@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.
- package/css/presets/antdv.css +2 -0
- package/css/presets/element-plus.css +2 -0
- package/css/style.css +19 -0
- package/css/tailwind3-utilities.css +15 -0
- package/css/tailwind3.css +4 -0
- package/css/tailwind4.css +4 -0
- package/dist/css/presets/antdv.css +2 -0
- package/dist/css/presets/element-plus.css +2 -0
- package/dist/css/style.css +19 -0
- package/dist/css/tailwind3-utilities.css +15 -0
- package/dist/css/tailwind3.css +4 -0
- package/dist/css/tailwind4.css +4 -0
- package/dist/index.full.mjs +3291 -2998
- package/dist/index.mjs +22 -19
- package/dist/table/src/components/ExpandedRowTr.d.ts +90 -0
- package/dist/table/src/components/ExpandedRowTr.d.ts.map +1 -0
- package/dist/table/src/components/ExpandedRowTr.mjs +61 -0
- package/dist/table/src/components/Table.d.ts +23 -3
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +355 -324
- package/dist/table/src/components/TableBody.d.ts.map +1 -1
- package/dist/table/src/components/TableBody.mjs +67 -58
- package/dist/table/src/components/VTable.vue.d.ts +4 -3
- package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTable.vue.mjs +43 -37
- package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
- package/dist/table/src/components/VirtualTableBody.mjs +151 -141
- package/dist/table/src/composables/index.d.ts +3 -0
- package/dist/table/src/composables/index.d.ts.map +1 -1
- package/dist/table/src/composables/useColumnDisplay.d.ts +26 -0
- package/dist/table/src/composables/useColumnDisplay.d.ts.map +1 -0
- package/dist/table/src/composables/useColumnDisplay.mjs +46 -0
- package/dist/table/src/composables/useColumnDisplay.test.d.ts +2 -0
- package/dist/table/src/composables/useColumnDisplay.test.d.ts.map +1 -0
- package/dist/table/src/composables/useRowDragSort.d.ts +79 -0
- package/dist/table/src/composables/useRowDragSort.d.ts.map +1 -0
- package/dist/table/src/composables/useRowDragSort.mjs +146 -0
- package/dist/table/src/composables/useRowDragSort.test.d.ts +2 -0
- package/dist/table/src/composables/useRowDragSort.test.d.ts.map +1 -0
- package/dist/table/src/context.d.ts +14 -0
- package/dist/table/src/context.d.ts.map +1 -1
- package/dist/table/src/index.d.ts +14 -4
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/types/column.d.ts +6 -0
- package/dist/table/src/types/column.d.ts.map +1 -1
- package/dist/table/src/types/index.d.ts +1 -1
- package/dist/table/src/types/index.d.ts.map +1 -1
- package/dist/table/src/types/table.d.ts +23 -8
- package/dist/table/src/types/table.d.ts.map +1 -1
- package/dist/table/src/utils/rowKey.d.ts +8 -0
- package/dist/table/src/utils/rowKey.d.ts.map +1 -0
- package/dist/table/src/utils/rowKey.mjs +6 -0
- package/dist/theme/src/presets/antdv/table.d.ts +3 -0
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +4 -0
- package/dist/theme/src/presets/element-plus/table.d.ts +3 -0
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +4 -0
- package/package.json +1 -1
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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(
|
|
95
|
-
const
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
...
|
|
99
|
-
maxX:
|
|
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
|
|
103
|
-
return
|
|
105
|
+
function k(e, l) {
|
|
106
|
+
return V(e, l, t.rowKey);
|
|
104
107
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
108
|
+
function q(e) {
|
|
109
|
+
const l = t.dataSource.indexOf(e);
|
|
110
|
+
return V(e, l, t.rowKey);
|
|
107
111
|
}
|
|
108
|
-
const
|
|
109
|
-
let
|
|
110
|
-
for (const l of
|
|
111
|
-
const
|
|
112
|
-
|
|
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
|
|
115
|
-
}),
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
}),
|
|
119
|
-
if (!
|
|
120
|
-
const
|
|
121
|
-
return !
|
|
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:
|
|
124
|
-
start:
|
|
125
|
-
end:
|
|
126
|
-
leftSpacer:
|
|
127
|
-
rightSpacer:
|
|
128
|
-
} =
|
|
129
|
-
widths: () =>
|
|
130
|
-
leftFixedCount: () =>
|
|
131
|
-
rightFixedStart: () =>
|
|
132
|
-
offsetX: () =>
|
|
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
|
-
}),
|
|
135
|
-
const
|
|
136
|
-
if (!
|
|
138
|
+
}), _ = c(() => {
|
|
139
|
+
const e = t.columns.length;
|
|
140
|
+
if (!R.value)
|
|
137
141
|
return Array.from({
|
|
138
|
-
length:
|
|
139
|
-
}, (
|
|
142
|
+
length: e
|
|
143
|
+
}, (n, i) => ({
|
|
140
144
|
index: i
|
|
141
145
|
}));
|
|
142
146
|
const {
|
|
143
147
|
leftFixedCount: l,
|
|
144
|
-
rightFixedStart:
|
|
145
|
-
} =
|
|
146
|
-
for (let
|
|
147
|
-
index:
|
|
148
|
+
rightFixedStart: u
|
|
149
|
+
} = v.value, o = [];
|
|
150
|
+
for (let n = 0; n < l; n += 1) o.push({
|
|
151
|
+
index: n
|
|
148
152
|
});
|
|
149
|
-
|
|
150
|
-
spacer:
|
|
153
|
+
p.value > 0 && o.push({
|
|
154
|
+
spacer: p.value
|
|
151
155
|
});
|
|
152
|
-
for (let
|
|
153
|
-
index:
|
|
156
|
+
for (let n = H.value; n <= I.value; n += 1) o.push({
|
|
157
|
+
index: n
|
|
154
158
|
});
|
|
155
|
-
|
|
156
|
-
spacer:
|
|
159
|
+
E.value > 0 && o.push({
|
|
160
|
+
spacer: E.value
|
|
157
161
|
});
|
|
158
|
-
for (let
|
|
159
|
-
index:
|
|
162
|
+
for (let n = u; n < e; n += 1) o.push({
|
|
163
|
+
index: n
|
|
160
164
|
});
|
|
161
|
-
return
|
|
165
|
+
return o;
|
|
162
166
|
});
|
|
163
|
-
function
|
|
167
|
+
function fe(e) {
|
|
164
168
|
}
|
|
165
|
-
let
|
|
166
|
-
function B(
|
|
167
|
-
const l =
|
|
168
|
-
l !==
|
|
169
|
-
|
|
170
|
-
})),
|
|
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
|
|
173
|
-
|
|
174
|
-
}),
|
|
175
|
-
if (
|
|
176
|
-
const l =
|
|
177
|
-
|
|
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
|
-
}), () =>
|
|
181
|
-
class:
|
|
182
|
-
style:
|
|
183
|
-
}, [
|
|
184
|
-
columns:
|
|
185
|
-
}, null),
|
|
186
|
-
class:
|
|
187
|
-
}, [
|
|
188
|
-
colSpan:
|
|
189
|
-
emptyClass:
|
|
190
|
-
tdClass:
|
|
191
|
-
}, null)])]) :
|
|
192
|
-
ref:
|
|
193
|
-
data:
|
|
194
|
-
height:
|
|
195
|
-
itemHeight:
|
|
196
|
-
itemKey:
|
|
197
|
-
scrollWidth:
|
|
198
|
-
disableHeightMeasure:
|
|
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:
|
|
201
|
-
showScrollBar:
|
|
204
|
+
onVirtualScroll: b,
|
|
205
|
+
showScrollBar: t.showScrollBar,
|
|
202
206
|
style: {
|
|
203
207
|
overflow: "hidden"
|
|
204
208
|
}
|
|
205
209
|
}, {
|
|
206
210
|
default: ({
|
|
207
|
-
item:
|
|
211
|
+
item: e,
|
|
208
212
|
index: l
|
|
209
213
|
}) => {
|
|
210
|
-
let
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
...
|
|
224
|
+
...t.tableStyle,
|
|
218
225
|
tableLayout: "fixed"
|
|
219
226
|
}
|
|
220
|
-
}, [
|
|
221
|
-
class:
|
|
222
|
-
"data-vtg-preserve-last-border": l <
|
|
223
|
-
}, [
|
|
224
|
-
key:
|
|
225
|
-
rowClass:
|
|
226
|
-
rowProps:
|
|
227
|
-
onClick:
|
|
228
|
-
},
|
|
229
|
-
if (
|
|
230
|
-
return
|
|
231
|
-
key: `__vtg_spacer_${
|
|
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: `${
|
|
240
|
+
width: `${g.spacer}px`,
|
|
234
241
|
padding: "0"
|
|
235
242
|
},
|
|
236
243
|
"aria-hidden": "true"
|
|
237
244
|
}, null);
|
|
238
|
-
const
|
|
239
|
-
return
|
|
240
|
-
key:
|
|
241
|
-
record:
|
|
242
|
-
rowIndex:
|
|
243
|
-
column:
|
|
244
|
-
colIndex:
|
|
245
|
-
widthOverride:
|
|
246
|
-
tdClass:
|
|
247
|
-
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
|
-
})) ?
|
|
250
|
-
default: () => [
|
|
251
|
-
}),
|
|
252
|
-
key: `${
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
colspan:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
-
|
|
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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a,CAAA;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,SAAS,EAAE,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 @@
|
|
|
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,CAA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