@vtable-guild/vtable-guild 2.8.1 → 2.9.0-alpha.1

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 (227) hide show
  1. package/css/presets/antdv.css +26 -0
  2. package/css/presets/element-plus.css +26 -0
  3. package/css/style.css +403 -0
  4. package/css/tailwind3-utilities.css +351 -0
  5. package/css/tailwind3.css +52 -0
  6. package/css/tailwind4.css +52 -0
  7. package/dist/core/src/components/Tooltip.d.ts +1 -1
  8. package/dist/core/src/components/Tooltip.d.ts.map +1 -1
  9. package/dist/core/src/components/Tooltip.mjs +49 -46
  10. package/dist/core/src/components/Tooltip.test.d.ts +2 -0
  11. package/dist/core/src/components/Tooltip.test.d.ts.map +1 -0
  12. package/dist/core/src/index.d.ts +1 -1
  13. package/dist/core/src/index.d.ts.map +1 -1
  14. package/dist/core/src/utils/types.d.ts +44 -1
  15. package/dist/core/src/utils/types.d.ts.map +1 -1
  16. package/dist/css/presets/antdv.css +26 -0
  17. package/dist/css/presets/element-plus.css +26 -0
  18. package/dist/css/style.css +403 -0
  19. package/dist/css/tailwind3-utilities.css +351 -0
  20. package/dist/css/tailwind3.css +52 -0
  21. package/dist/css/tailwind4.css +52 -0
  22. package/dist/icons/src/ColumnHeightOutlinedIcon.d.ts +3 -0
  23. package/dist/icons/src/ColumnHeightOutlinedIcon.d.ts.map +1 -0
  24. package/dist/icons/src/ColumnHeightOutlinedIcon.mjs +9 -0
  25. package/dist/icons/src/FullscreenExitOutlinedIcon.d.ts +3 -0
  26. package/dist/icons/src/FullscreenExitOutlinedIcon.d.ts.map +1 -0
  27. package/dist/icons/src/FullscreenExitOutlinedIcon.mjs +9 -0
  28. package/dist/icons/src/FullscreenOutlinedIcon.d.ts +3 -0
  29. package/dist/icons/src/FullscreenOutlinedIcon.d.ts.map +1 -0
  30. package/dist/icons/src/FullscreenOutlinedIcon.mjs +9 -0
  31. package/dist/icons/src/ReloadOutlinedIcon.d.ts +3 -0
  32. package/dist/icons/src/ReloadOutlinedIcon.d.ts.map +1 -0
  33. package/dist/icons/src/ReloadOutlinedIcon.mjs +9 -0
  34. package/dist/icons/src/SettingOutlinedIcon.d.ts +3 -0
  35. package/dist/icons/src/SettingOutlinedIcon.d.ts.map +1 -0
  36. package/dist/icons/src/SettingOutlinedIcon.mjs +9 -0
  37. package/dist/icons/src/index.d.ts +5 -0
  38. package/dist/icons/src/index.d.ts.map +1 -1
  39. package/dist/index.full.mjs +6374 -4134
  40. package/dist/index.mjs +125 -91
  41. package/dist/table/src/components/ExpandIcon.d.ts +18 -0
  42. package/dist/table/src/components/ExpandIcon.d.ts.map +1 -1
  43. package/dist/table/src/components/ExpandIcon.mjs +47 -17
  44. package/dist/table/src/components/FilterDropdown.d.ts +2 -2
  45. package/dist/table/src/components/Table.d.ts +69 -4
  46. package/dist/table/src/components/Table.d.ts.map +1 -1
  47. package/dist/table/src/components/Table.mjs +759 -628
  48. package/dist/table/src/components/TableBody.d.ts.map +1 -1
  49. package/dist/table/src/components/TableBody.mjs +41 -37
  50. package/dist/table/src/components/TableCell.d.ts.map +1 -1
  51. package/dist/table/src/components/TableCell.mjs +115 -95
  52. package/dist/table/src/components/TableColumnSettings.d.ts +41 -0
  53. package/dist/table/src/components/TableColumnSettings.d.ts.map +1 -0
  54. package/dist/table/src/components/TableColumnSettings.mjs +360 -0
  55. package/dist/table/src/components/TableColumnSettings.test.d.ts +2 -0
  56. package/dist/table/src/components/TableColumnSettings.test.d.ts.map +1 -0
  57. package/dist/table/src/components/TableCopyButton.d.ts +41 -0
  58. package/dist/table/src/components/TableCopyButton.d.ts.map +1 -0
  59. package/dist/table/src/components/TableCopyButton.mjs +94 -0
  60. package/dist/table/src/components/TableEnterprise.test.d.ts +2 -0
  61. package/dist/table/src/components/TableEnterprise.test.d.ts.map +1 -0
  62. package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
  63. package/dist/table/src/components/TableHeaderCell.mjs +284 -241
  64. package/dist/table/src/components/TableInstance.test.d.ts +2 -0
  65. package/dist/table/src/components/TableInstance.test.d.ts.map +1 -0
  66. package/dist/table/src/components/TableLazyTree.test.d.ts +2 -0
  67. package/dist/table/src/components/TableLazyTree.test.d.ts.map +1 -0
  68. package/dist/table/src/components/TableSelectionAlert.d.ts +50 -0
  69. package/dist/table/src/components/TableSelectionAlert.d.ts.map +1 -0
  70. package/dist/table/src/components/TableSelectionAlert.mjs +86 -0
  71. package/dist/table/src/components/TableSelectionAlert.test.d.ts +2 -0
  72. package/dist/table/src/components/TableSelectionAlert.test.d.ts.map +1 -0
  73. package/dist/table/src/components/TableToolbar.d.ts +87 -0
  74. package/dist/table/src/components/TableToolbar.d.ts.map +1 -0
  75. package/dist/table/src/components/TableToolbar.mjs +265 -0
  76. package/dist/table/src/components/TableToolbar.test.d.ts +2 -0
  77. package/dist/table/src/components/TableToolbar.test.d.ts.map +1 -0
  78. package/dist/table/src/components/VTable.vue.d.ts +5 -1
  79. package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
  80. package/dist/table/src/components/VTable.vue.mjs +56 -35
  81. package/dist/table/src/components/VTableColumnSettings.vue.d.ts +20 -0
  82. package/dist/table/src/components/VTableColumnSettings.vue.d.ts.map +1 -0
  83. package/dist/table/src/components/VTableColumnSettings.vue.mjs +42 -0
  84. package/dist/table/src/components/VTableColumnSettings.vue2.mjs +4 -0
  85. package/dist/table/src/components/VTableSelectionAlert.vue.d.ts +19 -0
  86. package/dist/table/src/components/VTableSelectionAlert.vue.d.ts.map +1 -0
  87. package/dist/table/src/components/VTableSelectionAlert.vue.mjs +54 -0
  88. package/dist/table/src/components/VTableSelectionAlert.vue2.mjs +4 -0
  89. package/dist/table/src/components/VTableToolbar.vue.d.ts +27 -0
  90. package/dist/table/src/components/VTableToolbar.vue.d.ts.map +1 -0
  91. package/dist/table/src/components/VTableToolbar.vue.mjs +108 -0
  92. package/dist/table/src/components/VTableToolbar.vue2.mjs +4 -0
  93. package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
  94. package/dist/table/src/components/VirtualTableBody.mjs +128 -115
  95. package/dist/table/src/composables/useColumnState.d.ts +32 -0
  96. package/dist/table/src/composables/useColumnState.d.ts.map +1 -0
  97. package/dist/table/src/composables/useColumnState.mjs +107 -0
  98. package/dist/table/src/composables/useColumnState.test.d.ts +2 -0
  99. package/dist/table/src/composables/useColumnState.test.d.ts.map +1 -0
  100. package/dist/table/src/composables/useFilter.d.ts.map +1 -1
  101. package/dist/table/src/composables/useFilter.mjs +28 -25
  102. package/dist/table/src/composables/useLazyTreeData.d.ts +19 -0
  103. package/dist/table/src/composables/useLazyTreeData.d.ts.map +1 -0
  104. package/dist/table/src/composables/useLazyTreeData.mjs +123 -0
  105. package/dist/table/src/composables/useLazyTreeData.test.d.ts +2 -0
  106. package/dist/table/src/composables/useLazyTreeData.test.d.ts.map +1 -0
  107. package/dist/table/src/composables/usePagination.d.ts +1 -0
  108. package/dist/table/src/composables/usePagination.d.ts.map +1 -1
  109. package/dist/table/src/composables/usePagination.mjs +35 -34
  110. package/dist/table/src/composables/useTableEdit.d.ts +4 -0
  111. package/dist/table/src/composables/useTableEdit.d.ts.map +1 -0
  112. package/dist/table/src/composables/useTableEdit.mjs +183 -0
  113. package/dist/table/src/composables/useTableEdit.test.d.ts +2 -0
  114. package/dist/table/src/composables/useTableEdit.test.d.ts.map +1 -0
  115. package/dist/table/src/composables/useTableQuery.d.ts +4 -0
  116. package/dist/table/src/composables/useTableQuery.d.ts.map +1 -0
  117. package/dist/table/src/composables/useTableQuery.mjs +54 -0
  118. package/dist/table/src/composables/useTableQuery.test.d.ts +2 -0
  119. package/dist/table/src/composables/useTableQuery.test.d.ts.map +1 -0
  120. package/dist/table/src/composables/useTableRequest.d.ts +4 -0
  121. package/dist/table/src/composables/useTableRequest.d.ts.map +1 -0
  122. package/dist/table/src/composables/useTableRequest.mjs +126 -0
  123. package/dist/table/src/composables/useTableRequest.test.d.ts +2 -0
  124. package/dist/table/src/composables/useTableRequest.test.d.ts.map +1 -0
  125. package/dist/table/src/composables/useTreeData.d.ts +2 -0
  126. package/dist/table/src/composables/useTreeData.d.ts.map +1 -1
  127. package/dist/table/src/composables/useTreeData.mjs +46 -51
  128. package/dist/table/src/context.d.ts +16 -2
  129. package/dist/table/src/context.d.ts.map +1 -1
  130. package/dist/table/src/index.d.ts +34 -2
  131. package/dist/table/src/index.d.ts.map +1 -1
  132. package/dist/table/src/renderers.d.ts +5 -0
  133. package/dist/table/src/renderers.d.ts.map +1 -0
  134. package/dist/table/src/renderers.mjs +52 -0
  135. package/dist/table/src/renderers.test.d.ts +2 -0
  136. package/dist/table/src/renderers.test.d.ts.map +1 -0
  137. package/dist/table/src/types/column-settings.d.ts +31 -0
  138. package/dist/table/src/types/column-settings.d.ts.map +1 -0
  139. package/dist/table/src/types/column-state.typecheck.d.ts +2 -0
  140. package/dist/table/src/types/column-state.typecheck.d.ts.map +1 -0
  141. package/dist/table/src/types/column.d.ts +20 -4
  142. package/dist/table/src/types/column.d.ts.map +1 -1
  143. package/dist/table/src/types/editing.d.ts +53 -0
  144. package/dist/table/src/types/editing.d.ts.map +1 -0
  145. package/dist/table/src/types/editing.typecheck.d.ts +11 -0
  146. package/dist/table/src/types/editing.typecheck.d.ts.map +1 -0
  147. package/dist/table/src/types/index.d.ts +7 -0
  148. package/dist/table/src/types/index.d.ts.map +1 -1
  149. package/dist/table/src/types/instance.d.ts +18 -0
  150. package/dist/table/src/types/instance.d.ts.map +1 -0
  151. package/dist/table/src/types/instance.typecheck.d.ts +3 -0
  152. package/dist/table/src/types/instance.typecheck.d.ts.map +1 -0
  153. package/dist/table/src/types/presentation.d.ts +24 -0
  154. package/dist/table/src/types/presentation.d.ts.map +1 -0
  155. package/dist/table/src/types/query.d.ts +36 -0
  156. package/dist/table/src/types/query.d.ts.map +1 -0
  157. package/dist/table/src/types/query.typecheck.d.ts +14 -0
  158. package/dist/table/src/types/query.typecheck.d.ts.map +1 -0
  159. package/dist/table/src/types/renderers.d.ts +37 -0
  160. package/dist/table/src/types/renderers.d.ts.map +1 -0
  161. package/dist/table/src/types/renderers.typecheck.d.ts +13 -0
  162. package/dist/table/src/types/renderers.typecheck.d.ts.map +1 -0
  163. package/dist/table/src/types/request.d.ts +65 -0
  164. package/dist/table/src/types/request.d.ts.map +1 -0
  165. package/dist/table/src/types/request.typecheck.d.ts +13 -0
  166. package/dist/table/src/types/request.typecheck.d.ts.map +1 -0
  167. package/dist/table/src/types/selection-alert.d.ts +30 -0
  168. package/dist/table/src/types/selection-alert.d.ts.map +1 -0
  169. package/dist/table/src/types/selection-alert.typecheck.d.ts +12 -0
  170. package/dist/table/src/types/selection-alert.typecheck.d.ts.map +1 -0
  171. package/dist/table/src/types/table.d.ts +20 -1
  172. package/dist/table/src/types/table.d.ts.map +1 -1
  173. package/dist/table/src/types/toolbar.d.ts +58 -0
  174. package/dist/table/src/types/toolbar.d.ts.map +1 -0
  175. package/dist/table/src/types/tree.d.ts +5 -0
  176. package/dist/table/src/types/tree.d.ts.map +1 -0
  177. package/dist/table/src/utils/cell.d.ts +8 -0
  178. package/dist/table/src/utils/cell.d.ts.map +1 -1
  179. package/dist/table/src/utils/cell.mjs +86 -53
  180. package/dist/table/src/utils/columnSettings.d.ts +22 -0
  181. package/dist/table/src/utils/columnSettings.d.ts.map +1 -0
  182. package/dist/table/src/utils/columnSettings.mjs +107 -0
  183. package/dist/table/src/utils/columnSettings.test.d.ts +2 -0
  184. package/dist/table/src/utils/columnSettings.test.d.ts.map +1 -0
  185. package/dist/table/src/utils/manual.d.ts +3 -0
  186. package/dist/table/src/utils/manual.d.ts.map +1 -0
  187. package/dist/table/src/utils/manual.mjs +6 -0
  188. package/dist/table/src/utils/snapshot.d.ts +3 -0
  189. package/dist/table/src/utils/snapshot.d.ts.map +1 -0
  190. package/dist/table/src/utils/snapshot.mjs +30 -0
  191. package/dist/table/src/utils/snapshot.test.d.ts +2 -0
  192. package/dist/table/src/utils/snapshot.test.d.ts.map +1 -0
  193. package/dist/table/src/utils/valueEnum.d.ts +7 -0
  194. package/dist/table/src/utils/valueEnum.d.ts.map +1 -0
  195. package/dist/table/src/utils/valueEnum.mjs +23 -0
  196. package/dist/theme/src/augment.d.ts +4 -0
  197. package/dist/theme/src/augment.d.ts.map +1 -1
  198. package/dist/theme/src/column-settings.d.ts +160 -0
  199. package/dist/theme/src/column-settings.d.ts.map +1 -0
  200. package/dist/theme/src/column-settings.mjs +84 -0
  201. package/dist/theme/src/index.d.ts +12 -0
  202. package/dist/theme/src/index.d.ts.map +1 -1
  203. package/dist/theme/src/presets/antdv/table-locale.d.ts +20 -0
  204. package/dist/theme/src/presets/antdv/table-locale.d.ts.map +1 -1
  205. package/dist/theme/src/presets/antdv/table-locale.mjs +4 -0
  206. package/dist/theme/src/presets/antdv/table.d.ts +7 -0
  207. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  208. package/dist/theme/src/presets/antdv/table.mjs +7 -0
  209. package/dist/theme/src/presets/element-plus/table-locale.d.ts +20 -0
  210. package/dist/theme/src/presets/element-plus/table-locale.d.ts.map +1 -1
  211. package/dist/theme/src/presets/element-plus/table-locale.mjs +4 -0
  212. package/dist/theme/src/presets/element-plus/table.d.ts +7 -0
  213. package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
  214. package/dist/theme/src/presets/element-plus/table.mjs +7 -0
  215. package/dist/theme/src/presets/index.d.ts.map +1 -1
  216. package/dist/theme/src/presets/index.mjs +100 -67
  217. package/dist/theme/src/presets/types.d.ts +3 -0
  218. package/dist/theme/src/presets/types.d.ts.map +1 -1
  219. package/dist/theme/src/selection-alert.d.ts +54 -0
  220. package/dist/theme/src/selection-alert.d.ts.map +1 -0
  221. package/dist/theme/src/selection-alert.mjs +36 -0
  222. package/dist/theme/src/toolbar.d.ts +105 -0
  223. package/dist/theme/src/toolbar.d.ts.map +1 -0
  224. package/dist/theme/src/toolbar.mjs +57 -0
  225. package/dist/vtable-guild/src/augment.d.ts +4 -1
  226. package/dist/vtable-guild/src/augment.d.ts.map +1 -1
  227. package/package.json +1 -1
