@vtable-guild/vtable-guild 2.6.4 → 2.7.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 (59) hide show
  1. package/css/presets/antdv.css +2 -0
  2. package/css/presets/element-plus.css +2 -0
  3. package/css/style.css +19 -0
  4. package/css/tailwind3-utilities.css +15 -0
  5. package/css/tailwind3.css +4 -0
  6. package/css/tailwind4.css +4 -0
  7. package/dist/css/presets/antdv.css +2 -0
  8. package/dist/css/presets/element-plus.css +2 -0
  9. package/dist/css/style.css +19 -0
  10. package/dist/css/tailwind3-utilities.css +15 -0
  11. package/dist/css/tailwind3.css +4 -0
  12. package/dist/css/tailwind4.css +4 -0
  13. package/dist/index.full.mjs +3291 -2998
  14. package/dist/index.mjs +22 -19
  15. package/dist/table/src/components/ExpandedRowTr.d.ts +90 -0
  16. package/dist/table/src/components/ExpandedRowTr.d.ts.map +1 -0
  17. package/dist/table/src/components/ExpandedRowTr.mjs +61 -0
  18. package/dist/table/src/components/Table.d.ts +23 -3
  19. package/dist/table/src/components/Table.d.ts.map +1 -1
  20. package/dist/table/src/components/Table.mjs +355 -324
  21. package/dist/table/src/components/TableBody.d.ts.map +1 -1
  22. package/dist/table/src/components/TableBody.mjs +67 -58
  23. package/dist/table/src/components/VTable.vue.d.ts +4 -3
  24. package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
  25. package/dist/table/src/components/VTable.vue.mjs +43 -37
  26. package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
  27. package/dist/table/src/components/VirtualTableBody.mjs +151 -141
  28. package/dist/table/src/composables/index.d.ts +3 -0
  29. package/dist/table/src/composables/index.d.ts.map +1 -1
  30. package/dist/table/src/composables/useColumnDisplay.d.ts +26 -0
  31. package/dist/table/src/composables/useColumnDisplay.d.ts.map +1 -0
  32. package/dist/table/src/composables/useColumnDisplay.mjs +46 -0
  33. package/dist/table/src/composables/useColumnDisplay.test.d.ts +2 -0
  34. package/dist/table/src/composables/useColumnDisplay.test.d.ts.map +1 -0
  35. package/dist/table/src/composables/useRowDragSort.d.ts +79 -0
  36. package/dist/table/src/composables/useRowDragSort.d.ts.map +1 -0
  37. package/dist/table/src/composables/useRowDragSort.mjs +146 -0
  38. package/dist/table/src/composables/useRowDragSort.test.d.ts +2 -0
  39. package/dist/table/src/composables/useRowDragSort.test.d.ts.map +1 -0
  40. package/dist/table/src/context.d.ts +14 -0
  41. package/dist/table/src/context.d.ts.map +1 -1
  42. package/dist/table/src/index.d.ts +14 -4
  43. package/dist/table/src/index.d.ts.map +1 -1
  44. package/dist/table/src/types/column.d.ts +6 -0
  45. package/dist/table/src/types/column.d.ts.map +1 -1
  46. package/dist/table/src/types/index.d.ts +1 -1
  47. package/dist/table/src/types/index.d.ts.map +1 -1
  48. package/dist/table/src/types/table.d.ts +23 -8
  49. package/dist/table/src/types/table.d.ts.map +1 -1
  50. package/dist/table/src/utils/rowKey.d.ts +8 -0
  51. package/dist/table/src/utils/rowKey.d.ts.map +1 -0
  52. package/dist/table/src/utils/rowKey.mjs +6 -0
  53. package/dist/theme/src/presets/antdv/table.d.ts +3 -0
  54. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  55. package/dist/theme/src/presets/antdv/table.mjs +4 -0
  56. package/dist/theme/src/presets/element-plus/table.d.ts +3 -0
  57. package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
  58. package/dist/theme/src/presets/element-plus/table.mjs +4 -0
  59. package/package.json +1 -1
@@ -1,18 +1,21 @@
1
- import { defineComponent as X, inject as $, ref as g, computed as c, onBeforeUnmount as D, watch as G, createVNode as r, isVNode as U } from "vue";
1
+ import { defineComponent as G, inject as U, ref as C, computed as c, onBeforeUnmount as Y, watch as J, createVNode as a, isVNode as Q } from "vue";
2
2
  import "../../../core/src/utils/tv.mjs";
