From 91ca48b4b679186f57887fc58fbf8cc568891e89 Mon Sep 17 00:00:00 2001 From: zsmj Date: Fri, 5 May 2023 16:09:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-95320=20fix:=20=E3=80=90=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E3=80=90=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=91=E6=9D=83=E9=99=90=E5=A4=8D=E7=94=A8=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=B9=B6=E9=80=89=E4=B8=AD=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=8F=96=E6=B6=88=E6=90=9C=E7=B4=A2=E5=90=8E?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=AE=9E=E9=99=85=E6=9C=AA=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../abstract.treevaluechooser.js | 96 ++++++++++--------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js b/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js index 317104409..87e23cb84 100644 --- a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js @@ -51,12 +51,12 @@ export class AbstractTreeValueChooser extends Widget { some(this.items, (i, item) => { if (item.value === v || `${item.value}` === v) { text = item.text; - + return true; } }); } - + return text; } @@ -104,7 +104,7 @@ export class AbstractTreeValueChooser extends Widget { if (selectedValues == null || isEmpty(selectedValues)) { callback({}); - + return; } @@ -128,7 +128,7 @@ export class AbstractTreeValueChooser extends Widget { createOneJson(child, node.id, llen); doCheck(newParents, child, {}); }); - + return; } each(selected, k => { @@ -181,7 +181,7 @@ export class AbstractTreeValueChooser extends Widget { if (selectedValues == null || isEmpty(selectedValues)) { callback({}); - + return; } @@ -300,7 +300,7 @@ export class AbstractTreeValueChooser extends Widget { newParents.push(current); if (this._isMatch(parents, current, keyword)) { searched && searched.push(newParents); - + return true; } @@ -323,7 +323,7 @@ export class AbstractTreeValueChooser extends Widget { result.push(next); }); } - + return can; }; @@ -333,7 +333,7 @@ export class AbstractTreeValueChooser extends Widget { return true; } } - + return false; }; @@ -346,7 +346,7 @@ export class AbstractTreeValueChooser extends Widget { return false; } } - + return true; } @@ -362,7 +362,7 @@ export class AbstractTreeValueChooser extends Widget { return true; } } - + return false; } } @@ -372,20 +372,14 @@ export class AbstractTreeValueChooser extends Widget { const selectedValues = op.selectedValues; if (selectedValues == null || isEmpty(selectedValues)) { callback({}); - + return; } each(selectedValues, (k, v) => { result.push([k]); }); - dealWithSelectedValues(selectedValues, []); - - const jo = {}; - each(result, (i, strs) => { - this._buildTree(jo, strs); - }); - callback(jo); + const isAllSelected = (selected, parents) => isEmpty(selected) || this._getChildCount(parents) === size(selected); function dealWithSelectedValues(selected, parents) { if (selected == null || isEmpty(selected)) { @@ -404,11 +398,19 @@ export class AbstractTreeValueChooser extends Widget { can = false; } }); - + return can && isAllSelected(selected, parents); } - const isAllSelected = (selected, parents) => isEmpty(selected) || this._getChildCount(parents) === size(selected); + dealWithSelectedValues(selectedValues, []); + + const jo = {}; + each(result, (i, strs) => { + this._buildTree(jo, strs); + }); + callback(jo); + + } _reqInitTreeNode(op, callback) { @@ -461,15 +463,15 @@ export class AbstractTreeValueChooser extends Widget { result = concat( filter(nodes, (idx, node) => { const find = Func.getSearchResult([node.text || node.value], keyword); - + return find.find.length > 0 || find.match.length > 0; }), result ); } - + return output; - }; + } function nodeSearch(deep, parentValues, current, isAllSelect, result) { if (self._isMatch(parentValues, current, keyword)) { @@ -483,7 +485,7 @@ export class AbstractTreeValueChooser extends Widget { true, result ); - + return [true, checked]; } const newParents = clone(parentValues); @@ -510,9 +512,9 @@ export class AbstractTreeValueChooser extends Widget { checked = isCurAllSelected || (isSelected(parentValues, current) && checked); createOneJson(parentValues, current, true, checked, false, false, result); } - + return [can, checked]; - }; + } function createOneJson(parentValues, value, isOpen, checked, half, flag, result) { const node = self._getTreeNode(parentValues, value); @@ -529,14 +531,14 @@ export class AbstractTreeValueChooser extends Widget { flag, disabled: node.disabled, }); - }; + } function isHalf(parentValues, value) { const find = findSelectedObj(parentValues); if (find == null) { return null; } - + return any(find, (v, ob) => { if (v === value) { if (ob != null && !isEmpty(ob)) { @@ -551,7 +553,7 @@ export class AbstractTreeValueChooser extends Widget { if (find == null) { return null; } - + return any(find, (v, ob) => { if (v === value) { if (ob != null && isEmpty(ob)) { @@ -566,7 +568,7 @@ export class AbstractTreeValueChooser extends Widget { if (find == null) { return false; } - + return any(find, v => { if (v === value) { return true; @@ -584,10 +586,10 @@ export class AbstractTreeValueChooser extends Widget { if (find == null) { return false; } - + return true; }); - + return find; } } @@ -626,7 +628,7 @@ export class AbstractTreeValueChooser extends Widget { // 不是上面那种情况就先看在节点没有带有明确半选的时候,通过节点自身的checked和valueMap的状态能都得到选中信息 check = ((tempCheck || checked) && !half) || has(valueMap, current); } - + return [check, halfCheck]; }; const getResult = (parentValues, checkState) => { @@ -636,33 +638,33 @@ export class AbstractTreeValueChooser extends Widget { if (isEmpty(selected)) { return true; } - + if (this._getChildCount(parents) !== size(selected)) { return false; } - + return every(selected, value => isAllSelected(selected[value], concat(parents, value))); }; - + function dealWithSelectedValue(parentValues, selectedValues) { const valueMap = {}, parents = (parentValues || []).slice(0); each(parentValues, (i, v) => { parents.push(v); - + selectedValues = selectedValues[v] || {}; }); each(selectedValues, (value, obj) => { const currentParents = concat(parents, value); - + if (isNull(obj)) { valueMap[value] = [0, 0]; - + return; } if (isEmpty(obj)) { valueMap[value] = [2, 0]; - + return; } const nextNames = {}; @@ -676,7 +678,7 @@ export class AbstractTreeValueChooser extends Widget { // valueMap的数组第一个参数为不选: 0, 半选: 1, 全选:2, 第二个参数为改节点下选中的子节点个数(子节点全选或者不存在) valueMap[value] = [1, size(nextNames)]; }); - + return valueMap; } valueMap = dealWithSelectedValue(parentValues, selectedValues); @@ -773,7 +775,7 @@ export class AbstractTreeValueChooser extends Widget { _getAddedValueNode(parentValues, selectedValues) { const nodes = this._getChildren(parentValues); - + return map(difference(keys(selectedValues), map(nodes, "value")), (idx, v) => { return { id: UUID(), @@ -796,7 +798,7 @@ export class AbstractTreeValueChooser extends Widget { } pNode = pNode[parentValues[i]]; } - + return pNode; } @@ -837,12 +839,12 @@ export class AbstractTreeValueChooser extends Widget { const find = Func.getSearchResult([node.text || node.value], keyword); if (o.allowSearchValue && node.value) { const valueFind = Func.getSearchResult([node.value], keyword); - + return ( valueFind.find.length > 0 || valueFind.match.length > 0 || find.find.length > 0 || find.match.length > 0 ); } - + return find.find.length > 0 || find.match.length > 0; } @@ -919,7 +921,7 @@ export class AbstractTreeValueChooser extends Widget { queue = queue.concat(childNodes); nodes = nodes.concat(childNodes); } - + return nodes; } @@ -972,7 +974,7 @@ export class AbstractTreeValueChooser extends Widget { r[child.value] = {}; fill(newParents, child, null, r[child.value]); }); - + return; } each(selected, k => { From 52d8f2ea4d44591d396e825446b6a76cd2f619c3 Mon Sep 17 00:00:00 2001 From: zsmj Date: Fri, 5 May 2023 16:23:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BI-125865=20fix:=20=E3=80=906.0.10=E5=8F=91?= =?UTF-8?q?=E6=95=A3=E3=80=91=E5=B1=95=E5=BC=80=E6=95=B0=E6=8D=AE=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E5=90=8E=EF=BC=8C=E8=B0=83=E6=95=B4=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E7=AA=97=E5=8F=A3=EF=BC=8C=E9=A1=B5=E9=9D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 代码结构缺陷,core的不能反过来依赖base的. 所以直接把依赖注入 --- packages/fineui/src/base/0.base.js | 2 +- .../src/core/controller/controller.layer.js | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/fineui/src/base/0.base.js b/packages/fineui/src/base/0.base.js index 3cf9b52a3..6e224dbce 100644 --- a/packages/fineui/src/base/0.base.js +++ b/packages/fineui/src/base/0.base.js @@ -11,7 +11,7 @@ import { import { StyleLoaderManager } from '../core/loader/loader.style'; const Resizers = new ResizeController(); -const Layers = new LayerController(); +const Layers = new LayerController(Resizers); const Maskers = new MaskersController(); const Bubbles = new BubblesController(); const Tooltips = new TooltipsController(); diff --git a/packages/fineui/src/core/controller/controller.layer.js b/packages/fineui/src/core/controller/controller.layer.js index 9701a6d60..7b3196ef2 100644 --- a/packages/fineui/src/core/controller/controller.layer.js +++ b/packages/fineui/src/core/controller/controller.layer.js @@ -9,17 +9,17 @@ import { Widget } from "../4.widget"; import { createWidget } from "../5.inject"; import { zIndex_layer } from "../constant"; import { DOM } from "../utils"; -// import { Resizers } from "../../base/0.base"; export class LayerController extends Controller { - constructor() { + constructor(Resizers) { super(); this._constructor(); + this.Resizers = Resizers; } - + props = { render: "body", - } + }; init() { this.layerManager = {}; @@ -28,7 +28,7 @@ export class LayerController extends Controller { } _initResizer() { - // this.resizer = Resizers.add(`layerController${uniqueId()}`, bind(this._resize, this)); + this.resizer = this.Resizers.add(`layerController${uniqueId()}`, bind(this._resize, this)); } _resize() { @@ -47,7 +47,7 @@ export class LayerController extends Controller { context = op; op = container; } - + return this.create(name, null, op, context); } @@ -124,7 +124,7 @@ export class LayerController extends Controller { }); } this.add(name, widget, layout); - + return widget; } @@ -134,7 +134,7 @@ export class LayerController extends Controller { } this._getLayout(name).visible(); this._getLayout(name).element.css("z-index", this.zindex++).show(0, callback).trigger("__resize__"); - + return this; } @@ -144,7 +144,7 @@ export class LayerController extends Controller { } this._getLayout(name).invisible(); this._getLayout(name).element.hide(0, callback); - + return this; } @@ -160,7 +160,7 @@ export class LayerController extends Controller { this.layerManager[name] = layer; this.layouts[name] = layout; layout.element.css("z-index", this.zindex++); - + return this; } @@ -184,7 +184,7 @@ export class LayerController extends Controller { this.layouts[name].destroy(); delete this.layerManager[name]; delete this.layouts[name]; - + return this; } @@ -195,7 +195,7 @@ export class LayerController extends Controller { }); this.layerManager = {}; this.layouts = {}; - + return this; } }