@opentinyvue/vue-file-upload 2.22.0 → 3.22.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/lib/pc.js CHANGED
@@ -1,94 +1,3 @@
1
- import { renderless, api } from '@opentinyvue/vue-renderless/file-upload/vue';
2
- import { defineComponent, props, setup, isVue3 } from '@opentinyvue/vue-common';
3
- import UploadList from '@opentinyvue/vue-upload-list';
4
- import Upload from '@opentinyvue/vue-upload';
5
- import Progress from '@opentinyvue/vue-progress';
6
- import '@opentinyvue/vue-theme/file-upload/index.css';
7
- import '@opentinyvue/vue-theme/upload-list/index.css';
8
- import '@opentinyvue/vue-theme/upload-dragger/index.css';
9
- import '@opentinyvue/vue-theme/upload/index.css';
10
- import Modal from '@opentinyvue/vue-modal';
11
- import DialogBox from '@opentinyvue/vue-dialog-box';
12
- import Popover from '@opentinyvue/vue-popover';
13
- import Button from '@opentinyvue/vue-button';
14
- import Input from '@opentinyvue/vue-input';
15
- import Switch from '@opentinyvue/vue-switch';
16
- import Tooltip from '@opentinyvue/vue-tooltip';
17
- import { iconAttachment, iconSuccessful, iconClose, iconDownload, iconFileCloudupload, iconPlus, iconHelpCircle } from '@opentinyvue/vue-icon';
18
- import Streamsaver from 'streamsaver';
19
-
20
- function getDefaultExportFromCjs(x) {
21
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
22
- }
23
-
24
- var helper;
25
- var hasRequiredHelper;
26
- function requireHelper() {
27
- if (hasRequiredHelper) return helper;
28
- hasRequiredHelper = 1;
29
- function _extends() {
30
- return _extends = Object.assign ? Object.assign.bind() : function(a) {
31
- for (var b, c = 1; c < arguments.length; c++) for (var d in b = arguments[c], b) Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d]);
32
- return a;
33
- }, _extends.apply(this, arguments);
34
- }
35
- var normalMerge = ["attrs", "props", "domProps"], toArrayMerge = ["class", "style", "directives"], functionalMerge = ["on", "nativeOn"], mergeJsxProps = function mergeJsxProps2(a) {
36
- return a.reduce(function(c, a2) {
37
- for (var b in a2) if (!c[b]) c[b] = a2[b];
38
- else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends({}, c[b], a2[b]);
39
- else if (-1 !== toArrayMerge.indexOf(b)) {
40
- var d = c[b] instanceof Array ? c[b] : [c[b]], e = a2[b] instanceof Array ? a2[b] : [a2[b]];
41
- c[b] = [].concat(d, e);
42
- } else if (-1 !== functionalMerge.indexOf(b)) {
43
- for (var f in a2[b]) if (c[b][f]) {
44
- var g = c[b][f] instanceof Array ? c[b][f] : [c[b][f]], h = a2[b][f] instanceof Array ? a2[b][f] : [a2[b][f]];
45
- c[b][f] = [].concat(g, h);
46
- } else c[b][f] = a2[b][f];
47
- } else if ("hook" === b) for (var i in a2[b]) c[b][i] = c[b][i] ? mergeFn(c[b][i], a2[b][i]) : a2[b][i];
48
- else c[b] = a2[b];
49
- return c;
50
- }, {});
51
- }, mergeFn = function mergeFn2(a, b) {
52
- return function() {
53
- a && a.apply(this, arguments), b && b.apply(this, arguments);
54
- };
55
- };
56
- helper = mergeJsxProps;
57
- return helper;
58
- }
59
- var helperExports = requireHelper();
60
- var _mergeJSXProps5 = /* @__PURE__ */ getDefaultExportFromCjs(helperExports);
61
-
62
- function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
63
- var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
64
- if (render) {
65
- options.render = render;
66
- options.staticRenderFns = staticRenderFns;
67
- options._compiled = true;
68
- }
69
- var hook;
70
- if (injectStyles) {
71
- hook = injectStyles;
72
- }
73
- if (hook) {
74
- if (options.functional) {
75
- options._injectStyles = hook;
76
- var originalRender = options.render;
77
- options.render = function renderWithStyleInjection(h, context) {
78
- hook.call(context);
79
- return originalRender(h, context);
80
- };
81
- } else {
82
- var existing = options.beforeCreate;
83
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
84
- }
85
- }
86
- return {
87
- exports: scriptExports,
88
- options
89
- };
90
- }
91
-
92
1
  function _extends() {
93
2
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
94
3
  for (var e = 1; e < arguments.length; e++) {
@@ -98,6 +7,28 @@ function _extends() {
98
7
  return n;
99
8
  }, _extends.apply(null, arguments);
100
9
  }
10
+ import { createVNode, resolveComponent, createTextVNode, mergeProps, isVNode } from "vue";
11
+ import { api, renderless } from "@opentinyvue/vue-renderless/file-upload/vue";
12
+ import { defineComponent, props, h, setup as _setup, isVue3 } from "@opentinyvue/vue-common";
13
+ import UploadList from "@opentinyvue/vue-upload-list";
14
+ import Upload from "@opentinyvue/vue-upload";
15
+ import Progress from "@opentinyvue/vue-progress";
16
+ import "@opentinyvue/vue-theme/file-upload/index.css";
17
+ import "@opentinyvue/vue-theme/upload-list/index.css";
18
+ import "@opentinyvue/vue-theme/upload-dragger/index.css";
19
+ import "@opentinyvue/vue-theme/upload/index.css";
20
+ import Modal from "@opentinyvue/vue-modal";
21
+ import DialogBox from "@opentinyvue/vue-dialog-box";
22
+ import Popover from "@opentinyvue/vue-popover";
23
+ import Button from "@opentinyvue/vue-button";
24
+ import Input from "@opentinyvue/vue-input";
25
+ import Switch from "@opentinyvue/vue-switch";
26
+ import Tooltip from "@opentinyvue/vue-tooltip";
27
+ import { iconAttachment, iconSuccessful, iconClose, iconDownload, iconFileCloudupload, iconPlus, iconHelpCircle } from "@opentinyvue/vue-icon";
28
+ import Streamsaver from "streamsaver";
29
+ function _isSlot(s) {
30
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
31
+ }
101
32
  var TinyIconAttachment = iconAttachment();
102
33
  var TinyIconSuccessful = iconSuccessful();
103
34
  var TinyIconClose = iconClose();
@@ -105,12 +36,12 @@ var TinyIconDownload = iconDownload();
105
36
  var TinyIconFileCloudupload = iconFileCloudupload();
106
37
  var TinyIconPlus = iconPlus();
107
38
  var TinyIconHelpCircle = iconHelpCircle();
108
- var __vue2_script = defineComponent({
39
+ var _sfc_main = /* @__PURE__ */ defineComponent({
109
40
  inheritAttrs: false,
110
41
  props: [].concat(props, ["edm", "action", "headers", "data", "multiple", "name", "drag", "dragger", "withCredentials", "showFileList", "accept", "type", "beforeUpload", "beforeRemove", "fileList", "autoUpload", "listType", "httpRequest", "disabled", "limit", "openDownloadFile", "mergeService", "fileSize", "thumbOption", "isFolderTitle", "listOption", "maxNameLength", "isHidden", "sourceType", "cacheToken", "pasteUpload", "reUploadable", "reUploadTip", "encryptConfig", "title", "showTitle", "displayOnly", "compact", "promptTip"]),
111
42
  emits: ["change", "hash-progress", "progress", "success", "error", "remove", "download"],
112
- setup: function setup$1(props2, context) {
113
- return setup({
43
+ setup: function setup(props2, context) {
44
+ return _setup({
114
45
  props: props2,
115
46
  context,
116
47
  renderless,
@@ -134,7 +65,6 @@ var __vue2_script = defineComponent({
134
65
  },
135
66
  render: function render() {
136
67
  var _this = this;
137
- var h = arguments[0];
138
68
  var uploadList;
139
69
  var _this$state$listeners = this.state.listeners, _this$state$listeners2 = _this$state$listeners.exceed, exceed = _this$state$listeners2 === void 0 ? function() {
140
70
  } : _this$state$listeners2, _this$state$listeners3 = _this$state$listeners.preview, preview = _this$state$listeners3 === void 0 ? void 0 : _this$state$listeners3, downloadAll = _this$state$listeners["download-all"], handleDownloadFile = _this$state$listeners["download-file"], reUpload = _this$state$listeners["re-upload"];
@@ -148,9 +78,9 @@ var __vue2_script = defineComponent({
148
78
  var notice = this.slots.notice && this.slots.notice();
149
79
  var title = this.title || t("ui.fileUpload.attachment");
150
80
  var getDefaultTitle = function getDefaultTitle2(title2, showTitle) {
151
- return h("div", {
81
+ return createVNode("div", {
152
82
  "class": "tiny-upload-title"
153
- }, [h("span", {
83
+ }, [createVNode("span", {
154
84
  "class": [showTitle ? "title-show" : "title-hide", displayOnly ? "display-only" : ""]
155
85
  }, [title2])]);
156
86
  };
@@ -158,91 +88,81 @@ var __vue2_script = defineComponent({
158
88
  bubbling: true
159
89
  };
160
90
  var getTriggerContent = function getTriggerContent2(t2, disabled) {
161
- return h("div", {
91
+ return createVNode("div", {
162
92
  "class": "trigger-btn"
163
- }, [h("tiny-button", {
164
- "attrs": {
165
- "disabled": disabled
166
- },
167
- "on": {
168
- "click": handleTriggerClick
93
+ }, [createVNode(resolveComponent("tiny-button"), {
94
+ "disabled": disabled,
95
+ "onClick": handleTriggerClick
96
+ }, {
97
+ default: function _default() {
98
+ return [createVNode(TinyIconPlus, null, null), createVNode("span", null, [t2("ui.fileUpload.uploadFile")])];
169
99
  }
170
- }, [h(TinyIconPlus), h("span", [t2("ui.fileUpload.uploadFile")])])]);
100
+ })]);
171
101
  };
172
102
  var getOperateContent = function getOperateContent2(downloadAll2, uploadFiles2, t2) {
173
- return downloadAll2 && isSaasType ? h("div", {
103
+ return downloadAll2 && isSaasType ? createVNode("div", {
174
104
  "class": "operate-content"
175
- }, [h("tiny-button", {
176
- "on": {
177
- "click": function click() {
178
- return downloadAll2(uploadFiles2);
179
- }
105
+ }, [createVNode(resolveComponent("tiny-button"), {
106
+ "onClick": function onClick() {
107
+ return downloadAll2(uploadFiles2);
180
108
  }
181
- }, [h("div", {
182
- "class": "button-wrap"
183
- }, [h(TinyIconDownload), h("span", [t2("ui.fileUpload.downloadAll")])])])]) : null;
109
+ }, {
110
+ default: function _default() {
111
+ return [createVNode("div", {
112
+ "class": "button-wrap"
113
+ }, [createVNode(TinyIconDownload, null, null), createVNode("span", null, [t2("ui.fileUpload.downloadAll")])])];
114
+ }
115
+ })]) : null;
184
116
  };
185
117
  var getDefaultTip = function getDefaultTip2(tipMsg2) {
186
118
  if (promptTip) {
187
- return slots.tip && slots.tip() || tipMsg2 && promptTip && h("tiny-tooltip", {
188
- "attrs": {
189
- "effect": "light",
190
- "content": slots.tip && slots.tip() || tipMsg2,
191
- "placement": "right",
192
- "popper-options": popperConfig
119
+ return slots.tip && slots.tip() || tipMsg2 && promptTip && createVNode(resolveComponent("tiny-tooltip"), {
120
+ "effect": "light",
121
+ "content": slots.tip && slots.tip() || tipMsg2,
122
+ "placement": "right",
123
+ "popper-options": popperConfig
124
+ }, {
125
+ default: function _default() {
126
+ return [createVNode("div", {
127
+ "class": "prompt-tip"
128
+ }, [createVNode(TinyIconHelpCircle, null, null)])];
193
129
  }
194
- }, [h("div", {
195
- "class": "prompt-tip"
196
- }, [h(TinyIconHelpCircle)])]);
130
+ });
197
131
  } else {
198
- return h("div", {
132
+ return createVNode("div", {
199
133
  "class": "tip-wrap"
200
- }, [h("div", {
201
- "attrs": {
202
- "title": tipMsg2
203
- },
134
+ }, [createVNode("div", {
135
+ "title": tipMsg2,
204
136
  "class": "tip-content"
205
137
  }, [slots.tip && slots.tip() || tipMsg2])]);
206
138
  }
207
139
  };
208
140
  var getThumIcon = function getThumIcon2(file) {
209
- return [showDownload && h("span", {
141
+ return [showDownload && createVNode("span", {
210
142
  "class": "thumb-icon",
211
- "attrs": {
212
- "title": t("ui.fileUpload.downloadFile")
213
- },
214
- "on": {
215
- "click": function click() {
216
- return execDownload(file);
217
- }
143
+ "title": t("ui.fileUpload.downloadFile"),
144
+ "onClick": function onClick() {
145
+ return execDownload(file);
218
146
  }
219
- }, [h(TinyIconDownload, {
147
+ }, [createVNode(TinyIconDownload, {
220
148
  "class": "download-icon"
221
- })]), isEdm && !isFolder && showUpdate && h("span", {
149
+ }, null)]), isEdm && !isFolder && showUpdate && createVNode("span", {
222
150
  "class": "thumb-icon",
223
- "attrs": {
224
- "title": t("ui.fileUpload.updateFile")
225
- },
226
- "on": {
227
- "click": function click() {
228
- return updateFile(file);
229
- }
151
+ "title": t("ui.fileUpload.updateFile"),
152
+ "onClick": function onClick() {
153
+ return updateFile(file);
230
154
  }
231
- }, [h(TinyIconFileCloudupload, {
155
+ }, [createVNode(TinyIconFileCloudupload, {
232
156
  "class": "refres-icon"
233
- })]), showDel && h("span", {
157
+ }, null)]), showDel && createVNode("span", {
234
158
  "class": "thumb-icon",
235
- "attrs": {
236
- "title": t("ui.fileUpload.deleteFile")
237
- },
238
- "on": {
239
- "click": function click() {
240
- return handleRemove(file);
241
- }
159
+ "title": t("ui.fileUpload.deleteFile"),
160
+ "onClick": function onClick() {
161
+ return handleRemove(file);
242
162
  }
243
- }, [h(TinyIconClose, {
163
+ }, [createVNode(TinyIconClose, {
244
164
  "class": "close-icon"
245
- })])];
165
+ }, null)])];
246
166
  };
247
167
  var getThumbList = function getThumbList2(file) {
248
168
  var result = slots.file && slots.file({
@@ -251,15 +171,15 @@ var __vue2_script = defineComponent({
251
171
  if (result) {
252
172
  return result;
253
173
  } else {
254
- return [h(TinyIconSuccessful, {
174
+ return [createVNode(TinyIconSuccessful, {
255
175
  "class": "thumb-success-icon"
256
- }), h("span", {
176
+ }, null), createVNode("span", {
257
177
  "class": ["thumb-item-name", !showDel ? "hide-close-icon" : "", !showDownload ? "hide-download-icon" : ""]
258
178
  }, [file.name]), getThumIcon(file)];
259
179
  }
260
180
  };
261
181
  var getFileSize = function getFileSize2() {
262
- return h("span", [uploadFiles.length]);
182
+ return createVNode("span", null, [uploadFiles.length]);
263
183
  };
264
184
  if (this.showFileList) {
265
185
  if (listType === "thumb") {
@@ -443,20 +363,18 @@ var __vue2_script = defineComponent({
443
363
  }, dialogConfigObj, {
444
364
  scopedSlots: {
445
365
  default: function _default() {
446
- return h("iframe", {
447
- "attrs": {
448
- "id": "_iframe",
449
- "allowfullscreen": true,
450
- "allowtransparency": "true",
451
- "frameborder": "0",
452
- "border": "0",
453
- "marginwidth": "0",
454
- "marginheight": "0",
455
- "scrolling": "no",
456
- "src": iframeUrl
457
- },
458
- "style": "display: block;width: 100%;height: 500px;display: inline-block;"
459
- });
366
+ return createVNode("iframe", {
367
+ "id": "_iframe",
368
+ "style": "display: block;width: 100%;height: 500px;display: inline-block;",
369
+ "allowfullscreen": true,
370
+ "allowtransparency": "true",
371
+ "frameborder": "0",
372
+ "border": "0",
373
+ "marginwidth": "0",
374
+ "marginheight": "0",
375
+ "scrolling": "no",
376
+ "src": iframeUrl
377
+ }, null);
460
378
  }
461
379
  }
462
380
  }));
@@ -480,65 +398,54 @@ var __vue2_script = defineComponent({
480
398
  },
481
399
  scopedSlots: {
482
400
  default: function _default() {
483
- return h("div", {
401
+ return createVNode("div", {
484
402
  "class": "encrypt-config-dialog-body"
485
- }, [h("div", {
403
+ }, [createVNode("div", {
486
404
  "class": "encrypt-item"
487
- }, [_this.t("ui.fileUpload.addWatermark")]), h("div", [h("tiny-input", {
488
- "model": {
489
- value: _this.encryptConfig.watermark,
490
- callback: function callback($$v) {
491
- _this.$set(_this.encryptConfig, "watermark", $$v);
492
- }
405
+ }, [_this.t("ui.fileUpload.addWatermark")]), createVNode("div", null, [createVNode(resolveComponent("tiny-input"), {
406
+ "modelValue": _this.encryptConfig.watermark,
407
+ "onUpdate:modelValue": function onUpdateModelValue($event) {
408
+ return _this.encryptConfig.watermark = $event;
493
409
  }
494
- })]), h("p", [" "]), h("div", {
410
+ }, null)]), createVNode("p", null, [createTextVNode(" ")]), createVNode("div", {
495
411
  "class": "encrypt-item"
496
- }, [_this.t("ui.fileUpload.encrypted")]), h("div", [h("tiny-switch", {
497
- "model": {
498
- value: _this.encryptConfig.encrypt,
499
- callback: function callback($$v) {
500
- _this.$set(_this.encryptConfig, "encrypt", $$v);
501
- }
412
+ }, [_this.t("ui.fileUpload.encrypted")]), createVNode("div", null, [createVNode(resolveComponent("tiny-switch"), {
413
+ "modelValue": _this.encryptConfig.encrypt,
414
+ "onUpdate:modelValue": function onUpdateModelValue($event) {
415
+ return _this.encryptConfig.encrypt = $event;
502
416
  }
503
- })])]);
417
+ }, null)])]);
504
418
  },
505
419
  footer: function footer() {
506
- return [h(Button, {
507
- "on": {
508
- "click": function click() {
509
- return _this.state.encryptDialogConfig.show = false;
510
- }
420
+ var _slot, _slot2;
421
+ return [createVNode(Button, {
422
+ "onClick": function onClick() {
423
+ return _this.state.encryptDialogConfig.show = false;
424
+ }
425
+ }, _isSlot(_slot = _this.t("ui.base.cancel")) ? _slot : {
426
+ default: function _default() {
427
+ return [_slot];
511
428
  }
512
- }, [_this.t("ui.base.cancel")]), [h(Button, {
513
- "attrs": {
514
- "type": "primary"
515
- },
516
- "on": {
517
- "click": function click() {
518
- return encryptDialogConfirm();
519
- }
429
+ }), [createVNode(Button, {
430
+ "type": "primary",
431
+ "onClick": function onClick() {
432
+ return encryptDialogConfirm();
520
433
  }
521
- }, [_this.t("ui.popupload.uploadButtonText")])]];
434
+ }, _isSlot(_slot2 = _this.t("ui.popupload.uploadButtonText")) ? _slot2 : {
435
+ default: function _default() {
436
+ return [_slot2];
437
+ }
438
+ })]];
522
439
  }
523
440
  }
524
441
  });
525
442
  }
526
443
  var attrs = a($attrs, ["^on[A-Z]"]);
527
- return h("div", _mergeJSXProps5([{
444
+ return createVNode("div", mergeProps({
528
445
  "class": "tiny-file-upload"
529
- }, attrs]), [isSaasType ? getDefaultTitle(title, this.showTitle) : "", notice, isPictureCard ? uploadList : "", slots.trigger ? [uploadComponent, defaultSlot] : uploadComponent, !isSaasType && slots.tip && slots.tip(), isPictureCard ? "" : uploadList, previewComponent, encryptDialogComponent]);
446
+ }, attrs), [isSaasType ? getDefaultTitle(title, this.showTitle) : "", notice, isPictureCard ? uploadList : "", slots.trigger ? [uploadComponent, defaultSlot] : uploadComponent, !isSaasType && slots.tip && slots.tip(), isPictureCard ? "" : uploadList, previewComponent, encryptDialogComponent]);
530
447
  }
531
448
  });
532
- var __vue2_render, __vue2_staticRenderFns;
533
- var __cssModules = {};
534
- var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, __vue2_render, __vue2_staticRenderFns, false, __vue2_injectStyles);
535
- function __vue2_injectStyles(context) {
536
- for (var o in __cssModules) {
537
- this[o] = __cssModules[o];
538
- }
539
- }
540
- var pc = /* @__PURE__ */ function() {
541
- return __component__.exports;
542
- }();
543
-
544
- export { pc as default };
449
+ export {
450
+ _sfc_main as default
451
+ };
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@opentinyvue/vue-file-upload",
3
- "version": "2.22.0",
3
+ "version": "3.22.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "main": "./lib/index.js",
8
8
  "module": "./lib/index.js",
9
9
  "dependencies": {
10
- "@opentinyvue/vue-button": "~2.22.0",
11
- "@opentinyvue/vue-common": "~2.22.0",
12
- "@opentinyvue/vue-dialog-box": "~2.22.0",
13
- "@opentinyvue/vue-icon": "~2.22.0",
14
- "@opentinyvue/vue-input": "~2.22.0",
15
- "@opentinyvue/vue-modal": "~2.22.0",
16
- "@opentinyvue/vue-popover": "~2.22.0",
17
- "@opentinyvue/vue-progress": "~2.22.0",
10
+ "@opentinyvue/vue-button": "~3.22.0",
11
+ "@opentinyvue/vue-common": "~3.22.0",
12
+ "@opentinyvue/vue-dialog-box": "~3.22.0",
13
+ "@opentinyvue/vue-icon": "~3.22.0",
14
+ "@opentinyvue/vue-input": "~3.22.0",
15
+ "@opentinyvue/vue-modal": "~3.22.0",
16
+ "@opentinyvue/vue-popover": "~3.22.0",
17
+ "@opentinyvue/vue-progress": "~3.22.0",
18
18
  "@opentinyvue/vue-renderless": "~3.22.0",
19
- "@opentinyvue/vue-tooltip": "~2.22.0",
20
- "@opentinyvue/vue-upload": "~2.22.0",
21
- "@opentinyvue/vue-upload-list": "~2.22.0",
22
- "@opentinyvue/vue-switch": "~2.22.0",
19
+ "@opentinyvue/vue-tooltip": "~3.22.0",
20
+ "@opentinyvue/vue-upload": "~3.22.0",
21
+ "@opentinyvue/vue-upload-list": "~3.22.0",
22
+ "@opentinyvue/vue-switch": "~3.22.0",
23
23
  "@opentinyvue/vue-theme": "~3.22.0",
24
24
  "streamsaver": "2.0.6"
25
25
  },