@form-engine-ts/react 2.9.2 → 2.9.4
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 +5 -2
- package/dist/index.cjs +444 -351
- package/dist/index.d.cts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.js +445 -352
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -187,6 +187,10 @@ interface BuilderSelectProps extends InputComponentProps {
|
|
|
187
187
|
readonly options: readonly BuilderSelectOption[];
|
|
188
188
|
}
|
|
189
189
|
interface BuilderCheckboxProps extends ComponentBaseProps {
|
|
190
|
+
readonly name?: string;
|
|
191
|
+
readonly required?: boolean;
|
|
192
|
+
readonly error?: boolean;
|
|
193
|
+
readonly helperText?: string;
|
|
190
194
|
readonly checked: boolean;
|
|
191
195
|
readonly onChange: (checked: boolean) => void;
|
|
192
196
|
readonly label: string;
|
|
@@ -230,6 +234,7 @@ interface BuilderSlotBaseProps {
|
|
|
230
234
|
readonly readOnly: boolean;
|
|
231
235
|
readonly actions: FormBuilderActions;
|
|
232
236
|
readonly components: Required<FormBuilderComponents>;
|
|
237
|
+
readonly translate: (key: string, params?: Record<string, unknown>) => string;
|
|
233
238
|
}
|
|
234
239
|
interface BuilderToolbarSlotProps extends BuilderSlotBaseProps {
|
|
235
240
|
readonly kind: "page" | "field" | "option";
|
|
@@ -246,6 +251,11 @@ interface BuilderFieldEditorSlotProps extends BuilderSlotBaseProps {
|
|
|
246
251
|
readonly index: number;
|
|
247
252
|
readonly currentLocale: string;
|
|
248
253
|
readonly policy?: FormPolicy;
|
|
254
|
+
readonly features?: {
|
|
255
|
+
readonly pages?: boolean;
|
|
256
|
+
readonly localization?: boolean;
|
|
257
|
+
readonly conditions?: boolean;
|
|
258
|
+
};
|
|
249
259
|
}
|
|
250
260
|
interface BuilderOptionEditorSlotProps extends BuilderSlotBaseProps {
|
|
251
261
|
readonly field: FormField & {
|
|
@@ -257,6 +267,11 @@ interface BuilderOptionEditorSlotProps extends BuilderSlotBaseProps {
|
|
|
257
267
|
}
|
|
258
268
|
interface BuilderPagesSlotProps extends BuilderSlotBaseProps {
|
|
259
269
|
readonly currentLocale: string;
|
|
270
|
+
readonly features?: {
|
|
271
|
+
readonly pages?: boolean;
|
|
272
|
+
readonly localization?: boolean;
|
|
273
|
+
readonly conditions?: boolean;
|
|
274
|
+
};
|
|
260
275
|
}
|
|
261
276
|
interface BuilderLocalizationSlotProps extends BuilderSlotBaseProps {
|
|
262
277
|
readonly currentLocale: string;
|
|
@@ -264,6 +279,8 @@ interface BuilderLocalizationSlotProps extends BuilderSlotBaseProps {
|
|
|
264
279
|
readonly onAutoTranslate: () => void;
|
|
265
280
|
readonly isTranslating: boolean;
|
|
266
281
|
readonly translationError?: string;
|
|
282
|
+
readonly policy?: FormPolicy;
|
|
283
|
+
readonly translationAdapterAvailable?: boolean;
|
|
267
284
|
}
|
|
268
285
|
interface BuilderTranslationActionsSlotProps extends BuilderSlotBaseProps {
|
|
269
286
|
readonly currentLocale: string;
|
|
@@ -272,7 +289,9 @@ interface BuilderTranslationActionsSlotProps extends BuilderSlotBaseProps {
|
|
|
272
289
|
readonly translationError?: string;
|
|
273
290
|
readonly translationReport?: TranslationReport;
|
|
274
291
|
readonly onClearTranslationError?: () => void;
|
|
292
|
+
readonly translationAdapterAvailable?: boolean;
|
|
275
293
|
}
|
|
294
|
+
type FormBuilderSectionName = "basicSettings" | "completionMessage" | "questions" | "addQuestion" | "localization";
|
|
276
295
|
interface FormBuilderSlots {
|
|
277
296
|
readonly toolbar?: ComponentType<BuilderToolbarSlotProps>;
|
|
278
297
|
readonly fieldEditor?: ComponentType<BuilderFieldEditorSlotProps>;
|
|
@@ -280,6 +299,7 @@ interface FormBuilderSlots {
|
|
|
280
299
|
readonly pages?: ComponentType<BuilderPagesSlotProps>;
|
|
281
300
|
readonly localization?: ComponentType<BuilderLocalizationSlotProps>;
|
|
282
301
|
readonly translationActions?: ComponentType<BuilderTranslationActionsSlotProps>;
|
|
302
|
+
readonly sectionOrder?: readonly FormBuilderSectionName[];
|
|
283
303
|
}
|
|
284
304
|
interface BuilderActionContext {
|
|
285
305
|
readonly action: "addField" | "removeField" | "moveField" | "changeFieldType" | "updateField" | "addOption" | "removeOption" | "moveOption" | "updateOption" | "addPage" | "removePage" | "movePage" | "updatePage" | "assignFieldToPage" | "addLocale" | "setDefaultLocale" | "setDisplayCondition" | "setSourceText" | "setLocaleTranslation";
|
|
@@ -415,10 +435,11 @@ interface FormBuilderProps {
|
|
|
415
435
|
readonly features?: FormBuilderFeatures;
|
|
416
436
|
readonly components?: FormBuilderComponents;
|
|
417
437
|
readonly slots?: FormBuilderSlots;
|
|
438
|
+
readonly sectionOrder?: readonly FormBuilderSectionName[];
|
|
418
439
|
readonly disableDefaultStyles?: boolean;
|
|
419
440
|
readonly unstyled?: boolean;
|
|
420
441
|
}
|
|
421
|
-
declare function FormBuilder({ schema, onChange, locale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, components: componentOverrides, slots, disableDefaultStyles, unstyled }: FormBuilderProps): react.JSX.Element;
|
|
442
|
+
declare function FormBuilder({ schema, onChange, locale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, components: componentOverrides, slots, sectionOrder, disableDefaultStyles, unstyled }: FormBuilderProps): react.JSX.Element;
|
|
422
443
|
|
|
423
444
|
type SubmitStatus = "idle" | "submitting" | "success" | "error";
|
|
424
445
|
interface FormContextValue {
|
|
@@ -491,4 +512,4 @@ interface StandaloneFormRendererProps extends FormRendererPresentationProps {
|
|
|
491
512
|
type FormRendererProps = FormRendererPresentationProps | StandaloneFormRendererProps;
|
|
492
513
|
declare function FormRenderer(props: FormRendererProps): react.JSX.Element;
|
|
493
514
|
|
|
494
|
-
export { 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 BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type ComponentBaseProps, type FieldComponentProps, type FieldComponents, type FieldState, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSlots, type FormContextValue, FormProvider, type FormProviderProps, FormRenderer, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlots, type FormSubmitHandler, type FormSubmitState, type IconButtonProps, type InputComponentProps, type ManualTranslationContext, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitResponse, type SubmitResult, type SubmitStatus, type UseSubmissionReceiptsResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, resolveInitialFieldType, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useSubmissionReceipts };
|
|
515
|
+
export { 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 BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type ComponentBaseProps, type FieldComponentProps, type FieldComponents, type FieldState, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormContextValue, FormProvider, type FormProviderProps, FormRenderer, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlots, type FormSubmitHandler, type FormSubmitState, type IconButtonProps, type InputComponentProps, type ManualTranslationContext, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitResponse, type SubmitResult, type SubmitStatus, type UseSubmissionReceiptsResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, resolveInitialFieldType, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useSubmissionReceipts };
|
package/dist/index.d.ts
CHANGED
|
@@ -187,6 +187,10 @@ interface BuilderSelectProps extends InputComponentProps {
|
|
|
187
187
|
readonly options: readonly BuilderSelectOption[];
|
|
188
188
|
}
|
|
189
189
|
interface BuilderCheckboxProps extends ComponentBaseProps {
|
|
190
|
+
readonly name?: string;
|
|
191
|
+
readonly required?: boolean;
|
|
192
|
+
readonly error?: boolean;
|
|
193
|
+
readonly helperText?: string;
|
|
190
194
|
readonly checked: boolean;
|
|
191
195
|
readonly onChange: (checked: boolean) => void;
|
|
192
196
|
readonly label: string;
|
|
@@ -230,6 +234,7 @@ interface BuilderSlotBaseProps {
|
|
|
230
234
|
readonly readOnly: boolean;
|
|
231
235
|
readonly actions: FormBuilderActions;
|
|
232
236
|
readonly components: Required<FormBuilderComponents>;
|
|
237
|
+
readonly translate: (key: string, params?: Record<string, unknown>) => string;
|
|
233
238
|
}
|
|
234
239
|
interface BuilderToolbarSlotProps extends BuilderSlotBaseProps {
|
|
235
240
|
readonly kind: "page" | "field" | "option";
|
|
@@ -246,6 +251,11 @@ interface BuilderFieldEditorSlotProps extends BuilderSlotBaseProps {
|
|
|
246
251
|
readonly index: number;
|
|
247
252
|
readonly currentLocale: string;
|
|
248
253
|
readonly policy?: FormPolicy;
|
|
254
|
+
readonly features?: {
|
|
255
|
+
readonly pages?: boolean;
|
|
256
|
+
readonly localization?: boolean;
|
|
257
|
+
readonly conditions?: boolean;
|
|
258
|
+
};
|
|
249
259
|
}
|
|
250
260
|
interface BuilderOptionEditorSlotProps extends BuilderSlotBaseProps {
|
|
251
261
|
readonly field: FormField & {
|
|
@@ -257,6 +267,11 @@ interface BuilderOptionEditorSlotProps extends BuilderSlotBaseProps {
|
|
|
257
267
|
}
|
|
258
268
|
interface BuilderPagesSlotProps extends BuilderSlotBaseProps {
|
|
259
269
|
readonly currentLocale: string;
|
|
270
|
+
readonly features?: {
|
|
271
|
+
readonly pages?: boolean;
|
|
272
|
+
readonly localization?: boolean;
|
|
273
|
+
readonly conditions?: boolean;
|
|
274
|
+
};
|
|
260
275
|
}
|
|
261
276
|
interface BuilderLocalizationSlotProps extends BuilderSlotBaseProps {
|
|
262
277
|
readonly currentLocale: string;
|
|
@@ -264,6 +279,8 @@ interface BuilderLocalizationSlotProps extends BuilderSlotBaseProps {
|
|
|
264
279
|
readonly onAutoTranslate: () => void;
|
|
265
280
|
readonly isTranslating: boolean;
|
|
266
281
|
readonly translationError?: string;
|
|
282
|
+
readonly policy?: FormPolicy;
|
|
283
|
+
readonly translationAdapterAvailable?: boolean;
|
|
267
284
|
}
|
|
268
285
|
interface BuilderTranslationActionsSlotProps extends BuilderSlotBaseProps {
|
|
269
286
|
readonly currentLocale: string;
|
|
@@ -272,7 +289,9 @@ interface BuilderTranslationActionsSlotProps extends BuilderSlotBaseProps {
|
|
|
272
289
|
readonly translationError?: string;
|
|
273
290
|
readonly translationReport?: TranslationReport;
|
|
274
291
|
readonly onClearTranslationError?: () => void;
|
|
292
|
+
readonly translationAdapterAvailable?: boolean;
|
|
275
293
|
}
|
|
294
|
+
type FormBuilderSectionName = "basicSettings" | "completionMessage" | "questions" | "addQuestion" | "localization";
|
|
276
295
|
interface FormBuilderSlots {
|
|
277
296
|
readonly toolbar?: ComponentType<BuilderToolbarSlotProps>;
|
|
278
297
|
readonly fieldEditor?: ComponentType<BuilderFieldEditorSlotProps>;
|
|
@@ -280,6 +299,7 @@ interface FormBuilderSlots {
|
|
|
280
299
|
readonly pages?: ComponentType<BuilderPagesSlotProps>;
|
|
281
300
|
readonly localization?: ComponentType<BuilderLocalizationSlotProps>;
|
|
282
301
|
readonly translationActions?: ComponentType<BuilderTranslationActionsSlotProps>;
|
|
302
|
+
readonly sectionOrder?: readonly FormBuilderSectionName[];
|
|
283
303
|
}
|
|
284
304
|
interface BuilderActionContext {
|
|
285
305
|
readonly action: "addField" | "removeField" | "moveField" | "changeFieldType" | "updateField" | "addOption" | "removeOption" | "moveOption" | "updateOption" | "addPage" | "removePage" | "movePage" | "updatePage" | "assignFieldToPage" | "addLocale" | "setDefaultLocale" | "setDisplayCondition" | "setSourceText" | "setLocaleTranslation";
|
|
@@ -415,10 +435,11 @@ interface FormBuilderProps {
|
|
|
415
435
|
readonly features?: FormBuilderFeatures;
|
|
416
436
|
readonly components?: FormBuilderComponents;
|
|
417
437
|
readonly slots?: FormBuilderSlots;
|
|
438
|
+
readonly sectionOrder?: readonly FormBuilderSectionName[];
|
|
418
439
|
readonly disableDefaultStyles?: boolean;
|
|
419
440
|
readonly unstyled?: boolean;
|
|
420
441
|
}
|
|
421
|
-
declare function FormBuilder({ schema, onChange, locale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, components: componentOverrides, slots, disableDefaultStyles, unstyled }: FormBuilderProps): react.JSX.Element;
|
|
442
|
+
declare function FormBuilder({ schema, onChange, locale, translator, translationAdapter, translationOptions, onTranslationReport, policy, idFactory, factories, className, defaultFieldType, onActionError, createManualTranslationMetadata, readOnly, features, components: componentOverrides, slots, sectionOrder, disableDefaultStyles, unstyled }: FormBuilderProps): react.JSX.Element;
|
|
422
443
|
|
|
423
444
|
type SubmitStatus = "idle" | "submitting" | "success" | "error";
|
|
424
445
|
interface FormContextValue {
|
|
@@ -491,4 +512,4 @@ interface StandaloneFormRendererProps extends FormRendererPresentationProps {
|
|
|
491
512
|
type FormRendererProps = FormRendererPresentationProps | StandaloneFormRendererProps;
|
|
492
513
|
declare function FormRenderer(props: FormRendererProps): react.JSX.Element;
|
|
493
514
|
|
|
494
|
-
export { 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 BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type ComponentBaseProps, type FieldComponentProps, type FieldComponents, type FieldState, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSlots, type FormContextValue, FormProvider, type FormProviderProps, FormRenderer, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlots, type FormSubmitHandler, type FormSubmitState, type IconButtonProps, type InputComponentProps, type ManualTranslationContext, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitResponse, type SubmitResult, type SubmitStatus, type UseSubmissionReceiptsResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, resolveInitialFieldType, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useSubmissionReceipts };
|
|
515
|
+
export { 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 BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type ComponentBaseProps, type FieldComponentProps, type FieldComponents, type FieldState, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormContextValue, FormProvider, type FormProviderProps, FormRenderer, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlots, type FormSubmitHandler, type FormSubmitState, type IconButtonProps, type InputComponentProps, type ManualTranslationContext, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitResponse, type SubmitResult, type SubmitStatus, type UseSubmissionReceiptsResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, resolveInitialFieldType, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useSubmissionReceipts };
|