@vueye-table/styled 3.0.0-alpha.9 → 3.0.0-beta.2

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SortInfo, TableColumn, TableRow } from "@vueye-table/core";
2
- import { DetailSlotProps, GridCellSlotProps } from "@vueye-table/headless";
2
+ import { CellEditorSlotProps, DetailSlotProps, GridCellSlotProps } from "@vueye-table/headless";
3
3
  import { AnyDataTableBinding, DataTableBinding } from "@vueye-table/vue";
4
4
  import { Component, PropType, SlotsType, VNode, VNodeChild } from "vue";
5
5
  //#region src/components.d.ts
@@ -32,8 +32,14 @@ declare const VtHeader: import("vue").DefineComponent<{}, () => VNode<import("vu
32
32
  } & {
33
33
  before?: () => VNode[];
34
34
  after?: () => VNode[];
35
+ /**
36
+ * The content of every header cell, inside the sort button of a sortable column, so a custom
37
+ * header keeps click-to-sort and its indicator.
38
+ */
35
39
  header?: (props: {
36
40
  column: TableColumn<unknown>;
41
+ sort: SortInfo | undefined;
42
+ toggleSort: (multi?: boolean) => void;
37
43
  }) => VNodeChild;
38
44
  }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
39
45
  /**
@@ -66,7 +72,7 @@ declare const VtTable: import("vue").DefineComponent<import("vue").ExtractPropTy
66
72
  readonly default: false;
67
73
  };
68
74
  theme: {
69
- readonly type: PropType<"light" | "dark" | undefined>;
75
+ readonly type: PropType<"light" | "dark" | "inherit" | undefined>;
70
76
  readonly default: undefined;
71
77
  };
72
78
  treeColumn: {
@@ -105,6 +111,10 @@ declare const VtTable: import("vue").DefineComponent<import("vue").ExtractPropTy
105
111
  type: PropType<AnyDataTableBinding>;
106
112
  required: true;
107
113
  };
114
+ leadingColumns: {
115
+ type: NumberConstructor;
116
+ default: number;
117
+ };
108
118
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
109
119
  [key: string]: any;
110
120
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -133,7 +143,7 @@ declare const VtTable: import("vue").DefineComponent<import("vue").ExtractPropTy
133
143
  readonly default: false;
134
144
  };
135
145
  theme: {
136
- readonly type: PropType<"light" | "dark" | undefined>;
146
+ readonly type: PropType<"light" | "dark" | "inherit" | undefined>;
137
147
  readonly default: undefined;
138
148
  };
139
149
  treeColumn: {
@@ -172,14 +182,19 @@ declare const VtTable: import("vue").DefineComponent<import("vue").ExtractPropTy
172
182
  type: PropType<AnyDataTableBinding>;
173
183
  required: true;
174
184
  };
185
+ leadingColumns: {
186
+ type: NumberConstructor;
187
+ default: number;
188
+ };
175
189
  }>> & Readonly<{}>, {
190
+ leadingColumns: number;
176
191
  density: Density;
177
192
  striped: boolean;
178
193
  bordered: boolean;
179
194
  hover: boolean;
180
195
  stickyHeader: boolean;
181
196
  loading: boolean;
182
- theme: "light" | "dark" | undefined;
197
+ theme: "light" | "dark" | "inherit" | undefined;
183
198
  treeColumn: string | undefined;
184
199
  keepAliveDetail: boolean;
185
200
  virtual: boolean | import("@vueye-table/headless").ComponentVirtualOptions;
@@ -274,18 +289,18 @@ declare const VtBody: import("vue").DefineComponent<import("vue").ExtractPropTyp
274
289
  /** The default empty state. */
275
290
  declare const VtEmpty: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
276
291
  text: {
277
- type: StringConstructor;
278
- default: string;
292
+ type: PropType<string | undefined>;
293
+ default: undefined;
279
294
  };
280
295
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
281
296
  [key: string]: any;
282
297
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
283
298
  text: {
284
- type: StringConstructor;
285
- default: string;
299
+ type: PropType<string | undefined>;
300
+ default: undefined;
286
301
  };
287
302
  }>> & Readonly<{}>, {
288
- text: string;
303
+ text: string | undefined;
289
304
  }, SlotsType<{
290
305
  default?: () => VNode[];
291
306
  }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -300,8 +315,8 @@ declare const VtPageSize: import("vue").DefineComponent<import("vue").ExtractPro
300
315
  default: () => number[];
301
316
  };
302
317
  label: {
303
- type: StringConstructor;
304
- default: string;
318
+ type: PropType<string | undefined>;
319
+ default: undefined;
305
320
  };
306
321
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
307
322
  [key: string]: any;
@@ -311,11 +326,11 @@ declare const VtPageSize: import("vue").DefineComponent<import("vue").ExtractPro
311
326
  default: () => number[];
312
327
  };
313
328
  label: {
314
- type: StringConstructor;
315
- default: string;
329
+ type: PropType<string | undefined>;
330
+ default: undefined;
316
331
  };
317
332
  }>> & Readonly<{}>, {
318
- label: string;
333
+ label: string | undefined;
319
334
  options: readonly number[];
320
335
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
321
336
  /**
@@ -324,18 +339,18 @@ declare const VtPageSize: import("vue").DefineComponent<import("vue").ExtractPro
324
339
  */
325
340
  declare const VtColumnVisibility: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
326
341
  label: {
327
- type: StringConstructor;
328
- default: string;
342
+ type: PropType<string | undefined>;
343
+ default: undefined;
329
344
  };
330
345
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
331
346
  [key: string]: any;
332
347
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
333
348
  label: {
334
- type: StringConstructor;
335
- default: string;
349
+ type: PropType<string | undefined>;
350
+ default: undefined;
336
351
  };
337
352
  }>> & Readonly<{}>, {
338
- label: string;
353
+ label: string | undefined;
339
354
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
340
355
  declare const VtPagination: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
341
356
  as: {
@@ -343,8 +358,8 @@ declare const VtPagination: import("vue").DefineComponent<import("vue").ExtractP
343
358
  readonly default: string;
344
359
  };
345
360
  label: {
346
- type: StringConstructor;
347
- default: string;
361
+ type: PropType<string | undefined>;
362
+ default: undefined;
348
363
  };
349
364
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
350
365
  [key: string]: any;
@@ -354,11 +369,11 @@ declare const VtPagination: import("vue").DefineComponent<import("vue").ExtractP
354
369
  readonly default: string;
355
370
  };
356
371
  label: {
357
- type: StringConstructor;
358
- default: string;
372
+ type: PropType<string | undefined>;
373
+ default: undefined;
359
374
  };
360
375
  }>> & Readonly<{}>, {
361
- label: string;
376
+ label: string | undefined;
362
377
  as: string;
363
378
  }, SlotsType<{
364
379
  default?: (props: {
@@ -391,36 +406,36 @@ declare const VtStatus: import("vue").DefineComponent<import("vue").ExtractPropT
391
406
  }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
392
407
  declare const VtLoadMore: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
393
408
  label: {
394
- type: StringConstructor;
395
- default: string;
409
+ type: PropType<string | undefined>;
410
+ default: undefined;
396
411
  };
397
412
  retryLabel: {
398
- type: StringConstructor;
399
- default: string;
413
+ type: PropType<string | undefined>;
414
+ default: undefined;
400
415
  };
401
416
  loadingLabel: {
402
- type: StringConstructor;
403
- default: string;
417
+ type: PropType<string | undefined>;
418
+ default: undefined;
404
419
  };
405
420
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
406
421
  [key: string]: any;
407
422
  }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
408
423
  label: {
409
- type: StringConstructor;
410
- default: string;
424
+ type: PropType<string | undefined>;
425
+ default: undefined;
411
426
  };
412
427
  retryLabel: {
413
- type: StringConstructor;
414
- default: string;
428
+ type: PropType<string | undefined>;
429
+ default: undefined;
415
430
  };
416
431
  loadingLabel: {
417
- type: StringConstructor;
418
- default: string;
432
+ type: PropType<string | undefined>;
433
+ default: undefined;
419
434
  };
420
435
  }>> & Readonly<{}>, {
421
- label: string;
422
- retryLabel: string;
423
- loadingLabel: string;
436
+ label: string | undefined;
437
+ retryLabel: string | undefined;
438
+ loadingLabel: string | undefined;
424
439
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
425
440
  declare const VtDetailRow: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
426
441
  row: {
@@ -477,12 +492,12 @@ declare const VtExpandToggle: import("vue").DefineComponent<import("vue").Extrac
477
492
  readonly default: undefined;
478
493
  };
479
494
  readonly expandLabel: {
480
- readonly type: StringConstructor;
481
- readonly default: "Expand row";
495
+ readonly type: PropType<string | undefined>;
496
+ readonly default: undefined;
482
497
  };
483
498
  readonly collapseLabel: {
484
- readonly type: StringConstructor;
485
- readonly default: "Collapse row";
499
+ readonly type: PropType<string | undefined>;
500
+ readonly default: undefined;
486
501
  };
487
502
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
488
503
  [key: string]: any;
@@ -496,17 +511,17 @@ declare const VtExpandToggle: import("vue").DefineComponent<import("vue").Extrac
496
511
  readonly default: undefined;
497
512
  };
