@webiny/app-headless-cms 0.0.0-mt-1
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/LICENSE +21 -0
- package/README.md +18 -0
- package/admin/components/ContentEntryForm/ContentEntryForm.d.ts +8 -0
- package/admin/components/ContentEntryForm/ContentEntryForm.js +68 -0
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.d.ts +7 -0
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js +43 -0
- package/admin/components/ContentEntryForm/Fields.d.ts +12 -0
- package/admin/components/ContentEntryForm/Fields.js +33 -0
- package/admin/components/ContentEntryForm/Label.d.ts +5 -0
- package/admin/components/ContentEntryForm/Label.js +20 -0
- package/admin/components/ContentEntryForm/RenderFieldElement.d.ts +8 -0
- package/admin/components/ContentEntryForm/RenderFieldElement.js +40 -0
- package/admin/components/ContentEntryForm/functions/createValidators.d.ts +1 -0
- package/admin/components/ContentEntryForm/functions/createValidators.js +58 -0
- package/admin/components/ContentEntryForm/functions/getValue.d.ts +5 -0
- package/admin/components/ContentEntryForm/functions/getValue.js +20 -0
- package/admin/components/ContentEntryForm/functions/setValue.d.ts +6 -0
- package/admin/components/ContentEntryForm/functions/setValue.js +20 -0
- package/admin/components/ContentEntryForm/useBind.d.ts +10 -0
- package/admin/components/ContentEntryForm/useBind.js +76 -0
- package/admin/components/ContentEntryForm/useContentEntryForm.d.ts +22 -0
- package/admin/components/ContentEntryForm/useContentEntryForm.js +338 -0
- package/admin/components/ContentEntryForm/useRenderPlugins.d.ts +2 -0
- package/admin/components/ContentEntryForm/useRenderPlugins.js +7 -0
- package/admin/components/ContentModelEditor/Context.d.ts +23 -0
- package/admin/components/ContentModelEditor/Context.js +218 -0
- package/admin/components/ContentModelEditor/Editor.d.ts +3 -0
- package/admin/components/ContentModelEditor/Editor.js +138 -0
- package/admin/components/ContentModelEditor/FieldsSidebar.d.ts +4 -0
- package/admin/components/ContentModelEditor/FieldsSidebar.js +91 -0
- package/admin/components/ContentModelEditor/Header.d.ts +2 -0
- package/admin/components/ContentModelEditor/Header.js +24 -0
- package/admin/components/ContentModelEditor/PreviewTab.d.ts +2 -0
- package/admin/components/ContentModelEditor/PreviewTab.js +36 -0
- package/admin/components/ContentModelEditor/icons/round-assignment-24px.svg +4 -0
- package/admin/components/ContentModelEditor/icons/round-drag_indicator-24px.svg +4 -0
- package/admin/components/ContentModelEditor/useContentModelEditor.d.ts +1 -0
- package/admin/components/ContentModelEditor/useContentModelEditor.js +11 -0
- package/admin/components/DragPreview.d.ts +2 -0
- package/admin/components/DragPreview.js +98 -0
- package/admin/components/Draggable.d.ts +14 -0
- package/admin/components/Draggable.js +49 -0
- package/admin/components/DropZone/Center.d.ts +12 -0
- package/admin/components/DropZone/Center.js +60 -0
- package/admin/components/DropZone/Horizontal.d.ts +9 -0
- package/admin/components/DropZone/Horizontal.js +83 -0
- package/admin/components/DropZone/Vertical.d.ts +10 -0
- package/admin/components/DropZone/Vertical.js +79 -0
- package/admin/components/DropZone/index.d.ts +4 -0
- package/admin/components/DropZone/index.js +4 -0
- package/admin/components/Droppable.d.ts +23 -0
- package/admin/components/Droppable.js +45 -0
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.d.ts +3 -0
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js +83 -0
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.d.ts +10 -0
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +120 -0
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.d.ts +5 -0
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js +55 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.d.ts +10 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js +121 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.d.ts +6 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.js +16 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.d.ts +7 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.js +21 -0
- package/admin/components/FieldEditor/EditFieldDialog.d.ts +9 -0
- package/admin/components/FieldEditor/EditFieldDialog.js +231 -0
- package/admin/components/FieldEditor/Field.d.ts +3 -0
- package/admin/components/FieldEditor/Field.js +179 -0
- package/admin/components/FieldEditor/FieldEditor.d.ts +12 -0
- package/admin/components/FieldEditor/FieldEditor.js +166 -0
- package/admin/components/FieldEditor/FieldEditorContext.d.ts +53 -0
- package/admin/components/FieldEditor/FieldEditorContext.js +330 -0
- package/admin/components/FieldEditor/Styled.d.ts +6 -0
- package/admin/components/FieldEditor/Styled.js +54 -0
- package/admin/components/FieldEditor/index.d.ts +2 -0
- package/admin/components/FieldEditor/index.js +2 -0
- package/admin/components/FieldEditor/useFieldEditor.d.ts +1 -0
- package/admin/components/FieldEditor/useFieldEditor.js +5 -0
- package/admin/components/FieldEditor/utils/deleteField.d.ts +10 -0
- package/admin/components/FieldEditor/utils/deleteField.js +34 -0
- package/admin/components/FieldEditor/utils/getFieldPosition.d.ts +6 -0
- package/admin/components/FieldEditor/utils/getFieldPosition.js +20 -0
- package/admin/components/FieldEditor/utils/index.d.ts +4 -0
- package/admin/components/FieldEditor/utils/index.js +4 -0
- package/admin/components/FieldEditor/utils/moveField.d.ts +7 -0
- package/admin/components/FieldEditor/utils/moveField.js +51 -0
- package/admin/components/FieldEditor/utils/moveRow.d.ts +9 -0
- package/admin/components/FieldEditor/utils/moveRow.js +10 -0
- package/admin/constants/statusLabels.d.ts +8 -0
- package/admin/constants/statusLabels.js +13 -0
- package/admin/contexts/Cms/NetworkError.d.ts +2 -0
- package/admin/contexts/Cms/NetworkError.js +7 -0
- package/admin/contexts/Cms/index.d.ts +16 -0
- package/admin/contexts/Cms/index.js +43 -0
- package/admin/elements/ContentGroupMenuElement.d.ts +3 -0
- package/admin/elements/ContentGroupMenuElement.js +17 -0
- package/admin/elements/ContentModelMenuElement.d.ts +3 -0
- package/admin/elements/ContentModelMenuElement.js +17 -0
- package/admin/elements/NothingToShowElement.d.ts +15 -0
- package/admin/elements/NothingToShowElement.js +88 -0
- package/admin/graphql/contentEntries.d.ts +12 -0
- package/admin/graphql/contentEntries.js +68 -0
- package/admin/graphql/contentModels.d.ts +4 -0
- package/admin/graphql/contentModels.js +9 -0
- package/admin/graphql/createFieldsList.d.ts +2 -0
- package/admin/graphql/createFieldsList.js +21 -0
- package/admin/hooks/index.d.ts +5 -0
- package/admin/hooks/index.js +5 -0
- package/admin/hooks/useApolloClient.d.ts +2 -0
- package/admin/hooks/useApolloClient.js +10 -0
- package/admin/hooks/useCms.d.ts +3 -0
- package/admin/hooks/useCms.js +14 -0
- package/admin/hooks/useLazyQuery.d.ts +2 -0
- package/admin/hooks/useLazyQuery.js +16 -0
- package/admin/hooks/useMutation.d.ts +2 -0
- package/admin/hooks/useMutation.js +16 -0
- package/admin/hooks/usePermission.d.ts +27 -0
- package/admin/hooks/usePermission.js +218 -0
- package/admin/hooks/useQuery.d.ts +2 -0
- package/admin/hooks/useQuery.js +17 -0
- package/admin/icons/add.svg +5 -0
- package/admin/icons/arrow_forward-24px.svg +1 -0
- package/admin/icons/baseline-autorenew-24px.svg +4 -0
- package/admin/icons/beenhere.svg +1 -0
- package/admin/icons/call_split-24px.svg +4 -0
- package/admin/icons/close.svg +13 -0
- package/admin/icons/delete.svg +12 -0
- package/admin/icons/devices_other-black-24px.svg +1 -0
- package/admin/icons/done-24px.svg +1 -0
- package/admin/icons/edit.svg +17 -0
- package/admin/icons/emoji_people-24px.svg +1 -0
- package/admin/icons/gesture.svg +1 -0
- package/admin/icons/help_outline.svg +1 -0
- package/admin/icons/how_to_vote-24px.svg +4 -0
- package/admin/icons/info.svg +1 -0
- package/admin/icons/lock.svg +1 -0
- package/admin/icons/more_vert.svg +12 -0
- package/admin/icons/publish.svg +1 -0
- package/admin/icons/round-arrow_drop_down-24px.svg +12 -0
- package/admin/icons/round-drag_indicator-24px.svg +4 -0
- package/admin/icons/round-translate-24px.svg +4 -0
- package/admin/icons/rule-24px.svg +1 -0
- package/admin/icons/title-24px.svg +1 -0
- package/admin/icons/unpublish.svg +4 -0
- package/admin/icons/view_list.svg +1 -0
- package/admin/icons/visibility.svg +16 -0
- package/admin/plugins/apiInformation/index.d.ts +3 -0
- package/admin/plugins/apiInformation/index.js +59 -0
- package/admin/plugins/apiInformation/placeholder.manage.graphql +18 -0
- package/admin/plugins/apiInformation/placeholder.preview.graphql +15 -0
- package/admin/plugins/apiInformation/placeholder.read.graphql +16 -0
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.d.ts +21 -0
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js +61 -0
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.d.ts +10 -0
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js +36 -0
- package/admin/plugins/editor/defaultBar/BackButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/BackButton.js +21 -0
- package/admin/plugins/editor/defaultBar/CreateContentButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/CreateContentButton.js +46 -0
- package/admin/plugins/editor/defaultBar/Divider.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/Divider.js +11 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.d.ts +6 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js +90 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.js +27 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +6 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.js +42 -0
- package/admin/plugins/editor/defaultBar/FormSettings/index.d.ts +1 -0
- package/admin/plugins/editor/defaultBar/FormSettings/index.js +1 -0
- package/admin/plugins/editor/defaultBar/Name/Name.d.ts +7 -0
- package/admin/plugins/editor/defaultBar/Name/Name.js +80 -0
- package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +5 -0
- package/admin/plugins/editor/defaultBar/Name/NameStyled.js +48 -0
- package/admin/plugins/editor/defaultBar/Name/index.d.ts +1 -0
- package/admin/plugins/editor/defaultBar/Name/index.js +1 -0
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.js +63 -0
- package/admin/plugins/editor/defaultBar/icons/more_vert.svg +12 -0
- package/admin/plugins/editor/defaultBar/icons/round-arrow_back-24px.svg +13 -0
- package/admin/plugins/editor/defaultBar/icons/round-arrow_drop_down-24px.svg +12 -0
- package/admin/plugins/editor/defaultBar/icons/settings.svg +25 -0
- package/admin/plugins/editor/defaultBar/index.d.ts +7 -0
- package/admin/plugins/editor/defaultBar/index.js +44 -0
- package/admin/plugins/editor/formSettings/components/GeneralSettings.d.ts +7 -0
- package/admin/plugins/editor/formSettings/components/GeneralSettings.js +37 -0
- package/admin/plugins/editor/formSettings/components/GroupSelect.d.ts +3 -0
- package/admin/plugins/editor/formSettings/components/GroupSelect.js +30 -0
- package/admin/plugins/editor/formSettings/icons/round-settings-24px.svg +1 -0
- package/admin/plugins/editor/formSettings/index.d.ts +3 -0
- package/admin/plugins/editor/formSettings/index.js +14 -0
- package/admin/plugins/fieldRenderers/Accordion.d.ts +10 -0
- package/admin/plugins/fieldRenderers/Accordion.js +125 -0
- package/admin/plugins/fieldRenderers/DynamicSection.d.ts +14 -0
- package/admin/plugins/fieldRenderers/DynamicSection.js +103 -0
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.d.ts +3 -0
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.js +34 -0
- package/admin/plugins/fieldRenderers/boolean/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/boolean/index.js +2 -0
- package/admin/plugins/fieldRenderers/checkboxes.d.ts +3 -0
- package/admin/plugins/fieldRenderers/checkboxes.js +45 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.d.ts +9 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js +148 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.d.ts +8 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js +115 -0
- package/admin/plugins/fieldRenderers/dateTime/Input.d.ts +16 -0
- package/admin/plugins/fieldRenderers/dateTime/Input.js +26 -0
- package/admin/plugins/fieldRenderers/dateTime/Select.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/Select.js +13 -0
- package/admin/plugins/fieldRenderers/dateTime/Time.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/Time.js +13 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js +59 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js +84 -0
- package/admin/plugins/fieldRenderers/dateTime/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/dateTime/index.js +3 -0
- package/admin/plugins/fieldRenderers/dateTime/utils.d.ts +15 -0
- package/admin/plugins/fieldRenderers/dateTime/utils.js +153 -0
- package/admin/plugins/fieldRenderers/file/File.d.ts +15 -0
- package/admin/plugins/fieldRenderers/file/File.js +79 -0
- package/admin/plugins/fieldRenderers/file/fileField.d.ts +3 -0
- package/admin/plugins/fieldRenderers/file/fileField.js +64 -0
- package/admin/plugins/fieldRenderers/file/fileFields.d.ts +3 -0
- package/admin/plugins/fieldRenderers/file/fileFields.js +125 -0
- package/admin/plugins/fieldRenderers/file/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/file/index.js +3 -0
- package/admin/plugins/fieldRenderers/file/utils.d.ts +7 -0
- package/admin/plugins/fieldRenderers/file/utils.js +51 -0
- package/admin/plugins/fieldRenderers/longText/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/longText/index.js +3 -0
- package/admin/plugins/fieldRenderers/longText/longText.d.ts +3 -0
- package/admin/plugins/fieldRenderers/longText/longText.js +36 -0
- package/admin/plugins/fieldRenderers/longText/longTexts.d.ts +3 -0
- package/admin/plugins/fieldRenderers/longText/longTexts.js +43 -0
- package/admin/plugins/fieldRenderers/number/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/number/index.js +3 -0
- package/admin/plugins/fieldRenderers/number/numberInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/number/numberInput.js +39 -0
- package/admin/plugins/fieldRenderers/number/numberInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/number/numberInputs.js +50 -0
- package/admin/plugins/fieldRenderers/object/StyledComponents.d.ts +4 -0
- package/admin/plugins/fieldRenderers/object/StyledComponents.js +5 -0
- package/admin/plugins/fieldRenderers/object/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/object/index.js +3 -0
- package/admin/plugins/fieldRenderers/object/multipleObjects.d.ts +3 -0
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +72 -0
- package/admin/plugins/fieldRenderers/object/singleObject.d.ts +3 -0
- package/admin/plugins/fieldRenderers/object/singleObject.js +45 -0
- package/admin/plugins/fieldRenderers/radioButtons.d.ts +3 -0
- package/admin/plugins/fieldRenderers/radioButtons.js +45 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.d.ts +6 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +54 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.d.ts +6 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js +65 -0
- package/admin/plugins/fieldRenderers/ref/components/getOptions.d.ts +1 -0
- package/admin/plugins/fieldRenderers/ref/components/getOptions.js +21 -0
- package/admin/plugins/fieldRenderers/ref/components/graphql.d.ts +4 -0
- package/admin/plugins/fieldRenderers/ref/components/graphql.js +10 -0
- package/admin/plugins/fieldRenderers/ref/components/renderItem.d.ts +2 -0
- package/admin/plugins/fieldRenderers/ref/components/renderItem.js +14 -0
- package/admin/plugins/fieldRenderers/ref/components/useReference.d.ts +22 -0
- package/admin/plugins/fieldRenderers/ref/components/useReference.js +240 -0
- package/admin/plugins/fieldRenderers/ref/components/useReferences.d.ts +19 -0
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js +180 -0
- package/admin/plugins/fieldRenderers/ref/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/ref/index.js +3 -0
- package/admin/plugins/fieldRenderers/ref/refInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/ref/refInput.js +30 -0
- package/admin/plugins/fieldRenderers/ref/refInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/ref/refInputs.js +37 -0
- package/admin/plugins/fieldRenderers/richText/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/richText/index.js +3 -0
- package/admin/plugins/fieldRenderers/richText/richTextInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/richText/richTextInput.js +50 -0
- package/admin/plugins/fieldRenderers/richText/richTextInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js +79 -0
- package/admin/plugins/fieldRenderers/select.d.ts +3 -0
- package/admin/plugins/fieldRenderers/select.js +34 -0
- package/admin/plugins/fieldRenderers/text/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/text/index.js +3 -0
- package/admin/plugins/fieldRenderers/text/textInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/text/textInput.js +35 -0
- package/admin/plugins/fieldRenderers/text/textInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/text/textInputs.js +46 -0
- package/admin/plugins/fieldValidators/date/availableValidators.d.ts +1 -0
- package/admin/plugins/fieldValidators/date/availableValidators.js +11 -0
- package/admin/plugins/fieldValidators/date/createDateInputField.d.ts +3 -0
- package/admin/plugins/fieldValidators/date/createDateInputField.js +33 -0
- package/admin/plugins/fieldValidators/dateGte.d.ts +3 -0
- package/admin/plugins/fieldValidators/dateGte.js +40 -0
- package/admin/plugins/fieldValidators/dateLte.d.ts +3 -0
- package/admin/plugins/fieldValidators/dateLte.js +40 -0
- package/admin/plugins/fieldValidators/gte.d.ts +3 -0
- package/admin/plugins/fieldValidators/gte.js +27 -0
- package/admin/plugins/fieldValidators/in.d.ts +3 -0
- package/admin/plugins/fieldValidators/in.js +26 -0
- package/admin/plugins/fieldValidators/lte.d.ts +3 -0
- package/admin/plugins/fieldValidators/lte.js +27 -0
- package/admin/plugins/fieldValidators/maxLength.d.ts +3 -0
- package/admin/plugins/fieldValidators/maxLength.js +27 -0
- package/admin/plugins/fieldValidators/minLength.d.ts +3 -0
- package/admin/plugins/fieldValidators/minLength.js +27 -0
- package/admin/plugins/fieldValidators/pattern.d.ts +3 -0
- package/admin/plugins/fieldValidators/pattern.js +74 -0
- package/admin/plugins/fieldValidators/patternPlugins/email.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/email.js +9 -0
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js +9 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.js +9 -0
- package/admin/plugins/fieldValidators/patternPlugins/url.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/url.js +9 -0
- package/admin/plugins/fieldValidators/required.d.ts +3 -0
- package/admin/plugins/fieldValidators/required.js +10 -0
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.d.ts +6 -0
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js +108 -0
- package/admin/plugins/fields/boolean.d.ts +3 -0
- package/admin/plugins/fields/boolean.js +31 -0
- package/admin/plugins/fields/dateTime.d.ts +3 -0
- package/admin/plugins/fields/dateTime.js +77 -0
- package/admin/plugins/fields/file.d.ts +3 -0
- package/admin/plugins/fields/file.js +46 -0
- package/admin/plugins/fields/icons/ballot_black_24dp.svg +1 -0
- package/admin/plugins/fields/icons/dropdown-icon.svg +16 -0
- package/admin/plugins/fields/icons/notes-black-24px.svg +1 -0
- package/admin/plugins/fields/icons/round-check_box-24px.svg +4 -0
- package/admin/plugins/fields/icons/round-link-24px.svg +1 -0
- package/admin/plugins/fields/icons/round-looks_3-24px.svg +4 -0
- package/admin/plugins/fields/icons/round-notes.svg +1 -0
- package/admin/plugins/fields/icons/round-radio_button_checked-24px.svg +5 -0
- package/admin/plugins/fields/icons/round-short_text.svg +1 -0
- package/admin/plugins/fields/icons/round-subject.svg +1 -0
- package/admin/plugins/fields/icons/round-text_fields-24px.svg +4 -0
- package/admin/plugins/fields/icons/round-visibility_off-24px.svg +4 -0
- package/admin/plugins/fields/icons/round_insert_drive_file-24px.svg +1 -0
- package/admin/plugins/fields/icons/schedule-black-24px.svg +1 -0
- package/admin/plugins/fields/icons/title-black-24px.svg +1 -0
- package/admin/plugins/fields/icons/toggle_on-black-24px.svg +1 -0
- package/admin/plugins/fields/longText.d.ts +3 -0
- package/admin/plugins/fields/longText.js +46 -0
- package/admin/plugins/fields/number.d.ts +3 -0
- package/admin/plugins/fields/number.js +63 -0
- package/admin/plugins/fields/object/ObjectFields.d.ts +4 -0
- package/admin/plugins/fields/object/ObjectFields.js +32 -0
- package/admin/plugins/fields/object.d.ts +3 -0
- package/admin/plugins/fields/object.js +46 -0
- package/admin/plugins/fields/ref.d.ts +3 -0
- package/admin/plugins/fields/ref.js +144 -0
- package/admin/plugins/fields/richText.d.ts +3 -0
- package/admin/plugins/fields/richText.js +45 -0
- package/admin/plugins/fields/text.d.ts +3 -0
- package/admin/plugins/fields/text.js +51 -0
- package/admin/plugins/getObjectId.d.ts +3 -0
- package/admin/plugins/getObjectId.js +13 -0
- package/admin/plugins/icons.d.ts +3 -0
- package/admin/plugins/icons.js +40 -0
- package/admin/plugins/index.d.ts +13 -0
- package/admin/plugins/index.js +14 -0
- package/admin/plugins/install.d.ts +3 -0
- package/admin/plugins/install.js +127 -0
- package/admin/plugins/menus/CmsMenuLoader.d.ts +7 -0
- package/admin/plugins/menus/CmsMenuLoader.js +76 -0
- package/admin/plugins/menus/ContentGroupsMenuItems.d.ts +6 -0
- package/admin/plugins/menus/ContentGroupsMenuItems.js +154 -0
- package/admin/plugins/menus/GlobalSearchPlugins.d.ts +8 -0
- package/admin/plugins/menus/GlobalSearchPlugins.js +53 -0
- package/admin/plugins/menus.d.ts +4 -0
- package/admin/plugins/menus.js +19 -0
- package/admin/plugins/permissionRenderer/CmsPermissions.d.ts +5 -0
- package/admin/plugins/permissionRenderer/CmsPermissions.js +340 -0
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.d.ts +8 -0
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js +117 -0
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.d.ts +9 -0
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.js +77 -0
- package/admin/plugins/permissionRenderer/components/ContentModelList.d.ts +7 -0
- package/admin/plugins/permissionRenderer/components/ContentModelList.js +53 -0
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.d.ts +10 -0
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.js +104 -0
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.d.ts +5 -0
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.js +28 -0
- package/admin/plugins/permissionRenderer/components/PermissionSelector.d.ts +34 -0
- package/admin/plugins/permissionRenderer/components/PermissionSelector.js +66 -0
- package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +2 -0
- package/admin/plugins/permissionRenderer/components/StyledComponents.js +10 -0
- package/admin/plugins/permissionRenderer/components/useCmsData.d.ts +1 -0
- package/admin/plugins/permissionRenderer/components/useCmsData.js +79 -0
- package/admin/plugins/permissionRenderer/index.d.ts +3 -0
- package/admin/plugins/permissionRenderer/index.js +16 -0
- package/admin/plugins/routes.d.ts +3 -0
- package/admin/plugins/routes.js +88 -0
- package/admin/plugins/transformers/dateTransformer.d.ts +3 -0
- package/admin/plugins/transformers/dateTransformer.js +44 -0
- package/admin/plugins/transformers/index.d.ts +3 -0
- package/admin/plugins/transformers/index.js +5 -0
- package/admin/plugins/transformers/numberTransformer.d.ts +3 -0
- package/admin/plugins/transformers/numberTransformer.js +14 -0
- package/admin/plugins/upgrades/v5.0.0.d.ts +5 -0
- package/admin/plugins/upgrades/v5.0.0.js +85 -0
- package/admin/plugins/upgrades/v5.5.0.d.ts +5 -0
- package/admin/plugins/upgrades/v5.5.0.js +85 -0
- package/admin/plugins/upgrades/v5.8.0.d.ts +5 -0
- package/admin/plugins/upgrades/v5.8.0.js +85 -0
- package/admin/plugins/validators/dateGte.d.ts +3 -0
- package/admin/plugins/validators/dateGte.js +23 -0
- package/admin/plugins/validators/dateLte.d.ts +3 -0
- package/admin/plugins/validators/dateLte.js +23 -0
- package/admin/plugins/validators/gte.d.ts +3 -0
- package/admin/plugins/validators/gte.js +15 -0
- package/admin/plugins/validators/in.d.ts +3 -0
- package/admin/plugins/validators/in.js +15 -0
- package/admin/plugins/validators/lte.d.ts +3 -0
- package/admin/plugins/validators/lte.js +15 -0
- package/admin/plugins/validators/maxLength.d.ts +3 -0
- package/admin/plugins/validators/maxLength.js +15 -0
- package/admin/plugins/validators/minLength.d.ts +3 -0
- package/admin/plugins/validators/minLength.js +15 -0
- package/admin/plugins/validators/pattern.d.ts +9 -0
- package/admin/plugins/validators/pattern.js +34 -0
- package/admin/plugins/validators/patternPlugins/email.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/email.js +9 -0
- package/admin/plugins/validators/patternPlugins/lowerCase.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/lowerCase.js +9 -0
- package/admin/plugins/validators/patternPlugins/upperCase.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/upperCase.js +9 -0
- package/admin/plugins/validators/patternPlugins/url.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/url.js +9 -0
- package/admin/plugins/validators/required.d.ts +3 -0
- package/admin/plugins/validators/required.js +11 -0
- package/admin/plugins/validators/timeGte.d.ts +3 -0
- package/admin/plugins/validators/timeGte.js +19 -0
- package/admin/plugins/validators/timeLte.d.ts +3 -0
- package/admin/plugins/validators/timeLte.js +19 -0
- package/admin/plugins/welcomeScreenWidget.d.ts +3 -0
- package/admin/plugins/welcomeScreenWidget.js +29 -0
- package/admin/views/contentEntries/ContentEntries.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntries.js +73 -0
- package/admin/views/contentEntries/ContentEntriesContext.d.ts +24 -0
- package/admin/views/contentEntries/ContentEntriesContext.js +78 -0
- package/admin/views/contentEntries/ContentEntriesList.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntriesList.js +180 -0
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.d.ts +28 -0
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +113 -0
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.d.ts +7 -0
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js +152 -0
- package/admin/views/contentEntries/ContentEntry/RevisionsList.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/RevisionsList.js +59 -0
- package/admin/views/contentEntries/ContentEntry/cache.d.ts +7 -0
- package/admin/views/contentEntries/ContentEntry/cache.js +183 -0
- package/admin/views/contentEntries/ContentEntry/header/Header.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/Header.js +32 -0
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.js +141 -0
- package/admin/views/contentEntries/ContentEntry/header/index.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/index.js +45 -0
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js +67 -0
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/rule-24px.svg +1 -0
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js +69 -0
- package/admin/views/contentEntries/ContentEntry/header/requestReview/emoji_people-24px.svg +1 -0
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.js +75 -0
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.js +84 -0
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.js +32 -0
- package/admin/views/contentEntries/ContentEntry/prepareFormData.d.ts +2 -0
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js +79 -0
- package/admin/views/contentEntries/ContentEntry/useRevision.d.ts +13 -0
- package/admin/views/contentEntries/ContentEntry/useRevision.js +335 -0
- package/admin/views/contentEntries/ContentEntry.d.ts +12 -0
- package/admin/views/contentEntries/ContentEntry.js +99 -0
- package/admin/views/contentEntries/hooks/useContentEntries.d.ts +1 -0
- package/admin/views/contentEntries/hooks/useContentEntries.js +5 -0
- package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +21 -0
- package/admin/views/contentEntries/hooks/useContentEntriesList.js +152 -0
- package/admin/views/contentEntries/hooks/useContentEntry.d.ts +1 -0
- package/admin/views/contentEntries/hooks/useContentEntry.js +5 -0
- package/admin/views/contentModelGroups/ContentModelGroups.d.ts +3 -0
- package/admin/views/contentModelGroups/ContentModelGroups.js +35 -0
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.d.ts +6 -0
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js +242 -0
- package/admin/views/contentModelGroups/ContentModelGroupsForm.d.ts +6 -0
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js +231 -0
- package/admin/views/contentModelGroups/DelayedOnChange.d.ts +25 -0
- package/admin/views/contentModelGroups/DelayedOnChange.js +134 -0
- package/admin/views/contentModelGroups/IconPicker.d.ts +7 -0
- package/admin/views/contentModelGroups/IconPicker.js +204 -0
- package/admin/views/contentModelGroups/graphql.d.ts +5 -0
- package/admin/views/contentModelGroups/graphql.js +11 -0
- package/admin/views/contentModels/ContentModelEditor.d.ts +2 -0
- package/admin/views/contentModels/ContentModelEditor.js +35 -0
- package/admin/views/contentModels/ContentModels.d.ts +3 -0
- package/admin/views/contentModels/ContentModels.js +82 -0
- package/admin/views/contentModels/ContentModelsDataList.d.ts +7 -0
- package/admin/views/contentModels/ContentModelsDataList.js +281 -0
- package/admin/views/contentModels/NewContentModelDialog.d.ts +8 -0
- package/admin/views/contentModels/NewContentModelDialog.js +196 -0
- package/admin/views/contentModels/cache.d.ts +5 -0
- package/admin/views/contentModels/cache.js +68 -0
- package/admin/views/utils.d.ts +2 -0
- package/admin/views/utils.js +27 -0
- package/admin/viewsGraphql.d.ts +4 -0
- package/admin/viewsGraphql.js +12 -0
- package/package.json +109 -0
- package/types.d.ts +484 -0
- package/types.js +1 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
import _cloneDeep from "lodash/cloneDeep";
|
|
5
|
+
|
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
7
|
+
|
|
8
|
+
var _excluded = ["field", "onSubmit"];
|
|
9
|
+
import React, { useState, useEffect, useCallback } from "react";
|
|
10
|
+
import { css } from "emotion";
|
|
11
|
+
import { Dialog, DialogContent, DialogTitle, DialogActions, DialogButton } from "@webiny/ui/Dialog";
|
|
12
|
+
import { Form } from "@webiny/form";
|
|
13
|
+
import { Tabs, Tab } from "@webiny/ui/Tabs";
|
|
14
|
+
import { i18n } from "@webiny/app/i18n";
|
|
15
|
+
import { plugins } from "@webiny/plugins";
|
|
16
|
+
import GeneralTab from "./EditFieldDialog/GeneralTab";
|
|
17
|
+
import AppearanceTab from "./EditFieldDialog/AppearanceTab";
|
|
18
|
+
import PredefinedValues from "./EditFieldDialog/PredefinedValues";
|
|
19
|
+
import ValidatorsTab from "./EditFieldDialog/ValidatorsTab";
|
|
20
|
+
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
21
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
22
|
+
import { Elevation } from "@webiny/ui/Elevation";
|
|
23
|
+
import { useFieldEditor } from "./useFieldEditor";
|
|
24
|
+
var t = i18n.namespace("app-headless-cms/admin/components/editor");
|
|
25
|
+
var dialogBody = /*#__PURE__*/css({
|
|
26
|
+
"&.webiny-ui-dialog__content": {
|
|
27
|
+
width: 875,
|
|
28
|
+
height: 450
|
|
29
|
+
}
|
|
30
|
+
}, "label:dialogBody;");
|
|
31
|
+
|
|
32
|
+
var getValidators = function getValidators(fieldPlugin, key) {
|
|
33
|
+
var defaultValidators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
34
|
+
return plugins.byType("cms-editor-field-validator").map(function (plugin) {
|
|
35
|
+
return plugin.validator;
|
|
36
|
+
}).map(function (validator) {
|
|
37
|
+
var allowedValidators = fieldPlugin.field[key] || defaultValidators;
|
|
38
|
+
|
|
39
|
+
if (allowedValidators.includes(validator.name)) {
|
|
40
|
+
return {
|
|
41
|
+
optional: true,
|
|
42
|
+
validator: validator
|
|
43
|
+
};
|
|
44
|
+
} else if (allowedValidators.includes("!".concat(validator.name))) {
|
|
45
|
+
return {
|
|
46
|
+
optional: false,
|
|
47
|
+
validator: validator
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return null;
|
|
52
|
+
}).filter(Boolean).sort(function (a, b) {
|
|
53
|
+
if (!a.optional && b.optional) {
|
|
54
|
+
return -1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (a.optional && !b.optional) {
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return 0;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var getListValidators = function getListValidators(fieldPlugin) {
|
|
66
|
+
return getValidators(fieldPlugin, "listValidators", ["minLength", "maxLength"]);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var getFieldValidators = function getFieldValidators(fieldPlugin) {
|
|
70
|
+
return getValidators(fieldPlugin, "validators");
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var fieldEditorDialog = /*#__PURE__*/css({
|
|
74
|
+
width: "100vw",
|
|
75
|
+
height: "100vh",
|
|
76
|
+
".mdc-dialog__surface": {
|
|
77
|
+
maxWidth: "100% !important",
|
|
78
|
+
maxHeight: "100% !important",
|
|
79
|
+
".webiny-ui-dialog__content": {
|
|
80
|
+
maxWidth: "100% !important",
|
|
81
|
+
maxHeight: "100% !important",
|
|
82
|
+
width: "100vw",
|
|
83
|
+
height: "calc(100vh - 155px)",
|
|
84
|
+
paddingTop: "0 !important"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, "label:fieldEditorDialog;");
|
|
88
|
+
|
|
89
|
+
var EditFieldDialog = function EditFieldDialog(_ref) {
|
|
90
|
+
var field = _ref.field,
|
|
91
|
+
onSubmit = _ref.onSubmit,
|
|
92
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
93
|
+
|
|
94
|
+
var _useState = useState(null),
|
|
95
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
96
|
+
current = _useState2[0],
|
|
97
|
+
setCurrent = _useState2[1];
|
|
98
|
+
|
|
99
|
+
var _useFieldEditor = useFieldEditor(),
|
|
100
|
+
getFieldPlugin = _useFieldEditor.getFieldPlugin;
|
|
101
|
+
|
|
102
|
+
useEffect(function () {
|
|
103
|
+
if (!field) {
|
|
104
|
+
return setCurrent(field);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var clonedField = _cloneDeep(field);
|
|
108
|
+
|
|
109
|
+
if (!clonedField.renderer || !clonedField.renderer.name) {
|
|
110
|
+
var _plugins$byType$filte = plugins.byType("cms-editor-field-renderer").filter(function (item) {
|
|
111
|
+
return item.renderer.canUse({
|
|
112
|
+
field: field
|
|
113
|
+
});
|
|
114
|
+
}),
|
|
115
|
+
_plugins$byType$filte2 = _slicedToArray(_plugins$byType$filte, 1),
|
|
116
|
+
renderPlugin = _plugins$byType$filte2[0];
|
|
117
|
+
|
|
118
|
+
if (renderPlugin) {
|
|
119
|
+
clonedField.renderer = {
|
|
120
|
+
name: renderPlugin.renderer.rendererName
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
setCurrent(clonedField);
|
|
126
|
+
}, [field]);
|
|
127
|
+
var onClose = useCallback(function () {
|
|
128
|
+
setCurrent(null);
|
|
129
|
+
props.onClose();
|
|
130
|
+
}, undefined);
|
|
131
|
+
var render = null;
|
|
132
|
+
var headerTitle = t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Field Settings"])));
|
|
133
|
+
|
|
134
|
+
if (current) {
|
|
135
|
+
var fieldPlugin = getFieldPlugin(current.type);
|
|
136
|
+
|
|
137
|
+
if (fieldPlugin) {
|
|
138
|
+
headerTitle = t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Field Settings - {fieldTypeLabel}"])))({
|
|
139
|
+
fieldTypeLabel: fieldPlugin.field.label
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
render = /*#__PURE__*/React.createElement(Form, {
|
|
144
|
+
data: current,
|
|
145
|
+
onSubmit: onSubmit
|
|
146
|
+
}, function (form) {
|
|
147
|
+
var predefinedValuesTabEnabled = fieldPlugin.field.allowPredefinedValues && form.data.predefinedValues && form.data.predefinedValues.enabled;
|
|
148
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DialogContent, {
|
|
149
|
+
className: dialogBody
|
|
150
|
+
}, /*#__PURE__*/React.createElement(Tabs, null, /*#__PURE__*/React.createElement(Tab, {
|
|
151
|
+
label: t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["General"])))
|
|
152
|
+
}, /*#__PURE__*/React.createElement(GeneralTab, {
|
|
153
|
+
form: form,
|
|
154
|
+
field: form.data,
|
|
155
|
+
fieldPlugin: fieldPlugin
|
|
156
|
+
})), /*#__PURE__*/React.createElement(Tab, {
|
|
157
|
+
label: t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Predefined Values"]))),
|
|
158
|
+
disabled: !predefinedValuesTabEnabled
|
|
159
|
+
}, predefinedValuesTabEnabled && /*#__PURE__*/React.createElement(PredefinedValues, {
|
|
160
|
+
form: form,
|
|
161
|
+
field: form.data,
|
|
162
|
+
fieldPlugin: fieldPlugin
|
|
163
|
+
})), form.data.multipleValues && /*#__PURE__*/React.createElement(Tab, {
|
|
164
|
+
label: "Validators",
|
|
165
|
+
"data-testid": "cms.editor.field.tabs.validators"
|
|
166
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
167
|
+
span: 12
|
|
168
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
169
|
+
use: "headline5"
|
|
170
|
+
}, "List validators"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Typography, {
|
|
171
|
+
use: "body2"
|
|
172
|
+
}, "These validators are applied to the entire list of values.")), /*#__PURE__*/React.createElement(Cell, {
|
|
173
|
+
span: 12
|
|
174
|
+
}, /*#__PURE__*/React.createElement(Elevation, {
|
|
175
|
+
z: 2
|
|
176
|
+
}, /*#__PURE__*/React.createElement(ValidatorsTab, {
|
|
177
|
+
field: field,
|
|
178
|
+
name: "listValidation",
|
|
179
|
+
validators: getListValidators(fieldPlugin),
|
|
180
|
+
form: form
|
|
181
|
+
})))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
182
|
+
span: 12
|
|
183
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
184
|
+
use: "headline5"
|
|
185
|
+
}, "Individual value validators"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Typography, {
|
|
186
|
+
use: "body2"
|
|
187
|
+
}, "These validators are applied to each value in the list.")), /*#__PURE__*/React.createElement(Cell, {
|
|
188
|
+
span: 12
|
|
189
|
+
}, /*#__PURE__*/React.createElement(Elevation, {
|
|
190
|
+
z: 2
|
|
191
|
+
}, /*#__PURE__*/React.createElement(ValidatorsTab, {
|
|
192
|
+
field: current,
|
|
193
|
+
form: form,
|
|
194
|
+
name: "validation",
|
|
195
|
+
validators: getFieldValidators(fieldPlugin)
|
|
196
|
+
}))))), !form.data.multipleValues && Array.isArray(fieldPlugin.field.validators) && fieldPlugin.field.validators.length > 0 && /*#__PURE__*/React.createElement(Tab, {
|
|
197
|
+
label: "Validators",
|
|
198
|
+
"data-testid": "cms.editor.field.tabs.validators"
|
|
199
|
+
}, /*#__PURE__*/React.createElement(ValidatorsTab, {
|
|
200
|
+
field: current,
|
|
201
|
+
form: form,
|
|
202
|
+
name: "validation",
|
|
203
|
+
validators: getFieldValidators(fieldPlugin)
|
|
204
|
+
})), /*#__PURE__*/React.createElement(Tab, {
|
|
205
|
+
label: t(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Appearance"])))
|
|
206
|
+
}, /*#__PURE__*/React.createElement(AppearanceTab, {
|
|
207
|
+
form: form,
|
|
208
|
+
field: form.data,
|
|
209
|
+
fieldPlugin: fieldPlugin
|
|
210
|
+
})))), /*#__PURE__*/React.createElement(DialogActions, {
|
|
211
|
+
style: {
|
|
212
|
+
justifyContent: "flex-end"
|
|
213
|
+
}
|
|
214
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DialogButton, {
|
|
215
|
+
onClick: onClose
|
|
216
|
+
}, t(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["Cancel"])))), /*#__PURE__*/React.createElement(DialogButton, {
|
|
217
|
+
onClick: form.submit
|
|
218
|
+
}, t(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["Save"])))))));
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
223
|
+
preventOutsideDismiss: true,
|
|
224
|
+
open: !!current,
|
|
225
|
+
onClose: onClose,
|
|
226
|
+
"data-testid": "cms-editor-edit-fields-dialog",
|
|
227
|
+
className: fieldEditorDialog
|
|
228
|
+
}, /*#__PURE__*/React.createElement(DialogTitle, null, headerTitle), render);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export default EditFieldDialog;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
6
|
+
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
import React, { Fragment, useCallback } from "react";
|
|
9
|
+
import { css } from "emotion";
|
|
10
|
+
import styled from "@emotion/styled";
|
|
11
|
+
import { IconButton } from "@webiny/ui/Button";
|
|
12
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
13
|
+
import { ReactComponent as EditIcon } from "@svgr/webpack!../../icons/edit.svg";
|
|
14
|
+
import { ReactComponent as DeleteIcon } from "@svgr/webpack!../../icons/delete.svg";
|
|
15
|
+
import { ReactComponent as TitleIcon } from "@svgr/webpack!../../icons/title-24px.svg";
|
|
16
|
+
import { ReactComponent as MoreVerticalIcon } from "@svgr/webpack!../../icons/more_vert.svg";
|
|
17
|
+
import { Menu, MenuItem } from "@webiny/ui/Menu";
|
|
18
|
+
import { plugins } from "@webiny/plugins";
|
|
19
|
+
import { ListItemGraphic } from "@webiny/ui/List";
|
|
20
|
+
import { Icon } from "@webiny/ui/Icon";
|
|
21
|
+
import { i18n } from "@webiny/app/i18n";
|
|
22
|
+
import { useSnackbar } from "@webiny/app-admin/hooks/useSnackbar";
|
|
23
|
+
import { useContentModelEditor } from "../ContentModelEditor/useContentModelEditor";
|
|
24
|
+
import { useFieldEditor } from "./useFieldEditor";
|
|
25
|
+
var t = i18n.ns("app-headless-cms/admin/components/editor/field");
|
|
26
|
+
var FieldContainer = /*#__PURE__*/styled("div", {
|
|
27
|
+
target: "erv8xml0",
|
|
28
|
+
label: "FieldContainer"
|
|
29
|
+
})({
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
justifyContent: "space-between",
|
|
33
|
+
alignItems: "center"
|
|
34
|
+
});
|
|
35
|
+
var Info = /*#__PURE__*/styled("div", {
|
|
36
|
+
target: "erv8xml1",
|
|
37
|
+
label: "Info"
|
|
38
|
+
})({
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexDirection: "column",
|
|
41
|
+
"> *": {
|
|
42
|
+
flex: "1 100%",
|
|
43
|
+
lineHeight: "150%"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var Actions = /*#__PURE__*/styled("div", {
|
|
47
|
+
target: "erv8xml2",
|
|
48
|
+
label: "Actions"
|
|
49
|
+
})({
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexDirection: "row",
|
|
52
|
+
alignItems: "right",
|
|
53
|
+
"> *": {
|
|
54
|
+
flex: "1 100%"
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
var menuStyles = /*#__PURE__*/css({
|
|
58
|
+
width: 220,
|
|
59
|
+
right: -105,
|
|
60
|
+
left: "auto !important",
|
|
61
|
+
".disabled": {
|
|
62
|
+
opacity: 0.5,
|
|
63
|
+
pointerEvents: "none"
|
|
64
|
+
}
|
|
65
|
+
}, "label:menuStyles;");
|
|
66
|
+
var allowedTitleFieldTypes = ["text", "number"];
|
|
67
|
+
|
|
68
|
+
var isFieldAllowedToBeTitle = function isFieldAllowedToBeTitle(field, parent) {
|
|
69
|
+
if (field.multipleValues || parent) {
|
|
70
|
+
return false;
|
|
71
|
+
} else if (allowedTitleFieldTypes.includes(field.type) === false) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return true;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var Field = function Field(props) {
|
|
79
|
+
var field = props.field,
|
|
80
|
+
onEdit = props.onEdit,
|
|
81
|
+
parent = props.parent;
|
|
82
|
+
|
|
83
|
+
var _useSnackbar = useSnackbar(),
|
|
84
|
+
showSnackbar = _useSnackbar.showSnackbar;
|
|
85
|
+
|
|
86
|
+
var _useContentModelEdito = useContentModelEditor(),
|
|
87
|
+
setData = _useContentModelEdito.setData,
|
|
88
|
+
data = _useContentModelEdito.data;
|
|
89
|
+
|
|
90
|
+
var _useFieldEditor = useFieldEditor(),
|
|
91
|
+
getFieldPlugin = _useFieldEditor.getFieldPlugin;
|
|
92
|
+
|
|
93
|
+
var onDelete = useCallback(function () {
|
|
94
|
+
props.onDelete(field);
|
|
95
|
+
}, [field.fieldId]);
|
|
96
|
+
var setAsTitle = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
97
|
+
var response;
|
|
98
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
99
|
+
while (1) {
|
|
100
|
+
switch (_context.prev = _context.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_context.next = 2;
|
|
103
|
+
return setData(function (data) {
|
|
104
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
105
|
+
titleFieldId: field.fieldId
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
case 2:
|
|
110
|
+
response = _context.sent;
|
|
111
|
+
|
|
112
|
+
if (!response.error) {
|
|
113
|
+
_context.next = 5;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return _context.abrupt("return", showSnackbar(response.error.message));
|
|
118
|
+
|
|
119
|
+
case 5:
|
|
120
|
+
showSnackbar(t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Title field set successfully."]))));
|
|
121
|
+
|
|
122
|
+
case 6:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context.stop();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, _callee);
|
|
128
|
+
})), [field.fieldId]);
|
|
129
|
+
var fieldPlugin = getFieldPlugin(field.type);
|
|
130
|
+
var editorFieldOptionPlugins = plugins.byType("cms-editor-field-option");
|
|
131
|
+
|
|
132
|
+
if (!fieldPlugin) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var lockedFields = data.lockedFields || [];
|
|
137
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FieldContainer, null, /*#__PURE__*/React.createElement(Info, null, /*#__PURE__*/React.createElement(Typography, {
|
|
138
|
+
use: "subtitle1"
|
|
139
|
+
}, field.label), /*#__PURE__*/React.createElement(Typography, {
|
|
140
|
+
use: "caption"
|
|
141
|
+
}, fieldPlugin.field.label, " ", field.multipleValues && /*#__PURE__*/React.createElement(React.Fragment, null, "(", t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["multiple values"]))), ")"), field.fieldId === data.titleFieldId && /*#__PURE__*/React.createElement(React.Fragment, null, "(", t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["entry title"]))), ")"))), /*#__PURE__*/React.createElement(Actions, null, /*#__PURE__*/React.createElement(IconButton, {
|
|
142
|
+
"data-testid": "cms.editor.edit-field",
|
|
143
|
+
icon: /*#__PURE__*/React.createElement(EditIcon, null),
|
|
144
|
+
onClick: function onClick() {
|
|
145
|
+
return onEdit(field);
|
|
146
|
+
}
|
|
147
|
+
}), /*#__PURE__*/React.createElement(Menu, {
|
|
148
|
+
className: menuStyles,
|
|
149
|
+
handle: /*#__PURE__*/React.createElement(IconButton, {
|
|
150
|
+
icon: /*#__PURE__*/React.createElement(MoreVerticalIcon, null)
|
|
151
|
+
})
|
|
152
|
+
}, editorFieldOptionPlugins.map(function (pl) {
|
|
153
|
+
return /*#__PURE__*/React.cloneElement(pl.render(), {
|
|
154
|
+
key: pl.name
|
|
155
|
+
});
|
|
156
|
+
}), /*#__PURE__*/React.createElement(MenuItem, {
|
|
157
|
+
disabled: !isFieldAllowedToBeTitle(field, parent),
|
|
158
|
+
onClick: setAsTitle
|
|
159
|
+
}, /*#__PURE__*/React.createElement(ListItemGraphic, null, /*#__PURE__*/React.createElement(Icon, {
|
|
160
|
+
icon: /*#__PURE__*/React.createElement(TitleIcon, null)
|
|
161
|
+
})), t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Use as title"])))), /*#__PURE__*/React.createElement(MenuItem, {
|
|
162
|
+
disabled: lockedFields.some(function (lockedField) {
|
|
163
|
+
return lockedField.fieldId === field.fieldId;
|
|
164
|
+
}),
|
|
165
|
+
onClick: onDelete
|
|
166
|
+
}, /*#__PURE__*/React.createElement(ListItemGraphic, null, /*#__PURE__*/React.createElement(Icon, {
|
|
167
|
+
icon: /*#__PURE__*/React.createElement(DeleteIcon, null)
|
|
168
|
+
})), lockedFields.find(function (lockedField) {
|
|
169
|
+
return lockedField.fieldId === field.fieldId;
|
|
170
|
+
}) ? t(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Cannot delete"]))) : t(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["Delete"]))))))), /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: "field-extra"
|
|
172
|
+
}, fieldPlugin.field.render && fieldPlugin.field.render({
|
|
173
|
+
field: field,
|
|
174
|
+
data: data,
|
|
175
|
+
setData: setData
|
|
176
|
+
})));
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export default /*#__PURE__*/React.memo(Field);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CmsEditorField, CmsEditorFieldsLayout } from "../../../types";
|
|
3
|
+
export interface FieldEditorProps {
|
|
4
|
+
parent?: CmsEditorField;
|
|
5
|
+
layout: CmsEditorFieldsLayout;
|
|
6
|
+
fields: CmsEditorField[];
|
|
7
|
+
onChange: (params: {
|
|
8
|
+
fields: CmsEditorField[];
|
|
9
|
+
layout: CmsEditorFieldsLayout;
|
|
10
|
+
}) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const FieldEditor: (props: FieldEditorProps) => JSX.Element;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import React, { Fragment } from "react";
|
|
6
|
+
import get from "lodash/get";
|
|
7
|
+
import { Icon } from "@webiny/ui/Icon";
|
|
8
|
+
import { i18n } from "@webiny/app/i18n";
|
|
9
|
+
import { ReactComponent as HandleIcon } from "@svgr/webpack!../../icons/round-drag_indicator-24px.svg";
|
|
10
|
+
import { Center, Vertical, Horizontal } from "../DropZone";
|
|
11
|
+
import Draggable from "../Draggable";
|
|
12
|
+
import EditFieldDialog from "./EditFieldDialog";
|
|
13
|
+
import Field from "./Field";
|
|
14
|
+
import { rowHandle, fieldHandle, fieldContainer, Row, RowContainer } from "./Styled";
|
|
15
|
+
import { useFieldEditor } from "./useFieldEditor";
|
|
16
|
+
import { FieldEditorProvider } from "./FieldEditorContext";
|
|
17
|
+
var t = i18n.namespace("app-headless-cms/admin/components/editor");
|
|
18
|
+
var fieldTypes = ["field", "newField"];
|
|
19
|
+
|
|
20
|
+
var Editor = function Editor() {
|
|
21
|
+
var _useFieldEditor = useFieldEditor(),
|
|
22
|
+
parent = _useFieldEditor.parent,
|
|
23
|
+
depth = _useFieldEditor.depth,
|
|
24
|
+
insertField = _useFieldEditor.insertField,
|
|
25
|
+
updateField = _useFieldEditor.updateField,
|
|
26
|
+
deleteField = _useFieldEditor.deleteField,
|
|
27
|
+
fields = _useFieldEditor.fields,
|
|
28
|
+
noConflict = _useFieldEditor.noConflict,
|
|
29
|
+
editField = _useFieldEditor.editField,
|
|
30
|
+
onFieldDrop = _useFieldEditor.onFieldDrop,
|
|
31
|
+
onEndDrag = _useFieldEditor.onEndDrag,
|
|
32
|
+
field = _useFieldEditor.field,
|
|
33
|
+
dropTarget = _useFieldEditor.dropTarget;
|
|
34
|
+
|
|
35
|
+
return /*#__PURE__*/React.createElement(Fragment, null, fields.length === 0 && /*#__PURE__*/React.createElement(Center, {
|
|
36
|
+
onDrop: function onDrop(item) {
|
|
37
|
+
return onFieldDrop(item, {
|
|
38
|
+
row: 0,
|
|
39
|
+
index: 0
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
style: {
|
|
43
|
+
padding: "5px 0 15px 0"
|
|
44
|
+
}
|
|
45
|
+
}, t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Drop your first field here"])))), fields.map(function (row, index) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(Draggable, {
|
|
47
|
+
beginDrag: {
|
|
48
|
+
parent: parent ? parent.fieldId : null,
|
|
49
|
+
type: "row",
|
|
50
|
+
fields: row,
|
|
51
|
+
pos: {
|
|
52
|
+
row: index
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
endDrag: onEndDrag,
|
|
56
|
+
key: row.map(function (f) {
|
|
57
|
+
return f.fieldId;
|
|
58
|
+
}).join(".")
|
|
59
|
+
}, function (_ref
|
|
60
|
+
/* RowContainer start - includes drag handle, drop zones and the Row itself. */
|
|
61
|
+
) {
|
|
62
|
+
var drag = _ref.drag,
|
|
63
|
+
isDragging = _ref.isDragging;
|
|
64
|
+
return /*#__PURE__*/React.createElement(RowContainer, {
|
|
65
|
+
style: {
|
|
66
|
+
opacity: isDragging ? 0.3 : 1
|
|
67
|
+
}
|
|
68
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: rowHandle,
|
|
70
|
+
ref: drag
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
72
|
+
icon: /*#__PURE__*/React.createElement(HandleIcon, null)
|
|
73
|
+
})), /*#__PURE__*/React.createElement(Horizontal, {
|
|
74
|
+
"data-testid": "cms-editor-row-droppable-top-".concat(index),
|
|
75
|
+
isVisible: noConflict(),
|
|
76
|
+
onDrop: function onDrop(item) {
|
|
77
|
+
return onFieldDrop(item, {
|
|
78
|
+
row: index,
|
|
79
|
+
index: null
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}), /*#__PURE__*/React.createElement(Row, {
|
|
83
|
+
"data-testid": "cms.editor.field-row"
|
|
84
|
+
}, row.map(function (field, fieldIndex) {
|
|
85
|
+
return /*#__PURE__*/React.createElement(Draggable, {
|
|
86
|
+
key: field.fieldId,
|
|
87
|
+
beginDrag: {
|
|
88
|
+
parent: parent ? parent.fieldId : null,
|
|
89
|
+
type: "field",
|
|
90
|
+
field: field,
|
|
91
|
+
pos: {
|
|
92
|
+
row: index,
|
|
93
|
+
index: fieldIndex
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
endDrag: onEndDrag
|
|
97
|
+
}, function (_ref2) {
|
|
98
|
+
var drag = _ref2.drag;
|
|
99
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: fieldContainer,
|
|
101
|
+
ref: drag
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Vertical, {
|
|
103
|
+
depth: depth,
|
|
104
|
+
onDrop: function onDrop(item) {
|
|
105
|
+
return onFieldDrop(item, {
|
|
106
|
+
row: index,
|
|
107
|
+
index: fieldIndex
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
isVisible: noConflict(function (item) {
|
|
111
|
+
return fieldTypes.includes(item.type) && (row.length < 4 || get(item, "pos.row") === index);
|
|
112
|
+
})
|
|
113
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: fieldHandle
|
|
115
|
+
}, /*#__PURE__*/React.createElement(Field, {
|
|
116
|
+
parent: parent,
|
|
117
|
+
field: field,
|
|
118
|
+
onEdit: editField,
|
|
119
|
+
onDelete: deleteField
|
|
120
|
+
})), fieldIndex === row.length - 1 && /*#__PURE__*/React.createElement(Vertical, {
|
|
121
|
+
last: true,
|
|
122
|
+
depth: depth,
|
|
123
|
+
isVisible: noConflict(function (item) {
|
|
124
|
+
return fieldTypes.includes(item.type) && (row.length < 4 || get(item, "pos.row") === index);
|
|
125
|
+
}),
|
|
126
|
+
onDrop: function onDrop(item) {
|
|
127
|
+
return onFieldDrop(item, {
|
|
128
|
+
row: index,
|
|
129
|
+
index: fieldIndex + 1
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
});
|
|
134
|
+
})), index === fields.length - 1 && /*#__PURE__*/React.createElement(Horizontal, {
|
|
135
|
+
"data-testid": "cms-editor-row-droppable-bottom-".concat(index),
|
|
136
|
+
last: true,
|
|
137
|
+
isVisible: noConflict(),
|
|
138
|
+
onDrop: function onDrop(item) {
|
|
139
|
+
return onFieldDrop(item, {
|
|
140
|
+
row: index + 1,
|
|
141
|
+
index: null
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}));
|
|
145
|
+
});
|
|
146
|
+
}), /*#__PURE__*/React.createElement(EditFieldDialog, {
|
|
147
|
+
field: field,
|
|
148
|
+
onClose: editField,
|
|
149
|
+
onSubmit: function onSubmit(field) {
|
|
150
|
+
if (field.id) {
|
|
151
|
+
updateField(field);
|
|
152
|
+
} else {
|
|
153
|
+
insertField({
|
|
154
|
+
field: field,
|
|
155
|
+
position: dropTarget
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
editField(null);
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export var FieldEditor = function FieldEditor(props) {
|
|
165
|
+
return /*#__PURE__*/React.createElement(FieldEditorProvider, props, /*#__PURE__*/React.createElement(Editor, null));
|
|
166
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CmsEditorField, CmsEditorFieldId, CmsEditorFieldsLayout, CmsEditorFieldTypePlugin, FieldLayoutPosition } from "../../../types";
|
|
3
|
+
import { FieldEditorProps } from "./FieldEditor";
|
|
4
|
+
import { DragObjectWithType, DragSourceMonitor } from "react-dnd";
|
|
5
|
+
interface DropTarget {
|
|
6
|
+
row: number;
|
|
7
|
+
index: number;
|
|
8
|
+
}
|
|
9
|
+
interface Position {
|
|
10
|
+
row: number;
|
|
11
|
+
index: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DragSource extends DragObjectWithType {
|
|
14
|
+
parent?: string;
|
|
15
|
+
pos: Partial<Position>;
|
|
16
|
+
type: "row" | "field" | "newField";
|
|
17
|
+
fieldType?: string;
|
|
18
|
+
field?: CmsEditorField;
|
|
19
|
+
fields?: CmsEditorField[];
|
|
20
|
+
}
|
|
21
|
+
export interface FieldEditorContextValue {
|
|
22
|
+
fields: CmsEditorField[][];
|
|
23
|
+
noConflict: Function;
|
|
24
|
+
layout: CmsEditorFieldsLayout;
|
|
25
|
+
onChange?: (data: any) => void;
|
|
26
|
+
getFieldsInLayout: () => CmsEditorField[][];
|
|
27
|
+
getFieldPlugin: (type: string) => CmsEditorFieldTypePlugin;
|
|
28
|
+
getField: (query: Record<string, string>) => CmsEditorField;
|
|
29
|
+
editField: (field: CmsEditorField) => void;
|
|
30
|
+
field: CmsEditorField;
|
|
31
|
+
parent: CmsEditorField;
|
|
32
|
+
depth: number;
|
|
33
|
+
dropTarget?: DropTarget;
|
|
34
|
+
onFieldDrop: (source: Partial<DragSource>, target: DropTarget) => void;
|
|
35
|
+
onEndDrag: (item: DragSource, monitor: DragSourceMonitor) => void;
|
|
36
|
+
insertField: (params: {
|
|
37
|
+
field: CmsEditorField;
|
|
38
|
+
position: FieldLayoutPosition;
|
|
39
|
+
}) => void;
|
|
40
|
+
moveField: (params: {
|
|
41
|
+
field: CmsEditorFieldId | CmsEditorField;
|
|
42
|
+
position: FieldLayoutPosition;
|
|
43
|
+
}) => void;
|
|
44
|
+
moveRow: (source: number, destination: number) => void;
|
|
45
|
+
updateField: (field: CmsEditorField) => void;
|
|
46
|
+
deleteField: (field: CmsEditorField) => void;
|
|
47
|
+
}
|
|
48
|
+
interface FieldEditorProviderProps extends FieldEditorProps {
|
|
49
|
+
children: React.ReactElement;
|
|
50
|
+
}
|
|
51
|
+
export declare const FieldEditorContext: React.Context<FieldEditorContextValue>;
|
|
52
|
+
export declare const FieldEditorProvider: ({ parent, fields, layout, onChange, children }: FieldEditorProviderProps) => JSX.Element;
|
|
53
|
+
export {};
|