vft 0.0.333 → 0.0.335
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/index.css +1 -1
- package/es/components/input-tag/input-tag.vue2.js +24 -24
- package/es/components/upload/index.d.ts +72 -18
- package/es/components/upload/types.d.ts +17 -2
- package/es/components/upload/upload-content.vue.d.ts +10 -1
- package/es/components/upload/upload-content.vue2.js +103 -80
- package/es/components/upload/upload.vue.d.ts +22 -13
- package/es/components/upload/upload.vue2.js +201 -73
- package/es/components/upload/use-handlers.js +69 -61
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/input-tag/input-tag.vue2.cjs +1 -1
- package/lib/components/upload/index.d.ts +72 -18
- package/lib/components/upload/types.d.ts +17 -2
- package/lib/components/upload/upload-content.vue.d.ts +10 -1
- package/lib/components/upload/upload-content.vue2.cjs +1 -1
- package/lib/components/upload/upload.vue.d.ts +22 -13
- package/lib/components/upload/upload.vue2.cjs +1 -1
- package/lib/components/upload/use-handlers.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +5 -5
- package/theme-style/index.css +1 -1
- package/theme-style/src/input-tag.scss +4 -0
- package/theme-style/vft-input-tag.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,15 +1,122 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as E, useSlots as T, shallowRef as V, computed as b, onBeforeUnmount as j, provide as N, toRef as O, createElementBlock as q, openBlock as u, normalizeClass as D, unref as o, createBlock as v, createCommentVNode as t, renderSlot as r, createSlots as B, withCtx as a, createVNode as H, mergeProps as S } from "vue";
|
|
2
|
+
import "../alert/index.js";
|
|
3
|
+
import "../avatar/index.js";
|
|
4
|
+
import "../avatar-stack/index.js";
|
|
5
|
+
import "../backtop/index.js";
|
|
6
|
+
import "../button/index.js";
|
|
7
|
+
import "../card/index.js";
|
|
8
|
+
import "../cascader/index.js";
|
|
9
|
+
import "../cascader-panel/index.js";
|
|
10
|
+
import "../check-tag/index.js";
|
|
11
|
+
import "../checkbox/index.js";
|
|
12
|
+
import "../clamp/index.js";
|
|
13
|
+
import "../clamp-toggle/index.js";
|
|
14
|
+
import "../clamp-tooltip/index.js";
|
|
15
|
+
import "../col/index.js";
|
|
16
|
+
import "../collapse-transition/index.js";
|
|
17
|
+
import "../color-picker/index.js";
|
|
18
|
+
import "../config-provider/index.js";
|
|
19
|
+
import "../container/index.js";
|
|
20
|
+
import "@vft/utils";
|
|
21
|
+
import "../context-menu/context-menu.vue2.js";
|
|
22
|
+
import "../icon/index.js";
|
|
23
|
+
import "../date-picker/index.js";
|
|
24
|
+
import "../date-time-select/index.js";
|
|
25
|
+
import "../descriptions/index.js";
|
|
26
|
+
import "../dialog/index.js";
|
|
27
|
+
import "../divider/index.js";
|
|
28
|
+
import "../drawer/index.js";
|
|
29
|
+
import "../dropdown/index.js";
|
|
30
|
+
import "../empty/index.js";
|
|
31
|
+
import "../footer-layout/index.js";
|
|
2
32
|
import "../form/index.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
33
|
+
import "../full-screen/index.js";
|
|
34
|
+
import "../header-layout/index.js";
|
|
35
|
+
import "../horizontal-menu/index.js";
|
|
36
|
+
import "../icon-text/index.js";
|
|
37
|
+
import "../iframe-layout/index.js";
|
|
38
|
+
import "../image/index.js";
|
|
39
|
+
import "../image-viewer/index.js";
|
|
40
|
+
import "../input/index.js";
|
|
41
|
+
import "../input-number/index.js";
|
|
42
|
+
import "../link/index.js";
|
|
43
|
+
import "../list-cell/index.js";
|
|
44
|
+
import "../logo/index.js";
|
|
45
|
+
import "../menu/index.js";
|
|
46
|
+
import "../multiple-tabs/index.js";
|
|
47
|
+
import "../notification/index.js";
|
|
48
|
+
import "../overlay/index.js";
|
|
49
|
+
import "../page-wrapper/index.js";
|
|
50
|
+
import "../pagination/index.js";
|
|
51
|
+
import "../popconfirm/index.js";
|
|
52
|
+
import "../popover/index.js";
|
|
53
|
+
import "../popper/index.js";
|
|
54
|
+
import "../qrcode/index.js";
|
|
55
|
+
import "../radio/index.js";
|
|
56
|
+
import "../result/index.js";
|
|
57
|
+
import "../router-view-content/index.js";
|
|
58
|
+
import "../row/index.js";
|
|
59
|
+
import "../scrollbar/index.js";
|
|
60
|
+
import "../search/index.js";
|
|
61
|
+
import "../select/index.js";
|
|
62
|
+
import "../side-menu/index.js";
|
|
63
|
+
import "../skeleton/index.js";
|
|
64
|
+
import "../slider/index.js";
|
|
65
|
+
import "../space/index.js";
|
|
66
|
+
import "../steps/index.js";
|
|
67
|
+
import "../switch/index.js";
|
|
68
|
+
import "../table/index.js";
|
|
69
|
+
import "../tabs/index.js";
|
|
70
|
+
import "../tag/index.js";
|
|
71
|
+
import "../time-picker/index.js";
|
|
72
|
+
import "../tooltip/index.js";
|
|
73
|
+
import "../tree/index.js";
|
|
74
|
+
import "../verify-code/index.js";
|
|
75
|
+
import "../virtual-list/components/fixed-size-list.js";
|
|
76
|
+
import "../virtual-list/components/dynamic-size-list.js";
|
|
77
|
+
import "../virtual-list/components/fixed-size-grid.js";
|
|
78
|
+
import "../virtual-list/components/dynamic-size-grid.js";
|
|
79
|
+
import "../virtual-list/props.js";
|
|
80
|
+
import "../autocomplete/index.js";
|
|
81
|
+
import "../breadcrumb/index.js";
|
|
82
|
+
import "../carousel/index.js";
|
|
83
|
+
import "../collapse/index.js";
|
|
84
|
+
import "../countdown/index.js";
|
|
85
|
+
import "../input-tag/index.js";
|
|
86
|
+
import "../modal/index.js";
|
|
87
|
+
import "../progress/index.js";
|
|
88
|
+
import "../segmented/index.js";
|
|
89
|
+
import "../statistic/index.js";
|
|
90
|
+
import "../super-form/index.js";
|
|
91
|
+
import "../timeline/index.js";
|
|
92
|
+
import "../transfer/index.js";
|
|
93
|
+
import "./index.js";
|
|
94
|
+
import "../watermark/index.js";
|
|
95
|
+
import "../md-code-demo/index.js";
|
|
96
|
+
import "../md-code-tabs/index.js";
|
|
97
|
+
import "../md-comment/index.js";
|
|
98
|
+
import "../md-container/index.js";
|
|
99
|
+
import "../md-tabs/index.js";
|
|
100
|
+
import "../md-vue-playground/index.js";
|
|
101
|
+
import "../infinite-scroll/index.js";
|
|
102
|
+
import "@vueuse/core";
|
|
103
|
+
import "../config-provider/hooks/use-global-config.js";
|
|
104
|
+
import "lodash-es";
|
|
105
|
+
import "../../hooks/use-model-toggle/index.js";
|
|
106
|
+
import "@popperjs/core";
|
|
107
|
+
import "../../hooks/use-z-index/index.js";
|
|
108
|
+
import { VftMessage as I } from "../message/index.js";
|
|
109
|
+
import "../progress-i/index.js";
|
|
110
|
+
import { ajaxUpload as K } from "./ajax.js";
|
|
111
|
+
import { uploadContextKey as W } from "./constants.js";
|
|
112
|
+
import $ from "./upload-content.vue2.js";
|
|
113
|
+
import C from "./upload-list.vue2.js";
|
|
114
|
+
import { useHandlers as A } from "./use-handlers.js";
|
|
115
|
+
import { useFormDisabled as G } from "../form/hooks/use-form-common-props.js";
|
|
116
|
+
const J = E({
|
|
10
117
|
name: "vft-upload"
|
|
11
|
-
}),
|
|
12
|
-
...
|
|
118
|
+
}), tt = /* @__PURE__ */ E({
|
|
119
|
+
...J,
|
|
13
120
|
props: {
|
|
14
121
|
action: { default: "#" },
|
|
15
122
|
headers: {},
|
|
@@ -25,9 +132,12 @@ const A = w({
|
|
|
25
132
|
fileList: { default: [] },
|
|
26
133
|
autoUpload: { type: Boolean, default: !1 },
|
|
27
134
|
listType: { default: "text" },
|
|
28
|
-
httpRequest: { type: Function, default:
|
|
135
|
+
httpRequest: { type: Function, default: K },
|
|
29
136
|
disabled: { type: Boolean },
|
|
30
137
|
limit: {},
|
|
138
|
+
replaceOnLimit: { type: Boolean, default: !1 },
|
|
139
|
+
maxSize: { default: void 0 },
|
|
140
|
+
sizeExceedMessage: { default: "文件大小超出限制" },
|
|
31
141
|
beforeUpload: {},
|
|
32
142
|
beforeRemove: {},
|
|
33
143
|
onRemove: {},
|
|
@@ -37,60 +147,78 @@ const A = w({
|
|
|
37
147
|
onProgress: {},
|
|
38
148
|
onError: {},
|
|
39
149
|
onExceed: { type: Function, default: () => {
|
|
40
|
-
} }
|
|
150
|
+
} },
|
|
151
|
+
onSizeExceed: {}
|
|
41
152
|
},
|
|
42
|
-
setup(
|
|
43
|
-
const i =
|
|
44
|
-
abort:
|
|
45
|
-
submit:
|
|
46
|
-
clearFiles:
|
|
47
|
-
uploadFiles:
|
|
48
|
-
handleStart:
|
|
153
|
+
setup(F, { expose: L }) {
|
|
154
|
+
const i = F, p = T(), c = G(), s = V(), {
|
|
155
|
+
abort: y,
|
|
156
|
+
submit: g,
|
|
157
|
+
clearFiles: h,
|
|
158
|
+
uploadFiles: m,
|
|
159
|
+
handleStart: w,
|
|
49
160
|
handleError: P,
|
|
50
|
-
handleRemove:
|
|
51
|
-
handleSuccess:
|
|
52
|
-
handleProgress:
|
|
53
|
-
} =
|
|
161
|
+
handleRemove: n,
|
|
162
|
+
handleSuccess: z,
|
|
163
|
+
handleProgress: M
|
|
164
|
+
} = A(i, s), d = b(() => i.listType === "picture-card"), U = {
|
|
165
|
+
abort: y,
|
|
166
|
+
submit: g,
|
|
167
|
+
clearFiles: h,
|
|
168
|
+
uploadFiles: m,
|
|
169
|
+
uploadRef: s
|
|
170
|
+
}, k = b(() => ({
|
|
54
171
|
...i,
|
|
55
|
-
fileList:
|
|
56
|
-
onStart:
|
|
57
|
-
onProgress:
|
|
58
|
-
onSuccess:
|
|
172
|
+
fileList: m.value,
|
|
173
|
+
onStart: w,
|
|
174
|
+
onProgress: M,
|
|
175
|
+
onSuccess: z,
|
|
59
176
|
onError: P,
|
|
60
|
-
onRemove:
|
|
177
|
+
onRemove: n,
|
|
178
|
+
onChange: (e, l) => {
|
|
179
|
+
i.onChange?.(e, l, U);
|
|
180
|
+
},
|
|
181
|
+
onSizeExceed: (e, l) => {
|
|
182
|
+
if (i.onSizeExceed)
|
|
183
|
+
i.onSizeExceed?.(e, l);
|
|
184
|
+
else {
|
|
185
|
+
const R = `文件大小不能超过 ${(l / 1048576).toFixed(2)}MB`;
|
|
186
|
+
console.warn("默认文件大小超出提示:", R), I.warning(R);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
61
189
|
}));
|
|
62
190
|
return j(() => {
|
|
63
|
-
|
|
191
|
+
m.value.forEach(({ url: e }) => {
|
|
64
192
|
e?.startsWith("blob:") && URL.revokeObjectURL(e);
|
|
65
193
|
});
|
|
66
|
-
}), N(
|
|
67
|
-
accept:
|
|
68
|
-
}),
|
|
69
|
-
abort:
|
|
70
|
-
submit:
|
|
71
|
-
clearFiles:
|
|
72
|
-
handleStart:
|
|
73
|
-
handleRemove:
|
|
74
|
-
fileList:
|
|
75
|
-
}), (e,
|
|
76
|
-
class:
|
|
194
|
+
}), N(W, {
|
|
195
|
+
accept: O(i, "accept")
|
|
196
|
+
}), L({
|
|
197
|
+
abort: y,
|
|
198
|
+
submit: g,
|
|
199
|
+
clearFiles: h,
|
|
200
|
+
handleStart: w,
|
|
201
|
+
handleRemove: n,
|
|
202
|
+
fileList: m
|
|
203
|
+
}), (e, l) => (u(), q("div", {
|
|
204
|
+
class: D(["vft-upload-wrapper", { disabled: o(c) }])
|
|
77
205
|
}, [
|
|
78
|
-
|
|
206
|
+
d.value && e.showFileList ? (u(), v(C, {
|
|
79
207
|
key: 0,
|
|
80
|
-
disabled:
|
|
208
|
+
disabled: o(c),
|
|
81
209
|
"list-type": e.listType,
|
|
82
|
-
files:
|
|
210
|
+
files: o(m),
|
|
83
211
|
"handle-preview": e.onPreview,
|
|
84
|
-
onRemove:
|
|
85
|
-
},
|
|
86
|
-
append:
|
|
87
|
-
|
|
212
|
+
onRemove: o(n)
|
|
213
|
+
}, B({
|
|
214
|
+
append: a(() => [
|
|
215
|
+
H($, S({
|
|
88
216
|
ref_key: "uploadRef",
|
|
89
|
-
ref:
|
|
90
|
-
},
|
|
91
|
-
default:
|
|
92
|
-
|
|
93
|
-
!
|
|
217
|
+
ref: s
|
|
218
|
+
}, k.value), {
|
|
219
|
+
default: a(() => [
|
|
220
|
+
o(p).trigger ? r(e.$slots, "trigger", { key: 0 }) : t("", !0),
|
|
221
|
+
!o(p).trigger && o(p).default ? r(e.$slots, "default", { key: 1 }) : t("", !0)
|
|
94
222
|
]),
|
|
95
223
|
_: 3
|
|
96
224
|
}, 16)
|
|
@@ -99,44 +227,44 @@ const A = w({
|
|
|
99
227
|
}, [
|
|
100
228
|
e.$slots.file ? {
|
|
101
229
|
name: "default",
|
|
102
|
-
fn:
|
|
103
|
-
|
|
230
|
+
fn: a(({ file: f }) => [
|
|
231
|
+
r(e.$slots, "file", { file: f })
|
|
104
232
|
]),
|
|
105
233
|
key: "0"
|
|
106
234
|
} : void 0
|
|
107
|
-
]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) :
|
|
108
|
-
!
|
|
235
|
+
]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : t("", !0),
|
|
236
|
+
!d.value || d.value && !e.showFileList ? (u(), v($, S({
|
|
109
237
|
key: 1,
|
|
110
238
|
ref_key: "uploadRef",
|
|
111
|
-
ref:
|
|
112
|
-
},
|
|
113
|
-
default:
|
|
114
|
-
|
|
115
|
-
!
|
|
239
|
+
ref: s
|
|
240
|
+
}, k.value), {
|
|
241
|
+
default: a(() => [
|
|
242
|
+
o(p).trigger ? r(e.$slots, "trigger", { key: 0 }) : t("", !0),
|
|
243
|
+
!o(p).trigger && o(p).default ? r(e.$slots, "default", { key: 1 }) : t("", !0)
|
|
116
244
|
]),
|
|
117
245
|
_: 3
|
|
118
|
-
}, 16)) :
|
|
119
|
-
e.$slots.trigger ?
|
|
120
|
-
|
|
121
|
-
!
|
|
246
|
+
}, 16)) : t("", !0),
|
|
247
|
+
e.$slots.trigger ? r(e.$slots, "default", { key: 2 }) : t("", !0),
|
|
248
|
+
r(e.$slots, "tip"),
|
|
249
|
+
!d.value && e.showFileList ? (u(), v(C, {
|
|
122
250
|
key: 3,
|
|
123
|
-
disabled:
|
|
251
|
+
disabled: o(c),
|
|
124
252
|
"list-type": e.listType,
|
|
125
|
-
files:
|
|
253
|
+
files: o(m),
|
|
126
254
|
"handle-preview": e.onPreview,
|
|
127
|
-
onRemove:
|
|
128
|
-
},
|
|
255
|
+
onRemove: o(n)
|
|
256
|
+
}, B({ _: 2 }, [
|
|
129
257
|
e.$slots.file ? {
|
|
130
258
|
name: "default",
|
|
131
|
-
fn:
|
|
132
|
-
|
|
259
|
+
fn: a(({ file: f }) => [
|
|
260
|
+
r(e.$slots, "file", { file: f })
|
|
133
261
|
]),
|
|
134
262
|
key: "0"
|
|
135
263
|
} : void 0
|
|
136
|
-
]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) :
|
|
264
|
+
]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : t("", !0)
|
|
137
265
|
], 2));
|
|
138
266
|
}
|
|
139
267
|
});
|
|
140
268
|
export {
|
|
141
|
-
|
|
269
|
+
tt as default
|
|
142
270
|
};
|
|
@@ -1,38 +1,44 @@
|
|
|
1
|
-
import { useVModel as
|
|
1
|
+
import { useVModel as O } from "@vueuse/core";
|
|
2
2
|
import "@vft/utils";
|
|
3
|
-
import { throwError as U, debugWarn as
|
|
3
|
+
import { throwError as U, debugWarn as F } from "../../utils/error.js";
|
|
4
4
|
import "../config-provider/hooks/use-global-config.js";
|
|
5
|
-
import { watch as
|
|
6
|
-
import { isNil as
|
|
7
|
-
import { genFileId as
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
const
|
|
12
|
-
|
|
5
|
+
import { watch as f } from "vue";
|
|
6
|
+
import { isNil as j } from "lodash-es";
|
|
7
|
+
import { genFileId as m } from "./constants.js";
|
|
8
|
+
const h = "VftUpload", b = (u) => {
|
|
9
|
+
u.url?.startsWith("blob:") && URL.revokeObjectURL(u.url);
|
|
10
|
+
}, z = (u, i) => {
|
|
11
|
+
const r = O(
|
|
12
|
+
u,
|
|
13
13
|
"fileList",
|
|
14
14
|
void 0,
|
|
15
15
|
{ passive: !0 }
|
|
16
|
-
),
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
), c = (e) => r.value.find((t) => t.uid === e.uid), s = {
|
|
17
|
+
abort: l,
|
|
18
|
+
submit: v,
|
|
19
|
+
clearFiles: d,
|
|
20
|
+
uploadFiles: r,
|
|
21
|
+
uploadRef: i
|
|
22
|
+
};
|
|
23
|
+
function l(e) {
|
|
24
|
+
i.value?.abort(e);
|
|
19
25
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
26
|
+
function d(e = ["ready", "uploading", "success", "fail"]) {
|
|
27
|
+
r.value = r.value.filter(
|
|
22
28
|
(t) => !e.includes(t.status)
|
|
23
29
|
);
|
|
24
30
|
}
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
31
|
+
const g = (e, t) => {
|
|
32
|
+
const a = c(t);
|
|
33
|
+
a && (console.error(e), a.status = "fail", r.value.splice(r.value.indexOf(a), 1), u.onError?.(e, a, r.value), u.onChange?.(a, r.value, s));
|
|
34
|
+
}, L = (e, t) => {
|
|
35
|
+
const a = c(t);
|
|
36
|
+
a && (u.onProgress?.(e, a, r.value), a.status = "uploading", a.percentage = Math.round(e.percent));
|
|
37
|
+
}, R = (e, t) => {
|
|
38
|
+
const a = c(t);
|
|
39
|
+
a && (a.status = "success", a.response = e, u.onSuccess?.(e, a, r.value), u.onChange?.(a, r.value, s));
|
|
40
|
+
}, y = (e) => {
|
|
41
|
+
j(e.uid) && (e.uid = m());
|
|
36
42
|
const t = {
|
|
37
43
|
name: e.name,
|
|
38
44
|
percentage: 0,
|
|
@@ -41,61 +47,63 @@ const v = "VftUpload", O = (o) => {
|
|
|
41
47
|
raw: e,
|
|
42
48
|
uid: e.uid
|
|
43
49
|
};
|
|
44
|
-
if (
|
|
50
|
+
if (u.listType === "picture-card" || u.listType === "picture")
|
|
45
51
|
try {
|
|
46
52
|
t.url = URL.createObjectURL(e);
|
|
47
|
-
} catch (
|
|
48
|
-
|
|
53
|
+
} catch (a) {
|
|
54
|
+
F(h, a.message), u.onError?.(a, t, r.value);
|
|
49
55
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
u.limit === 1 && u.replaceOnLimit && r.value.length > 0 && (r.value.forEach((a) => {
|
|
57
|
+
b(a);
|
|
58
|
+
}), r.value = []), r.value = [...r.value, t], u.onChange?.(t, r.value, s);
|
|
59
|
+
}, E = async (e) => {
|
|
60
|
+
const t = e instanceof File ? c(e) : e;
|
|
61
|
+
t || U(h, "file to be removed not found");
|
|
62
|
+
const a = (n) => {
|
|
63
|
+
l(n);
|
|
64
|
+
const o = r.value;
|
|
65
|
+
o.splice(o.indexOf(n), 1), u.onRemove?.(n, o), b(n);
|
|
58
66
|
};
|
|
59
|
-
|
|
67
|
+
u.beforeRemove ? await u.beforeRemove(t, r.value) !== !1 && a(t) : a(t);
|
|
60
68
|
};
|
|
61
|
-
function
|
|
62
|
-
|
|
69
|
+
function v() {
|
|
70
|
+
r.value.filter(({ status: e }) => e === "ready").forEach(({ raw: e }) => e && i.value?.upload(e));
|
|
63
71
|
}
|
|
64
|
-
return
|
|
65
|
-
() =>
|
|
72
|
+
return f(
|
|
73
|
+
() => u.listType,
|
|
66
74
|
(e) => {
|
|
67
|
-
e !== "picture-card" && e !== "picture" || (
|
|
68
|
-
const { raw:
|
|
69
|
-
if (!
|
|
75
|
+
e !== "picture-card" && e !== "picture" || (r.value = r.value.map((t) => {
|
|
76
|
+
const { raw: a, url: n } = t;
|
|
77
|
+
if (!n && a)
|
|
70
78
|
try {
|
|
71
|
-
t.url = URL.createObjectURL(
|
|
72
|
-
} catch (
|
|
73
|
-
|
|
79
|
+
t.url = URL.createObjectURL(a);
|
|
80
|
+
} catch (o) {
|
|
81
|
+
u.onError?.(o, t, r.value);
|
|
74
82
|
}
|
|
75
83
|
return t;
|
|
76
84
|
}));
|
|
77
85
|
}
|
|
78
|
-
),
|
|
79
|
-
|
|
86
|
+
), f(
|
|
87
|
+
r,
|
|
80
88
|
(e) => {
|
|
81
89
|
if (e)
|
|
82
90
|
for (const t of e)
|
|
83
|
-
t.uid ||=
|
|
91
|
+
t.uid ||= m(), t.status ||= "success";
|
|
84
92
|
},
|
|
85
93
|
{ immediate: !0, deep: !0 }
|
|
86
94
|
), {
|
|
87
95
|
/** @description two-way binding ref from props `fileList` */
|
|
88
|
-
uploadFiles:
|
|
89
|
-
abort:
|
|
90
|
-
clearFiles:
|
|
91
|
-
handleError:
|
|
92
|
-
handleProgress:
|
|
93
|
-
handleStart:
|
|
94
|
-
handleSuccess:
|
|
95
|
-
handleRemove:
|
|
96
|
-
submit:
|
|
96
|
+
uploadFiles: r,
|
|
97
|
+
abort: l,
|
|
98
|
+
clearFiles: d,
|
|
99
|
+
handleError: g,
|
|
100
|
+
handleProgress: L,
|
|
101
|
+
handleStart: y,
|
|
102
|
+
handleSuccess: R,
|
|
103
|
+
handleRemove: E,
|
|
104
|
+
submit: v
|
|
97
105
|
};
|
|
98
106
|
};
|
|
99
107
|
export {
|
|
100
|
-
|
|
108
|
+
z as useHandlers
|
|
101
109
|
};
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),ae=require("../../hooks/use-attrs/index.cjs");require("@vueuse/core");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const S=require("../icon/index.cjs"),ae=require("../tag/index.cjs"),le=require("../../hooks/use-attrs/index.cjs");require("@vueuse/core");const se=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const ue=require("../../hooks/use-calc-input-width/index.cjs"),ie=require("./composables/use-drag-tag.cjs"),de=require("./composables/use-hovering.cjs"),fe=require("./composables/use-input-tag.cjs"),ce=require("./composables/use-input-tag-dom.cjs"),V=require("./input-tag.cjs"),w=require("../form/hooks/use-form-item.cjs"),pe=["id","minlength","maxlength","disabled","readonly","autocomplete","tabindex","placeholder","autofocus","ariaLabel"],me=["textContent"],ge=e.defineComponent({name:"VftInputTag",inheritAttrs:!1}),ve=e.defineComponent({...ge,props:V.inputTagProps,emits:V.inputTagEmits,setup(T,{expose:z,emit:B}){const i=T,E=B,M=le.useAttrs(),N=e.useSlots(),{form:R,formItem:d}=w.useFormItem(),{inputId:x}=w.useFormItemInputId(i,{formItemContext:d}),c=e.computed(()=>R?.statusIcon??!1),a=e.computed(()=>d?.validateState||""),$={validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"},p=e.computed(()=>a.value&&$[a.value]),{inputRef:F,wrapperRef:m,isFocused:L,inputValue:l,size:K,tagSize:P,placeholder:A,closable:g,disabled:v,handleDragged:H,handleInput:C,handleKeydown:I,handleRemoveTag:O,handleClear:U,handleCompositionStart:k,handleCompositionUpdate:y,handleCompositionEnd:h,focus:D,blur:j}=fe.useInputTag({props:i,emit:E,formItem:d}),{hovering:W,handleMouseEnter:b,handleMouseLeave:q}=de.useHovering(),{calculatorRef:G,inputStyle:J}=ue.useCalcInputWidth(),{dropIndicatorRef:Q,showDropIndicator:X,handleDragStart:Y,handleDragOver:Z,handleDragEnd:_}=ie.useDragTag({wrapperRef:m,handleDragged:H,afterDragged:D}),{ns:t,nsInput:f,containerKls:ee,containerStyle:ne,innerKls:re,showClear:oe,showSuffix:te}=ce.useInputTagDom({props:i,hovering:W,isFocused:L,inputValue:l,disabled:v,size:K,validateState:a,validateIcon:p,needStatusIcon:c});return z({focus:D,blur:j}),(o,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:m,class:e.normalizeClass(e.unref(ee)),style:e.normalizeStyle(e.unref(ne)),onMouseenter:n[7]||(n[7]=(...r)=>e.unref(b)&&e.unref(b)(...r)),onMouseleave:n[8]||(n[8]=(...r)=>e.unref(q)&&e.unref(q)(...r))},[e.unref(N).prefix?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).e("prefix"))},[e.renderSlot(o.$slots,"prefix")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(re))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.modelValue,(r,s)=>(e.openBlock(),e.createBlock(e.unref(ae.VftTag),{key:s,size:e.unref(P),closable:e.unref(g),type:o.tagType,effect:o.tagEffect,draggable:e.unref(g)&&o.draggable,"disable-transitions":"",onClose:u=>e.unref(O)(s),onDragstart:u=>e.unref(Y)(u,s),onDragover:u=>e.unref(Z)(u,s),onDragend:e.unref(_),onDrop:n[0]||(n[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"tag",{value:r,index:s},()=>[e.createTextVNode(e.toDisplayString(r),1)])]),_:2},1032,["size","closable","type","effect","draggable","onClose","onDragstart","onDragover","onDragend"]))),128)),e.createElementVNode("div",{class:e.normalizeClass(e.unref(t).e("input-wrapper"))},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(x),ref_key:"inputRef",ref:F,"onUpdate:modelValue":n[1]||(n[1]=r=>e.isRef(l)?l.value=r:null)},e.unref(M),{type:"text",minlength:o.minlength,maxlength:o.maxlength,disabled:e.unref(v),readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,placeholder:e.unref(A),autofocus:o.autofocus,ariaLabel:o.ariaLabel,class:e.unref(t).e("input"),style:e.unref(J),onCompositionstart:n[2]||(n[2]=(...r)=>e.unref(k)&&e.unref(k)(...r)),onCompositionupdate:n[3]||(n[3]=(...r)=>e.unref(y)&&e.unref(y)(...r)),onCompositionend:n[4]||(n[4]=(...r)=>e.unref(h)&&e.unref(h)(...r)),onInput:n[5]||(n[5]=(...r)=>e.unref(C)&&e.unref(C)(...r)),onKeydown:n[6]||(n[6]=(...r)=>e.unref(I)&&e.unref(I)(...r))}),null,16,pe),[[e.vModelText,e.unref(l)]]),e.createElementVNode("span",{ref_key:"calculatorRef",ref:G,"aria-hidden":"true",class:e.normalizeClass(e.unref(t).e("input-calculator")),textContent:e.toDisplayString(e.unref(l))},null,10,me)],2),e.withDirectives(e.createElementVNode("div",{ref_key:"dropIndicatorRef",ref:Q,class:e.normalizeClass(e.unref(t).e("drop-indicator"))},null,2),[[e.vShow,e.unref(X)]])],2),e.unref(te)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(t).e("suffix"))},[e.renderSlot(o.$slots,"suffix"),e.unref(oe)?(e.openBlock(),e.createBlock(e.unref(S.VftIcon),{key:0,class:e.normalizeClass([e.unref(t).e("icon"),e.unref(t).e("clear")]),onMousedown:e.withModifiers(e.unref(se.noop),["prevent"]),onClick:e.unref(U),icon:"icon-circle-close"},null,8,["class","onMousedown","onClick"])):e.createCommentVNode("",!0),a.value&&p.value&&c.value?(e.openBlock(),e.createBlock(e.unref(S.VftIcon),{key:1,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("validateIcon"),e.unref(f).is("loading",a.value==="validating")]),icon:"validateIcon"},null,8,["class"])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],38))}});exports.default=ve;
|