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