@bsol-oss/react-datatable5 13.0.1-beta.2 → 13.0.1-beta.21
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 +5 -326
- package/dist/index.d.ts +126 -291
- package/dist/index.js +2592 -2546
- package/dist/index.mjs +2597 -2547
- 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 +27 -0
- package/dist/types/components/DatePicker/DateTimePicker.d.ts +20 -4
- package/dist/types/components/DatePicker/UniversalPicker.d.ts +2 -3
- package/dist/types/components/DatePicker/index.d.ts +1 -2
- package/dist/types/components/Form/SchemaFormContext.d.ts +3 -11
- package/dist/types/components/Form/components/core/FormRoot.d.ts +30 -14
- package/dist/types/components/Form/components/fields/FilePicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +0 -5
- package/dist/types/components/Form/components/fields/TagPicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/useIdPickerData.d.ts +4 -0
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +25 -5
- package/dist/types/components/Form/components/viewers/EnumViewer.d.ts +1 -1
- package/dist/types/components/Form/components/viewers/FileViewer.d.ts +7 -5
- package/dist/types/components/Form/components/viewers/TagViewer.d.ts +1 -1
- package/dist/types/components/Form/useForm.d.ts +2 -5
- 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 +9 -8
- package/dist/types/index.d.ts +10 -2
- package/package.json +7 -4
- package/dist/types/components/DatePicker/DatePickerInput.d.ts +0 -18
- package/dist/types/components/DatePicker/IsoTimePicker.d.ts +0 -24
- package/dist/types/components/DatePicker/PickerDemo.d.ts +0 -1
- 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/useFormI18n.d.ts +0 -57
- package/dist/types/components/ui/number-input.d.ts +0 -8
|
@@ -17,6 +17,9 @@ export interface DataTableLabel {
|
|
|
17
17
|
globalFilterPlaceholder: string;
|
|
18
18
|
trueLabel: string;
|
|
19
19
|
falseLabel: string;
|
|
20
|
+
noFiltersMatchText: string;
|
|
21
|
+
filterByLabel: string;
|
|
22
|
+
filterLabelsPlaceholder: string;
|
|
20
23
|
}
|
|
21
24
|
export interface DataTableContextProps<TData = unknown> extends Omit<DataTableProps, 'translate'> {
|
|
22
25
|
table: Table<TData>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ColumnFilterMenuLabels {
|
|
2
|
+
filterByLabel?: string;
|
|
3
|
+
filterLabelsPlaceholder?: string;
|
|
4
|
+
noFiltersMatchText?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ColumnFilterMenuProps {
|
|
7
|
+
displayName: string;
|
|
8
|
+
filterOptions: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
filterVariant?: 'select' | 'tag';
|
|
13
|
+
colorPalette: string;
|
|
14
|
+
value?: string[] | string | undefined;
|
|
15
|
+
onChange?: (value: string[] | string | undefined) => void;
|
|
16
|
+
labels?: ColumnFilterMenuLabels;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const ColumnFilterMenu: ({ displayName, filterOptions, filterVariant, colorPalette, value: controlledValue, onChange, labels, open: controlledOpen, onOpenChange, }: ColumnFilterMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -26,4 +26,4 @@ export interface MobileTableControlsProps {
|
|
|
26
26
|
hasError?: boolean;
|
|
27
27
|
gridProps?: GridProps;
|
|
28
28
|
}
|
|
29
|
-
export declare const MobileTableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter,
|
|
29
|
+
export declare const MobileTableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: MobileTableControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,8 +7,6 @@ export interface TableControlsProps {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
showGlobalFilter?: boolean;
|
|
9
9
|
showFilter?: boolean;
|
|
10
|
-
showFilterName?: boolean;
|
|
11
|
-
showFilterTags?: boolean;
|
|
12
10
|
showReload?: boolean;
|
|
13
11
|
showPagination?: boolean;
|
|
14
12
|
showPageSizeControl?: boolean;
|
|
@@ -26,4 +24,4 @@ export interface TableControlsProps {
|
|
|
26
24
|
hasError?: boolean;
|
|
27
25
|
gridProps?: GridProps;
|
|
28
26
|
}
|
|
29
|
-
export declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter,
|
|
27
|
+
export declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: TableControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface TableFilterTagsProps {
|
|
2
|
+
filterTagsOptions?: {
|
|
3
|
+
column: string;
|
|
4
|
+
options: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export declare const TableFilterTags: ({ filterTagsOptions, }?: TableFilterTagsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export interface DataDisplayProps {
|
|
2
2
|
variant?: 'horizontal' | 'stats' | '';
|
|
3
3
|
}
|
|
4
|
-
export declare const DataDisplay: ({
|
|
4
|
+
export declare const DataDisplay: ({}: DataDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactNode } from
|
|
3
|
-
export interface TableCardContainerProps extends
|
|
1
|
+
import { FlexProps, GridProps } from '@chakra-ui/react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface TableCardContainerProps extends Omit<GridProps, 'direction'> {
|
|
4
4
|
children: ReactNode;
|
|
5
|
-
variant?:
|
|
5
|
+
variant?: 'carousel' | '';
|
|
6
6
|
gap?: string;
|
|
7
7
|
gridTemplateColumns?: string;
|
|
8
|
-
direction?: FlexProps[
|
|
8
|
+
direction?: FlexProps['direction'];
|
|
9
9
|
}
|
|
10
10
|
export declare const TableCardContainer: ({ children, variant, gap, gridTemplateColumns, direction, ...props }: TableCardContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { ColumnFiltersState, SortingState } from '@tanstack/react-table';
|
|
3
3
|
import { UseDataTableProps, UseDataTableReturn } from './useDataTable';
|
|
4
|
-
export interface UseDataTableServerProps<TData> extends
|
|
4
|
+
export interface UseDataTableServerProps<TData> extends UseDataTableProps {
|
|
5
5
|
/**
|
|
6
6
|
* Delay to send the request if the `refreshData` called multiple times
|
|
7
7
|
*
|
|
@@ -34,7 +34,7 @@ export declare function areSomePageRowsSelected<TData>(table: Table<TData>, rowS
|
|
|
34
34
|
/**
|
|
35
35
|
* Create a toggle handler for a specific row
|
|
36
36
|
*/
|
|
37
|
-
export declare function createRowToggleHandler<TData>(row: Row<TData>,
|
|
37
|
+
export declare function createRowToggleHandler<TData>(row: Row<TData>, _rowSelection: RowSelectionState, setRowSelection: OnChangeFn<RowSelectionState>): () => void;
|
|
38
38
|
/**
|
|
39
39
|
* Create a toggle handler for all rows
|
|
40
40
|
*/
|
|
@@ -30,6 +30,9 @@ export interface DatePickerProps {
|
|
|
30
30
|
weekdayNamesShort: string[];
|
|
31
31
|
backButtonLabel?: string;
|
|
32
32
|
forwardButtonLabel?: string;
|
|
33
|
+
todayLabel?: string;
|
|
34
|
+
yesterdayLabel?: string;
|
|
35
|
+
tomorrowLabel?: string;
|
|
33
36
|
};
|
|
34
37
|
render?: (calendarData: CalendarRenderProps) => React.ReactNode;
|
|
35
38
|
}
|
|
@@ -38,6 +41,30 @@ export interface DatePickerLabels {
|
|
|
38
41
|
weekdayNamesShort: string[];
|
|
39
42
|
backButtonLabel?: string;
|
|
40
43
|
forwardButtonLabel?: string;
|
|
44
|
+
todayLabel?: string;
|
|
45
|
+
yesterdayLabel?: string;
|
|
46
|
+
tomorrowLabel?: string;
|
|
41
47
|
}
|
|
48
|
+
export declare const DatePickerContext: React.Context<{
|
|
49
|
+
labels: DatePickerLabels;
|
|
50
|
+
}>;
|
|
42
51
|
declare const DatePicker: React.FC<DatePickerProps>;
|
|
43
52
|
export default DatePicker;
|
|
53
|
+
export interface DatePickerInputProps {
|
|
54
|
+
value?: string | Date;
|
|
55
|
+
onChange?: (date?: string) => void;
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
dateFormat?: string;
|
|
58
|
+
displayFormat?: string;
|
|
59
|
+
labels?: DatePickerLabels;
|
|
60
|
+
timezone?: string;
|
|
61
|
+
minDate?: Date;
|
|
62
|
+
maxDate?: Date;
|
|
63
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
64
|
+
showOutsideDays?: boolean;
|
|
65
|
+
monthsToDisplay?: number;
|
|
66
|
+
insideDialog?: boolean;
|
|
67
|
+
readOnly?: boolean;
|
|
68
|
+
showHelperButtons?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare function DatePickerInput({ value, onChange, placeholder, dateFormat, displayFormat, labels, timezone, minDate, maxDate, firstDayOfWeek, showOutsideDays, monthsToDisplay, insideDialog, readOnly, showHelperButtons, }: DatePickerInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TimePickerLabels } from '../Form/components/types/CustomJSONSchema7';
|
|
1
|
+
import { DateTimePickerLabels, TimePickerLabels } from '../Form/components/types/CustomJSONSchema7';
|
|
3
2
|
interface DateTimePickerProps {
|
|
4
3
|
value?: string;
|
|
5
4
|
onChange?: (date?: string) => void;
|
|
6
5
|
format?: 'date-time' | 'iso-date-time';
|
|
7
6
|
showSeconds?: boolean;
|
|
8
|
-
labels?:
|
|
7
|
+
labels?: DateTimePickerLabels;
|
|
9
8
|
timePickerLabels?: TimePickerLabels;
|
|
10
9
|
timezone?: string;
|
|
11
10
|
startTime?: string;
|
|
12
11
|
minDate?: Date;
|
|
13
12
|
maxDate?: Date;
|
|
14
13
|
portalled?: boolean;
|
|
14
|
+
defaultDate?: string;
|
|
15
|
+
defaultTime?: {
|
|
16
|
+
hour: number | null;
|
|
17
|
+
minute: number | null;
|
|
18
|
+
second?: number | null;
|
|
19
|
+
meridiem?: 'am' | 'pm' | null;
|
|
20
|
+
};
|
|
21
|
+
showQuickActions?: boolean;
|
|
22
|
+
quickActionLabels?: {
|
|
23
|
+
yesterday?: string;
|
|
24
|
+
today?: string;
|
|
25
|
+
tomorrow?: string;
|
|
26
|
+
plus7Days?: string;
|
|
27
|
+
};
|
|
28
|
+
showTimezoneSelector?: boolean;
|
|
29
|
+
timezoneOffset?: string;
|
|
30
|
+
onTimezoneOffsetChange?: (offset: string) => void;
|
|
15
31
|
}
|
|
16
|
-
export declare function DateTimePicker({ value, onChange, format, showSeconds, labels, timePickerLabels, timezone, startTime, minDate, maxDate, portalled, }: DateTimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function DateTimePicker({ value, onChange, format, showSeconds, labels, timePickerLabels, timezone: tz, startTime, minDate, maxDate, portalled, defaultDate, defaultTime, showQuickActions, quickActionLabels, showTimezoneSelector, timezoneOffset: controlledTimezoneOffset, onTimezoneOffsetChange, }: DateTimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
17
33
|
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
type FormatType =
|
|
1
|
+
type FormatType = 'date' | 'time' | 'date-time' | 'iso-time' | 'iso-date-time' | 'duration';
|
|
2
2
|
interface UniversalPickerProps {
|
|
3
3
|
format: FormatType;
|
|
4
4
|
value?: string | null;
|
|
5
5
|
onChange?: (value: string | null) => void;
|
|
6
|
-
placeholder?: string;
|
|
7
6
|
}
|
|
8
|
-
export declare function UniversalPicker({ format, value, onChange,
|
|
7
|
+
export declare function UniversalPicker({ format, value, onChange, }: UniversalPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { default as DatePicker } from './DatePicker';
|
|
2
2
|
export { TimePicker } from '../TimePicker/TimePicker';
|
|
3
|
-
export { IsoTimePicker } from './IsoTimePicker';
|
|
4
3
|
export { DateTimePicker } from './DateTimePicker';
|
|
5
4
|
export { DurationPicker } from './DurationPicker';
|
|
6
5
|
export { UniversalPicker } from './UniversalPicker';
|
|
7
|
-
export { DatePickerInput } from './
|
|
6
|
+
export { DatePickerInput } from './DatePicker';
|
|
8
7
|
export type { DatePickerProps, CalendarProps, GetDateColorProps, GetVariantProps, } from './DatePicker';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { JSONSchema7 } from 'json-schema';
|
|
3
2
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
4
|
-
import { FieldValues
|
|
5
|
-
import {
|
|
6
|
-
import { DateTimePickerLabels, IdPickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, TimePickerLabels } from './components/types/CustomJSONSchema7';
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
|
+
import { CustomJSONSchema7, DateTimePickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, IdPickerLabels, TimePickerLabels } from './components/types/CustomJSONSchema7';
|
|
7
5
|
export interface SchemaFormContext<TData extends FieldValues> {
|
|
8
|
-
schema:
|
|
6
|
+
schema: CustomJSONSchema7;
|
|
9
7
|
requestUrl: string;
|
|
10
8
|
order: string[];
|
|
11
9
|
ignore: string[];
|
|
@@ -14,8 +12,6 @@ export interface SchemaFormContext<TData extends FieldValues> {
|
|
|
14
12
|
rowNumber?: number | string;
|
|
15
13
|
idMap: Record<string, object>;
|
|
16
14
|
setIdMap: Dispatch<SetStateAction<Record<string, object>>>;
|
|
17
|
-
/** Translate object for fallback text (components prefer label objects) */
|
|
18
|
-
translate: Translate;
|
|
19
15
|
requestOptions: AxiosRequestConfig;
|
|
20
16
|
isSuccess: boolean;
|
|
21
17
|
setIsSuccess: Dispatch<SetStateAction<boolean>>;
|
|
@@ -23,8 +19,6 @@ export interface SchemaFormContext<TData extends FieldValues> {
|
|
|
23
19
|
setIsError: Dispatch<SetStateAction<boolean>>;
|
|
24
20
|
isSubmiting: boolean;
|
|
25
21
|
setIsSubmiting: Dispatch<SetStateAction<boolean>>;
|
|
26
|
-
isConfirming: boolean;
|
|
27
|
-
setIsConfirming: Dispatch<SetStateAction<boolean>>;
|
|
28
22
|
validatedData: TData | undefined;
|
|
29
23
|
setValidatedData: Dispatch<SetStateAction<TData>>;
|
|
30
24
|
error: unknown;
|
|
@@ -38,7 +32,6 @@ export interface SchemaFormContext<TData extends FieldValues> {
|
|
|
38
32
|
showResetButton?: boolean;
|
|
39
33
|
showTitle?: boolean;
|
|
40
34
|
};
|
|
41
|
-
requireConfirmation: boolean;
|
|
42
35
|
onFormSubmit: (data: TData) => Promise<void>;
|
|
43
36
|
dateTimePickerLabels?: DateTimePickerLabels;
|
|
44
37
|
idPickerLabels?: IdPickerLabels;
|
|
@@ -46,7 +39,6 @@ export interface SchemaFormContext<TData extends FieldValues> {
|
|
|
46
39
|
filePickerLabels?: FilePickerLabels;
|
|
47
40
|
formButtonLabels?: FormButtonLabels;
|
|
48
41
|
timePickerLabels?: TimePickerLabels;
|
|
49
|
-
ajvResolver: Resolver<FieldValues>;
|
|
50
42
|
insideDialog?: boolean;
|
|
51
43
|
}
|
|
52
44
|
export declare const SchemaFormContext: import("react").Context<SchemaFormContext<unknown>>;
|
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
import { ForeignKeyProps } from '@/components/Form/components/fields/StringInputField';
|
|
2
1
|
import { AxiosRequestConfig } from 'axios';
|
|
3
2
|
import { JSONSchema7 } from 'json-schema';
|
|
4
3
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
5
4
|
import { FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form';
|
|
6
|
-
import {
|
|
7
|
-
import { CustomJSONSchema7, DateTimePickerLabels, IdPickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, TimePickerLabels } from '../types/CustomJSONSchema7';
|
|
5
|
+
import { CustomJSONSchema7, DateTimePickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, IdPickerLabels, TimePickerLabels } from '../types/CustomJSONSchema7';
|
|
8
6
|
export interface FormRootProps<TData extends FieldValues> {
|
|
7
|
+
/**
|
|
8
|
+
* JSON Schema with support for errorMessages in properties.
|
|
9
|
+
* Each property can define errorMessages object with keys like:
|
|
10
|
+
* - required: Error message when field is required but missing
|
|
11
|
+
* - minLength, maxLength: Error messages for string length validation
|
|
12
|
+
* - minimum, maximum: Error messages for number range validation
|
|
13
|
+
* - format: Error message for format validation (email, date, etc.)
|
|
14
|
+
* - pattern: Error message for pattern validation
|
|
15
|
+
* - type: Error message for type validation
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* {
|
|
19
|
+
* type: 'object',
|
|
20
|
+
* properties: {
|
|
21
|
+
* username: {
|
|
22
|
+
* type: 'string',
|
|
23
|
+
* minLength: 3,
|
|
24
|
+
* errorMessages: {
|
|
25
|
+
* required: 'Username is required',
|
|
26
|
+
* minLength: 'Username must be at least 3 characters'
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*/
|
|
9
32
|
schema: CustomJSONSchema7;
|
|
10
33
|
requestUrl?: string;
|
|
11
34
|
idMap: Record<string, object>;
|
|
12
35
|
setIdMap: Dispatch<SetStateAction<Record<string, object>>>;
|
|
13
36
|
form: UseFormReturn;
|
|
14
|
-
/** Translate object for fallback text (components prefer label objects) */
|
|
15
|
-
translate: Translate;
|
|
16
37
|
children: ReactNode;
|
|
17
38
|
order?: string[];
|
|
18
39
|
ignore?: string[];
|
|
@@ -28,7 +49,6 @@ export interface FormRootProps<TData extends FieldValues> {
|
|
|
28
49
|
showResetButton?: boolean;
|
|
29
50
|
showTitle?: boolean;
|
|
30
51
|
};
|
|
31
|
-
requireConfirmation?: boolean;
|
|
32
52
|
dateTimePickerLabels?: DateTimePickerLabels;
|
|
33
53
|
idPickerLabels?: IdPickerLabels;
|
|
34
54
|
enumPickerLabels?: EnumPickerLabels;
|
|
@@ -39,15 +59,11 @@ export interface FormRootProps<TData extends FieldValues> {
|
|
|
39
59
|
}
|
|
40
60
|
export interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
41
61
|
variant: string;
|
|
42
|
-
in_table: string;
|
|
43
|
-
column_ref: string;
|
|
44
62
|
gridColumn: string;
|
|
45
63
|
gridRow: string;
|
|
46
|
-
|
|
64
|
+
customQueryFn: any;
|
|
65
|
+
idColumn: string;
|
|
47
66
|
children: ReactNode;
|
|
48
67
|
}
|
|
49
|
-
export declare const idPickerSanityCheck: (column: string,
|
|
50
|
-
|
|
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;
|
|
68
|
+
export declare const idPickerSanityCheck: (column: string, customQueryFn?: any, idColumn?: string) => void;
|
|
69
|
+
export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, customSuccessRenderer, displayConfig, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,6 +12,6 @@ interface MediaBrowserDialogProps {
|
|
|
12
12
|
labels?: FilePickerLabels;
|
|
13
13
|
colLabel: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function MediaBrowserDialog({ open, onClose, onSelect, title, filterImageOnly, onFetchFiles, onUploadFile, enableUpload, labels,
|
|
15
|
+
export declare function MediaBrowserDialog({ open, onClose, onSelect, title, filterImageOnly, onFetchFiles, onUploadFile, enableUpload, labels, }: MediaBrowserDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
16
|
export declare const FilePicker: ({ column, schema, prefix }: InputDefaultProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -21,9 +21,4 @@ export interface CustomQueryFnParams {
|
|
|
21
21
|
}>;
|
|
22
22
|
}
|
|
23
23
|
export type CustomQueryFn = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse>;
|
|
24
|
-
export interface ForeignKeyProps {
|
|
25
|
-
column: string;
|
|
26
|
-
table: string;
|
|
27
|
-
customQueryFn?: CustomQueryFn;
|
|
28
|
-
}
|
|
29
24
|
export declare const StringInputField: ({ column, schema, prefix, }: StringInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -22,4 +22,4 @@ export interface TagData {
|
|
|
22
22
|
export interface TagResponse {
|
|
23
23
|
data: TagData[];
|
|
24
24
|
}
|
|
25
|
-
export declare const TagPicker: ({ column, schema
|
|
25
|
+
export declare const TagPicker: ({ column, schema }: TagPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -26,6 +26,7 @@ export interface UseIdPickerDataReturn {
|
|
|
26
26
|
missingIds: string[];
|
|
27
27
|
comboboxItems: Array<{
|
|
28
28
|
label: string;
|
|
29
|
+
displayLabel: string;
|
|
29
30
|
value: string;
|
|
30
31
|
raw: RecordType;
|
|
31
32
|
}>;
|
|
@@ -33,6 +34,7 @@ export interface UseIdPickerDataReturn {
|
|
|
33
34
|
filter: (text: string) => void;
|
|
34
35
|
set: (items: Array<{
|
|
35
36
|
label: string;
|
|
37
|
+
displayLabel: string;
|
|
36
38
|
value: string;
|
|
37
39
|
raw: RecordType;
|
|
38
40
|
}>) => void;
|
|
@@ -40,6 +42,8 @@ export interface UseIdPickerDataReturn {
|
|
|
40
42
|
idPickerLabels: any;
|
|
41
43
|
insideDialog: boolean;
|
|
42
44
|
renderDisplay: ((item: RecordType) => React.ReactNode) | undefined;
|
|
45
|
+
itemToValue: (item: RecordType) => string;
|
|
46
|
+
itemToString: (item: RecordType) => string;
|
|
43
47
|
loadInitialValues: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
44
48
|
column_ref: string;
|
|
45
49
|
errors: any;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { CustomQueryFn } from '../fields/StringInputField';
|
|
4
4
|
import { UseFormReturn } from 'react-hook-form';
|
|
5
|
-
import { ValidationErrorType } from '../../utils/buildErrorMessages';
|
|
6
5
|
import React from 'react';
|
|
6
|
+
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
7
|
export interface DateTimePickerLabels {
|
|
8
8
|
monthNamesShort?: string[];
|
|
9
9
|
weekdayNamesShort?: string[];
|
|
10
10
|
backButtonLabel?: string;
|
|
11
11
|
forwardButtonLabel?: string;
|
|
12
|
+
selectDateLabel?: string;
|
|
13
|
+
quickActionLabels?: {
|
|
14
|
+
yesterday?: string;
|
|
15
|
+
today?: string;
|
|
16
|
+
tomorrow?: string;
|
|
17
|
+
plus7Days?: string;
|
|
18
|
+
};
|
|
12
19
|
}
|
|
13
20
|
export interface IdPickerLabels {
|
|
14
21
|
undefined?: string;
|
|
@@ -60,10 +67,12 @@ export interface FormButtonLabels {
|
|
|
60
67
|
export interface TimePickerLabels {
|
|
61
68
|
placeholder?: string;
|
|
62
69
|
emptyMessage?: string;
|
|
70
|
+
selectTimeLabel?: string;
|
|
63
71
|
}
|
|
64
72
|
export interface LoadInitialValuesParams {
|
|
65
73
|
ids: string[];
|
|
66
|
-
|
|
74
|
+
customQueryFn: CustomQueryFn;
|
|
75
|
+
idColumn: string;
|
|
67
76
|
setIdMap: React.Dispatch<React.SetStateAction<Record<string, object>>>;
|
|
68
77
|
}
|
|
69
78
|
export interface LoadInitialValuesResult {
|
|
@@ -76,9 +85,11 @@ export interface LoadInitialValuesResult {
|
|
|
76
85
|
export interface CustomJSONSchema7 extends JSONSchema7 {
|
|
77
86
|
gridColumn?: string;
|
|
78
87
|
gridRow?: string;
|
|
79
|
-
|
|
88
|
+
customQueryFn?: CustomQueryFn;
|
|
89
|
+
idColumn?: string;
|
|
80
90
|
variant?: string;
|
|
81
91
|
renderDisplay?: (item: unknown) => ReactNode;
|
|
92
|
+
itemToValue?: (item: unknown) => string;
|
|
82
93
|
loadInitialValues?: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
83
94
|
inputRender?: (props: {
|
|
84
95
|
column: string;
|
|
@@ -103,7 +114,6 @@ export interface CustomJSONSchema7 extends JSONSchema7 {
|
|
|
103
114
|
filePicker?: FilePickerProps;
|
|
104
115
|
tagPicker?: {
|
|
105
116
|
queryFn?: (params: {
|
|
106
|
-
in_table: string;
|
|
107
117
|
where?: {
|
|
108
118
|
id: string;
|
|
109
119
|
value: string[];
|
|
@@ -119,6 +129,16 @@ export interface CustomJSONSchema7 extends JSONSchema7 {
|
|
|
119
129
|
idMap?: Record<string, object>;
|
|
120
130
|
}>;
|
|
121
131
|
};
|
|
132
|
+
dateTimePicker?: {
|
|
133
|
+
showQuickActions?: boolean;
|
|
134
|
+
quickActionLabels?: {
|
|
135
|
+
yesterday?: string;
|
|
136
|
+
today?: string;
|
|
137
|
+
tomorrow?: string;
|
|
138
|
+
plus7Days?: string;
|
|
139
|
+
};
|
|
140
|
+
showTimezoneSelector?: boolean;
|
|
141
|
+
};
|
|
122
142
|
}
|
|
123
143
|
export declare const defaultRenderDisplay: (item: unknown) => ReactNode;
|
|
124
144
|
export interface TagPickerProps {
|
|
@@ -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;
|
|
@@ -27,4 +27,4 @@ export interface TagViewerProps {
|
|
|
27
27
|
schema: CustomJSONSchema7;
|
|
28
28
|
prefix: string;
|
|
29
29
|
}
|
|
30
|
-
export declare const TagViewer: ({ column, schema
|
|
30
|
+
export declare const TagViewer: ({ column, schema }: TagViewerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FieldValues } from 'react-hook-form';
|
|
3
2
|
import { JSONSchema7 } from 'json-schema';
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
export interface Translate {
|
|
5
5
|
t: (key: string, options?: any) => string;
|
|
6
6
|
i18n?: any;
|
|
@@ -8,13 +8,10 @@ export interface Translate {
|
|
|
8
8
|
}
|
|
9
9
|
export interface UseFormProps {
|
|
10
10
|
preLoadedValues?: FieldValues | undefined;
|
|
11
|
-
keyPrefix?: string;
|
|
12
|
-
namespace?: string;
|
|
13
11
|
schema?: JSONSchema7;
|
|
14
12
|
}
|
|
15
|
-
export declare const useForm: ({ preLoadedValues,
|
|
13
|
+
export declare const useForm: ({ preLoadedValues, schema }: UseFormProps) => {
|
|
16
14
|
form: import("react-hook-form").UseFormReturn<FieldValues, any, undefined>;
|
|
17
15
|
idMap: Record<string, object>;
|
|
18
16
|
setIdMap: import("react").Dispatch<import("react").SetStateAction<Record<string, object>>>;
|
|
19
|
-
translate: Translate;
|
|
20
17
|
};
|
|
@@ -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>>;
|