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