Browse Source

Merge remote-tracking branch 'origin/master'

es6
guy 2 years ago
parent
commit
78779feeec
  1. 2
      package.json
  2. 34
      src/component/treevaluechooser/abstract.treevaluechooser.js
  3. 2
      src/component/treevaluechooser/combo.treevaluechooser.js
  4. 3
      src/component/treevaluechooser/pane.treevaluechooser.js
  5. 11
      src/less/base/single/html.less
  6. 7
      src/less/base/tree/ztree.less

2
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",

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

@ -851,6 +851,40 @@ 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), {});
}
});
// 执行完一条路径,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) {
var self = this;
var result = {};

2
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),

3
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);

11
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
}
}
}

7
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 {

Loading…
Cancel
Save