@rozie-ui/data-table-solid 0.7.1 → 0.7.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.mjs CHANGED
@@ -239,7 +239,7 @@ const indexOfRowIn = (rows, rowOriginal, rowId) => {
239
239
  //#endregion
240
240
  //#region src/DataTable.tsx
241
241
  var _tmpl$$11 = /* @__PURE__ */ template(`<div class=rozie-data-table-wrap data-rozie-s-d5dcab4c=""><div class=rdt-column-defs aria-hidden=true data-rozie-s-d5dcab4c=""></div><div class=rdt-toolbar data-rozie-s-d5dcab4c=""><input type=text role=searchbox aria-label="Search table"class=rdt-global-filter data-rozie-s-d5dcab4c="">`), _tmpl$2$4 = /* @__PURE__ */ template(`<div class=rdt-sr-live role=status aria-live=polite aria-atomic=true data-rozie-s-d5dcab4c="">`), _tmpl$3$1 = /* @__PURE__ */ template(`<div class="rdt-sr-live rdt-sr-paste"data-testid=paste-announce role=status aria-live=polite aria-atomic=true data-rozie-s-d5dcab4c="">`), _tmpl$4$1 = /* @__PURE__ */ template(`<div class="rdt-sr-live rdt-sr-range"data-testid=range-announce role=status aria-live=polite aria-atomic=true data-rozie-s-d5dcab4c="">`), _tmpl$5$1 = /* @__PURE__ */ template(`<div class="rdt-sr-live rdt-sr-sortfilter"data-testid=sortfilter-announce role=status aria-live=polite aria-atomic=true data-rozie-s-d5dcab4c="">`), _tmpl$6 = /* @__PURE__ */ template(`<details class=rdt-colvis data-rozie-s-d5dcab4c=""><summary class=rdt-colvis-summary data-rozie-s-d5dcab4c="">Columns</summary><div class=rdt-colvis-menu role=group aria-label="Toggle columns"data-rozie-s-d5dcab4c="">`), _tmpl$7 = /* @__PURE__ */ template(`<label class=rdt-colvis-item data-rozie-s-d5dcab4c=""><input type=checkbox class=rdt-colvis-checkbox data-rozie-s-d5dcab4c=""><span class=rdt-colvis-label data-rozie-s-d5dcab4c="">`), _tmpl$8 = /* @__PURE__ */ template(`<div class=rdt-group-bar-host data-rozie-s-d5dcab4c="">`), _tmpl$9 = /* @__PURE__ */ template(`<span class=rdt-group-token data-group-token=""data-rozie-s-d5dcab4c="">`), _tmpl$0 = /* @__PURE__ */ template(`<div class=rdt-scroll data-rozie-s-d5dcab4c=""><table data-rozie-s-d5dcab4c=""><thead class=rdt-thead role=rowgroup data-rozie-s-d5dcab4c=""></thead><tbody class=rdt-tbody role=rowgroup data-rozie-s-d5dcab4c=""><tr class=rdt-spacer aria-hidden=true data-rozie-s-d5dcab4c=""><td data-rozie-s-d5dcab4c=""></td></tr><tr class=rdt-spacer aria-hidden=true data-rozie-s-d5dcab4c=""><td data-rozie-s-d5dcab4c="">`), _tmpl$1 = /* @__PURE__ */ template(`<table data-rozie-s-d5dcab4c=""><thead class=rdt-thead role=rowgroup data-rozie-s-d5dcab4c=""></thead><tbody class=rdt-tbody role=rowgroup data-rozie-s-d5dcab4c="">`), _tmpl$10 = /* @__PURE__ */ template(`<tr class=rdt-tr role=row data-rozie-s-d5dcab4c="">`), _tmpl$11 = /* @__PURE__ */ template(`<th role=columnheader data-grid-cell=""data-row=__header data-rozie-s-d5dcab4c="">`), _tmpl$12 = /* @__PURE__ */ template(`<span data-rozie-s-d5dcab4c="">`), _tmpl$13 = /* @__PURE__ */ template(`<div class=rdt-col-menu role=menu data-rozie-s-d5dcab4c=""><button type=button role=menuitem class=rdt-col-menu-item data-rozie-s-d5dcab4c="">Pin left</button><button type=button role=menuitem class=rdt-col-menu-item data-rozie-s-d5dcab4c="">Pin right</button><button type=button role=menuitem class=rdt-col-menu-item data-rozie-s-d5dcab4c="">Unpin</button><hr class=rdt-col-menu-sep data-rozie-s-d5dcab4c=""><button type=button role=menuitem class=rdt-col-menu-item data-rozie-s-d5dcab4c="">Hide column`), _tmpl$14 = /* @__PURE__ */ template(`<span data-rozie-s-d5dcab4c=""><button type=button class=rdt-resize-handle data-rozie-s-d5dcab4c=""><span class=rdt-resize-grip aria-hidden=true data-rozie-s-d5dcab4c="">`), _tmpl$15 = /* @__PURE__ */ template(`<button type=button class=rdt-sort-btn data-rozie-s-d5dcab4c=""><span class=rdt-header-label data-rozie-s-d5dcab4c=""></span><span class=rdt-sort-ind aria-hidden=true data-rozie-s-d5dcab4c="">`), _tmpl$16 = /* @__PURE__ */ template(`<span data-rozie-s-d5dcab4c=""><span class=rdt-header-label data-rozie-s-d5dcab4c="">`), _tmpl$17 = /* @__PURE__ */ template(`<button type=button class=rdt-col-menu-trigger data-rozie-s-d5dcab4c="">⋯`), _tmpl$18 = /* @__PURE__ */ template(`<input type=checkbox aria-label="Select all rows"class=rdt-select-all data-rozie-s-d5dcab4c="">`), _tmpl$19 = /* @__PURE__ */ template(`<tr class=rdt-filter-row data-rozie-s-d5dcab4c="">`), _tmpl$20 = /* @__PURE__ */ template(`<th role=presentation data-rozie-s-d5dcab4c="">`), _tmpl$21 = /* @__PURE__ */ template(`<input type=text class=rdt-col-filter data-rozie-s-d5dcab4c="">`), _tmpl$22 = /* @__PURE__ */ template(`<tr role=row data-rozie-s-d5dcab4c="">`), _tmpl$23 = /* @__PURE__ */ template(`<td data-grid-cell=""data-rozie-s-d5dcab4c="">`), _tmpl$24 = /* @__PURE__ */ template(`<span data-rozie-s-d5dcab4c=""><button type=button data-expander=""class="rdt-expander rdt-group-toggle"data-rozie-s-d5dcab4c=""></button><span class=rdt-group-value data-rozie-s-d5dcab4c=""></span><span class=rdt-group-count data-rozie-s-d5dcab4c="">`), _tmpl$25 = /* @__PURE__ */ template(`<span class=rdt-cell-value data-rozie-s-d5dcab4c="">`), _tmpl$26 = /* @__PURE__ */ template(`<input type=number data-editing-cell=""data-builtin-editor=""class=rdt-cell-editor data-rozie-s-d5dcab4c="">`), _tmpl$27 = /* @__PURE__ */ template(`<select data-editing-cell=""data-builtin-editor=""class=rdt-cell-editor data-rozie-s-d5dcab4c="">`), _tmpl$28 = /* @__PURE__ */ template(`<input type=checkbox data-editing-cell=""data-builtin-editor=""class=rdt-cell-editor data-rozie-s-d5dcab4c="">`), _tmpl$29 = /* @__PURE__ */ template(`<input type=text data-editing-cell=""data-builtin-editor=""class=rdt-cell-editor data-rozie-s-d5dcab4c="">`), _tmpl$30 = /* @__PURE__ */ template(`<option data-rozie-s-d5dcab4c="">`), _tmpl$31 = /* @__PURE__ */ template(`<input type=checkbox aria-label="Select row"class=rdt-select-row data-rozie-s-d5dcab4c="">`), _tmpl$32 = /* @__PURE__ */ template(`<button type=button data-expander=""class=rdt-expander data-rozie-s-d5dcab4c="">`), _tmpl$33 = /* @__PURE__ */ template(`<span data-fill-handle=""data-testid=fill-handle aria-hidden=true class=rdt-fill-handle data-rozie-s-d5dcab4c="">`), _tmpl$34 = /* @__PURE__ */ template(`<tr class=rdt-detail-row role=row data-rozie-s-d5dcab4c=""><td class=rdt-detail-cell data-rozie-s-d5dcab4c="">`), _tmpl$35 = /* @__PURE__ */ template(`<th class=rdt-col-spacer aria-hidden=true data-rozie-s-d5dcab4c="">`), _tmpl$36 = /* @__PURE__ */ template(`<td class=rdt-col-spacer aria-hidden=true data-rozie-s-d5dcab4c="">`), _tmpl$37 = /* @__PURE__ */ template(`<span data-rozie-s-d5dcab4c=""><input class=rdt-select-placeholder type=checkbox tabindex=-1 aria-hidden=true data-rozie-s-d5dcab4c="">`), _tmpl$38 = /* @__PURE__ */ template(`<span class=rdt-skeleton aria-hidden=true data-rozie-s-d5dcab4c="">&#8203;`), _tmpl$39 = /* @__PURE__ */ template(`<div class=rdt-pagination role=group aria-label=Pagination data-rozie-s-d5dcab4c=""><button type=button class="rdt-page-btn rdt-page-prev"data-rozie-s-d5dcab4c="">Prev</button><span class=rdt-page-status aria-live=polite data-rozie-s-d5dcab4c=""></span><button type=button class="rdt-page-btn rdt-page-next"data-rozie-s-d5dcab4c="">Next</button><select aria-label="Rows per page"class=rdt-page-size data-rozie-s-d5dcab4c=""><option value=10 data-rozie-s-d5dcab4c="">10</option><option value=25 data-rozie-s-d5dcab4c="">25</option><option value=50 data-rozie-s-d5dcab4c="">50</option><option value=100 data-rozie-s-d5dcab4c="">100`);
242
- __rozieInjectStyle("DataTable-d5dcab4c", `[data-rozie-s-d5dcab4c]:host {
242
+ /** A cell position as integers over the visible (display-order) model. */ /** The active (roving-focus) cell. A header cell reports `rowIndex: null` and `isHeader: true`. */ /** The rectangular cell-range selection. Both corners are `null` when there is no range. */ /** One data column offered to the `#groupBar` slot. */ /** One changed cell inside a row edit commit. */ /** The `activecell-change` payload. `isHeader` is set when the move landed on or left a header cell. */ /** The `cell-edit-commit` payload: one committed cell. */ /** The `row-edit-commit` payload: the row and every cell the save changed. */ /** The `filter-change` payload: `globalFilter` for the search box, `columnFilters` for a per-column filter. Exactly one key is set. */ /** The `history-change` payload: undo/redo availability. */ /** The `range-change` payload: the new range corners (both `null` when the range cleared). */ /** The `row-activate` payload. `row` is the original data object and `index` its position in the rendered model. */ /** The `visible-range-change` payload: the rendered row window, `end` exclusive. */ __rozieInjectStyle("DataTable-d5dcab4c", `[data-rozie-s-d5dcab4c]:host {
243
243
  --rdt-color: var(--rozie-data-table-fg, var(--rdt-ds-fg));
244
244
  --rdt-select-accent: var(--rozie-data-table-select-accent, var(--rozie-data-table-accent, var(--rdt-ds-select-accent)));
245
245
  --rdt-border: 1px solid var(--rozie-data-table-border-color, var(--rdt-ds-border-color));
@@ -692,23 +692,23 @@ function DataTable(_props) {
692
692
  "maxHeight",
693
693
  "children",
694
694
  "ref",
695
- "onSortChange",
695
+ "onActivecellChange",
696
+ "onCellEditCommit",
696
697
  "onExpandChange",
697
- "onGroupChange",
698
698
  "onFilterChange",
699
+ "onGroupChange",
700
+ "onHistoryChange",
699
701
  "onPageChange",
700
- "onSelectionChange",
701
- "onVisibilityChange",
702
- "onResizeChange",
703
- "onReorderChange",
704
702
  "onPinChange",
705
- "onHistoryChange",
706
- "onVisibleRangeChange",
707
- "onActivecellChange",
708
- "onRowActivate",
709
703
  "onRangeChange",
710
- "onCellEditCommit",
711
- "onRowEditCommit"
704
+ "onReorderChange",
705
+ "onResizeChange",
706
+ "onRowActivate",
707
+ "onRowEditCommit",
708
+ "onSelectionChange",
709
+ "onSortChange",
710
+ "onVisibilityChange",
711
+ "onVisibleRangeChange"
712
712
  ]);
713
713
  const resolved = () => local.children;
714
714
  onMount(() => {
@@ -690,23 +690,23 @@ function DataTable(_props) {
690
690
  "maxHeight",
691
691
  "children",
692
692
  "ref",
693
- "onSortChange",
693
+ "onActivecellChange",
694
+ "onCellEditCommit",
694
695
  "onExpandChange",
695
- "onGroupChange",
696
696
  "onFilterChange",
697
+ "onGroupChange",
698
+ "onHistoryChange",
697
699
  "onPageChange",
698
- "onSelectionChange",
699
- "onVisibilityChange",
700
- "onResizeChange",
701
- "onReorderChange",
702
700
  "onPinChange",
703
- "onHistoryChange",
704
- "onVisibleRangeChange",
705
- "onActivecellChange",
706
- "onRowActivate",
707
701
  "onRangeChange",
708
- "onCellEditCommit",
709
- "onRowEditCommit"
702
+ "onReorderChange",
703
+ "onResizeChange",
704
+ "onRowActivate",
705
+ "onRowEditCommit",
706
+ "onSelectionChange",
707
+ "onSortChange",
708
+ "onVisibilityChange",
709
+ "onVisibleRangeChange"
710
710
  ]);
711
711
  const resolved = () => local.children;
712
712
  onMount(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rozie-ui/data-table-solid",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -43,11 +43,12 @@
43
43
  },
44
44
  "files": [
45
45
  "dist",
46
- "src"
46
+ "src",
47
+ "CHANGELOG.md"
47
48
  ],
48
49
  "dependencies": {
49
50
  "@solid-primitives/keyed": "^1.5.3",
50
- "@rozie/runtime-solid": "^0.8.0"
51
+ "@rozie/runtime-solid": "^0.9.0"
51
52
  },
52
53
  "peerDependencies": {
53
54
  "solid-js": "^1.8",
package/src/DataTable.tsx CHANGED
@@ -44,6 +44,78 @@ import { columnSpecsEquivalent } from './helpers/columnDefUtils';
44
44
 
45
45
  // The registry API handed to <Column> children (whole-object-replace — T-48-PP guard).
46
46
 
47
+ import type { Column as TableColumn, ColumnDef, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, GroupingState, PaginationState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/table-core';
48
+
49
+ /** A cell position as integers over the visible (display-order) model. */
50
+ export interface DataTableCellPosition {
51
+ rowIndex: number;
52
+ colIndex: number;
53
+ }
54
+ /** The active (roving-focus) cell. A header cell reports `rowIndex: null` and `isHeader: true`. */
55
+ export interface DataTableActiveCell {
56
+ rowIndex: number | null;
57
+ colIndex: number;
58
+ isHeader: boolean;
59
+ }
60
+ /** The rectangular cell-range selection. Both corners are `null` when there is no range. */
61
+ export interface DataTableRange {
62
+ anchor: DataTableCellPosition | null;
63
+ focus: DataTableCellPosition | null;
64
+ }
65
+ /** One data column offered to the `#groupBar` slot. */
66
+ export interface DataTableGroupableColumn {
67
+ id: string;
68
+ label: string;
69
+ }
70
+ /** One changed cell inside a row edit commit. */
71
+ export interface DataTableCellChange {
72
+ columnId: string;
73
+ oldValue: any;
74
+ newValue: any;
75
+ }
76
+
77
+ /** The `activecell-change` payload. `isHeader` is set when the move landed on or left a header cell. */
78
+ export interface DataTableActiveCellChangePayload {
79
+ rowIndex: number | null;
80
+ colIndex: number;
81
+ isHeader?: boolean;
82
+ }
83
+ /** The `cell-edit-commit` payload: one committed cell. */
84
+ export interface DataTableCellEditCommitPayload {
85
+ rowId: string;
86
+ columnId: string;
87
+ oldValue: any;
88
+ newValue: any;
89
+ }
90
+ /** The `row-edit-commit` payload: the row and every cell the save changed. */
91
+ export interface DataTableRowEditCommitPayload {
92
+ rowId: string;
93
+ changes: DataTableCellChange[];
94
+ }
95
+ /** The `filter-change` payload: `globalFilter` for the search box, `columnFilters` for a per-column filter. Exactly one key is set. */
96
+ export interface DataTableFilterChangePayload {
97
+ globalFilter?: string;
98
+ columnFilters?: ColumnFiltersState;
99
+ }
100
+ /** The `history-change` payload: undo/redo availability. */
101
+ export interface DataTableHistoryChangePayload {
102
+ canUndo: boolean;
103
+ canRedo: boolean;
104
+ }
105
+ /** The `range-change` payload: the new range corners (both `null` when the range cleared). */
106
+ export type DataTableRangeChangePayload = DataTableRange;
107
+ /** The `row-activate` payload. `row` is the original data object and `index` its position in the rendered model. */
108
+ export interface DataTableRowActivatePayload {
109
+ row: any;
110
+ index: number;
111
+ trigger: 'keyboard' | 'click';
112
+ }
113
+ /** The `visible-range-change` payload: the rendered row window, `end` exclusive. */
114
+ export interface DataTableVisibleRangeChangePayload {
115
+ start: number;
116
+ end: number;
117
+ }
118
+
47
119
  __rozieInjectStyle('DataTable-d5dcab4c', `[data-rozie-s-d5dcab4c]:host {
48
120
  --rdt-color: var(--rozie-data-table-fg, var(--rdt-ds-fg));
49
121
  --rdt-select-accent: var(--rozie-data-table-select-accent, var(--rozie-data-table-accent, var(--rdt-ds-select-accent)));
@@ -445,23 +517,23 @@ __rozieInjectStyle('DataTable-d5dcab4c', `[data-rozie-s-d5dcab4c]:host {
445
517
  accent-color: var(--rdt-select-accent, currentColor);
446
518
  }`);
447
519
 
448
- interface GroupBarSlotCtx { grouping: any; groupableColumns: any; applyGrouping: any; clearGrouping: any; }
520
+ interface GroupBarSlotCtx { grouping: string[]; groupableColumns: DataTableGroupableColumn[]; applyGrouping: (cols: string[]) => void; clearGrouping: () => void; }
449
521
 
450
- interface SelectAllSlotCtx { checked: any; indeterminate: any; toggle: any; }
522
+ interface SelectAllSlotCtx { checked: boolean; indeterminate: boolean; toggle: (event: any) => void; }
451
523
 
452
- interface PlaceholderSlotCtx { index: any; columnId: any; }
524
+ interface PlaceholderSlotCtx { index: number; columnId: string; }
453
525
 
454
- interface SelectCellSlotCtx { row: any; checked: any; toggle: any; }
526
+ interface SelectCellSlotCtx { row: any; checked: boolean; toggle: (event: any) => void; }
455
527
 
456
528
  interface DetailSlotCtx { row: any; }
457
529
 
458
- interface ColHeaderSlotCtx { columnId: any; column: any; label: any; }
530
+ interface ColHeaderSlotCtx { columnId: string; column: TableColumn<any, unknown>; label: string; }
459
531
 
460
- interface FilterSlotCtx { columnId: any; value: any; uniqueValues: any; minMax: any; columnLabel: any; setFilter: any; }
532
+ interface FilterSlotCtx { columnId: string; value: any; uniqueValues: any[]; minMax: [number, number] | null; columnLabel: string; setFilter: (columnId: string, value: any) => void; }
461
533
 
462
- interface CellSlotCtx { columnId: any; column: any; row: any; value: any; }
534
+ interface CellSlotCtx { columnId: string; column: TableColumn<any, unknown>; row: any; value: any; }
463
535
 
464
- interface EditorSlotCtx { columnId: any; column: any; row: any; value: any; commit: any; cancel: any; columnLabel: any; autofocus: any; }
536
+ interface EditorSlotCtx { columnId: string; column: TableColumn<any, unknown>; row: any; value: any; commit: (value: any) => void; cancel: () => void; columnLabel: string; autofocus: boolean; }
465
537
 
466
538
  interface DataTableProps {
467
539
  /**
@@ -610,23 +682,23 @@ interface DataTableProps {
610
682
  * A CSS length string bounding the `rdt-scroll` container when `virtual` is on (e.g. `'400px'`). Mirrored to the `--rozie-data-table-max-height` custom property; the prop wins, the token is the fallback.
611
683
  */
612
684
  maxHeight?: string;
613
- onSortChange?: (...args: any[]) => void;
614
- onExpandChange?: (...args: any[]) => void;
615
- onGroupChange?: (...args: any[]) => void;
616
- onFilterChange?: (...args: any[]) => void;
617
- onPageChange?: (...args: any[]) => void;
618
- onSelectionChange?: (...args: any[]) => void;
619
- onVisibilityChange?: (...args: any[]) => void;
620
- onResizeChange?: (...args: any[]) => void;
621
- onReorderChange?: (...args: any[]) => void;
622
- onPinChange?: (...args: any[]) => void;
623
- onHistoryChange?: (...args: any[]) => void;
624
- onVisibleRangeChange?: (...args: any[]) => void;
625
- onActivecellChange?: (...args: any[]) => void;
626
- onRowActivate?: (...args: any[]) => void;
627
- onRangeChange?: (...args: any[]) => void;
628
- onCellEditCommit?: (...args: any[]) => void;
629
- onRowEditCommit?: (...args: any[]) => void;
685
+ onActivecellChange?: (payload: DataTableActiveCellChangePayload) => void;
686
+ onCellEditCommit?: (payload: DataTableCellEditCommitPayload) => void;
687
+ onExpandChange?: (payload: ExpandedState) => void;
688
+ onFilterChange?: (payload: DataTableFilterChangePayload) => void;
689
+ onGroupChange?: (payload: GroupingState) => void;
690
+ onHistoryChange?: (payload: DataTableHistoryChangePayload) => void;
691
+ onPageChange?: (payload: PaginationState) => void;
692
+ onPinChange?: (payload: ColumnPinningState) => void;
693
+ onRangeChange?: (payload: DataTableRangeChangePayload) => void;
694
+ onReorderChange?: (payload: ColumnOrderState) => void;
695
+ onResizeChange?: (payload: ColumnSizingState) => void;
696
+ onRowActivate?: (payload: DataTableRowActivatePayload) => void;
697
+ onRowEditCommit?: (payload: DataTableRowEditCommitPayload) => void;
698
+ onSelectionChange?: (payload: RowSelectionState) => void;
699
+ onSortChange?: (payload: SortingState) => void;
700
+ onVisibilityChange?: (payload: VisibilityState) => void;
701
+ onVisibleRangeChange?: (payload: DataTableVisibleRangeChangePayload) => void;
630
702
  // D-131: default slot resolved via children() at body top
631
703
  children?: JSX.Element;
632
704
  groupBarSlot?: (ctx: GroupBarSlotCtx) => JSX.Element;
@@ -638,52 +710,52 @@ interface DataTableProps {
638
710
  filterSlot?: (ctx: FilterSlotCtx) => JSX.Element;
639
711
  cellSlot?: (ctx: CellSlotCtx) => JSX.Element;
640
712
  editorSlot?: (ctx: EditorSlotCtx) => JSX.Element;
641
- slots?: { [key: `colHeader-${string}`]: ((ctx: { columnId: any; column: any; label: any }) => JSX.Element) | undefined; [key: `filter-${string}`]: ((ctx: { columnId: any; value: any; uniqueValues: any; minMax: any; columnLabel: any; setFilter: any }) => JSX.Element) | undefined; [key: `cell-${string}`]: ((ctx: { columnId: any; column: any; row: any; value: any }) => JSX.Element) | undefined; [key: `editor-${string}`]: ((ctx: { columnId: any; column: any; row: any; value: any; commit: any; cancel: any; columnLabel: any; autofocus: any }) => JSX.Element) | undefined; [key: string]: ((...args: any[]) => JSX.Element) | undefined; };
713
+ slots?: { [key: `colHeader-${string}`]: ((ctx: { columnId: string; column: TableColumn<any, unknown>; label: string }) => JSX.Element) | undefined; [key: `filter-${string}`]: ((ctx: { columnId: string; value: any; uniqueValues: any[]; minMax: [number, number] | null; columnLabel: string; setFilter: (columnId: string, value: any) => void }) => JSX.Element) | undefined; [key: `cell-${string}`]: ((ctx: { columnId: string; column: TableColumn<any, unknown>; row: any; value: any }) => JSX.Element) | undefined; [key: `editor-${string}`]: ((ctx: { columnId: string; column: TableColumn<any, unknown>; row: any; value: any; commit: (value: any) => void; cancel: () => void; columnLabel: string; autofocus: boolean }) => JSX.Element) | undefined; [key: string]: ((...args: any[]) => JSX.Element) | undefined; };
642
714
  ref?: (h: DataTableHandle) => void;
643
715
  }
644
716
 
645
717
  export interface DataTableHandle {
646
- sortColumn: (...args: any[]) => any;
647
- clearSorting: (...args: any[]) => any;
648
- toggleRowExpanded: (...args: any[]) => any;
649
- expandAll: (...args: any[]) => any;
650
- collapseAll: (...args: any[]) => any;
651
- getExpandedRows: (...args: any[]) => any;
652
- applyGrouping: (...args: any[]) => any;
653
- clearGrouping: (...args: any[]) => any;
654
- getFacetedUniqueValues: (...args: any[]) => any;
655
- getFacetedMinMaxValues: (...args: any[]) => any;
656
- getColumnDefs: (...args: any[]) => any;
657
- toggleAllRows: (...args: any[]) => any;
658
- clearSelection: (...args: any[]) => any;
659
- getSelectedRows: (...args: any[]) => any;
660
- setPage: (...args: any[]) => any;
661
- setRowsPerPage: (...args: any[]) => any;
662
- toggleColumnVisibility: (...args: any[]) => any;
663
- applyColumnOrder: (...args: any[]) => any;
664
- resetColumnSizing: (...args: any[]) => any;
665
- pinColumn: (...args: any[]) => any;
666
- focusCell: (...args: any[]) => any;
667
- getActiveCell: (...args: any[]) => any;
668
- clearActiveCell: (...args: any[]) => any;
718
+ sortColumn: (colId: string, desc?: boolean) => void;
719
+ clearSorting: () => void;
720
+ toggleRowExpanded: (rowId: string | number) => void;
721
+ expandAll: () => void;
722
+ collapseAll: () => void;
723
+ getExpandedRows: () => any[];
724
+ applyGrouping: (cols: string[]) => void;
725
+ clearGrouping: () => void;
726
+ getFacetedUniqueValues: (colId: string) => any[];
727
+ getFacetedMinMaxValues: (colId: string) => [number, number] | null;
728
+ getColumnDefs: () => ColumnDef<any, any>[];
729
+ toggleAllRows: (value?: boolean) => void;
730
+ clearSelection: () => void;
731
+ getSelectedRows: () => any[];
732
+ setPage: (idx: number) => void;
733
+ setRowsPerPage: (size: number) => void;
734
+ toggleColumnVisibility: (colId: string) => void;
735
+ applyColumnOrder: (order: string[]) => void;
736
+ resetColumnSizing: () => void;
737
+ pinColumn: (colId: string, side: 'left' | 'right' | false) => void;
738
+ focusCell: (rowIndex: number, colIndex: number) => void;
739
+ getActiveCell: () => DataTableActiveCell;
740
+ clearActiveCell: () => void;
669
741
  scrollToRow(index: any, options?: { align?: 'start' | 'center' | 'end' | 'auto'; behavior?: 'auto' | 'smooth' | 'instant'; }): void;
670
- getScrollElement(): any;
671
- getRowIndexRelativeToPage: (...args: any[]) => any;
672
- editCell: (...args: any[]) => any;
673
- commitEditing: (...args: any[]) => any;
674
- editRow: (...args: any[]) => any;
675
- getSelectedRange: (...args: any[]) => any;
676
- cut: (...args: any[]) => any;
677
- undo: (...args: any[]) => any;
678
- redo: (...args: any[]) => any;
679
- canUndo: (...args: any[]) => any;
680
- canRedo: (...args: any[]) => any;
681
- clearHistory: (...args: any[]) => any;
742
+ getScrollElement: () => HTMLElement | null;
743
+ getRowIndexRelativeToPage: (absRow?: number) => number;
744
+ editCell: (rowIndex: number, colIndex: number) => void;
745
+ commitEditing: () => void;
746
+ editRow: (rowIndex: number) => void;
747
+ getSelectedRange: () => DataTableRange;
748
+ cut: () => void;
749
+ undo: () => void;
750
+ redo: () => void;
751
+ canUndo: () => boolean;
752
+ canRedo: () => boolean;
753
+ clearHistory: () => void;
682
754
  }
683
755
 
684
756
  export default function DataTable(_props: DataTableProps): JSX.Element {
685
757
  const _merged = mergeProps({ columns: (() => [])() as any[], selectionMode: 'none', manual: false, rowCount: null, pageCount: null, expandable: false, getRowId: null, getSubRows: null, groupable: false, stickyHeader: false, interactionMode: 'table', singleClickEdit: false, undoable: false, undoLimit: 100, virtual: false, estimateRowHeight: 40, autoMeasure: false, maxHeight: '' }, _props);
686
- const [local, attrs] = splitProps(_merged, ['data', 'columns', 'selectionMode', 'sorting', 'globalFilter', 'columnFilters', 'pagination', 'manual', 'rowCount', 'pageCount', 'expandable', 'expanded', 'getRowId', 'getSubRows', 'groupable', 'grouping', 'rowSelection', 'columnVisibility', 'columnSizing', 'columnOrder', 'columnPinning', 'stickyHeader', 'interactionMode', 'singleClickEdit', 'undoable', 'undoLimit', 'virtual', 'estimateRowHeight', 'autoMeasure', 'maxHeight', 'children', 'ref', 'onSortChange', 'onExpandChange', 'onGroupChange', 'onFilterChange', 'onPageChange', 'onSelectionChange', 'onVisibilityChange', 'onResizeChange', 'onReorderChange', 'onPinChange', 'onHistoryChange', 'onVisibleRangeChange', 'onActivecellChange', 'onRowActivate', 'onRangeChange', 'onCellEditCommit', 'onRowEditCommit']);
758
+ const [local, attrs] = splitProps(_merged, ['data', 'columns', 'selectionMode', 'sorting', 'globalFilter', 'columnFilters', 'pagination', 'manual', 'rowCount', 'pageCount', 'expandable', 'expanded', 'getRowId', 'getSubRows', 'groupable', 'grouping', 'rowSelection', 'columnVisibility', 'columnSizing', 'columnOrder', 'columnPinning', 'stickyHeader', 'interactionMode', 'singleClickEdit', 'undoable', 'undoLimit', 'virtual', 'estimateRowHeight', 'autoMeasure', 'maxHeight', 'children', 'ref', 'onActivecellChange', 'onCellEditCommit', 'onExpandChange', 'onFilterChange', 'onGroupChange', 'onHistoryChange', 'onPageChange', 'onPinChange', 'onRangeChange', 'onReorderChange', 'onResizeChange', 'onRowActivate', 'onRowEditCommit', 'onSelectionChange', 'onSortChange', 'onVisibilityChange', 'onVisibleRangeChange']);
687
759
  const resolved = () => local.children;
688
760
  onMount(() => { local.ref?.({ sortColumn, clearSorting, toggleRowExpanded, expandAll, collapseAll, getExpandedRows, applyGrouping, clearGrouping, getFacetedUniqueValues, getFacetedMinMaxValues, getColumnDefs, toggleAllRows, clearSelection, getSelectedRows, setPage, setRowsPerPage, toggleColumnVisibility, applyColumnOrder, resetColumnSizing, pinColumn, focusCell, getActiveCell, clearActiveCell, scrollToRow, getScrollElement, getRowIndexRelativeToPage, editCell, commitEditing, editRow, getSelectedRange, cut, undo, redo, canUndo, canRedo, clearHistory }); });
689
761
 
package/src/index.ts CHANGED
@@ -14,3 +14,4 @@ export { default as DetailPanel } from './DetailPanel';
14
14
 
15
15
  /** The `$expose` imperative handle received via `ref` — { sortColumn, clearSorting, toggleRowExpanded, expandAll, collapseAll, getExpandedRows, applyGrouping, clearGrouping, getFacetedUniqueValues, getFacetedMinMaxValues, getColumnDefs, toggleAllRows, clearSelection, getSelectedRows, setPage, setRowsPerPage, toggleColumnVisibility, applyColumnOrder, resetColumnSizing, pinColumn, focusCell, getActiveCell, clearActiveCell, scrollToRow, getScrollElement, getRowIndexRelativeToPage, editCell, commitEditing, editRow, getSelectedRange, cut, undo, redo, canUndo, canRedo, clearHistory }. */
16
16
  export type { DataTableHandle } from './DataTable';
17
+ export type * from './DataTable';