@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.
@@ -2709,26 +2709,26 @@ var wi = Symbol("SelectedItemsKey"), Ti = Symbol("EnableCascadeSelectionKey"), E
2709
2709
  }),
2710
2710
  emits: /* @__PURE__ */ g(["handle-selected", "see-more"], ["update:selectedIds"]),
2711
2711
  setup(e, { emit: n }) {
2712
- let i = e, s = m(wi, void 0), c = I(e, "selectedIds"), l = m(Ai, D(!1)), d = m(ki, D(!1)), f = m(Di, void 0), p = m(Oi, void 0), h = D(i.defaultExpanded ?? !1), g = D(!1), v = D(i.children ?? []), b = D(/* @__PURE__ */ new Set());
2712
+ let i = e, s = m(wi, void 0), c = I(e, "selectedIds"), l = m(Ai, D(!1)), d = m(ki, D(!1)), f = m(Di, void 0), p = m(Oi, void 0), h = D(i.defaultExpanded ?? !1), g = D(!1), v = D(!1), b = D(i.children ?? []), S = D(/* @__PURE__ */ new Set());
2713
2713
  V(() => i.children, (e) => {
2714
2714
  if (!e) {
2715
- v.value = [];
2715
+ b.value = [];
2716
2716
  return;
2717
2717
  }
2718
- 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));
2719
- v.value = [...e, ...r];
2718
+ 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));
2719
+ b.value = [...e, ...r], v.value = !1;
2720
2720
  });
