@opentinyvue/vue-file-upload 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ import FileUpload from './src/index';
13
+ export default FileUpload;
package/lib/index.js ADDED
@@ -0,0 +1,388 @@
1
+ function _extends() {
2
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
3
+ for (var e = 1; e < arguments.length; e++) {
4
+ var t = arguments[e];
5
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6
+ }
7
+ return n;
8
+ }, _extends.apply(null, arguments);
9
+ }
10
+ import { defineComponent, $prefix, $setup, $props } from "@opentinyvue/vue-common";
11
+ import PcTemplate from "./pc.js";
12
+ import MobileTemplate from "./mobile.js";
13
+ import MobileFirstTemplate from "./mobile-first.js";
14
+ import "@opentinyvue/vue-theme/file-upload/index.css";
15
+ var template = function template2(mode) {
16
+ var _process$env;
17
+ var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
18
+ if ("pc" === (tinyMode || mode)) {
19
+ return PcTemplate;
20
+ }
21
+ if ("mobile" === (tinyMode || mode)) {
22
+ return MobileTemplate;
23
+ }
24
+ if ("mobile-first" === (tinyMode || mode)) {
25
+ return MobileFirstTemplate;
26
+ }
27
+ return PcTemplate;
28
+ };
29
+ var $constants = {
30
+ FILE_UPLOAD_INNER_TEMPLATE: "file-upload-inner-template",
31
+ UPLOAD_INNER: "upload-inner",
32
+ UPLOAD_INNER_TEMPLATE: "upload-inner-template",
33
+ UPLOAD_LIST_INNER: "upload-list-inner",
34
+ UPLOAD_LIST_INNER_TEMPLATE: "upload-list-inner-template",
35
+ ONLY_SUPPORT: "ui.fileUpload.onlySupport",
36
+ COMMA: "ui.base.comma",
37
+ FILE_NOT_LESS_THAN: "ui.fileUpload.fileNotLessThan",
38
+ FILE_NOT_MORE_THAN: "ui.fileUpload.fileNotMoreThan",
39
+ FILE_SIZE_RANGE: "ui.fileUpload.fileSizeRange",
40
+ NUMBER_LIMIT: "ui.fileUpload.numberLimit",
41
+ FILE_STATUS: {
42
+ READY: "ready",
43
+ SUCESS: "success",
44
+ UPLOADING: "uploading",
45
+ FAIL: "fail",
46
+ DOWNLOADING: "downloading"
47
+ },
48
+ LIST_TYPE: {
49
+ TEXT: "text",
50
+ PICTURE_CARD: "picture-card",
51
+ PICTURE: "picture",
52
+ THUMB: "thumb",
53
+ PICTURE_SINGLE: "picture-single",
54
+ DRAG_SINGLE: "drag-single",
55
+ SAAS: "saas"
56
+ },
57
+ EDM: {
58
+ CHUNKINIT: "chunkInit",
59
+ FILESIZE: "fileSize",
60
+ CHUNKS: "chunks",
61
+ FILENAME: "fileName",
62
+ ISCHECKCODE: "isCheckCode",
63
+ CHECKCODE: "checkCode",
64
+ MULTIPART: "multipartFile",
65
+ DOCID: "docId",
66
+ CHUNK: "chunk",
67
+ SINGLEUPLOAD: "uploadFile",
68
+ LOWERNAME: "filename",
69
+ FOLDERKEY: "ui.fileUpload.folder",
70
+ FORMAT: "docFormat=wm&",
71
+ WATER: "usageScenes=water&wmType=wm&",
72
+ SOURCE: "usageScenes=source&",
73
+ URLCONTS: "&type=doc&pageNum=1&docVersion=",
74
+ EDMTOKEN: "EDM-Authorization",
75
+ TRACEID: "x-trace-id",
76
+ TEXT: "edm-text",
77
+ JSLIB: "./jslib/",
78
+ I18NKEY: "ui.fileUpload.token",
79
+ LARGEFILEKEY: "ui.fileUpload.largefile",
80
+ EXCEED: "ui.fileUpload.exceed",
81
+ SIZE: "ui.fileUpload.fileSize",
82
+ SIZE_17G: 17 * 1024 * 1024,
83
+ SIZE_2G: 2 * 1024 * 1024,
84
+ // 单位(KB)
85
+ SIZE_64M: 64 * 1024,
86
+ SIZE_32M: 32 * 1024,
87
+ SIZE_20M: 20 * 1024,
88
+ SIZE_16M: 16 * 1024,
89
+ SIZE_8M: 8 * 1024,
90
+ SIZE_4M: 4 * 1024,
91
+ SIZE_2M: 2 * 1024,
92
+ SIZE_0M: 0 * 1024,
93
+ FILEEMPTY: "ui.fileUpload.empty",
94
+ KIASCANTIP: "ui.fileUpload.kiaScanTip",
95
+ FILENAMEEXCEEDS: "ui.fileUpload.fileNameExceeds",
96
+ THEFILENAME: "ui.fileUpload.fileName",
97
+ CALCHASH: "ui.fileUpload.calcHash",
98
+ KIASTATUS: 12079,
99
+ NumberExceed: "ui.fileUpload.numberExceed",
100
+ notSupport: "ui.fileUpload.notSupport",
101
+ NOT_SUPPORT_NO_SUFFIX: "ui.fileUpload.notSupportNoSuffix",
102
+ STATUS_SPECIAL_CHARACTERS: 11005,
103
+ NOT_SUPPORT_SPECIAL_CHARACTERS: "ui.fileUpload.notSupportSpecialCharacters",
104
+ DOC_PREVIEW: "ui.fileUpload.docPreview"
105
+ },
106
+ IMAGE_TYPE: "image/*",
107
+ FILE_TYPE: {
108
+ EXCEL: "xls/xlsx",
109
+ FILE: "file",
110
+ PDF: "pdf",
111
+ PICTURE: "png/jpg/jpeg/gif/svg/webp/bmp/tif/pjp/apng/xbm/jxl/svgz/ico/tiff/jfif/pjpeg/avif",
112
+ PPT: "ppt/pptx",
113
+ TEXT: "txt",
114
+ WORD: "doc/docx",
115
+ ZIP: "zip/rar/arj/z/jar/lzh",
116
+ VIDEO: "mp4/m4v/3gp/mpg/flv/f4v/swf/avi/wmv/rmvb/mov/mts/m2t/ogg/webm/mkv",
117
+ AUDIO: "mp3/aac/ape/flac/wav/wma/amr/mid/pcm"
118
+ },
119
+ SOURCE_TYPE: {
120
+ SOURCE_VIDEO: "video",
121
+ SOURCE_AUDIO: "audio",
122
+ SOURCE_PICTURE: "picture"
123
+ },
124
+ MODE: {
125
+ BUBBLE: "bubble"
126
+ }
127
+ };
128
+ var fileUploadProps = _extends({}, $props, {
129
+ _constants: {
130
+ type: Object,
131
+ default: function _default() {
132
+ return $constants;
133
+ }
134
+ },
135
+ accept: String,
136
+ action: String,
137
+ autoUpload: {
138
+ type: Boolean,
139
+ default: function _default2() {
140
+ return true;
141
+ }
142
+ },
143
+ beforeRemove: Function,
144
+ beforeUpload: Function,
145
+ data: Object,
146
+ disabled: Boolean,
147
+ display: {
148
+ type: Boolean,
149
+ default: function _default3() {
150
+ return true;
151
+ }
152
+ },
153
+ drag: Boolean,
154
+ dragger: Boolean,
155
+ edm: {
156
+ type: Object,
157
+ default: function _default4() {
158
+ return {};
159
+ }
160
+ },
161
+ fileIconList: {
162
+ type: Array,
163
+ default: function _default5() {
164
+ return [];
165
+ }
166
+ },
167
+ fileList: {
168
+ type: Array,
169
+ default: function _default6() {
170
+ return [];
171
+ }
172
+ },
173
+ fileSize: {
174
+ type: [Number, Array],
175
+ validator: function validator(value) {
176
+ return Array.isArray(value) ? value[0] < value[1] : typeof value === "number";
177
+ }
178
+ },
179
+ fileTitle: {
180
+ type: String,
181
+ default: function _default7() {
182
+ return "附件";
183
+ }
184
+ },
185
+ headerShow: {
186
+ type: Boolean,
187
+ default: function _default8() {
188
+ return true;
189
+ }
190
+ },
191
+ headers: {
192
+ type: Object,
193
+ default: function _default9() {
194
+ return {};
195
+ }
196
+ },
197
+ httpRequest: Function,
198
+ limit: Number,
199
+ listType: {
200
+ type: String,
201
+ default: function _default10() {
202
+ return "text";
203
+ },
204
+ validator: function validator2(value) {
205
+ return !!$constants.LIST_TYPE[value.toUpperCase().replace("-", "_")];
206
+ }
207
+ },
208
+ mergeService: {
209
+ type: Boolean,
210
+ default: function _default11() {
211
+ return false;
212
+ }
213
+ },
214
+ multiple: Boolean,
215
+ name: {
216
+ type: String,
217
+ default: function _default12() {
218
+ return "file";
219
+ }
220
+ },
221
+ openDownloadFile: {
222
+ type: Boolean,
223
+ default: function _default13() {
224
+ return false;
225
+ }
226
+ },
227
+ showFileList: {
228
+ type: Boolean,
229
+ default: function _default14() {
230
+ return true;
231
+ }
232
+ },
233
+ size: String,
234
+ successStatistics: {
235
+ type: Boolean,
236
+ default: function _default15() {
237
+ return true;
238
+ }
239
+ },
240
+ thumbOption: {
241
+ type: Object,
242
+ default: function _default16() {
243
+ return {
244
+ popperClass: "",
245
+ width: 270,
246
+ showDownload: false,
247
+ downloadFile: Function,
248
+ showDel: false,
249
+ icon: "icon-attachment",
250
+ showTooltip: false
251
+ };
252
+ }
253
+ },
254
+ type: {
255
+ type: String,
256
+ default: function _default17() {
257
+ return "select";
258
+ }
259
+ },
260
+ uploadIcon: {
261
+ type: Boolean,
262
+ default: function _default18() {
263
+ return true;
264
+ }
265
+ },
266
+ withCredentials: {
267
+ type: Boolean,
268
+ default: function _default19() {
269
+ return true;
270
+ }
271
+ },
272
+ isFolderTitle: {
273
+ type: Boolean,
274
+ default: false
275
+ },
276
+ listOption: {
277
+ type: Object,
278
+ default: function _default20() {
279
+ return {
280
+ showUpdate: true,
281
+ showDel: true
282
+ };
283
+ }
284
+ },
285
+ maxNameLength: {
286
+ type: Number,
287
+ default: 20
288
+ },
289
+ scale: {
290
+ type: [Number, String],
291
+ default: 1
292
+ },
293
+ showName: {
294
+ type: Boolean,
295
+ default: false
296
+ },
297
+ sourceType: {
298
+ type: String,
299
+ default: "picture",
300
+ validator: function validator3(val) {
301
+ return val.split("/").every(function(type) {
302
+ return ["picture", "video", "audio"].includes(type);
303
+ });
304
+ }
305
+ },
306
+ showTitle: {
307
+ type: Boolean,
308
+ default: true
309
+ },
310
+ title: {
311
+ type: String,
312
+ default: ""
313
+ },
314
+ displayOnly: {
315
+ type: Boolean,
316
+ default: false
317
+ },
318
+ customClass: [String, Object, Array],
319
+ hwh5: Object,
320
+ mode: {
321
+ type: String,
322
+ default: "",
323
+ validator: function validator4(val) {
324
+ return ["", "bubble"].includes(val);
325
+ }
326
+ },
327
+ cacheToken: {
328
+ type: Boolean,
329
+ default: true
330
+ },
331
+ lockScroll: {
332
+ type: Boolean,
333
+ default: true
334
+ },
335
+ compact: {
336
+ type: Boolean,
337
+ default: false
338
+ },
339
+ beforeAddFile: Function,
340
+ encryptConfig: {
341
+ type: Object,
342
+ default: function _default21() {
343
+ return {
344
+ enabled: false,
345
+ encrypt: false,
346
+ watermark: ""
347
+ };
348
+ }
349
+ },
350
+ promptTip: {
351
+ type: Boolean,
352
+ default: false
353
+ },
354
+ isHidden: {
355
+ type: Boolean,
356
+ default: false
357
+ },
358
+ pasteUpload: {
359
+ type: Boolean,
360
+ default: false
361
+ },
362
+ reUploadable: Boolean,
363
+ reUploadTip: Function,
364
+ imageBgColor: String
365
+ // mobile-first新增
366
+ });
367
+ var FileUpload = defineComponent({
368
+ name: $prefix + "FileUpload",
369
+ props: fileUploadProps,
370
+ setup: function setup(props, context) {
371
+ return $setup({
372
+ props,
373
+ context,
374
+ template,
375
+ extend: {
376
+ ref: "file-upload-inner-template"
377
+ }
378
+ });
379
+ }
380
+ });
381
+ var version = "2.21.0";
382
+ FileUpload.install = function(Vue) {
383
+ Vue.component(FileUpload.name, FileUpload);
384
+ };
385
+ FileUpload.version = version;
386
+ export {
387
+ FileUpload as default
388
+ };