Browse Source

Pull request #283501: KERNEL-18940 refactor: 新增一些属性和方法

Merge in DEC/fineui from ~JIMMY.CHAI/dec-fineui:feature/x to feature/x

* commit '504af4e069e41780b714e335562bc6f23dcb4626':
  KERNEL-18940 refactor: 新增一些属性和方法
master
Jimmy.Chai-柴嘉明 4 months ago
parent
commit
270b1cd58b
  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不默认收起
@ -356,6 +357,10 @@ export class DynamicDateCombo extends Single {
return this.trigger.getKey();
}
getPopup() {
return this.popup;
}
hidePopupView() {
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);
}
}
]
],
...opts.popup,
}
},
listeners: [
@ -363,6 +364,10 @@ export class DynamicDateTimeCombo extends Single {
return this.trigger.getKey();
}
getPopup() {
return this.popup;
}
hidePopupView() {
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_ADD_ITEM = "EVENT_ADD_ITEM";
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() {
return extend(super._defaultConfig(...arguments), {
@ -241,12 +243,13 @@ export class MultiSelectInsertCombo extends Single {
self.trigger.getSearcher().adjustView();
});
},
...o.popup,
},
value: o.value,
hideChecker(e) {
return (
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(() => {
self._populate();
});
self.fireEvent(MultiSelectInsertCombo.EVENT_BEFORE_POPUPVIEW);
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
@ -290,6 +294,8 @@ export class MultiSelectInsertCombo extends Single {
valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this),
value: o.value,
masker: o.masker,
popup: o.popup,
});
this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, () => {
if (!self.combo.isViewVisible()) {
@ -298,6 +304,7 @@ export class MultiSelectInsertCombo extends Single {
});
this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function() {
this.updateSelectedValue(self.storeValue);
self.fireEvent(MultiSelectInsertCombo.EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW);
});
this.numberCounter.on(Events.VIEW, b => {
@ -555,4 +562,12 @@ export class MultiSelectInsertCombo extends Single {
this._populate(...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();
}
getView() {
return this.switcher.getView();
}
hideView() {
this.switcher.empty();
this.switcher.hideView();

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

@ -10,7 +10,7 @@ import {
VerticalAdaptLayout,
deepClone,
Selection,
SIZE_CONSANTS
size
} from "@/core";
import { Single, Combo } from "@/base";
import { MultiTreeSearcher } from "./trigger/searcher.multi.tree";
@ -33,6 +33,7 @@ export class MultiTreeCombo extends Single {
static EVENT_CONFIRM = "EVENT_CONFIRM";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
static EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW = "EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
@ -70,13 +71,8 @@ export class MultiTreeCombo extends Single {
text: o.text,
defaultText: o.defaultText,
watermark: o.watermark,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
adapter: () => {
return this.popup.getView();
},
searcher: {
type: "bi.multi_tree_searcher",
@ -104,8 +100,6 @@ export class MultiTreeCombo extends Single {
type: MultiTreePopup.xtype,
ref() {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [
{
@ -160,13 +154,14 @@ export class MultiTreeCombo extends Single {
});
},
maxWidth: o.isNeedAdjustWidth ? "auto" : 500,
...o.popup,
},
isNeedAdjustWidth: o.isNeedAdjustWidth,
value: { value: o.value || {} },
hideChecker(e) {
return (
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({
type: "bi.multi_select_check_selected_switcher",
type: MultiSelectCheckSelectedSwitcher,
el: {
// type: "bi.multi_tree_check_selected_button",
type: MultiTreeCheckSelectedButton.xtype,
},
popup: {
// type: "bi.multi_tree_check_pane",
type: MultiTreeCheckPane.xtype,
...o.popup,
},
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
adapter: () => {
return this.popup.getView();
},
masker: o.masker,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
value: { value: o.value || {} },
@ -334,6 +324,7 @@ export class MultiTreeCombo extends Single {
want2showCounter = null;
showCounter();
}
this.fireEvent(MultiTreeCombo.EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW);
}
);
@ -443,4 +434,12 @@ export class MultiTreeCombo extends Single {
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) {
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_CLICK_ITEM = "EVENT_CLICK_ITEM";
static EVENT_CONFIRM = "EVENT_CONFIRM";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
@ -156,6 +157,7 @@ export class SingleSelectInsertCombo extends Single {
self.trigger.getSearcher().adjustView();
});
},
...o.popup,
},
hideChecker(e) {
return triggerBtn.element.find(e.target).length === 0;
@ -171,6 +173,7 @@ export class SingleSelectInsertCombo extends Single {
nextTick(() => {
self.populate();
});
self.fireEvent(SingleSelectInsertCombo .EVENT_BEFORE_POPUPVIEW);
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
@ -261,4 +264,8 @@ export class SingleSelectInsertCombo extends Single {
populate() {
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_CHANGE = "EVENT_CHANGE";
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() {
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.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 {
type: HorizontalFillLayout.xtype,
columnSize: ["fill", "", "fill"],
@ -79,6 +88,8 @@ export class DateInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicDateCombo.xtype,
container: o.container,
popup: o.popup,
isPreview: o.isPreview,
supportDynamic: o.supportDynamic,
minDate: o.minDate,
@ -243,4 +254,11 @@ export class DateInterval extends Single {
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_ERROR = "EVENT_ERROR";
static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_BEFORE_START_POPUPVIEW = "EVENT_BEFORE_START_POPUPVIEW";
static EVENT_BEFORE_END_POPUPVIEW = "EVENT_BEFORE_END_POPUPVIEW";
_defaultConfig() {
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.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 {
type: HorizontalFillLayout.xtype,
columnSize: ["fill", "", "fill"],
@ -77,6 +86,8 @@ export class TimeInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicDateTimeCombo.xtype,
container: o.container,
popup: o.popup,
isPreview: o.isPreview,
timeSelectTypes: o.timeSelectTypes,
simple: o.simple,
@ -250,4 +261,11 @@ export class TimeInterval extends Single {
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,
min: o.minDate,
max: o.maxDate,
...o.popup,
},
value: o.value || "",
},
@ -240,6 +241,10 @@ export class DynamicYearCombo extends Widget {
setWaterMark(v) {
this.trigger.setWaterMark(v);
}
getPopup() {
return this.popup;
}
}
extend(DynamicYearCombo, {
Static: 1,

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

@ -159,6 +159,7 @@ export class DynamicYearMonthCombo extends Single {
behaviors: o.behaviors,
min: o.minDate,
max: o.maxDate,
...o.popup,
},
value: o.value || "",
},
@ -251,6 +252,10 @@ export class DynamicYearMonthCombo extends Single {
this.popup && this.popup.setMaxDate(maxDate);
}
getPopup() {
return this.popup;
}
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_CHANGE = "EVENT_CHANGE";
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 = {
width: 25,
@ -43,6 +45,13 @@ export class YearMonthInterval extends Single {
this.left = this._createCombo(o.value.start, o.watermark?.start);
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 {
type: HorizontalFillLayout.xtype,
columnSize: ["fill", "", "fill"],
@ -72,6 +81,8 @@ export class YearMonthInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicYearMonthCombo.xtype,
container: o.container,
popup: o.popup,
isPreview: o.isPreview,
simple: o.simple,
supportDynamic: o.supportDynamic,
@ -235,4 +246,11 @@ export class YearMonthInterval extends Single {
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,
min: o.minDate,
max: o.maxDate,
...o.popup,
},
value: o.value || "",
},
@ -254,6 +255,10 @@ export class DynamicYearQuarterCombo extends Widget {
this.popup && this.popup.setMaxDate(maxDate);
}
getPopup() {
return this.popup;
}
hideView() {
this.combo.hideView();
}

Loading…
Cancel
Save