@bsol-oss/react-datatable5 12.0.0-beta.8 → 12.0.0-beta.80
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 +224 -5
- package/dist/index.d.ts +606 -96
- package/dist/index.js +2679 -610
- package/dist/index.mjs +2683 -619
- package/dist/types/components/DataTable/DataTable.d.ts +12 -7
- package/dist/types/components/DataTable/DataTableServer.d.ts +6 -4
- package/dist/types/components/DataTable/DefaultTable.d.ts +12 -14
- package/dist/types/components/DataTable/DefaultTableServer.d.ts +23 -0
- package/dist/types/components/DataTable/context/DataTableContext.d.ts +21 -3
- package/dist/types/components/DataTable/context/useDataTableContext.d.ts +2 -2
- package/dist/types/components/DataTable/controls/ReloadButton.d.ts +1 -2
- package/dist/types/components/DataTable/controls/ResetFilteringButton.d.ts +1 -4
- package/dist/types/components/DataTable/controls/ResetSelectionButton.d.ts +1 -4
- package/dist/types/components/DataTable/controls/ResetSortingButton.d.ts +1 -4
- package/dist/types/components/DataTable/controls/TableControls.d.ts +10 -2
- package/dist/types/components/DataTable/display/Table.d.ts +3 -3
- package/dist/types/components/DataTable/display/TableBody.d.ts +1 -2
- package/dist/types/components/DataTable/display/TableBodySkeleton.d.ts +5 -0
- package/dist/types/components/DataTable/display/TableCardContainer.d.ts +6 -3
- package/dist/types/components/DataTable/display/TableDataDisplay.d.ts +6 -1
- package/dist/types/components/DataTable/display/TableFooter.d.ts +1 -5
- package/dist/types/components/DataTable/display/TableHeader.d.ts +46 -8
- package/dist/types/components/DataTable/useDataTableServer.d.ts +55 -3
- package/dist/types/components/DatePicker/DatePicker.d.ts +23 -0
- package/dist/types/components/DatePicker/DateTimePicker.d.ts +11 -0
- package/dist/types/components/DatePicker/DurationPicker.d.ts +12 -0
- package/dist/types/components/DatePicker/IsoTimePicker.d.ts +16 -0
- package/dist/types/components/DatePicker/PickerDemo.d.ts +1 -0
- package/dist/types/components/DatePicker/UniversalPicker.d.ts +9 -0
- package/dist/types/components/DatePicker/index.d.ts +7 -0
- package/dist/types/components/Filter/TagFilter.d.ts +5 -1
- package/dist/types/components/Form/SchemaFormContext.d.ts +22 -6
- package/dist/types/components/Form/components/FileDropzone.d.ts +2 -2
- package/dist/types/components/Form/components/core/DefaultForm.d.ts +1 -0
- package/dist/types/components/Form/components/core/FormBody.d.ts +2 -1
- package/dist/types/components/Form/components/core/FormRoot.d.ts +21 -8
- package/dist/types/components/Form/components/fields/BooleanPicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/ColumnRenderer.d.ts +3 -2
- package/dist/types/components/Form/components/fields/CustomInput.d.ts +8 -0
- package/dist/types/components/Form/components/fields/DatePicker.d.ts +2 -7
- package/dist/types/components/Form/components/fields/DateRangePicker.d.ts +2 -0
- package/dist/types/components/Form/components/fields/DateTimePicker.d.ts +2 -0
- package/dist/types/components/Form/components/fields/EnumPicker.d.ts +3 -2
- package/dist/types/components/Form/components/fields/FilePicker.d.ts +2 -5
- package/dist/types/components/Form/components/fields/IdPicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/NumberInputField.d.ts +1 -1
- package/dist/types/components/Form/components/fields/ObjectInput.d.ts +1 -1
- package/dist/types/components/Form/components/fields/RecordInput.d.ts +1 -1
- package/dist/types/components/Form/components/fields/SchemaRenderer.d.ts +1 -1
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +19 -5
- package/dist/types/components/Form/components/fields/TextAreaInput.d.ts +12 -0
- package/dist/types/components/Form/components/{DatePicker.d.ts → fields/TimePicker.d.ts} +2 -2
- package/dist/types/components/Form/components/fields/types.d.ts +6 -0
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +77 -4
- package/dist/types/components/Form/components/viewers/CustomViewer.d.ts +8 -0
- package/dist/types/components/Form/components/viewers/DateTimeViewer.d.ts +7 -0
- package/dist/types/components/Form/components/viewers/NumberViewer.d.ts +1 -1
- package/dist/types/components/Form/components/viewers/TextAreaViewer.d.ts +12 -0
- package/dist/types/components/Form/components/viewers/TimeViewer.d.ts +7 -0
- package/dist/types/components/Form/useForm.d.ts +6 -3
- package/dist/types/components/Form/utils/ajvResolver.d.ts +13 -0
- package/dist/types/components/Form/utils/buildErrorMessages.d.ts +223 -0
- package/dist/types/components/Form/utils/formatBytes.d.ts +6 -0
- package/dist/types/components/Form/utils/getFieldError.d.ts +6 -0
- package/dist/types/components/Form/utils/useFormI18n.d.ts +53 -0
- package/dist/types/components/Form/utils/validateData.d.ts +9 -0
- package/dist/types/components/TextArea/TextArea.d.ts +22 -0
- package/dist/types/components/TimePicker/TimePicker.d.ts +21 -0
- package/dist/types/components/ui/field.d.ts +3 -3
- package/dist/types/index.d.ts +19 -2
- package/package.json +18 -3
- package/dist/types/components/Controls/DensityFeature.d.ts +0 -23
- package/dist/types/components/Controls/DensityToggleButton.d.ts +0 -6
- package/dist/types/components/Controls/EditFilterButton.d.ts +0 -9
- package/dist/types/components/Controls/EditOrderButton.d.ts +0 -7
- package/dist/types/components/Controls/EditSortingButton.d.ts +0 -7
- package/dist/types/components/Controls/EditViewButton.d.ts +0 -7
- package/dist/types/components/Controls/FilterDialog.d.ts +0 -5
- package/dist/types/components/Controls/PageSizeControl.d.ts +0 -4
- package/dist/types/components/Controls/Pagination.d.ts +0 -1
- package/dist/types/components/Controls/ResetFilteringButton.d.ts +0 -4
- package/dist/types/components/Controls/ResetSelectionButton.d.ts +0 -4
- package/dist/types/components/Controls/ResetSortingButton.d.ts +0 -4
- package/dist/types/components/Controls/RowCountText.d.ts +0 -1
- package/dist/types/components/Controls/SelectAllRowsToggle.d.ts +0 -8
- package/dist/types/components/Controls/TablePagination.d.ts +0 -1
- package/dist/types/components/Controls/ViewDialog.d.ts +0 -5
- package/dist/types/components/DataTable/CardHeader.d.ts +0 -13
- package/dist/types/components/DataTable/DataDisplay.d.ts +0 -6
- package/dist/types/components/DataTable/ReloadButton.d.ts +0 -5
- package/dist/types/components/DataTable/Table.d.ts +0 -10
- package/dist/types/components/DataTable/TableBody.d.ts +0 -21
- package/dist/types/components/DataTable/TableCardContainer.d.ts +0 -7
- package/dist/types/components/DataTable/TableCards.d.ts +0 -11
- package/dist/types/components/DataTable/TableComponent.d.ts +0 -6
- package/dist/types/components/DataTable/TableControls.d.ts +0 -21
- package/dist/types/components/DataTable/TableFilter.d.ts +0 -1
- package/dist/types/components/DataTable/TableFilterTags.d.ts +0 -1
- package/dist/types/components/DataTable/TableFilters.d.ts +0 -1
- package/dist/types/components/DataTable/TableFooter.d.ts +0 -9
- package/dist/types/components/DataTable/TableHeader.d.ts +0 -13
- package/dist/types/components/DataTable/TableLoadingComponent.d.ts +0 -5
- package/dist/types/components/DataTable/TableOrderer.d.ts +0 -1
- package/dist/types/components/DataTable/TableSelector.d.ts +0 -1
- package/dist/types/components/DataTable/TableSorter.d.ts +0 -1
- package/dist/types/components/DataTable/TableViewer.d.ts +0 -1
- package/dist/types/components/DataTable/TextCell.d.ts +0 -10
- package/dist/types/components/DataTable/components/EmptyState.d.ts +0 -5
- package/dist/types/components/DataTable/components/ErrorAlert.d.ts +0 -4
- package/dist/types/components/DataTable/components/RecordDisplay.d.ts +0 -9
- package/dist/types/components/DataTable/components/TextCell.d.ts +0 -10
- package/dist/types/components/Filter/DateRangeFilter.d.ts +0 -9
- package/dist/types/components/Filter/FilterOptions.d.ts +0 -4
- package/dist/types/components/Form/Form.d.ts +0 -36
- package/dist/types/components/Form/components/ArrayRenderer.d.ts +0 -7
- package/dist/types/components/Form/components/BooleanPicker.d.ts +0 -7
- package/dist/types/components/Form/components/ColumnRenderer.d.ts +0 -7
- package/dist/types/components/Form/components/EnumPicker.d.ts +0 -8
- package/dist/types/components/Form/components/FilePicker.d.ts +0 -5
- package/dist/types/components/Form/components/IdPicker.d.ts +0 -8
- package/dist/types/components/Form/components/IdViewer.d.ts +0 -5
- package/dist/types/components/Form/components/NumberInputField.d.ts +0 -7
- package/dist/types/components/Form/components/ObjectInput.d.ts +0 -7
- package/dist/types/components/Form/components/RecordInput.d.ts +0 -7
- package/dist/types/components/Form/components/SchemaRenderer.d.ts +0 -7
- package/dist/types/components/Form/components/StringInputField.d.ts +0 -20
- package/dist/types/components/Form/components/TagPicker.d.ts +0 -30
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Row, RowData, OnChangeFn, Updater, FilterFn, ColumnDef, RowSelectionState, ColumnOrderState, ColumnFiltersState, PaginationState, SortingState, VisibilityState, Table as Table$1, Column } from '@tanstack/react-table';
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import react__default, { ReactNode, Dispatch, SetStateAction } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { ImageProps, TableHeaderProps as TableHeaderProps$1,
|
|
6
|
+
import { ImageProps, GridProps, TableRootProps, TableHeaderProps as TableHeaderProps$1, TableRowProps, BoxProps, FlexProps, CardBodyProps, TextProps } 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
10
|
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
11
11
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
12
12
|
import { JSONSchema7 } from 'json-schema';
|
|
13
|
-
import { ForeignKeyProps } from '@/components/Form/components/fields/StringInputField';
|
|
13
|
+
import { ForeignKeyProps as ForeignKeyProps$1 } from '@/components/Form/components/fields/StringInputField';
|
|
14
14
|
import { AxiosRequestConfig } from 'axios';
|
|
15
15
|
import * as react_hook_form from 'react-hook-form';
|
|
16
|
-
import {
|
|
16
|
+
import { UseFormReturn, FieldValues, SubmitHandler } from 'react-hook-form';
|
|
17
17
|
import { RenderProps, Props } from '@bsol-oss/dayzed-react19';
|
|
18
18
|
|
|
19
19
|
interface DensityToggleButtonProps {
|
|
20
|
-
icon?:
|
|
20
|
+
icon?: react__default.ReactElement;
|
|
21
21
|
text?: string;
|
|
22
22
|
}
|
|
23
23
|
declare const DensityToggleButton: ({ text, icon, }: DensityToggleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -41,25 +41,16 @@ declare const PageSizeControl: ({ pageSizes, }: PageSizeControlProps) => react_j
|
|
|
41
41
|
|
|
42
42
|
declare const Pagination: () => react_jsx_runtime.JSX.Element;
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
text?: string;
|
|
46
|
-
}
|
|
47
|
-
declare const ResetFilteringButton: ({ text, }: ResetFilteringButtonProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare const ResetFilteringButton: () => react_jsx_runtime.JSX.Element;
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
text?: string;
|
|
51
|
-
}
|
|
52
|
-
declare const ResetSelectionButton: ({ text, }: ResetSelectionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
+
declare const ResetSelectionButton: () => react_jsx_runtime.JSX.Element;
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
text?: string;
|
|
56
|
-
}
|
|
57
|
-
declare const ResetSortingButton: ({ text, }: ResetSortingButtonProps) => react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare const ResetSortingButton: () => react_jsx_runtime.JSX.Element;
|
|
58
49
|
|
|
59
50
|
declare const RowCountText: () => react_jsx_runtime.JSX.Element;
|
|
60
51
|
|
|
61
52
|
interface EditViewButtonProps {
|
|
62
|
-
icon?:
|
|
53
|
+
icon?: react__default.ReactElement;
|
|
63
54
|
}
|
|
64
55
|
declare const ViewDialog: ({ icon }: EditViewButtonProps) => react_jsx_runtime.JSX.Element;
|
|
65
56
|
|
|
@@ -107,7 +98,7 @@ declare module "@tanstack/react-table" {
|
|
|
107
98
|
}
|
|
108
99
|
}
|
|
109
100
|
|
|
110
|
-
declare module
|
|
101
|
+
declare module '@tanstack/react-table' {
|
|
111
102
|
interface FilterFns {
|
|
112
103
|
fuzzy: FilterFn<unknown>;
|
|
113
104
|
}
|
|
@@ -121,6 +112,9 @@ interface DataTableProps<TData = unknown> {
|
|
|
121
112
|
* Data array for the table.
|
|
122
113
|
*
|
|
123
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 []
|
|
124
118
|
*
|
|
125
119
|
*/
|
|
126
120
|
data: TData[];
|
|
@@ -153,6 +147,7 @@ interface DataTableProps<TData = unknown> {
|
|
|
153
147
|
setDensity: OnChangeFn<DensityState>;
|
|
154
148
|
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
155
149
|
translate: UseTranslationResponse<any, any>;
|
|
150
|
+
tableLabel?: DataTableLabel;
|
|
156
151
|
}
|
|
157
152
|
/**
|
|
158
153
|
* DataTable will create a context to hold all values to
|
|
@@ -164,18 +159,35 @@ interface DataTableProps<TData = unknown> {
|
|
|
164
159
|
*
|
|
165
160
|
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
166
161
|
*/
|
|
167
|
-
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, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
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;
|
|
168
163
|
|
|
169
|
-
interface
|
|
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 {
|
|
170
182
|
table: Table$1<TData>;
|
|
171
183
|
globalFilter: string;
|
|
172
184
|
setGlobalFilter: OnChangeFn<string>;
|
|
173
185
|
type: "client" | "server";
|
|
174
|
-
translate: UseTranslationResponse<any,
|
|
186
|
+
translate: UseTranslationResponse<any, unknown>;
|
|
187
|
+
tableLabel: DataTableLabel;
|
|
175
188
|
}
|
|
176
|
-
declare const DataTableContext: React$1.Context<DataTableContext<unknown>>;
|
|
177
189
|
|
|
178
|
-
declare const useDataTableContext: <TData>() =>
|
|
190
|
+
declare const useDataTableContext: <TData>() => DataTableContextProps<TData>;
|
|
179
191
|
|
|
180
192
|
interface DataDisplayProps {
|
|
181
193
|
variant?: "horizontal" | "stats" | "";
|
|
@@ -218,7 +230,7 @@ interface UseDataTableReturn {
|
|
|
218
230
|
}
|
|
219
231
|
declare const useDataTable: ({ default: { sorting: defaultSorting, pagination: defaultPagination, rowSelection: defaultRowSelection, columnFilters: defaultColumnFilters, columnOrder: defaultColumnOrder, columnVisibility: defaultColumnVisibility, globalFilter: defaultGlobalFilter, density: defaultDensity, }, keyPrefix, }?: UseDataTableProps) => UseDataTableReturn;
|
|
220
232
|
|
|
221
|
-
interface UseDataTableServerProps extends UseDataTableProps {
|
|
233
|
+
interface UseDataTableServerProps<TData> extends UseDataTableProps {
|
|
222
234
|
/**
|
|
223
235
|
* Delay to send the request if the `refreshData` called multiple times
|
|
224
236
|
*
|
|
@@ -231,7 +243,51 @@ interface UseDataTableServerProps extends UseDataTableProps {
|
|
|
231
243
|
* default: `1000`
|
|
232
244
|
*/
|
|
233
245
|
debounceDelay?: number;
|
|
234
|
-
|
|
246
|
+
/**
|
|
247
|
+
* The url to fetch the data from.
|
|
248
|
+
*
|
|
249
|
+
* Remark:
|
|
250
|
+
* it is the server responsibility to handle the params and return the data.
|
|
251
|
+
* especially the pagination and sorting.
|
|
252
|
+
*
|
|
253
|
+
* The response must be like this:
|
|
254
|
+
* ```ts
|
|
255
|
+
* {
|
|
256
|
+
* data: TData[],
|
|
257
|
+
* count: number,
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* Example:
|
|
262
|
+
* ```ts
|
|
263
|
+
* const url = "https://jsonplaceholder.typicode.com/posts";
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* If not provided, the `queryFn` will be used.
|
|
267
|
+
*
|
|
268
|
+
* @default undefined
|
|
269
|
+
*/
|
|
270
|
+
url?: string;
|
|
271
|
+
placeholderData?: DataResponse<TData>;
|
|
272
|
+
/**
|
|
273
|
+
* The query function to fetch the data from.
|
|
274
|
+
*
|
|
275
|
+
* Remark:
|
|
276
|
+
* it is the server responsibility to handle the params and return the data.
|
|
277
|
+
* especially the pagination and sorting.
|
|
278
|
+
*
|
|
279
|
+
* Example:
|
|
280
|
+
* ```ts
|
|
281
|
+
* const queryFn = (params: QueryParams) => {
|
|
282
|
+
* return axios.get<DataResponse<TData>>(url, { params });
|
|
283
|
+
* };
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* If not provided, the `url` will be used.
|
|
287
|
+
*
|
|
288
|
+
* @default undefined
|
|
289
|
+
*/
|
|
290
|
+
queryFn?: (params: QueryParams) => Promise<DataResponse<TData>>;
|
|
235
291
|
}
|
|
236
292
|
interface UseDataTableServerReturn<TData> extends UseDataTableReturn {
|
|
237
293
|
query: UseQueryResult<DataResponse<TData>, Error>;
|
|
@@ -242,9 +298,16 @@ interface Result<T = unknown> {
|
|
|
242
298
|
interface DataResponse<T = unknown> extends Result<T> {
|
|
243
299
|
count: number;
|
|
244
300
|
}
|
|
245
|
-
|
|
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>;
|
|
246
309
|
|
|
247
|
-
interface DataTableServerProps<TData
|
|
310
|
+
interface DataTableServerProps<TData = unknown> {
|
|
248
311
|
children: ReactNode | ReactNode[];
|
|
249
312
|
/**
|
|
250
313
|
* Column definitions for the table.
|
|
@@ -273,9 +336,10 @@ interface DataTableServerProps<TData extends DataResponse = DataResponse<unknown
|
|
|
273
336
|
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
274
337
|
setDensity: OnChangeFn<DensityState>;
|
|
275
338
|
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
276
|
-
query: UseQueryResult<TData
|
|
277
|
-
url
|
|
339
|
+
query: UseQueryResult<DataResponse<TData>>;
|
|
340
|
+
url?: string;
|
|
278
341
|
translate: UseTranslationResponse<any, any>;
|
|
342
|
+
tableLabel?: DataTableLabel;
|
|
279
343
|
}
|
|
280
344
|
/**
|
|
281
345
|
* DataTableServer will create a context to hold all values to
|
|
@@ -288,28 +352,7 @@ interface DataTableServerProps<TData extends DataResponse = DataResponse<unknown
|
|
|
288
352
|
*
|
|
289
353
|
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
290
354
|
*/
|
|
291
|
-
declare function DataTableServer<TData
|
|
292
|
-
|
|
293
|
-
interface TableBodyProps {
|
|
294
|
-
pinnedBgColor?: {
|
|
295
|
-
light: string;
|
|
296
|
-
dark: string;
|
|
297
|
-
};
|
|
298
|
-
showSelector?: boolean;
|
|
299
|
-
alwaysShowSelector?: boolean;
|
|
300
|
-
canResize?: boolean;
|
|
301
|
-
}
|
|
302
|
-
interface TableRowSelectorProps<TData> {
|
|
303
|
-
index: number;
|
|
304
|
-
row: Row<TData>;
|
|
305
|
-
hoveredRow: number;
|
|
306
|
-
pinnedBgColor?: {
|
|
307
|
-
light: string;
|
|
308
|
-
dark: string;
|
|
309
|
-
};
|
|
310
|
-
alwaysShowSelector?: boolean;
|
|
311
|
-
}
|
|
312
|
-
declare const TableBody: ({ pinnedBgColor, showSelector, alwaysShowSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
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;
|
|
313
356
|
|
|
314
357
|
interface TableControlsProps {
|
|
315
358
|
totalText?: string;
|
|
@@ -325,69 +368,154 @@ interface TableControlsProps {
|
|
|
325
368
|
showPageSizeControl?: boolean;
|
|
326
369
|
showPageCountText?: boolean;
|
|
327
370
|
showView?: boolean;
|
|
328
|
-
|
|
371
|
+
filterTagsOptions?: {
|
|
372
|
+
column: string;
|
|
373
|
+
options: {
|
|
374
|
+
label: string;
|
|
375
|
+
value: string;
|
|
376
|
+
}[];
|
|
377
|
+
}[];
|
|
329
378
|
extraItems?: ReactNode;
|
|
330
379
|
loading?: boolean;
|
|
331
380
|
hasError?: boolean;
|
|
381
|
+
gridProps?: GridProps;
|
|
332
382
|
}
|
|
333
|
-
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView,
|
|
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;
|
|
334
384
|
|
|
335
|
-
interface
|
|
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 {
|
|
336
395
|
pinnedBgColor?: {
|
|
337
396
|
light: string;
|
|
338
397
|
dark: string;
|
|
339
398
|
};
|
|
340
399
|
showSelector?: boolean;
|
|
341
400
|
alwaysShowSelector?: boolean;
|
|
342
|
-
}
|
|
343
|
-
declare const TableFooter: ({ pinnedBgColor, showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
344
|
-
|
|
345
|
-
interface TableHeaderProps {
|
|
346
401
|
canResize?: boolean;
|
|
402
|
+
}
|
|
403
|
+
interface TableRowSelectorProps<TData> {
|
|
404
|
+
index: number;
|
|
405
|
+
row: Row<TData>;
|
|
406
|
+
hoveredRow: number;
|
|
347
407
|
pinnedBgColor?: {
|
|
348
408
|
light: string;
|
|
349
409
|
dark: string;
|
|
350
410
|
};
|
|
411
|
+
}
|
|
412
|
+
declare const TableBody: ({ showSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
413
|
+
|
|
414
|
+
interface TableFooterProps {
|
|
351
415
|
showSelector?: boolean;
|
|
352
|
-
isSticky?: boolean;
|
|
353
416
|
alwaysShowSelector?: boolean;
|
|
354
|
-
tHeadProps?: TableHeaderProps$1;
|
|
355
417
|
}
|
|
356
|
-
declare const
|
|
418
|
+
declare const TableFooter: ({ showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
357
419
|
|
|
358
|
-
interface
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
420
|
+
interface TableHeaderTexts {
|
|
421
|
+
pinColumn?: string;
|
|
422
|
+
cancelPin?: string;
|
|
423
|
+
sortAscending?: string;
|
|
424
|
+
sortDescending?: string;
|
|
425
|
+
clearSorting?: string;
|
|
426
|
+
}
|
|
427
|
+
interface TableHeaderProps {
|
|
362
428
|
canResize?: boolean;
|
|
363
|
-
|
|
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;
|
|
364
438
|
}
|
|
365
|
-
|
|
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;
|
|
366
470
|
|
|
367
471
|
interface DefaultTableProps {
|
|
368
472
|
showFooter?: boolean;
|
|
369
|
-
|
|
370
|
-
tableProps?: Omit<TableProps, "children">;
|
|
371
|
-
tHeadProps?: TableHeaderProps$1;
|
|
372
|
-
controlProps?: TableControlsProps;
|
|
373
|
-
tableFooterProps?: TableFooterProps;
|
|
374
|
-
tableBodyProps?: TableBodyProps;
|
|
473
|
+
tableProps?: Omit<TableProps, 'children'>;
|
|
375
474
|
tableHeaderProps?: TableHeaderProps;
|
|
376
|
-
|
|
475
|
+
tableBodyProps?: TableBodyProps;
|
|
476
|
+
tableFooterProps?: TableFooterProps;
|
|
477
|
+
controlProps?: TableControlsProps;
|
|
478
|
+
variant?: '' | 'greedy';
|
|
479
|
+
isLoading?: boolean;
|
|
480
|
+
}
|
|
481
|
+
declare const DefaultTable: ({ showFooter, tableProps, tableHeaderProps, tableBodyProps, tableFooterProps, controlProps, variant, isLoading, }: DefaultTableProps) => react_jsx_runtime.JSX.Element;
|
|
482
|
+
|
|
483
|
+
interface DefaultTableServerProps extends DefaultTableProps {
|
|
484
|
+
/**
|
|
485
|
+
* Optional isLoading prop to override auto-detected loading state.
|
|
486
|
+
* If not provided, will automatically detect from DataTableServerContext.
|
|
487
|
+
*/
|
|
488
|
+
isLoading?: boolean;
|
|
377
489
|
}
|
|
378
|
-
|
|
490
|
+
/**
|
|
491
|
+
* DefaultTableServer is a wrapper around DefaultTable that automatically
|
|
492
|
+
* detects server-side loading state from DataTableServerContext.
|
|
493
|
+
*
|
|
494
|
+
* Use this component when working with DataTableServer to automatically
|
|
495
|
+
* show skeleton loading state during data fetching.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```tsx
|
|
499
|
+
* <DataTableServer columns={columns} {...datatableServer}>
|
|
500
|
+
* <DefaultTableServer />
|
|
501
|
+
* </DataTableServer>
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
declare const DefaultTableServer: ({ isLoading: isLoadingOverride, ...props }: DefaultTableServerProps) => react_jsx_runtime.JSX.Element;
|
|
379
505
|
|
|
380
506
|
interface ReloadButtonProps {
|
|
381
|
-
text?: string;
|
|
382
507
|
variant?: string;
|
|
383
508
|
}
|
|
384
|
-
declare const ReloadButton: ({
|
|
509
|
+
declare const ReloadButton: ({ variant, }: ReloadButtonProps) => react_jsx_runtime.JSX.Element;
|
|
385
510
|
|
|
386
|
-
interface TableCardContainerProps extends
|
|
511
|
+
interface TableCardContainerProps extends BoxProps {
|
|
387
512
|
children: ReactNode;
|
|
388
513
|
variant?: "carousel" | "";
|
|
514
|
+
gap?: string;
|
|
515
|
+
gridTemplateColumns?: string;
|
|
516
|
+
direction?: FlexProps["direction"];
|
|
389
517
|
}
|
|
390
|
-
declare const TableCardContainer: ({ children, variant, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
518
|
+
declare const TableCardContainer: ({ children, variant, gap, gridTemplateColumns, direction, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
391
519
|
|
|
392
520
|
interface TableCardsProps<TData> {
|
|
393
521
|
isSelectable?: boolean;
|
|
@@ -399,9 +527,9 @@ declare const DefaultCardTitle: () => react_jsx_runtime.JSX.Element;
|
|
|
399
527
|
declare const TableCards: <TData>({ isSelectable, showDisplayNameOnly, renderTitle, cardBodyProps, }: TableCardsProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
400
528
|
|
|
401
529
|
interface TableRendererProps<TData> {
|
|
402
|
-
render: (render: Table$1<TData>) =>
|
|
530
|
+
render: (render: Table$1<TData>) => react__default.ReactElement;
|
|
403
531
|
}
|
|
404
|
-
declare const TableComponent: <TData>({ render, }: TableRendererProps<TData>) =>
|
|
532
|
+
declare const TableComponent: <TData>({ render, }: TableRendererProps<TData>) => react__default.ReactElement<unknown, string | react__default.JSXElementConstructor<any>>;
|
|
405
533
|
|
|
406
534
|
declare const TableFilter: () => react_jsx_runtime.JSX.Element;
|
|
407
535
|
|
|
@@ -441,17 +569,347 @@ interface GetColumnsConfigs<K extends RowData> {
|
|
|
441
569
|
declare const widthSanityCheck: <K extends unknown>(widthList: number[], ignoreList: K[], properties: { [key in K as string]?: object | undefined; }) => void;
|
|
442
570
|
declare const getColumns: <TData extends unknown>({ schema, include, ignore, width, meta, defaultWidth, translate, }: GetColumnsConfigs<TData>) => ColumnDef<TData>[];
|
|
443
571
|
|
|
444
|
-
|
|
572
|
+
interface TableDataDisplayProps {
|
|
573
|
+
colorPalette?: string;
|
|
574
|
+
emptyComponent?: ReactNode;
|
|
575
|
+
}
|
|
576
|
+
declare const TableDataDisplay: ({ colorPalette, emptyComponent, }: TableDataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
445
577
|
|
|
446
|
-
|
|
578
|
+
declare const GlobalFilter: () => react_jsx_runtime.JSX.Element;
|
|
579
|
+
|
|
580
|
+
interface CustomQueryFnResponse {
|
|
581
|
+
/**
|
|
582
|
+
* The data of the query
|
|
583
|
+
*/
|
|
584
|
+
data: any;
|
|
585
|
+
/**
|
|
586
|
+
* The id map of the data
|
|
587
|
+
*/
|
|
588
|
+
idMap: Record<string, any>;
|
|
589
|
+
}
|
|
590
|
+
interface CustomQueryFnParams {
|
|
591
|
+
searching: string;
|
|
592
|
+
limit: number;
|
|
593
|
+
offset: number;
|
|
594
|
+
}
|
|
595
|
+
type CustomQueryFn = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse>;
|
|
596
|
+
interface ForeignKeyProps {
|
|
447
597
|
column: string;
|
|
598
|
+
table: string;
|
|
599
|
+
display_column: string;
|
|
600
|
+
customQueryFn?: CustomQueryFn;
|
|
448
601
|
}
|
|
449
|
-
declare const FilterOptions: ({ column }: FilterOptionsProps) => react_jsx_runtime.JSX.Element;
|
|
450
602
|
|
|
451
|
-
|
|
603
|
+
/**
|
|
604
|
+
* Type definitions for error message configuration
|
|
605
|
+
*/
|
|
606
|
+
/**
|
|
607
|
+
* Common validation error types that can be customized
|
|
608
|
+
*/
|
|
609
|
+
type ValidationErrorType = 'minLength' | 'maxLength' | 'pattern' | 'minimum' | 'maximum' | 'multipleOf' | 'format' | 'type' | 'enum' | 'required' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minProperties' | 'maxProperties' | 'anyOf' | 'oneOf' | 'allOf' | 'const' | 'additionalProperties' | 'dependencies';
|
|
610
|
+
/**
|
|
611
|
+
* Configuration for field-specific validation errors
|
|
612
|
+
*/
|
|
613
|
+
type FieldErrorConfig = Partial<Record<ValidationErrorType, string>>;
|
|
614
|
+
/**
|
|
615
|
+
* Configuration for building error messages
|
|
616
|
+
*/
|
|
617
|
+
interface ErrorMessageConfig {
|
|
618
|
+
/**
|
|
619
|
+
* Required field error messages
|
|
620
|
+
* Maps field names to their required error messages
|
|
621
|
+
* Supports both plain strings and i18n translation keys
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```typescript
|
|
625
|
+
* required: {
|
|
626
|
+
* username: "Username is required", // plain string
|
|
627
|
+
* email: "user.email.field_required" // i18n key
|
|
628
|
+
* }
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
required?: Record<string, string>;
|
|
632
|
+
/**
|
|
633
|
+
* Field-specific validation error messages
|
|
634
|
+
* Maps field names to their validation error configurations
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* ```typescript
|
|
638
|
+
* properties: {
|
|
639
|
+
* username: {
|
|
640
|
+
* minLength: "Username must be at least 3 characters",
|
|
641
|
+
* pattern: "Username can only contain letters and numbers"
|
|
642
|
+
* },
|
|
643
|
+
* age: {
|
|
644
|
+
* minimum: "Age must be at least 18",
|
|
645
|
+
* maximum: "Age cannot exceed 120"
|
|
646
|
+
* }
|
|
647
|
+
* }
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
properties?: Record<string, FieldErrorConfig>;
|
|
651
|
+
/**
|
|
652
|
+
* Global fallback error messages for validation types
|
|
653
|
+
* These are used when no field-specific message is provided
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```typescript
|
|
657
|
+
* {
|
|
658
|
+
* minLength: "This field is too short",
|
|
659
|
+
* minimum: "Value is too small"
|
|
660
|
+
* }
|
|
661
|
+
* ```
|
|
662
|
+
*/
|
|
663
|
+
[key: string]: any;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Result of buildErrorMessages that follows ajv-errors format
|
|
667
|
+
*/
|
|
668
|
+
interface ErrorMessageResult {
|
|
669
|
+
required?: Record<string, string>;
|
|
670
|
+
properties?: Record<string, FieldErrorConfig>;
|
|
671
|
+
[key: string]: any;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Schema-level error message builder
|
|
675
|
+
*
|
|
676
|
+
* Builds a complete errorMessage object compatible with ajv-errors plugin.
|
|
677
|
+
* Supports both i18n translation keys and plain string messages.
|
|
678
|
+
*
|
|
679
|
+
* @param config - Error message configuration
|
|
680
|
+
* @returns Complete errorMessage object for JSON Schema
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```typescript
|
|
684
|
+
* // Simple required field errors
|
|
685
|
+
* const errorMessage = buildErrorMessages({
|
|
686
|
+
* required: {
|
|
687
|
+
* username: "Username is required",
|
|
688
|
+
* email: "user.email.field_required" // i18n key
|
|
689
|
+
* }
|
|
690
|
+
* });
|
|
691
|
+
*
|
|
692
|
+
* // With validation rules
|
|
693
|
+
* const errorMessage = buildErrorMessages({
|
|
694
|
+
* required: {
|
|
695
|
+
* password: "Password is required"
|
|
696
|
+
* },
|
|
697
|
+
* properties: {
|
|
698
|
+
* password: {
|
|
699
|
+
* minLength: "Password must be at least 8 characters",
|
|
700
|
+
* pattern: "Password must contain letters and numbers"
|
|
701
|
+
* },
|
|
702
|
+
* age: {
|
|
703
|
+
* minimum: "Must be 18 or older",
|
|
704
|
+
* maximum: "Must be under 120"
|
|
705
|
+
* }
|
|
706
|
+
* }
|
|
707
|
+
* });
|
|
708
|
+
*
|
|
709
|
+
* // With global fallbacks
|
|
710
|
+
* const errorMessage = buildErrorMessages({
|
|
711
|
+
* required: {
|
|
712
|
+
* email: "Email is required"
|
|
713
|
+
* },
|
|
714
|
+
* minLength: "This field is too short", // applies to all fields
|
|
715
|
+
* minimum: "Value is too small"
|
|
716
|
+
* });
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
719
|
+
declare const buildErrorMessages: (config: ErrorMessageConfig) => ErrorMessageResult;
|
|
720
|
+
/**
|
|
721
|
+
* Converts buildErrorMessages result to ajv-errors compatible format
|
|
722
|
+
*/
|
|
723
|
+
declare const convertToAjvErrorsFormat: (errorMessages: ErrorMessageResult) => Record<string, any>;
|
|
724
|
+
/**
|
|
725
|
+
* Helper function to build required field errors
|
|
726
|
+
*
|
|
727
|
+
* Simplifies creating required field error messages, especially useful
|
|
728
|
+
* for generating i18n translation keys following a pattern.
|
|
729
|
+
*
|
|
730
|
+
* @param fields - Array of required field names
|
|
731
|
+
* @param messageOrGenerator - Either a string template or function to generate messages
|
|
732
|
+
* @returns Required field error configuration
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* ```typescript
|
|
736
|
+
* // Plain string messages
|
|
737
|
+
* const required = buildRequiredErrors(
|
|
738
|
+
* ["username", "email", "password"],
|
|
739
|
+
* (field) => `${field} is required`
|
|
740
|
+
* );
|
|
741
|
+
* // Result: { username: "username is required", email: "email is required", ... }
|
|
742
|
+
*
|
|
743
|
+
* // i18n translation keys
|
|
744
|
+
* const required = buildRequiredErrors(
|
|
745
|
+
* ["username", "email"],
|
|
746
|
+
* (field) => `user.${field}.field_required`
|
|
747
|
+
* );
|
|
748
|
+
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
749
|
+
*
|
|
750
|
+
* // Same message for all fields
|
|
751
|
+
* const required = buildRequiredErrors(
|
|
752
|
+
* ["username", "email"],
|
|
753
|
+
* "This field is required"
|
|
754
|
+
* );
|
|
755
|
+
* // Result: { username: "This field is required", email: "This field is required" }
|
|
756
|
+
*
|
|
757
|
+
* // With keyPrefix for i18n
|
|
758
|
+
* const required = buildRequiredErrors(
|
|
759
|
+
* ["username", "email"],
|
|
760
|
+
* (field) => `${field}.field_required`,
|
|
761
|
+
* "user"
|
|
762
|
+
* );
|
|
763
|
+
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
declare const buildRequiredErrors: (fields: string[], messageOrGenerator: string | ((field: string) => string), keyPrefix?: string) => Record<string, string>;
|
|
767
|
+
/**
|
|
768
|
+
* Helper function to build field-specific validation errors
|
|
769
|
+
*
|
|
770
|
+
* Creates property-specific error messages for multiple fields at once.
|
|
771
|
+
*
|
|
772
|
+
* @param config - Maps field names to their validation error configurations
|
|
773
|
+
* @returns Properties error configuration
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```typescript
|
|
777
|
+
* const properties = buildFieldErrors({
|
|
778
|
+
* username: {
|
|
779
|
+
* minLength: "Username must be at least 3 characters",
|
|
780
|
+
* pattern: "Username can only contain letters and numbers"
|
|
781
|
+
* },
|
|
782
|
+
* age: {
|
|
783
|
+
* minimum: "Must be 18 or older",
|
|
784
|
+
* maximum: "Must be under 120"
|
|
785
|
+
* },
|
|
786
|
+
* email: {
|
|
787
|
+
* format: "Please enter a valid email address"
|
|
788
|
+
* }
|
|
789
|
+
* });
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
declare const buildFieldErrors: (config: Record<string, FieldErrorConfig>) => Record<string, FieldErrorConfig>;
|
|
793
|
+
/**
|
|
794
|
+
* Helper function to create a complete error message configuration in one call
|
|
795
|
+
*
|
|
796
|
+
* Convenient wrapper that combines required and validation errors.
|
|
797
|
+
*
|
|
798
|
+
* @param required - Required field error messages
|
|
799
|
+
* @param properties - Field-specific validation error messages
|
|
800
|
+
* @param globalFallbacks - Global fallback error messages
|
|
801
|
+
* @returns Complete error message configuration
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* ```typescript
|
|
805
|
+
* const errorMessage = createErrorMessage(
|
|
806
|
+
* {
|
|
807
|
+
* username: "Username is required",
|
|
808
|
+
* email: "Email is required"
|
|
809
|
+
* },
|
|
810
|
+
* {
|
|
811
|
+
* username: {
|
|
812
|
+
* minLength: "Username must be at least 3 characters"
|
|
813
|
+
* },
|
|
814
|
+
* email: {
|
|
815
|
+
* format: "Please enter a valid email"
|
|
816
|
+
* }
|
|
817
|
+
* },
|
|
818
|
+
* {
|
|
819
|
+
* minLength: "This field is too short",
|
|
820
|
+
* format: "Invalid format"
|
|
821
|
+
* }
|
|
822
|
+
* );
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
declare const createErrorMessage: (required?: Record<string, string>, properties?: Record<string, FieldErrorConfig>, globalFallbacks?: Partial<Record<ValidationErrorType, string>>) => ErrorMessageResult;
|
|
826
|
+
|
|
827
|
+
interface DateTimePickerLabels {
|
|
828
|
+
monthNamesShort?: string[];
|
|
829
|
+
weekdayNamesShort?: string[];
|
|
830
|
+
backButtonLabel?: string;
|
|
831
|
+
forwardButtonLabel?: string;
|
|
832
|
+
}
|
|
833
|
+
interface IdPickerLabels {
|
|
834
|
+
undefined?: string;
|
|
835
|
+
addMore?: string;
|
|
836
|
+
typeToSearch?: string;
|
|
837
|
+
total?: string;
|
|
838
|
+
showing?: string;
|
|
839
|
+
perPage?: string;
|
|
840
|
+
emptySearchResult?: string;
|
|
841
|
+
initialResults?: string;
|
|
842
|
+
}
|
|
843
|
+
interface EnumPickerLabels {
|
|
844
|
+
undefined?: string;
|
|
845
|
+
addMore?: string;
|
|
846
|
+
typeToSearch?: string;
|
|
847
|
+
total?: string;
|
|
848
|
+
showing?: string;
|
|
849
|
+
perPage?: string;
|
|
850
|
+
emptySearchResult?: string;
|
|
851
|
+
initialResults?: string;
|
|
852
|
+
}
|
|
853
|
+
interface FilePickerLabels {
|
|
854
|
+
fileDropzone?: string;
|
|
855
|
+
browseLibrary?: string;
|
|
856
|
+
dialogTitle?: string;
|
|
857
|
+
searchPlaceholder?: string;
|
|
858
|
+
loading?: string;
|
|
859
|
+
loadingFailed?: string;
|
|
860
|
+
noFilesFound?: string;
|
|
861
|
+
cancel?: string;
|
|
862
|
+
select?: string;
|
|
863
|
+
}
|
|
864
|
+
interface CustomJSONSchema7 extends JSONSchema7 {
|
|
865
|
+
gridColumn?: string;
|
|
866
|
+
gridRow?: string;
|
|
867
|
+
foreign_key?: ForeignKeyProps;
|
|
868
|
+
variant?: string;
|
|
869
|
+
renderDisplay?: (item: unknown) => ReactNode;
|
|
870
|
+
inputRender?: (props: {
|
|
871
|
+
column: string;
|
|
872
|
+
schema: CustomJSONSchema7;
|
|
873
|
+
prefix: string;
|
|
874
|
+
formContext: UseFormReturn;
|
|
875
|
+
}) => ReactNode;
|
|
876
|
+
inputViewerRender?: (props: {
|
|
877
|
+
column: string;
|
|
878
|
+
schema: CustomJSONSchema7;
|
|
879
|
+
prefix: string;
|
|
880
|
+
formContext: UseFormReturn;
|
|
881
|
+
}) => ReactNode;
|
|
882
|
+
dateFormat?: string;
|
|
883
|
+
displayDateFormat?: string;
|
|
884
|
+
timeFormat?: string;
|
|
885
|
+
displayTimeFormat?: string;
|
|
886
|
+
showLabel?: boolean;
|
|
887
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
888
|
+
numberStorageType?: 'string' | 'number';
|
|
889
|
+
errorMessages?: Partial<Record<ValidationErrorType | string, string>>;
|
|
890
|
+
filePicker?: FilePickerProps;
|
|
891
|
+
}
|
|
892
|
+
interface TagPickerProps {
|
|
893
|
+
column: string;
|
|
894
|
+
schema: CustomJSONSchema7;
|
|
895
|
+
prefix: string;
|
|
896
|
+
}
|
|
897
|
+
interface FilePickerMediaFile {
|
|
898
|
+
id: string;
|
|
899
|
+
name: string;
|
|
900
|
+
url?: string;
|
|
901
|
+
size?: string | number;
|
|
902
|
+
comment?: string;
|
|
903
|
+
type?: string;
|
|
904
|
+
}
|
|
905
|
+
interface FilePickerProps {
|
|
906
|
+
onFetchFiles?: (search: string) => Promise<FilePickerMediaFile[]>;
|
|
907
|
+
enableMediaLibrary?: boolean;
|
|
908
|
+
filterImageOnly?: boolean;
|
|
909
|
+
}
|
|
452
910
|
|
|
453
911
|
interface FormRootProps<TData extends FieldValues> {
|
|
454
|
-
schema:
|
|
912
|
+
schema: CustomJSONSchema7;
|
|
455
913
|
serverUrl: string;
|
|
456
914
|
requestUrl?: string;
|
|
457
915
|
idMap: Record<string, object>;
|
|
@@ -466,6 +924,18 @@ interface FormRootProps<TData extends FieldValues> {
|
|
|
466
924
|
rowNumber?: number | string;
|
|
467
925
|
requestOptions?: AxiosRequestConfig;
|
|
468
926
|
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
927
|
+
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
928
|
+
customSuccessRenderer?: (resetHandler: () => void | Promise<void>) => ReactNode;
|
|
929
|
+
displayConfig?: {
|
|
930
|
+
showSubmitButton?: boolean;
|
|
931
|
+
showResetButton?: boolean;
|
|
932
|
+
showTitle?: boolean;
|
|
933
|
+
};
|
|
934
|
+
requireConfirmation?: boolean;
|
|
935
|
+
dateTimePickerLabels?: DateTimePickerLabels;
|
|
936
|
+
idPickerLabels?: IdPickerLabels;
|
|
937
|
+
enumPickerLabels?: EnumPickerLabels;
|
|
938
|
+
filePickerLabels?: FilePickerLabels;
|
|
469
939
|
}
|
|
470
940
|
interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
471
941
|
variant: string;
|
|
@@ -474,7 +944,7 @@ interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
|
474
944
|
display_column: string;
|
|
475
945
|
gridColumn: string;
|
|
476
946
|
gridRow: string;
|
|
477
|
-
foreign_key: ForeignKeyProps;
|
|
947
|
+
foreign_key: ForeignKeyProps$1;
|
|
478
948
|
children: ReactNode;
|
|
479
949
|
}
|
|
480
950
|
declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
@@ -482,26 +952,29 @@ declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
|
482
952
|
column?: string | undefined;
|
|
483
953
|
display_column?: string | undefined;
|
|
484
954
|
} | undefined) => void;
|
|
485
|
-
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
955
|
+
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, customSuccessRenderer, displayConfig, requireConfirmation, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
486
956
|
|
|
487
957
|
interface DefaultFormProps<TData extends FieldValues> {
|
|
488
958
|
formConfig: Omit<FormRootProps<TData>, "children">;
|
|
959
|
+
showTitle?: boolean;
|
|
489
960
|
}
|
|
490
961
|
declare const DefaultForm: <TData extends FieldValues>({ formConfig, }: DefaultFormProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
491
962
|
|
|
492
963
|
declare const FormTitle: () => react_jsx_runtime.JSX.Element;
|
|
493
964
|
|
|
494
|
-
declare const FormBody: <TData extends object>() => react_jsx_runtime.JSX.Element;
|
|
965
|
+
declare const FormBody: <TData extends object>() => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
495
966
|
|
|
496
967
|
interface UseFormProps {
|
|
497
968
|
preLoadedValues?: FieldValues | undefined;
|
|
498
969
|
keyPrefix?: string;
|
|
970
|
+
namespace?: string;
|
|
971
|
+
schema?: JSONSchema7;
|
|
499
972
|
}
|
|
500
|
-
declare const useForm: ({ preLoadedValues, keyPrefix }: UseFormProps) => {
|
|
973
|
+
declare const useForm: ({ preLoadedValues, keyPrefix, namespace, schema, }: UseFormProps) => {
|
|
501
974
|
form: react_hook_form.UseFormReturn<FieldValues, any, undefined>;
|
|
502
975
|
idMap: Record<string, object>;
|
|
503
|
-
setIdMap:
|
|
504
|
-
translate: react_i18next.UseTranslationResponse<
|
|
976
|
+
setIdMap: react.Dispatch<react.SetStateAction<Record<string, object>>>;
|
|
977
|
+
translate: react_i18next.UseTranslationResponse<string, string>;
|
|
505
978
|
};
|
|
506
979
|
|
|
507
980
|
interface CalendarProps extends RenderProps {
|
|
@@ -518,6 +991,29 @@ interface GetVariantProps {
|
|
|
518
991
|
selectable: boolean;
|
|
519
992
|
}
|
|
520
993
|
interface DatePickerProps extends Props {
|
|
994
|
+
onDateSelected?: (obj: {
|
|
995
|
+
date: Date;
|
|
996
|
+
}) => void;
|
|
997
|
+
selected: Date | Date[];
|
|
998
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
999
|
+
showOutsideDays?: boolean;
|
|
1000
|
+
date?: Date;
|
|
1001
|
+
minDate?: Date;
|
|
1002
|
+
maxDate?: Date;
|
|
1003
|
+
monthsToDisplay?: number;
|
|
1004
|
+
labels?: {
|
|
1005
|
+
monthNamesShort: string[];
|
|
1006
|
+
weekdayNamesShort: string[];
|
|
1007
|
+
backButtonLabel?: string;
|
|
1008
|
+
forwardButtonLabel?: string;
|
|
1009
|
+
};
|
|
1010
|
+
render?: (dayzedData: any) => react__default.ReactNode;
|
|
1011
|
+
}
|
|
1012
|
+
interface DatePickerLabels {
|
|
1013
|
+
monthNamesShort: string[];
|
|
1014
|
+
weekdayNamesShort: string[];
|
|
1015
|
+
backButtonLabel?: string;
|
|
1016
|
+
forwardButtonLabel?: string;
|
|
521
1017
|
}
|
|
522
1018
|
|
|
523
1019
|
interface GetMultiDatesProps {
|
|
@@ -568,6 +1064,17 @@ declare module "@tanstack/react-table" {
|
|
|
568
1064
|
* The display name of the column, used for rendering headers.
|
|
569
1065
|
*/
|
|
570
1066
|
displayName?: string;
|
|
1067
|
+
/**
|
|
1068
|
+
* Text configuration for the column header menu items.
|
|
1069
|
+
* These strings can be customized per column.
|
|
1070
|
+
*/
|
|
1071
|
+
headerTexts?: {
|
|
1072
|
+
pinColumn?: string;
|
|
1073
|
+
cancelPin?: string;
|
|
1074
|
+
sortAscending?: string;
|
|
1075
|
+
sortDescending?: string;
|
|
1076
|
+
clearSorting?: string;
|
|
1077
|
+
};
|
|
571
1078
|
/**
|
|
572
1079
|
* Specifies the type of filter to be used for the column.
|
|
573
1080
|
*
|
|
@@ -588,7 +1095,10 @@ declare module "@tanstack/react-table" {
|
|
|
588
1095
|
/**
|
|
589
1096
|
* Options for the select filter variant, if applicable.
|
|
590
1097
|
*/
|
|
591
|
-
filterOptions?:
|
|
1098
|
+
filterOptions?: {
|
|
1099
|
+
label: string;
|
|
1100
|
+
value: string;
|
|
1101
|
+
}[];
|
|
592
1102
|
/**
|
|
593
1103
|
* Configuration for the range filter variant, if applicable.
|
|
594
1104
|
*
|
|
@@ -614,4 +1124,4 @@ declare module "@tanstack/react-table" {
|
|
|
614
1124
|
}
|
|
615
1125
|
}
|
|
616
1126
|
|
|
617
|
-
export { type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, type DatePickerProps, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, ErrorAlert, type ErrorAlertProps,
|
|
1127
|
+
export { type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, type DatePickerLabels, type DatePickerProps, type DateTimePickerLabels, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DefaultTableServer, type DefaultTableServerProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, type EnumPickerLabels, ErrorAlert, type ErrorAlertProps, type ErrorMessageConfig, type ErrorMessageResult, type FieldErrorConfig, type FilePickerLabels, type FilePickerMediaFile, type FilePickerProps, FilterDialog, FormBody, FormRoot, type FormRootProps, FormTitle, type GetColumnsConfigs, type GetDateColorProps, type GetMultiDatesProps, type GetRangeDatesProps, type GetStyleProps, type GetVariantProps, GlobalFilter, type IdPickerLabels, PageSizeControl, type PageSizeControlProps, Pagination, type QueryParams, type RangeCalendarProps, type RangeDatePickerProps, RecordDisplay, type RecordDisplayProps, ReloadButton, type ReloadButtonProps, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, type Result, RowCountText, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableDataDisplay, type TableDataDisplayProps, TableFilter, TableFilterTags, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, type TableHeaderTexts, TableLoadingComponent, type TableLoadingComponentProps, type TableProps, type TableRendererProps, type TableRowSelectorProps, TableSelector, TableSorter, TableViewer, type TagPickerProps, TextCell, type TextCellProps, type UseDataTableProps, type UseDataTableReturn, type UseDataTableServerProps, type UseDataTableServerReturn, type UseFormProps, type ValidationErrorType, ViewDialog, buildErrorMessages, buildFieldErrors, buildRequiredErrors, convertToAjvErrorsFormat, createErrorMessage, getColumns, getMultiDates, getRangeDates, idPickerSanityCheck, useDataTable, useDataTableContext, useDataTableServer, useForm, widthSanityCheck };
|