ablok-components 0.3.80 → 0.3.81
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,4 @@
|
|
|
1
|
-
import { defineComponent as L, ref as f, toRef as N, computed as P, watch as b, openBlock as u, createElementBlock as d, normalizeClass as h, unref as y, Fragment as V, renderList as T, renderSlot as S, createElementVNode as c, withModifiers as w, createVNode as
|
|
1
|
+
import { defineComponent as L, ref as f, toRef as N, computed as P, watch as b, openBlock as u, createElementBlock as d, normalizeClass as h, unref as y, Fragment as V, renderList as T, renderSlot as S, createElementVNode as c, withModifiers as w, createVNode as m, Transition as M, 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";
|
|
@@ -103,25 +103,25 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
103
103
|
},
|
|
104
104
|
emits: ["update:modelValue", "update:src"],
|
|
105
105
|
setup(a, { emit: U }) {
|
|
106
|
-
const e = a, i = U, v = f(),
|
|
106
|
+
const e = a, i = U, v = f(), p = f([]), n = f([]), { pending: $, uploadFile: B } = I(e), { toLocalUrl: D, revoke: C } = R(N(e, "localUrlFormat")), { isDragging: z } = E(v, {
|
|
107
107
|
enabled: () => e.dropFiles,
|
|
108
108
|
onDrop: (t) => {
|
|
109
|
-
|
|
109
|
+
p.value = t;
|
|
110
110
|
}
|
|
111
111
|
}), A = P(() => e.modelValue?.length ? e.modelValue : e.src ? [{ type: "", src: e.src }] : n.value);
|
|
112
112
|
function g(t) {
|
|
113
|
-
const l = typeof t == "string" ? parseInt(t, 10) : t, o = Array.isArray(e.modelValue) && e.modelValue.length > 0,
|
|
114
|
-
if (
|
|
115
|
-
const
|
|
116
|
-
l <
|
|
117
|
-
} else if (
|
|
118
|
-
const
|
|
119
|
-
i("update:modelValue",
|
|
113
|
+
const l = typeof t == "string" ? parseInt(t, 10) : t, o = Array.isArray(e.modelValue) && e.modelValue.length > 0, s = Array.isArray(n.value) && n.value.length > 0;
|
|
114
|
+
if (s && l < n.value.length && (C(n.value[l]?.src), n.value.splice(l, 1)), o) {
|
|
115
|
+
const r = [...e.modelValue];
|
|
116
|
+
l < r.length && r.splice(l, 1), i("update:modelValue", r), e.multiple || i("update:src", r[0]?.src || "");
|
|
117
|
+
} else if (s) {
|
|
118
|
+
const r = e.multiple ? n.value : n.value[0];
|
|
119
|
+
i("update:modelValue", r), e.multiple || i("update:src", n.value[0]?.src || "");
|
|
120
120
|
} else
|
|
121
121
|
i("update:modelValue", e.multiple ? [] : void 0), i("update:src", "");
|
|
122
|
-
|
|
122
|
+
p.value.splice(l, 1);
|
|
123
123
|
}
|
|
124
|
-
return b(() =>
|
|
124
|
+
return b(() => p.value, async (t) => {
|
|
125
125
|
const l = await Promise.all(
|
|
126
126
|
t.map(async (o) => ({
|
|
127
127
|
src: e.toDataUrl ? await D(o) : await B(o),
|
|
@@ -140,13 +140,13 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
140
140
|
"is-dragging": y(z)
|
|
141
141
|
}])
|
|
142
142
|
}, [
|
|
143
|
-
(u(!0), d(V, null, T(A.value, (o,
|
|
143
|
+
(u(!0), d(V, null, T(A.value, (o, s) => (u(), d("div", {
|
|
144
144
|
key: o.src,
|
|
145
145
|
class: h(a.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
|
|
146
146
|
}, [
|
|
147
147
|
S(t.$slots, "preview-item", {
|
|
148
|
-
|
|
149
|
-
index:
|
|
148
|
+
item: o,
|
|
149
|
+
index: s
|
|
150
150
|
}, () => [
|
|
151
151
|
a.enablePreview ? (u(), d(V, { key: 0 }, [
|
|
152
152
|
c("img", {
|
|
@@ -154,23 +154,23 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
154
154
|
class: "img-thumbnail rounded"
|
|
155
155
|
}, null, 8, _),
|
|
156
156
|
c("button", {
|
|
157
|
-
onClick: w((
|
|
157
|
+
onClick: w((r) => g(s), ["prevent"]),
|
|
158
158
|
class: "btn btn--close"
|
|
159
159
|
}, [
|
|
160
|
-
|
|
160
|
+
m(k, { symbol: "x" })
|
|
161
161
|
], 8, j)
|
|
162
162
|
], 64)) : (u(), d("button", {
|
|
163
163
|
key: 1,
|
|
164
|
-
onClick: w((
|
|
164
|
+
onClick: w((r) => g(s), ["prevent"]),
|
|
165
165
|
class: "btn btn--close btn-outline-contrast"
|
|
166
166
|
}, [
|
|
167
|
-
|
|
167
|
+
m(k, { symbol: "x" })
|
|
168
168
|
], 8, x))
|
|
169
169
|
])
|
|
170
170
|
], 2))), 128)),
|
|
171
|
-
|
|
172
|
-
modelValue:
|
|
173
|
-
"onUpdate:modelValue": l[0] || (l[0] = (o) =>
|
|
171
|
+
m(q, {
|
|
172
|
+
modelValue: p.value,
|
|
173
|
+
"onUpdate:modelValue": l[0] || (l[0] = (o) => p.value = o),
|
|
174
174
|
id: a.id,
|
|
175
175
|
name: a.name,
|
|
176
176
|
accept: a.accept,
|
|
@@ -188,7 +188,7 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
188
188
|
innerHTML: y(O)(a.label || t.$t("common.selectFile"))
|
|
189
189
|
}, null, 8, J)
|
|
190
190
|
]),
|
|
191
|
-
|
|
191
|
+
m(M, { name: "fade" }, {
|
|
192
192
|
default: H(() => [
|
|
193
193
|
y($) ? (u(), d("span", K, [...l[1] || (l[1] = [
|
|
194
194
|
c("span", {
|
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.81",
|
|
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
|
+
}
|