@iris-ui-kit/vue 0.2.8 → 0.2.10
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 +30 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
package/dist/index.cjs
CHANGED
|
@@ -3183,6 +3183,10 @@ var IrisPopover = vue.defineComponent({
|
|
|
3183
3183
|
return () => slots.default?.();
|
|
3184
3184
|
}
|
|
3185
3185
|
});
|
|
3186
|
+
function resolveTriggerElement(value) {
|
|
3187
|
+
const candidate = value !== null && typeof value === "object" && "$el" in value ? value.$el : value;
|
|
3188
|
+
return typeof HTMLElement !== "undefined" && candidate instanceof HTMLElement ? candidate : null;
|
|
3189
|
+
}
|
|
3186
3190
|
var IrisPopoverTrigger = vue.defineComponent({
|
|
3187
3191
|
name: "IrisPopoverTrigger",
|
|
3188
3192
|
inheritAttrs: false,
|
|
@@ -3199,7 +3203,7 @@ var IrisPopoverTrigger = vue.defineComponent({
|
|
|
3199
3203
|
ctx.setOpen(!ctx.open.value);
|
|
3200
3204
|
};
|
|
3201
3205
|
const captureRef = (el) => {
|
|
3202
|
-
ctx.triggerRef.value = el
|
|
3206
|
+
ctx.triggerRef.value = resolveTriggerElement(el);
|
|
3203
3207
|
};
|
|
3204
3208
|
return () => {
|
|
3205
3209
|
const triggerProps = {
|
|
@@ -9463,10 +9467,29 @@ var IrisTable = vue.defineComponent({
|
|
|
9463
9467
|
walk(sortedRows.value);
|
|
9464
9468
|
return nodes;
|
|
9465
9469
|
});
|
|
9470
|
+
const compactTreeSelectionSeed = (keys) => {
|
|
9471
|
+
const selected = new Set(keys);
|
|
9472
|
+
const parentByKey = new Map(
|
|
9473
|
+
treeSelectionNodes.value.map((node) => [node.key, node.parentKey])
|
|
9474
|
+
);
|
|
9475
|
+
return keys.filter((key) => {
|
|
9476
|
+
const visited = /* @__PURE__ */ new Set();
|
|
9477
|
+
let parent = parentByKey.get(key);
|
|
9478
|
+
while (parent !== void 0 && !visited.has(parent)) {
|
|
9479
|
+
if (selected.has(parent)) return false;
|
|
9480
|
+
visited.add(parent);
|
|
9481
|
+
parent = parentByKey.get(parent);
|
|
9482
|
+
}
|
|
9483
|
+
return true;
|
|
9484
|
+
});
|
|
9485
|
+
};
|
|
9466
9486
|
const resolvedTreeSelection = vue.computed(
|
|
9467
9487
|
() => cascadingTreeSelection.value ? core.createTreeSelection({
|
|
9468
9488
|
nodes: treeSelectionNodes.value,
|
|
9469
|
-
|
|
9489
|
+
// Canonical payloads contain fully-selected branches and their
|
|
9490
|
+
// leaves. Seed only the highest selected ancestors so rebuilding a
|
|
9491
|
+
// large fully-selected tree does not cascade once per descendant.
|
|
9492
|
+
defaultChecked: compactTreeSelectionSeed(displaySelection.value)
|
|
9470
9493
|
}) : null
|
|
9471
9494
|
);
|
|
9472
9495
|
const isSelected = (id) => resolvedTreeSelection.value?.isChecked(id) ?? displaySelection.value.includes(id);
|
|
@@ -9485,8 +9508,11 @@ var IrisTable = vue.defineComponent({
|
|
|
9485
9508
|
if (props.selectable === "single") {
|
|
9486
9509
|
selectionModel.set(selectionModel.isSelected(id) ? [] : [id]);
|
|
9487
9510
|
} else if (props.selectable === "multi") {
|
|
9488
|
-
|
|
9489
|
-
|
|
9511
|
+
if (cascadingTreeSelection.value) {
|
|
9512
|
+
const treeSelection = core.createTreeSelection({
|
|
9513
|
+
nodes: treeSelectionNodes.value,
|
|
9514
|
+
defaultChecked: compactTreeSelectionSeed(displaySelection.value)
|
|
9515
|
+
});
|
|
9490
9516
|
treeSelection.toggle(id);
|
|
9491
9517
|
selectionModel.set(treeSelection.getChecked());
|
|
9492
9518
|
} else {
|