hys-ui 0.3.0 → 0.5.0

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.
Files changed (168) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +68 -73
  3. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
  4. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
  5. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
  6. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
  7. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
  8. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
  9. package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
  10. package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
  11. package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
  12. package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
  13. package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
  14. package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
  15. package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
  16. package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
  17. package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
  18. package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
  19. package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
  20. package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
  21. package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
  22. package/dist/components/HysButton/HysButton.vue.js +2 -2
  23. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  24. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  25. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  26. package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
  27. package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
  28. package/dist/components/HysInput/HysInput.vue.js +2 -2
  29. package/dist/components/HysInput/HysInput2.vue.js +327 -274
  30. package/dist/components/HysMention/HysMention.vue.js +1 -1
  31. package/dist/components/HysMention/HysMention2.vue.js +1092 -154
  32. package/dist/components/HysModal/HysModal.vue.js +3 -3
  33. package/dist/components/HysModal/HysModal2.vue.js +81 -80
  34. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  35. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  36. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  37. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  38. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  39. package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
  40. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  41. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  42. package/dist/components/HysTable/HysTable.vue.js +2 -2
  43. package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
  44. package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
  45. package/dist/components/HysTour/HysTour.vue.js +291 -67
  46. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  47. package/dist/composables/animatedNumberDigits.js +106 -0
  48. package/dist/composables/animatedNumberFormat.js +222 -0
  49. package/dist/composables/animatedNumberTiming.js +66 -0
  50. package/dist/composables/buttonGroup.js +12 -0
  51. package/dist/composables/floatingPosition.js +18 -0
  52. package/dist/composables/mentionDocument.js +79 -0
  53. package/dist/composables/mentionEditor.js +58 -0
  54. package/dist/composables/numberAnimation.js +72 -0
  55. package/dist/composables/numberAnimationCatalog.js +301 -0
  56. package/dist/composables/numberAnimationSequence.js +45 -0
  57. package/dist/composables/selectOptions.js +44 -38
  58. package/dist/composables/splitPaneSizes.js +58 -0
  59. package/dist/composables/table.js +128 -105
  60. package/dist/composables/textInput.js +23 -14
  61. package/dist/composables/useDialog.js +50 -50
  62. package/dist/composables/useFloating.js +107 -103
  63. package/dist/composables/useHysAnimatedNumber.js +264 -0
  64. package/dist/composables/useHysNumberAnimationGroup.js +23 -0
  65. package/dist/composables/useMentionCaret.js +81 -0
  66. package/dist/composables/useMentionList.js +81 -0
  67. package/dist/composables/useMentionModel.js +90 -0
  68. package/dist/composables/useMentionOptions.js +421 -0
  69. package/dist/composables/useSplitPaneDrag.js +52 -0
  70. package/dist/composables/useSplitPaneStorage.js +38 -0
  71. package/dist/composables/useTable.js +344 -312
  72. package/dist/composables/useTableSticky.js +79 -0
  73. package/dist/composables/useTextareaSize.js +62 -46
  74. package/dist/composables/useTourLayout.js +129 -0
  75. package/dist/config.js +11 -11
  76. package/dist/index.js +183 -152
  77. package/dist/internal/MultiSplitPane.vue.js +305 -0
  78. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  79. package/dist/style.css +1 -1
  80. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
  81. package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
  82. package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
  83. package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
  84. package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
  85. package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
  86. package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
  87. package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
  88. package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
  89. package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
  90. package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
  91. package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
  92. package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
  93. package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
  94. package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
  95. package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
  96. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
  97. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
  98. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  99. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  100. package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
  101. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
  102. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
  103. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
  104. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
  105. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
  106. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
  107. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
  108. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
  109. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
  110. package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
  111. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
  112. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  113. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  114. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  115. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
  116. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  117. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
  118. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
  119. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
  120. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  121. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  122. package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
  123. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
  124. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
  125. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
  126. package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
  127. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
  128. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
  129. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
  130. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
  131. package/dist/types/composables/animatedNumber.d.ts +220 -0
  132. package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
  133. package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
  134. package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
  135. package/dist/types/composables/buttonGroup.d.ts +9 -0
  136. package/dist/types/composables/drawer.d.ts +1 -1
  137. package/dist/types/composables/floatingPosition.d.ts +14 -0
  138. package/dist/types/composables/mention.d.ts +284 -0
  139. package/dist/types/composables/mentionDocument.d.ts +15 -0
  140. package/dist/types/composables/mentionEditor.d.ts +7 -0
  141. package/dist/types/composables/modal.d.ts +2 -0
  142. package/dist/types/composables/numberAnimation.d.ts +29 -0
  143. package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
  144. package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
  145. package/dist/types/composables/selectOptions.d.ts +5 -0
  146. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  147. package/dist/types/composables/table.d.ts +116 -6
  148. package/dist/types/composables/textInput.d.ts +39 -4
  149. package/dist/types/composables/tour.d.ts +68 -0
  150. package/dist/types/composables/useFloating.d.ts +1 -1
  151. package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
  152. package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
  153. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  154. package/dist/types/composables/useMentionList.d.ts +23 -0
  155. package/dist/types/composables/useMentionModel.d.ts +14 -0
  156. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  157. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  158. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  159. package/dist/types/composables/useTable.d.ts +7 -3
  160. package/dist/types/composables/useTableSticky.d.ts +22 -0
  161. package/dist/types/composables/useTextareaSize.d.ts +5 -2
  162. package/dist/types/composables/useTourLayout.d.ts +33 -0
  163. package/dist/types/config.d.ts +1 -0
  164. package/dist/types/index.d.ts +46 -1
  165. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  166. package/package.json +3 -2
  167. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  168. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -1,375 +1,403 @@
