mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(util): pass an option to default to right side in isRightSide
This commit is contained in:
@ -51,7 +51,7 @@ export class ItemOptions {
|
||||
* @hidden
|
||||
*/
|
||||
isRightSide(): boolean {
|
||||
return isRightSide(this.side, this._plt.isRTL);
|
||||
return isRightSide(this.side, this._plt.isRTL, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,15 +128,24 @@ export function isCheckedProperty(a: any, b: any): boolean {
|
||||
return (a == b); // tslint:disable-line
|
||||
};
|
||||
|
||||
/** @hidden */
|
||||
export type Side = 'left' | 'right' | 'start' | 'end';
|
||||
|
||||
export function isRightSide(side: Side, isRTL: boolean): boolean {
|
||||
/**
|
||||
* @hidden
|
||||
* Given a side, return if it should be on the right
|
||||
* based on the value of dir
|
||||
* @param side the side
|
||||
* @param isRTL whether the application dir is rtl
|
||||
* @param defaultRight whether the default side is right
|
||||
*/
|
||||
export function isRightSide(side: Side, isRTL: boolean, defaultRight: boolean = false): boolean {
|
||||
switch (side) {
|
||||
case 'right': return true;
|
||||
case 'left': return false;
|
||||
case 'end': return !isRTL;
|
||||
// 'start' by default
|
||||
default: return isRTL;
|
||||
case 'start': return isRTL;
|
||||
default: return defaultRight ? !isRTL : isRTL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user