@orangelogic/design-system 2.222.0 → 2.223.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library/components/cropper.js +401 -400
- package/library/components/types.js +9322 -9318
- package/library/package.json +1 -1
- package/library/packages/molecules/src/cropper/react/ReactCrop/ReactCrop.d.ts +1 -1
- package/library/packages/organisms/src/content-builder/configs-controller.d.ts +2 -2
- package/library/packages/organisms/src/content-builder/content-builder.utils.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { n as S, C as
|
|
2
|
-
import { c as
|
|
3
|
-
import { U
|
|
4
|
-
import { c as
|
|
5
|
-
import { i as
|
|
6
|
-
import { r as
|
|
7
|
-
import { e as
|
|
8
|
-
import { n as
|
|
9
|
-
import { r as w, j as f, w as
|
|
10
|
-
import { c as
|
|
11
|
-
import { r as $
|
|
12
|
-
import { d as
|
|
13
|
-
const
|
|
1
|
+
import { n as S, C as bt } from "../chunks/lib-cortex-element.CVMmyPMC.js";
|
|
2
|
+
import { c as yt } from "../chunks/component.styles.CRO4Odto.js";
|
|
3
|
+
import { U } from "../chunks/asset-link-format.ClaYu_v8.js";
|
|
4
|
+
import { c as Rt } from "../chunks/custom-element.L4WJXn1j.js";
|
|
5
|
+
import { i as vt, x as et } from "../chunks/lit-element.jLBm65_O.js";
|
|
6
|
+
import { r as _t } from "../chunks/state.CSDxrqLd.js";
|
|
7
|
+
import { e as Dt } from "../chunks/query.BBf1UFkC.js";
|
|
8
|
+
import { n as at } from "../chunks/when.Dr1es41R.js";
|
|
9
|
+
import { r as w, j as f, w as Mt, R as kt, a as zt } from "../chunks/jsx-runtime.CTpPVMxj.js";
|
|
10
|
+
import { c as Ht, r as jt, a as St } from "../chunks/image.Y5c_hFx8.js";
|
|
11
|
+
import { r as $t } from "../chunks/number.Cx2ncfJJ.js";
|
|
12
|
+
import { d as st } from "../chunks/debounce.Bv1rtE8D.js";
|
|
13
|
+
const It = vt`:host{--rc-drag-handle-size:12px;--rc-drag-handle-mobile-size:24px;--rc-drag-handle-bg-colour:#0003;--rc-drag-bar-size:6px;--rc-border-color:#ffffffb3;--rc-focus-color:#08f;width:100%;height:100%;display:block;position:relative}.cropper{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:relative;container-type:size}.loading-container{z-index:1000;background-color:#00000080;width:100%;height:100%;position:absolute;top:0;left:0}.loading-container .loading{width:100%;height:100%;position:absolute}.loading-container .loading__skeleton{--border-radius:0;width:100%;height:100%}.loading-container .loading__spinner{--track-width:.2rem;font-size:var(--cx-font-size-3x-large);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cropper--portrait .cropper__image{max-width:100cqw;max-height:100cqh}.cropper__image{width:auto;max-width:100%;height:auto;max-height:100%;display:block}.cropper__image--loading{opacity:0}@keyframes marching-ants{0%{background-position:0 0,0 100%,0 0,100% 0}to{background-position:20px 0,-20px 100%,0 -20px,100% 20px}}.ReactCrop{cursor:crosshair;isolation:isolate;max-width:100%;display:inline-block;position:relative}.cropper--multiple .ReactCrop:before{content:"";z-index:-1;background:var(--cx-color-neutral-300);border-radius:2px;position:absolute;inset:0;transform:translate(-8px,-8px)}.ReactCrop *,.ReactCrop :before,.ReactCrop :after{box-sizing:border-box}.ReactCrop--disabled,.ReactCrop--loading,.ReactCrop--locked{cursor:inherit}.ReactCrop__child-wrapper{max-height:inherit;justify-content:center;align-items:center;width:100%;height:100%;display:flex;overflow:hidden}.ReactCrop__child-wrapper>img,.ReactCrop__child-wrapper>video{width:auto;max-width:100%;height:auto;max-height:100%;display:block}.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__child-wrapper>img,.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__child-wrapper>video,.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__crop-selection{touch-action:none}.ReactCrop__crop-mask{pointer-events:none;width:calc(100% + .5px);height:calc(100% + .5px);position:absolute;inset:0}.ReactCrop__crop-selection{cursor:move;position:absolute;top:0;left:0;transform:translateZ(0)}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit;display:none}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%}.ReactCrop--circular-crop .ReactCrop__crop-selection:after{pointer-events:none;content:"";border:1px solid var(--rc-border-color);opacity:.3;position:absolute;inset:-1px}.ReactCrop--no-animate .ReactCrop__crop-selection,.ReactCrop--loading .ReactCrop__crop-selection{outline:1px dashed #fff}.ReactCrop__crop-selection:not(.ReactCrop--no-animate .ReactCrop__crop-selection,.ReactCrop--loading .ReactCrop__crop-selection){color:#fff;background-image:linear-gradient(90deg,#fff 50%,#444 50%),linear-gradient(90deg,#fff 50%,#444 50%),linear-gradient(#fff 50%,#444 50%),linear-gradient(#fff 50%,#444 50%);background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;background-size:10px 1px,10px 1px,1px 10px,1px 10px;animation:1s linear infinite marching-ants}.ReactCrop__crop-selection:focus{outline:2px solid var(--rc-focus-color);outline-offset:-1px}.ReactCrop--disabled .ReactCrop__crop-mask,.ReactCrop--invisible-crop .ReactCrop__crop-mask,.ReactCrop--invisible-crop .ReactCrop__crop-selection{display:none}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after,.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{content:"";background-color:#fff6;display:block;position:absolute}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after{width:1px;height:100%}.ReactCrop__rule-of-thirds-vt:before{left:33.3333%}.ReactCrop__rule-of-thirds-vt:after{left:66.6667%}.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{width:100%;height:1px}.ReactCrop__rule-of-thirds-hz:before{top:33.3333%}.ReactCrop__rule-of-thirds-hz:after{top:66.6667%}.ReactCrop__drag-handle{width:var(--rc-drag-handle-size);height:var(--rc-drag-handle-size);background-color:var(--rc-drag-handle-bg-colour);border:1px solid var(--rc-border-color);position:absolute}.ReactCrop__drag-handle:focus{background:var(--rc-focus-color)}.ReactCrop .ord-nw{cursor:nw-resize;top:0;left:0;transform:translate(-50%,-50%)}.ReactCrop .ord-n{cursor:n-resize;top:0;left:50%;transform:translate(-50%,-50%)}.ReactCrop .ord-ne{cursor:ne-resize;top:0;right:0;transform:translate(50%,-50%)}.ReactCrop .ord-e{cursor:e-resize;top:50%;right:0;transform:translate(50%,-50%)}.ReactCrop .ord-se{cursor:se-resize;bottom:0;right:0;transform:translate(50%,50%)}.ReactCrop .ord-s{cursor:s-resize;bottom:0;left:50%;transform:translate(-50%,50%)}.ReactCrop .ord-sw{cursor:sw-resize;bottom:0;left:0;transform:translate(-50%,50%)}.ReactCrop .ord-w{cursor:w-resize;top:50%;left:0;transform:translate(-50%,-50%)}.ReactCrop__disabled .ReactCrop__drag-handle{cursor:inherit}.ReactCrop__drag-bar{position:absolute}.ReactCrop__drag-bar.ord-n{width:100%;height:var(--rc-drag-bar-size);top:0;left:0;transform:translateY(-50%)}.ReactCrop__drag-bar.ord-e{width:var(--rc-drag-bar-size);height:100%;top:0;right:0;transform:translate(50%)}.ReactCrop__drag-bar.ord-s{width:100%;height:var(--rc-drag-bar-size);bottom:0;left:0;transform:translateY(50%)}.ReactCrop__drag-bar.ord-w{width:var(--rc-drag-bar-size);height:100%;top:0;left:0;transform:translate(-50%)}.ReactCrop--new-crop .ReactCrop__drag-bar,.ReactCrop--new-crop .ReactCrop__drag-handle,.ReactCrop--fixed-aspect .ReactCrop__drag-bar,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-n,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-e,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-s,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-w{display:none}@media (pointer:coarse){.ReactCrop .ord-n,.ReactCrop .ord-e,.ReactCrop .ord-s,.ReactCrop .ord-w{display:none}.ReactCrop__drag-handle{width:var(--rc-drag-handle-mobile-size);height:var(--rc-drag-handle-mobile-size)}}`, q = {
|
|
14
14
|
height: 0,
|
|
15
15
|
unit: "px",
|
|
16
16
|
width: 0,
|
|
17
17
|
x: 0,
|
|
18
18
|
y: 0
|
|
19
|
-
},
|
|
20
|
-
function
|
|
21
|
-
const i = j(
|
|
22
|
-
return
|
|
19
|
+
}, A = (s, t, e) => Math.min(Math.max(s, t), e), Pt = (...s) => s.filter((t) => t && typeof t == "string").join(" "), ht = (s, t) => s === t || s.width === t.width && s.height === t.height && s.x === t.x && s.y === t.y && s.unit === t.unit;
|
|
20
|
+
function Yt(s, t, e, r) {
|
|
21
|
+
const i = j(s, e, r);
|
|
22
|
+
return s.width && (i.height = i.width / t), s.height && (i.width = i.height * t), i.y + i.height > r && (i.height = r - i.y, i.width = i.height * t), i.x + i.width > e && (i.width = e - i.x, i.height = i.width / t), s.unit === "%" ? Y(i, e, r) : i;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const r = j(
|
|
26
|
-
return r.x = (
|
|
24
|
+
function Lt(s, t, e) {
|
|
25
|
+
const r = j(s, t, e);
|
|
26
|
+
return r.x = (t - r.width) / 2, r.y = (e - r.height) / 2, s.unit === "%" ? Y(r, t, e) : r;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
30
|
-
height:
|
|
28
|
+
function Y(s, t, e) {
|
|
29
|
+
return s.unit === "%" ? { ...q, ...s, unit: "%" } : {
|
|
30
|
+
height: s.height ? s.height / e * 100 : 0,
|
|
31
31
|
unit: "%",
|
|
32
|
-
width:
|
|
33
|
-
x:
|
|
34
|
-
y:
|
|
32
|
+
width: s.width ? s.width / t * 100 : 0,
|
|
33
|
+
x: s.x ? s.x / t * 100 : 0,
|
|
34
|
+
y: s.y ? s.y / e * 100 : 0
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function j(
|
|
38
|
-
return
|
|
39
|
-
height:
|
|
37
|
+
function j(s, t, e) {
|
|
38
|
+
return s.unit ? s.unit === "px" ? { ...q, ...s, unit: "px" } : {
|
|
39
|
+
height: s.height ? s.height * e / 100 : 0,
|
|
40
40
|
unit: "px",
|
|
41
|
-
width:
|
|
42
|
-
x:
|
|
43
|
-
y:
|
|
44
|
-
} : { ...q, ...
|
|
41
|
+
width: s.width ? s.width * t / 100 : 0,
|
|
42
|
+
x: s.x ? s.x * t / 100 : 0,
|
|
43
|
+
y: s.y ? s.y * e / 100 : 0
|
|
44
|
+
} : { ...q, ...s, unit: "px" };
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const o = { ...
|
|
48
|
-
let d = Math.min(
|
|
49
|
-
|
|
46
|
+
function ct(s, t, e, r, i, h = 0, a = 0, l = r, c = i) {
|
|
47
|
+
const o = { ...s };
|
|
48
|
+
let d = Math.min(h, r), g = Math.min(a, i), u = Math.min(l, r), p = Math.min(c, i);
|
|
49
|
+
t && (t > 1 ? (d = a ? a * t : d, g = d / t, u = l * t) : (g = h ? h / t : g, d = g * t, p = c / t)), o.y < 0 && (o.height = Math.max(
|
|
50
50
|
o.height + o.y,
|
|
51
|
-
|
|
51
|
+
g
|
|
52
52
|
), o.y = 0), o.x < 0 && (o.width = Math.max(
|
|
53
53
|
o.width + o.x,
|
|
54
54
|
d
|
|
55
55
|
), o.x = 0);
|
|
56
56
|
const n = r - (o.x + o.width);
|
|
57
57
|
n < 0 && (o.x = Math.min(o.x, r - d), o.width += n);
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
(
|
|
64
|
-
} else if (
|
|
65
|
-
const
|
|
66
|
-
(
|
|
58
|
+
const C = i - (o.y + o.height);
|
|
59
|
+
if (C < 0 && (o.y = Math.min(o.y, i - g), o.height += C), o.width < d && ((e === "sw" || e == "nw") && (o.x -= d - o.width), o.width = d), o.height < g && ((e === "nw" || e == "ne") && (o.y -= g - o.height), o.height = g), o.width > u && ((e === "sw" || e == "nw") && (o.x -= u - o.width), o.width = u), o.height > p && ((e === "nw" || e == "ne") && (o.y -= p - o.height), o.height = p), t) {
|
|
60
|
+
const x = o.width / o.height;
|
|
61
|
+
if (x < t) {
|
|
62
|
+
const _ = Math.max(o.width / t, g);
|
|
63
|
+
(e === "nw" || e == "ne") && (o.y -= _ - o.height), o.height = _;
|
|
64
|
+
} else if (x > t) {
|
|
65
|
+
const _ = Math.max(o.height * t, d);
|
|
66
|
+
(e === "sw" || e == "nw") && (o.x -= _ - o.width), o.width = _;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
return o;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const i = { ...
|
|
73
|
-
return
|
|
71
|
+
function Xt(s, t, e, r) {
|
|
72
|
+
const i = { ...s };
|
|
73
|
+
return t === "ArrowLeft" ? r === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : r === "w" ? (i.x -= e, i.width += e) : r === "sw" ? (i.x -= e, i.width += e, i.height += e) : r === "ne" ? (i.y += e, i.width -= e, i.height -= e) : r === "e" ? i.width -= e : r === "se" && (i.width -= e, i.height -= e) : t === "ArrowRight" && (r === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : r === "w" ? (i.x += e, i.width -= e) : r === "sw" ? (i.x += e, i.width -= e, i.height -= e) : r === "ne" ? (i.y -= e, i.width += e, i.height += e) : r === "e" ? i.width += e : r === "se" && (i.width += e, i.height += e)), t === "ArrowUp" ? r === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : r === "n" ? (i.y -= e, i.height += e) : r === "ne" ? (i.y -= e, i.width += e, i.height += e) : r === "sw" ? (i.x += e, i.width -= e, i.height -= e) : r === "s" ? i.height -= e : r === "se" && (i.width -= e, i.height -= e) : t === "ArrowDown" && (r === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : r === "n" ? (i.y += e, i.height -= e) : r === "ne" ? (i.y += e, i.width -= e, i.height -= e) : r === "sw" ? (i.x -= e, i.width += e, i.height += e) : r === "s" ? i.height += e : r === "se" && (i.width += e, i.height += e)), i;
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
let
|
|
77
|
-
const
|
|
75
|
+
const K = { capture: !0, passive: !1 };
|
|
76
|
+
let Ot = 0;
|
|
77
|
+
const v = class v extends w.PureComponent {
|
|
78
78
|
constructor() {
|
|
79
79
|
super(...arguments), this.docMoveBound = !1, this.mouseDownOnCrop = !1, this.dragStarted = !1, this.evData = {
|
|
80
80
|
clientX: 0,
|
|
@@ -86,46 +86,46 @@ const _ = class _ extends w.PureComponent {
|
|
|
86
86
|
startCropWidth: 0,
|
|
87
87
|
startCropX: 0,
|
|
88
88
|
startCropY: 0
|
|
89
|
-
}, this.componentRef = w.createRef(), this.mediaRef = w.createRef(), this.initChangeCalled = !1, this.instanceId = `rc-${
|
|
89
|
+
}, this.componentRef = w.createRef(), this.mediaRef = w.createRef(), this.initChangeCalled = !1, this.instanceId = `rc-${Ot++}`, this.state = {
|
|
90
90
|
cropIsActive: !1,
|
|
91
91
|
newCropIsBeingDrawn: !1
|
|
92
|
-
}, this.onCropPointerDown = (
|
|
93
|
-
const { crop:
|
|
94
|
-
if (!
|
|
92
|
+
}, this.onCropPointerDown = (t) => {
|
|
93
|
+
const { crop: e, disabled: r, loading: i } = this.props, h = this.getBox();
|
|
94
|
+
if (!e)
|
|
95
95
|
return;
|
|
96
|
-
const a = j(
|
|
96
|
+
const a = j(e, h.width, h.height);
|
|
97
97
|
if (r || i)
|
|
98
98
|
return;
|
|
99
|
-
|
|
99
|
+
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({
|
|
100
100
|
preventScroll: !0
|
|
101
101
|
});
|
|
102
|
-
const l =
|
|
103
|
-
let o =
|
|
102
|
+
const l = t.target.dataset.ord, c = !!l;
|
|
103
|
+
let o = t.clientX, d = t.clientY, g = a.x, u = a.y;
|
|
104
104
|
if (l) {
|
|
105
|
-
const
|
|
106
|
-
let
|
|
107
|
-
l === "ne" || l == "e" ? (
|
|
105
|
+
const p = t.clientX - h.x, n = t.clientY - h.y;
|
|
106
|
+
let C = 0, x = 0;
|
|
107
|
+
l === "ne" || l == "e" ? (C = p - (a.x + a.width), x = n - a.y, g = a.x, u = a.y + a.height) : l === "se" || l === "s" ? (C = p - (a.x + a.width), x = n - (a.y + a.height), g = a.x, u = a.y) : l === "sw" || l == "w" ? (C = p - a.x, x = n - (a.y + a.height), g = a.x + a.width, u = a.y) : (l === "nw" || l == "n") && (C = p - a.x, x = n - a.y, g = a.x + a.width, u = a.y + a.height), o = g + h.x + C, d = u + h.y + x;
|
|
108
108
|
}
|
|
109
109
|
this.evData = {
|
|
110
|
-
clientX:
|
|
111
|
-
clientY:
|
|
110
|
+
clientX: t.clientX,
|
|
111
|
+
clientY: t.clientY,
|
|
112
112
|
isResize: c,
|
|
113
113
|
ord: l,
|
|
114
114
|
startClientX: o,
|
|
115
115
|
startClientY: d,
|
|
116
116
|
startCropHeight: a.height,
|
|
117
117
|
startCropWidth: a.width,
|
|
118
|
-
startCropX:
|
|
119
|
-
startCropY:
|
|
118
|
+
startCropX: g,
|
|
119
|
+
startCropY: u
|
|
120
120
|
}, this.mouseDownOnCrop = !0, this.setState({ cropIsActive: !0 });
|
|
121
|
-
}, this.onComponentPointerDown = (
|
|
122
|
-
const { crop:
|
|
123
|
-
if (r || a ||
|
|
121
|
+
}, this.onComponentPointerDown = (t) => {
|
|
122
|
+
const { crop: e, disabled: r, keepSelection: i, loading: h, locked: a, onChange: l } = this.props, c = this.getBox();
|
|
123
|
+
if (r || a || h || i && e)
|
|
124
124
|
return;
|
|
125
|
-
|
|
125
|
+
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({
|
|
126
126
|
preventScroll: !0
|
|
127
127
|
});
|
|
128
|
-
const o =
|
|
128
|
+
const o = t.clientX - c.x, d = t.clientY - c.y, g = {
|
|
129
129
|
height: 0,
|
|
130
130
|
unit: "px",
|
|
131
131
|
width: 0,
|
|
@@ -133,88 +133,93 @@ const _ = class _ extends w.PureComponent {
|
|
|
133
133
|
y: d
|
|
134
134
|
};
|
|
135
135
|
this.evData = {
|
|
136
|
-
clientX:
|
|
137
|
-
clientY:
|
|
136
|
+
clientX: t.clientX,
|
|
137
|
+
clientY: t.clientY,
|
|
138
138
|
isResize: !0,
|
|
139
|
-
startClientX:
|
|
140
|
-
startClientY:
|
|
139
|
+
startClientX: t.clientX,
|
|
140
|
+
startClientY: t.clientY,
|
|
141
141
|
startCropHeight: 0,
|
|
142
142
|
startCropWidth: 0,
|
|
143
143
|
startCropX: o,
|
|
144
144
|
startCropY: d
|
|
145
145
|
}, this.mouseDownOnCrop = !0, l(
|
|
146
|
-
j(
|
|
147
|
-
|
|
146
|
+
j(g, c.width, c.height),
|
|
147
|
+
Y(g, c.width, c.height)
|
|
148
148
|
), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
|
|
149
|
-
}, this.onDocPointerMove = (
|
|
150
|
-
const { crop:
|
|
151
|
-
if (r || i || !
|
|
149
|
+
}, this.onDocPointerMove = (t) => {
|
|
150
|
+
const { crop: e, disabled: r, loading: i, onChange: h, onDragStart: a } = this.props, l = this.getBox();
|
|
151
|
+
if (r || i || !e || !this.mouseDownOnCrop)
|
|
152
152
|
return;
|
|
153
|
-
|
|
153
|
+
t.cancelable && t.preventDefault(), this.dragStarted || (this.dragStarted = !0);
|
|
154
154
|
const { evData: c } = this;
|
|
155
|
-
c.clientX =
|
|
155
|
+
c.clientX = t.clientX, c.clientY = t.clientY;
|
|
156
156
|
let o;
|
|
157
|
-
c.isResize ? o = this.resizeCrop() : (o = this.dragCrop(), a && a(
|
|
157
|
+
c.isResize ? o = this.resizeCrop() : (o = this.dragCrop(), a && a(t)), ht(e, o) || h(
|
|
158
158
|
j(o, l.width, l.height),
|
|
159
|
-
|
|
159
|
+
Y(o, l.width, l.height)
|
|
160
160
|
);
|
|
161
|
-
}, this.onComponentKeyDown = (
|
|
162
|
-
const { crop:
|
|
161
|
+
}, this.onComponentKeyDown = (t) => {
|
|
162
|
+
const { crop: e, disabled: r, loading: i, onChange: h, onComplete: a } = this.props;
|
|
163
163
|
if (r || i)
|
|
164
164
|
return;
|
|
165
|
-
const l =
|
|
165
|
+
const l = t.key;
|
|
166
166
|
let c = !1;
|
|
167
|
-
if (!
|
|
167
|
+
if (!e)
|
|
168
168
|
return;
|
|
169
|
-
const o = this.getBox(), d = this.makePixelCrop(o),
|
|
170
|
-
if (l === "ArrowLeft" ? (d.x -=
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
169
|
+
const o = this.getBox(), d = this.makePixelCrop(o), u = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? v.nudgeStepLarge : t.shiftKey ? v.nudgeStepMedium : v.nudgeStep;
|
|
170
|
+
if (l === "ArrowLeft" ? (d.x -= u, c = !0) : l === "ArrowRight" ? (d.x += u, c = !0) : l === "ArrowUp" ? (d.y -= u, c = !0) : l === "ArrowDown" && (d.y += u, c = !0), c) {
|
|
171
|
+
t.cancelable && t.preventDefault(), d.x = A(d.x, 0, o.width - d.width), d.y = A(d.y, 0, o.height - d.height);
|
|
172
|
+
const p = j(d, o.width, o.height), n = Y(d, o.width, o.height);
|
|
173
|
+
h(p, n), a && a(p, n);
|
|
174
174
|
}
|
|
175
|
-
}, this.onHandlerKeyDown = (
|
|
175
|
+
}, this.onHandlerKeyDown = (t, e) => {
|
|
176
176
|
const {
|
|
177
177
|
aspect: r = 0,
|
|
178
178
|
crop: i,
|
|
179
|
-
disabled:
|
|
179
|
+
disabled: h,
|
|
180
180
|
loading: a,
|
|
181
181
|
maxHeight: l,
|
|
182
182
|
maxWidth: c,
|
|
183
183
|
minHeight: o = 0,
|
|
184
184
|
minWidth: d = 0,
|
|
185
|
-
onChange:
|
|
186
|
-
onComplete:
|
|
187
|
-
} = this.props,
|
|
188
|
-
if (
|
|
185
|
+
onChange: g,
|
|
186
|
+
onComplete: u
|
|
187
|
+
} = this.props, p = this.getBox();
|
|
188
|
+
if (h || a || !i)
|
|
189
189
|
return;
|
|
190
|
-
if (
|
|
191
|
-
|
|
190
|
+
if (t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "ArrowLeft" || t.key === "ArrowRight")
|
|
191
|
+
t.stopPropagation(), t.preventDefault();
|
|
192
192
|
else
|
|
193
193
|
return;
|
|
194
|
-
const
|
|
195
|
-
|
|
194
|
+
const C = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? v.nudgeStepLarge : t.shiftKey ? v.nudgeStepMedium : v.nudgeStep, x = j(i, p.width, p.height), _ = Xt(x, t.key, C, e), [R, k] = this.resolveMinDimensions(
|
|
195
|
+
p,
|
|
196
196
|
r,
|
|
197
|
-
t,
|
|
198
|
-
u.width,
|
|
199
|
-
u.height,
|
|
200
197
|
d,
|
|
201
|
-
o
|
|
198
|
+
o
|
|
199
|
+
), $ = ct(
|
|
200
|
+
_,
|
|
201
|
+
r,
|
|
202
|
+
e,
|
|
203
|
+
p.width,
|
|
204
|
+
p.height,
|
|
205
|
+
R,
|
|
206
|
+
k,
|
|
202
207
|
c,
|
|
203
208
|
l
|
|
204
209
|
);
|
|
205
|
-
if (!
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
+
if (!ht(i, $)) {
|
|
211
|
+
const L = Y(
|
|
212
|
+
$,
|
|
213
|
+
p.width,
|
|
214
|
+
p.height
|
|
210
215
|
);
|
|
211
|
-
|
|
216
|
+
g($, L), u && u($, L);
|
|
212
217
|
}
|
|
213
|
-
}, this.onDocPointerDone = (
|
|
214
|
-
const { crop:
|
|
215
|
-
this.unbindDocMove(), !(r || i || !
|
|
216
|
-
j(
|
|
217
|
-
|
|
218
|
+
}, this.onDocPointerDone = (t) => {
|
|
219
|
+
const { crop: e, disabled: r, loading: i, onComplete: h, onDragEnd: a } = this.props, l = this.getBox();
|
|
220
|
+
this.unbindDocMove(), !(r || i || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, a && a(t), h && h(
|
|
221
|
+
j(e, l.width, l.height),
|
|
222
|
+
Y(e, l.width, l.height)
|
|
218
223
|
), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
|
|
219
224
|
}, this.onDragFocus = () => {
|
|
220
225
|
this.componentRef.current?.scrollTo(0, 0);
|
|
@@ -226,19 +231,19 @@ const _ = class _ extends w.PureComponent {
|
|
|
226
231
|
// We unfortunately get the bounding box every time as x+y changes
|
|
227
232
|
// due to scrolling.
|
|
228
233
|
getBox() {
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
234
|
+
const t = this.mediaRef.current;
|
|
235
|
+
if (!t)
|
|
231
236
|
return { height: 0, width: 0, x: 0, y: 0 };
|
|
232
|
-
const { height:
|
|
233
|
-
return { height:
|
|
237
|
+
const { height: e, width: r, x: i, y: h } = t.getBoundingClientRect();
|
|
238
|
+
return { height: e, width: r, x: i, y: h };
|
|
234
239
|
}
|
|
235
|
-
componentDidUpdate(
|
|
236
|
-
const { crop:
|
|
237
|
-
if (r && !
|
|
238
|
-
const { height: i, width:
|
|
239
|
-
|
|
240
|
-
j(
|
|
241
|
-
|
|
240
|
+
componentDidUpdate(t) {
|
|
241
|
+
const { crop: e, onComplete: r } = this.props;
|
|
242
|
+
if (r && !t.crop && e) {
|
|
243
|
+
const { height: i, width: h } = this.getBox();
|
|
244
|
+
h && i && r(
|
|
245
|
+
j(e, h, i),
|
|
246
|
+
Y(e, h, i)
|
|
242
247
|
);
|
|
243
248
|
}
|
|
244
249
|
}
|
|
@@ -249,82 +254,76 @@ const _ = class _ extends w.PureComponent {
|
|
|
249
254
|
this.docMoveBound || (this.document.addEventListener(
|
|
250
255
|
"pointermove",
|
|
251
256
|
this.onDocPointerMove,
|
|
252
|
-
|
|
257
|
+
K
|
|
253
258
|
), this.document.addEventListener(
|
|
254
259
|
"pointerup",
|
|
255
260
|
this.onDocPointerDone,
|
|
256
|
-
|
|
261
|
+
K
|
|
257
262
|
), this.document.addEventListener(
|
|
258
263
|
"pointercancel",
|
|
259
264
|
this.onDocPointerDone,
|
|
260
|
-
|
|
265
|
+
K
|
|
261
266
|
), this.docMoveBound = !0);
|
|
262
267
|
}
|
|
263
268
|
unbindDocMove() {
|
|
264
269
|
this.docMoveBound && (this.document.removeEventListener(
|
|
265
270
|
"pointermove",
|
|
266
271
|
this.onDocPointerMove,
|
|
267
|
-
|
|
272
|
+
K
|
|
268
273
|
), this.document.removeEventListener(
|
|
269
274
|
"pointerup",
|
|
270
275
|
this.onDocPointerDone,
|
|
271
|
-
|
|
276
|
+
K
|
|
272
277
|
), this.document.removeEventListener(
|
|
273
278
|
"pointercancel",
|
|
274
279
|
this.onDocPointerDone,
|
|
275
|
-
|
|
280
|
+
K
|
|
276
281
|
), this.docMoveBound = !1);
|
|
277
282
|
}
|
|
278
283
|
getCropStyle() {
|
|
279
|
-
const { crop:
|
|
280
|
-
if (
|
|
284
|
+
const { crop: t } = this.props;
|
|
285
|
+
if (t)
|
|
281
286
|
return {
|
|
282
|
-
height: `${
|
|
283
|
-
left: `${
|
|
284
|
-
top: `${
|
|
285
|
-
width: `${
|
|
287
|
+
height: `${t.height}${t.unit}`,
|
|
288
|
+
left: `${t.x}${t.unit}`,
|
|
289
|
+
top: `${t.y}${t.unit}`,
|
|
290
|
+
width: `${t.width}${t.unit}`
|
|
286
291
|
};
|
|
287
292
|
}
|
|
288
293
|
dragCrop() {
|
|
289
|
-
const { evData:
|
|
290
|
-
return r.x =
|
|
291
|
-
|
|
294
|
+
const { evData: t } = this, e = this.getBox(), r = this.makePixelCrop(e), i = t.clientX - t.startClientX, h = t.clientY - t.startClientY;
|
|
295
|
+
return r.x = A(
|
|
296
|
+
t.startCropX + i,
|
|
292
297
|
0,
|
|
293
|
-
|
|
294
|
-
), r.y =
|
|
295
|
-
|
|
298
|
+
e.width - r.width
|
|
299
|
+
), r.y = A(
|
|
300
|
+
t.startCropY + h,
|
|
296
301
|
0,
|
|
297
|
-
|
|
302
|
+
e.height - r.height
|
|
298
303
|
), r;
|
|
299
304
|
}
|
|
300
|
-
getPointRegion(
|
|
301
|
-
const { evData:
|
|
302
|
-
|
|
303
|
-
i && t ? c = t === "nw" || t === "n" || t === "ne" : c = l < s.startCropY;
|
|
304
|
-
let o;
|
|
305
|
-
return r && t ? o = t === "nw" || t === "w" || t === "sw" : o = a < s.startCropX, o ? c ? "nw" : "sw" : c ? "ne" : "se";
|
|
305
|
+
getPointRegion(t) {
|
|
306
|
+
const { evData: e } = this, r = e.clientX - t.x, h = e.clientY - t.y < e.startCropY;
|
|
307
|
+
return r < e.startCropX ? h ? "nw" : "sw" : h ? "ne" : "se";
|
|
306
308
|
}
|
|
307
|
-
resolveMinDimensions(
|
|
308
|
-
const
|
|
309
|
-
return !
|
|
309
|
+
resolveMinDimensions(t, e, r = 0, i = 0) {
|
|
310
|
+
const h = Math.min(r, t.width), a = Math.min(i, t.height);
|
|
311
|
+
return !e || !h && !a ? [h, a] : e > 1 ? h ? [h, h / e] : [a * e, a] : a ? [a * e, a] : [h, h / e];
|
|
310
312
|
}
|
|
311
313
|
resizeCrop() {
|
|
312
|
-
const { evData:
|
|
313
|
-
aspect:
|
|
314
|
+
const { evData: t } = this, {
|
|
315
|
+
aspect: e = 0,
|
|
314
316
|
centerCrop: r,
|
|
315
317
|
maxHeight: i,
|
|
316
|
-
maxWidth:
|
|
318
|
+
maxWidth: h
|
|
317
319
|
} = this.props, a = this.getBox(), [l, c] = this.resolveMinDimensions(
|
|
318
320
|
a,
|
|
319
|
-
|
|
321
|
+
e,
|
|
320
322
|
this.props.minWidth,
|
|
321
323
|
this.props.minHeight
|
|
322
324
|
);
|
|
323
325
|
let o = this.makePixelCrop(a);
|
|
324
|
-
const d = this.getPointRegion(a,
|
|
325
|
-
let g = e.clientX - e.startClientX, u = e.clientY - e.startClientY;
|
|
326
|
-
(l && p === "nw" || p === "w" || p === "sw") && (g = Math.min(g, -l)), (c && p === "nw" || p === "n" || p === "ne") && (u = Math.min(u, -c));
|
|
327
|
-
const n = {
|
|
326
|
+
const d = this.getPointRegion(a), g = t.ord || d, u = t.clientX - t.startClientX, p = t.clientY - t.startClientY, n = {
|
|
328
327
|
height: 0,
|
|
329
328
|
unit: "px",
|
|
330
329
|
width: 0,
|
|
@@ -332,56 +331,56 @@ const _ = class _ extends w.PureComponent {
|
|
|
332
331
|
y: 0
|
|
333
332
|
};
|
|
334
333
|
if (r) {
|
|
335
|
-
const
|
|
334
|
+
const x = a.width / 2, _ = a.height / 2;
|
|
336
335
|
if (d === "ne") {
|
|
337
|
-
const
|
|
338
|
-
n.width = Math.min(Math.max(20,
|
|
336
|
+
const R = t.startCropWidth + (u - t.startCropWidth) * 2, k = t.startCropHeight - (t.startCropHeight + p) * 2;
|
|
337
|
+
n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
|
|
339
338
|
} else if (d === "se") {
|
|
340
|
-
const
|
|
341
|
-
n.width = Math.min(Math.max(20,
|
|
339
|
+
const R = t.startCropWidth + (u - t.startCropWidth) * 2, k = t.startCropHeight + (p - t.startCropHeight) * 2;
|
|
340
|
+
n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
|
|
342
341
|
} else if (d === "sw") {
|
|
343
|
-
const
|
|
344
|
-
n.width = Math.min(Math.max(20,
|
|
342
|
+
const R = t.startCropWidth - (t.startCropWidth + u) * 2, k = t.startCropHeight - (t.startCropHeight - p) * 2;
|
|
343
|
+
n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
|
|
345
344
|
} else if (d === "nw") {
|
|
346
|
-
const
|
|
347
|
-
n.width = Math.min(Math.max(20,
|
|
345
|
+
const R = t.startCropWidth - (t.startCropWidth + u) * 2, k = t.startCropHeight - (t.startCropHeight + p) * 2;
|
|
346
|
+
n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
|
|
348
347
|
}
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
|
|
348
|
+
if (e && n.width && n.height) {
|
|
349
|
+
const R = n.height * e, k = n.width / e;
|
|
350
|
+
R <= n.width ? n.width = R : n.height = k, n.x = x - n.width / 2, n.y = _ - n.height / 2;
|
|
352
351
|
}
|
|
353
352
|
} else
|
|
354
|
-
d === "ne" ? (n.x =
|
|
355
|
-
const
|
|
353
|
+
d === "ne" ? (n.x = t.startCropX, n.width = u, e ? (n.height = n.width / e, n.y = t.startCropY - n.height) : (n.height = Math.abs(p), n.y = t.startCropY - n.height)) : d === "se" ? (n.x = t.startCropX, n.y = t.startCropY, n.width = u, e ? n.height = n.width / e : n.height = p) : d === "sw" ? (n.x = t.startCropX + u, n.y = t.startCropY, n.width = Math.abs(u), e ? n.height = n.width / e : n.height = p) : d === "nw" && (n.x = t.startCropX + u, n.width = Math.abs(u), e ? (n.height = n.width / e, n.y = t.startCropY - n.height) : (n.height = Math.abs(p), n.y = t.startCropY + p));
|
|
354
|
+
const C = ct(
|
|
356
355
|
n,
|
|
357
|
-
|
|
356
|
+
e,
|
|
358
357
|
d,
|
|
359
358
|
a.width,
|
|
360
359
|
a.height,
|
|
361
360
|
l,
|
|
362
361
|
c,
|
|
363
|
-
|
|
362
|
+
h,
|
|
364
363
|
i
|
|
365
364
|
);
|
|
366
|
-
return
|
|
365
|
+
return e || v.xyOrds.indexOf(g) > -1 ? o = C : v.xOrds.indexOf(g) > -1 ? (o.x = C.x, o.width = C.width) : v.yOrds.indexOf(g) > -1 && (o.y = C.y, o.height = C.height), o.x = A(o.x, 0, a.width - o.width), o.y = A(o.y, 0, a.height - o.height), o;
|
|
367
366
|
}
|
|
368
367
|
renderCropSelection() {
|
|
369
368
|
const {
|
|
370
|
-
ariaLabels:
|
|
371
|
-
crop:
|
|
369
|
+
ariaLabels: t = v.defaultProps.ariaLabels,
|
|
370
|
+
crop: e,
|
|
372
371
|
disabled: r,
|
|
373
372
|
locked: i,
|
|
374
|
-
renderSelectionAddon:
|
|
373
|
+
renderSelectionAddon: h,
|
|
375
374
|
ruleOfThirds: a
|
|
376
375
|
} = this.props, l = this.getCropStyle();
|
|
377
|
-
if (
|
|
376
|
+
if (e)
|
|
378
377
|
return /* @__PURE__ */ f.jsxs(
|
|
379
378
|
"div",
|
|
380
379
|
{
|
|
381
380
|
style: l,
|
|
382
381
|
className: "ReactCrop__crop-selection",
|
|
383
382
|
onPointerDown: this.onCropPointerDown,
|
|
384
|
-
"aria-label":
|
|
383
|
+
"aria-label": t.cropArea,
|
|
385
384
|
tabIndex: 0,
|
|
386
385
|
onKeyDown: this.onComponentKeyDown,
|
|
387
386
|
role: "group",
|
|
@@ -397,7 +396,7 @@ const _ = class _ extends w.PureComponent {
|
|
|
397
396
|
className: "ReactCrop__drag-handle ord-nw",
|
|
398
397
|
"data-ord": "nw",
|
|
399
398
|
tabIndex: 0,
|
|
400
|
-
"aria-label":
|
|
399
|
+
"aria-label": t.nwDragHandle,
|
|
401
400
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "nw"),
|
|
402
401
|
role: "button"
|
|
403
402
|
}
|
|
@@ -408,7 +407,7 @@ const _ = class _ extends w.PureComponent {
|
|
|
408
407
|
className: "ReactCrop__drag-handle ord-n",
|
|
409
408
|
"data-ord": "n",
|
|
410
409
|
tabIndex: 0,
|
|
411
|
-
"aria-label":
|
|
410
|
+
"aria-label": t.nDragHandle,
|
|
412
411
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "n"),
|
|
413
412
|
role: "button"
|
|
414
413
|
}
|
|
@@ -419,7 +418,7 @@ const _ = class _ extends w.PureComponent {
|
|
|
419
418
|
className: "ReactCrop__drag-handle ord-ne",
|
|
420
419
|
"data-ord": "ne",
|
|
421
420
|
tabIndex: 0,
|
|
422
|
-
"aria-label":
|
|
421
|
+
"aria-label": t.neDragHandle,
|
|
423
422
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "ne"),
|
|
424
423
|
role: "button"
|
|
425
424
|
}
|
|
@@ -430,7 +429,7 @@ const _ = class _ extends w.PureComponent {
|
|
|
430
429
|
className: "ReactCrop__drag-handle ord-e",
|
|
431
430
|
"data-ord": "e",
|
|
432
431
|
tabIndex: 0,
|
|
433
|
-
"aria-label":
|
|
432
|
+
"aria-label": t.eDragHandle,
|
|
434
433
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "e"),
|
|
435
434
|
role: "button"
|
|
436
435
|
}
|
|
@@ -441,7 +440,7 @@ const _ = class _ extends w.PureComponent {
|
|
|
441
440
|
className: "ReactCrop__drag-handle ord-se",
|
|
442
441
|
"data-ord": "se",
|
|
443
442
|
tabIndex: 0,
|
|
444
|
-
"aria-label":
|
|
443
|
+
"aria-label": t.seDragHandle,
|
|
445
444
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "se"),
|
|
446
445
|
role: "button"
|
|
447
446
|
}
|
|
@@ -452,7 +451,7 @@ const _ = class _ extends w.PureComponent {
|
|
|
452
451
|
className: "ReactCrop__drag-handle ord-s",
|
|
453
452
|
"data-ord": "s",
|
|
454
453
|
tabIndex: 0,
|
|
455
|
-
"aria-label":
|
|
454
|
+
"aria-label": t.sDragHandle,
|
|
456
455
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "s"),
|
|
457
456
|
role: "button"
|
|
458
457
|
}
|
|
@@ -463,7 +462,7 @@ const _ = class _ extends w.PureComponent {
|
|
|
463
462
|
className: "ReactCrop__drag-handle ord-sw",
|
|
464
463
|
"data-ord": "sw",
|
|
465
464
|
tabIndex: 0,
|
|
466
|
-
"aria-label":
|
|
465
|
+
"aria-label": t.swDragHandle,
|
|
467
466
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "sw"),
|
|
468
467
|
role: "button"
|
|
469
468
|
}
|
|
@@ -474,18 +473,18 @@ const _ = class _ extends w.PureComponent {
|
|
|
474
473
|
className: "ReactCrop__drag-handle ord-w",
|
|
475
474
|
"data-ord": "w",
|
|
476
475
|
tabIndex: 0,
|
|
477
|
-
"aria-label":
|
|
476
|
+
"aria-label": t.wDragHandle,
|
|
478
477
|
onKeyDown: (c) => this.onHandlerKeyDown(c, "w"),
|
|
479
478
|
role: "button"
|
|
480
479
|
}
|
|
481
480
|
)
|
|
482
481
|
] }),
|
|
483
|
-
|
|
482
|
+
h && /* @__PURE__ */ f.jsx(
|
|
484
483
|
"div",
|
|
485
484
|
{
|
|
486
485
|
className: "ReactCrop__selection-addon",
|
|
487
486
|
onPointerDown: (c) => c.stopPropagation(),
|
|
488
|
-
children:
|
|
487
|
+
children: h(this.state)
|
|
489
488
|
}
|
|
490
489
|
),
|
|
491
490
|
a && /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
|
|
@@ -496,61 +495,61 @@ const _ = class _ extends w.PureComponent {
|
|
|
496
495
|
}
|
|
497
496
|
);
|
|
498
497
|
}
|
|
499
|
-
makePixelCrop(
|
|
500
|
-
const
|
|
501
|
-
return j(
|
|
498
|
+
makePixelCrop(t) {
|
|
499
|
+
const e = { ...q, ...this.props.crop || {} };
|
|
500
|
+
return j(e, t.width, t.height);
|
|
502
501
|
}
|
|
503
502
|
render() {
|
|
504
503
|
const {
|
|
505
|
-
aspect:
|
|
506
|
-
children:
|
|
504
|
+
aspect: t,
|
|
505
|
+
children: e,
|
|
507
506
|
circularCrop: r,
|
|
508
507
|
className: i,
|
|
509
|
-
crop:
|
|
508
|
+
crop: h,
|
|
510
509
|
disabled: a,
|
|
511
510
|
loading: l,
|
|
512
511
|
locked: c,
|
|
513
512
|
ruleOfThirds: o,
|
|
514
513
|
style: d
|
|
515
|
-
} = this.props, { cropIsActive:
|
|
514
|
+
} = this.props, { cropIsActive: g, newCropIsBeingDrawn: u } = this.state, p = h ? this.renderCropSelection() : null, n = Pt(
|
|
516
515
|
"ReactCrop",
|
|
517
516
|
i,
|
|
518
|
-
|
|
517
|
+
g && "ReactCrop--active",
|
|
519
518
|
a && "ReactCrop--disabled",
|
|
520
519
|
c && "ReactCrop--locked",
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
!this.dragStarted &&
|
|
520
|
+
u && "ReactCrop--new-crop",
|
|
521
|
+
h && t && "ReactCrop--fixed-aspect",
|
|
522
|
+
h && r && "ReactCrop--circular-crop",
|
|
523
|
+
h && o && "ReactCrop--rule-of-thirds",
|
|
524
|
+
!this.dragStarted && h && !h.width && !h.height && "ReactCrop--invisible-crop",
|
|
526
525
|
r && "ReactCrop--no-animate",
|
|
527
526
|
l && "ReactCrop--loading"
|
|
528
527
|
);
|
|
529
|
-
let
|
|
530
|
-
if (
|
|
531
|
-
let
|
|
528
|
+
let C;
|
|
529
|
+
if (h) {
|
|
530
|
+
let x = /* @__PURE__ */ f.jsx(
|
|
532
531
|
"rect",
|
|
533
532
|
{
|
|
534
|
-
x: `${
|
|
535
|
-
y: `${
|
|
536
|
-
width: `${
|
|
537
|
-
height: `${
|
|
533
|
+
x: `${h.x}${h.unit}`,
|
|
534
|
+
y: `${h.y}${h.unit}`,
|
|
535
|
+
width: `${h.width}${h.unit}`,
|
|
536
|
+
height: `${h.height}${h.unit}`,
|
|
538
537
|
fill: "black"
|
|
539
538
|
}
|
|
540
539
|
);
|
|
541
|
-
r && (
|
|
540
|
+
r && (x = /* @__PURE__ */ f.jsx(
|
|
542
541
|
"ellipse",
|
|
543
542
|
{
|
|
544
|
-
cx: `${
|
|
545
|
-
cy: `${
|
|
546
|
-
rx: `${
|
|
547
|
-
ry: `${
|
|
543
|
+
cx: `${h.x + h.width / 2}${h.unit}`,
|
|
544
|
+
cy: `${h.y + h.height / 2}${h.unit}`,
|
|
545
|
+
rx: `${h.width / 2}${h.unit}`,
|
|
546
|
+
ry: `${h.height / 2}${h.unit}`,
|
|
548
547
|
fill: "black"
|
|
549
548
|
}
|
|
550
|
-
)),
|
|
549
|
+
)), C = /* @__PURE__ */ f.jsxs("svg", { className: "ReactCrop__crop-mask", width: "100%", height: "100%", children: [
|
|
551
550
|
/* @__PURE__ */ f.jsx("defs", { children: /* @__PURE__ */ f.jsxs("mask", { id: `hole-${this.instanceId}`, children: [
|
|
552
551
|
/* @__PURE__ */ f.jsx("rect", { width: "100%", height: "100%", fill: "white" }),
|
|
553
|
-
|
|
552
|
+
x
|
|
554
553
|
] }) }),
|
|
555
554
|
/* @__PURE__ */ f.jsx(
|
|
556
555
|
"rect",
|
|
@@ -571,15 +570,15 @@ const _ = class _ extends w.PureComponent {
|
|
|
571
570
|
ref: this.mediaRef,
|
|
572
571
|
className: "ReactCrop__child-wrapper",
|
|
573
572
|
onPointerDown: this.onComponentPointerDown,
|
|
574
|
-
children:
|
|
573
|
+
children: e
|
|
575
574
|
}
|
|
576
575
|
),
|
|
577
|
-
|
|
578
|
-
|
|
576
|
+
C,
|
|
577
|
+
p
|
|
579
578
|
] });
|
|
580
579
|
}
|
|
581
580
|
};
|
|
582
|
-
|
|
581
|
+
v.xOrds = ["e", "w"], v.yOrds = ["n", "s"], v.xyOrds = ["nw", "ne", "se", "sw"], v.nudgeStep = 1, v.nudgeStepMedium = 10, v.nudgeStepLarge = 100, v.defaultProps = {
|
|
583
582
|
ariaLabels: {
|
|
584
583
|
cropArea: "Use the arrow keys to move the crop selection area",
|
|
585
584
|
eDragHandle: "Use the up and down arrow keys to move the east drag handle to change the crop selection area",
|
|
@@ -592,215 +591,215 @@ _.xOrds = ["e", "w"], _.yOrds = ["n", "s"], _.xyOrds = ["nw", "ne", "se", "sw"],
|
|
|
592
591
|
wDragHandle: "Use the up and down arrow keys to move the west drag handle to change the crop selection area"
|
|
593
592
|
}
|
|
594
593
|
};
|
|
595
|
-
let
|
|
596
|
-
function
|
|
597
|
-
return
|
|
598
|
-
|
|
594
|
+
let it = v;
|
|
595
|
+
function lt(s, t, e, r = 100) {
|
|
596
|
+
return Lt(
|
|
597
|
+
Yt(
|
|
599
598
|
{
|
|
600
599
|
unit: "%",
|
|
601
600
|
width: r
|
|
602
601
|
},
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
602
|
+
e,
|
|
603
|
+
s,
|
|
604
|
+
t
|
|
606
605
|
),
|
|
607
|
-
|
|
608
|
-
|
|
606
|
+
s,
|
|
607
|
+
t
|
|
609
608
|
);
|
|
610
609
|
}
|
|
611
|
-
const
|
|
610
|
+
const Et = w.forwardRef(
|
|
612
611
|
({
|
|
613
|
-
cropper:
|
|
614
|
-
disabled:
|
|
615
|
-
fillImage:
|
|
612
|
+
cropper: s,
|
|
613
|
+
disabled: t,
|
|
614
|
+
fillImage: e,
|
|
616
615
|
image: r,
|
|
617
616
|
loadable: i,
|
|
618
|
-
loading:
|
|
617
|
+
loading: h,
|
|
619
618
|
multiple: a,
|
|
620
619
|
resizer: l,
|
|
621
620
|
rotation: c,
|
|
622
621
|
useInternalLoading: o
|
|
623
622
|
}, d) => {
|
|
624
|
-
const [
|
|
623
|
+
const [g, u] = w.useState(!1), [p, n] = w.useState(t), [C, x] = w.useState(!1), [_, R] = w.useState({
|
|
625
624
|
height: 0,
|
|
626
|
-
unit:
|
|
625
|
+
unit: U.AspectRatio,
|
|
627
626
|
width: 0,
|
|
628
627
|
x: 0,
|
|
629
628
|
y: 0
|
|
630
|
-
}), [
|
|
629
|
+
}), [k, $] = w.useState(r?.url ?? ""), [L, V] = w.useState({
|
|
631
630
|
height: 0,
|
|
632
631
|
width: 0
|
|
633
|
-
}), [
|
|
632
|
+
}), [dt, pt] = w.useState({
|
|
634
633
|
height: r?.height ?? 0,
|
|
635
634
|
width: r?.width ?? 0
|
|
636
|
-
}),
|
|
635
|
+
}), D = w.useRef(null), T = w.useRef(r?.url ?? ""), Z = w.useRef(null), G = w.useRef({
|
|
637
636
|
height: r?.height ?? 0,
|
|
638
637
|
width: r?.width ?? 0
|
|
639
|
-
}),
|
|
640
|
-
G.current = { ...
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
638
|
+
}), I = w.useRef(null);
|
|
639
|
+
G.current = { ...dt };
|
|
640
|
+
const N = w.useCallback(() => {
|
|
641
|
+
I.current && clearTimeout(I.current), I.current = setTimeout(() => {
|
|
642
|
+
I.current = null, u(!0);
|
|
644
643
|
}, 1e3);
|
|
645
|
-
}, []),
|
|
646
|
-
|
|
644
|
+
}, []), O = w.useCallback(() => {
|
|
645
|
+
I.current ? (clearTimeout(I.current), I.current = null) : u(!1);
|
|
647
646
|
}, []);
|
|
648
647
|
w.useEffect(() => () => {
|
|
649
|
-
|
|
648
|
+
I.current && clearTimeout(I.current);
|
|
650
649
|
}, []);
|
|
651
|
-
const
|
|
652
|
-
if (!
|
|
650
|
+
const y = w.useMemo(() => r, [r.url, r.width, r.height, r.rotation, r.extension, r.x, r.y]), P = w.useMemo(() => l, [l.width, l.height, l.maxWidth, l.maxHeight]), J = w.useCallback(() => {
|
|
651
|
+
if (!D.current)
|
|
653
652
|
return { maxHeight: 0, maxWidth: 0 };
|
|
654
|
-
let m = 0,
|
|
655
|
-
const H =
|
|
656
|
-
return H >
|
|
657
|
-
}, [
|
|
653
|
+
let m = 0, b = 0;
|
|
654
|
+
const H = y.width / y.height, E = D.current.clientWidth / D.current.clientHeight;
|
|
655
|
+
return H > E ? (m = D.current.clientWidth, b = m / H) : (b = D.current.clientHeight, m = b * H), { maxHeight: b, maxWidth: m };
|
|
656
|
+
}, [y.width, y.height]);
|
|
658
657
|
w.useEffect(() => {
|
|
659
|
-
|
|
660
|
-
height:
|
|
661
|
-
unit:
|
|
662
|
-
width:
|
|
663
|
-
x:
|
|
664
|
-
y:
|
|
658
|
+
R({
|
|
659
|
+
height: s.percentageHeight,
|
|
660
|
+
unit: U.AspectRatio,
|
|
661
|
+
width: s.percentageWidth,
|
|
662
|
+
x: s.x,
|
|
663
|
+
y: s.y
|
|
665
664
|
});
|
|
666
|
-
}, [
|
|
667
|
-
const { height: m, width:
|
|
665
|
+
}, [s]), w.useEffect(() => {
|
|
666
|
+
const { height: m, width: b } = P, H = (X, B) => t ? P.width !== G.current.width || P.height !== G.current.height : b < X || m < B, W = st(async () => {
|
|
668
667
|
if (c !== 0)
|
|
669
668
|
return;
|
|
670
|
-
const { maxHeight:
|
|
671
|
-
if (!i || !
|
|
672
|
-
|
|
669
|
+
const { maxHeight: X, maxWidth: B } = J(), ft = H(B, X);
|
|
670
|
+
if (!i || !ft && T.current) {
|
|
671
|
+
$(y.url), n(t), O();
|
|
673
672
|
return;
|
|
674
673
|
}
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
const F =
|
|
678
|
-
|
|
679
|
-
F &&
|
|
680
|
-
F &&
|
|
681
|
-
|
|
682
|
-
|
|
674
|
+
const nt = T.current !== y.url;
|
|
675
|
+
nt && N();
|
|
676
|
+
const F = t && !e, { height: mt, width: Ct } = Ht(y.width, y.height, b, m), { url: xt } = await jt(
|
|
677
|
+
y.url,
|
|
678
|
+
F && P.width || B,
|
|
679
|
+
F && P.height || X,
|
|
680
|
+
D.current?.clientWidth ?? window.innerWidth,
|
|
681
|
+
D.current?.clientHeight ?? window.innerHeight
|
|
683
682
|
);
|
|
684
|
-
|
|
685
|
-
height: F ?
|
|
686
|
-
width: F ?
|
|
687
|
-
}), n(
|
|
683
|
+
$(xt), V({
|
|
684
|
+
height: F ? P.height : mt,
|
|
685
|
+
width: F ? P.width : Ct
|
|
686
|
+
}), n(t), nt || O(), T.current = y.url;
|
|
688
687
|
}, 300, { leading: !1 });
|
|
689
|
-
return
|
|
690
|
-
}, [
|
|
691
|
-
const
|
|
688
|
+
return W(), () => W.cancel();
|
|
689
|
+
}, [t, y, i, J, P, c, e, N, O, n]), w.useEffect(() => {
|
|
690
|
+
const b = st(async () => {
|
|
692
691
|
if (i && c !== 0) {
|
|
693
|
-
|
|
694
|
-
const { height:
|
|
695
|
-
|
|
696
|
-
|
|
692
|
+
N();
|
|
693
|
+
const { height: E, width: W } = $t(
|
|
694
|
+
y.width,
|
|
695
|
+
y.height,
|
|
697
696
|
c
|
|
698
|
-
),
|
|
697
|
+
), X = await St(
|
|
699
698
|
{
|
|
700
|
-
height:
|
|
701
|
-
url:
|
|
702
|
-
width:
|
|
699
|
+
height: y.height,
|
|
700
|
+
url: y.url,
|
|
701
|
+
width: y.width
|
|
703
702
|
},
|
|
704
703
|
c
|
|
705
704
|
);
|
|
706
|
-
|
|
707
|
-
height:
|
|
708
|
-
width:
|
|
709
|
-
}), n(
|
|
705
|
+
$(X), V({
|
|
706
|
+
height: E,
|
|
707
|
+
width: W
|
|
708
|
+
}), n(t), T.current = y.url;
|
|
710
709
|
} else
|
|
711
|
-
i ?
|
|
710
|
+
i ? N() : $(y.url);
|
|
712
711
|
}, 300, { leading: !1 });
|
|
713
|
-
return
|
|
714
|
-
}, [
|
|
715
|
-
const
|
|
716
|
-
|
|
712
|
+
return b(), () => b.cancel();
|
|
713
|
+
}, [y, i, c, t, J, N, O]);
|
|
714
|
+
const rt = w.useCallback(() => {
|
|
715
|
+
R({
|
|
717
716
|
height: 100,
|
|
718
717
|
unit: "%",
|
|
719
718
|
width: 100,
|
|
720
719
|
x: 0,
|
|
721
720
|
y: 0
|
|
722
721
|
});
|
|
723
|
-
}, []),
|
|
724
|
-
(m,
|
|
725
|
-
|
|
722
|
+
}, []), gt = w.useCallback(
|
|
723
|
+
(m, b) => {
|
|
724
|
+
t || R(b);
|
|
726
725
|
},
|
|
727
|
-
[
|
|
728
|
-
),
|
|
726
|
+
[t]
|
|
727
|
+
), ot = w.useCallback(
|
|
729
728
|
(m) => {
|
|
730
729
|
if (!Z.current)
|
|
731
730
|
return;
|
|
732
|
-
const { naturalHeight:
|
|
733
|
-
if (
|
|
734
|
-
height:
|
|
731
|
+
const { naturalHeight: b, naturalWidth: H } = m.currentTarget;
|
|
732
|
+
if (pt({
|
|
733
|
+
height: b,
|
|
735
734
|
width: H
|
|
736
735
|
}), V({
|
|
737
|
-
height:
|
|
736
|
+
height: b,
|
|
738
737
|
width: H
|
|
739
|
-
}),
|
|
740
|
-
const { height:
|
|
741
|
-
|
|
742
|
-
|
|
738
|
+
}), s.unit === U.AspectRatio) {
|
|
739
|
+
const { height: E, width: W } = m.currentTarget;
|
|
740
|
+
R(
|
|
741
|
+
lt(W, E, s.width / s.height)
|
|
743
742
|
);
|
|
744
743
|
} else
|
|
745
|
-
|
|
744
|
+
R({
|
|
746
745
|
height: 100,
|
|
747
746
|
unit: "%",
|
|
748
747
|
width: 100,
|
|
749
748
|
x: 0,
|
|
750
749
|
y: 0
|
|
751
750
|
});
|
|
752
|
-
|
|
751
|
+
O();
|
|
753
752
|
},
|
|
754
|
-
[
|
|
753
|
+
[s.height, s.unit, s.width, O]
|
|
755
754
|
);
|
|
756
755
|
w.useEffect(() => {
|
|
757
|
-
|
|
758
|
-
}, [
|
|
759
|
-
if (!
|
|
756
|
+
rt();
|
|
757
|
+
}, [t, rt]), w.useEffect(() => {
|
|
758
|
+
if (!D.current || !i)
|
|
760
759
|
return;
|
|
761
760
|
const m = new CustomEvent("cx-cropper-loading-change", {
|
|
762
761
|
bubbles: !0,
|
|
763
762
|
cancelable: !1,
|
|
764
763
|
composed: !0,
|
|
765
|
-
detail:
|
|
764
|
+
detail: g
|
|
766
765
|
});
|
|
767
|
-
|
|
768
|
-
}, [
|
|
769
|
-
const Q = w.useMemo(() =>
|
|
770
|
-
(m,
|
|
766
|
+
D.current.dispatchEvent(m), g || x(!0);
|
|
767
|
+
}, [g, i]);
|
|
768
|
+
const Q = w.useMemo(() => s.focusMode === "center", [s.focusMode]), tt = w.useCallback(
|
|
769
|
+
(m, b) => {
|
|
771
770
|
const H = new CustomEvent("cx-cropper-crop-complete", {
|
|
772
771
|
bubbles: !0,
|
|
773
772
|
cancelable: !1,
|
|
774
773
|
composed: !0,
|
|
775
774
|
detail: {
|
|
776
|
-
croppedArea:
|
|
775
|
+
croppedArea: b
|
|
777
776
|
}
|
|
778
777
|
});
|
|
779
|
-
|
|
778
|
+
D.current?.dispatchEvent(H);
|
|
780
779
|
},
|
|
781
780
|
[]
|
|
782
781
|
);
|
|
783
782
|
w.useEffect(() => {
|
|
784
783
|
if (Q) {
|
|
785
|
-
const m =
|
|
784
|
+
const m = lt(
|
|
786
785
|
r.width,
|
|
787
786
|
r.height,
|
|
788
|
-
|
|
789
|
-
|
|
787
|
+
s.width / s.height,
|
|
788
|
+
s.percentageWidth
|
|
790
789
|
);
|
|
791
|
-
|
|
790
|
+
R(m), tt(void 0, m);
|
|
792
791
|
}
|
|
793
792
|
}, [
|
|
794
793
|
Q,
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
794
|
+
s.percentageWidth,
|
|
795
|
+
s.width,
|
|
796
|
+
s.height,
|
|
798
797
|
r.width,
|
|
799
798
|
r.height,
|
|
800
|
-
|
|
799
|
+
tt
|
|
801
800
|
]);
|
|
802
|
-
const
|
|
803
|
-
const
|
|
801
|
+
const ut = w.useCallback((m) => {
|
|
802
|
+
const b = new CustomEvent("cx-cropper-crop-drag-start", {
|
|
804
803
|
bubbles: !0,
|
|
805
804
|
cancelable: !1,
|
|
806
805
|
composed: !0,
|
|
@@ -809,67 +808,69 @@ const We = w.forwardRef(
|
|
|
809
808
|
clientY: m.clientY
|
|
810
809
|
}
|
|
811
810
|
});
|
|
812
|
-
|
|
813
|
-
}, []),
|
|
814
|
-
if (!
|
|
811
|
+
D.current?.dispatchEvent(b);
|
|
812
|
+
}, []), wt = w.useMemo(() => {
|
|
813
|
+
if (!D.current)
|
|
815
814
|
return !1;
|
|
816
|
-
const m =
|
|
817
|
-
return m >
|
|
818
|
-
}, [
|
|
815
|
+
const m = L.height / L.width, b = D.current.clientHeight / D.current.clientWidth;
|
|
816
|
+
return m > b;
|
|
817
|
+
}, [L.height, L.width]);
|
|
819
818
|
return /* @__PURE__ */ f.jsx(
|
|
820
819
|
"div",
|
|
821
820
|
{
|
|
822
|
-
ref:
|
|
823
|
-
className: `cropper cropper--${
|
|
821
|
+
ref: D,
|
|
822
|
+
className: `cropper cropper--${wt ? "portrait" : "landscape"}${a ? " cropper--multiple" : ""}`,
|
|
824
823
|
children: i ? /* @__PURE__ */ f.jsx(
|
|
825
|
-
|
|
824
|
+
it,
|
|
826
825
|
{
|
|
827
|
-
aspect:
|
|
828
|
-
crop:
|
|
826
|
+
aspect: s.keepAspectRatio || s.unit === U.AspectRatio ? s.width / s.height : void 0,
|
|
827
|
+
crop: _,
|
|
829
828
|
centerCrop: Q,
|
|
830
|
-
disabled:
|
|
831
|
-
loading:
|
|
829
|
+
disabled: p,
|
|
830
|
+
loading: h || o && g,
|
|
832
831
|
keepSelection: !0,
|
|
832
|
+
minHeight: 1,
|
|
833
|
+
minWidth: 1,
|
|
833
834
|
ruleOfThirds: !0,
|
|
834
|
-
onChange:
|
|
835
|
-
onComplete:
|
|
836
|
-
onDragStart:
|
|
835
|
+
onChange: gt,
|
|
836
|
+
onComplete: tt,
|
|
837
|
+
onDragStart: ut,
|
|
837
838
|
style: {
|
|
838
|
-
cursor:
|
|
839
|
-
pointerEvents:
|
|
839
|
+
cursor: p ? "default" : "move",
|
|
840
|
+
pointerEvents: p ? "none" : "auto"
|
|
840
841
|
},
|
|
841
842
|
children: /* @__PURE__ */ f.jsx(
|
|
842
843
|
"img",
|
|
843
844
|
{
|
|
844
845
|
className: "cropper__image",
|
|
845
|
-
src:
|
|
846
|
+
src: k,
|
|
846
847
|
alt: "Cropped",
|
|
847
848
|
ref: Z,
|
|
848
|
-
onLoad:
|
|
849
|
+
onLoad: ot
|
|
849
850
|
}
|
|
850
851
|
)
|
|
851
852
|
},
|
|
852
|
-
|
|
853
|
+
y.url
|
|
853
854
|
) : /* @__PURE__ */ f.jsx(
|
|
854
855
|
"img",
|
|
855
856
|
{
|
|
856
|
-
className: `cropper__image ${
|
|
857
|
-
src:
|
|
857
|
+
className: `cropper__image ${g && !C ? "cropper__image--loading" : ""}`,
|
|
858
|
+
src: k,
|
|
858
859
|
alt: "Cropped",
|
|
859
860
|
ref: Z,
|
|
860
|
-
onLoad:
|
|
861
|
+
onLoad: ot
|
|
861
862
|
}
|
|
862
863
|
)
|
|
863
864
|
}
|
|
864
865
|
);
|
|
865
866
|
}
|
|
866
867
|
);
|
|
867
|
-
var
|
|
868
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
869
|
-
(a = h
|
|
870
|
-
return r && i &&
|
|
868
|
+
var Wt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, z = (s, t, e, r) => {
|
|
869
|
+
for (var i = r > 1 ? void 0 : r ? At(t, e) : t, h = s.length - 1, a; h >= 0; h--)
|
|
870
|
+
(a = s[h]) && (i = (r ? a(t, e, i) : a(i)) || i);
|
|
871
|
+
return r && i && Wt(t, e, i), i;
|
|
871
872
|
};
|
|
872
|
-
const
|
|
873
|
+
const Kt = Mt(Et, zt, kt, {
|
|
873
874
|
// @ts-expect-error type error
|
|
874
875
|
props: {
|
|
875
876
|
cropper: "object",
|
|
@@ -885,15 +886,15 @@ const Ke = Me(We, ze, ke, {
|
|
|
885
886
|
useInternalLoading: "boolean"
|
|
886
887
|
}
|
|
887
888
|
});
|
|
888
|
-
customElements.get("custom-cropper") || customElements.define("custom-cropper",
|
|
889
|
-
let
|
|
889
|
+
customElements.get("custom-cropper") || customElements.define("custom-cropper", Kt);
|
|
890
|
+
let M = class extends bt {
|
|
890
891
|
constructor() {
|
|
891
892
|
super(...arguments), this.cropper = {
|
|
892
893
|
height: 0,
|
|
893
894
|
keepAspectRatio: !0,
|
|
894
895
|
percentageHeight: 0,
|
|
895
896
|
percentageWidth: 0,
|
|
896
|
-
unit:
|
|
897
|
+
unit: U.Pixel,
|
|
897
898
|
width: 0,
|
|
898
899
|
x: 0,
|
|
899
900
|
y: 0
|
|
@@ -902,62 +903,62 @@ let k = class extends be {
|
|
|
902
903
|
width: 0
|
|
903
904
|
}, this.rotation = 0, this.fillImage = !1, this.disabled = !1, this.loadable = !1, this.loading = !1, this.multiple = !1, this.useInternalLoading = !1, this.showLoading = !0;
|
|
904
905
|
}
|
|
905
|
-
handleLoadingChange(
|
|
906
|
-
|
|
906
|
+
handleLoadingChange(s) {
|
|
907
|
+
s.detail || (this.showLoading = s.detail);
|
|
907
908
|
}
|
|
908
909
|
render() {
|
|
909
|
-
return
|
|
910
|
-
${
|
|
910
|
+
return et`
|
|
911
|
+
${at(
|
|
911
912
|
this.image,
|
|
912
|
-
() =>
|
|
913
|
+
() => et`<custom-cropper .ref=${this} .cropper=${this.cropper} .image=${this.image} .loadable=${this.loadable} .resizer=${this.resizer} .rotation=${this.rotation} .disabled=${this.disabled} .loading=${this.loading} .fillImage=${this.fillImage} .useInternalLoading=${this.useInternalLoading} .multiple=${this.multiple} @cx-cropper-loading-change=${this.handleLoadingChange}></custom-cropper>`
|
|
913
914
|
)}
|
|
914
|
-
${
|
|
915
|
+
${at(
|
|
915
916
|
this.showLoading,
|
|
916
|
-
() =>
|
|
917
|
+
() => et`<div class="loading-container"><div class="loading"><cx-skeleton class="loading__skeleton"></cx-skeleton><cx-spinner class="loading__spinner"></cx-spinner></div></div>`
|
|
917
918
|
)}
|
|
918
919
|
`;
|
|
919
920
|
}
|
|
920
921
|
};
|
|
921
|
-
|
|
922
|
+
M.styles = [yt, It];
|
|
922
923
|
z([
|
|
923
|
-
|
|
924
|
-
],
|
|
924
|
+
Dt("custom-cropper")
|
|
925
|
+
], M.prototype, "cropperEl", 2);
|
|
925
926
|
z([
|
|
926
927
|
S({ type: Object })
|
|
927
|
-
],
|
|
928
|
+
], M.prototype, "cropper", 2);
|
|
928
929
|
z([
|
|
929
930
|
S({ type: Object })
|
|
930
|
-
],
|
|
931
|
+
], M.prototype, "image", 2);
|
|
931
932
|
z([
|
|
932
933
|
S({ type: Object })
|
|
933
|
-
],
|
|
934
|
+
], M.prototype, "resizer", 2);
|
|
934
935
|
z([
|
|
935
936
|
S({ reflect: !0, type: Number })
|
|
936
|
-
],
|
|
937
|
+
], M.prototype, "rotation", 2);
|
|
937
938
|
z([
|
|
938
939
|
S({ attribute: "fill-image", reflect: !0, type: Boolean })
|
|
939
|
-
],
|
|
940
|
+
], M.prototype, "fillImage", 2);
|
|
940
941
|
z([
|
|
941
942
|
S({ reflect: !0, type: Boolean })
|
|
942
|
-
],
|
|
943
|
+
], M.prototype, "disabled", 2);
|
|
943
944
|
z([
|
|
944
945
|
S({ reflect: !0, type: Boolean })
|
|
945
|
-
],
|
|
946
|
+
], M.prototype, "loadable", 2);
|
|
946
947
|
z([
|
|
947
948
|
S({ reflect: !0, type: Boolean })
|
|
948
|
-
],
|
|
949
|
+
], M.prototype, "loading", 2);
|
|
949
950
|
z([
|
|
950
951
|
S({ reflect: !0, type: Boolean })
|
|
951
|
-
],
|
|
952
|
+
], M.prototype, "multiple", 2);
|
|
952
953
|
z([
|
|
953
954
|
S({ attribute: "use-internal-loading", reflect: !0, type: Boolean })
|
|
954
|
-
],
|
|
955
|
+
], M.prototype, "useInternalLoading", 2);
|
|
955
956
|
z([
|
|
956
|
-
|
|
957
|
-
],
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
],
|
|
957
|
+
_t()
|
|
958
|
+
], M.prototype, "showLoading", 2);
|
|
959
|
+
M = z([
|
|
960
|
+
Rt("cx-cropper")
|
|
961
|
+
], M);
|
|
961
962
|
export {
|
|
962
|
-
|
|
963
|
+
M as default
|
|
963
964
|
};
|