@vtable-guild/vtable-guild 2.9.0-alpha.9 → 3.0.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 (124) hide show
  1. package/css/index.css +114 -9
  2. package/css/presets/antdv.css +3 -0
  3. package/css/presets/element-plus.css +3 -0
  4. package/css/style.css +363 -17
  5. package/css/tailwind3-utilities.css +190 -6
  6. package/css/tailwind3.css +173 -11
  7. package/css/tailwind4.css +173 -11
  8. package/css/transitions.css +53 -2
  9. package/dist/core/src/utils/types.d.ts +3 -0
  10. package/dist/core/src/utils/types.d.ts.map +1 -1
  11. package/dist/css/index.css +114 -9
  12. package/dist/css/presets/antdv.css +3 -0
  13. package/dist/css/presets/element-plus.css +3 -0
  14. package/dist/css/style.css +363 -17
  15. package/dist/css/tailwind3-utilities.css +190 -6
  16. package/dist/css/tailwind3.css +173 -11
  17. package/dist/css/tailwind4.css +173 -11
  18. package/dist/css/transitions.css +53 -2
  19. package/dist/icons/src/EditOutlinedIcon.d.ts +3 -0
  20. package/dist/icons/src/EditOutlinedIcon.d.ts.map +1 -0
  21. package/dist/icons/src/EditOutlinedIcon.mjs +9 -0
  22. package/dist/icons/src/index.d.ts +1 -0
  23. package/dist/icons/src/index.d.ts.map +1 -1
  24. package/dist/index.full.mjs +8812 -7126
  25. package/dist/index.mjs +112 -106
  26. package/dist/table/src/components/Table.d.ts +1 -1
  27. package/dist/table/src/components/TableCell.d.ts.map +1 -1
  28. package/dist/table/src/components/TableCell.mjs +118 -147
  29. package/dist/table/src/components/TableEditFrame.d.ts +58 -0
  30. package/dist/table/src/components/TableEditFrame.d.ts.map +1 -0
  31. package/dist/table/src/components/TableEditFrame.mjs +127 -0
  32. package/dist/table/src/components/TableEditLayout.test.d.ts +2 -0
  33. package/dist/table/src/components/TableEditLayout.test.d.ts.map +1 -0
  34. package/dist/table/src/components/TableEditableCell.d.ts +46 -9
  35. package/dist/table/src/components/TableEditableCell.d.ts.map +1 -1
  36. package/dist/table/src/components/TableEditableCell.mjs +99 -22
  37. package/dist/table/src/components/TableLightFilter.d.ts.map +1 -1
  38. package/dist/table/src/components/TableLightFilter.mjs +53 -51
  39. package/dist/table/src/components/TableQuery.d.ts +6 -0
  40. package/dist/table/src/components/TableQuery.d.ts.map +1 -1
  41. package/dist/table/src/components/TableQuery.mjs +396 -225
  42. package/dist/table/src/components/TableQueryNative.test.d.ts +2 -0
  43. package/dist/table/src/components/TableQueryNative.test.d.ts.map +1 -0
  44. package/dist/table/src/components/TableSelectionAlert.d.ts +1 -1
  45. package/dist/table/src/components/TableSelectionAlert.d.ts.map +1 -1
  46. package/dist/table/src/components/TableSelectionAlert.mjs +109 -55
  47. package/dist/table/src/components/VTableEditCell.test.d.ts +2 -0
  48. package/dist/table/src/components/VTableEditCell.test.d.ts.map +1 -0
  49. package/dist/table/src/components/VTableEditCell.vue.d.ts +18 -3
  50. package/dist/table/src/components/VTableEditCell.vue.d.ts.map +1 -1
  51. package/dist/table/src/components/VTableEditCell.vue.mjs +172 -10
  52. package/dist/table/src/components/VTableEditShell.vue.d.ts +38 -0
  53. package/dist/table/src/components/VTableEditShell.vue.d.ts.map +1 -0
  54. package/dist/table/src/components/VTableEditShell.vue.mjs +37 -0
  55. package/dist/table/src/components/VTableEditShell.vue2.mjs +4 -0
  56. package/dist/table/src/components/VTableQuery.vue.mjs +12 -9
  57. package/dist/table/src/components/VirtualTableBody.mjs +24 -23
  58. package/dist/table/src/components/renderCellDisplay.d.ts +6 -0
  59. package/dist/table/src/components/renderCellDisplay.d.ts.map +1 -0
  60. package/dist/table/src/components/renderCellDisplay.mjs +37 -0
  61. package/dist/table/src/composables/useQueryCollapseMotion.d.ts +4 -0
  62. package/dist/table/src/composables/useQueryCollapseMotion.d.ts.map +1 -0
  63. package/dist/table/src/composables/useQueryCollapseMotion.mjs +48 -0
  64. package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts +2 -0
  65. package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts.map +1 -0
  66. package/dist/table/src/composables/useSelection.d.ts.map +1 -1
  67. package/dist/table/src/composables/useSelection.mjs +157 -148
  68. package/dist/table/src/composables/useTableEdit.d.ts +17 -0
  69. package/dist/table/src/composables/useTableEdit.d.ts.map +1 -1
  70. package/dist/table/src/composables/useTableEdit.mjs +326 -266
  71. package/dist/table/src/composables/useTableEditable.d.ts.map +1 -1
  72. package/dist/table/src/composables/useTableEditable.mjs +321 -89
  73. package/dist/table/src/controls.d.ts.map +1 -1
  74. package/dist/table/src/controls.mjs +161 -69
  75. package/dist/table/src/index.d.ts +2 -0
  76. package/dist/table/src/index.d.ts.map +1 -1
  77. package/dist/table/src/types/controls.d.ts +45 -2
  78. package/dist/table/src/types/controls.d.ts.map +1 -1
  79. package/dist/table/src/types/controls.mjs +4 -0
  80. package/dist/table/src/types/editable.d.ts +78 -4
  81. package/dist/table/src/types/editable.d.ts.map +1 -1
  82. package/dist/table/src/types/editable.typecheck.d.ts.map +1 -1
  83. package/dist/table/src/types/editing.d.ts +5 -2
  84. package/dist/table/src/types/editing.d.ts.map +1 -1
  85. package/dist/table/src/types/query-form.d.ts +11 -3
  86. package/dist/table/src/types/query-form.d.ts.map +1 -1
  87. package/dist/table/src/types/query-form.typecheck.d.ts +4 -0
  88. package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -1
  89. package/dist/table/src/types/table.d.ts +1 -0
  90. package/dist/table/src/types/table.d.ts.map +1 -1
  91. package/dist/table/src/utils/cell.d.ts +18 -12
  92. package/dist/table/src/utils/cell.d.ts.map +1 -1
  93. package/dist/table/src/utils/cell.mjs +95 -94
  94. package/dist/table/src/utils/draftEqual.d.ts +2 -0
  95. package/dist/table/src/utils/draftEqual.d.ts.map +1 -0
  96. package/dist/table/src/utils/draftEqual.mjs +22 -0
  97. package/dist/table/src/utils/queryInlineLayout.d.ts +22 -0
  98. package/dist/table/src/utils/queryInlineLayout.d.ts.map +1 -0
  99. package/dist/table/src/utils/queryInlineLayout.mjs +92 -0
  100. package/dist/table/src/utils/queryInlineLayout.test.d.ts +2 -0
  101. package/dist/table/src/utils/queryInlineLayout.test.d.ts.map +1 -0
  102. package/dist/table/src/utils/snapshot.d.ts +2 -0
  103. package/dist/table/src/utils/snapshot.d.ts.map +1 -1
  104. package/dist/table/src/utils/snapshot.mjs +18 -13
  105. package/dist/theme/src/presets/antdv/table-locale.d.ts +6 -0
  106. package/dist/theme/src/presets/antdv/table-locale.d.ts.map +1 -1
  107. package/dist/theme/src/presets/antdv/table-locale.mjs +16 -2
  108. package/dist/theme/src/presets/antdv/table.d.ts +18 -8
  109. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  110. package/dist/theme/src/presets/antdv/table.mjs +56 -12
  111. package/dist/theme/src/presets/element-plus/table-locale.d.ts +6 -0
  112. package/dist/theme/src/presets/element-plus/table-locale.d.ts.map +1 -1
  113. package/dist/theme/src/presets/element-plus/table-locale.mjs +16 -2
  114. package/dist/theme/src/presets/element-plus/table.d.ts +18 -8
  115. package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
  116. package/dist/theme/src/presets/element-plus/table.mjs +57 -10
  117. package/dist/theme/src/query.d.ts +4 -4
  118. package/dist/theme/src/query.mjs +1 -1
  119. package/dist/theme/src/selection-alert.d.ts +8 -0
  120. package/dist/theme/src/selection-alert.d.ts.map +1 -1
  121. package/dist/theme/src/selection-alert.mjs +2 -0
  122. package/dist/vtable-guild/src/index.d.ts +1 -1
  123. package/dist/vtable-guild/src/index.d.ts.map +1 -1
  124. package/package.json +2 -1
