fix(item-options): improve rtl support (#11188)

* fix(item): Initial version of better rtl support

for sliding items

*Note:* need tests

* Update item-options.ts

* fix(item-options): fix changes requested
This commit is contained in:
John-Luke
2017-04-17 12:32:04 -03:00
committed by Brandy Carney
parent feeb2678a9
commit ea6450e96a

View File

@ -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';
@ -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;
}
/**