Browse Source

KERNEL-18940 refactor: 新增一些属性和方法

master
Jimmy.Chai 4 months ago
parent
commit
504af4e069
  1. 5
      packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js
  2. 7
      packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js
  3. 17
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.js
  4. 4
      packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js
  5. 41
      packages/fineui/src/widget/multitree/multi.tree.combo.js
  6. 4
      packages/fineui/src/widget/multitree/multi.tree.popup.js
  7. 7
      packages/fineui/src/widget/singleselect/singleselect.insert.combo.js
  8. 18
      packages/fineui/src/widget/timeinterval/dateinterval.js
  9. 18
      packages/fineui/src/widget/timeinterval/timeinterval.js
  10. 5
      packages/fineui/src/widget/year/combo.year.js
  11. 5
      packages/fineui/src/widget/yearmonth/combo.yearmonth.js
  12. 18
      packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js
  13. 5
      packages/fineui/src/widget/yearquarter/combo.yearquarter.js

5
packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js

@ -261,6 +261,7 @@ export class DynamicDateCombo extends Single {
}, },
} }
], ],
...opts.popup,
}, },
}, },
// // DEC-4250 和复选下拉一样,点击triggerBtn不默认收起 // // DEC-4250 和复选下拉一样,点击triggerBtn不默认收起
@ -356,6 +357,10 @@ export class DynamicDateCombo extends Single {
return this.trigger.getKey(); return this.trigger.getKey();
} }
getPopup() {
return this.popup;
}
hidePopupView() { hidePopupView() {
this.combo.hideView(); this.combo.hideView();
} }

7
packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -271,7 +271,8 @@ export class DynamicDateTimeCombo extends Single {
this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW);
} }
} }
] ],
...opts.popup,
} }
}, },
listeners: [ listeners: [
@ -363,6 +364,10 @@ export class DynamicDateTimeCombo extends Single {
return this.trigger.getKey(); return this.trigger.getKey();
} }
getPopup() {
return this.popup;
}
hidePopupView() { hidePopupView() {
this.combo.hideView(); this.combo.hideView();
} }

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

@ -53,6 +53,8 @@ export class MultiSelectInsertCombo extends Single {
static EVENT_CONFIRM = "EVENT_CONFIRM"; static EVENT_CONFIRM = "EVENT_CONFIRM";
static EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; static EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
static EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW = "EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW";
_defaultConfig() { _defaultConfig() {
return extend(super._defaultConfig(...arguments), { return extend(super._defaultConfig(...arguments), {
@ -241,12 +243,13 @@ export class MultiSelectInsertCombo extends Single {
self.trigger.getSearcher().adjustView(); self.trigger.getSearcher().adjustView();
}); });
}, },
...o.popup,
}, },
value: o.value, value: o.value,
hideChecker(e) { hideChecker(e) {
return ( return (
triggerBtn.element.find(e.target).length === 0 && triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0 size(self.numberCounter.getView()?.element.find(e.target)) === 0
); );
}, },
}); });
@ -259,6 +262,7 @@ export class MultiSelectInsertCombo extends Single {
nextTick(() => { nextTick(() => {
self._populate(); self._populate();
}); });
self.fireEvent(MultiSelectInsertCombo.EVENT_BEFORE_POPUPVIEW);
}); });
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 // 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false; this.wants2Quit = false;
@ -290,6 +294,8 @@ export class MultiSelectInsertCombo extends Single {
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),
value: o.value, value: o.value,
masker: o.masker,
popup: o.popup,
}); });
this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, () => { this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, () => {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
@ -298,6 +304,7 @@ export class MultiSelectInsertCombo extends Single {
}); });
this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function() { this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function() {
this.updateSelectedValue(self.storeValue); this.updateSelectedValue(self.storeValue);
self.fireEvent(MultiSelectInsertCombo.EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW);
}); });
this.numberCounter.on(Events.VIEW, b => { this.numberCounter.on(Events.VIEW, b => {
@ -555,4 +562,12 @@ export class MultiSelectInsertCombo extends Single {
this._populate(...arguments); this._populate(...arguments);
this.numberCounter.populateSwitcher(...arguments); this.numberCounter.populateSwitcher(...arguments);
} }
getPopup() {
return this.popup;
}
getNumberCounter() {
return this.numberCounter;
}
} }

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

@ -80,6 +80,10 @@ export class MultiSelectCheckSelectedSwitcher extends Widget {
this.switcher.adjustView(); this.switcher.adjustView();
} }
getView() {
return this.switcher.getView();
}
hideView() { hideView() {
this.switcher.empty(); this.switcher.empty();
this.switcher.hideView(); this.switcher.hideView();

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

@ -10,7 +10,7 @@ import {
VerticalAdaptLayout, VerticalAdaptLayout,
deepClone, deepClone,
Selection, Selection,
SIZE_CONSANTS size
} 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";
@ -33,6 +33,7 @@ export class MultiTreeCombo extends Single {
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";
_defaultConfig() { _defaultConfig() {
return extend(super._defaultConfig(...arguments), { return extend(super._defaultConfig(...arguments), {
@ -70,13 +71,8 @@ export class MultiTreeCombo extends Single {
text: o.text, text: o.text,
defaultText: o.defaultText, defaultText: o.defaultText,
watermark: o.watermark, watermark: o.watermark,
masker: { adapter: () => {
offset: { return this.popup.getView();
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
searcher: { searcher: {
type: "bi.multi_tree_searcher", type: "bi.multi_tree_searcher",
@ -104,8 +100,6 @@ 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,13 +154,14 @@ 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 &&
self.numberCounter.element.find(e.target).length === 0 size(self.numberCounter.getView()?.element.find(e.target)) === 0
); );
}, },
}); });
@ -295,23 +290,18 @@ export class MultiTreeCombo extends Single {
}); });
this.numberCounter = createWidget({ this.numberCounter = createWidget({
type: "bi.multi_select_check_selected_switcher", type: MultiSelectCheckSelectedSwitcher,
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,
}, },
masker: { adapter: () => {
offset: { return this.popup.getView();
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 || {} },
@ -334,6 +324,7 @@ export class MultiTreeCombo extends Single {
want2showCounter = null; want2showCounter = null;
showCounter(); showCounter();
} }
this.fireEvent(MultiTreeCombo.EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW);
} }
); );
@ -443,4 +434,12 @@ 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;
}
} }

