@strapi/content-type-builder 5.13.0-beta.1 → 5.13.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/dist/admin/components/AttributeIcon.js +0 -1
- package/dist/admin/components/AttributeIcon.js.map +1 -1
- package/dist/admin/components/AttributeIcon.mjs +0 -1
- package/dist/admin/components/AttributeIcon.mjs.map +1 -1
- package/dist/admin/components/AttributeOptions/AttributeOption.js +1 -1
- package/dist/admin/components/AttributeOptions/AttributeOption.js.map +1 -1
- package/dist/admin/components/AttributeOptions/AttributeOption.mjs +1 -1
- package/dist/admin/components/AttributeOptions/AttributeOption.mjs.map +1 -1
- package/dist/admin/components/AttributeOptions/CustomFieldOption.js +1 -1
- package/dist/admin/components/AttributeOptions/CustomFieldOption.js.map +1 -1
- package/dist/admin/components/AttributeOptions/CustomFieldOption.mjs +1 -1
- package/dist/admin/components/AttributeOptions/CustomFieldOption.mjs.map +1 -1
- package/dist/admin/components/AutoReloadOverlayBlocker.js +2 -5
- package/dist/admin/components/AutoReloadOverlayBlocker.js.map +1 -1
- package/dist/admin/components/AutoReloadOverlayBlocker.mjs +2 -5
- package/dist/admin/components/AutoReloadOverlayBlocker.mjs.map +1 -1
- package/dist/admin/components/ComponentCard/ComponentCard.js +11 -13
- package/dist/admin/components/ComponentCard/ComponentCard.js.map +1 -1
- package/dist/admin/components/ComponentCard/ComponentCard.mjs +11 -13
- package/dist/admin/components/ComponentCard/ComponentCard.mjs.map +1 -1
- package/dist/admin/components/ComponentList.js +26 -12
- package/dist/admin/components/ComponentList.js.map +1 -1
- package/dist/admin/components/ComponentList.mjs +26 -12
- package/dist/admin/components/ComponentList.mjs.map +1 -1
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.js +70 -253
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.js.map +1 -1
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.mjs +73 -256
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.mjs.map +1 -1
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js +81 -53
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js.map +1 -1
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.mjs +82 -54
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.mjs.map +1 -1
- package/dist/admin/components/DisplayedType.js +14 -14
- package/dist/admin/components/DisplayedType.js.map +1 -1
- package/dist/admin/components/DisplayedType.mjs +15 -15
- package/dist/admin/components/DisplayedType.mjs.map +1 -1
- package/dist/admin/components/DynamicZoneList.js +38 -34
- package/dist/admin/components/DynamicZoneList.js.map +1 -1
- package/dist/admin/components/DynamicZoneList.mjs +40 -36
- package/dist/admin/components/DynamicZoneList.mjs.map +1 -1
- package/dist/admin/components/FormModal/FormModal.js +164 -198
- package/dist/admin/components/FormModal/FormModal.js.map +1 -1
- package/dist/admin/components/FormModal/FormModal.mjs +165 -198
- package/dist/admin/components/FormModal/FormModal.mjs.map +1 -1
- package/dist/admin/components/FormModal/attributes/types.js.map +1 -1
- package/dist/admin/components/FormModal/attributes/types.mjs.map +1 -1
- package/dist/admin/components/FormModal/attributes/validation/common.js.map +1 -1
- package/dist/admin/components/FormModal/attributes/validation/common.mjs.map +1 -1
- package/dist/admin/components/FormModal/component/createComponentSchema.js +2 -2
- package/dist/admin/components/FormModal/component/createComponentSchema.js.map +1 -1
- package/dist/admin/components/FormModal/component/createComponentSchema.mjs +1 -1
- package/dist/admin/components/FormModal/component/createComponentSchema.mjs.map +1 -1
- package/dist/admin/components/FormModal/forms/forms.js +27 -10
- package/dist/admin/components/FormModal/forms/forms.js.map +1 -1
- package/dist/admin/components/FormModal/forms/forms.mjs +27 -10
- package/dist/admin/components/FormModal/forms/forms.mjs.map +1 -1
- package/dist/admin/components/FormModal/forms/utils/getUsedAttributeNames.js.map +1 -1
- package/dist/admin/components/FormModal/forms/utils/getUsedAttributeNames.mjs.map +1 -1
- package/dist/admin/components/FormModal/reducer.js +4 -4
- package/dist/admin/components/FormModal/reducer.js.map +1 -1
- package/dist/admin/components/FormModal/reducer.mjs +4 -4
- package/dist/admin/components/FormModal/reducer.mjs.map +1 -1
- package/dist/admin/components/FormModal/utils/canEditContentType.js +14 -9
- package/dist/admin/components/FormModal/utils/canEditContentType.js.map +1 -1
- package/dist/admin/components/FormModal/utils/canEditContentType.mjs +14 -9
- package/dist/admin/components/FormModal/utils/canEditContentType.mjs.map +1 -1
- package/dist/admin/components/FormModal/utils/getAttributesToDisplay.js.map +1 -1
- package/dist/admin/components/FormModal/utils/getAttributesToDisplay.mjs.map +1 -1
- package/dist/admin/components/FormModalEndActions.js +34 -1
- package/dist/admin/components/FormModalEndActions.js.map +1 -1
- package/dist/admin/components/FormModalEndActions.mjs +34 -1
- package/dist/admin/components/FormModalEndActions.mjs.map +1 -1
- package/dist/admin/components/FormModalHeader.js +28 -10
- package/dist/admin/components/FormModalHeader.js.map +1 -1
- package/dist/admin/components/FormModalHeader.mjs +28 -10
- package/dist/admin/components/FormModalHeader.mjs.map +1 -1
- package/dist/admin/components/FormModalSubHeader.js.map +1 -1
- package/dist/admin/components/FormModalSubHeader.mjs.map +1 -1
- package/dist/admin/components/GenericInputs.js +5 -9
- package/dist/admin/components/GenericInputs.js.map +1 -1
- package/dist/admin/components/GenericInputs.mjs +5 -9
- package/dist/admin/components/GenericInputs.mjs.map +1 -1
- package/dist/admin/components/List.js +199 -149
- package/dist/admin/components/List.js.map +1 -1
- package/dist/admin/components/List.mjs +202 -151
- package/dist/admin/components/List.mjs.map +1 -1
- package/dist/admin/components/Relation/Relation.js +2 -3
- package/dist/admin/components/Relation/Relation.js.map +1 -1
- package/dist/admin/components/Relation/Relation.mjs +2 -3
- package/dist/admin/components/Relation/Relation.mjs.map +1 -1
- package/dist/admin/components/Relation/RelationField/RelationField.js +1 -1
- package/dist/admin/components/Relation/RelationField/RelationField.js.map +1 -1
- package/dist/admin/components/Relation/RelationField/RelationField.mjs +1 -1
- package/dist/admin/components/Relation/RelationField/RelationField.mjs.map +1 -1
- package/dist/admin/components/Relation/RelationField/RelationTargetPicker/RelationTargetPicker.js +5 -6
- package/dist/admin/components/Relation/RelationField/RelationTargetPicker/RelationTargetPicker.js.map +1 -1
- package/dist/admin/components/Relation/RelationField/RelationTargetPicker/RelationTargetPicker.mjs +5 -6
- package/dist/admin/components/Relation/RelationField/RelationTargetPicker/RelationTargetPicker.mjs.map +1 -1
- package/dist/admin/components/Relation/RelationNaturePicker/RelationNaturePicker.js +21 -19
- package/dist/admin/components/Relation/RelationNaturePicker/RelationNaturePicker.js.map +1 -1
- package/dist/admin/components/Relation/RelationNaturePicker/RelationNaturePicker.mjs +21 -19
- package/dist/admin/components/Relation/RelationNaturePicker/RelationNaturePicker.mjs.map +1 -1
- package/dist/admin/components/SelectCategory.js +1 -1
- package/dist/admin/components/SelectCategory.js.map +1 -1
- package/dist/admin/components/SelectCategory.mjs +1 -1
- package/dist/admin/components/SelectCategory.mjs.map +1 -1
- package/dist/admin/components/SelectComponent.js +6 -3
- package/dist/admin/components/SelectComponent.js.map +1 -1
- package/dist/admin/components/SelectComponent.mjs +6 -3
- package/dist/admin/components/SelectComponent.mjs.map +1 -1
- package/dist/admin/components/SelectComponents.js +6 -9
- package/dist/admin/components/SelectComponents.js.map +1 -1
- package/dist/admin/components/SelectComponents.mjs +6 -9
- package/dist/admin/components/SelectComponents.mjs.map +1 -1
- package/dist/admin/components/SelectNumber.js +4 -0
- package/dist/admin/components/SelectNumber.js.map +1 -1
- package/dist/admin/components/SelectNumber.mjs +4 -0
- package/dist/admin/components/SelectNumber.mjs.map +1 -1
- package/dist/admin/components/TabForm.js +1 -2
- package/dist/admin/components/TabForm.js.map +1 -1
- package/dist/admin/components/TabForm.mjs +1 -2
- package/dist/admin/components/TabForm.mjs.map +1 -1
- package/dist/admin/icons/Curve.js +1 -1
- package/dist/admin/icons/Curve.js.map +1 -1
- package/dist/admin/icons/Curve.mjs +1 -1
- package/dist/admin/icons/Curve.mjs.map +1 -1
- package/dist/admin/pages/App/index.js +19 -39
- package/dist/admin/pages/App/index.js.map +1 -1
- package/dist/admin/pages/App/index.mjs +21 -41
- package/dist/admin/pages/App/index.mjs.map +1 -1
- package/dist/admin/pages/ListView/LinkToCMSettingsView.js +17 -26
- package/dist/admin/pages/ListView/LinkToCMSettingsView.js.map +1 -1
- package/dist/admin/pages/ListView/LinkToCMSettingsView.mjs +17 -26
- package/dist/admin/pages/ListView/LinkToCMSettingsView.mjs.map +1 -1
- package/dist/admin/pages/ListView/ListView.js +158 -105
- package/dist/admin/pages/ListView/ListView.js.map +1 -1
- package/dist/admin/pages/ListView/ListView.mjs +163 -110
- package/dist/admin/pages/ListView/ListView.mjs.map +1 -1
- package/dist/admin/reducers.js +4 -3
- package/dist/admin/reducers.js.map +1 -1
- package/dist/admin/reducers.mjs +4 -3
- package/dist/admin/reducers.mjs.map +1 -1
- package/dist/admin/src/components/AutoReloadOverlayBlocker.d.ts +2 -2
- package/dist/admin/src/components/ComponentCard/ComponentCard.d.ts +1 -5
- package/dist/admin/src/components/ComponentList.d.ts +6 -4
- package/dist/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.d.ts +14 -29
- package/dist/admin/src/components/DisplayedType.d.ts +1 -2
- package/dist/admin/src/components/DynamicZoneList.d.ts +5 -8
- package/dist/admin/src/components/FormModal/forms/forms.d.ts +38 -2
- package/dist/admin/src/components/FormModal/forms/utils/getUsedAttributeNames.d.ts +2 -3
- package/dist/admin/src/components/FormModal/reducer.d.ts +4 -10
- package/dist/admin/src/components/FormModal/utils/canEditContentType.d.ts +4 -4
- package/dist/admin/src/components/FormModal/utils/getAttributesToDisplay.d.ts +1 -1
- package/dist/admin/src/components/FormModalEndActions.d.ts +5 -1
- package/dist/admin/src/components/FormModalHeader.d.ts +7 -10
- package/dist/admin/src/components/FormModalSubHeader.d.ts +3 -3
- package/dist/admin/src/components/GenericInputs.d.ts +1 -2
- package/dist/admin/src/components/List.d.ts +13 -16
- package/dist/admin/src/components/Relation/Relation.d.ts +1 -2
- package/dist/admin/src/components/Relation/RelationField/RelationField.d.ts +1 -2
- package/dist/admin/src/components/Relation/RelationField/RelationTargetPicker/RelationTargetPicker.d.ts +2 -3
- package/dist/admin/src/components/Relation/RelationNaturePicker/RelationNaturePicker.d.ts +1 -2
- package/dist/admin/src/components/SelectComponents.d.ts +1 -3
- package/dist/admin/src/components/SelectNumber.d.ts +7 -1
- package/dist/admin/src/pages/ListView/LinkToCMSettingsView.d.ts +4 -3
- package/dist/admin/src/pages/ListView/ListView.d.ts +1 -1
- package/dist/admin/src/reducers.d.ts +8 -2
- package/dist/admin/src/types.d.ts +43 -40
- package/dist/admin/src/utils/findAttribute.d.ts +2 -2
- package/dist/admin/src/utils/formAPI.d.ts +1 -43
- package/dist/admin/src/utils/getMaxDepth.d.ts +2 -2
- package/dist/admin/src/utils/getRelationType.d.ts +1 -1
- package/dist/admin/src/utils/isAllowedContentTypesForRelations.d.ts +1 -1
- package/dist/admin/translations/de.json.js +1 -0
- package/dist/admin/translations/de.json.js.map +1 -1
- package/dist/admin/translations/de.json.mjs +1 -0
- package/dist/admin/translations/de.json.mjs.map +1 -1
- package/dist/admin/translations/dk.json.js +1 -0
- package/dist/admin/translations/dk.json.js.map +1 -1
- package/dist/admin/translations/dk.json.mjs +1 -0
- package/dist/admin/translations/dk.json.mjs.map +1 -1
- package/dist/admin/translations/en.json.js +2 -4
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +2 -4
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/translations/es.json.js +1 -0
- package/dist/admin/translations/es.json.js.map +1 -1
- package/dist/admin/translations/es.json.mjs +1 -0
- package/dist/admin/translations/es.json.mjs.map +1 -1
- package/dist/admin/translations/ko.json.js +1 -0
- package/dist/admin/translations/ko.json.js.map +1 -1
- package/dist/admin/translations/ko.json.mjs +1 -0
- package/dist/admin/translations/ko.json.mjs.map +1 -1
- package/dist/admin/translations/pl.json.js +1 -0
- package/dist/admin/translations/pl.json.js.map +1 -1
- package/dist/admin/translations/pl.json.mjs +1 -0
- package/dist/admin/translations/pl.json.mjs.map +1 -1
- package/dist/admin/translations/pt-BR.json.js +1 -0
- package/dist/admin/translations/pt-BR.json.js.map +1 -1
- package/dist/admin/translations/pt-BR.json.mjs +1 -0
- package/dist/admin/translations/pt-BR.json.mjs.map +1 -1
- package/dist/admin/translations/sv.json.js +1 -0
- package/dist/admin/translations/sv.json.js.map +1 -1
- package/dist/admin/translations/sv.json.mjs +1 -0
- package/dist/admin/translations/sv.json.mjs.map +1 -1
- package/dist/admin/translations/tr.json.js +1 -0
- package/dist/admin/translations/tr.json.js.map +1 -1
- package/dist/admin/translations/tr.json.mjs +1 -0
- package/dist/admin/translations/tr.json.mjs.map +1 -1
- package/dist/admin/translations/zh.json.js +1 -0
- package/dist/admin/translations/zh.json.js.map +1 -1
- package/dist/admin/translations/zh.json.mjs +1 -0
- package/dist/admin/translations/zh.json.mjs.map +1 -1
- package/dist/admin/utils/findAttribute.js.map +1 -1
- package/dist/admin/utils/findAttribute.mjs.map +1 -1
- package/dist/admin/utils/formAPI.js +1 -0
- package/dist/admin/utils/formAPI.js.map +1 -1
- package/dist/admin/utils/formAPI.mjs +1 -0
- package/dist/admin/utils/formAPI.mjs.map +1 -1
- package/dist/admin/utils/getMaxDepth.js.map +1 -1
- package/dist/admin/utils/getMaxDepth.mjs.map +1 -1
- package/dist/admin/utils/getRelationType.js.map +1 -1
- package/dist/admin/utils/getRelationType.mjs.map +1 -1
- package/dist/admin/utils/isAllowedContentTypesForRelations.js.map +1 -1
- package/dist/admin/utils/isAllowedContentTypesForRelations.mjs.map +1 -1
- package/dist/server/controllers/index.js +1 -3
- package/dist/server/controllers/index.js.map +1 -1
- package/dist/server/controllers/index.mjs +1 -3
- package/dist/server/controllers/index.mjs.map +1 -1
- package/dist/server/controllers/validation/common.js +0 -2
- package/dist/server/controllers/validation/common.js.map +1 -1
- package/dist/server/controllers/validation/common.mjs +1 -2
- package/dist/server/controllers/validation/common.mjs.map +1 -1
- package/dist/server/controllers/validation/content-type.js.map +1 -1
- package/dist/server/controllers/validation/content-type.mjs.map +1 -1
- package/dist/server/routes/admin.js +0 -51
- package/dist/server/routes/admin.js.map +1 -1
- package/dist/server/routes/admin.mjs +0 -51
- package/dist/server/routes/admin.mjs.map +1 -1
- package/dist/server/services/index.js +1 -3
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +1 -3
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/services/schema-builder/component-builder.js +2 -12
- package/dist/server/services/schema-builder/component-builder.js.map +1 -1
- package/dist/server/services/schema-builder/component-builder.mjs +2 -12
- package/dist/server/services/schema-builder/component-builder.mjs.map +1 -1
- package/dist/server/services/schema-builder/content-type-builder.js +28 -43
- package/dist/server/services/schema-builder/content-type-builder.js.map +1 -1
- package/dist/server/services/schema-builder/content-type-builder.mjs +28 -43
- package/dist/server/services/schema-builder/content-type-builder.mjs.map +1 -1
- package/dist/server/services/schema-builder/index.js +49 -51
- package/dist/server/services/schema-builder/index.js.map +1 -1
- package/dist/server/services/schema-builder/index.mjs +49 -51
- package/dist/server/services/schema-builder/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts +0 -5
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/common.d.ts +0 -1
- package/dist/server/src/controllers/validation/common.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/content-type.d.ts +2 -3
- package/dist/server/src/controllers/validation/content-type.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +0 -6
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/admin.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +0 -2
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/schema-builder/component-builder.d.ts +0 -1
- package/dist/server/src/services/schema-builder/component-builder.d.ts.map +1 -1
- package/dist/server/src/services/schema-builder/content-type-builder.d.ts +3 -2
- package/dist/server/src/services/schema-builder/content-type-builder.d.ts.map +1 -1
- package/dist/server/src/services/schema-builder/index.d.ts +0 -3
- package/dist/server/src/services/schema-builder/index.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +0 -2
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/package.json +6 -11
- package/dist/admin/components/AttributeRow.js +0 -342
- package/dist/admin/components/AttributeRow.js.map +0 -1
- package/dist/admin/components/AttributeRow.mjs +0 -339
- package/dist/admin/components/AttributeRow.mjs.map +0 -1
- package/dist/admin/components/ComponentRow.js +0 -42
- package/dist/admin/components/ComponentRow.js.map +0 -1
- package/dist/admin/components/ComponentRow.mjs +0 -40
- package/dist/admin/components/ComponentRow.mjs.map +0 -1
- package/dist/admin/components/DataManager/DataManagerContext.js +0 -9
- package/dist/admin/components/DataManager/DataManagerContext.js.map +0 -1
- package/dist/admin/components/DataManager/DataManagerContext.mjs +0 -7
- package/dist/admin/components/DataManager/DataManagerContext.mjs.map +0 -1
- package/dist/admin/components/DataManager/DataManagerProvider.js +0 -344
- package/dist/admin/components/DataManager/DataManagerProvider.js.map +0 -1
- package/dist/admin/components/DataManager/DataManagerProvider.mjs +0 -323
- package/dist/admin/components/DataManager/DataManagerProvider.mjs.map +0 -1
- package/dist/admin/components/DataManager/reducer.js +0 -546
- package/dist/admin/components/DataManager/reducer.js.map +0 -1
- package/dist/admin/components/DataManager/reducer.mjs +0 -542
- package/dist/admin/components/DataManager/reducer.mjs.map +0 -1
- package/dist/admin/components/DataManager/undoRedo.js +0 -102
- package/dist/admin/components/DataManager/undoRedo.js.map +0 -1
- package/dist/admin/components/DataManager/undoRedo.mjs +0 -100
- package/dist/admin/components/DataManager/undoRedo.mjs.map +0 -1
- package/dist/admin/components/DataManager/useDataManager.js +0 -9
- package/dist/admin/components/DataManager/useDataManager.js.map +0 -1
- package/dist/admin/components/DataManager/useDataManager.mjs +0 -7
- package/dist/admin/components/DataManager/useDataManager.mjs.map +0 -1
- package/dist/admin/components/DataManager/useServerRestartWatcher.js +0 -35
- package/dist/admin/components/DataManager/useServerRestartWatcher.js.map +0 -1
- package/dist/admin/components/DataManager/useServerRestartWatcher.mjs +0 -33
- package/dist/admin/components/DataManager/useServerRestartWatcher.mjs.map +0 -1
- package/dist/admin/components/DataManager/utils/cleanData.js +0 -128
- package/dist/admin/components/DataManager/utils/cleanData.js.map +0 -1
- package/dist/admin/components/DataManager/utils/cleanData.mjs +0 -125
- package/dist/admin/components/DataManager/utils/cleanData.mjs.map +0 -1
- package/dist/admin/components/DataManager/utils/formatSchemas.js +0 -21
- package/dist/admin/components/DataManager/utils/formatSchemas.js.map +0 -1
- package/dist/admin/components/DataManager/utils/formatSchemas.mjs +0 -18
- package/dist/admin/components/DataManager/utils/formatSchemas.mjs.map +0 -1
- package/dist/admin/components/DataManager/utils/retrieveComponentsThatHaveComponents.js +0 -34
- package/dist/admin/components/DataManager/utils/retrieveComponentsThatHaveComponents.js.map +0 -1
- package/dist/admin/components/DataManager/utils/retrieveComponentsThatHaveComponents.mjs +0 -31
- package/dist/admin/components/DataManager/utils/retrieveComponentsThatHaveComponents.mjs.map +0 -1
- package/dist/admin/components/DataManager/utils/retrieveNestedComponents.js +0 -45
- package/dist/admin/components/DataManager/utils/retrieveNestedComponents.js.map +0 -1
- package/dist/admin/components/DataManager/utils/retrieveNestedComponents.mjs +0 -43
- package/dist/admin/components/DataManager/utils/retrieveNestedComponents.mjs.map +0 -1
- package/dist/admin/components/DataManager/utils/retrieveSpecificInfoFromComponents.js +0 -17
- package/dist/admin/components/DataManager/utils/retrieveSpecificInfoFromComponents.js.map +0 -1
- package/dist/admin/components/DataManager/utils/retrieveSpecificInfoFromComponents.mjs +0 -15
- package/dist/admin/components/DataManager/utils/retrieveSpecificInfoFromComponents.mjs.map +0 -1
- package/dist/admin/components/ExitPrompt.js +0 -50
- package/dist/admin/components/ExitPrompt.js.map +0 -1
- package/dist/admin/components/ExitPrompt.mjs +0 -48
- package/dist/admin/components/ExitPrompt.mjs.map +0 -1
- package/dist/admin/components/Footers.js +0 -95
- package/dist/admin/components/Footers.js.map +0 -1
- package/dist/admin/components/Footers.mjs +0 -92
- package/dist/admin/components/Footers.mjs.map +0 -1
- package/dist/admin/components/FormModalNavigation/FormModalNavigationContext.js +0 -28
- package/dist/admin/components/FormModalNavigation/FormModalNavigationContext.js.map +0 -1
- package/dist/admin/components/FormModalNavigation/FormModalNavigationContext.mjs +0 -7
- package/dist/admin/components/FormModalNavigation/FormModalNavigationContext.mjs.map +0 -1
- package/dist/admin/components/FormModalNavigation/FormModalNavigationProvider.js +0 -205
- package/dist/admin/components/FormModalNavigation/FormModalNavigationProvider.js.map +0 -1
- package/dist/admin/components/FormModalNavigation/FormModalNavigationProvider.mjs +0 -202
- package/dist/admin/components/FormModalNavigation/FormModalNavigationProvider.mjs.map +0 -1
- package/dist/admin/components/FormModalNavigation/useFormModalNavigation.js +0 -9
- package/dist/admin/components/FormModalNavigation/useFormModalNavigation.js.map +0 -1
- package/dist/admin/components/FormModalNavigation/useFormModalNavigation.mjs +0 -7
- package/dist/admin/components/FormModalNavigation/useFormModalNavigation.mjs.map +0 -1
- package/dist/admin/components/Status.js +0 -73
- package/dist/admin/components/Status.js.map +0 -1
- package/dist/admin/components/Status.mjs +0 -70
- package/dist/admin/components/Status.mjs.map +0 -1
- package/dist/admin/pages/ListView/EmptyState.js +0 -38
- package/dist/admin/pages/ListView/EmptyState.js.map +0 -1
- package/dist/admin/pages/ListView/EmptyState.mjs +0 -36
- package/dist/admin/pages/ListView/EmptyState.mjs.map +0 -1
- package/dist/admin/src/components/AttributeRow.d.ts +0 -28
- package/dist/admin/src/components/ComponentRow.d.ts +0 -11
- package/dist/admin/src/components/DataManager/DataManagerContext.d.ts +0 -138
- package/dist/admin/src/components/DataManager/DataManagerProvider.d.ts +0 -6
- package/dist/admin/src/components/DataManager/reducer.d.ts +0 -278
- package/dist/admin/src/components/DataManager/undoRedo.d.ts +0 -23
- package/dist/admin/src/components/DataManager/useDataManager.d.ts +0 -1
- package/dist/admin/src/components/DataManager/useServerRestartWatcher.d.ts +0 -1
- package/dist/admin/src/components/DataManager/utils/cleanData.d.ts +0 -311
- package/dist/admin/src/components/DataManager/utils/formatSchemas.d.ts +0 -3
- package/dist/admin/src/components/DataManager/utils/retrieveComponentsThatHaveComponents.d.ts +0 -12
- package/dist/admin/src/components/DataManager/utils/retrieveNestedComponents.d.ts +0 -8
- package/dist/admin/src/components/DataManager/utils/retrieveSpecificInfoFromComponents.d.ts +0 -1
- package/dist/admin/src/components/ExitPrompt.d.ts +0 -1
- package/dist/admin/src/components/Footers.d.ts +0 -13
- package/dist/admin/src/components/FormModalNavigation/FormModalNavigationContext.d.ts +0 -19
- package/dist/admin/src/components/FormModalNavigation/FormModalNavigationProvider.d.ts +0 -54
- package/dist/admin/src/components/FormModalNavigation/useFormModalNavigation.d.ts +0 -1
- package/dist/admin/src/components/Status.d.ts +0 -6
- package/dist/admin/src/pages/ListView/EmptyState.d.ts +0 -1
- package/dist/server/controllers/schema.js +0 -55
- package/dist/server/controllers/schema.js.map +0 -1
- package/dist/server/controllers/schema.mjs +0 -53
- package/dist/server/controllers/schema.mjs.map +0 -1
- package/dist/server/controllers/validation/schema.js +0 -612
- package/dist/server/controllers/validation/schema.js.map +0 -1
- package/dist/server/controllers/validation/schema.mjs +0 -610
- package/dist/server/controllers/validation/schema.mjs.map +0 -1
- package/dist/server/services/schema.js +0 -246
- package/dist/server/services/schema.js.map +0 -1
- package/dist/server/services/schema.mjs +0 -242
- package/dist/server/services/schema.mjs.map +0 -1
- package/dist/server/src/controllers/schema.d.ts +0 -8
- package/dist/server/src/controllers/schema.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/schema.d.ts +0 -80968
- package/dist/server/src/controllers/validation/schema.d.ts.map +0 -1
- package/dist/server/src/services/schema.d.ts +0 -2756
- package/dist/server/src/services/schema.d.ts.map +0 -1
|
@@ -5,13 +5,14 @@ import { Modal, Tabs, Flex, Divider, Button } from '@strapi/design-system';
|
|
|
5
5
|
import get from 'lodash/get';
|
|
6
6
|
import has from 'lodash/has';
|
|
7
7
|
import isEqual from 'lodash/isEqual';
|
|
8
|
-
import pick from 'lodash/pick';
|
|
9
8
|
import set from 'lodash/set';
|
|
9
|
+
import toLower from 'lodash/toLower';
|
|
10
10
|
import { useIntl } from 'react-intl';
|
|
11
11
|
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
|
|
12
12
|
import { useNavigate } from 'react-router-dom';
|
|
13
13
|
import { styled } from 'styled-components';
|
|
14
|
-
import
|
|
14
|
+
import { useDataManager } from '../../hooks/useDataManager.mjs';
|
|
15
|
+
import { useFormModalNavigation } from '../../hooks/useFormModalNavigation.mjs';
|
|
15
16
|
import { pluginId } from '../../pluginId.mjs';
|
|
16
17
|
import { getTrad } from '../../utils/getTrad.mjs';
|
|
17
18
|
import { isAllowedContentTypesForRelations } from '../../utils/isAllowedContentTypesForRelations.mjs';
|
|
@@ -24,11 +25,9 @@ import { BooleanRadioGroup } from '../BooleanRadioGroup.mjs';
|
|
|
24
25
|
import { CheckboxWithNumberField } from '../CheckboxWithNumberField.mjs';
|
|
25
26
|
import { ContentTypeRadioGroup } from '../ContentTypeRadioGroup.mjs';
|
|
26
27
|
import { CustomRadioGroup } from '../CustomRadioGroup/CustomRadioGroup.mjs';
|
|
27
|
-
import { useDataManager } from '../DataManager/useDataManager.mjs';
|
|
28
28
|
import { DraftAndPublishToggle } from '../DraftAndPublishToggle.mjs';
|
|
29
29
|
import { FormModalEndActions } from '../FormModalEndActions.mjs';
|
|
30
30
|
import { FormModalHeader } from '../FormModalHeader.mjs';
|
|
31
|
-
import { useFormModalNavigation } from '../FormModalNavigation/useFormModalNavigation.mjs';
|
|
32
31
|
import { FormModalSubHeader } from '../FormModalSubHeader.mjs';
|
|
33
32
|
import { IconPicker } from '../IconPicker/IconPicker.mjs';
|
|
34
33
|
import { PluralName } from '../PluralName.mjs';
|
|
@@ -42,45 +41,68 @@ import { SingularName } from '../SingularName.mjs';
|
|
|
42
41
|
import { TabForm } from '../TabForm.mjs';
|
|
43
42
|
import { TextareaEnum } from '../TextareaEnum.mjs';
|
|
44
43
|
import { forms } from './forms/forms.mjs';
|
|
45
|
-
import { actions
|
|
44
|
+
import { actions } from './reducer.mjs';
|
|
45
|
+
import { makeSelectFormModal } from './selectors.mjs';
|
|
46
46
|
import { canEditContentType } from './utils/canEditContentType.mjs';
|
|
47
47
|
import { createUid, createComponentUid } from './utils/createUid.mjs';
|
|
48
48
|
import { getAttributesToDisplay } from './utils/getAttributesToDisplay.mjs';
|
|
49
49
|
import { getFormInputNames } from './utils/getFormInputNames.mjs';
|
|
50
50
|
|
|
51
|
-
const FormComponent = styled.form`
|
|
51
|
+
/* eslint-disable indent */ /* eslint-disable react/no-array-index-key */ const FormComponent = styled.form`
|
|
52
52
|
overflow: auto;
|
|
53
53
|
`;
|
|
54
|
-
const selectState = (state)=>state['content-type-builder_formModal'] || initialState;
|
|
55
54
|
const FormModal = ()=>{
|
|
56
|
-
const { onCloseModal, onNavigateToChooseAttributeModal, onNavigateToAddCompoToDZModal, onNavigateToCreateComponentStep2, actionType, attributeName, attributeType, customFieldUid, dynamicZoneTarget, forTarget, modalType, isOpen, kind, step, targetUid, showBackLink, activeTab, setActiveTab } = useFormModalNavigation();
|
|
55
|
+
const { onCloseModal, onNavigateToChooseAttributeModal, onNavigateToAddCompoToDZModal, onNavigateToCreateComponentStep2, actionType, attributeName, attributeType, customFieldUid, categoryName, dynamicZoneTarget, forTarget, modalType, isOpen, kind, step, targetUid, showBackLink, activeTab, setActiveTab } = useFormModalNavigation();
|
|
57
56
|
const getPlugin = useStrapiApp('FormModal', (state)=>state.getPlugin);
|
|
58
57
|
const getCustomField = useStrapiApp('FormModal', (state)=>state.customFields.get);
|
|
59
58
|
const customField = getCustomField(customFieldUid);
|
|
59
|
+
const formModalSelector = React.useMemo(makeSelectFormModal, []);
|
|
60
60
|
const dispatch = useDispatch();
|
|
61
61
|
const { toggleNotification } = useNotification();
|
|
62
|
-
const reducerState = useSelector(
|
|
62
|
+
const reducerState = useSelector((state)=>formModalSelector(state), shallowEqual);
|
|
63
63
|
const navigate = useNavigate();
|
|
64
64
|
const { trackUsage } = useTracking();
|
|
65
65
|
const { formatMessage } = useIntl();
|
|
66
66
|
const ctbPlugin = getPlugin(pluginId);
|
|
67
67
|
const ctbFormsAPI = ctbPlugin?.apis.forms;
|
|
68
68
|
const inputsFromPlugins = ctbFormsAPI.components.inputs;
|
|
69
|
-
const { addAttribute,
|
|
69
|
+
const { addAttribute, addCustomFieldAttribute, addCreatedComponentToDynamicZone, allComponentsCategories, changeDynamicZoneComponents, contentTypes, components, createSchema, deleteCategory, deleteData, editCategory, editCustomFieldAttribute, submitData, modifiedData: allDataSchema, nestedComponents, setModifiedData, sortedContentTypesList, updateSchema, reservedNames } = useDataManager();
|
|
70
70
|
const { componentToCreate, formErrors, initialData, isCreatingComponentWhileAddingAField, modifiedData } = reducerState;
|
|
71
|
-
const
|
|
71
|
+
const pathToSchema = forTarget === 'contentType' || forTarget === 'component' ? [
|
|
72
|
+
forTarget
|
|
73
|
+
] : [
|
|
74
|
+
forTarget,
|
|
75
|
+
targetUid
|
|
76
|
+
];
|
|
72
77
|
React.useEffect(()=>{
|
|
73
78
|
if (isOpen) {
|
|
74
79
|
const collectionTypesForRelation = sortedContentTypesList.filter(isAllowedContentTypesForRelations);
|
|
80
|
+
// Reset all the modification when opening the edit category modal
|
|
81
|
+
if (modalType === 'editCategory') {
|
|
82
|
+
setModifiedData();
|
|
83
|
+
}
|
|
75
84
|
if (actionType === 'edit' && modalType === 'attribute' && forTarget === 'contentType') {
|
|
76
85
|
trackUsage('willEditFieldOfContentType');
|
|
77
86
|
}
|
|
87
|
+
const pathToAttributes = [
|
|
88
|
+
...pathToSchema,
|
|
89
|
+
'schema',
|
|
90
|
+
'attributes'
|
|
91
|
+
];
|
|
78
92
|
// Case:
|
|
79
93
|
// the user opens the modal chooseAttributes
|
|
80
94
|
// selects dynamic zone => set the field name
|
|
81
95
|
// then goes to step 1 (the modal is addComponentToDynamicZone) and finally reloads the app.
|
|
82
96
|
// In this particular if the user tries to add components to the zone it will pop an error since the dz is unknown
|
|
83
|
-
const foundDynamicZoneTarget = findAttribute(get(
|
|
97
|
+
const foundDynamicZoneTarget = findAttribute(get(allDataSchema, pathToAttributes, []), dynamicZoneTarget) || null;
|
|
98
|
+
// Edit category
|
|
99
|
+
if (modalType === 'editCategory' && actionType === 'edit') {
|
|
100
|
+
dispatch(actions.setDataToEdit({
|
|
101
|
+
data: {
|
|
102
|
+
name: categoryName
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
84
106
|
// Create content type we need to add the default option draftAndPublish
|
|
85
107
|
if (modalType === 'contentType' && actionType === 'create') {
|
|
86
108
|
dispatch(actions.setDataToEdit({
|
|
@@ -91,24 +113,34 @@ const FormModal = ()=>{
|
|
|
91
113
|
}
|
|
92
114
|
// Edit content type
|
|
93
115
|
if (modalType === 'contentType' && actionType === 'edit') {
|
|
116
|
+
const { displayName, draftAndPublish, kind, pluginOptions, pluralName, singularName } = get(allDataSchema, [
|
|
117
|
+
...pathToSchema,
|
|
118
|
+
'schema'
|
|
119
|
+
], {
|
|
120
|
+
displayName: null,
|
|
121
|
+
pluginOptions: {},
|
|
122
|
+
singularName: null,
|
|
123
|
+
pluralName: null
|
|
124
|
+
});
|
|
94
125
|
dispatch(actions.setDataToEdit({
|
|
95
126
|
data: {
|
|
96
|
-
displayName
|
|
97
|
-
draftAndPublish
|
|
98
|
-
kind
|
|
99
|
-
pluginOptions
|
|
100
|
-
pluralName
|
|
101
|
-
singularName
|
|
127
|
+
displayName,
|
|
128
|
+
draftAndPublish,
|
|
129
|
+
kind,
|
|
130
|
+
pluginOptions,
|
|
131
|
+
pluralName,
|
|
132
|
+
singularName
|
|
102
133
|
}
|
|
103
134
|
}));
|
|
104
135
|
}
|
|
105
136
|
// Edit component
|
|
106
137
|
if (modalType === 'component' && actionType === 'edit') {
|
|
138
|
+
const data = get(allDataSchema, pathToSchema, {});
|
|
107
139
|
dispatch(actions.setDataToEdit({
|
|
108
140
|
data: {
|
|
109
|
-
displayName:
|
|
110
|
-
category:
|
|
111
|
-
icon:
|
|
141
|
+
displayName: data.schema.displayName,
|
|
142
|
+
category: data.category,
|
|
143
|
+
icon: data.schema.icon
|
|
112
144
|
}
|
|
113
145
|
}));
|
|
114
146
|
}
|
|
@@ -131,9 +163,7 @@ const FormModal = ()=>{
|
|
|
131
163
|
}
|
|
132
164
|
// Set the predefined data structure to create an attribute
|
|
133
165
|
if (attributeType) {
|
|
134
|
-
const attributeToEditNotFormatted = findAttribute(get(
|
|
135
|
-
'attributes'
|
|
136
|
-
], []), attributeName);
|
|
166
|
+
const attributeToEditNotFormatted = findAttribute(get(allDataSchema, pathToAttributes, []), attributeName);
|
|
137
167
|
const attributeToEdit = {
|
|
138
168
|
...attributeToEditNotFormatted,
|
|
139
169
|
name: attributeName
|
|
@@ -141,7 +171,7 @@ const FormModal = ()=>{
|
|
|
141
171
|
// We need to set the repeatable key to false when editing a component
|
|
142
172
|
// The API doesn't send this info
|
|
143
173
|
if (attributeType === 'component' && actionType === 'edit') {
|
|
144
|
-
if (!
|
|
174
|
+
if (!attributeToEdit.repeatable) {
|
|
145
175
|
set(attributeToEdit, 'repeatable', false);
|
|
146
176
|
}
|
|
147
177
|
}
|
|
@@ -149,18 +179,13 @@ const FormModal = ()=>{
|
|
|
149
179
|
if (actionType === 'edit') {
|
|
150
180
|
dispatch(actions.setCustomFieldDataSchema({
|
|
151
181
|
isEditing: true,
|
|
152
|
-
modifiedDataToSetForEditing: attributeToEdit
|
|
153
|
-
uid: type.uid
|
|
182
|
+
modifiedDataToSetForEditing: attributeToEdit
|
|
154
183
|
}));
|
|
155
184
|
} else {
|
|
156
185
|
dispatch(actions.setCustomFieldDataSchema({
|
|
157
|
-
customField:
|
|
158
|
-
'type',
|
|
159
|
-
'options'
|
|
160
|
-
]),
|
|
186
|
+
customField: customField,
|
|
161
187
|
isEditing: false,
|
|
162
|
-
modifiedDataToSetForEditing: attributeToEdit
|
|
163
|
-
uid: type.uid
|
|
188
|
+
modifiedDataToSetForEditing: attributeToEdit
|
|
164
189
|
}));
|
|
165
190
|
}
|
|
166
191
|
} else {
|
|
@@ -176,8 +201,7 @@ const FormModal = ()=>{
|
|
|
176
201
|
], 'error'),
|
|
177
202
|
isEditing: actionType === 'edit',
|
|
178
203
|
modifiedDataToSetForEditing: attributeToEdit,
|
|
179
|
-
step
|
|
180
|
-
uid: type.uid
|
|
204
|
+
step
|
|
181
205
|
}));
|
|
182
206
|
}
|
|
183
207
|
}
|
|
@@ -189,6 +213,7 @@ const FormModal = ()=>{
|
|
|
189
213
|
actionType,
|
|
190
214
|
attributeName,
|
|
191
215
|
attributeType,
|
|
216
|
+
categoryName,
|
|
192
217
|
dynamicZoneTarget,
|
|
193
218
|
forTarget,
|
|
194
219
|
isOpen,
|
|
@@ -202,9 +227,12 @@ const FormModal = ()=>{
|
|
|
202
227
|
const isCreating = actionType === 'create';
|
|
203
228
|
const isCreatingComponentFromAView = get(modifiedData, 'createComponent', false) || isCreatingComponentWhileAddingAField;
|
|
204
229
|
const isInFirstComponentStep = step === '1';
|
|
230
|
+
const isEditingCategory = modalType === 'editCategory';
|
|
205
231
|
const isPickingAttribute = modalType === 'chooseAttribute';
|
|
206
232
|
const uid = createUid(modifiedData.displayName || '');
|
|
207
|
-
const attributes = get(
|
|
233
|
+
const attributes = get(allDataSchema, [
|
|
234
|
+
...pathToSchema,
|
|
235
|
+
'schema',
|
|
208
236
|
'attributes'
|
|
209
237
|
], null);
|
|
210
238
|
const checkFormValidity = async ()=>{
|
|
@@ -213,14 +241,22 @@ const FormModal = ()=>{
|
|
|
213
241
|
// Check form validity for content type
|
|
214
242
|
if (isCreatingContentType) {
|
|
215
243
|
schema = forms.contentType.schema(Object.keys(contentTypes), actionType === 'edit', // currentUID
|
|
216
|
-
|
|
244
|
+
get(allDataSchema, [
|
|
245
|
+
...pathToSchema,
|
|
246
|
+
'uid'
|
|
247
|
+
], null), reservedNames, ctbFormsAPI, contentTypes);
|
|
217
248
|
// Check form validity for component
|
|
218
249
|
// This is happening when the user click on the link from the left menu
|
|
219
250
|
} else if (isCreatingComponent) {
|
|
220
|
-
schema = forms.component.schema(Object.keys(components), modifiedData.category || '', reservedNames, actionType === 'edit', components, modifiedData.displayName || '',
|
|
251
|
+
schema = forms.component.schema(Object.keys(components), modifiedData.category || '', reservedNames, actionType === 'edit', components, modifiedData.displayName || '', get(allDataSchema, [
|
|
252
|
+
...pathToSchema,
|
|
253
|
+
'uid'
|
|
254
|
+
], null));
|
|
221
255
|
} else if (isCreatingCustomFieldAttribute) {
|
|
222
256
|
schema = forms.customField.schema({
|
|
223
|
-
schemaAttributes: get(
|
|
257
|
+
schemaAttributes: get(allDataSchema, [
|
|
258
|
+
...pathToSchema,
|
|
259
|
+
'schema',
|
|
224
260
|
'attributes'
|
|
225
261
|
], []),
|
|
226
262
|
attributeType: customField.type,
|
|
@@ -241,14 +277,15 @@ const FormModal = ()=>{
|
|
|
241
277
|
// Check form validity for creating a 'common attribute'
|
|
242
278
|
// We need to make sure that it is independent from the step
|
|
243
279
|
} else if (isCreatingAttribute && !isInFirstComponentStep) {
|
|
244
|
-
const
|
|
280
|
+
const type = attributeType === 'relation' ? 'relation' : modifiedData.type;
|
|
245
281
|
let alreadyTakenTargetContentTypeAttributes = [];
|
|
246
|
-
if (
|
|
282
|
+
if (type === 'relation') {
|
|
247
283
|
const targetContentTypeUID = get(modifiedData, [
|
|
248
284
|
'target'
|
|
249
285
|
], null);
|
|
250
286
|
const targetContentTypeAttributes = get(contentTypes, [
|
|
251
287
|
targetContentTypeUID,
|
|
288
|
+
'schema',
|
|
252
289
|
'attributes'
|
|
253
290
|
], []);
|
|
254
291
|
// Create an array with all the targetContentType attributes name
|
|
@@ -263,10 +300,12 @@ const FormModal = ()=>{
|
|
|
263
300
|
return attrName !== initialData.targetAttribute;
|
|
264
301
|
});
|
|
265
302
|
}
|
|
266
|
-
schema = forms.attribute.schema(
|
|
303
|
+
schema = forms.attribute.schema(get(allDataSchema, pathToSchema, {}), type, reservedNames, alreadyTakenTargetContentTypeAttributes, {
|
|
267
304
|
modifiedData,
|
|
268
305
|
initialData
|
|
269
306
|
}, ctbFormsAPI);
|
|
307
|
+
} else if (isEditingCategory) {
|
|
308
|
+
schema = forms.editCategory.schema(allComponentsCategories, initialData);
|
|
270
309
|
} else {
|
|
271
310
|
// The user is either in the addComponentToDynamicZone modal or
|
|
272
311
|
// in step 1 of the add component (modalType=attribute&attributeType=component) but not creating a component
|
|
@@ -325,45 +364,29 @@ const FormModal = ()=>{
|
|
|
325
364
|
e.preventDefault();
|
|
326
365
|
try {
|
|
327
366
|
await checkFormValidity();
|
|
328
|
-
dispatch(actions.setErrors({
|
|
329
|
-
errors: {}
|
|
330
|
-
}));
|
|
331
367
|
sendButtonAddMoreFieldEvent(shouldContinue);
|
|
332
|
-
const ctTargetUid = targetUid;
|
|
368
|
+
const ctTargetUid = forTarget === 'components' ? targetUid : uid;
|
|
333
369
|
if (isCreatingContentType) {
|
|
334
370
|
// Create the content type schema
|
|
335
371
|
if (isCreating) {
|
|
336
372
|
createSchema({
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
draftAndPublish: modifiedData.draftAndPublish,
|
|
341
|
-
pluginOptions: modifiedData.pluginOptions,
|
|
342
|
-
singularName: modifiedData.singularName,
|
|
343
|
-
pluralName: modifiedData.pluralName
|
|
344
|
-
},
|
|
345
|
-
uid
|
|
346
|
-
});
|
|
373
|
+
...modifiedData,
|
|
374
|
+
kind
|
|
375
|
+
}, modalType, uid);
|
|
347
376
|
// Redirect the user to the created content type
|
|
348
377
|
navigate({
|
|
349
378
|
pathname: `/plugins/${pluginId}/content-types/${uid}`
|
|
350
379
|
});
|
|
351
|
-
|
|
380
|
+
// Navigate to the choose attribute modal
|
|
381
|
+
onNavigateToChooseAttributeModal({
|
|
382
|
+
forTarget,
|
|
383
|
+
targetUid: ctTargetUid
|
|
384
|
+
});
|
|
352
385
|
} else {
|
|
353
|
-
// NOTE: we have to assume we have a CT here until we refactor more
|
|
354
|
-
const contentType = type;
|
|
355
386
|
// We cannot switch from collection type to single when the modal is making relations other than oneWay or manyWay
|
|
356
|
-
if (canEditContentType(
|
|
387
|
+
if (canEditContentType(allDataSchema, modifiedData)) {
|
|
357
388
|
onCloseModal();
|
|
358
|
-
await
|
|
359
|
-
uid: contentType.uid,
|
|
360
|
-
data: {
|
|
361
|
-
displayName: modifiedData.displayName,
|
|
362
|
-
kind: modifiedData.kind,
|
|
363
|
-
draftAndPublish: modifiedData.draftAndPublish,
|
|
364
|
-
pluginOptions: modifiedData.pluginOptions
|
|
365
|
-
}
|
|
366
|
-
});
|
|
389
|
+
await submitData(modifiedData);
|
|
367
390
|
} else {
|
|
368
391
|
toggleNotification({
|
|
369
392
|
type: 'danger',
|
|
@@ -380,42 +403,32 @@ const FormModal = ()=>{
|
|
|
380
403
|
// Create the component schema
|
|
381
404
|
const componentUid = createComponentUid(modifiedData.displayName, modifiedData.category);
|
|
382
405
|
const { category, ...rest } = modifiedData;
|
|
383
|
-
|
|
384
|
-
data: {
|
|
385
|
-
displayName: rest.displayName,
|
|
386
|
-
icon: rest.icon
|
|
387
|
-
},
|
|
388
|
-
uid: componentUid,
|
|
389
|
-
componentCategory: category
|
|
390
|
-
});
|
|
406
|
+
createSchema(rest, 'component', componentUid, category);
|
|
391
407
|
// Redirect the user to the created component
|
|
392
408
|
navigate({
|
|
393
409
|
pathname: `/plugins/${pluginId}/component-categories/${category}/${componentUid}`
|
|
394
410
|
});
|
|
411
|
+
// Navigate to the choose attribute modal
|
|
412
|
+
onNavigateToChooseAttributeModal({
|
|
413
|
+
forTarget,
|
|
414
|
+
targetUid: componentUid
|
|
415
|
+
});
|
|
416
|
+
} else {
|
|
417
|
+
updateSchema(modifiedData, modalType, targetUid);
|
|
418
|
+
// Close the modal
|
|
395
419
|
onCloseModal();
|
|
396
420
|
return;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
icon: modifiedData.icon,
|
|
401
|
-
displayName: modifiedData.displayName
|
|
402
|
-
},
|
|
403
|
-
componentUID: targetUid
|
|
404
|
-
});
|
|
405
|
-
if (type.status === 'NEW') {
|
|
406
|
-
const componentUid = createComponentUid(modifiedData.displayName, modifiedData.category);
|
|
407
|
-
updateComponentUid({
|
|
408
|
-
componentUID: targetUid,
|
|
409
|
-
newComponentUID: componentUid
|
|
410
|
-
});
|
|
411
|
-
navigate({
|
|
412
|
-
pathname: `/plugins/${pluginId}/component-categories/${modifiedData.category}/${componentUid}`
|
|
413
|
-
});
|
|
414
|
-
}
|
|
421
|
+
}
|
|
422
|
+
} else if (isEditingCategory) {
|
|
423
|
+
if (toLower(initialData.name) === toLower(modifiedData.name)) {
|
|
415
424
|
// Close the modal
|
|
416
425
|
onCloseModal();
|
|
417
426
|
return;
|
|
418
427
|
}
|
|
428
|
+
editCategory(initialData.name, modifiedData);
|
|
429
|
+
return;
|
|
430
|
+
// Add/edit a field to a content type
|
|
431
|
+
// Add/edit a field to a created component (the end modal is not step 2)
|
|
419
432
|
} else if (isCreatingCustomFieldAttribute) {
|
|
420
433
|
const customFieldAttributeUpdate = {
|
|
421
434
|
attributeToSet: {
|
|
@@ -424,7 +437,7 @@ const FormModal = ()=>{
|
|
|
424
437
|
},
|
|
425
438
|
forTarget,
|
|
426
439
|
targetUid,
|
|
427
|
-
|
|
440
|
+
initialAttribute: initialData
|
|
428
441
|
};
|
|
429
442
|
if (actionType === 'edit') {
|
|
430
443
|
editCustomFieldAttribute(customFieldAttributeUpdate);
|
|
@@ -444,20 +457,7 @@ const FormModal = ()=>{
|
|
|
444
457
|
const isDynamicZoneAttribute = attributeType === 'dynamiczone';
|
|
445
458
|
// The user is creating a DZ (he had entered the name of the dz)
|
|
446
459
|
if (isDynamicZoneAttribute) {
|
|
447
|
-
|
|
448
|
-
addAttribute({
|
|
449
|
-
attributeToSet: modifiedData,
|
|
450
|
-
forTarget,
|
|
451
|
-
targetUid
|
|
452
|
-
});
|
|
453
|
-
} else {
|
|
454
|
-
editAttribute({
|
|
455
|
-
attributeToSet: modifiedData,
|
|
456
|
-
forTarget,
|
|
457
|
-
targetUid,
|
|
458
|
-
name: initialData.name
|
|
459
|
-
});
|
|
460
|
-
}
|
|
460
|
+
addAttribute(modifiedData, forTarget, targetUid, actionType === 'edit', initialData);
|
|
461
461
|
// Adding a component to a dynamiczone is not the same logic as creating a simple field
|
|
462
462
|
// so the search is different
|
|
463
463
|
if (isCreating) {
|
|
@@ -474,20 +474,7 @@ const FormModal = ()=>{
|
|
|
474
474
|
}
|
|
475
475
|
// Normal fields like boolean relations or dynamic zone
|
|
476
476
|
if (!isComponentAttribute) {
|
|
477
|
-
|
|
478
|
-
addAttribute({
|
|
479
|
-
attributeToSet: modifiedData,
|
|
480
|
-
forTarget,
|
|
481
|
-
targetUid
|
|
482
|
-
});
|
|
483
|
-
} else {
|
|
484
|
-
editAttribute({
|
|
485
|
-
attributeToSet: modifiedData,
|
|
486
|
-
forTarget,
|
|
487
|
-
targetUid,
|
|
488
|
-
name: initialData.name
|
|
489
|
-
});
|
|
490
|
-
}
|
|
477
|
+
addAttribute(modifiedData, forTarget, targetUid, actionType === 'edit', initialData);
|
|
491
478
|
if (shouldContinue) {
|
|
492
479
|
onNavigateToChooseAttributeModal({
|
|
493
480
|
forTarget,
|
|
@@ -507,28 +494,18 @@ const FormModal = ()=>{
|
|
|
507
494
|
// This way we don't have to add some logic to re-run the useEffect
|
|
508
495
|
// The first step is either needed to create a component or just to navigate
|
|
509
496
|
// To the modal for adding a "common field"
|
|
510
|
-
dispatch(actions.resetPropsAndSetFormForAddingAnExistingCompo({
|
|
511
|
-
uid: type.uid
|
|
512
|
-
}));
|
|
497
|
+
dispatch(actions.resetPropsAndSetFormForAddingAnExistingCompo({}));
|
|
513
498
|
// We don't want all the props to be reset
|
|
514
499
|
return;
|
|
515
500
|
// Here we are in step 2
|
|
516
501
|
// The step 2 is also use to edit an attribute that is a component
|
|
517
502
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
} else {
|
|
525
|
-
editAttribute({
|
|
526
|
-
attributeToSet: modifiedData,
|
|
527
|
-
forTarget,
|
|
528
|
-
targetUid,
|
|
529
|
-
name: initialData.name
|
|
530
|
-
});
|
|
531
|
-
}
|
|
503
|
+
addAttribute(modifiedData, forTarget, targetUid, // This change the dispatched type
|
|
504
|
+
// either 'editAttribute' or 'addAttribute' in the DataManagerProvider
|
|
505
|
+
actionType === 'edit', // This is for the edit part
|
|
506
|
+
initialData, // Passing true will add the component to the components object
|
|
507
|
+
// This way we can add fields to the added component (if it wasn't there already)
|
|
508
|
+
true);
|
|
532
509
|
if (shouldContinue) {
|
|
533
510
|
onNavigateToChooseAttributeModal({
|
|
534
511
|
forTarget,
|
|
@@ -551,40 +528,33 @@ const FormModal = ()=>{
|
|
|
551
528
|
trackUsage('willCreateComponentFromAttributesModal');
|
|
552
529
|
// Here we clear the reducer state but we also keep the created component
|
|
553
530
|
// If we were to create the component before
|
|
554
|
-
dispatch(actions.resetPropsAndSaveCurrentData({
|
|
555
|
-
uid: type.uid
|
|
556
|
-
}));
|
|
531
|
+
dispatch(actions.resetPropsAndSaveCurrentData({}));
|
|
557
532
|
onNavigateToCreateComponentStep2();
|
|
558
533
|
// Terminate because we don't want the reducer to be entirely reset
|
|
559
534
|
return;
|
|
560
535
|
// Step 2 of creating a component (which is setting the attribute name in the parent's schema)
|
|
561
536
|
}
|
|
562
537
|
// We are destructuring because the modifiedData object doesn't have the appropriate format to create a field
|
|
563
|
-
const { category, ...rest } = componentToCreate;
|
|
538
|
+
const { category, type, ...rest } = componentToCreate;
|
|
564
539
|
// Create a the component temp UID
|
|
565
540
|
// This could be refactored but I think it's more understandable to separate the logic
|
|
566
541
|
const componentUid = createComponentUid(componentToCreate.displayName, category);
|
|
567
542
|
// Create the component first and add it to the components data
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
});
|
|
543
|
+
createSchema(// Component data
|
|
544
|
+
rest, // Type will always be component
|
|
545
|
+
// It will dispatch the CREATE_COMPONENT_SCHEMA action
|
|
546
|
+
// So the component will be added in the main components object
|
|
547
|
+
// This might not be needed if we don't allow navigation between entries while editing
|
|
548
|
+
type, componentUid, category, // This will add the created component in the datamanager modifiedData components key
|
|
549
|
+
// Like explained above we will be able to modify the created component structure
|
|
550
|
+
isCreatingComponentFromAView);
|
|
577
551
|
// Add the field to the schema
|
|
578
|
-
addAttribute(
|
|
579
|
-
attributeToSet: modifiedData,
|
|
580
|
-
forTarget,
|
|
581
|
-
targetUid
|
|
582
|
-
});
|
|
552
|
+
addAttribute(modifiedData, forTarget, targetUid, false);
|
|
583
553
|
dispatch(actions.resetProps());
|
|
584
554
|
// Open modal attribute for adding attr to component
|
|
585
555
|
if (shouldContinue) {
|
|
586
556
|
onNavigateToChooseAttributeModal({
|
|
587
|
-
forTarget: '
|
|
557
|
+
forTarget: 'components',
|
|
588
558
|
targetUid: componentUid
|
|
589
559
|
});
|
|
590
560
|
} else {
|
|
@@ -598,35 +568,28 @@ const FormModal = ()=>{
|
|
|
598
568
|
const { category, type, ...rest } = modifiedData.componentToCreate;
|
|
599
569
|
const componentUid = createComponentUid(modifiedData.componentToCreate.displayName, category);
|
|
600
570
|
// Create the component first and add it to the components data
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
571
|
+
createSchema(// Component data
|
|
572
|
+
rest, // Type will always be component
|
|
573
|
+
// It will dispatch the CREATE_COMPONENT_SCHEMA action
|
|
574
|
+
// So the component will be added in the main components object
|
|
575
|
+
// This might not be needed if we don't allow navigation between entries while editing
|
|
576
|
+
type, componentUid, category, // This will add the created component in the datamanager modifiedData components key
|
|
577
|
+
// Like explained above we will be able to modify the created component structure
|
|
578
|
+
isCreatingComponentFromAView);
|
|
606
579
|
// Add the created component to the DZ
|
|
607
580
|
// We don't want to remove the old ones
|
|
608
|
-
addCreatedComponentToDynamicZone(
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
dynamicZoneTarget,
|
|
612
|
-
componentsToAdd: [
|
|
613
|
-
componentUid
|
|
614
|
-
]
|
|
615
|
-
});
|
|
581
|
+
addCreatedComponentToDynamicZone(dynamicZoneTarget, [
|
|
582
|
+
componentUid
|
|
583
|
+
]);
|
|
616
584
|
// The Dynamic Zone and the component is created
|
|
617
585
|
// Open the modal to add fields to the created component
|
|
618
586
|
onNavigateToChooseAttributeModal({
|
|
619
|
-
forTarget: '
|
|
587
|
+
forTarget: 'components',
|
|
620
588
|
targetUid: componentUid
|
|
621
589
|
});
|
|
622
590
|
} else {
|
|
623
591
|
// Add the components to the DZ
|
|
624
|
-
changeDynamicZoneComponents(
|
|
625
|
-
forTarget,
|
|
626
|
-
targetUid,
|
|
627
|
-
dynamicZoneTarget,
|
|
628
|
-
newComponents: modifiedData.components
|
|
629
|
-
});
|
|
592
|
+
changeDynamicZoneComponents(dynamicZoneTarget, modifiedData.components);
|
|
630
593
|
onCloseModal();
|
|
631
594
|
}
|
|
632
595
|
} else {
|
|
@@ -636,12 +599,10 @@ const FormModal = ()=>{
|
|
|
636
599
|
}
|
|
637
600
|
dispatch(actions.resetProps());
|
|
638
601
|
} catch (err) {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}));
|
|
644
|
-
}
|
|
602
|
+
const errors = getYupInnerErrors(err);
|
|
603
|
+
dispatch(actions.setErrors({
|
|
604
|
+
errors
|
|
605
|
+
}));
|
|
645
606
|
}
|
|
646
607
|
};
|
|
647
608
|
const handleConfirmClose = ()=>{
|
|
@@ -683,6 +644,9 @@ const FormModal = ()=>{
|
|
|
683
644
|
}
|
|
684
645
|
};
|
|
685
646
|
const shouldDisableAdvancedTab = ()=>{
|
|
647
|
+
if (modalType === 'editCategory') {
|
|
648
|
+
return true;
|
|
649
|
+
}
|
|
686
650
|
if (modalType === 'component') {
|
|
687
651
|
return true;
|
|
688
652
|
}
|
|
@@ -708,7 +672,7 @@ const FormModal = ()=>{
|
|
|
708
672
|
sections: []
|
|
709
673
|
})
|
|
710
674
|
});
|
|
711
|
-
const isAddingAComponentToAnotherComponent = forTarget === 'component';
|
|
675
|
+
const isAddingAComponentToAnotherComponent = forTarget === 'components' || forTarget === 'component';
|
|
712
676
|
const genericInputProps = {
|
|
713
677
|
customInputs: {
|
|
714
678
|
'allowed-types-select': AllowedTypesSelect,
|
|
@@ -735,8 +699,9 @@ const FormModal = ()=>{
|
|
|
735
699
|
formErrors,
|
|
736
700
|
isAddingAComponentToAnotherComponent,
|
|
737
701
|
isCreatingComponentWhileAddingAField,
|
|
738
|
-
mainBoxHeader: get(
|
|
739
|
-
|
|
702
|
+
mainBoxHeader: get(allDataSchema, [
|
|
703
|
+
...pathToSchema,
|
|
704
|
+
'schema',
|
|
740
705
|
'displayName'
|
|
741
706
|
], ''),
|
|
742
707
|
modifiedData,
|
|
@@ -753,7 +718,7 @@ const FormModal = ()=>{
|
|
|
753
718
|
attributes,
|
|
754
719
|
extensions: ctbFormsAPI,
|
|
755
720
|
forTarget,
|
|
756
|
-
contentTypeSchema:
|
|
721
|
+
contentTypeSchema: allDataSchema.contentType || {},
|
|
757
722
|
customField
|
|
758
723
|
}).sections;
|
|
759
724
|
const baseForm = formToDisplay.base({
|
|
@@ -764,7 +729,7 @@ const FormModal = ()=>{
|
|
|
764
729
|
attributes,
|
|
765
730
|
extensions: ctbFormsAPI,
|
|
766
731
|
forTarget,
|
|
767
|
-
contentTypeSchema:
|
|
732
|
+
contentTypeSchema: allDataSchema.contentType || {},
|
|
768
733
|
customField
|
|
769
734
|
}).sections;
|
|
770
735
|
const baseFormInputNames = getFormInputNames(baseForm);
|
|
@@ -773,6 +738,7 @@ const FormModal = ()=>{
|
|
|
773
738
|
const doesAdvancedFormHasError = Object.keys(formErrors).some((key)=>advancedFormInputNames.includes(key));
|
|
774
739
|
const schemaKind = get(contentTypes, [
|
|
775
740
|
targetUid,
|
|
741
|
+
'schema',
|
|
776
742
|
'kind'
|
|
777
743
|
]);
|
|
778
744
|
const checkIsEditingFieldName = ()=>actionType === 'edit' && attributes.every(({ name })=>name !== modifiedData?.name);
|
|
@@ -789,6 +755,7 @@ const FormModal = ()=>{
|
|
|
789
755
|
/*#__PURE__*/ jsx(FormModalHeader, {
|
|
790
756
|
actionType: actionType,
|
|
791
757
|
attributeName: attributeName,
|
|
758
|
+
categoryName: categoryName,
|
|
792
759
|
contentTypeKind: kind,
|
|
793
760
|
dynamicZoneTarget: dynamicZoneTarget,
|
|
794
761
|
modalType: modalType,
|
|
@@ -889,20 +856,18 @@ const FormModal = ()=>{
|
|
|
889
856
|
/*#__PURE__*/ jsxs(Modal.Footer, {
|
|
890
857
|
children: [
|
|
891
858
|
/*#__PURE__*/ jsx(Button, {
|
|
892
|
-
type: "button",
|
|
893
859
|
variant: "tertiary",
|
|
894
|
-
onClick:
|
|
895
|
-
e.preventDefault();
|
|
896
|
-
handleClosed();
|
|
897
|
-
},
|
|
860
|
+
onClick: handleClosed,
|
|
898
861
|
children: formatMessage({
|
|
899
862
|
id: 'app.components.Button.cancel',
|
|
900
863
|
defaultMessage: 'Cancel'
|
|
901
864
|
})
|
|
902
865
|
}),
|
|
903
866
|
/*#__PURE__*/ jsx(FormModalEndActions, {
|
|
904
|
-
|
|
905
|
-
|
|
867
|
+
deleteCategory: deleteCategory,
|
|
868
|
+
deleteContentType: deleteData,
|
|
869
|
+
deleteComponent: deleteData,
|
|
870
|
+
categoryName: initialData.name,
|
|
906
871
|
isAttributeModal: modalType === 'attribute',
|
|
907
872
|
isCustomFieldModal: modalType === 'customField',
|
|
908
873
|
isComponentToDzModal: modalType === 'addComponentToDynamicZone',
|
|
@@ -917,6 +882,7 @@ const FormModal = ()=>{
|
|
|
917
882
|
isCreatingContentType: actionType === 'create',
|
|
918
883
|
isEditingAttribute: actionType === 'edit',
|
|
919
884
|
isDzAttribute: attributeType === 'dynamiczone',
|
|
885
|
+
isEditingCategory: modalType === 'editCategory',
|
|
920
886
|
isInFirstComponentStep: step === '1',
|
|
921
887
|
onSubmitAddComponentAttribute: handleSubmit,
|
|
922
888
|
onSubmitAddComponentToDz: handleSubmit,
|
|
@@ -924,6 +890,7 @@ const FormModal = ()=>{
|
|
|
924
890
|
onSubmitCreateContentType: handleSubmit,
|
|
925
891
|
onSubmitCreateDz: handleSubmit,
|
|
926
892
|
onSubmitEditAttribute: handleSubmit,
|
|
893
|
+
onSubmitEditCategory: handleSubmit,
|
|
927
894
|
onSubmitEditComponent: handleSubmit,
|
|
928
895
|
onSubmitEditContentType: handleSubmit,
|
|
929
896
|
onSubmitEditCustomFieldAttribute: handleSubmit,
|