@@ -0,0 +1,123 @@
1
+ import { shallowRef as p, computed as M, watch as S, getCurrentScope as L, onScopeDispose as C } from "vue";
2
+ function T(n) {
3
+ const s = p(/* @__PURE__ */ new Map()), i = p(/* @__PURE__ */ new Map()), y = p(/* @__PURE__ */ new Set()), c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new WeakMap();
4
+ let g = !1;
5
+ const o = M(() => n.childrenColumnName() ?? "children"), h = M(() => {
6
+ const e = /* @__PURE__ */ new Map();
7
+ let r = 0;
8
+ function t(a) {
9
+ for (const u of a) {
10
+ const d = n.getRowKey(u, r++);
11
+ e.set(d, u);
12
+ const v = s.value.get(d), l = u[o.value] ?? (v?.record === u ? v.children : void 0);
13
+ Array.isArray(l) && t(l);
14
+ }
15
+ }
16
+ return n.loadData() && t(n.data()), e;
17
+ });
18
+ function w(e, r = !0) {
19
+ const t = c.get(e);
20
+ r && (t?.controller.abort(), t?.resolve(!1)), c.delete(e), y.value = new Set([...y.value].filter((a) => a !== e));
21
+ }
22
+ let D = h.value;
23
+ S(
24
+ h,
25
+ (e) => {
26
+ const r = new Map(s.value);
27
+ for (const [t, a] of r)
28
+ (e.get(t) !== a.record || Array.isArray(a.record[o.value])) && r.delete(t);
29
+ r.size !== s.value.size && (s.value = r);
30
+ for (const [t, a] of c)
31
+ (e.get(t) !== a.record || Array.isArray(a.record[o.value])) && w(t);
32
+ i.value = new Map(
33
+ [...i.value].filter(([t]) => {
34
+ const a = e.get(t);
35
+ return a !== void 0 && a === D.get(t) && !Array.isArray(a[o.value]);
36
+ })
37
+ ), D = e;
38
+ },
39
+ { flush: "sync" }
40
+ );
41
+ const b = M(() => {
42
+ if (!n.loadData()) return n.data();
43
+ let e = 0;
44
+ function r(t) {
45
+ return t.map((a) => {
46
+ const u = n.getRowKey(a, e++), d = s.value.get(u), v = a[o.value] ?? (d?.record === a ? d.children : void 0);
47
+ if (!Array.isArray(v)) return a;
48
+ const l = { ...a, [o.value]: r(v) };
49
+ return m.set(l, a), l;
50
+ });
51
+ }
52
+ return r(n.data());
53
+ });
54
+ function A(e) {
55
+ const r = e[o.value];
56
+ return Array.isArray(r) ? r.length > 0 : !!n.loadData() && n.isLeaf()?.(m.get(e) ?? e) !== !0;
57
+ }
58
+ function x(e, r) {
59
+ const t = m.get(e) ?? e, a = n.getRowKey(t, r);
60
+ return g || !n.loadData() || !A(e) ? Promise.resolve(!1) : P(t, a);
61
+ }
62
+ function P(e, r) {
63
+ if (Array.isArray(e[o.value]) || s.value.get(r)?.record === e)
64
+ return Promise.resolve(!0);
65
+ const t = c.get(r);
66
+ if (t) return t.promise;
67
+ const a = new AbortController(), u = n.loadData();
68
+ let d;
69
+ const v = new Promise((f) => {
70
+ d = f;
71
+ }), l = { record: e, controller: a, promise: Promise.resolve(!1), resolve: d };
72
+ c.set(r, l), y.value = /* @__PURE__ */ new Set([...y.value, r]);
73
+ const E = new Map(i.value);
74
+ E.delete(r), i.value = E;
75
+ const K = Promise.resolve().then(async () => {
76
+ if (g || a.signal.aborted || c.get(r) !== l) return !1;
77
+ try {
78
+ const f = await u(e, { signal: a.signal });
79
+ if (g || a.signal.aborted || h.value.get(r) !== e || Array.isArray(e[o.value]))
80
+ return !1;
81
+ if (!Array.isArray(f)) throw new Error("Tree loadData must return an array");
82
+ return s.value = new Map(s.value).set(r, { record: e, children: f }), !0;
83
+ } catch (f) {
84
+ if (g || a.signal.aborted || h.value.get(r) !== e) return !1;
85
+ const R = f instanceof Error ? f : new Error(String(f));
86
+ i.value = new Map(i.value).set(r, R);
87
+ try {
88
+ Promise.resolve(n.onLoadError?.(R, e)).catch(() => {
89
+ });
90
+ } catch {
91
+ }
92
+ return !1;
93
+ } finally {
94
+ c.get(r) === l && w(r, !1);
95
+ }
96
+ });
97
+ return l.promise = Promise.race([K, v]), l.promise;
98
+ }
99
+ return S(
100
+ [n.loadData, o],
101
+ () => {
102
+ for (const e of c.keys()) w(e);
103
+ s.value = /* @__PURE__ */ new Map(), i.value = /* @__PURE__ */ new Map();
104
+ },
105
+ { flush: "sync" }
106
+ ), L() && C(() => {
107
+ g = !0;
108
+ for (const e of c.keys()) w(e);
109
+ }), {
110
+ data: b,
111
+ hasChildren: A,
112
+ load: x,
113
+ isLoading: (e) => y.value.has(e),
114
+ getError: (e) => i.value.get(e),
115
+ retry(e) {
116
+ const r = h.value.get(e);
117
+ return r && !g && n.loadData() && A(r) ? P(r, e) : Promise.resolve(!1);
118
+ }
119
+ };
120
+ }
121
+ export {
122
+ T as useLazyTreeData
123
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useLazyTreeData.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLazyTreeData.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useLazyTreeData.test.ts"],"names":[],"mappings":""}
@@ -3,6 +3,7 @@ export declare function positiveInteger(value: unknown, fallback: number): numbe
3
3
  export declare function usePagination<T>(options: {
4
4
  pagination: () => false | TablePaginationConfig | undefined;
5
5
  data: () => T[];
6
+ manual?: () => boolean;
6
7
  onChange: (state: TablePaginationState) => void;
7
8
  }): {
8
9
  enabled: import('vue').ComputedRef<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/usePagination.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAEtF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE;IACxC,UAAU,EAAE,MAAM,KAAK,GAAG,qBAAqB,GAAG,SAAS,CAAA;IAC3D,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAA;CAChD;;;;;sBAsE0B,MAAM;0BAeJ,oBAAoB,GAAG,SAAS;EAQ5D"}
1
+ {"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/usePagination.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAEtF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE;IACxC,UAAU,EAAE,MAAM,KAAK,GAAG,qBAAqB,GAAG,SAAS,CAAA;IAC3D,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,OAAO,CAAA;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAA;CAChD;;;;;sBA4E0B,MAAM;0BAeJ,oBAAoB,GAAG,SAAS;EAQ5D"}
@@ -1,65 +1,66 @@
1
- import { computed as g, ref as p, watch as f } from "vue";
2
- function o(r, u) {
3
- return typeof r == "number" && Number.isSafeInteger(r) && r > 0 ? r : u;
1
+ import { computed as f, ref as h, watch as s } from "vue";
2
+ function c(u, r) {
3
+ return typeof u == "number" && Number.isSafeInteger(u) && u > 0 ? u : r;
4
4
  }
5
- function C(r) {
6
- const u = g(() => !!r.pagination()), l = g(() => r.pagination() || {}), c = p(1), v = p(10);
7
- let d = !1;
8
- f(
9
- u,
5
+ function x(u) {
6
+ const r = f(() => !!u.pagination()), l = f(() => u.pagination() || {}), o = h(1), v = h(10);
7
+ let m = !1;
8
+ s(
9
+ r,
10
10
  (e) => {
11
- !e || d || (d = !0, v.value = o(l.value.defaultPageSize, 10), c.value = o(l.value.defaultCurrent, 1));
11
+ !e || m || (m = !0, v.value = c(l.value.defaultPageSize, 10), o.value = c(l.value.defaultCurrent, 1));
12
12
  },
13
13
  { immediate: !0, flush: "sync" }
14
14
  );
15
- const i = g(() => {
16
- const e = l.value, n = o(e.pageSize, v.value), t = o(e.total, r.data().length);
15
+ const i = f(() => {
16
+ const e = l.value, n = c(e.pageSize, v.value), t = u.manual?.() && typeof e.total == "number" && Number.isSafeInteger(e.total) && e.total >= 0 ? e.total : c(e.total, u.data().length);
17
17
  return { current: Math.min(
18
- o(e.current, c.value),
18
+ c(e.current, o.value),
19
19
  Math.max(1, Math.ceil(t / n))
20
20
  ), pageSize: n, total: t };
21
21
  });
22
- f(
22
+ s(
23
23
  () => i.value.current,
24
24
  (e) => {
25
- u.value && l.value.current === void 0 && (c.value = e);
25
+ r.value && l.value.current === void 0 && (o.value = e);
26
26
  },
27
27
  { flush: "sync" }
28
28
  );
29
- const m = g(() => {
30
- const e = r.data();
31
- if (!u.value) return e;
29
+ const p = f(() => {
30
+ const e = u.data();
31
+ if (!r.value || u.manual?.()) return e;
32
32
  const { current: n, pageSize: t, total: a } = i.value;
33
33
  return e.length < a && e.length <= t ? e : e.slice((n - 1) * t, n * t);
34
34
  });
35
- f(
36
- () => [u.value, r.data().length, i.value.total, i.value.pageSize],
35
+ s(
36
+ () => [r.value, u.data().length, i.value.total, i.value.pageSize],
37
37
  ([e, n, t, a]) => {
38
+ e && !u.manual?.() && n < t && n > a;
38
39
  },
39
40
  { immediate: !0 }
40
41
  );
41
- function h(e, n, t) {
42
+ function d(e, n, t) {
42
43
  const a = l.value;
43
- a.current === void 0 && (c.value = e), a.pageSize === void 0 && (v.value = n), a["onUpdate:current"]?.(e), t && (a["onUpdate:pageSize"]?.(n), a.onShowSizeChange?.(e, n)), a.onChange?.(e, n);
44
+ a.current === void 0 && (o.value = e), a.pageSize === void 0 && (v.value = n), a["onUpdate:current"]?.(e), t && (a["onUpdate:pageSize"]?.(n), a.onShowSizeChange?.(e, n)), a.onChange?.(e, n);
44
45
  }
45
- function z(e, n = i.value.pageSize) {
46
- if (!u.value || l.value.disabled) return;
47
- const t = i.value, a = o(n, t.pageSize), s = Math.min(
48
- o(e, t.current),
46
+ function S(e, n = i.value.pageSize) {
47
+ if (!r.value || l.value.disabled) return;
48
+ const t = i.value, a = c(n, t.pageSize), g = Math.min(
49
+ c(e, t.current),
49
50
  Math.max(1, Math.ceil(t.total / a))
50
51
  );
51
- if (s === t.current && a === t.pageSize) return;
52
- const M = { current: s, pageSize: a, total: t.total };
53
- h(s, a, a !== t.pageSize), r.onChange(M);
52
+ if (g === t.current && a === t.pageSize) return;
53
+ const b = { current: g, pageSize: a, total: t.total };
54
+ d(g, a, a !== t.pageSize), u.onChange(b);
54
55
  }
55
- function S() {
56
- if (!u.value) return;
56
+ function z() {
57
+ if (!r.value) return;
57
58
  const e = { ...i.value, current: 1 };
58
- return h(1, e.pageSize, !1), e;
59
+ return d(1, e.pageSize, !1), e;
59
60
  }
60
- return { enabled: u, config: l, state: i, pageData: m, change: z, resetForFilter: S };
61
+ return { enabled: r, config: l, state: i, pageData: p, change: S, resetForFilter: z };
61
62
  }
62
63
  export {
63
- o as positiveInteger,
64
- C as usePagination
64
+ c as positiveInteger,
65
+ x as usePagination
65
66
  };
@@ -0,0 +1,4 @@
1
+ import { UseTableEditOptions, UseTableEditReturn } from '../types/editing';
2
+ /** Row drafts and validation without coupling the table to a form or HTTP library. */
3
+ export declare function useTableEdit<TRecord extends object>(options: UseTableEditOptions<TRecord>): UseTableEditReturn<TRecord>;
4
+ //# sourceMappingURL=useTableEdit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableEdit.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableEdit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAezB,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,EACjD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACpC,kBAAkB,CAAC,OAAO,CAAC,CA8O7B"}
@@ -0,0 +1,183 @@
1
+ import { shallowRef as x, getCurrentScope as O, onScopeDispose as V, computed as M } from "vue";
2
+ import { snapshot as B } from "../utils/snapshot.mjs";
3
+ function H(u) {
4
+ const r = x(/* @__PURE__ */ new Map()), g = x(/* @__PURE__ */ new Map()), c = x(/* @__PURE__ */ new Map()), s = x(/* @__PURE__ */ new Map()), a = u.clone ?? ((e) => B(e));
5
+ let d = !1;
6
+ function E(e) {
7
+ const t = typeof u.rowKey == "function" ? u.rowKey(e) : e[u.rowKey];
8
+ if (typeof t != "string" && typeof t != "number")
9
+ throw new Error("useTableEdit requires a string or number row key");
10
+ return t;
11
+ }
12
+ function p(e) {
13
+ if (!g.value.has(e)) return;
14
+ const t = new Map(g.value);
15
+ t.delete(e), g.value = t;
16
+ }
17
+ function P(e, t) {
18
+ g.value = new Map(g.value).set(e, t);
19
+ try {
20
+ u.onError?.(t, e);
21
+ } catch {
22
+ }
23
+ }
24
+ function S(e) {
25
+ const t = c.value.get(e);
26
+ if (!t) return;
27
+ t.controller.abort();
28
+ const n = new Map(c.value);
29
+ n.delete(e), c.value = n, t.resolve(void 0);
30
+ }
31
+ function N(e) {
32
+ const t = s.value.get(e);
33
+ if (!t) return;
34
+ t.controller.abort();
35
+ const n = new Map(s.value);
36
+ n.delete(e), s.value = n, t.resolve(!1);
37
+ }
38
+ function K(e) {
39
+ S(e), N(e);
40
+ const t = new Map(r.value);
41
+ t.delete(e), r.value = t, p(e);
42
+ }
43
+ function y(e) {
44
+ const t = s.value.get(e);
45
+ if (t) return t.promise;
46
+ const n = r.value.get(e);
47
+ if (d || !n) return Promise.resolve(!1);
48
+ if (S(e), p(e), !u.onCancel)
49
+ return K(e), Promise.resolve(!0);
50
+ let v;
51
+ const m = new Promise((o) => {
52
+ v = o;
53
+ }), i = { controller: new AbortController(), promise: m, resolve: v };
54
+ s.value = new Map(s.value).set(e, i);
55
+ const f = () => !d && s.value.get(e) === i;
56
+ return (async () => {
57
+ try {
58
+ const o = await u.onCancel(a(n.draft), {
59
+ key: e,
60
+ original: n.original === void 0 ? void 0 : a(n.original),
61
+ isNew: n.isNew,
62
+ signal: i.controller.signal
63
+ });
64
+ if (!f() || o === !1) return;
65
+ i.resolve(!0), K(e);
66
+ } catch (o) {
67
+ if (!f()) return;
68
+ const b = {
69
+ type: "cancel",
70
+ message: o instanceof Error ? o.message : String(o),
71
+ cause: o
72
+ };
73
+ P(e, b);
74
+ } finally {
75
+ if (f()) {
76
+ const o = new Map(s.value);
77
+ o.delete(e), s.value = o;
78
+ }
79
+ i.resolve(!1);
80
+ }
81
+ })(), m;
82
+ }
83
+ function T() {
84
+ return Promise.all([...r.value.keys()].map(y));
85
+ }
86
+ function A(e, t) {
87
+ if (d) return !1;
88
+ const n = E(e);
89
+ return r.value.has(n) || u.mode !== "multiple" && r.value.size > 0 ? !1 : (r.value = new Map(r.value).set(n, {
90
+ draft: a(e),
91
+ original: t ? void 0 : a(e),
92
+ isNew: t
93
+ }), !0);
94
+ }
95
+ function j(e, t) {
96
+ const n = r.value.get(e);
97
+ if (d || !n) return !1;
98
+ const v = typeof t == "function" ? t(a(n.draft)) : { ...a(n.draft), ...t };
99
+ if (E(v) !== e) throw new Error("Editing a row key is unsupported");
100
+ return S(e), N(e), p(e), r.value = new Map(r.value).set(e, { ...n, draft: a(v) }), !0;
101
+ }
102
+ function q(e) {
103
+ const t = c.value.get(e);
104
+ if (t) return t.promise;
105
+ const n = r.value.get(e);
106
+ if (d || !n || s.value.has(e)) return Promise.resolve(void 0);
107
+ p(e);
108
+ let v;
109
+ const m = new Promise((w) => {
110
+ v = w;
111
+ }), i = { controller: new AbortController(), promise: m, resolve: v };
112
+ c.value = new Map(c.value).set(e, i);
113
+ const f = () => !d && c.value.get(e) === i, o = {
114
+ key: e,
115
+ original: n.original === void 0 ? void 0 : a(n.original),
116
+ isNew: n.isNew,
117
+ signal: i.controller.signal
118
+ }, b = (w) => {
119
+ f() && P(e, w);
120
+ };
121
+ return (async () => {
122
+ let w = "validation";
123
+ try {
124
+ const l = a(n.draft), h = await u.validate?.(a(l), o);
125
+ if (!f()) return;
126
+ if (h?.message || Object.keys(h?.fields ?? {}).length > 0) {
127
+ b({
128
+ ...h,
129
+ type: "validation",
130
+ message: h?.message ?? "Validation failed"
131
+ });
132
+ return;
133
+ }
134
+ w = "save";
135
+ const C = await u.onSave?.(a(l), o);
136
+ if (!f() || C === !1) return;
137
+ const D = C === !0 ? l : C ?? l;
138
+ if (!n.isNew && E(D) !== e)
139
+ throw new Error("Saving an existing row cannot change its key");
140
+ const z = a(D), R = new Map(r.value);
141
+ R.delete(e), r.value = R, p(e), i.resolve(z);
142
+ } catch (l) {
143
+ b({
144
+ type: w,
145
+ message: l instanceof Error ? l.message : String(l),
146
+ cause: l
147
+ });
148
+ } finally {
149
+ if (f()) {
150
+ const l = new Map(c.value);
151
+ l.delete(e), c.value = l;
152
+ }
153
+ i.resolve(void 0);
154
+ }
155
+ })(), m;
156
+ }
157
+ return O() && V(() => {
158
+ d = !0;
159
+ for (const e of r.value.keys()) K(e);
160
+ }), {
161
+ editableKeys: M(() => [...r.value.keys()]),
162
+ savingKeys: M(() => new Set(c.value.keys())),
163
+ cancellingKeys: M(() => new Set(s.value.keys())),
164
+ errors: M(() => new Map(g.value)),
165
+ newRecords: M(
166
+ () => [...r.value.values()].filter((e) => e.isNew).map((e) => a(e.draft))
167
+ ),
168
+ isEditing: (e) => r.value.has(e),
169
+ getDraft: (e) => {
170
+ const t = r.value.get(e);
171
+ return t ? a(t.draft) : void 0;
172
+ },
173
+ start: (e) => A(e, !1),
174
+ add: (e) => A(e, !0),
175
+ setDraft: j,
176
+ save: q,
177
+ cancel: y,
178
+ cancelAll: T
179
+ };
180
+ }
181
+ export {
182
+ H as useTableEdit
183
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useTableEdit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableEdit.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableEdit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { UseTableQueryOptions, UseTableQueryReturn } from '../types/query';
2
+ /** Form state and submit protocol; controls and layout remain owned by the host UI library. */
3
+ export declare function useTableQuery<TValues extends object, TParams extends object = TValues>(options: UseTableQueryOptions<TValues, TParams>): UseTableQueryReturn<TValues, TParams>;
4
+ //# sourceMappingURL=useTableQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableQuery.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAG/E,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,GAAG,OAAO,EACpF,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,GAC9C,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAsFvC"}
@@ -0,0 +1,54 @@
1
+ import { ref as y, shallowRef as g, watch as O, getCurrentScope as S, onScopeDispose as j, computed as h } from "vue";
2
+ import { snapshot as e } from "../utils/snapshot.mjs";
3
+ function R(a) {
4
+ const d = e(a.defaultValues), c = y(e(d)), v = g(), p = g(), f = a.collapsed ?? y(a.defaultCollapsed ?? !0), i = y(!1), b = g(null);
5
+ let o = 0, l = !1;
6
+ const k = a.onCollapse ? O(f, (r) => a.onCollapse?.(r), { flush: "sync" }) : void 0;
7
+ function w(r) {
8
+ const s = a.fieldTransforms, t = {};
9
+ for (const [n, m] of Object.entries(r))
10
+ Object.prototype.hasOwnProperty.call(s ?? {}, n) && s?.[n] || (t[n] = m);
11
+ for (const n of Object.keys(s ?? {})) {
12
+ const m = s?.[n];
13
+ m && Object.assign(t, m(r[n], r));
14
+ }
15
+ const u = t;
16
+ return e(a.transform?.(u, r) ?? u);
17
+ }
18
+ async function C(r) {
19
+ if (l) return !1;
20
+ const s = ++o;
21
+ i.value = !0, b.value = null;
22
+ try {
23
+ const t = e(c.value), u = w(t);
24
+ return v.value = e(t), p.value = e(u), await (r ? a.onReset ?? a.onSubmit : a.onSubmit)?.(e(u), e(t)), !l && s === o;
25
+ } catch (t) {
26
+ return !l && s === o && (b.value = t instanceof Error ? t : new Error(String(t))), !1;
27
+ } finally {
28
+ !l && s === o && (i.value = !1);
29
+ }
30
+ }
31
+ return S() && j(() => {
32
+ l = !0, o++, i.value = !1, k?.();
33
+ }), {
34
+ draft: c,
35
+ submitted: h(() => v.value && e(v.value)),
36
+ params: h(() => p.value && e(p.value)),
37
+ collapsed: f,
38
+ submitting: h(() => i.value),
39
+ error: b,
40
+ submit: () => C(!1),
41
+ reset() {
42
+ return l ? Promise.resolve(!1) : (c.value = e(d), C(!0));
43
+ },
44
+ resetFields() {
45
+ l || (c.value = e(d));
46
+ },
47
+ toggleCollapsed() {
48
+ f.value = !f.value;
49
+ }
50
+ };
51
+ }
52
+ export {
53
+ R as useTableQuery
54
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useTableQuery.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableQuery.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableQuery.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { UseTableRequestOptions, UseTableRequestReturn } from '../types/request';
2
+ /** Optional server request orchestration. Bind onChange once and pass manual to VTable. */
3
+ export declare function useTableRequest<TRecord extends object, TParams extends object = Record<string, unknown>>(options: UseTableRequestOptions<TRecord, TParams>): UseTableRequestReturn<TRecord, TParams>;
4
+ //# sourceMappingURL=useTableRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableRequest.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;AAsCzB,2FAA2F;AAC3F,wBAAgB,eAAe,CAC7B,OAAO,SAAS,MAAM,EACtB,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChD,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAyL5F"}
@@ -0,0 +1,126 @@
1
+ import { shallowRef as w, ref as D, toValue as I, watch as J, getCurrentScope as Q, onScopeDispose as U, computed as S } from "vue";
2
+ import { positiveInteger as M } from "./usePagination.mjs";
3
+ import { snapshot as l } from "../utils/snapshot.mjs";
4
+ function W(e, t, r = /* @__PURE__ */ new WeakMap()) {
5
+ if (Object.is(e, t)) return !0;
6
+ if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
7
+ if (!e || !t || typeof e != "object" || typeof t != "object" || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) || Object.getPrototypeOf(e) !== Object.prototype && !Array.isArray(e)) return !1;
8
+ if (r.get(e)?.has(t)) return !0;
9
+ const n = r.get(e) ?? /* @__PURE__ */ new WeakSet();
10
+ r.set(e, n), n.add(t);
11
+ const f = Object.entries(e), o = Object.entries(t);
12
+ return f.length === o.length && f.every(
13
+ ([c, P]) => Object.prototype.hasOwnProperty.call(t, c) && W(P, Reflect.get(t, c), r)
14
+ );
15
+ }
16
+ function X(e) {
17
+ const t = [];
18
+ for (const r of Array.isArray(e) ? e : [e]) {
19
+ if (!r.order) continue;
20
+ const n = r.field ?? r.columnKey;
21
+ n != null && t.push([Array.isArray(n) ? n.join(".") : String(n), r.order]);
22
+ }
23
+ return Object.fromEntries(t);
24
+ }
25
+ function $(e) {
26
+ const t = l(e.defaultParams ?? {}), r = w(l(t)), n = w({}), f = w({}), o = D(M(e.initialPagination?.current, 1)), c = D(M(e.initialPagination?.pageSize, 10)), P = D(Math.max(0, e.initialPagination?.total ?? 0)), F = w([]), O = D(!1), g = w(null), B = Object.freeze({ sort: !0, filter: !0, pagination: !0 });
27
+ let j = !1, y = 0, h, z, A, d, C = Promise.resolve();
28
+ function E() {
29
+ y++, h !== void 0 && clearTimeout(h), h = void 0, z?.abort(), z = void 0, A?.(), A = void 0, O.value = !1, d = void 0;
30
+ }
31
+ function m(i = !1, x = !1) {
32
+ if (j) return Promise.resolve();
33
+ let a;
34
+ try {
35
+ const s = l({ ...t, ...r.value, ...I(e.params) });
36
+ a = {
37
+ ...e.beforeSearchSubmit?.(s) ?? s,
38
+ current: o.value,
39
+ pageSize: c.value
40
+ };
41
+ } catch (s) {
42
+ return E(), g.value = s instanceof Error ? s : new Error(String(s)), e.onError?.(g.value), Promise.resolve();
43
+ }
44
+ const p = l(n.value), b = l(f.value), L = l({ params: a, sort: p, filters: b });
45
+ if (!i && d !== void 0 && W(d, L)) return C;
46
+ E(), d = L;
47
+ const R = y, T = new AbortController();
48
+ return z = T, O.value = !0, g.value = null, C = new Promise((s) => {
49
+ A = s;
50
+ const N = async () => {
51
+ h = void 0;
52
+ try {
53
+ for (let v = 0; v < 2; v++) {
54
+ const u = await e.request(a, p, b, { signal: T.signal });
55
+ if (j || R !== y || T.signal.aborted) return;
56
+ if (u.success === !1) throw new Error("Table request was unsuccessful");
57
+ if (!Array.isArray(u.data))
58
+ throw new Error("Table request data must be an array");
59
+ if (!Number.isSafeInteger(u.total) || u.total < 0)
60
+ throw new Error("Table request total must be a non-negative safe integer");
61
+ const q = Math.max(1, Math.ceil(u.total / a.pageSize));
62
+ if (v === 0 && u.total > 0 && a.current > q) {
63
+ o.value = q, a = { ...a, current: q };
64
+ continue;
65
+ }
66
+ const k = e.postData ? e.postData(u.data) : u.data;
67
+ if (!Array.isArray(k)) throw new Error("Table postData must return an array");
68
+ o.value = Math.min(a.current, q), P.value = u.total, F.value = k, d = l({ params: { ...a, current: o.value }, sort: p, filters: b }), e.onLoad?.(k, u);
69
+ break;
70
+ }
71
+ } catch (v) {
72
+ !j && R === y && !T.signal.aborted && (g.value = v instanceof Error ? v : new Error(String(v)), d = void 0, e.onError?.(g.value));
73
+ } finally {
74
+ R === y && (O.value = !1, z = void 0, A = void 0), s();
75
+ }
76
+ }, V = x ? 0 : Math.max(0, e.debounceTime ?? 0);
77
+ V > 0 ? h = setTimeout(() => {
78
+ N();
79
+ }, V) : N();
80
+ }), C;
81
+ }
82
+ const G = (i, x, a) => {
83
+ if (a.action === "select") return;
84
+ const p = M(a.pagination?.pageSize, c.value), b = p !== c.value;
85
+ n.value = X(x), f.value = l(i), o.value = a.action !== "paginate" || b && e.resetOnPageSizeChange !== !1 ? 1 : M(a.pagination?.current, o.value), c.value = p, m();
86
+ };
87
+ let K = l(I(e.params));
88
+ const H = J(
89
+ () => I(e.params),
90
+ (i) => {
91
+ W(K, i) || (K = l(i), o.value = 1, m());
92
+ },
93
+ { deep: !0 }
94
+ );
95
+ return Q() && U(() => {
96
+ j = !0, H(), E();
97
+ }), e.manualRequest || m(), {
98
+ dataSource: F,
99
+ loading: S(() => O.value),
100
+ error: g,
101
+ pagination: S(() => ({
102
+ ...e.pagination,
103
+ current: o.value,
104
+ pageSize: c.value,
105
+ total: P.value
106
+ })),
107
+ query: S(() => r.value),
108
+ sort: S(() => n.value),
109
+ filters: S(() => f.value),
110
+ manual: B,
111
+ onChange: G,
112
+ reload(i = !1) {
113
+ return i && (o.value = 1), m(!0, !0);
114
+ },
115
+ submit(i = {}) {
116
+ return r.value = l(i), o.value = 1, m(!0);
117
+ },
118
+ reset(i = t) {
119
+ return r.value = l(i), n.value = {}, f.value = {}, o.value = 1, m(!0);
120
+ },
121
+ cancel: E
122
+ };
123
+ }
124
+ export {
125
+ $ as useTableRequest
126
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useTableRequest.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableRequest.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableRequest.test.ts"],"names":[],"mappings":""}