@vunk/form 2.9.1 → 2.9.3

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,35 @@ 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
+ uploadRef.value?.submit();
404
+ };
405
+ if (props2.confirmExceed) {
406
+ elementPlus.ElMessageBox.confirm(
407
+ `\u5DF2\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u6570\u91CF\u9650\u5236\uFF0C\u662F\u5426\u4F7F\u7528\u65B0\u6587\u4EF6\u91CD\u65B0\u4E0A\u4F20\uFF1F`,
408
+ "\u63D0\u793A",
409
+ {
410
+ confirmButtonText: "\u7EE7\u7EED",
411
+ cancelButtonText: "\u53D6\u6D88",
412
+ type: "warning"
413
+ }
414
+ ).then(doUpload);
415
+ } else {
416
+ doUpload();
417
+ }
418
+ }
419
+ };
373
420
  const readonly = composables.useComputedReadonly(props2);
374
421
  const onSuccess = (response, uploadFile, uploadFiles) => {
375
422
  const raw = uploadFile.raw;
@@ -404,7 +451,8 @@ var _sfc_main = vue.defineComponent({
404
451
  readonly,
405
452
  onSuccess,
406
453
  // onProgress,
407
- beforeUpload
454
+ beforeUpload,
455
+ handleExceed
408
456
  };
409
457
  }
410
458
  });
@@ -425,12 +473,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
425
473
  class: ["vkf-upload", {
426
474
  "is-readonly": _ctx.readonly,
427
475
  "is-empty": _ctx.fileList?.length === 0,
428
- "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit
476
+ "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit,
477
+ "is-exceedable": _ctx.exceedable
429
478
  }],
430
479
  "file-list": _ctx.fileList ?? [],
431
480
  "on-success": _ctx.onSuccess,
432
481
  "before-upload": _ctx.beforeUpload,
433
482
  disabled: _ctx.readonly || _ctx.disabled,
483
+ "on-exceed": _ctx.handleExceed,
434
484
  "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event))
435
485
  }), vue.createSlots({
436
486
  file: vue.withCtx(({ file }) => [
@@ -471,7 +521,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
471
521
  ]),
472
522
  key: "0"
473
523
  } : void 0
474
- ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled"]),
524
+ ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled", "on-exceed"]),
475
525
  vue.createElementVNode(
476
526
  "span",
477
527
  {
@@ -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,35 @@ 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
+ uploadRef.value?.submit();
400
+ };
401
+ if (props2.confirmExceed) {
402
+ ElMessageBox.confirm(
403
+ `\u5DF2\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u6570\u91CF\u9650\u5236\uFF0C\u662F\u5426\u4F7F\u7528\u65B0\u6587\u4EF6\u91CD\u65B0\u4E0A\u4F20\uFF1F`,
404
+ "\u63D0\u793A",
405
+ {
406
+ confirmButtonText: "\u7EE7\u7EED",
407
+ cancelButtonText: "\u53D6\u6D88",
408
+ type: "warning"
409
+ }
410
+ ).then(doUpload);
411
+ } else {
412
+ doUpload();
413
+ }
414
+ }
415
+ };
369
416
  const readonly = useComputedReadonly(props2);
370
417
  const onSuccess = (response, uploadFile, uploadFiles) => {
371
418
  const raw = uploadFile.raw;
@@ -400,7 +447,8 @@ var _sfc_main = defineComponent({
400
447
  readonly,
401
448
  onSuccess,
402
449
  // onProgress,
403
- beforeUpload
450
+ beforeUpload,
451
+ handleExceed
404
452
  };
405
453
  }
406
454
  });
@@ -421,12 +469,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
421
469
  class: ["vkf-upload", {
422
470
  "is-readonly": _ctx.readonly,
423
471
  "is-empty": _ctx.fileList?.length === 0,
424
- "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit
472
+ "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit,
473
+ "is-exceedable": _ctx.exceedable
425
474
  }],
426
475
  "file-list": _ctx.fileList ?? [],
427
476
  "on-success": _ctx.onSuccess,
428
477
  "before-upload": _ctx.beforeUpload,
429
478
  disabled: _ctx.readonly || _ctx.disabled,
479
+ "on-exceed": _ctx.handleExceed,
430
480
  "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event))
