@bsol-oss/react-datatable5 13.0.1-beta.9 → 13.0.1
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 +8 -323
- package/dist/index.d.ts +492 -419
- package/dist/index.js +1727 -4118
- package/dist/index.mjs +1720 -4116
- package/dist/types/components/DataTable/context/DataTableContext.d.ts +3 -0
- package/dist/types/components/DataTable/controls/ColumnFilterMenu.d.ts +20 -0
- package/dist/types/components/DataTable/controls/MobileTableControls.d.ts +1 -1
- package/dist/types/components/DataTable/controls/TableControls.d.ts +1 -3
- package/dist/types/components/DataTable/controls/TableFilterTags.d.ts +10 -1
- package/dist/types/components/DataTable/display/DataDisplay.d.ts +1 -1
- package/dist/types/components/DataTable/display/TableCardContainer.d.ts +5 -5
- package/dist/types/components/DataTable/hooks/useResponsiveColumnVisibility.d.ts +1 -1
- package/dist/types/components/DataTable/useDataTableServer.d.ts +1 -1
- package/dist/types/components/DataTable/utils/selectors.d.ts +1 -1
- package/dist/types/components/DatePicker/Calendar.d.ts +2 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +7 -47
- package/dist/types/components/DatePicker/DateTimePicker.d.ts +4 -1
- package/dist/types/components/DatePicker/RangeDatePicker.d.ts +4 -40
- package/dist/types/components/DatePicker/TimeRangeZoom.d.ts +255 -0
- package/dist/types/components/DatePicker/datePickerContext.d.ts +5 -0
- package/dist/types/components/DatePicker/datePickerTypes.d.ts +39 -0
- package/dist/types/components/DatePicker/dateValueUtils.d.ts +10 -0
- package/dist/types/components/DatePicker/index.d.ts +2 -0
- package/dist/types/components/Form/SchemaFormContext.d.ts +6 -40
- package/dist/types/components/Form/components/MediaLibraryBrowser.d.ts +1 -1
- package/dist/types/components/Form/components/core/DefaultForm.d.ts +3 -4
- package/dist/types/components/Form/components/core/FormRoot.d.ts +32 -34
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +0 -25
- package/dist/types/components/Form/components/fields/useIdPickerData.d.ts +3 -4
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +143 -34
- package/dist/types/components/Form/components/viewers/FileViewer.d.ts +7 -5
- package/dist/types/components/Form/useForm.d.ts +8 -16
- package/dist/types/components/Form/utils/ajvResolver.d.ts +4 -0
- package/dist/types/components/Form/utils/getNestedError.d.ts +12 -0
- package/dist/types/components/Form/utils/getTableData.d.ts +1 -2
- package/dist/types/components/Form/utils/useFormLabel.d.ts +12 -0
- package/dist/types/components/TextArea/TextArea.d.ts +4 -19
- package/dist/types/components/TimePicker/TimePicker.d.ts +13 -41
- package/dist/types/index.d.ts +11 -3
- package/package.json +11 -2
- package/dist/types/components/DataTable/utils/getColumns.d.ts +0 -14
- package/dist/types/components/DatePicker/PickerDemo.d.ts +0 -1
- package/dist/types/components/Form/components/core/FormTitle.d.ts +0 -1
- package/dist/types/components/Form/components/core/SubmitButton.d.ts +0 -1
- package/dist/types/components/Form/components/fields/TagPicker.d.ts +0 -25
- package/dist/types/components/Form/components/viewers/TagViewer.d.ts +0 -30
- package/dist/types/components/Form/utils/buildErrorMessages.d.ts +0 -223
- package/dist/types/components/Form/utils/getFieldError.d.ts +0 -6
- package/dist/types/components/Form/utils/idListSanityCheck.d.ts +0 -1
- package/dist/types/components/Form/utils/useFormI18n.d.ts +0 -41
- package/dist/types/components/ui/number-input.d.ts +0 -8
|
@@ -18,5 +18,5 @@ type MediaLibraryBrowserPropsMultiple = MediaLibraryBrowserPropsBase & {
|
|
|
18
18
|
onSelectedFileChange?: (files: FilePickerMediaFile[]) => void;
|
|
19
19
|
};
|
|
20
20
|
export type MediaLibraryBrowserProps = MediaLibraryBrowserPropsSingle | MediaLibraryBrowserPropsMultiple;
|
|
21
|
-
export declare const MediaLibraryBrowser: ({ onFetchFiles, filterImageOnly, labels, enabled, multiple, onFileSelect, selectedFile: controlledSelectedFile, onSelectedFileChange, }: MediaLibraryBrowserProps) => import("react/jsx-runtime").JSX.Element
|
|
21
|
+
export declare const MediaLibraryBrowser: ({ onFetchFiles, filterImageOnly, labels, enabled, multiple, onFileSelect, selectedFile: controlledSelectedFile, onSelectedFileChange, }: MediaLibraryBrowserProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { FormRootProps } from
|
|
2
|
-
import { FieldValues } from
|
|
1
|
+
import { FormRootProps } from './FormRoot';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
export interface DefaultFormProps<TData extends FieldValues> {
|
|
4
|
-
formConfig: Omit<FormRootProps<TData>,
|
|
5
|
-
showTitle?: boolean;
|
|
4
|
+
formConfig: Omit<FormRootProps<TData>, 'children'>;
|
|
6
5
|
}
|
|
7
6
|
export declare const DefaultForm: <TData extends FieldValues>({ formConfig, }: DefaultFormProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
import { ForeignKeyProps } from '@/components/Form/components/fields/StringInputField';
|
|
2
|
-
import { AxiosRequestConfig } from 'axios';
|
|
3
1
|
import { JSONSchema7 } from 'json-schema';
|
|
4
2
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
5
|
-
import { FieldValues,
|
|
6
|
-
import {
|
|
7
|
-
import { CustomJSONSchema7, DateTimePickerLabels, IdPickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, TimePickerLabels } from '../types/CustomJSONSchema7';
|
|
3
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
4
|
+
import { CustomJSONSchema7, DateTimePickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, IdPickerLabels, TimePickerLabels } from '../types/CustomJSONSchema7';
|
|
8
5
|
export interface FormRootProps<TData extends FieldValues> {
|
|
6
|
+
/**
|
|
7
|
+
* JSON Schema with support for errorMessages in properties.
|
|
8
|
+
* Each property can define errorMessages object with keys like:
|
|
9
|
+
* - required: Error message when field is required but missing
|
|
10
|
+
* - minLength, maxLength: Error messages for string length validation
|
|
11
|
+
* - minimum, maximum: Error messages for number range validation
|
|
12
|
+
* - format: Error message for format validation (email, date, etc.)
|
|
13
|
+
* - pattern: Error message for pattern validation
|
|
14
|
+
* - type: Error message for type validation
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* {
|
|
18
|
+
* type: 'object',
|
|
19
|
+
* properties: {
|
|
20
|
+
* username: {
|
|
21
|
+
* type: 'string',
|
|
22
|
+
* minLength: 3,
|
|
23
|
+
* errorMessages: {
|
|
24
|
+
* required: 'Username is required',
|
|
25
|
+
* minLength: 'Username must be at least 3 characters'
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
*/
|
|
9
31
|
schema: CustomJSONSchema7;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
form: UseFormReturn;
|
|
14
|
-
/** Translate object for fallback text (components prefer label objects) */
|
|
15
|
-
translate: Translate;
|
|
32
|
+
idMap: Record<string, unknown>;
|
|
33
|
+
setIdMap: Dispatch<SetStateAction<Record<string, unknown>>>;
|
|
34
|
+
form: UseFormReturn<TData, any, TData>;
|
|
16
35
|
children: ReactNode;
|
|
17
|
-
order?: string[];
|
|
18
|
-
ignore?: string[];
|
|
19
|
-
include?: string[];
|
|
20
|
-
onSubmit?: SubmitHandler<TData>;
|
|
21
|
-
rowNumber?: number | string;
|
|
22
|
-
requestOptions?: AxiosRequestConfig;
|
|
23
|
-
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
24
|
-
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
25
|
-
customSuccessRenderer?: (resetHandler: () => void | Promise<void>) => ReactNode;
|
|
26
|
-
displayConfig?: {
|
|
27
|
-
showSubmitButton?: boolean;
|
|
28
|
-
showResetButton?: boolean;
|
|
29
|
-
showTitle?: boolean;
|
|
30
|
-
};
|
|
31
|
-
requireConfirmation?: boolean;
|
|
32
36
|
dateTimePickerLabels?: DateTimePickerLabels;
|
|
33
37
|
idPickerLabels?: IdPickerLabels;
|
|
34
38
|
enumPickerLabels?: EnumPickerLabels;
|
|
@@ -39,15 +43,9 @@ export interface FormRootProps<TData extends FieldValues> {
|
|
|
39
43
|
}
|
|
40
44
|
export interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
41
45
|
variant: string;
|
|
42
|
-
in_table: string;
|
|
43
|
-
column_ref: string;
|
|
44
46
|
gridColumn: string;
|
|
45
47
|
gridRow: string;
|
|
46
|
-
|
|
48
|
+
customQueryFn: any;
|
|
47
49
|
children: ReactNode;
|
|
48
50
|
}
|
|
49
|
-
export declare const
|
|
50
|
-
table?: string | undefined;
|
|
51
|
-
column?: string | undefined;
|
|
52
|
-
} | undefined) => void;
|
|
53
|
-
export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, customSuccessRenderer, displayConfig, requireConfirmation, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,29 +1,4 @@
|
|
|
1
1
|
import { InputDefaultProps } from './types';
|
|
2
2
|
export interface StringInputFieldProps extends InputDefaultProps {
|
|
3
3
|
}
|
|
4
|
-
export interface CustomQueryFnResponse {
|
|
5
|
-
/**
|
|
6
|
-
* The data of the query
|
|
7
|
-
*/
|
|
8
|
-
data: any;
|
|
9
|
-
/**
|
|
10
|
-
* The id map of the data
|
|
11
|
-
*/
|
|
12
|
-
idMap: Record<string, any>;
|
|
13
|
-
}
|
|
14
|
-
export interface CustomQueryFnParams {
|
|
15
|
-
searching: string;
|
|
16
|
-
limit: number;
|
|
17
|
-
offset: number;
|
|
18
|
-
where?: Array<{
|
|
19
|
-
id: string;
|
|
20
|
-
value: string | string[];
|
|
21
|
-
}>;
|
|
22
|
-
}
|
|
23
|
-
export type CustomQueryFn = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse>;
|
|
24
|
-
export interface ForeignKeyProps {
|
|
25
|
-
column: string;
|
|
26
|
-
table: string;
|
|
27
|
-
customQueryFn?: CustomQueryFn;
|
|
28
|
-
}
|
|
29
4
|
export declare const StringInputField: ({ column, schema, prefix, }: StringInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CustomJSONSchema7, LoadInitialValuesParams, LoadInitialValuesResult } from '../types/CustomJSONSchema7';
|
|
2
|
+
import { CustomJSONSchema7, IdPickerLabels, LoadInitialValuesParams, LoadInitialValuesResult } from '../types/CustomJSONSchema7';
|
|
3
3
|
export interface RecordType {
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}
|
|
@@ -38,14 +38,13 @@ export interface UseIdPickerDataReturn {
|
|
|
38
38
|
value: string;
|
|
39
39
|
raw: RecordType;
|
|
40
40
|
}>) => void;
|
|
41
|
-
idMap: Record<string,
|
|
42
|
-
idPickerLabels
|
|
41
|
+
idMap: Record<string, unknown>;
|
|
42
|
+
idPickerLabels?: IdPickerLabels;
|
|
43
43
|
insideDialog: boolean;
|
|
44
44
|
renderDisplay: ((item: RecordType) => React.ReactNode) | undefined;
|
|
45
45
|
itemToValue: (item: RecordType) => string;
|
|
46
46
|
itemToString: (item: RecordType) => string;
|
|
47
47
|
loadInitialValues: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
48
|
-
column_ref: string;
|
|
49
48
|
errors: any;
|
|
50
49
|
setValue: (name: string, value: any) => void;
|
|
51
50
|
}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ForeignKeyProps } from '../fields/StringInputField';
|
|
4
3
|
import { UseFormReturn } from 'react-hook-form';
|
|
5
|
-
import { ValidationErrorType } from '../../utils/buildErrorMessages';
|
|
6
4
|
import React from 'react';
|
|
5
|
+
export type ValidationErrorType = 'minLength' | 'maxLength' | 'pattern' | 'minimum' | 'maximum' | 'multipleOf' | 'format' | 'type' | 'enum' | 'required' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minProperties' | 'maxProperties' | 'anyOf' | 'oneOf' | 'allOf' | 'const' | 'additionalProperties' | 'dependencies';
|
|
7
6
|
export interface DateTimePickerLabels {
|
|
8
7
|
monthNamesShort?: string[];
|
|
9
8
|
weekdayNamesShort?: string[];
|
|
10
9
|
backButtonLabel?: string;
|
|
11
10
|
forwardButtonLabel?: string;
|
|
11
|
+
selectDateLabel?: string;
|
|
12
|
+
quickActionLabels?: {
|
|
13
|
+
yesterday?: string;
|
|
14
|
+
today?: string;
|
|
15
|
+
tomorrow?: string;
|
|
16
|
+
plus7Days?: string;
|
|
17
|
+
};
|
|
12
18
|
}
|
|
13
19
|
export interface IdPickerLabels {
|
|
14
20
|
undefined?: string;
|
|
@@ -60,24 +66,25 @@ export interface FormButtonLabels {
|
|
|
60
66
|
export interface TimePickerLabels {
|
|
61
67
|
placeholder?: string;
|
|
62
68
|
emptyMessage?: string;
|
|
69
|
+
selectTimeLabel?: string;
|
|
63
70
|
}
|
|
64
|
-
export interface LoadInitialValuesParams {
|
|
71
|
+
export interface LoadInitialValuesParams<TRecord = unknown> {
|
|
65
72
|
ids: string[];
|
|
66
|
-
|
|
67
|
-
setIdMap: React.Dispatch<React.SetStateAction<Record<string,
|
|
73
|
+
customQueryFn: CustomQueryFn<TRecord>;
|
|
74
|
+
setIdMap: React.Dispatch<React.SetStateAction<Record<string, TRecord>>>;
|
|
68
75
|
}
|
|
69
|
-
export interface LoadInitialValuesResult {
|
|
76
|
+
export interface LoadInitialValuesResult<TRecord = unknown> {
|
|
70
77
|
data: {
|
|
71
|
-
data:
|
|
78
|
+
data: TRecord[];
|
|
72
79
|
count: number;
|
|
73
80
|
};
|
|
74
|
-
idMap: Record<string,
|
|
81
|
+
idMap: Record<string, TRecord>;
|
|
75
82
|
}
|
|
76
|
-
export interface CustomJSONSchema7 extends JSONSchema7 {
|
|
83
|
+
export interface CustomJSONSchema7 extends Omit<JSONSchema7, 'items' | 'additionalItems' | 'properties' | 'additionalProperties' | 'definitions' | 'patternProperties' | 'dependencies' | 'allOf' | 'anyOf' | 'oneOf' | 'not' | 'if' | 'then' | 'else' | 'contains'> {
|
|
77
84
|
gridColumn?: string;
|
|
78
85
|
gridRow?: string;
|
|
79
|
-
|
|
80
|
-
variant?:
|
|
86
|
+
customQueryFn?: CustomQueryFn;
|
|
87
|
+
variant?: 'custom-input' | 'id-picker' | 'text-area' | 'media-library-browser' | 'file-picker' | 'date-range' | 'enum-picker' | 'radio';
|
|
81
88
|
renderDisplay?: (item: unknown) => ReactNode;
|
|
82
89
|
itemToValue?: (item: unknown) => string;
|
|
83
90
|
loadInitialValues?: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
@@ -100,45 +107,147 @@ export interface CustomJSONSchema7 extends JSONSchema7 {
|
|
|
100
107
|
showLabel?: boolean;
|
|
101
108
|
formatOptions?: Intl.NumberFormatOptions;
|
|
102
109
|
numberStorageType?: 'string' | 'number';
|
|
103
|
-
|
|
110
|
+
errorMessage?: Record<Partial<ValidationErrorType> | string, string | Record<string, string>>;
|
|
104
111
|
filePicker?: FilePickerProps;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
dateTimePicker?: {
|
|
113
|
+
showQuickActions?: boolean;
|
|
114
|
+
quickActionLabels?: {
|
|
115
|
+
yesterday?: string;
|
|
116
|
+
today?: string;
|
|
117
|
+
tomorrow?: string;
|
|
118
|
+
plus7Days?: string;
|
|
119
|
+
};
|
|
120
|
+
showTimezoneSelector?: boolean;
|
|
121
|
+
};
|
|
122
|
+
items?: CustomJSONSchema7 | CustomJSONSchema7[];
|
|
123
|
+
additionalItems?: CustomJSONSchema7;
|
|
124
|
+
properties?: {
|
|
125
|
+
[key: string]: CustomJSONSchema7;
|
|
126
|
+
};
|
|
127
|
+
additionalProperties?: boolean | CustomJSONSchema7;
|
|
128
|
+
definitions?: {
|
|
129
|
+
[key: string]: CustomJSONSchema7;
|
|
122
130
|
};
|
|
131
|
+
patternProperties?: {
|
|
132
|
+
[key: string]: CustomJSONSchema7;
|
|
133
|
+
};
|
|
134
|
+
dependencies?: {
|
|
135
|
+
[key: string]: CustomJSONSchema7 | string[];
|
|
136
|
+
};
|
|
137
|
+
allOf?: CustomJSONSchema7[];
|
|
138
|
+
anyOf?: CustomJSONSchema7[];
|
|
139
|
+
oneOf?: CustomJSONSchema7[];
|
|
140
|
+
not?: CustomJSONSchema7;
|
|
141
|
+
if?: CustomJSONSchema7;
|
|
142
|
+
then?: CustomJSONSchema7;
|
|
143
|
+
else?: CustomJSONSchema7;
|
|
144
|
+
contains?: CustomJSONSchema7;
|
|
123
145
|
}
|
|
124
146
|
export declare const defaultRenderDisplay: (item: unknown) => ReactNode;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Expected shape of a media file returned by `onFetchFiles` and used by
|
|
149
|
+
* the Media Library Browser and File Picker components.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* {
|
|
154
|
+
* id: 'file-1',
|
|
155
|
+
* name: 'photo.jpg',
|
|
156
|
+
* url: 'https://cdn.example.com/photo.jpg',
|
|
157
|
+
* size: 102400,
|
|
158
|
+
* comment: 'Profile photo',
|
|
159
|
+
* type: 'image/jpeg',
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
130
163
|
export interface FilePickerMediaFile {
|
|
164
|
+
/** Unique identifier for the file (required) */
|
|
131
165
|
id: string;
|
|
166
|
+
/** Display name of the file (required) */
|
|
132
167
|
name: string;
|
|
168
|
+
/** URL for image preview; required for thumbnails in media library */
|
|
133
169
|
url?: string;
|
|
170
|
+
/** File size in bytes (number) or human-readable string (e.g. "1.2 MB") */
|
|
134
171
|
size?: string | number;
|
|
172
|
+
/** Optional description or metadata */
|
|
135
173
|
comment?: string;
|
|
174
|
+
/** MIME type (e.g. "image/jpeg", "application/pdf") */
|
|
136
175
|
type?: string;
|
|
137
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* JSON Schema definition for FilePickerMediaFile.
|
|
179
|
+
* Use this to document or validate the expected structure in your API/schema.
|
|
180
|
+
*/
|
|
181
|
+
export declare const FilePickerMediaFileSchema: {
|
|
182
|
+
readonly type: "object";
|
|
183
|
+
readonly required: readonly ["id", "name"];
|
|
184
|
+
readonly properties: {
|
|
185
|
+
readonly id: {
|
|
186
|
+
readonly type: "string";
|
|
187
|
+
readonly description: "Unique identifier for the file";
|
|
188
|
+
};
|
|
189
|
+
readonly name: {
|
|
190
|
+
readonly type: "string";
|
|
191
|
+
readonly description: "Display name of the file";
|
|
192
|
+
};
|
|
193
|
+
readonly url: {
|
|
194
|
+
readonly type: "string";
|
|
195
|
+
readonly format: "uri";
|
|
196
|
+
readonly description: "URL for image preview; required for thumbnails in media library";
|
|
197
|
+
};
|
|
198
|
+
readonly size: {
|
|
199
|
+
readonly oneOf: readonly [{
|
|
200
|
+
readonly type: "number";
|
|
201
|
+
}, {
|
|
202
|
+
readonly type: "string";
|
|
203
|
+
}];
|
|
204
|
+
readonly description: "File size in bytes (number) or human-readable string";
|
|
205
|
+
};
|
|
206
|
+
readonly comment: {
|
|
207
|
+
readonly type: "string";
|
|
208
|
+
readonly description: "Optional description or metadata";
|
|
209
|
+
};
|
|
210
|
+
readonly type: {
|
|
211
|
+
readonly type: "string";
|
|
212
|
+
readonly description: "MIME type (e.g. \"image/jpeg\", \"application/pdf\")";
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
};
|
|
138
216
|
export interface FilePickerProps {
|
|
217
|
+
/**
|
|
218
|
+
* Fetches files from your media library/API. Must return FilePickerMediaFile[].
|
|
219
|
+
* The search string can be used to filter results.
|
|
220
|
+
*/
|
|
139
221
|
onFetchFiles?: (search: string) => Promise<FilePickerMediaFile[]>;
|
|
222
|
+
/** When true, adds a "Browse Library" button to the file picker (file-picker variant only) */
|
|
140
223
|
enableMediaLibrary?: boolean;
|
|
224
|
+
/** When true, only shows image files (jpg, jpeg, png, gif, bmp, webp, svg) */
|
|
141
225
|
filterImageOnly?: boolean;
|
|
226
|
+
/** When true, shows an upload tab in the media library dialog */
|
|
142
227
|
enableUpload?: boolean;
|
|
228
|
+
/** Upload handler; must return the new file's ID string */
|
|
143
229
|
onUploadFile?: (file: File) => Promise<string>;
|
|
144
230
|
}
|
|
231
|
+
export interface CustomQueryFnResponse<TRecord = unknown> {
|
|
232
|
+
/**
|
|
233
|
+
* The data of the query
|
|
234
|
+
*/
|
|
235
|
+
data: {
|
|
236
|
+
data: TRecord[];
|
|
237
|
+
count: number;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* The id map of the data
|
|
241
|
+
*/
|
|
242
|
+
idMap: Record<string, TRecord>;
|
|
243
|
+
}
|
|
244
|
+
export interface CustomQueryFnParams {
|
|
245
|
+
searching: string;
|
|
246
|
+
limit: number;
|
|
247
|
+
offset: number;
|
|
248
|
+
where?: Array<{
|
|
249
|
+
id: string;
|
|
250
|
+
value: string | string[];
|
|
251
|
+
}>;
|
|
252
|
+
}
|
|
253
|
+
export type CustomQueryFn<TRecord = unknown> = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse<TRecord>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
|
|
2
|
+
export interface FileViewerProps {
|
|
3
|
+
column: string;
|
|
4
|
+
schema: CustomJSONSchema7;
|
|
5
|
+
prefix: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const FileViewer: ({ column, schema, prefix }: FileViewerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
|
-
import {
|
|
4
|
-
export interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ready?: boolean;
|
|
3
|
+
import { CustomJSONSchema7 } from './components/types/CustomJSONSchema7';
|
|
4
|
+
export interface UseFormProps<T> {
|
|
5
|
+
preLoadedValues?: T | undefined;
|
|
6
|
+
schema: CustomJSONSchema7;
|
|
8
7
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
schema?: JSONSchema7;
|
|
14
|
-
}
|
|
15
|
-
export declare const useForm: ({ preLoadedValues, keyPrefix: _keyPrefix, namespace: _namespace, schema, }: UseFormProps) => {
|
|
16
|
-
form: import("react-hook-form").UseFormReturn<FieldValues, any, undefined>;
|
|
17
|
-
idMap: Record<string, object>;
|
|
18
|
-
setIdMap: import("react").Dispatch<import("react").SetStateAction<Record<string, object>>>;
|
|
19
|
-
translate: Translate;
|
|
8
|
+
export declare function useForm<T extends FieldValues = any>({ preLoadedValues, schema, }: UseFormProps<T>): {
|
|
9
|
+
form: import("react-hook-form").UseFormReturn<T, any, T>;
|
|
10
|
+
idMap: Record<string, unknown>;
|
|
11
|
+
setIdMap: import("react").Dispatch<import("react").SetStateAction<Record<string, unknown>>>;
|
|
20
12
|
};
|
|
@@ -10,4 +10,8 @@ export declare const convertAjvErrorsToFieldErrors: (errors: ErrorObject<string,
|
|
|
10
10
|
params?: Record<string, unknown>;
|
|
11
11
|
message?: string;
|
|
12
12
|
}>;
|
|
13
|
+
/**
|
|
14
|
+
* AJV resolver for react-hook-form
|
|
15
|
+
* Integrates AJV validation with react-hook-form's validation system
|
|
16
|
+
*/
|
|
13
17
|
export declare const ajvResolver: <T extends FieldValues>(schema: CustomJSONSchema7) => Resolver<T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FieldErrors } from 'react-hook-form';
|
|
2
|
+
/**
|
|
3
|
+
* Get nested error message from react-hook-form errors object.
|
|
4
|
+
* For nested fields like 'address.street', errors are stored as
|
|
5
|
+
* errors.address.street, not errors['address.street'].
|
|
6
|
+
* This utility traverses the nested structure to find the error.
|
|
7
|
+
*
|
|
8
|
+
* @param errors - The errors object from react-hook-form
|
|
9
|
+
* @param path - The field path (e.g., 'address.street' or 'contact.info.email')
|
|
10
|
+
* @returns The error message string or undefined if no error
|
|
11
|
+
*/
|
|
12
|
+
export declare const getNestedError: (errors: FieldErrors, path: string) => string | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export interface GetTableDataConfig {
|
|
2
|
-
in_table: string;
|
|
3
2
|
limit?: number;
|
|
4
3
|
offset?: number;
|
|
5
4
|
where?: {
|
|
@@ -12,4 +11,4 @@ export interface GetTableResponse {
|
|
|
12
11
|
data?: object[];
|
|
13
12
|
count: number;
|
|
14
13
|
}
|
|
15
|
-
export declare const getTableData: ({
|
|
14
|
+
export declare const getTableData: ({}: GetTableDataConfig) => Promise<never>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomJSONSchema7 } from '../components/types/CustomJSONSchema7';
|
|
2
|
+
export declare const useFormLabel: (column: string, prefix: string | undefined, schema: CustomJSONSchema7) => {
|
|
3
|
+
/**
|
|
4
|
+
* The constructed column label (prefix + column)
|
|
5
|
+
*/
|
|
6
|
+
colLabel: string;
|
|
7
|
+
/**
|
|
8
|
+
* Get the field label from schema title property.
|
|
9
|
+
* Logs a debug message if title is missing.
|
|
10
|
+
*/
|
|
11
|
+
label: () => string;
|
|
12
|
+
};
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Textarea as ChakraTextarea } from '@chakra-ui/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface TextAreaProps extends Omit<React.ComponentProps<typeof ChakraTextarea>, 'onChange' | 'value'> {
|
|
3
4
|
value?: string;
|
|
4
|
-
defaultValue?: string;
|
|
5
|
-
placeholder?: string;
|
|
6
5
|
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
6
|
}
|
|
21
|
-
declare const Textarea: React.ForwardRefExoticComponent<
|
|
22
|
-
export { Textarea };
|
|
7
|
+
export declare const Textarea: React.ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,51 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { TimePickerLabels } from '../Form/components/types/CustomJSONSchema7';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
meridiem?: 'am' | 'pm' | null;
|
|
12
|
-
setMeridiem?: Dispatch<SetStateAction<'am' | 'pm' | null>>;
|
|
13
|
-
second?: never;
|
|
14
|
-
setSecond?: never;
|
|
15
|
-
onTimeChange?: (newValue: {
|
|
3
|
+
export interface TimePickerProps {
|
|
4
|
+
hour: number | null;
|
|
5
|
+
setHour: (hour: number | null) => void;
|
|
6
|
+
minute: number | null;
|
|
7
|
+
setMinute: (minute: number | null) => void;
|
|
8
|
+
meridiem: 'am' | 'pm' | null;
|
|
9
|
+
setMeridiem: (meridiem: 'am' | 'pm' | null) => void;
|
|
10
|
+
onChange?: (params: {
|
|
16
11
|
hour: number | null;
|
|
17
12
|
minute: number | null;
|
|
18
13
|
meridiem: 'am' | 'pm' | null;
|
|
19
14
|
}) => void;
|
|
15
|
+
format?: '12h' | '24h';
|
|
16
|
+
showSeconds?: boolean;
|
|
20
17
|
startTime?: string;
|
|
21
18
|
selectedDate?: string;
|
|
22
19
|
timezone?: string;
|
|
23
20
|
portalled?: boolean;
|
|
24
21
|
labels?: TimePickerLabels;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
format: '24h';
|
|
28
|
-
value?: string;
|
|
29
|
-
onChange?: (value: string | undefined) => void;
|
|
30
|
-
hour?: number | null;
|
|
31
|
-
setHour?: Dispatch<SetStateAction<number | null>>;
|
|
32
|
-
minute?: number | null;
|
|
33
|
-
setMinute?: Dispatch<SetStateAction<number | null>>;
|
|
34
|
-
second?: number | null;
|
|
35
|
-
setSecond?: Dispatch<SetStateAction<number | null>>;
|
|
36
|
-
meridiem?: never;
|
|
37
|
-
setMeridiem?: never;
|
|
38
|
-
onTimeChange?: (newValue: {
|
|
39
|
-
hour: number | null;
|
|
40
|
-
minute: number | null;
|
|
41
|
-
second: number | null;
|
|
42
|
-
}) => void;
|
|
43
|
-
startTime?: string;
|
|
44
|
-
selectedDate?: string;
|
|
45
|
-
timezone?: string;
|
|
46
|
-
portalled?: boolean;
|
|
47
|
-
labels?: TimePickerLabels;
|
|
48
|
-
};
|
|
49
|
-
export type TimePickerProps = TimePickerProps12h | TimePickerProps24h;
|
|
50
|
-
export declare const TimePicker: (props: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
-
export {};
|
|
22
|
+
}
|
|
23
|
+
export declare const TimePicker: React.FC<TimePickerProps>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -76,6 +76,16 @@ declare module '@tanstack/react-table' {
|
|
|
76
76
|
* Only applies when canResize={false}.
|
|
77
77
|
*/
|
|
78
78
|
responsivePriority?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Grid column span for data display layout.
|
|
81
|
+
* Used in DataDisplay component.
|
|
82
|
+
*/
|
|
83
|
+
gridColumn?: string | string[];
|
|
84
|
+
/**
|
|
85
|
+
* Grid row span for data display layout.
|
|
86
|
+
* Used in DataDisplay component.
|
|
87
|
+
*/
|
|
88
|
+
gridRow?: string | object;
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
91
|
export type { TableHeaderTexts } from './components/DataTable/display/TableHeader';
|
|
@@ -113,19 +123,17 @@ export * from './components/DataTable/display/ErrorAlert';
|
|
|
113
123
|
export * from './components/DataTable/useDataTable';
|
|
114
124
|
export * from './components/DataTable/useDataTableServer';
|
|
115
125
|
export * from './components/DataTable/context/useDataTableContext';
|
|
116
|
-
export * from './components/DataTable/utils/getColumns';
|
|
117
126
|
export * from './components/Form/components/core/DefaultForm';
|
|
118
127
|
export * from './components/Form/components/core/FormRoot';
|
|
119
|
-
export * from './components/Form/components/core/FormTitle';
|
|
120
128
|
export * from './components/Form/components/core/FormBody';
|
|
121
129
|
export * from './components/Form/components/types/CustomJSONSchema7';
|
|
122
130
|
export * from './components/Form/components/MediaLibraryBrowser';
|
|
123
131
|
export * from './components/Form/useForm';
|
|
124
|
-
export * from './components/Form/utils/buildErrorMessages';
|
|
125
132
|
export * from './components/DatePicker/DatePicker';
|
|
126
133
|
export * from './components/DatePicker/getMultiDates';
|
|
127
134
|
export * from './components/DatePicker/getRangeDates';
|
|
128
135
|
export * from './components/DatePicker/RangeDatePicker';
|
|
136
|
+
export * from './components/DatePicker/TimeRangeZoom';
|
|
129
137
|
export * from './components/DataTable/display/RecordDisplay';
|
|
130
138
|
export * from './components/DataTable/display/TableDataDisplay';
|
|
131
139
|
export * from './components/DataTable/DefaultTable';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsol-oss/react-datatable5",
|
|
3
|
-
"version": "13.0.1
|
|
3
|
+
"version": "13.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -40,11 +40,13 @@
|
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
43
|
-
"@chakra-ui/react": "^3.
|
|
43
|
+
"@chakra-ui/react": "^3.34.0",
|
|
44
44
|
"@emotion/react": "^11.13.5",
|
|
45
|
+
"@internationalized/date": "^3.7.0",
|
|
45
46
|
"@tanstack/match-sorter-utils": "^8.15.1",
|
|
46
47
|
"@tanstack/react-query": "^5.66.9",
|
|
47
48
|
"@tanstack/react-table": "^8.21.2",
|
|
49
|
+
"@tanstack/react-virtual": "^3.13.0",
|
|
48
50
|
"@uidotdev/usehooks": "^2.4.1",
|
|
49
51
|
"ajv": "^8.12.0",
|
|
50
52
|
"ajv-errors": "^3.0.0",
|
|
@@ -59,11 +61,15 @@
|
|
|
59
61
|
"tiny-invariant": "^1.3.3"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
64
|
+
"@chakra-ui/react": "^3.34.0",
|
|
65
|
+
"@emotion/react": "^11.14.0",
|
|
66
|
+
"@internationalized/date": "^3.12.0",
|
|
62
67
|
"@rollup/plugin-alias": "^5.1.1",
|
|
63
68
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
64
69
|
"@storybook/addon-docs": "^10.0.7",
|
|
65
70
|
"@storybook/addon-onboarding": "^10.0.7",
|
|
66
71
|
"@storybook/react-vite": "^10.0.7",
|
|
72
|
+
"@tanstack/react-virtual": "^3.13.18",
|
|
67
73
|
"@types/ajv-errors": "^2.0.0",
|
|
68
74
|
"@types/json-schema": "^7.0.15",
|
|
69
75
|
"@types/react": "19.0.2",
|
|
@@ -91,5 +97,8 @@
|
|
|
91
97
|
"*.{ts,js,json,md,tsx}": [
|
|
92
98
|
"prettier --config ./.prettierrc --write"
|
|
93
99
|
]
|
|
100
|
+
},
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"@hookform/resolvers": "^5.2.2"
|
|
94
103
|
}
|
|
95
104
|
}
|