1
- import { ref as A, computed as v, shallowRef as re, watch as _, nextTick as $, onActivated as Ne, onDeactivated as We, onBeforeUnmount as Ve } from "vue";
2
- import { tableValue as ue, tableToken as y, tableFilterPredicate as De, tableCompare as Be } from "./table.js";
3
- function Ge(n, b, ie, s) {
4
- const d = A(!0), g = v(() => !!n.loading || !!n.disabled), K = A(
5
- Array.isArray(n.defaultSort) ? [...n.defaultSort] : n.defaultSort ? [n.defaultSort] : n.defaultSort === void 0 ? b().filter((e) => e.defaultSortOrder).map((e) => ({ key: e.key, direction: e.defaultSortOrder })) : []
6
- ), se = A({
1
+ import { ref as R, computed as s, shallowRef as ce, watch as p, nextTick as ee, onActivated as Be, onDeactivated as He, onBeforeUnmount as Ue } from "vue";
2
+ import { tableValue as se, tableToken as b, tableFilterPredicate as Je, tableCompare as Le } from "./table.js";
3
+ function Ze(l, m, fe, i) {
4
+ const f = R(!0), g = s(() => !!l.loading || !!l.disabled), z = s(
5
+ () => typeof l.pagination == "object" ? l.pagination : {}
6
+ ), de = R(
7
+ Array.isArray(l.defaultSort) ? [...l.defaultSort] : l.defaultSort ? [l.defaultSort] : l.defaultSort === void 0 ? m().filter((e) => e.defaultSortOrder).map((e) => ({ key: e.key, direction: e.defaultSortOrder })) : []
8
+ ), te = R({
7
9
  ...Object.fromEntries(
8
- b().filter((e) => e.defaultFilterValue).map((e) => [e.key, [...e.defaultFilterValue]])
10
+ m().filter((e) => e.defaultFilterValue).map((e) => [e.key, [...e.defaultFilterValue]])
9
11
  ),
10
- ...n.defaultFilters
11
- }), I = A(1), N = A(10), ce = A([
12
- ...n.defaultSelectedRowKeys ?? []
13
- ]), ve = A([...n.defaultExpandedRowKeys ?? []]), p = A(
14
- n.defaultCurrentRowKey ?? null
15
- ), x = re(
12
+ ...l.defaultFilters
13
+ }), q = R(z.value.defaultPage ?? 1), _ = R(z.value.defaultPageSize ?? 10), ve = R([
14
+ ...l.defaultSelectedRowKeys ?? []
15
+ ]), he = R([...l.defaultExpandedRowKeys ?? []]), ae = R(
16
+ l.defaultCurrentRowKey ?? null
17
+ ), x = ce(
16
18
  /* @__PURE__ */ new Map()
17
- ), h = re(
19
+ ), h = ce(
18
20
  /* @__PURE__ */ new Map()
19
- ), C = re(/* @__PURE__ */ new Map());
21
+ ), A = ce(/* @__PURE__ */ new Map());
20
22
  let W = /* @__PURE__ */ new WeakSet();
21
- const ee = /* @__PURE__ */ new WeakMap();
22
- let Re = 0;
23
- function te(e) {
24
- const a = typeof n.rowKey == "function" ? n.rowKey(e) : ue(e, n.rowKey ?? "id");
25
- return typeof a == "string" || typeof a == "number" && Number.isFinite(a) ? a : (ee.has(e) || ee.set(e, "@hys-table-row:" + ++Re), ee.get(e));
23
+ const ne = /* @__PURE__ */ new WeakMap();
24
+ let Oe = 0;
25
+ function le(e) {
26
+ const a = typeof l.rowKey == "function" ? l.rowKey(e) : se(e, l.rowKey ?? "id");
27
+ return typeof a == "string" || typeof a == "number" && Number.isFinite(a) ? a : (ne.has(e) || ne.set(e, "@hys-table-row:" + ++Oe), ne.get(e));
26
28
  }
27
- const f = v(() => {
28
- const e = [], a = [], t = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new WeakSet(), o = [...n.rows].reverse().map((r) => ({
29
+ const d = s(() => {
30
+ const e = [], a = [], t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new WeakSet(), o = [...l.rows].reverse().map((r) => ({
29
31
  row: r,
30
32
  parent: void 0,
31
33
  depth: 0
32
34
  }));
33
35
  for (; o.length; ) {
34
36
  const { row: r, parent: u, depth: c } = o.pop();
35
- if (!r || typeof r != "object" || l.has(r)) continue;
36
- l.add(r);
37
- const w = te(r), k = y(w);
38
- if (t.has(k)) continue;
39
- const q = n.treeMode ? ue(r, n.childrenKey ?? "children") : void 0, S = x.value.get(k), U = (S == null ? void 0 : S.row) === r && S.override ? S.rows : Array.isArray(q) ? q : (S == null ? void 0 : S.row) === r ? S.rows : [], i = {
37
+ if (!r || typeof r != "object" || n.has(r)) continue;
38
+ n.add(r);
39
+ const y = le(r), M = b(y);
40
+ if (t.has(M)) continue;
41
+ const F = l.treeMode ? se(r, l.childrenKey ?? "children") : void 0, w = x.value.get(M), D = (w == null ? void 0 : w.row) === r && w.override ? w.rows : Array.isArray(F) ? F : (w == null ? void 0 : w.row) === r ? w.rows : [], T = {
40
42
  row: r,
41
- key: w,
42
- token: k,
43
+ key: y,
44
+ token: M,
43
45
  index: a.length,
44
46
  depth: c,
45
- rootToken: (u == null ? void 0 : u.rootToken) ?? k,
47
+ rootToken: (u == null ? void 0 : u.rootToken) ?? M,
46
48
  parent: u,
47
49
  children: [],
48
- lazy: !!n.treeMode && !!n.loadChildren && !Array.isArray(q) && (S == null ? void 0 : S.row) !== r && !!ue(r, n.hasChildrenKey ?? "hasChildren")
50
+ lazy: !!l.treeMode && !!l.loadChildren && !Array.isArray(F) && (w == null ? void 0 : w.row) !== r && !!se(r, l.hasChildrenKey ?? "hasChildren")
49
51
  };
50
- if (t.set(k, i), a.push(i), ((u == null ? void 0 : u.children) ?? e).push(i), n.treeMode)
51
- for (let oe = U.length - 1; oe >= 0; oe--)
52
- o.push({ row: U[oe], parent: i, depth: c + 1 });
52
+ if (t.set(M, T), a.push(T), ((u == null ? void 0 : u.children) ?? e).push(T), l.treeMode)
53
+ for (let v = D.length - 1; v >= 0; v--)
54
+ o.push({ row: D[v], parent: T, depth: c + 1 });
53
55
  }
54
56
  return { roots: e, all: a, map: t };
55
- }), M = v(() => [
56
- ...new Set(n.selectedRowKeys ?? ce.value)
57
- ]), m = v(
58
- () => new Set(M.value.map(y))
59
- ), V = v(() => [
57
+ }), S = s(() => [
58
+ ...new Set(l.selectedRowKeys ?? ve.value)
59
+ ]), k = s(
60
+ () => new Set(S.value.map(b))
61
+ ), G = s(() => [
60
62
  ...new Set(
61
- n.expandedRowKeys ?? (n.defaultExpandAll && !fe.value ? f.value.all.filter((e) => e.children.length || e.lazy || ie()).map((e) => e.key) : ve.value)
63
+ l.expandedRowKeys ?? (l.defaultExpandAll && !ge.value ? d.value.all.filter((e) => e.children.length || e.lazy || fe()).map((e) => e.key) : he.value)
62
64
  )
63
- ]), fe = A(!1), D = v(() => new Set(V.value.map(y))), G = /* @__PURE__ */ new Map();
64
- _(
65
- [M, () => f.value.all, () => n.reserveSelection],
65
+ ]), ge = R(!1), V = s(() => new Set(G.value.map(b))), B = /* @__PURE__ */ new Map();
66
+ p(
67
+ [S, () => d.value.all, () => l.reserveSelection],
66
68
  () => {
67
69
  var a, t;
68
- for (const l of G.keys())
69
- m.value.has(l) || G.delete(l);
70
- for (const l of M.value) {
71
- const o = f.value.map.get(y(l));
72
- o && G.set(o.token, o.row);
70
+ for (const n of B.keys())
71
+ k.value.has(n) || B.delete(n);
72
+ for (const n of S.value) {
73
+ const o = d.value.map.get(b(n));
74
+ o && B.set(o.token, o.row);
73
75
  }
74
- if (!n.reserveSelection) {
75
- const l = M.value.filter(
76
- (o) => f.value.map.has(y(o))
76
+ if (!l.reserveSelection) {
77
+ const n = S.value.filter(
78
+ (o) => d.value.map.has(b(o))
77
79
  );
78
- l.length !== M.value.length && j(l);
80
+ n.length !== S.value.length && Z(n);
79
81
  }
80
82
  let e;
81
- for (const [l, o] of x.value)
82
- ((a = f.value.map.get(l)) == null ? void 0 : a.row) !== o.row && (e ?? (e = new Map(x.value)), e.delete(l));
83
+ for (const [n, o] of x.value)
84
+ ((a = d.value.map.get(n)) == null ? void 0 : a.row) !== o.row && (e ?? (e = new Map(x.value)), e.delete(n));
83
85
  e && (x.value = e);
84
- for (const [l, o] of h.value)
85
- ((t = f.value.map.get(l)) == null ? void 0 : t.row) !== o.row && P(l);
86
+ for (const [n, o] of h.value)
87
+ ((t = d.value.map.get(n)) == null ? void 0 : t.row) !== o.row && I(n);
86
88
  },
87
89
  { immediate: !0 }
88
90
  );
89
- const E = v(() => {
90
- const e = n.sorts ?? (n.sort !== void 0 ? n.sort ? [n.sort] : [] : K.value), a = /* @__PURE__ */ new Set();
91
+ function H(e) {
92
+ const a = new Map(m().filter((n) => n.sortable).map((n) => [n.key, n])), t = /* @__PURE__ */ new Set();
91
93
  return e.filter(
92
- (t) => ["asc", "desc"].includes(t.direction) && b().some((l) => l.key === t.key && l.sortable) && !a.has(t.key) && (a.add(t.key), !0)
93
- ).slice(0, n.multiSort ? void 0 : 1).sort(
94
- (t, l) => {
95
- var o, r;
96
- return (((o = b().find((u) => u.key === l.key)) == null ? void 0 : o.sortPriority) ?? 0) - (((r = b().find((u) => u.key === t.key)) == null ? void 0 : r.sortPriority) ?? 0);
94
+ (n) => ["asc", "desc"].includes(n.direction) && a.has(n.key) && !t.has(n.key) && (t.add(n.key), !0)
95
+ ).slice(0, l.multiSort ? void 0 : 1).sort(
96
+ (n, o) => {
97
+ var r, u;
98
+ return (((r = a.get(o.key)) == null ? void 0 : r.sortPriority) ?? 0) - (((u = a.get(n.key)) == null ? void 0 : u.sortPriority) ?? 0);
97
99
  }
98
100
  );
99
- }), F = v(
100
- () => n.filters ?? se.value
101
- ), z = v(() => {
102
- const e = f.value, a = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Map(), l = De(F.value, b());
103
- if (!n.serverMode)
101
+ }
102
+ const oe = s(() => new Map(
103
+ m().filter((e) => e.sortable && e.sortOrder !== void 0).map((e) => [e.key, e.sortOrder])
104
+ )), N = s(() => {
105
+ if (l.sorts !== void 0) return H(l.sorts);
106
+ if (l.sort !== void 0) return H(l.sort ? [l.sort] : []);
107
+ const e = de.value.filter((t) => !oe.value.has(t.key)), a = m().flatMap(({ key: t }) => {
108
+ const n = oe.value.get(t);
109
+ return n ? [{ key: t, direction: n }] : [];
110
+ });
111
+ return H([...a, ...e]);
112
+ }), j = s(() => {
113
+ if (l.filters !== void 0) return l.filters;
114
+ const e = m().flatMap(
115
+ ({ key: a, filteredValue: t }) => t === void 0 ? [] : [[a, t]]
116
+ );
117
+ return e.length ? { ...te.value, ...Object.fromEntries(e) } : te.value;
118
+ }), E = s(() => {
119
+ const e = d.value, a = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Map(), n = Je(j.value, m());
120
+ if (!l.serverMode)
104
121
  for (let u = e.all.length - 1; u >= 0; u--) {
105
122
  const c = e.all[u];
106
- (l(c.row) || c.children.some((w) => a.has(w.token))) && a.add(c.token);
123
+ (n(c.row) || c.children.some((y) => a.has(y.token))) && a.add(c.token);
107
124
  }
108
- const o = Be(E.value, b());
125
+ const o = Le(N.value, m());
109
126
  function r(u) {
110
- const c = n.serverMode ? [...u] : u.filter((w) => a.has(w.token));
111
- return n.serverMode || !E.value.length ? c : c.sort((w, k) => o(w.row, k.row) || w.index - k.index);
127
+ const c = l.serverMode ? [...u] : u.filter((y) => a.has(y.token));
128
+ return l.serverMode || !N.value.length ? c : c.sort((y, M) => o(y.row, M.row) || y.index - M.index);
112
129
  }
113
130
  for (const u of e.all)
114
131
  u.children.length && t.set(u.token, r(u.children));
115
132
  return { roots: r(e.roots), children: t };
116
- }), J = v(
117
- () => typeof n.pagination == "object" ? n.pagination : {}
118
- ), B = v(() => {
119
- const e = n.pageSize ?? J.value.pageSize ?? N.value;
120
- return Number.isFinite(e) && e > 0 ? Math.floor(e) : 10;
121
- }), de = v(
122
- () => n.serverMode ? Math.max(0, n.total ?? J.value.total ?? n.rows.length) : z.value.roots.length
123
- ), he = v(
124
- () => Math.max(1, Math.ceil(de.value / B.value))
125
- ), L = v(() => {
126
- const e = n.page ?? J.value.page ?? I.value;
133
+ }), X = s(() => {
134
+ const e = l.pageSize ?? z.value.pageSize ?? _.value;
135
+ return Number.isFinite(e) && e > 0 ? Math.min(Number.MAX_SAFE_INTEGER, Math.max(1, Math.floor(e))) : 10;
136
+ }), we = s(() => {
137
+ const e = z.value.pageCount;
138
+ return l.serverMode && e !== void 0 && Number.isFinite(e) && e > 0 ? Math.min(Number.MAX_SAFE_INTEGER, Math.max(1, Math.floor(e))) : void 0;
139
+ }), ke = s(() => {
140
+ if (!l.serverMode) return E.value.roots.length;
141
+ const e = l.total ?? z.value.total;
142
+ return e === void 0 ? we.value === void 0 ? l.rows.length : void 0 : Number.isFinite(e) ? Math.min(Number.MAX_SAFE_INTEGER, Math.max(0, Math.floor(e))) : 0;
143
+ }), re = s(
144
+ () => we.value ?? Math.max(1, Math.ceil((ke.value ?? 0) / X.value))
145
+ ), U = s(() => {
146
+ const e = l.page ?? z.value.page ?? q.value;
127
147
  return Math.min(
128
- he.value,
148
+ re.value,
129
149
  Math.max(1, Number.isFinite(e) ? Math.floor(e) : 1)
130
150
  );
131
- }), we = v(
132
- () => !n.pagination || n.serverMode ? z.value.roots : z.value.roots.slice(
133
- (L.value - 1) * B.value,
134
- L.value * B.value
151
+ }), ye = s(
152
+ () => !l.pagination || l.serverMode ? E.value.roots : E.value.roots.slice(
153
+ (U.value - 1) * X.value,
154
+ U.value * X.value
135
155
  )
136
- ), Q = v(() => {
137
- const e = [], a = [...we.value].reverse();
156
+ ), J = s(() => {
157
+ const e = [], a = [...ye.value].reverse();
138
158
  for (; a.length; ) {
139
159
  const t = a.pop();
140
- if (e.push(t), D.value.has(t.token) || !n.serverMode && Object.values(F.value).some((l) => l.length)) {
141
- const l = z.value.children.get(t.token) ?? [];
142
- for (let o = l.length - 1; o >= 0; o--) a.push(l[o]);
160
+ if (e.push(t), V.value.has(t.token) || !l.serverMode && Object.values(j.value).some((n) => n.length)) {
161
+ const n = E.value.children.get(t.token) ?? [];
162
+ for (let o = n.length - 1; o >= 0; o--) a.push(n[o]);
143
163
  }
144
164
  }
145
165
  return e;
146
- }), ke = v(() => {
147
- const e = [], a = [...z.value.roots].reverse();
166
+ }), Se = s(() => {
167
+ const e = [], a = [...E.value.roots].reverse();
148
168
  for (; a.length; ) {
149
169
  const t = a.pop();
150
170
  e.push(t.row);
151
- const l = z.value.children.get(t.token) ?? [];
152
- for (let o = l.length - 1; o >= 0; o--) a.push(l[o]);
171
+ const n = E.value.children.get(t.token) ?? [];
172
+ for (let o = n.length - 1; o >= 0; o--) a.push(n[o]);
153
173
  }
154
174
  return e;
155
- }), X = v(
156
- () => n.currentRowKey !== void 0 ? n.currentRowKey : p.value
157
- ), Y = v(
175
+ }), L = s(
176
+ () => l.currentRowKey !== void 0 ? l.currentRowKey : ae.value
177
+ ), Q = s(
158
178
  () => {
159
179
  var e;
160
- return X.value == null || (e = f.value.map.get(y(X.value))) == null ? void 0 : e.row;
180
+ return L.value == null || (e = d.value.map.get(b(L.value))) == null ? void 0 : e.row;
161
181
  }
162
- ), ae = v(() => {
182
+ ), ue = s(() => {
163
183
  const e = /* @__PURE__ */ new Set();
164
- if (n.checkStrictly !== !1) return e;
165
- for (let a = f.value.all.length - 1; a >= 0; a--) {
166
- const t = f.value.all[a];
184
+ if (l.checkStrictly !== !1) return e;
185
+ for (let a = d.value.all.length - 1; a >= 0; a--) {
186
+ const t = d.value.all[a];
167
187
  t.children.some(
168
- (l) => e.has(l.token) || m.value.has(l.token)
169
- ) && !t.children.filter(R).every((l) => m.value.has(l.token)) && e.add(t.token);
188
+ (n) => e.has(n.token) || k.value.has(n.token)
189
+ ) && !t.children.filter(C).every((n) => k.value.has(n.token)) && e.add(t.token);
170
190
  }
171
191
  return e;
172
192
  });
173
- function R(e) {
193
+ function C(e) {
174
194
  var a;
175
- return n.selectable !== !1 && ((a = n.getSelectionProps) == null ? void 0 : a.call(n, e.row, e.index).disabled) !== !0 && (typeof n.selectable != "function" || n.selectable(e.row, e.index));
195
+ return l.selectable !== !1 && ((a = l.getSelectionProps) == null ? void 0 : a.call(l, e.row, e.index).disabled) !== !0 && (typeof l.selectable != "function" || l.selectable(e.row, e.index));
176
196
  }
177
- const H = v(() => {
178
- const e = [], a = [...we.value].reverse();
197
+ const O = s(() => {
198
+ const e = [], a = [...ye.value].reverse();
179
199
  for (; a.length; ) {
180
200
  const t = a.pop();
181
- R(t) && e.push(t);
182
- const l = z.value.children.get(t.token) ?? [];
183
- for (let o = l.length - 1; o >= 0; o--) a.push(l[o]);
201
+ C(t) && e.push(t);
202
+ const n = E.value.children.get(t.token) ?? [];
203
+ for (let o = n.length - 1; o >= 0; o--) a.push(n[o]);
184
204
  }
185
205
  return e;
186
- }), le = v(
187
- () => !!H.value.length && H.value.every((e) => m.value.has(e.token))
188
- ), ye = v(
189
- () => !le.value && H.value.some(
190
- (e) => m.value.has(e.token) || ae.value.has(e.token)
206
+ }), ie = s(
207
+ () => !!O.value.length && O.value.every((e) => k.value.has(e.token))
208
+ ), Me = s(
209
+ () => !ie.value && O.value.some(
210
+ (e) => k.value.has(e.token) || ue.value.has(e.token)
191
211
  )
192
- ), ge = v(() => ({
212
+ ), be = s(() => ({
193
213
  action: "page",
194
- page: L.value,
195
- pageSize: B.value,
196
- sorts: E.value.map((e) => ({ ...e })),
214
+ page: U.value,
215
+ pageSize: X.value,
216
+ sorts: N.value.map((e) => ({ ...e })),
197
217
  filters: Object.fromEntries(
198
- Object.entries(F.value).map(([e, a]) => [e, [...a]])
218
+ Object.entries(j.value).map(([e, a]) => [e, [...a]])
199
219
  ),
200
- currentData: ke.value
220
+ currentData: Se.value
201
221
  }));
202
- function Z(e, a = {}) {
203
- const t = { ...ge.value, ...a, action: e };
204
- s("queryChange", t), s("change", t);
222
+ function Y(e, a = {}) {
223
+ const t = { ...be.value, ...a, action: e };
224
+ i("queryChange", t), i("change", t);
205
225
  }
206
- function Ae(e, a = "page") {
207
- if (g.value || !d.value) return;
208
- const t = Math.max(1, Math.min(he.value, Math.floor(e) || 1));
209
- I.value = t, s("update:page", t), s("pageChange", t), Z(a, { page: t });
226
+ function Ke(e, a = "page") {
227
+ if (g.value || !f.value) return;
228
+ const t = Math.max(1, Math.min(re.value, Math.floor(e) || 1));
229
+ q.value = t, i("update:page", t), i("pageChange", t), Y(a, { page: t });
210
230
  }
211
- function Ke(e) {
212
- g.value || !d.value || !Number.isFinite(e) || e < 1 || (N.value = Math.floor(e), I.value = 1, s("update:pageSize", N.value), s("pageSizeChange", N.value), s("update:page", 1), s("pageChange", 1), Z("pageSize", { page: 1, pageSize: N.value }));
231
+ function Fe(e) {
232
+ g.value || !f.value || !Number.isFinite(e) || e < 1 || (_.value = Math.floor(e), q.value = 1, i("update:pageSize", _.value), i("pageSizeChange", _.value), i("update:page", 1), i("pageChange", 1), Y("pageSize", { page: 1, pageSize: _.value }));
213
233
  }
214
- function Se(e) {
215
- if (g.value || !d.value) return;
216
- const a = (Array.isArray(e) ? [...e] : e ? [e] : []).filter(
217
- (t) => b().some((l) => l.key === t.key && l.sortable) && ["asc", "desc"].includes(t.direction)
234
+ function xe(e) {
235
+ if (g.value || !f.value) return;
236
+ const a = H(
237
+ Array.isArray(e) ? [...e] : e ? [e] : []
218
238
  );
219
- K.value = n.multiSort ? a : a.slice(0, 1), n.multiSort && K.value.sort(
220
- (t, l) => {
221
- var o, r;
222
- return (((o = b().find((u) => u.key === l.key)) == null ? void 0 : o.sortPriority) ?? 0) - (((r = b().find((u) => u.key === t.key)) == null ? void 0 : r.sortPriority) ?? 0);
223
- }
224
- ), I.value = 1, s("update:sort", K.value[0] ?? null), s("update:sorts", K.value), s("sortChange", K.value[0] ?? null, K.value), s("update:page", 1), Z("sort", { sorts: K.value, page: 1 });
239
+ de.value = l.sorts !== void 0 || l.sort !== void 0 ? a : a.filter((t) => !oe.value.has(t.key)), q.value = 1, i("update:sort", a[0] ?? null), i("update:sorts", a), i("sortChange", a[0] ?? null, a), i("update:page", 1), Y("sort", { sorts: a, page: 1 });
225
240
  }
226
- function ze(e, a) {
227
- var u, c, w;
241
+ function me(e, a) {
242
+ var o, r, u;
243
+ const t = (o = N.value.find((c) => c.key === e.key)) == null ? void 0 : o.direction, n = (r = e.sortOrders) != null && r.length ? e.sortOrders : (u = l.sortOrders) != null && u.length ? l.sortOrders : ["asc", "desc", null];
244
+ return a ? t === a ? null : a : n[(n.indexOf(t ?? null) + 1) % n.length];
245
+ }
246
+ function Te(e, a) {
228
247
  if (!e.sortable) return;
229
- const t = (u = E.value.find((k) => k.key === e.key)) == null ? void 0 : u.direction, l = (c = e.sortOrders) != null && c.length ? e.sortOrders : (w = n.sortOrders) != null && w.length ? n.sortOrders : ["asc", "desc", null], o = a ? t === a ? null : a : l[(l.indexOf(t ?? null) + 1) % l.length], r = n.multiSort ? E.value.filter((k) => k.key !== e.key) : [];
230
- o && r.push({ key: e.key, direction: o }), Se(r);
248
+ const t = me(e, a), n = l.multiSort ? N.value.filter((o) => o.key !== e.key) : [];
249
+ t && n.push({ key: e.key, direction: t }), xe(n);
231
250
  }
232
- function Me(e) {
233
- g.value || !d.value || (se.value = e, I.value = 1, s("update:filters", e), s("filterChange", e), s("update:page", 1), Z("filter", { filters: e, page: 1 }));
251
+ function Ce(e) {
252
+ if (g.value || !f.value) return;
253
+ const a = new Set(m().filter((t) => t.filteredValue !== void 0).map((t) => t.key));
254
+ te.value = l.filters !== void 0 || !a.size ? e : Object.fromEntries(Object.entries(e).filter(([t]) => !a.has(t))), q.value = 1, i("update:filters", e), i("filterChange", e), i("update:page", 1), Y("filter", { filters: e, page: 1 });
234
255
  }
235
- function Oe(e, a) {
236
- b().some((t) => t.key === e) && Me({ ...F.value, [e]: [...a] });
256
+ function Ne(e, a) {
257
+ m().some((t) => t.key === e) && Ce({ ...j.value, [e]: [...a] });
237
258
  }
238
- function Ee(e) {
239
- Me(
259
+ function je(e) {
260
+ Ce(
240
261
  e ? Object.fromEntries(
241
- Object.entries(F.value).filter(
262
+ Object.entries(j.value).filter(
242
263
  ([a]) => !e.includes(a)
243
264
  )
244
265
  ) : {}
245
266
  );
246
267
  }
247
- function T(e) {
248
- return f.value.map.get(
249
- y(typeof e == "object" ? te(e) : e)
268
+ function P(e) {
269
+ return d.value.map.get(
270
+ b(typeof e == "object" ? le(e) : e)
250
271
  );
251
272
  }
252
- function O() {
253
- return M.value.flatMap((e) => {
254
- var l;
255
- const a = y(e), t = ((l = f.value.map.get(a)) == null ? void 0 : l.row) ?? (n.reserveSelection ? G.get(a) : void 0);
273
+ function K() {
274
+ return S.value.flatMap((e) => {
275
+ var n;
276
+ const a = b(e), t = ((n = d.value.map.get(a)) == null ? void 0 : n.row) ?? (l.reserveSelection ? B.get(a) : void 0);
256
277
  return t ? [t] : [];
257
278
  });
258
279
  }
259
- async function j(e) {
260
- if (g.value || !d.value) return !1;
280
+ async function Z(e) {
281
+ if (g.value || !f.value) return !1;
261
282
  const a = [...new Set(e)];
262
- ce.value = a, s("update:selectedRowKeys", a), await $();
263
- const t = d.value && a.length === M.value.length && a.every((l) => m.value.has(y(l)));
264
- return t && s("selectionChange", O(), M.value), t;
283
+ ve.value = a, i("update:selectedRowKeys", a), await ee();
284
+ const t = f.value && a.length === S.value.length && a.every((n) => k.value.has(b(n)));
285
+ return t && i("selectionChange", K(), S.value), t;
265
286
  }
266
- function ne(e) {
267
- if (!(n.checkStrictly !== !1 || n.selectionType === "radio"))
268
- for (let a = f.value.all.length - 1; a >= 0; a--) {
269
- const t = f.value.all[a], l = t.children.filter(R);
270
- !l.length || !R(t) || (l.every((o) => e.has(o.token)) ? e.add(t.token) : e.delete(t.token));
287
+ function Pe(e) {
288
+ if (!(l.checkStrictly !== !1 || l.selectionType === "radio"))
289
+ for (let a = d.value.all.length - 1; a >= 0; a--) {
290
+ const t = d.value.all[a], n = t.children.filter(C);
291
+ !n.length || !C(t) || (n.every((o) => e.has(o.token)) ? e.add(t.token) : e.delete(t.token));
271
292
  }
272
293
  }
273
- let be;
274
- async function Fe(e, a, t = !1) {
275
- const l = T(e);
276
- if (!l || !R(l) || g.value) return !1;
277
- const o = a ?? !m.value.has(l.token);
278
- if (n.selectionType === "radio") {
279
- const i = await j(o ? [l.key] : []);
280
- return i && s("select", O(), l.row, o), i;
294
+ function $(e) {
295
+ Pe(e);
296
+ const a = S.value.filter((t) => e.has(b(t)));
297
+ for (const t of d.value.all)
298
+ e.has(t.token) && !k.value.has(t.token) && a.push(t.key);
299
+ return Z(a);
300
+ }
301
+ let Ae;
302
+ async function Ie(e, a, t = !1) {
303
+ const n = P(e), o = typeof t == "boolean" ? t : t.range, r = typeof t == "object" && t.ignoreSelectable;
304
+ if (!n || !r && !C(n) || g.value || !f.value)
305
+ return !1;
306
+ const u = a ?? !k.value.has(n.token);
307
+ if (l.selectionType === "radio") {
308
+ const v = await Z(u ? [n.key] : []);
309
+ return v && i("select", K(), n.row, u), v;
281
310
  }
282
- const r = t && n.rangeSelection ? Q.value.findIndex((i) => i.token === be) : -1, u = Q.value.findIndex((i) => i.token === l.token), c = r >= 0 && u >= 0 ? Q.value.slice(Math.min(r, u), Math.max(r, u) + 1) : [l], w = new Set(m.value), k = [...c], q = /* @__PURE__ */ new Set();
283
- for (; k.length; ) {
284
- const i = k.pop();
285
- q.has(i.token) || (q.add(i.token), R(i) && (o ? w.add(i.token) : w.delete(i.token)), n.checkStrictly === !1 && k.push(...i.children));
311
+ const c = o && l.rangeSelection ? J.value.findIndex((v) => v.token === Ae) : -1, y = J.value.findIndex((v) => v.token === n.token), M = c >= 0 && y >= 0 ? J.value.slice(Math.min(c, y), Math.max(c, y) + 1) : [n], F = new Set(k.value), w = [...M], D = /* @__PURE__ */ new Set();
312
+ for (; w.length; ) {
313
+ const v = w.pop();
314
+ D.has(v.token) || (D.add(v.token), (r && v === n || C(v)) && (u ? F.add(v.token) : F.delete(v.token)), l.checkStrictly === !1 && w.push(...v.children));
286
315
  }
287
- ne(w);
288
- const S = [
289
- ...new Map([
290
- ...M.value.filter((i) => w.has(y(i))).map((i) => [y(i), i]),
291
- ...f.value.all.filter((i) => w.has(i.token)).map((i) => [i.token, i.key])
292
- ]).values()
293
- ], U = await j(S);
294
- return U && (be = l.token, s("select", O(), l.row, o), c.length > 1 && s(
316
+ const T = await $(F);
317
+ return T && (Ae = n.token, i("select", K(), n.row, u), M.length > 1 && i(
295
318
  "selectRange",
296
- O(),
297
- c.filter(R).map((i) => i.row),
298
- o
299
- )), U;
319
+ K(),
320
+ M.filter(C).map((v) => v.row),
321
+ u
322
+ )), T;
300
323
  }
301
- async function Te(e) {
302
- if (n.selectionType === "radio") return !1;
303
- const a = e ?? (ye.value && n.selectOnIndeterminate === !1 ? !1 : !le.value), t = new Set(m.value);
304
- for (const r of H.value)
305
- a ? t.add(r.token) : t.delete(r.token);
306
- ne(t);
307
- const l = [
308
- ...new Map([
309
- ...M.value.filter((r) => t.has(y(r))).map((r) => [y(r), r]),
310
- ...f.value.all.filter((r) => t.has(r.token)).map((r) => [r.token, r.key])
311
- ]).values()
312
- ], o = await j(l);
313
- return o && s("selectAll", O(), a), o;
324
+ async function qe(e) {
325
+ if (l.selectionType === "radio") return !1;
326
+ const a = e ?? (Me.value && l.selectOnIndeterminate === !1 ? !1 : !ie.value), t = k.value, n = new Set(t), o = O.value;
327
+ for (const u of o)
328
+ a ? n.add(u.token) : n.delete(u.token);
329
+ const r = await $(n);
330
+ if (r) {
331
+ const u = o.filter(({ token: c }) => t.has(c) !== n.has(c));
332
+ i("selectAll", K(), a, u.map(({ row: c }) => c));
333
+ }
334
+ return r;
314
335
  }
315
- async function je() {
316
- if (n.selectionType === "radio" || g.value || !d.value)
336
+ async function _e() {
337
+ if (l.selectionType === "radio" || g.value || !f.value)
317
338
  return !1;
318
- const e = new Set(m.value);
319
- for (const l of H.value)
320
- (n.checkStrictly !== !1 || !l.children.some(R)) && (e.has(l.token) ? e.delete(l.token) : e.add(l.token));
321
- ne(e);
322
- const a = [
323
- ...new Map([
324
- ...M.value.filter((l) => e.has(y(l))).map((l) => [y(l), l]),
325
- ...f.value.all.filter((l) => e.has(l.token)).map((l) => [l.token, l.key])
326
- ]).values()
327
- ], t = await j(a);
328
- return t && s("selectInvert", O(), M.value), t;
339
+ const e = new Set(k.value);
340
+ for (const t of O.value)
341
+ (l.checkStrictly !== !1 || !t.children.some(C)) && (e.has(t.token) ? e.delete(t.token) : e.add(t.token));
342
+ const a = await $(e);
343
+ return a && i("selectInvert", K(), S.value), a;
344
+ }
345
+ async function We(e, a = O.value) {
346
+ if (l.selectionType === "radio" || g.value || !f.value) return !1;
347
+ const t = new Set(e.map(b)), n = new Set(k.value);
348
+ for (const o of a) {
349
+ const r = d.value.map.get(o.token);
350
+ (r == null ? void 0 : r.row) !== o.row || !C(r) || (t.has(o.token) ? n.add(o.token) : n.delete(o.token));
351
+ }
352
+ return $(n);
329
353
  }
330
- async function Pe(e) {
331
- if (g.value || !d.value) return !1;
332
- const a = e == null ? void 0 : T(e);
354
+ async function Ge() {
355
+ const e = S.value.length > 0, a = await Z([]);
356
+ return e && a && i("selectNone"), a;
357
+ }
358
+ async function Ve(e) {
359
+ if (g.value || !f.value) return !1;
360
+ const a = e == null ? void 0 : P(e);
333
361
  if (e != null && !a) return !1;
334
- const t = Y.value;
335
- p.value = (a == null ? void 0 : a.key) ?? null, s("update:currentRowKey", p.value), await $();
336
- const l = d.value && X.value === ((a == null ? void 0 : a.key) ?? null);
337
- return l && Y.value !== t && s("currentChange", Y.value, t), l;
362
+ const t = Q.value;
363
+ ae.value = (a == null ? void 0 : a.key) ?? null, i("update:currentRowKey", ae.value), await ee();
364
+ const n = f.value && L.value === ((a == null ? void 0 : a.key) ?? null);
365
+ return n && Q.value !== t && i("currentChange", Q.value, t), n;
338
366
  }
339
- function P(e) {
367
+ function I(e) {
340
368
  const a = h.value.get(e);
341
369
  if (!a) return;
342
370
  a.controller.abort(), W.delete(a.row);
343
371
  const t = new Map(h.value);
344
372
  t.delete(e), h.value = t;
345
373
  }
346
- async function xe(e, a = !1) {
374
+ async function Re(e, a = !1) {
347
375
  var u;
348
- const t = T(e), l = n.loadChildren;
349
- if (!t || !l || !n.treeMode || g.value || !d.value || h.value.has(t.token))
376
+ const t = P(e), n = l.loadChildren;
377
+ if (!t || !n || !l.treeMode || g.value || !f.value || h.value.has(t.token))
350
378
  return !1;
351
379
  if (!a && !t.lazy && x.value.has(t.token)) return !0;
352
380
  W.add(t.row);
353
381
  const o = { row: t.row, controller: new AbortController() };
354
382
  h.value = new Map(h.value).set(t.token, o);
355
- const r = new Map(C.value);
356
- r.delete(t.token), C.value = r;
383
+ const r = new Map(A.value);
384
+ r.delete(t.token), A.value = r;
357
385
  try {
358
- const c = await l(t.row, {
386
+ const c = await n(t.row, {
359
387
  signal: o.controller.signal,
360
388
  key: t.key,
361
389
  depth: t.depth
362
390
  });
363
- if (!d.value || o.controller.signal.aborted || h.value.get(t.token) !== o || ((u = f.value.map.get(t.token)) == null ? void 0 : u.row) !== t.row || n.loadChildren !== l)
391
+ if (!f.value || o.controller.signal.aborted || h.value.get(t.token) !== o || ((u = d.value.map.get(t.token)) == null ? void 0 : u.row) !== t.row || l.loadChildren !== n)
364
392
  return !1;
365
393
  if (!Array.isArray(c))
366
394
  throw new TypeError("loadChildren must return an array");
367
395
  return x.value = new Map(x.value).set(t.token, {
368
396
  row: t.row,
369
397
  rows: c
370
- }), s("load", t.row, c), !0;
398
+ }), i("load", t.row, c), !0;
371
399
  } catch (c) {
372
- return d.value && !o.controller.signal.aborted && h.value.get(t.token) === o && (C.value = new Map(C.value).set(t.token, c), s("loadError", t.row, c)), !1;
400
+ return f.value && !o.controller.signal.aborted && h.value.get(t.token) === o && (A.value = new Map(A.value).set(t.token, c), i("loadError", t.row, c)), !1;
373
401
  } finally {
374
402
  if (h.value.get(t.token) === o) {
375
403
  const c = new Map(h.value);
@@ -377,98 +405,102 @@ function Ge(n, b, ie, s) {
377
405
  }
378
406
  }
379
407
  }
380
- function me(e) {
408
+ function Ee(e) {
381
409
  var a;
382
- return ((a = n.rowExpandable) == null ? void 0 : a.call(n, e.row)) !== !1 && (e.children.length > 0 || e.lazy || !!n.expandable || ie());
410
+ return ((a = l.rowExpandable) == null ? void 0 : a.call(l, e.row)) !== !1 && (e.children.length > 0 || e.lazy || !!l.expandable || fe());
383
411
  }
384
- async function qe(e, a) {
412
+ async function Xe(e, a) {
385
413
  var r;
386
- const t = T(e);
387
- if (!t || !n.treeMode || g.value || !d.value || !Array.isArray(a))
414
+ const t = P(e);
415
+ if (!t || !l.treeMode || g.value || !f.value || !Array.isArray(a))
388
416
  return !1;
389
- P(t.token), W.add(t.row);
390
- const l = { row: t.row, rows: [...a], override: !0 };
391
- x.value = new Map(x.value).set(t.token, l);
392
- const o = new Map(C.value);
393
- return o.delete(t.token), C.value = o, await $(), !d.value || x.value.get(t.token) !== l || ((r = f.value.map.get(t.token)) == null ? void 0 : r.row) !== t.row ? !1 : (s("childrenChange", t.row, l.rows), !0);
417
+ I(t.token), W.add(t.row);
418
+ const n = { row: t.row, rows: [...a], override: !0 };
419
+ x.value = new Map(x.value).set(t.token, n);
420
+ const o = new Map(A.value);
421
+ return o.delete(t.token), A.value = o, await ee(), !f.value || x.value.get(t.token) !== n || ((r = d.value.map.get(t.token)) == null ? void 0 : r.row) !== t.row ? !1 : (i("childrenChange", t.row, n.rows), !0);
394
422
  }
395
- async function Ie(e, a) {
396
- const t = T(e);
397
- if (!t || !me(t) || g.value || !d.value) return !1;
398
- const l = a ?? !D.value.has(t.token), o = V.value.filter((u) => y(u) !== t.token);
399
- return l && o.push(t.key), fe.value = !0, ve.value = o, s("update:expandedRowKeys", o), await $(), d.value && D.value.has(t.token) === l ? (s("expandChange", t.row, l, V.value), l || P(t.token), !0) : !1;
423
+ async function De(e, a) {
424
+ const t = P(e);
425
+ if (!t || !Ee(t) || g.value || !f.value) return !1;
426
+ const n = a ?? !V.value.has(t.token), o = G.value.filter((u) => b(u) !== t.token);
427
+ return n && o.push(t.key), ge.value = !0, he.value = o, i("update:expandedRowKeys", o), await ee(), f.value && V.value.has(t.token) === n ? (i("expandChange", t.row, n, G.value), n || I(t.token), !0) : !1;
400
428
  }
401
- function Ce() {
402
- d.value = !1;
403
- for (const e of [...h.value.keys()]) P(e);
429
+ function ze() {
430
+ f.value = !1;
431
+ for (const e of [...h.value.keys()]) I(e);
404
432
  }
405
- return _(
406
- () => n.loadChildren,
433
+ return p(
434
+ () => l.loadChildren,
407
435
  () => {
408
- for (const e of [...h.value.keys()]) P(e);
409
- x.value = /* @__PURE__ */ new Map(), C.value = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new WeakSet();
436
+ for (const e of [...h.value.keys()]) I(e);
437
+ x.value = /* @__PURE__ */ new Map(), A.value = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new WeakSet();
410
438
  }
411
- ), _(g, (e) => {
412
- if (e) for (const a of [...h.value.keys()]) P(a);
413
- }), _(
414
- [V, () => f.value.all, () => h.value.size, d, g],
439
+ ), p(g, (e) => {
440
+ if (e) for (const a of [...h.value.keys()]) I(a);
441
+ }), p(
442
+ [G, () => d.value.all, () => h.value.size, f, g],
415
443
  () => {
416
444
  var a;
417
- if (!d.value || g.value) return;
445
+ if (!f.value || g.value) return;
418
446
  let e = Math.max(0, 4 - h.value.size);
419
- for (const t of f.value.all) {
447
+ for (const t of d.value.all) {
420
448
  if (!e) break;
421
- t.lazy && D.value.has(t.token) && !W.has(t.row) && !C.value.has(t.token) && ((a = n.rowExpandable) == null ? void 0 : a.call(n, t.row)) !== !1 && (e--, xe(t.key));
449
+ t.lazy && V.value.has(t.token) && !W.has(t.row) && !A.value.has(t.token) && ((a = l.rowExpandable) == null ? void 0 : a.call(l, t.row)) !== !1 && (e--, Re(t.key));
422
450
  }
423
451
  },
424
452
  { immediate: !0, flush: "post" }
425
- ), Ne(() => d.value = !0), We(Ce), Ve(Ce), {
426
- live: d,
453
+ ), Be(() => f.value = !0), He(ze), Ue(ze), {
454
+ live: f,
427
455
  busy: g,
428
- graph: f,
429
- rowId: te,
430
- selectedKeys: M,
431
- selectedSet: m,
432
- expandedKeys: V,
433
- expandedSet: D,
434
- halfSet: ae,
435
- eligible: R,
436
- allSelected: le,
437
- someSelected: ye,
438
- sorts: E,
439
- filters: F,
440
- processed: z,
441
- filteredRows: ke,
442
- display: Q,
443
- page: L,
444
- pageSize: B,
445
- total: de,
446
- pagination: J,
447
- currentKey: X,
448
- currentRow: Y,
449
- query: ge,
456
+ graph: d,
457
+ rowId: le,
458
+ selectedKeys: S,
459
+ selectedSet: k,
460
+ expandedKeys: G,
461
+ expandedSet: V,
462
+ halfSet: ue,
463
+ eligible: C,
464
+ allSelected: ie,
465
+ someSelected: Me,
466
+ selectionPage: O,
467
+ sorts: N,
468
+ filters: j,
469
+ processed: E,
470
+ filteredRows: Se,
471
+ display: J,
472
+ page: U,
473
+ pageSize: X,
474
+ pageCount: re,
475
+ paginationTotal: ke,
476
+ pagination: z,
477
+ currentKey: L,
478
+ currentRow: Q,
479
+ query: be,
450
480
  pending: h,
451
- loadErrors: C,
452
- canExpand: me,
453
- toggleSort: ze,
454
- setSort: Se,
455
- setFilter: Oe,
456
- clearFilter: Ee,
457
- requestPage: Ae,
458
- changeSize: Ke,
459
- toggleRowSelection: Fe,
460
- toggleAllSelection: Te,
461
- invertSelection: je,
462
- clearSelection: () => j([]),
463
- getSelectionRows: O,
464
- getHalfSelectionRows: () => f.value.all.filter((e) => ae.value.has(e.token)).map((e) => e.row),
465
- setCurrentRow: Pe,
466
- toggleRowExpansion: Ie,
467
- loadRow: xe,
468
- updateKeyChildren: qe,
469
- find: T
481
+ loadErrors: A,
482
+ canExpand: Ee,
483
+ nextSortOrder: me,
484
+ toggleSort: Te,
485
+ setSort: xe,
486
+ setFilter: Ne,
487
+ clearFilter: je,
488
+ requestPage: Ke,
489
+ changeSize: Fe,
490
+ toggleRowSelection: Ie,
491
+ toggleAllSelection: qe,
492
+ invertSelection: _e,
493
+ clearSelection: Ge,
494
+ selectPage: We,
495
+ getSelectionRows: K,
496
+ getHalfSelectionRows: () => d.value.all.filter((e) => ue.value.has(e.token)).map((e) => e.row),
497
+ setCurrentRow: Ve,
498
+ toggleRowExpansion: De,
499
+ loadRow: Re,
500
+ updateKeyChildren: Xe,
501
+ find: P
470
502
  };
471
503
  }
472
504
  export {
473
- Ge as useTable
505
+ Ze as useTable
474
506
  };