@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.js CHANGED
@@ -134,6 +134,10 @@ var IrisPopover = defineComponent({
134
134
  return () => slots.default?.();
135
135
  }
136
136
  });
137
+ function resolveTriggerElement(value) {
138
+ const candidate = value !== null && typeof value === "object" && "$el" in value ? value.$el : value;
139
+ return typeof HTMLElement !== "undefined" && candidate instanceof HTMLElement ? candidate : null;
140
+ }
137
141
  var IrisPopoverTrigger = defineComponent({
138
142
  name: "IrisPopoverTrigger",
139
143
  inheritAttrs: false,
@@ -150,7 +154,7 @@ var IrisPopoverTrigger = defineComponent({
150
154
  ctx.setOpen(!ctx.open.value);
151
155
  };
152
156
  const captureRef = (el) => {
153
- ctx.triggerRef.value = el ?? null;
157
+ ctx.triggerRef.value = resolveTriggerElement(el);
154
158
  };
155
159
  return () => {
156
160
  const triggerProps = {
@@ -5538,10 +5542,29 @@ var IrisTable = defineComponent({
5538
5542
  walk(sortedRows.value);
5539
5543
  return nodes;
5540
5544
  });
5545
+ const compactTreeSelectionSeed = (keys) => {
5546
+ const selected = new Set(keys);
5547
+ const parentByKey = new Map(
5548
+ treeSelectionNodes.value.map((node) => [node.key, node.parentKey])
5549
+ );
5550
+ return keys.filter((key) => {
5551
+ const visited = /* @__PURE__ */ new Set();
5552
+ let parent = parentByKey.get(key);
5553
+ while (parent !== void 0 && !visited.has(parent)) {
5554
+ if (selected.has(parent)) return false;
5555
+ visited.add(parent);
5556
+ parent = parentByKey.get(parent);
5557
+ }
5558
+ return true;
5559
+ });
5560
+ };
5541
5561
  const resolvedTreeSelection = computed(
5542
5562
  () => cascadingTreeSelection.value ? createTreeSelection({
5543
5563
  nodes: treeSelectionNodes.value,
5544
- defaultChecked: displaySelection.value
5564
+ // Canonical payloads contain fully-selected branches and their
5565
+ // leaves. Seed only the highest selected ancestors so rebuilding a
5566
+ // large fully-selected tree does not cascade once per descendant.
5567
+ defaultChecked: compactTreeSelectionSeed(displaySelection.value)
5545
5568
  }) : null
5546
5569
  );
5547
5570
  const isSelected = (id) => resolvedTreeSelection.value?.isChecked(id) ?? displaySelection.value.includes(id);
@@ -5560,8 +5583,11 @@ var IrisTable = defineComponent({
5560
5583
  if (props.selectable === "single") {
5561
5584
  selectionModel.set(selectionModel.isSelected(id) ? [] : [id]);
5562
5585
  } else if (props.selectable === "multi") {
5563
- const treeSelection = resolvedTreeSelection.value;
5564
- if (treeSelection) {
5586
+ if (cascadingTreeSelection.value) {
5587
+ const treeSelection = createTreeSelection({
5588
+ nodes: treeSelectionNodes.value,
5589
+ defaultChecked: compactTreeSelectionSeed(displaySelection.value)
5590
+ });
5565
5591
  treeSelection.toggle(id);
5566
5592
  selectionModel.set(treeSelection.getChecked());
5567
5593
  } else {