dinocollab-core 2.2.57 → 2.2.59
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/dist/components/index.js +1 -1
- package/dist/filter-bar/index.js +1 -1
- package/dist/form/index.js +1 -1
- package/dist/src/components/confirm-button.js +1 -1
- package/dist/src/components/confirm-button.js.map +1 -1
- package/dist/src/components/copy-to-clipboard.js +1 -1
- package/dist/src/components/copy-to-clipboard.js.map +1 -1
- package/dist/src/components/image-with-fallback.js +1 -1
- package/dist/src/components/image-with-fallback.js.map +1 -1
- package/dist/src/data-surface/index.create.js +1 -1
- package/dist/src/data-surface/index.create.js.map +1 -1
- package/dist/src/data-surface/types.js.map +1 -1
- package/dist/src/data-surface/ui.units.js +1 -1
- package/dist/src/data-surface/ui.units.js.map +1 -1
- package/dist/src/data-surface/view-grid/index.js +1 -1
- package/dist/src/data-surface/view-grid/index.js.map +1 -1
- package/dist/src/data-surface/view-list/column-selector.js +1 -1
- package/dist/src/data-surface/view-list/column-selector.js.map +1 -1
- package/dist/src/data-surface/view-list/helpers.js +1 -1
- package/dist/src/data-surface/view-list/helpers.js.map +1 -1
- package/dist/src/data-surface/view-list/hooks.js +1 -1
- package/dist/src/data-surface/view-list/hooks.js.map +1 -1
- package/dist/src/data-surface/view-list/index.js +1 -1
- package/dist/src/data-surface/view-list/index.js.map +1 -1
- package/dist/src/data-surface/view-list/types.js.map +1 -1
- package/dist/src/filter-bar/filter-input.js +1 -1
- package/dist/src/filter-bar/filter-input.js.map +1 -1
- package/dist/src/filter-bar/filter-input.types.js.map +1 -1
- package/dist/src/filter-bar/filter-input.units.js +1 -1
- package/dist/src/filter-bar/filter-input.units.js.map +1 -1
- package/dist/src/filter-bar/filter-menu.helpers.js +1 -1
- package/dist/src/filter-bar/filter-menu.helpers.js.map +1 -1
- package/dist/src/filter-bar/filter-menu.js +1 -1
- package/dist/src/filter-bar/filter-menu.js.map +1 -1
- package/dist/src/filter-bar/filter-summary.js +1 -1
- package/dist/src/filter-bar/filter-summary.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-boolean.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-boolean.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-number.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-number.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select-with-api.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select-with-api.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.fallback.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.fallback.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-string.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-string.js.map +1 -1
- package/dist/src/filter-bar/index.create.js +1 -1
- package/dist/src/filter-bar/index.create.js.map +1 -1
- package/dist/src/filter-bar/index.dino.js +1 -1
- package/dist/src/filter-bar/index.dino.js.map +1 -1
- package/dist/src/filter-bar/types.js.map +1 -1
- package/dist/src/form/create.form-base.js +1 -1
- package/dist/src/form/create.form-base.js.map +1 -1
- package/dist/src/form/create.form-confirm.js +2 -0
- package/dist/src/form/create.form-confirm.js.map +1 -0
- package/dist/src/form/create.form-grid-layout.js +1 -1
- package/dist/src/form/create.form-grid-layout.js.map +1 -1
- package/dist/src/form/create.form-grid-layout.units.js +1 -1
- package/dist/src/form/create.form-grid-layout.units.js.map +1 -1
- package/dist/src/form/create.input.object.js +1 -1
- package/dist/src/form/create.input.object.js.map +1 -1
- package/dist/src/form/create.input.object.styled.js +1 -1
- package/dist/src/form/create.input.object.styled.js.map +1 -1
- package/dist/src/form/create.input.object.units.js +2 -0
- package/dist/src/form/create.input.object.units.js.map +1 -0
- package/dist/src/form/decorator.form.js +1 -1
- package/dist/src/form/decorator.form.js.map +1 -1
- package/dist/src/form/decorator.units.js +1 -1
- package/dist/src/form/decorator.units.js.map +1 -1
- package/dist/src/form/dino-form.js +1 -1
- package/dist/src/form/dino-form.js.map +1 -1
- package/dist/src/form/error-handler.js +1 -1
- package/dist/src/form/error-handler.js.map +1 -1
- package/dist/src/form/v2/create.date-picker.js +1 -1
- package/dist/src/form/v2/create.date-picker.js.map +1 -1
- package/dist/src/form/v2/create.input.js +1 -1
- package/dist/src/form/v2/create.input.js.map +1 -1
- package/dist/src/form/v2/create.select-simple.js +1 -1
- package/dist/src/form/v2/create.select-simple.js.map +1 -1
- package/dist/src/form/validator.js +1 -1
- package/dist/src/form/validator.js.map +1 -1
- package/dist/src/form/validator.units.js +2 -0
- package/dist/src/form/validator.units.js.map +1 -0
- package/dist/src/table/create.table.js +1 -1
- package/dist/src/table/create.table.js.map +1 -1
- package/dist/src/table/dino.js +1 -1
- package/dist/src/table/dino.js.map +1 -1
- package/dist/src/table/table.error-panel.js +2 -0
- package/dist/src/table/table.error-panel.js.map +1 -0
- package/dist/table/index.js +1 -1
- package/dist/types/components/confirm-button.d.ts +7 -0
- package/dist/types/components/copy-to-clipboard.d.ts +2 -1
- package/dist/types/data-surface/index.create.d.ts +21 -6
- package/dist/types/data-surface/types.d.ts +1 -1
- package/dist/types/data-surface/ui.units.d.ts +2 -2
- package/dist/types/data-surface/view-list/column-selector.d.ts +2 -2
- package/dist/types/data-surface/view-list/helpers.d.ts +9 -4
- package/dist/types/data-surface/view-list/types.d.ts +32 -14
- package/dist/types/filter-bar/filter-input.types.d.ts +2 -2
- package/dist/types/filter-bar/filter-input.units.d.ts +6 -2
- package/dist/types/filter-bar/filter-menu.types.d.ts +2 -2
- package/dist/types/filter-bar/filter-summary.types.d.ts +2 -2
- package/dist/types/filter-bar/form-field/create-form-field-boolean.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-number.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-select-with-api.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-select.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-string.d.ts +1 -1
- package/dist/types/filter-bar/index.dino.d.ts +6 -6
- package/dist/types/filter-bar/types.d.ts +4 -2
- package/dist/types/form/create.form-confirm.d.ts +33 -0
- package/dist/types/form/create.form-grid-layout.d.ts +15 -5
- package/dist/types/form/create.form-grid-layout.units.d.ts +15 -1
- package/dist/types/form/create.input.object.d.ts +15 -57
- package/dist/types/form/create.input.object.styled.d.ts +5 -0
- package/dist/types/form/create.input.object.units.d.ts +88 -0
- package/dist/types/form/decorator.units.d.ts +3 -1
- package/dist/types/form/dino-form.d.ts +2 -2
- package/dist/types/form/error-handler.d.ts +34 -4
- package/dist/types/form/index.d.ts +4 -1
- package/dist/types/form/v2/create.date-picker.d.ts +3 -3
- package/dist/types/form/v2/create.input.d.ts +42 -3
- package/dist/types/form/v2/create.select-simple.d.ts +1 -1
- package/dist/types/form/validator.d.ts +3 -52
- package/dist/types/form/validator.units.d.ts +65 -0
- package/dist/types/table/create.table.d.ts +7 -2
- package/dist/types/table/dino.d.ts +1 -0
- package/dist/types/table/index.d.ts +1 -0
- package/dist/types/table/table.error-panel.d.ts +7 -0
- package/dist/types/table/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/src/form/create.form-comfirm.js +0 -2
- package/dist/src/form/create.form-comfirm.js.map +0 -1
- package/dist/types/form/create.form-comfirm.d.ts +0 -20
|
@@ -41,6 +41,6 @@ export interface IFormFieldSelectWithApiParam<T> {
|
|
|
41
41
|
* @param params - Static configuration (fetchOptions, debounce settings, etc.)
|
|
42
42
|
* @returns A React FC ready to be used as a filter-menu field component
|
|
43
43
|
*/
|
|
44
|
-
declare function createFormFieldSelectWithApi<T>(params: IFormFieldSelectWithApiParam<T>): FC<IFormFieldSelectWithApiProps<T>>;
|
|
44
|
+
export declare function createFormFieldSelectWithApi<T>(params: IFormFieldSelectWithApiParam<T>): FC<IFormFieldSelectWithApiProps<T>>;
|
|
45
45
|
export default createFormFieldSelectWithApi;
|
|
46
46
|
export declare function formatterSelectWithApi<T = any>(field: TFieldType<T>, storageKey?: string): (param: TValueFormatterParam<T>) => string;
|
|
@@ -46,7 +46,7 @@ export interface IFormFieldSelectParam<T> {
|
|
|
46
46
|
* @param params - Static configuration (option list, optional field config override)
|
|
47
47
|
* @returns A React FC ready to be used as a filter-menu field component
|
|
48
48
|
*/
|
|
49
|
-
declare function createFormFieldSelect<T>(params: IFormFieldSelectParam<T>): FC<IFormFieldSelectProps<T>>;
|
|
49
|
+
export declare function createFormFieldSelect<T>(params: IFormFieldSelectParam<T>): FC<IFormFieldSelectProps<T>>;
|
|
50
50
|
/**
|
|
51
51
|
* Creates a labelFormatter for use in summaryConfig / menuConfig.
|
|
52
52
|
* Formats select field values to their human-readable labels from local storage.
|
|
@@ -25,5 +25,5 @@ export interface IFormFieldStringParam<T> {
|
|
|
25
25
|
* @param params - Static configuration (optional field config override)
|
|
26
26
|
* @returns A React FC ready to be used as a free-text filter-menu field component
|
|
27
27
|
*/
|
|
28
|
-
declare function createFormFieldString<T>(params?: IFormFieldStringParam<T>): FC<IFormFieldStringProps<T>>;
|
|
28
|
+
export declare function createFormFieldString<T>(params?: IFormFieldStringParam<T>): FC<IFormFieldStringProps<T>>;
|
|
29
29
|
export default createFormFieldString;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createFilterBar } from './index.create';
|
|
2
2
|
import { getFilterFromURL, isEmptyFilterState, isFilterStateEqual, removeNullValues, setFilterToURL } from './helpers';
|
|
3
|
+
import { createFormFieldString } from './form-field/create-form-field-string';
|
|
4
|
+
import { createFormFieldNumber, formatterNumber } from './form-field/create-form-field-number';
|
|
5
|
+
import { createFormFieldSelect, formatterSelect } from './form-field/create-form-field-select';
|
|
6
|
+
import { createFormFieldBoolean, formatterBoolean } from './form-field/create-form-field-boolean';
|
|
3
7
|
import { createFormFieldSelectWithFallback } from './form-field/create-form-field-select.fallback';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import createFormFieldSelect, { formatterSelect } from './form-field/create-form-field-select';
|
|
7
|
-
import createFormFieldBoolean, { formatterBoolean } from './form-field/create-form-field-boolean';
|
|
8
|
-
import createFormFieldSelectWithApi, { formatterSelectWithApi } from './form-field/create-form-field-select-with-api';
|
|
9
|
-
import createFormFieldString from './form-field/create-form-field-string';
|
|
8
|
+
import { createFormFieldDateTime, formatterDateTime } from './form-field/create-form-field-datetime';
|
|
9
|
+
import { createFormFieldSelectWithApi, formatterSelectWithApi } from './form-field/create-form-field-select-with-api';
|
|
10
10
|
export declare class DinoFilterBar {
|
|
11
11
|
createFilterBar: typeof createFilterBar;
|
|
12
12
|
createConvertToGraphQL: <TSource extends Record<string, any>, TTarget extends object, U extends object = {}>(state: import("./types").TFilterState<TSource>) => import("./convert-to-graphql").TableFileterConverter<TSource, TTarget, U>;
|
|
@@ -118,10 +118,12 @@ export type TFilterBarConfigs<T> = {
|
|
|
118
118
|
menuConfig?: Omit<IFilterMenuParam<T>, 'fields'>;
|
|
119
119
|
/** Toggle active summary chips bar below the filter bar @default true */
|
|
120
120
|
enableSummary?: boolean;
|
|
121
|
-
/** Toggle quick search pseudo-field in filter menu @default false */
|
|
122
|
-
enableQuickSearch?: boolean
|
|
121
|
+
/** Toggle quick search pseudo-field in filter menu or specify default search field @default false */
|
|
122
|
+
enableQuickSearch?: boolean | TFieldType<T>;
|
|
123
123
|
/** Specific options for Field Sorting behavior */
|
|
124
124
|
sortConfig?: ISortFieldConfig;
|
|
125
|
+
/** Toggle Sort functionality in FilterBar @default true */
|
|
126
|
+
enableSort?: boolean;
|
|
125
127
|
};
|
|
126
128
|
/**
|
|
127
129
|
* Sorting direction for fields ('asc' | 'desc').
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IErrorCommonGetter } from './error-handler';
|
|
2
|
+
import type { ButtonProps } from '@mui/material';
|
|
3
|
+
import type { ComponentType, PropsWithChildren, ReactNode } from 'react';
|
|
4
|
+
export interface IFormConfirmBaseHandlers<T = any> {
|
|
5
|
+
/** Custom extractor for common error messages */
|
|
6
|
+
errorCommonGetter?: IErrorCommonGetter;
|
|
7
|
+
/** Automatically push error message to global alert when submit fails. @default true */
|
|
8
|
+
autoAlertError?: boolean;
|
|
9
|
+
/** Default error message if error cannot be extracted. @default 'An error has occurred, please try again' */
|
|
10
|
+
defaultErrorMessage?: string;
|
|
11
|
+
/** Callback triggered after `onSubmit` successfully completes */
|
|
12
|
+
onSuccess?: (value?: T) => void;
|
|
13
|
+
/** Callback triggered when an error occurs during form submit */
|
|
14
|
+
onError?: (error: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface IFormConfirmParam<T = any> extends IFormConfirmBaseHandlers<T> {
|
|
17
|
+
title?: ReactNode;
|
|
18
|
+
content?: (value?: T) => ReactNode;
|
|
19
|
+
colors?: {
|
|
20
|
+
[key in 'yes' | 'no']?: ButtonProps['color'];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface IFormConfirmProps<T = any> extends PropsWithChildren, IFormConfirmBaseHandlers<T> {
|
|
24
|
+
data?: T;
|
|
25
|
+
title?: ReactNode;
|
|
26
|
+
onSubmit: (value?: T) => Promise<void>;
|
|
27
|
+
onCancel?: () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface IFormComfirmState {
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function createFormConfirm<T = any>(param?: IFormConfirmParam<T>): ComponentType<IFormConfirmProps<T>>;
|
|
33
|
+
export default createFormConfirm;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BoxProps, RegularBreakpoints, SxProps, Theme } from '@mui/material';
|
|
2
2
|
import type { ComponentType } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { IFormInputBase } from './types';
|
|
4
|
+
import { IFormBottomBarProps, IFormErrorPanelProps } from './create.form-grid-layout.units';
|
|
4
5
|
import FormValidator, { IPartialError } from './validator';
|
|
5
|
-
import { IFormBaseSlots } from './create.form-base';
|
|
6
|
+
import { IFormBaseErrorHandlers, IFormBaseSlots } from './create.form-base';
|
|
7
|
+
export type IFormErrorMode = 'footer' | 'panel';
|
|
6
8
|
export interface IFormGridLayoutConfig<T> {
|
|
7
9
|
key: keyof T;
|
|
8
10
|
label?: string;
|
|
@@ -18,10 +20,11 @@ export interface IFormGridLayoutMergedConfigs<T> {
|
|
|
18
20
|
disabledFields?: Partial<Record<keyof T, boolean>> | ((state: Partial<T>, model?: Partial<T>) => Partial<Record<keyof T, boolean>>);
|
|
19
21
|
}
|
|
20
22
|
export interface IFormGridLayoutSlots<T> extends IFormGridLayoutMergedConfigs<T> {
|
|
21
|
-
action?: ComponentType<
|
|
23
|
+
action?: ComponentType<IFormBottomBarProps<T>>;
|
|
22
24
|
actionBefore?: JSX.Element;
|
|
23
25
|
contentBefore?: JSX.Element;
|
|
24
26
|
contentAfter?: JSX.Element;
|
|
27
|
+
errorPanel?: ComponentType<IFormErrorPanelProps>;
|
|
25
28
|
closeState?: {
|
|
26
29
|
Success?: boolean;
|
|
27
30
|
Fail?: boolean;
|
|
@@ -30,12 +33,15 @@ export interface IFormGridLayoutSlots<T> extends IFormGridLayoutMergedConfigs<T>
|
|
|
30
33
|
preSubmit?: IPreSubmitEvent<T>;
|
|
31
34
|
formSlots?: IFormBaseSlots;
|
|
32
35
|
}
|
|
33
|
-
export interface IFormGridLayoutParams<T> extends IFormGridLayoutSlots<T> {
|
|
36
|
+
export interface IFormGridLayoutParams<T> extends IFormGridLayoutSlots<T>, IFormBaseErrorHandlers<T> {
|
|
34
37
|
configs: IFormGridLayoutConfig<T>[];
|
|
35
38
|
validate: FormValidator<Partial<T>>;
|
|
36
39
|
autoHeight?: boolean;
|
|
40
|
+
checkChanged?: boolean;
|
|
41
|
+
noChangeMessage?: string;
|
|
42
|
+
errorMode?: IFormErrorMode;
|
|
37
43
|
}
|
|
38
|
-
export interface IFormGridLayoutProps<T> {
|
|
44
|
+
export interface IFormGridLayoutProps<T> extends IFormBaseErrorHandlers<T> {
|
|
39
45
|
data?: T;
|
|
40
46
|
onSubmit: (value: Partial<T>, signal?: AbortSignal) => Promise<void>;
|
|
41
47
|
onError?: (error: any) => void;
|
|
@@ -44,6 +50,10 @@ export interface IFormGridLayoutProps<T> {
|
|
|
44
50
|
sx?: SxProps<Theme>;
|
|
45
51
|
slots?: IFormGridLayoutSlots<T>;
|
|
46
52
|
autoHeight?: boolean;
|
|
53
|
+
checkChanged?: boolean;
|
|
54
|
+
noChangeMessage?: string;
|
|
55
|
+
/** Error display mode: 'footer' (in bottom bar) or 'panel' (red alert box at end of form). @default 'footer' */
|
|
56
|
+
errorMode?: IFormErrorMode;
|
|
47
57
|
}
|
|
48
58
|
export interface IFormGridLayoutState {
|
|
49
59
|
loadding?: boolean;
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { IFormBase } from './types';
|
|
3
|
+
import { IPartialError } from './validator';
|
|
3
4
|
export declare const formGridLayoutClasses: {
|
|
4
5
|
root: string;
|
|
5
6
|
form: string;
|
|
6
7
|
bottomBar: string;
|
|
8
|
+
errorWrapper: string;
|
|
9
|
+
errorText: string;
|
|
10
|
+
otherErrorText: string;
|
|
11
|
+
errorPanel: string;
|
|
12
|
+
errorPanelText: string;
|
|
13
|
+
errorPanelList: string;
|
|
7
14
|
autoHeight: string;
|
|
8
15
|
};
|
|
9
16
|
export declare const FormGridLayoutStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
17
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
11
18
|
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
12
|
-
export interface
|
|
19
|
+
export interface IFormErrorPanelProps {
|
|
20
|
+
messageErrors?: IPartialError<any>;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const FormErrorPanelStyled: import("@emotion/styled").StyledComponent<import("@mui/material").AlertProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
24
|
+
export declare const FormErrorPanel: FC<IFormErrorPanelProps>;
|
|
25
|
+
export interface IFormBottomBarProps<T = any> extends IFormBase<T> {
|
|
13
26
|
before?: ReactNode;
|
|
27
|
+
loading?: boolean;
|
|
14
28
|
}
|
|
15
29
|
export declare function CreateFormBottomBar<T>(): FC<IFormBottomBarProps<T>>;
|
|
16
30
|
export declare const FormBottomBarWrap: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -2,64 +2,9 @@ import { ComponentType, ReactNode } from 'react';
|
|
|
2
2
|
import { BoxProps } from '@mui/material';
|
|
3
3
|
import { IFormInputBase } from './types';
|
|
4
4
|
import { inputObjectClasses } from './create.input.object.styled';
|
|
5
|
+
import type { IInputObjectFields } from './create.input.object.units';
|
|
5
6
|
export { inputObjectClasses };
|
|
6
|
-
|
|
7
|
-
export interface ISelectOption {
|
|
8
|
-
value: string | number;
|
|
9
|
-
/** Display label for the option. Defaults to value if omitted. */
|
|
10
|
-
label?: string;
|
|
11
|
-
}
|
|
12
|
-
interface INumberInputOptions {
|
|
13
|
-
min?: number;
|
|
14
|
-
max?: number;
|
|
15
|
-
step?: number;
|
|
16
|
-
}
|
|
17
|
-
/** Configuration for an individual field column in an object row. */
|
|
18
|
-
export interface IInputObjectField<J = any> {
|
|
19
|
-
label?: string;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
/** @default 'string' */
|
|
22
|
-
inputType?: 'string' | 'number' | 'select';
|
|
23
|
-
/** @default [] */
|
|
24
|
-
selectItems?: ISelectOption[] | ((item: Partial<J>) => ISelectOption[]);
|
|
25
|
-
numberOptions?: INumberInputOptions | ((item: Partial<J>) => INumberInputOptions);
|
|
26
|
-
/** @default '' */
|
|
27
|
-
defaultValue?: any;
|
|
28
|
-
/**
|
|
29
|
-
* Determine the flex layout space the field occupies.
|
|
30
|
-
* Can be a number, string, or a function evaluating the current row item values.
|
|
31
|
-
* @default 1
|
|
32
|
-
*/
|
|
33
|
-
flex?: number | string | ((item: Partial<J>) => number | string);
|
|
34
|
-
/**
|
|
35
|
-
* Determine if the field should be disabled.
|
|
36
|
-
* Can be a boolean or a function evaluating the current row item values.
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
disabled?: boolean | ((item: Partial<J>) => boolean);
|
|
40
|
-
/**
|
|
41
|
-
* Determine if the field should be visible.
|
|
42
|
-
* Can be a boolean or a function evaluating the current row item values.
|
|
43
|
-
* If false, the field will not be rendered (returns null).
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
visible?: boolean | ((item: Partial<J>) => boolean);
|
|
47
|
-
/**
|
|
48
|
-
* End icon for the input.
|
|
49
|
-
* Can be a ReactNode or a function evaluating the current row item values.
|
|
50
|
-
* @default undefined
|
|
51
|
-
*/
|
|
52
|
-
endIcon?: ReactNode | ((item: Partial<J>) => ReactNode);
|
|
53
|
-
}
|
|
54
|
-
/** Field configuration map for row item model J. */
|
|
55
|
-
export type IInputObjectFields<J = any> = {
|
|
56
|
-
[key in keyof J]?: IInputObjectField<J>;
|
|
57
|
-
};
|
|
58
|
-
/** Internal row item state wrapper. */
|
|
59
|
-
export interface IInputObjectItem<J = any> {
|
|
60
|
-
id: string;
|
|
61
|
-
values: Partial<J>;
|
|
62
|
-
}
|
|
7
|
+
export type { ISelectOption, INumberInputOptions, IInputObjectField, IInputObjectFields, IInputObjectItem } from './create.input.object.units';
|
|
63
8
|
/** Customizable slots and options for InputObject component. */
|
|
64
9
|
export interface IInputObjectSlots<J = any> {
|
|
65
10
|
/** @default 'Object Registry' */
|
|
@@ -78,6 +23,11 @@ export interface IInputObjectSlots<J = any> {
|
|
|
78
23
|
fields?: IInputObjectFields<J>;
|
|
79
24
|
/** Optional maximum number of object row items allowed. */
|
|
80
25
|
maxItems?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Determine whether to display the column header row above item entries.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
showHeader?: boolean;
|
|
81
31
|
}
|
|
82
32
|
/** Parameters passed to createInputObject factory function. */
|
|
83
33
|
export interface IInputObjectParams<J = any> extends IInputObjectSlots<J> {
|
|
@@ -88,6 +38,14 @@ export interface IInputObjectProps<T = any, J = any> extends IFormInputBase<T, I
|
|
|
88
38
|
onChange?: (value: string) => void;
|
|
89
39
|
fields?: IInputObjectFields<J>;
|
|
90
40
|
maxItems?: number;
|
|
41
|
+
showHeader?: boolean;
|
|
91
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Factory function creating a dynamic Object Form Input Component matching key-value styling.
|
|
45
|
+
* @template T Form Data Model interface.
|
|
46
|
+
* @template J Row Item Model interface.
|
|
47
|
+
* @param params Component configuration parameters and default field definitions.
|
|
48
|
+
* @returns React Component for rendering dynamic object list inputs.
|
|
49
|
+
*/
|
|
92
50
|
export declare function createInputObject<T = any, J = any>(params?: IInputObjectParams<J>): ComponentType<IInputObjectProps<T, J>>;
|
|
93
51
|
export default createInputObject;
|
|
@@ -11,7 +11,12 @@ export declare const inputObjectClasses: {
|
|
|
11
11
|
createBtn: string;
|
|
12
12
|
rowList: string;
|
|
13
13
|
row: string;
|
|
14
|
+
rowAction: string;
|
|
14
15
|
field: string;
|
|
16
|
+
fieldHidden: string;
|
|
17
|
+
columnHeader: string;
|
|
18
|
+
columnHeaderItem: string;
|
|
19
|
+
columnHeaderAction: string;
|
|
15
20
|
deleteBtn: string;
|
|
16
21
|
noDataPanel: string;
|
|
17
22
|
noDataIcon: string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Option entry for select input dropdown. */
|
|
3
|
+
export interface ISelectOption {
|
|
4
|
+
value: string | number;
|
|
5
|
+
/** Display label for the option. Defaults to value if omitted. */
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface INumberInputOptions {
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Configuration for an individual field column in an object row. */
|
|
14
|
+
export interface IInputObjectField<J = any> {
|
|
15
|
+
label?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** @default 'string' */
|
|
18
|
+
inputType?: 'string' | 'number' | 'select';
|
|
19
|
+
/** @default [] */
|
|
20
|
+
selectItems?: ISelectOption[] | ((item: Partial<J>) => ISelectOption[]);
|
|
21
|
+
numberOptions?: INumberInputOptions | ((item: Partial<J>) => INumberInputOptions);
|
|
22
|
+
/** @default '' */
|
|
23
|
+
defaultValue?: any;
|
|
24
|
+
/**
|
|
25
|
+
* Determine the flex layout space the field occupies.
|
|
26
|
+
* Can be a number, string, or a function evaluating the current row item values.
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
flex?: number | string | ((item: Partial<J>) => number | string);
|
|
30
|
+
/**
|
|
31
|
+
* Determine if the field should be disabled.
|
|
32
|
+
* Can be a boolean or a function evaluating the current row item values.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean | ((item: Partial<J>) => boolean);
|
|
36
|
+
/**
|
|
37
|
+
* Determine if the field should be visible.
|
|
38
|
+
* Can be a boolean or a function evaluating the current row item values.
|
|
39
|
+
* If false, the field will retain its slot width with hidden visibility.
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
visible?: boolean | ((item: Partial<J>) => boolean);
|
|
43
|
+
/**
|
|
44
|
+
* End icon for the input.
|
|
45
|
+
* Can be a ReactNode or a function evaluating the current row item values.
|
|
46
|
+
* @default undefined
|
|
47
|
+
*/
|
|
48
|
+
endIcon?: ReactNode | ((item: Partial<J>) => ReactNode);
|
|
49
|
+
}
|
|
50
|
+
/** Field configuration map for row item model J. */
|
|
51
|
+
export type IInputObjectFields<J = any> = {
|
|
52
|
+
[key in keyof J]?: IInputObjectField<J>;
|
|
53
|
+
};
|
|
54
|
+
/** Internal row item state wrapper. */
|
|
55
|
+
export interface IInputObjectItem<J = any> {
|
|
56
|
+
id: string;
|
|
57
|
+
values: Partial<J>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Generates a short unique string ID.
|
|
61
|
+
* @returns Unique string ID.
|
|
62
|
+
*/
|
|
63
|
+
export declare const generateUniqueId: () => string;
|
|
64
|
+
/**
|
|
65
|
+
* Constructs an initial default value object for a new row item based on field configurations.
|
|
66
|
+
* @param fields Field configuration map.
|
|
67
|
+
* @returns Initial default value mapping for item model J.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createDefaultItem<J>(fields?: IInputObjectFields<J>): Partial<J>;
|
|
70
|
+
/**
|
|
71
|
+
* Determines whether a row item has no valid user inputs filled out.
|
|
72
|
+
* @param item Row item state wrapper.
|
|
73
|
+
* @returns True if all values are empty strings, null, or undefined.
|
|
74
|
+
*/
|
|
75
|
+
export declare function isRowEmpty<J>(item?: IInputObjectItem<J>): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Safely parses raw input data (JSON string or array of objects) into an item state array.
|
|
78
|
+
* Preserves existing item IDs when available to prevent React component unmounting and focus loss.
|
|
79
|
+
* @param raw Raw input data from form model or default props.
|
|
80
|
+
* @param existingItems Current item state array to preserve stable IDs.
|
|
81
|
+
* @returns Array of parsed row items with stable unique IDs.
|
|
82
|
+
*/
|
|
83
|
+
export declare function parseObjectData<J>(raw: any, existingItems?: IInputObjectItem<J>[]): IInputObjectItem<J>[];
|
|
84
|
+
/**
|
|
85
|
+
* Serializes an array of row items back into a JSON string format, filtering out empty entries.
|
|
86
|
+
* Converts string values to numbers if the field config specifies inputType 'number'.
|
|
87
|
+
*/
|
|
88
|
+
export declare function serializeObjectData<J>(items: IInputObjectItem<J>[], fields?: IInputObjectFields<J>): string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { BoxProps, ButtonProps } from '@mui/material';
|
|
3
3
|
import { IFormBaseContext } from './types';
|
|
4
|
+
import { extractErrorMessages, formatDisplayErrorMessage } from './error-handler';
|
|
5
|
+
export { extractErrorMessages, formatDisplayErrorMessage };
|
|
4
6
|
export interface IFormFooterSlots {
|
|
5
7
|
after?: React.ReactNode;
|
|
6
8
|
before?: React.ReactNode;
|
|
@@ -13,7 +15,7 @@ export interface IFormFooterProps<T = any> extends Omit<BoxProps, 'slots'> {
|
|
|
13
15
|
interface IInternalFormFooterProps<T = any> extends IFormFooterProps<T> {
|
|
14
16
|
slots?: IFormFooterSlots;
|
|
15
17
|
errorMessage?: string;
|
|
18
|
+
remainingErrorCount?: number;
|
|
16
19
|
onCancel?: ButtonProps['onClick'];
|
|
17
20
|
}
|
|
18
21
|
export declare const FormFooter: FC<IInternalFormFooterProps<any>>;
|
|
19
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import FormValidator from './validator';
|
|
3
|
-
import
|
|
3
|
+
import createFormConfirm from './create.form-confirm';
|
|
4
4
|
import createCheckbox from './create.checkbox';
|
|
5
5
|
import createInputFile from './create.input.file';
|
|
6
6
|
import createDatePickerV2 from './v2/create.date-picker';
|
|
@@ -23,7 +23,7 @@ export declare class DinoForm {
|
|
|
23
23
|
FormValidator: typeof FormValidator;
|
|
24
24
|
validator: <T>(configs: import("./validator").IFormValidatorConfig<T>) => FormValidator<T>;
|
|
25
25
|
createFormBase: <T>(config?: import("./create.form-base").IFormBaseConfig<T> | undefined) => import("./create.form-base").IFormBaseResult<T>;
|
|
26
|
-
|
|
26
|
+
createFormConfirm: typeof createFormConfirm;
|
|
27
27
|
createFormGridLayout: <T>(params: import("./create.form-grid-layout").IFormGridLayoutParams<T>) => import("react").ComponentType<import("./create.form-grid-layout").IFormGridLayoutProps<T>>;
|
|
28
28
|
createDecoratorForm: <T>(configClass?: any, config?: Partial<Omit<import("./decorator.form").IDecoratorFormProps<T>, "configClass">> | undefined) => import("react").ComponentType<import("./decorator.form").IDecoratorFormProps<T>>;
|
|
29
29
|
createColorPicker: typeof createColorPicker;
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
import { IPartialError } from './validator';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Unpacks a raw error message string into a list of human-readable messages.
|
|
4
|
+
* If the string is a serialized JSON object/array (e.g. `{"duration":"Duration is required."}`),
|
|
5
|
+
* all string values inside are extracted as individual error messages.
|
|
6
|
+
*/
|
|
7
|
+
export declare const extractErrorMessages: (message?: string) => string[];
|
|
8
|
+
/**
|
|
9
|
+
* Safely extracts a clean human-readable error string (1st message only).
|
|
10
|
+
*/
|
|
11
|
+
export declare const formatDisplayErrorMessage: (message?: string) => string;
|
|
12
|
+
export interface IFormDisplayError {
|
|
13
|
+
firstMessage: string;
|
|
14
|
+
remainingCount: number;
|
|
15
|
+
allMessages: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Extracts and flattens all error messages from IPartialError into a structured summary for form display.
|
|
19
|
+
* Unpacks any serialized JSON object strings into individual errors.
|
|
20
|
+
*/
|
|
21
|
+
export declare const extractFormDisplayErrors: <T = any>(messageErrors?: IPartialError<T> | undefined) => IFormDisplayError;
|
|
22
|
+
export interface ISplitFormErrors<T = any> {
|
|
23
|
+
commonErrors: IPartialError<T>;
|
|
24
|
+
fieldErrors: IPartialError<T>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Splits an IPartialError map into common errors (key '') and field-specific errors (all other keys).
|
|
28
|
+
*/
|
|
29
|
+
export declare const splitFormErrors: <T = any>(messageErrors?: IPartialError<T> | undefined) => ISplitFormErrors<T>;
|
|
30
|
+
export type IErrorGetter<T> = (error: any, currentErrors?: {
|
|
31
|
+
[key in keyof T]?: string | string[];
|
|
32
|
+
}, modelRender?: Partial<T>) => {
|
|
3
33
|
[key in keyof T]?: string | string[];
|
|
4
34
|
} | undefined;
|
|
5
|
-
export type IErrorCommonGetter = (error: any) => string | string[] | undefined;
|
|
35
|
+
export type IErrorCommonGetter = (error: any, currentError?: string | string[]) => string | string[] | undefined;
|
|
6
36
|
export declare class ErrorHandler<T> {
|
|
7
|
-
getError:
|
|
37
|
+
getError: (error: any, modelRender?: Partial<T>) => { [key in keyof T]?: string | undefined; };
|
|
8
38
|
errorToPartialError: (errors: { [key in keyof T]?: string | string[] | undefined; }) => IPartialError<T>;
|
|
9
|
-
getErrorCommon:
|
|
39
|
+
getErrorCommon: (error: any) => string[];
|
|
10
40
|
}
|
|
@@ -9,6 +9,7 @@ export type { InputBaseImage } from './create.input';
|
|
|
9
9
|
export type { ISelectSimpleOption } from './create.select-simple';
|
|
10
10
|
export * from './decorator';
|
|
11
11
|
export * from './decorator.form';
|
|
12
|
+
export * from './create.form-confirm';
|
|
12
13
|
export { default as createColorPickerV2 } from './v2/create.color-picker';
|
|
13
14
|
export * from './v2/create.color-picker';
|
|
14
15
|
export { default as createDatePickerV2 } from './v2/create.date-picker';
|
|
@@ -21,5 +22,7 @@ export { default as createSelectSimpleV2 } from './v2/create.select-simple';
|
|
|
21
22
|
export * from './v2/create.select-simple';
|
|
22
23
|
export { default as createSelectWithApiV2 } from './v2/create.select-with-api';
|
|
23
24
|
export * from './v2/create.select-with-api';
|
|
24
|
-
export { formGridLayoutClasses } from './create.form-grid-layout.units';
|
|
25
|
+
export { formGridLayoutClasses, FormErrorPanel, type IFormErrorPanelProps } from './create.form-grid-layout.units';
|
|
26
|
+
export type { IFormErrorMode } from './create.form-grid-layout';
|
|
27
|
+
export { splitFormErrors, type ISplitFormErrors } from './error-handler';
|
|
25
28
|
export * from './create.input.object';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
1
|
import { Dayjs } from 'dayjs';
|
|
3
|
-
import { BoxProps } from '@mui/material';
|
|
4
|
-
import { DatePickerProps } from '@mui/x-date-pickers';
|
|
5
2
|
import { IFormInputBase } from '../types';
|
|
3
|
+
import type { ComponentType } from 'react';
|
|
4
|
+
import type { BoxProps } from '@mui/material';
|
|
5
|
+
import type { DatePickerProps } from '@mui/x-date-pickers';
|
|
6
6
|
export interface IDatePickerSlots {
|
|
7
7
|
defaultValue?: string;
|
|
8
8
|
minDate?: Dayjs;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import React, { ComponentType } from 'react';
|
|
2
|
-
import { TextFieldProps } from '@mui/material';
|
|
1
|
+
import React, { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { BoxProps, TextFieldProps } from '@mui/material';
|
|
3
|
+
import { SwitchProps } from '@mui/material';
|
|
3
4
|
import { IFormInputBase } from './../types';
|
|
4
5
|
import { IImageWithFallbackPropsOwner } from '../../components/image-with-fallback';
|
|
5
6
|
import { IRichTooltipPanelConfig } from '../../components/rich-tooltip';
|
|
6
7
|
export interface InputBaseImage<T> extends Omit<Partial<IImageWithFallbackPropsOwner>, 'src'> {
|
|
7
|
-
src?: string | ((value: any, model?: Partial<T>) => string | undefined);
|
|
8
|
+
src?: string | ((value: any, model?: Partial<T>, modelState?: Partial<T>) => string | undefined);
|
|
8
9
|
element?: React.ComponentType<{
|
|
9
10
|
value: any;
|
|
10
11
|
model?: Partial<T>;
|
|
12
|
+
modelState?: Partial<T>;
|
|
11
13
|
}>;
|
|
12
14
|
mirror?: boolean;
|
|
15
|
+
wrapProps?: BoxProps;
|
|
13
16
|
}
|
|
14
17
|
export interface IInputSlots<T> {
|
|
15
18
|
maxLength?: number;
|
|
@@ -19,11 +22,43 @@ export interface IInputSlots<T> {
|
|
|
19
22
|
imageLeft?: InputBaseImage<T>;
|
|
20
23
|
imageRight?: InputBaseImage<T>;
|
|
21
24
|
tooltip?: IRichTooltipPanelConfig;
|
|
25
|
+
/** Custom end input slot that remains active even when the input is disabled */
|
|
26
|
+
endInput?: ReactNode | ((context: {
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
value?: string;
|
|
29
|
+
}) => ReactNode);
|
|
30
|
+
/** Enable switch to toggle input active state @default false */
|
|
31
|
+
switchable?: boolean;
|
|
32
|
+
/** Controlled initial state of the switch */
|
|
33
|
+
switchChecked?: boolean;
|
|
34
|
+
/** Custom getter to derive switch checked state from data model */
|
|
35
|
+
switchCheckedGetter?: (value: any, model?: Partial<T>) => boolean;
|
|
36
|
+
/** Custom props passed to MUI Switch */
|
|
37
|
+
switchProps?: SwitchProps;
|
|
38
|
+
/** Custom label for switch toggle @default { on: 'Enabled', off: 'Disabled' } */
|
|
39
|
+
switchLabel?: string | {
|
|
40
|
+
on?: string;
|
|
41
|
+
off?: string;
|
|
42
|
+
};
|
|
22
43
|
}
|
|
23
44
|
export interface IInputProps<T> extends IFormInputBase<T, IInputSlots<T>> {
|
|
45
|
+
onChange?: (value: string) => void;
|
|
46
|
+
endInput?: ReactNode | ((context: {
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
value?: string;
|
|
49
|
+
}) => ReactNode);
|
|
50
|
+
switchable?: boolean;
|
|
51
|
+
switchChecked?: boolean;
|
|
52
|
+
switchCheckedGetter?: (value: any, model?: Partial<T>) => boolean;
|
|
53
|
+
switchProps?: SwitchProps;
|
|
54
|
+
switchLabel?: string | {
|
|
55
|
+
on?: string;
|
|
56
|
+
off?: string;
|
|
57
|
+
};
|
|
24
58
|
}
|
|
25
59
|
export interface IInputState {
|
|
26
60
|
value?: string;
|
|
61
|
+
switchChecked: boolean;
|
|
27
62
|
}
|
|
28
63
|
export interface IInputParams<T> extends IInputSlots<T> {
|
|
29
64
|
}
|
|
@@ -31,6 +66,10 @@ declare const createInput: <T>(params?: IInputParams<T> | undefined) => React.Co
|
|
|
31
66
|
export default createInput;
|
|
32
67
|
export declare const inputClasses: {
|
|
33
68
|
root: string;
|
|
69
|
+
labelWrapper: string;
|
|
34
70
|
label: string;
|
|
71
|
+
control: string;
|
|
72
|
+
labelSwitch: string;
|
|
73
|
+
switch: string;
|
|
35
74
|
input: string;
|
|
36
75
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BoxProps, SelectProps } from '@mui/material';
|
|
2
1
|
import type { ComponentType } from 'react';
|
|
2
|
+
import type { BoxProps, SelectProps } from '@mui/material';
|
|
3
3
|
import type { IFormInputBase } from '../types';
|
|
4
4
|
import type { IRichTooltipPanelConfig } from '../../components/rich-tooltip';
|
|
5
5
|
export interface ISelectSimpleOption<T = any> {
|
|
@@ -1,60 +1,11 @@
|
|
|
1
|
+
import { EValidateRule, IRuleOptions } from './validator.units';
|
|
2
|
+
export { EValidateRule } from './validator.units';
|
|
3
|
+
export type { INumberRuleOptions, IRuleOptions, IArrayRuleOptions, IFileRuleOptions, IFileImageRuleOptions } from './validator.units';
|
|
1
4
|
export type IModelBase = {
|
|
2
5
|
[key: string]: any;
|
|
3
6
|
};
|
|
4
|
-
export declare enum EValidateRule {
|
|
5
|
-
Required = "Required",
|
|
6
|
-
Regex = "Regex",
|
|
7
|
-
RequiredValue = "RequiredValue",
|
|
8
|
-
Array = "Array",
|
|
9
|
-
Number = "Number",
|
|
10
|
-
Email = "Email",
|
|
11
|
-
PhoneNumber = "PhoneNumber",
|
|
12
|
-
Url = "Url",
|
|
13
|
-
File = "File",
|
|
14
|
-
FileImage = "FileImage",
|
|
15
|
-
FileRequired = "FileRequired",
|
|
16
|
-
Custom = "Custom"
|
|
17
|
-
}
|
|
18
7
|
export type EValidateRuleString = `${EValidateRule}`;
|
|
19
8
|
type IValidateRuleType = EValidateRule | EValidateRuleString;
|
|
20
|
-
export interface IFileRuleOptions {
|
|
21
|
-
/** Max size of single file in bytes */
|
|
22
|
-
maxSize?: number;
|
|
23
|
-
/** If true, maxSize applies to the total combined size of all files instead of each individual file */
|
|
24
|
-
sumSize?: boolean;
|
|
25
|
-
/** Exact number of files required */
|
|
26
|
-
count?: number;
|
|
27
|
-
/** Max number of files allowed */
|
|
28
|
-
maxCount?: number;
|
|
29
|
-
/** Min number of files required */
|
|
30
|
-
minCount?: number;
|
|
31
|
-
}
|
|
32
|
-
export interface IFileImageRuleOptions extends IFileRuleOptions {
|
|
33
|
-
/** Max image width in pixels */
|
|
34
|
-
maxWidth?: number;
|
|
35
|
-
/** Max image height in pixels */
|
|
36
|
-
maxHeight?: number;
|
|
37
|
-
/** Min image width in pixels */
|
|
38
|
-
minWidth?: number;
|
|
39
|
-
/** Min image height in pixels */
|
|
40
|
-
minHeight?: number;
|
|
41
|
-
}
|
|
42
|
-
export interface IArrayRuleOptions {
|
|
43
|
-
/** Exact number of items required in the array */
|
|
44
|
-
count?: number;
|
|
45
|
-
/** Max number of items allowed in the array */
|
|
46
|
-
maxCount?: number;
|
|
47
|
-
/** Min number of items required in the array */
|
|
48
|
-
minCount?: number;
|
|
49
|
-
}
|
|
50
|
-
export interface IRuleOptions {
|
|
51
|
-
/** Only apply for file rule */
|
|
52
|
-
file?: IFileRuleOptions;
|
|
53
|
-
/** Only apply for file image rule */
|
|
54
|
-
image?: IFileImageRuleOptions;
|
|
55
|
-
/** Only apply for array rule */
|
|
56
|
-
array?: IArrayRuleOptions;
|
|
57
|
-
}
|
|
58
9
|
export interface IValidateRule<T = any> {
|
|
59
10
|
/** The validation rule type to execute */
|
|
60
11
|
rule: IValidateRuleType;
|