ss-component-new 1.1.136 → 1.1.138
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/dist/array-0IshmkQJ.cjs +7 -0
- package/dist/array-CIJ8dGq6.js +2348 -0
- package/dist/{cloneDeep-Cc63EzZV.js → cloneDeep-C6YLa8ot.js} +1 -1
- package/dist/{cloneDeep-Bzug5d4F.cjs → cloneDeep-DSQ_igXr.cjs} +1 -1
- package/dist/{index-DOIGOPNZ.js → index-3X2JdNo3.js} +7 -7
- package/dist/{index-Cl6cBBE1.js → index-5Glr7sEl.js} +5 -5
- package/dist/{index-C8ofKvo8.cjs → index-9LI1e9ga.cjs} +1 -1
- package/dist/{index-htlfZCR5.cjs → index-9m8ZOeUK.cjs} +1 -1
- package/dist/index-B0cttYFm.cjs +10 -0
- package/dist/index-B1C1v_Px.cjs +6 -0
- package/dist/index-B3mpQLb3.cjs +7 -0
- package/dist/{index-Bb8-t5G9.js → index-BCI7q3f5.js} +12 -11
- package/dist/{index-BnGBvY9U.cjs → index-BJrnQHML.cjs} +1 -1
- package/dist/{index-CrtdIMYE.cjs → index-BJxHK1HL.cjs} +1 -1
- package/dist/{index-91zJrqjs.cjs → index-BKClglfP.cjs} +1 -1
- package/dist/{index-CooWRcVw.js → index-BLO1N_mc.js} +20 -14
- package/dist/{index-BGLzGltQ.js → index-BN2Hps6w.js} +7021 -7051
- package/dist/{index-CjrJ2TKD.js → index-BYjjDHvu.js} +1 -1
- package/dist/{index-cPHHgVQI.js → index-B_9tujT0.js} +6 -6
- package/dist/index-BgEwgHeR.js +1754 -0
- package/dist/{index-BgZ6sQ0W.js → index-C0SnH4hf.js} +7 -7
- package/dist/{index-CYHQktKl.js → index-C1RaRVSs.js} +189 -187
- package/dist/index-CCbUHfbR.cjs +74 -0
- package/dist/{index-CJKjrI-E.js → index-CEAr7g_x.js} +6 -6
- package/dist/index-CKd6wtQl.js +232 -0
- package/dist/{index-BtMfnrpv.cjs → index-CKncyBT-.cjs} +1 -1
- package/dist/{index-DeU-UCAx.js → index-CQkg-hee.js} +6 -6
- package/dist/index-CocT3ngV.cjs +1 -0
- package/dist/{index-B8odLCIx.cjs → index-Ct6IzfTx.cjs} +2 -2
- package/dist/{index-BkavIrOf.js → index-Czll01_l.js} +7 -6
- package/dist/{index-BV9q5v4A.js → index-DBBXJzQJ.js} +7 -7
- package/dist/{index-CXSZpNdn.js → index-DEcbAdpA.js} +647 -621
- package/dist/index-DMju3RK4.cjs +1 -0
- package/dist/{index-DApeVZv4.cjs → index-DO49JF8z.cjs} +1 -1
- package/dist/index-DQQnRSg0.cjs +1 -0
- package/dist/{index-DNoSOdIX.js → index-K3sFnD_E.js} +12 -11
- package/dist/index-LtlDJOqV.cjs +1 -0
- package/dist/index-Oe1ZKXjI.cjs +1 -0
- package/dist/{index-VlvSwltF.js → index-TZz_Myyq.js} +11 -11
- package/dist/{index-CIBrUeN_.cjs → index-VRCCBuFY.cjs} +1 -1
- package/dist/{index-zNpBUKES.js → index-Y34BMuQP.js} +103 -102
- package/dist/{index-BVkOb0I9.cjs → index-YBnh4kpP.cjs} +1 -1
- package/dist/{index-DSWOMYXG.js → index-tg7ByrvV.js} +1 -1
- package/dist/index-vw96Xii2.cjs +1 -0
- package/dist/index.vue_vue_type_script_setup_true_lang-BumUFbn-.js +44 -0
- package/dist/index.vue_vue_type_script_setup_true_lang-CGnBsRzb.cjs +1 -0
- package/dist/index.vue_vue_type_style_index_0_scoped_baf99455_lang-0EhkIvBa.cjs +1 -0
- package/dist/index.vue_vue_type_style_index_0_scoped_baf99455_lang-CFgYenw6.js +460 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-Dnfh78IK.cjs → index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-BQkPy1iT.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-DuzluCvf.js → index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-CGR-OZOc.js} +6 -6
- package/dist/isNil-CjWwlQS3.js +6 -0
- package/dist/isNil-x28vo2CT.cjs +1 -0
- package/dist/login-BDuusNHG.cjs +1 -0
- package/dist/{login-BJL3UOFs.js → login-CnN_NEU_.js} +11 -10
- package/dist/{main-B33BjDPL.cjs → main-Ceoo-qQr.cjs} +1 -1
- package/dist/{main-DkutNnJa.js → main-ni3OdUUB.js} +6 -6
- package/dist/menu-CxtX8L48.cjs +11 -0
- package/dist/{menu-CviAaP4o.js → menu-XcYMZJLY.js} +1378 -1783
- package/dist/{modelComp-D7y4j3I1.cjs → modelComp-BQutSX47.cjs} +1 -1
- package/dist/{modelComp-DFH7qNeB.js → modelComp-CP-waker.js} +1 -1
- package/dist/request-51putk3Q.js +2301 -0
- package/dist/request-CJPeGqdv.cjs +6 -0
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +9 -1
- package/dist/ss-component.js +6 -6
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +1 -1
- package/package.json +2 -1
- package/dist/array-5Pi_vrB4.js +0 -2273
- package/dist/array-BjgAlNtF.cjs +0 -7
- package/dist/index-B-OWENQ0.cjs +0 -1
- package/dist/index-BSlJJiN9.cjs +0 -6
- package/dist/index-C8jwhP_V.cjs +0 -87
- package/dist/index-CmyFuqBo.cjs +0 -1
- package/dist/index-DKEqtXj0.cjs +0 -7
- package/dist/index-DKq5fNWo.cjs +0 -1
- package/dist/index-DrUFjgr5.js +0 -2114
- package/dist/index-RL6uslGR.cjs +0 -6
- package/dist/index-W-9W7gWk.cjs +0 -1
- package/dist/index-l_CFUNIw.cjs +0 -1
- package/dist/index.vue_vue_type_script_setup_true_lang-Dsil2awN.js +0 -51
- package/dist/index.vue_vue_type_script_setup_true_lang-v-fKQ-qD.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_baf99455_lang-BUc3oYkg.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_baf99455_lang-CWDc9fZ3.js +0 -431
- package/dist/login-C9_hVzJI.cjs +0 -1
- package/dist/menu-ImEX9f2U.cjs +0 -11
|
@@ -0,0 +1,1754 @@
|
|
|
1
|
+
import { defineComponent as he, ref as wt, reactive as Se, resolveComponent as it, createElementBlock as ce, openBlock as le, createVNode as Y, withCtx as z, createElementVNode as I, createTextVNode as gt, toDisplayString as Re, nextTick as ke, Fragment as Le, renderSlot as Be } from "vue";
|
|
2
|
+
import { Q as Pe, ac as ze, j as pe, m as _, N as V } from "./index-C1RaRVSs.js";
|
|
3
|
+
import { i as We } from "./isNil-CjWwlQS3.js";
|
|
4
|
+
import { m as Ut, s as de, E as Ye } from "./request-51putk3Q.js";
|
|
5
|
+
import { _ as fe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
+
const He = "ElUpload";
|
|
7
|
+
class je extends Error {
|
|
8
|
+
constructor(t, i, e, o) {
|
|
9
|
+
super(t), this.name = "UploadAjaxError", this.status = i, this.method = e, this.url = o;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function Vt(a, t, i) {
|
|
13
|
+
let e;
|
|
14
|
+
return i.response ? e = `${i.response.error || i.response}` : i.responseText ? e = `${i.responseText}` : e = `fail to ${t.method} ${a} ${i.status}`, new je(e, i.status, t.method, a);
|
|
15
|
+
}
|
|
16
|
+
function Xe(a) {
|
|
17
|
+
const t = a.responseText || a.response;
|
|
18
|
+
if (!t)
|
|
19
|
+
return t;
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(t);
|
|
22
|
+
} catch {
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const Ue = (a) => {
|
|
27
|
+
typeof XMLHttpRequest > "u" && Pe(He, "XMLHttpRequest is undefined");
|
|
28
|
+
const t = new XMLHttpRequest(), i = a.action;
|
|
29
|
+
t.upload && t.upload.addEventListener("progress", (r) => {
|
|
30
|
+
const n = r;
|
|
31
|
+
n.percent = r.total > 0 ? r.loaded / r.total * 100 : 0, a.onProgress(n);
|
|
32
|
+
});
|
|
33
|
+
const e = new FormData();
|
|
34
|
+
if (a.data)
|
|
35
|
+
for (const [r, n] of Object.entries(a.data))
|
|
36
|
+
ze(n) && n.length ? e.append(r, ...n) : e.append(r, n);
|
|
37
|
+
e.append(a.filename, a.file, a.file.name), t.addEventListener("error", () => {
|
|
38
|
+
a.onError(Vt(i, a, t));
|
|
39
|
+
}), t.addEventListener("load", () => {
|
|
40
|
+
if (t.status < 200 || t.status >= 300)
|
|
41
|
+
return a.onError(Vt(i, a, t));
|
|
42
|
+
a.onSuccess(Xe(t));
|
|
43
|
+
}), t.open(a.method, i, !0), a.withCredentials && "withCredentials" in t && (t.withCredentials = !0);
|
|
44
|
+
const o = a.headers || {};
|
|
45
|
+
if (o instanceof Headers)
|
|
46
|
+
o.forEach((r, n) => t.setRequestHeader(n, r));
|
|
47
|
+
else
|
|
48
|
+
for (const [r, n] of Object.entries(o))
|
|
49
|
+
We(n) || t.setRequestHeader(r, String(n));
|
|
50
|
+
return t.send(e), t;
|
|
51
|
+
}, Ve = ["text", "picture", "picture-card"];
|
|
52
|
+
let Fe = 1;
|
|
53
|
+
const Ge = () => Date.now() + Fe++, Je = pe({
|
|
54
|
+
action: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "#"
|
|
57
|
+
},
|
|
58
|
+
headers: {
|
|
59
|
+
type: _(Object)
|
|
60
|
+
},
|
|
61
|
+
method: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "post"
|
|
64
|
+
},
|
|
65
|
+
data: {
|
|
66
|
+
type: _([Object, Function, Promise]),
|
|
67
|
+
default: () => Ut({})
|
|
68
|
+
},
|
|
69
|
+
multiple: Boolean,
|
|
70
|
+
name: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "file"
|
|
73
|
+
},
|
|
74
|
+
drag: Boolean,
|
|
75
|
+
withCredentials: Boolean,
|
|
76
|
+
showFileList: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: !0
|
|
79
|
+
},
|
|
80
|
+
accept: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: ""
|
|
83
|
+
},
|
|
84
|
+
fileList: {
|
|
85
|
+
type: _(Array),
|
|
86
|
+
default: () => Ut([])
|
|
87
|
+
},
|
|
88
|
+
autoUpload: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !0
|
|
91
|
+
},
|
|
92
|
+
listType: {
|
|
93
|
+
type: String,
|
|
94
|
+
values: Ve,
|
|
95
|
+
default: "text"
|
|
96
|
+
},
|
|
97
|
+
httpRequest: {
|
|
98
|
+
type: _(Function),
|
|
99
|
+
default: Ue
|
|
100
|
+
},
|
|
101
|
+
disabled: Boolean,
|
|
102
|
+
limit: Number
|
|
103
|
+
});
|
|
104
|
+
pe({
|
|
105
|
+
...Je,
|
|
106
|
+
beforeUpload: {
|
|
107
|
+
type: _(Function),
|
|
108
|
+
default: V
|
|
109
|
+
},
|
|
110
|
+
beforeRemove: {
|
|
111
|
+
type: _(Function)
|
|
112
|
+
},
|
|
113
|
+
onRemove: {
|
|
114
|
+
type: _(Function),
|
|
115
|
+
default: V
|
|
116
|
+
},
|
|
117
|
+
onChange: {
|
|
118
|
+
type: _(Function),
|
|
119
|
+
default: V
|
|
120
|
+
},
|
|
121
|
+
onPreview: {
|
|
122
|
+
type: _(Function),
|
|
123
|
+
default: V
|
|
124
|
+
},
|
|
125
|
+
onSuccess: {
|
|
126
|
+
type: _(Function),
|
|
127
|
+
default: V
|
|
128
|
+
},
|
|
129
|
+
onProgress: {
|
|
130
|
+
type: _(Function),
|
|
131
|
+
default: V
|
|
132
|
+
},
|
|
133
|
+
onError: {
|
|
134
|
+
type: _(Function),
|
|
135
|
+
default: V
|
|
136
|
+
},
|
|
137
|
+
onExceed: {
|
|
138
|
+
type: _(Function),
|
|
139
|
+
default: V
|
|
140
|
+
},
|
|
141
|
+
crossorigin: {
|
|
142
|
+
type: _(String)
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
/*!
|
|
146
|
+
* Cropper.js v1.6.2
|
|
147
|
+
* https://fengyuanchen.github.io/cropperjs
|
|
148
|
+
*
|
|
149
|
+
* Copyright 2015-present Chen Fengyuan
|
|
150
|
+
* Released under the MIT license
|
|
151
|
+
*
|
|
152
|
+
* Date: 2024-04-21T07:43:05.335Z
|
|
153
|
+
*/
|
|
154
|
+
function Ft(a, t) {
|
|
155
|
+
var i = Object.keys(a);
|
|
156
|
+
if (Object.getOwnPropertySymbols) {
|
|
157
|
+
var e = Object.getOwnPropertySymbols(a);
|
|
158
|
+
t && (e = e.filter(function(o) {
|
|
159
|
+
return Object.getOwnPropertyDescriptor(a, o).enumerable;
|
|
160
|
+
})), i.push.apply(i, e);
|
|
161
|
+
}
|
|
162
|
+
return i;
|
|
163
|
+
}
|
|
164
|
+
function ue(a) {
|
|
165
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
166
|
+
var i = arguments[t] != null ? arguments[t] : {};
|
|
167
|
+
t % 2 ? Ft(Object(i), !0).forEach(function(e) {
|
|
168
|
+
Ze(a, e, i[e]);
|
|
169
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(i)) : Ft(Object(i)).forEach(function(e) {
|
|
170
|
+
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(i, e));
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return a;
|
|
174
|
+
}
|
|
175
|
+
function $e(a, t) {
|
|
176
|
+
if (typeof a != "object" || !a) return a;
|
|
177
|
+
var i = a[Symbol.toPrimitive];
|
|
178
|
+
if (i !== void 0) {
|
|
179
|
+
var e = i.call(a, t);
|
|
180
|
+
if (typeof e != "object") return e;
|
|
181
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
182
|
+
}
|
|
183
|
+
return String(a);
|
|
184
|
+
}
|
|
185
|
+
function ge(a) {
|
|
186
|
+
var t = $e(a, "string");
|
|
187
|
+
return typeof t == "symbol" ? t : t + "";
|
|
188
|
+
}
|
|
189
|
+
function Ct(a) {
|
|
190
|
+
"@babel/helpers - typeof";
|
|
191
|
+
return Ct = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
192
|
+
return typeof t;
|
|
193
|
+
} : function(t) {
|
|
194
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
195
|
+
}, Ct(a);
|
|
196
|
+
}
|
|
197
|
+
function qe(a, t) {
|
|
198
|
+
if (!(a instanceof t))
|
|
199
|
+
throw new TypeError("Cannot call a class as a function");
|
|
200
|
+
}
|
|
201
|
+
function Gt(a, t) {
|
|
202
|
+
for (var i = 0; i < t.length; i++) {
|
|
203
|
+
var e = t[i];
|
|
204
|
+
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(a, ge(e.key), e);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function Qe(a, t, i) {
|
|
208
|
+
return t && Gt(a.prototype, t), i && Gt(a, i), Object.defineProperty(a, "prototype", {
|
|
209
|
+
writable: !1
|
|
210
|
+
}), a;
|
|
211
|
+
}
|
|
212
|
+
function Ze(a, t, i) {
|
|
213
|
+
return t = ge(t), t in a ? Object.defineProperty(a, t, {
|
|
214
|
+
value: i,
|
|
215
|
+
enumerable: !0,
|
|
216
|
+
configurable: !0,
|
|
217
|
+
writable: !0
|
|
218
|
+
}) : a[t] = i, a;
|
|
219
|
+
}
|
|
220
|
+
function me(a) {
|
|
221
|
+
return Ke(a) || ti(a) || ei(a) || ii();
|
|
222
|
+
}
|
|
223
|
+
function Ke(a) {
|
|
224
|
+
if (Array.isArray(a)) return Tt(a);
|
|
225
|
+
}
|
|
226
|
+
function ti(a) {
|
|
227
|
+
if (typeof Symbol < "u" && a[Symbol.iterator] != null || a["@@iterator"] != null) return Array.from(a);
|
|
228
|
+
}
|
|
229
|
+
function ei(a, t) {
|
|
230
|
+
if (a) {
|
|
231
|
+
if (typeof a == "string") return Tt(a, t);
|
|
232
|
+
var i = Object.prototype.toString.call(a).slice(8, -1);
|
|
233
|
+
if (i === "Object" && a.constructor && (i = a.constructor.name), i === "Map" || i === "Set") return Array.from(a);
|
|
234
|
+
if (i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) return Tt(a, t);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function Tt(a, t) {
|
|
238
|
+
(t == null || t > a.length) && (t = a.length);
|
|
239
|
+
for (var i = 0, e = new Array(t); i < t; i++) e[i] = a[i];
|
|
240
|
+
return e;
|
|
241
|
+
}
|
|
242
|
+
function ii() {
|
|
243
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
244
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
245
|
+
}
|
|
246
|
+
var yt = typeof window < "u" && typeof window.document < "u", j = yt ? window : {}, Lt = yt && j.document.documentElement ? "ontouchstart" in j.document.documentElement : !1, Bt = yt ? "PointerEvent" in j : !1, x = "cropper", Pt = "all", ve = "crop", we = "move", be = "zoom", Z = "e", K = "w", et = "s", F = "n", st = "ne", ht = "nw", ct = "se", lt = "sw", Ot = "".concat(x, "-crop"), Jt = "".concat(x, "-disabled"), R = "".concat(x, "-hidden"), $t = "".concat(x, "-hide"), ai = "".concat(x, "-invisible"), bt = "".concat(x, "-modal"), It = "".concat(x, "-move"), dt = "".concat(x, "Action"), mt = "".concat(x, "Preview"), zt = "crop", ye = "move", xe = "none", At = "crop", Nt = "cropend", _t = "cropmove", St = "cropstart", qt = "dblclick", ri = Lt ? "touchstart" : "mousedown", ni = Lt ? "touchmove" : "mousemove", oi = Lt ? "touchend touchcancel" : "mouseup", Qt = Bt ? "pointerdown" : ri, Zt = Bt ? "pointermove" : ni, Kt = Bt ? "pointerup pointercancel" : oi, te = "ready", ee = "resize", ie = "wheel", Rt = "zoom", ae = "image/jpeg", si = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/, hi = /^data:/, ci = /^data:image\/jpeg;base64,/, li = /^img|canvas$/i, De = 200, Ee = 100, re = {
|
|
247
|
+
// Define the view mode of the cropper
|
|
248
|
+
viewMode: 0,
|
|
249
|
+
// 0, 1, 2, 3
|
|
250
|
+
// Define the dragging mode of the cropper
|
|
251
|
+
dragMode: zt,
|
|
252
|
+
// 'crop', 'move' or 'none'
|
|
253
|
+
// Define the initial aspect ratio of the crop box
|
|
254
|
+
initialAspectRatio: NaN,
|
|
255
|
+
// Define the aspect ratio of the crop box
|
|
256
|
+
aspectRatio: NaN,
|
|
257
|
+
// An object with the previous cropping result data
|
|
258
|
+
data: null,
|
|
259
|
+
// A selector for adding extra containers to preview
|
|
260
|
+
preview: "",
|
|
261
|
+
// Re-render the cropper when resize the window
|
|
262
|
+
responsive: !0,
|
|
263
|
+
// Restore the cropped area after resize the window
|
|
264
|
+
restore: !0,
|
|
265
|
+
// Check if the current image is a cross-origin image
|
|
266
|
+
checkCrossOrigin: !0,
|
|
267
|
+
// Check the current image's Exif Orientation information
|
|
268
|
+
checkOrientation: !0,
|
|
269
|
+
// Show the black modal
|
|
270
|
+
modal: !0,
|
|
271
|
+
// Show the dashed lines for guiding
|
|
272
|
+
guides: !0,
|
|
273
|
+
// Show the center indicator for guiding
|
|
274
|
+
center: !0,
|
|
275
|
+
// Show the white modal to highlight the crop box
|
|
276
|
+
highlight: !0,
|
|
277
|
+
// Show the grid background
|
|
278
|
+
background: !0,
|
|
279
|
+
// Enable to crop the image automatically when initialize
|
|
280
|
+
autoCrop: !0,
|
|
281
|
+
// Define the percentage of automatic cropping area when initializes
|
|
282
|
+
autoCropArea: 0.8,
|
|
283
|
+
// Enable to move the image
|
|
284
|
+
movable: !0,
|
|
285
|
+
// Enable to rotate the image
|
|
286
|
+
rotatable: !0,
|
|
287
|
+
// Enable to scale the image
|
|
288
|
+
scalable: !0,
|
|
289
|
+
// Enable to zoom the image
|
|
290
|
+
zoomable: !0,
|
|
291
|
+
// Enable to zoom the image by dragging touch
|
|
292
|
+
zoomOnTouch: !0,
|
|
293
|
+
// Enable to zoom the image by wheeling mouse
|
|
294
|
+
zoomOnWheel: !0,
|
|
295
|
+
// Define zoom ratio when zoom the image by wheeling mouse
|
|
296
|
+
wheelZoomRatio: 0.1,
|
|
297
|
+
// Enable to move the crop box
|
|
298
|
+
cropBoxMovable: !0,
|
|
299
|
+
// Enable to resize the crop box
|
|
300
|
+
cropBoxResizable: !0,
|
|
301
|
+
// Toggle drag mode between "crop" and "move" when click twice on the cropper
|
|
302
|
+
toggleDragModeOnDblclick: !0,
|
|
303
|
+
// Size limitation
|
|
304
|
+
minCanvasWidth: 0,
|
|
305
|
+
minCanvasHeight: 0,
|
|
306
|
+
minCropBoxWidth: 0,
|
|
307
|
+
minCropBoxHeight: 0,
|
|
308
|
+
minContainerWidth: De,
|
|
309
|
+
minContainerHeight: Ee,
|
|
310
|
+
// Shortcuts of events
|
|
311
|
+
ready: null,
|
|
312
|
+
cropstart: null,
|
|
313
|
+
cropmove: null,
|
|
314
|
+
cropend: null,
|
|
315
|
+
crop: null,
|
|
316
|
+
zoom: null
|
|
317
|
+
}, pi = '<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>', di = Number.isNaN || j.isNaN;
|
|
318
|
+
function w(a) {
|
|
319
|
+
return typeof a == "number" && !di(a);
|
|
320
|
+
}
|
|
321
|
+
var ne = function(t) {
|
|
322
|
+
return t > 0 && t < 1 / 0;
|
|
323
|
+
};
|
|
324
|
+
function Et(a) {
|
|
325
|
+
return typeof a > "u";
|
|
326
|
+
}
|
|
327
|
+
function tt(a) {
|
|
328
|
+
return Ct(a) === "object" && a !== null;
|
|
329
|
+
}
|
|
330
|
+
var fi = Object.prototype.hasOwnProperty;
|
|
331
|
+
function at(a) {
|
|
332
|
+
if (!tt(a))
|
|
333
|
+
return !1;
|
|
334
|
+
try {
|
|
335
|
+
var t = a.constructor, i = t.prototype;
|
|
336
|
+
return t && i && fi.call(i, "isPrototypeOf");
|
|
337
|
+
} catch {
|
|
338
|
+
return !1;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function S(a) {
|
|
342
|
+
return typeof a == "function";
|
|
343
|
+
}
|
|
344
|
+
var ui = Array.prototype.slice;
|
|
345
|
+
function Me(a) {
|
|
346
|
+
return Array.from ? Array.from(a) : ui.call(a);
|
|
347
|
+
}
|
|
348
|
+
function C(a, t) {
|
|
349
|
+
return a && S(t) && (Array.isArray(a) || w(a.length) ? Me(a).forEach(function(i, e) {
|
|
350
|
+
t.call(a, i, e, a);
|
|
351
|
+
}) : tt(a) && Object.keys(a).forEach(function(i) {
|
|
352
|
+
t.call(a, a[i], i, a);
|
|
353
|
+
})), a;
|
|
354
|
+
}
|
|
355
|
+
var D = Object.assign || function(t) {
|
|
356
|
+
for (var i = arguments.length, e = new Array(i > 1 ? i - 1 : 0), o = 1; o < i; o++)
|
|
357
|
+
e[o - 1] = arguments[o];
|
|
358
|
+
return tt(t) && e.length > 0 && e.forEach(function(r) {
|
|
359
|
+
tt(r) && Object.keys(r).forEach(function(n) {
|
|
360
|
+
t[n] = r[n];
|
|
361
|
+
});
|
|
362
|
+
}), t;
|
|
363
|
+
}, gi = /\.\d*(?:0|9){12}\d*$/;
|
|
364
|
+
function nt(a) {
|
|
365
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e11;
|
|
366
|
+
return gi.test(a) ? Math.round(a * t) / t : a;
|
|
367
|
+
}
|
|
368
|
+
var mi = /^width|height|left|top|marginLeft|marginTop$/;
|
|
369
|
+
function G(a, t) {
|
|
370
|
+
var i = a.style;
|
|
371
|
+
C(t, function(e, o) {
|
|
372
|
+
mi.test(o) && w(e) && (e = "".concat(e, "px")), i[o] = e;
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function vi(a, t) {
|
|
376
|
+
return a.classList ? a.classList.contains(t) : a.className.indexOf(t) > -1;
|
|
377
|
+
}
|
|
378
|
+
function O(a, t) {
|
|
379
|
+
if (t) {
|
|
380
|
+
if (w(a.length)) {
|
|
381
|
+
C(a, function(e) {
|
|
382
|
+
O(e, t);
|
|
383
|
+
});
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (a.classList) {
|
|
387
|
+
a.classList.add(t);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
var i = a.className.trim();
|
|
391
|
+
i ? i.indexOf(t) < 0 && (a.className = "".concat(i, " ").concat(t)) : a.className = t;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function H(a, t) {
|
|
395
|
+
if (t) {
|
|
396
|
+
if (w(a.length)) {
|
|
397
|
+
C(a, function(i) {
|
|
398
|
+
H(i, t);
|
|
399
|
+
});
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (a.classList) {
|
|
403
|
+
a.classList.remove(t);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
a.className.indexOf(t) >= 0 && (a.className = a.className.replace(t, ""));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function rt(a, t, i) {
|
|
410
|
+
if (t) {
|
|
411
|
+
if (w(a.length)) {
|
|
412
|
+
C(a, function(e) {
|
|
413
|
+
rt(e, t, i);
|
|
414
|
+
});
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
i ? O(a, t) : H(a, t);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
var wi = /([a-z\d])([A-Z])/g;
|
|
421
|
+
function Wt(a) {
|
|
422
|
+
return a.replace(wi, "$1-$2").toLowerCase();
|
|
423
|
+
}
|
|
424
|
+
function kt(a, t) {
|
|
425
|
+
return tt(a[t]) ? a[t] : a.dataset ? a.dataset[t] : a.getAttribute("data-".concat(Wt(t)));
|
|
426
|
+
}
|
|
427
|
+
function ft(a, t, i) {
|
|
428
|
+
tt(i) ? a[t] = i : a.dataset ? a.dataset[t] = i : a.setAttribute("data-".concat(Wt(t)), i);
|
|
429
|
+
}
|
|
430
|
+
function bi(a, t) {
|
|
431
|
+
if (tt(a[t]))
|
|
432
|
+
try {
|
|
433
|
+
delete a[t];
|
|
434
|
+
} catch {
|
|
435
|
+
a[t] = void 0;
|
|
436
|
+
}
|
|
437
|
+
else if (a.dataset)
|
|
438
|
+
try {
|
|
439
|
+
delete a.dataset[t];
|
|
440
|
+
} catch {
|
|
441
|
+
a.dataset[t] = void 0;
|
|
442
|
+
}
|
|
443
|
+
else
|
|
444
|
+
a.removeAttribute("data-".concat(Wt(t)));
|
|
445
|
+
}
|
|
446
|
+
var Ce = /\s\s*/, Te = function() {
|
|
447
|
+
var a = !1;
|
|
448
|
+
if (yt) {
|
|
449
|
+
var t = !1, i = function() {
|
|
450
|
+
}, e = Object.defineProperty({}, "once", {
|
|
451
|
+
get: function() {
|
|
452
|
+
return a = !0, t;
|
|
453
|
+
},
|
|
454
|
+
/**
|
|
455
|
+
* This setter can fix a `TypeError` in strict mode
|
|
456
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
|
|
457
|
+
* @param {boolean} value - The value to set
|
|
458
|
+
*/
|
|
459
|
+
set: function(r) {
|
|
460
|
+
t = r;
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
j.addEventListener("test", i, e), j.removeEventListener("test", i, e);
|
|
464
|
+
}
|
|
465
|
+
return a;
|
|
466
|
+
}();
|
|
467
|
+
function P(a, t, i) {
|
|
468
|
+
var e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, o = i;
|
|
469
|
+
t.trim().split(Ce).forEach(function(r) {
|
|
470
|
+
if (!Te) {
|
|
471
|
+
var n = a.listeners;
|
|
472
|
+
n && n[r] && n[r][i] && (o = n[r][i], delete n[r][i], Object.keys(n[r]).length === 0 && delete n[r], Object.keys(n).length === 0 && delete a.listeners);
|
|
473
|
+
}
|
|
474
|
+
a.removeEventListener(r, o, e);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
function L(a, t, i) {
|
|
478
|
+
var e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, o = i;
|
|
479
|
+
t.trim().split(Ce).forEach(function(r) {
|
|
480
|
+
if (e.once && !Te) {
|
|
481
|
+
var n = a.listeners, s = n === void 0 ? {} : n;
|
|
482
|
+
o = function() {
|
|
483
|
+
delete s[r][i], a.removeEventListener(r, o, e);
|
|
484
|
+
for (var l = arguments.length, h = new Array(l), c = 0; c < l; c++)
|
|
485
|
+
h[c] = arguments[c];
|
|
486
|
+
i.apply(a, h);
|
|
487
|
+
}, s[r] || (s[r] = {}), s[r][i] && a.removeEventListener(r, s[r][i], e), s[r][i] = o, a.listeners = s;
|
|
488
|
+
}
|
|
489
|
+
a.addEventListener(r, o, e);
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
function ot(a, t, i) {
|
|
493
|
+
var e;
|
|
494
|
+
return S(Event) && S(CustomEvent) ? e = new CustomEvent(t, {
|
|
495
|
+
detail: i,
|
|
496
|
+
bubbles: !0,
|
|
497
|
+
cancelable: !0
|
|
498
|
+
}) : (e = document.createEvent("CustomEvent"), e.initCustomEvent(t, !0, !0, i)), a.dispatchEvent(e);
|
|
499
|
+
}
|
|
500
|
+
function Oe(a) {
|
|
501
|
+
var t = a.getBoundingClientRect();
|
|
502
|
+
return {
|
|
503
|
+
left: t.left + (window.pageXOffset - document.documentElement.clientLeft),
|
|
504
|
+
top: t.top + (window.pageYOffset - document.documentElement.clientTop)
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
var Mt = j.location, yi = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i;
|
|
508
|
+
function oe(a) {
|
|
509
|
+
var t = a.match(yi);
|
|
510
|
+
return t !== null && (t[1] !== Mt.protocol || t[2] !== Mt.hostname || t[3] !== Mt.port);
|
|
511
|
+
}
|
|
512
|
+
function se(a) {
|
|
513
|
+
var t = "timestamp=".concat((/* @__PURE__ */ new Date()).getTime());
|
|
514
|
+
return a + (a.indexOf("?") === -1 ? "?" : "&") + t;
|
|
515
|
+
}
|
|
516
|
+
function pt(a) {
|
|
517
|
+
var t = a.rotate, i = a.scaleX, e = a.scaleY, o = a.translateX, r = a.translateY, n = [];
|
|
518
|
+
w(o) && o !== 0 && n.push("translateX(".concat(o, "px)")), w(r) && r !== 0 && n.push("translateY(".concat(r, "px)")), w(t) && t !== 0 && n.push("rotate(".concat(t, "deg)")), w(i) && i !== 1 && n.push("scaleX(".concat(i, ")")), w(e) && e !== 1 && n.push("scaleY(".concat(e, ")"));
|
|
519
|
+
var s = n.length ? n.join(" ") : "none";
|
|
520
|
+
return {
|
|
521
|
+
WebkitTransform: s,
|
|
522
|
+
msTransform: s,
|
|
523
|
+
transform: s
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
function xi(a) {
|
|
527
|
+
var t = ue({}, a), i = 0;
|
|
528
|
+
return C(a, function(e, o) {
|
|
529
|
+
delete t[o], C(t, function(r) {
|
|
530
|
+
var n = Math.abs(e.startX - r.startX), s = Math.abs(e.startY - r.startY), d = Math.abs(e.endX - r.endX), l = Math.abs(e.endY - r.endY), h = Math.sqrt(n * n + s * s), c = Math.sqrt(d * d + l * l), p = (c - h) / h;
|
|
531
|
+
Math.abs(p) > Math.abs(i) && (i = p);
|
|
532
|
+
});
|
|
533
|
+
}), i;
|
|
534
|
+
}
|
|
535
|
+
function vt(a, t) {
|
|
536
|
+
var i = a.pageX, e = a.pageY, o = {
|
|
537
|
+
endX: i,
|
|
538
|
+
endY: e
|
|
539
|
+
};
|
|
540
|
+
return t ? o : ue({
|
|
541
|
+
startX: i,
|
|
542
|
+
startY: e
|
|
543
|
+
}, o);
|
|
544
|
+
}
|
|
545
|
+
function Di(a) {
|
|
546
|
+
var t = 0, i = 0, e = 0;
|
|
547
|
+
return C(a, function(o) {
|
|
548
|
+
var r = o.startX, n = o.startY;
|
|
549
|
+
t += r, i += n, e += 1;
|
|
550
|
+
}), t /= e, i /= e, {
|
|
551
|
+
pageX: t,
|
|
552
|
+
pageY: i
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
function J(a) {
|
|
556
|
+
var t = a.aspectRatio, i = a.height, e = a.width, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "contain", r = ne(e), n = ne(i);
|
|
557
|
+
if (r && n) {
|
|
558
|
+
var s = i * t;
|
|
559
|
+
o === "contain" && s > e || o === "cover" && s < e ? i = e / t : e = i * t;
|
|
560
|
+
} else r ? i = e / t : n && (e = i * t);
|
|
561
|
+
return {
|
|
562
|
+
width: e,
|
|
563
|
+
height: i
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function Ei(a) {
|
|
567
|
+
var t = a.width, i = a.height, e = a.degree;
|
|
568
|
+
if (e = Math.abs(e) % 180, e === 90)
|
|
569
|
+
return {
|
|
570
|
+
width: i,
|
|
571
|
+
height: t
|
|
572
|
+
};
|
|
573
|
+
var o = e % 90 * Math.PI / 180, r = Math.sin(o), n = Math.cos(o), s = t * n + i * r, d = t * r + i * n;
|
|
574
|
+
return e > 90 ? {
|
|
575
|
+
width: d,
|
|
576
|
+
height: s
|
|
577
|
+
} : {
|
|
578
|
+
width: s,
|
|
579
|
+
height: d
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function Mi(a, t, i, e) {
|
|
583
|
+
var o = t.aspectRatio, r = t.naturalWidth, n = t.naturalHeight, s = t.rotate, d = s === void 0 ? 0 : s, l = t.scaleX, h = l === void 0 ? 1 : l, c = t.scaleY, p = c === void 0 ? 1 : c, v = i.aspectRatio, m = i.naturalWidth, g = i.naturalHeight, u = e.fillColor, E = u === void 0 ? "transparent" : u, M = e.imageSmoothingEnabled, y = M === void 0 ? !0 : M, B = e.imageSmoothingQuality, A = B === void 0 ? "low" : B, f = e.maxWidth, b = f === void 0 ? 1 / 0 : f, T = e.maxHeight, k = T === void 0 ? 1 / 0 : T, X = e.minWidth, $ = X === void 0 ? 0 : X, q = e.minHeight, U = q === void 0 ? 0 : q, W = document.createElement("canvas"), N = W.getContext("2d"), Q = J({
|
|
584
|
+
aspectRatio: v,
|
|
585
|
+
width: b,
|
|
586
|
+
height: k
|
|
587
|
+
}), ut = J({
|
|
588
|
+
aspectRatio: v,
|
|
589
|
+
width: $,
|
|
590
|
+
height: U
|
|
591
|
+
}, "cover"), xt = Math.min(Q.width, Math.max(ut.width, m)), Dt = Math.min(Q.height, Math.max(ut.height, g)), Yt = J({
|
|
592
|
+
aspectRatio: o,
|
|
593
|
+
width: b,
|
|
594
|
+
height: k
|
|
595
|
+
}), Ht = J({
|
|
596
|
+
aspectRatio: o,
|
|
597
|
+
width: $,
|
|
598
|
+
height: U
|
|
599
|
+
}, "cover"), jt = Math.min(Yt.width, Math.max(Ht.width, r)), Xt = Math.min(Yt.height, Math.max(Ht.height, n)), Ne = [-jt / 2, -Xt / 2, jt, Xt];
|
|
600
|
+
return W.width = nt(xt), W.height = nt(Dt), N.fillStyle = E, N.fillRect(0, 0, xt, Dt), N.save(), N.translate(xt / 2, Dt / 2), N.rotate(d * Math.PI / 180), N.scale(h, p), N.imageSmoothingEnabled = y, N.imageSmoothingQuality = A, N.drawImage.apply(N, [a].concat(me(Ne.map(function(_e) {
|
|
601
|
+
return Math.floor(nt(_e));
|
|
602
|
+
})))), N.restore(), W;
|
|
603
|
+
}
|
|
604
|
+
var Ie = String.fromCharCode;
|
|
605
|
+
function Ci(a, t, i) {
|
|
606
|
+
var e = "";
|
|
607
|
+
i += t;
|
|
608
|
+
for (var o = t; o < i; o += 1)
|
|
609
|
+
e += Ie(a.getUint8(o));
|
|
610
|
+
return e;
|
|
611
|
+
}
|
|
612
|
+
var Ti = /^data:.*,/;
|
|
613
|
+
function Oi(a) {
|
|
614
|
+
var t = a.replace(Ti, ""), i = atob(t), e = new ArrayBuffer(i.length), o = new Uint8Array(e);
|
|
615
|
+
return C(o, function(r, n) {
|
|
616
|
+
o[n] = i.charCodeAt(n);
|
|
617
|
+
}), e;
|
|
618
|
+
}
|
|
619
|
+
function Ii(a, t) {
|
|
620
|
+
for (var i = [], e = 8192, o = new Uint8Array(a); o.length > 0; )
|
|
621
|
+
i.push(Ie.apply(null, Me(o.subarray(0, e)))), o = o.subarray(e);
|
|
622
|
+
return "data:".concat(t, ";base64,").concat(btoa(i.join("")));
|
|
623
|
+
}
|
|
624
|
+
function Ai(a) {
|
|
625
|
+
var t = new DataView(a), i;
|
|
626
|
+
try {
|
|
627
|
+
var e, o, r;
|
|
628
|
+
if (t.getUint8(0) === 255 && t.getUint8(1) === 216)
|
|
629
|
+
for (var n = t.byteLength, s = 2; s + 1 < n; ) {
|
|
630
|
+
if (t.getUint8(s) === 255 && t.getUint8(s + 1) === 225) {
|
|
631
|
+
o = s;
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
s += 1;
|
|
635
|
+
}
|
|
636
|
+
if (o) {
|
|
637
|
+
var d = o + 4, l = o + 10;
|
|
638
|
+
if (Ci(t, d, 4) === "Exif") {
|
|
639
|
+
var h = t.getUint16(l);
|
|
640
|
+
if (e = h === 18761, (e || h === 19789) && t.getUint16(l + 2, e) === 42) {
|
|
641
|
+
var c = t.getUint32(l + 4, e);
|
|
642
|
+
c >= 8 && (r = l + c);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (r) {
|
|
647
|
+
var p = t.getUint16(r, e), v, m;
|
|
648
|
+
for (m = 0; m < p; m += 1)
|
|
649
|
+
if (v = r + m * 12 + 2, t.getUint16(v, e) === 274) {
|
|
650
|
+
v += 8, i = t.getUint16(v, e), t.setUint16(v, 1, e);
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
} catch {
|
|
655
|
+
i = 1;
|
|
656
|
+
}
|
|
657
|
+
return i;
|
|
658
|
+
}
|
|
659
|
+
function Ni(a) {
|
|
660
|
+
var t = 0, i = 1, e = 1;
|
|
661
|
+
switch (a) {
|
|
662
|
+
// Flip horizontal
|
|
663
|
+
case 2:
|
|
664
|
+
i = -1;
|
|
665
|
+
break;
|
|
666
|
+
// Rotate left 180°
|
|
667
|
+
case 3:
|
|
668
|
+
t = -180;
|
|
669
|
+
break;
|
|
670
|
+
// Flip vertical
|
|
671
|
+
case 4:
|
|
672
|
+
e = -1;
|
|
673
|
+
break;
|
|
674
|
+
// Flip vertical and rotate right 90°
|
|
675
|
+
case 5:
|
|
676
|
+
t = 90, e = -1;
|
|
677
|
+
break;
|
|
678
|
+
// Rotate right 90°
|
|
679
|
+
case 6:
|
|
680
|
+
t = 90;
|
|
681
|
+
break;
|
|
682
|
+
// Flip horizontal and rotate right 90°
|
|
683
|
+
case 7:
|
|
684
|
+
t = 90, i = -1;
|
|
685
|
+
break;
|
|
686
|
+
// Rotate left 90°
|
|
687
|
+
case 8:
|
|
688
|
+
t = -90;
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
691
|
+
return {
|
|
692
|
+
rotate: t,
|
|
693
|
+
scaleX: i,
|
|
694
|
+
scaleY: e
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
var _i = {
|
|
698
|
+
render: function() {
|
|
699
|
+
this.initContainer(), this.initCanvas(), this.initCropBox(), this.renderCanvas(), this.cropped && this.renderCropBox();
|
|
700
|
+
},
|
|
701
|
+
initContainer: function() {
|
|
702
|
+
var t = this.element, i = this.options, e = this.container, o = this.cropper, r = Number(i.minContainerWidth), n = Number(i.minContainerHeight);
|
|
703
|
+
O(o, R), H(t, R);
|
|
704
|
+
var s = {
|
|
705
|
+
width: Math.max(e.offsetWidth, r >= 0 ? r : De),
|
|
706
|
+
height: Math.max(e.offsetHeight, n >= 0 ? n : Ee)
|
|
707
|
+
};
|
|
708
|
+
this.containerData = s, G(o, {
|
|
709
|
+
width: s.width,
|
|
710
|
+
height: s.height
|
|
711
|
+
}), O(t, R), H(o, R);
|
|
712
|
+
},
|
|
713
|
+
// Canvas (image wrapper)
|
|
714
|
+
initCanvas: function() {
|
|
715
|
+
var t = this.containerData, i = this.imageData, e = this.options.viewMode, o = Math.abs(i.rotate) % 180 === 90, r = o ? i.naturalHeight : i.naturalWidth, n = o ? i.naturalWidth : i.naturalHeight, s = r / n, d = t.width, l = t.height;
|
|
716
|
+
t.height * s > t.width ? e === 3 ? d = t.height * s : l = t.width / s : e === 3 ? l = t.width / s : d = t.height * s;
|
|
717
|
+
var h = {
|
|
718
|
+
aspectRatio: s,
|
|
719
|
+
naturalWidth: r,
|
|
720
|
+
naturalHeight: n,
|
|
721
|
+
width: d,
|
|
722
|
+
height: l
|
|
723
|
+
};
|
|
724
|
+
this.canvasData = h, this.limited = e === 1 || e === 2, this.limitCanvas(!0, !0), h.width = Math.min(Math.max(h.width, h.minWidth), h.maxWidth), h.height = Math.min(Math.max(h.height, h.minHeight), h.maxHeight), h.left = (t.width - h.width) / 2, h.top = (t.height - h.height) / 2, h.oldLeft = h.left, h.oldTop = h.top, this.initialCanvasData = D({}, h);
|
|
725
|
+
},
|
|
726
|
+
limitCanvas: function(t, i) {
|
|
727
|
+
var e = this.options, o = this.containerData, r = this.canvasData, n = this.cropBoxData, s = e.viewMode, d = r.aspectRatio, l = this.cropped && n;
|
|
728
|
+
if (t) {
|
|
729
|
+
var h = Number(e.minCanvasWidth) || 0, c = Number(e.minCanvasHeight) || 0;
|
|
730
|
+
s > 1 ? (h = Math.max(h, o.width), c = Math.max(c, o.height), s === 3 && (c * d > h ? h = c * d : c = h / d)) : s > 0 && (h ? h = Math.max(h, l ? n.width : 0) : c ? c = Math.max(c, l ? n.height : 0) : l && (h = n.width, c = n.height, c * d > h ? h = c * d : c = h / d));
|
|
731
|
+
var p = J({
|
|
732
|
+
aspectRatio: d,
|
|
733
|
+
width: h,
|
|
734
|
+
height: c
|
|
735
|
+
});
|
|
736
|
+
h = p.width, c = p.height, r.minWidth = h, r.minHeight = c, r.maxWidth = 1 / 0, r.maxHeight = 1 / 0;
|
|
737
|
+
}
|
|
738
|
+
if (i)
|
|
739
|
+
if (s > (l ? 0 : 1)) {
|
|
740
|
+
var v = o.width - r.width, m = o.height - r.height;
|
|
741
|
+
r.minLeft = Math.min(0, v), r.minTop = Math.min(0, m), r.maxLeft = Math.max(0, v), r.maxTop = Math.max(0, m), l && this.limited && (r.minLeft = Math.min(n.left, n.left + (n.width - r.width)), r.minTop = Math.min(n.top, n.top + (n.height - r.height)), r.maxLeft = n.left, r.maxTop = n.top, s === 2 && (r.width >= o.width && (r.minLeft = Math.min(0, v), r.maxLeft = Math.max(0, v)), r.height >= o.height && (r.minTop = Math.min(0, m), r.maxTop = Math.max(0, m))));
|
|
742
|
+
} else
|
|
743
|
+
r.minLeft = -r.width, r.minTop = -r.height, r.maxLeft = o.width, r.maxTop = o.height;
|
|
744
|
+
},
|
|
745
|
+
renderCanvas: function(t, i) {
|
|
746
|
+
var e = this.canvasData, o = this.imageData;
|
|
747
|
+
if (i) {
|
|
748
|
+
var r = Ei({
|
|
749
|
+
width: o.naturalWidth * Math.abs(o.scaleX || 1),
|
|
750
|
+
height: o.naturalHeight * Math.abs(o.scaleY || 1),
|
|
751
|
+
degree: o.rotate || 0
|
|
752
|
+
}), n = r.width, s = r.height, d = e.width * (n / e.naturalWidth), l = e.height * (s / e.naturalHeight);
|
|
753
|
+
e.left -= (d - e.width) / 2, e.top -= (l - e.height) / 2, e.width = d, e.height = l, e.aspectRatio = n / s, e.naturalWidth = n, e.naturalHeight = s, this.limitCanvas(!0, !1);
|
|
754
|
+
}
|
|
755
|
+
(e.width > e.maxWidth || e.width < e.minWidth) && (e.left = e.oldLeft), (e.height > e.maxHeight || e.height < e.minHeight) && (e.top = e.oldTop), e.width = Math.min(Math.max(e.width, e.minWidth), e.maxWidth), e.height = Math.min(Math.max(e.height, e.minHeight), e.maxHeight), this.limitCanvas(!1, !0), e.left = Math.min(Math.max(e.left, e.minLeft), e.maxLeft), e.top = Math.min(Math.max(e.top, e.minTop), e.maxTop), e.oldLeft = e.left, e.oldTop = e.top, G(this.canvas, D({
|
|
756
|
+
width: e.width,
|
|
757
|
+
height: e.height
|
|
758
|
+
}, pt({
|
|
759
|
+
translateX: e.left,
|
|
760
|
+
translateY: e.top
|
|
761
|
+
}))), this.renderImage(t), this.cropped && this.limited && this.limitCropBox(!0, !0);
|
|
762
|
+
},
|
|
763
|
+
renderImage: function(t) {
|
|
764
|
+
var i = this.canvasData, e = this.imageData, o = e.naturalWidth * (i.width / i.naturalWidth), r = e.naturalHeight * (i.height / i.naturalHeight);
|
|
765
|
+
D(e, {
|
|
766
|
+
width: o,
|
|
767
|
+
height: r,
|
|
768
|
+
left: (i.width - o) / 2,
|
|
769
|
+
top: (i.height - r) / 2
|
|
770
|
+
}), G(this.image, D({
|
|
771
|
+
width: e.width,
|
|
772
|
+
height: e.height
|
|
773
|
+
}, pt(D({
|
|
774
|
+
translateX: e.left,
|
|
775
|
+
translateY: e.top
|
|
776
|
+
}, e)))), t && this.output();
|
|
777
|
+
},
|
|
778
|
+
initCropBox: function() {
|
|
779
|
+
var t = this.options, i = this.canvasData, e = t.aspectRatio || t.initialAspectRatio, o = Number(t.autoCropArea) || 0.8, r = {
|
|
780
|
+
width: i.width,
|
|
781
|
+
height: i.height
|
|
782
|
+
};
|
|
783
|
+
e && (i.height * e > i.width ? r.height = r.width / e : r.width = r.height * e), this.cropBoxData = r, this.limitCropBox(!0, !0), r.width = Math.min(Math.max(r.width, r.minWidth), r.maxWidth), r.height = Math.min(Math.max(r.height, r.minHeight), r.maxHeight), r.width = Math.max(r.minWidth, r.width * o), r.height = Math.max(r.minHeight, r.height * o), r.left = i.left + (i.width - r.width) / 2, r.top = i.top + (i.height - r.height) / 2, r.oldLeft = r.left, r.oldTop = r.top, this.initialCropBoxData = D({}, r);
|
|
784
|
+
},
|
|
785
|
+
limitCropBox: function(t, i) {
|
|
786
|
+
var e = this.options, o = this.containerData, r = this.canvasData, n = this.cropBoxData, s = this.limited, d = e.aspectRatio;
|
|
787
|
+
if (t) {
|
|
788
|
+
var l = Number(e.minCropBoxWidth) || 0, h = Number(e.minCropBoxHeight) || 0, c = s ? Math.min(o.width, r.width, r.width + r.left, o.width - r.left) : o.width, p = s ? Math.min(o.height, r.height, r.height + r.top, o.height - r.top) : o.height;
|
|
789
|
+
l = Math.min(l, o.width), h = Math.min(h, o.height), d && (l && h ? h * d > l ? h = l / d : l = h * d : l ? h = l / d : h && (l = h * d), p * d > c ? p = c / d : c = p * d), n.minWidth = Math.min(l, c), n.minHeight = Math.min(h, p), n.maxWidth = c, n.maxHeight = p;
|
|
790
|
+
}
|
|
791
|
+
i && (s ? (n.minLeft = Math.max(0, r.left), n.minTop = Math.max(0, r.top), n.maxLeft = Math.min(o.width, r.left + r.width) - n.width, n.maxTop = Math.min(o.height, r.top + r.height) - n.height) : (n.minLeft = 0, n.minTop = 0, n.maxLeft = o.width - n.width, n.maxTop = o.height - n.height));
|
|
792
|
+
},
|
|
793
|
+
renderCropBox: function() {
|
|
794
|
+
var t = this.options, i = this.containerData, e = this.cropBoxData;
|
|
795
|
+
(e.width > e.maxWidth || e.width < e.minWidth) && (e.left = e.oldLeft), (e.height > e.maxHeight || e.height < e.minHeight) && (e.top = e.oldTop), e.width = Math.min(Math.max(e.width, e.minWidth), e.maxWidth), e.height = Math.min(Math.max(e.height, e.minHeight), e.maxHeight), this.limitCropBox(!1, !0), e.left = Math.min(Math.max(e.left, e.minLeft), e.maxLeft), e.top = Math.min(Math.max(e.top, e.minTop), e.maxTop), e.oldLeft = e.left, e.oldTop = e.top, t.movable && t.cropBoxMovable && ft(this.face, dt, e.width >= i.width && e.height >= i.height ? we : Pt), G(this.cropBox, D({
|
|
796
|
+
width: e.width,
|
|
797
|
+
height: e.height
|
|
798
|
+
}, pt({
|
|
799
|
+
translateX: e.left,
|
|
800
|
+
translateY: e.top
|
|
801
|
+
}))), this.cropped && this.limited && this.limitCanvas(!0, !0), this.disabled || this.output();
|
|
802
|
+
},
|
|
803
|
+
output: function() {
|
|
804
|
+
this.preview(), ot(this.element, At, this.getData());
|
|
805
|
+
}
|
|
806
|
+
}, Si = {
|
|
807
|
+
initPreview: function() {
|
|
808
|
+
var t = this.element, i = this.crossOrigin, e = this.options.preview, o = i ? this.crossOriginUrl : this.url, r = t.alt || "The image to preview", n = document.createElement("img");
|
|
809
|
+
if (i && (n.crossOrigin = i), n.src = o, n.alt = r, this.viewBox.appendChild(n), this.viewBoxImage = n, !!e) {
|
|
810
|
+
var s = e;
|
|
811
|
+
typeof e == "string" ? s = t.ownerDocument.querySelectorAll(e) : e.querySelector && (s = [e]), this.previews = s, C(s, function(d) {
|
|
812
|
+
var l = document.createElement("img");
|
|
813
|
+
ft(d, mt, {
|
|
814
|
+
width: d.offsetWidth,
|
|
815
|
+
height: d.offsetHeight,
|
|
816
|
+
html: d.innerHTML
|
|
817
|
+
}), i && (l.crossOrigin = i), l.src = o, l.alt = r, l.style.cssText = 'display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"', d.innerHTML = "", d.appendChild(l);
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
resetPreview: function() {
|
|
822
|
+
C(this.previews, function(t) {
|
|
823
|
+
var i = kt(t, mt);
|
|
824
|
+
G(t, {
|
|
825
|
+
width: i.width,
|
|
826
|
+
height: i.height
|
|
827
|
+
}), t.innerHTML = i.html, bi(t, mt);
|
|
828
|
+
});
|
|
829
|
+
},
|
|
830
|
+
preview: function() {
|
|
831
|
+
var t = this.imageData, i = this.canvasData, e = this.cropBoxData, o = e.width, r = e.height, n = t.width, s = t.height, d = e.left - i.left - t.left, l = e.top - i.top - t.top;
|
|
832
|
+
!this.cropped || this.disabled || (G(this.viewBoxImage, D({
|
|
833
|
+
width: n,
|
|
834
|
+
height: s
|
|
835
|
+
}, pt(D({
|
|
836
|
+
translateX: -d,
|
|
837
|
+
translateY: -l
|
|
838
|
+
}, t)))), C(this.previews, function(h) {
|
|
839
|
+
var c = kt(h, mt), p = c.width, v = c.height, m = p, g = v, u = 1;
|
|
840
|
+
o && (u = p / o, g = r * u), r && g > v && (u = v / r, m = o * u, g = v), G(h, {
|
|
841
|
+
width: m,
|
|
842
|
+
height: g
|
|
843
|
+
}), G(h.getElementsByTagName("img")[0], D({
|
|
844
|
+
width: n * u,
|
|
845
|
+
height: s * u
|
|
846
|
+
}, pt(D({
|
|
847
|
+
translateX: -d * u,
|
|
848
|
+
translateY: -l * u
|
|
849
|
+
}, t))));
|
|
850
|
+
}));
|
|
851
|
+
}
|
|
852
|
+
}, Ri = {
|
|
853
|
+
bind: function() {
|
|
854
|
+
var t = this.element, i = this.options, e = this.cropper;
|
|
855
|
+
S(i.cropstart) && L(t, St, i.cropstart), S(i.cropmove) && L(t, _t, i.cropmove), S(i.cropend) && L(t, Nt, i.cropend), S(i.crop) && L(t, At, i.crop), S(i.zoom) && L(t, Rt, i.zoom), L(e, Qt, this.onCropStart = this.cropStart.bind(this)), i.zoomable && i.zoomOnWheel && L(e, ie, this.onWheel = this.wheel.bind(this), {
|
|
856
|
+
passive: !1,
|
|
857
|
+
capture: !0
|
|
858
|
+
}), i.toggleDragModeOnDblclick && L(e, qt, this.onDblclick = this.dblclick.bind(this)), L(t.ownerDocument, Zt, this.onCropMove = this.cropMove.bind(this)), L(t.ownerDocument, Kt, this.onCropEnd = this.cropEnd.bind(this)), i.responsive && L(window, ee, this.onResize = this.resize.bind(this));
|
|
859
|
+
},
|
|
860
|
+
unbind: function() {
|
|
861
|
+
var t = this.element, i = this.options, e = this.cropper;
|
|
862
|
+
S(i.cropstart) && P(t, St, i.cropstart), S(i.cropmove) && P(t, _t, i.cropmove), S(i.cropend) && P(t, Nt, i.cropend), S(i.crop) && P(t, At, i.crop), S(i.zoom) && P(t, Rt, i.zoom), P(e, Qt, this.onCropStart), i.zoomable && i.zoomOnWheel && P(e, ie, this.onWheel, {
|
|
863
|
+
passive: !1,
|
|
864
|
+
capture: !0
|
|
865
|
+
}), i.toggleDragModeOnDblclick && P(e, qt, this.onDblclick), P(t.ownerDocument, Zt, this.onCropMove), P(t.ownerDocument, Kt, this.onCropEnd), i.responsive && P(window, ee, this.onResize);
|
|
866
|
+
}
|
|
867
|
+
}, ki = {
|
|
868
|
+
resize: function() {
|
|
869
|
+
if (!this.disabled) {
|
|
870
|
+
var t = this.options, i = this.container, e = this.containerData, o = i.offsetWidth / e.width, r = i.offsetHeight / e.height, n = Math.abs(o - 1) > Math.abs(r - 1) ? o : r;
|
|
871
|
+
if (n !== 1) {
|
|
872
|
+
var s, d;
|
|
873
|
+
t.restore && (s = this.getCanvasData(), d = this.getCropBoxData()), this.render(), t.restore && (this.setCanvasData(C(s, function(l, h) {
|
|
874
|
+
s[h] = l * n;
|
|
875
|
+
})), this.setCropBoxData(C(d, function(l, h) {
|
|
876
|
+
d[h] = l * n;
|
|
877
|
+
})));
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
dblclick: function() {
|
|
882
|
+
this.disabled || this.options.dragMode === xe || this.setDragMode(vi(this.dragBox, Ot) ? ye : zt);
|
|
883
|
+
},
|
|
884
|
+
wheel: function(t) {
|
|
885
|
+
var i = this, e = Number(this.options.wheelZoomRatio) || 0.1, o = 1;
|
|
886
|
+
this.disabled || (t.preventDefault(), !this.wheeling && (this.wheeling = !0, setTimeout(function() {
|
|
887
|
+
i.wheeling = !1;
|
|
888
|
+
}, 50), t.deltaY ? o = t.deltaY > 0 ? 1 : -1 : t.wheelDelta ? o = -t.wheelDelta / 120 : t.detail && (o = t.detail > 0 ? 1 : -1), this.zoom(-o * e, t)));
|
|
889
|
+
},
|
|
890
|
+
cropStart: function(t) {
|
|
891
|
+
var i = t.buttons, e = t.button;
|
|
892
|
+
if (!(this.disabled || (t.type === "mousedown" || t.type === "pointerdown" && t.pointerType === "mouse") && // No primary button (Usually the left button)
|
|
893
|
+
(w(i) && i !== 1 || w(e) && e !== 0 || t.ctrlKey))) {
|
|
894
|
+
var o = this.options, r = this.pointers, n;
|
|
895
|
+
t.changedTouches ? C(t.changedTouches, function(s) {
|
|
896
|
+
r[s.identifier] = vt(s);
|
|
897
|
+
}) : r[t.pointerId || 0] = vt(t), Object.keys(r).length > 1 && o.zoomable && o.zoomOnTouch ? n = be : n = kt(t.target, dt), si.test(n) && ot(this.element, St, {
|
|
898
|
+
originalEvent: t,
|
|
899
|
+
action: n
|
|
900
|
+
}) !== !1 && (t.preventDefault(), this.action = n, this.cropping = !1, n === ve && (this.cropping = !0, O(this.dragBox, bt)));
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
cropMove: function(t) {
|
|
904
|
+
var i = this.action;
|
|
905
|
+
if (!(this.disabled || !i)) {
|
|
906
|
+
var e = this.pointers;
|
|
907
|
+
t.preventDefault(), ot(this.element, _t, {
|
|
908
|
+
originalEvent: t,
|
|
909
|
+
action: i
|
|
910
|
+
}) !== !1 && (t.changedTouches ? C(t.changedTouches, function(o) {
|
|
911
|
+
D(e[o.identifier] || {}, vt(o, !0));
|
|
912
|
+
}) : D(e[t.pointerId || 0] || {}, vt(t, !0)), this.change(t));
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
cropEnd: function(t) {
|
|
916
|
+
if (!this.disabled) {
|
|
917
|
+
var i = this.action, e = this.pointers;
|
|
918
|
+
t.changedTouches ? C(t.changedTouches, function(o) {
|
|
919
|
+
delete e[o.identifier];
|
|
920
|
+
}) : delete e[t.pointerId || 0], i && (t.preventDefault(), Object.keys(e).length || (this.action = ""), this.cropping && (this.cropping = !1, rt(this.dragBox, bt, this.cropped && this.options.modal)), ot(this.element, Nt, {
|
|
921
|
+
originalEvent: t,
|
|
922
|
+
action: i
|
|
923
|
+
}));
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}, Li = {
|
|
927
|
+
change: function(t) {
|
|
928
|
+
var i = this.options, e = this.canvasData, o = this.containerData, r = this.cropBoxData, n = this.pointers, s = this.action, d = i.aspectRatio, l = r.left, h = r.top, c = r.width, p = r.height, v = l + c, m = h + p, g = 0, u = 0, E = o.width, M = o.height, y = !0, B;
|
|
929
|
+
!d && t.shiftKey && (d = c && p ? c / p : 1), this.limited && (g = r.minLeft, u = r.minTop, E = g + Math.min(o.width, e.width, e.left + e.width), M = u + Math.min(o.height, e.height, e.top + e.height));
|
|
930
|
+
var A = n[Object.keys(n)[0]], f = {
|
|
931
|
+
x: A.endX - A.startX,
|
|
932
|
+
y: A.endY - A.startY
|
|
933
|
+
}, b = function(k) {
|
|
934
|
+
switch (k) {
|
|
935
|
+
case Z:
|
|
936
|
+
v + f.x > E && (f.x = E - v);
|
|
937
|
+
break;
|
|
938
|
+
case K:
|
|
939
|
+
l + f.x < g && (f.x = g - l);
|
|
940
|
+
break;
|
|
941
|
+
case F:
|
|
942
|
+
h + f.y < u && (f.y = u - h);
|
|
943
|
+
break;
|
|
944
|
+
case et:
|
|
945
|
+
m + f.y > M && (f.y = M - m);
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
switch (s) {
|
|
950
|
+
// Move crop box
|
|
951
|
+
case Pt:
|
|
952
|
+
l += f.x, h += f.y;
|
|
953
|
+
break;
|
|
954
|
+
// Resize crop box
|
|
955
|
+
case Z:
|
|
956
|
+
if (f.x >= 0 && (v >= E || d && (h <= u || m >= M))) {
|
|
957
|
+
y = !1;
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
960
|
+
b(Z), c += f.x, c < 0 && (s = K, c = -c, l -= c), d && (p = c / d, h += (r.height - p) / 2);
|
|
961
|
+
break;
|
|
962
|
+
case F:
|
|
963
|
+
if (f.y <= 0 && (h <= u || d && (l <= g || v >= E))) {
|
|
964
|
+
y = !1;
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
b(F), p -= f.y, h += f.y, p < 0 && (s = et, p = -p, h -= p), d && (c = p * d, l += (r.width - c) / 2);
|
|
968
|
+
break;
|
|
969
|
+
case K:
|
|
970
|
+
if (f.x <= 0 && (l <= g || d && (h <= u || m >= M))) {
|
|
971
|
+
y = !1;
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
b(K), c -= f.x, l += f.x, c < 0 && (s = Z, c = -c, l -= c), d && (p = c / d, h += (r.height - p) / 2);
|
|
975
|
+
break;
|
|
976
|
+
case et:
|
|
977
|
+
if (f.y >= 0 && (m >= M || d && (l <= g || v >= E))) {
|
|
978
|
+
y = !1;
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
b(et), p += f.y, p < 0 && (s = F, p = -p, h -= p), d && (c = p * d, l += (r.width - c) / 2);
|
|
982
|
+
break;
|
|
983
|
+
case st:
|
|
984
|
+
if (d) {
|
|
985
|
+
if (f.y <= 0 && (h <= u || v >= E)) {
|
|
986
|
+
y = !1;
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
b(F), p -= f.y, h += f.y, c = p * d;
|
|
990
|
+
} else
|
|
991
|
+
b(F), b(Z), f.x >= 0 ? v < E ? c += f.x : f.y <= 0 && h <= u && (y = !1) : c += f.x, f.y <= 0 ? h > u && (p -= f.y, h += f.y) : (p -= f.y, h += f.y);
|
|
992
|
+
c < 0 && p < 0 ? (s = lt, p = -p, c = -c, h -= p, l -= c) : c < 0 ? (s = ht, c = -c, l -= c) : p < 0 && (s = ct, p = -p, h -= p);
|
|
993
|
+
break;
|
|
994
|
+
case ht:
|
|
995
|
+
if (d) {
|
|
996
|
+
if (f.y <= 0 && (h <= u || l <= g)) {
|
|
997
|
+
y = !1;
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
b(F), p -= f.y, h += f.y, c = p * d, l += r.width - c;
|
|
1001
|
+
} else
|
|
1002
|
+
b(F), b(K), f.x <= 0 ? l > g ? (c -= f.x, l += f.x) : f.y <= 0 && h <= u && (y = !1) : (c -= f.x, l += f.x), f.y <= 0 ? h > u && (p -= f.y, h += f.y) : (p -= f.y, h += f.y);
|
|
1003
|
+
c < 0 && p < 0 ? (s = ct, p = -p, c = -c, h -= p, l -= c) : c < 0 ? (s = st, c = -c, l -= c) : p < 0 && (s = lt, p = -p, h -= p);
|
|
1004
|
+
break;
|
|
1005
|
+
case lt:
|
|
1006
|
+
if (d) {
|
|
1007
|
+
if (f.x <= 0 && (l <= g || m >= M)) {
|
|
1008
|
+
y = !1;
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
b(K), c -= f.x, l += f.x, p = c / d;
|
|
1012
|
+
} else
|
|
1013
|
+
b(et), b(K), f.x <= 0 ? l > g ? (c -= f.x, l += f.x) : f.y >= 0 && m >= M && (y = !1) : (c -= f.x, l += f.x), f.y >= 0 ? m < M && (p += f.y) : p += f.y;
|
|
1014
|
+
c < 0 && p < 0 ? (s = st, p = -p, c = -c, h -= p, l -= c) : c < 0 ? (s = ct, c = -c, l -= c) : p < 0 && (s = ht, p = -p, h -= p);
|
|
1015
|
+
break;
|
|
1016
|
+
case ct:
|
|
1017
|
+
if (d) {
|
|
1018
|
+
if (f.x >= 0 && (v >= E || m >= M)) {
|
|
1019
|
+
y = !1;
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
1022
|
+
b(Z), c += f.x, p = c / d;
|
|
1023
|
+
} else
|
|
1024
|
+
b(et), b(Z), f.x >= 0 ? v < E ? c += f.x : f.y >= 0 && m >= M && (y = !1) : c += f.x, f.y >= 0 ? m < M && (p += f.y) : p += f.y;
|
|
1025
|
+
c < 0 && p < 0 ? (s = ht, p = -p, c = -c, h -= p, l -= c) : c < 0 ? (s = lt, c = -c, l -= c) : p < 0 && (s = st, p = -p, h -= p);
|
|
1026
|
+
break;
|
|
1027
|
+
// Move canvas
|
|
1028
|
+
case we:
|
|
1029
|
+
this.move(f.x, f.y), y = !1;
|
|
1030
|
+
break;
|
|
1031
|
+
// Zoom canvas
|
|
1032
|
+
case be:
|
|
1033
|
+
this.zoom(xi(n), t), y = !1;
|
|
1034
|
+
break;
|
|
1035
|
+
// Create crop box
|
|
1036
|
+
case ve:
|
|
1037
|
+
if (!f.x || !f.y) {
|
|
1038
|
+
y = !1;
|
|
1039
|
+
break;
|
|
1040
|
+
}
|
|
1041
|
+
B = Oe(this.cropper), l = A.startX - B.left, h = A.startY - B.top, c = r.minWidth, p = r.minHeight, f.x > 0 ? s = f.y > 0 ? ct : st : f.x < 0 && (l -= c, s = f.y > 0 ? lt : ht), f.y < 0 && (h -= p), this.cropped || (H(this.cropBox, R), this.cropped = !0, this.limited && this.limitCropBox(!0, !0));
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
y && (r.width = c, r.height = p, r.left = l, r.top = h, this.action = s, this.renderCropBox()), C(n, function(T) {
|
|
1045
|
+
T.startX = T.endX, T.startY = T.endY;
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
}, Bi = {
|
|
1049
|
+
// Show the crop box manually
|
|
1050
|
+
crop: function() {
|
|
1051
|
+
return this.ready && !this.cropped && !this.disabled && (this.cropped = !0, this.limitCropBox(!0, !0), this.options.modal && O(this.dragBox, bt), H(this.cropBox, R), this.setCropBoxData(this.initialCropBoxData)), this;
|
|
1052
|
+
},
|
|
1053
|
+
// Reset the image and crop box to their initial states
|
|
1054
|
+
reset: function() {
|
|
1055
|
+
return this.ready && !this.disabled && (this.imageData = D({}, this.initialImageData), this.canvasData = D({}, this.initialCanvasData), this.cropBoxData = D({}, this.initialCropBoxData), this.renderCanvas(), this.cropped && this.renderCropBox()), this;
|
|
1056
|
+
},
|
|
1057
|
+
// Clear the crop box
|
|
1058
|
+
clear: function() {
|
|
1059
|
+
return this.cropped && !this.disabled && (D(this.cropBoxData, {
|
|
1060
|
+
left: 0,
|
|
1061
|
+
top: 0,
|
|
1062
|
+
width: 0,
|
|
1063
|
+
height: 0
|
|
1064
|
+
}), this.cropped = !1, this.renderCropBox(), this.limitCanvas(!0, !0), this.renderCanvas(), H(this.dragBox, bt), O(this.cropBox, R)), this;
|
|
1065
|
+
},
|
|
1066
|
+
/**
|
|
1067
|
+
* Replace the image's src and rebuild the cropper
|
|
1068
|
+
* @param {string} url - The new URL.
|
|
1069
|
+
* @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.
|
|
1070
|
+
* @returns {Cropper} this
|
|
1071
|
+
*/
|
|
1072
|
+
replace: function(t) {
|
|
1073
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
1074
|
+
return !this.disabled && t && (this.isImg && (this.element.src = t), i ? (this.url = t, this.image.src = t, this.ready && (this.viewBoxImage.src = t, C(this.previews, function(e) {
|
|
1075
|
+
e.getElementsByTagName("img")[0].src = t;
|
|
1076
|
+
}))) : (this.isImg && (this.replaced = !0), this.options.data = null, this.uncreate(), this.load(t))), this;
|
|
1077
|
+
},
|
|
1078
|
+
// Enable (unfreeze) the cropper
|
|
1079
|
+
enable: function() {
|
|
1080
|
+
return this.ready && this.disabled && (this.disabled = !1, H(this.cropper, Jt)), this;
|
|
1081
|
+
},
|
|
1082
|
+
// Disable (freeze) the cropper
|
|
1083
|
+
disable: function() {
|
|
1084
|
+
return this.ready && !this.disabled && (this.disabled = !0, O(this.cropper, Jt)), this;
|
|
1085
|
+
},
|
|
1086
|
+
/**
|
|
1087
|
+
* Destroy the cropper and remove the instance from the image
|
|
1088
|
+
* @returns {Cropper} this
|
|
1089
|
+
*/
|
|
1090
|
+
destroy: function() {
|
|
1091
|
+
var t = this.element;
|
|
1092
|
+
return t[x] ? (t[x] = void 0, this.isImg && this.replaced && (t.src = this.originalUrl), this.uncreate(), this) : this;
|
|
1093
|
+
},
|
|
1094
|
+
/**
|
|
1095
|
+
* Move the canvas with relative offsets
|
|
1096
|
+
* @param {number} offsetX - The relative offset distance on the x-axis.
|
|
1097
|
+
* @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.
|
|
1098
|
+
* @returns {Cropper} this
|
|
1099
|
+
*/
|
|
1100
|
+
move: function(t) {
|
|
1101
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, e = this.canvasData, o = e.left, r = e.top;
|
|
1102
|
+
return this.moveTo(Et(t) ? t : o + Number(t), Et(i) ? i : r + Number(i));
|
|
1103
|
+
},
|
|
1104
|
+
/**
|
|
1105
|
+
* Move the canvas to an absolute point
|
|
1106
|
+
* @param {number} x - The x-axis coordinate.
|
|
1107
|
+
* @param {number} [y=x] - The y-axis coordinate.
|
|
1108
|
+
* @returns {Cropper} this
|
|
1109
|
+
*/
|
|
1110
|
+
moveTo: function(t) {
|
|
1111
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, e = this.canvasData, o = !1;
|
|
1112
|
+
return t = Number(t), i = Number(i), this.ready && !this.disabled && this.options.movable && (w(t) && (e.left = t, o = !0), w(i) && (e.top = i, o = !0), o && this.renderCanvas(!0)), this;
|
|
1113
|
+
},
|
|
1114
|
+
/**
|
|
1115
|
+
* Zoom the canvas with a relative ratio
|
|
1116
|
+
* @param {number} ratio - The target ratio.
|
|
1117
|
+
* @param {Event} _originalEvent - The original event if any.
|
|
1118
|
+
* @returns {Cropper} this
|
|
1119
|
+
*/
|
|
1120
|
+
zoom: function(t, i) {
|
|
1121
|
+
var e = this.canvasData;
|
|
1122
|
+
return t = Number(t), t < 0 ? t = 1 / (1 - t) : t = 1 + t, this.zoomTo(e.width * t / e.naturalWidth, null, i);
|
|
1123
|
+
},
|
|
1124
|
+
/**
|
|
1125
|
+
* Zoom the canvas to an absolute ratio
|
|
1126
|
+
* @param {number} ratio - The target ratio.
|
|
1127
|
+
* @param {Object} pivot - The zoom pivot point coordinate.
|
|
1128
|
+
* @param {Event} _originalEvent - The original event if any.
|
|
1129
|
+
* @returns {Cropper} this
|
|
1130
|
+
*/
|
|
1131
|
+
zoomTo: function(t, i, e) {
|
|
1132
|
+
var o = this.options, r = this.canvasData, n = r.width, s = r.height, d = r.naturalWidth, l = r.naturalHeight;
|
|
1133
|
+
if (t = Number(t), t >= 0 && this.ready && !this.disabled && o.zoomable) {
|
|
1134
|
+
var h = d * t, c = l * t;
|
|
1135
|
+
if (ot(this.element, Rt, {
|
|
1136
|
+
ratio: t,
|
|
1137
|
+
oldRatio: n / d,
|
|
1138
|
+
originalEvent: e
|
|
1139
|
+
}) === !1)
|
|
1140
|
+
return this;
|
|
1141
|
+
if (e) {
|
|
1142
|
+
var p = this.pointers, v = Oe(this.cropper), m = p && Object.keys(p).length ? Di(p) : {
|
|
1143
|
+
pageX: e.pageX,
|
|
1144
|
+
pageY: e.pageY
|
|
1145
|
+
};
|
|
1146
|
+
r.left -= (h - n) * ((m.pageX - v.left - r.left) / n), r.top -= (c - s) * ((m.pageY - v.top - r.top) / s);
|
|
1147
|
+
} else at(i) && w(i.x) && w(i.y) ? (r.left -= (h - n) * ((i.x - r.left) / n), r.top -= (c - s) * ((i.y - r.top) / s)) : (r.left -= (h - n) / 2, r.top -= (c - s) / 2);
|
|
1148
|
+
r.width = h, r.height = c, this.renderCanvas(!0);
|
|
1149
|
+
}
|
|
1150
|
+
return this;
|
|
1151
|
+
},
|
|
1152
|
+
/**
|
|
1153
|
+
* Rotate the canvas with a relative degree
|
|
1154
|
+
* @param {number} degree - The rotate degree.
|
|
1155
|
+
* @returns {Cropper} this
|
|
1156
|
+
*/
|
|
1157
|
+
rotate: function(t) {
|
|
1158
|
+
return this.rotateTo((this.imageData.rotate || 0) + Number(t));
|
|
1159
|
+
},
|
|
1160
|
+
/**
|
|
1161
|
+
* Rotate the canvas to an absolute degree
|
|
1162
|
+
* @param {number} degree - The rotate degree.
|
|
1163
|
+
* @returns {Cropper} this
|
|
1164
|
+
*/
|
|
1165
|
+
rotateTo: function(t) {
|
|
1166
|
+
return t = Number(t), w(t) && this.ready && !this.disabled && this.options.rotatable && (this.imageData.rotate = t % 360, this.renderCanvas(!0, !0)), this;
|
|
1167
|
+
},
|
|
1168
|
+
/**
|
|
1169
|
+
* Scale the image on the x-axis.
|
|
1170
|
+
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
1171
|
+
* @returns {Cropper} this
|
|
1172
|
+
*/
|
|
1173
|
+
scaleX: function(t) {
|
|
1174
|
+
var i = this.imageData.scaleY;
|
|
1175
|
+
return this.scale(t, w(i) ? i : 1);
|
|
1176
|
+
},
|
|
1177
|
+
/**
|
|
1178
|
+
* Scale the image on the y-axis.
|
|
1179
|
+
* @param {number} scaleY - The scale ratio on the y-axis.
|
|
1180
|
+
* @returns {Cropper} this
|
|
1181
|
+
*/
|
|
1182
|
+
scaleY: function(t) {
|
|
1183
|
+
var i = this.imageData.scaleX;
|
|
1184
|
+
return this.scale(w(i) ? i : 1, t);
|
|
1185
|
+
},
|
|
1186
|
+
/**
|
|
1187
|
+
* Scale the image
|
|
1188
|
+
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
1189
|
+
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
|
|
1190
|
+
* @returns {Cropper} this
|
|
1191
|
+
*/
|
|
1192
|
+
scale: function(t) {
|
|
1193
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, e = this.imageData, o = !1;
|
|
1194
|
+
return t = Number(t), i = Number(i), this.ready && !this.disabled && this.options.scalable && (w(t) && (e.scaleX = t, o = !0), w(i) && (e.scaleY = i, o = !0), o && this.renderCanvas(!0, !0)), this;
|
|
1195
|
+
},
|
|
1196
|
+
/**
|
|
1197
|
+
* Get the cropped area position and size data (base on the original image)
|
|
1198
|
+
* @param {boolean} [rounded=false] - Indicate if round the data values or not.
|
|
1199
|
+
* @returns {Object} The result cropped data.
|
|
1200
|
+
*/
|
|
1201
|
+
getData: function() {
|
|
1202
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.options, e = this.imageData, o = this.canvasData, r = this.cropBoxData, n;
|
|
1203
|
+
if (this.ready && this.cropped) {
|
|
1204
|
+
n = {
|
|
1205
|
+
x: r.left - o.left,
|
|
1206
|
+
y: r.top - o.top,
|
|
1207
|
+
width: r.width,
|
|
1208
|
+
height: r.height
|
|
1209
|
+
};
|
|
1210
|
+
var s = e.width / e.naturalWidth;
|
|
1211
|
+
if (C(n, function(h, c) {
|
|
1212
|
+
n[c] = h / s;
|
|
1213
|
+
}), t) {
|
|
1214
|
+
var d = Math.round(n.y + n.height), l = Math.round(n.x + n.width);
|
|
1215
|
+
n.x = Math.round(n.x), n.y = Math.round(n.y), n.width = l - n.x, n.height = d - n.y;
|
|
1216
|
+
}
|
|
1217
|
+
} else
|
|
1218
|
+
n = {
|
|
1219
|
+
x: 0,
|
|
1220
|
+
y: 0,
|
|
1221
|
+
width: 0,
|
|
1222
|
+
height: 0
|
|
1223
|
+
};
|
|
1224
|
+
return i.rotatable && (n.rotate = e.rotate || 0), i.scalable && (n.scaleX = e.scaleX || 1, n.scaleY = e.scaleY || 1), n;
|
|
1225
|
+
},
|
|
1226
|
+
/**
|
|
1227
|
+
* Set the cropped area position and size with new data
|
|
1228
|
+
* @param {Object} data - The new data.
|
|
1229
|
+
* @returns {Cropper} this
|
|
1230
|
+
*/
|
|
1231
|
+
setData: function(t) {
|
|
1232
|
+
var i = this.options, e = this.imageData, o = this.canvasData, r = {};
|
|
1233
|
+
if (this.ready && !this.disabled && at(t)) {
|
|
1234
|
+
var n = !1;
|
|
1235
|
+
i.rotatable && w(t.rotate) && t.rotate !== e.rotate && (e.rotate = t.rotate, n = !0), i.scalable && (w(t.scaleX) && t.scaleX !== e.scaleX && (e.scaleX = t.scaleX, n = !0), w(t.scaleY) && t.scaleY !== e.scaleY && (e.scaleY = t.scaleY, n = !0)), n && this.renderCanvas(!0, !0);
|
|
1236
|
+
var s = e.width / e.naturalWidth;
|
|
1237
|
+
w(t.x) && (r.left = t.x * s + o.left), w(t.y) && (r.top = t.y * s + o.top), w(t.width) && (r.width = t.width * s), w(t.height) && (r.height = t.height * s), this.setCropBoxData(r);
|
|
1238
|
+
}
|
|
1239
|
+
return this;
|
|
1240
|
+
},
|
|
1241
|
+
/**
|
|
1242
|
+
* Get the container size data.
|
|
1243
|
+
* @returns {Object} The result container data.
|
|
1244
|
+
*/
|
|
1245
|
+
getContainerData: function() {
|
|
1246
|
+
return this.ready ? D({}, this.containerData) : {};
|
|
1247
|
+
},
|
|
1248
|
+
/**
|
|
1249
|
+
* Get the image position and size data.
|
|
1250
|
+
* @returns {Object} The result image data.
|
|
1251
|
+
*/
|
|
1252
|
+
getImageData: function() {
|
|
1253
|
+
return this.sized ? D({}, this.imageData) : {};
|
|
1254
|
+
},
|
|
1255
|
+
/**
|
|
1256
|
+
* Get the canvas position and size data.
|
|
1257
|
+
* @returns {Object} The result canvas data.
|
|
1258
|
+
*/
|
|
1259
|
+
getCanvasData: function() {
|
|
1260
|
+
var t = this.canvasData, i = {};
|
|
1261
|
+
return this.ready && C(["left", "top", "width", "height", "naturalWidth", "naturalHeight"], function(e) {
|
|
1262
|
+
i[e] = t[e];
|
|
1263
|
+
}), i;
|
|
1264
|
+
},
|
|
1265
|
+
/**
|
|
1266
|
+
* Set the canvas position and size with new data.
|
|
1267
|
+
* @param {Object} data - The new canvas data.
|
|
1268
|
+
* @returns {Cropper} this
|
|
1269
|
+
*/
|
|
1270
|
+
setCanvasData: function(t) {
|
|
1271
|
+
var i = this.canvasData, e = i.aspectRatio;
|
|
1272
|
+
return this.ready && !this.disabled && at(t) && (w(t.left) && (i.left = t.left), w(t.top) && (i.top = t.top), w(t.width) ? (i.width = t.width, i.height = t.width / e) : w(t.height) && (i.height = t.height, i.width = t.height * e), this.renderCanvas(!0)), this;
|
|
1273
|
+
},
|
|
1274
|
+
/**
|
|
1275
|
+
* Get the crop box position and size data.
|
|
1276
|
+
* @returns {Object} The result crop box data.
|
|
1277
|
+
*/
|
|
1278
|
+
getCropBoxData: function() {
|
|
1279
|
+
var t = this.cropBoxData, i;
|
|
1280
|
+
return this.ready && this.cropped && (i = {
|
|
1281
|
+
left: t.left,
|
|
1282
|
+
top: t.top,
|
|
1283
|
+
width: t.width,
|
|
1284
|
+
height: t.height
|
|
1285
|
+
}), i || {};
|
|
1286
|
+
},
|
|
1287
|
+
/**
|
|
1288
|
+
* Set the crop box position and size with new data.
|
|
1289
|
+
* @param {Object} data - The new crop box data.
|
|
1290
|
+
* @returns {Cropper} this
|
|
1291
|
+
*/
|
|
1292
|
+
setCropBoxData: function(t) {
|
|
1293
|
+
var i = this.cropBoxData, e = this.options.aspectRatio, o, r;
|
|
1294
|
+
return this.ready && this.cropped && !this.disabled && at(t) && (w(t.left) && (i.left = t.left), w(t.top) && (i.top = t.top), w(t.width) && t.width !== i.width && (o = !0, i.width = t.width), w(t.height) && t.height !== i.height && (r = !0, i.height = t.height), e && (o ? i.height = i.width / e : r && (i.width = i.height * e)), this.renderCropBox()), this;
|
|
1295
|
+
},
|
|
1296
|
+
/**
|
|
1297
|
+
* Get a canvas drawn the cropped image.
|
|
1298
|
+
* @param {Object} [options={}] - The config options.
|
|
1299
|
+
* @returns {HTMLCanvasElement} - The result canvas.
|
|
1300
|
+
*/
|
|
1301
|
+
getCroppedCanvas: function() {
|
|
1302
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1303
|
+
if (!this.ready || !window.HTMLCanvasElement)
|
|
1304
|
+
return null;
|
|
1305
|
+
var i = this.canvasData, e = Mi(this.image, this.imageData, i, t);
|
|
1306
|
+
if (!this.cropped)
|
|
1307
|
+
return e;
|
|
1308
|
+
var o = this.getData(t.rounded), r = o.x, n = o.y, s = o.width, d = o.height, l = e.width / Math.floor(i.naturalWidth);
|
|
1309
|
+
l !== 1 && (r *= l, n *= l, s *= l, d *= l);
|
|
1310
|
+
var h = s / d, c = J({
|
|
1311
|
+
aspectRatio: h,
|
|
1312
|
+
width: t.maxWidth || 1 / 0,
|
|
1313
|
+
height: t.maxHeight || 1 / 0
|
|
1314
|
+
}), p = J({
|
|
1315
|
+
aspectRatio: h,
|
|
1316
|
+
width: t.minWidth || 0,
|
|
1317
|
+
height: t.minHeight || 0
|
|
1318
|
+
}, "cover"), v = J({
|
|
1319
|
+
aspectRatio: h,
|
|
1320
|
+
width: t.width || (l !== 1 ? e.width : s),
|
|
1321
|
+
height: t.height || (l !== 1 ? e.height : d)
|
|
1322
|
+
}), m = v.width, g = v.height;
|
|
1323
|
+
m = Math.min(c.width, Math.max(p.width, m)), g = Math.min(c.height, Math.max(p.height, g));
|
|
1324
|
+
var u = document.createElement("canvas"), E = u.getContext("2d");
|
|
1325
|
+
u.width = nt(m), u.height = nt(g), E.fillStyle = t.fillColor || "transparent", E.fillRect(0, 0, m, g);
|
|
1326
|
+
var M = t.imageSmoothingEnabled, y = M === void 0 ? !0 : M, B = t.imageSmoothingQuality;
|
|
1327
|
+
E.imageSmoothingEnabled = y, B && (E.imageSmoothingQuality = B);
|
|
1328
|
+
var A = e.width, f = e.height, b = r, T = n, k, X, $, q, U, W;
|
|
1329
|
+
b <= -s || b > A ? (b = 0, k = 0, $ = 0, U = 0) : b <= 0 ? ($ = -b, b = 0, k = Math.min(A, s + b), U = k) : b <= A && ($ = 0, k = Math.min(s, A - b), U = k), k <= 0 || T <= -d || T > f ? (T = 0, X = 0, q = 0, W = 0) : T <= 0 ? (q = -T, T = 0, X = Math.min(f, d + T), W = X) : T <= f && (q = 0, X = Math.min(d, f - T), W = X);
|
|
1330
|
+
var N = [b, T, k, X];
|
|
1331
|
+
if (U > 0 && W > 0) {
|
|
1332
|
+
var Q = m / s;
|
|
1333
|
+
N.push($ * Q, q * Q, U * Q, W * Q);
|
|
1334
|
+
}
|
|
1335
|
+
return E.drawImage.apply(E, [e].concat(me(N.map(function(ut) {
|
|
1336
|
+
return Math.floor(nt(ut));
|
|
1337
|
+
})))), u;
|
|
1338
|
+
},
|
|
1339
|
+
/**
|
|
1340
|
+
* Change the aspect ratio of the crop box.
|
|
1341
|
+
* @param {number} aspectRatio - The new aspect ratio.
|
|
1342
|
+
* @returns {Cropper} this
|
|
1343
|
+
*/
|
|
1344
|
+
setAspectRatio: function(t) {
|
|
1345
|
+
var i = this.options;
|
|
1346
|
+
return !this.disabled && !Et(t) && (i.aspectRatio = Math.max(0, t) || NaN, this.ready && (this.initCropBox(), this.cropped && this.renderCropBox())), this;
|
|
1347
|
+
},
|
|
1348
|
+
/**
|
|
1349
|
+
* Change the drag mode.
|
|
1350
|
+
* @param {string} mode - The new drag mode.
|
|
1351
|
+
* @returns {Cropper} this
|
|
1352
|
+
*/
|
|
1353
|
+
setDragMode: function(t) {
|
|
1354
|
+
var i = this.options, e = this.dragBox, o = this.face;
|
|
1355
|
+
if (this.ready && !this.disabled) {
|
|
1356
|
+
var r = t === zt, n = i.movable && t === ye;
|
|
1357
|
+
t = r || n ? t : xe, i.dragMode = t, ft(e, dt, t), rt(e, Ot, r), rt(e, It, n), i.cropBoxMovable || (ft(o, dt, t), rt(o, Ot, r), rt(o, It, n));
|
|
1358
|
+
}
|
|
1359
|
+
return this;
|
|
1360
|
+
}
|
|
1361
|
+
}, Pi = j.Cropper, Ae = /* @__PURE__ */ function() {
|
|
1362
|
+
function a(t) {
|
|
1363
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1364
|
+
if (qe(this, a), !t || !li.test(t.tagName))
|
|
1365
|
+
throw new Error("The first argument is required and must be an <img> or <canvas> element.");
|
|
1366
|
+
this.element = t, this.options = D({}, re, at(i) && i), this.cropped = !1, this.disabled = !1, this.pointers = {}, this.ready = !1, this.reloading = !1, this.replaced = !1, this.sized = !1, this.sizing = !1, this.init();
|
|
1367
|
+
}
|
|
1368
|
+
return Qe(a, [{
|
|
1369
|
+
key: "init",
|
|
1370
|
+
value: function() {
|
|
1371
|
+
var i = this.element, e = i.tagName.toLowerCase(), o;
|
|
1372
|
+
if (!i[x]) {
|
|
1373
|
+
if (i[x] = this, e === "img") {
|
|
1374
|
+
if (this.isImg = !0, o = i.getAttribute("src") || "", this.originalUrl = o, !o)
|
|
1375
|
+
return;
|
|
1376
|
+
o = i.src;
|
|
1377
|
+
} else e === "canvas" && window.HTMLCanvasElement && (o = i.toDataURL());
|
|
1378
|
+
this.load(o);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}, {
|
|
1382
|
+
key: "load",
|
|
1383
|
+
value: function(i) {
|
|
1384
|
+
var e = this;
|
|
1385
|
+
if (i) {
|
|
1386
|
+
this.url = i, this.imageData = {};
|
|
1387
|
+
var o = this.element, r = this.options;
|
|
1388
|
+
if (!r.rotatable && !r.scalable && (r.checkOrientation = !1), !r.checkOrientation || !window.ArrayBuffer) {
|
|
1389
|
+
this.clone();
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
if (hi.test(i)) {
|
|
1393
|
+
ci.test(i) ? this.read(Oi(i)) : this.clone();
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
var n = new XMLHttpRequest(), s = this.clone.bind(this);
|
|
1397
|
+
this.reloading = !0, this.xhr = n, n.onabort = s, n.onerror = s, n.ontimeout = s, n.onprogress = function() {
|
|
1398
|
+
n.getResponseHeader("content-type") !== ae && n.abort();
|
|
1399
|
+
}, n.onload = function() {
|
|
1400
|
+
e.read(n.response);
|
|
1401
|
+
}, n.onloadend = function() {
|
|
1402
|
+
e.reloading = !1, e.xhr = null;
|
|
1403
|
+
}, r.checkCrossOrigin && oe(i) && o.crossOrigin && (i = se(i)), n.open("GET", i, !0), n.responseType = "arraybuffer", n.withCredentials = o.crossOrigin === "use-credentials", n.send();
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}, {
|
|
1407
|
+
key: "read",
|
|
1408
|
+
value: function(i) {
|
|
1409
|
+
var e = this.options, o = this.imageData, r = Ai(i), n = 0, s = 1, d = 1;
|
|
1410
|
+
if (r > 1) {
|
|
1411
|
+
this.url = Ii(i, ae);
|
|
1412
|
+
var l = Ni(r);
|
|
1413
|
+
n = l.rotate, s = l.scaleX, d = l.scaleY;
|
|
1414
|
+
}
|
|
1415
|
+
e.rotatable && (o.rotate = n), e.scalable && (o.scaleX = s, o.scaleY = d), this.clone();
|
|
1416
|
+
}
|
|
1417
|
+
}, {
|
|
1418
|
+
key: "clone",
|
|
1419
|
+
value: function() {
|
|
1420
|
+
var i = this.element, e = this.url, o = i.crossOrigin, r = e;
|
|
1421
|
+
this.options.checkCrossOrigin && oe(e) && (o || (o = "anonymous"), r = se(e)), this.crossOrigin = o, this.crossOriginUrl = r;
|
|
1422
|
+
var n = document.createElement("img");
|
|
1423
|
+
o && (n.crossOrigin = o), n.src = r || e, n.alt = i.alt || "The image to crop", this.image = n, n.onload = this.start.bind(this), n.onerror = this.stop.bind(this), O(n, $t), i.parentNode.insertBefore(n, i.nextSibling);
|
|
1424
|
+
}
|
|
1425
|
+
}, {
|
|
1426
|
+
key: "start",
|
|
1427
|
+
value: function() {
|
|
1428
|
+
var i = this, e = this.image;
|
|
1429
|
+
e.onload = null, e.onerror = null, this.sizing = !0;
|
|
1430
|
+
var o = j.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(j.navigator.userAgent), r = function(l, h) {
|
|
1431
|
+
D(i.imageData, {
|
|
1432
|
+
naturalWidth: l,
|
|
1433
|
+
naturalHeight: h,
|
|
1434
|
+
aspectRatio: l / h
|
|
1435
|
+
}), i.initialImageData = D({}, i.imageData), i.sizing = !1, i.sized = !0, i.build();
|
|
1436
|
+
};
|
|
1437
|
+
if (e.naturalWidth && !o) {
|
|
1438
|
+
r(e.naturalWidth, e.naturalHeight);
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
var n = document.createElement("img"), s = document.body || document.documentElement;
|
|
1442
|
+
this.sizingImage = n, n.onload = function() {
|
|
1443
|
+
r(n.width, n.height), o || s.removeChild(n);
|
|
1444
|
+
}, n.src = e.src, o || (n.style.cssText = "left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;", s.appendChild(n));
|
|
1445
|
+
}
|
|
1446
|
+
}, {
|
|
1447
|
+
key: "stop",
|
|
1448
|
+
value: function() {
|
|
1449
|
+
var i = this.image;
|
|
1450
|
+
i.onload = null, i.onerror = null, i.parentNode.removeChild(i), this.image = null;
|
|
1451
|
+
}
|
|
1452
|
+
}, {
|
|
1453
|
+
key: "build",
|
|
1454
|
+
value: function() {
|
|
1455
|
+
if (!(!this.sized || this.ready)) {
|
|
1456
|
+
var i = this.element, e = this.options, o = this.image, r = i.parentNode, n = document.createElement("div");
|
|
1457
|
+
n.innerHTML = pi;
|
|
1458
|
+
var s = n.querySelector(".".concat(x, "-container")), d = s.querySelector(".".concat(x, "-canvas")), l = s.querySelector(".".concat(x, "-drag-box")), h = s.querySelector(".".concat(x, "-crop-box")), c = h.querySelector(".".concat(x, "-face"));
|
|
1459
|
+
this.container = r, this.cropper = s, this.canvas = d, this.dragBox = l, this.cropBox = h, this.viewBox = s.querySelector(".".concat(x, "-view-box")), this.face = c, d.appendChild(o), O(i, R), r.insertBefore(s, i.nextSibling), H(o, $t), this.initPreview(), this.bind(), e.initialAspectRatio = Math.max(0, e.initialAspectRatio) || NaN, e.aspectRatio = Math.max(0, e.aspectRatio) || NaN, e.viewMode = Math.max(0, Math.min(3, Math.round(e.viewMode))) || 0, O(h, R), e.guides || O(h.getElementsByClassName("".concat(x, "-dashed")), R), e.center || O(h.getElementsByClassName("".concat(x, "-center")), R), e.background && O(s, "".concat(x, "-bg")), e.highlight || O(c, ai), e.cropBoxMovable && (O(c, It), ft(c, dt, Pt)), e.cropBoxResizable || (O(h.getElementsByClassName("".concat(x, "-line")), R), O(h.getElementsByClassName("".concat(x, "-point")), R)), this.render(), this.ready = !0, this.setDragMode(e.dragMode), e.autoCrop && this.crop(), this.setData(e.data), S(e.ready) && L(i, te, e.ready, {
|
|
1460
|
+
once: !0
|
|
1461
|
+
}), ot(i, te);
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
}, {
|
|
1465
|
+
key: "unbuild",
|
|
1466
|
+
value: function() {
|
|
1467
|
+
if (this.ready) {
|
|
1468
|
+
this.ready = !1, this.unbind(), this.resetPreview();
|
|
1469
|
+
var i = this.cropper.parentNode;
|
|
1470
|
+
i && i.removeChild(this.cropper), H(this.element, R);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}, {
|
|
1474
|
+
key: "uncreate",
|
|
1475
|
+
value: function() {
|
|
1476
|
+
this.ready ? (this.unbuild(), this.ready = !1, this.cropped = !1) : this.sizing ? (this.sizingImage.onload = null, this.sizing = !1, this.sized = !1) : this.reloading ? (this.xhr.onabort = null, this.xhr.abort()) : this.image && this.stop();
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Get the no conflict cropper class.
|
|
1480
|
+
* @returns {Cropper} The cropper class.
|
|
1481
|
+
*/
|
|
1482
|
+
}], [{
|
|
1483
|
+
key: "noConflict",
|
|
1484
|
+
value: function() {
|
|
1485
|
+
return window.Cropper = Pi, a;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Change the default options.
|
|
1489
|
+
* @param {Object} options - The new default options.
|
|
1490
|
+
*/
|
|
1491
|
+
}, {
|
|
1492
|
+
key: "setDefaults",
|
|
1493
|
+
value: function(i) {
|
|
1494
|
+
D(re, at(i) && i);
|
|
1495
|
+
}
|
|
1496
|
+
}]);
|
|
1497
|
+
}();
|
|
1498
|
+
D(Ae.prototype, _i, Si, Ri, ki, Li, Bi);
|
|
1499
|
+
const zi = { style: { "text-align": "left" } }, Wi = { class: "cropper-warp" }, Yi = { class: "cropper-warp-left" }, Hi = ["src"], ji = { class: "cropper-warp-right" }, Xi = { class: "cropper-warp-right-item" }, Ui = { class: "cropper-warp-right-value" }, Vi = ["src"], Fi = { class: "cropper-warp-right-item" }, Gi = { class: "cropper-warp-right-value" }, Ji = ["src"], $i = { class: "dialog-footer" }, qi = /* @__PURE__ */ he({
|
|
1500
|
+
__name: "index",
|
|
1501
|
+
props: {
|
|
1502
|
+
title: {
|
|
1503
|
+
type: String,
|
|
1504
|
+
default: () => ""
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
emits: ["submitImage", "deleteImage"],
|
|
1508
|
+
setup(a, { expose: t, emit: i }) {
|
|
1509
|
+
const e = i, o = wt(), r = Se({
|
|
1510
|
+
isShowDialog: !1,
|
|
1511
|
+
cropperImg: "",
|
|
1512
|
+
cropperImgBase64: "",
|
|
1513
|
+
cropper: null
|
|
1514
|
+
}), n = (g) => {
|
|
1515
|
+
r.cropperImg = g, r.isShowDialog = !0, ke(() => {
|
|
1516
|
+
c();
|
|
1517
|
+
});
|
|
1518
|
+
}, s = () => {
|
|
1519
|
+
var g;
|
|
1520
|
+
(g = r.cropper) == null || g.destroy(), r.isShowDialog = !1;
|
|
1521
|
+
}, d = () => {
|
|
1522
|
+
s();
|
|
1523
|
+
}, l = async () => {
|
|
1524
|
+
const g = await p();
|
|
1525
|
+
e("submitImage", { file: g }), s();
|
|
1526
|
+
}, h = async () => {
|
|
1527
|
+
e("deleteImage");
|
|
1528
|
+
}, c = () => {
|
|
1529
|
+
const g = document.querySelector(".cropper-warp-left-img");
|
|
1530
|
+
g && g.setAttribute("crossOrigin", "anonymous"), r.cropper = new Ae(g, {
|
|
1531
|
+
viewMode: 1,
|
|
1532
|
+
dragMode: "none",
|
|
1533
|
+
initialAspectRatio: 1,
|
|
1534
|
+
aspectRatio: 1,
|
|
1535
|
+
preview: ".before",
|
|
1536
|
+
background: !0,
|
|
1537
|
+
autoCropArea: 1,
|
|
1538
|
+
// zoomOnWheel: false,
|
|
1539
|
+
checkCrossOrigin: !1,
|
|
1540
|
+
crop: () => {
|
|
1541
|
+
r.cropperImgBase64 = r.cropper.getCroppedCanvas().toDataURL("image/jpeg");
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1544
|
+
}, p = () => new Promise((g) => {
|
|
1545
|
+
r.cropper.getCroppedCanvas().toBlob((u) => {
|
|
1546
|
+
g(u);
|
|
1547
|
+
});
|
|
1548
|
+
}), v = async (g) => {
|
|
1549
|
+
let u = window.URL || window.webkitURL;
|
|
1550
|
+
r.cropperImg = u.createObjectURL(g.raw), r.cropper.replace(r.cropperImg);
|
|
1551
|
+
}, m = (g) => {
|
|
1552
|
+
o.value.clearFiles();
|
|
1553
|
+
const u = g[0];
|
|
1554
|
+
u.uid = Ge(), o.value.handleStart(u);
|
|
1555
|
+
};
|
|
1556
|
+
return t({
|
|
1557
|
+
openDialog: n
|
|
1558
|
+
}), (g, u) => {
|
|
1559
|
+
const E = it("ele-Edit"), M = it("el-icon"), y = it("el-button"), B = it("el-upload"), A = it("el-dialog");
|
|
1560
|
+
return le(), ce("div", null, [
|
|
1561
|
+
Y(A, {
|
|
1562
|
+
modelValue: r.isShowDialog,
|
|
1563
|
+
"onUpdate:modelValue": u[0] || (u[0] = (f) => r.isShowDialog = f),
|
|
1564
|
+
width: "769px",
|
|
1565
|
+
"before-close": d
|
|
1566
|
+
}, {
|
|
1567
|
+
header: z(() => [
|
|
1568
|
+
I("div", zi, [
|
|
1569
|
+
Y(M, {
|
|
1570
|
+
size: "16",
|
|
1571
|
+
style: { "margin-right": "3px", display: "inline", "vertical-align": "middle" }
|
|
1572
|
+
}, {
|
|
1573
|
+
default: z(() => [
|
|
1574
|
+
Y(E)
|
|
1575
|
+
]),
|
|
1576
|
+
_: 1
|
|
1577
|
+
}),
|
|
1578
|
+
I("span", null, Re(a.title), 1)
|
|
1579
|
+
])
|
|
1580
|
+
]),
|
|
1581
|
+
footer: z(() => [
|
|
1582
|
+
I("span", $i, [
|
|
1583
|
+
Y(B, {
|
|
1584
|
+
class: "avatar-uploader",
|
|
1585
|
+
ref_key: "uploadSignRef",
|
|
1586
|
+
ref: o,
|
|
1587
|
+
accept: ".jpg,.png",
|
|
1588
|
+
limit: 1,
|
|
1589
|
+
"show-file-list": !1,
|
|
1590
|
+
"auto-upload": !1,
|
|
1591
|
+
"on-change": v,
|
|
1592
|
+
"on-exceed": m
|
|
1593
|
+
}, {
|
|
1594
|
+
trigger: z(() => [
|
|
1595
|
+
Y(y, {
|
|
1596
|
+
type: "info",
|
|
1597
|
+
icon: "ele-Picture"
|
|
1598
|
+
}, {
|
|
1599
|
+
default: z(() => u[4] || (u[4] = [
|
|
1600
|
+
gt("选择图片")
|
|
1601
|
+
])),
|
|
1602
|
+
_: 1,
|
|
1603
|
+
__: [4]
|
|
1604
|
+
})
|
|
1605
|
+
]),
|
|
1606
|
+
default: z(() => [
|
|
1607
|
+
Y(y, {
|
|
1608
|
+
onClick: h,
|
|
1609
|
+
type: "danger",
|
|
1610
|
+
icon: "ele-Picture",
|
|
1611
|
+
style: { "margin-left": "8px" }
|
|
1612
|
+
}, {
|
|
1613
|
+
default: z(() => u[5] || (u[5] = [
|
|
1614
|
+
gt("删除图片")
|
|
1615
|
+
])),
|
|
1616
|
+
_: 1,
|
|
1617
|
+
__: [5]
|
|
1618
|
+
})
|
|
1619
|
+
]),
|
|
1620
|
+
_: 1
|
|
1621
|
+
}, 512),
|
|
1622
|
+
I("div", null, [
|
|
1623
|
+
Y(y, { onClick: d }, {
|
|
1624
|
+
default: z(() => u[6] || (u[6] = [
|
|
1625
|
+
gt("取 消")
|
|
1626
|
+
])),
|
|
1627
|
+
_: 1,
|
|
1628
|
+
__: [6]
|
|
1629
|
+
}),
|
|
1630
|
+
Y(y, {
|
|
1631
|
+
type: "primary",
|
|
1632
|
+
onClick: l
|
|
1633
|
+
}, {
|
|
1634
|
+
default: z(() => u[7] || (u[7] = [
|
|
1635
|
+
gt("确 定")
|
|
1636
|
+
])),
|
|
1637
|
+
_: 1,
|
|
1638
|
+
__: [7]
|
|
1639
|
+
})
|
|
1640
|
+
])
|
|
1641
|
+
])
|
|
1642
|
+
]),
|
|
1643
|
+
default: z(() => [
|
|
1644
|
+
I("div", Wi, [
|
|
1645
|
+
I("div", Yi, [
|
|
1646
|
+
I("img", {
|
|
1647
|
+
src: r.cropperImg,
|
|
1648
|
+
class: "cropper-warp-left-img"
|
|
1649
|
+
}, null, 8, Hi)
|
|
1650
|
+
]),
|
|
1651
|
+
I("div", ji, [
|
|
1652
|
+
u[3] || (u[3] = I("div", { class: "cropper-warp-right-title" }, "预览", -1)),
|
|
1653
|
+
I("div", Xi, [
|
|
1654
|
+
I("div", Ui, [
|
|
1655
|
+
I("img", {
|
|
1656
|
+
src: r.cropperImgBase64,
|
|
1657
|
+
class: "cropper-warp-right-value-img"
|
|
1658
|
+
}, null, 8, Vi)
|
|
1659
|
+
]),
|
|
1660
|
+
u[1] || (u[1] = I("div", { class: "cropper-warp-right-label" }, "100 x 100", -1))
|
|
1661
|
+
]),
|
|
1662
|
+
I("div", Fi, [
|
|
1663
|
+
I("div", Gi, [
|
|
1664
|
+
I("img", {
|
|
1665
|
+
src: r.cropperImgBase64,
|
|
1666
|
+
class: "cropper-warp-right-value-img cropper-size"
|
|
1667
|
+
}, null, 8, Ji)
|
|
1668
|
+
]),
|
|
1669
|
+
u[2] || (u[2] = I("div", { class: "cropper-warp-right-label" }, "50 x 50", -1))
|
|
1670
|
+
])
|
|
1671
|
+
])
|
|
1672
|
+
])
|
|
1673
|
+
]),
|
|
1674
|
+
_: 1
|
|
1675
|
+
}, 8, ["modelValue"])
|
|
1676
|
+
]);
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
}), Qi = /* @__PURE__ */ fe(qi, [["__scopeId", "data-v-6742e05e"]]);
|
|
1680
|
+
function na(a, t) {
|
|
1681
|
+
return de({
|
|
1682
|
+
url: a,
|
|
1683
|
+
method: "post",
|
|
1684
|
+
data: t,
|
|
1685
|
+
headers: {
|
|
1686
|
+
Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjEzMDAwMDAwMDAxMDEsIlRlbmFudElkIjoxMzAwMDAwMDAwMDAxLCJBY2NvdW50Ijoic3VwZXJhZG1pbiIsIlJlYWxOYW1lIjoi6LaF57qn566h55CG5ZGYIiwiQWNjb3VudFR5cGUiOjk5OSwiT3JnSWQiOjAsIk9yZ05hbWUiOm51bGwsIk9yZ1R5cGUiOm51bGwsImlhdCI6MTc0OTcwOTM0NCwibmJmIjoxNzQ5NzA5MzQ0LCJleHAiOjE3NTAzMTQxNDQsImlzcyI6IkFkbWluLk5FVCIsImF1ZCI6IkFkbWluLk5FVCJ9.ITuVhBJHidiyS-D-3suoiot2YtjgKbj6x_YcN1NquW4",
|
|
1687
|
+
"Content-Type": "multipart/form-data"
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
function Zi(a, t) {
|
|
1692
|
+
return de({
|
|
1693
|
+
url: a,
|
|
1694
|
+
method: "post",
|
|
1695
|
+
data: t,
|
|
1696
|
+
headers: {
|
|
1697
|
+
Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjEzMDAwMDAwMDAxMDEsIlRlbmFudElkIjoxMzAwMDAwMDAwMDAxLCJBY2NvdW50Ijoic3VwZXJhZG1pbiIsIlJlYWxOYW1lIjoi6LaF57qn566h55CG5ZGYIiwiQWNjb3VudFR5cGUiOjk5OSwiT3JnSWQiOjAsIk9yZ05hbWUiOm51bGwsIk9yZ1R5cGUiOm51bGwsImlhdCI6MTc0OTcwOTM0NCwibmJmIjoxNzQ5NzA5MzQ0LCJleHAiOjE3NTAzMTQxNDQsImlzcyI6IkFkbWluLk5FVCIsImF1ZCI6IkFkbWluLk5FVCJ9.ITuVhBJHidiyS-D-3suoiot2YtjgKbj6x_YcN1NquW4"
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
const Ki = /* @__PURE__ */ he({
|
|
1702
|
+
__name: "index",
|
|
1703
|
+
props: {
|
|
1704
|
+
apiUrl: {
|
|
1705
|
+
type: Object,
|
|
1706
|
+
default: {}
|
|
1707
|
+
}
|
|
1708
|
+
},
|
|
1709
|
+
emits: ["submitImage", "deleteImage"],
|
|
1710
|
+
setup(a, { emit: t }) {
|
|
1711
|
+
const i = a, e = wt(""), o = wt(""), r = wt(), n = t, s = () => {
|
|
1712
|
+
var h;
|
|
1713
|
+
(h = r.value) == null || h.openDialog("");
|
|
1714
|
+
}, d = async (h) => {
|
|
1715
|
+
n("submitImage", h);
|
|
1716
|
+
}, l = async () => {
|
|
1717
|
+
var h, c;
|
|
1718
|
+
try {
|
|
1719
|
+
if (console.log(1212, e.value), !e.value) return;
|
|
1720
|
+
const p = await Zi((h = i.apiUrl) == null ? void 0 : h.delete, { id: o.value });
|
|
1721
|
+
((c = p == null ? void 0 : p.data) == null ? void 0 : c.code) === 200 && n("deleteImage", !0);
|
|
1722
|
+
} catch (p) {
|
|
1723
|
+
Ye.error(p);
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
return (h, c) => {
|
|
1727
|
+
const p = it("el-avatar");
|
|
1728
|
+
return le(), ce(Le, null, [
|
|
1729
|
+
Y(p, {
|
|
1730
|
+
src: e.value,
|
|
1731
|
+
onClick: s,
|
|
1732
|
+
class: "avatar-wrap",
|
|
1733
|
+
fit: "contain"
|
|
1734
|
+
}, {
|
|
1735
|
+
default: z(() => [
|
|
1736
|
+
Be(h.$slots, "avatarDefault", {}, void 0, !0)
|
|
1737
|
+
]),
|
|
1738
|
+
_: 3
|
|
1739
|
+
}, 8, ["src"]),
|
|
1740
|
+
Y(Qi, {
|
|
1741
|
+
ref_key: "cropperDialogRef",
|
|
1742
|
+
ref: r,
|
|
1743
|
+
title: "更改头像",
|
|
1744
|
+
onSubmitImage: d,
|
|
1745
|
+
onDeleteImage: l
|
|
1746
|
+
}, null, 512)
|
|
1747
|
+
], 64);
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
}), oa = /* @__PURE__ */ fe(Ki, [["__scopeId", "data-v-d651400f"]]);
|
|
1751
|
+
export {
|
|
1752
|
+
oa as A,
|
|
1753
|
+
na as u
|
|
1754
|
+
};
|