Browse Source

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

* commit '399d2c7a12b017053188109109a035ca85455020':
  REPORT-24695 fix: 不影响父子节点勾选状态的树在搜索选中时的处理 && 类改成生命周期形式
  REPORT-24695 fix: el可配属性
master
windy 5 years ago
parent
commit
9d9c1b5723
  1. 3
      changelog.md
  2. 16
      src/component/treevaluechooser/abstract.treevaluechooser.list.js
  3. 42
      src/widget/multitree/trigger/multi.tree.search.pane.js

3
changelog.md

@ -1,4 +1,7 @@
# 更新日志 # 更新日志
2.0(2020-2)
- 修复勾选节点不影响父子节点勾选状态的树搜索选中getValue不正常的问题
2.0(2020-1) 2.0(2020-1)
- 修复单值系滑块滑动松手后发两次EVENT_CHANGE的问题 - 修复单值系滑块滑动松手后发两次EVENT_CHANGE的问题

16
src/component/treevaluechooser/abstract.treevaluechooser.list.js

@ -107,7 +107,7 @@ BI.AbstractListTreeValueChooser = BI.inherit(BI.AbstractTreeValueChooser, {
function nodeSearch(deep, parentValues, current, result) { function nodeSearch(deep, parentValues, current, result) {
if (self._isMatch(parentValues, current, keyword)) { if (self._isMatch(parentValues, current, keyword)) {
var checked = isSelected(current); var checked = isSelected(parentValues, current);
createOneJson(parentValues, current, false, checked, true, result); createOneJson(parentValues, current, false, checked, true, result);
return [true, checked]; return [true, checked];
} }
@ -127,7 +127,7 @@ BI.AbstractListTreeValueChooser = BI.inherit(BI.AbstractTreeValueChooser, {
} }
}); });
if (can === true) { if (can === true) {
checked = isSelected(current); checked = isSelected(parentValues, current);
createOneJson(parentValues, current, true, checked, false, result); createOneJson(parentValues, current, true, checked, false, result);
} }
return [can, checked]; return [can, checked];
@ -177,9 +177,9 @@ BI.AbstractListTreeValueChooser = BI.inherit(BI.AbstractTreeValueChooser, {
}); });
} }
function isSelected(value) { function isSelected(parentValues, value) {
return BI.any(selectedValues, function (idx, array) { return BI.any(selectedValues, function (idx, array) {
return BI.last(array) === value; return BI.isEqual(parentValues, array.slice(0, parentValues.length)) && BI.last(array) === value;
}); });
} }
@ -205,7 +205,7 @@ BI.AbstractListTreeValueChooser = BI.inherit(BI.AbstractTreeValueChooser, {
var times = op.times; var times = op.times;
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues || []; var selectedValues = op.selectedValues || [];
var valueMap = dealWithSelectedValue(selectedValues); var valueMap = dealWithSelectedValue(parentValues, selectedValues);
var nodes = this._getChildren(parentValues); var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var checked = BI.has(valueMap, nodes[i].value); var checked = BI.has(valueMap, nodes[i].value);
@ -254,10 +254,12 @@ BI.AbstractListTreeValueChooser = BI.inherit(BI.AbstractTreeValueChooser, {
}); });
}); });
function dealWithSelectedValue(selectedValues) { function dealWithSelectedValue(parentValues, selectedValues) {
var valueMap = {}; var valueMap = {};
BI.each(selectedValues, function (idx, v) { BI.each(selectedValues, function (idx, v) {
valueMap[BI.last(v)] = [2, 0]; if (BI.isEqual(parentValues, v.slice(0, parentValues.length))) {
valueMap[BI.last(v)] = [2, 0];
}
}); });
return valueMap; return valueMap;
} }

42
src/widget/multitree/trigger/multi.tree.search.pane.js

@ -7,20 +7,16 @@
BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
_defaultConfig: function () { props: {
return BI.extend(BI.MultiTreeSearchPane.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multi-tree-search-pane bi-card",
baseCls: "bi-multi-tree-search-pane bi-card", itemsCreator: BI.emptyFn,
itemsCreator: BI.emptyFn, keywordGetter: BI.emptyFn
keywordGetter: BI.emptyFn
});
}, },
_init: function () { render: function () {
BI.MultiTreeSearchPane.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
this.partTree = BI.createWidget({ return BI.extend({
type: "bi.part_tree", type: "bi.part_tree",
element: this, element: this,
tipText: BI.i18nText("BI-No_Select"), tipText: BI.i18nText("BI-No_Select"),
@ -28,16 +24,22 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
op.keyword = opts.keywordGetter(); op.keyword = opts.keywordGetter();
opts.itemsCreator(op, callback); opts.itemsCreator(op, callback);
}, },
value: opts.value value: opts.value,
}); listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
this.partTree.on(BI.Controller.EVENT_CHANGE, function () { action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); }
}, {
this.partTree.on(BI.TreeView.EVENT_CHANGE, function () { eventName: BI.TreeView.EVENT_CHANGE,
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE); action: function () {
}); self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE);
}
}],
ref: function (_ref) {
self.partTree = _ref;
}
}, opts.el);
}, },
hasChecked: function () { hasChecked: function () {

Loading…
Cancel
Save