@bsol-oss/react-datatable5 12.0.0-beta.80 → 12.0.0-beta.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +365 -353
- package/dist/index.js +1009 -831
- package/dist/index.mjs +1012 -834
- package/dist/types/components/DataTable/display/Table.d.ts +2 -1
- package/dist/types/components/DataTable/hooks/useResponsiveColumnVisibility.d.ts +13 -0
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +4 -0
- package/dist/types/index.d.ts +64 -57
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Row,
|
|
2
|
+
import { Row, Table as Table$1, RowData, OnChangeFn, Updater, SortingState, ColumnFiltersState, PaginationState, RowSelectionState, ColumnOrderState, VisibilityState, FilterFn, ColumnDef, Column } from '@tanstack/react-table';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import react__default, { ReactNode, Dispatch, SetStateAction } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import {
|
|
6
|
+
import { TableHeaderProps as TableHeaderProps$1, TableRowProps, GridProps, TableRootProps, BoxProps, FlexProps, CardBodyProps, TextProps, ImageProps } from '@chakra-ui/react';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import * as react_i18next from 'react-i18next';
|
|
9
9
|
import { UseTranslationResponse } from 'react-i18next';
|
|
10
|
-
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
11
10
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
11
|
+
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
12
12
|
import { JSONSchema7 } from 'json-schema';
|
|
13
13
|
import { ForeignKeyProps as ForeignKeyProps$1 } from '@/components/Form/components/fields/StringInputField';
|
|
14
14
|
import { AxiosRequestConfig } from 'axios';
|
|
@@ -16,6 +16,57 @@ import * as react_hook_form from 'react-hook-form';
|
|
|
16
16
|
import { UseFormReturn, FieldValues, SubmitHandler } from 'react-hook-form';
|
|
17
17
|
import { RenderProps, Props } from '@bsol-oss/dayzed-react19';
|
|
18
18
|
|
|
19
|
+
interface TableHeaderTexts {
|
|
20
|
+
pinColumn?: string;
|
|
21
|
+
cancelPin?: string;
|
|
22
|
+
sortAscending?: string;
|
|
23
|
+
sortDescending?: string;
|
|
24
|
+
clearSorting?: string;
|
|
25
|
+
}
|
|
26
|
+
interface TableHeaderProps {
|
|
27
|
+
canResize?: boolean;
|
|
28
|
+
showSelector?: boolean;
|
|
29
|
+
isSticky?: boolean;
|
|
30
|
+
tableHeaderProps?: TableHeaderProps$1;
|
|
31
|
+
tableRowProps?: TableRowProps;
|
|
32
|
+
/**
|
|
33
|
+
* Default text configuration for all columns.
|
|
34
|
+
* Can be overridden per column via meta.headerTexts.
|
|
35
|
+
*/
|
|
36
|
+
defaultTexts?: TableHeaderTexts;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* TableHeader component with configurable text strings.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Using default texts
|
|
43
|
+
* <TableHeader />
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Customizing default texts for all columns
|
|
47
|
+
* <TableHeader
|
|
48
|
+
* defaultTexts={{
|
|
49
|
+
* pinColumn: "Pin This Column",
|
|
50
|
+
* sortAscending: "Sort A-Z"
|
|
51
|
+
* }}
|
|
52
|
+
* />
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Customizing texts per column via meta
|
|
56
|
+
* const columns = [
|
|
57
|
+
* columnHelper.accessor("name", {
|
|
58
|
+
* header: "Name",
|
|
59
|
+
* meta: {
|
|
60
|
+
* headerTexts: {
|
|
61
|
+
* pinColumn: "Pin Name Column",
|
|
62
|
+
* sortAscending: "Sort Names A-Z"
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* })
|
|
66
|
+
* ];
|
|
67
|
+
*/
|
|
68
|
+
declare const TableHeader: ({ canResize, showSelector, isSticky, tableHeaderProps, tableRowProps, defaultTexts, }: TableHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
69
|
+
|
|
19
70
|
interface DensityToggleButtonProps {
|
|
20
71
|
icon?: react__default.ReactElement;
|
|
21
72
|
text?: string;
|
|
@@ -54,6 +105,124 @@ interface EditViewButtonProps {
|
|
|
54
105
|
}
|
|
55
106
|
declare const ViewDialog: ({ icon }: EditViewButtonProps) => react_jsx_runtime.JSX.Element;
|
|
56
107
|
|
|
108
|
+
interface ReloadButtonProps {
|
|
109
|
+
variant?: string;
|
|
110
|
+
}
|
|
111
|
+
declare const ReloadButton: ({ variant, }: ReloadButtonProps) => react_jsx_runtime.JSX.Element;
|
|
112
|
+
|
|
113
|
+
declare const GlobalFilter: () => react_jsx_runtime.JSX.Element;
|
|
114
|
+
|
|
115
|
+
declare const TableSelector: () => react_jsx_runtime.JSX.Element;
|
|
116
|
+
|
|
117
|
+
declare const TableSorter: () => react_jsx_runtime.JSX.Element;
|
|
118
|
+
|
|
119
|
+
declare const TableViewer: () => react_jsx_runtime.JSX.Element;
|
|
120
|
+
|
|
121
|
+
interface TableControlsProps {
|
|
122
|
+
totalText?: string;
|
|
123
|
+
fitTableWidth?: boolean;
|
|
124
|
+
fitTableHeight?: boolean;
|
|
125
|
+
children?: ReactNode;
|
|
126
|
+
showGlobalFilter?: boolean;
|
|
127
|
+
showFilter?: boolean;
|
|
128
|
+
showFilterName?: boolean;
|
|
129
|
+
showFilterTags?: boolean;
|
|
130
|
+
showReload?: boolean;
|
|
131
|
+
showPagination?: boolean;
|
|
132
|
+
showPageSizeControl?: boolean;
|
|
133
|
+
showPageCountText?: boolean;
|
|
134
|
+
showView?: boolean;
|
|
135
|
+
filterTagsOptions?: {
|
|
136
|
+
column: string;
|
|
137
|
+
options: {
|
|
138
|
+
label: string;
|
|
139
|
+
value: string;
|
|
140
|
+
}[];
|
|
141
|
+
}[];
|
|
142
|
+
extraItems?: ReactNode;
|
|
143
|
+
loading?: boolean;
|
|
144
|
+
hasError?: boolean;
|
|
145
|
+
gridProps?: GridProps;
|
|
146
|
+
}
|
|
147
|
+
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: TableControlsProps) => react_jsx_runtime.JSX.Element;
|
|
148
|
+
|
|
149
|
+
declare const TableFilter: () => react_jsx_runtime.JSX.Element;
|
|
150
|
+
|
|
151
|
+
declare const TableFilterTags: () => react_jsx_runtime.JSX.Element;
|
|
152
|
+
|
|
153
|
+
interface TableProps extends TableRootProps {
|
|
154
|
+
showLoading?: boolean;
|
|
155
|
+
loadingComponent?: ReactNode;
|
|
156
|
+
emptyComponent?: ReactNode;
|
|
157
|
+
canResize?: boolean;
|
|
158
|
+
showSelector?: boolean;
|
|
159
|
+
children: ReactNode;
|
|
160
|
+
}
|
|
161
|
+
declare const Table: ({ children, emptyComponent, canResize, showLoading, showSelector, ...props }: TableProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
|
|
162
|
+
|
|
163
|
+
interface TableBodyProps {
|
|
164
|
+
pinnedBgColor?: {
|
|
165
|
+
light: string;
|
|
166
|
+
dark: string;
|
|
167
|
+
};
|
|
168
|
+
showSelector?: boolean;
|
|
169
|
+
alwaysShowSelector?: boolean;
|
|
170
|
+
canResize?: boolean;
|
|
171
|
+
}
|
|
172
|
+
interface TableRowSelectorProps<TData> {
|
|
173
|
+
index: number;
|
|
174
|
+
row: Row<TData>;
|
|
175
|
+
hoveredRow: number;
|
|
176
|
+
pinnedBgColor?: {
|
|
177
|
+
light: string;
|
|
178
|
+
dark: string;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
declare const TableBody: ({ showSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
182
|
+
|
|
183
|
+
interface TableCardContainerProps extends BoxProps {
|
|
184
|
+
children: ReactNode;
|
|
185
|
+
variant?: "carousel" | "";
|
|
186
|
+
gap?: string;
|
|
187
|
+
gridTemplateColumns?: string;
|
|
188
|
+
direction?: FlexProps["direction"];
|
|
189
|
+
}
|
|
190
|
+
declare const TableCardContainer: ({ children, variant, gap, gridTemplateColumns, direction, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
interface TableCardsProps<TData> {
|
|
193
|
+
isSelectable?: boolean;
|
|
194
|
+
showDisplayNameOnly?: boolean;
|
|
195
|
+
renderTitle?: (row: Row<TData>) => ReactNode | undefined;
|
|
196
|
+
cardBodyProps?: CardBodyProps;
|
|
197
|
+
}
|
|
198
|
+
declare const DefaultCardTitle: () => react_jsx_runtime.JSX.Element;
|
|
199
|
+
declare const TableCards: <TData>({ isSelectable, showDisplayNameOnly, renderTitle, cardBodyProps, }: TableCardsProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
200
|
+
|
|
201
|
+
interface TableRendererProps<TData> {
|
|
202
|
+
render: (render: Table$1<TData>) => react__default.ReactElement;
|
|
203
|
+
}
|
|
204
|
+
declare const TableComponent: <TData>({ render, }: TableRendererProps<TData>) => react__default.ReactElement<unknown, string | react__default.JSXElementConstructor<any>>;
|
|
205
|
+
|
|
206
|
+
interface TableFooterProps {
|
|
207
|
+
showSelector?: boolean;
|
|
208
|
+
alwaysShowSelector?: boolean;
|
|
209
|
+
}
|
|
210
|
+
declare const TableFooter: ({ showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
211
|
+
|
|
212
|
+
interface TableLoadingComponentProps {
|
|
213
|
+
render: (loading: boolean) => ReactNode;
|
|
214
|
+
}
|
|
215
|
+
declare const TableLoadingComponent: ({ render, }: TableLoadingComponentProps) => react_jsx_runtime.JSX.Element;
|
|
216
|
+
|
|
217
|
+
interface TextCellProps {
|
|
218
|
+
label?: string;
|
|
219
|
+
noOfLines?: number[];
|
|
220
|
+
children: string | number | ReactNode | ReactNode[];
|
|
221
|
+
containerProps?: FlexProps;
|
|
222
|
+
textProps?: TextProps;
|
|
223
|
+
}
|
|
224
|
+
declare const TextCell: ({ label, containerProps, textProps, children, }: TextCellProps) => react_jsx_runtime.JSX.Element;
|
|
225
|
+
|
|
57
226
|
interface CardHeaderProps<TData> {
|
|
58
227
|
row: Row<TData>;
|
|
59
228
|
imageColumnId?: keyof TData;
|
|
@@ -98,103 +267,6 @@ declare module "@tanstack/react-table" {
|
|
|
98
267
|
}
|
|
99
268
|
}
|
|
100
269
|
|
|
101
|
-
declare module '@tanstack/react-table' {
|
|
102
|
-
interface FilterFns {
|
|
103
|
-
fuzzy: FilterFn<unknown>;
|
|
104
|
-
}
|
|
105
|
-
interface FilterMeta {
|
|
106
|
-
itemRank: RankingInfo;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
interface DataTableProps<TData = unknown> {
|
|
110
|
-
children?: ReactNode | ReactNode[];
|
|
111
|
-
/**
|
|
112
|
-
* Data array for the table.
|
|
113
|
-
*
|
|
114
|
-
* It will pass into as the data in `@tanstack/react-table`
|
|
115
|
-
* Do not toggle the data array, it will cause the table to re-render in infinite loop.
|
|
116
|
-
*
|
|
117
|
-
* @default []
|
|
118
|
-
*
|
|
119
|
-
*/
|
|
120
|
-
data: TData[];
|
|
121
|
-
/**
|
|
122
|
-
* Column definitions for the table.
|
|
123
|
-
*
|
|
124
|
-
* It will pass into as the column definitions in `@tanstack/react-table`
|
|
125
|
-
*
|
|
126
|
-
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
127
|
-
*/
|
|
128
|
-
columns: ColumnDef<TData, unknown>[];
|
|
129
|
-
enableRowSelection?: boolean;
|
|
130
|
-
enableMultiRowSelection?: boolean;
|
|
131
|
-
enableSubRowSelection?: boolean;
|
|
132
|
-
onRowSelect?: (rowSelectionState: RowSelectionState, data: TData[]) => void;
|
|
133
|
-
columnOrder: ColumnOrderState;
|
|
134
|
-
columnFilters: ColumnFiltersState;
|
|
135
|
-
globalFilter: string;
|
|
136
|
-
density: DensityState;
|
|
137
|
-
pagination: PaginationState;
|
|
138
|
-
sorting: SortingState;
|
|
139
|
-
rowSelection: RowSelectionState;
|
|
140
|
-
columnVisibility: VisibilityState;
|
|
141
|
-
setPagination: OnChangeFn<PaginationState>;
|
|
142
|
-
setSorting: OnChangeFn<SortingState>;
|
|
143
|
-
setColumnFilters: OnChangeFn<ColumnFiltersState>;
|
|
144
|
-
setRowSelection: OnChangeFn<RowSelectionState>;
|
|
145
|
-
setGlobalFilter: OnChangeFn<string>;
|
|
146
|
-
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
147
|
-
setDensity: OnChangeFn<DensityState>;
|
|
148
|
-
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
149
|
-
translate: UseTranslationResponse<any, any>;
|
|
150
|
-
tableLabel?: DataTableLabel;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* DataTable will create a context to hold all values to
|
|
154
|
-
* help the render of the DataTable in serverside
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* The query is required to be a GET request that can receive
|
|
158
|
-
* specified params and return a specified response
|
|
159
|
-
*
|
|
160
|
-
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
161
|
-
*/
|
|
162
|
-
declare function DataTable<TData = unknown>({ columns, data, enableRowSelection, enableMultiRowSelection, enableSubRowSelection, columnOrder, columnFilters, columnVisibility, density, globalFilter, pagination, sorting, rowSelection, setPagination, setSorting, setColumnFilters, setRowSelection, setGlobalFilter, setColumnOrder, setDensity, setColumnVisibility, translate, children, tableLabel, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
163
|
-
|
|
164
|
-
interface DataTableLabel {
|
|
165
|
-
view: string;
|
|
166
|
-
edit: string;
|
|
167
|
-
filterButtonText: string;
|
|
168
|
-
filterTitle: string;
|
|
169
|
-
filterReset: string;
|
|
170
|
-
filterClose: string;
|
|
171
|
-
reloadTooltip: string;
|
|
172
|
-
reloadButtonText: string;
|
|
173
|
-
resetSelection: string;
|
|
174
|
-
resetSorting: string;
|
|
175
|
-
rowCountText: string;
|
|
176
|
-
hasErrorText: string;
|
|
177
|
-
globalFilterPlaceholder: string;
|
|
178
|
-
trueLabel: string;
|
|
179
|
-
falseLabel: string;
|
|
180
|
-
}
|
|
181
|
-
interface DataTableContextProps<TData = unknown> extends DataTableProps {
|
|
182
|
-
table: Table$1<TData>;
|
|
183
|
-
globalFilter: string;
|
|
184
|
-
setGlobalFilter: OnChangeFn<string>;
|
|
185
|
-
type: "client" | "server";
|
|
186
|
-
translate: UseTranslationResponse<any, unknown>;
|
|
187
|
-
tableLabel: DataTableLabel;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
declare const useDataTableContext: <TData>() => DataTableContextProps<TData>;
|
|
191
|
-
|
|
192
|
-
interface DataDisplayProps {
|
|
193
|
-
variant?: "horizontal" | "stats" | "";
|
|
194
|
-
translate?: UseTranslationResponse<any, any>;
|
|
195
|
-
}
|
|
196
|
-
declare const DataDisplay: ({ variant }: DataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
197
|
-
|
|
198
270
|
interface DataTableDefaultState {
|
|
199
271
|
sorting?: SortingState;
|
|
200
272
|
columnFilters?: ColumnFiltersState;
|
|
@@ -298,262 +370,105 @@ interface Result<T = unknown> {
|
|
|
298
370
|
interface DataResponse<T = unknown> extends Result<T> {
|
|
299
371
|
count: number;
|
|
300
372
|
}
|
|
301
|
-
interface QueryParams {
|
|
302
|
-
offset: number;
|
|
303
|
-
limit: number;
|
|
304
|
-
sorting: SortingState;
|
|
305
|
-
where: ColumnFiltersState;
|
|
306
|
-
searching: string;
|
|
307
|
-
}
|
|
308
|
-
declare const useDataTableServer: <TData>(props: UseDataTableServerProps<TData>) => UseDataTableServerReturn<TData>;
|
|
309
|
-
|
|
310
|
-
interface DataTableServerProps<TData = unknown> {
|
|
311
|
-
children: ReactNode | ReactNode[];
|
|
312
|
-
/**
|
|
313
|
-
* Column definitions for the table.
|
|
314
|
-
*
|
|
315
|
-
* It will pass into as the column definitions in `@tanstack/react-table`
|
|
316
|
-
*
|
|
317
|
-
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
318
|
-
*/
|
|
319
|
-
columns: ColumnDef<TData>[];
|
|
320
|
-
enableRowSelection?: boolean;
|
|
321
|
-
enableMultiRowSelection?: boolean;
|
|
322
|
-
enableSubRowSelection?: boolean;
|
|
323
|
-
columnOrder: ColumnOrderState;
|
|
324
|
-
columnFilters: ColumnFiltersState;
|
|
325
|
-
globalFilter: string;
|
|
326
|
-
density: DensityState;
|
|
327
|
-
pagination: PaginationState;
|
|
328
|
-
sorting: SortingState;
|
|
329
|
-
rowSelection: RowSelectionState;
|
|
330
|
-
columnVisibility: VisibilityState;
|
|
331
|
-
setPagination: OnChangeFn<PaginationState>;
|
|
332
|
-
setSorting: OnChangeFn<SortingState>;
|
|
333
|
-
setColumnFilters: OnChangeFn<ColumnFiltersState>;
|
|
334
|
-
setRowSelection: OnChangeFn<RowSelectionState>;
|
|
335
|
-
setGlobalFilter: OnChangeFn<string>;
|
|
336
|
-
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
337
|
-
setDensity: OnChangeFn<DensityState>;
|
|
338
|
-
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
339
|
-
query: UseQueryResult<DataResponse<TData>>;
|
|
340
|
-
url?: string;
|
|
341
|
-
translate: UseTranslationResponse<any, any>;
|
|
342
|
-
tableLabel?: DataTableLabel;
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* DataTableServer will create a context to hold all values to
|
|
346
|
-
* help the render of the DataTable in serverside
|
|
347
|
-
*
|
|
348
|
-
* The query is required to be a GET request that can receive
|
|
349
|
-
* specified params and return a specified response
|
|
350
|
-
*
|
|
351
|
-
* The `useDataTableServer` can help to create the specified request and response
|
|
352
|
-
*
|
|
353
|
-
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
354
|
-
*/
|
|
355
|
-
declare function DataTableServer<TData = unknown>({ columns, enableRowSelection, enableMultiRowSelection, enableSubRowSelection, columnOrder, columnFilters, columnVisibility, density, globalFilter, pagination, sorting, rowSelection, setPagination, setSorting, setColumnFilters, setRowSelection, setGlobalFilter, setColumnOrder, setDensity, setColumnVisibility, query, url, translate, children, tableLabel, }: DataTableServerProps<TData>): react_jsx_runtime.JSX.Element;
|
|
356
|
-
|
|
357
|
-
interface TableControlsProps {
|
|
358
|
-
totalText?: string;
|
|
359
|
-
fitTableWidth?: boolean;
|
|
360
|
-
fitTableHeight?: boolean;
|
|
361
|
-
children?: ReactNode;
|
|
362
|
-
showGlobalFilter?: boolean;
|
|
363
|
-
showFilter?: boolean;
|
|
364
|
-
showFilterName?: boolean;
|
|
365
|
-
showFilterTags?: boolean;
|
|
366
|
-
showReload?: boolean;
|
|
367
|
-
showPagination?: boolean;
|
|
368
|
-
showPageSizeControl?: boolean;
|
|
369
|
-
showPageCountText?: boolean;
|
|
370
|
-
showView?: boolean;
|
|
371
|
-
filterTagsOptions?: {
|
|
372
|
-
column: string;
|
|
373
|
-
options: {
|
|
374
|
-
label: string;
|
|
375
|
-
value: string;
|
|
376
|
-
}[];
|
|
377
|
-
}[];
|
|
378
|
-
extraItems?: ReactNode;
|
|
379
|
-
loading?: boolean;
|
|
380
|
-
hasError?: boolean;
|
|
381
|
-
gridProps?: GridProps;
|
|
382
|
-
}
|
|
383
|
-
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: TableControlsProps) => react_jsx_runtime.JSX.Element;
|
|
384
|
-
|
|
385
|
-
interface TableProps extends TableRootProps {
|
|
386
|
-
showLoading?: boolean;
|
|
387
|
-
loadingComponent?: ReactNode;
|
|
388
|
-
emptyComponent?: ReactNode;
|
|
389
|
-
canResize?: boolean;
|
|
390
|
-
children: ReactNode;
|
|
391
|
-
}
|
|
392
|
-
declare const Table: ({ children, emptyComponent, canResize, showLoading, ...props }: TableProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
|
|
393
|
-
|
|
394
|
-
interface TableBodyProps {
|
|
395
|
-
pinnedBgColor?: {
|
|
396
|
-
light: string;
|
|
397
|
-
dark: string;
|
|
398
|
-
};
|
|
399
|
-
showSelector?: boolean;
|
|
400
|
-
alwaysShowSelector?: boolean;
|
|
401
|
-
canResize?: boolean;
|
|
402
|
-
}
|
|
403
|
-
interface TableRowSelectorProps<TData> {
|
|
404
|
-
index: number;
|
|
405
|
-
row: Row<TData>;
|
|
406
|
-
hoveredRow: number;
|
|
407
|
-
pinnedBgColor?: {
|
|
408
|
-
light: string;
|
|
409
|
-
dark: string;
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
declare const TableBody: ({ showSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
413
|
-
|
|
414
|
-
interface TableFooterProps {
|
|
415
|
-
showSelector?: boolean;
|
|
416
|
-
alwaysShowSelector?: boolean;
|
|
417
|
-
}
|
|
418
|
-
declare const TableFooter: ({ showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
419
|
-
|
|
420
|
-
interface TableHeaderTexts {
|
|
421
|
-
pinColumn?: string;
|
|
422
|
-
cancelPin?: string;
|
|
423
|
-
sortAscending?: string;
|
|
424
|
-
sortDescending?: string;
|
|
425
|
-
clearSorting?: string;
|
|
426
|
-
}
|
|
427
|
-
interface TableHeaderProps {
|
|
428
|
-
canResize?: boolean;
|
|
429
|
-
showSelector?: boolean;
|
|
430
|
-
isSticky?: boolean;
|
|
431
|
-
tableHeaderProps?: TableHeaderProps$1;
|
|
432
|
-
tableRowProps?: TableRowProps;
|
|
433
|
-
/**
|
|
434
|
-
* Default text configuration for all columns.
|
|
435
|
-
* Can be overridden per column via meta.headerTexts.
|
|
436
|
-
*/
|
|
437
|
-
defaultTexts?: TableHeaderTexts;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* TableHeader component with configurable text strings.
|
|
441
|
-
*
|
|
442
|
-
* @example
|
|
443
|
-
* // Using default texts
|
|
444
|
-
* <TableHeader />
|
|
445
|
-
*
|
|
446
|
-
* @example
|
|
447
|
-
* // Customizing default texts for all columns
|
|
448
|
-
* <TableHeader
|
|
449
|
-
* defaultTexts={{
|
|
450
|
-
* pinColumn: "Pin This Column",
|
|
451
|
-
* sortAscending: "Sort A-Z"
|
|
452
|
-
* }}
|
|
453
|
-
* />
|
|
454
|
-
*
|
|
455
|
-
* @example
|
|
456
|
-
* // Customizing texts per column via meta
|
|
457
|
-
* const columns = [
|
|
458
|
-
* columnHelper.accessor("name", {
|
|
459
|
-
* header: "Name",
|
|
460
|
-
* meta: {
|
|
461
|
-
* headerTexts: {
|
|
462
|
-
* pinColumn: "Pin Name Column",
|
|
463
|
-
* sortAscending: "Sort Names A-Z"
|
|
464
|
-
* }
|
|
465
|
-
* }
|
|
466
|
-
* })
|
|
467
|
-
* ];
|
|
468
|
-
*/
|
|
469
|
-
declare const TableHeader: ({ canResize, showSelector, isSticky, tableHeaderProps, tableRowProps, defaultTexts, }: TableHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
470
|
-
|
|
471
|
-
interface DefaultTableProps {
|
|
472
|
-
showFooter?: boolean;
|
|
473
|
-
tableProps?: Omit<TableProps, 'children'>;
|
|
474
|
-
tableHeaderProps?: TableHeaderProps;
|
|
475
|
-
tableBodyProps?: TableBodyProps;
|
|
476
|
-
tableFooterProps?: TableFooterProps;
|
|
477
|
-
controlProps?: TableControlsProps;
|
|
478
|
-
variant?: '' | 'greedy';
|
|
479
|
-
isLoading?: boolean;
|
|
373
|
+
interface QueryParams {
|
|
374
|
+
offset: number;
|
|
375
|
+
limit: number;
|
|
376
|
+
sorting: SortingState;
|
|
377
|
+
where: ColumnFiltersState;
|
|
378
|
+
searching: string;
|
|
480
379
|
}
|
|
481
|
-
declare const
|
|
380
|
+
declare const useDataTableServer: <TData>(props: UseDataTableServerProps<TData>) => UseDataTableServerReturn<TData>;
|
|
482
381
|
|
|
483
|
-
|
|
382
|
+
declare module '@tanstack/react-table' {
|
|
383
|
+
interface FilterFns {
|
|
384
|
+
fuzzy: FilterFn<unknown>;
|
|
385
|
+
}
|
|
386
|
+
interface FilterMeta {
|
|
387
|
+
itemRank: RankingInfo;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
interface DataTableProps<TData = unknown> {
|
|
391
|
+
children?: ReactNode | ReactNode[];
|
|
484
392
|
/**
|
|
485
|
-
*
|
|
486
|
-
*
|
|
393
|
+
* Data array for the table.
|
|
394
|
+
*
|
|
395
|
+
* It will pass into as the data in `@tanstack/react-table`
|
|
396
|
+
* Do not toggle the data array, it will cause the table to re-render in infinite loop.
|
|
397
|
+
*
|
|
398
|
+
* @default []
|
|
399
|
+
*
|
|
487
400
|
*/
|
|
488
|
-
|
|
401
|
+
data: TData[];
|
|
402
|
+
/**
|
|
403
|
+
* Column definitions for the table.
|
|
404
|
+
*
|
|
405
|
+
* It will pass into as the column definitions in `@tanstack/react-table`
|
|
406
|
+
*
|
|
407
|
+
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
408
|
+
*/
|
|
409
|
+
columns: ColumnDef<TData, unknown>[];
|
|
410
|
+
enableRowSelection?: boolean;
|
|
411
|
+
enableMultiRowSelection?: boolean;
|
|
412
|
+
enableSubRowSelection?: boolean;
|
|
413
|
+
onRowSelect?: (rowSelectionState: RowSelectionState, data: TData[]) => void;
|
|
414
|
+
columnOrder: ColumnOrderState;
|
|
415
|
+
columnFilters: ColumnFiltersState;
|
|
416
|
+
globalFilter: string;
|
|
417
|
+
density: DensityState;
|
|
418
|
+
pagination: PaginationState;
|
|
419
|
+
sorting: SortingState;
|
|
420
|
+
rowSelection: RowSelectionState;
|
|
421
|
+
columnVisibility: VisibilityState;
|
|
422
|
+
setPagination: OnChangeFn<PaginationState>;
|
|
423
|
+
setSorting: OnChangeFn<SortingState>;
|
|
424
|
+
setColumnFilters: OnChangeFn<ColumnFiltersState>;
|
|
425
|
+
setRowSelection: OnChangeFn<RowSelectionState>;
|
|
426
|
+
setGlobalFilter: OnChangeFn<string>;
|
|
427
|
+
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
428
|
+
setDensity: OnChangeFn<DensityState>;
|
|
429
|
+
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
430
|
+
translate: UseTranslationResponse<any, any>;
|
|
431
|
+
tableLabel?: DataTableLabel;
|
|
489
432
|
}
|
|
490
433
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
434
|
+
* DataTable will create a context to hold all values to
|
|
435
|
+
* help the render of the DataTable in serverside
|
|
493
436
|
*
|
|
494
|
-
* Use this component when working with DataTableServer to automatically
|
|
495
|
-
* show skeleton loading state during data fetching.
|
|
496
437
|
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* </DataTableServer>
|
|
502
|
-
* ```
|
|
438
|
+
* The query is required to be a GET request that can receive
|
|
439
|
+
* specified params and return a specified response
|
|
440
|
+
*
|
|
441
|
+
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
503
442
|
*/
|
|
504
|
-
declare
|
|
505
|
-
|
|
506
|
-
interface ReloadButtonProps {
|
|
507
|
-
variant?: string;
|
|
508
|
-
}
|
|
509
|
-
declare const ReloadButton: ({ variant, }: ReloadButtonProps) => react_jsx_runtime.JSX.Element;
|
|
510
|
-
|
|
511
|
-
interface TableCardContainerProps extends BoxProps {
|
|
512
|
-
children: ReactNode;
|
|
513
|
-
variant?: "carousel" | "";
|
|
514
|
-
gap?: string;
|
|
515
|
-
gridTemplateColumns?: string;
|
|
516
|
-
direction?: FlexProps["direction"];
|
|
517
|
-
}
|
|
518
|
-
declare const TableCardContainer: ({ children, variant, gap, gridTemplateColumns, direction, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
519
|
-
|
|
520
|
-
interface TableCardsProps<TData> {
|
|
521
|
-
isSelectable?: boolean;
|
|
522
|
-
showDisplayNameOnly?: boolean;
|
|
523
|
-
renderTitle?: (row: Row<TData>) => ReactNode | undefined;
|
|
524
|
-
cardBodyProps?: CardBodyProps;
|
|
525
|
-
}
|
|
526
|
-
declare const DefaultCardTitle: () => react_jsx_runtime.JSX.Element;
|
|
527
|
-
declare const TableCards: <TData>({ isSelectable, showDisplayNameOnly, renderTitle, cardBodyProps, }: TableCardsProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
443
|
+
declare function DataTable<TData = unknown>({ columns, data, enableRowSelection, enableMultiRowSelection, enableSubRowSelection, columnOrder, columnFilters, columnVisibility, density, globalFilter, pagination, sorting, rowSelection, setPagination, setSorting, setColumnFilters, setRowSelection, setGlobalFilter, setColumnOrder, setDensity, setColumnVisibility, translate, children, tableLabel, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
528
444
|
|
|
529
|
-
interface
|
|
530
|
-
|
|
445
|
+
interface DataTableLabel {
|
|
446
|
+
view: string;
|
|
447
|
+
edit: string;
|
|
448
|
+
filterButtonText: string;
|
|
449
|
+
filterTitle: string;
|
|
450
|
+
filterReset: string;
|
|
451
|
+
filterClose: string;
|
|
452
|
+
reloadTooltip: string;
|
|
453
|
+
reloadButtonText: string;
|
|
454
|
+
resetSelection: string;
|
|
455
|
+
resetSorting: string;
|
|
456
|
+
rowCountText: string;
|
|
457
|
+
hasErrorText: string;
|
|
458
|
+
globalFilterPlaceholder: string;
|
|
459
|
+
trueLabel: string;
|
|
460
|
+
falseLabel: string;
|
|
531
461
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
render: (loading: boolean) => ReactNode;
|
|
462
|
+
interface DataTableContextProps<TData = unknown> extends DataTableProps {
|
|
463
|
+
table: Table$1<TData>;
|
|
464
|
+
globalFilter: string;
|
|
465
|
+
setGlobalFilter: OnChangeFn<string>;
|
|
466
|
+
type: "client" | "server";
|
|
467
|
+
translate: UseTranslationResponse<any, unknown>;
|
|
468
|
+
tableLabel: DataTableLabel;
|
|
540
469
|
}
|
|
541
|
-
declare const TableLoadingComponent: ({ render, }: TableLoadingComponentProps) => react_jsx_runtime.JSX.Element;
|
|
542
|
-
|
|
543
|
-
declare const TableSelector: () => react_jsx_runtime.JSX.Element;
|
|
544
|
-
|
|
545
|
-
declare const TableSorter: () => react_jsx_runtime.JSX.Element;
|
|
546
|
-
|
|
547
|
-
declare const TableViewer: () => react_jsx_runtime.JSX.Element;
|
|
548
470
|
|
|
549
|
-
|
|
550
|
-
label?: string;
|
|
551
|
-
noOfLines?: number[];
|
|
552
|
-
children: string | number | ReactNode | ReactNode[];
|
|
553
|
-
containerProps?: FlexProps;
|
|
554
|
-
textProps?: TextProps;
|
|
555
|
-
}
|
|
556
|
-
declare const TextCell: ({ label, containerProps, textProps, children, }: TextCellProps) => react_jsx_runtime.JSX.Element;
|
|
471
|
+
declare const useDataTableContext: <TData>() => DataTableContextProps<TData>;
|
|
557
472
|
|
|
558
473
|
interface GetColumnsConfigs<K extends RowData> {
|
|
559
474
|
schema: JSONSchema7;
|
|
@@ -569,14 +484,6 @@ interface GetColumnsConfigs<K extends RowData> {
|
|
|
569
484
|
declare const widthSanityCheck: <K extends unknown>(widthList: number[], ignoreList: K[], properties: { [key in K as string]?: object | undefined; }) => void;
|
|
570
485
|
declare const getColumns: <TData extends unknown>({ schema, include, ignore, width, meta, defaultWidth, translate, }: GetColumnsConfigs<TData>) => ColumnDef<TData>[];
|
|
571
486
|
|
|
572
|
-
interface TableDataDisplayProps {
|
|
573
|
-
colorPalette?: string;
|
|
574
|
-
emptyComponent?: ReactNode;
|
|
575
|
-
}
|
|
576
|
-
declare const TableDataDisplay: ({ colorPalette, emptyComponent, }: TableDataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
577
|
-
|
|
578
|
-
declare const GlobalFilter: () => react_jsx_runtime.JSX.Element;
|
|
579
|
-
|
|
580
487
|
interface CustomQueryFnResponse {
|
|
581
488
|
/**
|
|
582
489
|
* The data of the query
|
|
@@ -591,6 +498,10 @@ interface CustomQueryFnParams {
|
|
|
591
498
|
searching: string;
|
|
592
499
|
limit: number;
|
|
593
500
|
offset: number;
|
|
501
|
+
where?: Array<{
|
|
502
|
+
id: string;
|
|
503
|
+
value: string | string[];
|
|
504
|
+
}>;
|
|
594
505
|
}
|
|
595
506
|
type CustomQueryFn = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse>;
|
|
596
507
|
interface ForeignKeyProps {
|
|
@@ -1052,7 +963,101 @@ interface RecordDisplayProps {
|
|
|
1052
963
|
}
|
|
1053
964
|
declare const RecordDisplay: ({ object, boxProps, translate, prefix, }: RecordDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
1054
965
|
|
|
1055
|
-
|
|
966
|
+
interface TableDataDisplayProps {
|
|
967
|
+
colorPalette?: string;
|
|
968
|
+
emptyComponent?: ReactNode;
|
|
969
|
+
}
|
|
970
|
+
declare const TableDataDisplay: ({ colorPalette, emptyComponent, }: TableDataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
971
|
+
|
|
972
|
+
interface DefaultTableProps {
|
|
973
|
+
showFooter?: boolean;
|
|
974
|
+
tableProps?: Omit<TableProps, 'children'>;
|
|
975
|
+
tableHeaderProps?: TableHeaderProps;
|
|
976
|
+
tableBodyProps?: TableBodyProps;
|
|
977
|
+
tableFooterProps?: TableFooterProps;
|
|
978
|
+
controlProps?: TableControlsProps;
|
|
979
|
+
variant?: '' | 'greedy';
|
|
980
|
+
isLoading?: boolean;
|
|
981
|
+
}
|
|
982
|
+
declare const DefaultTable: ({ showFooter, tableProps, tableHeaderProps, tableBodyProps, tableFooterProps, controlProps, variant, isLoading, }: DefaultTableProps) => react_jsx_runtime.JSX.Element;
|
|
983
|
+
|
|
984
|
+
interface DefaultTableServerProps extends DefaultTableProps {
|
|
985
|
+
/**
|
|
986
|
+
* Optional isLoading prop to override auto-detected loading state.
|
|
987
|
+
* If not provided, will automatically detect from DataTableServerContext.
|
|
988
|
+
*/
|
|
989
|
+
isLoading?: boolean;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* DefaultTableServer is a wrapper around DefaultTable that automatically
|
|
993
|
+
* detects server-side loading state from DataTableServerContext.
|
|
994
|
+
*
|
|
995
|
+
* Use this component when working with DataTableServer to automatically
|
|
996
|
+
* show skeleton loading state during data fetching.
|
|
997
|
+
*
|
|
998
|
+
* @example
|
|
999
|
+
* ```tsx
|
|
1000
|
+
* <DataTableServer columns={columns} {...datatableServer}>
|
|
1001
|
+
* <DefaultTableServer />
|
|
1002
|
+
* </DataTableServer>
|
|
1003
|
+
* ```
|
|
1004
|
+
*/
|
|
1005
|
+
declare const DefaultTableServer: ({ isLoading: isLoadingOverride, ...props }: DefaultTableServerProps) => react_jsx_runtime.JSX.Element;
|
|
1006
|
+
|
|
1007
|
+
interface DataDisplayProps {
|
|
1008
|
+
variant?: "horizontal" | "stats" | "";
|
|
1009
|
+
translate?: UseTranslationResponse<any, any>;
|
|
1010
|
+
}
|
|
1011
|
+
declare const DataDisplay: ({ variant }: DataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
1012
|
+
|
|
1013
|
+
interface DataTableServerProps<TData = unknown> {
|
|
1014
|
+
children: ReactNode | ReactNode[];
|
|
1015
|
+
/**
|
|
1016
|
+
* Column definitions for the table.
|
|
1017
|
+
*
|
|
1018
|
+
* It will pass into as the column definitions in `@tanstack/react-table`
|
|
1019
|
+
*
|
|
1020
|
+
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
1021
|
+
*/
|
|
1022
|
+
columns: ColumnDef<TData>[];
|
|
1023
|
+
enableRowSelection?: boolean;
|
|
1024
|
+
enableMultiRowSelection?: boolean;
|
|
1025
|
+
enableSubRowSelection?: boolean;
|
|
1026
|
+
columnOrder: ColumnOrderState;
|
|
1027
|
+
columnFilters: ColumnFiltersState;
|
|
1028
|
+
globalFilter: string;
|
|
1029
|
+
density: DensityState;
|
|
1030
|
+
pagination: PaginationState;
|
|
1031
|
+
sorting: SortingState;
|
|
1032
|
+
rowSelection: RowSelectionState;
|
|
1033
|
+
columnVisibility: VisibilityState;
|
|
1034
|
+
setPagination: OnChangeFn<PaginationState>;
|
|
1035
|
+
setSorting: OnChangeFn<SortingState>;
|
|
1036
|
+
setColumnFilters: OnChangeFn<ColumnFiltersState>;
|
|
1037
|
+
setRowSelection: OnChangeFn<RowSelectionState>;
|
|
1038
|
+
setGlobalFilter: OnChangeFn<string>;
|
|
1039
|
+
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
1040
|
+
setDensity: OnChangeFn<DensityState>;
|
|
1041
|
+
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
1042
|
+
query: UseQueryResult<DataResponse<TData>>;
|
|
1043
|
+
url?: string;
|
|
1044
|
+
translate: UseTranslationResponse<any, any>;
|
|
1045
|
+
tableLabel?: DataTableLabel;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* DataTableServer will create a context to hold all values to
|
|
1049
|
+
* help the render of the DataTable in serverside
|
|
1050
|
+
*
|
|
1051
|
+
* The query is required to be a GET request that can receive
|
|
1052
|
+
* specified params and return a specified response
|
|
1053
|
+
*
|
|
1054
|
+
* The `useDataTableServer` can help to create the specified request and response
|
|
1055
|
+
*
|
|
1056
|
+
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
1057
|
+
*/
|
|
1058
|
+
declare function DataTableServer<TData = unknown>({ columns, enableRowSelection, enableMultiRowSelection, enableSubRowSelection, columnOrder, columnFilters, columnVisibility, density, globalFilter, pagination, sorting, rowSelection, setPagination, setSorting, setColumnFilters, setRowSelection, setGlobalFilter, setColumnOrder, setDensity, setColumnVisibility, query, url, translate, children, tableLabel, }: DataTableServerProps<TData>): react_jsx_runtime.JSX.Element;
|
|
1059
|
+
|
|
1060
|
+
declare module '@tanstack/react-table' {
|
|
1056
1061
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
1057
1062
|
/**
|
|
1058
1063
|
* If `showCustomDisplay` is `true`, it will use the cell render to render the value.
|
|
@@ -1091,7 +1096,7 @@ declare module "@tanstack/react-table" {
|
|
|
1091
1096
|
* - "dateRange": A date range filter.
|
|
1092
1097
|
* - "custom": A custom filter function.
|
|
1093
1098
|
*/
|
|
1094
|
-
filterVariant?:
|
|
1099
|
+
filterVariant?: 'text' | 'range' | 'select' | 'tag' | 'boolean' | 'dateRange' | 'custom';
|
|
1095
1100
|
/**
|
|
1096
1101
|
* Options for the select filter variant, if applicable.
|
|
1097
1102
|
*/
|
|
@@ -1121,6 +1126,13 @@ declare module "@tanstack/react-table" {
|
|
|
1121
1126
|
* @returns A JSX element representing the filter UI.
|
|
1122
1127
|
*/
|
|
1123
1128
|
renderFilter?: (column: Column<TData>) => ReactNode;
|
|
1129
|
+
/**
|
|
1130
|
+
* Priority for responsive column hiding when table width is too narrow.
|
|
1131
|
+
* Lower priority numbers = hide first (e.g., priority 1 hides before priority 10).
|
|
1132
|
+
* Columns without priority default to Infinity (highest priority, never auto-hide).
|
|
1133
|
+
* Only applies when canResize={false}.
|
|
1134
|
+
*/
|
|
1135
|
+
responsivePriority?: number;
|
|
1124
1136
|
}
|
|
1125
1137
|
}
|
|
1126
1138
|
|