|
|
@ -5,16 +5,32 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, { |
|
|
|
|
|
|
|
|
|
|
|
props: function () { |
|
|
|
props: function () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
extraCls: "bi-search-text-value-trigger", |
|
|
|
baseCls: "bi-search-text-value-trigger", |
|
|
|
height: 24, |
|
|
|
height: 24, |
|
|
|
watermark: BI.i18nText("BI-Basic_Search") |
|
|
|
watermark: BI.i18nText("BI-Basic_Search"), |
|
|
|
|
|
|
|
allowClear: false, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this, o = this.options; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var triggerButton = { |
|
|
|
|
|
|
|
type: "bi.trigger_icon_button", |
|
|
|
|
|
|
|
cls: "trigger-icon-button", |
|
|
|
|
|
|
|
ref: function () { |
|
|
|
|
|
|
|
self.triggerBtn = this; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
width: o.height, |
|
|
|
|
|
|
|
height: o.height, |
|
|
|
|
|
|
|
width: 24, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var stateText = this._digest(o.value, o.items); |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
type: "bi.htape", |
|
|
|
type: "bi.horizontal_fill", |
|
|
|
|
|
|
|
columnSize: ["fill", 24], |
|
|
|
items: [ |
|
|
|
items: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
el: { |
|
|
|
el: { |
|
|
@ -30,7 +46,7 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
watermark: o.watermark, |
|
|
|
watermark: o.watermark, |
|
|
|
defaultText: o.defaultText, |
|
|
|
defaultText: o.defaultText, |
|
|
|
text: this._digest(o.value, o.items), |
|
|
|
text: stateText, |
|
|
|
value: o.value, |
|
|
|
value: o.value, |
|
|
|
height: o.height, |
|
|
|
height: o.height, |
|
|
|
tipText: "" |
|
|
|
tipText: "" |
|
|
@ -55,10 +71,30 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, { |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
} |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
|
|
|
|
el: o.allowClear ? { |
|
|
|
|
|
|
|
type: "bi.vertical_adapt", |
|
|
|
|
|
|
|
horizontalAlign: "left", |
|
|
|
|
|
|
|
scrollable: false, |
|
|
|
|
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "bi.layout", |
|
|
|
type: "bi.icon_button", |
|
|
|
width: 24 |
|
|
|
ref: function (_ref) { |
|
|
|
|
|
|
|
self.clearBtn = _ref; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
cls: "close-h-font " + (o.allowClear ? "clear-button" : ""), |
|
|
|
|
|
|
|
stopPropagation: true, |
|
|
|
|
|
|
|
invisible: !BI.isNotEmptyString(stateText), |
|
|
|
|
|
|
|
width: o.height, |
|
|
|
|
|
|
|
handler: function () { |
|
|
|
|
|
|
|
self.fireEvent(BI.SearchTextValueTrigger.EVENT_CLEAR); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
el: triggerButton, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
} : triggerButton, |
|
|
|
width: 24 |
|
|
|
width: 24 |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
@ -100,7 +136,9 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (vals) { |
|
|
|
setValue: function (vals) { |
|
|
|
this._setState(this._digest(vals, this.options.items)); |
|
|
|
var stateText = this._digest(vals, this.options.items); |
|
|
|
|
|
|
|
this._setState(stateText); |
|
|
|
|
|
|
|
this.options.allowClear && this.clearBtn.setVisible(BI.isNotEmptyString(stateText)); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
getValue: function () { |
|
|
|