|
|
@ -10,7 +10,7 @@ import { |
|
|
|
VerticalAdaptLayout, |
|
|
|
VerticalAdaptLayout, |
|
|
|
deepClone, |
|
|
|
deepClone, |
|
|
|
Selection, |
|
|
|
Selection, |
|
|
|
size |
|
|
|
SIZE_CONSANTS |
|
|
|
} from "@/core"; |
|
|
|
} from "@/core"; |
|
|
|
import { Single, Combo } from "@/base"; |
|
|
|
import { Single, Combo } from "@/base"; |
|
|
|
import { MultiTreeSearcher } from "./trigger/searcher.multi.tree"; |
|
|
|
import { MultiTreeSearcher } from "./trigger/searcher.multi.tree"; |
|
|
@ -27,15 +27,12 @@ export class MultiTreeCombo extends Single { |
|
|
|
|
|
|
|
|
|
|
|
static EVENT_FOCUS = "EVENT_FOCUS"; |
|
|
|
static EVENT_FOCUS = "EVENT_FOCUS"; |
|
|
|
static EVENT_BLUR = "EVENT_BLUR"; |
|
|
|
static EVENT_BLUR = "EVENT_BLUR"; |
|
|
|
static EVENT_START = "EVENT_START"; |
|
|
|
|
|
|
|
static EVENT_STOP = "EVENT_STOP"; |
|
|
|
static EVENT_STOP = "EVENT_STOP"; |
|
|
|
static EVENT_SEARCHING = "EVENT_SEARCHING"; |
|
|
|
static EVENT_SEARCHING = "EVENT_SEARCHING"; |
|
|
|
static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; |
|
|
|
static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; |
|
|
|
static EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
static EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
|
|
|
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
|
|
|
static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; |
|
|
|
static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; |
|
|
|
static EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW = "EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW"; |
|
|
|
|
|
|
|
static EVENT_AFTER_NUMBER_COUNTER_POPUPVIEW = "EVENT_AFTER_NUMBER_COUNTER_POPUPVIEW"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_defaultConfig() { |
|
|
|
_defaultConfig() { |
|
|
|
return extend(super._defaultConfig(...arguments), { |
|
|
|
return extend(super._defaultConfig(...arguments), { |
|
|
@ -45,8 +42,6 @@ export class MultiTreeCombo extends Single { |
|
|
|
height: 24, |
|
|
|
height: 24, |
|
|
|
allowEdit: true, |
|
|
|
allowEdit: true, |
|
|
|
isNeedAdjustWidth: true, |
|
|
|
isNeedAdjustWidth: true, |
|
|
|
popup: {}, |
|
|
|
|
|
|
|
masker: {}, |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -68,20 +63,23 @@ export class MultiTreeCombo extends Single { |
|
|
|
this.storeValue = { value: o.value || {} }; |
|
|
|
this.storeValue = { value: o.value || {} }; |
|
|
|
|
|
|
|
|
|
|
|
this.trigger = createWidget({ |
|
|
|
this.trigger = createWidget({ |
|
|
|
type: MultiSelectTrigger.xtype, |
|
|
|
type: "bi.multi_select_trigger", |
|
|
|
popup: o.popup, |
|
|
|
|
|
|
|
masker: o.masker, |
|
|
|
|
|
|
|
allowEdit: o.allowEdit, |
|
|
|
allowEdit: o.allowEdit, |
|
|
|
height: toPix(o.height, o.simple ? 1 : 2), |
|
|
|
height: toPix(o.height, o.simple ? 1 : 2), |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
text: o.text, |
|
|
|
text: o.text, |
|
|
|
defaultText: o.defaultText, |
|
|
|
defaultText: o.defaultText, |
|
|
|
watermark: o.watermark, |
|
|
|
watermark: o.watermark, |
|
|
|
adapter: () => { |
|
|
|
masker: { |
|
|
|
return this.popup.getView(); |
|
|
|
offset: { |
|
|
|
|
|
|
|
left: 0, |
|
|
|
|
|
|
|
top: 0, |
|
|
|
|
|
|
|
right: 0, |
|
|
|
|
|
|
|
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
searcher: { |
|
|
|
searcher: { |
|
|
|
type: MultiTreeSearcher.xtype, |
|
|
|
type: "bi.multi_tree_searcher", |
|
|
|
itemsCreator: o.itemsCreator, |
|
|
|
itemsCreator: o.itemsCreator, |
|
|
|
listeners: [ |
|
|
|
listeners: [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -106,6 +104,8 @@ export class MultiTreeCombo extends Single { |
|
|
|
type: MultiTreePopup.xtype, |
|
|
|
type: MultiTreePopup.xtype, |
|
|
|
ref() { |
|
|
|
ref() { |
|
|
|
self.popup = this; |
|
|
|
self.popup = this; |
|
|
|
|
|
|
|
self.trigger.setAdapter(this); |
|
|
|
|
|
|
|
self.numberCounter.setAdapter(this); |
|
|
|
}, |
|
|
|
}, |
|
|
|
listeners: [ |
|
|
|
listeners: [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -160,16 +160,13 @@ export class MultiTreeCombo extends Single { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
maxWidth: o.isNeedAdjustWidth ? "auto" : 500, |
|
|
|
maxWidth: o.isNeedAdjustWidth ? "auto" : 500, |
|
|
|
...o.popup, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
isNeedAdjustWidth: o.isNeedAdjustWidth, |
|
|
|
isNeedAdjustWidth: o.isNeedAdjustWidth, |
|
|
|
value: { value: o.value || {} }, |
|
|
|
value: { value: o.value || {} }, |
|
|
|
hideChecker(e) { |
|
|
|
hideChecker(e) { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
triggerBtn.element.find(e.target).length === 0 && |
|
|
|
triggerBtn.element.find(e.target).length === 0 && |
|
|
|
size(self.numberCounter.getView()?.element.find(e.target)) === 0 && |
|
|
|
self.numberCounter.element.find(e.target).length === 0 |
|
|
|
size(self.trigger.getSearcher().getSearcher().getView()?.element.find(e.target)) === 0 && |
|
|
|
|
|
|
|
self.trigger.getSearcher().getSearcher().getView()?.element[0] !== e.target |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
@ -185,6 +182,7 @@ export class MultiTreeCombo extends Single { |
|
|
|
return self.combo.isViewVisible(); |
|
|
|
return self.combo.isViewVisible(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let shouldComboPopulate = true; |
|
|
|
this.trigger.on(MultiSelectTrigger.EVENT_FOCUS, () => { |
|
|
|
this.trigger.on(MultiSelectTrigger.EVENT_FOCUS, () => { |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_FOCUS); |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_FOCUS); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -196,7 +194,6 @@ export class MultiTreeCombo extends Single { |
|
|
|
self.storeValue = { value: self.combo.getValue() }; |
|
|
|
self.storeValue = { value: self.combo.getValue() }; |
|
|
|
this.setValue(self.storeValue); |
|
|
|
this.setValue(self.storeValue); |
|
|
|
self.numberCounter.setValue(self.storeValue); |
|
|
|
self.numberCounter.setValue(self.storeValue); |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_START); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
this.trigger.on(MultiSelectTrigger.EVENT_STOP, function () { |
|
|
|
this.trigger.on(MultiSelectTrigger.EVENT_STOP, function () { |
|
|
|
self.storeValue = { value: this.getValue() }; |
|
|
|
self.storeValue = { value: this.getValue() }; |
|
|
@ -263,14 +260,14 @@ export class MultiTreeCombo extends Single { |
|
|
|
} |
|
|
|
} |
|
|
|
self.combo.setValue(self.storeValue); |
|
|
|
self.combo.setValue(self.storeValue); |
|
|
|
self.numberCounter.setValue(self.storeValue); |
|
|
|
self.numberCounter.setValue(self.storeValue); |
|
|
|
self.populate(); |
|
|
|
shouldComboPopulate && self.populate(); |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.combo.on(Combo.EVENT_BEFORE_HIDEVIEW, () => { |
|
|
|
this.combo.on(Combo.EVENT_BEFORE_HIDEVIEW, () => { |
|
|
|
if (isSearching()) { |
|
|
|
if (isSearching()) { |
|
|
|
self._stopEditing(); |
|
|
|
self._stopEditing(); |
|
|
|
self._dataChange && |
|
|
|
self._dataChange && |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_CONFIRM); |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_CONFIRM); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (isPopupView()) { |
|
|
|
if (isPopupView()) { |
|
|
|
self._stopEditing(); |
|
|
|
self._stopEditing(); |
|
|
@ -279,7 +276,7 @@ export class MultiTreeCombo extends Single { |
|
|
|
self.storeValue = { value: {} }; |
|
|
|
self.storeValue = { value: {} }; |
|
|
|
} |
|
|
|
} |
|
|
|
self._dataChange && |
|
|
|
self._dataChange && |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_CONFIRM); |
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_CONFIRM); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
clear = false; |
|
|
|
clear = false; |
|
|
@ -299,26 +296,39 @@ export class MultiTreeCombo extends Single { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.numberCounter = createWidget({ |
|
|
|
this.numberCounter = createWidget({ |
|
|
|
type: MultiSelectCheckSelectedSwitcher, |
|
|
|
type: "bi.multi_select_check_selected_switcher", |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
|
|
|
|
// type: "bi.multi_tree_check_selected_button",
|
|
|
|
type: MultiTreeCheckSelectedButton.xtype, |
|
|
|
type: MultiTreeCheckSelectedButton.xtype, |
|
|
|
}, |
|
|
|
}, |
|
|
|
popup: { |
|
|
|
popup: { |
|
|
|
|
|
|
|
// type: "bi.multi_tree_check_pane",
|
|
|
|
type: MultiTreeCheckPane.xtype, |
|
|
|
type: MultiTreeCheckPane.xtype, |
|
|
|
...o.popup, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
adapter: () => { |
|
|
|
masker: { |
|
|
|
return this.popup.getView(); |
|
|
|
offset: { |
|
|
|
|
|
|
|
left: 0, |
|
|
|
|
|
|
|
top: 0, |
|
|
|
|
|
|
|
right: 0, |
|
|
|
|
|
|
|
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
masker: o.masker, |
|
|
|
|
|
|
|
itemsCreator: o.itemsCreator, |
|
|
|
itemsCreator: o.itemsCreator, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
value: { value: o.value || {} }, |
|
|
|
value: { value: o.value || {} }, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.numberCounter.on( |
|
|
|
|
|
|
|
MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_COMBO, |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
self.populate(); |
|
|
|
|
|
|
|
shouldComboPopulate = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
this.numberCounter.on( |
|
|
|
this.numberCounter.on( |
|
|
|
MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, |
|
|
|
MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
if (!self.combo.isViewVisible()) { |
|
|
|
if (!self.combo.isViewVisible()) { |
|
|
|
|
|
|
|
shouldComboPopulate = false; |
|
|
|
self.combo.showView(); |
|
|
|
self.combo.showView(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -333,12 +343,8 @@ export class MultiTreeCombo extends Single { |
|
|
|
want2showCounter = null; |
|
|
|
want2showCounter = null; |
|
|
|
showCounter(); |
|
|
|
showCounter(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.fireEvent(MultiTreeCombo.EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_AFTER_POPUPVIEW, function() { |
|
|
|
|
|
|
|
self.fireEvent(MultiTreeCombo.EVENT_AFTER_NUMBER_COUNTER_POPUPVIEW); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.numberCounter.on(Events.VIEW, b => { |
|
|
|
this.numberCounter.on(Events.VIEW, b => { |
|
|
|
nextTick(() => { |
|
|
|
nextTick(() => { |
|
|
@ -446,16 +452,4 @@ export class MultiTreeCombo extends Single { |
|
|
|
setWaterMark(v) { |
|
|
|
setWaterMark(v) { |
|
|
|
this.trigger.setWaterMark(v); |
|
|
|
this.trigger.setWaterMark(v); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getPopup() { |
|
|
|
|
|
|
|
return this.popup; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getNumberCounter() { |
|
|
|
|
|
|
|
return this.numberCounter; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getTrigger() { |
|
|
|
|
|
|
|
return this.trigger; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|