4
packages/fineui/src/widget/multitree/multi.tree.popup.js

@ -105,4 +105,8 @@ export class MultiTreePopup extends Pane {
resetWidth(w) { resetWidth(w) {
this.popupView.resetWidth(w); this.popupView.resetWidth(w);
} }
getView() {
return this.popupView.getView();
}
} }

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

@ -29,6 +29,7 @@ export class SingleSelectInsertCombo extends Single {
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"
_defaultConfig() { _defaultConfig() {
return extend(super._defaultConfig(...arguments), { return extend(super._defaultConfig(...arguments), {
@ -156,6 +157,7 @@ export class SingleSelectInsertCombo extends Single {
self.trigger.getSearcher().adjustView(); self.trigger.getSearcher().adjustView();
}); });
}, },
...o.popup,
}, },
hideChecker(e) { hideChecker(e) {
return triggerBtn.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0;
@ -171,6 +173,7 @@ export class SingleSelectInsertCombo extends Single {
nextTick(() => { nextTick(() => {
self.populate(); self.populate();
}); });
self.fireEvent(SingleSelectInsertCombo .EVENT_BEFORE_POPUPVIEW);
}); });
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 // 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false; this.wants2Quit = false;
@ -261,4 +264,8 @@ export class SingleSelectInsertCombo extends Single {
populate() { populate() {
this.combo.populate(...arguments); this.combo.populate(...arguments);
} }
getPopup() {
return this.popup;
}
} }

18
packages/fineui/src/widget/timeinterval/dateinterval.js

