Browse Source

Pull request #3091: 无JIRA 删除多于less

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '13ef11859bc99720aca6880b7511c8f337636fc1':
  KERNEL-12891 feat: treevaluechooser支持传入数组类型的value
  KERNEL-12891 feat: treevaluechooser支持传入数组类型的value
  KERNEL-12891 feat: treevaluechooser支持传入数组类型的value
  无JIRA 删除多于less
es6
Dailer-刘荣歆 2 years ago
parent
commit
378365e4c7
  1. 34
      src/component/treevaluechooser/abstract.treevaluechooser.js
  2. 2
      src/component/treevaluechooser/combo.treevaluechooser.js
  3. 3
      src/component/treevaluechooser/pane.treevaluechooser.js
  4. 11
      src/less/base/single/html.less
  5. 7
      src/less/base/tree/ztree.less

34
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -851,6 +851,40 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return this._getChildren(parentValues).length; 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), {});
}
});
// 执行完一条路径,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;
},
buildCompleteTree: function (selectedValues) { buildCompleteTree: function (selectedValues) {
var self = this; var self = this;
var result = {}; var result = {};

2
src/component/treevaluechooser/combo.treevaluechooser.js

@ -30,7 +30,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
text: o.text, text: o.text,
defaultText: o.defaultText, defaultText: o.defaultText,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
value: o.value, value: this.assertSelectedValue(o.value, o.items),
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),

3
src/component/treevaluechooser/pane.treevaluechooser.js

@ -30,7 +30,8 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
self.fireEvent(BI.TreeValueChooserPane.EVENT_CHANGE); self.fireEvent(BI.TreeValueChooserPane.EVENT_CHANGE);
}); });
if (BI.isNotNull(o.value)) { 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)) { if (BI.isNotNull(o.items)) {
this._initData(o.items); this._initData(o.items);

11
src/less/base/single/html.less

@ -18,8 +18,6 @@
canvas, canvas,
video { video {
display: inline-block; display: inline-block;
*display: inline;
*zoom: 1
} }
audio:not([controls]) { audio:not([controls]) {
display: none; display: none;
@ -180,7 +178,6 @@
border: 0; border: 0;
padding: 0; padding: 0;
white-space: normal; white-space: normal;
*margin-left: -7px
} }
button, button,
input, input,
@ -189,7 +186,6 @@
font-size: 100%; font-size: 100%;
margin: 0; margin: 0;
vertical-align: baseline; vertical-align: baseline;
*vertical-align: middle
} }
button, button,
input { input {
@ -201,7 +197,6 @@
input[type="submit"] { input[type="submit"] {
-webkit-appearance: button; -webkit-appearance: button;
cursor: pointer; cursor: pointer;
*overflow: visible
} }
button[disabled], button[disabled],
input[disabled] { input[disabled] {
@ -211,8 +206,8 @@
input[type="radio"] { input[type="radio"] {
box-sizing: border-box; box-sizing: border-box;
padding: 0; padding: 0;
*height: 13px; height: 13px;
*width: 13px width: 13px
} }
input[type="search"] { input[type="search"] {
-webkit-appearance: textfield; -webkit-appearance: textfield;
@ -237,4 +232,4 @@
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0 border-spacing: 0
} }
} }

7
src/less/base/tree/ztree.less

@ -130,7 +130,6 @@
margin: 0; margin: 0;
font-size: 12px; font-size: 12px;
border: 1px #7EC4CC solid; border: 1px #7EC4CC solid;
*border: 0px
} }
.ztree li span { .ztree li span {
@ -315,42 +314,36 @@
margin-right: 2px; margin-right: 2px;
background-position: -110px -16px; background-position: -110px -16px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.ico_close { .ztree li span.button.ico_close {
margin-right: 2px; margin-right: 2px;
background-position: -110px 0; background-position: -110px 0;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.ico_docu { .ztree li span.button.ico_docu {
margin-right: 2px; margin-right: 2px;
background-position: -110px -32px; background-position: -110px -32px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.edit { .ztree li span.button.edit {
margin-right: 2px; margin-right: 2px;
background-position: -110px -48px; background-position: -110px -48px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.remove { .ztree li span.button.remove {
margin-right: 2px; margin-right: 2px;
background-position: -110px -64px; background-position: -110px -64px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.ico_loading { .ztree li span.button.ico_loading {
width: 0px; width: 0px;
margin-right: 2px; margin-right: 2px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
ul.tmpTargetzTree { ul.tmpTargetzTree {

Loading…
Cancel
Save