Skip to content

Commit 7bcf5a0

Browse files
committed
fix(util): pass an option to default to right side in isRightSide
1 parent 67af71b commit 7bcf5a0

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/components/item/item-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class ItemOptions {
5151
* @hidden
5252
*/
5353
isRightSide(): boolean {
54-
return isRightSide(this.side, this._plt.isRTL);
54+
return isRightSide(this.side, this._plt.isRTL, true);
5555
}
5656

5757
/**

src/util/util.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,24 @@ export function isCheckedProperty(a: any, b: any): boolean {
128128
return (a == b); // tslint:disable-line
129129
};
130130

131+
/** @hidden */
131132
export type Side = 'left' | 'right' | 'start' | 'end';
132133

133-
export function isRightSide(side: Side, isRTL: boolean): boolean {
134+
/**
135+
* @hidden
136+
* Given a side, return if it should be on the right
137+
* based on the value of dir
138+
* @param side the side
139+
* @param isRTL whether the application dir is rtl
140+
* @param defaultRight whether the default side is right
141+
*/
142+
export function isRightSide(side: Side, isRTL: boolean, defaultRight: boolean = false): boolean {
134143
switch (side) {
135144
case 'right': return true;
136145
case 'left': return false;
137146
case 'end': return !isRTL;
138-
// 'start' by default
139-
default: return isRTL;
147+
case 'start': return isRTL;
148+
default: return defaultRight ? !isRTL : isRTL;
140149
}
141150
}
142151

0 commit comments

Comments
 (0)