|
|
|
@ -7,25 +7,27 @@
|
|
|
|
|
*/ |
|
|
|
|
BI.TextTrigger = BI.inherit(BI.Trigger, { |
|
|
|
|
|
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
props: function () { |
|
|
|
|
var self = this; |
|
|
|
|
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); |
|
|
|
|
return BI.extend(conf, { |
|
|
|
|
baseCls: (conf.baseCls || "") + " bi-text-trigger", |
|
|
|
|
return { |
|
|
|
|
baseCls: "bi-text-trigger", |
|
|
|
|
height: 24, |
|
|
|
|
textHgap: 6, |
|
|
|
|
textCls: "", |
|
|
|
|
allowClear: false, |
|
|
|
|
title: function () { |
|
|
|
|
return self.text.getText(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.TextTrigger.superclass._init.apply(this, arguments); |
|
|
|
|
render: function () { |
|
|
|
|
var self = this, o = this.options, c = this._const; |
|
|
|
|
this.text = BI.createWidget({ |
|
|
|
|
var text = { |
|
|
|
|
type: "bi.label", |
|
|
|
|
ref: function (_ref) { |
|
|
|
|
self.text = _ref; |
|
|
|
|
}, |
|
|
|
|
cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), |
|
|
|
|
textAlign: "left", |
|
|
|
|
height: o.height, |
|
|
|
@ -39,32 +41,69 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
tgap: o.textTgap, |
|
|
|
|
bgap: o.textBgap, |
|
|
|
|
readonly: o.readonly |
|
|
|
|
}); |
|
|
|
|
this.trigerButton = BI.createWidget({ |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var triggerButton = { |
|
|
|
|
type: "bi.trigger_icon_button", |
|
|
|
|
ref: function (_ref) { |
|
|
|
|
self.triggerButton = _ref; |
|
|
|
|
}, |
|
|
|
|
width: o.triggerWidth || o.height |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.createWidget({ |
|
|
|
|
element: this, |
|
|
|
|
return ({ |
|
|
|
|
type: "bi.horizontal_fill", |
|
|
|
|
items: [ |
|
|
|
|
{ |
|
|
|
|
el: this.text, |
|
|
|
|
el: text, |
|
|
|
|
width: "fill" |
|
|
|
|
}, { |
|
|
|
|
el: this.trigerButton, |
|
|
|
|
width: o.triggerWidth || o.height |
|
|
|
|
type: "bi.vertical_adapt", |
|
|
|
|
horizontalAlign: "left", |
|
|
|
|
width: o.triggerWidth || o.height, |
|
|
|
|
scrollable: false, |
|
|
|
|
items: [ |
|
|
|
|
{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.icon_button", |
|
|
|
|
ref: function (_ref) { |
|
|
|
|
self.clearBtn = _ref; |
|
|
|
|
}, |
|
|
|
|
cls: "close-h-font", |
|
|
|
|
stopPropagation: true, |
|
|
|
|
handler: function () { |
|
|
|
|
self.fireEvent(BI.TextTrigger.EVENT_CLEAR); |
|
|
|
|
self.clearBtn.setVisible(false); |
|
|
|
|
}, |
|
|
|
|
invisible: true, |
|
|
|
|
}, |
|
|
|
|
width: o.triggerWidth || o.height |
|
|
|
|
}, { |
|
|
|
|
el: triggerButton, |
|
|
|
|
width: o.triggerWidth || o.height |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getTextor: function() { |
|
|
|
|
mounted: function () { |
|
|
|
|
var self = this; |
|
|
|
|
if (this.options.allowClear) { |
|
|
|
|
this.element.hover(function () { |
|
|
|
|
BI.isKey(self.text.getText()) && self.clearBtn.setVisible(true); |
|
|
|
|
}, function () { |
|
|
|
|
self.clearBtn.setVisible(false); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getTextor: function () { |
|
|
|
|
return this.text; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setTextCls: function(cls) { |
|
|
|
|
setTextCls: function (cls) { |
|
|
|
|
var o = this.options; |
|
|
|
|
var oldCls = o.textCls; |
|
|
|
|
o.textCls = cls; |
|
|
|
@ -80,4 +119,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
this.options.tipType = v; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
BI.TextTrigger.EVENT_CLEAR = "EVENT_CLEAR"; |
|
|
|
|
BI.shortcut("bi.text_trigger", BI.TextTrigger); |
|
|
|
|