ablok-components 0.3.83 → 0.3.84
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,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as w, computed as T, ref as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as w, computed as T, ref as v, resolveComponent as y, openBlock as p, createElementBlock as _, createElementVNode as o, toDisplayString as x, createCommentVNode as U, createVNode as d, withCtx as g, withDirectives as H, vModelText as I, withModifiers as V, nextTick as L } from "vue";
|
|
2
|
+
import N from "../file-upload/file-upload.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
const
|
|
4
|
+
const S = { class: "container" }, A = { class: "row" }, B = { class: "col-12" }, E = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "grid place-items-center text-center text-muted py-5 border border-bottom-0"
|
|
7
|
-
},
|
|
7
|
+
}, z = { class: "m-0" }, D = { class: "preview-item border-bottom p-3" }, F = { class: "d-flex gap-3" }, j = { class: "col-2" }, q = { class: "col" }, R = ["onUpdate:modelValue", "id"], G = ["innerHTML"], J = { class: "col-auto d-flex flex-column gap-2" }, K = ["onClick"], O = ["onClick"], P = { class: "d-flex align-items-end p-3" }, Q = { class: "btn btn-primary btn-sm ms-auto d-flex align-items-center gap-2" }, W = ["innerHTML"], ee = /* @__PURE__ */ w({
|
|
8
8
|
__name: "bulk-upload",
|
|
9
9
|
props: {
|
|
10
10
|
storeId: String,
|
|
@@ -25,99 +25,108 @@ const A = { class: "container" }, B = { class: "row" }, E = { class: "col-12" },
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
emits: ["update:modelValue"],
|
|
28
|
-
setup(
|
|
29
|
-
const
|
|
28
|
+
setup(k, { emit: M }) {
|
|
29
|
+
const f = k, b = M, n = T({
|
|
30
30
|
get: () => {
|
|
31
|
-
const e =
|
|
32
|
-
return
|
|
31
|
+
const e = f.modelValue || [];
|
|
32
|
+
return c.value = e.map((t) => t.caption || ""), e.map((t) => ({ type: t.type, src: t.src }));
|
|
33
33
|
},
|
|
34
34
|
set: (e) => {
|
|
35
|
-
const t =
|
|
36
|
-
|
|
35
|
+
const t = n.value || [], s = Array.isArray(e) ? e : [], i = s.length <= t.length && s.every((r) => t.some((l) => l.src === r.src));
|
|
36
|
+
u(i ? s : [...t, ...s]);
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
}), h = v(null), a = v({}), c = v({});
|
|
39
|
+
function C(e) {
|
|
40
|
+
const t = [...f.modelValue || []];
|
|
41
|
+
t.splice(e, 1), b("update:modelValue", t);
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
43
|
+
async function $(e) {
|
|
44
|
+
a.value[e] = !a.value[e], a.value[e] || u(), await L(), h.value?.querySelector(`#caption-${e}`)?.focus();
|
|
45
|
+
}
|
|
46
|
+
function u(e) {
|
|
47
|
+
b("update:modelValue", (e || n.value).map((t, s) => ({
|
|
44
48
|
...t,
|
|
45
|
-
caption:
|
|
49
|
+
caption: c.value[s] || ""
|
|
46
50
|
})));
|
|
47
51
|
}
|
|
48
52
|
return (e, t) => {
|
|
49
|
-
const
|
|
50
|
-
return
|
|
53
|
+
const s = y("base-image"), i = y("svg-icon");
|
|
54
|
+
return p(), _("div", {
|
|
51
55
|
class: "bulk-upload",
|
|
52
56
|
ref_key: "root",
|
|
53
|
-
ref:
|
|
57
|
+
ref: h
|
|
54
58
|
}, [
|
|
55
|
-
o("div",
|
|
56
|
-
o("div",
|
|
57
|
-
o("div",
|
|
58
|
-
|
|
59
|
-
o("p",
|
|
59
|
+
o("div", S, [
|
|
60
|
+
o("div", A, [
|
|
61
|
+
o("div", B, [
|
|
62
|
+
n.value.length ? U("", !0) : (p(), _("div", E, [
|
|
63
|
+
o("p", z, x(e.$t("fileInput.noFilesSelected")), 1)
|
|
60
64
|
])),
|
|
61
|
-
|
|
62
|
-
modelValue:
|
|
63
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
65
|
+
d(N, {
|
|
66
|
+
modelValue: n.value,
|
|
67
|
+
"onUpdate:modelValue": t[1] || (t[1] = (r) => n.value = r),
|
|
64
68
|
multiple: !0,
|
|
65
69
|
accept: "image/*",
|
|
66
70
|
"drop-files": !0,
|
|
67
71
|
"to-data-url": !0,
|
|
68
72
|
"local-url-format": "objectUrl",
|
|
69
|
-
class: "d-flex flex-column
|
|
73
|
+
class: "d-flex flex-column border"
|
|
70
74
|
}, {
|
|
71
|
-
"preview-item":
|
|
72
|
-
o("div",
|
|
73
|
-
o("div",
|
|
74
|
-
o("div",
|
|
75
|
-
|
|
76
|
-
src:
|
|
75
|
+
"preview-item": g(({ bind: { item: r, index: l } }) => [
|
|
76
|
+
o("div", D, [
|
|
77
|
+
o("div", F, [
|
|
78
|
+
o("div", j, [
|
|
79
|
+
d(s, {
|
|
80
|
+
src: r.src,
|
|
77
81
|
alt: "",
|
|
78
82
|
class: "img-thumbnail"
|
|
79
83
|
}, null, 8, ["src"])
|
|
80
84
|
]),
|
|
81
|
-
o("div",
|
|
82
|
-
|
|
85
|
+
o("div", q, [
|
|
86
|
+
a.value[l] ? H((p(), _("textarea", {
|
|
83
87
|
key: 0,
|
|
84
|
-
"onUpdate:modelValue": (
|
|
88
|
+
"onUpdate:modelValue": (m) => c.value[l] = m,
|
|
85
89
|
id: `caption-${l}`,
|
|
86
90
|
class: "form-control rounded-0 h-100",
|
|
87
|
-
onChangeCapture: t[0] || (t[0] = (
|
|
88
|
-
}, null, 40,
|
|
89
|
-
[
|
|
90
|
-
]) : (
|
|
91
|
+
onChangeCapture: t[0] || (t[0] = (m) => u())
|
|
92
|
+
}, null, 40, R)), [
|
|
93
|
+
[I, c.value[l]]
|
|
94
|
+
]) : (p(), _("p", {
|
|
91
95
|
key: 1,
|
|
92
96
|
class: "m-0",
|
|
93
|
-
innerHTML:
|
|
94
|
-
}, null, 8,
|
|
97
|
+
innerHTML: c.value[l] || `<small>${e.$t("fileInput.noCaption")}</small>`
|
|
98
|
+
}, null, 8, G))
|
|
95
99
|
]),
|
|
96
|
-
o("div",
|
|
100
|
+
o("div", J, [
|
|
97
101
|
o("button", {
|
|
98
|
-
onClick:
|
|
102
|
+
onClick: V((m) => C(l), ["prevent"]),
|
|
99
103
|
class: "btn btn--close"
|
|
100
104
|
}, [
|
|
101
|
-
|
|
102
|
-
], 8,
|
|
105
|
+
d(i, { symbol: "x" })
|
|
106
|
+
], 8, K),
|
|
103
107
|
o("button", {
|
|
104
|
-
onClick:
|
|
108
|
+
onClick: V((m) => $(l), ["prevent"]),
|
|
105
109
|
class: "btn btn--close"
|
|
106
110
|
}, [
|
|
107
|
-
|
|
108
|
-
symbol:
|
|
111
|
+
d(i, {
|
|
112
|
+
symbol: a.value[l] ? "check" : "edit-3"
|
|
109
113
|
}, null, 8, ["symbol"])
|
|
110
|
-
], 8,
|
|
114
|
+
], 8, O)
|
|
111
115
|
])
|
|
112
116
|
])
|
|
113
117
|
])
|
|
114
118
|
]),
|
|
115
|
-
button:
|
|
116
|
-
o("span",
|
|
117
|
-
o("span",
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
button: g(() => [
|
|
120
|
+
o("span", P, [
|
|
121
|
+
o("span", Q, [
|
|
122
|
+
d(i, {
|
|
123
|
+
symbol: "upload",
|
|
124
|
+
size: "small"
|
|
125
|
+
}),
|
|
126
|
+
o("span", {
|
|
127
|
+
innerHTML: e.$t("common.selectFile")
|
|
128
|
+
}, null, 8, W)
|
|
129
|
+
])
|
|
121
130
|
])
|
|
122
131
|
]),
|
|
123
132
|
_: 1
|
|
@@ -130,5 +139,5 @@ const A = { class: "container" }, B = { class: "row" }, E = { class: "col-12" },
|
|
|
130
139
|
}
|
|
131
140
|
});
|
|
132
141
|
export {
|
|
133
|
-
|
|
142
|
+
ee as default
|
|
134
143
|
};
|
package/package.json
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ablok-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "vite --host",
|
|
7
|
-
"story:dev": "histoire dev",
|
|
8
|
-
"story:build": "histoire build",
|
|
9
|
-
"story:preview": "histoire preview",
|
|
10
|
-
"build": "vue-tsc --noEmit --project tsconfig.build.json && vite build",
|
|
11
|
-
"build:watch": "vue-tsc --noEmit --watch --project tsconfig.build.json & vite build --watch",
|
|
12
|
-
"preview": "vite preview",
|
|
13
|
-
"build-lib-bak": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
|
|
14
|
-
"build-lib": "vite build && vue-tsc --emitDeclarationOnly",
|
|
15
|
-
"release": "bash ./scripts/release.sh",
|
|
16
|
-
"postrelease": "bash ./scripts/publish.sh",
|
|
17
|
-
"test": "vitest run",
|
|
18
|
-
"test:watch": "vitest",
|
|
19
|
-
"test:ui": "vitest --ui"
|
|
20
|
-
},
|
|
4
|
+
"version": "0.3.84",
|
|
21
5
|
"dependencies": {
|
|
22
6
|
"date-fns": "^3.0.0",
|
|
23
7
|
"dompurify": "^3.3.1",
|
|
@@ -136,5 +120,21 @@
|
|
|
136
120
|
"./package.json": "./package.json"
|
|
137
121
|
},
|
|
138
122
|
"types": "./dist/index.d.ts",
|
|
139
|
-
"sideEffects": false
|
|
140
|
-
|
|
123
|
+
"sideEffects": false,
|
|
124
|
+
"scripts": {
|
|
125
|
+
"dev": "vite --host",
|
|
126
|
+
"story:dev": "histoire dev",
|
|
127
|
+
"story:build": "histoire build",
|
|
128
|
+
"story:preview": "histoire preview",
|
|
129
|
+
"build": "vue-tsc --noEmit --project tsconfig.build.json && vite build",
|
|
130
|
+
"build:watch": "vue-tsc --noEmit --watch --project tsconfig.build.json & vite build --watch",
|
|
131
|
+
"preview": "vite preview",
|
|
132
|
+
"build-lib-bak": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
|
|
133
|
+
"build-lib": "vite build && vue-tsc --emitDeclarationOnly",
|
|
134
|
+
"release": "bash ./scripts/release.sh",
|
|
135
|
+
"postrelease": "bash ./scripts/publish.sh",
|
|
136
|
+
"test": "vitest run",
|
|
137
|
+
"test:watch": "vitest",
|
|
138
|
+
"test:ui": "vitest --ui"
|
|
139
|
+
}
|
|
140
|
+
}
|