@webiny/app-headless-cms 5.37.8 → 5.38.0-beta.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/HeadlessCMS.js +5 -2
- package/HeadlessCMS.js.map +1 -1
- package/admin/components/ContentEntries/BulkActions/ActionDelete.d.ts +4 -0
- package/admin/components/ContentEntries/BulkActions/ActionDelete.js +125 -0
- package/admin/components/ContentEntries/BulkActions/ActionDelete.js.map +1 -0
- package/admin/components/ContentEntries/BulkActions/ActionMove.d.ts +4 -0
- package/admin/components/ContentEntries/BulkActions/ActionMove.js +141 -0
- package/admin/components/ContentEntries/BulkActions/ActionMove.js.map +1 -0
- package/admin/components/ContentEntries/BulkActions/ActionPublish.d.ts +4 -0
- package/admin/components/ContentEntries/BulkActions/ActionPublish.js +131 -0
- package/admin/components/ContentEntries/BulkActions/ActionPublish.js.map +1 -0
- package/admin/components/ContentEntries/BulkActions/ActionUnpublish.d.ts +4 -0
- package/admin/components/ContentEntries/BulkActions/ActionUnpublish.js +131 -0
- package/admin/components/ContentEntries/BulkActions/ActionUnpublish.js.map +1 -0
- package/admin/components/ContentEntries/BulkActions/BulkActions.d.ts +3 -0
- package/admin/components/ContentEntries/BulkActions/BulkActions.js +53 -0
- package/admin/components/ContentEntries/BulkActions/BulkActions.js.map +1 -0
- package/admin/components/ContentEntries/BulkActions/BulkActions.styled.d.ts +15 -0
- package/admin/components/ContentEntries/BulkActions/BulkActions.styled.js +26 -0
- package/admin/components/ContentEntries/BulkActions/BulkActions.styled.js.map +1 -0
- package/admin/components/ContentEntries/BulkActions/index.d.ts +5 -0
- package/admin/components/ContentEntries/BulkActions/index.js +53 -0
- package/admin/components/ContentEntries/BulkActions/index.js.map +1 -0
- package/admin/components/ContentEntries/Empty/index.js +3 -1
- package/admin/components/ContentEntries/Empty/styled.js +3 -1
- package/admin/components/ContentEntries/Filters/FieldsMapper.d.ts +7 -0
- package/admin/components/ContentEntries/Filters/FieldsMapper.js +74 -0
- package/admin/components/ContentEntries/Filters/FieldsMapper.js.map +1 -0
- package/admin/components/ContentEntries/Filters/FilterByStatus.js +3 -1
- package/admin/components/ContentEntries/Filters/Filters.d.ts +1 -1
- package/admin/components/ContentEntries/Filters/Filters.js +36 -3
- package/admin/components/ContentEntries/Filters/Filters.js.map +1 -1
- package/admin/components/ContentEntries/Filters/index.js +3 -1
- package/admin/components/ContentEntries/Filters/styles.js +3 -1
- package/admin/components/ContentEntries/Header/ButtonFilters/ButtonFilters.js +3 -1
- package/admin/components/ContentEntries/Header/ButtonFilters/index.js +3 -1
- package/admin/components/ContentEntries/Header/ButtonsCreate/ButtonsCreate.js +3 -1
- package/admin/components/ContentEntries/Header/ButtonsCreate/index.js +3 -1
- package/admin/components/ContentEntries/Header/ButtonsCreate/styled.js +3 -1
- package/admin/components/ContentEntries/Header/Header.js +3 -1
- package/admin/components/ContentEntries/Header/Title/Title.js +3 -1
- package/admin/components/ContentEntries/Header/Title/index.js +3 -1
- package/admin/components/ContentEntries/Header/Title/styled.js +3 -1
- package/admin/components/ContentEntries/Header/index.js +3 -1
- package/admin/components/ContentEntries/Header/styled.js +3 -1
- package/admin/components/ContentEntries/LoadMoreButton/LoadMoreButton.js +3 -1
- package/admin/components/ContentEntries/LoadMoreButton/index.js +3 -1
- package/admin/components/ContentEntries/LoadMoreButton/styled.js +3 -1
- package/admin/components/ContentEntries/LoadingMore/index.js +3 -1
- package/admin/components/ContentEntries/LoadingMore/styled.js +3 -1
- package/admin/components/ContentEntries/Table/Row/Folder/FolderActionDelete.js +3 -1
- package/admin/components/ContentEntries/Table/Row/Folder/FolderActionEdit.js +3 -1
- package/admin/components/ContentEntries/Table/Row/Folder/FolderActionManagePermissions.d.ts +6 -0
- package/admin/components/ContentEntries/Table/Row/Folder/FolderActionManagePermissions.js +27 -0
- package/admin/components/ContentEntries/Table/Row/Folder/FolderActionManagePermissions.js.map +1 -0
- package/admin/components/ContentEntries/Table/Row/Name.js +12 -2
- package/admin/components/ContentEntries/Table/Row/Name.js.map +1 -1
- package/admin/components/ContentEntries/Table/Row/Record/RecordActionDelete.js +3 -1
- package/admin/components/ContentEntries/Table/Row/Record/RecordActionEdit.js +3 -1
- package/admin/components/ContentEntries/Table/Row/Record/RecordActionMove.js +3 -1
- package/admin/components/ContentEntries/Table/Row/Record/RecordActionPublish.js +3 -1
- package/admin/components/ContentEntries/Table/index.d.ts +8 -6
- package/admin/components/ContentEntries/Table/index.js +50 -18
- package/admin/components/ContentEntries/Table/index.js.map +1 -1
- package/admin/components/ContentEntries/Table/styled.js +3 -1
- package/admin/components/ContentEntries/Table/types.d.ts +1 -0
- package/admin/components/ContentEntries/Table/types.js +3 -1
- package/admin/components/ContentEntries/Table/types.js.map +1 -1
- package/admin/components/ContentEntryForm/ContentEntryForm.js +3 -1
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js +3 -1
- package/admin/components/ContentEntryForm/Fields.js +3 -1
- package/admin/components/ContentEntryForm/Header/ContentFormOptionsMenu/ContentFormOptionsMenu.js +3 -1
- package/admin/components/ContentEntryForm/Header/ContentFormOptionsMenu/ContentFormOptionsMenu.styles.js +3 -1
- package/admin/components/ContentEntryForm/Header/ContentFormOptionsMenu/index.js +3 -1
- package/admin/components/ContentEntryForm/Header/DeleteEntry/DeleteEntry.js +3 -1
- package/admin/components/ContentEntryForm/Header/DeleteEntry/index.js +3 -1
- package/admin/components/ContentEntryForm/Header/DeleteEntry/useDeleteEntry.js +3 -1
- package/admin/components/ContentEntryForm/Header/Header.js +3 -1
- package/admin/components/ContentEntryForm/Header/RevisionSelector/RevisionSelector.js +3 -1
- package/admin/components/ContentEntryForm/Header/RevisionSelector/RevisionSelector.styles.d.ts +4 -1
- package/admin/components/ContentEntryForm/Header/RevisionSelector/RevisionSelector.styles.js +3 -1
- package/admin/components/ContentEntryForm/Header/RevisionSelector/index.js +3 -1
- package/admin/components/ContentEntryForm/Header/SaveAndPublishContent/SaveAndPublishContent.js +3 -1
- package/admin/components/ContentEntryForm/Header/SaveAndPublishContent/index.js +3 -1
- package/admin/components/ContentEntryForm/Header/SaveAndPublishContent/useSaveAndPublish.js +3 -1
- package/admin/components/ContentEntryForm/Header/SaveContent/SaveContent.js +9 -2
- package/admin/components/ContentEntryForm/Header/SaveContent/SaveContent.js.map +1 -1
- package/admin/components/ContentEntryForm/Header/SaveContent/index.js +3 -1
- package/admin/components/ContentEntryForm/Header/index.js +3 -1
- package/admin/components/ContentEntryForm/Label.js +3 -1
- package/admin/components/ContentEntryForm/RenderFieldElement.js +3 -1
- package/admin/components/ContentEntryForm/functions/getValue.js +3 -1
- package/admin/components/ContentEntryForm/functions/setValue.js +3 -1
- package/admin/components/ContentEntryForm/useBind.js +4 -2
- package/admin/components/ContentEntryForm/useBind.js.map +1 -1
- package/admin/components/ContentEntryForm/useContentEntryForm.js +23 -13
- package/admin/components/ContentEntryForm/useContentEntryForm.js.map +1 -1
- package/admin/components/ContentEntryForm/useRenderPlugins.js +3 -1
- package/admin/components/ContentModelEditor/ContentModelEditorProvider.js +3 -1
- package/admin/components/ContentModelEditor/Editor.js +3 -1
- package/admin/components/ContentModelEditor/FieldsSidebar.js +3 -1
- package/admin/components/ContentModelEditor/Header.js +3 -1
- package/admin/components/ContentModelEditor/PreviewTab.js +3 -1
- package/admin/components/ContentModelEditor/index.js +3 -1
- package/admin/components/ContentModelEditor/useModelEditor.js +3 -1
- package/admin/components/DelayedOnChange.js +3 -1
- package/admin/components/Dialog.js +3 -1
- package/admin/components/DragPreview.js +3 -1
- package/admin/components/Draggable.js +3 -1
- package/admin/components/DropZone/Center.js +3 -1
- package/admin/components/DropZone/Horizontal.js +3 -1
- package/admin/components/DropZone/Vertical.js +3 -1
- package/admin/components/DropZone/index.js +3 -1
- package/admin/components/Droppable.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/ValidationsSection.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsList.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog/getValidators.js +3 -1
- package/admin/components/FieldEditor/EditFieldDialog.js +3 -1
- package/admin/components/FieldEditor/Field.js +3 -1
- package/admin/components/FieldEditor/FieldEditor.js +3 -1
- package/admin/components/FieldEditor/FieldEditorContext.js +3 -1
- package/admin/components/FieldEditor/Styled.js +3 -1
- package/admin/components/FieldEditor/index.js +3 -1
- package/admin/components/FieldEditor/useModelFieldEditor.js +3 -1
- package/admin/components/FieldEditor/utils/deleteField.js +3 -1
- package/admin/components/FieldEditor/utils/getFieldPosition.js +3 -1
- package/admin/components/FieldEditor/utils/index.js +3 -1
- package/admin/components/FieldEditor/utils/moveField.js +3 -1
- package/admin/components/FieldEditor/utils/moveRow.js +3 -1
- package/admin/components/IconPicker.js +3 -1
- package/admin/components/LexicalCmsEditor/LexicalCmsEditor.js +3 -1
- package/admin/components/LexicalCmsEditor/LexicalEditorCmsPlugin.js +3 -1
- package/admin/components/LexicalCmsEditor/TypographyDropDown.js +39 -28
- package/admin/components/LexicalCmsEditor/TypographyDropDown.js.map +1 -1
- package/admin/components/ModelFieldProvider/ModelFieldContext.js +3 -1
- package/admin/components/ModelFieldProvider/index.js +3 -1
- package/admin/components/ModelFieldProvider/useModelField.js +3 -1
- package/admin/components/ModelProvider/ModelContext.js +3 -1
- package/admin/components/ModelProvider/index.js +3 -1
- package/admin/components/ModelProvider/useModel.js +3 -1
- package/admin/config/contentEntries/editor/Actions/BaseAction.js +3 -1
- package/admin/config/contentEntries/editor/Actions/ButtonAction.js +3 -1
- package/admin/config/contentEntries/editor/Actions/MenuItemAction.js +3 -1
- package/admin/config/contentEntries/editor/Actions/index.js +3 -1
- package/admin/config/contentEntries/editor/ContentEntryEditorConfig.js +3 -1
- package/admin/config/contentEntries/editor/index.js +3 -1
- package/admin/config/contentEntries/index.js +3 -1
- package/admin/config/contentEntries/list/Browser/BulkAction.d.ts +27 -0
- package/admin/config/contentEntries/list/Browser/BulkAction.js +103 -0
- package/admin/config/contentEntries/list/Browser/BulkAction.js.map +1 -0
- package/admin/config/contentEntries/list/Browser/Filter.js +3 -1
- package/admin/config/contentEntries/list/Browser/FiltersToWhere.js +3 -1
- package/admin/config/contentEntries/list/Browser/index.d.ts +13 -0
- package/admin/config/contentEntries/list/Browser/index.js +5 -1
- package/admin/config/contentEntries/list/Browser/index.js.map +1 -1
- package/admin/config/contentEntries/list/ContentEntryListConfig.d.ts +12 -0
- package/admin/config/contentEntries/list/ContentEntryListConfig.js +4 -1
- package/admin/config/contentEntries/list/ContentEntryListConfig.js.map +1 -1
- package/admin/config/contentEntries/list/index.js +3 -1
- package/admin/constants/folders.js +3 -1
- package/admin/constants/statusLabels.js +3 -1
- package/admin/constants.js +3 -1
- package/admin/contexts/Cms/NetworkError.js +3 -1
- package/admin/contexts/Cms/index.d.ts +26 -3
- package/admin/contexts/Cms/index.js +40 -5
- package/admin/contexts/Cms/index.js.map +1 -1
- package/admin/elements/ContentGroupMenuElement.js +3 -1
- package/admin/elements/ContentModelMenuElement.js +3 -1
- package/admin/elements/NothingToShowElement.js +3 -1
- package/admin/graphql/contentModels.js +3 -1
- package/admin/hooks/index.js +3 -1
- package/admin/hooks/useApolloClient.js +3 -1
- package/admin/hooks/useCms.js +3 -1
- package/admin/hooks/useContentModels.js +3 -1
- package/admin/hooks/useLazyQuery.js +3 -1
- package/admin/hooks/useModelFieldGraphqlContext.js +3 -1
- package/admin/hooks/useMutation.js +3 -1
- package/admin/hooks/usePermission.js +3 -1
- package/admin/hooks/useQuery.js +3 -1
- package/admin/hooks/useQueryLocale.js +3 -1
- package/admin/lexicalConfig/LexicalEditorConfig.js +3 -1
- package/admin/menus/CmsMenuLoader.js +29 -9
- package/admin/menus/CmsMenuLoader.js.map +1 -1
- package/admin/menus/ContentGroupsMenuItems.js +3 -1
- package/admin/menus/GlobalSearchPlugins.js +3 -1
- package/admin/menus/NothingToShowElement.js +3 -1
- package/admin/plugins/apiInformation/index.js +3 -1
- package/admin/plugins/arrayUtils.js +3 -1
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js +3 -1
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js +3 -1
- package/admin/plugins/editor/defaultBar/BackButton.js +3 -1
- package/admin/plugins/editor/defaultBar/CreateContentButton.js +3 -1
- package/admin/plugins/editor/defaultBar/Divider.js +3 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js +3 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.js +3 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.js +3 -1
- package/admin/plugins/editor/defaultBar/FormSettings/index.js +3 -1
- package/admin/plugins/editor/defaultBar/Name/Name.js +3 -1
- package/admin/plugins/editor/defaultBar/Name/NameStyled.js +3 -1
- package/admin/plugins/editor/defaultBar/Name/index.js +3 -1
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.js +3 -1
- package/admin/plugins/editor/defaultBar/index.js +3 -1
- package/admin/plugins/editor/formSettings/components/GeneralSettings.js +3 -1
- package/admin/plugins/editor/formSettings/components/GroupSelect.js +3 -1
- package/admin/plugins/editor/formSettings/index.js +3 -1
- package/admin/plugins/entry/DefaultOnEntryDelete.js +3 -1
- package/admin/plugins/entry/DefaultOnEntryPublish.js +3 -1
- package/admin/plugins/entry/DefaultOnEntryUnpublish.d.ts +2 -0
- package/admin/plugins/entry/DefaultOnEntryUnpublish.js +127 -0
- package/admin/plugins/entry/DefaultOnEntryUnpublish.js.map +1 -0
- package/admin/plugins/fieldRenderers/Accordion.js +3 -1
- package/admin/plugins/fieldRenderers/DynamicSection.js +3 -1
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.js +3 -1
- package/admin/plugins/fieldRenderers/boolean/index.js +3 -1
- package/admin/plugins/fieldRenderers/checkboxes.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/Input.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/Select.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/Time.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/index.js +3 -1
- package/admin/plugins/fieldRenderers/dateTime/utils.js +3 -1
- package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js +3 -1
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js +3 -1
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js +3 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.js +3 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js +3 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js +3 -1
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js +9 -1
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js.map +1 -1
- package/admin/plugins/fieldRenderers/file/File.js +3 -1
- package/admin/plugins/fieldRenderers/file/fileField.js +3 -1
- package/admin/plugins/fieldRenderers/file/fileFields.js +3 -1
- package/admin/plugins/fieldRenderers/file/index.js +3 -1
- package/admin/plugins/fieldRenderers/file/utils.js +3 -1
- package/admin/plugins/fieldRenderers/lexicalText/index.js +3 -1
- package/admin/plugins/fieldRenderers/lexicalText/lexicalTextInput.js +3 -1
- package/admin/plugins/fieldRenderers/lexicalText/lexicalTextInputs.js +3 -1
- package/admin/plugins/fieldRenderers/lexicalText/utils.js +3 -1
- package/admin/plugins/fieldRenderers/longText/index.js +3 -1
- package/admin/plugins/fieldRenderers/longText/longText.js +3 -1
- package/admin/plugins/fieldRenderers/longText/longTexts.js +3 -1
- package/admin/plugins/fieldRenderers/number/index.js +3 -1
- package/admin/plugins/fieldRenderers/number/numberInput.js +3 -1
- package/admin/plugins/fieldRenderers/number/numberInputs.js +3 -1
- package/admin/plugins/fieldRenderers/object/FieldSettings.d.ts +42 -0
- package/admin/plugins/fieldRenderers/object/FieldSettings.js +68 -0
- package/admin/plugins/fieldRenderers/object/FieldSettings.js.map +1 -0
- package/admin/plugins/fieldRenderers/object/StyledComponents.js +3 -1
- package/admin/plugins/fieldRenderers/object/index.js +3 -1
- package/admin/plugins/fieldRenderers/object/multipleObjects.d.ts +2 -2
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +12 -3
- package/admin/plugins/fieldRenderers/object/multipleObjects.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.d.ts +2 -2
- package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.js +12 -3
- package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/singleObjectAccordion.d.ts +2 -2
- package/admin/plugins/fieldRenderers/object/singleObjectAccordion.js +10 -2
- package/admin/plugins/fieldRenderers/object/singleObjectAccordion.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/singleObjectInline.d.ts +2 -2
- package/admin/plugins/fieldRenderers/object/singleObjectInline.js +12 -4
- package/admin/plugins/fieldRenderers/object/singleObjectInline.js.map +1 -1
- package/admin/plugins/fieldRenderers/radioButtons.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.js +19 -8
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.js +11 -2
- package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entries.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/Entry.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/Loader.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/Options.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/ReferencesDialog.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/Search.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Box.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/CreatedBy.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Description.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Image.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModelName.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/ModifiedBy.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveDown.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/MoveUp.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Remove.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Select.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Status.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/Title.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/View.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/elements/ButtonLink.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelList.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelListItem.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferenceRenderer.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/detailedReferencesRenderer.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/graphql.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useEntries.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/hooks/useReferences.js +3 -1
- package/admin/plugins/fieldRenderers/ref/advanced/index.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/EntryStatus.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/MissingEntryHelpText.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/NewEntryButton.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/NewReferencedEntryDialog.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/dialog/Dialog.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/dialog/DialogHeader.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/graphql.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/helpers.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/renderItem.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/types.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/useReference.js +3 -1
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js +3 -1
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js +3 -1
- package/admin/plugins/fieldRenderers/ref/index.js +3 -1
- package/admin/plugins/fieldRenderers/ref/refInput.js +3 -1
- package/admin/plugins/fieldRenderers/ref/refInputs.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/components/SimpleItems.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/components/SimpleMultipleRenderer.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/components/SimpleSingleRenderer.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/components/useContentModels.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/components/useReferences.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/index.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/simpleMultipleRenderer.js +3 -1
- package/admin/plugins/fieldRenderers/ref/simple/simpleSingleRenderer.js +3 -1
- package/admin/plugins/fieldRenderers/richText/index.js +3 -1
- package/admin/plugins/fieldRenderers/richText/richTextInput.js +3 -1
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js +3 -1
- package/admin/plugins/fieldRenderers/richText/utils.js +3 -1
- package/admin/plugins/fieldRenderers/select.js +3 -1
- package/admin/plugins/fieldRenderers/text/index.js +3 -1
- package/admin/plugins/fieldRenderers/text/textInput.js +3 -1
- package/admin/plugins/fieldRenderers/text/textInputs.js +3 -1
- package/admin/plugins/fieldValidators/date/availableValidators.js +3 -1
- package/admin/plugins/fieldValidators/date/createDateInputField.js +3 -1
- package/admin/plugins/fieldValidators/dateGte.js +3 -1
- package/admin/plugins/fieldValidators/dateLte.js +3 -1
- package/admin/plugins/fieldValidators/dynamicZone.js +3 -1
- package/admin/plugins/fieldValidators/gte.js +3 -1
- package/admin/plugins/fieldValidators/in.js +3 -1
- package/admin/plugins/fieldValidators/lte.js +3 -1
- package/admin/plugins/fieldValidators/maxLength.js +3 -1
- package/admin/plugins/fieldValidators/minLength.js +3 -1
- package/admin/plugins/fieldValidators/pattern.js +3 -1
- package/admin/plugins/fieldValidators/patternPlugins/email.js +3 -1
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js +3 -1
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js +3 -1
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.js +3 -1
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js +3 -1
- package/admin/plugins/fieldValidators/patternPlugins/url.js +3 -1
- package/admin/plugins/fieldValidators/required.js +3 -1
- package/admin/plugins/fieldValidators/unique.js +3 -1
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js +3 -1
- package/admin/plugins/fields/boolean.js +3 -1
- package/admin/plugins/fields/dateTime.js +3 -1
- package/admin/plugins/fields/dynamicZone/AddTemplate.js +3 -1
- package/admin/plugins/fields/dynamicZone/DynamicZone.js +3 -1
- package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.js +3 -1
- package/admin/plugins/fields/dynamicZone/TemplateDialog.js +3 -1
- package/admin/plugins/fields/dynamicZone/commonValidators.js +3 -1
- package/admin/plugins/fields/dynamicZone.js +14 -9
- package/admin/plugins/fields/dynamicZone.js.map +1 -1
- package/admin/plugins/fields/file.js +3 -1
- package/admin/plugins/fields/longText.js +3 -1
- package/admin/plugins/fields/number.js +3 -1
- package/admin/plugins/fields/object/ObjectFields.js +3 -1
- package/admin/plugins/fields/object.js +11 -8
- package/admin/plugins/fields/object.js.map +1 -1
- package/admin/plugins/fields/ref/graphql.js +3 -1
- package/admin/plugins/fields/ref/renderInfo.js +3 -1
- package/admin/plugins/fields/ref.js +3 -1
- package/admin/plugins/fields/richText.js +3 -1
- package/admin/plugins/fields/text.js +3 -1
- package/admin/plugins/getObjectId.js +3 -1
- package/admin/plugins/icons.js +3 -1
- package/admin/plugins/index.d.ts +2 -2
- package/admin/plugins/index.js +3 -1
- package/admin/plugins/install.js +17 -21
- package/admin/plugins/install.js.map +1 -1
- package/admin/plugins/permissionRenderer/CmsPermissions.js +3 -1
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js +3 -1
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.js +3 -1
- package/admin/plugins/permissionRenderer/components/ContentModelList.js +3 -1
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.js +3 -1
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.js +3 -1
- package/admin/plugins/permissionRenderer/components/PermissionSelector.js +3 -1
- package/admin/plugins/permissionRenderer/components/StyledComponents.js +3 -1
- package/admin/plugins/permissionRenderer/components/types.js +3 -1
- package/admin/plugins/permissionRenderer/components/useCmsData.js +3 -1
- package/admin/plugins/permissionRenderer/index.js +3 -1
- package/admin/plugins/routes.js +3 -1
- package/admin/plugins/routes.js.map +1 -1
- package/admin/plugins/transformers/dateTransformer.js +3 -2
- package/admin/plugins/transformers/dateTransformer.js.map +1 -1
- package/admin/plugins/transformers/dynamicZoneTransformer.js +6 -5
- package/admin/plugins/transformers/dynamicZoneTransformer.js.map +1 -1
- package/admin/plugins/transformers/index.js +5 -2
- package/admin/plugins/transformers/index.js.map +1 -1
- package/admin/plugins/transformers/numberTransformer.js +11 -2
- package/admin/plugins/transformers/numberTransformer.js.map +1 -1
- package/admin/plugins/transformers/objectTransformer.d.ts +2 -0
- package/admin/plugins/transformers/objectTransformer.js +25 -0
- package/admin/plugins/transformers/objectTransformer.js.map +1 -0
- package/admin/plugins/welcomeScreenWidget.js +3 -1
- package/admin/views/contentEntries/ContentEntries.js +3 -1
- package/admin/views/contentEntries/ContentEntriesContainer.js +3 -1
- package/admin/views/contentEntries/ContentEntriesContext.js +3 -1
- package/admin/views/contentEntries/ContentEntriesModule.js +16 -1
- package/admin/views/contentEntries/ContentEntriesModule.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.d.ts +2 -1
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +3 -1
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/PublishEntryRevisionListItem.js +3 -1
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js +4 -2
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/RevisionsList.js +3 -1
- package/admin/views/contentEntries/ContentEntry/useRevision.js +3 -1
- package/admin/views/contentEntries/ContentEntry.js +3 -1
- package/admin/views/contentEntries/Table/Main.js +8 -3
- package/admin/views/contentEntries/Table/Main.js.map +1 -1
- package/admin/views/contentEntries/Table/Sidebar.js +3 -1
- package/admin/views/contentEntries/Table/index.js +5 -2
- package/admin/views/contentEntries/Table/index.js.map +1 -1
- package/admin/views/contentEntries/Table/styled.js +3 -1
- package/admin/views/contentEntries/hooks/index.js +3 -1
- package/admin/views/contentEntries/hooks/useContentEntries.js +3 -1
- package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +13 -2
- package/admin/views/contentEntries/hooks/useContentEntriesList.js +37 -8
- package/admin/views/contentEntries/hooks/useContentEntriesList.js.map +1 -1
- package/admin/views/contentEntries/hooks/useContentEntry.js +3 -1
- package/admin/views/contentEntries/hooks/useMoveContentEntryToFolder.js +3 -1
- package/admin/views/contentModelGroups/ContentModelGroups.js +3 -1
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js +3 -1
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js +3 -1
- package/admin/views/contentModelGroups/graphql.js +3 -1
- package/admin/views/contentModels/CloneContentModelDialog.js +3 -1
- package/admin/views/contentModels/ContentModelEditor.js +3 -1
- package/admin/views/contentModels/ContentModels.js +19 -3
- package/admin/views/contentModels/ContentModels.js.map +1 -1
- package/admin/views/contentModels/ContentModelsDataList.d.ts +1 -0
- package/admin/views/contentModels/ContentModelsDataList.js +46 -13
- package/admin/views/contentModels/ContentModelsDataList.js.map +1 -1
- package/admin/views/contentModels/NewContentModelDialog.js +3 -1
- package/admin/views/contentModels/OptionsMenu.d.ts +13 -0
- package/admin/views/contentModels/OptionsMenu.js +50 -0
- package/admin/views/contentModels/OptionsMenu.js.map +1 -0
- package/admin/views/contentModels/cache.js +3 -1
- package/admin/views/contentModels/exporting/download.d.ts +7 -0
- package/admin/views/contentModels/exporting/download.js +32 -0
- package/admin/views/contentModels/exporting/download.js.map +1 -0
- package/admin/views/contentModels/exporting/graphql.d.ts +1 -0
- package/admin/views/contentModels/exporting/graphql.js +14 -0
- package/admin/views/contentModels/exporting/graphql.js.map +1 -0
- package/admin/views/contentModels/exporting/runExport.d.ts +16 -0
- package/admin/views/contentModels/exporting/runExport.js +95 -0
- package/admin/views/contentModels/exporting/runExport.js.map +1 -0
- package/admin/views/contentModels/exporting/useModelExport.d.ts +5 -0
- package/admin/views/contentModels/exporting/useModelExport.js +65 -0
- package/admin/views/contentModels/exporting/useModelExport.js.map +1 -0
- package/admin/views/contentModels/helpers/apiNameValidator.js +3 -1
- package/admin/views/contentModels/helpers/nameValidator.js +3 -1
- package/admin/views/contentModels/importing/ImportContentModelsDialog.d.ts +5 -0
- package/admin/views/contentModels/importing/ImportContentModelsDialog.js +55 -0
- package/admin/views/contentModels/importing/ImportContentModelsDialog.js.map +1 -0
- package/admin/views/contentModels/importing/ImportContext.d.ts +58 -0
- package/admin/views/contentModels/importing/ImportContext.js +495 -0
- package/admin/views/contentModels/importing/ImportContext.js.map +1 -0
- package/admin/views/contentModels/importing/components/DataList.d.ts +2 -0
- package/admin/views/contentModels/importing/components/DataList.js +36 -0
- package/admin/views/contentModels/importing/components/DataList.js.map +1 -0
- package/admin/views/contentModels/importing/components/DataListGroup.d.ts +8 -0
- package/admin/views/contentModels/importing/components/DataListGroup.js +42 -0
- package/admin/views/contentModels/importing/components/DataListGroup.js.map +1 -0
- package/admin/views/contentModels/importing/components/Errors.d.ts +8 -0
- package/admin/views/contentModels/importing/components/Errors.js +50 -0
- package/admin/views/contentModels/importing/components/Errors.js.map +1 -0
- package/admin/views/contentModels/importing/components/FileUpload.d.ts +2 -0
- package/admin/views/contentModels/importing/components/FileUpload.js +75 -0
- package/admin/views/contentModels/importing/components/FileUpload.js.map +1 -0
- package/admin/views/contentModels/importing/components/ImportButton.d.ts +8 -0
- package/admin/views/contentModels/importing/components/ImportButton.js +26 -0
- package/admin/views/contentModels/importing/components/ImportButton.js.map +1 -0
- package/admin/views/contentModels/importing/components/Model/DataListInstructions.d.ts +2 -0
- package/admin/views/contentModels/importing/components/Model/DataListInstructions.js +24 -0
- package/admin/views/contentModels/importing/components/Model/DataListInstructions.js.map +1 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItem.d.ts +10 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItem.js +160 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItem.js.map +1 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItemError.d.ts +7 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItemError.js +75 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItemError.js.map +1 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItemInfo.d.ts +7 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItemInfo.js +37 -0
- package/admin/views/contentModels/importing/components/Model/DataListModelItemInfo.js.map +1 -0
- package/admin/views/contentModels/importing/components/Model/DataListModels.d.ts +7 -0
- package/admin/views/contentModels/importing/components/Model/DataListModels.js +37 -0
- package/admin/views/contentModels/importing/components/Model/DataListModels.js.map +1 -0
- package/admin/views/contentModels/importing/components/Model/index.d.ts +1 -0
- package/admin/views/contentModels/importing/components/Model/index.js +18 -0
- package/admin/views/contentModels/importing/components/Model/index.js.map +1 -0
- package/admin/views/contentModels/importing/graphql.d.ts +46 -0
- package/admin/views/contentModels/importing/graphql.js +17 -0
- package/admin/views/contentModels/importing/graphql.js.map +1 -0
- package/admin/views/contentModels/importing/types.d.ts +50 -0
- package/admin/views/contentModels/importing/types.js +16 -0
- package/admin/views/contentModels/importing/types.js.map +1 -0
- package/admin/views/contentModels/importing/useImport.d.ts +1 -0
- package/admin/views/contentModels/importing/useImport.js +19 -0
- package/admin/views/contentModels/importing/useImport.js.map +1 -0
- package/admin/views/contentModels/types.js +3 -1
- package/admin/views/utils.js +3 -1
- package/admin/viewsGraphql.js +3 -1
- package/allPlugins.d.ts +2 -2
- package/allPlugins.js +3 -1
- package/index.d.ts +1 -0
- package/index.js +11 -1
- package/index.js.map +1 -1
- package/package.json +29 -24
- package/types.js +3 -1
- package/utils/CmsModelFieldValidatorConfigAdapter.js +3 -1
- package/utils/acoRecordTransform.js +5 -1
- package/utils/acoRecordTransform.js.map +1 -1
- package/utils/allowCmsLegacyRichTextInput.js +3 -1
- package/utils/createTypeName.js +3 -1
- package/utils/createValidators.js +8 -1
- package/utils/createValidators.js.map +1 -1
- package/utils/getFetchPolicy.js +3 -1
- package/utils/getModelTitleFieldId.js +3 -1
- package/admin/graphql/createFieldsList.d.ts +0 -7
- package/admin/graphql/createFieldsList.js +0 -33
- package/admin/graphql/createFieldsList.js.map +0 -1
- package/admin/views/contentEntries/ContentEntry/prepareFormData.d.ts +0 -2
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js +0 -115
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js.map +0 -1
|
@@ -36,7 +36,11 @@ var _filter24px = require("@webiny/app-admin/assets/icons/filter-24px.svg");
|
|
|
36
36
|
var _usePermission2 = _interopRequireDefault(require("../../hooks/usePermission"));
|
|
37
37
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
38
38
|
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
39
|
-
var
|
|
39
|
+
var _OptionsMenu = require("./OptionsMenu");
|
|
40
|
+
var _file_download = require("@webiny/app-admin/assets/icons/file_download.svg");
|
|
41
|
+
var _file_upload = require("@webiny/app-admin/assets/icons/file_upload.svg");
|
|
42
|
+
var _useModelExport2 = require("./exporting/useModelExport");
|
|
43
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
|
|
40
44
|
/**
|
|
41
45
|
* Package timeago-react does not have types.
|
|
42
46
|
*/
|
|
@@ -55,6 +59,10 @@ var SORTERS = [{
|
|
|
55
59
|
label: t(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["Name Z-A"]))),
|
|
56
60
|
sorters: "name_DESC"
|
|
57
61
|
}];
|
|
62
|
+
var DataListActionsWrapper = /*#__PURE__*/(0, _styled.default)("div", {
|
|
63
|
+
label: "DataListActionsWrapper",
|
|
64
|
+
target: "ey1m2qq0"
|
|
65
|
+
})("display:flex;justify-content:flex-end;align-items:center;");
|
|
58
66
|
var rightAlign = /*#__PURE__*/(0, _emotion.css)({
|
|
59
67
|
alignItems: "flex-end !important",
|
|
60
68
|
justifyContent: "center !important"
|
|
@@ -63,7 +71,7 @@ var listItemMinHeight = /*#__PURE__*/(0, _emotion.css)({
|
|
|
63
71
|
minHeight: "66px !important"
|
|
64
72
|
}, "label:listItemMinHeight;");
|
|
65
73
|
var Icon = /*#__PURE__*/(0, _styled.default)("div", {
|
|
66
|
-
target: "
|
|
74
|
+
target: "ey1m2qq1",
|
|
67
75
|
label: "Icon"
|
|
68
76
|
})({
|
|
69
77
|
width: "24px",
|
|
@@ -90,7 +98,8 @@ var DisplayIcon = function DisplayIcon(_ref) {
|
|
|
90
98
|
var ContentModelsDataList = function ContentModelsDataList(_ref2) {
|
|
91
99
|
var canCreate = _ref2.canCreate,
|
|
92
100
|
onCreate = _ref2.onCreate,
|
|
93
|
-
onClone = _ref2.onClone
|
|
101
|
+
onClone = _ref2.onClone,
|
|
102
|
+
showImportModelModal = _ref2.showImportModelModal;
|
|
94
103
|
var _useState = (0, _react.useState)(""),
|
|
95
104
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
96
105
|
filter = _useState2[0],
|
|
@@ -208,6 +217,9 @@ var ContentModelsDataList = function ContentModelsDataList(_ref2) {
|
|
|
208
217
|
}, [sort]);
|
|
209
218
|
var filteredData = filter === "" ? models : models.filter(filterData);
|
|
210
219
|
var contentModels = sortData(filteredData);
|
|
220
|
+
var _useModelExport = (0, _useModelExport2.useModelExport)(),
|
|
221
|
+
handleModelsExport = _useModelExport.handleModelsExport,
|
|
222
|
+
handleModelExport = _useModelExport.handleModelExport;
|
|
211
223
|
var onRefreshClick = (0, _react.useCallback)(function () {
|
|
212
224
|
refresh();
|
|
213
225
|
}, []);
|
|
@@ -215,12 +227,23 @@ var ContentModelsDataList = function ContentModelsDataList(_ref2) {
|
|
|
215
227
|
loading: loading,
|
|
216
228
|
data: contentModels,
|
|
217
229
|
title: t(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["Content Models"]))),
|
|
218
|
-
actions: canCreate ? /*#__PURE__*/_react.default.createElement(_Button.ButtonSecondary, {
|
|
230
|
+
actions: /*#__PURE__*/_react.default.createElement(DataListActionsWrapper, null, canCreate ? /*#__PURE__*/_react.default.createElement(_Button.ButtonSecondary, {
|
|
219
231
|
"data-testid": "new-record-button",
|
|
220
232
|
onClick: onCreate
|
|
221
233
|
}, /*#__PURE__*/_react.default.createElement(_Button.ButtonIcon, {
|
|
222
234
|
icon: /*#__PURE__*/_react.default.createElement(_add18px.ReactComponent, null)
|
|
223
|
-
}), " ", t(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["New Model"])))) : null,
|
|
235
|
+
}), " ", t(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["New Model"])))) : null, /*#__PURE__*/_react.default.createElement(_OptionsMenu.OptionsMenu, {
|
|
236
|
+
"data-testid": "pb-blocks-list-options-menu",
|
|
237
|
+
items: [{
|
|
238
|
+
label: "Export all models",
|
|
239
|
+
icon: /*#__PURE__*/_react.default.createElement(_file_download.ReactComponent, null),
|
|
240
|
+
onClick: handleModelsExport
|
|
241
|
+
}, {
|
|
242
|
+
label: "Import models",
|
|
243
|
+
icon: /*#__PURE__*/_react.default.createElement(_file_upload.ReactComponent, null),
|
|
244
|
+
onClick: showImportModelModal
|
|
245
|
+
}]
|
|
246
|
+
})),
|
|
224
247
|
search: /*#__PURE__*/_react.default.createElement(_SearchUI.default, {
|
|
225
248
|
value: filter,
|
|
226
249
|
onChange: setFilter,
|
|
@@ -251,7 +274,7 @@ var ContentModelsDataList = function ContentModelsDataList(_ref2) {
|
|
|
251
274
|
}) : "N/A"
|
|
252
275
|
}))), /*#__PURE__*/_react.default.createElement(UIL.ListItemMeta, {
|
|
253
276
|
className: rightAlign
|
|
254
|
-
}, /*#__PURE__*/_react.default.createElement(UIL.ListActions, null,
|
|
277
|
+
}, /*#__PURE__*/_react.default.createElement(UIL.ListActions, null, /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
255
278
|
content: t(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["{message}"])))({
|
|
256
279
|
message: message
|
|
257
280
|
}),
|
|
@@ -262,14 +285,22 @@ var ContentModelsDataList = function ContentModelsDataList(_ref2) {
|
|
|
262
285
|
label: t(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["View entries"]))),
|
|
263
286
|
onClick: viewContentEntries(contentModel),
|
|
264
287
|
disabled: disableViewContent
|
|
265
|
-
})),
|
|
266
|
-
content: t(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["
|
|
288
|
+
})), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
289
|
+
content: t(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["Export content model"]))),
|
|
290
|
+
placement: "top"
|
|
291
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.IconButton, {
|
|
292
|
+
"data-testid": "cms-export-content-model-button",
|
|
293
|
+
icon: /*#__PURE__*/_react.default.createElement(_file_download.ReactComponent, null),
|
|
294
|
+
label: t(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["Export content model"]))),
|
|
295
|
+
onClick: handleModelExport(contentModel)
|
|
296
|
+
})), canEdit(contentModel, "cms.contentModel") && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, contentModel.plugin ? /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
297
|
+
content: t(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["Content model is registered via a plugin."]))),
|
|
267
298
|
placement: "top"
|
|
268
299
|
}, /*#__PURE__*/_react.default.createElement(_icons.EditIcon, {
|
|
269
300
|
disabled: true,
|
|
270
301
|
"data-testid": "cms-edit-content-model-button"
|
|
271
302
|
})) : /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
272
|
-
content: t(
|
|
303
|
+
content: t(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["Edit content model"]))),
|
|
273
304
|
placement: "top"
|
|
274
305
|
}, /*#__PURE__*/_react.default.createElement(_icons.EditIcon, {
|
|
275
306
|
onClick: function onClick() {
|
|
@@ -282,18 +313,18 @@ var ContentModelsDataList = function ContentModelsDataList(_ref2) {
|
|
|
282
313
|
}, /*#__PURE__*/_react.default.createElement(_Button.IconButton, {
|
|
283
314
|
"data-testid": "cms-clone-content-model-button",
|
|
284
315
|
icon: /*#__PURE__*/_react.default.createElement(_clone.ReactComponent, null),
|
|
285
|
-
label: t(
|
|
316
|
+
label: t(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["Clone content model"]))),
|
|
286
317
|
onClick: function onClick() {
|
|
287
318
|
return onClone(contentModel);
|
|
288
319
|
}
|
|
289
320
|
}))), canDelete(contentModel, "cms.contentModel") && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, contentModel.plugin ? /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
290
|
-
content: t(
|
|
321
|
+
content: t(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["Content model is registered via a plugin."]))),
|
|
291
322
|
placement: "top"
|
|
292
323
|
}, /*#__PURE__*/_react.default.createElement(_icons.DeleteIcon, {
|
|
293
324
|
disabled: true,
|
|
294
325
|
"data-testid": "cms-delete-content-model-button"
|
|
295
326
|
})) : /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
296
|
-
content: t(
|
|
327
|
+
content: t(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["Delete content model"]))),
|
|
297
328
|
placement: "top"
|
|
298
329
|
}, /*#__PURE__*/_react.default.createElement(_icons.DeleteIcon, {
|
|
299
330
|
onClick: function onClick() {
|
|
@@ -305,4 +336,6 @@ var ContentModelsDataList = function ContentModelsDataList(_ref2) {
|
|
|
305
336
|
});
|
|
306
337
|
};
|
|
307
338
|
var _default = ContentModelsDataList;
|
|
308
|
-
exports.default = _default;
|
|
339
|
+
exports.default = _default;
|
|
340
|
+
|
|
341
|
+
//# sourceMappingURL=ContentModelsDataList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_timeagoReact","_interopRequireDefault","_emotion","_reactRouter","_icons","_view_list","_clone","_hooks","_useSnackbar2","UIL","_Button","_Tooltip","_i18n","_useConfirmationDialog","_cache","GQL","_add18px","_SearchUI","_utils","_orderBy","_Grid","_Select","_filter24px","_usePermission2","_styled","_reactFontawesome","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","_templateObject14","_templateObject15","_templateObject16","_templateObject17","_templateObject18","t","i18n","namespace","SORTERS","label","_taggedTemplateLiteral2","default","sorters","rightAlign","css","alignItems","justifyContent","listItemMinHeight","minHeight","Icon","styled","target","width","height","marginRight","flex","svg","color","maxWidth","maxHeight","DisplayIcon","_ref","model","icon","createElement","FontAwesomeIcon","split","ContentModelsDataList","_ref2","canCreate","onCreate","onClone","_useState","useState","_useState2","_slicedToArray2","filter","setFilter","_useState3","_useState4","sort","setSort","_useRouter","useRouter","history","client","useApolloClient","_useSnackbar","useSnackbar","showSnackbar","_useConfirmationDialo","useConfirmationDialog","dataTestId","showConfirmation","_useModels","useModels","models","loading","refresh","_usePermission","usePermission","canDelete","canEdit","filterData","useCallback","_ref3","name","toLowerCase","includes","sortData","list","_deserializeSorters","deserializeSorters","_deserializeSorters2","sortField","sortOrderBy","orderBy","deleteRecord","_ref4","_asyncToGenerator2","_regeneratorRuntime2","mark","_callee2","item","wrap","_callee2$","_context2","prev","next","_callee","_callee$","_context","mutate","mutation","DELETE_CONTENT_MODEL","variables","modelId","update","cache","_ref6","data","error","deleteContentModel","message","title","removeModelFromListCache","removeModelFromGroupCache","removeModelFromCache","stop","_x","apply","arguments","editRecord","contentModel","push","viewContentEntries","contentModelsDataListModalOverlay","useMemo","DataListModalOverlay","Grid","Cell","span","Select","value","onChange","description","map","_ref7","key","filteredData","contentModels","onRefreshClick","DataList","actions","ButtonSecondary","onClick","ButtonIcon","ReactComponent","search","inputPlaceholder","modalOverlay","modalOverlayAction","DataListModalOverlayAction","_ref8","_ref8$data","List","disableViewContent","fields","length","ListItem","className","ListItemText","ListItemTextSecondary","time","savedOn","datetime","ListItemMeta","ListActions","Fragment","Tooltip","content","placement","IconButton","disabled","plugin","EditIcon","DeleteIcon","_default","exports"],"sources":["ContentModelsDataList.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from \"react\";\n/**\n * Package timeago-react does not have types.\n */\n// @ts-ignore\nimport TimeAgo from \"timeago-react\";\nimport { css } from \"emotion\";\nimport { useRouter } from \"@webiny/react-router\";\nimport { DeleteIcon, EditIcon } from \"@webiny/ui/List/DataList/icons\";\nimport { ReactComponent as ViewListIcon } from \"../../icons/view_list.svg\";\nimport { ReactComponent as CloneIcon } from \"../../icons/clone.svg\";\nimport { useApolloClient, useModels } from \"../../hooks\";\nimport { useSnackbar } from \"@webiny/app-admin/hooks/useSnackbar\";\nimport * as UIL from \"@webiny/ui/List\";\nimport { ButtonIcon, ButtonSecondary, IconButton } from \"@webiny/ui/Button\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/useConfirmationDialog\";\nimport { removeModelFromCache, removeModelFromGroupCache, removeModelFromListCache } from \"./cache\";\nimport * as GQL from \"../../viewsGraphql\";\nimport {\n DeleteCmsModelMutationResponse,\n DeleteCmsModelMutationVariables\n} from \"../../viewsGraphql\";\nimport { ReactComponent as AddIcon } from \"@webiny/app-admin/assets/icons/add-18px.svg\";\nimport SearchUI from \"@webiny/app-admin/components/SearchUI\";\nimport { deserializeSorters } from \"../utils\";\nimport orderBy from \"lodash/orderBy\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { Select } from \"@webiny/ui/Select\";\nimport { ReactComponent as FilterIcon } from \"@webiny/app-admin/assets/icons/filter-24px.svg\";\nimport { CmsEditorContentModel, CmsModel } from \"~/types\";\nimport usePermission from \"~/admin/hooks/usePermission\";\nimport styled from \"@emotion/styled\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { IconProp } from \"@fortawesome/fontawesome-svg-core\";\n\nconst t = i18n.namespace(\"FormsApp.ContentModelsDataList\");\n\ninterface Sorter {\n label: string;\n sorters: string;\n}\n\nconst SORTERS: Sorter[] = [\n {\n label: t`Newest to oldest`,\n sorters: \"savedOn_DESC\"\n },\n {\n label: t`Oldest to newest`,\n sorters: \"savedOn_ASC\"\n },\n {\n label: t`Name A-Z`,\n sorters: \"name_ASC\"\n },\n {\n label: t`Name Z-A`,\n sorters: \"name_DESC\"\n }\n];\n\nconst rightAlign = css({\n alignItems: \"flex-end !important\",\n justifyContent: \"center !important\"\n});\n\nconst listItemMinHeight = css({\n minHeight: \"66px !important\"\n});\n\ninterface ContentModelsDataListProps {\n canCreate: boolean;\n onCreate: () => void;\n onClone: (contentModel: CmsEditorContentModel) => void;\n}\n\nconst Icon = styled(\"div\")({\n width: \"24px\",\n height: \"24px\",\n marginRight: \"15px\",\n flex: \"0 0 24px\",\n svg: {\n color: \"var(--mdc-theme-text-icon-on-light)\",\n width: \"100%\",\n height: \"auto\",\n maxWidth: 24,\n maxHeight: 24\n }\n});\n\ninterface IconProps {\n model: Pick<CmsModel, \"icon\">;\n}\n\nconst DisplayIcon: React.VFC<IconProps> = ({ model }) => {\n if (!model.icon) {\n return null;\n }\n return <FontAwesomeIcon icon={(model.icon || \"\").split(\"/\") as IconProp} />;\n};\n\nconst ContentModelsDataList: React.FC<ContentModelsDataListProps> = ({\n canCreate,\n onCreate,\n onClone\n}) => {\n const [filter, setFilter] = useState<string>(\"\");\n const [sort, setSort] = useState<string>(SORTERS[0].sorters);\n const { history } = useRouter();\n const client = useApolloClient();\n const { showSnackbar } = useSnackbar();\n const { showConfirmation } = useConfirmationDialog({\n dataTestId: \"cms-delete-content-model-dialog\"\n });\n const { models, loading, refresh } = useModels();\n const { canDelete, canEdit } = usePermission();\n\n const filterData = useCallback(\n ({ name }: Pick<CmsModel, \"name\">): boolean => {\n return name.toLowerCase().includes(filter);\n },\n [filter]\n );\n\n const sortData = useCallback(\n (list: CmsModel[]): CmsModel[] => {\n if (!sort) {\n return list;\n }\n const [sortField, sortOrderBy] = deserializeSorters(sort);\n return orderBy(list, [sortField], [sortOrderBy]);\n },\n [sort]\n );\n\n const deleteRecord = async (item: CmsModel): Promise<void> => {\n showConfirmation(async () => {\n await client.mutate<DeleteCmsModelMutationResponse, DeleteCmsModelMutationVariables>({\n mutation: GQL.DELETE_CONTENT_MODEL,\n variables: { modelId: item.modelId },\n update(cache, { data }) {\n if (!data) {\n showSnackbar(\"Missing data on Delete Content Model Mutation Response.\");\n return;\n }\n const { error } = data.deleteContentModel;\n\n if (error) {\n showSnackbar(error.message, {\n title: t`Something unexpected happened.`\n });\n return;\n }\n\n removeModelFromListCache(cache, item);\n removeModelFromGroupCache(cache, item);\n removeModelFromCache(client, item);\n\n showSnackbar(\n t`Content model {name} deleted successfully!.`({ name: item.name })\n );\n }\n });\n });\n };\n\n const editRecord = (contentModel: CmsModel): void => {\n history.push(\"/cms/content-models/\" + contentModel.modelId);\n };\n\n const viewContentEntries = useCallback(contentModel => {\n return () => history.push(\"/cms/content-entries/\" + contentModel.modelId);\n }, []);\n\n const contentModelsDataListModalOverlay = useMemo(\n () => (\n <UIL.DataListModalOverlay>\n <Grid>\n <Cell span={12}>\n <Select\n value={sort}\n onChange={setSort}\n label={t`Sort by`}\n description={\"Sort content models by\"}\n >\n {SORTERS.map(({ label, sorters }) => {\n return (\n <option key={label} value={sorters}>\n {label}\n </option>\n );\n })}\n </Select>\n </Cell>\n </Grid>\n </UIL.DataListModalOverlay>\n ),\n [sort]\n );\n\n const filteredData = filter === \"\" ? models : models.filter(filterData);\n const contentModels = sortData(filteredData);\n\n const onRefreshClick = useCallback(() => {\n refresh();\n }, []);\n\n return (\n <UIL.DataList\n loading={loading}\n data={contentModels}\n title={t`Content Models`}\n actions={\n canCreate ? (\n <ButtonSecondary data-testid=\"new-record-button\" onClick={onCreate}>\n <ButtonIcon icon={<AddIcon />} /> {t`New Model`}\n </ButtonSecondary>\n ) : null\n }\n search={\n <SearchUI\n value={filter}\n onChange={setFilter}\n inputPlaceholder={t`Search content models`}\n />\n }\n modalOverlay={contentModelsDataListModalOverlay}\n modalOverlayAction={\n <UIL.DataListModalOverlayAction\n icon={<FilterIcon />}\n data-testid={\"default-data-list.filter\"}\n />\n }\n refresh={onRefreshClick}\n >\n {({ data = [] }: { data: CmsModel[] }) => (\n <UIL.List data-testid=\"default-data-list\">\n {data.map(contentModel => {\n const disableViewContent = contentModel.fields.length === 0;\n const message = disableViewContent\n ? \"To view the content, you first need to add a field and save the model\"\n : \"View content\";\n return (\n <UIL.ListItem key={contentModel.modelId} className={listItemMinHeight}>\n <Icon>\n <DisplayIcon model={contentModel} />\n </Icon>\n <UIL.ListItemText>\n {contentModel.name}\n <UIL.ListItemTextSecondary>\n {t`Last modified: {time}.`({\n time: contentModel.savedOn ? (\n <TimeAgo datetime={contentModel.savedOn} />\n ) : (\n \"N/A\"\n )\n })}\n </UIL.ListItemTextSecondary>\n </UIL.ListItemText>\n <UIL.ListItemMeta className={rightAlign}>\n <UIL.ListActions>\n {canEdit(contentModel, \"cms.contentModel\") && (\n <>\n <Tooltip\n content={t`{message}`({ message })}\n placement={\"top\"}\n >\n <IconButton\n data-testid={\n \"cms-view-content-model-button\"\n }\n icon={<ViewListIcon />}\n label={t`View entries`}\n onClick={viewContentEntries(contentModel)}\n disabled={disableViewContent}\n />\n </Tooltip>\n {contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <EditIcon\n disabled\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Edit content model`}\n placement={\"top\"}\n >\n <EditIcon\n onClick={() => editRecord(contentModel)}\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n )}\n <Tooltip\n content={\"Clone content model\"}\n placement={\"top\"}\n >\n <IconButton\n data-testid={\n \"cms-clone-content-model-button\"\n }\n icon={<CloneIcon />}\n label={t`View entries`}\n onClick={() => onClone(contentModel)}\n />\n </Tooltip>\n </>\n )}\n\n {canDelete(contentModel, \"cms.contentModel\") && (\n <>\n {contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <DeleteIcon\n disabled\n data-testid={\n \"cms-delete-content-model-button\"\n }\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Delete content model`}\n placement={\"top\"}\n >\n <DeleteIcon\n onClick={() =>\n deleteRecord(contentModel)\n }\n data-testid={\n \"cms-delete-content-model-button\"\n }\n />\n </Tooltip>\n )}\n </>\n )}\n </UIL.ListActions>\n </UIL.ListItemMeta>\n </UIL.ListItem>\n );\n })}\n </UIL.List>\n )}\n </UIL.DataList>\n );\n};\n\nexport default ContentModelsDataList;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OA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6J,QAAA,QACK7C,YAAY,CAACmD,MAAM,gBAChBxN,MAAA,CAAAqD,OAAA,CAAAuB,aAAA,CAAC9D,QAAA,CAAAqM,OAAO;QACJC,OAAO,EAAErK,CAAC,CAAAF,iBAAA,KAAAA,iBAAA,OAAAO,uBAAA,CAAAC,OAAA,kDAA4C;QACtDgK,SAAS,EAAE;MAAM,gBAEjBrN,MAAA,CAAAqD,OAAA,CAAAuB,aAAA,CAACrE,MAAA,CAAAmN,UAAU;QACPH,QAAQ;QACR,eACI;MACH,CACJ,CACI,CAAC,gBAEVvN,MAAA,CAAAqD,OAAA,CAAAuB,aAAA,CAAC9D,QAAA,CAAAqM,OAAO;QACJC,OAAO,EAAErK,CAAC,CAAAD,iBAAA,KAAAA,iBAAA,OAAAM,uBAAA,CAAAC,OAAA,6BAAuB;QACjCgK,SAAS,EAAE;MAAM,gBAEjBrN,MAAA,CAAAqD,OAAA,CAAAuB,aAAA,CAACrE,MAAA,CAAAmN,UAAU;QACP/B,OAAO,EAAE,SAAAA,QAAA;UAAA,OACL1D,YAAY,CAACoC,YAAY,CAAC;QAAA,CAC7B;QACD,eACI;MACH,CACJ,CACI,CAEf,CAEO,CACH,CACR,CAAC;IAEvB,CAAC,CACK,CAAC;EAAA,CAEL,CAAC;AAEvB,CAAC;AAAC,IAAAsD,QAAA,GAEa5I,qBAAqB;AAAA6I,OAAA,CAAAvK,OAAA,GAAAsK,QAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_timeagoReact","_interopRequireDefault","_emotion","_reactRouter","_icons","_view_list","_clone","_hooks","_useSnackbar2","UIL","_Button","_Tooltip","_i18n","_useConfirmationDialog","_cache","GQL","_add18px","_SearchUI","_utils","_orderBy","_Grid","_Select","_filter24px","_usePermission2","_styled","_reactFontawesome","_OptionsMenu","_file_download","_file_upload","_useModelExport2","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","_templateObject14","_templateObject15","_templateObject16","_templateObject17","_templateObject18","_templateObject19","_templateObject20","t","i18n","namespace","SORTERS","label","_taggedTemplateLiteral2","default","sorters","DataListActionsWrapper","styled","target","rightAlign","css","alignItems","justifyContent","listItemMinHeight","minHeight","Icon","width","height","marginRight","flex","svg","color","maxWidth","maxHeight","DisplayIcon","_ref","model","icon","createElement","FontAwesomeIcon","split","ContentModelsDataList","_ref2","canCreate","onCreate","onClone","showImportModelModal","_useState","useState","_useState2","_slicedToArray2","filter","setFilter","_useState3","_useState4","sort","setSort","_useRouter","useRouter","history","client","useApolloClient","_useSnackbar","useSnackbar","showSnackbar","_useConfirmationDialo","useConfirmationDialog","dataTestId","showConfirmation","_useModels","useModels","models","loading","refresh","_usePermission","usePermission","canDelete","canEdit","filterData","useCallback","_ref3","name","toLowerCase","includes","sortData","list","_deserializeSorters","deserializeSorters","_deserializeSorters2","sortField","sortOrderBy","orderBy","deleteRecord","_ref4","_asyncToGenerator2","_regeneratorRuntime2","mark","_callee2","item","wrap","_callee2$","_context2","prev","next","_callee","_callee$","_context","mutate","mutation","DELETE_CONTENT_MODEL","variables","modelId","update","cache","_ref6","data","error","deleteContentModel","message","title","removeModelFromListCache","removeModelFromGroupCache","removeModelFromCache","stop","_x","apply","arguments","editRecord","contentModel","push","viewContentEntries","contentModelsDataListModalOverlay","useMemo","DataListModalOverlay","Grid","Cell","span","Select","value","onChange","description","map","_ref7","key","filteredData","contentModels","_useModelExport","useModelExport","handleModelsExport","handleModelExport","onRefreshClick","DataList","actions","ButtonSecondary","onClick","ButtonIcon","ReactComponent","OptionsMenu","items","search","inputPlaceholder","modalOverlay","modalOverlayAction","DataListModalOverlayAction","_ref8","_ref8$data","List","disableViewContent","fields","length","ListItem","className","ListItemText","ListItemTextSecondary","time","savedOn","datetime","ListItemMeta","ListActions","Tooltip","content","placement","IconButton","disabled","Fragment","plugin","EditIcon","DeleteIcon","_default","exports"],"sources":["ContentModelsDataList.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from \"react\";\n/**\n * Package timeago-react does not have types.\n */\n// @ts-ignore\nimport TimeAgo from \"timeago-react\";\nimport { css } from \"emotion\";\nimport { useRouter } from \"@webiny/react-router\";\nimport { DeleteIcon, EditIcon } from \"@webiny/ui/List/DataList/icons\";\nimport { ReactComponent as ViewListIcon } from \"../../icons/view_list.svg\";\nimport { ReactComponent as CloneIcon } from \"../../icons/clone.svg\";\nimport { useApolloClient, useModels } from \"../../hooks\";\nimport { useSnackbar } from \"@webiny/app-admin/hooks/useSnackbar\";\nimport * as UIL from \"@webiny/ui/List\";\nimport { ButtonIcon, ButtonSecondary, IconButton } from \"@webiny/ui/Button\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/useConfirmationDialog\";\nimport { removeModelFromCache, removeModelFromGroupCache, removeModelFromListCache } from \"./cache\";\nimport * as GQL from \"../../viewsGraphql\";\nimport {\n DeleteCmsModelMutationResponse,\n DeleteCmsModelMutationVariables\n} from \"../../viewsGraphql\";\nimport { ReactComponent as AddIcon } from \"@webiny/app-admin/assets/icons/add-18px.svg\";\nimport SearchUI from \"@webiny/app-admin/components/SearchUI\";\nimport { deserializeSorters } from \"../utils\";\nimport orderBy from \"lodash/orderBy\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { Select } from \"@webiny/ui/Select\";\nimport { ReactComponent as FilterIcon } from \"@webiny/app-admin/assets/icons/filter-24px.svg\";\nimport { CmsEditorContentModel, CmsModel } from \"~/types\";\nimport usePermission from \"~/admin/hooks/usePermission\";\nimport styled from \"@emotion/styled\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { IconProp } from \"@fortawesome/fontawesome-svg-core\";\nimport { OptionsMenu } from \"./OptionsMenu\";\nimport { ReactComponent as DownloadFileIcon } from \"@webiny/app-admin/assets/icons/file_download.svg\";\nimport { ReactComponent as UploadFileIcon } from \"@webiny/app-admin/assets/icons/file_upload.svg\";\nimport { useModelExport } from \"./exporting/useModelExport\";\n\nconst t = i18n.namespace(\"FormsApp.ContentModelsDataList\");\n\ninterface Sorter {\n label: string;\n sorters: string;\n}\n\nconst SORTERS: Sorter[] = [\n {\n label: t`Newest to oldest`,\n sorters: \"savedOn_DESC\"\n },\n {\n label: t`Oldest to newest`,\n sorters: \"savedOn_ASC\"\n },\n {\n label: t`Name A-Z`,\n sorters: \"name_ASC\"\n },\n {\n label: t`Name Z-A`,\n sorters: \"name_DESC\"\n }\n];\n\nconst DataListActionsWrapper = styled.div`\n display: flex;\n justify-content: flex-end;\n align-items: center;\n`;\n\nconst rightAlign = css({\n alignItems: \"flex-end !important\",\n justifyContent: \"center !important\"\n});\n\nconst listItemMinHeight = css({\n minHeight: \"66px !important\"\n});\n\ninterface ContentModelsDataListProps {\n canCreate: boolean;\n onCreate: () => void;\n onClone: (contentModel: CmsEditorContentModel) => void;\n showImportModelModal: () => void;\n}\n\nconst Icon = styled(\"div\")({\n width: \"24px\",\n height: \"24px\",\n marginRight: \"15px\",\n flex: \"0 0 24px\",\n svg: {\n color: \"var(--mdc-theme-text-icon-on-light)\",\n width: \"100%\",\n height: \"auto\",\n maxWidth: 24,\n maxHeight: 24\n }\n});\n\ninterface IconProps {\n model: Pick<CmsModel, \"icon\">;\n}\n\nconst DisplayIcon: React.VFC<IconProps> = ({ model }) => {\n if (!model.icon) {\n return null;\n }\n return <FontAwesomeIcon icon={(model.icon || \"\").split(\"/\") as IconProp} />;\n};\n\nconst ContentModelsDataList: React.FC<ContentModelsDataListProps> = ({\n canCreate,\n onCreate,\n onClone,\n showImportModelModal\n}) => {\n const [filter, setFilter] = useState<string>(\"\");\n const [sort, setSort] = useState<string>(SORTERS[0].sorters);\n const { history } = useRouter();\n const client = useApolloClient();\n const { showSnackbar } = useSnackbar();\n const { showConfirmation } = useConfirmationDialog({\n dataTestId: \"cms-delete-content-model-dialog\"\n });\n const { models, loading, refresh } = useModels();\n const { canDelete, canEdit } = usePermission();\n\n const filterData = useCallback(\n ({ name }: Pick<CmsModel, \"name\">): boolean => {\n return name.toLowerCase().includes(filter);\n },\n [filter]\n );\n\n const sortData = useCallback(\n (list: CmsModel[]): CmsModel[] => {\n if (!sort) {\n return list;\n }\n const [sortField, sortOrderBy] = deserializeSorters(sort);\n return orderBy(list, [sortField], [sortOrderBy]);\n },\n [sort]\n );\n\n const deleteRecord = async (item: CmsModel): Promise<void> => {\n showConfirmation(async () => {\n await client.mutate<DeleteCmsModelMutationResponse, DeleteCmsModelMutationVariables>({\n mutation: GQL.DELETE_CONTENT_MODEL,\n variables: { modelId: item.modelId },\n update(cache, { data }) {\n if (!data) {\n showSnackbar(\"Missing data on Delete Content Model Mutation Response.\");\n return;\n }\n const { error } = data.deleteContentModel;\n\n if (error) {\n showSnackbar(error.message, {\n title: t`Something unexpected happened.`\n });\n return;\n }\n\n removeModelFromListCache(cache, item);\n removeModelFromGroupCache(cache, item);\n removeModelFromCache(client, item);\n\n showSnackbar(\n t`Content model {name} deleted successfully!.`({ name: item.name })\n );\n }\n });\n });\n };\n\n const editRecord = (contentModel: CmsModel): void => {\n history.push(\"/cms/content-models/\" + contentModel.modelId);\n };\n\n const viewContentEntries = useCallback(contentModel => {\n return () => history.push(\"/cms/content-entries/\" + contentModel.modelId);\n }, []);\n\n const contentModelsDataListModalOverlay = useMemo(\n () => (\n <UIL.DataListModalOverlay>\n <Grid>\n <Cell span={12}>\n <Select\n value={sort}\n onChange={setSort}\n label={t`Sort by`}\n description={\"Sort content models by\"}\n >\n {SORTERS.map(({ label, sorters }) => {\n return (\n <option key={label} value={sorters}>\n {label}\n </option>\n );\n })}\n </Select>\n </Cell>\n </Grid>\n </UIL.DataListModalOverlay>\n ),\n [sort]\n );\n\n const filteredData = filter === \"\" ? models : models.filter(filterData);\n const contentModels = sortData(filteredData);\n\n const { handleModelsExport, handleModelExport } = useModelExport();\n\n const onRefreshClick = useCallback(() => {\n refresh();\n }, []);\n\n return (\n <UIL.DataList\n loading={loading}\n data={contentModels}\n title={t`Content Models`}\n actions={\n <DataListActionsWrapper>\n {canCreate ? (\n <ButtonSecondary data-testid=\"new-record-button\" onClick={onCreate}>\n <ButtonIcon icon={<AddIcon />} /> {t`New Model`}\n </ButtonSecondary>\n ) : null}\n <OptionsMenu\n data-testid=\"pb-blocks-list-options-menu\"\n items={[\n {\n label: \"Export all models\",\n icon: <DownloadFileIcon />,\n onClick: handleModelsExport\n },\n {\n label: \"Import models\",\n icon: <UploadFileIcon />,\n onClick: showImportModelModal\n }\n ]}\n />\n </DataListActionsWrapper>\n }\n search={\n <SearchUI\n value={filter}\n onChange={setFilter}\n inputPlaceholder={t`Search content models`}\n />\n }\n modalOverlay={contentModelsDataListModalOverlay}\n modalOverlayAction={\n <UIL.DataListModalOverlayAction\n icon={<FilterIcon />}\n data-testid={\"default-data-list.filter\"}\n />\n }\n refresh={onRefreshClick}\n >\n {({ data = [] }: { data: CmsModel[] }) => (\n <UIL.List data-testid=\"default-data-list\">\n {data.map(contentModel => {\n const disableViewContent = contentModel.fields.length === 0;\n const message = disableViewContent\n ? \"To view the content, you first need to add a field and save the model\"\n : \"View content\";\n return (\n <UIL.ListItem key={contentModel.modelId} className={listItemMinHeight}>\n <Icon>\n <DisplayIcon model={contentModel} />\n </Icon>\n <UIL.ListItemText>\n {contentModel.name}\n <UIL.ListItemTextSecondary>\n {t`Last modified: {time}.`({\n time: contentModel.savedOn ? (\n <TimeAgo datetime={contentModel.savedOn} />\n ) : (\n \"N/A\"\n )\n })}\n </UIL.ListItemTextSecondary>\n </UIL.ListItemText>\n <UIL.ListItemMeta className={rightAlign}>\n <UIL.ListActions>\n <Tooltip\n content={t`{message}`({ message })}\n placement={\"top\"}\n >\n <IconButton\n data-testid={\"cms-view-content-model-button\"}\n icon={<ViewListIcon />}\n label={t`View entries`}\n onClick={viewContentEntries(contentModel)}\n disabled={disableViewContent}\n />\n </Tooltip>\n <Tooltip\n content={t`Export content model`}\n placement={\"top\"}\n >\n <IconButton\n data-testid={\"cms-export-content-model-button\"}\n icon={<DownloadFileIcon />}\n label={t`Export content model`}\n onClick={handleModelExport(contentModel)}\n />\n </Tooltip>\n {canEdit(contentModel, \"cms.contentModel\") && (\n <>\n {contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <EditIcon\n disabled\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Edit content model`}\n placement={\"top\"}\n >\n <EditIcon\n onClick={() => editRecord(contentModel)}\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n )}\n <Tooltip\n content={\"Clone content model\"}\n placement={\"top\"}\n >\n <IconButton\n data-testid={\n \"cms-clone-content-model-button\"\n }\n icon={<CloneIcon />}\n label={t`Clone content model`}\n onClick={() => onClone(contentModel)}\n />\n </Tooltip>\n </>\n )}\n\n {canDelete(contentModel, \"cms.contentModel\") && (\n <>\n {contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <DeleteIcon\n disabled\n data-testid={\n \"cms-delete-content-model-button\"\n }\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Delete content model`}\n placement={\"top\"}\n >\n <DeleteIcon\n onClick={() =>\n deleteRecord(contentModel)\n }\n data-testid={\n \"cms-delete-content-model-button\"\n }\n />\n </Tooltip>\n )}\n </>\n )}\n </UIL.ListActions>\n </UIL.ListItemMeta>\n </UIL.ListItem>\n );\n })}\n </UIL.List>\n )}\n </UIL.DataList>\n );\n};\n\nexport default ContentModelsDataList;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MA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,OAAA,CAAA/K,OAAA,GAAA8K,QAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface OptionsMenuItem {
|
|
3
|
+
label: string;
|
|
4
|
+
icon: React.ReactElement;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
"data-testid"?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface OptionsMenuProps {
|
|
10
|
+
items: OptionsMenuItem[];
|
|
11
|
+
"data-testid"?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const OptionsMenu: import("@webiny/app-admin").ComposableFC<OptionsMenuProps>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.OptionsMenu = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _emotion = require("emotion");
|
|
11
|
+
var _appAdmin = require("@webiny/app-admin");
|
|
12
|
+
var _Menu = require("@webiny/ui/Menu");
|
|
13
|
+
var _Button = require("@webiny/ui/Button");
|
|
14
|
+
var _more_vert = require("@material-design-icons/svg/filled/more_vert.svg");
|
|
15
|
+
var _List = require("@webiny/ui/List");
|
|
16
|
+
var _Icon = require("@webiny/ui/Icon");
|
|
17
|
+
var _excluded = ["items"];
|
|
18
|
+
var menuStyles = /*#__PURE__*/(0, _emotion.css)({
|
|
19
|
+
".disabled": {
|
|
20
|
+
opacity: 0.5,
|
|
21
|
+
pointerEvents: "none"
|
|
22
|
+
}
|
|
23
|
+
}, "label:menuStyles;");
|
|
24
|
+
var OptionsMenu = (0, _appAdmin.makeComposable)("CmsModelsOptionsMenu", function (_ref) {
|
|
25
|
+
var items = _ref.items,
|
|
26
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
27
|
+
if (!items.length) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_Menu.Menu, Object.assign({
|
|
31
|
+
className: menuStyles,
|
|
32
|
+
handle: /*#__PURE__*/_react.default.createElement(_Button.IconButton, {
|
|
33
|
+
icon: /*#__PURE__*/_react.default.createElement(_more_vert.ReactComponent, null)
|
|
34
|
+
}),
|
|
35
|
+
anchor: "topLeft"
|
|
36
|
+
}, props), items.map(function (item) {
|
|
37
|
+
var _item$disabled;
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_Menu.MenuItem, {
|
|
39
|
+
key: item.label,
|
|
40
|
+
disabled: (_item$disabled = item.disabled) !== null && _item$disabled !== void 0 ? _item$disabled : false,
|
|
41
|
+
onClick: item.onClick,
|
|
42
|
+
"data-testid": item["data-testid"]
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_List.ListItemGraphic, null, /*#__PURE__*/_react.default.createElement(_Icon.Icon, {
|
|
44
|
+
icon: item.icon
|
|
45
|
+
})), item.label);
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
exports.OptionsMenu = OptionsMenu;
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=OptionsMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_emotion","_appAdmin","_Menu","_Button","_more_vert","_List","_Icon","_excluded","menuStyles","css","opacity","pointerEvents","OptionsMenu","makeComposable","_ref","items","props","_objectWithoutProperties2","default","length","createElement","Menu","Object","assign","className","handle","IconButton","icon","ReactComponent","anchor","map","item","_item$disabled","MenuItem","key","label","disabled","onClick","ListItemGraphic","Icon","exports"],"sources":["OptionsMenu.tsx"],"sourcesContent":["import React from \"react\";\nimport { css } from \"emotion\";\nimport { makeComposable } from \"@webiny/app-admin\";\nimport { Menu, MenuItem } from \"@webiny/ui/Menu\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport { ReactComponent as MoreVerticalIcon } from \"@material-design-icons/svg/filled/more_vert.svg\";\nimport { ListItemGraphic } from \"@webiny/ui/List\";\nimport { Icon } from \"@webiny/ui/Icon\";\n\nconst menuStyles = css({\n \".disabled\": {\n opacity: 0.5,\n pointerEvents: \"none\"\n }\n});\n\nexport interface OptionsMenuItem {\n label: string;\n icon: React.ReactElement;\n onClick: () => void;\n disabled?: boolean;\n \"data-testid\"?: string;\n}\n\nexport interface OptionsMenuProps {\n items: OptionsMenuItem[];\n \"data-testid\"?: string;\n}\n\nexport const OptionsMenu = makeComposable<OptionsMenuProps>(\n \"CmsModelsOptionsMenu\",\n ({ items, ...props }) => {\n if (!items.length) {\n return null;\n }\n\n return (\n <Menu\n className={menuStyles}\n handle={<IconButton icon={<MoreVerticalIcon />} />}\n anchor={\"topLeft\"}\n {...props}\n >\n {items.map(item => (\n <MenuItem\n key={item.label}\n disabled={item.disabled ?? false}\n onClick={item.onClick}\n data-testid={item[\"data-testid\"]}\n >\n <ListItemGraphic>\n <Icon icon={item.icon} />\n </ListItemGraphic>\n {item.label}\n </MenuItem>\n ))}\n </Menu>\n );\n }\n);\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAAuC,IAAAQ,SAAA;AAEvC,IAAMC,UAAU,gBAAG,IAAAC,YAAG,EAAC;EACnB,WAAW,EAAE;IACTC,OAAO,EAAE,GAAG;IACZC,aAAa,EAAE;EACnB;AACJ,CAAC,sBAAC;AAeK,IA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AAA5B,WAAA,GAAAA,WAAA"}
|
|
@@ -111,4 +111,6 @@ var removeModelFromGroupCache = function removeModelFromGroupCache(cache, model)
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
|
-
exports.removeModelFromGroupCache = removeModelFromGroupCache;
|
|
114
|
+
exports.removeModelFromGroupCache = removeModelFromGroupCache;
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.download = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var getName = function getName(models) {
|
|
10
|
+
if (models.length > 1) {
|
|
11
|
+
return "groups-and-models";
|
|
12
|
+
}
|
|
13
|
+
var _models = (0, _slicedToArray2.default)(models, 1),
|
|
14
|
+
model = _models[0];
|
|
15
|
+
return model.modelId.toLowerCase();
|
|
16
|
+
};
|
|
17
|
+
var download = function download(params) {
|
|
18
|
+
var models = params.models;
|
|
19
|
+
var element = document.createElement("a");
|
|
20
|
+
var data = new Blob([JSON.stringify(params)], {
|
|
21
|
+
type: "application/json;charset=utf-8"
|
|
22
|
+
});
|
|
23
|
+
var name = getName(models);
|
|
24
|
+
element.download = "webiny-".concat(name, ".json");
|
|
25
|
+
element.href = URL.createObjectURL(data);
|
|
26
|
+
element.click();
|
|
27
|
+
element.remove();
|
|
28
|
+
element = null;
|
|
29
|
+
};
|
|
30
|
+
exports.download = download;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getName","models","length","_models","_slicedToArray2","default","model","modelId","toLowerCase","download","params","element","document","createElement","data","Blob","JSON","stringify","type","name","concat","href","URL","createObjectURL","click","remove","exports"],"sources":["download.ts"],"sourcesContent":["import { CmsGroup, CmsModel } from \"@webiny/app-headless-cms-common/types\";\n\ninterface Params {\n groups: CmsGroup[];\n models: CmsModel[];\n}\n\nconst getName = (models: CmsModel[]): string => {\n if (models.length > 1) {\n return \"groups-and-models\";\n }\n const [model] = models;\n return model.modelId.toLowerCase();\n};\n\nexport const download = (params: Params): void => {\n const { models } = params;\n let element: HTMLAnchorElement | null = document.createElement(\"a\");\n const data = new Blob([JSON.stringify(params)], {\n type: \"application/json;charset=utf-8\"\n });\n const name = getName(models);\n element.download = `webiny-${name}.json`;\n element.href = URL.createObjectURL(data);\n element.click();\n element.remove();\n element = null;\n};\n"],"mappings":";;;;;;;;AAOA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,CAAIC,MAAkB,EAAa;EAC5C,IAAIA,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;IACnB,OAAO,mBAAmB;EAC9B;EACA,IAAAC,OAAA,OAAAC,eAAA,CAAAC,OAAA,EAAgBJ,MAAM;IAAfK,KAAK,GAAAH,OAAA;EACZ,OAAOG,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC,CAAC;AACtC,CAAC;AAEM,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,MAAc,EAAW;EAC9C,IAAQT,MAAM,GAAKS,MAAM,CAAjBT,MAAM;EACd,IAAIU,OAAiC,GAAGC,QAAQ,CAACC,aAAa,CAAC,GAAG,CAAC;EACnE,IAAMC,IAAI,GAAG,IAAIC,IAAI,CAAC,CAACC,IAAI,CAACC,SAAS,CAACP,MAAM,CAAC,CAAC,EAAE;IAC5CQ,IAAI,EAAE;EACV,CAAC,CAAC;EACF,IAAMC,IAAI,GAAGnB,OAAO,CAACC,MAAM,CAAC;EAC5BU,OAAO,CAACF,QAAQ,aAAAW,MAAA,CAAaD,IAAI,UAAO;EACxCR,OAAO,CAACU,IAAI,GAAGC,GAAG,CAACC,eAAe,CAACT,IAAI,CAAC;EACxCH,OAAO,CAACa,KAAK,CAAC,CAAC;EACfb,OAAO,CAACc,MAAM,CAAC,CAAC;EAChBd,OAAO,GAAG,IAAI;AAClB,CAAC;AAACe,OAAA,CAAAjB,QAAA,GAAAA,QAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CMS_EXPORT_STRUCTURE_QUERY: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CMS_EXPORT_STRUCTURE_QUERY = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
10
|
+
var _templateObject;
|
|
11
|
+
var CMS_EXPORT_STRUCTURE_QUERY = (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n query CmsExportStructure($models: [String!]) {\n exportStructure(models: $models) {\n data\n error {\n message\n code\n data\n }\n }\n }\n"])));
|
|
12
|
+
exports.CMS_EXPORT_STRUCTURE_QUERY = CMS_EXPORT_STRUCTURE_QUERY;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_templateObject","CMS_EXPORT_STRUCTURE_QUERY","gql","_taggedTemplateLiteral2","default","exports"],"sources":["graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\n\nexport const CMS_EXPORT_STRUCTURE_QUERY = gql`\n query CmsExportStructure($models: [String!]) {\n exportStructure(models: $models) {\n data\n error {\n message\n code\n data\n }\n }\n }\n`;\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8B,IAAAC,eAAA;AAEvB,IAAMC,0BAA0B,OAAGC,mBAAG,EAAAF,eAAA,KAAAA,eAAA,OAAAG,uBAAA,CAAAC,OAAA,wPAW5C;AAACC,OAAA,CAAAJ,0BAAA,GAAAA,0BAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ApolloClient from "apollo-client";
|
|
2
|
+
import { CmsGroup, CmsModel } from "@webiny/app-headless-cms-common/types";
|
|
3
|
+
interface Params {
|
|
4
|
+
client: ApolloClient<any>;
|
|
5
|
+
models?: string[];
|
|
6
|
+
}
|
|
7
|
+
interface ResponseData {
|
|
8
|
+
groups: CmsGroup[];
|
|
9
|
+
models: CmsModel[];
|
|
10
|
+
}
|
|
11
|
+
interface Response {
|
|
12
|
+
error?: Partial<Error>;
|
|
13
|
+
data?: ResponseData;
|
|
14
|
+
}
|
|
15
|
+
export declare const runExport: ({ client, models }: Params) => Promise<Response>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.runExport = void 0;
|
|
8
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _graphql = require("./graphql");
|
|
11
|
+
var runExport = /*#__PURE__*/function () {
|
|
12
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(_ref) {
|
|
13
|
+
var _result$errors, _result$data;
|
|
14
|
+
var client, models, variables, result, message, _result$data$exportSt, data, error, _message;
|
|
15
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
client = _ref.client, models = _ref.models;
|
|
19
|
+
variables = {};
|
|
20
|
+
if (models !== null && models !== void 0 && models.length) {
|
|
21
|
+
variables.models = models;
|
|
22
|
+
}
|
|
23
|
+
_context.next = 5;
|
|
24
|
+
return client.query({
|
|
25
|
+
query: _graphql.CMS_EXPORT_STRUCTURE_QUERY,
|
|
26
|
+
variables: variables
|
|
27
|
+
});
|
|
28
|
+
case 5:
|
|
29
|
+
result = _context.sent;
|
|
30
|
+
if (!((_result$errors = result.errors) !== null && _result$errors !== void 0 && _result$errors.length)) {
|
|
31
|
+
_context.next = 11;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
console.error(result.errors);
|
|
35
|
+
return _context.abrupt("return", {
|
|
36
|
+
error: result.errors[0]
|
|
37
|
+
});
|
|
38
|
+
case 11:
|
|
39
|
+
if ((_result$data = result.data) !== null && _result$data !== void 0 && _result$data.exportStructure) {
|
|
40
|
+
_context.next = 15;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
message = "There is no object returned from the exportStructure query.";
|
|
44
|
+
console.error(message);
|
|
45
|
+
return _context.abrupt("return", {
|
|
46
|
+
error: {
|
|
47
|
+
message: message
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
case 15:
|
|
51
|
+
_result$data$exportSt = result.data.exportStructure, data = _result$data$exportSt.data, error = _result$data$exportSt.error;
|
|
52
|
+
if (!error) {
|
|
53
|
+
_context.next = 21;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
console.error(error.message);
|
|
57
|
+
return _context.abrupt("return", {
|
|
58
|
+
error: error
|
|
59
|
+
});
|
|
60
|
+
case 21:
|
|
61
|
+
if (data) {
|
|
62
|
+
_context.next = 24;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
_message = "There is no data returned from the exportStructure query.";
|
|
66
|
+
return _context.abrupt("return", {
|
|
67
|
+
error: {
|
|
68
|
+
message: _message
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
case 24:
|
|
72
|
+
_context.prev = 24;
|
|
73
|
+
return _context.abrupt("return", {
|
|
74
|
+
data: JSON.parse(data)
|
|
75
|
+
});
|
|
76
|
+
case 28:
|
|
77
|
+
_context.prev = 28;
|
|
78
|
+
_context.t0 = _context["catch"](24);
|
|
79
|
+
console.error(_context.t0.message);
|
|
80
|
+
return _context.abrupt("return", {
|
|
81
|
+
error: _context.t0
|
|
82
|
+
});
|
|
83
|
+
case 32:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context.stop();
|
|
86
|
+
}
|
|
87
|
+
}, _callee, null, [[24, 28]]);
|
|
88
|
+
}));
|
|
89
|
+
return function runExport(_x) {
|
|
90
|
+
return _ref2.apply(this, arguments);
|
|
91
|
+
};
|
|
92
|
+
}();
|
|
93
|
+
exports.runExport = runExport;
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=runExport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_graphql","require","runExport","_ref2","_asyncToGenerator2","default","_regeneratorRuntime2","mark","_callee","_ref","_result$errors","_result$data","client","models","variables","result","message","_result$data$exportSt","data","error","_message","wrap","_callee$","_context","prev","next","length","query","CMS_EXPORT_STRUCTURE_QUERY","sent","errors","console","abrupt","exportStructure","JSON","parse","t0","stop","_x","apply","arguments","exports"],"sources":["runExport.ts"],"sourcesContent":["import ApolloClient from \"apollo-client\";\nimport { CmsGroup, CmsModel } from \"@webiny/app-headless-cms-common/types\";\nimport { CMS_EXPORT_STRUCTURE_QUERY } from \"./graphql\";\n\ninterface Params {\n client: ApolloClient<any>;\n models?: string[];\n}\n\ninterface ResponseData {\n groups: CmsGroup[];\n models: CmsModel[];\n}\n\ninterface Response {\n error?: Partial<Error>;\n data?: ResponseData;\n}\n\nexport const runExport = async ({ client, models }: Params): Promise<Response> => {\n const variables: Record<string, any> = {};\n if (models?.length) {\n variables.models = models;\n }\n const result = await client.query({\n query: CMS_EXPORT_STRUCTURE_QUERY,\n variables\n });\n\n if (result.errors?.length) {\n console.error(result.errors);\n return {\n error: result.errors[0]\n };\n } else if (!result.data?.exportStructure) {\n const message = `There is no object returned from the exportStructure query.`;\n console.error(message);\n return {\n error: {\n message\n }\n };\n }\n const { data, error } = result.data.exportStructure;\n if (error) {\n console.error(error.message);\n return {\n error\n };\n } else if (!data) {\n const message = `There is no data returned from the exportStructure query.`;\n return {\n error: {\n message\n }\n };\n }\n try {\n return {\n data: JSON.parse(data)\n };\n } catch (ex) {\n console.error(ex.message);\n return {\n error: ex\n };\n }\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAiBO,IAAMC,SAAS;EAAA,IAAAC,KAAA,OAAAC,kBAAA,CAAAC,OAAA,oBAAAC,oBAAA,CAAAD,OAAA,IAAAE,IAAA,CAAG,SAAAC,QAAAC,IAAA;IAAA,IAAAC,cAAA,EAAAC,YAAA;IAAA,IAAAC,MAAA,EAAAC,MAAA,EAAAC,SAAA,EAAAC,MAAA,EAAAC,OAAA,EAAAC,qBAAA,EAAAC,IAAA,EAAAC,KAAA,EAAAC,QAAA;IAAA,WAAAd,oBAAA,CAAAD,OAAA,IAAAgB,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAASb,MAAM,GAAAH,IAAA,CAANG,MAAM,EAAEC,MAAM,GAAAJ,IAAA,CAANI,MAAM;UACtCC,SAA8B,GAAG,CAAC,CAAC;UACzC,IAAID,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEa,MAAM,EAAE;YAChBZ,SAAS,CAACD,MAAM,GAAGA,MAAM;UAC7B;UAACU,QAAA,CAAAE,IAAA;UAAA,OACoBb,MAAM,CAACe,KAAK,CAAC;YAC9B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