ablok-components 0.3.93 → 0.3.95
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.
- package/dist/ablok-components.css +1 -1
- package/dist/ablok-components.umd.js +2 -2
- package/dist/components/molecules/bulk-upload/bulk-upload.vue.d.ts +44 -0
- package/dist/components/molecules/bulk-upload/bulk-upload.vue.js +128 -99
- package/dist/components/molecules/file-upload/file-upload.vue.d.ts +15 -0
- package/dist/components/molecules/file-upload/file-upload.vue.js +39 -37
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as L, ref as y, toRef as M, computed as N, watch as
|
|
1
|
+
import { defineComponent as L, ref as y, toRef as M, computed as N, watch as h, openBlock as u, createElementBlock as d, normalizeClass as V, unref as v, Fragment as S, renderList as P, renderSlot as g, createElementVNode as c, withModifiers as w, createVNode as p, Transition as T, withCtx as H, createCommentVNode as W } from "vue";
|
|
2
2
|
import k from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import q from "../../atoms/input-file/input-file.vue.js";
|
|
@@ -7,7 +7,7 @@ import { useUploadTransport as I } from "../../../composables/useUploadTransport
|
|
|
7
7
|
import { useLocalFileUrl as R } from "../../../composables/useLocalFileUrl.js";
|
|
8
8
|
import { sanitizeHtml as O } from "../../../composables/useSanitize.js";
|
|
9
9
|
import { uniqueId as F } from "../../../utilities/helpers.js";
|
|
10
|
-
const
|
|
10
|
+
const j = ["src"], G = ["onClick"], J = ["onClick"], K = ["for"], Q = ["innerHTML"], X = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "file-upload__loading-spinner"
|
|
13
13
|
}, ne = /* @__PURE__ */ L({
|
|
@@ -103,7 +103,7 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
103
103
|
},
|
|
104
104
|
emits: ["update:modelValue", "update:src"],
|
|
105
105
|
setup(o, { emit: U }) {
|
|
106
|
-
const e = o, i = U,
|
|
106
|
+
const e = o, i = U, b = y(), m = y([]), n = y([]), { pending: $, uploadFile: B } = I(e), { toLocalUrl: D, revoke: z } = R(M(e, "localUrlFormat")), { isDragging: C } = E(b, {
|
|
107
107
|
enabled: () => e.dropFiles,
|
|
108
108
|
onDrop: (t) => {
|
|
109
109
|
m.value = t;
|
|
@@ -121,7 +121,7 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
121
121
|
i("update:modelValue", e.multiple ? [] : void 0), i("update:src", "");
|
|
122
122
|
m.value.splice(l, 1);
|
|
123
123
|
}
|
|
124
|
-
return
|
|
124
|
+
return h(() => m.value, async (t) => {
|
|
125
125
|
const l = await Promise.all(
|
|
126
126
|
t.map(async (a) => ({
|
|
127
127
|
src: e.toDataUrl ? await D(a) : await B(a),
|
|
@@ -132,43 +132,43 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
132
132
|
}))
|
|
133
133
|
);
|
|
134
134
|
n.value = l;
|
|
135
|
-
}, { deep: !0 }),
|
|
135
|
+
}, { deep: !0 }), h(() => n.value, async (t) => {
|
|
136
136
|
const l = e.multiple ? t : t[0];
|
|
137
137
|
i("update:modelValue", l), e.multiple || i("update:src", t[0] && t[0].src);
|
|
138
138
|
}, { deep: !0 }), (t, l) => (u(), d("div", {
|
|
139
139
|
ref_key: "root",
|
|
140
|
-
ref:
|
|
141
|
-
class:
|
|
140
|
+
ref: b,
|
|
141
|
+
class: V(["file-upload", {
|
|
142
142
|
"has-dragging": o.dropFiles,
|
|
143
143
|
"is-dragging": v(C)
|
|
144
144
|
}])
|
|
145
145
|
}, [
|
|
146
|
-
(u(!0), d(
|
|
146
|
+
(u(!0), d(S, null, P(A.value, (a, r) => (u(), d("div", {
|
|
147
147
|
key: a.src,
|
|
148
|
-
class:
|
|
148
|
+
class: V(o.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
|
|
149
149
|
}, [
|
|
150
|
-
|
|
150
|
+
g(t.$slots, "preview-item", {
|
|
151
151
|
bind: { item: a, index: r },
|
|
152
152
|
on: { removeFile: f }
|
|
153
153
|
}, () => [
|
|
154
|
-
o.enablePreview ? (u(), d(
|
|
154
|
+
o.enablePreview ? (u(), d(S, { key: 0 }, [
|
|
155
155
|
c("img", {
|
|
156
156
|
src: `${a.src}${o.previewWidth ? `?width=${o.previewWidth}` : ""}`,
|
|
157
157
|
class: "img-thumbnail rounded"
|
|
158
|
-
}, null, 8,
|
|
158
|
+
}, null, 8, j),
|
|
159
159
|
c("button", {
|
|
160
160
|
onClick: w((s) => f(r), ["prevent"]),
|
|
161
161
|
class: "btn btn--close"
|
|
162
162
|
}, [
|
|
163
163
|
p(k, { symbol: "x" })
|
|
164
|
-
], 8,
|
|
164
|
+
], 8, G)
|
|
165
165
|
], 64)) : (u(), d("button", {
|
|
166
166
|
key: 1,
|
|
167
167
|
onClick: w((s) => f(r), ["prevent"]),
|
|
168
168
|
class: "btn btn--close btn-outline-contrast"
|
|
169
169
|
}, [
|
|
170
170
|
p(k, { symbol: "x" })
|
|
171
|
-
], 8,
|
|
171
|
+
], 8, J))
|
|
172
172
|
])
|
|
173
173
|
], 2))), 128)),
|
|
174
174
|
p(q, {
|
|
@@ -181,30 +181,32 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
181
181
|
multiple: o.multiple,
|
|
182
182
|
class: "d-none"
|
|
183
183
|
}, null, 8, ["modelValue", "id", "name", "accept", "max-file-size", "multiple"]),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
p(T, { name: "fade" }, {
|
|
195
|
-
default: H(() => [
|
|
196
|
-
v($) ? (u(), d("span", K, [...l[1] || (l[1] = [
|
|
197
|
-
c("span", {
|
|
198
|
-
class: "spinner-border",
|
|
199
|
-
role: "status"
|
|
200
|
-
}, [
|
|
201
|
-
c("span", { class: "visually-hidden" }, "Loading...")
|
|
202
|
-
], -1)
|
|
203
|
-
])])) : W("", !0)
|
|
184
|
+
g(t.$slots, "label", {}, () => [
|
|
185
|
+
c("label", {
|
|
186
|
+
for: o.id,
|
|
187
|
+
class: "file-upload__label"
|
|
188
|
+
}, [
|
|
189
|
+
g(t.$slots, "button", {}, () => [
|
|
190
|
+
c("span", {
|
|
191
|
+
class: "btn btn-outline-contrast",
|
|
192
|
+
innerHTML: v(O)(o.label || t.$t("common.selectFile"))
|
|
193
|
+
}, null, 8, Q)
|
|
204
194
|
]),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
195
|
+
p(T, { name: "fade" }, {
|
|
196
|
+
default: H(() => [
|
|
197
|
+
v($) ? (u(), d("span", X, [...l[1] || (l[1] = [
|
|
198
|
+
c("span", {
|
|
199
|
+
class: "spinner-border",
|
|
200
|
+
role: "status"
|
|
201
|
+
}, [
|
|
202
|
+
c("span", { class: "visually-hidden" }, "Loading...")
|
|
203
|
+
], -1)
|
|
204
|
+
])])) : W("", !0)
|
|
205
|
+
]),
|
|
206
|
+
_: 1
|
|
207
|
+
})
|
|
208
|
+
], 8, K)
|
|
209
|
+
])
|
|
208
210
|
], 2));
|
|
209
211
|
}
|
|
210
212
|
});
|