ablok-components 0.3.87 → 0.3.88

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