@anzusystems/common-admin 2.0.0-rc.1 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common-admin.js +188 -187
- package/dist/domains/dam/cropper/components/ACropper.js.map +1 -1
- package/dist/domains/dam/cropper/components/ACropper.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/domains/dam/cropper/components/ACropper.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/domains/dam/cropper/utils/cropperGeometry.js +1 -1
- package/dist/domains/dam/cropper/utils/cropperGeometry.js.map +1 -1
- package/dist/domains/dam/keyword/factory/KeywordFactory.js +2 -2
- package/dist/domains/dam/keyword/factory/KeywordFactory.js.map +1 -1
- package/dist/domains/filters/composables/filterFactory.d.ts +31 -2
- package/dist/domains/filters/composables/filterFactory.js +78 -67
- package/dist/domains/filters/composables/filterFactory.js.map +1 -1
- package/dist/domains/system/composables/breadcrumbs.d.ts +6 -6
- package/dist/domains/system/composables/breadcrumbs.js +7 -7
- package/dist/domains/system/composables/breadcrumbs.js.map +1 -1
- package/dist/domains/system/composables/recordActions.d.ts +41 -0
- package/dist/domains/system/composables/recordActions.js +33 -0
- package/dist/domains/system/composables/recordActions.js.map +1 -0
- package/dist/domains/system/composables/recordPage.d.ts +14 -4
- package/dist/domains/system/composables/recordPage.js +36 -34
- package/dist/domains/system/composables/recordPage.js.map +1 -1
- package/dist/lib.d.ts +3 -2
- package/dist/vendor/@cropper/element/dist/element.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element/dist/element.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-canvas/dist/element-canvas.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-canvas/dist/element-canvas.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-crosshair/dist/element-crosshair.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-crosshair/dist/element-crosshair.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-grid/dist/element-grid.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-grid/dist/element-grid.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-handle/dist/element-handle.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-handle/dist/element-handle.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-image/dist/element-image.esm.raw.js +74 -58
- package/dist/vendor/@cropper/element-image/dist/element-image.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-selection/dist/element-selection.esm.raw.js +198 -52
- package/dist/vendor/@cropper/element-selection/dist/element-selection.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-shade/dist/element-shade.esm.raw.js +11 -4
- package/dist/vendor/@cropper/element-shade/dist/element-shade.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-viewer/dist/element-viewer.esm.raw.js +8 -8
- package/dist/vendor/@cropper/element-viewer/dist/element-viewer.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/utils/dist/utils.esm.raw.js +89 -46
- package/dist/vendor/@cropper/utils/dist/utils.esm.raw.js.map +1 -1
- package/dist/vendor/{cropperjs2 → cropperjs}/dist/cropper.esm.raw.js +11 -11
- package/dist/vendor/cropperjs/dist/cropper.esm.raw.js.map +1 -0
- package/package.json +10 -10
- package/src/eslint/adminConfig.mjs +2 -1
- package/src/eslint/oxlint-admin.json +3 -0
- package/dist/vendor/cropperjs2/dist/cropper.esm.raw.js.map +0 -1
|
@@ -1,44 +1,113 @@
|
|
|
1
|
-
import { ACTION_MOVE as e, ACTION_RESIZE_EAST as t, ACTION_RESIZE_NORTH as n, ACTION_RESIZE_NORTHEAST as r, ACTION_RESIZE_NORTHWEST as i, ACTION_RESIZE_SOUTH as a, ACTION_RESIZE_SOUTHEAST as o, ACTION_RESIZE_SOUTHWEST as s, ACTION_RESIZE_WEST as c, ACTION_SCALE as l, ACTION_SELECT as u, ACTION_TRANSFORM as d, CROPPER_CANVAS as f, CROPPER_IMAGE as p, CROPPER_SELECTION as m, EVENT_ACTION as h, EVENT_ACTION_END as g, EVENT_ACTION_START as _, EVENT_CHANGE as v, EVENT_KEYDOWN as y,
|
|
2
|
-
import
|
|
1
|
+
import { ACTION_MOVE as e, ACTION_RESIZE_EAST as t, ACTION_RESIZE_NORTH as n, ACTION_RESIZE_NORTHEAST as r, ACTION_RESIZE_NORTHWEST as i, ACTION_RESIZE_SOUTH as a, ACTION_RESIZE_SOUTHEAST as o, ACTION_RESIZE_SOUTHWEST as s, ACTION_RESIZE_WEST as c, ACTION_SCALE as l, ACTION_SELECT as u, ACTION_TRANSFORM as d, CROPPER_CANVAS as f, CROPPER_IMAGE as p, CROPPER_SELECTION as m, EVENT_ACTION as h, EVENT_ACTION_END as g, EVENT_ACTION_START as _, EVENT_CHANGE as v, EVENT_KEYDOWN as y, exceedsInset as b, getAdjustedSizes as x, getComposedPathTarget as S, getOffset as C, isFunction as w, isNumber as T, isPlainObject as E, isPositiveNumber as D, off as O, on as k } from "../../utils/dist/utils.esm.raw.js";
|
|
2
|
+
import A from "../../element/dist/element.esm.raw.js";
|
|
3
3
|
//#region node_modules/@cropper/element-selection/dist/element-selection.esm.raw.js
|
|
4
|
-
|
|
4
|
+
function j(e, t, n, r) {
|
|
5
|
+
function i(e) {
|
|
6
|
+
return e instanceof n ? e : new n(function(t) {
|
|
7
|
+
t(e);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return new (n ||= Promise)(function(n, a) {
|
|
11
|
+
function o(e) {
|
|
12
|
+
try {
|
|
13
|
+
c(r.next(e));
|
|
14
|
+
} catch (e) {
|
|
15
|
+
a(e);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function s(e) {
|
|
19
|
+
try {
|
|
20
|
+
c(r.throw(e));
|
|
21
|
+
} catch (e) {
|
|
22
|
+
a(e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function c(e) {
|
|
26
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
27
|
+
}
|
|
28
|
+
c((r = r.apply(e, t || [])).next());
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
var M = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:\"\";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}", N = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
function F(e, t, n) {
|
|
33
|
+
let r = parseFloat(e);
|
|
34
|
+
return Number.isNaN(r) ? 0 : e.trim().endsWith("%") ? r / 100 * t : r * n;
|
|
35
|
+
}
|
|
36
|
+
function I(e) {
|
|
37
|
+
let [t, n = t, r = t, i = n] = e;
|
|
38
|
+
return [
|
|
39
|
+
t,
|
|
40
|
+
n,
|
|
41
|
+
r,
|
|
42
|
+
i
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
function L(e, t, n, r) {
|
|
46
|
+
let [i, a = i] = e.split("/").map((e) => {
|
|
47
|
+
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 4);
|
|
48
|
+
return t.length > 0 ? t : ["0"];
|
|
49
|
+
}), o = I(i).map((e) => F(e, t, r)), s = I(a).map((e) => F(e, n, r)), c = o.map((e, t) => [Math.max(e, 0), Math.max(s[t], 0)]), [l, u, d, f] = c, p = Math.min(1, t / (l[0] + u[0] || 1), t / (f[0] + d[0] || 1), n / (l[1] + f[1] || 1), n / (u[1] + d[1] || 1));
|
|
50
|
+
return p < 1 ? c.map(([e, t]) => [e * p, t * p]) : c;
|
|
51
|
+
}
|
|
52
|
+
var R = class extends A {
|
|
5
53
|
constructor() {
|
|
6
|
-
super(...arguments), this.$onCanvasAction = null, this.$onCanvasActionStart = null, this.$onCanvasActionEnd = null, this.$onDocumentKeyDown = null, this.$action = "", this.$actionStartTarget = null, this.$changing = !1, this.$style =
|
|
54
|
+
super(...arguments), this.$onCanvasAction = null, this.$onCanvasActionStart = null, this.$onCanvasActionEnd = null, this.$onDocumentKeyDown = null, this.$action = "", this.$actionStartTarget = null, this.$resizeStart = null, this.$changing = !1, this.$insetRejected = !1, this.$style = M, this.$initialSelection = {
|
|
7
55
|
x: 0,
|
|
8
56
|
y: 0,
|
|
9
57
|
width: 0,
|
|
10
58
|
height: 0
|
|
11
|
-
}, this.x = 0, this.y = 0, this.width = 0, this.height = 0, this.aspectRatio = NaN, this.initialAspectRatio = NaN, this.initialCoverage = NaN, this.active = !1, this.linked = !1, this.dynamic = !1, this.movable = !1, this.resizable = !1, this.zoomable = !1, this.multiple = !1, this.keyboard = !1, this.outlined = !1, this.precise = !1;
|
|
59
|
+
}, this.$changingAroundCenter = !1, this.x = 0, this.y = 0, this.width = 0, this.height = 0, this.aspectRatio = NaN, this.borderRadius = "", this.initialAspectRatio = NaN, this.initialCoverage = NaN, this.active = !1, this.linked = !1, this.dynamic = !1, this.movable = !1, this.maxInset = "auto", this.minInset = "auto", this.resizable = !1, this.resizeAroundCenter = !1, this.zoomable = !1, this.zoomAroundCenter = !1, this.multiple = !1, this.keyboard = !1, this.outlined = !1, this.precise = !1;
|
|
12
60
|
}
|
|
13
61
|
set $canvas(e) {
|
|
14
|
-
|
|
62
|
+
N.set(this, e);
|
|
15
63
|
}
|
|
16
64
|
get $canvas() {
|
|
17
|
-
return
|
|
65
|
+
return N.get(this);
|
|
66
|
+
}
|
|
67
|
+
set $image(e) {
|
|
68
|
+
P.set(this, e);
|
|
69
|
+
}
|
|
70
|
+
get $image() {
|
|
71
|
+
return P.get(this);
|
|
18
72
|
}
|
|
19
73
|
static get observedAttributes() {
|
|
20
74
|
return super.observedAttributes.concat([
|
|
21
75
|
"active",
|
|
22
76
|
"aspect-ratio",
|
|
77
|
+
"border-radius",
|
|
23
78
|
"dynamic",
|
|
24
79
|
"height",
|
|
25
80
|
"initial-aspect-ratio",
|
|
26
81
|
"initial-coverage",
|
|
27
82
|
"keyboard",
|
|
28
83
|
"linked",
|
|
84
|
+
"max-inset",
|
|
85
|
+
"min-inset",
|
|
29
86
|
"movable",
|
|
30
87
|
"multiple",
|
|
31
88
|
"outlined",
|
|
32
89
|
"precise",
|
|
33
90
|
"resizable",
|
|
91
|
+
"resize-around-center",
|
|
34
92
|
"width",
|
|
35
93
|
"x",
|
|
36
94
|
"y",
|
|
95
|
+
"zoom-around-center",
|
|
37
96
|
"zoomable"
|
|
38
97
|
]);
|
|
39
98
|
}
|
|
40
99
|
$propertyChangedCallback(e, t, n) {
|
|
41
100
|
if (!Object.is(n, t)) switch (super.$propertyChangedCallback(e, t, n), e) {
|
|
101
|
+
case "borderRadius":
|
|
102
|
+
this.$nextTick(() => {
|
|
103
|
+
this.$render(), this.$emit(v, {
|
|
104
|
+
x: this.x,
|
|
105
|
+
y: this.y,
|
|
106
|
+
width: this.width,
|
|
107
|
+
height: this.height
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
break;
|
|
42
111
|
case "x":
|
|
43
112
|
case "y":
|
|
44
113
|
case "width":
|
|
@@ -55,12 +124,12 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
55
124
|
break;
|
|
56
125
|
case "initialCoverage":
|
|
57
126
|
this.$nextTick(() => {
|
|
58
|
-
|
|
127
|
+
D(n) && n <= 1 && this.$initSelection(!0, D(t));
|
|
59
128
|
});
|
|
60
129
|
break;
|
|
61
130
|
case "keyboard":
|
|
62
131
|
this.$nextTick(() => {
|
|
63
|
-
this.$canvas && (n ? this.$onDocumentKeyDown || (this.$onDocumentKeyDown = this.$handleKeyDown.bind(this),
|
|
132
|
+
this.$canvas && (n ? this.$onDocumentKeyDown || (this.$onDocumentKeyDown = this.$handleKeyDown.bind(this), k(this.ownerDocument, y, this.$onDocumentKeyDown)) : this.$onDocumentKeyDown &&= (O(this.ownerDocument, y, this.$onDocumentKeyDown), null));
|
|
64
133
|
});
|
|
65
134
|
break;
|
|
66
135
|
case "multiple":
|
|
@@ -91,34 +160,60 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
91
160
|
connectedCallback() {
|
|
92
161
|
super.connectedCallback();
|
|
93
162
|
let e = this.closest(this.$getTagNameOf(f));
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
163
|
+
if (e) {
|
|
164
|
+
this.$canvas = e;
|
|
165
|
+
let t = e.querySelector(this.$getTagNameOf(p));
|
|
166
|
+
t && (this.$image = t), this.$setStyles({
|
|
167
|
+
position: "absolute",
|
|
168
|
+
transform: `translate(${this.x}px, ${this.y}px)`
|
|
169
|
+
}), this.hidden || this.$render(), this.$initSelection(!0), this.$onCanvasActionStart = this.$handleActionStart.bind(this), this.$onCanvasActionEnd = this.$handleActionEnd.bind(this), this.$onCanvasAction = this.$handleAction.bind(this), k(e, _, this.$onCanvasActionStart), k(e, g, this.$onCanvasActionEnd), k(e, h, this.$onCanvasAction);
|
|
170
|
+
} else this.$render();
|
|
98
171
|
}
|
|
99
172
|
disconnectedCallback() {
|
|
100
173
|
let { $canvas: e } = this;
|
|
101
|
-
e && (this.$onCanvasActionStart &&= (
|
|
174
|
+
e && (this.$onCanvasActionStart &&= (O(e, _, this.$onCanvasActionStart), null), this.$onCanvasActionEnd &&= (O(e, g, this.$onCanvasActionEnd), null), this.$onCanvasAction &&= (O(e, h, this.$onCanvasAction), null)), super.disconnectedCallback();
|
|
175
|
+
}
|
|
176
|
+
$exceedsInset(e, t, n, r) {
|
|
177
|
+
let { parentElement: i, maxInset: a, minInset: o } = this;
|
|
178
|
+
if (!i || n === 0 && r === 0 || a === "auto" && o === "auto") return !1;
|
|
179
|
+
let s = i.getBoundingClientRect();
|
|
180
|
+
return b([
|
|
181
|
+
t,
|
|
182
|
+
s.width - (e + n),
|
|
183
|
+
s.height - (t + r),
|
|
184
|
+
e
|
|
185
|
+
], a, o, i, s);
|
|
102
186
|
}
|
|
103
187
|
$getSelections() {
|
|
104
188
|
let e = [];
|
|
105
189
|
return this.parentElement && (e = Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(m)))), e;
|
|
106
190
|
}
|
|
107
|
-
$initSelection(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
191
|
+
$initSelection() {
|
|
192
|
+
return j(this, arguments, void 0, function* (e = !1, t = !1) {
|
|
193
|
+
let { initialCoverage: n, parentElement: r } = this;
|
|
194
|
+
if (D(n) && r) {
|
|
195
|
+
let { $canvas: i } = this, a = this.$image || null;
|
|
196
|
+
if (a) {
|
|
197
|
+
try {
|
|
198
|
+
yield a.$ready();
|
|
199
|
+
} catch {
|
|
200
|
+
a = null;
|
|
201
|
+
}
|
|
202
|
+
if (this.parentElement !== r || this.initialCoverage !== n) return;
|
|
203
|
+
}
|
|
204
|
+
let o = (a || i || r).getBoundingClientRect(), s = (i || r).getBoundingClientRect(), c = a ? o.left - s.left : 0, l = a ? o.top - s.top : 0, u = this.aspectRatio || this.initialAspectRatio, d = (t ? 0 : this.width) || o.width * n, f = (t ? 0 : this.height) || o.height * n;
|
|
205
|
+
D(u) && ({width: d, height: f} = x({
|
|
206
|
+
aspectRatio: u,
|
|
207
|
+
width: d,
|
|
208
|
+
height: f
|
|
209
|
+
})), e ? this.$change(c + (o.width - d) / 2, l + (o.height - f) / 2, d, f) : this.$change(this.x, this.y, d, f), this.$initialSelection = {
|
|
210
|
+
x: this.x,
|
|
211
|
+
y: this.y,
|
|
212
|
+
width: this.width,
|
|
213
|
+
height: this.height
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
});
|
|
122
217
|
}
|
|
123
218
|
$createSelection() {
|
|
124
219
|
let e = this.cloneNode(!0);
|
|
@@ -140,8 +235,20 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
140
235
|
}
|
|
141
236
|
$handleActionStart(e) {
|
|
142
237
|
if (e.defaultPrevented) return;
|
|
143
|
-
let t = e.detail?.
|
|
144
|
-
this.$action = "", this.$actionStartTarget =
|
|
238
|
+
let { action: t, relatedEvent: n } = e.detail || {}, r = n?.target;
|
|
239
|
+
if (this.$action = "", this.$actionStartTarget = r, this.$resizeStart = typeof t == "string" && t.endsWith("-resize") && n ? {
|
|
240
|
+
action: t,
|
|
241
|
+
pageX: n.pageX,
|
|
242
|
+
pageY: n.pageY,
|
|
243
|
+
x: this.x,
|
|
244
|
+
y: this.y,
|
|
245
|
+
width: this.width,
|
|
246
|
+
height: this.height
|
|
247
|
+
} : null, t === "select" && !this.resizable && (!this.multiple || this.active) && D(this.width) && D(this.height) && n && e.currentTarget) {
|
|
248
|
+
let t = C(e.currentTarget);
|
|
249
|
+
(this.multiple && !this.hidden ? this.$createSelection() : this).$change(n.pageX - t.left, n.pageY - t.top, this.width, this.height);
|
|
250
|
+
}
|
|
251
|
+
!this.hidden && this.multiple && !this.active && r === this && this.parentElement && (this.$getSelections().forEach((e) => {
|
|
145
252
|
e.active = !1;
|
|
146
253
|
}), this.active = !0, this.$emit(v, {
|
|
147
254
|
x: this.x,
|
|
@@ -153,14 +260,23 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
153
260
|
$handleAction(t) {
|
|
154
261
|
let { currentTarget: n, detail: a } = t;
|
|
155
262
|
if (t.defaultPrevented || !n || !a) return;
|
|
156
|
-
let { relatedEvent: c } = a, { action: f } = a, p = c ?
|
|
263
|
+
let { relatedEvent: c } = a, { action: f } = a, p = c ? S(c) : null;
|
|
157
264
|
if (!f && this.multiple && (f = this.$action || p?.action, this.$action = f), !f || this.hidden && f !== "select" || this.multiple && !this.active && f !== "scale") return;
|
|
158
|
-
let { width: m, height: h } = this, g = a.endX - a.startX, _ = a.endY - a.startY, { aspectRatio: v } = this;
|
|
159
|
-
|
|
265
|
+
let { width: m, height: h } = this, g = a.endX - a.startX, _ = a.endY - a.startY, { aspectRatio: v } = this, y = null;
|
|
266
|
+
if (this.$resizeStart && f.endsWith("-resize")) {
|
|
267
|
+
let e = this.$resizeStart;
|
|
268
|
+
f = e.action, g = a.endX - e.pageX, _ = a.endY - e.pageY, y = e;
|
|
269
|
+
}
|
|
270
|
+
if (!D(v) && c.shiftKey) {
|
|
271
|
+
let e = y?.width ?? m, t = y?.height ?? h;
|
|
272
|
+
v = D(e) && D(t) ? e / t : 1;
|
|
273
|
+
}
|
|
274
|
+
switch (f) {
|
|
160
275
|
case u:
|
|
276
|
+
if (!this.resizable && D(this.width) && D(this.height)) break;
|
|
161
277
|
if (g !== 0 || _ !== 0) {
|
|
162
278
|
g === 0 ? g = _ : _ === 0 && (_ = g);
|
|
163
|
-
let { $canvas: e } = this, t =
|
|
279
|
+
let { $canvas: e } = this, t = C(n);
|
|
164
280
|
(this.multiple && !this.hidden ? this.$createSelection() : this).$change(a.startX - t.left, a.startY - t.top, Math.abs(g), Math.abs(_), v), g < 0 ? _ < 0 ? f = i : _ > 0 && (f = s) : g > 0 && (_ < 0 ? f = r : _ > 0 && (f = o)), e && (e.$action = f);
|
|
165
281
|
}
|
|
166
282
|
break;
|
|
@@ -170,15 +286,18 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
170
286
|
case l:
|
|
171
287
|
case d:
|
|
172
288
|
if (c && this.zoomable && (this.dynamic || this.contains(c.target))) {
|
|
173
|
-
|
|
174
|
-
|
|
289
|
+
if (this.zoomAroundCenter) this.$zoom(a.scale);
|
|
290
|
+
else {
|
|
291
|
+
let e = C(n);
|
|
292
|
+
this.$zoom(a.scale, c.pageX - e.left, c.pageY - e.top);
|
|
293
|
+
}
|
|
175
294
|
}
|
|
176
295
|
break;
|
|
177
296
|
default: this.$resize(f, g, _, v);
|
|
178
297
|
}
|
|
179
298
|
}
|
|
180
299
|
$handleActionEnd() {
|
|
181
|
-
this.$action = "", this.$actionStartTarget = null;
|
|
300
|
+
this.$action = "", this.$actionStartTarget = null, this.$resizeStart = null;
|
|
182
301
|
}
|
|
183
302
|
$handleKeyDown(e) {
|
|
184
303
|
if (e.defaultPrevented || this.hidden || !this.keyboard || this.multiple && !this.active) return;
|
|
@@ -218,11 +337,11 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
218
337
|
return this.$moveTo(this.x + e, this.y + t);
|
|
219
338
|
}
|
|
220
339
|
$moveTo(e, t = e) {
|
|
221
|
-
return this.movable
|
|
340
|
+
return this.movable && (this.$change(e, t), this.$insetRejected && e !== this.x && t !== this.y && (this.$change(e, this.y), this.$change(this.x, t))), this;
|
|
222
341
|
}
|
|
223
342
|
$resize(e, l = 0, u = 0, d = this.aspectRatio) {
|
|
224
343
|
if (!this.resizable) return this;
|
|
225
|
-
let f =
|
|
344
|
+
let f = D(d), { $canvas: p } = this, { x: m, y: h, width: g, height: _ } = this.$resizeStart || this;
|
|
226
345
|
switch (e) {
|
|
227
346
|
case n:
|
|
228
347
|
h += u, _ -= u, _ < 0 && (e = a, _ = -_, h -= _), f && (l = u * d, m += l / 2, g -= l, g < 0 && (g = -g, m -= g));
|
|
@@ -247,25 +366,45 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
247
366
|
break;
|
|
248
367
|
case s: f && (u = -l / d), m += l, g -= l, _ += u, g < 0 && _ < 0 ? (e = r, g = -g, _ = -_, m -= g, h -= _) : g < 0 ? (e = o, g = -g, m -= g) : _ < 0 && (e = i, _ = -_, h -= _);
|
|
249
368
|
}
|
|
250
|
-
|
|
369
|
+
p && p.$setAction(e);
|
|
370
|
+
let v = this.$changingAroundCenter;
|
|
371
|
+
this.$changingAroundCenter = this.resizeAroundCenter || v;
|
|
372
|
+
try {
|
|
373
|
+
return this.$change(m, h, g, _);
|
|
374
|
+
} finally {
|
|
375
|
+
this.$changingAroundCenter = v;
|
|
376
|
+
}
|
|
251
377
|
}
|
|
252
378
|
$zoom(e, t, n) {
|
|
253
379
|
if (!this.zoomable || e === 0) return this;
|
|
254
380
|
e < 0 ? e = 1 / (1 - e) : e += 1;
|
|
255
381
|
let { width: r, height: i } = this, a = r * e, o = i * e, s = this.x, c = this.y;
|
|
256
|
-
|
|
382
|
+
T(t) && T(n) ? (s -= (a - r) * ((t - this.x) / r), c -= (o - i) * ((n - this.y) / i)) : (s -= (a - r) / 2, c -= (o - i) / 2);
|
|
383
|
+
let l = this.$changingAroundCenter;
|
|
384
|
+
this.$changingAroundCenter = this.zoomAroundCenter && !(T(t) && T(n)) || l;
|
|
385
|
+
try {
|
|
386
|
+
return this.$change(s, c, a, o);
|
|
387
|
+
} finally {
|
|
388
|
+
this.$changingAroundCenter = l;
|
|
389
|
+
}
|
|
257
390
|
}
|
|
258
391
|
$change(e, t, n = this.width, r = this.height, i = this.aspectRatio, a = !1) {
|
|
259
|
-
|
|
392
|
+
if (this.$insetRejected = !1, this.$changing || !T(e) || !T(t) || !T(n) || !T(r) || n < 0 || r < 0) return this;
|
|
393
|
+
if (D(i) && ({width: n, height: r} = x({
|
|
260
394
|
aspectRatio: i,
|
|
261
395
|
width: n,
|
|
262
396
|
height: r
|
|
263
|
-
}, "cover")), this
|
|
397
|
+
}, "cover")), this.$changingAroundCenter) {
|
|
398
|
+
this.precise || (n = Math.round(n), r = Math.round(r), (n - this.width) % 2 != 0 && (n += n < this.width ? -1 : 1), (r - this.height) % 2 != 0 && (r += r < this.height ? -1 : 1));
|
|
399
|
+
let i = this.$resizeStart || this;
|
|
400
|
+
e = i.x + (i.width - n) / 2, t = i.y + (i.height - r) / 2;
|
|
401
|
+
} else this.precise || (n = Math.round(n), r = Math.round(r), e = Math.round(e), t = Math.round(t));
|
|
402
|
+
return e === this.x && t === this.y && n === this.width && r === this.height && Object.is(i, this.aspectRatio) && !a ? this : this.$exceedsInset(e, t, n, r) ? (this.$insetRejected = !0, this) : (this.hidden &&= !1, this.$emit("change", {
|
|
264
403
|
x: e,
|
|
265
404
|
y: t,
|
|
266
405
|
width: n,
|
|
267
406
|
height: r
|
|
268
|
-
}) === !1
|
|
407
|
+
}) === !1 ? this : (this.$changing = !0, this.x = e, this.y = t, this.width = n, this.height = r, this.$changing = !1, this.$render()));
|
|
269
408
|
}
|
|
270
409
|
$reset() {
|
|
271
410
|
let { x: e, y: t, width: n, height: r } = this.$initialSelection;
|
|
@@ -278,7 +417,8 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
278
417
|
return this.$setStyles({
|
|
279
418
|
transform: `translate(${this.x}px, ${this.y}px)`,
|
|
280
419
|
width: this.width,
|
|
281
|
-
height: this.height
|
|
420
|
+
height: this.height,
|
|
421
|
+
borderRadius: this.borderRadius
|
|
282
422
|
});
|
|
283
423
|
}
|
|
284
424
|
$toCanvas(e) {
|
|
@@ -288,7 +428,7 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
288
428
|
return;
|
|
289
429
|
}
|
|
290
430
|
let r = document.createElement("canvas"), { width: i, height: a } = this, o = 1;
|
|
291
|
-
if (
|
|
431
|
+
if (E(e) && (D(e.width) || D(e.height)) && ({width: i, height: a} = x({
|
|
292
432
|
aspectRatio: i / a,
|
|
293
433
|
width: e.width,
|
|
294
434
|
height: e.height
|
|
@@ -296,22 +436,28 @@ var A = ":host{display:block;left:0;position:relative;right:0}:host([outlined]){
|
|
|
296
436
|
t(r);
|
|
297
437
|
return;
|
|
298
438
|
}
|
|
299
|
-
let s = this
|
|
439
|
+
let { $image: s } = this;
|
|
300
440
|
s ? s.$ready().then((n) => {
|
|
301
441
|
let c = r.getContext("2d");
|
|
302
442
|
if (c) {
|
|
303
443
|
let [t, l, u, d, f, p] = s.$getTransform(), m = -this.x, h = -this.y, g = (m * d - u * h) / (t * d - u * l), _ = (h * t - l * m) / (t * d - u * l), v = t * g + u * _ + f, y = l * g + d * _ + p, b = n.naturalWidth, x = n.naturalHeight;
|
|
304
444
|
o !== 1 && (v *= o, y *= o, b *= o, x *= o);
|
|
305
|
-
let S = b / 2,
|
|
306
|
-
c.fillStyle = "transparent", c.fillRect(0, 0, i, a),
|
|
445
|
+
let S = b / 2, C = x / 2;
|
|
446
|
+
c.fillStyle = "transparent", c.fillRect(0, 0, i, a), E(e) && w(e.beforeDraw) && e.beforeDraw.call(this, c, r), c.save();
|
|
447
|
+
let T = L(this.borderRadius, i, a, o);
|
|
448
|
+
if (T.some(([e, t]) => e > 0 && t > 0)) {
|
|
449
|
+
let [[e, t], [n, r], [o, s], [l, u]] = T, d = Math.PI / 2;
|
|
450
|
+
c.beginPath(), c.moveTo(e, 0), c.lineTo(i - n, 0), c.ellipse(i - n, r, n, r, 0, -d, 0), c.lineTo(i, a - s), c.ellipse(i - o, a - s, o, s, 0, 0, d), c.lineTo(l, a), c.ellipse(l, a - u, l, u, 0, d, Math.PI), c.lineTo(0, t), c.ellipse(e, t, e, t, 0, Math.PI, Math.PI + d), c.closePath(), c.clip();
|
|
451
|
+
}
|
|
452
|
+
c.translate(S, C), c.transform(t, l, u, d, v, y), c.translate(-S, -C), c.drawImage(n, 0, 0, b, x), c.restore();
|
|
307
453
|
}
|
|
308
454
|
t(r);
|
|
309
455
|
}).catch(n) : t(r);
|
|
310
456
|
});
|
|
311
457
|
}
|
|
312
458
|
};
|
|
313
|
-
|
|
459
|
+
R.$name = m, R.$version = "2.3.1";
|
|
314
460
|
//#endregion
|
|
315
|
-
export {
|
|
461
|
+
export { R as default };
|
|
316
462
|
|
|
317
463
|
//# sourceMappingURL=element-selection.esm.raw.js.map
|