katecms 0.0.0-stage → 1.0.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/README.md +5 -3
- package/dist/module.d.mts +93 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +579 -0
- package/dist/runtime/assets/img/katecms-logo.svg +17 -0
- package/dist/runtime/composables/getCollection.d.ts +62 -0
- package/dist/runtime/composables/getCollection.js +167 -0
- package/dist/runtime/composables/getOptions.d.ts +22 -0
- package/dist/runtime/composables/getOptions.js +22 -0
- package/dist/runtime/composables/getQueryCollection.d.ts +95 -0
- package/dist/runtime/composables/getQueryCollection.js +199 -0
- package/dist/runtime/composables/getTerms.d.ts +79 -0
- package/dist/runtime/composables/getTerms.js +148 -0
- package/dist/runtime/composables/useAuth.d.ts +14 -0
- package/dist/runtime/composables/useAuth.js +33 -0
- package/dist/runtime/composables/useAuthCooldown.d.ts +6 -0
- package/dist/runtime/composables/useAuthCooldown.js +44 -0
- package/dist/runtime/composables/useCmsPaths.d.ts +15 -0
- package/dist/runtime/composables/useCmsPaths.js +21 -0
- package/dist/runtime/composables/useKateCmsExtensions.d.ts +49 -0
- package/dist/runtime/composables/useKateCmsExtensions.js +29 -0
- package/dist/runtime/composables/useMediaLibrary.d.ts +84 -0
- package/dist/runtime/composables/useMediaLibrary.js +140 -0
- package/dist/runtime/composables/useMenuAccess.d.ts +8 -0
- package/dist/runtime/composables/useMenuAccess.js +16 -0
- package/dist/runtime/internal/admin/AdminHeader.d.vue.ts +24 -0
- package/dist/runtime/internal/admin/AdminHeader.vue +91 -0
- package/dist/runtime/internal/admin/AdminHeader.vue.d.ts +24 -0
- package/dist/runtime/internal/admin/AppMenu.d.vue.ts +3 -0
- package/dist/runtime/internal/admin/AppMenu.vue +244 -0
- package/dist/runtime/internal/admin/AppMenu.vue.d.ts +3 -0
- package/dist/runtime/internal/admin/AppUser.d.vue.ts +3 -0
- package/dist/runtime/internal/admin/AppUser.vue +227 -0
- package/dist/runtime/internal/admin/AppUser.vue.d.ts +3 -0
- package/dist/runtime/internal/admin/CollectionEntryForm.d.vue.ts +41 -0
- package/dist/runtime/internal/admin/CollectionEntryForm.vue +916 -0
- package/dist/runtime/internal/admin/CollectionEntryForm.vue.d.ts +41 -0
- package/dist/runtime/internal/admin/ConfirmDialog.d.vue.ts +28 -0
- package/dist/runtime/internal/admin/ConfirmDialog.vue +136 -0
- package/dist/runtime/internal/admin/ConfirmDialog.vue.d.ts +28 -0
- package/dist/runtime/internal/admin/DictionaryTermForm.d.vue.ts +33 -0
- package/dist/runtime/internal/admin/DictionaryTermForm.vue +328 -0
- package/dist/runtime/internal/admin/DictionaryTermForm.vue.d.ts +33 -0
- package/dist/runtime/internal/admin/EntryRevisions.d.vue.ts +15 -0
- package/dist/runtime/internal/admin/EntryRevisions.vue +125 -0
- package/dist/runtime/internal/admin/EntryRevisions.vue.d.ts +15 -0
- package/dist/runtime/internal/admin/MediaLibraryFilters.d.vue.ts +16 -0
- package/dist/runtime/internal/admin/MediaLibraryFilters.vue +153 -0
- package/dist/runtime/internal/admin/MediaLibraryFilters.vue.d.ts +16 -0
- package/dist/runtime/internal/admin/MediaLibraryModal.d.vue.ts +65 -0
- package/dist/runtime/internal/admin/MediaLibraryModal.vue +451 -0
- package/dist/runtime/internal/admin/MediaLibraryModal.vue.d.ts +65 -0
- package/dist/runtime/internal/admin/OptionPageForm.d.vue.ts +26 -0
- package/dist/runtime/internal/admin/OptionPageForm.vue +222 -0
- package/dist/runtime/internal/admin/OptionPageForm.vue.d.ts +26 -0
- package/dist/runtime/internal/admin/UserAvatarField.d.vue.ts +12 -0
- package/dist/runtime/internal/admin/UserAvatarField.vue +305 -0
- package/dist/runtime/internal/admin/UserAvatarField.vue.d.ts +12 -0
- package/dist/runtime/internal/fields/AccordionField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/AccordionField.vue +220 -0
- package/dist/runtime/internal/fields/AccordionField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ButtonGroupField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ButtonGroupField.vue +109 -0
- package/dist/runtime/internal/fields/ButtonGroupField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/CheckboxField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/CheckboxField.vue +190 -0
- package/dist/runtime/internal/fields/CheckboxField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ColorPickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ColorPickerField.vue +791 -0
- package/dist/runtime/internal/fields/ColorPickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/DatePickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/DatePickerField.vue +26 -0
- package/dist/runtime/internal/fields/DatePickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/DateTimePickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/DateTimePickerField.vue +26 -0
- package/dist/runtime/internal/fields/DateTimePickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/DictionaryField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/DictionaryField.vue +345 -0
- package/dist/runtime/internal/fields/DictionaryField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/EmailField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/EmailField.vue +21 -0
- package/dist/runtime/internal/fields/EmailField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/FileField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/FileField.vue +408 -0
- package/dist/runtime/internal/fields/FileField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/FlexibleContentField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/FlexibleContentField.vue +1114 -0
- package/dist/runtime/internal/fields/FlexibleContentField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/GalleryField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/GalleryField.vue +584 -0
- package/dist/runtime/internal/fields/GalleryField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/GroupField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/GroupField.vue +111 -0
- package/dist/runtime/internal/fields/GroupField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ImageField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ImageField.vue +638 -0
- package/dist/runtime/internal/fields/ImageField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ImageSelectField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ImageSelectField.vue +179 -0
- package/dist/runtime/internal/fields/ImageSelectField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/LinkField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/LinkField.vue +303 -0
- package/dist/runtime/internal/fields/LinkField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/NumberField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/NumberField.vue +25 -0
- package/dist/runtime/internal/fields/NumberField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/OembedField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/OembedField.vue +161 -0
- package/dist/runtime/internal/fields/OembedField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/OpenStreetMapField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/OpenStreetMapField.vue +1502 -0
- package/dist/runtime/internal/fields/OpenStreetMapField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/PageLinkField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/PageLinkField.vue +153 -0
- package/dist/runtime/internal/fields/PageLinkField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/PasswordField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/PasswordField.vue +108 -0
- package/dist/runtime/internal/fields/PasswordField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/PostObjectField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/PostObjectField.vue +151 -0
- package/dist/runtime/internal/fields/PostObjectField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RadioField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RadioField.vue +163 -0
- package/dist/runtime/internal/fields/RadioField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RangeField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RangeField.vue +48 -0
- package/dist/runtime/internal/fields/RangeField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RelationshipField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RelationshipField.vue +525 -0
- package/dist/runtime/internal/fields/RelationshipField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RepeaterField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RepeaterField.vue +856 -0
- package/dist/runtime/internal/fields/RepeaterField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/SelectField.d.vue.ts +21 -0
- package/dist/runtime/internal/fields/SelectField.vue +101 -0
- package/dist/runtime/internal/fields/SelectField.vue.d.ts +21 -0
- package/dist/runtime/internal/fields/SeparatorField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/SeparatorField.vue +63 -0
- package/dist/runtime/internal/fields/SeparatorField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TabField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TabField.vue +210 -0
- package/dist/runtime/internal/fields/TabField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TextField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TextField.vue +22 -0
- package/dist/runtime/internal/fields/TextField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TextareaField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TextareaField.vue +62 -0
- package/dist/runtime/internal/fields/TextareaField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TimePickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TimePickerField.vue +24 -0
- package/dist/runtime/internal/fields/TimePickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TrueFalseField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TrueFalseField.vue +151 -0
- package/dist/runtime/internal/fields/TrueFalseField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/UrlField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/UrlField.vue +21 -0
- package/dist/runtime/internal/fields/UrlField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/UserField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/UserField.vue +164 -0
- package/dist/runtime/internal/fields/UserField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/WysiwygField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/WysiwygField.vue +971 -0
- package/dist/runtime/internal/fields/WysiwygField.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/DateTimeControl.d.vue.ts +90 -0
- package/dist/runtime/internal/parts/DateTimeControl.vue +568 -0
- package/dist/runtime/internal/parts/DateTimeControl.vue.d.ts +90 -0
- package/dist/runtime/internal/parts/FieldAddon.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldAddon.vue +43 -0
- package/dist/runtime/internal/parts/FieldAddon.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/FieldInstructions.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldInstructions.vue +24 -0
- package/dist/runtime/internal/parts/FieldInstructions.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/FieldLabel.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldLabel.vue +40 -0
- package/dist/runtime/internal/parts/FieldLabel.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/FieldWrapper.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldWrapper.vue +47 -0
- package/dist/runtime/internal/parts/FieldWrapper.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/ImageCropper.d.vue.ts +17 -0
- package/dist/runtime/internal/parts/ImageCropper.vue +363 -0
- package/dist/runtime/internal/parts/ImageCropper.vue.d.ts +17 -0
- package/dist/runtime/internal/parts/InputControl.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/InputControl.vue +163 -0
- package/dist/runtime/internal/parts/InputControl.vue.d.ts +0 -0
- package/dist/runtime/internal/ui/UiButton.d.vue.ts +35 -0
- package/dist/runtime/internal/ui/UiButton.vue +204 -0
- package/dist/runtime/internal/ui/UiButton.vue.d.ts +35 -0
- package/dist/runtime/internal/ui/UiNotice.d.vue.ts +40 -0
- package/dist/runtime/internal/ui/UiNotice.vue +253 -0
- package/dist/runtime/internal/ui/UiNotice.vue.d.ts +40 -0
- package/dist/runtime/internal/ui/UiSelect.d.vue.ts +61 -0
- package/dist/runtime/internal/ui/UiSelect.vue +1212 -0
- package/dist/runtime/internal/ui/UiSelect.vue.d.ts +61 -0
- package/dist/runtime/middleware/auth-guard.d.ts +9 -0
- package/dist/runtime/middleware/auth-guard.js +37 -0
- package/dist/runtime/pages/admin/collections/[id].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/collections/[id].vue +423 -0
- package/dist/runtime/pages/admin/collections/[id].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/collections/create.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/collections/create.vue +179 -0
- package/dist/runtime/pages/admin/collections/create.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/collections/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/collections/index.vue +828 -0
- package/dist/runtime/pages/admin/collections/index.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/demo-fields.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/demo-fields.vue +1327 -0
- package/dist/runtime/pages/admin/demo-fields.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/[id].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/[id].vue +213 -0
- package/dist/runtime/pages/admin/dictionaries/[id].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/index.vue +387 -0
- package/dist/runtime/pages/admin/dictionaries/index.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/index.vue +138 -0
- package/dist/runtime/pages/admin/index.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/login.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/login.vue +373 -0
- package/dist/runtime/pages/admin/login.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/media.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/media.vue +1054 -0
- package/dist/runtime/pages/admin/media.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/options/[page].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/options/[page].vue +151 -0
- package/dist/runtime/pages/admin/options/[page].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/register.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/register.vue +391 -0
- package/dist/runtime/pages/admin/register.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/users/[id].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/users/[id].vue +337 -0
- package/dist/runtime/pages/admin/users/[id].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/users/create.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/users/create.vue +201 -0
- package/dist/runtime/pages/admin/users/create.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/users/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/users/index.vue +329 -0
- package/dist/runtime/pages/admin/users/index.vue.d.ts +3 -0
- package/dist/runtime/pages/index.d.vue.ts +3 -0
- package/dist/runtime/pages/index.vue +399 -0
- package/dist/runtime/pages/index.vue.d.ts +3 -0
- package/dist/runtime/server/api/_katecms/auth/login.post.d.ts +5 -0
- package/dist/runtime/server/api/_katecms/auth/login.post.js +44 -0
- package/dist/runtime/server/api/_katecms/auth/logout.post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/auth/logout.post.js +6 -0
- package/dist/runtime/server/api/_katecms/auth/register.post.d.ts +19 -0
- package/dist/runtime/server/api/_katecms/auth/register.post.js +83 -0
- package/dist/runtime/server/api/_katecms/auth/state.get.d.ts +9 -0
- package/dist/runtime/server/api/_katecms/auth/state.get.js +12 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].delete.d.ts +15 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].delete.js +59 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].get.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].get.js +50 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].patch.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].patch.js +130 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions/[revisionId].post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions/[revisionId].post.js +123 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions.get.d.ts +6 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions.get.js +31 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].get.d.ts +8 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].get.js +135 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].post.js +91 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].delete.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].delete.js +31 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].get.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].get.js +45 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].patch.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].patch.js +83 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].get.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].get.js +38 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].post.js +64 -0
- package/dist/runtime/server/api/_katecms/media/[id]/regenerate.post.d.ts +8 -0
- package/dist/runtime/server/api/_katecms/media/[id]/regenerate.post.js +30 -0
- package/dist/runtime/server/api/_katecms/media/[id].delete.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/media/[id].delete.js +22 -0
- package/dist/runtime/server/api/_katecms/media/[id].get.d.ts +9 -0
- package/dist/runtime/server/api/_katecms/media/[id].get.js +17 -0
- package/dist/runtime/server/api/_katecms/media/[id].patch.d.ts +6 -0
- package/dist/runtime/server/api/_katecms/media/[id].patch.js +48 -0
- package/dist/runtime/server/api/_katecms/media/index.get.d.ts +5 -0
- package/dist/runtime/server/api/_katecms/media/index.get.js +75 -0
- package/dist/runtime/server/api/_katecms/media/index.post.d.ts +9 -0
- package/dist/runtime/server/api/_katecms/media/index.post.js +84 -0
- package/dist/runtime/server/api/_katecms/media/regenerate.post.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/media/regenerate.post.js +30 -0
- package/dist/runtime/server/api/_katecms/menu.get.d.ts +8 -0
- package/dist/runtime/server/api/_katecms/menu.get.js +14 -0
- package/dist/runtime/server/api/_katecms/oembed.get.d.ts +2 -0
- package/dist/runtime/server/api/_katecms/oembed.get.js +53 -0
- package/dist/runtime/server/api/_katecms/options/[page].get.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/options/[page].get.js +28 -0
- package/dist/runtime/server/api/_katecms/options/[page].patch.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/options/[page].patch.js +36 -0
- package/dist/runtime/server/api/_katecms/query.get.d.ts +24 -0
- package/dist/runtime/server/api/_katecms/query.get.js +270 -0
- package/dist/runtime/server/api/_katecms/relation/entries.get.d.ts +17 -0
- package/dist/runtime/server/api/_katecms/relation/entries.get.js +74 -0
- package/dist/runtime/server/api/_katecms/relation/terms.get.d.ts +17 -0
- package/dist/runtime/server/api/_katecms/relation/terms.get.js +51 -0
- package/dist/runtime/server/api/_katecms/resolve.get.d.ts +17 -0
- package/dist/runtime/server/api/_katecms/resolve.get.js +116 -0
- package/dist/runtime/server/api/_katecms/terms.get.d.ts +20 -0
- package/dist/runtime/server/api/_katecms/terms.get.js +201 -0
- package/dist/runtime/server/api/_katecms/users/[id].delete.d.ts +11 -0
- package/dist/runtime/server/api/_katecms/users/[id].delete.js +45 -0
- package/dist/runtime/server/api/_katecms/users/[id].patch.d.ts +19 -0
- package/dist/runtime/server/api/_katecms/users/[id].patch.js +129 -0
- package/dist/runtime/server/api/_katecms/users.get.d.ts +10 -0
- package/dist/runtime/server/api/_katecms/users.get.js +34 -0
- package/dist/runtime/server/api/_katecms/users.post.d.ts +10 -0
- package/dist/runtime/server/api/_katecms/users.post.js +62 -0
- package/dist/runtime/server/api/uploads/[...key].get.d.ts +3 -0
- package/dist/runtime/server/api/uploads/[...key].get.js +28 -0
- package/dist/runtime/server/kit.d.ts +5 -0
- package/dist/runtime/server/kit.js +5 -0
- package/dist/runtime/server/middleware/admin-headers.d.ts +3 -0
- package/dist/runtime/server/middleware/admin-headers.js +12 -0
- package/dist/runtime/server/plugins/auto-migrate.d.ts +2 -0
- package/dist/runtime/server/plugins/auto-migrate.js +45 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/utils/auth-attempts.d.ts +22 -0
- package/dist/runtime/server/utils/auth-attempts.js +42 -0
- package/dist/runtime/server/utils/auth-rate-limit.d.ts +11 -0
- package/dist/runtime/server/utils/auth-rate-limit.js +36 -0
- package/dist/runtime/server/utils/client-address.d.ts +16 -0
- package/dist/runtime/server/utils/client-address.js +23 -0
- package/dist/runtime/server/utils/collections.d.ts +42 -0
- package/dist/runtime/server/utils/collections.js +300 -0
- package/dist/runtime/server/utils/db.d.ts +3 -0
- package/dist/runtime/server/utils/db.js +25 -0
- package/dist/runtime/server/utils/dictionaries.d.ts +53 -0
- package/dist/runtime/server/utils/dictionaries.js +301 -0
- package/dist/runtime/server/utils/media-list.d.ts +18 -0
- package/dist/runtime/server/utils/media-list.js +84 -0
- package/dist/runtime/server/utils/media.d.ts +12 -0
- package/dist/runtime/server/utils/media.js +77 -0
- package/dist/runtime/server/utils/oembed-fetch.d.ts +4 -0
- package/dist/runtime/server/utils/oembed-fetch.js +142 -0
- package/dist/runtime/server/utils/options.d.ts +17 -0
- package/dist/runtime/server/utils/options.js +66 -0
- package/dist/runtime/server/utils/permissions.d.ts +13 -0
- package/dist/runtime/server/utils/permissions.js +20 -0
- package/dist/runtime/server/utils/public-fields-query.d.ts +6 -0
- package/dist/runtime/server/utils/public-fields-query.js +8 -0
- package/dist/runtime/server/utils/public-term.d.ts +8 -0
- package/dist/runtime/server/utils/public-term.js +80 -0
- package/dist/runtime/server/utils/regenerate.d.ts +12 -0
- package/dist/runtime/server/utils/regenerate.js +40 -0
- package/dist/runtime/server/utils/relation.d.ts +18 -0
- package/dist/runtime/server/utils/relation.js +77 -0
- package/dist/runtime/server/utils/request-address.d.ts +6 -0
- package/dist/runtime/server/utils/request-address.js +10 -0
- package/dist/runtime/server/utils/revisions.d.ts +20 -0
- package/dist/runtime/server/utils/revisions.js +172 -0
- package/dist/runtime/server/utils/session.d.ts +18 -0
- package/dist/runtime/server/utils/session.js +71 -0
- package/dist/runtime/server/utils/upload-headers.d.ts +2 -0
- package/dist/runtime/server/utils/upload-headers.js +30 -0
- package/dist/runtime/server/utils/users.d.ts +13 -0
- package/dist/runtime/server/utils/users.js +47 -0
- package/dist/runtime/utils/admin-users.d.ts +20 -0
- package/dist/runtime/utils/admin-users.js +19 -0
- package/dist/runtime/utils/auth-error.d.ts +6 -0
- package/dist/runtime/utils/auth-error.js +11 -0
- package/dist/runtime/utils/cms-paths.d.ts +5 -0
- package/dist/runtime/utils/cms-paths.js +13 -0
- package/dist/runtime/utils/collections.d.ts +176 -0
- package/dist/runtime/utils/collections.js +30 -0
- package/dist/runtime/utils/dictionaries.d.ts +65 -0
- package/dist/runtime/utils/dictionaries.js +14 -0
- package/dist/runtime/utils/field-errors.d.ts +4 -0
- package/dist/runtime/utils/field-errors.js +9 -0
- package/dist/runtime/utils/field-values.d.ts +19 -0
- package/dist/runtime/utils/field-values.js +82 -0
- package/dist/runtime/utils/helpers.d.ts +4 -0
- package/dist/runtime/utils/helpers.js +20 -0
- package/dist/runtime/utils/media-library-query.d.ts +54 -0
- package/dist/runtime/utils/media-library-query.js +190 -0
- package/dist/runtime/utils/options.d.ts +19 -0
- package/dist/runtime/utils/options.js +3 -0
- package/dist/runtime/utils/preview.d.ts +22 -0
- package/dist/runtime/utils/preview.js +33 -0
- package/dist/runtime/utils/relation.d.ts +33 -0
- package/dist/runtime/utils/relation.js +23 -0
- package/dist/runtime/utils/slugify.d.ts +2 -0
- package/dist/runtime/utils/slugify.js +4 -0
- package/dist/types.d.mts +7 -0
- package/package.json +84 -3
- package/src/admin-components.ts +124 -0
- package/src/module.ts +592 -0
- package/src/runtime/assets/img/katecms-logo.svg +17 -0
- package/src/runtime/assets/styles/_functions.scss +70 -0
- package/src/runtime/assets/styles/_index.scss +3 -0
- package/src/runtime/assets/styles/_mixins.scss +256 -0
- package/src/runtime/assets/styles/_variables.scss +35 -0
- package/src/runtime/composables/getCollection.ts +253 -0
- package/src/runtime/composables/getOptions.ts +42 -0
- package/src/runtime/composables/getQueryCollection.ts +325 -0
- package/src/runtime/composables/getTerms.ts +231 -0
- package/src/runtime/composables/useAuth.ts +43 -0
- package/src/runtime/composables/useAuthCooldown.ts +52 -0
- package/src/runtime/composables/useCmsPaths.ts +24 -0
- package/src/runtime/composables/useKateCmsExtensions.ts +81 -0
- package/src/runtime/composables/useMediaLibrary.ts +168 -0
- package/src/runtime/composables/useMenuAccess.ts +25 -0
- package/src/runtime/internal/admin/AdminHeader.vue +106 -0
- package/src/runtime/internal/admin/AppMenu.vue +290 -0
- package/src/runtime/internal/admin/AppUser.vue +260 -0
- package/src/runtime/internal/admin/CollectionEntryForm.vue +1044 -0
- package/src/runtime/internal/admin/ConfirmDialog.vue +164 -0
- package/src/runtime/internal/admin/DictionaryTermForm.vue +400 -0
- package/src/runtime/internal/admin/EntryRevisions.vue +145 -0
- package/src/runtime/internal/admin/MediaLibraryFilters.vue +186 -0
- package/src/runtime/internal/admin/MediaLibraryModal.vue +526 -0
- package/src/runtime/internal/admin/OptionPageForm.vue +277 -0
- package/src/runtime/internal/admin/UserAvatarField.vue +337 -0
- package/src/runtime/internal/fields/AccordionField.vue +258 -0
- package/src/runtime/internal/fields/ButtonGroupField.vue +144 -0
- package/src/runtime/internal/fields/CheckboxField.vue +228 -0
- package/src/runtime/internal/fields/ColorPickerField.vue +926 -0
- package/src/runtime/internal/fields/DatePickerField.vue +33 -0
- package/src/runtime/internal/fields/DateTimePickerField.vue +33 -0
- package/src/runtime/internal/fields/DictionaryField.vue +403 -0
- package/src/runtime/internal/fields/EmailField.vue +28 -0
- package/src/runtime/internal/fields/FileField.vue +480 -0
- package/src/runtime/internal/fields/FlexibleContentField.vue +1296 -0
- package/src/runtime/internal/fields/GalleryField.vue +677 -0
- package/src/runtime/internal/fields/GroupField.vue +136 -0
- package/src/runtime/internal/fields/ImageField.vue +730 -0
- package/src/runtime/internal/fields/ImageSelectField.vue +213 -0
- package/src/runtime/internal/fields/LinkField.vue +338 -0
- package/src/runtime/internal/fields/NumberField.vue +32 -0
- package/src/runtime/internal/fields/OembedField.vue +187 -0
- package/src/runtime/internal/fields/OpenStreetMapField.vue +1716 -0
- package/src/runtime/internal/fields/PageLinkField.vue +186 -0
- package/src/runtime/internal/fields/PasswordField.vue +127 -0
- package/src/runtime/internal/fields/PostObjectField.vue +187 -0
- package/src/runtime/internal/fields/RadioField.vue +195 -0
- package/src/runtime/internal/fields/RangeField.vue +62 -0
- package/src/runtime/internal/fields/RelationshipField.vue +604 -0
- package/src/runtime/internal/fields/RepeaterField.vue +999 -0
- package/src/runtime/internal/fields/SelectField.vue +118 -0
- package/src/runtime/internal/fields/SeparatorField.vue +77 -0
- package/src/runtime/internal/fields/TabField.vue +249 -0
- package/src/runtime/internal/fields/TextField.vue +29 -0
- package/src/runtime/internal/fields/TextareaField.vue +61 -0
- package/src/runtime/internal/fields/TimePickerField.vue +31 -0
- package/src/runtime/internal/fields/TrueFalseField.vue +181 -0
- package/src/runtime/internal/fields/UrlField.vue +28 -0
- package/src/runtime/internal/fields/UserField.vue +203 -0
- package/src/runtime/internal/fields/WysiwygField.vue +1061 -0
- package/src/runtime/internal/parts/DateTimeControl.vue +657 -0
- package/src/runtime/internal/parts/FieldAddon.vue +60 -0
- package/src/runtime/internal/parts/FieldInstructions.vue +38 -0
- package/src/runtime/internal/parts/FieldLabel.vue +56 -0
- package/src/runtime/internal/parts/FieldWrapper.vue +63 -0
- package/src/runtime/internal/parts/ImageCropper.vue +415 -0
- package/src/runtime/internal/parts/InputControl.vue +189 -0
- package/src/runtime/internal/ui/UiButton.vue +274 -0
- package/src/runtime/internal/ui/UiNotice.vue +302 -0
- package/src/runtime/internal/ui/UiSelect.vue +1420 -0
- package/src/runtime/middleware/auth-guard.ts +52 -0
- package/src/runtime/pages/admin/collections/[id].vue +486 -0
- package/src/runtime/pages/admin/collections/create.vue +208 -0
- package/src/runtime/pages/admin/collections/index.vue +955 -0
- package/src/runtime/pages/admin/demo-fields.vue +1354 -0
- package/src/runtime/pages/admin/dictionaries/[id].vue +246 -0
- package/src/runtime/pages/admin/dictionaries/index.vue +438 -0
- package/src/runtime/pages/admin/index.vue +155 -0
- package/src/runtime/pages/admin/login.vue +159 -0
- package/src/runtime/pages/admin/media.vue +1176 -0
- package/src/runtime/pages/admin/options/[page].vue +174 -0
- package/src/runtime/pages/admin/register.vue +179 -0
- package/src/runtime/pages/admin/users/[id].vue +382 -0
- package/src/runtime/pages/admin/users/create.vue +232 -0
- package/src/runtime/pages/admin/users/index.vue +374 -0
- package/src/runtime/pages/index.vue +265 -0
- package/src/runtime/server/api/_katecms/auth/login.post.ts +62 -0
- package/src/runtime/server/api/_katecms/auth/logout.post.ts +7 -0
- package/src/runtime/server/api/_katecms/auth/register.post.ts +112 -0
- package/src/runtime/server/api/_katecms/auth/state.get.ts +19 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/[id].delete.ts +77 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/[id].get.ts +57 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/[id].patch.ts +157 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/revisions/[revisionId].post.ts +133 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/revisions.get.ts +35 -0
- package/src/runtime/server/api/_katecms/collections/[collection].get.ts +177 -0
- package/src/runtime/server/api/_katecms/collections/[collection].post.ts +111 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].delete.ts +37 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].get.ts +51 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].patch.ts +101 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary].get.ts +43 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary].post.ts +78 -0
- package/src/runtime/server/api/_katecms/media/[id]/regenerate.post.ts +39 -0
- package/src/runtime/server/api/_katecms/media/[id].delete.ts +28 -0
- package/src/runtime/server/api/_katecms/media/[id].get.ts +25 -0
- package/src/runtime/server/api/_katecms/media/[id].patch.ts +60 -0
- package/src/runtime/server/api/_katecms/media/index.get.ts +96 -0
- package/src/runtime/server/api/_katecms/media/index.post.ts +104 -0
- package/src/runtime/server/api/_katecms/media/regenerate.post.ts +38 -0
- package/src/runtime/server/api/_katecms/menu.get.ts +19 -0
- package/src/runtime/server/api/_katecms/oembed.get.ts +62 -0
- package/src/runtime/server/api/_katecms/options/[page].get.ts +35 -0
- package/src/runtime/server/api/_katecms/options/[page].patch.ts +46 -0
- package/src/runtime/server/api/_katecms/query.get.ts +332 -0
- package/src/runtime/server/api/_katecms/relation/entries.get.ts +98 -0
- package/src/runtime/server/api/_katecms/relation/terms.get.ts +61 -0
- package/src/runtime/server/api/_katecms/resolve.get.ts +148 -0
- package/src/runtime/server/api/_katecms/terms.get.ts +258 -0
- package/src/runtime/server/api/_katecms/users/[id].delete.ts +57 -0
- package/src/runtime/server/api/_katecms/users/[id].patch.ts +177 -0
- package/src/runtime/server/api/_katecms/users.get.ts +48 -0
- package/src/runtime/server/api/_katecms/users.post.ts +85 -0
- package/src/runtime/server/api/uploads/[...key].get.ts +33 -0
- package/src/runtime/server/kit.ts +5 -0
- package/src/runtime/server/middleware/admin-headers.ts +14 -0
- package/src/runtime/server/plugins/auto-migrate.ts +53 -0
- package/src/runtime/server/tsconfig.json +3 -0
- package/src/runtime/server/utils/auth-attempts.ts +71 -0
- package/src/runtime/server/utils/auth-rate-limit.ts +48 -0
- package/src/runtime/server/utils/client-address.ts +41 -0
- package/src/runtime/server/utils/collections.ts +381 -0
- package/src/runtime/server/utils/db.ts +36 -0
- package/src/runtime/server/utils/dictionaries.ts +397 -0
- package/src/runtime/server/utils/media-list.ts +131 -0
- package/src/runtime/server/utils/media.ts +94 -0
- package/src/runtime/server/utils/oembed-fetch.ts +157 -0
- package/src/runtime/server/utils/options.ts +86 -0
- package/src/runtime/server/utils/permissions.ts +44 -0
- package/src/runtime/server/utils/public-fields-query.ts +14 -0
- package/src/runtime/server/utils/public-term.ts +98 -0
- package/src/runtime/server/utils/regenerate.ts +56 -0
- package/src/runtime/server/utils/relation.ts +96 -0
- package/src/runtime/server/utils/request-address.ts +16 -0
- package/src/runtime/server/utils/revisions.ts +256 -0
- package/src/runtime/server/utils/session.ts +112 -0
- package/src/runtime/server/utils/upload-headers.ts +35 -0
- package/src/runtime/server/utils/users.ts +67 -0
- package/src/runtime/utils/admin-users.ts +43 -0
- package/src/runtime/utils/auth-error.ts +22 -0
- package/src/runtime/utils/cms-paths.ts +17 -0
- package/src/runtime/utils/collections.ts +228 -0
- package/src/runtime/utils/dictionaries.ts +89 -0
- package/src/runtime/utils/field-errors.ts +12 -0
- package/src/runtime/utils/field-values.ts +101 -0
- package/src/runtime/utils/helpers.ts +33 -0
- package/src/runtime/utils/media-library-query.ts +263 -0
- package/src/runtime/utils/options.ts +25 -0
- package/src/runtime/utils/preview.ts +56 -0
- package/src/runtime/utils/relation.ts +60 -0
- package/src/runtime/utils/slugify.ts +10 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Field } from '@katecms/core'
|
|
3
|
+
|
|
4
|
+
const rootClass = 'katecms-range-field'
|
|
5
|
+
|
|
6
|
+
type RangeFieldConfig = Extract<Field, { type: 'range' }>
|
|
7
|
+
|
|
8
|
+
withDefaults(defineProps<{
|
|
9
|
+
fieldKey: string
|
|
10
|
+
field?: RangeFieldConfig
|
|
11
|
+
}>(), {
|
|
12
|
+
field: () => ({ type: 'range', label: '' }),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const model = defineModel<number>()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<KateCmsFieldWrapper
|
|
20
|
+
:field-key="fieldKey"
|
|
21
|
+
:field="field"
|
|
22
|
+
>
|
|
23
|
+
<KateCmsInputControl
|
|
24
|
+
v-model="model"
|
|
25
|
+
type="range"
|
|
26
|
+
numeric
|
|
27
|
+
:field-key="fieldKey"
|
|
28
|
+
:field="field"
|
|
29
|
+
:min="field?.min ?? undefined"
|
|
30
|
+
:max="field?.max ?? undefined"
|
|
31
|
+
:step="field?.step ?? undefined"
|
|
32
|
+
>
|
|
33
|
+
<template #append>
|
|
34
|
+
<div :class="`${rootClass}__value`">
|
|
35
|
+
{{ `${model} / ${field?.max ?? '100'}` }}
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
</KateCmsInputControl>
|
|
39
|
+
</KateCmsFieldWrapper>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style scoped lang="scss">
|
|
43
|
+
@use "../../assets/styles" as *;
|
|
44
|
+
|
|
45
|
+
$root: '.katecms-range-field';
|
|
46
|
+
|
|
47
|
+
#{$root} {
|
|
48
|
+
&__value {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
left: 50%;
|
|
52
|
+
transform: translateX(-50%);
|
|
53
|
+
font-variant-numeric: tabular-nums;
|
|
54
|
+
font-size: math-rem(11);
|
|
55
|
+
line-height: 1.2;
|
|
56
|
+
color: $color-muted;
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
min-width: 20px;
|
|
59
|
+
text-align: center;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref } from 'vue'
|
|
3
|
+
import { useRuntimeConfig } from '#imports'
|
|
4
|
+
import {
|
|
5
|
+
encodeRelationEntryValue,
|
|
6
|
+
isImageMedia,
|
|
7
|
+
isRelationEntryValue,
|
|
8
|
+
relationFieldIds,
|
|
9
|
+
} from '@katecms/core'
|
|
10
|
+
import type { Field, SelectChoice, SelectModelValue } from '@katecms/core'
|
|
11
|
+
import type { PublicCollectionNav } from '../../utils/collections'
|
|
12
|
+
import type { PublicDictionaryNav } from '../../utils/dictionaries'
|
|
13
|
+
import { relationEntriesApi, relationTermsApi } from '../../utils/relation'
|
|
14
|
+
import type { RelationEntriesResponse, RelationPickerEntry, RelationTermsResponse } from '../../utils/relation'
|
|
15
|
+
|
|
16
|
+
type RelationshipFieldConfig = Extract<Field, { type: 'relationship' }>
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(defineProps<{
|
|
19
|
+
fieldKey: string
|
|
20
|
+
field?: RelationshipFieldConfig
|
|
21
|
+
}>(), {
|
|
22
|
+
field: () => ({ type: 'relationship', label: '' }),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const model = defineModel<unknown>()
|
|
26
|
+
|
|
27
|
+
const rootClass = 'katecms-relationship-field'
|
|
28
|
+
const collectionsNav = (useRuntimeConfig().public.katecms?.collections ?? {}) as Record<string, PublicCollectionNav>
|
|
29
|
+
const dictionariesNav = (useRuntimeConfig().public.katecms?.dictionaries ?? {}) as Record<string, PublicDictionaryNav>
|
|
30
|
+
|
|
31
|
+
function entriesFromModel(value: unknown): RelationPickerEntry[] {
|
|
32
|
+
const items = Array.isArray(value) ? value : value != null && value !== '' ? [value] : []
|
|
33
|
+
return items.filter(isRelationEntryValue)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const entries = ref<RelationPickerEntry[]>(entriesFromModel(model.value))
|
|
37
|
+
const termsByDictionary = ref<Record<string, RelationTermsResponse['terms']>>({})
|
|
38
|
+
const loading = ref(false)
|
|
39
|
+
const loadError = ref<string | null>(null)
|
|
40
|
+
const search = ref('')
|
|
41
|
+
const postTypeFilter = ref('')
|
|
42
|
+
const termFilter = ref('')
|
|
43
|
+
|
|
44
|
+
const filters = computed(() => props.field?.filters ?? ['search'])
|
|
45
|
+
const showSearch = computed(() => filters.value.includes('search'))
|
|
46
|
+
const showPostType = computed(() => (
|
|
47
|
+
filters.value.includes('post_type') && collectionChoices.value.length > 1
|
|
48
|
+
))
|
|
49
|
+
const showDictionary = computed(() => (
|
|
50
|
+
filters.value.includes('dictionary') && dictionarySlugs.value.length > 0
|
|
51
|
+
))
|
|
52
|
+
const imageFieldKeys = computed(() => (
|
|
53
|
+
(props.field?.elements ?? []).map(key => key.trim()).filter(Boolean)
|
|
54
|
+
))
|
|
55
|
+
const showFeatured = computed(() => imageFieldKeys.value.length > 0)
|
|
56
|
+
|
|
57
|
+
const collectionChoices = computed<SelectChoice[]>(() => {
|
|
58
|
+
const slugs = props.field?.postType?.length
|
|
59
|
+
? props.field.postType
|
|
60
|
+
: Object.keys(collectionsNav)
|
|
61
|
+
return slugs
|
|
62
|
+
.filter(slug => slug in collectionsNav || (props.field?.postType ?? []).includes(slug))
|
|
63
|
+
.map(slug => ({
|
|
64
|
+
val: slug,
|
|
65
|
+
lbl: collectionsNav[slug]?.labels?.name || slug,
|
|
66
|
+
}))
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const dictionarySlugs = computed(() => {
|
|
70
|
+
if (props.field?.dictionary?.length) {
|
|
71
|
+
return props.field.dictionary
|
|
72
|
+
}
|
|
73
|
+
return Object.keys(dictionariesNav)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const termChoices = computed<SelectChoice[]>(() => {
|
|
77
|
+
const choices: SelectChoice[] = []
|
|
78
|
+
for (const slug of dictionarySlugs.value) {
|
|
79
|
+
const terms = termsByDictionary.value[slug] ?? []
|
|
80
|
+
const group = dictionariesNav[slug]?.labels?.name || slug
|
|
81
|
+
for (const term of terms) {
|
|
82
|
+
const depth = term.depth ?? 0
|
|
83
|
+
const title = depth < 1 ? term.title : `${'— '.repeat(depth)}${term.title}`
|
|
84
|
+
choices.push({
|
|
85
|
+
val: String(term.id),
|
|
86
|
+
lbl: dictionarySlugs.value.length > 1 ? `${group}: ${title}` : title,
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return choices
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const selectedIds = computed(() => relationFieldIds(model.value))
|
|
94
|
+
|
|
95
|
+
const selectedEntries = computed(() => {
|
|
96
|
+
return selectedIds.value
|
|
97
|
+
.map(id => entries.value.find(entry => String(entry.id) === id))
|
|
98
|
+
.filter((entry): entry is RelationPickerEntry => !!entry)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const availableEntries = computed(() => {
|
|
102
|
+
const selected = new Set(selectedIds.value)
|
|
103
|
+
const q = search.value.trim().toLowerCase()
|
|
104
|
+
const type = postTypeFilter.value
|
|
105
|
+
const termId = termFilter.value
|
|
106
|
+
return entries.value.filter((entry) => {
|
|
107
|
+
if (selected.has(String(entry.id))) {
|
|
108
|
+
return false
|
|
109
|
+
}
|
|
110
|
+
if (type && entry.type !== type) {
|
|
111
|
+
return false
|
|
112
|
+
}
|
|
113
|
+
if (termId && !(entry.termIds ?? []).includes(Number(termId))) {
|
|
114
|
+
return false
|
|
115
|
+
}
|
|
116
|
+
if (q) {
|
|
117
|
+
const haystack = `${entry.title} ${entry.slug} ${entry.slugPath}`.toLowerCase()
|
|
118
|
+
if (!haystack.includes(q)) {
|
|
119
|
+
return false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return true
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const atMax = computed(() => {
|
|
127
|
+
const max = props.field?.max
|
|
128
|
+
return typeof max === 'number' && max > 0 && selectedIds.value.length >= max
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const belowMin = computed(() => {
|
|
132
|
+
const min = props.field?.min
|
|
133
|
+
return typeof min === 'number' && min > 0 && selectedIds.value.length < min
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
function collectionLabel(slug: string): string {
|
|
137
|
+
return collectionsNav[slug]?.labels?.singularName
|
|
138
|
+
|| collectionsNav[slug]?.labels?.name
|
|
139
|
+
|| slug
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function thumbUrl(entry: RelationPickerEntry): string | undefined {
|
|
143
|
+
const image = entry.featuredImage
|
|
144
|
+
return image && isImageMedia(image) ? image.url : undefined
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function findEntry(id: string): RelationPickerEntry | undefined {
|
|
148
|
+
return entries.value.find(entry => String(entry.id) === id)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function commit(ids: string[]) {
|
|
152
|
+
const max = props.field?.max
|
|
153
|
+
const next = typeof max === 'number' && max > 0 ? ids.slice(0, max) : ids
|
|
154
|
+
model.value = next
|
|
155
|
+
.map(id => findEntry(id))
|
|
156
|
+
.filter((entry): entry is RelationPickerEntry => !!entry)
|
|
157
|
+
.map(entry => encodeRelationEntryValue(entry, props.field?.returnFormat))
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function addEntry(entry: RelationPickerEntry) {
|
|
161
|
+
if (atMax.value) {
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
const id = String(entry.id)
|
|
165
|
+
if (selectedIds.value.includes(id)) {
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
commit([...selectedIds.value, id])
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function removeEntry(id: string) {
|
|
172
|
+
commit(selectedIds.value.filter(item => item !== id))
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function moveEntry(id: string, delta: number) {
|
|
176
|
+
const ids = [...selectedIds.value]
|
|
177
|
+
const index = ids.indexOf(id)
|
|
178
|
+
const next = index + delta
|
|
179
|
+
if (index < 0 || next < 0 || next >= ids.length) {
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
const [item] = ids.splice(index, 1)
|
|
183
|
+
ids.splice(next, 0, item)
|
|
184
|
+
commit(ids)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const postTypeModel = computed<SelectModelValue>({
|
|
188
|
+
get: () => postTypeFilter.value,
|
|
189
|
+
set: (raw) => {
|
|
190
|
+
postTypeFilter.value = raw == null ? '' : String(raw)
|
|
191
|
+
},
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
const termModel = computed<SelectModelValue>({
|
|
195
|
+
get: () => termFilter.value,
|
|
196
|
+
set: (raw) => {
|
|
197
|
+
termFilter.value = raw == null ? '' : String(raw)
|
|
198
|
+
},
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
async function load() {
|
|
202
|
+
loading.value = true
|
|
203
|
+
loadError.value = null
|
|
204
|
+
try {
|
|
205
|
+
const res = await $fetch<RelationEntriesResponse>(relationEntriesApi({
|
|
206
|
+
postType: props.field?.postType,
|
|
207
|
+
elements: imageFieldKeys.value,
|
|
208
|
+
}))
|
|
209
|
+
const byId = new Map(res.entries.map(entry => [entry.id, entry]))
|
|
210
|
+
for (const existing of entries.value) {
|
|
211
|
+
if (!byId.has(existing.id)) {
|
|
212
|
+
byId.set(existing.id, existing)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
entries.value = [...byId.values()]
|
|
216
|
+
|
|
217
|
+
if (showDictionary.value) {
|
|
218
|
+
const loaded = await Promise.all(dictionarySlugs.value.map(async (slug) => {
|
|
219
|
+
try {
|
|
220
|
+
const terms = await $fetch<RelationTermsResponse>(relationTermsApi(slug))
|
|
221
|
+
return [slug, terms.terms] as const
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
return [slug, []] as const
|
|
225
|
+
}
|
|
226
|
+
}))
|
|
227
|
+
termsByDictionary.value = Object.fromEntries(loaded)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
loadError.value = 'Could not load entries.'
|
|
232
|
+
}
|
|
233
|
+
finally {
|
|
234
|
+
loading.value = false
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
onMounted(() => {
|
|
239
|
+
void load()
|
|
240
|
+
})
|
|
241
|
+
</script>
|
|
242
|
+
|
|
243
|
+
<template>
|
|
244
|
+
<KateCmsFieldWrapper
|
|
245
|
+
:field-key="fieldKey"
|
|
246
|
+
:field="field"
|
|
247
|
+
label-tag="div"
|
|
248
|
+
>
|
|
249
|
+
<div :class="rootClass">
|
|
250
|
+
<div
|
|
251
|
+
v-if="loadError"
|
|
252
|
+
:class="`${rootClass}__error`"
|
|
253
|
+
>
|
|
254
|
+
{{ loadError }}
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
<div
|
|
258
|
+
v-if="showSearch || showPostType || showDictionary"
|
|
259
|
+
:class="`${rootClass}__filters`"
|
|
260
|
+
>
|
|
261
|
+
<input
|
|
262
|
+
v-if="showSearch"
|
|
263
|
+
v-model="search"
|
|
264
|
+
type="search"
|
|
265
|
+
:class="`${rootClass}__search`"
|
|
266
|
+
placeholder="Search entries"
|
|
267
|
+
aria-label="Search entries"
|
|
268
|
+
:disabled="loading"
|
|
269
|
+
>
|
|
270
|
+
<div
|
|
271
|
+
v-if="showPostType"
|
|
272
|
+
:class="`${rootClass}__filter`"
|
|
273
|
+
>
|
|
274
|
+
<KateCmsUiSelect
|
|
275
|
+
:id="`${fieldKey}_post_type`"
|
|
276
|
+
v-model="postTypeModel"
|
|
277
|
+
:choices="collectionChoices"
|
|
278
|
+
placeholder="All types"
|
|
279
|
+
selected-opt-clearable
|
|
280
|
+
search
|
|
281
|
+
search-placeholder="Filter type"
|
|
282
|
+
:disabled="loading"
|
|
283
|
+
aria-label="Collection type"
|
|
284
|
+
/>
|
|
285
|
+
</div>
|
|
286
|
+
<div
|
|
287
|
+
v-if="showDictionary"
|
|
288
|
+
:class="`${rootClass}__filter`"
|
|
289
|
+
>
|
|
290
|
+
<KateCmsUiSelect
|
|
291
|
+
:id="`${fieldKey}_term`"
|
|
292
|
+
v-model="termModel"
|
|
293
|
+
:choices="termChoices"
|
|
294
|
+
placeholder="All terms"
|
|
295
|
+
selected-opt-clearable
|
|
296
|
+
search
|
|
297
|
+
search-placeholder="Filter term"
|
|
298
|
+
:disabled="loading"
|
|
299
|
+
aria-label="Dictionary term"
|
|
300
|
+
/>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
|
|
304
|
+
<div
|
|
305
|
+
v-if="belowMin"
|
|
306
|
+
:class="`${rootClass}__hint`"
|
|
307
|
+
>
|
|
308
|
+
Select at least {{ field?.min }}.
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div :class="`${rootClass}__columns`">
|
|
312
|
+
<div :class="`${rootClass}__column`">
|
|
313
|
+
<div :class="`${rootClass}__column-title`">
|
|
314
|
+
Available
|
|
315
|
+
</div>
|
|
316
|
+
<div :class="`${rootClass}__list`">
|
|
317
|
+
<div
|
|
318
|
+
v-for="entry in availableEntries"
|
|
319
|
+
:key="entry.id"
|
|
320
|
+
>
|
|
321
|
+
<button
|
|
322
|
+
type="button"
|
|
323
|
+
:class="`${rootClass}__item`"
|
|
324
|
+
:disabled="loading || atMax"
|
|
325
|
+
@click="addEntry(entry)"
|
|
326
|
+
>
|
|
327
|
+
<img
|
|
328
|
+
v-if="showFeatured && thumbUrl(entry)"
|
|
329
|
+
:src="thumbUrl(entry)"
|
|
330
|
+
alt=""
|
|
331
|
+
:class="`${rootClass}__thumb`"
|
|
332
|
+
>
|
|
333
|
+
<span :class="`${rootClass}__item-body`">
|
|
334
|
+
<span :class="`${rootClass}__item-title`">{{ entry.title }}</span>
|
|
335
|
+
<span :class="`${rootClass}__item-meta`">{{ collectionLabel(entry.type) }}</span>
|
|
336
|
+
</span>
|
|
337
|
+
</button>
|
|
338
|
+
</div>
|
|
339
|
+
<div
|
|
340
|
+
v-if="!availableEntries.length"
|
|
341
|
+
:class="`${rootClass}__empty`"
|
|
342
|
+
>
|
|
343
|
+
{{ loading ? 'Loading…' : 'No entries' }}
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
</div>
|
|
347
|
+
|
|
348
|
+
<div :class="`${rootClass}__column`">
|
|
349
|
+
<div :class="`${rootClass}__column-title`">
|
|
350
|
+
Selected
|
|
351
|
+
</div>
|
|
352
|
+
<div :class="`${rootClass}__list`">
|
|
353
|
+
<div
|
|
354
|
+
v-for="(entry, index) in selectedEntries"
|
|
355
|
+
:key="entry.id"
|
|
356
|
+
:class="`${rootClass}__selected`"
|
|
357
|
+
>
|
|
358
|
+
<div :class="`${rootClass}__item ${rootClass}__item--static`">
|
|
359
|
+
<img
|
|
360
|
+
v-if="showFeatured && thumbUrl(entry)"
|
|
361
|
+
:src="thumbUrl(entry)"
|
|
362
|
+
alt=""
|
|
363
|
+
:class="`${rootClass}__thumb`"
|
|
364
|
+
>
|
|
365
|
+
<span :class="`${rootClass}__item-body`">
|
|
366
|
+
<span :class="`${rootClass}__item-title`">{{ entry.title }}</span>
|
|
367
|
+
<span :class="`${rootClass}__item-meta`">{{ collectionLabel(entry.type) }}</span>
|
|
368
|
+
</span>
|
|
369
|
+
</div>
|
|
370
|
+
<div :class="`${rootClass}__item-actions`">
|
|
371
|
+
<KateCmsUiButton
|
|
372
|
+
tag="button"
|
|
373
|
+
:variant="['tertiary', 'small', 'icon']"
|
|
374
|
+
:disabled="index === 0"
|
|
375
|
+
title="Move up"
|
|
376
|
+
aria-label="Move up"
|
|
377
|
+
@click="moveEntry(String(entry.id), -1)"
|
|
378
|
+
>
|
|
379
|
+
<svg
|
|
380
|
+
viewBox="0 0 24 24"
|
|
381
|
+
fill="none"
|
|
382
|
+
stroke="currentColor"
|
|
383
|
+
stroke-width="2"
|
|
384
|
+
aria-hidden="true"
|
|
385
|
+
>
|
|
386
|
+
<path d="M6 14l6-6 6 6" />
|
|
387
|
+
</svg>
|
|
388
|
+
</KateCmsUiButton>
|
|
389
|
+
<KateCmsUiButton
|
|
390
|
+
tag="button"
|
|
391
|
+
:variant="['tertiary', 'small', 'icon']"
|
|
392
|
+
:disabled="index === selectedEntries.length - 1"
|
|
393
|
+
title="Move down"
|
|
394
|
+
aria-label="Move down"
|
|
395
|
+
@click="moveEntry(String(entry.id), 1)"
|
|
396
|
+
>
|
|
397
|
+
<svg
|
|
398
|
+
viewBox="0 0 24 24"
|
|
399
|
+
fill="none"
|
|
400
|
+
stroke="currentColor"
|
|
401
|
+
stroke-width="2"
|
|
402
|
+
aria-hidden="true"
|
|
403
|
+
>
|
|
404
|
+
<path d="M6 10l6 6 6-6" />
|
|
405
|
+
</svg>
|
|
406
|
+
</KateCmsUiButton>
|
|
407
|
+
<KateCmsUiButton
|
|
408
|
+
tag="button"
|
|
409
|
+
:variant="['tertiary', 'small', 'icon']"
|
|
410
|
+
title="Remove"
|
|
411
|
+
aria-label="Remove"
|
|
412
|
+
@click="removeEntry(String(entry.id))"
|
|
413
|
+
>
|
|
414
|
+
<svg
|
|
415
|
+
viewBox="0 0 24 24"
|
|
416
|
+
fill="none"
|
|
417
|
+
stroke="currentColor"
|
|
418
|
+
stroke-width="2"
|
|
419
|
+
aria-hidden="true"
|
|
420
|
+
>
|
|
421
|
+
<path d="M6 6l12 12M18 6L6 18" />
|
|
422
|
+
</svg>
|
|
423
|
+
</KateCmsUiButton>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
<div
|
|
427
|
+
v-if="!selectedEntries.length"
|
|
428
|
+
:class="`${rootClass}__empty`"
|
|
429
|
+
>
|
|
430
|
+
Nothing selected
|
|
431
|
+
</div>
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
</KateCmsFieldWrapper>
|
|
437
|
+
</template>
|
|
438
|
+
|
|
439
|
+
<style scoped lang="scss">
|
|
440
|
+
@use "../../assets/styles" as *;
|
|
441
|
+
|
|
442
|
+
$root: '.katecms-relationship-field';
|
|
443
|
+
|
|
444
|
+
#{$root} {
|
|
445
|
+
display: flex;
|
|
446
|
+
flex-direction: column;
|
|
447
|
+
gap: math-rem(10);
|
|
448
|
+
|
|
449
|
+
&__error {
|
|
450
|
+
margin: 0;
|
|
451
|
+
color: $color-danger;
|
|
452
|
+
font-size: math-rem(13);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
&__hint {
|
|
456
|
+
margin: 0;
|
|
457
|
+
color: $color-warning;
|
|
458
|
+
font-size: math-rem(13);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
&__filters {
|
|
462
|
+
display: flex;
|
|
463
|
+
flex-wrap: wrap;
|
|
464
|
+
gap: math-rem(8);
|
|
465
|
+
align-items: stretch;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
&__filter {
|
|
469
|
+
flex: 1 1 math-rem(160);
|
|
470
|
+
min-width: 0;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
&__search {
|
|
474
|
+
flex: 1 1 math-rem(160);
|
|
475
|
+
min-width: 0;
|
|
476
|
+
height: math-rem(40);
|
|
477
|
+
padding: 0 math-rem(10);
|
|
478
|
+
border: 1px solid $color-border;
|
|
479
|
+
border-radius: $border-radius-inter;
|
|
480
|
+
background: $color-surface;
|
|
481
|
+
color: $color-ink;
|
|
482
|
+
font-size: math-rem(14);
|
|
483
|
+
box-sizing: border-box;
|
|
484
|
+
|
|
485
|
+
&:focus {
|
|
486
|
+
outline: none;
|
|
487
|
+
border-color: $color-accent;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
&__columns {
|
|
492
|
+
display: grid;
|
|
493
|
+
grid-template-columns: 1fr 1fr;
|
|
494
|
+
gap: math-rem(12);
|
|
495
|
+
|
|
496
|
+
@media (max-width: 800px) {
|
|
497
|
+
grid-template-columns: 1fr;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
&__column {
|
|
502
|
+
min-width: 0;
|
|
503
|
+
border: 1px solid $color-border;
|
|
504
|
+
border-radius: $border-radius-inter;
|
|
505
|
+
background: $color-surface;
|
|
506
|
+
overflow: hidden;
|
|
507
|
+
|
|
508
|
+
&-title {
|
|
509
|
+
padding: math-rem(8) math-rem(10);
|
|
510
|
+
font-size: math-rem(12);
|
|
511
|
+
font-weight: 600;
|
|
512
|
+
color: $color-muted;
|
|
513
|
+
background: $color-bg;
|
|
514
|
+
border-bottom: 1px solid $color-border;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
&__list {
|
|
519
|
+
margin: 0;
|
|
520
|
+
padding: math-rem(6);
|
|
521
|
+
max-height: math-rem(280);
|
|
522
|
+
overflow: auto;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
&__empty {
|
|
526
|
+
padding: math-rem(10);
|
|
527
|
+
color: $color-muted;
|
|
528
|
+
font-size: math-rem(13);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
&__item {
|
|
532
|
+
display: flex;
|
|
533
|
+
align-items: center;
|
|
534
|
+
gap: math-rem(8);
|
|
535
|
+
width: 100%;
|
|
536
|
+
padding: math-rem(6);
|
|
537
|
+
border: 0;
|
|
538
|
+
border-radius: $border-radius-inter;
|
|
539
|
+
background: transparent;
|
|
540
|
+
color: $color-ink;
|
|
541
|
+
text-align: left;
|
|
542
|
+
cursor: pointer;
|
|
543
|
+
|
|
544
|
+
&:hover:not(:disabled) {
|
|
545
|
+
background: $color-accent-wash;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
&:disabled {
|
|
549
|
+
cursor: default;
|
|
550
|
+
opacity: 0.55;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
&--static {
|
|
554
|
+
cursor: default;
|
|
555
|
+
flex: 1 1 auto;
|
|
556
|
+
min-width: 0;
|
|
557
|
+
|
|
558
|
+
&:hover {
|
|
559
|
+
background: transparent;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
&-body {
|
|
564
|
+
display: flex;
|
|
565
|
+
flex-direction: column;
|
|
566
|
+
min-width: 0;
|
|
567
|
+
gap: 2px;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
&-title {
|
|
571
|
+
font-size: math-rem(14);
|
|
572
|
+
overflow: hidden;
|
|
573
|
+
text-overflow: ellipsis;
|
|
574
|
+
white-space: nowrap;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
&-meta {
|
|
578
|
+
font-size: math-rem(12);
|
|
579
|
+
color: $color-muted;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
&-actions {
|
|
583
|
+
display: flex;
|
|
584
|
+
flex: 0 0 auto;
|
|
585
|
+
gap: 2px;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
&__thumb {
|
|
590
|
+
width: math-rem(36);
|
|
591
|
+
height: math-rem(36);
|
|
592
|
+
object-fit: cover;
|
|
593
|
+
border-radius: $border-radius-inter;
|
|
594
|
+
background: $color-bg;
|
|
595
|
+
flex: 0 0 auto;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
&__selected {
|
|
599
|
+
display: flex;
|
|
600
|
+
align-items: center;
|
|
601
|
+
gap: math-rem(4);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
</style>
|