498
513
  readonly expandLabel: {
499
- readonly type: StringConstructor;
500
- readonly default: "Expand row";
514
+ readonly type: PropType<string | undefined>;
515
+ readonly default: undefined;
501
516
  };
502
517
  readonly collapseLabel: {
503
- readonly type: StringConstructor;
504
- readonly default: "Collapse row";
518
+ readonly type: PropType<string | undefined>;
519
+ readonly default: undefined;
505
520
  };
506
521
  }>> & Readonly<{}>, {
507
522
  readonly controls: string | undefined;
508
- readonly expandLabel: string;
509
- readonly collapseLabel: string;
523
+ readonly expandLabel: string | undefined;
524
+ readonly collapseLabel: string | undefined;
510
525
  }, SlotsType<{
511
526
  default?: (props: {
512
527
  row: TableRow<unknown>;
@@ -547,11 +562,114 @@ declare const VtToolbar: import("vue").DefineComponent<{}, () => VNode<import("v
547
562
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, SlotsType<{
548
563
  default?: () => VNode[];
549
564
  }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
565
+ declare const VtCellEditor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
566
+ readonly editor: {
567
+ readonly type: PropType<CellEditorSlotProps>;
568
+ readonly required: true;
569
+ };
570
+ readonly spec: {
571
+ readonly type: PropType<import("@vueye-table/core").EditorSpec>;
572
+ readonly default: () => {
573
+ kind: string;
574
+ };
575
+ };
576
+ readonly finish: {
577
+ readonly type: PropType<((direction?: "up" | "down" | "left" | "right") => void) | undefined>;
578
+ readonly default: undefined;
579
+ };
580
+ readonly autofocus: {
581
+ readonly type: BooleanConstructor;
582
+ readonly default: true;
583
+ };
584
+ readonly blurCommit: {
585
+ readonly type: BooleanConstructor;
586
+ readonly default: true;
587
+ };
588
+ readonly tabCommit: {
589
+ readonly type: BooleanConstructor;
590
+ readonly default: true;
591
+ };
592
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
593
+ [key: string]: any;
594
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
595
+ readonly editor: {
596
+ readonly type: PropType<CellEditorSlotProps>;
597
+ readonly required: true;
598
+ };
599
+ readonly spec: {
600
+ readonly type: PropType<import("@vueye-table/core").EditorSpec>;
601
+ readonly default: () => {
602
+ kind: string;
603
+ };
604
+ };
605
+ readonly finish: {
606
+ readonly type: PropType<((direction?: "up" | "down" | "left" | "right") => void) | undefined>;
607
+ readonly default: undefined;
608
+ };
609
+ readonly autofocus: {
610
+ readonly type: BooleanConstructor;
611
+ readonly default: true;
612
+ };
613
+ readonly blurCommit: {
614
+ readonly type: BooleanConstructor;
615
+ readonly default: true;
616
+ };
617
+ readonly tabCommit: {
618
+ readonly type: BooleanConstructor;
619
+ readonly default: true;
620
+ };
621
+ }>> & Readonly<{}>, {
622
+ readonly spec: import("@vueye-table/core").EditorSpec;
623
+ readonly finish: ((direction?: "up" | "down" | "left" | "right") => void) | undefined;
624
+ readonly autofocus: boolean;
625
+ readonly blurCommit: boolean;
626
+ readonly tabCommit: boolean;
627
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
628
+ declare const VtRowActions: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
629
+ row: {
630
+ readonly type: PropType<TableRow<unknown>>;
631
+ readonly required: true;
632
+ };
633
+ editable: {
634
+ type: BooleanConstructor;
635
+ default: boolean;
636
+ };
637
+ removable: {
638
+ type: BooleanConstructor;
639
+ default: boolean;
640
+ };
641
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
642
+ [key: string]: any;
643
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
644
+ row: {
645
+ readonly type: PropType<TableRow<unknown>>;
646
+ readonly required: true;
647
+ };
648
+ editable: {
649
+ type: BooleanConstructor;
650
+ default: boolean;
651
+ };
652
+ removable: {
653
+ type: BooleanConstructor;
654
+ default: boolean;
655
+ };
656
+ }>> & Readonly<{}>, {
657
+ editable: boolean;
658
+ removable: boolean;
659
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
550
660
  /**
551
661
  * The styled spreadsheet grid, with optional row numbers and A, B, C column letters. A
552
662
  * `cell.<column id>` slot draws that column's cells while they are not being edited.
553
663
  */
554
664
  declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
665
+ rowActions: {
666
+ type: BooleanConstructor;
667
+ default: boolean;
668
+ };
669
+ removable: {
670
+ type: BooleanConstructor;
671
+ default: boolean;
672
+ };
555
673
  density: {
556
674
  readonly type: PropType<Density>;
557
675
  readonly default: "comfortable";
@@ -577,7 +695,7 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
577
695
  readonly default: false;
578
696
  };
579
697
  theme: {
580
- readonly type: PropType<"light" | "dark" | undefined>;
698
+ readonly type: PropType<"light" | "dark" | "inherit" | undefined>;
581
699
  readonly default: undefined;
582
700
  };
583
701
  treeColumn: {
@@ -630,7 +748,18 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
630
748
  };
631
749
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
632
750
  [key: string]: any;
633
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
751
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
752
+ save: (_result: unknown) => true;
753
+ cancel: (_key: unknown) => true;
754
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
755
+ rowActions: {
756
+ type: BooleanConstructor;
757
+ default: boolean;
758
+ };
759
+ removable: {
760
+ type: BooleanConstructor;
761
+ default: boolean;
762
+ };
634
763
  density: {
635
764
  readonly type: PropType<Density>;
636
765
  readonly default: "comfortable";
@@ -656,7 +785,7 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
656
785
  readonly default: false;
657
786
  };
658
787
  theme: {
659
- readonly type: PropType<"light" | "dark" | undefined>;
788
+ readonly type: PropType<"light" | "dark" | "inherit" | undefined>;
660
789
  readonly default: undefined;
661
790
  };
662
791
  treeColumn: {
@@ -707,7 +836,10 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
707
836
  type: BooleanConstructor;
708
837
  default: boolean;
709
838
  };
710
- }>> & Readonly<{}>, {
839
+ }>> & Readonly<{
840
+ onCancel?: (_key: unknown) => any;
841
+ onSave?: (_result: unknown) => any;
842
+ }>, {
711
843
  label: string | undefined;
712
844
  density: Density;
713
845
  striped: boolean;
@@ -715,7 +847,7 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
715
847
  hover: boolean;
716
848
  stickyHeader: boolean;
717
849
  loading: boolean;
718
- theme: "light" | "dark" | undefined;
850
+ theme: "light" | "dark" | "inherit" | undefined;
719
851
  treeColumn: string | undefined;
720
852
  keepAliveDetail: boolean;
721
853
  virtual: boolean | import("@vueye-table/headless").ComponentVirtualOptions;
@@ -724,10 +856,13 @@ declare const VtGrid: import("vue").DefineComponent<import("vue").ExtractPropTyp
724
856
  overscan: number;
725
857
  virtualColumns: boolean;
726
858
  columnWidth: number;
859
+ removable: boolean;
727
860
  rowNumbers: boolean;
728
861
  columnLetters: boolean;
862
+ rowActions: boolean;
729
863
  }, SlotsType<{
730
864
  [key: `cell.${string}`]: GridCellSlotProps;
865
+ [key: `editor.${string}`]: CellEditorSlotProps;
731
866
  } & {
732
867
  default?: (props: Record<string, unknown>) => VNode[];
733
868
  expanded?: (props: DetailSlotProps) => VNodeChild;
@@ -755,5 +890,5 @@ declare function icon(name: IconName, className?: string): VNode;
755
890
  */
756
891
  declare function withClass<TComponent extends Component>(component: TComponent, className: string, name: string): TComponent;
757
892
  //#endregion
758
- export { type Density, type IconName, VtBody, VtColumnVisibility, VtDetailRow, VtEmpty, VtExpandToggle, VtGrid, VtHeader, VtLoadMore, VtPageSize, VtPagination, VtSearch, VtSortIndicator, VtStatus, VtTable, VtToolbar, VtTreeCell, icon, withClass };
893
+ export { type Density, type IconName, VtBody, VtCellEditor, VtColumnVisibility, VtDetailRow, VtEmpty, VtExpandToggle, VtGrid, VtHeader, VtLoadMore, VtPageSize, VtPagination, VtRowActions, VtSearch, VtSortIndicator, VtStatus, VtTable, VtToolbar, VtTreeCell, icon, withClass };
759
894
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/components.ts","../src/icons.ts","../src/with-class.ts"],"mappings":";;;;;KA6CY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ableCell, DataTableColumnVisibility, DataTableDetailRow, DataTableExpandToggle, DataTableHeader, DataTableHeaderCell, DataTableHeaderRow, DataTableLoadMore, DataTablePageSize, DataTablePagination, DataTableRoot, DataTableRow, DataTableSearch, DataTableSortButton, DataTableStatus, DataTableTreeCell, DataTableViewport, DataTableVirtualColumns, expandToggleProps, hierarchyProps, injectVirtualRenderer, resolveTreeColumn, treeCellProps, virtualProps } from "@vueye-table/headless";
3
- import { injectDataTable } from "@vueye-table/vue";
2
+ import { DataCellEditor, DataGridBody, DataGridRoot, DataTableBody, DataTableCell, DataTableColumnVisibility, DataTableDetailRow, DataTableExpandToggle, DataTableHeader, DataTableHeaderCell, DataTableHeaderRow, DataTableLoadMore, DataTablePageSize, DataTablePagination, DataTableRoot, DataTableRow, DataTableRowActions, DataTableSearch, DataTableSortButton, DataTableStatus, DataTableTreeCell, DataTableViewport, DataTableVirtualColumns, cellEditorProps, expandToggleProps, hierarchyProps, injectVirtualRenderer, resolveTreeColumn, treeCellProps, virtualProps } from "@vueye-table/headless";
3
+ import { injectDataTable, useTableLocale } from "@vueye-table/vue";
4
4
  import { defineComponent, h, mergeProps } from "vue";
5
5
 
6
6
  //#region src/icons.ts
@@ -74,7 +74,10 @@ const surfaceProps = {
74
74
  type: Boolean,
75
75
  default: false
76
76
  },
77
- /** Force a theme; by default the table follows `prefers-color-scheme`. */
77
+ /**
78
+ * Force a theme; by default the table follows `prefers-color-scheme`. `"inherit"` declares no
79
+ * palette, so the host's `--vt-*` tokens apply.
80
+ */
78
81
  theme: {
79
82
  type: String,
80
83
  default: void 0
@@ -122,6 +125,11 @@ const VtHeader = defineComponent({
122
125
  slots: Object,
123
126
  setup(_props, { slots }) {
124
127
  const table = injectDataTable("<VtHeader>");
128
+ const content = (column, sort) => slots.header?.({
129
+ column,
130
+ sort,
131
+ toggleSort: (multi = false) => table.toggleSort(column.id, { multi })
132
+ }) ?? column.header;
125
133
  const virtual = injectVirtualRenderer();
126
134
  const headerCell = (column) => h(DataTableHeaderCell, {
127
135
  key: column.id,
@@ -130,9 +138,9 @@ const VtHeader = defineComponent({
130
138
  column,
131
139
  class: "vt-sort-button"
132
140
  }, {
133
- default: () => [slots.header?.({ column }) ?? column.header],
141
+ default: ({ sort }) => [content(column, sort)],
134
142
  indicator: ({ sort }) => [h(VtSortIndicator, { sort })]
135
- }) : [slots.header?.({ column }) ?? column.header]) });
143
+ }) : [content(column, void 0)]) });
136
144
  return () => h(DataTableHeader, { class: "vt-head" }, () => h(DataTableHeaderRow, () => [
137
145
  slots.before?.(),
138
146
  ...virtual?.columns ? [h(DataTableVirtualColumns, null, { default: ({ column }) => [headerCell(column)] })] : table.columns.map(headerCell),
@@ -152,6 +160,10 @@ const VtTable = defineComponent({
152
160
  type: Object,
153
161
  required: true
154
162
  },
163
+ leadingColumns: {
164
+ type: Number,
165
+ default: 0
166
+ },
155
167
  ...surfaceProps
156
168
  },
157
169
  setup(props, { slots }) {
@@ -164,6 +176,7 @@ const VtTable = defineComponent({
164
176
  }), scroller(props, [h(DataTableRoot, {
165
177
  table: props.table,
166
178
  class: "vt-table",
179
+ leadingColumns: props.leadingColumns,
167
180
  virtual: props.virtual,
168
181
  rowHeight: props.rowHeight,
169
182
  overscan: props.overscan,
@@ -185,6 +198,7 @@ const VtBody = defineComponent({
185
198
  },
186
199
  setup(props, { slots }) {
187
200
  const table = injectDataTable("<VtBody>");
201
+ const locale = useTableLocale();
188
202
  return () => h(DataTableBody, {
189
203
  class: "vt-body",
190
204
  ...props
@@ -206,7 +220,7 @@ const VtBody = defineComponent({
206
220
  })),
207
221
  $stable: true
208
222
  })),
209
- empty: slots.empty ?? (() => h(VtEmpty, { text: table.loadingMode && table.loadState === "loading" ? "Loading rows…" : table.loadingMode && table.loadState === "error" ? "Could not load rows." : "No matching rows" }))
223
+ empty: slots.empty ?? (() => h(VtEmpty, { text: table.loadingMode && table.loadState === "loading" ? locale().messages.loadingRows : table.loadingMode && table.loadState === "error" ? locale().messages.couldNotLoadRows : locale().messages.noMatchingRows }))
210
224
  });
211
225
  }
212
226
  });
@@ -216,10 +230,11 @@ const VtEmpty = defineComponent({
216
230
  slots: Object,
217
231
  props: { text: {
218
232
  type: String,
219
- default: "No matching rows"
233
+ default: void 0
220
234
  } },
221
235
  setup(props, { slots }) {
222
- return () => h("div", { class: "vt-empty" }, [icon("empty", "vt-empty-icon"), slots.default?.() ?? props.text]);
236
+ const locale = useTableLocale();
237
+ return () => h("div", { class: "vt-empty" }, [icon("empty", "vt-empty-icon"), slots.default?.() ?? props.text ?? locale().messages.noMatchingRows]);
223
238
  }
224
239
  });
225
240
  /** A search field with an icon. */
@@ -245,14 +260,18 @@ const VtPageSize = defineComponent({
245
260
  },
246
261
  label: {
247
262
  type: String,
248
- default: "Rows per page"
263
+ default: void 0
249
264
  }
250
265
  },
251
266
  setup(props) {
252
- return () => h("label", { class: "vt-page-size" }, [h("span", props.label), h(DataTablePageSize, {
253
- options: props.options,
254
- label: props.label
255
- })]);
267
+ const locale = useTableLocale();
268
+ return () => {
269
+ const label = props.label ?? locale().messages.rowsPerPage;
270
+ return h("label", { class: "vt-page-size" }, [h("span", label), h(DataTablePageSize, {
271
+ options: props.options,
272
+ label
273
+ })]);
274
+ };
256
275
  }
257
276
  });
258
277
  /**
@@ -263,9 +282,10 @@ const VtColumnVisibility = defineComponent({
263
282
  name: "VtColumnVisibility",
264
283
  props: { label: {
265
284
  type: String,
266
- default: "Columns"
285
+ default: void 0
267
286
  } },
268
287
  setup(props) {
288
+ const locale = useTableLocale();
269
289
  const close = (menu, refocus) => {
270
290
  if (!menu.open) return;
271
291
  menu.open = false;
@@ -284,7 +304,7 @@ const VtColumnVisibility = defineComponent({
284
304
  const next = event.relatedTarget;
285
305
  if (next !== null && !menu.contains(next)) close(menu, false);
286
306
  }
287
- }, [h("summary", { class: "vt-button" }, [icon("columns"), props.label]), h(DataTableColumnVisibility, {
307
+ }, [h("summary", { class: "vt-button" }, [icon("columns"), props.label ?? locale().messages.columns]), h(DataTableColumnVisibility, {
288
308
  as: "div",
289
309
  class: "vt-menu-panel"
290
310
  })]);
@@ -327,6 +347,17 @@ const VtToolbar = defineComponent({
327
347
  }, slots.default?.());
328
348
  }
329
349
  });
350
+ const VtCellEditor = defineComponent({
351
+ name: "VtCellEditor",
352
+ props: cellEditorProps,
353
+ setup(props) {
354
+ return () => h(DataCellEditor, {
355
+ ...props,
356
+ class: "vt-cell-editor"
357
+ });
358
+ }
359
+ });
360
+ const VtRowActions = withClass(DataTableRowActions, "vt-row-actions", "VtRowActions");
330
361
  const GridBody = defineComponent({
331
362
  name: "VtGridBody",
332
363
  props: {
@@ -346,6 +377,18 @@ const GridBody = defineComponent({
346
377
  cells: {
347
378
  type: Object,
348
379
  default: () => ({})
380
+ },
381
+ editors: {
382
+ type: Object,
383
+ default: () => ({})
384
+ },
385
+ rowActions: {
386
+ type: Boolean,
387
+ default: false
388
+ },
389
+ removable: {
390
+ type: Boolean,
391
+ default: false
349
392
  }
350
393
  },
351
394
  setup(props) {
@@ -356,18 +399,32 @@ const GridBody = defineComponent({
356
399
  return h(DataGridBody, {
357
400
  class: "vt-body",
358
401
  treeCell: false,
359
- colspan: table.columns.length + (props.rowNumbers || details ? 1 : 0)
402
+ colspan: table.columns.length + (props.rowNumbers || details || props.rowActions ? 1 : 0)
360
403
  }, {
361
404
  detail: props.detail,
362
- rowHeader: ({ index }) => props.rowNumbers || details ? h("th", {
405
+ rowHeader: ({ index }) => props.rowNumbers || details || props.rowActions ? h("th", {
363
406
  class: "vt-row-number",
364
- scope: "row"
365
- }, [details ? h(VtExpandToggle, { row: table.rows[index] }) : null, props.rowNumbers ? String(table.pageStart + index) : null]) : null,
407
+ scope: "row",
408
+ "aria-colindex": 1
409
+ }, [
410
+ details ? h(VtExpandToggle, { row: table.rows[index] }) : null,
411
+ props.rowNumbers ? String(table.pageStart + index) : null,
412
+ props.rowActions ? h(VtRowActions, {
413
+ row: table.rows[index],
414
+ editable: false,
415
+ removable: props.removable
416
+ }) : null
417
+ ]) : null,
366
418
  cell: (cellProps) => {
367
419
  const slot = cellSlots[cellProps.column.id];
368
420
  const content = () => slot ? slot(cellProps) : cellProps.display;
369
421
  return table.tree && cellProps.column.id === resolveTreeColumn(table, props.treeColumn) ? h(VtTreeCell, { row: cellProps.row }, { default: content }) : content();
370
- }
422
+ },
423
+ editor: (editor) => props.editors[editor.column.id]?.(editor) ?? h(VtCellEditor, {
424
+ editor,
425
+ spec: editor.spec,
426
+ finish: editor.finish
427
+ })
371
428
  });
372
429
  };
373
430
  }
@@ -396,20 +453,41 @@ const VtGrid = defineComponent({
396
453
  type: Boolean,
397
454
  default: false
398
455
  },
399
- ...surfaceProps
456
+ ...surfaceProps,
457
+ rowActions: {
458
+ type: Boolean,
459
+ default: false
460
+ },
461
+ removable: {
462
+ type: Boolean,
463
+ default: false
464
+ }
465
+ },
466
+ emits: {
467
+ save: (_result) => true,
468
+ cancel: (_key) => true
400
469
  },
401
- setup(props, { slots, attrs }) {
470
+ setup(props, { slots, attrs, emit }) {
471
+ const locale = useTableLocale();
402
472
  const details = () => !!slots.expanded && !props.table.tree;
403
473
  const cellSlots = () => {
404
474
  const found = {};
405
475
  for (const [name, slot] of Object.entries(slots)) if (name.startsWith("cell.") && slot) found[name.slice(5)] = slot;
406
476
  return found;
407
477
  };
478
+ const editorSlots = () => {
479
+ const found = {};
480
+ for (const name of Object.keys(slots)) if (name.startsWith("editor.")) {
481
+ const slot = slots[name];
482
+ if (slot) found[name.slice(7)] = slot;
483
+ }
484
+ return found;
485
+ };
408
486
  const header = () => h(VtHeader, null, {
409
- before: () => props.rowNumbers || details() ? h("th", {
487
+ before: () => props.rowNumbers || details() || props.rowActions ? h("th", {
410
488
  class: "vt-row-number",
411
- "aria-hidden": details() ? void 0 : "true",
412
- "aria-label": details() ? "Details" : void 0
489
+ "aria-colindex": 1,
490
+ "aria-label": props.rowActions ? locale().messages.rowActions : details() ? locale().messages.details : locale().messages.rowNumber
413
491
  }) : null,
414
492
  header: ({ column }) => props.columnLetters ? [h("span", { class: "vt-column-letter" }, columnLabel(props.table.columns.indexOf(column))), column.header] : column.header
415
493
  });
@@ -422,6 +500,7 @@ const VtGrid = defineComponent({
422
500
  }), scroller(props, [h(DataGridRoot, {
423
501
  table: props.table,
424
502
  label: props.label,
503
+ leadingColumns: props.rowNumbers || details() || props.rowActions ? 1 : 0,
425
504
  "aria-describedby": attrs["aria-describedby"],
426
505
  class: "vt-table vt-grid",
427
506
  virtual: props.virtual,
@@ -429,12 +508,17 @@ const VtGrid = defineComponent({
429
508
  rowHeight: props.rowHeight,
430
509
  overscan: props.overscan,
431
510
  columnWidth: props.columnWidth,
432
- gutter: props.rowNumbers ? details() ? 80 : 48 : details() ? 48 : 0,
511
+ gutter: props.rowActions ? 120 : props.rowNumbers ? details() ? 80 : 48 : details() ? 48 : 0,
512
+ onSave: (result) => emit("save", result),
513
+ onCancel: (key) => emit("cancel", key),
433
514
  treeColumn: props.treeColumn,
434
515
  keepAliveDetail: props.keepAliveDetail
435
516
  }, { default: (slotProps) => slots.default?.(slotProps) ?? [header(), h(GridBody, {
436
517
  rowNumbers: props.rowNumbers,
437
518
  cells: cellSlots(),
519
+ editors: editorSlots(),
520
+ rowActions: props.rowActions,
521
+ removable: props.removable,
438
522
  treeColumn: props.treeColumn,
439
523
  detail: slots.expanded
440
524
  })] })])]);
@@ -442,5 +526,5 @@ const VtGrid = defineComponent({
442
526
  });
443
527
 
444
528
  //#endregion
445
- export { VtBody, VtColumnVisibility, VtDetailRow, VtEmpty, VtExpandToggle, VtGrid, VtHeader, VtLoadMore, VtPageSize, VtPagination, VtSearch, VtSortIndicator, VtStatus, VtTable, VtToolbar, VtTreeCell, icon, withClass };
529
+ export { VtBody, VtCellEditor, VtColumnVisibility, VtDetailRow, VtEmpty, VtExpandToggle, VtGrid, VtHeader, VtLoadMore, VtPageSize, VtPagination, VtRowActions, VtSearch, VtSortIndicator, VtStatus, VtTable, VtToolbar, VtTreeCell, icon, withClass };
446
530
  //# sourceMappingURL=index.js.map
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 expand: \"M9 5l7 7-7 7\",\n collapse: \"M5 9l7 7 7-7\",\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 DataTableLoadMore,\n DataTableViewport,\n DataTableVirtualColumns,\n injectVirtualRenderer,\n virtualProps,\n type GridCellSlotProps,\n DataTableExpandToggle,\n DataTableDetailRow,\n DataTableTreeCell,\n DataTableRow,\n DataTableCell,\n hierarchyProps,\n resolveTreeColumn,\n type DetailSlotProps,\n expandToggleProps,\n treeCellProps,\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 ...hierarchyProps,\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 expanded?: (props: DetailSlotProps) => VNodeChild;\n }>,\n props: {\n table: { type: Object as PropType<AnyDataTableBinding>, required: true },\n ...surfaceProps,\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n surfaceAttrs({\n ...props,\n loading:\n props.loading ||\n props.table.loadState === \"loading\" ||\n props.table.loadState === \"streaming\",\n }),\n [\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 treeColumn: props.treeColumn,\n keepAliveDetail: props.keepAliveDetail,\n },\n {\n default: () =>\n slots.default?.({ table: props.table }) ?? [\n h(VtHeader),\n h(VtBody, { treeColumn: props.treeColumn }, { detail: slots.expanded }),\n ],\n },\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 detail?: (props: DetailSlotProps) => VNodeChild;\n row?: (props: DetailSlotProps) => VNodeChild;\n }>,\n props: {\n ...virtualProps,\n treeColumn: { type: String as PropType<string | undefined>, default: undefined },\n },\n setup(props, { slots }) {\n const table = injectDataTable(\"<VtBody>\");\n return () =>\n h(\n DataTableBody,\n { class: \"vt-body\", ...props },\n {\n ...slots,\n row:\n slots.row ??\n (({ row, rowIndex }: DetailSlotProps) =>\n h(\n DataTableRow,\n { key: row.key, row, rowIndex },\n {\n default: () =>\n table.columns.map((column) =>\n h(\n DataTableCell,\n { key: column.id, row, column, tree: false },\n {\n default: () =>\n table.tree && column.id === resolveTreeColumn(table, props.treeColumn)\n ? h(VtTreeCell, { row }, () => row.getDisplay(column.id))\n : row.getDisplay(column.id),\n $stable: true,\n },\n ),\n ),\n $stable: true,\n },\n )),\n empty:\n slots.empty ??\n (() =>\n h(VtEmpty, {\n text:\n table.loadingMode && table.loadState === \"loading\"\n ? \"Loading rows…\"\n : table.loadingMode && table.loadState === \"error\"\n ? \"Could not load rows.\"\n : \"No matching rows\",\n })),\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\");\nexport const VtLoadMore = withClass(DataTableLoadMore, \"vt-button\", \"VtLoadMore\");\nexport const VtDetailRow = withClass(DataTableDetailRow, \"vt-detail-row\", \"VtDetailRow\");\nexport const VtExpandToggle = defineComponent({\n name: \"VtExpandToggle\",\n props: expandToggleProps,\n slots: Object as SlotsType<{\n default?: (props: { row: TableRow<unknown>; expanded: boolean }) => VNodeChild;\n }>,\n setup(props, { slots }) {\n return () =>\n h(\n DataTableExpandToggle,\n { ...props, class: \"vt-expand-toggle\" },\n {\n default:\n slots.default ??\n (({ expanded }: { expanded: boolean }) => icon(expanded ? \"collapse\" : \"expand\")),\n },\n );\n },\n});\nexport const VtTreeCell = defineComponent({\n name: \"VtTreeCell\",\n props: treeCellProps,\n slots: Object as SlotsType<{\n default?: () => VNodeChild;\n toggle?: (props: { row: TableRow<unknown> }) => VNodeChild;\n }>,\n setup(props, { slots }) {\n return () =>\n h(DataTableTreeCell, props, {\n ...slots,\n toggle: slots.toggle ?? (() => h(VtExpandToggle, { row: props.row })),\n });\n },\n});\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 treeColumn: { type: String as PropType<string | undefined>, default: undefined },\n detail: {\n type: Function as PropType<((props: DetailSlotProps) => VNodeChild) | undefined>,\n default: undefined,\n },\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 details = !!props.detail && !table.tree;\n return h(\n DataGridBody,\n {\n class: \"vt-body\",\n treeCell: false,\n colspan: table.columns.length + (props.rowNumbers || details ? 1 : 0),\n },\n {\n detail: props.detail,\n rowHeader: ({ index }: { index: number }) =>\n props.rowNumbers || details\n ? h(\"th\", { class: \"vt-row-number\", scope: \"row\" }, [\n details ? h(VtExpandToggle, { row: table.rows[index]! }) : null,\n props.rowNumbers ? String(table.pageStart + index) : null,\n ])\n : null,\n cell: (cellProps: GridCellSlotProps) => {\n const slot = cellSlots[cellProps.column.id];\n const content = () => (slot ? slot(cellProps) : cellProps.display);\n return table.tree && cellProps.column.id === resolveTreeColumn(table, props.treeColumn)\n ? h(VtTreeCell, { row: cellProps.row }, { default: content })\n : content();\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 expanded?: (props: DetailSlotProps) => VNodeChild;\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 details = (): boolean => !!slots.expanded && !props.table.tree;\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 || details()\n ? h(\"th\", {\n class: \"vt-row-number\",\n \"aria-hidden\": details() ? undefined : \"true\",\n \"aria-label\": details() ? \"Details\" : undefined,\n })\n : 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(\n \"div\",\n surfaceAttrs({\n ...props,\n loading:\n props.loading ||\n props.table.loadState === \"loading\" ||\n props.table.loadState === \"streaming\",\n }),\n [\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 ? (details() ? 80 : 48) : details() ? 48 : 0,\n treeColumn: props.treeColumn,\n keepAliveDetail: props.keepAliveDetail,\n },\n {\n default: (slotProps: Record<string, unknown>) =>\n slots.default?.(slotProps) ?? [\n header(),\n h(GridBody, {\n rowNumbers: props.rowNumbers,\n cells: cellSlots(),\n treeColumn: props.treeColumn,\n detail: slots.expanded,\n }),\n ],\n },\n ),\n ]),\n ],\n );\n },\n});\n"],"mappings":";;;;;;AAEA,MAAM,QAAQ;CACZ,UAAU;CACV,SAAS;CACT,UAAU;CACV,QAAQ;CACR,SAAS;CACT,OAAO;CACP,QAAQ;CACR,UAAU;AACZ;;AAKA,SAAgB,KAAK,MAAgB,YAAY,WAAkB;CACjE,OAAO,EACL,OACA;EACE,OAAO;EACP,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;EACnB,eAAe;EACf,WAAW;CACb,GACA,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,CAChC;AACF;;;;;;;;AC5BA,SAAgB,UACd,WACA,WACA,MACY;CACZ,MAAM,WAAgC,QAAQ,EAAE,OAAO,YACrD,EAAE,WAAW,WAAW,OAAO,EAAE,OAAO,UAAU,CAAC,GAAG,KAAK;CAC7D,QAAQ,cAAc;CACtB,QAAQ,eAAe;CACvB,OAAO;AACT;;;;;ACgCA,MAAM,eAAe;CACnB,GAAG;CACH,GAAG;CACH,SAAS;EAAE,MAAM;EAA6B,SAAS;CAAc;CACrE,SAAS;EAAE,MAAM;EAAS,SAAS;CAAM;CACzC,UAAU;EAAE,MAAM;EAAS,SAAS;CAAM;CAC1C,OAAO;EAAE,MAAM;EAAS,SAAS;CAAK;CACtC,cAAc;EAAE,MAAM;EAAS,SAAS;CAAM;CAC9C,SAAS;EAAE,MAAM;EAAS,SAAS;CAAM;;CAEzC,OAAO;EAAE,MAAM;EAAkD,SAAS;CAAU;AACtF;AAEA,SAAS,aAAa,OAS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IACP,eAAe,QAAQ,IAAI,SAAY;IACvC,cAAc,QAAQ,IAAI,YAAY;GACxC,CAAC,IACD;GACN,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,EACE,OACA,aAAa;GACX,GAAG;GACH,SACE,MAAM,WACN,MAAM,MAAM,cAAc,aAC1B,MAAM,MAAM,cAAc;EAC9B,CAAC,GACD,CACE,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,aAAc,QAAQ,IAAI,KAAK,KAAM,QAAQ,IAAI,KAAK;GACpE,YAAY,MAAM;GAClB,iBAAiB,MAAM;EACzB,GACA,EACE,UAAU,cACR,MAAM,UAAU,SAAS,KAAK,CAC5B,OAAO,GACP,EAAE,UAAU;GACV,YAAY,MAAM;GAClB,OAAO,UAAU;GACjB,YAAY,MAAM;GAClB,QAAQ,MAAM;EAChB,CAAC,CACH,EACJ,CACF,CACF,CAAC,CACH,CACF;CACJ;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 expand: \"M9 5l7 7-7 7\",\n collapse: \"M5 9l7 7 7-7\",\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 DataTableLoadMore,\n DataTableViewport,\n DataTableVirtualColumns,\n injectVirtualRenderer,\n virtualProps,\n type GridCellSlotProps,\n DataTableExpandToggle,\n DataTableDetailRow,\n DataTableTreeCell,\n DataTableRow,\n DataTableCell,\n hierarchyProps,\n resolveTreeColumn,\n type DetailSlotProps,\n expandToggleProps,\n treeCellProps,\n DataCellEditor,\n cellEditorProps,\n DataTableRowActions,\n type CellEditorSlotProps,\n} from \"@vueye-table/headless\";\nimport {\n injectDataTable,\n useTableLocale,\n type AnyDataTableBinding,\n type DataTableBinding,\n} 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 ...hierarchyProps,\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 /**\n * Force a theme; by default the table follows `prefers-color-scheme`. `\"inherit\"` declares no\n * palette, so the host's `--vt-*` tokens apply.\n */\n theme: { type: String as PropType<\"light\" | \"dark\" | \"inherit\" | 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\" | \"inherit\" | 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 /**\n * The content of every header cell, inside the sort button of a sortable column, so a custom\n * header keeps click-to-sort and its indicator.\n */\n header?: (props: {\n column: TableColumn<unknown>;\n sort: SortInfo | undefined;\n toggleSort: (multi?: boolean) => void;\n }) => VNodeChild;\n }\n >,\n setup(_props, { slots }) {\n const table = injectDataTable(\"<VtHeader>\");\n const content = (column: TableColumn<unknown>, sort: SortInfo | undefined): VNodeChild =>\n slots.header?.({\n column,\n sort,\n toggleSort: (multi = false) => table.toggleSort(column.id, { multi }),\n }) ?? column.header;\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: ({ sort }: { sort: SortInfo | undefined }) => [\n content(column, sort),\n ],\n indicator: ({ sort }: { sort: SortInfo | undefined }) => [\n h(VtSortIndicator, { sort }),\n ],\n },\n )\n : [content(column, undefined)]),\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 expanded?: (props: DetailSlotProps) => VNodeChild;\n }>,\n props: {\n table: { type: Object as PropType<AnyDataTableBinding>, required: true },\n leadingColumns: { type: Number, default: 0 },\n ...surfaceProps,\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n surfaceAttrs({\n ...props,\n loading:\n props.loading ||\n props.table.loadState === \"loading\" ||\n props.table.loadState === \"streaming\",\n }),\n [\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 leadingColumns: props.leadingColumns,\n virtual: props.virtual,\n rowHeight: props.rowHeight,\n overscan: props.overscan,\n treeColumn: props.treeColumn,\n keepAliveDetail: props.keepAliveDetail,\n },\n {\n default: () =>\n slots.default?.({ table: props.table }) ?? [\n h(VtHeader),\n h(VtBody, { treeColumn: props.treeColumn }, { detail: slots.expanded }),\n ],\n },\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 detail?: (props: DetailSlotProps) => VNodeChild;\n row?: (props: DetailSlotProps) => VNodeChild;\n }>,\n props: {\n ...virtualProps,\n treeColumn: { type: String as PropType<string | undefined>, default: undefined },\n },\n setup(props, { slots }) {\n const table = injectDataTable(\"<VtBody>\");\n const locale = useTableLocale();\n return () =>\n h(\n DataTableBody,\n { class: \"vt-body\", ...props },\n {\n ...slots,\n row:\n slots.row ??\n (({ row, rowIndex }: DetailSlotProps) =>\n h(\n DataTableRow,\n { key: row.key, row, rowIndex },\n {\n default: () =>\n table.columns.map((column) =>\n h(\n DataTableCell,\n { key: column.id, row, column, tree: false },\n {\n default: () =>\n table.tree && column.id === resolveTreeColumn(table, props.treeColumn)\n ? h(VtTreeCell, { row }, () => row.getDisplay(column.id))\n : row.getDisplay(column.id),\n $stable: true,\n },\n ),\n ),\n $stable: true,\n },\n )),\n empty:\n slots.empty ??\n (() =>\n h(VtEmpty, {\n text:\n table.loadingMode && table.loadState === \"loading\"\n ? locale().messages.loadingRows\n : table.loadingMode && table.loadState === \"error\"\n ? locale().messages.couldNotLoadRows\n : locale().messages.noMatchingRows,\n })),\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 as PropType<string | undefined>, default: undefined } },\n setup(props, { slots }) {\n const locale = useTableLocale();\n return () =>\n h(\"div\", { class: \"vt-empty\" }, [\n icon(\"empty\", \"vt-empty-icon\"),\n slots.default?.() ?? props.text ?? locale().messages.noMatchingRows,\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 as PropType<string | undefined>, default: undefined },\n },\n setup(props) {\n const locale = useTableLocale();\n return () => {\n const label = props.label ?? locale().messages.rowsPerPage;\n return h(\"label\", { class: \"vt-page-size\" }, [\n h(\"span\", label),\n h(DataTablePageSize, { options: props.options, label }),\n ]);\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 as PropType<string | undefined>, default: undefined } },\n setup(props) {\n const locale = useTableLocale();\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\" }, [\n icon(\"columns\"),\n props.label ?? locale().messages.columns,\n ]),\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\");\nexport const VtLoadMore = withClass(DataTableLoadMore, \"vt-button\", \"VtLoadMore\");\nexport const VtDetailRow = withClass(DataTableDetailRow, \"vt-detail-row\", \"VtDetailRow\");\nexport const VtExpandToggle = defineComponent({\n name: \"VtExpandToggle\",\n props: expandToggleProps,\n slots: Object as SlotsType<{\n default?: (props: { row: TableRow<unknown>; expanded: boolean }) => VNodeChild;\n }>,\n setup(props, { slots }) {\n return () =>\n h(\n DataTableExpandToggle,\n { ...props, class: \"vt-expand-toggle\" },\n {\n default:\n slots.default ??\n (({ expanded }: { expanded: boolean }) => icon(expanded ? \"collapse\" : \"expand\")),\n },\n );\n },\n});\nexport const VtTreeCell = defineComponent({\n name: \"VtTreeCell\",\n props: treeCellProps,\n slots: Object as SlotsType<{\n default?: () => VNodeChild;\n toggle?: (props: { row: TableRow<unknown> }) => VNodeChild;\n }>,\n setup(props, { slots }) {\n return () =>\n h(DataTableTreeCell, props, {\n ...slots,\n toggle: slots.toggle ?? (() => h(VtExpandToggle, { row: props.row })),\n });\n },\n});\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;\ntype EditorSlot = (props: CellEditorSlotProps) => VNodeChild;\n\nexport const VtCellEditor = defineComponent({\n name: \"VtCellEditor\",\n props: cellEditorProps,\n setup(props) {\n return () => h(DataCellEditor, { ...props, class: \"vt-cell-editor\" });\n },\n});\nexport const VtRowActions = withClass(DataTableRowActions, \"vt-row-actions\", \"VtRowActions\");\n\nconst GridBody = defineComponent({\n name: \"VtGridBody\",\n props: {\n rowNumbers: { type: Boolean, default: true },\n treeColumn: { type: String as PropType<string | undefined>, default: undefined },\n detail: {\n type: Function as PropType<((props: DetailSlotProps) => VNodeChild) | undefined>,\n default: undefined,\n },\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 editors: {\n type: Object as PropType<Readonly<Record<string, EditorSlot | undefined>>>,\n default: () => ({}),\n },\n rowActions: { type: Boolean, default: false },\n removable: { type: Boolean, default: false },\n },\n setup(props) {\n const table = injectDataTable(\"<VtGrid>\");\n return () => {\n const cellSlots = props.cells;\n const details = !!props.detail && !table.tree;\n return h(\n DataGridBody,\n {\n class: \"vt-body\",\n treeCell: false,\n colspan: table.columns.length + (props.rowNumbers || details || props.rowActions ? 1 : 0),\n },\n {\n detail: props.detail,\n rowHeader: ({ index }: { index: number }) =>\n props.rowNumbers || details || props.rowActions\n ? h(\"th\", { class: \"vt-row-number\", scope: \"row\", \"aria-colindex\": 1 }, [\n details ? h(VtExpandToggle, { row: table.rows[index]! }) : null,\n props.rowNumbers ? String(table.pageStart + index) : null,\n props.rowActions\n ? h(VtRowActions, {\n row: table.rows[index]!,\n editable: false,\n removable: props.removable,\n })\n : null,\n ])\n : null,\n cell: (cellProps: GridCellSlotProps) => {\n const slot = cellSlots[cellProps.column.id];\n const content = () => (slot ? slot(cellProps) : cellProps.display);\n return table.tree && cellProps.column.id === resolveTreeColumn(table, props.treeColumn)\n ? h(VtTreeCell, { row: cellProps.row }, { default: content })\n : content();\n },\n editor: (editor: CellEditorSlotProps) =>\n props.editors[editor.column.id]?.(editor) ??\n h(VtCellEditor, { editor, spec: editor.spec, finish: editor.finish }),\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 {\n [key: `cell.${string}`]: GridCellSlotProps;\n [key: `editor.${string}`]: CellEditorSlotProps;\n } & {\n default?: (props: Record<string, unknown>) => VNode[];\n expanded?: (props: DetailSlotProps) => VNodeChild;\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 rowActions: { type: Boolean, default: false },\n removable: { type: Boolean, default: false },\n },\n emits: { save: (_result: unknown) => true, cancel: (_key: unknown) => true },\n setup(props, { slots, attrs, emit }) {\n const locale = useTableLocale();\n const details = (): boolean => !!slots.expanded && !props.table.tree;\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 editorSlots = (): Record<string, EditorSlot> => {\n const found: Record<string, EditorSlot> = {};\n for (const name of Object.keys(slots)) {\n if (name.startsWith(\"editor.\")) {\n const slot = slots[name as `editor.${string}`];\n if (slot) found[name.slice(7)] = slot;\n }\n }\n return found;\n };\n const header = () =>\n h(VtHeader, null, {\n before: () =>\n props.rowNumbers || details() || props.rowActions\n ? h(\"th\", {\n class: \"vt-row-number\",\n \"aria-colindex\": 1,\n \"aria-label\": props.rowActions\n ? locale().messages.rowActions\n : details()\n ? locale().messages.details\n : locale().messages.rowNumber,\n })\n : 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(\n \"div\",\n surfaceAttrs({\n ...props,\n loading:\n props.loading ||\n props.table.loadState === \"loading\" ||\n props.table.loadState === \"streaming\",\n }),\n [\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 leadingColumns: props.rowNumbers || details() || props.rowActions ? 1 : 0,\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.rowActions\n ? 120\n : props.rowNumbers\n ? details()\n ? 80\n : 48\n : details()\n ? 48\n : 0,\n onSave: (result: unknown) => emit(\"save\", result),\n onCancel: (key: unknown) => emit(\"cancel\", key),\n treeColumn: props.treeColumn,\n keepAliveDetail: props.keepAliveDetail,\n },\n {\n default: (slotProps: Record<string, unknown>) =>\n slots.default?.(slotProps) ?? [\n header(),\n h(GridBody, {\n rowNumbers: props.rowNumbers,\n cells: cellSlots(),\n editors: editorSlots(),\n rowActions: props.rowActions,\n removable: props.removable,\n treeColumn: props.treeColumn,\n detail: slots.expanded,\n }),\n ],\n },\n ),\n ]),\n ],\n );\n },\n});\n"],"mappings":";;;;;;AAEA,MAAM,QAAQ;CACZ,UAAU;CACV,SAAS;CACT,UAAU;CACV,QAAQ;CACR,SAAS;CACT,OAAO;CACP,QAAQ;CACR,UAAU;AACZ;;AAKA,SAAgB,KAAK,MAAgB,YAAY,WAAkB;CACjE,OAAO,EACL,OACA;EACE,OAAO;EACP,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;EACnB,eAAe;EACf,WAAW;CACb,GACA,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,CAChC;AACF;;;;;;;;AC5BA,SAAgB,UACd,WACA,WACA,MACY;CACZ,MAAM,WAAgC,QAAQ,EAAE,OAAO,YACrD,EAAE,WAAW,WAAW,OAAO,EAAE,OAAO,UAAU,CAAC,GAAG,KAAK;CAC7D,QAAQ,cAAc;CACtB,QAAQ,eAAe;CACvB,OAAO;AACT;;;;;ACyCA,MAAM,eAAe;CACnB,GAAG;CACH,GAAG;CACH,SAAS;EAAE,MAAM;EAA6B,SAAS;CAAc;CACrE,SAAS;EAAE,MAAM;EAAS,SAAS;CAAM;CACzC,UAAU;EAAE,MAAM;EAAS,SAAS;CAAM;CAC1C,OAAO;EAAE,MAAM;EAAS,SAAS;CAAK;CACtC,cAAc;EAAE,MAAM;EAAS,SAAS;CAAM;CAC9C,SAAS;EAAE,MAAM;EAAS,SAAS;CAAM;;;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,MAAM;EACzB,GACA,EACE,UAAU,cACR,MAAM,UAAU,SAAS,KAAK,CAC5B,OAAO,GACP,EAAE,UAAU;GACV,YAAY,MAAM;GAClB,OAAO,UAAU;GACjB,SAAS,YAAY;GACrB,YAAY,MAAM;GAClB,WAAW,MAAM;GACjB,YAAY,MAAM;GAClB,QAAQ,MAAM;EAChB,CAAC,CACH,EACJ,CACF,CACF,CAAC,CACH,CACF;CACJ;AACF,CAAC"}
package/dist/style.css CHANGED
@@ -1,16 +1,30 @@
1
1
  /*
2
2
  * vueye-table styled theme.
3
3
  *
4
- * Every color, size, and radius is a custom property on .vt-surface, so a theme is a handful of
5
- * overrides. Dark colors apply under prefers-color-scheme unless a surface is forced light, and
6
- * always under data-vt-theme="dark". Any element with .vt-theme carries the tokens, so controls
7
- * placed outside a table match it.
4
+ * Every color, size, and radius is a custom property. The defaults below are declared once, on the
5
+ * outermost themed element (a table surface, a grid, or a standalone .vt-theme control), and at
6
+ * zero specificity: toolbars, menus and footers inside a table inherit the table's tokens, and any
7
+ * host rule that sets a token wins over the default without a specificity fight.
8
+ *
9
+ * Dark colors apply under prefers-color-scheme unless a surface is forced light, and always under
10
+ * data-vt-theme="dark". data-vt-theme="inherit" declares no colors at all: the host sets them on
11
+ * an ancestor, in its own light and dark themes. Sizes keep their defaults unless the host sets
12
+ * them too.
8
13
  */
9
14
 
10
- .vt-surface,
11
- .vt-theme {
15
+ :where(.vt-surface, .vt-theme):where(:not(:is(.vt-surface, .vt-theme) *)) {
12
16
  --vt-font: inherit;
13
17
  --vt-font-size: 0.875rem;
18
+ --vt-radius: 8px;
19
+ --vt-control-radius: 6px;
20
+ --vt-cell-x: 0.75rem;
21
+ --vt-cell-y: 0.625rem;
22
+ --vt-tree-indent: 1.25rem;
23
+ }
24
+
25
+ :where(.vt-surface, .vt-theme):where(:not(:is(.vt-surface, .vt-theme) *)):where(
26
+ :not([data-vt-theme="inherit"])
27
+ ) {
14
28
  --vt-bg: #ffffff;
15
29
  --vt-fg: #1f2328;
16
30
  --vt-muted: #656d76;
@@ -24,13 +38,11 @@
24
38
  --vt-range: rgb(59 91 219 / 0.1);
25
39
  --vt-focus: #3b5bdb;
26
40
  --vt-danger: #cf222e;
27
- --vt-radius: 8px;
28
- --vt-control-radius: 6px;
29
- --vt-cell-x: 0.75rem;
30
- --vt-cell-y: 0.625rem;
31
41
  --vt-shadow: 0 8px 24px rgb(31 35 40 / 0.12);
32
- --vt-tree-indent: 1.25rem;
42
+ }
33
43
 
44
+ .vt-surface,
45
+ .vt-theme {
34
46
  font-family: var(--vt-font);
35
47
  font-size: var(--vt-font-size);
36
48
  color: var(--vt-fg);
@@ -59,18 +71,20 @@
59
71
  border-end-end-radius: calc(var(--vt-radius) - 1px);
60
72
  }
61
73
 
62
- :is(.vt-surface, .vt-theme)[data-density="compact"] {
74
+ :where(.vt-surface, .vt-theme):where([data-density="compact"]) {
63
75
  --vt-cell-x: 0.5rem;
64
76
  --vt-cell-y: 0.3rem;
65
77
  }
66
78
 
67
- :is(.vt-surface, .vt-theme)[data-density="spacious"] {
79
+ :where(.vt-surface, .vt-theme):where([data-density="spacious"]) {
68
80
  --vt-cell-x: 1rem;
69
81
  --vt-cell-y: 0.9rem;
70
82
  }
71
83
 
72
84
  @media (prefers-color-scheme: dark) {
73
- :is(.vt-surface, .vt-theme):not([data-vt-theme="light"]) {
85
+ :where(.vt-surface, .vt-theme):where(:not(:is(.vt-surface, .vt-theme) *)):where(
86
+ :not([data-vt-theme="light"], [data-vt-theme="inherit"])
87
+ ) {
74
88
  --vt-bg: #0d1117;
75
89
  --vt-fg: #e6edf3;
76
90
  --vt-muted: #8d96a0;
@@ -88,7 +102,7 @@
88
102
  }
89
103
  }
90
104
 
91
- :is(.vt-surface, .vt-theme)[data-vt-theme="dark"] {
105
+ :where(.vt-surface, .vt-theme):where([data-vt-theme="dark"]) {
92
106
  --vt-bg: #0d1117;
93
107
  --vt-fg: #e6edf3;
94
108
  --vt-muted: #8d96a0;
@@ -105,6 +119,11 @@
105
119
  --vt-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
106
120
  }
107
121
 
122
+ /* Right to left, a collapsed row's chevron points into the row, at the reader's next column. */
123
+ :where([dir="rtl"]) .vt-expand-toggle[aria-expanded="false"] .vt-icon {
124
+ transform: scaleX(-1);
125
+ }
126
+
108
127
  .vt-scroll {
109
128
  overflow: auto;
110
129
  max-height: var(--vt-max-height, none);
@@ -279,6 +298,13 @@
279
298
  animation: vt-progress 1.1s ease-in-out infinite;
280
299
  }
281
300
 
301
+ /* Right to left, the bar starts at the right edge and runs toward the left. */
302
+ :where([dir="rtl"]) .vt-surface[data-loading] .vt-progress::after {
303
+ inset-inline-start: 0;
304
+ inset-inline-end: auto;
305
+ --vt-progress-sign: -1;
306
+ }
307
+
282
308
  .vt-surface[data-loading] .vt-body {
283
309
  opacity: 0.55;
284
310
  transition: opacity 0.15s;
@@ -286,10 +312,10 @@
286
312
 
287
313
  @keyframes vt-progress {
288
314
  from {
289
- transform: translateX(-100%);
315
+ transform: translateX(calc(-100% * var(--vt-progress-sign, 1)));
290
316
  }
291
317
  to {
292
- transform: translateX(250%);
318
+ transform: translateX(calc(250% * var(--vt-progress-sign, 1)));
293
319
  }
294
320
  }
295
321
 
@@ -536,6 +562,119 @@
536
562
  outline: none;
537
563
  }
538
564
 
565
+ .vt-table [data-edit-cell][data-editable] {
566
+ cursor: text;
567
+ }
568
+ .vt-table [data-edit-cell]:focus-visible {
569
+ outline: 2px solid var(--vt-focus);
570
+ outline-offset: -2px;
571
+ }
572
+ .vt-table [data-dirty] {
573
+ background-color: color-mix(in srgb, var(--vt-accent) 6%, var(--vt-bg));
574
+ }
575
+ .vt-table [data-editing] [data-editor],
576
+ .vt-cell-editor,
577
+ .vt-table [data-select-editor] input,
578
+ .vt-table [data-select-editor] select {
579
+ box-sizing: border-box;
580
+ min-width: 6rem;
581
+ max-width: 100%;
582
+ width: 100%;
583
+ padding: 0.5rem;
584
+ color: var(--vt-fg);
585
+ font: inherit;
586
+ background: var(--vt-bg);
587
+ border: 1px solid var(--vt-border);
588
+ border-radius: 4px;
589
+ accent-color: var(--vt-accent);
590
+ caret-color: var(--vt-accent);
591
+ }
592
+ .vt-table [data-editor][type="checkbox"] {
593
+ width: 1.1rem;
594
+ min-width: 1.1rem;
595
+ height: 1.1rem;
596
+ margin: 0.5rem;
597
+ }
598
+ .vt-table [data-editor]:focus-visible,
599
+ .vt-table [data-select-editor] input:focus-visible {
600
+ outline: 2px solid var(--vt-focus);
601
+ outline-offset: -2px;
602
+ }
603
+ .vt-table [aria-invalid="true"] [data-editor],
604
+ .vt-table [data-editor][aria-invalid="true"] {
605
+ border-color: var(--vt-danger);
606
+ }
607
+ .vt-table [data-edit-issues] {
608
+ display: block;
609
+ padding: 0.4rem 0.5rem;
610
+ color: var(--vt-danger);
611
+ font-size: 0.85em;
612
+ white-space: normal;
613
+ }
614
+ .vt-table [aria-busy="true"] [data-edit-issues] {
615
+ color: var(--vt-muted);
616
+ }
617
+ .vt-table [data-select-editor] {
618
+ min-width: 10rem;
619
+ padding: 0.4rem;
620
+ }
621
+ .vt-table [data-editor-hint] {
622
+ display: block;
623
+ padding-top: 0.35rem;
624
+ font-size: 0.8em;
625
+ color: var(--vt-muted);
626
+ }
627
+ .vt-row-controls {
628
+ width: 1%;
629
+ }
630
+ .vt-row-actions {
631
+ display: flex;
632
+ align-items: center;
633
+ flex-wrap: wrap;
634
+ gap: 0.35rem;
635
+ min-width: 5rem;
636
+ max-width: 100%;
637
+ }
638
+ .vt-row-actions details {
639
+ min-width: 0;
640
+ max-width: 100%;
641
+ }
642
+ .vt-row-actions button,
643
+ .vt-row-actions summary {
644
+ padding: 0.3rem 0.5rem;
645
+ border: 1px solid var(--vt-border);
646
+ border-radius: 4px;
647
+ color: var(--vt-fg);
648
+ background: var(--vt-bg);
649
+ font: inherit;
650
+ font-size: 0.85em;
651
+ cursor: pointer;
652
+ white-space: nowrap;
653
+ }
654
+ .vt-row-actions button:disabled {
655
+ color: var(--vt-muted);
656
+ cursor: default;
657
+ }
658
+ .vt-row-actions button:enabled:hover,
659
+ .vt-row-actions summary:hover {
660
+ background: var(--vt-header-bg);
661
+ }
662
+ .vt-row-actions button:focus-visible,
663
+ .vt-row-actions summary:focus-visible {
664
+ outline: 2px solid var(--vt-focus);
665
+ outline-offset: 2px;
666
+ }
667
+ .vt-row-actions [data-row-menu] {
668
+ display: flex;
669
+ flex-wrap: wrap;
670
+ gap: 0.35rem;
671
+ margin-top: 0.35rem;
672
+ }
673
+ .vt-row-actions [data-row-menu] button {
674
+ max-width: 100%;
675
+ white-space: normal;
676
+ }
677
+
539
678
  .vt-grid .vt-row-number {
540
679
  width: 1%;
541
680
  padding-inline: 0.5rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueye-table/styled",
3
- "version": "3.0.0-alpha.9",
3
+ "version": "3.0.0-beta.2",
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.9",
45
- "@vueye-table/headless": "3.0.0-alpha.9",
46
- "@vueye-table/vue": "3.0.0-alpha.9"
44
+ "@vueye-table/core": "3.0.0-beta.2",
45
+ "@vueye-table/headless": "3.0.0-beta.2",
46
+ "@vueye-table/vue": "3.0.0-beta.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "vue": "3.5.43",