vft 0.0.280 → 0.0.282
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/es/components/super-form/super-form.vue2.js +63 -61
- package/es/components/upload/index.d.ts +129 -0
- package/es/components/upload/upload.vue.d.ts +43 -0
- package/es/components/upload/upload.vue2.js +25 -24
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/super-form/super-form.vue2.cjs +1 -1
- package/lib/components/upload/index.d.ts +129 -0
- package/lib/components/upload/upload.vue.d.ts +43 -0
- package/lib/components/upload/upload.vue2.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { defineComponent as U, useAttrs as ne, reactive as
|
|
2
|
-
import { VftCol as
|
|
3
|
-
import { VftForm as
|
|
4
|
-
import { VftRow as
|
|
5
|
-
import { useTimeoutFn as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
import { defineComponent as U, useAttrs as ne, reactive as se, ref as i, computed as B, unref as o, watch as h, nextTick as le, useSlots as re, createBlock as r, createCommentVNode as H, openBlock as l, mergeProps as y, withKeys as ue, withModifiers as ie, withCtx as v, renderSlot as O, normalizeProps as z, createElementBlock as me, Fragment as fe, renderList as K, createSlots as pe, resolveDynamicComponent as A, h as ce } from "vue";
|
|
2
|
+
import { VftCol as de } from "../col/index.js";
|
|
3
|
+
import { VftForm as Be } from "../form/index.js";
|
|
4
|
+
import { VftRow as he } from "../row/index.js";
|
|
5
|
+
import { useTimeoutFn as ye, useDebounceFn as ve } from "@vueuse/core";
|
|
6
|
+
import { cloneDeep as ge, isEqual as be, pick as Fe, deepMerge as we } from "@vft/utils";
|
|
7
7
|
import "../../utils/ns-cover.js";
|
|
8
8
|
import "lodash-es";
|
|
9
|
-
import { useNamespace as
|
|
9
|
+
import { useNamespace as Se } from "../../hooks/use-namespace/index.js";
|
|
10
10
|
import "../../hooks/use-model-toggle/index.js";
|
|
11
11
|
import "@popperjs/core";
|
|
12
12
|
import "../../hooks/use-z-index/index.js";
|
|
13
13
|
import Ce from "./super-form-action.vue2.js";
|
|
14
|
-
import
|
|
15
|
-
import { useAutoFocus as
|
|
16
|
-
import { createFormContext as
|
|
17
|
-
import { useFormEvents as
|
|
18
|
-
import { useFormValues as
|
|
19
|
-
const
|
|
14
|
+
import ke from "./super-form-item.vue2.js";
|
|
15
|
+
import { useAutoFocus as Re } from "./use/use-auto-focus.js";
|
|
16
|
+
import { createFormContext as Oe } from "./use/use-form-context.js";
|
|
17
|
+
import { useFormEvents as Ae } from "./use/use-form-events.js";
|
|
18
|
+
import { useFormValues as Pe } from "./use/use-form-values.js";
|
|
19
|
+
const Ee = U({
|
|
20
20
|
name: "vft-super-form"
|
|
21
|
-
}),
|
|
22
|
-
...
|
|
21
|
+
}), Je = /* @__PURE__ */ U({
|
|
22
|
+
...Ee,
|
|
23
23
|
props: {
|
|
24
24
|
size: {
|
|
25
25
|
default: "default"
|
|
@@ -147,58 +147,58 @@ const Pe = U({
|
|
|
147
147
|
expose: j,
|
|
148
148
|
emit: J
|
|
149
149
|
}) {
|
|
150
|
-
const Q =
|
|
150
|
+
const Q = Se("super-form"), P = W, E = J, X = ne(), u = se({}), g = i({}), p = i(!1), c = i({}), V = i(), b = i(null), I = i(), t = B(() => ({
|
|
151
151
|
...P,
|
|
152
|
-
...o(
|
|
152
|
+
...o(c)
|
|
153
153
|
})), m = B(() => ({
|
|
154
154
|
...X,
|
|
155
155
|
...P,
|
|
156
156
|
...o(t)
|
|
157
|
-
})),
|
|
157
|
+
})), s = B(() => {
|
|
158
158
|
const e = o(V);
|
|
159
|
-
return
|
|
159
|
+
return ge(e);
|
|
160
160
|
}), {
|
|
161
161
|
handleFormValues: Y,
|
|
162
|
-
initDefault:
|
|
163
|
-
} =
|
|
162
|
+
initDefault: _
|
|
163
|
+
} = Pe({
|
|
164
164
|
getProps: t,
|
|
165
165
|
defaultValueRef: g,
|
|
166
|
-
getSchema:
|
|
166
|
+
getSchema: s,
|
|
167
167
|
formModel: u
|
|
168
168
|
});
|
|
169
|
-
|
|
170
|
-
getSchema:
|
|
169
|
+
Re({
|
|
170
|
+
getSchema: s,
|
|
171
171
|
getProps: t,
|
|
172
|
-
isInitedDefault:
|
|
172
|
+
isInitedDefault: p,
|
|
173
173
|
formElRef: b
|
|
174
174
|
});
|
|
175
175
|
const {
|
|
176
176
|
handleSubmit: f,
|
|
177
177
|
setFieldsValue: F,
|
|
178
|
-
clearValidate:
|
|
179
|
-
validate:
|
|
178
|
+
clearValidate: M,
|
|
179
|
+
validate: D,
|
|
180
180
|
validateField: T,
|
|
181
181
|
getFieldsValue: w,
|
|
182
|
-
updateSchema:
|
|
182
|
+
updateSchema: S,
|
|
183
183
|
resetSchema: d,
|
|
184
184
|
appendSchemaByField: q,
|
|
185
185
|
removeSchemaByField: $,
|
|
186
|
-
resetFields:
|
|
186
|
+
resetFields: C,
|
|
187
187
|
scrollToField: Z,
|
|
188
188
|
getFieldValue: L
|
|
189
|
-
} =
|
|
189
|
+
} = Ae({
|
|
190
190
|
emit: E,
|
|
191
191
|
getProps: t,
|
|
192
192
|
formModel: u,
|
|
193
|
-
getSchema:
|
|
193
|
+
getSchema: s,
|
|
194
194
|
defaultValueRef: g,
|
|
195
195
|
formElRef: b,
|
|
196
196
|
schemaRef: V,
|
|
197
197
|
handleFormValues: Y,
|
|
198
|
-
initValues:
|
|
198
|
+
initValues: I
|
|
199
199
|
});
|
|
200
|
-
|
|
201
|
-
resetAction:
|
|
200
|
+
Oe({
|
|
201
|
+
resetAction: C,
|
|
202
202
|
submitAction: f
|
|
203
203
|
}), h(() => o(t).model, () => {
|
|
204
204
|
const {
|
|
@@ -208,19 +208,19 @@ const Pe = U({
|
|
|
208
208
|
}, {
|
|
209
209
|
immediate: !0
|
|
210
210
|
}), h(() => o(t).schemas, (e, a) => {
|
|
211
|
-
|
|
212
|
-
}), h(() =>
|
|
213
|
-
|
|
214
|
-
}), !o(
|
|
215
|
-
|
|
211
|
+
be(e, a) || d(e ?? []);
|
|
212
|
+
}), h(() => s.value, (e) => {
|
|
213
|
+
le(() => {
|
|
214
|
+
}), !o(p) && e?.length && (_(), p.value = !0, t.value?.watchDataIsChange && ye(() => {
|
|
215
|
+
I.value = w();
|
|
216
216
|
}, 40));
|
|
217
|
-
}), h(() => u,
|
|
217
|
+
}), h(() => u, ve(() => {
|
|
218
218
|
o(t).submitOnChange && f();
|
|
219
219
|
}, 300), {
|
|
220
220
|
deep: !0
|
|
221
221
|
});
|
|
222
222
|
async function N(e) {
|
|
223
|
-
|
|
223
|
+
c.value = we(o(c) || {}, e), p.value || (d(c.value?.schemas ?? []), _());
|
|
224
224
|
}
|
|
225
225
|
function ee(e, a, n) {
|
|
226
226
|
u[e] = a, n && n.itemProps;
|
|
@@ -238,20 +238,20 @@ const Pe = U({
|
|
|
238
238
|
getFieldsValue: w,
|
|
239
239
|
getFieldValue: L,
|
|
240
240
|
setFieldsValue: F,
|
|
241
|
-
resetFields:
|
|
242
|
-
updateSchema:
|
|
241
|
+
resetFields: C,
|
|
242
|
+
updateSchema: S,
|
|
243
243
|
resetSchema: d,
|
|
244
244
|
setProps: N,
|
|
245
245
|
removeSchemaByField: $,
|
|
246
246
|
appendSchemaByField: q,
|
|
247
|
-
clearValidate:
|
|
247
|
+
clearValidate: M,
|
|
248
248
|
validateField: T,
|
|
249
|
-
validate:
|
|
249
|
+
validate: D,
|
|
250
250
|
submit: f,
|
|
251
251
|
scrollToField: Z
|
|
252
252
|
};
|
|
253
253
|
E("register", G);
|
|
254
|
-
const oe = B(() =>
|
|
254
|
+
const oe = B(() => Fe(t.value, ["showResetButton", "showCommonButton", "showSubmitButton", "resetButtonOptions", "submitButtonOptions", "commonButtonOptions", "actionRowOptions", "actionSpan"])), k = re(), R = (e) => e ? ce(Ce, oe.value, {
|
|
255
255
|
resetBefore: (a) => k.resetBefore?.(a),
|
|
256
256
|
submitBefore: (a) => k.submitBefore?.(a),
|
|
257
257
|
submitAfter: (a) => k.submitAfter?.(a)
|
|
@@ -260,30 +260,32 @@ const Pe = U({
|
|
|
260
260
|
getFieldsValue: w,
|
|
261
261
|
getFieldValue: L,
|
|
262
262
|
setFieldsValue: F,
|
|
263
|
-
resetFields:
|
|
264
|
-
updateSchema:
|
|
263
|
+
resetFields: C,
|
|
264
|
+
updateSchema: S,
|
|
265
265
|
resetSchema: d,
|
|
266
266
|
setProps: N,
|
|
267
267
|
removeSchemaByField: $,
|
|
268
268
|
appendSchemaByField: q,
|
|
269
|
-
clearValidate:
|
|
269
|
+
clearValidate: M,
|
|
270
270
|
validateField: T,
|
|
271
|
-
validate:
|
|
271
|
+
validate: D,
|
|
272
272
|
submit: f,
|
|
273
|
-
getSchema:
|
|
274
|
-
}), (e, a) =>
|
|
273
|
+
getSchema: s
|
|
274
|
+
}), (e, a) => s.value?.length ? (l(), r(o(Be), y({
|
|
275
275
|
key: 0
|
|
276
276
|
}, m.value, {
|
|
277
277
|
ref_key: "formElRef",
|
|
278
278
|
ref: b,
|
|
279
279
|
class: o(Q).b(),
|
|
280
280
|
model: u,
|
|
281
|
+
onSubmit: a[0] || (a[0] = ie(() => {
|
|
282
|
+
}, ["prevent"])),
|
|
281
283
|
onKeypress: ue(te, ["enter"])
|
|
282
284
|
}), {
|
|
283
|
-
default: v(() => [
|
|
285
|
+
default: v(() => [s.value?.length ? (l(), r(o(he), z(y({
|
|
284
286
|
key: 0
|
|
285
287
|
}, m.value?.rowProps)), {
|
|
286
|
-
default: v(() => [O(e.$slots, "formHeader"), (
|
|
288
|
+
default: v(() => [O(e.$slots, "formHeader"), (l(!0), me(fe, null, K(s.value, (n) => (l(), r(ke, {
|
|
287
289
|
key: n.field,
|
|
288
290
|
"form-action-type": G,
|
|
289
291
|
schema: n,
|
|
@@ -291,31 +293,31 @@ const Pe = U({
|
|
|
291
293
|
"all-default-values": g.value,
|
|
292
294
|
"form-model": u,
|
|
293
295
|
"set-form-model": ee,
|
|
294
|
-
"update-schema": o(
|
|
295
|
-
},
|
|
296
|
+
"update-schema": o(S)
|
|
297
|
+
}, pe({
|
|
296
298
|
_: 2
|
|
297
299
|
}, [K(Object.keys(e.$slots), (x) => ({
|
|
298
300
|
name: x,
|
|
299
301
|
fn: v((ae) => [O(e.$slots, x, y({
|
|
300
302
|
ref_for: !0
|
|
301
303
|
}, ae || {}))])
|
|
302
|
-
}))]), 1032, ["schema", "form-props", "all-default-values", "form-model", "update-schema"]))), 128)), t.value?.customLayout ? (
|
|
304
|
+
}))]), 1032, ["schema", "form-props", "all-default-values", "form-model", "update-schema"]))), 128)), t.value?.customLayout ? (l(), r(A(R(t.value?.showActionButtonGroup && t.value?.actionInline)), {
|
|
303
305
|
key: 1
|
|
304
|
-
})) : (
|
|
306
|
+
})) : (l(), r(o(de), z(y({
|
|
305
307
|
key: 0
|
|
306
308
|
}, m.value?.quickColSpan ? {
|
|
307
309
|
span: Math.ceil(24 / m.value?.quickColSpan),
|
|
308
310
|
...m.value?.baseColProps
|
|
309
311
|
} : {})), {
|
|
310
|
-
default: v(() => [(
|
|
312
|
+
default: v(() => [(l(), r(A(R(t.value?.showActionButtonGroup && t.value?.actionInline))))]),
|
|
311
313
|
_: 1
|
|
312
314
|
}, 16))]),
|
|
313
315
|
_: 3
|
|
314
|
-
}, 16)) : H("", !0), (
|
|
316
|
+
}, 16)) : H("", !0), (l(), r(A(R(t.value?.showActionButtonGroup && !t.value?.actionInline)))), O(e.$slots, "formFooter")]),
|
|
315
317
|
_: 3
|
|
316
318
|
}, 16, ["class", "model"])) : H("", !0);
|
|
317
319
|
}
|
|
318
320
|
});
|
|
319
321
|
export {
|
|
320
|
-
|
|
322
|
+
Je as default
|
|
321
323
|
};
|
|
@@ -96,6 +96,49 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
96
96
|
clearFiles: (states?: import("./types").UploadStatus[]) => void;
|
|
97
97
|
handleStart: (rawFile: import("./types").UploadRawFile) => void;
|
|
98
98
|
handleRemove: (file: import("./types").UploadFile | import("./types").UploadRawFile, rawFile?: import("./types").UploadRawFile) => void;
|
|
99
|
+
fileList: import("vue").Ref<{
|
|
100
|
+
name: string;
|
|
101
|
+
percentage?: number | undefined;
|
|
102
|
+
status: import("./types").UploadStatus;
|
|
103
|
+
size?: number | undefined;
|
|
104
|
+
response?: unknown;
|
|
105
|
+
uid: number;
|
|
106
|
+
url?: string | undefined;
|
|
107
|
+
raw?: {
|
|
108
|
+
uid: number;
|
|
109
|
+
readonly lastModified: number;
|
|
110
|
+
readonly name: string;
|
|
111
|
+
readonly webkitRelativePath: string;
|
|
112
|
+
readonly size: number;
|
|
113
|
+
readonly type: string;
|
|
114
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
115
|
+
bytes: () => Promise<Uint8Array>;
|
|
116
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
117
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
118
|
+
text: () => Promise<string>;
|
|
119
|
+
} | undefined;
|
|
120
|
+
}[], {
|
|
121
|
+
name: string;
|
|
122
|
+
percentage?: number | undefined;
|
|
123
|
+
status: import("./types").UploadStatus;
|
|
124
|
+
size?: number | undefined;
|
|
125
|
+
response?: unknown;
|
|
126
|
+
uid: number;
|
|
127
|
+
url?: string | undefined;
|
|
128
|
+
raw?: {
|
|
129
|
+
uid: number;
|
|
130
|
+
readonly lastModified: number;
|
|
131
|
+
readonly name: string;
|
|
132
|
+
readonly webkitRelativePath: string;
|
|
133
|
+
readonly size: number;
|
|
134
|
+
readonly type: string;
|
|
135
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
136
|
+
bytes: () => Promise<Uint8Array>;
|
|
137
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
138
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
139
|
+
text: () => Promise<string>;
|
|
140
|
+
} | undefined;
|
|
141
|
+
}[]>;
|
|
99
142
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
100
143
|
drag: boolean;
|
|
101
144
|
name: string;
|
|
@@ -213,6 +256,49 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
213
256
|
clearFiles: (states?: import("./types").UploadStatus[]) => void;
|
|
214
257
|
handleStart: (rawFile: import("./types").UploadRawFile) => void;
|
|
215
258
|
handleRemove: (file: import("./types").UploadFile | import("./types").UploadRawFile, rawFile?: import("./types").UploadRawFile) => void;
|
|
259
|
+
fileList: import("vue").Ref<{
|
|
260
|
+
name: string;
|
|
261
|
+
percentage?: number | undefined;
|
|
262
|
+
status: import("./types").UploadStatus;
|
|
263
|
+
size?: number | undefined;
|
|
264
|
+
response?: unknown;
|
|
265
|
+
uid: number;
|
|
266
|
+
url?: string | undefined;
|
|
267
|
+
raw?: {
|
|
268
|
+
uid: number;
|
|
269
|
+
readonly lastModified: number;
|
|
270
|
+
readonly name: string;
|
|
271
|
+
readonly webkitRelativePath: string;
|
|
272
|
+
readonly size: number;
|
|
273
|
+
readonly type: string;
|
|
274
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
275
|
+
bytes: () => Promise<Uint8Array>;
|
|
276
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
277
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
278
|
+
text: () => Promise<string>;
|
|
279
|
+
} | undefined;
|
|
280
|
+
}[], {
|
|
281
|
+
name: string;
|
|
282
|
+
percentage?: number | undefined;
|
|
283
|
+
status: import("./types").UploadStatus;
|
|
284
|
+
size?: number | undefined;
|
|
285
|
+
response?: unknown;
|
|
286
|
+
uid: number;
|
|
287
|
+
url?: string | undefined;
|
|
288
|
+
raw?: {
|
|
289
|
+
uid: number;
|
|
290
|
+
readonly lastModified: number;
|
|
291
|
+
readonly name: string;
|
|
292
|
+
readonly webkitRelativePath: string;
|
|
293
|
+
readonly size: number;
|
|
294
|
+
readonly type: string;
|
|
295
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
296
|
+
bytes: () => Promise<Uint8Array>;
|
|
297
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
298
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
299
|
+
text: () => Promise<string>;
|
|
300
|
+
} | undefined;
|
|
301
|
+
}[]>;
|
|
216
302
|
}, {}, {}, {}, {
|
|
217
303
|
drag: boolean;
|
|
218
304
|
name: string;
|
|
@@ -327,6 +413,49 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
327
413
|
clearFiles: (states?: import("./types").UploadStatus[]) => void;
|
|
328
414
|
handleStart: (rawFile: import("./types").UploadRawFile) => void;
|
|
329
415
|
handleRemove: (file: import("./types").UploadFile | import("./types").UploadRawFile, rawFile?: import("./types").UploadRawFile) => void;
|
|
416
|
+
fileList: import("vue").Ref<{
|
|
417
|
+
name: string;
|
|
418
|
+
percentage?: number | undefined;
|
|
419
|
+
status: import("./types").UploadStatus;
|
|
420
|
+
size?: number | undefined;
|
|
421
|
+
response?: unknown;
|
|
422
|
+
uid: number;
|
|
423
|
+
url?: string | undefined;
|
|
424
|
+
raw?: {
|
|
425
|
+
uid: number;
|
|
426
|
+
readonly lastModified: number;
|
|
427
|
+
readonly name: string;
|
|
428
|
+
readonly webkitRelativePath: string;
|
|
429
|
+
readonly size: number;
|
|
430
|
+
readonly type: string;
|
|
431
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
432
|
+
bytes: () => Promise<Uint8Array>;
|
|
433
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
434
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
435
|
+
text: () => Promise<string>;
|
|
436
|
+
} | undefined;
|
|
437
|
+
}[], {
|
|
438
|
+
name: string;
|
|
439
|
+
percentage?: number | undefined;
|
|
440
|
+
status: import("./types").UploadStatus;
|
|
441
|
+
size?: number | undefined;
|
|
442
|
+
response?: unknown;
|
|
443
|
+
uid: number;
|
|
444
|
+
url?: string | undefined;
|
|
445
|
+
raw?: {
|
|
446
|
+
uid: number;
|
|
447
|
+
readonly lastModified: number;
|
|
448
|
+
readonly name: string;
|
|
449
|
+
readonly webkitRelativePath: string;
|
|
450
|
+
readonly size: number;
|
|
451
|
+
readonly type: string;
|
|
452
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
453
|
+
bytes: () => Promise<Uint8Array>;
|
|
454
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
455
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
456
|
+
text: () => Promise<string>;
|
|
457
|
+
} | undefined;
|
|
458
|
+
}[]>;
|
|
330
459
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
331
460
|
drag: boolean;
|
|
332
461
|
name: string;
|
|
@@ -26,6 +26,49 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
26
26
|
clearFiles: (states?: import("./types").UploadStatus[]) => void;
|
|
27
27
|
handleStart: (rawFile: import("./types").UploadRawFile) => void;
|
|
28
28
|
handleRemove: (file: import("./types").UploadFile | import("./types").UploadRawFile, rawFile?: import("./types").UploadRawFile) => void;
|
|
29
|
+
fileList: import("vue").Ref<{
|
|
30
|
+
name: string;
|
|
31
|
+
percentage?: number | undefined;
|
|
32
|
+
status: import("./types").UploadStatus;
|
|
33
|
+
size?: number | undefined;
|
|
34
|
+
response?: unknown;
|
|
35
|
+
uid: number;
|
|
36
|
+
url?: string | undefined;
|
|
37
|
+
raw?: {
|
|
38
|
+
uid: number;
|
|
39
|
+
readonly lastModified: number;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly webkitRelativePath: string;
|
|
42
|
+
readonly size: number;
|
|
43
|
+
readonly type: string;
|
|
44
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
45
|
+
bytes: () => Promise<Uint8Array>;
|
|
46
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
47
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
48
|
+
text: () => Promise<string>;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}[], {
|
|
51
|
+
name: string;
|
|
52
|
+
percentage?: number | undefined;
|
|
53
|
+
status: import("./types").UploadStatus;
|
|
54
|
+
size?: number | undefined;
|
|
55
|
+
response?: unknown;
|
|
56
|
+
uid: number;
|
|
57
|
+
url?: string | undefined;
|
|
58
|
+
raw?: {
|
|
59
|
+
uid: number;
|
|
60
|
+
readonly lastModified: number;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly webkitRelativePath: string;
|
|
63
|
+
readonly size: number;
|
|
64
|
+
readonly type: string;
|
|
65
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
66
|
+
bytes: () => Promise<Uint8Array>;
|
|
67
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
68
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
69
|
+
text: () => Promise<string>;
|
|
70
|
+
} | undefined;
|
|
71
|
+
}[]>;
|
|
29
72
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<UploadProps>, {
|
|
30
73
|
action: string;
|
|
31
74
|
method: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as w, useSlots as U, shallowRef as T, computed as h, onBeforeUnmount as j, provide as N, toRef as V, createElementBlock as q, openBlock as f, createBlock as m, createCommentVNode as t, renderSlot as l, unref as o, createSlots as g, withCtx as
|
|
1
|
+
import { defineComponent as w, useSlots as U, shallowRef as T, computed as h, onBeforeUnmount as j, provide as N, toRef as V, createElementBlock as q, openBlock as f, createBlock as m, createCommentVNode as t, renderSlot as l, unref as o, createSlots as g, withCtx as r, createVNode as D, mergeProps as k } from "vue";
|
|
2
2
|
import "../form/index.js";
|
|
3
3
|
import { ajaxUpload as H } from "./ajax.js";
|
|
4
4
|
import { uploadContextKey as K } from "./constants.js";
|
|
@@ -39,52 +39,53 @@ const z = w({
|
|
|
39
39
|
onExceed: {}
|
|
40
40
|
},
|
|
41
41
|
setup($, { expose: B }) {
|
|
42
|
-
const
|
|
43
|
-
abort:
|
|
44
|
-
submit:
|
|
45
|
-
clearFiles:
|
|
46
|
-
uploadFiles:
|
|
42
|
+
const i = $, s = U(), v = W(), u = T(), {
|
|
43
|
+
abort: L,
|
|
44
|
+
submit: P,
|
|
45
|
+
clearFiles: C,
|
|
46
|
+
uploadFiles: a,
|
|
47
47
|
handleStart: y,
|
|
48
|
-
handleError:
|
|
48
|
+
handleError: F,
|
|
49
49
|
handleRemove: n,
|
|
50
50
|
handleSuccess: S,
|
|
51
51
|
handleProgress: E
|
|
52
|
-
} = O(
|
|
53
|
-
...
|
|
54
|
-
fileList:
|
|
52
|
+
} = O(i, u), d = h(() => i.listType === "picture-card"), c = h(() => ({
|
|
53
|
+
...i,
|
|
54
|
+
fileList: a.value,
|
|
55
55
|
onStart: y,
|
|
56
56
|
onProgress: E,
|
|
57
57
|
onSuccess: S,
|
|
58
|
-
onError:
|
|
58
|
+
onError: F,
|
|
59
59
|
onRemove: n
|
|
60
60
|
}));
|
|
61
61
|
return j(() => {
|
|
62
|
-
|
|
62
|
+
a.value.forEach(({ url: e }) => {
|
|
63
63
|
e?.startsWith("blob:") && URL.revokeObjectURL(e);
|
|
64
64
|
});
|
|
65
65
|
}), N(K, {
|
|
66
|
-
accept: V(
|
|
66
|
+
accept: V(i, "accept")
|
|
67
67
|
}), B({
|
|
68
|
-
abort:
|
|
69
|
-
submit:
|
|
70
|
-
clearFiles:
|
|
68
|
+
abort: L,
|
|
69
|
+
submit: P,
|
|
70
|
+
clearFiles: C,
|
|
71
71
|
handleStart: y,
|
|
72
|
-
handleRemove: n
|
|
72
|
+
handleRemove: n,
|
|
73
|
+
fileList: a
|
|
73
74
|
}), (e, A) => (f(), q("div", null, [
|
|
74
75
|
d.value && e.showFileList ? (f(), m(b, {
|
|
75
76
|
key: 0,
|
|
76
77
|
disabled: o(v),
|
|
77
78
|
"list-type": e.listType,
|
|
78
|
-
files: o(
|
|
79
|
+
files: o(a),
|
|
79
80
|
"handle-preview": e.onPreview,
|
|
80
81
|
onRemove: o(n)
|
|
81
82
|
}, g({
|
|
82
|
-
append:
|
|
83
|
+
append: r(() => [
|
|
83
84
|
D(R, k({
|
|
84
85
|
ref_key: "uploadRef",
|
|
85
86
|
ref: u
|
|
86
87
|
}, c.value), {
|
|
87
|
-
default:
|
|
88
|
+
default: r(() => [
|
|
88
89
|
o(s).trigger ? l(e.$slots, "trigger", { key: 0 }) : t("", !0),
|
|
89
90
|
!o(s).trigger && o(s).default ? l(e.$slots, "default", { key: 1 }) : t("", !0)
|
|
90
91
|
]),
|
|
@@ -95,7 +96,7 @@ const z = w({
|
|
|
95
96
|
}, [
|
|
96
97
|
e.$slots.file ? {
|
|
97
98
|
name: "default",
|
|
98
|
-
fn:
|
|
99
|
+
fn: r(({ file: p }) => [
|
|
99
100
|
l(e.$slots, "file", { file: p })
|
|
100
101
|
]),
|
|
101
102
|
key: "0"
|
|
@@ -106,7 +107,7 @@ const z = w({
|
|
|
106
107
|
ref_key: "uploadRef",
|
|
107
108
|
ref: u
|
|
108
109
|
}, c.value), {
|
|
109
|
-
default:
|
|
110
|
+
default: r(() => [
|
|
110
111
|
o(s).trigger ? l(e.$slots, "trigger", { key: 0 }) : t("", !0),
|
|
111
112
|
!o(s).trigger && o(s).default ? l(e.$slots, "default", { key: 1 }) : t("", !0)
|
|
112
113
|
]),
|
|
@@ -118,13 +119,13 @@ const z = w({
|
|
|
118
119
|
key: 3,
|
|
119
120
|
disabled: o(v),
|
|
120
121
|
"list-type": e.listType,
|
|
121
|
-
files: o(
|
|
122
|
+
files: o(a),
|
|
122
123
|
"handle-preview": e.onPreview,
|
|
123
124
|
onRemove: o(n)
|
|
124
125
|
}, g({ _: 2 }, [
|
|
125
126
|
e.$slots.file ? {
|
|
126
127
|
name: "default",
|
|
127
|
-
fn:
|
|
128
|
+
fn: r(({ file: p }) => [
|
|
128
129
|
l(e.$slots, "file", { file: p })
|
|
129
130
|
]),
|
|
130
131
|
key: "0"
|
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"),U=require("../col/index.cjs"),W=require("../form/index.cjs"),J=require("../row/index.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),U=require("../col/index.cjs"),W=require("../form/index.cjs"),J=require("../row/index.cjs"),M=require("@vueuse/core"),m=require("@vft/utils");require("../../utils/ns-cover.cjs");require("lodash-es");const Q=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const X=require("./super-form-action.vue2.cjs"),Y=require("./super-form-item.vue2.cjs"),Z=require("./use/use-auto-focus.cjs"),ee=require("./use/use-form-context.cjs"),te=require("./use/use-form-events.cjs"),oe=require("./use/use-form-values.cjs"),ne=e.defineComponent({name:"vft-super-form"}),re=e.defineComponent({...ne,props:{size:{default:"default"},rowProps:{default:{gutter:20}},baseColProps:{},quickColSpan:{default:3},autoSetPlaceHolder:{type:Boolean,default:!0},schemas:{},autoFocusFirstItem:{type:Boolean,default:!1},submitOnReset:{type:Boolean},mergeDynamicData:{},fieldMapToTime:{},autoSubmitOnEnter:{type:Boolean,default:!0},rulesMessageJoinLabel:{type:Boolean,default:!0},submitOnChange:{type:Boolean},showActionButtonGroup:{type:Boolean,default:!0},autoCleanErrorMessage:{type:Boolean},beforeSubmitFunc:{},submitFunc:{},watchDataIsChange:{type:Boolean},compFullWidth:{type:Boolean,default:!1},actionInline:{type:Boolean,default:!1},resetFunc:{},customLayout:{type:Boolean,default:!1},showResetButton:{type:Boolean,default:!1},showSubmitButton:{type:Boolean,default:!0},showCommonButton:{type:Boolean,default:!1},resetButtonOptions:{},submitButtonOptions:{},commonButtonOptions:{},actionRowOptions:{},disabled:{type:Boolean},model:{},rules:{},labelPosition:{default:"right"},requireAsteriskPosition:{default:"left"},labelWidth:{default:"auto"},labelSuffix:{},inline:{type:Boolean},inlineMessage:{type:Boolean},statusIcon:{type:Boolean},showMessage:{type:Boolean,default:!0},validateOnRuleChange:{type:Boolean,default:!0},hideRequiredAsterisk:{type:Boolean,default:!1},scrollToError:{type:Boolean},scrollIntoViewOptions:{type:Boolean}},emits:["register","reset","submit","field-value-change"],setup(D,{expose:T,emit:x}){const $=Q.useNamespace("super-form"),F=D,k=x,L=e.useAttrs(),s=e.reactive({}),p=e.ref({}),i=e.ref(!1),c=e.ref({}),w=e.ref(),d=e.ref(null),C=e.ref(),o=e.computed(()=>({...F,...e.unref(c)})),a=e.computed(()=>({...L,...F,...e.unref(o)})),u=e.computed(()=>{const t=e.unref(w);return m.cloneDeep(t)}),{handleFormValues:N,initDefault:S}=oe.useFormValues({getProps:o,defaultValueRef:p,getSchema:u,formModel:s});Z.useAutoFocus({getSchema:u,getProps:o,isInitedDefault:i,formElRef:d});const{handleSubmit:l,setFieldsValue:B,clearValidate:q,validate:_,validateField:P,getFieldsValue:h,updateSchema:v,resetSchema:f,appendSchemaByField:A,removeSchemaByField:O,resetFields:y,scrollToField:G,getFieldValue:R}=te.useFormEvents({emit:k,getProps:o,formModel:s,getSchema:u,defaultValueRef:p,formElRef:d,schemaRef:w,handleFormValues:N,initValues:C});ee.createFormContext({resetAction:y,submitAction:l}),e.watch(()=>e.unref(o).model,()=>{const{model:t}=e.unref(o);t&&B(t)},{immediate:!0}),e.watch(()=>e.unref(o).schemas,(t,n)=>{m.isEqual(t,n)||f(t??[])}),e.watch(()=>u.value,t=>{e.nextTick(()=>{}),!e.unref(i)&&t?.length&&(S(),i.value=!0,o.value?.watchDataIsChange&&M.useTimeoutFn(()=>{C.value=h()},40))}),e.watch(()=>s,M.useDebounceFn(()=>{e.unref(o).submitOnChange&&l()},300),{deep:!0});async function V(t){c.value=m.deepMerge(e.unref(c)||{},t),i.value||(f(c.value?.schemas??[]),S())}function z(t,n,r){s[t]=n,r&&r.itemProps}function H(t){const{autoSubmitOnEnter:n}=e.unref(o);if(n&&t.key==="Enter"&&t.target&&t.target instanceof HTMLElement){const r=t.target;r&&r.tagName&&r.tagName.toUpperCase()==="INPUT"&&l()}}const E={getFieldsValue:h,getFieldValue:R,setFieldsValue:B,resetFields:y,updateSchema:v,resetSchema:f,setProps:V,removeSchemaByField:O,appendSchemaByField:A,clearValidate:q,validateField:P,validate:_,submit:l,scrollToField:G};k("register",E);const j=e.computed(()=>m.pick(o.value,["showResetButton","showCommonButton","showSubmitButton","resetButtonOptions","submitButtonOptions","commonButtonOptions","actionRowOptions","actionSpan"])),g=e.useSlots(),b=t=>t?e.h(X.default,j.value,{resetBefore:n=>g.resetBefore?.(n),submitBefore:n=>g.submitBefore?.(n),submitAfter:n=>g.submitAfter?.(n)}):null;return T({getFieldsValue:h,getFieldValue:R,setFieldsValue:B,resetFields:y,updateSchema:v,resetSchema:f,setProps:V,removeSchemaByField:O,appendSchemaByField:A,clearValidate:q,validateField:P,validate:_,submit:l,getSchema:u}),(t,n)=>u.value?.length?(e.openBlock(),e.createBlock(e.unref(W.VftForm),e.mergeProps({key:0},a.value,{ref_key:"formElRef",ref:d,class:e.unref($).b(),model:s,onSubmit:n[0]||(n[0]=e.withModifiers(()=>{},["prevent"])),onKeypress:e.withKeys(H,["enter"])}),{default:e.withCtx(()=>[u.value?.length?(e.openBlock(),e.createBlock(e.unref(J.VftRow),e.normalizeProps(e.mergeProps({key:0},a.value?.rowProps)),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"formHeader"),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,r=>(e.openBlock(),e.createBlock(Y.default,{key:r.field,"form-action-type":E,schema:r,"form-props":o.value,"all-default-values":p.value,"form-model":s,"set-form-model":z,"update-schema":e.unref(v)},e.createSlots({_:2},[e.renderList(Object.keys(t.$slots),I=>({name:I,fn:e.withCtx(K=>[e.renderSlot(t.$slots,I,e.mergeProps({ref_for:!0},K||{}))])}))]),1032,["schema","form-props","all-default-values","form-model","update-schema"]))),128)),o.value?.customLayout?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.value?.showActionButtonGroup&&o.value?.actionInline)),{key:1})):(e.openBlock(),e.createBlock(e.unref(U.VftCol),e.normalizeProps(e.mergeProps({key:0},a.value?.quickColSpan?{span:Math.ceil(24/a.value?.quickColSpan),...a.value?.baseColProps}:{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.value?.showActionButtonGroup&&o.value?.actionInline))))]),_:1},16))]),_:3},16)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.value?.showActionButtonGroup&&!o.value?.actionInline)))),e.renderSlot(t.$slots,"formFooter")]),_:3},16,["class","model"])):e.createCommentVNode("",!0)}});exports.default=re;
|