ablok-components 0.3.89 → 0.3.90

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,14 +1,14 @@
1
- import { defineComponent as x, computed as D, ref as y, resolveComponent as B, openBlock as i, createElementBlock as r, createElementVNode as o, unref as L, withModifiers as g, createVNode as m, createCommentVNode as p, toDisplayString as b, withCtx as C, renderSlot as S, Fragment as I, withDirectives as U, vModelText as N, nextTick as A } from "vue";
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";
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";
5
5
  const K = { class: "container" }, j = { class: "row" }, q = {
6
6
  key: 0,
7
7
  class: "col-12"
8
- }, G = { class: "p-3 d-flex align-items-center border border-bottom-0" }, J = ["innerHTML"], O = { class: "col-12" }, P = {
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"], re = ["onClick"], ce = { class: "d-flex align-items-end p-3" }, de = { class: "btn btn-primary btn-sm ms-auto d-flex align-items-center gap-2" }, ue = ["innerHTML"], _e = /* @__PURE__ */ x({
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({
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(d, { emit: w }) {
57
- const _ = d, k = w, M = (e) => `${e.name ?? ""}|${e.size ?? 0}|${e.lastModified ?? 0}|${e.type ?? ""}`, u = D({
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({
58
58
  get: () => {
59
- const e = _.modelValue || [];
59
+ const e = h.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 = u.value || [], l = Array.isArray(e) ? e : [], a = _.allowDuplicateFiles ? l : l.filter((s) => {
70
- const c = M(s);
71
- return !t.some((T) => M(T) === c);
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);
72
72
  });
73
- if (!_.allowDuplicateFiles && l.length > 0 && a.length === 0)
73
+ if (!h.allowDuplicateFiles && l.length > 0 && a.length === 0)
74
74
  return;
75
- const n = a.length <= t.length && a.every((s) => t.some((c) => c.src === s.src));
76
- h(n ? a : [...t, ...a]);
75
+ const n = a.length <= t.length && a.every((s) => t.some((r) => r.src === s.src));
76
+ b(n ? a : [...t, ...a]);
77
77
  }
78
- }), $ = y(null), f = y({}), v = y({});
78
+ }), $ = _(null), f = _({}), v = _({});
79
79
  function V(e) {
80
- const t = [..._.modelValue || []];
80
+ const t = [...h.modelValue || []];
81
81
  t.splice(e, 1), k("update:modelValue", t);
82
82
  }
83
83
  async function H(e) {
84
- f.value[e] = !f.value[e], f.value[e] || h(), await A(), $.value?.querySelector(`#caption-${e}`)?.focus();
84
+ f.value[e] = !f.value[e], f.value[e] || b(), await A(), $.value?.querySelector(`#caption-${e}`)?.focus();
85
85
  }
86
- function z(e) {
86
+ function x(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,46 +91,46 @@ 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 F(e) {
94
+ function z(e) {
95
95
  return e ? new Date(e).toLocaleDateString() : "";
96
96
  }
97
- function h(e) {
98
- k("update:modelValue", (e || u.value).map((t, l) => ({
97
+ function b(e) {
98
+ k("update:modelValue", (e || m.value).map((t, l) => ({
99
99
  ...t,
100
100
  caption: v.value[l] || ""
101
101
  })));
102
102
  }
103
103
  return (e, t) => {
104
- const l = B("svg-icon"), a = B("base-image");
105
- return i(), r("div", {
104
+ const l = C("svg-icon"), a = C("base-image");
105
+ return i(), d("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
- d.hasHeader ? (i(), r("div", q, [
112
+ c.hasHeader ? (i(), d("div", q, [
113
113
  o("div", G, [
114
114
  o("p", {
115
115
  class: "fw-bold m-0",
116
- innerHTML: L(R)(d.title || e.$t("fileInput.bulkUploadHeadline"))
116
+ innerHTML: L(R)(c.title || e.$t("fileInput.bulkUploadHeadline"))
117
117
  }, null, 8, J),
118
- d.hasBulkRemove ? (i(), r("button", {
118
+ c.hasBulkRemove ? (i(), d("button", {
119
119
  key: 0,
120
- onClick: t[0] || (t[0] = g((n) => u.value = [], ["prevent"])),
120
+ onClick: t[0] || (t[0] = g((n) => m.value = [], ["prevent"])),
121
121
  class: "btn btn--close ms-auto p-0"
122
122
  }, [
123
- m(l, { symbol: "x" })
124
- ])) : p("", !0)
123
+ p(l, { symbol: "x" })
124
+ ])) : u("", !0)
125
125
  ])
126
- ])) : p("", !0),
126
+ ])) : u("", !0),
127
127
  o("div", O, [
128
- u.value.length ? p("", !0) : (i(), r("div", P, [
129
- o("p", Q, b(e.$t("fileInput.noFilesSelected")), 1)
128
+ m.value.length ? u("", !0) : (i(), d("div", P, [
129
+ o("p", Q, y(e.$t("fileInput.noFilesSelected")), 1)
130
130
  ])),
131
- m(E, {
132
- modelValue: u.value,
133
- "onUpdate:modelValue": t[2] || (t[2] = (n) => u.value = n),
131
+ p(E, {
132
+ modelValue: m.value,
133
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => m.value = n),
134
134
  multiple: !0,
135
135
  accept: "image/*",
136
136
  "drop-files": !0,
@@ -138,11 +138,11 @@ const K = { class: "container" }, j = { class: "row" }, q = {
138
138
  "local-url-format": "objectUrl",
139
139
  class: "d-flex flex-column border"
140
140
  }, {
141
- "preview-item": C(({ bind: { item: n, index: s } }) => [
141
+ "preview-item": B(({ bind: { item: n, index: s } }) => [
142
142
  o("div", W, [
143
143
  o("div", X, [
144
144
  o("div", Y, [
145
- m(a, {
145
+ p(a, {
146
146
  src: n.src,
147
147
  alt: "",
148
148
  class: "img-thumbnail"
@@ -150,52 +150,53 @@ const K = { class: "container" }, j = { class: "row" }, q = {
150
150
  ]),
151
151
  o("div", Z, [
152
152
  o("div", ee, [
153
- o("div", te, b(n.name || e.$t("fileInput.unknownFile")), 1),
153
+ o("div", te, y(n.name || e.$t("fileInput.unknownFile")), 1),
154
154
  o("div", null, [
155
- n.size ? (i(), r("span", oe, b(z(n.size)), 1)) : p("", !0),
156
- n.lastModified ? (i(), r("span", le, " · " + b(F(n.lastModified)), 1)) : p("", !0)
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
157
  ])
158
158
  ]),
159
- d.hasCaptions ? (i(), r(I, { key: 0 }, [
160
- f.value[s] && d.editCaptions ? U((i(), r("textarea", {
159
+ c.hasCaptions ? (i(), d(I, { key: 0 }, [
160
+ f.value[s] && c.editCaptions ? U((i(), d("textarea", {
161
161
  key: 0,
162
- "onUpdate:modelValue": (c) => v.value[s] = c,
162
+ "onUpdate:modelValue": (r) => v.value[s] = r,
163
163
  id: `caption-${s}`,
164
164
  class: "form-control rounded-0 h-100",
165
- onChangeCapture: t[1] || (t[1] = (c) => h())
165
+ onChangeCapture: t[1] || (t[1] = (r) => b())
166
166
  }, null, 40, se)), [
167
167
  [N, v.value[s]]
168
- ]) : (i(), r("p", {
168
+ ]) : (i(), d("p", {
169
169
  key: 1,
170
170
  class: "m-0",
171
171
  innerHTML: v.value[s] || `<small>${e.$t("fileInput.noCaption")}</small>`
172
172
  }, null, 8, ne))
173
- ], 64)) : p("", !0)
173
+ ], 64)) : u("", !0)
174
174
  ]),
175
175
  o("div", ae, [
176
176
  o("button", {
177
- onClick: g((c) => V(s), ["prevent"]),
177
+ onClick: g((r) => V(s), ["prevent"]),
178
178
  class: "btn btn--close"
179
179
  }, [
180
- m(l, { symbol: "x" })
180
+ p(l, { symbol: "x" })
181
181
  ], 8, ie),
182
- o("button", {
183
- onClick: g((c) => H(s), ["prevent"]),
182
+ c.editCaptions ? (i(), d("button", {
183
+ key: 0,
184
+ onClick: g((r) => H(s), ["prevent"]),
184
185
  class: "btn btn--close"
185
186
  }, [
186
- m(l, {
187
+ p(l, {
187
188
  symbol: f.value[s] ? "check" : "edit-3"
188
189
  }, null, 8, ["symbol"])
189
- ], 8, re)
190
+ ], 8, de)) : u("", !0)
190
191
  ])
191
192
  ])
192
193
  ])
193
194
  ]),
194
- button: C(() => [
195
+ button: B(() => [
195
196
  S(e.$slots, "button", {}, () => [
196
- o("span", ce, [
197
- o("span", de, [
198
- m(l, {
197
+ o("span", re, [
198
+ o("span", ce, [
199
+ p(l, {
199
200
  symbol: "upload",
200
201
  size: "small"
201
202
  }),
@@ -216,5 +217,5 @@ const K = { class: "container" }, j = { class: "row" }, q = {
216
217
  }
217
218
  });
218
219
  export {
219
- _e as default
220
+ he as default
220
221
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.89",
4
+ "version": "0.3.90",
5
5
  "dependencies": {
6
6
  "date-fns": "^3.0.0",
7
7
  "dompurify": "^3.3.1",