@form-engine-ts/react 4.7.0 → 5.0.0
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 +15 -2
- package/dist/index.cjs +560 -422
- package/dist/index.d.cts +62 -9
- package/dist/index.d.ts +62 -9
- package/dist/index.js +412 -275
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, TranslationSlot, FieldType } from '@form-engine-ts/core';
|
|
1
|
+
import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, TranslationSlot, FormEngineTranslator, FormEngineMessages, FieldType } from '@form-engine-ts/core';
|
|
2
2
|
export { QuestionType } from '@form-engine-ts/core';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode, ComponentType, KeyboardEvent, MouseEvent, CSSProperties } from 'react';
|
|
@@ -659,7 +659,7 @@ interface FormBuilderProps {
|
|
|
659
659
|
readonly onActiveFieldChange?: (fieldId: string | undefined) => void;
|
|
660
660
|
readonly submissionSettingsOptions?: FormBuilderSubmissionSettingsOptions;
|
|
661
661
|
}
|
|
662
|
-
declare function FormBuilder({ schema, onChange, locale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, fieldEditorControls, fieldTypeOptions, components: componentOverrides, slots, sectionOrder, disableDefaultStyles, unstyled, fieldEditorMode, activeFieldId, defaultActiveFieldId, onActiveFieldChange, submissionSettingsOptions }: FormBuilderProps): react.JSX.Element;
|
|
662
|
+
declare function FormBuilder({ schema, onChange, locale: explicitLocale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, fieldEditorControls, fieldTypeOptions, components: componentOverrides, slots, sectionOrder, disableDefaultStyles, unstyled, fieldEditorMode, activeFieldId, defaultActiveFieldId, onActiveFieldChange, submissionSettingsOptions }: FormBuilderProps): react.JSX.Element;
|
|
663
663
|
|
|
664
664
|
type SubmitStatus = "idle" | "submitting" | "success" | "error";
|
|
665
665
|
interface FormContextValue {
|
|
@@ -708,6 +708,9 @@ interface UseTranslationWorkspaceOptions {
|
|
|
708
708
|
readonly translationAdapter?: TranslationAdapter | AsyncTranslationAdapter;
|
|
709
709
|
readonly readOnly?: boolean;
|
|
710
710
|
readonly policy?: FormPolicy;
|
|
711
|
+
readonly beforeRemoveLocale?: (locale: string, context: {
|
|
712
|
+
readonly slotCount: number;
|
|
713
|
+
}) => Promise<boolean> | boolean;
|
|
711
714
|
readonly validateLocale?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator;
|
|
712
715
|
}
|
|
713
716
|
interface LocaleValidationContext {
|
|
@@ -732,6 +735,33 @@ interface TranslationSummary {
|
|
|
732
735
|
readonly manualCount: number;
|
|
733
736
|
readonly completionPercentage: number;
|
|
734
737
|
}
|
|
738
|
+
type TranslationWorkspaceError = {
|
|
739
|
+
readonly type: "locale_not_allowed";
|
|
740
|
+
readonly locale: string;
|
|
741
|
+
} | {
|
|
742
|
+
readonly type: "locale_already_exists";
|
|
743
|
+
readonly locale: string;
|
|
744
|
+
} | {
|
|
745
|
+
readonly type: "invalid_locale_format";
|
|
746
|
+
readonly locale: string;
|
|
747
|
+
} | {
|
|
748
|
+
readonly type: "max_locales_exceeded";
|
|
749
|
+
readonly max: number;
|
|
750
|
+
readonly current: number;
|
|
751
|
+
} | {
|
|
752
|
+
readonly type: "read_only_mode";
|
|
753
|
+
} | {
|
|
754
|
+
readonly type: "adapter_not_configured";
|
|
755
|
+
} | {
|
|
756
|
+
readonly type: "target_locale_missing";
|
|
757
|
+
} | {
|
|
758
|
+
readonly type: "translation_failed";
|
|
759
|
+
readonly message: string;
|
|
760
|
+
readonly cause?: unknown;
|
|
761
|
+
} | {
|
|
762
|
+
readonly type: "custom_validation_failed";
|
|
763
|
+
readonly message: string;
|
|
764
|
+
};
|
|
735
765
|
interface UseTranslationWorkspaceResult {
|
|
736
766
|
readonly sourceLocale: string;
|
|
737
767
|
readonly targetLocale: string;
|
|
@@ -741,18 +771,25 @@ interface UseTranslationWorkspaceResult {
|
|
|
741
771
|
readonly summary: TranslationSummary;
|
|
742
772
|
readonly addLocale: (locale: string) => {
|
|
743
773
|
readonly success: boolean;
|
|
744
|
-
readonly error?:
|
|
774
|
+
readonly error?: TranslationWorkspaceError;
|
|
745
775
|
};
|
|
746
776
|
readonly isAddLocaleAllowed: (locale: string) => boolean;
|
|
747
|
-
readonly removeLocale: (locale: string) =>
|
|
777
|
+
readonly removeLocale: (locale: string) => boolean | Promise<boolean>;
|
|
748
778
|
readonly setTranslation: (slot: TranslationSlot, text: string) => void;
|
|
749
|
-
readonly translateAll: (options?: PopulateTranslationOptions) => Promise<
|
|
750
|
-
|
|
779
|
+
readonly translateAll: (options?: PopulateTranslationOptions) => Promise<{
|
|
780
|
+
readonly success: boolean;
|
|
781
|
+
readonly report?: TranslationReport;
|
|
782
|
+
readonly error?: TranslationWorkspaceError;
|
|
783
|
+
}>;
|
|
784
|
+
readonly translateSlot: (slot: TranslationSlot) => Promise<{
|
|
785
|
+
readonly success: boolean;
|
|
786
|
+
readonly error?: TranslationWorkspaceError;
|
|
787
|
+
}>;
|
|
751
788
|
readonly isTranslating: boolean;
|
|
752
|
-
readonly error?:
|
|
789
|
+
readonly error?: TranslationWorkspaceError;
|
|
753
790
|
}
|
|
754
791
|
declare const validateLocalePipeline: (locale: string, schema: FormSchema, policy?: FormPolicy, customValidator?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator) => LocaleValidationResult;
|
|
755
|
-
declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
|
|
792
|
+
declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, beforeRemoveLocale, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
|
|
756
793
|
|
|
757
794
|
declare const BUILDER_TRANSLATION_KEYS: {
|
|
758
795
|
readonly ADD_FIELD: "builder.actions.addField";
|
|
@@ -773,6 +810,22 @@ declare const BUILDER_TRANSLATION_ALIASES: Readonly<Record<string, string>>;
|
|
|
773
810
|
declare function isTranslationUnresolved(result: unknown, key: string, aliases?: readonly string[]): boolean;
|
|
774
811
|
declare function resolveTranslation(key: string, aliases: readonly string[], adapter?: TranslationAdapter, defaultCatalog?: Readonly<Record<string, string>>, params?: Readonly<Record<string, unknown>>, locale?: string): string;
|
|
775
812
|
|
|
813
|
+
interface FormEngineI18nContextValue {
|
|
814
|
+
readonly uiLocale: string;
|
|
815
|
+
readonly translator: FormEngineTranslator;
|
|
816
|
+
}
|
|
817
|
+
declare const FormEngineI18nContext: react.Context<FormEngineI18nContextValue>;
|
|
818
|
+
interface FormEngineI18nProviderProps {
|
|
819
|
+
readonly locale?: string;
|
|
820
|
+
readonly fallbackLocale?: string;
|
|
821
|
+
readonly messages?: FormEngineMessages;
|
|
822
|
+
readonly customCatalogs?: Record<string, FormEngineMessages>;
|
|
823
|
+
readonly translator?: FormEngineTranslator;
|
|
824
|
+
readonly children: ReactNode;
|
|
825
|
+
}
|
|
826
|
+
declare function FormEngineI18nProvider({ locale, fallbackLocale, messages, customCatalogs, translator: customTranslator, children }: FormEngineI18nProviderProps): react.JSX.Element;
|
|
827
|
+
declare function useFormEngineI18n(): FormEngineI18nContextValue;
|
|
828
|
+
|
|
776
829
|
declare function resolveChoiceFieldLayout(type: FieldType, appearance?: FormRendererAppearance, groupedChoiceFieldsLegacy?: boolean): "default" | "grouped";
|
|
777
830
|
interface FieldComponentProps {
|
|
778
831
|
readonly field: FormField;
|
|
@@ -826,4 +879,4 @@ interface StandaloneFormRendererProps extends FormRendererPresentationProps {
|
|
|
826
879
|
type FormRendererProps = FormRendererPresentationProps | StandaloneFormRendererProps;
|
|
827
880
|
declare function FormRenderer(props: FormRendererProps): react.JSX.Element;
|
|
828
881
|
|
|
829
|
-
export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, FormSubmissionError, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationSummary, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useSubmissionReceipts, useTranslationWorkspace, validateLocalePipeline };
|
|
882
|
+
export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, FormEngineI18nContext, type FormEngineI18nContextValue, FormEngineI18nProvider, type FormEngineI18nProviderProps, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, FormSubmissionError, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationSummary, type TranslationWorkspaceError, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useFormEngineI18n, useSubmissionReceipts, useTranslationWorkspace, validateLocalePipeline };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, TranslationSlot, FieldType } from '@form-engine-ts/core';
|
|
1
|
+
import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, TranslationSlot, FormEngineTranslator, FormEngineMessages, FieldType } from '@form-engine-ts/core';
|
|
2
2
|
export { QuestionType } from '@form-engine-ts/core';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode, ComponentType, KeyboardEvent, MouseEvent, CSSProperties } from 'react';
|
|
@@ -659,7 +659,7 @@ interface FormBuilderProps {
|
|
|
659
659
|
readonly onActiveFieldChange?: (fieldId: string | undefined) => void;
|
|
660
660
|
readonly submissionSettingsOptions?: FormBuilderSubmissionSettingsOptions;
|
|
661
661
|
}
|
|
662
|
-
declare function FormBuilder({ schema, onChange, locale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, fieldEditorControls, fieldTypeOptions, components: componentOverrides, slots, sectionOrder, disableDefaultStyles, unstyled, fieldEditorMode, activeFieldId, defaultActiveFieldId, onActiveFieldChange, submissionSettingsOptions }: FormBuilderProps): react.JSX.Element;
|
|
662
|
+
declare function FormBuilder({ schema, onChange, locale: explicitLocale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, fieldEditorControls, fieldTypeOptions, components: componentOverrides, slots, sectionOrder, disableDefaultStyles, unstyled, fieldEditorMode, activeFieldId, defaultActiveFieldId, onActiveFieldChange, submissionSettingsOptions }: FormBuilderProps): react.JSX.Element;
|
|
663
663
|
|
|
664
664
|
type SubmitStatus = "idle" | "submitting" | "success" | "error";
|
|
665
665
|
interface FormContextValue {
|
|
@@ -708,6 +708,9 @@ interface UseTranslationWorkspaceOptions {
|
|
|
708
708
|
readonly translationAdapter?: TranslationAdapter | AsyncTranslationAdapter;
|
|
709
709
|
readonly readOnly?: boolean;
|
|
710
710
|
readonly policy?: FormPolicy;
|
|
711
|
+
readonly beforeRemoveLocale?: (locale: string, context: {
|
|
712
|
+
readonly slotCount: number;
|
|
713
|
+
}) => Promise<boolean> | boolean;
|
|
711
714
|
readonly validateLocale?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator;
|
|
712
715
|
}
|
|
713
716
|
interface LocaleValidationContext {
|
|
@@ -732,6 +735,33 @@ interface TranslationSummary {
|
|
|
732
735
|
readonly manualCount: number;
|
|
733
736
|
readonly completionPercentage: number;
|
|
734
737
|
}
|
|
738
|
+
type TranslationWorkspaceError = {
|
|
739
|
+
readonly type: "locale_not_allowed";
|
|
740
|
+
readonly locale: string;
|
|
741
|
+
} | {
|
|
742
|
+
readonly type: "locale_already_exists";
|
|
743
|
+
readonly locale: string;
|
|
744
|
+
} | {
|
|
745
|
+
readonly type: "invalid_locale_format";
|
|
746
|
+
readonly locale: string;
|
|
747
|
+
} | {
|
|
748
|
+
readonly type: "max_locales_exceeded";
|
|
749
|
+
readonly max: number;
|
|
750
|
+
readonly current: number;
|
|
751
|
+
} | {
|
|
752
|
+
readonly type: "read_only_mode";
|
|
753
|
+
} | {
|
|
754
|
+
readonly type: "adapter_not_configured";
|
|
755
|
+
} | {
|
|
756
|
+
readonly type: "target_locale_missing";
|
|
757
|
+
} | {
|
|
758
|
+
readonly type: "translation_failed";
|
|
759
|
+
readonly message: string;
|
|
760
|
+
readonly cause?: unknown;
|
|
761
|
+
} | {
|
|
762
|
+
readonly type: "custom_validation_failed";
|
|
763
|
+
readonly message: string;
|
|
764
|
+
};
|
|
735
765
|
interface UseTranslationWorkspaceResult {
|
|
736
766
|
readonly sourceLocale: string;
|
|
737
767
|
readonly targetLocale: string;
|
|
@@ -741,18 +771,25 @@ interface UseTranslationWorkspaceResult {
|
|
|
741
771
|
readonly summary: TranslationSummary;
|
|
742
772
|
readonly addLocale: (locale: string) => {
|
|
743
773
|
readonly success: boolean;
|
|
744
|
-
readonly error?:
|
|
774
|
+
readonly error?: TranslationWorkspaceError;
|
|
745
775
|
};
|
|
746
776
|
readonly isAddLocaleAllowed: (locale: string) => boolean;
|
|
747
|
-
readonly removeLocale: (locale: string) =>
|
|
777
|
+
readonly removeLocale: (locale: string) => boolean | Promise<boolean>;
|
|
748
778
|
readonly setTranslation: (slot: TranslationSlot, text: string) => void;
|
|
749
|
-
readonly translateAll: (options?: PopulateTranslationOptions) => Promise<
|
|
750
|
-
|
|
779
|
+
readonly translateAll: (options?: PopulateTranslationOptions) => Promise<{
|
|
780
|
+
readonly success: boolean;
|
|
781
|
+
readonly report?: TranslationReport;
|
|
782
|
+
readonly error?: TranslationWorkspaceError;
|
|
783
|
+
}>;
|
|
784
|
+
readonly translateSlot: (slot: TranslationSlot) => Promise<{
|
|
785
|
+
readonly success: boolean;
|
|
786
|
+
readonly error?: TranslationWorkspaceError;
|
|
787
|
+
}>;
|
|
751
788
|
readonly isTranslating: boolean;
|
|
752
|
-
readonly error?:
|
|
789
|
+
readonly error?: TranslationWorkspaceError;
|
|
753
790
|
}
|
|
754
791
|
declare const validateLocalePipeline: (locale: string, schema: FormSchema, policy?: FormPolicy, customValidator?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator) => LocaleValidationResult;
|
|
755
|
-
declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
|
|
792
|
+
declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, beforeRemoveLocale, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
|
|
756
793
|
|
|
757
794
|
declare const BUILDER_TRANSLATION_KEYS: {
|
|
758
795
|
readonly ADD_FIELD: "builder.actions.addField";
|
|
@@ -773,6 +810,22 @@ declare const BUILDER_TRANSLATION_ALIASES: Readonly<Record<string, string>>;
|
|
|
773
810
|
declare function isTranslationUnresolved(result: unknown, key: string, aliases?: readonly string[]): boolean;
|
|
774
811
|
declare function resolveTranslation(key: string, aliases: readonly string[], adapter?: TranslationAdapter, defaultCatalog?: Readonly<Record<string, string>>, params?: Readonly<Record<string, unknown>>, locale?: string): string;
|
|
775
812
|
|
|
813
|
+
interface FormEngineI18nContextValue {
|
|
814
|
+
readonly uiLocale: string;
|
|
815
|
+
readonly translator: FormEngineTranslator;
|
|
816
|
+
}
|
|
817
|
+
declare const FormEngineI18nContext: react.Context<FormEngineI18nContextValue>;
|
|
818
|
+
interface FormEngineI18nProviderProps {
|
|
819
|
+
readonly locale?: string;
|
|
820
|
+
readonly fallbackLocale?: string;
|
|
821
|
+
readonly messages?: FormEngineMessages;
|
|
822
|
+
readonly customCatalogs?: Record<string, FormEngineMessages>;
|
|
823
|
+
readonly translator?: FormEngineTranslator;
|
|
824
|
+
readonly children: ReactNode;
|
|
825
|
+
}
|
|
826
|
+
declare function FormEngineI18nProvider({ locale, fallbackLocale, messages, customCatalogs, translator: customTranslator, children }: FormEngineI18nProviderProps): react.JSX.Element;
|
|
827
|
+
declare function useFormEngineI18n(): FormEngineI18nContextValue;
|
|
828
|
+
|
|
776
829
|
declare function resolveChoiceFieldLayout(type: FieldType, appearance?: FormRendererAppearance, groupedChoiceFieldsLegacy?: boolean): "default" | "grouped";
|
|
777
830
|
interface FieldComponentProps {
|
|
778
831
|
readonly field: FormField;
|
|
@@ -826,4 +879,4 @@ interface StandaloneFormRendererProps extends FormRendererPresentationProps {
|
|
|
826
879
|
type FormRendererProps = FormRendererPresentationProps | StandaloneFormRendererProps;
|
|
827
880
|
declare function FormRenderer(props: FormRendererProps): react.JSX.Element;
|
|
828
881
|
|
|
829
|
-
export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, FormSubmissionError, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationSummary, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useSubmissionReceipts, useTranslationWorkspace, validateLocalePipeline };
|
|
882
|
+
export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, FormEngineI18nContext, type FormEngineI18nContextValue, FormEngineI18nProvider, type FormEngineI18nProviderProps, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, FormSubmissionError, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationSummary, type TranslationWorkspaceError, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useFormEngineI18n, useSubmissionReceipts, useTranslationWorkspace, validateLocalePipeline };
|