@coldsmirk/ledger-mantine 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.cjs +149 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -2
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +40 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +149 -6
- package/dist/index.js.map +1 -1
- package/dist/labels-Ck0Y2Ser.d.cts.map +1 -0
- package/dist/labels-Ck0Y2Ser.d.ts.map +1 -0
- package/dist/locales.d.cts.map +1 -0
- package/dist/locales.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ import { n as defaultLabels, t as DataTableLabels } from "./labels-Ck0Y2Ser.cjs"
|
|
|
3
3
|
import { BoxProps, ComboboxData, ElementProps, Factory, MantineBreakpoint, MantineColor, MantineRadius, MantineSize, MantineSpacing, PopoverProps, StylesApiProps, TableTdProps, TableThProps, TableTrProps, TextInputProps } from "@mantine/core";
|
|
4
4
|
import { Cell as Cell$1, CellData, Column as Column$1, ColumnDef as ColumnDef$1, ColumnFiltersState, ColumnFiltersState as ColumnFiltersState$1, ColumnOrderState, ColumnOrderState as ColumnOrderState$1, ColumnPinningState, ColumnPinningState as ColumnPinningState$1, ColumnSizingState, ColumnSizingState as ColumnSizingState$1, ColumnVisibilityState, ColumnVisibilityState as ColumnVisibilityState$1, ExpandedState, ExpandedState as ExpandedState$1, FilterFn, FilterFnOption, GroupingState, GroupingState as GroupingState$1, Header as Header$1, HeaderGroup as HeaderGroup$1, PaginationState, PaginationState as PaginationState$1, ReactTable, Row as Row$1, RowData, RowData as RowData$1, RowPinningState, RowPinningState as RowPinningState$1, RowSelectionState, RowSelectionState as RowSelectionState$1, SortingState, SortingState as SortingState$1, TableFeatures, TableOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, flexRender } from "@tanstack/react-table";
|
|
5
5
|
import { CSSProperties, ComponentProps, ComponentType, JSX as JSX$1, KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref } from "react";
|
|
6
|
+
import "@tanstack/react-virtual";
|
|
6
7
|
//#region src/icons.d.ts
|
|
7
8
|
/**
|
|
8
9
|
* What a replacement icon receives — the two knobs the chrome actually turns. Lucide icons are
|
|
@@ -222,6 +223,24 @@ export declare function createColumnHelper<TData extends RowData$1>(): import("@
|
|
|
222
223
|
};
|
|
223
224
|
}, TData>;
|
|
224
225
|
//#endregion
|
|
226
|
+
//#region src/scroll-snapshot.d.ts
|
|
227
|
+
declare const scrollSnapshotBrand: unique symbol;
|
|
228
|
+
/**
|
|
229
|
+
* Opaque, plain-data snapshot of a table's scroll position and measured virtualized row heights.
|
|
230
|
+
*
|
|
231
|
+
* Capture with `handle.getScrollSnapshot()`, hold across unmounts (in memory, history state, or
|
|
232
|
+
* storage), validate untrusted values with {@link isDataTableScrollSnapshot}, and pass back to
|
|
233
|
+
* `<DataTable initialScroll={snapshot} />` on remount.
|
|
234
|
+
*/
|
|
235
|
+
interface DataTableScrollSnapshot {
|
|
236
|
+
readonly [scrollSnapshotBrand]: "scroll-snapshot";
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Validates an unknown value — such as one read back from `sessionStorage` or router history
|
|
240
|
+
* state — as a {@link DataTableScrollSnapshot} written by this version of ledger.
|
|
241
|
+
*/
|
|
242
|
+
export declare function isDataTableScrollSnapshot(value: unknown): value is DataTableScrollSnapshot;
|
|
243
|
+
//#endregion
|
|
225
244
|
//#region src/types.d.ts
|
|
226
245
|
/**
|
|
227
246
|
* TanStack's table instance (the enriched React shape: `state`, `Subscribe`, `FlexRender`),
|
|
@@ -604,6 +623,17 @@ interface DataTableHandle<TData extends RowData$1> {
|
|
|
604
623
|
* window is not rendering is still reachable. Pinned columns are already in view; a no-op.
|
|
605
624
|
*/
|
|
606
625
|
scrollToColumn: (columnId: string, options?: DataTableScrollOptions) => void;
|
|
626
|
+
/**
|
|
627
|
+
* Captures an opaque, plain-data snapshot of the table's scroll offsets and measured virtualized
|
|
628
|
+
* row heights for restoration via `<DataTable initialScroll={snapshot} />`
|
|
629
|
+
* ([virtualization.md](../docs/virtualization.md#restoring-scroll-position)).
|
|
630
|
+
*
|
|
631
|
+
* Call while the table is still mounted — for example before navigating away, or in a parent
|
|
632
|
+
* component's `useLayoutEffect` cleanup (a passive `useEffect` cleanup runs after the table's
|
|
633
|
+
* DOM has already unmounted, where this returns `null`). On remount, `initialScroll` is applied
|
|
634
|
+
* once to the rows the table mounts with; rows that arrive later are not scrolled to.
|
|
635
|
+
*/
|
|
636
|
+
getScrollSnapshot: () => DataTableScrollSnapshot | null;
|
|
607
637
|
/**
|
|
608
638
|
* Cell mode requires `columnId`; row mode takes the id of any editable column to focus, or
|
|
609
639
|
* none.
|
|
@@ -1069,6 +1099,14 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
|
|
|
1069
1099
|
virtualizedColumns?: boolean | {
|
|
1070
1100
|
overscan?: number;
|
|
1071
1101
|
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Mount-only scroll snapshot from an earlier table's `handle.getScrollSnapshot()`
|
|
1104
|
+
* ([virtualization.md](../docs/virtualization.md#restoring-scroll-position)).
|
|
1105
|
+
*
|
|
1106
|
+
* Applied once to the rows the table mounts with (rows arriving later are not scrolled to),
|
|
1107
|
+
* best-effort and clamped when the dataset is shorter or the shape version does not match.
|
|
1108
|
+
*/
|
|
1109
|
+
initialScroll?: DataTableScrollSnapshot | null;
|
|
1072
1110
|
onEndReached?: () => void;
|
|
1073
1111
|
endReachedOffset?: number;
|
|
1074
1112
|
loadingMore?: boolean;
|
|
@@ -1136,7 +1174,7 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
|
|
|
1136
1174
|
*/
|
|
1137
1175
|
icons?: Partial<DataTableIcons>;
|
|
1138
1176
|
/**
|
|
1139
|
-
* Imperative handle: `{ table, viewport, scrollToRow, scrollToIndex, scrollToColumn, startEditing, stopEditing }`.
|
|
1177
|
+
* Imperative handle: `{ table, viewport, scrollToRow, scrollToIndex, scrollToColumn, getScrollSnapshot, startEditing, stopEditing }`.
|
|
1140
1178
|
*/
|
|
1141
1179
|
handleRef?: Ref<DataTableHandle<TData>>;
|
|
1142
1180
|
}
|
|
@@ -1247,5 +1285,5 @@ export declare function checkboxEditor(): DataTableInstantEditRenderer<any, any>
|
|
|
1247
1285
|
//#region src/use-data-table.d.ts
|
|
1248
1286
|
export declare function useDataTable<TData extends RowData$1>(options: UseDataTableOptions<TData>): TableInstance<TData>;
|
|
1249
1287
|
//#endregion
|
|
1250
|
-
export { type Cell, type Column, type ColumnDef, type ColumnFiltersState, type ColumnOrderState, type ColumnPinningState, type ColumnSizingState, type ColumnVisibilityState, type DataTableBaseProps, type DataTableColumnsPanelProps, type DataTableCssVariables, type DataTableEditCommit, type DataTableEditConfig, type DataTableEditContext, type DataTableEditMode, type DataTableEditRenderer, type DataTableEditTrigger, type DataTableEditingCell, type DataTableElementProps, type DataTableExportMeta, type DataTableFactory, type DataTableFilterConfig, type DataTableFilterVariant, type DataTableHandle, type DataTableIconComponent, type DataTableIconProps, type DataTableIcons, type DataTableInstantEditConfig, type DataTableInstantEditContext, type DataTableInstantEditRenderer, type DataTableLabels, type DataTablePaginationProps, type DataTablePersistState, type DataTablePersistableSlice, type DataTableProps, type DataTableRowEditCommit, type DataTableRowReorder, type DataTableScrollOptions, type DataTableSearchProps, type DataTableSelectionBarProps, type DataTableStylesNames, type ExpandedState, type GroupingState, type Header, type HeaderGroup, type LedgerCellEditor, type LedgerEditingController, type LedgerFeatures, type LedgerInstantEditingController, type LedgerMeta, type LedgerRowEditingController, type LedgerRowEditor, type PaginationState, type Row, type RowData, type RowPinningState, type RowSelectionState, type SortingState, type TableInstance, type ToCsvOptions, type UseDataTableOptions, defaultLabels, flexRender };
|
|
1288
|
+
export { type Cell, type Column, type ColumnDef, type ColumnFiltersState, type ColumnOrderState, type ColumnPinningState, type ColumnSizingState, type ColumnVisibilityState, type DataTableBaseProps, type DataTableColumnsPanelProps, type DataTableCssVariables, type DataTableEditCommit, type DataTableEditConfig, type DataTableEditContext, type DataTableEditMode, type DataTableEditRenderer, type DataTableEditTrigger, type DataTableEditingCell, type DataTableElementProps, type DataTableExportMeta, type DataTableFactory, type DataTableFilterConfig, type DataTableFilterVariant, type DataTableHandle, type DataTableIconComponent, type DataTableIconProps, type DataTableIcons, type DataTableInstantEditConfig, type DataTableInstantEditContext, type DataTableInstantEditRenderer, type DataTableLabels, type DataTablePaginationProps, type DataTablePersistState, type DataTablePersistableSlice, type DataTableProps, type DataTableRowEditCommit, type DataTableRowReorder, type DataTableScrollOptions, type DataTableScrollSnapshot, type DataTableSearchProps, type DataTableSelectionBarProps, type DataTableStylesNames, type ExpandedState, type GroupingState, type Header, type HeaderGroup, type LedgerCellEditor, type LedgerEditingController, type LedgerFeatures, type LedgerInstantEditingController, type LedgerMeta, type LedgerRowEditingController, type LedgerRowEditor, type PaginationState, type Row, type RowData, type RowPinningState, type RowSelectionState, type SortingState, type TableInstance, type ToCsvOptions, type UseDataTableOptions, defaultLabels, flexRender };
|
|
1251
1289
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["RowData","RowData","TanStackColumnDef","TanStackColumn","TanStackRow","TanStackCell","TanStackHeader","TanStackHeaderGroup","SortingState","ColumnFiltersState","PaginationState","RowSelectionState","ExpandedState","ColumnVisibilityState","ColumnPinningState","ColumnOrderState","ColumnSizingState","GroupingState","RowPinningState","TanStackTableOptions","RowData","RowData","RowData","RowData","RowData","RowData","ReactKeyboardEvent","JSX","RowData"],"sources":["../src/icons.tsx","../src/element-props.ts","../src/ledger-features.ts","../src/scroll-snapshot.ts","../src/types.ts","../src/columns-panel.tsx","../src/csv.ts","../src/pagination-bar.tsx","../src/search.tsx","../src/selection-bar.tsx","../src/data-table.tsx","../src/editors.tsx","../src/use-data-table.ts"],"mappings":";;;;;;;;;;;UAoNiB;;;;;EAKf;EACA;;KAGU,yBAAyB,cAAc;;;;;;UAOlC;EAEf,SAAS;EACT,UAAU;;;;EAIV,UAAU;EACV,cAAc;EAGd,WAAW;;;;EAIX,YAAY;EAGZ,OAAO;EACP,WAAW;EACX,OAAO;EACP,OAAO;EAGP,QAAQ;EAGR,gBAAgB;EAGhB,cAAc;EACd,eAAe;;;;EAIf,eAAe;EACf,UAAU;EACV,OAAO;EACP,QAAQ;;qBAGG,cAAc;;;;;;;;KCtQf,iBAAiB;;;;;;;;;;KAWjB,sBAAsB,QAAQ,aACnC,SAAS,oBACR,SAAS,cAAc,SAAS;;;cCmI3B;;;;;;;;;;;;;;;;;;;;;;;;;IAzBJ,cAAO;IACN,eAAO;IACR,cAAO;IACR,aAAO;IACR,YAAO;IACN,aAAO;IACL,eAAO;IACV,YAAO;IACP,YAAO;IACJ,eAAO;IACF,oBAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmDV,wBAAwB;;;;;wBAMpB,mBAAmB,cAAcA,8CAAO;;;;;;;;;;;;;;;;;;;;;;;;;IAnE/C,cAAO;IACN,eAAO;IACR,cAAO;IACR,aAAO;IACR,YAAO;IACN,aAAO;IACL,eAAO;IACV,YAAO;IACP,YAAO;IACJ,eAAO;IACF,oBAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DrB;;;cCtLa;;;;;;;;UASG;YACL;;;;;;wBAqEI,0BAA0B,iBAAiB,SAAS;;;;;;;KC7CxD,cAAc,cAAcC,aAAW,WAAW,gBAAgB;KAMlE,UAAU,cAAcA,WAAS,eAAe,WAAW,YACnEC,YAAkB,gBAAgB,OAAO;EAAY;;KAC7C,OAAO,cAAcD,WAAS,eA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rB,mBAAmB;MACnB,qBAAqB;;;;EAThB,OAAA;EACF,KAAA;EACQ,aAAA;EACP,MAAA;EACK,YAAC,cAAcF,WAAS,OAAO,eAAe,WAAWE,MAAI;EACtD;IAChB,eAAe;IACf,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;;;;;;;;;;wBChUT,cAAc;;;;wBA6Bd,gBAAgB;;;;;;wBAShB,aAAa,SAAS,eAAe;;;;;wBAyDrC,kBAAkB;;;wBClElB,aAAa,cAAcC,WAAS,SAAS,oBAAoB,SAAS,cAAc"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { n as defaultLabels, t as DataTableLabels } from "./labels-Ck0Y2Ser.js";
|
|
|
3
3
|
import { BoxProps, ComboboxData, ElementProps, Factory, MantineBreakpoint, MantineColor, MantineRadius, MantineSize, MantineSpacing, PopoverProps, StylesApiProps, TableTdProps, TableThProps, TableTrProps, TextInputProps } from "@mantine/core";
|
|
4
4
|
import { CSSProperties, ComponentProps, ComponentType, JSX as JSX$1, KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref } from "react";
|
|
5
5
|
import { Cell as Cell$1, CellData, Column as Column$1, ColumnDef as ColumnDef$1, ColumnFiltersState, ColumnFiltersState as ColumnFiltersState$1, ColumnOrderState, ColumnOrderState as ColumnOrderState$1, ColumnPinningState, ColumnPinningState as ColumnPinningState$1, ColumnSizingState, ColumnSizingState as ColumnSizingState$1, ColumnVisibilityState, ColumnVisibilityState as ColumnVisibilityState$1, ExpandedState, ExpandedState as ExpandedState$1, FilterFn, FilterFnOption, GroupingState, GroupingState as GroupingState$1, Header as Header$1, HeaderGroup as HeaderGroup$1, PaginationState, PaginationState as PaginationState$1, ReactTable, Row as Row$1, RowData, RowData as RowData$1, RowPinningState, RowPinningState as RowPinningState$1, RowSelectionState, RowSelectionState as RowSelectionState$1, SortingState, SortingState as SortingState$1, TableFeatures, TableOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, flexRender } from "@tanstack/react-table";
|
|
6
|
+
import "@tanstack/react-virtual";
|
|
6
7
|
//#region src/icons.d.ts
|
|
7
8
|
/**
|
|
8
9
|
* What a replacement icon receives — the two knobs the chrome actually turns. Lucide icons are
|
|
@@ -222,6 +223,24 @@ export declare function createColumnHelper<TData extends RowData$1>(): import("@
|
|
|
222
223
|
};
|
|
223
224
|
}, TData>;
|
|
224
225
|
//#endregion
|
|
226
|
+
//#region src/scroll-snapshot.d.ts
|
|
227
|
+
declare const scrollSnapshotBrand: unique symbol;
|
|
228
|
+
/**
|
|
229
|
+
* Opaque, plain-data snapshot of a table's scroll position and measured virtualized row heights.
|
|
230
|
+
*
|
|
231
|
+
* Capture with `handle.getScrollSnapshot()`, hold across unmounts (in memory, history state, or
|
|
232
|
+
* storage), validate untrusted values with {@link isDataTableScrollSnapshot}, and pass back to
|
|
233
|
+
* `<DataTable initialScroll={snapshot} />` on remount.
|
|
234
|
+
*/
|
|
235
|
+
interface DataTableScrollSnapshot {
|
|
236
|
+
readonly [scrollSnapshotBrand]: "scroll-snapshot";
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Validates an unknown value — such as one read back from `sessionStorage` or router history
|
|
240
|
+
* state — as a {@link DataTableScrollSnapshot} written by this version of ledger.
|
|
241
|
+
*/
|
|
242
|
+
export declare function isDataTableScrollSnapshot(value: unknown): value is DataTableScrollSnapshot;
|
|
243
|
+
//#endregion
|
|
225
244
|
//#region src/types.d.ts
|
|
226
245
|
/**
|
|
227
246
|
* TanStack's table instance (the enriched React shape: `state`, `Subscribe`, `FlexRender`),
|
|
@@ -604,6 +623,17 @@ interface DataTableHandle<TData extends RowData$1> {
|
|
|
604
623
|
* window is not rendering is still reachable. Pinned columns are already in view; a no-op.
|
|
605
624
|
*/
|
|
606
625
|
scrollToColumn: (columnId: string, options?: DataTableScrollOptions) => void;
|
|
626
|
+
/**
|
|
627
|
+
* Captures an opaque, plain-data snapshot of the table's scroll offsets and measured virtualized
|
|
628
|
+
* row heights for restoration via `<DataTable initialScroll={snapshot} />`
|
|
629
|
+
* ([virtualization.md](../docs/virtualization.md#restoring-scroll-position)).
|
|
630
|
+
*
|
|
631
|
+
* Call while the table is still mounted — for example before navigating away, or in a parent
|
|
632
|
+
* component's `useLayoutEffect` cleanup (a passive `useEffect` cleanup runs after the table's
|
|
633
|
+
* DOM has already unmounted, where this returns `null`). On remount, `initialScroll` is applied
|
|
634
|
+
* once to the rows the table mounts with; rows that arrive later are not scrolled to.
|
|
635
|
+
*/
|
|
636
|
+
getScrollSnapshot: () => DataTableScrollSnapshot | null;
|
|
607
637
|
/**
|
|
608
638
|
* Cell mode requires `columnId`; row mode takes the id of any editable column to focus, or
|
|
609
639
|
* none.
|
|
@@ -1069,6 +1099,14 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
|
|
|
1069
1099
|
virtualizedColumns?: boolean | {
|
|
1070
1100
|
overscan?: number;
|
|
1071
1101
|
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Mount-only scroll snapshot from an earlier table's `handle.getScrollSnapshot()`
|
|
1104
|
+
* ([virtualization.md](../docs/virtualization.md#restoring-scroll-position)).
|
|
1105
|
+
*
|
|
1106
|
+
* Applied once to the rows the table mounts with (rows arriving later are not scrolled to),
|
|
1107
|
+
* best-effort and clamped when the dataset is shorter or the shape version does not match.
|
|
1108
|
+
*/
|
|
1109
|
+
initialScroll?: DataTableScrollSnapshot | null;
|
|
1072
1110
|
onEndReached?: () => void;
|
|
1073
1111
|
endReachedOffset?: number;
|
|
1074
1112
|
loadingMore?: boolean;
|
|
@@ -1136,7 +1174,7 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
|
|
|
1136
1174
|
*/
|
|
1137
1175
|
icons?: Partial<DataTableIcons>;
|
|
1138
1176
|
/**
|
|
1139
|
-
* Imperative handle: `{ table, viewport, scrollToRow, scrollToIndex, scrollToColumn, startEditing, stopEditing }`.
|
|
1177
|
+
* Imperative handle: `{ table, viewport, scrollToRow, scrollToIndex, scrollToColumn, getScrollSnapshot, startEditing, stopEditing }`.
|
|
1140
1178
|
*/
|
|
1141
1179
|
handleRef?: Ref<DataTableHandle<TData>>;
|
|
1142
1180
|
}
|
|
@@ -1247,5 +1285,5 @@ export declare function checkboxEditor(): DataTableInstantEditRenderer<any, any>
|
|
|
1247
1285
|
//#region src/use-data-table.d.ts
|
|
1248
1286
|
export declare function useDataTable<TData extends RowData$1>(options: UseDataTableOptions<TData>): TableInstance<TData>;
|
|
1249
1287
|
//#endregion
|
|
1250
|
-
export { type Cell, type Column, type ColumnDef, type ColumnFiltersState, type ColumnOrderState, type ColumnPinningState, type ColumnSizingState, type ColumnVisibilityState, type DataTableBaseProps, type DataTableColumnsPanelProps, type DataTableCssVariables, type DataTableEditCommit, type DataTableEditConfig, type DataTableEditContext, type DataTableEditMode, type DataTableEditRenderer, type DataTableEditTrigger, type DataTableEditingCell, type DataTableElementProps, type DataTableExportMeta, type DataTableFactory, type DataTableFilterConfig, type DataTableFilterVariant, type DataTableHandle, type DataTableIconComponent, type DataTableIconProps, type DataTableIcons, type DataTableInstantEditConfig, type DataTableInstantEditContext, type DataTableInstantEditRenderer, type DataTableLabels, type DataTablePaginationProps, type DataTablePersistState, type DataTablePersistableSlice, type DataTableProps, type DataTableRowEditCommit, type DataTableRowReorder, type DataTableScrollOptions, type DataTableSearchProps, type DataTableSelectionBarProps, type DataTableStylesNames, type ExpandedState, type GroupingState, type Header, type HeaderGroup, type LedgerCellEditor, type LedgerEditingController, type LedgerFeatures, type LedgerInstantEditingController, type LedgerMeta, type LedgerRowEditingController, type LedgerRowEditor, type PaginationState, type Row, type RowData, type RowPinningState, type RowSelectionState, type SortingState, type TableInstance, type ToCsvOptions, type UseDataTableOptions, defaultLabels, flexRender };
|
|
1288
|
+
export { type Cell, type Column, type ColumnDef, type ColumnFiltersState, type ColumnOrderState, type ColumnPinningState, type ColumnSizingState, type ColumnVisibilityState, type DataTableBaseProps, type DataTableColumnsPanelProps, type DataTableCssVariables, type DataTableEditCommit, type DataTableEditConfig, type DataTableEditContext, type DataTableEditMode, type DataTableEditRenderer, type DataTableEditTrigger, type DataTableEditingCell, type DataTableElementProps, type DataTableExportMeta, type DataTableFactory, type DataTableFilterConfig, type DataTableFilterVariant, type DataTableHandle, type DataTableIconComponent, type DataTableIconProps, type DataTableIcons, type DataTableInstantEditConfig, type DataTableInstantEditContext, type DataTableInstantEditRenderer, type DataTableLabels, type DataTablePaginationProps, type DataTablePersistState, type DataTablePersistableSlice, type DataTableProps, type DataTableRowEditCommit, type DataTableRowReorder, type DataTableScrollOptions, type DataTableScrollSnapshot, type DataTableSearchProps, type DataTableSelectionBarProps, type DataTableStylesNames, type ExpandedState, type GroupingState, type Header, type HeaderGroup, type LedgerCellEditor, type LedgerEditingController, type LedgerFeatures, type LedgerInstantEditingController, type LedgerMeta, type LedgerRowEditingController, type LedgerRowEditor, type PaginationState, type Row, type RowData, type RowPinningState, type RowSelectionState, type SortingState, type TableInstance, type ToCsvOptions, type UseDataTableOptions, defaultLabels, flexRender };
|
|
1251
1289
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["RowData","RowData","TanStackColumnDef","TanStackColumn","TanStackRow","TanStackCell","TanStackHeader","TanStackHeaderGroup","SortingState","ColumnFiltersState","PaginationState","RowSelectionState","ExpandedState","ColumnVisibilityState","ColumnPinningState","ColumnOrderState","ColumnSizingState","GroupingState","RowPinningState","TanStackTableOptions","RowData","RowData","RowData","RowData","RowData","RowData","ReactKeyboardEvent","JSX","RowData"],"sources":["../src/icons.tsx","../src/element-props.ts","../src/ledger-features.ts","../src/scroll-snapshot.ts","../src/types.ts","../src/columns-panel.tsx","../src/csv.ts","../src/pagination-bar.tsx","../src/search.tsx","../src/selection-bar.tsx","../src/data-table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eAAe,WAAWE,MAAI;EACtD;IAChB,eAAe;IACf,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;;;;;;;;;;wBChUT,cAAc;;;;wBA6Bd,gBAAgB;;;;;;wBAShB,aAAa,SAAS,eAAe;;;;;wBAyDrC,kBAAkB;;;wBClElB,aAAa,cAAcC,WAAS,SAAS,oBAAoB,SAAS,cAAc"}
|
package/dist/index.js
CHANGED
|
@@ -1749,6 +1749,125 @@ function DataTablePagination(props) {
|
|
|
1749
1749
|
});
|
|
1750
1750
|
}
|
|
1751
1751
|
//#endregion
|
|
1752
|
+
//#region src/scroll-snapshot.ts
|
|
1753
|
+
/**
|
|
1754
|
+
* Opaque scroll-restoration snapshots (`docs/virtualization.md#restoring-scroll-position`).
|
|
1755
|
+
*
|
|
1756
|
+
* A snapshot captures plain, JSON-serializable scroll geometry — the viewport's offsets, its last
|
|
1757
|
+
* known dimensions, and TanStack Virtual's measured row heights (`takeSnapshot()`) — tagged with a
|
|
1758
|
+
* shape version so storage/history payloads from another version of ledger fail validation instead
|
|
1759
|
+
* of restoring corrupt numbers.
|
|
1760
|
+
*/
|
|
1761
|
+
const SCROLL_SNAPSHOT_VERSION = 1;
|
|
1762
|
+
function isRecord$1(value) {
|
|
1763
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1764
|
+
}
|
|
1765
|
+
function isFiniteNumber$1(value) {
|
|
1766
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
1767
|
+
}
|
|
1768
|
+
function isNonNegativeFinite(value) {
|
|
1769
|
+
return isFiniteNumber$1(value) && value >= 0;
|
|
1770
|
+
}
|
|
1771
|
+
function isNonNegativeInteger(value) {
|
|
1772
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
1773
|
+
}
|
|
1774
|
+
function isViewportRect(value) {
|
|
1775
|
+
if (!isRecord$1(value)) return false;
|
|
1776
|
+
return isNonNegativeFinite(value.width) && isNonNegativeFinite(value.height);
|
|
1777
|
+
}
|
|
1778
|
+
function isSerializedVirtualItem(value) {
|
|
1779
|
+
if (!isRecord$1(value)) return false;
|
|
1780
|
+
const validKey = typeof value.key === "string" || isFiniteNumber$1(value.key);
|
|
1781
|
+
return isNonNegativeInteger(value.index) && validKey && isFiniteNumber$1(value.start) && isNonNegativeFinite(value.size) && isFiniteNumber$1(value.end) && isNonNegativeInteger(value.lane);
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Validates an unknown value — such as one read back from `sessionStorage` or router history
|
|
1785
|
+
* state — as a {@link DataTableScrollSnapshot} written by this version of ledger.
|
|
1786
|
+
*/
|
|
1787
|
+
function isDataTableScrollSnapshot(value) {
|
|
1788
|
+
if (!isRecord$1(value) || value.version !== SCROLL_SNAPSHOT_VERSION) return false;
|
|
1789
|
+
if (!isNonNegativeFinite(value.scrollTop) || !isFiniteNumber$1(value.scrollLeft)) return false;
|
|
1790
|
+
if (value.viewport !== null && !isViewportRect(value.viewport)) return false;
|
|
1791
|
+
return value.measurements === null || Array.isArray(value.measurements) && value.measurements.every(isSerializedVirtualItem);
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Validates and unwraps a snapshot at the component boundary. Invalid or mismatched-version
|
|
1795
|
+
* payloads degrade to `null` instead of throwing.
|
|
1796
|
+
*/
|
|
1797
|
+
function readScrollSnapshot(value) {
|
|
1798
|
+
if (!isDataTableScrollSnapshot(value)) return null;
|
|
1799
|
+
return value;
|
|
1800
|
+
}
|
|
1801
|
+
function readViewportRect(viewport, virtualizer) {
|
|
1802
|
+
const virtualRect = virtualizer?.scrollRect;
|
|
1803
|
+
if (virtualRect && virtualRect.width > 0 && virtualRect.height > 0) return {
|
|
1804
|
+
width: Math.round(virtualRect.width),
|
|
1805
|
+
height: Math.round(virtualRect.height)
|
|
1806
|
+
};
|
|
1807
|
+
const width = Math.round(viewport.offsetWidth);
|
|
1808
|
+
const height = Math.round(viewport.offsetHeight);
|
|
1809
|
+
if (width > 0 && height > 0) return {
|
|
1810
|
+
width,
|
|
1811
|
+
height
|
|
1812
|
+
};
|
|
1813
|
+
return null;
|
|
1814
|
+
}
|
|
1815
|
+
function serializeVirtualMeasurements(virtualizer) {
|
|
1816
|
+
const items = [];
|
|
1817
|
+
for (const item of virtualizer.takeSnapshot()) {
|
|
1818
|
+
if (typeof item.key !== "string" && !(typeof item.key === "number" && Number.isFinite(item.key))) continue;
|
|
1819
|
+
items.push({
|
|
1820
|
+
index: item.index,
|
|
1821
|
+
key: item.key,
|
|
1822
|
+
start: item.start,
|
|
1823
|
+
size: item.size,
|
|
1824
|
+
end: item.end,
|
|
1825
|
+
lane: item.lane
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
return items;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Captures the viewport's current scroll offsets, dimensions, and measured virtualizer row heights
|
|
1832
|
+
* as an opaque plain-data snapshot. Returns `null` while the viewport is not mounted.
|
|
1833
|
+
*/
|
|
1834
|
+
function captureScrollSnapshot(viewport, virtualizer) {
|
|
1835
|
+
if (!viewport) return null;
|
|
1836
|
+
const rawTop = Number.isFinite(viewport.scrollTop) ? viewport.scrollTop : 0;
|
|
1837
|
+
const scrollTop = Math.max(0, rawTop);
|
|
1838
|
+
const scrollLeft = Number.isFinite(viewport.scrollLeft) ? viewport.scrollLeft : 0;
|
|
1839
|
+
return {
|
|
1840
|
+
version: SCROLL_SNAPSHOT_VERSION,
|
|
1841
|
+
scrollTop,
|
|
1842
|
+
scrollLeft,
|
|
1843
|
+
viewport: readViewportRect(viewport, virtualizer),
|
|
1844
|
+
measurements: virtualizer === null ? null : serializeVirtualMeasurements(virtualizer)
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Resolves a validated snapshot into the mount-only options TanStack Virtual expects, clamped to
|
|
1849
|
+
* the rows the table mounts with so a snapshot taken on a longer table lands at the end instead of
|
|
1850
|
+
* past it. Returns `null` when there is no snapshot or no rows to restore into.
|
|
1851
|
+
*/
|
|
1852
|
+
function resolveInitialVirtualRestore(snapshot, rowKeys, estimateHeight) {
|
|
1853
|
+
if (snapshot === null || rowKeys.length === 0) return null;
|
|
1854
|
+
const measurements = [];
|
|
1855
|
+
const sizeByKey = /* @__PURE__ */ new Map();
|
|
1856
|
+
if (snapshot.measurements !== null) for (const item of snapshot.measurements) {
|
|
1857
|
+
sizeByKey.set(item.key, item.size);
|
|
1858
|
+
measurements.push({ ...item });
|
|
1859
|
+
}
|
|
1860
|
+
let totalHeight = 0;
|
|
1861
|
+
for (const key of rowKeys) totalHeight += sizeByKey.get(key) ?? estimateHeight;
|
|
1862
|
+
const viewportHeight = snapshot.viewport?.height ?? 0;
|
|
1863
|
+
const maxOffset = viewportHeight > 0 ? Math.max(0, totalHeight - viewportHeight) : totalHeight;
|
|
1864
|
+
return {
|
|
1865
|
+
offset: Math.min(snapshot.scrollTop, maxOffset),
|
|
1866
|
+
measurements,
|
|
1867
|
+
rect: snapshot.viewport ? { ...snapshot.viewport } : void 0
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
//#endregion
|
|
1752
1871
|
//#region src/search.tsx
|
|
1753
1872
|
/**
|
|
1754
1873
|
* `DataTable.Search` — the global-filter input, debounced. A standalone compound: takes the
|
|
@@ -2895,7 +3014,7 @@ function LoadMoreErrorRow({ colSpan, message, ariaRowIndex, onRetry }) {
|
|
|
2895
3014
|
})
|
|
2896
3015
|
});
|
|
2897
3016
|
}
|
|
2898
|
-
function TableBody({ table, virtualization, columnWindow, filler, viewportRef, loading, loadingMore, loadMoreError, onLoadMoreRetry, reorderSourceId, reorderTarget, skeletonRowCount, onVirtualizerChange }) {
|
|
3017
|
+
function TableBody({ table, virtualization, initialScroll, columnWindow, filler, viewportRef, loading, loadingMore, loadMoreError, onLoadMoreRetry, reorderSourceId, reorderTarget, skeletonRowCount, onVirtualizerChange }) {
|
|
2899
3018
|
const { getStyles, withColumnHeaders } = useDataTableContext();
|
|
2900
3019
|
const ledger = table.options.meta?.ledger;
|
|
2901
3020
|
const withDetailPanels = Boolean(ledger?.renderDetailPanel);
|
|
@@ -2923,18 +3042,24 @@ function TableBody({ table, virtualization, columnWindow, filler, viewportRef, l
|
|
|
2923
3042
|
const getItemKey = useCallback((index) => centerDisplayRows[index]?.key ?? index, [centerDisplayRows]);
|
|
2924
3043
|
const estimateHeight = virtualization?.estimateHeight ?? DEFAULT_ESTIMATED_ROW_HEIGHT;
|
|
2925
3044
|
const estimateSize = useCallback(() => estimateHeight, [estimateHeight]);
|
|
3045
|
+
const [initialRestore] = useState(() => virtualization === null ? null : resolveInitialVirtualRestore(initialScroll, centerDisplayRows.map((row) => row.key), estimateHeight));
|
|
2926
3046
|
const virtualizer = useVirtualizer({
|
|
2927
3047
|
count: centerDisplayRows.length,
|
|
2928
3048
|
enabled: virtualization !== null,
|
|
2929
3049
|
estimateSize,
|
|
2930
3050
|
getItemKey,
|
|
2931
3051
|
getScrollElement: () => viewportRef.current,
|
|
3052
|
+
...initialRestore !== null && {
|
|
3053
|
+
initialMeasurementsCache: initialRestore.measurements,
|
|
3054
|
+
initialOffset: initialRestore.offset,
|
|
3055
|
+
...initialRestore.rect !== void 0 && { initialRect: initialRestore.rect }
|
|
3056
|
+
},
|
|
2932
3057
|
measureElement: measureRow,
|
|
2933
3058
|
overscan: virtualization?.overscan ?? DEFAULT_OVERSCAN,
|
|
2934
3059
|
useFlushSync: false
|
|
2935
3060
|
});
|
|
2936
3061
|
const virtualEnabled = virtualization !== null;
|
|
2937
|
-
|
|
3062
|
+
useLayoutEffect(() => {
|
|
2938
3063
|
onVirtualizerChange(virtualEnabled ? virtualizer : null);
|
|
2939
3064
|
return () => onVirtualizerChange(null);
|
|
2940
3065
|
}, [
|
|
@@ -4493,7 +4618,7 @@ function normalizeColumnPinning(value) {
|
|
|
4493
4618
|
if (!isRecord(value) || !isStringArray(value.start) || !isStringArray(value.end)) return value;
|
|
4494
4619
|
const start = new Set(value.start);
|
|
4495
4620
|
return {
|
|
4496
|
-
end: [...new Set(value.end).
|
|
4621
|
+
end: [...new Set(value.end)].filter((id) => !start.has(id)),
|
|
4497
4622
|
start: [...start]
|
|
4498
4623
|
};
|
|
4499
4624
|
}
|
|
@@ -7169,7 +7294,7 @@ function DataTableFromOptions({ props }) {
|
|
|
7169
7294
|
});
|
|
7170
7295
|
}
|
|
7171
7296
|
function DataTableCore({ presentation, stylesProps, table }) {
|
|
7172
|
-
const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, size: sizeProp, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, columnMinSizeFromHeader, virtualizedRows, virtualizedColumns, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
|
|
7297
|
+
const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, size: sizeProp, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, columnMinSizeFromHeader, virtualizedRows, virtualizedColumns, initialScroll, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
|
|
7173
7298
|
const getStyles = useStyles({
|
|
7174
7299
|
name: "DataTable",
|
|
7175
7300
|
classes,
|
|
@@ -7242,6 +7367,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7242
7367
|
tableMinWidth,
|
|
7243
7368
|
viewport
|
|
7244
7369
|
});
|
|
7370
|
+
const [initialScrollData] = useState(() => readScrollSnapshot(initialScroll));
|
|
7245
7371
|
const virtualization = virtualizedRows ? {
|
|
7246
7372
|
estimateHeight: typeof virtualizedRows === "object" && virtualizedRows.estimateHeight !== void 0 ? virtualizedRows.estimateHeight : scale.rowHeight,
|
|
7247
7373
|
overscan: typeof virtualizedRows === "object" && virtualizedRows.overscan !== void 0 ? virtualizedRows.overscan : 8
|
|
@@ -7464,6 +7590,19 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7464
7590
|
if (!element) return;
|
|
7465
7591
|
for (const mirror of [headerViewportRef.current, footerViewportRef.current]) if (mirror && mirror.scrollLeft !== element.scrollLeft) mirror.scrollLeft = element.scrollLeft;
|
|
7466
7592
|
});
|
|
7593
|
+
const initialScrollApplied = useRef(false);
|
|
7594
|
+
useLayoutEffect(() => {
|
|
7595
|
+
if (initialScrollApplied.current || initialScrollData === null) return;
|
|
7596
|
+
const element = viewportRef.current;
|
|
7597
|
+
if (!element) return;
|
|
7598
|
+
initialScrollApplied.current = true;
|
|
7599
|
+
if (!virtualEnabled && initialScrollData.scrollTop > 0 && rowsLength > 0) element.scrollTop = initialScrollData.scrollTop;
|
|
7600
|
+
if (initialScrollData.scrollLeft !== 0) {
|
|
7601
|
+
element.scrollLeft = initialScrollData.scrollLeft;
|
|
7602
|
+
mirrorBodyScrollLeft();
|
|
7603
|
+
updateScrollEdges();
|
|
7604
|
+
}
|
|
7605
|
+
}, []);
|
|
7467
7606
|
useEffect(() => {
|
|
7468
7607
|
updateScrollEdges();
|
|
7469
7608
|
mirrorBodyScrollLeft();
|
|
@@ -7559,6 +7698,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7559
7698
|
left: rtl ? -target : target
|
|
7560
7699
|
});
|
|
7561
7700
|
});
|
|
7701
|
+
const getScrollSnapshot = useCallback(() => captureScrollSnapshot(viewportRef.current, virtualizerRef.current), []);
|
|
7562
7702
|
useImperativeHandle(handleRef, () => {
|
|
7563
7703
|
return {
|
|
7564
7704
|
table,
|
|
@@ -7568,6 +7708,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7568
7708
|
scrollToRow: scrollRowIntoView,
|
|
7569
7709
|
scrollToIndex: scrollIndexIntoView,
|
|
7570
7710
|
scrollToColumn: scrollColumnIntoView,
|
|
7711
|
+
getScrollSnapshot,
|
|
7571
7712
|
startEditing: (rowId, columnId) => {
|
|
7572
7713
|
const editing = table.options.meta?.ledger?.editing;
|
|
7573
7714
|
if (!editing) return;
|
|
@@ -7588,7 +7729,8 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7588
7729
|
table,
|
|
7589
7730
|
scrollRowIntoView,
|
|
7590
7731
|
scrollIndexIntoView,
|
|
7591
|
-
scrollColumnIntoView
|
|
7732
|
+
scrollColumnIntoView,
|
|
7733
|
+
getScrollSnapshot
|
|
7592
7734
|
]);
|
|
7593
7735
|
const activeRowAnnouncer = useRef(null);
|
|
7594
7736
|
const rowNavigationHintId = `${instanceId}-row-navigation`;
|
|
@@ -7857,6 +7999,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
|
|
|
7857
7999
|
children: [/* @__PURE__ */ jsx("colgroup", { children: colElements }), /* @__PURE__ */ jsx(TableBody, {
|
|
7858
8000
|
columnWindow,
|
|
7859
8001
|
filler,
|
|
8002
|
+
initialScroll: initialScrollData,
|
|
7860
8003
|
loading: loading === true,
|
|
7861
8004
|
loadingMore: loadingMore === true,
|
|
7862
8005
|
loadMoreError: loadMoreError ?? false,
|
|
@@ -8047,6 +8190,6 @@ function checkboxEditor() {
|
|
|
8047
8190
|
return renderCheckboxEditor;
|
|
8048
8191
|
}
|
|
8049
8192
|
//#endregion
|
|
8050
|
-
export { DataTable, DataTableColumnsPanel, DataTablePagination, DataTableSearch, DataTableSelectionBar, checkboxEditor, createColumnHelper, defaultIcons, defaultLabels, flexRender, numberEditor, selectEditor, textEditor, toCsv, useDataTable };
|
|
8193
|
+
export { DataTable, DataTableColumnsPanel, DataTablePagination, DataTableSearch, DataTableSelectionBar, checkboxEditor, createColumnHelper, defaultIcons, defaultLabels, flexRender, isDataTableScrollSnapshot, numberEditor, selectEditor, textEditor, toCsv, useDataTable };
|
|
8051
8194
|
|
|
8052
8195
|
//# sourceMappingURL=index.js.map
|