Browse Source

KERNEL-18940 refactor: 处理搜索,新增一些属性和方法

master
Jimmy.Chai 4 months ago
parent
commit
d161133498
  1. 13
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.js
  2. 2
      packages/fineui/src/widget/multiselect/multiselect.insert.trigger.js
  3. 2
      packages/fineui/src/widget/multiselect/multiselect.trigger.js
  4. 4
      packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js
  5. 18
      packages/fineui/src/widget/multitree/multi.tree.combo.js
  6. 4
      packages/fineui/src/widget/multitree/trigger/searcher.multi.tree.js
  7. 18
      packages/fineui/src/widget/singleselect/singleselect.insert.combo.js
  8. 4
      packages/fineui/src/widget/singleselect/trigger/searcher.singleselect.js

13
packages/fineui/src/widget/multiselect/multiselect.insert.combo.js

@ -47,6 +47,7 @@ export class MultiSelectInsertCombo extends Single {
static REQ_GET_ALL_DATA = "-1";
static EVENT_FOCUS = "EVENT_FOCUS";
static EVENT_BLUR = "EVENT_BLUR";
static EVENT_START = "EVENT_START";
static EVENT_STOP = "EVENT_STOP";
static EVENT_SEARCHING = "EVENT_SEARCHING";
static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
@ -64,6 +65,8 @@ export class MultiSelectInsertCombo extends Single {
height: 24,
itemHeight: SIZE_CONSANTS.LIST_ITEM_HEIGHT,
allowEdit: true,
popup: {},
masker: {},
});
}
@ -99,6 +102,8 @@ export class MultiSelectInsertCombo extends Single {
this.trigger = createWidget({
type: MultiSelectInsertTrigger.xtype,
popup: o.popup,
masker: o.masker,
allowEdit: o.allowEdit,
height: toPix(o.height, o.simple ? 1 : 2),
text: o.text,
@ -124,6 +129,7 @@ export class MultiSelectInsertCombo extends Single {
this.trigger.on(MultiSelectInsertTrigger.EVENT_START, function() {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
self.fireEvent(MultiSelectInsertCombo.EVENT_START);
});
this.trigger.on(MultiSelectInsertTrigger.EVENT_STOP, () => {
self._setStartValue("");
@ -249,7 +255,8 @@ export class MultiSelectInsertCombo extends Single {
hideChecker(e) {
return (
triggerBtn.element.find(e.target).length === 0 &&
size(self.numberCounter.getView()?.element.find(e.target)) === 0
size(self.numberCounter.getView()?.element.find(e.target)) === 0 &&
size(self.trigger.getSearcher().getSearcher().getView()?.element.find(e.target)) === 0
);
},
});
@ -570,4 +577,8 @@ export class MultiSelectInsertCombo extends Single {
getNumberCounter() {
return this.numberCounter;
}
getTrigger() {
return this.trigger;
}
}

2
packages/fineui/src/widget/multiselect/multiselect.insert.trigger.js

@ -50,7 +50,7 @@ export class MultiSelectInsertTrigger extends Trigger {
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
watermark: o.watermark,
popup: {},
popup: o.popup,
adapter: o.adapter,
masker: o.masker,
value: o.value,

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

@ -50,7 +50,7 @@ export class MultiSelectTrigger extends Trigger {
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
watermark: o.watermark,
popup: {},
popup: o.popup,
adapter: o.adapter,
masker: o.masker,
value: o.value,

4
packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -132,6 +132,10 @@ export class MultiSelectInsertSearcher extends Widget {
}
}
getSearcher() {
return this.searcher;
}
adjustView() {
this.searcher.adjustView();
}

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

@ -27,6 +27,7 @@ export class MultiTreeCombo extends Single {
static EVENT_FOCUS = "EVENT_FOCUS";
static EVENT_BLUR = "EVENT_BLUR";
static EVENT_START = "EVENT_START";
static EVENT_STOP = "EVENT_STOP";
static EVENT_SEARCHING = "EVENT_SEARCHING";
static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
@ -43,6 +44,8 @@ export class MultiTreeCombo extends Single {
height: 24,
allowEdit: true,
isNeedAdjustWidth: true,
popup: {},
masker: {},
});
}
@ -64,7 +67,9 @@ export class MultiTreeCombo extends Single {
this.storeValue = { value: o.value || {} };
this.trigger = createWidget({
type: "bi.multi_select_trigger",
type: MultiSelectTrigger.xtype,
popup: o.popup,
masker: o.masker,
allowEdit: o.allowEdit,
height: toPix(o.height, o.simple ? 1 : 2),
valueFormatter: o.valueFormatter,
@ -75,7 +80,7 @@ export class MultiTreeCombo extends Single {
return this.popup.getView();
},
searcher: {
type: "bi.multi_tree_searcher",
type: MultiTreeSearcher.xtype,
itemsCreator: o.itemsCreator,
listeners: [
{
@ -161,7 +166,9 @@ export class MultiTreeCombo extends Single {
hideChecker(e) {
return (
triggerBtn.element.find(e.target).length === 0 &&
size(self.numberCounter.getView()?.element.find(e.target)) === 0
size(self.numberCounter.getView()?.element.find(e.target)) === 0 &&
size(self.trigger.getSearcher().getSearcher().getView()?.element.find(e.target)) === 0 &&
self.trigger.getSearcher().getSearcher().getView()?.element[0] !== e.target
);
},
});
@ -188,6 +195,7 @@ export class MultiTreeCombo extends Single {
self.storeValue = { value: self.combo.getValue() };
this.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue);
self.fireEvent(MultiTreeCombo.EVENT_START);
});
this.trigger.on(MultiSelectTrigger.EVENT_STOP, function () {
self.storeValue = { value: this.getValue() };
@ -442,4 +450,8 @@ export class MultiTreeCombo extends Single {
getNumberCounter() {
return this.numberCounter;
}
getTrigger() {
return this.trigger;
}
}

4
packages/fineui/src/widget/multitree/trigger/searcher.multi.tree.js

@ -220,6 +220,10 @@ export class MultiTreeSearcher extends Widget {
return this.editor.getState();
}
getSearcher() {
return this.searcher;
}
setValue(ob) {
this.setState(ob);
this.searcher.setValue(ob);

18
packages/fineui/src/widget/singleselect/singleselect.insert.combo.js

@ -10,7 +10,8 @@ import {
isNotNull,
nextTick,
AbsoluteLayout,
makeObject
makeObject,
size
} from "@/core";
import { Single, Combo } from "@/base";
import { SingleSelectTrigger } from "./singleselect.trigger";
@ -25,6 +26,7 @@ export class SingleSelectInsertCombo extends Single {
static REQ_GET_ALL_DATA = -1;
static EVENT_FOCUS = "EVENT_FOCUS";
static EVENT_BLUR = "EVENT_BLUR";
static EVENT_START = "EVENT_START";
static EVENT_STOP = "EVENT_STOP";
static EVENT_SEARCHING = "EVENT_SEARCHING";
static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
@ -41,6 +43,8 @@ export class SingleSelectInsertCombo extends Single {
height: 24,
allowEdit: true,
watermark: i18nText("BI-Basic_Search_And_Patch_Paste"),
popup: {},
masker: {},
});
}
@ -58,6 +62,7 @@ export class SingleSelectInsertCombo extends Single {
this.trigger = createWidget({
type: SingleSelectTrigger.xtype,
masker: o.masker,
watermark: o.watermark,
height: toPix(o.height, o.simple ? 1 : 2),
allowNoSelect: o.allowNoSelect,
@ -78,6 +83,7 @@ export class SingleSelectInsertCombo extends Single {
searcher: {
popup: {
type: SingleSelectSearchInsertPane.xtype,
...o.popup,
},
},
});
@ -92,6 +98,7 @@ export class SingleSelectInsertCombo extends Single {
this.trigger.on(SingleSelectTrigger.EVENT_START, function () {
self._setStartValue();
this.getSearcher().setValue(self.storeValue);
self.fireEvent(SingleSelectInsertCombo.EVENT_START);
});
this.trigger.on(SingleSelectTrigger.EVENT_STOP, () => {
self._setStartValue();
@ -160,7 +167,10 @@ export class SingleSelectInsertCombo extends Single {
...o.popup,
},
hideChecker(e) {
return triggerBtn.element.find(e.target).length === 0;
return (
triggerBtn.element.find(e.target).length === 0 &&
size(self.trigger.getSearcher().getSearcher().getView()?.element.find(e.target)) === 0
);
},
value: o.value,
});
@ -268,4 +278,8 @@ export class SingleSelectInsertCombo extends Single {
getPopup() {
return this.popup;
}
getTrigger() {
return this.trigger;
}
}

4
packages/fineui/src/widget/singleselect/trigger/searcher.singleselect.js

@ -131,6 +131,10 @@ export class SingleSelectSearcher extends Widget {
return this.searcher.getView() && this.searcher.getView().hasChecked();
}
getSearcher() {
return this.searcher;
}
setAdapter(adapter) {
this.searcher.setAdapter(adapter);
}

Loading…
Cancel
Save