431
481
  }), createSlots({
432
482
  file: withCtx(({ file }) => [
@@ -467,7 +517,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
467
517
  ]),
468
518
  key: "0"
469
519
  } : void 0
470
- ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled"]),
520
+ ]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled", "on-exceed"]),
471
521
  createElementVNode(
472
522
  "span",
473
523
  {
@@ -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,21 @@ 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>;
222
+ submit: AnyFunc;
217
223
  }, {
218
224
  handleRemove: AnyFunc;
219
225
  abort: AnyFunc;
226
+ clearFiles: AnyFunc;
227
+ handleStart: Func<File>;
228
+ submit: AnyFunc;
220
229
  }>;
221
230
  handleRemove: (file: UploadFile) => void;
222
231
  readonly: import("vue").ComputedRef<boolean>;
223
232
  onSuccess: (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
224
233
  beforeUpload: (rawFile: UploadRawFile) => Promise<any>;
234
+ handleExceed: (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
225
235
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
226
236
  'update:fileList': any;
227
237
  remove: (e: UploadFile) => UploadFile;
@@ -239,9 +249,21 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
239
249
  default: any;
240
250
  };
241
251
  onDownload: {
242
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
252
+ type: import("vue").PropType<Func<UploadFile>>;
253
+ default: any;
254
+ };
255
+ onExceed: {
256
+ type: import("vue").PropType<OnExceed>;
243
257
  default: any;
244
258
  };
259
+ exceedable: {
260
+ type: BooleanConstructor;
261
+ default: boolean;
262
+ };
263
+ confirmExceed: {
264
+ type: BooleanConstructor;
265
+ default: boolean;
266
+ };
245
267
  beforeRemove: {
246
268
  readonly type: import("vue").PropType<(uploadFile: UploadFile, uploadFiles: UploadFiles) => import("element-plus/es/utils").Awaitable<boolean>>;
247
269
  readonly required: false;
@@ -302,15 +324,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
302
324
  new (): any;
303
325
  readonly prototype: any;
304
326
  })[], 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
327
  crossorigin: {
315
328
  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
329
  readonly required: false;
@@ -426,11 +439,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
426
439
  name: string;
427
440
  data: import("element-plus/es/utils").Mutable<{}>;
428
441
  multiple: boolean;
429
- onChange: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
430
- withCredentials: boolean;
431
- drag: boolean;
432
442
  beforeUpload: Function;
433
443
  onRemove: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
444
+ onChange: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
434
445
  onPreview: (uploadFile: UploadFile) => void;
435
446
  onSuccess: (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
436
447
  onProgress: (evt: import("element-plus").UploadProgressEvent, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
@@ -438,6 +449,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
438
449
  onExceed: (files: File[], uploadFiles: import("element-plus").UploadUserFile[]) => void;
439
450
  action: string;
440
451
  method: string;
452
+ drag: boolean;
453
+ withCredentials: boolean;
441
454
  showFileList: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
442
455
  accept: string;
443
456
  fileList: import("element-plus").UploadUserFile[];
@@ -447,6 +460,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
447
460
  onDownload: (arg: UploadFile) => any;
448
461
  preview: boolean;
449
462
  tip: string;
463
+ exceedable: boolean;
464
+ confirmExceed: boolean;
450
465
  }, {}, {
451
466
  VkfFormItem: {
452
467
  new (...args: any[]): any;
@@ -932,11 +947,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
932
947
  default: boolean;
933
948
  };
934
949
  onPreview: {
935
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
950
+ type: import("vue").PropType<Func<UploadFile>>;
936
951
  default: () => () => void;
937
952
  };
938
953
  onDownload: {
939
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
954
+ type: import("vue").PropType<Func<UploadFile>>;
940
955
  default: any;
941
956
  };
942
957
  preview: {
@@ -999,11 +1014,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
999
1014
  default: boolean;
1000
1015
  };
1001
1016
  onPreview: {
1002
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
1017
+ type: import("vue").PropType<Func<UploadFile>>;
1003
1018
  default: () => () => void;
1004
1019
  };
1005
1020
  onDownload: {
1006
- type: import("vue").PropType<import("@vunk/core").Func<UploadFile>>;
1021
+ type: import("vue").PropType<Func<UploadFile>>;
1007
1022
  default: any;
1008
1023
  };
1009
1024
  preview: {
@@ -1014,9 +1029,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1014
1029
  onRemove?: (e: UploadFile) => any;
1015
1030
  }>, {
1016
1031
  disabled: boolean;
1017
- file: UploadFile;
1018
1032
  onPreview: (arg: UploadFile) => any;
1019
1033
  listType: "text" | "picture" | "picture-card";
1034
+ file: UploadFile;
1020
1035
  onDownload: (arg: UploadFile) => any;
1021
1036
  preview: boolean;
1022
1037
  }, {}, {
@@ -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.3",
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]; }>;