@webx-ui/module-media 0.7.1 → 0.8.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/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as S, useModel as A, ref as R, watch as G, openBlock as b, createBlock as T, unref as e, mergeModels as q, computed as z, resolveDirective as Ge, withCtx as w, createElementBlock as L, Fragment as ce, renderList as me, withDirectives as Ye, createCommentVNode as D, createVNode as g, createTextVNode as O, toDisplayString as U, isRef as ve, useTemplateRef as oe, onMounted as Fe, nextTick as Je, createElementVNode as V, withKeys as Qe, normalizeClass as pe, createSlots as We, inject as Ze, normalizeStyle as fe, mergeProps as ge } from "vue";
2
- import { useTranslate as H, useAdmin as se, useErrorText as et, adminKey as tt, WxListScreen as lt } from "@webx-ui/module-admin";
3
- import { WxTree as at, WxSelectionArea as it, WxFileCard as Le, WxEmpty as nt, toast as J, WxAction as B, WxInput as Z, WxDropdown as Ve, WxDropdownItem as Te, WxActions as le, useModal as ye, WxDialog as he, WxSelect as ot, WxSpace as be, WxButton as I, useElementWidth as st, createModal as ae, WxPagination as rt, WxDrawer as dt, confirm as ue, openImageEditor as ut, WxSortableList as ct, WxPopover as Re, WxPopconfirm as De, WxImage as mt, WxCard as pt } from "@webx-ui/core";
4
- function we(a) {
1
+ import { defineComponent as S, useModel as A, ref as R, watch as G, openBlock as w, createBlock as T, unref as e, mergeModels as q, computed as z, resolveDirective as Ye, withCtx as b, createElementBlock as L, Fragment as ce, renderList as me, withDirectives as Je, createCommentVNode as D, createVNode as g, createTextVNode as O, toDisplayString as U, isRef as ve, useTemplateRef as oe, onMounted as Fe, nextTick as Qe, createElementVNode as V, withKeys as Ze, normalizeClass as pe, createSlots as We, inject as et, normalizeStyle as fe, mergeProps as ge } from "vue";
2
+ import { useTranslate as H, useAdmin as se, useErrorText as tt, adminKey as lt, WxListScreen as at } from "@webx-ui/module-admin";
3
+ import { WxTree as it, WxSelectionArea as nt, WxFileCard as Le, WxEmpty as ot, toast as J, WxAction as B, WxInput as Z, WxDropdown as Ve, WxDropdownItem as Te, WxActions as le, useModal as ye, WxDialog as he, WxSelect as st, WxSpace as we, WxButton as I, useElementWidth as rt, createModal as ae, WxPagination as dt, WxDrawer as ut, confirm as ue, openImageEditor as ct, WxSortableList as mt, WxPopover as Re, WxPopconfirm as De, WxImage as pt, WxCard as ft } from "@webx-ui/core";
4
+ function be(a) {
5
5
  const i = `${a.apiPath}/media`, n = (l) => l.data;
6
6
  return {
7
7
  directories: () => a.http.get(`${i}/directories`).then(n),
@@ -28,7 +28,7 @@ function we(a) {
28
28
  return v.append("directory_id", String(l)), r.forEach((t) => v.append("files[]", t)), new Promise((t, x) => {
29
29
  const y = new XMLHttpRequest();
30
30
  y.open("POST", `${i}/files`), y.responseType = "json", y.withCredentials = !0, y.setRequestHeader("Accept", "application/json"), y.setRequestHeader("X-Requested-With", "XMLHttpRequest"), y.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
31
- const s = ft();
31
+ const s = vt();
32
32
  s && y.setRequestHeader("X-XSRF-TOKEN", s), y.upload.addEventListener("progress", (u) => {
33
33
  u.lengthComputable && d?.(Math.round(u.loaded / u.total * 100));
34
34
  }), y.addEventListener("load", () => {
@@ -63,7 +63,7 @@ function we(a) {
63
63
  }
64
64
  };
65
65
  }
66
- function ft() {
66
+ function vt() {
67
67
  const a = document.cookie.split("; ").find((i) => i.startsWith("XSRF-TOKEN="));
68
68
  return a ? decodeURIComponent(a.slice(11)) : null;
69
69
  }
@@ -74,7 +74,7 @@ function Be(a) {
74
74
  n /= 1024, l++;
75
75
  return `${n >= 10 || l === 0 ? Math.round(n) : n.toFixed(1)} ${i[l]}`;
76
76
  }
77
- function vt(a) {
77
+ function gt(a) {
78
78
  return a.split("/").pop() || a;
79
79
  }
80
80
  const ze = /* @__PURE__ */ S({
@@ -109,7 +109,7 @@ const ze = /* @__PURE__ */ S({
109
109
  const k = u.zone === "inside" ? u.target : u.parent;
110
110
  k && r("move", u.node.id, k.id);
111
111
  }
112
- return (u, k) => (b(), T(e(at), {
112
+ return (u, k) => (w(), T(e(it), {
113
113
  selected: l.value,
114
114
  "onUpdate:selected": k[0] || (k[0] = (h) => l.value = h),
115
115
  expanded: t.value,
@@ -123,7 +123,7 @@ const ze = /* @__PURE__ */ S({
123
123
  onDrop: s
124
124
  }, null, 8, ["selected", "expanded", "modelValue"]));
125
125
  }
126
- }), gt = /* @__PURE__ */ S({
126
+ }), yt = /* @__PURE__ */ S({
127
127
  __name: "FileGrid",
128
128
  props: /* @__PURE__ */ q({
129
129
  files: {},
@@ -158,16 +158,16 @@ const ze = /* @__PURE__ */ S({
158
158
  J.danger(`${d("errors.copy")} ${y.url}`, { duration: 0 });
159
159
  }
160
160
  return (y, s) => {
161
- const u = Ge("wx-select");
162
- return a.files.length > 0 ? (b(), T(e(it), {
161
+ const u = Ye("wx-select");
162
+ return a.files.length > 0 ? (w(), T(e(nt), {
163
163
  key: 0,
164
164
  modelValue: l.value,
165
165
  "onUpdate:modelValue": s[0] || (s[0] = (k) => l.value = k),
166
166
  class: "wx-media-grid",
167
167
  multiple: !a.single
168
168
  }, {
169
- default: w(({ isSelected: k }) => [
170
- (b(!0), L(ce, null, me(a.files, (h) => Ye((b(), T(e(Le), {
169
+ default: b(({ isSelected: k }) => [
170
+ (w(!0), L(ce, null, me(a.files, (h) => Je((w(), T(e(Le), {
171
171
  key: h.id,
172
172
  class: "wx-media-grid__card",
173
173
  name: h.name,
@@ -201,13 +201,13 @@ const ze = /* @__PURE__ */ S({
201
201
  ])), 128))
202
202
  ]),
203
203
  _: 1
204
- }, 8, ["modelValue", "multiple"])) : (b(), T(e(nt), {
204
+ }, 8, ["modelValue", "multiple"])) : (w(), T(e(ot), {
205
205
  key: 1,
206
206
  description: v.value
207
207
  }, null, 8, ["description"]));
208
208
  };
209
209
  }
210
- }), yt = { class: "wx-media-toolbar" }, ht = /* @__PURE__ */ S({
210
+ }), ht = { class: "wx-media-toolbar" }, wt = /* @__PURE__ */ S({
211
211
  __name: "MediaToolbar",
212
212
  props: /* @__PURE__ */ q({
213
213
  canUpload: { type: Boolean },
@@ -237,8 +237,8 @@ const ze = /* @__PURE__ */ S({
237
237
  { value: "name", label: t("manager.sort-name") },
238
238
  { value: "-size", label: t("manager.sort-size") }
239
239
  ]), s = z(() => x.value.find((k) => k.value === r.value)?.label ?? ""), u = z(() => y.value.find((k) => k.value === d.value)?.label ?? "");
240
- return (k, h) => (b(), L("header", yt, [
241
- a.compact ? (b(), T(e(B), {
240
+ return (k, h) => (w(), L("header", ht, [
241
+ a.compact ? (w(), T(e(B), {
242
242
  key: 0,
243
243
  icon: "sidebar",
244
244
  title: e(t)("manager.folders"),
@@ -253,21 +253,21 @@ const ze = /* @__PURE__ */ S({
253
253
  clearable: "",
254
254
  size: "sm"
255
255
  }, null, 8, ["modelValue", "placeholder"]),
256
- a.fixedType ? D("", !0) : (b(), T(e(Ve), { key: 1 }, {
257
- trigger: w(() => [
256
+ a.fixedType ? D("", !0) : (w(), T(e(Ve), { key: 1 }, {
257
+ trigger: b(() => [
258
258
  g(e(B), {
259
259
  icon: "filter",
260
260
  title: `${e(t)("manager.all-types")}: ${s.value}`,
261
261
  size: "sm"
262
262
  }, null, 8, ["title"])
263
263
  ]),
264
- default: w(() => [
265
- (b(!0), L(ce, null, me(x.value, (o) => (b(), T(e(Te), {
264
+ default: b(() => [
265
+ (w(!0), L(ce, null, me(x.value, (o) => (w(), T(e(Te), {
266
266
  key: String(o.value),
267
267
  active: o.value === r.value,
268
268
  onClick: ($) => r.value = o.value
269
269
  }, {
270
- default: w(() => [
270
+ default: b(() => [
271
271
  O(U(o.label), 1)
272
272
  ]),
273
273
  _: 2
@@ -276,20 +276,20 @@ const ze = /* @__PURE__ */ S({
276
276
  _: 1
277
277
  })),
278
278
  g(e(Ve), null, {
279
- trigger: w(() => [
279
+ trigger: b(() => [
280
280
  g(e(B), {
281
281
  icon: "arrow-down",
282
282
  title: u.value,
283
283
  size: "sm"
284
284
  }, null, 8, ["title"])
285
285
  ]),
286
- default: w(() => [
287
- (b(!0), L(ce, null, me(y.value, (o) => (b(), T(e(Te), {
286
+ default: b(() => [
287
+ (w(!0), L(ce, null, me(y.value, (o) => (w(), T(e(Te), {
288
288
  key: o.value,
289
289
  active: o.value === d.value,
290
290
  onClick: ($) => d.value = o.value
291
291
  }, {
292
- default: w(() => [
292
+ default: b(() => [
293
293
  O(U(o.label), 1)
294
294
  ]),
295
295
  _: 2
@@ -297,18 +297,18 @@ const ze = /* @__PURE__ */ S({
297
297
  ]),
298
298
  _: 1
299
299
  }),
300
- a.canUpload ? (b(), T(e(B), {
300
+ a.canUpload ? (w(), T(e(B), {
301
301
  key: 2,
302
302
  type: "upload",
303
303
  title: e(t)("manager.upload"),
304
304
  size: "sm",
305
305
  onClick: h[2] || (h[2] = (o) => v("upload"))
306
306
  }, null, 8, ["title"])) : D("", !0),
307
- a.canManage ? (b(), T(e(le), {
307
+ a.canManage ? (w(), T(e(le), {
308
308
  key: 3,
309
309
  size: "sm"
310
310
  }, {
311
- default: w(() => [
311
+ default: b(() => [
312
312
  g(e(B), {
313
313
  icon: "folder-move",
314
314
  title: e(t)("manager.move"),
@@ -347,20 +347,20 @@ const ze = /* @__PURE__ */ S({
347
347
  ...x(s.children ?? [])
348
348
  ]);
349
349
  }
350
- return (y, s) => (b(), T(e(he), {
350
+ return (y, s) => (w(), T(e(he), {
351
351
  open: e(n),
352
352
  "onUpdate:open": s[3] || (s[3] = (u) => ve(n) ? n.value = u : null),
353
353
  title: e(d)("manager.move-to"),
354
354
  width: 420
355
355
  }, {
356
- footer: w(() => [
357
- g(e(be), { size: "sm" }, {
358
- default: w(() => [
356
+ footer: b(() => [
357
+ g(e(we), { size: "sm" }, {
358
+ default: b(() => [
359
359
  g(e(I), {
360
360
  variant: "outline",
361
361
  onClick: s[1] || (s[1] = (u) => e(r)())
362
362
  }, {
363
- default: w(() => [
363
+ default: b(() => [
364
364
  O(U(e(d)("manager.cancel")), 1)
365
365
  ]),
366
366
  _: 1
@@ -370,7 +370,7 @@ const ze = /* @__PURE__ */ S({
370
370
  disabled: t.value === null,
371
371
  onClick: s[2] || (s[2] = (u) => e(l)(t.value))
372
372
  }, {
373
- default: w(() => [
373
+ default: b(() => [
374
374
  O(U(e(d)("manager.move")), 1)
375
375
  ]),
376
376
  _: 1
@@ -379,8 +379,8 @@ const ze = /* @__PURE__ */ S({
379
379
  _: 1
380
380
  })
381
381
  ]),
382
- default: w(() => [
383
- g(e(ot), {
382
+ default: b(() => [
383
+ g(e(st), {
384
384
  modelValue: t.value,
385
385
  "onUpdate:modelValue": s[0] || (s[0] = (u) => t.value = u),
386
386
  options: v.value
@@ -389,7 +389,7 @@ const ze = /* @__PURE__ */ S({
389
389
  _: 1
390
390
  }, 8, ["open", "title"]));
391
391
  }
392
- }), wt = /* @__PURE__ */ S({
392
+ }), xt = /* @__PURE__ */ S({
393
393
  __name: "NameDialog",
394
394
  props: {
395
395
  title: {},
@@ -400,26 +400,26 @@ const ze = /* @__PURE__ */ S({
400
400
  setup(a) {
401
401
  const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = R(i.value), t = oe("input");
402
402
  Fe(async () => {
403
- await Je(), t.value?.querySelector("input")?.focus();
403
+ await Qe(), t.value?.querySelector("input")?.focus();
404
404
  });
405
405
  function x() {
406
406
  const y = v.value.trim();
407
407
  y !== "" && l(y);
408
408
  }
409
- return (y, s) => (b(), T(e(he), {
409
+ return (y, s) => (w(), T(e(he), {
410
410
  open: e(n),
411
411
  "onUpdate:open": s[2] || (s[2] = (u) => ve(n) ? n.value = u : null),
412
412
  title: a.title,
413
413
  width: 420
414
414
  }, {
415
- footer: w(() => [
416
- g(e(be), { size: "sm" }, {
417
- default: w(() => [
415
+ footer: b(() => [
416
+ g(e(we), { size: "sm" }, {
417
+ default: b(() => [
418
418
  g(e(I), {
419
419
  variant: "outline",
420
420
  onClick: s[1] || (s[1] = (u) => e(r)())
421
421
  }, {
422
- default: w(() => [
422
+ default: b(() => [
423
423
  O(U(e(d)("manager.cancel")), 1)
424
424
  ]),
425
425
  _: 1
@@ -429,7 +429,7 @@ const ze = /* @__PURE__ */ S({
429
429
  disabled: v.value.trim() === "",
430
430
  onClick: x
431
431
  }, {
432
- default: w(() => [
432
+ default: b(() => [
433
433
  O(U(a.confirmText ?? e(d)("manager.save")), 1)
434
434
  ]),
435
435
  _: 1
@@ -438,7 +438,7 @@ const ze = /* @__PURE__ */ S({
438
438
  _: 1
439
439
  })
440
440
  ]),
441
- default: w(() => [
441
+ default: b(() => [
442
442
  V("div", {
443
443
  ref_key: "input",
444
444
  ref: t
@@ -448,14 +448,14 @@ const ze = /* @__PURE__ */ S({
448
448
  "onUpdate:modelValue": s[0] || (s[0] = (u) => v.value = u),
449
449
  placeholder: a.label ?? e(d)("manager.folder-name"),
450
450
  "aria-label": a.label ?? e(d)("manager.folder-name"),
451
- onKeyup: Qe(x, ["enter"])
451
+ onKeyup: Ze(x, ["enter"])
452
452
  }, null, 8, ["modelValue", "placeholder", "aria-label"])
453
453
  ], 512)
454
454
  ]),
455
455
  _: 1
456
456
  }, 8, ["open", "title"]));
457
457
  }
458
- }), xt = {
458
+ }), kt = {
459
459
  module: {
460
460
  title: "Files"
461
461
  },
@@ -590,14 +590,14 @@ const ze = /* @__PURE__ */ S({
590
590
  function re() {
591
591
  try {
592
592
  const { i18n: a } = se();
593
- Ue.has(a) || (a.defaults("webx-media", xt), Ue.add(a));
593
+ Ue.has(a) || (a.defaults("webx-media", kt), Ue.add(a));
594
594
  } catch {
595
595
  }
596
596
  }
597
- const kt = {
597
+ const $t = {
598
598
  key: 0,
599
599
  class: "wx-media__folders"
600
- }, $t = { class: "wx-media__files" }, _t = ["accept"], Ct = { class: "wx-media__status" }, Mt = { key: 0 }, Vt = { class: "wx-media__drawer" }, Se = /* @__PURE__ */ S({
600
+ }, _t = { class: "wx-media__files" }, Ct = ["accept"], Mt = { class: "wx-media__status" }, Vt = { key: 0 }, Tt = { class: "wx-media__drawer" }, Se = /* @__PURE__ */ S({
601
601
  __name: "MediaManager",
602
602
  props: /* @__PURE__ */ q({
603
603
  picking: { type: Boolean, default: !1 },
@@ -611,9 +611,9 @@ const kt = {
611
611
  }),
612
612
  emits: /* @__PURE__ */ q(["pick", "selection"], ["update:type"]),
613
613
  setup(a, { expose: i, emit: n }) {
614
- const l = a, r = n, d = se(), v = we(d);
614
+ const l = a, r = n, d = se(), v = be(d);
615
615
  re();
616
- const t = H("webx-media"), x = et();
616
+ const t = H("webx-media"), x = tt();
617
617
  function y() {
618
618
  return {
619
619
  title: t("editor.title"),
@@ -635,14 +635,14 @@ const kt = {
635
635
  errorText: t("editor.error")
636
636
  };
637
637
  }
638
- const s = oe("root"), u = st(s), k = z(() => u.value > 0 && u.value < 640), h = R([]), o = R(null), $ = R(null), F = R([]), K = R(""), X = A(a, "type");
638
+ const s = oe("root"), u = rt(s), k = z(() => u.value > 0 && u.value < 640), h = R([]), o = R(null), $ = R(null), F = R([]), K = R(""), X = A(a, "type");
639
639
  l.accept && (X.value = l.accept), G(
640
640
  () => l.accept,
641
641
  (p) => {
642
642
  X.value = p ?? "all";
643
643
  }
644
644
  );
645
- const N = R("-created_at"), ee = R(!1), j = R(!1), te = oe("picker"), ie = z(() => $.value?.data ?? []), Q = z(() => d.can("media.manage")), de = z(() => d.can("media.upload") || Q.value), E = z(() => He(o.value)), ne = z(() => l.picking && !l.multiple);
645
+ const N = R("-created_at"), ee = R(!1), j = R(!1), te = oe("picker"), ie = z(() => $.value?.data ?? []), Q = z(() => d.can("media.manage")), de = z(() => d.can("media.upload") || Q.value), E = z(() => Xe(o.value)), ne = z(() => l.picking && !l.multiple);
646
646
  G(F, (p) => {
647
647
  if (l.max !== null && l.max > 0 && p.length > l.max) {
648
648
  F.value = p.slice(0, l.max);
@@ -654,7 +654,7 @@ const kt = {
654
654
  );
655
655
  }), Fe(c), G([o, X, N], () => m(1)), G(
656
656
  K,
657
- Ke(() => m(1), 300)
657
+ je(() => m(1), 300)
658
658
  ), G(k, (p) => {
659
659
  p || (j.value = !1);
660
660
  });
@@ -682,13 +682,13 @@ const kt = {
682
682
  const f = p.target, _ = Array.from(f.files ?? []);
683
683
  if (f.value = "", !(_.length === 0 || o.value === null))
684
684
  try {
685
- const P = await v.upload(o.value, _), Y = P.filter((je) => je.duplicate).length;
685
+ const P = await v.upload(o.value, _), Y = P.filter((Ge) => Ge.duplicate).length;
686
686
  P.length > Y && J.success(t("manager.uploaded", { count: P.length - Y })), Y > 0 && J.info(t("manager.duplicate-added")), await Promise.all([c(), m(1)]);
687
687
  } catch (P) {
688
688
  J.danger(x(P, t("errors.upload")));
689
689
  }
690
690
  }
691
- const W = ae(wt);
691
+ const W = ae(xt);
692
692
  async function $e() {
693
693
  const p = await W({
694
694
  title: t("manager.new-folder"),
@@ -719,7 +719,7 @@ const kt = {
719
719
  try {
720
720
  await v.deleteDirectory(p.id);
721
721
  } catch (_) {
722
- const P = Xe(_);
722
+ const P = Ke(_);
723
723
  if (!P) {
724
724
  J.danger(x(_));
725
725
  return;
@@ -745,16 +745,16 @@ const kt = {
745
745
  }
746
746
  await c();
747
747
  }
748
- const Ee = ae(bt);
749
- async function Pe() {
750
- const p = await Ee({
748
+ const Pe = ae(bt);
749
+ async function Oe() {
750
+ const p = await Pe({
751
751
  directories: h.value,
752
752
  from: o.value,
753
753
  count: F.value.length
754
754
  });
755
755
  p !== void 0 && (await v.move([...F.value], p), await Promise.all([c(), m()]));
756
756
  }
757
- async function Oe() {
757
+ async function Ae() {
758
758
  const p = [...F.value];
759
759
  await ue({
760
760
  title: t("dialogs.delete-files-title", { count: p.length }),
@@ -764,14 +764,14 @@ const kt = {
764
764
  tone: "danger"
765
765
  }) && (await v.remove(p), await Promise.all([c(), m()]));
766
766
  }
767
- async function Ae(p, f) {
767
+ async function Ne(p, f) {
768
768
  await v.rename(p.id, f), await m();
769
769
  }
770
- async function Ne(p) {
770
+ async function qe(p) {
771
771
  await v.removeOne(p.id), await Promise.all([c(), m()]);
772
772
  }
773
- async function qe(p) {
774
- const f = await ut({
773
+ async function Ie(p) {
774
+ const f = await ct({
775
775
  src: p.source ?? p.url,
776
776
  fileName: p.file_name,
777
777
  filters: !1,
@@ -789,10 +789,10 @@ const kt = {
789
789
  resize: { width: f.width, height: f.height }
790
790
  }), await m());
791
791
  }
792
- function Ie(p) {
792
+ function He(p) {
793
793
  l.multiple || r("pick", p);
794
794
  }
795
- function He(p) {
795
+ function Xe(p) {
796
796
  const f = (_) => {
797
797
  for (const P of _) {
798
798
  if (P.id === p)
@@ -805,35 +805,35 @@ const kt = {
805
805
  };
806
806
  return p === null ? null : f(h.value);
807
807
  }
808
- function Xe(p) {
808
+ function Ke(p) {
809
809
  const f = p?.body;
810
810
  return f?.code === "directory_not_empty" ? f.counts ?? null : null;
811
811
  }
812
812
  i({ upload: M });
813
- function Ke(p, f) {
813
+ function je(p, f) {
814
814
  let _;
815
815
  return () => {
816
816
  clearTimeout(_), _ = setTimeout(p, f);
817
817
  };
818
818
  }
819
- return (p, f) => (b(), L("div", {
819
+ return (p, f) => (w(), L("div", {
820
820
  ref_key: "root",
821
821
  ref: s,
822
822
  class: pe(["wx-media", { "wx-media--compact": k.value }])
823
823
  }, [
824
- k.value ? D("", !0) : (b(), L("aside", kt, [
824
+ k.value ? D("", !0) : (w(), L("aside", $t, [
825
825
  g(ze, {
826
826
  selected: o.value,
827
827
  "onUpdate:selected": f[0] || (f[0] = (_) => o.value = _),
828
828
  directories: h.value,
829
829
  onMove: Me
830
830
  }, null, 8, ["selected", "directories"]),
831
- Q.value ? (b(), T(e(le), {
831
+ Q.value ? (w(), T(e(le), {
832
832
  key: 0,
833
833
  size: "sm",
834
834
  align: "start"
835
835
  }, {
836
- default: w(() => [
836
+ default: b(() => [
837
837
  g(e(B), {
838
838
  type: "add",
839
839
  title: e(t)("manager.new-folder"),
@@ -855,8 +855,8 @@ const kt = {
855
855
  _: 1
856
856
  })) : D("", !0)
857
857
  ])),
858
- V("section", $t, [
859
- g(ht, {
858
+ V("section", _t, [
859
+ g(wt, {
860
860
  search: K.value,
861
861
  "onUpdate:search": f[1] || (f[1] = (_) => K.value = _),
862
862
  type: X.value,
@@ -869,8 +869,8 @@ const kt = {
869
869
  selected: F.value.length,
870
870
  compact: k.value,
871
871
  onUpload: M,
872
- onMove: Pe,
873
- onRemove: Oe,
872
+ onMove: Oe,
873
+ onRemove: Ae,
874
874
  onFolders: f[4] || (f[4] = (_) => j.value = !0)
875
875
  }, null, 8, ["search", "type", "sort", "can-upload", "fixed-type", "can-manage", "selected", "compact"]),
876
876
  V("input", {
@@ -881,25 +881,25 @@ const kt = {
881
881
  hidden: "",
882
882
  accept: a.accept === null ? void 0 : `${a.accept}/*`,
883
883
  onChange: C
884
- }, null, 40, _t),
885
- g(gt, {
884
+ }, null, 40, Ct),
885
+ g(yt, {
886
886
  selected: F.value,
887
887
  "onUpdate:selected": f[5] || (f[5] = (_) => F.value = _),
888
888
  files: ie.value,
889
889
  api: e(v),
890
890
  query: K.value,
891
891
  single: ne.value,
892
- onRename: Ae,
893
- onEdit: qe,
894
- onRemove: Ne,
895
- onOpen: Ie
892
+ onRename: Ne,
893
+ onEdit: Ie,
894
+ onRemove: qe,
895
+ onOpen: He
896
896
  }, null, 8, ["selected", "files", "api", "query", "single"]),
897
- V("footer", Ct, [
897
+ V("footer", Mt, [
898
898
  V("span", null, U(e(t)("manager.status-files", { count: $.value?.stats.files ?? 0 })), 1),
899
- F.value.length > 0 ? (b(), L("span", Mt, U(e(t)("manager.status-selected", { count: F.value.length })), 1)) : D("", !0),
899
+ F.value.length > 0 ? (w(), L("span", Vt, U(e(t)("manager.status-selected", { count: F.value.length })), 1)) : D("", !0),
900
900
  V("span", null, U(e(t)("manager.status-size", { size: e(Be)($.value?.stats.size ?? 0) })), 1)
901
901
  ]),
902
- $.value && $.value.meta.last_page > 1 ? (b(), T(e(rt), {
902
+ $.value && $.value.meta.last_page > 1 ? (w(), T(e(dt), {
903
903
  key: 0,
904
904
  page: $.value.meta.current_page,
905
905
  "per-page": $.value.meta.per_page,
@@ -910,15 +910,15 @@ const kt = {
910
910
  onChange: f[6] || (f[6] = ({ page: _ }) => m(_))
911
911
  }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : D("", !0)
912
912
  ]),
913
- g(e(dt), {
913
+ g(e(ut), {
914
914
  open: j.value,
915
915
  "onUpdate:open": f[9] || (f[9] = (_) => j.value = _),
916
916
  side: "left",
917
917
  title: e(t)("manager.folders"),
918
918
  size: 280
919
919
  }, {
920
- default: w(() => [
921
- V("div", Vt, [
920
+ default: b(() => [
921
+ V("div", Tt, [
922
922
  g(ze, {
923
923
  selected: o.value,
924
924
  "onUpdate:selected": [
@@ -928,12 +928,12 @@ const kt = {
928
928
  directories: h.value,
929
929
  onMove: Me
930
930
  }, null, 8, ["selected", "directories"]),
931
- Q.value ? (b(), T(e(le), {
931
+ Q.value ? (w(), T(e(le), {
932
932
  key: 0,
933
933
  size: "sm",
934
934
  align: "start"
935
935
  }, {
936
- default: w(() => [
936
+ default: b(() => [
937
937
  g(e(B), {
938
938
  type: "add",
939
939
  title: e(t)("manager.new-folder"),
@@ -960,7 +960,7 @@ const kt = {
960
960
  }, 8, ["open", "title"])
961
961
  ], 2));
962
962
  }
963
- }), Tt = { class: "wx-media-picker" }, zt = {
963
+ }), zt = { class: "wx-media-picker" }, Ut = {
964
964
  key: 0,
965
965
  class: "wx-media-picker__count"
966
966
  }, xe = /* @__PURE__ */ S({
@@ -974,14 +974,14 @@ const kt = {
974
974
  },
975
975
  setup(a) {
976
976
  const { open: i, resolve: n, dismiss: l } = ye(), r = H("webx-media"), d = R([]);
977
- return (v, t) => (b(), T(e(he), {
977
+ return (v, t) => (w(), T(e(he), {
978
978
  open: e(i),
979
979
  "onUpdate:open": t[4] || (t[4] = (x) => ve(i) ? i.value = x : null),
980
980
  title: a.title ?? e(r)("module.title"),
981
981
  width: 960
982
982
  }, We({
983
- default: w(() => [
984
- V("div", Tt, [
983
+ default: b(() => [
984
+ V("div", zt, [
985
985
  g(Se, {
986
986
  picking: !a.manage,
987
987
  accept: a.manage ? null : a.accept,
@@ -996,15 +996,15 @@ const kt = {
996
996
  }, [
997
997
  a.multiple && !a.manage ? {
998
998
  name: "footer",
999
- fn: w(() => [
1000
- g(e(be), { size: "sm" }, {
1001
- default: w(() => [
1002
- a.max !== null && a.max > 0 ? (b(), L("span", zt, U(e(r)("manager.chosen", { count: d.value.length, max: a.max })), 1)) : D("", !0),
999
+ fn: b(() => [
1000
+ g(e(we), { size: "sm" }, {
1001
+ default: b(() => [
1002
+ a.max !== null && a.max > 0 ? (w(), L("span", Ut, U(e(r)("manager.chosen", { count: d.value.length, max: a.max })), 1)) : D("", !0),
1003
1003
  g(e(I), {
1004
1004
  variant: "outline",
1005
1005
  onClick: t[2] || (t[2] = (x) => e(l)())
1006
1006
  }, {
1007
- default: w(() => [
1007
+ default: b(() => [
1008
1008
  O(U(e(r)("manager.cancel")), 1)
1009
1009
  ]),
1010
1010
  _: 1
@@ -1015,7 +1015,7 @@ const kt = {
1015
1015
  disabled: d.value.length === 0,
1016
1016
  onClick: t[3] || (t[3] = (x) => e(n)(d.value))
1017
1017
  }, {
1018
- default: w(() => [
1018
+ default: b(() => [
1019
1019
  O(U(e(r)("manager.pick", { count: d.value.length })), 1)
1020
1020
  ]),
1021
1021
  _: 1
@@ -1028,7 +1028,7 @@ const kt = {
1028
1028
  } : void 0
1029
1029
  ]), 1032, ["open", "title"]));
1030
1030
  }
1031
- }), Ut = ae(xe), Ft = ae(xe, {
1031
+ }), Ee = ae(xe), Ft = ae(xe, {
1032
1032
  props: { multiple: !0 }
1033
1033
  }), Wt = ae(
1034
1034
  xe,
@@ -1066,7 +1066,7 @@ const kt = {
1066
1066
  setup(a) {
1067
1067
  const i = a, n = A(a, "modelValue");
1068
1068
  re();
1069
- const l = H("webx-media"), r = Ze(tt, null), d = r ? we(r) : null, v = {
1069
+ const l = H("webx-media"), r = et(lt, null), d = r ? be(r) : null, v = {
1070
1070
  "16/9": "16 / 9",
1071
1071
  "4/3": "4 / 3",
1072
1072
  "1/1": "1 / 1"
@@ -1103,7 +1103,7 @@ const kt = {
1103
1103
  return o(c) === null;
1104
1104
  }
1105
1105
  function F(c) {
1106
- return o(c)?.name ?? vt(c.path);
1106
+ return o(c)?.name ?? gt(c.path);
1107
1107
  }
1108
1108
  function K(c) {
1109
1109
  const m = o(c);
@@ -1154,12 +1154,12 @@ const kt = {
1154
1154
  const c = t.value.length;
1155
1155
  return i.min && c < i.min ? l("field.at-least", { count: i.min }) : x.value === null ? "" : l("field.count", { count: c, max: x.value });
1156
1156
  });
1157
- return (c, m) => (b(), L("div", {
1157
+ return (c, m) => (w(), L("div", {
1158
1158
  class: pe(["wx-media-list", [`wx-media-list--${a.layout}`, { "is-disabled": a.disabled }]]),
1159
1159
  style: fe(E.value)
1160
1160
  }, [
1161
- a.label ? (b(), L("span", Lt, U(a.label), 1)) : D("", !0),
1162
- g(e(ct), {
1161
+ a.label ? (w(), L("span", Lt, U(a.label), 1)) : D("", !0),
1162
+ g(e(mt), {
1163
1163
  modelValue: t.value,
1164
1164
  "onUpdate:modelValue": m[1] || (m[1] = (M) => t.value = M),
1165
1165
  plain: "",
@@ -1170,7 +1170,7 @@ const kt = {
1170
1170
  "drag-label": e(l)("field.reorder"),
1171
1171
  "empty-text": e(l)("field.empty")
1172
1172
  }, {
1173
- default: w(({ item: M, index: C }) => [
1173
+ default: b(({ item: M, index: C }) => [
1174
1174
  V("div", {
1175
1175
  class: pe(["wx-media-list__cell", { "is-broken": $(M), "is-busy": N.value === C }])
1176
1176
  }, [
@@ -1180,15 +1180,15 @@ const kt = {
1180
1180
  type: o(M)?.mime,
1181
1181
  size: a.layout === "rows" ? "sm" : "md"
1182
1182
  }, {
1183
- meta: w(() => [
1184
- $(M) ? (b(), L("span", Rt, U(e(l)("field.missing")), 1)) : (b(), L("span", Dt, U(X(M)), 1))
1183
+ meta: b(() => [
1184
+ $(M) ? (w(), L("span", Rt, U(e(l)("field.missing")), 1)) : (w(), L("span", Dt, U(X(M)), 1))
1185
1185
  ]),
1186
1186
  _: 2
1187
1187
  }, 1032, ["name", "thumbnail", "type", "size"]),
1188
- a.disabled ? D("", !0) : (b(), L("div", Bt, [
1188
+ a.disabled ? D("", !0) : (w(), L("div", Bt, [
1189
1189
  g(e(le), { size: "sm" }, {
1190
- default: w(() => [
1191
- a.captions ? (b(), T(e(Re), {
1190
+ default: b(() => [
1191
+ a.captions ? (w(), T(e(Re), {
1192
1192
  key: 0,
1193
1193
  open: N.value === C,
1194
1194
  title: e(l)("field.captions"),
@@ -1197,13 +1197,13 @@ const kt = {
1197
1197
  teleport: "",
1198
1198
  "onUpdate:open": (W) => N.value = W ? C : null
1199
1199
  }, {
1200
- trigger: w(() => [
1200
+ trigger: b(() => [
1201
1201
  g(e(B), {
1202
1202
  type: "edit",
1203
1203
  title: e(l)("field.captions")
1204
1204
  }, null, 8, ["title"])
1205
1205
  ]),
1206
- default: w(() => [
1206
+ default: b(() => [
1207
1207
  V("div", St, [
1208
1208
  V("div", Et, [
1209
1209
  m[2] || (m[2] = V("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
@@ -1229,7 +1229,7 @@ const kt = {
1229
1229
  type: "primary",
1230
1230
  onClick: m[0] || (m[0] = (W) => N.value = null)
1231
1231
  }, {
1232
- default: w(() => [
1232
+ default: b(() => [
1233
1233
  O(U(e(l)("manager.save")), 1)
1234
1234
  ]),
1235
1235
  _: 1
@@ -1239,7 +1239,7 @@ const kt = {
1239
1239
  ]),
1240
1240
  _: 2
1241
1241
  }, 1032, ["open", "title", "onUpdate:open"])) : D("", !0),
1242
- $(M) ? D("", !0) : (b(), T(e(B), {
1242
+ $(M) ? D("", !0) : (w(), T(e(B), {
1243
1243
  key: 1,
1244
1244
  type: "goto",
1245
1245
  title: e(l)("field.open"),
@@ -1254,7 +1254,7 @@ const kt = {
1254
1254
  side: "top",
1255
1255
  onConfirm: (W) => Q(C)
1256
1256
  }, {
1257
- trigger: w(() => [
1257
+ trigger: b(() => [
1258
1258
  g(e(B), {
1259
1259
  type: "remove",
1260
1260
  title: e(l)("field.remove-confirm")
@@ -1277,12 +1277,12 @@ const kt = {
1277
1277
  disabled: a.disabled || y.value,
1278
1278
  onClick: ie
1279
1279
  }, {
1280
- default: w(() => [
1280
+ default: b(() => [
1281
1281
  O(U(e(l)("field.add")), 1)
1282
1282
  ]),
1283
1283
  _: 1
1284
1284
  }, 8, ["disabled"]),
1285
- ne.value ? (b(), L("span", Nt, U(ne.value), 1)) : D("", !0)
1285
+ ne.value ? (w(), L("span", Nt, U(ne.value), 1)) : D("", !0)
1286
1286
  ])
1287
1287
  ], 6));
1288
1288
  }
@@ -1302,7 +1302,7 @@ const kt = {
1302
1302
  i.value = l[0] ?? null;
1303
1303
  }
1304
1304
  });
1305
- return (l, r) => (b(), T(ke, ge(l.$attrs, {
1305
+ return (l, r) => (w(), T(ke, ge(l.$attrs, {
1306
1306
  modelValue: n.value,
1307
1307
  "onUpdate:modelValue": r[0] || (r[0] = (d) => n.value = d),
1308
1308
  layout: "rows",
@@ -1320,7 +1320,7 @@ const kt = {
1320
1320
  emits: ["update:modelValue"],
1321
1321
  setup(a) {
1322
1322
  const i = A(a, "modelValue");
1323
- return (n, l) => (b(), T(ke, ge(n.$attrs, {
1323
+ return (n, l) => (w(), T(ke, ge(n.$attrs, {
1324
1324
  modelValue: i.value,
1325
1325
  "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1326
1326
  layout: "rows"
@@ -1337,7 +1337,7 @@ const kt = {
1337
1337
  emits: ["update:modelValue"],
1338
1338
  setup(a) {
1339
1339
  const i = A(a, "modelValue");
1340
- return (n, l) => (b(), T(ke, ge(n.$attrs, {
1340
+ return (n, l) => (w(), T(ke, ge(n.$attrs, {
1341
1341
  modelValue: i.value,
1342
1342
  "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1343
1343
  layout: "grid",
@@ -1370,7 +1370,7 @@ const kt = {
1370
1370
  setup(a) {
1371
1371
  const i = a, n = A(a, "modelValue");
1372
1372
  re();
1373
- const l = H("webx-media"), r = we(se()), d = {
1373
+ const l = H("webx-media"), r = be(se()), d = {
1374
1374
  "16/9": "16 / 9",
1375
1375
  "4/3": "4 / 3",
1376
1376
  "1/1": "1 / 1"
@@ -1398,15 +1398,15 @@ const kt = {
1398
1398
  }
1399
1399
  async function k() {
1400
1400
  if (i.disabled) return;
1401
- const o = await Ut({ accept: i.accept });
1401
+ const o = await Ee({ accept: i.accept });
1402
1402
  o && (t.value = { ...t.value, [o.path]: o.url }, n.value = { ...n.value, path: o.path, url: o.url });
1403
1403
  }
1404
1404
  function h() {
1405
1405
  n.value = null, v.value = !1;
1406
1406
  }
1407
- return (o, $) => (b(), L("div", Xt, [
1408
- a.label ? (b(), L("span", Kt, U(a.label), 1)) : D("", !0),
1409
- n.value ? (b(), L("div", {
1407
+ return (o, $) => (w(), L("div", Xt, [
1408
+ a.label ? (w(), L("span", Kt, U(a.label), 1)) : D("", !0),
1409
+ n.value ? (w(), L("div", {
1410
1410
  key: 2,
1411
1411
  class: "wx-media-field__frame",
1412
1412
  style: fe(y.value)
@@ -1418,18 +1418,18 @@ const kt = {
1418
1418
  title: e(l)("field.replace"),
1419
1419
  onClick: k
1420
1420
  }, [
1421
- x.value ? (b(), T(e(mt), {
1421
+ x.value ? (w(), T(e(pt), {
1422
1422
  key: 0,
1423
1423
  src: x.value,
1424
1424
  fit: "contain",
1425
1425
  width: "100%",
1426
1426
  height: "100%"
1427
- }, null, 8, ["src"])) : (b(), L("span", Yt, U(e(l)("field.no-preview")), 1))
1427
+ }, null, 8, ["src"])) : (w(), L("span", Yt, U(e(l)("field.no-preview")), 1))
1428
1428
  ], 8, Gt),
1429
- a.disabled ? D("", !0) : (b(), L("div", Jt, [
1429
+ a.disabled ? D("", !0) : (w(), L("div", Jt, [
1430
1430
  g(e(le), { size: "sm" }, {
1431
- default: w(() => [
1432
- a.captions ? (b(), T(e(Re), {
1431
+ default: b(() => [
1432
+ a.captions ? (w(), T(e(Re), {
1433
1433
  key: 0,
1434
1434
  open: v.value,
1435
1435
  "onUpdate:open": $[3] || ($[3] = (F) => v.value = F),
@@ -1438,13 +1438,13 @@ const kt = {
1438
1438
  side: "top",
1439
1439
  teleport: ""
1440
1440
  }, {
1441
- trigger: w(() => [
1441
+ trigger: b(() => [
1442
1442
  g(e(B), {
1443
1443
  type: "edit",
1444
1444
  title: e(l)("field.edit")
1445
1445
  }, null, 8, ["title"])
1446
1446
  ]),
1447
- default: w(() => [
1447
+ default: b(() => [
1448
1448
  V("div", Qt, [
1449
1449
  V("div", Zt, [
1450
1450
  $[4] || ($[4] = V("label", {
@@ -1478,7 +1478,7 @@ const kt = {
1478
1478
  type: "primary",
1479
1479
  onClick: $[2] || ($[2] = (F) => v.value = !1)
1480
1480
  }, {
1481
- default: w(() => [
1481
+ default: b(() => [
1482
1482
  O(U(e(l)("manager.save")), 1)
1483
1483
  ]),
1484
1484
  _: 1
@@ -1497,7 +1497,7 @@ const kt = {
1497
1497
  side: "top",
1498
1498
  onConfirm: h
1499
1499
  }, {
1500
- trigger: w(() => [
1500
+ trigger: b(() => [
1501
1501
  g(e(B), {
1502
1502
  type: "remove",
1503
1503
  title: e(l)("field.clear-confirm")
@@ -1509,7 +1509,7 @@ const kt = {
1509
1509
  _: 1
1510
1510
  })
1511
1511
  ]))
1512
- ], 4)) : (b(), L("div", {
1512
+ ], 4)) : (w(), L("div", {
1513
1513
  key: 1,
1514
1514
  class: "wx-media-field__frame is-empty",
1515
1515
  style: fe(y.value)
@@ -1537,7 +1537,7 @@ const kt = {
1537
1537
  label: n(`manager.${y}`)
1538
1538
  }))
1539
1539
  ]);
1540
- return (y, s) => (b(), T(e(lt), {
1540
+ return (y, s) => (w(), T(e(at), {
1541
1541
  view: r.value,
1542
1542
  "onUpdate:view": s[1] || (s[1] = (u) => r.value = u),
1543
1543
  title: t.value,
@@ -1545,12 +1545,12 @@ const kt = {
1545
1545
  card: !1,
1546
1546
  fill: ""
1547
1547
  }, We({
1548
- default: w(() => [
1549
- g(e(pt), {
1548
+ default: b(() => [
1549
+ g(e(ft), {
1550
1550
  class: "wx-media-page",
1551
1551
  padding: "md"
1552
1552
  }, {
1553
- default: w(() => [
1553
+ default: b(() => [
1554
1554
  g(Se, {
1555
1555
  ref_key: "manager",
1556
1556
  ref: l,
@@ -1565,13 +1565,13 @@ const kt = {
1565
1565
  }, [
1566
1566
  v.value ? {
1567
1567
  name: "actions",
1568
- fn: w(() => [
1568
+ fn: b(() => [
1569
1569
  g(e(I), {
1570
1570
  type: "primary",
1571
1571
  icon: "upload",
1572
1572
  onClick: s[0] || (s[0] = (u) => l.value?.upload())
1573
1573
  }, {
1574
- default: w(() => [
1574
+ default: b(() => [
1575
1575
  O(U(e(n)("manager.upload")), 1)
1576
1576
  ]),
1577
1577
  _: 1
@@ -1600,9 +1600,19 @@ function sl(a = {}) {
1600
1600
  // `multiple: true` and `accept: document`".
1601
1601
  types: {
1602
1602
  "wx-media": { component: ll, kind: "field" },
1603
- "wx-gallery": { component: Ht, kind: "field" },
1603
+ "wx-gallery": { component: Ht, kind: "field", wide: !0 },
1604
1604
  "wx-file": { component: qt, kind: "field" },
1605
- "wx-files": { component: It, kind: "field" }
1605
+ "wx-files": { component: It, kind: "field", wide: !0 }
1606
+ },
1607
+ /**
1608
+ * Where the panel's own fields get a picture from. `wx-rich-text` lives in
1609
+ * `module-admin`, which cannot reach the library — the dependency runs this way — so the
1610
+ * module that has the files hands the way in, and a panel without a file manager simply
1611
+ * has no image button in its editors.
1612
+ */
1613
+ pickImage: async () => {
1614
+ const n = await Ee({ accept: "image" });
1615
+ return n ? { url: n.url, path: n.path } : null;
1606
1616
  }
1607
1617
  };
1608
1618
  }
@@ -1614,11 +1624,11 @@ export {
1614
1624
  Se as WxMediaManager,
1615
1625
  al as WxMediaPage,
1616
1626
  xe as WxMediaPicker,
1617
- we as createMediaApi,
1627
+ be as createMediaApi,
1618
1628
  sl as media,
1619
- xt as mediaMessages,
1629
+ kt as mediaMessages,
1620
1630
  Ft as openMediaFiles,
1621
1631
  Wt as openMediaLibrary,
1622
- Ut as openMediaPicker
1632
+ Ee as openMediaPicker
1623
1633
  };
1624
1634
  //# sourceMappingURL=index.js.map