ablok-components 0.3.86 → 0.3.87
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.umd.js +2 -2
- package/dist/components/molecules/base-camera/base-camera.vue.js +147 -146
- package/dist/components/molecules/base-map/base-map.vue.js +49 -49
- package/dist/components/molecules/bulk-upload/bulk-upload.vue.d.ts +39 -0
- package/dist/components/molecules/bulk-upload/bulk-upload.vue.js +88 -64
- package/dist/components/molecules/file-upload/file-upload.vue.d.ts +42 -0
- package/dist/components/molecules/file-upload/file-upload.vue.js +47 -44
- package/package.json +19 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as L, ref as y, toRef as
|
|
1
|
+
import { defineComponent as L, ref as y, toRef as M, computed as N, watch as b, openBlock as u, createElementBlock as d, normalizeClass as h, unref as v, Fragment as V, renderList as P, renderSlot as S, 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";
|
|
@@ -10,7 +10,7 @@ import { uniqueId as F } from "../../../utilities/helpers.js";
|
|
|
10
10
|
const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTML"], K = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "file-upload__loading-spinner"
|
|
13
|
-
},
|
|
13
|
+
}, ne = /* @__PURE__ */ L({
|
|
14
14
|
__name: "file-upload",
|
|
15
15
|
props: {
|
|
16
16
|
modelValue: {
|
|
@@ -102,93 +102,96 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
emits: ["update:modelValue", "update:src"],
|
|
105
|
-
setup(
|
|
106
|
-
const e =
|
|
105
|
+
setup(o, { emit: U }) {
|
|
106
|
+
const e = o, i = U, g = y(), m = y([]), n = y([]), { pending: $, uploadFile: B } = I(e), { toLocalUrl: D, revoke: z } = R(M(e, "localUrlFormat")), { isDragging: C } = E(g, {
|
|
107
107
|
enabled: () => e.dropFiles,
|
|
108
108
|
onDrop: (t) => {
|
|
109
|
-
|
|
109
|
+
m.value = t;
|
|
110
110
|
}
|
|
111
|
-
}), A =
|
|
111
|
+
}), A = N(() => e.modelValue?.length ? e.modelValue : e.src ? [{ type: "", src: e.src }] : n.value);
|
|
112
112
|
function f(t) {
|
|
113
|
-
const l = typeof t == "string" ? parseInt(t, 10) : t,
|
|
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, a = Array.isArray(e.modelValue) && e.modelValue.length > 0, r = Array.isArray(n.value) && n.value.length > 0;
|
|
114
|
+
if (r && l < n.value.length && (z(n.value[l]?.src), n.value.splice(l, 1)), a) {
|
|
115
|
+
const s = [...e.modelValue];
|
|
116
|
+
l < s.length && s.splice(l, 1), i("update:modelValue", s), e.multiple || i("update:src", s[0]?.src || "");
|
|
117
|
+
} else if (r) {
|
|
118
|
+
const s = e.multiple ? n.value : n.value[0];
|
|
119
|
+
i("update:modelValue", s), 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
|
+
m.value.splice(l, 1);
|
|
123
123
|
}
|
|
124
|
-
return b(() =>
|
|
124
|
+
return b(() => m.value, async (t) => {
|
|
125
125
|
const l = await Promise.all(
|
|
126
|
-
t.map(async (
|
|
127
|
-
src: e.toDataUrl ? await D(
|
|
128
|
-
type:
|
|
126
|
+
t.map(async (a) => ({
|
|
127
|
+
src: e.toDataUrl ? await D(a) : await B(a),
|
|
128
|
+
type: a.type,
|
|
129
|
+
name: a.name,
|
|
130
|
+
size: a.size,
|
|
131
|
+
lastModified: a.lastModified
|
|
129
132
|
}))
|
|
130
133
|
);
|
|
131
|
-
|
|
132
|
-
}, { deep: !0 }), b(() =>
|
|
134
|
+
n.value = l;
|
|
135
|
+
}, { deep: !0 }), b(() => n.value, async (t) => {
|
|
133
136
|
const l = e.multiple ? t : t[0];
|
|
134
137
|
i("update:modelValue", l), e.multiple || i("update:src", t[0] && t[0].src);
|
|
135
138
|
}, { deep: !0 }), (t, l) => (u(), d("div", {
|
|
136
139
|
ref_key: "root",
|
|
137
140
|
ref: g,
|
|
138
141
|
class: h(["file-upload", {
|
|
139
|
-
"has-dragging":
|
|
140
|
-
"is-dragging": v(
|
|
142
|
+
"has-dragging": o.dropFiles,
|
|
143
|
+
"is-dragging": v(C)
|
|
141
144
|
}])
|
|
142
145
|
}, [
|
|
143
|
-
(u(!0), d(V, null,
|
|
144
|
-
key:
|
|
145
|
-
class: h(
|
|
146
|
+
(u(!0), d(V, null, P(A.value, (a, r) => (u(), d("div", {
|
|
147
|
+
key: a.src,
|
|
148
|
+
class: h(o.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
|
|
146
149
|
}, [
|
|
147
150
|
S(t.$slots, "preview-item", {
|
|
148
|
-
bind: { item:
|
|
151
|
+
bind: { item: a, index: r },
|
|
149
152
|
on: { removeFile: f }
|
|
150
153
|
}, () => [
|
|
151
|
-
|
|
154
|
+
o.enablePreview ? (u(), d(V, { key: 0 }, [
|
|
152
155
|
c("img", {
|
|
153
|
-
src: `${
|
|
156
|
+
src: `${a.src}${o.previewWidth ? `?width=${o.previewWidth}` : ""}`,
|
|
154
157
|
class: "img-thumbnail rounded"
|
|
155
158
|
}, null, 8, _),
|
|
156
159
|
c("button", {
|
|
157
|
-
onClick: w((
|
|
160
|
+
onClick: w((s) => f(r), ["prevent"]),
|
|
158
161
|
class: "btn btn--close"
|
|
159
162
|
}, [
|
|
160
|
-
|
|
163
|
+
p(k, { symbol: "x" })
|
|
161
164
|
], 8, j)
|
|
162
165
|
], 64)) : (u(), d("button", {
|
|
163
166
|
key: 1,
|
|
164
|
-
onClick: w((
|
|
167
|
+
onClick: w((s) => f(r), ["prevent"]),
|
|
165
168
|
class: "btn btn--close btn-outline-contrast"
|
|
166
169
|
}, [
|
|
167
|
-
|
|
170
|
+
p(k, { symbol: "x" })
|
|
168
171
|
], 8, x))
|
|
169
172
|
])
|
|
170
173
|
], 2))), 128)),
|
|
171
|
-
|
|
172
|
-
modelValue:
|
|
173
|
-
"onUpdate:modelValue": l[0] || (l[0] = (
|
|
174
|
-
id:
|
|
175
|
-
name:
|
|
176
|
-
accept:
|
|
177
|
-
"max-file-size":
|
|
178
|
-
multiple:
|
|
174
|
+
p(q, {
|
|
175
|
+
modelValue: m.value,
|
|
176
|
+
"onUpdate:modelValue": l[0] || (l[0] = (a) => m.value = a),
|
|
177
|
+
id: o.id,
|
|
178
|
+
name: o.name,
|
|
179
|
+
accept: o.accept,
|
|
180
|
+
"max-file-size": o.maxFileSize,
|
|
181
|
+
multiple: o.multiple,
|
|
179
182
|
class: "d-none"
|
|
180
183
|
}, null, 8, ["modelValue", "id", "name", "accept", "max-file-size", "multiple"]),
|
|
181
184
|
c("label", {
|
|
182
|
-
for:
|
|
185
|
+
for: o.id,
|
|
183
186
|
class: "file-upload__label"
|
|
184
187
|
}, [
|
|
185
188
|
S(t.$slots, "button", {}, () => [
|
|
186
189
|
c("span", {
|
|
187
190
|
class: "btn btn-outline-contrast",
|
|
188
|
-
innerHTML: v(O)(
|
|
191
|
+
innerHTML: v(O)(o.label || t.$t("common.selectFile"))
|
|
189
192
|
}, null, 8, J)
|
|
190
193
|
]),
|
|
191
|
-
|
|
194
|
+
p(T, { name: "fade" }, {
|
|
192
195
|
default: H(() => [
|
|
193
196
|
v($) ? (u(), d("span", K, [...l[1] || (l[1] = [
|
|
194
197
|
c("span", {
|
|
@@ -206,5 +209,5 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
|
|
|
206
209
|
}
|
|
207
210
|
});
|
|
208
211
|
export {
|
|
209
|
-
|
|
212
|
+
ne as default
|
|
210
213
|
};
|
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.87",
|
|
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
|
+
}
|