2721
- let S = () => {
2721
+ let C = () => {
2722
2722
  h.value = !h.value;
2723
- }, C = r(() => ({ paddingLeft: `${i.level * 12 + 12}px` })), w = r(() => {
2723
+ }, w = r(() => ({ paddingLeft: `${i.level * 12 + 12}px` })), E = r(() => {
2724
2724
  let { level: e, config: t, itemClass: n, ...r } = i;
2725
2725
  return r;
2726
- }), E = r(() => v.value.length > 0 && i.level < Li), k = r(() => E.value ? l.value ? h.value : !0 : !1), j = 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), N = n, F = r(() => i.totalChildCount == null ? !1 : i.totalChildCount > v.value.length), ee = async () => {
2726
+ }), k = r(() => (b.value.length > 0 || (i.totalChildCount ?? 0) > 0) && i.level < Li), j = r(() => k.value ? l.value ? h.value : !0 : !1), M = r(() => h.value ? "chevron-down" : "chevron-right"), N = (e) => s && Array.isArray(s.value) ? s.value.some((t) => t.id === e.id) : c.value.includes(e.id), F = n, ee = r(() => v.value || i.totalChildCount == null ? !1 : i.totalChildCount > b.value.length), L = async () => {
2727
2727
  if (g.value) return;
2728
2728
  if (!i.handleSeeMore) {
2729
- N("see-more", {
2729
+ F("see-more", {
2730
2730
  parentId: i.id,
2731
- offset: v.value.length
2731
+ offset: b.value.length
2732
2732
  });
2733
2733
  return;
2734
2734
  }
@@ -2737,50 +2737,53 @@ var wi = Symbol("SelectedItemsKey"), Ti = Symbol("EnableCascadeSelectionKey"), E
2737
2737
  try {
2738
2738
  let t = await i.handleSeeMore({
2739
2739
  parentId: i.id,
2740
- offset: v.value.length
2740
+ offset: b.value.length
2741
2741
  });
2742
2742
  if (Array.isArray(t) && t.length > 0) {
2743
- let n = new Set(v.value.map((e) => e.id)), r = t.filter((e) => !n.has(e.id));
2744
- if (r.length === 0) return;
2745
- let a = new Set(b.value);
2743
+ let n = new Set(b.value.map((e) => e.id)), r = t.filter((e) => !n.has(e.id));
2744
+ if (r.length === 0) {
2745
+ v.value = !0;
2746
+ return;
2747
+ }
2748
+ let a = new Set(S.value);
2746
2749
  for (let e of r) a.add(e.id);
2747
- if (b.value = a, v.value = [...v.value, ...r], e && s?.value) {
2750
+ if (S.value = a, b.value = [...b.value, ...r], e && s?.value) {
2748
2751
  let e = p?.value?.get(i.id), t = e ? r.filter((t) => !e.has(t.id)) : r;
2749
2752
  if (t.length > 0) {
2750
2753
  let e = new Set(s.value.map((e) => e.id)), n = t.filter((t) => !e.has(t.id));
2751
2754
  n.length > 0 && (s.value = [...s.value, ...n]);
2752
2755
  }
2753
2756
  }
2754
- }
2757
+ } else Array.isArray(t) && (v.value = !0);
2755
2758
  } finally {
2756
2759
  g.value = !1;
2757
2760
  }
2758
- }, L = (e) => {
2759
- if (l.value && E.value && e.option.id === i.id && !d.value) {
2760
- S();
2761
+ }, R = (e) => {
2762
+ if (l.value && k.value && e.option.id === i.id && !d.value) {
2763
+ C();
2761
2764
  return;
2762
2765
  }
2763
2766
  if (!s) {
2764
2767
  let t = c.value.indexOf(e.option.id);
2765
2768
  t > -1 ? c.value = [...c.value.slice(0, t), ...c.value.slice(t + 1)] : c.value = [...c.value, e.option.id];
2766
2769
  }
2767
- N("handle-selected", e);
2768
- }, R = (e) => {
2769
- N("handle-selected", e);
2770
+ F("handle-selected", e);
2771
+ }, z = (e) => {
2772
+ F("handle-selected", e);
2770
2773
  };
2771
2774
  return (n, r) => {
2772
2775
  let s = A("PvMenuItem", !0);
2773
- return T(), o(t, null, [u(Pi, _(w.value, {
2774
- children: v.value,
2776
+ return T(), o(t, null, [u(Pi, _(E.value, {
2777
+ children: b.value,
2775
2778
  menuOptionConfig: e.config,
2776
2779
  queryText: e.queryText,
2777
2780
  highlightSearchText: e.highlightSearchText,
2778
- showChevron: P(l) && E.value,
2779
- chevronIcon: j.value,
2781
+ showChevron: P(l) && k.value,
2782
+ chevronIcon: M.value,
2780
2783
  expanded: h.value,
2781
- onHandleSelected: L,
2782
- onToggleExpanded: S,
2783
- selected: M(i)
2784
+ onHandleSelected: R,
2785
+ onToggleExpanded: C,
2786
+ selected: N(i)
2784
2787
  }), null, 16, [
2785
2788
  "children",
2786
2789
  "menuOptionConfig",
@@ -2790,13 +2793,13 @@ var wi = Symbol("SelectedItemsKey"), Ti = Symbol("EnableCascadeSelectionKey"), E
2790
2793
  "chevronIcon",
2791
2794
  "expanded",
2792
2795
  "selected"
2793
- ]), k.value ? (T(), o("ul", {
2796
+ ]), j.value ? (T(), o("ul", {
2794
2797
  key: 0,
2795
2798
  role: "list",
2796
- style: x(C.value)
2797
- }, [(T(!0), o(t, null, O(v.value, (t) => (T(), o("li", {
2799
+ style: x(w.value)
2800
+ }, [(T(!0), o(t, null, O(b.value, (t) => (T(), o("li", {
2798
2801
  key: t.id,
2799
- "data-active": M(t) ? "true" : null,
2802
+ "data-active": N(t) ? "true" : null,
2800
2803
  class: y(e.itemClass)
2801
2804
  }, [u(s, _({ ref_for: !0 }, t, {
2802
2805
  selectedIds: c.value,
@@ -2805,21 +2808,21 @@ var wi = Symbol("SelectedItemsKey"), Ti = Symbol("EnableCascadeSelectionKey"), E
2805
2808
  queryText: e.queryText,
2806
2809
  highlightSearchText: e.highlightSearchText,
2807
2810
  level: e.level + 1,
2808
- onHandleSelected: R,
2809
- onSeeMore: r[1] ||= (e) => N("see-more", e)
2811
+ onHandleSelected: z,
2812
+ onSeeMore: r[1] ||= (e) => F("see-more", e)
2810
2813
  }), null, 16, [
2811
2814
  "selectedIds",
2812
2815
  "config",
2813
2816
  "queryText",
2814
2817
  "highlightSearchText",
2815
2818
  "level"
2816
- ])], 10, Fi))), 128)), F.value ? (T(), o("li", Ii, [u(J, {
2819
+ ])], 10, Fi))), 128)), ee.value ? (T(), o("li", Ii, [u(J, {
2817
2820
  class: "pv-text-brand",
2818
2821
  variant: "ghost",
2819
2822
  label: "See more",
2820
2823
  loading: g.value,
2821
2824
  "data-testid": "pv-menu-item-see-more",
2822
- onClick: ee
2825
+ onClick: L
2823
2826
  }, null, 8, ["loading"])])) : a("", !0)], 4)) : a("", !0)], 64);
2824
2827
  };
2825
2828
  }