mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
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:
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user