|
|
|
@ -8,6 +8,7 @@ export class IconCombo extends Widget {
|
|
|
|
|
static xtype = "bi.icon_combo"; |
|
|
|
|
|
|
|
|
|
static EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
|
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
|
|
|
|
|
|
|
|
|
_defaultConfig() { |
|
|
|
|
return extend(super._defaultConfig(...arguments), { |
|
|
|
@ -55,18 +56,18 @@ export class IconCombo extends Widget {
|
|
|
|
|
value: o.value, |
|
|
|
|
isShowDown: o.isShowDown, |
|
|
|
|
}); |
|
|
|
|
this.popup = createWidget(o.popup, { |
|
|
|
|
this.popupEl = createWidget(o.popup, { |
|
|
|
|
type: IconComboPopup.xtype, |
|
|
|
|
chooseType: o.chooseType, |
|
|
|
|
items: o.items, |
|
|
|
|
value: o.value, |
|
|
|
|
}); |
|
|
|
|
this.popup.on(IconComboPopup.EVENT_CHANGE, () => { |
|
|
|
|
this.setValue(this.popup.getValue()); |
|
|
|
|
this.popupEl.on(IconComboPopup.EVENT_CHANGE, () => { |
|
|
|
|
this.setValue(this.popupEl.getValue()); |
|
|
|
|
this.iconCombo.hideView(); |
|
|
|
|
this.fireEvent(IconCombo.EVENT_CHANGE); |
|
|
|
|
}); |
|
|
|
|
this.popup.on(Controller.EVENT_CHANGE, (...args) => { |
|
|
|
|
this.popupEl.on(Controller.EVENT_CHANGE, (...args) => { |
|
|
|
|
this.fireEvent(Controller.EVENT_CHANGE, ...args); |
|
|
|
|
}); |
|
|
|
|
this.iconCombo = createWidget({ |
|
|
|
@ -82,11 +83,20 @@ export class IconCombo extends Widget {
|
|
|
|
|
el: this.trigger, |
|
|
|
|
hideWhenAnotherComboOpen: o.hideWhenAnotherComboOpen, |
|
|
|
|
popup: { |
|
|
|
|
el: this.popup, |
|
|
|
|
el: this.popupEl, |
|
|
|
|
maxWidth: o.maxWidth, |
|
|
|
|
maxHeight: o.maxHeight, |
|
|
|
|
minWidth: o.minWidth, |
|
|
|
|
ref: (ref) => { |
|
|
|
|
this.popup = ref; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: Combo.EVENT_BEFORE_POPUPVIEW, |
|
|
|
|
action: () => { |
|
|
|
|
this.fireEvent(IconCombo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -100,15 +110,19 @@ export class IconCombo extends Widget {
|
|
|
|
|
|
|
|
|
|
setValue(v) { |
|
|
|
|
this.trigger.setValue(v); |
|
|
|
|
this.popup.setValue(v); |
|
|
|
|
this.popupEl.setValue(v); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getValue() { |
|
|
|
|
const value = this.popup.getValue(); |
|
|
|
|
const value = this.popupEl.getValue(); |
|
|
|
|
|
|
|
|
|
return isNull(value) ? [] : isArray(value) ? value : [value]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getPopup() { |
|
|
|
|
return this.popup; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
populate(items) { |
|
|
|
|
this.options.items = items; |
|
|
|
|
this.iconCombo.populate(items); |
|
|
|
|