@form-eng/core 1.0.0 → 1.1.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/index.d.mts +43 -12
- package/dist/index.d.ts +43 -12
- package/dist/index.js +77 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -30,7 +30,7 @@ interface IFieldCondition {
|
|
|
30
30
|
/** The field name to evaluate */
|
|
31
31
|
field: string;
|
|
32
32
|
/** Comparison operator */
|
|
33
|
-
operator: "equals" | "notEquals" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "contains" | "notContains" | "startsWith" | "endsWith" | "in" | "notIn" | "isEmpty" | "isNotEmpty" | "matches";
|
|
33
|
+
operator: "equals" | "notEquals" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "contains" | "notContains" | "startsWith" | "endsWith" | "in" | "notIn" | "isEmpty" | "isNotEmpty" | "matches" | "arrayContains" | "arrayNotContains" | "arrayLengthEquals" | "arrayLengthGreaterThan" | "arrayLengthLessThan";
|
|
34
34
|
/** The value to compare against. Not required for isEmpty/isNotEmpty. */
|
|
35
35
|
value?: unknown;
|
|
36
36
|
}
|
|
@@ -96,6 +96,8 @@ interface IFieldEffect {
|
|
|
96
96
|
computedValue?: string;
|
|
97
97
|
/** Override field ordering */
|
|
98
98
|
fieldOrder?: string[];
|
|
99
|
+
/** Directly set the field's value when the rule condition is met */
|
|
100
|
+
setValue?: unknown;
|
|
99
101
|
/** Apply effects to OTHER fields (keyed by field name) */
|
|
100
102
|
fields?: Record<string, IFieldEffect>;
|
|
101
103
|
}
|
|
@@ -263,9 +265,7 @@ interface IFormSettings {
|
|
|
263
265
|
}
|
|
264
266
|
|
|
265
267
|
/**
|
|
266
|
-
* Props passed to injected field components
|
|
267
|
-
*
|
|
268
|
-
* This replaces the v1 IHookFieldSharedProps type.
|
|
268
|
+
* Props passed to injected field components via React.cloneElement.
|
|
269
269
|
* The generic parameter T types the `config` metadata object.
|
|
270
270
|
*/
|
|
271
271
|
interface IFieldProps<T = Record<string, unknown>> {
|
|
@@ -315,9 +315,7 @@ interface IFieldProps<T = Record<string, unknown>> {
|
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* Runtime state for a single field after all rules have been evaluated.
|
|
318
|
-
*
|
|
319
|
-
* This replaces the v1 IBusinessRule type. Contains the evaluated state
|
|
320
|
-
* consumed by form components to determine rendering behavior.
|
|
318
|
+
* Consumed by form components to determine rendering behavior.
|
|
321
319
|
*/
|
|
322
320
|
interface IRuntimeFieldState {
|
|
323
321
|
/** UI component type to render. May be swapped by rules. */
|
|
@@ -348,11 +346,16 @@ interface IRuntimeFieldState {
|
|
|
348
346
|
dependsOnFields?: string[];
|
|
349
347
|
/** The source rules that produced this state (for tracing/debugging). */
|
|
350
348
|
activeRuleIds?: string[];
|
|
349
|
+
/**
|
|
350
|
+
* A pending value to set on the field, produced by a rule with setValue effect.
|
|
351
|
+
* The form component reads this and calls RHF setValue. Undefined if no rule set a value.
|
|
352
|
+
*/
|
|
353
|
+
pendingSetValue?: {
|
|
354
|
+
value: unknown;
|
|
355
|
+
};
|
|
351
356
|
}
|
|
352
357
|
/**
|
|
353
358
|
* Runtime state for the entire form.
|
|
354
|
-
*
|
|
355
|
-
* This replaces the v1 IConfigBusinessRules + IBusinessRulesState types.
|
|
356
359
|
*/
|
|
357
360
|
interface IRuntimeFormState {
|
|
358
361
|
/** Per-field runtime state keyed by field name. */
|
|
@@ -362,8 +365,6 @@ interface IRuntimeFormState {
|
|
|
362
365
|
}
|
|
363
366
|
/**
|
|
364
367
|
* State stored in the rules engine provider (keyed by config name).
|
|
365
|
-
*
|
|
366
|
-
* This replaces the v1 IBusinessRulesState type.
|
|
367
368
|
*/
|
|
368
369
|
interface IRulesEngineState {
|
|
369
370
|
configs: Record<string, IRuntimeFormState>;
|
|
@@ -605,6 +606,15 @@ declare const ComponentTypes: {
|
|
|
605
606
|
readonly ReadOnlyWithButton: "ReadOnlyWithButton";
|
|
606
607
|
readonly ChoiceSet: "ChoiceSet";
|
|
607
608
|
readonly FieldArray: "FieldArray";
|
|
609
|
+
readonly RadioGroup: "RadioGroup";
|
|
610
|
+
readonly CheckboxGroup: "CheckboxGroup";
|
|
611
|
+
readonly Rating: "Rating";
|
|
612
|
+
readonly ColorPicker: "ColorPicker";
|
|
613
|
+
readonly Autocomplete: "Autocomplete";
|
|
614
|
+
readonly FileUpload: "FileUpload";
|
|
615
|
+
readonly DateRange: "DateRange";
|
|
616
|
+
readonly DateTime: "DateTime";
|
|
617
|
+
readonly PhoneInput: "PhoneInput";
|
|
608
618
|
};
|
|
609
619
|
/** Form-level constants */
|
|
610
620
|
declare const FormConstants: {
|
|
@@ -804,6 +814,27 @@ interface IValidationContext {
|
|
|
804
814
|
values: IEntityData;
|
|
805
815
|
signal?: AbortSignal;
|
|
806
816
|
}
|
|
817
|
+
/** Metadata describing a validator for use in designer UIs and documentation. */
|
|
818
|
+
interface IValidatorMetadata {
|
|
819
|
+
/** Human-readable display name */
|
|
820
|
+
label: string;
|
|
821
|
+
/** Optional description of what the validator checks */
|
|
822
|
+
description?: string;
|
|
823
|
+
/** Named parameters the validator accepts */
|
|
824
|
+
params?: Record<string, {
|
|
825
|
+
type: "string" | "number" | "boolean";
|
|
826
|
+
label: string;
|
|
827
|
+
required?: boolean;
|
|
828
|
+
}>;
|
|
829
|
+
}
|
|
830
|
+
/** Register metadata for a custom (or built-in) validator */
|
|
831
|
+
declare function registerValidatorMetadata(name: string, metadata: IValidatorMetadata): void;
|
|
832
|
+
/** Get metadata for a specific validator by name */
|
|
833
|
+
declare function getValidatorMetadata(name: string): IValidatorMetadata | undefined;
|
|
834
|
+
/** Get all registered validator metadata */
|
|
835
|
+
declare function getAllValidatorMetadata(): Record<string, IValidatorMetadata>;
|
|
836
|
+
/** Reset validator metadata registry (for testing) */
|
|
837
|
+
declare function resetValidatorMetadataRegistry(): void;
|
|
807
838
|
/** Register custom validators (merge into registry) */
|
|
808
839
|
declare function registerValidators(custom: Record<string, ValidatorFn>): void;
|
|
809
840
|
/** Get a validator by name */
|
|
@@ -1454,4 +1485,4 @@ declare function getTimeline(): ITimelineEvent[];
|
|
|
1454
1485
|
*/
|
|
1455
1486
|
declare function clearTimeline(): void;
|
|
1456
1487
|
|
|
1457
|
-
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal, type Dictionary, ExecuteComputedValue, FIELD_PARENT_PREFIX, FieldArray, FieldWrapper, FormConstants, FormDevTools, FormEngine, FormErrorBoundary, FormFields, FormStrings, GetChildEntity, GetComputedValuesOnCreate, GetComputedValuesOnDirtyFields, GetConfirmInputModalProps, GetFieldsToRender, type IAnalyticsCallbacks, type IClearRulesAction, type ICondition, type IConfigValidationError, type IConfirmInputModalProps, type ICoreLocaleStrings, type ICycleError, type IDraftPersistenceOptions, type IDraftState, type IEntityData, type IFieldArrayProps, type IFieldCondition, type IFieldConfig, type IFieldEffect, type IFieldProps, type IFieldToRender, type IFormAnalytics, type IFormConfig, type IFormDevToolsProps, type IFormEngineSharedProps, type IFormSettings, type IInjectedFieldProvider, type IJsonSchemaNode, type ILogicalCondition, type IOption, type IRjsfConvertOptions, type IRjsfUiSchema, type IRule, type IRuleTraceEvent, type IRulesEngineProvider, type IRulesEngineState, type IRuntimeFieldState, type IRuntimeFormState, type ISetRulesAction, type ITimelineEvent, type IUpdateRulesAction, type IUseDraftPersistenceResult, type IValidationContext, type IValidationRule, type IValueFunctionContext, type IWizardConfig, type IWizardFormProps, type IWizardNavigationProps, type IWizardStep, type IWizardStepHeaderProps, InitOnCreateFormState, InitOnEditFormState, InjectedFieldProvider, IsExpandVisible, _default as RenderField, type RulesEngineAction, RulesEngineActionType, RulesEngineProvider, ShowField, SortOptions as SortDropdownOptions, SortOptions$1 as SortOptions, type SubEntityType, type TimelineEventType, type TypedFieldConfig, UseInjectedFieldContext, UseRulesEngineContext, type ValidatorFn, type ValueFunction, WizardForm, buildDefaultFieldStates, buildDependencyGraph, clearRuleTraceLog, clearTimeline, convertBooleanToYesOrNoText, createLazyFieldRegistry, createMaxLengthRule, createMinLengthRule, createNumericRangeRule, createOption, createPatternRule, createRequiredIfRule, deepCopy, defineFormConfig, deserializeFormState, detectDependencyCycles, detectSelfDependencies, disableRuleTracing, enableRuleTracing, evaluateAffectedFields, evaluateAllRules, evaluateCondition, evaluateExpression, executeValueFunction, extractConditionDependencies, extractExpressionDependencies, extractFunctionDependencies, flushRenderCycle, fromRjsfSchema, getCurrentLocale, getLastRenderedFields, getLocaleString, getRenderCounts, getRuleTraceLog, getStepFieldOrder, getStepFields, getStepIndex, getTimeline, getTotalFormRenders, getValidator, getValidatorRegistry, getValueFunction, getVisibleSteps, isEmpty, isFieldCondition, isLogicalCondition, isNull, isRuleTracingEnabled, isStepValid, isStringEmpty, logEvent, registerLocale, registerValidators, registerValueFunctions, resetLocale, resetRenderTracker, resetValidatorRegistry, resetValueFunctionRegistry, runSyncValidations, runValidations, serializeFormState, sortDropdownOptions, toRjsfSchema, topologicalSort, traceRuleEvent, trackRender, useBeforeUnload, useDraftPersistence, useFormAnalytics, validateDependencyGraph, validateFieldConfigs, validateStepFields, zodSchemaToFieldConfig };
|
|
1488
|
+
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal, type Dictionary, ExecuteComputedValue, FIELD_PARENT_PREFIX, FieldArray, FieldWrapper, FormConstants, FormDevTools, FormEngine, FormErrorBoundary, FormFields, FormStrings, GetChildEntity, GetComputedValuesOnCreate, GetComputedValuesOnDirtyFields, GetConfirmInputModalProps, GetFieldsToRender, type IAnalyticsCallbacks, type IClearRulesAction, type ICondition, type IConfigValidationError, type IConfirmInputModalProps, type ICoreLocaleStrings, type ICycleError, type IDraftPersistenceOptions, type IDraftState, type IEntityData, type IFieldArrayProps, type IFieldCondition, type IFieldConfig, type IFieldEffect, type IFieldProps, type IFieldToRender, type IFormAnalytics, type IFormConfig, type IFormDevToolsProps, type IFormEngineSharedProps, type IFormSettings, type IInjectedFieldProvider, type IJsonSchemaNode, type ILogicalCondition, type IOption, type IRjsfConvertOptions, type IRjsfUiSchema, type IRule, type IRuleTraceEvent, type IRulesEngineProvider, type IRulesEngineState, type IRuntimeFieldState, type IRuntimeFormState, type ISetRulesAction, type ITimelineEvent, type IUpdateRulesAction, type IUseDraftPersistenceResult, type IValidationContext, type IValidationRule, type IValidatorMetadata, type IValueFunctionContext, type IWizardConfig, type IWizardFormProps, type IWizardNavigationProps, type IWizardStep, type IWizardStepHeaderProps, InitOnCreateFormState, InitOnEditFormState, InjectedFieldProvider, IsExpandVisible, _default as RenderField, type RulesEngineAction, RulesEngineActionType, RulesEngineProvider, ShowField, SortOptions as SortDropdownOptions, SortOptions$1 as SortOptions, type SubEntityType, type TimelineEventType, type TypedFieldConfig, UseInjectedFieldContext, UseRulesEngineContext, type ValidatorFn, type ValueFunction, WizardForm, buildDefaultFieldStates, buildDependencyGraph, clearRuleTraceLog, clearTimeline, convertBooleanToYesOrNoText, createLazyFieldRegistry, createMaxLengthRule, createMinLengthRule, createNumericRangeRule, createOption, createPatternRule, createRequiredIfRule, deepCopy, defineFormConfig, deserializeFormState, detectDependencyCycles, detectSelfDependencies, disableRuleTracing, enableRuleTracing, evaluateAffectedFields, evaluateAllRules, evaluateCondition, evaluateExpression, executeValueFunction, extractConditionDependencies, extractExpressionDependencies, extractFunctionDependencies, flushRenderCycle, fromRjsfSchema, getAllValidatorMetadata, getCurrentLocale, getLastRenderedFields, getLocaleString, getRenderCounts, getRuleTraceLog, getStepFieldOrder, getStepFields, getStepIndex, getTimeline, getTotalFormRenders, getValidator, getValidatorMetadata, getValidatorRegistry, getValueFunction, getVisibleSteps, isEmpty, isFieldCondition, isLogicalCondition, isNull, isRuleTracingEnabled, isStepValid, isStringEmpty, logEvent, registerLocale, registerValidatorMetadata, registerValidators, registerValueFunctions, resetLocale, resetRenderTracker, resetValidatorMetadataRegistry, resetValidatorRegistry, resetValueFunctionRegistry, runSyncValidations, runValidations, serializeFormState, sortDropdownOptions, toRjsfSchema, topologicalSort, traceRuleEvent, trackRender, useBeforeUnload, useDraftPersistence, useFormAnalytics, validateDependencyGraph, validateFieldConfigs, validateStepFields, zodSchemaToFieldConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ interface IFieldCondition {
|
|
|
30
30
|
/** The field name to evaluate */
|
|
31
31
|
field: string;
|
|
32
32
|
/** Comparison operator */
|
|
33
|
-
operator: "equals" | "notEquals" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "contains" | "notContains" | "startsWith" | "endsWith" | "in" | "notIn" | "isEmpty" | "isNotEmpty" | "matches";
|
|
33
|
+
operator: "equals" | "notEquals" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "contains" | "notContains" | "startsWith" | "endsWith" | "in" | "notIn" | "isEmpty" | "isNotEmpty" | "matches" | "arrayContains" | "arrayNotContains" | "arrayLengthEquals" | "arrayLengthGreaterThan" | "arrayLengthLessThan";
|
|
34
34
|
/** The value to compare against. Not required for isEmpty/isNotEmpty. */
|
|
35
35
|
value?: unknown;
|
|
36
36
|
}
|
|
@@ -96,6 +96,8 @@ interface IFieldEffect {
|
|
|
96
96
|
computedValue?: string;
|
|
97
97
|
/** Override field ordering */
|
|
98
98
|
fieldOrder?: string[];
|
|
99
|
+
/** Directly set the field's value when the rule condition is met */
|
|
100
|
+
setValue?: unknown;
|
|
99
101
|
/** Apply effects to OTHER fields (keyed by field name) */
|
|
100
102
|
fields?: Record<string, IFieldEffect>;
|
|
101
103
|
}
|
|
@@ -263,9 +265,7 @@ interface IFormSettings {
|
|
|
263
265
|
}
|
|
264
266
|
|
|
265
267
|
/**
|
|
266
|
-
* Props passed to injected field components
|
|
267
|
-
*
|
|
268
|
-
* This replaces the v1 IHookFieldSharedProps type.
|
|
268
|
+
* Props passed to injected field components via React.cloneElement.
|
|
269
269
|
* The generic parameter T types the `config` metadata object.
|
|
270
270
|
*/
|
|
271
271
|
interface IFieldProps<T = Record<string, unknown>> {
|
|
@@ -315,9 +315,7 @@ interface IFieldProps<T = Record<string, unknown>> {
|
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* Runtime state for a single field after all rules have been evaluated.
|
|
318
|
-
*
|
|
319
|
-
* This replaces the v1 IBusinessRule type. Contains the evaluated state
|
|
320
|
-
* consumed by form components to determine rendering behavior.
|
|
318
|
+
* Consumed by form components to determine rendering behavior.
|
|
321
319
|
*/
|
|
322
320
|
interface IRuntimeFieldState {
|
|
323
321
|
/** UI component type to render. May be swapped by rules. */
|
|
@@ -348,11 +346,16 @@ interface IRuntimeFieldState {
|
|
|
348
346
|
dependsOnFields?: string[];
|
|
349
347
|
/** The source rules that produced this state (for tracing/debugging). */
|
|
350
348
|
activeRuleIds?: string[];
|
|
349
|
+
/**
|
|
350
|
+
* A pending value to set on the field, produced by a rule with setValue effect.
|
|
351
|
+
* The form component reads this and calls RHF setValue. Undefined if no rule set a value.
|
|
352
|
+
*/
|
|
353
|
+
pendingSetValue?: {
|
|
354
|
+
value: unknown;
|
|
355
|
+
};
|
|
351
356
|
}
|
|
352
357
|
/**
|
|
353
358
|
* Runtime state for the entire form.
|
|
354
|
-
*
|
|
355
|
-
* This replaces the v1 IConfigBusinessRules + IBusinessRulesState types.
|
|
356
359
|
*/
|
|
357
360
|
interface IRuntimeFormState {
|
|
358
361
|
/** Per-field runtime state keyed by field name. */
|
|
@@ -362,8 +365,6 @@ interface IRuntimeFormState {
|
|
|
362
365
|
}
|
|
363
366
|
/**
|
|
364
367
|
* State stored in the rules engine provider (keyed by config name).
|
|
365
|
-
*
|
|
366
|
-
* This replaces the v1 IBusinessRulesState type.
|
|
367
368
|
*/
|
|
368
369
|
interface IRulesEngineState {
|
|
369
370
|
configs: Record<string, IRuntimeFormState>;
|
|
@@ -605,6 +606,15 @@ declare const ComponentTypes: {
|
|
|
605
606
|
readonly ReadOnlyWithButton: "ReadOnlyWithButton";
|
|
606
607
|
readonly ChoiceSet: "ChoiceSet";
|
|
607
608
|
readonly FieldArray: "FieldArray";
|
|
609
|
+
readonly RadioGroup: "RadioGroup";
|
|
610
|
+
readonly CheckboxGroup: "CheckboxGroup";
|
|
611
|
+
readonly Rating: "Rating";
|
|
612
|
+
readonly ColorPicker: "ColorPicker";
|
|
613
|
+
readonly Autocomplete: "Autocomplete";
|
|
614
|
+
readonly FileUpload: "FileUpload";
|
|
615
|
+
readonly DateRange: "DateRange";
|
|
616
|
+
readonly DateTime: "DateTime";
|
|
617
|
+
readonly PhoneInput: "PhoneInput";
|
|
608
618
|
};
|
|
609
619
|
/** Form-level constants */
|
|
610
620
|
declare const FormConstants: {
|
|
@@ -804,6 +814,27 @@ interface IValidationContext {
|
|
|
804
814
|
values: IEntityData;
|
|
805
815
|
signal?: AbortSignal;
|
|
806
816
|
}
|
|
817
|
+
/** Metadata describing a validator for use in designer UIs and documentation. */
|
|
818
|
+
interface IValidatorMetadata {
|
|
819
|
+
/** Human-readable display name */
|
|
820
|
+
label: string;
|
|
821
|
+
/** Optional description of what the validator checks */
|
|
822
|
+
description?: string;
|
|
823
|
+
/** Named parameters the validator accepts */
|
|
824
|
+
params?: Record<string, {
|
|
825
|
+
type: "string" | "number" | "boolean";
|
|
826
|
+
label: string;
|
|
827
|
+
required?: boolean;
|
|
828
|
+
}>;
|
|
829
|
+
}
|
|
830
|
+
/** Register metadata for a custom (or built-in) validator */
|
|
831
|
+
declare function registerValidatorMetadata(name: string, metadata: IValidatorMetadata): void;
|
|
832
|
+
/** Get metadata for a specific validator by name */
|
|
833
|
+
declare function getValidatorMetadata(name: string): IValidatorMetadata | undefined;
|
|
834
|
+
/** Get all registered validator metadata */
|
|
835
|
+
declare function getAllValidatorMetadata(): Record<string, IValidatorMetadata>;
|
|
836
|
+
/** Reset validator metadata registry (for testing) */
|
|
837
|
+
declare function resetValidatorMetadataRegistry(): void;
|
|
807
838
|
/** Register custom validators (merge into registry) */
|
|
808
839
|
declare function registerValidators(custom: Record<string, ValidatorFn>): void;
|
|
809
840
|
/** Get a validator by name */
|
|
@@ -1454,4 +1485,4 @@ declare function getTimeline(): ITimelineEvent[];
|
|
|
1454
1485
|
*/
|
|
1455
1486
|
declare function clearTimeline(): void;
|
|
1456
1487
|
|
|
1457
|
-
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal, type Dictionary, ExecuteComputedValue, FIELD_PARENT_PREFIX, FieldArray, FieldWrapper, FormConstants, FormDevTools, FormEngine, FormErrorBoundary, FormFields, FormStrings, GetChildEntity, GetComputedValuesOnCreate, GetComputedValuesOnDirtyFields, GetConfirmInputModalProps, GetFieldsToRender, type IAnalyticsCallbacks, type IClearRulesAction, type ICondition, type IConfigValidationError, type IConfirmInputModalProps, type ICoreLocaleStrings, type ICycleError, type IDraftPersistenceOptions, type IDraftState, type IEntityData, type IFieldArrayProps, type IFieldCondition, type IFieldConfig, type IFieldEffect, type IFieldProps, type IFieldToRender, type IFormAnalytics, type IFormConfig, type IFormDevToolsProps, type IFormEngineSharedProps, type IFormSettings, type IInjectedFieldProvider, type IJsonSchemaNode, type ILogicalCondition, type IOption, type IRjsfConvertOptions, type IRjsfUiSchema, type IRule, type IRuleTraceEvent, type IRulesEngineProvider, type IRulesEngineState, type IRuntimeFieldState, type IRuntimeFormState, type ISetRulesAction, type ITimelineEvent, type IUpdateRulesAction, type IUseDraftPersistenceResult, type IValidationContext, type IValidationRule, type IValueFunctionContext, type IWizardConfig, type IWizardFormProps, type IWizardNavigationProps, type IWizardStep, type IWizardStepHeaderProps, InitOnCreateFormState, InitOnEditFormState, InjectedFieldProvider, IsExpandVisible, _default as RenderField, type RulesEngineAction, RulesEngineActionType, RulesEngineProvider, ShowField, SortOptions as SortDropdownOptions, SortOptions$1 as SortOptions, type SubEntityType, type TimelineEventType, type TypedFieldConfig, UseInjectedFieldContext, UseRulesEngineContext, type ValidatorFn, type ValueFunction, WizardForm, buildDefaultFieldStates, buildDependencyGraph, clearRuleTraceLog, clearTimeline, convertBooleanToYesOrNoText, createLazyFieldRegistry, createMaxLengthRule, createMinLengthRule, createNumericRangeRule, createOption, createPatternRule, createRequiredIfRule, deepCopy, defineFormConfig, deserializeFormState, detectDependencyCycles, detectSelfDependencies, disableRuleTracing, enableRuleTracing, evaluateAffectedFields, evaluateAllRules, evaluateCondition, evaluateExpression, executeValueFunction, extractConditionDependencies, extractExpressionDependencies, extractFunctionDependencies, flushRenderCycle, fromRjsfSchema, getCurrentLocale, getLastRenderedFields, getLocaleString, getRenderCounts, getRuleTraceLog, getStepFieldOrder, getStepFields, getStepIndex, getTimeline, getTotalFormRenders, getValidator, getValidatorRegistry, getValueFunction, getVisibleSteps, isEmpty, isFieldCondition, isLogicalCondition, isNull, isRuleTracingEnabled, isStepValid, isStringEmpty, logEvent, registerLocale, registerValidators, registerValueFunctions, resetLocale, resetRenderTracker, resetValidatorRegistry, resetValueFunctionRegistry, runSyncValidations, runValidations, serializeFormState, sortDropdownOptions, toRjsfSchema, topologicalSort, traceRuleEvent, trackRender, useBeforeUnload, useDraftPersistence, useFormAnalytics, validateDependencyGraph, validateFieldConfigs, validateStepFields, zodSchemaToFieldConfig };
|
|
1488
|
+
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal, type Dictionary, ExecuteComputedValue, FIELD_PARENT_PREFIX, FieldArray, FieldWrapper, FormConstants, FormDevTools, FormEngine, FormErrorBoundary, FormFields, FormStrings, GetChildEntity, GetComputedValuesOnCreate, GetComputedValuesOnDirtyFields, GetConfirmInputModalProps, GetFieldsToRender, type IAnalyticsCallbacks, type IClearRulesAction, type ICondition, type IConfigValidationError, type IConfirmInputModalProps, type ICoreLocaleStrings, type ICycleError, type IDraftPersistenceOptions, type IDraftState, type IEntityData, type IFieldArrayProps, type IFieldCondition, type IFieldConfig, type IFieldEffect, type IFieldProps, type IFieldToRender, type IFormAnalytics, type IFormConfig, type IFormDevToolsProps, type IFormEngineSharedProps, type IFormSettings, type IInjectedFieldProvider, type IJsonSchemaNode, type ILogicalCondition, type IOption, type IRjsfConvertOptions, type IRjsfUiSchema, type IRule, type IRuleTraceEvent, type IRulesEngineProvider, type IRulesEngineState, type IRuntimeFieldState, type IRuntimeFormState, type ISetRulesAction, type ITimelineEvent, type IUpdateRulesAction, type IUseDraftPersistenceResult, type IValidationContext, type IValidationRule, type IValidatorMetadata, type IValueFunctionContext, type IWizardConfig, type IWizardFormProps, type IWizardNavigationProps, type IWizardStep, type IWizardStepHeaderProps, InitOnCreateFormState, InitOnEditFormState, InjectedFieldProvider, IsExpandVisible, _default as RenderField, type RulesEngineAction, RulesEngineActionType, RulesEngineProvider, ShowField, SortOptions as SortDropdownOptions, SortOptions$1 as SortOptions, type SubEntityType, type TimelineEventType, type TypedFieldConfig, UseInjectedFieldContext, UseRulesEngineContext, type ValidatorFn, type ValueFunction, WizardForm, buildDefaultFieldStates, buildDependencyGraph, clearRuleTraceLog, clearTimeline, convertBooleanToYesOrNoText, createLazyFieldRegistry, createMaxLengthRule, createMinLengthRule, createNumericRangeRule, createOption, createPatternRule, createRequiredIfRule, deepCopy, defineFormConfig, deserializeFormState, detectDependencyCycles, detectSelfDependencies, disableRuleTracing, enableRuleTracing, evaluateAffectedFields, evaluateAllRules, evaluateCondition, evaluateExpression, executeValueFunction, extractConditionDependencies, extractExpressionDependencies, extractFunctionDependencies, flushRenderCycle, fromRjsfSchema, getAllValidatorMetadata, getCurrentLocale, getLastRenderedFields, getLocaleString, getRenderCounts, getRuleTraceLog, getStepFieldOrder, getStepFields, getStepIndex, getTimeline, getTotalFormRenders, getValidator, getValidatorMetadata, getValidatorRegistry, getValueFunction, getVisibleSteps, isEmpty, isFieldCondition, isLogicalCondition, isNull, isRuleTracingEnabled, isStepValid, isStringEmpty, logEvent, registerLocale, registerValidatorMetadata, registerValidators, registerValueFunctions, resetLocale, resetRenderTracker, resetValidatorMetadataRegistry, resetValidatorRegistry, resetValueFunctionRegistry, runSyncValidations, runValidations, serializeFormState, sortDropdownOptions, toRjsfSchema, topologicalSort, traceRuleEvent, trackRender, useBeforeUnload, useDraftPersistence, useFormAnalytics, validateDependencyGraph, validateFieldConfigs, validateStepFields, zodSchemaToFieldConfig };
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ __export(index_exports, {
|
|
|
93
93
|
extractFunctionDependencies: () => extractFunctionDependencies,
|
|
94
94
|
flushRenderCycle: () => flushRenderCycle,
|
|
95
95
|
fromRjsfSchema: () => fromRjsfSchema,
|
|
96
|
+
getAllValidatorMetadata: () => getAllValidatorMetadata,
|
|
96
97
|
getCurrentLocale: () => getCurrentLocale,
|
|
97
98
|
getLastRenderedFields: () => getLastRenderedFields,
|
|
98
99
|
getLocaleString: () => getLocaleString,
|
|
@@ -104,6 +105,7 @@ __export(index_exports, {
|
|
|
104
105
|
getTimeline: () => getTimeline,
|
|
105
106
|
getTotalFormRenders: () => getTotalFormRenders,
|
|
106
107
|
getValidator: () => getValidator,
|
|
108
|
+
getValidatorMetadata: () => getValidatorMetadata,
|
|
107
109
|
getValidatorRegistry: () => getValidatorRegistry,
|
|
108
110
|
getValueFunction: () => getValueFunction,
|
|
109
111
|
getVisibleSteps: () => getVisibleSteps,
|
|
@@ -116,10 +118,12 @@ __export(index_exports, {
|
|
|
116
118
|
isStringEmpty: () => isStringEmpty,
|
|
117
119
|
logEvent: () => logEvent,
|
|
118
120
|
registerLocale: () => registerLocale,
|
|
121
|
+
registerValidatorMetadata: () => registerValidatorMetadata,
|
|
119
122
|
registerValidators: () => registerValidators,
|
|
120
123
|
registerValueFunctions: () => registerValueFunctions,
|
|
121
124
|
resetLocale: () => resetLocale,
|
|
122
125
|
resetRenderTracker: () => resetRenderTracker,
|
|
126
|
+
resetValidatorMetadataRegistry: () => resetValidatorMetadataRegistry,
|
|
123
127
|
resetValidatorRegistry: () => resetValidatorRegistry,
|
|
124
128
|
resetValueFunctionRegistry: () => resetValueFunctionRegistry,
|
|
125
129
|
runSyncValidations: () => runSyncValidations,
|
|
@@ -218,7 +222,16 @@ var ComponentTypes = {
|
|
|
218
222
|
ReadOnlyRichText: "ReadOnlyRichText",
|
|
219
223
|
ReadOnlyWithButton: "ReadOnlyWithButton",
|
|
220
224
|
ChoiceSet: "ChoiceSet",
|
|
221
|
-
FieldArray: "FieldArray"
|
|
225
|
+
FieldArray: "FieldArray",
|
|
226
|
+
RadioGroup: "RadioGroup",
|
|
227
|
+
CheckboxGroup: "CheckboxGroup",
|
|
228
|
+
Rating: "Rating",
|
|
229
|
+
ColorPicker: "ColorPicker",
|
|
230
|
+
Autocomplete: "Autocomplete",
|
|
231
|
+
FileUpload: "FileUpload",
|
|
232
|
+
DateRange: "DateRange",
|
|
233
|
+
DateTime: "DateTime",
|
|
234
|
+
PhoneInput: "PhoneInput"
|
|
222
235
|
};
|
|
223
236
|
var FormConstants = {
|
|
224
237
|
defaultExpandCutoffCount: 12,
|
|
@@ -469,7 +482,7 @@ var FormStrings = {
|
|
|
469
482
|
}
|
|
470
483
|
};
|
|
471
484
|
|
|
472
|
-
// src/providers/
|
|
485
|
+
// src/providers/RulesEngineProvider.tsx
|
|
473
486
|
var import_react = __toESM(require("react"));
|
|
474
487
|
|
|
475
488
|
// src/helpers/ConditionEvaluator.ts
|
|
@@ -528,6 +541,16 @@ function evaluateFieldCondition(condition, values) {
|
|
|
528
541
|
} catch {
|
|
529
542
|
return false;
|
|
530
543
|
}
|
|
544
|
+
case "arrayContains":
|
|
545
|
+
return Array.isArray(fieldValue) ? fieldValue.some((v) => looseEquals(v, condition.value)) : false;
|
|
546
|
+
case "arrayNotContains":
|
|
547
|
+
return Array.isArray(fieldValue) ? !fieldValue.some((v) => looseEquals(v, condition.value)) : true;
|
|
548
|
+
case "arrayLengthEquals":
|
|
549
|
+
return Array.isArray(fieldValue) ? fieldValue.length === toNumber(condition.value) : false;
|
|
550
|
+
case "arrayLengthGreaterThan":
|
|
551
|
+
return Array.isArray(fieldValue) ? fieldValue.length > toNumber(condition.value) : false;
|
|
552
|
+
case "arrayLengthLessThan":
|
|
553
|
+
return Array.isArray(fieldValue) ? fieldValue.length < toNumber(condition.value) : false;
|
|
531
554
|
default:
|
|
532
555
|
return false;
|
|
533
556
|
}
|
|
@@ -837,6 +860,9 @@ function evaluateAllRules(fields, values, areAllFieldsReadonly) {
|
|
|
837
860
|
}
|
|
838
861
|
logEvent("rule_evaluated", fieldName, `${config.rules.length} rule(s) evaluated`);
|
|
839
862
|
applyEffectToState(fieldStates, fieldName, ruleResults.selfEffect);
|
|
863
|
+
if (ruleResults.pendingSetValue !== void 0 && fieldStates[fieldName]) {
|
|
864
|
+
fieldStates[fieldName].pendingSetValue = ruleResults.pendingSetValue;
|
|
865
|
+
}
|
|
840
866
|
for (const [targetField, effect] of Object.entries(ruleResults.crossEffects)) {
|
|
841
867
|
if (fieldStates[targetField]) {
|
|
842
868
|
applyEffectToState(fieldStates, targetField, effect);
|
|
@@ -872,7 +898,8 @@ function evaluateAffectedFields(changedField, fields, values, currentState) {
|
|
|
872
898
|
label: config.label,
|
|
873
899
|
defaultValue: config.defaultValue,
|
|
874
900
|
computeOnCreateOnly: config.computeOnCreateOnly,
|
|
875
|
-
activeRuleIds: []
|
|
901
|
+
activeRuleIds: [],
|
|
902
|
+
pendingSetValue: void 0
|
|
876
903
|
};
|
|
877
904
|
}
|
|
878
905
|
for (const [ownerField, config] of Object.entries(fields)) {
|
|
@@ -880,6 +907,9 @@ function evaluateAffectedFields(changedField, fields, values, currentState) {
|
|
|
880
907
|
const ruleResults = evaluateFieldRules(config.rules, values);
|
|
881
908
|
if (affected.has(ownerField) || ownerField === changedField) {
|
|
882
909
|
applyEffectToState(updatedStates, ownerField, ruleResults.selfEffect);
|
|
910
|
+
if (ruleResults.pendingSetValue !== void 0 && updatedStates[ownerField]) {
|
|
911
|
+
updatedStates[ownerField].pendingSetValue = ruleResults.pendingSetValue;
|
|
912
|
+
}
|
|
883
913
|
}
|
|
884
914
|
for (const [targetField, effect] of Object.entries(ruleResults.crossEffects)) {
|
|
885
915
|
if (affected.has(targetField) && updatedStates[targetField]) {
|
|
@@ -913,6 +943,7 @@ function evaluateFieldRules(rules, values) {
|
|
|
913
943
|
const crossEffects = {};
|
|
914
944
|
let fieldOrder;
|
|
915
945
|
const activeRuleIds = [];
|
|
946
|
+
let pendingSetValue;
|
|
916
947
|
for (let i = 0; i < sorted.length; i++) {
|
|
917
948
|
const rule = sorted[i];
|
|
918
949
|
const conditionMet = evaluateCondition(rule.when, values);
|
|
@@ -920,6 +951,9 @@ function evaluateFieldRules(rules, values) {
|
|
|
920
951
|
activeRuleIds.push(rule.id ?? `rule_${i}`);
|
|
921
952
|
}
|
|
922
953
|
const effect = conditionMet ? rule.then : rule.else;
|
|
954
|
+
if (conditionMet && rule.then?.setValue !== void 0 && pendingSetValue === void 0) {
|
|
955
|
+
pendingSetValue = { value: rule.then.setValue };
|
|
956
|
+
}
|
|
923
957
|
if (!effect) continue;
|
|
924
958
|
mergeEffect(selfEffect, effect);
|
|
925
959
|
if (effect.fields) {
|
|
@@ -934,7 +968,7 @@ function evaluateFieldRules(rules, values) {
|
|
|
934
968
|
fieldOrder = effect.fieldOrder;
|
|
935
969
|
}
|
|
936
970
|
}
|
|
937
|
-
return { selfEffect, crossEffects, fieldOrder, activeRuleIds };
|
|
971
|
+
return { selfEffect, crossEffects, fieldOrder, activeRuleIds, pendingSetValue };
|
|
938
972
|
}
|
|
939
973
|
function mergeEffect(target, source) {
|
|
940
974
|
if (source.required !== void 0 && target.required === void 0) {
|
|
@@ -978,7 +1012,7 @@ function applyEffectToState(states, fieldName, effect) {
|
|
|
978
1012
|
if (effect.computedValue !== void 0) state.computedValue = effect.computedValue;
|
|
979
1013
|
}
|
|
980
1014
|
|
|
981
|
-
// src/reducers/
|
|
1015
|
+
// src/reducers/RulesEngineReducer.ts
|
|
982
1016
|
var defaultRulesEngineState = {
|
|
983
1017
|
configs: {}
|
|
984
1018
|
};
|
|
@@ -1025,9 +1059,9 @@ var rulesEngineReducer = (state = defaultRulesEngineState, action) => {
|
|
|
1025
1059
|
return state;
|
|
1026
1060
|
}
|
|
1027
1061
|
};
|
|
1028
|
-
var
|
|
1062
|
+
var RulesEngineReducer_default = rulesEngineReducer;
|
|
1029
1063
|
|
|
1030
|
-
// src/providers/
|
|
1064
|
+
// src/providers/RulesEngineProvider.tsx
|
|
1031
1065
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1032
1066
|
var RulesEngineContext = import_react.default.createContext(
|
|
1033
1067
|
void 0
|
|
@@ -1042,7 +1076,7 @@ function UseRulesEngineContext() {
|
|
|
1042
1076
|
return context;
|
|
1043
1077
|
}
|
|
1044
1078
|
var RulesEngineProvider = (props) => {
|
|
1045
|
-
const [rulesState, dispatch] = import_react.default.useReducer(
|
|
1079
|
+
const [rulesState, dispatch] = import_react.default.useReducer(RulesEngineReducer_default, defaultRulesEngineState);
|
|
1046
1080
|
const rulesStateRef = import_react.default.useRef(rulesState);
|
|
1047
1081
|
import_react.default.useEffect(() => {
|
|
1048
1082
|
rulesStateRef.current = rulesState;
|
|
@@ -1081,7 +1115,7 @@ var RulesEngineProvider = (props) => {
|
|
|
1081
1115
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RulesEngineContext.Provider, { value: providerValue, children: props.children });
|
|
1082
1116
|
};
|
|
1083
1117
|
|
|
1084
|
-
// src/providers/
|
|
1118
|
+
// src/providers/InjectedFieldProvider.tsx
|
|
1085
1119
|
var import_react2 = __toESM(require("react"));
|
|
1086
1120
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1087
1121
|
var InjectedFieldContext = import_react2.default.createContext(
|
|
@@ -1225,6 +1259,19 @@ var requiredIf = (value, params, context) => {
|
|
|
1225
1259
|
}
|
|
1226
1260
|
return void 0;
|
|
1227
1261
|
};
|
|
1262
|
+
var validatorMetadataRegistry = {};
|
|
1263
|
+
function registerValidatorMetadata(name, metadata) {
|
|
1264
|
+
validatorMetadataRegistry = { ...validatorMetadataRegistry, [name]: metadata };
|
|
1265
|
+
}
|
|
1266
|
+
function getValidatorMetadata(name) {
|
|
1267
|
+
return validatorMetadataRegistry[name];
|
|
1268
|
+
}
|
|
1269
|
+
function getAllValidatorMetadata() {
|
|
1270
|
+
return { ...validatorMetadataRegistry };
|
|
1271
|
+
}
|
|
1272
|
+
function resetValidatorMetadataRegistry() {
|
|
1273
|
+
validatorMetadataRegistry = {};
|
|
1274
|
+
}
|
|
1228
1275
|
var defaultValidators = {
|
|
1229
1276
|
required,
|
|
1230
1277
|
email,
|
|
@@ -1524,7 +1571,7 @@ function validateDependencyGraph(fields) {
|
|
|
1524
1571
|
try {
|
|
1525
1572
|
if (typeof globalThis !== "undefined" && globalThis.__DEV__ !== false) {
|
|
1526
1573
|
for (const error of errors) {
|
|
1527
|
-
console.warn(`[
|
|
1574
|
+
console.warn(`[form-engine] ${error.message}`);
|
|
1528
1575
|
}
|
|
1529
1576
|
}
|
|
1530
1577
|
} catch {
|
|
@@ -1830,7 +1877,7 @@ var FieldWrapper = import_react6.default.memo((props) => {
|
|
|
1830
1877
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { id: labelId, htmlFor: id, className: "field-label", children: [
|
|
1831
1878
|
label,
|
|
1832
1879
|
required2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1833
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "required-indicator", "aria-hidden": "true", style: { color: "var(--
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "required-indicator", "aria-hidden": "true", style: { color: "var(--fe-required-color, #d13438)" }, children: " *" }),
|
|
1834
1881
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sr-only", style: { position: "absolute", width: "1px", height: "1px", padding: 0, margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", border: 0 }, children: " (required)" })
|
|
1835
1882
|
] })
|
|
1836
1883
|
] }),
|
|
@@ -1838,19 +1885,19 @@ var FieldWrapper = import_react6.default.memo((props) => {
|
|
|
1838
1885
|
!additionalInfoComponent && additionalInfo && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "additional-info", title: additionalInfo, children: "\u24D8" })
|
|
1839
1886
|
] });
|
|
1840
1887
|
const defaultErrorAndStatus = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "message", children: error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1841
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "error-icon", "aria-hidden": "true", style: { color: "var(--
|
|
1842
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "error-message", id: errorMessageId, role: "alert", style: { color: "var(--
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "error-icon", "aria-hidden": "true", style: { color: "var(--fe-error-color, #d13438)" }, children: "\u2716" }),
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "error-message", id: errorMessageId, role: "alert", style: { color: "var(--fe-error-color, #d13438)" }, children: error.message || "Error" })
|
|
1843
1890
|
] }) : savePending ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1844
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "warning-icon", "aria-hidden": "true", style: { color: "var(--
|
|
1845
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "warning-message", id: errorMessageId, role: "status", style: { color: "var(--
|
|
1891
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "warning-icon", "aria-hidden": "true", style: { color: "var(--fe-warning-color, #ffb900)" }, children: "\u26A0" }),
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "warning-message", id: errorMessageId, role: "status", style: { color: "var(--fe-warning-color, #ffb900)" }, children: [
|
|
1846
1893
|
!isManualSave ? FormStrings.autoSavePending : FormStrings.savePending,
|
|
1847
1894
|
" (",
|
|
1848
1895
|
`${errorCount} ${FormStrings.remaining}`,
|
|
1849
1896
|
")"
|
|
1850
1897
|
] })
|
|
1851
1898
|
] }) : saving ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1852
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "save-spinner", "aria-hidden": "true", style: { color: "var(--
|
|
1853
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "save-message", id: errorMessageId, role: "status", style: { color: "var(--
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "save-spinner", "aria-hidden": "true", style: { color: "var(--fe-saving-color, #0078d4)" }, children: "\u231B" }),
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "save-message", id: errorMessageId, role: "status", style: { color: "var(--fe-saving-color, #0078d4)" }, children: FormStrings.saving })
|
|
1854
1901
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, {}) });
|
|
1855
1902
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1856
1903
|
"div",
|
|
@@ -2169,7 +2216,7 @@ var ConfirmInputsModal = (props) => {
|
|
|
2169
2216
|
trigger();
|
|
2170
2217
|
setValue(`${fieldName}`, fieldValue, { shouldDirty: true });
|
|
2171
2218
|
};
|
|
2172
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "
|
|
2219
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fe-form-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fe-form-container", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("form", { className: "fe-form fe-modal", children: confirmInputFields?.map((confirmInputField) => {
|
|
2173
2220
|
const fieldState = rulesState.configs[configName]?.fieldStates[confirmInputField];
|
|
2174
2221
|
const fieldConfig = fields[confirmInputField];
|
|
2175
2222
|
if (!fieldState || !fieldConfig) return null;
|
|
@@ -2197,9 +2244,9 @@ var ConfirmInputsModal = (props) => {
|
|
|
2197
2244
|
if (renderDialog) {
|
|
2198
2245
|
return renderDialog({ isOpen: !!isOpen, onSave: saveConfirmInputFields, onCancel: cancelConfirmInputFields, children: content });
|
|
2199
2246
|
}
|
|
2200
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("dialog", { ref: dialogRef, className: "
|
|
2247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("dialog", { ref: dialogRef, className: "fe-modal", role: "dialog", "aria-modal": "true", "aria-label": FormStrings.confirm, onKeyDown: handleKeyDown, children: [
|
|
2201
2248
|
content,
|
|
2202
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "fe-modal-actions", children: [
|
|
2203
2250
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", ref: saveButtonRef, onClick: saveConfirmInputFields, children: FormStrings.save }),
|
|
2204
2251
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", onClick: cancelConfirmInputFields, children: FormStrings.cancel })
|
|
2205
2252
|
] })
|
|
@@ -2271,10 +2318,10 @@ var FormFields = (props) => {
|
|
|
2271
2318
|
const collapsedClass = !isExpanded && (expandEnabled || expandEnabled === void 0) ? "collapsed" : "";
|
|
2272
2319
|
const fieldsToRender = GetFieldsToRender(fieldRenderLimit ?? 0, fieldOrder ?? [], formState?.fieldStates);
|
|
2273
2320
|
const loadingKey = `${programName}-${entityType}-${entityId}-form-loaded`;
|
|
2274
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `
|
|
2321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `fe-form-container ${collapsedClass}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2275
2322
|
"form",
|
|
2276
2323
|
{
|
|
2277
|
-
className: `
|
|
2324
|
+
className: `fe-form ${collapsedClass} ${inPanel ? "in-panel" : ""}`,
|
|
2278
2325
|
style: collapsedClass && collapsedMaxHeight ? { maxHeight: `${collapsedMaxHeight}px` } : void 0,
|
|
2279
2326
|
"data-testid": `${programName}-${entityType}-${entityId}-form`,
|
|
2280
2327
|
children: [
|
|
@@ -2556,9 +2603,9 @@ var FormEngine = (props) => {
|
|
|
2556
2603
|
const cutoff = expandEnabled && !isExpanded ? effectiveExpandCutoff ?? FormConstants.defaultExpandCutoffCount : void 0;
|
|
2557
2604
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_hook_form4.FormProvider, { ...formMethods, formState: { ...formMethods.formState, isDirty, isValid, dirtyFields, errors, isSubmitting, isSubmitSuccessful }, children: [
|
|
2558
2605
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { role: "status", "aria-live": "polite", className: "sr-only", style: { position: "absolute", width: "1px", height: "1px", padding: 0, margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", border: 0 }, "data-testid": "form-status-live-region", children: statusMessage }),
|
|
2559
|
-
enableFilter && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "
|
|
2560
|
-
formErrors && formErrors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "form-errors", role: "alert", style: { color: "var(--
|
|
2561
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "
|
|
2606
|
+
enableFilter && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fe-filter", children: renderFilterInput ? renderFilterInput({ onChange: onFilterChange }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "text", placeholder: FormStrings.filterFields, "aria-label": FormStrings.filterFields, onChange: (e) => onFilterChange(e.target.value), className: "fe-filter-input" }) }),
|
|
2607
|
+
formErrors && formErrors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "form-errors", role: "alert", style: { color: "var(--fe-error-color, #d13438)", padding: "8px", marginBottom: "8px" }, children: formErrors.map((err, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "form-error-item", children: err }, i)) }),
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "fe-form-wrapper", children: [
|
|
2562
2609
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2563
2610
|
FormFields,
|
|
2564
2611
|
{
|
|
@@ -2585,7 +2632,7 @@ var FormEngine = (props) => {
|
|
|
2585
2632
|
}
|
|
2586
2633
|
),
|
|
2587
2634
|
expandEnabled && (renderExpandButton ? renderExpandButton({ isExpanded, onToggle: () => setIsExpanded(!isExpanded) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "expand-button", onClick: () => setIsExpanded(!isExpanded), "aria-expanded": isExpanded, "data-testid": `${programName}-${entityType}-${entityId}-expand-form`, children: isExpanded ? FormStrings.seeLess : FormStrings.expand })),
|
|
2588
|
-
effectiveManualSave && (renderSaveButton ? renderSaveButton({ onSave: manualSave, isDirty, isValid, isSubmitting }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "
|
|
2635
|
+
effectiveManualSave && (renderSaveButton ? renderSaveButton({ onSave: manualSave, isDirty, isValid, isSubmitting }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "fe-save-actions", style: { marginTop: "16px", display: "flex", gap: "8px" }, children: [
|
|
2589
2636
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "save-button", onClick: manualSave, disabled: !isDirty || isSubmitting, children: isCreate ? FormStrings.create : FormStrings.save }),
|
|
2590
2637
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "cancel-button", onClick: () => {
|
|
2591
2638
|
reset();
|
|
@@ -4313,6 +4360,7 @@ function isRuleTracingEnabled() {
|
|
|
4313
4360
|
extractFunctionDependencies,
|
|
4314
4361
|
flushRenderCycle,
|
|
4315
4362
|
fromRjsfSchema,
|
|
4363
|
+
getAllValidatorMetadata,
|
|
4316
4364
|
getCurrentLocale,
|
|
4317
4365
|
getLastRenderedFields,
|
|
4318
4366
|
getLocaleString,
|
|
@@ -4324,6 +4372,7 @@ function isRuleTracingEnabled() {
|
|
|
4324
4372
|
getTimeline,
|
|
4325
4373
|
getTotalFormRenders,
|
|
4326
4374
|
getValidator,
|
|
4375
|
+
getValidatorMetadata,
|
|
4327
4376
|
getValidatorRegistry,
|
|
4328
4377
|
getValueFunction,
|
|
4329
4378
|
getVisibleSteps,
|
|
@@ -4336,10 +4385,12 @@ function isRuleTracingEnabled() {
|
|
|
4336
4385
|
isStringEmpty,
|
|
4337
4386
|
logEvent,
|
|
4338
4387
|
registerLocale,
|
|
4388
|
+
registerValidatorMetadata,
|
|
4339
4389
|
registerValidators,
|
|
4340
4390
|
registerValueFunctions,
|
|
4341
4391
|
resetLocale,
|
|
4342
4392
|
resetRenderTracker,
|
|
4393
|
+
resetValidatorMetadataRegistry,
|
|
4343
4394
|
resetValidatorRegistry,
|
|
4344
4395
|
resetValueFunctionRegistry,
|
|
4345
4396
|
runSyncValidations,
|