@ -30,6 +30,8 @@ export class DateInterval extends Single {
static EVENT_ERROR = "EVENT_ERROR"; static EVENT_ERROR = "EVENT_ERROR";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW";
static EVENT_BEFORE_START_POPUPVIEW = "EVENT_BEFORE_START_POPUPVIEW";
static EVENT_BEFORE_END_POPUPVIEW = "EVENT_BEFORE_END_POPUPVIEW";
_defaultConfig() { _defaultConfig() {
const conf = super._defaultConfig(...arguments); const conf = super._defaultConfig(...arguments);
@ -50,6 +52,13 @@ export class DateInterval extends Single {
this.left = this._createCombo(o.value.start, o.watermark?.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
this.left.on(DynamicDateCombo.EVENT_BEFORE_POPUPVIEW, () => {
this.fireEvent(DateInterval.EVENT_BEFORE_START_POPUPVIEW);
})
this.right.on(DynamicDateCombo.EVENT_BEFORE_POPUPVIEW, () => {
this.fireEvent(DateInterval.EVENT_BEFORE_END_POPUPVIEW);
})
return { return {
type: HorizontalFillLayout.xtype, type: HorizontalFillLayout.xtype,
columnSize: ["fill", "", "fill"], columnSize: ["fill", "", "fill"],
@ -79,6 +88,8 @@ export class DateInterval extends Single {
const o = this.options; const o = this.options;
const combo = createWidget({ const combo = createWidget({
type: DynamicDateCombo.xtype, type: DynamicDateCombo.xtype,
container: o.container,
popup: o.popup,
isPreview: o.isPreview, isPreview: o.isPreview,
supportDynamic: o.supportDynamic, supportDynamic: o.supportDynamic,
minDate: o.minDate, minDate: o.minDate,
@ -243,4 +254,11 @@ export class DateInterval extends Single {
end: this.right.getValue(), end: this.right.getValue(),
}; };
} }
getPopup() {
return {
start: this.left.getPopup(),
end: this.right.getPopup(),
};
}
} }

18
packages/fineui/src/widget/timeinterval/timeinterval.js

@ -29,6 +29,8 @@ export class TimeInterval extends Single {
static EVENT_VALID = "EVENT_VALID"; static EVENT_VALID = "EVENT_VALID";
static EVENT_ERROR = "EVENT_ERROR"; static EVENT_ERROR = "EVENT_ERROR";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_BEFORE_START_POPUPVIEW = "EVENT_BEFORE_START_POPUPVIEW";
static EVENT_BEFORE_END_POPUPVIEW = "EVENT_BEFORE_END_POPUPVIEW";
_defaultConfig() { _defaultConfig() {
const conf = super._defaultConfig(...arguments); const conf = super._defaultConfig(...arguments);
@ -48,6 +50,13 @@ export class TimeInterval extends Single {
this.left = this._createCombo(o.value.start, o.watermark?.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
this.left.on(DynamicDateTimeCombo.EVENT_BEFORE_POPUPVIEW, () => {
this.fireEvent(TimeInterval.EVENT_BEFORE_START_POPUPVIEW);
})
this.right.on(DynamicDateTimeCombo.EVENT_BEFORE_POPUPVIEW, () => {
this.fireEvent(TimeInterval.EVENT_BEFORE_END_POPUPVIEW);
})
return { return {
type: HorizontalFillLayout.xtype, type: HorizontalFillLayout.xtype,
columnSize: ["fill", "", "fill"], columnSize: ["fill", "", "fill"],
@ -77,6 +86,8 @@ export class TimeInterval extends Single {
const o = this.options; const o = this.options;
const combo = createWidget({ const combo = createWidget({
type: DynamicDateTimeCombo.xtype, type: DynamicDateTimeCombo.xtype,
container: o.container,
popup: o.popup,
isPreview: o.isPreview, isPreview: o.isPreview,
timeSelectTypes: o.timeSelectTypes, timeSelectTypes: o.timeSelectTypes,
simple: o.simple, simple: o.simple,
@ -250,4 +261,11 @@ export class TimeInterval extends Single {
end: this.right.getValue(), end: this.right.getValue(),
}; };
} }
getPopup() {
return {
start: this.left.getPopup(),
end: this.right.getPopup(),
};
}
} }

5
packages/fineui/src/widget/year/combo.year.js

@ -138,6 +138,7 @@ export class DynamicYearCombo extends Widget {
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.minDate, min: o.minDate,
max: o.maxDate, max: o.maxDate,
...o.popup,
}, },
value: o.value || "", value: o.value || "",
}, },
@ -240,6 +241,10 @@ export class DynamicYearCombo extends Widget {
setWaterMark(v) { setWaterMark(v) {
this.trigger.setWaterMark(v); this.trigger.setWaterMark(v);
} }
getPopup() {
return this.popup;
}
} }
extend(DynamicYearCombo, { extend(DynamicYearCombo, {
Static: 1, Static: 1,

5
packages/fineui/src/widget/yearmonth/combo.yearmonth.js

@ -159,6 +159,7 @@ export class DynamicYearMonthCombo extends Single {
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.minDate, min: o.minDate,
max: o.maxDate, max: o.maxDate,
...o.popup,
}, },
value: o.value || "", value: o.value || "",
}, },
@ -251,6 +252,10 @@ export class DynamicYearMonthCombo extends Single {
this.popup && this.popup.setMaxDate(maxDate); this.popup && this.popup.setMaxDate(maxDate);
} }
getPopup() {
return this.popup;
}
hideView() { hideView() {
this.combo.hideView(); this.combo.hideView();
} }

18
packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js

@ -20,6 +20,8 @@ export class YearMonthInterval extends Single {
static EVENT_ERROR = "EVENT_ERROR"; static EVENT_ERROR = "EVENT_ERROR";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
static EVENT_BEFORE_START_POPUPVIEW = "EVENT_BEFORE_START_POPUPVIEW";
static EVENT_BEFORE_END_POPUPVIEW = "EVENT_BEFORE_END_POPUPVIEW";
constants = { constants = {
width: 25, width: 25,
@ -43,6 +45,13 @@ export class YearMonthInterval extends Single {
this.left = this._createCombo(o.value.start, o.watermark?.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
this.left.on(DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW, () => {
this.fireEvent(YearMonthInterval.EVENT_BEFORE_START_POPUPVIEW);
})
this.right.on(DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW, () => {
this.fireEvent(YearMonthInterval.EVENT_BEFORE_END_POPUPVIEW);
})
return { return {
type: HorizontalFillLayout.xtype, type: HorizontalFillLayout.xtype,
columnSize: ["fill", "", "fill"], columnSize: ["fill", "", "fill"],
@ -72,6 +81,8 @@ export class YearMonthInterval extends Single {
const o = this.options; const o = this.options;
const combo = createWidget({ const combo = createWidget({
type: DynamicYearMonthCombo.xtype, type: DynamicYearMonthCombo.xtype,
container: o.container,
popup: o.popup,
isPreview: o.isPreview, isPreview: o.isPreview,
simple: o.simple, simple: o.simple,
supportDynamic: o.supportDynamic, supportDynamic: o.supportDynamic,
@ -235,4 +246,11 @@ export class YearMonthInterval extends Single {
getValue() { getValue() {
return { start: this.left.getValue(), end: this.right.getValue() }; return { start: this.left.getValue(), end: this.right.getValue() };
} }
getPopup() {
return {
start: this.left.getPopup(),
end: this.right.getPopup(),
};
}
} }

5
packages/fineui/src/widget/yearquarter/combo.yearquarter.js

@ -162,6 +162,7 @@ export class DynamicYearQuarterCombo extends Widget {
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.minDate, min: o.minDate,
max: o.maxDate, max: o.maxDate,
...o.popup,
}, },
value: o.value || "", value: o.value || "",
}, },
@ -254,6 +255,10 @@ export class DynamicYearQuarterCombo extends Widget {
this.popup && this.popup.setMaxDate(maxDate); this.popup && this.popup.setMaxDate(maxDate);
} }
getPopup() {
return this.popup;
}
hideView() { hideView() {
this.combo.hideView(); this.combo.hideView();
} }

Loading…
Cancel
Save