@digiform/builder 0.1.7 → 0.2.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/FormBuilder.d.ts +24 -0
- package/client.cjs +1 -1
- package/client.d.ts +18 -0
- package/client.js +1 -1
- package/component-registry/components/alert.d.ts +4 -0
- package/component-registry/components/button.d.ts +4 -0
- package/component-registry/components/checkbox.d.ts +9 -0
- package/component-registry/components/code-input/code-input.d.ts +4 -0
- package/component-registry/components/dropdown.d.ts +1 -0
- package/component-registry/components/heading.d.ts +4 -0
- package/component-registry/components/index.d.ts +35 -0
- package/component-registry/components/paragraph.d.ts +4 -0
- package/component-registry/components/progress-loader.d.ts +4 -0
- package/component-registry/components/radioGroup.d.ts +1 -0
- package/component-registry/components/text.d.ts +2 -0
- package/component-registry/components/textarea.d.ts +2 -0
- package/component-registry/createFormFieldComponent.d.ts +52 -0
- package/component-registry/index.d.ts +3 -0
- package/component-registry/types.d.ts +42 -0
- package/component-registry/utils.d.ts +33 -0
- package/component-registry/validation.d.ts +141 -0
- package/component-registry/validationBridge.d.ts +10 -0
- package/components/ConnectionErrorScreen/ConnectionErrorScreen.d.ts +10 -0
- package/components/DatabaseStatusIndicator/DatabaseStatusIndicator.d.ts +24 -0
- package/config/SecureConfigLoader.d.ts +57 -0
- package/config/hooks.d.ts +2 -0
- package/config/index.d.ts +5 -0
- package/config/types.d.ts +94 -0
- package/{configReader-BkMPr3Ju.js → configReader-C49NagAF.js} +4936 -4988
- package/configReader-C49NagAF.js.map +1 -0
- package/{configReader-CbGTKRUP.cjs → configReader-CT1_bYSZ.cjs} +7 -7
- package/configReader-CT1_bYSZ.cjs.map +1 -0
- package/design-system/components/ComponentSourceBadge/ComponentSourceBadge.d.ts +15 -0
- package/design-system/components/FormFieldWrapper/FormFieldWrapper.d.ts +18 -0
- package/design-system/custom/config/date-preset.config.d.ts +7 -0
- package/design-system/custom/config/email-preset.config.d.ts +7 -0
- package/design-system/custom/config/index.d.ts +10 -0
- package/design-system/custom/config/number-preset.config.d.ts +7 -0
- package/design-system/custom/config/tel-preset.config.d.ts +7 -0
- package/design-system/custom/index.d.ts +17 -0
- package/design-system/custom/utils/create-preset-config.d.ts +74 -0
- package/design-system/generated/rhc-catalog.generated.d.ts +9360 -0
- package/design-system/index.d.ts +15 -0
- package/design-system/rhc/components.d.ts +12 -0
- package/design-system/rhc/config/alert.config.d.ts +5 -0
- package/design-system/rhc/config/button.config.d.ts +8 -0
- package/design-system/rhc/config/checkbox.config.d.ts +4 -0
- package/design-system/rhc/config/form-builder.config.d.ts +74 -0
- package/design-system/rhc/config/heading.config.d.ts +5 -0
- package/design-system/rhc/config/index.d.ts +9 -0
- package/design-system/rhc/config/paragraph.config.d.ts +8 -0
- package/design-system/rhc/config/radio-group.config.d.ts +5 -0
- package/design-system/rhc/config/select.config.d.ts +5 -0
- package/design-system/rhc/config/text-input.config.d.ts +5 -0
- package/design-system/rhc/config/textarea.config.d.ts +4 -0
- package/design-system/rhc/index.d.ts +1 -0
- package/design-system/rhc/utils/create-config.d.ts +76 -0
- package/design-system/rhc/utils/generate-schema.d.ts +20 -0
- package/design-system/types.d.ts +22 -0
- package/error-boundaries/BaseErrorBoundary/BaseErrorBoundary.d.ts +31 -0
- package/error-boundaries/ComponentErrorBoundary/ComponentErrorBoundary.d.ts +9 -0
- package/error-boundaries/ErrorBoundaryTest/ErrorBoundaryTest.d.ts +2 -0
- package/error-boundaries/FlowBuilderErrorBoundary/FlowBuilderErrorBoundary.d.ts +7 -0
- package/error-boundaries/index.d.ts +1 -0
- package/features/condition-editor/components/ConditionEditor/ConditionEditor.d.ts +17 -0
- package/features/condition-editor/components/ConditionItem/ConditionItem.d.ts +17 -0
- package/features/condition-editor/components/ConditionOperatorSelect/ConditionOperatorSelect.d.ts +8 -0
- package/features/condition-editor/components/ConditionRow/ConditionRow.d.ts +14 -0
- package/features/condition-editor/components/ConditionSummary/ConditionSummary.d.ts +7 -0
- package/features/condition-editor/components/ConditionTargetSelect/ConditionTargetSelect.d.ts +14 -0
- package/features/condition-editor/components/ConditionValueInput/ConditionValueInput.d.ts +10 -0
- package/features/condition-editor/components/EditConditionForm/EditConditionForm.d.ts +13 -0
- package/features/condition-editor/components/ExistingCondition/ExistingCondition.d.ts +13 -0
- package/features/condition-editor/components/LogicalConnector/LogicalConnector.d.ts +8 -0
- package/features/condition-editor/components/LogicalOperatorToggle/LogicalOperatorToggle.d.ts +13 -0
- package/features/condition-editor/components/NewConditionBuilder/NewConditionBuilder.d.ts +10 -0
- package/features/condition-editor/components/NewConditionRow/NewConditionRow.d.ts +15 -0
- package/features/condition-editor/components/VisibilityConditionBuilder/VisibilityConditionBuilder.d.ts +17 -0
- package/features/condition-editor/components/hooks/useTargetComponents.d.ts +6 -0
- package/features/condition-editor/components/utils/conditionUtils.d.ts +7 -0
- package/features/condition-editor/components/visibilityHelpers.d.ts +21 -0
- package/features/condition-editor/index.d.ts +17 -0
- package/features/dialog-system/components/ConfirmDialog.d.ts +12 -0
- package/features/dialog-system/components/DialogEditor/DialogEditor.d.ts +12 -0
- package/features/dialog-system/components/ModalDialog/ModalDialog.d.ts +12 -0
- package/features/dialog-system/components/VerifyEmailDialog/VerifyEmailDialog.d.ts +10 -0
- package/features/dialog-system/index.d.ts +4 -0
- package/features/form-builder/components/actions/ActionsPanel/ActionsPanel.d.ts +3 -0
- package/features/form-builder/components/actions/SortableActionItem/SortableActionItem.d.ts +9 -0
- package/features/form-builder/components/actions/index.d.ts +4 -0
- package/features/form-builder/components/actions-menu/FormBuilderActionsMenu/FormBuilderActionsMenu.d.ts +1 -0
- package/features/form-builder/components/actions-menu/index.d.ts +3 -0
- package/features/form-builder/components/actions-menu/items/CreateTemplateMenuItem/CreateTemplateMenuItem.d.ts +2 -0
- package/features/form-builder/components/actions-menu/items/ExampleMenuItem/ExampleMenuItem.d.ts +2 -0
- package/features/form-builder/components/actions-menu/items/index.d.ts +2 -0
- package/features/form-builder/components/actions-menu/registry.d.ts +9 -0
- package/features/form-builder/components/actions-menu/types.d.ts +44 -0
- package/features/form-builder/components/buttons/PreviewButton/PreviewButton.d.ts +74 -0
- package/features/form-builder/components/buttons/SaveDropdownButton/SaveDropdownButton.d.ts +8 -0
- package/features/form-builder/components/buttons/index.d.ts +6 -0
- package/features/form-builder/components/canvas/AdminRenderCanvasItems/AdminRenderCanvasItems.d.ts +15 -0
- package/features/form-builder/components/canvas/Canvas/Canvas.d.ts +3 -0
- package/features/form-builder/components/canvas/CanvasComponent/CanvasComponent.d.ts +16 -0
- package/features/form-builder/components/canvas/SortableComponent/SortableComponent.d.ts +13 -0
- package/features/form-builder/components/canvas/index.d.ts +8 -0
- package/features/form-builder/components/components-panel/FormWizardComponentItem/FormWizardComponentItem.d.ts +7 -0
- package/features/form-builder/components/components-panel/FormWizardComponentsPanel/FormWizardComponentsPanel.d.ts +6 -0
- package/features/form-builder/components/components-panel/SortableComponentItem/SortableComponentItem.d.ts +20 -0
- package/features/form-builder/components/components-panel/index.d.ts +6 -0
- package/features/form-builder/components/core/AdminFormContent/AdminFormContent.d.ts +5 -0
- package/features/form-builder/components/core/FormBuilder/FormBuilder.d.ts +23 -0
- package/features/form-builder/components/core/index.d.ts +4 -0
- package/features/form-builder/components/editors/AdminPropertiesPanel/AdminPropertiesPanel.d.ts +3 -0
- package/features/form-builder/components/editors/ConditionsTab/ConditionsTab.d.ts +10 -0
- package/features/form-builder/components/editors/NavigationEditor/NavigationEditor.d.ts +13 -0
- package/features/form-builder/components/editors/NavigationSettings/NavigationSettings.d.ts +2 -0
- package/features/form-builder/components/editors/SectionConfigEditor/SectionConfigEditor.d.ts +8 -0
- package/features/form-builder/components/editors/index.d.ts +10 -0
- package/features/form-builder/components/fields/FieldValueButton/FieldValueButton.d.ts +7 -0
- package/features/form-builder/components/fields/FormFieldSelector/FormFieldSelector.d.ts +19 -0
- package/features/form-builder/components/fields/index.d.ts +4 -0
- package/features/form-builder/components/index.d.ts +13 -0
- package/features/form-builder/components/layout/FormFooter.d.ts +11 -0
- package/features/form-builder/components/layout/FormFooterBase.d.ts +15 -0
- package/features/form-builder/components/layout/FormHeader/FormHeader.d.ts +35 -0
- package/features/form-builder/components/layout/index.d.ts +6 -0
- package/features/form-builder/components/panels/RightPanel/RightPanel.d.ts +1 -0
- package/features/form-builder/components/panels/index.d.ts +1 -0
- package/features/form-builder/components/sections/AdminFormSection/AdminFormSection.d.ts +14 -0
- package/features/form-builder/components/sections/SectionContainer/SectionContainer.d.ts +13 -0
- package/features/form-builder/components/sections/index.d.ts +4 -0
- package/features/form-builder/components/steps/AdminStepSettings/AdminStepSettings.d.ts +7 -0
- package/features/form-builder/components/steps/SortableStepItem/SortableStepItem.d.ts +18 -0
- package/features/form-builder/components/steps/StepLockIndicator/StepLockIndicator.d.ts +18 -0
- package/features/form-builder/components/steps/StepsList/StepsList.d.ts +3 -0
- package/features/form-builder/components/steps/index.d.ts +8 -0
- package/features/form-builder/context/FormBuilderContext.d.ts +30 -0
- package/features/form-builder/context/ResolvedStepContext.d.ts +9 -0
- package/features/form-builder/hooks/useCurrentStep.d.ts +18 -0
- package/features/form-builder/hooks/useDragAndDrop.d.ts +16 -0
- package/features/form-builder/hooks/useDragFeedback.d.ts +32 -0
- package/features/form-builder/hooks/useHoldToDrag.d.ts +18 -0
- package/features/form-builder/hooks/usePreviewConfig.d.ts +23 -0
- package/features/form-builder/hooks/useSectionOperations.d.ts +7 -0
- package/features/form-builder/index.d.ts +10 -0
- package/features/form-builder/providers/DragAndDropProvider/DragAndDropProvider.d.ts +8 -0
- package/features/form-builder/utils/PropertyLockIndicator/PropertyLockIndicator.d.ts +30 -0
- package/features/form-builder/utils/bodyConversionUtils.d.ts +35 -0
- package/features/form-builder/utils/collisionDetection.d.ts +6 -0
- package/features/form-management/components/FormBuilderView/FormBuilderView.d.ts +17 -0
- package/features/form-management/components/FormExplorer/FormExplorer.d.ts +38 -0
- package/features/form-management/components/FormExplorerCore/FormExplorerCore.d.ts +67 -0
- package/features/form-management/components/FormManager/FormManager.d.ts +43 -0
- package/features/form-management/components/FormSectionList/FormSectionList.d.ts +1 -0
- package/features/form-management/components/FormsView/FormsView.d.ts +40 -0
- package/features/form-management/components/NewFormDialog/NewFormDialog.d.ts +25 -0
- package/features/form-management/components/NewProjectDialog/NewProjectDialog.d.ts +23 -0
- package/features/form-management/components/ProjectCard/ProjectCard.d.ts +9 -0
- package/features/form-management/components/ProjectsView/ProjectsView.d.ts +20 -0
- package/features/form-management/components/SearchInput/SearchInput.d.ts +9 -0
- package/features/form-management/components/ViewCard/ViewCard.d.ts +40 -0
- package/features/form-management/components/pages/FormBuilderPage.d.ts +3 -0
- package/features/form-management/components/pages/FormsPage.d.ts +3 -0
- package/features/form-management/components/pages/ProjectsPage.d.ts +16 -0
- package/features/form-management/components/pages/index.d.ts +13 -0
- package/features/form-management/hooks/index.d.ts +9 -0
- package/features/form-management/hooks/useFormActions.d.ts +20 -0
- package/features/form-management/hooks/useFormData.d.ts +13 -0
- package/features/form-management/hooks/useFormExplorerState.d.ts +26 -0
- package/features/form-management/hooks/useFormOperations.d.ts +17 -0
- package/features/form-management/hooks/useFormsQuery.d.ts +50 -0
- package/features/form-management/hooks/useProjectActions.d.ts +25 -0
- package/features/form-management/hooks/useProjectOperations.d.ts +10 -0
- package/features/form-management/hooks/useProjectsData.d.ts +13 -0
- package/features/form-management/index.d.ts +29 -0
- package/features/form-management/layout/BaseHeader/BaseHeader.d.ts +1 -0
- package/features/form-management/layout/BaseLayout/BaseLayout.d.ts +25 -0
- package/features/form-management/providers/QueryProvider.d.ts +8 -0
- package/features/form-management/types/viewTypes.d.ts +53 -0
- package/features/form-management/utils/configInitializer.d.ts +4 -0
- package/features/index.d.ts +9 -0
- package/features/property-editors/components/ComponentValidationEditor/ComponentValidationEditor.d.ts +12 -0
- package/features/property-editors/components/GenericPropertyEditor/GenericPropertyEditor.d.ts +13 -0
- package/features/property-editors/components/ProgressLoaderEditor/ProgressLoaderEditor.d.ts +12 -0
- package/features/property-editors/components/RadioGroupEditor/RadioGroupEditor.d.ts +3 -0
- package/features/property-editors/components/SelectEditor/SelectEditor.d.ts +3 -0
- package/features/property-editors/components/ValidationRuleEditor/ValidationRuleEditor.d.ts +23 -0
- package/features/property-editors/components/ValidationRuleListItem/ValidationRuleListItem.d.ts +9 -0
- package/features/property-editors/components/ValidationRuleSheet/ValidationRuleSheet.d.ts +14 -0
- package/features/property-editors/index.d.ts +5 -0
- package/features/property-editors/types/schema.d.ts +66 -0
- package/features/property-editors/types/types.d.ts +23 -0
- package/features/template-system/components/CreateTemplateDialog/CreateTemplateDialog.d.ts +17 -0
- package/features/template-system/components/DeleteTemplateDialog/DeleteTemplateDialog.d.ts +11 -0
- package/features/template-system/components/DuplicateTemplateDialog/DuplicateTemplateDialog.d.ts +11 -0
- package/features/template-system/components/EditTemplateDialog/EditTemplateDialog.d.ts +10 -0
- package/features/template-system/components/EnhancedTemplateBrowser/EnhancedTemplateBrowser.d.ts +11 -0
- package/features/template-system/components/TemplateContextMenu/TemplateContextMenu.d.ts +12 -0
- package/features/template-system/hooks/useTemplateGovernance.d.ts +46 -0
- package/features/template-system/hooks/useTemplatePermissions.d.ts +104 -0
- package/features/template-system/hooks/useTemplateStepTitle.d.ts +5 -0
- package/features/template-system/index.d.ts +17 -0
- package/features/template-system/services/TemplateStorageService.d.ts +52 -0
- package/features/template-system/utils/templateApplication.d.ts +75 -0
- package/features/template-system/utils/templateCategories.d.ts +105 -0
- package/features/template-system/utils/templateConfig.d.ts +148 -0
- package/features/template-system/utils/templateDeletion.d.ts +44 -0
- package/features/template-system/utils/templateDuplication.d.ts +65 -0
- package/features/template-system/utils/templateGovernance.d.ts +54 -0
- package/features/template-system/utils/templateLoader.d.ts +25 -0
- package/features/template-system/utils/templateMetadataOperations.d.ts +40 -0
- package/features/template-system/utils/templateUtils.d.ts +12 -0
- package/features/trigger-action-system/components/ActionConfigurationSheet/ActionConfigurationSheet.d.ts +9 -0
- package/features/trigger-action-system/components/ActionEditor/ActionEditor.d.ts +15 -0
- package/features/trigger-action-system/components/ActionsList/ActionsList.d.ts +8 -0
- package/features/trigger-action-system/components/ComponentTriggerActionEditor/ComponentTriggerActionEditor.d.ts +8 -0
- package/features/trigger-action-system/components/TriggerContextSelector/TriggerContextSelector.d.ts +9 -0
- package/features/trigger-action-system/index.d.ts +5 -0
- package/features/visual-mapping/components/ApiCallEditor/ApiCallEditor.d.ts +15 -0
- package/features/visual-mapping/components/ApiResponsePreview/ApiResponsePreview.d.ts +8 -0
- package/features/visual-mapping/components/ApiStructureTree/ApiStructureTree.d.ts +10 -0
- package/features/visual-mapping/components/CompactApiTestButton/CompactApiTestButton.d.ts +11 -0
- package/features/visual-mapping/components/ConnectionCircle/ConnectionCircle.d.ts +8 -0
- package/features/visual-mapping/components/ConnectionLines/ConnectionLines.d.ts +8 -0
- package/features/visual-mapping/components/CurrentMappingsDisplay/CurrentMappingsDisplay.d.ts +5 -0
- package/features/visual-mapping/components/EmptyFormFieldsMessage/EmptyFormFieldsMessage.d.ts +1 -0
- package/features/visual-mapping/components/FormFieldItem/FormFieldItem.d.ts +9 -0
- package/features/visual-mapping/components/FormFieldsList/FormFieldsList.d.ts +9 -0
- package/features/visual-mapping/components/KeyValueEditor/KeyValueEditor.d.ts +39 -0
- package/features/visual-mapping/components/MappingActionsDropdownMenu/MappingActionsDropdownMenu.d.ts +9 -0
- package/features/visual-mapping/components/MappingConnections/MappingConnections.d.ts +10 -0
- package/features/visual-mapping/components/RequestBodyEditor/RequestBodyEditor.d.ts +10 -0
- package/features/visual-mapping/components/SearchBar/SearchBar.d.ts +25 -0
- package/features/visual-mapping/components/VisualApiMappingInterface/VisualApiMappingInterface.d.ts +9 -0
- package/features/visual-mapping/components/index.d.ts +2 -0
- package/features/visual-mapping/components/typeCompatibility.d.ts +4 -0
- package/features/visual-mapping/components/utils/getFormFieldDataType.d.ts +2 -0
- package/features/visual-mapping/index.d.ts +18 -0
- package/features/visual-mapping/utils/apiBodyUtils.d.ts +1 -0
- package/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +35 -0
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/integrations/NextJSIntegration.d.ts +23 -0
- package/integrations/ReactRouterIntegration.d.ts +16 -0
- package/integrations/index.d.ts +12 -0
- package/integrations/react-router/FormBuilderPage/FormBuilderPage.d.ts +23 -0
- package/integrations/react-router/FormsPage.d.ts +18 -0
- package/integrations/react-router/index.d.ts +11 -0
- package/package.json +1 -1
- package/providers/FormSaveContext.d.ts +20 -0
- package/providers/FormSaveProvider.d.ts +93 -0
- package/providers/ThemeProvider.d.ts +2 -0
- package/providers/index.d.ts +9 -0
- package/server.d.ts +8 -0
- package/storage/FilesystemStorageProvider.d.ts +19 -0
- package/storage/NullStorageProvider.d.ts +15 -0
- package/storage/PgLiteSyncProvider.d.ts +41 -0
- package/storage/StorageProviderFactory.d.ts +77 -0
- package/storage/ZeroConfigFilesystemStorageProvider.d.ts +157 -0
- package/storage/database-schemas.d.ts +17901 -0
- package/storage/database-types.d.ts +194 -0
- package/storage/index.d.ts +17 -0
- package/storage/types.d.ts +195 -0
- package/store/formBuilderStore.d.ts +287 -0
- package/store/index.d.ts +7 -0
- package/store/initialState/templates.d.ts +22 -0
- package/styles/index.d.ts +0 -0
- package/utils/configInitializer.d.ts +11 -0
- package/utils/configReader.d.ts +13 -0
- package/utils/fieldChangeValidation.d.ts +127 -0
- package/utils/fileStorage.d.ts +253 -0
- package/utils/formSaver.d.ts +22 -0
- package/utils/formsExplorer.d.ts +128 -0
- package/utils/index.d.ts +2 -0
- package/utils/routeUtils.d.ts +85 -0
- package/configReader-BkMPr3Ju.js.map +0 -1
- package/configReader-CbGTKRUP.cjs.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Template } from '../../../../utils/fileStorage';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface TemplateContextMenuProps {
|
|
4
|
+
template: Template;
|
|
5
|
+
currentUser: string;
|
|
6
|
+
onPreview?: () => void;
|
|
7
|
+
onEdit?: () => void;
|
|
8
|
+
onDuplicate?: () => void;
|
|
9
|
+
onDelete?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const TemplateContextMenu: React.FC<TemplateContextMenuProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { FormStepConfig, TemplateStepConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to get template governance information for a step
|
|
4
|
+
*
|
|
5
|
+
* Returns comprehensive information about template permissions, display properties,
|
|
6
|
+
* and lock status for use in UI components.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useTemplateGovernance(step: FormStepConfig | TemplateStepConfig | null, templateOrigin?: {
|
|
9
|
+
templateId: string;
|
|
10
|
+
stepIndex?: number;
|
|
11
|
+
}): {
|
|
12
|
+
isLocked: boolean;
|
|
13
|
+
isGeneric: boolean;
|
|
14
|
+
isTeam: boolean;
|
|
15
|
+
isRegularStep: boolean;
|
|
16
|
+
permissions: import('../utils/templateConfig').TemplatePermissions;
|
|
17
|
+
display: import('../utils/templateConfig').TemplateDisplayConfig;
|
|
18
|
+
lockMessage: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hook to check if a specific action is allowed for a step
|
|
22
|
+
*/
|
|
23
|
+
export declare function useTemplatePermission(step: FormStepConfig | TemplateStepConfig | null, permission: keyof ReturnType<typeof useTemplateGovernance>["permissions"], templateOrigin?: {
|
|
24
|
+
templateId: string;
|
|
25
|
+
stepIndex?: number;
|
|
26
|
+
}): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Hook to get the lock status and message for a property
|
|
29
|
+
*/
|
|
30
|
+
export declare function usePropertyLock(step: FormStepConfig | TemplateStepConfig | null, propertyName: string, templateOrigin?: {
|
|
31
|
+
templateId: string;
|
|
32
|
+
stepIndex?: number;
|
|
33
|
+
}): {
|
|
34
|
+
isLocked: boolean;
|
|
35
|
+
lockMessage: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Hook specifically for component property locks
|
|
39
|
+
*/
|
|
40
|
+
export declare function useComponentPropertyLock(step: FormStepConfig | TemplateStepConfig | null, templateOrigin?: {
|
|
41
|
+
templateId: string;
|
|
42
|
+
stepIndex?: number;
|
|
43
|
+
}): {
|
|
44
|
+
isLocked: boolean;
|
|
45
|
+
lockMessage: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { FormStepConfig, TemplateStepConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
import { TemplatePermissions } from '../utils/templateConfig';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to get template permissions and validation for a step
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTemplatePermissions(step: FormStepConfig | TemplateStepConfig | null): {
|
|
7
|
+
permissions: TemplatePermissions;
|
|
8
|
+
isLocked: boolean;
|
|
9
|
+
canEdit: boolean;
|
|
10
|
+
templateInfo: null;
|
|
11
|
+
validateAction: () => {
|
|
12
|
+
allowed: boolean;
|
|
13
|
+
};
|
|
14
|
+
isActionAllowed: () => true;
|
|
15
|
+
} | {
|
|
16
|
+
permissions: TemplatePermissions;
|
|
17
|
+
isLocked: boolean;
|
|
18
|
+
canEdit: boolean;
|
|
19
|
+
templateInfo: {
|
|
20
|
+
type: import('../utils/templateConfig').TemplateType;
|
|
21
|
+
permissions: TemplatePermissions;
|
|
22
|
+
display: import('../utils/templateConfig').TemplateDisplayConfig;
|
|
23
|
+
rules: {
|
|
24
|
+
lockMessage: string;
|
|
25
|
+
supportsMultipleSteps: boolean;
|
|
26
|
+
defaultNavigation: {
|
|
27
|
+
next: {
|
|
28
|
+
label: string;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
};
|
|
31
|
+
previous: {
|
|
32
|
+
label: string;
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
isLocked: boolean;
|
|
38
|
+
canEdit: boolean;
|
|
39
|
+
isGeneric: boolean;
|
|
40
|
+
isTeam: boolean;
|
|
41
|
+
isRegularStep: boolean;
|
|
42
|
+
};
|
|
43
|
+
validateAction: (action: keyof TemplatePermissions) => {
|
|
44
|
+
allowed: boolean;
|
|
45
|
+
message?: string;
|
|
46
|
+
};
|
|
47
|
+
isActionAllowed: (action: keyof TemplatePermissions) => boolean;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Hook to get template permissions for the currently selected step
|
|
51
|
+
*/
|
|
52
|
+
export declare function useCurrentStepTemplatePermissions(): {
|
|
53
|
+
permissions: TemplatePermissions;
|
|
54
|
+
isLocked: boolean;
|
|
55
|
+
canEdit: boolean;
|
|
56
|
+
templateInfo: null;
|
|
57
|
+
validateAction: () => {
|
|
58
|
+
allowed: boolean;
|
|
59
|
+
};
|
|
60
|
+
isActionAllowed: () => true;
|
|
61
|
+
} | {
|
|
62
|
+
permissions: TemplatePermissions;
|
|
63
|
+
isLocked: boolean;
|
|
64
|
+
canEdit: boolean;
|
|
65
|
+
templateInfo: {
|
|
66
|
+
type: import('../utils/templateConfig').TemplateType;
|
|
67
|
+
permissions: TemplatePermissions;
|
|
68
|
+
display: import('../utils/templateConfig').TemplateDisplayConfig;
|
|
69
|
+
rules: {
|
|
70
|
+
lockMessage: string;
|
|
71
|
+
supportsMultipleSteps: boolean;
|
|
72
|
+
defaultNavigation: {
|
|
73
|
+
next: {
|
|
74
|
+
label: string;
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
};
|
|
77
|
+
previous: {
|
|
78
|
+
label: string;
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
isLocked: boolean;
|
|
84
|
+
canEdit: boolean;
|
|
85
|
+
isGeneric: boolean;
|
|
86
|
+
isTeam: boolean;
|
|
87
|
+
isRegularStep: boolean;
|
|
88
|
+
};
|
|
89
|
+
validateAction: (action: keyof TemplatePermissions) => {
|
|
90
|
+
allowed: boolean;
|
|
91
|
+
message?: string;
|
|
92
|
+
};
|
|
93
|
+
isActionAllowed: (action: keyof TemplatePermissions) => boolean;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Hook to check if a specific action is allowed for the current step
|
|
97
|
+
*/
|
|
98
|
+
export declare function useIsActionAllowed(action: keyof TemplatePermissions): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Hook to validate an action for the current step and get appropriate error message
|
|
101
|
+
*/
|
|
102
|
+
export declare function useValidateAction(action: keyof TemplatePermissions): {
|
|
103
|
+
allowed: boolean;
|
|
104
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './components/CreateTemplateDialog/CreateTemplateDialog';
|
|
2
|
+
export * from './components/DeleteTemplateDialog/DeleteTemplateDialog';
|
|
3
|
+
export * from './components/DuplicateTemplateDialog/DuplicateTemplateDialog';
|
|
4
|
+
export * from './components/EditTemplateDialog/EditTemplateDialog';
|
|
5
|
+
export * from './components/EnhancedTemplateBrowser/EnhancedTemplateBrowser';
|
|
6
|
+
export * from './components/TemplateContextMenu/TemplateContextMenu';
|
|
7
|
+
export * from './hooks/useTemplateGovernance';
|
|
8
|
+
export * from './hooks/useTemplatePermissions';
|
|
9
|
+
export * from './hooks/useTemplateStepTitle';
|
|
10
|
+
export * from './services/TemplateStorageService';
|
|
11
|
+
export * from './utils/templateApplication';
|
|
12
|
+
export * from './utils/templateCategories';
|
|
13
|
+
export * from './utils/templateConfig';
|
|
14
|
+
export * from './utils/templateDeletion';
|
|
15
|
+
export * from './utils/templateDuplication';
|
|
16
|
+
export * from './utils/templateGovernance';
|
|
17
|
+
export * from './utils/templateMetadataOperations';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FileStorageResult, Template, TemplateCategory, TemplateStorageConfig } from '../../../utils/fileStorage';
|
|
2
|
+
/**
|
|
3
|
+
* Template storage service using File System Access API
|
|
4
|
+
* Falls back to download/upload for browsers without support
|
|
5
|
+
*/
|
|
6
|
+
export declare class TemplateStorageService {
|
|
7
|
+
private storageConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Initialize the service with storage configuration
|
|
10
|
+
*/
|
|
11
|
+
initialize(storageConfig: TemplateStorageConfig): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Save a template to storage
|
|
14
|
+
*/
|
|
15
|
+
saveTemplate(template: Template): Promise<FileStorageResult<string>>;
|
|
16
|
+
private saveWithDirectFilesystem;
|
|
17
|
+
/**
|
|
18
|
+
* Load a template from storage
|
|
19
|
+
*/
|
|
20
|
+
loadTemplate(templateId: string, category: TemplateCategory): Promise<FileStorageResult<Template>>;
|
|
21
|
+
private loadWithFetch;
|
|
22
|
+
/**
|
|
23
|
+
* List templates in a category
|
|
24
|
+
*/
|
|
25
|
+
listTemplates(category: TemplateCategory): Promise<FileStorageResult<Template[]>>;
|
|
26
|
+
private listWithFetch;
|
|
27
|
+
/**
|
|
28
|
+
* Delete a template
|
|
29
|
+
*/
|
|
30
|
+
deleteTemplate(templateId: string, category: TemplateCategory): Promise<FileStorageResult<void>>;
|
|
31
|
+
/**
|
|
32
|
+
* Get template directory path for a category
|
|
33
|
+
*/
|
|
34
|
+
private getTemplateDirectory;
|
|
35
|
+
/**
|
|
36
|
+
* Check if the service is properly configured and ready to use
|
|
37
|
+
*/
|
|
38
|
+
isReady(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get current configuration
|
|
41
|
+
*/
|
|
42
|
+
getConfig(): TemplateStorageConfig | null;
|
|
43
|
+
/**
|
|
44
|
+
* Update template metadata
|
|
45
|
+
*/
|
|
46
|
+
updateTemplateMetadata(templateId: string, category: TemplateCategory, updates: Partial<Template["metadata"]>): Promise<FileStorageResult<Template>>;
|
|
47
|
+
/**
|
|
48
|
+
* Duplicate a template with new ID
|
|
49
|
+
*/
|
|
50
|
+
duplicateTemplate(sourceTemplateId: string, sourceCategory: TemplateCategory, newMetadata: Partial<Template["metadata"]>, targetCategory?: TemplateCategory): Promise<FileStorageResult<string>>;
|
|
51
|
+
}
|
|
52
|
+
export declare const templateStorageService: TemplateStorageService;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Template } from '../../../utils/fileStorage';
|
|
2
|
+
import { FormStepConfig, FormTemplate } from '../../../../../core/src/index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Minimal interface representing what applyCustomTemplate actually reads from a template.
|
|
5
|
+
* stepsData is typed as unknown so callers with Omit<FormStepConfig, "navigation">[] or
|
|
6
|
+
* FormStepConfig[] can pass their template objects without unsafe casts.
|
|
7
|
+
* The function accesses individual step fields and fills in missing properties (e.g. navigation).
|
|
8
|
+
*/
|
|
9
|
+
export interface TemplateWithStepsData {
|
|
10
|
+
stepsData: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Interface for template application result
|
|
14
|
+
*/
|
|
15
|
+
export interface TemplateApplicationResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
stepConfig?: FormStepConfig;
|
|
18
|
+
conflicts?: TemplateConflict[];
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Interface for multi-step template application result
|
|
23
|
+
*/
|
|
24
|
+
export interface StepTemplateApplicationResult {
|
|
25
|
+
success: boolean;
|
|
26
|
+
stepConfigs?: FormStepConfig[];
|
|
27
|
+
conflicts?: TemplateConflict[];
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Interface for template conflicts that need user resolution
|
|
32
|
+
*/
|
|
33
|
+
export interface TemplateConflict {
|
|
34
|
+
type: "duplicate_id" | "naming_conflict" | "validation_conflict";
|
|
35
|
+
field: string;
|
|
36
|
+
message: string;
|
|
37
|
+
suggestions: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Interface for template application options
|
|
41
|
+
*/
|
|
42
|
+
export interface TemplateApplicationOptions {
|
|
43
|
+
/** Whether to automatically resolve ID conflicts */
|
|
44
|
+
autoResolveIds?: boolean;
|
|
45
|
+
/** Whether to preserve existing field names */
|
|
46
|
+
preserveFieldNames?: boolean;
|
|
47
|
+
/** Custom field name mappings */
|
|
48
|
+
fieldMappings?: Record<string, string>;
|
|
49
|
+
/** Step title override */
|
|
50
|
+
stepTitle?: string;
|
|
51
|
+
/** Whether to validate the template before application */
|
|
52
|
+
validateTemplate?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Apply a built-in template to create a new step configuration
|
|
56
|
+
*/
|
|
57
|
+
export declare function applyBuiltinTemplate(templateKey: string, options?: TemplateApplicationOptions): TemplateApplicationResult;
|
|
58
|
+
/**
|
|
59
|
+
* Apply a multi-step template to create multiple step configurations
|
|
60
|
+
*/
|
|
61
|
+
export declare function applyStepTemplate(template: FormTemplate, options?: TemplateApplicationOptions): StepTemplateApplicationResult;
|
|
62
|
+
/**
|
|
63
|
+
* Apply a custom template to create a new step configuration.
|
|
64
|
+
* Accepts any object with a stepsData property — both Template (from file storage)
|
|
65
|
+
* and CompatibleTemplateConfig (from formBuilderStore) satisfy this interface.
|
|
66
|
+
*/
|
|
67
|
+
export declare function applyCustomTemplate(template: Template | TemplateWithStepsData, options?: TemplateApplicationOptions): TemplateApplicationResult;
|
|
68
|
+
/**
|
|
69
|
+
* Get template preview data for built-in templates
|
|
70
|
+
*/
|
|
71
|
+
export declare function getTemplatePreview(templateKey: string): {
|
|
72
|
+
sectionCount: number;
|
|
73
|
+
componentCount: number;
|
|
74
|
+
description: string;
|
|
75
|
+
} | null;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { FileStorageResult, Template, TemplateCategory, TemplateStorageConfig } from '../../../utils/fileStorage';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for category display information
|
|
4
|
+
*/
|
|
5
|
+
export interface CategoryDisplayInfo {
|
|
6
|
+
displayName: string;
|
|
7
|
+
description: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
permissions: {
|
|
10
|
+
canCreate: boolean;
|
|
11
|
+
canEdit: boolean;
|
|
12
|
+
canDelete: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interface for category statistics
|
|
17
|
+
*/
|
|
18
|
+
export interface CategoryStatistics {
|
|
19
|
+
templateCount: number;
|
|
20
|
+
totalUsage: number;
|
|
21
|
+
lastModified: number | null;
|
|
22
|
+
recentlyAdded: number;
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Interface for category access validation result
|
|
27
|
+
*/
|
|
28
|
+
export interface CategoryAccessResult {
|
|
29
|
+
hasAccess: boolean;
|
|
30
|
+
permissions: {
|
|
31
|
+
canView: boolean;
|
|
32
|
+
canCreate: boolean;
|
|
33
|
+
canEdit: boolean;
|
|
34
|
+
canDelete: boolean;
|
|
35
|
+
canShare: boolean;
|
|
36
|
+
canManage: boolean;
|
|
37
|
+
};
|
|
38
|
+
reason?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get available template categories based on storage configuration
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAvailableCategories(storageConfig: TemplateStorageConfig): TemplateCategory[];
|
|
44
|
+
/**
|
|
45
|
+
* Get display information for a category
|
|
46
|
+
*/
|
|
47
|
+
export declare function getCategoryDisplayInfo(category: TemplateCategory): CategoryDisplayInfo;
|
|
48
|
+
/**
|
|
49
|
+
* Get statistics for all categories
|
|
50
|
+
*/
|
|
51
|
+
export declare function getCategoryStatistics(storageConfig: TemplateStorageConfig): Promise<FileStorageResult<Record<TemplateCategory, CategoryStatistics>>>;
|
|
52
|
+
/**
|
|
53
|
+
* Validate category access for a user
|
|
54
|
+
*/
|
|
55
|
+
export declare function validateCategoryAccess(category: TemplateCategory, currentUser: string, storageConfig: TemplateStorageConfig): CategoryAccessResult;
|
|
56
|
+
/**
|
|
57
|
+
* Get permissions for a user in a specific category
|
|
58
|
+
*/
|
|
59
|
+
export declare function getCategoryPermissions(category: TemplateCategory, currentUser: string): {
|
|
60
|
+
canView: boolean;
|
|
61
|
+
canCreate: boolean;
|
|
62
|
+
canEdit: boolean;
|
|
63
|
+
canDelete: boolean;
|
|
64
|
+
canShare: boolean;
|
|
65
|
+
canManage: boolean;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Get templates for a specific category
|
|
69
|
+
*/
|
|
70
|
+
export declare function getTemplatesByCategory(category: TemplateCategory, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<Template[]>>;
|
|
71
|
+
/**
|
|
72
|
+
* Get category usage analytics
|
|
73
|
+
*/
|
|
74
|
+
export declare function getCategoryUsageAnalytics(category: TemplateCategory, storageConfig: TemplateStorageConfig, days?: number): Promise<FileStorageResult<{
|
|
75
|
+
totalTemplates: number;
|
|
76
|
+
totalUsage: number;
|
|
77
|
+
averageUsage: number;
|
|
78
|
+
mostUsedTemplates: Array<{
|
|
79
|
+
name: string;
|
|
80
|
+
usageCount: number;
|
|
81
|
+
}>;
|
|
82
|
+
leastUsedTemplates: Array<{
|
|
83
|
+
name: string;
|
|
84
|
+
usageCount: number;
|
|
85
|
+
}>;
|
|
86
|
+
recentActivity: Array<{
|
|
87
|
+
date: string;
|
|
88
|
+
templateName: string;
|
|
89
|
+
action: "created" | "modified";
|
|
90
|
+
}>;
|
|
91
|
+
}>>;
|
|
92
|
+
/**
|
|
93
|
+
* Get templates by tag across all categories
|
|
94
|
+
*/
|
|
95
|
+
export declare function getTemplatesByTag(tag: string, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<Array<Template & {
|
|
96
|
+
category: TemplateCategory;
|
|
97
|
+
}>>>;
|
|
98
|
+
/**
|
|
99
|
+
* Get all unique tags across categories
|
|
100
|
+
*/
|
|
101
|
+
export declare function getAllTemplateTags(storageConfig: TemplateStorageConfig): Promise<FileStorageResult<Array<{
|
|
102
|
+
tag: string;
|
|
103
|
+
count: number;
|
|
104
|
+
categories: TemplateCategory[];
|
|
105
|
+
}>>>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FormStepConfig, TemplateStepConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
export type TemplateType = "generic" | "team" | null;
|
|
3
|
+
/**
|
|
4
|
+
* Template permissions configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface TemplatePermissions {
|
|
7
|
+
/** Can add new components to sections */
|
|
8
|
+
canAddComponents: boolean;
|
|
9
|
+
/** Can remove existing components */
|
|
10
|
+
canRemoveComponents: boolean;
|
|
11
|
+
/** Can edit component properties */
|
|
12
|
+
canEditComponentProperties: boolean;
|
|
13
|
+
/** Can add new sections */
|
|
14
|
+
canAddSections: boolean;
|
|
15
|
+
/** Can remove existing sections */
|
|
16
|
+
canRemoveSections: boolean;
|
|
17
|
+
/** Can edit section properties */
|
|
18
|
+
canEditSectionProperties: boolean;
|
|
19
|
+
/** Can edit step title */
|
|
20
|
+
canEditStepTitle: boolean;
|
|
21
|
+
/** Can edit navigation settings */
|
|
22
|
+
canEditNavigation: boolean;
|
|
23
|
+
/** Can add/edit actions */
|
|
24
|
+
canEditActions: boolean;
|
|
25
|
+
/** Can duplicate the step */
|
|
26
|
+
canDuplicate: boolean;
|
|
27
|
+
/** Can delete the step */
|
|
28
|
+
canDelete: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Template display configuration
|
|
32
|
+
*/
|
|
33
|
+
export interface TemplateDisplayConfig {
|
|
34
|
+
/** Template type for UI display */
|
|
35
|
+
type: TemplateType;
|
|
36
|
+
/** Whether template is readonly */
|
|
37
|
+
isReadonly: boolean;
|
|
38
|
+
/** Whether to show lock icon */
|
|
39
|
+
showLockIcon: boolean;
|
|
40
|
+
/** CSS classes for theme styling */
|
|
41
|
+
themeClass: string;
|
|
42
|
+
/** Icon color classes */
|
|
43
|
+
iconColor: string;
|
|
44
|
+
/** Tooltip text for locked templates */
|
|
45
|
+
lockTooltip?: string;
|
|
46
|
+
/** Badge text for template type */
|
|
47
|
+
badgeText?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Complete template configuration
|
|
51
|
+
*/
|
|
52
|
+
export interface TemplateConfig {
|
|
53
|
+
permissions: TemplatePermissions;
|
|
54
|
+
display: TemplateDisplayConfig;
|
|
55
|
+
rules: {
|
|
56
|
+
/** Message shown when user tries to edit locked content */
|
|
57
|
+
lockMessage: string;
|
|
58
|
+
/** Whether this template type supports multiple steps */
|
|
59
|
+
supportsMultipleSteps: boolean;
|
|
60
|
+
/** Default navigation behavior */
|
|
61
|
+
defaultNavigation: {
|
|
62
|
+
next: {
|
|
63
|
+
label: string;
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
};
|
|
66
|
+
previous: {
|
|
67
|
+
label: string;
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Gets the complete template configuration for a given template ID or step
|
|
75
|
+
*/
|
|
76
|
+
export declare function getTemplateConfig(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): TemplateConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Gets template permissions for a given template ID or step
|
|
79
|
+
*/
|
|
80
|
+
export declare function getTemplatePermissions(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): TemplatePermissions;
|
|
81
|
+
/**
|
|
82
|
+
* Gets template display configuration for a given template ID or step
|
|
83
|
+
*/
|
|
84
|
+
export declare function getTemplateDisplayConfig(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): TemplateDisplayConfig;
|
|
85
|
+
/**
|
|
86
|
+
* Checks if a specific action is allowed for a template or step
|
|
87
|
+
*/
|
|
88
|
+
export declare function isActionAllowed(templateIdOrStep: string | FormStepConfig | TemplateStepConfig, action: keyof TemplatePermissions): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if a step is locked for editing
|
|
91
|
+
*/
|
|
92
|
+
export declare function isStepLocked(step: FormStepConfig | TemplateStepConfig, templateOrigin?: {
|
|
93
|
+
templateId: string;
|
|
94
|
+
stepIndex?: number;
|
|
95
|
+
}): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the lock message for a template
|
|
98
|
+
*/
|
|
99
|
+
export declare function getLockMessage(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): string;
|
|
100
|
+
/**
|
|
101
|
+
* Validates if a template action should be blocked and returns appropriate message
|
|
102
|
+
*/
|
|
103
|
+
export declare function validateTemplateAction(templateIdOrStep: string | FormStepConfig | TemplateStepConfig, action: keyof TemplatePermissions): {
|
|
104
|
+
allowed: boolean;
|
|
105
|
+
message?: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Gets template type from various input formats
|
|
109
|
+
*/
|
|
110
|
+
export declare function getTemplateTypeFromInput(input: string | FormStepConfig | TemplateStepConfig): TemplateType;
|
|
111
|
+
/**
|
|
112
|
+
* Utility to check if input represents a generic template
|
|
113
|
+
*/
|
|
114
|
+
export declare function isGenericTemplateInput(input: string | FormStepConfig | TemplateStepConfig): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Utility to check if input represents a team template
|
|
117
|
+
*/
|
|
118
|
+
export declare function isTeamTemplateInput(input: string | FormStepConfig | TemplateStepConfig): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Creates a comprehensive template info object for UI components
|
|
121
|
+
*/
|
|
122
|
+
export declare function getTemplateInfo(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): {
|
|
123
|
+
type: TemplateType;
|
|
124
|
+
permissions: TemplatePermissions;
|
|
125
|
+
display: TemplateDisplayConfig;
|
|
126
|
+
rules: {
|
|
127
|
+
/** Message shown when user tries to edit locked content */
|
|
128
|
+
lockMessage: string;
|
|
129
|
+
/** Whether this template type supports multiple steps */
|
|
130
|
+
supportsMultipleSteps: boolean;
|
|
131
|
+
/** Default navigation behavior */
|
|
132
|
+
defaultNavigation: {
|
|
133
|
+
next: {
|
|
134
|
+
label: string;
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
};
|
|
137
|
+
previous: {
|
|
138
|
+
label: string;
|
|
139
|
+
enabled: boolean;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
isLocked: boolean;
|
|
144
|
+
canEdit: boolean;
|
|
145
|
+
isGeneric: boolean;
|
|
146
|
+
isTeam: boolean;
|
|
147
|
+
isRegularStep: boolean;
|
|
148
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FileStorageResult, Template, TemplateCategory } from '../../../utils/fileStorage';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for deletion permission check result
|
|
4
|
+
*/
|
|
5
|
+
export interface DeletionPermissionResult {
|
|
6
|
+
canDelete: boolean;
|
|
7
|
+
reason?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Interface for deletion validation result
|
|
11
|
+
*/
|
|
12
|
+
export interface DeletionValidationResult {
|
|
13
|
+
canDelete: boolean;
|
|
14
|
+
template?: Template;
|
|
15
|
+
warnings: string[];
|
|
16
|
+
errors: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Interface for bulk deletion result
|
|
20
|
+
*/
|
|
21
|
+
export interface BulkDeletionResult {
|
|
22
|
+
deletedCount: number;
|
|
23
|
+
failedCount: number;
|
|
24
|
+
failures: Array<{
|
|
25
|
+
templateId: string;
|
|
26
|
+
error: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if a template can be deleted by a specific user
|
|
31
|
+
*/
|
|
32
|
+
export declare function canDeleteTemplate(template: Template, currentUser: string): DeletionPermissionResult;
|
|
33
|
+
/**
|
|
34
|
+
* Delete a template with validation
|
|
35
|
+
*/
|
|
36
|
+
export declare function deleteTemplateWithValidation(templateId: string, category: TemplateCategory, currentUser: string): Promise<FileStorageResult<void>>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete multiple templates
|
|
39
|
+
*/
|
|
40
|
+
export declare function deleteMultipleTemplates(templateIds: string[], category: TemplateCategory, currentUser: string): Promise<FileStorageResult<BulkDeletionResult>>;
|
|
41
|
+
/**
|
|
42
|
+
* Validate template deletion and provide warnings
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateTemplateDeletion(templateId: string, category: TemplateCategory, currentUser: string): Promise<DeletionValidationResult>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { FileStorageResult, Template, TemplateCategory, TemplateStorageConfig } from '../../../utils/fileStorage';
|
|
2
|
+
import { FormStepConfig } from '../../../../../core/src/index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for duplication request
|
|
5
|
+
*/
|
|
6
|
+
export interface DuplicationRequest {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
tags?: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface for duplication validation result
|
|
13
|
+
*/
|
|
14
|
+
export interface DuplicationValidationResult {
|
|
15
|
+
isValid: boolean;
|
|
16
|
+
errors: string[];
|
|
17
|
+
sourceTemplate?: Template;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Interface for duplication result
|
|
21
|
+
*/
|
|
22
|
+
export interface DuplicationResult {
|
|
23
|
+
templateId: string;
|
|
24
|
+
filePath: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Duplicate a template
|
|
28
|
+
*/
|
|
29
|
+
export declare function duplicateTemplate(sourceTemplateId: string, sourceCategory: TemplateCategory, duplicateInfo: DuplicationRequest, targetCategory: TemplateCategory, currentUser: string, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<DuplicationResult>>;
|
|
30
|
+
/**
|
|
31
|
+
* Validate a duplication request
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateDuplicationRequest(sourceTemplateId: string, sourceCategory: TemplateCategory, newName: string, targetCategory: TemplateCategory, _currentUser: string, storageConfig: TemplateStorageConfig): Promise<DuplicationValidationResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Create a duplicate template with new IDs
|
|
36
|
+
*/
|
|
37
|
+
export declare function createDuplicateWithNewIds(sourceTemplate: Template, duplicateInfo: DuplicationRequest, targetCategory: TemplateCategory, currentUser: string): Template;
|
|
38
|
+
/**
|
|
39
|
+
* Generate unique IDs for all components in step data
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateUniqueComponentIds(stepData: FormStepConfig): FormStepConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Duplicate multiple templates
|
|
44
|
+
*/
|
|
45
|
+
export declare function duplicateMultipleTemplates(templates: Array<{
|
|
46
|
+
sourceTemplateId: string;
|
|
47
|
+
sourceCategory: TemplateCategory;
|
|
48
|
+
duplicateInfo: DuplicationRequest;
|
|
49
|
+
}>, targetCategory: TemplateCategory, currentUser: string, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<Array<{
|
|
50
|
+
templateId: string;
|
|
51
|
+
name: string;
|
|
52
|
+
success: boolean;
|
|
53
|
+
error?: string;
|
|
54
|
+
}>>>;
|
|
55
|
+
/**
|
|
56
|
+
* Create a template copy with auto-generated name
|
|
57
|
+
*/
|
|
58
|
+
export declare function quickDuplicateTemplate(sourceTemplateId: string, sourceCategory: TemplateCategory, targetCategory: TemplateCategory, currentUser: string, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<DuplicationResult>>;
|
|
59
|
+
/**
|
|
60
|
+
* Validate that duplication preserves template structure
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateDuplicateStructure(original: FormStepConfig, duplicate: FormStepConfig): {
|
|
63
|
+
isValid: boolean;
|
|
64
|
+
errors: string[];
|
|
65
|
+
};
|