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