vant-vtk 1.0.5 → 1.0.7
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/style.css +1 -1
- package/dist/vant-vtk.es.js +340 -342
- package/dist/vant-vtk.es.js.map +1 -1
- package/dist/vant-vtk.umd.js +1 -1
- package/dist/vant-vtk.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/es/Area.js +0 -193
- package/dist/es/Area.js.map +0 -1
- package/dist/es/Radio.css +0 -1
- package/dist/es/Radio.js +0 -79
- package/dist/es/Radio.js.map +0 -1
- package/dist/es/Uploader.css +0 -1
- package/dist/es/Uploader.js +0 -128
- package/dist/es/Uploader.js.map +0 -1
- package/dist/es/_plugin-vue_export-helper-CHgC5LLL.js +0 -10
- package/dist/es/_plugin-vue_export-helper-CHgC5LLL.js.map +0 -1
- package/dist/es/checkbox.css +0 -1
- package/dist/es/checkbox.js +0 -86
- package/dist/es/checkbox.js.map +0 -1
- package/dist/es/index.js +0 -35
- package/dist/es/index.js.map +0 -1
- package/dist/es/preview.css +0 -1
- package/dist/es/preview.js +0 -192
- package/dist/es/preview.js.map +0 -1
- package/dist/lib/Area.js +0 -2
- package/dist/lib/Area.js.map +0 -1
- package/dist/lib/Radio.css +0 -1
- package/dist/lib/Radio.js +0 -2
- package/dist/lib/Radio.js.map +0 -1
- package/dist/lib/Uploader.css +0 -1
- package/dist/lib/Uploader.js +0 -2
- package/dist/lib/Uploader.js.map +0 -1
- package/dist/lib/_plugin-vue_export-helper-BHFhmbuH.cjs +0 -2
- package/dist/lib/_plugin-vue_export-helper-BHFhmbuH.cjs.map +0 -1
- package/dist/lib/checkbox.css +0 -1
- package/dist/lib/checkbox.js +0 -2
- package/dist/lib/checkbox.js.map +0 -1
- package/dist/lib/index.js +0 -2
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/preview.css +0 -1
- package/dist/lib/preview.js +0 -2
- package/dist/lib/preview.js.map +0 -1
package/dist/vant-vtk.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { showLoadingToast as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
for (const [
|
|
7
|
-
|
|
8
|
-
return
|
|
9
|
-
},
|
|
1
|
+
import { computed as L, resolveComponent as V, openBlock as k, createBlock as T, normalizeProps as J, guardReactiveProps as K, withCtx as A, createVNode as x, createElementBlock as P, Fragment as W, renderList as Q, createTextVNode as $, toDisplayString as j, ref as C, watch as z, mergeProps as X, createElementVNode as S, unref as Z, createCommentVNode as O } from "vue";
|
|
2
|
+
import { showLoadingToast as H, closeToast as ee, showToast as E } from "vant";
|
|
3
|
+
import ae from "vue-pdf-embed";
|
|
4
|
+
const q = (n, _) => {
|
|
5
|
+
const r = n.__vccOpts || n;
|
|
6
|
+
for (const [d, m] of _)
|
|
7
|
+
r[d] = m;
|
|
8
|
+
return r;
|
|
9
|
+
}, te = /* @__PURE__ */ Object.assign({
|
|
10
10
|
name: "VtkCheckbox"
|
|
11
11
|
}, {
|
|
12
12
|
__name: "index",
|
|
@@ -25,7 +25,7 @@ const J = (l, d) => {
|
|
|
25
25
|
valueType: {
|
|
26
26
|
type: String,
|
|
27
27
|
default: "array",
|
|
28
|
-
validator: (
|
|
28
|
+
validator: (n) => ["string", "array", "object"].includes(n)
|
|
29
29
|
},
|
|
30
30
|
// 当 valueType 为 string 时的分隔符
|
|
31
31
|
separator: {
|
|
@@ -34,42 +34,42 @@ const J = (l, d) => {
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
emits: ["update:modelValue", "change"],
|
|
37
|
-
setup(
|
|
38
|
-
const
|
|
39
|
-
const [
|
|
37
|
+
setup(n, { emit: _ }) {
|
|
38
|
+
const r = n, d = _, m = L(() => Array.isArray(r.options) ? r.options : typeof r.options == "string" && r.options ? r.options.split("/").filter(Boolean).map((t) => {
|
|
39
|
+
const [o, s] = t.split(":");
|
|
40
40
|
return {
|
|
41
|
-
text: s ||
|
|
42
|
-
value:
|
|
41
|
+
text: s || o,
|
|
42
|
+
value: o
|
|
43
43
|
};
|
|
44
|
-
}) : []),
|
|
44
|
+
}) : []), i = L({
|
|
45
45
|
get: () => {
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
let
|
|
49
|
-
return
|
|
46
|
+
const t = r.modelValue;
|
|
47
|
+
if (!t) return [];
|
|
48
|
+
let o = [];
|
|
49
|
+
return r.valueType === "string" ? o = typeof t == "string" ? t.split(r.separator).filter(Boolean) : [] : r.valueType === "object" ? o = Array.isArray(t) ? t.map((s) => (s == null ? void 0 : s.value) ?? s) : [] : o = Array.isArray(t) ? t : [], o.map(String);
|
|
50
50
|
},
|
|
51
|
-
set: (
|
|
52
|
-
let
|
|
53
|
-
|
|
51
|
+
set: (t) => {
|
|
52
|
+
let o;
|
|
53
|
+
r.valueType === "string" ? o = t.join(r.separator) : r.valueType === "object" ? o = m.value.filter((s) => t.includes(String(s.value))) : o = t.map((s) => isNaN(Number(s)) ? s : Array.isArray(r.modelValue) && typeof r.modelValue[0] == "number" ? Number(s) : s), d("update:modelValue", o), d("change", o);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
return (
|
|
57
|
-
const s = V("van-checkbox"),
|
|
58
|
-
return
|
|
56
|
+
return (t, o) => {
|
|
57
|
+
const s = V("van-checkbox"), y = V("van-checkbox-group"), v = V("van-field");
|
|
58
|
+
return k(), T(v, J(K(t.$attrs)), {
|
|
59
59
|
input: A(() => [
|
|
60
|
-
x(
|
|
61
|
-
modelValue:
|
|
62
|
-
"onUpdate:modelValue":
|
|
60
|
+
x(y, {
|
|
61
|
+
modelValue: i.value,
|
|
62
|
+
"onUpdate:modelValue": o[0] || (o[0] = (g) => i.value = g),
|
|
63
63
|
direction: "horizontal"
|
|
64
64
|
}, {
|
|
65
65
|
default: A(() => [
|
|
66
|
-
(
|
|
66
|
+
(k(!0), P(W, null, Q(m.value, (g) => (k(), T(s, {
|
|
67
67
|
key: String(g.value),
|
|
68
68
|
name: String(g.value),
|
|
69
69
|
shape: "square"
|
|
70
70
|
}, {
|
|
71
71
|
default: A(() => [
|
|
72
|
-
|
|
72
|
+
$(j(g.text), 1)
|
|
73
73
|
]),
|
|
74
74
|
_: 2
|
|
75
75
|
}, 1032, ["name"]))), 128))
|
|
@@ -81,11 +81,11 @@ const J = (l, d) => {
|
|
|
81
81
|
}, 16);
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
}),
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
}), U = /* @__PURE__ */ q(te, [["__scopeId", "data-v-eb64e8a9"]]);
|
|
85
|
+
U.install = (n) => {
|
|
86
|
+
n.component(U.name || "VtkCheckbox", U);
|
|
87
87
|
};
|
|
88
|
-
const
|
|
88
|
+
const I = /* @__PURE__ */ Object.assign({
|
|
89
89
|
name: "VtkArea"
|
|
90
90
|
}, {
|
|
91
91
|
__name: "index",
|
|
@@ -104,7 +104,7 @@ const E = /* @__PURE__ */ Object.assign({
|
|
|
104
104
|
valueType: {
|
|
105
105
|
type: String,
|
|
106
106
|
default: "code",
|
|
107
|
-
validator: (
|
|
107
|
+
validator: (n) => ["code", "codes", "object"].includes(n)
|
|
108
108
|
},
|
|
109
109
|
// 显示分隔符
|
|
110
110
|
separator: {
|
|
@@ -130,143 +130,147 @@ const E = /* @__PURE__ */ Object.assign({
|
|
|
130
130
|
displayMode: {
|
|
131
131
|
type: String,
|
|
132
132
|
default: "full",
|
|
133
|
-
validator: (
|
|
133
|
+
validator: (n) => ["full", "last"].includes(n)
|
|
134
|
+
},
|
|
135
|
+
/** 自定义加载初始地区方法(必填) */
|
|
136
|
+
AreaShowMethod: {
|
|
137
|
+
type: Function,
|
|
138
|
+
required: !0
|
|
139
|
+
},
|
|
140
|
+
/** 自定义加载下级地区方法(必填) */
|
|
141
|
+
AreaNextMethod: {
|
|
142
|
+
type: Function,
|
|
143
|
+
required: !0
|
|
134
144
|
}
|
|
135
145
|
},
|
|
136
146
|
emits: ["update:modelValue", "change", "finish"],
|
|
137
|
-
setup(
|
|
138
|
-
|
|
139
|
-
const _ = ee("vant-vtk:request", null), c = (y = ae()) == null ? void 0 : y.appContext.config.globalProperties, p = (c == null ? void 0 : c.$vtkRequest) || (c == null ? void 0 : c.$request), r = () => {
|
|
140
|
-
const e = _ || p;
|
|
141
|
-
if (!e)
|
|
142
|
-
throw new Error("VantVtk request 未配置");
|
|
143
|
-
return e;
|
|
144
|
-
}, t = l, s = n, f = S(!1), h = S(""), g = S([]), b = S(""), q = S(!1), w = S([]), U = {
|
|
147
|
+
setup(n, { expose: _, emit: r }) {
|
|
148
|
+
const d = n, m = r, i = C(!1), t = C(""), o = C([]), s = C(""), y = C(!1), v = C([]), g = {
|
|
145
149
|
text: "areaName",
|
|
146
150
|
value: "areaCode",
|
|
147
151
|
children: "children"
|
|
148
152
|
};
|
|
149
|
-
|
|
150
|
-
() =>
|
|
151
|
-
(
|
|
152
|
-
|
|
153
|
+
z(
|
|
154
|
+
() => d.modelValue,
|
|
155
|
+
(a) => {
|
|
156
|
+
a || (s.value = "", t.value = "", v.value = []);
|
|
153
157
|
},
|
|
154
158
|
{ immediate: !0 }
|
|
155
159
|
);
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
if (!
|
|
160
|
-
|
|
160
|
+
const N = () => {
|
|
161
|
+
i.value = !0, o.value.length === 0 && F();
|
|
162
|
+
}, F = async () => {
|
|
163
|
+
if (!y.value) {
|
|
164
|
+
y.value = !0;
|
|
161
165
|
try {
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
areaCode:
|
|
166
|
-
areaName:
|
|
167
|
-
areaLeve:
|
|
168
|
-
children:
|
|
166
|
+
const a = d.defaultAreaCode, e = await d.AreaShowMethod(a);
|
|
167
|
+
if (e.data) {
|
|
168
|
+
const l = {
|
|
169
|
+
areaCode: e.data.areaCode,
|
|
170
|
+
areaName: e.data.areaName,
|
|
171
|
+
areaLeve: e.data.areaLeve,
|
|
172
|
+
children: e.data.areaLeve < d.maxLevel ? [] : void 0
|
|
169
173
|
};
|
|
170
|
-
|
|
174
|
+
o.value = [l];
|
|
171
175
|
}
|
|
172
|
-
} catch (
|
|
173
|
-
console.error("加载初始地区失败:",
|
|
176
|
+
} catch (a) {
|
|
177
|
+
console.error("加载初始地区失败:", a);
|
|
174
178
|
} finally {
|
|
175
|
-
|
|
179
|
+
y.value = !1;
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
|
-
},
|
|
179
|
-
if (!
|
|
180
|
-
|
|
182
|
+
}, u = async (a) => {
|
|
183
|
+
if (!a._loading) {
|
|
184
|
+
a._loading = !0;
|
|
181
185
|
try {
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}),
|
|
186
|
-
} catch (
|
|
187
|
-
console.error("加载下级地区失败:",
|
|
186
|
+
const e = await d.AreaNextMethod(a.areaCode);
|
|
187
|
+
e.data && e.data.length > 0 ? (e.data.forEach((l) => {
|
|
188
|
+
l.areaLeve < d.maxLevel && (l.children = []);
|
|
189
|
+
}), a.children = e.data) : delete a.children;
|
|
190
|
+
} catch (e) {
|
|
191
|
+
console.error("加载下级地区失败:", e);
|
|
188
192
|
} finally {
|
|
189
|
-
|
|
193
|
+
a._loading = !1;
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
|
-
},
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
areaCode:
|
|
199
|
-
areaName:
|
|
200
|
-
areaLeve:
|
|
196
|
+
}, c = ({ value: a, selectedOptions: e, tabIndex: l }) => {
|
|
197
|
+
const p = e[l];
|
|
198
|
+
p && p.areaLeve < d.maxLevel && Array.isArray(p.children) && p.children.length === 0 && u(p), m("change", { value: a, selectedOptions: e, tabIndex: l });
|
|
199
|
+
}, f = ({ selectedOptions: a }) => {
|
|
200
|
+
var l, p, w, b, R;
|
|
201
|
+
d.displayMode === "last" ? s.value = ((l = a[a.length - 1]) == null ? void 0 : l.areaName) || "" : s.value = a.map((h) => h.areaName).join(d.separator), v.value = a.map((h) => ({
|
|
202
|
+
areaCode: h.areaCode,
|
|
203
|
+
areaName: h.areaName,
|
|
204
|
+
areaLeve: h.areaLeve
|
|
201
205
|
}));
|
|
202
|
-
let
|
|
203
|
-
switch (
|
|
206
|
+
let e;
|
|
207
|
+
switch (d.valueType) {
|
|
204
208
|
case "code":
|
|
205
|
-
|
|
209
|
+
e = ((p = a[a.length - 1]) == null ? void 0 : p.areaCode) || "";
|
|
206
210
|
break;
|
|
207
211
|
case "codes":
|
|
208
|
-
|
|
212
|
+
e = a.map((h) => h.areaCode);
|
|
209
213
|
break;
|
|
210
214
|
case "object":
|
|
211
|
-
|
|
212
|
-
codes:
|
|
213
|
-
names:
|
|
214
|
-
fullName:
|
|
215
|
-
lastCode: ((
|
|
216
|
-
lastLevel: (
|
|
217
|
-
options:
|
|
215
|
+
e = {
|
|
216
|
+
codes: a.map((h) => h.areaCode),
|
|
217
|
+
names: a.map((h) => h.areaName),
|
|
218
|
+
fullName: a.map((h) => h.areaName).join(d.separator),
|
|
219
|
+
lastCode: ((w = a[a.length - 1]) == null ? void 0 : w.areaCode) || "",
|
|
220
|
+
lastLevel: (b = a[a.length - 1]) == null ? void 0 : b.areaLeve,
|
|
221
|
+
options: v.value
|
|
218
222
|
};
|
|
219
223
|
break;
|
|
220
224
|
default:
|
|
221
|
-
|
|
225
|
+
e = ((R = a[a.length - 1]) == null ? void 0 : R.areaCode) || "";
|
|
222
226
|
}
|
|
223
|
-
|
|
227
|
+
m("update:modelValue", e), m("finish", { selectedOptions: a, value: e }), i.value = !1;
|
|
224
228
|
};
|
|
225
|
-
return
|
|
229
|
+
return _({
|
|
226
230
|
// 获取当前选中的完整数据
|
|
227
|
-
getSelectedData: () =>
|
|
231
|
+
getSelectedData: () => v.value,
|
|
228
232
|
// 获取显示值
|
|
229
|
-
getDisplayValue: () =>
|
|
233
|
+
getDisplayValue: () => s.value,
|
|
230
234
|
// 重置选择
|
|
231
235
|
reset: () => {
|
|
232
|
-
|
|
236
|
+
s.value = "", t.value = "", v.value = [], m("update:modelValue", d.valueType === "codes" ? [] : d.valueType === "object" ? null : "");
|
|
233
237
|
},
|
|
234
238
|
// 打开选择器
|
|
235
239
|
open: () => {
|
|
236
|
-
|
|
240
|
+
N();
|
|
237
241
|
},
|
|
238
242
|
// 关闭选择器
|
|
239
243
|
close: () => {
|
|
240
|
-
|
|
244
|
+
i.value = !1;
|
|
241
245
|
}
|
|
242
|
-
}), (
|
|
243
|
-
const
|
|
244
|
-
return
|
|
245
|
-
x(
|
|
246
|
-
modelValue:
|
|
247
|
-
"onUpdate:modelValue":
|
|
246
|
+
}), (a, e) => {
|
|
247
|
+
const l = V("van-field"), p = V("van-cascader"), w = V("van-popup");
|
|
248
|
+
return k(), P(W, null, [
|
|
249
|
+
x(l, X({
|
|
250
|
+
modelValue: s.value,
|
|
251
|
+
"onUpdate:modelValue": e[0] || (e[0] = (b) => s.value = b),
|
|
248
252
|
"is-link": "",
|
|
249
253
|
readonly: ""
|
|
250
|
-
},
|
|
251
|
-
placeholder:
|
|
252
|
-
onClick:
|
|
254
|
+
}, a.$attrs, {
|
|
255
|
+
placeholder: n.placeholder,
|
|
256
|
+
onClick: N
|
|
253
257
|
}), null, 16, ["modelValue", "placeholder"]),
|
|
254
|
-
x(
|
|
255
|
-
show:
|
|
256
|
-
"onUpdate:show":
|
|
258
|
+
x(w, {
|
|
259
|
+
show: i.value,
|
|
260
|
+
"onUpdate:show": e[3] || (e[3] = (b) => i.value = b),
|
|
257
261
|
round: "",
|
|
258
262
|
position: "bottom"
|
|
259
263
|
}, {
|
|
260
264
|
default: A(() => [
|
|
261
|
-
x(
|
|
262
|
-
modelValue:
|
|
263
|
-
"onUpdate:modelValue":
|
|
264
|
-
title:
|
|
265
|
-
options:
|
|
266
|
-
"field-names":
|
|
267
|
-
onClose:
|
|
268
|
-
onFinish:
|
|
269
|
-
onChange:
|
|
265
|
+
x(p, {
|
|
266
|
+
modelValue: t.value,
|
|
267
|
+
"onUpdate:modelValue": e[1] || (e[1] = (b) => t.value = b),
|
|
268
|
+
title: n.title,
|
|
269
|
+
options: o.value,
|
|
270
|
+
"field-names": g,
|
|
271
|
+
onClose: e[2] || (e[2] = (b) => i.value = !1),
|
|
272
|
+
onFinish: f,
|
|
273
|
+
onChange: c
|
|
270
274
|
}, null, 8, ["modelValue", "title", "options"])
|
|
271
275
|
]),
|
|
272
276
|
_: 1
|
|
@@ -275,10 +279,10 @@ const E = /* @__PURE__ */ Object.assign({
|
|
|
275
279
|
};
|
|
276
280
|
}
|
|
277
281
|
});
|
|
278
|
-
|
|
279
|
-
|
|
282
|
+
I.install = (n) => {
|
|
283
|
+
n.component(I.name || "VtkArea", I);
|
|
280
284
|
};
|
|
281
|
-
const
|
|
285
|
+
const le = /* @__PURE__ */ Object.assign({
|
|
282
286
|
name: "VtkRadio"
|
|
283
287
|
}, {
|
|
284
288
|
__name: "index",
|
|
@@ -297,44 +301,44 @@ const ue = /* @__PURE__ */ Object.assign({
|
|
|
297
301
|
valueType: {
|
|
298
302
|
type: String,
|
|
299
303
|
default: "string",
|
|
300
|
-
validator: (
|
|
304
|
+
validator: (n) => ["string", "object"].includes(n)
|
|
301
305
|
}
|
|
302
306
|
},
|
|
303
307
|
emits: ["update:modelValue", "change"],
|
|
304
|
-
setup(
|
|
305
|
-
const
|
|
306
|
-
const [
|
|
308
|
+
setup(n, { emit: _ }) {
|
|
309
|
+
const r = n, d = _, m = L(() => Array.isArray(r.options) ? r.options : typeof r.options == "string" && r.options ? r.options.split("/").filter(Boolean).map((t) => {
|
|
310
|
+
const [o, s] = t.split(":");
|
|
307
311
|
return {
|
|
308
|
-
text: s ||
|
|
309
|
-
value:
|
|
312
|
+
text: s || o,
|
|
313
|
+
value: o
|
|
310
314
|
};
|
|
311
|
-
}) : []),
|
|
315
|
+
}) : []), i = L({
|
|
312
316
|
get: () => {
|
|
313
|
-
const
|
|
314
|
-
return
|
|
317
|
+
const t = r.modelValue;
|
|
318
|
+
return t == null ? "" : r.valueType === "object" && t && typeof t == "object" ? String(t.value ?? "") : String(t);
|
|
315
319
|
},
|
|
316
|
-
set: (
|
|
317
|
-
var
|
|
318
|
-
let
|
|
319
|
-
typeof (
|
|
320
|
+
set: (t) => {
|
|
321
|
+
var y;
|
|
322
|
+
let o = t;
|
|
323
|
+
typeof (r.valueType === "object" ? (y = r.modelValue) == null ? void 0 : y.value : r.modelValue) == "number" && !isNaN(Number(t)) && (o = Number(t)), r.valueType === "object" && (o = m.value.find((v) => String(v.value) === String(t)) || null), d("update:modelValue", o), d("change", o);
|
|
320
324
|
}
|
|
321
325
|
});
|
|
322
|
-
return (
|
|
323
|
-
const s = V("van-radio"),
|
|
324
|
-
return
|
|
326
|
+
return (t, o) => {
|
|
327
|
+
const s = V("van-radio"), y = V("van-radio-group"), v = V("van-field");
|
|
328
|
+
return k(), T(v, J(K(t.$attrs)), {
|
|
325
329
|
input: A(() => [
|
|
326
|
-
x(
|
|
327
|
-
modelValue:
|
|
328
|
-
"onUpdate:modelValue":
|
|
330
|
+
x(y, {
|
|
331
|
+
modelValue: i.value,
|
|
332
|
+
"onUpdate:modelValue": o[0] || (o[0] = (g) => i.value = g),
|
|
329
333
|
direction: "horizontal"
|
|
330
334
|
}, {
|
|
331
335
|
default: A(() => [
|
|
332
|
-
(
|
|
336
|
+
(k(!0), P(W, null, Q(m.value, (g) => (k(), T(s, {
|
|
333
337
|
key: String(g.value),
|
|
334
338
|
name: String(g.value)
|
|
335
339
|
}, {
|
|
336
340
|
default: A(() => [
|
|
337
|
-
|
|
341
|
+
$(j(g.text), 1)
|
|
338
342
|
]),
|
|
339
343
|
_: 2
|
|
340
344
|
}, 1032, ["name"]))), 128))
|
|
@@ -346,11 +350,11 @@ const ue = /* @__PURE__ */ Object.assign({
|
|
|
346
350
|
}, 16);
|
|
347
351
|
};
|
|
348
352
|
}
|
|
349
|
-
}), M = /* @__PURE__ */
|
|
350
|
-
M.install = (
|
|
351
|
-
|
|
353
|
+
}), M = /* @__PURE__ */ q(le, [["__scopeId", "data-v-3482e335"]]);
|
|
354
|
+
M.install = (n) => {
|
|
355
|
+
n.component(M.name || "VtkRadio", M);
|
|
352
356
|
};
|
|
353
|
-
const
|
|
357
|
+
const ne = /* @__PURE__ */ Object.assign({
|
|
354
358
|
name: "VtkUploader",
|
|
355
359
|
inheritAttrs: !1
|
|
356
360
|
}, {
|
|
@@ -365,7 +369,7 @@ const ie = /* @__PURE__ */ Object.assign({
|
|
|
365
369
|
valueType: {
|
|
366
370
|
type: String,
|
|
367
371
|
default: "array",
|
|
368
|
-
validator: (
|
|
372
|
+
validator: (n) => ["string", "array"].includes(n)
|
|
369
373
|
},
|
|
370
374
|
/** 单个文件最大大小(字节),默认10MB */
|
|
371
375
|
maxSize: {
|
|
@@ -377,10 +381,10 @@ const ie = /* @__PURE__ */ Object.assign({
|
|
|
377
381
|
type: String,
|
|
378
382
|
default: "image/*"
|
|
379
383
|
},
|
|
380
|
-
/**
|
|
381
|
-
|
|
382
|
-
type:
|
|
383
|
-
|
|
384
|
+
/** 自定义上传方法(必填) */
|
|
385
|
+
uploadMethod: {
|
|
386
|
+
type: Function,
|
|
387
|
+
required: !0
|
|
384
388
|
},
|
|
385
389
|
/** 上传文件的字段名 */
|
|
386
390
|
fieldName: {
|
|
@@ -389,112 +393,106 @@ const ie = /* @__PURE__ */ Object.assign({
|
|
|
389
393
|
}
|
|
390
394
|
},
|
|
391
395
|
emits: ["update:modelValue", "change", "success", "error"],
|
|
392
|
-
setup(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
return a;
|
|
399
|
-
}, t = l, s = n, f = S([]), h = (a) => {
|
|
400
|
-
if (!a) return [];
|
|
401
|
-
let u = [];
|
|
402
|
-
return typeof a == "string" ? u = a.split(",").filter((y) => y.trim()) : Array.isArray(a) && (u = a.filter((y) => y)), u.map((y) => ({
|
|
403
|
-
url: y,
|
|
396
|
+
setup(n, { expose: _, emit: r }) {
|
|
397
|
+
const d = n, m = r, i = C([]), t = (u) => {
|
|
398
|
+
if (!u) return [];
|
|
399
|
+
let c = [];
|
|
400
|
+
return typeof u == "string" ? c = u.split(",").filter((f) => f.trim()) : Array.isArray(u) && (c = u.filter((f) => f)), c.map((f) => ({
|
|
401
|
+
url: f,
|
|
404
402
|
status: "done",
|
|
405
403
|
message: ""
|
|
406
404
|
}));
|
|
407
|
-
},
|
|
408
|
-
const
|
|
409
|
-
|
|
405
|
+
}, o = () => i.value.filter((u) => u.status === "done" && u.url).map((u) => u.url), s = (u) => d.valueType === "string" ? u.join(",") : u, y = () => {
|
|
406
|
+
const u = o(), c = s(u);
|
|
407
|
+
m("update:modelValue", c), m("change", c);
|
|
410
408
|
};
|
|
411
|
-
|
|
412
|
-
() =>
|
|
413
|
-
(
|
|
414
|
-
const
|
|
415
|
-
|
|
409
|
+
z(
|
|
410
|
+
() => d.modelValue,
|
|
411
|
+
(u) => {
|
|
412
|
+
const c = o().join(","), f = Array.isArray(u) ? u.join(",") : u || "";
|
|
413
|
+
c !== f && (i.value = t(u));
|
|
416
414
|
},
|
|
417
415
|
{ immediate: !0 }
|
|
418
416
|
);
|
|
419
|
-
const
|
|
420
|
-
const
|
|
421
|
-
for (const
|
|
422
|
-
if (
|
|
423
|
-
const
|
|
424
|
-
return
|
|
417
|
+
const v = (u) => {
|
|
418
|
+
const c = Array.isArray(u) ? u : [u];
|
|
419
|
+
for (const f of c)
|
|
420
|
+
if (f.size > d.maxSize) {
|
|
421
|
+
const a = (d.maxSize / 1024 / 1024).toFixed(1);
|
|
422
|
+
return E(`文件大小不能超过${a}MB`), !1;
|
|
425
423
|
}
|
|
426
424
|
return !0;
|
|
427
|
-
},
|
|
428
|
-
var
|
|
429
|
-
const
|
|
430
|
-
|
|
425
|
+
}, g = async (u) => {
|
|
426
|
+
var f, a, e, l;
|
|
427
|
+
const c = new FormData();
|
|
428
|
+
c.append(d.fieldName, u.file);
|
|
431
429
|
try {
|
|
432
|
-
const
|
|
433
|
-
return (
|
|
434
|
-
} catch (
|
|
435
|
-
return { success: !1, message:
|
|
430
|
+
const p = await d.uploadMethod(c);
|
|
431
|
+
return (f = p.meta) != null && f.success ? { success: !0, url: ((a = p.data) == null ? void 0 : a.url) || ((e = p.data) == null ? void 0 : e.path) || p.data } : { success: !1, message: ((l = p.meta) == null ? void 0 : l.message) || "上传失败" };
|
|
432
|
+
} catch (p) {
|
|
433
|
+
return { success: !1, message: p.message || "上传失败" };
|
|
436
434
|
}
|
|
437
|
-
},
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
message: `正在上传 0/${
|
|
435
|
+
}, N = async (u) => {
|
|
436
|
+
const c = Array.isArray(u) ? u : [u];
|
|
437
|
+
c.length > 1 && H({
|
|
438
|
+
message: `正在上传 0/${c.length}`,
|
|
441
439
|
forbidClick: !0,
|
|
442
440
|
duration: 0
|
|
443
441
|
});
|
|
444
|
-
let
|
|
445
|
-
for (let
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
message: `正在上传 ${
|
|
442
|
+
let f = 0, a = 0;
|
|
443
|
+
for (let e = 0; e < c.length; e++) {
|
|
444
|
+
const l = c[e];
|
|
445
|
+
l.status = "uploading", l.message = "上传中...", c.length > 1 && H({
|
|
446
|
+
message: `正在上传 ${e + 1}/${c.length}`,
|
|
449
447
|
forbidClick: !0,
|
|
450
448
|
duration: 0
|
|
451
449
|
});
|
|
452
|
-
const
|
|
453
|
-
|
|
450
|
+
const p = await g(l);
|
|
451
|
+
p.success ? (l.status = "done", l.message = "", l.url = p.url, f++, m("success", { file: l, url: p.url })) : (l.status = "failed", l.message = p.message, a++, m("error", { file: l, message: p.message }));
|
|
454
452
|
}
|
|
455
|
-
|
|
456
|
-
},
|
|
453
|
+
ee(), c.length > 1 ? a === 0 ? E(`${f}个文件上传成功`) : E(`${f}个成功,${a}个失败`) : a > 0 && E(c[0].message || "上传失败"), y();
|
|
454
|
+
}, F = () => {
|
|
457
455
|
setTimeout(() => {
|
|
458
|
-
|
|
456
|
+
y();
|
|
459
457
|
}, 0);
|
|
460
458
|
};
|
|
461
|
-
return
|
|
459
|
+
return _({
|
|
462
460
|
/** 获取已上传的URL列表 */
|
|
463
|
-
getUrls:
|
|
461
|
+
getUrls: o,
|
|
464
462
|
/** 清空文件列表 */
|
|
465
463
|
clear: () => {
|
|
466
|
-
|
|
464
|
+
i.value = [], y();
|
|
467
465
|
},
|
|
468
466
|
/** 获取文件列表 */
|
|
469
|
-
getFileList: () =>
|
|
470
|
-
}), (
|
|
471
|
-
const
|
|
472
|
-
return
|
|
473
|
-
modelValue:
|
|
474
|
-
"onUpdate:modelValue":
|
|
475
|
-
},
|
|
476
|
-
"max-size":
|
|
477
|
-
accept:
|
|
478
|
-
"before-read":
|
|
479
|
-
"after-read":
|
|
480
|
-
onDelete:
|
|
467
|
+
getFileList: () => i.value
|
|
468
|
+
}), (u, c) => {
|
|
469
|
+
const f = V("van-uploader");
|
|
470
|
+
return k(), T(f, X({
|
|
471
|
+
modelValue: i.value,
|
|
472
|
+
"onUpdate:modelValue": c[0] || (c[0] = (a) => i.value = a)
|
|
473
|
+
}, u.$attrs, {
|
|
474
|
+
"max-size": n.maxSize,
|
|
475
|
+
accept: n.accept,
|
|
476
|
+
"before-read": v,
|
|
477
|
+
"after-read": N,
|
|
478
|
+
onDelete: F
|
|
481
479
|
}), null, 16, ["modelValue", "max-size", "accept"]);
|
|
482
480
|
};
|
|
483
481
|
}
|
|
484
|
-
}),
|
|
485
|
-
|
|
486
|
-
|
|
482
|
+
}), D = /* @__PURE__ */ q(ne, [["__scopeId", "data-v-c8221cd8"]]);
|
|
483
|
+
D.install = (n) => {
|
|
484
|
+
n.component(D.name || "VtkUploader", D);
|
|
487
485
|
};
|
|
488
|
-
const
|
|
486
|
+
const oe = { class: "file-preview-container" }, re = { class: "file-header" }, se = { class: "file-title" }, ue = { class: "file-content" }, ie = {
|
|
489
487
|
key: 0,
|
|
490
488
|
class: "image-preview"
|
|
491
|
-
},
|
|
489
|
+
}, de = { class: "image-footer" }, ce = { class: "file-info" }, pe = {
|
|
492
490
|
key: 1,
|
|
493
491
|
class: "pdf-preview"
|
|
494
|
-
},
|
|
492
|
+
}, me = {
|
|
495
493
|
key: 1,
|
|
496
494
|
class: "pdf-placeholder"
|
|
497
|
-
},
|
|
495
|
+
}, fe = { class: "pdf-footer" }, ve = { class: "page-info" }, ge = { class: "footer" }, ye = /* @__PURE__ */ Object.assign({
|
|
498
496
|
name: "VtkPreview"
|
|
499
497
|
}, {
|
|
500
498
|
__name: "index",
|
|
@@ -513,145 +511,145 @@ const de = { class: "file-preview-container" }, ce = { class: "file-header" }, m
|
|
|
513
511
|
}
|
|
514
512
|
},
|
|
515
513
|
emits: ["update:modelValue", "close"],
|
|
516
|
-
setup(
|
|
517
|
-
const
|
|
518
|
-
if (typeof
|
|
519
|
-
const
|
|
514
|
+
setup(n, { emit: _ }) {
|
|
515
|
+
const r = n, d = _, m = C(r.modelValue), i = C(r.startIndex), t = C(1), o = C(null), s = C(0), y = L(() => r.files.map((e, l) => {
|
|
516
|
+
if (typeof e == "string") {
|
|
517
|
+
const p = e.toLowerCase().endsWith(".pdf");
|
|
520
518
|
return {
|
|
521
|
-
name:
|
|
522
|
-
url:
|
|
523
|
-
type:
|
|
519
|
+
name: p ? `文档${l + 1}.pdf` : `图片${l + 1}`,
|
|
520
|
+
url: e,
|
|
521
|
+
type: p ? "pdf" : "image"
|
|
524
522
|
};
|
|
525
523
|
}
|
|
526
|
-
return
|
|
527
|
-
})),
|
|
528
|
-
if (!
|
|
529
|
-
const
|
|
530
|
-
return typeof
|
|
524
|
+
return e;
|
|
525
|
+
})), v = L(() => y.value[i.value] || null), g = L(() => {
|
|
526
|
+
if (!v.value) return null;
|
|
527
|
+
const e = v.value.url || v.value;
|
|
528
|
+
return typeof e == "string" ? e.toLowerCase().endsWith(".pdf") ? "pdf" : "image" : v.value.type || "image";
|
|
531
529
|
});
|
|
532
|
-
|
|
533
|
-
() =>
|
|
534
|
-
(
|
|
535
|
-
|
|
530
|
+
z(
|
|
531
|
+
() => r.modelValue,
|
|
532
|
+
(e) => {
|
|
533
|
+
m.value = e, e && y.value.length > 0 && (i.value = r.startIndex, N());
|
|
536
534
|
}
|
|
537
|
-
),
|
|
538
|
-
() =>
|
|
539
|
-
(
|
|
540
|
-
|
|
535
|
+
), z(
|
|
536
|
+
() => r.startIndex,
|
|
537
|
+
(e) => {
|
|
538
|
+
i.value = e, N();
|
|
541
539
|
}
|
|
542
|
-
),
|
|
543
|
-
|
|
544
|
-
}),
|
|
545
|
-
|
|
540
|
+
), z(m, (e) => {
|
|
541
|
+
d("update:modelValue", e), e || a();
|
|
542
|
+
}), z(i, () => {
|
|
543
|
+
t.value = 1, s.value = 0, N();
|
|
546
544
|
});
|
|
547
|
-
const
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
},
|
|
551
|
-
s.value =
|
|
552
|
-
},
|
|
545
|
+
const N = () => {
|
|
546
|
+
const e = v.value;
|
|
547
|
+
e && (g.value === "pdf" ? o.value = e.url || e : o.value = null);
|
|
548
|
+
}, F = (e) => {
|
|
549
|
+
s.value = e.numPages || 0;
|
|
550
|
+
}, u = () => {
|
|
553
551
|
console.log("PDF rendered successfully");
|
|
554
|
-
},
|
|
555
|
-
|
|
556
|
-
},
|
|
557
|
-
|
|
558
|
-
},
|
|
559
|
-
|
|
552
|
+
}, c = () => {
|
|
553
|
+
i.value > 0 && i.value--;
|
|
554
|
+
}, f = () => {
|
|
555
|
+
i.value < y.value.length - 1 && i.value++;
|
|
556
|
+
}, a = () => {
|
|
557
|
+
m.value = !1, o.value = null, t.value = 1, s.value = 0, d("close");
|
|
560
558
|
};
|
|
561
|
-
return (
|
|
562
|
-
const
|
|
563
|
-
return
|
|
564
|
-
show:
|
|
565
|
-
"onUpdate:show":
|
|
559
|
+
return (e, l) => {
|
|
560
|
+
const p = V("van-icon"), w = V("van-image"), b = V("van-button"), R = V("van-popup");
|
|
561
|
+
return k(), T(R, {
|
|
562
|
+
show: m.value,
|
|
563
|
+
"onUpdate:show": l[2] || (l[2] = (h) => m.value = h),
|
|
566
564
|
position: "bottom",
|
|
567
565
|
style: { height: "100vh" }
|
|
568
566
|
}, {
|
|
569
567
|
default: A(() => {
|
|
570
|
-
var
|
|
568
|
+
var h, G;
|
|
571
569
|
return [
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
x(
|
|
570
|
+
S("div", oe, [
|
|
571
|
+
S("div", re, [
|
|
572
|
+
S("div", se, j(((h = v.value) == null ? void 0 : h.name) || "文件预览"), 1),
|
|
573
|
+
x(p, {
|
|
576
574
|
name: "cross",
|
|
577
575
|
size: "20",
|
|
578
|
-
onClick:
|
|
576
|
+
onClick: a
|
|
579
577
|
})
|
|
580
578
|
]),
|
|
581
|
-
|
|
582
|
-
g.value === "image" ? (
|
|
583
|
-
x(
|
|
584
|
-
src: (
|
|
579
|
+
S("div", ue, [
|
|
580
|
+
g.value === "image" ? (k(), P("div", ie, [
|
|
581
|
+
x(w, {
|
|
582
|
+
src: (G = v.value) == null ? void 0 : G.url,
|
|
585
583
|
fit: "contain",
|
|
586
584
|
class: "preview-image"
|
|
587
585
|
}, null, 8, ["src"]),
|
|
588
|
-
|
|
589
|
-
x(
|
|
586
|
+
S("div", de, [
|
|
587
|
+
x(b, {
|
|
590
588
|
size: "small",
|
|
591
|
-
disabled:
|
|
592
|
-
onClick:
|
|
589
|
+
disabled: i.value <= 0,
|
|
590
|
+
onClick: c
|
|
593
591
|
}, {
|
|
594
|
-
default: A(() => [...
|
|
595
|
-
|
|
592
|
+
default: A(() => [...l[3] || (l[3] = [
|
|
593
|
+
$("上一个", -1)
|
|
596
594
|
])]),
|
|
597
595
|
_: 1
|
|
598
596
|
}, 8, ["disabled"]),
|
|
599
|
-
|
|
600
|
-
x(
|
|
597
|
+
S("span", ce, j(i.value + 1) + " / " + j(n.files.length), 1),
|
|
598
|
+
x(b, {
|
|
601
599
|
size: "small",
|
|
602
|
-
disabled:
|
|
603
|
-
onClick:
|
|
600
|
+
disabled: i.value >= n.files.length - 1,
|
|
601
|
+
onClick: f
|
|
604
602
|
}, {
|
|
605
|
-
default: A(() => [...
|
|
606
|
-
|
|
603
|
+
default: A(() => [...l[4] || (l[4] = [
|
|
604
|
+
$("下一个", -1)
|
|
607
605
|
])]),
|
|
608
606
|
_: 1
|
|
609
607
|
}, 8, ["disabled"])
|
|
610
608
|
])
|
|
611
|
-
])) : g.value === "pdf" ? (
|
|
612
|
-
|
|
609
|
+
])) : g.value === "pdf" ? (k(), P("div", pe, [
|
|
610
|
+
o.value ? (k(), T(Z(ae), {
|
|
613
611
|
key: 0,
|
|
614
|
-
source:
|
|
615
|
-
page:
|
|
612
|
+
source: o.value,
|
|
613
|
+
page: t.value,
|
|
616
614
|
class: "pdf-embed-preview",
|
|
617
|
-
onRendered:
|
|
618
|
-
onLoaded:
|
|
619
|
-
}, null, 8, ["source", "page"])) : (
|
|
620
|
-
|
|
621
|
-
x(
|
|
615
|
+
onRendered: u,
|
|
616
|
+
onLoaded: F
|
|
617
|
+
}, null, 8, ["source", "page"])) : (k(), P("div", me, "请选择PDF文件")),
|
|
618
|
+
S("div", fe, [
|
|
619
|
+
x(b, {
|
|
622
620
|
size: "small",
|
|
623
|
-
disabled:
|
|
624
|
-
onClick:
|
|
621
|
+
disabled: t.value <= 1,
|
|
622
|
+
onClick: l[0] || (l[0] = (Y) => t.value--)
|
|
625
623
|
}, {
|
|
626
|
-
default: A(() => [...
|
|
627
|
-
|
|
624
|
+
default: A(() => [...l[5] || (l[5] = [
|
|
625
|
+
$("上一页", -1)
|
|
628
626
|
])]),
|
|
629
627
|
_: 1
|
|
630
628
|
}, 8, ["disabled"]),
|
|
631
|
-
|
|
632
|
-
x(
|
|
629
|
+
S("span", ve, "第 " + j(t.value) + " / " + j(s.value || "?") + " 页", 1),
|
|
630
|
+
x(b, {
|
|
633
631
|
size: "small",
|
|
634
|
-
disabled: !
|
|
635
|
-
onClick:
|
|
632
|
+
disabled: !o.value || t.value >= s.value,
|
|
633
|
+
onClick: l[1] || (l[1] = (Y) => t.value++)
|
|
636
634
|
}, {
|
|
637
|
-
default: A(() => [...
|
|
638
|
-
|
|
635
|
+
default: A(() => [...l[6] || (l[6] = [
|
|
636
|
+
$("下一页", -1)
|
|
639
637
|
])]),
|
|
640
638
|
_: 1
|
|
641
639
|
}, 8, ["disabled"])
|
|
642
640
|
])
|
|
643
|
-
])) :
|
|
644
|
-
|
|
645
|
-
x(
|
|
646
|
-
disabled:
|
|
647
|
-
onClick:
|
|
641
|
+
])) : O("", !0),
|
|
642
|
+
S("div", ge, [
|
|
643
|
+
x(b, {
|
|
644
|
+
disabled: i.value <= 0,
|
|
645
|
+
onClick: c,
|
|
648
646
|
icon: "arrow-left",
|
|
649
647
|
type: "primary",
|
|
650
648
|
round: ""
|
|
651
649
|
}, null, 8, ["disabled"]),
|
|
652
|
-
x(
|
|
653
|
-
disabled:
|
|
654
|
-
onClick:
|
|
650
|
+
x(b, {
|
|
651
|
+
disabled: i.value >= n.files.length - 1,
|
|
652
|
+
onClick: f,
|
|
655
653
|
icon: "arrow",
|
|
656
654
|
type: "primary",
|
|
657
655
|
round: ""
|
|
@@ -665,37 +663,37 @@ const de = { class: "file-preview-container" }, ce = { class: "file-header" }, m
|
|
|
665
663
|
}, 8, ["show"]);
|
|
666
664
|
};
|
|
667
665
|
}
|
|
668
|
-
}),
|
|
669
|
-
|
|
670
|
-
|
|
666
|
+
}), B = /* @__PURE__ */ q(ye, [["__scopeId", "data-v-1ad2c749"]]);
|
|
667
|
+
B.install = (n) => {
|
|
668
|
+
n.component(B.name || "VtkPreview", B);
|
|
671
669
|
};
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
|
|
670
|
+
const he = [
|
|
671
|
+
U,
|
|
672
|
+
I,
|
|
675
673
|
M,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
],
|
|
679
|
-
|
|
680
|
-
|
|
674
|
+
D,
|
|
675
|
+
B
|
|
676
|
+
], _e = (n) => {
|
|
677
|
+
he.forEach((_) => {
|
|
678
|
+
_.install ? n.use(_) : _.name && n.component(_.name, _);
|
|
681
679
|
});
|
|
682
|
-
},
|
|
683
|
-
install:
|
|
680
|
+
}, ke = {
|
|
681
|
+
install: _e,
|
|
684
682
|
// 也导出所有组件,方便直接访问
|
|
685
|
-
Checkbox:
|
|
686
|
-
Area:
|
|
683
|
+
Checkbox: U,
|
|
684
|
+
Area: I,
|
|
687
685
|
Radio: M,
|
|
688
|
-
Uploader:
|
|
689
|
-
Preview:
|
|
690
|
-
},
|
|
686
|
+
Uploader: D,
|
|
687
|
+
Preview: B
|
|
688
|
+
}, Ce = "1.0.0";
|
|
691
689
|
export {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
690
|
+
I as Area,
|
|
691
|
+
U as Checkbox,
|
|
692
|
+
B as Preview,
|
|
695
693
|
M as Radio,
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
694
|
+
D as Uploader,
|
|
695
|
+
ke as default,
|
|
696
|
+
_e as install,
|
|
697
|
+
Ce as version
|
|
700
698
|
};
|
|
701
699
|
//# sourceMappingURL=vant-vtk.es.js.map
|