From ffd7f178f1be829358e3e9df684f8fbb9fb5f3e3 Mon Sep 17 00:00:00 2001 From: Andrea Standeren Date: Fri, 2 Feb 2024 09:13:03 +0100 Subject: [PATCH] Add code to ux-editor-v3 --- .../src/components/Properties/Content.tsx | 40 +++++++++---------- .../components/config/EditFormContainer.tsx | 16 +++++++- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/frontend/packages/ux-editor-v3/src/components/Properties/Content.tsx b/frontend/packages/ux-editor-v3/src/components/Properties/Content.tsx index 32744d080dd..8a287f5baab 100644 --- a/frontend/packages/ux-editor-v3/src/components/Properties/Content.tsx +++ b/frontend/packages/ux-editor-v3/src/components/Properties/Content.tsx @@ -16,27 +16,23 @@ export const Content = () => { if (editId) return ; if (!formId || !form) return t('right_menu.content_empty'); - return ( - <> - {isContainer(form) ? ( - { - handleUpdate(updatedContainer); - debounceSave(formId, updatedContainer); - }} - /> - ) : ( - { - handleUpdate(updatedComponent); - debounceSave(formId, updatedComponent); - }} - /> - )} - + return isContainer(form) ? ( + { + handleUpdate(updatedContainer); + debounceSave(formId, updatedContainer); + }} + /> + ) : ( + { + handleUpdate(updatedComponent); + debounceSave(formId, updatedComponent); + }} + /> ); }; diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx index f10263eb81c..2b87df6ecdb 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx @@ -5,7 +5,14 @@ import { EditGroupDataModelBindings } from './group/EditGroupDataModelBindings'; import { getTextResource } from '../../utils/language'; import { idExists } from '../../utils/formLayoutUtils'; import type { DatamodelFieldElement } from 'app-shared/types/DatamodelFieldElement'; -import { Switch, Checkbox, LegacyFieldSet, LegacyTextField } from '@digdir/design-system-react'; +import { + Alert, + Switch, + Checkbox, + LegacyFieldSet, + LegacyTextField, + Paragraph, +} from '@digdir/design-system-react'; import classes from './EditFormContainer.module.css'; import { TextResource } from '../TextResource'; import { useDatamodelMetadataQuery } from '../../hooks/queries/useDatamodelMetadataQuery'; @@ -20,6 +27,7 @@ import { FormField } from '../FormField'; import type { FormContainer } from '../../types/FormContainer'; import { useStudioUrlParams } from 'app-shared/hooks/useStudioUrlParams'; import { useAppContext } from '../../hooks/useAppContext'; +import { ComponentType } from 'app-shared/types/ComponentType'; export interface IEditFormContainerProps { editFormId: string; @@ -130,7 +138,7 @@ export const EditFormContainer = ({ }); }; - return ( + return container.type === ComponentType.Group ? ( )} + ) : ( + + {t('ux_editor.container_not_editable_info')} + ); };