Browse Source

REPORT-20971 feat: 可配置是否搜索实际值

es6
windy 5 years ago
parent
commit
64d82dfbe9
  1. 1
      demo/js/component/demo.treevaluechoosercombo.js
  2. 1
      demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js
  3. 1
      demo/js/widget/singletree/demo.multilayer_single_tree_combo.js
  4. 146
      dist/2.0/fineui.ie.js
  5. 146
      dist/2.0/fineui.js
  6. 146
      dist/bundle.ie.js
  7. 146
      dist/bundle.js
  8. 4
      dist/core.js
  9. 5
      dist/demo.js
  10. 146
      dist/fineui.ie.js
  11. 146
      dist/fineui.js
  12. 146
      dist/fineui_without_jquery_polyfill.js
  13. 4
      dist/utils.js
  14. 142
      dist/widget.js
  15. 2
      lodash.md
  16. 6
      src/component/treevaluechooser/abstract.treevaluechooser.js
  17. 2
      src/core/base.js
  18. 2
      src/core/lodash.js
  19. 4
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  20. 64
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js
  21. 1
      src/widget/multilayersingletree/multilayersingletree.combo.js
  22. 67
      src/widget/multilayersingletree/multilayersingletree.trigger.js

1
demo/js/component/demo.treevaluechoosercombo.js

