From 7bcf5a05f70b015196e82e1d338132dac83638e0 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Tue, 25 Apr 2017 13:54:37 -0400 Subject: [PATCH] fix(util): pass an option to default to right side in isRightSide --- src/components/item/item-options.ts | 2 +- src/util/util.ts | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/item/item-options.ts b/src/components/item/item-options.ts index 22cc117db7..13b86ca30c 100644 --- a/src/components/item/item-options.ts +++ b/src/components/item/item-options.ts @@ -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); } /** diff --git a/src/util/util.ts b/src/util/util.ts index abb67fb51d..1c577b97f0 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -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; } }