@cling-se/widget 0.17.3 → 0.18.1
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/CHANGELOG.md +24 -0
- package/dist/AddClientCallout-CCt78VvH.js +101 -0
- package/dist/AnswerModal-B4LwVv2N.js +3371 -0
- package/dist/AttachmentItem-DnvYffKP.js +171 -0
- package/dist/BaseUpload-DFoV0ZLe.js +6503 -0
- package/dist/BlockMedia-Amo_kdHo.js +103 -0
- package/dist/CCallout-Gd06ds6O.js +104 -0
- package/dist/{CCurrencyDropdown-CXXQu8th.js → CCurrencyDropdown-B4GNmOGA.js} +91 -53
- package/dist/CDropdownItem-BUNVCpSR.js +749 -0
- package/dist/CFormField.vue_vue_type_script_setup_true_lang-Bo2J0c4G.js +292 -0
- package/dist/{CPhoneFormat-BtBGl8b4.js → CPhoneFormat-DmN5r9Ci.js} +13 -21
- package/dist/CPhoneInput-B6iyhsOG.js +207 -0
- package/dist/CPriceInput-BLQaNu1d.js +142 -0
- package/dist/CSelect-BVO9iO9L.js +98 -0
- package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-C9loRtrk.js +51 -0
- package/dist/ClientAutocomplete-C__yUaxD.js +532 -0
- package/dist/ClientModal-B9cbuEiC.js +1188 -0
- package/dist/ColorPicker-G2kkxL7_.js +1408 -0
- package/dist/CompanyModal-por9AG4P.js +250 -0
- package/dist/ContentWrapper-CQtaGA2u.js +265 -0
- package/dist/CoverBlockSettings-BCBDouyl.js +861 -0
- package/dist/DocAnswer-BrKctwrY.js +33 -0
- package/dist/DocDetails-B_LWVHGt.js +452 -0
- package/dist/DocForm-D6T7NmfO.js +6772 -0
- package/dist/DocFormSend-COYPrhl7.js +171 -0
- package/dist/DocLinks-B0LjxXIk.js +36 -0
- package/dist/DocModalBase-DObZHuYr.js +29 -0
- package/dist/DocPrint-CkDq78fB.js +399 -0
- package/dist/DocReceipt-CYBPyePC.js +341 -0
- package/dist/DocSendReminder-Dau6s43e.js +181 -0
- package/dist/{DocTextEditor-yD9Dt_um.js → DocTextEditor-CVn6gE1i.js} +7907 -5579
- package/dist/DocTimeline-ChBDPOfd.js +537 -0
- package/dist/DocumentClient-MLXzzXLb.js +90 -0
- package/dist/DocumentLayout-BMHOt380.js +1434 -0
- package/dist/DocumentLogotype-Clj3fopX.js +162 -0
- package/dist/DocumentVoided-B5_MSBbC.js +33 -0
- package/dist/EmbedInput-CzkOa02p.js +156 -0
- package/dist/EmbedSettings-Cf_F3KrM.js +103 -0
- package/dist/ErrorCallout-CJn6NCse.js +34 -0
- package/dist/FilePreviewModal-Di1VnPNY.js +202 -0
- package/dist/Flag-C4_G5IY1.js +41 -0
- package/dist/HeaderSettings-DWN0TjVD.js +720 -0
- package/dist/ImageSelectModal-DmAJ9PrN.js +119 -0
- package/dist/ImageUploadWrapper-QLEhA_dI.js +1585 -0
- package/dist/Index-B06eCuBA.js +76 -0
- package/dist/Index-B8Zj0-MX.js +87 -0
- package/dist/{Index-C_aIQ908.js → Index-BBBXL4zh.js} +319 -214
- package/dist/Index-BCHLxp7B.js +21 -0
- package/dist/Index-BDAp1CwZ.js +363 -0
- package/dist/Index-BFbcjFo4.js +16 -0
- package/dist/{Index-CRiATiQn.js → Index-BODJXJNp.js} +10 -18
- package/dist/Index-BOx_9tTM.js +136 -0
- package/dist/Index-BgZNiD7A.js +47 -0
- package/dist/Index-Bt97lEsI.js +228 -0
- package/dist/Index-C9aBeBBk.js +70 -0
- package/dist/Index-CE3pWPzp.js +49 -0
- package/dist/Index-CMdPSsp4.js +38 -0
- package/dist/Index-CNhBDG2e.js +126 -0
- package/dist/Index-CdsOdgG2.js +28 -0
- package/dist/{Index-Ch9r5yhG.js → Index-CmxFh3dW.js} +9 -17
- package/dist/Index-CpxzwwQS.js +52 -0
- package/dist/Index-CxTwWRD9.js +93 -0
- package/dist/Index-D9WFWlE6.js +140 -0
- package/dist/Index-D9bulLeI.js +39 -0
- package/dist/{Index-RWMPRDAE.js → Index-DL_9LzoR.js} +10 -18
- package/dist/Index-DR-sGE3Y.js +25 -0
- package/dist/Index-DRoOW5Pn.js +163 -0
- package/dist/Index-DTn47-hP.js +74 -0
- package/dist/Index-DeGDlj0B.js +68 -0
- package/dist/Index-DhYYK4bK.js +28 -0
- package/dist/Index-Dssdb-0Z.js +629 -0
- package/dist/Index-OcBnU480.js +200 -0
- package/dist/Index-Qh_8JqAv.js +3477 -0
- package/dist/Index-W10PQb8i.js +102 -0
- package/dist/Index-lbWFEELM.js +4 -0
- package/dist/Index-qFAg7VVU.js +1098 -0
- package/dist/Index-rDndJKo1.js +160 -0
- package/dist/{Index-Dfq7egc1.js → Index-s-6Qh_NE.js} +47 -60
- package/dist/Index.vue_vue_type_script_lang-CriDqp1F.js +671 -0
- package/dist/InputToggleRow-DJarYsVL.js +99 -0
- package/dist/ManualPopover-BMrkEHtV.js +65 -0
- package/dist/MediaWrapper-BYdVpmov.js +18 -0
- package/dist/{NotBindingText-CC7TxUqg.js → NotBindingText-DGjJoN8-.js} +13 -17
- package/dist/PackageGroup-q7_oBOqw.js +1060 -0
- package/dist/PdfTerms-DBEClYQ5.js +34 -0
- package/dist/PdfViewer-C_y5sqXB.js +392 -0
- package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D5ZLw34T.js +17 -0
- package/dist/PriceHeader-BSwv3mzc.js +488 -0
- package/dist/{SearchApi-G2Hvp0Dd.js → SearchApi-BM6TTqxW.js} +37 -49
- package/dist/SendForm-DfmBbhp9.js +6689 -0
- package/dist/Setup-BC1feKr_.js +47 -0
- package/dist/{SmartList-BynTuXtB.js → SmartList-B3pgsg4S.js} +16 -24
- package/dist/Sortable.vue_vue_type_script_setup_true_lang-YOP-Y07m.js +1349 -0
- package/dist/{TermsSettings-cA5YAO77.js → TermsSettings-DEkACrRU.js} +169 -56
- package/dist/ThemeColorRow-qG8Dkkyj.js +105 -0
- package/dist/ToggleBinding-Cdtl_-1s.js +44 -0
- package/dist/UploadModal-1OWPRxA5.js +134 -0
- package/dist/VideoPlayerInput-DgFNjiKK.js +134 -0
- package/dist/VideoPlayerSettings-CFuA-7RC.js +78 -0
- package/dist/VideoSelectModal-CSv67eA8.js +217 -0
- package/dist/{anime.es-BrPTThYb.js → anime.es-4wvNItHq.js} +205 -201
- package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
- package/dist/{dom-Ds4ypDrd.js → dom-CkTGWrfu.js} +3 -6
- package/dist/{focusDrawerMixin-CximZA1J.js → focusDrawerMixin-r-OZchfV.js} +1 -1
- package/dist/{formDrawerState-CkNGdxn5.js → formDrawerState-COVczNhJ.js} +2 -2
- package/dist/helpers-ChwW54Ex.js +46 -0
- package/dist/index-BMZle8Ew.js +513 -0
- package/dist/index-Bf-fiKJf.js +268 -0
- package/dist/index-Bg4JRi5S.js +125 -0
- package/dist/index-C7chK2UD.js +3525 -0
- package/dist/index-CR52qIBO.js +149 -0
- package/dist/index-D1x9O_nJ.js +188 -0
- package/dist/index-YFcPqc9m.js +508 -0
- package/dist/index.es.js +2 -5
- package/dist/index.umd.js +303 -1486
- package/dist/main-DI0diChK.js +57570 -0
- package/dist/mapFormMixin-Cgvwie9a.js +1528 -0
- package/dist/omit-DpjD7Dj9.js +56 -0
- package/dist/{publicSenderState-CGEm9EYe.js → publicSenderState-BcjNldje.js} +4 -4
- package/dist/splitpanes-BypKTSRL.js +342 -0
- package/dist/template-Dzexob5I.js +1572 -0
- package/dist/tippy.esm-0UMN6kWf.js +1994 -0
- package/dist/useTermsModal-DzH_PDFP.js +87 -0
- package/dist/{utils-Dr4AcaE9.js → utils--kBYCNZD.js} +8 -11
- package/dist/validation-B-omH73u.js +40 -0
- package/dist/widget.css +1 -0
- package/package.json +20 -25
- package/dist/AddClientCallout-Br6IhwGH.js +0 -48
- package/dist/AnswerModal-CsWltR6j.js +0 -3879
- package/dist/AttachmentItem-BG7FuSCD.js +0 -85
- package/dist/BaseDatePicker-PSNBtUIh.js +0 -3187
- package/dist/BaseUpload-BfEurAAV.js +0 -1977
- package/dist/BlockMedia-Bo3OfNSU.js +0 -76
- package/dist/CCallout-CAjM8-1X.js +0 -58
- package/dist/CDropdownItem-CN7gSfgY.js +0 -640
- package/dist/CFormField-Clvcf2Jh.js +0 -240
- package/dist/CPhoneInput-CEHXh5jM.js +0 -138
- package/dist/CPriceInput-D2c07SXp.js +0 -116
- package/dist/CSelect-Cz2IPzxS.js +0 -91
- package/dist/CSkeleton-AsnvnD-m.js +0 -55
- package/dist/ClientAutocomplete-CZ55-DKe.js +0 -438
- package/dist/ClientModal-CgUhWZ5L.js +0 -666
- package/dist/ColorPicker-IFGHqH-u.js +0 -2879
- package/dist/CompanyModal-TLSBFo3U.js +0 -147
- package/dist/ContentWrapper-HClxKPuT.js +0 -190
- package/dist/CoverBlockSettings-D99hAa6e.js +0 -659
- package/dist/DocAnswer-CTV_Bpt7.js +0 -36
- package/dist/DocDetails-CQe5htXj.js +0 -263
- package/dist/DocForm-6Efv5_oz.js +0 -5017
- package/dist/DocFormSend-DbXcklxU.js +0 -146
- package/dist/DocLinks-BO545zbL.js +0 -38
- package/dist/DocModalBase-DXHNJ-6i.js +0 -28
- package/dist/DocPrint-Bf2U4FQN.js +0 -240
- package/dist/DocReceipt-CWXvC7bY.js +0 -217
- package/dist/DocSendReminder-CRzBM2NJ.js +0 -140
- package/dist/DocTimeline-DGVOk8-2.js +0 -485
- package/dist/DocumentClient-Das9BaJ7.js +0 -136
- package/dist/DocumentLayout-4q8rmTVT.js +0 -4880
- package/dist/DocumentLogotype-DLncJJAB.js +0 -92
- package/dist/DocumentVoided-CcI9lX27.js +0 -25
- package/dist/EmbedInput-BPdy0lGS.js +0 -117
- package/dist/EmbedSettings-L2iwYLQK.js +0 -74
- package/dist/ErrorCallout-Ds_tBT02.js +0 -27
- package/dist/FilePreviewModal-hxUu330p.js +0 -81
- package/dist/Flag-1-HcT5Dz.js +0 -46
- package/dist/HeaderSettings-C27fMugK.js +0 -440
- package/dist/ImageSelectModal-BKDIyxF4.js +0 -86
- package/dist/ImageUploadWrapper-BiYzUQur.js +0 -1604
- package/dist/Index-5BOWxcPG.js +0 -26
- package/dist/Index-B1Odktov.js +0 -754
- package/dist/Index-B3d5BjEn.js +0 -25
- package/dist/Index-B3sSU_4X.js +0 -54
- package/dist/Index-B5Dqsh3K.js +0 -150
- package/dist/Index-B6aO1c_w.js +0 -62
- package/dist/Index-BGfICxJQ.js +0 -643
- package/dist/Index-BHopC0hv.js +0 -24
- package/dist/Index-BJXcSmp_.js +0 -55
- package/dist/Index-BQe6QjQZ.js +0 -25
- package/dist/Index-BmXx_x6t.js +0 -77
- package/dist/Index-C692qMTG.js +0 -294
- package/dist/Index-CEvbw-3i.js +0 -41
- package/dist/Index-CYSULnpn.js +0 -32
- package/dist/Index-CdtYzwAM.js +0 -107
- package/dist/Index-CetF2FW0.js +0 -230
- package/dist/Index-Cv6XLM20.js +0 -73
- package/dist/Index-Cwy8ff76.js +0 -154
- package/dist/Index-D34z4UEY.js +0 -84
- package/dist/Index-DNCei-lp.js +0 -56
- package/dist/Index-DUbxgIYB.js +0 -2445
- package/dist/Index-DVwn_LLf.js +0 -28
- package/dist/Index-Dla-mesV.js +0 -146
- package/dist/Index-KtUkOPI2.js +0 -58
- package/dist/Index-LjnOTVJk.js +0 -66
- package/dist/Index-ky1SRtfY.js +0 -94
- package/dist/Index-mceZW2NX.js +0 -41
- package/dist/Index-tD3hZjh8.js +0 -144
- package/dist/Index-vM5kDtC2.js +0 -33
- package/dist/InputToggleRow-BmDuSbE2.js +0 -57
- package/dist/ManualPopover-CQfjPvFe.js +0 -60
- package/dist/MediaWrapper-DDzcjR6V.js +0 -23
- package/dist/PackageGroup-mAGXfZDv.js +0 -704
- package/dist/PdfTerms-BH_Nwf2h.js +0 -31
- package/dist/PdfViewer-mBLxI8bA.js +0 -383
- package/dist/PlainHtml-B7gUNNZd.js +0 -27
- package/dist/PriceHeader-DClYMPcq.js +0 -338
- package/dist/SendForm-Cxv_m8Rq.js +0 -1023
- package/dist/Setup-B90VDZTG.js +0 -50
- package/dist/ThemeColorRow-D-Z7w4Wk.js +0 -69
- package/dist/ToggleBinding-DOeTcWzi.js +0 -42
- package/dist/UploadModal-DOPLVEpV.js +0 -95
- package/dist/VideoPlayerInput-1zG06elO.js +0 -97
- package/dist/VideoPlayerSettings-O-4rAYYh.js +0 -61
- package/dist/VideoSelectModal-DzqFrqCg.js +0 -104
- package/dist/answerDocumentMixin-HBiNWYCH.js +0 -51
- package/dist/debounce-Ch1d3526.js +0 -84
- package/dist/formValidationMixin-D_MzsHsR.js +0 -49
- package/dist/index-BNdbPq4J.js +0 -492
- package/dist/index-BXzugeJ6.js +0 -81
- package/dist/index-C5wcxrC6.js +0 -167
- package/dist/index-CgDOs7t4.js +0 -2700
- package/dist/index-Cj-_2coz.js +0 -351
- package/dist/index-DpqV5y0K.js +0 -102
- package/dist/main-BL_yzf2r.js +0 -57357
- package/dist/mapFormMixin-Cu_vkTP-.js +0 -3028
- package/dist/omit-Dfe_H1Ft.js +0 -31
- package/dist/simplebar.min-CRlLD1Oz.js +0 -71
- package/dist/splitpanes-BHUVsCZF.js +0 -382
- package/dist/style.css +0 -4
- package/dist/throttle-BX_w77tW.js +0 -18
- package/dist/tippy.esm-n4arfVzA.js +0 -1805
- package/dist/vuedraggable.umd-DW4PJoZ3.js +0 -3161
- package/dist/vuex.esm-DKGl8mcw.js +0 -467
|
@@ -1,1977 +0,0 @@
|
|
|
1
|
-
import { ad as Ue, l as De, n as $e, an as ye, W as ve } from "./main-BL_yzf2r.js";
|
|
2
|
-
/*!
|
|
3
|
-
* Compressor.js v1.1.1
|
|
4
|
-
* https://fengyuanchen.github.io/compressorjs
|
|
5
|
-
*
|
|
6
|
-
* Copyright 2018-present Chen Fengyuan
|
|
7
|
-
* Released under the MIT license
|
|
8
|
-
*
|
|
9
|
-
* Date: 2021-10-05T02:32:40.212Z
|
|
10
|
-
*/
|
|
11
|
-
function be(s, n) {
|
|
12
|
-
var a = Object.keys(s);
|
|
13
|
-
if (Object.getOwnPropertySymbols) {
|
|
14
|
-
var l = Object.getOwnPropertySymbols(s);
|
|
15
|
-
n && (l = l.filter(function(d) {
|
|
16
|
-
return Object.getOwnPropertyDescriptor(s, d).enumerable;
|
|
17
|
-
})), a.push.apply(a, l);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
}
|
|
21
|
-
function le(s) {
|
|
22
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
23
|
-
var a = arguments[n] != null ? arguments[n] : {};
|
|
24
|
-
n % 2 ? be(Object(a), !0).forEach(function(l) {
|
|
25
|
-
Se(s, l, a[l]);
|
|
26
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(a)) : be(Object(a)).forEach(function(l) {
|
|
27
|
-
Object.defineProperty(s, l, Object.getOwnPropertyDescriptor(a, l));
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return s;
|
|
31
|
-
}
|
|
32
|
-
function Re(s, n) {
|
|
33
|
-
if (!(s instanceof n))
|
|
34
|
-
throw new TypeError("Cannot call a class as a function");
|
|
35
|
-
}
|
|
36
|
-
function _e(s, n) {
|
|
37
|
-
for (var a = 0; a < n.length; a++) {
|
|
38
|
-
var l = n[a];
|
|
39
|
-
l.enumerable = l.enumerable || !1, l.configurable = !0, "value" in l && (l.writable = !0), Object.defineProperty(s, l.key, l);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function Te(s, n, a) {
|
|
43
|
-
return n && _e(s.prototype, n), a && _e(s, a), s;
|
|
44
|
-
}
|
|
45
|
-
function Se(s, n, a) {
|
|
46
|
-
return n in s ? Object.defineProperty(s, n, {
|
|
47
|
-
value: a,
|
|
48
|
-
enumerable: !0,
|
|
49
|
-
configurable: !0,
|
|
50
|
-
writable: !0
|
|
51
|
-
}) : s[n] = a, s;
|
|
52
|
-
}
|
|
53
|
-
function fe() {
|
|
54
|
-
return fe = Object.assign || function(s) {
|
|
55
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
56
|
-
var a = arguments[n];
|
|
57
|
-
for (var l in a)
|
|
58
|
-
Object.prototype.hasOwnProperty.call(a, l) && (s[l] = a[l]);
|
|
59
|
-
}
|
|
60
|
-
return s;
|
|
61
|
-
}, fe.apply(this, arguments);
|
|
62
|
-
}
|
|
63
|
-
var Ee = { exports: {} };
|
|
64
|
-
(function(s) {
|
|
65
|
-
typeof window > "u" || function(n) {
|
|
66
|
-
var a = n.HTMLCanvasElement && n.HTMLCanvasElement.prototype, l = n.Blob && function() {
|
|
67
|
-
try {
|
|
68
|
-
return !!new Blob();
|
|
69
|
-
} catch {
|
|
70
|
-
return !1;
|
|
71
|
-
}
|
|
72
|
-
}(), d = l && n.Uint8Array && function() {
|
|
73
|
-
try {
|
|
74
|
-
return new Blob([new Uint8Array(100)]).size === 100;
|
|
75
|
-
} catch {
|
|
76
|
-
return !1;
|
|
77
|
-
}
|
|
78
|
-
}(), p = n.BlobBuilder || n.WebKitBlobBuilder || n.MozBlobBuilder || n.MSBlobBuilder, m = /^data:((.*?)(;charset=.*?)?)(;base64)?,/, k = (l || p) && n.atob && n.ArrayBuffer && n.Uint8Array && function(g) {
|
|
79
|
-
var b, w, A, B, T, v, S, U, H;
|
|
80
|
-
if (b = g.match(m), !b)
|
|
81
|
-
throw new Error("invalid data URI");
|
|
82
|
-
for (w = b[2] ? b[1] : "text/plain" + (b[3] || ";charset=US-ASCII"), A = !!b[4], B = g.slice(b[0].length), A ? T = atob(B) : T = decodeURIComponent(B), v = new ArrayBuffer(T.length), S = new Uint8Array(v), U = 0; U < T.length; U += 1)
|
|
83
|
-
S[U] = T.charCodeAt(U);
|
|
84
|
-
return l ? new Blob([d ? S : v], {
|
|
85
|
-
type: w
|
|
86
|
-
}) : (H = new p(), H.append(v), H.getBlob(w));
|
|
87
|
-
};
|
|
88
|
-
n.HTMLCanvasElement && !a.toBlob && (a.mozGetAsFile ? a.toBlob = function(g, b, w) {
|
|
89
|
-
var A = this;
|
|
90
|
-
setTimeout(function() {
|
|
91
|
-
w && a.toDataURL && k ? g(k(A.toDataURL(b, w))) : g(A.mozGetAsFile("blob", b));
|
|
92
|
-
});
|
|
93
|
-
} : a.toDataURL && k && (a.msToBlob ? a.toBlob = function(g, b, w) {
|
|
94
|
-
var A = this;
|
|
95
|
-
setTimeout(function() {
|
|
96
|
-
(b && b !== "image/png" || w) && a.toDataURL && k ? g(k(A.toDataURL(b, w))) : g(A.msToBlob(b));
|
|
97
|
-
});
|
|
98
|
-
} : a.toBlob = function(g, b, w) {
|
|
99
|
-
var A = this;
|
|
100
|
-
setTimeout(function() {
|
|
101
|
-
g(k(A.toDataURL(b, w)));
|
|
102
|
-
});
|
|
103
|
-
})), s.exports ? s.exports = k : n.dataURLtoBlob = k;
|
|
104
|
-
}(window);
|
|
105
|
-
})(Ee);
|
|
106
|
-
var Be = Ee.exports, je = function(n) {
|
|
107
|
-
return typeof Blob > "u" ? !1 : n instanceof Blob || Object.prototype.toString.call(n) === "[object Blob]";
|
|
108
|
-
}, ke = {
|
|
109
|
-
/**
|
|
110
|
-
* Indicates if output the original image instead of the compressed one
|
|
111
|
-
* when the size of the compressed image is greater than the original one's
|
|
112
|
-
* @type {boolean}
|
|
113
|
-
*/
|
|
114
|
-
strict: !0,
|
|
115
|
-
/**
|
|
116
|
-
* Indicates if read the image's Exif Orientation information,
|
|
117
|
-
* and then rotate or flip the image automatically.
|
|
118
|
-
* @type {boolean}
|
|
119
|
-
*/
|
|
120
|
-
checkOrientation: !0,
|
|
121
|
-
/**
|
|
122
|
-
* The max width of the output image.
|
|
123
|
-
* @type {number}
|
|
124
|
-
*/
|
|
125
|
-
maxWidth: 1 / 0,
|
|
126
|
-
/**
|
|
127
|
-
* The max height of the output image.
|
|
128
|
-
* @type {number}
|
|
129
|
-
*/
|
|
130
|
-
maxHeight: 1 / 0,
|
|
131
|
-
/**
|
|
132
|
-
* The min width of the output image.
|
|
133
|
-
* @type {number}
|
|
134
|
-
*/
|
|
135
|
-
minWidth: 0,
|
|
136
|
-
/**
|
|
137
|
-
* The min height of the output image.
|
|
138
|
-
* @type {number}
|
|
139
|
-
*/
|
|
140
|
-
minHeight: 0,
|
|
141
|
-
/**
|
|
142
|
-
* The width of the output image.
|
|
143
|
-
* If not specified, the natural width of the source image will be used.
|
|
144
|
-
* @type {number}
|
|
145
|
-
*/
|
|
146
|
-
width: void 0,
|
|
147
|
-
/**
|
|
148
|
-
* The height of the output image.
|
|
149
|
-
* If not specified, the natural height of the source image will be used.
|
|
150
|
-
* @type {number}
|
|
151
|
-
*/
|
|
152
|
-
height: void 0,
|
|
153
|
-
/**
|
|
154
|
-
* Sets how the size of the image should be resized to the container
|
|
155
|
-
* specified by the `width` and `height` options.
|
|
156
|
-
* @type {string}
|
|
157
|
-
*/
|
|
158
|
-
resize: "none",
|
|
159
|
-
/**
|
|
160
|
-
* The quality of the output image.
|
|
161
|
-
* It must be a number between `0` and `1`,
|
|
162
|
-
* and only available for `image/jpeg` and `image/webp` images.
|
|
163
|
-
* Check out {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob canvas.toBlob}.
|
|
164
|
-
* @type {number}
|
|
165
|
-
*/
|
|
166
|
-
quality: 0.8,
|
|
167
|
-
/**
|
|
168
|
-
* The mime type of the output image.
|
|
169
|
-
* By default, the original mime type of the source image file will be used.
|
|
170
|
-
* @type {string}
|
|
171
|
-
*/
|
|
172
|
-
mimeType: "auto",
|
|
173
|
-
/**
|
|
174
|
-
* Files whose file type is included in this list,
|
|
175
|
-
* and whose file size exceeds the `convertSize` value will be converted to JPEGs.
|
|
176
|
-
* @type {string|Array}
|
|
177
|
-
*/
|
|
178
|
-
convertTypes: ["image/png"],
|
|
179
|
-
/**
|
|
180
|
-
* PNG files over this size (5 MB by default) will be converted to JPEGs.
|
|
181
|
-
* To disable this, just set the value to `Infinity`.
|
|
182
|
-
* @type {number}
|
|
183
|
-
*/
|
|
184
|
-
convertSize: 5e6,
|
|
185
|
-
/**
|
|
186
|
-
* The hook function to execute before draw the image into the canvas for compression.
|
|
187
|
-
* @type {Function}
|
|
188
|
-
* @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
|
|
189
|
-
* @param {HTMLCanvasElement} canvas - The canvas for compression.
|
|
190
|
-
* @example
|
|
191
|
-
* function (context, canvas) {
|
|
192
|
-
* context.fillStyle = '#fff';
|
|
193
|
-
* }
|
|
194
|
-
*/
|
|
195
|
-
beforeDraw: null,
|
|
196
|
-
/**
|
|
197
|
-
* The hook function to execute after drew the image into the canvas for compression.
|
|
198
|
-
* @type {Function}
|
|
199
|
-
* @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
|
|
200
|
-
* @param {HTMLCanvasElement} canvas - The canvas for compression.
|
|
201
|
-
* @example
|
|
202
|
-
* function (context, canvas) {
|
|
203
|
-
* context.filter = 'grayscale(100%)';
|
|
204
|
-
* }
|
|
205
|
-
*/
|
|
206
|
-
drew: null,
|
|
207
|
-
/**
|
|
208
|
-
* The hook function to execute when success to compress the image.
|
|
209
|
-
* @type {Function}
|
|
210
|
-
* @param {File} file - The compressed image File object.
|
|
211
|
-
* @example
|
|
212
|
-
* function (file) {
|
|
213
|
-
* console.log(file);
|
|
214
|
-
* }
|
|
215
|
-
*/
|
|
216
|
-
success: null,
|
|
217
|
-
/**
|
|
218
|
-
* The hook function to execute when fail to compress the image.
|
|
219
|
-
* @type {Function}
|
|
220
|
-
* @param {Error} err - An Error object.
|
|
221
|
-
* @example
|
|
222
|
-
* function (err) {
|
|
223
|
-
* console.log(err.message);
|
|
224
|
-
* }
|
|
225
|
-
*/
|
|
226
|
-
error: null
|
|
227
|
-
}, Pe = typeof window < "u" && typeof window.document < "u", q = Pe ? window : {}, de = function(n) {
|
|
228
|
-
return n > 0 && n < 1 / 0;
|
|
229
|
-
}, Ie = Array.prototype.slice;
|
|
230
|
-
function ze(s) {
|
|
231
|
-
return Array.from ? Array.from(s) : Ie.call(s);
|
|
232
|
-
}
|
|
233
|
-
var Ne = /^image\/.+$/;
|
|
234
|
-
function ge(s) {
|
|
235
|
-
return Ne.test(s);
|
|
236
|
-
}
|
|
237
|
-
function Le(s) {
|
|
238
|
-
var n = ge(s) ? s.substr(6) : "";
|
|
239
|
-
return n === "jpeg" && (n = "jpg"), ".".concat(n);
|
|
240
|
-
}
|
|
241
|
-
var Ae = String.fromCharCode;
|
|
242
|
-
function Me(s, n, a) {
|
|
243
|
-
var l = "", d;
|
|
244
|
-
for (a += n, d = n; d < a; d += 1)
|
|
245
|
-
l += Ae(s.getUint8(d));
|
|
246
|
-
return l;
|
|
247
|
-
}
|
|
248
|
-
var He = q.btoa;
|
|
249
|
-
function We(s, n) {
|
|
250
|
-
for (var a = [], l = 8192, d = new Uint8Array(s); d.length > 0; )
|
|
251
|
-
a.push(Ae.apply(null, ze(d.subarray(0, l)))), d = d.subarray(l);
|
|
252
|
-
return "data:".concat(n, ";base64,").concat(He(a.join("")));
|
|
253
|
-
}
|
|
254
|
-
function qe(s) {
|
|
255
|
-
var n = new DataView(s), a;
|
|
256
|
-
try {
|
|
257
|
-
var l, d, p;
|
|
258
|
-
if (n.getUint8(0) === 255 && n.getUint8(1) === 216)
|
|
259
|
-
for (var m = n.byteLength, k = 2; k + 1 < m; ) {
|
|
260
|
-
if (n.getUint8(k) === 255 && n.getUint8(k + 1) === 225) {
|
|
261
|
-
d = k;
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
k += 1;
|
|
265
|
-
}
|
|
266
|
-
if (d) {
|
|
267
|
-
var g = d + 4, b = d + 10;
|
|
268
|
-
if (Me(n, g, 4) === "Exif") {
|
|
269
|
-
var w = n.getUint16(b);
|
|
270
|
-
if (l = w === 18761, (l || w === 19789) && n.getUint16(b + 2, l) === 42) {
|
|
271
|
-
var A = n.getUint32(b + 4, l);
|
|
272
|
-
A >= 8 && (p = b + A);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
if (p) {
|
|
277
|
-
var B = n.getUint16(p, l), T, v;
|
|
278
|
-
for (v = 0; v < B; v += 1)
|
|
279
|
-
if (T = p + v * 12 + 2, n.getUint16(T, l) === 274) {
|
|
280
|
-
T += 8, a = n.getUint16(T, l), n.setUint16(T, 1, l);
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
} catch {
|
|
285
|
-
a = 1;
|
|
286
|
-
}
|
|
287
|
-
return a;
|
|
288
|
-
}
|
|
289
|
-
function Fe(s) {
|
|
290
|
-
var n = 0, a = 1, l = 1;
|
|
291
|
-
switch (s) {
|
|
292
|
-
case 2:
|
|
293
|
-
a = -1;
|
|
294
|
-
break;
|
|
295
|
-
case 3:
|
|
296
|
-
n = -180;
|
|
297
|
-
break;
|
|
298
|
-
case 4:
|
|
299
|
-
l = -1;
|
|
300
|
-
break;
|
|
301
|
-
case 5:
|
|
302
|
-
n = 90, l = -1;
|
|
303
|
-
break;
|
|
304
|
-
case 6:
|
|
305
|
-
n = 90;
|
|
306
|
-
break;
|
|
307
|
-
case 7:
|
|
308
|
-
n = 90, a = -1;
|
|
309
|
-
break;
|
|
310
|
-
case 8:
|
|
311
|
-
n = -90;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
return {
|
|
315
|
-
rotate: n,
|
|
316
|
-
scaleX: a,
|
|
317
|
-
scaleY: l
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
var Xe = /\.\d*(?:0|9){12}\d*$/;
|
|
321
|
-
function xe(s) {
|
|
322
|
-
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e11;
|
|
323
|
-
return Xe.test(s) ? Math.round(s * n) / n : s;
|
|
324
|
-
}
|
|
325
|
-
function V(s) {
|
|
326
|
-
var n = s.aspectRatio, a = s.height, l = s.width, d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "none", p = de(l), m = de(a);
|
|
327
|
-
if (p && m) {
|
|
328
|
-
var k = a * n;
|
|
329
|
-
(d === "contain" || d === "none") && k > l || d === "cover" && k < l ? a = l / n : l = a * n;
|
|
330
|
-
} else
|
|
331
|
-
p ? a = l / n : m && (l = a * n);
|
|
332
|
-
return {
|
|
333
|
-
width: l,
|
|
334
|
-
height: a
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
var Ge = q.ArrayBuffer, Ce = q.FileReader, X = q.URL || q.webkitURL, Ke = /\.\w+$/, Je = q.Compressor, Oe = /* @__PURE__ */ function() {
|
|
338
|
-
function s(n, a) {
|
|
339
|
-
Re(this, s), this.file = n, this.image = new Image(), this.options = le(le({}, ke), a), this.aborted = !1, this.result = null, this.init();
|
|
340
|
-
}
|
|
341
|
-
return Te(s, [{
|
|
342
|
-
key: "init",
|
|
343
|
-
value: function() {
|
|
344
|
-
var a = this, l = this.file, d = this.options;
|
|
345
|
-
if (!je(l)) {
|
|
346
|
-
this.fail(new Error("The first argument must be a File or Blob object."));
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
var p = l.type;
|
|
350
|
-
if (!ge(p)) {
|
|
351
|
-
this.fail(new Error("The first argument must be an image File or Blob object."));
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
if (!X || !Ce) {
|
|
355
|
-
this.fail(new Error("The current browser does not support image compression."));
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
if (Ge || (d.checkOrientation = !1), X && !d.checkOrientation)
|
|
359
|
-
this.load({
|
|
360
|
-
url: X.createObjectURL(l)
|
|
361
|
-
});
|
|
362
|
-
else {
|
|
363
|
-
var m = new Ce(), k = d.checkOrientation && p === "image/jpeg";
|
|
364
|
-
this.reader = m, m.onload = function(g) {
|
|
365
|
-
var b = g.target, w = b.result, A = {};
|
|
366
|
-
if (k) {
|
|
367
|
-
var B = qe(w);
|
|
368
|
-
B > 1 || !X ? (A.url = We(w, p), B > 1 && fe(A, Fe(B))) : A.url = X.createObjectURL(l);
|
|
369
|
-
} else
|
|
370
|
-
A.url = w;
|
|
371
|
-
a.load(A);
|
|
372
|
-
}, m.onabort = function() {
|
|
373
|
-
a.fail(new Error("Aborted to read the image with FileReader."));
|
|
374
|
-
}, m.onerror = function() {
|
|
375
|
-
a.fail(new Error("Failed to read the image with FileReader."));
|
|
376
|
-
}, m.onloadend = function() {
|
|
377
|
-
a.reader = null;
|
|
378
|
-
}, k ? m.readAsArrayBuffer(l) : m.readAsDataURL(l);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}, {
|
|
382
|
-
key: "load",
|
|
383
|
-
value: function(a) {
|
|
384
|
-
var l = this, d = this.file, p = this.image;
|
|
385
|
-
p.onload = function() {
|
|
386
|
-
l.draw(le(le({}, a), {}, {
|
|
387
|
-
naturalWidth: p.naturalWidth,
|
|
388
|
-
naturalHeight: p.naturalHeight
|
|
389
|
-
}));
|
|
390
|
-
}, p.onabort = function() {
|
|
391
|
-
l.fail(new Error("Aborted to load the image."));
|
|
392
|
-
}, p.onerror = function() {
|
|
393
|
-
l.fail(new Error("Failed to load the image."));
|
|
394
|
-
}, q.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(q.navigator.userAgent) && (p.crossOrigin = "anonymous"), p.alt = d.name, p.src = a.url;
|
|
395
|
-
}
|
|
396
|
-
}, {
|
|
397
|
-
key: "draw",
|
|
398
|
-
value: function(a) {
|
|
399
|
-
var l = this, d = a.naturalWidth, p = a.naturalHeight, m = a.rotate, k = m === void 0 ? 0 : m, g = a.scaleX, b = g === void 0 ? 1 : g, w = a.scaleY, A = w === void 0 ? 1 : w, B = this.file, T = this.image, v = this.options, S = document.createElement("canvas"), U = S.getContext("2d"), H = Math.abs(k) % 180 === 90, G = (v.resize === "contain" || v.resize === "cover") && de(v.width) && de(v.height), F = Math.max(v.maxWidth, 0) || 1 / 0, I = Math.max(v.maxHeight, 0) || 1 / 0, z = Math.max(v.minWidth, 0) || 0, W = Math.max(v.minHeight, 0) || 0, L = d / p, D = v.width, $ = v.height;
|
|
400
|
-
if (H) {
|
|
401
|
-
var Q = [I, F];
|
|
402
|
-
F = Q[0], I = Q[1];
|
|
403
|
-
var Z = [W, z];
|
|
404
|
-
z = Z[0], W = Z[1];
|
|
405
|
-
var K = [$, D];
|
|
406
|
-
D = K[0], $ = K[1];
|
|
407
|
-
}
|
|
408
|
-
G && (L = D / $);
|
|
409
|
-
var ee = V({
|
|
410
|
-
aspectRatio: L,
|
|
411
|
-
width: F,
|
|
412
|
-
height: I
|
|
413
|
-
}, "contain");
|
|
414
|
-
F = ee.width, I = ee.height;
|
|
415
|
-
var te = V({
|
|
416
|
-
aspectRatio: L,
|
|
417
|
-
width: z,
|
|
418
|
-
height: W
|
|
419
|
-
}, "cover");
|
|
420
|
-
if (z = te.width, W = te.height, G) {
|
|
421
|
-
var re = V({
|
|
422
|
-
aspectRatio: L,
|
|
423
|
-
width: D,
|
|
424
|
-
height: $
|
|
425
|
-
}, v.resize);
|
|
426
|
-
D = re.width, $ = re.height;
|
|
427
|
-
} else {
|
|
428
|
-
var ie = V({
|
|
429
|
-
aspectRatio: L,
|
|
430
|
-
width: D,
|
|
431
|
-
height: $
|
|
432
|
-
}), ne = ie.width;
|
|
433
|
-
D = ne === void 0 ? d : ne;
|
|
434
|
-
var ae = ie.height;
|
|
435
|
-
$ = ae === void 0 ? p : ae;
|
|
436
|
-
}
|
|
437
|
-
D = Math.floor(xe(Math.min(Math.max(D, z), F))), $ = Math.floor(xe(Math.min(Math.max($, W), I)));
|
|
438
|
-
var ce = -D / 2, pe = -$ / 2, he = D, me = $, J = [];
|
|
439
|
-
if (G) {
|
|
440
|
-
var se = 0, oe = 0, Y = d, f = p, t = V({
|
|
441
|
-
aspectRatio: L,
|
|
442
|
-
width: d,
|
|
443
|
-
height: p
|
|
444
|
-
}, {
|
|
445
|
-
contain: "cover",
|
|
446
|
-
cover: "contain"
|
|
447
|
-
}[v.resize]);
|
|
448
|
-
Y = t.width, f = t.height, se = (d - Y) / 2, oe = (p - f) / 2, J.push(se, oe, Y, f);
|
|
449
|
-
}
|
|
450
|
-
if (J.push(ce, pe, he, me), H) {
|
|
451
|
-
var r = [$, D];
|
|
452
|
-
D = r[0], $ = r[1];
|
|
453
|
-
}
|
|
454
|
-
S.width = D, S.height = $, ge(v.mimeType) || (v.mimeType = B.type);
|
|
455
|
-
var i = "transparent";
|
|
456
|
-
if (B.size > v.convertSize && v.convertTypes.indexOf(v.mimeType) >= 0 && (v.mimeType = "image/jpeg"), v.mimeType === "image/jpeg" && (i = "#fff"), U.fillStyle = i, U.fillRect(0, 0, D, $), v.beforeDraw && v.beforeDraw.call(this, U, S), !this.aborted && (U.save(), U.translate(D / 2, $ / 2), U.rotate(k * Math.PI / 180), U.scale(b, A), U.drawImage.apply(U, [T].concat(J)), U.restore(), v.drew && v.drew.call(this, U, S), !this.aborted)) {
|
|
457
|
-
var u = function(h) {
|
|
458
|
-
l.aborted || l.done({
|
|
459
|
-
naturalWidth: d,
|
|
460
|
-
naturalHeight: p,
|
|
461
|
-
result: h
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
|
-
S.toBlob ? S.toBlob(u, v.mimeType, v.quality) : u(Be(S.toDataURL(v.mimeType, v.quality)));
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}, {
|
|
468
|
-
key: "done",
|
|
469
|
-
value: function(a) {
|
|
470
|
-
var l = a.naturalWidth, d = a.naturalHeight, p = a.result, m = this.file, k = this.image, g = this.options;
|
|
471
|
-
if (X && !g.checkOrientation && X.revokeObjectURL(k.src), p)
|
|
472
|
-
if (g.strict && p.size > m.size && g.mimeType === m.type && !(g.width > l || g.height > d || g.minWidth > l || g.minHeight > d || g.maxWidth < l || g.maxHeight < d))
|
|
473
|
-
p = m;
|
|
474
|
-
else {
|
|
475
|
-
var b = /* @__PURE__ */ new Date();
|
|
476
|
-
p.lastModified = b.getTime(), p.lastModifiedDate = b, p.name = m.name, p.name && p.type !== m.type && (p.name = p.name.replace(Ke, Le(p.type)));
|
|
477
|
-
}
|
|
478
|
-
else
|
|
479
|
-
p = m;
|
|
480
|
-
this.result = p, g.success && g.success.call(this, p);
|
|
481
|
-
}
|
|
482
|
-
}, {
|
|
483
|
-
key: "fail",
|
|
484
|
-
value: function(a) {
|
|
485
|
-
var l = this.options;
|
|
486
|
-
if (l.error)
|
|
487
|
-
l.error.call(this, a);
|
|
488
|
-
else
|
|
489
|
-
throw a;
|
|
490
|
-
}
|
|
491
|
-
}, {
|
|
492
|
-
key: "abort",
|
|
493
|
-
value: function() {
|
|
494
|
-
this.aborted || (this.aborted = !0, this.reader ? this.reader.abort() : this.image.complete ? this.fail(new Error("The compression process has been aborted.")) : (this.image.onload = null, this.image.onabort()));
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Get the no conflict compressor class.
|
|
498
|
-
* @returns {Compressor} The compressor class.
|
|
499
|
-
*/
|
|
500
|
-
}], [{
|
|
501
|
-
key: "noConflict",
|
|
502
|
-
value: function() {
|
|
503
|
-
return window.Compressor = Je, s;
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Change the default options.
|
|
507
|
-
* @param {Object} options - The new default options.
|
|
508
|
-
*/
|
|
509
|
-
}, {
|
|
510
|
-
key: "setDefaults",
|
|
511
|
-
value: function(a) {
|
|
512
|
-
fe(ke, a);
|
|
513
|
-
}
|
|
514
|
-
}]), s;
|
|
515
|
-
}(), we = { exports: {} };
|
|
516
|
-
/*!
|
|
517
|
-
* Name: vue-upload-component
|
|
518
|
-
* Version: 2.8.21
|
|
519
|
-
* Author: Marco Lang
|
|
520
|
-
*/
|
|
521
|
-
(function(s, n) {
|
|
522
|
-
(function(a, l) {
|
|
523
|
-
s.exports = l();
|
|
524
|
-
})(Ue, function() {
|
|
525
|
-
var a = function(t) {
|
|
526
|
-
var r = new XMLHttpRequest();
|
|
527
|
-
return r.open(t.method || "GET", t.url), r.responseType = "json", t.headers && Object.keys(t.headers).forEach(function(i) {
|
|
528
|
-
r.setRequestHeader(i, t.headers[i]);
|
|
529
|
-
}), r;
|
|
530
|
-
}, l = function(t, r) {
|
|
531
|
-
return new Promise(function(i, u) {
|
|
532
|
-
t.onload = function() {
|
|
533
|
-
if (t.status >= 200 && t.status < 300) {
|
|
534
|
-
var o;
|
|
535
|
-
try {
|
|
536
|
-
o = JSON.parse(t.response);
|
|
537
|
-
} catch {
|
|
538
|
-
o = t.response;
|
|
539
|
-
}
|
|
540
|
-
i(o);
|
|
541
|
-
} else
|
|
542
|
-
u(t.response);
|
|
543
|
-
}, t.onerror = function() {
|
|
544
|
-
return u(t.response);
|
|
545
|
-
}, t.send(JSON.stringify(r));
|
|
546
|
-
});
|
|
547
|
-
}, d = function(t, r) {
|
|
548
|
-
var i = new FormData();
|
|
549
|
-
for (var u in r)
|
|
550
|
-
i.append(u, r[u]);
|
|
551
|
-
return new Promise(function(o, h) {
|
|
552
|
-
t.onload = function() {
|
|
553
|
-
if (t.status >= 200 && t.status < 300) {
|
|
554
|
-
var c;
|
|
555
|
-
try {
|
|
556
|
-
c = JSON.parse(t.response);
|
|
557
|
-
} catch {
|
|
558
|
-
c = t.response;
|
|
559
|
-
}
|
|
560
|
-
o(c);
|
|
561
|
-
} else
|
|
562
|
-
h(t.response);
|
|
563
|
-
}, t.onerror = function() {
|
|
564
|
-
return h(t.response);
|
|
565
|
-
}, t.send(i);
|
|
566
|
-
});
|
|
567
|
-
};
|
|
568
|
-
function p(f) {
|
|
569
|
-
var t = a(f);
|
|
570
|
-
return l(t, f.body);
|
|
571
|
-
}
|
|
572
|
-
var m = /* @__PURE__ */ function() {
|
|
573
|
-
function f(t, r) {
|
|
574
|
-
for (var i = 0; i < r.length; i++) {
|
|
575
|
-
var u = r[i];
|
|
576
|
-
u.enumerable = u.enumerable || !1, u.configurable = !0, "value" in u && (u.writable = !0), Object.defineProperty(t, u.key, u);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
return function(t, r, i) {
|
|
580
|
-
return r && f(t.prototype, r), i && f(t, i), t;
|
|
581
|
-
};
|
|
582
|
-
}();
|
|
583
|
-
function k(f, t) {
|
|
584
|
-
if (!(f instanceof t))
|
|
585
|
-
throw new TypeError("Cannot call a class as a function");
|
|
586
|
-
}
|
|
587
|
-
var g = function() {
|
|
588
|
-
function f(t, r) {
|
|
589
|
-
k(this, f), this.file = t, this.options = r, this.chunks = [], this.sessionId = null, this.chunkSize = null, this.speedInterval = null;
|
|
590
|
-
}
|
|
591
|
-
return m(f, [{
|
|
592
|
-
key: "createChunks",
|
|
593
|
-
/**
|
|
594
|
-
* Creates all the chunks in the initial state
|
|
595
|
-
*/
|
|
596
|
-
value: function() {
|
|
597
|
-
this.chunks = [];
|
|
598
|
-
for (var r = 0, i = this.chunkSize; r < this.fileSize; )
|
|
599
|
-
this.chunks.push({
|
|
600
|
-
blob: this.file.file.slice(r, i),
|
|
601
|
-
startOffset: r,
|
|
602
|
-
active: !1,
|
|
603
|
-
retries: this.maxRetries
|
|
604
|
-
}), r = i, i = r + this.chunkSize;
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Updates the progress of the file with the handler's progress
|
|
608
|
-
*/
|
|
609
|
-
}, {
|
|
610
|
-
key: "updateFileProgress",
|
|
611
|
-
value: function() {
|
|
612
|
-
this.file.progress = this.progress;
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* Paues the upload process
|
|
616
|
-
* - Stops all active requests
|
|
617
|
-
* - Sets the file not active
|
|
618
|
-
*/
|
|
619
|
-
}, {
|
|
620
|
-
key: "pause",
|
|
621
|
-
value: function() {
|
|
622
|
-
this.file.active = !1, this.stopChunks();
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Stops all the current chunks
|
|
626
|
-
*/
|
|
627
|
-
}, {
|
|
628
|
-
key: "stopChunks",
|
|
629
|
-
value: function() {
|
|
630
|
-
this.chunksUploading.forEach(function(r) {
|
|
631
|
-
r.xhr.abort(), r.active = !1;
|
|
632
|
-
}), this.stopSpeedCalc();
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Resumes the file upload
|
|
636
|
-
* - Sets the file active
|
|
637
|
-
* - Starts the following chunks
|
|
638
|
-
*/
|
|
639
|
-
}, {
|
|
640
|
-
key: "resume",
|
|
641
|
-
value: function() {
|
|
642
|
-
this.file.active = !0, this.startChunking();
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Starts the file upload
|
|
646
|
-
*
|
|
647
|
-
* @returns Promise
|
|
648
|
-
* - resolve The file was uploaded
|
|
649
|
-
* - reject The file upload failed
|
|
650
|
-
*/
|
|
651
|
-
}, {
|
|
652
|
-
key: "upload",
|
|
653
|
-
value: function() {
|
|
654
|
-
var r = this;
|
|
655
|
-
return this.promise = new Promise(function(i, u) {
|
|
656
|
-
r.resolve = i, r.reject = u;
|
|
657
|
-
}), this.start(), this.promise;
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Start phase
|
|
661
|
-
* Sends a request to the backend to initialise the chunks
|
|
662
|
-
*/
|
|
663
|
-
}, {
|
|
664
|
-
key: "start",
|
|
665
|
-
value: function() {
|
|
666
|
-
var r = this;
|
|
667
|
-
p({
|
|
668
|
-
method: "POST",
|
|
669
|
-
headers: Object.assign({}, this.headers, {
|
|
670
|
-
"Content-Type": "application/json"
|
|
671
|
-
}),
|
|
672
|
-
url: this.action,
|
|
673
|
-
body: Object.assign(this.startBody, {
|
|
674
|
-
phase: "start",
|
|
675
|
-
mime_type: this.fileType,
|
|
676
|
-
size: this.fileSize,
|
|
677
|
-
name: this.fileName
|
|
678
|
-
})
|
|
679
|
-
}).then(function(i) {
|
|
680
|
-
if (i.status !== "success")
|
|
681
|
-
return r.file.response = i, r.reject("server");
|
|
682
|
-
r.sessionId = i.data.session_id, r.chunkSize = i.data.end_offset, r.createChunks(), r.startChunking();
|
|
683
|
-
}).catch(function(i) {
|
|
684
|
-
r.file.response = i, r.reject("server");
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Starts to upload chunks
|
|
689
|
-
*/
|
|
690
|
-
}, {
|
|
691
|
-
key: "startChunking",
|
|
692
|
-
value: function() {
|
|
693
|
-
for (var r = 0; r < this.maxActiveChunks; r++)
|
|
694
|
-
this.uploadNextChunk();
|
|
695
|
-
this.startSpeedCalc();
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Uploads the next chunk
|
|
699
|
-
* - Won't do anything if the process is paused
|
|
700
|
-
* - Will start finish phase if there are no more chunks to upload
|
|
701
|
-
*/
|
|
702
|
-
}, {
|
|
703
|
-
key: "uploadNextChunk",
|
|
704
|
-
value: function() {
|
|
705
|
-
if (this.file.active) {
|
|
706
|
-
if (this.hasChunksToUpload)
|
|
707
|
-
return this.uploadChunk(this.chunksToUpload[0]);
|
|
708
|
-
if (this.chunksUploading.length === 0)
|
|
709
|
-
return this.finish();
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Uploads a chunk
|
|
714
|
-
* - Sends the chunk to the backend
|
|
715
|
-
* - Sets the chunk as uploaded if everything went well
|
|
716
|
-
* - Decreases the number of retries if anything went wrong
|
|
717
|
-
* - Fails if there are no more retries
|
|
718
|
-
*
|
|
719
|
-
* @param {Object} chunk
|
|
720
|
-
*/
|
|
721
|
-
}, {
|
|
722
|
-
key: "uploadChunk",
|
|
723
|
-
value: function(r) {
|
|
724
|
-
var i = this;
|
|
725
|
-
r.progress = 0, r.active = !0, this.updateFileProgress(), r.xhr = a({
|
|
726
|
-
method: "POST",
|
|
727
|
-
headers: this.headers,
|
|
728
|
-
url: this.action
|
|
729
|
-
}), r.xhr.upload.addEventListener("progress", function(u) {
|
|
730
|
-
u.lengthComputable && (r.progress = Math.round(u.loaded / u.total * 100));
|
|
731
|
-
}, !1), d(r.xhr, Object.assign(this.uploadBody, {
|
|
732
|
-
phase: "upload",
|
|
733
|
-
session_id: this.sessionId,
|
|
734
|
-
start_offset: r.startOffset,
|
|
735
|
-
chunk: r.blob
|
|
736
|
-
})).then(function(u) {
|
|
737
|
-
if (r.active = !1, u.status === "success")
|
|
738
|
-
r.uploaded = !0;
|
|
739
|
-
else if (r.retries-- <= 0)
|
|
740
|
-
return i.stopChunks(), i.reject("upload");
|
|
741
|
-
i.uploadNextChunk();
|
|
742
|
-
}).catch(function() {
|
|
743
|
-
if (r.active = !1, r.retries-- <= 0)
|
|
744
|
-
return i.stopChunks(), i.reject("upload");
|
|
745
|
-
i.uploadNextChunk();
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Finish phase
|
|
750
|
-
* Sends a request to the backend to finish the process
|
|
751
|
-
*/
|
|
752
|
-
}, {
|
|
753
|
-
key: "finish",
|
|
754
|
-
value: function() {
|
|
755
|
-
var r = this;
|
|
756
|
-
this.updateFileProgress(), this.stopSpeedCalc(), p({
|
|
757
|
-
method: "POST",
|
|
758
|
-
headers: Object.assign({}, this.headers, {
|
|
759
|
-
"Content-Type": "application/json"
|
|
760
|
-
}),
|
|
761
|
-
url: this.action,
|
|
762
|
-
body: Object.assign(this.finishBody, {
|
|
763
|
-
phase: "finish",
|
|
764
|
-
session_id: this.sessionId
|
|
765
|
-
})
|
|
766
|
-
}).then(function(i) {
|
|
767
|
-
if (r.file.response = i, i.status !== "success")
|
|
768
|
-
return r.reject("server");
|
|
769
|
-
r.resolve(i);
|
|
770
|
-
}).catch(function(i) {
|
|
771
|
-
r.file.response = i, r.reject("server");
|
|
772
|
-
});
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Sets an interval to calculate and
|
|
776
|
-
* set upload speed every 3 seconds
|
|
777
|
-
*/
|
|
778
|
-
}, {
|
|
779
|
-
key: "startSpeedCalc",
|
|
780
|
-
value: function() {
|
|
781
|
-
var r = this;
|
|
782
|
-
this.file.speed = 0;
|
|
783
|
-
var i = 0;
|
|
784
|
-
this.speedInterval || (this.speedInterval = window.setInterval(function() {
|
|
785
|
-
var u = r.progress / 100 * r.fileSize;
|
|
786
|
-
r.file.speed = u - i, i = u;
|
|
787
|
-
}, 1e3));
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Removes the upload speed interval
|
|
791
|
-
*/
|
|
792
|
-
}, {
|
|
793
|
-
key: "stopSpeedCalc",
|
|
794
|
-
value: function() {
|
|
795
|
-
this.speedInterval && window.clearInterval(this.speedInterval), this.speedInterval = null, this.file.speed = 0;
|
|
796
|
-
}
|
|
797
|
-
}, {
|
|
798
|
-
key: "maxRetries",
|
|
799
|
-
get: function() {
|
|
800
|
-
return parseInt(this.options.maxRetries, 10);
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Gets the max number of active chunks being uploaded at once from options
|
|
804
|
-
*/
|
|
805
|
-
}, {
|
|
806
|
-
key: "maxActiveChunks",
|
|
807
|
-
get: function() {
|
|
808
|
-
return parseInt(this.options.maxActive, 10);
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* Gets the file type
|
|
812
|
-
*/
|
|
813
|
-
}, {
|
|
814
|
-
key: "fileType",
|
|
815
|
-
get: function() {
|
|
816
|
-
return this.file.type;
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Gets the file size
|
|
820
|
-
*/
|
|
821
|
-
}, {
|
|
822
|
-
key: "fileSize",
|
|
823
|
-
get: function() {
|
|
824
|
-
return this.file.size;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Gets the file name
|
|
828
|
-
*/
|
|
829
|
-
}, {
|
|
830
|
-
key: "fileName",
|
|
831
|
-
get: function() {
|
|
832
|
-
return this.file.name;
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Gets action (url) to upload the file
|
|
836
|
-
*/
|
|
837
|
-
}, {
|
|
838
|
-
key: "action",
|
|
839
|
-
get: function() {
|
|
840
|
-
return this.options.action || null;
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* Gets the body to be merged when sending the request in start phase
|
|
844
|
-
*/
|
|
845
|
-
}, {
|
|
846
|
-
key: "startBody",
|
|
847
|
-
get: function() {
|
|
848
|
-
return this.options.startBody || {};
|
|
849
|
-
}
|
|
850
|
-
/**
|
|
851
|
-
* Gets the body to be merged when sending the request in upload phase
|
|
852
|
-
*/
|
|
853
|
-
}, {
|
|
854
|
-
key: "uploadBody",
|
|
855
|
-
get: function() {
|
|
856
|
-
return this.options.uploadBody || {};
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* Gets the body to be merged when sending the request in finish phase
|
|
860
|
-
*/
|
|
861
|
-
}, {
|
|
862
|
-
key: "finishBody",
|
|
863
|
-
get: function() {
|
|
864
|
-
return this.options.finishBody || {};
|
|
865
|
-
}
|
|
866
|
-
/**
|
|
867
|
-
* Gets the headers of the requests from options
|
|
868
|
-
*/
|
|
869
|
-
}, {
|
|
870
|
-
key: "headers",
|
|
871
|
-
get: function() {
|
|
872
|
-
return this.options.headers || {};
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* Whether it's ready to upload files or not
|
|
876
|
-
*/
|
|
877
|
-
}, {
|
|
878
|
-
key: "readyToUpload",
|
|
879
|
-
get: function() {
|
|
880
|
-
return !!this.chunks;
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Gets the progress of the chunk upload
|
|
884
|
-
* - Gets all the completed chunks
|
|
885
|
-
* - Gets the progress of all the chunks that are being uploaded
|
|
886
|
-
*/
|
|
887
|
-
}, {
|
|
888
|
-
key: "progress",
|
|
889
|
-
get: function() {
|
|
890
|
-
var r = this, i = this.chunksUploaded.length / this.chunks.length * 100, u = this.chunksUploading.reduce(function(o, h) {
|
|
891
|
-
return o + (h.progress | 0) / r.chunks.length;
|
|
892
|
-
}, 0);
|
|
893
|
-
return Math.min(i + u, 100);
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* Gets all the chunks that are pending to be uploaded
|
|
897
|
-
*/
|
|
898
|
-
}, {
|
|
899
|
-
key: "chunksToUpload",
|
|
900
|
-
get: function() {
|
|
901
|
-
return this.chunks.filter(function(r) {
|
|
902
|
-
return !r.active && !r.uploaded;
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Whether there are chunks to upload or not
|
|
907
|
-
*/
|
|
908
|
-
}, {
|
|
909
|
-
key: "hasChunksToUpload",
|
|
910
|
-
get: function() {
|
|
911
|
-
return this.chunksToUpload.length > 0;
|
|
912
|
-
}
|
|
913
|
-
/**
|
|
914
|
-
* Gets all the chunks that are uploading
|
|
915
|
-
*/
|
|
916
|
-
}, {
|
|
917
|
-
key: "chunksUploading",
|
|
918
|
-
get: function() {
|
|
919
|
-
return this.chunks.filter(function(r) {
|
|
920
|
-
return !!r.xhr && !!r.active;
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Gets all the chunks that have finished uploading
|
|
925
|
-
*/
|
|
926
|
-
}, {
|
|
927
|
-
key: "chunksUploaded",
|
|
928
|
-
get: function() {
|
|
929
|
-
return this.chunks.filter(function(r) {
|
|
930
|
-
return !!r.uploaded;
|
|
931
|
-
});
|
|
932
|
-
}
|
|
933
|
-
}]), f;
|
|
934
|
-
}(), b = {
|
|
935
|
-
methods: {
|
|
936
|
-
change: function(t) {
|
|
937
|
-
this.$parent.addInputFile(t.target), t.target.files ? (t.target.value = "", t.target.files.length && !/safari/i.test(navigator.userAgent) && (t.target.type = "", t.target.type = "file")) : (this.$destroy(), new this.constructor({
|
|
938
|
-
parent: this.$parent,
|
|
939
|
-
el: this.$el
|
|
940
|
-
}));
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
|
-
function w(f, t, r, i, u, o, h, c, x, C) {
|
|
945
|
-
typeof h != "boolean" && (x = c, c = h, h = !1);
|
|
946
|
-
var _ = typeof r == "function" ? r.options : r;
|
|
947
|
-
f && f.render && (_.render = f.render, _.staticRenderFns = f.staticRenderFns, _._compiled = !0, u && (_.functional = !0)), i && (_._scopeId = i);
|
|
948
|
-
var O;
|
|
949
|
-
if (o ? (O = function(R) {
|
|
950
|
-
R = R || // cached call
|
|
951
|
-
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
952
|
-
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !R && typeof __VUE_SSR_CONTEXT__ < "u" && (R = __VUE_SSR_CONTEXT__), t && t.call(this, x(R)), R && R._registeredComponents && R._registeredComponents.add(o);
|
|
953
|
-
}, _._ssrRegister = O) : t && (O = h ? function() {
|
|
954
|
-
t.call(this, C(this.$root.$options.shadowRoot));
|
|
955
|
-
} : function(P) {
|
|
956
|
-
t.call(this, c(P));
|
|
957
|
-
}), O)
|
|
958
|
-
if (_.functional) {
|
|
959
|
-
var y = _.render;
|
|
960
|
-
_.render = function(R, j) {
|
|
961
|
-
return O.call(j), y(R, j);
|
|
962
|
-
};
|
|
963
|
-
} else {
|
|
964
|
-
var E = _.beforeCreate;
|
|
965
|
-
_.beforeCreate = E ? [].concat(E, O) : [O];
|
|
966
|
-
}
|
|
967
|
-
return r;
|
|
968
|
-
}
|
|
969
|
-
var A = w, B = b, T = function() {
|
|
970
|
-
var t = this, r = t.$createElement, i = t._self._c || r;
|
|
971
|
-
return i("input", { attrs: { type: "file", name: t.$parent.name, id: t.$parent.inputId || t.$parent.name, accept: t.$parent.accept, capture: t.$parent.capture, disabled: t.$parent.disabled, webkitdirectory: t.$parent.directory && t.$parent.features.directory, directory: t.$parent.directory && t.$parent.features.directory, multiple: t.$parent.multiple && t.$parent.features.html5 }, on: { change: t.change } });
|
|
972
|
-
}, v = [], S = void 0, U = void 0, H = void 0, G = !1, F = A({ render: T, staticRenderFns: v }, S, B, U, G, H, void 0, void 0), I = Object.assign || function(f) {
|
|
973
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
974
|
-
var r = arguments[t];
|
|
975
|
-
for (var i in r)
|
|
976
|
-
Object.prototype.hasOwnProperty.call(r, i) && (f[i] = r[i]);
|
|
977
|
-
}
|
|
978
|
-
return f;
|
|
979
|
-
}, z = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(f) {
|
|
980
|
-
return typeof f;
|
|
981
|
-
} : function(f) {
|
|
982
|
-
return f && typeof Symbol == "function" && f.constructor === Symbol && f !== Symbol.prototype ? "symbol" : typeof f;
|
|
983
|
-
};
|
|
984
|
-
function W(f) {
|
|
985
|
-
if (Array.isArray(f)) {
|
|
986
|
-
for (var t = 0, r = Array(f.length); t < f.length; t++)
|
|
987
|
-
r[t] = f[t];
|
|
988
|
-
return r;
|
|
989
|
-
} else
|
|
990
|
-
return Array.from(f);
|
|
991
|
-
}
|
|
992
|
-
var L = {
|
|
993
|
-
headers: {},
|
|
994
|
-
action: "",
|
|
995
|
-
minSize: 1048576,
|
|
996
|
-
maxActive: 3,
|
|
997
|
-
maxRetries: 5,
|
|
998
|
-
handler: g
|
|
999
|
-
}, D = {
|
|
1000
|
-
components: {
|
|
1001
|
-
InputFile: F
|
|
1002
|
-
},
|
|
1003
|
-
props: {
|
|
1004
|
-
inputId: {
|
|
1005
|
-
type: String
|
|
1006
|
-
},
|
|
1007
|
-
name: {
|
|
1008
|
-
type: String,
|
|
1009
|
-
default: "file"
|
|
1010
|
-
},
|
|
1011
|
-
accept: {
|
|
1012
|
-
type: String
|
|
1013
|
-
},
|
|
1014
|
-
capture: {},
|
|
1015
|
-
disabled: {},
|
|
1016
|
-
multiple: {
|
|
1017
|
-
type: Boolean
|
|
1018
|
-
},
|
|
1019
|
-
maximum: {
|
|
1020
|
-
type: Number,
|
|
1021
|
-
default: function() {
|
|
1022
|
-
return this.multiple ? 0 : 1;
|
|
1023
|
-
}
|
|
1024
|
-
},
|
|
1025
|
-
addIndex: {
|
|
1026
|
-
type: [Boolean, Number]
|
|
1027
|
-
},
|
|
1028
|
-
directory: {
|
|
1029
|
-
type: Boolean
|
|
1030
|
-
},
|
|
1031
|
-
postAction: {
|
|
1032
|
-
type: String
|
|
1033
|
-
},
|
|
1034
|
-
putAction: {
|
|
1035
|
-
type: String
|
|
1036
|
-
},
|
|
1037
|
-
customAction: {
|
|
1038
|
-
type: Function
|
|
1039
|
-
},
|
|
1040
|
-
headers: {
|
|
1041
|
-
type: Object,
|
|
1042
|
-
default: Object
|
|
1043
|
-
},
|
|
1044
|
-
data: {
|
|
1045
|
-
type: Object,
|
|
1046
|
-
default: Object
|
|
1047
|
-
},
|
|
1048
|
-
timeout: {
|
|
1049
|
-
type: Number,
|
|
1050
|
-
default: 0
|
|
1051
|
-
},
|
|
1052
|
-
drop: {
|
|
1053
|
-
default: !1
|
|
1054
|
-
},
|
|
1055
|
-
dropDirectory: {
|
|
1056
|
-
type: Boolean,
|
|
1057
|
-
default: !0
|
|
1058
|
-
},
|
|
1059
|
-
size: {
|
|
1060
|
-
type: Number,
|
|
1061
|
-
default: 0
|
|
1062
|
-
},
|
|
1063
|
-
extensions: {
|
|
1064
|
-
default: Array
|
|
1065
|
-
},
|
|
1066
|
-
value: {
|
|
1067
|
-
type: Array,
|
|
1068
|
-
default: Array
|
|
1069
|
-
},
|
|
1070
|
-
thread: {
|
|
1071
|
-
type: Number,
|
|
1072
|
-
default: 1
|
|
1073
|
-
},
|
|
1074
|
-
// Chunk upload enabled
|
|
1075
|
-
chunkEnabled: {
|
|
1076
|
-
type: Boolean,
|
|
1077
|
-
default: !1
|
|
1078
|
-
},
|
|
1079
|
-
// Chunk upload properties
|
|
1080
|
-
chunk: {
|
|
1081
|
-
type: Object,
|
|
1082
|
-
default: function() {
|
|
1083
|
-
return L;
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
},
|
|
1087
|
-
data: function() {
|
|
1088
|
-
return {
|
|
1089
|
-
files: this.value,
|
|
1090
|
-
features: {
|
|
1091
|
-
html5: !0,
|
|
1092
|
-
directory: !1,
|
|
1093
|
-
drop: !1
|
|
1094
|
-
},
|
|
1095
|
-
active: !1,
|
|
1096
|
-
dropActive: !1,
|
|
1097
|
-
uploading: 0,
|
|
1098
|
-
destroy: !1
|
|
1099
|
-
};
|
|
1100
|
-
},
|
|
1101
|
-
/**
|
|
1102
|
-
* mounted
|
|
1103
|
-
* @return {[type]} [description]
|
|
1104
|
-
*/
|
|
1105
|
-
mounted: function() {
|
|
1106
|
-
var t = document.createElement("input");
|
|
1107
|
-
if (t.type = "file", t.multiple = !0, window.FormData && t.files ? ((typeof t.webkitdirectory == "boolean" || typeof t.directory == "boolean") && (this.features.directory = !0), this.features.html5 && typeof t.ondrop < "u" && (this.features.drop = !0)) : this.features.html5 = !1, this.maps = {}, this.files)
|
|
1108
|
-
for (var r = 0; r < this.files.length; r++) {
|
|
1109
|
-
var i = this.files[r];
|
|
1110
|
-
this.maps[i.id] = i;
|
|
1111
|
-
}
|
|
1112
|
-
this.$nextTick(function() {
|
|
1113
|
-
var u = this;
|
|
1114
|
-
this.$parent ? (this.$parent.$forceUpdate(), this.$parent.$nextTick(function() {
|
|
1115
|
-
u.watchDrop(u.drop);
|
|
1116
|
-
})) : this.watchDrop(this.drop);
|
|
1117
|
-
});
|
|
1118
|
-
},
|
|
1119
|
-
/**
|
|
1120
|
-
* beforeDestroy
|
|
1121
|
-
* @return {[type]} [description]
|
|
1122
|
-
*/
|
|
1123
|
-
beforeDestroy: function() {
|
|
1124
|
-
this.destroy = !0, this.active = !1, this.watchDrop(!1);
|
|
1125
|
-
},
|
|
1126
|
-
computed: {
|
|
1127
|
-
/**
|
|
1128
|
-
* uploading 正在上传的线程
|
|
1129
|
-
* @return {[type]} [description]
|
|
1130
|
-
*/
|
|
1131
|
-
/**
|
|
1132
|
-
* uploaded 文件列表是否全部已上传
|
|
1133
|
-
* @return {[type]} [description]
|
|
1134
|
-
*/
|
|
1135
|
-
uploaded: function() {
|
|
1136
|
-
for (var t = void 0, r = 0; r < this.files.length; r++)
|
|
1137
|
-
if (t = this.files[r], t.fileObject && !t.error && !t.success)
|
|
1138
|
-
return !1;
|
|
1139
|
-
return !0;
|
|
1140
|
-
},
|
|
1141
|
-
chunkOptions: function() {
|
|
1142
|
-
return Object.assign(L, this.chunk);
|
|
1143
|
-
},
|
|
1144
|
-
className: function() {
|
|
1145
|
-
return ["file-uploads", this.features.html5 ? "file-uploads-html5" : "file-uploads-html4", this.features.directory && this.directory ? "file-uploads-directory" : void 0, this.features.drop && this.drop ? "file-uploads-drop" : void 0, this.disabled ? "file-uploads-disabled" : void 0];
|
|
1146
|
-
}
|
|
1147
|
-
},
|
|
1148
|
-
watch: {
|
|
1149
|
-
active: function(t) {
|
|
1150
|
-
this.watchActive(t);
|
|
1151
|
-
},
|
|
1152
|
-
dropActive: function() {
|
|
1153
|
-
this.$parent && this.$parent.$forceUpdate();
|
|
1154
|
-
},
|
|
1155
|
-
drop: function(t) {
|
|
1156
|
-
this.watchDrop(t);
|
|
1157
|
-
},
|
|
1158
|
-
value: function(t) {
|
|
1159
|
-
if (this.files !== t) {
|
|
1160
|
-
this.files = t;
|
|
1161
|
-
var r = this.maps;
|
|
1162
|
-
this.maps = {};
|
|
1163
|
-
for (var i = 0; i < this.files.length; i++) {
|
|
1164
|
-
var u = this.files[i];
|
|
1165
|
-
this.maps[u.id] = u;
|
|
1166
|
-
}
|
|
1167
|
-
for (var o in this.maps) {
|
|
1168
|
-
var h = this.maps[o], c = r[o];
|
|
1169
|
-
h !== c && this.emitFile(h, c);
|
|
1170
|
-
}
|
|
1171
|
-
for (var x in r)
|
|
1172
|
-
this.maps[x] || this.emitFile(void 0, r[x]);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
},
|
|
1176
|
-
methods: {
|
|
1177
|
-
// 清空
|
|
1178
|
-
clear: function() {
|
|
1179
|
-
if (this.files.length) {
|
|
1180
|
-
var t = this.files;
|
|
1181
|
-
this.files = [], this.maps = {}, this.emitInput();
|
|
1182
|
-
for (var r = 0; r < t.length; r++)
|
|
1183
|
-
this.emitFile(void 0, t[r]);
|
|
1184
|
-
}
|
|
1185
|
-
return !0;
|
|
1186
|
-
},
|
|
1187
|
-
// 选择
|
|
1188
|
-
get: function(t) {
|
|
1189
|
-
return t ? (typeof t > "u" ? "undefined" : z(t)) === "object" ? this.maps[t.id] || !1 : this.maps[t] || !1 : !1;
|
|
1190
|
-
},
|
|
1191
|
-
// 添加
|
|
1192
|
-
add: function(t) {
|
|
1193
|
-
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.addIndex, i = t, u = i instanceof Array;
|
|
1194
|
-
u || (i = [i]);
|
|
1195
|
-
for (var o = [], h = 0; h < i.length; h++) {
|
|
1196
|
-
var c = i[h];
|
|
1197
|
-
this.features.html5 && c instanceof Blob && (c = {
|
|
1198
|
-
file: c,
|
|
1199
|
-
size: c.size,
|
|
1200
|
-
name: c.webkitRelativePath || c.relativePath || c.name || "unknown",
|
|
1201
|
-
type: c.type
|
|
1202
|
-
});
|
|
1203
|
-
var x = !1;
|
|
1204
|
-
if (c.fileObject === !1 || (c.fileObject || typeof Element < "u" && c.el instanceof Element || typeof Blob < "u" && c.file instanceof Blob) && (x = !0), x && (c = I({
|
|
1205
|
-
fileObject: !0,
|
|
1206
|
-
size: -1,
|
|
1207
|
-
name: "Filename",
|
|
1208
|
-
type: "",
|
|
1209
|
-
active: !1,
|
|
1210
|
-
error: "",
|
|
1211
|
-
success: !1,
|
|
1212
|
-
putAction: this.putAction,
|
|
1213
|
-
postAction: this.postAction,
|
|
1214
|
-
timeout: this.timeout
|
|
1215
|
-
}, c, {
|
|
1216
|
-
response: {},
|
|
1217
|
-
progress: "0.00",
|
|
1218
|
-
// 只读
|
|
1219
|
-
speed: 0
|
|
1220
|
-
// 只读
|
|
1221
|
-
// xhr: false, // 只读
|
|
1222
|
-
// iframe: false, // 只读
|
|
1223
|
-
}), c.data = I({}, this.data, c.data ? c.data : {}), c.headers = I({}, this.headers, c.headers ? c.headers : {})), c.id || (c.id = Math.random().toString(36).substr(2)), !this.emitFilter(c, void 0) && (this.maximum > 1 && o.length + this.files.length >= this.maximum || (o.push(c), this.maximum === 1)))
|
|
1224
|
-
break;
|
|
1225
|
-
}
|
|
1226
|
-
if (!o.length)
|
|
1227
|
-
return !1;
|
|
1228
|
-
this.maximum === 1 && this.clear();
|
|
1229
|
-
var C = void 0;
|
|
1230
|
-
if (r === !0 || r === 0)
|
|
1231
|
-
C = o.concat(this.files);
|
|
1232
|
-
else if (r) {
|
|
1233
|
-
var _;
|
|
1234
|
-
C = this.files.concat([]), (_ = C).splice.apply(_, [r, 0].concat(o));
|
|
1235
|
-
} else
|
|
1236
|
-
C = this.files.concat(o);
|
|
1237
|
-
this.files = C;
|
|
1238
|
-
for (var O = 0; O < o.length; O++) {
|
|
1239
|
-
var y = o[O];
|
|
1240
|
-
this.maps[y.id] = y;
|
|
1241
|
-
}
|
|
1242
|
-
this.emitInput();
|
|
1243
|
-
for (var E = 0; E < o.length; E++)
|
|
1244
|
-
this.emitFile(o[E], void 0);
|
|
1245
|
-
return u ? o : o[0];
|
|
1246
|
-
},
|
|
1247
|
-
// 添加表单文件
|
|
1248
|
-
addInputFile: function(t) {
|
|
1249
|
-
var r = [];
|
|
1250
|
-
if (t.files)
|
|
1251
|
-
for (var i = 0; i < t.files.length; i++) {
|
|
1252
|
-
var u = t.files[i];
|
|
1253
|
-
r.push({
|
|
1254
|
-
size: u.size,
|
|
1255
|
-
name: u.webkitRelativePath || u.relativePath || u.name,
|
|
1256
|
-
type: u.type,
|
|
1257
|
-
file: u
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
else {
|
|
1261
|
-
var o = t.value.replace(/\\/g, "/").split("/");
|
|
1262
|
-
delete t.__vuex__, r.push({
|
|
1263
|
-
name: o[o.length - 1],
|
|
1264
|
-
el: t
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
return this.add(r);
|
|
1268
|
-
},
|
|
1269
|
-
// 添加 DataTransfer
|
|
1270
|
-
addDataTransfer: function(t) {
|
|
1271
|
-
var r = this, i = [];
|
|
1272
|
-
if (t.items && t.items.length) {
|
|
1273
|
-
for (var u = [], o = 0; o < t.items.length; o++) {
|
|
1274
|
-
var h = t.items[o];
|
|
1275
|
-
h.getAsEntry ? h = h.getAsEntry() || h.getAsFile() : h.webkitGetAsEntry ? h = h.webkitGetAsEntry() || h.getAsFile() : h = h.getAsFile(), h && u.push(h);
|
|
1276
|
-
}
|
|
1277
|
-
return new Promise(function(x, C) {
|
|
1278
|
-
var _ = function O(y) {
|
|
1279
|
-
var E = u[y];
|
|
1280
|
-
if (!E || r.maximum > 0 && i.length >= r.maximum)
|
|
1281
|
-
return x(r.add(i));
|
|
1282
|
-
r.getEntry(E).then(function(P) {
|
|
1283
|
-
i.push.apply(i, W(P)), O(y + 1);
|
|
1284
|
-
});
|
|
1285
|
-
};
|
|
1286
|
-
_(0);
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
if (t.files.length) {
|
|
1290
|
-
for (var c = 0; c < t.files.length && (i.push(t.files[c]), !(this.maximum > 0 && i.length >= this.maximum)); c++)
|
|
1291
|
-
;
|
|
1292
|
-
return Promise.resolve(this.add(i));
|
|
1293
|
-
}
|
|
1294
|
-
return Promise.resolve([]);
|
|
1295
|
-
},
|
|
1296
|
-
// 获得 entry
|
|
1297
|
-
getEntry: function(t) {
|
|
1298
|
-
var r = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
1299
|
-
return new Promise(function(u, o) {
|
|
1300
|
-
if (t.isFile)
|
|
1301
|
-
t.file(function(C) {
|
|
1302
|
-
u([{
|
|
1303
|
-
size: C.size,
|
|
1304
|
-
name: i + C.name,
|
|
1305
|
-
type: C.type,
|
|
1306
|
-
file: C
|
|
1307
|
-
}]);
|
|
1308
|
-
});
|
|
1309
|
-
else if (t.isDirectory && r.dropDirectory) {
|
|
1310
|
-
var h = [], c = t.createReader(), x = function C() {
|
|
1311
|
-
c.readEntries(function(_) {
|
|
1312
|
-
var O = function y(E) {
|
|
1313
|
-
if (!_[E] && E === 0 || r.maximum > 0 && h.length >= r.maximum)
|
|
1314
|
-
return u(h);
|
|
1315
|
-
if (!_[E])
|
|
1316
|
-
return C();
|
|
1317
|
-
r.getEntry(_[E], i + t.name + "/").then(function(P) {
|
|
1318
|
-
h.push.apply(h, W(P)), y(E + 1);
|
|
1319
|
-
});
|
|
1320
|
-
};
|
|
1321
|
-
O(0);
|
|
1322
|
-
});
|
|
1323
|
-
};
|
|
1324
|
-
x();
|
|
1325
|
-
} else
|
|
1326
|
-
u([]);
|
|
1327
|
-
});
|
|
1328
|
-
},
|
|
1329
|
-
replace: function(t, r) {
|
|
1330
|
-
var i = this.get(t), u = this.get(r);
|
|
1331
|
-
if (!i || !u || i === u)
|
|
1332
|
-
return !1;
|
|
1333
|
-
var o = this.files.concat([]), h = o.indexOf(i), c = o.indexOf(u);
|
|
1334
|
-
return h === -1 || c === -1 ? !1 : (o[h] = u, o[c] = i, this.files = o, this.emitInput(), !0);
|
|
1335
|
-
},
|
|
1336
|
-
// 移除
|
|
1337
|
-
remove: function(t) {
|
|
1338
|
-
var r = this.get(t);
|
|
1339
|
-
if (r) {
|
|
1340
|
-
if (this.emitFilter(void 0, r))
|
|
1341
|
-
return !1;
|
|
1342
|
-
var i = this.files.concat([]), u = i.indexOf(r);
|
|
1343
|
-
if (u === -1)
|
|
1344
|
-
return console.error("remove", r), !1;
|
|
1345
|
-
i.splice(u, 1), this.files = i, delete this.maps[r.id], this.emitInput(), this.emitFile(void 0, r);
|
|
1346
|
-
}
|
|
1347
|
-
return r;
|
|
1348
|
-
},
|
|
1349
|
-
// 更新
|
|
1350
|
-
update: function(t, r) {
|
|
1351
|
-
var i = this.get(t);
|
|
1352
|
-
if (i) {
|
|
1353
|
-
var u = I({}, i, r);
|
|
1354
|
-
if (i.fileObject && i.active && !u.active && !u.error && !u.success && (u.error = "abort"), this.emitFilter(u, i))
|
|
1355
|
-
return !1;
|
|
1356
|
-
var o = this.files.concat([]), h = o.indexOf(i);
|
|
1357
|
-
return h === -1 ? (console.error("update", i), !1) : (o.splice(h, 1, u), this.files = o, delete this.maps[i.id], this.maps[u.id] = u, this.emitInput(), this.emitFile(u, i), u);
|
|
1358
|
-
}
|
|
1359
|
-
return !1;
|
|
1360
|
-
},
|
|
1361
|
-
// 预处理 事件 过滤器
|
|
1362
|
-
emitFilter: function(t, r) {
|
|
1363
|
-
var i = !1;
|
|
1364
|
-
return this.$emit("input-filter", t, r, function() {
|
|
1365
|
-
return i = !0, i;
|
|
1366
|
-
}), i;
|
|
1367
|
-
},
|
|
1368
|
-
// 处理后 事件 分发
|
|
1369
|
-
emitFile: function(t, r) {
|
|
1370
|
-
this.$emit("input-file", t, r), t && t.fileObject && t.active && (!r || !r.active) ? (this.uploading++, this.$nextTick(function() {
|
|
1371
|
-
var i = this;
|
|
1372
|
-
setTimeout(function() {
|
|
1373
|
-
i.upload(t).then(function() {
|
|
1374
|
-
t = i.get(t), t && t.fileObject && i.update(t, {
|
|
1375
|
-
active: !1,
|
|
1376
|
-
success: !t.error
|
|
1377
|
-
});
|
|
1378
|
-
}).catch(function(u) {
|
|
1379
|
-
i.update(t, {
|
|
1380
|
-
active: !1,
|
|
1381
|
-
success: !1,
|
|
1382
|
-
error: u.code || u.error || u.message || u
|
|
1383
|
-
});
|
|
1384
|
-
});
|
|
1385
|
-
}, parseInt(Math.random() * 50 + 50, 10));
|
|
1386
|
-
})) : (!t || !t.fileObject || !t.active) && r && r.fileObject && r.active && this.uploading--, this.active && (!!t != !!r || t.active !== r.active) && this.watchActive(!0);
|
|
1387
|
-
},
|
|
1388
|
-
emitInput: function() {
|
|
1389
|
-
this.$emit("input", this.files);
|
|
1390
|
-
},
|
|
1391
|
-
// 上传
|
|
1392
|
-
upload: function(t) {
|
|
1393
|
-
var r = this.get(t);
|
|
1394
|
-
if (!r)
|
|
1395
|
-
return Promise.reject("not_exists");
|
|
1396
|
-
if (!r.fileObject)
|
|
1397
|
-
return Promise.reject("file_object");
|
|
1398
|
-
if (r.error)
|
|
1399
|
-
return Promise.reject(r.error);
|
|
1400
|
-
if (r.success)
|
|
1401
|
-
return Promise.resolve(r);
|
|
1402
|
-
var i = this.extensions;
|
|
1403
|
-
if (i && (i.length || typeof i.length > "u") && (((typeof i > "u" ? "undefined" : z(i)) !== "object" || !(i instanceof RegExp)) && (typeof i == "string" && (i = i.split(",").map(function(u) {
|
|
1404
|
-
return u.trim();
|
|
1405
|
-
}).filter(function(u) {
|
|
1406
|
-
return u;
|
|
1407
|
-
})), i = new RegExp("\\.(" + i.join("|").replace(/\./g, "\\.") + ")$", "i")), r.name.search(i) === -1))
|
|
1408
|
-
return Promise.reject("extension");
|
|
1409
|
-
if (this.size > 0 && r.size >= 0 && r.size > this.size)
|
|
1410
|
-
return Promise.reject("size");
|
|
1411
|
-
if (this.customAction)
|
|
1412
|
-
return this.customAction(r, this);
|
|
1413
|
-
if (this.features.html5) {
|
|
1414
|
-
if (this.shouldUseChunkUpload(r))
|
|
1415
|
-
return this.uploadChunk(r);
|
|
1416
|
-
if (r.putAction)
|
|
1417
|
-
return this.uploadPut(r);
|
|
1418
|
-
if (r.postAction)
|
|
1419
|
-
return this.uploadHtml5(r);
|
|
1420
|
-
}
|
|
1421
|
-
return r.postAction ? this.uploadHtml4(r) : Promise.reject("No action configured");
|
|
1422
|
-
},
|
|
1423
|
-
/**
|
|
1424
|
-
* Whether this file should be uploaded using chunk upload or not
|
|
1425
|
-
*
|
|
1426
|
-
* @param Object file
|
|
1427
|
-
*/
|
|
1428
|
-
shouldUseChunkUpload: function(t) {
|
|
1429
|
-
return this.chunkEnabled && !!this.chunkOptions.handler && t.size > this.chunkOptions.minSize;
|
|
1430
|
-
},
|
|
1431
|
-
/**
|
|
1432
|
-
* Upload a file using Chunk method
|
|
1433
|
-
*
|
|
1434
|
-
* @param File file
|
|
1435
|
-
*/
|
|
1436
|
-
uploadChunk: function(t) {
|
|
1437
|
-
var r = this.chunkOptions.handler;
|
|
1438
|
-
return t.chunk = new r(t, this.chunkOptions), t.chunk.upload();
|
|
1439
|
-
},
|
|
1440
|
-
uploadPut: function(t) {
|
|
1441
|
-
var r = [], i = void 0;
|
|
1442
|
-
for (var u in t.data)
|
|
1443
|
-
i = t.data[u], i != null && r.push(encodeURIComponent(u) + "=" + encodeURIComponent(i));
|
|
1444
|
-
var o = r.length ? (t.putAction.indexOf("?") === -1 ? "?" : "&") + r.join("&") : "", h = new XMLHttpRequest();
|
|
1445
|
-
return h.open("PUT", t.putAction + o), this.uploadXhr(h, t, t.file);
|
|
1446
|
-
},
|
|
1447
|
-
uploadHtml5: function(t) {
|
|
1448
|
-
var r = new window.FormData(), i = void 0;
|
|
1449
|
-
for (var u in t.data)
|
|
1450
|
-
i = t.data[u], i && (typeof i > "u" ? "undefined" : z(i)) === "object" && typeof i.toString != "function" ? i instanceof File ? r.append(u, i, i.name) : r.append(u, JSON.stringify(i)) : i != null && r.append(u, i);
|
|
1451
|
-
r.append(this.name, t.file, t.file.filename || t.name);
|
|
1452
|
-
var o = new XMLHttpRequest();
|
|
1453
|
-
return o.open("POST", t.postAction), this.uploadXhr(o, t, r);
|
|
1454
|
-
},
|
|
1455
|
-
uploadXhr: function(t, r, i) {
|
|
1456
|
-
var u = this, o = r, h = 0, c = 0;
|
|
1457
|
-
t.upload.onprogress = function(C) {
|
|
1458
|
-
if (o = u.get(o), !(!C.lengthComputable || !o || !o.fileObject || !o.active)) {
|
|
1459
|
-
var _ = Math.round(Date.now() / 1e3);
|
|
1460
|
-
_ !== h && (h = _, o = u.update(o, {
|
|
1461
|
-
progress: (C.loaded / C.total * 100).toFixed(2),
|
|
1462
|
-
speed: C.loaded - c
|
|
1463
|
-
}), c = C.loaded);
|
|
1464
|
-
}
|
|
1465
|
-
};
|
|
1466
|
-
var x = setInterval(function() {
|
|
1467
|
-
if (o = u.get(o), !(o && o.fileObject && !o.success && !o.error && o.active)) {
|
|
1468
|
-
x && (clearInterval(x), x = !1);
|
|
1469
|
-
try {
|
|
1470
|
-
t.abort(), t.timeout = 1;
|
|
1471
|
-
} catch {
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
}, 100);
|
|
1475
|
-
return new Promise(function(C, _) {
|
|
1476
|
-
var O = void 0, y = function(R) {
|
|
1477
|
-
if (!O) {
|
|
1478
|
-
if (O = !0, x && (clearInterval(x), x = !1), o = u.get(o), !o)
|
|
1479
|
-
return _("not_exists");
|
|
1480
|
-
if (!o.fileObject)
|
|
1481
|
-
return _("file_object");
|
|
1482
|
-
if (o.error)
|
|
1483
|
-
return _(o.error);
|
|
1484
|
-
if (!o.active)
|
|
1485
|
-
return _("abort");
|
|
1486
|
-
if (o.success)
|
|
1487
|
-
return C(o);
|
|
1488
|
-
var j = {};
|
|
1489
|
-
switch (R.type) {
|
|
1490
|
-
case "timeout":
|
|
1491
|
-
case "abort":
|
|
1492
|
-
j.error = R.type;
|
|
1493
|
-
break;
|
|
1494
|
-
case "error":
|
|
1495
|
-
t.status ? t.status >= 500 ? j.error = "server" : t.status >= 400 && (j.error = "denied") : j.error = "network";
|
|
1496
|
-
break;
|
|
1497
|
-
default:
|
|
1498
|
-
t.status >= 500 ? j.error = "server" : t.status >= 400 ? j.error = "denied" : j.progress = "100.00";
|
|
1499
|
-
}
|
|
1500
|
-
if (t.responseText) {
|
|
1501
|
-
var ue = t.getResponseHeader("Content-Type");
|
|
1502
|
-
ue && ue.indexOf("/json") !== -1 ? j.response = JSON.parse(t.responseText) : j.response = t.responseText;
|
|
1503
|
-
}
|
|
1504
|
-
return o = u.update(o, j), o.error ? _(o.error) : C(o);
|
|
1505
|
-
}
|
|
1506
|
-
};
|
|
1507
|
-
t.onload = y, t.onerror = y, t.onabort = y, t.ontimeout = y, o.timeout && (t.timeout = o.timeout);
|
|
1508
|
-
for (var E in o.headers)
|
|
1509
|
-
t.setRequestHeader(E, o.headers[E]);
|
|
1510
|
-
o = u.update(o, { xhr: t }), t.send(i);
|
|
1511
|
-
});
|
|
1512
|
-
},
|
|
1513
|
-
uploadHtml4: function(t) {
|
|
1514
|
-
var r = this, i = t, u = function(y) {
|
|
1515
|
-
y.keyCode === 27 && y.preventDefault();
|
|
1516
|
-
}, o = document.createElement("iframe");
|
|
1517
|
-
o.id = "upload-iframe-" + i.id, o.name = "upload-iframe-" + i.id, o.src = "about:blank", o.setAttribute("style", "width:1px;height:1px;top:-999em;position:absolute; margin-top:-999em;");
|
|
1518
|
-
var h = document.createElement("form");
|
|
1519
|
-
h.action = i.postAction, h.name = "upload-form-" + i.id, h.setAttribute("method", "POST"), h.setAttribute("target", "upload-iframe-" + i.id), h.setAttribute("enctype", "multipart/form-data");
|
|
1520
|
-
var c = void 0, x = void 0;
|
|
1521
|
-
for (var C in i.data)
|
|
1522
|
-
c = i.data[C], c && (typeof c > "u" ? "undefined" : z(c)) === "object" && typeof c.toString != "function" && (c = JSON.stringify(c)), c != null && (x = document.createElement("input"), x.type = "hidden", x.name = C, x.value = c, h.appendChild(x));
|
|
1523
|
-
h.appendChild(i.el), document.body.appendChild(o).appendChild(h);
|
|
1524
|
-
var _ = function() {
|
|
1525
|
-
var y = void 0;
|
|
1526
|
-
try {
|
|
1527
|
-
o.contentWindow && (y = o.contentWindow.document);
|
|
1528
|
-
} catch {
|
|
1529
|
-
}
|
|
1530
|
-
if (!y)
|
|
1531
|
-
try {
|
|
1532
|
-
y = o.contentDocument ? o.contentDocument : o.document;
|
|
1533
|
-
} catch {
|
|
1534
|
-
y = o.document;
|
|
1535
|
-
}
|
|
1536
|
-
return y && y.body ? y.body.innerHTML : null;
|
|
1537
|
-
};
|
|
1538
|
-
return new Promise(function(O, y) {
|
|
1539
|
-
setTimeout(function() {
|
|
1540
|
-
if (i = r.update(i, { iframe: o }), !i)
|
|
1541
|
-
return y("not_exists");
|
|
1542
|
-
var E = setInterval(function() {
|
|
1543
|
-
i = r.get(i), !(i && i.fileObject && !i.success && !i.error && i.active) && (E && (clearInterval(E), E = !1), o.onabort({ type: i ? "abort" : "not_exists" }));
|
|
1544
|
-
}, 100), P = void 0, R = function(ue) {
|
|
1545
|
-
if (!P) {
|
|
1546
|
-
if (P = !0, E && (clearInterval(E), E = !1), document.body.removeEventListener("keydown", u), i = r.get(i), !i)
|
|
1547
|
-
return y("not_exists");
|
|
1548
|
-
if (!i.fileObject)
|
|
1549
|
-
return y("file_object");
|
|
1550
|
-
if (i.error)
|
|
1551
|
-
return y(i.error);
|
|
1552
|
-
if (!i.active)
|
|
1553
|
-
return y("abort");
|
|
1554
|
-
if (i.success)
|
|
1555
|
-
return O(i);
|
|
1556
|
-
var M = _(), N = {};
|
|
1557
|
-
switch (ue.type) {
|
|
1558
|
-
case "abort":
|
|
1559
|
-
N.error = "abort";
|
|
1560
|
-
break;
|
|
1561
|
-
case "error":
|
|
1562
|
-
i.error ? N.error = i.error : M === null ? N.error = "network" : N.error = "denied";
|
|
1563
|
-
break;
|
|
1564
|
-
default:
|
|
1565
|
-
i.error ? N.error = i.error : N === null ? N.error = "network" : N.progress = "100.00";
|
|
1566
|
-
}
|
|
1567
|
-
if (M !== null) {
|
|
1568
|
-
if (M && M.substr(0, 1) === "{" && M.substr(M.length - 1, 1) === "}")
|
|
1569
|
-
try {
|
|
1570
|
-
M = JSON.parse(M);
|
|
1571
|
-
} catch {
|
|
1572
|
-
}
|
|
1573
|
-
N.response = M;
|
|
1574
|
-
}
|
|
1575
|
-
return i = r.update(i, N), i.error ? y(i.error) : O(i);
|
|
1576
|
-
}
|
|
1577
|
-
};
|
|
1578
|
-
o.onload = R, o.onerror = R, o.onabort = R, document.body.addEventListener("keydown", u), h.submit();
|
|
1579
|
-
}, 50);
|
|
1580
|
-
}).then(function(O) {
|
|
1581
|
-
return o.parentNode && o.parentNode.removeChild(o), O;
|
|
1582
|
-
}).catch(function(O) {
|
|
1583
|
-
return o.parentNode && o.parentNode.removeChild(o), O;
|
|
1584
|
-
});
|
|
1585
|
-
},
|
|
1586
|
-
watchActive: function(t) {
|
|
1587
|
-
for (var r = void 0, i = 0; r = this.files[i]; )
|
|
1588
|
-
if (i++, r.fileObject)
|
|
1589
|
-
if (t && !this.destroy) {
|
|
1590
|
-
if (this.uploading >= this.thread || this.uploading && !this.features.html5)
|
|
1591
|
-
break;
|
|
1592
|
-
!r.active && !r.error && !r.success && this.update(r, { active: !0 });
|
|
1593
|
-
} else
|
|
1594
|
-
r.active && this.update(r, { active: !1 });
|
|
1595
|
-
this.uploading === 0 && (this.active = !1);
|
|
1596
|
-
},
|
|
1597
|
-
watchDrop: function(t) {
|
|
1598
|
-
var r = t;
|
|
1599
|
-
if (this.features.drop) {
|
|
1600
|
-
if (this.dropElement)
|
|
1601
|
-
try {
|
|
1602
|
-
document.removeEventListener("dragenter", this.onDragenter, !1), document.removeEventListener("dragleave", this.onDragleave, !1), document.removeEventListener("drop", this.onDocumentDrop, !1), this.dropElement.removeEventListener("dragover", this.onDragover, !1), this.dropElement.removeEventListener("drop", this.onDrop, !1);
|
|
1603
|
-
} catch {
|
|
1604
|
-
}
|
|
1605
|
-
r ? typeof r == "string" ? r = document.querySelector(r) || this.$root.$el.querySelector(r) : r === !0 && (r = this.$parent.$el) : r = !1, this.dropElement = r, this.dropElement && (document.addEventListener("dragenter", this.onDragenter, !1), document.addEventListener("dragleave", this.onDragleave, !1), document.addEventListener("drop", this.onDocumentDrop, !1), this.dropElement.addEventListener("dragover", this.onDragover, !1), this.dropElement.addEventListener("drop", this.onDrop, !1));
|
|
1606
|
-
}
|
|
1607
|
-
},
|
|
1608
|
-
onDragenter: function(t) {
|
|
1609
|
-
if (t.preventDefault(), !this.dropActive && t.dataTransfer) {
|
|
1610
|
-
var r = t.dataTransfer;
|
|
1611
|
-
r.files && r.files.length ? this.dropActive = !0 : r.types ? r.types.indexOf && r.types.indexOf("Files") !== -1 ? this.dropActive = !0 : r.types.contains && r.types.contains("Files") && (this.dropActive = !0) : this.dropActive = !0;
|
|
1612
|
-
}
|
|
1613
|
-
},
|
|
1614
|
-
onDragleave: function(t) {
|
|
1615
|
-
t.preventDefault(), this.dropActive && (t.target.nodeName === "HTML" || t.target === t.explicitOriginalTarget || !t.fromElement && (t.clientX <= 0 || t.clientY <= 0 || t.clientX >= window.innerWidth || t.clientY >= window.innerHeight)) && (this.dropActive = !1);
|
|
1616
|
-
},
|
|
1617
|
-
onDragover: function(t) {
|
|
1618
|
-
t.preventDefault();
|
|
1619
|
-
},
|
|
1620
|
-
onDocumentDrop: function() {
|
|
1621
|
-
this.dropActive = !1;
|
|
1622
|
-
},
|
|
1623
|
-
onDrop: function(t) {
|
|
1624
|
-
t.preventDefault(), this.addDataTransfer(t.dataTransfer);
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
}, $ = typeof navigator < "u" && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
|
|
1628
|
-
function Q(f) {
|
|
1629
|
-
return function(t, r) {
|
|
1630
|
-
return ee(t, r);
|
|
1631
|
-
};
|
|
1632
|
-
}
|
|
1633
|
-
var Z = document.head || document.getElementsByTagName("head")[0], K = {};
|
|
1634
|
-
function ee(f, t) {
|
|
1635
|
-
var r = $ ? t.media || "default" : f, i = K[r] || (K[r] = {
|
|
1636
|
-
ids: /* @__PURE__ */ new Set(),
|
|
1637
|
-
styles: []
|
|
1638
|
-
});
|
|
1639
|
-
if (!i.ids.has(f)) {
|
|
1640
|
-
i.ids.add(f);
|
|
1641
|
-
var u = t.source;
|
|
1642
|
-
if (t.map && (u += `
|
|
1643
|
-
/*# sourceURL=` + t.map.sources[0] + " */", u += `
|
|
1644
|
-
/*# sourceMappingURL=data:application/json;base64,` + btoa(unescape(encodeURIComponent(JSON.stringify(t.map)))) + " */"), i.element || (i.element = document.createElement("style"), i.element.type = "text/css", t.media && i.element.setAttribute("media", t.media), Z.appendChild(i.element)), "styleSheet" in i.element)
|
|
1645
|
-
i.styles.push(u), i.element.styleSheet.cssText = i.styles.filter(Boolean).join(`
|
|
1646
|
-
`);
|
|
1647
|
-
else {
|
|
1648
|
-
var o = i.ids.size - 1, h = document.createTextNode(u), c = i.element.childNodes;
|
|
1649
|
-
c[o] && i.element.removeChild(c[o]), c.length ? i.element.insertBefore(h, c[o]) : i.element.appendChild(h);
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
var te = Q, re = D, ie = function() {
|
|
1654
|
-
var t = this, r = t.$createElement, i = t._self._c || r;
|
|
1655
|
-
return i("span", { class: t.className }, [t._t("default"), t._v(" "), i("label", { attrs: { for: t.inputId || t.name } }), t._v(" "), i("input-file")], 2);
|
|
1656
|
-
}, ne = [], ae = function(t) {
|
|
1657
|
-
t && t("data-v-76d380b6_0", { source: ".file-uploads{overflow:hidden;position:relative;text-align:center;display:inline-block}.file-uploads.file-uploads-html4 input,.file-uploads.file-uploads-html5 label{background:#fff;opacity:0;font-size:20em;z-index:1;top:0;left:0;right:0;bottom:0;position:absolute;width:100%;height:100%}.file-uploads.file-uploads-html4 label,.file-uploads.file-uploads-html5 input{background:rgba(255,255,255,0);overflow:hidden;position:fixed;width:1px;height:1px;z-index:-1;opacity:0}", map: void 0, media: void 0 });
|
|
1658
|
-
}, ce = void 0, pe = void 0, he = !1, me = A({ render: ie, staticRenderFns: ne }, ae, re, ce, he, pe, te, void 0), J = /* @__PURE__ */ Object.freeze({
|
|
1659
|
-
default: me
|
|
1660
|
-
});
|
|
1661
|
-
function se(f) {
|
|
1662
|
-
return f && f.default || f;
|
|
1663
|
-
}
|
|
1664
|
-
var oe = se(J), Y = oe;
|
|
1665
|
-
return Y;
|
|
1666
|
-
});
|
|
1667
|
-
})(we);
|
|
1668
|
-
var Ye = we.exports;
|
|
1669
|
-
const Ve = /* @__PURE__ */ De(Ye), Qe = {
|
|
1670
|
-
i18nOptions: {
|
|
1671
|
-
namespaces: "baseUpload",
|
|
1672
|
-
messages: {
|
|
1673
|
-
en: {
|
|
1674
|
-
dropActive: "Drag & drop files to upload",
|
|
1675
|
-
errors: {
|
|
1676
|
-
thumbnail: "Could not create thumbnail",
|
|
1677
|
-
compress: "Could not upload photo",
|
|
1678
|
-
general: "File could not be uploaded",
|
|
1679
|
-
extension: "Unsupported file format. Supported types are: {{extensions}}",
|
|
1680
|
-
size: "File is too large. Max file size is {{maxFileSize}}",
|
|
1681
|
-
ECONNREFUSED: "File could not be uploaded, no internet connection"
|
|
1682
|
-
}
|
|
1683
|
-
},
|
|
1684
|
-
sv: {
|
|
1685
|
-
dropActive: "Släpp filer för att ladda upp",
|
|
1686
|
-
errors: {
|
|
1687
|
-
thumbnail: "Kunde inte skapa tumnagel",
|
|
1688
|
-
compress: "Kunde inte ladda upp bild",
|
|
1689
|
-
general: "Kunde inte ladda upp fil",
|
|
1690
|
-
extension: "Ogiltigt format. Tillåtna format: {{extensions}}",
|
|
1691
|
-
size: "För stor fil. Max filstorlek är {{maxFileSize}}",
|
|
1692
|
-
ECONNREFUSED: "Kunde inte ladda upp fil, ingen internetanslutning"
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
},
|
|
1697
|
-
name: "BaseUpload",
|
|
1698
|
-
components: {
|
|
1699
|
-
FileUpload: Ve,
|
|
1700
|
-
UploadModal: () => import("./UploadModal-DOPLVEpV.js")
|
|
1701
|
-
},
|
|
1702
|
-
props: {
|
|
1703
|
-
// Optional function to handle any errors
|
|
1704
|
-
// If not supplied a default errorHandler is used
|
|
1705
|
-
onError: {
|
|
1706
|
-
type: Function,
|
|
1707
|
-
default: void 0
|
|
1708
|
-
},
|
|
1709
|
-
autostartUpload: {
|
|
1710
|
-
type: Boolean,
|
|
1711
|
-
default: !1
|
|
1712
|
-
},
|
|
1713
|
-
multiple: {
|
|
1714
|
-
type: Boolean,
|
|
1715
|
-
default: !0
|
|
1716
|
-
},
|
|
1717
|
-
// max file size in bytes
|
|
1718
|
-
maxSize: {
|
|
1719
|
-
type: Number,
|
|
1720
|
-
default: 1e3 * 1e3 * 10
|
|
1721
|
-
// 10 MB
|
|
1722
|
-
},
|
|
1723
|
-
// Compression (0 - 1)
|
|
1724
|
-
// Only for image/jpeg and image/webp
|
|
1725
|
-
quality: {
|
|
1726
|
-
type: Number,
|
|
1727
|
-
default: 0.8
|
|
1728
|
-
// Be careful to use 1 as it may make the size of the output image become larger
|
|
1729
|
-
},
|
|
1730
|
-
// Resize
|
|
1731
|
-
maxHeight: {
|
|
1732
|
-
type: Number,
|
|
1733
|
-
default: 1 / 0
|
|
1734
|
-
},
|
|
1735
|
-
maxWidth: {
|
|
1736
|
-
type: Number,
|
|
1737
|
-
default: 1 / 0
|
|
1738
|
-
},
|
|
1739
|
-
// Thumbnail props
|
|
1740
|
-
createThumbnails: {
|
|
1741
|
-
type: Boolean,
|
|
1742
|
-
default: !1
|
|
1743
|
-
},
|
|
1744
|
-
thumbnailMaxWidth: {
|
|
1745
|
-
type: Number,
|
|
1746
|
-
default: 120
|
|
1747
|
-
},
|
|
1748
|
-
thumbnailMaxHeight: {
|
|
1749
|
-
type: Number,
|
|
1750
|
-
default: 120
|
|
1751
|
-
},
|
|
1752
|
-
drop: {
|
|
1753
|
-
type: Boolean,
|
|
1754
|
-
default: !1
|
|
1755
|
-
},
|
|
1756
|
-
maximum: {
|
|
1757
|
-
type: Number,
|
|
1758
|
-
default: null
|
|
1759
|
-
},
|
|
1760
|
-
extensions: {
|
|
1761
|
-
type: String,
|
|
1762
|
-
default: "gif,jpg,jpeg,png,webp,heic,heif"
|
|
1763
|
-
},
|
|
1764
|
-
accept: {
|
|
1765
|
-
type: String,
|
|
1766
|
-
default: "image/png,image/gif,image/jpeg,image/webp,image/heic,image/heif,image/tiff"
|
|
1767
|
-
},
|
|
1768
|
-
recentModal: {
|
|
1769
|
-
type: Boolean,
|
|
1770
|
-
default: !1
|
|
1771
|
-
}
|
|
1772
|
-
},
|
|
1773
|
-
data() {
|
|
1774
|
-
return {
|
|
1775
|
-
files: [],
|
|
1776
|
-
modalOpen: !1
|
|
1777
|
-
};
|
|
1778
|
-
},
|
|
1779
|
-
mounted() {
|
|
1780
|
-
this.$emit("has-mounted", !0);
|
|
1781
|
-
},
|
|
1782
|
-
methods: {
|
|
1783
|
-
open() {
|
|
1784
|
-
this.recentModal ? this.modalOpen = !0 : this.openFilePicker();
|
|
1785
|
-
},
|
|
1786
|
-
openFilePicker() {
|
|
1787
|
-
this.$refs.upload && this.$refs.upload.$el.querySelector("input[type='file']").click();
|
|
1788
|
-
},
|
|
1789
|
-
closeRecentModal() {
|
|
1790
|
-
this.$modal.hide("recent-modal");
|
|
1791
|
-
},
|
|
1792
|
-
async postAction(s) {
|
|
1793
|
-
const n = new FormData();
|
|
1794
|
-
n.append("file", s.file, s.file.name);
|
|
1795
|
-
const { data: a } = await ye.post("/file", n, {
|
|
1796
|
-
onUploadProgress: (d) => {
|
|
1797
|
-
const p = this.files.filter(
|
|
1798
|
-
(m) => m.id === s.id
|
|
1799
|
-
);
|
|
1800
|
-
if (p.length) {
|
|
1801
|
-
const m = p[0], k = m, g = Math.round(
|
|
1802
|
-
d.loaded * 100 / d.total
|
|
1803
|
-
);
|
|
1804
|
-
k.progress = g, this.$refs.upload.update(m, k);
|
|
1805
|
-
}
|
|
1806
|
-
},
|
|
1807
|
-
timeout: 6e4
|
|
1808
|
-
}), l = s;
|
|
1809
|
-
return l.response = a, this.$refs.upload.update(s, l), a;
|
|
1810
|
-
},
|
|
1811
|
-
// Pre-treatment when files are added
|
|
1812
|
-
inputFilter(s, n) {
|
|
1813
|
-
if (s && (!n || s.file !== n.file)) {
|
|
1814
|
-
s.url = "";
|
|
1815
|
-
const a = window.URL || window.webkitURL;
|
|
1816
|
-
a && a.createObjectURL && (s.url = a.createObjectURL(s.file));
|
|
1817
|
-
}
|
|
1818
|
-
},
|
|
1819
|
-
// Method to start uploading
|
|
1820
|
-
startUpload() {
|
|
1821
|
-
this.$refs.upload.active = !0;
|
|
1822
|
-
},
|
|
1823
|
-
// Clear any uploads
|
|
1824
|
-
undoFileUpload() {
|
|
1825
|
-
this.$refs.upload.clear();
|
|
1826
|
-
},
|
|
1827
|
-
remove(s) {
|
|
1828
|
-
this.$refs.upload.remove(s);
|
|
1829
|
-
},
|
|
1830
|
-
// When a file is changed
|
|
1831
|
-
inputFile(s, n) {
|
|
1832
|
-
if (this.modalOpen && (this.modalOpen = !1), this.createThumbnails && s && !s.thumbnailId && s.file && s.type.substr(0, 6) === "image/" && !["image/heic", "image/heif"].includes(s.type) && !n)
|
|
1833
|
-
return s.error = "thumbnail", new Promise(async (a, l) => {
|
|
1834
|
-
try {
|
|
1835
|
-
const { id: d } = await this.generateThumbnail(
|
|
1836
|
-
s.file
|
|
1837
|
-
), p = s;
|
|
1838
|
-
return p.thumbnailId = d, p.error = "", this.$refs.upload.update(s, p), a();
|
|
1839
|
-
} catch (d) {
|
|
1840
|
-
return l(d);
|
|
1841
|
-
}
|
|
1842
|
-
}).catch((a) => {
|
|
1843
|
-
this.$refs.upload.update(s, {
|
|
1844
|
-
error: a.code || a.error || a.message || a
|
|
1845
|
-
});
|
|
1846
|
-
});
|
|
1847
|
-
if (s && s.file && s.type.substr(0, 6) === "image/" && !["image/heic", "image/heif"].includes(s.type) && !s.hasCompressed)
|
|
1848
|
-
return s.error = "compressor", new Promise(async (a, l) => {
|
|
1849
|
-
try {
|
|
1850
|
-
const d = await this.compressFile(s.file);
|
|
1851
|
-
return this.$refs.upload.update(s, { ...d, error: "" }), a();
|
|
1852
|
-
} catch (d) {
|
|
1853
|
-
return l(d);
|
|
1854
|
-
}
|
|
1855
|
-
}).catch((a) => {
|
|
1856
|
-
this.$refs.upload.update(s, {
|
|
1857
|
-
error: a.code || a.error || a.message || a
|
|
1858
|
-
});
|
|
1859
|
-
});
|
|
1860
|
-
if (s && !s.active && !s.success && !s.error && this.autostartUpload && (s.active = !0), s && s.success && !n.success && this.$emit("upload-success", s), s && s.error && s.error !== "thumbnail" && s.error !== "compressor" && (!n || !n.error)) {
|
|
1861
|
-
if (this.onError)
|
|
1862
|
-
this.onError(s);
|
|
1863
|
-
else {
|
|
1864
|
-
let a = null;
|
|
1865
|
-
switch (s.error) {
|
|
1866
|
-
case "extension": {
|
|
1867
|
-
const l = this.extensions.replace(/,/g, ", ");
|
|
1868
|
-
a = this.$t("errors.extension", {
|
|
1869
|
-
extensions: l
|
|
1870
|
-
});
|
|
1871
|
-
break;
|
|
1872
|
-
}
|
|
1873
|
-
case "size": {
|
|
1874
|
-
a = this.$t("errors.size", {
|
|
1875
|
-
maxFileSize: `${this.maxSize / 1e6} MB`
|
|
1876
|
-
});
|
|
1877
|
-
break;
|
|
1878
|
-
}
|
|
1879
|
-
case "ECONNREFUSED": {
|
|
1880
|
-
a = this.$t("errors.ECONNREFUSED");
|
|
1881
|
-
break;
|
|
1882
|
-
}
|
|
1883
|
-
default:
|
|
1884
|
-
a = `${this.$t("errors.general")}: ${s.error}`;
|
|
1885
|
-
}
|
|
1886
|
-
ve("error", a);
|
|
1887
|
-
}
|
|
1888
|
-
this.remove(s);
|
|
1889
|
-
}
|
|
1890
|
-
return !0;
|
|
1891
|
-
},
|
|
1892
|
-
async generateThumbnail(s) {
|
|
1893
|
-
try {
|
|
1894
|
-
return new Promise((n, a) => {
|
|
1895
|
-
new Oe(s, {
|
|
1896
|
-
quality: this.quality,
|
|
1897
|
-
maxWidth: this.thumbnailMaxWidth,
|
|
1898
|
-
maxHeight: this.thumbnailMaxHeight,
|
|
1899
|
-
success: (l) => {
|
|
1900
|
-
const d = new FormData(), p = this.appendToFilename(
|
|
1901
|
-
l.name,
|
|
1902
|
-
"_thumbnail"
|
|
1903
|
-
);
|
|
1904
|
-
return d.append("file", l, p), ye.post("/file", d).then((m) => n(m.data)).catch((m) => a(m));
|
|
1905
|
-
},
|
|
1906
|
-
error: (l) => a(l)
|
|
1907
|
-
});
|
|
1908
|
-
});
|
|
1909
|
-
} catch (n) {
|
|
1910
|
-
return ve("error", this.$t("errors.thumbnail")), Promise.reject(n);
|
|
1911
|
-
}
|
|
1912
|
-
},
|
|
1913
|
-
/**
|
|
1914
|
-
* Helper to compress file
|
|
1915
|
-
*
|
|
1916
|
-
* @param {Object} originalFile
|
|
1917
|
-
*
|
|
1918
|
-
* @returns {Promise} Resolves with a new fileObj when done
|
|
1919
|
-
*/
|
|
1920
|
-
async compressFile(s) {
|
|
1921
|
-
let n;
|
|
1922
|
-
try {
|
|
1923
|
-
return new Promise((a, l) => {
|
|
1924
|
-
n = new Oe(s, {
|
|
1925
|
-
quality: this.quality,
|
|
1926
|
-
maxWidth: this.maxWidth,
|
|
1927
|
-
maxHeight: this.maxHeight,
|
|
1928
|
-
success: (d) => {
|
|
1929
|
-
const p = {
|
|
1930
|
-
file: d,
|
|
1931
|
-
size: d.size,
|
|
1932
|
-
type: d.type,
|
|
1933
|
-
hasCompressed: !0
|
|
1934
|
-
};
|
|
1935
|
-
return a(p);
|
|
1936
|
-
},
|
|
1937
|
-
error: (d) => l(d)
|
|
1938
|
-
});
|
|
1939
|
-
});
|
|
1940
|
-
} catch (a) {
|
|
1941
|
-
return ve("error", this.$t("errors.compress")), this.$refs.upload.update(s, { error: e.message }), Promise.reject(a);
|
|
1942
|
-
} finally {
|
|
1943
|
-
n = null;
|
|
1944
|
-
}
|
|
1945
|
-
},
|
|
1946
|
-
appendToFilename(s, n) {
|
|
1947
|
-
const a = s.lastIndexOf(".");
|
|
1948
|
-
return a === -1 ? s + n : s.substring(0, a) + n + s.substring(a);
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
|
-
};
|
|
1952
|
-
var Ze = function() {
|
|
1953
|
-
var l, d, p;
|
|
1954
|
-
var n = this, a = n._self._c;
|
|
1955
|
-
return a("FileUpload", { ref: "upload", staticClass: "btn btn-primary white-list", attrs: { maximum: n.maximum, "custom-action": n.postAction, extensions: n.extensions, multiple: n.multiple, drop: n.drop || n.modalOpen, size: n.maxSize, thread: 1, accept: n.accept }, on: { input: function(m) {
|
|
1956
|
-
return n.$emit("input", n.files);
|
|
1957
|
-
}, "input-filter": n.inputFilter, "input-file": n.inputFile }, model: { value: n.files, callback: function(m) {
|
|
1958
|
-
n.files = m;
|
|
1959
|
-
}, expression: "files" } }, [n._t("default", null, { openFilePicker: n.open }), n.drop || n.modalOpen ? a("div", { directives: [{ name: "show", rawName: "v-show", value: (d = (l = n.$refs) == null ? void 0 : l.upload) == null ? void 0 : d.dropActive, expression: "$refs?.upload?.dropActive" }], staticClass: "drop-active font-inter white-list", class: { transparent: n.modalOpen } }, [a("CIcon", { attrs: { type: "upload-cloud", size: "60" } }), n._v(" " + n._s(n.$t("dropActive")) + " ")], 1) : n._e(), n.modalOpen ? a("portal", { attrs: { to: "modal" } }, [a("div", { staticClass: "modal-overlay", on: { click: function(m) {
|
|
1960
|
-
if (m.target !== m.currentTarget)
|
|
1961
|
-
return null;
|
|
1962
|
-
n.modalOpen = !1;
|
|
1963
|
-
} } }, [a("div", { staticClass: "modal-container" }, [a("UploadModal", { on: { "open-picker": n.openFilePicker, select: function(m) {
|
|
1964
|
-
n.$emit("upload-success", { response: m }), n.modalOpen = !1;
|
|
1965
|
-
} } })], 1)]), (p = n.$refs.upload) != null && p.dropActive ? a("div", { staticClass: "drop-active font-inter", staticStyle: { "pointer-events": "none" } }, [a("style", { tag: "component", attrs: { type: "text/css" } }, [n._v(" * { pointer-events: none !important; } .white-list { pointer-events: initial !important; } ")]), a("CIcon", { attrs: { type: "upload-cloud", size: "60" } }), n._v(" " + n._s(n.$t("dropActive")) + " ")], 1) : n._e()]) : n._e()], 2);
|
|
1966
|
-
}, et = [], tt = /* @__PURE__ */ $e(
|
|
1967
|
-
Qe,
|
|
1968
|
-
Ze,
|
|
1969
|
-
et,
|
|
1970
|
-
!1,
|
|
1971
|
-
null,
|
|
1972
|
-
"7d0db589"
|
|
1973
|
-
);
|
|
1974
|
-
const nt = tt.exports;
|
|
1975
|
-
export {
|
|
1976
|
-
nt as default
|
|
1977
|
-
};
|