@webx-ui/module-media 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MediaField.d.ts +13 -5
- package/dist/MediaToolbar.d.ts +2 -0
- package/dist/api.d.ts +7 -0
- package/dist/index.js +726 -560
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +17 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { WxTree as
|
|
3
|
-
import { useTranslate as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as E, useModel as A, ref as M, watch as q, openBlock as b, createBlock as k, unref as e, mergeModels as F, computed as W, resolveDirective as Pe, withCtx as w, createElementBlock as z, Fragment as Q, renderList as Z, withDirectives as Oe, createCommentVNode as L, createVNode as h, createTextVNode as S, toDisplayString as D, isRef as te, useTemplateRef as ee, onMounted as he, nextTick as qe, createElementVNode as $, withKeys as Ne, normalizeClass as Ae, normalizeStyle as me } from "vue";
|
|
2
|
+
import { WxTree as He, WxSelectionArea as Xe, WxFileCard as Ie, WxEmpty as Ke, toast as N, WxAction as T, WxInput as j, WxDropdown as pe, WxDropdownItem as fe, WxActions as G, useModal as ae, WxDialog as le, WxSelect as je, WxSpace as be, WxButton as X, useElementWidth as Ge, createModal as Y, WxPagination as Ye, WxDrawer as Je, confirm as ve, openImageEditor as Qe, WxCard as Ze, WxImage as et, WxPopover as tt, WxPopconfirm as at } from "@webx-ui/core";
|
|
3
|
+
import { useTranslate as B, useAdmin as ie } from "@webx-ui/admin";
|
|
4
|
+
const ge = /* @__PURE__ */ E({
|
|
5
5
|
__name: "DirectoryTree",
|
|
6
|
-
props: /* @__PURE__ */
|
|
6
|
+
props: /* @__PURE__ */ F({
|
|
7
7
|
directories: {}
|
|
8
8
|
}, {
|
|
9
9
|
selected: { default: null },
|
|
10
10
|
selectedModifiers: {}
|
|
11
11
|
}),
|
|
12
|
-
emits: /* @__PURE__ */
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
() =>
|
|
17
|
-
(
|
|
18
|
-
|
|
12
|
+
emits: /* @__PURE__ */ F(["move"], ["update:selected"]),
|
|
13
|
+
setup(a, { emit: c }) {
|
|
14
|
+
const m = a, l = A(a, "selected"), f = c, o = B("webx-media"), t = M([]), p = M([]);
|
|
15
|
+
q(
|
|
16
|
+
() => m.directories,
|
|
17
|
+
(r) => {
|
|
18
|
+
t.value = r.map(x), p.value = g(r);
|
|
19
19
|
},
|
|
20
20
|
{ immediate: !0, deep: !0 }
|
|
21
21
|
);
|
|
22
|
-
function x(
|
|
22
|
+
function x(r) {
|
|
23
23
|
return {
|
|
24
|
-
...
|
|
25
|
-
label:
|
|
26
|
-
children: (
|
|
24
|
+
...r,
|
|
25
|
+
label: r.is_root ? o("manager.root") : r.title,
|
|
26
|
+
children: (r.children ?? []).map(x)
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
29
|
+
function g(r) {
|
|
30
|
+
return r.flatMap((v) => [v.id, ...g(v.children ?? [])]);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
32
|
+
function u(r) {
|
|
33
|
+
const v = r.zone === "inside" ? r.target : r.parent;
|
|
34
|
+
v && f("move", r.node.id, v.id);
|
|
35
35
|
}
|
|
36
|
-
return (
|
|
37
|
-
selected:
|
|
38
|
-
"onUpdate:selected":
|
|
39
|
-
expanded:
|
|
40
|
-
"onUpdate:expanded":
|
|
41
|
-
modelValue:
|
|
42
|
-
"onUpdate:modelValue":
|
|
36
|
+
return (r, v) => (b(), k(e(He), {
|
|
37
|
+
selected: l.value,
|
|
38
|
+
"onUpdate:selected": v[0] || (v[0] = (i) => l.value = i),
|
|
39
|
+
expanded: p.value,
|
|
40
|
+
"onUpdate:expanded": v[1] || (v[1] = (i) => p.value = i),
|
|
41
|
+
modelValue: t.value,
|
|
42
|
+
"onUpdate:modelValue": v[2] || (v[2] = (i) => t.value = i),
|
|
43
43
|
class: "wx-media-tree",
|
|
44
44
|
"node-key": "id",
|
|
45
45
|
draggable: "",
|
|
46
46
|
"show-lines": "",
|
|
47
|
-
onDrop:
|
|
47
|
+
onDrop: u
|
|
48
48
|
}, null, 8, ["selected", "expanded", "modelValue"]));
|
|
49
49
|
}
|
|
50
|
-
}),
|
|
50
|
+
}), lt = /* @__PURE__ */ E({
|
|
51
51
|
__name: "FileGrid",
|
|
52
|
-
props: /* @__PURE__ */
|
|
52
|
+
props: /* @__PURE__ */ F({
|
|
53
53
|
files: {},
|
|
54
54
|
api: {},
|
|
55
55
|
query: {},
|
|
@@ -58,79 +58,83 @@ const ve = /* @__PURE__ */ R({
|
|
|
58
58
|
selected: { default: () => [] },
|
|
59
59
|
selectedModifiers: {}
|
|
60
60
|
}),
|
|
61
|
-
emits: /* @__PURE__ */
|
|
62
|
-
setup(
|
|
63
|
-
const
|
|
64
|
-
() =>
|
|
61
|
+
emits: /* @__PURE__ */ F(["open", "rename", "edit", "remove"], ["update:selected"]),
|
|
62
|
+
setup(a, { emit: c }) {
|
|
63
|
+
const m = a, l = A(a, "selected"), f = c, o = B("webx-media"), t = W(
|
|
64
|
+
() => m.query ? o("manager.empty-search", { query: m.query }) : o("manager.empty")
|
|
65
65
|
);
|
|
66
|
-
function
|
|
67
|
-
|
|
66
|
+
function p() {
|
|
67
|
+
N.success(o("manager.link-copied"));
|
|
68
68
|
}
|
|
69
|
-
function x(
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
let
|
|
69
|
+
function x(g) {
|
|
70
|
+
const u = document.createElement("textarea");
|
|
71
|
+
u.value = g.url, u.setAttribute("readonly", ""), u.style.position = "fixed", u.style.opacity = "0", document.body.appendChild(u), u.select();
|
|
72
|
+
let r = !1;
|
|
73
73
|
try {
|
|
74
|
-
|
|
74
|
+
r = document.execCommand("copy");
|
|
75
75
|
} catch {
|
|
76
|
-
|
|
76
|
+
r = !1;
|
|
77
77
|
}
|
|
78
|
-
if (
|
|
79
|
-
|
|
78
|
+
if (u.remove(), r) {
|
|
79
|
+
p();
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
N.danger(`${o("errors.copy")} ${g.url}`, { duration: 0 });
|
|
83
83
|
}
|
|
84
|
-
return (
|
|
85
|
-
const
|
|
86
|
-
return
|
|
84
|
+
return (g, u) => {
|
|
85
|
+
const r = Pe("wx-select");
|
|
86
|
+
return a.files.length > 0 ? (b(), k(e(Xe), {
|
|
87
87
|
key: 0,
|
|
88
|
-
modelValue:
|
|
89
|
-
"onUpdate:modelValue":
|
|
88
|
+
modelValue: l.value,
|
|
89
|
+
"onUpdate:modelValue": u[0] || (u[0] = (v) => l.value = v),
|
|
90
90
|
class: "wx-media-grid",
|
|
91
|
-
multiple: !
|
|
91
|
+
multiple: !a.single
|
|
92
92
|
}, {
|
|
93
|
-
default:
|
|
94
|
-
(
|
|
95
|
-
key:
|
|
93
|
+
default: w(({ isSelected: v }) => [
|
|
94
|
+
(b(!0), z(Q, null, Z(a.files, (i) => Oe((b(), k(e(Ie), {
|
|
95
|
+
key: i.id,
|
|
96
96
|
class: "wx-media-grid__card",
|
|
97
|
-
name:
|
|
98
|
-
url:
|
|
99
|
-
thumbnail:
|
|
100
|
-
type:
|
|
101
|
-
selected:
|
|
97
|
+
name: i.name,
|
|
98
|
+
url: i.url,
|
|
99
|
+
thumbnail: a.api.thumb(i, 320, 320) ?? void 0,
|
|
100
|
+
type: i.mime,
|
|
101
|
+
selected: v(i.id),
|
|
102
102
|
renamable: "",
|
|
103
|
-
editable:
|
|
103
|
+
editable: i.editable,
|
|
104
104
|
removable: "",
|
|
105
105
|
copyable: "",
|
|
106
|
-
"rename-label": e(
|
|
107
|
-
"edit-label": e(
|
|
108
|
-
"remove-label": e(
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
"rename-label": e(o)("manager.rename"),
|
|
107
|
+
"edit-label": e(o)("manager.edit"),
|
|
108
|
+
"remove-label": e(o)("manager.delete"),
|
|
109
|
+
"remove-confirm-text": e(o)("dialogs.delete-file", { name: i.name }),
|
|
110
|
+
"cancel-label": e(o)("manager.cancel"),
|
|
111
|
+
"save-label": e(o)("manager.save"),
|
|
112
|
+
"copy-label": e(o)("manager.copy-link"),
|
|
113
|
+
"copied-label": e(o)("manager.link-copied"),
|
|
114
|
+
onRename: (d) => f("rename", i, d),
|
|
115
|
+
onEdit: (d) => f("edit", i),
|
|
116
|
+
onRemove: (d) => f("remove", i),
|
|
117
|
+
onCopy: p,
|
|
118
|
+
onCopyError: (d) => x(i),
|
|
119
|
+
onDblclick: (d) => f("open", i)
|
|
120
|
+
}, 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"])), [
|
|
121
|
+
[r, i.id]
|
|
119
122
|
])), 128))
|
|
120
123
|
]),
|
|
121
124
|
_: 1
|
|
122
|
-
}, 8, ["modelValue", "multiple"])) : (
|
|
125
|
+
}, 8, ["modelValue", "multiple"])) : (b(), k(e(Ke), {
|
|
123
126
|
key: 1,
|
|
124
|
-
description:
|
|
127
|
+
description: t.value
|
|
125
128
|
}, null, 8, ["description"]));
|
|
126
129
|
};
|
|
127
130
|
}
|
|
128
|
-
}),
|
|
131
|
+
}), it = { class: "wx-media-toolbar" }, ot = /* @__PURE__ */ E({
|
|
129
132
|
__name: "MediaToolbar",
|
|
130
|
-
props: /* @__PURE__ */
|
|
133
|
+
props: /* @__PURE__ */ F({
|
|
131
134
|
canUpload: { type: Boolean },
|
|
132
135
|
canManage: { type: Boolean },
|
|
133
136
|
selected: {},
|
|
137
|
+
fixedType: { type: Boolean },
|
|
134
138
|
compact: { type: Boolean }
|
|
135
139
|
}, {
|
|
136
140
|
search: { default: "" },
|
|
@@ -140,155 +144,155 @@ const ve = /* @__PURE__ */ R({
|
|
|
140
144
|
sort: { default: "-created_at" },
|
|
141
145
|
sortModifiers: {}
|
|
142
146
|
}),
|
|
143
|
-
emits: /* @__PURE__ */
|
|
144
|
-
setup(
|
|
145
|
-
const
|
|
146
|
-
{ value: "all", label:
|
|
147
|
-
...["image", "video", "audio", "document", "other"].map((
|
|
148
|
-
value:
|
|
149
|
-
label:
|
|
147
|
+
emits: /* @__PURE__ */ F(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
|
|
148
|
+
setup(a, { emit: c }) {
|
|
149
|
+
const m = a, l = A(a, "search"), f = A(a, "type"), o = A(a, "sort"), t = c, p = B("webx-media"), x = W(() => [
|
|
150
|
+
{ value: "all", label: p("manager.all-types") },
|
|
151
|
+
...["image", "video", "audio", "document", "other"].map((v) => ({
|
|
152
|
+
value: v,
|
|
153
|
+
label: p(`manager.${v}`)
|
|
150
154
|
}))
|
|
151
|
-
]),
|
|
152
|
-
{ value: "-created_at", label:
|
|
153
|
-
{ value: "created_at", label:
|
|
154
|
-
{ value: "name", label:
|
|
155
|
-
{ value: "-size", label:
|
|
156
|
-
]),
|
|
157
|
-
return (
|
|
158
|
-
|
|
155
|
+
]), g = W(() => [
|
|
156
|
+
{ value: "-created_at", label: p("manager.sort-newest") },
|
|
157
|
+
{ value: "created_at", label: p("manager.sort-oldest") },
|
|
158
|
+
{ value: "name", label: p("manager.sort-name") },
|
|
159
|
+
{ value: "-size", label: p("manager.sort-size") }
|
|
160
|
+
]), u = W(() => x.value.find((v) => v.value === f.value)?.label ?? ""), r = W(() => g.value.find((v) => v.value === o.value)?.label ?? "");
|
|
161
|
+
return (v, i) => (b(), z("header", it, [
|
|
162
|
+
a.compact ? (b(), k(e(T), {
|
|
159
163
|
key: 0,
|
|
160
164
|
icon: "folder",
|
|
161
|
-
title: e(
|
|
165
|
+
title: e(p)("manager.folders"),
|
|
162
166
|
size: "sm",
|
|
163
|
-
onClick:
|
|
164
|
-
}, null, 8, ["title"])) :
|
|
165
|
-
|
|
166
|
-
modelValue:
|
|
167
|
-
"onUpdate:modelValue":
|
|
167
|
+
onClick: i[0] || (i[0] = (d) => t("folders"))
|
|
168
|
+
}, null, 8, ["title"])) : L("", !0),
|
|
169
|
+
h(e(j), {
|
|
170
|
+
modelValue: l.value,
|
|
171
|
+
"onUpdate:modelValue": i[1] || (i[1] = (d) => l.value = d),
|
|
168
172
|
class: "wx-media-toolbar__search",
|
|
169
|
-
placeholder: e(
|
|
173
|
+
placeholder: e(p)("manager.search"),
|
|
170
174
|
clearable: "",
|
|
171
175
|
size: "sm"
|
|
172
176
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
173
|
-
|
|
174
|
-
trigger:
|
|
175
|
-
|
|
177
|
+
a.fixedType ? L("", !0) : (b(), k(e(pe), { key: 1 }, {
|
|
178
|
+
trigger: w(() => [
|
|
179
|
+
h(e(T), {
|
|
176
180
|
icon: "filter",
|
|
177
|
-
title: `${e(
|
|
181
|
+
title: `${e(p)("manager.all-types")}: ${u.value}`,
|
|
178
182
|
size: "sm"
|
|
179
183
|
}, null, 8, ["title"])
|
|
180
184
|
]),
|
|
181
|
-
default:
|
|
182
|
-
(
|
|
183
|
-
key: String(
|
|
184
|
-
active:
|
|
185
|
-
onClick: (
|
|
185
|
+
default: w(() => [
|
|
186
|
+
(b(!0), z(Q, null, Z(x.value, (d) => (b(), k(e(fe), {
|
|
187
|
+
key: String(d.value),
|
|
188
|
+
active: d.value === f.value,
|
|
189
|
+
onClick: (_) => f.value = d.value
|
|
186
190
|
}, {
|
|
187
|
-
default:
|
|
188
|
-
|
|
191
|
+
default: w(() => [
|
|
192
|
+
S(D(d.label), 1)
|
|
189
193
|
]),
|
|
190
194
|
_: 2
|
|
191
195
|
}, 1032, ["active", "onClick"]))), 128))
|
|
192
196
|
]),
|
|
193
197
|
_: 1
|
|
194
|
-
}),
|
|
195
|
-
|
|
196
|
-
trigger:
|
|
197
|
-
|
|
198
|
+
})),
|
|
199
|
+
h(e(pe), null, {
|
|
200
|
+
trigger: w(() => [
|
|
201
|
+
h(e(T), {
|
|
198
202
|
icon: "arrow-down",
|
|
199
|
-
title:
|
|
203
|
+
title: r.value,
|
|
200
204
|
size: "sm"
|
|
201
205
|
}, null, 8, ["title"])
|
|
202
206
|
]),
|
|
203
|
-
default:
|
|
204
|
-
(
|
|
205
|
-
key:
|
|
206
|
-
active:
|
|
207
|
-
onClick: (
|
|
207
|
+
default: w(() => [
|
|
208
|
+
(b(!0), z(Q, null, Z(g.value, (d) => (b(), k(e(fe), {
|
|
209
|
+
key: d.value,
|
|
210
|
+
active: d.value === o.value,
|
|
211
|
+
onClick: (_) => o.value = d.value
|
|
208
212
|
}, {
|
|
209
|
-
default:
|
|
210
|
-
|
|
213
|
+
default: w(() => [
|
|
214
|
+
S(D(d.label), 1)
|
|
211
215
|
]),
|
|
212
216
|
_: 2
|
|
213
217
|
}, 1032, ["active", "onClick"]))), 128))
|
|
214
218
|
]),
|
|
215
219
|
_: 1
|
|
216
220
|
}),
|
|
217
|
-
|
|
218
|
-
key:
|
|
221
|
+
a.canUpload ? (b(), k(e(T), {
|
|
222
|
+
key: 2,
|
|
219
223
|
type: "upload",
|
|
220
|
-
title: e(
|
|
224
|
+
title: e(p)("manager.upload"),
|
|
221
225
|
size: "sm",
|
|
222
|
-
onClick:
|
|
223
|
-
}, null, 8, ["title"])) :
|
|
224
|
-
|
|
225
|
-
key:
|
|
226
|
+
onClick: i[2] || (i[2] = (d) => t("upload"))
|
|
227
|
+
}, null, 8, ["title"])) : L("", !0),
|
|
228
|
+
a.canManage ? (b(), k(e(G), {
|
|
229
|
+
key: 3,
|
|
226
230
|
size: "sm"
|
|
227
231
|
}, {
|
|
228
|
-
default:
|
|
229
|
-
|
|
232
|
+
default: w(() => [
|
|
233
|
+
h(e(T), {
|
|
230
234
|
icon: "folder",
|
|
231
|
-
title: e(
|
|
232
|
-
disabled:
|
|
233
|
-
onClick:
|
|
235
|
+
title: e(p)("manager.move"),
|
|
236
|
+
disabled: m.selected === 0,
|
|
237
|
+
onClick: i[3] || (i[3] = (d) => t("move"))
|
|
234
238
|
}, null, 8, ["title", "disabled"]),
|
|
235
|
-
|
|
239
|
+
h(e(T), {
|
|
236
240
|
type: "remove",
|
|
237
|
-
title: e(
|
|
238
|
-
disabled:
|
|
239
|
-
onClick:
|
|
241
|
+
title: e(p)("manager.delete"),
|
|
242
|
+
disabled: m.selected === 0,
|
|
243
|
+
onClick: i[4] || (i[4] = (d) => t("remove"))
|
|
240
244
|
}, null, 8, ["title", "disabled"])
|
|
241
245
|
]),
|
|
242
246
|
_: 1
|
|
243
|
-
})) :
|
|
247
|
+
})) : L("", !0)
|
|
244
248
|
]));
|
|
245
249
|
}
|
|
246
|
-
}),
|
|
250
|
+
}), nt = /* @__PURE__ */ E({
|
|
247
251
|
__name: "MoveDialog",
|
|
248
252
|
props: {
|
|
249
253
|
directories: {},
|
|
250
254
|
from: {},
|
|
251
255
|
count: {}
|
|
252
256
|
},
|
|
253
|
-
setup(
|
|
254
|
-
const
|
|
255
|
-
() => x(
|
|
256
|
-
),
|
|
257
|
-
function x(
|
|
258
|
-
return
|
|
257
|
+
setup(a) {
|
|
258
|
+
const c = a, { open: m, resolve: l, dismiss: f } = ae(), o = B("webx-media"), t = W(
|
|
259
|
+
() => x(c.directories).filter((g) => g.value !== c.from)
|
|
260
|
+
), p = M(t.value[0]?.value ?? null);
|
|
261
|
+
function x(g) {
|
|
262
|
+
return g.flatMap((u) => [
|
|
259
263
|
{
|
|
260
|
-
value:
|
|
264
|
+
value: u.id,
|
|
261
265
|
// Indented, so the tree is still readable once it is a flat list.
|
|
262
|
-
label: " ".repeat(
|
|
266
|
+
label: " ".repeat(u.depth * 3) + (u.is_root ? o("manager.root") : u.title)
|
|
263
267
|
},
|
|
264
|
-
...x(
|
|
268
|
+
...x(u.children ?? [])
|
|
265
269
|
]);
|
|
266
270
|
}
|
|
267
|
-
return (
|
|
268
|
-
open: e(
|
|
269
|
-
"onUpdate:open":
|
|
270
|
-
title: e(
|
|
271
|
+
return (g, u) => (b(), k(e(le), {
|
|
272
|
+
open: e(m),
|
|
273
|
+
"onUpdate:open": u[3] || (u[3] = (r) => te(m) ? m.value = r : null),
|
|
274
|
+
title: e(o)("manager.move-to"),
|
|
271
275
|
width: 420
|
|
272
276
|
}, {
|
|
273
|
-
footer:
|
|
274
|
-
|
|
275
|
-
default:
|
|
276
|
-
|
|
277
|
+
footer: w(() => [
|
|
278
|
+
h(e(be), { size: "sm" }, {
|
|
279
|
+
default: w(() => [
|
|
280
|
+
h(e(X), {
|
|
277
281
|
variant: "outline",
|
|
278
|
-
onClick:
|
|
282
|
+
onClick: u[1] || (u[1] = (r) => e(f)())
|
|
279
283
|
}, {
|
|
280
|
-
default:
|
|
281
|
-
|
|
284
|
+
default: w(() => [
|
|
285
|
+
S(D(e(o)("manager.cancel")), 1)
|
|
282
286
|
]),
|
|
283
287
|
_: 1
|
|
284
288
|
}),
|
|
285
|
-
|
|
289
|
+
h(e(X), {
|
|
286
290
|
type: "primary",
|
|
287
|
-
disabled:
|
|
288
|
-
onClick:
|
|
291
|
+
disabled: p.value === null,
|
|
292
|
+
onClick: u[2] || (u[2] = (r) => e(l)(p.value))
|
|
289
293
|
}, {
|
|
290
|
-
default:
|
|
291
|
-
|
|
294
|
+
default: w(() => [
|
|
295
|
+
S(D(e(o)("manager.move")), 1)
|
|
292
296
|
]),
|
|
293
297
|
_: 1
|
|
294
298
|
}, 8, ["disabled"])
|
|
@@ -296,17 +300,17 @@ const ve = /* @__PURE__ */ R({
|
|
|
296
300
|
_: 1
|
|
297
301
|
})
|
|
298
302
|
]),
|
|
299
|
-
default:
|
|
300
|
-
|
|
301
|
-
modelValue:
|
|
302
|
-
"onUpdate:modelValue":
|
|
303
|
-
options:
|
|
303
|
+
default: w(() => [
|
|
304
|
+
h(e(je), {
|
|
305
|
+
modelValue: p.value,
|
|
306
|
+
"onUpdate:modelValue": u[0] || (u[0] = (r) => p.value = r),
|
|
307
|
+
options: t.value
|
|
304
308
|
}, null, 8, ["modelValue", "options"])
|
|
305
309
|
]),
|
|
306
310
|
_: 1
|
|
307
311
|
}, 8, ["open", "title"]));
|
|
308
312
|
}
|
|
309
|
-
}),
|
|
313
|
+
}), rt = /* @__PURE__ */ E({
|
|
310
314
|
__name: "NameDialog",
|
|
311
315
|
props: {
|
|
312
316
|
title: {},
|
|
@@ -314,40 +318,40 @@ const ve = /* @__PURE__ */ R({
|
|
|
314
318
|
value: { default: "" },
|
|
315
319
|
confirmText: { default: void 0 }
|
|
316
320
|
},
|
|
317
|
-
setup(
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
await
|
|
321
|
+
setup(a) {
|
|
322
|
+
const c = a, { open: m, resolve: l, dismiss: f } = ae(), o = B("webx-media"), t = M(c.value), p = ee("input");
|
|
323
|
+
he(async () => {
|
|
324
|
+
await qe(), p.value?.querySelector("input")?.focus();
|
|
321
325
|
});
|
|
322
326
|
function x() {
|
|
323
|
-
const
|
|
324
|
-
|
|
327
|
+
const g = t.value.trim();
|
|
328
|
+
g !== "" && l(g);
|
|
325
329
|
}
|
|
326
|
-
return (
|
|
327
|
-
open: e(
|
|
328
|
-
"onUpdate:open":
|
|
329
|
-
title:
|
|
330
|
+
return (g, u) => (b(), k(e(le), {
|
|
331
|
+
open: e(m),
|
|
332
|
+
"onUpdate:open": u[2] || (u[2] = (r) => te(m) ? m.value = r : null),
|
|
333
|
+
title: a.title,
|
|
330
334
|
width: 420
|
|
331
335
|
}, {
|
|
332
|
-
footer:
|
|
333
|
-
|
|
334
|
-
default:
|
|
335
|
-
|
|
336
|
+
footer: w(() => [
|
|
337
|
+
h(e(be), { size: "sm" }, {
|
|
338
|
+
default: w(() => [
|
|
339
|
+
h(e(X), {
|
|
336
340
|
variant: "outline",
|
|
337
|
-
onClick:
|
|
341
|
+
onClick: u[1] || (u[1] = (r) => e(f)())
|
|
338
342
|
}, {
|
|
339
|
-
default:
|
|
340
|
-
|
|
343
|
+
default: w(() => [
|
|
344
|
+
S(D(e(o)("manager.cancel")), 1)
|
|
341
345
|
]),
|
|
342
346
|
_: 1
|
|
343
347
|
}),
|
|
344
|
-
|
|
348
|
+
h(e(X), {
|
|
345
349
|
type: "primary",
|
|
346
|
-
disabled:
|
|
350
|
+
disabled: t.value.trim() === "",
|
|
347
351
|
onClick: x
|
|
348
352
|
}, {
|
|
349
|
-
default:
|
|
350
|
-
|
|
353
|
+
default: w(() => [
|
|
354
|
+
S(D(a.confirmText ?? e(o)("manager.save")), 1)
|
|
351
355
|
]),
|
|
352
356
|
_: 1
|
|
353
357
|
}, 8, ["disabled"])
|
|
@@ -355,17 +359,17 @@ const ve = /* @__PURE__ */ R({
|
|
|
355
359
|
_: 1
|
|
356
360
|
})
|
|
357
361
|
]),
|
|
358
|
-
default:
|
|
359
|
-
|
|
362
|
+
default: w(() => [
|
|
363
|
+
$("div", {
|
|
360
364
|
ref_key: "input",
|
|
361
|
-
ref:
|
|
365
|
+
ref: p
|
|
362
366
|
}, [
|
|
363
|
-
|
|
364
|
-
modelValue:
|
|
365
|
-
"onUpdate:modelValue":
|
|
366
|
-
placeholder:
|
|
367
|
-
"aria-label":
|
|
368
|
-
onKeyup:
|
|
367
|
+
h(e(j), {
|
|
368
|
+
modelValue: t.value,
|
|
369
|
+
"onUpdate:modelValue": u[0] || (u[0] = (r) => t.value = r),
|
|
370
|
+
placeholder: a.label ?? e(o)("manager.folder-name"),
|
|
371
|
+
"aria-label": a.label ?? e(o)("manager.folder-name"),
|
|
372
|
+
onKeyup: Ne(x, ["enter"])
|
|
369
373
|
}, null, 8, ["modelValue", "placeholder", "aria-label"])
|
|
370
374
|
], 512)
|
|
371
375
|
]),
|
|
@@ -373,72 +377,73 @@ const ve = /* @__PURE__ */ R({
|
|
|
373
377
|
}, 8, ["open", "title"]));
|
|
374
378
|
}
|
|
375
379
|
});
|
|
376
|
-
function
|
|
377
|
-
const
|
|
380
|
+
function we(a) {
|
|
381
|
+
const c = `${a.apiPath}/media`, m = (l) => l.data;
|
|
378
382
|
return {
|
|
379
|
-
directories: () =>
|
|
380
|
-
createDirectory: (
|
|
381
|
-
renameDirectory: (
|
|
382
|
-
moveDirectory: (
|
|
383
|
-
deleteDirectory: (
|
|
384
|
-
query: { force:
|
|
383
|
+
directories: () => a.http.get(`${c}/directories`).then(m),
|
|
384
|
+
createDirectory: (l, f) => a.http.post(`${c}/directories`, { parent_id: l, title: f }).then(m),
|
|
385
|
+
renameDirectory: (l, f) => a.http.patch(`${c}/directories/${l}`, { title: f }).then(m),
|
|
386
|
+
moveDirectory: (l, f) => a.http.patch(`${c}/directories/${l}/move`, { parent_id: f }).then(m),
|
|
387
|
+
deleteDirectory: (l, f = !1) => a.http.delete(`${c}/directories/${l}`, {
|
|
388
|
+
query: { force: f ? 1 : void 0 }
|
|
385
389
|
}),
|
|
386
|
-
files: (
|
|
390
|
+
files: (l = {}) => a.http.get(`${c}/files`, {
|
|
387
391
|
query: {
|
|
388
|
-
directory_id:
|
|
389
|
-
q:
|
|
390
|
-
type:
|
|
391
|
-
sort:
|
|
392
|
-
page:
|
|
393
|
-
per_page:
|
|
392
|
+
directory_id: l.directory_id ?? void 0,
|
|
393
|
+
q: l.q || void 0,
|
|
394
|
+
type: l.type ?? void 0,
|
|
395
|
+
sort: l.sort,
|
|
396
|
+
page: l.page,
|
|
397
|
+
per_page: l.per_page
|
|
394
398
|
}
|
|
395
399
|
}),
|
|
396
|
-
file: (
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
400
|
+
file: (l) => a.http.get(`${c}/files/${l}`).then(m),
|
|
401
|
+
fileByPath: (l) => a.http.get(`${c}/files/by-path?path=${encodeURIComponent(l)}`).then(m).catch(() => null),
|
|
402
|
+
async upload(l, f, o) {
|
|
403
|
+
const t = new FormData();
|
|
404
|
+
return t.append("directory_id", String(l)), f.forEach((p) => t.append("files[]", p)), new Promise((p, x) => {
|
|
405
|
+
const g = new XMLHttpRequest();
|
|
406
|
+
g.open("POST", `${c}/files`), g.responseType = "json", g.withCredentials = !0, g.setRequestHeader("Accept", "application/json"), g.setRequestHeader("X-Requested-With", "XMLHttpRequest"), g.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
|
|
407
|
+
const u = st();
|
|
408
|
+
u && g.setRequestHeader("X-XSRF-TOKEN", u), g.upload.addEventListener("progress", (r) => {
|
|
409
|
+
r.lengthComputable && o?.(Math.round(r.loaded / r.total * 100));
|
|
410
|
+
}), g.addEventListener("load", () => {
|
|
411
|
+
const r = g.response;
|
|
412
|
+
if (g.status >= 200 && g.status < 300 && r?.data) {
|
|
413
|
+
p(r.data);
|
|
409
414
|
return;
|
|
410
415
|
}
|
|
411
416
|
x(
|
|
412
|
-
Object.assign(new Error(
|
|
413
|
-
status:
|
|
414
|
-
body:
|
|
417
|
+
Object.assign(new Error(r?.message ?? "Upload failed"), {
|
|
418
|
+
status: g.status,
|
|
419
|
+
body: r
|
|
415
420
|
})
|
|
416
421
|
);
|
|
417
|
-
}),
|
|
422
|
+
}), g.addEventListener("error", () => x(new Error("Upload failed"))), g.send(t);
|
|
418
423
|
});
|
|
419
424
|
},
|
|
420
|
-
rename: (
|
|
421
|
-
move: (
|
|
425
|
+
rename: (l, f) => a.http.patch(`${c}/files/${l}`, { name: f }).then(m),
|
|
426
|
+
move: (l, f) => a.http.post(`${c}/files/move`, { ids: l, directory_id: f }).then((o) => o.data.moved),
|
|
422
427
|
// A POST for the batch, not a DELETE: the panel's own client sends no body on DELETE, and
|
|
423
428
|
// a list of ids in a query string is a worse answer than an honest verb.
|
|
424
|
-
remove: (
|
|
425
|
-
removeOne: (
|
|
426
|
-
edit: (
|
|
427
|
-
copy: (
|
|
428
|
-
restoreOriginal: (
|
|
429
|
-
thumb(
|
|
430
|
-
if (!
|
|
429
|
+
remove: (l) => a.http.post(`${c}/files/delete`, { ids: l }).then((f) => f.data.deleted),
|
|
430
|
+
removeOne: (l) => a.http.delete(`${c}/files/${l}`),
|
|
431
|
+
edit: (l, f) => a.http.post(`${c}/files/${l}/edit`, f).then(m),
|
|
432
|
+
copy: (l) => a.http.post(`${c}/files/${l}/copy`).then(m),
|
|
433
|
+
restoreOriginal: (l) => a.http.post(`${c}/files/${l}/restore-original`).then(m),
|
|
434
|
+
thumb(l, f, o, t = "cover") {
|
|
435
|
+
if (!l.thumb)
|
|
431
436
|
return null;
|
|
432
|
-
const
|
|
433
|
-
return
|
|
437
|
+
const p = new URL(l.thumb, window.location.origin);
|
|
438
|
+
return p.searchParams.set("w", String(f)), o && p.searchParams.set("h", String(o)), p.searchParams.set("fit", t), p.pathname + p.search;
|
|
434
439
|
}
|
|
435
440
|
};
|
|
436
441
|
}
|
|
437
|
-
function
|
|
438
|
-
const
|
|
439
|
-
return
|
|
442
|
+
function st() {
|
|
443
|
+
const a = document.cookie.split("; ").find((c) => c.startsWith("XSRF-TOKEN="));
|
|
444
|
+
return a ? decodeURIComponent(a.slice(11)) : null;
|
|
440
445
|
}
|
|
441
|
-
const
|
|
446
|
+
const dt = {
|
|
442
447
|
module: {
|
|
443
448
|
title: "Files"
|
|
444
449
|
},
|
|
@@ -479,13 +484,48 @@ const ot = {
|
|
|
479
484
|
"status-selected": "selected: :count",
|
|
480
485
|
"status-size": "size: :size"
|
|
481
486
|
},
|
|
487
|
+
// The picture field on a form, which is the module used from outside its own section.
|
|
488
|
+
field: {
|
|
489
|
+
select: "Choose a picture",
|
|
490
|
+
edit: "Captions",
|
|
491
|
+
replace: "Replace",
|
|
492
|
+
captions: "Captions",
|
|
493
|
+
"alt-hint": "What is on the picture, for a reader who cannot see it",
|
|
494
|
+
"title-hint": "A caption shown on hover",
|
|
495
|
+
"no-preview": "No preview",
|
|
496
|
+
"clear-title": "Clear the field?",
|
|
497
|
+
"clear-text": "The file stays in the library — only this record stops using it.",
|
|
498
|
+
"clear-confirm": "Clear"
|
|
499
|
+
},
|
|
500
|
+
// The image editor is a component of the design system, so its words are props rather than
|
|
501
|
+
// lines in the dictionary — the manager hands it these when it opens it.
|
|
502
|
+
editor: {
|
|
503
|
+
title: "Edit picture",
|
|
504
|
+
save: "Save",
|
|
505
|
+
cancel: "Cancel",
|
|
506
|
+
reset: "Reset",
|
|
507
|
+
"rotate-left": "Turn left",
|
|
508
|
+
"rotate-right": "Turn right",
|
|
509
|
+
"flip-horizontal": "Mirror across",
|
|
510
|
+
"flip-vertical": "Mirror down",
|
|
511
|
+
ratio: "Ratio",
|
|
512
|
+
crop: "Crop",
|
|
513
|
+
output: "Output",
|
|
514
|
+
"output-hint": "The size of the picture you will get",
|
|
515
|
+
width: "Width",
|
|
516
|
+
height: "Height",
|
|
517
|
+
free: "Free",
|
|
518
|
+
original: "Original",
|
|
519
|
+
error: "This picture could not be loaded"
|
|
520
|
+
},
|
|
482
521
|
dialogs: {
|
|
483
522
|
"delete-files-title": "Delete :count file(s)?",
|
|
484
523
|
"delete-files-text": "Anywhere they are already used, they will stop opening.",
|
|
485
524
|
"delete-folder-title": "Delete the folder :title?",
|
|
486
525
|
"delete-folder-contents": "It holds :files file(s) and :directories folder(s).",
|
|
487
526
|
"delete-folder-warning": "Everything inside goes too, and pictures already placed in content will stop opening.",
|
|
488
|
-
confirm: "Delete"
|
|
527
|
+
confirm: "Delete",
|
|
528
|
+
"delete-file": "Delete :name?"
|
|
489
529
|
},
|
|
490
530
|
errors: {
|
|
491
531
|
"directory-not-empty": "This folder is not empty.",
|
|
@@ -508,478 +548,604 @@ const ot = {
|
|
|
508
548
|
directory_id: "folder",
|
|
509
549
|
files: "files"
|
|
510
550
|
}
|
|
511
|
-
},
|
|
512
|
-
function
|
|
551
|
+
}, ye = /* @__PURE__ */ new WeakSet();
|
|
552
|
+
function xe() {
|
|
513
553
|
try {
|
|
514
|
-
const { i18n:
|
|
515
|
-
|
|
554
|
+
const { i18n: a } = ie();
|
|
555
|
+
ye.has(a) || (a.defaults("webx-media", dt), ye.add(a));
|
|
516
556
|
} catch {
|
|
517
557
|
}
|
|
518
558
|
}
|
|
519
|
-
const
|
|
559
|
+
const ut = {
|
|
520
560
|
key: 0,
|
|
521
561
|
class: "wx-media__folders"
|
|
522
|
-
},
|
|
562
|
+
}, ct = { class: "wx-media__files" }, mt = ["accept"], pt = { class: "wx-media__status" }, ft = { key: 0 }, vt = { class: "wx-media__drawer" }, ke = /* @__PURE__ */ E({
|
|
523
563
|
__name: "MediaManager",
|
|
524
564
|
props: {
|
|
525
565
|
picking: { type: Boolean, default: !1 },
|
|
526
566
|
accept: { default: null }
|
|
527
567
|
},
|
|
528
568
|
emits: ["pick"],
|
|
529
|
-
setup(
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
569
|
+
setup(a, { emit: c }) {
|
|
570
|
+
const m = a, l = c, f = ie(), o = we(f);
|
|
571
|
+
xe();
|
|
572
|
+
const t = B("webx-media");
|
|
573
|
+
function p() {
|
|
574
|
+
return {
|
|
575
|
+
title: t("editor.title"),
|
|
576
|
+
saveLabel: t("editor.save"),
|
|
577
|
+
cancelLabel: t("editor.cancel"),
|
|
578
|
+
resetLabel: t("editor.reset"),
|
|
579
|
+
rotateLeftLabel: t("editor.rotate-left"),
|
|
580
|
+
rotateRightLabel: t("editor.rotate-right"),
|
|
581
|
+
flipHorizontalLabel: t("editor.flip-horizontal"),
|
|
582
|
+
flipVerticalLabel: t("editor.flip-vertical"),
|
|
583
|
+
ratioLabel: t("editor.ratio"),
|
|
584
|
+
cropLabel: t("editor.crop"),
|
|
585
|
+
outputLabel: t("editor.output"),
|
|
586
|
+
outputHint: t("editor.output-hint"),
|
|
587
|
+
widthLabel: t("editor.width"),
|
|
588
|
+
heightLabel: t("editor.height"),
|
|
589
|
+
freeLabel: t("editor.free"),
|
|
590
|
+
originalLabel: t("editor.original"),
|
|
591
|
+
errorText: t("editor.error")
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
const x = ee("root"), g = Ge(x), u = W(() => g.value > 0 && g.value < 640), r = M([]), v = M(null), i = M(null), d = M([]), _ = M(""), P = M(m.accept ?? "all");
|
|
595
|
+
q(
|
|
596
|
+
() => m.accept,
|
|
597
|
+
(s) => {
|
|
598
|
+
P.value = s ?? "all";
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
const I = M("-created_at"), J = M(!1), H = M(!1), oe = ee("picker"), _e = W(() => i.value?.data ?? []), K = W(() => f.can("media.manage")), Ce = W(() => f.can("media.upload") || K.value), U = W(() => Ve(v.value));
|
|
602
|
+
he(V), q([v, P, I], () => R(1)), q(
|
|
603
|
+
_,
|
|
604
|
+
Fe(() => R(1), 300)
|
|
605
|
+
), q(u, (s) => {
|
|
606
|
+
s || (H.value = !1);
|
|
538
607
|
});
|
|
539
608
|
async function V() {
|
|
540
|
-
|
|
609
|
+
r.value = await o.directories(), v.value ??= r.value[0]?.id ?? null, await R(1);
|
|
541
610
|
}
|
|
542
|
-
async function
|
|
611
|
+
async function R(s = i.value?.meta.current_page ?? 1) {
|
|
543
612
|
J.value = !0;
|
|
544
613
|
try {
|
|
545
|
-
|
|
546
|
-
directory_id:
|
|
547
|
-
q:
|
|
548
|
-
type:
|
|
549
|
-
sort:
|
|
614
|
+
i.value = await o.files({
|
|
615
|
+
directory_id: _.value ? null : v.value,
|
|
616
|
+
q: _.value,
|
|
617
|
+
type: P.value === "all" ? null : P.value,
|
|
618
|
+
sort: I.value,
|
|
550
619
|
page: s
|
|
551
|
-
}),
|
|
620
|
+
}), d.value = [];
|
|
552
621
|
} finally {
|
|
553
622
|
J.value = !1;
|
|
554
623
|
}
|
|
555
624
|
}
|
|
556
|
-
function
|
|
557
|
-
|
|
625
|
+
function Me() {
|
|
626
|
+
oe.value?.click();
|
|
558
627
|
}
|
|
559
|
-
async function
|
|
560
|
-
const
|
|
561
|
-
if (
|
|
628
|
+
async function Te(s) {
|
|
629
|
+
const n = s.target, y = Array.from(n.files ?? []);
|
|
630
|
+
if (n.value = "", !(y.length === 0 || v.value === null))
|
|
562
631
|
try {
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
} catch (
|
|
566
|
-
|
|
632
|
+
const C = await o.upload(v.value, y), O = C.filter((Se) => Se.duplicate).length;
|
|
633
|
+
C.length > O && N.success(t("manager.uploaded", { count: C.length - O })), O > 0 && N.info(t("manager.duplicate-added")), await Promise.all([V(), R(1)]);
|
|
634
|
+
} catch (C) {
|
|
635
|
+
N.danger(ce(C) ?? t("errors.upload"));
|
|
567
636
|
}
|
|
568
637
|
}
|
|
569
|
-
const
|
|
570
|
-
async function
|
|
571
|
-
const s = await
|
|
572
|
-
title:
|
|
573
|
-
confirmText:
|
|
638
|
+
const ne = Y(rt);
|
|
639
|
+
async function re() {
|
|
640
|
+
const s = await ne({
|
|
641
|
+
title: t("manager.new-folder"),
|
|
642
|
+
confirmText: t("manager.new-folder")
|
|
574
643
|
});
|
|
575
|
-
s === void 0 ||
|
|
644
|
+
s === void 0 || v.value === null || (await o.createDirectory(v.value, s), await V());
|
|
576
645
|
}
|
|
577
|
-
async function
|
|
578
|
-
const s =
|
|
646
|
+
async function se() {
|
|
647
|
+
const s = U.value;
|
|
579
648
|
if (!s || s.is_root)
|
|
580
649
|
return;
|
|
581
|
-
const
|
|
582
|
-
title:
|
|
650
|
+
const n = await ne({
|
|
651
|
+
title: t("manager.rename"),
|
|
583
652
|
value: s.title,
|
|
584
|
-
confirmText:
|
|
653
|
+
confirmText: t("manager.save")
|
|
585
654
|
});
|
|
586
|
-
|
|
655
|
+
n !== void 0 && (await o.renameDirectory(s.id, n), await V());
|
|
587
656
|
}
|
|
588
|
-
async function
|
|
589
|
-
const s =
|
|
657
|
+
async function de() {
|
|
658
|
+
const s = U.value;
|
|
590
659
|
if (!(!s || s.is_root)) {
|
|
591
660
|
try {
|
|
592
|
-
await
|
|
593
|
-
} catch (
|
|
594
|
-
const
|
|
595
|
-
if (!
|
|
596
|
-
throw
|
|
597
|
-
if (!await
|
|
598
|
-
title:
|
|
599
|
-
message: `${
|
|
600
|
-
confirmText:
|
|
601
|
-
cancelText:
|
|
661
|
+
await o.deleteDirectory(s.id);
|
|
662
|
+
} catch (n) {
|
|
663
|
+
const y = Ee(n);
|
|
664
|
+
if (!y)
|
|
665
|
+
throw n;
|
|
666
|
+
if (!await ve({
|
|
667
|
+
title: t("dialogs.delete-folder-title", { title: s.title }),
|
|
668
|
+
message: `${t("dialogs.delete-folder-contents", y)} ${t("dialogs.delete-folder-warning")}`,
|
|
669
|
+
confirmText: t("dialogs.confirm"),
|
|
670
|
+
cancelText: t("manager.cancel"),
|
|
602
671
|
tone: "danger"
|
|
603
672
|
}))
|
|
604
673
|
return;
|
|
605
|
-
await
|
|
674
|
+
await o.deleteDirectory(s.id, !0);
|
|
606
675
|
}
|
|
607
|
-
|
|
676
|
+
v.value = null, await V();
|
|
608
677
|
}
|
|
609
678
|
}
|
|
610
|
-
async function
|
|
679
|
+
async function ue(s, n) {
|
|
611
680
|
try {
|
|
612
|
-
await
|
|
613
|
-
} catch (
|
|
614
|
-
|
|
681
|
+
await o.moveDirectory(s, n);
|
|
682
|
+
} catch (y) {
|
|
683
|
+
N.danger(ce(y) ?? t("errors.directory-into-itself"));
|
|
615
684
|
}
|
|
616
685
|
await V();
|
|
617
686
|
}
|
|
618
|
-
const
|
|
619
|
-
async function
|
|
620
|
-
const s = await
|
|
621
|
-
directories:
|
|
622
|
-
from:
|
|
623
|
-
count:
|
|
687
|
+
const ze = Y(nt);
|
|
688
|
+
async function We() {
|
|
689
|
+
const s = await ze({
|
|
690
|
+
directories: r.value,
|
|
691
|
+
from: v.value,
|
|
692
|
+
count: d.value.length
|
|
624
693
|
});
|
|
625
|
-
s !== void 0 && (await
|
|
694
|
+
s !== void 0 && (await o.move([...d.value], s), await Promise.all([V(), R()]));
|
|
626
695
|
}
|
|
627
|
-
async function
|
|
628
|
-
const s = [...
|
|
629
|
-
await
|
|
630
|
-
title:
|
|
631
|
-
message:
|
|
632
|
-
confirmText:
|
|
633
|
-
cancelText:
|
|
696
|
+
async function De() {
|
|
697
|
+
const s = [...d.value];
|
|
698
|
+
await ve({
|
|
699
|
+
title: t("dialogs.delete-files-title", { count: s.length }),
|
|
700
|
+
message: t("dialogs.delete-files-text"),
|
|
701
|
+
confirmText: t("dialogs.confirm"),
|
|
702
|
+
cancelText: t("manager.cancel"),
|
|
634
703
|
tone: "danger"
|
|
635
|
-
}) && (await
|
|
636
|
-
}
|
|
637
|
-
async function ze(s, o) {
|
|
638
|
-
await i.rename(s.id, o), await U();
|
|
704
|
+
}) && (await o.remove(s), await Promise.all([V(), R()]));
|
|
639
705
|
}
|
|
640
|
-
async function
|
|
641
|
-
await
|
|
706
|
+
async function Le(s, n) {
|
|
707
|
+
await o.rename(s.id, n), await R();
|
|
642
708
|
}
|
|
643
709
|
async function Ue(s) {
|
|
644
|
-
|
|
645
|
-
|
|
710
|
+
await o.removeOne(s.id), await Promise.all([V(), R()]);
|
|
711
|
+
}
|
|
712
|
+
async function Re(s) {
|
|
713
|
+
const n = await Qe({
|
|
714
|
+
src: s.source ?? s.url,
|
|
715
|
+
fileName: s.file_name,
|
|
716
|
+
filters: !1,
|
|
717
|
+
// The editor is a component of the design system: its words are props with English
|
|
718
|
+
// defaults, not lines in the panel's dictionary. Whoever opens it is the one who knows
|
|
719
|
+
// what language the panel is being read in.
|
|
720
|
+
...p()
|
|
721
|
+
});
|
|
722
|
+
n && (await o.edit(s.id, {
|
|
646
723
|
// The editor's frame is read against the picture as it is on screen — already turned — and
|
|
647
724
|
// the server applies the operations in that order for the same reason.
|
|
648
|
-
crop:
|
|
649
|
-
rotate: (
|
|
650
|
-
flip:
|
|
651
|
-
resize: { width:
|
|
652
|
-
}), await
|
|
725
|
+
crop: n.crop,
|
|
726
|
+
rotate: (n.rotation % 360 + 360) % 360,
|
|
727
|
+
flip: n.flipX ? "horizontal" : n.flipY ? "vertical" : void 0,
|
|
728
|
+
resize: { width: n.width, height: n.height }
|
|
729
|
+
}), await R());
|
|
653
730
|
}
|
|
654
|
-
function
|
|
655
|
-
const
|
|
656
|
-
for (const
|
|
657
|
-
if (
|
|
658
|
-
return
|
|
659
|
-
const
|
|
660
|
-
if (
|
|
661
|
-
return
|
|
731
|
+
function Ve(s) {
|
|
732
|
+
const n = (y) => {
|
|
733
|
+
for (const C of y) {
|
|
734
|
+
if (C.id === s)
|
|
735
|
+
return C;
|
|
736
|
+
const O = n(C.children ?? []);
|
|
737
|
+
if (O)
|
|
738
|
+
return O;
|
|
662
739
|
}
|
|
663
740
|
return null;
|
|
664
741
|
};
|
|
665
|
-
return s === null ? null :
|
|
742
|
+
return s === null ? null : n(r.value);
|
|
666
743
|
}
|
|
667
|
-
function
|
|
668
|
-
const
|
|
669
|
-
return
|
|
744
|
+
function Ee(s) {
|
|
745
|
+
const n = s?.body;
|
|
746
|
+
return n?.code === "directory_not_empty" ? n.counts ?? null : null;
|
|
670
747
|
}
|
|
671
|
-
function
|
|
748
|
+
function ce(s) {
|
|
672
749
|
return s?.message ?? null;
|
|
673
750
|
}
|
|
674
|
-
function
|
|
675
|
-
const
|
|
676
|
-
let
|
|
677
|
-
for (;
|
|
678
|
-
|
|
679
|
-
return `${
|
|
751
|
+
function Be(s) {
|
|
752
|
+
const n = ["B", "KB", "MB", "GB", "TB"];
|
|
753
|
+
let y = s, C = 0;
|
|
754
|
+
for (; y >= 1024 && C < n.length - 1; )
|
|
755
|
+
y /= 1024, C++;
|
|
756
|
+
return `${y >= 10 || C === 0 ? Math.round(y) : y.toFixed(1)} ${n[C]}`;
|
|
680
757
|
}
|
|
681
|
-
function
|
|
682
|
-
let
|
|
758
|
+
function Fe(s, n) {
|
|
759
|
+
let y;
|
|
683
760
|
return () => {
|
|
684
|
-
clearTimeout(
|
|
761
|
+
clearTimeout(y), y = setTimeout(s, n);
|
|
685
762
|
};
|
|
686
763
|
}
|
|
687
|
-
return (s,
|
|
764
|
+
return (s, n) => (b(), z("div", {
|
|
688
765
|
ref_key: "root",
|
|
689
|
-
ref:
|
|
690
|
-
class:
|
|
766
|
+
ref: x,
|
|
767
|
+
class: Ae(["wx-media", { "wx-media--compact": u.value }])
|
|
691
768
|
}, [
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
selected:
|
|
695
|
-
"onUpdate:selected":
|
|
696
|
-
directories:
|
|
697
|
-
onMove:
|
|
769
|
+
u.value ? L("", !0) : (b(), z("aside", ut, [
|
|
770
|
+
h(ge, {
|
|
771
|
+
selected: v.value,
|
|
772
|
+
"onUpdate:selected": n[0] || (n[0] = (y) => v.value = y),
|
|
773
|
+
directories: r.value,
|
|
774
|
+
onMove: ue
|
|
698
775
|
}, null, 8, ["selected", "directories"]),
|
|
699
|
-
|
|
776
|
+
K.value ? (b(), k(e(G), {
|
|
700
777
|
key: 0,
|
|
701
778
|
size: "sm",
|
|
702
779
|
align: "start"
|
|
703
780
|
}, {
|
|
704
|
-
default:
|
|
705
|
-
|
|
781
|
+
default: w(() => [
|
|
782
|
+
h(e(T), {
|
|
706
783
|
type: "add",
|
|
707
|
-
title: e(
|
|
708
|
-
onClick:
|
|
784
|
+
title: e(t)("manager.new-folder"),
|
|
785
|
+
onClick: re
|
|
709
786
|
}, null, 8, ["title"]),
|
|
710
|
-
|
|
787
|
+
h(e(T), {
|
|
711
788
|
type: "edit",
|
|
712
|
-
title: e(
|
|
713
|
-
disabled: !
|
|
714
|
-
onClick:
|
|
789
|
+
title: e(t)("manager.rename"),
|
|
790
|
+
disabled: !U.value || U.value.is_root,
|
|
791
|
+
onClick: se
|
|
715
792
|
}, null, 8, ["title", "disabled"]),
|
|
716
|
-
|
|
793
|
+
h(e(T), {
|
|
717
794
|
type: "remove",
|
|
718
|
-
title: e(
|
|
719
|
-
disabled: !
|
|
720
|
-
onClick:
|
|
795
|
+
title: e(t)("manager.delete"),
|
|
796
|
+
disabled: !U.value || U.value.is_root,
|
|
797
|
+
onClick: de
|
|
721
798
|
}, null, 8, ["title", "disabled"])
|
|
722
799
|
]),
|
|
723
800
|
_: 1
|
|
724
|
-
})) :
|
|
801
|
+
})) : L("", !0)
|
|
725
802
|
])),
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
search:
|
|
729
|
-
"onUpdate:search":
|
|
730
|
-
type:
|
|
731
|
-
"onUpdate:type":
|
|
732
|
-
sort:
|
|
733
|
-
"onUpdate:sort":
|
|
734
|
-
"can-upload":
|
|
735
|
-
"
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
803
|
+
$("section", ct, [
|
|
804
|
+
h(ot, {
|
|
805
|
+
search: _.value,
|
|
806
|
+
"onUpdate:search": n[1] || (n[1] = (y) => _.value = y),
|
|
807
|
+
type: P.value,
|
|
808
|
+
"onUpdate:type": n[2] || (n[2] = (y) => P.value = y),
|
|
809
|
+
sort: I.value,
|
|
810
|
+
"onUpdate:sort": n[3] || (n[3] = (y) => I.value = y),
|
|
811
|
+
"can-upload": Ce.value,
|
|
812
|
+
"fixed-type": a.accept !== null,
|
|
813
|
+
"can-manage": K.value,
|
|
814
|
+
selected: d.value.length,
|
|
815
|
+
compact: u.value,
|
|
816
|
+
onUpload: Me,
|
|
817
|
+
onMove: We,
|
|
818
|
+
onRemove: De,
|
|
819
|
+
onFolders: n[4] || (n[4] = (y) => H.value = !0)
|
|
820
|
+
}, null, 8, ["search", "type", "sort", "can-upload", "fixed-type", "can-manage", "selected", "compact"]),
|
|
821
|
+
$("input", {
|
|
744
822
|
ref_key: "picker",
|
|
745
|
-
ref:
|
|
823
|
+
ref: oe,
|
|
746
824
|
type: "file",
|
|
747
825
|
multiple: "",
|
|
748
826
|
hidden: "",
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
827
|
+
accept: a.accept === null ? void 0 : `${a.accept}/*`,
|
|
828
|
+
onChange: Te
|
|
829
|
+
}, null, 40, mt),
|
|
830
|
+
h(lt, {
|
|
831
|
+
selected: d.value,
|
|
832
|
+
"onUpdate:selected": n[5] || (n[5] = (y) => d.value = y),
|
|
833
|
+
files: _e.value,
|
|
834
|
+
api: e(o),
|
|
835
|
+
query: _.value,
|
|
836
|
+
single: a.picking,
|
|
837
|
+
onRename: Le,
|
|
838
|
+
onEdit: Re,
|
|
839
|
+
onRemove: Ue,
|
|
840
|
+
onOpen: n[6] || (n[6] = (y) => l("pick", y))
|
|
762
841
|
}, null, 8, ["selected", "files", "api", "query", "single"]),
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
842
|
+
$("footer", pt, [
|
|
843
|
+
$("span", null, D(e(t)("manager.status-files", { count: i.value?.stats.files ?? 0 })), 1),
|
|
844
|
+
d.value.length > 0 ? (b(), z("span", ft, D(e(t)("manager.status-selected", { count: d.value.length })), 1)) : L("", !0),
|
|
845
|
+
$("span", null, D(e(t)("manager.status-size", { size: Be(i.value?.stats.size ?? 0) })), 1)
|
|
767
846
|
]),
|
|
768
|
-
|
|
847
|
+
i.value && i.value.meta.last_page > 1 ? (b(), k(e(Ye), {
|
|
769
848
|
key: 0,
|
|
770
|
-
page:
|
|
771
|
-
"per-page":
|
|
772
|
-
total:
|
|
773
|
-
"last-page":
|
|
849
|
+
page: i.value.meta.current_page,
|
|
850
|
+
"per-page": i.value.meta.per_page,
|
|
851
|
+
total: i.value.meta.total,
|
|
852
|
+
"last-page": i.value.meta.last_page,
|
|
774
853
|
disabled: J.value,
|
|
775
854
|
size: "sm",
|
|
776
|
-
onChange:
|
|
777
|
-
}, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) :
|
|
855
|
+
onChange: n[7] || (n[7] = ({ page: y }) => R(y))
|
|
856
|
+
}, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : L("", !0)
|
|
778
857
|
]),
|
|
779
|
-
|
|
780
|
-
open:
|
|
781
|
-
"onUpdate:open":
|
|
858
|
+
h(e(Je), {
|
|
859
|
+
open: H.value,
|
|
860
|
+
"onUpdate:open": n[10] || (n[10] = (y) => H.value = y),
|
|
782
861
|
side: "left",
|
|
783
|
-
title: e(
|
|
862
|
+
title: e(t)("manager.folders"),
|
|
784
863
|
size: 280
|
|
785
864
|
}, {
|
|
786
|
-
default:
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
selected:
|
|
865
|
+
default: w(() => [
|
|
866
|
+
$("div", vt, [
|
|
867
|
+
h(ge, {
|
|
868
|
+
selected: v.value,
|
|
790
869
|
"onUpdate:selected": [
|
|
791
|
-
|
|
792
|
-
|
|
870
|
+
n[8] || (n[8] = (y) => v.value = y),
|
|
871
|
+
n[9] || (n[9] = (y) => H.value = !1)
|
|
793
872
|
],
|
|
794
|
-
directories:
|
|
795
|
-
onMove:
|
|
873
|
+
directories: r.value,
|
|
874
|
+
onMove: ue
|
|
796
875
|
}, null, 8, ["selected", "directories"]),
|
|
797
|
-
|
|
876
|
+
K.value ? (b(), k(e(G), {
|
|
798
877
|
key: 0,
|
|
799
878
|
size: "sm",
|
|
800
879
|
align: "start"
|
|
801
880
|
}, {
|
|
802
|
-
default:
|
|
803
|
-
|
|
881
|
+
default: w(() => [
|
|
882
|
+
h(e(T), {
|
|
804
883
|
type: "add",
|
|
805
|
-
title: e(
|
|
806
|
-
onClick:
|
|
884
|
+
title: e(t)("manager.new-folder"),
|
|
885
|
+
onClick: re
|
|
807
886
|
}, null, 8, ["title"]),
|
|
808
|
-
|
|
887
|
+
h(e(T), {
|
|
809
888
|
type: "edit",
|
|
810
|
-
title: e(
|
|
811
|
-
disabled: !
|
|
812
|
-
onClick:
|
|
889
|
+
title: e(t)("manager.rename"),
|
|
890
|
+
disabled: !U.value || U.value.is_root,
|
|
891
|
+
onClick: se
|
|
813
892
|
}, null, 8, ["title", "disabled"]),
|
|
814
|
-
|
|
893
|
+
h(e(T), {
|
|
815
894
|
type: "remove",
|
|
816
|
-
title: e(
|
|
817
|
-
disabled: !
|
|
818
|
-
onClick:
|
|
895
|
+
title: e(t)("manager.delete"),
|
|
896
|
+
disabled: !U.value || U.value.is_root,
|
|
897
|
+
onClick: de
|
|
819
898
|
}, null, 8, ["title", "disabled"])
|
|
820
899
|
]),
|
|
821
900
|
_: 1
|
|
822
|
-
})) :
|
|
901
|
+
})) : L("", !0)
|
|
823
902
|
])
|
|
824
903
|
]),
|
|
825
904
|
_: 1
|
|
826
905
|
}, 8, ["open", "title"])
|
|
827
906
|
], 2));
|
|
828
907
|
}
|
|
829
|
-
}),
|
|
908
|
+
}), gt = /* @__PURE__ */ E({
|
|
830
909
|
__name: "MediaPage",
|
|
831
|
-
setup(
|
|
832
|
-
return (
|
|
910
|
+
setup(a) {
|
|
911
|
+
return (c, m) => (b(), k(e(Ze), {
|
|
833
912
|
class: "wx-media-page",
|
|
834
913
|
padding: "md"
|
|
835
914
|
}, {
|
|
836
|
-
default:
|
|
837
|
-
|
|
915
|
+
default: w(() => [
|
|
916
|
+
h(ke)
|
|
838
917
|
]),
|
|
839
918
|
_: 1
|
|
840
919
|
}));
|
|
841
920
|
}
|
|
842
|
-
}),
|
|
921
|
+
}), yt = { class: "wx-media-picker" }, $e = /* @__PURE__ */ E({
|
|
843
922
|
__name: "MediaPicker",
|
|
844
923
|
props: {
|
|
845
924
|
accept: { default: "image" },
|
|
846
925
|
title: { default: void 0 },
|
|
847
926
|
manage: { type: Boolean, default: !1 }
|
|
848
927
|
},
|
|
849
|
-
setup(
|
|
850
|
-
const { open:
|
|
851
|
-
return (
|
|
852
|
-
open: e(
|
|
853
|
-
"onUpdate:open":
|
|
854
|
-
title:
|
|
928
|
+
setup(a) {
|
|
929
|
+
const { open: c, resolve: m } = ae(), l = B("webx-media");
|
|
930
|
+
return (f, o) => (b(), k(e(le), {
|
|
931
|
+
open: e(c),
|
|
932
|
+
"onUpdate:open": o[1] || (o[1] = (t) => te(c) ? c.value = t : null),
|
|
933
|
+
title: a.title ?? e(l)("module.title"),
|
|
855
934
|
width: 960
|
|
856
935
|
}, {
|
|
857
|
-
default:
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
picking: !
|
|
861
|
-
accept:
|
|
862
|
-
onPick:
|
|
936
|
+
default: w(() => [
|
|
937
|
+
$("div", yt, [
|
|
938
|
+
h(ke, {
|
|
939
|
+
picking: !a.manage,
|
|
940
|
+
accept: a.manage ? null : a.accept,
|
|
941
|
+
onPick: o[0] || (o[0] = (t) => e(m)(t))
|
|
863
942
|
}, null, 8, ["picking", "accept"])
|
|
864
943
|
])
|
|
865
944
|
]),
|
|
866
945
|
_: 1
|
|
867
946
|
}, 8, ["open", "title"]));
|
|
868
947
|
}
|
|
869
|
-
}),
|
|
870
|
-
|
|
948
|
+
}), ht = Y($e), Ut = Y(
|
|
949
|
+
$e,
|
|
871
950
|
{ props: { manage: !0 } }
|
|
872
|
-
),
|
|
951
|
+
), bt = { class: "wx-media-field" }, wt = {
|
|
873
952
|
key: 0,
|
|
874
953
|
class: "wx-media-field__label"
|
|
875
|
-
},
|
|
954
|
+
}, xt = ["disabled"], kt = ["disabled", "title"], $t = {
|
|
955
|
+
key: 1,
|
|
956
|
+
class: "wx-media-field__missing"
|
|
957
|
+
}, _t = {
|
|
958
|
+
key: 0,
|
|
959
|
+
class: "wx-media-field__bar"
|
|
960
|
+
}, Ct = { class: "wx-media-field__captions" }, Mt = { class: "wx-media-field__caption" }, Tt = { class: "wx-media-field__caption" }, zt = { class: "wx-media-field__captions-footer" }, Rt = /* @__PURE__ */ E({
|
|
876
961
|
__name: "MediaField",
|
|
877
|
-
props: /* @__PURE__ */
|
|
962
|
+
props: /* @__PURE__ */ F({
|
|
878
963
|
label: { default: void 0 },
|
|
879
964
|
accept: { default: "image" },
|
|
880
|
-
captions: { type: Boolean, default: !0 }
|
|
965
|
+
captions: { type: Boolean, default: !0 },
|
|
966
|
+
height: { default: 220 },
|
|
967
|
+
disabled: { type: Boolean, default: !1 }
|
|
881
968
|
}, {
|
|
882
969
|
modelValue: { default: null },
|
|
883
970
|
modelModifiers: {}
|
|
884
971
|
}),
|
|
885
972
|
emits: ["update:modelValue"],
|
|
886
|
-
setup(
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
973
|
+
setup(a) {
|
|
974
|
+
const c = a, m = A(a, "modelValue");
|
|
975
|
+
xe();
|
|
976
|
+
const l = B("webx-media"), f = we(ie()), o = M(!1), t = M({});
|
|
977
|
+
q(
|
|
978
|
+
() => m.value?.path,
|
|
979
|
+
async (i) => {
|
|
980
|
+
if (!i || m.value?.url || t.value[i]) return;
|
|
981
|
+
const d = await f.fileByPath(i);
|
|
982
|
+
d && (t.value = { ...t.value, [i]: d.url });
|
|
983
|
+
},
|
|
984
|
+
{ immediate: !0 }
|
|
985
|
+
);
|
|
986
|
+
const p = W(() => {
|
|
987
|
+
const i = m.value;
|
|
988
|
+
return i ? i.url ?? t.value[i.path] ?? null : null;
|
|
989
|
+
}), x = W(() => ({
|
|
990
|
+
height: typeof c.height == "number" ? `${c.height}px` : c.height
|
|
991
|
+
}));
|
|
992
|
+
function g(i) {
|
|
993
|
+
return m.value?.[i] ?? {};
|
|
893
994
|
}
|
|
894
|
-
function i
|
|
895
|
-
|
|
995
|
+
function u(i, d) {
|
|
996
|
+
m.value && (m.value = { ...m.value, [i]: d });
|
|
896
997
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
998
|
+
async function r() {
|
|
999
|
+
if (c.disabled) return;
|
|
1000
|
+
const i = await ht({ accept: c.accept });
|
|
1001
|
+
i && (m.value = { ...m.value, path: i.path, url: i.url });
|
|
1002
|
+
}
|
|
1003
|
+
function v() {
|
|
1004
|
+
m.value = null, o.value = !1;
|
|
1005
|
+
}
|
|
1006
|
+
return (i, d) => (b(), z("div", bt, [
|
|
1007
|
+
a.label ? (b(), z("span", wt, D(a.label), 1)) : L("", !0),
|
|
1008
|
+
m.value ? (b(), z("div", {
|
|
1009
|
+
key: 2,
|
|
1010
|
+
class: "wx-media-field__frame",
|
|
1011
|
+
style: me(x.value)
|
|
1012
|
+
}, [
|
|
1013
|
+
$("button", {
|
|
1014
|
+
type: "button",
|
|
1015
|
+
class: "wx-media-field__picture",
|
|
1016
|
+
disabled: a.disabled,
|
|
1017
|
+
title: e(l)("field.replace"),
|
|
1018
|
+
onClick: r
|
|
1019
|
+
}, [
|
|
1020
|
+
p.value ? (b(), k(e(et), {
|
|
1021
|
+
key: 0,
|
|
1022
|
+
src: p.value,
|
|
1023
|
+
fit: "contain",
|
|
1024
|
+
width: "100%",
|
|
1025
|
+
height: "100%"
|
|
1026
|
+
}, null, 8, ["src"])) : (b(), z("span", $t, D(e(l)("field.no-preview")), 1))
|
|
1027
|
+
], 8, kt),
|
|
1028
|
+
a.disabled ? L("", !0) : (b(), z("div", _t, [
|
|
1029
|
+
h(e(G), { size: "sm" }, {
|
|
1030
|
+
default: w(() => [
|
|
1031
|
+
a.captions ? (b(), k(e(tt), {
|
|
1032
|
+
key: 0,
|
|
1033
|
+
open: o.value,
|
|
1034
|
+
"onUpdate:open": d[3] || (d[3] = (_) => o.value = _),
|
|
1035
|
+
title: e(l)("field.captions"),
|
|
1036
|
+
width: 360,
|
|
1037
|
+
side: "top",
|
|
1038
|
+
teleport: ""
|
|
1039
|
+
}, {
|
|
1040
|
+
trigger: w(() => [
|
|
1041
|
+
h(e(T), {
|
|
1042
|
+
type: "edit",
|
|
1043
|
+
title: e(l)("field.edit")
|
|
1044
|
+
}, null, 8, ["title"])
|
|
1045
|
+
]),
|
|
1046
|
+
default: w(() => [
|
|
1047
|
+
$("div", Ct, [
|
|
1048
|
+
$("div", Mt, [
|
|
1049
|
+
d[4] || (d[4] = $("label", {
|
|
1050
|
+
class: "wx-media-field__caption-label",
|
|
1051
|
+
for: "wx-media-alt"
|
|
1052
|
+
}, "alt", -1)),
|
|
1053
|
+
h(e(j), {
|
|
1054
|
+
id: "wx-media-alt",
|
|
1055
|
+
localized: "",
|
|
1056
|
+
"model-value": g("alt"),
|
|
1057
|
+
placeholder: e(l)("field.alt-hint"),
|
|
1058
|
+
"onUpdate:modelValue": d[0] || (d[0] = (_) => u("alt", _))
|
|
1059
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
1060
|
+
]),
|
|
1061
|
+
$("div", Tt, [
|
|
1062
|
+
d[5] || (d[5] = $("label", {
|
|
1063
|
+
class: "wx-media-field__caption-label",
|
|
1064
|
+
for: "wx-media-title"
|
|
1065
|
+
}, "title", -1)),
|
|
1066
|
+
h(e(j), {
|
|
1067
|
+
id: "wx-media-title",
|
|
1068
|
+
localized: "",
|
|
1069
|
+
"model-value": g("title"),
|
|
1070
|
+
placeholder: e(l)("field.title-hint"),
|
|
1071
|
+
"onUpdate:modelValue": d[1] || (d[1] = (_) => u("title", _))
|
|
1072
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
1073
|
+
]),
|
|
1074
|
+
$("div", zt, [
|
|
1075
|
+
h(e(X), {
|
|
1076
|
+
size: "sm",
|
|
1077
|
+
type: "primary",
|
|
1078
|
+
onClick: d[2] || (d[2] = (_) => o.value = !1)
|
|
1079
|
+
}, {
|
|
1080
|
+
default: w(() => [
|
|
1081
|
+
S(D(e(l)("manager.save")), 1)
|
|
1082
|
+
]),
|
|
1083
|
+
_: 1
|
|
1084
|
+
})
|
|
1085
|
+
])
|
|
1086
|
+
])
|
|
1087
|
+
]),
|
|
1088
|
+
_: 1
|
|
1089
|
+
}, 8, ["open", "title"])) : L("", !0),
|
|
1090
|
+
h(e(at), {
|
|
1091
|
+
title: e(l)("field.clear-title"),
|
|
1092
|
+
description: e(l)("field.clear-text"),
|
|
1093
|
+
"confirm-text": e(l)("field.clear-confirm"),
|
|
1094
|
+
"cancel-text": e(l)("manager.cancel"),
|
|
1095
|
+
"confirm-type": "danger",
|
|
1096
|
+
side: "top",
|
|
1097
|
+
onConfirm: v
|
|
1098
|
+
}, {
|
|
1099
|
+
trigger: w(() => [
|
|
1100
|
+
h(e(T), {
|
|
1101
|
+
type: "remove",
|
|
1102
|
+
title: e(l)("field.clear-confirm")
|
|
1103
|
+
}, null, 8, ["title"])
|
|
1104
|
+
]),
|
|
1105
|
+
_: 1
|
|
1106
|
+
}, 8, ["title", "description", "confirm-text", "cancel-text"])
|
|
1107
|
+
]),
|
|
1108
|
+
_: 1
|
|
1109
|
+
})
|
|
1110
|
+
]))
|
|
1111
|
+
], 4)) : (b(), z("div", {
|
|
1112
|
+
key: 1,
|
|
1113
|
+
class: "wx-media-field__frame is-empty",
|
|
1114
|
+
style: me(x.value)
|
|
1115
|
+
}, [
|
|
1116
|
+
$("button", {
|
|
1117
|
+
type: "button",
|
|
1118
|
+
class: "wx-media-field__pick",
|
|
1119
|
+
disabled: a.disabled,
|
|
1120
|
+
onClick: r
|
|
1121
|
+
}, D(e(l)("field.select")), 9, xt)
|
|
1122
|
+
], 4))
|
|
957
1123
|
]));
|
|
958
1124
|
}
|
|
959
1125
|
});
|
|
960
|
-
function
|
|
961
|
-
const
|
|
1126
|
+
function Vt(a = {}) {
|
|
1127
|
+
const c = a.path ?? "/media";
|
|
962
1128
|
return {
|
|
963
1129
|
id: "media",
|
|
964
|
-
path:
|
|
1130
|
+
path: c,
|
|
965
1131
|
routes: [
|
|
966
1132
|
{
|
|
967
|
-
path:
|
|
1133
|
+
path: c,
|
|
968
1134
|
name: "webx.media",
|
|
969
|
-
component:
|
|
1135
|
+
component: gt
|
|
970
1136
|
}
|
|
971
1137
|
]
|
|
972
1138
|
};
|
|
973
1139
|
}
|
|
974
1140
|
export {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1141
|
+
Rt as WxMediaField,
|
|
1142
|
+
ke as WxMediaManager,
|
|
1143
|
+
gt as WxMediaPage,
|
|
1144
|
+
$e as WxMediaPicker,
|
|
1145
|
+
we as createMediaApi,
|
|
1146
|
+
Vt as media,
|
|
1147
|
+
dt as mediaMessages,
|
|
1148
|
+
Ut as openMediaLibrary,
|
|
1149
|
+
ht as openMediaPicker
|
|
984
1150
|
};
|
|
985
1151
|
//# sourceMappingURL=index.js.map
|