@vunk/form 2.9.1 → 2.9.2

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.
@@ -33,6 +33,24 @@ const props = {
33
33
  onDownload: {
34
34
  type: Function,
35
35
  default: void 0
36
+ },
37
+ onExceed: {
38
+ type: Function,
39
+ default: void 0
40
+ },
41
+ /**
42
+ * @description 达到limit后是否允许继续添加文件, 默认采用清空+添加的方式重新添加文件,你可以通过 onExceed 自定义行为
43
+ */
44
+ exceedable: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ /**
49
+ * @description 是否开启超出覆盖文件的确认框
50
+ */
51
+ confirmExceed: {
52
+ type: Boolean,
53
+ default: false
36
54
  }
37
55
  };
38
56
  const createBindProps = utilsVue.bindPropsFactory(props);
@@ -370,6 +388,34 @@ var _sfc_main = vue.defineComponent({
370
388
  uploadRef.value?.abort(file);
371
389
  emit("update:fileList", props2.fileList);
372
390
  };
391
+ const handleExceed = (files, uploadFiles) => {
392
+ if (props2.onExceed) {
393
+ props2.onExceed(files, uploadFiles);
394
+ return;
395
+ }
396
+ if (props2.exceedable) {
397
+ const doUpload = () => {
398
+ uploadRef.value?.clearFiles();
399
+ files.forEach((file) => {
400
+ file.uid = elementPlus.genFileId();
401
+ uploadRef.value?.handleStart(file);
402
+ });
403
+ };
404
+ if (props2.confirmExceed) {
405
+ elementPlus.ElMessageBox.confirm(
406
+ `\u5DF2\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u6570\u91CF\u9650\u5236\uFF0C\u662F\u5426\u4F7F\u7528\u65B0\u6587\u4EF6\u91CD\u65B0\u4E0A\u4F20\uFF1F`,
407
+ "\u63D0\u793A",
408
+ {
409
+ confirmButtonText: "\u7EE7\u7EED",
410
+ cancelButtonText: "\u53D6\u6D88",
411
+ type: "warning"
412
+ }
413
+ ).then(doUpload);
414
+ } else {
415
+ doUpload();
416
+ }
417
+ }
418
+ };
373
419
  const readonly = composables.useComputedReadonly(props2);
374
420
  const onSuccess = (response, uploadFile, uploadFiles) => {
375
421
  const raw = uploadFile.raw;
@@ -404,7 +450,8 @@ var _sfc_main = vue.defineComponent({
404
450
  readonly,
405
451
  onSuccess,
406
452
  // onProgress,
407
- beforeUpload
453
+ beforeUpload,
454
+ handleExceed
408
455
  };
409
456
  }
410
457
  });
@@ -425,12 +472,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
425
472
  class: ["vkf-upload", {
426
473
  "is-readonly": _ctx.readonly,
427
474
  "is-empty": _ctx.fileList?.length === 0,
428
- "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit
475
+ "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit,
476
+ "is-exceedable": _ctx.exceedable
429
477
  }],
430
478
  "file-list": _ctx.fileList ?? [],
431
479
  "on-success": _ctx.onSuccess,
432
480
  "before-upload": _ctx.beforeUpload,
433
481
  disabled: _ctx.readonly || _ctx.disabled,
482
+ "on-exceed": _ctx.handleExceed,
434
483
  "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event))
