@vtable-guild/vtable-guild 2.6.3 → 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 +25 -3
- package/css/tailwind3-utilities.css +21 -3
- package/css/tailwind3.css +4 -0
- package/css/tailwind4.css +4 -0
- package/dist/core/src/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/VirtualList.mjs +97 -91
- package/dist/css/presets/antdv.css +2 -0
- package/dist/css/presets/element-plus.css +2 -0
- package/dist/css/style.css +25 -3
- package/dist/css/tailwind3-utilities.css +21 -3
- package/dist/css/tailwind3.css +4 -0
- package/dist/css/tailwind4.css +4 -0
- package/dist/index.full.mjs +4051 -3623
- 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 +421 -365
- 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 -140
- 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/useAutoHeight.d.ts +32 -0
- package/dist/table/src/composables/useAutoHeight.d.ts.map +1 -0
- package/dist/table/src/composables/useAutoHeight.mjs +66 -0
- package/dist/table/src/composables/useAutoHeight.test.d.ts +2 -0
- package/dist/table/src/composables/useAutoHeight.test.d.ts.map +1 -0
- 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/useColumnMetrics.d.ts.map +1 -1
- package/dist/table/src/composables/useColumnMetrics.mjs +49 -49
- package/dist/table/src/composables/useColumnMetrics.test.d.ts +2 -0
- package/dist/table/src/composables/useColumnMetrics.test.d.ts.map +1 -0
- package/dist/table/src/composables/useColumnWindow.mjs +16 -16
- package/dist/table/src/composables/useResize.d.ts.map +1 -1
- package/dist/table/src/composables/useResize.mjs +37 -31
- 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/composables/useScroll.d.ts +8 -0
- package/dist/table/src/composables/useScroll.d.ts.map +1 -1
- package/dist/table/src/composables/useScroll.mjs +37 -37
- package/dist/table/src/composables/useVirtual.d.ts +35 -0
- package/dist/table/src/composables/useVirtual.d.ts.map +1 -1
- package/dist/table/src/composables/useVirtual.mjs +44 -16
- 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 +32 -9
- 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 +6 -1
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +14 -1
- package/dist/theme/src/presets/element-plus/table.d.ts +6 -1
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +8 -1
- 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,175 +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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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_${$}`,
|
|
231
239
|
style: {
|
|
232
|
-
width: `${
|
|
240
|
+
width: `${g.spacer}px`,
|
|
233
241
|
padding: "0"
|
|
234
242
|
},
|
|
235
243
|
"aria-hidden": "true"
|
|
236
244
|
}, null);
|
|
237
|
-
const
|
|
238
|
-
return
|
|
239
|
-
key:
|
|
240
|
-
record:
|
|
241
|
-
rowIndex:
|
|
242
|
-
column:
|
|
243
|
-
colIndex:
|
|
244
|
-
widthOverride:
|
|
245
|
-
tdClass:
|
|
246
|
-
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
|
|
247
255
|
}, null);
|
|
248
|
-
})) ?
|
|
249
|
-
default: () => [
|
|
250
|
-
}),
|
|
251
|
-
key: `${
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
colspan:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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])]);
|
|
259
270
|
}
|
|
260
271
|
});
|
|
261
272
|
}
|
|
262
273
|
});
|
|
263
274
|
export {
|
|
264
|
-
|
|
275
|
+
Fe as default
|
|
265
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,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,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"}
|
|
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,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE3E,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,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,32 @@
|
|
|
1
|
+
import { ShallowRef } from 'vue';
|
|
2
|
+
export interface UseAutoHeightOptions {
|
|
3
|
+
/** 关闭时不测量、不注册 observer,bodyHeight 恒为 undefined。 */
|
|
4
|
+
enabled: () => boolean;
|
|
5
|
+
/** 内容区 wrapper:表头 / 表体 / 固定 summary 的共同父级。 */
|
|
6
|
+
wrapperEl: () => HTMLElement | null;
|
|
7
|
+
/** 表头块(useScroll 的 headerWrapRef)。缺失(showHeader: false)时不扣减。 */
|
|
8
|
+
headerEl: () => HTMLElement | null;
|
|
9
|
+
/** 固定 summary 块。缺失(无 summary 或不固定)时不扣减。 */
|
|
10
|
+
summaryEl?: () => HTMLElement | null;
|
|
11
|
+
/** 是否有数据。空数据时容器再矮也属正常,不提示配置问题。 */
|
|
12
|
+
hasData: () => boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface UseAutoHeightReturn {
|
|
15
|
+
/**
|
|
16
|
+
* 实测表体最大高度 = wrapper − 表头 − 固定 summary(向下取整,钳制 ≥1px)。
|
|
17
|
+
* undefined 表示尚未测得(未挂载 / ref 异常),调用方此时暂不约束高度。
|
|
18
|
+
*/
|
|
19
|
+
bodyHeight: ShallowRef<number | undefined>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* `scroll.y: 'auto'` 的实测表体高度。
|
|
23
|
+
*
|
|
24
|
+
* 观察 wrapper + 表头 + 固定 summary 三个元素(表头高度会随分组表头、size
|
|
25
|
+
* 预设独立变化),任一尺寸变化都重算。**不会震荡**:wrapper 高度由父容器
|
|
26
|
+
* 的 flex 布局决定,表体 maxHeight 只封顶内容,不反过来改变 wrapper 高度。
|
|
27
|
+
*
|
|
28
|
+
* 挂载与 ref 换绑后**立即同步测量一次**再注册 observer:ResizeObserver 的
|
|
29
|
+
* 首次回调要等下一渲染帧,不主动测的话首帧会以未约束高度绘制。
|
|
30
|
+
*/
|
|
31
|
+
export declare function useAutoHeight(options: UseAutoHeightOptions): UseAutoHeightReturn;
|
|
32
|
+
//# sourceMappingURL=useAutoHeight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoHeight.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useAutoHeight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AAGpF,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;IACnC,gEAAgE;IAChE,QAAQ,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;IAClC,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;IACpC,kCAAkC;IAClC,OAAO,EAAE,MAAM,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,UAAU,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAC3C;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,CAoIhF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { shallowRef as b, watch as g, onMounted as E, onBeforeUnmount as w } from "vue";
|
|
2
|
+
const y = 0.5, h = 1;
|
|
3
|
+
function R(e) {
|
|
4
|
+
const r = b(void 0);
|
|
5
|
+
let l = 0, a = null, u = [], i;
|
|
6
|
+
function s(n) {
|
|
7
|
+
const t = e.wrapperEl();
|
|
8
|
+
t && t.getClientRects().length > 0 && e.hasData() && n !== void 0 && n <= h;
|
|
9
|
+
}
|
|
10
|
+
function f() {
|
|
11
|
+
if (l = 0, !e.enabled()) {
|
|
12
|
+
r.value = void 0, i = void 0;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const n = e.wrapperEl();
|
|
16
|
+
if (!n) {
|
|
17
|
+
i = void 0, r.value !== void 0 && (r.value = void 0), s(void 0);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const t = e.headerEl()?.getBoundingClientRect().height ?? 0, c = e.summaryEl?.()?.getBoundingClientRect().height ?? 0, d = n.getBoundingClientRect().height - t - c;
|
|
21
|
+
if (i !== void 0 && Math.abs(d - i) <= y) {
|
|
22
|
+
s(r.value);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
i = d;
|
|
26
|
+
const v = Math.max(h, Math.floor(d));
|
|
27
|
+
r.value !== v && (r.value = v), s(v);
|
|
28
|
+
}
|
|
29
|
+
function m() {
|
|
30
|
+
if (typeof requestAnimationFrame > "u") {
|
|
31
|
+
f();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
l || (l = requestAnimationFrame(f));
|
|
35
|
+
}
|
|
36
|
+
function o() {
|
|
37
|
+
const n = e.enabled() ? [e.wrapperEl(), e.headerEl(), e.summaryEl?.() ?? null].filter(
|
|
38
|
+
(t) => !!t
|
|
39
|
+
) : [];
|
|
40
|
+
if (!(n.length === u.length && n.every((t, c) => t === u[c])) && (a?.disconnect(), u = n, n.length > 0)) {
|
|
41
|
+
!a && typeof ResizeObserver < "u" && (a = new ResizeObserver(m));
|
|
42
|
+
for (const t of n) a?.observe(t);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return g(
|
|
46
|
+
[
|
|
47
|
+
() => e.enabled(),
|
|
48
|
+
() => e.wrapperEl(),
|
|
49
|
+
() => e.headerEl(),
|
|
50
|
+
() => e.summaryEl?.() ?? null,
|
|
51
|
+
// 数据后到时重估「测不到高度」的告警条件(空数据不算配置问题)。
|
|
52
|
+
() => e.hasData()
|
|
53
|
+
],
|
|
54
|
+
() => {
|
|
55
|
+
o(), f();
|
|
56
|
+
},
|
|
57
|
+
{ flush: "post" }
|
|
58
|
+
), E(() => {
|
|
59
|
+
o(), f();
|
|
60
|
+
}), w(() => {
|
|
61
|
+
l && cancelAnimationFrame(l), a?.disconnect(), a = null, u = [];
|
|
62
|
+
}), { bodyHeight: r };
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
R as useAutoHeight
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoHeight.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useAutoHeight.test.ts"],"names":[],"mappings":""}
|
|
@@ -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":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnMetrics.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useColumnMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AACpF,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,UAAU,CAAA;AAG/C,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,WAAW;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAA;IACpD,qBAAqB;IACrB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,uCAAuC;IACvC,SAAS,EAAE,MAAM,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,OAAO,EAAE,UAAU,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACzC,uBAAuB;IACvB,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB;AA0CD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"useColumnMetrics.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useColumnMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AACpF,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,UAAU,CAAA;AAG/C,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,WAAW;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAA;IACpD,qBAAqB;IACrB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,uCAAuC;IACvC,SAAS,EAAE,MAAM,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,OAAO,EAAE,UAAU,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACzC,uBAAuB;IACvB,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB;AA0CD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAuHzF"}
|