extended-dynamic-forms 0.3.13 → 0.4.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/README.md +253 -674
- package/dist/WizardForm.d.ts +17 -2
- package/dist/components/FieldFeedbackContext.d.ts +4 -0
- package/dist/components/FieldStyleContext.d.ts +7 -0
- package/dist/components/SchemaSelectionContext.d.ts +20 -0
- package/dist/components/URLBlurValidationContext.d.ts +38 -0
- package/dist/components/fields/TextChangeScope.d.ts +28 -0
- package/dist/components/fields/TextEmptyArrayField.d.ts +3 -0
- package/dist/conditionals/v2/createConditionalEngineHook.d.ts +3 -1
- package/dist/conditionals/v2/index.d.ts +2 -1
- package/dist/conditionals/v2/types.d.ts +13 -0
- package/dist/conditionals/v2/utils/stepRules.d.ts +35 -0
- package/dist/events/FormEventContext.d.ts +3 -0
- package/dist/index.es.js +41796 -32825
- package/dist/index.umd.js +1618 -1606
- package/dist/layouts/wizard/WizardLayout.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/utils/normalizeUrlValue.d.ts +3 -0
- package/dist/utils/urlValue.d.ts +12 -0
- package/dist/widgets/base/URLParts.d.ts +5 -0
- package/dist/widgets/base/URLPreviewLink.d.ts +5 -0
- package/dist/widgets/base/inputStyles.d.ts +4 -0
- package/dist/widgets/base/inputTypography.d.ts +3 -0
- package/dist/widgets/base/numberInputStyles.d.ts +4 -0
- package/dist/widgets/base/telephoneAddons.d.ts +3 -0
- package/dist/widgets/base/types.d.ts +15 -1
- package/dist/widgets/base/useInputChrome.d.ts +5 -0
- package/dist/widgets/base/utils.d.ts +9 -1
- package/dist/widgets/choice/ChoiceWidget.types.d.ts +2 -0
- package/dist/widgets/choice/dropdownValidation.d.ts +8 -0
- package/dist/widgets/choice/inlineChoiceValidation.d.ts +5 -0
- package/dist/widgets/choice/presenters/InlineChoiceGroup.d.ts +888 -0
- package/dist/widgets/date/DateTimeWidget.d.ts +2 -21
- package/dist/widgets/date/calendarConstraints.d.ts +5 -0
- package/dist/widgets/date/dateRangeValue.d.ts +20 -0
- package/dist/widgets/date/dateTimeValue.d.ts +15 -0
- package/dist/widgets/file/FileUploadWidget.d.ts +3 -32
- package/dist/widgets/index.d.ts +6 -6
- package/dist/widgets/input/TelephoneWidget.d.ts +1 -1
- package/dist/widgets/input/emailValidation.d.ts +7 -0
- package/dist/widgets/input/telephoneMask.d.ts +7 -0
- package/dist/widgets/input/telephoneOptions.d.ts +14 -0
- package/package.json +9 -11
package/dist/WizardForm.d.ts
CHANGED
|
@@ -4,6 +4,18 @@ export interface WizardStep {
|
|
|
4
4
|
id: string;
|
|
5
5
|
title: string;
|
|
6
6
|
description?: string;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface StepChangeEvent {
|
|
10
|
+
stepId: string;
|
|
11
|
+
stepIndex: number;
|
|
12
|
+
allStepsIndex: number;
|
|
13
|
+
formData: any;
|
|
14
|
+
}
|
|
15
|
+
export interface StepAutoAdvanceEvent {
|
|
16
|
+
fromStepId: string;
|
|
17
|
+
toStepId: string;
|
|
18
|
+
formData: any;
|
|
7
19
|
}
|
|
8
20
|
export interface WizardFormProps {
|
|
9
21
|
schema: any;
|
|
@@ -11,7 +23,9 @@ export interface WizardFormProps {
|
|
|
11
23
|
webhooks?: WebhookConfig[];
|
|
12
24
|
formData?: any;
|
|
13
25
|
onSubmit?: (data: any) => void;
|
|
14
|
-
onStepChange?: (
|
|
26
|
+
onStepChange?: (stepIndex: number, data: any, stepId?: string) => void;
|
|
27
|
+
onStepChangeDetailed?: (event: StepChangeEvent) => void;
|
|
28
|
+
onStepAutoAdvance?: (event: StepAutoAdvanceEvent) => void;
|
|
15
29
|
onFieldFocus?: (event: any) => void;
|
|
16
30
|
onFieldBlur?: (event: any) => void;
|
|
17
31
|
onFieldChange?: (event: any) => void;
|
|
@@ -28,5 +42,6 @@ export interface WizardFormProps {
|
|
|
28
42
|
fields?: any;
|
|
29
43
|
templates?: any;
|
|
30
44
|
enableDynamicBinding?: boolean;
|
|
45
|
+
includeHiddenStepsInSubmit?: boolean;
|
|
31
46
|
}
|
|
32
|
-
export declare function WizardForm({ schema, uiSchema, webhooks, formData: initialFormData, onSubmit, onStepChange, onFieldFocus, onFieldBlur, onFieldChange, onLiveChange, showProgressBar, showStepDescription, submitButtonText, liveValidate, showErrorList, onWebhookStart, onWebhookComplete, onWebhookError, widgets, fields, templates, enableDynamicBinding, }: WizardFormProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function WizardForm({ schema, uiSchema, webhooks, formData: initialFormData, onSubmit, onStepChange, onFieldFocus, onFieldBlur, onFieldChange, onLiveChange, showProgressBar, showStepDescription, submitButtonText, liveValidate, showErrorList, onWebhookStart, onWebhookComplete, onWebhookError, widgets, fields, templates, enableDynamicBinding, onStepChangeDetailed, onStepAutoAdvance, includeHiddenStepsInSubmit, }: WizardFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare const FieldStyleContext: import('react').Context<{
|
|
4
|
+
id: string;
|
|
5
|
+
style: CSSProperties | undefined;
|
|
6
|
+
} | undefined>;
|
|
7
|
+
export declare function useFieldStyle(id: string, explicitStyle?: CSSProperties): CSSProperties | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { FieldProps, MultiSchemaFieldTemplateProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
export type SchemaSelections = {
|
|
5
|
+
choices: Map<string, number>;
|
|
6
|
+
rows: Map<string, string[]>;
|
|
7
|
+
scope: string;
|
|
8
|
+
arrayScope: string;
|
|
9
|
+
baseId: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const SchemaSelectionContext: import('react').Context<SchemaSelections | undefined>;
|
|
12
|
+
export declare const createSchemaSelections: () => SchemaSelections;
|
|
13
|
+
export declare const schemaSelectionKey: (selection: SchemaSelections | undefined, id: string) => string;
|
|
14
|
+
export declare function arrayItemSelections(selection: SchemaSelections | undefined, id: string, itemId: string, index: number, token?: string | undefined): SchemaSelections | undefined;
|
|
15
|
+
/** Respect registry and per-field template overrides through RJSF's public template resolver. */
|
|
16
|
+
export declare function withArraySchemaSelections(Field: ComponentType<FieldProps>): (props: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/** Seed RJSF's own matching/selection state without replaying its data-changing onOptionChange. */
|
|
18
|
+
export declare function withRestoredSchemaSelection(Field: ComponentType<FieldProps>): (props: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
/** Observe RJSF's public template inputs, not private field state or a second branch selector. */
|
|
20
|
+
export declare function withSchemaSelections(Template: ComponentType<MultiSchemaFieldTemplateProps>): (props: MultiSchemaFieldTemplateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ErrorListProps, ErrorSchema, WidgetProps } from '@rjsf/utils';
|
|
3
|
+
import { ExtendedFormProps } from '../types';
|
|
4
|
+
|
|
5
|
+
type Metadata = Pick<WidgetProps, 'id' | 'registry'>;
|
|
6
|
+
type Path = string[];
|
|
7
|
+
type Settings = Pick<ExtendedFormProps, 'schema' | 'uiSchema' | 'formData' | 'liveValidate' | 'noValidate' | 'extraErrors' | 'idPrefix' | 'idSeparator' | 'transformErrors' | 'customValidate'>;
|
|
8
|
+
type TimingContext = {
|
|
9
|
+
register: (metadata: Metadata) => () => void;
|
|
10
|
+
touch: (metadata: Metadata, changing: boolean) => void;
|
|
11
|
+
request: (metadata: Metadata) => void;
|
|
12
|
+
errors: (metadata: Metadata, rawErrors: string[]) => string[];
|
|
13
|
+
hiddenPaths: Path[];
|
|
14
|
+
};
|
|
15
|
+
export declare const URLBlurValidationContext: React.Context<TimingContext | undefined>;
|
|
16
|
+
export declare function useURLBlurValidationRoot(settings: Settings): {
|
|
17
|
+
acceptChange: (data: unknown, rootErrors?: ErrorSchema) => void;
|
|
18
|
+
value: {
|
|
19
|
+
register: (metadata: Metadata) => () => void;
|
|
20
|
+
touch: (metadata: Metadata, changing: boolean) => void;
|
|
21
|
+
request: (metadata: Metadata) => void;
|
|
22
|
+
errors: (metadata: Metadata, rawErrors: string[]) => string[];
|
|
23
|
+
hiddenPaths: Path[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function useURLBlurValidation(props: WidgetProps, urlPresentation?: boolean): {
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
messages: string[];
|
|
29
|
+
change: () => void;
|
|
30
|
+
blur: (changing?: boolean) => void;
|
|
31
|
+
};
|
|
32
|
+
export declare function URLBlurFeedback({ id, messages, hideError }: {
|
|
33
|
+
id: string;
|
|
34
|
+
messages: string[];
|
|
35
|
+
hideError?: boolean;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
37
|
+
export declare function withURLBlurErrorList(Template: React.ComponentType<ErrorListProps>): (props: ErrorListProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FieldProps } from '@rjsf/utils';
|
|
2
|
+
|
|
3
|
+
type Path = (string | number)[];
|
|
4
|
+
export type TextChangeScope = {
|
|
5
|
+
parent?: TextChangeScope;
|
|
6
|
+
key: string | number;
|
|
7
|
+
name: string;
|
|
8
|
+
index?: number;
|
|
9
|
+
live: boolean;
|
|
10
|
+
widgets: Set<object>;
|
|
11
|
+
children: Set<TextChangeScope>;
|
|
12
|
+
};
|
|
13
|
+
export type TextChangeCalls = {
|
|
14
|
+
current?: TextChangeScope;
|
|
15
|
+
};
|
|
16
|
+
export declare const TextChangeContext: import('react').Context<{
|
|
17
|
+
scope: TextChangeScope;
|
|
18
|
+
onChange: FieldProps["onChange"];
|
|
19
|
+
} | undefined>;
|
|
20
|
+
/** Public callbacks, not DOM ids or answer equality, identify same-field delegation. */
|
|
21
|
+
export declare function useTextChangeScope(props: FieldProps, item?: boolean): TextChangeScope;
|
|
22
|
+
/** Presence belongs to this committed field scope, never a form-wide widget-id set. */
|
|
23
|
+
export declare function useTextChangeRegistration(name: string, emptyValue: unknown): void;
|
|
24
|
+
/** The actual originating leaf must match the complete public path to this boundary. */
|
|
25
|
+
export declare function textChangeTargets(origin: TextChangeScope | undefined, boundary: TextChangeScope, path: Path): boolean;
|
|
26
|
+
/** Preserve origin only during matching synchronous public callback forwarding. */
|
|
27
|
+
export declare function useTextChangeCallback(onChange: FieldProps['onChange'], scope: TextChangeScope, calls: TextChangeCalls): (newValue: any, path?: (number | string)[], es?: import('@rjsf/utils').ErrorSchema<any> | undefined, id?: string) => void;
|
|
28
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { EngineConfig, ConditionalEngineHook } from './types';
|
|
1
|
+
import { Rule, EngineConfig, ConditionalEngineHook } from './types';
|
|
2
2
|
|
|
3
|
+
export declare function stripConditionalMetadata(value: unknown): unknown;
|
|
4
|
+
export declare function evaluateConditionalRules<T, C>(config: EngineConfig<T, C>, rules: Rule<T>[], baseConfig: C, formData: unknown): C;
|
|
3
5
|
export declare function createConditionalEngineHook<T>(config: EngineConfig<T>): ConditionalEngineHook<T>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { createConditionalEngineHook } from './createConditionalEngineHook';
|
|
2
|
-
export type { Rule, EngineConfig, ConditionalEngineHook, UiEffect, SchemaEffect, ValidationEffect, JsonLogicRule, } from './types';
|
|
2
|
+
export type { Rule, EngineConfig, ConditionalEngineHook, UiEffect, SchemaEffect, ValidationEffect, JsonLogicRule, StepEffect, StepRule, } from './types';
|
|
3
3
|
export { useConditionalUi, type UiRule } from './hooks/useConditionalUi';
|
|
4
4
|
export { useConditionalSchema, type SchemaRule, } from './hooks/useConditionalSchema';
|
|
5
5
|
export { useConditionalValidation, type ValidationRule, } from './hooks/useConditionalValidation';
|
|
6
6
|
export { createDynamicArrayItemsUiSchema, mergeItemUiSchema, arrayItemPatterns, normalizeUiSchemaDynamicItems, compileDynamicItems, type ArrayItemsFunction, type ArrayItemConditionalFn, type DynamicItemsConfig, type DynamicItemsRule, } from './utils/dynamicArrayItems';
|
|
7
|
+
export { sanitizeStepRules, evaluateStepRules, type SanitizedStepRule, type StepRuleSanitizerOptions, type StepVisibilityResult, } from './utils/stepRules';
|
|
7
8
|
export { uiEngineConfig } from './engines/uiEngineConfig';
|
|
8
9
|
export { schemaEngineConfig } from './engines/schemaEngineConfig';
|
|
9
10
|
export { validationEngineConfig, createCustomValidate, } from './engines/validationEngineConfig';
|
|
@@ -45,3 +45,16 @@ export interface ValidationEffect {
|
|
|
45
45
|
*/
|
|
46
46
|
validate: (errors: ErrorSchema, formData: any) => void;
|
|
47
47
|
}
|
|
48
|
+
export type StepEffect = 'skip';
|
|
49
|
+
export interface StepRule extends Omit<Rule<StepEffect>, 'condition' | 'effect'> {
|
|
50
|
+
/**
|
|
51
|
+
* JsonLogic rule determining whether the step should be skipped.
|
|
52
|
+
* Functions are not supported to keep configurations serializable.
|
|
53
|
+
*/
|
|
54
|
+
condition: JsonLogicRule;
|
|
55
|
+
/**
|
|
56
|
+
* Currently only `skip` is supported. The field is optional to keep
|
|
57
|
+
* authoring friction low – when omitted we treat the rule as `skip`.
|
|
58
|
+
*/
|
|
59
|
+
effect?: StepEffect;
|
|
60
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { StepEffect, StepRule } from '../types';
|
|
2
|
+
|
|
3
|
+
export type SanitizedStepRule = Omit<StepRule, 'effect'> & {
|
|
4
|
+
effect: StepEffect;
|
|
5
|
+
};
|
|
6
|
+
export interface StepRuleSanitizerOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Human-readable location for logging warnings.
|
|
9
|
+
*/
|
|
10
|
+
context?: string;
|
|
11
|
+
/**
|
|
12
|
+
* When provided we attempt to pick rules addressed to this step id from
|
|
13
|
+
* mapping objects (`{ [stepId]: StepRule[] }`).
|
|
14
|
+
*/
|
|
15
|
+
stepId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Allow objects that map `stepId -> StepRule[]`.
|
|
18
|
+
*/
|
|
19
|
+
allowMap?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface StepRuleEvaluationDebug {
|
|
22
|
+
name: string;
|
|
23
|
+
result?: boolean;
|
|
24
|
+
error?: Error;
|
|
25
|
+
}
|
|
26
|
+
export interface StepVisibilityResult {
|
|
27
|
+
visible: boolean;
|
|
28
|
+
triggeredRuleName?: string;
|
|
29
|
+
triggeredRule?: SanitizedStepRule;
|
|
30
|
+
evaluations?: StepRuleEvaluationDebug[];
|
|
31
|
+
}
|
|
32
|
+
export declare const sanitizeStepRules: (raw: unknown, options?: StepRuleSanitizerOptions) => SanitizedStepRule[];
|
|
33
|
+
export declare const evaluateStepRules: (rules: SanitizedStepRule[], formData: any, options?: {
|
|
34
|
+
debug?: boolean;
|
|
35
|
+
}) => StepVisibilityResult;
|
|
@@ -7,14 +7,17 @@ export interface FormEventContextType {
|
|
|
7
7
|
formData?: any;
|
|
8
8
|
bindingData?: any;
|
|
9
9
|
formContext?: any;
|
|
10
|
+
noValidate?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const FormEventContext: React.Context<FormEventContextType | null>;
|
|
13
|
+
export declare const SubmitLifecycleOwnerContext: React.Context<"form" | "parent">;
|
|
12
14
|
export { FormEventContext, FormEventManager };
|
|
13
15
|
export interface FormEventProviderProps {
|
|
14
16
|
eventHub: FormEventHub;
|
|
15
17
|
formData?: any;
|
|
16
18
|
bindingData?: any;
|
|
17
19
|
formContext?: any;
|
|
20
|
+
noValidate?: boolean;
|
|
18
21
|
children: ReactNode;
|
|
19
22
|
}
|
|
20
23
|
export declare const FormEventProvider: React.FC<FormEventProviderProps>;
|