@xleddyl/nuxt-cms 0.9.4 → 0.10.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/README.md +1 -1
- package/dist/module.d.mts +20 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1037 -148
- package/dist/runtime/app/blocks/CmsBlocks.d.vue.ts +1 -1
- package/dist/runtime/app/blocks/CmsBlocks.vue +57 -9
- package/dist/runtime/app/blocks/CmsBlocks.vue.d.ts +1 -1
- package/dist/runtime/app/blocks/CmsField.d.ts +24 -0
- package/dist/runtime/app/blocks/CmsField.js +16 -0
- package/dist/runtime/app/blocks/node.d.ts +37 -0
- package/dist/runtime/app/blocks/node.js +17 -0
- package/dist/runtime/app/blocks/resolve.d.ts +18 -0
- package/dist/runtime/app/blocks/resolve.js +34 -0
- package/dist/runtime/app/components/cms/BlockPicker.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue +87 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.d.vue.ts +38 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue +44 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue.d.ts +38 -0
- package/dist/runtime/app/components/cms/BlockTree.d.vue.ts +29 -0
- package/dist/runtime/app/components/cms/BlockTree.vue +322 -0
- package/dist/runtime/app/components/cms/BlockTree.vue.d.ts +29 -0
- package/dist/runtime/app/components/cms/BlocksField.vue +569 -219
- package/dist/runtime/app/components/cms/BrandMark.vue +7 -13
- package/dist/runtime/app/components/cms/ConfirmGroups.vue +15 -13
- package/dist/runtime/app/components/cms/{BlockPalette.vue.d.ts → EditorHistory.d.vue.ts} +6 -5
- package/dist/runtime/app/components/cms/EditorHistory.vue +34 -0
- package/dist/runtime/app/components/cms/{BlockPalette.d.vue.ts → EditorHistory.vue.d.ts} +6 -5
- package/dist/runtime/app/components/cms/EntryDrawer.d.vue.ts +11 -5
- package/dist/runtime/app/components/cms/EntryDrawer.vue +183 -152
- package/dist/runtime/app/components/cms/EntryDrawer.vue.d.ts +11 -5
- package/dist/runtime/app/components/cms/EntryForm.d.vue.ts +16 -4
- package/dist/runtime/app/components/cms/EntryForm.vue +106 -147
- package/dist/runtime/app/components/cms/EntryForm.vue.d.ts +16 -4
- package/dist/runtime/app/components/cms/FieldInput.vue +10 -2
- package/dist/runtime/app/components/cms/FormSections.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/FormSections.vue +71 -0
- package/dist/runtime/app/components/cms/FormSections.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/ImportModal.vue +46 -58
- package/dist/runtime/app/components/cms/LinkField.d.vue.ts +16 -0
- package/dist/runtime/app/components/cms/LinkField.vue +250 -0
- package/dist/runtime/app/components/cms/LinkField.vue.d.ts +16 -0
- package/dist/runtime/app/components/cms/ListFilters.vue +10 -12
- package/dist/runtime/app/components/cms/LocaleSwitch.d.vue.ts +2 -1
- package/dist/runtime/app/components/cms/LocaleSwitch.vue +19 -11
- package/dist/runtime/app/components/cms/LocaleSwitch.vue.d.ts +2 -1
- package/dist/runtime/app/components/cms/MediaDetail.d.vue.ts +2 -0
- package/dist/runtime/app/components/cms/MediaDetail.vue +112 -83
- package/dist/runtime/app/components/cms/MediaDetail.vue.d.ts +2 -0
- package/dist/runtime/app/components/cms/MediaField.vue +35 -25
- package/dist/runtime/app/components/cms/MediaFolderPicker.vue +26 -71
- package/dist/runtime/app/components/cms/MediaGallery.d.vue.ts +1 -0
- package/dist/runtime/app/components/cms/MediaGallery.vue +442 -419
- package/dist/runtime/app/components/cms/MediaGallery.vue.d.ts +1 -0
- package/dist/runtime/app/components/cms/MediaThumb.vue +9 -25
- package/dist/runtime/app/components/cms/MediaUpload.vue +1 -1
- package/dist/runtime/app/components/cms/{BlockOutline.d.vue.ts → NestedBlockList.d.vue.ts} +5 -5
- package/dist/runtime/app/components/cms/NestedBlockList.vue +87 -0
- package/dist/runtime/app/components/cms/{BlockOutline.vue.d.ts → NestedBlockList.vue.d.ts} +5 -5
- package/dist/runtime/app/components/cms/PoweredBy.vue +12 -5
- package/dist/runtime/app/components/cms/PresetModal.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/PresetModal.vue +70 -0
- package/dist/runtime/app/components/cms/PresetModal.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/RelationField.vue +2 -8
- package/dist/runtime/app/components/cms/SettingsAccount.vue +60 -71
- package/dist/runtime/app/components/cms/SettingsColumns.vue +47 -69
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue +50 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntry.d.vue.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntry.vue +11 -95
- package/dist/runtime/app/components/cms/SettingsEntry.vue.d.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntryActions.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue +40 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue +17 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsLayout.vue +18 -14
- package/dist/runtime/app/components/cms/SettingsPresetForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue +60 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresets.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue +65 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.d.vue.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue +45 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue.d.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue +59 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue +77 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue +117 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue +43 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSite.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue +140 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.d.vue.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue +82 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue.d.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue +179 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUsers.d.vue.ts +9 -6
- package/dist/runtime/app/components/cms/SettingsUsers.vue +88 -234
- package/dist/runtime/app/components/cms/SettingsUsers.vue.d.ts +9 -6
- package/dist/runtime/app/components/cms/SharePreview.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/SharePreview.vue +219 -0
- package/dist/runtime/app/components/cms/SharePreview.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/SlugField.vue +5 -3
- package/dist/runtime/app/components/cms/StatusBadge.vue +8 -8
- package/dist/runtime/app/components/cms/TranslationBadges.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue +44 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationMenu.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue +28 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/VisualEditor.d.vue.ts +22 -4
- package/dist/runtime/app/components/cms/VisualEditor.vue +1153 -338
- package/dist/runtime/app/components/cms/VisualEditor.vue.d.ts +22 -4
- package/dist/runtime/app/components/cms/WelcomeModal.vue +32 -50
- package/dist/runtime/app/composables/cms-clipboard.d.ts +8 -0
- package/dist/runtime/app/composables/cms-clipboard.js +38 -0
- package/dist/runtime/app/composables/cms-confirm.d.ts +6 -8
- package/dist/runtime/app/composables/cms-confirm.js +5 -7
- package/dist/runtime/app/composables/cms-entry-disabled.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry-disabled.js +7 -0
- package/dist/runtime/app/composables/cms-entry-form.d.ts +15 -0
- package/dist/runtime/app/composables/cms-entry-form.js +40 -0
- package/dist/runtime/app/composables/cms-entry-settings.d.ts +30 -0
- package/dist/runtime/app/composables/cms-entry-settings.js +122 -0
- package/dist/runtime/app/composables/cms-entry.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry.js +36 -11
- package/dist/runtime/app/composables/cms-history.d.ts +10 -0
- package/dist/runtime/app/composables/cms-history.js +24 -0
- package/dist/runtime/app/composables/cms-link-targets.d.ts +10 -0
- package/dist/runtime/app/composables/cms-link-targets.js +40 -0
- package/dist/runtime/app/composables/cms-link-usage.d.ts +1 -0
- package/dist/runtime/app/composables/cms-link-usage.js +45 -0
- package/dist/runtime/app/composables/cms-media-library.d.ts +19 -9
- package/dist/runtime/app/composables/cms-media-library.js +31 -13
- package/dist/runtime/app/composables/cms-media-uploader.js +6 -20
- package/dist/runtime/app/composables/cms-permissions.d.ts +18 -0
- package/dist/runtime/app/composables/cms-permissions.js +54 -0
- package/dist/runtime/app/composables/cms-presets.d.ts +11 -0
- package/dist/runtime/app/composables/cms-presets.js +40 -0
- package/dist/runtime/app/composables/cms-preview-mode.d.ts +4 -0
- package/dist/runtime/app/composables/cms-preview-mode.js +8 -0
- package/dist/runtime/app/composables/cms-query.d.ts +3 -0
- package/dist/runtime/app/composables/cms-query.js +45 -20
- package/dist/runtime/app/composables/cms-record-list.d.ts +31 -0
- package/dist/runtime/app/composables/cms-record-list.js +75 -0
- package/dist/runtime/app/composables/cms-route.d.ts +6 -0
- package/dist/runtime/app/composables/cms-route.js +36 -0
- package/dist/runtime/app/composables/cms-runtime.d.ts +1 -0
- package/dist/runtime/app/composables/cms-save-handoff.d.ts +4 -0
- package/dist/runtime/app/composables/cms-save-handoff.js +19 -0
- package/dist/runtime/app/composables/cms-seo.d.ts +12 -0
- package/dist/runtime/app/composables/cms-seo.js +69 -0
- package/dist/runtime/app/composables/cms-settings-form.d.ts +13 -0
- package/dist/runtime/app/composables/cms-settings-form.js +29 -0
- package/dist/runtime/app/composables/cms-settings-sections.d.ts +26 -0
- package/dist/runtime/app/composables/cms-settings-sections.js +181 -0
- package/dist/runtime/app/composables/cms-settings-stores.d.ts +52 -0
- package/dist/runtime/app/composables/cms-settings-stores.js +156 -0
- package/dist/runtime/app/composables/cms-settings.d.ts +3 -3
- package/dist/runtime/app/composables/cms-settings.js +14 -8
- package/dist/runtime/app/composables/cms-site-disabled.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site-disabled.js +8 -0
- package/dist/runtime/app/composables/cms-site.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site.js +22 -0
- package/dist/runtime/app/composables/cms-toast.d.ts +2 -8
- package/dist/runtime/app/composables/cms-toast.js +3 -9
- package/dist/runtime/app/composables/cms-translation-actions.d.ts +15 -0
- package/dist/runtime/app/composables/cms-translation-actions.js +108 -0
- package/dist/runtime/app/css-url.d.ts +4 -0
- package/dist/runtime/app/image/CmsImage.d.vue.ts +89 -0
- package/dist/runtime/app/image/CmsImage.vue +91 -0
- package/dist/runtime/app/image/CmsImage.vue.d.ts +89 -0
- package/dist/runtime/app/layouts/cms-admin.d.vue.ts +2 -2
- package/dist/runtime/app/layouts/cms-admin.vue +98 -76
- package/dist/runtime/app/layouts/cms-admin.vue.d.ts +2 -2
- package/dist/runtime/app/layouts/cms-editor.vue +7 -2
- package/dist/runtime/app/links/CmsLink.d.vue.ts +18 -0
- package/dist/runtime/app/links/CmsLink.vue +18 -0
- package/dist/runtime/app/links/CmsLink.vue.d.ts +18 -0
- package/dist/runtime/app/middleware/cms-auth.js +13 -1
- package/dist/runtime/app/pages/admin-collection.vue +473 -297
- package/dist/runtime/app/pages/admin-content.vue +191 -54
- package/dist/runtime/app/pages/admin-entry.vue +79 -75
- package/dist/runtime/app/pages/admin-index.vue +18 -5
- package/dist/runtime/app/pages/admin-login.vue +1 -1
- package/dist/runtime/app/pages/admin-logout.vue +1 -1
- package/dist/runtime/app/pages/admin-media.vue +3 -3
- package/dist/runtime/app/pages/admin-preview.vue +112 -24
- package/dist/runtime/app/plugins/cms-field.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-field.js +8 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.js +19 -0
- package/dist/runtime/app/plugins/cms-preview.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview.js +27 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.d.vue.ts +7 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue +63 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue.d.ts +7 -0
- package/dist/runtime/app/preview/PreviewOverlay.d.vue.ts +17 -3
- package/dist/runtime/app/preview/PreviewOverlay.vue +629 -166
- package/dist/runtime/app/preview/PreviewOverlay.vue.d.ts +17 -3
- package/dist/runtime/app/preview/field-marker.d.ts +12 -0
- package/dist/runtime/app/preview/field-marker.js +20 -0
- package/dist/runtime/app/preview/inline-text.d.ts +15 -0
- package/dist/runtime/app/preview/inline-text.js +158 -0
- package/dist/runtime/app/utils/block-editor.d.ts +22 -0
- package/dist/runtime/app/utils/block-editor.js +12 -0
- package/dist/runtime/app/utils/keyboard.d.ts +6 -0
- package/dist/runtime/app/utils/keyboard.js +52 -0
- package/dist/runtime/app/utils/redirects.d.ts +6 -0
- package/dist/runtime/app/utils/redirects.js +7 -0
- package/dist/runtime/app/utils/ui.d.ts +8 -0
- package/dist/runtime/app/utils/ui.js +15 -1
- package/dist/runtime/app/utils/users.d.ts +15 -0
- package/dist/runtime/app/utils/users.js +14 -0
- package/dist/runtime/assets/cms.css +1 -1
- package/dist/runtime/generate.js +16 -2
- package/dist/runtime/server/api/collection-export.get.js +3 -2
- package/dist/runtime/server/api/collection-import.post.js +39 -11
- package/dist/runtime/server/api/collection.get.js +27 -9
- package/dist/runtime/server/api/collection.post.js +28 -11
- package/dist/runtime/server/api/collection.put.js +35 -13
- package/dist/runtime/server/api/item.delete.js +19 -7
- package/dist/runtime/server/api/item.get.js +3 -2
- package/dist/runtime/server/api/item.put.js +52 -18
- package/dist/runtime/server/api/link-usage.post.d.ts +5 -0
- package/dist/runtime/server/api/link-usage.post.js +21 -0
- package/dist/runtime/server/api/media-delete.post.js +4 -2
- package/dist/runtime/server/api/media-download.get.js +2 -2
- package/dist/runtime/server/api/media-folder.delete.js +8 -2
- package/dist/runtime/server/api/media-folder.patch.js +10 -2
- package/dist/runtime/server/api/media-folder.post.js +4 -2
- package/dist/runtime/server/api/media-move.post.js +7 -4
- package/dist/runtime/server/api/media-presign.post.js +2 -2
- package/dist/runtime/server/api/media-upload.put.js +2 -2
- package/dist/runtime/server/api/media-usage.post.d.ts +2 -4
- package/dist/runtime/server/api/media-usage.post.js +13 -9
- package/dist/runtime/server/api/media.delete.js +4 -2
- package/dist/runtime/server/api/media.get.js +22 -7
- package/dist/runtime/server/api/media.post.js +4 -2
- package/dist/runtime/server/api/media.put.js +33 -16
- package/dist/runtime/server/api/preset.delete.d.ts +4 -0
- package/dist/runtime/server/api/preset.delete.js +9 -0
- package/dist/runtime/server/api/preset.put.d.ts +3 -0
- package/dist/runtime/server/api/preset.put.js +23 -0
- package/dist/runtime/server/api/presets-field.get.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.get.js +13 -0
- package/dist/runtime/server/api/presets-field.post.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.post.js +36 -0
- package/dist/runtime/server/api/presets.get.d.ts +3 -0
- package/dist/runtime/server/api/presets.get.js +7 -0
- package/dist/runtime/server/api/preview-link.delete.d.ts +4 -0
- package/dist/runtime/server/api/preview-link.delete.js +15 -0
- package/dist/runtime/server/api/preview-links.get.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.get.js +10 -0
- package/dist/runtime/server/api/preview-links.post.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.post.js +17 -0
- package/dist/runtime/server/api/preview.get.d.ts +3 -0
- package/dist/runtime/server/api/preview.get.js +7 -0
- package/dist/runtime/server/api/redirect.delete.d.ts +4 -0
- package/dist/runtime/server/api/redirect.delete.js +10 -0
- package/dist/runtime/server/api/redirect.put.d.ts +3 -0
- package/dist/runtime/server/api/redirect.put.js +8 -0
- package/dist/runtime/server/api/redirects-import.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects-import.post.js +13 -0
- package/dist/runtime/server/api/redirects.get.d.ts +3 -0
- package/dist/runtime/server/api/redirects.get.js +7 -0
- package/dist/runtime/server/api/redirects.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects.post.js +7 -0
- package/dist/runtime/server/api/search.get.js +8 -3
- package/dist/runtime/server/api/settings.delete.js +2 -2
- package/dist/runtime/server/api/settings.get.js +4 -2
- package/dist/runtime/server/api/settings.put.js +2 -2
- package/dist/runtime/server/api/site.get.d.ts +3 -0
- package/dist/runtime/server/api/site.get.js +7 -0
- package/dist/runtime/server/api/site.put.d.ts +3 -0
- package/dist/runtime/server/api/site.put.js +16 -0
- package/dist/runtime/server/api/tags.get.js +3 -2
- package/dist/runtime/server/api/user.delete.js +8 -2
- package/dist/runtime/server/api/user.put.js +14 -4
- package/dist/runtime/server/api/users.get.js +2 -2
- package/dist/runtime/server/api/users.post.js +8 -4
- package/dist/runtime/server/middleware/hidden-site.d.ts +2 -0
- package/dist/runtime/server/middleware/hidden-site.js +8 -0
- package/dist/runtime/server/middleware/preview-links.d.ts +2 -0
- package/dist/runtime/server/middleware/preview-links.js +6 -0
- package/dist/runtime/server/middleware/redirects.d.ts +2 -0
- package/dist/runtime/server/middleware/redirects.js +18 -0
- package/dist/runtime/server/plugins/session-validate.js +4 -1
- package/dist/runtime/server/plugins/webhooks.d.ts +3 -0
- package/dist/runtime/server/plugins/webhooks.js +27 -0
- package/dist/runtime/server/routes/graphql.js +5 -3
- package/dist/runtime/server/routes/robots.d.ts +2 -0
- package/dist/runtime/server/routes/robots.js +16 -0
- package/dist/runtime/server/routes/sitemap.d.ts +2 -0
- package/dist/runtime/server/routes/sitemap.js +67 -0
- package/dist/runtime/server/utils/cached-value.d.ts +5 -0
- package/dist/runtime/server/utils/cached-value.js +24 -0
- package/dist/runtime/server/utils/content-routes.d.ts +5 -0
- package/dist/runtime/server/utils/content-routes.js +29 -0
- package/dist/runtime/server/utils/field-rules.d.ts +19 -0
- package/dist/runtime/server/utils/field-rules.js +72 -0
- package/dist/runtime/server/utils/graphql.d.ts +3 -1
- package/dist/runtime/server/utils/graphql.js +143 -28
- package/dist/runtime/server/utils/hooks.d.ts +14 -0
- package/dist/runtime/server/utils/hooks.js +71 -0
- package/dist/runtime/server/utils/import.d.ts +7 -2
- package/dist/runtime/server/utils/import.js +108 -14
- package/dist/runtime/server/utils/link-usage.d.ts +4 -0
- package/dist/runtime/server/utils/link-usage.js +28 -0
- package/dist/runtime/server/utils/media-references.d.ts +6 -1
- package/dist/runtime/server/utils/media-references.js +49 -20
- package/dist/runtime/server/utils/media-usage.d.ts +2 -0
- package/dist/runtime/server/utils/media-usage.js +5 -3
- package/dist/runtime/server/utils/page-rows.d.ts +2 -0
- package/dist/runtime/server/utils/page-rows.js +42 -29
- package/dist/runtime/server/utils/permissions.d.ts +14 -0
- package/dist/runtime/server/utils/permissions.js +43 -0
- package/dist/runtime/server/utils/presets.d.ts +18 -0
- package/dist/runtime/server/utils/presets.js +68 -0
- package/dist/runtime/server/utils/preview-links.d.ts +207 -0
- package/dist/runtime/server/utils/preview-links.js +161 -0
- package/dist/runtime/server/utils/redirects.d.ts +31 -0
- package/dist/runtime/server/utils/redirects.js +240 -0
- package/dist/runtime/server/utils/registry.js +4 -1
- package/dist/runtime/server/utils/relations.d.ts +8 -0
- package/dist/runtime/server/utils/relations.js +25 -6
- package/dist/runtime/server/utils/require-admin.d.ts +0 -1
- package/dist/runtime/server/utils/require-admin.js +4 -8
- package/dist/runtime/server/utils/search.d.ts +1 -0
- package/dist/runtime/server/utils/search.js +44 -19
- package/dist/runtime/server/utils/site.d.ts +23 -0
- package/dist/runtime/server/utils/site.js +79 -0
- package/dist/runtime/server/utils/sitemap.d.ts +12 -0
- package/dist/runtime/server/utils/sitemap.js +109 -0
- package/dist/runtime/server/utils/user-management.d.ts +4 -0
- package/dist/runtime/server/utils/user-management.js +20 -0
- package/dist/runtime/server/utils/users.d.ts +1 -1
- package/dist/runtime/server/utils/users.js +1 -1
- package/dist/runtime/server/utils/visibility.d.ts +1 -0
- package/dist/runtime/server/utils/visibility.js +6 -1
- package/dist/runtime/server/utils/webhooks.d.ts +24 -0
- package/dist/runtime/server/utils/webhooks.js +90 -0
- package/dist/runtime/shared/block-paths.d.ts +66 -0
- package/dist/runtime/shared/block-paths.js +310 -0
- package/dist/runtime/shared/block-picker.d.ts +18 -0
- package/dist/runtime/shared/block-picker.js +31 -0
- package/dist/runtime/shared/block-signature.d.ts +4 -0
- package/dist/runtime/shared/block-signature.js +46 -0
- package/dist/runtime/shared/clipboard.d.ts +31 -0
- package/dist/runtime/shared/clipboard.js +206 -0
- package/dist/runtime/shared/conditions.d.ts +36 -0
- package/dist/runtime/shared/conditions.js +100 -0
- package/dist/runtime/shared/content-routes.d.ts +42 -0
- package/dist/runtime/shared/content-routes.js +237 -0
- package/dist/runtime/shared/duplicate.js +2 -1
- package/dist/runtime/shared/editor-layout.d.ts +18 -0
- package/dist/runtime/shared/editor-layout.js +9 -0
- package/dist/runtime/shared/field-options.d.ts +21 -0
- package/dist/runtime/shared/field-options.js +90 -0
- package/dist/runtime/shared/graphql-sdl.d.ts +1 -0
- package/dist/runtime/shared/graphql-sdl.js +50 -26
- package/dist/runtime/shared/history.d.ts +27 -0
- package/dist/runtime/shared/history.js +123 -0
- package/dist/runtime/shared/hooks.d.ts +45 -0
- package/dist/runtime/shared/hooks.js +28 -0
- package/dist/runtime/shared/index.d.ts +90 -21
- package/dist/runtime/shared/index.js +121 -37
- package/dist/runtime/shared/inline-text.d.ts +38 -0
- package/dist/runtime/shared/inline-text.js +85 -0
- package/dist/runtime/shared/layout.d.ts +2 -1
- package/dist/runtime/shared/layout.js +3 -0
- package/dist/runtime/shared/links.d.ts +48 -0
- package/dist/runtime/shared/links.js +155 -0
- package/dist/runtime/shared/list-filters.d.ts +2 -0
- package/dist/runtime/shared/list-filters.js +2 -0
- package/dist/runtime/shared/media-focal.d.ts +30 -0
- package/dist/runtime/shared/media-focal.js +52 -0
- package/dist/runtime/shared/migrations-dir.d.ts +14 -0
- package/dist/runtime/shared/migrations-dir.js +48 -2
- package/dist/runtime/shared/presets.d.ts +67 -0
- package/dist/runtime/shared/presets.js +127 -0
- package/dist/runtime/shared/preview-links.d.ts +64 -0
- package/dist/runtime/shared/preview-links.js +54 -0
- package/dist/runtime/shared/preview.d.ts +124 -21
- package/dist/runtime/shared/preview.js +419 -81
- package/dist/runtime/shared/redirects.d.ts +75 -0
- package/dist/runtime/shared/redirects.js +230 -0
- package/dist/runtime/shared/roles.d.ts +57 -0
- package/dist/runtime/shared/roles.js +293 -0
- package/dist/runtime/shared/save-state.d.ts +8 -0
- package/dist/runtime/shared/save-state.js +15 -0
- package/dist/runtime/shared/search.d.ts +16 -1
- package/dist/runtime/shared/search.js +41 -7
- package/dist/runtime/shared/seo.d.ts +167 -0
- package/dist/runtime/shared/seo.js +335 -0
- package/dist/runtime/shared/transfer.js +2 -1
- package/dist/runtime/shared/translations.d.ts +29 -0
- package/dist/runtime/shared/translations.js +123 -0
- package/dist/runtime/shared/users.d.ts +1 -1
- package/dist/runtime/shared/validation.d.ts +23 -1
- package/dist/runtime/shared/validation.js +214 -64
- package/dist/runtime/webhooks.d.ts +33 -0
- package/dist/runtime/webhooks.js +57 -0
- package/dist/types.d.mts +5 -1
- package/package.json +6 -2
- package/dist/runtime/app/components/cms/BlockOutline.vue +0 -88
- package/dist/runtime/app/components/cms/BlockPalette.vue +0 -31
- package/dist/runtime/app/components/cms/SettingsModal.d.vue.ts +0 -12
- package/dist/runtime/app/components/cms/SettingsModal.vue +0 -126
- package/dist/runtime/app/components/cms/SettingsModal.vue.d.ts +0 -12
- package/dist/runtime/app/composables/cms-field-focus.d.ts +0 -4
- package/dist/runtime/app/composables/cms-field-focus.js +0 -20
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import type { CmsEntry, CmsTab } from '#nuxt-cms';
|
|
2
|
+
import type { FormErrors } from '@xleddyl/443-components-vue';
|
|
2
3
|
import type { CmsSearchFocus } from '../../../shared/search.js';
|
|
4
|
+
import type { CmsEntryForm } from '../../composables/cms-entry-form.js';
|
|
5
|
+
import type { CmsResponseIssue } from '../../utils/ui.js';
|
|
3
6
|
type __VLS_Props = {
|
|
4
7
|
fields: CmsEntry['fields'];
|
|
5
8
|
tabs?: CmsTab[];
|
|
6
9
|
entryName?: string;
|
|
7
|
-
drafts?: boolean;
|
|
8
|
-
loading?: boolean;
|
|
9
10
|
formId?: string;
|
|
10
|
-
footer?: boolean;
|
|
11
11
|
focus?: CmsSearchFocus | null;
|
|
12
12
|
path?: string;
|
|
13
|
+
lock?: string | null;
|
|
14
|
+
locked?: string[];
|
|
15
|
+
form?: CmsEntryForm;
|
|
16
|
+
tab?: string;
|
|
17
|
+
tabQuery?: string;
|
|
13
18
|
};
|
|
19
|
+
declare function setIssues(issues: CmsResponseIssue[]): void;
|
|
20
|
+
declare function revealErrors(errors: FormErrors): void;
|
|
14
21
|
type __VLS_ModelProps = {
|
|
15
22
|
modelValue: Record<string, unknown>;
|
|
16
23
|
};
|
|
17
24
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
18
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
25
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
26
|
+
setIssues: typeof setIssues;
|
|
27
|
+
revealErrors: typeof revealErrors;
|
|
28
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
29
|
error: () => any;
|
|
20
30
|
submit: () => any;
|
|
21
31
|
"update:modelValue": (value: Record<string, unknown>) => any;
|
|
32
|
+
"update:tab": (tab: string) => any;
|
|
22
33
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
34
|
onError?: (() => any) | undefined;
|
|
24
35
|
onSubmit?: (() => any) | undefined;
|
|
25
36
|
"onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
37
|
+
"onUpdate:tab"?: ((tab: string) => any) | undefined;
|
|
26
38
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
39
|
declare const _default: typeof __VLS_export;
|
|
28
40
|
export default _default;
|
|
@@ -1,71 +1,47 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component
|
|
3
|
+
:is="wrapper"
|
|
4
|
+
:id="external ? void 0 : formId"
|
|
5
|
+
v-bind="formBinding"
|
|
6
|
+
class="cms-form"
|
|
7
|
+
>
|
|
8
|
+
<KAlert v-if="lock" tone="neutral" :icon="cmsIcon('lock-closed')" :title="lock" />
|
|
3
9
|
<component :is="tabbed ? KTabs : 'div'" v-bind="tabsBinding" class="cms-form-body">
|
|
4
10
|
<template #[panelSlot]>
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
:style="{ '--cms-row-cols': row.length }"
|
|
11
|
+
<CmsFormSections ref="sectionsRef" :layout="layout" :shown="isShown">
|
|
12
|
+
<template #field="{ fieldKey: key }">
|
|
13
|
+
<KFormField
|
|
14
|
+
:name="key"
|
|
15
|
+
:label="fields[key].label"
|
|
16
|
+
:help="fields[key].description"
|
|
17
|
+
:required="fields[key].required"
|
|
18
|
+
:disabled="locked.includes(key) || void 0"
|
|
19
|
+
:highlight="highlighted === key"
|
|
20
|
+
>
|
|
21
|
+
<template
|
|
22
|
+
v-if="hasLocaleSwitch(fields[key]) && i18n.locales.length > 1"
|
|
23
|
+
#label-actions
|
|
19
24
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
:
|
|
23
|
-
:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
:value="
|
|
38
|
-
isTranslatableField(fields[key]) ? state[key] : null
|
|
39
|
-
"
|
|
40
|
-
@update:model-value="(locale) => setLocale(key, locale)"
|
|
41
|
-
/>
|
|
42
|
-
</template>
|
|
43
|
-
<CmsFieldInput
|
|
44
|
-
v-model="state[key]"
|
|
45
|
-
:field="fields[key]"
|
|
46
|
-
:locale="localeFor(key)"
|
|
47
|
-
:slug-source="slugSource(fields[key])"
|
|
48
|
-
:entry-name="entryName"
|
|
49
|
-
:field-key="key"
|
|
50
|
-
/>
|
|
51
|
-
</KFormField>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</component>
|
|
55
|
-
</div>
|
|
25
|
+
<CmsLocaleSwitch
|
|
26
|
+
:model-value="localeFor(key)"
|
|
27
|
+
:progress="fieldProgress(key)"
|
|
28
|
+
@update:model-value="(locale) => setLocale(key, locale)"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
31
|
+
<CmsFieldInput
|
|
32
|
+
v-model="state[key]"
|
|
33
|
+
:field="fields[key]"
|
|
34
|
+
:locale="localeFor(key)"
|
|
35
|
+
:slug-source="slugSource(fields[key])"
|
|
36
|
+
:entry-name="entryName"
|
|
37
|
+
:field-key="key"
|
|
38
|
+
/>
|
|
39
|
+
</KFormField>
|
|
40
|
+
</template>
|
|
41
|
+
</CmsFormSections>
|
|
56
42
|
</template>
|
|
57
43
|
</component>
|
|
58
|
-
|
|
59
|
-
<KButton type="submit" label="Save" :loading="loading" />
|
|
60
|
-
<KButton
|
|
61
|
-
v-if="drafts"
|
|
62
|
-
type="submit"
|
|
63
|
-
:label="published ? 'Make draft' : 'Publish'"
|
|
64
|
-
:loading="loading"
|
|
65
|
-
@click="togglePublished"
|
|
66
|
-
/>
|
|
67
|
-
</KStack>
|
|
68
|
-
</KForm>
|
|
44
|
+
</component>
|
|
69
45
|
</template>
|
|
70
46
|
|
|
71
47
|
<script setup>
|
|
@@ -73,51 +49,70 @@ import {
|
|
|
73
49
|
fieldTab,
|
|
74
50
|
hasTranslatableBlockFields,
|
|
75
51
|
isFieldVisible,
|
|
52
|
+
isLocalizedLinkField,
|
|
76
53
|
isTranslatableField,
|
|
77
54
|
resolveFormLayout,
|
|
78
55
|
slugSourceValue
|
|
79
56
|
} from "#nuxt-cms";
|
|
80
57
|
import {
|
|
81
|
-
|
|
82
|
-
Button as KButton,
|
|
58
|
+
Alert as KAlert,
|
|
83
59
|
Form as KForm,
|
|
84
60
|
FormField as KFormField,
|
|
85
|
-
Stack as KStack,
|
|
86
61
|
Tabs as KTabs,
|
|
87
|
-
|
|
62
|
+
useFieldHighlight
|
|
88
63
|
} from "@xleddyl/443-components-vue";
|
|
89
|
-
import { computed, nextTick, onMounted, ref
|
|
90
|
-
import
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
64
|
+
import { computed, nextTick, onMounted, ref } from "#imports";
|
|
65
|
+
import { translationProgress } from "../../../shared/translations";
|
|
66
|
+
import { useCmsEntryForm } from "../../composables/cms-entry-form";
|
|
67
|
+
import { useCmsPageQuery } from "../../composables/cms-route";
|
|
93
68
|
import { useCmsRuntime } from "../../composables/cms-runtime";
|
|
94
69
|
import { entryFormLayout, useCmsSettingsState } from "../../composables/cms-settings";
|
|
95
|
-
import { cmsIcon
|
|
70
|
+
import { cmsIcon } from "../../utils/ui";
|
|
96
71
|
const props = defineProps({
|
|
97
72
|
fields: { type: Object, required: true },
|
|
98
73
|
tabs: { type: Array, required: false },
|
|
99
74
|
entryName: { type: String, required: false },
|
|
100
|
-
drafts: { type: Boolean, required: false },
|
|
101
|
-
loading: { type: Boolean, required: false },
|
|
102
75
|
formId: { type: String, required: false },
|
|
103
|
-
footer: { type: Boolean, required: false, default: true },
|
|
104
76
|
focus: { type: [Object, null], required: false },
|
|
105
|
-
path: { type: String, required: false }
|
|
77
|
+
path: { type: String, required: false },
|
|
78
|
+
lock: { type: [String, null], required: false, default: null },
|
|
79
|
+
locked: { type: Array, required: false, default: () => [] },
|
|
80
|
+
form: { type: null, required: false, default: void 0 },
|
|
81
|
+
tab: { type: String, required: false, default: void 0 },
|
|
82
|
+
tabQuery: { type: String, required: false, default: void 0 }
|
|
106
83
|
});
|
|
107
84
|
const state = defineModel({ type: Object, ...{ required: true } });
|
|
108
|
-
const emit = defineEmits(["submit", "error"]);
|
|
85
|
+
const emit = defineEmits(["submit", "error", "update:tab"]);
|
|
86
|
+
const external = !!props.form;
|
|
109
87
|
const { i18n } = useCmsRuntime();
|
|
110
88
|
const activeLocale = ref({});
|
|
111
89
|
const tabList = computed(() => props.tabs ?? []);
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
90
|
+
const localTab = ref("");
|
|
91
|
+
const routeTab = props.tabQuery ? useCmsPageQuery(props.tabQuery) : null;
|
|
92
|
+
const ownTab = computed({
|
|
93
|
+
get: () => {
|
|
94
|
+
const tabs = tabList.value;
|
|
95
|
+
const wanted = routeTab ? routeTab.value : localTab.value;
|
|
96
|
+
return tabs.some((tab) => tab.id === wanted) ? wanted : tabs[0]?.id ?? "";
|
|
97
|
+
},
|
|
98
|
+
set: (value) => {
|
|
99
|
+
if (!routeTab) localTab.value = value;
|
|
100
|
+
else routeTab.value = value === tabList.value[0]?.id ? "" : value;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const activeTab = computed({
|
|
104
|
+
get: () => props.tab !== void 0 ? props.tab : ownTab.value,
|
|
105
|
+
set: (value) => {
|
|
106
|
+
if (props.tab !== void 0) emit("update:tab", value);
|
|
107
|
+
else ownTab.value = value;
|
|
108
|
+
}
|
|
115
109
|
});
|
|
116
|
-
const tabbed = computed(() => tabList.value.length > 1);
|
|
110
|
+
const tabbed = computed(() => props.tab === void 0 && tabList.value.length > 1);
|
|
117
111
|
const panelSlot = computed(() => tabbed.value ? "panel" : "default");
|
|
118
112
|
const tabsBinding = computed(
|
|
119
113
|
() => tabbed.value ? {
|
|
120
114
|
items: tabList.value.map((tab) => ({ value: tab.id, label: tab.label })),
|
|
115
|
+
label: "Entry fields",
|
|
121
116
|
modelValue: activeTab.value,
|
|
122
117
|
panelFocusable: false,
|
|
123
118
|
"onUpdate:modelValue": (value) => {
|
|
@@ -131,42 +126,13 @@ const layout = computed(
|
|
|
131
126
|
);
|
|
132
127
|
function isShown(key) {
|
|
133
128
|
const field = props.fields[key];
|
|
134
|
-
if (!field || !isFieldVisible(field, state.value)) return false;
|
|
129
|
+
if (!field || !isFieldVisible(field, state.value, props.fields)) return false;
|
|
135
130
|
if (!tabList.value.length) return true;
|
|
136
131
|
return fieldTab(field, tabList.value) === activeTab.value;
|
|
137
132
|
}
|
|
138
|
-
const
|
|
139
|
-
() => layout.value.main.map((section, index) => ({
|
|
140
|
-
...section,
|
|
141
|
-
id: `${index}-${section.title ?? ""}`,
|
|
142
|
-
rows: section.rows.map((row) => row.filter((key) => isShown(key))).filter((row) => row.length)
|
|
143
|
-
})).filter((section) => section.rows.length)
|
|
144
|
-
);
|
|
145
|
-
const toggled = ref({});
|
|
146
|
-
function isCollapsed(section) {
|
|
147
|
-
if (!section.title) return false;
|
|
148
|
-
return toggled.value[section.id] ?? !!section.collapsed;
|
|
149
|
-
}
|
|
150
|
-
function toggleSection(id) {
|
|
151
|
-
const section = sections.value.find((s) => s.id === id);
|
|
152
|
-
if (section) toggled.value = { ...toggled.value, [id]: !isCollapsed(section) };
|
|
153
|
-
}
|
|
154
|
-
function sectionBinding(section) {
|
|
155
|
-
if (!section.title) return {};
|
|
156
|
-
return {
|
|
157
|
-
items: [{ value: section.id, title: section.title, description: section.description }],
|
|
158
|
-
variant: "outline",
|
|
159
|
-
contentVariant: "neutral",
|
|
160
|
-
modelValue: isCollapsed(section) ? null : section.id,
|
|
161
|
-
"onUpdate:modelValue": () => toggleSection(section.id)
|
|
162
|
-
};
|
|
163
|
-
}
|
|
133
|
+
const sectionsRef = ref(null);
|
|
164
134
|
function revealField(key) {
|
|
165
|
-
|
|
166
|
-
if (section.rows.some((row) => row.includes(key)) && isCollapsed(section)) {
|
|
167
|
-
toggled.value = { ...toggled.value, [section.id]: false };
|
|
168
|
-
}
|
|
169
|
-
}
|
|
135
|
+
sectionsRef.value?.reveal(key);
|
|
170
136
|
}
|
|
171
137
|
function firstErrorKey(errors) {
|
|
172
138
|
const keys = Object.keys(errors).filter((key) => errors[key]);
|
|
@@ -186,7 +152,10 @@ function slugSource(field) {
|
|
|
186
152
|
return slugSourceValue(props.fields[field.from], state.value[field.from], i18n.defaultLocale);
|
|
187
153
|
}
|
|
188
154
|
function hasLocaleSwitch(field) {
|
|
189
|
-
return isTranslatableField(field) || hasTranslatableBlockFields(field);
|
|
155
|
+
return isTranslatableField(field) || isLocalizedLinkField(field) || hasTranslatableBlockFields(field);
|
|
156
|
+
}
|
|
157
|
+
function fieldProgress(key) {
|
|
158
|
+
return translationProgress(props.fields, state.value, i18n, [key]);
|
|
190
159
|
}
|
|
191
160
|
function localeFor(key) {
|
|
192
161
|
return activeLocale.value[key] ?? i18n.defaultLocale;
|
|
@@ -194,41 +163,20 @@ function localeFor(key) {
|
|
|
194
163
|
function setLocale(key, locale) {
|
|
195
164
|
activeLocale.value = { ...activeLocale.value, [key]: locale };
|
|
196
165
|
}
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
() =>
|
|
202
|
-
{ fields: props.fields, drafts: props.drafts, validate: validate.value, path: props.path },
|
|
203
|
-
i18n
|
|
204
|
-
)
|
|
205
|
-
);
|
|
206
|
-
function warnings(values) {
|
|
207
|
-
return entryValidationWarnings(
|
|
208
|
-
{ fields: props.fields, validate: validate.value },
|
|
209
|
-
values,
|
|
210
|
-
i18n,
|
|
211
|
-
props.path
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
const form = useForm({
|
|
215
|
-
values: state,
|
|
216
|
-
validator: schema,
|
|
217
|
-
warnings,
|
|
166
|
+
const form = props.form ?? useCmsEntryForm({
|
|
167
|
+
state,
|
|
168
|
+
fields: () => props.fields,
|
|
169
|
+
entryName: () => props.entryName,
|
|
170
|
+
path: () => props.path,
|
|
218
171
|
onSubmit: () => emit("submit"),
|
|
219
|
-
onInvalid: (errors) => onError(firstErrorKey(errors))
|
|
220
|
-
|
|
221
|
-
const published = computed({
|
|
222
|
-
get: () => state.value.status === "published",
|
|
223
|
-
set: (value) => {
|
|
224
|
-
state.value.status = value ? "published" : "draft";
|
|
225
|
-
}
|
|
172
|
+
onInvalid: (errors) => onError(firstErrorKey(errors)),
|
|
173
|
+
guard: false
|
|
226
174
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const { highlighted,
|
|
175
|
+
const wrapper = external ? "div" : KForm;
|
|
176
|
+
const formBinding = computed(
|
|
177
|
+
() => external ? {} : { form, focusOnError: false, disabled: props.lock ? true : void 0 }
|
|
178
|
+
);
|
|
179
|
+
const { highlighted, highlight } = useFieldHighlight();
|
|
232
180
|
function applyFocus(focus) {
|
|
233
181
|
if (focus.tab && tabList.value.some((tab2) => tab2.id === focus.tab)) activeTab.value = focus.tab;
|
|
234
182
|
const key = focus.field;
|
|
@@ -241,10 +189,21 @@ function applyFocus(focus) {
|
|
|
241
189
|
}
|
|
242
190
|
void nextTick(() => {
|
|
243
191
|
revealField(key);
|
|
244
|
-
|
|
192
|
+
highlight(key);
|
|
245
193
|
});
|
|
246
194
|
}
|
|
247
195
|
onMounted(() => {
|
|
248
196
|
if (props.focus) applyFocus(props.focus);
|
|
249
197
|
});
|
|
198
|
+
function setIssues(issues) {
|
|
199
|
+
const fieldIssues = issues.filter((issue) => issue.path.length);
|
|
200
|
+
if (!fieldIssues.length) return;
|
|
201
|
+
form.setIssues(fieldIssues);
|
|
202
|
+
onError(String(fieldIssues[0].path[0]));
|
|
203
|
+
}
|
|
204
|
+
function revealErrors(errors) {
|
|
205
|
+
const key = firstErrorKey(errors);
|
|
206
|
+
if (key) void nextTick(() => revealField(key));
|
|
207
|
+
}
|
|
208
|
+
defineExpose({ setIssues, revealErrors });
|
|
250
209
|
</script>
|
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import type { CmsEntry, CmsTab } from '#nuxt-cms';
|
|
2
|
+
import type { FormErrors } from '@xleddyl/443-components-vue';
|
|
2
3
|
import type { CmsSearchFocus } from '../../../shared/search.js';
|
|
4
|
+
import type { CmsEntryForm } from '../../composables/cms-entry-form.js';
|
|
5
|
+
import type { CmsResponseIssue } from '../../utils/ui.js';
|
|
3
6
|
type __VLS_Props = {
|
|
4
7
|
fields: CmsEntry['fields'];
|
|
5
8
|
tabs?: CmsTab[];
|
|
6
9
|
entryName?: string;
|
|
7
|
-
drafts?: boolean;
|
|
8
|
-
loading?: boolean;
|
|
9
10
|
formId?: string;
|
|
10
|
-
footer?: boolean;
|
|
11
11
|
focus?: CmsSearchFocus | null;
|
|
12
12
|
path?: string;
|
|
13
|
+
lock?: string | null;
|
|
14
|
+
locked?: string[];
|
|
15
|
+
form?: CmsEntryForm;
|
|
16
|
+
tab?: string;
|
|
17
|
+
tabQuery?: string;
|
|
13
18
|
};
|
|
19
|
+
declare function setIssues(issues: CmsResponseIssue[]): void;
|
|
20
|
+
declare function revealErrors(errors: FormErrors): void;
|
|
14
21
|
type __VLS_ModelProps = {
|
|
15
22
|
modelValue: Record<string, unknown>;
|
|
16
23
|
};
|
|
17
24
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
18
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
25
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
26
|
+
setIssues: typeof setIssues;
|
|
27
|
+
revealErrors: typeof revealErrors;
|
|
28
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
29
|
error: () => any;
|
|
20
30
|
submit: () => any;
|
|
21
31
|
"update:modelValue": (value: Record<string, unknown>) => any;
|
|
32
|
+
"update:tab": (tab: string) => any;
|
|
22
33
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
34
|
onError?: (() => any) | undefined;
|
|
24
35
|
onSubmit?: (() => any) | undefined;
|
|
25
36
|
"onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
37
|
+
"onUpdate:tab"?: ((tab: string) => any) | undefined;
|
|
26
38
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
39
|
declare const _default: typeof __VLS_export;
|
|
28
40
|
export default _default;
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
v-else-if="field.type === 'number'"
|
|
58
58
|
v-model="num"
|
|
59
59
|
align="start"
|
|
60
|
+
:min="field.min"
|
|
61
|
+
:max="field.max"
|
|
60
62
|
:placeholder="field.placeholder"
|
|
61
63
|
/>
|
|
62
64
|
<KDateInput v-else-if="field.type === 'date'" v-model="plainText" />
|
|
@@ -68,15 +70,21 @@
|
|
|
68
70
|
<CmsRelationField
|
|
69
71
|
v-else-if="field.type === 'relation'"
|
|
70
72
|
v-model="relationValue"
|
|
71
|
-
:to="field
|
|
73
|
+
:to="relationTarget(field)"
|
|
72
74
|
:required="field.required"
|
|
73
75
|
:multiple="field.cardinality === 'many-to-many'"
|
|
74
76
|
/>
|
|
77
|
+
<CmsLinkField
|
|
78
|
+
v-else-if="field.type === 'link'"
|
|
79
|
+
v-model="model"
|
|
80
|
+
:field="field"
|
|
81
|
+
:locale="locale"
|
|
82
|
+
/>
|
|
75
83
|
<CmsMediaField v-else v-model="strOrNull" :media-type="field.mediaType" :accept="field.accept" />
|
|
76
84
|
</template>
|
|
77
85
|
|
|
78
86
|
<script setup>
|
|
79
|
-
import { isTranslatableField, selectOptions } from "#nuxt-cms";
|
|
87
|
+
import { isTranslatableField, relationTarget, selectOptions } from "#nuxt-cms";
|
|
80
88
|
import {
|
|
81
89
|
Combobox as KCombobox,
|
|
82
90
|
DateInput as KDateInput,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CmsFormLayout } from '#nuxt-cms';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
layout: CmsFormLayout;
|
|
4
|
+
shown?: (key: string) => boolean;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_Slots = {
|
|
7
|
+
field(props: {
|
|
8
|
+
fieldKey: string;
|
|
9
|
+
}): unknown;
|
|
10
|
+
};
|
|
11
|
+
declare function reveal(key: string): void;
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
13
|
+
reveal: typeof reveal;
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<KStack gap="lg">
|
|
3
|
+
<component
|
|
4
|
+
:is="section.title ? KAccordion : 'div'"
|
|
5
|
+
v-for="section in sections"
|
|
6
|
+
:key="section.id"
|
|
7
|
+
v-bind="sectionBinding(section)"
|
|
8
|
+
>
|
|
9
|
+
<KStack gap="lg">
|
|
10
|
+
<KGrid
|
|
11
|
+
v-for="row in section.rows"
|
|
12
|
+
:key="row.join('|')"
|
|
13
|
+
:columns="{ base: 1, sm: row.length }"
|
|
14
|
+
>
|
|
15
|
+
<template v-for="key in row" :key="key">
|
|
16
|
+
<slot name="field" :field-key="key" />
|
|
17
|
+
</template>
|
|
18
|
+
</KGrid>
|
|
19
|
+
</KStack>
|
|
20
|
+
</component>
|
|
21
|
+
</KStack>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup>
|
|
25
|
+
import {
|
|
26
|
+
Accordion as KAccordion,
|
|
27
|
+
Grid as KGrid,
|
|
28
|
+
Stack as KStack
|
|
29
|
+
} from "@xleddyl/443-components-vue";
|
|
30
|
+
import { computed, ref } from "#imports";
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
layout: { type: Object, required: true },
|
|
33
|
+
shown: { type: Function, required: false, default: () => true }
|
|
34
|
+
});
|
|
35
|
+
defineSlots();
|
|
36
|
+
const sections = computed(
|
|
37
|
+
() => props.layout.main.map((section, index) => ({
|
|
38
|
+
...section,
|
|
39
|
+
id: `${index}-${section.title ?? ""}`,
|
|
40
|
+
rows: section.rows.map((row) => row.filter((key) => props.shown(key))).filter((row) => row.length)
|
|
41
|
+
})).filter((section) => section.rows.length)
|
|
42
|
+
);
|
|
43
|
+
const toggled = ref({});
|
|
44
|
+
function isCollapsed(section) {
|
|
45
|
+
if (!section.title) return false;
|
|
46
|
+
return toggled.value[section.id] ?? !!section.collapsed;
|
|
47
|
+
}
|
|
48
|
+
function toggleSection(id) {
|
|
49
|
+
const section = sections.value.find((s) => s.id === id);
|
|
50
|
+
if (section) toggled.value = { ...toggled.value, [id]: !isCollapsed(section) };
|
|
51
|
+
}
|
|
52
|
+
function sectionBinding(section) {
|
|
53
|
+
if (!section.title) return {};
|
|
54
|
+
return {
|
|
55
|
+
items: [{ value: section.id, title: section.title, description: section.description }],
|
|
56
|
+
variant: "outline",
|
|
57
|
+
contentVariant: "neutral",
|
|
58
|
+
divided: true,
|
|
59
|
+
modelValue: isCollapsed(section) ? null : section.id,
|
|
60
|
+
"onUpdate:modelValue": () => toggleSection(section.id)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function reveal(key) {
|
|
64
|
+
for (const section of sections.value) {
|
|
65
|
+
if (section.rows.some((row) => row.includes(key)) && isCollapsed(section)) {
|
|
66
|
+
toggled.value = { ...toggled.value, [section.id]: false };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
defineExpose({ reveal });
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CmsFormLayout } from '#nuxt-cms';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
layout: CmsFormLayout;
|
|
4
|
+
shown?: (key: string) => boolean;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_Slots = {
|
|
7
|
+
field(props: {
|
|
8
|
+
fieldKey: string;
|
|
9
|
+
}): unknown;
|
|
10
|
+
};
|
|
11
|
+
declare function reveal(key: string): void;
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
13
|
+
reveal: typeof reveal;
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|