@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
|
@@ -0,0 +1,620 @@
|
|
|
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 Modal from '@opentinyvue/vue-modal';
|
|
7
|
+
import DialogBox from '@opentinyvue/vue-dialog-box';
|
|
8
|
+
import Tooltip from '@opentinyvue/vue-tooltip';
|
|
9
|
+
import { IconAttachment, IconSuccessful, IconClose, IconDownload, IconFileCloudupload, IconPlus, IconPlusCircle, IconPicture, IconMic, IconStartCircle, IconHelpQuery } from '@opentinyvue/vue-icon';
|
|
10
|
+
import Streamsaver from 'streamsaver';
|
|
11
|
+
import Button from '@opentinyvue/vue-button';
|
|
12
|
+
import Input from '@opentinyvue/vue-input';
|
|
13
|
+
import Switch from '@opentinyvue/vue-switch';
|
|
14
|
+
|
|
15
|
+
function getDefaultExportFromCjs(x) {
|
|
16
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var helper;
|
|
20
|
+
var hasRequiredHelper;
|
|
21
|
+
function requireHelper() {
|
|
22
|
+
if (hasRequiredHelper) return helper;
|
|
23
|
+
hasRequiredHelper = 1;
|
|
24
|
+
function _extends() {
|
|
25
|
+
return _extends = Object.assign ? Object.assign.bind() : function(a) {
|
|
26
|
+
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]);
|
|
27
|
+
return a;
|
|
28
|
+
}, _extends.apply(this, arguments);
|
|
29
|
+
}
|
|
30
|
+
var normalMerge = ["attrs", "props", "domProps"], toArrayMerge = ["class", "style", "directives"], functionalMerge = ["on", "nativeOn"], mergeJsxProps = function mergeJsxProps2(a) {
|
|
31
|
+
return a.reduce(function(c, a2) {
|
|
32
|
+
for (var b in a2) if (!c[b]) c[b] = a2[b];
|
|
33
|
+
else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends({}, c[b], a2[b]);
|
|
34
|
+
else if (-1 !== toArrayMerge.indexOf(b)) {
|
|
35
|
+
var d = c[b] instanceof Array ? c[b] : [c[b]], e = a2[b] instanceof Array ? a2[b] : [a2[b]];
|
|
36
|
+
c[b] = [].concat(d, e);
|
|
37
|
+
} else if (-1 !== functionalMerge.indexOf(b)) {
|
|
38
|
+
for (var f in a2[b]) if (c[b][f]) {
|
|
39
|
+
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]];
|
|
40
|
+
c[b][f] = [].concat(g, h);
|
|
41
|
+
} else c[b][f] = a2[b][f];
|
|
42
|
+
} 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];
|
|
43
|
+
else c[b] = a2[b];
|
|
44
|
+
return c;
|
|
45
|
+
}, {});
|
|
46
|
+
}, mergeFn = function mergeFn2(a, b) {
|
|
47
|
+
return function() {
|
|
48
|
+
a && a.apply(this, arguments), b && b.apply(this, arguments);
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
helper = mergeJsxProps;
|
|
52
|
+
return helper;
|
|
53
|
+
}
|
|
54
|
+
var helperExports = requireHelper();
|
|
55
|
+
var _mergeJSXProps5 = /* @__PURE__ */ getDefaultExportFromCjs(helperExports);
|
|
56
|
+
|
|
57
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
58
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
59
|
+
if (render) {
|
|
60
|
+
options.render = render;
|
|
61
|
+
options.staticRenderFns = staticRenderFns;
|
|
62
|
+
options._compiled = true;
|
|
63
|
+
}
|
|
64
|
+
var hook;
|
|
65
|
+
if (injectStyles) {
|
|
66
|
+
hook = injectStyles;
|
|
67
|
+
}
|
|
68
|
+
if (hook) {
|
|
69
|
+
if (options.functional) {
|
|
70
|
+
options._injectStyles = hook;
|
|
71
|
+
var originalRender = options.render;
|
|
72
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
73
|
+
hook.call(context);
|
|
74
|
+
return originalRender(h, context);
|
|
75
|
+
};
|
|
76
|
+
} else {
|
|
77
|
+
var existing = options.beforeCreate;
|
|
78
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
exports: scriptExports,
|
|
83
|
+
options
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function _extends() {
|
|
88
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
89
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
90
|
+
var t = arguments[e];
|
|
91
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
92
|
+
}
|
|
93
|
+
return n;
|
|
94
|
+
}, _extends.apply(null, arguments);
|
|
95
|
+
}
|
|
96
|
+
var __vue2_script = defineComponent({
|
|
97
|
+
inheritAttrs: false,
|
|
98
|
+
emits: ["change", "hash-progress", "error", "progress", "success", "remove", "download", "trigger-click", "click-file-list"],
|
|
99
|
+
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", "scale", "showName", "sourceType", "showTitle", "title", "displayOnly", "customClass", "hwh5", "mode", "cacheToken", "lockScroll", "compact", "encryptConfig", "imageBgColor", "promptTip"]),
|
|
100
|
+
setup: function setup$1(props2, context) {
|
|
101
|
+
return setup({
|
|
102
|
+
props: props2,
|
|
103
|
+
context,
|
|
104
|
+
renderless,
|
|
105
|
+
api,
|
|
106
|
+
extendOptions: {
|
|
107
|
+
Modal,
|
|
108
|
+
Streamsaver
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
components: {
|
|
113
|
+
TinyProgress: Progress,
|
|
114
|
+
UploadList,
|
|
115
|
+
Upload,
|
|
116
|
+
TinyDialogBox: DialogBox,
|
|
117
|
+
TinyTooltip: Tooltip,
|
|
118
|
+
IconAttachment: IconAttachment(),
|
|
119
|
+
IconSuccessful: IconSuccessful(),
|
|
120
|
+
IconCloseCircle: IconClose(),
|
|
121
|
+
IconDownload: IconDownload(),
|
|
122
|
+
IconFileCloudupload: IconFileCloudupload(),
|
|
123
|
+
TinyButton: Button,
|
|
124
|
+
IconPlus: IconPlus(),
|
|
125
|
+
IconPlusCircle: IconPlusCircle(),
|
|
126
|
+
IconPicture: IconPicture(),
|
|
127
|
+
IconMic: IconMic(),
|
|
128
|
+
IconStartCircle: IconStartCircle(),
|
|
129
|
+
IconHelpQuery: IconHelpQuery(),
|
|
130
|
+
TinyModal: Modal
|
|
131
|
+
},
|
|
132
|
+
render: function render() {
|
|
133
|
+
var _this = this;
|
|
134
|
+
var h = arguments[0];
|
|
135
|
+
var _this$state$listeners = this.state.listeners, _this$state$listeners2 = _this$state$listeners.exceed, exceed = _this$state$listeners2 === void 0 ? function() {
|
|
136
|
+
} : _this$state$listeners2, _this$state$listeners3 = _this$state$listeners.preview, preview = _this$state$listeners3 === void 0 ? void 0 : _this$state$listeners3, downloadFile = _this$state$listeners["download-file"], downloadAll = _this$state$listeners["download-all"], reUpload = _this$state$listeners["re-upload"], triggerClick = _this$state$listeners["trigger-click"], play = _this$state$listeners.play;
|
|
137
|
+
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, isDragover = _this$state.isDragover, selected = _this$state.selected, types = _this$state.types, isHwh5 = _this$state.isHwh5;
|
|
138
|
+
var handleRemove = this.handleRemove, updateFile = this.updateFile, slots = this.slots, _this$edm = this.edm, edm = _this$edm === void 0 ? {} : _this$edm, $attrs = this.$attrs, a = this.a, t = this.t, showTitle = this.showTitle, isFolderTitle = this.isFolderTitle, listOption = this.listOption, maxNameLength = this.maxNameLength, scale = this.scale, showName = this.showName, openDownloadFile = this.openDownloadFile, type = this.type, drag = this.drag, multiple = this.multiple, withCredentials = this.withCredentials, headers = this.headers, name = this.name, data = this.data, autoUpload = this.autoUpload, limit = this.limit, handleStart = this.handleStart, handleProgress = this.handleProgress, handleSuccess = this.handleSuccess, handleError = this.handleError, fileSize = this.fileSize, displayOnly = this.displayOnly, customClass = this.customClass, handleClickFileList = this.handleClickFileList, handleTriggerClick = this.handleTriggerClick, showFileList = this.showFileList, mode = this.mode, lockScroll = this.lockScroll, compact = this.compact, encryptConfig = this.encryptConfig, encryptDialogConfirm = this.encryptDialogConfirm, imageBgColor = this.imageBgColor, promptTip = this.promptTip;
|
|
139
|
+
var listType = this.listType === "saas" ? "text" : this.listType;
|
|
140
|
+
var title = this.title || t("ui.fileUpload.attachment");
|
|
141
|
+
var isDragSingle = listType === "drag-single";
|
|
142
|
+
var isText = listType === "text";
|
|
143
|
+
var isFolder = edm.upload ? edm.upload.isFolder : false;
|
|
144
|
+
var getDefaultTitle = function getDefaultTitle2(_ref) {
|
|
145
|
+
var listType2 = _ref.listType, title2 = _ref.title, showTitle2 = _ref.showTitle, _ref$isInside = _ref.isInside, isInside = _ref$isInside === void 0 ? false : _ref$isInside, _ref$displayOnly = _ref.displayOnly, displayOnly2 = _ref$displayOnly === void 0 ? false : _ref$displayOnly, mode2 = _ref.mode;
|
|
146
|
+
var defaultTitle;
|
|
147
|
+
if (isInside) {
|
|
148
|
+
defaultTitle = h("span", {
|
|
149
|
+
"class": showTitle2 ? "inline-block mr-1 text-sm text-color-text-primary font-bold" : "hidden"
|
|
150
|
+
}, [title2]);
|
|
151
|
+
} else {
|
|
152
|
+
var cls = "text-sm text-color-text-primary font-bold leading-5.5 ";
|
|
153
|
+
if (listType2 !== "text") {
|
|
154
|
+
cls += "hidden";
|
|
155
|
+
} else if (!displayOnly2 && showTitle2) {
|
|
156
|
+
cls += "hidden sm:block";
|
|
157
|
+
} else {
|
|
158
|
+
!displayOnly2 || !showTitle2 ? cls += "hidden" : cls += "mt-4 mb-2";
|
|
159
|
+
}
|
|
160
|
+
defaultTitle = mode2 !== "bubble" ? h("div", {
|
|
161
|
+
"class": cls
|
|
162
|
+
}, [h("span", {
|
|
163
|
+
"class": "mr-1"
|
|
164
|
+
}, [title2]), displayOnly2 && getDisplayOnlyTip({
|
|
165
|
+
isEdm,
|
|
166
|
+
fileSize
|
|
167
|
+
})]) : null;
|
|
168
|
+
}
|
|
169
|
+
return defaultTitle;
|
|
170
|
+
};
|
|
171
|
+
var getDefaultTip = function getDefaultTip2(_ref2) {
|
|
172
|
+
var listType2 = _ref2.listType, title2 = _ref2.title, showTitle2 = _ref2.showTitle, isEdm2 = _ref2.isEdm, accept2 = _ref2.accept, fileSize2 = _ref2.fileSize, slots2 = _ref2.slots;
|
|
173
|
+
var defaultTip;
|
|
174
|
+
var tipMsg = _this.getTipMessage({
|
|
175
|
+
accept: isEdm2 ? accept2 : _this.accept,
|
|
176
|
+
fileSize: fileSize2,
|
|
177
|
+
limit: _this.limit
|
|
178
|
+
});
|
|
179
|
+
var popperConfig = {
|
|
180
|
+
bubbling: true
|
|
181
|
+
};
|
|
182
|
+
if (listType2 === "text") {
|
|
183
|
+
defaultTip = h("div", {
|
|
184
|
+
"class": "inline-block w-full sm:pl-4 text-color-none"
|
|
185
|
+
}, [h("div", {
|
|
186
|
+
"class": "block sm:hidden"
|
|
187
|
+
}, [getDefaultTitle({
|
|
188
|
+
listType: listType2,
|
|
189
|
+
title: title2,
|
|
190
|
+
showTitle: showTitle2,
|
|
191
|
+
isInside: true
|
|
192
|
+
}), h("tiny-tooltip", {
|
|
193
|
+
"attrs": {
|
|
194
|
+
"effect": "dark",
|
|
195
|
+
"content": tipMsg,
|
|
196
|
+
"placement": "top",
|
|
197
|
+
"popper-options": popperConfig
|
|
198
|
+
}
|
|
199
|
+
}, [h("icon-help-query", {
|
|
200
|
+
"class": "-mt-0.5 fill-color-none-hover"
|
|
201
|
+
})])])]);
|
|
202
|
+
} else if (listType2 === "drag-single") {
|
|
203
|
+
defaultTip = h("div", {
|
|
204
|
+
"attrs": {
|
|
205
|
+
"title": tipMsg
|
|
206
|
+
},
|
|
207
|
+
"class": "leading-5 text-color-text-primary overflow-hidden text-ellipsis whitespace-nowrap"
|
|
208
|
+
}, [slots2.tip && slots2.tip() || tipMsg]);
|
|
209
|
+
} else {
|
|
210
|
+
defaultTip = slots2.tip ? h("div", {
|
|
211
|
+
"class": "mb-4 text-color-none"
|
|
212
|
+
}, [slots2.tip()]) : null;
|
|
213
|
+
}
|
|
214
|
+
return defaultTip;
|
|
215
|
+
};
|
|
216
|
+
var getDisplayOnlyTip = function getDisplayOnlyTip2(_ref3) {
|
|
217
|
+
var isEdm2 = _ref3.isEdm, fileSize2 = _ref3.fileSize;
|
|
218
|
+
var popperConfig = {
|
|
219
|
+
bubbling: true
|
|
220
|
+
};
|
|
221
|
+
return h("tiny-tooltip", {
|
|
222
|
+
"class": "inline-block sm:hidden",
|
|
223
|
+
"attrs": {
|
|
224
|
+
"effect": "dark",
|
|
225
|
+
"content": _this.getTipMessage({
|
|
226
|
+
accept: isEdm2 ? accept : _this.accept,
|
|
227
|
+
fileSize: fileSize2,
|
|
228
|
+
limit: _this.limit
|
|
229
|
+
}),
|
|
230
|
+
"placement": "top",
|
|
231
|
+
"popper-options": popperConfig
|
|
232
|
+
}
|
|
233
|
+
}, [h("icon-help-query", {
|
|
234
|
+
"class": "-mt-0.5 fill-color-none-hover"
|
|
235
|
+
})]);
|
|
236
|
+
};
|
|
237
|
+
var getTriggerContent = function getTriggerContent2(_ref4) {
|
|
238
|
+
var listType2 = _ref4.listType, t2 = _ref4.t, type2 = _ref4.type, disabled = _ref4.disabled;
|
|
239
|
+
var defaultList = {
|
|
240
|
+
"picture": h("div", [h("icon-picture", {
|
|
241
|
+
"class": "w-6 h-6 fill-color-icon-secondary"
|
|
242
|
+
}), h("div", {
|
|
243
|
+
"class": "mt-1 sm:mt-2 text-color-text-secondary text-xs"
|
|
244
|
+
}, [t2("ui.upload.addPicture")])]),
|
|
245
|
+
"audio": h("div", [h("icon-mic", {
|
|
246
|
+
"class": "w-6 h-6 fill-color-icon-secondary"
|
|
247
|
+
}), h("div", {
|
|
248
|
+
"class": "mt-1 sm:mt-2 text-color-text-secondary text-xs"
|
|
249
|
+
}, [t2("ui.upload.addAudio")])]),
|
|
250
|
+
"video": h("div", [h("icon-start-circle", {
|
|
251
|
+
"class": "w-6 h-6 fill-color-icon-secondary"
|
|
252
|
+
}), h("div", {
|
|
253
|
+
"class": "mt-1 sm:mt-2 text-color-text-secondary text-xs"
|
|
254
|
+
}, [t2("ui.upload.addVideo")])])
|
|
255
|
+
};
|
|
256
|
+
var defaultContent;
|
|
257
|
+
if (listType2 === "text") {
|
|
258
|
+
defaultContent = h("div", {
|
|
259
|
+
"class": "inline-block"
|
|
260
|
+
}, [h("tiny-button", {
|
|
261
|
+
"attrs": {
|
|
262
|
+
"disabled": disabled
|
|
263
|
+
},
|
|
264
|
+
"class": "hidden sm:block"
|
|
265
|
+
}, [h("div", {
|
|
266
|
+
"class": "flex items-center"
|
|
267
|
+
}, [h("icon-plus"), h("span", {
|
|
268
|
+
"class": "ml-2"
|
|
269
|
+
}, [t2("ui.fileUpload.uploadFile")])])]), h("icon-plus-circle", {
|
|
270
|
+
"attrs": {
|
|
271
|
+
"custom-class": "sm:hidden w-5 h-5"
|
|
272
|
+
}
|
|
273
|
+
})]);
|
|
274
|
+
} else if (listType2 === "drag-single") {
|
|
275
|
+
defaultContent = null;
|
|
276
|
+
} else {
|
|
277
|
+
var defaultClass = "relative h-full border border-dashed border-color-border rounded bg-color-bg-2 align-top hover:cursor-pointer";
|
|
278
|
+
listType2 === "picture-single" && uploadFiles.length && (defaultClass += " hidden");
|
|
279
|
+
defaultContent = h("div", {
|
|
280
|
+
"class": defaultClass
|
|
281
|
+
}, [h("div", {
|
|
282
|
+
"class": "absolute w-full top-1/2 left-0 -translate-y-1/2 z-[1] text-center"
|
|
283
|
+
}, [defaultList[type2 || "picture"]])]);
|
|
284
|
+
}
|
|
285
|
+
return defaultContent;
|
|
286
|
+
};
|
|
287
|
+
var getOperateContent = function getOperateContent2(_ref5) {
|
|
288
|
+
var listType2 = _ref5.listType, downloadAll2 = _ref5.downloadAll, uploadFiles2 = _ref5.uploadFiles, t2 = _ref5.t;
|
|
289
|
+
var operateContent;
|
|
290
|
+
if (listType2 === "text") {
|
|
291
|
+
operateContent = downloadAll2 ? h("div", {
|
|
292
|
+
"class": "hidden sm:inline-block align-middle"
|
|
293
|
+
}, [h("tiny-button", {
|
|
294
|
+
"class": "ml-2",
|
|
295
|
+
"on": {
|
|
296
|
+
"click": function click() {
|
|
297
|
+
return downloadAll2(uploadFiles2);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}, [h("div", {
|
|
301
|
+
"class": "flex items-center"
|
|
302
|
+
}, [h("icon-download"), h("span", {
|
|
303
|
+
"class": "ml-2"
|
|
304
|
+
}, [t2("ui.fileUpload.downloadAll")])])])]) : null;
|
|
305
|
+
}
|
|
306
|
+
return operateContent;
|
|
307
|
+
};
|
|
308
|
+
var getTrigger = function getTrigger2(_ref6) {
|
|
309
|
+
var displayOnly2 = _ref6.displayOnly, slots2 = _ref6.slots, listType2 = _ref6.listType, t2 = _ref6.t, type2 = _ref6.type, disabled = _ref6.disabled;
|
|
310
|
+
return !displayOnly2 || displayOnly2 && ["picture-card", "picture-single"].includes(type2) ? slots2.trigger ? slots2.trigger() : getTriggerContent({
|
|
311
|
+
listType: listType2,
|
|
312
|
+
t: t2,
|
|
313
|
+
type: type2,
|
|
314
|
+
disabled
|
|
315
|
+
}) : null;
|
|
316
|
+
};
|
|
317
|
+
var _tip = !displayOnly ? getDefaultTip({
|
|
318
|
+
listType,
|
|
319
|
+
title,
|
|
320
|
+
showTitle,
|
|
321
|
+
isEdm,
|
|
322
|
+
accept,
|
|
323
|
+
fileSize,
|
|
324
|
+
slots
|
|
325
|
+
}) : null;
|
|
326
|
+
_tip && _tip.data && (_tip.data.slot = "tip");
|
|
327
|
+
var _operate = !displayOnly ? getOperateContent({
|
|
328
|
+
listType,
|
|
329
|
+
downloadAll,
|
|
330
|
+
uploadFiles,
|
|
331
|
+
t
|
|
332
|
+
}) : null;
|
|
333
|
+
_operate && _operate.data && (_operate.data.slot = "operate");
|
|
334
|
+
var getChildren = function getChildren2(type2) {
|
|
335
|
+
var trigger = getTrigger({
|
|
336
|
+
displayOnly,
|
|
337
|
+
slots,
|
|
338
|
+
listType,
|
|
339
|
+
t,
|
|
340
|
+
type: type2,
|
|
341
|
+
disabled: uploadDisabled
|
|
342
|
+
});
|
|
343
|
+
var childNodes = isVue3 ? {
|
|
344
|
+
default: function _default() {
|
|
345
|
+
return trigger;
|
|
346
|
+
},
|
|
347
|
+
tip: function tip() {
|
|
348
|
+
return !isDragSingle && _tip;
|
|
349
|
+
},
|
|
350
|
+
operate: function operate() {
|
|
351
|
+
return _operate;
|
|
352
|
+
}
|
|
353
|
+
} : [trigger, !isDragSingle && _tip, _operate];
|
|
354
|
+
return childNodes;
|
|
355
|
+
};
|
|
356
|
+
var tipMessage = slots.tip && slots.tip() || this.getTipMessage({
|
|
357
|
+
accept: isEdm ? accept : this.accept,
|
|
358
|
+
fileSize,
|
|
359
|
+
limit: this.limit
|
|
360
|
+
});
|
|
361
|
+
var uploadData = {
|
|
362
|
+
props: {
|
|
363
|
+
type,
|
|
364
|
+
drag,
|
|
365
|
+
action: url,
|
|
366
|
+
multiple,
|
|
367
|
+
withCredentials,
|
|
368
|
+
headers,
|
|
369
|
+
name,
|
|
370
|
+
data,
|
|
371
|
+
edm,
|
|
372
|
+
accept: isEdm ? accept : this.accept,
|
|
373
|
+
fileList: uploadFiles,
|
|
374
|
+
autoUpload,
|
|
375
|
+
listType,
|
|
376
|
+
disabled: uploadDisabled,
|
|
377
|
+
limit,
|
|
378
|
+
onExceed: exceed,
|
|
379
|
+
onStart: handleStart,
|
|
380
|
+
onProgress: handleProgress,
|
|
381
|
+
onSuccess: handleSuccess,
|
|
382
|
+
onError: handleError,
|
|
383
|
+
onPreview: preview,
|
|
384
|
+
httpRequest,
|
|
385
|
+
isFolder,
|
|
386
|
+
edmToken,
|
|
387
|
+
scale,
|
|
388
|
+
displayOnly,
|
|
389
|
+
customClass,
|
|
390
|
+
handleTriggerClick,
|
|
391
|
+
mode,
|
|
392
|
+
showTitle,
|
|
393
|
+
isHwh5,
|
|
394
|
+
tipMessage,
|
|
395
|
+
promptTip,
|
|
396
|
+
showFileList
|
|
397
|
+
},
|
|
398
|
+
ref: "upload-inner"
|
|
399
|
+
};
|
|
400
|
+
var createUploadComponent = function createUploadComponent2(type2) {
|
|
401
|
+
uploadData.props.sourceType = type2;
|
|
402
|
+
return h(Upload, uploadData, getChildren(type2));
|
|
403
|
+
};
|
|
404
|
+
var uploadListDate = {
|
|
405
|
+
props: {
|
|
406
|
+
disabled: uploadDisabled,
|
|
407
|
+
isFolder,
|
|
408
|
+
isEdm,
|
|
409
|
+
edm,
|
|
410
|
+
displayOnly,
|
|
411
|
+
listType,
|
|
412
|
+
files: uploadFiles,
|
|
413
|
+
isFolderTitle,
|
|
414
|
+
listOption,
|
|
415
|
+
maxNameLength,
|
|
416
|
+
scale,
|
|
417
|
+
showName,
|
|
418
|
+
types,
|
|
419
|
+
isDragover,
|
|
420
|
+
handlePreview: preview,
|
|
421
|
+
handleDownloadFile: downloadFile,
|
|
422
|
+
handleReUpload: reUpload,
|
|
423
|
+
openDownloadFile,
|
|
424
|
+
selected,
|
|
425
|
+
triggerClick,
|
|
426
|
+
isHwh5,
|
|
427
|
+
triggerPlay: play,
|
|
428
|
+
mode,
|
|
429
|
+
lockScroll,
|
|
430
|
+
compact,
|
|
431
|
+
imageBgColor
|
|
432
|
+
},
|
|
433
|
+
scopedSlots: {
|
|
434
|
+
default: function _default(props2) {
|
|
435
|
+
if (slots.file) {
|
|
436
|
+
return slots.file({
|
|
437
|
+
file: props2.file
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
upload: function upload(_ref7) {
|
|
442
|
+
var type2 = _ref7.type;
|
|
443
|
+
return !isText ? createUploadComponent(type2) : null;
|
|
444
|
+
},
|
|
445
|
+
tip: function tip() {
|
|
446
|
+
return _tip;
|
|
447
|
+
},
|
|
448
|
+
"assist-content": function assistContent(props2) {
|
|
449
|
+
if (slots["assist-content"]) {
|
|
450
|
+
return slots["assist-content"]({
|
|
451
|
+
file: props2.file
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
operate: function operate(props2) {
|
|
456
|
+
if (slots.operate) {
|
|
457
|
+
return slots.operate({
|
|
458
|
+
file: props2.file
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
on: {
|
|
464
|
+
remove: handleRemove,
|
|
465
|
+
update: updateFile,
|
|
466
|
+
start: handleStart,
|
|
467
|
+
"click-file-list": handleClickFileList,
|
|
468
|
+
"update:visible": function updateVisible(visible) {
|
|
469
|
+
return _this.state.visible = visible;
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
ref: "upload-list-inner"
|
|
473
|
+
};
|
|
474
|
+
var uploadList;
|
|
475
|
+
if (showFileList) {
|
|
476
|
+
uploadList = h(UploadList, uploadListDate);
|
|
477
|
+
if (mode === "bubble") {
|
|
478
|
+
uploadList = h("tiny-modal", {
|
|
479
|
+
props: {
|
|
480
|
+
customClass: "sm:w-[theme(spacing.112)]",
|
|
481
|
+
title: t("ui.fileUpload.uploadList"),
|
|
482
|
+
position: "bottom-right",
|
|
483
|
+
mask: false,
|
|
484
|
+
showClose: false,
|
|
485
|
+
showFooter: false,
|
|
486
|
+
modelValue: this.state.visible
|
|
487
|
+
},
|
|
488
|
+
on: {
|
|
489
|
+
"update:modelValue": function updateModelValue(val) {
|
|
490
|
+
return _this.state.visible = val;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}, [uploadList]);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
var previewComponent = null;
|
|
497
|
+
var encryptDialogComponent = null;
|
|
498
|
+
var notice = this.slots.notice && this.slots.notice();
|
|
499
|
+
var noticePC = this.state.current !== "default" ? notice : "";
|
|
500
|
+
var noticeMF = this.state.current === "default" ? notice : "";
|
|
501
|
+
if (isEdm && isSuccess) {
|
|
502
|
+
uploadData.props.accept = accept;
|
|
503
|
+
uploadData.props.edmToken = edmToken;
|
|
504
|
+
}
|
|
505
|
+
if (edm.preview) {
|
|
506
|
+
previewComponent = h("tiny-dialog-box", _extends({
|
|
507
|
+
minHeight: "600px",
|
|
508
|
+
width: "60%"
|
|
509
|
+
}, dialogConfigObj, {
|
|
510
|
+
scopedSlots: {
|
|
511
|
+
default: function _default() {
|
|
512
|
+
return h("iframe", {
|
|
513
|
+
"attrs": {
|
|
514
|
+
"id": "_iframe",
|
|
515
|
+
"allowfullscreen": true,
|
|
516
|
+
"allowtransparency": "true",
|
|
517
|
+
"frameborder": "0",
|
|
518
|
+
"border": "0",
|
|
519
|
+
"marginwidth": "0",
|
|
520
|
+
"marginheight": "0",
|
|
521
|
+
"scrolling": "no",
|
|
522
|
+
"src": iframeUrl
|
|
523
|
+
},
|
|
524
|
+
"style": "display: block;width: 100%;height: 500px;display: inline-block;"
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}));
|
|
529
|
+
}
|
|
530
|
+
if (encryptConfig.enabled) {
|
|
531
|
+
encryptDialogComponent = h("tiny-dialog-box", {
|
|
532
|
+
style: "",
|
|
533
|
+
props: {
|
|
534
|
+
dataTag: "encrypt-config-dialog",
|
|
535
|
+
lockScroll: true,
|
|
536
|
+
visible: this.state.encryptDialogConfig.show,
|
|
537
|
+
dragable: true,
|
|
538
|
+
title: this.t("ui.fileUpload.encryptDialogTitle"),
|
|
539
|
+
width: "380px",
|
|
540
|
+
height: "auto",
|
|
541
|
+
"modal-append-to-body": false
|
|
542
|
+
// tiny的dialogbox需要添加此属性,防止自动加到body下
|
|
543
|
+
},
|
|
544
|
+
on: {
|
|
545
|
+
"update:visible": function updateVisible(value) {
|
|
546
|
+
return _this.state.encryptDialogConfig.show = value;
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
scopedSlots: {
|
|
550
|
+
default: function _default() {
|
|
551
|
+
return h("div", {
|
|
552
|
+
"attrs": {
|
|
553
|
+
"data-tag": "encrypt-config-dialog-body"
|
|
554
|
+
}
|
|
555
|
+
}, [h("div", [_this.t("ui.fileUpload.addWatermark")]), h("div", [h(Input, {
|
|
556
|
+
"model": {
|
|
557
|
+
value: _this.encryptConfig.watermark,
|
|
558
|
+
callback: function callback($$v) {
|
|
559
|
+
_this.$set(_this.encryptConfig, "watermark", $$v);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
})]), h("p", [" "]), h("div", [_this.t("ui.fileUpload.encrypted")]), h("div", [h(Switch, {
|
|
563
|
+
"model": {
|
|
564
|
+
value: _this.encryptConfig.encrypt,
|
|
565
|
+
callback: function callback($$v) {
|
|
566
|
+
_this.$set(_this.encryptConfig, "encrypt", $$v);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
})])]);
|
|
570
|
+
},
|
|
571
|
+
footer: function footer() {
|
|
572
|
+
return [h(Button, {
|
|
573
|
+
"on": {
|
|
574
|
+
"click": function click() {
|
|
575
|
+
return _this.state.encryptDialogConfig.show = false;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}, [_this.t("ui.base.cancel")]), [h(Button, {
|
|
579
|
+
"attrs": {
|
|
580
|
+
"type": "primary",
|
|
581
|
+
"customClass": "ml-2"
|
|
582
|
+
},
|
|
583
|
+
"on": {
|
|
584
|
+
"click": function click() {
|
|
585
|
+
return encryptDialogConfirm();
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}, [_this.t("ui.popupload.uploadButtonText")])]];
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
var attrs = a($attrs, ["^on[A-Z]"]);
|
|
594
|
+
return h("div", _mergeJSXProps5([{}, attrs, {
|
|
595
|
+
"attrs": {
|
|
596
|
+
"data-tag": "tiny-file-upload"
|
|
597
|
+
},
|
|
598
|
+
"class": isDragSingle ? "relative inline-block" : ""
|
|
599
|
+
}]), [getDefaultTitle({
|
|
600
|
+
listType,
|
|
601
|
+
title,
|
|
602
|
+
showTitle,
|
|
603
|
+
displayOnly,
|
|
604
|
+
mode
|
|
605
|
+
}), noticePC, isText && !displayOnly ? slots.trigger ? [createUploadComponent()] : createUploadComponent() : null, noticeMF, uploadList, previewComponent, encryptDialogComponent]);
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
var __vue2_render, __vue2_staticRenderFns;
|
|
609
|
+
var __cssModules = {};
|
|
610
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, __vue2_render, __vue2_staticRenderFns, false, __vue2_injectStyles);
|
|
611
|
+
function __vue2_injectStyles(context) {
|
|
612
|
+
for (var o in __cssModules) {
|
|
613
|
+
this[o] = __cssModules[o];
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
var mobileFirst = /* @__PURE__ */ function() {
|
|
617
|
+
return __component__.exports;
|
|
618
|
+
}();
|
|
619
|
+
|
|
620
|
+
export { mobileFirst as default };
|