reactaform 1.5.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common-Awfy-0XP.js +1 -0
- package/dist/{common-DRxsgpaH.mjs → common-BZgeDhcm.mjs} +40 -15
- package/dist/common-BmlrZtLZ.js +1 -0
- package/dist/common-CBecOKIA.mjs +123 -0
- package/dist/{common-CTK4jqc5.mjs → common-CsY8BnXg.mjs} +58 -33
- package/dist/common-D8L4oP0c.js +1 -0
- package/dist/common-DnEDu-7h.mjs +123 -0
- package/dist/common-udunqMU-.js +1 -0
- package/dist/components/LayoutComponents.d.ts +77 -0
- package/dist/components/PopupOptionMenu.d.ts +16 -0
- package/dist/components/ReactaForm.d.ts +4 -0
- package/dist/components/ReactaFormProvider.d.ts +5 -0
- package/dist/components/ReactaFormRenderer.d.ts +10 -0
- package/dist/components/SubmissionButton.d.ts +8 -0
- package/dist/components/SubmissionMessage.d.ts +7 -0
- package/dist/components/Tooltip.d.ts +8 -0
- package/dist/components/fields/CheckboxInput.d.ts +5 -0
- package/dist/components/fields/ColorInput.d.ts +13 -0
- package/dist/components/fields/DateInput.d.ts +11 -0
- package/dist/components/fields/DropdownInput.d.ts +16 -0
- package/dist/components/fields/EmailInput.d.ts +5 -0
- package/dist/components/fields/FileInput.d.ts +5 -0
- package/dist/components/fields/FloatArrayInput.d.ts +8 -0
- package/dist/components/fields/FloatInput.d.ts +9 -0
- package/dist/components/fields/ImageDisplay.d.ts +18 -0
- package/dist/components/fields/IntegerArrayInput.d.ts +9 -0
- package/dist/components/fields/IntegerInput.d.ts +6 -0
- package/dist/components/fields/MultiSelection.d.ts +9 -0
- package/dist/components/fields/MultilineTextInput.d.ts +6 -0
- package/dist/components/fields/NumericStepperInput.d.ts +6 -0
- package/dist/components/fields/PasswordInput.d.ts +6 -0
- package/dist/components/fields/PhoneInput.d.ts +6 -0
- package/dist/components/fields/RadioInput.d.ts +8 -0
- package/dist/components/fields/RatingInput.d.ts +9 -0
- package/dist/components/fields/Separator.d.ts +21 -0
- package/dist/components/fields/SliderInput.d.ts +5 -0
- package/dist/components/fields/SpinInput.d.ts +5 -0
- package/dist/components/fields/SwitchInput.d.ts +8 -0
- package/dist/components/fields/TextInput.d.ts +8 -0
- package/dist/components/fields/TimeInput.d.ts +6 -0
- package/dist/components/fields/UnitValueInput.d.ts +5 -0
- package/dist/components/fields/UrlInput.d.ts +9 -0
- package/dist/components/renderFields.d.ts +3 -0
- package/dist/core/baseRegistry.d.ts +15 -0
- package/dist/core/componentRegistry.d.ts +15 -0
- package/dist/core/env.d.ts +1 -0
- package/dist/core/fieldVisibility.d.ts +25 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/pluginRegistry.d.ts +45 -0
- package/dist/core/reactaFormModel.d.ts +31 -0
- package/dist/core/reactaFormTypes.d.ts +148 -0
- package/dist/core/submissionHandlerRegistry.d.ts +7 -0
- package/dist/core/submitForm.d.ts +9 -0
- package/dist/hooks/useDebouncedCallback.d.ts +27 -0
- package/dist/hooks/useDropdownPosition.d.ts +6 -0
- package/dist/hooks/useFieldValidator.d.ts +2 -0
- package/dist/hooks/useReactaFormContext.d.ts +4 -0
- package/dist/hooks/useUncontrolledValidatedInput.d.ts +18 -0
- package/dist/hooks/useUnitValueField.d.ts +13 -0
- package/dist/index.d.ts +10 -9
- package/dist/reactaform.cjs.js +18 -5
- package/dist/reactaform.css +1 -1
- package/dist/reactaform.es.js +4346 -3991
- package/dist/utils/cssClasses.d.ts +14 -0
- package/dist/utils/definitionSerializers.d.ts +62 -0
- package/dist/utils/groupingHelpers.d.ts +24 -0
- package/dist/utils/themeUtils.d.ts +31 -0
- package/dist/utils/translationCache.d.ts +43 -0
- package/dist/utils/unitValueMapper.d.ts +14 -0
- package/dist/validation/registerBuiltinTypeValidators.d.ts +11 -0
- package/dist/validation/validateColorField.d.ts +2 -0
- package/dist/validation/validateDateField.d.ts +2 -0
- package/dist/validation/validateEmailField.d.ts +2 -0
- package/dist/validation/validateFieldPattern.d.ts +3 -0
- package/dist/validation/validateFileField.d.ts +2 -0
- package/dist/validation/validateFloatField.d.ts +3 -0
- package/dist/validation/validateIntegerField.d.ts +3 -0
- package/dist/validation/validatePhoneField.d.ts +2 -0
- package/dist/validation/validateRatingField.d.ts +2 -0
- package/dist/validation/validateSelectionFields.d.ts +3 -0
- package/dist/validation/validateTextField.d.ts +2 -0
- package/dist/validation/validateTimeField.d.ts +2 -0
- package/dist/validation/validateUnitValueField.d.ts +2 -0
- package/dist/validation/validateUrlField.d.ts +2 -0
- package/dist/validation/validation.d.ts +12 -0
- package/dist/validation/validationHandlerRegistry.d.ts +20 -0
- package/package.json +14 -34
- package/dist/common-BeJOG7Z0.js +0 -1
- package/dist/common-Crb-me6O.js +0 -1
- package/dist/common-DINaqn4M.mjs +0 -98
- package/dist/common-DLr0UoG9.js +0 -1
- package/dist/common-DRIndE7S.js +0 -1
- package/dist/common-DXEjsP3o.mjs +0 -98
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
type CheckboxInputProps = BaseInputProps<boolean, DefinitionPropertyField>;
|
|
4
|
+
export declare const CheckboxInput: React.FC<CheckboxInputProps>;
|
|
5
|
+
export default CheckboxInput;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
export type ColorInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
|
+
/**
|
|
5
|
+
* ColorInput Component
|
|
6
|
+
* * ---------------------
|
|
7
|
+
* A reusable color input field that supports a predefined list of color options
|
|
8
|
+
* (e.g., Red, Blue, etc.) and also allows the user to choose a custom color via
|
|
9
|
+
* a native HTML `<input type="color">`.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
declare const ColorInput: React.FC<ColorInputProps>;
|
|
13
|
+
export default ColorInput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
type DateInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
+
/**
|
|
6
|
+
* DateInput Component
|
|
7
|
+
* -------------------
|
|
8
|
+
* Controlled date input for ReactaForm.
|
|
9
|
+
*/
|
|
10
|
+
declare const DateInput: React.FC<DateInputProps>;
|
|
11
|
+
export default DateInput;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
type DropdownField = DefinitionPropertyField & {
|
|
4
|
+
options: NonNullable<DefinitionPropertyField['options']>;
|
|
5
|
+
};
|
|
6
|
+
export type DropdownInputProps = BaseInputProps<string, DropdownField>;
|
|
7
|
+
/**
|
|
8
|
+
* DropdownInput
|
|
9
|
+
*
|
|
10
|
+
* Renders a custom dropdown for selecting a single value from options.
|
|
11
|
+
* - Validates that the selected value is in the options list
|
|
12
|
+
* - Auto-corrects to first option if invalid value provided
|
|
13
|
+
* - Uses custom styling from fieldStyle.dropdown
|
|
14
|
+
*/
|
|
15
|
+
declare const DropdownInput: React.FC<DropdownInputProps>;
|
|
16
|
+
export default DropdownInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField, BaseInputProps } from "../../core/reactaFormTypes";
|
|
3
|
+
export type EmailInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
|
+
export declare const EmailInput: React.FC<EmailInputProps>;
|
|
5
|
+
export default EmailInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
export type FileInputProps = BaseInputProps<File | File[] | null, DefinitionPropertyField>;
|
|
4
|
+
declare const FileInput: React.FC<FileInputProps>;
|
|
5
|
+
export default FileInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField, BaseInputProps } from "../../core/reactaFormTypes";
|
|
3
|
+
export type FloatArrayInputProps = BaseInputProps<string | number[], DefinitionPropertyField>;
|
|
4
|
+
/**
|
|
5
|
+
* FloatArrayInput component
|
|
6
|
+
*/
|
|
7
|
+
declare const FloatArrayInput: React.FC<FloatArrayInputProps>;
|
|
8
|
+
export default FloatArrayInput;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
/**
|
|
5
|
+
* FloatInput component
|
|
6
|
+
*/
|
|
7
|
+
export type FloatInputProps = BaseInputProps<number | string, DefinitionPropertyField>;
|
|
8
|
+
declare const FloatInput: React.FC<FloatInputProps>;
|
|
9
|
+
export default FloatInput;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
export type ImageProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
|
+
/**
|
|
5
|
+
* ImageDisplay is a React component that renders an image with optional
|
|
6
|
+
* localization and flexible layout/styling options.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Localized image fallback based on current language (e.g., _fr, _zhcn suffixes).
|
|
10
|
+
* - Supports left, center, or right alignment.
|
|
11
|
+
* - Supports both row and column layout via field.labelLayout property
|
|
12
|
+
* - Dynamically handles width and height:
|
|
13
|
+
* - If both are specified, uses them directly.
|
|
14
|
+
* - If only one is specified, uses that and sets the other to `auto`.
|
|
15
|
+
* - If neither is specified, renders the image without size constraints.
|
|
16
|
+
*/
|
|
17
|
+
declare const ImageDisplay: React.FC<ImageProps>;
|
|
18
|
+
export default ImageDisplay;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
export type IntegerArrayInputProps = BaseInputProps<string | number[], DefinitionPropertyField>;
|
|
5
|
+
/**
|
|
6
|
+
* IntegerArrayInput
|
|
7
|
+
*/
|
|
8
|
+
declare const IntegerArrayInput: React.FC<IntegerArrayInputProps>;
|
|
9
|
+
export default IntegerArrayInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
export type IntegerInputProps = BaseInputProps<number | string, DefinitionPropertyField>;
|
|
5
|
+
declare const _default: React.NamedExoticComponent<IntegerInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
export type OptionsField = DefinitionPropertyField & {
|
|
5
|
+
options: NonNullable<DefinitionPropertyField["options"]>;
|
|
6
|
+
};
|
|
7
|
+
type MultiSelectionProps = BaseInputProps<string[] | null, OptionsField>;
|
|
8
|
+
declare const MultiSelect: React.FC<MultiSelectionProps>;
|
|
9
|
+
export default MultiSelect;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
type TextInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
+
declare const MultilineTextInput: React.FC<TextInputProps>;
|
|
6
|
+
export default MultilineTextInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
export type NumericStepperInputProps = BaseInputProps<string | number, DefinitionPropertyField>;
|
|
5
|
+
declare const NumericStepperInput: React.FC<NumericStepperInputProps>;
|
|
6
|
+
export default NumericStepperInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
type PasswordInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
+
declare const PasswordInput: React.FC<PasswordInputProps>;
|
|
6
|
+
export default PasswordInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
export type PhoneInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
+
export declare const PhoneInput: React.FC<PhoneInputProps>;
|
|
6
|
+
export default PhoneInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
type RadioField = DefinitionPropertyField & {
|
|
4
|
+
options: NonNullable<DefinitionPropertyField["options"]>;
|
|
5
|
+
};
|
|
6
|
+
export type RadioInputProps = BaseInputProps<string, RadioField>;
|
|
7
|
+
declare const RadioInput: React.FC<RadioInputProps>;
|
|
8
|
+
export default RadioInput;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
type RatingField = DefinitionPropertyField & {
|
|
4
|
+
max?: number;
|
|
5
|
+
icon?: string;
|
|
6
|
+
};
|
|
7
|
+
export type RatingInputProps = BaseInputProps<number, RatingField>;
|
|
8
|
+
declare const RatingInput: React.FC<RatingInputProps>;
|
|
9
|
+
export default RatingInput;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface SeparatorProps {
|
|
3
|
+
color?: string;
|
|
4
|
+
thickness?: number;
|
|
5
|
+
margin?: string | number;
|
|
6
|
+
label?: string | null;
|
|
7
|
+
alignment?: "left" | "center" | "right";
|
|
8
|
+
}
|
|
9
|
+
export declare const Separator: React.FC<SeparatorProps>;
|
|
10
|
+
interface FieldSeparatorProps {
|
|
11
|
+
field: {
|
|
12
|
+
color?: string;
|
|
13
|
+
thickness?: number;
|
|
14
|
+
margin?: string | number;
|
|
15
|
+
label?: string;
|
|
16
|
+
alignment?: "left" | "center" | "right";
|
|
17
|
+
};
|
|
18
|
+
t: (text: string) => string;
|
|
19
|
+
}
|
|
20
|
+
declare const FieldSeparator: React.FC<FieldSeparatorProps>;
|
|
21
|
+
export default FieldSeparator;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
type SliderInputProps = BaseInputProps<string | number, DefinitionPropertyField>;
|
|
4
|
+
declare const SliderInput: React.FC<SliderInputProps>;
|
|
5
|
+
export default SliderInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField, BaseInputProps } from "../../core/reactaFormTypes";
|
|
3
|
+
export type SpinInputProps = BaseInputProps<number, DefinitionPropertyField>;
|
|
4
|
+
declare const SpinInput: React.FC<SpinInputProps>;
|
|
5
|
+
export default SpinInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
type SwitchInputProps = BaseInputProps<boolean, DefinitionPropertyField>;
|
|
4
|
+
/**
|
|
5
|
+
* SwitchInput
|
|
6
|
+
*/
|
|
7
|
+
export declare const SwitchInput: React.FC<SwitchInputProps>;
|
|
8
|
+
export default SwitchInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
type TextInputProps = BaseInputProps<string, DefinitionPropertyField> & {
|
|
5
|
+
error?: string | null;
|
|
6
|
+
};
|
|
7
|
+
declare const TextInput: React.FC<TextInputProps>;
|
|
8
|
+
export default TextInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
type TimeInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
+
declare const TimeInput: React.FC<TimeInputProps>;
|
|
6
|
+
export default TimeInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
type UnitValueInputProps = BaseInputProps<[string | number, string], DefinitionPropertyField>;
|
|
4
|
+
declare const _default: React.NamedExoticComponent<UnitValueInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
+
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
+
/**
|
|
5
|
+
* UrlInput component
|
|
6
|
+
*/
|
|
7
|
+
export type UrlInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
8
|
+
declare const UrlInput: React.FC<UrlInputProps>;
|
|
9
|
+
export default UrlInput;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DefinitionPropertyField, FieldValueType, ErrorType } from "../core/reactaFormTypes";
|
|
2
|
+
export declare const renderFields: (fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, handleChange: (fieldName: string, value: FieldValueType, error: ErrorType) => void, visibility: Record<string, boolean>, loadedCount: number, handleError?: (fieldName: string, error: ErrorType) => void, errorsMap?: Record<string, string>) => (import("react/jsx-runtime").JSX.Element | null)[];
|
|
3
|
+
export declare const renderFieldsWithGroups: (groupState: Record<string, boolean>, fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, t: (key: string) => string, handleChange: (fieldName: string, value: FieldValueType, error: ErrorType) => void, handleError: (fieldName: string, error: ErrorType) => void, visibility: Record<string, boolean>, loadedCount: number, toggleGroup: (groupName: string) => void, errors?: Record<string, string>) => JSX.Element[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class BaseRegistry<T> {
|
|
2
|
+
private map;
|
|
3
|
+
register(name: string, value: T): void;
|
|
4
|
+
get(name: string): T | undefined;
|
|
5
|
+
has(name: string): boolean;
|
|
6
|
+
list(): string[];
|
|
7
|
+
entries(): [string, T][];
|
|
8
|
+
values(): T[];
|
|
9
|
+
size(): number;
|
|
10
|
+
unregister(name: string): boolean;
|
|
11
|
+
clear(): void;
|
|
12
|
+
registerAll(entries: Record<string, T> | [string, T][]): void;
|
|
13
|
+
getOrDefault(name: string, defaultValue: T): T;
|
|
14
|
+
}
|
|
15
|
+
export default BaseRegistry;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import BaseRegistry from "./baseRegistry";
|
|
2
|
+
export type DebounceConfig = false | {
|
|
3
|
+
wait?: number;
|
|
4
|
+
leading?: boolean;
|
|
5
|
+
trailing?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const DEBOUNCE_CONFIG: Record<string, DebounceConfig>;
|
|
8
|
+
declare const registry: BaseRegistry<unknown>;
|
|
9
|
+
export declare function isBuiltinComponentType(typeName: string): boolean;
|
|
10
|
+
export declare function registerComponentInternal(type: string, component: unknown, isBaseComponent: boolean): void;
|
|
11
|
+
export declare function registerComponent(type: string, component: unknown): void;
|
|
12
|
+
export declare function getComponent(type: string): unknown;
|
|
13
|
+
export declare function listComponents(): string[];
|
|
14
|
+
export declare function registerBaseComponents(): void;
|
|
15
|
+
export default registry;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IS_TEST_ENV: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DefinitionPropertyField, FieldValueType } from "./reactaFormTypes";
|
|
2
|
+
/**
|
|
3
|
+
* Initializes the visibility map for all fields by setting them to `false`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const initializeVisibility: (fields: DefinitionPropertyField[]) => Record<string, boolean>;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a lookup map for faster field access during visibility calculations
|
|
8
|
+
*/
|
|
9
|
+
export declare const createFieldMap: (fields: DefinitionPropertyField[]) => Record<string, DefinitionPropertyField>;
|
|
10
|
+
/**
|
|
11
|
+
* Updates visibility map based on current field values and parent-child relationships
|
|
12
|
+
*/
|
|
13
|
+
export declare const updateVisibilityMap: (fields: DefinitionPropertyField[], values: Record<string, FieldValueType>, oldVisibility: Record<string, boolean>, fieldMapRef: Record<string, DefinitionPropertyField>) => Record<string, boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Updates visibility when a specific field value changes
|
|
16
|
+
*/
|
|
17
|
+
export declare const updateVisibilityBasedOnSelection: (visibility: Record<string, boolean>, fieldMap: Record<string, DefinitionPropertyField>, valuesMap: Record<string, FieldValueType>, fieldName: string, value: FieldValueType) => Record<string, boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a field should be visible based on its parent relationships
|
|
20
|
+
*/
|
|
21
|
+
export declare const isFieldVisible: (fieldName: string, fieldMap: Record<string, DefinitionPropertyField>, values: Record<string, FieldValueType>) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Gets all visible fields efficiently
|
|
24
|
+
*/
|
|
25
|
+
export declare const getVisibleFields: (fields: DefinitionPropertyField[], values: Record<string, FieldValueType>) => DefinitionPropertyField[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Plugin Registry for ReactaForm
|
|
3
|
+
* Tracks installed plugins, components, validators, submission handlers
|
|
4
|
+
* Handles conflicts with customizable strategy
|
|
5
|
+
*/
|
|
6
|
+
import type { FieldCustomValidationHandler, FieldTypeValidationHandler, FormValidationHandler, FormSubmissionHandler } from './reactaFormTypes';
|
|
7
|
+
/** Conflict resolution strategies */
|
|
8
|
+
export type ConflictResolution = 'error' | 'warn' | 'override' | 'skip';
|
|
9
|
+
/** Plugin registration options */
|
|
10
|
+
export interface PluginRegistrationOptions {
|
|
11
|
+
conflictResolution?: ConflictResolution;
|
|
12
|
+
onConflict?: (conflict: PluginConflict) => boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Plugin conflict information */
|
|
15
|
+
export interface PluginConflict {
|
|
16
|
+
type: 'component' | 'fieldCustomValidator' | 'fieldTypeValidator' | 'formValidator' | 'submissionHandler' | 'plugin';
|
|
17
|
+
name: string;
|
|
18
|
+
existingPlugin: string;
|
|
19
|
+
newPlugin: string;
|
|
20
|
+
}
|
|
21
|
+
/** ReactaForm plugin definition */
|
|
22
|
+
export interface ReactaFormPlugin {
|
|
23
|
+
name: string;
|
|
24
|
+
version: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
components?: Record<string, React.ComponentType<unknown>>;
|
|
27
|
+
fieldCustomValidators?: Record<string, Record<string, FieldCustomValidationHandler>>;
|
|
28
|
+
fieldTypeValidators?: Record<string, FieldTypeValidationHandler>;
|
|
29
|
+
formValidators?: Record<string, FormValidationHandler>;
|
|
30
|
+
submissionHandlers?: Record<string, FormSubmissionHandler>;
|
|
31
|
+
setup?: () => void;
|
|
32
|
+
cleanup?: () => void;
|
|
33
|
+
}
|
|
34
|
+
/** Register a plugin */
|
|
35
|
+
export declare function registerPlugin(plugin: ReactaFormPlugin, options?: PluginRegistrationOptions): void;
|
|
36
|
+
/** Unregister plugin */
|
|
37
|
+
export declare function unregisterPlugin(pluginName: string, removeRegistrations?: boolean): boolean;
|
|
38
|
+
/** Get a plugin by name */
|
|
39
|
+
export declare function getPlugin(pluginName: string): ReactaFormPlugin | undefined;
|
|
40
|
+
/** Get all installed plugins */
|
|
41
|
+
export declare function getAllPlugins(): ReactaFormPlugin[];
|
|
42
|
+
/** Check if plugin is registered */
|
|
43
|
+
export declare function hasPlugin(pluginName: string): boolean;
|
|
44
|
+
/** Helper to register multiple components at once */
|
|
45
|
+
export declare function registerComponents(components: Record<string, React.ComponentType<unknown>>): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactaDefinition, ReactaInstance } from "./reactaFormTypes";
|
|
2
|
+
export interface LoadDefinitionOptions {
|
|
3
|
+
validateSchema?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface DefinitionLoadResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
definition?: ReactaDefinition;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface InstanceLoadResult {
|
|
11
|
+
success: boolean;
|
|
12
|
+
instance?: ReactaInstance;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validates that a definition object has the required structure
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateDefinitionSchema(definition: ReactaDefinition): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Load definition from a JSON string. This intentionally does not perform any file I/O.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadJsonDefinition(jsonData: string, options?: LoadDefinitionOptions): Promise<DefinitionLoadResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Create instance from definition with validation and error handling
|
|
25
|
+
*/
|
|
26
|
+
export declare function createInstanceFromDefinition(definition: ReactaDefinition, name: string): InstanceLoadResult;
|
|
27
|
+
/**
|
|
28
|
+
* Load instance data with validation
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadInstance(instanceData: string | Record<string, unknown>): InstanceLoadResult;
|
|
31
|
+
export declare function upgradeInstanceToLatestDefinition(oldInstance: ReactaInstance, latestDefinition: ReactaDefinition, callback?: (oldInstance: ReactaInstance, newInstance: Record<string, unknown>, latestDefinition: ReactaDefinition) => void): InstanceLoadResult;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type Integer = number;
|
|
3
|
+
type Float = number;
|
|
4
|
+
export type FieldValueType = boolean | Integer | Float | string | Integer[] | Float[] | string[] | [number, string] | File | File[];
|
|
5
|
+
export type ErrorType = string | null;
|
|
6
|
+
export type ParentField = Record<string, string[] | Integer[] | boolean[]>;
|
|
7
|
+
export type ValidationHandlerName = string | [string] | [string, string];
|
|
8
|
+
export interface DefinitionPropertyField {
|
|
9
|
+
name: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
type: string;
|
|
12
|
+
defaultValue: FieldValueType;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
parents?: ParentField;
|
|
15
|
+
children?: Record<string, string[]>;
|
|
16
|
+
group?: string;
|
|
17
|
+
tooltip?: string;
|
|
18
|
+
labelLayout?: 'row' | 'column-left' | 'column-center';
|
|
19
|
+
validationHandlerName?: ValidationHandlerName;
|
|
20
|
+
dimension?: string;
|
|
21
|
+
defaultUnit?: string;
|
|
22
|
+
options?: Array<{
|
|
23
|
+
label: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}>;
|
|
26
|
+
minLength?: number;
|
|
27
|
+
maxLength?: number;
|
|
28
|
+
pattern?: string;
|
|
29
|
+
patternErrorMessage?: string;
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
min?: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
minInclusive?: boolean;
|
|
34
|
+
maxInclusive?: boolean;
|
|
35
|
+
step?: number;
|
|
36
|
+
minCount?: number;
|
|
37
|
+
maxCount?: number;
|
|
38
|
+
minDate?: string;
|
|
39
|
+
maxDate?: string;
|
|
40
|
+
includeSeconds?: boolean;
|
|
41
|
+
layout?: 'horizontal' | 'vertical' | 'row' | 'column';
|
|
42
|
+
alignment?: 'left' | 'center' | 'right';
|
|
43
|
+
width?: number;
|
|
44
|
+
height?: number;
|
|
45
|
+
localized?: string;
|
|
46
|
+
minHeight?: string;
|
|
47
|
+
accept?: string;
|
|
48
|
+
multiple?: boolean;
|
|
49
|
+
allowRelative?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface ReactaDefinition {
|
|
52
|
+
name: string;
|
|
53
|
+
version: string;
|
|
54
|
+
displayName: string;
|
|
55
|
+
localization?: string;
|
|
56
|
+
properties: DefinitionPropertyField[];
|
|
57
|
+
validationHandlerName?: string;
|
|
58
|
+
submitHandlerName?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ReactaInstance {
|
|
61
|
+
name: string;
|
|
62
|
+
definition: string;
|
|
63
|
+
version: string;
|
|
64
|
+
values: Record<string, FieldValueType>;
|
|
65
|
+
}
|
|
66
|
+
export interface ReactaFormProps {
|
|
67
|
+
definitionData: string | Record<string, unknown>;
|
|
68
|
+
language?: string;
|
|
69
|
+
instance?: ReactaInstance;
|
|
70
|
+
className?: string;
|
|
71
|
+
theme?: string;
|
|
72
|
+
style?: React.CSSProperties;
|
|
73
|
+
fieldValidationMode?: FieldValidationMode;
|
|
74
|
+
}
|
|
75
|
+
export type TranslationFunction = (text: string, ...args: unknown[]) => string;
|
|
76
|
+
/** Validation mode controls where validation is performed. */
|
|
77
|
+
export type FieldValidationMode = 'realTime' | 'onSubmission';
|
|
78
|
+
export type FieldCustomValidationHandler = (fieldName: string, value: FieldValueType | unknown, t: TranslationFunction) => string | undefined;
|
|
79
|
+
export type FieldTypeValidationHandler = (field: DefinitionPropertyField, input: FieldValueType, t: TranslationFunction) => string | null;
|
|
80
|
+
export type FormValidationHandler = (valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction) => string[] | undefined | Promise<string[] | undefined>;
|
|
81
|
+
export type FormSubmissionHandler = (definition: ReactaDefinition, instanceName: string | null, valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction) => string[] | undefined | Promise<string[] | undefined>;
|
|
82
|
+
export type InputOnChange<T> = (value: T | string) => void;
|
|
83
|
+
export interface BaseInputProps<TValue = unknown, TField extends DefinitionPropertyField = DefinitionPropertyField> {
|
|
84
|
+
field: TField;
|
|
85
|
+
value: TValue;
|
|
86
|
+
placeholder?: string;
|
|
87
|
+
onChange?: InputOnChange<TValue>;
|
|
88
|
+
onError?: (error: string | null) => void;
|
|
89
|
+
error?: string | null;
|
|
90
|
+
}
|
|
91
|
+
export type ReactaFormContextType = {
|
|
92
|
+
definitionName: string;
|
|
93
|
+
language: string;
|
|
94
|
+
theme: string;
|
|
95
|
+
formStyle: {
|
|
96
|
+
container?: React.CSSProperties;
|
|
97
|
+
titleStyle?: React.CSSProperties;
|
|
98
|
+
};
|
|
99
|
+
fieldStyle: Record<string, unknown>;
|
|
100
|
+
t: TranslationFunction;
|
|
101
|
+
fieldValidationMode?: FieldValidationMode;
|
|
102
|
+
};
|
|
103
|
+
export type ReactaFormProviderProps = {
|
|
104
|
+
children: ReactNode;
|
|
105
|
+
definitionName?: string;
|
|
106
|
+
defaultStyle?: Record<string, unknown>;
|
|
107
|
+
defaultLanguage?: string;
|
|
108
|
+
defaultTheme?: string;
|
|
109
|
+
defaultLocalizeName?: string;
|
|
110
|
+
defaultFieldValidationMode?: FieldValidationMode;
|
|
111
|
+
className?: string;
|
|
112
|
+
};
|
|
113
|
+
export type TranslationMap = Record<string, string>;
|
|
114
|
+
export type TranslationCache = Map<string, TranslationMap>;
|
|
115
|
+
export interface RegistryResult<T = unknown> {
|
|
116
|
+
success: boolean;
|
|
117
|
+
data?: T;
|
|
118
|
+
error?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface FieldGroup {
|
|
121
|
+
name: string;
|
|
122
|
+
displayName: string;
|
|
123
|
+
description?: string;
|
|
124
|
+
collapsed?: boolean;
|
|
125
|
+
order?: number;
|
|
126
|
+
}
|
|
127
|
+
export interface ValidationResult {
|
|
128
|
+
isValid: boolean;
|
|
129
|
+
errors: string[];
|
|
130
|
+
warnings?: string[];
|
|
131
|
+
}
|
|
132
|
+
export type FormEventType = 'init' | 'change' | 'validate' | 'submit' | 'reset';
|
|
133
|
+
export interface FormEvent {
|
|
134
|
+
type: FormEventType;
|
|
135
|
+
timestamp: Date;
|
|
136
|
+
data?: unknown;
|
|
137
|
+
}
|
|
138
|
+
export interface EnhancedDefinitionPropertyField extends DefinitionPropertyField {
|
|
139
|
+
category?: string;
|
|
140
|
+
tags?: string[];
|
|
141
|
+
dependencies?: string[];
|
|
142
|
+
conditional?: {
|
|
143
|
+
field: string;
|
|
144
|
+
value: unknown;
|
|
145
|
+
operator?: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than';
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FormSubmissionHandler } from "./reactaFormTypes";
|
|
2
|
+
import BaseRegistry from "./baseRegistry";
|
|
3
|
+
declare const registry: BaseRegistry<FormSubmissionHandler>;
|
|
4
|
+
export declare function registerSubmissionHandler(submitterName: string, fn: FormSubmissionHandler): void;
|
|
5
|
+
export declare function getFormSubmissionHandler(submitterName: string): FormSubmissionHandler | undefined;
|
|
6
|
+
export declare function getSubmissionHandler(submitterName: string): FormSubmissionHandler | undefined;
|
|
7
|
+
export default registry;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactaDefinition, FieldValueType, ReactaInstance, TranslationFunction } from "./reactaFormTypes";
|
|
2
|
+
export interface SubmitResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
data?: Record<string, unknown>;
|
|
6
|
+
errors?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function submitForm(definition: ReactaDefinition, instance: ReactaInstance | null, valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction, errors: Record<string, string>): Promise<SubmitResult>;
|
|
9
|
+
export default submitForm;
|