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. 14
      src/component/treevaluechooser/abstract.treevaluechooser.list.js
  3. 32
      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)
- 修复单值系滑块滑动松手后发两次EVENT_CHANGE的问题

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

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

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

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

Loading…
Cancel
Save