@bsol-oss/react-datatable5 13.0.1-beta.3 → 13.0.1-beta.30
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 +173 -367
- package/dist/index.js +2449 -2934
- package/dist/index.mjs +2456 -2934
- 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 +6 -35
- package/dist/types/components/Form/components/core/FormRoot.d.ts +31 -27
- package/dist/types/components/Form/components/fields/FilePicker.d.ts +1 -1
- package/dist/types/components/Form/components/fields/StringInputField.d.ts +0 -25
- package/dist/types/components/Form/components/fields/useIdPickerData.d.ts +7 -4
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +75 -34
- 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/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 +9 -8
- package/dist/types/index.d.ts +10 -3
- package/package.json +10 -4
- package/dist/types/components/DataTable/utils/getColumns.d.ts +0 -14
- 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/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 -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, 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,52 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { FieldValues, Resolver } from 'react-hook-form';
|
|
5
|
-
import { Translate } from './useForm';
|
|
6
|
-
import { DateTimePickerLabels, IdPickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, TimePickerLabels } from './components/types/CustomJSONSchema7';
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { CustomJSONSchema7, DateTimePickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, IdPickerLabels, TimePickerLabels } from './components/types/CustomJSONSchema7';
|
|
7
4
|
export interface SchemaFormContext<TData extends FieldValues> {
|
|
8
|
-
schema:
|
|
9
|
-
requestUrl: string;
|
|
10
|
-
order: string[];
|
|
11
|
-
ignore: string[];
|
|
12
|
-
include: string[];
|
|
5
|
+
schema: CustomJSONSchema7;
|
|
13
6
|
onSubmit?: (data: TData) => Promise<void>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
setIdMap: Dispatch<SetStateAction<Record<string, object>>>;
|
|
17
|
-
/** Translate object for fallback text (components prefer label objects) */
|
|
18
|
-
translate: Translate;
|
|
19
|
-
requestOptions: AxiosRequestConfig;
|
|
20
|
-
isSuccess: boolean;
|
|
21
|
-
setIsSuccess: Dispatch<SetStateAction<boolean>>;
|
|
22
|
-
isError: boolean;
|
|
23
|
-
setIsError: Dispatch<SetStateAction<boolean>>;
|
|
24
|
-
isSubmiting: boolean;
|
|
25
|
-
setIsSubmiting: Dispatch<SetStateAction<boolean>>;
|
|
26
|
-
isConfirming: boolean;
|
|
27
|
-
setIsConfirming: Dispatch<SetStateAction<boolean>>;
|
|
28
|
-
validatedData: TData | undefined;
|
|
29
|
-
setValidatedData: Dispatch<SetStateAction<TData>>;
|
|
30
|
-
error: unknown;
|
|
31
|
-
setError: Dispatch<SetStateAction<unknown>>;
|
|
32
|
-
getUpdatedData: () => TData | Promise<TData>;
|
|
33
|
-
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
34
|
-
customSuccessRenderer?: (resetHandler: () => void | Promise<void>) => ReactNode;
|
|
7
|
+
idMap: Record<string, unknown>;
|
|
8
|
+
setIdMap: Dispatch<SetStateAction<Record<string, unknown>>>;
|
|
35
9
|
timezone?: string;
|
|
36
10
|
displayConfig: {
|
|
37
11
|
showSubmitButton?: boolean;
|
|
38
12
|
showResetButton?: boolean;
|
|
39
13
|
showTitle?: boolean;
|
|
40
14
|
};
|
|
41
|
-
requireConfirmation: boolean;
|
|
42
|
-
onFormSubmit: (data: TData) => Promise<void>;
|
|
43
15
|
dateTimePickerLabels?: DateTimePickerLabels;
|
|
44
16
|
idPickerLabels?: IdPickerLabels;
|
|
45
17
|
enumPickerLabels?: EnumPickerLabels;
|
|
46
18
|
filePickerLabels?: FilePickerLabels;
|
|
47
19
|
formButtonLabels?: FormButtonLabels;
|
|
48
20
|
timePickerLabels?: TimePickerLabels;
|
|
49
|
-
ajvResolver: Resolver<FieldValues>;
|
|
50
21
|
insideDialog?: boolean;
|
|
51
22
|
}
|
|
52
23
|
export declare const SchemaFormContext: import("react").Context<SchemaFormContext<unknown>>;
|
|
@@ -1,34 +1,44 @@
|
|
|
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
3
|
import { FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form';
|
|
6
|
-
import {
|
|
7
|
-
import { CustomJSONSchema7, DateTimePickerLabels, IdPickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, TimePickerLabels } from '../types/CustomJSONSchema7';
|
|
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
36
|
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
37
|
displayConfig?: {
|
|
27
38
|
showSubmitButton?: boolean;
|
|
28
39
|
showResetButton?: boolean;
|
|
29
40
|
showTitle?: boolean;
|
|
30
41
|
};
|
|
31
|
-
requireConfirmation?: boolean;
|
|
32
42
|
dateTimePickerLabels?: DateTimePickerLabels;
|
|
33
43
|
idPickerLabels?: IdPickerLabels;
|
|
34
44
|
enumPickerLabels?: EnumPickerLabels;
|
|
@@ -39,15 +49,9 @@ export interface FormRootProps<TData extends FieldValues> {
|
|
|
39
49
|
}
|
|
40
50
|
export interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
41
51
|
variant: string;
|
|
42
|
-
in_table: string;
|
|
43
|
-
column_ref: string;
|
|
44
52
|
gridColumn: string;
|
|
45
53
|
gridRow: string;
|
|
46
|
-
|
|
54
|
+
customQueryFn: any;
|
|
47
55
|
children: ReactNode;
|
|
48
56
|
}
|
|
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;
|
|
57
|
+
export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, onSubmit, 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 {};
|
|
@@ -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
|
}
|
|
@@ -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,15 +34,17 @@ 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;
|
|
39
|
-
idMap: Record<string,
|
|
40
|
-
idPickerLabels
|
|
41
|
+
idMap: Record<string, unknown>;
|
|
42
|
+
idPickerLabels?: IdPickerLabels;
|
|
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
|
-
column_ref: string;
|
|
45
48
|
errors: any;
|
|
46
49
|
setValue: (name: string, value: any) => void;
|
|
47
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,25 +66,27 @@ 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;
|
|
89
|
+
itemToValue?: (item: unknown) => string;
|
|
82
90
|
loadInitialValues?: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
83
91
|
inputRender?: (props: {
|
|
84
92
|
column: string;
|
|
@@ -99,33 +107,43 @@ export interface CustomJSONSchema7 extends JSONSchema7 {
|
|
|
99
107
|
showLabel?: boolean;
|
|
100
108
|
formatOptions?: Intl.NumberFormatOptions;
|
|
101
109
|
numberStorageType?: 'string' | 'number';
|
|
102
|
-
|
|
110
|
+
errorMessage?: Record<Partial<ValidationErrorType> | string, string | Record<string, string>>;
|
|
103
111
|
filePicker?: FilePickerProps;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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;
|
|
121
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;
|
|
122
145
|
}
|
|
123
146
|
export declare const defaultRenderDisplay: (item: unknown) => ReactNode;
|
|
124
|
-
export interface TagPickerProps {
|
|
125
|
-
column: string;
|
|
126
|
-
schema: CustomJSONSchema7;
|
|
127
|
-
prefix: string;
|
|
128
|
-
}
|
|
129
147
|
export interface FilePickerMediaFile {
|
|
130
148
|
id: string;
|
|
131
149
|
name: string;
|
|
@@ -141,3 +159,26 @@ export interface FilePickerProps {
|
|
|
141
159
|
enableUpload?: boolean;
|
|
142
160
|
onUploadFile?: (file: File) => Promise<string>;
|
|
143
161
|
}
|
|
162
|
+
export interface CustomQueryFnResponse<TRecord = unknown> {
|
|
163
|
+
/**
|
|
164
|
+
* The data of the query
|
|
165
|
+
*/
|
|
166
|
+
data: {
|
|
167
|
+
data: TRecord[];
|
|
168
|
+
count: number;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* The id map of the data
|
|
172
|
+
*/
|
|
173
|
+
idMap: Record<string, TRecord>;
|
|
174
|
+
}
|
|
175
|
+
export interface CustomQueryFnParams {
|
|
176
|
+
searching: string;
|
|
177
|
+
limit: number;
|
|
178
|
+
offset: number;
|
|
179
|
+
where?: Array<{
|
|
180
|
+
id: string;
|
|
181
|
+
value: string | string[];
|
|
182
|
+
}>;
|
|
183
|
+
}
|
|
184
|
+
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;
|