@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,75 @@
|
|
|
1
|
+
import _get from "lodash/get";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { css } from "emotion";
|
|
4
|
+
import { useRouter } from "@webiny/react-router";
|
|
5
|
+
import { ButtonDefault } from "@webiny/ui/Button";
|
|
6
|
+
import { Icon } from "@webiny/ui/Icon";
|
|
7
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
8
|
+
import { Menu, MenuItem } from "@webiny/ui/Menu";
|
|
9
|
+
import { ReactComponent as DownButton } from "@svgr/webpack!../../../../../icons/round-arrow_drop_down-24px.svg";
|
|
10
|
+
import { useContentEntry } from "../../../hooks/useContentEntry";
|
|
11
|
+
import statusLabels from "../../../../../constants/statusLabels";
|
|
12
|
+
var buttonStyle = /*#__PURE__*/css({
|
|
13
|
+
"&.mdc-button": {
|
|
14
|
+
color: "var(--mdc-theme-text-primary-on-background) !important"
|
|
15
|
+
}
|
|
16
|
+
}, "label:buttonStyle;");
|
|
17
|
+
var menuStyles = /*#__PURE__*/css({
|
|
18
|
+
width: 150,
|
|
19
|
+
right: 0,
|
|
20
|
+
".mdc-list-item": {
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
alignItems: "baseline",
|
|
24
|
+
textAlign: "left"
|
|
25
|
+
}
|
|
26
|
+
}, "label:menuStyles;");
|
|
27
|
+
|
|
28
|
+
var RevisionSelector = function RevisionSelector() {
|
|
29
|
+
var _useContentEntry = useContentEntry(),
|
|
30
|
+
entry = _useContentEntry.entry,
|
|
31
|
+
revisions = _useContentEntry.revisions,
|
|
32
|
+
loading = _useContentEntry.loading;
|
|
33
|
+
|
|
34
|
+
var _useRouter = useRouter(),
|
|
35
|
+
location = _useRouter.location,
|
|
36
|
+
history = _useRouter.history;
|
|
37
|
+
|
|
38
|
+
var query = new URLSearchParams(location.search);
|
|
39
|
+
var currentRevision = {
|
|
40
|
+
version: _get(entry, "meta.version", 1),
|
|
41
|
+
status: _get(entry, "meta.status", "draft")
|
|
42
|
+
};
|
|
43
|
+
var allRevisions = revisions.length ? revisions : [{
|
|
44
|
+
id: "new",
|
|
45
|
+
meta: {
|
|
46
|
+
version: 1,
|
|
47
|
+
status: "draft"
|
|
48
|
+
}
|
|
49
|
+
}];
|
|
50
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
51
|
+
className: menuStyles,
|
|
52
|
+
handle: /*#__PURE__*/React.createElement(ButtonDefault, {
|
|
53
|
+
className: buttonStyle,
|
|
54
|
+
disabled: loading
|
|
55
|
+
}, "v", currentRevision.version, " (", statusLabels[currentRevision.status], ")", " ", /*#__PURE__*/React.createElement(Icon, {
|
|
56
|
+
icon: /*#__PURE__*/React.createElement(DownButton, null)
|
|
57
|
+
}))
|
|
58
|
+
}, allRevisions.map(function (revision) {
|
|
59
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
60
|
+
key: revision.id,
|
|
61
|
+
onClick: function onClick() {
|
|
62
|
+
query.set("id", encodeURIComponent(revision.id));
|
|
63
|
+
history.push({
|
|
64
|
+
search: query.toString()
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
68
|
+
use: "body2"
|
|
69
|
+
}, "v", revision.meta.version), /*#__PURE__*/React.createElement(Typography, {
|
|
70
|
+
use: "caption"
|
|
71
|
+
}, "(", statusLabels[revision.meta.status], ")"));
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default RevisionSelector;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
5
|
+
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { css } from "emotion";
|
|
9
|
+
import { i18n } from "@webiny/app/i18n";
|
|
10
|
+
import { ButtonPrimary } from "@webiny/ui/Button";
|
|
11
|
+
import { useConfirmationDialog } from "@webiny/app-admin/hooks/useConfirmationDialog";
|
|
12
|
+
import { useRevision } from "../../useRevision";
|
|
13
|
+
import { useContentEntry } from "../../../hooks/useContentEntry";
|
|
14
|
+
import usePermission from "../../../../../hooks/usePermission";
|
|
15
|
+
var t = i18n.ns("app-headless-cms/admin/plugins/content-details/header/publish-revision");
|
|
16
|
+
var buttonStyles = /*#__PURE__*/css({
|
|
17
|
+
marginLeft: 16
|
|
18
|
+
}, "label:buttonStyles;");
|
|
19
|
+
|
|
20
|
+
var SaveAndPublishButton = function SaveAndPublishButton() {
|
|
21
|
+
var _useContentEntry = useContentEntry(),
|
|
22
|
+
form = _useContentEntry.form,
|
|
23
|
+
loading = _useContentEntry.loading,
|
|
24
|
+
entry = _useContentEntry.entry;
|
|
25
|
+
|
|
26
|
+
var _useRevision = useRevision({
|
|
27
|
+
revision: entry
|
|
28
|
+
}),
|
|
29
|
+
publishRevision = _useRevision.publishRevision;
|
|
30
|
+
|
|
31
|
+
var _useConfirmationDialo = useConfirmationDialog({
|
|
32
|
+
title: t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Publish content"]))),
|
|
33
|
+
message: /*#__PURE__*/React.createElement("p", null, t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["You are about to publish a new revision. Are you sure you want to continue?"])))),
|
|
34
|
+
dataTestId: "cms-confirm-save-and-publish"
|
|
35
|
+
}),
|
|
36
|
+
showConfirmation = _useConfirmationDialo.showConfirmation;
|
|
37
|
+
|
|
38
|
+
var _usePermission = usePermission(),
|
|
39
|
+
canEdit = _usePermission.canEdit,
|
|
40
|
+
canPublish = _usePermission.canPublish;
|
|
41
|
+
|
|
42
|
+
if (!canEdit(entry, "cms.contentEntry") || !canPublish("cms.contentEntry")) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
47
|
+
className: buttonStyles,
|
|
48
|
+
onClick: function onClick() {
|
|
49
|
+
showConfirmation( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
50
|
+
var entry;
|
|
51
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
52
|
+
while (1) {
|
|
53
|
+
switch (_context.prev = _context.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
_context.next = 2;
|
|
56
|
+
return form.current.submit();
|
|
57
|
+
|
|
58
|
+
case 2:
|
|
59
|
+
entry = _context.sent;
|
|
60
|
+
|
|
61
|
+
if (entry) {
|
|
62
|
+
_context.next = 5;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return _context.abrupt("return");
|
|
67
|
+
|
|
68
|
+
case 5:
|
|
69
|
+
_context.next = 7;
|
|
70
|
+
return publishRevision(entry.id);
|
|
71
|
+
|
|
72
|
+
case 7:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context.stop();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, _callee);
|
|
78
|
+
})));
|
|
79
|
+
},
|
|
80
|
+
disabled: loading
|
|
81
|
+
}, t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["Save & Publish"]))));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default SaveAndPublishButton;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { i18n } from "@webiny/app/i18n";
|
|
7
|
+
import { ButtonSecondary } from "@webiny/ui/Button";
|
|
8
|
+
import { useContentEntry } from "../../../hooks/useContentEntry";
|
|
9
|
+
import usePermission from "../../../../../hooks/usePermission";
|
|
10
|
+
var t = i18n.ns("app-headless-cms/admin/plugins/content-details/header/publish-revision");
|
|
11
|
+
|
|
12
|
+
var SaveContentButton = function SaveContentButton() {
|
|
13
|
+
var _useContentEntry = useContentEntry(),
|
|
14
|
+
form = _useContentEntry.form,
|
|
15
|
+
entry = _useContentEntry.entry;
|
|
16
|
+
|
|
17
|
+
var _usePermission = usePermission(),
|
|
18
|
+
canEdit = _usePermission.canEdit;
|
|
19
|
+
|
|
20
|
+
if (!canEdit(entry, "cms.contentEntry")) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return /*#__PURE__*/React.createElement(ButtonSecondary, {
|
|
25
|
+
"data-testid": "cms-content-save-content-button",
|
|
26
|
+
onClick: function onClick() {
|
|
27
|
+
return form.current.submit();
|
|
28
|
+
}
|
|
29
|
+
}, t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Save"]))));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default SaveContentButton;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
|
|
2
|
+
import { plugins } from "@webiny/plugins";
|
|
3
|
+
|
|
4
|
+
var getAvailableTransformerPlugins = function getAvailableTransformerPlugins() {
|
|
5
|
+
return plugins.byType("cms-field-value-transformer").reduce(function (transformers, pl) {
|
|
6
|
+
var fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];
|
|
7
|
+
|
|
8
|
+
var _iterator = _createForOfIteratorHelper(fieldTypes),
|
|
9
|
+
_step;
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13
|
+
var _fieldType = _step.value;
|
|
14
|
+
|
|
15
|
+
if (transformers[_fieldType]) {
|
|
16
|
+
console.warn("Transformer for field type \"".concat(_fieldType, "\" is already defined. There cannot be more than one transformer."));
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
transformers[_fieldType] = pl;
|
|
21
|
+
}
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_iterator.e(err);
|
|
24
|
+
} finally {
|
|
25
|
+
_iterator.f();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return transformers;
|
|
29
|
+
}, {});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var createTransformers = function createTransformers(fields) {
|
|
33
|
+
var transformerPlugins = getAvailableTransformerPlugins();
|
|
34
|
+
var transformers = {};
|
|
35
|
+
|
|
36
|
+
var _iterator2 = _createForOfIteratorHelper(fields),
|
|
37
|
+
_step2;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
var _loop = function _loop() {
|
|
41
|
+
var field = _step2.value;
|
|
42
|
+
|
|
43
|
+
if (!transformerPlugins[field.type]) {
|
|
44
|
+
return "continue";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
transformers[field.fieldId] = function (value) {
|
|
48
|
+
return transformerPlugins[field.type].transform(value, field);
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
53
|
+
var _ret = _loop();
|
|
54
|
+
|
|
55
|
+
if (_ret === "continue") continue;
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_iterator2.e(err);
|
|
59
|
+
} finally {
|
|
60
|
+
_iterator2.f();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return transformers;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export var prepareFormData = function prepareFormData(data, model) {
|
|
67
|
+
var transformers = createTransformers(model.fields);
|
|
68
|
+
return Object.keys(data).reduce(function (acc, key) {
|
|
69
|
+
var value = data[key];
|
|
70
|
+
|
|
71
|
+
if (!transformers[key]) {
|
|
72
|
+
acc[key] = value;
|
|
73
|
+
return acc;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
acc[key] = transformers[key](value);
|
|
77
|
+
return acc;
|
|
78
|
+
}, {});
|
|
79
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CmsEditorContentEntry } from "../../../../types";
|
|
2
|
+
export declare type UseRevisionProps = {
|
|
3
|
+
revision: CmsEditorContentEntry;
|
|
4
|
+
};
|
|
5
|
+
export declare const useRevision: ({ revision }: UseRevisionProps) => {
|
|
6
|
+
createRevision: (...params: any[]) => any;
|
|
7
|
+
editRevision: (...params: any[]) => any;
|
|
8
|
+
deleteRevision: (...params: any[]) => any;
|
|
9
|
+
publishRevision: (...params: any[]) => any;
|
|
10
|
+
unpublishRevision: (...params: any[]) => any;
|
|
11
|
+
requestReview: (...params: any[]) => any;
|
|
12
|
+
requestChanges: (...params: any[]) => any;
|
|
13
|
+
};
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import React, { useMemo } from "react";
|
|
4
|
+
import { useRouter } from "@webiny/react-router";
|
|
5
|
+
import { useHandlers } from "@webiny/app/hooks/useHandlers";
|
|
6
|
+
import { useSnackbar } from "@webiny/app-admin/hooks/useSnackbar";
|
|
7
|
+
import * as GQL from "../../../graphql/contentEntries";
|
|
8
|
+
import * as GQLCache from "./cache";
|
|
9
|
+
import { useApolloClient } from "../../../hooks";
|
|
10
|
+
import { useContentEntry } from "../hooks/useContentEntry";
|
|
11
|
+
export var useRevision = function useRevision(_ref) {
|
|
12
|
+
var revision = _ref.revision;
|
|
13
|
+
|
|
14
|
+
var _useContentEntry = useContentEntry(),
|
|
15
|
+
contentModel = _useContentEntry.contentModel,
|
|
16
|
+
entry = _useContentEntry.entry,
|
|
17
|
+
setLoading = _useContentEntry.setLoading,
|
|
18
|
+
listQueryVariables = _useContentEntry.listQueryVariables;
|
|
19
|
+
|
|
20
|
+
var _useRouter = useRouter(),
|
|
21
|
+
history = _useRouter.history;
|
|
22
|
+
|
|
23
|
+
var _useSnackbar = useSnackbar(),
|
|
24
|
+
showSnackbar = _useSnackbar.showSnackbar;
|
|
25
|
+
|
|
26
|
+
var client = useApolloClient();
|
|
27
|
+
var modelId = contentModel.modelId;
|
|
28
|
+
|
|
29
|
+
var _useMemo = useMemo(function () {
|
|
30
|
+
return {
|
|
31
|
+
CREATE_REVISION: GQL.createCreateFromMutation(contentModel),
|
|
32
|
+
DELETE_REVISION: GQL.createDeleteMutation(contentModel),
|
|
33
|
+
PUBLISH_REVISION: GQL.createPublishMutation(contentModel),
|
|
34
|
+
UNPUBLISH_REVISION: GQL.createUnpublishMutation(contentModel),
|
|
35
|
+
REQUEST_REVIEW: GQL.createRequestReviewMutation(contentModel),
|
|
36
|
+
REQUEST_CHANGES: GQL.createRequestChangesMutation(contentModel)
|
|
37
|
+
};
|
|
38
|
+
}, [modelId]),
|
|
39
|
+
CREATE_REVISION = _useMemo.CREATE_REVISION,
|
|
40
|
+
DELETE_REVISION = _useMemo.DELETE_REVISION,
|
|
41
|
+
PUBLISH_REVISION = _useMemo.PUBLISH_REVISION,
|
|
42
|
+
UNPUBLISH_REVISION = _useMemo.UNPUBLISH_REVISION,
|
|
43
|
+
REQUEST_REVIEW = _useMemo.REQUEST_REVIEW,
|
|
44
|
+
REQUEST_CHANGES = _useMemo.REQUEST_CHANGES;
|
|
45
|
+
|
|
46
|
+
var _useHandlers = useHandlers({
|
|
47
|
+
entry: entry
|
|
48
|
+
}, {
|
|
49
|
+
createRevision: function createRevision() {
|
|
50
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
51
|
+
var _yield$client$mutate, res, _res$content, data, error;
|
|
52
|
+
|
|
53
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
54
|
+
while (1) {
|
|
55
|
+
switch (_context.prev = _context.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
setLoading(true);
|
|
58
|
+
_context.next = 3;
|
|
59
|
+
return client.mutate({
|
|
60
|
+
mutation: CREATE_REVISION,
|
|
61
|
+
variables: {
|
|
62
|
+
revision: revision.id
|
|
63
|
+
},
|
|
64
|
+
update: function update(cache, _ref3) {
|
|
65
|
+
var data = _ref3.data;
|
|
66
|
+
var newRevision = data.content.data;
|
|
67
|
+
GQLCache.updateLatestRevisionInListCache(contentModel, cache, newRevision, listQueryVariables);
|
|
68
|
+
GQLCache.addRevisionToRevisionsCache(contentModel, cache, newRevision);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
case 3:
|
|
73
|
+
_yield$client$mutate = _context.sent;
|
|
74
|
+
res = _yield$client$mutate.data;
|
|
75
|
+
setLoading(false);
|
|
76
|
+
_res$content = res.content, data = _res$content.data, error = _res$content.error;
|
|
77
|
+
|
|
78
|
+
if (!error) {
|
|
79
|
+
_context.next = 9;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return _context.abrupt("return", showSnackbar(error.message));
|
|
84
|
+
|
|
85
|
+
case 9:
|
|
86
|
+
history.push("/cms/content-entries/".concat(modelId, "?id=").concat(encodeURIComponent(data.id)));
|
|
87
|
+
|
|
88
|
+
case 10:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context.stop();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, _callee);
|
|
94
|
+
}));
|
|
95
|
+
},
|
|
96
|
+
editRevision: function editRevision() {
|
|
97
|
+
return function () {
|
|
98
|
+
history.push("/cms/content-entries/".concat(modelId, "/?id=").concat(encodeURIComponent(revision.id)));
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
deleteRevision: function deleteRevision(_ref4) {
|
|
102
|
+
var entry = _ref4.entry;
|
|
103
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
104
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
105
|
+
while (1) {
|
|
106
|
+
switch (_context2.prev = _context2.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
setLoading(true);
|
|
109
|
+
_context2.next = 3;
|
|
110
|
+
return client.mutate({
|
|
111
|
+
mutation: DELETE_REVISION,
|
|
112
|
+
variables: {
|
|
113
|
+
revision: revision.id
|
|
114
|
+
},
|
|
115
|
+
update: function update(cache, _ref6) {
|
|
116
|
+
var data = _ref6.data;
|
|
117
|
+
var error = data.content.error;
|
|
118
|
+
|
|
119
|
+
if (error) {
|
|
120
|
+
return showSnackbar(error.message);
|
|
121
|
+
} // We have other revisions, update entry's cache
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
// We have other revisions, update entry's cache
|
|
125
|
+
var revisions = GQLCache.removeRevisionFromEntryCache(contentModel, cache, revision);
|
|
126
|
+
|
|
127
|
+
if (revision.id === entry.id) {
|
|
128
|
+
GQLCache.updateLatestRevisionInListCache(contentModel, cache, revisions[0], listQueryVariables); // Redirect to the first revision in the list of all entry revisions.
|
|
129
|
+
|
|
130
|
+
// Redirect to the first revision in the list of all entry revisions.
|
|
131
|
+
return history.push("/cms/content-entries/".concat(modelId, "?id=") + encodeURIComponent(revisions[0].id));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
case 3:
|
|
137
|
+
setLoading(false);
|
|
138
|
+
|
|
139
|
+
case 4:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context2.stop();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, _callee2);
|
|
145
|
+
}));
|
|
146
|
+
},
|
|
147
|
+
publishRevision: function publishRevision() {
|
|
148
|
+
return /*#__PURE__*/function () {
|
|
149
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
|
|
150
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
151
|
+
while (1) {
|
|
152
|
+
switch (_context3.prev = _context3.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
setLoading(true);
|
|
155
|
+
_context3.next = 3;
|
|
156
|
+
return client.mutate({
|
|
157
|
+
mutation: PUBLISH_REVISION,
|
|
158
|
+
variables: {
|
|
159
|
+
revision: id || revision.id
|
|
160
|
+
},
|
|
161
|
+
update: function update(cache, _ref8) {
|
|
162
|
+
var data = _ref8.data;
|
|
163
|
+
var _data$content = data.content,
|
|
164
|
+
published = _data$content.data,
|
|
165
|
+
error = _data$content.error;
|
|
166
|
+
|
|
167
|
+
if (error) {
|
|
168
|
+
return showSnackbar(error.message);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
GQLCache.unpublishPreviouslyPublishedRevision(contentModel, cache, published.id);
|
|
172
|
+
showSnackbar( /*#__PURE__*/React.createElement("span", null, "Successfully published revision", " ", /*#__PURE__*/React.createElement("strong", null, "#", published.meta.version), "!"));
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
case 3:
|
|
177
|
+
setLoading(false);
|
|
178
|
+
|
|
179
|
+
case 4:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context3.stop();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, _callee3);
|
|
185
|
+
}));
|
|
186
|
+
|
|
187
|
+
return function (_x) {
|
|
188
|
+
return _ref7.apply(this, arguments);
|
|
189
|
+
};
|
|
190
|
+
}();
|
|
191
|
+
},
|
|
192
|
+
unpublishRevision: function unpublishRevision() {
|
|
193
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
194
|
+
var _yield$client$mutate2, data, error;
|
|
195
|
+
|
|
196
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
197
|
+
while (1) {
|
|
198
|
+
switch (_context4.prev = _context4.next) {
|
|
199
|
+
case 0:
|
|
200
|
+
setLoading(true);
|
|
201
|
+
_context4.next = 3;
|
|
202
|
+
return client.mutate({
|
|
203
|
+
mutation: UNPUBLISH_REVISION,
|
|
204
|
+
variables: {
|
|
205
|
+
revision: revision.id
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
case 3:
|
|
210
|
+
_yield$client$mutate2 = _context4.sent;
|
|
211
|
+
data = _yield$client$mutate2.data;
|
|
212
|
+
setLoading(false);
|
|
213
|
+
error = data.content.error;
|
|
214
|
+
|
|
215
|
+
if (!error) {
|
|
216
|
+
_context4.next = 9;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return _context4.abrupt("return", showSnackbar(error.message));
|
|
221
|
+
|
|
222
|
+
case 9:
|
|
223
|
+
showSnackbar( /*#__PURE__*/React.createElement("span", null, "Successfully unpublished revision ", /*#__PURE__*/React.createElement("strong", null, "#", revision.meta.version), "!"));
|
|
224
|
+
|
|
225
|
+
case 10:
|
|
226
|
+
case "end":
|
|
227
|
+
return _context4.stop();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}, _callee4);
|
|
231
|
+
}));
|
|
232
|
+
},
|
|
233
|
+
requestReview: function requestReview() {
|
|
234
|
+
return /*#__PURE__*/function () {
|
|
235
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id) {
|
|
236
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
237
|
+
while (1) {
|
|
238
|
+
switch (_context5.prev = _context5.next) {
|
|
239
|
+
case 0:
|
|
240
|
+
setLoading(true);
|
|
241
|
+
_context5.next = 3;
|
|
242
|
+
return client.mutate({
|
|
243
|
+
mutation: REQUEST_REVIEW,
|
|
244
|
+
variables: {
|
|
245
|
+
revision: id || revision.id
|
|
246
|
+
},
|
|
247
|
+
update: function update(_, _ref11) {
|
|
248
|
+
var data = _ref11.data;
|
|
249
|
+
var error = data.content.error;
|
|
250
|
+
|
|
251
|
+
if (error) {
|
|
252
|
+
return showSnackbar(error.message);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
showSnackbar( /*#__PURE__*/React.createElement("span", null, "Review requested successfully!"));
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
case 3:
|
|
260
|
+
setLoading(false);
|
|
261
|
+
|
|
262
|
+
case 4:
|
|
263
|
+
case "end":
|
|
264
|
+
return _context5.stop();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}, _callee5);
|
|
268
|
+
}));
|
|
269
|
+
|
|
270
|
+
return function (_x2) {
|
|
271
|
+
return _ref10.apply(this, arguments);
|
|
272
|
+
};
|
|
273
|
+
}();
|
|
274
|
+
},
|
|
275
|
+
requestChanges: function requestChanges() {
|
|
276
|
+
return /*#__PURE__*/function () {
|
|
277
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
|
|
278
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
279
|
+
while (1) {
|
|
280
|
+
switch (_context6.prev = _context6.next) {
|
|
281
|
+
case 0:
|
|
282
|
+
setLoading(true);
|
|
283
|
+
_context6.next = 3;
|
|
284
|
+
return client.mutate({
|
|
285
|
+
mutation: REQUEST_CHANGES,
|
|
286
|
+
variables: {
|
|
287
|
+
revision: id || revision.id
|
|
288
|
+
},
|
|
289
|
+
update: function update(_, _ref13) {
|
|
290
|
+
var data = _ref13.data;
|
|
291
|
+
var error = data.content.error;
|
|
292
|
+
|
|
293
|
+
if (error) {
|
|
294
|
+
return showSnackbar(error.message);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
showSnackbar( /*#__PURE__*/React.createElement("span", null, "Changes requested successfully!"));
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
case 3:
|
|
302
|
+
setLoading(false);
|
|
303
|
+
|
|
304
|
+
case 4:
|
|
305
|
+
case "end":
|
|
306
|
+
return _context6.stop();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}, _callee6);
|
|
310
|
+
}));
|
|
311
|
+
|
|
312
|
+
return function (_x3) {
|
|
313
|
+
return _ref12.apply(this, arguments);
|
|
314
|
+
};
|
|
315
|
+
}();
|
|
316
|
+
}
|
|
317
|
+
}),
|
|
318
|
+
createRevision = _useHandlers.createRevision,
|
|
319
|
+
editRevision = _useHandlers.editRevision,
|
|
320
|
+
deleteRevision = _useHandlers.deleteRevision,
|
|
321
|
+
publishRevision = _useHandlers.publishRevision,
|
|
322
|
+
unpublishRevision = _useHandlers.unpublishRevision,
|
|
323
|
+
requestReview = _useHandlers.requestReview,
|
|
324
|
+
requestChanges = _useHandlers.requestChanges;
|
|
325
|
+
|
|
326
|
+
return {
|
|
327
|
+
createRevision: createRevision,
|
|
328
|
+
editRevision: editRevision,
|
|
329
|
+
deleteRevision: deleteRevision,
|
|
330
|
+
publishRevision: publishRevision,
|
|
331
|
+
unpublishRevision: unpublishRevision,
|
|
332
|
+
requestReview: requestReview,
|
|
333
|
+
requestChanges: requestChanges
|
|
334
|
+
};
|
|
335
|
+
};
|