@iris-ui-kit/vue 0.2.8 → 0.2.9
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 +25 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -9463,10 +9463,29 @@ var IrisTable = vue.defineComponent({
|
|
|
9463
9463
|
walk(sortedRows.value);
|
|
9464
9464
|
return nodes;
|
|
9465
9465
|
});
|
|
9466
|
+
const compactTreeSelectionSeed = (keys) => {
|
|
9467
|
+
const selected = new Set(keys);
|
|
9468
|
+
const parentByKey = new Map(
|
|
9469
|
+
treeSelectionNodes.value.map((node) => [node.key, node.parentKey])
|
|
9470
|
+
);
|
|
9471
|
+
return keys.filter((key) => {
|
|
9472
|
+
const visited = /* @__PURE__ */ new Set();
|
|
9473
|
+
let parent = parentByKey.get(key);
|
|
9474
|
+
while (parent !== void 0 && !visited.has(parent)) {
|
|
9475
|
+
if (selected.has(parent)) return false;
|
|
9476
|
+
visited.add(parent);
|
|
9477
|
+
parent = parentByKey.get(parent);
|
|
9478
|
+
}
|
|
9479
|
+
return true;
|
|
9480
|
+
});
|
|
9481
|
+
};
|
|
9466
9482
|
const resolvedTreeSelection = vue.computed(
|
|
9467
9483
|
() => cascadingTreeSelection.value ? core.createTreeSelection({
|
|
9468
9484
|
nodes: treeSelectionNodes.value,
|
|
9469
|
-
|
|
9485
|
+
// Canonical payloads contain fully-selected branches and their
|
|
9486
|
+
// leaves. Seed only the highest selected ancestors so rebuilding a
|
|
9487
|
+
// large fully-selected tree does not cascade once per descendant.
|
|
9488
|
+
defaultChecked: compactTreeSelectionSeed(displaySelection.value)
|
|
9470
9489
|
}) : null
|
|
9471
9490
|
);
|
|
9472
9491
|
const isSelected = (id) => resolvedTreeSelection.value?.isChecked(id) ?? displaySelection.value.includes(id);
|
|
@@ -9485,8 +9504,11 @@ var IrisTable = vue.defineComponent({
|
|
|
9485
9504
|
if (props.selectable === "single") {
|
|
9486
9505
|
selectionModel.set(selectionModel.isSelected(id) ? [] : [id]);
|
|
9487
9506
|
} else if (props.selectable === "multi") {
|
|
9488
|
-
|
|
9489
|
-
|
|
9507
|
+
if (cascadingTreeSelection.value) {
|
|
9508
|
+
const treeSelection = core.createTreeSelection({
|
|
9509
|
+
nodes: treeSelectionNodes.value,
|
|
9510
|
+
defaultChecked: compactTreeSelectionSeed(displaySelection.value)
|
|
9511
|
+
});
|
|
9490
9512
|
treeSelection.toggle(id);
|
|
9491
9513
|
selectionModel.set(treeSelection.getChecked());
|
|
9492
9514
|
} else {
|