ablok-components 0.0.31 → 0.0.34
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.es.js +282 -187
- package/dist/ablok-components.umd.js +1 -1
- package/dist/components/file-input.vue.d.ts +83 -50
- package/dist/components/media-upload.vue.d.ts +439 -0
- package/dist/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as b, openBlock as u, createElementBlock as s, normalizeClass as v, createElementVNode as i, renderSlot as m, computed as g, resolveComponent as $, createBlock as O, createCommentVNode as q, unref as p, toDisplayString as h, withDirectives as M, isRef as U, vModelDynamic as T, vModelText as A, ref as B, watch as S, onBeforeMount as N, Fragment as k, renderList as w, createTextVNode as C, withModifiers as z, reactive as D, createVNode as L } from "vue";
|
|
2
|
+
const R = {
|
|
3
3
|
class: "icon",
|
|
4
4
|
preserveAspectRatio: "xMaxYMin"
|
|
5
|
-
},
|
|
5
|
+
}, F = ["xlink:href"], Ve = /* @__PURE__ */ b({
|
|
6
6
|
__name: "svg-icon",
|
|
7
7
|
props: {
|
|
8
8
|
basePath: {
|
|
@@ -23,23 +23,23 @@ const D = {
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
setup(e) {
|
|
26
|
-
return (r,
|
|
26
|
+
return (r, t) => (u(), s("i", {
|
|
27
27
|
class: v(["svg-icon", {
|
|
28
28
|
[`svg-icon--${e.size}`]: e.size
|
|
29
29
|
}])
|
|
30
30
|
}, [
|
|
31
|
-
(u(), s("svg",
|
|
31
|
+
(u(), s("svg", R, [
|
|
32
32
|
i("use", {
|
|
33
33
|
"xlink:href": `${e.basePath}#${e.prefix}${e.symbol}`,
|
|
34
34
|
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
35
35
|
x: "0",
|
|
36
36
|
y: "0"
|
|
37
|
-
}, null, 8,
|
|
37
|
+
}, null, 8, F)
|
|
38
38
|
]))
|
|
39
39
|
], 2));
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
const
|
|
42
|
+
const P = { class: "loading-spinner d-block" }, H = { class: "loading-spinner__animation" }, E = {
|
|
43
43
|
class: "d-block",
|
|
44
44
|
version: "1.1",
|
|
45
45
|
id: "L9",
|
|
@@ -50,7 +50,7 @@ const F = { class: "loading-spinner d-block" }, H = { class: "loading-spinner__a
|
|
|
50
50
|
viewBox: "0 0 100 100",
|
|
51
51
|
"enable-background": "new 0 0 0 0",
|
|
52
52
|
"xml:space": "preserve"
|
|
53
|
-
},
|
|
53
|
+
}, j = ["fill"], G = /* @__PURE__ */ i("animateTransform", {
|
|
54
54
|
attributeName: "transform",
|
|
55
55
|
attributeType: "XML",
|
|
56
56
|
type: "rotate",
|
|
@@ -58,9 +58,9 @@ const F = { class: "loading-spinner d-block" }, H = { class: "loading-spinner__a
|
|
|
58
58
|
from: "0 50 50",
|
|
59
59
|
to: "360 50 50",
|
|
60
60
|
repeatCount: "indefinite"
|
|
61
|
-
}, null, -1),
|
|
62
|
-
|
|
63
|
-
],
|
|
61
|
+
}, null, -1), J = [
|
|
62
|
+
G
|
|
63
|
+
], xe = /* @__PURE__ */ b({
|
|
64
64
|
__name: "loading-spinner",
|
|
65
65
|
props: {
|
|
66
66
|
color: {
|
|
@@ -69,20 +69,20 @@ const F = { class: "loading-spinner d-block" }, H = { class: "loading-spinner__a
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
setup(e) {
|
|
72
|
-
return (r,
|
|
72
|
+
return (r, t) => (u(), s("span", P, [
|
|
73
73
|
i("span", H, [
|
|
74
|
-
(u(), s("svg",
|
|
74
|
+
(u(), s("svg", E, [
|
|
75
75
|
i("path", {
|
|
76
76
|
fill: e.color,
|
|
77
77
|
d: "M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
|
|
78
|
-
},
|
|
78
|
+
}, J, 8, j)
|
|
79
79
|
]))
|
|
80
80
|
]),
|
|
81
|
-
|
|
81
|
+
m(r.$slots, "default")
|
|
82
82
|
]));
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
const
|
|
85
|
+
const X = ["type", "disabled", "href", "to"], Be = /* @__PURE__ */ b({
|
|
86
86
|
__name: "base-button",
|
|
87
87
|
props: {
|
|
88
88
|
type: null,
|
|
@@ -99,9 +99,9 @@ const J = ["type", "disabled", "href", "to"], ge = /* @__PURE__ */ g({
|
|
|
99
99
|
fab: { type: Boolean }
|
|
100
100
|
},
|
|
101
101
|
setup(e) {
|
|
102
|
-
const r = e,
|
|
103
|
-
return (a,
|
|
104
|
-
const
|
|
102
|
+
const r = e, t = g(() => r.caption && !r.fab);
|
|
103
|
+
return (a, n) => {
|
|
104
|
+
const d = $("svg-icon");
|
|
105
105
|
return u(), s("button", {
|
|
106
106
|
type: e.type,
|
|
107
107
|
disabled: e.disabled,
|
|
@@ -119,28 +119,28 @@ const J = ["type", "disabled", "href", "to"], ge = /* @__PURE__ */ g({
|
|
|
119
119
|
"x-small": e.size === "x-small"
|
|
120
120
|
}])
|
|
121
121
|
}, [
|
|
122
|
-
|
|
123
|
-
e.icon ? (u(),
|
|
122
|
+
m(a.$slots, "default", {}, () => [
|
|
123
|
+
e.icon ? (u(), O(d, {
|
|
124
124
|
key: 0,
|
|
125
125
|
id: e.icon,
|
|
126
126
|
class: "base-button__caption"
|
|
127
|
-
}, null, 8, ["id"])) :
|
|
128
|
-
|
|
127
|
+
}, null, 8, ["id"])) : q("", !0),
|
|
128
|
+
p(t) ? (u(), s("span", {
|
|
129
129
|
key: 1,
|
|
130
130
|
class: v(["base-button__caption", { "icon-padding": e.icon }])
|
|
131
|
-
}, h(e.caption), 3)) :
|
|
131
|
+
}, h(e.caption), 3)) : q("", !0)
|
|
132
132
|
])
|
|
133
|
-
], 10,
|
|
133
|
+
], 10, X);
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
-
function
|
|
137
|
+
function y() {
|
|
138
138
|
return (new Date().valueOf() + Math.random()).toString(36);
|
|
139
139
|
}
|
|
140
|
-
const
|
|
140
|
+
const Y = { class: "input-group form-input__input-group" }, K = ["type", "id", "name", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"], Q = {
|
|
141
141
|
key: 0,
|
|
142
142
|
class: "form-input__color-swatch"
|
|
143
|
-
},
|
|
143
|
+
}, W = ["name", "id", "disabled", "read-only", "required", "aria-label"], Z = ["for", "innerHTML"], ke = /* @__PURE__ */ b({
|
|
144
144
|
__name: "form-input",
|
|
145
145
|
props: {
|
|
146
146
|
modelValue: {
|
|
@@ -153,11 +153,11 @@ const j = { class: "input-group form-input__input-group" }, X = ["type", "id", "
|
|
|
153
153
|
},
|
|
154
154
|
name: {
|
|
155
155
|
type: String,
|
|
156
|
-
default: () =>
|
|
156
|
+
default: () => y()
|
|
157
157
|
},
|
|
158
158
|
id: {
|
|
159
159
|
type: String,
|
|
160
|
-
default: () =>
|
|
160
|
+
default: () => y()
|
|
161
161
|
},
|
|
162
162
|
label: {
|
|
163
163
|
type: String,
|
|
@@ -197,21 +197,21 @@ const j = { class: "input-group form-input__input-group" }, X = ["type", "id", "
|
|
|
197
197
|
},
|
|
198
198
|
emits: ["update:modelValue"],
|
|
199
199
|
setup(e, { emit: r }) {
|
|
200
|
-
const
|
|
200
|
+
const t = e, a = g({
|
|
201
201
|
get() {
|
|
202
|
-
return
|
|
202
|
+
return t.modelValue;
|
|
203
203
|
},
|
|
204
|
-
set(
|
|
205
|
-
r("update:modelValue",
|
|
204
|
+
set(n) {
|
|
205
|
+
r("update:modelValue", n);
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
|
-
return (
|
|
208
|
+
return (n, d) => (u(), s("div", {
|
|
209
209
|
class: v(["form-input", `form-input--${e.type}`])
|
|
210
210
|
}, [
|
|
211
|
-
i("div",
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
"onUpdate:modelValue":
|
|
211
|
+
i("div", Y, [
|
|
212
|
+
m(n.$slots, "input-prepend"),
|
|
213
|
+
M(i("input", {
|
|
214
|
+
"onUpdate:modelValue": d[0] || (d[0] = (l) => U(a) ? a.value = l : null),
|
|
215
215
|
type: e.type === "color" ? "text" : e.type,
|
|
216
216
|
id: e.id,
|
|
217
217
|
name: e.name,
|
|
@@ -224,13 +224,13 @@ const j = { class: "input-group form-input__input-group" }, X = ["type", "id", "
|
|
|
224
224
|
checked: e.checked,
|
|
225
225
|
class: "form-control",
|
|
226
226
|
"aria-label": e.label
|
|
227
|
-
}, null, 8,
|
|
228
|
-
[
|
|
227
|
+
}, null, 8, K), [
|
|
228
|
+
[T, p(a)]
|
|
229
229
|
]),
|
|
230
|
-
|
|
231
|
-
e.type === "color" ? (u(), s("span",
|
|
232
|
-
|
|
233
|
-
"onUpdate:modelValue":
|
|
230
|
+
m(n.$slots, "input-append", {}, () => [
|
|
231
|
+
e.type === "color" ? (u(), s("span", Q, [
|
|
232
|
+
M(i("input", {
|
|
233
|
+
"onUpdate:modelValue": d[1] || (d[1] = (l) => U(a) ? a.value = l : null),
|
|
234
234
|
type: "color",
|
|
235
235
|
name: `${e.name}-color`,
|
|
236
236
|
id: `${e.id}-color`,
|
|
@@ -239,23 +239,23 @@ const j = { class: "input-group form-input__input-group" }, X = ["type", "id", "
|
|
|
239
239
|
required: e.required,
|
|
240
240
|
class: "form-control",
|
|
241
241
|
"aria-label": e.label
|
|
242
|
-
}, null, 8,
|
|
243
|
-
[
|
|
242
|
+
}, null, 8, W), [
|
|
243
|
+
[A, p(a)]
|
|
244
244
|
])
|
|
245
|
-
])) :
|
|
245
|
+
])) : q("", !0)
|
|
246
246
|
])
|
|
247
247
|
]),
|
|
248
|
-
|
|
248
|
+
m(n.$slots, "label", {}, () => [
|
|
249
249
|
i("label", {
|
|
250
250
|
for: e.id,
|
|
251
251
|
class: "form-input__label",
|
|
252
252
|
innerHTML: `${e.label}${e.required ? " *" : ""}`
|
|
253
|
-
}, null, 8,
|
|
253
|
+
}, null, 8, Z)
|
|
254
254
|
])
|
|
255
255
|
], 2));
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
const
|
|
258
|
+
const _ = { class: "radio-group" }, ee = ["for"], we = /* @__PURE__ */ b({
|
|
259
259
|
__name: "check-group",
|
|
260
260
|
props: {
|
|
261
261
|
modelValue: {
|
|
@@ -267,11 +267,11 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
267
267
|
},
|
|
268
268
|
name: {
|
|
269
269
|
type: String,
|
|
270
|
-
default: () =>
|
|
270
|
+
default: () => y()
|
|
271
271
|
},
|
|
272
272
|
id: {
|
|
273
273
|
type: String,
|
|
274
|
-
default: () =>
|
|
274
|
+
default: () => y()
|
|
275
275
|
},
|
|
276
276
|
label: {
|
|
277
277
|
type: String,
|
|
@@ -296,25 +296,25 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
296
296
|
},
|
|
297
297
|
emits: ["change", "update:modelValue"],
|
|
298
298
|
setup(e, { emit: r }) {
|
|
299
|
-
const
|
|
300
|
-
return
|
|
301
|
-
a.value =
|
|
302
|
-
(
|
|
299
|
+
const t = e, a = B([]);
|
|
300
|
+
return S(() => t.modelValue, (n, d) => {
|
|
301
|
+
a.value = t.options.map(
|
|
302
|
+
(l) => l.value ? t.modelValue.some((o) => o["value "] === l.value) : t.modelValue.some((o) => o === l)
|
|
303
303
|
);
|
|
304
|
-
}, { immediate: !0 }),
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
return [...o, ...
|
|
304
|
+
}, { immediate: !0 }), S(a, (n, d) => {
|
|
305
|
+
const l = n.reduce((o, c, f) => {
|
|
306
|
+
const V = c && t.options[f] ? [t.options[f] || t.options[f]] : [];
|
|
307
|
+
return [...o, ...V];
|
|
308
308
|
}, []);
|
|
309
|
-
r("update:modelValue",
|
|
310
|
-
}, { deep: !0 }),
|
|
311
|
-
}), (
|
|
312
|
-
const
|
|
313
|
-
return u(), s("div",
|
|
314
|
-
(u(!0), s(
|
|
309
|
+
r("update:modelValue", l);
|
|
310
|
+
}, { deep: !0 }), N(() => {
|
|
311
|
+
}), (n, d) => {
|
|
312
|
+
const l = $("form-input");
|
|
313
|
+
return u(), s("div", _, [
|
|
314
|
+
(u(!0), s(k, null, w(e.options, (o, c) => (u(), O(l, {
|
|
315
315
|
key: c,
|
|
316
|
-
modelValue:
|
|
317
|
-
"onUpdate:modelValue": (
|
|
316
|
+
modelValue: p(a)[c],
|
|
317
|
+
"onUpdate:modelValue": (f) => p(a)[c] = f,
|
|
318
318
|
type: "checkbox",
|
|
319
319
|
name: e.name,
|
|
320
320
|
id: `${e.id}-${c}`,
|
|
@@ -324,14 +324,14 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
324
324
|
required: e.required
|
|
325
325
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "name", "id", "label", "disabled", "read-only", "required"]))), 128)),
|
|
326
326
|
i("label", { for: e.id }, [
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
m(n.$slots, "label", {}, () => [
|
|
328
|
+
C(h(e.label), 1)
|
|
329
329
|
])
|
|
330
|
-
], 8,
|
|
330
|
+
], 8, ee)
|
|
331
331
|
]);
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
}),
|
|
334
|
+
}), te = { class: "radio-group" }, le = ["for"], qe = /* @__PURE__ */ b({
|
|
335
335
|
__name: "radio-group",
|
|
336
336
|
props: {
|
|
337
337
|
modelValue: {
|
|
@@ -343,11 +343,11 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
343
343
|
},
|
|
344
344
|
name: {
|
|
345
345
|
type: String,
|
|
346
|
-
default: () =>
|
|
346
|
+
default: () => y()
|
|
347
347
|
},
|
|
348
348
|
id: {
|
|
349
349
|
type: String,
|
|
350
|
-
default: () =>
|
|
350
|
+
default: () => y()
|
|
351
351
|
},
|
|
352
352
|
label: {
|
|
353
353
|
type: String,
|
|
@@ -372,16 +372,16 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
372
372
|
},
|
|
373
373
|
emits: ["change", "update:modelValue"],
|
|
374
374
|
setup(e, { emit: r }) {
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
function a(
|
|
378
|
-
r("update:modelValue",
|
|
375
|
+
const t = e;
|
|
376
|
+
B(t.options.map((n) => n.value === t.modelValue));
|
|
377
|
+
function a(n) {
|
|
378
|
+
r("update:modelValue", n);
|
|
379
379
|
}
|
|
380
|
-
return
|
|
381
|
-
}), (
|
|
382
|
-
const
|
|
383
|
-
return u(), s("div",
|
|
384
|
-
(u(!0), s(
|
|
380
|
+
return N(() => {
|
|
381
|
+
}), (n, d) => {
|
|
382
|
+
const l = $("form-input");
|
|
383
|
+
return u(), s("div", te, [
|
|
384
|
+
(u(!0), s(k, null, w(e.options, (o, c) => (u(), O(l, {
|
|
385
385
|
key: c,
|
|
386
386
|
type: "radio",
|
|
387
387
|
name: e.name,
|
|
@@ -392,20 +392,20 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
392
392
|
disabled: e.disabled,
|
|
393
393
|
"read-only": e.readOnly,
|
|
394
394
|
required: e.required,
|
|
395
|
-
onChange: (
|
|
395
|
+
onChange: (f) => a(o)
|
|
396
396
|
}, null, 8, ["name", "id", "value", "label", "checked", "disabled", "read-only", "required", "onChange"]))), 128)),
|
|
397
397
|
i("label", { for: e.id }, [
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
m(n.$slots, "label", {}, () => [
|
|
399
|
+
C(h(e.label), 1)
|
|
400
400
|
])
|
|
401
|
-
], 8,
|
|
401
|
+
], 8, le)
|
|
402
402
|
]);
|
|
403
403
|
};
|
|
404
404
|
}
|
|
405
|
-
}),
|
|
405
|
+
}), ae = { class: "input input-dropdown" }, ne = { class: "dropdown" }, de = {
|
|
406
406
|
class: "btn-group",
|
|
407
407
|
role: "group"
|
|
408
|
-
},
|
|
408
|
+
}, oe = ["id", "disabled"], ie = ["aria-labelledby"], ue = ["onClick"], re = ["for"], Oe = /* @__PURE__ */ b({
|
|
409
409
|
__name: "input-dropdown",
|
|
410
410
|
props: {
|
|
411
411
|
modelValue: {
|
|
@@ -414,11 +414,11 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
414
414
|
},
|
|
415
415
|
name: {
|
|
416
416
|
type: String,
|
|
417
|
-
default: () =>
|
|
417
|
+
default: () => y()
|
|
418
418
|
},
|
|
419
419
|
id: {
|
|
420
420
|
type: String,
|
|
421
|
-
default: () =>
|
|
421
|
+
default: () => y()
|
|
422
422
|
},
|
|
423
423
|
label: {
|
|
424
424
|
type: String,
|
|
@@ -463,29 +463,29 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
463
463
|
},
|
|
464
464
|
emits: ["update:modelValue"],
|
|
465
465
|
setup(e, { emit: r }) {
|
|
466
|
-
const
|
|
467
|
-
|
|
466
|
+
const t = e;
|
|
467
|
+
g({
|
|
468
468
|
get() {
|
|
469
|
-
return
|
|
469
|
+
return t.modelValue;
|
|
470
470
|
},
|
|
471
|
-
set(
|
|
472
|
-
r("update:modelValue",
|
|
471
|
+
set(l) {
|
|
472
|
+
r("update:modelValue", l);
|
|
473
473
|
}
|
|
474
474
|
});
|
|
475
|
-
function a(
|
|
476
|
-
r("update:modelValue",
|
|
475
|
+
function a(l) {
|
|
476
|
+
r("update:modelValue", l);
|
|
477
477
|
}
|
|
478
|
-
const
|
|
478
|
+
const n = g(() => [
|
|
479
479
|
{
|
|
480
480
|
text: "Please select"
|
|
481
481
|
},
|
|
482
|
-
...
|
|
483
|
-
(
|
|
482
|
+
...t.options.map(
|
|
483
|
+
(l) => typeof l == "string" ? { value: l, text: l } : l
|
|
484
484
|
)
|
|
485
|
-
]),
|
|
486
|
-
return (
|
|
487
|
-
i("div",
|
|
488
|
-
i("div",
|
|
485
|
+
]), d = g(() => [...t.options].find((l) => JSON.stringify(l.value) === JSON.stringify(t.modelValue)));
|
|
486
|
+
return (l, o) => (u(), s("div", ae, [
|
|
487
|
+
i("div", ne, [
|
|
488
|
+
i("div", de, [
|
|
489
489
|
i("button", {
|
|
490
490
|
class: v(["btn dropdown-toggle", {
|
|
491
491
|
[`btn-${e.variant}`]: e.variant,
|
|
@@ -498,47 +498,43 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
498
498
|
"data-bs-toggle": "dropdown",
|
|
499
499
|
"aria-expanded": "false",
|
|
500
500
|
disabled: e.disabled
|
|
501
|
-
}, h(
|
|
501
|
+
}, h(p(d) ? p(d).text : e.placeholder), 11, oe),
|
|
502
502
|
i("ul", {
|
|
503
503
|
class: "dropdown-menu",
|
|
504
504
|
"aria-labelledby": e.id
|
|
505
505
|
}, [
|
|
506
|
-
(u(!0), s(
|
|
507
|
-
|
|
506
|
+
(u(!0), s(k, null, w(p(n), (c, f) => (u(), s("li", { key: f }, [
|
|
507
|
+
m(l.$slots, "option", {}, () => [
|
|
508
508
|
i("a", {
|
|
509
509
|
class: "dropdown-item",
|
|
510
|
-
onClick:
|
|
511
|
-
}, h(c.text), 9,
|
|
510
|
+
onClick: z((V) => a(c.value), ["prevent"])
|
|
511
|
+
}, h(c.text), 9, ue)
|
|
512
512
|
])
|
|
513
513
|
]))), 128))
|
|
514
|
-
], 8,
|
|
514
|
+
], 8, ie)
|
|
515
515
|
])
|
|
516
516
|
]),
|
|
517
517
|
i("label", { for: e.id }, [
|
|
518
|
-
|
|
519
|
-
|
|
518
|
+
m(l.$slots, "label", {}, () => [
|
|
519
|
+
C(h(e.label), 1)
|
|
520
520
|
])
|
|
521
|
-
], 8,
|
|
521
|
+
], 8, re)
|
|
522
522
|
]));
|
|
523
523
|
}
|
|
524
|
-
}),
|
|
524
|
+
}), se = ["id", "name", "multiple", "accept"], ce = { class: "form-input__input-group input-group" }, fe = ["value", "id", "name"], me = ["for"], ye = ["for", "innerHTML"], Ce = /* @__PURE__ */ b({
|
|
525
525
|
__name: "file-input",
|
|
526
526
|
props: {
|
|
527
527
|
modelValue: {
|
|
528
|
-
type:
|
|
529
|
-
default:
|
|
530
|
-
},
|
|
531
|
-
type: {
|
|
532
|
-
type: String,
|
|
533
|
-
default: "text"
|
|
528
|
+
type: Array,
|
|
529
|
+
default: []
|
|
534
530
|
},
|
|
535
531
|
name: {
|
|
536
532
|
type: String,
|
|
537
|
-
default: () =>
|
|
533
|
+
default: () => y()
|
|
538
534
|
},
|
|
539
535
|
id: {
|
|
540
536
|
type: String,
|
|
541
|
-
default: () =>
|
|
537
|
+
default: () => y()
|
|
542
538
|
},
|
|
543
539
|
label: {
|
|
544
540
|
type: String,
|
|
@@ -564,88 +560,187 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
|
|
|
564
560
|
type: Boolean,
|
|
565
561
|
default: !1
|
|
566
562
|
},
|
|
567
|
-
maxlength: {
|
|
568
|
-
type: Number
|
|
569
|
-
},
|
|
570
563
|
pattern: {
|
|
571
564
|
type: String,
|
|
572
565
|
default: null
|
|
573
566
|
},
|
|
574
|
-
|
|
567
|
+
multiple: {
|
|
575
568
|
type: Boolean,
|
|
576
569
|
default: !1
|
|
570
|
+
},
|
|
571
|
+
accept: {
|
|
572
|
+
type: String
|
|
577
573
|
}
|
|
578
574
|
},
|
|
579
575
|
emits: ["update:modelValue"],
|
|
580
576
|
setup(e, { emit: r }) {
|
|
581
|
-
function
|
|
582
|
-
const
|
|
583
|
-
|
|
577
|
+
function t(d) {
|
|
578
|
+
const l = d.target && d.target.files;
|
|
579
|
+
l && (a.splice(0, a.length), Array.from(l).forEach((o) => {
|
|
584
580
|
a.push(o);
|
|
585
581
|
}));
|
|
586
582
|
}
|
|
587
|
-
const a =
|
|
588
|
-
return
|
|
589
|
-
|
|
590
|
-
}, { deep: !0 }), (
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
disabled: e.disabled,
|
|
613
|
-
"read-only": e.readOnly,
|
|
614
|
-
required: e.required,
|
|
615
|
-
maxlength: e.maxlength,
|
|
616
|
-
checked: e.checked,
|
|
617
|
-
class: "form-control",
|
|
618
|
-
"aria-label": e.label
|
|
619
|
-
}, null, 8, se), [
|
|
620
|
-
[C, y(d)]
|
|
621
|
-
]),
|
|
622
|
-
f(l.$slots, "input-append", {}, () => [
|
|
623
|
-
i("label", {
|
|
624
|
-
for: e.id,
|
|
625
|
-
class: "input-group-text"
|
|
626
|
-
}, [
|
|
627
|
-
A(o, { symbol: "upload" })
|
|
628
|
-
], 8, ce)
|
|
629
|
-
])
|
|
630
|
-
]),
|
|
631
|
-
f(l.$slots, "label", {}, () => [
|
|
583
|
+
const a = D([]), n = g(() => a && a.map((d) => d.name));
|
|
584
|
+
return g(() => a.map((d) => URL.createObjectURL(d))), S(() => a, (d, l) => {
|
|
585
|
+
console.log("file input", d), r("update:modelValue", d);
|
|
586
|
+
}, { deep: !0 }), (d, l) => (u(), s("div", {
|
|
587
|
+
class: v(["form-input file-input", "file-input--primary"])
|
|
588
|
+
}, [
|
|
589
|
+
i("input", {
|
|
590
|
+
type: "file",
|
|
591
|
+
id: e.id,
|
|
592
|
+
name: e.name,
|
|
593
|
+
class: "d-none",
|
|
594
|
+
onChange: t,
|
|
595
|
+
multiple: e.multiple,
|
|
596
|
+
accept: e.accept
|
|
597
|
+
}, null, 40, se),
|
|
598
|
+
i("div", ce, [
|
|
599
|
+
m(d.$slots, "input-prepend"),
|
|
600
|
+
i("input", {
|
|
601
|
+
type: "text",
|
|
602
|
+
value: p(n),
|
|
603
|
+
id: e.id,
|
|
604
|
+
name: e.name,
|
|
605
|
+
class: "form-control"
|
|
606
|
+
}, null, 8, fe),
|
|
607
|
+
m(d.$slots, "input-append", {}, () => [
|
|
632
608
|
i("label", {
|
|
633
609
|
for: e.id,
|
|
634
|
-
class: "
|
|
635
|
-
|
|
636
|
-
}, null, 8, fe)
|
|
610
|
+
class: "btn btn-outline-dark"
|
|
611
|
+
}, " Select Image ", 8, me)
|
|
637
612
|
])
|
|
613
|
+
]),
|
|
614
|
+
m(d.$slots, "label", {}, () => [
|
|
615
|
+
i("label", {
|
|
616
|
+
for: e.id,
|
|
617
|
+
class: "form-input__label",
|
|
618
|
+
innerHTML: `${e.label}${e.required ? " *" : ""}`
|
|
619
|
+
}, null, 8, ye)
|
|
620
|
+
])
|
|
621
|
+
]));
|
|
622
|
+
}
|
|
623
|
+
}), pe = { class: "media-upload" }, be = ["src"], ge = ["onClick"], he = ["for"];
|
|
624
|
+
async function ve(e) {
|
|
625
|
+
return await new Promise((r) => {
|
|
626
|
+
let t = new FileReader();
|
|
627
|
+
t.onload = () => r(t.result), t.readAsDataURL(e);
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
const Me = /* @__PURE__ */ b({
|
|
631
|
+
__name: "media-upload",
|
|
632
|
+
props: {
|
|
633
|
+
modelValue: {
|
|
634
|
+
type: Array,
|
|
635
|
+
default: []
|
|
636
|
+
},
|
|
637
|
+
src: {
|
|
638
|
+
type: String
|
|
639
|
+
},
|
|
640
|
+
name: {
|
|
641
|
+
type: String,
|
|
642
|
+
default: () => y()
|
|
643
|
+
},
|
|
644
|
+
id: {
|
|
645
|
+
type: String,
|
|
646
|
+
default: () => y()
|
|
647
|
+
},
|
|
648
|
+
label: {
|
|
649
|
+
type: String,
|
|
650
|
+
default: ""
|
|
651
|
+
},
|
|
652
|
+
placeholder: {
|
|
653
|
+
type: String,
|
|
654
|
+
default: ""
|
|
655
|
+
},
|
|
656
|
+
variant: {
|
|
657
|
+
type: String,
|
|
658
|
+
default: ""
|
|
659
|
+
},
|
|
660
|
+
disabled: {
|
|
661
|
+
type: Boolean,
|
|
662
|
+
default: !1
|
|
663
|
+
},
|
|
664
|
+
readOnly: {
|
|
665
|
+
type: Boolean,
|
|
666
|
+
default: !1
|
|
667
|
+
},
|
|
668
|
+
required: {
|
|
669
|
+
type: Boolean,
|
|
670
|
+
default: !1
|
|
671
|
+
},
|
|
672
|
+
pattern: {
|
|
673
|
+
type: String,
|
|
674
|
+
default: null
|
|
675
|
+
},
|
|
676
|
+
multiple: {
|
|
677
|
+
type: Boolean,
|
|
678
|
+
default: !1
|
|
679
|
+
},
|
|
680
|
+
accept: {
|
|
681
|
+
type: String,
|
|
682
|
+
default: "image/*"
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
emits: ["update:modelValue", "update:src"],
|
|
686
|
+
setup(e, { emit: r }) {
|
|
687
|
+
const t = e, a = B([]), n = B([]), d = g(() => t.modelValue.length ? t.modelValue : t.src ? [{ type: "", src: t.src }] : n.value);
|
|
688
|
+
S(() => a, async (o, c) => {
|
|
689
|
+
n.value = await Promise.all(
|
|
690
|
+
o.value.map(async (f) => ({
|
|
691
|
+
src: await ve(f),
|
|
692
|
+
type: f.type
|
|
693
|
+
}))
|
|
694
|
+
);
|
|
695
|
+
}, { deep: !0 }), S(() => n, async (o, c) => {
|
|
696
|
+
const f = t.multiple ? n.value : [n.value[0]];
|
|
697
|
+
r("update:modelValue", f), t.multiple || r("update:src", n.value[0] && n.value[0].src);
|
|
698
|
+
}, { deep: !0 });
|
|
699
|
+
function l(o) {
|
|
700
|
+
a.value.splice(o, 1);
|
|
701
|
+
}
|
|
702
|
+
return (o, c) => {
|
|
703
|
+
const f = $("svg-icon"), V = $("file-input");
|
|
704
|
+
return u(), s("div", pe, [
|
|
705
|
+
(u(!0), s(k, null, w(p(d), (x, I) => (u(), s("div", {
|
|
706
|
+
key: x.src,
|
|
707
|
+
class: "media-upload__thumbnail"
|
|
708
|
+
}, [
|
|
709
|
+
i("img", {
|
|
710
|
+
src: x.src,
|
|
711
|
+
class: "img-thumbnail rounded"
|
|
712
|
+
}, null, 8, be),
|
|
713
|
+
i("button", {
|
|
714
|
+
onClick: z(($e) => l(I), ["prevent"]),
|
|
715
|
+
class: "btn btn--close"
|
|
716
|
+
}, [
|
|
717
|
+
L(f, { symbol: "x" })
|
|
718
|
+
], 8, ge)
|
|
719
|
+
]))), 128)),
|
|
720
|
+
L(V, {
|
|
721
|
+
modelValue: a.value,
|
|
722
|
+
"onUpdate:modelValue": c[0] || (c[0] = (x) => a.value = x),
|
|
723
|
+
id: e.id,
|
|
724
|
+
name: e.name,
|
|
725
|
+
accept: e.accept,
|
|
726
|
+
class: "d-none"
|
|
727
|
+
}, null, 8, ["modelValue", "id", "name", "accept"]),
|
|
728
|
+
i("label", {
|
|
729
|
+
for: e.id,
|
|
730
|
+
class: "btn btn-outline-dark"
|
|
731
|
+
}, " Select Image ", 8, he)
|
|
638
732
|
]);
|
|
639
733
|
};
|
|
640
734
|
}
|
|
641
735
|
});
|
|
642
736
|
export {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
737
|
+
Be as BaseButton,
|
|
738
|
+
we as CheckGroup,
|
|
739
|
+
Ce as FileInput,
|
|
740
|
+
ke as FormInput,
|
|
741
|
+
Oe as InputDropdown,
|
|
742
|
+
xe as LoadingSpinner,
|
|
743
|
+
Me as MediaUpload,
|
|
744
|
+
qe as RadioGroup,
|
|
745
|
+
Ve as SvgIcon
|
|
651
746
|
};
|