3
- import Y from "./TableRow.mjs";
4
- import J from "./TableCell.mjs";
5
- import Q from "./TableEmpty.mjs";
6
- import Z from "./ColGroup.mjs";
7
- import { TABLE_CONTEXT_KEY as ee } from "../context.mjs";
8
- import { resolveFixedColumnRanges as te, useColumnWindow as le } from "../composables/useColumnWindow.mjs";
9
- import { getRowCompatClass as ne, getExpandedRowCompatClass as oe } from "../utils/compat.mjs";
10
- import ae from "../../../core/src/components/VirtualList/VirtualList.mjs";
11
- import { cn as x } from "tailwind-variants";
12
- function re(e) {
13
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
3
+ import Z from "./TableRow.mjs";
4
+ import ee from "./TableCell.mjs";
5
+ import te from "./TableEmpty.mjs";
6
+ import le from "./ExpandedRowTr.mjs";
7
+ import ne from "./ColGroup.mjs";
8
+ import { TABLE_CONTEXT_KEY as oe } from "../context.mjs";
9
+ import { resolveFixedColumnRanges as re, useColumnWindow as ae } from "../composables/useColumnWindow.mjs";
10
+ import { resolveRowDragClass as ie } from "../composables/useRowDragSort.mjs";
11
+ import { getRowCompatClass as se } from "../utils/compat.mjs";
12
+ import { resolveRowKey as V } from "../utils/rowKey.mjs";
13
+ import de from "../../../core/src/components/VirtualList/VirtualList.mjs";
14
+ import { cn as ue } from "tailwind-variants";
15
+ function ce(t) {
16
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Q(t);
14
17
  }
15
- const xe = /* @__PURE__ */ X({
18
+ const Fe = /* @__PURE__ */ G({
16
19
  name: "VirtualTableBody",
17
20
  props: {
18
21
  dataSource: {
@@ -91,176 +94,183 @@ const xe = /* @__PURE__ */ X({
91
94
  default: "hover"
92
95
  }
93
96
  },
94
- setup(e) {
95
- const a = $(ee, {}), w = g(), b = g(0), f = g(0);
96
- function S(t) {
97
- b.value = t.x, e.onVirtualScroll?.({
98
- ...t,
99
- maxX: w.value?.getHorizontalRange() ?? 0
97
+ setup(t) {
98
+ const r = U(oe, {}), m = C(), x = C(0), f = C(0);
99
+ function b(e) {
100
+ x.value = e.x, t.onVirtualScroll?.({
101
+ ...e,
102
+ maxX: m.value?.getHorizontalRange() ?? 0
100
103
  });
101
104
  }
102
- function O(t, l) {
103
- return typeof e.rowKey == "function" ? e.rowKey(t) : typeof e.rowKey == "string" && e.rowKey in t ? t[e.rowKey] : l;
105
+ function k(e, l) {
106
+ return V(e, l, t.rowKey);
104
107
  }
105
- function T(t) {
106
- return typeof e.rowKey == "function" ? e.rowKey(t) : typeof e.rowKey == "string" && e.rowKey in t ? t[e.rowKey] : e.dataSource.indexOf(t);
108
+ function q(e) {
109
+ const l = t.dataSource.indexOf(e);
110
+ return V(e, l, t.rowKey);
107
111
  }
108
- const V = c(() => {
109
- let t = 0;
110
- for (const l of e.columns) {
111
- const d = typeof l.width == "number" ? l.width : parseInt(String(l.width || "0"), 10);
112
- t += d || 0;
112
+ const O = c(() => {
113
+ let e = 0;
114
+ for (const l of t.columns) {
115
+ const u = typeof l.width == "number" ? l.width : parseInt(String(l.width || "0"), 10);
116
+ e += u || 0;
113
117
  }
114
- return t;
115
- }), k = c(() => {
116
- const t = e.virtualColumn ? e.columnMetrics?.total : void 0;
117
- return t && t > 0 ? t : V.value;
118
- }), m = c(() => te(e.columns)), R = c(() => {
119
- if (!e.virtualColumn || f.value <= 0) return null;
120
- const t = e.columnMetrics;
121
- return !t || t.widths.length !== e.columns.length ? null : t.widths;
118
+ return e;
119
+ }), W = c(() => {
120
+ const e = t.virtualColumn ? t.columnMetrics?.total : void 0;
121
+ return e && e > 0 ? e : O.value;
122
+ }), v = c(() => re(t.columns)), S = c(() => {
123
+ if (!t.virtualColumn || f.value <= 0) return null;
124
+ const e = t.columnMetrics;
125
+ return !e || e.widths.length !== t.columns.length ? null : e.widths;
122
126
  }), {
123
- active: p,
124
- start: q,
125
- end: W,
126
- leftSpacer: E,
127
- rightSpacer: K
128
- } = le({
129
- widths: () => R.value,
130
- leftFixedCount: () => m.value.leftFixedCount,
131
- rightFixedStart: () => m.value.rightFixedStart,
132
- offsetX: () => b.value,
127
+ active: R,
128
+ start: H,
129
+ end: I,
130
+ leftSpacer: p,
131
+ rightSpacer: E
132
+ } = ae({
133
+ widths: () => S.value,
134
+ leftFixedCount: () => v.value.leftFixedCount,
135
+ rightFixedStart: () => v.value.rightFixedStart,
136
+ offsetX: () => x.value,
133
137
  viewportWidth: () => f.value
134
- }), H = c(() => {
135
- const t = e.columns.length;
136
- if (!p.value)
138
+ }), _ = c(() => {
139
+ const e = t.columns.length;
140
+ if (!R.value)
137
141
  return Array.from({
138
- length: t
139
- }, (o, i) => ({
142
+ length: e
143
+ }, (n, i) => ({
140
144
  index: i
141
145
  }));
142
146
  const {
143
147
  leftFixedCount: l,
144
- rightFixedStart: d
145
- } = m.value, n = [];
146
- for (let o = 0; o < l; o += 1) n.push({
147
- index: o
148
+ rightFixedStart: u
149
+ } = v.value, o = [];
150
+ for (let n = 0; n < l; n += 1) o.push({
151
+ index: n
148
152
  });
149
- E.value > 0 && n.push({
150
- spacer: E.value
153
+ p.value > 0 && o.push({
154
+ spacer: p.value
151
155
  });
152
- for (let o = q.value; o <= W.value; o += 1) n.push({
153
- index: o
156
+ for (let n = H.value; n <= I.value; n += 1) o.push({
157
+ index: n
154
158
  });
155
- K.value > 0 && n.push({
156
- spacer: K.value
159
+ E.value > 0 && o.push({
160
+ spacer: E.value
157
161
  });
158
- for (let o = d; o < t; o += 1) n.push({
159
- index: o
162
+ for (let n = u; n < e; n += 1) o.push({
163
+ index: n
160
164
  });
161
- return n;
165
+ return o;
162
166
  });
163
- function ie(t) {
167
+ function fe(e) {
164
168
  }
165
- let u = null, s = null;
166
- function B(t) {
167
- const l = t ?? null;
168
- l !== s && (u && s && u.unobserve(s), s = l, l && (f.value = l.clientWidth, !u && typeof ResizeObserver < "u" && (u = new ResizeObserver(() => {
169
- s && (f.value = s.clientWidth);
170
- })), u?.observe(l)));
169
+ let s = null, d = null;
170
+ function B(e) {
171
+ const l = e ?? null;
172
+ l !== d && (s && d && s.unobserve(d), d = l, l && (f.value = l.clientWidth, !s && typeof ResizeObserver < "u" && (s = new ResizeObserver(() => {
173
+ d && (f.value = d.clientWidth);
174
+ })), s?.observe(l)));
171
175
  }
172
- return D(() => {
173
- u?.disconnect(), u = null, s = null;
174
- }), G(() => w.value, (t) => {
175
- if (t) {
176
- const l = t.getScrollInfo();
177
- S(l), t.nativeElement, B(t.nativeElement);
176
+ return Y(() => {
177
+ s?.disconnect(), s = null, d = null;
178
+ }), J(() => m.value, (e) => {
179
+ if (e) {
180
+ const l = e.getScrollInfo();
181
+ b(l), e.nativeElement, B(e.nativeElement);
178
182
  } else
179
183
  B(null);
180
- }), () => e.dataSource.length === 0 ? r("table", {
181
- class: e.tableClass,
182
- style: e.tableStyle
183
- }, [r(Z, {
184
- columns: e.columns
185
- }, null), r("tbody", {
186
- class: e.tbodyClass
187
- }, [r(Q, {
188
- colSpan: e.columns.length || 1,
189
- emptyClass: e.emptyClass,
190
- tdClass: e.tdClass
191
- }, null)])]) : r(ae, {
192
- ref: w,
193
- data: e.dataSource,
194
- height: e.height,
195
- itemHeight: e.itemHeight,
196
- itemKey: T,
197
- scrollWidth: k.value || void 0,
198
- disableHeightMeasure: e.fixedHeight,
184
+ }), () => t.dataSource.length === 0 ? a("table", {
185
+ class: t.tableClass,
186
+ style: t.tableStyle
187
+ }, [a(ne, {
188
+ columns: t.columns
189
+ }, null), a("tbody", {
190
+ class: t.tbodyClass
191
+ }, [a(te, {
192
+ colSpan: t.columns.length || 1,
193
+ emptyClass: t.emptyClass,
194
+ tdClass: t.tdClass
195
+ }, null)])]) : a(de, {
196
+ ref: m,
197
+ data: t.dataSource,
198
+ height: t.height,
199
+ itemHeight: t.itemHeight,
200
+ itemKey: q,
201
+ scrollWidth: W.value || void 0,
202
+ disableHeightMeasure: t.fixedHeight,
199
203
  fullHeight: !1,
200
- onVirtualScroll: S,
201
- showScrollBar: e.showScrollBar,
204
+ onVirtualScroll: b,
205
+ showScrollBar: t.showScrollBar,
202
206
  style: {
203
207
  overflow: "hidden"
204
208
  }
205
209
  }, {
206
210
  default: ({
207
- item: t,
211
+ item: e,
208
212
  index: l
209
213
  }) => {
210
- let d;
211
- const n = l, o = O(t, n), i = a.expandable?.(), _ = a.isExpanded?.(o) ?? !1, I = i?.expandRowByClick ?? !1, j = a.isRowExpandable?.(t) ?? !1, F = a.getRowClassName?.(t, n), A = a.getRowProps?.(t, n), v = (a.isTreeData?.value ? a.getFlattenRow?.(t) : void 0)?.level ?? 0, z = typeof i?.expandedRowClassName == "function" ? i.expandedRowClassName(t, n, v) : i?.expandedRowClassName, L = I ? () => {
212
- j && a.toggleExpand?.(t, n);
213
- } : void 0, N = H.value, M = p.value ? R.value : null;
214
- return r("table", {
215
- class: e.tableClass,
214
+ let u;
215
+ const o = l, n = k(e, o), i = r.expandable?.(), K = r.isExpanded?.(n) ?? !1, j = i?.expandRowByClick ?? !1, D = r.isRowExpandable?.(e) ?? !1, N = r.getRowClassName?.(e, o), F = r.getRowProps?.(e, o), A = r.rowDrag?.enabled.value ? r.rowDrag.getBindings(e, o, F) : void 0, P = {
216
+ ...F,
217
+ ...A
218
+ }, L = ie(r.rowDrag, n, r.subThemeSlots), y = (r.isTreeData?.value ? r.getFlattenRow?.(e) : void 0)?.level ?? 0, M = typeof i?.expandedRowClassName == "function" ? i.expandedRowClassName(e, o, y) : i?.expandedRowClassName, X = j ? () => {
219
+ D && r.toggleExpand?.(e, o);
220
+ } : void 0, T = _.value, z = R.value ? S.value : null;
221
+ return a("table", {
222
+ class: t.tableClass,
216
223
  style: {
217
- ...e.tableStyle,
224
+ ...t.tableStyle,
218
225
  tableLayout: "fixed"
219
226
  }
220
- }, [r("tbody", {
221
- class: e.tbodyClass,
222
- "data-vtg-preserve-last-border": l < e.dataSource.length - 1 ? "" : void 0
223
- }, [r(Y, {
224
- key: o,
225
- rowClass: x(e.rowClass, F, ne(a, t, n, v)) ?? "",
226
- rowProps: A,
227
- onClick: L
228
- }, re(d = N.map((h, P) => {
229
- if (h.spacer !== void 0)
230
- return r("td", {
231
- key: `__vtg_spacer_${P}`,
227
+ }, [a("tbody", {
228
+ class: t.tbodyClass,
229
+ "data-vtg-preserve-last-border": l < t.dataSource.length - 1 ? "" : void 0
230
+ }, [a(Z, {
231
+ key: n,
232
+ rowClass: ue(t.rowClass, N, L, se(r, e, o, y)) ?? "",
233
+ rowProps: P,
234
+ onClick: X
235
+ }, ce(u = T.map((g, $) => {
236
+ if (g.spacer !== void 0)
237
+ return a("td", {
238
+ key: `__vtg_spacer_${$}`,
232
239
  style: {
233
- width: `${h.spacer}px`,
240
+ width: `${g.spacer}px`,
234
241
  padding: "0"
235
242
  },
236
243
  "aria-hidden": "true"
237
244
  }, null);
238
- const y = h.index, C = e.columns[y];
239
- return r(J, {
240
- key: C.key ?? String(C.dataIndex ?? y),
241
- record: t,
242
- rowIndex: n,
243
- column: C,
244
- colIndex: y,
245
- widthOverride: M?.[y],
246
- tdClass: e.tdClass,
247
- bodyCellEllipsisClass: e.bodyCellEllipsisClass
245
+ const w = g.index, h = t.columns[w];
246
+ return a(ee, {
247
+ key: h.key ?? String(h.dataIndex ?? w),
248
+ record: e,
249
+ rowIndex: o,
250
+ column: h,
251
+ colIndex: w,
252
+ widthOverride: z?.[w],
253
+ tdClass: t.tdClass,
254
+ bodyCellEllipsisClass: t.bodyCellEllipsisClass
248
255
  }, null);
249
- })) ? d : {
250
- default: () => [d]
251
- }), _ && i?.expandedRowRender && r("tr", {
252
- key: `${o}-expanded`,
253
- class: x(e.rowClass, F, a.subThemeSlots?.expandedRow(), oe(a, v), z)
254
- }, [r("td", {
255
- colspan: N.length,
256
- class: x(e.tdClass, a.subThemeSlots?.expandedRowCell())
257
- }, [a.compatClass && (a.fixedOffsets?.value?.size ?? 0) > 0 ? r("div", {
258
- class: a.compatClass("expanded-row-fixed")
259
- }, [i.expandedRowRender(t, n, 0, !0)]) : i.expandedRowRender(t, n, 0, !0)])])])]);
256
+ })) ? u : {
257
+ default: () => [u]
258
+ }), K && i?.expandedRowRender ? a(le, {
259
+ key: `${n}-expanded`,
260
+ record: e,
261
+ rowIndex: o,
262
+ colspan: T.length,
263
+ rowIndent: y,
264
+ rowClass: t.rowClass,
265
+ rowClassName: N,
266
+ expandedRowClassName: M,
267
+ tdClass: t.tdClass,
268
+ expandedRowRender: i.expandedRowRender
269
+ }, null) : null])]);
260
270
  }
261
271
  });
262
272
  }
263
273
  });
264
274
  export {
265
- xe as default
275
+ Fe as default
266
276
  };
@@ -1,4 +1,5 @@
1
1
  export { useColumns, getByDataIndex } from './useColumns';
2
+ export { filterVisibleColumns, applyColumnOrder } from './useColumnDisplay';
2
3
  export { useSorter, getColumnKey } from './useSorter';
3
4
  export type { SorterState, SorterResult } from './useSorter';
4
5
  export { useFilter } from './useFilter';
@@ -12,6 +13,8 @@ export { useExpand } from './useExpand';
12
13
  export { useResize } from './useResize';
13
14
  export { useHoverState, isInHoverRange } from './useHoverState';
14
15
  export type { HoverState } from './useHoverState';
16
+ export { useRowDragSort, moveTreeNode, resolveRowDragClass } from './useRowDragSort';
17
+ export type { DropPosition, RowDragBindings, RowDragDropTarget, TreeLocation, UseRowDragSortOptions, } from './useRowDragSort';
15
18
  export { useColumnMetrics } from './useColumnMetrics';
16
19
  export type { ColumnMetrics } from './useColumnMetrics';
17
20
  export { useColumnWindow, computeColumnWindow, resolveFixedColumnRanges, DEFAULT_COLUMN_OVERSCAN, } from './useColumnWindow';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACrD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,cAAc,EAAE,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E,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACpF,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,GACtB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { ColumnsType, Key } from '../types';
2
+ /**
3
+ * 过滤不可见列(`column.visible === false`)。
4
+ *
5
+ * 与 filterResponsiveColumns 同构:哨兵(EXPAND_COLUMN / SELECTION_COLUMN)
6
+ * 原样穿过;叶子列 visible 为 false 时丢弃;分组列自身隐藏或子列全部被
7
+ * 过滤掉时整组丢弃。叶子列保持原引用稳定;分组列因需替换 children 数组
8
+ * 会被克隆。
9
+ *
10
+ * 只在显示层(displayColumnTree)调用:数据列(排序/筛选输入)保持全量,
11
+ * 隐藏列的 sorter / filter 内部状态不会被清理,取消隐藏后状态保留。
12
+ */
13
+ export declare function filterVisibleColumns<TRecord extends Record<string, unknown>>(columns: ColumnsType<TRecord>): ColumnsType<TRecord>;
14
+ /**
15
+ * 按表级 `columnOrder` 重排顶层列。
16
+ *
17
+ * 规则:
18
+ * - key 在 order 中出现的列,按 order 中的先后排前(重复 key 取首次下标);
19
+ * - 未出现的列(含无 key 列)保持原相对顺序,排在已匹配列之后;
20
+ * - `pinnedKeys`(选择列 / 展开列)不参与顺序匹配,恒提取到最前(保持原相对顺序);
21
+ * - order 为空时原样返回,不做任何重排。
22
+ *
23
+ * 仅重排传入的这一层数组;分组列作为整体移动。
24
+ */
25
+ export declare function applyColumnOrder<TRecord extends Record<string, unknown>>(columns: ColumnsType<TRecord>, order: Key[] | undefined, pinnedKeys?: readonly string[]): ColumnsType<TRecord>;
26
+ //# sourceMappingURL=useColumnDisplay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useColumnDisplay.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useColumnDisplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGjE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1E,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAC5B,WAAW,CAAC,OAAO,CAAC,CAsBtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtE,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAC7B,KAAK,EAAE,GAAG,EAAE,GAAG,SAAS,EACxB,UAAU,GAAE,SAAS,MAAM,EAAO,GACjC,WAAW,CAAC,OAAO,CAAC,CAyCtB"}
@@ -0,0 +1,46 @@
1
+ import { getColumnKey as c } from "./useColumns.mjs";
2
+ function y(d) {
3
+ return d.reduce((e, n) => {
4
+ if (typeof n == "symbol")
5
+ return e.push(n), e;
6
+ if (n.visible === !1)
7
+ return e;
8
+ if ("children" in n && Array.isArray(n.children)) {
9
+ const o = y(n.children);
10
+ return o.length === 0 || e.push({ ...n, children: o }), e;
11
+ }
12
+ return e.push(n), e;
13
+ }, []);
14
+ }
15
+ function u(d, e, n = []) {
16
+ if (!e || e.length === 0) return d;
17
+ const o = /* @__PURE__ */ new Map();
18
+ e.forEach((r, i) => {
19
+ const t = String(r);
20
+ o.has(t) || o.set(t, i);
21
+ });
22
+ const a = new Set(n), h = [], s = [], f = [];
23
+ return d.forEach((r, i) => {
24
+ if (typeof r != "symbol") {
25
+ const t = c(r);
26
+ if (t !== void 0 && a.has(String(t))) {
27
+ h.push(r);
28
+ return;
29
+ }
30
+ const p = t !== void 0 ? o.get(String(t)) : void 0;
31
+ if (p !== void 0) {
32
+ s.push({ column: r, order: p, index: i });
33
+ return;
34
+ }
35
+ }
36
+ f.push({ column: r, order: Number.POSITIVE_INFINITY, index: i });
37
+ }), s.sort((r, i) => r.order - i.order || r.index - i.index), f.sort((r, i) => r.index - i.index), [
38
+ ...h,
39
+ ...s.map((r) => r.column),
40
+ ...f.map((r) => r.column)
41
+ ];
42
+ }
43
+ export {
44
+ u as applyColumnOrder,
45
+ y as filterVisibleColumns
46
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useColumnDisplay.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useColumnDisplay.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useColumnDisplay.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,79 @@
1
+ import { Ref } from 'vue';
2
+ import { Key, RowDragSortInfo } from '../types';
3
+ /** 拖拽放置位置:目标行的前 / 后 */
4
+ export type DropPosition = 'before' | 'after';
5
+ export interface RowDragDropTarget {
6
+ key: Key;
7
+ position: DropPosition;
8
+ }
9
+ /** 行拖拽状态对应的 class(trDragging / trDropAbove / trDropBelow) */
10
+ export declare function resolveRowDragClass(rowDrag: {
11
+ draggingKey: Ref<Key | null>;
12
+ dropTarget: Ref<RowDragDropTarget | null>;
13
+ } | undefined, key: Key, slots: {
14
+ trDragging: () => string;
15
+ trDropAbove: () => string;
16
+ trDropBelow: () => string;
17
+ } | undefined): string;
18
+ export interface UseRowDragSortOptions<TRecord extends Record<string, unknown>> {
19
+ /** 是否启用行拖拽(对应 rowDraggable prop) */
20
+ enabled: () => boolean;
21
+ /** 行 key 解析器(与表格 getRowKey 同源) */
22
+ getRowKey: (record: TRecord, index: number) => Key;
23
+ /** 数据源(拖放后在它上面搬移,重排结果交给外部更新) */
24
+ dataSource: () => TRecord[];
25
+ /** 树形数据子节点字段名;缺省 'children' */
26
+ childrenColumnName?: () => string | undefined;
27
+ /** 拖放完成且顺序有变化时回调 */
28
+ onDrop?: (newData: TRecord[], info: RowDragSortInfo) => void;
29
+ }
30
+ /**
31
+ * 在树结构中按 key 定位节点:返回包含它的数组从根起的下标路径([] 表示顶层)、
32
+ * 在该数组中的下标与节点引用。找不到返回 null。
33
+ */
34
+ export interface TreeLocation<TRecord> {
35
+ listPath: number[];
36
+ index: number;
37
+ node: TRecord;
38
+ }
39
+ /**
40
+ * 树感知的节点搬移:把 draggedKey 节点搬到 targetKey 节点的前 / 后,
41
+ * 即插入到目标节点的**同级位置**——目标在顶层就回到顶层,目标是某父的子节点
42
+ * 就变成该父的子节点(跨父移动)。节点自身携带整棵子树;平铺数据自然退化为
43
+ * 普通的前后插入。
44
+ *
45
+ * 返回 null 表示不需要更新:找不到节点、拖到自己 / 自己的子树里、或插回原位。
46
+ * 纯函数不修改入参;仅拖拽路径上的 children 数组与父节点对象被克隆,其余节点
47
+ * 保持原引用,选择 / 展开等按 record 引用或 key 记录的状态因此不受影响。
48
+ */
49
+ export declare function moveTreeNode<TRecord extends Record<string, unknown>>(records: readonly TRecord[], getKey: (record: TRecord, index: number) => Key, draggedKey: Key, targetKey: Key, position: DropPosition, childrenColumnName?: string): TRecord[] | null;
50
+ /** 拖拽行绑到 <tr> 上的 props。禁用时 draggable 为 false、事件仅透传用户 handler。 */
51
+ export interface RowDragBindings {
52
+ draggable: boolean;
53
+ onDragstart: (event: DragEvent) => void;
54
+ onDragover: (event: DragEvent) => void;
55
+ onDragleave: (event: DragEvent) => void;
56
+ onDrop: (event: DragEvent) => void;
57
+ onDragend: (event: DragEvent) => void;
58
+ }
59
+ /**
60
+ * 行拖拽排序(原生 HTML5 拖放)。
61
+ *
62
+ * 仅负责交互状态与拖放结果计算:drop 时在 dataSource 上搬移行并通过
63
+ * onDrop 交给外部更新(受控模式,与 dataSource 为 prop 的数据流一致)。
64
+ * 拖拽态 class(trDragging / trDropAbove / trDropBelow)由行组件根据
65
+ * draggingKey / dropTarget 拼进 rowClass。
66
+ */
67
+ export declare function useRowDragSort<TRecord extends Record<string, unknown>>(options: UseRowDragSortOptions<TRecord>): {
68
+ draggingKey: Ref<Key | null, Key | null>;
69
+ dropTarget: Ref<{
70
+ key: Key;
71
+ position: DropPosition;
72
+ } | null, RowDragDropTarget | {
73
+ key: Key;
74
+ position: DropPosition;
75
+ } | null>;
76
+ isDragging: import('vue').ComputedRef<boolean>;
77
+ getBindings: (record: TRecord, index: number, userProps?: Record<string, unknown>) => RowDragBindings;
78
+ };
79
+ //# sourceMappingURL=useRowDragSort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRowDragSort.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useRowDragSort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEpD,uBAAuB;AACvB,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE7C,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,QAAQ,EAAE,YAAY,CAAA;CACvB;AAED,6DAA6D;AAC7D,wBAAgB,mBAAmB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