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