From e7bde3a56985a2e61b45ab0f0ae5ca304aaa6fdf Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 21 Sep 2022 16:26:41 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=97=A0JIRA=20=E5=88=A0=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BA=8Eless?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/less/base/single/html.less | 11 +++-------- src/less/base/tree/ztree.less | 7 ------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/less/base/single/html.less b/src/less/base/single/html.less index 3159bc630..0a4279397 100644 --- a/src/less/base/single/html.less +++ b/src/less/base/single/html.less @@ -18,8 +18,6 @@ canvas, video { display: inline-block; - *display: inline; - *zoom: 1 } audio:not([controls]) { display: none; @@ -180,7 +178,6 @@ border: 0; padding: 0; white-space: normal; - *margin-left: -7px } button, input, @@ -189,7 +186,6 @@ font-size: 100%; margin: 0; vertical-align: baseline; - *vertical-align: middle } button, input { @@ -201,7 +197,6 @@ input[type="submit"] { -webkit-appearance: button; cursor: pointer; - *overflow: visible } button[disabled], input[disabled] { @@ -211,8 +206,8 @@ input[type="radio"] { box-sizing: border-box; padding: 0; - *height: 13px; - *width: 13px + height: 13px; + width: 13px } input[type="search"] { -webkit-appearance: textfield; @@ -237,4 +232,4 @@ border-collapse: collapse; border-spacing: 0 } -} \ No newline at end of file +} diff --git a/src/less/base/tree/ztree.less b/src/less/base/tree/ztree.less index 6f6fa77c7..e300e0be4 100644 --- a/src/less/base/tree/ztree.less +++ b/src/less/base/tree/ztree.less @@ -130,7 +130,6 @@ margin: 0; font-size: 12px; border: 1px #7EC4CC solid; - *border: 0px } .ztree li span { @@ -315,42 +314,36 @@ margin-right: 2px; background-position: -110px -16px; vertical-align: top; - *vertical-align: middle } .ztree li span.button.ico_close { margin-right: 2px; background-position: -110px 0; vertical-align: top; - *vertical-align: middle } .ztree li span.button.ico_docu { margin-right: 2px; background-position: -110px -32px; vertical-align: top; - *vertical-align: middle } .ztree li span.button.edit { margin-right: 2px; background-position: -110px -48px; vertical-align: top; - *vertical-align: middle } .ztree li span.button.remove { margin-right: 2px; background-position: -110px -64px; vertical-align: top; - *vertical-align: middle } .ztree li span.button.ico_loading { width: 0px; margin-right: 2px; vertical-align: top; - *vertical-align: middle } ul.tmpTargetzTree { From 2e0a253cd48c38a515a3a684b103cfd6d21124b4 Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 21 Sep 2022 21:37:39 +0800 Subject: [PATCH 2/5] =?UTF-8?q?KERNEL-12891=20feat:=20treevaluechooser?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5=E6=95=B0=E7=BB=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../abstract.treevaluechooser.js | 29 +++++++++++++++++++ .../treevaluechooser/pane.treevaluechooser.js | 3 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/component/treevaluechooser/abstract.treevaluechooser.js b/src/component/treevaluechooser/abstract.treevaluechooser.js index 53e31298f..dbd1453b8 100644 --- a/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/src/component/treevaluechooser/abstract.treevaluechooser.js @@ -851,6 +851,35 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { return this._getChildren(parentValues).length; }, + assertSelectedValue: function (selectedValues, items = []) { + if (BI.isPlainObject(selectedValues)) { + return selectedValues; + } + + var tree = BI.Tree.transformToTreeFormat(items); + var value2ParentMap = {}; + BI.Tree.traversal(tree, function (index, node, pNode) { + value2ParentMap[node.value] = pNode; + }); + + var result = {}; + BI.each(selectedValues, function (index, value) { + var curr = value; + var parentPath = []; + while (curr) { + parentPath.unshift(curr); + curr = value2ParentMap[curr]?.value; + } + BI.each(parentPath, function (index) { + if (BI.isNull(BI.get(result, parentPath.slice(0, index + 1)))) { + BI.set(result, parentPath.slice(0, index + 1), {}); + } + }); + }); + + return result; + }, + buildCompleteTree: function (selectedValues) { var self = this; var result = {}; diff --git a/src/component/treevaluechooser/pane.treevaluechooser.js b/src/component/treevaluechooser/pane.treevaluechooser.js index 66486711a..8171c04d8 100644 --- a/src/component/treevaluechooser/pane.treevaluechooser.js +++ b/src/component/treevaluechooser/pane.treevaluechooser.js @@ -30,7 +30,8 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, { self.fireEvent(BI.TreeValueChooserPane.EVENT_CHANGE); }); if (BI.isNotNull(o.value)) { - this.pane.setSelectedValue(o.value); + var selectedValues = this.assertSelectedValue(o.value, o.items); + this.pane.setSelectedValue(selectedValues); } if (BI.isNotNull(o.items)) { this._initData(o.items); From b7a93e284e80f673fb74b6f2aa9686382198c112 Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 21 Sep 2022 21:43:56 +0800 Subject: [PATCH 3/5] =?UTF-8?q?KERNEL-12891=20feat:=20treevaluechooser?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5=E6=95=B0=E7=BB=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/treevaluechooser/combo.treevaluechooser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index 33cb4e520..7b42f3d74 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -30,7 +30,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { text: o.text, defaultText: o.defaultText, allowEdit: o.allowEdit, - value: o.value, + value: this.assertSelectedValue(o.value, o.items), watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), From 13ef11859bc99720aca6880b7511c8f337636fc1 Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 21 Sep 2022 22:10:35 +0800 Subject: [PATCH 4/5] =?UTF-8?q?KERNEL-12891=20feat:=20treevaluechooser?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5=E6=95=B0=E7=BB=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/treevaluechooser/abstract.treevaluechooser.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/component/treevaluechooser/abstract.treevaluechooser.js b/src/component/treevaluechooser/abstract.treevaluechooser.js index dbd1453b8..123185e08 100644 --- a/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/src/component/treevaluechooser/abstract.treevaluechooser.js @@ -875,6 +875,11 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { BI.set(result, parentPath.slice(0, index + 1), {}); } }); + // 执行完一条路径,check一下 + var lengths = BI.size(BI.get(result, parentPath.slice(0, -1))); + if (lengths === value2ParentMap[value]?.children?.length) { + BI.set(result, parentPath.slice(0, -1), {}); + } }); return result; From ae3673010a5723339226379db8b3a3584ae0cb7f Mon Sep 17 00:00:00 2001 From: data Date: Wed, 21 Sep 2022 22:34:18 +0800 Subject: [PATCH 5/5] auto upgrade version to 2.0.20220921223412 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fad3e653b..509c809e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220921174940", + "version": "2.0.20220921223412", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts",