From 93dd40d3621344ab39a581dce04856e62868cf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Tue, 2 Jul 2024 17:28:51 +0800 Subject: [PATCH 01/11] =?UTF-8?q?REPORT-125909=20fix:=20=E3=80=90=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=A8=A1=E5=9E=8B=E5=BC=95=E5=85=A5BI=E3=80=91?= =?UTF-8?q?=E4=BD=8E=E7=89=88=E6=9C=ACchrome=EF=BC=8C=E7=BB=B4=E5=BA=A6?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E9=9B=86=E5=9C=A8=E7=BB=84=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E6=9E=90=E5=8C=BA=E5=9F=9F=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/fineui/package.json b/packages/fineui/package.json index f467aa097..17ef6a00a 100644 --- a/packages/fineui/package.json +++ b/packages/fineui/package.json @@ -57,7 +57,7 @@ "jquery": "3.6.3" }, "devDependencies": { - "core-js": "^3.30.2", + "core-js": "^3.37.1", "cross-env": "^7.0.3" } -} \ No newline at end of file +} From f0750f646f8cf8a6de071f6ae73b192a853ff951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Wed, 10 Jul 2024 09:08:30 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=97=A0JIRA=20layout=20=E7=9A=84updateC?= =?UTF-8?q?hildren=E8=BF=87=E7=A8=8B=E4=B8=AD=E4=BC=A0=E9=80=92context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/wrapper/layout.js | 154 ++++++++++++--------- 1 file changed, 86 insertions(+), 68 deletions(-) diff --git a/packages/fineui/src/core/wrapper/layout.js b/packages/fineui/src/core/wrapper/layout.js index 288d586eb..adaf5d351 100644 --- a/packages/fineui/src/core/wrapper/layout.js +++ b/packages/fineui/src/core/wrapper/layout.js @@ -1,4 +1,17 @@ -import { isNull, isFunction, each, stripEL, keys, isArray, contains, isKey, isOdd, isWidget, isNotNull, has } from "../2.base"; +import { + isNull, + isFunction, + each, + stripEL, + keys, + isArray, + contains, + isKey, + isOdd, + isWidget, + isNotNull, + has +} from "../2.base"; import { Widget } from "../4.widget"; import { _lazyCreateWidget, Providers } from "../5.inject"; import { shortcut } from "../decorator"; @@ -65,38 +78,38 @@ export class Layout extends Widget { _init4Scroll() { switch (this.options.scrollable) { - case true: - case "xy": - this.element.css("overflow", "auto"); - - return; - case false: - this.element.css("overflow", "hidden"); - - return; - case "x": - this.element.css({ - "overflow-x": "auto", - "overflow-y": "hidden", - }); - - return; - case "y": - this.element.css({ - "overflow-x": "hidden", - "overflow-y": "auto", - }); - - return; - default : - break; + case true: + case "xy": + this.element.css("overflow", "auto"); + + return; + case false: + this.element.css("overflow", "hidden"); + + return; + case "x": + this.element.css({ + "overflow-x": "auto", + "overflow-y": "hidden", + }); + + return; + case "y": + this.element.css({ + "overflow-x": "hidden", + "overflow-y": "auto", + }); + + return; + default : + break; } if (this.options.scrollx) { this.element.css({ "overflow-x": "auto", "overflow-y": "hidden", }); - + return; } if (this.options.scrolly) { @@ -149,7 +162,7 @@ export class Layout extends Widget { } else { w = this.getWidgetByName(this._getChildName(i)); } - + return w; } @@ -163,7 +176,7 @@ export class Layout extends Widget { } }); }); - + return this._addElement(i, item, context, w); } @@ -175,7 +188,7 @@ export class Layout extends Widget { if (item instanceof Widget) { item = item.options; } - + return item; } @@ -190,19 +203,19 @@ export class Layout extends Widget { } const className = Object.prototype.toString.call(a); switch (className) { - case "[object RegExp]": - case "[object String]": - return `${a}` === `${b}`; - case "[object Number]": - if (+a !== +a) { - return +b !== +b; - } - - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case "[object Date]": - case "[object Boolean]": - return +a === +b; - default: + case "[object RegExp]": + case "[object String]": + return `${a}` === `${b}`; + case "[object Number]": + if (+a !== +a) { + return +b !== +b; + } + + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + return +a === +b; + default: } const areArrays = className === "[object Array]"; @@ -252,10 +265,10 @@ export class Layout extends Widget { } aStack.pop(); bStack.pop(); - + return true; }; - + return eq(item1, item2); } @@ -264,9 +277,9 @@ export class Layout extends Widget { } // 不依赖于this.options.items进行更新 - _updateItemAt(oldIndex, newIndex, item) { + _updateItemAt(oldIndex, newIndex, item, context) { const del = this._children[this._getChildName(oldIndex)]; - const w = this._newElement(newIndex, item); + const w = this._newElement(newIndex, item, context); // 需要有个地方临时存一下新建的组件,否则如果直接使用newIndex的话,newIndex位置的元素可能会被用到 this._children[`${this._getChildName(newIndex)}-temp`] = w; const nextSibling = del.element.next(); @@ -277,7 +290,7 @@ export class Layout extends Widget { } del._destroy(); w._mount(); - + return true; } @@ -314,42 +327,47 @@ export class Layout extends Widget { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._lgap || 0) + (item.lgap || 0)) : item._lgap) || 0; } - + return (item._lgap || 0) + (item.lgap || 0); } + _optimiseItemRgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._rgap || 0) + (item.rgap || 0)) : item._rgap) || 0; } - + return (item._rgap || 0) + (item.rgap || 0); } + _optimiseItemTgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._tgap || 0) + (item.tgap || 0)) : item._tgap) || 0; } - + return (item._tgap || 0) + (item.tgap || 0); } + _optimiseItemBgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._bgap || 0) + (item.bgap || 0)) : item._bgap) || 0; } - + return (item._bgap || 0) + (item.bgap || 0); } + _optimiseItemHgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._hgap || 0) + (item.hgap || 0)) : item._hgap) || 0; } - + return (item._hgap || 0) + (item.hgap || 0); } + _optimiseItemVgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._vgap || 0) + (item.vgap || 0)) : item._vgap) || 0; } - + return (item._vgap || 0) + (item.vgap || 0); } @@ -450,7 +468,7 @@ export class Layout extends Widget { w.element.prependTo(this._getWrapper()); } w._mount(); - + return w; } @@ -479,7 +497,7 @@ export class Layout extends Widget { if (!child || !child.shouldUpdate) { return null; } - + return child.shouldUpdate(this._getOptions(item)); } @@ -532,7 +550,7 @@ export class Layout extends Widget { value = value.concat(v); } }); - + return value; } @@ -552,19 +570,19 @@ export class Layout extends Widget { }); } - patchItem(oldVnode, vnode, oldIndex, newIndex) { + patchItem(oldVnode, vnode, oldIndex, newIndex, context) { const shouldUpdate = this.shouldUpdateItem(oldIndex, vnode); const child = this._children[this._getChildName(oldIndex)]; if (shouldUpdate) { this._children[`${this._getChildName(newIndex)}-temp`] = child; - + return child._update(this._getOptions(vnode), shouldUpdate); } if (shouldUpdate === null && !this._compare(oldVnode, vnode)) { // if (child.update) { // return child.update(this._getOptions(vnode)); // } - return this._updateItemAt(oldIndex, newIndex, vnode); + return this._updateItemAt(oldIndex, newIndex, vnode, context); } } @@ -647,7 +665,7 @@ export class Layout extends Widget { findIndex = i; } } - + return [found, findIndex]; }; @@ -665,26 +683,26 @@ export class Layout extends Widget { } else if (isNull(oldEndVnode)) { oldEndVnode = oldCh[--oldEndIdx]; } else if (sameVnode(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx)) { - const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx); + const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx, context); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (sameVnode(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx)) { - const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx); + const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx, context); updated = willUpdate || updated; children[isNull(oldEndVnode.key) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldStartVnode, newEndVnode)) { - const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx); + const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx, context); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; insertBefore(oldStartVnode, oldEndVnode, true); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldEndVnode, newStartVnode)) { - const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx); + const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx, context); updated = willUpdate || updated; children[isNull(oldEndVnode) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; insertBefore(oldEndVnode, oldStartVnode); @@ -697,7 +715,7 @@ export class Layout extends Widget { insertBefore(node, oldStartVnode); } else { // 如果新节点在旧节点区间中存在就复用一下 const sameOldIndex = sameOldVnode[1]; - const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx); + const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx, context); updated = willUpdate || updated; children[isNull(sameOldVnode[0].key) ? newStartIdx : sameOldVnode[0].key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(sameOldIndex)]; oldCh[sameOldIndex] = undefined; @@ -744,7 +762,7 @@ export class Layout extends Widget { const context = opt.context; const oldItems = o.items; this.options.items = items; - + return this.updateChildren(oldItems, items, context); } @@ -808,7 +826,7 @@ export class Layout extends Widget { items, context: options.context, }); - + return; } this.options.items = items; From 504af4e069e41780b714e335562bc6f23dcb4626 Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Wed, 24 Jul 2024 17:15:04 +0800 Subject: [PATCH 03/11] =?UTF-8?q?KERNEL-18940=20refactor:=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=80=E4=BA=9B=E5=B1=9E=E6=80=A7=E5=92=8C=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/dynamicdate/dynamicdate.combo.js | 5 +++ .../dynamicdatetime/dynamicdatetime.combo.js | 7 +++- .../multiselect/multiselect.insert.combo.js | 17 +++++++- .../trigger/switcher.checkselected.js | 4 ++ .../src/widget/multitree/multi.tree.combo.js | 41 +++++++++---------- .../src/widget/multitree/multi.tree.popup.js | 4 ++ .../singleselect/singleselect.insert.combo.js | 7 ++++ .../src/widget/timeinterval/dateinterval.js | 18 ++++++++ .../src/widget/timeinterval/timeinterval.js | 18 ++++++++ packages/fineui/src/widget/year/combo.year.js | 5 +++ .../src/widget/yearmonth/combo.yearmonth.js | 5 +++ .../yearmonthinterval/yearmonthinterval.js | 18 ++++++++ .../widget/yearquarter/combo.yearquarter.js | 5 +++ 13 files changed, 131 insertions(+), 23 deletions(-) diff --git a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js b/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js index 3fa097e55..ac22f8057 100644 --- a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js +++ b/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(); } diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js index e65e12768..315008c0c 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/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(); } diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js index 61e9f125a..0e41b1b10 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js +++ b/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; + } } diff --git a/packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js b/packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js index 4d5bab1da..c4773e549 100644 --- a/packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js +++ b/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(); diff --git a/packages/fineui/src/widget/multitree/multi.tree.combo.js b/packages/fineui/src/widget/multitree/multi.tree.combo.js index 7d61b6e9d..cc8ab0e60 100644 --- a/packages/fineui/src/widget/multitree/multi.tree.combo.js +++ b/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; + } } diff --git a/packages/fineui/src/widget/multitree/multi.tree.popup.js b/packages/fineui/src/widget/multitree/multi.tree.popup.js index 44c91a591..4bd078ab1 100644 --- a/packages/fineui/src/widget/multitree/multi.tree.popup.js +++ b/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(); + } } diff --git a/packages/fineui/src/widget/singleselect/singleselect.insert.combo.js b/packages/fineui/src/widget/singleselect/singleselect.insert.combo.js index eb528ec7a..5bf6dc855 100644 --- a/packages/fineui/src/widget/singleselect/singleselect.insert.combo.js +++ b/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; + } } diff --git a/packages/fineui/src/widget/timeinterval/dateinterval.js b/packages/fineui/src/widget/timeinterval/dateinterval.js index 4c7f784da..d98510c7b 100644 --- a/packages/fineui/src/widget/timeinterval/dateinterval.js +++ b/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(), + }; + } } diff --git a/packages/fineui/src/widget/timeinterval/timeinterval.js b/packages/fineui/src/widget/timeinterval/timeinterval.js index 85deda173..4ae530169 100644 --- a/packages/fineui/src/widget/timeinterval/timeinterval.js +++ b/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(), + }; + } } diff --git a/packages/fineui/src/widget/year/combo.year.js b/packages/fineui/src/widget/year/combo.year.js index 50056e22e..562ad5cc9 100644 --- a/packages/fineui/src/widget/year/combo.year.js +++ b/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, diff --git a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js b/packages/fineui/src/widget/yearmonth/combo.yearmonth.js index 79dfa5da8..ba7d693e8 100644 --- a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js +++ b/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(); } diff --git a/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js b/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js index c6bc874bb..c7abfff4e 100644 --- a/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js +++ b/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(), + }; + } } diff --git a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js b/packages/fineui/src/widget/yearquarter/combo.yearquarter.js index c14100a38..c6cbb18c9 100644 --- a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js +++ b/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(); } From cc1364720c544965c23db6b42d3aaa0c5ce6bf7b Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Thu, 25 Jul 2024 20:29:22 +0800 Subject: [PATCH 04/11] =?UTF-8?q?KERNEL-18940=20refactor:=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/widget/downlist/combo.downlist.js | 7 ++++++ .../widget/dynamicdate/dynamicdate.combo.js | 21 +++++++++-------- .../dynamicdatetime/dynamicdatetime.combo.js | 23 +++++++++++-------- .../combo.textvaluedownlist.js | 11 +++++++++ packages/fineui/src/widget/year/combo.year.js | 21 +++++++++-------- .../src/widget/yearmonth/combo.yearmonth.js | 21 +++++++++-------- .../widget/yearquarter/combo.yearquarter.js | 21 +++++++++-------- packages/fineui/typescript/index.ts | 1 + .../widget/downlist/combo.downlist.ts | 3 +++ .../widget/dynamicdate/dynamicdate.combo.ts | 6 ++++- .../dynamicdatetime/dynamicdatetime.combo.ts | 4 ++++ .../multiselect/multiselect.insert.combo.ts | 10 ++++++++ .../multiselect/switcher.checkselected.ts | 19 +++++++++++++++ .../widget/multitree/multi.tree.combo.ts | 12 ++++++++++ .../widget/multitree/multi.tree.popup.ts | 3 +++ .../singleselect/singleselect.insert.combo.ts | 5 ++++ .../combo.textvaluedownlist.ts | 9 ++++++++ .../widget/timeinterval/dateinterval.ts | 13 +++++++++-- .../widget/timeinterval/timeinterval.ts | 11 ++++++++- .../typescript/widget/year/combo.year.ts | 7 ++++++ .../widget/yearmonth/combo.yearmonth.ts | 7 ++++++ .../yearmonthinterval/yearmonthinterval.ts | 11 ++++++++- .../widget/yearquarter/combo.yearquarter.ts | 7 ++++++ 23 files changed, 202 insertions(+), 51 deletions(-) create mode 100644 packages/fineui/typescript/widget/multiselect/switcher.checkselected.ts diff --git a/packages/fineui/src/widget/downlist/combo.downlist.js b/packages/fineui/src/widget/downlist/combo.downlist.js index 341372724..eb65d8758 100644 --- a/packages/fineui/src/widget/downlist/combo.downlist.js +++ b/packages/fineui/src/widget/downlist/combo.downlist.js @@ -108,6 +108,9 @@ export class DownListCombo extends Widget { stopPropagation: o.stopPropagation, maxHeight: o.maxHeight, minWidth: o.minWidth, + ref: (ref) => { + this.popup = ref; + }, ...o.popup, }, }); @@ -125,6 +128,10 @@ export class DownListCombo extends Widget { this.downlistcombo.showView(e); } + getPopup() { + return this.popup; + } + populate(items) { this.popupView.populate(items); } diff --git a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js b/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js index ac22f8057..27e0caae0 100644 --- a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js +++ b/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js @@ -208,7 +208,7 @@ export class DynamicDateCombo extends Single { min: opts.minDate, max: opts.maxDate, ref: _ref => { - this.popup = _ref; + this.popupEl = _ref; }, listeners: [ { @@ -238,7 +238,7 @@ export class DynamicDateCombo extends Single { { eventName: DynamicDatePopup.BUTTON_OK_EVENT_CHANGE, action: () => { - const value = this.popup.getValue(); + const value = this.popupEl.getValue(); if (this._checkValue(value)) { this.setValue(value); } @@ -249,7 +249,7 @@ export class DynamicDateCombo extends Single { { eventName: DynamicDatePopup.EVENT_CHANGE, action: () => { - this.setValue(this.popup.getValue()); + this.setValue(this.popupEl.getValue()); this.combo.hideView(); this.fireEvent(DynamicDateCombo.EVENT_CONFIRM); }, @@ -261,8 +261,11 @@ export class DynamicDateCombo extends Single { }, } ], - ...opts.popup, }, + ref: (ref) => { + this.popup = ref; + }, + ...opts.popup, }, // // DEC-4250 和复选下拉一样,点击triggerBtn不默认收起 // hideChecker: function (e) { @@ -272,9 +275,9 @@ export class DynamicDateCombo extends Single { { eventName: Combo.EVENT_BEFORE_POPUPVIEW, action: () => { - this.popup.setMinDate(opts.minDate); - this.popup.setMaxDate(opts.maxDate); - this.popup.setValue(this.storeValue); + this.popupEl.setMinDate(opts.minDate); + this.popupEl.setMaxDate(opts.maxDate); + this.popupEl.setValue(this.storeValue); this.fireEvent(DynamicDateCombo.EVENT_BEFORE_POPUPVIEW); }, } @@ -333,14 +336,14 @@ export class DynamicDateCombo extends Single { const o = this.options; o.minDate = minDate; this.trigger.setMinDate(minDate); - this.popup && this.popup.setMinDate(minDate); + this.popupEl && this.popupEl.setMinDate(minDate); } setMaxDate(maxDate) { const o = this.options; o.maxDate = maxDate; this.trigger.setMaxDate(maxDate); - this.popup && this.popup.setMaxDate(maxDate); + this.popupEl && this.popupEl.setMaxDate(maxDate); } setValue(v) { diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js index 315008c0c..3be733631 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -216,7 +216,7 @@ export class DynamicDateTimeCombo extends Single { min: opts.minDate, max: opts.maxDate, ref: _ref => { - this.popup = _ref; + this.popupEl = _ref; }, listeners: [ { @@ -249,7 +249,7 @@ export class DynamicDateTimeCombo extends Single { { eventName: DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE, action: () => { - const value = this.popup.getValue(); + const value = this.popupEl.getValue(); if (this._checkValue(value)) { this.setValue(value); } @@ -260,7 +260,7 @@ export class DynamicDateTimeCombo extends Single { { eventName: DynamicDateTimePopup.EVENT_CHANGE, action: () => { - this.setValue(this.popup.getValue()); + this.setValue(this.popupEl.getValue()); this.combo.hideView(); this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); } @@ -272,16 +272,19 @@ export class DynamicDateTimeCombo extends Single { } } ], - ...opts.popup, - } + }, + ref: (ref) => { + this.popup = ref; + }, + ...opts.popup, }, listeners: [ { eventName: Combo.EVENT_BEFORE_POPUPVIEW, action: () => { - this.popup.setMinDate(opts.minDate); - this.popup.setMaxDate(opts.maxDate); - this.popup.setValue(this.storeValue); + this.popupEl.setMinDate(opts.minDate); + this.popupEl.setMaxDate(opts.maxDate); + this.popupEl.setValue(this.storeValue); this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_POPUPVIEW); } } @@ -340,14 +343,14 @@ export class DynamicDateTimeCombo extends Single { const o = this.options; o.minDate = minDate; this.trigger.setMinDate(minDate); - this.popup && this.popup.setMinDate(minDate); + this.popupEl && this.popupEl.setMinDate(minDate); } setMaxDate(maxDate) { const o = this.options; o.maxDate = maxDate; this.trigger.setMaxDate(maxDate); - this.popup && this.popup.setMaxDate(maxDate); + this.popupEl && this.popupEl.setMaxDate(maxDate); } setValue(v) { diff --git a/packages/fineui/src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js b/packages/fineui/src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js index 398888e25..617ce13f3 100644 --- a/packages/fineui/src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js +++ b/packages/fineui/src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js @@ -20,6 +20,7 @@ export class TextValueDownListCombo extends Widget { static xtype = "bi.text_value_down_list_combo"; static EVENT_CHANGE = "EVENT_CHANGE"; + static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; _defaultConfig(config) { return extend(super._defaultConfig(...arguments), { @@ -42,6 +43,7 @@ export class TextValueDownListCombo extends Widget { this.combo = createWidget({ type: DownListCombo.xtype, element: this, + container: o.container, chooseType: Selection.Single, adjustLength: 2, width: toPix(o.width, 2), @@ -59,6 +61,7 @@ export class TextValueDownListCombo extends Widget { }, value: isNull(value) ? [] : [value], items: deepClone(o.items), + popup: o.popup, }); this.combo.on(DownListCombo.EVENT_CHANGE, () => { @@ -76,6 +79,10 @@ export class TextValueDownListCombo extends Widget { this.fireEvent(TextValueDownListCombo.EVENT_CHANGE); } }); + + this.combo.on(DownListCombo.EVENT_BEFORE_POPUPVIEW, () => { + this.fireEvent(TextValueDownListCombo.EVENT_BEFORE_POPUPVIEW); + }); } _createValueMap() { @@ -114,4 +121,8 @@ export class TextValueDownListCombo extends Widget { this.combo.populate(items); this._createValueMap(); } + + getPopup() { + return this.combo.getPopup(); + } } diff --git a/packages/fineui/src/widget/year/combo.year.js b/packages/fineui/src/widget/year/combo.year.js index 562ad5cc9..1bf7e11e6 100644 --- a/packages/fineui/src/widget/year/combo.year.js +++ b/packages/fineui/src/widget/year/combo.year.js @@ -98,13 +98,13 @@ export class DynamicYearCombo extends Widget { supportDynamic: o.supportDynamic, isPreview: o.isPreview, ref: _ref => { - this.popup = _ref; + this.popupEl = _ref; }, listeners: [ { eventName: DynamicYearPopup.EVENT_CHANGE, action: () => { - this.setValue(this.popup.getValue()); + this.setValue(this.popupEl.getValue()); this.combo.hideView(); this.fireEvent(DynamicYearCombo.EVENT_CONFIRM); }, @@ -129,7 +129,7 @@ export class DynamicYearCombo extends Widget { { eventName: DynamicYearPopup.BUTTON_OK_EVENT_CHANGE, action: () => { - this.setValue(this.popup.getValue()); + this.setValue(this.popupEl.getValue()); this.combo.hideView(); this.fireEvent(DynamicDateCombo.EVENT_CONFIRM); }, @@ -138,15 +138,18 @@ export class DynamicYearCombo extends Widget { behaviors: o.behaviors, min: o.minDate, max: o.maxDate, - ...o.popup, }, value: o.value || "", + ref: (ref) => { + this.popup = ref; + }, + ...o.popup, }, }); this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, () => { - this.popup.setMinDate(o.minDate); - this.popup.setMaxDate(o.maxDate); - this.popup.setValue(this.storeValue); + this.popupEl.setMinDate(o.minDate); + this.popupEl.setMaxDate(o.maxDate); + this.popupEl.setValue(this.storeValue); this.fireEvent(DynamicYearCombo.EVENT_BEFORE_POPUPVIEW); }); @@ -206,14 +209,14 @@ export class DynamicYearCombo extends Widget { const o = this.options; o.minDate = minDate; this.trigger.setMinDate(minDate); - this.popup && this.popup.setMinDate(minDate); + this.popupEl && this.popupEl.setMinDate(minDate); } setMaxDate(maxDate) { const o = this.options; o.maxDate = maxDate; this.trigger.setMaxDate(maxDate); - this.popup && this.popup.setMaxDate(maxDate); + this.popupEl && this.popupEl.setMaxDate(maxDate); } hideView() { diff --git a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js b/packages/fineui/src/widget/yearmonth/combo.yearmonth.js index ba7d693e8..de524f2b8 100644 --- a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js +++ b/packages/fineui/src/widget/yearmonth/combo.yearmonth.js @@ -109,13 +109,13 @@ export class DynamicYearMonthCombo extends Single { supportDynamic: o.supportDynamic, isPreview: o.isPreview, ref: _ref => { - this.popup = _ref; + this.popupEl = _ref; }, listeners: [ { eventName: DynamicYearMonthPopup.EVENT_CHANGE, action: () => { - this.setValue(this.popup.getValue()); + this.setValue(this.popupEl.getValue()); this.combo.hideView(); this.fireEvent(DynamicYearMonthCombo.EVENT_CONFIRM); }, @@ -147,7 +147,7 @@ export class DynamicYearMonthCombo extends Single { { eventName: DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE, action: () => { - const value = this.popup.getValue(); + const value = this.popupEl.getValue(); if (this._checkValue(value)) { this.setValue(value); } @@ -159,15 +159,18 @@ export class DynamicYearMonthCombo extends Single { behaviors: o.behaviors, min: o.minDate, max: o.maxDate, - ...o.popup, }, value: o.value || "", + ref: (ref) => { + this.popup = ref; + }, + ...o.popup, }, }); this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, () => { - this.popup.setMinDate(o.minDate); - this.popup.setMaxDate(o.maxDate); - this.popup.setValue(this.storeValue); + this.popupEl.setMinDate(o.minDate); + this.popupEl.setMaxDate(o.maxDate); + this.popupEl.setValue(this.storeValue); this.fireEvent(DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW); }); @@ -242,14 +245,14 @@ export class DynamicYearMonthCombo extends Single { const o = this.options; o.minDate = minDate; this.trigger.setMinDate(minDate); - this.popup && this.popup.setMinDate(minDate); + this.popupEl && this.popupEl.setMinDate(minDate); } setMaxDate(maxDate) { const o = this.options; o.maxDate = maxDate; this.trigger.setMaxDate(maxDate); - this.popup && this.popup.setMaxDate(maxDate); + this.popupEl && this.popupEl.setMaxDate(maxDate); } getPopup() { diff --git a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js b/packages/fineui/src/widget/yearquarter/combo.yearquarter.js index c6cbb18c9..0f9c473c1 100644 --- a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js +++ b/packages/fineui/src/widget/yearquarter/combo.yearquarter.js @@ -112,13 +112,13 @@ export class DynamicYearQuarterCombo extends Widget { supportDynamic: o.supportDynamic, isPreview: o.isPreview, ref: _ref => { - this.popup = _ref; + this.popupEl = _ref; }, listeners: [ { eventName: DynamicYearQuarterPopup.EVENT_CHANGE, action: () => { - this.setValue(this.popup.getValue()); + this.setValue(this.popupEl.getValue()); this.combo.hideView(); this.fireEvent(DynamicYearQuarterCombo.EVENT_CONFIRM); }, @@ -150,7 +150,7 @@ export class DynamicYearQuarterCombo extends Widget { { eventName: DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE, action: () => { - const value = this.popup.getValue(); + const value = this.popupEl.getValue(); if (this._checkValue(value)) { this.setValue(value); } @@ -162,15 +162,18 @@ export class DynamicYearQuarterCombo extends Widget { behaviors: o.behaviors, min: o.minDate, max: o.maxDate, - ...o.popup, }, value: o.value || "", + ref: (ref) => { + this.popup = ref; + }, + ...o.popup, }, }); this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, () => { - this.popup.setMinDate(o.minDate); - this.popup.setMaxDate(o.maxDate); - this.popup.setValue(this.storeValue); + this.popupEl.setMinDate(o.minDate); + this.popupEl.setMaxDate(o.maxDate); + this.popupEl.setValue(this.storeValue); this.fireEvent(DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW); }); @@ -245,14 +248,14 @@ export class DynamicYearQuarterCombo extends Widget { const o = this.options; o.minDate = minDate; this.trigger.setMinDate(minDate); - this.popup && this.popup.setMinDate(minDate); + this.popupEl && this.popupEl.setMinDate(minDate); } setMaxDate(maxDate) { const o = this.options; o.maxDate = maxDate; this.trigger.setMaxDate(maxDate); - this.popup && this.popup.setMaxDate(maxDate); + this.popupEl && this.popupEl.setMaxDate(maxDate); } getPopup() { diff --git a/packages/fineui/typescript/index.ts b/packages/fineui/typescript/index.ts index 97de6153e..acb087f20 100644 --- a/packages/fineui/typescript/index.ts +++ b/packages/fineui/typescript/index.ts @@ -103,6 +103,7 @@ export { CenterAdaptLayout } from "./core/wrapper/layout/adapt/adapt.center"; export { VerticalAdaptLayout } from "./core/wrapper/layout/adapt/adapt.vertical"; export { MultiSelectInsertCombo } from "./widget/multiselect/multiselect.insert.combo"; export { MultiSelectCombo } from "./widget/multiselect/multiselect.combo"; +export { MultiSelectCheckSelectedSwitcher } from "./widget/multiselect/switcher.checkselected"; export { SearchEditor } from "./widget/editor/editor.search"; export { MultiLayerSingleLevelTree } from "./widget/multilayersingletree/multilayersingletree.leveltree"; export { SimpleColorChooser } from "./case/colorchooser/colorchooser.simple"; diff --git a/packages/fineui/typescript/widget/downlist/combo.downlist.ts b/packages/fineui/typescript/widget/downlist/combo.downlist.ts index 6cc88db52..4eed3e1f7 100644 --- a/packages/fineui/typescript/widget/downlist/combo.downlist.ts +++ b/packages/fineui/typescript/widget/downlist/combo.downlist.ts @@ -1,3 +1,4 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Widget } from "../../core/widget"; export declare class DownListCombo extends Widget { @@ -15,4 +16,6 @@ export declare class DownListCombo extends Widget { adjustWidth: (e?: MouseEvent) => void; adjustHeight: (e?: MouseEvent) => void; + + getPopup(): PopupView; } diff --git a/packages/fineui/typescript/widget/dynamicdate/dynamicdate.combo.ts b/packages/fineui/typescript/widget/dynamicdate/dynamicdate.combo.ts index e9a54490a..a4f82a741 100644 --- a/packages/fineui/typescript/widget/dynamicdate/dynamicdate.combo.ts +++ b/packages/fineui/typescript/widget/dynamicdate/dynamicdate.combo.ts @@ -1,4 +1,5 @@ -import { Single } from '../../base/single/single'; +import { PopupView } from "../../base/layer/layer.popup"; +import { Single } from "../../base/single/single"; export declare class DynamicDateCombo extends Single { static xtype: string; @@ -26,6 +27,7 @@ export declare class DynamicDateCombo extends Single { }; watermark?: string; simple?: boolean; + popup?: any; } & Single['props'] setMinDate(minDate: string): void; @@ -43,6 +45,8 @@ export declare class DynamicDateCombo extends Single { blur(): void; setWaterMark(v: string): void; + + getPopup(): PopupView; } export interface DynamicDataComboValue { diff --git a/packages/fineui/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts b/packages/fineui/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts index 120f38ef3..7ef1abc68 100644 --- a/packages/fineui/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts +++ b/packages/fineui/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts @@ -1,3 +1,4 @@ +import { PopupView } from '../../base/layer/layer.popup'; import { Single } from '../../base/single/single'; export declare class DynamicDateTimeCombo extends Single { @@ -23,6 +24,7 @@ export declare class DynamicDateTimeCombo extends Single { tabIndex?: number; }; watermark?: string; + popup?: any; } & Single['props']; getValue(): DynamicDateTimeComboValue; @@ -40,6 +42,8 @@ export declare class DynamicDateTimeCombo extends Single { blur(): void; setWaterMark(v: string): void + + getPopup(): PopupView; } export interface DynamicDateTimeComboValue { diff --git a/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts b/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts index bd0a75ece..6aef0a5c5 100644 --- a/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts +++ b/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts @@ -1,4 +1,6 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Single } from "../../base/single/single"; +import { MultiSelectCheckSelectedSwitcher } from "./switcher.checkselected"; export declare class MultiSelectInsertCombo extends Single { static xtype: string; @@ -12,6 +14,8 @@ export declare class MultiSelectInsertCombo extends Single { static REQ_GET_DATA_LENGTH: 1; static REQ_GET_ALL_DATA: -1; static EVENT_AFTER_HIDEVIEW: string; + static EVENT_BEFORE_POPUPVIEW: string; + static EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW: string; props: { itemsCreator?: Function; @@ -21,6 +25,8 @@ export declare class MultiSelectInsertCombo extends Single { text?: string; watermark?: string; container?: any; + popup?: any; + masker?: any; } & Single["props"]; _itemsCreator4Trigger(op: any, callback: Function): void; @@ -67,5 +73,9 @@ export declare class MultiSelectInsertCombo extends Single { assist: string[]; }; + getPopup(): PopupView; + + getNumberCounter(): MultiSelectCheckSelectedSwitcher; + populate(...args: any[]): void; } diff --git a/packages/fineui/typescript/widget/multiselect/switcher.checkselected.ts b/packages/fineui/typescript/widget/multiselect/switcher.checkselected.ts new file mode 100644 index 000000000..8e6e83a6e --- /dev/null +++ b/packages/fineui/typescript/widget/multiselect/switcher.checkselected.ts @@ -0,0 +1,19 @@ +import { Widget } from '../../core/widget'; + +export declare class MultiSelectCheckSelectedSwitcher extends Widget { + static xtype: string; + static EVENT_TRIGGER_CHANGE: string; + static EVENT_BEFORE_POPUPVIEW: string; + static EVENT_AFTER_HIDEVIEW: string; + + props: { + itemsCreator?: Function; + valueFormatter?: Function; + }; + + adjustView(): void; + + hideView(): void; + + getView(): Widget; +} diff --git a/packages/fineui/typescript/widget/multitree/multi.tree.combo.ts b/packages/fineui/typescript/widget/multitree/multi.tree.combo.ts index 3fe60ebed..944397695 100644 --- a/packages/fineui/typescript/widget/multitree/multi.tree.combo.ts +++ b/packages/fineui/typescript/widget/multitree/multi.tree.combo.ts @@ -1,5 +1,7 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Single } from "../../base/single/single"; import { Widget } from "../../core/widget"; +import { MultiSelectCheckSelectedSwitcher } from "../multiselect/switcher.checkselected"; export declare class MultiTreeCombo extends Single { static xtype: string; @@ -10,6 +12,12 @@ export declare class MultiTreeCombo extends Single { static EVENT_CLICK_ITEM: string; static EVENT_CONFIRM: string; static EVENT_BEFORE_POPUPVIEW: string; + static EVENT_BEFORE_NUMBER_COUNTER_POPUPVIEW: string; + + props: { + popup?: any; + masker?: any; + } & Single["props"]; showView(): void; hideView(): void; @@ -21,4 +29,8 @@ export declare class MultiTreeCombo extends Single { blur(): void; setWaterMark(v: string): void; + + getPopup(): PopupView; + + getNumberCounter(): MultiSelectCheckSelectedSwitcher; } diff --git a/packages/fineui/typescript/widget/multitree/multi.tree.popup.ts b/packages/fineui/typescript/widget/multitree/multi.tree.popup.ts index 68f8f65a2..3c7506623 100644 --- a/packages/fineui/typescript/widget/multitree/multi.tree.popup.ts +++ b/packages/fineui/typescript/widget/multitree/multi.tree.popup.ts @@ -1,3 +1,4 @@ +import { ButtonGroup } from "../../base/combination/group.button"; import { Pane } from "../../base/pane"; export declare class MultiTreePopup extends Pane { @@ -12,4 +13,6 @@ export declare class MultiTreePopup extends Pane { resetHeight(h: number): void; resetWidth(w: number): void; + + getView(): ButtonGroup; } diff --git a/packages/fineui/typescript/widget/singleselect/singleselect.insert.combo.ts b/packages/fineui/typescript/widget/singleselect/singleselect.insert.combo.ts index 5c9f5d934..d153b952a 100644 --- a/packages/fineui/typescript/widget/singleselect/singleselect.insert.combo.ts +++ b/packages/fineui/typescript/widget/singleselect/singleselect.insert.combo.ts @@ -1,3 +1,4 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Single } from "../../base/single/single"; export declare class SingleSelectInsertCombo extends Single { @@ -8,6 +9,7 @@ export declare class SingleSelectInsertCombo extends Single { static EVENT_SEARCHING: string; static EVENT_CLICK_ITEM: string; static EVENT_CONFIRM: string; + static EVENT_BEFORE_POPUPVIEW: string; props: { text?: string, @@ -16,5 +18,8 @@ export declare class SingleSelectInsertCombo extends Single { valueFormatter?: Function, allowEdit?: boolean, watermark?: string, + popup?: any; } & Single['props'] + + getPopup(): PopupView; } diff --git a/packages/fineui/typescript/widget/textvaluedownlistcombo/combo.textvaluedownlist.ts b/packages/fineui/typescript/widget/textvaluedownlistcombo/combo.textvaluedownlist.ts index e3387f30d..d351e5f33 100644 --- a/packages/fineui/typescript/widget/textvaluedownlistcombo/combo.textvaluedownlist.ts +++ b/packages/fineui/typescript/widget/textvaluedownlistcombo/combo.textvaluedownlist.ts @@ -1,8 +1,17 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Widget } from "../../core/widget"; export declare class TextValueDownListCombo extends Widget { static xtype: string; static EVENT_CHANGE: string; + static EVENT_BEFORE_POPUPVIEW: string; + + props: { + container?: string; + popup?: any; + }; getValue(): [T]; + + getPopup(): PopupView; } diff --git a/packages/fineui/typescript/widget/timeinterval/dateinterval.ts b/packages/fineui/typescript/widget/timeinterval/dateinterval.ts index 31001fe6a..27ca6f787 100644 --- a/packages/fineui/typescript/widget/timeinterval/dateinterval.ts +++ b/packages/fineui/typescript/widget/timeinterval/dateinterval.ts @@ -1,5 +1,5 @@ import { Single } from "../../base/single/single"; -import { DynamicDataComboValue } from "../dynamicdate/dynamicdate.combo"; +import { DynamicDataComboValue, DynamicDateCombo } from "../dynamicdate/dynamicdate.combo"; export declare class DateInterval extends Single { static xtype: string; @@ -7,13 +7,17 @@ export declare class DateInterval extends Single { static EVENT_VALID: string; static EVENT_ERROR: string; static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW: string; + static EVENT_BEFORE_START_POPUPVIEW: string; + static EVENT_BEFORE_END_POPUPVIEW: string; props: { minDate?: string; maxDate?: string; supportDynamic?: boolean; watermark?: string; - } & Single['props'] + container?: string; + popup?: any; + } & Single["props"]; getValue(): { start: DynamicDataComboValue; @@ -23,4 +27,9 @@ export declare class DateInterval extends Single { setMinDate(minDate: string): void; setMaxDate(minDate: string): void; + + getPopup(): { + start: DynamicDateCombo; + end: DynamicDateCombo; + }; } diff --git a/packages/fineui/typescript/widget/timeinterval/timeinterval.ts b/packages/fineui/typescript/widget/timeinterval/timeinterval.ts index 87d4fd977..e7a72f9af 100644 --- a/packages/fineui/typescript/widget/timeinterval/timeinterval.ts +++ b/packages/fineui/typescript/widget/timeinterval/timeinterval.ts @@ -1,11 +1,13 @@ import { Single } from "../../base/single/single"; -import { DynamicDateTimeComboValue } from "../dynamicdatetime/dynamicdatetime.combo"; +import { DynamicDateTimeCombo, DynamicDateTimeComboValue } from "../dynamicdatetime/dynamicdatetime.combo"; export declare class TimeInterval extends Single { static xtype: string; static EVENT_CHANGE: string; static EVENT_VALID: string; static EVENT_ERROR: string; + static EVENT_BEFORE_START_POPUPVIEW: string; + static EVENT_BEFORE_END_POPUPVIEW: string; props: { minDate?: string; @@ -13,6 +15,8 @@ export declare class TimeInterval extends Single { supportDynamic?: boolean; watermark?: string; simple?: boolean; + container?: string; + popup?: any; } & Single['props']; getValue(): { @@ -23,4 +27,9 @@ export declare class TimeInterval extends Single { setMinDate(minDate: string): void; setMaxDate(minDate: string): void; + + getPopup(): { + start: DynamicDateTimeCombo; + end: DynamicDateTimeCombo; + }; } diff --git a/packages/fineui/typescript/widget/year/combo.year.ts b/packages/fineui/typescript/widget/year/combo.year.ts index 5b9b21acb..78917340b 100644 --- a/packages/fineui/typescript/widget/year/combo.year.ts +++ b/packages/fineui/typescript/widget/year/combo.year.ts @@ -1,3 +1,4 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Widget } from "../../core/widget"; export declare class DynamicYearCombo extends Widget { @@ -7,11 +8,17 @@ export declare class DynamicYearCombo extends Widget { static EVENT_CONFIRM: string; static EVENT_BEFORE_POPUPVIEW: string; + props: { + popup?: any; + }; + getValue(): DynamicYearComboValue; setMinDate(minDate: string): void; setMaxDate(maxDate: string): void; + + getPopup(): PopupView; } export interface DynamicYearComboValue { diff --git a/packages/fineui/typescript/widget/yearmonth/combo.yearmonth.ts b/packages/fineui/typescript/widget/yearmonth/combo.yearmonth.ts index 10f198e46..36a75cbff 100644 --- a/packages/fineui/typescript/widget/yearmonth/combo.yearmonth.ts +++ b/packages/fineui/typescript/widget/yearmonth/combo.yearmonth.ts @@ -1,3 +1,4 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Single } from "../../base/single/single"; export declare class DynamicYearMonthCombo extends Single { @@ -8,6 +9,10 @@ export declare class DynamicYearMonthCombo extends Single { static EVENT_CONFIRM: string; static EVENT_BEFORE_POPUPVIEW: string; + props: { + popup?: any; + } & Single["props"]; + hideView(): void; getKey(): string; @@ -17,6 +22,8 @@ export declare class DynamicYearMonthCombo extends Single { setMinDate(minDate: string): void; setMaxDate(maxDate: string): void; + + getPopup(): PopupView; } export interface DynamicYearMonthComboValue { diff --git a/packages/fineui/typescript/widget/yearmonthinterval/yearmonthinterval.ts b/packages/fineui/typescript/widget/yearmonthinterval/yearmonthinterval.ts index 9da536c22..a17c5d36e 100644 --- a/packages/fineui/typescript/widget/yearmonthinterval/yearmonthinterval.ts +++ b/packages/fineui/typescript/widget/yearmonthinterval/yearmonthinterval.ts @@ -1,5 +1,5 @@ import { Single } from '../../base/single/single'; -import { DynamicYearMonthComboValue } from '../yearmonth/combo.yearmonth'; +import { DynamicYearMonthCombo, DynamicYearMonthComboValue } from '../yearmonth/combo.yearmonth'; export declare class YearMonthInterval extends Single { static xtype: string; @@ -7,9 +7,13 @@ export declare class YearMonthInterval extends Single { static EVENT_ERROR: string; static EVENT_CHANGE: string; static EVENT_BEFORE_POPUPVIEW: string; + static EVENT_BEFORE_START_POPUPVIEW: string; + static EVENT_BEFORE_END_POPUPVIEW: string; props: { simple?: boolean; + container?: string; + popup?: any; } & Single['props']; getValue(): { @@ -20,4 +24,9 @@ export declare class YearMonthInterval extends Single { setMinDate(minDate: string): void; setMaxDate(maxDate: string): void; + + getPopup(): { + start: DynamicYearMonthCombo; + end: DynamicYearMonthCombo; + }; } diff --git a/packages/fineui/typescript/widget/yearquarter/combo.yearquarter.ts b/packages/fineui/typescript/widget/yearquarter/combo.yearquarter.ts index f1a07770b..de9564b3e 100644 --- a/packages/fineui/typescript/widget/yearquarter/combo.yearquarter.ts +++ b/packages/fineui/typescript/widget/yearquarter/combo.yearquarter.ts @@ -1,3 +1,4 @@ +import { PopupView } from "../../base/layer/layer.popup"; import { Widget } from "../../core/widget"; export declare class DynamicYearQuarterCombo extends Widget { @@ -5,11 +6,17 @@ export declare class DynamicYearQuarterCombo extends Widget { static EVENT_CONFIRM: string; static EVENT_BEFORE_POPUPVIEW: string; + props: { + popup?: any; + }; + getValue(): DynamicYearQuarterComboValue; setMinDate(minDate: string): void; setMaxDate(maxDate: string): void; + + getPopup(): PopupView; } export interface DynamicYearQuarterComboValue { From 191175deeaf6940b97e3616b16d80f889719d0b5 Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Fri, 26 Jul 2024 16:50:28 +0800 Subject: [PATCH 05/11] =?UTF-8?q?BI-124572=20fix:=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=BB=E9=A2=98=E8=89=B2=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/base/single/input/radio/radio.js | 9 --------- packages/fineui/src/case/toolbar/toolbar.multiselect.js | 1 + 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/fineui/src/base/single/input/radio/radio.js b/packages/fineui/src/base/single/input/radio/radio.js index fa6a10401..aa9eae19b 100644 --- a/packages/fineui/src/base/single/input/radio/radio.js +++ b/packages/fineui/src/base/single/input/radio/radio.js @@ -56,13 +56,4 @@ export class Radio extends BasicButton { this.fireEvent(Radio.EVENT_CHANGE); } } - - setSelected(b) { - super.setSelected(b); - if (b) { - this.radio.element.addClass("bi-high-light-background"); - } else { - this.radio.element.removeClass("bi-high-light-background"); - } - } } diff --git a/packages/fineui/src/case/toolbar/toolbar.multiselect.js b/packages/fineui/src/case/toolbar/toolbar.multiselect.js index f0df9ce78..9ca7281de 100644 --- a/packages/fineui/src/case/toolbar/toolbar.multiselect.js +++ b/packages/fineui/src/case/toolbar/toolbar.multiselect.js @@ -126,6 +126,7 @@ export class MultiSelectBar extends BasicButton { } setSelected(v) { + super.setSelected(v); this.checkbox.setSelected(v); this.setHalfSelected(false); } From 5c0d4a81c9f2e8fcb86b82dda62fd93160e55b4c Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Mon, 29 Jul 2024 10:35:13 +0800 Subject: [PATCH 06/11] =?UTF-8?q?BI-153053=20fix:=20=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E5=8A=A0=E8=BD=BD=E6=8C=89=E9=92=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/case/ztree/asynctree.js | 4 ---- packages/fineui/src/less/base/tree/ztree.less | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/fineui/src/case/ztree/asynctree.js b/packages/fineui/src/case/ztree/asynctree.js index 7921ef821..7c6efe09c 100644 --- a/packages/fineui/src/case/ztree/asynctree.js +++ b/packages/fineui/src/case/ztree/asynctree.js @@ -221,15 +221,11 @@ export class AsyncTree extends TreeView { { el: { type: IconLabel.xtype, - width: 20, - height: 20, cls: "button-loading-font anim-rotate bi-card", ref: ref => { loadingIcon = ref; }, }, - left: 5, - top: 5, }, ], }); diff --git a/packages/fineui/src/less/base/tree/ztree.less b/packages/fineui/src/less/base/tree/ztree.less index e7869baae..4932e49ef 100644 --- a/packages/fineui/src/less/base/tree/ztree.less +++ b/packages/fineui/src/less/base/tree/ztree.less @@ -335,3 +335,10 @@ margin-right: 2px; vertical-align: top; } + +.ztree .button-loading-font { + .use-scale(width, 20px); + .use-scale(height, 20px); + .use-scale(left, 5px); + .use-scale(top, 5px); +} \ No newline at end of file From d161133498a13eaaf615aa49c0a5c32ce03eb462 Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Mon, 29 Jul 2024 20:44:30 +0800 Subject: [PATCH 07/11] =?UTF-8?q?KERNEL-18940=20refactor:=20=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=90=9C=E7=B4=A2=EF=BC=8C=E6=96=B0=E5=A2=9E=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E5=B1=9E=E6=80=A7=E5=92=8C=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiselect/multiselect.insert.combo.js | 13 ++++++++++++- .../multiselect/multiselect.insert.trigger.js | 2 +- .../widget/multiselect/multiselect.trigger.js | 2 +- .../trigger/searcher.multiselect.insert.js | 4 ++++ .../src/widget/multitree/multi.tree.combo.js | 18 +++++++++++++++--- .../multitree/trigger/searcher.multi.tree.js | 4 ++++ .../singleselect/singleselect.insert.combo.js | 18 ++++++++++++++++-- .../trigger/searcher.singleselect.js | 4 ++++ 8 files changed, 57 insertions(+), 8 deletions(-) diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js index 0e41b1b10..4cf2d8dfd 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js +++ b/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; + } } diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.trigger.js b/packages/fineui/src/widget/multiselect/multiselect.insert.trigger.js index b7be3abf6..d292971c0 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.trigger.js +++ b/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, diff --git a/packages/fineui/src/widget/multiselect/multiselect.trigger.js b/packages/fineui/src/widget/multiselect/multiselect.trigger.js index d0666731d..8bfcfb6f7 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.trigger.js +++ b/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, diff --git a/packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js index 36d2cf184..cb948a7ac 100644 --- a/packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js +++ b/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(); } diff --git a/packages/fineui/src/widget/multitree/multi.tree.combo.js b/packages/fineui/src/widget/multitree/multi.tree.combo.js index cc8ab0e60..8edab4f41 100644 --- a/packages/fineui/src/widget/multitree/multi.tree.combo.js +++ b/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; + } } diff --git a/packages/fineui/src/widget/multitree/trigger/searcher.multi.tree.js b/packages/fineui/src/widget/multitree/trigger/searcher.multi.tree.js index 518dff408..972f8ac15 100644 --- a/packages/fineui/src/widget/multitree/trigger/searcher.multi.tree.js +++ b/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); diff --git a/packages/fineui/src/widget/singleselect/singleselect.insert.combo.js b/packages/fineui/src/widget/singleselect/singleselect.insert.combo.js index 5bf6dc855..8b07ee6ec 100644 --- a/packages/fineui/src/widget/singleselect/singleselect.insert.combo.js +++ b/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; + } } diff --git a/packages/fineui/src/widget/singleselect/trigger/searcher.singleselect.js b/packages/fineui/src/widget/singleselect/trigger/searcher.singleselect.js index 31ebc6f67..c9df1bde1 100644 --- a/packages/fineui/src/widget/singleselect/trigger/searcher.singleselect.js +++ b/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); } From 06435006a4471815fcc3baeee56ce914f4afe746 Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Tue, 20 Aug 2024 14:04:16 +0800 Subject: [PATCH 08/11] =?UTF-8?q?BI-154136=20fix:=20=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E8=A2=AB=E9=81=AE=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/utils/dom.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/fineui/src/core/utils/dom.js b/packages/fineui/src/core/utils/dom.js index 1be70de14..0530cfe95 100644 --- a/packages/fineui/src/core/utils/dom.js +++ b/packages/fineui/src/core/utils/dom.js @@ -743,12 +743,13 @@ export function getComboPosition(combo, popup, extraWidth, extraHeight, needAdap } if (needAdaptHeight === true && popup.resetHeight) { const comboRect = combo.element[0].getBoundingClientRect(); + const scale = comboRect.height / combo.element.height(); const relativeOffset = positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0; const positionTop = position.top + relativeOffset; if (positionTop < comboRect.top) { - popup.resetHeight(Math.min(viewportBounds.height - positionTop, comboRect.top, maxHeight)); + popup.resetHeight(Math.min((viewportBounds.height - positionTop) / scale, comboRect.top / scale, maxHeight)); } else if (positionTop >= comboRect.bottom) { - popup.resetHeight(Math.min(viewportBounds.height - positionTop, viewportBounds.height - comboRect.bottom, maxHeight)); + popup.resetHeight(Math.min((viewportBounds.height - positionTop) / scale, (viewportBounds.height - comboRect.bottom) / scale, maxHeight)); } } From 4b0f0a951b004e554ff76617bad7e6db0b27e94e Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Fri, 23 Aug 2024 15:30:14 +0800 Subject: [PATCH 09/11] =?UTF-8?q?BI-154253=20fix:=20=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/utils/dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fineui/src/core/utils/dom.js b/packages/fineui/src/core/utils/dom.js index 0530cfe95..275aa3adf 100644 --- a/packages/fineui/src/core/utils/dom.js +++ b/packages/fineui/src/core/utils/dom.js @@ -743,7 +743,7 @@ export function getComboPosition(combo, popup, extraWidth, extraHeight, needAdap } if (needAdaptHeight === true && popup.resetHeight) { const comboRect = combo.element[0].getBoundingClientRect(); - const scale = comboRect.height / combo.element.height(); + const scale = comboRect.height === 0 ? 1 : comboRect.height / combo.element.height(); const relativeOffset = positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0; const positionTop = position.top + relativeOffset; if (positionTop < comboRect.top) { From df79823d5acdeee937b3349018fa259e38110b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Mon, 26 Aug 2024 11:13:47 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E6=97=A0JIRA=20tab=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AD=90card=20destory=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/base/combination/tab.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/fineui/src/base/combination/tab.js b/packages/fineui/src/base/combination/tab.js index c9f79278a..8c6da9f4d 100644 --- a/packages/fineui/src/base/combination/tab.js +++ b/packages/fineui/src/base/combination/tab.js @@ -13,7 +13,8 @@ import { contains, any, isEqual, - LogicFactory + LogicFactory, + Events, } from "@/core"; /** @@ -106,7 +107,11 @@ export class Tab extends Widget { Widget.execWithContext(this, () => { this.cardMap[v] = cardCreator(v); }); - this.layout.addCardByName(v, this.cardMap[v]); + const card = this.layout.addCardByName(v, this.cardMap[v]); + card.on(Events.DESTROY, () => { + this.layout.deleteCardByName(v); + delete this.cardMap[v]; + }); } } From 1cc207c31cab4b89a0af7a907bbea1d0e3ea54b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Mon, 26 Aug 2024 11:16:16 +0800 Subject: [PATCH 11/11] =?UTF-8?q?Revert=20"=E6=97=A0JIRA=20layout=20?= =?UTF-8?q?=E7=9A=84updateChildren=E8=BF=87=E7=A8=8B=E4=B8=AD=E4=BC=A0?= =?UTF-8?q?=E9=80=92context"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit f0750f646f8cf8a6de071f6ae73b192a853ff951. --- packages/fineui/src/core/wrapper/layout.js | 154 +++++++++------------ 1 file changed, 68 insertions(+), 86 deletions(-) diff --git a/packages/fineui/src/core/wrapper/layout.js b/packages/fineui/src/core/wrapper/layout.js index adaf5d351..288d586eb 100644 --- a/packages/fineui/src/core/wrapper/layout.js +++ b/packages/fineui/src/core/wrapper/layout.js @@ -1,17 +1,4 @@ -import { - isNull, - isFunction, - each, - stripEL, - keys, - isArray, - contains, - isKey, - isOdd, - isWidget, - isNotNull, - has -} from "../2.base"; +import { isNull, isFunction, each, stripEL, keys, isArray, contains, isKey, isOdd, isWidget, isNotNull, has } from "../2.base"; import { Widget } from "../4.widget"; import { _lazyCreateWidget, Providers } from "../5.inject"; import { shortcut } from "../decorator"; @@ -78,38 +65,38 @@ export class Layout extends Widget { _init4Scroll() { switch (this.options.scrollable) { - case true: - case "xy": - this.element.css("overflow", "auto"); - - return; - case false: - this.element.css("overflow", "hidden"); - - return; - case "x": - this.element.css({ - "overflow-x": "auto", - "overflow-y": "hidden", - }); - - return; - case "y": - this.element.css({ - "overflow-x": "hidden", - "overflow-y": "auto", - }); - - return; - default : - break; + case true: + case "xy": + this.element.css("overflow", "auto"); + + return; + case false: + this.element.css("overflow", "hidden"); + + return; + case "x": + this.element.css({ + "overflow-x": "auto", + "overflow-y": "hidden", + }); + + return; + case "y": + this.element.css({ + "overflow-x": "hidden", + "overflow-y": "auto", + }); + + return; + default : + break; } if (this.options.scrollx) { this.element.css({ "overflow-x": "auto", "overflow-y": "hidden", }); - + return; } if (this.options.scrolly) { @@ -162,7 +149,7 @@ export class Layout extends Widget { } else { w = this.getWidgetByName(this._getChildName(i)); } - + return w; } @@ -176,7 +163,7 @@ export class Layout extends Widget { } }); }); - + return this._addElement(i, item, context, w); } @@ -188,7 +175,7 @@ export class Layout extends Widget { if (item instanceof Widget) { item = item.options; } - + return item; } @@ -203,19 +190,19 @@ export class Layout extends Widget { } const className = Object.prototype.toString.call(a); switch (className) { - case "[object RegExp]": - case "[object String]": - return `${a}` === `${b}`; - case "[object Number]": - if (+a !== +a) { - return +b !== +b; - } - - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case "[object Date]": - case "[object Boolean]": - return +a === +b; - default: + case "[object RegExp]": + case "[object String]": + return `${a}` === `${b}`; + case "[object Number]": + if (+a !== +a) { + return +b !== +b; + } + + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + return +a === +b; + default: } const areArrays = className === "[object Array]"; @@ -265,10 +252,10 @@ export class Layout extends Widget { } aStack.pop(); bStack.pop(); - + return true; }; - + return eq(item1, item2); } @@ -277,9 +264,9 @@ export class Layout extends Widget { } // 不依赖于this.options.items进行更新 - _updateItemAt(oldIndex, newIndex, item, context) { + _updateItemAt(oldIndex, newIndex, item) { const del = this._children[this._getChildName(oldIndex)]; - const w = this._newElement(newIndex, item, context); + const w = this._newElement(newIndex, item); // 需要有个地方临时存一下新建的组件,否则如果直接使用newIndex的话,newIndex位置的元素可能会被用到 this._children[`${this._getChildName(newIndex)}-temp`] = w; const nextSibling = del.element.next(); @@ -290,7 +277,7 @@ export class Layout extends Widget { } del._destroy(); w._mount(); - + return true; } @@ -327,47 +314,42 @@ export class Layout extends Widget { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._lgap || 0) + (item.lgap || 0)) : item._lgap) || 0; } - + return (item._lgap || 0) + (item.lgap || 0); } - _optimiseItemRgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._rgap || 0) + (item.rgap || 0)) : item._rgap) || 0; } - + return (item._rgap || 0) + (item.rgap || 0); } - _optimiseItemTgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._tgap || 0) + (item.tgap || 0)) : item._tgap) || 0; } - + return (item._tgap || 0) + (item.tgap || 0); } - _optimiseItemBgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._bgap || 0) + (item.bgap || 0)) : item._bgap) || 0; } - + return (item._bgap || 0) + (item.bgap || 0); } - _optimiseItemHgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._hgap || 0) + (item.hgap || 0)) : item._hgap) || 0; } - + return (item._hgap || 0) + (item.hgap || 0); } - _optimiseItemVgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._vgap || 0) + (item.vgap || 0)) : item._vgap) || 0; } - + return (item._vgap || 0) + (item.vgap || 0); } @@ -468,7 +450,7 @@ export class Layout extends Widget { w.element.prependTo(this._getWrapper()); } w._mount(); - + return w; } @@ -497,7 +479,7 @@ export class Layout extends Widget { if (!child || !child.shouldUpdate) { return null; } - + return child.shouldUpdate(this._getOptions(item)); } @@ -550,7 +532,7 @@ export class Layout extends Widget { value = value.concat(v); } }); - + return value; } @@ -570,19 +552,19 @@ export class Layout extends Widget { }); } - patchItem(oldVnode, vnode, oldIndex, newIndex, context) { + patchItem(oldVnode, vnode, oldIndex, newIndex) { const shouldUpdate = this.shouldUpdateItem(oldIndex, vnode); const child = this._children[this._getChildName(oldIndex)]; if (shouldUpdate) { this._children[`${this._getChildName(newIndex)}-temp`] = child; - + return child._update(this._getOptions(vnode), shouldUpdate); } if (shouldUpdate === null && !this._compare(oldVnode, vnode)) { // if (child.update) { // return child.update(this._getOptions(vnode)); // } - return this._updateItemAt(oldIndex, newIndex, vnode, context); + return this._updateItemAt(oldIndex, newIndex, vnode); } } @@ -665,7 +647,7 @@ export class Layout extends Widget { findIndex = i; } } - + return [found, findIndex]; }; @@ -683,26 +665,26 @@ export class Layout extends Widget { } else if (isNull(oldEndVnode)) { oldEndVnode = oldCh[--oldEndIdx]; } else if (sameVnode(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx)) { - const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx, context); + const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (sameVnode(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx)) { - const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx, context); + const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx); updated = willUpdate || updated; children[isNull(oldEndVnode.key) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldStartVnode, newEndVnode)) { - const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx, context); + const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; insertBefore(oldStartVnode, oldEndVnode, true); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldEndVnode, newStartVnode)) { - const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx, context); + const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx); updated = willUpdate || updated; children[isNull(oldEndVnode) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; insertBefore(oldEndVnode, oldStartVnode); @@ -715,7 +697,7 @@ export class Layout extends Widget { insertBefore(node, oldStartVnode); } else { // 如果新节点在旧节点区间中存在就复用一下 const sameOldIndex = sameOldVnode[1]; - const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx, context); + const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx); updated = willUpdate || updated; children[isNull(sameOldVnode[0].key) ? newStartIdx : sameOldVnode[0].key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(sameOldIndex)]; oldCh[sameOldIndex] = undefined; @@ -762,7 +744,7 @@ export class Layout extends Widget { const context = opt.context; const oldItems = o.items; this.options.items = items; - + return this.updateChildren(oldItems, items, context); } @@ -826,7 +808,7 @@ export class Layout extends Widget { items, context: options.context, }); - + return; } this.options.items = items;