435
484
  }), vue.createSlots({
436
485
  file: vue.withCtx(({ file }) => [
@@ -471,7 +520,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
471
520
  ]),
472
521
  key: "0"
473
522
  } : void 0
474
- ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled"]),
523
+ ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled", "on-exceed"]),
475
524
  vue.createElementVNode(
476
525
  "span",
477
526
  {
@@ -26,6 +26,6 @@
26
26
  .vkf-upload .el-upload-list{
27
27
  min-width: 100px;
28
28
  }
29
- .vkf-upload.is-limit .el-upload{
29
+ .vkf-upload.is-limit:not(.is-exceedable) .el-upload{
30
30
  display: none;
31
31
  }
@@ -1,6 +1,6 @@
1
1
  import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
2
2
  import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
3
- import { uploadProps, ElProgress, ElIcon, useNamespace, useLocale, ElUpload, ElLink } from 'element-plus';
3
+ import { uploadProps, ElProgress, ElIcon, useNamespace, useLocale, ElUpload, ElLink, ElMessageBox, genFileId } from 'element-plus';
4
4
  import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, createCommentVNode, normalizeClass, createBlock, createElementVNode, withModifiers, createVNode, withCtx, toDisplayString, normalizeStyle, shallowRef, normalizeProps, guardReactiveProps, mergeProps, createSlots, renderSlot, createTextVNode } from 'vue';
5
5
  import { pickObject } from '@vunk/core/shared/utils-object';
6
6
  import { createUploadBindProps } from '@vunk/form/shared/element-plus';
@@ -29,6 +29,24 @@ const props = {
29
29
  onDownload: {
30
30
  type: Function,
31
31
  default: void 0
32
+ },
33
+ onExceed: {
34
+ type: Function,
35
+ default: void 0
36
+ },
37
+ /**
38
+ * @description 达到limit后是否允许继续添加文件, 默认采用清空+添加的方式重新添加文件,你可以通过 onExceed 自定义行为
39
+ */
40
+ exceedable: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ /**
45
+ * @description 是否开启超出覆盖文件的确认框
46
+ */
47
+ confirmExceed: {
48
+ type: Boolean,
49
+ default: false
32
50
  }
33
51
  };
34
52
  const createBindProps = bindPropsFactory(props);
@@ -366,6 +384,34 @@ var _sfc_main = defineComponent({
366
384
  uploadRef.value?.abort(file);
367
385
  emit("update:fileList", props2.fileList);
368
386
  };
387
+ const handleExceed = (files, uploadFiles) => {
388
+ if (props2.onExceed) {
389
+ props2.onExceed(files, uploadFiles);
390
+ return;
391
+ }
392
+ if (props2.exceedable) {
393
+ const doUpload = () => {
394
+ uploadRef.value?.clearFiles();
395
+ files.forEach((file) => {
396
+ file.uid = genFileId();
397
+ uploadRef.value?.handleStart(file);
398
+ });
399
+ };
400
+ if (props2.confirmExceed) {
401
+ ElMessageBox.confirm(
402
+ `\u5DF2\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u6570\u91CF\u9650\u5236\uFF0C\u662F\u5426\u4F7F\u7528\u65B0\u6587\u4EF6\u91CD\u65B0\u4E0A\u4F20\uFF1F`,
403
+ "\u63D0\u793A",
404
+ {
405
+ confirmButtonText: "\u7EE7\u7EED",
406
+ cancelButtonText: "\u53D6\u6D88",
407
+ type: "warning"
408
+ }
409
+ ).then(doUpload);
410
+ } else {
411
+ doUpload();
412
+ }
413
+ }
414
+ };
369
415
  const readonly = useComputedReadonly(props2);
370
416
  const onSuccess = (response, uploadFile, uploadFiles) => {
371
417
  const raw = uploadFile.raw;
@@ -400,7 +446,8 @@ var _sfc_main = defineComponent({
400
446
  readonly,
401
447
  onSuccess,
402
448
  // onProgress,
403
- beforeUpload
449
+ beforeUpload,
450
+ handleExceed
404
451
  };
405
452
  }
406
453
  });
@@ -421,12 +468,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
421
468
  class: ["vkf-upload", {
422
469
  "is-readonly": _ctx.readonly,
423
470
  "is-empty": _ctx.fileList?.length === 0,
424
- "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit
471
+ "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit,
472
+ "is-exceedable": _ctx.exceedable
425
473
  }],
426
474
  "file-list": _ctx.fileList ?? [],
427
475
  "on-success": _ctx.onSuccess,
428
476
  "before-upload": _ctx.beforeUpload,
429
477
  disabled: _ctx.readonly || _ctx.disabled,
478
+ "on-exceed": _ctx.handleExceed,
430
479
  "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event))
431
480
  }), createSlots({
432
481
  file: withCtx(({ file }) => [
@@ -467,7 +516,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
467
516
  ]),
468
517
  key: "0"
469
518
  } : void 0
470
- ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled"]),
519
+ ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled", "on-exceed"]),
471
520
  createElementVNode(
472
521
  "span",
473
522
  {
@@ -1,6 +1,7 @@
1
1
  import { Func } from '@vunk/core';
2
2
  import { UploadFile } from 'element-plus';
3
3
  import { PropType } from 'vue';
4
+ import { OnExceed } from './types';
4
5
  export declare const props: {
5
6
  tip: {
6
7
  type: StringConstructor;
@@ -18,6 +19,24 @@ export declare const props: {
18
19
  type: PropType<Func<UploadFile>>;
19
20
  default: any;
20
21
  };
22
+ onExceed: {
23
+ type: PropType<OnExceed>;
24
+ default: any;
25
+ };
26
+ /**
27
+ * @description 达到limit后是否允许继续添加文件, 默认采用清空+添加的方式重新添加文件,你可以通过 onExceed 自定义行为
28
+ */
29
+ exceedable: {
30
+ type: BooleanConstructor;
31
+ default: boolean;
32
+ };
33
+ /**
34
+ * @description 是否开启超出覆盖文件的确认框
35
+ */
36
+ confirmExceed: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
21
40
  beforeRemove: {
22
41
  readonly type: import("vue").PropType<(uploadFile: UploadFile, uploadFiles: import("element-plus").UploadFiles) => import("element-plus/es/utils").Awaitable<boolean>>;
23
42
  readonly required: false;
@@ -78,15 +97,6 @@ export declare const props: {
78
97
  new (): any;
79
98
  readonly prototype: any;
80
99
  })[], unknown, unknown, () => void, boolean>;
81
- onExceed: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | (() => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | {
82
- (): (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
83
- new (): any;
84
- readonly prototype: any;
85
- } | ((new (...args: any[]) => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | (() => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | {
86
- (): (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
87
- new (): any;
88
- readonly prototype: any;
89
- })[], unknown, unknown, () => void, boolean>;
90
100
  crossorigin: {
91
101
  readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => "" | "anonymous" | "use-credentials") | ((new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => "" | "anonymous" | "use-credentials"))[], unknown, unknown>>;
92
102
  readonly required: false;
@@ -182,7 +192,7 @@ export declare const props: {
182
192
  inlineMessage: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, BooleanConstructor], unknown, unknown, "", boolean>;
183
193
  showMessage: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
184
194
  };
185
- export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"formItemTip", keyof T2> | Extract<"formItemTipClass", keyof T2> | Extract<"labelTip", keyof T2> | Extract<"information", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"name", keyof T2> | Extract<"data", keyof T2> | Extract<"multiple", keyof T2> | Extract<"onChange", keyof T2> | Extract<"withCredentials", keyof T2> | Extract<"drag", keyof T2> | Extract<"beforeUpload", keyof T2> | Extract<"beforeRemove", keyof T2> | Extract<"onRemove", keyof T2> | Extract<"onPreview", keyof T2> | Extract<"onSuccess", keyof T2> | Extract<"onProgress", keyof T2> | Extract<"onError", keyof T2> | Extract<"onExceed", keyof T2> | Extract<"crossorigin", keyof T2> | Extract<"action", keyof T2> | Extract<"headers", keyof T2> | Extract<"method", keyof T2> | Extract<"showFileList", keyof T2> | Extract<"accept", keyof T2> | Extract<"fileList", keyof T2> | Extract<"autoUpload", keyof T2> | Extract<"listType", keyof T2> | Extract<"httpRequest", keyof T2> | Extract<"limit", keyof T2> | Extract<"onDownload", keyof T2> | Extract<"preview", keyof T2> | Extract<"tip", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"required" | "formItemSize" | "formItemSlots" | "elRef" | "inline" | "readonly" | "formItemTip" | "formItemTipClass" | "labelTip" | "information" | "label" | "labelWidth" | "labelPosition" | "prop" | "rules" | "error" | "validateStatus" | "for" | "inlineMessage" | "showMessage" | "disabled" | "name" | "data" | "multiple" | "onChange" | "withCredentials" | "drag" | "beforeUpload" | "beforeRemove" | "onRemove" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit" | "onDownload" | "preview" | "tip", keyof T2>, KE> : Extract<"required" | "formItemSize" | "formItemSlots" | "elRef" | "inline" | "readonly" | "formItemTip" | "formItemTipClass" | "labelTip" | "information" | "label" | "labelWidth" | "labelPosition" | "prop" | "rules" | "error" | "validateStatus" | "for" | "inlineMessage" | "showMessage" | "disabled" | "name" | "data" | "multiple" | "onChange" | "withCredentials" | "drag" | "beforeUpload" | "beforeRemove" | "onRemove" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit" | "onDownload" | "preview" | "tip", keyof T2>]: { [k in Extract<"required" | "formItemSize" | "formItemSlots" | "elRef" | "inline" | "readonly" | "formItemTip" | "formItemTipClass" | "labelTip" | "information" | "label" | "labelWidth" | "labelPosition" | "prop" | "rules" | "error" | "validateStatus" | "for" | "inlineMessage" | "showMessage" | "disabled" | "name" | "data" | "multiple" | "onChange" | "withCredentials" | "drag" | "beforeUpload" | "beforeRemove" | "onRemove" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit" | "onDownload" | "preview" | "tip", keyof T2>]: T2[k]; }[P]; }>;
195
+ export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"formItemTip", keyof T2> | Extract<"formItemTipClass", keyof T2> | Extract<"labelTip", keyof T2> | Extract<"information", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"name", keyof T2> | Extract<"data", keyof T2> | Extract<"multiple", keyof T2> | Extract<"beforeUpload", keyof T2> | Extract<"beforeRemove", keyof T2> | Extract<"onRemove", keyof T2> | Extract<"onChange", keyof T2> | Extract<"onPreview", keyof T2> | Extract<"onSuccess", keyof T2> | Extract<"onProgress", keyof T2> | Extract<"onError", keyof T2> | Extract<"onExceed", keyof T2> | Extract<"crossorigin", keyof T2> | Extract<"action", keyof T2> | Extract<"headers", keyof T2> | Extract<"method", keyof T2> | Extract<"drag", keyof T2> | Extract<"withCredentials", keyof T2> | Extract<"showFileList", keyof T2> | Extract<"accept", keyof T2> | Extract<"fileList", keyof T2> | Extract<"autoUpload", keyof T2> | Extract<"listType", keyof T2> | Extract<"httpRequest", keyof T2> | Extract<"limit", keyof T2> | Extract<"onDownload", keyof T2> | Extract<"preview", keyof T2> | Extract<"tip", keyof T2> | Extract<"exceedable", keyof T2> | Extract<"confirmExceed", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"required" | "formItemSize" | "formItemSlots" | "elRef" | "inline" | "readonly" | "formItemTip" | "formItemTipClass" | "labelTip" | "information" | "label" | "labelWidth" | "labelPosition" | "prop" | "rules" | "error" | "validateStatus" | "for" | "inlineMessage" | "showMessage" | "disabled" | "name" | "data" | "multiple" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit" | "onDownload" | "preview" | "tip" | "exceedable" | "confirmExceed", keyof T2>, KE> : Extract<"required" | "formItemSize" | "formItemSlots" | "elRef" | "inline" | "readonly" | "formItemTip" | "formItemTipClass" | "labelTip" | "information" | "label" | "labelWidth" | "labelPosition" | "prop" | "rules" | "error" | "validateStatus" | "for" | "inlineMessage" | "showMessage" | "disabled" | "name" | "data" | "multiple" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit" | "onDownload" | "preview" | "tip" | "exceedable" | "confirmExceed", keyof T2>]: { [k in Extract<"required" | "formItemSize" | "formItemSlots" | "elRef" | "inline" | "readonly" | "formItemTip" | "formItemTipClass" | "labelTip" | "information" | "label" | "labelWidth" | "labelPosition" | "prop" | "rules" | "error" | "validateStatus" | "for" | "inlineMessage" | "showMessage" | "disabled" | "name" | "data" | "multiple" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit" | "onDownload" | "preview" | "tip" | "exceedable" | "confirmExceed", keyof T2>]: T2[k]; }[P]; }>;
186
196
  export declare const emits: {
187
197
  'update:fileList': any;
188
198
  remove: (e: UploadFile) => UploadFile;
@@ -97,9 +97,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
97
97
  onRemove?: (e: UploadFile) => any;
98
98
  }>, {
99
99
  disabled: boolean;
100
- file: UploadFile;
101
100
  onPreview: (arg: UploadFile) => any;
102
101
  listType: "text" | "picture" | "picture-card";
102
+ file: UploadFile;
103
103
  onDownload: (arg: UploadFile) => any;
104
104
  preview: boolean;
105
105
  }, {}, {
@@ -1,6 +1,6 @@
1
1
  import { UploadFile, UploadFiles } from 'element-plus';
2
- import type { AnyFunc } from '@vunk/core';
3
- import type { UploadRawFile } from './types';
2
+ import type { AnyFunc, Func } from '@vunk/core';
3
+ import type { UploadRawFile, OnExceed } from './types';
4
4
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
5
  tip: {
6
6
  type: StringConstructor;
@@ -15,9 +15,21 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
15
15
  default: any;
16
16
  };
17
17
  onDownload: {
18
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
18
+ type: import("vue").PropType<Func<UploadFile>>;
19
19
  default: any;
20
20
  };
21
+ onExceed: {
22
+ type: import("vue").PropType<OnExceed>;
23
+ default: any;
24
+ };
25
+ exceedable: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
29
+ confirmExceed: {
30
+ type: BooleanConstructor;
31
+ default: boolean;
32
+ };
21
33
  beforeRemove: {
22
34
  readonly type: import("vue").PropType<(uploadFile: UploadFile, uploadFiles: UploadFiles) => import("element-plus/es/utils").Awaitable<boolean>>;
23
35
  readonly required: false;
@@ -78,15 +90,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
78
90
  new (): any;
79
91
  readonly prototype: any;
80
92
  })[], unknown, unknown, () => void, boolean>;
81
- onExceed: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | (() => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | {
82
- (): (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
83
- new (): any;
84
- readonly prototype: any;
85
- } | ((new (...args: any[]) => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | (() => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | {
86
- (): (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
87
- new (): any;
88
- readonly prototype: any;
89
- })[], unknown, unknown, () => void, boolean>;
90
93
  crossorigin: {
91
94
  readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => "" | "anonymous" | "use-credentials") | ((new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => "" | "anonymous" | "use-credentials"))[], unknown, unknown>>;
92
95
  readonly required: false;
@@ -191,11 +194,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
191
194
  name: string;
192
195
  data: import("element-plus/es/utils").Mutable<{}>;
193
196
  multiple: boolean;
194
- onChange: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
195
- withCredentials: boolean;
196
- drag: boolean;
197
197
  beforeRemove: (uploadFile: UploadFile, uploadFiles: UploadFiles) => import("element-plus/es/utils").Awaitable<boolean>;
198
198
  onRemove: ((uploadFile: UploadFile, uploadFiles: UploadFiles) => void) & ((e: UploadFile) => any);
199
+ onChange: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
199
200
  onPreview: (uploadFile: UploadFile) => void;
200
201
  onProgress: (evt: import("element-plus").UploadProgressEvent, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
201
202
  onError: (error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
@@ -204,6 +205,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
204
205
  action: string;
205
206
  headers: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => Record<string, any> | Headers) | (() => Record<string, any> | Headers) | ((new (...args: any[]) => Record<string, any> | Headers) | (() => Record<string, any> | Headers))[], unknown, unknown>;
206
207
  method: string;
208
+ drag: boolean;
209
+ withCredentials: boolean;
207
210
  showFileList: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
208
211
  accept: string;
209
212
  autoUpload: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
@@ -214,14 +217,19 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
214
217
  uploadRef: import("vue").ShallowRef<{
215
218
  handleRemove: AnyFunc;
216
219
  abort: AnyFunc;
220
+ clearFiles: AnyFunc;
221
+ handleStart: Func<File>;
217
222
  }, {
218
223
  handleRemove: AnyFunc;
219
224
  abort: AnyFunc;
225
+ clearFiles: AnyFunc;
226
+ handleStart: Func<File>;
220
227
  }>;
221
228
  handleRemove: (file: UploadFile) => void;
222
229
  readonly: import("vue").ComputedRef<boolean>;
223
230
  onSuccess: (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
224
231
  beforeUpload: (rawFile: UploadRawFile) => Promise<any>;
232
+ handleExceed: (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
225
233
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
226
234
  'update:fileList': any;
227
235
  remove: (e: UploadFile) => UploadFile;
@@ -239,9 +247,21 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
239
247
  default: any;
240
248
  };
241
249
  onDownload: {
242
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
250
+ type: import("vue").PropType<Func<UploadFile>>;
251
+ default: any;
252
+ };
253
+ onExceed: {
254
+ type: import("vue").PropType<OnExceed>;
243
255
  default: any;
244
256
  };
257
+ exceedable: {
258
+ type: BooleanConstructor;
259
+ default: boolean;
260
+ };
261
+ confirmExceed: {
262
+ type: BooleanConstructor;
263
+ default: boolean;
264
+ };
245
265
  beforeRemove: {
246
266
  readonly type: import("vue").PropType<(uploadFile: UploadFile, uploadFiles: UploadFiles) => import("element-plus/es/utils").Awaitable<boolean>>;
247
267
  readonly required: false;
@@ -302,15 +322,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
302
322
  new (): any;
303
323
  readonly prototype: any;
304
324
  })[], unknown, unknown, () => void, boolean>;
305
- onExceed: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | (() => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | {
306
- (): (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
307
- new (): any;
308
- readonly prototype: any;
309
- } | ((new (...args: any[]) => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | (() => (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void) | {
310
- (): (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
311
- new (): any;
312
- readonly prototype: any;
313
- })[], unknown, unknown, () => void, boolean>;
314
325
  crossorigin: {
315
326
  readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => "" | "anonymous" | "use-credentials") | ((new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => "" | "anonymous" | "use-credentials"))[], unknown, unknown>>;
316
327
  readonly required: false;
@@ -426,11 +437,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
426
437
  name: string;
427
438
  data: import("element-plus/es/utils").Mutable<{}>;
428
439
  multiple: boolean;
429
- onChange: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
430
- withCredentials: boolean;
431
- drag: boolean;
432
440
  beforeUpload: Function;
433
441
  onRemove: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
442
+ onChange: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
434
443
  onPreview: (uploadFile: UploadFile) => void;
435
444
  onSuccess: (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
436
445
  onProgress: (evt: import("element-plus").UploadProgressEvent, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
@@ -438,6 +447,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
438
447
  onExceed: (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
439
448
  action: string;
440
449
  method: string;
450
+ drag: boolean;
451
+ withCredentials: boolean;
441
452
  showFileList: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
442
453
  accept: string;
443
454
  fileList: import("element-plus").UploadUserFile[];
@@ -447,6 +458,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
447
458
  onDownload: (arg: UploadFile) => any;
448
459
  preview: boolean;
449
460
  tip: string;
461
+ exceedable: boolean;
462
+ confirmExceed: boolean;
450
463
  }, {}, {
451
464
  VkfFormItem: {
452
465
  new (...args: any[]): any;
@@ -932,11 +945,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
932
945
  default: boolean;
933
946
  };
934
947
  onPreview: {
935
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
948
+ type: import("vue").PropType<Func<UploadFile>>;
936
949
  default: () => () => void;
937
950
  };
938
951
  onDownload: {
939
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
952
+ type: import("vue").PropType<Func<UploadFile>>;
940
953
  default: any;
941
954
  };
942
955
  preview: {
@@ -999,11 +1012,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
999
1012
  default: boolean;
1000
1013
  };
1001
1014
  onPreview: {
1002
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
1015
+ type: import("vue").PropType<Func<UploadFile>>;
1003
1016
  default: () => () => void;
1004
1017
  };
1005
1018
  onDownload: {
1006
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
1019
+ type: import("vue").PropType<Func<UploadFile>>;
1007
1020
  default: any;
1008
1021
  };
1009
1022
  preview: {
@@ -1014,9 +1027,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1014
1027
  onRemove?: (e: UploadFile) => any;
1015
1028
  }>, {
1016
1029
  disabled: boolean;
1017
- file: UploadFile;
1018
1030
  onPreview: (arg: UploadFile) => any;
1019
1031
  listType: "text" | "picture" | "picture-card";
1032
+ file: UploadFile;
1020
1033
  onDownload: (arg: UploadFile) => any;
1021
1034
  preview: boolean;
1022
1035
  }, {}, {
@@ -1,8 +1,9 @@
1
1
  import { VkfUpload } from '@vunk/form/components/upload';
2
2
  import { VueComponentPropsType } from '@vunk/core';
3
3
  import { BasicSource } from '@vunk/form/shared';
4
- import { UploadRawFile as _UploadRawFile } from 'element-plus';
4
+ import { UploadRawFile as _UploadRawFile, UploadProps } from 'element-plus';
5
5
  import { Setter } from '@vunk/form/shared/progress-it';
6
+ export type OnExceed = UploadProps['onExceed'];
6
7
  export interface UploadRawFile extends _UploadRawFile {
7
8
  progress: Setter;
8
9
  }
@@ -246,12 +246,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
246
246
  labelPosition: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "top" | "left" | "right", unknown>;
247
247
  inlineMessage: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, BooleanConstructor], unknown, unknown>;
248
248
  showMessage: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
249
- url: string;
249
+ accept: string;
250
250
  file: File;
251
+ url: string;
251
252
  chunkSize: number;
252
253
  fileServiceType: import("./types").FileServiceType;
253
254
  fileStatus: Status;
254
- accept: string;
255
255
  dictId: string;
256
256
  }, {}, {
257
257
  VkfFormItem: {
package/index.css CHANGED
@@ -381,7 +381,7 @@
381
381
  .vkf-upload .el-upload-list{
382
382
  min-width: 100px;
383
383
  }
384
- .vkf-upload.is-limit .el-upload{
384
+ .vkf-upload.is-limit:not(.is-exceedable) .el-upload{
385
385
  display: none;
386
386
  }
387
387
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@ export declare const createRadioGroupBindProps: <T2 extends import("@vunk/core")
15
15
  export declare const createRadioGroupOnEmits: <T2 extends import("@vunk/core").AnyFunc, EX extends ("update:modelValue" | "change")[]>(emit: T2, excludes?: EX) => { [P in EX extends (infer KE)[] ? Exclude<"update:modelValue" | "change", KE> : "update:modelValue" | "change"]: { [k in "update:modelValue" | "change"]: (...e: import("@vunk/core").RestParameters<T2>) => void; }[P]; };
16
16
  export declare const createCheckboxGroupBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"tag", keyof T2> | Extract<"size", keyof T2> | Extract<"disabled", keyof T2> | Extract<"fill", keyof T2> | Extract<"ariaLabel", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"max", keyof T2> | Extract<"min", keyof T2> | Extract<"textColor", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"tag" | "size" | "disabled" | "fill" | "ariaLabel" | "modelValue" | "validateEvent" | "max" | "min" | "textColor", keyof T2>, KE> : Extract<"tag" | "size" | "disabled" | "fill" | "ariaLabel" | "modelValue" | "validateEvent" | "max" | "min" | "textColor", keyof T2>]: { [k in Extract<"tag" | "size" | "disabled" | "fill" | "ariaLabel" | "modelValue" | "validateEvent" | "max" | "min" | "textColor", keyof T2>]: T2[k]; }[P]; }>;
17
17
  export declare const createCheckboxGroupOnEmits: <T2 extends import("@vunk/core").AnyFunc, EX extends ("update:modelValue" | "change")[]>(emit: T2, excludes?: EX) => { [P in EX extends (infer KE)[] ? Exclude<"update:modelValue" | "change", KE> : "update:modelValue" | "change"]: { [k in "update:modelValue" | "change"]: (...e: import("@vunk/core").RestParameters<T2>) => void; }[P]; };
18
- export declare const createUploadBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"disabled", keyof T2> | Extract<"name", keyof T2> | Extract<"data", keyof T2> | Extract<"multiple", keyof T2> | Extract<"beforeUpload", keyof T2> | Extract<"beforeRemove", keyof T2> | Extract<"onRemove", keyof T2> | Extract<"onChange", keyof T2> | Extract<"onPreview", keyof T2> | Extract<"onSuccess", keyof T2> | Extract<"onProgress", keyof T2> | Extract<"onError", keyof T2> | Extract<"onExceed", keyof T2> | Extract<"crossorigin", keyof T2> | Extract<"action", keyof T2> | Extract<"headers", keyof T2> | Extract<"method", keyof T2> | Extract<"drag", keyof T2> | Extract<"withCredentials", keyof T2> | Extract<"showFileList", keyof T2> | Extract<"accept", keyof T2> | Extract<"fileList", keyof T2> | Extract<"autoUpload", keyof T2> | Extract<"listType", keyof T2> | Extract<"httpRequest", keyof T2> | Extract<"limit", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"disabled" | "name" | "data" | "multiple" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit", keyof T2>, KE> : Extract<"disabled" | "name" | "data" | "multiple" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit", keyof T2>]: { [k in Extract<"disabled" | "name" | "data" | "multiple" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit", keyof T2>]: T2[k]; }[P]; }>;
18
+ export declare const createUploadBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"disabled", keyof T2> | Extract<"name", keyof T2> | Extract<"data", keyof T2> | Extract<"beforeUpload", keyof T2> | Extract<"beforeRemove", keyof T2> | Extract<"onRemove", keyof T2> | Extract<"onChange", keyof T2> | Extract<"onPreview", keyof T2> | Extract<"onSuccess", keyof T2> | Extract<"onProgress", keyof T2> | Extract<"onError", keyof T2> | Extract<"onExceed", keyof T2> | Extract<"crossorigin", keyof T2> | Extract<"action", keyof T2> | Extract<"headers", keyof T2> | Extract<"method", keyof T2> | Extract<"multiple", keyof T2> | Extract<"drag", keyof T2> | Extract<"withCredentials", keyof T2> | Extract<"showFileList", keyof T2> | Extract<"accept", keyof T2> | Extract<"fileList", keyof T2> | Extract<"autoUpload", keyof T2> | Extract<"listType", keyof T2> | Extract<"httpRequest", keyof T2> | Extract<"limit", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"disabled" | "name" | "data" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "multiple" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit", keyof T2>, KE> : Extract<"disabled" | "name" | "data" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "multiple" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit", keyof T2>]: { [k in Extract<"disabled" | "name" | "data" | "beforeUpload" | "beforeRemove" | "onRemove" | "onChange" | "onPreview" | "onSuccess" | "onProgress" | "onError" | "onExceed" | "crossorigin" | "action" | "headers" | "method" | "multiple" | "drag" | "withCredentials" | "showFileList" | "accept" | "fileList" | "autoUpload" | "listType" | "httpRequest" | "limit", keyof T2>]: T2[k]; }[P]; }>;
19
19
  export declare const createColorPickerBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"size", keyof T2> | Extract<"disabled", keyof T2> | Extract<"id", keyof T2> | Extract<"ariaLabel", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"tabindex", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"popperClass", keyof T2> | Extract<"teleported", keyof T2> | Extract<"showAlpha", keyof T2> | Extract<"colorFormat", keyof T2> | Extract<"predefine", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"size" | "disabled" | "id" | "ariaLabel" | "modelValue" | "tabindex" | "validateEvent" | "popperClass" | "teleported" | "showAlpha" | "colorFormat" | "predefine", keyof T2>, KE> : Extract<"size" | "disabled" | "id" | "ariaLabel" | "modelValue" | "tabindex" | "validateEvent" | "popperClass" | "teleported" | "showAlpha" | "colorFormat" | "predefine", keyof T2>]: { [k in Extract<"size" | "disabled" | "id" | "ariaLabel" | "modelValue" | "tabindex" | "validateEvent" | "popperClass" | "teleported" | "showAlpha" | "colorFormat" | "predefine", keyof T2>]: T2[k]; }[P]; }>;
20
20
  export declare const createColorPickerOnEmits: <T2 extends import("@vunk/core").AnyFunc, EX extends ("update:modelValue" | "change" | "focus" | "blur" | "activeChange")[]>(emit: T2, excludes?: EX) => { [P in EX extends (infer KE)[] ? Exclude<"update:modelValue" | "change" | "focus" | "blur" | "activeChange", KE> : "update:modelValue" | "change" | "focus" | "blur" | "activeChange"]: { [k in "update:modelValue" | "change" | "focus" | "blur" | "activeChange"]: (...e: import("@vunk/core").RestParameters<T2>) => void; }[P]; };
21
21
  export declare const createButtonBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"tag", keyof T2> | Extract<"type", keyof T2> | Extract<"size", keyof T2> | Extract<"disabled", keyof T2> | Extract<"icon", keyof T2> | Extract<"link", keyof T2> | Extract<"circle", keyof T2> | Extract<"text", keyof T2> | Extract<"dark", keyof T2> | Extract<"plain", keyof T2> | Extract<"autofocus", keyof T2> | Extract<"loading", keyof T2> | Extract<"nativeType", keyof T2> | Extract<"loadingIcon", keyof T2> | Extract<"bg", keyof T2> | Extract<"round", keyof T2> | Extract<"color", keyof T2> | Extract<"autoInsertSpace", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"tag" | "type" | "size" | "disabled" | "icon" | "link" | "circle" | "text" | "dark" | "plain" | "autofocus" | "loading" | "nativeType" | "loadingIcon" | "bg" | "round" | "color" | "autoInsertSpace", keyof T2>, KE> : Extract<"tag" | "type" | "size" | "disabled" | "icon" | "link" | "circle" | "text" | "dark" | "plain" | "autofocus" | "loading" | "nativeType" | "loadingIcon" | "bg" | "round" | "color" | "autoInsertSpace", keyof T2>]: { [k in Extract<"tag" | "type" | "size" | "disabled" | "icon" | "link" | "circle" | "text" | "dark" | "plain" | "autofocus" | "loading" | "nativeType" | "loadingIcon" | "bg" | "round" | "color" | "autoInsertSpace", keyof T2>]: T2[k]; }[P]; }>;