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