@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 +22 -0
- package/index.d.ts +13 -0
- package/lib/index.js +388 -0
- package/lib/mobile-first.js +620 -0
- package/lib/mobile.js +177 -0
- package/lib/pc.js +544 -0
- package/package.json +32 -0
- package/src/index.d.ts +389 -0
- package/src/mobile-first.vue.d.ts +2 -0
- package/src/mobile.vue.d.ts +2 -0
- package/src/pc.vue.d.ts +2 -0
package/lib/pc.js
ADDED
|
@@ -0,0 +1,544 @@
|
|
|
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
|
+
function _extends() {
|
|
93
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
94
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
95
|
+
var t = arguments[e];
|
|
96
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
97
|
+
}
|
|
98
|
+
return n;
|
|
99
|
+
}, _extends.apply(null, arguments);
|
|
100
|
+
}
|
|
101
|
+
var TinyIconAttachment = iconAttachment();
|
|
102
|
+
var TinyIconSuccessful = iconSuccessful();
|
|
103
|
+
var TinyIconClose = iconClose();
|
|
104
|
+
var TinyIconDownload = iconDownload();
|
|
105
|
+
var TinyIconFileCloudupload = iconFileCloudupload();
|
|
106
|
+
var TinyIconPlus = iconPlus();
|
|
107
|
+
var TinyIconHelpCircle = iconHelpCircle();
|
|
108
|
+
var __vue2_script = defineComponent({
|
|
109
|
+
inheritAttrs: false,
|
|
110
|
+
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
|
+
emits: ["change", "hash-progress", "progress", "success", "error", "remove", "download"],
|
|
112
|
+
setup: function setup$1(props2, context) {
|
|
113
|
+
return setup({
|
|
114
|
+
props: props2,
|
|
115
|
+
context,
|
|
116
|
+
renderless,
|
|
117
|
+
api,
|
|
118
|
+
extendOptions: {
|
|
119
|
+
Modal,
|
|
120
|
+
Streamsaver
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
components: {
|
|
125
|
+
TinyProgress: Progress,
|
|
126
|
+
UploadList,
|
|
127
|
+
Upload,
|
|
128
|
+
TinyDialogBox: DialogBox,
|
|
129
|
+
Popover,
|
|
130
|
+
TinyButton: Button,
|
|
131
|
+
TinyInput: Input,
|
|
132
|
+
TinySwitch: Switch,
|
|
133
|
+
TinyTooltip: Tooltip
|
|
134
|
+
},
|
|
135
|
+
render: function render() {
|
|
136
|
+
var _this = this;
|
|
137
|
+
var h = arguments[0];
|
|
138
|
+
var uploadList;
|
|
139
|
+
var _this$state$listeners = this.state.listeners, _this$state$listeners2 = _this$state$listeners.exceed, exceed = _this$state$listeners2 === void 0 ? function() {
|
|
140
|
+
} : _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"];
|
|
141
|
+
var _this$state = this.state, uploadFiles = _this$state.uploadFiles, isEdm = _this$state.isEdm, dialogConfigObj = _this$state.dialogConfigObj, isSuccess = _this$state.isSuccess, uploadDisabled = _this$state.uploadDisabled, url = _this$state.url, accept = _this$state.accept, httpRequest = _this$state.httpRequest, edmToken = _this$state.edmToken, iframeUrl = _this$state.iframeUrl;
|
|
142
|
+
var downloadFile = this.downloadFile, handleRemove = this.handleRemove, handleReUpload = this.handleReUpload, handleReUploadTotal = this.handleReUploadTotal, updateFile = this.updateFile, slots = this.slots, _this$edm = this.edm, edm = _this$edm === void 0 ? {} : _this$edm, t = this.t, $attrs = this.$attrs, a = this.a, encryptConfig = this.encryptConfig, encryptDialogConfirm = this.encryptDialogConfirm, handleTriggerClick = this.handleTriggerClick, handleClickFileList = this.handleClickFileList, handleFileClick = this.handleFileClick, displayOnly = this.displayOnly, listType = this.listType, compact = this.compact, promptTip = this.promptTip;
|
|
143
|
+
var isPictureCard = listType === "picture-card";
|
|
144
|
+
var isSaasType = listType === "saas";
|
|
145
|
+
var _this$thumbOption = this.thumbOption, showDel = _this$thumbOption.showDel, showDownload = _this$thumbOption.showDownload, showTooltip = _this$thumbOption.showTooltip, showUpdate = _this$thumbOption.showUpdate, icon = _this$thumbOption.icon;
|
|
146
|
+
var execDownload = this.thumbOption.downloadFile || downloadFile;
|
|
147
|
+
var isFolder = edm.upload ? edm.upload.isFolder : false;
|
|
148
|
+
var notice = this.slots.notice && this.slots.notice();
|
|
149
|
+
var title = this.title || t("ui.fileUpload.attachment");
|
|
150
|
+
var getDefaultTitle = function getDefaultTitle2(title2, showTitle) {
|
|
151
|
+
return h("div", {
|
|
152
|
+
"class": "tiny-upload-title"
|
|
153
|
+
}, [h("span", {
|
|
154
|
+
"class": [showTitle ? "title-show" : "title-hide", displayOnly ? "display-only" : ""]
|
|
155
|
+
}, [title2])]);
|
|
156
|
+
};
|
|
157
|
+
var popperConfig = {
|
|
158
|
+
bubbling: true
|
|
159
|
+
};
|
|
160
|
+
var getTriggerContent = function getTriggerContent2(t2, disabled) {
|
|
161
|
+
return h("div", {
|
|
162
|
+
"class": "trigger-btn"
|
|
163
|
+
}, [h("tiny-button", {
|
|
164
|
+
"attrs": {
|
|
165
|
+
"disabled": disabled
|
|
166
|
+
},
|
|
167
|
+
"on": {
|
|
168
|
+
"click": handleTriggerClick
|
|
169
|
+
}
|
|
170
|
+
}, [h(TinyIconPlus), h("span", [t2("ui.fileUpload.uploadFile")])])]);
|
|
171
|
+
};
|
|
172
|
+
var getOperateContent = function getOperateContent2(downloadAll2, uploadFiles2, t2) {
|
|
173
|
+
return downloadAll2 && isSaasType ? h("div", {
|
|
174
|
+
"class": "operate-content"
|
|
175
|
+
}, [h("tiny-button", {
|
|
176
|
+
"on": {
|
|
177
|
+
"click": function click() {
|
|
178
|
+
return downloadAll2(uploadFiles2);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, [h("div", {
|
|
182
|
+
"class": "button-wrap"
|
|
183
|
+
}, [h(TinyIconDownload), h("span", [t2("ui.fileUpload.downloadAll")])])])]) : null;
|
|
184
|
+
};
|
|
185
|
+
var getDefaultTip = function getDefaultTip2(tipMsg2) {
|
|
186
|
+
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
|
|
193
|
+
}
|
|
194
|
+
}, [h("div", {
|
|
195
|
+
"class": "prompt-tip"
|
|
196
|
+
}, [h(TinyIconHelpCircle)])]);
|
|
197
|
+
} else {
|
|
198
|
+
return h("div", {
|
|
199
|
+
"class": "tip-wrap"
|
|
200
|
+
}, [h("div", {
|
|
201
|
+
"attrs": {
|
|
202
|
+
"title": tipMsg2
|
|
203
|
+
},
|
|
204
|
+
"class": "tip-content"
|
|
205
|
+
}, [slots.tip && slots.tip() || tipMsg2])]);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var getThumIcon = function getThumIcon2(file) {
|
|
209
|
+
return [showDownload && h("span", {
|
|
210
|
+
"class": "thumb-icon",
|
|
211
|
+
"attrs": {
|
|
212
|
+
"title": t("ui.fileUpload.downloadFile")
|
|
213
|
+
},
|
|
214
|
+
"on": {
|
|
215
|
+
"click": function click() {
|
|
216
|
+
return execDownload(file);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}, [h(TinyIconDownload, {
|
|
220
|
+
"class": "download-icon"
|
|
221
|
+
})]), isEdm && !isFolder && showUpdate && h("span", {
|
|
222
|
+
"class": "thumb-icon",
|
|
223
|
+
"attrs": {
|
|
224
|
+
"title": t("ui.fileUpload.updateFile")
|
|
225
|
+
},
|
|
226
|
+
"on": {
|
|
227
|
+
"click": function click() {
|
|
228
|
+
return updateFile(file);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}, [h(TinyIconFileCloudupload, {
|
|
232
|
+
"class": "refres-icon"
|
|
233
|
+
})]), showDel && h("span", {
|
|
234
|
+
"class": "thumb-icon",
|
|
235
|
+
"attrs": {
|
|
236
|
+
"title": t("ui.fileUpload.deleteFile")
|
|
237
|
+
},
|
|
238
|
+
"on": {
|
|
239
|
+
"click": function click() {
|
|
240
|
+
return handleRemove(file);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}, [h(TinyIconClose, {
|
|
244
|
+
"class": "close-icon"
|
|
245
|
+
})])];
|
|
246
|
+
};
|
|
247
|
+
var getThumbList = function getThumbList2(file) {
|
|
248
|
+
var result = slots.file && slots.file({
|
|
249
|
+
file
|
|
250
|
+
});
|
|
251
|
+
if (result) {
|
|
252
|
+
return result;
|
|
253
|
+
} else {
|
|
254
|
+
return [h(TinyIconSuccessful, {
|
|
255
|
+
"class": "thumb-success-icon"
|
|
256
|
+
}), h("span", {
|
|
257
|
+
"class": ["thumb-item-name", !showDel ? "hide-close-icon" : "", !showDownload ? "hide-download-icon" : ""]
|
|
258
|
+
}, [file.name]), getThumIcon(file)];
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var getFileSize = function getFileSize2() {
|
|
262
|
+
return h("span", [uploadFiles.length]);
|
|
263
|
+
};
|
|
264
|
+
if (this.showFileList) {
|
|
265
|
+
if (listType === "thumb") {
|
|
266
|
+
uploadList = uploadFiles.length === 0 ? "" : h("div", {
|
|
267
|
+
class: "tiny-upload--thumb__wrap"
|
|
268
|
+
}, [h("Popover", {
|
|
269
|
+
props: {
|
|
270
|
+
trigger: "hover",
|
|
271
|
+
popperClass: this.thumbOption.popperClass,
|
|
272
|
+
width: this.thumbOption.width
|
|
273
|
+
},
|
|
274
|
+
scopedSlots: {
|
|
275
|
+
reference: function reference() {
|
|
276
|
+
return h("div", {
|
|
277
|
+
class: "tiny-upload--thumb__head"
|
|
278
|
+
}, [h(icon || TinyIconAttachment, {
|
|
279
|
+
class: "thumb-icon"
|
|
280
|
+
}), getFileSize()]);
|
|
281
|
+
},
|
|
282
|
+
default: function _default() {
|
|
283
|
+
return h("div", {
|
|
284
|
+
class: "tiny-upload--thumb__body"
|
|
285
|
+
}, [h("div", {
|
|
286
|
+
class: "tiny-upload--thumb__list"
|
|
287
|
+
}, [uploadFiles.map(function(item) {
|
|
288
|
+
return h("Popover", {
|
|
289
|
+
props: {
|
|
290
|
+
content: item.name,
|
|
291
|
+
trigger: showTooltip ? "hover" : "manual",
|
|
292
|
+
placement: "top"
|
|
293
|
+
},
|
|
294
|
+
scopedSlots: {
|
|
295
|
+
reference: function reference() {
|
|
296
|
+
return h("div", {
|
|
297
|
+
class: "thumb-item",
|
|
298
|
+
on: {
|
|
299
|
+
click: function click() {
|
|
300
|
+
handleFileClick(item);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}, [getThumbList(item)]);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
})])]);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
})]);
|
|
311
|
+
} else {
|
|
312
|
+
var uploadListDate = {
|
|
313
|
+
props: {
|
|
314
|
+
disabled: uploadDisabled,
|
|
315
|
+
reUploadable: this.reUploadable,
|
|
316
|
+
reUploadTip: this.reUploadTip,
|
|
317
|
+
isFolder,
|
|
318
|
+
isEdm,
|
|
319
|
+
edm,
|
|
320
|
+
displayOnly,
|
|
321
|
+
listType,
|
|
322
|
+
files: uploadFiles,
|
|
323
|
+
isFolderTitle: this.isFolderTitle,
|
|
324
|
+
listOption: this.listOption,
|
|
325
|
+
maxNameLength: this.maxNameLength,
|
|
326
|
+
handlePreview: preview,
|
|
327
|
+
handleDownloadFile,
|
|
328
|
+
handleReUpload: reUpload,
|
|
329
|
+
openDownloadFile: this.openDownloadFile,
|
|
330
|
+
compact
|
|
331
|
+
},
|
|
332
|
+
scopedSlots: {
|
|
333
|
+
default: function _default(props2) {
|
|
334
|
+
if (slots.file) {
|
|
335
|
+
return slots.file({
|
|
336
|
+
file: props2.file
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
tip: function tip() {
|
|
341
|
+
return _tip;
|
|
342
|
+
},
|
|
343
|
+
"assist-content": function assistContent(props2) {
|
|
344
|
+
if (slots["assist-content"]) {
|
|
345
|
+
return slots["assist-content"]({
|
|
346
|
+
file: props2.file
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
operate: function operate(props2) {
|
|
351
|
+
if (slots.operate) {
|
|
352
|
+
return slots.operate({
|
|
353
|
+
file: props2.file
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
on: {
|
|
359
|
+
remove: handleRemove,
|
|
360
|
+
reUpload: handleReUpload,
|
|
361
|
+
reUploadTotal: handleReUploadTotal,
|
|
362
|
+
update: updateFile,
|
|
363
|
+
start: this.handleStart,
|
|
364
|
+
"click-file-list": handleClickFileList,
|
|
365
|
+
"update:visible": function updateVisible(visible) {
|
|
366
|
+
return _this.state.visible = visible;
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
ref: "upload-list-inner"
|
|
370
|
+
};
|
|
371
|
+
uploadList = h(UploadList, uploadListDate);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
var uploadData = {
|
|
375
|
+
props: {
|
|
376
|
+
type: this.type,
|
|
377
|
+
drag: this.drag,
|
|
378
|
+
action: url,
|
|
379
|
+
multiple: this.multiple,
|
|
380
|
+
withCredentials: this.withCredentials,
|
|
381
|
+
headers: this.headers,
|
|
382
|
+
name: this.name,
|
|
383
|
+
data: this.data,
|
|
384
|
+
edm: this.edm,
|
|
385
|
+
accept: isEdm ? accept : this.accept,
|
|
386
|
+
fileList: uploadFiles,
|
|
387
|
+
autoUpload: this.autoUpload,
|
|
388
|
+
listType,
|
|
389
|
+
disabled: uploadDisabled,
|
|
390
|
+
displayOnly,
|
|
391
|
+
limit: this.limit,
|
|
392
|
+
onExceed: exceed,
|
|
393
|
+
onStart: this.handleStart,
|
|
394
|
+
onProgress: this.handleProgress,
|
|
395
|
+
onSuccess: this.handleSuccess,
|
|
396
|
+
onError: this.handleError,
|
|
397
|
+
onPreview: preview,
|
|
398
|
+
httpRequest,
|
|
399
|
+
isFolder,
|
|
400
|
+
edmToken,
|
|
401
|
+
pasteUpload: this.pasteUpload,
|
|
402
|
+
isHidden: this.isHidden
|
|
403
|
+
},
|
|
404
|
+
ref: "upload-inner"
|
|
405
|
+
};
|
|
406
|
+
var tipMsg = this.getTipMessage({
|
|
407
|
+
accept: isEdm ? accept : this.accept,
|
|
408
|
+
fileSize: this.fileSize,
|
|
409
|
+
limit: this.limit
|
|
410
|
+
});
|
|
411
|
+
var _tip = !displayOnly && isSaasType ? getDefaultTip(tipMsg) : null;
|
|
412
|
+
_tip && _tip.data && (_tip.data.slot = "tip");
|
|
413
|
+
var _operate = !displayOnly ? getOperateContent(downloadAll, uploadFiles, t) : null;
|
|
414
|
+
_operate && _operate.data && (_operate.data.slot = "operate");
|
|
415
|
+
var defaultSlot = slots.default && slots.default();
|
|
416
|
+
var trigger = slots.trigger ? slots.trigger() : defaultSlot;
|
|
417
|
+
var getChildren = function getChildren2() {
|
|
418
|
+
var triggerDom = !trigger && isSaasType && !displayOnly ? getTriggerContent(t, _this.disabled) : trigger;
|
|
419
|
+
var childNodes = isVue3 ? {
|
|
420
|
+
default: function _default() {
|
|
421
|
+
return triggerDom;
|
|
422
|
+
},
|
|
423
|
+
tip: function tip() {
|
|
424
|
+
return _tip;
|
|
425
|
+
},
|
|
426
|
+
operate: function operate() {
|
|
427
|
+
return _operate;
|
|
428
|
+
}
|
|
429
|
+
} : [triggerDom, _tip, _operate];
|
|
430
|
+
return childNodes;
|
|
431
|
+
};
|
|
432
|
+
var uploadComponent = h(Upload, uploadData, getChildren());
|
|
433
|
+
var previewComponent = null;
|
|
434
|
+
var encryptDialogComponent = null;
|
|
435
|
+
if (isEdm && isSuccess) {
|
|
436
|
+
uploadData.props.accept = accept;
|
|
437
|
+
uploadData.props.edmToken = edmToken;
|
|
438
|
+
}
|
|
439
|
+
if (this.edm.preview) {
|
|
440
|
+
previewComponent = h("tiny-dialog-box", _extends({
|
|
441
|
+
minHeight: "600px",
|
|
442
|
+
width: "60%"
|
|
443
|
+
}, dialogConfigObj, {
|
|
444
|
+
scopedSlots: {
|
|
445
|
+
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
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}));
|
|
463
|
+
}
|
|
464
|
+
if (encryptConfig.enabled) {
|
|
465
|
+
encryptDialogComponent = h("tiny-dialog-box", {
|
|
466
|
+
class: "encrypt-config-dialog",
|
|
467
|
+
style: "",
|
|
468
|
+
props: {
|
|
469
|
+
lockScroll: true,
|
|
470
|
+
visible: this.state.encryptDialogConfig.show,
|
|
471
|
+
dragable: true,
|
|
472
|
+
title: this.t("ui.fileUpload.encryptDialogTitle"),
|
|
473
|
+
width: "380px",
|
|
474
|
+
height: "auto"
|
|
475
|
+
},
|
|
476
|
+
on: {
|
|
477
|
+
"update:visible": function updateVisible(value) {
|
|
478
|
+
return _this.state.encryptDialogConfig.show = value;
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
scopedSlots: {
|
|
482
|
+
default: function _default() {
|
|
483
|
+
return h("div", {
|
|
484
|
+
"class": "encrypt-config-dialog-body"
|
|
485
|
+
}, [h("div", {
|
|
486
|
+
"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
|
+
}
|
|
493
|
+
}
|
|
494
|
+
})]), h("p", [" "]), h("div", {
|
|
495
|
+
"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
|
+
}
|
|
502
|
+
}
|
|
503
|
+
})])]);
|
|
504
|
+
},
|
|
505
|
+
footer: function footer() {
|
|
506
|
+
return [h(Button, {
|
|
507
|
+
"on": {
|
|
508
|
+
"click": function click() {
|
|
509
|
+
return _this.state.encryptDialogConfig.show = false;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}, [_this.t("ui.base.cancel")]), [h(Button, {
|
|
513
|
+
"attrs": {
|
|
514
|
+
"type": "primary"
|
|
515
|
+
},
|
|
516
|
+
"on": {
|
|
517
|
+
"click": function click() {
|
|
518
|
+
return encryptDialogConfirm();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}, [_this.t("ui.popupload.uploadButtonText")])]];
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
var attrs = a($attrs, ["^on[A-Z]"]);
|
|
527
|
+
return h("div", _mergeJSXProps5([{
|
|
528
|
+
"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]);
|
|
530
|
+
}
|
|
531
|
+
});
|
|
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 };
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-file-upload",
|
|
3
|
+
"version": "2.21.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./lib/index.js",
|
|
8
|
+
"module": "./lib/index.js",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@opentinyvue/vue-button": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-dialog-box": "~2.21.0",
|
|
13
|
+
"@opentinyvue/vue-icon": "~2.21.0",
|
|
14
|
+
"@opentinyvue/vue-input": "~2.21.0",
|
|
15
|
+
"@opentinyvue/vue-modal": "~2.21.0",
|
|
16
|
+
"@opentinyvue/vue-popover": "~2.21.0",
|
|
17
|
+
"@opentinyvue/vue-progress": "~2.21.0",
|
|
18
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
19
|
+
"@opentinyvue/vue-tooltip": "~2.21.0",
|
|
20
|
+
"@opentinyvue/vue-upload": "~2.21.0",
|
|
21
|
+
"@opentinyvue/vue-upload-list": "~2.21.0",
|
|
22
|
+
"@opentinyvue/vue-switch": "~2.21.0",
|
|
23
|
+
"@opentinyvue/vue-theme": "~3.21.0",
|
|
24
|
+
"@opentinyvue/vue-theme-mobile": "~3.21.0",
|
|
25
|
+
"streamsaver": "2.0.6"
|
|
26
|
+
},
|
|
27
|
+
"types": "index.d.ts",
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "pnpm -w build:ui $npm_package_name",
|
|
30
|
+
"//postversion": "pnpm build"
|
|
31
|
+
}
|
|
32
|
+
}
|