@mapomodule/uikit 2.0.0-beta.5 → 2.0.0-beta.6
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/dist/module.json +1 -1
- package/dist/runtime/components/MapoDetail.vue +1 -1
- package/dist/runtime/components/MapoList.vue +1 -1
- package/dist/runtime/components/MapoListQuickEdit.vue +1 -1
- package/dist/runtime/components/MapoListTable.vue +1 -1
- package/dist/runtime/components/MapoMediaFileChanger.vue +1 -1
- package/dist/runtime/components/MapoMediaManager.vue +1 -1
- package/dist/runtime/components/MapoMediaManagerDialog.vue +1 -1
- package/dist/runtime/components/MapoMediaPreview.vue +1 -1
- package/dist/runtime/stores/media.d.ts.map +1 -1
- package/dist/runtime/stores/media.js +7 -8
- package/package.json +1 -1
- package/src/runtime/stores/media.ts +11 -8
package/dist/module.json
CHANGED
|
@@ -27,7 +27,7 @@ const props = defineProps({
|
|
|
27
27
|
sticky: { type: Boolean, required: false, default: true },
|
|
28
28
|
usePatch: { type: Boolean, required: false, default: true },
|
|
29
29
|
readonly: { type: Boolean, required: false, default: false },
|
|
30
|
-
registry: { type: null, required: false, default: null },
|
|
30
|
+
registry: { type: [Object, null], required: false, default: null },
|
|
31
31
|
draft: { type: Boolean, required: false, default: false },
|
|
32
32
|
draftKey: { type: String, required: false, default: void 0 },
|
|
33
33
|
multipart: { type: null, required: false, default: "auto" },
|
|
@@ -18,7 +18,7 @@ const props = defineProps({
|
|
|
18
18
|
positionField: { type: String, required: false, default: "position" },
|
|
19
19
|
editFields: { type: Array, required: false, default: () => [] },
|
|
20
20
|
languages: { type: Array, required: false },
|
|
21
|
-
registry: { type:
|
|
21
|
+
registry: { type: Object, required: false },
|
|
22
22
|
detailBase: { type: String, required: false },
|
|
23
23
|
permissionModel: { type: String, required: false },
|
|
24
24
|
defaultPageSize: { type: Number, required: false, default: 20 },
|
|
@@ -9,7 +9,7 @@ const props = defineProps({
|
|
|
9
9
|
editFields: { type: Array, required: false, default: () => [] },
|
|
10
10
|
lookup: { type: String, required: false, default: "id" },
|
|
11
11
|
languages: { type: Array, required: false },
|
|
12
|
-
registry: { type:
|
|
12
|
+
registry: { type: Object, required: false },
|
|
13
13
|
offline: { type: Boolean, required: false, default: false },
|
|
14
14
|
localItem: { type: null, required: false, default: null }
|
|
15
15
|
});
|
|
@@ -31,7 +31,7 @@ const props = defineProps({
|
|
|
31
31
|
positionField: { type: String, required: false, default: "position" },
|
|
32
32
|
editFields: { type: Array, required: false, default: () => [] },
|
|
33
33
|
languages: { type: Array, required: false },
|
|
34
|
-
registry: { type:
|
|
34
|
+
registry: { type: Object, required: false },
|
|
35
35
|
detailBase: { type: String, required: false },
|
|
36
36
|
permissionModel: { type: String, required: false }
|
|
37
37
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ref, computed, onUnmounted } from "vue";
|
|
3
3
|
import { humanFileSize } from "@mapomodule/utils";
|
|
4
4
|
const props = defineProps({
|
|
5
|
-
media: { type:
|
|
5
|
+
media: { type: Object, required: true },
|
|
6
6
|
accept: { type: String, required: false }
|
|
7
7
|
});
|
|
8
8
|
const emit = defineEmits(["update:file", "update:maintainUrl"]);
|
|
@@ -8,7 +8,7 @@ const props = defineProps({
|
|
|
8
8
|
noFolders: { type: Boolean, required: false, default: false },
|
|
9
9
|
languages: { type: Array, required: false, default: void 0 },
|
|
10
10
|
defaultLang: { type: String, required: false, default: void 0 },
|
|
11
|
-
initialSelection: { type: null, required: false, default: null }
|
|
11
|
+
initialSelection: { type: [Object, Array, null], required: false, default: null }
|
|
12
12
|
});
|
|
13
13
|
const emit = defineEmits(["update:selection"]);
|
|
14
14
|
const store = useMediaStore();
|
|
@@ -8,7 +8,7 @@ const props = defineProps({
|
|
|
8
8
|
noFolders: { type: Boolean, required: false, default: false },
|
|
9
9
|
languages: { type: Array, required: false, default: void 0 },
|
|
10
10
|
defaultLang: { type: String, required: false, default: void 0 },
|
|
11
|
-
selected: { type: null, required: false, default: null }
|
|
11
|
+
selected: { type: [Object, Array, null], required: false, default: null }
|
|
12
12
|
});
|
|
13
13
|
const emit = defineEmits(["update:modelValue", "confirm"]);
|
|
14
14
|
const store = useMediaStore();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
const props = defineProps({
|
|
4
|
-
media: { type:
|
|
4
|
+
media: { type: Object, required: true },
|
|
5
5
|
size: { type: String, required: false, default: "md" },
|
|
6
6
|
contain: { type: Boolean, required: false, default: false },
|
|
7
7
|
showFilename: { type: Boolean, required: false, default: false },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/runtime/stores/media.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/runtime/stores/media.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EAEX,kBAAkB,EAClB,kBAAkB,EAGlB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;iBAOZ,CAAC;oBAA0B,CAAC;uBAC5B,CAAC;;;;;;;;;;;;;;;;;;;;iBADD,CAAC;oBAA0B,CAAC;uBAC5B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBADD,CAAC;oBAA0B,CAAC;uBAC5B,CAAC;;;;;;;;;;;;;;;;;;;;iBADD,CAAC;oBAA0B,CAAC;uBAC5B,CAAC;;;;;;;;;;;;;;eAgDJ,OAAO;uBACC,OAAO;iBACb,OAAO;;uBAkDa,kBAAkB,KAAQ,OAAO,CAAC,IAAI,CAAC;+BAuC9B,WAAW,GAAG,IAAI,KAAG,OAAO,CAAC,IAAI,CAAC;wBAOzC,SAAS,KAAG,OAAO,CAAC,IAAI,CAAC;uBAalC,IAAI;oBAIL,MAAM,GAAG,SAAS,KAAG,IA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AAO,CAAC,WAAW,CAAC,KAC3B,OAAO,CAAC,IAAI,CAAC;2BAYoB,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;yBAY7B,SAAS,KAAG,OAAO,CAAC,IAAI,CAAC;oBAapC,SAAS,KAAG,IAAI;6BAkBP,UAAU,KAAG,IAAI;0BAKpB,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,KAAG,IAAI;qBAI1C,MAAM,GAAG,MAAM,EAAE,KAAG,IAAI;yBAUtB,IAAI;0BAWG,OAAO,CAAC,IAAI,CAAC;2BAiBnC,kBAAkB,eACd,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KACrC,OAAO,CAAC,SAAS,CAAC;wBAqCM,MAAM,GAAG,IAAI,KAAG,IAAI;yBAKnB,MAAM,GAAG,IAAI,KAAG,IAAI;iBAK9B,IAAI;wUA0DtB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { ref, computed, shallowRef } from "vue";
|
|
|
3
3
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
4
4
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
5
5
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
6
|
+
import { applyMultipartPolicy } from "@mapomodule/core/runtime/api/multipart";
|
|
6
7
|
import { useNuxtApp, useRuntimeConfig } from "#app";
|
|
7
8
|
import { defaultMediaAdapter } from "../adapters/defaultMediaAdapter.js";
|
|
8
9
|
export const useMediaStore = defineStore("mapo-media", () => {
|
|
@@ -226,14 +227,12 @@ export const useMediaStore = defineStore("mapo-media", () => {
|
|
|
226
227
|
await getRoot();
|
|
227
228
|
}
|
|
228
229
|
async function uploadMedia(payload, onProgress) {
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
if (payload.
|
|
232
|
-
if (payload.
|
|
233
|
-
if (payload.
|
|
234
|
-
|
|
235
|
-
if (payload.folder != null)
|
|
236
|
-
formData.append("folder", String(payload.folder));
|
|
230
|
+
const body = { file: payload.file };
|
|
231
|
+
if (payload.title) body.title = payload.title;
|
|
232
|
+
if (payload.alt_text) body.alt_text = payload.alt_text;
|
|
233
|
+
if (payload.description) body.description = payload.description;
|
|
234
|
+
if (payload.folder != null) body.folder = payload.folder;
|
|
235
|
+
const formData = applyMultipartPolicy(body, "force");
|
|
237
236
|
return await new Promise((resolve, reject) => {
|
|
238
237
|
const xhr = new XMLHttpRequest();
|
|
239
238
|
xhr.open("POST", `${endpoints.media.replace(/\/+$/, "")}/`);
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { ref, computed, shallowRef } from "vue";
|
|
|
3
3
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
4
4
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
5
5
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
6
|
+
import { applyMultipartPolicy } from "@mapomodule/core/runtime/api/multipart";
|
|
6
7
|
import { useNuxtApp, useRuntimeConfig } from "#app";
|
|
7
8
|
import { defaultMediaAdapter } from "../adapters/defaultMediaAdapter.js";
|
|
8
9
|
import type {
|
|
@@ -330,14 +331,16 @@ export const useMediaStore = defineStore("mapo-media", () => {
|
|
|
330
331
|
payload: MediaUploadPayload,
|
|
331
332
|
onProgress?: (percent: number) => void,
|
|
332
333
|
): Promise<MediaItem> {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if (payload.
|
|
340
|
-
|
|
334
|
+
// Build the body through the same multipart pipeline every other write uses
|
|
335
|
+
// (`data` JSON envelope + files at their dot-path). Hand-rolling a flat
|
|
336
|
+
// FormData here made uploads the only write that spoke a different wire
|
|
337
|
+
// format, which backends parsing the envelope reject.
|
|
338
|
+
const body: Record<string, unknown> = { file: payload.file };
|
|
339
|
+
if (payload.title) body.title = payload.title;
|
|
340
|
+
if (payload.alt_text) body.alt_text = payload.alt_text;
|
|
341
|
+
if (payload.description) body.description = payload.description;
|
|
342
|
+
if (payload.folder != null) body.folder = payload.folder;
|
|
343
|
+
const formData = applyMultipartPolicy(body, "force") as FormData;
|
|
341
344
|
|
|
342
345
|
// ofetch has no upload-progress hook, so uploads go through XHR.
|
|
343
346
|
// Same-origin request: the session cookie is attached automatically.
|