@vueye-table/styled 3.0.0-alpha.3 → 3.0.0-alpha.5
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/README.md +2 -0
- package/dist/index.d.ts +167 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -19
- package/dist/index.js.map +1 -1
- package/dist/style.css +26 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @vueye-table/styled
|
|
2
2
|
|
|
3
|
+
`VtTable` and `VtGrid` accept opt-in `virtual`, `height`, `rowHeight` and `overscan`. A virtual grid also accepts `virtualColumns` and `columnWidth`; headers and body use the same widths and column slice. The supplied binding retains its pagination choice. See `docs/guide/virtualization.md` and the runnable 100k-record component example.
|
|
4
|
+
|
|
3
5
|
Themed Vue components for vueye-table (`VtTable`, `VtGrid`, `VtToolbar`, `VtSearch`,
|
|
4
6
|
`VtPagination`, `VtPageSize`, `VtColumnVisibility`, `VtStatus`, `VtEmpty`) and a stylesheet
|
|
5
7
|
driven by CSS custom properties, with dark mode and three densities.
|
package/dist/index.d.ts
CHANGED
|
@@ -69,6 +69,30 @@ declare const VtTable: import("vue").DefineComponent<import("vue").ExtractPropTy
|
|
|
69
69
|
readonly type: PropType<"light" | "dark" | undefined>;
|
|
70
70
|
readonly default: undefined;
|
|
71
71
|
};
|
|
72
|
+
virtual: {
|
|
73
|
+
readonly type: PropType<boolean | import("@vueye-table/headless").ComponentVirtualOptions>;
|
|
74
|
+
readonly default: false;
|
|
75
|
+
};
|
|
76
|
+
height: {
|
|
77
|
+
readonly type: PropType<string | undefined>;
|
|
78
|
+
readonly default: undefined;
|
|
79
|
+
};
|
|
80
|
+
rowHeight: {
|
|
81
|
+
readonly type: NumberConstructor;
|
|
82
|
+
readonly default: 40;
|
|
83
|
+
};
|
|
84
|
+
overscan: {
|
|
85
|
+
readonly type: NumberConstructor;
|
|
86
|
+
readonly default: 5;
|
|
87
|
+
};
|
|
88
|
+
virtualColumns: {
|
|
89
|
+
readonly type: BooleanConstructor;
|
|
90
|
+
readonly default: false;
|
|
91
|
+
};
|
|
92
|
+
columnWidth: {
|
|
93
|
+
readonly type: NumberConstructor;
|
|
94
|
+
readonly default: 120;
|
|
95
|
+
};
|
|
72
96
|
table: {
|
|
73
97
|
type: PropType<AnyDataTableBinding>;
|
|
74
98
|
required: true;
|
|
@@ -104,6 +128,30 @@ declare const VtTable: import("vue").DefineComponent<import("vue").ExtractPropTy
|
|
|
104
128
|
readonly type: PropType<"light" | "dark" | undefined>;
|
|
105
129
|
readonly default: undefined;
|
|
106
130
|
};
|
|
131
|
+
virtual: {
|
|
132
|
+
readonly type: PropType<boolean | import("@vueye-table/headless").ComponentVirtualOptions>;
|
|
133
|
+
readonly default: false;
|
|
134
|
+
};
|
|
135
|
+
height: {
|
|
136
|
+
readonly type: PropType<string | undefined>;
|
|
137
|
+
readonly default: undefined;
|
|
138
|
+
};
|
|
139
|
+
rowHeight: {
|
|
140
|
+
readonly type: NumberConstructor;
|
|
141
|
+
readonly default: 40;
|
|
142
|
+
};
|
|
143
|
+
overscan: {
|
|
144
|
+
readonly type: NumberConstructor;
|
|
145
|
+
readonly default: 5;
|
|
146
|
+
};
|
|
147
|
+
virtualColumns: {
|
|
148
|
+
readonly type: BooleanConstructor;
|
|
149
|
+
readonly default: false;
|
|
150
|
+
};
|
|
151
|
+
columnWidth: {
|
|
152
|
+
readonly type: NumberConstructor;
|
|
153
|
+
readonly default: 120;
|
|
154
|
+
};
|
|
107
155
|
table: {
|
|
108
156
|
type: PropType<AnyDataTableBinding>;
|
|
109
157
|
required: true;
|
|
@@ -116,15 +164,78 @@ declare const VtTable: import("vue").DefineComponent<import("vue").ExtractPropTy
|
|
|
116
164
|
stickyHeader: boolean;
|
|
117
165
|
loading: boolean;
|
|
118
166
|
theme: "light" | "dark" | undefined;
|
|
167
|
+
virtual: boolean | import("@vueye-table/headless").ComponentVirtualOptions;
|
|
168
|
+
height: string | undefined;
|
|
169
|
+
rowHeight: number;
|
|
170
|
+
overscan: number;
|
|
171
|
+
virtualColumns: boolean;
|
|
172
|
+
columnWidth: number;
|
|
119
173
|
}, SlotsType<{
|
|
120
174
|
default?: (props: {
|
|
121
175
|
table: DataTableBinding<unknown>;
|
|
122
176
|
}) => VNode[];
|
|
123
177
|
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
124
178
|
/** The styled body, with the empty state in a full-width row. */
|
|
125
|
-
declare const VtBody: import("vue").DefineComponent<
|
|
179
|
+
declare const VtBody: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
180
|
+
virtual: {
|
|
181
|
+
readonly type: PropType<boolean | import("@vueye-table/headless").ComponentVirtualOptions>;
|
|
182
|
+
readonly default: false;
|
|
183
|
+
};
|
|
184
|
+
height: {
|
|
185
|
+
readonly type: PropType<string | undefined>;
|
|
186
|
+
readonly default: undefined;
|
|
187
|
+
};
|
|
188
|
+
rowHeight: {
|
|
189
|
+
readonly type: NumberConstructor;
|
|
190
|
+
readonly default: 40;
|
|
191
|
+
};
|
|
192
|
+
overscan: {
|
|
193
|
+
readonly type: NumberConstructor;
|
|
194
|
+
readonly default: 5;
|
|
195
|
+
};
|
|
196
|
+
virtualColumns: {
|
|
197
|
+
readonly type: BooleanConstructor;
|
|
198
|
+
readonly default: false;
|
|
199
|
+
};
|
|
200
|
+
columnWidth: {
|
|
201
|
+
readonly type: NumberConstructor;
|
|
202
|
+
readonly default: 120;
|
|
203
|
+
};
|
|
204
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
126
205
|
[key: string]: any;
|
|
127
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
206
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
207
|
+
virtual: {
|
|
208
|
+
readonly type: PropType<boolean | import("@vueye-table/headless").ComponentVirtualOptions>;
|
|
209
|
+
readonly default: false;
|
|
210
|
+
};
|
|
211
|
+
height: {
|
|
212
|
+
readonly type: PropType<string | undefined>;
|
|
213
|
+
readonly default: undefined;
|
|
214
|
+
};
|
|
215
|
+
rowHeight: {
|
|
216
|
+
readonly type: NumberConstructor;
|
|
217
|
+
readonly default: 40;
|
|
218
|
+
};
|
|
219
|
+
overscan: {
|
|
220
|
+
readonly type: NumberConstructor;
|
|
221
|
+
readonly default: 5;
|
|
222
|
+
};
|
|
223
|
+
virtualColumns: {
|
|
224
|
+
readonly type: BooleanConstructor;
|
|
225
|
+
readonly default: false;
|
|
226
|
+
};
|
|
227
|
+
columnWidth: {
|
|
228
|
+
readonly type: NumberConstructor;
|
|
229
|
+
readonly default: 120;
|
|
230
|
+
};
|
|
231
|
+
}>> & Readonly<{}>, {
|
|
232
|
+
virtual: boolean | import("@vueye-table/headless").ComponentVirtualOptions;
|
|
233
|
+
height: string | undefined;
|
|
234
|
+
rowHeight: number;
|
|
235
|
+
overscan: number;
|
|
236
|
+
virtualColumns: boolean;
|
|
237
|
+
columnWidth: number;
|
|
238
|
+
}, SlotsType<{
|
|
128
239
|
default?: (props: {
|
|
129
240
|
rows: readonly TableRow<unknown>[];
|
|
130
241
|
}) => VNode[];
|
|
@@ -293,6 +404,30 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
|
|
|
293
404
|
readonly type: PropType<"light" | "dark" | undefined>;
|
|
294
405
|
readonly default: undefined;
|
|
295
406
|
};
|
|
407
|
+
virtual: {
|
|
408
|
+
readonly type: PropType<boolean | import("@vueye-table/headless").ComponentVirtualOptions>;
|
|
409
|
+
readonly default: false;
|
|
410
|
+
};
|
|
411
|
+
height: {
|
|
412
|
+
readonly type: PropType<string | undefined>;
|
|
413
|
+
readonly default: undefined;
|
|
414
|
+
};
|
|
415
|
+
rowHeight: {
|
|
416
|
+
readonly type: NumberConstructor;
|
|
417
|
+
readonly default: 40;
|
|
418
|
+
};
|
|
419
|
+
overscan: {
|
|
420
|
+
readonly type: NumberConstructor;
|
|
421
|
+
readonly default: 5;
|
|
422
|
+
};
|
|
423
|
+
virtualColumns: {
|
|
424
|
+
readonly type: BooleanConstructor;
|
|
425
|
+
readonly default: false;
|
|
426
|
+
};
|
|
427
|
+
columnWidth: {
|
|
428
|
+
readonly type: NumberConstructor;
|
|
429
|
+
readonly default: 120;
|
|
430
|
+
};
|
|
296
431
|
table: {
|
|
297
432
|
type: PropType<AnyDataTableBinding>;
|
|
298
433
|
required: true;
|
|
@@ -340,6 +475,30 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
|
|
|
340
475
|
readonly type: PropType<"light" | "dark" | undefined>;
|
|
341
476
|
readonly default: undefined;
|
|
342
477
|
};
|
|
478
|
+
virtual: {
|
|
479
|
+
readonly type: PropType<boolean | import("@vueye-table/headless").ComponentVirtualOptions>;
|
|
480
|
+
readonly default: false;
|
|
481
|
+
};
|
|
482
|
+
height: {
|
|
483
|
+
readonly type: PropType<string | undefined>;
|
|
484
|
+
readonly default: undefined;
|
|
485
|
+
};
|
|
486
|
+
rowHeight: {
|
|
487
|
+
readonly type: NumberConstructor;
|
|
488
|
+
readonly default: 40;
|
|
489
|
+
};
|
|
490
|
+
overscan: {
|
|
491
|
+
readonly type: NumberConstructor;
|
|
492
|
+
readonly default: 5;
|
|
493
|
+
};
|
|
494
|
+
virtualColumns: {
|
|
495
|
+
readonly type: BooleanConstructor;
|
|
496
|
+
readonly default: false;
|
|
497
|
+
};
|
|
498
|
+
columnWidth: {
|
|
499
|
+
readonly type: NumberConstructor;
|
|
500
|
+
readonly default: 120;
|
|
501
|
+
};
|
|
343
502
|
table: {
|
|
344
503
|
type: PropType<AnyDataTableBinding>;
|
|
345
504
|
required: true;
|
|
@@ -365,6 +524,12 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
|
|
|
365
524
|
stickyHeader: boolean;
|
|
366
525
|
loading: boolean;
|
|
367
526
|
theme: "light" | "dark" | undefined;
|
|
527
|
+
virtual: boolean | import("@vueye-table/headless").ComponentVirtualOptions;
|
|
528
|
+
height: string | undefined;
|
|
529
|
+
rowHeight: number;
|
|
530
|
+
overscan: number;
|
|
531
|
+
virtualColumns: boolean;
|
|
532
|
+
columnWidth: number;
|
|
368
533
|
rowNumbers: boolean;
|
|
369
534
|
columnLetters: boolean;
|
|
370
535
|
}, SlotsType<{
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components.ts","../src/icons.ts","../src/with-class.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components.ts","../src/icons.ts","../src/with-class.ts"],"mappings":";;;;;KAkCY;;cA6DC,+BAAe,8BAAA;;IAEO,MAAA,SAAS;;;;;;;IAAT,MAAA,SAAS;;;;;qCAW1C;;cAGW,wBAAQ,0BAAA,oBAAA,4BAAA;;;GAIoB,2BAAA;IACjC,QAAQ;IACR,MAAM;IACN,aAAa;QACT;;EAEG,eAAM;EACP,cAAM;EACL,UAAC;IAAS,QAAQ;QAA2B;kCA2C1D;;;;;cAMW,uBAAO,8BAAA;;aArIS,MAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;aAOX,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoIE,MAAA,SAAS;;;;;;;aA3IT,MAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;aAOX,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoIE,MAAA,SAAS;;;;;;;;;;;;;;;;;;EAHxB,WAAC;IAAS,OAAO;QAAgC;kCA2B7D;;cAGW,sBAAM,8BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGL,WAAC;IAAS,eAAe;QAA0B;EACrD,cAAM;kCAchB;;cAGW,uBAAO,8BAAA;;;;;;;;;;;;;;;EAEqB,gBAAM;kCAS7C;;cAGW,wBAAQ,0BAAA,oBAAA,4BAAA;;8BAMnB,qCAAA,iDAAA,aAAA,eAAA,oDAAA;;cAGW,0BAAU,8BAAA;;IAGO,MAAA;;;;;;;;;;;IAAA,MAAA;;;;;;;;;;qCAU5B;;;;;cAMW,kCAAkB,8BAAA;;;;;;;;;;;;;;qCAwC7B;cAEW,4BAAY,8BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAAkE;cAC9E,wBAAQ,8BAAA;;;;;;;;;;;;;;;;;;;;;;kCAAsD;;cAG9D,yBAAS,0BAAA,oBAAA,4BAAA;;;EAEmB,gBAAM;kCAI7C;;;;;cA6CW,sBAAM,8BAAA;;aAtUU,MAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;aAOX,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuUE,MAAA,SAAS;;;;IACT,MAAA;;;;;;;;;;;;;;;aA/UA,MAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;aAOX,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuUE,MAAA,SAAS;;;;IACT,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EALb,WAAC,OAAO,4BAA4B;kCAiElD;;;cChbI;;;;;;;;KASM,wBAAwB;;iBAGpB,KAAK,MAAM,UAAU,qBAAwB;;;;;;;iBCR7C,UAAU,mBAAmB,WAC3C,WAAW,YACX,mBACA,eACC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { columnLabel } from "@vueye-table/core";
|
|
2
|
-
import { DataGridBody, DataGridRoot, DataTableBody, DataTableColumnVisibility, DataTableHeader, DataTableHeaderCell, DataTableHeaderRow, DataTablePageSize, DataTablePagination, DataTableRoot, DataTableSearch, DataTableSortButton, DataTableStatus } from "@vueye-table/headless";
|
|
2
|
+
import { DataGridBody, DataGridRoot, DataTableBody, DataTableColumnVisibility, DataTableHeader, DataTableHeaderCell, DataTableHeaderRow, DataTablePageSize, DataTablePagination, DataTableRoot, DataTableSearch, DataTableSortButton, DataTableStatus, DataTableViewport, DataTableVirtualColumns, injectVirtualRenderer, virtualProps } from "@vueye-table/headless";
|
|
3
3
|
import { injectDataTable } from "@vueye-table/vue";
|
|
4
4
|
import { defineComponent, h, mergeProps } from "vue";
|
|
5
5
|
|
|
@@ -46,6 +46,7 @@ function withClass(component, className, name) {
|
|
|
46
46
|
//#region src/components.ts
|
|
47
47
|
/** Visual options shared by the styled table and grid. */
|
|
48
48
|
const surfaceProps = {
|
|
49
|
+
...virtualProps,
|
|
49
50
|
density: {
|
|
50
51
|
type: String,
|
|
51
52
|
default: "comfortable"
|
|
@@ -83,12 +84,20 @@ function surfaceAttrs(props) {
|
|
|
83
84
|
"data-striped": props.striped ? "" : void 0,
|
|
84
85
|
"data-bordered": props.bordered ? "" : void 0,
|
|
85
86
|
"data-hover": props.hover ? "" : void 0,
|
|
86
|
-
"data-sticky-header": props.stickyHeader ? "" : void 0,
|
|
87
|
+
"data-sticky-header": props.stickyHeader || props.virtual ? "" : void 0,
|
|
88
|
+
"data-virtual": props.virtual ? "" : void 0,
|
|
87
89
|
"data-loading": props.loading ? "" : void 0,
|
|
88
90
|
"data-vt-theme": props.theme,
|
|
89
91
|
"aria-busy": props.loading ? "true" : void 0
|
|
90
92
|
};
|
|
91
93
|
}
|
|
94
|
+
function scroller(props, children) {
|
|
95
|
+
return props.virtual ? h(DataTableViewport, {
|
|
96
|
+
class: "vt-scroll",
|
|
97
|
+
height: props.height ?? "24rem",
|
|
98
|
+
style: { "--vt-row-height": `${props.rowHeight}px` }
|
|
99
|
+
}, { default: () => children }) : h("div", { class: "vt-scroll" }, children);
|
|
100
|
+
}
|
|
92
101
|
/** An arrow showing a column's sort direction and, in a multi-column sort, its priority. */
|
|
93
102
|
const VtSortIndicator = defineComponent({
|
|
94
103
|
name: "VtSortIndicator",
|
|
@@ -110,18 +119,20 @@ const VtHeader = defineComponent({
|
|
|
110
119
|
slots: Object,
|
|
111
120
|
setup(_props, { slots }) {
|
|
112
121
|
const table = injectDataTable("<VtHeader>");
|
|
122
|
+
const virtual = injectVirtualRenderer();
|
|
123
|
+
const headerCell = (column) => h(DataTableHeaderCell, {
|
|
124
|
+
key: column.id,
|
|
125
|
+
column
|
|
126
|
+
}, { default: slots[`header.${column.id}`] ?? (() => column.sortable ? h(DataTableSortButton, {
|
|
127
|
+
column,
|
|
128
|
+
class: "vt-sort-button"
|
|
129
|
+
}, {
|
|
130
|
+
default: () => [slots.header?.({ column }) ?? column.header],
|
|
131
|
+
indicator: ({ sort }) => [h(VtSortIndicator, { sort })]
|
|
132
|
+
}) : [slots.header?.({ column }) ?? column.header]) });
|
|
113
133
|
return () => h(DataTableHeader, { class: "vt-head" }, () => h(DataTableHeaderRow, () => [
|
|
114
134
|
slots.before?.(),
|
|
115
|
-
...
|
|
116
|
-
key: column.id,
|
|
117
|
-
column
|
|
118
|
-
}, { default: slots[`header.${column.id}`] ?? (() => column.sortable ? h(DataTableSortButton, {
|
|
119
|
-
column,
|
|
120
|
-
class: "vt-sort-button"
|
|
121
|
-
}, {
|
|
122
|
-
default: () => [slots.header?.({ column }) ?? column.header],
|
|
123
|
-
indicator: ({ sort }) => [h(VtSortIndicator, { sort })]
|
|
124
|
-
}) : [slots.header?.({ column }) ?? column.header]) })),
|
|
135
|
+
...virtual?.columns ? [h(DataTableVirtualColumns, null, { default: ({ column }) => [headerCell(column)] })] : table.columns.map(headerCell),
|
|
125
136
|
slots.after?.()
|
|
126
137
|
]));
|
|
127
138
|
}
|
|
@@ -144,9 +155,12 @@ const VtTable = defineComponent({
|
|
|
144
155
|
return () => h("div", surfaceAttrs(props), [h("div", {
|
|
145
156
|
class: "vt-progress",
|
|
146
157
|
role: "presentation"
|
|
147
|
-
}),
|
|
158
|
+
}), scroller(props, [h(DataTableRoot, {
|
|
148
159
|
table: props.table,
|
|
149
|
-
class: "vt-table"
|
|
160
|
+
class: "vt-table",
|
|
161
|
+
virtual: props.virtual,
|
|
162
|
+
rowHeight: props.rowHeight,
|
|
163
|
+
overscan: props.overscan
|
|
150
164
|
}, { default: () => slots.default?.({ table: props.table }) ?? [h(VtHeader), h(VtBody)] })])]);
|
|
151
165
|
}
|
|
152
166
|
});
|
|
@@ -154,8 +168,12 @@ const VtTable = defineComponent({
|
|
|
154
168
|
const VtBody = defineComponent({
|
|
155
169
|
name: "VtBody",
|
|
156
170
|
slots: Object,
|
|
157
|
-
|
|
158
|
-
|
|
171
|
+
props: { ...virtualProps },
|
|
172
|
+
setup(props, { slots }) {
|
|
173
|
+
return () => h(DataTableBody, {
|
|
174
|
+
class: "vt-body",
|
|
175
|
+
...props
|
|
176
|
+
}, {
|
|
159
177
|
...slots,
|
|
160
178
|
empty: slots.empty ?? (() => h(VtEmpty))
|
|
161
179
|
});
|
|
@@ -311,7 +329,7 @@ const VtGrid = defineComponent({
|
|
|
311
329
|
},
|
|
312
330
|
...surfaceProps
|
|
313
331
|
},
|
|
314
|
-
setup(props, { slots }) {
|
|
332
|
+
setup(props, { slots, attrs }) {
|
|
315
333
|
const cellSlots = () => {
|
|
316
334
|
const found = {};
|
|
317
335
|
for (const [name, slot] of Object.entries(slots)) if (name.startsWith("cell.") && slot) found[name.slice(5)] = slot;
|
|
@@ -327,10 +345,17 @@ const VtGrid = defineComponent({
|
|
|
327
345
|
return () => h("div", surfaceAttrs(props), [h("div", {
|
|
328
346
|
class: "vt-progress",
|
|
329
347
|
role: "presentation"
|
|
330
|
-
}),
|
|
348
|
+
}), scroller(props, [h(DataGridRoot, {
|
|
331
349
|
table: props.table,
|
|
332
350
|
label: props.label,
|
|
333
|
-
|
|
351
|
+
"aria-describedby": attrs["aria-describedby"],
|
|
352
|
+
class: "vt-table vt-grid",
|
|
353
|
+
virtual: props.virtual,
|
|
354
|
+
virtualColumns: props.virtualColumns,
|
|
355
|
+
rowHeight: props.rowHeight,
|
|
356
|
+
overscan: props.overscan,
|
|
357
|
+
columnWidth: props.columnWidth,
|
|
358
|
+
gutter: props.rowNumbers ? 48 : 0
|
|
334
359
|
}, { default: (slotProps) => slots.default?.(slotProps) ?? [header(), h(GridBody, {
|
|
335
360
|
rowNumbers: props.rowNumbers,
|
|
336
361
|
cells: cellSlots()
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/icons.ts","../src/with-class.ts","../src/components.ts"],"sourcesContent":["import { h, type VNode } from \"vue\";\n\nconst paths = {\n sortNone: \"M7 9l5-5 5 5M7 15l5 5 5-5\",\n sortAsc: \"M7 14l5-5 5 5\",\n sortDesc: \"M7 10l5 5 5-5\",\n search: \"M11 19a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm10 2-4.35-4.35\",\n columns: \"M4 4h6v16H4zM14 4h6v16h-6z\",\n empty: \"M3 7h18M3 12h18M3 17h10\",\n} as const;\n\nexport type IconName = keyof typeof paths;\n\n/** A 24-pixel stroke icon that inherits the text color. */\nexport function icon(name: IconName, className = \"vt-icon\"): VNode {\n return h(\n \"svg\",\n {\n class: className,\n viewBox: \"0 0 24 24\",\n width: 16,\n height: 16,\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-width\": 2,\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n },\n [h(\"path\", { d: paths[name] })],\n );\n}\n","import { h, mergeProps, type Component, type FunctionalComponent } from \"vue\";\n\n/**\n * Wrap a component so it always carries a class. Props, attributes, and slots pass through\n * untouched, so the wrapper keeps the wrapped component's full API.\n */\nexport function withClass<TComponent extends Component>(\n component: TComponent,\n className: string,\n name: string,\n): TComponent {\n const wrapper: FunctionalComponent = (_props, { attrs, slots }) =>\n h(component, mergeProps(attrs, { class: className }), slots);\n wrapper.displayName = name;\n wrapper.inheritAttrs = false;\n return wrapper as unknown as TComponent;\n}\n","import { columnLabel, type SortInfo, type TableColumn, type TableRow } from \"@vueye-table/core\";\nimport {\n DataGridBody,\n DataGridRoot,\n DataTableBody,\n DataTableColumnVisibility,\n DataTableHeader,\n DataTableHeaderCell,\n DataTableHeaderRow,\n DataTablePageSize,\n DataTablePagination,\n DataTableRoot,\n DataTableSearch,\n DataTableSortButton,\n DataTableStatus,\n type GridCellSlotProps,\n} from \"@vueye-table/headless\";\nimport { injectDataTable, type AnyDataTableBinding, type DataTableBinding } from \"@vueye-table/vue\";\nimport {\n defineComponent,\n h,\n type PropType,\n type SlotsType,\n type VNode,\n type VNodeChild,\n} from \"vue\";\n\nimport { icon } from \"./icons\";\nimport { withClass } from \"./with-class\";\n\nexport type Density = \"compact\" | \"comfortable\" | \"spacious\";\n\n/** Visual options shared by the styled table and grid. */\nconst surfaceProps = {\n density: { type: String as PropType<Density>, default: \"comfortable\" },\n striped: { type: Boolean, default: false },\n bordered: { type: Boolean, default: false },\n hover: { type: Boolean, default: true },\n stickyHeader: { type: Boolean, default: false },\n loading: { type: Boolean, default: false },\n /** Force a theme; by default the table follows `prefers-color-scheme`. */\n theme: { type: String as PropType<\"light\" | \"dark\" | undefined>, default: undefined },\n} as const;\n\nfunction surfaceAttrs(props: {\n readonly density: Density;\n readonly striped: boolean;\n readonly bordered: boolean;\n readonly hover: boolean;\n readonly stickyHeader: boolean;\n readonly loading: boolean;\n readonly theme: \"light\" | \"dark\" | undefined;\n}) {\n return {\n class: \"vt-surface\",\n \"data-density\": props.density,\n \"data-striped\": props.striped ? \"\" : undefined,\n \"data-bordered\": props.bordered ? \"\" : undefined,\n \"data-hover\": props.hover ? \"\" : undefined,\n \"data-sticky-header\": props.stickyHeader ? \"\" : undefined,\n \"data-loading\": props.loading ? \"\" : undefined,\n \"data-vt-theme\": props.theme,\n \"aria-busy\": props.loading ? \"true\" : undefined,\n };\n}\n\n/** An arrow showing a column's sort direction and, in a multi-column sort, its priority. */\nexport const VtSortIndicator = defineComponent({\n name: \"VtSortIndicator\",\n props: { sort: { type: Object as PropType<SortInfo | undefined>, default: undefined } },\n setup(props) {\n const table = injectDataTable(\"<VtSortIndicator>\");\n return () =>\n h(\"span\", { class: \"vt-sort-indicator\", \"data-active\": props.sort ? \"\" : undefined }, [\n icon(!props.sort ? \"sortNone\" : props.sort.direction === \"asc\" ? \"sortAsc\" : \"sortDesc\"),\n props.sort && table.state.sorting.length > 1\n ? h(\"span\", { class: \"vt-sort-priority\" }, String(props.sort.priority + 1))\n : null,\n ]);\n },\n});\n\n/** A header row of styled header cells with sort indicators. */\nexport const VtHeader = defineComponent({\n name: \"VtHeader\",\n slots: Object as SlotsType<\n {\n [key: `header.${string}`]: (props: {\n column: TableColumn<unknown>;\n sort: SortInfo | undefined;\n toggleSort: (multi?: boolean) => void;\n }) => VNode[];\n } & {\n before?: () => VNode[];\n after?: () => VNode[];\n header?: (props: { column: TableColumn<unknown> }) => VNodeChild;\n }\n >,\n setup(_props, { slots }) {\n const table = injectDataTable(\"<VtHeader>\");\n return () =>\n h(DataTableHeader, { class: \"vt-head\" }, () =>\n h(DataTableHeaderRow, () => [\n slots.before?.(),\n ...table.columns.map((column) =>\n h(\n DataTableHeaderCell,\n { key: column.id, column },\n {\n default:\n slots[`header.${column.id}`] ??\n (() =>\n column.sortable\n ? h(\n DataTableSortButton,\n { column, class: \"vt-sort-button\" },\n {\n default: () => [slots.header?.({ column }) ?? column.header],\n indicator: ({ sort }: { sort: SortInfo | undefined }) => [\n h(VtSortIndicator, { sort }),\n ],\n },\n )\n : [slots.header?.({ column }) ?? column.header]),\n },\n ),\n ),\n slots.after?.(),\n ]),\n );\n },\n});\n\n/**\n * The styled table surface: a scroll container, a loading bar, and the table. Without a default\n * slot it renders a styled header and body.\n */\nexport const VtTable = defineComponent({\n name: \"VtTable\",\n slots: Object as SlotsType<{\n default?: (props: { table: DataTableBinding<unknown> }) => VNode[];\n }>,\n props: {\n table: { type: Object as PropType<AnyDataTableBinding>, required: true },\n ...surfaceProps,\n },\n setup(props, { slots }) {\n return () =>\n h(\"div\", surfaceAttrs(props), [\n h(\"div\", { class: \"vt-progress\", role: \"presentation\" }),\n h(\"div\", { class: \"vt-scroll\" }, [\n h(\n DataTableRoot,\n { table: props.table, class: \"vt-table\" },\n {\n default: () => slots.default?.({ table: props.table }) ?? [h(VtHeader), h(VtBody)],\n },\n ),\n ]),\n ]);\n },\n});\n\n/** The styled body, with the empty state in a full-width row. */\nexport const VtBody = defineComponent({\n name: \"VtBody\",\n slots: Object as SlotsType<{\n default?: (props: { rows: readonly TableRow<unknown>[] }) => VNode[];\n empty?: () => VNode[];\n }>,\n setup(_props, { slots }) {\n return () =>\n h(\n DataTableBody,\n { class: \"vt-body\" },\n {\n ...slots,\n empty: slots.empty ?? (() => h(VtEmpty)),\n },\n );\n },\n});\n\n/** The default empty state. */\nexport const VtEmpty = defineComponent({\n name: \"VtEmpty\",\n slots: Object as SlotsType<{ default?: () => VNode[] }>,\n props: { text: { type: String, default: \"No matching rows\" } },\n setup(props, { slots }) {\n return () =>\n h(\"div\", { class: \"vt-empty\" }, [\n icon(\"empty\", \"vt-empty-icon\"),\n slots.default?.() ?? props.text,\n ]);\n },\n});\n\n/** A search field with an icon. */\nexport const VtSearch = defineComponent({\n name: \"VtSearch\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => h(\"label\", { class: \"vt-search\" }, [icon(\"search\"), h(DataTableSearch, attrs)]);\n },\n});\n\n/** \"Rows per page\" with a picker. */\nexport const VtPageSize = defineComponent({\n name: \"VtPageSize\",\n props: {\n options: { type: Array as PropType<readonly number[]>, default: () => [5, 10, 20, 50] },\n label: { type: String, default: \"Rows per page\" },\n },\n setup(props) {\n return () =>\n h(\"label\", { class: \"vt-page-size\" }, [\n h(\"span\", props.label),\n h(DataTablePageSize, { options: props.options, label: props.label }),\n ]);\n },\n});\n\n/**\n * A menu of column checkboxes behind a \"Columns\" button. Escape closes it and returns focus to\n * the button, and so does moving focus out of it.\n */\nexport const VtColumnVisibility = defineComponent({\n name: \"VtColumnVisibility\",\n props: { label: { type: String, default: \"Columns\" } },\n setup(props) {\n const close = (menu: HTMLDetailsElement, refocus: boolean): void => {\n if (!menu.open) {\n return;\n }\n menu.open = false;\n if (refocus) {\n menu.querySelector(\"summary\")?.focus();\n }\n };\n return () =>\n h(\n \"details\",\n {\n class: \"vt-menu\",\n onKeydown: (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n close(event.currentTarget as HTMLDetailsElement, true);\n }\n },\n onFocusout: (event: FocusEvent) => {\n const menu = event.currentTarget as HTMLDetailsElement;\n const next = event.relatedTarget as Node | null;\n // Some browsers move no focus when a checkbox label is clicked; only a known\n // destination outside the menu closes it.\n if (next !== null && !menu.contains(next)) {\n close(menu, false);\n }\n },\n },\n [\n h(\"summary\", { class: \"vt-button\" }, [icon(\"columns\"), props.label]),\n h(DataTableColumnVisibility, { as: \"div\", class: \"vt-menu-panel\" }),\n ],\n );\n },\n});\n\nexport const VtPagination = withClass(DataTablePagination, \"vt-pagination\", \"VtPagination\");\nexport const VtStatus = withClass(DataTableStatus, \"vt-status\", \"VtStatus\");\n\n/** A horizontal bar for controls above or below a table. */\nexport const VtToolbar = defineComponent({\n name: \"VtToolbar\",\n slots: Object as SlotsType<{ default?: () => VNode[] }>,\n setup(_props, { slots }) {\n return () => h(\"div\", { class: \"vt-theme vt-toolbar\", role: \"toolbar\" }, slots.default?.());\n },\n});\n\ntype CellSlot = (props: GridCellSlotProps) => VNodeChild;\n\nconst GridBody = defineComponent({\n name: \"VtGridBody\",\n props: {\n rowNumbers: { type: Boolean, default: true },\n /** Content slots per column id, as `cell.<id>` on `<VtGrid>`. */\n cells: {\n type: Object as PropType<Readonly<Record<string, CellSlot | undefined>>>,\n default: () => ({}),\n },\n },\n setup(props) {\n const table = injectDataTable(\"<VtGrid>\");\n return () => {\n const cellSlots = props.cells;\n const hasCellSlots = Object.keys(cellSlots).length > 0;\n return h(\n DataGridBody,\n { class: \"vt-body\" },\n {\n rowHeader: ({ index }: { index: number }) =>\n props.rowNumbers\n ? h(\"th\", { class: \"vt-row-number\", scope: \"row\" }, String(table.pageStart + index))\n : null,\n ...(hasCellSlots\n ? {\n cell: (cellProps: GridCellSlotProps) => {\n const slot = cellSlots[cellProps.column.id];\n return slot ? slot(cellProps) : cellProps.display;\n },\n }\n : {}),\n },\n );\n };\n },\n});\n\n/**\n * The styled spreadsheet grid, with optional row numbers and A, B, C column letters. A\n * `cell.<column id>` slot draws that column's cells while they are not being edited.\n */\nexport const VtGrid = defineComponent({\n name: \"VtGrid\",\n slots: Object as SlotsType<\n { [key: `cell.${string}`]: GridCellSlotProps } & {\n default?: (props: Record<string, unknown>) => VNode[];\n }\n >,\n props: {\n table: { type: Object as PropType<AnyDataTableBinding>, required: true },\n label: { type: String as PropType<string | undefined>, default: undefined },\n rowNumbers: { type: Boolean, default: true },\n columnLetters: { type: Boolean, default: false },\n ...surfaceProps,\n },\n setup(props, { slots }) {\n const cellSlots = (): Record<string, CellSlot> => {\n const found: Record<string, CellSlot> = {};\n for (const [name, slot] of Object.entries(slots)) {\n if (name.startsWith(\"cell.\") && slot) {\n found[name.slice(\"cell.\".length)] = slot as CellSlot;\n }\n }\n return found;\n };\n const header = () =>\n h(VtHeader, null, {\n before: () =>\n props.rowNumbers ? h(\"th\", { class: \"vt-row-number\", \"aria-hidden\": \"true\" }) : null,\n header: ({ column }: { column: TableColumn<unknown> }) =>\n props.columnLetters\n ? [\n h(\n \"span\",\n { class: \"vt-column-letter\" },\n columnLabel(props.table.columns.indexOf(column)),\n ),\n column.header,\n ]\n : column.header,\n });\n return () =>\n h(\"div\", surfaceAttrs(props), [\n h(\"div\", { class: \"vt-progress\", role: \"presentation\" }),\n h(\"div\", { class: \"vt-scroll\" }, [\n h(\n DataGridRoot,\n { table: props.table, label: props.label, class: \"vt-table vt-grid\" },\n {\n default: (slotProps: Record<string, unknown>) =>\n slots.default?.(slotProps) ?? [\n header(),\n h(GridBody, { rowNumbers: props.rowNum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E,QACA,EAAE,OAAO,mBAAmB,GAC5B,YAAY,MAAM,MAAM,QAAQ,QAAQ,MAAM,CAAC,CACjD,GACA,OAAO,MACT,IACA,OAAO;EACf,CAAC;EACH,aACE,EAAE,OAAO,aAAa,KAAK,GAAG,CAC5B,EAAE,OAAO;GAAE,OAAO;GAAe,MAAM;EAAe,CAAC,GACvD,EAAE,OAAO,EAAE,OAAO,YAAY,GAAG,CAC/B,EACE,cACA;GAAE,OAAO,MAAM;GAAO,OAAO,MAAM;GAAO,OAAO;EAAmB,GACpE,EACE,UAAU,cACR,MAAM,UAAU,SAAS,KAAK,CAC5B,OAAO,GACP,EAAE,UAAU;GAAE,YAAY,MAAM;GAAY,OAAO,UAAU;EAAE,CAAC,CAClE,EACJ,CACF,CACF,CAAC,CACH,CAAC;CACL;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/icons.ts","../src/with-class.ts","../src/components.ts"],"sourcesContent":["import { h, type VNode } from \"vue\";\n\nconst paths = {\n sortNone: \"M7 9l5-5 5 5M7 15l5 5 5-5\",\n sortAsc: \"M7 14l5-5 5 5\",\n sortDesc: \"M7 10l5 5 5-5\",\n search: \"M11 19a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm10 2-4.35-4.35\",\n columns: \"M4 4h6v16H4zM14 4h6v16h-6z\",\n empty: \"M3 7h18M3 12h18M3 17h10\",\n} as const;\n\nexport type IconName = keyof typeof paths;\n\n/** A 24-pixel stroke icon that inherits the text color. */\nexport function icon(name: IconName, className = \"vt-icon\"): VNode {\n return h(\n \"svg\",\n {\n class: className,\n viewBox: \"0 0 24 24\",\n width: 16,\n height: 16,\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-width\": 2,\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n },\n [h(\"path\", { d: paths[name] })],\n );\n}\n","import { h, mergeProps, type Component, type FunctionalComponent } from \"vue\";\n\n/**\n * Wrap a component so it always carries a class. Props, attributes, and slots pass through\n * untouched, so the wrapper keeps the wrapped component's full API.\n */\nexport function withClass<TComponent extends Component>(\n component: TComponent,\n className: string,\n name: string,\n): TComponent {\n const wrapper: FunctionalComponent = (_props, { attrs, slots }) =>\n h(component, mergeProps(attrs, { class: className }), slots);\n wrapper.displayName = name;\n wrapper.inheritAttrs = false;\n return wrapper as unknown as TComponent;\n}\n","import { columnLabel, type SortInfo, type TableColumn, type TableRow } from \"@vueye-table/core\";\nimport {\n DataGridBody,\n DataGridRoot,\n DataTableBody,\n DataTableColumnVisibility,\n DataTableHeader,\n DataTableHeaderCell,\n DataTableHeaderRow,\n DataTablePageSize,\n DataTablePagination,\n DataTableRoot,\n DataTableSearch,\n DataTableSortButton,\n DataTableStatus,\n DataTableViewport,\n DataTableVirtualColumns,\n injectVirtualRenderer,\n virtualProps,\n type GridCellSlotProps,\n} from \"@vueye-table/headless\";\nimport { injectDataTable, type AnyDataTableBinding, type DataTableBinding } from \"@vueye-table/vue\";\nimport {\n defineComponent,\n h,\n type PropType,\n type SlotsType,\n type VNode,\n type VNodeChild,\n} from \"vue\";\n\nimport { icon } from \"./icons\";\nimport { withClass } from \"./with-class\";\n\nexport type Density = \"compact\" | \"comfortable\" | \"spacious\";\n\n/** Visual options shared by the styled table and grid. */\nconst surfaceProps = {\n ...virtualProps,\n density: { type: String as PropType<Density>, default: \"comfortable\" },\n striped: { type: Boolean, default: false },\n bordered: { type: Boolean, default: false },\n hover: { type: Boolean, default: true },\n stickyHeader: { type: Boolean, default: false },\n loading: { type: Boolean, default: false },\n /** Force a theme; by default the table follows `prefers-color-scheme`. */\n theme: { type: String as PropType<\"light\" | \"dark\" | undefined>, default: undefined },\n} as const;\n\nfunction surfaceAttrs(props: {\n readonly density: Density;\n readonly striped: boolean;\n readonly bordered: boolean;\n readonly hover: boolean;\n readonly stickyHeader: boolean;\n readonly loading: boolean;\n readonly theme: \"light\" | \"dark\" | undefined;\n readonly virtual: boolean | object;\n}) {\n return {\n class: \"vt-surface\",\n \"data-density\": props.density,\n \"data-striped\": props.striped ? \"\" : undefined,\n \"data-bordered\": props.bordered ? \"\" : undefined,\n \"data-hover\": props.hover ? \"\" : undefined,\n \"data-sticky-header\": props.stickyHeader || props.virtual ? \"\" : undefined,\n \"data-virtual\": props.virtual ? \"\" : undefined,\n \"data-loading\": props.loading ? \"\" : undefined,\n \"data-vt-theme\": props.theme,\n \"aria-busy\": props.loading ? \"true\" : undefined,\n };\n}\n\nfunction scroller(\n props: {\n readonly virtual: boolean | object;\n readonly height: string | undefined;\n readonly rowHeight: number;\n },\n children: VNode[],\n): VNode {\n return props.virtual\n ? h(\n DataTableViewport,\n {\n class: \"vt-scroll\",\n height: props.height ?? \"24rem\",\n style: { \"--vt-row-height\": `${props.rowHeight}px` },\n },\n { default: () => children },\n )\n : h(\"div\", { class: \"vt-scroll\" }, children);\n}\n\n/** An arrow showing a column's sort direction and, in a multi-column sort, its priority. */\nexport const VtSortIndicator = defineComponent({\n name: \"VtSortIndicator\",\n props: { sort: { type: Object as PropType<SortInfo | undefined>, default: undefined } },\n setup(props) {\n const table = injectDataTable(\"<VtSortIndicator>\");\n return () =>\n h(\"span\", { class: \"vt-sort-indicator\", \"data-active\": props.sort ? \"\" : undefined }, [\n icon(!props.sort ? \"sortNone\" : props.sort.direction === \"asc\" ? \"sortAsc\" : \"sortDesc\"),\n props.sort && table.state.sorting.length > 1\n ? h(\"span\", { class: \"vt-sort-priority\" }, String(props.sort.priority + 1))\n : null,\n ]);\n },\n});\n\n/** A header row of styled header cells with sort indicators. */\nexport const VtHeader = defineComponent({\n name: \"VtHeader\",\n slots: Object as SlotsType<\n {\n [key: `header.${string}`]: (props: {\n column: TableColumn<unknown>;\n sort: SortInfo | undefined;\n toggleSort: (multi?: boolean) => void;\n }) => VNode[];\n } & {\n before?: () => VNode[];\n after?: () => VNode[];\n header?: (props: { column: TableColumn<unknown> }) => VNodeChild;\n }\n >,\n setup(_props, { slots }) {\n const table = injectDataTable(\"<VtHeader>\");\n const virtual = injectVirtualRenderer();\n const headerCell = (column: TableColumn<unknown>) =>\n h(\n DataTableHeaderCell,\n { key: column.id, column },\n {\n default:\n slots[`header.${column.id}`] ??\n (() =>\n column.sortable\n ? h(\n DataTableSortButton,\n { column, class: \"vt-sort-button\" },\n {\n default: () => [slots.header?.({ column }) ?? column.header],\n indicator: ({ sort }: { sort: SortInfo | undefined }) => [\n h(VtSortIndicator, { sort }),\n ],\n },\n )\n : [slots.header?.({ column }) ?? column.header]),\n },\n );\n return () =>\n h(DataTableHeader, { class: \"vt-head\" }, () =>\n h(DataTableHeaderRow, () => [\n slots.before?.(),\n ...(virtual?.columns\n ? [\n h(DataTableVirtualColumns, null, {\n default: ({ column }: { column: TableColumn<unknown> }) => [headerCell(column)],\n }),\n ]\n : table.columns.map(headerCell)),\n slots.after?.(),\n ]),\n );\n },\n});\n\n/**\n * The styled table surface: a scroll container, a loading bar, and the table. Without a default\n * slot it renders a styled header and body.\n */\nexport const VtTable = defineComponent({\n name: \"VtTable\",\n slots: Object as SlotsType<{\n default?: (props: { table: DataTableBinding<unknown> }) => VNode[];\n }>,\n props: {\n table: { type: Object as PropType<AnyDataTableBinding>, required: true },\n ...surfaceProps,\n },\n setup(props, { slots }) {\n return () =>\n h(\"div\", surfaceAttrs(props), [\n h(\"div\", { class: \"vt-progress\", role: \"presentation\" }),\n scroller(props, [\n h(\n DataTableRoot,\n {\n table: props.table,\n class: \"vt-table\",\n virtual: props.virtual,\n rowHeight: props.rowHeight,\n overscan: props.overscan,\n },\n {\n default: () => slots.default?.({ table: props.table }) ?? [h(VtHeader), h(VtBody)],\n },\n ),\n ]),\n ]);\n },\n});\n\n/** The styled body, with the empty state in a full-width row. */\nexport const VtBody = defineComponent({\n name: \"VtBody\",\n slots: Object as SlotsType<{\n default?: (props: { rows: readonly TableRow<unknown>[] }) => VNode[];\n empty?: () => VNode[];\n }>,\n props: { ...virtualProps },\n setup(props, { slots }) {\n return () =>\n h(\n DataTableBody,\n { class: \"vt-body\", ...props },\n {\n ...slots,\n empty: slots.empty ?? (() => h(VtEmpty)),\n },\n );\n },\n});\n\n/** The default empty state. */\nexport const VtEmpty = defineComponent({\n name: \"VtEmpty\",\n slots: Object as SlotsType<{ default?: () => VNode[] }>,\n props: { text: { type: String, default: \"No matching rows\" } },\n setup(props, { slots }) {\n return () =>\n h(\"div\", { class: \"vt-empty\" }, [\n icon(\"empty\", \"vt-empty-icon\"),\n slots.default?.() ?? props.text,\n ]);\n },\n});\n\n/** A search field with an icon. */\nexport const VtSearch = defineComponent({\n name: \"VtSearch\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => h(\"label\", { class: \"vt-search\" }, [icon(\"search\"), h(DataTableSearch, attrs)]);\n },\n});\n\n/** \"Rows per page\" with a picker. */\nexport const VtPageSize = defineComponent({\n name: \"VtPageSize\",\n props: {\n options: { type: Array as PropType<readonly number[]>, default: () => [5, 10, 20, 50] },\n label: { type: String, default: \"Rows per page\" },\n },\n setup(props) {\n return () =>\n h(\"label\", { class: \"vt-page-size\" }, [\n h(\"span\", props.label),\n h(DataTablePageSize, { options: props.options, label: props.label }),\n ]);\n },\n});\n\n/**\n * A menu of column checkboxes behind a \"Columns\" button. Escape closes it and returns focus to\n * the button, and so does moving focus out of it.\n */\nexport const VtColumnVisibility = defineComponent({\n name: \"VtColumnVisibility\",\n props: { label: { type: String, default: \"Columns\" } },\n setup(props) {\n const close = (menu: HTMLDetailsElement, refocus: boolean): void => {\n if (!menu.open) {\n return;\n }\n menu.open = false;\n if (refocus) {\n menu.querySelector(\"summary\")?.focus();\n }\n };\n return () =>\n h(\n \"details\",\n {\n class: \"vt-menu\",\n onKeydown: (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n close(event.currentTarget as HTMLDetailsElement, true);\n }\n },\n onFocusout: (event: FocusEvent) => {\n const menu = event.currentTarget as HTMLDetailsElement;\n const next = event.relatedTarget as Node | null;\n // Some browsers move no focus when a checkbox label is clicked; only a known\n // destination outside the menu closes it.\n if (next !== null && !menu.contains(next)) {\n close(menu, false);\n }\n },\n },\n [\n h(\"summary\", { class: \"vt-button\" }, [icon(\"columns\"), props.label]),\n h(DataTableColumnVisibility, { as: \"div\", class: \"vt-menu-panel\" }),\n ],\n );\n },\n});\n\nexport const VtPagination = withClass(DataTablePagination, \"vt-pagination\", \"VtPagination\");\nexport const VtStatus = withClass(DataTableStatus, \"vt-status\", \"VtStatus\");\n\n/** A horizontal bar for controls above or below a table. */\nexport const VtToolbar = defineComponent({\n name: \"VtToolbar\",\n slots: Object as SlotsType<{ default?: () => VNode[] }>,\n setup(_props, { slots }) {\n return () => h(\"div\", { class: \"vt-theme vt-toolbar\", role: \"toolbar\" }, slots.default?.());\n },\n});\n\ntype CellSlot = (props: GridCellSlotProps) => VNodeChild;\n\nconst GridBody = defineComponent({\n name: \"VtGridBody\",\n props: {\n rowNumbers: { type: Boolean, default: true },\n /** Content slots per column id, as `cell.<id>` on `<VtGrid>`. */\n cells: {\n type: Object as PropType<Readonly<Record<string, CellSlot | undefined>>>,\n default: () => ({}),\n },\n },\n setup(props) {\n const table = injectDataTable(\"<VtGrid>\");\n return () => {\n const cellSlots = props.cells;\n const hasCellSlots = Object.keys(cellSlots).length > 0;\n return h(\n DataGridBody,\n { class: \"vt-body\" },\n {\n rowHeader: ({ index }: { index: number }) =>\n props.rowNumbers\n ? h(\"th\", { class: \"vt-row-number\", scope: \"row\" }, String(table.pageStart + index))\n : null,\n ...(hasCellSlots\n ? {\n cell: (cellProps: GridCellSlotProps) => {\n const slot = cellSlots[cellProps.column.id];\n return slot ? slot(cellProps) : cellProps.display;\n },\n }\n : {}),\n },\n );\n };\n },\n});\n\n/**\n * The styled spreadsheet grid, with optional row numbers and A, B, C column letters. A\n * `cell.<column id>` slot draws that column's cells while they are not being edited.\n */\nexport const VtGrid = defineComponent({\n name: \"VtGrid\",\n slots: Object as SlotsType<\n { [key: `cell.${string}`]: GridCellSlotProps } & {\n default?: (props: Record<string, unknown>) => VNode[];\n }\n >,\n props: {\n table: { type: Object as PropType<AnyDataTableBinding>, required: true },\n label: { type: String as PropType<string | undefined>, default: undefined },\n rowNumbers: { type: Boolean, default: true },\n columnLetters: { type: Boolean, default: false },\n ...surfaceProps,\n },\n setup(props, { slots, attrs }) {\n const cellSlots = (): Record<string, CellSlot> => {\n const found: Record<string, CellSlot> = {};\n for (const [name, slot] of Object.entries(slots)) {\n if (name.startsWith(\"cell.\") && slot) {\n found[name.slice(\"cell.\".length)] = slot as CellSlot;\n }\n }\n return found;\n };\n const header = () =>\n h(VtHeader, null, {\n before: () =>\n props.rowNumbers ? h(\"th\", { class: \"vt-row-number\", \"aria-hidden\": \"true\" }) : null,\n header: ({ column }: { column: TableColumn<unknown> }) =>\n props.columnLetters\n ? [\n h(\n \"span\",\n { class: \"vt-column-letter\" },\n columnLabel(props.table.columns.indexOf(column)),\n ),\n column.header,\n ]\n : column.header,\n });\n return () =>\n h(\"div\", surfaceAttrs(props), [\n h(\"div\", { class: \"vt-progress\", role: \"presentation\" }),\n scroller(props, [\n h(\n DataGridRoot,\n {\n table: props.table,\n label: props.label,\n \"aria-describedby\": attrs[\"aria-describedby\"],\n class: \"vt-table vt-grid\",\n virtual: props.virtual,\n virtualColumns: props.virtualColumns,\n rowHeight: props.rowHeight,\n overscan: props.overscan,\n columnWidth: props.columnWidth,\n gutter: props.rowNumbers ? 48 : 0,\n },\n {\n default: (slotProps: Record<string, unknown>) =>\n slots.default?.(slotProps) ?? [\n header(),\n h(GridBody, { rowNumbers: props.rowNumbers, cells: cellSlots() }),\n ],\n },\n ),\n ]),\n ]);\n },\n});\n"],"mappings":";;;;;;AAEA,MAAM,QAAQ;CACZ,UAAU;CACV,SAAS;CACT,UAAU;CACV,QAAQ;CACR,SAAS;CACT,OAAO;AACT;;AAKA,SAAgB,KAAK,MAAgB,YAAY,WAAkB;CACjE,OAAO,EACL,OACA;EACE,OAAO;EACP,SAAS;EACT,OAAO;EACP,QAAQ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,KAAK,GAC7C,IAAI,KAAK,WAAW,OAAO,KAAK,MAC9B,MAAM,KAAK,MAAM,CAAc,KAAK;GAGxC,OAAO;EACT;EACA,MAAM,eACJ,EAAE,UAAU,MAAM;GAChB,cACE,MAAM,aAAa,EAAE,MAAM;IAAE,OAAO;IAAiB,eAAe;GAAO,CAAC,IAAI;GAClF,SAAS,EAAE,aACT,MAAM,gBACF,CACE,EACE,QACA,EAAE,OAAO,mBAAmB,GAC5B,YAAY,MAAM,MAAM,QAAQ,QAAQ,MAAM,CAAC,CACjD,GACA,OAAO,MACT,IACA,OAAO;EACf,CAAC;EACH,aACE,EAAE,OAAO,aAAa,KAAK,GAAG,CAC5B,EAAE,OAAO;GAAE,OAAO;GAAe,MAAM;EAAe,CAAC,GACvD,SAAS,OAAO,CACd,EACE,cACA;GACE,OAAO,MAAM;GACb,OAAO,MAAM;GACb,oBAAoB,MAAM;GAC1B,OAAO;GACP,SAAS,MAAM;GACf,gBAAgB,MAAM;GACtB,WAAW,MAAM;GACjB,UAAU,MAAM;GAChB,aAAa,MAAM;GACnB,QAAQ,MAAM,aAAa,KAAK;EAClC,GACA,EACE,UAAU,cACR,MAAM,UAAU,SAAS,KAAK,CAC5B,OAAO,GACP,EAAE,UAAU;GAAE,YAAY,MAAM;GAAY,OAAO,UAAU;EAAE,CAAC,CAClE,EACJ,CACF,CACF,CAAC,CACH,CAAC;CACL;AACF,CAAC"}
|
package/dist/style.css
CHANGED
|
@@ -109,6 +109,32 @@
|
|
|
109
109
|
max-height: var(--vt-max-height, none);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
.vt-surface[data-virtual] {
|
|
113
|
+
min-width: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.vt-surface[data-virtual] .vt-scroll {
|
|
117
|
+
overflow-anchor: none;
|
|
118
|
+
scrollbar-color: var(--vt-border) var(--vt-bg);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.vt-surface[data-virtual] .vt-table [data-virtual-row] {
|
|
122
|
+
height: var(--vt-row-height, 40px);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.vt-table [data-virtual-spacer] > td,
|
|
126
|
+
.vt-table th[data-virtual-spacer],
|
|
127
|
+
.vt-table td[data-virtual-spacer] {
|
|
128
|
+
padding: 0;
|
|
129
|
+
border: 0;
|
|
130
|
+
background: transparent;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.vt-surface[data-virtual] .vt-table .vt-row-number {
|
|
134
|
+
width: 48px;
|
|
135
|
+
min-width: 48px;
|
|
136
|
+
}
|
|
137
|
+
|
|
112
138
|
.vt-table {
|
|
113
139
|
width: 100%;
|
|
114
140
|
border-collapse: separate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueye-table/styled",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.5",
|
|
4
4
|
"description": "Styled, themeable Vue components for vueye-table, built on the headless layer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-table",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"provenance": true
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@vueye-table/core": "3.0.0-alpha.
|
|
45
|
-
"@vueye-table/
|
|
46
|
-
"@vueye-table/
|
|
44
|
+
"@vueye-table/core": "3.0.0-alpha.5",
|
|
45
|
+
"@vueye-table/vue": "3.0.0-alpha.5",
|
|
46
|
+
"@vueye-table/headless": "3.0.0-alpha.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"vue": "3.5.43",
|