@zvndev/yable-react 0.3.0 → 0.5.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/dist/index.cjs +1322 -267
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +324 -16
- package/dist/index.d.ts +324 -16
- package/dist/index.js +1307 -269
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,43 @@
|
|
|
1
|
-
import { Table as Table$1,
|
|
1
|
+
import { RowData, ColumnDefBase, ColumnDefExtensions, Row, ColumnDef, Table as Table$1, Cell, Header, TableOptions, SortingState, ColumnFiltersState, PaginationState, TableState, Updater, Column, SortDirection, CellContext, ClipboardOptions, CellFlashInfo } from '@zvndev/yable-core';
|
|
2
2
|
export { AccessorFnColumnDef, AccessorKeyColumnDef, AggregationFn, Cell, CellStatus as CellCommitStatus, CellContext, CellFlashEvent, CellPatch, ClipboardOptions, Column, ColumnDef, ColumnDefBase, ColumnFiltersState, ColumnMeta, ColumnOrderState, ColumnPinningState, ColumnSizingInfoState, ColumnSizingState, CommitError, CommitErrorCells, CommitRecord, CommitResult, CommitsSlice, DisplayColumnDef, EditingState, ExpandedState, FillHandleState, FilterFn, FormulaEngine, FormulaError, FormulaFunction, FormulaState, GroupColumnDef, Header, HeaderContext, HeaderGroup, KeyboardNavigationAction, KeyboardNavigationCell, KeyboardNavigationDirection, KeyboardNavigationState, OnChangeFn, OnCommitFn, PaginationState, PartialLocale, PivotColumn, PivotConfig, PivotEngine, PivotFieldConfig, PivotRow, PivotState, PivotValueConfig, Row, RowData, RowDragEndEvent, RowDragEvent, RowDragState, RowEditCommitEvent, RowEditEvent, RowPinningState, RowReorderEvent, RowSelectionState, SortDirection, SortingFn, SortingState, Table as TableInstance, TableOptions, TableOptionsResolved, TableState, UndoAction, UndoRedoOptions, UndoRedoState, UndoStack, Updater, VisibilityState, YableLocale, aggregationFns, createColumnHelper, createLocale, createUndoRedoIntegration, en, filterFns, formulaFunctions, functionalUpdate, generatePivotColumnDefs, getDefaultLocale, getInitialPivotState, getPivotRowModel, resetLocale, setDefaultLocale, sortingFns } from '@zvndev/yable-core';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default, { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
4
|
+
import React__default, { CSSProperties, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, ReactNode } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { RowDragState } from '@zvndev/yable-core/features/rowDragging';
|
|
7
7
|
|
|
8
|
+
type YableTableVisualConfig = Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel' | 'clickableRows' | 'floatingFilters' | 'columnVirtualization' | 'columnVirtualizationOverscan' | 'statusBar' | 'sidebar' | 'sidebarPanels' | 'defaultSidebarPanel'>>;
|
|
9
|
+
type YableColumnConfig<TData extends RowData = any, TValue = unknown> = Partial<ColumnDefBase<TData, TValue>> & Partial<ColumnDefExtensions<TData, TValue>>;
|
|
10
|
+
interface YableRowConfig<TData extends RowData = any> {
|
|
11
|
+
className?: string | ((row: Row<TData>) => string | undefined);
|
|
12
|
+
style?: CSSProperties | ((row: Row<TData>) => CSSProperties);
|
|
13
|
+
}
|
|
14
|
+
type YableCellConfig<TData extends RowData = any, TValue = unknown> = Pick<YableColumnConfig<TData, TValue>, 'cell' | 'cellType' | 'cellTypeProps' | 'cellClassName' | 'cellStyle' | 'editable' | 'editConfig' | 'tooltip' | 'tooltipDelay'>;
|
|
15
|
+
interface YableColumnConfigSet<TData extends RowData = any> {
|
|
16
|
+
default?: YableColumnConfig<TData>;
|
|
17
|
+
byId?: Record<string, YableColumnConfig<TData>>;
|
|
18
|
+
}
|
|
19
|
+
interface YableCellConfigSet<TData extends RowData = any> {
|
|
20
|
+
default?: YableCellConfig<TData>;
|
|
21
|
+
named?: Record<string, YableCellConfig<TData>>;
|
|
22
|
+
byColumn?: Record<string, YableCellConfig<TData>>;
|
|
23
|
+
}
|
|
24
|
+
interface YableTableProfile<TData extends RowData = any> {
|
|
25
|
+
table?: YableTableVisualConfig;
|
|
26
|
+
columns?: YableColumnConfigSet<TData>;
|
|
27
|
+
rows?: YableRowConfig<TData>;
|
|
28
|
+
cells?: YableCellConfigSet<TData>;
|
|
29
|
+
}
|
|
30
|
+
interface YableConfig<TData extends RowData = any> extends YableTableProfile<TData> {
|
|
31
|
+
profiles?: Record<string, YableTableProfile<TData>>;
|
|
32
|
+
}
|
|
33
|
+
interface ResolvedYableProfile<TData extends RowData = any> extends YableTableProfile<TData> {
|
|
34
|
+
name: string;
|
|
35
|
+
}
|
|
36
|
+
declare function createYableConfig<TData extends RowData = any>(config: YableConfig<TData>): YableConfig<TData>;
|
|
37
|
+
declare function resolveYableProfile<TData extends RowData = any>(config?: YableConfig<TData>, profileName?: string): ResolvedYableProfile<TData>;
|
|
38
|
+
declare function getYableDefaultColumnDef<TData extends RowData>(profile?: YableTableProfile<TData>): YableColumnConfig<TData> | undefined;
|
|
39
|
+
declare function applyYableConfigToColumns<TData extends RowData>(columns: ColumnDef<TData, any>[], profile?: YableTableProfile<TData>): ColumnDef<TData, any>[];
|
|
40
|
+
|
|
8
41
|
interface TableProps<TData extends RowData> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
9
42
|
table: Table$1<TData>;
|
|
10
43
|
/** Enable sticky header */
|
|
@@ -17,6 +50,10 @@ interface TableProps<TData extends RowData> extends Omit<HTMLAttributes<HTMLDivE
|
|
|
17
50
|
compact?: boolean;
|
|
18
51
|
/** Theme variant */
|
|
19
52
|
theme?: string;
|
|
53
|
+
/** Named table profile from `YableProvider config` */
|
|
54
|
+
configProfile?: string;
|
|
55
|
+
/** Table-local config; overrides provider config for this component */
|
|
56
|
+
config?: YableConfig<TData>;
|
|
20
57
|
/** Whether rows are clickable (adds cursor + hover) */
|
|
21
58
|
clickableRows?: boolean;
|
|
22
59
|
/** Show footer */
|
|
@@ -83,6 +120,12 @@ interface TableHeaderCellProps<TData extends RowData, TValue = unknown> extends
|
|
|
83
120
|
header: Header<TData, TValue>;
|
|
84
121
|
}
|
|
85
122
|
|
|
123
|
+
type UseTableOptions<TData extends RowData> = TableOptions<TData> & {
|
|
124
|
+
/** Table-local config; overrides provider config for this table instance. */
|
|
125
|
+
config?: YableConfig<TData>;
|
|
126
|
+
/** Named profile from `YableProvider config`; overrides provider `tableProfile`. */
|
|
127
|
+
configProfile?: string;
|
|
128
|
+
};
|
|
86
129
|
/**
|
|
87
130
|
* React hook that wraps the framework-agnostic core table engine.
|
|
88
131
|
*
|
|
@@ -97,7 +140,124 @@ interface TableHeaderCellProps<TData extends RowData, TValue = unknown> extends
|
|
|
97
140
|
* function identity from the parent is always invoked — even if every other
|
|
98
141
|
* option key is shallow-equal to the previous render.
|
|
99
142
|
*/
|
|
100
|
-
declare function useTable<TData extends RowData>(options:
|
|
143
|
+
declare function useTable<TData extends RowData>(options: UseTableOptions<TData>): Table$1<TData>;
|
|
144
|
+
|
|
145
|
+
interface ServerTableFetchArgs {
|
|
146
|
+
sorting: SortingState;
|
|
147
|
+
columnFilters: ColumnFiltersState;
|
|
148
|
+
globalFilter: string;
|
|
149
|
+
pagination: PaginationState;
|
|
150
|
+
cursor: unknown;
|
|
151
|
+
signal: AbortSignal;
|
|
152
|
+
}
|
|
153
|
+
interface ServerTableFetchResult<TData extends RowData> {
|
|
154
|
+
rows: TData[];
|
|
155
|
+
cursor?: unknown;
|
|
156
|
+
hasMore?: boolean;
|
|
157
|
+
rowCount?: number;
|
|
158
|
+
pageCount?: number;
|
|
159
|
+
}
|
|
160
|
+
interface ServerTableUpdateArgs<TData extends RowData> {
|
|
161
|
+
rowId: string;
|
|
162
|
+
patch: Partial<TData>;
|
|
163
|
+
previousRow?: TData;
|
|
164
|
+
signal: AbortSignal;
|
|
165
|
+
}
|
|
166
|
+
interface UseServerTableOptions<TData extends RowData> extends Omit<UseTableOptions<TData>, 'data' | 'state' | 'manualSorting' | 'manualFiltering' | 'manualPagination' | 'onSortingChange' | 'onColumnFiltersChange' | 'onGlobalFilterChange' | 'onPaginationChange' | 'rowCount' | 'pageCount'> {
|
|
167
|
+
fetchData: (args: ServerTableFetchArgs) => Promise<ServerTableFetchResult<TData>>;
|
|
168
|
+
updateRow?: (args: ServerTableUpdateArgs<TData>) => Promise<TData | Partial<TData> | void>;
|
|
169
|
+
initialRows?: TData[];
|
|
170
|
+
initialCursor?: unknown;
|
|
171
|
+
initialHasMore?: boolean;
|
|
172
|
+
initialRowCount?: number;
|
|
173
|
+
initialPageCount?: number;
|
|
174
|
+
initialSorting?: SortingState;
|
|
175
|
+
initialColumnFilters?: ColumnFiltersState;
|
|
176
|
+
initialGlobalFilter?: string;
|
|
177
|
+
initialPagination?: PaginationState;
|
|
178
|
+
autoLoad?: boolean;
|
|
179
|
+
}
|
|
180
|
+
interface ServerTableController<TData extends RowData> {
|
|
181
|
+
table: Table$1<TData>;
|
|
182
|
+
rows: TData[];
|
|
183
|
+
loading: boolean;
|
|
184
|
+
error: unknown;
|
|
185
|
+
cursor: unknown;
|
|
186
|
+
hasMore: boolean;
|
|
187
|
+
rowCount?: number;
|
|
188
|
+
pageCount?: number;
|
|
189
|
+
sorting: SortingState;
|
|
190
|
+
columnFilters: ColumnFiltersState;
|
|
191
|
+
globalFilter: string;
|
|
192
|
+
pagination: PaginationState;
|
|
193
|
+
refresh: () => Promise<void>;
|
|
194
|
+
loadMore: () => Promise<void>;
|
|
195
|
+
updateRow: (rowId: string, patch: Partial<TData>) => Promise<void>;
|
|
196
|
+
}
|
|
197
|
+
declare function useServerTable<TData extends RowData>({ fetchData, updateRow, initialRows, initialCursor, initialHasMore, initialRowCount, initialPageCount, initialSorting, initialColumnFilters, initialGlobalFilter, initialPagination, autoLoad, getRowId, ...tableOptions }: UseServerTableOptions<TData>): ServerTableController<TData>;
|
|
198
|
+
|
|
199
|
+
interface UseTablePersistenceOptions {
|
|
200
|
+
/** Storage key used for getItem/setItem. */
|
|
201
|
+
key: string;
|
|
202
|
+
/** Which TableState slices to persist. Defaults to column layout keys. */
|
|
203
|
+
persistedKeys?: (keyof TableState)[];
|
|
204
|
+
/** Milliseconds to debounce storage writes. Default: 100. */
|
|
205
|
+
debounce?: number;
|
|
206
|
+
/** Schema version — bumping this discards any stale stored data. */
|
|
207
|
+
version?: number;
|
|
208
|
+
/** Custom Storage implementation. Default: localStorage. */
|
|
209
|
+
storage?: Storage;
|
|
210
|
+
}
|
|
211
|
+
interface UseTablePersistenceReturn {
|
|
212
|
+
/**
|
|
213
|
+
* Partial state hydrated from storage — pass to `useTable({ initialState })`.
|
|
214
|
+
* Only useful when NOT passing `onStateChange` (i.e., uncontrolled mode).
|
|
215
|
+
*/
|
|
216
|
+
initialState: Partial<TableState>;
|
|
217
|
+
/**
|
|
218
|
+
* State-change handler that persists relevant slices on each update.
|
|
219
|
+
* When passed to `useTable({ onStateChange })`, the persistence hook
|
|
220
|
+
* takes over state management (controlled mode). You MUST also pass
|
|
221
|
+
* `state` to useTable in this case.
|
|
222
|
+
*/
|
|
223
|
+
onStateChange: (updater: Updater<TableState>) => void;
|
|
224
|
+
/**
|
|
225
|
+
* Current table state managed by the persistence hook.
|
|
226
|
+
* Pass to `useTable({ state })` alongside `onStateChange`.
|
|
227
|
+
*/
|
|
228
|
+
state: Partial<TableState>;
|
|
229
|
+
/** Manually clear all persisted state for this key. */
|
|
230
|
+
clearPersistedState: () => void;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* React hook that persists selected table state slices to storage.
|
|
234
|
+
*
|
|
235
|
+
* Returns `initialState` (hydrated from storage), `state`, and
|
|
236
|
+
* `onStateChange` — pass all three to `useTable` so that persisted
|
|
237
|
+
* slices survive page reloads.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```tsx
|
|
241
|
+
* const persistence = useTablePersistence({ key: 'my-table', version: 1 })
|
|
242
|
+
*
|
|
243
|
+
* // Controlled mode (recommended) — persistence manages state:
|
|
244
|
+
* const table = useTable({
|
|
245
|
+
* data,
|
|
246
|
+
* columns,
|
|
247
|
+
* initialState: persistence.initialState,
|
|
248
|
+
* state: persistence.state,
|
|
249
|
+
* onStateChange: persistence.onStateChange,
|
|
250
|
+
* })
|
|
251
|
+
*
|
|
252
|
+
* // Uncontrolled mode — only hydrate, no live persistence:
|
|
253
|
+
* const table = useTable({
|
|
254
|
+
* data,
|
|
255
|
+
* columns,
|
|
256
|
+
* initialState: persistence.initialState,
|
|
257
|
+
* })
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
declare function useTablePersistence(options: UseTablePersistenceOptions): UseTablePersistenceReturn;
|
|
101
261
|
|
|
102
262
|
interface VirtualRow {
|
|
103
263
|
index: number;
|
|
@@ -114,6 +274,12 @@ interface UseVirtualizationOptions {
|
|
|
114
274
|
pretextHeights?: Float64Array | null;
|
|
115
275
|
/** Pre-computed prefix sums for O(log n) scroll lookups */
|
|
116
276
|
pretextPrefixSums?: Float64Array | null;
|
|
277
|
+
/**
|
|
278
|
+
* Opaque key that changes when column widths change.
|
|
279
|
+
* When this value changes the height cache is invalidated because column
|
|
280
|
+
* resizing can affect text wrapping and therefore row heights.
|
|
281
|
+
*/
|
|
282
|
+
columnSizingHash?: string | number;
|
|
117
283
|
}
|
|
118
284
|
interface UseVirtualizationResult {
|
|
119
285
|
virtualRows: VirtualRow[];
|
|
@@ -121,19 +287,26 @@ interface UseVirtualizationResult {
|
|
|
121
287
|
startIndex: number;
|
|
122
288
|
endIndex: number;
|
|
123
289
|
scrollTo: (index: number) => void;
|
|
290
|
+
/**
|
|
291
|
+
* Manually clear the row-height cache and force recalculation.
|
|
292
|
+
* Call this when cell content changes (data mutations, font-size changes, etc.)
|
|
293
|
+
* that may affect row heights.
|
|
294
|
+
*/
|
|
295
|
+
invalidateRowHeights: () => void;
|
|
124
296
|
}
|
|
125
297
|
/**
|
|
126
298
|
* Computes which rows are visible in a scrollable container and returns
|
|
127
299
|
* positioning data so only those rows (plus an overscan buffer) are rendered.
|
|
128
300
|
*
|
|
129
|
-
* Returns `{ virtualRows, totalHeight, startIndex, endIndex, scrollTo }`.
|
|
301
|
+
* Returns `{ virtualRows, totalHeight, startIndex, endIndex, scrollTo, invalidateRowHeights }`.
|
|
130
302
|
* Re-renders are triggered by scroll (rAF-throttled) and ResizeObserver
|
|
131
303
|
* container resize. Supports fixed, variable, and Pretext-pre-measured heights.
|
|
132
304
|
*
|
|
133
|
-
*
|
|
134
|
-
* `
|
|
305
|
+
* The height cache is automatically invalidated when `totalRows`, `isFixedHeight`,
|
|
306
|
+
* or `columnSizingHash` changes. For manual invalidation (e.g. after data mutations
|
|
307
|
+
* or font-size changes), call `invalidateRowHeights()`.
|
|
135
308
|
*/
|
|
136
|
-
declare function useVirtualization({ containerRef, totalRows, rowHeight, overscan, estimateRowHeight: _estimateRowHeight, pretextHeights, pretextPrefixSums, }: UseVirtualizationOptions): UseVirtualizationResult;
|
|
309
|
+
declare function useVirtualization({ containerRef, totalRows, rowHeight, overscan, estimateRowHeight: _estimateRowHeight, pretextHeights, pretextPrefixSums, columnSizingHash, }: UseVirtualizationOptions): UseVirtualizationResult;
|
|
137
310
|
|
|
138
311
|
interface VirtualColumn<TData extends RowData> {
|
|
139
312
|
column: Column<TData, unknown>;
|
|
@@ -146,6 +319,7 @@ interface UseColumnVirtualizationOptions<TData extends RowData> {
|
|
|
146
319
|
columns: Column<TData, unknown>[];
|
|
147
320
|
overscan?: number;
|
|
148
321
|
enabled?: boolean;
|
|
322
|
+
sizingKey?: string;
|
|
149
323
|
}
|
|
150
324
|
interface UseColumnVirtualizationResult<TData extends RowData> {
|
|
151
325
|
virtualColumns: VirtualColumn<TData>[];
|
|
@@ -158,7 +332,7 @@ interface UseColumnVirtualizationResult<TData extends RowData> {
|
|
|
158
332
|
isVirtualized: boolean;
|
|
159
333
|
scrollToIndex: (index: number) => void;
|
|
160
334
|
}
|
|
161
|
-
declare function useColumnVirtualization<TData extends RowData>({ containerRef, columns, overscan, enabled, }: UseColumnVirtualizationOptions<TData>): UseColumnVirtualizationResult<TData>;
|
|
335
|
+
declare function useColumnVirtualization<TData extends RowData>({ containerRef, columns, overscan, enabled, sizingKey, }: UseColumnVirtualizationOptions<TData>): UseColumnVirtualizationResult<TData>;
|
|
162
336
|
|
|
163
337
|
interface CellMeasurement {
|
|
164
338
|
/** Column ID */
|
|
@@ -393,7 +567,59 @@ declare function getRegisteredCellTypes(): readonly string[];
|
|
|
393
567
|
declare const TableProvider: React$1.Provider<Table$1<any> | null>;
|
|
394
568
|
declare function useTableContext<TData extends RowData>(): Table$1<TData>;
|
|
395
569
|
|
|
396
|
-
|
|
570
|
+
/**
|
|
571
|
+
* Project-wide default table and column options.
|
|
572
|
+
*
|
|
573
|
+
* Wrap your app (or a subtree) in `<YableProvider>` so every `<Table>` and
|
|
574
|
+
* `useTable` call inherits these defaults without repeating config.
|
|
575
|
+
*
|
|
576
|
+
* Component-level and hook-level values always take precedence over provider
|
|
577
|
+
* defaults.
|
|
578
|
+
*/
|
|
579
|
+
interface YableDefaults {
|
|
580
|
+
/** Layered project config with default and named table/cell profiles */
|
|
581
|
+
config?: YableConfig;
|
|
582
|
+
/** Named config profile used by descendants unless overridden */
|
|
583
|
+
tableProfile?: string;
|
|
584
|
+
/** Default props applied to every `<Table>` in the subtree */
|
|
585
|
+
tableProps?: Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel'>>;
|
|
586
|
+
/** Default column definition merged under every table's own `defaultColumnDef` */
|
|
587
|
+
defaultColumnDef?: Partial<ColumnDefBase<any, unknown>> & Partial<ColumnDefExtensions<any, unknown>>;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Read the nearest `YableProvider` defaults.
|
|
591
|
+
*
|
|
592
|
+
* Safe to call outside a provider — returns an empty object.
|
|
593
|
+
*/
|
|
594
|
+
declare function useYableDefaults(): YableDefaults;
|
|
595
|
+
/**
|
|
596
|
+
* Provide project-wide defaults for all Yable tables in a subtree.
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```tsx
|
|
600
|
+
* <YableProvider
|
|
601
|
+
* striped
|
|
602
|
+
* stickyHeader
|
|
603
|
+
* theme="stripe"
|
|
604
|
+
* defaultColumnDef={{ enableSorting: true }}
|
|
605
|
+
* >
|
|
606
|
+
* <EmployeeTable />
|
|
607
|
+
* <ProjectTable />
|
|
608
|
+
* </YableProvider>
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
declare function YableProvider({ children, config, tableProfile, defaultColumnDef, striped, stickyHeader, bordered, compact, theme, direction, ariaLabel, }: YableDefaults & {
|
|
612
|
+
children: ReactNode;
|
|
613
|
+
striped?: boolean;
|
|
614
|
+
stickyHeader?: boolean;
|
|
615
|
+
bordered?: boolean;
|
|
616
|
+
compact?: boolean;
|
|
617
|
+
theme?: string;
|
|
618
|
+
direction?: 'ltr' | 'rtl';
|
|
619
|
+
ariaLabel?: string;
|
|
620
|
+
}): react_jsx_runtime.JSX.Element;
|
|
621
|
+
|
|
622
|
+
declare function Table<TData extends RowData>({ table, stickyHeader: stickyHeaderProp, striped: stripedProp, bordered: borderedProp, compact: compactProp, theme: themeProp, config, configProfile, clickableRows, footer, loading, loadingComponent, loadingText, emptyMessage, emptyComponent, emptyIcon, emptyDetail, renderEmpty, renderLoading, children, className, direction: directionProp, statusBar, statusBarPanels, sidebar, sidebarPanels, defaultSidebarPanel, floatingFilters, columnVirtualization, columnVirtualizationOverscan, ariaLabel: ariaLabelProp, ...rest }: TableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
397
623
|
|
|
398
624
|
interface TableHeaderProps<TData extends RowData> {
|
|
399
625
|
table: Table$1<TData>;
|
|
@@ -404,8 +630,9 @@ declare function TableHeader<TData extends RowData>({ table, floatingFilters, }:
|
|
|
404
630
|
interface TableBodyProps<TData extends RowData> {
|
|
405
631
|
table: Table$1<TData>;
|
|
406
632
|
clickableRows?: boolean;
|
|
633
|
+
colgroup?: React__default.ReactNode;
|
|
407
634
|
}
|
|
408
|
-
declare function TableBody<TData extends RowData>({ table, clickableRows }: TableBodyProps<TData>): react_jsx_runtime.JSX.Element;
|
|
635
|
+
declare function TableBody<TData extends RowData>({ table, clickableRows, colgroup, }: TableBodyProps<TData>): react_jsx_runtime.JSX.Element;
|
|
409
636
|
|
|
410
637
|
interface TableCellProps<TData extends RowData> {
|
|
411
638
|
cell: Cell<TData, unknown>;
|
|
@@ -946,16 +1173,19 @@ interface ContextMenuProps<TData extends RowData> {
|
|
|
946
1173
|
y: number;
|
|
947
1174
|
onClose: () => void;
|
|
948
1175
|
table: Table$1<TData>;
|
|
1176
|
+
/** Column the menu was opened on (right-clicked header/cell). */
|
|
1177
|
+
targetColumnId?: string;
|
|
949
1178
|
customItems?: ContextMenuItemDef[];
|
|
950
1179
|
}
|
|
951
|
-
declare function ContextMenu<TData extends RowData>({ x, y, onClose, table, customItems, }: ContextMenuProps<TData>): react_jsx_runtime.JSX.Element;
|
|
1180
|
+
declare function ContextMenu<TData extends RowData>({ x, y, onClose, table, targetColumnId, customItems, }: ContextMenuProps<TData>): react_jsx_runtime.JSX.Element;
|
|
952
1181
|
|
|
953
1182
|
declare function useContextMenu(): {
|
|
954
1183
|
isOpen: boolean;
|
|
955
1184
|
x: number;
|
|
956
1185
|
y: number;
|
|
957
1186
|
targetTable: Table$1<any> | null;
|
|
958
|
-
|
|
1187
|
+
targetColumnId: string | undefined;
|
|
1188
|
+
open: <TData extends RowData>(clientX: number, clientY: number, table: Table$1<TData>, columnId?: string) => void;
|
|
959
1189
|
close: () => void;
|
|
960
1190
|
};
|
|
961
1191
|
|
|
@@ -972,7 +1202,7 @@ declare function Sidebar<TData extends RowData>({ table, open, onClose, panels,
|
|
|
972
1202
|
interface ColumnsPanelProps<TData extends RowData> {
|
|
973
1203
|
table: Table$1<TData>;
|
|
974
1204
|
}
|
|
975
|
-
declare function ColumnsPanel<TData extends RowData>({ table
|
|
1205
|
+
declare function ColumnsPanel<TData extends RowData>({ table }: ColumnsPanelProps<TData>): react_jsx_runtime.JSX.Element;
|
|
976
1206
|
|
|
977
1207
|
interface FiltersPanelProps<TData extends RowData> {
|
|
978
1208
|
table: Table$1<TData>;
|
|
@@ -1015,11 +1245,89 @@ interface UseThemeOptions {
|
|
|
1015
1245
|
declare function useTheme(options?: UseThemeOptions): {
|
|
1016
1246
|
theme: string;
|
|
1017
1247
|
setTheme: (newTheme: string) => void;
|
|
1018
|
-
colorScheme: "auto" | "
|
|
1248
|
+
colorScheme: "auto" | "dark" | "light";
|
|
1019
1249
|
setColorScheme: (scheme: "light" | "dark" | "auto") => void;
|
|
1020
1250
|
toggleColorScheme: () => void;
|
|
1021
|
-
resolvedColorScheme: "
|
|
1251
|
+
resolvedColorScheme: "dark" | "light";
|
|
1022
1252
|
containerRef: React$1.RefObject<HTMLElement | null>;
|
|
1023
1253
|
};
|
|
1024
1254
|
|
|
1025
|
-
|
|
1255
|
+
interface SelectColumnOptions {
|
|
1256
|
+
id?: string;
|
|
1257
|
+
size?: number;
|
|
1258
|
+
headerAriaLabel?: string;
|
|
1259
|
+
}
|
|
1260
|
+
declare function selectColumn<TData extends RowData>(options?: SelectColumnOptions): ColumnDef<TData, unknown>;
|
|
1261
|
+
|
|
1262
|
+
interface RowNumberColumnOptions {
|
|
1263
|
+
id?: string;
|
|
1264
|
+
header?: string;
|
|
1265
|
+
size?: number;
|
|
1266
|
+
startFrom?: number;
|
|
1267
|
+
}
|
|
1268
|
+
declare function rowNumberColumn<TData extends RowData>(options?: RowNumberColumnOptions): ColumnDef<TData, unknown>;
|
|
1269
|
+
|
|
1270
|
+
interface ActionItem<TData extends RowData> {
|
|
1271
|
+
label: string;
|
|
1272
|
+
icon?: ReactNode;
|
|
1273
|
+
onClick: (row: Row<TData>) => void;
|
|
1274
|
+
hidden?: (row: Row<TData>) => boolean;
|
|
1275
|
+
disabled?: (row: Row<TData>) => boolean;
|
|
1276
|
+
}
|
|
1277
|
+
interface ActionsColumnOptions<TData extends RowData> {
|
|
1278
|
+
id?: string;
|
|
1279
|
+
header?: string;
|
|
1280
|
+
size?: number;
|
|
1281
|
+
actions: ActionItem<TData>[] | ((row: Row<TData>) => ActionItem<TData>[]);
|
|
1282
|
+
}
|
|
1283
|
+
declare function actionsColumn<TData extends RowData>(options: ActionsColumnOptions<TData>): ColumnDef<TData, unknown>;
|
|
1284
|
+
|
|
1285
|
+
interface ExpandColumnOptions {
|
|
1286
|
+
id?: string;
|
|
1287
|
+
size?: number;
|
|
1288
|
+
}
|
|
1289
|
+
declare function expandColumn<TData extends RowData>(options?: ExpandColumnOptions): ColumnDef<TData, unknown>;
|
|
1290
|
+
|
|
1291
|
+
interface CellStackProps {
|
|
1292
|
+
children: React__default.ReactNode;
|
|
1293
|
+
gap?: number;
|
|
1294
|
+
}
|
|
1295
|
+
declare function CellStack({ children, gap }: CellStackProps): react_jsx_runtime.JSX.Element;
|
|
1296
|
+
|
|
1297
|
+
interface CellRowProps {
|
|
1298
|
+
children: React__default.ReactNode;
|
|
1299
|
+
gap?: number;
|
|
1300
|
+
align?: 'start' | 'center' | 'end' | 'baseline';
|
|
1301
|
+
justify?: 'start' | 'center' | 'end' | 'between';
|
|
1302
|
+
}
|
|
1303
|
+
declare function CellRow({ children, gap, align, justify }: CellRowProps): react_jsx_runtime.JSX.Element;
|
|
1304
|
+
|
|
1305
|
+
interface CellWithIconProps {
|
|
1306
|
+
icon: React__default.ReactNode;
|
|
1307
|
+
children: React__default.ReactNode;
|
|
1308
|
+
gap?: number;
|
|
1309
|
+
iconSize?: number;
|
|
1310
|
+
}
|
|
1311
|
+
declare function CellWithIcon({ icon, children, gap, iconSize }: CellWithIconProps): react_jsx_runtime.JSX.Element;
|
|
1312
|
+
|
|
1313
|
+
interface CellTextProps {
|
|
1314
|
+
children: React__default.ReactNode;
|
|
1315
|
+
variant?: 'primary' | 'secondary' | 'muted';
|
|
1316
|
+
bold?: boolean;
|
|
1317
|
+
truncate?: boolean;
|
|
1318
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1319
|
+
}
|
|
1320
|
+
declare function CellText({ children, variant, bold, truncate, size, }: CellTextProps): react_jsx_runtime.JSX.Element;
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Merges edit-commit changes into a data array, returning a new array
|
|
1324
|
+
* with matching rows shallow-merged. Rows without changes keep their
|
|
1325
|
+
* original reference so downstream memoisation works.
|
|
1326
|
+
*
|
|
1327
|
+
* @param data Current data array
|
|
1328
|
+
* @param changes Map of row ID -> partial row values (same shape as `onEditCommit`)
|
|
1329
|
+
* @param getRowId Optional row-ID resolver; defaults to string index
|
|
1330
|
+
*/
|
|
1331
|
+
declare function mergeEditChanges<TData>(data: TData[], changes: Record<string, Partial<TData>>, getRowId?: (row: TData, index: number) => string): TData[];
|
|
1332
|
+
|
|
1333
|
+
export { type ActionItem, type ActionsColumnOptions, type AutoMeasurementsOptions, CellBadge, type CellBadgeProps, CellBoolean, type CellBooleanProps, CellCheckbox, CellCurrency, type CellCurrencyProps, CellDate, CellDatePicker, type CellDateProps, CellErrorBoundary, CellInput, CellLink, type CellLinkProps, type CellMeasureRecipe, type CellMeasurement, CellNumeric, type CellNumericProps, CellProgress, type CellProgressProps, CellRating, type CellRatingProps, CellRow, type CellRowProps, CellSelect, CellStack, type CellStackProps, CellStatus, CellStatusBadge, type CellStatusBadgeProps, type CellStatusProps, CellText, type CellTextProps, CellToggle, CellWithIcon, type CellWithIconProps, ColumnsPanel, ContextMenu, ContextMenuItem, type ContextMenuItemDef, DEFAULT_TEXT_RECIPE, DragHandle, ErrorBoundary, type ExpandColumnOptions, ExpandIcon, FillHandle, type FillHandleDragState, type FillHandleProps, FiltersPanel, FlashCell, FloatingFilter, GlobalFilter, LoadingOverlay, type LoadingOverlayProps, MasterDetail, NoRowsOverlay, type NoRowsOverlayProps, Pagination, PivotConfigPanel, type PivotConfigProps, type PivotFieldItem, type PivotValueItem, PrintLayout, type ResolvedYableProfile, type RowNumberColumnOptions, type SelectColumnOptions, type ServerTableController, type ServerTableFetchArgs, type ServerTableFetchResult, type ServerTableUpdateArgs, SetFilter, Sidebar, SortIndicator, StatusBar, StatusBarPanelComponent, type StatusBarPanelComponentProps, type StatusBarPanelConfig, type StatusBarPanelProps, Table, TableBody, TableCell, type TableCellProps$1 as TableCellProps, TableFooter, TableHeader, type TableHeaderCellProps, type TableProps, TableProvider, type TableRowProps, Tooltip, type TooltipPosition, type TooltipProps, TreeToggle, type UseCellFlashOptions, type UseClipboardOptions, type UseColumnVirtualizationOptions, type UseColumnVirtualizationResult, type UseFillHandleOptions, type UseFillHandleReturn, type UseKeyboardNavigationOptions, type UsePretextMeasurementOptions, type UsePretextMeasurementResult, type UsePrintLayoutOptions, type UseRowAnimationOptions, type UseRowDragOptions, type UseRowDragReturn, type UseServerTableOptions, type UseTableOptions, type UseTablePersistenceOptions, type UseTablePersistenceReturn, type UseTableRowHeightsOptions, type UseThemeOptions, type UseTooltipOptions, type UseVirtualizationOptions, type UseVirtualizationResult, type VirtualColumn, type VirtualRow, type YableCellConfig, type YableCellConfigSet, type YableColumnConfig, type YableColumnConfigSet, type YableConfig, type YableDefaults, YableProvider, type YableRowConfig, type YableTableProfile, type YableTableVisualConfig, actionsColumn, applyYableConfigToColumns, createYableConfig, expandColumn, getMeasureRecipeForCellType, getRegisteredCellTypes, getYableDefaultColumnDef, mergeEditChanges, resolveMeasureRecipe, resolveYableProfile, rowNumberColumn, selectColumn, useAutoMeasurements, useCellFlash, useClipboard, useColumnVirtualization, useContextMenu, useFillHandle, useKeyboardNavigation, usePretextMeasurement, usePrintLayout, useRowAnimation, useRowDrag, useServerTable, useTable, useTableContext, useTablePersistence, useTableRowHeights, useTheme, useTooltip, useVirtualization, useYableDefaults };
|