Browse Source

Merge pull request #1100 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit 'bfba131d03fa477f3857ce535cd3cb75fd94cead':
  no message
  REPORT-20971 feat: 可配置是否搜索实际值
  搜索后选值显示的是已选择
  REPORT-20334 fix: singletree和selecttree代码没有同步
es6
guy 5 years ago
parent
commit
878166eed6
  1. 162
      dist/2.0/fineui.ie.js
  2. 28
      dist/2.0/fineui.ie.min.js
  3. 162
      dist/2.0/fineui.js
  4. 2
      dist/2.0/fineui.min.css
  5. 28
      dist/2.0/fineui.min.js
  6. 162
      dist/bundle.ie.js
  7. 28
      dist/bundle.ie.min.js
  8. 162
      dist/bundle.js
  9. 2
      dist/bundle.min.css
  10. 28
      dist/bundle.min.js
  11. 4
      dist/core.js
  12. 162
      dist/fineui.ie.js
  13. 26
      dist/fineui.ie.min.js
  14. 162
      dist/fineui.js
  15. 2
      dist/fineui.min.css
  16. 26
      dist/fineui.min.js
  17. 162
      dist/fineui_without_jquery_polyfill.js
  18. 4
      dist/utils.js
  19. 2
      dist/utils.min.js
  20. 158
      dist/widget.js
  21. 2
      lodash.md
  22. 6
      src/component/treevaluechooser/abstract.treevaluechooser.js
  23. 2
      src/core/base.js
  24. 2
      src/core/lodash.js
  25. 4
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  26. 74
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js
  27. 1
      src/widget/multilayersingletree/multilayersingletree.combo.js
  28. 67
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  29. 2
      src/widget/multitree/multi.tree.combo.js
  30. 2
      src/widget/multitree/multi.tree.insert.combo.js
  31. 2
      src/widget/multitree/multi.tree.list.combo.js

162
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",
@ -69067,7 +69069,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +69123,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -69683,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) {
@ -70031,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
};
},
@ -70039,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",
@ -70093,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();
}
@ -70137,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) {
@ -75776,7 +75846,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -76079,7 +76149,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -76395,7 +76465,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -87826,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;
},

28
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

162
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",
@ -69471,7 +69473,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +69527,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -70087,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) {
@ -70435,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
};
},
@ -70443,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",
@ -70497,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();
}
@ -70541,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) {
@ -76180,7 +76250,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -76483,7 +76553,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -76799,7 +76869,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -88230,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;
},

2
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

28
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

162
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",
@ -69067,7 +69069,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +69123,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -69683,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) {
@ -70031,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
};
},
@ -70039,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",
@ -70093,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();
}
@ -70137,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) {
@ -75776,7 +75846,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -76079,7 +76149,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -76395,7 +76465,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -87826,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;
},

28
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

162
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",
@ -69471,7 +69473,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +69527,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -70087,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) {
@ -70435,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
};
},
@ -70443,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",
@ -70497,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();
}
@ -70541,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) {
@ -76180,7 +76250,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -76483,7 +76553,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -76799,7 +76869,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -88230,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;
},

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

28
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

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

162
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",
@ -69312,7 +69314,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +69368,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -69928,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) {
@ -70276,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
};
},
@ -70284,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",
@ -70338,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();
}
@ -70382,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) {
@ -76021,7 +76091,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -76324,7 +76394,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -76640,7 +76710,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -88071,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;
},

26
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

162
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",
@ -69716,7 +69718,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +69772,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -70332,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) {
@ -70680,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
};
},
@ -70688,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",
@ -70742,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();
}
@ -70786,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) {
@ -76425,7 +76495,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -76728,7 +76798,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -77044,7 +77114,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -88475,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;
},

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

26
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

162
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",
@ -52018,7 +52020,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +52074,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -52634,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) {
@ -52982,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
};
},
@ -52990,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",
@ -53044,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();
}
@ -53088,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) {
@ -58727,7 +58797,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -59030,7 +59100,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -59346,7 +59416,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -70777,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) {

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

158
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",
@ -7132,7 +7134,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +7188,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {
@ -7748,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) {
@ -8096,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
};
},
@ -8104,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",
@ -8158,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();
}
@ -8202,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) {
@ -13841,7 +13911,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});
@ -14144,7 +14214,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -14460,7 +14530,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});
@ -25891,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) {

74
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",
@ -61,7 +61,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
@ -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,32 +115,70 @@ 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) {
var o = this.options;
return o.valueFormatter(v) || o.text;
if(o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
return o.valueFormatter(v);
},
stopEditing: function () {

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

2
src/widget/multitree/multi.tree.combo.js

@ -189,7 +189,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM);
});

2
src/widget/multitree/multi.tree.insert.combo.js

@ -206,7 +206,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});

2
src/widget/multitree/multi.tree.list.combo.js

@ -214,7 +214,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
type: BI.Selection.Multi,
value: checked ? this.getValue() : {}
};
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue());
});

Loading…
Cancel
Save