@webiny/app-headless-cms 0.0.0-unstable.40876133bb → 0.0.0-unstable.496cf268ac
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/HeadlessCMS.js +10 -19
- package/HeadlessCMS.js.map +1 -1
- package/admin/components/ContentEntryForm/ContentEntryForm.js +34 -59
- package/admin/components/ContentEntryForm/ContentEntryForm.js.map +1 -1
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js +0 -16
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js.map +1 -1
- package/admin/components/ContentEntryForm/Fields.d.ts +2 -2
- package/admin/components/ContentEntryForm/Fields.js +4 -11
- package/admin/components/ContentEntryForm/Fields.js.map +1 -1
- package/admin/components/ContentEntryForm/Label.js +0 -8
- package/admin/components/ContentEntryForm/Label.js.map +1 -1
- package/admin/components/ContentEntryForm/RenderFieldElement.d.ts +2 -2
- package/admin/components/ContentEntryForm/RenderFieldElement.js +7 -18
- package/admin/components/ContentEntryForm/RenderFieldElement.js.map +1 -1
- package/admin/components/ContentEntryForm/functions/getValue.d.ts +2 -2
- package/admin/components/ContentEntryForm/functions/getValue.js +2 -8
- package/admin/components/ContentEntryForm/functions/getValue.js.map +1 -1
- package/admin/components/ContentEntryForm/functions/setValue.d.ts +2 -2
- package/admin/components/ContentEntryForm/functions/setValue.js +3 -9
- package/admin/components/ContentEntryForm/functions/setValue.js.map +1 -1
- package/admin/components/ContentEntryForm/useBind.d.ts +2 -2
- package/admin/components/ContentEntryForm/useBind.js +20 -37
- package/admin/components/ContentEntryForm/useBind.js.map +1 -1
- package/admin/components/ContentEntryForm/useContentEntryForm.d.ts +1 -2
- package/admin/components/ContentEntryForm/useContentEntryForm.js +269 -350
- package/admin/components/ContentEntryForm/useContentEntryForm.js.map +1 -1
- package/admin/components/ContentEntryForm/useRenderPlugins.js +0 -3
- package/admin/components/ContentEntryForm/useRenderPlugins.js.map +1 -1
- package/admin/components/ContentModelEditor/{Context.d.ts → ContentModelEditorProvider.d.ts} +10 -4
- package/admin/components/ContentModelEditor/ContentModelEditorProvider.js +260 -0
- package/admin/components/ContentModelEditor/ContentModelEditorProvider.js.map +1 -0
- package/admin/components/ContentModelEditor/Editor.d.ts +4 -1
- package/admin/components/ContentModelEditor/Editor.js +9 -42
- package/admin/components/ContentModelEditor/Editor.js.map +1 -1
- package/admin/components/ContentModelEditor/FieldsSidebar.js +5 -17
- package/admin/components/ContentModelEditor/FieldsSidebar.js.map +1 -1
- package/admin/components/ContentModelEditor/Header.js +0 -8
- package/admin/components/ContentModelEditor/Header.js.map +1 -1
- package/admin/components/ContentModelEditor/PreviewTab.js +3 -18
- package/admin/components/ContentModelEditor/PreviewTab.js.map +1 -1
- package/admin/components/ContentModelEditor/index.d.ts +2 -0
- package/admin/components/ContentModelEditor/index.js +27 -0
- package/admin/components/ContentModelEditor/index.js.map +1 -0
- package/admin/components/ContentModelEditor/useModelEditor.d.ts +1 -0
- package/admin/components/ContentModelEditor/{useContentModelEditor.js → useModelEditor.js} +4 -10
- package/admin/components/ContentModelEditor/useModelEditor.js.map +1 -0
- package/admin/{views/contentModelGroups → components}/DelayedOnChange.js +6 -31
- package/admin/{views/contentModelGroups → components}/DelayedOnChange.js.map +1 -1
- package/admin/components/Dialog.d.ts +8 -0
- package/admin/components/Dialog.js +28 -0
- package/admin/components/Dialog.js.map +1 -0
- package/admin/components/DragPreview.js +21 -39
- package/admin/components/DragPreview.js.map +1 -1
- package/admin/components/Draggable.js +28 -40
- package/admin/components/Draggable.js.map +1 -1
- package/admin/components/DropZone/Center.d.ts +2 -1
- package/admin/components/DropZone/Center.js +34 -53
- package/admin/components/DropZone/Center.js.map +1 -1
- package/admin/components/DropZone/Horizontal.js +5 -16
- package/admin/components/DropZone/Horizontal.js.map +1 -1
- package/admin/components/DropZone/Vertical.js +5 -15
- package/admin/components/DropZone/Vertical.js.map +1 -1
- package/admin/components/DropZone/index.js +0 -4
- package/admin/components/DropZone/index.js.map +1 -1
- package/admin/components/Droppable.d.ts +1 -0
- package/admin/components/Droppable.js +32 -34
- package/admin/components/Droppable.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.d.ts +2 -8
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js +16 -32
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.d.ts +2 -9
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +30 -44
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.d.ts +2 -9
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js +23 -46
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog/ValidationsSection.d.ts +10 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidationsSection.js +34 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidationsSection.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsList.d.ts +8 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsList.js +189 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsList.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.js +2 -8
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.js +3 -10
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog/getValidators.d.ts +13 -0
- package/admin/components/FieldEditor/EditFieldDialog/getValidators.js +91 -0
- package/admin/components/FieldEditor/EditFieldDialog/getValidators.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog.d.ts +3 -3
- package/admin/components/FieldEditor/EditFieldDialog.js +108 -289
- package/admin/components/FieldEditor/EditFieldDialog.js.map +1 -1
- package/admin/components/FieldEditor/Field.d.ts +5 -5
- package/admin/components/FieldEditor/Field.js +267 -111
- package/admin/components/FieldEditor/Field.js.map +1 -1
- package/admin/components/FieldEditor/FieldEditor.d.ts +4 -4
- package/admin/components/FieldEditor/FieldEditor.js +74 -58
- package/admin/components/FieldEditor/FieldEditor.js.map +1 -1
- package/admin/components/FieldEditor/FieldEditorContext.d.ts +20 -16
- package/admin/components/FieldEditor/FieldEditorContext.js +65 -118
- package/admin/components/FieldEditor/FieldEditorContext.js.map +1 -1
- package/admin/components/FieldEditor/Styled.d.ts +9 -3
- package/admin/components/FieldEditor/Styled.js +4 -17
- package/admin/components/FieldEditor/Styled.js.map +1 -1
- package/admin/components/FieldEditor/index.d.ts +1 -1
- package/admin/components/FieldEditor/index.js +3 -5
- package/admin/components/FieldEditor/index.js.map +1 -1
- package/admin/components/FieldEditor/useModelFieldEditor.d.ts +2 -0
- package/admin/components/FieldEditor/useModelFieldEditor.js +15 -0
- package/admin/components/FieldEditor/useModelFieldEditor.js.map +1 -0
- package/admin/components/FieldEditor/utils/deleteField.d.ts +2 -2
- package/admin/components/FieldEditor/utils/deleteField.js +4 -13
- package/admin/components/FieldEditor/utils/deleteField.js.map +1 -1
- package/admin/components/FieldEditor/utils/getFieldPosition.d.ts +2 -2
- package/admin/components/FieldEditor/utils/getFieldPosition.js +1 -6
- package/admin/components/FieldEditor/utils/getFieldPosition.js.map +1 -1
- package/admin/components/FieldEditor/utils/index.js +0 -5
- package/admin/components/FieldEditor/utils/index.js.map +1 -1
- package/admin/components/FieldEditor/utils/moveField.d.ts +3 -3
- package/admin/components/FieldEditor/utils/moveField.js +7 -17
- package/admin/components/FieldEditor/utils/moveField.js.map +1 -1
- package/admin/components/FieldEditor/utils/moveRow.js +2 -7
- package/admin/components/FieldEditor/utils/moveRow.js.map +1 -1
- package/admin/components/IconPicker.d.ts +7 -0
- package/admin/{views/contentModelGroups → components}/IconPicker.js +50 -72
- package/admin/components/IconPicker.js.map +1 -0
- package/admin/components/ModelFieldProvider/ModelFieldContext.d.ts +36 -0
- package/admin/components/ModelFieldProvider/ModelFieldContext.js +18 -0
- package/admin/components/ModelFieldProvider/ModelFieldContext.js.map +1 -0
- package/admin/components/ModelFieldProvider/index.d.ts +2 -0
- package/admin/components/ModelFieldProvider/index.js +27 -0
- package/admin/components/ModelFieldProvider/index.js.map +1 -0
- package/admin/components/ModelFieldProvider/useModelField.d.ts +35 -0
- package/admin/components/ModelFieldProvider/useModelField.js +33 -0
- package/admin/components/ModelFieldProvider/useModelField.js.map +1 -0
- package/admin/components/ModelProvider/ModelContext.d.ts +9 -0
- package/admin/components/ModelProvider/ModelContext.js +18 -0
- package/admin/components/ModelProvider/ModelContext.js.map +1 -0
- package/admin/components/ModelProvider/index.d.ts +2 -0
- package/admin/components/ModelProvider/index.js +27 -0
- package/admin/components/ModelProvider/index.js.map +1 -0
- package/admin/components/ModelProvider/useModel.d.ts +9 -0
- package/admin/components/ModelProvider/useModel.js +20 -0
- package/admin/components/ModelProvider/useModel.js.map +1 -0
- package/admin/constants/statusLabels.js +0 -6
- package/admin/constants/statusLabels.js.map +1 -1
- package/admin/contexts/Cms/NetworkError.js +0 -5
- package/admin/contexts/Cms/NetworkError.js.map +1 -1
- package/admin/contexts/Cms/index.js +29 -70
- package/admin/contexts/Cms/index.js.map +1 -1
- package/admin/elements/ContentGroupMenuElement.js +0 -11
- package/admin/elements/ContentGroupMenuElement.js.map +1 -1
- package/admin/elements/ContentModelMenuElement.js +0 -11
- package/admin/elements/ContentModelMenuElement.js.map +1 -1
- package/admin/elements/NothingToShowElement.js +0 -24
- package/admin/elements/NothingToShowElement.js.map +1 -1
- package/admin/graphql/contentEntries.js +33 -68
- package/admin/graphql/contentEntries.js.map +1 -1
- package/admin/graphql/contentModels.d.ts +1 -1
- package/admin/graphql/contentModels.js +3 -9
- package/admin/graphql/contentModels.js.map +1 -1
- package/admin/graphql/createFieldsList.d.ts +7 -2
- package/admin/graphql/createFieldsList.js +10 -9
- package/admin/graphql/createFieldsList.js.map +1 -1
- package/admin/hooks/index.d.ts +6 -0
- package/admin/hooks/index.js +54 -10
- package/admin/hooks/index.js.map +1 -1
- package/admin/hooks/useApolloClient.js +1 -6
- package/admin/hooks/useApolloClient.js.map +1 -1
- package/admin/hooks/useCms.js +0 -6
- package/admin/hooks/useCms.js.map +1 -1
- package/admin/hooks/useContentModels.d.ts +6 -0
- package/admin/hooks/useContentModels.js +33 -0
- package/admin/hooks/useContentModels.js.map +1 -0
- package/admin/hooks/useLazyQuery.js +1 -9
- package/admin/hooks/useLazyQuery.js.map +1 -1
- package/admin/hooks/useMutation.js +1 -9
- package/admin/hooks/useMutation.js.map +1 -1
- package/admin/hooks/usePermission.d.ts +2 -2
- package/admin/hooks/usePermission.js +13 -51
- package/admin/hooks/usePermission.js.map +1 -1
- package/admin/hooks/useQuery.js +1 -9
- package/admin/hooks/useQuery.js.map +1 -1
- package/admin/hooks/useQueryLocale.js +1 -9
- package/admin/hooks/useQueryLocale.js.map +1 -1
- package/admin/menus/CmsMenuLoader.js +5 -19
- package/admin/menus/CmsMenuLoader.js.map +1 -1
- package/admin/menus/ContentGroupsMenuItems.js +3 -23
- package/admin/menus/ContentGroupsMenuItems.js.map +1 -1
- package/admin/menus/GlobalSearchPlugins.js +5 -15
- package/admin/menus/GlobalSearchPlugins.js.map +1 -1
- package/admin/menus/NothingToShowElement.js +1 -8
- package/admin/menus/NothingToShowElement.js.map +1 -1
- package/admin/plugins/apiInformation/index.js +3 -14
- package/admin/plugins/apiInformation/index.js.map +1 -1
- package/admin/plugins/arrayUtils.d.ts +12 -0
- package/admin/plugins/arrayUtils.js +45 -0
- package/admin/plugins/arrayUtils.js.map +1 -0
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js +0 -14
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js.map +1 -1
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js +0 -14
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js.map +1 -1
- package/admin/plugins/editor/defaultBar/BackButton.js +1 -11
- package/admin/plugins/editor/defaultBar/BackButton.js.map +1 -1
- package/admin/plugins/editor/defaultBar/CreateContentButton.js +4 -21
- package/admin/plugins/editor/defaultBar/CreateContentButton.js.map +1 -1
- package/admin/plugins/editor/defaultBar/Divider.d.ts +5 -2
- package/admin/plugins/editor/defaultBar/Divider.js +0 -3
- package/admin/plugins/editor/defaultBar/Divider.js.map +1 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js +11 -38
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js.map +1 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.js +3 -13
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.js.map +1 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +8 -2
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.js +0 -7
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.js.map +1 -1
- package/admin/plugins/editor/defaultBar/FormSettings/index.js +0 -2
- package/admin/plugins/editor/defaultBar/FormSettings/index.js.map +1 -1
- package/admin/plugins/editor/defaultBar/Name/Name.js +13 -32
- package/admin/plugins/editor/defaultBar/Name/Name.js.map +1 -1
- package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +13 -4
- package/admin/plugins/editor/defaultBar/Name/NameStyled.js +0 -4
- package/admin/plugins/editor/defaultBar/Name/NameStyled.js.map +1 -1
- package/admin/plugins/editor/defaultBar/Name/index.js +0 -1
- package/admin/plugins/editor/defaultBar/Name/index.js.map +1 -1
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.js +26 -52
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.js.map +1 -1
- package/admin/plugins/editor/defaultBar/index.js +0 -9
- package/admin/plugins/editor/defaultBar/index.js.map +1 -1
- package/admin/plugins/editor/formSettings/components/GeneralSettings.d.ts +2 -2
- package/admin/plugins/editor/formSettings/components/GeneralSettings.js +30 -9
- package/admin/plugins/editor/formSettings/components/GeneralSettings.js.map +1 -1
- package/admin/plugins/editor/formSettings/components/GroupSelect.js +3 -14
- package/admin/plugins/editor/formSettings/components/GroupSelect.js.map +1 -1
- package/admin/plugins/editor/formSettings/index.js +0 -6
- package/admin/plugins/editor/formSettings/index.js.map +1 -1
- package/admin/plugins/entry/DefaultOnEntryDelete.js +93 -140
- package/admin/plugins/entry/DefaultOnEntryDelete.js.map +1 -1
- package/admin/plugins/entry/DefaultOnEntryPublish.js +70 -112
- package/admin/plugins/entry/DefaultOnEntryPublish.js.map +1 -1
- package/admin/plugins/fieldRenderers/Accordion.js +8 -21
- package/admin/plugins/fieldRenderers/Accordion.js.map +1 -1
- package/admin/plugins/fieldRenderers/DynamicSection.d.ts +3 -3
- package/admin/plugins/fieldRenderers/DynamicSection.js +11 -28
- package/admin/plugins/fieldRenderers/DynamicSection.js.map +1 -1
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.js +1 -10
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.js.map +1 -1
- package/admin/plugins/fieldRenderers/boolean/index.js +0 -3
- package/admin/plugins/fieldRenderers/boolean/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/checkboxes.js +6 -17
- package/admin/plugins/fieldRenderers/checkboxes.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.js +20 -41
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js +51 -97
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js +46 -85
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/Input.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dateTime/Input.js +1 -10
- package/admin/plugins/fieldRenderers/dateTime/Input.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/Select.js +0 -5
- package/admin/plugins/fieldRenderers/dateTime/Select.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/Time.js +19 -39
- package/admin/plugins/fieldRenderers/dateTime/Time.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js +1 -14
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js +1 -21
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/index.js +0 -4
- package/admin/plugins/fieldRenderers/dateTime/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/dateTime/utils.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dateTime/utils.js +2 -31
- package/admin/plugins/fieldRenderers/dateTime/utils.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.d.ts +12 -0
- package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js +85 -0
- package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.d.ts +11 -0
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js +114 -0
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.d.ts +11 -0
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js +54 -0
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.d.ts +8 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.js +54 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.d.ts +8 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js +40 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.d.ts +6 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js +17 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.d.ts +2 -0
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js +56 -0
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js.map +1 -0
- package/admin/plugins/fieldRenderers/file/File.js +6 -21
- package/admin/plugins/fieldRenderers/file/File.js.map +1 -1
- package/admin/plugins/fieldRenderers/file/fileField.js +3 -15
- package/admin/plugins/fieldRenderers/file/fileField.js.map +1 -1
- package/admin/plugins/fieldRenderers/file/fileFields.js +6 -25
- package/admin/plugins/fieldRenderers/file/fileFields.js.map +1 -1
- package/admin/plugins/fieldRenderers/file/index.js +0 -4
- package/admin/plugins/fieldRenderers/file/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/file/utils.js +1 -12
- package/admin/plugins/fieldRenderers/file/utils.js.map +1 -1
- package/admin/plugins/fieldRenderers/longText/index.js +0 -4
- package/admin/plugins/fieldRenderers/longText/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/longText/longText.js +1 -10
- package/admin/plugins/fieldRenderers/longText/longText.js.map +1 -1
- package/admin/plugins/fieldRenderers/longText/longTexts.js +1 -12
- package/admin/plugins/fieldRenderers/longText/longTexts.js.map +1 -1
- package/admin/plugins/fieldRenderers/number/index.js +0 -4
- package/admin/plugins/fieldRenderers/number/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/number/numberInput.js +1 -10
- package/admin/plugins/fieldRenderers/number/numberInput.js.map +1 -1
- package/admin/plugins/fieldRenderers/number/numberInputs.js +1 -13
- package/admin/plugins/fieldRenderers/number/numberInputs.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/StyledComponents.d.ts +9 -3
- package/admin/plugins/fieldRenderers/object/StyledComponents.js +0 -4
- package/admin/plugins/fieldRenderers/object/StyledComponents.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/index.js +4 -6
- package/admin/plugins/fieldRenderers/object/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +31 -51
- package/admin/plugins/fieldRenderers/object/multipleObjects.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.js +12 -36
- package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/singleObjectAccordion.js +2 -11
- package/admin/plugins/fieldRenderers/object/singleObjectAccordion.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/singleObjectInline.js +2 -14
- package/admin/plugins/fieldRenderers/object/singleObjectInline.js.map +1 -1
- package/admin/plugins/fieldRenderers/radioButtons.js +6 -17
- package/admin/plugins/fieldRenderers/radioButtons.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.js +275 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.js +185 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entries.d.ts +9 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entries.js +61 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entries.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entry.d.ts +27 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entry.js +153 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entry.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Loader.d.ts +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Loader.js +37 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Loader.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/NewReferencedEntryDialog.d.ts +9 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/NewReferencedEntryDialog.js +142 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/NewReferencedEntryDialog.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Options.d.ts +9 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Options.js +118 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Options.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/ReferencesDialog.d.ts +11 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/ReferencesDialog.js +183 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/ReferencesDialog.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Search.d.ts +7 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Search.js +60 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/Search.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/assets/add-circle.svg +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/assets/down-arrow.svg +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/assets/link.svg +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/assets/search.svg +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/dialog/Dialog.d.ts +19 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/dialog/Dialog.js +35 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/dialog/Dialog.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/dialog/DialogHeader.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/dialog/DialogHeader.js +90 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/dialog/DialogHeader.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/dialog/assets/close.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Box.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Box.js +64 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Box.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/CreatedBy.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/CreatedBy.js +26 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/CreatedBy.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Description.d.ts +6 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Description.js +31 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Description.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Image.d.ts +9 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Image.js +65 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Image.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModelName.d.ts +6 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModelName.js +25 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModelName.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModifiedBy.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModifiedBy.js +30 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModifiedBy.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveDown.d.ts +7 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveDown.js +24 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveDown.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveUp.d.ts +7 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveUp.js +24 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveUp.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Remove.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Remove.js +44 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Remove.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Select.d.ts +9 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Select.js +82 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Select.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Status.d.ts +7 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Status.js +32 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Status.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Title.d.ts +6 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Title.js +24 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Title.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/View.d.ts +7 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/View.js +22 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/View.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/move-down.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/move-up.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/remove.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/selected.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/status-draft.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/status-published.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/status-unpublished.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/assets/view.svg +3 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/elements/ButtonLink.d.ts +18 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/elements/ButtonLink.js +84 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/elements/ButtonLink.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelList.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelList.js +55 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelList.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelListItem.d.ts +8 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelListItem.js +98 -0
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelListItem.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferenceRenderer.d.ts +2 -0
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferenceRenderer.js +46 -0
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferenceRenderer.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferencesRenderer.d.ts +2 -0
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferencesRenderer.js +45 -0
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferencesRenderer.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/graphql.d.ts +44 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/graphql.js +21 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/graphql.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useEntries.d.ts +15 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useEntries.js +187 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useEntries.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useReferences.d.ts +12 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useReferences.js +214 -0
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useReferences.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/index.d.ts +1 -0
- package/admin/plugins/fieldRenderers/ref/advanced/index.js +12 -0
- package/admin/plugins/fieldRenderers/ref/advanced/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.d.ts +2 -2
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +15 -46
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.d.ts +2 -2
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js +19 -46
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/EntryStatus.js +4 -17
- package/admin/plugins/fieldRenderers/ref/components/EntryStatus.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/MissingEntryHelpText.js +0 -15
- package/admin/plugins/fieldRenderers/ref/components/MissingEntryHelpText.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js +20 -65
- package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.js +1 -5
- package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/graphql.js +2 -7
- package/admin/plugins/fieldRenderers/ref/components/graphql.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/helpers.js +0 -12
- package/admin/plugins/fieldRenderers/ref/components/helpers.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/renderItem.js +0 -14
- package/admin/plugins/fieldRenderers/ref/components/renderItem.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/types.d.ts +11 -1
- package/admin/plugins/fieldRenderers/ref/components/types.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/useReference.d.ts +2 -2
- package/admin/plugins/fieldRenderers/ref/components/useReference.js +51 -99
- package/admin/plugins/fieldRenderers/ref/components/useReference.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/useReferences.d.ts +2 -2
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js +53 -83
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.d.ts +2 -2
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js +16 -31
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntryDialog.js +5 -17
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntryDialog.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/index.js +3 -5
- package/admin/plugins/fieldRenderers/ref/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/refInput.js +0 -9
- package/admin/plugins/fieldRenderers/ref/refInput.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/refInputs.js +0 -10
- package/admin/plugins/fieldRenderers/ref/refInputs.js.map +1 -1
- package/admin/plugins/fieldRenderers/richText/index.js +0 -4
- package/admin/plugins/fieldRenderers/richText/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/richText/richTextInput.js +1 -13
- package/admin/plugins/fieldRenderers/richText/richTextInput.js.map +1 -1
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js +1 -18
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js.map +1 -1
- package/admin/plugins/fieldRenderers/select.js +2 -15
- package/admin/plugins/fieldRenderers/select.js.map +1 -1
- package/admin/plugins/fieldRenderers/text/index.js +0 -4
- package/admin/plugins/fieldRenderers/text/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/text/textInput.js +1 -10
- package/admin/plugins/fieldRenderers/text/textInput.js.map +1 -1
- package/admin/plugins/fieldRenderers/text/textInputs.js +1 -13
- package/admin/plugins/fieldRenderers/text/textInputs.js.map +1 -1
- package/admin/plugins/fieldValidators/date/availableValidators.js +0 -4
- package/admin/plugins/fieldValidators/date/availableValidators.js.map +1 -1
- package/admin/plugins/fieldValidators/date/createDateInputField.d.ts +2 -2
- package/admin/plugins/fieldValidators/date/createDateInputField.js +0 -10
- package/admin/plugins/fieldValidators/date/createDateInputField.js.map +1 -1
- package/admin/plugins/fieldValidators/dateGte.d.ts +2 -2
- package/admin/plugins/fieldValidators/dateGte.js +61 -32
- package/admin/plugins/fieldValidators/dateGte.js.map +1 -1
- package/admin/plugins/fieldValidators/dateLte.d.ts +2 -2
- package/admin/plugins/fieldValidators/dateLte.js +61 -32
- package/admin/plugins/fieldValidators/dateLte.js.map +1 -1
- package/admin/plugins/fieldValidators/dynamicZone.d.ts +2 -0
- package/admin/plugins/fieldValidators/dynamicZone.js +163 -0
- package/admin/plugins/fieldValidators/dynamicZone.js.map +1 -0
- package/admin/plugins/fieldValidators/gte.d.ts +2 -2
- package/admin/plugins/fieldValidators/gte.js +33 -11
- package/admin/plugins/fieldValidators/gte.js.map +1 -1
- package/admin/plugins/fieldValidators/in.d.ts +2 -2
- package/admin/plugins/fieldValidators/in.js +33 -11
- package/admin/plugins/fieldValidators/in.js.map +1 -1
- package/admin/plugins/fieldValidators/lte.d.ts +2 -2
- package/admin/plugins/fieldValidators/lte.js +33 -11
- package/admin/plugins/fieldValidators/lte.js.map +1 -1
- package/admin/plugins/fieldValidators/maxLength.d.ts +2 -2
- package/admin/plugins/fieldValidators/maxLength.js +44 -12
- package/admin/plugins/fieldValidators/maxLength.js.map +1 -1
- package/admin/plugins/fieldValidators/minLength.d.ts +2 -2
- package/admin/plugins/fieldValidators/minLength.js +44 -12
- package/admin/plugins/fieldValidators/minLength.js.map +1 -1
- package/admin/plugins/fieldValidators/pattern.d.ts +2 -2
- package/admin/plugins/fieldValidators/pattern.js +108 -71
- package/admin/plugins/fieldValidators/pattern.js.map +1 -1
- package/admin/plugins/fieldValidators/patternPlugins/email.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/email.js +6 -4
- package/admin/plugins/fieldValidators/patternPlugins/email.js.map +1 -1
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js +5 -3
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js.map +1 -1
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js +5 -3
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js.map +1 -1
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.js +5 -3
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.js.map +1 -1
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js +5 -3
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js.map +1 -1
- package/admin/plugins/fieldValidators/patternPlugins/url.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/url.js +5 -3
- package/admin/plugins/fieldValidators/patternPlugins/url.js.map +1 -1
- package/admin/plugins/fieldValidators/required.d.ts +2 -2
- package/admin/plugins/fieldValidators/required.js +6 -2
- package/admin/plugins/fieldValidators/required.js.map +1 -1
- package/admin/plugins/fieldValidators/unique.d.ts +2 -2
- package/admin/plugins/fieldValidators/unique.js +22 -4
- package/admin/plugins/fieldValidators/unique.js.map +1 -1
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.d.ts +1 -2
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js +29 -52
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js.map +1 -1
- package/admin/plugins/fields/boolean.d.ts +2 -2
- package/admin/plugins/fields/boolean.js +5 -15
- package/admin/plugins/fields/boolean.js.map +1 -1
- package/admin/plugins/fields/dateTime.d.ts +2 -2
- package/admin/plugins/fields/dateTime.js +53 -60
- package/admin/plugins/fields/dateTime.js.map +1 -1
- package/admin/plugins/fields/dynamicZone/AddTemplate.d.ts +11 -0
- package/admin/plugins/fields/dynamicZone/AddTemplate.js +91 -0
- package/admin/plugins/fields/dynamicZone/AddTemplate.js.map +1 -0
- package/admin/plugins/fields/dynamicZone/DynamicZone.d.ts +2 -0
- package/admin/plugins/fields/dynamicZone/DynamicZone.js +62 -0
- package/admin/plugins/fields/dynamicZone/DynamicZone.js.map +1 -0
- package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.d.ts +11 -0
- package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.js +104 -0
- package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.js.map +1 -0
- package/admin/plugins/fields/dynamicZone/TemplateDialog.d.ts +9 -0
- package/admin/plugins/fields/dynamicZone/TemplateDialog.js +141 -0
- package/admin/plugins/fields/dynamicZone/TemplateDialog.js.map +1 -0
- package/admin/plugins/fields/dynamicZone/commonValidators.d.ts +2 -0
- package/admin/plugins/fields/dynamicZone/commonValidators.js +26 -0
- package/admin/plugins/fields/dynamicZone/commonValidators.js.map +1 -0
- package/admin/plugins/fields/dynamicZone.d.ts +2 -0
- package/admin/plugins/fields/dynamicZone.js +83 -0
- package/admin/plugins/fields/dynamicZone.js.map +1 -0
- package/admin/plugins/fields/file.d.ts +2 -2
- package/admin/plugins/fields/file.js +5 -15
- package/admin/plugins/fields/file.js.map +1 -1
- package/admin/plugins/fields/longText.d.ts +2 -2
- package/admin/plugins/fields/longText.js +3 -13
- package/admin/plugins/fields/longText.js.map +1 -1
- package/admin/plugins/fields/number.d.ts +2 -2
- package/admin/plugins/fields/number.js +5 -16
- package/admin/plugins/fields/number.js.map +1 -1
- package/admin/plugins/fields/object/ObjectFields.d.ts +2 -2
- package/admin/plugins/fields/object/ObjectFields.js +4 -14
- package/admin/plugins/fields/object/ObjectFields.js.map +1 -1
- package/admin/plugins/fields/object.d.ts +2 -2
- package/admin/plugins/fields/object.js +9 -14
- package/admin/plugins/fields/object.js.map +1 -1
- package/admin/plugins/fields/ref/graphql.d.ts +8 -0
- package/admin/plugins/fields/ref/graphql.js +12 -0
- package/admin/plugins/fields/ref/graphql.js.map +1 -0
- package/admin/plugins/fields/ref/renderInfo.d.ts +9 -0
- package/admin/plugins/fields/ref/renderInfo.js +116 -0
- package/admin/plugins/fields/ref/renderInfo.js.map +1 -0
- package/admin/plugins/fields/ref.d.ts +2 -2
- package/admin/plugins/fields/ref.js +96 -120
- package/admin/plugins/fields/ref.js.map +1 -1
- package/admin/plugins/fields/richText.d.ts +2 -2
- package/admin/plugins/fields/richText.js +5 -15
- package/admin/plugins/fields/richText.js.map +1 -1
- package/admin/plugins/fields/text.d.ts +2 -2
- package/admin/plugins/fields/text.js +3 -14
- package/admin/plugins/fields/text.js.map +1 -1
- package/admin/plugins/getObjectId.js +0 -4
- package/admin/plugins/getObjectId.js.map +1 -1
- package/admin/plugins/icons.js +2 -12
- package/admin/plugins/icons.js.map +1 -1
- package/admin/plugins/index.d.ts +28 -1
- package/admin/plugins/index.js +0 -12
- package/admin/plugins/index.js.map +1 -1
- package/admin/plugins/install.js +22 -87
- package/admin/plugins/install.js.map +1 -1
- package/admin/plugins/permissionRenderer/CmsPermissions.js +20 -79
- package/admin/plugins/permissionRenderer/CmsPermissions.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js +6 -24
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.js +4 -19
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/ContentModelList.js +5 -18
- package/admin/plugins/permissionRenderer/components/ContentModelList.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.js +9 -29
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.js +2 -8
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/PermissionSelector.js +11 -27
- package/admin/plugins/permissionRenderer/components/PermissionSelector.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +5 -2
- package/admin/plugins/permissionRenderer/components/StyledComponents.js +0 -3
- package/admin/plugins/permissionRenderer/components/StyledComponents.js.map +1 -1
- package/admin/plugins/permissionRenderer/components/useCmsData.d.ts +1 -0
- package/admin/plugins/permissionRenderer/components/useCmsData.js +60 -65
- package/admin/plugins/permissionRenderer/components/useCmsData.js.map +1 -1
- package/admin/plugins/permissionRenderer/index.js +0 -6
- package/admin/plugins/permissionRenderer/index.js.map +1 -1
- package/admin/plugins/routes.js +1 -19
- package/admin/plugins/routes.js.map +1 -1
- package/admin/plugins/transformers/dateTransformer.d.ts +1 -2
- package/admin/plugins/transformers/dateTransformer.js +8 -39
- package/admin/plugins/transformers/dateTransformer.js.map +1 -1
- package/admin/plugins/transformers/dynamicZoneTransformer.d.ts +2 -0
- package/admin/plugins/transformers/dynamicZoneTransformer.js +36 -0
- package/admin/plugins/transformers/dynamicZoneTransformer.js.map +1 -0
- package/admin/plugins/transformers/index.js +4 -9
- package/admin/plugins/transformers/index.js.map +1 -1
- package/admin/plugins/transformers/numberTransformer.d.ts +1 -2
- package/admin/plugins/transformers/numberTransformer.js +3 -6
- package/admin/plugins/transformers/numberTransformer.js.map +1 -1
- package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js.map +1 -1
- package/admin/plugins/upgrades/v5.0.0.js.map +1 -1
- package/admin/plugins/upgrades/v5.19.0.js.map +1 -1
- package/admin/plugins/upgrades/v5.33.0.js.map +1 -1
- package/admin/plugins/upgrades/v5.5.0.js.map +1 -1
- package/admin/plugins/upgrades/v5.8.0.js.map +1 -1
- package/admin/plugins/welcomeScreenWidget.js +0 -6
- package/admin/plugins/welcomeScreenWidget.js.map +1 -1
- package/admin/views/contentEntries/ContentEntries.js +27 -54
- package/admin/views/contentEntries/ContentEntries.js.map +1 -1
- package/admin/views/contentEntries/ContentEntriesContext.d.ts +4 -4
- package/admin/views/contentEntries/ContentEntriesContext.js +11 -44
- package/admin/views/contentEntries/ContentEntriesContext.js.map +1 -1
- package/admin/views/contentEntries/ContentEntriesList.js +38 -57
- package/admin/views/contentEntries/ContentEntriesList.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +32 -75
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/PublishEntryRevisionListItem.js +0 -12
- package/admin/views/contentEntries/ContentEntry/PublishEntryRevisionListItem.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js +71 -111
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/RevisionsList.js +3 -19
- package/admin/views/contentEntries/ContentEntry/RevisionsList.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/cache.js +12 -62
- package/admin/views/contentEntries/ContentEntry/cache.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/header/Header.js +0 -9
- package/admin/views/contentEntries/ContentEntry/header/Header.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.js +48 -94
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/header/index.js +0 -24
- package/admin/views/contentEntries/ContentEntry/header/index.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.js +5 -22
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.js +30 -62
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.js +3 -17
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/prepareFormData.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js +2 -35
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/useRevision.js +86 -162
- package/admin/views/contentEntries/ContentEntry/useRevision.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry.js +9 -34
- package/admin/views/contentEntries/ContentEntry.js.map +1 -1
- package/admin/views/contentEntries/experiment/ContentEntriesModule.js +19 -24
- package/admin/views/contentEntries/experiment/ContentEntriesModule.js.map +1 -1
- package/admin/views/contentEntries/experiment/ContentEntriesRenderer.js +0 -8
- package/admin/views/contentEntries/experiment/ContentEntriesRenderer.js.map +1 -1
- package/admin/views/contentEntries/experiment/ContentEntriesViewConfig.js +14 -35
- package/admin/views/contentEntries/experiment/ContentEntriesViewConfig.js.map +1 -1
- package/admin/views/contentEntries/experiment/Property.js +9 -57
- package/admin/views/contentEntries/experiment/Property.js.map +1 -1
- package/admin/views/contentEntries/hooks/useContentEntries.js +5 -4
- package/admin/views/contentEntries/hooks/useContentEntries.js.map +1 -1
- package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +1 -1
- package/admin/views/contentEntries/hooks/useContentEntriesList.js +31 -54
- package/admin/views/contentEntries/hooks/useContentEntriesList.js.map +1 -1
- package/admin/views/contentEntries/hooks/useContentEntry.js +0 -5
- package/admin/views/contentEntries/hooks/useContentEntry.js.map +1 -1
- package/admin/views/contentModelGroups/ContentModelGroups.js +2 -15
- package/admin/views/contentModelGroups/ContentModelGroups.js.map +1 -1
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js +66 -120
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js.map +1 -1
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js +74 -131
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js.map +1 -1
- package/admin/views/contentModelGroups/graphql.js +1 -9
- package/admin/views/contentModelGroups/graphql.js.map +1 -1
- package/admin/views/contentModels/CloneContentModelDialog.d.ts +5 -6
- package/admin/views/contentModels/CloneContentModelDialog.js +123 -180
- package/admin/views/contentModels/CloneContentModelDialog.js.map +1 -1
- package/admin/views/contentModels/ContentModelEditor.js +5 -19
- package/admin/views/contentModels/ContentModelEditor.js.map +1 -1
- package/admin/views/contentModels/ContentModels.js +10 -30
- package/admin/views/contentModels/ContentModels.js.map +1 -1
- package/admin/views/contentModels/ContentModelsDataList.js +107 -141
- package/admin/views/contentModels/ContentModelsDataList.js.map +1 -1
- package/admin/views/contentModels/NewContentModelDialog.js +120 -235
- package/admin/views/contentModels/NewContentModelDialog.js.map +1 -1
- package/admin/views/contentModels/cache.js +5 -28
- package/admin/views/contentModels/cache.js.map +1 -1
- package/admin/views/contentModels/helpers/apiNameValidator.d.ts +8 -0
- package/admin/views/contentModels/helpers/apiNameValidator.js +116 -0
- package/admin/views/contentModels/helpers/apiNameValidator.js.map +1 -0
- package/admin/views/contentModels/helpers/nameValidator.d.ts +6 -0
- package/admin/views/contentModels/helpers/nameValidator.js +63 -0
- package/admin/views/contentModels/helpers/nameValidator.js.map +1 -0
- package/admin/views/utils.js +3 -9
- package/admin/views/utils.js.map +1 -1
- package/admin/viewsGraphql.js +7 -11
- package/admin/viewsGraphql.js.map +1 -1
- package/allPlugins.d.ts +34 -0
- package/allPlugins.js +51 -0
- package/allPlugins.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +13 -4
- package/index.js.map +1 -1
- package/package.json +27 -28
- package/{types.d.ts → types/index.d.ts} +60 -178
- package/types/index.js +38 -0
- package/types/index.js.map +1 -0
- package/types/model.d.ts +88 -0
- package/types/model.js.map +1 -0
- package/types/shared.d.ts +5 -0
- package/types/shared.js +5 -0
- package/types/shared.js.map +1 -0
- package/types/validation.d.ts +70 -0
- package/types/validation.js +5 -0
- package/types/validation.js.map +1 -0
- package/utils/CmsModelFieldValidatorConfigAdapter.d.ts +15 -0
- package/utils/CmsModelFieldValidatorConfigAdapter.js +79 -0
- package/utils/CmsModelFieldValidatorConfigAdapter.js.map +1 -0
- package/utils/createTypeName.d.ts +1 -0
- package/utils/createTypeName.js +13 -0
- package/utils/createTypeName.js.map +1 -0
- package/utils/createValidators.d.ts +3 -0
- package/utils/createValidators.js +76 -0
- package/utils/createValidators.js.map +1 -0
- package/utils/getFetchPolicy.d.ts +6 -0
- package/utils/getFetchPolicy.js +17 -0
- package/utils/getFetchPolicy.js.map +1 -0
- package/utils/getModelTitleFieldId.d.ts +2 -0
- package/utils/getModelTitleFieldId.js +13 -0
- package/utils/getModelTitleFieldId.js.map +1 -0
- package/admin/components/ContentEntryForm/functions/createValidators.d.ts +0 -3
- package/admin/components/ContentEntryForm/functions/createValidators.js +0 -76
- package/admin/components/ContentEntryForm/functions/createValidators.js.map +0 -1
- package/admin/components/ContentModelEditor/Context.js +0 -379
- package/admin/components/ContentModelEditor/Context.js.map +0 -1
- package/admin/components/ContentModelEditor/useContentModelEditor.d.ts +0 -1
- package/admin/components/ContentModelEditor/useContentModelEditor.js.map +0 -1
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.d.ts +0 -15
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js +0 -148
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js.map +0 -1
- package/admin/components/FieldEditor/useFieldEditor.d.ts +0 -1
- package/admin/components/FieldEditor/useFieldEditor.js +0 -14
- package/admin/components/FieldEditor/useFieldEditor.js.map +0 -1
- package/admin/plugins/fieldRenderers/object/singleObject.d.ts +0 -3
- package/admin/plugins/fieldRenderers/object/singleObject.js +0 -64
- package/admin/plugins/fieldRenderers/object/singleObject.js.map +0 -1
- package/admin/plugins/validators/dateGte.d.ts +0 -3
- package/admin/plugins/validators/dateGte.js +0 -68
- package/admin/plugins/validators/dateGte.js.map +0 -1
- package/admin/plugins/validators/dateLte.d.ts +0 -3
- package/admin/plugins/validators/dateLte.js +0 -68
- package/admin/plugins/validators/dateLte.js.map +0 -1
- package/admin/plugins/validators/gte.d.ts +0 -3
- package/admin/plugins/validators/gte.js +0 -57
- package/admin/plugins/validators/gte.js.map +0 -1
- package/admin/plugins/validators/in.d.ts +0 -3
- package/admin/plugins/validators/in.js +0 -57
- package/admin/plugins/validators/in.js.map +0 -1
- package/admin/plugins/validators/lte.d.ts +0 -3
- package/admin/plugins/validators/lte.js +0 -57
- package/admin/plugins/validators/lte.js.map +0 -1
- package/admin/plugins/validators/maxLength.d.ts +0 -3
- package/admin/plugins/validators/maxLength.js +0 -57
- package/admin/plugins/validators/maxLength.js.map +0 -1
- package/admin/plugins/validators/minLength.d.ts +0 -3
- package/admin/plugins/validators/minLength.js +0 -57
- package/admin/plugins/validators/minLength.js.map +0 -1
- package/admin/plugins/validators/pattern.d.ts +0 -3
- package/admin/plugins/validators/pattern.js +0 -77
- package/admin/plugins/validators/pattern.js.map +0 -1
- package/admin/plugins/validators/patternPlugins/email.d.ts +0 -3
- package/admin/plugins/validators/patternPlugins/email.js +0 -17
- package/admin/plugins/validators/patternPlugins/email.js.map +0 -1
- package/admin/plugins/validators/patternPlugins/lowerCase.d.ts +0 -3
- package/admin/plugins/validators/patternPlugins/lowerCase.js +0 -17
- package/admin/plugins/validators/patternPlugins/lowerCase.js.map +0 -1
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +0 -3
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js +0 -17
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js.map +0 -1
- package/admin/plugins/validators/patternPlugins/upperCase.d.ts +0 -3
- package/admin/plugins/validators/patternPlugins/upperCase.js +0 -17
- package/admin/plugins/validators/patternPlugins/upperCase.js.map +0 -1
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.d.ts +0 -3
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.js +0 -17
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.js.map +0 -1
- package/admin/plugins/validators/patternPlugins/url.d.ts +0 -3
- package/admin/plugins/validators/patternPlugins/url.js +0 -17
- package/admin/plugins/validators/patternPlugins/url.js.map +0 -1
- package/admin/plugins/validators/required.d.ts +0 -3
- package/admin/plugins/validators/required.js +0 -21
- package/admin/plugins/validators/required.js.map +0 -1
- package/admin/plugins/validators/timeGte.d.ts +0 -3
- package/admin/plugins/validators/timeGte.js +0 -59
- package/admin/plugins/validators/timeGte.js.map +0 -1
- package/admin/plugins/validators/timeLte.d.ts +0 -3
- package/admin/plugins/validators/timeLte.js +0 -59
- package/admin/plugins/validators/timeLte.js.map +0 -1
- package/admin/plugins/validators/unique.d.ts +0 -7
- package/admin/plugins/validators/unique.js +0 -50
- package/admin/plugins/validators/unique.js.map +0 -1
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.d.ts +0 -1
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js +0 -13
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js.map +0 -1
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/rule-24px.svg +0 -1
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.d.ts +0 -1
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js +0 -13
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js.map +0 -1
- package/admin/views/contentEntries/ContentEntry/header/requestReview/emoji_people-24px.svg +0 -1
- package/admin/views/contentModelGroups/IconPicker.d.ts +0 -8
- package/admin/views/contentModelGroups/IconPicker.js.map +0 -1
- package/types.js.map +0 -1
- /package/admin/{views/contentModelGroups → components}/DelayedOnChange.d.ts +0 -0
- /package/{types.js → types/model.js} +0 -0
|
@@ -1,94 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.FieldEditorProvider = exports.FieldEditorContext = void 0;
|
|
11
|
-
|
|
12
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
12
|
var _dotPropImmutable = _interopRequireDefault(require("dot-prop-immutable"));
|
|
19
|
-
|
|
20
13
|
var _useDeepCompareEffect = _interopRequireDefault(require("use-deep-compare-effect"));
|
|
21
|
-
|
|
22
14
|
var _plugins = require("@webiny/plugins");
|
|
23
|
-
|
|
24
15
|
var utils = _interopRequireWildcard(require("./utils"));
|
|
25
|
-
|
|
26
|
-
var _useFieldEditor = require("./useFieldEditor");
|
|
27
|
-
|
|
16
|
+
var _useModelFieldEditor = require("./useModelFieldEditor");
|
|
28
17
|
var _utils2 = require("@webiny/utils");
|
|
29
|
-
|
|
30
|
-
var FieldEditorContext = /*#__PURE__*/_react.default.createContext(
|
|
31
|
-
/**
|
|
32
|
-
* Safe to cast.
|
|
33
|
-
*/
|
|
34
|
-
{
|
|
35
|
-
field: null
|
|
36
|
-
});
|
|
18
|
+
var FieldEditorContext = /*#__PURE__*/_react.default.createContext(undefined);
|
|
37
19
|
/**
|
|
38
20
|
* We try to generate the random id string but with the check that it does not exist already.
|
|
39
21
|
* Chances that the same string exists are quite small, but let's check it anyway.
|
|
40
22
|
*
|
|
41
23
|
* In most cases, there will be no iterations anyway...
|
|
42
24
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
25
|
exports.FieldEditorContext = FieldEditorContext;
|
|
46
26
|
var maxGenerateIdIterations = 100;
|
|
47
|
-
|
|
48
27
|
var generateFieldId = function generateFieldId(layout) {
|
|
49
28
|
var id = (0, _utils2.generateAlphaNumericLowerCaseId)(8);
|
|
50
29
|
var iteration = 0;
|
|
51
|
-
|
|
52
30
|
while (layout.includes(id) && iteration < maxGenerateIdIterations) {
|
|
53
31
|
id = (0, _utils2.generateAlphaNumericLowerCaseId)(8);
|
|
54
32
|
iteration++;
|
|
55
33
|
}
|
|
56
|
-
|
|
57
34
|
if (iteration >= maxGenerateIdIterations) {
|
|
58
35
|
throw new Error("Could not generate field ID in ".concat(maxGenerateIdIterations, " iterations."));
|
|
59
36
|
}
|
|
60
|
-
|
|
61
37
|
return id;
|
|
62
38
|
};
|
|
63
|
-
|
|
64
39
|
var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
65
40
|
var parent = _ref.parent,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
41
|
+
fields = _ref.fields,
|
|
42
|
+
layout = _ref.layout,
|
|
43
|
+
onChange = _ref.onChange,
|
|
44
|
+
children = _ref.children;
|
|
70
45
|
// We need to determine depth of this provider so we can render drop zones with correct z-indexes.
|
|
71
46
|
var depth = 0;
|
|
72
|
-
|
|
73
47
|
try {
|
|
74
|
-
var editor = (0,
|
|
48
|
+
var editor = (0, _useModelFieldEditor.useModelFieldEditor)();
|
|
75
49
|
depth = editor.depth + 1;
|
|
76
|
-
} catch (_unused) {
|
|
50
|
+
} catch (_unused) {
|
|
51
|
+
// There's no parent provider, so this is the top-level one.
|
|
77
52
|
}
|
|
78
|
-
|
|
79
53
|
var _useState = (0, _react.useState)({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
54
|
+
layout: layout,
|
|
55
|
+
fields: fields,
|
|
56
|
+
field: null,
|
|
57
|
+
dropTarget: {
|
|
58
|
+
row: -1,
|
|
59
|
+
index: null
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
63
|
+
state = _useState2[0],
|
|
64
|
+
setState = _useState2[1];
|
|
92
65
|
(0, _useDeepCompareEffect.default)(function () {
|
|
93
66
|
onChange({
|
|
94
67
|
fields: state.fields,
|
|
@@ -107,13 +80,12 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
107
80
|
};
|
|
108
81
|
var onFieldDrop = (0, _react.useCallback)(function (source, dropTarget) {
|
|
109
82
|
var pos = source.pos,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
83
|
+
type = source.type,
|
|
84
|
+
fieldType = source.fieldType,
|
|
85
|
+
field = source.field,
|
|
86
|
+
_source$fields = source.fields,
|
|
87
|
+
fields = _source$fields === void 0 ? [] : _source$fields;
|
|
115
88
|
var parentId = parent ? parent.fieldId : null;
|
|
116
|
-
|
|
117
89
|
if (type === "row") {
|
|
118
90
|
if (parentId !== source.parent) {
|
|
119
91
|
// We're dragging an existing row from another fieldset
|
|
@@ -130,16 +102,14 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
130
102
|
// We're dragging a row within the same fieldset
|
|
131
103
|
moveRow(pos.row, dropTarget.row);
|
|
132
104
|
}
|
|
133
|
-
|
|
134
105
|
return onDropTarget;
|
|
135
|
-
}
|
|
136
|
-
|
|
106
|
+
}
|
|
137
107
|
|
|
108
|
+
// If source pos is set, we are moving an existing field.
|
|
138
109
|
if (pos) {
|
|
139
110
|
if (!field) {
|
|
140
111
|
return onDropTarget;
|
|
141
112
|
}
|
|
142
|
-
|
|
143
113
|
if (parentId !== source.parent) {
|
|
144
114
|
// We're dragging an existing field from another fieldset
|
|
145
115
|
insertField({
|
|
@@ -153,58 +123,51 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
153
123
|
position: dropTarget
|
|
154
124
|
});
|
|
155
125
|
}
|
|
156
|
-
|
|
157
126
|
return onDropTarget;
|
|
158
127
|
}
|
|
159
|
-
|
|
160
128
|
if (!fieldType) {
|
|
161
129
|
return null;
|
|
162
130
|
}
|
|
163
|
-
|
|
164
131
|
var plugin = getFieldPlugin(fieldType);
|
|
165
|
-
|
|
166
132
|
if (!plugin) {
|
|
167
133
|
return null;
|
|
168
134
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
177
|
-
dropTarget: dropTarget
|
|
135
|
+
var fieldData = plugin.field.createField();
|
|
136
|
+
if (plugin.field.canEditSettings !== false) {
|
|
137
|
+
editField(fieldData);
|
|
138
|
+
setState(function (state) {
|
|
139
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
140
|
+
dropTarget: dropTarget
|
|
141
|
+
});
|
|
178
142
|
});
|
|
179
|
-
}
|
|
143
|
+
} else {
|
|
144
|
+
insertField({
|
|
145
|
+
field: fieldData,
|
|
146
|
+
position: dropTarget
|
|
147
|
+
});
|
|
148
|
+
}
|
|
180
149
|
return null;
|
|
181
150
|
}, []);
|
|
182
|
-
|
|
183
151
|
var onEndDrag = function onEndDrag(_ref2, monitor) {
|
|
184
152
|
var type = _ref2.type,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
153
|
+
field = _ref2.field,
|
|
154
|
+
fields = _ref2.fields;
|
|
188
155
|
if (!monitor.didDrop()) {
|
|
189
156
|
return;
|
|
190
|
-
}
|
|
191
|
-
|
|
157
|
+
}
|
|
192
158
|
|
|
159
|
+
// Check if we dropped outside of the source fieldset, and if yes, remove the field from the original parent.
|
|
193
160
|
var _monitor$getDropResul = monitor.getDropResult(),
|
|
194
|
-
|
|
195
|
-
|
|
161
|
+
dropTarget = _monitor$getDropResul.dropTarget;
|
|
196
162
|
var parentId = parent ? parent.fieldId : null;
|
|
197
|
-
|
|
198
163
|
if (dropTarget === parentId) {
|
|
199
164
|
return;
|
|
200
165
|
}
|
|
201
|
-
|
|
202
166
|
var removeFields = type === "row" ? fields || [] : field ? [field] : [];
|
|
203
167
|
removeFields.forEach(function (field) {
|
|
204
168
|
return deleteField(field);
|
|
205
169
|
});
|
|
206
170
|
};
|
|
207
|
-
|
|
208
171
|
var getFieldsInLayout = function getFieldsInLayout() {
|
|
209
172
|
// Replace every field ID with actual field object.
|
|
210
173
|
return state.layout.filter(function (arr) {
|
|
@@ -219,66 +182,62 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
219
182
|
return row.length > 0;
|
|
220
183
|
});
|
|
221
184
|
};
|
|
185
|
+
|
|
222
186
|
/**
|
|
223
187
|
* Return field plugin.
|
|
224
188
|
*/
|
|
225
|
-
|
|
226
|
-
|
|
227
189
|
var getFieldPlugin = function getFieldPlugin(type) {
|
|
228
190
|
return _plugins.plugins.byType("cms-editor-field-type").find(function (plugin) {
|
|
229
191
|
return plugin.field.type === type;
|
|
230
192
|
});
|
|
231
193
|
};
|
|
194
|
+
var getFieldRendererPlugin = function getFieldRendererPlugin(name) {
|
|
195
|
+
return _plugins.plugins.byType("cms-editor-field-renderer").find(function (plugin) {
|
|
196
|
+
return plugin.renderer.rendererName === name;
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
232
200
|
/**
|
|
233
201
|
* Checks if field of given type already exists in the list of fields.
|
|
234
202
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
203
|
var getField = function getField(query) {
|
|
238
204
|
return state.fields.find(function (field) {
|
|
239
205
|
for (var key in query) {
|
|
240
206
|
if (!(key in field)) {
|
|
241
207
|
return false;
|
|
242
|
-
}
|
|
208
|
+
}
|
|
209
|
+
// TODO @ts-refactor figure if there is a way to fix this.
|
|
243
210
|
// @ts-ignore
|
|
244
|
-
|
|
245
|
-
|
|
246
211
|
if (field[key] !== query[key]) {
|
|
247
212
|
return false;
|
|
248
213
|
}
|
|
249
214
|
}
|
|
250
|
-
|
|
251
215
|
return true;
|
|
252
216
|
});
|
|
253
217
|
};
|
|
218
|
+
|
|
254
219
|
/**
|
|
255
220
|
* Inserts a new field into the target position.
|
|
256
221
|
*/
|
|
257
|
-
|
|
258
|
-
|
|
259
222
|
var insertField = function insertField(_ref3) {
|
|
260
223
|
var field = _ref3.field,
|
|
261
|
-
|
|
262
|
-
|
|
224
|
+
position = _ref3.position;
|
|
263
225
|
if (!field.id) {
|
|
264
226
|
field.id = generateFieldId(layout.flat());
|
|
265
227
|
}
|
|
266
|
-
|
|
267
228
|
if (!field.type) {
|
|
268
229
|
throw new Error("Field \"type\" missing.");
|
|
269
230
|
}
|
|
270
|
-
|
|
271
231
|
var fieldPlugin = getFieldPlugin(field.type);
|
|
272
|
-
|
|
273
232
|
if (!fieldPlugin) {
|
|
274
|
-
throw new Error("
|
|
233
|
+
throw new Error("No plugin found for field type \"".concat(field.type, "\"."));
|
|
275
234
|
}
|
|
276
|
-
|
|
277
235
|
setState(function (prev) {
|
|
278
236
|
var next = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), {}, {
|
|
279
237
|
fields: (prev.fields || []).concat(field)
|
|
280
|
-
});
|
|
238
|
+
});
|
|
281
239
|
|
|
240
|
+
// Move field to position where it was dropped.
|
|
282
241
|
return utils.moveField({
|
|
283
242
|
field: field,
|
|
284
243
|
position: position,
|
|
@@ -286,14 +245,13 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
286
245
|
});
|
|
287
246
|
});
|
|
288
247
|
};
|
|
248
|
+
|
|
289
249
|
/**
|
|
290
250
|
* Moves field to the given target position.
|
|
291
251
|
*/
|
|
292
|
-
|
|
293
|
-
|
|
294
252
|
var moveField = function moveField(_ref4) {
|
|
295
253
|
var field = _ref4.field,
|
|
296
|
-
|
|
254
|
+
position = _ref4.position;
|
|
297
255
|
setState(function (data) {
|
|
298
256
|
return utils.moveField({
|
|
299
257
|
field: field,
|
|
@@ -302,11 +260,10 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
302
260
|
});
|
|
303
261
|
});
|
|
304
262
|
};
|
|
263
|
+
|
|
305
264
|
/**
|
|
306
265
|
* Moves row to a destination row.
|
|
307
266
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
310
267
|
var moveRow = function moveRow(source, destination) {
|
|
311
268
|
setState(function (data) {
|
|
312
269
|
return utils.moveRow({
|
|
@@ -316,11 +273,10 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
316
273
|
});
|
|
317
274
|
});
|
|
318
275
|
};
|
|
276
|
+
|
|
319
277
|
/**
|
|
320
278
|
* Updates field.
|
|
321
279
|
*/
|
|
322
|
-
|
|
323
|
-
|
|
324
280
|
var updateField = function updateField(field) {
|
|
325
281
|
setState(function (data) {
|
|
326
282
|
for (var i = 0; i < data.fields.length; i++) {
|
|
@@ -328,15 +284,13 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
328
284
|
return _dotPropImmutable.default.set(data, "fields.".concat(i), field);
|
|
329
285
|
}
|
|
330
286
|
}
|
|
331
|
-
|
|
332
287
|
return data;
|
|
333
288
|
});
|
|
334
289
|
};
|
|
290
|
+
|
|
335
291
|
/**
|
|
336
292
|
* Deletes a field (both from the list of field and the layout).
|
|
337
293
|
*/
|
|
338
|
-
|
|
339
|
-
|
|
340
294
|
var deleteField = function deleteField(field) {
|
|
341
295
|
setState(function (data) {
|
|
342
296
|
return utils.deleteField({
|
|
@@ -345,37 +299,30 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
345
299
|
});
|
|
346
300
|
});
|
|
347
301
|
};
|
|
348
|
-
|
|
349
302
|
var noConflict = (0, _react.useCallback)(function (isVisible) {
|
|
350
303
|
return function (item) {
|
|
351
304
|
var sameParent = item.parent === onDropTarget.dropTarget;
|
|
352
305
|
var draggedFields = [];
|
|
353
|
-
|
|
354
306
|
switch (item.type) {
|
|
355
307
|
case "row":
|
|
356
308
|
(item.fields || []).forEach(function (field) {
|
|
357
309
|
return draggedFields.push(field.fieldId);
|
|
358
310
|
});
|
|
359
311
|
break;
|
|
360
|
-
|
|
361
312
|
case "field":
|
|
362
313
|
if (!item.field) {
|
|
363
314
|
break;
|
|
364
315
|
}
|
|
365
|
-
|
|
366
316
|
draggedFields.push(item.field.fieldId);
|
|
367
317
|
break;
|
|
368
|
-
|
|
369
318
|
default:
|
|
370
319
|
break;
|
|
371
320
|
}
|
|
372
|
-
|
|
373
321
|
if (draggedFields.length && !sameParent && fields.some(function (field) {
|
|
374
322
|
return draggedFields.includes(field.fieldId);
|
|
375
323
|
})) {
|
|
376
324
|
return false;
|
|
377
325
|
}
|
|
378
|
-
|
|
379
326
|
return typeof isVisible === "function" ? isVisible(item) : true;
|
|
380
327
|
};
|
|
381
328
|
}, [fields.map(function (f) {
|
|
@@ -386,6 +333,7 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
386
333
|
depth: depth,
|
|
387
334
|
getFieldsInLayout: getFieldsInLayout,
|
|
388
335
|
getFieldPlugin: getFieldPlugin,
|
|
336
|
+
getFieldRendererPlugin: getFieldRendererPlugin,
|
|
389
337
|
getField: getField,
|
|
390
338
|
editField: editField,
|
|
391
339
|
field: state.field,
|
|
@@ -405,5 +353,4 @@ var FieldEditorProvider = function FieldEditorProvider(_ref) {
|
|
|
405
353
|
value: value
|
|
406
354
|
}, children);
|
|
407
355
|
};
|
|
408
|
-
|
|
409
356
|
exports.FieldEditorProvider = FieldEditorProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FieldEditorContext","React","createContext","field","maxGenerateIdIterations","generateFieldId","layout","id","generateAlphaNumericLowerCaseId","iteration","includes","Error","FieldEditorProvider","parent","fields","onChange","children","depth","editor","useFieldEditor","useState","dropTarget","row","index","state","setState","useDeepCompareEffect","editField","useCallback","onDropTarget","fieldId","onFieldDrop","source","pos","type","fieldType","parentId","forEach","insertField","position","undefined","moveRow","moveField","plugin","getFieldPlugin","createField","onEndDrag","monitor","didDrop","getDropResult","removeFields","deleteField","getFieldsInLayout","filter","arr","length","map","getField","Boolean","plugins","byType","find","query","key","flat","fieldPlugin","prev","next","concat","utils","data","destination","updateField","i","dot","set","noConflict","isVisible","item","sameParent","draggedFields","push","some","f","join","value"],"sources":["FieldEditorContext.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport dot from \"dot-prop-immutable\";\nimport useDeepCompareEffect from \"use-deep-compare-effect\";\nimport {\n CmsEditorField,\n CmsEditorFieldId,\n CmsEditorFieldsLayout,\n CmsEditorFieldTypePlugin,\n FieldLayoutPosition\n} from \"~/types\";\nimport { plugins } from \"@webiny/plugins\";\nimport * as utils from \"./utils\";\nimport { FieldEditorProps } from \"./FieldEditor\";\nimport { DragObjectWithType, DragSourceMonitor } from \"react-dnd\";\nimport { useFieldEditor } from \"~/admin/components/FieldEditor/useFieldEditor\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\n\ninterface DropTarget {\n row: number;\n index: number | null;\n}\n\ninterface Position {\n row: number;\n index: number;\n}\n\nexport interface DragSource extends DragObjectWithType {\n parent?: string;\n pos?: Partial<Position>;\n type: \"row\" | \"field\" | \"newField\";\n fieldType?: string;\n field?: CmsEditorField | null;\n fields?: CmsEditorField[];\n}\n\n/**\n * Property in GetFieldParams can be any key from CmsEditorField, but TS does not allow union types\n */\ninterface GetFieldParams {\n id?: string;\n fieldId?: string;\n}\ninterface InsertFieldParams {\n field: CmsEditorField;\n position: FieldLayoutPosition;\n}\ninterface MoveFieldParams {\n field: CmsEditorFieldId | CmsEditorField;\n position: FieldLayoutPosition;\n}\ninterface GetFieldsInLayoutCallable {\n (): CmsEditorField[][];\n}\ninterface GetFieldPluginCallable {\n (type: string): CmsEditorFieldTypePlugin | undefined;\n}\ninterface GetFieldCallable {\n (query: GetFieldParams): CmsEditorField | undefined;\n}\ninterface OnFieldDropCallable {\n (source: Partial<DragSource>, target: DropTarget): void;\n}\ninterface InsertFieldCallable {\n (params: InsertFieldParams): void;\n}\ninterface MoveFieldCallable {\n (params: MoveFieldParams): void;\n}\ninterface OnEndDragCallable {\n (item: DragSource, monitor: DragSourceMonitor): void;\n}\ninterface MoveRowCallable {\n (source: number, destination: number): void;\n}\ninterface UpdateFieldCallable {\n (field: Pick<CmsEditorField, \"id\">): void;\n}\ninterface DeleteFieldCallable {\n (field: Pick<CmsEditorField, \"id\">): void;\n}\ninterface IsVisibleCallable {\n (item: DragSource): boolean;\n}\ninterface NoConflictCallable {\n (cb?: IsVisibleCallable): (item: DragSource) => boolean;\n}\nexport interface FieldEditorContextValue {\n fields: CmsEditorField[][];\n noConflict: NoConflictCallable;\n layout: CmsEditorFieldsLayout;\n onChange?: (data: any) => void;\n getFieldsInLayout: GetFieldsInLayoutCallable;\n getFieldPlugin: GetFieldPluginCallable;\n getField: GetFieldCallable;\n editField: (field: CmsEditorField | null) => void;\n field: CmsEditorField | null;\n parent?: CmsEditorField;\n depth: number;\n dropTarget: DropTarget;\n onFieldDrop: OnFieldDropCallable;\n onEndDrag: OnEndDragCallable;\n insertField: InsertFieldCallable;\n moveField: MoveFieldCallable;\n moveRow: MoveRowCallable;\n updateField: UpdateFieldCallable;\n deleteField: DeleteFieldCallable;\n}\n\ninterface FieldEditorProviderProps extends FieldEditorProps {\n children: React.ReactElement;\n}\n\nexport const FieldEditorContext = React.createContext<FieldEditorContextValue>(\n /**\n * Safe to cast.\n */\n {\n field: null\n } as unknown as FieldEditorContextValue\n);\n/**\n * We try to generate the random id string but with the check that it does not exist already.\n * Chances that the same string exists are quite small, but let's check it anyway.\n *\n * In most cases, there will be no iterations anyway...\n */\nconst maxGenerateIdIterations = 100;\nconst generateFieldId = (layout: string[]): string => {\n let id = generateAlphaNumericLowerCaseId(8);\n\n let iteration = 0;\n while (layout.includes(id) && iteration < maxGenerateIdIterations) {\n id = generateAlphaNumericLowerCaseId(8);\n iteration++;\n }\n if (iteration >= maxGenerateIdIterations) {\n throw new Error(`Could not generate field ID in ${maxGenerateIdIterations} iterations.`);\n }\n return id;\n};\n\ninterface State {\n layout: CmsEditorFieldsLayout;\n fields: CmsEditorField[];\n field: CmsEditorField | null;\n dropTarget: DropTarget;\n}\nexport const FieldEditorProvider: React.FC<FieldEditorProviderProps> = ({\n parent,\n fields,\n layout,\n onChange,\n children\n}) => {\n // We need to determine depth of this provider so we can render drop zones with correct z-indexes.\n let depth = 0;\n try {\n const editor = useFieldEditor();\n depth = editor.depth + 1;\n } catch {\n // There's no parent provider, so this is the top-level one.\n }\n\n const [state, setState] = useState<State>({\n layout,\n fields,\n field: null,\n dropTarget: {\n row: -1,\n index: null\n }\n });\n\n useDeepCompareEffect(() => {\n onChange({ fields: state.fields, layout: state.layout });\n }, [state.fields, state.layout]);\n\n const editField = useCallback((field: CmsEditorField | null) => {\n setState(state => ({ ...state, field }));\n }, []);\n\n const onDropTarget = {\n dropTarget: parent ? parent.fieldId : null\n };\n\n const onFieldDrop = useCallback<OnFieldDropCallable>((source, dropTarget) => {\n const { pos, type, fieldType, field, fields = [] } = source;\n\n const parentId = parent ? parent.fieldId : null;\n\n if (type === \"row\") {\n if (parentId !== source.parent) {\n // We're dragging an existing row from another fieldset\n fields.forEach((field, index) => {\n insertField({\n field,\n position: {\n row: dropTarget.row,\n index: index === 0 ? null : index\n }\n });\n });\n } else if (pos && pos.row !== undefined) {\n // We're dragging a row within the same fieldset\n moveRow(pos.row, dropTarget.row);\n }\n\n return onDropTarget;\n }\n\n // If source pos is set, we are moving an existing field.\n if (pos) {\n if (!field) {\n return onDropTarget;\n }\n if (parentId !== source.parent) {\n // We're dragging an existing field from another fieldset\n insertField({ field, position: dropTarget });\n } else {\n // We're dragging a field within the same fieldset\n moveField({ field, position: dropTarget });\n }\n return onDropTarget;\n }\n\n if (!fieldType) {\n return null;\n }\n const plugin = getFieldPlugin(fieldType);\n if (!plugin) {\n return null;\n }\n /**\n * TODO @ts-refactor figure out better type for this.\n */\n editField(plugin.field.createField() as CmsEditorField);\n setState(state => ({\n ...state,\n dropTarget\n }));\n return null;\n }, []);\n\n const onEndDrag: OnEndDragCallable = ({ type, field, fields }, monitor) => {\n if (!monitor.didDrop()) {\n return;\n }\n\n // Check if we dropped outside of the source fieldset, and if yes, remove the field from the original parent.\n const { dropTarget } = monitor.getDropResult();\n const parentId = parent ? parent.fieldId : null;\n if (dropTarget === parentId) {\n return;\n }\n\n const removeFields = type === \"row\" ? fields || [] : field ? [field] : [];\n removeFields.forEach(field => deleteField(field));\n };\n\n const getFieldsInLayout: GetFieldsInLayoutCallable = () => {\n // Replace every field ID with actual field object.\n return state.layout\n .filter(arr => arr.length)\n .map(row => {\n return row\n .map(id => {\n return getField({ id });\n })\n .filter(Boolean);\n })\n .filter(row => {\n return row.length > 0;\n }) as CmsEditorField[][];\n };\n\n /**\n * Return field plugin.\n */\n const getFieldPlugin: GetFieldPluginCallable = type => {\n return plugins\n .byType<CmsEditorFieldTypePlugin>(\"cms-editor-field-type\")\n .find(plugin => plugin.field.type === type);\n };\n\n /**\n * Checks if field of given type already exists in the list of fields.\n */\n const getField: GetFieldCallable = query => {\n return state.fields.find(field => {\n for (const key in query) {\n if (!(key in field)) {\n return false;\n }\n // TODO @ts-refactor figure if there is a way to fix this.\n // @ts-ignore\n if (field[key] !== query[key]) {\n return false;\n }\n }\n\n return true;\n });\n };\n\n /**\n * Inserts a new field into the target position.\n */\n const insertField: InsertFieldCallable = ({ field, position }) => {\n if (!field.id) {\n field.id = generateFieldId(layout.flat());\n }\n\n if (!field.type) {\n throw new Error(`Field \"type\" missing.`);\n }\n\n const fieldPlugin = getFieldPlugin(field.type);\n if (!fieldPlugin) {\n throw new Error(`Invalid field \"type\".`);\n }\n\n setState(prev => {\n const next: State = {\n ...prev,\n fields: (prev.fields || []).concat(field)\n };\n\n // Move field to position where it was dropped.\n return utils.moveField({ field, position, data: next });\n });\n };\n\n /**\n * Moves field to the given target position.\n */\n const moveField: MoveFieldCallable = ({ field, position }) => {\n setState(data => {\n return utils.moveField<State>({ field, position, data });\n });\n };\n\n /**\n * Moves row to a destination row.\n */\n const moveRow: MoveRowCallable = (source, destination) => {\n setState(data => {\n return utils.moveRow({ data, source, destination });\n });\n };\n\n /**\n * Updates field.\n */\n const updateField: UpdateFieldCallable = field => {\n setState(data => {\n for (let i = 0; i < data.fields.length; i++) {\n if (data.fields[i].id === field.id) {\n return dot.set(data, `fields.${i}`, field);\n }\n }\n return data;\n });\n };\n\n /**\n * Deletes a field (both from the list of field and the layout).\n */\n const deleteField: DeleteFieldCallable = field => {\n setState(data => {\n return utils.deleteField({ field, data });\n });\n };\n\n const noConflict: NoConflictCallable = useCallback(\n (isVisible?: IsVisibleCallable) => item => {\n const sameParent = item.parent === onDropTarget.dropTarget;\n const draggedFields: string[] = [];\n switch (item.type) {\n case \"row\":\n (item.fields || []).forEach(field => draggedFields.push(field.fieldId));\n break;\n case \"field\":\n if (!item.field) {\n break;\n }\n draggedFields.push(item.field.fieldId);\n break;\n default:\n break;\n }\n\n if (\n draggedFields.length &&\n !sameParent &&\n fields.some(field => draggedFields.includes(field.fieldId))\n ) {\n return false;\n }\n\n return typeof isVisible === \"function\" ? isVisible(item) : true;\n },\n [fields.map(f => f.fieldId).join(\".\")]\n );\n\n const value = {\n parent,\n depth,\n getFieldsInLayout,\n getFieldPlugin,\n getField,\n editField,\n field: state.field,\n dropTarget: state.dropTarget,\n onFieldDrop,\n onEndDrag,\n insertField,\n moveField,\n moveRow,\n updateField,\n deleteField,\n fields: getFieldsInLayout(),\n noConflict,\n layout: state.layout\n };\n\n return <FieldEditorContext.Provider value={value}>{children}</FieldEditorContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAQA;;AACA;;AAGA;;AACA;;AAkGO,IAAMA,kBAAkB,gBAAGC,cAAA,CAAMC,aAAN;AAC9B;AACJ;AACA;AACI;EACIC,KAAK,EAAE;AADX,CAJ8B,CAA3B;AAQP;AACA;AACA;AACA;AACA;AACA;;;;AACA,IAAMC,uBAAuB,GAAG,GAAhC;;AACA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,MAAD,EAA8B;EAClD,IAAIC,EAAE,GAAG,IAAAC,uCAAA,EAAgC,CAAhC,CAAT;EAEA,IAAIC,SAAS,GAAG,CAAhB;;EACA,OAAOH,MAAM,CAACI,QAAP,CAAgBH,EAAhB,KAAuBE,SAAS,GAAGL,uBAA1C,EAAmE;IAC/DG,EAAE,GAAG,IAAAC,uCAAA,EAAgC,CAAhC,CAAL;IACAC,SAAS;EACZ;;EACD,IAAIA,SAAS,IAAIL,uBAAjB,EAA0C;IACtC,MAAM,IAAIO,KAAJ,0CAA4CP,uBAA5C,kBAAN;EACH;;EACD,OAAOG,EAAP;AACH,CAZD;;AAoBO,IAAMK,mBAAuD,GAAG,SAA1DA,mBAA0D,OAMjE;EAAA,IALFC,MAKE,QALFA,MAKE;EAAA,IAJFC,MAIE,QAJFA,MAIE;EAAA,IAHFR,MAGE,QAHFA,MAGE;EAAA,IAFFS,QAEE,QAFFA,QAEE;EAAA,IADFC,QACE,QADFA,QACE;EACF;EACA,IAAIC,KA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version":3,"names":["FieldEditorContext","React","createContext","undefined","maxGenerateIdIterations","generateFieldId","layout","id","generateAlphaNumericLowerCaseId","iteration","includes","Error","FieldEditorProvider","parent","fields","onChange","children","depth","editor","useModelFieldEditor","useState","field","dropTarget","row","index","state","setState","useDeepCompareEffect","editField","useCallback","onDropTarget","fieldId","onFieldDrop","source","pos","type","fieldType","parentId","forEach","insertField","position","moveRow","moveField","plugin","getFieldPlugin","fieldData","createField","canEditSettings","onEndDrag","monitor","didDrop","getDropResult","removeFields","deleteField","getFieldsInLayout","filter","arr","length","map","getField","Boolean","plugins","byType","find","getFieldRendererPlugin","name","renderer","rendererName","query","key","flat","fieldPlugin","prev","next","concat","utils","data","destination","updateField","i","dot","set","noConflict","isVisible","item","sameParent","draggedFields","push","some","f","join","value"],"sources":["FieldEditorContext.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport dot from \"dot-prop-immutable\";\nimport useDeepCompareEffect from \"use-deep-compare-effect\";\nimport {\n CmsModelField,\n CmsEditorFieldId,\n CmsEditorFieldRendererPlugin,\n CmsEditorFieldsLayout,\n CmsEditorFieldTypePlugin,\n FieldLayoutPosition\n} from \"~/types\";\nimport { plugins } from \"@webiny/plugins\";\nimport * as utils from \"./utils\";\nimport { FieldEditorProps } from \"./FieldEditor\";\nimport { DragObjectWithType, DragSourceMonitor } from \"react-dnd\";\nimport { useModelFieldEditor } from \"~/admin/components/FieldEditor/useModelFieldEditor\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\n\ninterface DropTarget {\n row: number;\n index: number | null;\n}\n\ninterface Position {\n row: number;\n index: number;\n}\n\nexport interface DragSource extends DragObjectWithType {\n parent?: string;\n pos?: Partial<Position>;\n type: \"row\" | \"field\" | \"newField\";\n fieldType?: string;\n field?: CmsModelField | null;\n fields?: CmsModelField[];\n}\n\n/**\n * Property in GetFieldParams can be any key from CmsEditorField, but TS does not allow union types\n */\ninterface GetFieldParams {\n id?: string;\n fieldId?: string;\n}\ninterface InsertFieldParams {\n field: CmsModelField;\n position: FieldLayoutPosition;\n}\ninterface MoveFieldParams {\n field: CmsEditorFieldId | CmsModelField;\n position: FieldLayoutPosition;\n}\ninterface GetFieldsInLayoutCallable {\n (): CmsModelField[][];\n}\ninterface GetFieldPluginCallable {\n (type: string): CmsEditorFieldTypePlugin | undefined;\n}\ninterface GetFieldCallable {\n (query: GetFieldParams): CmsModelField | undefined;\n}\ninterface GetFieldRendererCallable {\n (rendererName: string): CmsEditorFieldRendererPlugin | undefined;\n}\ninterface OnFieldDropCallable {\n (source: Partial<DragSource>, target: DropTarget): void;\n}\ninterface InsertFieldCallable {\n (params: InsertFieldParams): void;\n}\ninterface MoveFieldCallable {\n (params: MoveFieldParams): void;\n}\ninterface OnEndDragCallable {\n (item: DragSource, monitor: DragSourceMonitor): void;\n}\ninterface MoveRowCallable {\n (source: number, destination: number): void;\n}\ninterface UpdateFieldCallable {\n (field: CmsModelField): void;\n}\ninterface DeleteFieldCallable {\n (field: Pick<CmsModelField, \"id\">): void;\n}\nexport interface IsVisibleCallable {\n (item: DragSource): boolean;\n}\ninterface NoConflictCallable {\n (cb?: IsVisibleCallable): (item: DragSource) => boolean;\n}\nexport interface FieldEditorContext {\n fields: CmsModelField[][];\n noConflict: NoConflictCallable;\n layout: CmsEditorFieldsLayout;\n onChange?: (data: any) => void;\n getFieldsInLayout: GetFieldsInLayoutCallable;\n getFieldPlugin: GetFieldPluginCallable;\n getField: GetFieldCallable;\n getFieldRendererPlugin: GetFieldRendererCallable;\n editField: (field: CmsModelField | null) => void;\n field: CmsModelField | null;\n parent?: CmsModelField;\n depth: number;\n dropTarget: DropTarget;\n onFieldDrop: OnFieldDropCallable;\n onEndDrag: OnEndDragCallable;\n insertField: InsertFieldCallable;\n moveField: MoveFieldCallable;\n moveRow: MoveRowCallable;\n updateField: UpdateFieldCallable;\n deleteField: DeleteFieldCallable;\n}\n\ninterface FieldEditorProviderProps extends FieldEditorProps {\n children: React.ReactElement;\n}\n\nexport const FieldEditorContext = React.createContext<FieldEditorContext | undefined>(undefined);\n/**\n * We try to generate the random id string but with the check that it does not exist already.\n * Chances that the same string exists are quite small, but let's check it anyway.\n *\n * In most cases, there will be no iterations anyway...\n */\nconst maxGenerateIdIterations = 100;\nconst generateFieldId = (layout: string[]): string => {\n let id = generateAlphaNumericLowerCaseId(8);\n\n let iteration = 0;\n while (layout.includes(id) && iteration < maxGenerateIdIterations) {\n id = generateAlphaNumericLowerCaseId(8);\n iteration++;\n }\n if (iteration >= maxGenerateIdIterations) {\n throw new Error(`Could not generate field ID in ${maxGenerateIdIterations} iterations.`);\n }\n return id;\n};\n\ninterface State {\n layout: CmsEditorFieldsLayout;\n fields: CmsModelField[];\n field: CmsModelField | null;\n dropTarget: DropTarget;\n}\nexport const FieldEditorProvider: React.FC<FieldEditorProviderProps> = ({\n parent,\n fields,\n layout,\n onChange,\n children\n}) => {\n // We need to determine depth of this provider so we can render drop zones with correct z-indexes.\n let depth = 0;\n try {\n const editor = useModelFieldEditor();\n depth = editor.depth + 1;\n } catch {\n // There's no parent provider, so this is the top-level one.\n }\n\n const [state, setState] = useState<State>({\n layout,\n fields,\n field: null,\n dropTarget: {\n row: -1,\n index: null\n }\n });\n\n useDeepCompareEffect(() => {\n onChange({ fields: state.fields, layout: state.layout });\n }, [state.fields, state.layout]);\n\n const editField = useCallback((field: CmsModelField | null) => {\n setState(state => ({ ...state, field }));\n }, []);\n\n const onDropTarget = {\n dropTarget: parent ? parent.fieldId : null\n };\n\n const onFieldDrop = useCallback<OnFieldDropCallable>((source, dropTarget) => {\n const { pos, type, fieldType, field, fields = [] } = source;\n\n const parentId = parent ? parent.fieldId : null;\n\n if (type === \"row\") {\n if (parentId !== source.parent) {\n // We're dragging an existing row from another fieldset\n fields.forEach((field, index) => {\n insertField({\n field,\n position: {\n row: dropTarget.row,\n index: index === 0 ? null : index\n }\n });\n });\n } else if (pos && pos.row !== undefined) {\n // We're dragging a row within the same fieldset\n moveRow(pos.row, dropTarget.row);\n }\n\n return onDropTarget;\n }\n\n // If source pos is set, we are moving an existing field.\n if (pos) {\n if (!field) {\n return onDropTarget;\n }\n if (parentId !== source.parent) {\n // We're dragging an existing field from another fieldset\n insertField({ field, position: dropTarget });\n } else {\n // We're dragging a field within the same fieldset\n moveField({ field, position: dropTarget });\n }\n return onDropTarget;\n }\n\n if (!fieldType) {\n return null;\n }\n const plugin = getFieldPlugin(fieldType);\n if (!plugin) {\n return null;\n }\n\n const fieldData = plugin.field.createField() as CmsModelField;\n\n if (plugin.field.canEditSettings !== false) {\n editField(fieldData);\n setState(state => ({\n ...state,\n dropTarget\n }));\n } else {\n insertField({ field: fieldData, position: dropTarget });\n }\n return null;\n }, []);\n\n const onEndDrag: OnEndDragCallable = ({ type, field, fields }, monitor) => {\n if (!monitor.didDrop()) {\n return;\n }\n\n // Check if we dropped outside of the source fieldset, and if yes, remove the field from the original parent.\n const { dropTarget } = monitor.getDropResult();\n const parentId = parent ? parent.fieldId : null;\n if (dropTarget === parentId) {\n return;\n }\n\n const removeFields = type === \"row\" ? fields || [] : field ? [field] : [];\n removeFields.forEach(field => deleteField(field));\n };\n\n const getFieldsInLayout: GetFieldsInLayoutCallable = () => {\n // Replace every field ID with actual field object.\n return state.layout\n .filter(arr => arr.length)\n .map(row => {\n return row\n .map(id => {\n return getField({ id });\n })\n .filter(Boolean);\n })\n .filter(row => {\n return row.length > 0;\n }) as CmsModelField[][];\n };\n\n /**\n * Return field plugin.\n */\n const getFieldPlugin: GetFieldPluginCallable = type => {\n return plugins\n .byType<CmsEditorFieldTypePlugin>(\"cms-editor-field-type\")\n .find(plugin => plugin.field.type === type);\n };\n\n const getFieldRendererPlugin: GetFieldRendererCallable = name => {\n return plugins\n .byType<CmsEditorFieldRendererPlugin>(\"cms-editor-field-renderer\")\n .find(plugin => plugin.renderer.rendererName === name);\n };\n\n /**\n * Checks if field of given type already exists in the list of fields.\n */\n const getField: GetFieldCallable = query => {\n return state.fields.find(field => {\n for (const key in query) {\n if (!(key in field)) {\n return false;\n }\n // TODO @ts-refactor figure if there is a way to fix this.\n // @ts-ignore\n if (field[key] !== query[key]) {\n return false;\n }\n }\n\n return true;\n });\n };\n\n /**\n * Inserts a new field into the target position.\n */\n const insertField: InsertFieldCallable = ({ field, position }) => {\n if (!field.id) {\n field.id = generateFieldId(layout.flat());\n }\n\n if (!field.type) {\n throw new Error(`Field \"type\" missing.`);\n }\n\n const fieldPlugin = getFieldPlugin(field.type);\n if (!fieldPlugin) {\n throw new Error(`No plugin found for field type \"${field.type}\".`);\n }\n\n setState(prev => {\n const next: State = {\n ...prev,\n fields: (prev.fields || []).concat(field)\n };\n\n // Move field to position where it was dropped.\n return utils.moveField({ field, position, data: next });\n });\n };\n\n /**\n * Moves field to the given target position.\n */\n const moveField: MoveFieldCallable = ({ field, position }) => {\n setState(data => {\n return utils.moveField<State>({ field, position, data });\n });\n };\n\n /**\n * Moves row to a destination row.\n */\n const moveRow: MoveRowCallable = (source, destination) => {\n setState(data => {\n return utils.moveRow({ data, source, destination });\n });\n };\n\n /**\n * Updates field.\n */\n const updateField: UpdateFieldCallable = field => {\n setState(data => {\n for (let i = 0; i < data.fields.length; i++) {\n if (data.fields[i].id === field.id) {\n return dot.set(data, `fields.${i}`, field);\n }\n }\n return data;\n });\n };\n\n /**\n * Deletes a field (both from the list of field and the layout).\n */\n const deleteField: DeleteFieldCallable = field => {\n setState(data => {\n return utils.deleteField({ field, data });\n });\n };\n\n const noConflict: NoConflictCallable = useCallback(\n (isVisible?: IsVisibleCallable) => item => {\n const sameParent = item.parent === onDropTarget.dropTarget;\n const draggedFields: string[] = [];\n switch (item.type) {\n case \"row\":\n (item.fields || []).forEach(field => draggedFields.push(field.fieldId));\n break;\n case \"field\":\n if (!item.field) {\n break;\n }\n draggedFields.push(item.field.fieldId);\n break;\n default:\n break;\n }\n\n if (\n draggedFields.length &&\n !sameParent &&\n fields.some(field => draggedFields.includes(field.fieldId))\n ) {\n return false;\n }\n\n return typeof isVisible === \"function\" ? isVisible(item) : true;\n },\n [fields.map(f => f.fieldId).join(\".\")]\n );\n\n const value: FieldEditorContext = {\n parent,\n depth,\n getFieldsInLayout,\n getFieldPlugin,\n getFieldRendererPlugin,\n getField,\n editField,\n field: state.field,\n dropTarget: state.dropTarget,\n onFieldDrop,\n onEndDrag,\n insertField,\n moveField,\n moveRow,\n updateField,\n deleteField,\n fields: getFieldsInLayout(),\n noConflict,\n layout: state.layout\n };\n\n return <FieldEditorContext.Provider value={value}>{children}</FieldEditorContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AASA;AACA;AAGA;AACA;AAsGO,IAAMA,kBAAkB,gBAAGC,cAAK,CAACC,aAAa,CAAiCC,SAAS,CAAC;AAChG;AACA;AACA;AACA;AACA;AACA;AALA;AAMA,IAAMC,uBAAuB,GAAG,GAAG;AACnC,IAAMC,eAAe,GAAG,SAAlBA,eAAe,CAAIC,MAAgB,EAAa;EAClD,IAAIC,EAAE,GAAG,IAAAC,uCAA+B,EAAC,CAAC,CAAC;EAE3C,IAAIC,SAAS,GAAG,CAAC;EACjB,OAAOH,MAAM,CAACI,QAAQ,CAACH,EAAE,CAAC,IAAIE,SAAS,GAAGL,uBAAuB,EAAE;IAC/DG,EAAE,GAAG,IAAAC,uCAA+B,EAAC,CAAC,CAAC;IACvCC,SAAS,EAAE;EACf;EACA,IAAIA,SAAS,IAAIL,uBAAuB,EAAE;IACtC,MAAM,IAAIO,KAAK,0CAAmCP,uBAAuB,kBAAe;EAC5F;EACA,OAAOG,EAAE;AACb,CAAC;AAQM,IAAMK,mBAAuD,GAAG,SAA1DA,mBAAuD,OAM9D;EAAA,IALFC,MAAM,QAANA,MAAM;IACNC,MAAM,QAANA,MAAM;IACNR,MAAM,QAANA,MAAM;IACNS,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;EAER;EACA,IAAIC,KAAK,GAAG,CAAC;EACb,IAAI;IACA,IAAMC,MAAM,GAAG,IAAAC,wCAAmB,GAAE;I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BAAC,kBAAkB,CAAC,QAAQ;IAAC,KAAK,EAAEqF;EAAM,GAAE3E,QAAQ,CAA+B;AAC9F,CAAC;AAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="web" />
|
|
3
2
|
/// <reference types="react" />
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
3
|
+
/// <reference types="web" />
|
|
4
|
+
export declare const RowContainer: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
6
|
+
as?: import("react").ElementType<any> | undefined;
|
|
7
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
export declare const Row: import("@emotion/styled").StyledComponent<{
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
as?: import("react").ElementType<any> | undefined;
|
|
11
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
12
|
export declare const fieldContainer: string;
|
|
7
13
|
export declare const rowHandle: string;
|
|
8
14
|
export declare const fieldHandle: string;
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.rowHandle = exports.fieldHandle = exports.fieldContainer = exports.RowContainer = exports.Row = void 0;
|
|
9
|
-
|
|
10
8
|
var _emotion = require("emotion");
|
|
11
|
-
|
|
12
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
13
|
-
|
|
14
10
|
var RowContainer = /*#__PURE__*/(0, _styled.default)("div", {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})({
|
|
18
|
-
position: "relative",
|
|
19
|
-
display: "flex",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
marginBottom: 20,
|
|
22
|
-
borderRadius: 2,
|
|
23
|
-
backgroundColor: "var(--mdc-theme-surface)",
|
|
24
|
-
border: "1px solid var(--mdc-theme-on-background)",
|
|
25
|
-
boxShadow: "var(--mdc-theme-on-background) 1px 1px 1px, var(--mdc-theme-on-background) 1px 1px 2px"
|
|
26
|
-
});
|
|
11
|
+
label: "RowContainer",
|
|
12
|
+
target: "e1pk1rsi0"
|
|
13
|
+
})("position:relative;display:flex;flex-direction:column;margin-bottom:20px;border-radius:2px;background-color:var(--mdc-theme-surface);border:1px solid var(--mdc-theme-on-background);box-shadow:var(--mdc-theme-on-background) 1px 1px 1px,var(--mdc-theme-on-background) 1px 1px 2px;:last-child{margin-bottom:5px;}");
|
|
27
14
|
exports.RowContainer = RowContainer;
|
|
28
15
|
var Row = /*#__PURE__*/(0, _styled.default)("div", {
|
|
29
16
|
target: "e1pk1rsi1",
|
|
@@ -41,7 +28,7 @@ var fieldContainer = /*#__PURE__*/(0, _emotion.css)({
|
|
|
41
28
|
position: "relative",
|
|
42
29
|
flex: "1 100%",
|
|
43
30
|
backgroundColor: "var(--mdc-theme-background)",
|
|
44
|
-
padding: "
|
|
31
|
+
padding: "2px 15px 2px",
|
|
45
32
|
margin: 10,
|
|
46
33
|
borderRadius: 2,
|
|
47
34
|
border: "1px solid var(--mdc-theme-on-background)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RowContainer","styled","
|
|
1
|
+
{"version":3,"names":["RowContainer","styled","Row","display","flexDirection","backgroundColor","paddingLeft","paddingRight","position","fieldContainer","css","flex","padding","margin","borderRadius","border","transition","color","cursor","boxShadow","rowHandle","width","left","top","transform","zIndex","fieldHandle"],"sources":["Styled.ts"],"sourcesContent":["import { css } from \"emotion\";\nimport styled from \"@emotion/styled\";\n\nexport const RowContainer = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n border-radius: 2px;\n background-color: var(--mdc-theme-surface);\n border: 1px solid var(--mdc-theme-on-background);\n box-shadow: var(--mdc-theme-on-background) 1px 1px 1px,\n var(--mdc-theme-on-background) 1px 1px 2px;\n :last-child {\n margin-bottom: 5px;\n }\n`;\n\nexport const Row = styled(\"div\")({\n display: \"flex\",\n flexDirection: \"row\",\n backgroundColor: \"var(--mdc-theme-surface)\",\n paddingLeft: 40,\n paddingRight: 10,\n position: \"relative\"\n});\n\nexport const fieldContainer = css({\n position: \"relative\",\n flex: \"1 100%\",\n backgroundColor: \"var(--mdc-theme-background)\",\n padding: \"2px 15px 2px\",\n margin: 10,\n borderRadius: 2,\n border: \"1px solid var(--mdc-theme-on-background)\",\n transition: \"box-shadow 225ms\",\n color: \"var(--mdc-theme-on-surface)\",\n cursor: \"grab\",\n \"&:hover\": {\n boxShadow:\n \"var(--mdc-theme-on-background) 1px 1px 1px, var(--mdc-theme-on-background) 1px 1px 2px\"\n }\n});\n\nexport const rowHandle = css({\n width: 30,\n cursor: \"grab\",\n position: \"absolute\",\n left: 10,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n zIndex: 1,\n color: \"var(--mdc-theme-on-surface)\"\n});\n\nexport const fieldHandle = css({\n cursor: \"grab\"\n});\n"],"mappings":";;;;;;;AAAA;AACA;AAEO,IAAMA,YAAY,oBAAGC,eAAM;EAAA;EAAA;AAAA,0TAajC;AAAC;AAEK,IAAMC,GAAG,oBAAGD,eAAM,EAAC,KAAK;EAAA;EAAA;AAAA,GAAE;EAC7BE,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,0BAA0B;EAC3CC,WAAW,EAAE,EAAE;EACfC,YAAY,EAAE,EAAE;EAChBC,QAAQ,EAAE;AACd,CAAC,CAAC;AAAC;AAEI,IAAMC,cAAc,gBAAG,IAAAC,YAAG,EAAC;EAC9BF,QAAQ,EAAE,UAAU;EACpBG,IAAI,EAAE,QAAQ;EACdN,eAAe,EAAE,6BAA6B;EAC9CO,OAAO,EAAE,cAAc;EACvBC,MAAM,EAAE,EAAE;EACVC,YAAY,EAAE,CAAC;EACfC,MAAM,EAAE,0CAA0C;EAClDC,UAAU,EAAE,kBAAkB;EAC9BC,KAAK,EAAE,6BAA6B;EACpCC,MAAM,EAAE,MAAM;EACd,SAAS,EAAE;IACPC,SAAS,EACL;EACR;AACJ,CAAC,0BAAC;AAAC;AAEI,IAAMC,SAAS,gBAAG,IAAAV,YAAG,EAAC;EACzBW,KAAK,EAAE,EAAE;EACTH,MAAM,EAAE,MAAM;EACdV,QAAQ,EAAE,UAAU;EACpBc,IAAI,EAAE,EAAE;EACRC,GAAG,EAAE,KAAK;EACVC,SAAS,EAAE,kBAAkB;EAC7BC,MAAM,EAAE,CAAC;EACTR,KAAK,EAAE;AACX,CAAC,qBAAC;AAAC;AAEI,IAAMS,WAAW,gBAAG,IAAAhB,YAAG,EAAC;EAC3BQ,MAAM,EAAE;AACZ,CAAC,uBAAC;AAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { FieldEditor } from "./FieldEditor";
|
|
2
|
-
export {
|
|
2
|
+
export { useModelFieldEditor } from "./useModelFieldEditor";
|
|
@@ -9,13 +9,11 @@ Object.defineProperty(exports, "FieldEditor", {
|
|
|
9
9
|
return _FieldEditor.FieldEditor;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "useModelFieldEditor", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _useModelFieldEditor.useModelFieldEditor;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
var _FieldEditor = require("./FieldEditor");
|
|
20
|
-
|
|
21
|
-
var _useFieldEditor = require("./useFieldEditor");
|
|
19
|
+
var _useModelFieldEditor = require("./useModelFieldEditor");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { FieldEditor } from \"./FieldEditor\";\nexport {
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { FieldEditor } from \"./FieldEditor\";\nexport { useModelFieldEditor } from \"./useModelFieldEditor\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA"}
|