You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.7 KiB
93 lines
2.7 KiB
/** |
|
* 文字trigger |
|
* |
|
* Created by GUY on 2015/9/15. |
|
* @class BI.IconTextTrigger |
|
* @extends BI.Trigger |
|
*/ |
|
BI.IconTextTrigger = BI.inherit(BI.Trigger, { |
|
|
|
_defaultConfig: function () { |
|
var conf = BI.IconTextTrigger.superclass._defaultConfig.apply(this, arguments); |
|
return BI.extend(conf, { |
|
baseCls: (conf.baseCls || "") + " bi-text-trigger", |
|
height: 24, |
|
iconHeight: null, |
|
iconWidth: null, |
|
textCls: "" |
|
}); |
|
}, |
|
|
|
_init: function () { |
|
BI.IconTextTrigger.superclass._init.apply(this, arguments); |
|
var self = this, o = this.options; |
|
this.text = BI.createWidget({ |
|
type: "bi.label", |
|
cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), |
|
textAlign: "left", |
|
height: o.height, |
|
hgap: o.textHgap, |
|
vgap: o.textVgap, |
|
lgap: o.textLgap, |
|
rgap: o.textRgap, |
|
tgap: o.textTgap, |
|
bgap: o.textBgap, |
|
text: o.text |
|
}); |
|
this.trigerButton = BI.createWidget({ |
|
type: "bi.trigger_icon_button", |
|
width: o.triggerWidth || o.height |
|
}); |
|
|
|
BI.createWidget({ |
|
element: this, |
|
type: "bi.horizontal_fill", |
|
columnSize: ["", "fill", ""], |
|
ref: function (_ref) { |
|
self.wrapper = _ref; |
|
}, |
|
items: [{ |
|
el: { |
|
type: "bi.icon_change_button", |
|
cls: "icon-combo-trigger-icon", |
|
width: o.triggerWidth || o.height, |
|
iconCls: o.iconCls, |
|
invisible: !o.iconCls, |
|
ref: function (_ref) { |
|
self.icon = _ref; |
|
}, |
|
iconHeight: o.iconHeight, |
|
iconWidth: o.iconWidth, |
|
disableSelected: true |
|
} |
|
}, { |
|
el: this.text, |
|
lgap: BI.isEmptyString(o.iconCls) ? 5 : 0 |
|
}, { |
|
el: this.trigerButton |
|
}] |
|
}); |
|
}, |
|
|
|
setValue: function (value) { |
|
this.text.setValue(value); |
|
}, |
|
|
|
setIcon: function (iconCls) { |
|
var o = this.options; |
|
this.icon.setIcon(iconCls); |
|
this.icon.setVisible(!!iconCls); |
|
}, |
|
|
|
setTextCls: function (cls) { |
|
var o = this.options; |
|
var oldCls = o.textCls; |
|
o.textCls = cls; |
|
this.text.element.removeClass(oldCls).addClass(cls); |
|
}, |
|
|
|
setText: function (text) { |
|
this.text.setText(text); |
|
} |
|
}); |
|
BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);
|
|
|