@bsol-oss/react-datatable5 12.0.0-beta.9 → 12.0.0-beta.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +225 -5
- package/dist/index.d.ts +871 -258
- package/dist/index.js +4116 -1238
- package/dist/index.mjs +4203 -1332
- package/dist/types/components/DataTable/DataTable.d.ts +12 -7
- package/dist/types/components/DataTable/DataTableServer.d.ts +6 -4
- package/dist/types/components/DataTable/DefaultTable.d.ts +12 -14
- package/dist/types/components/DataTable/DefaultTableServer.d.ts +23 -0
- package/dist/types/components/DataTable/context/DataTableContext.d.ts +21 -3
- package/dist/types/components/DataTable/context/useDataTableContext.d.ts +2 -2
- package/dist/types/components/DataTable/controls/DensityFeature.d.ts +3 -3
- package/dist/types/components/DataTable/controls/ReloadButton.d.ts +1 -2
- package/dist/types/components/DataTable/controls/ResetFilteringButton.d.ts +1 -4
- package/dist/types/components/DataTable/controls/ResetSelectionButton.d.ts +1 -4
- package/dist/types/components/DataTable/controls/ResetSortingButton.d.ts +1 -4
- package/dist/types/components/DataTable/controls/SelectAllRowsToggle.d.ts +1 -1
- package/dist/types/components/DataTable/controls/TableControls.d.ts +10 -2
- package/dist/types/components/DataTable/display/DataDisplay.d.ts +2 -2
- package/dist/types/components/DataTable/display/Table.d.ts +4 -3
- package/dist/types/components/DataTable/display/TableBody.d.ts +2 -3
- package/dist/types/components/DataTable/display/TableBodySkeleton.d.ts +5 -0
- package/dist/types/components/DataTable/display/TableCardContainer.d.ts +6 -3
- package/dist/types/components/DataTable/display/TableCards.d.ts +3 -3
- package/dist/types/components/DataTable/display/TableDataDisplay.d.ts +3 -1
- package/dist/types/components/DataTable/display/TableFooter.d.ts +1 -5
- package/dist/types/components/DataTable/display/TableHeader.d.ts +46 -8
- package/dist/types/components/DataTable/hooks/useResponsiveColumnVisibility.d.ts +13 -0
- package/dist/types/components/DataTable/useDataTableServer.d.ts +55 -3
- package/dist/types/components/DataTable/utils/selectors.d.ts +53 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +23 -0
- package/dist/types/components/DatePicker/DateTimePicker.d.ts +12 -0
- package/dist/types/components/DatePicker/DurationPicker.d.ts +12 -0
- package/dist/types/components/DatePicker/IsoTimePicker.d.ts +19 -0
- package/dist/types/components/DatePicker/PickerDemo.d.ts +1 -0
- package/dist/types/components/DatePicker/RangeDatePicker.d.ts +61 -5
- package/dist/types/components/DatePicker/UniversalPicker.d.ts +9 -0
- package/dist/types/components/DatePicker/index.d.ts +7 -0
- package/dist/types/components/Filter/TagFilter.d.ts +6 -2
- package/dist/types/components/Form/SchemaFormContext.d.ts +23 -6
- package/dist/types/components/Form/components/FileDropzone.d.ts +2 -2
- package/dist/types/components/Form/components/MediaLibraryBrowser.d.ts +22 -0
- package/dist/types/components/Form/components/core/DefaultForm.d.ts +1 -0
- package/dist/types/components/Form/components/core/FormBody.d.ts +2 -1
- package/dist/types/components/Form/components/core/FormRoot.d.ts +22 -8
- package/dist/types/components/Form/components/fields/BooleanPicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/ColumnRenderer.d.ts +3 -2
- package/dist/types/components/Form/components/fields/CustomInput.d.ts +8 -0
- package/dist/types/components/Form/components/fields/DatePicker.d.ts +2 -7
- package/dist/types/components/Form/components/fields/DateRangePicker.d.ts +2 -0
- package/dist/types/components/Form/components/fields/DateTimePicker.d.ts +2 -0
- package/dist/types/components/Form/components/fields/EnumPicker.d.ts +3 -2
- package/dist/types/components/Form/components/fields/FilePicker.d.ts +18 -5
- package/dist/types/components/Form/components/fields/FormMediaLibraryBrowser.d.ts +2 -0
- package/dist/types/components/Form/components/fields/IdPicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/NumberInputField.d.ts +1 -1
- package/dist/types/components/Form/components/fields/ObjectInput.d.ts +1 -1
- package/dist/types/components/Form/components/fields/RecordInput.d.ts +1 -1
- package/dist/types/components/Form/components/fields/SchemaRenderer.d.ts +1 -1
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +23 -5
- package/dist/types/components/Form/components/fields/TextAreaInput.d.ts +12 -0
- package/dist/types/components/Form/components/{DatePicker.d.ts → fields/TimePicker.d.ts} +2 -2
- package/dist/types/components/Form/components/fields/types.d.ts +6 -0
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +83 -4
- package/dist/types/components/Form/components/viewers/CustomViewer.d.ts +8 -0
- package/dist/types/components/Form/components/viewers/DateTimeViewer.d.ts +7 -0
- package/dist/types/components/Form/components/viewers/NumberViewer.d.ts +1 -1
- package/dist/types/components/Form/components/viewers/SchemaViewer.d.ts +1 -1
- package/dist/types/components/Form/components/viewers/TextAreaViewer.d.ts +12 -0
- package/dist/types/components/Form/components/viewers/TimeViewer.d.ts +7 -0
- package/dist/types/components/Form/useForm.d.ts +6 -3
- package/dist/types/components/Form/utils/ajvResolver.d.ts +13 -0
- package/dist/types/components/Form/utils/buildErrorMessages.d.ts +223 -0
- package/dist/types/components/Form/utils/formatBytes.d.ts +6 -0
- package/dist/types/components/Form/utils/getFieldError.d.ts +6 -0
- package/dist/types/components/Form/utils/useFormI18n.d.ts +53 -0
- package/dist/types/components/Form/utils/validateData.d.ts +9 -0
- package/dist/types/components/TextArea/TextArea.d.ts +22 -0
- package/dist/types/components/TimePicker/TimePicker.d.ts +23 -0
- package/dist/types/components/ui/field.d.ts +3 -3
- package/dist/types/index.d.ts +81 -55
- package/package.json +24 -13
- package/dist/types/components/Controls/DensityFeature.d.ts +0 -23
- package/dist/types/components/Controls/DensityToggleButton.d.ts +0 -6
- package/dist/types/components/Controls/EditFilterButton.d.ts +0 -9
- package/dist/types/components/Controls/EditOrderButton.d.ts +0 -7
- package/dist/types/components/Controls/EditSortingButton.d.ts +0 -7
- package/dist/types/components/Controls/EditViewButton.d.ts +0 -7
- package/dist/types/components/Controls/FilterDialog.d.ts +0 -5
- package/dist/types/components/Controls/PageSizeControl.d.ts +0 -4
- package/dist/types/components/Controls/Pagination.d.ts +0 -1
- package/dist/types/components/Controls/ResetFilteringButton.d.ts +0 -4
- package/dist/types/components/Controls/ResetSelectionButton.d.ts +0 -4
- package/dist/types/components/Controls/ResetSortingButton.d.ts +0 -4
- package/dist/types/components/Controls/RowCountText.d.ts +0 -1
- package/dist/types/components/Controls/SelectAllRowsToggle.d.ts +0 -8
- package/dist/types/components/Controls/TablePagination.d.ts +0 -1
- package/dist/types/components/Controls/ViewDialog.d.ts +0 -5
- package/dist/types/components/DataTable/CardHeader.d.ts +0 -13
- package/dist/types/components/DataTable/DataDisplay.d.ts +0 -6
- package/dist/types/components/DataTable/ReloadButton.d.ts +0 -5
- package/dist/types/components/DataTable/Table.d.ts +0 -10
- package/dist/types/components/DataTable/TableBody.d.ts +0 -21
- package/dist/types/components/DataTable/TableCardContainer.d.ts +0 -7
- package/dist/types/components/DataTable/TableCards.d.ts +0 -11
- package/dist/types/components/DataTable/TableComponent.d.ts +0 -6
- package/dist/types/components/DataTable/TableControls.d.ts +0 -21
- package/dist/types/components/DataTable/TableFilter.d.ts +0 -1
- package/dist/types/components/DataTable/TableFilterTags.d.ts +0 -1
- package/dist/types/components/DataTable/TableFilters.d.ts +0 -1
- package/dist/types/components/DataTable/TableFooter.d.ts +0 -9
- package/dist/types/components/DataTable/TableHeader.d.ts +0 -13
- package/dist/types/components/DataTable/TableLoadingComponent.d.ts +0 -5
- package/dist/types/components/DataTable/TableOrderer.d.ts +0 -1
- package/dist/types/components/DataTable/TableSelector.d.ts +0 -1
- package/dist/types/components/DataTable/TableSorter.d.ts +0 -1
- package/dist/types/components/DataTable/TableViewer.d.ts +0 -1
- package/dist/types/components/DataTable/TextCell.d.ts +0 -10
- package/dist/types/components/DataTable/components/EmptyState.d.ts +0 -5
- package/dist/types/components/DataTable/components/ErrorAlert.d.ts +0 -4
- package/dist/types/components/DataTable/components/RecordDisplay.d.ts +0 -9
- package/dist/types/components/DataTable/components/TextCell.d.ts +0 -10
- package/dist/types/components/Filter/DateRangeFilter.d.ts +0 -9
- package/dist/types/components/Filter/FilterOptions.d.ts +0 -4
- package/dist/types/components/Form/Form.d.ts +0 -36
- package/dist/types/components/Form/components/ArrayRenderer.d.ts +0 -7
- package/dist/types/components/Form/components/BooleanPicker.d.ts +0 -7
- package/dist/types/components/Form/components/ColumnRenderer.d.ts +0 -7
- package/dist/types/components/Form/components/EnumPicker.d.ts +0 -8
- package/dist/types/components/Form/components/FilePicker.d.ts +0 -5
- package/dist/types/components/Form/components/IdPicker.d.ts +0 -8
- package/dist/types/components/Form/components/IdViewer.d.ts +0 -5
- package/dist/types/components/Form/components/NumberInputField.d.ts +0 -7
- package/dist/types/components/Form/components/ObjectInput.d.ts +0 -7
- package/dist/types/components/Form/components/RecordInput.d.ts +0 -7
- package/dist/types/components/Form/components/SchemaRenderer.d.ts +0 -7
- package/dist/types/components/Form/components/StringInputField.d.ts +0 -20
- package/dist/types/components/Form/components/TagPicker.d.ts +0 -30
- package/dist/types/components/ui/popover.d.ts +0 -17
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for error message configuration
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Common validation error types that can be customized
|
|
6
|
+
*/
|
|
7
|
+
export type ValidationErrorType = 'minLength' | 'maxLength' | 'pattern' | 'minimum' | 'maximum' | 'multipleOf' | 'format' | 'type' | 'enum' | 'required' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minProperties' | 'maxProperties' | 'anyOf' | 'oneOf' | 'allOf' | 'const' | 'additionalProperties' | 'dependencies';
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for field-specific validation errors
|
|
10
|
+
*/
|
|
11
|
+
export type FieldErrorConfig = Partial<Record<ValidationErrorType, string>>;
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for building error messages
|
|
14
|
+
*/
|
|
15
|
+
export interface ErrorMessageConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Required field error messages
|
|
18
|
+
* Maps field names to their required error messages
|
|
19
|
+
* Supports both plain strings and i18n translation keys
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* required: {
|
|
24
|
+
* username: "Username is required", // plain string
|
|
25
|
+
* email: "user.email.field_required" // i18n key
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
required?: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Field-specific validation error messages
|
|
32
|
+
* Maps field names to their validation error configurations
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* properties: {
|
|
37
|
+
* username: {
|
|
38
|
+
* minLength: "Username must be at least 3 characters",
|
|
39
|
+
* pattern: "Username can only contain letters and numbers"
|
|
40
|
+
* },
|
|
41
|
+
* age: {
|
|
42
|
+
* minimum: "Age must be at least 18",
|
|
43
|
+
* maximum: "Age cannot exceed 120"
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
properties?: Record<string, FieldErrorConfig>;
|
|
49
|
+
/**
|
|
50
|
+
* Global fallback error messages for validation types
|
|
51
|
+
* These are used when no field-specific message is provided
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* {
|
|
56
|
+
* minLength: "This field is too short",
|
|
57
|
+
* minimum: "Value is too small"
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Result of buildErrorMessages that follows ajv-errors format
|
|
65
|
+
*/
|
|
66
|
+
export interface ErrorMessageResult {
|
|
67
|
+
required?: Record<string, string>;
|
|
68
|
+
properties?: Record<string, FieldErrorConfig>;
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Schema-level error message builder
|
|
73
|
+
*
|
|
74
|
+
* Builds a complete errorMessage object compatible with ajv-errors plugin.
|
|
75
|
+
* Supports both i18n translation keys and plain string messages.
|
|
76
|
+
*
|
|
77
|
+
* @param config - Error message configuration
|
|
78
|
+
* @returns Complete errorMessage object for JSON Schema
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* // Simple required field errors
|
|
83
|
+
* const errorMessage = buildErrorMessages({
|
|
84
|
+
* required: {
|
|
85
|
+
* username: "Username is required",
|
|
86
|
+
* email: "user.email.field_required" // i18n key
|
|
87
|
+
* }
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* // With validation rules
|
|
91
|
+
* const errorMessage = buildErrorMessages({
|
|
92
|
+
* required: {
|
|
93
|
+
* password: "Password is required"
|
|
94
|
+
* },
|
|
95
|
+
* properties: {
|
|
96
|
+
* password: {
|
|
97
|
+
* minLength: "Password must be at least 8 characters",
|
|
98
|
+
* pattern: "Password must contain letters and numbers"
|
|
99
|
+
* },
|
|
100
|
+
* age: {
|
|
101
|
+
* minimum: "Must be 18 or older",
|
|
102
|
+
* maximum: "Must be under 120"
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* // With global fallbacks
|
|
108
|
+
* const errorMessage = buildErrorMessages({
|
|
109
|
+
* required: {
|
|
110
|
+
* email: "Email is required"
|
|
111
|
+
* },
|
|
112
|
+
* minLength: "This field is too short", // applies to all fields
|
|
113
|
+
* minimum: "Value is too small"
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare const buildErrorMessages: (config: ErrorMessageConfig) => ErrorMessageResult;
|
|
118
|
+
/**
|
|
119
|
+
* Converts buildErrorMessages result to ajv-errors compatible format
|
|
120
|
+
*/
|
|
121
|
+
export declare const convertToAjvErrorsFormat: (errorMessages: ErrorMessageResult) => Record<string, any>;
|
|
122
|
+
/**
|
|
123
|
+
* Helper function to build required field errors
|
|
124
|
+
*
|
|
125
|
+
* Simplifies creating required field error messages, especially useful
|
|
126
|
+
* for generating i18n translation keys following a pattern.
|
|
127
|
+
*
|
|
128
|
+
* @param fields - Array of required field names
|
|
129
|
+
* @param messageOrGenerator - Either a string template or function to generate messages
|
|
130
|
+
* @returns Required field error configuration
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* // Plain string messages
|
|
135
|
+
* const required = buildRequiredErrors(
|
|
136
|
+
* ["username", "email", "password"],
|
|
137
|
+
* (field) => `${field} is required`
|
|
138
|
+
* );
|
|
139
|
+
* // Result: { username: "username is required", email: "email is required", ... }
|
|
140
|
+
*
|
|
141
|
+
* // i18n translation keys
|
|
142
|
+
* const required = buildRequiredErrors(
|
|
143
|
+
* ["username", "email"],
|
|
144
|
+
* (field) => `user.${field}.field_required`
|
|
145
|
+
* );
|
|
146
|
+
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
147
|
+
*
|
|
148
|
+
* // Same message for all fields
|
|
149
|
+
* const required = buildRequiredErrors(
|
|
150
|
+
* ["username", "email"],
|
|
151
|
+
* "This field is required"
|
|
152
|
+
* );
|
|
153
|
+
* // Result: { username: "This field is required", email: "This field is required" }
|
|
154
|
+
*
|
|
155
|
+
* // With keyPrefix for i18n
|
|
156
|
+
* const required = buildRequiredErrors(
|
|
157
|
+
* ["username", "email"],
|
|
158
|
+
* (field) => `${field}.field_required`,
|
|
159
|
+
* "user"
|
|
160
|
+
* );
|
|
161
|
+
* // Result: { username: "user.username.field_required", email: "user.email.field_required" }
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export declare const buildRequiredErrors: (fields: string[], messageOrGenerator: string | ((field: string) => string), keyPrefix?: string) => Record<string, string>;
|
|
165
|
+
/**
|
|
166
|
+
* Helper function to build field-specific validation errors
|
|
167
|
+
*
|
|
168
|
+
* Creates property-specific error messages for multiple fields at once.
|
|
169
|
+
*
|
|
170
|
+
* @param config - Maps field names to their validation error configurations
|
|
171
|
+
* @returns Properties error configuration
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const properties = buildFieldErrors({
|
|
176
|
+
* username: {
|
|
177
|
+
* minLength: "Username must be at least 3 characters",
|
|
178
|
+
* pattern: "Username can only contain letters and numbers"
|
|
179
|
+
* },
|
|
180
|
+
* age: {
|
|
181
|
+
* minimum: "Must be 18 or older",
|
|
182
|
+
* maximum: "Must be under 120"
|
|
183
|
+
* },
|
|
184
|
+
* email: {
|
|
185
|
+
* format: "Please enter a valid email address"
|
|
186
|
+
* }
|
|
187
|
+
* });
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
export declare const buildFieldErrors: (config: Record<string, FieldErrorConfig>) => Record<string, FieldErrorConfig>;
|
|
191
|
+
/**
|
|
192
|
+
* Helper function to create a complete error message configuration in one call
|
|
193
|
+
*
|
|
194
|
+
* Convenient wrapper that combines required and validation errors.
|
|
195
|
+
*
|
|
196
|
+
* @param required - Required field error messages
|
|
197
|
+
* @param properties - Field-specific validation error messages
|
|
198
|
+
* @param globalFallbacks - Global fallback error messages
|
|
199
|
+
* @returns Complete error message configuration
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const errorMessage = createErrorMessage(
|
|
204
|
+
* {
|
|
205
|
+
* username: "Username is required",
|
|
206
|
+
* email: "Email is required"
|
|
207
|
+
* },
|
|
208
|
+
* {
|
|
209
|
+
* username: {
|
|
210
|
+
* minLength: "Username must be at least 3 characters"
|
|
211
|
+
* },
|
|
212
|
+
* email: {
|
|
213
|
+
* format: "Please enter a valid email"
|
|
214
|
+
* }
|
|
215
|
+
* },
|
|
216
|
+
* {
|
|
217
|
+
* minLength: "This field is too short",
|
|
218
|
+
* format: "Invalid format"
|
|
219
|
+
* }
|
|
220
|
+
* );
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare const createErrorMessage: (required?: Record<string, string>, properties?: Record<string, FieldErrorConfig>, globalFallbacks?: Partial<Record<ValidationErrorType, string>>) => ErrorMessageResult;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FieldErrors } from 'react-hook-form';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the error message for a specific field from react-hook-form errors
|
|
4
|
+
* Prioritizes required errors (#.required) over field-specific validation errors
|
|
5
|
+
*/
|
|
6
|
+
export declare const getFieldError: (errors: FieldErrors, fieldName: string) => string | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to simplify i18n translation for form fields.
|
|
3
|
+
* Automatically handles colLabel construction and removeIndex logic.
|
|
4
|
+
*
|
|
5
|
+
* @param column - The column name
|
|
6
|
+
* @param prefix - The prefix for the field (usually empty string or parent path)
|
|
7
|
+
* @returns Object with translation helper functions
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const formI18n = useFormI18n(column, prefix);
|
|
12
|
+
*
|
|
13
|
+
* // Get field label
|
|
14
|
+
* <Field label={formI18n.label()} />
|
|
15
|
+
*
|
|
16
|
+
* // Get error message
|
|
17
|
+
* <Text>{formI18n.required()}</Text>
|
|
18
|
+
*
|
|
19
|
+
* // Get custom translation key
|
|
20
|
+
* <Text>{formI18n.t('add_more')}</Text>
|
|
21
|
+
*
|
|
22
|
+
* // Access the raw colLabel
|
|
23
|
+
* const colLabel = formI18n.colLabel;
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const useFormI18n: (column: string, prefix?: string) => {
|
|
27
|
+
/**
|
|
28
|
+
* The constructed column label (prefix + column)
|
|
29
|
+
*/
|
|
30
|
+
colLabel: string;
|
|
31
|
+
/**
|
|
32
|
+
* Get the field label translation
|
|
33
|
+
* Equivalent to: translate.t(removeIndex(`${colLabel}.field_label`))
|
|
34
|
+
*/
|
|
35
|
+
label: (options?: any) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Get the required error message translation
|
|
38
|
+
* Equivalent to: translate.t(removeIndex(`${colLabel}.field_required`))
|
|
39
|
+
*/
|
|
40
|
+
required: (options?: any) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Get a translation for any custom key relative to the field
|
|
43
|
+
* Equivalent to: translate.t(removeIndex(`${colLabel}.${key}`))
|
|
44
|
+
*
|
|
45
|
+
* @param key - The translation key suffix (e.g., 'add_more', 'total', etc.)
|
|
46
|
+
* @param options - Optional translation options (e.g., defaultValue, interpolation variables)
|
|
47
|
+
*/
|
|
48
|
+
t: (key: string, options?: any) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Access to the original translate object for edge cases
|
|
51
|
+
*/
|
|
52
|
+
translate: import("react-i18next").UseTranslationResponse<string, string>;
|
|
53
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ErrorObject, ValidateFunction } from 'ajv';
|
|
2
|
+
import { JSONSchema7 } from 'json-schema';
|
|
3
|
+
type ValidateDataResult = {
|
|
4
|
+
isValid: boolean;
|
|
5
|
+
validate: ValidateFunction;
|
|
6
|
+
errors: ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const validateData: (data: unknown, schema: JSONSchema7) => ValidateDataResult;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface CustomTextareaProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
onFocus?: () => void;
|
|
8
|
+
onBlur?: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
rows?: number;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
autoFocus?: boolean;
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
label?: string;
|
|
18
|
+
helperText?: string;
|
|
19
|
+
errorText?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const Textarea: React.ForwardRefExoticComponent<CustomTextareaProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export { Textarea };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
interface TimePickerProps {
|
|
3
|
+
hour: number | null;
|
|
4
|
+
setHour: Dispatch<SetStateAction<number | null>>;
|
|
5
|
+
minute: number | null;
|
|
6
|
+
setMinute: Dispatch<SetStateAction<number | null>>;
|
|
7
|
+
meridiem: 'am' | 'pm' | null;
|
|
8
|
+
setMeridiem: Dispatch<SetStateAction<'am' | 'pm' | null>>;
|
|
9
|
+
onChange?: (newValue: {
|
|
10
|
+
hour: number | null;
|
|
11
|
+
minute: number | null;
|
|
12
|
+
meridiem: 'am' | 'pm' | null;
|
|
13
|
+
}) => void;
|
|
14
|
+
meridiemLabel?: {
|
|
15
|
+
am: string;
|
|
16
|
+
pm: string;
|
|
17
|
+
};
|
|
18
|
+
timezone?: string;
|
|
19
|
+
startTime?: string;
|
|
20
|
+
selectedDate?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function TimePicker({ hour, setHour, minute, setMinute, meridiem, setMeridiem, meridiemLabel: _meridiemLabel, onChange, timezone, startTime, selectedDate, }: TimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Field as ChakraField } from
|
|
2
|
-
import * as React from
|
|
3
|
-
export interface FieldProps extends Omit<ChakraField.RootProps,
|
|
1
|
+
import { Field as ChakraField } from '@chakra-ui/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface FieldProps extends Omit<ChakraField.RootProps, 'label'> {
|
|
4
4
|
label?: React.ReactNode;
|
|
5
5
|
helperText?: React.ReactNode;
|
|
6
6
|
errorText?: React.ReactNode;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Column, RowData } from
|
|
2
|
-
import { ReactNode } from
|
|
3
|
-
declare module
|
|
1
|
+
import { Column, RowData } from '@tanstack/react-table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
declare module '@tanstack/react-table' {
|
|
4
4
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
5
5
|
/**
|
|
6
6
|
* If `showCustomDisplay` is `true`, it will use the cell render to render the value.
|
|
@@ -12,6 +12,17 @@ declare module "@tanstack/react-table" {
|
|
|
12
12
|
* The display name of the column, used for rendering headers.
|
|
13
13
|
*/
|
|
14
14
|
displayName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Text configuration for the column header menu items.
|
|
17
|
+
* These strings can be customized per column.
|
|
18
|
+
*/
|
|
19
|
+
headerTexts?: {
|
|
20
|
+
pinColumn?: string;
|
|
21
|
+
cancelPin?: string;
|
|
22
|
+
sortAscending?: string;
|
|
23
|
+
sortDescending?: string;
|
|
24
|
+
clearSorting?: string;
|
|
25
|
+
};
|
|
15
26
|
/**
|
|
16
27
|
* Specifies the type of filter to be used for the column.
|
|
17
28
|
*
|
|
@@ -28,11 +39,14 @@ declare module "@tanstack/react-table" {
|
|
|
28
39
|
* - "dateRange": A date range filter.
|
|
29
40
|
* - "custom": A custom filter function.
|
|
30
41
|
*/
|
|
31
|
-
filterVariant?:
|
|
42
|
+
filterVariant?: 'text' | 'range' | 'select' | 'tag' | 'boolean' | 'dateRange' | 'custom';
|
|
32
43
|
/**
|
|
33
44
|
* Options for the select filter variant, if applicable.
|
|
34
45
|
*/
|
|
35
|
-
filterOptions?:
|
|
46
|
+
filterOptions?: {
|
|
47
|
+
label: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}[];
|
|
36
50
|
/**
|
|
37
51
|
* Configuration for the range filter variant, if applicable.
|
|
38
52
|
*
|
|
@@ -55,55 +69,67 @@ declare module "@tanstack/react-table" {
|
|
|
55
69
|
* @returns A JSX element representing the filter UI.
|
|
56
70
|
*/
|
|
57
71
|
renderFilter?: (column: Column<TData>) => ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Priority for responsive column hiding when table width is too narrow.
|
|
74
|
+
* Lower priority numbers = hide first (e.g., priority 1 hides before priority 10).
|
|
75
|
+
* Columns without priority default to Infinity (highest priority, never auto-hide).
|
|
76
|
+
* Only applies when canResize={false}.
|
|
77
|
+
*/
|
|
78
|
+
responsivePriority?: number;
|
|
58
79
|
}
|
|
59
80
|
}
|
|
60
|
-
export
|
|
61
|
-
export * from
|
|
62
|
-
export * from
|
|
63
|
-
export * from
|
|
64
|
-
export * from
|
|
65
|
-
export * from
|
|
66
|
-
export * from
|
|
67
|
-
export * from
|
|
68
|
-
export * from
|
|
69
|
-
export * from
|
|
70
|
-
export * from
|
|
71
|
-
export * from
|
|
72
|
-
export * from
|
|
73
|
-
export * from
|
|
74
|
-
export * from
|
|
75
|
-
export * from
|
|
76
|
-
export * from
|
|
77
|
-
export * from
|
|
78
|
-
export * from
|
|
79
|
-
export * from
|
|
80
|
-
export * from
|
|
81
|
-
export * from
|
|
82
|
-
export * from
|
|
83
|
-
export * from
|
|
84
|
-
export * from
|
|
85
|
-
export * from
|
|
86
|
-
export * from
|
|
87
|
-
export * from
|
|
88
|
-
export * from
|
|
89
|
-
export * from
|
|
90
|
-
export * from
|
|
91
|
-
export * from
|
|
92
|
-
export * from
|
|
93
|
-
export * from
|
|
94
|
-
export * from
|
|
95
|
-
export * from
|
|
96
|
-
export * from
|
|
97
|
-
export * from
|
|
98
|
-
export * from
|
|
99
|
-
export * from
|
|
100
|
-
export * from
|
|
101
|
-
export * from
|
|
102
|
-
export * from
|
|
103
|
-
export * from
|
|
104
|
-
export * from
|
|
105
|
-
export * from
|
|
106
|
-
export * from
|
|
107
|
-
export * from
|
|
108
|
-
export * from
|
|
109
|
-
export * from
|
|
81
|
+
export type { TableHeaderTexts } from './components/DataTable/display/TableHeader';
|
|
82
|
+
export * from './components/DataTable/controls/DensityToggleButton';
|
|
83
|
+
export * from './components/DataTable/controls/EditSortingButton';
|
|
84
|
+
export * from './components/DataTable/controls/FilterDialog';
|
|
85
|
+
export * from './components/DataTable/controls/PageSizeControl';
|
|
86
|
+
export * from './components/DataTable/controls/Pagination';
|
|
87
|
+
export * from './components/DataTable/controls/ResetFilteringButton';
|
|
88
|
+
export * from './components/DataTable/controls/ResetSelectionButton';
|
|
89
|
+
export * from './components/DataTable/controls/ResetSortingButton';
|
|
90
|
+
export * from './components/DataTable/controls/RowCountText';
|
|
91
|
+
export * from './components/DataTable/controls/ViewDialog';
|
|
92
|
+
export * from './components/DataTable/controls/ReloadButton';
|
|
93
|
+
export * from './components/Filter/GlobalFilter';
|
|
94
|
+
export * from './components/DataTable/controls/TableSelector';
|
|
95
|
+
export * from './components/DataTable/controls/SelectAllRowsToggle';
|
|
96
|
+
export * from './components/DataTable/controls/TableSorter';
|
|
97
|
+
export * from './components/DataTable/controls/TableViewer';
|
|
98
|
+
export * from './components/DataTable/controls/TableControls';
|
|
99
|
+
export * from './components/DataTable/controls/TableFilters';
|
|
100
|
+
export * from './components/DataTable/controls/TableFilterTags';
|
|
101
|
+
export * from './components/DataTable/display/Table';
|
|
102
|
+
export * from './components/DataTable/display/TableBody';
|
|
103
|
+
export * from './components/DataTable/display/TableCardContainer';
|
|
104
|
+
export * from './components/DataTable/display/TableCards';
|
|
105
|
+
export * from './components/DataTable/display/TableComponent';
|
|
106
|
+
export * from './components/DataTable/display/TableFooter';
|
|
107
|
+
export * from './components/DataTable/display/TableHeader';
|
|
108
|
+
export * from './components/DataTable/display/TableLoadingComponent';
|
|
109
|
+
export * from './components/DataTable/display/TextCell';
|
|
110
|
+
export * from './components/DataTable/display/CardHeader';
|
|
111
|
+
export * from './components/DataTable/display/EmptyState';
|
|
112
|
+
export * from './components/DataTable/display/ErrorAlert';
|
|
113
|
+
export * from './components/DataTable/useDataTable';
|
|
114
|
+
export * from './components/DataTable/useDataTableServer';
|
|
115
|
+
export * from './components/DataTable/context/useDataTableContext';
|
|
116
|
+
export * from './components/DataTable/utils/getColumns';
|
|
117
|
+
export * from './components/Form/components/core/DefaultForm';
|
|
118
|
+
export * from './components/Form/components/core/FormRoot';
|
|
119
|
+
export * from './components/Form/components/core/FormTitle';
|
|
120
|
+
export * from './components/Form/components/core/FormBody';
|
|
121
|
+
export * from './components/Form/components/types/CustomJSONSchema7';
|
|
122
|
+
export * from './components/Form/components/MediaLibraryBrowser';
|
|
123
|
+
export * from './components/Form/useForm';
|
|
124
|
+
export * from './components/Form/utils/buildErrorMessages';
|
|
125
|
+
export * from './components/DatePicker/DatePicker';
|
|
126
|
+
export * from './components/DatePicker/getMultiDates';
|
|
127
|
+
export * from './components/DatePicker/getRangeDates';
|
|
128
|
+
export * from './components/DatePicker/RangeDatePicker';
|
|
129
|
+
export * from './components/DataTable/display/RecordDisplay';
|
|
130
|
+
export * from './components/DataTable/display/TableDataDisplay';
|
|
131
|
+
export * from './components/DataTable/DefaultTable';
|
|
132
|
+
export * from './components/DataTable/DefaultTableServer';
|
|
133
|
+
export * from './components/DataTable/display/DataDisplay';
|
|
134
|
+
export * from './components/DataTable/DataTable';
|
|
135
|
+
export * from './components/DataTable/DataTableServer';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsol-oss/react-datatable5",
|
|
3
|
-
"version": "12.0.0-beta.
|
|
3
|
+
"version": "12.0.0-beta.90",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,17 +32,21 @@
|
|
|
32
32
|
"preview": "vite preview",
|
|
33
33
|
"storybook": "storybook dev -p 6006",
|
|
34
34
|
"build-storybook": "storybook build",
|
|
35
|
-
"format": "prettier --ignore-unknown '**/*'"
|
|
35
|
+
"format": "prettier --ignore-unknown '**/*'",
|
|
36
|
+
"prepare": "husky"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
39
40
|
"@bsol-oss/dayzed-react19": "^0.0.4",
|
|
40
|
-
"@chakra-ui/react": "^3.
|
|
41
|
+
"@chakra-ui/react": "^3.19.1",
|
|
41
42
|
"@emotion/react": "^11.13.5",
|
|
42
43
|
"@tanstack/match-sorter-utils": "^8.15.1",
|
|
43
44
|
"@tanstack/react-query": "^5.66.9",
|
|
44
45
|
"@tanstack/react-table": "^8.21.2",
|
|
45
46
|
"@uidotdev/usehooks": "^2.4.1",
|
|
47
|
+
"ajv": "^8.12.0",
|
|
48
|
+
"ajv-errors": "^3.0.0",
|
|
49
|
+
"ajv-formats": "^3.0.1",
|
|
46
50
|
"axios": "^1.7.9",
|
|
47
51
|
"dayjs": "^1.11.13",
|
|
48
52
|
"next-themes": "^0.4.4",
|
|
@@ -56,13 +60,9 @@
|
|
|
56
60
|
"devDependencies": {
|
|
57
61
|
"@rollup/plugin-alias": "^5.1.1",
|
|
58
62
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
59
|
-
"@storybook/addon-
|
|
60
|
-
"@storybook/
|
|
61
|
-
"@
|
|
62
|
-
"@storybook/blocks": "^8.4.7",
|
|
63
|
-
"@storybook/react": "^8.4.7",
|
|
64
|
-
"@storybook/react-vite": "^8.4.7",
|
|
65
|
-
"@storybook/test": "^8.4.7",
|
|
63
|
+
"@storybook/addon-onboarding": "^10.0.7",
|
|
64
|
+
"@storybook/react-vite": "^10.0.7",
|
|
65
|
+
"@types/ajv-errors": "^2.0.0",
|
|
66
66
|
"@types/json-schema": "^7.0.15",
|
|
67
67
|
"@types/react": "19.0.2",
|
|
68
68
|
"@types/react-beautiful-dnd": "^13.1.8",
|
|
@@ -70,14 +70,25 @@
|
|
|
70
70
|
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
71
71
|
"@typescript-eslint/parser": "^7.2.0",
|
|
72
72
|
"@vitejs/plugin-react": "^4.2.1",
|
|
73
|
+
"ajv": "^8.12.0",
|
|
74
|
+
"ajv-errors": "^3.0.0",
|
|
75
|
+
"ajv-formats": "^3.0.1",
|
|
73
76
|
"eslint": "^8.57.0",
|
|
74
77
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
75
78
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
76
|
-
"eslint-plugin-storybook": "^0.
|
|
79
|
+
"eslint-plugin-storybook": "^10.0.7",
|
|
80
|
+
"husky": "^9.1.7",
|
|
81
|
+
"lint-staged": "^16.2.5",
|
|
77
82
|
"prettier": "3.2.5",
|
|
78
83
|
"rollup-plugin-dts": "^6.1.0",
|
|
79
|
-
"storybook": "^
|
|
84
|
+
"storybook": "^10.0.7",
|
|
80
85
|
"typescript": "^5.2.2",
|
|
81
|
-
"vite": "^5.2.0"
|
|
86
|
+
"vite": "^5.2.0",
|
|
87
|
+
"@storybook/addon-docs": "^10.0.7"
|
|
88
|
+
},
|
|
89
|
+
"lint-staged": {
|
|
90
|
+
"*.{ts,js,json,md,tsx}": [
|
|
91
|
+
"prettier --config ./.prettierrc --write"
|
|
92
|
+
]
|
|
82
93
|
}
|
|
83
94
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { OnChangeFn, Updater, RowData, TableFeature } from "@tanstack/react-table";
|
|
2
|
-
export type DensityState = "sm" | "md" | "lg";
|
|
3
|
-
export interface DensityTableState {
|
|
4
|
-
density: DensityState;
|
|
5
|
-
}
|
|
6
|
-
export interface DensityOptions {
|
|
7
|
-
enableDensity?: boolean;
|
|
8
|
-
onDensityChange?: OnChangeFn<DensityState>;
|
|
9
|
-
}
|
|
10
|
-
export interface DensityInstance {
|
|
11
|
-
setDensity: (updater: Updater<DensityState>) => void;
|
|
12
|
-
toggleDensity: (value?: DensityState) => void;
|
|
13
|
-
getDensityValue: (value?: DensityState) => number;
|
|
14
|
-
}
|
|
15
|
-
declare module "@tanstack/react-table" {
|
|
16
|
-
interface TableState extends DensityTableState {
|
|
17
|
-
}
|
|
18
|
-
interface TableOptionsResolved<TData extends RowData> extends DensityOptions {
|
|
19
|
-
}
|
|
20
|
-
interface Table<TData extends RowData> extends DensityInstance {
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export declare const DensityFeature: TableFeature<any>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface EditFilterButtonProps {
|
|
3
|
-
text?: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
closeText?: string;
|
|
6
|
-
resetText?: string;
|
|
7
|
-
icon?: React.ReactElement;
|
|
8
|
-
}
|
|
9
|
-
export declare const EditFilterButton: ({ text, title, closeText, resetText, icon, }: EditFilterButtonProps) => import("react/jsx-runtime").JSX.Element;
|