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