Browse Source

REPORT-97526 feat:给带搜索的多选多层级树增加searcherPaneAutoShrink,searcherPaneIsSelectedAny字段

research/test
parent
commit
42eea2a91a
  1. 13
      packages/fineui/src/case/ztree/parttree.js
  2. 2
      packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js
  3. 9
      packages/fineui/src/component/treevaluechooser/pane.treevaluechooser.js
  4. 2
      packages/fineui/src/widget/multiselecttree/multiselecttree.js
  5. 6
      packages/fineui/src/widget/multitree/trigger/multi.tree.search.pane.js

13
packages/fineui/src/case/ztree/parttree.js

@ -16,6 +16,12 @@ export class PartTree extends AsyncTree {
static EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
isSelectedAny: true, //是否返回所有被checked的结点(包括被checked的结点的子结点)
});
}
constructor(...args) {
super(...args);
this.seMethos = super._selectTreeNode;
@ -55,8 +61,11 @@ export class PartTree extends AsyncTree {
const name = this._getNodeValue(treeNode);
this.fireEvent(PartTree.EVENT_CLICK_TREE_NODE);
if (treeNode.checked === true) {
this.options.paras.selectedValues = this._getUnionValue();
// this._buildTree(self.options.paras.selectedValues, concat(parentValues, name));
if (this.options.isSelectedAny) {
this.options.paras.selectedValues = this._getUnionValue(); //获取所有被selected的结点
} else {
this._addTreeNode(this.options.paras.selectedValues, parentValues, name, {});//给selectedValues增加被click的结点(不包含该节点的子结点)
}
o.itemsCreator(
extend({}, o.paras, {
type: TreeView.REQ_TYPE_ADJUST_DATA,

2
packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js

@ -389,7 +389,7 @@ export class AbstractTreeValueChooser extends Widget {
each(selected, (k, v) => {
const p = clone(parents);
p.push(k);
if (!dealWithSelectedValues(selected[k], p)) {
if (!dealWithSelectedValues(selected[k], p) || op.searcherPaneAutoShrink === false) {
each(selected[k], (nk, nv) => {
const t = clone(p);
t.push(nk);

9
packages/fineui/src/component/treevaluechooser/pane.treevaluechooser.js

@ -15,6 +15,9 @@ export class TreeValueChooserPane extends AbstractTreeValueChooser {
items: null,
itemsCreator: emptyFn,
showLine: true,
//searcherPaneAutoShrink和searcherPaneIsSelectedAny同时为false时,返回值和非搜索状态下的树逻辑一致
searcherPaneAutoShrink: true,//其搜索树是否会判别子结点全选则取父结点的值
searcherPaneIsSelectedAny: true, //其搜索树是否返回所有被checked的结点(包括被checked的结点的子结点)
});
}
@ -25,7 +28,11 @@ export class TreeValueChooserPane extends AbstractTreeValueChooser {
type: o.hideSearch ? MultiSelectTreePopup.xtype : MultiSelectTree.xtype,
element: this,
showLine: o.showLine,
itemsCreator: bind(this._itemsCreator, this),
searcherPaneIsSelectedAny: o.hideSearch || o.searcherPaneIsSelectedAny,
itemsCreator: (options, callback) => {
options.searcherPaneAutoShrink = o.hideSearch || o.searcherPaneAutoShrink;
this._itemsCreator.call(this, options, callback);
},
});
this.pane.on(MultiSelectTree.EVENT_CHANGE, () => {

2
packages/fineui/src/widget/multiselecttree/multiselecttree.js

@ -16,6 +16,7 @@ export class MultiSelectTree extends Single {
baseCls: "bi-multi-select-tree",
itemsCreator: emptyFn,
simple: false,
searcherPaneIsSelectedAny: true,
});
}
@ -44,6 +45,7 @@ export class MultiSelectTree extends Single {
this.searcherPane = createWidget({
type: MultiTreeSearchPane.xtype,
cls: "bi-border-left bi-border-right bi-border-bottom",
isSelectedAny: o.searcherPaneIsSelectedAny,
keywordGetter() {
return self.searcher.getKeyword();
},

6
packages/fineui/src/widget/multitree/trigger/multi.tree.search.pane.js

@ -6,7 +6,10 @@ import { TreeView, PartTree } from "@/case";
export class MultiTreeSearchPane extends Pane {
static xtype = "bi.multi_tree_search_pane";
props = { baseCls: "bi-multi-tree-search-pane bi-card" };
props = {
baseCls: "bi-multi-tree-search-pane bi-card",
isSelectedAny: true,
};
static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
@ -22,6 +25,7 @@ export class MultiTreeSearchPane extends Pane {
type: PartTree.xtype,
element: this,
tipText: i18nText("BI-No_Select"),
isSelectedAny: opts.isSelectedAny,
itemsCreator(op, callback) {
op.keyword = opts.keywordGetter();
opts.itemsCreator(op, callback);

Loading…
Cancel
Save