|
|
|
@ -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; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|