ablok-components 0.3.90 → 0.3.91

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.
@@ -1,6 +1,7 @@
1
1
  declare function __VLS_template(): {
2
2
  attrs: Partial<{}>;
3
3
  slots: {
4
+ 'bulk-remove'?(_: {}): any;
4
5
  button?(_: {}): any;
5
6
  };
6
7
  refs: {
@@ -1,4 +1,4 @@
1
- import { defineComponent as T, computed as D, ref as _, resolveComponent as C, openBlock as i, createElementBlock as d, createElementVNode as o, unref as L, withModifiers as g, createVNode as p, createCommentVNode as u, toDisplayString as y, withCtx as B, renderSlot as S, Fragment as I, withDirectives as U, vModelText as N, nextTick as A } from "vue";
1
+ import { defineComponent as D, computed as L, ref as _, resolveComponent as C, openBlock as i, createElementBlock as r, createElementVNode as o, unref as S, renderSlot as B, withModifiers as g, createVNode as p, createCommentVNode as c, toDisplayString as y, withCtx as w, Fragment as I, withDirectives as U, vModelText as N, nextTick as A } from "vue";
2
2
  import E from "../file-upload/file-upload.vue.js";
3
3
  /* empty css */
4
4
  import { sanitizeHtml as R } from "../../../composables/useSanitize.js";
@@ -8,7 +8,7 @@ const K = { class: "container" }, j = { class: "row" }, q = {
8
8
  }, G = { class: "py-4 px-3 d-flex align-items-center border border-bottom-0" }, J = ["innerHTML"], O = { class: "col-12" }, P = {
9
9
  key: 0,
10
10
  class: "grid place-items-center text-center text-muted py-5 border border-bottom-0"
11
- }, Q = { class: "m-0" }, W = { class: "preview-item border-bottom p-3" }, X = { class: "d-flex gap-3" }, Y = { class: "col-2" }, Z = { class: "col d-flex flex-column" }, ee = { class: "file-meta text-muted small mb-2" }, te = { class: "fw-semibold" }, oe = { key: 0 }, le = { key: 1 }, se = ["onUpdate:modelValue", "id"], ne = ["innerHTML"], ae = { class: "col-auto d-flex flex-column gap-2" }, ie = ["onClick"], de = ["onClick"], re = { class: "d-flex align-items-end p-3" }, ce = { class: "btn btn-primary btn-sm ms-auto d-flex align-items-center gap-2" }, ue = ["innerHTML"], he = /* @__PURE__ */ T({
11
+ }, Q = { class: "m-0" }, W = { class: "preview-item border-bottom p-3" }, X = { class: "d-flex gap-3" }, Y = { class: "col-2" }, Z = { class: "col d-flex flex-column" }, ee = { class: "file-meta text-muted small mb-2" }, te = { class: "fw-semibold" }, oe = { key: 0 }, le = { key: 1 }, se = ["onUpdate:modelValue", "id"], ne = ["innerHTML"], ae = { class: "col-auto d-flex flex-column gap-2" }, ie = ["onClick"], re = ["onClick"], de = { class: "d-flex align-items-end p-3" }, ue = { class: "btn btn-primary btn-sm ms-auto d-flex align-items-center gap-2" }, ce = ["innerHTML"], be = /* @__PURE__ */ D({
12
12
  __name: "bulk-upload",
13
13
  props: {
14
14
  storeId: String,
@@ -53,10 +53,10 @@ const K = { class: "container" }, j = { class: "row" }, q = {
53
53
  }
54
54
  },
55
55
  emits: ["update:modelValue"],
56
- setup(c, { emit: w }) {
57
- const h = c, k = w, M = (e) => `${e.name ?? ""}|${e.size ?? 0}|${e.lastModified ?? 0}|${e.type ?? ""}`, m = D({
56
+ setup(u, { emit: V }) {
57
+ const b = u, k = V, M = (e) => `${e.name ?? ""}|${e.size ?? 0}|${e.lastModified ?? 0}|${e.type ?? ""}`, m = L({
58
58
  get: () => {
59
- const e = h.modelValue || [];
59
+ const e = b.modelValue || [];
60
60
  return v.value = e.map((t) => t.caption || ""), e.map((t) => ({
61
61
  type: t.type,
62
62
  src: t.src,
@@ -66,24 +66,24 @@ const K = { class: "container" }, j = { class: "row" }, q = {
66
66
  }));
67
67
  },
68
68
  set: (e) => {
69
- const t = m.value || [], l = Array.isArray(e) ? e : [], a = h.allowDuplicateFiles ? l : l.filter((s) => {
70
- const r = M(s);
71
- return !t.some((F) => M(F) === r);
69
+ const t = m.value || [], l = Array.isArray(e) ? e : [], a = b.allowDuplicateFiles ? l : l.filter((s) => {
70
+ const d = M(s);
71
+ return !t.some((x) => M(x) === d);
72
72
  });
73
- if (!h.allowDuplicateFiles && l.length > 0 && a.length === 0)
73
+ if (!b.allowDuplicateFiles && l.length > 0 && a.length === 0)
74
74
  return;
75
- const n = a.length <= t.length && a.every((s) => t.some((r) => r.src === s.src));
76
- b(n ? a : [...t, ...a]);
75
+ const n = a.length <= t.length && a.every((s) => t.some((d) => d.src === s.src));
76
+ h(n ? a : [...t, ...a]);
77
77
  }
78
78
  }), $ = _(null), f = _({}), v = _({});
79
- function V(e) {
80
- const t = [...h.modelValue || []];
79
+ function H(e) {
80
+ const t = [...b.modelValue || []];
81
81
  t.splice(e, 1), k("update:modelValue", t);
82
82
  }
83
- async function H(e) {
84
- f.value[e] = !f.value[e], f.value[e] || b(), await A(), $.value?.querySelector(`#caption-${e}`)?.focus();
83
+ async function z(e) {
84
+ f.value[e] = !f.value[e], f.value[e] || h(), await A(), $.value?.querySelector(`#caption-${e}`)?.focus();
85
85
  }
86
- function x(e) {
86
+ function F(e) {
87
87
  if (e == null) return "";
88
88
  const t = ["B", "KB", "MB", "GB", "TB"];
89
89
  let l = e, a = t.shift();
@@ -91,10 +91,10 @@ const K = { class: "container" }, j = { class: "row" }, q = {
91
91
  l /= 1024, a = t.shift();
92
92
  return `${l.toFixed(1)} ${a}`;
93
93
  }
94
- function z(e) {
94
+ function T(e) {
95
95
  return e ? new Date(e).toLocaleDateString() : "";
96
96
  }
97
- function b(e) {
97
+ function h(e) {
98
98
  k("update:modelValue", (e || m.value).map((t, l) => ({
99
99
  ...t,
100
100
  caption: v.value[l] || ""
@@ -102,30 +102,32 @@ const K = { class: "container" }, j = { class: "row" }, q = {
102
102
  }
103
103
  return (e, t) => {
104
104
  const l = C("svg-icon"), a = C("base-image");
105
- return i(), d("div", {
105
+ return i(), r("div", {
106
106
  class: "bulk-upload",
107
107
  ref_key: "root",
108
108
  ref: $
109
109
  }, [
110
110
  o("div", K, [
111
111
  o("div", j, [
112
- c.hasHeader ? (i(), d("div", q, [
112
+ u.hasHeader ? (i(), r("div", q, [
113
113
  o("div", G, [
114
114
  o("p", {
115
115
  class: "fw-bold m-0",
116
- innerHTML: L(R)(c.title || e.$t("fileInput.bulkUploadHeadline"))
116
+ innerHTML: S(R)(u.title || e.$t("fileInput.bulkUploadHeadline"))
117
117
  }, null, 8, J),
118
- c.hasBulkRemove ? (i(), d("button", {
119
- key: 0,
120
- onClick: t[0] || (t[0] = g((n) => m.value = [], ["prevent"])),
121
- class: "btn btn--close ms-auto p-0"
122
- }, [
123
- p(l, { symbol: "x" })
124
- ])) : u("", !0)
118
+ B(e.$slots, "bulk-remove", {}, () => [
119
+ u.hasBulkRemove ? (i(), r("button", {
120
+ key: 0,
121
+ onClick: t[0] || (t[0] = g((n) => m.value = [], ["prevent"])),
122
+ class: "btn btn--close ms-auto p-0"
123
+ }, [
124
+ p(l, { symbol: "x" })
125
+ ])) : c("", !0)
126
+ ])
125
127
  ])
126
- ])) : u("", !0),
128
+ ])) : c("", !0),
127
129
  o("div", O, [
128
- m.value.length ? u("", !0) : (i(), d("div", P, [
130
+ m.value.length ? c("", !0) : (i(), r("div", P, [
129
131
  o("p", Q, y(e.$t("fileInput.noFilesSelected")), 1)
130
132
  ])),
131
133
  p(E, {
@@ -138,7 +140,7 @@ const K = { class: "container" }, j = { class: "row" }, q = {
138
140
  "local-url-format": "objectUrl",
139
141
  class: "d-flex flex-column border"
140
142
  }, {
141
- "preview-item": B(({ bind: { item: n, index: s } }) => [
143
+ "preview-item": w(({ bind: { item: n, index: s } }) => [
142
144
  o("div", W, [
143
145
  o("div", X, [
144
146
  o("div", Y, [
@@ -152,57 +154,57 @@ const K = { class: "container" }, j = { class: "row" }, q = {
152
154
  o("div", ee, [
153
155
  o("div", te, y(n.name || e.$t("fileInput.unknownFile")), 1),
154
156
  o("div", null, [
155
- n.size ? (i(), d("span", oe, y(x(n.size)), 1)) : u("", !0),
156
- n.lastModified ? (i(), d("span", le, " · " + y(z(n.lastModified)), 1)) : u("", !0)
157
+ n.size ? (i(), r("span", oe, y(F(n.size)), 1)) : c("", !0),
158
+ n.lastModified ? (i(), r("span", le, " · " + y(T(n.lastModified)), 1)) : c("", !0)
157
159
  ])
158
160
  ]),
159
- c.hasCaptions ? (i(), d(I, { key: 0 }, [
160
- f.value[s] && c.editCaptions ? U((i(), d("textarea", {
161
+ u.hasCaptions ? (i(), r(I, { key: 0 }, [
162
+ f.value[s] && u.editCaptions ? U((i(), r("textarea", {
161
163
  key: 0,
162
- "onUpdate:modelValue": (r) => v.value[s] = r,
164
+ "onUpdate:modelValue": (d) => v.value[s] = d,
163
165
  id: `caption-${s}`,
164
166
  class: "form-control rounded-0 h-100",
165
- onChangeCapture: t[1] || (t[1] = (r) => b())
167
+ onChangeCapture: t[1] || (t[1] = (d) => h())
166
168
  }, null, 40, se)), [
167
169
  [N, v.value[s]]
168
- ]) : (i(), d("p", {
170
+ ]) : (i(), r("p", {
169
171
  key: 1,
170
172
  class: "m-0",
171
173
  innerHTML: v.value[s] || `<small>${e.$t("fileInput.noCaption")}</small>`
172
174
  }, null, 8, ne))
173
- ], 64)) : u("", !0)
175
+ ], 64)) : c("", !0)
174
176
  ]),
175
177
  o("div", ae, [
176
178
  o("button", {
177
- onClick: g((r) => V(s), ["prevent"]),
179
+ onClick: g((d) => H(s), ["prevent"]),
178
180
  class: "btn btn--close"
179
181
  }, [
180
182
  p(l, { symbol: "x" })
181
183
  ], 8, ie),
182
- c.editCaptions ? (i(), d("button", {
184
+ u.editCaptions ? (i(), r("button", {
183
185
  key: 0,
184
- onClick: g((r) => H(s), ["prevent"]),
186
+ onClick: g((d) => z(s), ["prevent"]),
185
187
  class: "btn btn--close"
186
188
  }, [
187
189
  p(l, {
188
190
  symbol: f.value[s] ? "check" : "edit-3"
189
191
  }, null, 8, ["symbol"])
190
- ], 8, de)) : u("", !0)
192
+ ], 8, re)) : c("", !0)
191
193
  ])
192
194
  ])
193
195
  ])
194
196
  ]),
195
- button: B(() => [
196
- S(e.$slots, "button", {}, () => [
197
- o("span", re, [
198
- o("span", ce, [
197
+ button: w(() => [
198
+ B(e.$slots, "button", {}, () => [
199
+ o("span", de, [
200
+ o("span", ue, [
199
201
  p(l, {
200
202
  symbol: "upload",
201
203
  size: "small"
202
204
  }),
203
205
  o("span", {
204
206
  innerHTML: e.$t("common.selectFile")
205
- }, null, 8, ue)
207
+ }, null, 8, ce)
206
208
  ])
207
209
  ])
208
210
  ])
@@ -217,5 +219,5 @@ const K = { class: "container" }, j = { class: "row" }, q = {
217
219
  }
218
220
  });
219
221
  export {
220
- he as default
222
+ be as default
221
223
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.90",
4
+ "version": "0.3.91",
5
5
  "dependencies": {
6
6
  "date-fns": "^3.0.0",
7
7
  "dompurify": "^3.3.1",