mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
fix(select): RTL fix for searchbar (#11355)
* fix(select): RTL fix for searchbar RTL fix for searchbar component * fix bad reference I forgot to refrence _isRTL * use platform variable instead of method * space indent instead of tab indent * Remove scss changes per request PR - #11342 - covers the scss, and is about done
This commit is contained in:
@ -238,13 +238,21 @@ export class Searchbar extends BaseInput<string> {
|
|||||||
|
|
||||||
// Set the input padding start
|
// Set the input padding start
|
||||||
var inputLeft = 'calc(50% - ' + (textWidth / 2) + 'px)';
|
var inputLeft = 'calc(50% - ' + (textWidth / 2) + 'px)';
|
||||||
|
if (this._plt.isRTL) {
|
||||||
|
inputEle.style.paddingRight = inputLeft;
|
||||||
|
} else {
|
||||||
inputEle.style.paddingLeft = inputLeft;
|
inputEle.style.paddingLeft = inputLeft;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the icon margin start
|
// Set the icon margin start
|
||||||
var iconLeft = 'calc(50% - ' + ((textWidth / 2) + 30) + 'px)';
|
var iconLeft = 'calc(50% - ' + ((textWidth / 2) + 30) + 'px)';
|
||||||
|
if (this._plt.isRTL) {
|
||||||
|
iconEle.style.marginRight = iconLeft;
|
||||||
|
} else {
|
||||||
iconEle.style.marginLeft = iconLeft;
|
iconEle.style.marginLeft = iconLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
@ -257,15 +265,23 @@ export class Searchbar extends BaseInput<string> {
|
|||||||
var cancelStyle = cancelStyleEle.style;
|
var cancelStyle = cancelStyleEle.style;
|
||||||
this._isCancelVisible = showShowCancel;
|
this._isCancelVisible = showShowCancel;
|
||||||
if (showShowCancel) {
|
if (showShowCancel) {
|
||||||
|
if (this._plt.isRTL) {
|
||||||
|
cancelStyle.marginLeft = '0';
|
||||||
|
} else {
|
||||||
cancelStyle.marginRight = '0';
|
cancelStyle.marginRight = '0';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var offset = cancelStyleEle.offsetWidth;
|
var offset = cancelStyleEle.offsetWidth;
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
|
if (this._plt.isRTL) {
|
||||||
|
cancelStyle.marginLeft = -offset + 'px';
|
||||||
|
} else {
|
||||||
cancelStyle.marginRight = -offset + 'px';
|
cancelStyle.marginRight = -offset + 'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user