reactaform 1.1.1 → 1.1.2
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/package.json +8 -2
- package/dist/components/LayoutComponents.d.ts +0 -76
- package/dist/components/PopupOptionMenu.d.ts +0 -15
- package/dist/components/ReactaForm.d.ts +0 -4
- package/dist/components/ReactaFormProvider.d.ts +0 -3
- package/dist/components/ReactaFormRenderer.d.ts +0 -13
- package/dist/components/Tooltip.d.ts +0 -8
- package/dist/components/VirtualizedFieldList.d.ts +0 -36
- package/dist/components/fields/CheckboxInput.d.ts +0 -9
- package/dist/components/fields/ColorInput.d.ts +0 -17
- package/dist/components/fields/DateInput.d.ts +0 -11
- package/dist/components/fields/DropdownInput.d.ts +0 -13
- package/dist/components/fields/EmailInput.d.ts +0 -5
- package/dist/components/fields/FileInput.d.ts +0 -5
- package/dist/components/fields/FloatArrayInput.d.ts +0 -5
- package/dist/components/fields/FloatInput.d.ts +0 -24
- package/dist/components/fields/ImageDisplay.d.ts +0 -17
- package/dist/components/fields/IntegerArrayInput.d.ts +0 -23
- package/dist/components/fields/IntegerInput.d.ts +0 -28
- package/dist/components/fields/MultiSelection.d.ts +0 -9
- package/dist/components/fields/MultilineTextInput.d.ts +0 -6
- package/dist/components/fields/NumericStepperInput.d.ts +0 -6
- package/dist/components/fields/PhoneInput.d.ts +0 -6
- package/dist/components/fields/RadioInput.d.ts +0 -13
- package/dist/components/fields/RatingInput.d.ts +0 -6
- package/dist/components/fields/Separator.d.ts +0 -20
- package/dist/components/fields/SliderInput.d.ts +0 -22
- package/dist/components/fields/SpinInput.d.ts +0 -6
- package/dist/components/fields/SwitchInput.d.ts +0 -13
- package/dist/components/fields/TextInput.d.ts +0 -6
- package/dist/components/fields/TimeInput.d.ts +0 -6
- package/dist/components/fields/UnitValueInput.d.ts +0 -5
- package/dist/components/fields/UrlInput.d.ts +0 -21
- package/dist/components/renderFields.d.ts +0 -4
- package/dist/core/fieldVisibility.d.ts +0 -25
- package/dist/core/index.d.ts +0 -19
- package/dist/core/reactaFormModel.d.ts +0 -38
- package/dist/core/reactaFormTypes.d.ts +0 -137
- package/dist/core/registries/baseRegistry.d.ts +0 -15
- package/dist/core/registries/componentRegistry.d.ts +0 -10
- package/dist/core/registries/index.d.ts +0 -7
- package/dist/core/registries/submissionHandlerRegistry.d.ts +0 -6
- package/dist/core/registries/validationHandlerRegistry.d.ts +0 -16
- package/dist/core/submitForm.d.ts +0 -12
- package/dist/core/validation.d.ts +0 -10
- package/dist/hooks/useDebouncedCallback.d.ts +0 -25
- package/dist/hooks/useReactaFormContext.d.ts +0 -4
- package/dist/utils/cssClasses.d.ts +0 -14
- package/dist/utils/definitionSerializers.d.ts +0 -62
- package/dist/utils/groupingHelpers.d.ts +0 -24
- package/dist/utils/index.d.ts +0 -11
- package/dist/utils/translationCache.d.ts +0 -43
- package/dist/utils/unitValueMapper.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactaform",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A powerful, type-safe React form builder library with dynamic field rendering, conditional visibility, multi-language support, and extensible validation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,7 +37,13 @@
|
|
|
37
37
|
"./style.css": "./dist/reactaform.css"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
|
-
"dist",
|
|
40
|
+
"dist/*.js",
|
|
41
|
+
"dist/*.mjs",
|
|
42
|
+
"dist/*.cjs.js",
|
|
43
|
+
"dist/*.es.js",
|
|
44
|
+
"dist/*.css",
|
|
45
|
+
"dist/*.map",
|
|
46
|
+
"dist/*.d.ts",
|
|
41
47
|
"README.md",
|
|
42
48
|
"LICENSE"
|
|
43
49
|
],
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField } from "../core/reactaFormTypes";
|
|
3
|
-
/**
|
|
4
|
-
* ColumnFieldLayout - Vertical layout wrapper for form fields
|
|
5
|
-
*
|
|
6
|
-
* This component provides a column-based layout pattern:
|
|
7
|
-
* - Label on top (left-aligned or center-aligned based on labelLayout)
|
|
8
|
-
* - Value/input area below
|
|
9
|
-
* - Optional tooltip support
|
|
10
|
-
* - Error display area
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* <ColumnFieldLayout field={field} error={error}>
|
|
14
|
-
* <textarea ... />
|
|
15
|
-
* </ColumnFieldLayout>
|
|
16
|
-
*/
|
|
17
|
-
export declare const ColumnFieldLayout: React.MemoExoticComponent<({ field, error, children, showLabel, }: {
|
|
18
|
-
field: DefinitionPropertyField;
|
|
19
|
-
error?: string | null;
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
showLabel?: boolean;
|
|
22
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
23
|
-
/**
|
|
24
|
-
* RowFieldLayout - Horizontal layout wrapper for form fields
|
|
25
|
-
*
|
|
26
|
-
* This component provides the traditional two-column layout pattern:
|
|
27
|
-
* - Label on the left using CSS_CLASSES.label
|
|
28
|
-
* - Value/input area on the right
|
|
29
|
-
* - Optional tooltip support
|
|
30
|
-
* - Error display area
|
|
31
|
-
*
|
|
32
|
-
* Usage:
|
|
33
|
-
* <RowFieldLayout field={field} error={error}>
|
|
34
|
-
* <input ... />
|
|
35
|
-
* </RowFieldLayout>
|
|
36
|
-
*/
|
|
37
|
-
export declare const RowFieldLayout: React.MemoExoticComponent<({ field, error, children, rightAlign, }: {
|
|
38
|
-
field: DefinitionPropertyField;
|
|
39
|
-
error?: string | null;
|
|
40
|
-
children: React.ReactNode;
|
|
41
|
-
rightAlign?: boolean;
|
|
42
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
43
|
-
/**
|
|
44
|
-
* StandardFieldLayout - Smart layout wrapper that delegates to appropriate layout component
|
|
45
|
-
*
|
|
46
|
-
* This component automatically chooses between row and column layouts based on field.labelLayout:
|
|
47
|
-
* - Uses ColumnFieldLayout when field.labelLayout === 'column'
|
|
48
|
-
* - Uses RowFieldLayout for default/row layout
|
|
49
|
-
* - Maintains consistent API for all field components
|
|
50
|
-
*
|
|
51
|
-
* Usage:
|
|
52
|
-
* <StandardFieldLayout field={field} error={error}>
|
|
53
|
-
* <input ... />
|
|
54
|
-
* </StandardFieldLayout>
|
|
55
|
-
*/
|
|
56
|
-
export declare const StandardFieldLayout: ({ field, error, children, rightAlign, }: {
|
|
57
|
-
field: DefinitionPropertyField;
|
|
58
|
-
error?: string | null;
|
|
59
|
-
children: React.ReactNode;
|
|
60
|
-
rightAlign?: boolean;
|
|
61
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
-
export declare const ErrorDiv: React.MemoExoticComponent<({ children }: {
|
|
63
|
-
children: React.ReactNode;
|
|
64
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
65
|
-
/**
|
|
66
|
-
* InstanceName - display and edit an instance name in a compact grid row
|
|
67
|
-
* on top of fields list
|
|
68
|
-
*
|
|
69
|
-
* Props:
|
|
70
|
-
* - `name`: current instance name
|
|
71
|
-
* - `onChange`: callback invoked with new name when edited
|
|
72
|
-
*/
|
|
73
|
-
export declare const InstanceName: React.MemoExoticComponent<({ name, onChange }: {
|
|
74
|
-
name: string;
|
|
75
|
-
onChange: (n: string) => void;
|
|
76
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type PopupOptionMenuPosition = {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
};
|
|
5
|
-
export interface PopupOption {
|
|
6
|
-
label: string;
|
|
7
|
-
}
|
|
8
|
-
export interface PopupOptionMenuProps<T extends PopupOption> {
|
|
9
|
-
pos: PopupOptionMenuPosition | null;
|
|
10
|
-
options: T[];
|
|
11
|
-
onClose: () => void;
|
|
12
|
-
onClickOption: (option: T) => void;
|
|
13
|
-
}
|
|
14
|
-
export declare function PopupOptionMenu<T extends PopupOption>({ pos, options, onClose, onClickOption }: PopupOptionMenuProps<T>): import("react").ReactPortal | null;
|
|
15
|
-
export default PopupOptionMenu;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ReactaFormProviderProps } from '../core/reactaFormTypes';
|
|
2
|
-
import '../core/reactaform.css';
|
|
3
|
-
export declare const ReactaFormProvider: ({ children, defaultDefinitionName, defaultStyle, defaultLanguage, defaultDarkMode, defaultLocalizeName, className, }: ReactaFormProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReactaDefinition, ReactaInstance } from "../core/reactaFormTypes";
|
|
2
|
-
export interface ReactaFormRendererProps {
|
|
3
|
-
definition: ReactaDefinition;
|
|
4
|
-
instance: ReactaInstance;
|
|
5
|
-
chunkSize?: number;
|
|
6
|
-
chunkDelay?: number;
|
|
7
|
-
enableVirtualization?: boolean;
|
|
8
|
-
virtualizationThreshold?: number;
|
|
9
|
-
virtualContainerHeight?: number;
|
|
10
|
-
estimatedFieldHeight?: number;
|
|
11
|
-
}
|
|
12
|
-
declare const ReactaFormRenderer: React.FC<ReactaFormRendererProps>;
|
|
13
|
-
export default ReactaFormRenderer;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { DefinitionPropertyField, FieldValueType, ErrorType } from '../core/reactaFormTypes';
|
|
3
|
-
interface VirtualizedFieldListProps {
|
|
4
|
-
fields: DefinitionPropertyField[];
|
|
5
|
-
valuesMap: Record<string, FieldValueType>;
|
|
6
|
-
visibility: Record<string, boolean>;
|
|
7
|
-
groupState: Record<string, boolean>;
|
|
8
|
-
handleChange: (fieldName: string, value: FieldValueType, error: ErrorType) => void;
|
|
9
|
-
handleError: (fieldName: string, error: ErrorType) => void;
|
|
10
|
-
toggleGroup: (groupName: string) => void;
|
|
11
|
-
t: (key: string) => string;
|
|
12
|
-
renderField: (field: DefinitionPropertyField) => React.ReactNode;
|
|
13
|
-
containerHeight?: number;
|
|
14
|
-
estimatedFieldHeight?: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* VirtualizedFieldList - Efficiently renders large forms using windowing
|
|
18
|
-
*
|
|
19
|
-
* This component uses react-window to virtualize field rendering, dramatically
|
|
20
|
-
* improving performance for forms with hundreds or thousands of fields by only
|
|
21
|
-
* rendering the fields currently visible in the viewport.
|
|
22
|
-
*
|
|
23
|
-
* Features:
|
|
24
|
-
* - Dynamic windowing (supports different field heights)
|
|
25
|
-
* - Group support with expand/collapse
|
|
26
|
-
* - Visibility filtering
|
|
27
|
-
* - Dynamic height calculation
|
|
28
|
-
* - Memory efficient (only renders visible items)
|
|
29
|
-
*
|
|
30
|
-
* Performance gains:
|
|
31
|
-
* - 100 fields: ~50% faster initial render
|
|
32
|
-
* - 500 fields: ~80% faster, significantly reduced memory
|
|
33
|
-
* - 1000+ fields: ~90% faster, prevents browser lag
|
|
34
|
-
*/
|
|
35
|
-
export declare const VirtualizedFieldList: React.FC<VirtualizedFieldListProps>;
|
|
36
|
-
export default VirtualizedFieldList;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
type CheckboxInputProps = BaseInputProps<boolean, DefinitionPropertyField>;
|
|
4
|
-
/**
|
|
5
|
-
* CheckboxInput
|
|
6
|
-
* Renders a simple checkbox input for boolean values.
|
|
7
|
-
*/
|
|
8
|
-
export declare const CheckboxInput: React.FC<CheckboxInputProps>;
|
|
9
|
-
export default CheckboxInput;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import 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
|
-
* Props:
|
|
12
|
-
* - field: field metadata including display name and tooltip.
|
|
13
|
-
* - value: currently selected color (hex string).
|
|
14
|
-
* - onChange: callback to propagate changes to parent form.
|
|
15
|
-
*/
|
|
16
|
-
declare const ColorInput: React.FC<ColorInputProps>;
|
|
17
|
-
export default ColorInput;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import 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;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
export type DropdownInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
|
-
/**
|
|
5
|
-
* DropdownInput
|
|
6
|
-
*
|
|
7
|
-
* Renders a select dropdown for selecting a single value from options.
|
|
8
|
-
* - Validates that the selected value is in the options list
|
|
9
|
-
* - Auto-corrects to first option if invalid value provided
|
|
10
|
-
* - Uses custom styling from fieldStyle.optionInput
|
|
11
|
-
*/
|
|
12
|
-
declare const DropdownInput: React.FC<DropdownInputProps>;
|
|
13
|
-
export default DropdownInput;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import 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;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import 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;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField, BaseInputProps } from "../../core/reactaFormTypes";
|
|
3
|
-
export type FloatArrayInputProps = BaseInputProps<string | number[], DefinitionPropertyField>;
|
|
4
|
-
declare const FloatArrayInput: React.FC<FloatArrayInputProps>;
|
|
5
|
-
export default FloatArrayInput;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
-
/**
|
|
5
|
-
* FloatInput component
|
|
6
|
-
*
|
|
7
|
-
* This component provides a controlled input field specifically for floating-point numbers.
|
|
8
|
-
* It supports validation for required values, numeric format (including decimals and scientific notation),
|
|
9
|
-
* and optional minimum and maximum constraints with inclusive/exclusive boundaries.
|
|
10
|
-
*
|
|
11
|
-
* Props:
|
|
12
|
-
* - field: The metadata defining this input's configuration and validation rules.
|
|
13
|
-
* - value: The current numeric value to display.
|
|
14
|
-
* - onChange: Callback to notify parent of changes, passing the parsed number and any validation error.
|
|
15
|
-
*
|
|
16
|
-
* Features:
|
|
17
|
-
* - Validates input against a regex allowing floating-point formats.
|
|
18
|
-
* - Shows validation errors inline.
|
|
19
|
-
* - Supports tooltip display for additional field information.
|
|
20
|
-
* - Integrates with Reacta form context for localization and styling.
|
|
21
|
-
*/
|
|
22
|
-
export type FloatInputProps = BaseInputProps<string | number, DefinitionPropertyField>;
|
|
23
|
-
declare const FloatInput: React.FC<FloatInputProps>;
|
|
24
|
-
export default FloatInput;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
2
|
-
export type ImageProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
3
|
-
/**
|
|
4
|
-
* ImageDisplay is a React component that renders an image with optional
|
|
5
|
-
* localization and flexible layout/styling options.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Localized image fallback based on current language (e.g., _fr, _zhcn suffixes).
|
|
9
|
-
* - Supports left, center, or right alignment.
|
|
10
|
-
* - Supports both row and column layout via field.labelLayout property
|
|
11
|
-
* - Dynamically handles width and height:
|
|
12
|
-
* - If both are specified, uses them directly.
|
|
13
|
-
* - If only one is specified, uses that and sets the other to `auto`.
|
|
14
|
-
* - If neither is specified, renders the image without size constraints.
|
|
15
|
-
*/
|
|
16
|
-
declare const ImageDisplay: React.FC<ImageProps>;
|
|
17
|
-
export default ImageDisplay;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import 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 component
|
|
7
|
-
*
|
|
8
|
-
* A controlled input component for editing an array of integer numbers represented as
|
|
9
|
-
* a delimiter-separated string. It supports:
|
|
10
|
-
* - Parsing and validating each integer value.
|
|
11
|
-
* - Min/max validation for the number of values.
|
|
12
|
-
* - Min/Max limit constraints (inclusive or exclusive) per value.
|
|
13
|
-
* - Inline error display.
|
|
14
|
-
* - Tooltip support for field help.
|
|
15
|
-
* - Integration with Reacta form context for localization, styles, and validation.
|
|
16
|
-
*
|
|
17
|
-
* Props:
|
|
18
|
-
* - field: Metadata describing the input field, including validation rules and display info.
|
|
19
|
-
* - value: The integer array.
|
|
20
|
-
* - onChange: Callback invoked when input changes, returning the parsed integer array and validation error.
|
|
21
|
-
*/
|
|
22
|
-
declare const IntegerArrayInput: React.FC<IntegerArrayInputProps>;
|
|
23
|
-
export default IntegerArrayInput;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
-
/**
|
|
5
|
-
* IntegerInput component
|
|
6
|
-
*
|
|
7
|
-
* This component renders a controlled input field specifically for integer values.
|
|
8
|
-
* It handles validation for required input, integer format, and optional min/max constraints,
|
|
9
|
-
* with inclusive or exclusive boundaries. The component supports inline validation error
|
|
10
|
-
* display and integrates with the Reacta form context for localization, styling, and field metadata.
|
|
11
|
-
*
|
|
12
|
-
* Props:
|
|
13
|
-
* - field: The metadata describing the input field, including validation rules and display info.
|
|
14
|
-
* - value: The current integer value to display.
|
|
15
|
-
* - onChange: Callback invoked when the input changes, providing the parsed integer value and any validation error.
|
|
16
|
-
* - parse: Function to parse string input into an integer.
|
|
17
|
-
* - validNumberRegex: Regex pattern to validate the integer input format.
|
|
18
|
-
* - typeName: Descriptive string for the value type (e.g., "integer") used in validation messages.
|
|
19
|
-
*
|
|
20
|
-
* Features:
|
|
21
|
-
* - Validates input against integer format and required presence.
|
|
22
|
-
* - Enforces min and max constraints with inclusive/exclusive options.
|
|
23
|
-
* - Displays error messages inline below the input.
|
|
24
|
-
* - Supports tooltips for additional user guidance.
|
|
25
|
-
*/
|
|
26
|
-
export type IntegerInputProps = BaseInputProps<string | number, DefinitionPropertyField>;
|
|
27
|
-
declare const IntegerInput: React.FC<IntegerInputProps>;
|
|
28
|
-
export default IntegerInput;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import 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;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import 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;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
-
export type NumericStepperInputProps = BaseInputProps<number, DefinitionPropertyField>;
|
|
5
|
-
declare const NumericStepperInput: React.FC<NumericStepperInputProps>;
|
|
6
|
-
export default NumericStepperInput;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import 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;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
export type RadioInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
|
-
/**
|
|
5
|
-
* RadioInput
|
|
6
|
-
*
|
|
7
|
-
* Renders radio button options for selecting a single value.
|
|
8
|
-
* - Supports horizontal and vertical layouts
|
|
9
|
-
* - Validates that the selected value is in the options list
|
|
10
|
-
* - Auto-corrects to first option if invalid value provided
|
|
11
|
-
*/
|
|
12
|
-
declare const RadioInput: React.FC<RadioInputProps>;
|
|
13
|
-
export default RadioInput;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
-
export type RatingInputProps = BaseInputProps<number, DefinitionPropertyField>;
|
|
5
|
-
declare const RatingInput: React.FC<RatingInputProps>;
|
|
6
|
-
export default RatingInput;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface SeparatorProps {
|
|
2
|
-
color?: string;
|
|
3
|
-
thickness?: number;
|
|
4
|
-
margin?: string | number;
|
|
5
|
-
label?: string | null;
|
|
6
|
-
alignment?: "left" | "center" | "right";
|
|
7
|
-
}
|
|
8
|
-
export declare const Separator: React.FC<SeparatorProps>;
|
|
9
|
-
interface FieldSeparatorProps {
|
|
10
|
-
field: {
|
|
11
|
-
color?: string;
|
|
12
|
-
thickness?: number;
|
|
13
|
-
margin?: string | number;
|
|
14
|
-
label?: string;
|
|
15
|
-
alignment?: "left" | "center" | "right";
|
|
16
|
-
};
|
|
17
|
-
t: (text: string) => string;
|
|
18
|
-
}
|
|
19
|
-
declare const FieldSeparator: React.FC<FieldSeparatorProps>;
|
|
20
|
-
export default FieldSeparator;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
/**
|
|
4
|
-
* SliderInput component
|
|
5
|
-
*
|
|
6
|
-
* A reusable UI component that displays a range slider with a linked numeric input.
|
|
7
|
-
* Designed for numeric fields defined in a JSON schema, this component supports:
|
|
8
|
-
* - Validation (min/max, required, and custom rules)
|
|
9
|
-
* - Real-time synchronization between slider and text input
|
|
10
|
-
* - Tooltip display on hover
|
|
11
|
-
* - Integration with ReactaForm context (for styling, translation, and validation)
|
|
12
|
-
*
|
|
13
|
-
* Props:
|
|
14
|
-
* - field: DefinitionPropertyField
|
|
15
|
-
* - Required: min, max
|
|
16
|
-
* - Optional: tooltip
|
|
17
|
-
* - value: current numeric value
|
|
18
|
-
* - onChange: callback triggered with new value and optional error string
|
|
19
|
-
*/
|
|
20
|
-
type SliderInputProps = BaseInputProps<string | number, DefinitionPropertyField>;
|
|
21
|
-
declare const SliderInput: React.FC<SliderInputProps>;
|
|
22
|
-
export default SliderInput;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
-
export type SpinInputProps = BaseInputProps<number, DefinitionPropertyField>;
|
|
5
|
-
declare const SpinInput: React.FC<SpinInputProps>;
|
|
6
|
-
export default SpinInput;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
type SwitchInputProps = BaseInputProps<boolean, DefinitionPropertyField>;
|
|
4
|
-
/**
|
|
5
|
-
* SwitchInput
|
|
6
|
-
*
|
|
7
|
-
* Renders a toggle switch UI for boolean values.
|
|
8
|
-
* - Clicking anywhere on the container toggles the switch.
|
|
9
|
-
* - Visual toggle with sliding knob and background color changes.
|
|
10
|
-
* - Displays label and optional tooltip.
|
|
11
|
-
*/
|
|
12
|
-
export declare const SwitchInput: React.FC<SwitchInputProps>;
|
|
13
|
-
export default SwitchInput;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import 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 TextInput: React.FC<TextInputProps>;
|
|
6
|
-
export default TextInput;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import 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;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
2
|
-
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
type UnitValueInputProps = BaseInputProps<[string | number, string], DefinitionPropertyField>;
|
|
4
|
-
declare function UnitValueInput({ field, value, onChange }: UnitValueInputProps): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
-
export default UnitValueInput;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
|
-
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
|
-
/**
|
|
5
|
-
* UrlInput component
|
|
6
|
-
*
|
|
7
|
-
* This component provides a controlled input field for URL values.
|
|
8
|
-
* It validates required fields, URL format, and integrates with Reacta form context.
|
|
9
|
-
*
|
|
10
|
-
* Props:
|
|
11
|
-
* - field: Field metadata (name, displayName, tooltip, validation rules).
|
|
12
|
-
* - value: Current URL string.
|
|
13
|
-
* - onChange: Callback called with (value, error).
|
|
14
|
-
*
|
|
15
|
-
* Features:
|
|
16
|
-
* - Validates using a robust URL regex and `URL` constructor fallback.
|
|
17
|
-
* - Supports tooltip, localization, and inline validation errors.
|
|
18
|
-
*/
|
|
19
|
-
export type UrlInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
20
|
-
declare const UrlInput: React.FC<UrlInputProps>;
|
|
21
|
-
export default UrlInput;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DefinitionPropertyField, FieldValueType, ErrorType } from "../core/reactaFormTypes";
|
|
2
|
-
import type { JSX } from "react/jsx-runtime";
|
|
3
|
-
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) => (JSX.Element | null)[];
|
|
4
|
-
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) => JSX.Element[];
|
|
@@ -1,25 +0,0 @@
|
|
|
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[];
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export * from "./reactaFormTypes";
|
|
2
|
-
export * from "./validation";
|
|
3
|
-
export * from "./submitForm";
|
|
4
|
-
export * from "./fieldVisibility";
|
|
5
|
-
export * from "./reactaFormModel";
|
|
6
|
-
export * from "./registries";
|
|
7
|
-
import * as registries from "./registries";
|
|
8
|
-
import * as validation from "./validation";
|
|
9
|
-
import * as submitForm from "./submitForm";
|
|
10
|
-
import * as fieldVisibility from "./fieldVisibility";
|
|
11
|
-
import * as reactaFormModel from "./reactaFormModel";
|
|
12
|
-
declare const _default: {
|
|
13
|
-
registries: typeof registries;
|
|
14
|
-
validation: typeof validation;
|
|
15
|
-
submitForm: typeof submitForm;
|
|
16
|
-
fieldVisibility: typeof fieldVisibility;
|
|
17
|
-
reactaFormModel: typeof reactaFormModel;
|
|
18
|
-
};
|
|
19
|
-
export default _default;
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
/**
|
|
11
|
-
* Validates that a definition object has the required structure
|
|
12
|
-
*/
|
|
13
|
-
export declare function validateDefinitionSchema(definition: ReactaDefinition): string | null;
|
|
14
|
-
/**
|
|
15
|
-
* Load definition from a JSON string. This intentionally does not perform any file I/O.
|
|
16
|
-
*/
|
|
17
|
-
export declare function loadJsonDefinition(jsonData: string, options?: LoadDefinitionOptions): Promise<DefinitionLoadResult>;
|
|
18
|
-
/**
|
|
19
|
-
* Create instance from definition with validation and error handling
|
|
20
|
-
*/
|
|
21
|
-
export declare function createInstanceFromDefinition(definition: ReactaDefinition, name: string): {
|
|
22
|
-
success: boolean;
|
|
23
|
-
instance?: ReactaInstance;
|
|
24
|
-
error?: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Load instance data with validation
|
|
28
|
-
*/
|
|
29
|
-
export declare function loadInstance(instanceData: string | Record<string, unknown>): {
|
|
30
|
-
success: boolean;
|
|
31
|
-
instance?: ReactaInstance;
|
|
32
|
-
error?: string;
|
|
33
|
-
};
|
|
34
|
-
export declare function upgradeInstanceToLatestDefinition(instance: ReactaInstance, latestDefinition: ReactaDefinition, callback?: (oldInstance: ReactaInstance, newInstance: Record<string, unknown>, latestDefinition: ReactaDefinition) => void): {
|
|
35
|
-
success: boolean;
|
|
36
|
-
upgradedInstance?: Record<string, unknown>;
|
|
37
|
-
error?: string;
|
|
38
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
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 interface DefinitionPropertyField {
|
|
8
|
-
name: string;
|
|
9
|
-
displayName: string;
|
|
10
|
-
type: string;
|
|
11
|
-
defaultValue: FieldValueType;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
parents?: ParentField;
|
|
14
|
-
children?: Record<string, string[]>;
|
|
15
|
-
group?: string;
|
|
16
|
-
tooltip?: string;
|
|
17
|
-
labelLayout?: 'row' | 'column-left' | 'column-center';
|
|
18
|
-
validationHandlerName?: string;
|
|
19
|
-
dimension?: string;
|
|
20
|
-
defaultUnit?: string;
|
|
21
|
-
options?: Array<{
|
|
22
|
-
label: string;
|
|
23
|
-
value: string;
|
|
24
|
-
}>;
|
|
25
|
-
minLength?: number;
|
|
26
|
-
maxLength?: number;
|
|
27
|
-
pattern?: string;
|
|
28
|
-
placeholder?: string;
|
|
29
|
-
min?: number;
|
|
30
|
-
max?: number;
|
|
31
|
-
minInclusive?: boolean;
|
|
32
|
-
maxInclusive?: boolean;
|
|
33
|
-
step?: number;
|
|
34
|
-
minCount?: number;
|
|
35
|
-
maxCount?: number;
|
|
36
|
-
minDate?: string;
|
|
37
|
-
maxDate?: string;
|
|
38
|
-
includeSeconds?: boolean;
|
|
39
|
-
layout?: 'horizontal' | 'vertical' | 'row' | 'column';
|
|
40
|
-
alignment?: 'left' | 'center' | 'right';
|
|
41
|
-
width?: number;
|
|
42
|
-
height?: number;
|
|
43
|
-
localized?: string;
|
|
44
|
-
minHeight?: string;
|
|
45
|
-
accept?: string;
|
|
46
|
-
multiple?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface ReactaDefinition {
|
|
49
|
-
name: string;
|
|
50
|
-
version: string;
|
|
51
|
-
displayName: string;
|
|
52
|
-
localization?: string;
|
|
53
|
-
properties: DefinitionPropertyField[];
|
|
54
|
-
validationHandlerName?: string;
|
|
55
|
-
submitHandlerName?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface ReactaInstance {
|
|
58
|
-
name: string;
|
|
59
|
-
definition: string;
|
|
60
|
-
version: string;
|
|
61
|
-
values: Record<string, FieldValueType>;
|
|
62
|
-
}
|
|
63
|
-
export interface ReactaFormProps {
|
|
64
|
-
definitionData: string | Record<string, unknown>;
|
|
65
|
-
language?: string;
|
|
66
|
-
instance?: ReactaInstance;
|
|
67
|
-
className?: string;
|
|
68
|
-
darkMode?: boolean;
|
|
69
|
-
style?: React.CSSProperties;
|
|
70
|
-
}
|
|
71
|
-
export type FieldValidationHandler = (value: FieldValueType | unknown, t: (defaultText: string, ...args: unknown[]) => string) => string | undefined;
|
|
72
|
-
export type FormValidationHandler = (valuesMap: Record<string, FieldValueType | unknown>, t: (key: string, ...args: unknown[]) => string) => string[] | undefined;
|
|
73
|
-
export type FormSubmissionHandler = (definition: ReactaDefinition | Record<string, unknown>, instanceName: string | null, valuesMap: Record<string, FieldValueType | unknown>, t: (defaultText: string, ...args: unknown[]) => string) => string[] | undefined;
|
|
74
|
-
export type InputOnChange<T> = (value: T | string, error: string | null) => void;
|
|
75
|
-
export interface BaseInputProps<TValue = unknown, TField extends DefinitionPropertyField = DefinitionPropertyField> {
|
|
76
|
-
field: TField;
|
|
77
|
-
value: TValue;
|
|
78
|
-
placeholder?: string;
|
|
79
|
-
onChange?: InputOnChange<TValue>;
|
|
80
|
-
onError?: (error: string | null) => void;
|
|
81
|
-
}
|
|
82
|
-
export type ReactaFormContextType = {
|
|
83
|
-
definitionName: string;
|
|
84
|
-
language: string;
|
|
85
|
-
darkMode: boolean;
|
|
86
|
-
formStyle: {
|
|
87
|
-
container?: React.CSSProperties;
|
|
88
|
-
titleStyle?: React.CSSProperties;
|
|
89
|
-
};
|
|
90
|
-
fieldStyle: Record<string, unknown>;
|
|
91
|
-
t: (defaultText: string, ...args: unknown[]) => string;
|
|
92
|
-
};
|
|
93
|
-
export type ReactaFormProviderProps = {
|
|
94
|
-
children: ReactNode;
|
|
95
|
-
defaultDefinitionName?: string;
|
|
96
|
-
defaultStyle?: Record<string, unknown>;
|
|
97
|
-
defaultLanguage?: string;
|
|
98
|
-
defaultDarkMode?: boolean;
|
|
99
|
-
defaultLocalizeName?: string;
|
|
100
|
-
className?: string;
|
|
101
|
-
};
|
|
102
|
-
export type TranslationMap = Record<string, string>;
|
|
103
|
-
export type TranslationCache = Map<string, TranslationMap>;
|
|
104
|
-
export interface RegistryResult<T = unknown> {
|
|
105
|
-
success: boolean;
|
|
106
|
-
data?: T;
|
|
107
|
-
error?: string;
|
|
108
|
-
}
|
|
109
|
-
export interface FieldGroup {
|
|
110
|
-
name: string;
|
|
111
|
-
displayName: string;
|
|
112
|
-
description?: string;
|
|
113
|
-
collapsed?: boolean;
|
|
114
|
-
order?: number;
|
|
115
|
-
}
|
|
116
|
-
export interface ValidationResult {
|
|
117
|
-
isValid: boolean;
|
|
118
|
-
errors: string[];
|
|
119
|
-
warnings?: string[];
|
|
120
|
-
}
|
|
121
|
-
export type FormEventType = 'init' | 'change' | 'validate' | 'submit' | 'reset';
|
|
122
|
-
export interface FormEvent {
|
|
123
|
-
type: FormEventType;
|
|
124
|
-
timestamp: Date;
|
|
125
|
-
data?: unknown;
|
|
126
|
-
}
|
|
127
|
-
export interface EnhancedDefinitionPropertyField extends DefinitionPropertyField {
|
|
128
|
-
category?: string;
|
|
129
|
-
tags?: string[];
|
|
130
|
-
dependencies?: string[];
|
|
131
|
-
conditional?: {
|
|
132
|
-
field: string;
|
|
133
|
-
value: unknown;
|
|
134
|
-
operator?: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than';
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import BaseRegistry from "./baseRegistry";
|
|
2
|
-
import React from "react";
|
|
3
|
-
type ComponentType = React.ComponentType<any>;
|
|
4
|
-
declare const registry: BaseRegistry<ComponentType>;
|
|
5
|
-
export declare function registerComponentInternal(type: string, component: ComponentType, isBaseComponent: boolean): void;
|
|
6
|
-
export declare function registerComponent(type: string, component: ComponentType): void;
|
|
7
|
-
export declare function getComponent(type: string): ComponentType | undefined;
|
|
8
|
-
export declare function listComponents(): string[];
|
|
9
|
-
export declare function registerBaseComponents(): void;
|
|
10
|
-
export default registry;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./componentRegistry";
|
|
2
|
-
export * from "./submissionHandlerRegistry";
|
|
3
|
-
export * from "./validationHandlerRegistry";
|
|
4
|
-
export * from "./baseRegistry";
|
|
5
|
-
export { default as componentRegistry } from "./componentRegistry";
|
|
6
|
-
export { default as submissionRegistry } from "./submissionHandlerRegistry";
|
|
7
|
-
export { default as validatorRegistry } from "./validationHandlerRegistry";
|
|
@@ -1,6 +0,0 @@
|
|
|
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 default registry;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FieldValidationHandler, FormValidationHandler } from "../reactaFormTypes";
|
|
2
|
-
export declare function registerFormValidationHandler(name: string, fn: FormValidationHandler): void;
|
|
3
|
-
export declare function registerFieldValidationHandler(category: string, name: string, fn: FieldValidationHandler): void;
|
|
4
|
-
export declare function getFieldValidationHandler(category: string, name: string): FieldValidationHandler | null;
|
|
5
|
-
export declare function getFormValidationHandler(name: string): FormValidationHandler | null;
|
|
6
|
-
export declare function listFieldValidationHandlers(category?: string): string[];
|
|
7
|
-
export declare function listFormValidationHandlers(): string[];
|
|
8
|
-
declare const _default: {
|
|
9
|
-
registerFormValidationHandler: typeof registerFormValidationHandler;
|
|
10
|
-
registerFieldValidationHandler: typeof registerFieldValidationHandler;
|
|
11
|
-
getFieldValidationHandler: typeof getFieldValidationHandler;
|
|
12
|
-
getFormValidationHandler: typeof getFormValidationHandler;
|
|
13
|
-
listFieldValidationHandlers: typeof listFieldValidationHandlers;
|
|
14
|
-
listFormValidationHandlers: typeof listFormValidationHandlers;
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ReactaDefinition, FieldValueType, ReactaInstance } 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: (key: string) => string, errors: Record<string, string>): SubmitResult;
|
|
9
|
-
declare const _default: {
|
|
10
|
-
submitForm: typeof submitForm;
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ReactaDefinition, FieldValueType, DefinitionPropertyField } from "./reactaFormTypes";
|
|
2
|
-
export declare function validateFieldValue(definitionName: string, field: Partial<DefinitionPropertyField>, value: FieldValueType | unknown, t: (key: string) => string): string | null;
|
|
3
|
-
export declare function validateFormValues(definition: ReactaDefinition | null, valuesMap: Record<string, FieldValueType | unknown>, t: (key: string) => string): string[] | null;
|
|
4
|
-
export declare function clearValidationCache(): void;
|
|
5
|
-
declare const _default: {
|
|
6
|
-
validateFieldValue: typeof validateFieldValue;
|
|
7
|
-
validateFormValues: typeof validateFormValues;
|
|
8
|
-
clearValidationCache: typeof clearValidationCache;
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type DebouncedCallback = {
|
|
2
|
-
callback: (...args: unknown[]) => void;
|
|
3
|
-
cancel: () => void;
|
|
4
|
-
flush: () => void;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* useDebouncedCallback
|
|
8
|
-
* - callback: function to call
|
|
9
|
-
* - wait: debounce delay in ms
|
|
10
|
-
* - options.leading: if true, call on leading edge (optional)
|
|
11
|
-
*
|
|
12
|
-
* Returns { callback, cancel, flush } where callback is debounced.
|
|
13
|
-
*/
|
|
14
|
-
export declare function useDebouncedCallback(callback: (...args: unknown[]) => unknown, wait?: number, options?: {
|
|
15
|
-
leading?: boolean;
|
|
16
|
-
}): DebouncedCallback;
|
|
17
|
-
/**
|
|
18
|
-
* createDebouncedCallback - non-hook variant that returns the same API but
|
|
19
|
-
* doesn't use React hooks. Useful for creating many debounced callbacks
|
|
20
|
-
* programmatically (e.g., driven from a static schema) while handling
|
|
21
|
-
* lifecycle cleanup manually.
|
|
22
|
-
*/
|
|
23
|
-
export declare function createDebouncedCallback(callback: (...args: unknown[]) => unknown, wait?: number, options?: {
|
|
24
|
-
leading?: boolean;
|
|
25
|
-
}): DebouncedCallback;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ReactaFormContextType } from '../core/reactaFormTypes';
|
|
2
|
-
export declare const ReactaFormContext: import("react").Context<ReactaFormContextType | undefined>;
|
|
3
|
-
declare const useReactaFormContext: () => ReactaFormContextType;
|
|
4
|
-
export default useReactaFormContext;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS class constants and helpers
|
|
3
|
-
*/
|
|
4
|
-
export declare const CSS_CLASSES: {
|
|
5
|
-
readonly field: "reactaform-field";
|
|
6
|
-
readonly label: "reactaform-label";
|
|
7
|
-
readonly input: "reactaform-input";
|
|
8
|
-
readonly textInput: "reactaform-input--text";
|
|
9
|
-
readonly inputNumber: "reactaform-input--number";
|
|
10
|
-
readonly inputSelect: "reactaform-select";
|
|
11
|
-
readonly rangeInput: "reactaform-input--range";
|
|
12
|
-
readonly button: "reactaform-button";
|
|
13
|
-
};
|
|
14
|
-
export declare const combineClasses: (...classes: (string | undefined | null | false | Record<string, boolean>)[]) => string;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ReactaDefinition, DefinitionPropertyField } from "../core/reactaFormTypes";
|
|
2
|
-
export declare function isDefinitionPropertyField(obj: unknown): obj is DefinitionPropertyField;
|
|
3
|
-
export declare function isReactaDefinition(obj: unknown): obj is ReactaDefinition;
|
|
4
|
-
/**
|
|
5
|
-
* Enhanced serialization options for better control over the process
|
|
6
|
-
*/
|
|
7
|
-
export interface SerializationOptions {
|
|
8
|
-
includeMetadata?: boolean;
|
|
9
|
-
dateFormat?: 'iso' | 'timestamp' | 'locale';
|
|
10
|
-
fileHandling?: 'metadata' | 'skip' | 'base64';
|
|
11
|
-
prettify?: boolean;
|
|
12
|
-
excludeFields?: string[];
|
|
13
|
-
includeOnlyFields?: string[];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Enhanced deserialization options
|
|
17
|
-
*/
|
|
18
|
-
export interface DeserializationOptions {
|
|
19
|
-
strict?: boolean;
|
|
20
|
-
validateTypes?: boolean;
|
|
21
|
-
preserveUnknownFields?: boolean;
|
|
22
|
-
dateFormat?: 'auto' | 'iso' | 'timestamp';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Serialization result with metadata
|
|
26
|
-
*/
|
|
27
|
-
export interface SerializationResult {
|
|
28
|
-
success: boolean;
|
|
29
|
-
data?: string;
|
|
30
|
-
error?: string;
|
|
31
|
-
metadata?: {
|
|
32
|
-
fieldCount: number;
|
|
33
|
-
excludedFields: string[];
|
|
34
|
-
warnings: string[];
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Deserialization result with validation info
|
|
39
|
-
*/
|
|
40
|
-
export interface DeserializationResult<T = unknown> {
|
|
41
|
-
success: boolean;
|
|
42
|
-
data?: T;
|
|
43
|
-
error?: string;
|
|
44
|
-
warnings?: string[];
|
|
45
|
-
validationErrors?: string[];
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Enhanced instance serialization with comprehensive options and error handling
|
|
49
|
-
*/
|
|
50
|
-
export declare function serializeInstance(instance: Record<string, unknown>, definition?: ReactaDefinition | Record<string, unknown>, options?: SerializationOptions): SerializationResult;
|
|
51
|
-
/**
|
|
52
|
-
* Enhanced instance deserialization with comprehensive validation and error handling
|
|
53
|
-
*/
|
|
54
|
-
export declare function deserializeInstance(serialized: string, definition?: ReactaDefinition | Record<string, unknown>, options?: DeserializationOptions): DeserializationResult<Record<string, unknown>>;
|
|
55
|
-
/**
|
|
56
|
-
* Enhanced definition serialization with validation and metadata
|
|
57
|
-
*/
|
|
58
|
-
export declare function serializeDefinition(definition: ReactaDefinition | Record<string, unknown>, options?: SerializationOptions): SerializationResult;
|
|
59
|
-
/**
|
|
60
|
-
* Enhanced definition deserialization with comprehensive validation
|
|
61
|
-
*/
|
|
62
|
-
export declare function deserializeDefinition(input: string | Record<string, unknown>, options?: DeserializationOptions): DeserializationResult<ReactaDefinition>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { DefinitionPropertyField } from "../core/reactaFormTypes";
|
|
2
|
-
/**
|
|
3
|
-
* Enhanced rename duplicated groups with better conflict resolution
|
|
4
|
-
* For example: g1, g1, g2, g1 becomes g1, g1, g2, g1(1)
|
|
5
|
-
* This mutates the provided nameToField map so downstream code sees the
|
|
6
|
-
* renamed group values.
|
|
7
|
-
*/
|
|
8
|
-
export declare const renameDuplicatedGroups: (properties: DefinitionPropertyField[], nameToField: Record<string, DefinitionPropertyField>) => number;
|
|
9
|
-
/**
|
|
10
|
-
* Enhanced consecutive field grouping with metadata
|
|
11
|
-
*/
|
|
12
|
-
export declare const groupConsecutiveFields: (items: DefinitionPropertyField[], options?: {
|
|
13
|
-
includeEmpty?: boolean;
|
|
14
|
-
}) => {
|
|
15
|
-
groups: Array<{
|
|
16
|
-
name: string | null;
|
|
17
|
-
fields: DefinitionPropertyField[];
|
|
18
|
-
}>;
|
|
19
|
-
metadata: {
|
|
20
|
-
totalGroups: number;
|
|
21
|
-
emptyGroups: number;
|
|
22
|
-
largestGroup: number;
|
|
23
|
-
};
|
|
24
|
-
};
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ReactaForm Utils - Comprehensive utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides enhanced utility functions for form building,
|
|
5
|
-
* styling, serialization, translation, and component management.
|
|
6
|
-
*/
|
|
7
|
-
export { combineClasses, CSS_CLASSES, } from './cssClasses';
|
|
8
|
-
export { serializeInstance, deserializeInstance, serializeDefinition, deserializeDefinition, type SerializationOptions, type DeserializationOptions, type SerializationResult, type DeserializationResult } from './definitionSerializers';
|
|
9
|
-
export { renameDuplicatedGroups, groupConsecutiveFields } from './groupingHelpers';
|
|
10
|
-
export { loadCommonTranslation, loadUserTranslation, createTranslationFunction, } from './translationCache';
|
|
11
|
-
export * from './unitValueMapper';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { TranslationMap, TranslationCache } from "../core/reactaFormTypes";
|
|
2
|
-
/**
|
|
3
|
-
* Translation loading result
|
|
4
|
-
*/
|
|
5
|
-
export interface TranslationLoadResult {
|
|
6
|
-
success: boolean;
|
|
7
|
-
translations: TranslationMap;
|
|
8
|
-
error?: string;
|
|
9
|
-
fromCache?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare const userTranslationCache: TranslationCache;
|
|
12
|
-
export declare const userFailedSet: Set<string>;
|
|
13
|
-
/**
|
|
14
|
-
* Enhanced common translation loader with better error handling
|
|
15
|
-
*/
|
|
16
|
-
export declare const loadCommon: (language: string) => Promise<TranslationLoadResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Enhanced common translation loading with caching and metadata
|
|
19
|
-
*/
|
|
20
|
-
export declare const loadCommonTranslation: (language: string) => Promise<TranslationLoadResult>;
|
|
21
|
-
/**
|
|
22
|
-
* Enhanced user translation loading with better error handling and caching
|
|
23
|
-
*/
|
|
24
|
-
export declare const loadUserTranslation: (language: string, localizeName: string) => Promise<TranslationLoadResult>;
|
|
25
|
-
/**
|
|
26
|
-
* Return whether translation subsystem should run in debug mode.
|
|
27
|
-
* Checks multiple env sources (Vite, webpack, Next.js, etc.) for dev/debug mode.
|
|
28
|
-
*/
|
|
29
|
-
export declare function isDebugMode(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Create a translation function using provided maps
|
|
32
|
-
* @returns A translation function
|
|
33
|
-
* This function processes text using only dictionary lookups and basic string interpolation.
|
|
34
|
-
* Note: handling pluralization is not supported now
|
|
35
|
-
* @example
|
|
36
|
-
* const t = createTranslationFunction('fr', commonMap, userMap);
|
|
37
|
-
* const translated = t("Hello, {{1}}!", "world");
|
|
38
|
-
*/
|
|
39
|
-
export declare const createTranslationFunction: (language: string, commonMap: TranslationMap, userMap: TranslationMap) => (defaultText: string, ...args: unknown[]) => string;
|
|
40
|
-
/**
|
|
41
|
-
* Clear all caches
|
|
42
|
-
*/
|
|
43
|
-
export declare function clearTranslationCaches(): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const dimensionUnitsMap: Record<string, string[]>;
|
|
2
|
-
export declare const dimensionUnitDisplayMap: Record<string, Record<string, string>>;
|
|
3
|
-
export declare const dimensonUnitFactorsMap: Record<string, Record<string, number>>;
|
|
4
|
-
export declare const unitsByDimension: Record<string, Record<string, {
|
|
5
|
-
name: string;
|
|
6
|
-
shortName: string;
|
|
7
|
-
factor?: number;
|
|
8
|
-
}>>;
|