@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,104 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useEffect } from "react";
|
|
6
|
+
import get from "lodash/get";
|
|
7
|
+
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
8
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
9
|
+
import { Select } from "@webiny/ui/Select";
|
|
10
|
+
import { i18n } from "@webiny/app/i18n";
|
|
11
|
+
import { Elevation } from "@webiny/ui/Elevation";
|
|
12
|
+
import { PermissionSelector, PermissionSelectorWrapper } from "./PermissionSelector";
|
|
13
|
+
import { useCmsData } from "./useCmsData";
|
|
14
|
+
import { Note } from "./StyledComponents";
|
|
15
|
+
import ContentModelList from "./ContentModelList";
|
|
16
|
+
var t = i18n.ns("app-headless-cms/admin/plugins/permissionRenderer");
|
|
17
|
+
export var ContentModelPermission = function ContentModelPermission(_ref) {
|
|
18
|
+
var Bind = _ref.Bind,
|
|
19
|
+
data = _ref.data,
|
|
20
|
+
setValue = _ref.setValue,
|
|
21
|
+
entity = _ref.entity,
|
|
22
|
+
title = _ref.title,
|
|
23
|
+
locales = _ref.locales,
|
|
24
|
+
selectedContentModelGroups = _ref.selectedContentModelGroups;
|
|
25
|
+
var modelsGroups = useCmsData(locales); // Set "cms.contentModel" access scope to "own" if "cms.contentModelGroup" === "own".
|
|
26
|
+
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (get(data, "contentModelGroupAccessScope") === "own" && get(data, "".concat(entity, "AccessScope")) !== "own") {
|
|
29
|
+
setValue("".concat(entity, "AccessScope"), "own");
|
|
30
|
+
}
|
|
31
|
+
}, [data]);
|
|
32
|
+
var getItems = useCallback(function (code) {
|
|
33
|
+
var list = get(modelsGroups, "".concat(code, ".models"), []);
|
|
34
|
+
var groups = selectedContentModelGroups && selectedContentModelGroups[code] || [];
|
|
35
|
+
|
|
36
|
+
if (groups.length) {
|
|
37
|
+
// Filter by groups
|
|
38
|
+
list = list.filter(function (item) {
|
|
39
|
+
return groups.includes(item.group.id);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return list;
|
|
44
|
+
}, [modelsGroups]);
|
|
45
|
+
var disabledPrimaryActions = [undefined, "own", "no"].includes(data["".concat(entity, "AccessScope")]) || !data.endpoints.includes("manage");
|
|
46
|
+
return /*#__PURE__*/React.createElement(Elevation, {
|
|
47
|
+
z: 1,
|
|
48
|
+
style: {
|
|
49
|
+
marginTop: 10
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
52
|
+
span: 12
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
54
|
+
use: "overline"
|
|
55
|
+
}, title)), /*#__PURE__*/React.createElement(Cell, {
|
|
56
|
+
span: 12
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
58
|
+
style: {
|
|
59
|
+
padding: 0,
|
|
60
|
+
paddingBottom: 24
|
|
61
|
+
}
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Cell, {
|
|
63
|
+
span: 12
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
65
|
+
name: "".concat(entity, "AccessScope"),
|
|
66
|
+
defaultValue: "full"
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
68
|
+
label: t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Access Scope"]))),
|
|
69
|
+
disabled: data["contentModelGroupAccessScope"] === "own",
|
|
70
|
+
description: t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["The list of available models is defined by the options set in the content model groups section above."])))
|
|
71
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
72
|
+
value: "full"
|
|
73
|
+
}, t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["All models"])))), /*#__PURE__*/React.createElement("option", {
|
|
74
|
+
value: "models"
|
|
75
|
+
}, t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Only specific models"])))), data.endpoints.includes("manage") && /*#__PURE__*/React.createElement("option", {
|
|
76
|
+
value: "own"
|
|
77
|
+
}, t(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Only models created by the user"])))))), data["contentModelGroupAccessScope"] === "own" && /*#__PURE__*/React.createElement(Note, null, /*#__PURE__*/React.createElement(Typography, {
|
|
78
|
+
use: "caption"
|
|
79
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
80
|
+
className: "highlight"
|
|
81
|
+
}, "Content Model"), "\xA0", t(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["access depends upon"]))), "\xA0", /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
className: "highlight"
|
|
83
|
+
}, "Content Model Group")))), data["".concat(entity, "AccessScope")] === "models" && /*#__PURE__*/React.createElement(PermissionSelectorWrapper, null, /*#__PURE__*/React.createElement(PermissionSelector, {
|
|
84
|
+
locales: locales,
|
|
85
|
+
Bind: Bind,
|
|
86
|
+
entity: entity,
|
|
87
|
+
selectorKey: "models",
|
|
88
|
+
getItems: getItems,
|
|
89
|
+
RenderItems: ContentModelList
|
|
90
|
+
})), /*#__PURE__*/React.createElement(Cell, {
|
|
91
|
+
span: 12
|
|
92
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
93
|
+
name: "".concat(entity, "RWD")
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
95
|
+
label: t(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["Primary Actions"]))),
|
|
96
|
+
disabled: disabledPrimaryActions
|
|
97
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
98
|
+
value: "r"
|
|
99
|
+
}, t(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["Read"])))), data.endpoints.includes("manage") ? /*#__PURE__*/React.createElement("option", {
|
|
100
|
+
value: "rw"
|
|
101
|
+
}, t(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["Read, write"])))) : null, data.endpoints.includes("manage") ? /*#__PURE__*/React.createElement("option", {
|
|
102
|
+
value: "rwd"
|
|
103
|
+
}, t(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["Read, write, delete"])))) : null)))))));
|
|
104
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Elevation } from "@webiny/ui/Elevation";
|
|
3
|
+
import { Cell, Grid } from "@webiny/ui/Grid";
|
|
4
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
5
|
+
export var PermissionRendererWrapper = function PermissionRendererWrapper(_ref) {
|
|
6
|
+
var label = _ref.label,
|
|
7
|
+
children = _ref.children;
|
|
8
|
+
return /*#__PURE__*/React.createElement(Elevation, {
|
|
9
|
+
z: 1,
|
|
10
|
+
className: ""
|
|
11
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
12
|
+
className: "",
|
|
13
|
+
style: {
|
|
14
|
+
marginTop: 36
|
|
15
|
+
}
|
|
16
|
+
}, /*#__PURE__*/React.createElement(Cell, {
|
|
17
|
+
span: 12
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
19
|
+
use: "overline"
|
|
20
|
+
}, label)), /*#__PURE__*/React.createElement(Cell, {
|
|
21
|
+
span: 12
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
23
|
+
style: {
|
|
24
|
+
padding: 0,
|
|
25
|
+
paddingBottom: 24
|
|
26
|
+
}
|
|
27
|
+
}, children))));
|
|
28
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BindComponent } from "@webiny/form";
|
|
3
|
+
export declare type PermissionSelectorCheckList = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
declare type Model = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
declare type Group = {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
declare type RenderItemsProps = {
|
|
18
|
+
onChange: Function;
|
|
19
|
+
getValue: Function;
|
|
20
|
+
items: Model[] | Group[];
|
|
21
|
+
};
|
|
22
|
+
export declare type PermissionSelectorProps = {
|
|
23
|
+
Bind: BindComponent;
|
|
24
|
+
selectorKey: string;
|
|
25
|
+
locales: string[];
|
|
26
|
+
entity: string;
|
|
27
|
+
getItems: (code: string) => Model[] | Group[];
|
|
28
|
+
RenderItems?: React.FunctionComponent<RenderItemsProps>;
|
|
29
|
+
};
|
|
30
|
+
export declare const PermissionSelector: ({ Bind, entity, locales, selectorKey, getItems, RenderItems }: PermissionSelectorProps) => JSX.Element;
|
|
31
|
+
export declare const PermissionSelectorWrapper: ({ children }: {
|
|
32
|
+
children: any;
|
|
33
|
+
}) => JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import React, { Fragment } from "react";
|
|
6
|
+
import { i18n } from "@webiny/app/i18n";
|
|
7
|
+
import { Checkbox, CheckboxGroup } from "@webiny/ui/Checkbox";
|
|
8
|
+
import { Cell } from "@webiny/ui/Grid";
|
|
9
|
+
import { FormElementMessage } from "@webiny/ui/FormElementMessage";
|
|
10
|
+
var t = i18n.ns("app-headless-cms/admin/plugins/permissionRenderer");
|
|
11
|
+
|
|
12
|
+
var DefaultRenderItems = function DefaultRenderItems(_ref) {
|
|
13
|
+
var items = _ref.items,
|
|
14
|
+
getValue = _ref.getValue,
|
|
15
|
+
onChange = _ref.onChange;
|
|
16
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, items.map(function (_ref2) {
|
|
17
|
+
var id = _ref2.id,
|
|
18
|
+
label = _ref2.label;
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
key: id
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
22
|
+
key: id,
|
|
23
|
+
label: label,
|
|
24
|
+
value: getValue(id),
|
|
25
|
+
onChange: onChange(id)
|
|
26
|
+
}));
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export var PermissionSelector = function PermissionSelector(_ref3) {
|
|
31
|
+
var Bind = _ref3.Bind,
|
|
32
|
+
entity = _ref3.entity,
|
|
33
|
+
locales = _ref3.locales,
|
|
34
|
+
selectorKey = _ref3.selectorKey,
|
|
35
|
+
getItems = _ref3.getItems,
|
|
36
|
+
_ref3$RenderItems = _ref3.RenderItems,
|
|
37
|
+
RenderItems = _ref3$RenderItems === void 0 ? DefaultRenderItems : _ref3$RenderItems;
|
|
38
|
+
var description = t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Select the {selectorKey} user will be allowed to access."])))({
|
|
39
|
+
selectorKey: selectorKey
|
|
40
|
+
});
|
|
41
|
+
return /*#__PURE__*/React.createElement(Fragment, null, locales.map(function (code) {
|
|
42
|
+
var items = getItems(code);
|
|
43
|
+
return /*#__PURE__*/React.createElement(Bind, {
|
|
44
|
+
key: code,
|
|
45
|
+
name: "".concat(entity, "Props.").concat(selectorKey, ".").concat(code)
|
|
46
|
+
}, items.length && /*#__PURE__*/React.createElement(CheckboxGroup, {
|
|
47
|
+
label: code
|
|
48
|
+
}, function (_ref4) {
|
|
49
|
+
var onChange = _ref4.onChange,
|
|
50
|
+
getValue = _ref4.getValue;
|
|
51
|
+
return /*#__PURE__*/React.createElement(RenderItems, {
|
|
52
|
+
items: items,
|
|
53
|
+
onChange: onChange,
|
|
54
|
+
getValue: getValue
|
|
55
|
+
});
|
|
56
|
+
}));
|
|
57
|
+
}), /*#__PURE__*/React.createElement(FormElementMessage, null, description));
|
|
58
|
+
};
|
|
59
|
+
export var PermissionSelectorWrapper = function PermissionSelectorWrapper(_ref5) {
|
|
60
|
+
var children = _ref5.children;
|
|
61
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Cell, {
|
|
62
|
+
span: 1
|
|
63
|
+
}), /*#__PURE__*/React.createElement(Cell, {
|
|
64
|
+
span: 11
|
|
65
|
+
}, children));
|
|
66
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Note: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "hidden" | "dir" | "slot" | "style" | "title" | "color" | "translate" | "children" | "defaultValue" | "id" | "onError" | "className" | "onBlur" | "onClick" | "onContextMenu" | "onCopy" | "onCut" | "onAuxClick" | "onDoubleClick" | "onDragEnd" | "onDragStart" | "onDrop" | "onFocus" | "onInput" | "onInvalid" | "onKeyDown" | "onKeyPress" | "onKeyUp" | "onMouseDown" | "onMouseUp" | "onPaste" | "onPause" | "onPlay" | "onPointerCancel" | "onPointerDown" | "onPointerUp" | "onRateChange" | "onReset" | "onSeeked" | "onSubmit" | "onTouchCancel" | "onTouchEnd" | "onTouchStart" | "onVolumeChange" | "onAbort" | "onAnimationEnd" | "onAnimationIteration" | "onAnimationStart" | "onCanPlay" | "onCanPlayThrough" | "onDrag" | "onDragEnter" | "onDragExit" | "onDragLeave" | "onDragOver" | "onDurationChange" | "onEmptied" | "onEncrypted" | "onEnded" | "onGotPointerCapture" | "onLoad" | "onLoadedData" | "onLoadedMetadata" | "onLoadStart" | "onLostPointerCapture" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onPlaying" | "onPointerMove" | "onPointerOut" | "onPointerOver" | "onProgress" | "onScroll" | "onSeeking" | "onStalled" | "onSuspend" | "onTimeUpdate" | "onTouchMove" | "onTransitionEnd" | "onWaiting" | "onWheel" | "onMouseEnter" | "onMouseLeave" | "onPointerEnter" | "onPointerLeave" | "onChange" | "onSelect" | "onBeforeInput" | "onCompositionEnd" | "onCompositionStart" | "onCompositionUpdate" | "placeholder" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopyCapture" | "onCutCapture" | "onPasteCapture" | "onCompositionEndCapture" | "onCompositionStartCapture" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInputCapture" | "onInputCapture" | "onResetCapture" | "onSubmitCapture" | "onInvalidCapture" | "onLoadCapture" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPressCapture" | "onKeyUpCapture" | "onAbortCapture" | "onCanPlayCapture" | "onCanPlayThroughCapture" | "onDurationChangeCapture" | "onEmptiedCapture" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedDataCapture" | "onLoadedMetadataCapture" | "onLoadStartCapture" | "onPauseCapture" | "onPlayCapture" | "onPlayingCapture" | "onProgressCapture" | "onRateChangeCapture" | "onSeekedCapture" | "onSeekingCapture" | "onStalledCapture" | "onSuspendCapture" | "onTimeUpdateCapture" | "onVolumeChangeCapture" | "onWaitingCapture" | "onAuxClickCapture" | "onClickCapture" | "onContextMenuCapture" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnterCapture" | "onDragExitCapture" | "onDragLeaveCapture" | "onDragOverCapture" | "onDragStartCapture" | "onDropCapture" | "onMouseDownCapture" | "onMouseMoveCapture" | "onMouseOutCapture" | "onMouseOverCapture" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancelCapture" | "onTouchEndCapture" | "onTouchMoveCapture" | "onTouchStartCapture" | "onPointerDownCapture" | "onPointerMoveCapture" | "onPointerUpCapture" | "onPointerCancelCapture" | "onPointerEnterCapture" | "onPointerLeaveCapture" | "onPointerOverCapture" | "onPointerOutCapture" | "onGotPointerCaptureCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIterationCapture" | "onTransitionEndCapture">, object>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCmsData: (locales: string[]) => {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
6
|
+
|
|
7
|
+
var _templateObject;
|
|
8
|
+
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
+
import { useEffect, useReducer } from "react";
|
|
11
|
+
import gql from "graphql-tag";
|
|
12
|
+
import { useCms } from "../../../hooks";
|
|
13
|
+
var LIST_DATA = gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query CmsLoadPermissionsData {\n listContentModels {\n data {\n id: modelId\n label: name\n group {\n id\n label: name\n }\n }\n }\n listContentModelGroups {\n data {\n id\n label: name\n }\n }\n }\n"])));
|
|
14
|
+
export var useCmsData = function useCmsData(locales) {
|
|
15
|
+
var _useCms = useCms(),
|
|
16
|
+
getApolloClient = _useCms.getApolloClient;
|
|
17
|
+
|
|
18
|
+
var _useReducer = useReducer(function (prev, next) {
|
|
19
|
+
return _objectSpread(_objectSpread({}, prev), next);
|
|
20
|
+
}, {}),
|
|
21
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
22
|
+
state = _useReducer2[0],
|
|
23
|
+
setState = _useReducer2[1];
|
|
24
|
+
|
|
25
|
+
var loadData = /*#__PURE__*/function () {
|
|
26
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
27
|
+
var _loop, i;
|
|
28
|
+
|
|
29
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
30
|
+
while (1) {
|
|
31
|
+
switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
_loop = function _loop(i) {
|
|
34
|
+
var code = locales[i];
|
|
35
|
+
var client = getApolloClient(code);
|
|
36
|
+
|
|
37
|
+
if (!state[code]) {
|
|
38
|
+
client.query({
|
|
39
|
+
query: LIST_DATA
|
|
40
|
+
}).then(function (_ref2) {
|
|
41
|
+
var data = _ref2.data;
|
|
42
|
+
var models = data.listContentModels.data;
|
|
43
|
+
var groups = data.listContentModelGroups.data;
|
|
44
|
+
setState(_objectSpread(_objectSpread({}, state), {}, _defineProperty({}, code, {
|
|
45
|
+
models: models,
|
|
46
|
+
groups: groups
|
|
47
|
+
})));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
for (i = 0; i < locales.length; i++) {
|
|
53
|
+
_loop(i);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
case 2:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, _callee);
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
return function loadData() {
|
|
65
|
+
return _ref.apply(this, arguments);
|
|
66
|
+
};
|
|
67
|
+
}();
|
|
68
|
+
|
|
69
|
+
useEffect(function () {
|
|
70
|
+
loadData();
|
|
71
|
+
}, [locales.sort().join(":")]);
|
|
72
|
+
return locales.reduce(function (acc, code) {
|
|
73
|
+
acc[code] = state[code] || {
|
|
74
|
+
models: [],
|
|
75
|
+
groups: []
|
|
76
|
+
};
|
|
77
|
+
return acc;
|
|
78
|
+
}, {});
|
|
79
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AccordionItem } from "@webiny/ui/Accordion";
|
|
3
|
+
import { ReactComponent as HeadlessCMSIcon } from "@svgr/webpack!../../icons/devices_other-black-24px.svg";
|
|
4
|
+
import { CMSPermissions } from "./CmsPermissions";
|
|
5
|
+
export default {
|
|
6
|
+
type: "admin-app-permissions-renderer",
|
|
7
|
+
name: "admin-app-permissions-renderer-cms",
|
|
8
|
+
render: function render(props) {
|
|
9
|
+
return /*#__PURE__*/React.createElement(AccordionItem, {
|
|
10
|
+
icon: /*#__PURE__*/React.createElement(HeadlessCMSIcon, null),
|
|
11
|
+
title: "Headless CMS",
|
|
12
|
+
description: "Manage Headless CMS app access permissions.",
|
|
13
|
+
"data-testid": "permission.cms"
|
|
14
|
+
}, /*#__PURE__*/React.createElement(CMSPermissions, props));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
5
|
+
|
|
6
|
+
var _excluded = ["children"];
|
|
7
|
+
import React, { Suspense, lazy } from "react";
|
|
8
|
+
import Helmet from "react-helmet";
|
|
9
|
+
import { SecureRoute } from "@webiny/app-security/components";
|
|
10
|
+
import { CircularProgress } from "@webiny/ui/Progress";
|
|
11
|
+
import { Route } from "@webiny/react-router";
|
|
12
|
+
import { AdminLayout } from "@webiny/app-admin/components/AdminLayout";
|
|
13
|
+
import { i18n } from "@webiny/app/i18n";
|
|
14
|
+
var t = i18n.ns("app-headless-cms/admin/routes");
|
|
15
|
+
|
|
16
|
+
var Loader = function Loader(_ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(Suspense, {
|
|
21
|
+
fallback: /*#__PURE__*/React.createElement(CircularProgress, null)
|
|
22
|
+
}, /*#__PURE__*/React.cloneElement(children, props));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var ContentModelEditor = /*#__PURE__*/lazy(function () {
|
|
26
|
+
return import("../views/contentModels/ContentModelEditor");
|
|
27
|
+
});
|
|
28
|
+
var ContentModelsView = /*#__PURE__*/lazy(function () {
|
|
29
|
+
return import("../views/contentModels/ContentModels");
|
|
30
|
+
});
|
|
31
|
+
var ContentModelGroupsView = /*#__PURE__*/lazy(function () {
|
|
32
|
+
return import("../views/contentModelGroups/ContentModelGroups");
|
|
33
|
+
});
|
|
34
|
+
var ContentEntiesView = /*#__PURE__*/lazy(function () {
|
|
35
|
+
return import("../views/contentEntries/ContentEntries");
|
|
36
|
+
});
|
|
37
|
+
var plugins = [{
|
|
38
|
+
name: "route-cms-content-models-groups",
|
|
39
|
+
type: "route",
|
|
40
|
+
route: /*#__PURE__*/React.createElement(Route, {
|
|
41
|
+
exact: true,
|
|
42
|
+
path: "/cms/content-model-groups",
|
|
43
|
+
render: function render() {
|
|
44
|
+
return /*#__PURE__*/React.createElement(SecureRoute, {
|
|
45
|
+
permission: "cms.contentModelGroup"
|
|
46
|
+
}, /*#__PURE__*/React.createElement(AdminLayout, null, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("title", null, t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Content Model Groups"]))))), /*#__PURE__*/React.createElement(Loader, null, /*#__PURE__*/React.createElement(ContentModelGroupsView, null))));
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}, {
|
|
50
|
+
name: "route-cms-content-models-manage",
|
|
51
|
+
type: "route",
|
|
52
|
+
route: /*#__PURE__*/React.createElement(Route, {
|
|
53
|
+
exact: true,
|
|
54
|
+
path: "/cms/content-entries/:modelId",
|
|
55
|
+
render: function render() {
|
|
56
|
+
return /*#__PURE__*/React.createElement(SecureRoute, {
|
|
57
|
+
permission: "cms.contentModel"
|
|
58
|
+
}, /*#__PURE__*/React.createElement(AdminLayout, null, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("title", null, t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Content"]))))), /*#__PURE__*/React.createElement(Loader, null, /*#__PURE__*/React.createElement(ContentEntiesView, null))));
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}, {
|
|
62
|
+
name: "route-cms-content-models-editor",
|
|
63
|
+
type: "route",
|
|
64
|
+
route: /*#__PURE__*/React.createElement(Route, {
|
|
65
|
+
exact: true,
|
|
66
|
+
path: "/cms/content-models/:modelId",
|
|
67
|
+
render: function render() {
|
|
68
|
+
return /*#__PURE__*/React.createElement(SecureRoute, {
|
|
69
|
+
permission: "cms.contentModel"
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("title", null, t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["Edit Content Model"]))))), /*#__PURE__*/React.createElement(Loader, null, /*#__PURE__*/React.createElement(ContentModelEditor, null)));
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
}, {
|
|
74
|
+
name: "route-cms-content-models",
|
|
75
|
+
type: "route",
|
|
76
|
+
route: /*#__PURE__*/React.createElement(Route, {
|
|
77
|
+
exact: true,
|
|
78
|
+
path: "/cms/content-models",
|
|
79
|
+
render: function render() {
|
|
80
|
+
return /*#__PURE__*/React.createElement(SecureRoute, {
|
|
81
|
+
permission: "cms.contentModel"
|
|
82
|
+
}, /*#__PURE__*/React.createElement(AdminLayout, null, /*#__PURE__*/React.createElement(Helmet, {
|
|
83
|
+
title: t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Content Models"])))
|
|
84
|
+
}), /*#__PURE__*/React.createElement(Loader, null, /*#__PURE__*/React.createElement(ContentModelsView, null))));
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
}];
|
|
88
|
+
export default plugins;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
|
|
3
|
+
var transformDate = function transformDate(value, type) {
|
|
4
|
+
if (type === "date") {
|
|
5
|
+
return value.substr(0, 10);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return value;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
var excludeTypesTransformation = ["time", "dateTimeWithTimezone"];
|
|
12
|
+
export default (function () {
|
|
13
|
+
return {
|
|
14
|
+
type: "cms-field-value-transformer",
|
|
15
|
+
name: "cms-field-value-transformer-date",
|
|
16
|
+
fieldType: "datetime",
|
|
17
|
+
transform: function transform(value, field) {
|
|
18
|
+
// check types in packages/app-headless-cms/src/admin/plugins/fieldRenderers/dateTime/dateTimeField.tsx
|
|
19
|
+
var type = field.settings.type;
|
|
20
|
+
|
|
21
|
+
if (!value) {
|
|
22
|
+
console.log("Field \"".concat(field.fieldId, "\" has no value."));
|
|
23
|
+
return null;
|
|
24
|
+
} else if (excludeTypesTransformation.includes(type) === true) {
|
|
25
|
+
return value;
|
|
26
|
+
} else if (type === "dateTimeWithoutTimezone" && value.includes(" ")) {
|
|
27
|
+
/**
|
|
28
|
+
* Need to replace space and add .000Z to datetime value because it can look like: 2021-02-02 16:34:56
|
|
29
|
+
*/
|
|
30
|
+
value = "".concat(value.replace(" ", "T"), ".000Z");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
var result = new Date(value).toISOString();
|
|
35
|
+
return transformDate(result, type);
|
|
36
|
+
} catch (ex) {
|
|
37
|
+
throw new WebinyError("Could not transform \"".concat(value, "\" to a date."), "TRANSFORM_ERROR", {
|
|
38
|
+
message: ex.message,
|
|
39
|
+
code: ex.code
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default (function () {
|
|
2
|
+
return {
|
|
3
|
+
type: "cms-field-value-transformer",
|
|
4
|
+
name: "cms-field-value-transformer-number",
|
|
5
|
+
fieldType: "number",
|
|
6
|
+
transform: function transform(value) {
|
|
7
|
+
if (Array.isArray(value) === true) {
|
|
8
|
+
return value.map(Number);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return Number(value);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
+
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
6
|
+
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
import React, { useCallback, useState } from "react";
|
|
9
|
+
import gql from "graphql-tag";
|
|
10
|
+
import { i18n } from "@webiny/app/i18n";
|
|
11
|
+
import { SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader } from "@webiny/app-admin/components/SimpleForm";
|
|
12
|
+
import { useApolloClient } from "@apollo/react-hooks";
|
|
13
|
+
import { Alert } from "@webiny/ui/Alert";
|
|
14
|
+
import { CircularProgress } from "@webiny/ui/Progress";
|
|
15
|
+
import { Cell, Grid } from "@webiny/ui/Grid";
|
|
16
|
+
import { ButtonPrimary } from "@webiny/ui/Button";
|
|
17
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
18
|
+
var t = i18n.ns("app-headless-cms/admin/installation");
|
|
19
|
+
var UPGRADE = gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n mutation UpgradeCMS($version: String!) {\n cms {\n upgrade(version: $version) {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n"])));
|
|
20
|
+
|
|
21
|
+
var Upgrade = function Upgrade(_ref) {
|
|
22
|
+
var onInstalled = _ref.onInstalled;
|
|
23
|
+
var client = useApolloClient();
|
|
24
|
+
|
|
25
|
+
var _useState = useState(null),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
error = _useState2[0],
|
|
28
|
+
setError = _useState2[1];
|
|
29
|
+
|
|
30
|
+
var _useState3 = useState(false),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
loading = _useState4[0],
|
|
33
|
+
setLoading = _useState4[1];
|
|
34
|
+
|
|
35
|
+
var startUpgrade = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
36
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
37
|
+
while (1) {
|
|
38
|
+
switch (_context.prev = _context.next) {
|
|
39
|
+
case 0:
|
|
40
|
+
setLoading(true);
|
|
41
|
+
_context.next = 3;
|
|
42
|
+
return client.mutate({
|
|
43
|
+
mutation: UPGRADE,
|
|
44
|
+
variables: {
|
|
45
|
+
version: "5.0.0"
|
|
46
|
+
}
|
|
47
|
+
}).then(function (_ref3) {
|
|
48
|
+
var data = _ref3.data;
|
|
49
|
+
setLoading(false);
|
|
50
|
+
var error = data.cms.upgrade.error;
|
|
51
|
+
|
|
52
|
+
if (error) {
|
|
53
|
+
setError(error.message);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
onInstalled();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
case 3:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
})), []);
|
|
67
|
+
var label = error ? /*#__PURE__*/React.createElement(Alert, {
|
|
68
|
+
title: t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Something went wrong"]))),
|
|
69
|
+
type: "danger"
|
|
70
|
+
}, error) : t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["Upgrading Headless CMS..."])));
|
|
71
|
+
return /*#__PURE__*/React.createElement(SimpleForm, null, loading && /*#__PURE__*/React.createElement(CircularProgress, {
|
|
72
|
+
label: label
|
|
73
|
+
}), /*#__PURE__*/React.createElement(SimpleFormHeader, {
|
|
74
|
+
title: "Upgrade Headless CMS"
|
|
75
|
+
}), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
76
|
+
span: 12
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
78
|
+
use: "body1",
|
|
79
|
+
tag: "div"
|
|
80
|
+
}, "This upgrade will do the following:", /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "create a separate Elasticsearch index for each content model"), /*#__PURE__*/React.createElement("li", null, "upgrade data stored into Elasticsearch for certain data types"), /*#__PURE__*/React.createElement("li", null, "insert Elasticsearch records into a dedicated DynamoDB table")))))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
81
|
+
onClick: startUpgrade
|
|
82
|
+
}, "Upgrade")));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default Upgrade;
|