@v-c/table 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/dist/Body/BodyRow.cjs +0 -143
- package/dist/Body/ExpandedRow.cjs +0 -55
- package/dist/Body/MeasureCell.cjs +0 -39
- package/dist/Body/MeasureRow.cjs +0 -68
- package/dist/Body/index.cjs +0 -82
- package/dist/Cell/index.cjs +0 -202
- package/dist/Cell/useHoverState.cjs +0 -18
- package/dist/ColGroup.cjs +0 -51
- package/dist/FixedHolder/index.cjs +0 -142
- package/dist/Footer/Cell.cjs +0 -51
- package/dist/Footer/Row.cjs +0 -23
- package/dist/Footer/Summary.cjs +0 -19
- package/dist/Footer/SummaryContext.cjs +0 -12
- package/dist/Footer/index.cjs +0 -39
- package/dist/Header/Header.cjs +0 -89
- package/dist/Header/HeaderRow.cjs +0 -66
- package/dist/Panel/index.cjs +0 -13
- package/dist/Table.cjs +0 -739
- package/dist/VirtualTable/BodyGrid.cjs +0 -180
- package/dist/VirtualTable/BodyLine.cjs +0 -92
- package/dist/VirtualTable/VirtualCell.cjs +0 -87
- package/dist/VirtualTable/context.cjs +0 -21
- package/dist/VirtualTable/index.cjs +0 -337
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/constant.cjs +0 -5
- package/dist/context/PerfContext.cjs +0 -14
- package/dist/context/TableContext.cjs +0 -21
- package/dist/hooks/useColumns/index.cjs +0 -127
- package/dist/hooks/useColumns/useWidthColumns.cjs +0 -57
- package/dist/hooks/useExpand.cjs +0 -56
- package/dist/hooks/useFixedInfo.cjs +0 -20
- package/dist/hooks/useFlattenRecords.cjs +0 -38
- package/dist/hooks/useFrame.cjs +0 -49
- package/dist/hooks/useHover.cjs +0 -20
- package/dist/hooks/useRowInfo.cjs +0 -53
- package/dist/hooks/useSticky.cjs +0 -27
- package/dist/hooks/useStickyOffsets.cjs +0 -41
- package/dist/index.cjs +0 -24
- package/dist/interface.cjs +0 -1
- package/dist/namePathType.cjs +0 -1
- package/dist/stickyScrollBar.cjs +0 -173
- package/dist/sugar/Column.cjs +0 -109
- package/dist/sugar/ColumnGroup.cjs +0 -109
- package/dist/utils/expandUtil.cjs +0 -38
- package/dist/utils/fixUtil.cjs +0 -49
- package/dist/utils/legacyUtil.cjs +0 -35
- package/dist/utils/offsetUtil.cjs +0 -12
- package/dist/utils/valueUtil.cjs +0 -28
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_constant = require("../constant.cjs");
|
|
7
|
-
const require_Table = require("../Table.cjs");
|
|
8
|
-
const require_context = require("./context.cjs");
|
|
9
|
-
const require_BodyGrid = require("./BodyGrid.cjs");
|
|
10
|
-
let vue = require("vue");
|
|
11
|
-
let _v_c_util = require("@v-c/util");
|
|
12
|
-
var VirtualTable = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots, attrs }) => {
|
|
13
|
-
const tableRef = (0, vue.ref)(null);
|
|
14
|
-
const bodyRef = (0, vue.ref)();
|
|
15
|
-
const mergedScrollX = (0, vue.computed)(() => {
|
|
16
|
-
const scrollX = props.scroll?.x;
|
|
17
|
-
if (typeof scrollX !== "number") {
|
|
18
|
-
if (process.env.NODE_ENV !== "production") (0, _v_c_util.warning)(!scrollX, "`scroll.x` in virtual table must be number.");
|
|
19
|
-
return 1;
|
|
20
|
-
}
|
|
21
|
-
return scrollX;
|
|
22
|
-
});
|
|
23
|
-
const mergedScrollY = (0, vue.computed)(() => {
|
|
24
|
-
const scrollY = props.scroll?.y;
|
|
25
|
-
if (typeof scrollY !== "number") {
|
|
26
|
-
if (process.env.NODE_ENV !== "production") (0, _v_c_util.warning)(false, "`scroll.y` in virtual table must be number.");
|
|
27
|
-
return 500;
|
|
28
|
-
}
|
|
29
|
-
return scrollY;
|
|
30
|
-
});
|
|
31
|
-
const getComponent = (path, defaultComponent) => {
|
|
32
|
-
return (0, _v_c_util.get)(props.components, path) || defaultComponent;
|
|
33
|
-
};
|
|
34
|
-
const onTablePropScroll = (event) => {
|
|
35
|
-
props.onScroll?.(event);
|
|
36
|
-
};
|
|
37
|
-
const staticContext = (0, vue.reactive)({
|
|
38
|
-
scrollY: mergedScrollY.value,
|
|
39
|
-
listItemHeight: props.listItemHeight,
|
|
40
|
-
sticky: props.sticky,
|
|
41
|
-
getComponent,
|
|
42
|
-
onScroll: onTablePropScroll
|
|
43
|
-
});
|
|
44
|
-
require_context.useProvideStaticContext(staticContext);
|
|
45
|
-
(0, vue.watchEffect)(() => {
|
|
46
|
-
staticContext.scrollY = mergedScrollY.value;
|
|
47
|
-
staticContext.listItemHeight = props.listItemHeight;
|
|
48
|
-
staticContext.sticky = props.sticky;
|
|
49
|
-
});
|
|
50
|
-
expose({
|
|
51
|
-
get nativeElement() {
|
|
52
|
-
return tableRef.value?.nativeElement;
|
|
53
|
-
},
|
|
54
|
-
scrollTo: (config) => {
|
|
55
|
-
bodyRef.value?.scrollTo?.(config);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
return () => {
|
|
59
|
-
const { scroll, listItemHeight, components, ...restProps } = props;
|
|
60
|
-
const mergedClassName = (0, _v_c_util.clsx)(restProps.className, `${props.prefixCls || "vc-table"}-virtual`);
|
|
61
|
-
const renderBody = (rawData, info) => {
|
|
62
|
-
return (0, vue.createVNode)(require_BodyGrid.default, {
|
|
63
|
-
"ref": (el) => {
|
|
64
|
-
bodyRef.value = el;
|
|
65
|
-
if (typeof info.ref === "function") info.ref(el);
|
|
66
|
-
else if ((0, vue.isRef)(info.ref)) info.ref.value = el;
|
|
67
|
-
},
|
|
68
|
-
"data": rawData,
|
|
69
|
-
"onScroll": info.onScroll
|
|
70
|
-
}, null);
|
|
71
|
-
};
|
|
72
|
-
return (0, vue.createVNode)(require_Table.default, (0, vue.mergeProps)(attrs, restProps, {
|
|
73
|
-
"className": mergedClassName,
|
|
74
|
-
"scroll": {
|
|
75
|
-
...scroll,
|
|
76
|
-
x: mergedScrollX.value,
|
|
77
|
-
y: mergedScrollY.value
|
|
78
|
-
},
|
|
79
|
-
"components": {
|
|
80
|
-
...components || {},
|
|
81
|
-
body: props.data?.length ? renderBody : void 0
|
|
82
|
-
},
|
|
83
|
-
"internalHooks": require_constant.INTERNAL_HOOKS,
|
|
84
|
-
"tailor": true,
|
|
85
|
-
"ref": tableRef
|
|
86
|
-
}), { default: () => [slots.default?.()] });
|
|
87
|
-
};
|
|
88
|
-
}, { props: {
|
|
89
|
-
listItemHeight: {
|
|
90
|
-
type: Number,
|
|
91
|
-
required: false,
|
|
92
|
-
default: void 0
|
|
93
|
-
},
|
|
94
|
-
scroll: {
|
|
95
|
-
type: Object,
|
|
96
|
-
required: true,
|
|
97
|
-
default: void 0
|
|
98
|
-
},
|
|
99
|
-
prefixCls: {
|
|
100
|
-
type: String,
|
|
101
|
-
required: false,
|
|
102
|
-
default: void 0
|
|
103
|
-
},
|
|
104
|
-
className: {
|
|
105
|
-
type: String,
|
|
106
|
-
required: false,
|
|
107
|
-
default: void 0
|
|
108
|
-
},
|
|
109
|
-
style: {
|
|
110
|
-
type: Object,
|
|
111
|
-
required: false,
|
|
112
|
-
default: void 0
|
|
113
|
-
},
|
|
114
|
-
classNames: {
|
|
115
|
-
type: Object,
|
|
116
|
-
required: false,
|
|
117
|
-
default: void 0
|
|
118
|
-
},
|
|
119
|
-
styles: {
|
|
120
|
-
type: Object,
|
|
121
|
-
required: false,
|
|
122
|
-
default: void 0
|
|
123
|
-
},
|
|
124
|
-
data: {
|
|
125
|
-
type: Array,
|
|
126
|
-
required: false,
|
|
127
|
-
default: void 0
|
|
128
|
-
},
|
|
129
|
-
columns: {
|
|
130
|
-
type: Array,
|
|
131
|
-
required: false,
|
|
132
|
-
default: void 0
|
|
133
|
-
},
|
|
134
|
-
rowKey: {
|
|
135
|
-
type: [String, Function],
|
|
136
|
-
required: false,
|
|
137
|
-
skipCheck: true,
|
|
138
|
-
default: void 0
|
|
139
|
-
},
|
|
140
|
-
tableLayout: {
|
|
141
|
-
type: String,
|
|
142
|
-
required: false,
|
|
143
|
-
default: void 0
|
|
144
|
-
},
|
|
145
|
-
expandable: {
|
|
146
|
-
type: Object,
|
|
147
|
-
required: false,
|
|
148
|
-
default: void 0
|
|
149
|
-
},
|
|
150
|
-
indentSize: {
|
|
151
|
-
type: Number,
|
|
152
|
-
required: false,
|
|
153
|
-
default: void 0
|
|
154
|
-
},
|
|
155
|
-
rowClassName: {
|
|
156
|
-
type: [String, Function],
|
|
157
|
-
required: false,
|
|
158
|
-
default: void 0
|
|
159
|
-
},
|
|
160
|
-
title: {
|
|
161
|
-
type: Function,
|
|
162
|
-
required: false,
|
|
163
|
-
default: void 0
|
|
164
|
-
},
|
|
165
|
-
footer: {
|
|
166
|
-
type: Function,
|
|
167
|
-
required: false,
|
|
168
|
-
default: void 0
|
|
169
|
-
},
|
|
170
|
-
summary: {
|
|
171
|
-
type: Function,
|
|
172
|
-
required: false,
|
|
173
|
-
default: void 0
|
|
174
|
-
},
|
|
175
|
-
headerCell: {
|
|
176
|
-
type: Function,
|
|
177
|
-
required: false,
|
|
178
|
-
default: void 0
|
|
179
|
-
},
|
|
180
|
-
bodyCell: {
|
|
181
|
-
type: Function,
|
|
182
|
-
required: false,
|
|
183
|
-
default: void 0
|
|
184
|
-
},
|
|
185
|
-
caption: {
|
|
186
|
-
required: false,
|
|
187
|
-
default: void 0
|
|
188
|
-
},
|
|
189
|
-
id: {
|
|
190
|
-
type: String,
|
|
191
|
-
required: false,
|
|
192
|
-
default: void 0
|
|
193
|
-
},
|
|
194
|
-
showHeader: {
|
|
195
|
-
type: Boolean,
|
|
196
|
-
required: false,
|
|
197
|
-
default: void 0
|
|
198
|
-
},
|
|
199
|
-
components: {
|
|
200
|
-
type: Object,
|
|
201
|
-
required: false,
|
|
202
|
-
default: void 0
|
|
203
|
-
},
|
|
204
|
-
onRow: {
|
|
205
|
-
type: Function,
|
|
206
|
-
required: false,
|
|
207
|
-
default: void 0
|
|
208
|
-
},
|
|
209
|
-
onHeaderRow: {
|
|
210
|
-
type: Function,
|
|
211
|
-
required: false,
|
|
212
|
-
default: void 0
|
|
213
|
-
},
|
|
214
|
-
emptyText: {
|
|
215
|
-
type: Function,
|
|
216
|
-
required: false,
|
|
217
|
-
skipCheck: true,
|
|
218
|
-
default: void 0
|
|
219
|
-
},
|
|
220
|
-
direction: {
|
|
221
|
-
type: String,
|
|
222
|
-
required: false,
|
|
223
|
-
default: void 0
|
|
224
|
-
},
|
|
225
|
-
sticky: {
|
|
226
|
-
type: [Boolean, Object],
|
|
227
|
-
required: false,
|
|
228
|
-
default: void 0
|
|
229
|
-
},
|
|
230
|
-
rowHoverable: {
|
|
231
|
-
type: Boolean,
|
|
232
|
-
required: false,
|
|
233
|
-
default: void 0
|
|
234
|
-
},
|
|
235
|
-
onScroll: {
|
|
236
|
-
type: Function,
|
|
237
|
-
required: false,
|
|
238
|
-
default: void 0
|
|
239
|
-
},
|
|
240
|
-
internalHooks: {
|
|
241
|
-
type: String,
|
|
242
|
-
required: false,
|
|
243
|
-
default: void 0
|
|
244
|
-
},
|
|
245
|
-
transformColumns: {
|
|
246
|
-
type: Function,
|
|
247
|
-
required: false,
|
|
248
|
-
default: void 0
|
|
249
|
-
},
|
|
250
|
-
tailor: {
|
|
251
|
-
type: Boolean,
|
|
252
|
-
required: false,
|
|
253
|
-
default: void 0
|
|
254
|
-
},
|
|
255
|
-
getContainerWidth: {
|
|
256
|
-
type: Function,
|
|
257
|
-
required: false,
|
|
258
|
-
default: void 0
|
|
259
|
-
},
|
|
260
|
-
internalRefs: {
|
|
261
|
-
type: Object,
|
|
262
|
-
required: false,
|
|
263
|
-
default: void 0
|
|
264
|
-
},
|
|
265
|
-
measureRowRender: {
|
|
266
|
-
type: Function,
|
|
267
|
-
required: false,
|
|
268
|
-
default: void 0
|
|
269
|
-
},
|
|
270
|
-
getPopupContainer: {
|
|
271
|
-
type: Function,
|
|
272
|
-
required: false,
|
|
273
|
-
default: void 0
|
|
274
|
-
},
|
|
275
|
-
"onUpdate:expandedRowKeys": {
|
|
276
|
-
type: Function,
|
|
277
|
-
required: false,
|
|
278
|
-
default: void 0
|
|
279
|
-
},
|
|
280
|
-
expandedRowKeys: {
|
|
281
|
-
type: Array,
|
|
282
|
-
required: false,
|
|
283
|
-
default: void 0
|
|
284
|
-
},
|
|
285
|
-
defaultExpandedRowKeys: {
|
|
286
|
-
type: Array,
|
|
287
|
-
required: false,
|
|
288
|
-
default: void 0
|
|
289
|
-
},
|
|
290
|
-
expandedRowRender: {
|
|
291
|
-
type: Function,
|
|
292
|
-
required: false,
|
|
293
|
-
default: void 0
|
|
294
|
-
},
|
|
295
|
-
expandRowByClick: {
|
|
296
|
-
type: Boolean,
|
|
297
|
-
required: false,
|
|
298
|
-
default: void 0
|
|
299
|
-
},
|
|
300
|
-
expandIcon: {
|
|
301
|
-
type: Function,
|
|
302
|
-
required: false,
|
|
303
|
-
default: void 0
|
|
304
|
-
},
|
|
305
|
-
onExpand: {
|
|
306
|
-
type: Function,
|
|
307
|
-
required: false,
|
|
308
|
-
default: void 0
|
|
309
|
-
},
|
|
310
|
-
onExpandedRowsChange: {
|
|
311
|
-
type: Function,
|
|
312
|
-
required: false,
|
|
313
|
-
default: void 0
|
|
314
|
-
},
|
|
315
|
-
defaultExpandAllRows: {
|
|
316
|
-
type: Boolean,
|
|
317
|
-
required: false,
|
|
318
|
-
default: void 0
|
|
319
|
-
},
|
|
320
|
-
expandIconColumnIndex: {
|
|
321
|
-
type: Number,
|
|
322
|
-
required: false,
|
|
323
|
-
default: void 0
|
|
324
|
-
},
|
|
325
|
-
expandedRowClassName: {
|
|
326
|
-
type: Function,
|
|
327
|
-
required: false,
|
|
328
|
-
default: void 0
|
|
329
|
-
},
|
|
330
|
-
childrenColumnName: {
|
|
331
|
-
type: String,
|
|
332
|
-
required: false,
|
|
333
|
-
default: void 0
|
|
334
|
-
}
|
|
335
|
-
} });
|
|
336
|
-
var VirtualTable_default = VirtualTable;
|
|
337
|
-
exports.default = VirtualTable_default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
9
|
-
key = keys[i];
|
|
10
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
-
get: ((k) => from[k]).bind(null, key),
|
|
12
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
-
value: mod,
|
|
19
|
-
enumerable: true
|
|
20
|
-
}) : target, mod));
|
|
21
|
-
exports.__toESM = __toESM;
|
package/dist/constant.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
var defaultPerfRecord = { renderWithProps: false };
|
|
5
|
-
var PerfContextKey = Symbol("TablePerfContext");
|
|
6
|
-
function useProvidePerfContext(record = (0, vue.reactive)({ ...defaultPerfRecord })) {
|
|
7
|
-
(0, vue.provide)(PerfContextKey, record);
|
|
8
|
-
return record;
|
|
9
|
-
}
|
|
10
|
-
function useInjectPerfContext() {
|
|
11
|
-
return (0, vue.inject)(PerfContextKey, defaultPerfRecord);
|
|
12
|
-
}
|
|
13
|
-
exports.useInjectPerfContext = useInjectPerfContext;
|
|
14
|
-
exports.useProvidePerfContext = useProvidePerfContext;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
const TableContextKey = Symbol("TableContextProps");
|
|
5
|
-
function useProvideTableContext(props) {
|
|
6
|
-
(0, vue.provide)(TableContextKey, props);
|
|
7
|
-
}
|
|
8
|
-
function useInjectTableContext() {
|
|
9
|
-
return (0, vue.inject)(TableContextKey, {});
|
|
10
|
-
}
|
|
11
|
-
const makeImmutable = (component, _shouldTriggerRender) => component;
|
|
12
|
-
const responseImmutable = (component) => component;
|
|
13
|
-
function useImmutableMark() {
|
|
14
|
-
return (0, vue.ref)(0);
|
|
15
|
-
}
|
|
16
|
-
exports.TableContextKey = TableContextKey;
|
|
17
|
-
exports.makeImmutable = makeImmutable;
|
|
18
|
-
exports.responseImmutable = responseImmutable;
|
|
19
|
-
exports.useImmutableMark = useImmutableMark;
|
|
20
|
-
exports.useInjectTableContext = useInjectTableContext;
|
|
21
|
-
exports.useProvideTableContext = useProvideTableContext;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_legacyUtil = require("../../utils/legacyUtil.cjs");
|
|
7
|
-
const require_constant = require("../../constant.cjs");
|
|
8
|
-
const require_useWidthColumns = require("./useWidthColumns.cjs");
|
|
9
|
-
let vue = require("vue");
|
|
10
|
-
let _v_c_util = require("@v-c/util");
|
|
11
|
-
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
12
|
-
function convertChildrenToColumns(children) {
|
|
13
|
-
return (0, _v_c_util_dist_props_util.flattenChildren)(children).filter((node) => (0, vue.isVNode)(node)).map((node) => {
|
|
14
|
-
const { key, props, children: nodeChildren } = node;
|
|
15
|
-
const column = {
|
|
16
|
-
key,
|
|
17
|
-
...props || {}
|
|
18
|
-
};
|
|
19
|
-
if (nodeChildren?.default) column.children = convertChildrenToColumns(nodeChildren.default());
|
|
20
|
-
return column;
|
|
21
|
-
}).filter(Boolean);
|
|
22
|
-
}
|
|
23
|
-
function filterHiddenColumns(columns) {
|
|
24
|
-
return columns.filter((column) => column && typeof column === "object" && !column.hidden).map((column) => {
|
|
25
|
-
const subColumns = column.children;
|
|
26
|
-
if (subColumns && subColumns.length > 0) return {
|
|
27
|
-
...column,
|
|
28
|
-
children: filterHiddenColumns(subColumns)
|
|
29
|
-
};
|
|
30
|
-
return column;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function flatColumns(columns, parentKey = "key") {
|
|
34
|
-
return columns.filter((column) => column && typeof column === "object").reduce((list, column, index) => {
|
|
35
|
-
const { fixed } = column;
|
|
36
|
-
const parsedFixed = fixed === true || fixed === "left" ? "start" : fixed === "right" ? "end" : fixed;
|
|
37
|
-
const mergedKey = `${parentKey}-${index}`;
|
|
38
|
-
const subColumns = column.children;
|
|
39
|
-
if (subColumns && subColumns.length > 0) return [...list, ...flatColumns(subColumns, mergedKey).map((subColumn) => ({
|
|
40
|
-
...subColumn,
|
|
41
|
-
fixed: subColumn.fixed ?? parsedFixed
|
|
42
|
-
}))];
|
|
43
|
-
return [...list, {
|
|
44
|
-
key: mergedKey,
|
|
45
|
-
...column,
|
|
46
|
-
fixed: parsedFixed
|
|
47
|
-
}];
|
|
48
|
-
}, []);
|
|
49
|
-
}
|
|
50
|
-
function useColumns(options, transformColumns) {
|
|
51
|
-
const baseColumns = (0, vue.computed)(() => {
|
|
52
|
-
return filterHiddenColumns(((0, vue.unref)(options.columns) || convertChildrenToColumns(options.children) || []).slice());
|
|
53
|
-
});
|
|
54
|
-
const withExpandColumns = (0, vue.computed)(() => {
|
|
55
|
-
if ((0, vue.unref)(options.expandable)) {
|
|
56
|
-
let cloneColumns = baseColumns.value.slice();
|
|
57
|
-
const expandIconColumnIndex = (0, vue.unref)(options.expandIconColumnIndex);
|
|
58
|
-
if (process.env.NODE_ENV !== "production" && expandIconColumnIndex !== void 0) (0, _v_c_util.warning)(false, "`expandIconColumnIndex` is deprecated. Please use `Table.EXPAND_COLUMN` in `columns` instead.");
|
|
59
|
-
if (!cloneColumns.includes(require_constant.EXPAND_COLUMN)) {
|
|
60
|
-
const expandColIndex = expandIconColumnIndex || 0;
|
|
61
|
-
const fixed$1 = (0, vue.unref)(options.fixed);
|
|
62
|
-
const insertIndex = expandColIndex === 0 && (fixed$1 === "right" || fixed$1 === "end") ? baseColumns.value.length : expandColIndex;
|
|
63
|
-
if (insertIndex >= 0) cloneColumns.splice(insertIndex, 0, require_constant.EXPAND_COLUMN);
|
|
64
|
-
}
|
|
65
|
-
if (process.env.NODE_ENV !== "production" && cloneColumns.filter((c) => c === require_constant.EXPAND_COLUMN).length > 1) (0, _v_c_util.warning)(false, "There exist more than one `EXPAND_COLUMN` in `columns`.");
|
|
66
|
-
const expandColumnIndex = cloneColumns.indexOf(require_constant.EXPAND_COLUMN);
|
|
67
|
-
cloneColumns = cloneColumns.filter((column, index) => column !== require_constant.EXPAND_COLUMN || index === expandColumnIndex);
|
|
68
|
-
const prevColumn = baseColumns.value[expandColumnIndex];
|
|
69
|
-
let fixedColumn;
|
|
70
|
-
const fixed = (0, vue.unref)(options.fixed);
|
|
71
|
-
if (fixed) fixedColumn = fixed;
|
|
72
|
-
else fixedColumn = prevColumn?.fixed;
|
|
73
|
-
const prefixCls = (0, vue.unref)(options.prefixCls) || "";
|
|
74
|
-
const expandColumn = {
|
|
75
|
-
[require_legacyUtil.INTERNAL_COL_DEFINE]: {
|
|
76
|
-
className: `${prefixCls}-expand-icon-col`,
|
|
77
|
-
columnType: "EXPAND_COLUMN"
|
|
78
|
-
},
|
|
79
|
-
title: (0, vue.unref)(options.columnTitle),
|
|
80
|
-
fixed: fixedColumn,
|
|
81
|
-
className: `${prefixCls}-row-expand-icon-cell`,
|
|
82
|
-
width: (0, vue.unref)(options.columnWidth),
|
|
83
|
-
render: (_, record, index) => {
|
|
84
|
-
const rowKey = (0, vue.unref)(options.getRowKey)(record, index);
|
|
85
|
-
const expanded = (0, vue.unref)(options.expandedKeys).has(rowKey);
|
|
86
|
-
const rowExpandable = (0, vue.unref)(options.rowExpandable);
|
|
87
|
-
const recordExpandable = rowExpandable ? rowExpandable(record) : true;
|
|
88
|
-
const expandIcon = (0, vue.unref)(options.expandIcon);
|
|
89
|
-
const icon = expandIcon ? expandIcon({
|
|
90
|
-
prefixCls,
|
|
91
|
-
expanded,
|
|
92
|
-
expandable: recordExpandable,
|
|
93
|
-
record,
|
|
94
|
-
onExpand: options.onTriggerExpand
|
|
95
|
-
}) : null;
|
|
96
|
-
if ((0, vue.unref)(options.expandRowByClick)) return (0, vue.createVNode)("span", { "onClick": (e) => e.stopPropagation() }, [icon]);
|
|
97
|
-
return icon;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
return cloneColumns.map((col, index) => {
|
|
101
|
-
const column = col === require_constant.EXPAND_COLUMN ? expandColumn : col;
|
|
102
|
-
if ((options.expandedRowOffset || 0) && index < (options.expandedRowOffset || 0)) return {
|
|
103
|
-
...column,
|
|
104
|
-
fixed: column.fixed || "start"
|
|
105
|
-
};
|
|
106
|
-
return column;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
if (process.env.NODE_ENV !== "production" && baseColumns.value.includes(require_constant.EXPAND_COLUMN)) (0, _v_c_util.warning)(false, "`expandable` is not config but there exist `EXPAND_COLUMN` in `columns`.");
|
|
110
|
-
return baseColumns.value.filter((col) => col !== require_constant.EXPAND_COLUMN);
|
|
111
|
-
});
|
|
112
|
-
const mergedColumns = (0, vue.computed)(() => {
|
|
113
|
-
let finalColumns = withExpandColumns.value;
|
|
114
|
-
const transform = (0, vue.unref)(transformColumns);
|
|
115
|
-
if (transform) finalColumns = transform(finalColumns);
|
|
116
|
-
if (!finalColumns.length) finalColumns = [{ render: () => null }];
|
|
117
|
-
return finalColumns;
|
|
118
|
-
});
|
|
119
|
-
const widthColumns = require_useWidthColumns.default((0, vue.computed)(() => flatColumns(mergedColumns.value)), options.scrollWidth, options.clientWidth);
|
|
120
|
-
return [
|
|
121
|
-
mergedColumns,
|
|
122
|
-
(0, vue.computed)(() => widthColumns.value[0]),
|
|
123
|
-
(0, vue.computed)(() => widthColumns.value[1])
|
|
124
|
-
];
|
|
125
|
-
}
|
|
126
|
-
exports.convertChildrenToColumns = convertChildrenToColumns;
|
|
127
|
-
exports.default = useColumns;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function parseColWidth(totalWidth, width = "") {
|
|
8
|
-
if (typeof width === "number") return width;
|
|
9
|
-
if (typeof width === "string" && width.endsWith("%")) return totalWidth * parseFloat(width) / 100;
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
function useWidthColumns(flattenColumns, scrollWidth, clientWidth) {
|
|
13
|
-
return (0, vue.computed)(() => {
|
|
14
|
-
const mergedColumns = (0, vue.unref)(flattenColumns) || [];
|
|
15
|
-
const mergedScrollWidth = (0, vue.unref)(scrollWidth);
|
|
16
|
-
const mergedClientWidth = (0, vue.unref)(clientWidth);
|
|
17
|
-
if (mergedScrollWidth && mergedScrollWidth > 0) {
|
|
18
|
-
let totalWidth = 0;
|
|
19
|
-
let missWidthCount = 0;
|
|
20
|
-
mergedColumns.forEach((col) => {
|
|
21
|
-
const colWidth = parseColWidth(mergedScrollWidth, col.width);
|
|
22
|
-
if (colWidth) totalWidth += colWidth;
|
|
23
|
-
else missWidthCount += 1;
|
|
24
|
-
});
|
|
25
|
-
const maxFitWidth = Math.max(mergedScrollWidth, mergedClientWidth);
|
|
26
|
-
let restWidth = Math.max(maxFitWidth - totalWidth, missWidthCount);
|
|
27
|
-
let restCount = missWidthCount;
|
|
28
|
-
const avgWidth = restWidth / missWidthCount;
|
|
29
|
-
let realTotal = 0;
|
|
30
|
-
const filledColumns = mergedColumns.map((col) => {
|
|
31
|
-
const clone = { ...col };
|
|
32
|
-
const colWidth = parseColWidth(mergedScrollWidth, clone.width);
|
|
33
|
-
if (colWidth) clone.width = colWidth;
|
|
34
|
-
else {
|
|
35
|
-
const colAvgWidth = Math.floor(avgWidth);
|
|
36
|
-
clone.width = restCount === 1 ? restWidth : colAvgWidth;
|
|
37
|
-
restWidth -= colAvgWidth;
|
|
38
|
-
restCount -= 1;
|
|
39
|
-
}
|
|
40
|
-
realTotal += clone.width;
|
|
41
|
-
return clone;
|
|
42
|
-
});
|
|
43
|
-
if (realTotal < maxFitWidth) {
|
|
44
|
-
const scale = maxFitWidth / realTotal;
|
|
45
|
-
restWidth = maxFitWidth;
|
|
46
|
-
filledColumns.forEach((col, index) => {
|
|
47
|
-
const colWidth = Math.floor(col.width * scale);
|
|
48
|
-
col.width = index === filledColumns.length - 1 ? restWidth : colWidth;
|
|
49
|
-
restWidth -= colWidth;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return [filledColumns, Math.max(realTotal, maxFitWidth)];
|
|
53
|
-
}
|
|
54
|
-
return [mergedColumns, mergedScrollWidth ?? void 0];
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
exports.default = useWidthColumns;
|
package/dist/hooks/useExpand.cjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_legacyUtil = require("../utils/legacyUtil.cjs");
|
|
7
|
-
const require_expandUtil = require("../utils/expandUtil.cjs");
|
|
8
|
-
const require_constant = require("../constant.cjs");
|
|
9
|
-
let vue = require("vue");
|
|
10
|
-
let _v_c_util = require("@v-c/util");
|
|
11
|
-
function useExpand(props, mergedData, getRowKey) {
|
|
12
|
-
const expandableConfig = (0, vue.computed)(() => require_legacyUtil.getExpandableProps(props));
|
|
13
|
-
const mergedExpandIcon = (0, vue.computed)(() => expandableConfig.value.expandIcon || require_expandUtil.renderExpandIcon);
|
|
14
|
-
const mergedChildrenColumnName = (0, vue.computed)(() => expandableConfig.value.childrenColumnName || "children");
|
|
15
|
-
const expandableType = (0, vue.computed)(() => {
|
|
16
|
-
if (expandableConfig.value.expandedRowRender) return "row";
|
|
17
|
-
const data = (0, vue.unref)(mergedData) || [];
|
|
18
|
-
const childrenKey = mergedChildrenColumnName.value;
|
|
19
|
-
if (props.expandable && props.internalHooks === "vc-table-internal-hook" && props.expandable.__PARENT_RENDER_ICON__ || data.some((record) => record && typeof record === "object" && record[childrenKey])) return "nest";
|
|
20
|
-
return false;
|
|
21
|
-
});
|
|
22
|
-
const innerExpandedKeys = (0, vue.ref)((() => {
|
|
23
|
-
const config = expandableConfig.value;
|
|
24
|
-
if (config.defaultExpandedRowKeys) return [...config.defaultExpandedRowKeys];
|
|
25
|
-
if (config.defaultExpandAllRows) return require_expandUtil.findAllChildrenKeys((0, vue.unref)(mergedData) || [], (0, vue.unref)(getRowKey), mergedChildrenColumnName.value);
|
|
26
|
-
return [];
|
|
27
|
-
})());
|
|
28
|
-
const mergedExpandedKeys = (0, vue.computed)(() => {
|
|
29
|
-
return new Set(expandableConfig.value.expandedRowKeys || innerExpandedKeys.value || []);
|
|
30
|
-
});
|
|
31
|
-
const onTriggerExpand = (record, event) => {
|
|
32
|
-
const data = (0, vue.unref)(mergedData) || [];
|
|
33
|
-
const rowKey = (0, vue.unref)(getRowKey)(record, data.indexOf(record));
|
|
34
|
-
const newExpandedKeys = new Set(mergedExpandedKeys.value);
|
|
35
|
-
const hasKey = newExpandedKeys.has(rowKey);
|
|
36
|
-
if (hasKey) newExpandedKeys.delete(rowKey);
|
|
37
|
-
else newExpandedKeys.add(rowKey);
|
|
38
|
-
innerExpandedKeys.value = Array.from(newExpandedKeys);
|
|
39
|
-
expandableConfig.value.onExpand?.(!hasKey, record);
|
|
40
|
-
expandableConfig.value.onExpandedRowsChange?.(Array.from(newExpandedKeys));
|
|
41
|
-
props["onUpdate:expandedRowKeys"]?.(Array.from(newExpandedKeys));
|
|
42
|
-
event?.stopPropagation?.();
|
|
43
|
-
};
|
|
44
|
-
if (process.env.NODE_ENV !== "production" && expandableConfig.value.expandedRowRender && ((0, vue.unref)(mergedData) || []).some((record) => {
|
|
45
|
-
return Array.isArray(record?.[mergedChildrenColumnName.value]);
|
|
46
|
-
})) (0, _v_c_util.warning)(false, "`expandedRowRender` should not use with nested Table");
|
|
47
|
-
return [
|
|
48
|
-
expandableConfig,
|
|
49
|
-
expandableType,
|
|
50
|
-
mergedExpandedKeys,
|
|
51
|
-
mergedExpandIcon,
|
|
52
|
-
mergedChildrenColumnName,
|
|
53
|
-
onTriggerExpand
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
exports.default = useExpand;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_fixUtil = require("../utils/fixUtil.cjs");
|
|
7
|
-
let vue = require("vue");
|
|
8
|
-
let _v_c_util_dist_isEqual = require("@v-c/util/dist/isEqual");
|
|
9
|
-
_v_c_util_dist_isEqual = require_rolldown_runtime.__toESM(_v_c_util_dist_isEqual);
|
|
10
|
-
let _v_c_util_dist_hooks_useMemo = require("@v-c/util/dist/hooks/useMemo");
|
|
11
|
-
_v_c_util_dist_hooks_useMemo = require_rolldown_runtime.__toESM(_v_c_util_dist_hooks_useMemo);
|
|
12
|
-
function useFixedInfo(flattenColumns, stickyOffsets) {
|
|
13
|
-
const fixedInfoList = (0, vue.computed)(() => {
|
|
14
|
-
const mergedColumns = (0, vue.unref)(flattenColumns) || [];
|
|
15
|
-
const mergedOffsets = (0, vue.unref)(stickyOffsets);
|
|
16
|
-
return mergedColumns.map((_, colIndex) => require_fixUtil.getCellFixedInfo(colIndex, colIndex, mergedColumns, mergedOffsets));
|
|
17
|
-
});
|
|
18
|
-
return (0, _v_c_util_dist_hooks_useMemo.default)(() => fixedInfoList.value, [fixedInfoList], (prev, next) => !(0, _v_c_util_dist_isEqual.default)(prev, next));
|
|
19
|
-
}
|
|
20
|
-
exports.default = useFixedInfo;
|