@bsol-oss/react-datatable5 12.0.0-beta.6 → 12.0.0-beta.60
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 +192 -0
- package/dist/index.d.ts +212 -91
- package/dist/index.js +1396 -426
- package/dist/index.mjs +1402 -432
- package/dist/types/components/DataTable/DataTable.d.ts +4 -2
- package/dist/types/components/DataTable/DataTableServer.d.ts +4 -2
- package/dist/types/components/DataTable/DefaultTable.d.ts +9 -12
- package/dist/types/components/DataTable/context/DataTableContext.d.ts +22 -3
- package/dist/types/components/DataTable/context/useDataTableContext.d.ts +2 -2
- package/dist/types/components/DataTable/controls/DensityFeature.d.ts +23 -0
- package/dist/types/components/DataTable/controls/DensityToggleButton.d.ts +6 -0
- package/dist/types/components/DataTable/controls/EditSortingButton.d.ts +7 -0
- package/dist/types/components/DataTable/controls/FilterDialog.d.ts +5 -0
- package/dist/types/components/DataTable/controls/PageSizeControl.d.ts +4 -0
- package/dist/types/components/DataTable/controls/Pagination.d.ts +1 -0
- package/dist/types/components/DataTable/controls/ReloadButton.d.ts +4 -0
- package/dist/types/components/DataTable/controls/ResetFilteringButton.d.ts +1 -0
- package/dist/types/components/DataTable/controls/ResetSelectionButton.d.ts +1 -0
- package/dist/types/components/DataTable/controls/ResetSortingButton.d.ts +1 -0
- package/dist/types/components/DataTable/controls/RowCountText.d.ts +1 -0
- package/dist/types/components/DataTable/controls/SelectAllRowsToggle.d.ts +8 -0
- package/dist/types/components/DataTable/controls/TableControls.d.ts +29 -0
- package/dist/types/components/DataTable/controls/TableFilterTags.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableFilters.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableSelector.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableSorter.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableViewer.d.ts +1 -0
- package/dist/types/components/DataTable/controls/ViewDialog.d.ts +5 -0
- package/dist/types/components/DataTable/display/CardHeader.d.ts +13 -0
- package/dist/types/components/DataTable/display/DataDisplay.d.ts +6 -0
- package/dist/types/components/DataTable/display/EmptyState.d.ts +5 -0
- package/dist/types/components/DataTable/display/ErrorAlert.d.ts +4 -0
- package/dist/types/components/DataTable/display/RecordDisplay.d.ts +9 -0
- package/dist/types/components/DataTable/display/Table.d.ts +10 -0
- package/dist/types/components/DataTable/display/TableBody.d.ts +20 -0
- package/dist/types/components/DataTable/display/TableCardContainer.d.ts +10 -0
- package/dist/types/components/DataTable/display/TableCards.d.ts +11 -0
- package/dist/types/components/DataTable/display/TableComponent.d.ts +6 -0
- package/dist/types/components/DataTable/display/TableDataDisplay.d.ts +6 -0
- package/dist/types/components/DataTable/display/TableFooter.d.ts +5 -0
- package/dist/types/components/DataTable/display/TableHeader.d.ts +51 -0
- package/dist/types/components/DataTable/display/TableLoadingComponent.d.ts +5 -0
- package/dist/types/components/DataTable/display/TextCell.d.ts +10 -0
- package/dist/types/components/DataTable/useDataTable.d.ts +1 -1
- package/dist/types/components/DatePicker/DatePicker.d.ts +23 -0
- package/dist/types/components/DatePicker/DateTimePicker.d.ts +11 -0
- package/dist/types/components/DatePicker/DurationPicker.d.ts +12 -0
- package/dist/types/components/DatePicker/IsoTimePicker.d.ts +16 -0
- package/dist/types/components/DatePicker/PickerDemo.d.ts +1 -0
- package/dist/types/components/DatePicker/UniversalPicker.d.ts +9 -0
- package/dist/types/components/DatePicker/index.d.ts +7 -0
- package/dist/types/components/Filter/TagFilter.d.ts +5 -1
- package/dist/types/components/Form/SchemaFormContext.d.ts +3 -1
- package/dist/types/components/Form/components/core/DefaultForm.d.ts +2 -1
- package/dist/types/components/Form/components/core/FormRoot.d.ts +4 -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/DateTimePicker.d.ts +2 -0
- package/dist/types/components/Form/components/fields/EnumPicker.d.ts +2 -1
- package/dist/types/components/Form/components/fields/FilePicker.d.ts +2 -5
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +2 -5
- package/dist/types/components/Form/components/fields/TextAreaInput.d.ts +12 -0
- package/dist/types/components/Form/components/fields/TimePicker.d.ts +7 -0
- package/dist/types/components/Form/components/fields/types.d.ts +6 -0
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +19 -1
- 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/TextAreaViewer.d.ts +12 -0
- package/dist/types/components/Form/components/viewers/TimeViewer.d.ts +7 -0
- package/dist/types/components/Form/utils/translateWrapper.d.ts +6 -0
- package/dist/types/components/Form/utils/validation.d.ts +104 -0
- package/dist/types/components/TimePicker/TimePicker.d.ts +20 -0
- package/dist/types/index.d.ts +48 -33
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ The datetable package is built on top of `@tanstack/react-table` and `chakra-ui`
|
|
|
8
8
|
npm install @tanstack/react-table @chakra-ui/react @emotion/react @bsol-oss/react-datatable5
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
For form validation features with internationalization support, also install:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install ajv ajv-formats ajv-i18n
|
|
15
|
+
```
|
|
16
|
+
|
|
11
17
|
## Usage
|
|
12
18
|
|
|
13
19
|
### Hook
|
|
@@ -82,6 +88,192 @@ GET http://localhost:8081/api/g/core_people?offset=0&limit=10&sorting[0][id]=id&
|
|
|
82
88
|
</DataTable>
|
|
83
89
|
```
|
|
84
90
|
|
|
91
|
+
### Form Validation with AJV and Internationalization
|
|
92
|
+
|
|
93
|
+
The package now includes built-in JSON Schema validation using AJV (Another JSON Schema Validator) with format support and comprehensive internationalization (i18n) capabilities, including full Traditional Chinese (Hong Kong/Taiwan) support.
|
|
94
|
+
|
|
95
|
+
#### Features
|
|
96
|
+
|
|
97
|
+
- **JSON Schema Validation**: Full JSON Schema Draft 7 support
|
|
98
|
+
- **Format Validation**: Built-in support for date, time, email, UUID, and other formats via `ajv-formats`
|
|
99
|
+
- **Multi-language Support**: Complete i18n support with Traditional Chinese (Hong Kong/Taiwan) and Simplified Chinese
|
|
100
|
+
- **Enhanced Error Messages**: Culturally appropriate error messages in multiple languages
|
|
101
|
+
- **Automatic Validation**: Validation occurs before form submission and confirmation
|
|
102
|
+
- **Custom Error Display**: Collapsible error panels with localized validation feedback
|
|
103
|
+
|
|
104
|
+
#### Supported Languages
|
|
105
|
+
|
|
106
|
+
- **🇺🇸 English (en)** - Default language
|
|
107
|
+
- **🇭🇰 Traditional Chinese - Hong Kong (zh-HK)** - 繁體中文(香港)
|
|
108
|
+
- **🇹🇼 Traditional Chinese - Taiwan (zh-TW)** - 繁體中文(台灣)
|
|
109
|
+
- **🇨🇳 Simplified Chinese (zh-CN, zh)** - 简体中文
|
|
110
|
+
|
|
111
|
+
#### Basic Usage with Internationalization
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { FormRoot, FormBody, validateData, SupportedLocale } from "@bsol-oss/react-datatable5";
|
|
115
|
+
|
|
116
|
+
const schema = {
|
|
117
|
+
type: "object",
|
|
118
|
+
required: ["email", "age"],
|
|
119
|
+
properties: {
|
|
120
|
+
email: {
|
|
121
|
+
type: "string",
|
|
122
|
+
format: "email"
|
|
123
|
+
},
|
|
124
|
+
age: {
|
|
125
|
+
type: "integer",
|
|
126
|
+
minimum: 18,
|
|
127
|
+
maximum: 120
|
|
128
|
+
},
|
|
129
|
+
name: {
|
|
130
|
+
type: "string",
|
|
131
|
+
minLength: 2,
|
|
132
|
+
maxLength: 50
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Use Traditional Chinese (Hong Kong) for validation errors
|
|
138
|
+
<FormRoot
|
|
139
|
+
schema={schema}
|
|
140
|
+
validationLocale="zh-HK"
|
|
141
|
+
/* other props */
|
|
142
|
+
>
|
|
143
|
+
<FormBody />
|
|
144
|
+
</FormRoot>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Language-specific Examples
|
|
148
|
+
|
|
149
|
+
**Traditional Chinese (Hong Kong):**
|
|
150
|
+
```tsx
|
|
151
|
+
<FormRoot
|
|
152
|
+
schema={schema}
|
|
153
|
+
validationLocale="zh-HK"
|
|
154
|
+
/* other props */
|
|
155
|
+
>
|
|
156
|
+
<FormBody />
|
|
157
|
+
</FormRoot>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Traditional Chinese (Taiwan):**
|
|
161
|
+
```tsx
|
|
162
|
+
<FormRoot
|
|
163
|
+
schema={schema}
|
|
164
|
+
validationLocale="zh-TW"
|
|
165
|
+
/* other props */
|
|
166
|
+
>
|
|
167
|
+
<FormBody />
|
|
168
|
+
</FormRoot>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Simplified Chinese:**
|
|
172
|
+
```tsx
|
|
173
|
+
<FormRoot
|
|
174
|
+
schema={schema}
|
|
175
|
+
validationLocale="zh-CN"
|
|
176
|
+
/* other props */
|
|
177
|
+
>
|
|
178
|
+
<FormBody />
|
|
179
|
+
</FormRoot>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### Manual Validation with Internationalization
|
|
183
|
+
|
|
184
|
+
You can also use the validation utilities directly with language support:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { validateData, ValidationResult, SupportedLocale } from "@bsol-oss/react-datatable5";
|
|
188
|
+
|
|
189
|
+
// Validate with Traditional Chinese (Hong Kong) error messages
|
|
190
|
+
const result: ValidationResult = validateData(formData, schema, {
|
|
191
|
+
locale: 'zh-HK'
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
if (!result.isValid) {
|
|
195
|
+
console.log("驗證錯誤:", result.errors);
|
|
196
|
+
// Error messages will be in Traditional Chinese
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Check supported locales
|
|
200
|
+
import { getSupportedLocales, isLocaleSupported } from "@bsol-oss/react-datatable5";
|
|
201
|
+
|
|
202
|
+
const supportedLocales = getSupportedLocales(); // ['en', 'zh-HK', 'zh-TW', 'zh-CN', 'zh']
|
|
203
|
+
const isSupported = isLocaleSupported('zh-HK'); // true
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### Validation Error Structure
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
interface ValidationError {
|
|
210
|
+
field: string; // The field that failed validation
|
|
211
|
+
message: string; // User-friendly error message (localized)
|
|
212
|
+
value?: unknown; // The current value that failed
|
|
213
|
+
schemaPath?: string; // JSON Schema path for debugging
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### Dynamic Language Switching
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { SupportedLocale } from "@bsol-oss/react-datatable5";
|
|
221
|
+
|
|
222
|
+
const MyForm = () => {
|
|
223
|
+
const [locale, setLocale] = useState<SupportedLocale>('zh-HK');
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<div>
|
|
227
|
+
{/* Language selector */}
|
|
228
|
+
<select value={locale} onChange={(e) => setLocale(e.target.value as SupportedLocale)}>
|
|
229
|
+
<option value="en">English</option>
|
|
230
|
+
<option value="zh-HK">繁體中文(香港)</option>
|
|
231
|
+
<option value="zh-TW">繁體中文(台灣)</option>
|
|
232
|
+
<option value="zh-CN">简体中文</option>
|
|
233
|
+
</select>
|
|
234
|
+
|
|
235
|
+
{/* Form with dynamic locale */}
|
|
236
|
+
<FormRoot
|
|
237
|
+
schema={schema}
|
|
238
|
+
validationLocale={locale}
|
|
239
|
+
/* other props */
|
|
240
|
+
>
|
|
241
|
+
<FormBody />
|
|
242
|
+
</FormRoot>
|
|
243
|
+
</div>
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
#### Example Validation Messages
|
|
249
|
+
|
|
250
|
+
**English:**
|
|
251
|
+
- "email is required"
|
|
252
|
+
- "Invalid email format"
|
|
253
|
+
- "Must be at least 18"
|
|
254
|
+
|
|
255
|
+
**Traditional Chinese (Hong Kong/Taiwan):**
|
|
256
|
+
- "email 為必填"
|
|
257
|
+
- "無效的 email 格式"
|
|
258
|
+
- "必須至少為 18"
|
|
259
|
+
|
|
260
|
+
**Simplified Chinese:**
|
|
261
|
+
- "email 为必填"
|
|
262
|
+
- "无效的 email 格式"
|
|
263
|
+
- "必须至少为 18"
|
|
264
|
+
|
|
265
|
+
#### Supported Validation Types
|
|
266
|
+
|
|
267
|
+
- **Type validation**: string, number, integer, boolean, object, array
|
|
268
|
+
- **Format validation**: email, date, time, date-time, uuid, uri, etc.
|
|
269
|
+
- **String constraints**: minLength, maxLength, pattern (regex)
|
|
270
|
+
- **Numeric constraints**: minimum, maximum, multipleOf
|
|
271
|
+
- **Array constraints**: minItems, maxItems, uniqueItems
|
|
272
|
+
- **Object constraints**: required properties, additionalProperties
|
|
273
|
+
- **Enum validation**: restricted value sets
|
|
274
|
+
|
|
275
|
+
All validation types are fully supported across all languages with culturally appropriate translations.
|
|
276
|
+
|
|
85
277
|
For more details of props and examples, please review the stories in storybook platform.
|
|
86
278
|
|
|
87
279
|
## Development
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Row,
|
|
2
|
+
import { Row, RowData, OnChangeFn, Updater, FilterFn, ColumnDef, RowSelectionState, ColumnOrderState, ColumnFiltersState, PaginationState, SortingState, VisibilityState, Table as Table$1, 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 { ImageProps, TableHeaderProps as TableHeaderProps$1,
|
|
6
|
+
import { ImageProps, GridProps, TableRootProps, TableHeaderProps as TableHeaderProps$1, TableRowProps, BoxProps, FlexProps, CardBodyProps, TextProps } from '@chakra-ui/react';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import * as react_i18next from 'react-i18next';
|
|
9
9
|
import { UseTranslationResponse } from 'react-i18next';
|
|
10
10
|
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
11
11
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
12
12
|
import { JSONSchema7 } from 'json-schema';
|
|
13
|
-
import { ForeignKeyProps } from '@/components/Form/components/fields/StringInputField';
|
|
13
|
+
import { ForeignKeyProps as ForeignKeyProps$1 } from '@/components/Form/components/fields/StringInputField';
|
|
14
14
|
import { AxiosRequestConfig } from 'axios';
|
|
15
15
|
import * as react_hook_form from 'react-hook-form';
|
|
16
|
-
import {
|
|
16
|
+
import { UseFormReturn, FieldValues, SubmitHandler } from 'react-hook-form';
|
|
17
17
|
import { RenderProps, Props } from '@bsol-oss/dayzed-react19';
|
|
18
18
|
|
|
19
19
|
interface DensityToggleButtonProps {
|
|
@@ -41,20 +41,11 @@ declare const PageSizeControl: ({ pageSizes, }: PageSizeControlProps) => react_j
|
|
|
41
41
|
|
|
42
42
|
declare const Pagination: () => react_jsx_runtime.JSX.Element;
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
text?: string;
|
|
46
|
-
}
|
|
47
|
-
declare const ResetFilteringButton: ({ text, }: ResetFilteringButtonProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare const ResetFilteringButton: () => react_jsx_runtime.JSX.Element;
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
text?: string;
|
|
51
|
-
}
|
|
52
|
-
declare const ResetSelectionButton: ({ text, }: ResetSelectionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
+
declare const ResetSelectionButton: () => react_jsx_runtime.JSX.Element;
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
text?: string;
|
|
56
|
-
}
|
|
57
|
-
declare const ResetSortingButton: ({ text, }: ResetSortingButtonProps) => react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare const ResetSortingButton: () => react_jsx_runtime.JSX.Element;
|
|
58
49
|
|
|
59
50
|
declare const RowCountText: () => react_jsx_runtime.JSX.Element;
|
|
60
51
|
|
|
@@ -85,23 +76,6 @@ interface ErrorAlertProps {
|
|
|
85
76
|
}
|
|
86
77
|
declare const ErrorAlert: ({ showMessage }: ErrorAlertProps) => react_jsx_runtime.JSX.Element;
|
|
87
78
|
|
|
88
|
-
interface DataTableContext<TData = unknown> {
|
|
89
|
-
table: Table$1<TData>;
|
|
90
|
-
globalFilter: string;
|
|
91
|
-
setGlobalFilter: OnChangeFn<string>;
|
|
92
|
-
type: "client" | "server";
|
|
93
|
-
translate: UseTranslationResponse<any, any>;
|
|
94
|
-
}
|
|
95
|
-
declare const DataTableContext: React$1.Context<DataTableContext<unknown>>;
|
|
96
|
-
|
|
97
|
-
declare const useDataTableContext: <TData>() => DataTableContext<TData>;
|
|
98
|
-
|
|
99
|
-
interface DataDisplayProps {
|
|
100
|
-
variant?: "horizontal" | "stats" | "";
|
|
101
|
-
translate?: UseTranslationResponse<any, any>;
|
|
102
|
-
}
|
|
103
|
-
declare const DataDisplay: ({ variant }: DataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
104
|
-
|
|
105
79
|
type DensityState = "sm" | "md" | "lg";
|
|
106
80
|
interface DensityTableState {
|
|
107
81
|
density: DensityState;
|
|
@@ -170,6 +144,7 @@ interface DataTableProps<TData = unknown> {
|
|
|
170
144
|
setDensity: OnChangeFn<DensityState>;
|
|
171
145
|
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
172
146
|
translate: UseTranslationResponse<any, any>;
|
|
147
|
+
tableLabel?: DataTableLabel;
|
|
173
148
|
}
|
|
174
149
|
/**
|
|
175
150
|
* DataTable will create a context to hold all values to
|
|
@@ -181,7 +156,41 @@ interface DataTableProps<TData = unknown> {
|
|
|
181
156
|
*
|
|
182
157
|
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
183
158
|
*/
|
|
184
|
-
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;
|
|
159
|
+
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;
|
|
160
|
+
|
|
161
|
+
interface DataTableLabel {
|
|
162
|
+
view: string;
|
|
163
|
+
edit: string;
|
|
164
|
+
filterButtonText: string;
|
|
165
|
+
filterTitle: string;
|
|
166
|
+
filterReset: string;
|
|
167
|
+
filterClose: string;
|
|
168
|
+
reloadTooltip: string;
|
|
169
|
+
reloadButtonText: string;
|
|
170
|
+
resetSelection: string;
|
|
171
|
+
resetSorting: string;
|
|
172
|
+
rowCountText: string;
|
|
173
|
+
hasErrorText: string;
|
|
174
|
+
globalFilterPlaceholder: string;
|
|
175
|
+
trueLabel: string;
|
|
176
|
+
falseLabel: string;
|
|
177
|
+
}
|
|
178
|
+
interface DataTableContextProps<TData = unknown> extends DataTableProps {
|
|
179
|
+
table: Table$1<TData>;
|
|
180
|
+
globalFilter: string;
|
|
181
|
+
setGlobalFilter: OnChangeFn<string>;
|
|
182
|
+
type: "client" | "server";
|
|
183
|
+
translate: UseTranslationResponse<any, unknown>;
|
|
184
|
+
tableLabel: DataTableLabel;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
declare const useDataTableContext: <TData>() => DataTableContextProps<TData>;
|
|
188
|
+
|
|
189
|
+
interface DataDisplayProps {
|
|
190
|
+
variant?: "horizontal" | "stats" | "";
|
|
191
|
+
translate?: UseTranslationResponse<any, any>;
|
|
192
|
+
}
|
|
193
|
+
declare const DataDisplay: ({ variant }: DataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
185
194
|
|
|
186
195
|
interface DataTableDefaultState {
|
|
187
196
|
sorting?: SortingState;
|
|
@@ -276,6 +285,7 @@ interface DataTableServerProps<TData extends DataResponse = DataResponse<unknown
|
|
|
276
285
|
query: UseQueryResult<TData>;
|
|
277
286
|
url: string;
|
|
278
287
|
translate: UseTranslationResponse<any, any>;
|
|
288
|
+
tableLabel: DataTableLabel;
|
|
279
289
|
}
|
|
280
290
|
/**
|
|
281
291
|
* DataTableServer will create a context to hold all values to
|
|
@@ -288,28 +298,7 @@ interface DataTableServerProps<TData extends DataResponse = DataResponse<unknown
|
|
|
288
298
|
*
|
|
289
299
|
* @link https://tanstack.com/table/latest/docs/guide/column-defs
|
|
290
300
|
*/
|
|
291
|
-
declare function DataTableServer<TData extends DataResponse = DataResponse<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, }: DataTableServerProps<TData>): react_jsx_runtime.JSX.Element;
|
|
292
|
-
|
|
293
|
-
interface TableBodyProps {
|
|
294
|
-
pinnedBgColor?: {
|
|
295
|
-
light: string;
|
|
296
|
-
dark: string;
|
|
297
|
-
};
|
|
298
|
-
showSelector?: boolean;
|
|
299
|
-
alwaysShowSelector?: boolean;
|
|
300
|
-
canResize?: boolean;
|
|
301
|
-
}
|
|
302
|
-
interface TableRowSelectorProps<TData> {
|
|
303
|
-
index: number;
|
|
304
|
-
row: Row<TData>;
|
|
305
|
-
hoveredRow: number;
|
|
306
|
-
pinnedBgColor?: {
|
|
307
|
-
light: string;
|
|
308
|
-
dark: string;
|
|
309
|
-
};
|
|
310
|
-
alwaysShowSelector?: boolean;
|
|
311
|
-
}
|
|
312
|
-
declare const TableBody: ({ pinnedBgColor, showSelector, alwaysShowSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
301
|
+
declare function DataTableServer<TData extends DataResponse = DataResponse<unknown>>({ columns, enableRowSelection, enableMultiRowSelection, enableSubRowSelection, columnOrder, columnFilters, columnVisibility, density, globalFilter, pagination, sorting, rowSelection, setPagination, setSorting, setColumnFilters, setRowSelection, setGlobalFilter, setColumnOrder, setDensity, setColumnVisibility, query, url, translate, children, tableLabel, }: DataTableServerProps<TData>): react_jsx_runtime.JSX.Element;
|
|
313
302
|
|
|
314
303
|
interface TableControlsProps {
|
|
315
304
|
totalText?: string;
|
|
@@ -325,69 +314,130 @@ interface TableControlsProps {
|
|
|
325
314
|
showPageSizeControl?: boolean;
|
|
326
315
|
showPageCountText?: boolean;
|
|
327
316
|
showView?: boolean;
|
|
328
|
-
|
|
317
|
+
filterTagsOptions?: {
|
|
318
|
+
column: string;
|
|
319
|
+
options: {
|
|
320
|
+
label: string;
|
|
321
|
+
value: string;
|
|
322
|
+
}[];
|
|
323
|
+
}[];
|
|
329
324
|
extraItems?: ReactNode;
|
|
330
325
|
loading?: boolean;
|
|
331
326
|
hasError?: boolean;
|
|
327
|
+
gridProps?: GridProps;
|
|
332
328
|
}
|
|
333
|
-
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView,
|
|
329
|
+
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: TableControlsProps) => react_jsx_runtime.JSX.Element;
|
|
334
330
|
|
|
335
|
-
interface
|
|
331
|
+
interface TableProps extends TableRootProps {
|
|
332
|
+
showLoading?: boolean;
|
|
333
|
+
loadingComponent?: ReactNode;
|
|
334
|
+
emptyComponent?: ReactNode;
|
|
335
|
+
canResize?: boolean;
|
|
336
|
+
children: ReactNode;
|
|
337
|
+
}
|
|
338
|
+
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;
|
|
339
|
+
|
|
340
|
+
interface TableBodyProps {
|
|
336
341
|
pinnedBgColor?: {
|
|
337
342
|
light: string;
|
|
338
343
|
dark: string;
|
|
339
344
|
};
|
|
340
345
|
showSelector?: boolean;
|
|
341
346
|
alwaysShowSelector?: boolean;
|
|
342
|
-
}
|
|
343
|
-
declare const TableFooter: ({ pinnedBgColor, showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
344
|
-
|
|
345
|
-
interface TableHeaderProps {
|
|
346
347
|
canResize?: boolean;
|
|
348
|
+
}
|
|
349
|
+
interface TableRowSelectorProps<TData> {
|
|
350
|
+
index: number;
|
|
351
|
+
row: Row<TData>;
|
|
352
|
+
hoveredRow: number;
|
|
347
353
|
pinnedBgColor?: {
|
|
348
354
|
light: string;
|
|
349
355
|
dark: string;
|
|
350
356
|
};
|
|
357
|
+
}
|
|
358
|
+
declare const TableBody: ({ showSelector, canResize, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
359
|
+
|
|
360
|
+
interface TableFooterProps {
|
|
351
361
|
showSelector?: boolean;
|
|
352
|
-
isSticky?: boolean;
|
|
353
362
|
alwaysShowSelector?: boolean;
|
|
354
|
-
tHeadProps?: TableHeaderProps$1;
|
|
355
363
|
}
|
|
356
|
-
declare const
|
|
364
|
+
declare const TableFooter: ({ showSelector, alwaysShowSelector, }: TableFooterProps) => react_jsx_runtime.JSX.Element;
|
|
357
365
|
|
|
358
|
-
interface
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
366
|
+
interface TableHeaderTexts {
|
|
367
|
+
pinColumn?: string;
|
|
368
|
+
cancelPin?: string;
|
|
369
|
+
sortAscending?: string;
|
|
370
|
+
sortDescending?: string;
|
|
371
|
+
clearSorting?: string;
|
|
372
|
+
}
|
|
373
|
+
interface TableHeaderProps {
|
|
362
374
|
canResize?: boolean;
|
|
363
|
-
|
|
375
|
+
showSelector?: boolean;
|
|
376
|
+
isSticky?: boolean;
|
|
377
|
+
tableHeaderProps?: TableHeaderProps$1;
|
|
378
|
+
tableRowProps?: TableRowProps;
|
|
379
|
+
/**
|
|
380
|
+
* Default text configuration for all columns.
|
|
381
|
+
* Can be overridden per column via meta.headerTexts.
|
|
382
|
+
*/
|
|
383
|
+
defaultTexts?: TableHeaderTexts;
|
|
364
384
|
}
|
|
365
|
-
|
|
385
|
+
/**
|
|
386
|
+
* TableHeader component with configurable text strings.
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* // Using default texts
|
|
390
|
+
* <TableHeader />
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* // Customizing default texts for all columns
|
|
394
|
+
* <TableHeader
|
|
395
|
+
* defaultTexts={{
|
|
396
|
+
* pinColumn: "Pin This Column",
|
|
397
|
+
* sortAscending: "Sort A-Z"
|
|
398
|
+
* }}
|
|
399
|
+
* />
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* // Customizing texts per column via meta
|
|
403
|
+
* const columns = [
|
|
404
|
+
* columnHelper.accessor("name", {
|
|
405
|
+
* header: "Name",
|
|
406
|
+
* meta: {
|
|
407
|
+
* headerTexts: {
|
|
408
|
+
* pinColumn: "Pin Name Column",
|
|
409
|
+
* sortAscending: "Sort Names A-Z"
|
|
410
|
+
* }
|
|
411
|
+
* }
|
|
412
|
+
* })
|
|
413
|
+
* ];
|
|
414
|
+
*/
|
|
415
|
+
declare const TableHeader: ({ canResize, showSelector, isSticky, tableHeaderProps, tableRowProps, defaultTexts, }: TableHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
366
416
|
|
|
367
417
|
interface DefaultTableProps {
|
|
368
418
|
showFooter?: boolean;
|
|
369
|
-
showSelector?: boolean;
|
|
370
419
|
tableProps?: Omit<TableProps, "children">;
|
|
371
|
-
tHeadProps?: TableHeaderProps$1;
|
|
372
|
-
controlProps?: TableControlsProps;
|
|
373
|
-
tableFooterProps?: TableFooterProps;
|
|
374
|
-
tableBodyProps?: TableBodyProps;
|
|
375
420
|
tableHeaderProps?: TableHeaderProps;
|
|
421
|
+
tableBodyProps?: TableBodyProps;
|
|
422
|
+
tableFooterProps?: TableFooterProps;
|
|
423
|
+
controlProps?: TableControlsProps;
|
|
376
424
|
variant?: "" | "greedy";
|
|
377
425
|
}
|
|
378
|
-
declare const DefaultTable: ({ showFooter, tableProps, tableHeaderProps, tableBodyProps,
|
|
426
|
+
declare const DefaultTable: ({ showFooter, tableProps, tableHeaderProps, tableBodyProps, tableFooterProps, controlProps, variant, }: DefaultTableProps) => react_jsx_runtime.JSX.Element;
|
|
379
427
|
|
|
380
428
|
interface ReloadButtonProps {
|
|
381
|
-
text?: string;
|
|
382
429
|
variant?: string;
|
|
383
430
|
}
|
|
384
|
-
declare const ReloadButton: ({
|
|
431
|
+
declare const ReloadButton: ({ variant, }: ReloadButtonProps) => react_jsx_runtime.JSX.Element;
|
|
385
432
|
|
|
386
|
-
interface TableCardContainerProps extends
|
|
433
|
+
interface TableCardContainerProps extends BoxProps {
|
|
387
434
|
children: ReactNode;
|
|
388
435
|
variant?: "carousel" | "";
|
|
436
|
+
gap?: string;
|
|
437
|
+
gridTemplateColumns?: string;
|
|
438
|
+
direction?: FlexProps["direction"];
|
|
389
439
|
}
|
|
390
|
-
declare const TableCardContainer: ({ children, variant, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
440
|
+
declare const TableCardContainer: ({ children, variant, gap, gridTemplateColumns, direction, ...props }: TableCardContainerProps) => react_jsx_runtime.JSX.Element;
|
|
391
441
|
|
|
392
442
|
interface TableCardsProps<TData> {
|
|
393
443
|
isSelectable?: boolean;
|
|
@@ -441,15 +491,47 @@ interface GetColumnsConfigs<K extends RowData> {
|
|
|
441
491
|
declare const widthSanityCheck: <K extends unknown>(widthList: number[], ignoreList: K[], properties: { [key in K as string]?: object | undefined; }) => void;
|
|
442
492
|
declare const getColumns: <TData extends unknown>({ schema, include, ignore, width, meta, defaultWidth, translate, }: GetColumnsConfigs<TData>) => ColumnDef<TData>[];
|
|
443
493
|
|
|
444
|
-
interface
|
|
445
|
-
|
|
494
|
+
interface TableDataDisplayProps {
|
|
495
|
+
colorPalette?: string;
|
|
496
|
+
emptyComponent?: ReactNode;
|
|
446
497
|
}
|
|
447
|
-
declare const
|
|
498
|
+
declare const TableDataDisplay: ({ colorPalette, emptyComponent, }: TableDataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
448
499
|
|
|
449
500
|
declare const GlobalFilter: () => react_jsx_runtime.JSX.Element;
|
|
450
501
|
|
|
502
|
+
interface ForeignKeyProps {
|
|
503
|
+
column: string;
|
|
504
|
+
table: string;
|
|
505
|
+
display_column: string;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
interface CustomJSONSchema7 extends JSONSchema7 {
|
|
509
|
+
gridColumn?: string;
|
|
510
|
+
gridRow?: string;
|
|
511
|
+
foreign_key?: ForeignKeyProps;
|
|
512
|
+
variant?: string;
|
|
513
|
+
renderDisplay?: (item: unknown) => ReactNode;
|
|
514
|
+
inputRender?: (props: {
|
|
515
|
+
column: string;
|
|
516
|
+
schema: CustomJSONSchema7;
|
|
517
|
+
prefix: string;
|
|
518
|
+
formContext: UseFormReturn;
|
|
519
|
+
}) => ReactNode;
|
|
520
|
+
inputViewerRender?: (props: {
|
|
521
|
+
column: string;
|
|
522
|
+
schema: CustomJSONSchema7;
|
|
523
|
+
prefix: string;
|
|
524
|
+
formContext: UseFormReturn;
|
|
525
|
+
}) => ReactNode;
|
|
526
|
+
dateFormat?: string;
|
|
527
|
+
displayDateFormat?: string;
|
|
528
|
+
timeFormat?: string;
|
|
529
|
+
displayTimeFormat?: string;
|
|
530
|
+
showLabel?: boolean;
|
|
531
|
+
}
|
|
532
|
+
|
|
451
533
|
interface FormRootProps<TData extends FieldValues> {
|
|
452
|
-
schema:
|
|
534
|
+
schema: CustomJSONSchema7;
|
|
453
535
|
serverUrl: string;
|
|
454
536
|
requestUrl?: string;
|
|
455
537
|
idMap: Record<string, object>;
|
|
@@ -464,6 +546,7 @@ interface FormRootProps<TData extends FieldValues> {
|
|
|
464
546
|
rowNumber?: number | string;
|
|
465
547
|
requestOptions?: AxiosRequestConfig;
|
|
466
548
|
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
549
|
+
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
467
550
|
}
|
|
468
551
|
interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
469
552
|
variant: string;
|
|
@@ -472,7 +555,7 @@ interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
|
472
555
|
display_column: string;
|
|
473
556
|
gridColumn: string;
|
|
474
557
|
gridRow: string;
|
|
475
|
-
foreign_key: ForeignKeyProps;
|
|
558
|
+
foreign_key: ForeignKeyProps$1;
|
|
476
559
|
children: ReactNode;
|
|
477
560
|
}
|
|
478
561
|
declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
@@ -480,12 +563,13 @@ declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
|
480
563
|
column?: string | undefined;
|
|
481
564
|
display_column?: string | undefined;
|
|
482
565
|
} | undefined) => void;
|
|
483
|
-
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;
|
|
566
|
+
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
484
567
|
|
|
485
568
|
interface DefaultFormProps<TData extends FieldValues> {
|
|
486
569
|
formConfig: Omit<FormRootProps<TData>, "children">;
|
|
570
|
+
showTitle?: boolean;
|
|
487
571
|
}
|
|
488
|
-
declare const DefaultForm: <TData extends FieldValues>({ formConfig, }: DefaultFormProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
572
|
+
declare const DefaultForm: <TData extends FieldValues>({ formConfig, showTitle, }: DefaultFormProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
489
573
|
|
|
490
574
|
declare const FormTitle: () => react_jsx_runtime.JSX.Element;
|
|
491
575
|
|
|
@@ -516,6 +600,29 @@ interface GetVariantProps {
|
|
|
516
600
|
selectable: boolean;
|
|
517
601
|
}
|
|
518
602
|
interface DatePickerProps extends Props {
|
|
603
|
+
onDateSelected?: (obj: {
|
|
604
|
+
date: Date;
|
|
605
|
+
}) => void;
|
|
606
|
+
selected: Date | Date[];
|
|
607
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
608
|
+
showOutsideDays?: boolean;
|
|
609
|
+
date?: Date;
|
|
610
|
+
minDate?: Date;
|
|
611
|
+
maxDate?: Date;
|
|
612
|
+
monthsToDisplay?: number;
|
|
613
|
+
labels?: {
|
|
614
|
+
monthNamesShort: string[];
|
|
615
|
+
weekdayNamesShort: string[];
|
|
616
|
+
backButtonLabel?: string;
|
|
617
|
+
forwardButtonLabel?: string;
|
|
618
|
+
};
|
|
619
|
+
render?: (dayzedData: any) => React__default.ReactNode;
|
|
620
|
+
}
|
|
621
|
+
interface DatePickerLabels {
|
|
622
|
+
monthNamesShort: string[];
|
|
623
|
+
weekdayNamesShort: string[];
|
|
624
|
+
backButtonLabel?: string;
|
|
625
|
+
forwardButtonLabel?: string;
|
|
519
626
|
}
|
|
520
627
|
|
|
521
628
|
interface GetMultiDatesProps {
|
|
@@ -566,6 +673,17 @@ declare module "@tanstack/react-table" {
|
|
|
566
673
|
* The display name of the column, used for rendering headers.
|
|
567
674
|
*/
|
|
568
675
|
displayName?: string;
|
|
676
|
+
/**
|
|
677
|
+
* Text configuration for the column header menu items.
|
|
678
|
+
* These strings can be customized per column.
|
|
679
|
+
*/
|
|
680
|
+
headerTexts?: {
|
|
681
|
+
pinColumn?: string;
|
|
682
|
+
cancelPin?: string;
|
|
683
|
+
sortAscending?: string;
|
|
684
|
+
sortDescending?: string;
|
|
685
|
+
clearSorting?: string;
|
|
686
|
+
};
|
|
569
687
|
/**
|
|
570
688
|
* Specifies the type of filter to be used for the column.
|
|
571
689
|
*
|
|
@@ -586,7 +704,10 @@ declare module "@tanstack/react-table" {
|
|
|
586
704
|
/**
|
|
587
705
|
* Options for the select filter variant, if applicable.
|
|
588
706
|
*/
|
|
589
|
-
filterOptions?:
|
|
707
|
+
filterOptions?: {
|
|
708
|
+
label: string;
|
|
709
|
+
value: string;
|
|
710
|
+
}[];
|
|
590
711
|
/**
|
|
591
712
|
* Configuration for the range filter variant, if applicable.
|
|
592
713
|
*
|
|
@@ -612,4 +733,4 @@ declare module "@tanstack/react-table" {
|
|
|
612
733
|
}
|
|
613
734
|
}
|
|
614
735
|
|
|
615
|
-
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, FilterDialog,
|
|
736
|
+
export { type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, type DatePickerLabels, 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, FilterDialog, FormBody, FormRoot, type FormRootProps, FormTitle, type GetColumnsConfigs, type GetDateColorProps, type GetMultiDatesProps, type GetRangeDatesProps, type GetStyleProps, type GetVariantProps, GlobalFilter, PageSizeControl, type PageSizeControlProps, Pagination, type RangeCalendarProps, type RangeDatePickerProps, RecordDisplay, type RecordDisplayProps, ReloadButton, type ReloadButtonProps, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, type Result, RowCountText, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableDataDisplay, type TableDataDisplayProps, TableFilter, TableFilterTags, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, type TableHeaderTexts, TableLoadingComponent, type TableLoadingComponentProps, type TableProps, type TableRendererProps, type TableRowSelectorProps, TableSelector, TableSorter, TableViewer, TextCell, type TextCellProps, type UseDataTableProps, type UseDataTableReturn, type UseDataTableServerProps, type UseDataTableServerReturn, type UseFormProps, ViewDialog, getColumns, getMultiDates, getRangeDates, idPickerSanityCheck, useDataTable, useDataTableContext, useDataTableServer, useForm, widthSanityCheck };
|