@vunk/form 1.1.70 → 1.1.72

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.
@@ -0,0 +1,198 @@
1
+ import { Status } from './const';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ fileId: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ };
7
+ url: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ chunkSize: {
12
+ type: NumberConstructor;
13
+ default: number;
14
+ };
15
+ fileServiceType: {
16
+ type: import("vue").PropType<import("../../upload-plus/src/types").FileServiceType>;
17
+ default: any;
18
+ };
19
+ fileStatus: {
20
+ type: import("vue").PropType<Status>;
21
+ default: any;
22
+ };
23
+ label: StringConstructor;
24
+ labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
25
+ prop: {
26
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | string[]) | (() => import("element-plus").FormItemProp) | ((new (...args: any[]) => string | string[]) | (() => import("element-plus").FormItemProp))[], unknown, unknown>>;
27
+ readonly required: false;
28
+ readonly validator: (val: unknown) => boolean;
29
+ __epPropKey: true;
30
+ };
31
+ required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
32
+ rules: {
33
+ readonly type: import("vue").PropType<unknown>;
34
+ readonly required: false;
35
+ readonly validator: (val: unknown) => boolean;
36
+ __epPropKey: true;
37
+ };
38
+ error: StringConstructor;
39
+ validateStatus: {
40
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "error" | "success" | "validating", unknown>>;
41
+ readonly required: false;
42
+ readonly validator: (val: unknown) => boolean;
43
+ __epPropKey: true;
44
+ };
45
+ for: StringConstructor;
46
+ inlineMessage: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, BooleanConstructor], unknown, unknown, "", boolean>;
47
+ showMessage: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
48
+ formItemSize: {
49
+ type: import("vue").PropType<"default" | "small" | "large">;
50
+ default: "default" | "small" | "large";
51
+ };
52
+ formItemSlots: {
53
+ type: import("vue").PropType<import("../../form-item/src/types").FormItemSlots>;
54
+ default: any;
55
+ };
56
+ elRef: {
57
+ type: import("vue").PropType<any>;
58
+ required: boolean;
59
+ };
60
+ inline: {
61
+ type: BooleanConstructor;
62
+ default: boolean;
63
+ };
64
+ readonly: {
65
+ type: BooleanConstructor;
66
+ default: any;
67
+ };
68
+ labelPosition: {
69
+ type: import("vue").PropType<"right">;
70
+ default: string;
71
+ };
72
+ }, {
73
+ formItemBindProps: import("vue").ComputedRef<{}>;
74
+ fileInfo: import("vue").Ref<{
75
+ id: string;
76
+ name: string;
77
+ url: string;
78
+ response: {
79
+ fileName: string;
80
+ size: number;
81
+ memo: string;
82
+ realName: string;
83
+ fileId: string;
84
+ fileServiceType: string;
85
+ id: string;
86
+ };
87
+ fileName: string;
88
+ size: number;
89
+ memo: string;
90
+ realName: string;
91
+ fileId: string;
92
+ fileServiceType: string;
93
+ }>;
94
+ handleDownload: () => void;
95
+ handlePause: () => void;
96
+ Status: typeof Status;
97
+ chunks: import("vue").Ref<{
98
+ fileId: string;
99
+ start: number;
100
+ end: number;
101
+ status: Status;
102
+ index: number;
103
+ fileServiceType?: import("../../upload-plus/src/types").FileServiceType;
104
+ progress: number;
105
+ data?: Blob;
106
+ }[]>;
107
+ fileStatus: import("vue").WritableComputedRef<Status>;
108
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
109
+ 'update:fileStatus': any;
110
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
111
+ fileId: {
112
+ type: StringConstructor;
113
+ default: string;
114
+ };
115
+ url: {
116
+ type: StringConstructor;
117
+ default: string;
118
+ };
119
+ chunkSize: {
120
+ type: NumberConstructor;
121
+ default: number;
122
+ };
123
+ fileServiceType: {
124
+ type: import("vue").PropType<import("../../upload-plus/src/types").FileServiceType>;
125
+ default: any;
126
+ };
127
+ fileStatus: {
128
+ type: import("vue").PropType<Status>;
129
+ default: any;
130
+ };
131
+ label: StringConstructor;
132
+ labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
133
+ prop: {
134
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | string[]) | (() => import("element-plus").FormItemProp) | ((new (...args: any[]) => string | string[]) | (() => import("element-plus").FormItemProp))[], unknown, unknown>>;
135
+ readonly required: false;
136
+ readonly validator: (val: unknown) => boolean;
137
+ __epPropKey: true;
138
+ };
139
+ required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
140
+ rules: {
141
+ readonly type: import("vue").PropType<unknown>;
142
+ readonly required: false;
143
+ readonly validator: (val: unknown) => boolean;
144
+ __epPropKey: true;
145
+ };
146
+ error: StringConstructor;
147
+ validateStatus: {
148
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "error" | "success" | "validating", unknown>>;
149
+ readonly required: false;
150
+ readonly validator: (val: unknown) => boolean;
151
+ __epPropKey: true;
152
+ };
153
+ for: StringConstructor;
154
+ inlineMessage: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, BooleanConstructor], unknown, unknown, "", boolean>;
155
+ showMessage: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
156
+ formItemSize: {
157
+ type: import("vue").PropType<"default" | "small" | "large">;
158
+ default: "default" | "small" | "large";
159
+ };
160
+ formItemSlots: {
161
+ type: import("vue").PropType<import("../../form-item/src/types").FormItemSlots>;
162
+ default: any;
163
+ };
164
+ elRef: {
165
+ type: import("vue").PropType<any>;
166
+ required: boolean;
167
+ };
168
+ inline: {
169
+ type: BooleanConstructor;
170
+ default: boolean;
171
+ };
172
+ readonly: {
173
+ type: BooleanConstructor;
174
+ default: any;
175
+ };
176
+ labelPosition: {
177
+ type: import("vue").PropType<"right">;
178
+ default: string;
179
+ };
180
+ }>> & {
181
+ "onUpdate:fileStatus"?: (...args: any[] | unknown[]) => any;
182
+ }, {
183
+ labelWidth: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
184
+ required: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
185
+ inlineMessage: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, BooleanConstructor], unknown, unknown>;
186
+ showMessage: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
187
+ formItemSize: "default" | "small" | "large";
188
+ formItemSlots: import("../../form-item/src/types").FormItemSlots;
189
+ inline: boolean;
190
+ readonly: boolean;
191
+ labelPosition: "right";
192
+ url: string;
193
+ chunkSize: number;
194
+ fileServiceType: import("../../upload-plus/src/types").FileServiceType;
195
+ fileStatus: Status;
196
+ fileId: string;
197
+ }, {}>;
198
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { rFile } from '@skzz/platform/api/basic';
2
+ import { ApiReturnType } from '@vunk/core';
3
+ import { Status } from './const';
4
+ import { __VkfUploadPlus } from '@vunk/form/components/upload-plus';
5
+ export type FileInfo = ApiReturnType<typeof rFile>;
6
+ export type FileServiceType = __VkfUploadPlus.FileServiceType;
7
+ export interface DownloadChunk {
8
+ fileId: string;
9
+ start: number;
10
+ end: number;
11
+ status: Status;
12
+ index: number;
13
+ fileServiceType?: FileServiceType;
14
+ progress: number;
15
+ data?: Blob;
16
+ }
17
+ export {};
@@ -73,6 +73,8 @@
73
73
  .vkf-upload-plus-label .el-input{
74
74
  pointer-events: none;
75
75
  --el-input-border-color: transparent;
76
+ --el-input-focus-border-color: transparent;
77
+ --el-input-hover-border-color: transparent;
76
78
  }
