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