@farris/ui-vue 1.3.4 → 1.3.6
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/components/accordion/index.esm.js +16 -16
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +65 -65
- package/components/avatar/index.umd.cjs +1 -1
- package/components/button-edit/index.esm.js +13 -13
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +504 -490
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +247 -233
- package/components/capsule/index.umd.cjs +1 -1
- package/components/checkbox/index.esm.js +356 -344
- package/components/checkbox/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +159 -145
- package/components/color-picker/index.umd.cjs +2 -2
- package/components/combo-list/index.esm.js +127 -128
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +15 -15
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/component/index.esm.js +101 -87
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.esm.js +9 -7
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +181 -167
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.esm.js +746 -730
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +9 -7
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.esm.js +789 -777
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/designer-canvas/index.esm.js +3096 -3069
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/dropdown/index.esm.js +257 -243
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.esm.js +322 -306
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +177 -163
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/event-parameter/index.esm.js +78 -82
- package/components/event-parameter/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +501 -487
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +37 -37
- package/components/expression-editor/index.umd.cjs +1 -1
- package/components/external-container/index.esm.js +487 -472
- package/components/external-container/index.umd.cjs +1 -1
- package/components/field-selector/index.esm.js +440 -433
- package/components/field-selector/index.umd.cjs +1 -1
- package/components/filter-bar/index.esm.js +594 -587
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/flow-canvas/index.esm.js +2766 -2739
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +402 -388
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/input-group/index.esm.js +201 -202
- package/components/input-group/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +264 -245
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +157 -143
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.esm.js +314 -298
- package/components/list-view/index.umd.cjs +1 -1
- package/components/lookup/index.esm.js +862 -843
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.esm.js +1031 -1015
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +169 -155
- package/components/nav/index.umd.cjs +2 -2
- package/components/number-range/index.esm.js +150 -137
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +207 -194
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.esm.js +427 -414
- package/components/order/index.umd.cjs +1 -1
- package/components/page-footer/index.esm.js +22 -22
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +510 -492
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +192 -178
- package/components/pagination/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +234 -220
- package/components/progress/index.umd.cjs +3 -3
- package/components/property-editor/index.esm.js +288 -277
- package/components/property-editor/index.umd.cjs +2 -2
- package/components/property-panel/index.esm.js +62 -61
- package/components/property-panel/index.umd.cjs +1 -1
- package/components/query-solution/index.esm.js +776 -770
- package/components/query-solution/index.umd.cjs +6 -6
- package/components/radio-button/index.esm.js +64 -64
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/radio-group/index.esm.js +296 -283
- package/components/radio-group/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +222 -208
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +187 -173
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.esm.js +554 -542
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +483 -469
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.esm.js +634 -619
- package/components/schema-selector/index.umd.cjs +2 -2
- package/components/search-box/index.esm.js +228 -214
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +419 -406
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +162 -148
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/splitter/index.esm.js +308 -284
- package/components/splitter/index.umd.cjs +1 -1
- package/components/step/index.esm.js +279 -265
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +183 -170
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.esm.js +307 -294
- package/components/tabs/index.umd.cjs +1 -1
- package/components/tags/index.esm.js +320 -306
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +245 -231
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +260 -247
- package/components/textarea/index.umd.cjs +1 -1
- package/components/time-picker/index.esm.js +409 -396
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/transfer/index.esm.js +424 -410
- package/components/transfer/index.umd.cjs +1 -1
- package/components/tree-grid/index.esm.js +383 -376
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +595 -575
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +325 -311
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +304 -290
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +99 -85
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +947 -933
- package/components/weather/index.umd.cjs +4 -4
- package/farris.all.esm.js +5492 -5470
- package/farris.all.umd.cjs +13 -13
- package/index.css +1 -1
- package/package.json +1 -1
- package/types/condition/src/composition/condition-value/input-group-value.d.ts +1 -1
- package/types/entity-binding-selector/composition/use-entity-tree.d.ts +3 -0
- package/types/entity-binding-selector/composition/use-field-tree.d.ts +1 -0
|
@@ -1,117 +1,131 @@
|
|
|
1
|
-
import { inject as Te, ref as
|
|
2
|
-
import { isPlainObject as Me, cloneDeep as
|
|
3
|
-
const
|
|
1
|
+
import { inject as Te, ref as h, onMounted as Ae, onUnmounted as ut, watch as K, defineComponent as Se, createVNode as S, withModifiers as I } from "vue";
|
|
2
|
+
import { isPlainObject as Me, cloneDeep as ze } from "lodash-es";
|
|
3
|
+
const Ee = {}, ke = {};
|
|
4
4
|
function ve(e) {
|
|
5
|
-
const { properties: i, title:
|
|
6
|
-
if (
|
|
7
|
-
const
|
|
8
|
-
t.id = `${
|
|
5
|
+
const { properties: i, title: n, ignore: d } = e, o = d && Array.isArray(d), t = Object.keys(i).reduce((c, g) => ((!o || !d.find((w) => w === g)) && (c[g] = i[g].type === "object" && i[g].properties ? ve(i[g]) : ze(i[g].default)), c), {});
|
|
6
|
+
if (n && (!o || !d.find((c) => c === "id"))) {
|
|
7
|
+
const c = n.toLowerCase().replace(/-/g, "_");
|
|
8
|
+
t.id = `${c}_${Math.random().toString().slice(2, 6)}`;
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
function rt(e) {
|
|
13
|
+
const { properties: i, title: n, required: d } = e;
|
|
14
|
+
if (d && Array.isArray(d)) {
|
|
15
|
+
const o = d.reduce((t, c) => (t[c] = i[c].type === "object" && i[c].properties ? ve(i[c]) : ze(i[c].default), t), {});
|
|
16
|
+
if (n && d.find((t) => t === "id")) {
|
|
17
|
+
const t = n.toLowerCase().replace(/-/g, "_");
|
|
18
|
+
o.id = `${t}_${Math.random().toString().slice(2, 6)}`;
|
|
19
|
+
}
|
|
20
|
+
return o;
|
|
18
21
|
}
|
|
19
|
-
return
|
|
22
|
+
return {
|
|
23
|
+
type: n
|
|
24
|
+
};
|
|
20
25
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
|
|
26
|
+
function De(e, i = {}, n) {
|
|
27
|
+
const d = Ee[e];
|
|
28
|
+
if (d) {
|
|
29
|
+
let o = rt(d);
|
|
30
|
+
const t = ke[e];
|
|
31
|
+
return o = t ? t({ getSchemaByType: De }, o, i, n) : o, o;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
24
34
|
}
|
|
25
35
|
function st(e, i) {
|
|
26
|
-
|
|
36
|
+
const n = ve(i);
|
|
37
|
+
return Object.keys(n).reduce((d, o) => (Object.prototype.hasOwnProperty.call(e, o) && (d[o] && Me(d[o]) && Me(e[o] || !e[o]) ? Object.assign(d[o], e[o] || {}) : d[o] = e[o]), d), n), n;
|
|
38
|
+
}
|
|
39
|
+
function ot(e, i) {
|
|
40
|
+
return Object.keys(e).filter((d) => e[d] != null).reduce((d, o) => {
|
|
27
41
|
if (i.has(o)) {
|
|
28
42
|
const t = i.get(o);
|
|
29
43
|
if (typeof t == "string")
|
|
30
|
-
|
|
44
|
+
d[t] = e[o];
|
|
31
45
|
else {
|
|
32
|
-
const
|
|
33
|
-
Object.assign(
|
|
46
|
+
const c = t(o, e[o], e);
|
|
47
|
+
Object.assign(d, c);
|
|
34
48
|
}
|
|
35
49
|
} else
|
|
36
|
-
|
|
37
|
-
return
|
|
50
|
+
d[o] = e[o];
|
|
51
|
+
return d;
|
|
38
52
|
}, {});
|
|
39
53
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
return
|
|
54
|
+
function ct(e, i, n = /* @__PURE__ */ new Map()) {
|
|
55
|
+
const d = st(e, i);
|
|
56
|
+
return ot(d, n);
|
|
43
57
|
}
|
|
44
|
-
function
|
|
45
|
-
function i(s, y,
|
|
46
|
-
if (typeof
|
|
47
|
-
return l[s].length ===
|
|
48
|
-
if (typeof
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
58
|
+
function ft(e = {}) {
|
|
59
|
+
function i(s, y, p, l) {
|
|
60
|
+
if (typeof p == "number")
|
|
61
|
+
return l[s].length === p;
|
|
62
|
+
if (typeof p == "object") {
|
|
63
|
+
const r = Object.keys(p)[0], T = p[r];
|
|
64
|
+
if (r === "not")
|
|
51
65
|
return Number(l[s].length) !== Number(T);
|
|
52
|
-
if (
|
|
66
|
+
if (r === "moreThan")
|
|
53
67
|
return Number(l[s].length) >= Number(T);
|
|
54
|
-
if (
|
|
68
|
+
if (r === "lessThan")
|
|
55
69
|
return Number(l[s].length) <= Number(T);
|
|
56
70
|
}
|
|
57
71
|
return !1;
|
|
58
72
|
}
|
|
59
|
-
function
|
|
60
|
-
return l[s] && l[s].propertyValue && String(l[s].propertyValue.value) === String(
|
|
73
|
+
function n(s, y, p, l) {
|
|
74
|
+
return l[s] && l[s].propertyValue && String(l[s].propertyValue.value) === String(p);
|
|
61
75
|
}
|
|
62
|
-
const
|
|
76
|
+
const d = /* @__PURE__ */ new Map([
|
|
63
77
|
["length", i],
|
|
64
|
-
["getProperty",
|
|
78
|
+
["getProperty", n]
|
|
65
79
|
]);
|
|
66
|
-
Object.keys(e).reduce((s, y) => (s.set(y, e[y]), s),
|
|
80
|
+
Object.keys(e).reduce((s, y) => (s.set(y, e[y]), s), d);
|
|
67
81
|
function o(s, y) {
|
|
68
|
-
const
|
|
69
|
-
return typeof y == "number" ? [{ target:
|
|
82
|
+
const p = s;
|
|
83
|
+
return typeof y == "number" ? [{ target: p, operator: "length", param: null, value: Number(y) }] : typeof y == "boolean" ? [{ target: p, operator: "getProperty", param: s, value: !!y }] : typeof y == "object" ? Object.keys(y).map((l) => {
|
|
70
84
|
if (l === "length")
|
|
71
|
-
return { target:
|
|
72
|
-
const
|
|
73
|
-
return { target:
|
|
85
|
+
return { target: p, operator: "length", param: null, value: y[l] };
|
|
86
|
+
const r = l, T = y[l];
|
|
87
|
+
return { target: p, operator: "getProperty", param: r, value: T };
|
|
74
88
|
}) : [];
|
|
75
89
|
}
|
|
76
90
|
function t(s) {
|
|
77
|
-
return Object.keys(s).reduce((
|
|
78
|
-
const
|
|
79
|
-
return
|
|
91
|
+
return Object.keys(s).reduce((p, l) => {
|
|
92
|
+
const r = o(l, s[l]);
|
|
93
|
+
return p.push(...r), p;
|
|
80
94
|
}, []);
|
|
81
95
|
}
|
|
82
|
-
function
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
return
|
|
96
|
+
function c(s, y) {
|
|
97
|
+
if (d.has(s.operator)) {
|
|
98
|
+
const p = d.get(s.operator);
|
|
99
|
+
return p && p(s.target, s.param, s.value, y) || !1;
|
|
86
100
|
}
|
|
87
101
|
return !1;
|
|
88
102
|
}
|
|
89
103
|
function g(s, y) {
|
|
90
|
-
return t(s).reduce((
|
|
104
|
+
return t(s).reduce((r, T) => r && c(T, y), !0);
|
|
91
105
|
}
|
|
92
106
|
function w(s, y) {
|
|
93
|
-
const
|
|
94
|
-
return l ? !
|
|
107
|
+
const p = Object.keys(s), l = p.includes("allOf"), r = p.includes("anyOf"), T = l || r, L = (T ? s[T ? l ? "allOf" : "anyOf" : "allOf"] : [s]).map((B) => g(B, y));
|
|
108
|
+
return l ? !L.includes(!1) : L.includes(!0);
|
|
95
109
|
}
|
|
96
110
|
return { parseValueSchema: w };
|
|
97
111
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
function
|
|
101
|
-
return
|
|
102
|
-
const g =
|
|
112
|
+
const vt = {}, ht = {};
|
|
113
|
+
ft();
|
|
114
|
+
function dt(e, i, n = /* @__PURE__ */ new Map(), d = (c, g, w, s) => g, o = {}, t = (c) => c) {
|
|
115
|
+
return Ee[i.title] = i, ke[i.title] = d, vt[i.title] = o, ht[i.title] = t, (c = {}) => {
|
|
116
|
+
const g = ct(c, i, n), w = Object.keys(e).reduce((s, y) => (s[y] = e[y].default, s), {});
|
|
103
117
|
return Object.assign(w, g);
|
|
104
118
|
};
|
|
105
119
|
}
|
|
106
120
|
function gt(e, i) {
|
|
107
121
|
return { customClass: i.class, customStyle: i.style };
|
|
108
122
|
}
|
|
109
|
-
function
|
|
123
|
+
function mt(e, i, n) {
|
|
110
124
|
return i;
|
|
111
125
|
}
|
|
112
|
-
const
|
|
126
|
+
const pt = /* @__PURE__ */ new Map([
|
|
113
127
|
["appearance", gt]
|
|
114
|
-
]),
|
|
128
|
+
]), yt = "https://json-schema.org/draft/2020-12/schema", xt = "https://farris-design.gitee.io/image-cropper.schema.json", bt = "image-cropper", Mt = "A Farris Component", wt = "object", Tt = {
|
|
115
129
|
id: {
|
|
116
130
|
description: "The unique identifier for image-cropper",
|
|
117
131
|
type: "string"
|
|
@@ -173,18 +187,18 @@ const mt = /* @__PURE__ */ new Map([
|
|
|
173
187
|
type: "boolean",
|
|
174
188
|
default: !0
|
|
175
189
|
}
|
|
176
|
-
},
|
|
190
|
+
}, At = [
|
|
177
191
|
"id",
|
|
178
192
|
"type"
|
|
179
|
-
],
|
|
180
|
-
$schema:
|
|
181
|
-
$id:
|
|
182
|
-
title:
|
|
183
|
-
description:
|
|
184
|
-
type:
|
|
185
|
-
properties:
|
|
186
|
-
required:
|
|
187
|
-
},
|
|
193
|
+
], St = {
|
|
194
|
+
$schema: yt,
|
|
195
|
+
$id: xt,
|
|
196
|
+
title: bt,
|
|
197
|
+
description: Mt,
|
|
198
|
+
type: wt,
|
|
199
|
+
properties: Tt,
|
|
200
|
+
required: At
|
|
201
|
+
}, zt = "image-cropper", Et = "A Farris Component", kt = "object", Dt = {
|
|
188
202
|
basic: {
|
|
189
203
|
description: "Basic Infomation",
|
|
190
204
|
title: "基本信息",
|
|
@@ -237,11 +251,11 @@ const mt = /* @__PURE__ */ new Map([
|
|
|
237
251
|
}
|
|
238
252
|
}
|
|
239
253
|
}
|
|
240
|
-
},
|
|
241
|
-
title:
|
|
242
|
-
description:
|
|
243
|
-
type:
|
|
244
|
-
categories:
|
|
254
|
+
}, Bt = {
|
|
255
|
+
title: zt,
|
|
256
|
+
description: Et,
|
|
257
|
+
type: kt,
|
|
258
|
+
categories: Dt
|
|
245
259
|
}, he = {
|
|
246
260
|
/** 输出图片格式 */
|
|
247
261
|
format: { type: String, default: "png" },
|
|
@@ -299,9 +313,9 @@ const mt = /* @__PURE__ */ new Map([
|
|
|
299
313
|
y2: 1e4
|
|
300
314
|
}
|
|
301
315
|
}
|
|
302
|
-
}, we =
|
|
316
|
+
}, we = dt(he, St, pt, mt, Bt);
|
|
303
317
|
var ae = /* @__PURE__ */ ((e) => (e.Move = "move", e.Resize = "resize", e))(ae || {});
|
|
304
|
-
function
|
|
318
|
+
function Ct() {
|
|
305
319
|
function e(o) {
|
|
306
320
|
switch (typeof o == "string" && (o = i(o)), o) {
|
|
307
321
|
case 2:
|
|
@@ -323,12 +337,12 @@ function Bt() {
|
|
|
323
337
|
}
|
|
324
338
|
}
|
|
325
339
|
function i(o) {
|
|
326
|
-
const t = new DataView(
|
|
340
|
+
const t = new DataView(n(o));
|
|
327
341
|
if (t.getUint16(0, !1) !== 65496)
|
|
328
342
|
return -2;
|
|
329
|
-
const
|
|
343
|
+
const c = t.byteLength;
|
|
330
344
|
let g = 2;
|
|
331
|
-
for (; g <
|
|
345
|
+
for (; g < c; ) {
|
|
332
346
|
if (t.getUint16(g + 2, !1) <= 8)
|
|
333
347
|
return -1;
|
|
334
348
|
const w = t.getUint16(g, !1);
|
|
@@ -339,9 +353,9 @@ function Bt() {
|
|
|
339
353
|
g += t.getUint32(g + 4, s);
|
|
340
354
|
const y = t.getUint16(g, s);
|
|
341
355
|
g += 2;
|
|
342
|
-
for (let
|
|
343
|
-
if (t.getUint16(g +
|
|
344
|
-
return t.getUint16(g +
|
|
356
|
+
for (let p = 0; p < y; p++)
|
|
357
|
+
if (t.getUint16(g + p * 12, s) === 274)
|
|
358
|
+
return t.getUint16(g + p * 12 + 8, s);
|
|
345
359
|
} else {
|
|
346
360
|
if ((w & 65280) !== 65280)
|
|
347
361
|
break;
|
|
@@ -350,74 +364,74 @@ function Bt() {
|
|
|
350
364
|
}
|
|
351
365
|
return -1;
|
|
352
366
|
}
|
|
353
|
-
function
|
|
367
|
+
function n(o) {
|
|
354
368
|
o = o.replace(/^data:([^;]+);base64,/gmi, "");
|
|
355
|
-
const t = atob(o),
|
|
356
|
-
for (let w = 0; w <
|
|
369
|
+
const t = atob(o), c = t.length, g = new Uint8Array(c);
|
|
370
|
+
for (let w = 0; w < c; w++)
|
|
357
371
|
g[w] = t.charCodeAt(w);
|
|
358
372
|
return g.buffer;
|
|
359
373
|
}
|
|
360
|
-
function
|
|
374
|
+
function d(o, t, c) {
|
|
361
375
|
const g = o.width, w = o.height;
|
|
362
|
-
t = Math.round(t),
|
|
363
|
-
const s = g / t, y = w /
|
|
364
|
-
if (
|
|
365
|
-
const T =
|
|
366
|
-
for (let R = 0; R <
|
|
376
|
+
t = Math.round(t), c = Math.round(c);
|
|
377
|
+
const s = g / t, y = w / c, p = Math.ceil(s / 2), l = Math.ceil(y / 2), r = o.getContext("2d");
|
|
378
|
+
if (r) {
|
|
379
|
+
const T = r.getImageData(0, 0, g, w), M = r.createImageData(t, c), { data: W } = T, L = M.data;
|
|
380
|
+
for (let R = 0; R < c; R++)
|
|
367
381
|
for (let B = 0; B < t; B++) {
|
|
368
|
-
const j = (B + R * t) * 4,
|
|
369
|
-
let A = 0,
|
|
370
|
-
const
|
|
382
|
+
const j = (B + R * t) * 4, m = R * y;
|
|
383
|
+
let A = 0, f = 0, b = 0, V = 0, Q = 0, D = 0, E = 0;
|
|
384
|
+
const H = Math.floor(B * s), C = Math.floor(R * y);
|
|
371
385
|
let q = Math.ceil((B + 1) * s), J = Math.ceil((R + 1) * y);
|
|
372
386
|
q = Math.min(q, g), J = Math.min(J, w);
|
|
373
|
-
for (let
|
|
374
|
-
const z = Math.abs(
|
|
375
|
-
for (let U =
|
|
376
|
-
const N = Math.abs(ie - U) /
|
|
377
|
-
if (
|
|
387
|
+
for (let P = C; P < J; P++) {
|
|
388
|
+
const z = Math.abs(m - P) / l, ie = B * s, ee = z * z;
|
|
389
|
+
for (let U = H; U < q; U++) {
|
|
390
|
+
const N = Math.abs(ie - U) / p, _ = Math.sqrt(ee + N * N);
|
|
391
|
+
if (_ >= 1)
|
|
378
392
|
continue;
|
|
379
|
-
A = 2 *
|
|
380
|
-
const
|
|
381
|
-
E += A *
|
|
393
|
+
A = 2 * _ * _ * _ - 3 * _ * _ + 1;
|
|
394
|
+
const O = 4 * (U + P * g);
|
|
395
|
+
E += A * W[O + 3], b += A, W[O + 3] < 255 && (A = A * W[O + 3] / 250), V += A * W[O], Q += A * W[O + 1], D += A * W[O + 2], f += A;
|
|
382
396
|
}
|
|
383
397
|
}
|
|
384
|
-
|
|
398
|
+
L[j] = V / f, L[j + 1] = Q / f, L[j + 2] = D / f, L[j + 3] = E / b;
|
|
385
399
|
}
|
|
386
|
-
o.width = t, o.height =
|
|
400
|
+
o.width = t, o.height = c, r.putImageData(M, 0, 0);
|
|
387
401
|
}
|
|
388
402
|
}
|
|
389
403
|
return {
|
|
390
|
-
resizeCanvas:
|
|
404
|
+
resizeCanvas: d,
|
|
391
405
|
getTransformationsFromExifData: e
|
|
392
406
|
};
|
|
393
407
|
}
|
|
394
|
-
function
|
|
395
|
-
function o(l,
|
|
396
|
-
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) *
|
|
408
|
+
function Lt(e, i, n, d) {
|
|
409
|
+
function o(l, r) {
|
|
410
|
+
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * n.value, l = Math.max(e.value.x2 - i.value.width, 0), r = Math.max(0 - e.value.y1, 0), (l > 0 || r > 0) && (e.value.x2 -= r * n.value > l ? r * n.value : l, e.value.y1 += r * n.value > l ? r : l / n.value);
|
|
397
411
|
}
|
|
398
|
-
function t(l,
|
|
399
|
-
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) *
|
|
412
|
+
function t(l, r) {
|
|
413
|
+
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * n.value, l = Math.max(e.value.x2 - i.value.width, 0), r = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || r > 0) && (e.value.x2 -= r * n.value > l ? r * n.value : l, e.value.y2 -= r * n.value > l ? r : l / n.value);
|
|
400
414
|
}
|
|
401
|
-
function
|
|
402
|
-
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) /
|
|
415
|
+
function c(l, r) {
|
|
416
|
+
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / n.value, l = Math.max(0 - e.value.x1, 0), r = Math.max(0 - e.value.y1, 0), (l > 0 || r > 0) && (e.value.x1 += r * n.value > l ? r * n.value : l, e.value.y1 += r * n.value > l ? r : l / n.value);
|
|
403
417
|
}
|
|
404
|
-
function g(l,
|
|
405
|
-
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) /
|
|
418
|
+
function g(l, r) {
|
|
419
|
+
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / n.value, l = Math.max(e.value.x2 - i.value.width, 0), r = Math.max(0 - e.value.y1, 0), (l > 0 || r > 0) && (e.value.x2 -= r * n.value > l ? r * n.value : l, e.value.y1 += r * n.value > l ? r : l / n.value);
|
|
406
420
|
}
|
|
407
|
-
function w(l,
|
|
408
|
-
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) /
|
|
421
|
+
function w(l, r) {
|
|
422
|
+
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / n.value, l = Math.max(e.value.x2 - i.value.width, 0), r = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || r > 0) && (e.value.x2 -= r * n.value > l ? r * n.value : l, e.value.y2 -= r * n.value > l ? r : l / n.value);
|
|
409
423
|
}
|
|
410
|
-
function s(l,
|
|
411
|
-
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) /
|
|
424
|
+
function s(l, r) {
|
|
425
|
+
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / n.value, l = Math.max(0 - e.value.x1, 0), r = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || r > 0) && (e.value.x1 += r * n.value > l ? r * n.value : l, e.value.y2 -= r * n.value > l ? r : l / n.value);
|
|
412
426
|
}
|
|
413
427
|
function y() {
|
|
414
|
-
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) *
|
|
415
|
-
const l = Math.max(0 - e.value.x1, 0),
|
|
416
|
-
(l > 0 ||
|
|
428
|
+
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * n.value, e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / n.value;
|
|
429
|
+
const l = Math.max(0 - e.value.x1, 0), r = Math.max(e.value.x2 - i.value.width, 0), T = Math.max(e.value.y2 - i.value.height, 0), M = Math.max(0 - e.value.y1, 0);
|
|
430
|
+
(l > 0 || r > 0 || T > 0 || M > 0) && (e.value.x1 += T * n.value > l ? T * n.value : l, e.value.x2 -= M * n.value > r ? M * n.value : r, e.value.y1 += M * n.value > r ? M : r / n.value, e.value.y2 -= T * n.value > l ? T : l / n.value);
|
|
417
431
|
}
|
|
418
|
-
function
|
|
432
|
+
function p() {
|
|
419
433
|
if (i.value.width && i.value.height)
|
|
420
|
-
switch (
|
|
434
|
+
switch (d.position) {
|
|
421
435
|
case "top":
|
|
422
436
|
o(0, 0);
|
|
423
437
|
break;
|
|
@@ -425,7 +439,7 @@ function Ct(e, i, r, p) {
|
|
|
425
439
|
t(0, 0);
|
|
426
440
|
break;
|
|
427
441
|
case "topleft":
|
|
428
|
-
|
|
442
|
+
c(0, 0);
|
|
429
443
|
break;
|
|
430
444
|
case "topright":
|
|
431
445
|
g(0, 0);
|
|
@@ -443,19 +457,19 @@ function Ct(e, i, r, p) {
|
|
|
443
457
|
break;
|
|
444
458
|
}
|
|
445
459
|
}
|
|
446
|
-
return { checkAspectRatio:
|
|
460
|
+
return { checkAspectRatio: p };
|
|
447
461
|
}
|
|
448
|
-
function
|
|
449
|
-
const { resizeCanvas:
|
|
450
|
-
let
|
|
451
|
-
const
|
|
452
|
-
let ee, U = 20, N = 20,
|
|
453
|
-
const
|
|
454
|
-
function
|
|
455
|
-
q.value = "scaleX(" + (
|
|
462
|
+
function Be(e, i) {
|
|
463
|
+
const { resizeCanvas: n, getTransformationsFromExifData: d } = Ct(), o = Te("NotifyService"), t = h(e.cropper), c = h(e.transform), g = h(e.cropperMinWidth), w = h(e.maintainAspectRatio), s = h(e.aspectRatio), y = h(e.autoCrop), p = h(e.backgroundColor), l = h(e.resizeToWidth), r = h(e.onlyScaleDown), T = h(e.containWithinAspectRatio), M = h(e.canvasRotation), W = h(e.format), L = h(e.imageQuality), R = h(e.resizeToHeight), B = h(e.cropperMinHeight), j = h(""), m = h(!0), A = h(!0);
|
|
464
|
+
let f, b, V = 0, Q, D, E;
|
|
465
|
+
const H = h(null), C = h(""), q = h(""), J = h("0px"), P = h(), z = h({ width: 100, height: 100 }), ie = ae;
|
|
466
|
+
let ee, U = 20, N = 20, _ = !1, O = { rotate: 0, flip: !1 }, x = { active: !1, type: null, position: null, x1: 0, y1: 0, x2: 0, y2: 0, clientX: 0, clientY: 0 };
|
|
467
|
+
const de = h(e.imageChangedEvent), le = h(e.imageURL), Ce = h(e.imageBase64), Le = h(e.imageFile);
|
|
468
|
+
function Pe() {
|
|
469
|
+
q.value = "scaleX(" + (c.value.scale || 1) * (c.value.flipH ? -1 : 1) + ")scaleY(" + (c.value.scale || 1) * (c.value.flipV ? -1 : 1) + ")rotate(" + (c.value.rotate || 0) + "deg)";
|
|
456
470
|
}
|
|
457
471
|
function Y() {
|
|
458
|
-
A.value = !1,
|
|
472
|
+
A.value = !1, P.value = null, j.value = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=", x = {
|
|
459
473
|
active: !1,
|
|
460
474
|
type: null,
|
|
461
475
|
position: null,
|
|
@@ -468,7 +482,7 @@ function De(e, i) {
|
|
|
468
482
|
}, z.value = {
|
|
469
483
|
width: 0,
|
|
470
484
|
height: 0
|
|
471
|
-
},
|
|
485
|
+
}, f = {
|
|
472
486
|
width: 0,
|
|
473
487
|
height: 0
|
|
474
488
|
}, b = {
|
|
@@ -476,193 +490,193 @@ function De(e, i) {
|
|
|
476
490
|
height: 0
|
|
477
491
|
}, t.value.x1 = -100, t.value.y1 = -100, t.value.x2 = 1e4, t.value.y2 = 1e4;
|
|
478
492
|
}
|
|
479
|
-
function
|
|
493
|
+
function We(a) {
|
|
480
494
|
return /image\/(png|jpg|jpeg|bmp|gif|tiff|webp)/.test(a);
|
|
481
495
|
}
|
|
482
|
-
function
|
|
483
|
-
if (M.value +=
|
|
496
|
+
function Re() {
|
|
497
|
+
if (M.value += O.rotate, T.value && f.width && f.height) {
|
|
484
498
|
if (M.value % 2) {
|
|
485
|
-
const
|
|
499
|
+
const v = f.width * s.value, k = f.height / s.value;
|
|
486
500
|
return {
|
|
487
|
-
width: Math.max(
|
|
488
|
-
height: Math.max(
|
|
501
|
+
width: Math.max(f.height, v),
|
|
502
|
+
height: Math.max(f.width, k)
|
|
489
503
|
};
|
|
490
504
|
}
|
|
491
|
-
const a =
|
|
505
|
+
const a = f.height * s.value, u = f.width / s.value;
|
|
492
506
|
return {
|
|
493
|
-
width: Math.max(
|
|
494
|
-
height: Math.max(
|
|
507
|
+
width: Math.max(f.width, a),
|
|
508
|
+
height: Math.max(f.height, u)
|
|
495
509
|
};
|
|
496
510
|
}
|
|
497
511
|
return M.value % 2 ? {
|
|
498
|
-
height:
|
|
499
|
-
width:
|
|
512
|
+
height: f.width,
|
|
513
|
+
width: f.height
|
|
500
514
|
} : {
|
|
501
|
-
width:
|
|
502
|
-
height:
|
|
515
|
+
width: f.width,
|
|
516
|
+
height: f.height
|
|
503
517
|
};
|
|
504
518
|
}
|
|
505
|
-
function
|
|
506
|
-
M.value +=
|
|
507
|
-
const a =
|
|
508
|
-
a.width && a.height && (
|
|
509
|
-
const
|
|
510
|
-
return
|
|
511
|
-
}
|
|
512
|
-
function
|
|
513
|
-
return new Promise((
|
|
514
|
-
ee = a, j.value = a,
|
|
515
|
-
var
|
|
516
|
-
b.width = (
|
|
517
|
-
},
|
|
519
|
+
function _e() {
|
|
520
|
+
M.value += O.rotate;
|
|
521
|
+
const a = Re(), u = document.createElement("canvas");
|
|
522
|
+
a.width && a.height && (u.width = a.width, u.height = a.height);
|
|
523
|
+
const v = u.getContext("2d");
|
|
524
|
+
return f.width && f.height && E && (v == null || v.setTransform(O.flip ? -1 : 1, 0, 0, 1, u.width / 2, u.height / 2), v == null || v.rotate(Math.PI * (M.value / 2)), v == null || v.drawImage(E, -f.width / 2, -f.height / 2)), u.toDataURL();
|
|
525
|
+
}
|
|
526
|
+
function $e(a) {
|
|
527
|
+
return new Promise((u) => {
|
|
528
|
+
ee = a, j.value = a, P.value = new Image(), P.value.onload = () => {
|
|
529
|
+
var v, k;
|
|
530
|
+
b.width = (v = P.value) == null ? void 0 : v.naturalWidth, b.height = (k = P.value) == null ? void 0 : k.naturalHeight, u();
|
|
531
|
+
}, P.value.src = ee;
|
|
518
532
|
});
|
|
519
533
|
}
|
|
520
|
-
function
|
|
521
|
-
if (!E || !E.complete || !
|
|
534
|
+
function ge() {
|
|
535
|
+
if (!E || !E.complete || !O)
|
|
522
536
|
return Promise.reject(new Error("No image loaded"));
|
|
523
|
-
const a =
|
|
524
|
-
return
|
|
537
|
+
const a = _e();
|
|
538
|
+
return $e(a);
|
|
525
539
|
}
|
|
526
540
|
function ne(a) {
|
|
527
|
-
const
|
|
541
|
+
const u = (v) => {
|
|
528
542
|
o.show({
|
|
529
543
|
showCloseButton: !1,
|
|
530
544
|
timeout: 3e3,
|
|
531
545
|
animate: "fadeIn",
|
|
532
546
|
toasts: [{ type: "string", title: "提示", msg: "图片上传错误,请重试" }]
|
|
533
|
-
}),
|
|
547
|
+
}), m.value = !1, _ = !0, i.emit("loadImageFailed"), E = null, C.value = "";
|
|
534
548
|
};
|
|
535
549
|
E = new Image(), E.onload = () => {
|
|
536
|
-
C.value = a,
|
|
537
|
-
|
|
538
|
-
}).catch(
|
|
539
|
-
}, E.onerror =
|
|
550
|
+
C.value = a, O = d(a), f.width = E == null ? void 0 : E.naturalWidth, f.height = E == null ? void 0 : E.naturalHeight, ge().then(() => {
|
|
551
|
+
_ = !1;
|
|
552
|
+
}).catch(u);
|
|
553
|
+
}, E.onerror = u, E.src = a;
|
|
540
554
|
}
|
|
541
|
-
function
|
|
542
|
-
|
|
555
|
+
function He(a, u) {
|
|
556
|
+
We(u) ? (_ = !1, ne(a)) : (o.show({
|
|
543
557
|
showCloseButton: !1,
|
|
544
558
|
timeout: 3e3,
|
|
545
559
|
animate: "fadeIn",
|
|
546
560
|
toasts: [{ type: "string", title: "提示", msg: "图片类型不正确,请重试" }]
|
|
547
|
-
}),
|
|
561
|
+
}), m.value = !1, _ = !0, i.emit("loadImageFailed"));
|
|
548
562
|
}
|
|
549
563
|
function me(a) {
|
|
550
|
-
const
|
|
551
|
-
|
|
564
|
+
const u = new FileReader();
|
|
565
|
+
u.onload = (v) => He(v.target.result, a.type), u.readAsDataURL(a);
|
|
552
566
|
}
|
|
553
567
|
function pe(a) {
|
|
554
|
-
const
|
|
555
|
-
|
|
568
|
+
const u = new Image();
|
|
569
|
+
u.onerror = () => {
|
|
556
570
|
o.show({
|
|
557
571
|
showCloseButton: !1,
|
|
558
572
|
timeout: 3e3,
|
|
559
573
|
animate: "fadeIn",
|
|
560
574
|
toasts: [{ type: "string", title: "提示", msg: "图片加载错误,请重试" }]
|
|
561
|
-
}),
|
|
562
|
-
},
|
|
563
|
-
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
},
|
|
575
|
+
}), m.value = !1, _ = !0, i.emit("loadImageFailed");
|
|
576
|
+
}, u.onload = () => {
|
|
577
|
+
_ = !1;
|
|
578
|
+
const v = document.createElement("canvas"), k = v.getContext("2d");
|
|
579
|
+
v.width = u.width, v.height = u.height, k == null || k.drawImage(u, 0, 0), ne(v.toDataURL());
|
|
580
|
+
}, u.crossOrigin = "anonymous", u.src = a;
|
|
567
581
|
}
|
|
568
|
-
function
|
|
569
|
-
return
|
|
582
|
+
function Ue() {
|
|
583
|
+
return H.value && H.value && H.value.offsetWidth > 0;
|
|
570
584
|
}
|
|
571
585
|
function ue() {
|
|
572
|
-
if (
|
|
573
|
-
const a =
|
|
586
|
+
if (H.value) {
|
|
587
|
+
const a = H.value;
|
|
574
588
|
z.value.width = a.offsetWidth, z.value.height = a.offsetHeight, J.value = "calc(50% - " + z.value.width / 2 + "px)";
|
|
575
589
|
}
|
|
576
590
|
}
|
|
577
|
-
function Ue() {
|
|
578
|
-
L.value && z.value.width && (U = g.value > 0 ? Math.max(20, g.value / L.value.width * z.value.width) : 20);
|
|
579
|
-
}
|
|
580
591
|
function je() {
|
|
581
|
-
|
|
592
|
+
P.value && z.value.width && (U = g.value > 0 ? Math.max(20, g.value / P.value.width * z.value.width) : 20);
|
|
593
|
+
}
|
|
594
|
+
function Ne() {
|
|
595
|
+
w.value ? N = Math.max(20, U / s.value) : B.value > 0 && P.value && z.value.height ? N = Math.max(20, B.value / P.value.height * z.value.height) : N = 20;
|
|
582
596
|
}
|
|
583
597
|
function re() {
|
|
584
|
-
|
|
598
|
+
P.value ? (je(), Ne()) : (U = 20, N = 20);
|
|
585
599
|
}
|
|
586
|
-
function
|
|
587
|
-
const a =
|
|
600
|
+
function Oe() {
|
|
601
|
+
const a = H.value, u = h({ x1: 0, x2: 0, y1: 0, y2: 0 });
|
|
588
602
|
if (a && b.width && b.height) {
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
x1: Math.round(t.value.x1 *
|
|
592
|
-
y1: Math.round(t.value.y1 *
|
|
593
|
-
x2: Math.round(t.value.x2 *
|
|
594
|
-
y2: Math.round(t.value.y2 *
|
|
595
|
-
}, T.value || (
|
|
603
|
+
const v = b.width / a.offsetWidth;
|
|
604
|
+
u.value = {
|
|
605
|
+
x1: Math.round(t.value.x1 * v),
|
|
606
|
+
y1: Math.round(t.value.y1 * v),
|
|
607
|
+
x2: Math.round(t.value.x2 * v),
|
|
608
|
+
y2: Math.round(t.value.y2 * v)
|
|
609
|
+
}, T.value || (u.value.x1 = Math.max(u.value.x1, 0), u.value.y1 = Math.max(u.value.y1, 0), u.value.x2 = Math.min(u.value.x2, b.width), u.value.y2 = Math.min(u.value.y2, b.height));
|
|
596
610
|
}
|
|
597
|
-
return
|
|
611
|
+
return u.value;
|
|
598
612
|
}
|
|
599
613
|
function Ie() {
|
|
600
|
-
M.value +=
|
|
601
|
-
const a =
|
|
602
|
-
if (a && b.height && b.width &&
|
|
603
|
-
const
|
|
604
|
-
let k,
|
|
605
|
-
M.value % 2 ? (k = (b.width -
|
|
606
|
-
x1: Math.round(t.value.x1 *
|
|
607
|
-
y1: Math.round(t.value.y1 *
|
|
608
|
-
x2: Math.round(t.value.x2 *
|
|
609
|
-
y2: Math.round(t.value.y2 *
|
|
610
|
-
}, T.value || (
|
|
614
|
+
M.value += O.rotate;
|
|
615
|
+
const a = H.value, u = h({ x1: 0, x2: 0, y1: 0, y2: 0 });
|
|
616
|
+
if (a && b.height && b.width && f.height && f.width) {
|
|
617
|
+
const v = b.width / a.offsetWidth;
|
|
618
|
+
let k, $;
|
|
619
|
+
M.value % 2 ? (k = (b.width - f.height) / 2, $ = (b.height - f.width) / 2) : (k = (b.width - f.width) / 2, $ = (b.height - f.height) / 2), u.value = {
|
|
620
|
+
x1: Math.round(t.value.x1 * v) - k,
|
|
621
|
+
y1: Math.round(t.value.y1 * v) - $,
|
|
622
|
+
x2: Math.round(t.value.x2 * v) - k,
|
|
623
|
+
y2: Math.round(t.value.y2 * v) - $
|
|
624
|
+
}, T.value || (u.value.x1 = Math.max(u.value.x1, 0), u.value.y1 = Math.max(u.value.y1, 0), u.value.x2 = Math.min(u.value.x2, b.width), u.value.y2 = Math.min(u.value.y2, b.height));
|
|
611
625
|
}
|
|
612
|
-
return
|
|
626
|
+
return u.value;
|
|
613
627
|
}
|
|
614
|
-
function
|
|
628
|
+
function Ve(a, u) {
|
|
615
629
|
if (l.value > 0) {
|
|
616
|
-
if (!
|
|
630
|
+
if (!r.value || a > l.value)
|
|
617
631
|
return l.value / a;
|
|
618
|
-
} else if (R.value > 0 && (!
|
|
619
|
-
return R.value /
|
|
632
|
+
} else if (R.value > 0 && (!r.value || u > R.value))
|
|
633
|
+
return R.value / u;
|
|
620
634
|
return 1;
|
|
621
635
|
}
|
|
622
|
-
function
|
|
623
|
-
return Math.min(1, Math.max(0,
|
|
624
|
-
}
|
|
625
|
-
function
|
|
626
|
-
return a.toDataURL("image/" +
|
|
627
|
-
}
|
|
628
|
-
function
|
|
629
|
-
if (
|
|
630
|
-
const a =
|
|
631
|
-
k.width =
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
|
|
635
|
-
const G = (
|
|
636
|
-
b.width && b.height && (
|
|
636
|
+
function Fe() {
|
|
637
|
+
return Math.min(1, Math.max(0, L.value / 100));
|
|
638
|
+
}
|
|
639
|
+
function qe(a) {
|
|
640
|
+
return a.toDataURL("image/" + W.value, Fe());
|
|
641
|
+
}
|
|
642
|
+
function Qe() {
|
|
643
|
+
if (H.value && H.value && P.value != null) {
|
|
644
|
+
const a = Oe(), u = a.x2 - a.x1, v = a.y2 - a.y1, k = document.createElement("canvas");
|
|
645
|
+
k.width = u, k.height = v;
|
|
646
|
+
const $ = k.getContext("2d");
|
|
647
|
+
if ($) {
|
|
648
|
+
p.value != null && ($.fillStyle = p.value, $.fillRect(0, 0, u, v));
|
|
649
|
+
const G = (c.value.scale || 1) * (c.value.flipH ? -1 : 1), Z = (c.value.scale || 1) * (c.value.flipV ? -1 : 1);
|
|
650
|
+
b.width && b.height && ($.setTransform(G, 0, 0, Z, b.width / 2, b.height / 2), $.translate(-a.x1 / G, -a.y1 / Z), $.rotate((c.value.rotate || 0) * Math.PI / 180), $.drawImage(P.value, -b.width / 2, -b.height / 2));
|
|
637
651
|
const F = {
|
|
638
|
-
width:
|
|
639
|
-
height:
|
|
652
|
+
width: u,
|
|
653
|
+
height: v,
|
|
640
654
|
imagePosition: a,
|
|
641
655
|
cropperPosition: { ...t.value }
|
|
642
656
|
};
|
|
643
657
|
T.value && (F.offsetImagePosition = Ie());
|
|
644
|
-
const X =
|
|
645
|
-
return X !== 1 && (F.width = Math.round(
|
|
658
|
+
const X = Ve(u, v);
|
|
659
|
+
return X !== 1 && (F.width = Math.round(u * X), F.height = w.value ? Math.round(F.width / s.value) : Math.round(v * X), n(k, F.width, F.height)), F.base64 = qe(k), i.emit("imageCropped", F), F;
|
|
646
660
|
}
|
|
647
661
|
}
|
|
648
662
|
return null;
|
|
649
663
|
}
|
|
650
664
|
function te() {
|
|
651
|
-
y.value &&
|
|
665
|
+
y.value && Qe();
|
|
652
666
|
}
|
|
653
667
|
function ye() {
|
|
654
|
-
const a =
|
|
668
|
+
const a = H.value;
|
|
655
669
|
if (a) {
|
|
656
670
|
if (!w.value)
|
|
657
671
|
t.value.x1 = 0, t.value.x2 = a.offsetWidth, t.value.y1 = 0, t.value.y2 = a.offsetHeight;
|
|
658
672
|
else if (a.offsetWidth / s.value < a.offsetHeight) {
|
|
659
673
|
t.value.x1 = 0, t.value.x2 = a.offsetWidth;
|
|
660
|
-
const
|
|
661
|
-
t.value.y1 = (a.offsetHeight -
|
|
674
|
+
const u = a.offsetWidth / s.value;
|
|
675
|
+
t.value.y1 = (a.offsetHeight - u) / 2, t.value.y2 = t.value.y1 + u;
|
|
662
676
|
} else {
|
|
663
677
|
t.value.y1 = 0, t.value.y2 = a.offsetHeight;
|
|
664
|
-
const
|
|
665
|
-
t.value.x1 = (a.offsetWidth -
|
|
678
|
+
const u = a.offsetHeight * s.value;
|
|
679
|
+
t.value.x1 = (a.offsetWidth - u) / 2, t.value.x2 = t.value.x1 + u;
|
|
666
680
|
}
|
|
667
681
|
te(), A.value = !0;
|
|
668
682
|
}
|
|
@@ -673,26 +687,26 @@ function De(e, i) {
|
|
|
673
687
|
timeout: 3e3,
|
|
674
688
|
animate: "fadeIn",
|
|
675
689
|
toasts: [{ type: "string", title: "提示", msg: "图片加载超时,请重试" }]
|
|
676
|
-
}),
|
|
677
|
-
}
|
|
678
|
-
function Qe() {
|
|
679
|
-
L.value != null && (d.value = !1, i.emit("imageLoaded"), V = 0, setTimeout(() => xe()));
|
|
690
|
+
}), _ = !0, m.value = !1, i.emit("loadImageFailed")) : Ue() ? (_ = !1, ue(), re(), ye(), i.emit("cropperReady", { ...z.value })) : (V++, setTimeout(() => xe(), 50));
|
|
680
691
|
}
|
|
681
692
|
function Ge() {
|
|
682
|
-
|
|
693
|
+
P.value != null && (m.value = !1, i.emit("imageLoaded"), V = 0, setTimeout(() => xe()));
|
|
694
|
+
}
|
|
695
|
+
function Je() {
|
|
696
|
+
const a = H.value;
|
|
683
697
|
(z.value.width !== (a == null ? void 0 : a.offsetWidth) || z.value.height !== (a == null ? void 0 : a.offsetHeight)) && z.value.width && z.value.height && a && (t.value.x1 = t.value.x1 * a.offsetWidth / z.value.width, t.value.x2 = t.value.x2 * a.offsetWidth / z.value.width, t.value.y1 = t.value.y1 * a.offsetHeight / z.value.height, t.value.y2 = t.value.y2 * a.offsetHeight / z.value.height);
|
|
684
698
|
}
|
|
685
|
-
const
|
|
686
|
-
|
|
699
|
+
const Ze = () => {
|
|
700
|
+
Je(), ue(), re();
|
|
687
701
|
}, be = () => {
|
|
688
|
-
clearTimeout(D), D = setTimeout(
|
|
702
|
+
clearTimeout(D), D = setTimeout(Ze, 300);
|
|
689
703
|
};
|
|
690
704
|
Ae(() => {
|
|
691
|
-
window.addEventListener("resize", be), le.value && (Y(),
|
|
692
|
-
}),
|
|
705
|
+
window.addEventListener("resize", be), le.value && (Y(), m.value = !0, pe(le.value));
|
|
706
|
+
}), ut(() => {
|
|
693
707
|
window.removeEventListener("resize", be);
|
|
694
708
|
});
|
|
695
|
-
function
|
|
709
|
+
function Ye() {
|
|
696
710
|
x.active && (x.active = !1, te());
|
|
697
711
|
}
|
|
698
712
|
function se(a) {
|
|
@@ -701,11 +715,11 @@ function De(e, i) {
|
|
|
701
715
|
function oe(a) {
|
|
702
716
|
return (a.touches && a.touches[0] ? a.touches[0].clientY : a.clientY) || 0;
|
|
703
717
|
}
|
|
704
|
-
function
|
|
718
|
+
function Xe(a, u, v = null) {
|
|
705
719
|
x && x.active || (a.preventDefault && a.preventDefault(), x = {
|
|
706
720
|
active: !0,
|
|
707
|
-
type:
|
|
708
|
-
position:
|
|
721
|
+
type: u,
|
|
722
|
+
position: v,
|
|
709
723
|
clientX: se(a),
|
|
710
724
|
clientY: oe(a),
|
|
711
725
|
...t.value
|
|
@@ -714,63 +728,63 @@ function De(e, i) {
|
|
|
714
728
|
function ce(a = !1) {
|
|
715
729
|
t.value.x1 < 0 && (t.value.x2 -= a ? t.value.x1 : 0, t.value.x1 = 0), t.value.y1 < 0 && (t.value.y2 -= a ? t.value.y1 : 0, t.value.y1 = 0), t.value.x2 > z.value.width && (t.value.x1 -= a ? t.value.x2 - z.value.width : 0, t.value.x2 = z.value.width), t.value.y2 > z.value.height && (t.value.y1 -= a ? t.value.y2 - z.value.height : 0, t.value.y2 = z.value.height);
|
|
716
730
|
}
|
|
717
|
-
function
|
|
718
|
-
const
|
|
719
|
-
t.value.x1 = x.x1 +
|
|
731
|
+
function Ke(a) {
|
|
732
|
+
const u = se(a) - x.clientX, v = oe(a) - x.clientY;
|
|
733
|
+
t.value.x1 = x.x1 + u, t.value.y1 = x.y1 + v, t.value.x2 = x.x2 + u, t.value.y2 = x.y2 + v;
|
|
720
734
|
}
|
|
721
|
-
const { checkAspectRatio:
|
|
722
|
-
function
|
|
723
|
-
const
|
|
735
|
+
const { checkAspectRatio: et } = Lt(t, z, s, x);
|
|
736
|
+
function tt(a) {
|
|
737
|
+
const u = se(a) - x.clientX, v = oe(a) - x.clientY;
|
|
724
738
|
switch (x.position) {
|
|
725
739
|
case "left":
|
|
726
|
-
t.value.x1 = Math.min(x.x1 +
|
|
740
|
+
t.value.x1 = Math.min(x.x1 + u, t.value.x2 - U);
|
|
727
741
|
break;
|
|
728
742
|
case "topleft":
|
|
729
|
-
t.value.x1 = Math.min(x.x1 +
|
|
743
|
+
t.value.x1 = Math.min(x.x1 + u, t.value.x2 - U), t.value.y1 = Math.min(x.y1 + v, t.value.y2 - N);
|
|
730
744
|
break;
|
|
731
745
|
case "top":
|
|
732
|
-
t.value.y1 = Math.min(x.y1 +
|
|
746
|
+
t.value.y1 = Math.min(x.y1 + v, t.value.y2 - N);
|
|
733
747
|
break;
|
|
734
748
|
case "topright":
|
|
735
|
-
t.value.x2 = Math.max(x.x2 +
|
|
749
|
+
t.value.x2 = Math.max(x.x2 + u, t.value.x1 + U), t.value.y1 = Math.min(x.y1 + v, t.value.y2 - N);
|
|
736
750
|
break;
|
|
737
751
|
case "right":
|
|
738
|
-
t.value.x2 = Math.max(x.x2 +
|
|
752
|
+
t.value.x2 = Math.max(x.x2 + u, t.value.x1 + U);
|
|
739
753
|
break;
|
|
740
754
|
case "bottomright":
|
|
741
|
-
t.value.x2 = Math.max(x.x2 +
|
|
755
|
+
t.value.x2 = Math.max(x.x2 + u, t.value.x1 + U), t.value.y2 = Math.max(x.y2 + v, t.value.y1 + N);
|
|
742
756
|
break;
|
|
743
757
|
case "bottom":
|
|
744
|
-
t.value.y2 = Math.max(x.y2 +
|
|
758
|
+
t.value.y2 = Math.max(x.y2 + v, t.value.y1 + N);
|
|
745
759
|
break;
|
|
746
760
|
case "bottomleft":
|
|
747
|
-
t.value.x1 = Math.min(x.x1 +
|
|
761
|
+
t.value.x1 = Math.min(x.x1 + u, t.value.x2 - U), t.value.y2 = Math.max(x.y2 + v, t.value.y1 + N);
|
|
748
762
|
break;
|
|
749
763
|
case "center":
|
|
750
|
-
const { scale: k } = a,
|
|
751
|
-
t.value.x1 = Math.min(x.clientX -
|
|
764
|
+
const { scale: k } = a, $ = Math.abs(x.x2 - x.x1) * k, G = Math.abs(x.y2 - x.y1) * k, { x1: Z } = t.value, { y1: F } = t.value;
|
|
765
|
+
t.value.x1 = Math.min(x.clientX - $ / 2, t.value.x2 - U), t.value.y1 = Math.min(x.clientY - G / 2, t.value.y2 - N), t.value.x2 = Math.max(x.clientX + $ / 2, Z + U), t.value.y2 = Math.max(x.clientY + G / 2, F + N);
|
|
752
766
|
break;
|
|
753
767
|
}
|
|
754
|
-
w.value &&
|
|
768
|
+
w.value && et();
|
|
755
769
|
}
|
|
756
|
-
function
|
|
770
|
+
function at(a) {
|
|
757
771
|
x && x.active && (a.stopPropagation && a.stopPropagation(), a.preventDefault && a.preventDefault(), clearTimeout(Q), Q = setTimeout(() => {
|
|
758
|
-
x.type === ae.Move ? (
|
|
772
|
+
x.type === ae.Move ? (Ke(a), ce(!0)) : x.type === ae.Resize && (tt(a), ce(!1));
|
|
759
773
|
}, 300));
|
|
760
774
|
}
|
|
761
|
-
return K(
|
|
762
|
-
Y(), a && a.target && a.target.files && a.target.files.length > 0 && (
|
|
775
|
+
return K(de, (a) => {
|
|
776
|
+
Y(), a && a.target && a.target.files && a.target.files.length > 0 && (m.value = !0, me(a.target.files[0]));
|
|
763
777
|
}), K(le, (a) => {
|
|
764
|
-
a ? (Y(),
|
|
778
|
+
a ? (Y(), m.value = !0, pe(a)) : (o.show({
|
|
765
779
|
showCloseButton: !1,
|
|
766
780
|
timeout: 3e3,
|
|
767
781
|
animate: "fadeIn",
|
|
768
782
|
toasts: [{ type: "string", title: "提示", msg: "图片路径为空" }]
|
|
769
|
-
}),
|
|
770
|
-
}), K(Be, (a) => {
|
|
771
|
-
Y(), d.value = !0, ne(a);
|
|
783
|
+
}), m.value = !1, _ = !0);
|
|
772
784
|
}), K(Ce, (a) => {
|
|
773
|
-
Y(),
|
|
785
|
+
Y(), m.value = !0, ne(a);
|
|
786
|
+
}), K(Le, (a) => {
|
|
787
|
+
Y(), a && (m.value = !0, me(a));
|
|
774
788
|
}), K(
|
|
775
789
|
() => [
|
|
776
790
|
e.containWithinAspectRatio,
|
|
@@ -780,25 +794,25 @@ function De(e, i) {
|
|
|
780
794
|
e.transform,
|
|
781
795
|
e.imageChangedEvent
|
|
782
796
|
],
|
|
783
|
-
([a,
|
|
784
|
-
E && E.complete &&
|
|
797
|
+
([a, u, v, k, $, G], [Z, F, X, it, lt, nt]) => {
|
|
798
|
+
E && E.complete && O && (a !== Z || u !== F) && ge(), v !== X && (ue(), re(), ce(!1), te()), k !== it && A.value && ye(), $ !== lt && (Pe(), te()), G !== nt && (de.value = G);
|
|
785
799
|
}
|
|
786
800
|
), {
|
|
787
|
-
uploadError:
|
|
801
|
+
uploadError: _,
|
|
788
802
|
imageVisible: A,
|
|
789
|
-
backgroundColor:
|
|
790
|
-
sourceImage:
|
|
803
|
+
backgroundColor: p,
|
|
804
|
+
sourceImage: H,
|
|
791
805
|
safeImgDataUrl: j,
|
|
792
806
|
safeTransformStyle: q,
|
|
793
807
|
maxSize: z,
|
|
794
808
|
cropper: t,
|
|
795
809
|
marginLeft: J,
|
|
796
810
|
moveTypes: ie,
|
|
797
|
-
isLoading:
|
|
798
|
-
startMove:
|
|
799
|
-
imageLoadedInView:
|
|
800
|
-
moveStop:
|
|
801
|
-
moveImg:
|
|
811
|
+
isLoading: m,
|
|
812
|
+
startMove: Xe,
|
|
813
|
+
imageLoadedInView: Ge,
|
|
814
|
+
moveStop: Ye,
|
|
815
|
+
moveImg: at
|
|
802
816
|
};
|
|
803
817
|
}
|
|
804
818
|
const fe = /* @__PURE__ */ Se({
|
|
@@ -806,33 +820,33 @@ const fe = /* @__PURE__ */ Se({
|
|
|
806
820
|
props: he,
|
|
807
821
|
emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
|
|
808
822
|
setup(e, i) {
|
|
809
|
-
const
|
|
823
|
+
const n = h(e.alignImage), d = h(e.roundCropper), o = h(e.hideResizeSquares), t = h(e.loadImageErrorText), c = h(e.disabled), g = h(null), {
|
|
810
824
|
uploadError: w,
|
|
811
825
|
imageVisible: s,
|
|
812
826
|
backgroundColor: y,
|
|
813
|
-
sourceImage:
|
|
827
|
+
sourceImage: p,
|
|
814
828
|
safeImgDataUrl: l,
|
|
815
|
-
safeTransformStyle:
|
|
829
|
+
safeTransformStyle: r,
|
|
816
830
|
maxSize: T,
|
|
817
831
|
cropper: M,
|
|
818
|
-
marginLeft:
|
|
819
|
-
moveTypes:
|
|
832
|
+
marginLeft: W,
|
|
833
|
+
moveTypes: L,
|
|
820
834
|
isLoading: R,
|
|
821
835
|
startMove: B,
|
|
822
836
|
imageLoadedInView: j,
|
|
823
|
-
moveStop:
|
|
837
|
+
moveStop: m,
|
|
824
838
|
moveImg: A
|
|
825
|
-
} =
|
|
826
|
-
function
|
|
839
|
+
} = Be(e, i);
|
|
840
|
+
function f(D) {
|
|
827
841
|
return S("span", {
|
|
828
842
|
class: `farris-image-cropper-resize-bar ${D}`,
|
|
829
|
-
onMousedown:
|
|
843
|
+
onMousedown: I((E) => B(E, L.Resize, D), ["prevent"])
|
|
830
844
|
}, null);
|
|
831
845
|
}
|
|
832
846
|
function b(D) {
|
|
833
847
|
return S("div", null, [S("span", {
|
|
834
848
|
class: `farris-image-cropper-resize-bar ${D}`,
|
|
835
|
-
onMousedown:
|
|
849
|
+
onMousedown: I((E) => B(E, L.Resize, D), ["prevent"])
|
|
836
850
|
}, [S("span", {
|
|
837
851
|
class: "farris-image-cropper-square"
|
|
838
852
|
}, null)]), S("span", {
|
|
@@ -841,18 +855,18 @@ const fe = /* @__PURE__ */ Se({
|
|
|
841
855
|
class: "farris-image-cropper-square"
|
|
842
856
|
}, null)])]);
|
|
843
857
|
}
|
|
844
|
-
const V = ["top", "right", "bottom", "left"].map((D) =>
|
|
858
|
+
const V = ["top", "right", "bottom", "left"].map((D) => f(D)), Q = ["topleft", "topright", "bottomright", "bottomleft"].map((D) => b(D));
|
|
845
859
|
return () => S("div", {
|
|
846
860
|
class: ["farris-image-cropper-frame", {
|
|
847
|
-
"farris-image-cropper-disabled":
|
|
861
|
+
"farris-image-cropper-disabled": c.value
|
|
848
862
|
}],
|
|
849
863
|
style: {
|
|
850
|
-
"text-align":
|
|
864
|
+
"text-align": n.value
|
|
851
865
|
},
|
|
852
|
-
onMousemove:
|
|
853
|
-
onTouchmove:
|
|
854
|
-
onMouseup:
|
|
855
|
-
onTouchend:
|
|
866
|
+
onMousemove: I((D) => A(D), ["prevent"]),
|
|
867
|
+
onTouchmove: I((D) => A(D), ["prevent"]),
|
|
868
|
+
onMouseup: I(() => m(), ["prevent"]),
|
|
869
|
+
onTouchend: I(() => m(), ["prevent"])
|
|
856
870
|
}, [!w && S("div", {
|
|
857
871
|
ref: g,
|
|
858
872
|
class: "farris-image-cropper",
|
|
@@ -861,12 +875,12 @@ const fe = /* @__PURE__ */ Se({
|
|
|
861
875
|
}]
|
|
862
876
|
}, [l.value && S("img", {
|
|
863
877
|
title: "farris-source-image",
|
|
864
|
-
ref:
|
|
878
|
+
ref: p,
|
|
865
879
|
class: "farris-source-image",
|
|
866
880
|
style: [{
|
|
867
881
|
visibility: s.value ? "visible" : "hidden"
|
|
868
882
|
}, {
|
|
869
|
-
transform:
|
|
883
|
+
transform: r.value
|
|
870
884
|
}],
|
|
871
885
|
src: l.value,
|
|
872
886
|
onLoad: () => j()
|
|
@@ -877,11 +891,11 @@ const fe = /* @__PURE__ */ Se({
|
|
|
877
891
|
}, {
|
|
878
892
|
height: `${T.value.height || 0}px`
|
|
879
893
|
}, {
|
|
880
|
-
"margin-left":
|
|
894
|
+
"margin-left": n.value === "center" ? W.value : ""
|
|
881
895
|
}]
|
|
882
896
|
}, null), s.value && S("div", {
|
|
883
897
|
class: ["farris-image-cropper-wrapper", {
|
|
884
|
-
"farris-image-cropper-rounded":
|
|
898
|
+
"farris-image-cropper-rounded": d.value
|
|
885
899
|
}],
|
|
886
900
|
style: [{
|
|
887
901
|
top: `${M.value.y1}px`
|
|
@@ -894,12 +908,12 @@ const fe = /* @__PURE__ */ Se({
|
|
|
894
908
|
}, {
|
|
895
909
|
visibility: s.value ? "visible" : "hidden"
|
|
896
910
|
}, {
|
|
897
|
-
"margin-left":
|
|
911
|
+
"margin-left": n.value === "center" ? W.value : ""
|
|
898
912
|
}],
|
|
899
913
|
tabindex: "0"
|
|
900
914
|
}, [S("div", {
|
|
901
915
|
class: "farris-image-cropper-move",
|
|
902
|
-
onMousedown:
|
|
916
|
+
onMousedown: I((D) => B(D, L.Move, "topleft"), ["prevent"])
|
|
903
917
|
}, null), !o.value && S("div", null, [Q, V])])]), R.value && S("div", {
|
|
904
918
|
class: "farris-image-cropper-loading"
|
|
905
919
|
}, [S("div", {
|
|
@@ -909,10 +923,10 @@ const fe = /* @__PURE__ */ Se({
|
|
|
909
923
|
}, [t.value])]);
|
|
910
924
|
}
|
|
911
925
|
});
|
|
912
|
-
function
|
|
926
|
+
function Pt(e, i, n) {
|
|
913
927
|
var j;
|
|
914
|
-
const
|
|
915
|
-
function
|
|
928
|
+
const d = "", o = "", t = h();
|
|
929
|
+
function c() {
|
|
916
930
|
return (i == null ? void 0 : i.schema.componentType) !== "frame";
|
|
917
931
|
}
|
|
918
932
|
function g() {
|
|
@@ -924,49 +938,49 @@ function Wt(e, i, r) {
|
|
|
924
938
|
function s() {
|
|
925
939
|
return (i == null ? void 0 : i.schema.componentType) === "frame";
|
|
926
940
|
}
|
|
927
|
-
function y(
|
|
928
|
-
if (!
|
|
941
|
+
function y(m) {
|
|
942
|
+
if (!m || !m.value)
|
|
929
943
|
return null;
|
|
930
|
-
if (
|
|
931
|
-
return
|
|
932
|
-
const A =
|
|
933
|
-
return
|
|
944
|
+
if (m.value.schema && m.value.schema.type === "component")
|
|
945
|
+
return m.value;
|
|
946
|
+
const A = h(m == null ? void 0 : m.value.parent), f = y(A);
|
|
947
|
+
return f || null;
|
|
934
948
|
}
|
|
935
|
-
function m
|
|
936
|
-
const { componentInstance: A, designerItemElementRef:
|
|
937
|
-
return !A || !A.value ? null : A.value.canMove ?
|
|
949
|
+
function p(m = i) {
|
|
950
|
+
const { componentInstance: A, designerItemElementRef: f } = m;
|
|
951
|
+
return !A || !A.value ? null : A.value.canMove ? f : p(m.parent);
|
|
938
952
|
}
|
|
939
|
-
function l(
|
|
940
|
-
return !!
|
|
953
|
+
function l(m) {
|
|
954
|
+
return !!n;
|
|
941
955
|
}
|
|
942
|
-
function
|
|
956
|
+
function r() {
|
|
943
957
|
return (i == null ? void 0 : i.schema.label) || (i == null ? void 0 : i.schema.title) || (i == null ? void 0 : i.schema.name);
|
|
944
958
|
}
|
|
945
959
|
function T() {
|
|
946
960
|
}
|
|
947
|
-
function M(
|
|
961
|
+
function M(m, A) {
|
|
948
962
|
}
|
|
949
|
-
function
|
|
950
|
-
const { componentType:
|
|
951
|
-
let b =
|
|
952
|
-
const V =
|
|
953
|
-
return b && !b.id && b.type ===
|
|
963
|
+
function W(m, A) {
|
|
964
|
+
const { componentType: f } = m;
|
|
965
|
+
let b = De(f, m, A);
|
|
966
|
+
const V = f.toLowerCase().replace(/-/g, "_");
|
|
967
|
+
return b && !b.id && b.type === f && (b.id = `${V}_${Math.random().toString().slice(2, 6)}`), b;
|
|
954
968
|
}
|
|
955
|
-
function
|
|
969
|
+
function L(m) {
|
|
956
970
|
}
|
|
957
|
-
function R(...
|
|
971
|
+
function R(...m) {
|
|
958
972
|
}
|
|
959
973
|
function B() {
|
|
960
|
-
i != null && i.schema.contents && i.schema.contents.map((
|
|
974
|
+
i != null && i.schema.contents && i.schema.contents.map((m) => {
|
|
961
975
|
var b;
|
|
962
|
-
let A =
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
(b =
|
|
976
|
+
let A = m.id;
|
|
977
|
+
m.type === "component-ref" && (A = m.component);
|
|
978
|
+
const f = e.value.querySelector(`#${A}-design-item`);
|
|
979
|
+
(b = f == null ? void 0 : f.componentInstance) != null && b.value.onRemoveComponent && f.componentInstance.value.onRemoveComponent();
|
|
966
980
|
});
|
|
967
981
|
}
|
|
968
982
|
return t.value = {
|
|
969
|
-
canMove:
|
|
983
|
+
canMove: c(),
|
|
970
984
|
canSelectParent: g(),
|
|
971
985
|
canDelete: w(),
|
|
972
986
|
canNested: !s(),
|
|
@@ -974,57 +988,57 @@ function Wt(e, i, r) {
|
|
|
974
988
|
elementRef: e,
|
|
975
989
|
parent: (j = i == null ? void 0 : i.parent) == null ? void 0 : j.componentInstance,
|
|
976
990
|
schema: i == null ? void 0 : i.schema,
|
|
977
|
-
styles:
|
|
991
|
+
styles: d,
|
|
978
992
|
designerClass: o,
|
|
979
993
|
canAccepts: l,
|
|
980
994
|
getBelongedComponentInstance: y,
|
|
981
|
-
getDraggableDesignItemElement:
|
|
982
|
-
getDraggingDisplayText:
|
|
995
|
+
getDraggableDesignItemElement: p,
|
|
996
|
+
getDraggingDisplayText: r,
|
|
983
997
|
getPropConfig: R,
|
|
984
998
|
getDragScopeElement: T,
|
|
985
999
|
onAcceptMovedChildElement: M,
|
|
986
|
-
onChildElementMovedOut:
|
|
987
|
-
addNewChildComponentSchema:
|
|
988
|
-
triggerBelongedComponentToMoveWhenMoved:
|
|
989
|
-
triggerBelongedComponentToDeleteWhenDeleted:
|
|
1000
|
+
onChildElementMovedOut: L,
|
|
1001
|
+
addNewChildComponentSchema: W,
|
|
1002
|
+
triggerBelongedComponentToMoveWhenMoved: h(!1),
|
|
1003
|
+
triggerBelongedComponentToDeleteWhenDeleted: h(!1),
|
|
990
1004
|
onRemoveComponent: B
|
|
991
1005
|
}, t;
|
|
992
1006
|
}
|
|
993
|
-
const
|
|
1007
|
+
const Wt = /* @__PURE__ */ Se({
|
|
994
1008
|
name: "FImageCropperDesign",
|
|
995
1009
|
props: he,
|
|
996
1010
|
emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
|
|
997
1011
|
setup(e, i) {
|
|
998
|
-
const
|
|
1012
|
+
const n = h(e.alignImage), d = h(e.roundCropper), o = h(e.hideResizeSquares), t = h(e.loadImageErrorText), c = h(e.disabled), g = h(null), {
|
|
999
1013
|
uploadError: w,
|
|
1000
1014
|
imageVisible: s,
|
|
1001
1015
|
backgroundColor: y,
|
|
1002
|
-
sourceImage:
|
|
1016
|
+
sourceImage: p,
|
|
1003
1017
|
safeImgDataUrl: l,
|
|
1004
|
-
safeTransformStyle:
|
|
1018
|
+
safeTransformStyle: r,
|
|
1005
1019
|
maxSize: T,
|
|
1006
1020
|
cropper: M,
|
|
1007
|
-
marginLeft:
|
|
1008
|
-
moveTypes:
|
|
1021
|
+
marginLeft: W,
|
|
1022
|
+
moveTypes: L,
|
|
1009
1023
|
isLoading: R,
|
|
1010
1024
|
startMove: B,
|
|
1011
1025
|
imageLoadedInView: j,
|
|
1012
|
-
moveStop:
|
|
1026
|
+
moveStop: m,
|
|
1013
1027
|
moveImg: A
|
|
1014
|
-
} =
|
|
1028
|
+
} = Be(e, i), f = h(), b = Te("design-item-context"), V = Pt(f, b);
|
|
1015
1029
|
Ae(() => {
|
|
1016
|
-
|
|
1030
|
+
f.value.componentInstance = V;
|
|
1017
1031
|
}), i.expose(V.value);
|
|
1018
1032
|
function Q(C) {
|
|
1019
1033
|
return S("span", {
|
|
1020
1034
|
class: `farris-image-cropper-resize-bar ${C}`,
|
|
1021
|
-
onMousedown:
|
|
1035
|
+
onMousedown: I((q) => B(q, L.Resize, C), ["prevent"])
|
|
1022
1036
|
}, null);
|
|
1023
1037
|
}
|
|
1024
1038
|
function D(C) {
|
|
1025
1039
|
return S("div", null, [S("span", {
|
|
1026
1040
|
class: `farris-image-cropper-resize-bar ${C}`,
|
|
1027
|
-
onMousedown:
|
|
1041
|
+
onMousedown: I((q) => B(q, L.Resize, C), ["prevent"])
|
|
1028
1042
|
}, [S("span", {
|
|
1029
1043
|
class: "farris-image-cropper-square"
|
|
1030
1044
|
}, null)]), S("span", {
|
|
@@ -1033,19 +1047,19 @@ const Lt = /* @__PURE__ */ Se({
|
|
|
1033
1047
|
class: "farris-image-cropper-square"
|
|
1034
1048
|
}, null)])]);
|
|
1035
1049
|
}
|
|
1036
|
-
const E = ["top", "right", "bottom", "left"].map((C) => Q(C)),
|
|
1050
|
+
const E = ["top", "right", "bottom", "left"].map((C) => Q(C)), H = ["topleft", "topright", "bottomright", "bottomleft"].map((C) => D(C));
|
|
1037
1051
|
return () => S("div", {
|
|
1038
|
-
ref:
|
|
1052
|
+
ref: f,
|
|
1039
1053
|
class: ["farris-image-cropper-frame", {
|
|
1040
|
-
"farris-image-cropper-disabled":
|
|
1054
|
+
"farris-image-cropper-disabled": c.value
|
|
1041
1055
|
}],
|
|
1042
1056
|
style: {
|
|
1043
|
-
"text-align":
|
|
1057
|
+
"text-align": n.value
|
|
1044
1058
|
},
|
|
1045
|
-
onMousemove:
|
|
1046
|
-
onTouchmove:
|
|
1047
|
-
onMouseup:
|
|
1048
|
-
onTouchend:
|
|
1059
|
+
onMousemove: I((C) => A(C), ["prevent"]),
|
|
1060
|
+
onTouchmove: I((C) => A(C), ["prevent"]),
|
|
1061
|
+
onMouseup: I(() => m(), ["prevent"]),
|
|
1062
|
+
onTouchend: I(() => m(), ["prevent"])
|
|
1049
1063
|
}, [!w && S("div", {
|
|
1050
1064
|
ref: g,
|
|
1051
1065
|
class: "farris-image-cropper",
|
|
@@ -1054,12 +1068,12 @@ const Lt = /* @__PURE__ */ Se({
|
|
|
1054
1068
|
}]
|
|
1055
1069
|
}, [l.value && S("img", {
|
|
1056
1070
|
title: "farris-source-image",
|
|
1057
|
-
ref:
|
|
1071
|
+
ref: p,
|
|
1058
1072
|
class: "farris-source-image",
|
|
1059
1073
|
style: [{
|
|
1060
1074
|
visibility: s.value ? "visible" : "hidden"
|
|
1061
1075
|
}, {
|
|
1062
|
-
transform:
|
|
1076
|
+
transform: r.value
|
|
1063
1077
|
}],
|
|
1064
1078
|
src: l.value,
|
|
1065
1079
|
onLoad: () => j()
|
|
@@ -1070,11 +1084,11 @@ const Lt = /* @__PURE__ */ Se({
|
|
|
1070
1084
|
}, {
|
|
1071
1085
|
height: `${T.value.height || 0}px`
|
|
1072
1086
|
}, {
|
|
1073
|
-
"margin-left":
|
|
1087
|
+
"margin-left": n.value === "center" ? W.value : ""
|
|
1074
1088
|
}]
|
|
1075
1089
|
}, null), s.value && S("div", {
|
|
1076
1090
|
class: ["farris-image-cropper-wrapper", {
|
|
1077
|
-
"farris-image-cropper-rounded":
|
|
1091
|
+
"farris-image-cropper-rounded": d.value
|
|
1078
1092
|
}],
|
|
1079
1093
|
style: [{
|
|
1080
1094
|
top: `${M.value.y1}px`
|
|
@@ -1087,13 +1101,13 @@ const Lt = /* @__PURE__ */ Se({
|
|
|
1087
1101
|
}, {
|
|
1088
1102
|
visibility: s.value ? "visible" : "hidden"
|
|
1089
1103
|
}, {
|
|
1090
|
-
"margin-left":
|
|
1104
|
+
"margin-left": n.value === "center" ? W.value : ""
|
|
1091
1105
|
}],
|
|
1092
1106
|
tabindex: "0"
|
|
1093
1107
|
}, [S("div", {
|
|
1094
1108
|
class: "farris-image-cropper-move",
|
|
1095
|
-
onMousedown:
|
|
1096
|
-
}, null), !o.value && S("div", null, [
|
|
1109
|
+
onMousedown: I((C) => B(C, L.Move, "topleft"), ["prevent"])
|
|
1110
|
+
}, null), !o.value && S("div", null, [H, E])])]), R.value && S("div", {
|
|
1097
1111
|
class: "farris-image-cropper-loading"
|
|
1098
1112
|
}, [S("div", {
|
|
1099
1113
|
class: "farris-image-cropper-loading-spinner"
|
|
@@ -1101,20 +1115,20 @@ const Lt = /* @__PURE__ */ Se({
|
|
|
1101
1115
|
class: "farris-image-cropper-error"
|
|
1102
1116
|
}, [t.value])]);
|
|
1103
1117
|
}
|
|
1104
|
-
}),
|
|
1118
|
+
}), $t = {
|
|
1105
1119
|
install(e) {
|
|
1106
1120
|
e.component(fe.name, fe);
|
|
1107
1121
|
},
|
|
1108
|
-
register(e, i,
|
|
1122
|
+
register(e, i, n, d) {
|
|
1109
1123
|
e["image-cropper"] = fe, i["image-cropper"] = we;
|
|
1110
1124
|
},
|
|
1111
|
-
registerDesigner(e, i,
|
|
1112
|
-
e["image-cropper"] =
|
|
1125
|
+
registerDesigner(e, i, n) {
|
|
1126
|
+
e["image-cropper"] = Wt, i["image-cropper"] = we;
|
|
1113
1127
|
}
|
|
1114
1128
|
};
|
|
1115
1129
|
export {
|
|
1116
1130
|
fe as ImageCropper,
|
|
1117
|
-
|
|
1131
|
+
$t as default,
|
|
1118
1132
|
he as imageCropperProps,
|
|
1119
1133
|
we as propsResolver
|
|
1120
1134
|
};
|