77
79
  .vkf-upload-plus-label .el-input.is-success .el-icon{
78
80
  color: var(--el-color-success);
@@ -1,15 +1,19 @@
1
1
  import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
2
- import { openBlock, createElementBlock, createElementVNode, defineComponent, watch, ref, computed, watchEffect, onBeforeUnmount, resolveComponent, createBlock, mergeProps, withCtx, createVNode, normalizeClass, createCommentVNode, Fragment, renderList, normalizeStyle, createTextVNode } from 'vue';
3
- import { ElMessage, ElInput, ElButtonGroup, ElButton, ElIcon } from 'element-plus';
2
+ import { openBlock, createElementBlock, createElementVNode, defineComponent, watch, ref, computed, watchEffect, onBeforeUnmount, resolveComponent, resolveDirective, createBlock, mergeProps, withCtx, createVNode, normalizeClass, createCommentVNode, Fragment, renderList, normalizeStyle, withDirectives, createTextVNode } from 'vue';
3
+ import { ElMessage, ElInput, ElButtonGroup, ElButton, ElIcon, vLoading } from 'element-plus';
4
4
  import { createFileChunk, calculateFileHashSample } from '@vunk/form/shared/upload';
5
5
  import { RestFetch } from '@vunk/core/shared/utils-fetch';
6
6
  import '@vunk/core/shared/utils-promise';
7
7
  import { isPlainObject as isPlainObject$1 } from '@vunk/core/shared/utils-object';
8
+ import { restFetch as restFetch$1 } from '@skzz/platform/shared/fetch/platform';
8
9
  import { useModelComputed } from '@vunk/core/composables';
9
10
 
10
11
  const props = {
11
12
  ..._VkfFormItemCtx.props,
12
- size: {
13
+ /**
14
+ * @description 分片大小
15
+ */
16
+ chunkSize: {
13
17
  type: Number,
14
18
  default: 1024 / (16 * 16) * 1024 * 1024
15
19
  },
@@ -24,6 +28,9 @@ const props = {
24
28
  type: String,
25
29
  default: ""
26
30
  },
31
+ /**
32
+ * @description 上传文件类型
33
+ */
27
34
  accept: {
28
35
  type: String,
29
36
  default: ""
@@ -32,10 +39,17 @@ const props = {
32
39
  type: String,
33
40
  default: void 0
34
41
  },
42
+ /**
43
+ * @description v-model:file 文件对象
44
+ */
35
45
  file: {
36
46
  type: Object,
37
47
  default: void 0
38
48
  },
49
+ /**
50
+ * @description
51
+ * v-model:fileStatus 当前文件状态: wait, doPause, pause, doUpload, uploading, error, done
52
+ */
39
53
  fileStatus: {
40
54
  type: String,
41
55
  default: void 0
@@ -9500,7 +9514,7 @@ lodash.prototype.at=seq.at;lodash.prototype.chain=seq.wrapperChain;lodash.protot
9500
9514
  lodash.prototype.first=lodash.prototype.head;if(symIterator){lodash.prototype[symIterator]=seq.toIterator;}throttle(err=>{let message="\u7CFB\u7EDF\u9519\u8BEF";if(err instanceof Error){const local={"Failed to fetch":"\u8BF7\u6C42\u5931\u8D25","The user aborted a request.":"\u8BF7\u6C42\u88AB\u7EC8\u6B62"};message=local[err.message]||err.message;if(err.name==="AbortError"&&err.message.includes("user")){return;}}if(typeof err==="string"){message=err;}if(isPlainObject$1(err)){const msg=err==null?void 0:err.msg;msg&&(message=msg);}ElMessage({type:"error",message});},500,{trailing:false});const setDefaultHeader=config=>{const headers=config.headers;headers.set("application","platform");headers.set("tenant","default");return config;};
9501
9515
 
9502
9516
  const restFetch = new RestFetch({
9503
- baseURL: "http://192.168.110.209:36800",
9517
+ baseURL: restFetch$1.baseURL,
9504
9518
  presetRequestInit: (config) => {
9505
9519
  const header = config.headers;
9506
9520
  const token = getToken();
@@ -9673,6 +9687,9 @@ var script = defineComponent({
9673
9687
  ElIcon,
9674
9688
  SuccessFilled: success_filled_default
9675
9689
  },
9690
+ directives: {
9691
+ loading: vLoading
9692
+ },
9676
9693
  props,
9677
9694
  emits,
9678
9695
  setup(props2, {
@@ -9729,7 +9746,7 @@ var script = defineComponent({
9729
9746
  if (!containerFile.value)
9730
9747
  return;
9731
9748
  fileStatus.value = Status.uploading;
9732
- const chunkFiles = createFileChunk(containerFile.value, props2.size);
9749
+ const chunkFiles = createFileChunk(containerFile.value, props2.chunkSize);
9733
9750
  const hash = await calculateFileHashSample(containerFile.value);
9734
9751
  containerHash.value = hash;
9735
9752
  const {
@@ -9828,16 +9845,19 @@ var script = defineComponent({
9828
9845
  start();
9829
9846
  });
9830
9847
  }
9848
+ const merging = ref(false);
9831
9849
  function cFile() {
9832
9850
  if (!containerFile.value)
9833
9851
  return;
9834
9852
  if (!containerHash.value)
9835
9853
  return;
9854
+ merging.value = true;
9836
9855
  return merge({
9837
9856
  filename: containerFile.value.name,
9838
9857
  identifier: containerHash.value,
9839
9858
  fileServiceType: props2.fileServiceType,
9840
- dictId: props2.dictId
9859
+ dictId: props2.dictId,
9860
+ totalChunk: chunks.value.length
9841
9861
  }).then((res) => {
9842
9862
  emit("success", res);
9843
9863
  }).catch((err) => {
@@ -9847,6 +9867,8 @@ var script = defineComponent({
9847
9867
  message: "\u5408\u5E76\u5931\u8D25"
9848
9868
  });
9849
9869
  throw err;
9870
+ }).finally(() => {
9871
+ merging.value = false;
9850
9872
  });
9851
9873
  }
9852
9874
  onBeforeUnmount(() => {
@@ -9862,7 +9884,8 @@ var script = defineComponent({
9862
9884
  chunks,
9863
9885
  Status,
9864
9886
  filePrefixIcon,
9865
- handlePause
9887
+ handlePause,
9888
+ merging
9866
9889
  };
9867
9890
  }
9868
9891
  });
@@ -9897,6 +9920,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
9897
9920
  const _component_el_button = resolveComponent("el-button");
9898
9921
  const _component_el_button_group = resolveComponent("el-button-group");
9899
9922
  const _component_VkfFormItem = resolveComponent("VkfFormItem");
9923
+ const _directive_loading = resolveDirective("loading");
9900
9924
  return openBlock(), createBlock(
9901
9925
  _component_VkfFormItem,
9902
9926
  mergeProps(_ctx.formItemBindProps, {
@@ -9963,8 +9987,15 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
9963
9987
  }, null, 40, _hoisted_6), createVNode(_component_el_button_group, {
9964
9988
  class: "vkf-upload-plus-btng"
9965
9989
  }, {
9966
- default: withCtx(() => [_ctx.fileStatus === _ctx.Status.uploading ? (openBlock(), createBlock(_component_ElButton, {
9990
+ default: withCtx(() => [_ctx.merging ? withDirectives((openBlock(), createBlock(_component_ElButton, {
9967
9991
  key: 0,
9992
+ type: "success"
9993
+ }, {
9994
+ default: withCtx(() => [createTextVNode(" \u5408\u5E76 ")]),
9995
+ _: 1
9996
+ /* STABLE */
9997
+ })), [[_directive_loading, _ctx.merging]]) : _ctx.fileStatus === _ctx.Status.uploading ? (openBlock(), createBlock(_component_ElButton, {
9998
+ key: 1,
9968
9999
  type: "danger",
9969
10000
  onClick: _ctx.handlePause
9970
10001
  }, {
@@ -9972,7 +10003,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
9972
10003
  _: 1
9973
10004
  /* STABLE */
9974
10005
  }, 8, ["onClick"])) : _ctx.fileStatus === _ctx.Status.done ? (openBlock(), createBlock(_component_ElButton, {
9975
- key: 1,
10006
+ key: 2,
9976
10007
  type: "success",
9977
10008
  disabled: ""
9978
10009
  }, {
@@ -9980,7 +10011,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
9980
10011
  _: 1
9981
10012
  /* STABLE */
9982
10013
  })) : (openBlock(), createBlock(_component_el_button, {
9983
- key: 2,
10014
+ key: 3,
9984
10015
  type: "primary",
9985
10016
  disabled: !_ctx.containerFile,
9986
10017
  onClick: _ctx.handleUpload
@@ -34,4 +34,5 @@ export declare const merge: (data: {
34
34
  filename: string;
35
35
  dictId?: string;
36
36
  fileServiceType?: string;
37
+ totalChunk: number;
37
38
  }) => Promise<FileInfo>;