@webx-ui/module-media 0.6.0 → 0.6.2
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/MediaManager.d.ts +19 -2
- package/dist/MediaPage.d.ts +58 -1
- package/dist/index.js +832 -775
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTranslate as
|
|
3
|
-
import { WxTree as
|
|
4
|
-
function
|
|
5
|
-
const i = `${
|
|
1
|
+
import { defineComponent as S, useModel as A, ref as R, watch as G, openBlock as h, createBlock as T, unref as e, mergeModels as q, computed as z, resolveDirective as Ge, withCtx as b, createElementBlock as L, Fragment as ce, renderList as me, withDirectives as Ye, createCommentVNode as B, createVNode as g, createTextVNode as O, toDisplayString as U, isRef as ve, useTemplateRef as oe, onMounted as Fe, nextTick as Je, createElementVNode as V, withKeys as Qe, normalizeClass as pe, createSlots as We, inject as Ze, normalizeStyle as fe, mergeProps as ge } from "vue";
|
|
2
|
+
import { useTranslate as H, useAdmin as se, useErrorText as et, adminKey as tt, WxListScreen as lt } from "@webx-ui/module-admin";
|
|
3
|
+
import { WxTree as at, WxSelectionArea as it, WxFileCard as Le, WxEmpty as nt, toast as J, WxAction as D, WxInput as Z, WxDropdown as Ve, WxDropdownItem as Te, WxActions as le, useModal as ye, WxDialog as he, WxSelect as ot, WxSpace as be, WxButton as I, useElementWidth as st, createModal as ae, WxPagination as rt, WxDrawer as dt, confirm as ue, openImageEditor as ut, WxSortableList as ct, WxPopover as Re, WxPopconfirm as Be, WxImage as mt, WxCard as pt } from "@webx-ui/core";
|
|
4
|
+
function we(a) {
|
|
5
|
+
const i = `${a.apiPath}/media`, n = (l) => l.data;
|
|
6
6
|
return {
|
|
7
|
-
directories: () =>
|
|
8
|
-
createDirectory: (l,
|
|
9
|
-
renameDirectory: (l,
|
|
10
|
-
moveDirectory: (l,
|
|
11
|
-
deleteDirectory: (l,
|
|
12
|
-
query: { force:
|
|
7
|
+
directories: () => a.http.get(`${i}/directories`).then(n),
|
|
8
|
+
createDirectory: (l, r) => a.http.post(`${i}/directories`, { parent_id: l, title: r }).then(n),
|
|
9
|
+
renameDirectory: (l, r) => a.http.patch(`${i}/directories/${l}`, { title: r }).then(n),
|
|
10
|
+
moveDirectory: (l, r) => a.http.patch(`${i}/directories/${l}/move`, { parent_id: r }).then(n),
|
|
11
|
+
deleteDirectory: (l, r = !1) => a.http.delete(`${i}/directories/${l}`, {
|
|
12
|
+
query: { force: r ? 1 : void 0 }
|
|
13
13
|
}),
|
|
14
|
-
files: (l = {}) =>
|
|
14
|
+
files: (l = {}) => a.http.get(`${i}/files`, {
|
|
15
15
|
query: {
|
|
16
16
|
directory_id: l.directory_id ?? void 0,
|
|
17
17
|
q: l.q || void 0,
|
|
@@ -21,111 +21,111 @@ function he(t) {
|
|
|
21
21
|
per_page: l.per_page
|
|
22
22
|
}
|
|
23
23
|
}),
|
|
24
|
-
file: (l) =>
|
|
25
|
-
fileByPath: (l) =>
|
|
26
|
-
async upload(l,
|
|
27
|
-
const
|
|
28
|
-
return
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}),
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
|
|
24
|
+
file: (l) => a.http.get(`${i}/files/${l}`).then(n),
|
|
25
|
+
fileByPath: (l) => a.http.get(`${i}/files/by-path?path=${encodeURIComponent(l)}`).then(n).catch(() => null),
|
|
26
|
+
async upload(l, r, d) {
|
|
27
|
+
const v = new FormData();
|
|
28
|
+
return v.append("directory_id", String(l)), r.forEach((t) => v.append("files[]", t)), new Promise((t, x) => {
|
|
29
|
+
const y = new XMLHttpRequest();
|
|
30
|
+
y.open("POST", `${i}/files`), y.responseType = "json", y.withCredentials = !0, y.setRequestHeader("Accept", "application/json"), y.setRequestHeader("X-Requested-With", "XMLHttpRequest"), y.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
|
|
31
|
+
const s = ft();
|
|
32
|
+
s && y.setRequestHeader("X-XSRF-TOKEN", s), y.upload.addEventListener("progress", (u) => {
|
|
33
|
+
u.lengthComputable && d?.(Math.round(u.loaded / u.total * 100));
|
|
34
|
+
}), y.addEventListener("load", () => {
|
|
35
|
+
const u = y.response;
|
|
36
|
+
if (y.status >= 200 && y.status < 300 && u?.data) {
|
|
37
|
+
t(u.data);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
Object.assign(new Error(
|
|
42
|
-
status:
|
|
43
|
-
body:
|
|
40
|
+
x(
|
|
41
|
+
Object.assign(new Error(u?.message ?? "Upload failed"), {
|
|
42
|
+
status: y.status,
|
|
43
|
+
body: u
|
|
44
44
|
})
|
|
45
45
|
);
|
|
46
|
-
}),
|
|
46
|
+
}), y.addEventListener("error", () => x(new Error("Upload failed"))), y.send(v);
|
|
47
47
|
});
|
|
48
48
|
},
|
|
49
|
-
rename: (l,
|
|
50
|
-
move: (l,
|
|
49
|
+
rename: (l, r) => a.http.patch(`${i}/files/${l}`, { name: r }).then(n),
|
|
50
|
+
move: (l, r) => a.http.post(`${i}/files/move`, { ids: l, directory_id: r }).then((d) => d.data.moved),
|
|
51
51
|
// A POST for the batch, not a DELETE: the panel's own client sends no body on DELETE, and
|
|
52
52
|
// a list of ids in a query string is a worse answer than an honest verb.
|
|
53
|
-
remove: (l) =>
|
|
54
|
-
removeOne: (l) =>
|
|
55
|
-
edit: (l,
|
|
56
|
-
copy: (l) =>
|
|
57
|
-
restoreOriginal: (l) =>
|
|
58
|
-
thumb(l,
|
|
53
|
+
remove: (l) => a.http.post(`${i}/files/delete`, { ids: l }).then((r) => r.data.deleted),
|
|
54
|
+
removeOne: (l) => a.http.delete(`${i}/files/${l}`),
|
|
55
|
+
edit: (l, r) => a.http.post(`${i}/files/${l}/edit`, r).then(n),
|
|
56
|
+
copy: (l) => a.http.post(`${i}/files/${l}/copy`).then(n),
|
|
57
|
+
restoreOriginal: (l) => a.http.post(`${i}/files/${l}/restore-original`).then(n),
|
|
58
|
+
thumb(l, r, d, v = "cover") {
|
|
59
59
|
if (!l.thumb)
|
|
60
60
|
return null;
|
|
61
|
-
const
|
|
62
|
-
return
|
|
61
|
+
const t = new URL(l.thumb, window.location.origin);
|
|
62
|
+
return t.searchParams.set("w", String(r)), d && t.searchParams.set("h", String(d)), t.searchParams.set("fit", v), t.pathname + t.search;
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
return
|
|
66
|
+
function ft() {
|
|
67
|
+
const a = document.cookie.split("; ").find((i) => i.startsWith("XSRF-TOKEN="));
|
|
68
|
+
return a ? decodeURIComponent(a.slice(11)) : null;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function De(a) {
|
|
71
71
|
const i = ["B", "KB", "MB", "GB", "TB"];
|
|
72
|
-
let
|
|
73
|
-
for (;
|
|
74
|
-
|
|
75
|
-
return `${
|
|
72
|
+
let n = a, l = 0;
|
|
73
|
+
for (; n >= 1024 && l < i.length - 1; )
|
|
74
|
+
n /= 1024, l++;
|
|
75
|
+
return `${n >= 10 || l === 0 ? Math.round(n) : n.toFixed(1)} ${i[l]}`;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
77
|
+
function vt(a) {
|
|
78
|
+
return a.split("/").pop() || a;
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const ze = /* @__PURE__ */ S({
|
|
81
81
|
__name: "DirectoryTree",
|
|
82
|
-
props: /* @__PURE__ */
|
|
82
|
+
props: /* @__PURE__ */ q({
|
|
83
83
|
directories: {}
|
|
84
84
|
}, {
|
|
85
85
|
selected: { default: null },
|
|
86
86
|
selectedModifiers: {}
|
|
87
87
|
}),
|
|
88
|
-
emits: /* @__PURE__ */
|
|
89
|
-
setup(
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
() =>
|
|
93
|
-
(
|
|
94
|
-
|
|
88
|
+
emits: /* @__PURE__ */ q(["move"], ["update:selected"]),
|
|
89
|
+
setup(a, { emit: i }) {
|
|
90
|
+
const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = R([]), t = R([]);
|
|
91
|
+
G(
|
|
92
|
+
() => n.directories,
|
|
93
|
+
(u) => {
|
|
94
|
+
v.value = u.map(x), t.value = y(u);
|
|
95
95
|
},
|
|
96
96
|
{ immediate: !0, deep: !0 }
|
|
97
97
|
);
|
|
98
|
-
function
|
|
98
|
+
function x(u) {
|
|
99
99
|
return {
|
|
100
|
-
...
|
|
101
|
-
label:
|
|
102
|
-
children: (
|
|
100
|
+
...u,
|
|
101
|
+
label: u.is_root ? d("manager.root") : u.title,
|
|
102
|
+
children: (u.children ?? []).map(x)
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return
|
|
105
|
+
function y(u) {
|
|
106
|
+
return u.flatMap((k) => [k.id, ...y(k.children ?? [])]);
|
|
107
107
|
}
|
|
108
|
-
function u
|
|
109
|
-
const
|
|
110
|
-
|
|
108
|
+
function s(u) {
|
|
109
|
+
const k = u.zone === "inside" ? u.target : u.parent;
|
|
110
|
+
k && r("move", u.node.id, k.id);
|
|
111
111
|
}
|
|
112
|
-
return (
|
|
112
|
+
return (u, k) => (h(), T(e(at), {
|
|
113
113
|
selected: l.value,
|
|
114
|
-
"onUpdate:selected":
|
|
115
|
-
expanded:
|
|
116
|
-
"onUpdate:expanded":
|
|
117
|
-
modelValue:
|
|
118
|
-
"onUpdate:modelValue":
|
|
114
|
+
"onUpdate:selected": k[0] || (k[0] = (w) => l.value = w),
|
|
115
|
+
expanded: t.value,
|
|
116
|
+
"onUpdate:expanded": k[1] || (k[1] = (w) => t.value = w),
|
|
117
|
+
modelValue: v.value,
|
|
118
|
+
"onUpdate:modelValue": k[2] || (k[2] = (w) => v.value = w),
|
|
119
119
|
class: "wx-media-tree",
|
|
120
120
|
"node-key": "id",
|
|
121
121
|
draggable: "",
|
|
122
122
|
"show-lines": "",
|
|
123
|
-
onDrop:
|
|
123
|
+
onDrop: s
|
|
124
124
|
}, null, 8, ["selected", "expanded", "modelValue"]));
|
|
125
125
|
}
|
|
126
|
-
}),
|
|
126
|
+
}), gt = /* @__PURE__ */ S({
|
|
127
127
|
__name: "FileGrid",
|
|
128
|
-
props: /* @__PURE__ */
|
|
128
|
+
props: /* @__PURE__ */ q({
|
|
129
129
|
files: {},
|
|
130
130
|
api: {},
|
|
131
131
|
query: {},
|
|
@@ -134,79 +134,80 @@ const Te = /* @__PURE__ */ O({
|
|
|
134
134
|
selected: { default: () => [] },
|
|
135
135
|
selectedModifiers: {}
|
|
136
136
|
}),
|
|
137
|
-
emits: /* @__PURE__ */
|
|
138
|
-
setup(
|
|
139
|
-
const
|
|
140
|
-
() =>
|
|
137
|
+
emits: /* @__PURE__ */ q(["open", "rename", "edit", "remove"], ["update:selected"]),
|
|
138
|
+
setup(a, { emit: i }) {
|
|
139
|
+
const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = z(
|
|
140
|
+
() => n.query ? d("manager.empty-search", { query: n.query }) : d("manager.empty")
|
|
141
141
|
);
|
|
142
|
-
function
|
|
143
|
-
|
|
142
|
+
function t() {
|
|
143
|
+
J.success(d("manager.link-copied"));
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
let
|
|
145
|
+
function x(y) {
|
|
146
|
+
const s = document.createElement("textarea");
|
|
147
|
+
s.value = y.url, s.setAttribute("readonly", ""), s.style.position = "fixed", s.style.opacity = "0", document.body.appendChild(s), s.select();
|
|
148
|
+
let u = !1;
|
|
149
149
|
try {
|
|
150
|
-
|
|
150
|
+
u = document.execCommand("copy");
|
|
151
151
|
} catch {
|
|
152
|
-
|
|
152
|
+
u = !1;
|
|
153
153
|
}
|
|
154
|
-
if (
|
|
155
|
-
|
|
154
|
+
if (s.remove(), u) {
|
|
155
|
+
t();
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
J.danger(`${d("errors.copy")} ${y.url}`, { duration: 0 });
|
|
159
159
|
}
|
|
160
|
-
return (
|
|
161
|
-
const
|
|
162
|
-
return
|
|
160
|
+
return (y, s) => {
|
|
161
|
+
const u = Ge("wx-select");
|
|
162
|
+
return a.files.length > 0 ? (h(), T(e(it), {
|
|
163
163
|
key: 0,
|
|
164
164
|
modelValue: l.value,
|
|
165
|
-
"onUpdate:modelValue":
|
|
165
|
+
"onUpdate:modelValue": s[0] || (s[0] = (k) => l.value = k),
|
|
166
166
|
class: "wx-media-grid",
|
|
167
|
-
multiple: !
|
|
167
|
+
multiple: !a.single
|
|
168
168
|
}, {
|
|
169
|
-
default:
|
|
170
|
-
(
|
|
171
|
-
key:
|
|
169
|
+
default: b(({ isSelected: k }) => [
|
|
170
|
+
(h(!0), L(ce, null, me(a.files, (w) => Ye((h(), T(e(Le), {
|
|
171
|
+
key: w.id,
|
|
172
172
|
class: "wx-media-grid__card",
|
|
173
|
-
name:
|
|
174
|
-
url:
|
|
175
|
-
thumbnail:
|
|
176
|
-
type:
|
|
177
|
-
selected:
|
|
173
|
+
name: w.name,
|
|
174
|
+
url: w.url,
|
|
175
|
+
thumbnail: a.api.thumb(w, 320, 320) ?? void 0,
|
|
176
|
+
type: w.mime,
|
|
177
|
+
selected: k(w.id),
|
|
178
178
|
renamable: "",
|
|
179
|
-
editable:
|
|
179
|
+
editable: w.editable,
|
|
180
180
|
removable: "",
|
|
181
181
|
copyable: "",
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"remove-
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
182
|
+
"actions-menu": "",
|
|
183
|
+
"rename-label": e(d)("manager.rename"),
|
|
184
|
+
"edit-label": e(d)("manager.edit"),
|
|
185
|
+
"remove-label": e(d)("manager.delete"),
|
|
186
|
+
"remove-confirm-text": e(d)("dialogs.delete-file", { name: w.name }),
|
|
187
|
+
"cancel-label": e(d)("manager.cancel"),
|
|
188
|
+
"save-label": e(d)("manager.save"),
|
|
189
|
+
"copy-label": e(d)("manager.copy-link"),
|
|
190
|
+
"copied-label": e(d)("manager.link-copied"),
|
|
191
|
+
onRename: (o) => r("rename", w, o),
|
|
192
|
+
onEdit: (o) => r("edit", w),
|
|
193
|
+
onRemove: (o) => r("remove", w),
|
|
194
|
+
onCopy: t,
|
|
195
|
+
onCopyError: (o) => x(w),
|
|
196
|
+
onDblclick: (o) => r("open", w)
|
|
196
197
|
}, null, 8, ["name", "url", "thumbnail", "type", "selected", "editable", "rename-label", "edit-label", "remove-label", "remove-confirm-text", "cancel-label", "save-label", "copy-label", "copied-label", "onRename", "onEdit", "onRemove", "onCopyError", "onDblclick"])), [
|
|
197
|
-
[
|
|
198
|
+
[u, w.id]
|
|
198
199
|
])), 128))
|
|
199
200
|
]),
|
|
200
201
|
_: 1
|
|
201
|
-
}, 8, ["modelValue", "multiple"])) : (
|
|
202
|
+
}, 8, ["modelValue", "multiple"])) : (h(), T(e(nt), {
|
|
202
203
|
key: 1,
|
|
203
|
-
description:
|
|
204
|
+
description: v.value
|
|
204
205
|
}, null, 8, ["description"]));
|
|
205
206
|
};
|
|
206
207
|
}
|
|
207
|
-
}),
|
|
208
|
+
}), yt = { class: "wx-media-toolbar" }, ht = /* @__PURE__ */ S({
|
|
208
209
|
__name: "MediaToolbar",
|
|
209
|
-
props: /* @__PURE__ */
|
|
210
|
+
props: /* @__PURE__ */ q({
|
|
210
211
|
canUpload: { type: Boolean },
|
|
211
212
|
canManage: { type: Boolean },
|
|
212
213
|
selected: {},
|
|
@@ -220,155 +221,155 @@ const Te = /* @__PURE__ */ O({
|
|
|
220
221
|
sort: { default: "-created_at" },
|
|
221
222
|
sortModifiers: {}
|
|
222
223
|
}),
|
|
223
|
-
emits: /* @__PURE__ */
|
|
224
|
-
setup(
|
|
225
|
-
const
|
|
226
|
-
{ value: "all", label:
|
|
227
|
-
...["image", "video", "audio", "document", "other"].map((
|
|
228
|
-
value:
|
|
229
|
-
label:
|
|
224
|
+
emits: /* @__PURE__ */ q(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
|
|
225
|
+
setup(a, { emit: i }) {
|
|
226
|
+
const n = a, l = A(a, "search"), r = A(a, "type"), d = A(a, "sort"), v = i, t = H("webx-media"), x = z(() => [
|
|
227
|
+
{ value: "all", label: t("manager.all-types") },
|
|
228
|
+
...["image", "video", "audio", "document", "other"].map((k) => ({
|
|
229
|
+
value: k,
|
|
230
|
+
label: t(`manager.${k}`)
|
|
230
231
|
}))
|
|
231
|
-
]),
|
|
232
|
-
{ value: "-created_at", label:
|
|
233
|
-
{ value: "created_at", label:
|
|
234
|
-
{ value: "name", label:
|
|
235
|
-
{ value: "-size", label:
|
|
236
|
-
]),
|
|
237
|
-
return (
|
|
238
|
-
|
|
232
|
+
]), y = z(() => [
|
|
233
|
+
{ value: "-created_at", label: t("manager.sort-newest") },
|
|
234
|
+
{ value: "created_at", label: t("manager.sort-oldest") },
|
|
235
|
+
{ value: "name", label: t("manager.sort-name") },
|
|
236
|
+
{ value: "-size", label: t("manager.sort-size") }
|
|
237
|
+
]), s = z(() => x.value.find((k) => k.value === r.value)?.label ?? ""), u = z(() => y.value.find((k) => k.value === d.value)?.label ?? "");
|
|
238
|
+
return (k, w) => (h(), L("header", yt, [
|
|
239
|
+
a.compact ? (h(), T(e(D), {
|
|
239
240
|
key: 0,
|
|
240
|
-
icon: "
|
|
241
|
-
title: e(
|
|
241
|
+
icon: "sidebar",
|
|
242
|
+
title: e(t)("manager.folders"),
|
|
242
243
|
size: "sm",
|
|
243
|
-
onClick:
|
|
244
|
-
}, null, 8, ["title"])) :
|
|
245
|
-
|
|
244
|
+
onClick: w[0] || (w[0] = (o) => v("folders"))
|
|
245
|
+
}, null, 8, ["title"])) : B("", !0),
|
|
246
|
+
g(e(Z), {
|
|
246
247
|
modelValue: l.value,
|
|
247
|
-
"onUpdate:modelValue":
|
|
248
|
+
"onUpdate:modelValue": w[1] || (w[1] = (o) => l.value = o),
|
|
248
249
|
class: "wx-media-toolbar__search",
|
|
249
|
-
placeholder: e(
|
|
250
|
+
placeholder: e(t)("manager.search"),
|
|
250
251
|
clearable: "",
|
|
251
252
|
size: "sm"
|
|
252
253
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
253
|
-
|
|
254
|
-
trigger:
|
|
255
|
-
|
|
254
|
+
a.fixedType ? B("", !0) : (h(), T(e(Ve), { key: 1 }, {
|
|
255
|
+
trigger: b(() => [
|
|
256
|
+
g(e(D), {
|
|
256
257
|
icon: "filter",
|
|
257
|
-
title: `${e(
|
|
258
|
+
title: `${e(t)("manager.all-types")}: ${s.value}`,
|
|
258
259
|
size: "sm"
|
|
259
260
|
}, null, 8, ["title"])
|
|
260
261
|
]),
|
|
261
|
-
default:
|
|
262
|
-
(
|
|
263
|
-
key: String(
|
|
264
|
-
active:
|
|
265
|
-
onClick: ($) =>
|
|
262
|
+
default: b(() => [
|
|
263
|
+
(h(!0), L(ce, null, me(x.value, (o) => (h(), T(e(Te), {
|
|
264
|
+
key: String(o.value),
|
|
265
|
+
active: o.value === r.value,
|
|
266
|
+
onClick: ($) => r.value = o.value
|
|
266
267
|
}, {
|
|
267
|
-
default:
|
|
268
|
-
|
|
268
|
+
default: b(() => [
|
|
269
|
+
O(U(o.label), 1)
|
|
269
270
|
]),
|
|
270
271
|
_: 2
|
|
271
272
|
}, 1032, ["active", "onClick"]))), 128))
|
|
272
273
|
]),
|
|
273
274
|
_: 1
|
|
274
275
|
})),
|
|
275
|
-
|
|
276
|
-
trigger:
|
|
277
|
-
|
|
276
|
+
g(e(Ve), null, {
|
|
277
|
+
trigger: b(() => [
|
|
278
|
+
g(e(D), {
|
|
278
279
|
icon: "arrow-down",
|
|
279
|
-
title:
|
|
280
|
+
title: u.value,
|
|
280
281
|
size: "sm"
|
|
281
282
|
}, null, 8, ["title"])
|
|
282
283
|
]),
|
|
283
|
-
default:
|
|
284
|
-
(
|
|
285
|
-
key:
|
|
286
|
-
active:
|
|
287
|
-
onClick: ($) =>
|
|
284
|
+
default: b(() => [
|
|
285
|
+
(h(!0), L(ce, null, me(y.value, (o) => (h(), T(e(Te), {
|
|
286
|
+
key: o.value,
|
|
287
|
+
active: o.value === d.value,
|
|
288
|
+
onClick: ($) => d.value = o.value
|
|
288
289
|
}, {
|
|
289
|
-
default:
|
|
290
|
-
|
|
290
|
+
default: b(() => [
|
|
291
|
+
O(U(o.label), 1)
|
|
291
292
|
]),
|
|
292
293
|
_: 2
|
|
293
294
|
}, 1032, ["active", "onClick"]))), 128))
|
|
294
295
|
]),
|
|
295
296
|
_: 1
|
|
296
297
|
}),
|
|
297
|
-
|
|
298
|
+
a.canUpload ? (h(), T(e(D), {
|
|
298
299
|
key: 2,
|
|
299
300
|
type: "upload",
|
|
300
|
-
title: e(
|
|
301
|
+
title: e(t)("manager.upload"),
|
|
301
302
|
size: "sm",
|
|
302
|
-
onClick:
|
|
303
|
-
}, null, 8, ["title"])) :
|
|
304
|
-
|
|
303
|
+
onClick: w[2] || (w[2] = (o) => v("upload"))
|
|
304
|
+
}, null, 8, ["title"])) : B("", !0),
|
|
305
|
+
a.canManage ? (h(), T(e(le), {
|
|
305
306
|
key: 3,
|
|
306
307
|
size: "sm"
|
|
307
308
|
}, {
|
|
308
|
-
default:
|
|
309
|
-
|
|
310
|
-
icon: "folder",
|
|
311
|
-
title: e(
|
|
312
|
-
disabled:
|
|
313
|
-
onClick:
|
|
309
|
+
default: b(() => [
|
|
310
|
+
g(e(D), {
|
|
311
|
+
icon: "folder-move",
|
|
312
|
+
title: e(t)("manager.move"),
|
|
313
|
+
disabled: n.selected === 0,
|
|
314
|
+
onClick: w[3] || (w[3] = (o) => v("move"))
|
|
314
315
|
}, null, 8, ["title", "disabled"]),
|
|
315
|
-
|
|
316
|
+
g(e(D), {
|
|
316
317
|
type: "remove",
|
|
317
|
-
title: e(
|
|
318
|
-
disabled:
|
|
319
|
-
onClick:
|
|
318
|
+
title: e(t)("manager.delete"),
|
|
319
|
+
disabled: n.selected === 0,
|
|
320
|
+
onClick: w[4] || (w[4] = (o) => v("remove"))
|
|
320
321
|
}, null, 8, ["title", "disabled"])
|
|
321
322
|
]),
|
|
322
323
|
_: 1
|
|
323
|
-
})) :
|
|
324
|
+
})) : B("", !0)
|
|
324
325
|
]));
|
|
325
326
|
}
|
|
326
|
-
}),
|
|
327
|
+
}), bt = /* @__PURE__ */ S({
|
|
327
328
|
__name: "MoveDialog",
|
|
328
329
|
props: {
|
|
329
330
|
directories: {},
|
|
330
331
|
from: {},
|
|
331
332
|
count: {}
|
|
332
333
|
},
|
|
333
|
-
setup(
|
|
334
|
-
const i =
|
|
335
|
-
() =>
|
|
336
|
-
),
|
|
337
|
-
function
|
|
338
|
-
return
|
|
334
|
+
setup(a) {
|
|
335
|
+
const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = z(
|
|
336
|
+
() => x(i.directories).filter((y) => y.value !== i.from)
|
|
337
|
+
), t = R(v.value[0]?.value ?? null);
|
|
338
|
+
function x(y) {
|
|
339
|
+
return y.flatMap((s) => [
|
|
339
340
|
{
|
|
340
|
-
value:
|
|
341
|
+
value: s.id,
|
|
341
342
|
// Indented, so the tree is still readable once it is a flat list.
|
|
342
|
-
label: " ".repeat(
|
|
343
|
+
label: " ".repeat(s.depth * 3) + (s.is_root ? d("manager.root") : s.title)
|
|
343
344
|
},
|
|
344
|
-
...
|
|
345
|
+
...x(s.children ?? [])
|
|
345
346
|
]);
|
|
346
347
|
}
|
|
347
|
-
return (
|
|
348
|
-
open: e(
|
|
349
|
-
"onUpdate:open":
|
|
350
|
-
title: e(
|
|
348
|
+
return (y, s) => (h(), T(e(he), {
|
|
349
|
+
open: e(n),
|
|
350
|
+
"onUpdate:open": s[3] || (s[3] = (u) => ve(n) ? n.value = u : null),
|
|
351
|
+
title: e(d)("manager.move-to"),
|
|
351
352
|
width: 420
|
|
352
353
|
}, {
|
|
353
|
-
footer:
|
|
354
|
-
|
|
355
|
-
default:
|
|
356
|
-
|
|
354
|
+
footer: b(() => [
|
|
355
|
+
g(e(be), { size: "sm" }, {
|
|
356
|
+
default: b(() => [
|
|
357
|
+
g(e(I), {
|
|
357
358
|
variant: "outline",
|
|
358
|
-
onClick:
|
|
359
|
+
onClick: s[1] || (s[1] = (u) => e(r)())
|
|
359
360
|
}, {
|
|
360
|
-
default:
|
|
361
|
-
|
|
361
|
+
default: b(() => [
|
|
362
|
+
O(U(e(d)("manager.cancel")), 1)
|
|
362
363
|
]),
|
|
363
364
|
_: 1
|
|
364
365
|
}),
|
|
365
|
-
|
|
366
|
+
g(e(I), {
|
|
366
367
|
type: "primary",
|
|
367
|
-
disabled:
|
|
368
|
-
onClick:
|
|
368
|
+
disabled: t.value === null,
|
|
369
|
+
onClick: s[2] || (s[2] = (u) => e(l)(t.value))
|
|
369
370
|
}, {
|
|
370
|
-
default:
|
|
371
|
-
|
|
371
|
+
default: b(() => [
|
|
372
|
+
O(U(e(d)("manager.move")), 1)
|
|
372
373
|
]),
|
|
373
374
|
_: 1
|
|
374
375
|
}, 8, ["disabled"])
|
|
@@ -376,17 +377,17 @@ const Te = /* @__PURE__ */ O({
|
|
|
376
377
|
_: 1
|
|
377
378
|
})
|
|
378
379
|
]),
|
|
379
|
-
default:
|
|
380
|
-
|
|
381
|
-
modelValue:
|
|
382
|
-
"onUpdate:modelValue":
|
|
383
|
-
options:
|
|
380
|
+
default: b(() => [
|
|
381
|
+
g(e(ot), {
|
|
382
|
+
modelValue: t.value,
|
|
383
|
+
"onUpdate:modelValue": s[0] || (s[0] = (u) => t.value = u),
|
|
384
|
+
options: v.value
|
|
384
385
|
}, null, 8, ["modelValue", "options"])
|
|
385
386
|
]),
|
|
386
387
|
_: 1
|
|
387
388
|
}, 8, ["open", "title"]));
|
|
388
389
|
}
|
|
389
|
-
}),
|
|
390
|
+
}), wt = /* @__PURE__ */ S({
|
|
390
391
|
__name: "NameDialog",
|
|
391
392
|
props: {
|
|
392
393
|
title: {},
|
|
@@ -394,40 +395,40 @@ const Te = /* @__PURE__ */ O({
|
|
|
394
395
|
value: { default: "" },
|
|
395
396
|
confirmText: { default: void 0 }
|
|
396
397
|
},
|
|
397
|
-
setup(
|
|
398
|
-
const i =
|
|
398
|
+
setup(a) {
|
|
399
|
+
const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = R(i.value), t = oe("input");
|
|
399
400
|
Fe(async () => {
|
|
400
|
-
await
|
|
401
|
+
await Je(), t.value?.querySelector("input")?.focus();
|
|
401
402
|
});
|
|
402
|
-
function
|
|
403
|
-
const
|
|
404
|
-
|
|
403
|
+
function x() {
|
|
404
|
+
const y = v.value.trim();
|
|
405
|
+
y !== "" && l(y);
|
|
405
406
|
}
|
|
406
|
-
return (
|
|
407
|
-
open: e(
|
|
408
|
-
"onUpdate:open":
|
|
409
|
-
title:
|
|
407
|
+
return (y, s) => (h(), T(e(he), {
|
|
408
|
+
open: e(n),
|
|
409
|
+
"onUpdate:open": s[2] || (s[2] = (u) => ve(n) ? n.value = u : null),
|
|
410
|
+
title: a.title,
|
|
410
411
|
width: 420
|
|
411
412
|
}, {
|
|
412
|
-
footer:
|
|
413
|
-
|
|
414
|
-
default:
|
|
415
|
-
|
|
413
|
+
footer: b(() => [
|
|
414
|
+
g(e(be), { size: "sm" }, {
|
|
415
|
+
default: b(() => [
|
|
416
|
+
g(e(I), {
|
|
416
417
|
variant: "outline",
|
|
417
|
-
onClick:
|
|
418
|
+
onClick: s[1] || (s[1] = (u) => e(r)())
|
|
418
419
|
}, {
|
|
419
|
-
default:
|
|
420
|
-
|
|
420
|
+
default: b(() => [
|
|
421
|
+
O(U(e(d)("manager.cancel")), 1)
|
|
421
422
|
]),
|
|
422
423
|
_: 1
|
|
423
424
|
}),
|
|
424
|
-
|
|
425
|
+
g(e(I), {
|
|
425
426
|
type: "primary",
|
|
426
|
-
disabled:
|
|
427
|
-
onClick:
|
|
427
|
+
disabled: v.value.trim() === "",
|
|
428
|
+
onClick: x
|
|
428
429
|
}, {
|
|
429
|
-
default:
|
|
430
|
-
|
|
430
|
+
default: b(() => [
|
|
431
|
+
O(U(a.confirmText ?? e(d)("manager.save")), 1)
|
|
431
432
|
]),
|
|
432
433
|
_: 1
|
|
433
434
|
}, 8, ["disabled"])
|
|
@@ -435,24 +436,24 @@ const Te = /* @__PURE__ */ O({
|
|
|
435
436
|
_: 1
|
|
436
437
|
})
|
|
437
438
|
]),
|
|
438
|
-
default:
|
|
439
|
-
|
|
439
|
+
default: b(() => [
|
|
440
|
+
V("div", {
|
|
440
441
|
ref_key: "input",
|
|
441
|
-
ref:
|
|
442
|
+
ref: t
|
|
442
443
|
}, [
|
|
443
|
-
|
|
444
|
-
modelValue:
|
|
445
|
-
"onUpdate:modelValue":
|
|
446
|
-
placeholder:
|
|
447
|
-
"aria-label":
|
|
448
|
-
onKeyup:
|
|
444
|
+
g(e(Z), {
|
|
445
|
+
modelValue: v.value,
|
|
446
|
+
"onUpdate:modelValue": s[0] || (s[0] = (u) => v.value = u),
|
|
447
|
+
placeholder: a.label ?? e(d)("manager.folder-name"),
|
|
448
|
+
"aria-label": a.label ?? e(d)("manager.folder-name"),
|
|
449
|
+
onKeyup: Qe(x, ["enter"])
|
|
449
450
|
}, null, 8, ["modelValue", "placeholder", "aria-label"])
|
|
450
451
|
], 512)
|
|
451
452
|
]),
|
|
452
453
|
_: 1
|
|
453
454
|
}, 8, ["open", "title"]));
|
|
454
455
|
}
|
|
455
|
-
}),
|
|
456
|
+
}), xt = {
|
|
456
457
|
module: {
|
|
457
458
|
title: "Files"
|
|
458
459
|
},
|
|
@@ -543,6 +544,7 @@ const Te = /* @__PURE__ */ O({
|
|
|
543
544
|
"delete-files-title": "Delete :count file(s)?",
|
|
544
545
|
"delete-files-text": "Anywhere they are already used, they will stop opening.",
|
|
545
546
|
"delete-folder-title": "Delete the folder :title?",
|
|
547
|
+
"delete-folder-text": "It goes for good, and so does whatever is inside it.",
|
|
546
548
|
"delete-folder-contents": "It holds :files file(s) and :directories folder(s).",
|
|
547
549
|
"delete-folder-warning": "Everything inside goes too, and pictures already placed in content will stop opening.",
|
|
548
550
|
confirm: "Delete",
|
|
@@ -581,374 +583,384 @@ const Te = /* @__PURE__ */ O({
|
|
|
581
583
|
other: "other files"
|
|
582
584
|
}
|
|
583
585
|
}
|
|
584
|
-
},
|
|
585
|
-
function
|
|
586
|
+
}, Ue = /* @__PURE__ */ new WeakSet();
|
|
587
|
+
function re() {
|
|
586
588
|
try {
|
|
587
|
-
const { i18n:
|
|
588
|
-
|
|
589
|
+
const { i18n: a } = se();
|
|
590
|
+
Ue.has(a) || (a.defaults("webx-media", xt), Ue.add(a));
|
|
589
591
|
} catch {
|
|
590
592
|
}
|
|
591
593
|
}
|
|
592
|
-
const
|
|
594
|
+
const kt = {
|
|
593
595
|
key: 0,
|
|
594
596
|
class: "wx-media__folders"
|
|
595
|
-
},
|
|
597
|
+
}, $t = { class: "wx-media__files" }, _t = ["accept"], Ct = { class: "wx-media__status" }, Mt = { key: 0 }, Vt = { class: "wx-media__drawer" }, Se = /* @__PURE__ */ S({
|
|
596
598
|
__name: "MediaManager",
|
|
597
|
-
props: {
|
|
599
|
+
props: /* @__PURE__ */ q({
|
|
598
600
|
picking: { type: Boolean, default: !1 },
|
|
599
601
|
accept: { default: null },
|
|
600
602
|
multiple: { type: Boolean, default: !1 },
|
|
601
|
-
max: { default: null }
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
603
|
+
max: { default: null },
|
|
604
|
+
inPage: { type: Boolean, default: !1 }
|
|
605
|
+
}, {
|
|
606
|
+
type: { default: "all" },
|
|
607
|
+
typeModifiers: {}
|
|
608
|
+
}),
|
|
609
|
+
emits: /* @__PURE__ */ q(["pick", "selection"], ["update:type"]),
|
|
610
|
+
setup(a, { expose: i, emit: n }) {
|
|
611
|
+
const l = a, r = n, d = se(), v = we(d);
|
|
612
|
+
re();
|
|
613
|
+
const t = H("webx-media"), x = et();
|
|
614
|
+
function y() {
|
|
609
615
|
return {
|
|
610
|
-
title:
|
|
611
|
-
saveLabel:
|
|
612
|
-
cancelLabel:
|
|
613
|
-
resetLabel:
|
|
614
|
-
rotateLeftLabel:
|
|
615
|
-
rotateRightLabel:
|
|
616
|
-
flipHorizontalLabel:
|
|
617
|
-
flipVerticalLabel:
|
|
618
|
-
ratioLabel:
|
|
619
|
-
cropLabel:
|
|
620
|
-
outputLabel:
|
|
621
|
-
outputHint:
|
|
622
|
-
widthLabel:
|
|
623
|
-
heightLabel:
|
|
624
|
-
freeLabel:
|
|
625
|
-
originalLabel:
|
|
626
|
-
errorText:
|
|
616
|
+
title: t("editor.title"),
|
|
617
|
+
saveLabel: t("editor.save"),
|
|
618
|
+
cancelLabel: t("editor.cancel"),
|
|
619
|
+
resetLabel: t("editor.reset"),
|
|
620
|
+
rotateLeftLabel: t("editor.rotate-left"),
|
|
621
|
+
rotateRightLabel: t("editor.rotate-right"),
|
|
622
|
+
flipHorizontalLabel: t("editor.flip-horizontal"),
|
|
623
|
+
flipVerticalLabel: t("editor.flip-vertical"),
|
|
624
|
+
ratioLabel: t("editor.ratio"),
|
|
625
|
+
cropLabel: t("editor.crop"),
|
|
626
|
+
outputLabel: t("editor.output"),
|
|
627
|
+
outputHint: t("editor.output-hint"),
|
|
628
|
+
widthLabel: t("editor.width"),
|
|
629
|
+
heightLabel: t("editor.height"),
|
|
630
|
+
freeLabel: t("editor.free"),
|
|
631
|
+
originalLabel: t("editor.original"),
|
|
632
|
+
errorText: t("editor.error")
|
|
627
633
|
};
|
|
628
634
|
}
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
() =>
|
|
632
|
-
(
|
|
633
|
-
|
|
635
|
+
const s = oe("root"), u = st(s), k = z(() => u.value > 0 && u.value < 640), w = R([]), o = R(null), $ = R(null), F = R([]), K = R(""), X = A(a, "type");
|
|
636
|
+
l.accept && (X.value = l.accept), G(
|
|
637
|
+
() => l.accept,
|
|
638
|
+
(p) => {
|
|
639
|
+
X.value = p ?? "all";
|
|
634
640
|
}
|
|
635
641
|
);
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
if (
|
|
639
|
-
|
|
642
|
+
const N = R("-created_at"), ee = R(!1), j = R(!1), te = oe("picker"), ie = z(() => $.value?.data ?? []), Q = z(() => d.can("media.manage")), de = z(() => d.can("media.upload") || Q.value), E = z(() => He(o.value)), ne = z(() => l.picking && !l.multiple);
|
|
643
|
+
G(F, (p) => {
|
|
644
|
+
if (l.max !== null && l.max > 0 && p.length > l.max) {
|
|
645
|
+
F.value = p.slice(0, l.max);
|
|
640
646
|
return;
|
|
641
647
|
}
|
|
642
|
-
|
|
648
|
+
r(
|
|
643
649
|
"selection",
|
|
644
|
-
|
|
650
|
+
ie.value.filter((f) => p.includes(f.id))
|
|
645
651
|
);
|
|
646
|
-
}), Fe(
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
),
|
|
650
|
-
|
|
652
|
+
}), Fe(c), G([o, X, N], () => m(1)), G(
|
|
653
|
+
K,
|
|
654
|
+
Ke(() => m(1), 300)
|
|
655
|
+
), G(k, (p) => {
|
|
656
|
+
p || (j.value = !1);
|
|
651
657
|
});
|
|
652
|
-
async function
|
|
653
|
-
|
|
658
|
+
async function c() {
|
|
659
|
+
w.value = await v.directories(), o.value ??= w.value[0]?.id ?? null, await m(1);
|
|
654
660
|
}
|
|
655
|
-
async function
|
|
661
|
+
async function m(p = $.value?.meta.current_page ?? 1) {
|
|
656
662
|
ee.value = !0;
|
|
657
663
|
try {
|
|
658
|
-
|
|
659
|
-
directory_id:
|
|
660
|
-
q:
|
|
661
|
-
type:
|
|
662
|
-
sort:
|
|
663
|
-
page:
|
|
664
|
-
}),
|
|
664
|
+
$.value = await v.files({
|
|
665
|
+
directory_id: K.value ? null : o.value,
|
|
666
|
+
q: K.value,
|
|
667
|
+
type: X.value === "all" ? null : X.value,
|
|
668
|
+
sort: N.value,
|
|
669
|
+
page: p
|
|
670
|
+
}), F.value = [];
|
|
665
671
|
} finally {
|
|
666
672
|
ee.value = !1;
|
|
667
673
|
}
|
|
668
674
|
}
|
|
669
|
-
function
|
|
670
|
-
|
|
675
|
+
function M() {
|
|
676
|
+
te.value?.click();
|
|
671
677
|
}
|
|
672
|
-
async function
|
|
673
|
-
const
|
|
674
|
-
if (
|
|
678
|
+
async function C(p) {
|
|
679
|
+
const f = p.target, _ = Array.from(f.files ?? []);
|
|
680
|
+
if (f.value = "", !(_.length === 0 || o.value === null))
|
|
675
681
|
try {
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
} catch (
|
|
679
|
-
|
|
682
|
+
const P = await v.upload(o.value, _), Y = P.filter((je) => je.duplicate).length;
|
|
683
|
+
P.length > Y && J.success(t("manager.uploaded", { count: P.length - Y })), Y > 0 && J.info(t("manager.duplicate-added")), await Promise.all([c(), m(1)]);
|
|
684
|
+
} catch (P) {
|
|
685
|
+
J.danger(x(P, t("errors.upload")));
|
|
680
686
|
}
|
|
681
687
|
}
|
|
682
|
-
const
|
|
683
|
-
async function
|
|
684
|
-
const
|
|
685
|
-
title:
|
|
686
|
-
confirmText:
|
|
688
|
+
const W = ae(wt);
|
|
689
|
+
async function $e() {
|
|
690
|
+
const p = await W({
|
|
691
|
+
title: t("manager.new-folder"),
|
|
692
|
+
confirmText: t("manager.new-folder")
|
|
687
693
|
});
|
|
688
|
-
|
|
694
|
+
p === void 0 || o.value === null || (await v.createDirectory(o.value, p), await c());
|
|
689
695
|
}
|
|
690
|
-
async function
|
|
691
|
-
const
|
|
692
|
-
if (!
|
|
696
|
+
async function _e() {
|
|
697
|
+
const p = E.value;
|
|
698
|
+
if (!p || p.is_root)
|
|
693
699
|
return;
|
|
694
|
-
const
|
|
695
|
-
title:
|
|
696
|
-
value:
|
|
697
|
-
confirmText:
|
|
700
|
+
const f = await W({
|
|
701
|
+
title: t("manager.rename"),
|
|
702
|
+
value: p.title,
|
|
703
|
+
confirmText: t("manager.save")
|
|
698
704
|
});
|
|
699
|
-
|
|
705
|
+
f !== void 0 && (await v.renameDirectory(p.id, f), await c());
|
|
700
706
|
}
|
|
701
|
-
async function
|
|
702
|
-
const
|
|
703
|
-
if (!(!
|
|
707
|
+
async function Ce() {
|
|
708
|
+
const p = E.value;
|
|
709
|
+
if (!(!p || p.is_root || !await ue({
|
|
710
|
+
title: t("dialogs.delete-folder-title", { title: p.title }),
|
|
711
|
+
message: t("dialogs.delete-folder-text"),
|
|
712
|
+
confirmText: t("dialogs.confirm"),
|
|
713
|
+
cancelText: t("manager.cancel"),
|
|
714
|
+
tone: "danger"
|
|
715
|
+
}))) {
|
|
704
716
|
try {
|
|
705
|
-
await
|
|
706
|
-
} catch (
|
|
707
|
-
const
|
|
708
|
-
if (!
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
717
|
+
await v.deleteDirectory(p.id);
|
|
718
|
+
} catch (_) {
|
|
719
|
+
const P = Xe(_);
|
|
720
|
+
if (!P) {
|
|
721
|
+
J.danger(x(_));
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (!await ue({
|
|
725
|
+
title: t("dialogs.delete-folder-title", { title: p.title }),
|
|
726
|
+
message: `${t("dialogs.delete-folder-contents", P)} ${t("dialogs.delete-folder-warning")}`,
|
|
727
|
+
confirmText: t("dialogs.confirm"),
|
|
728
|
+
cancelText: t("manager.cancel"),
|
|
715
729
|
tone: "danger"
|
|
716
730
|
}))
|
|
717
731
|
return;
|
|
718
|
-
await
|
|
732
|
+
await v.deleteDirectory(p.id, !0);
|
|
719
733
|
}
|
|
720
|
-
|
|
734
|
+
o.value = null, await c();
|
|
721
735
|
}
|
|
722
736
|
}
|
|
723
|
-
async function
|
|
737
|
+
async function Me(p, f) {
|
|
724
738
|
try {
|
|
725
|
-
await
|
|
739
|
+
await v.moveDirectory(p, f);
|
|
726
740
|
} catch (_) {
|
|
727
|
-
|
|
741
|
+
J.danger(x(_, t("errors.directory-into-itself")));
|
|
728
742
|
}
|
|
729
|
-
await
|
|
743
|
+
await c();
|
|
730
744
|
}
|
|
731
|
-
const
|
|
732
|
-
async function
|
|
733
|
-
const
|
|
734
|
-
directories:
|
|
735
|
-
from:
|
|
736
|
-
count:
|
|
745
|
+
const Ee = ae(bt);
|
|
746
|
+
async function Pe() {
|
|
747
|
+
const p = await Ee({
|
|
748
|
+
directories: w.value,
|
|
749
|
+
from: o.value,
|
|
750
|
+
count: F.value.length
|
|
737
751
|
});
|
|
738
|
-
|
|
752
|
+
p !== void 0 && (await v.move([...F.value], p), await Promise.all([c(), m()]));
|
|
739
753
|
}
|
|
740
754
|
async function Oe() {
|
|
741
|
-
const
|
|
742
|
-
await
|
|
743
|
-
title:
|
|
744
|
-
message:
|
|
745
|
-
confirmText:
|
|
746
|
-
cancelText:
|
|
755
|
+
const p = [...F.value];
|
|
756
|
+
await ue({
|
|
757
|
+
title: t("dialogs.delete-files-title", { count: p.length }),
|
|
758
|
+
message: t("dialogs.delete-files-text"),
|
|
759
|
+
confirmText: t("dialogs.confirm"),
|
|
760
|
+
cancelText: t("manager.cancel"),
|
|
747
761
|
tone: "danger"
|
|
748
|
-
}) && (await
|
|
762
|
+
}) && (await v.remove(p), await Promise.all([c(), m()]));
|
|
749
763
|
}
|
|
750
|
-
async function
|
|
751
|
-
await
|
|
764
|
+
async function Ae(p, f) {
|
|
765
|
+
await v.rename(p.id, f), await m();
|
|
752
766
|
}
|
|
753
|
-
async function
|
|
754
|
-
await
|
|
767
|
+
async function Ne(p) {
|
|
768
|
+
await v.removeOne(p.id), await Promise.all([c(), m()]);
|
|
755
769
|
}
|
|
756
|
-
async function
|
|
757
|
-
const
|
|
758
|
-
src:
|
|
759
|
-
fileName:
|
|
770
|
+
async function qe(p) {
|
|
771
|
+
const f = await ut({
|
|
772
|
+
src: p.source ?? p.url,
|
|
773
|
+
fileName: p.file_name,
|
|
760
774
|
filters: !1,
|
|
761
775
|
// The editor is a component of the design system: its words are props with English
|
|
762
776
|
// defaults, not lines in the panel's dictionary. Whoever opens it is the one who knows
|
|
763
777
|
// what language the panel is being read in.
|
|
764
|
-
...
|
|
778
|
+
...y()
|
|
765
779
|
});
|
|
766
|
-
|
|
780
|
+
f && (await v.edit(p.id, {
|
|
767
781
|
// The editor's frame is read against the picture as it is on screen — already turned — and
|
|
768
782
|
// the server applies the operations in that order for the same reason.
|
|
769
|
-
crop:
|
|
770
|
-
rotate: (
|
|
771
|
-
flip:
|
|
772
|
-
resize: { width:
|
|
773
|
-
}), await
|
|
783
|
+
crop: f.crop,
|
|
784
|
+
rotate: (f.rotation % 360 + 360) % 360,
|
|
785
|
+
flip: f.flipX ? "horizontal" : f.flipY ? "vertical" : void 0,
|
|
786
|
+
resize: { width: f.width, height: f.height }
|
|
787
|
+
}), await m());
|
|
774
788
|
}
|
|
775
|
-
function
|
|
776
|
-
|
|
789
|
+
function Ie(p) {
|
|
790
|
+
l.multiple || r("pick", p);
|
|
777
791
|
}
|
|
778
|
-
function
|
|
779
|
-
const
|
|
780
|
-
for (const
|
|
781
|
-
if (
|
|
782
|
-
return
|
|
783
|
-
const
|
|
784
|
-
if (
|
|
785
|
-
return
|
|
792
|
+
function He(p) {
|
|
793
|
+
const f = (_) => {
|
|
794
|
+
for (const P of _) {
|
|
795
|
+
if (P.id === p)
|
|
796
|
+
return P;
|
|
797
|
+
const Y = f(P.children ?? []);
|
|
798
|
+
if (Y)
|
|
799
|
+
return Y;
|
|
786
800
|
}
|
|
787
801
|
return null;
|
|
788
802
|
};
|
|
789
|
-
return
|
|
790
|
-
}
|
|
791
|
-
function Ie(m) {
|
|
792
|
-
const p = m?.body;
|
|
793
|
-
return p?.code === "directory_not_empty" ? p.counts ?? null : null;
|
|
803
|
+
return p === null ? null : f(w.value);
|
|
794
804
|
}
|
|
795
|
-
function
|
|
796
|
-
|
|
805
|
+
function Xe(p) {
|
|
806
|
+
const f = p?.body;
|
|
807
|
+
return f?.code === "directory_not_empty" ? f.counts ?? null : null;
|
|
797
808
|
}
|
|
798
|
-
|
|
809
|
+
i({ upload: M });
|
|
810
|
+
function Ke(p, f) {
|
|
799
811
|
let _;
|
|
800
812
|
return () => {
|
|
801
|
-
clearTimeout(_), _ = setTimeout(
|
|
813
|
+
clearTimeout(_), _ = setTimeout(p, f);
|
|
802
814
|
};
|
|
803
815
|
}
|
|
804
|
-
return (
|
|
816
|
+
return (p, f) => (h(), L("div", {
|
|
805
817
|
ref_key: "root",
|
|
806
|
-
ref:
|
|
807
|
-
class:
|
|
818
|
+
ref: s,
|
|
819
|
+
class: pe(["wx-media", { "wx-media--compact": k.value }])
|
|
808
820
|
}, [
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
selected:
|
|
812
|
-
"onUpdate:selected":
|
|
813
|
-
directories:
|
|
814
|
-
onMove:
|
|
821
|
+
k.value ? B("", !0) : (h(), L("aside", kt, [
|
|
822
|
+
g(ze, {
|
|
823
|
+
selected: o.value,
|
|
824
|
+
"onUpdate:selected": f[0] || (f[0] = (_) => o.value = _),
|
|
825
|
+
directories: w.value,
|
|
826
|
+
onMove: Me
|
|
815
827
|
}, null, 8, ["selected", "directories"]),
|
|
816
|
-
|
|
828
|
+
Q.value ? (h(), T(e(le), {
|
|
817
829
|
key: 0,
|
|
818
830
|
size: "sm",
|
|
819
831
|
align: "start"
|
|
820
832
|
}, {
|
|
821
|
-
default:
|
|
822
|
-
|
|
833
|
+
default: b(() => [
|
|
834
|
+
g(e(D), {
|
|
823
835
|
type: "add",
|
|
824
|
-
title: e(
|
|
825
|
-
onClick:
|
|
836
|
+
title: e(t)("manager.new-folder"),
|
|
837
|
+
onClick: $e
|
|
826
838
|
}, null, 8, ["title"]),
|
|
827
|
-
|
|
839
|
+
g(e(D), {
|
|
828
840
|
type: "edit",
|
|
829
|
-
title: e(
|
|
841
|
+
title: e(t)("manager.rename"),
|
|
830
842
|
disabled: !E.value || E.value.is_root,
|
|
831
|
-
onClick:
|
|
843
|
+
onClick: _e
|
|
832
844
|
}, null, 8, ["title", "disabled"]),
|
|
833
|
-
|
|
845
|
+
g(e(D), {
|
|
834
846
|
type: "remove",
|
|
835
|
-
title: e(
|
|
847
|
+
title: e(t)("manager.delete"),
|
|
836
848
|
disabled: !E.value || E.value.is_root,
|
|
837
|
-
onClick:
|
|
849
|
+
onClick: Ce
|
|
838
850
|
}, null, 8, ["title", "disabled"])
|
|
839
851
|
]),
|
|
840
852
|
_: 1
|
|
841
|
-
})) :
|
|
853
|
+
})) : B("", !0)
|
|
842
854
|
])),
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
search:
|
|
846
|
-
"onUpdate:search":
|
|
847
|
-
type:
|
|
848
|
-
"onUpdate:type":
|
|
849
|
-
sort:
|
|
850
|
-
"onUpdate:sort":
|
|
851
|
-
"can-upload":
|
|
852
|
-
"fixed-type":
|
|
853
|
-
"can-manage":
|
|
854
|
-
selected:
|
|
855
|
-
compact:
|
|
856
|
-
onUpload:
|
|
857
|
-
onMove:
|
|
855
|
+
V("section", $t, [
|
|
856
|
+
g(ht, {
|
|
857
|
+
search: K.value,
|
|
858
|
+
"onUpdate:search": f[1] || (f[1] = (_) => K.value = _),
|
|
859
|
+
type: X.value,
|
|
860
|
+
"onUpdate:type": f[2] || (f[2] = (_) => X.value = _),
|
|
861
|
+
sort: N.value,
|
|
862
|
+
"onUpdate:sort": f[3] || (f[3] = (_) => N.value = _),
|
|
863
|
+
"can-upload": de.value && !a.inPage,
|
|
864
|
+
"fixed-type": a.accept !== null || a.inPage,
|
|
865
|
+
"can-manage": Q.value,
|
|
866
|
+
selected: F.value.length,
|
|
867
|
+
compact: k.value,
|
|
868
|
+
onUpload: M,
|
|
869
|
+
onMove: Pe,
|
|
858
870
|
onRemove: Oe,
|
|
859
|
-
onFolders:
|
|
871
|
+
onFolders: f[4] || (f[4] = (_) => j.value = !0)
|
|
860
872
|
}, null, 8, ["search", "type", "sort", "can-upload", "fixed-type", "can-manage", "selected", "compact"]),
|
|
861
|
-
|
|
873
|
+
V("input", {
|
|
862
874
|
ref_key: "picker",
|
|
863
|
-
ref:
|
|
875
|
+
ref: te,
|
|
864
876
|
type: "file",
|
|
865
877
|
multiple: "",
|
|
866
878
|
hidden: "",
|
|
867
|
-
accept:
|
|
868
|
-
onChange:
|
|
869
|
-
}, null, 40,
|
|
870
|
-
|
|
871
|
-
selected:
|
|
872
|
-
"onUpdate:selected":
|
|
873
|
-
files:
|
|
874
|
-
api: e(
|
|
875
|
-
query:
|
|
876
|
-
single:
|
|
877
|
-
onRename:
|
|
878
|
-
onEdit:
|
|
879
|
-
onRemove:
|
|
880
|
-
onOpen:
|
|
879
|
+
accept: a.accept === null ? void 0 : `${a.accept}/*`,
|
|
880
|
+
onChange: C
|
|
881
|
+
}, null, 40, _t),
|
|
882
|
+
g(gt, {
|
|
883
|
+
selected: F.value,
|
|
884
|
+
"onUpdate:selected": f[5] || (f[5] = (_) => F.value = _),
|
|
885
|
+
files: ie.value,
|
|
886
|
+
api: e(v),
|
|
887
|
+
query: K.value,
|
|
888
|
+
single: ne.value,
|
|
889
|
+
onRename: Ae,
|
|
890
|
+
onEdit: qe,
|
|
891
|
+
onRemove: Ne,
|
|
892
|
+
onOpen: Ie
|
|
881
893
|
}, null, 8, ["selected", "files", "api", "query", "single"]),
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
894
|
+
V("footer", Ct, [
|
|
895
|
+
V("span", null, U(e(t)("manager.status-files", { count: $.value?.stats.files ?? 0 })), 1),
|
|
896
|
+
F.value.length > 0 ? (h(), L("span", Mt, U(e(t)("manager.status-selected", { count: F.value.length })), 1)) : B("", !0),
|
|
897
|
+
V("span", null, U(e(t)("manager.status-size", { size: e(De)($.value?.stats.size ?? 0) })), 1)
|
|
886
898
|
]),
|
|
887
|
-
|
|
899
|
+
$.value && $.value.meta.last_page > 1 ? (h(), T(e(rt), {
|
|
888
900
|
key: 0,
|
|
889
|
-
page:
|
|
890
|
-
"per-page":
|
|
891
|
-
total:
|
|
892
|
-
"last-page":
|
|
901
|
+
page: $.value.meta.current_page,
|
|
902
|
+
"per-page": $.value.meta.per_page,
|
|
903
|
+
total: $.value.meta.total,
|
|
904
|
+
"last-page": $.value.meta.last_page,
|
|
893
905
|
disabled: ee.value,
|
|
894
906
|
size: "sm",
|
|
895
|
-
onChange:
|
|
896
|
-
}, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) :
|
|
907
|
+
onChange: f[6] || (f[6] = ({ page: _ }) => m(_))
|
|
908
|
+
}, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : B("", !0)
|
|
897
909
|
]),
|
|
898
|
-
|
|
899
|
-
open:
|
|
900
|
-
"onUpdate:open":
|
|
910
|
+
g(e(dt), {
|
|
911
|
+
open: j.value,
|
|
912
|
+
"onUpdate:open": f[9] || (f[9] = (_) => j.value = _),
|
|
901
913
|
side: "left",
|
|
902
|
-
title: e(
|
|
914
|
+
title: e(t)("manager.folders"),
|
|
903
915
|
size: 280
|
|
904
916
|
}, {
|
|
905
|
-
default:
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
selected:
|
|
917
|
+
default: b(() => [
|
|
918
|
+
V("div", Vt, [
|
|
919
|
+
g(ze, {
|
|
920
|
+
selected: o.value,
|
|
909
921
|
"onUpdate:selected": [
|
|
910
|
-
|
|
911
|
-
|
|
922
|
+
f[7] || (f[7] = (_) => o.value = _),
|
|
923
|
+
f[8] || (f[8] = (_) => j.value = !1)
|
|
912
924
|
],
|
|
913
|
-
directories:
|
|
914
|
-
onMove:
|
|
925
|
+
directories: w.value,
|
|
926
|
+
onMove: Me
|
|
915
927
|
}, null, 8, ["selected", "directories"]),
|
|
916
|
-
|
|
928
|
+
Q.value ? (h(), T(e(le), {
|
|
917
929
|
key: 0,
|
|
918
930
|
size: "sm",
|
|
919
931
|
align: "start"
|
|
920
932
|
}, {
|
|
921
|
-
default:
|
|
922
|
-
|
|
933
|
+
default: b(() => [
|
|
934
|
+
g(e(D), {
|
|
923
935
|
type: "add",
|
|
924
|
-
title: e(
|
|
925
|
-
onClick:
|
|
936
|
+
title: e(t)("manager.new-folder"),
|
|
937
|
+
onClick: $e
|
|
926
938
|
}, null, 8, ["title"]),
|
|
927
|
-
|
|
939
|
+
g(e(D), {
|
|
928
940
|
type: "edit",
|
|
929
|
-
title: e(
|
|
941
|
+
title: e(t)("manager.rename"),
|
|
930
942
|
disabled: !E.value || E.value.is_root,
|
|
931
|
-
onClick:
|
|
943
|
+
onClick: _e
|
|
932
944
|
}, null, 8, ["title", "disabled"]),
|
|
933
|
-
|
|
945
|
+
g(e(D), {
|
|
934
946
|
type: "remove",
|
|
935
|
-
title: e(
|
|
947
|
+
title: e(t)("manager.delete"),
|
|
936
948
|
disabled: !E.value || E.value.is_root,
|
|
937
|
-
onClick:
|
|
949
|
+
onClick: Ce
|
|
938
950
|
}, null, 8, ["title", "disabled"])
|
|
939
951
|
]),
|
|
940
952
|
_: 1
|
|
941
|
-
})) :
|
|
953
|
+
})) : B("", !0)
|
|
942
954
|
])
|
|
943
955
|
]),
|
|
944
956
|
_: 1
|
|
945
957
|
}, 8, ["open", "title"])
|
|
946
958
|
], 2));
|
|
947
959
|
}
|
|
948
|
-
}),
|
|
960
|
+
}), Tt = { class: "wx-media-picker" }, zt = {
|
|
949
961
|
key: 0,
|
|
950
962
|
class: "wx-media-picker__count"
|
|
951
|
-
},
|
|
963
|
+
}, xe = /* @__PURE__ */ S({
|
|
952
964
|
__name: "MediaPicker",
|
|
953
965
|
props: {
|
|
954
966
|
accept: { default: "image" },
|
|
@@ -957,51 +969,51 @@ const bt = {
|
|
|
957
969
|
multiple: { type: Boolean, default: !1 },
|
|
958
970
|
max: { default: null }
|
|
959
971
|
},
|
|
960
|
-
setup(
|
|
961
|
-
const { open: i, resolve:
|
|
962
|
-
return (
|
|
972
|
+
setup(a) {
|
|
973
|
+
const { open: i, resolve: n, dismiss: l } = ye(), r = H("webx-media"), d = R([]);
|
|
974
|
+
return (v, t) => (h(), T(e(he), {
|
|
963
975
|
open: e(i),
|
|
964
|
-
"onUpdate:open":
|
|
965
|
-
title:
|
|
976
|
+
"onUpdate:open": t[4] || (t[4] = (x) => ve(i) ? i.value = x : null),
|
|
977
|
+
title: a.title ?? e(r)("module.title"),
|
|
966
978
|
width: 960
|
|
967
|
-
},
|
|
968
|
-
default:
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
picking: !
|
|
972
|
-
accept:
|
|
973
|
-
multiple:
|
|
974
|
-
max:
|
|
975
|
-
onPick:
|
|
976
|
-
onSelection:
|
|
979
|
+
}, We({
|
|
980
|
+
default: b(() => [
|
|
981
|
+
V("div", Tt, [
|
|
982
|
+
g(Se, {
|
|
983
|
+
picking: !a.manage,
|
|
984
|
+
accept: a.manage ? null : a.accept,
|
|
985
|
+
multiple: a.multiple && !a.manage,
|
|
986
|
+
max: a.max,
|
|
987
|
+
onPick: t[0] || (t[0] = (x) => e(n)(x)),
|
|
988
|
+
onSelection: t[1] || (t[1] = (x) => d.value = x)
|
|
977
989
|
}, null, 8, ["picking", "accept", "multiple", "max"])
|
|
978
990
|
])
|
|
979
991
|
]),
|
|
980
992
|
_: 2
|
|
981
993
|
}, [
|
|
982
|
-
|
|
994
|
+
a.multiple && !a.manage ? {
|
|
983
995
|
name: "footer",
|
|
984
|
-
fn:
|
|
985
|
-
|
|
986
|
-
default:
|
|
987
|
-
|
|
988
|
-
|
|
996
|
+
fn: b(() => [
|
|
997
|
+
g(e(be), { size: "sm" }, {
|
|
998
|
+
default: b(() => [
|
|
999
|
+
a.max !== null && a.max > 0 ? (h(), L("span", zt, U(e(r)("manager.chosen", { count: d.value.length, max: a.max })), 1)) : B("", !0),
|
|
1000
|
+
g(e(I), {
|
|
989
1001
|
variant: "outline",
|
|
990
|
-
onClick:
|
|
1002
|
+
onClick: t[2] || (t[2] = (x) => e(l)())
|
|
991
1003
|
}, {
|
|
992
|
-
default:
|
|
993
|
-
|
|
1004
|
+
default: b(() => [
|
|
1005
|
+
O(U(e(r)("manager.cancel")), 1)
|
|
994
1006
|
]),
|
|
995
1007
|
_: 1
|
|
996
1008
|
}),
|
|
997
|
-
|
|
1009
|
+
g(e(I), {
|
|
998
1010
|
class: "wx-media-picker__confirm",
|
|
999
1011
|
type: "primary",
|
|
1000
|
-
disabled:
|
|
1001
|
-
onClick:
|
|
1012
|
+
disabled: d.value.length === 0,
|
|
1013
|
+
onClick: t[3] || (t[3] = (x) => e(n)(d.value))
|
|
1002
1014
|
}, {
|
|
1003
|
-
default:
|
|
1004
|
-
|
|
1015
|
+
default: b(() => [
|
|
1016
|
+
O(U(e(r)("manager.pick", { count: d.value.length })), 1)
|
|
1005
1017
|
]),
|
|
1006
1018
|
_: 1
|
|
1007
1019
|
}, 8, ["disabled"])
|
|
@@ -1013,26 +1025,26 @@ const bt = {
|
|
|
1013
1025
|
} : void 0
|
|
1014
1026
|
]), 1032, ["open", "title"]));
|
|
1015
1027
|
}
|
|
1016
|
-
}),
|
|
1028
|
+
}), Ut = ae(xe), Ft = ae(xe, {
|
|
1017
1029
|
props: { multiple: !0 }
|
|
1018
|
-
}),
|
|
1019
|
-
|
|
1030
|
+
}), Wt = ae(
|
|
1031
|
+
xe,
|
|
1020
1032
|
{ props: { manage: !0 } }
|
|
1021
|
-
),
|
|
1033
|
+
), Lt = {
|
|
1022
1034
|
key: 0,
|
|
1023
1035
|
class: "wx-media-list__label"
|
|
1024
|
-
},
|
|
1036
|
+
}, Rt = {
|
|
1025
1037
|
key: 0,
|
|
1026
1038
|
class: "wx-media-list__missing"
|
|
1027
|
-
},
|
|
1039
|
+
}, Bt = { key: 1 }, Dt = {
|
|
1028
1040
|
key: 0,
|
|
1029
1041
|
class: "wx-media-list__tools"
|
|
1030
|
-
},
|
|
1042
|
+
}, St = { class: "wx-media-list__captions" }, Et = { class: "wx-media-list__caption" }, Pt = { class: "wx-media-list__caption" }, Ot = { class: "wx-media-list__captions-footer" }, At = { class: "wx-media-list__footer" }, Nt = {
|
|
1031
1043
|
key: 0,
|
|
1032
1044
|
class: "wx-media-list__hint"
|
|
1033
|
-
},
|
|
1045
|
+
}, ke = /* @__PURE__ */ S({
|
|
1034
1046
|
__name: "MediaList",
|
|
1035
|
-
props: /* @__PURE__ */
|
|
1047
|
+
props: /* @__PURE__ */ q({
|
|
1036
1048
|
label: { default: void 0 },
|
|
1037
1049
|
layout: { default: "grid" },
|
|
1038
1050
|
accept: { default: null },
|
|
@@ -1048,174 +1060,174 @@ const bt = {
|
|
|
1048
1060
|
modelModifiers: {}
|
|
1049
1061
|
}),
|
|
1050
1062
|
emits: ["update:modelValue"],
|
|
1051
|
-
setup(
|
|
1052
|
-
const i =
|
|
1053
|
-
|
|
1054
|
-
const l =
|
|
1063
|
+
setup(a) {
|
|
1064
|
+
const i = a, n = A(a, "modelValue");
|
|
1065
|
+
re();
|
|
1066
|
+
const l = H("webx-media"), r = Ze(tt, null), d = r ? we(r) : null, v = {
|
|
1055
1067
|
"16/9": "16 / 9",
|
|
1056
1068
|
"4/3": "4 / 3",
|
|
1057
1069
|
"1/1": "1 / 1"
|
|
1058
|
-
},
|
|
1059
|
-
get: () => Array.isArray(
|
|
1060
|
-
set: (
|
|
1061
|
-
|
|
1070
|
+
}, t = z({
|
|
1071
|
+
get: () => Array.isArray(n.value) ? n.value : [],
|
|
1072
|
+
set: (c) => {
|
|
1073
|
+
n.value = c;
|
|
1062
1074
|
}
|
|
1063
|
-
}),
|
|
1064
|
-
async function
|
|
1065
|
-
if (!
|
|
1066
|
-
const
|
|
1067
|
-
if (
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1075
|
+
}), x = z(() => i.single ? 1 : i.max ?? null), y = z(() => x.value !== null && t.value.length >= x.value), s = R({}), u = /* @__PURE__ */ new Set();
|
|
1076
|
+
async function k(c) {
|
|
1077
|
+
if (!d) return;
|
|
1078
|
+
const m = c.filter((C) => !(C in s.value) && !u.has(C));
|
|
1079
|
+
if (m.length === 0) return;
|
|
1080
|
+
m.forEach((C) => u.add(C));
|
|
1081
|
+
const M = await Promise.all(
|
|
1082
|
+
m.map(async (C) => [C, await d.fileByPath(C)])
|
|
1071
1083
|
);
|
|
1072
|
-
|
|
1084
|
+
m.forEach((C) => u.delete(C)), s.value = { ...s.value, ...Object.fromEntries(M) };
|
|
1073
1085
|
}
|
|
1074
|
-
|
|
1075
|
-
() =>
|
|
1076
|
-
(
|
|
1077
|
-
|
|
1086
|
+
G(
|
|
1087
|
+
() => t.value.map((c) => c.path),
|
|
1088
|
+
(c) => {
|
|
1089
|
+
k(c.filter(Boolean));
|
|
1078
1090
|
},
|
|
1079
1091
|
{ immediate: !0 }
|
|
1080
1092
|
);
|
|
1081
|
-
function
|
|
1082
|
-
|
|
1093
|
+
function w(c) {
|
|
1094
|
+
s.value = { ...s.value, ...Object.fromEntries(c.map((m) => [m.path, m])) };
|
|
1083
1095
|
}
|
|
1084
|
-
function
|
|
1085
|
-
return
|
|
1096
|
+
function o(c) {
|
|
1097
|
+
return s.value[c.path];
|
|
1086
1098
|
}
|
|
1087
|
-
function $(
|
|
1088
|
-
return
|
|
1099
|
+
function $(c) {
|
|
1100
|
+
return o(c) === null;
|
|
1089
1101
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return
|
|
1102
|
+
function F(c) {
|
|
1103
|
+
return o(c)?.name ?? vt(c.path);
|
|
1092
1104
|
}
|
|
1093
|
-
function
|
|
1094
|
-
const
|
|
1095
|
-
return
|
|
1105
|
+
function K(c) {
|
|
1106
|
+
const m = o(c);
|
|
1107
|
+
return m && d ? d.thumb(m, 320, 320) ?? void 0 : void 0;
|
|
1096
1108
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const
|
|
1099
|
-
if (!
|
|
1100
|
-
const
|
|
1101
|
-
return
|
|
1109
|
+
function X(c) {
|
|
1110
|
+
const m = o(c);
|
|
1111
|
+
if (!m) return "";
|
|
1112
|
+
const M = De(m.size);
|
|
1113
|
+
return m.width && m.height ? `${m.width}×${m.height} · ${M}` : M;
|
|
1102
1114
|
}
|
|
1103
|
-
const
|
|
1104
|
-
function
|
|
1105
|
-
return
|
|
1115
|
+
const N = R(null);
|
|
1116
|
+
function ee(c, m) {
|
|
1117
|
+
return t.value.findIndex((C) => C.path === c.path) === m ? c.path : `${c.path}#${m}`;
|
|
1106
1118
|
}
|
|
1107
|
-
function
|
|
1108
|
-
return
|
|
1119
|
+
function j(c, m) {
|
|
1120
|
+
return t.value[c]?.[m] ?? {};
|
|
1109
1121
|
}
|
|
1110
|
-
function
|
|
1111
|
-
const C =
|
|
1122
|
+
function te(c, m, M) {
|
|
1123
|
+
const C = t.value[c];
|
|
1112
1124
|
if (!C) return;
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1125
|
+
const W = [...t.value];
|
|
1126
|
+
W[c] = { ...C, [m]: M }, t.value = W;
|
|
1115
1127
|
}
|
|
1116
|
-
async function
|
|
1128
|
+
async function ie() {
|
|
1117
1129
|
if (i.disabled) return;
|
|
1118
|
-
const
|
|
1119
|
-
if (!
|
|
1120
|
-
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1130
|
+
const c = x.value === null ? null : x.value - t.value.length, m = await Ft({ accept: i.accept, max: c });
|
|
1131
|
+
if (!m || m.length === 0) return;
|
|
1132
|
+
w(m);
|
|
1133
|
+
const M = new Set(t.value.map((W) => W.path)), C = m.filter((W) => !M.has(W.path)).map((W) => ({ path: W.path }));
|
|
1134
|
+
t.value = i.single ? C.slice(0, 1) : [...t.value, ...C];
|
|
1123
1135
|
}
|
|
1124
|
-
function
|
|
1125
|
-
|
|
1136
|
+
function Q(c) {
|
|
1137
|
+
t.value = t.value.filter((m, M) => M !== c), N.value = null;
|
|
1126
1138
|
}
|
|
1127
|
-
async function
|
|
1128
|
-
await
|
|
1129
|
-
const
|
|
1130
|
-
delete
|
|
1139
|
+
async function de(c) {
|
|
1140
|
+
await Wt({});
|
|
1141
|
+
const m = { ...s.value };
|
|
1142
|
+
delete m[c.path], s.value = m, k([c.path]);
|
|
1131
1143
|
}
|
|
1132
|
-
const
|
|
1133
|
-
const
|
|
1144
|
+
const E = z(() => {
|
|
1145
|
+
const c = i.columns ? `repeat(${i.columns}, minmax(0, 1fr))` : "repeat(auto-fill, minmax(140px, 1fr))";
|
|
1134
1146
|
return i.aspect ? {
|
|
1135
|
-
"--wx-media-list-columns":
|
|
1136
|
-
"--wx-media-list-aspect":
|
|
1137
|
-
} : { "--wx-media-list-columns":
|
|
1138
|
-
}),
|
|
1139
|
-
const
|
|
1140
|
-
return i.min &&
|
|
1147
|
+
"--wx-media-list-columns": c,
|
|
1148
|
+
"--wx-media-list-aspect": v[i.aspect] ?? i.aspect
|
|
1149
|
+
} : { "--wx-media-list-columns": c };
|
|
1150
|
+
}), ne = z(() => {
|
|
1151
|
+
const c = t.value.length;
|
|
1152
|
+
return i.min && c < i.min ? l("field.at-least", { count: i.min }) : x.value === null ? "" : l("field.count", { count: c, max: x.value });
|
|
1141
1153
|
});
|
|
1142
|
-
return (
|
|
1143
|
-
class:
|
|
1144
|
-
style:
|
|
1154
|
+
return (c, m) => (h(), L("div", {
|
|
1155
|
+
class: pe(["wx-media-list", [`wx-media-list--${a.layout}`, { "is-disabled": a.disabled }]]),
|
|
1156
|
+
style: fe(E.value)
|
|
1145
1157
|
}, [
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
modelValue:
|
|
1149
|
-
"onUpdate:modelValue":
|
|
1158
|
+
a.label ? (h(), L("span", Lt, U(a.label), 1)) : B("", !0),
|
|
1159
|
+
g(e(ct), {
|
|
1160
|
+
modelValue: t.value,
|
|
1161
|
+
"onUpdate:modelValue": m[1] || (m[1] = (M) => t.value = M),
|
|
1150
1162
|
plain: "",
|
|
1151
|
-
disabled:
|
|
1152
|
-
handle:
|
|
1153
|
-
"item-key":
|
|
1154
|
-
"item-label":
|
|
1163
|
+
disabled: a.disabled,
|
|
1164
|
+
handle: a.layout === "grid" ? "row" : "grip",
|
|
1165
|
+
"item-key": ee,
|
|
1166
|
+
"item-label": F,
|
|
1155
1167
|
"drag-label": e(l)("field.reorder"),
|
|
1156
1168
|
"empty-text": e(l)("field.empty")
|
|
1157
1169
|
}, {
|
|
1158
|
-
default:
|
|
1159
|
-
|
|
1160
|
-
class:
|
|
1170
|
+
default: b(({ item: M, index: C }) => [
|
|
1171
|
+
V("div", {
|
|
1172
|
+
class: pe(["wx-media-list__cell", { "is-broken": $(M), "is-busy": N.value === C }])
|
|
1161
1173
|
}, [
|
|
1162
|
-
|
|
1163
|
-
name:
|
|
1164
|
-
thumbnail:
|
|
1165
|
-
type:
|
|
1166
|
-
size:
|
|
1174
|
+
g(e(Le), {
|
|
1175
|
+
name: F(M),
|
|
1176
|
+
thumbnail: K(M),
|
|
1177
|
+
type: o(M)?.mime,
|
|
1178
|
+
size: a.layout === "rows" ? "sm" : "md"
|
|
1167
1179
|
}, {
|
|
1168
|
-
meta:
|
|
1169
|
-
$(
|
|
1180
|
+
meta: b(() => [
|
|
1181
|
+
$(M) ? (h(), L("span", Rt, U(e(l)("field.missing")), 1)) : (h(), L("span", Bt, U(X(M)), 1))
|
|
1170
1182
|
]),
|
|
1171
1183
|
_: 2
|
|
1172
1184
|
}, 1032, ["name", "thumbnail", "type", "size"]),
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
default:
|
|
1176
|
-
|
|
1185
|
+
a.disabled ? B("", !0) : (h(), L("div", Dt, [
|
|
1186
|
+
g(e(le), { size: "sm" }, {
|
|
1187
|
+
default: b(() => [
|
|
1188
|
+
a.captions ? (h(), T(e(Re), {
|
|
1177
1189
|
key: 0,
|
|
1178
|
-
open:
|
|
1190
|
+
open: N.value === C,
|
|
1179
1191
|
title: e(l)("field.captions"),
|
|
1180
1192
|
width: 360,
|
|
1181
1193
|
side: "top",
|
|
1182
1194
|
teleport: "",
|
|
1183
|
-
"onUpdate:open": (
|
|
1195
|
+
"onUpdate:open": (W) => N.value = W ? C : null
|
|
1184
1196
|
}, {
|
|
1185
|
-
trigger:
|
|
1186
|
-
|
|
1197
|
+
trigger: b(() => [
|
|
1198
|
+
g(e(D), {
|
|
1187
1199
|
type: "edit",
|
|
1188
1200
|
title: e(l)("field.captions")
|
|
1189
1201
|
}, null, 8, ["title"])
|
|
1190
1202
|
]),
|
|
1191
|
-
default:
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1203
|
+
default: b(() => [
|
|
1204
|
+
V("div", St, [
|
|
1205
|
+
V("div", Et, [
|
|
1206
|
+
m[2] || (m[2] = V("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
|
|
1207
|
+
g(e(Z), {
|
|
1196
1208
|
localized: "",
|
|
1197
|
-
"model-value":
|
|
1209
|
+
"model-value": j(C, "alt"),
|
|
1198
1210
|
placeholder: e(l)("field.alt-hint"),
|
|
1199
|
-
"onUpdate:modelValue": (
|
|
1211
|
+
"onUpdate:modelValue": (W) => te(C, "alt", W)
|
|
1200
1212
|
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
|
|
1201
1213
|
]),
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1214
|
+
V("div", Pt, [
|
|
1215
|
+
m[3] || (m[3] = V("span", { class: "wx-media-list__caption-label" }, "title", -1)),
|
|
1216
|
+
g(e(Z), {
|
|
1205
1217
|
localized: "",
|
|
1206
|
-
"model-value":
|
|
1218
|
+
"model-value": j(C, "title"),
|
|
1207
1219
|
placeholder: e(l)("field.title-hint"),
|
|
1208
|
-
"onUpdate:modelValue": (
|
|
1220
|
+
"onUpdate:modelValue": (W) => te(C, "title", W)
|
|
1209
1221
|
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
|
|
1210
1222
|
]),
|
|
1211
|
-
|
|
1212
|
-
|
|
1223
|
+
V("div", Ot, [
|
|
1224
|
+
g(e(I), {
|
|
1213
1225
|
size: "sm",
|
|
1214
1226
|
type: "primary",
|
|
1215
|
-
onClick:
|
|
1227
|
+
onClick: m[0] || (m[0] = (W) => N.value = null)
|
|
1216
1228
|
}, {
|
|
1217
|
-
default:
|
|
1218
|
-
|
|
1229
|
+
default: b(() => [
|
|
1230
|
+
O(U(e(l)("manager.save")), 1)
|
|
1219
1231
|
]),
|
|
1220
1232
|
_: 1
|
|
1221
1233
|
})
|
|
@@ -1223,24 +1235,24 @@ const bt = {
|
|
|
1223
1235
|
])
|
|
1224
1236
|
]),
|
|
1225
1237
|
_: 2
|
|
1226
|
-
}, 1032, ["open", "title", "onUpdate:open"])) :
|
|
1227
|
-
$(
|
|
1238
|
+
}, 1032, ["open", "title", "onUpdate:open"])) : B("", !0),
|
|
1239
|
+
$(M) ? B("", !0) : (h(), T(e(D), {
|
|
1228
1240
|
key: 1,
|
|
1229
1241
|
type: "goto",
|
|
1230
1242
|
title: e(l)("field.open"),
|
|
1231
|
-
onClick: (
|
|
1243
|
+
onClick: (W) => de(M)
|
|
1232
1244
|
}, null, 8, ["title", "onClick"])),
|
|
1233
|
-
|
|
1245
|
+
g(e(Be), {
|
|
1234
1246
|
title: e(l)("field.remove-title"),
|
|
1235
1247
|
description: e(l)("field.remove-text"),
|
|
1236
1248
|
"confirm-text": e(l)("field.remove-confirm"),
|
|
1237
1249
|
"cancel-text": e(l)("manager.cancel"),
|
|
1238
1250
|
"confirm-type": "danger",
|
|
1239
1251
|
side: "top",
|
|
1240
|
-
onConfirm: (
|
|
1252
|
+
onConfirm: (W) => Q(C)
|
|
1241
1253
|
}, {
|
|
1242
|
-
trigger:
|
|
1243
|
-
|
|
1254
|
+
trigger: b(() => [
|
|
1255
|
+
g(e(D), {
|
|
1244
1256
|
type: "remove",
|
|
1245
1257
|
title: e(l)("field.remove-confirm")
|
|
1246
1258
|
}, null, 8, ["title"])
|
|
@@ -1255,23 +1267,23 @@ const bt = {
|
|
|
1255
1267
|
]),
|
|
1256
1268
|
_: 1
|
|
1257
1269
|
}, 8, ["modelValue", "disabled", "handle", "drag-label", "empty-text"]),
|
|
1258
|
-
|
|
1259
|
-
|
|
1270
|
+
V("div", At, [
|
|
1271
|
+
g(e(I), {
|
|
1260
1272
|
size: "sm",
|
|
1261
1273
|
variant: "outline",
|
|
1262
|
-
disabled:
|
|
1263
|
-
onClick:
|
|
1274
|
+
disabled: a.disabled || y.value,
|
|
1275
|
+
onClick: ie
|
|
1264
1276
|
}, {
|
|
1265
|
-
default:
|
|
1266
|
-
|
|
1277
|
+
default: b(() => [
|
|
1278
|
+
O(U(e(l)("field.add")), 1)
|
|
1267
1279
|
]),
|
|
1268
1280
|
_: 1
|
|
1269
1281
|
}, 8, ["disabled"]),
|
|
1270
|
-
|
|
1282
|
+
ne.value ? (h(), L("span", Nt, U(ne.value), 1)) : B("", !0)
|
|
1271
1283
|
])
|
|
1272
1284
|
], 6));
|
|
1273
1285
|
}
|
|
1274
|
-
}),
|
|
1286
|
+
}), qt = /* @__PURE__ */ S({
|
|
1275
1287
|
name: "WxFileField",
|
|
1276
1288
|
inheritAttrs: !1,
|
|
1277
1289
|
__name: "FileField",
|
|
@@ -1280,21 +1292,21 @@ const bt = {
|
|
|
1280
1292
|
modelModifiers: {}
|
|
1281
1293
|
},
|
|
1282
1294
|
emits: ["update:modelValue"],
|
|
1283
|
-
setup(
|
|
1284
|
-
const i =
|
|
1295
|
+
setup(a) {
|
|
1296
|
+
const i = A(a, "modelValue"), n = z({
|
|
1285
1297
|
get: () => i.value ? [i.value] : [],
|
|
1286
1298
|
set: (l) => {
|
|
1287
1299
|
i.value = l[0] ?? null;
|
|
1288
1300
|
}
|
|
1289
1301
|
});
|
|
1290
|
-
return (l,
|
|
1291
|
-
modelValue:
|
|
1292
|
-
"onUpdate:modelValue":
|
|
1302
|
+
return (l, r) => (h(), T(ke, ge(l.$attrs, {
|
|
1303
|
+
modelValue: n.value,
|
|
1304
|
+
"onUpdate:modelValue": r[0] || (r[0] = (d) => n.value = d),
|
|
1293
1305
|
layout: "rows",
|
|
1294
1306
|
single: ""
|
|
1295
1307
|
}), null, 16, ["modelValue"]));
|
|
1296
1308
|
}
|
|
1297
|
-
}),
|
|
1309
|
+
}), It = /* @__PURE__ */ S({
|
|
1298
1310
|
name: "WxFilesField",
|
|
1299
1311
|
inheritAttrs: !1,
|
|
1300
1312
|
__name: "FilesField",
|
|
@@ -1303,15 +1315,15 @@ const bt = {
|
|
|
1303
1315
|
modelModifiers: {}
|
|
1304
1316
|
},
|
|
1305
1317
|
emits: ["update:modelValue"],
|
|
1306
|
-
setup(
|
|
1307
|
-
const i =
|
|
1308
|
-
return (
|
|
1318
|
+
setup(a) {
|
|
1319
|
+
const i = A(a, "modelValue");
|
|
1320
|
+
return (n, l) => (h(), T(ke, ge(n.$attrs, {
|
|
1309
1321
|
modelValue: i.value,
|
|
1310
|
-
"onUpdate:modelValue": l[0] || (l[0] = (
|
|
1322
|
+
"onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
|
|
1311
1323
|
layout: "rows"
|
|
1312
1324
|
}), null, 16, ["modelValue"]));
|
|
1313
1325
|
}
|
|
1314
|
-
}),
|
|
1326
|
+
}), Ht = /* @__PURE__ */ S({
|
|
1315
1327
|
name: "WxGalleryField",
|
|
1316
1328
|
inheritAttrs: !1,
|
|
1317
1329
|
__name: "GalleryField",
|
|
@@ -1320,27 +1332,27 @@ const bt = {
|
|
|
1320
1332
|
modelModifiers: {}
|
|
1321
1333
|
},
|
|
1322
1334
|
emits: ["update:modelValue"],
|
|
1323
|
-
setup(
|
|
1324
|
-
const i =
|
|
1325
|
-
return (
|
|
1335
|
+
setup(a) {
|
|
1336
|
+
const i = A(a, "modelValue");
|
|
1337
|
+
return (n, l) => (h(), T(ke, ge(n.$attrs, {
|
|
1326
1338
|
modelValue: i.value,
|
|
1327
|
-
"onUpdate:modelValue": l[0] || (l[0] = (
|
|
1339
|
+
"onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
|
|
1328
1340
|
layout: "grid",
|
|
1329
1341
|
accept: "image"
|
|
1330
1342
|
}), null, 16, ["modelValue"]));
|
|
1331
1343
|
}
|
|
1332
|
-
}),
|
|
1344
|
+
}), Xt = { class: "wx-media-field" }, Kt = {
|
|
1333
1345
|
key: 0,
|
|
1334
1346
|
class: "wx-media-field__label"
|
|
1335
|
-
},
|
|
1347
|
+
}, jt = ["disabled"], Gt = ["disabled", "title"], Yt = {
|
|
1336
1348
|
key: 1,
|
|
1337
1349
|
class: "wx-media-field__missing"
|
|
1338
|
-
},
|
|
1350
|
+
}, Jt = {
|
|
1339
1351
|
key: 0,
|
|
1340
1352
|
class: "wx-media-field__bar"
|
|
1341
|
-
},
|
|
1353
|
+
}, Qt = { class: "wx-media-field__captions" }, Zt = { class: "wx-media-field__caption" }, el = { class: "wx-media-field__caption" }, tl = { class: "wx-media-field__captions-footer" }, ll = /* @__PURE__ */ S({
|
|
1342
1354
|
__name: "MediaField",
|
|
1343
|
-
props: /* @__PURE__ */
|
|
1355
|
+
props: /* @__PURE__ */ q({
|
|
1344
1356
|
label: { default: void 0 },
|
|
1345
1357
|
accept: { default: "image" },
|
|
1346
1358
|
captions: { type: Boolean, default: !0 },
|
|
@@ -1352,119 +1364,119 @@ const bt = {
|
|
|
1352
1364
|
modelModifiers: {}
|
|
1353
1365
|
}),
|
|
1354
1366
|
emits: ["update:modelValue"],
|
|
1355
|
-
setup(
|
|
1356
|
-
const i =
|
|
1357
|
-
|
|
1358
|
-
const l =
|
|
1367
|
+
setup(a) {
|
|
1368
|
+
const i = a, n = A(a, "modelValue");
|
|
1369
|
+
re();
|
|
1370
|
+
const l = H("webx-media"), r = we(se()), d = {
|
|
1359
1371
|
"16/9": "16 / 9",
|
|
1360
1372
|
"4/3": "4 / 3",
|
|
1361
1373
|
"1/1": "1 / 1"
|
|
1362
|
-
},
|
|
1363
|
-
|
|
1364
|
-
() =>
|
|
1365
|
-
async (
|
|
1366
|
-
if (!
|
|
1367
|
-
const $ = await
|
|
1368
|
-
$ && (
|
|
1374
|
+
}, v = R(!1), t = R({});
|
|
1375
|
+
G(
|
|
1376
|
+
() => n.value?.path,
|
|
1377
|
+
async (o) => {
|
|
1378
|
+
if (!o || n.value?.url || t.value[o]) return;
|
|
1379
|
+
const $ = await r.fileByPath(o);
|
|
1380
|
+
$ && (t.value = { ...t.value, [o]: $.url });
|
|
1369
1381
|
},
|
|
1370
1382
|
{ immediate: !0 }
|
|
1371
1383
|
);
|
|
1372
|
-
const
|
|
1373
|
-
const
|
|
1374
|
-
return
|
|
1375
|
-
}),
|
|
1376
|
-
() => i.aspect ? { aspectRatio:
|
|
1384
|
+
const x = z(() => {
|
|
1385
|
+
const o = n.value;
|
|
1386
|
+
return o ? o.url ?? t.value[o.path] ?? null : null;
|
|
1387
|
+
}), y = z(
|
|
1388
|
+
() => i.aspect ? { aspectRatio: d[i.aspect] ?? i.aspect } : { height: typeof i.height == "number" ? `${i.height}px` : i.height }
|
|
1377
1389
|
);
|
|
1378
|
-
function
|
|
1379
|
-
return
|
|
1390
|
+
function s(o) {
|
|
1391
|
+
return n.value?.[o] ?? {};
|
|
1380
1392
|
}
|
|
1381
|
-
function
|
|
1382
|
-
|
|
1393
|
+
function u(o, $) {
|
|
1394
|
+
n.value && (n.value = { ...n.value, [o]: $ });
|
|
1383
1395
|
}
|
|
1384
|
-
async function
|
|
1396
|
+
async function k() {
|
|
1385
1397
|
if (i.disabled) return;
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1398
|
+
const o = await Ut({ accept: i.accept });
|
|
1399
|
+
o && (n.value = { ...n.value, path: o.path, url: o.url });
|
|
1388
1400
|
}
|
|
1389
|
-
function
|
|
1390
|
-
|
|
1401
|
+
function w() {
|
|
1402
|
+
n.value = null, v.value = !1;
|
|
1391
1403
|
}
|
|
1392
|
-
return (
|
|
1393
|
-
|
|
1394
|
-
|
|
1404
|
+
return (o, $) => (h(), L("div", Xt, [
|
|
1405
|
+
a.label ? (h(), L("span", Kt, U(a.label), 1)) : B("", !0),
|
|
1406
|
+
n.value ? (h(), L("div", {
|
|
1395
1407
|
key: 2,
|
|
1396
1408
|
class: "wx-media-field__frame",
|
|
1397
|
-
style:
|
|
1409
|
+
style: fe(y.value)
|
|
1398
1410
|
}, [
|
|
1399
|
-
|
|
1411
|
+
V("button", {
|
|
1400
1412
|
type: "button",
|
|
1401
1413
|
class: "wx-media-field__picture",
|
|
1402
|
-
disabled:
|
|
1414
|
+
disabled: a.disabled,
|
|
1403
1415
|
title: e(l)("field.replace"),
|
|
1404
|
-
onClick:
|
|
1416
|
+
onClick: k
|
|
1405
1417
|
}, [
|
|
1406
|
-
|
|
1418
|
+
x.value ? (h(), T(e(mt), {
|
|
1407
1419
|
key: 0,
|
|
1408
|
-
src:
|
|
1420
|
+
src: x.value,
|
|
1409
1421
|
fit: "contain",
|
|
1410
1422
|
width: "100%",
|
|
1411
1423
|
height: "100%"
|
|
1412
|
-
}, null, 8, ["src"])) : (
|
|
1413
|
-
], 8,
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
default:
|
|
1417
|
-
|
|
1424
|
+
}, null, 8, ["src"])) : (h(), L("span", Yt, U(e(l)("field.no-preview")), 1))
|
|
1425
|
+
], 8, Gt),
|
|
1426
|
+
a.disabled ? B("", !0) : (h(), L("div", Jt, [
|
|
1427
|
+
g(e(le), { size: "sm" }, {
|
|
1428
|
+
default: b(() => [
|
|
1429
|
+
a.captions ? (h(), T(e(Re), {
|
|
1418
1430
|
key: 0,
|
|
1419
|
-
open:
|
|
1420
|
-
"onUpdate:open": $[3] || ($[3] = (
|
|
1431
|
+
open: v.value,
|
|
1432
|
+
"onUpdate:open": $[3] || ($[3] = (F) => v.value = F),
|
|
1421
1433
|
title: e(l)("field.captions"),
|
|
1422
1434
|
width: 360,
|
|
1423
1435
|
side: "top",
|
|
1424
1436
|
teleport: ""
|
|
1425
1437
|
}, {
|
|
1426
|
-
trigger:
|
|
1427
|
-
|
|
1438
|
+
trigger: b(() => [
|
|
1439
|
+
g(e(D), {
|
|
1428
1440
|
type: "edit",
|
|
1429
1441
|
title: e(l)("field.edit")
|
|
1430
1442
|
}, null, 8, ["title"])
|
|
1431
1443
|
]),
|
|
1432
|
-
default:
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
$[4] || ($[4] =
|
|
1444
|
+
default: b(() => [
|
|
1445
|
+
V("div", Qt, [
|
|
1446
|
+
V("div", Zt, [
|
|
1447
|
+
$[4] || ($[4] = V("label", {
|
|
1436
1448
|
class: "wx-media-field__caption-label",
|
|
1437
1449
|
for: "wx-media-alt"
|
|
1438
1450
|
}, "alt", -1)),
|
|
1439
|
-
|
|
1451
|
+
g(e(Z), {
|
|
1440
1452
|
id: "wx-media-alt",
|
|
1441
1453
|
localized: "",
|
|
1442
|
-
"model-value":
|
|
1454
|
+
"model-value": s("alt"),
|
|
1443
1455
|
placeholder: e(l)("field.alt-hint"),
|
|
1444
|
-
"onUpdate:modelValue": $[0] || ($[0] = (
|
|
1456
|
+
"onUpdate:modelValue": $[0] || ($[0] = (F) => u("alt", F))
|
|
1445
1457
|
}, null, 8, ["model-value", "placeholder"])
|
|
1446
1458
|
]),
|
|
1447
|
-
|
|
1448
|
-
$[5] || ($[5] =
|
|
1459
|
+
V("div", el, [
|
|
1460
|
+
$[5] || ($[5] = V("label", {
|
|
1449
1461
|
class: "wx-media-field__caption-label",
|
|
1450
1462
|
for: "wx-media-title"
|
|
1451
1463
|
}, "title", -1)),
|
|
1452
|
-
|
|
1464
|
+
g(e(Z), {
|
|
1453
1465
|
id: "wx-media-title",
|
|
1454
1466
|
localized: "",
|
|
1455
|
-
"model-value":
|
|
1467
|
+
"model-value": s("title"),
|
|
1456
1468
|
placeholder: e(l)("field.title-hint"),
|
|
1457
|
-
"onUpdate:modelValue": $[1] || ($[1] = (
|
|
1469
|
+
"onUpdate:modelValue": $[1] || ($[1] = (F) => u("title", F))
|
|
1458
1470
|
}, null, 8, ["model-value", "placeholder"])
|
|
1459
1471
|
]),
|
|
1460
|
-
|
|
1461
|
-
|
|
1472
|
+
V("div", tl, [
|
|
1473
|
+
g(e(I), {
|
|
1462
1474
|
size: "sm",
|
|
1463
1475
|
type: "primary",
|
|
1464
|
-
onClick: $[2] || ($[2] = (
|
|
1476
|
+
onClick: $[2] || ($[2] = (F) => v.value = !1)
|
|
1465
1477
|
}, {
|
|
1466
|
-
default:
|
|
1467
|
-
|
|
1478
|
+
default: b(() => [
|
|
1479
|
+
O(U(e(l)("manager.save")), 1)
|
|
1468
1480
|
]),
|
|
1469
1481
|
_: 1
|
|
1470
1482
|
})
|
|
@@ -1472,18 +1484,18 @@ const bt = {
|
|
|
1472
1484
|
])
|
|
1473
1485
|
]),
|
|
1474
1486
|
_: 1
|
|
1475
|
-
}, 8, ["open", "title"])) :
|
|
1476
|
-
|
|
1487
|
+
}, 8, ["open", "title"])) : B("", !0),
|
|
1488
|
+
g(e(Be), {
|
|
1477
1489
|
title: e(l)("field.clear-title"),
|
|
1478
1490
|
description: e(l)("field.clear-text"),
|
|
1479
1491
|
"confirm-text": e(l)("field.clear-confirm"),
|
|
1480
1492
|
"cancel-text": e(l)("manager.cancel"),
|
|
1481
1493
|
"confirm-type": "danger",
|
|
1482
1494
|
side: "top",
|
|
1483
|
-
onConfirm:
|
|
1495
|
+
onConfirm: w
|
|
1484
1496
|
}, {
|
|
1485
|
-
trigger:
|
|
1486
|
-
|
|
1497
|
+
trigger: b(() => [
|
|
1498
|
+
g(e(D), {
|
|
1487
1499
|
type: "remove",
|
|
1488
1500
|
title: e(l)("field.clear-confirm")
|
|
1489
1501
|
}, null, 8, ["title"])
|
|
@@ -1494,36 +1506,81 @@ const bt = {
|
|
|
1494
1506
|
_: 1
|
|
1495
1507
|
})
|
|
1496
1508
|
]))
|
|
1497
|
-
], 4)) : (
|
|
1509
|
+
], 4)) : (h(), L("div", {
|
|
1498
1510
|
key: 1,
|
|
1499
1511
|
class: "wx-media-field__frame is-empty",
|
|
1500
|
-
style:
|
|
1512
|
+
style: fe(y.value)
|
|
1501
1513
|
}, [
|
|
1502
|
-
|
|
1514
|
+
V("button", {
|
|
1503
1515
|
type: "button",
|
|
1504
1516
|
class: "wx-media-field__pick",
|
|
1505
|
-
disabled:
|
|
1506
|
-
onClick:
|
|
1507
|
-
},
|
|
1517
|
+
disabled: a.disabled,
|
|
1518
|
+
onClick: k
|
|
1519
|
+
}, U(e(l)("field.select")), 9, jt)
|
|
1508
1520
|
], 4))
|
|
1509
1521
|
]));
|
|
1510
1522
|
}
|
|
1511
|
-
}),
|
|
1523
|
+
}), al = /* @__PURE__ */ S({
|
|
1512
1524
|
__name: "MediaPage",
|
|
1513
|
-
setup(
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1525
|
+
setup(a) {
|
|
1526
|
+
const i = se();
|
|
1527
|
+
re();
|
|
1528
|
+
const n = H("webx-media"), l = oe("manager"), r = R("all"), d = z(() => r.value), v = z(() => i.can("media.upload") || i.can("media.manage")), t = z(
|
|
1529
|
+
() => i.state.manifest?.modules.find((y) => y.id === "media")?.title ?? n("module.title")
|
|
1530
|
+
), x = z(() => [
|
|
1531
|
+
{ value: "all", label: n("manager.all-types") },
|
|
1532
|
+
...["image", "video", "audio", "document", "other"].map((y) => ({
|
|
1533
|
+
value: y,
|
|
1534
|
+
label: n(`manager.${y}`)
|
|
1535
|
+
}))
|
|
1536
|
+
]);
|
|
1537
|
+
return (y, s) => (h(), T(e(lt), {
|
|
1538
|
+
view: r.value,
|
|
1539
|
+
"onUpdate:view": s[1] || (s[1] = (u) => r.value = u),
|
|
1540
|
+
title: t.value,
|
|
1541
|
+
views: x.value,
|
|
1542
|
+
card: !1,
|
|
1543
|
+
fill: ""
|
|
1544
|
+
}, We({
|
|
1545
|
+
default: b(() => [
|
|
1546
|
+
g(e(pt), {
|
|
1547
|
+
class: "wx-media-page",
|
|
1548
|
+
padding: "md"
|
|
1549
|
+
}, {
|
|
1550
|
+
default: b(() => [
|
|
1551
|
+
g(Se, {
|
|
1552
|
+
ref_key: "manager",
|
|
1553
|
+
ref: l,
|
|
1554
|
+
type: d.value,
|
|
1555
|
+
"in-page": ""
|
|
1556
|
+
}, null, 8, ["type"])
|
|
1557
|
+
]),
|
|
1558
|
+
_: 1
|
|
1559
|
+
})
|
|
1520
1560
|
]),
|
|
1521
|
-
_:
|
|
1522
|
-
}
|
|
1561
|
+
_: 2
|
|
1562
|
+
}, [
|
|
1563
|
+
v.value ? {
|
|
1564
|
+
name: "actions",
|
|
1565
|
+
fn: b(() => [
|
|
1566
|
+
g(e(I), {
|
|
1567
|
+
type: "primary",
|
|
1568
|
+
icon: "upload",
|
|
1569
|
+
onClick: s[0] || (s[0] = (u) => l.value?.upload())
|
|
1570
|
+
}, {
|
|
1571
|
+
default: b(() => [
|
|
1572
|
+
O(U(e(n)("manager.upload")), 1)
|
|
1573
|
+
]),
|
|
1574
|
+
_: 1
|
|
1575
|
+
})
|
|
1576
|
+
]),
|
|
1577
|
+
key: "0"
|
|
1578
|
+
} : void 0
|
|
1579
|
+
]), 1032, ["view", "title", "views"]));
|
|
1523
1580
|
}
|
|
1524
1581
|
});
|
|
1525
|
-
function
|
|
1526
|
-
const i =
|
|
1582
|
+
function sl(a = {}) {
|
|
1583
|
+
const i = a.path ?? "/media";
|
|
1527
1584
|
return {
|
|
1528
1585
|
id: "media",
|
|
1529
1586
|
path: i,
|
|
@@ -1531,7 +1588,7 @@ function il(t = {}) {
|
|
|
1531
1588
|
{
|
|
1532
1589
|
path: i,
|
|
1533
1590
|
name: "webx.media",
|
|
1534
|
-
component:
|
|
1591
|
+
component: al
|
|
1535
1592
|
}
|
|
1536
1593
|
],
|
|
1537
1594
|
// What a screen means by these four: the fields over the library. The server registers the
|
|
@@ -1539,26 +1596,26 @@ function il(t = {}) {
|
|
|
1539
1596
|
// limit — the names are what an author picks from a list, and nobody picks "media with
|
|
1540
1597
|
// `multiple: true` and `accept: document`".
|
|
1541
1598
|
types: {
|
|
1542
|
-
"wx-media": { component:
|
|
1543
|
-
"wx-gallery": { component:
|
|
1544
|
-
"wx-file": { component:
|
|
1545
|
-
"wx-files": { component:
|
|
1599
|
+
"wx-media": { component: ll, kind: "field" },
|
|
1600
|
+
"wx-gallery": { component: Ht, kind: "field" },
|
|
1601
|
+
"wx-file": { component: qt, kind: "field" },
|
|
1602
|
+
"wx-files": { component: It, kind: "field" }
|
|
1546
1603
|
}
|
|
1547
1604
|
};
|
|
1548
1605
|
}
|
|
1549
1606
|
export {
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1607
|
+
qt as WxFileField,
|
|
1608
|
+
It as WxFilesField,
|
|
1609
|
+
Ht as WxGalleryField,
|
|
1610
|
+
ll as WxMediaField,
|
|
1611
|
+
Se as WxMediaManager,
|
|
1612
|
+
al as WxMediaPage,
|
|
1613
|
+
xe as WxMediaPicker,
|
|
1614
|
+
we as createMediaApi,
|
|
1615
|
+
sl as media,
|
|
1616
|
+
xt as mediaMessages,
|
|
1617
|
+
Ft as openMediaFiles,
|
|
1618
|
+
Wt as openMediaLibrary,
|
|
1619
|
+
Ut as openMediaPicker
|
|
1563
1620
|
};
|
|
1564
1621
|
//# sourceMappingURL=index.js.map
|