@bsol-oss/react-datatable5 12.0.0-beta.9 → 12.0.0-beta.90
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 +225 -5
- package/dist/index.d.ts +871 -258
- package/dist/index.js +4116 -1238
- package/dist/index.mjs +4203 -1332
- 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/DensityFeature.d.ts +3 -3
- 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/SelectAllRowsToggle.d.ts +1 -1
- package/dist/types/components/DataTable/controls/TableControls.d.ts +10 -2
- package/dist/types/components/DataTable/display/DataDisplay.d.ts +2 -2
- package/dist/types/components/DataTable/display/Table.d.ts +4 -3
- package/dist/types/components/DataTable/display/TableBody.d.ts +2 -3
- 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/TableCards.d.ts +3 -3
- package/dist/types/components/DataTable/display/TableDataDisplay.d.ts +3 -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/hooks/useResponsiveColumnVisibility.d.ts +13 -0
- package/dist/types/components/DataTable/useDataTableServer.d.ts +55 -3
- package/dist/types/components/DataTable/utils/selectors.d.ts +53 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +23 -0
- package/dist/types/components/DatePicker/DateTimePicker.d.ts +12 -0
- package/dist/types/components/DatePicker/DurationPicker.d.ts +12 -0
- package/dist/types/components/DatePicker/IsoTimePicker.d.ts +19 -0
- package/dist/types/components/DatePicker/PickerDemo.d.ts +1 -0
- package/dist/types/components/DatePicker/RangeDatePicker.d.ts +61 -5
- 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 +6 -2
- package/dist/types/components/Form/SchemaFormContext.d.ts +23 -6
- package/dist/types/components/Form/components/FileDropzone.d.ts +2 -2
- package/dist/types/components/Form/components/MediaLibraryBrowser.d.ts +22 -0
- 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 +22 -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 +18 -5
- package/dist/types/components/Form/components/fields/FormMediaLibraryBrowser.d.ts +2 -0
- 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 +23 -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 +83 -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/SchemaViewer.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 +23 -0
- package/dist/types/components/ui/field.d.ts +3 -3
- package/dist/types/index.d.ts +81 -55
- package/package.json +24 -13
- 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/types/components/ui/popover.d.ts +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,72 @@
|
|
|
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$1 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
|
-
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
|
+
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;
|
|
@@ -41,20 +92,11 @@ declare const PageSizeControl: ({ pageSizes, }: PageSizeControlProps) => react_j
|
|
|
41
92
|
|
|
42
93
|
declare const Pagination: () => react_jsx_runtime.JSX.Element;
|
|
43
94
|
|
|
44
|
-
|
|
45
|
-
text?: string;
|
|
46
|
-
}
|
|
47
|
-
declare const ResetFilteringButton: ({ text, }: ResetFilteringButtonProps) => react_jsx_runtime.JSX.Element;
|
|
95
|
+
declare const ResetFilteringButton: () => react_jsx_runtime.JSX.Element;
|
|
48
96
|
|
|
49
|
-
|
|
50
|
-
text?: string;
|
|
51
|
-
}
|
|
52
|
-
declare const ResetSelectionButton: ({ text, }: ResetSelectionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
97
|
+
declare const ResetSelectionButton: () => react_jsx_runtime.JSX.Element;
|
|
53
98
|
|
|
54
|
-
|
|
55
|
-
text?: string;
|
|
56
|
-
}
|
|
57
|
-
declare const ResetSortingButton: ({ text, }: ResetSortingButtonProps) => react_jsx_runtime.JSX.Element;
|
|
99
|
+
declare const ResetSortingButton: () => react_jsx_runtime.JSX.Element;
|
|
58
100
|
|
|
59
101
|
declare const RowCountText: () => react_jsx_runtime.JSX.Element;
|
|
60
102
|
|
|
@@ -63,6 +105,132 @@ interface EditViewButtonProps {
|
|
|
63
105
|
}
|
|
64
106
|
declare const ViewDialog: ({ icon }: EditViewButtonProps) => react_jsx_runtime.JSX.Element;
|
|
65
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
|
+
interface SelectAllRowsToggleProps {
|
|
118
|
+
selectAllIcon?: React__default.ReactElement;
|
|
119
|
+
clearAllIcon?: React__default.ReactElement;
|
|
120
|
+
selectAllText?: string;
|
|
121
|
+
clearAllText?: string;
|
|
122
|
+
}
|
|
123
|
+
declare const SelectAllRowsToggle: ({ selectAllIcon, clearAllIcon, selectAllText, clearAllText, }: SelectAllRowsToggleProps) => react_jsx_runtime.JSX.Element;
|
|
124
|
+
|
|
125
|
+
declare const TableSorter: () => react_jsx_runtime.JSX.Element;
|
|
126
|
+
|
|
127
|
+
declare const TableViewer: () => react_jsx_runtime.JSX.Element;
|
|
128
|
+
|
|
129
|
+
interface TableControlsProps {
|
|
130
|
+
totalText?: string;
|
|
131
|
+
fitTableWidth?: boolean;
|
|
132
|
+
fitTableHeight?: boolean;
|
|
133
|
+
children?: ReactNode;
|
|
134
|
+
showGlobalFilter?: boolean;
|
|
135
|
+
showFilter?: boolean;
|
|
136
|
+
showFilterName?: boolean;
|
|
137
|
+
showFilterTags?: boolean;
|
|
138
|
+
showReload?: boolean;
|
|
139
|
+
showPagination?: boolean;
|
|
140
|
+
showPageSizeControl?: boolean;
|
|
141
|
+
showPageCountText?: boolean;
|
|
142
|
+
showView?: boolean;
|
|
143
|
+
filterTagsOptions?: {
|
|
144
|
+
column: string;
|
|
145
|
+
options: {
|
|
146
|
+
label: string;
|
|
147
|
+
value: string;
|
|
148
|
+
}[];
|
|
149
|
+
}[];
|
|
150
|
+
extraItems?: ReactNode;
|
|
151
|
+
loading?: boolean;
|
|
152
|
+
hasError?: boolean;
|
|
153
|
+
gridProps?: GridProps;
|
|
154
|
+
}
|
|
155
|
+
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;
|
|
156
|
+
|
|
157
|
+
declare const TableFilter: () => react_jsx_runtime.JSX.Element;
|
|
158
|
+
|
|
159
|
+
declare const TableFilterTags: () => react_jsx_runtime.JSX.Element;
|
|
160
|
+
|
|
161
|
+
interface TableProps extends TableRootProps {
|
|
162
|
+
showLoading?: boolean;
|
|
163
|
+
loadingComponent?: ReactNode;
|
|
164
|
+
emptyComponent?: ReactNode;
|
|
165
|
+
canResize?: boolean;
|
|
166
|
+
showSelector?: boolean;
|
|
167
|
+
children: ReactNode;
|
|
168
|
+
}
|
|
169
|
+
declare const Table: ({ children, emptyComponent, canResize, showLoading, showSelector, ...props }: TableProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
|
|
170
|
+
|
|
171
|
+
interface TableBodyProps {
|
|
172
|
+
pinnedBgColor?: {
|
|
173
|
+
light: string;
|
|
174
|
+
dark: string;
|
|
175
|
+
};
|
|
176
|
+
showSelector?: boolean;
|
|
177
|
+
alwaysShowSelector?: boolean;
|
|
178
|
+
canResize?: boolean;
|
|
179
|
+
}
|
|
180
|
+
interface TableRowSelectorProps<TData> {
|
|
181
|
+
index: number;
|
|
182
|
+
row: Row<TData>;
|
|
183
|
+
hoveredRow: number;
|
|
184
|
+
pinnedBgColor?: {
|
|
185
|
+
light: string;
|
|
186
|
+
dark: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
declare const TableBody: ({ showSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
190
|
+
|
|
191
|
+
interface TableCardContainerProps extends BoxProps {
|
|
192
|
+
children: ReactNode;
|
|
193
|
+
variant?: "carousel" | "";
|
|
194
|
+
gap?: string;
|
|
195
|
+
gridTemplateColumns?: string;
|
|
196
|
+
direction?: FlexProps["direction"];
|
|
197
|
+
}
|
|
198
|
+
declare const TableCardContainer: ({ children, variant, gap, gridTemplateColumns, direction, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
interface TableCardsProps<TData> {
|
|
201
|
+
isSelectable?: boolean;
|
|
202
|
+
showDisplayNameOnly?: boolean;
|
|
203
|
+
renderTitle?: (row: Row<TData>) => ReactNode | undefined;
|
|
204
|
+
cardBodyProps?: CardBodyProps;
|
|
205
|
+
}
|
|
206
|
+
declare const DefaultCardTitle: () => react_jsx_runtime.JSX.Element;
|
|
207
|
+
declare const TableCards: <TData>({ isSelectable, showDisplayNameOnly, renderTitle, cardBodyProps, }: TableCardsProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
208
|
+
|
|
209
|
+
interface TableRendererProps<TData> {
|
|
210
|
+
render: (render: Table$1<TData>) => React__default.ReactElement;
|
|
211
|
+
}
|
|
212
|
+
declare const TableComponent: <TData>({ render, }: TableRendererProps<TData>) => React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>>;
|
|
213
|
+
|
|
214
|
+
interface TableFooterProps {
|
|
215
|
+
showSelector?: boolean;
|
|
216
|
+
alwaysShowSelector?: boolean;
|
|
217
|
+
}
|
|
218
|
+
declare const TableFooter: ({ showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
219
|
+
|
|
220
|
+
interface TableLoadingComponentProps {
|
|
221
|
+
render: (loading: boolean) => ReactNode;
|
|
222
|
+
}
|
|
223
|
+
declare const TableLoadingComponent: ({ render, }: TableLoadingComponentProps) => react_jsx_runtime.JSX.Element;
|
|
224
|
+
|
|
225
|
+
interface TextCellProps {
|
|
226
|
+
label?: string;
|
|
227
|
+
noOfLines?: number[];
|
|
228
|
+
children: string | number | ReactNode | ReactNode[];
|
|
229
|
+
containerProps?: FlexProps;
|
|
230
|
+
textProps?: TextProps;
|
|
231
|
+
}
|
|
232
|
+
declare const TextCell: ({ label, containerProps, textProps, children, }: TextCellProps) => react_jsx_runtime.JSX.Element;
|
|
233
|
+
|
|
66
234
|
interface CardHeaderProps<TData> {
|
|
67
235
|
row: Row<TData>;
|
|
68
236
|
imageColumnId?: keyof TData;
|
|
@@ -85,7 +253,7 @@ interface ErrorAlertProps {
|
|
|
85
253
|
}
|
|
86
254
|
declare const ErrorAlert: ({ showMessage }: ErrorAlertProps) => react_jsx_runtime.JSX.Element;
|
|
87
255
|
|
|
88
|
-
type DensityState =
|
|
256
|
+
type DensityState = 'xs' | 'sm' | 'md' | 'lg';
|
|
89
257
|
interface DensityTableState {
|
|
90
258
|
density: DensityState;
|
|
91
259
|
}
|
|
@@ -98,7 +266,7 @@ interface DensityInstance {
|
|
|
98
266
|
toggleDensity: (value?: DensityState) => void;
|
|
99
267
|
getDensityValue: (value?: DensityState) => number;
|
|
100
268
|
}
|
|
101
|
-
declare module
|
|
269
|
+
declare module '@tanstack/react-table' {
|
|
102
270
|
interface TableState extends DensityTableState {
|
|
103
271
|
}
|
|
104
272
|
interface TableOptionsResolved<TData extends RowData> extends DensityOptions {
|
|
@@ -107,82 +275,6 @@ declare module "@tanstack/react-table" {
|
|
|
107
275
|
}
|
|
108
276
|
}
|
|
109
277
|
|
|
110
|
-
declare module "@tanstack/react-table" {
|
|
111
|
-
interface FilterFns {
|
|
112
|
-
fuzzy: FilterFn<unknown>;
|
|
113
|
-
}
|
|
114
|
-
interface FilterMeta {
|
|
115
|
-
itemRank: RankingInfo;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
interface DataTableProps<TData = unknown> {
|
|
119
|
-
children?: ReactNode | ReactNode[];
|
|
120
|
-
/**
|
|
121
|
-
* Data array for the table.
|
|
122
|
-
*
|
|
123
|
-
* It will pass into as the data in `@tanstack/react-table`
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
data: TData[];
|
|
127
|
-
/**
|
|
128
|
-
* Column definitions for the table.
|
|
129
|
-
*
|
|
130
|
-
* It will pass into as the column definitions in `@tanstack/react-table`
|
|
131
|
-
*
|
|
132
|
-
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
133
|
-
*/
|
|
134
|
-
columns: ColumnDef<TData, unknown>[];
|
|
135
|
-
enableRowSelection?: boolean;
|
|
136
|
-
enableMultiRowSelection?: boolean;
|
|
137
|
-
enableSubRowSelection?: boolean;
|
|
138
|
-
onRowSelect?: (rowSelectionState: RowSelectionState, data: TData[]) => void;
|
|
139
|
-
columnOrder: ColumnOrderState;
|
|
140
|
-
columnFilters: ColumnFiltersState;
|
|
141
|
-
globalFilter: string;
|
|
142
|
-
density: DensityState;
|
|
143
|
-
pagination: PaginationState;
|
|
144
|
-
sorting: SortingState;
|
|
145
|
-
rowSelection: RowSelectionState;
|
|
146
|
-
columnVisibility: VisibilityState;
|
|
147
|
-
setPagination: OnChangeFn<PaginationState>;
|
|
148
|
-
setSorting: OnChangeFn<SortingState>;
|
|
149
|
-
setColumnFilters: OnChangeFn<ColumnFiltersState>;
|
|
150
|
-
setRowSelection: OnChangeFn<RowSelectionState>;
|
|
151
|
-
setGlobalFilter: OnChangeFn<string>;
|
|
152
|
-
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
153
|
-
setDensity: OnChangeFn<DensityState>;
|
|
154
|
-
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
155
|
-
translate: UseTranslationResponse<any, any>;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* DataTable will create a context to hold all values to
|
|
159
|
-
* help the render of the DataTable in serverside
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* The query is required to be a GET request that can receive
|
|
163
|
-
* specified params and return a specified response
|
|
164
|
-
*
|
|
165
|
-
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
166
|
-
*/
|
|
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;
|
|
168
|
-
|
|
169
|
-
interface DataTableContext<TData = unknown> extends DataTableProps {
|
|
170
|
-
table: Table$1<TData>;
|
|
171
|
-
globalFilter: string;
|
|
172
|
-
setGlobalFilter: OnChangeFn<string>;
|
|
173
|
-
type: "client" | "server";
|
|
174
|
-
translate: UseTranslationResponse<any, any>;
|
|
175
|
-
}
|
|
176
|
-
declare const DataTableContext: React$1.Context<DataTableContext<unknown>>;
|
|
177
|
-
|
|
178
|
-
declare const useDataTableContext: <TData>() => DataTableContext<TData>;
|
|
179
|
-
|
|
180
|
-
interface DataDisplayProps {
|
|
181
|
-
variant?: "horizontal" | "stats" | "";
|
|
182
|
-
translate?: UseTranslationResponse<any, any>;
|
|
183
|
-
}
|
|
184
|
-
declare const DataDisplay: ({ variant }: DataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
185
|
-
|
|
186
278
|
interface DataTableDefaultState {
|
|
187
279
|
sorting?: SortingState;
|
|
188
280
|
columnFilters?: ColumnFiltersState;
|
|
@@ -218,7 +310,7 @@ interface UseDataTableReturn {
|
|
|
218
310
|
}
|
|
219
311
|
declare const useDataTable: ({ default: { sorting: defaultSorting, pagination: defaultPagination, rowSelection: defaultRowSelection, columnFilters: defaultColumnFilters, columnOrder: defaultColumnOrder, columnVisibility: defaultColumnVisibility, globalFilter: defaultGlobalFilter, density: defaultDensity, }, keyPrefix, }?: UseDataTableProps) => UseDataTableReturn;
|
|
220
312
|
|
|
221
|
-
interface UseDataTableServerProps extends UseDataTableProps {
|
|
313
|
+
interface UseDataTableServerProps<TData> extends UseDataTableProps {
|
|
222
314
|
/**
|
|
223
315
|
* Delay to send the request if the `refreshData` called multiple times
|
|
224
316
|
*
|
|
@@ -231,7 +323,51 @@ interface UseDataTableServerProps extends UseDataTableProps {
|
|
|
231
323
|
* default: `1000`
|
|
232
324
|
*/
|
|
233
325
|
debounceDelay?: number;
|
|
234
|
-
|
|
326
|
+
/**
|
|
327
|
+
* The url to fetch the data from.
|
|
328
|
+
*
|
|
329
|
+
* Remark:
|
|
330
|
+
* it is the server responsibility to handle the params and return the data.
|
|
331
|
+
* especially the pagination and sorting.
|
|
332
|
+
*
|
|
333
|
+
* The response must be like this:
|
|
334
|
+
* ```ts
|
|
335
|
+
* {
|
|
336
|
+
* data: TData[],
|
|
337
|
+
* count: number,
|
|
338
|
+
* }
|
|
339
|
+
* ```
|
|
340
|
+
*
|
|
341
|
+
* Example:
|
|
342
|
+
* ```ts
|
|
343
|
+
* const url = "https://jsonplaceholder.typicode.com/posts";
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* If not provided, the `queryFn` will be used.
|
|
347
|
+
*
|
|
348
|
+
* @default undefined
|
|
349
|
+
*/
|
|
350
|
+
url?: string;
|
|
351
|
+
placeholderData?: DataResponse<TData>;
|
|
352
|
+
/**
|
|
353
|
+
* The query function to fetch the data from.
|
|
354
|
+
*
|
|
355
|
+
* Remark:
|
|
356
|
+
* it is the server responsibility to handle the params and return the data.
|
|
357
|
+
* especially the pagination and sorting.
|
|
358
|
+
*
|
|
359
|
+
* Example:
|
|
360
|
+
* ```ts
|
|
361
|
+
* const queryFn = (params: QueryParams) => {
|
|
362
|
+
* return axios.get<DataResponse<TData>>(url, { params });
|
|
363
|
+
* };
|
|
364
|
+
* ```
|
|
365
|
+
*
|
|
366
|
+
* If not provided, the `url` will be used.
|
|
367
|
+
*
|
|
368
|
+
* @default undefined
|
|
369
|
+
*/
|
|
370
|
+
queryFn?: (params: QueryParams) => Promise<DataResponse<TData>>;
|
|
235
371
|
}
|
|
236
372
|
interface UseDataTableServerReturn<TData> extends UseDataTableReturn {
|
|
237
373
|
query: UseQueryResult<DataResponse<TData>, Error>;
|
|
@@ -242,10 +378,35 @@ interface Result<T = unknown> {
|
|
|
242
378
|
interface DataResponse<T = unknown> extends Result<T> {
|
|
243
379
|
count: number;
|
|
244
380
|
}
|
|
245
|
-
|
|
381
|
+
interface QueryParams {
|
|
382
|
+
offset: number;
|
|
383
|
+
limit: number;
|
|
384
|
+
sorting: SortingState;
|
|
385
|
+
where: ColumnFiltersState;
|
|
386
|
+
searching: string;
|
|
387
|
+
}
|
|
388
|
+
declare const useDataTableServer: <TData>(props: UseDataTableServerProps<TData>) => UseDataTableServerReturn<TData>;
|
|
246
389
|
|
|
247
|
-
|
|
248
|
-
|
|
390
|
+
declare module '@tanstack/react-table' {
|
|
391
|
+
interface FilterFns {
|
|
392
|
+
fuzzy: FilterFn<unknown>;
|
|
393
|
+
}
|
|
394
|
+
interface FilterMeta {
|
|
395
|
+
itemRank: RankingInfo;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
interface DataTableProps<TData = unknown> {
|
|
399
|
+
children?: ReactNode | ReactNode[];
|
|
400
|
+
/**
|
|
401
|
+
* Data array for the table.
|
|
402
|
+
*
|
|
403
|
+
* It will pass into as the data in `@tanstack/react-table`
|
|
404
|
+
* Do not toggle the data array, it will cause the table to re-render in infinite loop.
|
|
405
|
+
*
|
|
406
|
+
* @default []
|
|
407
|
+
*
|
|
408
|
+
*/
|
|
409
|
+
data: TData[];
|
|
249
410
|
/**
|
|
250
411
|
* Column definitions for the table.
|
|
251
412
|
*
|
|
@@ -253,10 +414,11 @@ interface DataTableServerProps<TData extends DataResponse = DataResponse<unknown
|
|
|
253
414
|
*
|
|
254
415
|
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
255
416
|
*/
|
|
256
|
-
columns: ColumnDef<TData>[];
|
|
417
|
+
columns: ColumnDef<TData, unknown>[];
|
|
257
418
|
enableRowSelection?: boolean;
|
|
258
419
|
enableMultiRowSelection?: boolean;
|
|
259
420
|
enableSubRowSelection?: boolean;
|
|
421
|
+
onRowSelect?: (rowSelectionState: RowSelectionState, data: TData[]) => void;
|
|
260
422
|
columnOrder: ColumnOrderState;
|
|
261
423
|
columnFilters: ColumnFiltersState;
|
|
262
424
|
globalFilter: string;
|
|
@@ -273,159 +435,48 @@ interface DataTableServerProps<TData extends DataResponse = DataResponse<unknown
|
|
|
273
435
|
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
274
436
|
setDensity: OnChangeFn<DensityState>;
|
|
275
437
|
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
276
|
-
query: UseQueryResult<TData>;
|
|
277
|
-
url: string;
|
|
278
438
|
translate: UseTranslationResponse<any, any>;
|
|
439
|
+
tableLabel?: DataTableLabel;
|
|
279
440
|
}
|
|
280
441
|
/**
|
|
281
|
-
*
|
|
442
|
+
* DataTable will create a context to hold all values to
|
|
282
443
|
* help the render of the DataTable in serverside
|
|
283
444
|
*
|
|
445
|
+
*
|
|
284
446
|
* The query is required to be a GET request that can receive
|
|
285
447
|
* specified params and return a specified response
|
|
286
448
|
*
|
|
287
|
-
* The `useDataTableServer` can help to create the specified request and response
|
|
288
|
-
*
|
|
289
449
|
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
290
450
|
*/
|
|
291
|
-
declare function
|
|
451
|
+
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;
|
|
292
452
|
|
|
293
|
-
interface
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
453
|
+
interface DataTableLabel {
|
|
454
|
+
view: string;
|
|
455
|
+
edit: string;
|
|
456
|
+
filterButtonText: string;
|
|
457
|
+
filterTitle: string;
|
|
458
|
+
filterReset: string;
|
|
459
|
+
filterClose: string;
|
|
460
|
+
reloadTooltip: string;
|
|
461
|
+
reloadButtonText: string;
|
|
462
|
+
resetSelection: string;
|
|
463
|
+
resetSorting: string;
|
|
464
|
+
rowCountText: string;
|
|
465
|
+
hasErrorText: string;
|
|
466
|
+
globalFilterPlaceholder: string;
|
|
467
|
+
trueLabel: string;
|
|
468
|
+
falseLabel: string;
|
|
301
469
|
}
|
|
302
|
-
interface
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
310
|
-
alwaysShowSelector?: boolean;
|
|
470
|
+
interface DataTableContextProps<TData = unknown> extends DataTableProps {
|
|
471
|
+
table: Table$1<TData>;
|
|
472
|
+
globalFilter: string;
|
|
473
|
+
setGlobalFilter: OnChangeFn<string>;
|
|
474
|
+
type: "client" | "server";
|
|
475
|
+
translate: UseTranslationResponse<any, unknown>;
|
|
476
|
+
tableLabel: DataTableLabel;
|
|
311
477
|
}
|
|
312
|
-
declare const TableBody: ({ pinnedBgColor, showSelector, alwaysShowSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
313
478
|
|
|
314
|
-
|
|
315
|
-
totalText?: string;
|
|
316
|
-
fitTableWidth?: boolean;
|
|
317
|
-
fitTableHeight?: boolean;
|
|
318
|
-
children?: ReactNode;
|
|
319
|
-
showGlobalFilter?: boolean;
|
|
320
|
-
showFilter?: boolean;
|
|
321
|
-
showFilterName?: boolean;
|
|
322
|
-
showFilterTags?: boolean;
|
|
323
|
-
showReload?: boolean;
|
|
324
|
-
showPagination?: boolean;
|
|
325
|
-
showPageSizeControl?: boolean;
|
|
326
|
-
showPageCountText?: boolean;
|
|
327
|
-
showView?: boolean;
|
|
328
|
-
filterOptions?: string[];
|
|
329
|
-
extraItems?: ReactNode;
|
|
330
|
-
loading?: boolean;
|
|
331
|
-
hasError?: boolean;
|
|
332
|
-
}
|
|
333
|
-
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterOptions, extraItems, loading, hasError, }: TableControlsProps) => react_jsx_runtime.JSX.Element;
|
|
334
|
-
|
|
335
|
-
interface TableFooterProps {
|
|
336
|
-
pinnedBgColor?: {
|
|
337
|
-
light: string;
|
|
338
|
-
dark: string;
|
|
339
|
-
};
|
|
340
|
-
showSelector?: boolean;
|
|
341
|
-
alwaysShowSelector?: boolean;
|
|
342
|
-
}
|
|
343
|
-
declare const TableFooter: ({ pinnedBgColor, showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
344
|
-
|
|
345
|
-
interface TableHeaderProps {
|
|
346
|
-
canResize?: boolean;
|
|
347
|
-
pinnedBgColor?: {
|
|
348
|
-
light: string;
|
|
349
|
-
dark: string;
|
|
350
|
-
};
|
|
351
|
-
showSelector?: boolean;
|
|
352
|
-
isSticky?: boolean;
|
|
353
|
-
alwaysShowSelector?: boolean;
|
|
354
|
-
tHeadProps?: TableHeaderProps$1;
|
|
355
|
-
}
|
|
356
|
-
declare const TableHeader: ({ canResize, pinnedBgColor, showSelector, isSticky, alwaysShowSelector, tHeadProps, }: TableHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
357
|
-
|
|
358
|
-
interface TableProps extends TableRootProps {
|
|
359
|
-
showLoading?: boolean;
|
|
360
|
-
loadingComponent?: ReactNode;
|
|
361
|
-
emptyComponent?: ReactNode;
|
|
362
|
-
canResize?: boolean;
|
|
363
|
-
children: ReactNode;
|
|
364
|
-
}
|
|
365
|
-
declare const Table: ({ children, emptyComponent, canResize, ...props }: TableProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
|
|
366
|
-
|
|
367
|
-
interface DefaultTableProps {
|
|
368
|
-
showFooter?: boolean;
|
|
369
|
-
showSelector?: boolean;
|
|
370
|
-
tableProps?: Omit<TableProps, "children">;
|
|
371
|
-
tHeadProps?: TableHeaderProps$1;
|
|
372
|
-
controlProps?: TableControlsProps;
|
|
373
|
-
tableFooterProps?: TableFooterProps;
|
|
374
|
-
tableBodyProps?: TableBodyProps;
|
|
375
|
-
tableHeaderProps?: TableHeaderProps;
|
|
376
|
-
variant?: "" | "greedy";
|
|
377
|
-
}
|
|
378
|
-
declare const DefaultTable: ({ showFooter, tableProps, tableHeaderProps, tableBodyProps, controlProps, tableFooterProps, variant, }: DefaultTableProps) => react_jsx_runtime.JSX.Element;
|
|
379
|
-
|
|
380
|
-
interface ReloadButtonProps {
|
|
381
|
-
text?: string;
|
|
382
|
-
variant?: string;
|
|
383
|
-
}
|
|
384
|
-
declare const ReloadButton: ({ text, variant, }: ReloadButtonProps) => react_jsx_runtime.JSX.Element;
|
|
385
|
-
|
|
386
|
-
interface TableCardContainerProps extends GridProps {
|
|
387
|
-
children: ReactNode;
|
|
388
|
-
variant?: "carousel" | "";
|
|
389
|
-
}
|
|
390
|
-
declare const TableCardContainer: ({ children, variant, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
391
|
-
|
|
392
|
-
interface TableCardsProps<TData> {
|
|
393
|
-
isSelectable?: boolean;
|
|
394
|
-
showDisplayNameOnly?: boolean;
|
|
395
|
-
renderTitle?: (row: Row<TData>) => ReactNode | undefined;
|
|
396
|
-
cardBodyProps?: CardBodyProps;
|
|
397
|
-
}
|
|
398
|
-
declare const DefaultCardTitle: () => react_jsx_runtime.JSX.Element;
|
|
399
|
-
declare const TableCards: <TData>({ isSelectable, showDisplayNameOnly, renderTitle, cardBodyProps, }: TableCardsProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
400
|
-
|
|
401
|
-
interface TableRendererProps<TData> {
|
|
402
|
-
render: (render: Table$1<TData>) => React__default.ReactElement;
|
|
403
|
-
}
|
|
404
|
-
declare const TableComponent: <TData>({ render, }: TableRendererProps<TData>) => React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>>;
|
|
405
|
-
|
|
406
|
-
declare const TableFilter: () => react_jsx_runtime.JSX.Element;
|
|
407
|
-
|
|
408
|
-
declare const TableFilterTags: () => react_jsx_runtime.JSX.Element;
|
|
409
|
-
|
|
410
|
-
interface TableLoadingComponentProps {
|
|
411
|
-
render: (loading: boolean) => ReactNode;
|
|
412
|
-
}
|
|
413
|
-
declare const TableLoadingComponent: ({ render, }: TableLoadingComponentProps) => react_jsx_runtime.JSX.Element;
|
|
414
|
-
|
|
415
|
-
declare const TableSelector: () => react_jsx_runtime.JSX.Element;
|
|
416
|
-
|
|
417
|
-
declare const TableSorter: () => react_jsx_runtime.JSX.Element;
|
|
418
|
-
|
|
419
|
-
declare const TableViewer: () => react_jsx_runtime.JSX.Element;
|
|
420
|
-
|
|
421
|
-
interface TextCellProps {
|
|
422
|
-
label?: string;
|
|
423
|
-
noOfLines?: number[];
|
|
424
|
-
children: string | number | ReactNode | ReactNode[];
|
|
425
|
-
containerProps?: FlexProps;
|
|
426
|
-
textProps?: TextProps;
|
|
427
|
-
}
|
|
428
|
-
declare const TextCell: ({ label, containerProps, textProps, children, }: TextCellProps) => react_jsx_runtime.JSX.Element;
|
|
479
|
+
declare const useDataTableContext: <TData>() => DataTableContextProps<TData>;
|
|
429
480
|
|
|
430
481
|
interface GetColumnsConfigs<K extends RowData> {
|
|
431
482
|
schema: JSONSchema7;
|
|
@@ -441,20 +492,349 @@ interface GetColumnsConfigs<K extends RowData> {
|
|
|
441
492
|
declare const widthSanityCheck: <K extends unknown>(widthList: number[], ignoreList: K[], properties: { [key in K as string]?: object | undefined; }) => void;
|
|
442
493
|
declare const getColumns: <TData extends unknown>({ schema, include, ignore, width, meta, defaultWidth, translate, }: GetColumnsConfigs<TData>) => ColumnDef<TData>[];
|
|
443
494
|
|
|
444
|
-
interface
|
|
445
|
-
|
|
495
|
+
interface CustomQueryFnResponse {
|
|
496
|
+
/**
|
|
497
|
+
* The data of the query
|
|
498
|
+
*/
|
|
499
|
+
data: any;
|
|
500
|
+
/**
|
|
501
|
+
* The id map of the data
|
|
502
|
+
*/
|
|
503
|
+
idMap: Record<string, any>;
|
|
446
504
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
505
|
+
interface CustomQueryFnParams {
|
|
506
|
+
searching: string;
|
|
507
|
+
limit: number;
|
|
508
|
+
offset: number;
|
|
509
|
+
where?: Array<{
|
|
510
|
+
id: string;
|
|
511
|
+
value: string | string[];
|
|
512
|
+
}>;
|
|
513
|
+
}
|
|
514
|
+
type CustomQueryFn = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse>;
|
|
515
|
+
interface ForeignKeyProps {
|
|
450
516
|
column: string;
|
|
517
|
+
table: string;
|
|
518
|
+
display_column: string;
|
|
519
|
+
customQueryFn?: CustomQueryFn;
|
|
451
520
|
}
|
|
452
|
-
declare const FilterOptions: ({ column }: FilterOptionsProps) => react_jsx_runtime.JSX.Element;
|
|
453
521
|
|
|
454
|
-
|
|
522
|
+
/**
|
|
523
|
+
* Type definitions for error message configuration
|
|
524
|
+
*/
|
|
525
|
+
/**
|
|
526
|
+
* Common validation error types that can be customized
|
|
527
|
+
*/
|
|
528
|
+
type ValidationErrorType = 'minLength' | 'maxLength' | 'pattern' | 'minimum' | 'maximum' | 'multipleOf' | 'format' | 'type' | 'enum' | 'required' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minProperties' | 'maxProperties' | 'anyOf' | 'oneOf' | 'allOf' | 'const' | 'additionalProperties' | 'dependencies';
|
|
529
|
+
/**
|
|
530
|
+
* Configuration for field-specific validation errors
|
|
531
|
+
*/
|
|
532
|
+
type FieldErrorConfig = Partial<Record<ValidationErrorType, string>>;
|
|
533
|
+
/**
|
|
534
|
+
* Configuration for building error messages
|
|
535
|
+
*/
|
|
536
|
+
interface ErrorMessageConfig {
|
|
537
|
+
/**
|
|
538
|
+
* Required field error messages
|
|
539
|
+
* Maps field names to their required error messages
|
|
540
|
+
* Supports both plain strings and i18n translation keys
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```typescript
|
|
544
|
+
* required: {
|
|
545
|
+
* username: "Username is required", // plain string
|
|
546
|
+
* email: "user.email.field_required" // i18n key
|
|
547
|
+
* }
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
required?: Record<string, string>;
|
|
551
|
+
/**
|
|
552
|
+
* Field-specific validation error messages
|
|
553
|
+
* Maps field names to their validation error configurations
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```typescript
|
|
557
|
+
* properties: {
|
|
558
|
+
* username: {
|
|
559
|
+
* minLength: "Username must be at least 3 characters",
|
|
560
|
+
* pattern: "Username can only contain letters and numbers"
|
|
561
|
+
* },
|
|
562
|
+
* age: {
|
|
563
|
+
* minimum: "Age must be at least 18",
|
|
564
|
+
* maximum: "Age cannot exceed 120"
|
|
565
|
+
* }
|
|
566
|
+
* }
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
properties?: Record<string, FieldErrorConfig>;
|
|
570
|
+
/**
|
|
571
|
+
* Global fallback error messages for validation types
|
|
572
|
+
* These are used when no field-specific message is provided
|
|
573
|
+
*
|
|
574
|
+
* @example
|
|
575
|
+
* ```typescript
|
|
576
|
+
* {
|
|
577
|
+
* minLength: "This field is too short",
|
|
578
|
+
* minimum: "Value is too small"
|
|
579
|
+
* }
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
[key: string]: any;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Result of buildErrorMessages that follows ajv-errors format
|
|
586
|
+
*/
|
|
587
|
+
interface ErrorMessageResult {
|
|
588
|
+
required?: Record<string, string>;
|
|
589
|
+
properties?: Record<string, FieldErrorConfig>;
|
|
590
|
+
[key: string]: any;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Schema-level error message builder
|
|
594
|
+
*
|
|
595
|
+
* Builds a complete errorMessage object compatible with ajv-errors plugin.
|
|
596
|
+
* Supports both i18n translation keys and plain string messages.
|
|
597
|
+
*
|
|
598
|
+
* @param config - Error message configuration
|
|
599
|
+
* @returns Complete errorMessage object for JSON Schema
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```typescript
|
|
603
|
+
* // Simple required field errors
|
|
604
|
+
* const errorMessage = buildErrorMessages({
|
|
605
|
+
* required: {
|
|
606
|
+
* username: "Username is required",
|
|
607
|
+
* email: "user.email.field_required" // i18n key
|
|
608
|
+
* }
|
|
609
|
+
* });
|
|
610
|
+
*
|
|
611
|
+
* // With validation rules
|
|
612
|
+
* const errorMessage = buildErrorMessages({
|
|
613
|
+
* required: {
|
|
614
|
+
* password: "Password is required"
|
|
615
|
+
* },
|
|
616
|
+
* properties: {
|
|
617
|
+
* password: {
|
|
618
|
+
* minLength: "Password must be at least 8 characters",
|
|
619
|
+
* pattern: "Password must contain letters and numbers"
|
|
620
|
+
* },
|
|
621
|
+
* age: {
|
|
622
|
+
* minimum: "Must be 18 or older",
|
|
623
|
+
* maximum: "Must be under 120"
|
|
624
|
+
* }
|
|
625
|
+
* }
|
|
626
|
+
* });
|
|
627
|
+
*
|
|
628
|
+
* // With global fallbacks
|
|
629
|
+
* const errorMessage = buildErrorMessages({
|
|
630
|
+
* required: {
|
|
631
|
+
* email: "Email is required"
|
|
632
|
+
* },
|
|
633
|
+
* minLength: "This field is too short", // applies to all fields
|
|
634
|
+
* minimum: "Value is too small"
|
|
635
|
+
* });
|
|
636
|
+
* ```
|
|
637
|
+
*/
|
|
638
|
+
declare const buildErrorMessages: (config: ErrorMessageConfig) => ErrorMessageResult;
|
|
639
|
+
/**
|
|
640
|
+
* Converts buildErrorMessages result to ajv-errors compatible format
|
|
641
|
+
*/
|
|
642
|
+
declare const convertToAjvErrorsFormat: (errorMessages: ErrorMessageResult) => Record<string, any>;
|
|
643
|
+
/**
|
|
644
|
+
* Helper function to build required field errors
|
|
645
|
+
*
|
|
646
|
+
* Simplifies creating required field error messages, especially useful
|
|
647
|
+
* for generating i18n translation keys following a pattern.
|
|
648
|
+
*
|
|
649
|
+
* @param fields - Array of required field names
|
|
650
|
+
* @param messageOrGenerator - Either a string template or function to generate messages
|
|
651
|
+
* @returns Required field error configuration
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* ```typescript
|
|
655
|
+
* // Plain string messages
|
|
656
|
+
* const required = buildRequiredErrors(
|
|
657
|
+
* ["username", "email", "password"],
|
|
658
|
+
* (field) => `${field} is required`
|
|
659
|
+
* );
|
|
660
|
+
* // Result: { username: "username is required", email: "email is required", ... }
|
|
661
|
+
*
|
|
662
|
+
* // i18n translation keys
|
|
663
|
+
* const required = buildRequiredErrors(
|
|
664
|
+
* ["username", "email"],
|
|
665
|
+
* (field) => `user.${field}.field_required`
|
|
666
|
+
* );
|
|
667
|
+
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
668
|
+
*
|
|
669
|
+
* // Same message for all fields
|
|
670
|
+
* const required = buildRequiredErrors(
|
|
671
|
+
* ["username", "email"],
|
|
672
|
+
* "This field is required"
|
|
673
|
+
* );
|
|
674
|
+
* // Result: { username: "This field is required", email: "This field is required" }
|
|
675
|
+
*
|
|
676
|
+
* // With keyPrefix for i18n
|
|
677
|
+
* const required = buildRequiredErrors(
|
|
678
|
+
* ["username", "email"],
|
|
679
|
+
* (field) => `${field}.field_required`,
|
|
680
|
+
* "user"
|
|
681
|
+
* );
|
|
682
|
+
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
declare const buildRequiredErrors: (fields: string[], messageOrGenerator: string | ((field: string) => string), keyPrefix?: string) => Record<string, string>;
|
|
686
|
+
/**
|
|
687
|
+
* Helper function to build field-specific validation errors
|
|
688
|
+
*
|
|
689
|
+
* Creates property-specific error messages for multiple fields at once.
|
|
690
|
+
*
|
|
691
|
+
* @param config - Maps field names to their validation error configurations
|
|
692
|
+
* @returns Properties error configuration
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* ```typescript
|
|
696
|
+
* const properties = buildFieldErrors({
|
|
697
|
+
* username: {
|
|
698
|
+
* minLength: "Username must be at least 3 characters",
|
|
699
|
+
* pattern: "Username can only contain letters and numbers"
|
|
700
|
+
* },
|
|
701
|
+
* age: {
|
|
702
|
+
* minimum: "Must be 18 or older",
|
|
703
|
+
* maximum: "Must be under 120"
|
|
704
|
+
* },
|
|
705
|
+
* email: {
|
|
706
|
+
* format: "Please enter a valid email address"
|
|
707
|
+
* }
|
|
708
|
+
* });
|
|
709
|
+
* ```
|
|
710
|
+
*/
|
|
711
|
+
declare const buildFieldErrors: (config: Record<string, FieldErrorConfig>) => Record<string, FieldErrorConfig>;
|
|
712
|
+
/**
|
|
713
|
+
* Helper function to create a complete error message configuration in one call
|
|
714
|
+
*
|
|
715
|
+
* Convenient wrapper that combines required and validation errors.
|
|
716
|
+
*
|
|
717
|
+
* @param required - Required field error messages
|
|
718
|
+
* @param properties - Field-specific validation error messages
|
|
719
|
+
* @param globalFallbacks - Global fallback error messages
|
|
720
|
+
* @returns Complete error message configuration
|
|
721
|
+
*
|
|
722
|
+
* @example
|
|
723
|
+
* ```typescript
|
|
724
|
+
* const errorMessage = createErrorMessage(
|
|
725
|
+
* {
|
|
726
|
+
* username: "Username is required",
|
|
727
|
+
* email: "Email is required"
|
|
728
|
+
* },
|
|
729
|
+
* {
|
|
730
|
+
* username: {
|
|
731
|
+
* minLength: "Username must be at least 3 characters"
|
|
732
|
+
* },
|
|
733
|
+
* email: {
|
|
734
|
+
* format: "Please enter a valid email"
|
|
735
|
+
* }
|
|
736
|
+
* },
|
|
737
|
+
* {
|
|
738
|
+
* minLength: "This field is too short",
|
|
739
|
+
* format: "Invalid format"
|
|
740
|
+
* }
|
|
741
|
+
* );
|
|
742
|
+
* ```
|
|
743
|
+
*/
|
|
744
|
+
declare const createErrorMessage: (required?: Record<string, string>, properties?: Record<string, FieldErrorConfig>, globalFallbacks?: Partial<Record<ValidationErrorType, string>>) => ErrorMessageResult;
|
|
745
|
+
|
|
746
|
+
interface DateTimePickerLabels {
|
|
747
|
+
monthNamesShort?: string[];
|
|
748
|
+
weekdayNamesShort?: string[];
|
|
749
|
+
backButtonLabel?: string;
|
|
750
|
+
forwardButtonLabel?: string;
|
|
751
|
+
}
|
|
752
|
+
interface IdPickerLabels {
|
|
753
|
+
undefined?: string;
|
|
754
|
+
addMore?: string;
|
|
755
|
+
typeToSearch?: string;
|
|
756
|
+
total?: string;
|
|
757
|
+
showing?: string;
|
|
758
|
+
perPage?: string;
|
|
759
|
+
emptySearchResult?: string;
|
|
760
|
+
initialResults?: string;
|
|
761
|
+
}
|
|
762
|
+
interface EnumPickerLabels {
|
|
763
|
+
undefined?: string;
|
|
764
|
+
addMore?: string;
|
|
765
|
+
typeToSearch?: string;
|
|
766
|
+
total?: string;
|
|
767
|
+
showing?: string;
|
|
768
|
+
perPage?: string;
|
|
769
|
+
emptySearchResult?: string;
|
|
770
|
+
initialResults?: string;
|
|
771
|
+
}
|
|
772
|
+
interface FilePickerLabels {
|
|
773
|
+
fileDropzone?: string;
|
|
774
|
+
browseLibrary?: string;
|
|
775
|
+
dialogTitle?: string;
|
|
776
|
+
searchPlaceholder?: string;
|
|
777
|
+
loading?: string;
|
|
778
|
+
loadingFailed?: string;
|
|
779
|
+
noFilesFound?: string;
|
|
780
|
+
cancel?: string;
|
|
781
|
+
select?: string;
|
|
782
|
+
uploadTab?: string;
|
|
783
|
+
browseTab?: string;
|
|
784
|
+
uploading?: string;
|
|
785
|
+
uploadFailed?: string;
|
|
786
|
+
}
|
|
787
|
+
interface CustomJSONSchema7 extends JSONSchema7 {
|
|
788
|
+
gridColumn?: string;
|
|
789
|
+
gridRow?: string;
|
|
790
|
+
foreign_key?: ForeignKeyProps;
|
|
791
|
+
variant?: string;
|
|
792
|
+
renderDisplay?: (item: unknown) => ReactNode;
|
|
793
|
+
inputRender?: (props: {
|
|
794
|
+
column: string;
|
|
795
|
+
schema: CustomJSONSchema7;
|
|
796
|
+
prefix: string;
|
|
797
|
+
formContext: UseFormReturn;
|
|
798
|
+
}) => ReactNode;
|
|
799
|
+
inputViewerRender?: (props: {
|
|
800
|
+
column: string;
|
|
801
|
+
schema: CustomJSONSchema7;
|
|
802
|
+
prefix: string;
|
|
803
|
+
formContext: UseFormReturn;
|
|
804
|
+
}) => ReactNode;
|
|
805
|
+
dateFormat?: string;
|
|
806
|
+
displayDateFormat?: string;
|
|
807
|
+
timeFormat?: string;
|
|
808
|
+
displayTimeFormat?: string;
|
|
809
|
+
showLabel?: boolean;
|
|
810
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
811
|
+
numberStorageType?: 'string' | 'number';
|
|
812
|
+
errorMessages?: Partial<Record<ValidationErrorType | string, string>>;
|
|
813
|
+
filePicker?: FilePickerProps;
|
|
814
|
+
}
|
|
815
|
+
interface TagPickerProps {
|
|
816
|
+
column: string;
|
|
817
|
+
schema: CustomJSONSchema7;
|
|
818
|
+
prefix: string;
|
|
819
|
+
}
|
|
820
|
+
interface FilePickerMediaFile {
|
|
821
|
+
id: string;
|
|
822
|
+
name: string;
|
|
823
|
+
url?: string;
|
|
824
|
+
size?: string | number;
|
|
825
|
+
comment?: string;
|
|
826
|
+
type?: string;
|
|
827
|
+
}
|
|
828
|
+
interface FilePickerProps {
|
|
829
|
+
onFetchFiles?: (search: string) => Promise<FilePickerMediaFile[]>;
|
|
830
|
+
enableMediaLibrary?: boolean;
|
|
831
|
+
filterImageOnly?: boolean;
|
|
832
|
+
enableUpload?: boolean;
|
|
833
|
+
onUploadFile?: (file: File) => Promise<string>;
|
|
834
|
+
}
|
|
455
835
|
|
|
456
836
|
interface FormRootProps<TData extends FieldValues> {
|
|
457
|
-
schema:
|
|
837
|
+
schema: CustomJSONSchema7;
|
|
458
838
|
serverUrl: string;
|
|
459
839
|
requestUrl?: string;
|
|
460
840
|
idMap: Record<string, object>;
|
|
@@ -469,6 +849,19 @@ interface FormRootProps<TData extends FieldValues> {
|
|
|
469
849
|
rowNumber?: number | string;
|
|
470
850
|
requestOptions?: AxiosRequestConfig;
|
|
471
851
|
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
852
|
+
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
853
|
+
customSuccessRenderer?: (resetHandler: () => void | Promise<void>) => ReactNode;
|
|
854
|
+
displayConfig?: {
|
|
855
|
+
showSubmitButton?: boolean;
|
|
856
|
+
showResetButton?: boolean;
|
|
857
|
+
showTitle?: boolean;
|
|
858
|
+
};
|
|
859
|
+
requireConfirmation?: boolean;
|
|
860
|
+
dateTimePickerLabels?: DateTimePickerLabels;
|
|
861
|
+
idPickerLabels?: IdPickerLabels;
|
|
862
|
+
enumPickerLabels?: EnumPickerLabels;
|
|
863
|
+
filePickerLabels?: FilePickerLabels;
|
|
864
|
+
insideDialog?: boolean;
|
|
472
865
|
}
|
|
473
866
|
interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
474
867
|
variant: string;
|
|
@@ -477,7 +870,7 @@ interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
|
477
870
|
display_column: string;
|
|
478
871
|
gridColumn: string;
|
|
479
872
|
gridRow: string;
|
|
480
|
-
foreign_key: ForeignKeyProps;
|
|
873
|
+
foreign_key: ForeignKeyProps$1;
|
|
481
874
|
children: ReactNode;
|
|
482
875
|
}
|
|
483
876
|
declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
@@ -485,26 +878,50 @@ declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
|
485
878
|
column?: string | undefined;
|
|
486
879
|
display_column?: string | undefined;
|
|
487
880
|
} | undefined) => void;
|
|
488
|
-
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;
|
|
881
|
+
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, insideDialog, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
489
882
|
|
|
490
883
|
interface DefaultFormProps<TData extends FieldValues> {
|
|
491
884
|
formConfig: Omit<FormRootProps<TData>, "children">;
|
|
885
|
+
showTitle?: boolean;
|
|
492
886
|
}
|
|
493
887
|
declare const DefaultForm: <TData extends FieldValues>({ formConfig, }: DefaultFormProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
494
888
|
|
|
495
889
|
declare const FormTitle: () => react_jsx_runtime.JSX.Element;
|
|
496
890
|
|
|
497
|
-
declare const FormBody: <TData extends object>() => react_jsx_runtime.JSX.Element;
|
|
891
|
+
declare const FormBody: <TData extends object>() => string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
892
|
+
|
|
893
|
+
type MediaLibraryBrowserPropsBase = {
|
|
894
|
+
onFetchFiles?: (search: string) => Promise<FilePickerMediaFile[]>;
|
|
895
|
+
filterImageOnly?: boolean;
|
|
896
|
+
labels?: FilePickerLabels;
|
|
897
|
+
enabled?: boolean;
|
|
898
|
+
};
|
|
899
|
+
type MediaLibraryBrowserPropsSingle = MediaLibraryBrowserPropsBase & {
|
|
900
|
+
multiple?: false;
|
|
901
|
+
onFileSelect?: (file: FilePickerMediaFile) => void;
|
|
902
|
+
selectedFile?: FilePickerMediaFile;
|
|
903
|
+
onSelectedFileChange?: (file: FilePickerMediaFile | undefined) => void;
|
|
904
|
+
};
|
|
905
|
+
type MediaLibraryBrowserPropsMultiple = MediaLibraryBrowserPropsBase & {
|
|
906
|
+
multiple: true;
|
|
907
|
+
onFileSelect?: (files: FilePickerMediaFile[]) => void;
|
|
908
|
+
selectedFile?: FilePickerMediaFile[];
|
|
909
|
+
onSelectedFileChange?: (files: FilePickerMediaFile[]) => void;
|
|
910
|
+
};
|
|
911
|
+
type MediaLibraryBrowserProps = MediaLibraryBrowserPropsSingle | MediaLibraryBrowserPropsMultiple;
|
|
912
|
+
declare const MediaLibraryBrowser: ({ onFetchFiles, filterImageOnly, labels, enabled, multiple, onFileSelect, selectedFile: controlledSelectedFile, onSelectedFileChange, }: MediaLibraryBrowserProps) => react_jsx_runtime.JSX.Element | null;
|
|
498
913
|
|
|
499
914
|
interface UseFormProps {
|
|
500
915
|
preLoadedValues?: FieldValues | undefined;
|
|
501
916
|
keyPrefix?: string;
|
|
917
|
+
namespace?: string;
|
|
918
|
+
schema?: JSONSchema7;
|
|
502
919
|
}
|
|
503
|
-
declare const useForm: ({ preLoadedValues, keyPrefix }: UseFormProps) => {
|
|
920
|
+
declare const useForm: ({ preLoadedValues, keyPrefix, namespace, schema, }: UseFormProps) => {
|
|
504
921
|
form: react_hook_form.UseFormReturn<FieldValues, any, undefined>;
|
|
505
922
|
idMap: Record<string, object>;
|
|
506
923
|
setIdMap: React$1.Dispatch<React$1.SetStateAction<Record<string, object>>>;
|
|
507
|
-
translate: react_i18next.UseTranslationResponse<
|
|
924
|
+
translate: react_i18next.UseTranslationResponse<string, string>;
|
|
508
925
|
};
|
|
509
926
|
|
|
510
927
|
interface CalendarProps extends RenderProps {
|
|
@@ -521,6 +938,29 @@ interface GetVariantProps {
|
|
|
521
938
|
selectable: boolean;
|
|
522
939
|
}
|
|
523
940
|
interface DatePickerProps extends Props {
|
|
941
|
+
onDateSelected?: (obj: {
|
|
942
|
+
date: Date;
|
|
943
|
+
}) => void;
|
|
944
|
+
selected: Date | Date[];
|
|
945
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
946
|
+
showOutsideDays?: boolean;
|
|
947
|
+
date?: Date;
|
|
948
|
+
minDate?: Date;
|
|
949
|
+
maxDate?: Date;
|
|
950
|
+
monthsToDisplay?: number;
|
|
951
|
+
labels?: {
|
|
952
|
+
monthNamesShort: string[];
|
|
953
|
+
weekdayNamesShort: string[];
|
|
954
|
+
backButtonLabel?: string;
|
|
955
|
+
forwardButtonLabel?: string;
|
|
956
|
+
};
|
|
957
|
+
render?: (dayzedData: any) => React__default.ReactNode;
|
|
958
|
+
}
|
|
959
|
+
interface DatePickerLabels {
|
|
960
|
+
monthNamesShort: string[];
|
|
961
|
+
weekdayNamesShort: string[];
|
|
962
|
+
backButtonLabel?: string;
|
|
963
|
+
forwardButtonLabel?: string;
|
|
524
964
|
}
|
|
525
965
|
|
|
526
966
|
interface GetMultiDatesProps {
|
|
@@ -548,7 +988,65 @@ interface GetStyleProps {
|
|
|
548
988
|
unavailable: boolean;
|
|
549
989
|
isInRange: boolean;
|
|
550
990
|
}
|
|
551
|
-
interface
|
|
991
|
+
interface RangeDatePickerLabels {
|
|
992
|
+
monthNamesFull: string[];
|
|
993
|
+
weekdayNamesShort: string[];
|
|
994
|
+
backButtonLabel?: string;
|
|
995
|
+
forwardButtonLabel?: string;
|
|
996
|
+
}
|
|
997
|
+
interface RangeDatePickerProps extends Props {
|
|
998
|
+
onDateSelected?: (obj: {
|
|
999
|
+
selected: Date[];
|
|
1000
|
+
selectable: boolean;
|
|
1001
|
+
date: Date;
|
|
1002
|
+
}) => void;
|
|
1003
|
+
selected?: Date[];
|
|
1004
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1005
|
+
showOutsideDays?: boolean;
|
|
1006
|
+
date?: Date;
|
|
1007
|
+
minDate?: Date;
|
|
1008
|
+
maxDate?: Date;
|
|
1009
|
+
monthsToDisplay?: number;
|
|
1010
|
+
labels?: RangeDatePickerLabels;
|
|
1011
|
+
/**
|
|
1012
|
+
* Whether to render the calendar in a popover with a trigger button.
|
|
1013
|
+
* @default true
|
|
1014
|
+
*/
|
|
1015
|
+
withPopover?: boolean;
|
|
1016
|
+
/**
|
|
1017
|
+
* Controlled open state for the popover.
|
|
1018
|
+
*/
|
|
1019
|
+
open?: boolean;
|
|
1020
|
+
/**
|
|
1021
|
+
* Callback when the popover open state changes.
|
|
1022
|
+
*/
|
|
1023
|
+
onOpenChange?: (details: {
|
|
1024
|
+
open: boolean;
|
|
1025
|
+
}) => void;
|
|
1026
|
+
/**
|
|
1027
|
+
* The trigger button element. If not provided, a default button will be rendered.
|
|
1028
|
+
*/
|
|
1029
|
+
trigger?: React__default.ReactNode;
|
|
1030
|
+
/**
|
|
1031
|
+
* Format string for displaying the selected date range in the trigger button.
|
|
1032
|
+
* @default "YYYY-MM-DD"
|
|
1033
|
+
*/
|
|
1034
|
+
displayFormat?: string;
|
|
1035
|
+
/**
|
|
1036
|
+
* Placeholder text for the trigger button when no dates are selected.
|
|
1037
|
+
*/
|
|
1038
|
+
placeholder?: string;
|
|
1039
|
+
/**
|
|
1040
|
+
* Whether to close the popover when clicking outside.
|
|
1041
|
+
* @default true
|
|
1042
|
+
*/
|
|
1043
|
+
closeOnInteractOutside?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* Whether to portal the popover content.
|
|
1046
|
+
* @default true
|
|
1047
|
+
*/
|
|
1048
|
+
portalled?: boolean;
|
|
1049
|
+
render?: (dayzedData: RenderProps) => React__default.ReactNode;
|
|
552
1050
|
}
|
|
553
1051
|
|
|
554
1052
|
interface RecordDisplayProps {
|
|
@@ -559,7 +1057,101 @@ interface RecordDisplayProps {
|
|
|
559
1057
|
}
|
|
560
1058
|
declare const RecordDisplay: ({ object, boxProps, translate, prefix, }: RecordDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
561
1059
|
|
|
562
|
-
|
|
1060
|
+
interface TableDataDisplayProps {
|
|
1061
|
+
colorPalette?: string;
|
|
1062
|
+
emptyComponent?: ReactNode;
|
|
1063
|
+
}
|
|
1064
|
+
declare const TableDataDisplay: ({ colorPalette, emptyComponent, }: TableDataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
1065
|
+
|
|
1066
|
+
interface DefaultTableProps {
|
|
1067
|
+
showFooter?: boolean;
|
|
1068
|
+
tableProps?: Omit<TableProps, 'children'>;
|
|
1069
|
+
tableHeaderProps?: TableHeaderProps;
|
|
1070
|
+
tableBodyProps?: TableBodyProps;
|
|
1071
|
+
tableFooterProps?: TableFooterProps;
|
|
1072
|
+
controlProps?: TableControlsProps;
|
|
1073
|
+
variant?: '' | 'greedy';
|
|
1074
|
+
isLoading?: boolean;
|
|
1075
|
+
}
|
|
1076
|
+
declare const DefaultTable: ({ showFooter, tableProps, tableHeaderProps, tableBodyProps, tableFooterProps, controlProps, variant, isLoading, }: DefaultTableProps) => react_jsx_runtime.JSX.Element;
|
|
1077
|
+
|
|
1078
|
+
interface DefaultTableServerProps extends DefaultTableProps {
|
|
1079
|
+
/**
|
|
1080
|
+
* Optional isLoading prop to override auto-detected loading state.
|
|
1081
|
+
* If not provided, will automatically detect from DataTableServerContext.
|
|
1082
|
+
*/
|
|
1083
|
+
isLoading?: boolean;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* DefaultTableServer is a wrapper around DefaultTable that automatically
|
|
1087
|
+
* detects server-side loading state from DataTableServerContext.
|
|
1088
|
+
*
|
|
1089
|
+
* Use this component when working with DataTableServer to automatically
|
|
1090
|
+
* show skeleton loading state during data fetching.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```tsx
|
|
1094
|
+
* <DataTableServer columns={columns} {...datatableServer}>
|
|
1095
|
+
* <DefaultTableServer />
|
|
1096
|
+
* </DataTableServer>
|
|
1097
|
+
* ```
|
|
1098
|
+
*/
|
|
1099
|
+
declare const DefaultTableServer: ({ isLoading: isLoadingOverride, ...props }: DefaultTableServerProps) => react_jsx_runtime.JSX.Element;
|
|
1100
|
+
|
|
1101
|
+
interface DataDisplayProps {
|
|
1102
|
+
variant?: 'horizontal' | 'stats' | '';
|
|
1103
|
+
translate?: UseTranslationResponse<any, any>;
|
|
1104
|
+
}
|
|
1105
|
+
declare const DataDisplay: ({ variant }: DataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
1106
|
+
|
|
1107
|
+
interface DataTableServerProps<TData = unknown> {
|
|
1108
|
+
children: ReactNode | ReactNode[];
|
|
1109
|
+
/**
|
|
1110
|
+
* Column definitions for the table.
|
|
1111
|
+
*
|
|
1112
|
+
* It will pass into as the column definitions in `@tanstack/react-table`
|
|
1113
|
+
*
|
|
1114
|
+
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
1115
|
+
*/
|
|
1116
|
+
columns: ColumnDef<TData>[];
|
|
1117
|
+
enableRowSelection?: boolean;
|
|
1118
|
+
enableMultiRowSelection?: boolean;
|
|
1119
|
+
enableSubRowSelection?: boolean;
|
|
1120
|
+
columnOrder: ColumnOrderState;
|
|
1121
|
+
columnFilters: ColumnFiltersState;
|
|
1122
|
+
globalFilter: string;
|
|
1123
|
+
density: DensityState;
|
|
1124
|
+
pagination: PaginationState;
|
|
1125
|
+
sorting: SortingState;
|
|
1126
|
+
rowSelection: RowSelectionState;
|
|
1127
|
+
columnVisibility: VisibilityState;
|
|
1128
|
+
setPagination: OnChangeFn<PaginationState>;
|
|
1129
|
+
setSorting: OnChangeFn<SortingState>;
|
|
1130
|
+
setColumnFilters: OnChangeFn<ColumnFiltersState>;
|
|
1131
|
+
setRowSelection: OnChangeFn<RowSelectionState>;
|
|
1132
|
+
setGlobalFilter: OnChangeFn<string>;
|
|
1133
|
+
setColumnOrder: OnChangeFn<ColumnOrderState>;
|
|
1134
|
+
setDensity: OnChangeFn<DensityState>;
|
|
1135
|
+
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
1136
|
+
query: UseQueryResult<DataResponse<TData>>;
|
|
1137
|
+
url?: string;
|
|
1138
|
+
translate: UseTranslationResponse<any, any>;
|
|
1139
|
+
tableLabel?: DataTableLabel;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* DataTableServer will create a context to hold all values to
|
|
1143
|
+
* help the render of the DataTable in serverside
|
|
1144
|
+
*
|
|
1145
|
+
* The query is required to be a GET request that can receive
|
|
1146
|
+
* specified params and return a specified response
|
|
1147
|
+
*
|
|
1148
|
+
* The `useDataTableServer` can help to create the specified request and response
|
|
1149
|
+
*
|
|
1150
|
+
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
1151
|
+
*/
|
|
1152
|
+
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;
|
|
1153
|
+
|
|
1154
|
+
declare module '@tanstack/react-table' {
|
|
563
1155
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
564
1156
|
/**
|
|
565
1157
|
* If `showCustomDisplay` is `true`, it will use the cell render to render the value.
|
|
@@ -571,6 +1163,17 @@ declare module "@tanstack/react-table" {
|
|
|
571
1163
|
* The display name of the column, used for rendering headers.
|
|
572
1164
|
*/
|
|
573
1165
|
displayName?: string;
|
|
1166
|
+
/**
|
|
1167
|
+
* Text configuration for the column header menu items.
|
|
1168
|
+
* These strings can be customized per column.
|
|
1169
|
+
*/
|
|
1170
|
+
headerTexts?: {
|
|
1171
|
+
pinColumn?: string;
|
|
1172
|
+
cancelPin?: string;
|
|
1173
|
+
sortAscending?: string;
|
|
1174
|
+
sortDescending?: string;
|
|
1175
|
+
clearSorting?: string;
|
|
1176
|
+
};
|
|
574
1177
|
/**
|
|
575
1178
|
* Specifies the type of filter to be used for the column.
|
|
576
1179
|
*
|
|
@@ -587,11 +1190,14 @@ declare module "@tanstack/react-table" {
|
|
|
587
1190
|
* - "dateRange": A date range filter.
|
|
588
1191
|
* - "custom": A custom filter function.
|
|
589
1192
|
*/
|
|
590
|
-
filterVariant?:
|
|
1193
|
+
filterVariant?: 'text' | 'range' | 'select' | 'tag' | 'boolean' | 'dateRange' | 'custom';
|
|
591
1194
|
/**
|
|
592
1195
|
* Options for the select filter variant, if applicable.
|
|
593
1196
|
*/
|
|
594
|
-
filterOptions?:
|
|
1197
|
+
filterOptions?: {
|
|
1198
|
+
label: string;
|
|
1199
|
+
value: string;
|
|
1200
|
+
}[];
|
|
595
1201
|
/**
|
|
596
1202
|
* Configuration for the range filter variant, if applicable.
|
|
597
1203
|
*
|
|
@@ -614,7 +1220,14 @@ declare module "@tanstack/react-table" {
|
|
|
614
1220
|
* @returns A JSX element representing the filter UI.
|
|
615
1221
|
*/
|
|
616
1222
|
renderFilter?: (column: Column<TData>) => ReactNode;
|
|
1223
|
+
/**
|
|
1224
|
+
* Priority for responsive column hiding when table width is too narrow.
|
|
1225
|
+
* Lower priority numbers = hide first (e.g., priority 1 hides before priority 10).
|
|
1226
|
+
* Columns without priority default to Infinity (highest priority, never auto-hide).
|
|
1227
|
+
* Only applies when canResize={false}.
|
|
1228
|
+
*/
|
|
1229
|
+
responsivePriority?: number;
|
|
617
1230
|
}
|
|
618
1231
|
}
|
|
619
1232
|
|
|
620
|
-
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,
|
|
1233
|
+
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, MediaLibraryBrowser, type MediaLibraryBrowserProps, PageSizeControl, type PageSizeControlProps, Pagination, type QueryParams, type RangeCalendarProps, type RangeDatePickerLabels, type RangeDatePickerProps, RecordDisplay, type RecordDisplayProps, ReloadButton, type ReloadButtonProps, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, type Result, RowCountText, SelectAllRowsToggle, type SelectAllRowsToggleProps, 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 };
|