bkui-vue 0.0.1-beta.60 → 0.0.1-beta.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +23 -23
- package/dist/index.esm.js +112 -92
- package/dist/index.umd.js +23 -23
- package/lib/table/index.js +1 -1
- package/lib/tree/index.js +1 -1
- package/lib/tree/tree.d.ts +0 -2
- package/lib/tree/use-node-action.d.ts +1 -0
- package/lib/tree/util.d.ts +16 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -12563,12 +12563,12 @@ const tableProps = {
|
|
12563
12563
|
width: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]),
|
12564
12564
|
type: PropTypes.commonType(["selection", "index", "expand", "none"], "columnType").def("none"),
|
12565
12565
|
sort: PropTypes.oneOfType([PropTypes.shape({
|
12566
|
-
sortFn: PropTypes.func.def(
|
12566
|
+
sortFn: PropTypes.func.def(void 0),
|
12567
12567
|
sortScope: PropTypes.commonType(Object.values(SortScope)).def("current")
|
12568
12568
|
}), PropTypes.bool]).def(false),
|
12569
12569
|
filter: PropTypes.oneOfType([PropTypes.shape({
|
12570
12570
|
list: PropTypes.arrayOf(PropTypes.any).def([]),
|
12571
|
-
filterFn: PropTypes.func.def(
|
12571
|
+
filterFn: PropTypes.func.def(void 0)
|
12572
12572
|
}), PropTypes.bool]).def(false)
|
12573
12573
|
})),
|
12574
12574
|
activeColumn: PropTypes.oneOfType([PropTypes.number.def(-1), PropTypes.arrayOf(PropTypes.number.def(-1))]),
|
@@ -12582,7 +12582,7 @@ const tableProps = {
|
|
12582
12582
|
thead: PropTypes.shape({
|
12583
12583
|
height: PropTypes.number.def(40),
|
12584
12584
|
isShow: PropTypes.bool.def(true),
|
12585
|
-
cellFn: PropTypes.func.def(
|
12585
|
+
cellFn: PropTypes.func.def(void 0)
|
12586
12586
|
}),
|
12587
12587
|
virtualEnabled: PropTypes.bool.def(false),
|
12588
12588
|
border: PropTypes.arrayOf(PropTypes.commonType(BORDER_OPRIONS, "border")).def(["row"]),
|
@@ -12590,11 +12590,11 @@ const tableProps = {
|
|
12590
12590
|
remotePagination: PropTypes.bool.def(false),
|
12591
12591
|
emptyText: PropTypes.string.def("\u6682\u65E0\u6570\u636E"),
|
12592
12592
|
settings: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
12593
|
-
fields: PropTypes.shape([]).def(
|
12594
|
-
checked: PropTypes.shape([]).def(
|
12595
|
-
limit: PropTypes.number.def(
|
12593
|
+
fields: PropTypes.shape([]).def(void 0),
|
12594
|
+
checked: PropTypes.shape([]).def(void 0),
|
12595
|
+
limit: PropTypes.number.def(void 0),
|
12596
12596
|
size: PropTypes.size(["small", "default", "large"]).def("default"),
|
12597
|
-
sizeList: PropTypes.shape([]).def(
|
12597
|
+
sizeList: PropTypes.shape([]).def(void 0)
|
12598
12598
|
})]).def(false)
|
12599
12599
|
};
|
12600
12600
|
function _isSlot$2(s2) {
|
@@ -13236,10 +13236,10 @@ var Settings = defineComponent({
|
|
13236
13236
|
name: "Settings",
|
13237
13237
|
props: {
|
13238
13238
|
settings: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
13239
|
-
fields: PropTypes.shape([]).def(
|
13240
|
-
checked: PropTypes.shape([]).def(
|
13241
|
-
limit: PropTypes.number.def(
|
13242
|
-
size: PropTypes.string.def(
|
13239
|
+
fields: PropTypes.shape([]).def(void 0),
|
13240
|
+
checked: PropTypes.shape([]).def(void 0),
|
13241
|
+
limit: PropTypes.number.def(void 0),
|
13242
|
+
size: PropTypes.string.def(void 0)
|
13243
13243
|
})]).def(false),
|
13244
13244
|
columns: PropTypes.array.def([]),
|
13245
13245
|
rowHeight: PropTypes.number.def(40)
|
@@ -20239,7 +20239,7 @@ const Transfer = withInstall(Component$1);
|
|
20239
20239
|
const treeProps = {
|
20240
20240
|
data: PropTypes.arrayOf(PropTypes.any).def([]),
|
20241
20241
|
label: PropTypes.oneOfType([PropTypes.func.def(void 0), PropTypes.string.def("label")]),
|
20242
|
-
nodeKey: PropTypes.string.def(
|
20242
|
+
nodeKey: PropTypes.string.def(void 0),
|
20243
20243
|
children: PropTypes.string.def("children"),
|
20244
20244
|
indent: PropTypes.number.def(18),
|
20245
20245
|
lineHeight: PropTypes.number.def(32),
|
@@ -20255,50 +20255,12 @@ const treeProps = {
|
|
20255
20255
|
PropTypes.bool.def(false)
|
20256
20256
|
]).def(true),
|
20257
20257
|
async: PropTypes.shape({
|
20258
|
-
callback: PropTypes.func.def(
|
20258
|
+
callback: PropTypes.func.def(void 0),
|
20259
20259
|
cache: PropTypes.bool.def(true),
|
20260
20260
|
deepAutoOpen: PropTypes.commonType(["once", "every"], "columnType").def("once")
|
20261
20261
|
}),
|
20262
20262
|
offsetLeft: PropTypes.number.def(5)
|
20263
20263
|
};
|
20264
|
-
var useNodeAttribute = (flatData) => {
|
20265
|
-
const schemaValues = computed(() => Array.from(flatData.schema.values()));
|
20266
|
-
const getSchemaVal2 = (key) => flatData.schema.get(key);
|
20267
|
-
const getNodeAttr2 = (node, attr) => {
|
20268
|
-
var _a;
|
20269
|
-
return (_a = getSchemaVal2(node.__uuid)) == null ? void 0 : _a[attr];
|
20270
|
-
};
|
20271
|
-
const setNodeAttr = (node, attr, val) => flatData.schema.set(node.__uuid, __spreadProps(__spreadValues({}, getSchemaVal2(node.__uuid)), {
|
20272
|
-
[attr]: val
|
20273
|
-
}));
|
20274
|
-
const getNodePath = (node) => getNodeAttr2(node, "__path");
|
20275
|
-
const isRootNode = (node) => getNodeAttr2(node, "__isRoot");
|
20276
|
-
const isNodeOpened = (node) => getNodeAttr2(node, "__isOpen");
|
20277
|
-
const hasChildNode = (node) => getNodeAttr2(node, "__hasChild");
|
20278
|
-
const isItemOpen = (item) => {
|
20279
|
-
var _a;
|
20280
|
-
if (typeof item === "object") {
|
20281
|
-
return isNodeOpened(item);
|
20282
|
-
}
|
20283
|
-
if (typeof item === "string") {
|
20284
|
-
return (_a = getSchemaVal2(item)) == null ? void 0 : _a.__isOpen;
|
20285
|
-
}
|
20286
|
-
return false;
|
20287
|
-
};
|
20288
|
-
const checkNodeIsOpen = (node) => isRootNode(node) || isItemOpen(node) || isItemOpen(getNodeAttr2(node, "__parentId"));
|
20289
|
-
return {
|
20290
|
-
schemaValues,
|
20291
|
-
getSchemaVal: getSchemaVal2,
|
20292
|
-
getNodeAttr: getNodeAttr2,
|
20293
|
-
setNodeAttr,
|
20294
|
-
getNodePath,
|
20295
|
-
isRootNode,
|
20296
|
-
isNodeOpened,
|
20297
|
-
hasChildNode,
|
20298
|
-
isItemOpen,
|
20299
|
-
checkNodeIsOpen
|
20300
|
-
};
|
20301
|
-
};
|
20302
20264
|
var rngBrowser = { exports: {} };
|
20303
20265
|
var getRandomValues = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != "undefined" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto);
|
20304
20266
|
if (getRandomValues) {
|
@@ -20438,6 +20400,20 @@ uuid.v1 = v1;
|
|
20438
20400
|
uuid.v4 = v4;
|
20439
20401
|
var uuid_1 = uuid;
|
20440
20402
|
const DEFAULT_LEVLE_LINE = "1px dashed #c3cdd7";
|
20403
|
+
var NODE_ATTRIBUTES = /* @__PURE__ */ ((NODE_ATTRIBUTES2) => {
|
20404
|
+
NODE_ATTRIBUTES2["DEPTH"] = "__depth";
|
20405
|
+
NODE_ATTRIBUTES2["INDEX"] = "__index";
|
20406
|
+
NODE_ATTRIBUTES2["UUID"] = "__uuid";
|
20407
|
+
NODE_ATTRIBUTES2["PARENT_ID"] = "__parentId";
|
20408
|
+
NODE_ATTRIBUTES2["HAS_CHILD"] = "__hasChild";
|
20409
|
+
NODE_ATTRIBUTES2["PATH"] = "__path";
|
20410
|
+
NODE_ATTRIBUTES2["IS_ROOT"] = "__isRoot";
|
20411
|
+
NODE_ATTRIBUTES2["ORDER"] = "__order";
|
20412
|
+
NODE_ATTRIBUTES2["IS_OPEN"] = "__isOpen";
|
20413
|
+
NODE_ATTRIBUTES2["CHECKED"] = "__checked";
|
20414
|
+
NODE_ATTRIBUTES2["IS_ASYNC_INIT"] = "__isAsyncInit";
|
20415
|
+
return NODE_ATTRIBUTES2;
|
20416
|
+
})(NODE_ATTRIBUTES || {});
|
20441
20417
|
const getFlatdata = (props, treeData = void 0, cachedSchema = []) => {
|
20442
20418
|
const { data: data2, children } = props;
|
20443
20419
|
const outputData = [];
|
@@ -20448,10 +20424,10 @@ const getFlatdata = (props, treeData = void 0, cachedSchema = []) => {
|
|
20448
20424
|
if (typeof props.nodeKey === "string") {
|
20449
20425
|
uid = item[props.nodeKey];
|
20450
20426
|
}
|
20451
|
-
return uid || item
|
20427
|
+
return uid || item["__uuid"] || uuid_1.v4();
|
20452
20428
|
}
|
20453
20429
|
function getCachedTreeNodeAttr(uuid2, node, attr, cachedAttr) {
|
20454
|
-
const cached = (cachedSchema || []).find((item) => item
|
20430
|
+
const cached = (cachedSchema || []).find((item) => item["__uuid"] === uuid2);
|
20455
20431
|
if (cached) {
|
20456
20432
|
return cached[cachedAttr];
|
20457
20433
|
}
|
@@ -20475,19 +20451,19 @@ const getFlatdata = (props, treeData = void 0, cachedSchema = []) => {
|
|
20475
20451
|
const currentPath = path !== null ? `${path}-${i}` : `${i}`;
|
20476
20452
|
const hasChildren = !!(item[children] || []).length;
|
20477
20453
|
const attrs = {
|
20478
|
-
__depth: depth,
|
20479
|
-
__index: i,
|
20480
|
-
__uuid: uuid2,
|
20481
|
-
__parentId: parent,
|
20482
|
-
__hasChild: hasChildren,
|
20483
|
-
__path: currentPath,
|
20484
|
-
__isRoot: parent === null,
|
20485
|
-
__order: order2,
|
20486
|
-
__isOpen: isCachedTreeNodeOpened(uuid2, item),
|
20487
|
-
__checked: isCachedTreeNodeChecked(uuid2, item),
|
20454
|
+
["__depth"]: depth,
|
20455
|
+
["__index"]: i,
|
20456
|
+
["__uuid"]: uuid2,
|
20457
|
+
["__parentId"]: parent,
|
20458
|
+
["__hasChild"]: hasChildren,
|
20459
|
+
["__path"]: currentPath,
|
20460
|
+
["__isRoot"]: parent === null,
|
20461
|
+
["__order"]: order2,
|
20462
|
+
["__isOpen"]: isCachedTreeNodeOpened(uuid2, item),
|
20463
|
+
["__checked"]: isCachedTreeNodeChecked(uuid2, item),
|
20488
20464
|
[children]: null
|
20489
20465
|
};
|
20490
|
-
Object.assign(item, { __uuid: uuid2 });
|
20466
|
+
Object.assign(item, { ["__uuid"]: uuid2 });
|
20491
20467
|
schema.set(uuid2, attrs);
|
20492
20468
|
order2 += 1;
|
20493
20469
|
outputData.push(__spreadProps(__spreadValues({}, item), {
|
@@ -20548,7 +20524,7 @@ const getTreeStyle = (item, props) => {
|
|
20548
20524
|
};
|
20549
20525
|
const getNodeItemStyle = (item, props, flatData = {}) => {
|
20550
20526
|
const { schema } = flatData;
|
20551
|
-
const depth = getNodeAttr(schema, item
|
20527
|
+
const depth = getNodeAttr(schema, item["__uuid"], "__depth");
|
20552
20528
|
return __spreadValues({
|
20553
20529
|
"--depth": depth
|
20554
20530
|
}, typeof props.levelLine === "function" ? {
|
@@ -20558,7 +20534,7 @@ const getNodeItemStyle = (item, props, flatData = {}) => {
|
|
20558
20534
|
} : {});
|
20559
20535
|
};
|
20560
20536
|
const getNodeItemClass = (item, schema, props) => {
|
20561
|
-
const { __isRoot, __isOpen } = getSchemaVal(schema, item
|
20537
|
+
const { __isRoot, __isOpen } = getSchemaVal(schema, item["__uuid"]) || {};
|
20562
20538
|
return {
|
20563
20539
|
"is-root": __isRoot,
|
20564
20540
|
"bk-tree-node": true,
|
@@ -20568,7 +20544,7 @@ const getNodeItemClass = (item, schema, props) => {
|
|
20568
20544
|
};
|
20569
20545
|
};
|
20570
20546
|
const getNodeRowClass = (item, schema) => {
|
20571
|
-
const { __checked } = getSchemaVal(schema, item
|
20547
|
+
const { __checked } = getSchemaVal(schema, item["__uuid"]) || {};
|
20572
20548
|
return {
|
20573
20549
|
"is-checked": __checked,
|
20574
20550
|
[resolveClassName("node-row")]: true
|
@@ -20585,6 +20561,44 @@ const assignTreeNode = (path, treeData, childKey, assignVal) => {
|
|
20585
20561
|
}, treeData);
|
20586
20562
|
Object.assign(targetNode, assignVal || {});
|
20587
20563
|
};
|
20564
|
+
var useNodeAttribute = (flatData) => {
|
20565
|
+
const schemaValues = computed(() => Array.from(flatData.schema.values()));
|
20566
|
+
const getSchemaVal2 = (key) => flatData.schema.get(key);
|
20567
|
+
const getNodeAttr2 = (node, attr) => {
|
20568
|
+
var _a;
|
20569
|
+
return (_a = getSchemaVal2(node[NODE_ATTRIBUTES.UUID])) == null ? void 0 : _a[attr];
|
20570
|
+
};
|
20571
|
+
const setNodeAttr = (node, attr, val) => flatData.schema.set(node[NODE_ATTRIBUTES.UUID], __spreadProps(__spreadValues({}, getSchemaVal2(node[NODE_ATTRIBUTES.UUID])), {
|
20572
|
+
[attr]: val
|
20573
|
+
}));
|
20574
|
+
const getNodePath = (node) => getNodeAttr2(node, NODE_ATTRIBUTES.PATH);
|
20575
|
+
const isRootNode = (node) => getNodeAttr2(node, NODE_ATTRIBUTES.IS_ROOT);
|
20576
|
+
const isNodeOpened = (node) => getNodeAttr2(node, NODE_ATTRIBUTES.IS_OPEN);
|
20577
|
+
const hasChildNode = (node) => getNodeAttr2(node, NODE_ATTRIBUTES.HAS_CHILD);
|
20578
|
+
const isItemOpen = (item) => {
|
20579
|
+
var _a;
|
20580
|
+
if (typeof item === "object") {
|
20581
|
+
return isNodeOpened(item);
|
20582
|
+
}
|
20583
|
+
if (typeof item === "string") {
|
20584
|
+
return (_a = getSchemaVal2(item)) == null ? void 0 : _a[NODE_ATTRIBUTES.IS_OPEN];
|
20585
|
+
}
|
20586
|
+
return false;
|
20587
|
+
};
|
20588
|
+
const checkNodeIsOpen = (node) => isRootNode(node) || isItemOpen(node) || isItemOpen(getNodeAttr2(node, NODE_ATTRIBUTES.PARENT_ID));
|
20589
|
+
return {
|
20590
|
+
schemaValues,
|
20591
|
+
getSchemaVal: getSchemaVal2,
|
20592
|
+
getNodeAttr: getNodeAttr2,
|
20593
|
+
setNodeAttr,
|
20594
|
+
getNodePath,
|
20595
|
+
isRootNode,
|
20596
|
+
isNodeOpened,
|
20597
|
+
hasChildNode,
|
20598
|
+
isItemOpen,
|
20599
|
+
checkNodeIsOpen
|
20600
|
+
};
|
20601
|
+
};
|
20588
20602
|
var useAsync = (props, flatData) => {
|
20589
20603
|
const {
|
20590
20604
|
setNodeAttr,
|
@@ -20593,7 +20607,7 @@ var useAsync = (props, flatData) => {
|
|
20593
20607
|
} = useNodeAttribute(flatData);
|
20594
20608
|
const setNodeRemoteLoad = (resp, item) => {
|
20595
20609
|
if (typeof resp === "object" && resp !== null) {
|
20596
|
-
setNodeAttr(item,
|
20610
|
+
setNodeAttr(item, NODE_ATTRIBUTES.IS_OPEN, true);
|
20597
20611
|
const nodeValue = Array.isArray(resp) ? resp : [resp];
|
20598
20612
|
updateTreeNode(getNodePath(item), props.data, props.children, props.children, nodeValue);
|
20599
20613
|
}
|
@@ -20604,7 +20618,7 @@ var useAsync = (props, flatData) => {
|
|
20604
20618
|
callback = null,
|
20605
20619
|
cache = true
|
20606
20620
|
} = props.async || {};
|
20607
|
-
setNodeAttr(item,
|
20621
|
+
setNodeAttr(item, NODE_ATTRIBUTES.IS_ASYNC_INIT, true);
|
20608
20622
|
if (typeof callback === "function") {
|
20609
20623
|
if (!item.cached) {
|
20610
20624
|
Object.assign(item, {
|
@@ -20624,7 +20638,7 @@ var useAsync = (props, flatData) => {
|
|
20624
20638
|
}
|
20625
20639
|
};
|
20626
20640
|
const deepAutoOpen = () => {
|
20627
|
-
const autoOpenNodes = flatData.data.filter((item) => item.async && item.isOpen && !getNodeAttr2(item,
|
20641
|
+
const autoOpenNodes = flatData.data.filter((item) => item.async && item.isOpen && !getNodeAttr2(item, NODE_ATTRIBUTES.IS_ASYNC_INIT));
|
20628
20642
|
if (autoOpenNodes.length) {
|
20629
20643
|
Promise.all(autoOpenNodes.map((item) => asyncNodeClick(item))).then(() => {
|
20630
20644
|
deepAutoOpen();
|
@@ -20712,13 +20726,13 @@ var useNodeAction = (props, ctx, flatData, renderData) => {
|
|
20712
20726
|
return null;
|
20713
20727
|
};
|
20714
20728
|
const getLoadingIcon = (item) => item.loading ? createVNode(spinner, null, null) : "";
|
20715
|
-
const setNodeOpened = (item) => {
|
20716
|
-
const newVal = !isItemOpen(item);
|
20717
|
-
setNodeAttr(item,
|
20729
|
+
const setNodeOpened = (item, isOpen = null) => {
|
20730
|
+
const newVal = isOpen === null ? !isItemOpen(item) : !!isOpen;
|
20731
|
+
setNodeAttr(item, NODE_ATTRIBUTES.IS_OPEN, newVal);
|
20718
20732
|
if (newVal) {
|
20719
20733
|
return;
|
20720
20734
|
}
|
20721
|
-
renderData.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).forEach((filterNode) => setNodeAttr(filterNode,
|
20735
|
+
renderData.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).forEach((filterNode) => setNodeAttr(filterNode, NODE_ATTRIBUTES.IS_OPEN, newVal));
|
20722
20736
|
};
|
20723
20737
|
const hanldeTreeNodeClick = (item) => {
|
20724
20738
|
asyncNodeClick(item);
|
@@ -20733,17 +20747,17 @@ var useNodeAction = (props, ctx, flatData, renderData) => {
|
|
20733
20747
|
hanldeTreeNodeClick(node);
|
20734
20748
|
};
|
20735
20749
|
const handleNodeContentClick = (item) => {
|
20736
|
-
if (!checkedNodes.includes(item.
|
20750
|
+
if (!checkedNodes.includes(item[NODE_ATTRIBUTES.UUID])) {
|
20737
20751
|
checkedNodes.forEach((__uuid) => setNodeAttr({
|
20738
20752
|
__uuid
|
20739
|
-
},
|
20753
|
+
}, NODE_ATTRIBUTES.CHECKED, false));
|
20740
20754
|
checkedNodes.length = 0;
|
20741
|
-
setNodeAttr(item,
|
20742
|
-
checkedNodes.push(item.
|
20755
|
+
setNodeAttr(item, NODE_ATTRIBUTES.CHECKED, true);
|
20756
|
+
checkedNodes.push(item[NODE_ATTRIBUTES.UUID]);
|
20743
20757
|
if (!isNodeOpened(item)) {
|
20744
20758
|
hanldeTreeNodeClick(item);
|
20745
20759
|
}
|
20746
|
-
ctx.emit("check", item, getSchemaVal2(item.
|
20760
|
+
ctx.emit("check", item, getSchemaVal2(item[NODE_ATTRIBUTES.UUID]));
|
20747
20761
|
}
|
20748
20762
|
};
|
20749
20763
|
const filterNextNode = (depth, node) => {
|
@@ -20760,7 +20774,7 @@ var useNodeAction = (props, ctx, flatData, renderData) => {
|
|
20760
20774
|
const nextLevel = parseInt(lastLevel, 10);
|
20761
20775
|
paths.push(`${nextLevel + 1}`);
|
20762
20776
|
const nextNodePath = paths.join("-");
|
20763
|
-
return schemaValues.value.some((val) => val.
|
20777
|
+
return schemaValues.value.some((val) => val[NODE_ATTRIBUTES.PATH] === nextNodePath);
|
20764
20778
|
};
|
20765
20779
|
const getVirtualLines = (node) => {
|
20766
20780
|
if (!props.levelLine) {
|
@@ -20769,7 +20783,7 @@ var useNodeAction = (props, ctx, flatData, renderData) => {
|
|
20769
20783
|
const getNodeLineStyle = (dpth) => ({
|
20770
20784
|
"--depth": dpth
|
20771
20785
|
});
|
20772
|
-
const maxDeep = getNodeAttr2(node,
|
20786
|
+
const maxDeep = getNodeAttr2(node, NODE_ATTRIBUTES.DEPTH) + 1;
|
20773
20787
|
return new Array(maxDeep).fill("").map((_2, index) => index).filter((depth) => filterNextNode(depth, node)).filter((depth) => depth > 0).map((index) => createVNode("span", {
|
20774
20788
|
"class": "node-virtual-line",
|
20775
20789
|
"style": getNodeLineStyle(maxDeep - index)
|
@@ -20795,7 +20809,8 @@ var useNodeAction = (props, ctx, flatData, renderData) => {
|
|
20795
20809
|
return {
|
20796
20810
|
renderTreeNode,
|
20797
20811
|
hanldeTreeNodeClick,
|
20798
|
-
deepAutoOpen
|
20812
|
+
deepAutoOpen,
|
20813
|
+
setNodeOpened
|
20799
20814
|
};
|
20800
20815
|
};
|
20801
20816
|
var Component = defineComponent({
|
@@ -20821,7 +20836,8 @@ var Component = defineComponent({
|
|
20821
20836
|
const {
|
20822
20837
|
renderTreeNode,
|
20823
20838
|
hanldeTreeNodeClick,
|
20824
|
-
deepAutoOpen
|
20839
|
+
deepAutoOpen,
|
20840
|
+
setNodeOpened
|
20825
20841
|
} = useNodeAction(props, ctx, flatData, renderData);
|
20826
20842
|
if ((_a = props.async) == null ? void 0 : _a.callback) {
|
20827
20843
|
deepAutoOpen();
|
@@ -20840,10 +20856,10 @@ var Component = defineComponent({
|
|
20840
20856
|
const resolveNodeItem = (node) => {
|
20841
20857
|
if (typeof node === "string") {
|
20842
20858
|
return {
|
20843
|
-
|
20859
|
+
[NODE_ATTRIBUTES.UUID]: node
|
20844
20860
|
};
|
20845
20861
|
}
|
20846
|
-
if (Object.prototype.hasOwnProperty.call(node,
|
20862
|
+
if (Object.prototype.hasOwnProperty.call(node, NODE_ATTRIBUTES.UUID)) {
|
20847
20863
|
return node;
|
20848
20864
|
}
|
20849
20865
|
console.error("setNodeAction Error: cannot find uid for the ndoe item");
|
@@ -20858,18 +20874,22 @@ var Component = defineComponent({
|
|
20858
20874
|
};
|
20859
20875
|
const setOpen = (item, isOpen = true, autoOpenParents = false) => {
|
20860
20876
|
const resolvedItem = resolveNodeItem(item);
|
20861
|
-
if (autoOpenParents
|
20862
|
-
|
20863
|
-
|
20864
|
-
|
20865
|
-
|
20877
|
+
if (autoOpenParents) {
|
20878
|
+
if (isOpen) {
|
20879
|
+
setNodeAction(resolvedItem, NODE_ATTRIBUTES.IS_OPEN, isOpen);
|
20880
|
+
if (!isRootNode(resolvedItem)) {
|
20881
|
+
const parentId = getNodeAttr2(resolvedItem, NODE_ATTRIBUTES.PARENT_ID);
|
20882
|
+
setOpen(parentId, true, true);
|
20883
|
+
}
|
20884
|
+
} else {
|
20885
|
+
setNodeOpened(resolvedItem, false);
|
20866
20886
|
}
|
20867
20887
|
} else {
|
20868
|
-
setNodeAction(resolvedItem,
|
20888
|
+
setNodeAction(resolvedItem, NODE_ATTRIBUTES.IS_OPEN, isOpen);
|
20869
20889
|
}
|
20870
20890
|
};
|
20871
20891
|
const setChecked = (item, checked = true) => {
|
20872
|
-
setNodeAction(resolveNodeItem(item),
|
20892
|
+
setNodeAction(resolveNodeItem(item), NODE_ATTRIBUTES.CHECKED, checked);
|
20873
20893
|
};
|
20874
20894
|
ctx.expose({
|
20875
20895
|
hanldeTreeNodeClick,
|