@@ -1,10 +1,10 @@
1
- import { ref as _, watch as P, computed as m } from "vue";
2
- function ne(w) {
3
- const { data: o, childrenColumnName: d, getRowKey: R } = w, b = [];
4
- let A = 0;
5
- function E(y, N, S) {
6
- y.forEach((u) => {
7
- const k = A, f = R(u, k), h = u[d], I = {
1
+ import { ref as Y, watch as P, computed as m } from "vue";
2
+ function oe(g) {
3
+ const { data: r, childrenColumnName: d, getRowKey: R } = g, b = [];
4
+ let x = 0;
5
+ function E(h, N, S) {
6
+ h.forEach((u) => {
7
+ const k = x, f = R(u, k), y = u[d], A = {
8
8
  key: f,
9
9
  record: u,
10
10
  index: k,
@@ -12,63 +12,63 @@ function ne(w) {
12
12
  parentKey: S?.key,
13
13
  childrenKeys: []
14
14
  };
15
- b.push(I), S?.childrenKeys.push(f), A += 1, Array.isArray(h) && h.length > 0 && E(h, N + 1, I);
15
+ b.push(A), S?.childrenKeys.push(f), x += 1, Array.isArray(y) && y.length > 0 && E(y, N + 1, A);
16
16
  });
17
17
  }
18
- return E(o, 0), b;
18
+ return E(r, 0), b;
19
19
  }
20
- const se = Object.freeze([]);
21
- function le(w) {
22
- return w.data.map((o, d) => ({
23
- key: w.getRowKey(o, d),
24
- record: o,
20
+ const ce = Object.freeze([]);
21
+ function re(g) {
22
+ return g.data.map((r, d) => ({
23
+ key: g.getRowKey(r, d),
24
+ record: r,
25
25
  index: d,
26
26
  level: 0,
27
- childrenKeys: se
27
+ childrenKeys: ce
28
28
  }));
29
29
  }
30
- function ce(w) {
31
- const { rowSelection: o, getRowKey: d, data: R, visibleData: b, childrenColumnName: A, onSelectionChange: E } = w, y = _(/* @__PURE__ */ new Set()), N = _(!1), S = _(null), u = /* @__PURE__ */ new Map();
30
+ function ae(g) {
31
+ const { rowSelection: r, getRowKey: d, data: R, visibleData: b, childrenColumnName: x, onSelectionChange: E } = g, h = Y(/* @__PURE__ */ new Set()), N = Y(!1), S = Y(null), u = /* @__PURE__ */ new Map();
32
32
  P(
33
- () => o()?.defaultSelectedRowKeys,
33
+ () => r()?.defaultSelectedRowKeys,
34
34
  (e) => {
35
- N.value || !e?.length || (y.value = new Set(e), N.value = !0);
35
+ N.value || !e?.length || (h.value = new Set(e), N.value = !0);
36
36
  },
37
37
  { immediate: !0 }
38
38
  );
39
39
  function k() {
40
- return o()?.selectedRowKeys !== void 0;
40
+ return r()?.selectedRowKeys !== void 0;
41
41
  }
42
42
  const f = m(() => {
43
- if (!o()) return [];
44
- const e = A?.() ?? "children";
43
+ if (!r()) return [];
44
+ const e = x?.() ?? "children";
45
45
  return R().some((n) => {
46
46
  const s = n[e];
47
47
  return Array.isArray(s) && s.length > 0;
48
- }) ? ne({
48
+ }) ? oe({
49
49
  data: R(),
50
50
  childrenColumnName: e,
51
51
  getRowKey: d
52
- }) : le({
52
+ }) : re({
53
53
  data: R(),
54
54
  getRowKey: d
55
55
  });
56
- }), h = m(() => {
56
+ }), y = m(() => {
57
57
  const e = /* @__PURE__ */ new Map();
58
58
  return f.value.forEach((t) => e.set(t.key, t)), e;
59
59
  });
60
60
  P(
61
61
  [
62
62
  f,
63
- () => o()?.preserveSelectedRowKeys,
64
- () => o()?.selectedRowKeys
63
+ () => r()?.preserveSelectedRowKeys,
64
+ () => r()?.selectedRowKeys
65
65
  ],
66
66
  () => {
67
- if (!o()?.preserveSelectedRowKeys) {
67
+ if (!r()?.preserveSelectedRowKeys) {
68
68
  u.clear();
69
69
  return;
70
70
  }
71
- const e = new Set(o()?.selectedRowKeys ?? y.value);
71
+ const e = new Set(r()?.selectedRowKeys ?? h.value);
72
72
  for (const t of u.keys()) e.has(t) || u.delete(t);
73
73
  for (const t of f.value)
74
74
  e.has(t.key) && u.set(t.key, t.record);
@@ -80,215 +80,224 @@ function ce(w) {
80
80
  S.value = null;
81
81
  }
82
82
  );
83
- const I = m(
83
+ const A = m(
84
84
  () => f.value.filter((e) => e.parentKey === void 0).map((e) => e.key)
85
85
  );
86
86
  function v(e) {
87
- return o()?.getCheckboxProps?.(e)?.disabled ?? !1;
87
+ return r()?.getCheckboxProps?.(e)?.disabled ?? !1;
88
88
  }
89
- function j(e) {
90
- return h.value.get(e)?.childrenKeys ?? [];
89
+ function _(e) {
90
+ return y.value.get(e)?.childrenKeys ?? [];
91
91
  }
92
92
  const L = m(() => {
93
- const e = h.value, t = /* @__PURE__ */ new Map(), n = f.value;
93
+ const e = y.value, t = /* @__PURE__ */ new Map(), n = f.value;
94
94
  for (let s = n.length - 1; s >= 0; s -= 1) {
95
- const l = n[s], c = [];
96
- for (const r of l.childrenKeys) {
97
- const a = e.get(r);
98
- if (!a || v(a.record)) continue;
99
- c.push(r);
100
- const i = t.get(r);
101
- i && c.push(...i);
95
+ const o = n[s], c = [];
96
+ for (const l of o.childrenKeys) {
97
+ const i = e.get(l);
98
+ if (!i || v(i.record)) continue;
99
+ c.push(l);
100
+ const a = t.get(l);
101
+ a && c.push(...a);
102
102
  }
103
- t.set(l.key, c);
103
+ t.set(o.key, c);
104
104
  }
105
105
  return t;
106
106
  });
107
- function V(e) {
108
- if (o()?.checkStrictly !== !1)
107
+ function j(e) {
108
+ if (r()?.checkStrictly !== !1)
109
109
  return new Set(e);
110
110
  const t = new Set(e), n = (s) => {
111
- const l = j(s);
112
- l.forEach(n);
113
- const c = h.value.get(s);
111
+ const o = _(s);
112
+ o.forEach(n);
113
+ const c = y.value.get(s);
114
114
  if (!c || v(c.record)) return;
115
- const r = l.map((i) => h.value.get(i)).filter((i) => !!i && !v(i.record));
116
- if (r.length === 0) return;
117
- r.every((i) => t.has(i.key)) ? t.add(s) : t.delete(s);
115
+ const l = o.map((a) => y.value.get(a)).filter((a) => !!a && !v(a.record));
116
+ if (l.length === 0) return;
117
+ l.every((a) => t.has(a.key)) ? t.add(s) : t.delete(s);
118
118
  };
119
- return I.value.forEach(n), t;
119
+ return A.value.forEach(n), t;
120
120
  }
121
- const g = m(() => {
122
- const e = o(), t = e?.selectedRowKeys !== void 0 ? new Set(e.selectedRowKeys) : y.value;
123
- return V(t);
121
+ const w = m(() => {
122
+ const e = r(), t = e?.selectedRowKeys !== void 0 ? new Set(e.selectedRowKeys) : h.value;
123
+ return j(t);
124
124
  });
125
125
  P(
126
- [f, () => o()?.preserveSelectedRowKeys],
126
+ [f, () => r()?.preserveSelectedRowKeys],
127
127
  () => {
128
- if (k() || o()?.preserveSelectedRowKeys || y.value.size === 0) return;
128
+ if (k() || r()?.preserveSelectedRowKeys || h.value.size === 0) return;
129
129
  const e = new Set(f.value.map((n) => n.key)), t = new Set(
130
- Array.from(y.value).filter((n) => e.has(n))
130
+ Array.from(h.value).filter((n) => e.has(n))
131
131
  );
132
- t.size !== y.value.size && (y.value = t);
132
+ t.size !== h.value.size && (h.value = t);
133
133
  },
134
134
  { immediate: !0 }
135
135
  );
136
- function z(e) {
137
- return g.value.has(e);
136
+ function I(e) {
137
+ return w.value.has(e);
138
138
  }
139
- function p(e) {
140
- const t = f.value.filter((n) => e.has(n.key)).map((n) => n.record);
141
- if (o()?.preserveSelectedRowKeys)
142
- for (const n of e)
143
- !h.value.has(n) && u.has(n) && t.push(u.get(n));
139
+ function O(e) {
140
+ const t = [], n = y.value, s = r()?.preserveSelectedRowKeys;
141
+ for (const o of e) {
142
+ const c = n.get(o)?.record ?? (s ? u.get(o) : void 0);
143
+ c !== void 0 && t.push(c);
144
+ }
144
145
  return t;
145
146
  }
146
- function O() {
147
- return b().map((e, t) => h.value.get(d(e, t)) ?? null).filter((e) => e !== null);
147
+ function q() {
148
+ return b().map((e, t) => y.value.get(d(e, t)) ?? null).filter((e) => e !== null);
148
149
  }
149
- function M() {
150
- return O().filter((e) => !v(e.record));
150
+ function z() {
151
+ return q().filter((e) => !v(e.record));
151
152
  }
152
- function q() {
153
+ function F() {
153
154
  return f.value.filter((e) => !v(e.record));
154
155
  }
155
156
  function B(e = !1) {
156
- return w.paginate?.() && !e ? M() : q();
157
+ return g.paginate?.() && !e ? z() : F();
157
158
  }
158
- function F(e, t) {
159
- const n = d(e, t), s = z(n), l = v(e);
160
- if (o()?.checkStrictly !== !1)
159
+ function G(e, t) {
160
+ const n = d(e, t), s = I(n), o = v(e);
161
+ if (r()?.checkStrictly !== !1)
161
162
  return {
162
163
  checked: s,
163
164
  indeterminate: !1,
164
- disabled: l
165
+ disabled: o
165
166
  };
166
167
  const c = L.value.get(n) ?? [];
167
168
  if (c.length === 0)
168
169
  return {
169
170
  checked: s,
170
171
  indeterminate: !1,
171
- disabled: l
172
+ disabled: o
172
173
  };
173
- const r = c.filter((a) => g.value.has(a)).length;
174
+ const l = c.filter((i) => w.value.has(i)).length;
174
175
  return {
175
176
  checked: s,
176
- indeterminate: r > 0 && r < c.length,
177
- disabled: l
177
+ indeterminate: l > 0 && l < c.length,
178
+ disabled: o
178
179
  };
179
180
  }
180
181
  function K(e, t) {
181
- const n = V(e);
182
- if (o()?.preserveSelectedRowKeys) {
182
+ const n = j(e);
183
+ if (r()?.preserveSelectedRowKeys) {
183
184
  if (!k())
184
- for (const s of u.keys())
185
- n.has(s) || u.delete(s);
186
- for (const s of f.value)
187
- n.has(s.key) && u.set(s.key, s.record);
188
- }
189
- k() || (y.value = n);
190
- {
191
- const s = Array.from(n), l = p(n);
192
- o()?.onChange?.(s, l), E?.();
185
+ for (const c of u.keys())
186
+ n.has(c) || u.delete(c);
187
+ for (const c of f.value)
188
+ n.has(c.key) && u.set(c.key, c.record);
193
189
  }
190
+ k() || (h.value = n);
191
+ const s = Array.from(n), o = O(n);
192
+ return r()?.onChange?.(s, o), E?.(), { keys: s, rows: o };
194
193
  }
195
- function Y(e, t, n, s) {
196
- const l = h.value.get(e);
197
- if (!l || v(l.record)) return;
194
+ function V(e, t, n, s) {
195
+ const o = y.value.get(e);
196
+ if (!o || v(o.record)) return;
198
197
  const c = t.has(e);
199
- n ? t.add(e) : t.delete(e), c !== n && s.push(l.record), j(e).forEach(
200
- (r) => Y(r, t, n, s)
198
+ n ? t.add(e) : t.delete(e), c !== n && s.push(o.record), _(e).forEach(
199
+ (l) => V(l, t, n, s)
201
200
  );
202
201
  }
203
- function G(e, t, n) {
204
- const s = o();
202
+ function J(e, t, n) {
203
+ const s = r();
205
204
  if (!s) return;
206
- const l = d(e, t), c = !z(l);
207
- if (s.type !== "radio" && n?.shiftKey && S.value !== null && o()?.checkStrictly !== !1) {
208
- const a = M(), i = a.findIndex((C) => C.key === l), D = a.findIndex(
205
+ const o = d(e, t), c = !I(o);
206
+ if (s.type !== "radio" && n?.shiftKey && S.value !== null && r()?.checkStrictly !== !1) {
207
+ const a = z(), p = a.findIndex((C) => C.key === o), M = a.findIndex(
209
208
  (C) => C.key === S.value
210
209
  );
211
- if (i !== -1 && D !== -1) {
212
- const [C, ee] = i > D ? [D, i] : [i, D], x = new Set(g.value), H = [];
213
- a.slice(C, ee + 1).forEach((T) => {
214
- const te = x.has(T.key);
215
- c ? x.add(T.key) : x.delete(T.key), te !== c && H.push(T.record);
216
- }), K(x), s.onSelectMultiple?.(c, p(x), H), S.value = l;
210
+ if (p !== -1 && M !== -1) {
211
+ const [C, te] = p > M ? [M, p] : [p, M], D = new Set(w.value), H = [];
212
+ a.slice(C, te + 1).forEach((T) => {
213
+ const se = D.has(T.key);
214
+ c ? D.add(T.key) : D.delete(T.key), se !== c && H.push(T.record);
215
+ });
216
+ const { rows: ne } = K(D);
217
+ s.onSelectMultiple?.(c, ne, H), S.value = o;
217
218
  return;
218
219
  }
219
220
  }
220
221
  if (s.type === "radio") {
221
- const a = c ? /* @__PURE__ */ new Set([l]) : /* @__PURE__ */ new Set();
222
- K(a), s.onSelect?.(e, c, p(a)), S.value = l;
222
+ const a = c ? /* @__PURE__ */ new Set([o]) : /* @__PURE__ */ new Set(), { rows: p } = K(a);
223
+ s.onSelect?.(e, c, p), S.value = o;
223
224
  return;
224
225
  }
225
- const r = new Set(g.value);
226
- c ? r.add(l) : r.delete(l), K(r), s.onSelect?.(e, c, p(r)), S.value = l;
226
+ const l = new Set(w.value);
227
+ c ? l.add(o) : l.delete(o);
228
+ const { rows: i } = K(l);
229
+ s.onSelect?.(e, c, i), S.value = o;
227
230
  }
228
- function J(e, t) {
229
- const n = o();
231
+ function Q(e, t) {
232
+ const n = r();
230
233
  if (!n) return;
231
- const s = d(e, t), l = !z(s), c = new Set(g.value);
232
- Y(s, c, l, []), K(c), n.onSelect?.(e, l, p(c)), S.value = s;
234
+ const s = d(e, t), o = !I(s), c = new Set(w.value);
235
+ V(s, c, o, []);
236
+ const { rows: i } = K(c);
237
+ n.onSelect?.(e, o, i), S.value = s;
233
238
  }
234
- function Q(e, t, n) {
239
+ function U(e, t, n) {
235
240
  if (v(e)) return;
236
- const s = o();
241
+ const s = r();
237
242
  if (s) {
238
243
  if (s.checkStrictly === !1 && s.type !== "radio") {
239
- J(e, t);
244
+ Q(e, t);
240
245
  return;
241
246
  }
242
- G(e, t, n);
247
+ J(e, t, n);
243
248
  }
244
249
  }
245
- function U(e, t = !1) {
246
- const n = o();
250
+ function W(e, t = !1) {
251
+ const n = r();
247
252
  if (!n) return;
248
- const s = B(t), l = new Set(g.value), c = [];
249
- s.forEach((r) => {
253
+ const s = B(t), o = new Set(w.value), c = [];
254
+ s.forEach((i) => {
250
255
  if (n.checkStrictly === !1) {
251
- Y(r.key, l, e, c);
256
+ V(i.key, o, e, c);
252
257
  return;
253
258
  }
254
- const a = l.has(r.key);
255
- e ? l.add(r.key) : l.delete(r.key), a !== e && c.push(r.record);
256
- }), K(l), n.onSelectAll?.(e, p(l), c);
259
+ const a = o.has(i.key);
260
+ e ? o.add(i.key) : o.delete(i.key), a !== e && c.push(i.record);
261
+ });
262
+ const { rows: l } = K(o);
263
+ n.onSelectAll?.(e, l, c);
257
264
  }
258
- const W = m(() => {
265
+ const X = m(() => {
259
266
  const e = B();
260
267
  if (e.length === 0) return "none";
261
- const t = e.filter((n) => g.value.has(n.key)).length;
268
+ const t = e.filter((n) => w.value.has(n.key)).length;
262
269
  return t === 0 ? "none" : t === e.length ? "all" : "partial";
263
270
  });
264
- function X() {
265
- const e = o();
271
+ function Z() {
272
+ const e = r();
266
273
  if (!e) return;
267
- const t = M(), n = new Set(g.value);
268
- t.forEach((s) => {
269
- n.has(s.key) ? n.delete(s.key) : n.add(s.key);
270
- }), K(n), e.onSelectInvert?.(Array.from(V(n)));
274
+ const t = z(), n = new Set(w.value);
275
+ t.forEach((o) => {
276
+ n.has(o.key) ? n.delete(o.key) : n.add(o.key);
277
+ });
278
+ const { keys: s } = K(n);
279
+ e.onSelectInvert?.(s);
271
280
  }
272
- function Z() {
273
- const e = o();
281
+ function $() {
282
+ const e = r();
274
283
  e && (K(/* @__PURE__ */ new Set()), e.onSelectNone?.());
275
284
  }
276
- function $() {
277
- return M().map((e) => e.key);
285
+ function ee() {
286
+ return z().map((e) => e.key);
278
287
  }
279
288
  return {
280
- selectedKeySet: g,
281
- isSelected: z,
289
+ selectedKeySet: w,
290
+ isSelected: I,
282
291
  isDisabled: v,
283
- getSelectionState: F,
284
- toggleRow: Q,
285
- toggleAll: U,
286
- allCheckedState: W,
287
- invertSelection: X,
288
- clearSelection: Z,
289
- getChangeableRowKeys: $
292
+ getSelectionState: G,
293
+ toggleRow: U,
294
+ toggleAll: W,
295
+ allCheckedState: X,
296
+ invertSelection: Z,
297
+ clearSelection: $,
298
+ getChangeableRowKeys: ee
290
299
  };
291
300
  }
292
301
  export {
293
- ce as useSelection
302
+ ae as useSelection
294
303
  };
@@ -1,4 +1,21 @@
1
+ import { Key } from '../types/column';
1
2
  import { UseTableEditOptions, UseTableEditReturn } from '../types/editing';
3
+ type RowValidator<T extends object> = NonNullable<UseTableEditOptions<T>['validate']>;
4
+ interface CellValidation<T extends object> {
5
+ /** Validate the active column's rules. */
6
+ validate: RowValidator<T>;
7
+ validateRemaining: RowValidator<T>;
8
+ validateRow?: RowValidator<T>;
9
+ }
2
10
  /** Row drafts and validation without coupling the table to a form or HTTP library. */
3
11
  export declare function useTableEdit<TRecord extends object>(options: UseTableEditOptions<TRecord>): UseTableEditReturn<TRecord>;
12
+ /** Internal row engine shared with column editing. Public row saves always request full validation. */
13
+ export declare function createTableEdit<TRecord extends object>(options: UseTableEditOptions<TRecord>): Omit<UseTableEditReturn<TRecord>, 'save' | 'start'> & {
14
+ getDraftRevision: (key: Key) => number | undefined;
15
+ /** The stored snapshot itself, for read-only rendering without a clone per call. */
16
+ peekOriginal: (key: Key) => TRecord | undefined;
17
+ start: (record: TRecord, acceptDraft?: (draft: TRecord) => boolean) => boolean;
18
+ save: (key: Key, cell?: CellValidation<TRecord>) => Promise<TRecord | undefined>;
19
+ };
20
+ export {};
4
21
  //# sourceMappingURL=useTableEdit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEdit.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableEdit.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAKV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAiBzB,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,EACjD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACpC,kBAAkB,CAAC,OAAO,CAAC,CAwiB7B"}
1
+ {"version":3,"file":"useTableEdit.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableEdit.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,EAMV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAsBzB,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;AAErF,UAAU,cAAc,CAAC,CAAC,SAAS,MAAM;IACvC,0CAA0C;IAC1C,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IACzB,iBAAiB,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAClC,WAAW,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAC9B;AAeD,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,EACjD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACpC,kBAAkB,CAAC,OAAO,CAAC,CAO7B;AAED,uGAAuG;AACvG,wBAAgB,eAAe,CAAC,OAAO,SAAS,MAAM,EACpD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACpC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG;IACvD,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,SAAS,CAAA;IAClD,oFAAoF;IACpF,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,GAAG,SAAS,CAAA;IAC/C,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,KAAK,OAAO,CAAA;IAC9E,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;CACjF,CA2mBA"}