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,222 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, nextTick, reactive, ref, watch } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
buildFormValues,
|
|
5
|
+
collectPanelDefaults,
|
|
6
|
+
collectVisibleValueKeys,
|
|
7
|
+
isLayoutOnlyFieldType,
|
|
8
|
+
isVisible,
|
|
9
|
+
validateRequiredFields
|
|
10
|
+
} from "@katecms/core";
|
|
11
|
+
import { resolveField } from "../../utils/helpers";
|
|
12
|
+
import { provideKateCmsFieldValues } from "../../utils/field-values";
|
|
13
|
+
import { provideKateCmsFieldErrors } from "../../utils/field-errors";
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
page: { type: Object, required: true },
|
|
16
|
+
modelValue: { type: Object, required: true },
|
|
17
|
+
saving: { type: Boolean, required: false, default: false },
|
|
18
|
+
error: { type: [String, null], required: false, default: null },
|
|
19
|
+
canUpdate: { type: Boolean, required: false, default: true },
|
|
20
|
+
formId: { type: String, required: false, default: "cms-options-form" }
|
|
21
|
+
});
|
|
22
|
+
const emit = defineEmits(["update:modelValue", "submit"]);
|
|
23
|
+
const rootClass = "katecms-options-form";
|
|
24
|
+
const fieldDefs = computed(() => props.page.fields ?? {});
|
|
25
|
+
const values = reactive({});
|
|
26
|
+
provideKateCmsFieldValues(values);
|
|
27
|
+
const fieldErrors = ref({});
|
|
28
|
+
const attemptedSubmit = ref(false);
|
|
29
|
+
provideKateCmsFieldErrors(fieldErrors);
|
|
30
|
+
const readOnly = computed(() => !props.canUpdate);
|
|
31
|
+
let syncingFromParent = false;
|
|
32
|
+
function replaceValues(next) {
|
|
33
|
+
syncingFromParent = true;
|
|
34
|
+
for (const key of Object.keys(values)) {
|
|
35
|
+
Reflect.deleteProperty(values, key);
|
|
36
|
+
}
|
|
37
|
+
Object.assign(values, next);
|
|
38
|
+
queueMicrotask(() => {
|
|
39
|
+
syncingFromParent = false;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
watch(
|
|
43
|
+
() => props.page.slug,
|
|
44
|
+
() => {
|
|
45
|
+
replaceValues({
|
|
46
|
+
...buildFormValues(fieldDefs.value),
|
|
47
|
+
...props.modelValue
|
|
48
|
+
});
|
|
49
|
+
attemptedSubmit.value = false;
|
|
50
|
+
fieldErrors.value = {};
|
|
51
|
+
},
|
|
52
|
+
{ immediate: true }
|
|
53
|
+
);
|
|
54
|
+
watch(
|
|
55
|
+
values,
|
|
56
|
+
() => {
|
|
57
|
+
if (syncingFromParent) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
emit("update:modelValue", { ...values });
|
|
61
|
+
},
|
|
62
|
+
{ deep: true }
|
|
63
|
+
);
|
|
64
|
+
const visibleFields = computed(
|
|
65
|
+
() => Object.entries(fieldDefs.value).filter(
|
|
66
|
+
([, field]) => isVisible(field.conditionalLogic, values)
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
const hiddenCache = {};
|
|
70
|
+
function restoreFieldValue(key, field) {
|
|
71
|
+
if (isLayoutOnlyFieldType(field.type)) {
|
|
72
|
+
if (field.type === "tab" || field.type === "accordion") {
|
|
73
|
+
for (const [panelKey, panelDefault] of Object.entries(collectPanelDefaults(field))) {
|
|
74
|
+
if (!(panelKey in values)) {
|
|
75
|
+
values[panelKey] = panelKey in hiddenCache ? hiddenCache[panelKey] : panelDefault;
|
|
76
|
+
Reflect.deleteProperty(hiddenCache, panelKey);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
Reflect.deleteProperty(values, key);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!(key in values)) {
|
|
84
|
+
values[key] = key in hiddenCache ? hiddenCache[key] : "defaultValue" in field ? field.defaultValue : field.type === "group" ? void 0 : field.type === "repeater" || field.type === "flexible_content" || field.type === "gallery" ? [] : field.type === "open_street_map" && field.multiple ? [] : void 0;
|
|
85
|
+
Reflect.deleteProperty(hiddenCache, key);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
watch(visibleFields, (visible) => {
|
|
89
|
+
const visibleKeys = collectVisibleValueKeys(visible);
|
|
90
|
+
for (const key of Object.keys(values)) {
|
|
91
|
+
if (!visibleKeys.has(key)) {
|
|
92
|
+
hiddenCache[key] = values[key];
|
|
93
|
+
Reflect.deleteProperty(values, key);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const [key, field] of visible) {
|
|
97
|
+
restoreFieldValue(key, field);
|
|
98
|
+
}
|
|
99
|
+
}, { immediate: true });
|
|
100
|
+
const canSubmit = computed(() => !readOnly.value && !props.saving);
|
|
101
|
+
function collectFieldErrors() {
|
|
102
|
+
const next = {};
|
|
103
|
+
for (const issue of validateRequiredFields(fieldDefs.value, values)) {
|
|
104
|
+
next[issue.key] = issue.message;
|
|
105
|
+
}
|
|
106
|
+
return next;
|
|
107
|
+
}
|
|
108
|
+
function scrollToFirstError(errors) {
|
|
109
|
+
const key = Object.keys(errors)[0];
|
|
110
|
+
if (!key || typeof document === "undefined") {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const target = document.querySelector(`[data-field-key="${CSS.escape(key)}"]`);
|
|
114
|
+
if (target instanceof HTMLElement) {
|
|
115
|
+
target.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function validateForSubmit() {
|
|
119
|
+
if (!canSubmit.value) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
attemptedSubmit.value = true;
|
|
123
|
+
const errors = collectFieldErrors();
|
|
124
|
+
fieldErrors.value = errors;
|
|
125
|
+
if (Object.keys(errors).length > 0) {
|
|
126
|
+
nextTick(() => scrollToFirstError(errors));
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
function onSubmit() {
|
|
132
|
+
if (!validateForSubmit()) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
emit("submit");
|
|
136
|
+
}
|
|
137
|
+
defineExpose({ validateForSubmit });
|
|
138
|
+
watch(
|
|
139
|
+
values,
|
|
140
|
+
() => {
|
|
141
|
+
if (!attemptedSubmit.value) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
fieldErrors.value = collectFieldErrors();
|
|
145
|
+
},
|
|
146
|
+
{ deep: true }
|
|
147
|
+
);
|
|
148
|
+
const requiredNotice = computed(() => {
|
|
149
|
+
const messages = Object.values(fieldErrors.value);
|
|
150
|
+
if (messages.length === 0) {
|
|
151
|
+
return "";
|
|
152
|
+
}
|
|
153
|
+
if (messages.length === 1) {
|
|
154
|
+
return messages[0];
|
|
155
|
+
}
|
|
156
|
+
return "Please fill in the required fields.";
|
|
157
|
+
});
|
|
158
|
+
</script>
|
|
159
|
+
|
|
160
|
+
<template>
|
|
161
|
+
<form
|
|
162
|
+
:id="formId"
|
|
163
|
+
:class="rootClass"
|
|
164
|
+
novalidate
|
|
165
|
+
@submit.prevent="onSubmit"
|
|
166
|
+
>
|
|
167
|
+
<KateCmsUiNotice
|
|
168
|
+
v-if="requiredNotice"
|
|
169
|
+
placement="static"
|
|
170
|
+
variant="danger"
|
|
171
|
+
:message="requiredNotice"
|
|
172
|
+
:closable="false"
|
|
173
|
+
/>
|
|
174
|
+
<KateCmsUiNotice
|
|
175
|
+
v-if="error"
|
|
176
|
+
placement="static"
|
|
177
|
+
variant="danger"
|
|
178
|
+
:message="error"
|
|
179
|
+
/>
|
|
180
|
+
|
|
181
|
+
<div
|
|
182
|
+
v-if="visibleFields.length"
|
|
183
|
+
:class="`${rootClass}__fields`"
|
|
184
|
+
>
|
|
185
|
+
<div
|
|
186
|
+
v-for="[key, field] in visibleFields"
|
|
187
|
+
:key="key"
|
|
188
|
+
:class="`${rootClass}__field`"
|
|
189
|
+
:style="field.columnWidth ? { width: `${field.columnWidth}%` } : void 0"
|
|
190
|
+
>
|
|
191
|
+
<component
|
|
192
|
+
:is="resolveField(field.type)"
|
|
193
|
+
v-model="values[key]"
|
|
194
|
+
:field-key="key"
|
|
195
|
+
:field="field"
|
|
196
|
+
/>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</form>
|
|
200
|
+
</template>
|
|
201
|
+
|
|
202
|
+
<style scoped>
|
|
203
|
+
body#katecms-body .katecms-options-form {
|
|
204
|
+
display: flex;
|
|
205
|
+
flex-direction: column;
|
|
206
|
+
gap: 0.875rem;
|
|
207
|
+
min-width: 0;
|
|
208
|
+
}
|
|
209
|
+
body#katecms-body .katecms-options-form__fields {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-wrap: wrap;
|
|
212
|
+
row-gap: 1rem;
|
|
213
|
+
margin-left: -0.5rem;
|
|
214
|
+
margin-right: -0.5rem;
|
|
215
|
+
}
|
|
216
|
+
body#katecms-body .katecms-options-form__field {
|
|
217
|
+
padding-left: 0.5rem;
|
|
218
|
+
padding-right: 0.5rem;
|
|
219
|
+
width: 100%;
|
|
220
|
+
box-sizing: border-box;
|
|
221
|
+
}
|
|
222
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AdminOptionMeta } from '../../utils/options.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
page: AdminOptionMeta;
|
|
4
|
+
modelValue: Record<string, unknown>;
|
|
5
|
+
saving?: boolean;
|
|
6
|
+
error?: string | null;
|
|
7
|
+
canUpdate?: boolean;
|
|
8
|
+
formId?: string;
|
|
9
|
+
};
|
|
10
|
+
declare function validateForSubmit(): boolean;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
12
|
+
validateForSubmit: typeof validateForSubmit;
|
|
13
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
submit: () => any;
|
|
15
|
+
"update:modelValue": (value: Record<string, unknown>) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
onSubmit?: (() => any) | undefined;
|
|
18
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
canUpdate: boolean;
|
|
21
|
+
error: string | null;
|
|
22
|
+
saving: boolean;
|
|
23
|
+
formId: string;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MediaItem } from '@katecms/core';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
/** Bound avatar media item (`null` when cleared / not set). */
|
|
4
|
+
modelValue?: MediaItem | null;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
"update:modelValue": (value: MediaItem | null) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((value: MediaItem | null) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { $fetch } from "#imports";
|
|
4
|
+
import { isImageMedia } from "@katecms/core";
|
|
5
|
+
import { avatarSrc } from "../../utils/admin-users";
|
|
6
|
+
import { useMediaLibrary } from "../../composables/useMediaLibrary";
|
|
7
|
+
const model = defineModel({ type: [Object, null], ...{ default: null } });
|
|
8
|
+
const rootClass = "katecms-user-avatar-field";
|
|
9
|
+
const open = ref(false);
|
|
10
|
+
const {
|
|
11
|
+
items: library,
|
|
12
|
+
loading,
|
|
13
|
+
loadingMore,
|
|
14
|
+
hasMore,
|
|
15
|
+
filters,
|
|
16
|
+
months,
|
|
17
|
+
load: loadLibrary,
|
|
18
|
+
loadMore,
|
|
19
|
+
applyFilters,
|
|
20
|
+
prepend: prependLibrary
|
|
21
|
+
} = useMediaLibrary(() => isImageMedia, { baseType: "image" });
|
|
22
|
+
const uploading = ref(false);
|
|
23
|
+
const error = ref(null);
|
|
24
|
+
const fileInput = ref();
|
|
25
|
+
const previewUrl = computed(() => avatarSrc(model.value));
|
|
26
|
+
async function fetchLibrary() {
|
|
27
|
+
error.value = null;
|
|
28
|
+
try {
|
|
29
|
+
await loadLibrary({ resetFilters: true });
|
|
30
|
+
} catch {
|
|
31
|
+
error.value = "Could not load the media library.";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function onLibraryFilters(next) {
|
|
35
|
+
error.value = null;
|
|
36
|
+
try {
|
|
37
|
+
await applyFilters(next);
|
|
38
|
+
} catch {
|
|
39
|
+
error.value = "Could not load the media library.";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function onLoadMore() {
|
|
43
|
+
try {
|
|
44
|
+
await loadMore();
|
|
45
|
+
} catch {
|
|
46
|
+
error.value = "Could not load more files.";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function openModal() {
|
|
50
|
+
open.value = true;
|
|
51
|
+
error.value = null;
|
|
52
|
+
fetchLibrary();
|
|
53
|
+
}
|
|
54
|
+
function closeModal() {
|
|
55
|
+
if (uploading.value) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
open.value = false;
|
|
59
|
+
}
|
|
60
|
+
function applyAvatar(item) {
|
|
61
|
+
model.value = item;
|
|
62
|
+
open.value = false;
|
|
63
|
+
}
|
|
64
|
+
function choose(item) {
|
|
65
|
+
applyAvatar(item);
|
|
66
|
+
}
|
|
67
|
+
function clearAvatar() {
|
|
68
|
+
model.value = null;
|
|
69
|
+
}
|
|
70
|
+
function triggerUpload() {
|
|
71
|
+
fileInput.value?.click();
|
|
72
|
+
}
|
|
73
|
+
async function onFileChange(event) {
|
|
74
|
+
const input = event.target;
|
|
75
|
+
const file = input.files?.[0];
|
|
76
|
+
input.value = "";
|
|
77
|
+
if (!file) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
uploading.value = true;
|
|
81
|
+
error.value = null;
|
|
82
|
+
try {
|
|
83
|
+
const form = new FormData();
|
|
84
|
+
form.append("file", file, file.name);
|
|
85
|
+
const data = await $fetch("/api/_katecms/media", {
|
|
86
|
+
method: "POST",
|
|
87
|
+
body: form
|
|
88
|
+
});
|
|
89
|
+
prependLibrary(data.media);
|
|
90
|
+
applyAvatar(data.media);
|
|
91
|
+
} catch {
|
|
92
|
+
error.value = "Could not upload the image.";
|
|
93
|
+
} finally {
|
|
94
|
+
uploading.value = false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<template>
|
|
100
|
+
<div :class="rootClass">
|
|
101
|
+
<div :class="`${rootClass}__preview`">
|
|
102
|
+
<img
|
|
103
|
+
v-if="previewUrl"
|
|
104
|
+
:src="previewUrl"
|
|
105
|
+
:alt="model?.alt || ''"
|
|
106
|
+
:class="`${rootClass}__image`"
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
v-else
|
|
110
|
+
:class="`${rootClass}__placeholder`"
|
|
111
|
+
aria-hidden="true"
|
|
112
|
+
>
|
|
113
|
+
<svg
|
|
114
|
+
viewBox="0 0 24 24"
|
|
115
|
+
fill="none"
|
|
116
|
+
stroke="currentColor"
|
|
117
|
+
stroke-width="1.5"
|
|
118
|
+
stroke-linecap="round"
|
|
119
|
+
stroke-linejoin="round"
|
|
120
|
+
>
|
|
121
|
+
<path d="M20 21a8 8 0 0 0-16 0" />
|
|
122
|
+
<circle
|
|
123
|
+
cx="12"
|
|
124
|
+
cy="8"
|
|
125
|
+
r="4"
|
|
126
|
+
/>
|
|
127
|
+
</svg>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div :class="`${rootClass}__actions`">
|
|
132
|
+
<KateCmsUiButton
|
|
133
|
+
tag="button"
|
|
134
|
+
:variant="['secondary', 'small', 'icon']"
|
|
135
|
+
:aria-label="model ? 'Change' : 'Choose avatar'"
|
|
136
|
+
:title="model ? 'Change' : 'Choose avatar'"
|
|
137
|
+
@click="openModal"
|
|
138
|
+
>
|
|
139
|
+
<svg
|
|
140
|
+
data-v-b9a9df7f=""
|
|
141
|
+
width="16"
|
|
142
|
+
height="16"
|
|
143
|
+
viewBox="0 0 16 16"
|
|
144
|
+
fill="none"
|
|
145
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
146
|
+
><path
|
|
147
|
+
data-v-b9a9df7f=""
|
|
148
|
+
d="M6.00033 4.66406H4.00033C3.6467 4.66406 3.30756 4.80454 3.05752 5.05459C2.80747 5.30464 2.66699 5.64377 2.66699 5.9974V11.9974C2.66699 12.351 2.80747 12.6902 3.05752 12.9402C3.30756 13.1903 3.6467 13.3307 4.00033 13.3307H10.0003C10.3539 13.3307 10.6931 13.1903 10.9431 12.9402C11.1932 12.6902 11.3337 12.351 11.3337 11.9974V9.9974"
|
|
149
|
+
stroke="currentColor"
|
|
150
|
+
stroke-width="1.2"
|
|
151
|
+
stroke-linecap="round"
|
|
152
|
+
stroke-linejoin="round"
|
|
153
|
+
/><path
|
|
154
|
+
data-v-b9a9df7f=""
|
|
155
|
+
d="M6 9.99885H8L13.6667 4.33218C13.9319 4.06697 14.0809 3.70726 14.0809 3.33218C14.0809 2.95711 13.9319 2.5974 13.6667 2.33218C13.4015 2.06697 13.0417 1.91797 12.6667 1.91797C12.2916 1.91797 11.9319 2.06697 11.6667 2.33218L6 7.99885V9.99885Z"
|
|
156
|
+
stroke="currentColor"
|
|
157
|
+
stroke-width="1.2"
|
|
158
|
+
stroke-linecap="round"
|
|
159
|
+
stroke-linejoin="round"
|
|
160
|
+
/><path
|
|
161
|
+
data-v-b9a9df7f=""
|
|
162
|
+
d="M10.667 3.33203L12.667 5.33203"
|
|
163
|
+
stroke="currentColor"
|
|
164
|
+
stroke-width="1.2"
|
|
165
|
+
stroke-linecap="round"
|
|
166
|
+
stroke-linejoin="round"
|
|
167
|
+
/></svg>
|
|
168
|
+
</KateCmsUiButton>
|
|
169
|
+
<KateCmsUiButton
|
|
170
|
+
v-if="model"
|
|
171
|
+
tag="button"
|
|
172
|
+
:variant="['red', 'small', 'icon']"
|
|
173
|
+
aria-label="Remove"
|
|
174
|
+
title="Remove"
|
|
175
|
+
@click="clearAvatar"
|
|
176
|
+
>
|
|
177
|
+
<svg
|
|
178
|
+
data-v-b9a9df7f=""
|
|
179
|
+
data-v-e86d7870=""
|
|
180
|
+
data-v-dc89e617=""
|
|
181
|
+
width="18"
|
|
182
|
+
height="18"
|
|
183
|
+
viewBox="0 0 18 18"
|
|
184
|
+
fill="none"
|
|
185
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
186
|
+
><path
|
|
187
|
+
data-v-b9a9df7f=""
|
|
188
|
+
data-v-e86d7870=""
|
|
189
|
+
data-v-dc89e617=""
|
|
190
|
+
d="M3 5.25H15"
|
|
191
|
+
stroke-width="1.5"
|
|
192
|
+
stroke-linecap="round"
|
|
193
|
+
stroke-linejoin="round"
|
|
194
|
+
stroke="currentColor"
|
|
195
|
+
/><path
|
|
196
|
+
data-v-b9a9df7f=""
|
|
197
|
+
data-v-e86d7870=""
|
|
198
|
+
data-v-dc89e617=""
|
|
199
|
+
d="M7.5 8.25V12.75"
|
|
200
|
+
stroke-width="1.5"
|
|
201
|
+
stroke-linecap="round"
|
|
202
|
+
stroke-linejoin="round"
|
|
203
|
+
stroke="currentColor"
|
|
204
|
+
/><path
|
|
205
|
+
data-v-b9a9df7f=""
|
|
206
|
+
data-v-e86d7870=""
|
|
207
|
+
data-v-dc89e617=""
|
|
208
|
+
d="M10.5 8.25V12.75"
|
|
209
|
+
stroke-width="1.5"
|
|
210
|
+
stroke-linecap="round"
|
|
211
|
+
stroke-linejoin="round"
|
|
212
|
+
stroke="currentColor"
|
|
213
|
+
/><path
|
|
214
|
+
data-v-b9a9df7f=""
|
|
215
|
+
data-v-e86d7870=""
|
|
216
|
+
data-v-dc89e617=""
|
|
217
|
+
d="M3.75 5.25L4.5 14.25C4.5 14.6478 4.65804 15.0294 4.93934 15.3107C5.22064 15.592 5.60218 15.75 6 15.75H12C12.3978 15.75 12.7794 15.592 13.0607 15.3107C13.342 15.0294 13.5 14.6478 13.5 14.25L14.25 5.25"
|
|
218
|
+
stroke-width="1.5"
|
|
219
|
+
stroke-linecap="round"
|
|
220
|
+
stroke-linejoin="round"
|
|
221
|
+
stroke="currentColor"
|
|
222
|
+
/><path
|
|
223
|
+
data-v-b9a9df7f=""
|
|
224
|
+
data-v-e86d7870=""
|
|
225
|
+
data-v-dc89e617=""
|
|
226
|
+
d="M6.75 5.25V3C6.75 2.80109 6.82902 2.61032 6.96967 2.46967C7.11032 2.32902 7.30109 2.25 7.5 2.25H10.5C10.6989 2.25 10.8897 2.32902 11.0303 2.46967C11.171 2.61032 11.25 2.80109 11.25 3V5.25"
|
|
227
|
+
stroke-width="1.5"
|
|
228
|
+
stroke-linecap="round"
|
|
229
|
+
stroke-linejoin="round"
|
|
230
|
+
stroke="currentColor"
|
|
231
|
+
/></svg>
|
|
232
|
+
</KateCmsUiButton>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<input
|
|
236
|
+
ref="fileInput"
|
|
237
|
+
type="file"
|
|
238
|
+
accept="image/*"
|
|
239
|
+
hidden
|
|
240
|
+
@change="onFileChange"
|
|
241
|
+
>
|
|
242
|
+
|
|
243
|
+
<KateCmsMediaLibraryModal
|
|
244
|
+
:open="open"
|
|
245
|
+
media-kind="image"
|
|
246
|
+
:library-enabled="true"
|
|
247
|
+
:library="library"
|
|
248
|
+
:selected-id="model?.id"
|
|
249
|
+
:loading="loading"
|
|
250
|
+
:loading-more="loadingMore"
|
|
251
|
+
:has-more="hasMore"
|
|
252
|
+
:filters="filters"
|
|
253
|
+
:months="months"
|
|
254
|
+
:error="error"
|
|
255
|
+
:uploading="uploading"
|
|
256
|
+
@close="closeModal"
|
|
257
|
+
@choose="choose"
|
|
258
|
+
@upload="triggerUpload"
|
|
259
|
+
@load-more="onLoadMore"
|
|
260
|
+
@update:filters="onLibraryFilters"
|
|
261
|
+
/>
|
|
262
|
+
</div>
|
|
263
|
+
</template>
|
|
264
|
+
|
|
265
|
+
<style scoped>
|
|
266
|
+
.katecms-user-avatar-field {
|
|
267
|
+
display: flex;
|
|
268
|
+
align-items: center;
|
|
269
|
+
gap: 0.875rem;
|
|
270
|
+
}
|
|
271
|
+
.katecms-user-avatar-field__preview {
|
|
272
|
+
flex-shrink: 0;
|
|
273
|
+
width: 4.5rem;
|
|
274
|
+
height: 4.5rem;
|
|
275
|
+
border-radius: 50%;
|
|
276
|
+
overflow: hidden;
|
|
277
|
+
border: 1px solid var(--katecms-color-border);
|
|
278
|
+
background: var(--katecms-color-bg);
|
|
279
|
+
}
|
|
280
|
+
.katecms-user-avatar-field__image {
|
|
281
|
+
display: block;
|
|
282
|
+
width: 100%;
|
|
283
|
+
height: 100%;
|
|
284
|
+
max-width: none;
|
|
285
|
+
object-fit: cover;
|
|
286
|
+
}
|
|
287
|
+
.katecms-user-avatar-field__placeholder {
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
justify-content: center;
|
|
291
|
+
width: 100%;
|
|
292
|
+
height: 100%;
|
|
293
|
+
color: var(--katecms-color-muted);
|
|
294
|
+
}
|
|
295
|
+
.katecms-user-avatar-field__placeholder svg {
|
|
296
|
+
width: 2rem;
|
|
297
|
+
height: 2rem;
|
|
298
|
+
max-width: none;
|
|
299
|
+
}
|
|
300
|
+
.katecms-user-avatar-field__actions {
|
|
301
|
+
display: flex;
|
|
302
|
+
flex-wrap: wrap;
|
|
303
|
+
gap: 0.5rem;
|
|
304
|
+
}
|
|
305
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MediaItem } from '@katecms/core';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
/** Bound avatar media item (`null` when cleared / not set). */
|
|
4
|
+
modelValue?: MediaItem | null;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
"update:modelValue": (value: MediaItem | null) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((value: MediaItem | null) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
File without changes
|