@mapomodule/uikit 1.0.0 → 2.0.0-beta.10
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 +199 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/module.d.mts +60 -0
- package/dist/module.d.ts +55 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +179 -0
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts +14 -0
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts.map +1 -0
- package/dist/runtime/adapters/defaultMediaAdapter.js +30 -0
- package/dist/runtime/assets/main.css +1 -0
- package/dist/runtime/components/MapoConfirmDialog.vue +35 -0
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts +4 -0
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetail.vue +606 -0
- package/dist/runtime/components/MapoDetail.vue.d.ts +401 -0
- package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue +126 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +23 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDropArea.vue +99 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts +33 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoList.vue +191 -0
- package/dist/runtime/components/MapoList.vue.d.ts +111 -0
- package/dist/runtime/components/MapoList.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListActions.vue +119 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts +33 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListFilters.vue +246 -0
- package/dist/runtime/components/MapoListFilters.vue.d.ts +38 -0
- package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListHead.vue +9 -0
- package/dist/runtime/components/MapoListHead.vue.d.ts +14 -0
- package/dist/runtime/components/MapoListHead.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListQuickEdit.vue +123 -0
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts +47 -0
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListTable.vue +665 -0
- package/dist/runtime/components/MapoListTable.vue.d.ts +105 -0
- package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListTabs.vue +38 -0
- package/dist/runtime/components/MapoListTabs.vue.d.ts +26 -0
- package/dist/runtime/components/MapoListTabs.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLogin.vue +196 -0
- package/dist/runtime/components/MapoLogin.vue.d.ts +22 -0
- package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLogoutButton.vue +27 -0
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts +29 -0
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue +47 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaEditor.vue +320 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue +112 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts +15 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFolders.vue +220 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaGallery.vue +219 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManager.vue +140 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts +35 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue +116 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts +41 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaPreview.vue +92 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts +19 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaUploader.vue +290 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuManager.vue +273 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoRootComponents.vue +9 -0
- package/dist/runtime/components/MapoRootComponents.vue.d.ts +4 -0
- package/dist/runtime/components/MapoRootComponents.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebar.vue +89 -0
- package/dist/runtime/components/MapoSidebar.vue.d.ts +22 -0
- package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarList.vue +27 -0
- package/dist/runtime/components/MapoSidebarList.vue.d.ts +8 -0
- package/dist/runtime/components/MapoSidebarList.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarListItem.vue +74 -0
- package/dist/runtime/components/MapoSidebarListItem.vue.d.ts +9 -0
- package/dist/runtime/components/MapoSidebarListItem.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarProfile.vue +55 -0
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts +10 -0
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSnackBar.vue +38 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts +4 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoThemeToggle.vue +23 -0
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts +4 -0
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoTopbar.vue +30 -0
- package/dist/runtime/components/MapoTopbar.vue.d.ts +15 -0
- package/dist/runtime/components/MapoTopbar.vue.d.ts.map +1 -0
- package/dist/runtime/components/menuDndContext.d.ts +19 -0
- package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
- package/dist/runtime/components/menuDndContext.js +3 -0
- package/dist/runtime/layouts/default.vue +43 -0
- package/dist/runtime/layouts/default.vue.d.ts +20 -0
- package/dist/runtime/layouts/default.vue.d.ts.map +1 -0
- package/dist/runtime/layouts/empty.vue +9 -0
- package/dist/runtime/layouts/empty.vue.d.ts +14 -0
- package/dist/runtime/layouts/empty.vue.d.ts.map +1 -0
- package/dist/runtime/page-meta.nuxt.d.ts +45 -0
- package/dist/runtime/pages/index.vue +14 -0
- package/dist/runtime/pages/index.vue.d.ts +4 -0
- package/dist/runtime/pages/index.vue.d.ts.map +1 -0
- package/dist/runtime/pages/login.vue +3 -0
- package/dist/runtime/pages/login.vue.d.ts +4 -0
- package/dist/runtime/pages/login.vue.d.ts.map +1 -0
- package/dist/runtime/plugins/media-adapter.d.ts +18 -0
- package/dist/runtime/plugins/media-adapter.d.ts.map +1 -0
- package/dist/runtime/plugins/media-adapter.js +8 -0
- package/dist/runtime/stores/media.d.ts +462 -0
- package/dist/runtime/stores/media.d.ts.map +1 -0
- package/dist/runtime/stores/media.js +344 -0
- package/dist/runtime/types/list.d.ts +59 -0
- package/dist/runtime/types/list.d.ts.map +1 -0
- package/dist/runtime/types/list.js +0 -0
- package/dist/runtime/types/media.d.ts +116 -0
- package/dist/runtime/types/media.d.ts.map +1 -0
- package/dist/runtime/types/media.js +0 -0
- package/dist/runtime/types/menu.d.ts +66 -0
- package/dist/runtime/types/menu.d.ts.map +1 -0
- package/dist/runtime/types/menu.js +30 -0
- package/dist/types.d.mts +9 -0
- package/package.json +67 -12
- package/src/index.ts +30 -0
- package/src/module.ts +311 -0
- package/src/runtime/adapters/defaultMediaAdapter.ts +57 -0
- package/src/runtime/assets/main.css +59 -0
- package/src/runtime/components/MapoConfirmDialog.vue +36 -0
- package/src/runtime/components/MapoDetail.vue +864 -0
- package/src/runtime/components/MapoDetailLangSwitch.vue +166 -0
- package/src/runtime/components/MapoDropArea.vue +127 -0
- package/src/runtime/components/MapoLangSwitcher.vue +74 -0
- package/src/runtime/components/MapoList.vue +339 -0
- package/src/runtime/components/MapoListActions.vue +158 -0
- package/src/runtime/components/MapoListFilters.vue +292 -0
- package/src/runtime/components/MapoListHead.vue +12 -0
- package/src/runtime/components/MapoListQuickEdit.vue +166 -0
- package/src/runtime/components/MapoListTable.vue +931 -0
- package/src/runtime/components/MapoListTabs.vue +48 -0
- package/src/runtime/components/MapoLogin.vue +212 -0
- package/src/runtime/components/MapoLogoutButton.vue +48 -0
- package/src/runtime/components/MapoMediaBreadcrumbs.vue +53 -0
- package/src/runtime/components/MapoMediaEditor.vue +350 -0
- package/src/runtime/components/MapoMediaFileChanger.vue +136 -0
- package/src/runtime/components/MapoMediaFolders.vue +239 -0
- package/src/runtime/components/MapoMediaGallery.vue +239 -0
- package/src/runtime/components/MapoMediaManager.vue +180 -0
- package/src/runtime/components/MapoMediaManagerDialog.vue +148 -0
- package/src/runtime/components/MapoMediaPreview.vue +111 -0
- package/src/runtime/components/MapoMediaUploader.vue +351 -0
- package/src/runtime/components/MapoMenuManager.vue +402 -0
- package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
- package/src/runtime/components/MapoMenuTreeview.vue +264 -0
- package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
- package/src/runtime/components/MapoRootComponents.vue +9 -0
- package/src/runtime/components/MapoSidebar.vue +114 -0
- package/src/runtime/components/MapoSidebarList.vue +35 -0
- package/src/runtime/components/MapoSidebarListItem.vue +79 -0
- package/src/runtime/components/MapoSidebarProfile.vue +61 -0
- package/src/runtime/components/MapoSnackBar.vue +42 -0
- package/src/runtime/components/MapoThemeToggle.vue +27 -0
- package/src/runtime/components/MapoTopbar.vue +36 -0
- package/src/runtime/components/menuDndContext.ts +22 -0
- package/src/runtime/layouts/default.vue +53 -0
- package/src/runtime/layouts/empty.vue +9 -0
- package/src/runtime/page-meta.nuxt.d.ts +45 -0
- package/src/runtime/pages/index.vue +15 -0
- package/src/runtime/pages/login.vue +3 -0
- package/src/runtime/plugins/media-adapter.ts +33 -0
- package/src/runtime/stores/media.ts +474 -0
- package/src/runtime/types/list.ts +64 -0
- package/src/runtime/types/media.ts +126 -0
- package/src/runtime/types/menu.ts +105 -0
- package/CHANGELOG.md +0 -1030
- package/assets/mixins.scss +0 -22
- package/assets/variables.scss +0 -18
- package/components/ConfirmDialog.vue +0 -173
- package/components/Detail/Detail.vue +0 -696
- package/components/Detail/DetailLangSwitch.vue +0 -79
- package/components/DropArea.vue +0 -257
- package/components/Form/Form.vue +0 -218
- package/components/Form/FormField.vue +0 -216
- package/components/Form/FormGroup.vue +0 -146
- package/components/Form/FormTabs.vue +0 -188
- package/components/Form/defaults.js +0 -98
- package/components/Form/fields/ColorField.vue +0 -79
- package/components/Form/fields/DateField.vue +0 -77
- package/components/Form/fields/DateTimeField.vue +0 -271
- package/components/Form/fields/EnhancedMediaField.vue +0 -224
- package/components/Form/fields/FileField.vue +0 -125
- package/components/Form/fields/FksField.vue +0 -115
- package/components/Form/fields/MediaField.vue +0 -159
- package/components/Form/fields/MediaM2mField.vue +0 -149
- package/components/Form/fields/Repeater.vue +0 -618
- package/components/Form/fields/SeoPreview.vue +0 -89
- package/components/Form/fields/TimeField.vue +0 -154
- package/components/Form/fields/mapField/leaflet.injector.js +0 -39
- package/components/Form/fields/mapField/mapField.vue +0 -350
- package/components/Form/fields/wygEditor/defaults.js +0 -25
- package/components/Form/fields/wygEditor/utils/events.js +0 -64
- package/components/Form/fields/wygEditor/utils/mapomedia.plugin.js +0 -32
- package/components/Form/fields/wygEditor/utils/tinymce.injector.js +0 -29
- package/components/Form/fields/wygEditor/wygEditor.vue +0 -285
- package/components/Form/fields/wygEditorCKE/defaults.js +0 -103
- package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +0 -29
- package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +0 -270
- package/components/LangSwitcher.vue +0 -44
- package/components/List/List.vue +0 -271
- package/components/List/ListActions.vue +0 -164
- package/components/List/ListFilters.vue +0 -372
- package/components/List/ListHead.vue +0 -67
- package/components/List/ListQuickEdit.vue +0 -228
- package/components/List/ListTable.vue +0 -484
- package/components/List/ListTabs.vue +0 -65
- package/components/Login.vue +0 -125
- package/components/Logo.vue +0 -79
- package/components/LogoutButton.vue +0 -54
- package/components/MediaManager/MediaBreadcrumbs.vue +0 -45
- package/components/MediaManager/MediaEditor.vue +0 -340
- package/components/MediaManager/MediaFileChanger.vue +0 -78
- package/components/MediaManager/MediaFolders.vue +0 -287
- package/components/MediaManager/MediaGallery.vue +0 -281
- package/components/MediaManager/MediaManager.vue +0 -159
- package/components/MediaManager/MediaManagerDialog.vue +0 -104
- package/components/MediaManager/MediaPreview.vue +0 -258
- package/components/MediaManager/MediaUploader.vue +0 -163
- package/components/MenuManager/MenuManager.vue +0 -332
- package/components/MenuManager/MenuNodeEditor.vue +0 -270
- package/components/MenuManager/MenuTreeview.vue +0 -237
- package/components/MenuManager/MenuTreeviewNode.vue +0 -208
- package/components/PagePreview.vue +0 -58
- package/components/RootComponents.vue +0 -25
- package/components/SnackBar.vue +0 -69
- package/components/ThemeToggle.vue +0 -13
- package/components/layout/Sidebar/Sidebar.vue +0 -89
- package/components/layout/Sidebar/SidebarList.vue +0 -49
- package/components/layout/Sidebar/SidebarListItem.vue +0 -185
- package/components/layout/Sidebar/SidebarProfile.vue +0 -42
- package/components/layout/Sidebar/SidebarTitle.vue +0 -45
- package/components/layout/Topbar/Topbar.vue +0 -29
- package/components/layout/routebuilder.js +0 -48
- package/defaults/i18n.js +0 -37
- package/defaults/vuetify.js +0 -34
- package/layouts/default.vue +0 -47
- package/layouts/empty.vue +0 -16
- package/module.js +0 -80
- package/pages/index.vue +0 -37
- package/pages/login.vue +0 -10
- package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/dev/contents.css +0 -35
- package/static/mapo/ckeditor/plugins/image2/dev/image2.html +0 -338
- package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +0 -557
- package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
- package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
- package/static/mapo/ckeditor/plugins/image2/lang/af.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ar.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/az.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/bg.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/bn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/bs.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ca.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/cs.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/cy.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/da.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/de.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/el.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/eo.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/es.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/et.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/eu.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fa.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fi.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fo.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/gl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/gu.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/he.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/hi.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/hr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/hu.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/id.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/is.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/it.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ja.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ka.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/km.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ko.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ku.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/lt.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/lv.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/mk.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/mn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ms.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/nb.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/nl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/no.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/oc.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/pl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/pt.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ro.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ru.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/si.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sk.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sq.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sv.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/th.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/tr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/tt.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ug.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/uk.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/vi.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/zh.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/plugin.js +0 -1798
- package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/samples/image2.html +0 -68
- package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +0 -2374
- package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +0 -2722
- package/static/mapo/ckeditor/skins/moono/dev/locations.json +0 -144
- package/static/mapo/ckeditor/skins/moono/dialog.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_gecko.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +0 -5
- package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
- package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
- package/static/mapo/ckeditor/skins/moono/readme.md +0 -49
- package/static/mapo/ckeditor/skins/moono/skin.js +0 -10
- package/static/mapo/ckeditor/skins/moono-dark/dialog.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/readme.md +0 -51
- package/static/mapo/ckeditor/skins/moono-dark/skin.js +0 -5
- package/static/mapo/favicon.ico +0 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/content.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/content.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/skin.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +0 -7
- package/translations/en-US.js +0 -177
- package/translations/it-IT.js +0 -180
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, watch, computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
import { useMediaStore } from "../stores/media.js";
|
|
5
|
+
import type { MediaItem, SelectMode } from "../types/media.js";
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
modelValue?: boolean;
|
|
10
|
+
selectionMode?: Exclude<SelectMode, "none">;
|
|
11
|
+
mime?: string | null;
|
|
12
|
+
noFolders?: boolean;
|
|
13
|
+
languages?: string[];
|
|
14
|
+
defaultLang?: string;
|
|
15
|
+
/** Current value of the host field — pre-seeds the picker selection. */
|
|
16
|
+
selected?: MediaItem | MediaItem[] | null;
|
|
17
|
+
}>(),
|
|
18
|
+
{
|
|
19
|
+
modelValue: false,
|
|
20
|
+
selectionMode: "single",
|
|
21
|
+
mime: null,
|
|
22
|
+
noFolders: false,
|
|
23
|
+
languages: undefined,
|
|
24
|
+
defaultLang: undefined,
|
|
25
|
+
selected: null,
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const emit = defineEmits<{
|
|
30
|
+
"update:modelValue": [value: boolean];
|
|
31
|
+
/** Emitted when the user confirms their selection */
|
|
32
|
+
confirm: [value: MediaItem | MediaItem[]];
|
|
33
|
+
}>();
|
|
34
|
+
|
|
35
|
+
const { t } = useI18n();
|
|
36
|
+
const store = useMediaStore();
|
|
37
|
+
const open = ref(props.modelValue);
|
|
38
|
+
|
|
39
|
+
watch(
|
|
40
|
+
() => props.modelValue,
|
|
41
|
+
(v) => (open.value = v),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
watch(open, (v) => emit("update:modelValue", v));
|
|
45
|
+
|
|
46
|
+
const hasSelection = computed(() => {
|
|
47
|
+
if (props.selectionMode === "single") return !!store.selection;
|
|
48
|
+
return Array.isArray(store.selection) && store.selection.length > 0;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const selectionCount = computed(() => {
|
|
52
|
+
if (props.selectionMode === "multi" && Array.isArray(store.selection)) {
|
|
53
|
+
return store.selection.length;
|
|
54
|
+
}
|
|
55
|
+
return 0;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function confirm() {
|
|
59
|
+
if (!store.selection) return;
|
|
60
|
+
emit("confirm", store.selection as MediaItem | MediaItem[]);
|
|
61
|
+
open.value = false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function cancel() {
|
|
65
|
+
open.value = false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Legacy parity: in single mode the first pick confirms and closes right away.
|
|
69
|
+
// Guarded against the pre-seeded selection so reopening the dialog with a
|
|
70
|
+
// current value doesn't auto-close it.
|
|
71
|
+
watch(
|
|
72
|
+
() => store.selection,
|
|
73
|
+
(sel) => {
|
|
74
|
+
if (!open.value || props.selectionMode !== "single") return;
|
|
75
|
+
if (Array.isArray(sel) || !sel) return;
|
|
76
|
+
const initial = props.selected as MediaItem | null;
|
|
77
|
+
if (sel.id !== initial?.id) confirm();
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<template>
|
|
83
|
+
<!-- Activator slot: the caller provides the trigger button -->
|
|
84
|
+
<slot name="activator" :open="() => (open = true)" />
|
|
85
|
+
|
|
86
|
+
<UModal v-model:open="open" :ui="{ content: 'max-w-5xl w-full h-[80vh]' }">
|
|
87
|
+
<!-- #content gives full control: the default slot is the trigger in Nuxt UI v4 -->
|
|
88
|
+
<template #content>
|
|
89
|
+
<div class="flex h-full flex-col">
|
|
90
|
+
<!-- Header -->
|
|
91
|
+
<div class="flex items-center gap-2 border-b border-default px-4 py-3">
|
|
92
|
+
<UIcon name="i-lucide-image" class="size-4 text-dimmed" />
|
|
93
|
+
<span class="flex-1 font-semibold text-highlighted">
|
|
94
|
+
{{
|
|
95
|
+
selectionMode === "multi"
|
|
96
|
+
? t("mapo.mediaManager.selectMedia")
|
|
97
|
+
: t("mapo.mediaManager.selectAMedia")
|
|
98
|
+
}}
|
|
99
|
+
</span>
|
|
100
|
+
<UButton
|
|
101
|
+
icon="i-lucide-x"
|
|
102
|
+
size="xs"
|
|
103
|
+
variant="ghost"
|
|
104
|
+
color="neutral"
|
|
105
|
+
@click="cancel"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<!-- Body: media manager fills remaining space -->
|
|
110
|
+
<div class="min-h-0 flex-1">
|
|
111
|
+
<MapoMediaManager
|
|
112
|
+
:selection-mode="selectionMode"
|
|
113
|
+
:mime="mime"
|
|
114
|
+
:no-folders="noFolders"
|
|
115
|
+
:languages="languages"
|
|
116
|
+
:default-lang="defaultLang"
|
|
117
|
+
:initial-selection="selected"
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<!-- Footer -->
|
|
122
|
+
<div
|
|
123
|
+
class="flex items-center justify-between gap-2 border-t border-default px-4 py-3"
|
|
124
|
+
>
|
|
125
|
+
<p
|
|
126
|
+
v-if="selectionMode === 'multi' && selectionCount > 0"
|
|
127
|
+
class="text-sm text-muted"
|
|
128
|
+
>
|
|
129
|
+
{{ t("mapo.mediaGallery.nSelected", { number: selectionCount }) }}
|
|
130
|
+
</p>
|
|
131
|
+
<div class="ml-auto flex gap-2">
|
|
132
|
+
<UButton variant="ghost" color="neutral" @click="cancel">
|
|
133
|
+
{{ t("mapo.cancel") }}
|
|
134
|
+
</UButton>
|
|
135
|
+
<UButton
|
|
136
|
+
color="primary"
|
|
137
|
+
:disabled="!hasSelection"
|
|
138
|
+
icon="i-lucide-check"
|
|
139
|
+
@click="confirm"
|
|
140
|
+
>
|
|
141
|
+
{{ t("mapo.confirm") }}
|
|
142
|
+
</UButton>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</template>
|
|
147
|
+
</UModal>
|
|
148
|
+
</template>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import type { MediaItem } from "../types/media.js";
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<{
|
|
7
|
+
media: MediaItem;
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
9
|
+
contain?: boolean;
|
|
10
|
+
showFilename?: boolean;
|
|
11
|
+
videoControls?: boolean;
|
|
12
|
+
videoAutoplay?: boolean;
|
|
13
|
+
}>(),
|
|
14
|
+
{
|
|
15
|
+
size: "md",
|
|
16
|
+
contain: false,
|
|
17
|
+
showFilename: false,
|
|
18
|
+
videoControls: false,
|
|
19
|
+
videoAutoplay: false,
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const isImage = computed(() => props.media.mime_type?.startsWith("image/"));
|
|
24
|
+
const isVideo = computed(() => props.media.mime_type?.startsWith("video/"));
|
|
25
|
+
const isAudio = computed(() => props.media.mime_type?.startsWith("audio/"));
|
|
26
|
+
const isPdf = computed(() => props.media.mime_type === "application/pdf");
|
|
27
|
+
|
|
28
|
+
const sizeClass = computed(() => {
|
|
29
|
+
const map: Record<string, string> = {
|
|
30
|
+
xs: "size-10",
|
|
31
|
+
sm: "size-16",
|
|
32
|
+
md: "size-24",
|
|
33
|
+
lg: "size-40",
|
|
34
|
+
};
|
|
35
|
+
return map[props.size];
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const iconName = computed(() => {
|
|
39
|
+
if (isVideo.value) return "i-lucide-film";
|
|
40
|
+
if (isAudio.value) return "i-lucide-music";
|
|
41
|
+
if (isPdf.value) return "i-lucide-file-text";
|
|
42
|
+
return "i-lucide-file";
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const displayName = computed(
|
|
46
|
+
() =>
|
|
47
|
+
props.media.title ||
|
|
48
|
+
props.media.name ||
|
|
49
|
+
props.media.file?.split("/").pop() ||
|
|
50
|
+
"",
|
|
51
|
+
);
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<div class="mapo-media-preview flex flex-col items-center gap-1">
|
|
56
|
+
<div
|
|
57
|
+
class="overflow-hidden rounded bg-elevated flex items-center justify-center"
|
|
58
|
+
:class="sizeClass"
|
|
59
|
+
>
|
|
60
|
+
<!-- Image -->
|
|
61
|
+
<img
|
|
62
|
+
v-if="isImage"
|
|
63
|
+
:src="media.file"
|
|
64
|
+
:alt="media.alt_text || displayName"
|
|
65
|
+
class="size-full"
|
|
66
|
+
:class="contain ? 'object-contain' : 'object-cover'"
|
|
67
|
+
loading="lazy"
|
|
68
|
+
decoding="async"
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<!-- Video -->
|
|
72
|
+
<video
|
|
73
|
+
v-else-if="isVideo"
|
|
74
|
+
:src="media.file"
|
|
75
|
+
class="size-full object-cover"
|
|
76
|
+
:controls="videoControls"
|
|
77
|
+
:autoplay="videoAutoplay"
|
|
78
|
+
muted
|
|
79
|
+
playsinline
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
<!-- Audio -->
|
|
83
|
+
<div
|
|
84
|
+
v-else-if="isAudio"
|
|
85
|
+
class="flex flex-col items-center gap-1 p-2 text-center"
|
|
86
|
+
>
|
|
87
|
+
<UIcon :name="iconName" class="size-8 text-dimmed" />
|
|
88
|
+
<audio v-if="videoControls" :src="media.file" controls class="w-full" />
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<!-- Generic file icon -->
|
|
92
|
+
<div v-else class="flex flex-col items-center gap-1 p-2 text-center">
|
|
93
|
+
<UIcon :name="iconName" class="size-8 text-dimmed" />
|
|
94
|
+
<span
|
|
95
|
+
v-if="size !== 'xs'"
|
|
96
|
+
class="line-clamp-2 break-all text-[10px] text-muted"
|
|
97
|
+
>
|
|
98
|
+
{{ media.mime_type }}
|
|
99
|
+
</span>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<span
|
|
104
|
+
v-if="showFilename"
|
|
105
|
+
class="max-w-full truncate text-center text-xs text-muted"
|
|
106
|
+
:title="displayName"
|
|
107
|
+
>
|
|
108
|
+
{{ displayName }}
|
|
109
|
+
</span>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, computed, onUnmounted } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
import { humanFileSize } from "@mapomodule/utils";
|
|
5
|
+
import { useMediaStore } from "../stores/media.js";
|
|
6
|
+
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
7
|
+
import { useRuntimeConfig } from "#app";
|
|
8
|
+
import type { MediaUploadPayload } from "../types/media.js";
|
|
9
|
+
|
|
10
|
+
// USelect items cannot carry `null` values, so the library root uses a sentinel.
|
|
11
|
+
const ROOT_FOLDER = -1;
|
|
12
|
+
|
|
13
|
+
interface UploadEntry {
|
|
14
|
+
file: File;
|
|
15
|
+
title: string;
|
|
16
|
+
alt_text: string;
|
|
17
|
+
description: string;
|
|
18
|
+
folder: number;
|
|
19
|
+
progress: number;
|
|
20
|
+
status: "pending" | "uploading" | "done" | "error";
|
|
21
|
+
error?: string;
|
|
22
|
+
previewUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const emit = defineEmits<{
|
|
26
|
+
/** Emitted after at least one file uploaded successfully (legacy parity: the manager switches back to the gallery). */
|
|
27
|
+
uploaded: [];
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
const { t } = useI18n();
|
|
31
|
+
const store = useMediaStore();
|
|
32
|
+
const snack = useSnackStore();
|
|
33
|
+
|
|
34
|
+
// Configurable size limits via runtimeConfig.public.mapoMedia
|
|
35
|
+
const config = useRuntimeConfig();
|
|
36
|
+
const mediaConfig = (config.public.mapoMedia ?? {}) as {
|
|
37
|
+
maxImageSize?: number;
|
|
38
|
+
maxVideoSize?: number;
|
|
39
|
+
maxDefaultSize?: number;
|
|
40
|
+
};
|
|
41
|
+
const MAX_IMAGE = (mediaConfig.maxImageSize ?? 10) * 1024 * 1024;
|
|
42
|
+
const MAX_VIDEO = (mediaConfig.maxVideoSize ?? 100) * 1024 * 1024;
|
|
43
|
+
const MAX_DEFAULT = (mediaConfig.maxDefaultSize ?? 10) * 1024 * 1024;
|
|
44
|
+
|
|
45
|
+
const entries = ref<UploadEntry[]>([]);
|
|
46
|
+
const uploading = ref(false);
|
|
47
|
+
|
|
48
|
+
const canUpload = computed(
|
|
49
|
+
() =>
|
|
50
|
+
entries.value.length > 0 &&
|
|
51
|
+
entries.value.some((e) => e.status === "pending"),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const pendingCount = computed(
|
|
55
|
+
() => entries.value.filter((e) => e.status === "pending").length,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// Destination options: the current folder plus its subfolders (legacy parity).
|
|
59
|
+
const folderOptions = computed(() => [
|
|
60
|
+
{
|
|
61
|
+
label: store.parentFolder?.path ?? "/",
|
|
62
|
+
value: store.parentFolder?.id ?? ROOT_FOLDER,
|
|
63
|
+
},
|
|
64
|
+
...store.folders.map((f) => ({ label: f.path ?? f.name, value: f.id })),
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
function onFiles(files: File[]) {
|
|
68
|
+
for (const file of files) {
|
|
69
|
+
const limit = file.type.startsWith("image/")
|
|
70
|
+
? MAX_IMAGE
|
|
71
|
+
: file.type.startsWith("video/")
|
|
72
|
+
? MAX_VIDEO
|
|
73
|
+
: MAX_DEFAULT;
|
|
74
|
+
|
|
75
|
+
if (file.size > limit) {
|
|
76
|
+
snack.show(
|
|
77
|
+
t("mapo.mediaUploader.fileTooLarge", {
|
|
78
|
+
name: file.name,
|
|
79
|
+
max: (limit / (1024 * 1024)).toFixed(0),
|
|
80
|
+
}),
|
|
81
|
+
"error",
|
|
82
|
+
);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const previewUrl = file.type.startsWith("image/")
|
|
87
|
+
? URL.createObjectURL(file)
|
|
88
|
+
: undefined;
|
|
89
|
+
|
|
90
|
+
const baseName = file.name.replace(/\.[^.]+$/, "");
|
|
91
|
+
entries.value.push({
|
|
92
|
+
file,
|
|
93
|
+
title: baseName,
|
|
94
|
+
alt_text: baseName,
|
|
95
|
+
description: "",
|
|
96
|
+
folder: store.parentFolder?.id ?? ROOT_FOLDER,
|
|
97
|
+
progress: 0,
|
|
98
|
+
status: "pending",
|
|
99
|
+
previewUrl,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function remove(index: number) {
|
|
105
|
+
const entry = entries.value[index];
|
|
106
|
+
if (entry?.previewUrl) URL.revokeObjectURL(entry.previewUrl);
|
|
107
|
+
entries.value.splice(index, 1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function upload() {
|
|
111
|
+
uploading.value = true;
|
|
112
|
+
let successCount = 0;
|
|
113
|
+
|
|
114
|
+
for (const entry of entries.value) {
|
|
115
|
+
if (entry.status !== "pending") continue;
|
|
116
|
+
entry.status = "uploading";
|
|
117
|
+
entry.progress = 0;
|
|
118
|
+
|
|
119
|
+
const payload: MediaUploadPayload = {
|
|
120
|
+
file: entry.file,
|
|
121
|
+
title: entry.title || undefined,
|
|
122
|
+
alt_text: entry.alt_text || undefined,
|
|
123
|
+
description: entry.description || undefined,
|
|
124
|
+
folder: entry.folder === ROOT_FOLDER ? null : entry.folder,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
await store.uploadMedia(payload, (pct) => {
|
|
129
|
+
entry.progress = pct;
|
|
130
|
+
});
|
|
131
|
+
entry.status = "done";
|
|
132
|
+
entry.progress = 100;
|
|
133
|
+
successCount++;
|
|
134
|
+
} catch (err) {
|
|
135
|
+
entry.status = "error";
|
|
136
|
+
entry.error =
|
|
137
|
+
err instanceof Error
|
|
138
|
+
? err.message
|
|
139
|
+
: t("mapo.mediaUploader.uploadFailed");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
uploading.value = false;
|
|
144
|
+
|
|
145
|
+
if (successCount > 0) {
|
|
146
|
+
snack.show(
|
|
147
|
+
t("mapo.mediaUploader.success", { numberFiles: successCount }),
|
|
148
|
+
"success",
|
|
149
|
+
);
|
|
150
|
+
await store.getRoot({ page: 1 });
|
|
151
|
+
// Clean up completed entries
|
|
152
|
+
entries.value = entries.value.filter((e) => e.status !== "done");
|
|
153
|
+
emit("uploaded");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function clearAll() {
|
|
158
|
+
entries.value.forEach((e) => {
|
|
159
|
+
if (e.previewUrl) URL.revokeObjectURL(e.previewUrl);
|
|
160
|
+
});
|
|
161
|
+
entries.value = [];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
onUnmounted(clearAll);
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<template>
|
|
168
|
+
<div class="mapo-media-uploader space-y-4">
|
|
169
|
+
<!-- Drop zone -->
|
|
170
|
+
<MapoDropArea accept="*/*" multiple :disabled="uploading" @files="onFiles">
|
|
171
|
+
<template #default="{ triggerPick, isDragging }">
|
|
172
|
+
<div
|
|
173
|
+
class="flex min-h-32 cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed p-6 transition-colors"
|
|
174
|
+
:class="
|
|
175
|
+
isDragging
|
|
176
|
+
? 'border-primary bg-primary/10'
|
|
177
|
+
: 'border-default hover:border-accented'
|
|
178
|
+
"
|
|
179
|
+
@click="triggerPick"
|
|
180
|
+
>
|
|
181
|
+
<UIcon name="i-lucide-upload-cloud" class="size-10 text-dimmed" />
|
|
182
|
+
<div class="text-center">
|
|
183
|
+
<p class="text-sm font-medium text-muted">
|
|
184
|
+
{{ t("mapo.mediaUploader.dragHere") }}
|
|
185
|
+
<span class="text-primary">{{
|
|
186
|
+
t("mapo.mediaUploader.browse")
|
|
187
|
+
}}</span>
|
|
188
|
+
</p>
|
|
189
|
+
<p class="mt-0.5 text-xs text-dimmed">
|
|
190
|
+
{{
|
|
191
|
+
t("mapo.mediaUploader.limits", {
|
|
192
|
+
img: (MAX_IMAGE / (1024 * 1024)).toFixed(0),
|
|
193
|
+
vid: (MAX_VIDEO / (1024 * 1024)).toFixed(0),
|
|
194
|
+
})
|
|
195
|
+
}}
|
|
196
|
+
</p>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</template>
|
|
200
|
+
</MapoDropArea>
|
|
201
|
+
|
|
202
|
+
<!-- File list -->
|
|
203
|
+
<div v-if="entries.length > 0" class="space-y-2">
|
|
204
|
+
<div class="flex items-center justify-between">
|
|
205
|
+
<p class="text-xs font-medium text-muted">
|
|
206
|
+
{{
|
|
207
|
+
t(
|
|
208
|
+
"mapo.mediaUploader.nSelected",
|
|
209
|
+
{ n: entries.length },
|
|
210
|
+
entries.length,
|
|
211
|
+
)
|
|
212
|
+
}}
|
|
213
|
+
</p>
|
|
214
|
+
<UButton
|
|
215
|
+
v-if="!uploading"
|
|
216
|
+
size="xs"
|
|
217
|
+
variant="ghost"
|
|
218
|
+
color="neutral"
|
|
219
|
+
icon="i-lucide-x"
|
|
220
|
+
@click="clearAll"
|
|
221
|
+
>
|
|
222
|
+
{{ t("mapo.clear") }}
|
|
223
|
+
</UButton>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<div class="space-y-2 max-h-96 overflow-y-auto pr-1">
|
|
227
|
+
<div
|
|
228
|
+
v-for="(entry, i) in entries"
|
|
229
|
+
:key="i"
|
|
230
|
+
class="rounded-lg border p-3 transition-colors"
|
|
231
|
+
:class="{
|
|
232
|
+
'border-success/40 bg-success/10': entry.status === 'done',
|
|
233
|
+
'border-error/40 bg-error/10': entry.status === 'error',
|
|
234
|
+
'border-default':
|
|
235
|
+
entry.status === 'pending' || entry.status === 'uploading',
|
|
236
|
+
}"
|
|
237
|
+
>
|
|
238
|
+
<div class="flex items-start gap-3">
|
|
239
|
+
<!-- Preview -->
|
|
240
|
+
<div class="size-12 shrink-0 overflow-hidden rounded bg-elevated">
|
|
241
|
+
<img
|
|
242
|
+
v-if="entry.previewUrl"
|
|
243
|
+
:src="entry.previewUrl"
|
|
244
|
+
class="size-full object-cover"
|
|
245
|
+
alt=""
|
|
246
|
+
/>
|
|
247
|
+
<div v-else class="flex size-full items-center justify-center">
|
|
248
|
+
<UIcon name="i-lucide-file" class="size-6 text-dimmed" />
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<div class="flex-1 min-w-0 space-y-1.5">
|
|
253
|
+
<!-- Filename + size -->
|
|
254
|
+
<div class="flex items-center gap-2">
|
|
255
|
+
<span class="truncate text-xs font-medium text-default">
|
|
256
|
+
{{ entry.file.name }}
|
|
257
|
+
</span>
|
|
258
|
+
<span class="shrink-0 text-xs text-dimmed">
|
|
259
|
+
{{ humanFileSize(entry.file.size) }}
|
|
260
|
+
</span>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<!-- Metadata inputs (only for pending) -->
|
|
264
|
+
<div
|
|
265
|
+
v-if="entry.status === 'pending'"
|
|
266
|
+
class="grid grid-cols-2 gap-1.5"
|
|
267
|
+
>
|
|
268
|
+
<UInput
|
|
269
|
+
v-model="entry.title"
|
|
270
|
+
size="xs"
|
|
271
|
+
:placeholder="t('mapo.title')"
|
|
272
|
+
/>
|
|
273
|
+
<UInput
|
|
274
|
+
v-model="entry.alt_text"
|
|
275
|
+
size="xs"
|
|
276
|
+
:placeholder="t('mapo.altTag')"
|
|
277
|
+
/>
|
|
278
|
+
<UInput
|
|
279
|
+
v-model="entry.description"
|
|
280
|
+
size="xs"
|
|
281
|
+
:placeholder="t('mapo.description')"
|
|
282
|
+
/>
|
|
283
|
+
<USelect
|
|
284
|
+
v-model="entry.folder"
|
|
285
|
+
:items="folderOptions"
|
|
286
|
+
size="xs"
|
|
287
|
+
:placeholder="t('mapo.folder')"
|
|
288
|
+
/>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
<!-- Progress bar -->
|
|
292
|
+
<div v-if="entry.status === 'uploading'" class="space-y-0.5">
|
|
293
|
+
<UProgress :model-value="entry.progress" size="xs" />
|
|
294
|
+
<p class="text-right text-xs text-dimmed">
|
|
295
|
+
{{ entry.progress }}%
|
|
296
|
+
</p>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<!-- Status badges -->
|
|
300
|
+
<div
|
|
301
|
+
v-if="entry.status === 'done'"
|
|
302
|
+
class="flex items-center gap-1 text-success"
|
|
303
|
+
>
|
|
304
|
+
<UIcon name="i-lucide-check-circle" class="size-3.5" />
|
|
305
|
+
<span class="text-xs">{{
|
|
306
|
+
t("mapo.mediaUploader.uploaded")
|
|
307
|
+
}}</span>
|
|
308
|
+
</div>
|
|
309
|
+
<div
|
|
310
|
+
v-if="entry.status === 'error'"
|
|
311
|
+
class="flex items-center gap-1 text-error"
|
|
312
|
+
>
|
|
313
|
+
<UIcon name="i-lucide-alert-circle" class="size-3.5" />
|
|
314
|
+
<span class="text-xs">{{ entry.error }}</span>
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
<!-- Remove -->
|
|
319
|
+
<UButton
|
|
320
|
+
v-if="
|
|
321
|
+
!uploading ||
|
|
322
|
+
entry.status === 'done' ||
|
|
323
|
+
entry.status === 'error'
|
|
324
|
+
"
|
|
325
|
+
icon="i-lucide-x"
|
|
326
|
+
size="xs"
|
|
327
|
+
variant="ghost"
|
|
328
|
+
color="neutral"
|
|
329
|
+
@click="remove(i)"
|
|
330
|
+
/>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
<!-- Upload CTA -->
|
|
336
|
+
<div class="flex justify-end pt-2">
|
|
337
|
+
<UButton
|
|
338
|
+
icon="i-lucide-upload"
|
|
339
|
+
:loading="uploading"
|
|
340
|
+
:disabled="!canUpload"
|
|
341
|
+
color="primary"
|
|
342
|
+
@click="upload"
|
|
343
|
+
>
|
|
344
|
+
{{
|
|
345
|
+
t("mapo.mediaUploader.uploadCta", { n: pendingCount }, pendingCount)
|
|
346
|
+
}}
|
|
347
|
+
</UButton>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
</template>
|