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 REQ_GET_ALL_DATA = "-1";
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";
@ -64,6 +65,8 @@ export class MultiSelectInsertCombo extends Single {
height: 24, height: 24,
itemHeight: SIZE_CONSANTS.LIST_ITEM_HEIGHT, itemHeight: SIZE_CONSANTS.LIST_ITEM_HEIGHT,
allowEdit: true, allowEdit: true,
popup: {},
masker: {},
}); });
} }
@ -99,6 +102,8 @@ export class MultiSelectInsertCombo extends Single {
this.trigger = createWidget({ this.trigger = createWidget({
type: MultiSelectInsertTrigger.xtype, type: MultiSelectInsertTrigger.xtype,
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),
text: o.text, text: o.text,
@ -124,6 +129,7 @@ export class MultiSelectInsertCombo extends Single {
this.trigger.on(MultiSelectInsertTrigger.EVENT_START, function() { this.trigger.on(MultiSelectInsertTrigger.EVENT_START, function() {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
self.fireEvent(MultiSelectInsertCombo.EVENT_START);
}); });
this.trigger.on(MultiSelectInsertTrigger.EVENT_STOP, () => { this.trigger.on(MultiSelectInsertTrigger.EVENT_STOP, () => {
self._setStartValue(""); self._setStartValue("");
@ -249,7 +255,8 @@ export class MultiSelectInsertCombo extends Single {
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 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() { getNumberCounter() {
return this.numberCounter; 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, itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
watermark: o.watermark, watermark: o.watermark,
popup: {}, popup: o.popup,
adapter: o.adapter, adapter: o.adapter,
masker: o.masker, masker: o.masker,
value: o.value, value: o.value,

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

@ -50,7 +50,7 @@ export class MultiSelectTrigger extends Trigger {
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter, itemFormatter: o.itemFormatter,
watermark: o.watermark, watermark: o.watermark,
popup: {}, popup: o.popup,
adapter: o.adapter, adapter: o.adapter,
masker: o.masker, masker: o.masker,
value: o.value, 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() { adjustView() {
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_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";
@ -43,6 +44,8 @@ export class MultiTreeCombo extends Single {
height: 24, height: 24,
allowEdit: true, allowEdit: true,
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
popup: {},
masker: {},
}); });
} }
@ -64,7 +67,9 @@ export class MultiTreeCombo extends Single {
this.storeValue = { value: o.value || {} }; this.storeValue = { value: o.value || {} };
this.trigger = createWidget({ this.trigger = createWidget({
type: "bi.multi_select_trigger", type: MultiSelectTrigger.xtype,
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,
@ -75,7 +80,7 @@ export class MultiTreeCombo extends Single {
return this.popup.getView(); return this.popup.getView();
}, },
searcher: { searcher: {
type: "bi.multi_tree_searcher", type: MultiTreeSearcher.xtype,
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
listeners: [ listeners: [
{ {
@ -161,7 +166,9 @@ export class MultiTreeCombo extends Single {
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 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() }; 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() };
@ -442,4 +450,8 @@ export class MultiTreeCombo extends Single {
getNumberCounter() { getNumberCounter() {
return this.numberCounter; 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(); return this.editor.getState();
} }
getSearcher() {
return this.searcher;
}
setValue(ob) { setValue(ob) {
this.setState(ob); this.setState(ob);
this.searcher.setValue(ob); this.searcher.setValue(ob);

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

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

Loading…
Cancel
Save