@turquoisehealth/pit-viper 2.182.1-dev.2 → 2.182.1-dev.3

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.
@@ -2568,26 +2568,26 @@ var _a = Symbol("SelectedItemsKey"), va = Symbol("EnableCascadeSelectionKey"), y
2568
2568
  }),
2569
2569
  emits: /* @__PURE__ */ g(["handle-selected", "see-more"], ["update:selectedIds"]),
2570
2570
  setup(e, { emit: n }) {
2571
- let i = e, s = m(_a, void 0), c = I(e, "selectedIds"), l = m(Ca, O(!1)), d = m(Sa, O(!1)), f = m(ba, void 0), p = m(xa, void 0), h = O(i.defaultExpanded ?? !1), g = O(!1), v = O(i.children ?? []), b = O(/* @__PURE__ */ new Set());
2571
+ let i = e, s = m(_a, void 0), c = I(e, "selectedIds"), l = m(Ca, O(!1)), d = m(Sa, O(!1)), f = m(ba, void 0), p = m(xa, void 0), h = O(i.defaultExpanded ?? !1), g = O(!1), v = O(!1), b = O(i.children ?? []), S = O(/* @__PURE__ */ new Set());
2572
2572
  V(() => i.children, (e) => {
2573
2573
  if (!e) {
2574
- v.value = [];
2574
+ b.value = [];
2575
2575
  return;
2576
2576
  }
2577
- let t = v.value.filter((e) => b.value.has(e.id)), n = new Set(e.map((e) => e.id)), r = t.filter((e) => !n.has(e.id));
2578
- v.value = [...e, ...r];
2577
+ let t = b.value.filter((e) => S.value.has(e.id)), n = new Set(e.map((e) => e.id)), r = t.filter((e) => !n.has(e.id));
2578
+ b.value = [...e, ...r], v.value = !1;
2579
2579
  });
2580
- let S = () => {
2580
+ let C = () => {
2581
2581
  h.value = !h.value;
2582
- }, C = r(() => ({ paddingLeft: `${i.level * 12 + 12}px` })), w = r(() => {
2582
+ }, w = r(() => ({ paddingLeft: `${i.level * 12 + 12}px` })), T = r(() => {
2583
2583
  let { level: e, config: t, itemClass: n, ...r } = i;
2584
2584
  return r;
2585
- }), T = r(() => v.value.length > 0 && i.level < Aa), D = r(() => T.value ? l.value ? h.value : !0 : !1), A = r(() => h.value ? "chevron-down" : "chevron-right"), M = (e) => s && Array.isArray(s.value) ? s.value.some((t) => t.id === e.id) : c.value.includes(e.id), ee = n, N = r(() => i.totalChildCount == null ? !1 : i.totalChildCount > v.value.length), P = async () => {
2585
+ }), D = r(() => (b.value.length > 0 || (i.totalChildCount ?? 0) > 0) && i.level < Aa), A = r(() => D.value ? l.value ? h.value : !0 : !1), M = r(() => h.value ? "chevron-down" : "chevron-right"), ee = (e) => s && Array.isArray(s.value) ? s.value.some((t) => t.id === e.id) : c.value.includes(e.id), N = n, P = r(() => v.value || i.totalChildCount == null ? !1 : i.totalChildCount > b.value.length), te = async () => {
2586
2586
  if (g.value) return;
2587
2587
  if (!i.handleSeeMore) {
2588
- ee("see-more", {
2588
+ N("see-more", {
2589
2589
  parentId: i.id,
2590
- offset: v.value.length
2590
+ offset: b.value.length
2591
2591
  });
2592
2592
  return;
2593
2593
  }
@@ -2596,50 +2596,53 @@ var _a = Symbol("SelectedItemsKey"), va = Symbol("EnableCascadeSelectionKey"), y
2596
2596
  try {
2597
2597
  let t = await i.handleSeeMore({
2598
2598
  parentId: i.id,
2599
- offset: v.value.length
2599
+ offset: b.value.length
2600
2600
  });
2601
2601
  if (Array.isArray(t) && t.length > 0) {
2602
- let n = new Set(v.value.map((e) => e.id)), r = t.filter((e) => !n.has(e.id));
2603
- if (r.length === 0) return;
2604
- let a = new Set(b.value);
2602
+ let n = new Set(b.value.map((e) => e.id)), r = t.filter((e) => !n.has(e.id));
2603
+ if (r.length === 0) {
2604
+ v.value = !0;
2605
+ return;
2606
+ }
2607
+ let a = new Set(S.value);
2605
2608
  for (let e of r) a.add(e.id);
2606
- if (b.value = a, v.value = [...v.value, ...r], e && s?.value) {
2609
+ if (S.value = a, b.value = [...b.value, ...r], e && s?.value) {
2607
2610
  let e = p?.value?.get(i.id), t = e ? r.filter((t) => !e.has(t.id)) : r;
2608
2611
  if (t.length > 0) {
2609
2612
  let e = new Set(s.value.map((e) => e.id)), n = t.filter((t) => !e.has(t.id));
2610
2613
  n.length > 0 && (s.value = [...s.value, ...n]);
2611
2614
  }
2612
2615
  }
2613
- }
2616
+ } else Array.isArray(t) && (v.value = !0);
2614
2617
  } finally {
2615
2618
  g.value = !1;
2616
2619
  }
2617
- }, te = (e) => {
2618
- if (l.value && T.value && e.option.id === i.id && !d.value) {
2619
- S();
2620
+ }, L = (e) => {
2621
+ if (l.value && D.value && e.option.id === i.id && !d.value) {
2622
+ C();
2620
2623
  return;
2621
2624
  }
2622
2625
  if (!s) {
2623
2626
  let t = c.value.indexOf(e.option.id);
2624
2627
  t > -1 ? c.value = [...c.value.slice(0, t), ...c.value.slice(t + 1)] : c.value = [...c.value, e.option.id];
2625
2628
  }
2626
- ee("handle-selected", e);
2627
- }, L = (e) => {
2628
- ee("handle-selected", e);
2629
+ N("handle-selected", e);
2630
+ }, R = (e) => {
2631
+ N("handle-selected", e);
2629
2632
  };
2630
2633
  return (n, r) => {
2631
2634
  let s = j("PvMenuItem", !0);
2632
- return E(), o(t, null, [u(Da, _(w.value, {
2633
- children: v.value,
2635
+ return E(), o(t, null, [u(Da, _(T.value, {
2636
+ children: b.value,
2634
2637
  menuOptionConfig: e.config,
2635
2638
  queryText: e.queryText,
2636
2639
  highlightSearchText: e.highlightSearchText,
2637
- showChevron: F(l) && T.value,
2638
- chevronIcon: A.value,
2640
+ showChevron: F(l) && D.value,
2641
+ chevronIcon: M.value,
2639
2642
  expanded: h.value,
2640
- onHandleSelected: te,
2641
- onToggleExpanded: S,
2642
- selected: M(i)
2643
+ onHandleSelected: L,
2644
+ onToggleExpanded: C,
2645
+ selected: ee(i)
2643
2646
  }), null, 16, [
2644
2647
  "children",
2645
2648
  "menuOptionConfig",
@@ -2649,13 +2652,13 @@ var _a = Symbol("SelectedItemsKey"), va = Symbol("EnableCascadeSelectionKey"), y
2649
2652
  "chevronIcon",
2650
2653
  "expanded",
2651
2654
  "selected"
2652
- ]), D.value ? (E(), o("ul", {
2655
+ ]), A.value ? (E(), o("ul", {
2653
2656
  key: 0,
2654
2657
  role: "list",
2655
- style: x(C.value)
2656
- }, [(E(!0), o(t, null, k(v.value, (t) => (E(), o("li", {
2658
+ style: x(w.value)
2659
+ }, [(E(!0), o(t, null, k(b.value, (t) => (E(), o("li", {
2657
2660
  key: t.id,
2658
- "data-active": M(t) ? "true" : null,
2661
+ "data-active": ee(t) ? "true" : null,
2659
2662
  class: y(e.itemClass)
2660
2663
  }, [u(s, _({ ref_for: !0 }, t, {
2661
2664
  selectedIds: c.value,
@@ -2664,21 +2667,21 @@ var _a = Symbol("SelectedItemsKey"), va = Symbol("EnableCascadeSelectionKey"), y
2664
2667
  queryText: e.queryText,
2665
2668
  highlightSearchText: e.highlightSearchText,
2666
2669
  level: e.level + 1,
2667
- onHandleSelected: L,
2668
- onSeeMore: r[1] ||= (e) => ee("see-more", e)
2670
+ onHandleSelected: R,
2671
+ onSeeMore: r[1] ||= (e) => N("see-more", e)
2669
2672
  }), null, 16, [
2670
2673
  "selectedIds",
2671
2674
  "config",
2672
2675
  "queryText",
2673
2676
  "highlightSearchText",
2674
2677
  "level"
2675
- ])], 10, Oa))), 128)), N.value ? (E(), o("li", ka, [u(Z, {
2678
+ ])], 10, Oa))), 128)), P.value ? (E(), o("li", ka, [u(Z, {
2676
2679
  class: "pv-text-brand",
2677
2680
  variant: "ghost",
2678
2681
  label: "See more",
2679
2682
  loading: g.value,
2680
2683
  "data-testid": "pv-menu-item-see-more",
2681
- onClick: P
2684
+ onClick: te
2682
2685
  }, null, 8, ["loading"])])) : a("", !0)], 4)) : a("", !0)], 64);
2683
2686
  };
2684
2687
  }
@@ -4653,12 +4656,12 @@ var $ = /* @__PURE__ */ function(e) {
4653
4656
  }
4654
4657
  return [...e].filter((e) => !B.value.includes(e));
4655
4658
  }, ze = (e) => {
4656
- let n = f(U.value, e), r = (n?.children?.length ?? 0) > 0, i = ce.value ? "suggestions" : null;
4659
+ let n = f(U.value, e), r = (n?.children?.length ?? 0) > 0 || (n?.totalChildCount ?? 0) > 0, i = ce.value ? "suggestions" : null;
4657
4660
  n?.isPreference && (i = "preferences");
4658
4661
  let s = null, l = n?.matchedValue, u = De(n?.matchedField);
4659
4662
  l && u ? s = l ? `${u}: ${l}` : "" : n?.subText ? s = n.subText : n?.colField && q.value && !r && (s = De(n?.colField));
4660
4663
  let d, p, m;
4661
- if (r && (d = n.children.map((e) => ({
4664
+ if (r && (d = (n.children ?? []).map((e) => ({
4662
4665
  ...e.menuOption,
4663
4666
  id: e.value,
4664
4667
  text: e.label || e.value,