Browse Source

BI-148724 fix: 树控件查看已选项连发两次请求

master
chenzeyu 6 months ago
parent
commit
f00e4c5b6c
  1. 2
      packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js
  2. 11
      packages/fineui/src/widget/multitree/multi.tree.combo.js

2
packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js

@ -10,6 +10,7 @@ export class MultiSelectCheckSelectedSwitcher extends Widget {
static EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE"; static EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";
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_TRIGGER_COMBO = "EVENT_TRIGGER_COMBO";
_defaultConfig() { _defaultConfig() {
return extend(super._defaultConfig(...arguments), { return extend(super._defaultConfig(...arguments), {
@ -48,6 +49,7 @@ export class MultiSelectCheckSelectedSwitcher extends Widget {
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
onClickContinueSelect() { onClickContinueSelect() {
self.switcher.hideView(); self.switcher.hideView();
self.fireEvent(MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_COMBO);
}, },
ref(_ref) { ref(_ref) {
self.checkPane = _ref; self.checkPane = _ref;

11
packages/fineui/src/widget/multitree/multi.tree.combo.js

@ -182,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);
}); });
@ -259,7 +260,7 @@ 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, () => {
@ -316,10 +317,18 @@ export class MultiTreeCombo extends Single {
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();
} }
} }

Loading…
Cancel
Save