Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(item-options): rtl better suport #11188

Merged
merged 3 commits into from
Apr 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/components/item/item-options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Directive, ElementRef, EventEmitter, Input, Output, Renderer } from '@angular/core';

import { Platform } from '../../platform/platform';
import { isPresent} from '../../util/util';
import { ITEM_SIDE_FLAG_LEFT, ITEM_SIDE_FLAG_RIGHT, ItemSliding } from './item-sliding';

Expand Down Expand Up @@ -39,16 +40,25 @@ export class ItemOptions {
*/
@Output() ionSwipe: EventEmitter<ItemSliding> = new EventEmitter<ItemSliding>();

constructor(private _elementRef: ElementRef, private _renderer: Renderer) {}
constructor(private _elementRef: ElementRef, private _renderer: Renderer, private _plt: Platform) {}

/**
* @hidden
*/
getSides(): number {
if (isPresent(this.side) && this.side === 'left') {
return ITEM_SIDE_FLAG_LEFT;
if (isPresent(this.side)) {
switch (this.side) {
case 'left':
return ITEM_SIDE_FLAG_LEFT;
case 'right':
return ITEM_SIDE_FLAG_RIGHT;
case 'start':
return this._plt.isRTL() ? ITEM_SIDE_FLAG_RIGHT : ITEM_SIDE_FLAG_LEFT;
case 'end':
return this._plt.isRTL() ? ITEM_SIDE_FLAG_LEFT : ITEM_SIDE_FLAG_RIGHT;
}
}
return ITEM_SIDE_FLAG_RIGHT;
return this._plt.isRTL() ? ITEM_SIDE_FLAG_LEFT : ITEM_SIDE_FLAG_RIGHT;
}

/**
Expand Down