@ -7,6 +7,7 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, {
var widget = BI.createWidget({
type: "bi.tree_value_chooser_combo",
width: 300,
allowSearchValue: true,
// items: BI.deepClone(Demo.CONSTANTS.TREEITEMS),
itemsCreator: function (op, callback) {
callback(BI.deepClone(Demo.CONSTANTS.TREEITEMS));

1
demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js

@ -16,6 +16,7 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.tree = _ref;
},
allowEdit: true,
text: "默认值",
items: items,
width: 300,

1
demo/js/widget/singletree/demo.multilayer_single_tree_combo.js

@ -16,6 +16,7 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.tree = _ref;
},
allowEdit: true,
text: "默认值",
items: items,
width: 300

146
dist/2.0/fineui.ie.js vendored

@ -22,7 +22,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10538,7 +10538,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
@ -68588,7 +68588,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -68668,6 +68669,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -69025,7 +69027,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -69079,9 +69081,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -69123,27 +69123,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -69689,6 +69721,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -70037,7 +70070,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -70045,7 +70079,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -70099,9 +70133,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -70143,27 +70175,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -87832,11 +87896,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

146
dist/2.0/fineui.js vendored

@ -22,7 +22,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10538,7 +10538,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
@ -68992,7 +68992,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -69072,6 +69073,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -69429,7 +69431,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -69483,9 +69485,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -69527,27 +69527,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -70093,6 +70125,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -70441,7 +70474,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -70449,7 +70483,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -70503,9 +70537,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -70547,27 +70579,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -88236,11 +88300,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

146
dist/bundle.ie.js vendored

@ -22,7 +22,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10538,7 +10538,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
@ -68588,7 +68588,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -68668,6 +68669,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -69025,7 +69027,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -69079,9 +69081,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -69123,27 +69123,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -69689,6 +69721,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -70037,7 +70070,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -70045,7 +70079,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -70099,9 +70133,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -70143,27 +70175,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -87832,11 +87896,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

146
dist/bundle.js vendored

@ -22,7 +22,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10538,7 +10538,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
@ -68992,7 +68992,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -69072,6 +69073,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -69429,7 +69431,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -69483,9 +69485,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -69527,27 +69527,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -70093,6 +70125,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -70441,7 +70474,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -70449,7 +70483,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -70503,9 +70537,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -70547,27 +70579,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -88236,11 +88300,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

4
dist/core.js vendored

@ -22,7 +22,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10538,7 +10538,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {

5
dist/demo.js vendored

@ -3308,8 +3308,9 @@ BI.shortcut("demo.center", Demo.Center);Demo.TreeValueChooser = BI.inherit(BI.Wi
render: function () {
var widget = BI.createWidget({
type: "bi.list_tree_value_chooser_insert_combo",
type: "bi.tree_value_chooser_combo",
width: 300,
allowSearchValue: true,
// items: BI.deepClone(Demo.CONSTANTS.TREEITEMS),
itemsCreator: function (op, callback) {
callback(BI.deepClone(Demo.CONSTANTS.TREEITEMS));
@ -10404,6 +10405,7 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.tree = _ref;
},
allowEdit: true,
text: "默认值",
items: items,
width: 300,
@ -10586,6 +10588,7 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.tree = _ref;
},
allowEdit: true,
text: "默认值",
items: items,
width: 300

146
dist/fineui.ie.js vendored

@ -267,7 +267,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10783,7 +10783,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
@ -68833,7 +68833,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -68913,6 +68914,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -69270,7 +69272,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -69324,9 +69326,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -69368,27 +69368,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -69934,6 +69966,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -70282,7 +70315,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -70290,7 +70324,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -70344,9 +70378,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -70388,27 +70420,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -88077,11 +88141,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

146
dist/fineui.js vendored

@ -267,7 +267,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10783,7 +10783,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
@ -69237,7 +69237,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -69317,6 +69318,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -69674,7 +69676,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -69728,9 +69730,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -69772,27 +69772,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -70338,6 +70370,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -70686,7 +70719,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -70694,7 +70728,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -70748,9 +70782,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -70792,27 +70824,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -88481,11 +88545,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

146
dist/fineui_without_jquery_polyfill.js vendored

@ -22,7 +22,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10538,7 +10538,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
@ -51539,7 +51539,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -51619,6 +51620,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -51976,7 +51978,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -52030,9 +52032,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -52074,27 +52074,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -52640,6 +52672,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -52988,7 +53021,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -52996,7 +53030,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -53050,9 +53084,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -53094,27 +53126,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -70783,11 +70847,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

4
dist/utils.js vendored

@ -22,7 +22,7 @@ if(_global.BI.prepares == null) {
}/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -11317,7 +11317,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {

142
dist/widget.js vendored

@ -6653,7 +6653,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -6733,6 +6734,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
@ -7090,7 +7092,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -7144,9 +7146,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -7188,27 +7188,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
}
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -7754,6 +7786,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
@ -8102,7 +8135,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -8110,7 +8144,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -8164,9 +8198,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -8208,27 +8240,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {
@ -25897,11 +25961,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

2
lodash.md

@ -1 +1 @@
lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"
lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"

6
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -694,11 +694,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
},
_isMatch: function (parentValues, value, keyword) {
var o = this.options;
var node = this._getTreeNode(parentValues, value);
if (!node) {
return false;
}
var find = BI.Func.getSearchResult([node.text || node.value], keyword);
if(o.allowSearchValue && node.value) {
var valueFind = BI.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;
},

2
src/core/base.js

@ -359,7 +359,7 @@ if (!_global.BI) {
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) {
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {

2
src/core/lodash.js

@ -1,7 +1,7 @@
/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy"`
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>

4
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -16,7 +16,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
attributes: {
tabIndex: 0
},
allowEdit: false
allowEdit: false,
allowSearchValue: false
});
},
@ -96,6 +97,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_select_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {

64
src/widget/multilayerselecttree/multilayerselecttree.trigger.js

@ -19,7 +19,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -73,9 +73,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -117,27 +115,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {

1
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -99,6 +99,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return {
el: {
type: "bi.multilayer_single_tree_trigger",
allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {

67
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -11,7 +11,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return v;
},
itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false
};
},
@ -19,7 +20,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options;
if(o.itemsCreator === BI.emptyFn) {
this.tree = new BI.Tree();
this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items))));
this.tree.initTree(BI.Tree.treeFormat(o.items));
}
var content = {
type: "bi.htape",
@ -73,9 +74,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(self._fillTreeStructure4Search(find.concat(matched)));
callback(self._getSearchItems(keyword));
} else {
callback();
}
@ -117,27 +116,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
};
},
_getSearchItems: function(keyword) {
var o = this.options;
var findingText = BI.Func.getSearchResult(o.items, keyword, "text");
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []};
var textItems = findingText.find.concat(findingText.match);
var valueItems = findingValue.find.concat(findingValue.match);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id"));
},
_createJson: function(node, open) {
return {
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
},
_getChildren: function(node) {
var self = this;
node.children = node.children || [];
var nodes = [];
BI.each(node.children, function (idx, child) {
var children = self._getChildren(child);
nodes = nodes.concat(children);
});
return node.children.concat(nodes);
},
// 将搜索到的节点进行补充,构造成一棵完整的树
_fillTreeStructure4Search: function (leaves) {
var result = BI.map(leaves, "id");
var queue = leaves.reverse() || [];
var self = this;
var result = [];
var queue = [];
BI.each(leaves, function (idx, node) {
queue.push({pId: node.pId});
result.push(node);
result = result.concat(self._getChildren(node));
});
while (BI.isNotEmptyArray(queue)) {
var node = queue.pop();
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id");
if (pNode != null) {
queue.push(pNode);
result.push(pNode.id);
pNode.open = true;
queue.push({pId: pNode.pId});
result.push(pNode);
}
}
var nodes = [];
BI.each(this.options.items, function (idx, item) {
if(BI.contains(result, item.id)) {
nodes.push(BI.extend({}, item, {
open: true
}))
}
});
return nodes;
return BI.uniqBy(BI.map(result, function (idx, node) {
return self._createJson(node, node.open);
}), "id");
},
_digest: function (v) {

Loading…
Cancel
Save