vft 0.0.334 → 0.0.337
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/carousel/use-carousel.js +1 -1
- package/es/components/input/input.vue2.js +4 -4
- package/es/components/input-tag/composables/use-input-tag.js +1 -1
- package/es/components/search/style/css.d.ts +1 -0
- package/es/components/search/style/css.js +1 -0
- package/es/components/search/style/index.d.ts +1 -0
- package/es/components/search/style/index.js +1 -0
- package/es/components/super-form/index.d.ts +15 -0
- package/es/components/super-form/super-form-item.vue2.js +1 -1
- package/es/components/super-form/super-form.vue.d.ts +1 -0
- package/es/components/super-form/super-form.vue2.js +3 -3
- package/es/components/super-form/types.d.ts +1 -0
- package/es/components/super-form/use/helper.js +53 -137
- 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/es/utils/vue/vnode.js +1 -1
- package/lib/components/input/input.vue2.cjs +1 -1
- package/lib/components/search/style/css.cjs +1 -1
- package/lib/components/search/style/css.d.ts +1 -0
- package/lib/components/search/style/index.cjs +1 -1
- package/lib/components/search/style/index.d.ts +1 -0
- package/lib/components/super-form/index.d.ts +15 -0
- package/lib/components/super-form/super-form.vue.d.ts +1 -0
- package/lib/components/super-form/super-form.vue2.cjs +1 -1
- package/lib/components/super-form/types.d.ts +1 -0
- package/lib/components/super-form/use/helper.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/checkbox.scss +46 -45
- package/theme-style/vft-checkbox.css +1 -1
- package/web-types.json +1 -1
|
@@ -15,6 +15,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
15
15
|
listType: string;
|
|
16
16
|
httpRequest: import("./types").UploadRequestHandler;
|
|
17
17
|
fileList: never[];
|
|
18
|
+
replaceOnLimit: boolean;
|
|
19
|
+
maxSize: undefined;
|
|
20
|
+
sizeExceedMessage: string;
|
|
18
21
|
}>>, {
|
|
19
22
|
abort: (file?: UploadFile) => void;
|
|
20
23
|
upload: (rawFile: UploadRawFile) => Promise<void>;
|
|
@@ -31,6 +34,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
31
34
|
listType: string;
|
|
32
35
|
httpRequest: import("./types").UploadRequestHandler;
|
|
33
36
|
fileList: never[];
|
|
37
|
+
replaceOnLimit: boolean;
|
|
38
|
+
maxSize: undefined;
|
|
39
|
+
sizeExceedMessage: string;
|
|
34
40
|
}>>> & Readonly<{}>, {
|
|
35
41
|
drag: boolean;
|
|
36
42
|
name: string;
|
|
@@ -38,12 +44,15 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
38
44
|
method: string;
|
|
39
45
|
multiple: boolean;
|
|
40
46
|
action: string;
|
|
47
|
+
fileList: import("./types").UploadUserFile[];
|
|
41
48
|
showFileList: boolean;
|
|
42
49
|
accept: string;
|
|
43
|
-
fileList: import("./types").UploadUserFile[];
|
|
44
50
|
autoUpload: boolean;
|
|
45
51
|
listType: import("./types").ListType;
|
|
46
52
|
httpRequest: import("./types").UploadRequestHandler;
|
|
53
|
+
replaceOnLimit: boolean;
|
|
54
|
+
maxSize: number;
|
|
55
|
+
sizeExceedMessage: string;
|
|
47
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
48
57
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
49
58
|
export default _default;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as P, shallowRef as R, createElementBlock as I, openBlock as U, withKeys as T, normalizeClass as x, withModifiers as q, unref as c, createBlock as $, renderSlot as L, createElementVNode as A, withCtx as N, nextTick as V } from "vue";
|
|
2
|
+
import "../form/index.js";
|
|
3
|
+
import "../message/index.js";
|
|
2
4
|
import "@vueuse/core";
|
|
3
|
-
import { isObject as
|
|
4
|
-
import { debugWarn as
|
|
5
|
+
import { isObject as _, entriesOf as F } from "@vft/utils";
|
|
6
|
+
import { debugWarn as H } from "../../utils/error.js";
|
|
5
7
|
import "../config-provider/hooks/use-global-config.js";
|
|
6
|
-
import { cloneDeep as
|
|
7
|
-
import "
|
|
8
|
-
import { useNamespace as F } from "../../hooks/use-namespace/index.js";
|
|
8
|
+
import { cloneDeep as O, isEqual as W } from "lodash-es";
|
|
9
|
+
import { useNamespace as X } from "../../hooks/use-namespace/index.js";
|
|
9
10
|
import "../../hooks/use-model-toggle/index.js";
|
|
10
11
|
import "@popperjs/core";
|
|
11
12
|
import "../../hooks/use-z-index/index.js";
|
|
@@ -14,12 +15,14 @@ import { genFileId as J } from "./constants.js";
|
|
|
14
15
|
import Q from "./upload-dragger.vue2.js";
|
|
15
16
|
import { useFormDisabled as Y } from "../form/hooks/use-form-common-props.js";
|
|
16
17
|
import { useFormItem as Z } from "../form/hooks/use-form-item.js";
|
|
17
|
-
const ee = ["onKeydown"], te = ["name", "multiple", "accept"], oe =
|
|
18
|
+
const ee = ["onKeydown"], te = ["name", "multiple", "accept"], oe = P({
|
|
18
19
|
name: "VftUploadContent",
|
|
19
20
|
inheritAttrs: !1
|
|
20
|
-
}), ke = /* @__PURE__ */
|
|
21
|
+
}), ke = /* @__PURE__ */ P({
|
|
21
22
|
...oe,
|
|
22
23
|
props: {
|
|
24
|
+
fileList: { default: [] },
|
|
25
|
+
replaceOnLimit: { type: Boolean, default: !1 },
|
|
23
26
|
action: { default: "#" },
|
|
24
27
|
headers: {},
|
|
25
28
|
method: { default: "post" },
|
|
@@ -31,129 +34,149 @@ const ee = ["onKeydown"], te = ["name", "multiple", "accept"], oe = D({
|
|
|
31
34
|
showFileList: { type: Boolean, default: !0 },
|
|
32
35
|
accept: { default: "" },
|
|
33
36
|
type: { default: "select" },
|
|
34
|
-
fileList: { default: [] },
|
|
35
37
|
autoUpload: { type: Boolean, default: !1 },
|
|
36
38
|
listType: { default: "text" },
|
|
37
39
|
httpRequest: { type: Function, default: G },
|
|
38
40
|
disabled: { type: Boolean },
|
|
39
41
|
limit: {},
|
|
42
|
+
maxSize: { default: void 0 },
|
|
43
|
+
sizeExceedMessage: { default: "文件大小超出限制" },
|
|
40
44
|
beforeUpload: {},
|
|
41
45
|
onRemove: {},
|
|
42
46
|
onStart: {},
|
|
43
47
|
onSuccess: {},
|
|
44
48
|
onProgress: {},
|
|
45
49
|
onError: {},
|
|
46
|
-
onExceed: {}
|
|
50
|
+
onExceed: {},
|
|
51
|
+
onSizeExceed: {}
|
|
47
52
|
},
|
|
48
|
-
setup(
|
|
49
|
-
const
|
|
53
|
+
setup(D, { expose: K }) {
|
|
54
|
+
const n = D, p = X("upload"), E = Y(), { formItem: M } = Z(), r = R(
|
|
50
55
|
{}
|
|
51
|
-
),
|
|
56
|
+
), m = R(), k = (e) => {
|
|
52
57
|
if (e.length === 0) return;
|
|
53
|
-
const {
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
const {
|
|
59
|
+
autoUpload: t,
|
|
60
|
+
limit: o,
|
|
61
|
+
fileList: s,
|
|
62
|
+
multiple: d,
|
|
63
|
+
onStart: f,
|
|
64
|
+
onExceed: y,
|
|
65
|
+
replaceOnLimit: g,
|
|
66
|
+
maxSize: l,
|
|
67
|
+
sizeExceedMessage: z,
|
|
68
|
+
onSizeExceed: h
|
|
69
|
+
} = n;
|
|
70
|
+
if (l) {
|
|
71
|
+
const i = e.filter((a) => a.size > l);
|
|
72
|
+
if (i.length > 0 && (i.forEach((a) => {
|
|
73
|
+
h && h(a, l);
|
|
74
|
+
}), e = e.filter((a) => a.size <= l), e.length === 0))
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (o && s.length + e.length > o && !(o === 1 && g)) {
|
|
78
|
+
y(e, s);
|
|
56
79
|
return;
|
|
57
80
|
}
|
|
58
|
-
|
|
59
|
-
for (const
|
|
60
|
-
const
|
|
61
|
-
|
|
81
|
+
d || (e = e.slice(0, 1));
|
|
82
|
+
for (const i of e) {
|
|
83
|
+
const a = i;
|
|
84
|
+
a.uid = J(), f(a), t && S(a);
|
|
62
85
|
}
|
|
63
|
-
},
|
|
64
|
-
if (
|
|
65
|
-
return
|
|
86
|
+
}, S = async (e) => {
|
|
87
|
+
if (m.value.value = "", !n.beforeUpload)
|
|
88
|
+
return B(e);
|
|
66
89
|
let t, o = {};
|
|
67
90
|
try {
|
|
68
|
-
const
|
|
69
|
-
o =
|
|
91
|
+
const d = n.data, f = n.beforeUpload(e);
|
|
92
|
+
o = _(n.data) ? O(n.data) : n.data, t = await f, _(n.data) && W(d, o) && (o = O(n.data));
|
|
70
93
|
} catch {
|
|
71
94
|
t = !1;
|
|
72
95
|
}
|
|
73
96
|
if (t === !1) {
|
|
74
|
-
|
|
97
|
+
n.onRemove(e);
|
|
75
98
|
return;
|
|
76
99
|
}
|
|
77
|
-
let
|
|
78
|
-
t instanceof Blob && (t instanceof File ?
|
|
100
|
+
let s = e;
|
|
101
|
+
t instanceof Blob && (t instanceof File ? s = t : s = new File([t], e.name, {
|
|
79
102
|
type: e.type
|
|
80
|
-
})),
|
|
81
|
-
},
|
|
103
|
+
})), B(Object.assign(s, { uid: e.uid }), o);
|
|
104
|
+
}, B = (e, t) => {
|
|
82
105
|
const {
|
|
83
106
|
headers: o,
|
|
84
|
-
data:
|
|
85
|
-
method:
|
|
86
|
-
withCredentials:
|
|
87
|
-
name:
|
|
88
|
-
action:
|
|
89
|
-
onProgress:
|
|
90
|
-
onSuccess:
|
|
91
|
-
onError:
|
|
92
|
-
httpRequest:
|
|
93
|
-
} =
|
|
107
|
+
data: s,
|
|
108
|
+
method: d,
|
|
109
|
+
withCredentials: f,
|
|
110
|
+
name: y,
|
|
111
|
+
action: g,
|
|
112
|
+
onProgress: l,
|
|
113
|
+
onSuccess: z,
|
|
114
|
+
onError: h,
|
|
115
|
+
httpRequest: i
|
|
116
|
+
} = n, { uid: a } = e, b = {
|
|
94
117
|
headers: o || {},
|
|
95
|
-
withCredentials:
|
|
118
|
+
withCredentials: f,
|
|
96
119
|
file: e,
|
|
97
|
-
data: t ??
|
|
98
|
-
method:
|
|
99
|
-
filename:
|
|
100
|
-
action:
|
|
101
|
-
onProgress: (
|
|
102
|
-
|
|
120
|
+
data: t ?? s,
|
|
121
|
+
method: d,
|
|
122
|
+
filename: y,
|
|
123
|
+
action: g,
|
|
124
|
+
onProgress: (u) => {
|
|
125
|
+
l(u, e);
|
|
103
126
|
},
|
|
104
|
-
onSuccess: (
|
|
105
|
-
|
|
127
|
+
onSuccess: (u) => {
|
|
128
|
+
z(u, e), delete r.value[a];
|
|
106
129
|
},
|
|
107
|
-
onError: (
|
|
108
|
-
|
|
130
|
+
onError: (u) => {
|
|
131
|
+
h(u, e), delete r.value[a];
|
|
109
132
|
}
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
},
|
|
133
|
+
}, v = i(b);
|
|
134
|
+
r.value[a] = v, v instanceof Promise && v.then(b.onSuccess, b.onError);
|
|
135
|
+
}, j = (e) => {
|
|
113
136
|
const t = e.target.files;
|
|
114
|
-
t && (
|
|
115
|
-
|
|
137
|
+
t && (k(Array.from(t)), V(() => {
|
|
138
|
+
M?.validate("change").catch((o) => H(o));
|
|
116
139
|
}));
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
|
|
140
|
+
}, C = () => {
|
|
141
|
+
E.value || (m.value.value = "", m.value.click());
|
|
142
|
+
}, w = () => {
|
|
143
|
+
C();
|
|
121
144
|
};
|
|
122
|
-
return
|
|
145
|
+
return K({
|
|
123
146
|
abort: (e) => {
|
|
124
|
-
|
|
147
|
+
F(r.value).filter(
|
|
125
148
|
e ? ([o]) => String(e.uid) === o : () => !0
|
|
126
|
-
).forEach(([o,
|
|
127
|
-
|
|
149
|
+
).forEach(([o, s]) => {
|
|
150
|
+
s instanceof XMLHttpRequest && s.abort(), delete r.value[o];
|
|
128
151
|
});
|
|
129
152
|
},
|
|
130
|
-
upload:
|
|
131
|
-
}), (e, t) => (
|
|
132
|
-
class:
|
|
153
|
+
upload: S
|
|
154
|
+
}), (e, t) => (U(), I("div", {
|
|
155
|
+
class: x([c(p).b(), c(p).m(e.listType), c(p).is("drag", e.drag)]),
|
|
133
156
|
tabindex: "0",
|
|
134
|
-
onClick:
|
|
135
|
-
onKeydown:
|
|
157
|
+
onClick: C,
|
|
158
|
+
onKeydown: T(q(w, ["self"]), ["enter", "space"])
|
|
136
159
|
}, [
|
|
137
|
-
e.drag ? (
|
|
160
|
+
e.drag ? (U(), $(Q, {
|
|
138
161
|
key: 0,
|
|
139
|
-
disabled:
|
|
140
|
-
onFile:
|
|
162
|
+
disabled: c(E),
|
|
163
|
+
onFile: t[0] || (t[0] = (o) => k(o.file))
|
|
141
164
|
}, {
|
|
142
|
-
default:
|
|
143
|
-
|
|
165
|
+
default: N(() => [
|
|
166
|
+
L(e.$slots, "default")
|
|
144
167
|
]),
|
|
145
168
|
_: 3
|
|
146
|
-
}, 8, ["disabled"])) :
|
|
147
|
-
|
|
169
|
+
}, 8, ["disabled"])) : L(e.$slots, "default", { key: 1 }),
|
|
170
|
+
A("input", {
|
|
148
171
|
ref_key: "inputRef",
|
|
149
|
-
ref:
|
|
150
|
-
class:
|
|
172
|
+
ref: m,
|
|
173
|
+
class: x(c(p).e("input")),
|
|
151
174
|
name: e.name,
|
|
152
175
|
multiple: e.multiple,
|
|
153
176
|
accept: e.accept,
|
|
154
177
|
type: "file",
|
|
155
|
-
onChange:
|
|
156
|
-
onClick: t[
|
|
178
|
+
onChange: j,
|
|
179
|
+
onClick: t[1] || (t[1] = q(() => {
|
|
157
180
|
}, ["stop"]))
|
|
158
181
|
}, null, 42, te)
|
|
159
182
|
], 42, ee));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UploadProps } from './types';
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
file?(_: {
|
|
4
|
-
file: import("
|
|
4
|
+
file: import("vft/es/components").UploadFile;
|
|
5
5
|
}): any;
|
|
6
6
|
trigger?(_: {}): any;
|
|
7
7
|
default?(_: {}): any;
|
|
@@ -18,19 +18,22 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
18
18
|
type: string;
|
|
19
19
|
autoUpload: boolean;
|
|
20
20
|
listType: string;
|
|
21
|
-
httpRequest: import("
|
|
21
|
+
httpRequest: import("vft/es/components").UploadRequestHandler;
|
|
22
22
|
fileList: never[];
|
|
23
|
+
replaceOnLimit: boolean;
|
|
24
|
+
maxSize: undefined;
|
|
25
|
+
sizeExceedMessage: string;
|
|
23
26
|
onExceed: () => void;
|
|
24
27
|
}>>, {
|
|
25
|
-
abort: (file: import("
|
|
28
|
+
abort: (file: import("vft/es/components").UploadFile) => void;
|
|
26
29
|
submit: () => void;
|
|
27
|
-
clearFiles: (states?: import("
|
|
28
|
-
handleStart: (rawFile: import("
|
|
29
|
-
handleRemove: (file: import("
|
|
30
|
+
clearFiles: (states?: import("vft/es/components").UploadStatus[]) => void;
|
|
31
|
+
handleStart: (rawFile: import("vft/es/components").UploadRawFile) => void;
|
|
32
|
+
handleRemove: (file: import("vft/es/components").UploadFile | import("vft/es/components").UploadRawFile, rawFile?: import("vft/es/components").UploadRawFile) => void;
|
|
30
33
|
fileList: import("vue").Ref<{
|
|
31
34
|
name: string;
|
|
32
35
|
percentage?: number | undefined;
|
|
33
|
-
status: import("
|
|
36
|
+
status: import("vft/es/components").UploadStatus;
|
|
34
37
|
size?: number | undefined;
|
|
35
38
|
response?: unknown;
|
|
36
39
|
uid: number;
|
|
@@ -51,7 +54,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
51
54
|
}[], {
|
|
52
55
|
name: string;
|
|
53
56
|
percentage?: number | undefined;
|
|
54
|
-
status: import("
|
|
57
|
+
status: import("vft/es/components").UploadStatus;
|
|
55
58
|
size?: number | undefined;
|
|
56
59
|
response?: unknown;
|
|
57
60
|
uid: number;
|
|
@@ -81,8 +84,11 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
81
84
|
type: string;
|
|
82
85
|
autoUpload: boolean;
|
|
83
86
|
listType: string;
|
|
84
|
-
httpRequest: import("
|
|
87
|
+
httpRequest: import("vft/es/components").UploadRequestHandler;
|
|
85
88
|
fileList: never[];
|
|
89
|
+
replaceOnLimit: boolean;
|
|
90
|
+
maxSize: undefined;
|
|
91
|
+
sizeExceedMessage: string;
|
|
86
92
|
onExceed: () => void;
|
|
87
93
|
}>>> & Readonly<{}>, {
|
|
88
94
|
drag: boolean;
|
|
@@ -91,13 +97,16 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
91
97
|
method: string;
|
|
92
98
|
multiple: boolean;
|
|
93
99
|
action: string;
|
|
100
|
+
fileList: import("vft/es/components").UploadUserFile[];
|
|
94
101
|
showFileList: boolean;
|
|
95
102
|
accept: string;
|
|
96
|
-
fileList: import("./types").UploadUserFile[];
|
|
97
103
|
autoUpload: boolean;
|
|
98
|
-
listType: import("
|
|
99
|
-
httpRequest: import("
|
|
100
|
-
|
|
104
|
+
listType: import("vft/es/components").ListType;
|
|
105
|
+
httpRequest: import("vft/es/components").UploadRequestHandler;
|
|
106
|
+
replaceOnLimit: boolean;
|
|
107
|
+
maxSize: number;
|
|
108
|
+
sizeExceedMessage: string;
|
|
109
|
+
onExceed: import("vft/es/components").UploadHooks["onExceed"];
|
|
101
110
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
102
111
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
103
112
|
export default _default;
|