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