@univerjs/drawing-ui 0.1.17 → 0.2.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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +411 -397
- package/lib/types/index.d.ts +3 -2
- package/lib/umd/index.js +1 -1
- package/package.json +18 -17
package/lib/es/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
var Mt = Object.defineProperty;
|
|
2
2
|
var Ot = (a, n, e) => n in a ? Mt(a, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[n] = e;
|
|
3
3
|
var Q = (a, n, e) => Ot(a, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
-
import { getDrawingShapeKeyByDrawingSearch as
|
|
5
|
-
import { Group as pe, DRAWING_OBJECT_LAYER_INDEX as
|
|
6
|
-
import { UniverInstanceType as
|
|
7
|
-
import { useDependency as
|
|
8
|
-
import c, { forwardRef as
|
|
9
|
-
import { Button as ie, InputNumber as de, Checkbox as At, Select as
|
|
4
|
+
import { getDrawingShapeKeyByDrawingSearch as G, DrawingTypeEnum as te, ImageSourceType as Nt, IDrawingManagerService as ne, IImageIoService as rt, ArrangeTypeEnum as Se } from "@univerjs/drawing";
|
|
5
|
+
import { Group as pe, DRAWING_OBJECT_LAYER_INDEX as ze, Image as We, IRenderManagerService as ge, getGroupState as Dt, transformObjectOutOfGroup as Tt, RENDER_CLASS_TYPE as Xe, Shape as Bt, Rect as jt, Canvas as Ut, precisionTo as be, CURSOR_TYPE as Te, Vector2 as xe, degToRad as Je } from "@univerjs/engine-render";
|
|
6
|
+
import { UniverInstanceType as Re, LocaleService as Z, debounce as Ie, CommandType as we, ICommandService as ce, Tools as Ht, Disposable as Ue, checkIfMove as at, toDisposable as Ce, OnLifecycle as He, LifecycleStages as Le, IUniverInstanceService as Fe, Plugin as Lt } from "@univerjs/core";
|
|
7
|
+
import { useDependency as x } from "@wendellhu/redi/react-bindings";
|
|
8
|
+
import c, { forwardRef as Y, useRef as it, createElement as X, useState as L, useEffect as ve } from "react";
|
|
9
|
+
import { Button as ie, InputNumber as de, Checkbox as At, Select as ot, Dropdown as Vt, MessageType as qe } from "@univerjs/design";
|
|
10
10
|
import T from "clsx";
|
|
11
|
-
import { Inject as
|
|
11
|
+
import { Inject as se, Injector as st } from "@wendellhu/redi";
|
|
12
12
|
import { ComponentManager as xt, IMenuService as Gt, IMessageService as Wt, IDialogService as $t } from "@univerjs/ui";
|
|
13
|
-
|
|
13
|
+
import { filter as kt, switchMap as zt } from "rxjs";
|
|
14
|
+
function Ft(a, n, e, t) {
|
|
14
15
|
const r = t.getDrawingByParam(a);
|
|
15
16
|
if (r == null)
|
|
16
17
|
return;
|
|
17
|
-
const o =
|
|
18
|
+
const o = G(a), i = e.getObject(o);
|
|
18
19
|
if (i && !(i instanceof pe))
|
|
19
20
|
return;
|
|
20
21
|
if (i != null) {
|
|
@@ -22,7 +23,7 @@ function kt(a, n, e, t) {
|
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
const s = new pe(o);
|
|
25
|
-
e.addObject(s,
|
|
26
|
+
e.addObject(s, ze).attachTransformerTo(s), s.addObject(n);
|
|
26
27
|
const { transform: l } = r;
|
|
27
28
|
l && s.transformByState(
|
|
28
29
|
{
|
|
@@ -32,21 +33,21 @@ function kt(a, n, e, t) {
|
|
|
32
33
|
}
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function $e(a) {
|
|
36
37
|
var r;
|
|
37
38
|
const n = a.getFocusedUnit();
|
|
38
39
|
if (n == null)
|
|
39
40
|
return;
|
|
40
41
|
const e = n.getUnitId();
|
|
41
42
|
let t;
|
|
42
|
-
return n.type ===
|
|
43
|
+
return n.type === Re.UNIVER_SHEET ? t = (r = n.getActiveSheet()) == null ? void 0 : r.getSheetId() : (n.type === Re.UNIVER_DOC || n.type === Re.UNIVER_SLIDE) && (t = e), { unitId: e, subUnitId: t };
|
|
43
44
|
}
|
|
44
|
-
var
|
|
45
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
45
|
+
var Kt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Yt = (a, n, e, t) => {
|
|
46
|
+
for (var r = t > 1 ? void 0 : t ? Zt(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
46
47
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
47
|
-
return t && r &&
|
|
48
|
-
},
|
|
49
|
-
let
|
|
48
|
+
return t && r && Kt(n, e, r), r;
|
|
49
|
+
}, Qe = (a, n) => (e, t) => n(e, t, a);
|
|
50
|
+
let Be = class {
|
|
50
51
|
constructor(a, n) {
|
|
51
52
|
this._drawingManagerService = a, this._imageIoService = n;
|
|
52
53
|
}
|
|
@@ -54,33 +55,33 @@ let Te = class {
|
|
|
54
55
|
const { transform: e, drawingType: t, source: r, imageSourceType: o, srcRect: i, prstGeom: s, groupId: l, unitId: g, subUnitId: u, drawingId: d } = a;
|
|
55
56
|
if (t !== te.DRAWING_IMAGE || !this._drawingManagerService.getDrawingVisible() || e == null)
|
|
56
57
|
return;
|
|
57
|
-
const { left: h, top: f, width: v, height: w, angle: p, flipX: E, flipY: _, skewX: M, skewY: S } = e, R =
|
|
58
|
+
const { left: h, top: f, width: v, height: w, angle: p, flipX: E, flipY: _, skewX: M, skewY: S } = e, R = G({ unitId: g, subUnitId: u, drawingId: d }), b = n.getObject(R);
|
|
58
59
|
if (b != null) {
|
|
59
60
|
b.transformByState({ left: h, top: f, width: v, height: w, angle: p, flipX: E, flipY: _, skewX: M, skewY: S });
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
const y = this._drawingManagerService.getDrawingOrder(g, u), I = y.indexOf(d), P = { ...e, zIndex: I === -1 ? y.length - 1 : I }, N = this._imageIoService.getImageSourceCache(r, o);
|
|
63
|
-
let
|
|
64
|
+
let B = !1;
|
|
64
65
|
if (N != null)
|
|
65
66
|
P.image = N;
|
|
66
67
|
else {
|
|
67
68
|
if (o === Nt.UUID)
|
|
68
69
|
try {
|
|
69
70
|
P.url = await this._imageIoService.getImage(r);
|
|
70
|
-
} catch (
|
|
71
|
-
console.error(
|
|
71
|
+
} catch (W) {
|
|
72
|
+
console.error(W);
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
75
|
else
|
|
75
76
|
P.url = r;
|
|
76
|
-
|
|
77
|
+
B = !0;
|
|
77
78
|
}
|
|
78
79
|
P.printable = !0;
|
|
79
80
|
const D = new We(R, P);
|
|
80
|
-
if (
|
|
81
|
+
if (B && this._imageIoService.addImageSourceCache(r, o, D.getNative()), !this._drawingManagerService.getDrawingVisible())
|
|
81
82
|
return;
|
|
82
|
-
const
|
|
83
|
-
return this._drawingManagerService.getDrawingEditable() &&
|
|
83
|
+
const le = n.addObject(D, ze);
|
|
84
|
+
return this._drawingManagerService.getDrawingEditable() && le.attachTransformerTo(D), l && Ft({ drawingId: l, unitId: g, subUnitId: u }, D, n, this._drawingManagerService), s != null && D.setPrstGeom(s), i != null && D.setSrcRect(i), D;
|
|
84
85
|
}
|
|
85
86
|
renderDrawing(a, n) {
|
|
86
87
|
const e = this._drawingManagerService.getDrawingByParam(a);
|
|
@@ -91,11 +92,11 @@ let Te = class {
|
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
],
|
|
98
|
-
function
|
|
95
|
+
Be = Yt([
|
|
96
|
+
Qe(0, ne),
|
|
97
|
+
Qe(1, rt)
|
|
98
|
+
], Be);
|
|
99
|
+
function Ae(a, n) {
|
|
99
100
|
const e = [];
|
|
100
101
|
return a.forEach((t) => {
|
|
101
102
|
const { oKey: r, left: o, top: i, height: s, width: l, angle: g } = t, u = n.getDrawingOKey(r);
|
|
@@ -117,51 +118,32 @@ function Le(a, n) {
|
|
|
117
118
|
v === te.DRAWING_IMAGE && (w.srcRect = t.srcRect), e.push(w);
|
|
118
119
|
}), e;
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
type: we.OPERATION,
|
|
123
|
-
handler: (a, n) => !0
|
|
124
|
-
}, $e = {
|
|
125
|
-
id: "sheet.operation.open-image-crop",
|
|
126
|
-
type: we.OPERATION,
|
|
127
|
-
handler: (a, n) => !0
|
|
128
|
-
}, me = {
|
|
129
|
-
id: "sheet.operation.close-image-crop",
|
|
130
|
-
type: we.OPERATION,
|
|
131
|
-
handler: (a, n) => !0
|
|
132
|
-
};
|
|
133
|
-
var U = /* @__PURE__ */ ((a) => (a.FREE = "0", a.R1_1 = "1", a.R16_9 = "2", a.R9_16 = "3", a.R5_4 = "4", a.R4_5 = "5", a.R4_3 = "6", a.R3_4 = "7", a.R3_2 = "8", a.R2_3 = "9", a))(U || {});
|
|
134
|
-
const Be = {
|
|
135
|
-
id: "sheet.operation.Auto-image-crop",
|
|
136
|
-
type: we.OPERATION,
|
|
137
|
-
handler: (a, n) => !0
|
|
138
|
-
};
|
|
139
|
-
var k = function() {
|
|
140
|
-
return k = Object.assign || function(a) {
|
|
121
|
+
var $ = function() {
|
|
122
|
+
return $ = Object.assign || function(a) {
|
|
141
123
|
for (var n, e = 1, t = arguments.length; e < t; e++) {
|
|
142
124
|
n = arguments[e];
|
|
143
125
|
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (a[r] = n[r]);
|
|
144
126
|
}
|
|
145
127
|
return a;
|
|
146
|
-
},
|
|
147
|
-
},
|
|
128
|
+
}, $.apply(this, arguments);
|
|
129
|
+
}, Xt = function(a, n) {
|
|
148
130
|
var e = {};
|
|
149
131
|
for (var t in a) Object.prototype.hasOwnProperty.call(a, t) && n.indexOf(t) < 0 && (e[t] = a[t]);
|
|
150
132
|
if (a != null && typeof Object.getOwnPropertySymbols == "function")
|
|
151
133
|
for (var r = 0, t = Object.getOwnPropertySymbols(a); r < t.length; r++)
|
|
152
134
|
n.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(a, t[r]) && (e[t[r]] = a[t[r]]);
|
|
153
135
|
return e;
|
|
154
|
-
},
|
|
155
|
-
var e = a.icon, t = a.id, r = a.className, o = a.extend, i =
|
|
156
|
-
return
|
|
136
|
+
}, J = Y(function(a, n) {
|
|
137
|
+
var e = a.icon, t = a.id, r = a.className, o = a.extend, i = Xt(a, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), l = it("_".concat(Qt()));
|
|
138
|
+
return ct(e, "".concat(t), { defIds: e.defIds, idSuffix: l.current }, $({ ref: n, className: s }, i), o);
|
|
157
139
|
});
|
|
158
|
-
function
|
|
159
|
-
return
|
|
160
|
-
return
|
|
140
|
+
function ct(a, n, e, t, r) {
|
|
141
|
+
return X(a.tag, $($({ key: n }, Jt(a, e, r)), t), (qt(a, e).children || []).map(function(o, i) {
|
|
142
|
+
return ct(o, "".concat(n, "-").concat(a.tag, "-").concat(i), e, void 0, r);
|
|
161
143
|
}));
|
|
162
144
|
}
|
|
163
|
-
function
|
|
164
|
-
var t =
|
|
145
|
+
function Jt(a, n, e) {
|
|
146
|
+
var t = $({}, a.attrs);
|
|
165
147
|
e != null && e.colorChannel1 && t.fill === "colorChannel1" && (t.fill = e.colorChannel1);
|
|
166
148
|
var r = n.defIds;
|
|
167
149
|
return !r || r.length === 0 || (a.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + n.idSuffix), Object.entries(t).forEach(function(o) {
|
|
@@ -169,103 +151,103 @@ function Yt(a, n, e) {
|
|
|
169
151
|
typeof s == "string" && (t[i] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
170
152
|
})), t;
|
|
171
153
|
}
|
|
172
|
-
function
|
|
154
|
+
function qt(a, n) {
|
|
173
155
|
var e, t = n.defIds;
|
|
174
|
-
return !t || t.length === 0 ? a : a.tag === "defs" && (!((e = a.children) === null || e === void 0) && e.length) ?
|
|
175
|
-
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ?
|
|
156
|
+
return !t || t.length === 0 ? a : a.tag === "defs" && (!((e = a.children) === null || e === void 0) && e.length) ? $($({}, a), { children: a.children.map(function(r) {
|
|
157
|
+
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? $($({}, r), { attrs: $($({}, r.attrs), { id: r.attrs.id + n.idSuffix }) }) : r;
|
|
176
158
|
}) }) : a;
|
|
177
159
|
}
|
|
178
|
-
function
|
|
160
|
+
function Qt() {
|
|
179
161
|
return Math.random().toString(36).substring(2, 8);
|
|
180
162
|
}
|
|
181
|
-
|
|
182
|
-
var
|
|
183
|
-
return J
|
|
163
|
+
J.displayName = "UniverIcon";
|
|
164
|
+
var en = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365zM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377zM2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365zM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647zM9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635zM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635z", fillRule: "evenodd", clipRule: "evenodd" } }] }, lt = Y(function(a, n) {
|
|
165
|
+
return X(J, Object.assign({}, a, {
|
|
184
166
|
id: "autofill",
|
|
185
167
|
ref: n,
|
|
186
|
-
icon:
|
|
168
|
+
icon: en
|
|
187
169
|
}));
|
|
188
170
|
});
|
|
189
|
-
|
|
190
|
-
var
|
|
191
|
-
return J
|
|
171
|
+
lt.displayName = "Autofill";
|
|
172
|
+
var tn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334 15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334 2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045zM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334 3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334zM14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999 15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999 2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544zM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999 3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421 6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641 9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421 11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946 8.64077 14.6502 8.70566 14.6923 8.77482 14.7209 8.84557 14.7502 8.92314 14.7664 9.00449 14.7664 9.08585 14.7664 9.16342 14.7502 9.23416 14.7209 9.30332 14.6923 9.36821 14.6502 9.42482 14.5946" } }] }, mt = Y(function(a, n) {
|
|
173
|
+
return X(J, Object.assign({}, a, {
|
|
192
174
|
id: "bottom-single",
|
|
193
175
|
ref: n,
|
|
194
|
-
icon:
|
|
176
|
+
icon: tn
|
|
195
177
|
}));
|
|
196
178
|
});
|
|
197
|
-
|
|
198
|
-
var
|
|
199
|
-
return J
|
|
179
|
+
mt.displayName = "BottomSingle";
|
|
180
|
+
var nn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.97705 7.51296C5.97705 7.18159 6.24568 6.91296 6.57705 6.91296H8.48632C8.81769 6.91296 9.08632 7.18159 9.08632 7.51296 9.08632 7.84433 8.81769 8.11296 8.48632 8.11296H6.57705C6.24568 8.11296 5.97705 7.84433 5.97705 7.51296zM6.57705 9.41028C6.24568 9.41028 5.97705 9.67891 5.97705 10.0103 5.97705 10.3416 6.24568 10.6103 6.57705 10.6103H10.8199C11.1512 10.6103 11.4199 10.3416 11.4199 10.0103 11.4199 9.67891 11.1512 9.41028 10.8199 9.41028H6.57705z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.51074 2.37063C3.51074 1.48697 4.22709 0.77063 5.11074 0.77063H9.80318L9.81294 0.770708C9.97168 0.768161 10.1311 0.82824 10.2511 0.95055L14.4317 5.21408C14.5165 5.30049 14.5697 5.406 14.5917 5.51645C14.6041 5.5644 14.6106 5.61467 14.6106 5.66648V11.6406C14.6106 12.5243 13.8943 13.2406 13.0106 13.2406H5.11074C4.22709 13.2406 3.51074 12.5243 3.51074 11.6406V2.37063ZM10.4032 4.66648V2.81964L12.6063 5.06648H10.8032C10.5823 5.06648 10.4032 4.88739 10.4032 4.66648ZM5.11074 1.97063C4.88983 1.97063 4.71074 2.14972 4.71074 2.37063V11.6406C4.71074 11.8615 4.88983 12.0406 5.11074 12.0406H13.0106C13.2316 12.0406 13.4106 11.8615 13.4106 11.6406V6.26648H10.8032C9.91953 6.26648 9.20318 5.55013 9.20318 4.66648V1.97063H5.11074Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.58916 6.6741C2.58916 6.34273 2.32053 6.0741 1.98916 6.0741C1.65779 6.0741 1.38916 6.34273 1.38916 6.6741V12.6294C1.38916 14.0653 2.55322 15.2294 3.98916 15.2294H9.41408C9.74545 15.2294 10.0141 14.9607 10.0141 14.6294C10.0141 14.298 9.74545 14.0294 9.41408 14.0294H3.98916C3.21596 14.0294 2.58916 13.4026 2.58916 12.6294V6.6741Z" } }] }, gt = Y(function(a, n) {
|
|
181
|
+
return X(J, Object.assign({}, a, {
|
|
200
182
|
id: "create-copy-single",
|
|
201
183
|
ref: n,
|
|
202
|
-
icon:
|
|
184
|
+
icon: nn
|
|
203
185
|
}));
|
|
204
186
|
});
|
|
205
|
-
|
|
206
|
-
var
|
|
207
|
-
return J
|
|
187
|
+
gt.displayName = "CreateCopySingle";
|
|
188
|
+
var rn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.38125 1.16211C6.49759 1.16211 5.78125 1.87845 5.78125 2.76211V5.6377H2.87783C1.99418 5.6377 1.27783 6.35404 1.27783 7.2377V13.2377C1.27783 14.1214 1.99418 14.8377 2.87783 14.8377H8.87783C9.76149 14.8377 10.4778 14.1214 10.4778 13.2377V10.3621H13.3813C14.2649 10.3621 14.9813 9.64577 14.9813 8.76211V2.76211C14.9813 1.87845 14.2649 1.16211 13.3813 1.16211H7.38125ZM10.4778 9.16211H13.3813C13.6022 9.16211 13.7812 8.98302 13.7812 8.76211V2.76211C13.7812 2.5412 13.6022 2.36211 13.3813 2.36211H7.38125C7.16034 2.36211 6.98125 2.5412 6.98125 2.76211V5.6377H8.87783C9.76149 5.6377 10.4778 6.35404 10.4778 7.2377V9.16211ZM6.98125 6.8377H8.87783C9.09875 6.8377 9.27783 7.01678 9.27783 7.2377V9.16211H7.38125C7.16034 9.16211 6.98125 8.98302 6.98125 8.76211V6.8377ZM5.78125 6.8377V8.76211C5.78125 9.64577 6.49759 10.3621 7.38125 10.3621H9.27783V13.2377C9.27783 13.4586 9.09875 13.6377 8.87783 13.6377H2.87783C2.65692 13.6377 2.47783 13.4586 2.47783 13.2377V7.2377C2.47783 7.01678 2.65692 6.8377 2.87783 6.8377H5.78125Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ut = Y(function(a, n) {
|
|
189
|
+
return X(J, Object.assign({}, a, {
|
|
208
190
|
id: "group-single",
|
|
209
191
|
ref: n,
|
|
210
|
-
icon:
|
|
192
|
+
icon: rn
|
|
211
193
|
}));
|
|
212
194
|
});
|
|
213
|
-
|
|
214
|
-
var
|
|
215
|
-
return J
|
|
195
|
+
ut.displayName = "GroupSingle";
|
|
196
|
+
var an = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, dt = Y(function(a, n) {
|
|
197
|
+
return X(J, Object.assign({}, a, {
|
|
216
198
|
id: "more-down-single",
|
|
217
199
|
ref: n,
|
|
218
|
-
icon:
|
|
200
|
+
icon: an
|
|
219
201
|
}));
|
|
220
202
|
});
|
|
221
|
-
|
|
222
|
-
var
|
|
223
|
-
return J
|
|
203
|
+
dt.displayName = "MoreDownSingle";
|
|
204
|
+
var on = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z" } }] }, ht = Y(function(a, n) {
|
|
205
|
+
return X(J, Object.assign({}, a, {
|
|
224
206
|
id: "move-down-single",
|
|
225
207
|
ref: n,
|
|
226
|
-
icon:
|
|
208
|
+
icon: on
|
|
227
209
|
}));
|
|
228
210
|
});
|
|
229
|
-
|
|
230
|
-
var
|
|
231
|
-
return J
|
|
211
|
+
ht.displayName = "MoveDownSingle";
|
|
212
|
+
var sn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z" } }] }, ft = Y(function(a, n) {
|
|
213
|
+
return X(J, Object.assign({}, a, {
|
|
232
214
|
id: "move-up-single",
|
|
233
215
|
ref: n,
|
|
234
|
-
icon:
|
|
216
|
+
icon: sn
|
|
235
217
|
}));
|
|
236
218
|
});
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
return J
|
|
219
|
+
ft.displayName = "MoveUpSingle";
|
|
220
|
+
var cn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9 15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9zM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9 2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9 13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439zM1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665 15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665zM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665 2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665 13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543z", fillRule: "evenodd", clipRule: "evenodd" } }] }, pt = Y(function(a, n) {
|
|
221
|
+
return X(J, Object.assign({}, a, {
|
|
240
222
|
id: "topmost-single",
|
|
241
223
|
ref: n,
|
|
242
|
-
icon:
|
|
224
|
+
icon: cn
|
|
243
225
|
}));
|
|
244
226
|
});
|
|
245
|
-
|
|
246
|
-
var
|
|
247
|
-
return J
|
|
227
|
+
pt.displayName = "TopmostSingle";
|
|
228
|
+
var ln = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.46855 2.83731C7.46855 2.61639 7.64764 2.4373 7.86855 2.4373H13.8603C14.0812 2.4373 14.2603 2.61639 14.2603 2.8373V9.5049C14.2603 9.72581 14.0812 9.90489 13.8603 9.90489H12.866C12.5346 9.90489 12.266 10.1735 12.266 10.5049C12.266 10.8363 12.5346 11.1049 12.866 11.1049H13.8603C14.7439 11.1049 15.4603 10.3886 15.4603 9.5049V2.8373C15.4603 1.95365 14.7439 1.2373 13.8603 1.2373H7.86855C6.9849 1.2373 6.26855 1.95365 6.26855 2.83731V3.48688C6.26855 3.81825 6.53718 4.08688 6.86855 4.08688C7.19993 4.08688 7.46855 3.81825 7.46855 3.48688V2.83731Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.19888 5.56299C2.31522 5.56299 1.59888 6.27933 1.59888 7.16299V13.163C1.59888 14.0466 2.31522 14.763 3.19888 14.763H9.19888C10.0825 14.763 10.7989 14.0466 10.7989 13.163V7.16299C10.7989 6.27933 10.0825 5.56299 9.19888 5.56299H3.19888ZM2.79888 7.16299C2.79888 6.94207 2.97796 6.76299 3.19888 6.76299H9.19888C9.41979 6.76299 9.59888 6.94207 9.59888 7.16299V13.163C9.59888 13.3839 9.41979 13.563 9.19888 13.563H3.19888C2.97796 13.563 2.79888 13.3839 2.79888 13.163V7.16299Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ct = Y(function(a, n) {
|
|
229
|
+
return X(J, Object.assign({}, a, {
|
|
248
230
|
id: "ungroup-single",
|
|
249
231
|
ref: n,
|
|
250
|
-
icon:
|
|
232
|
+
icon: ln
|
|
251
233
|
}));
|
|
252
234
|
});
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
imageCommonPanel:
|
|
256
|
-
imageCommonPanelGrid:
|
|
257
|
-
imageCommonPanelBorder:
|
|
258
|
-
imageCommonPanelTitle:
|
|
259
|
-
imageCommonPanelRow:
|
|
260
|
-
imageCommonPanelRowVertical:
|
|
261
|
-
imageCommonPanelColumn:
|
|
262
|
-
imageCommonPanelColumnCenter:
|
|
263
|
-
imageCommonPanelInline:
|
|
264
|
-
imageCommonPanelSpan2:
|
|
265
|
-
imageCommonPanelSpan3:
|
|
266
|
-
imageCommonPanelInput:
|
|
267
|
-
},
|
|
268
|
-
const { arrangeShow: n, drawings: e } = a, t =
|
|
235
|
+
Ct.displayName = "UngroupSingle";
|
|
236
|
+
const mn = "univer-image-common-panel", gn = "univer-image-common-panel-grid", un = "univer-image-common-panel-border", dn = "univer-image-common-panel-title", hn = "univer-image-common-panel-row", fn = "univer-image-common-panel-row-vertical", pn = "univer-image-common-panel-column", Cn = "univer-image-common-panel-column-center", wn = "univer-image-common-panel-inline", vn = "univer-image-common-panel-span2", _n = "univer-image-common-panel-span3", Sn = "univer-image-common-panel-input", m = {
|
|
237
|
+
imageCommonPanel: mn,
|
|
238
|
+
imageCommonPanelGrid: gn,
|
|
239
|
+
imageCommonPanelBorder: un,
|
|
240
|
+
imageCommonPanelTitle: dn,
|
|
241
|
+
imageCommonPanelRow: hn,
|
|
242
|
+
imageCommonPanelRowVertical: fn,
|
|
243
|
+
imageCommonPanelColumn: pn,
|
|
244
|
+
imageCommonPanelColumnCenter: Cn,
|
|
245
|
+
imageCommonPanelInline: wn,
|
|
246
|
+
imageCommonPanelSpan2: vn,
|
|
247
|
+
imageCommonPanelSpan3: _n,
|
|
248
|
+
imageCommonPanelInput: Sn
|
|
249
|
+
}, bn = (a) => {
|
|
250
|
+
const { arrangeShow: n, drawings: e } = a, t = x(Z), r = x(ne), o = (g) => g ? "block" : "none", [i, s] = L(e);
|
|
269
251
|
ve(() => {
|
|
270
252
|
const g = r.focus$.subscribe((u) => {
|
|
271
253
|
s(u);
|
|
@@ -280,16 +262,16 @@ const cn = "univer-image-common-panel", ln = "univer-image-common-panel-grid", m
|
|
|
280
262
|
};
|
|
281
263
|
return /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelGrid, style: { display: o(n) } }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelTitle) }, /* @__PURE__ */ c.createElement("div", null, t.t("image-panel.arrange.title")))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2) }, /* @__PURE__ */ c.createElement(ie, { size: "small", onClick: () => {
|
|
282
264
|
l(Se.forward);
|
|
283
|
-
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(
|
|
265
|
+
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(ft, null), t.t("image-panel.arrange.forward")))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2) }, /* @__PURE__ */ c.createElement(ie, { size: "small", onClick: () => {
|
|
284
266
|
l(Se.backward);
|
|
285
|
-
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(
|
|
267
|
+
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(ht, null), t.t("image-panel.arrange.backward"))))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2) }, /* @__PURE__ */ c.createElement(ie, { size: "small", onClick: () => {
|
|
286
268
|
l(Se.front);
|
|
287
|
-
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(
|
|
269
|
+
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(pt, null), t.t("image-panel.arrange.front")))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2) }, /* @__PURE__ */ c.createElement(ie, { size: "small", onClick: () => {
|
|
288
270
|
l(Se.back);
|
|
289
|
-
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(
|
|
290
|
-
}, re = 20,
|
|
291
|
-
var
|
|
292
|
-
const n =
|
|
271
|
+
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(mt, null), t.t("image-panel.arrange.back"))))));
|
|
272
|
+
}, re = 20, In = 20, Pn = [-3600, 3600], Pe = 300, yn = (a) => {
|
|
273
|
+
var Ye;
|
|
274
|
+
const n = x(Z), e = x(ne), t = x(ge), { drawings: r, transformShow: o } = a, i = r[0];
|
|
293
275
|
if (i == null)
|
|
294
276
|
return;
|
|
295
277
|
const s = i.transform;
|
|
@@ -298,7 +280,7 @@ const cn = "univer-image-common-panel", ln = "univer-image-common-panel-grid", m
|
|
|
298
280
|
const { unitId: l, subUnitId: g, drawingId: u, drawingType: d } = i, h = t.getRenderById(l), f = h == null ? void 0 : h.scene;
|
|
299
281
|
if (f == null)
|
|
300
282
|
return;
|
|
301
|
-
const v = (
|
|
283
|
+
const v = (Ye = f.getEngine()) == null ? void 0 : Ye.activeScene;
|
|
302
284
|
if (v == null)
|
|
303
285
|
return;
|
|
304
286
|
const w = f.getTransformerByCreate(), {
|
|
@@ -307,106 +289,110 @@ const cn = "univer-image-common-panel", ln = "univer-image-common-panel-grid", m
|
|
|
307
289
|
left: _ = 0,
|
|
308
290
|
top: M = 0,
|
|
309
291
|
angle: S = 0
|
|
310
|
-
} = s, [R, b] = L(p), [y, I] = L(E), [P, N] = L(_), [
|
|
311
|
-
const { width:
|
|
312
|
-
let
|
|
313
|
-
return C +
|
|
314
|
-
limitLeft:
|
|
315
|
-
limitTop:
|
|
292
|
+
} = s, [R, b] = L(p), [y, I] = L(E), [P, N] = L(_), [B, D] = L(M), [le, W] = L(S), [Ve, _t] = L(w.keepRatio), _e = (C, A, V, H) => {
|
|
293
|
+
const { width: U, height: q } = v, { ancestorLeft: k, ancestorTop: z } = f;
|
|
294
|
+
let F = C, K = A, ee = V, ue = H;
|
|
295
|
+
return C + k < 0 && (F = -k), A + z < 0 && (K = -z), ee = U - F - k, ee < re && (ee = re), ue = q - K - z, ue < re && (ue = re), C + ee + k > U && (F = U - V - k), A + ue + z > q && (K = q - H - z), {
|
|
296
|
+
limitLeft: F,
|
|
297
|
+
limitTop: K,
|
|
316
298
|
limitWidth: ee,
|
|
317
299
|
limitHeight: ue
|
|
318
300
|
};
|
|
319
|
-
},
|
|
320
|
-
const { objects: A } = C,
|
|
321
|
-
if (
|
|
301
|
+
}, Ze = (C) => {
|
|
302
|
+
const { objects: A } = C, V = Ae(A, e);
|
|
303
|
+
if (V.length !== 1)
|
|
322
304
|
return;
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
305
|
+
const H = V[0];
|
|
306
|
+
if (H == null)
|
|
325
307
|
return;
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
308
|
+
const U = H.transform;
|
|
309
|
+
if (U == null)
|
|
328
310
|
return;
|
|
329
311
|
const {
|
|
330
|
-
width:
|
|
331
|
-
height:
|
|
332
|
-
left:
|
|
333
|
-
top:
|
|
334
|
-
angle:
|
|
335
|
-
} =
|
|
336
|
-
|
|
312
|
+
width: q,
|
|
313
|
+
height: k,
|
|
314
|
+
left: z,
|
|
315
|
+
top: F,
|
|
316
|
+
angle: K
|
|
317
|
+
} = U;
|
|
318
|
+
q != null && b(q), k != null && I(k), z != null && N(z), F != null && D(F), K != null && W(K);
|
|
337
319
|
};
|
|
338
320
|
ve(() => {
|
|
339
|
-
const C = w.changeStart$.subscribe((
|
|
340
|
-
|
|
341
|
-
}), A = w.changing$.subscribe((
|
|
342
|
-
|
|
343
|
-
}),
|
|
344
|
-
if (
|
|
321
|
+
const C = w.changeStart$.subscribe((H) => {
|
|
322
|
+
Ze(H);
|
|
323
|
+
}), A = w.changing$.subscribe((H) => {
|
|
324
|
+
Ze(H);
|
|
325
|
+
}), V = e.focus$.subscribe((H) => {
|
|
326
|
+
if (H.length !== 1)
|
|
345
327
|
return;
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
328
|
+
const U = e.getDrawingByParam(H[0]);
|
|
329
|
+
if (U == null)
|
|
348
330
|
return;
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
331
|
+
const q = U.transform;
|
|
332
|
+
if (q == null)
|
|
351
333
|
return;
|
|
352
334
|
const {
|
|
353
|
-
width:
|
|
354
|
-
height:
|
|
355
|
-
left:
|
|
356
|
-
top:
|
|
335
|
+
width: k,
|
|
336
|
+
height: z,
|
|
337
|
+
left: F,
|
|
338
|
+
top: K,
|
|
357
339
|
angle: ee
|
|
358
|
-
} =
|
|
359
|
-
|
|
340
|
+
} = q;
|
|
341
|
+
k != null && b(k), z != null && I(z), F != null && N(F), K != null && D(K), ee != null && W(ee);
|
|
360
342
|
});
|
|
361
343
|
return () => {
|
|
362
|
-
A.unsubscribe(), C.unsubscribe(),
|
|
344
|
+
A.unsubscribe(), C.unsubscribe(), V.unsubscribe();
|
|
363
345
|
};
|
|
364
346
|
}, []);
|
|
365
347
|
const St = Ie((C) => {
|
|
366
348
|
if (C == null)
|
|
367
349
|
return;
|
|
368
350
|
C = Math.max(C, re);
|
|
369
|
-
const { limitWidth: A } = _e(P,
|
|
370
|
-
C = A;
|
|
351
|
+
const { limitWidth: A, limitHeight: V } = _e(P, B, C, y);
|
|
352
|
+
C = Math.min(C, A);
|
|
371
353
|
const H = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { width: C } };
|
|
372
|
-
if (
|
|
373
|
-
let
|
|
374
|
-
|
|
354
|
+
if (Ve) {
|
|
355
|
+
let U = C / R * y;
|
|
356
|
+
if (U = Math.max(U, In), U > V)
|
|
357
|
+
return;
|
|
358
|
+
I(U), H.transform.height = U;
|
|
375
359
|
}
|
|
376
360
|
b(C), e.featurePluginUpdateNotification([H]), w.refreshControls().changeNotification();
|
|
377
361
|
}, Pe), bt = Ie((C) => {
|
|
378
362
|
if (C == null)
|
|
379
363
|
return;
|
|
380
364
|
C = Math.max(C, re);
|
|
381
|
-
const { limitHeight: A } = _e(P,
|
|
382
|
-
C = A;
|
|
365
|
+
const { limitHeight: A, limitWidth: V } = _e(P, B, R, C);
|
|
366
|
+
C = Math.min(C, A);
|
|
383
367
|
const H = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { height: C } };
|
|
384
|
-
if (
|
|
385
|
-
let
|
|
386
|
-
|
|
368
|
+
if (Ve) {
|
|
369
|
+
let U = C / y * R;
|
|
370
|
+
if (U = Math.max(U, re), U > V)
|
|
371
|
+
return;
|
|
372
|
+
b(U), H.transform.width = U;
|
|
387
373
|
}
|
|
388
374
|
I(C), e.featurePluginUpdateNotification([H]), w.refreshControls().changeNotification();
|
|
389
375
|
}, Pe), It = Ie((C) => {
|
|
390
376
|
if (C == null)
|
|
391
377
|
return;
|
|
392
|
-
const { limitLeft: A } = _e(C,
|
|
378
|
+
const { limitLeft: A } = _e(C, B, R, y);
|
|
393
379
|
C = A;
|
|
394
|
-
const
|
|
395
|
-
N(C), e.featurePluginUpdateNotification([
|
|
380
|
+
const V = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { left: C } };
|
|
381
|
+
N(C), e.featurePluginUpdateNotification([V]), w.refreshControls().changeNotification();
|
|
396
382
|
}, Pe), Pt = Ie((C) => {
|
|
397
383
|
if (C == null)
|
|
398
384
|
return;
|
|
399
385
|
const { limitTop: A } = _e(P, C, R, y);
|
|
400
386
|
C = A;
|
|
401
|
-
const
|
|
402
|
-
D(C), e.featurePluginUpdateNotification([
|
|
387
|
+
const V = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { top: C } };
|
|
388
|
+
D(C), e.featurePluginUpdateNotification([V]), w.refreshControls().changeNotification();
|
|
403
389
|
}, Pe), yt = (C) => {
|
|
404
390
|
if (C == null)
|
|
405
391
|
return;
|
|
406
|
-
const [A,
|
|
407
|
-
C < A && (C = A), C >
|
|
408
|
-
const
|
|
409
|
-
|
|
392
|
+
const [A, V] = Pn;
|
|
393
|
+
C < A && (C = A), C > V && (C = V);
|
|
394
|
+
const H = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { angle: C } };
|
|
395
|
+
W(C), e.featurePluginUpdateNotification([H]), w.refreshControls().changeNotification();
|
|
410
396
|
}, Et = (C) => {
|
|
411
397
|
_t(C), w.keepRatio = C;
|
|
412
398
|
}, Rt = (C) => C ? "block" : "none";
|
|
@@ -414,19 +400,19 @@ const cn = "univer-image-common-panel", ln = "univer-image-common-panel-grid", m
|
|
|
414
400
|
St(C);
|
|
415
401
|
}, className: m.imageCommonPanelInput }))))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.height"))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(de, { precision: 1, value: y, onChange: (C) => {
|
|
416
402
|
bt(C);
|
|
417
|
-
}, className: m.imageCommonPanelInput }))))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.lock"))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelRow, m.imageCommonPanelRowVertical) }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(At, { checked:
|
|
403
|
+
}, className: m.imageCommonPanelInput }))))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.lock"))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelRow, m.imageCommonPanelRowVertical) }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(At, { checked: Ve, onChange: Et })))))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.x"))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(de, { precision: 1, value: P, onChange: (C) => {
|
|
418
404
|
It(C);
|
|
419
|
-
}, className: m.imageCommonPanelInput }))))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.y"))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(de, { precision: 1, value:
|
|
405
|
+
}, className: m.imageCommonPanelInput }))))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.y"))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(de, { precision: 1, value: B, onChange: (C) => {
|
|
420
406
|
Pt(C);
|
|
421
|
-
}, className: m.imageCommonPanelInput }))))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.rotate"))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(de, { precision: 1, value:
|
|
407
|
+
}, className: m.imageCommonPanelInput }))))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan3) }, /* @__PURE__ */ c.createElement("label", null, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, n.t("image-panel.transform.rotate"))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelColumn }, /* @__PURE__ */ c.createElement(de, { precision: 1, value: le, onChange: yt, className: m.imageCommonPanelInput })))))));
|
|
422
408
|
};
|
|
423
409
|
var O = /* @__PURE__ */ ((a) => (a.default = "0", a.left = "1", a.center = "2", a.right = "3", a.top = "4", a.middle = "5", a.bottom = "6", a.horizon = "7", a.vertical = "8", a))(O || {});
|
|
424
|
-
const
|
|
410
|
+
const Ke = {
|
|
425
411
|
id: "sheet.operation.set-image-align",
|
|
426
412
|
type: we.OPERATION,
|
|
427
413
|
handler: (a, n) => !0
|
|
428
|
-
},
|
|
429
|
-
const n =
|
|
414
|
+
}, En = (a) => {
|
|
415
|
+
const n = x(ce), e = x(Z), { alignShow: t } = a, [r, o] = L(O.default), i = [
|
|
430
416
|
{
|
|
431
417
|
label: e.t("image-panel.align.default"),
|
|
432
418
|
value: O.default
|
|
@@ -477,61 +463,75 @@ const Fe = {
|
|
|
477
463
|
}
|
|
478
464
|
];
|
|
479
465
|
function s(g) {
|
|
480
|
-
o(g), n.executeCommand(
|
|
466
|
+
o(g), n.executeCommand(Ke.id, {
|
|
481
467
|
alignType: g
|
|
482
468
|
});
|
|
483
469
|
}
|
|
484
470
|
const l = (g) => g ? "block" : "none";
|
|
485
|
-
return /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: l(t) } }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelTitle) }, /* @__PURE__ */ c.createElement("div", null, e.t("image-panel.align.title")))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn) }, /* @__PURE__ */ c.createElement(
|
|
486
|
-
},
|
|
487
|
-
|
|
471
|
+
return /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: l(t) } }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelTitle) }, /* @__PURE__ */ c.createElement("div", null, e.t("image-panel.align.title")))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn) }, /* @__PURE__ */ c.createElement(ot, { value: r, options: i, onChange: s }))));
|
|
472
|
+
}, ke = {
|
|
473
|
+
id: "sheet.operation.open-image-crop",
|
|
474
|
+
type: we.OPERATION,
|
|
475
|
+
handler: (a, n) => !0
|
|
476
|
+
}, oe = {
|
|
477
|
+
id: "sheet.operation.close-image-crop",
|
|
478
|
+
type: we.OPERATION,
|
|
479
|
+
handler: (a, n) => !0
|
|
480
|
+
};
|
|
481
|
+
var j = /* @__PURE__ */ ((a) => (a.FREE = "0", a.R1_1 = "1", a.R16_9 = "2", a.R9_16 = "3", a.R5_4 = "4", a.R4_5 = "5", a.R4_3 = "6", a.R3_4 = "7", a.R3_2 = "8", a.R2_3 = "9", a))(j || {});
|
|
482
|
+
const je = {
|
|
483
|
+
id: "sheet.operation.Auto-image-crop",
|
|
484
|
+
type: we.OPERATION,
|
|
485
|
+
handler: (a, n) => !0
|
|
486
|
+
}, Rn = (a) => {
|
|
487
|
+
const n = x(ce), e = x(Z), { drawings: t, cropperShow: r } = a;
|
|
488
488
|
if (t[0] == null)
|
|
489
489
|
return;
|
|
490
|
-
const [i, s] = L(
|
|
490
|
+
const [i, s] = L(j.FREE), l = it(!1), g = [
|
|
491
491
|
{
|
|
492
492
|
label: e.t("image-panel.crop.mode"),
|
|
493
|
-
value:
|
|
493
|
+
value: j.FREE
|
|
494
494
|
},
|
|
495
495
|
{
|
|
496
496
|
label: "1:1",
|
|
497
|
-
value:
|
|
497
|
+
value: j.R1_1
|
|
498
498
|
},
|
|
499
499
|
{
|
|
500
500
|
label: "16:9",
|
|
501
|
-
value:
|
|
501
|
+
value: j.R16_9
|
|
502
502
|
},
|
|
503
503
|
{
|
|
504
504
|
label: "9:16",
|
|
505
|
-
value:
|
|
505
|
+
value: j.R9_16
|
|
506
506
|
},
|
|
507
507
|
{
|
|
508
508
|
label: "5:4",
|
|
509
|
-
value:
|
|
509
|
+
value: j.R5_4
|
|
510
510
|
},
|
|
511
511
|
{
|
|
512
512
|
label: "4:5",
|
|
513
|
-
value:
|
|
513
|
+
value: j.R4_5
|
|
514
514
|
},
|
|
515
515
|
{
|
|
516
516
|
label: "4:3",
|
|
517
|
-
value:
|
|
517
|
+
value: j.R4_3
|
|
518
518
|
},
|
|
519
519
|
{
|
|
520
520
|
label: "3:4",
|
|
521
|
-
value:
|
|
521
|
+
value: j.R3_4
|
|
522
522
|
},
|
|
523
523
|
{
|
|
524
524
|
label: "3:2",
|
|
525
|
-
value:
|
|
525
|
+
value: j.R3_2
|
|
526
526
|
},
|
|
527
527
|
{
|
|
528
528
|
label: "2:3",
|
|
529
|
-
value:
|
|
529
|
+
value: j.R2_3
|
|
530
530
|
}
|
|
531
531
|
];
|
|
532
532
|
ve(() => {
|
|
533
533
|
const f = n.onCommandExecuted((v) => {
|
|
534
|
-
if (v.id ===
|
|
534
|
+
if (v.id === oe.id) {
|
|
535
535
|
const w = v.params;
|
|
536
536
|
w != null && w.isAuto || (l.current = !1);
|
|
537
537
|
}
|
|
@@ -541,20 +541,20 @@ const Fe = {
|
|
|
541
541
|
};
|
|
542
542
|
}, []);
|
|
543
543
|
function u(f) {
|
|
544
|
-
s(f), l.current && n.executeCommand(
|
|
544
|
+
s(f), l.current && n.executeCommand(je.id, {
|
|
545
545
|
cropType: f
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
const d = (f) => f ? "block" : "none", h = (f) => {
|
|
549
|
-
n.executeCommand(
|
|
549
|
+
n.executeCommand(je.id, {
|
|
550
550
|
cropType: f
|
|
551
551
|
}), l.current = !0;
|
|
552
552
|
};
|
|
553
553
|
return /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: d(r) } }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelTitle) }, /* @__PURE__ */ c.createElement("div", null, e.t("image-panel.crop.title")))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelRow, m.imageCommonPanelRowVertical) }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2) }, /* @__PURE__ */ c.createElement(ie, { size: "small", onClick: () => {
|
|
554
554
|
h(i);
|
|
555
|
-
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(
|
|
556
|
-
},
|
|
557
|
-
const n =
|
|
555
|
+
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(gt, null), e.t("image-panel.crop.start")))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2) }, /* @__PURE__ */ c.createElement(ot, { value: i, options: g, onChange: u }))));
|
|
556
|
+
}, Mn = (a) => {
|
|
557
|
+
const n = x(Z), e = x(ge), t = x(ne), { hasGroup: r, drawings: o } = a, [i, s] = L(!1), [l, g] = L(!0), [u, d] = L(!0), h = (p) => p ? "block" : "none", f = () => {
|
|
558
558
|
const p = t.getFocusDrawings(), { unitId: E, subUnitId: _ } = p[0], M = Ht.generateRandomId(10), S = Dt(0, 0, p.map((y) => y.transform || {})), R = {
|
|
559
559
|
unitId: E,
|
|
560
560
|
subUnitId: _,
|
|
@@ -562,11 +562,11 @@ const Fe = {
|
|
|
562
562
|
drawingType: te.DRAWING_GROUP,
|
|
563
563
|
transform: S
|
|
564
564
|
}, b = p.map((y) => {
|
|
565
|
-
const I = y.transform || { left: 0, top: 0 }, { unitId: P, subUnitId: N, drawingId:
|
|
565
|
+
const I = y.transform || { left: 0, top: 0 }, { unitId: P, subUnitId: N, drawingId: B } = y;
|
|
566
566
|
return {
|
|
567
567
|
unitId: P,
|
|
568
568
|
subUnitId: N,
|
|
569
|
-
drawingId:
|
|
569
|
+
drawingId: B,
|
|
570
570
|
transform: {
|
|
571
571
|
...I,
|
|
572
572
|
left: I.left - S.left,
|
|
@@ -589,11 +589,11 @@ const Fe = {
|
|
|
589
589
|
if (R.length === 0)
|
|
590
590
|
return;
|
|
591
591
|
const b = R.map((y) => {
|
|
592
|
-
const { transform: I } = y, { unitId: P, subUnitId: N, drawingId:
|
|
592
|
+
const { transform: I } = y, { unitId: P, subUnitId: N, drawingId: B } = y, D = Tt(I || {}, S, S.width || 0, S.height || 0);
|
|
593
593
|
return {
|
|
594
594
|
unitId: P,
|
|
595
595
|
subUnitId: N,
|
|
596
|
-
drawingId:
|
|
596
|
+
drawingId: B,
|
|
597
597
|
transform: {
|
|
598
598
|
...I,
|
|
599
599
|
...D
|
|
@@ -621,20 +621,20 @@ const Fe = {
|
|
|
621
621
|
const S = M.getTransformerByCreate(), R = S.clearControl$.subscribe((y) => {
|
|
622
622
|
y === !0 && s(!1);
|
|
623
623
|
}), b = S.changeStart$.subscribe((y) => {
|
|
624
|
-
const { objects: I } = y, P =
|
|
625
|
-
let
|
|
626
|
-
P.length > 1 && (
|
|
624
|
+
const { objects: I } = y, P = Ae(I, t), N = P.filter((W) => (W == null ? void 0 : W.drawingType) === te.DRAWING_GROUP);
|
|
625
|
+
let B = !1, D = !1;
|
|
626
|
+
P.length > 1 && (B = !0), N.length > 0 && (D = !0), s(B || D), g(B), d(D);
|
|
627
627
|
});
|
|
628
628
|
return () => {
|
|
629
629
|
b.unsubscribe(), R.unsubscribe();
|
|
630
630
|
};
|
|
631
631
|
}, []), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: h(r === !0 ? i : !1) } }, /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelTitle) }, /* @__PURE__ */ c.createElement("div", null, n.t("image-panel.group.title")))), /* @__PURE__ */ c.createElement("div", { className: m.imageCommonPanelRow }, /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2, m.imageCommonPanelColumnCenter) }, /* @__PURE__ */ c.createElement(ie, { size: "small", onClick: () => {
|
|
632
632
|
f();
|
|
633
|
-
}, style: { display: h(l) } }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(
|
|
633
|
+
}, style: { display: h(l) } }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(ut, null), n.t("image-panel.group.group")))), /* @__PURE__ */ c.createElement("div", { className: T(m.imageCommonPanelColumn, m.imageCommonPanelSpan2, m.imageCommonPanelColumnCenter) }, /* @__PURE__ */ c.createElement(ie, { size: "small", onClick: () => {
|
|
634
634
|
w();
|
|
635
|
-
}, style: { display: h(u) } }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(
|
|
636
|
-
},
|
|
637
|
-
const n =
|
|
635
|
+
}, style: { display: h(u) } }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(Ct, null), n.t("image-panel.group.unGroup"))))));
|
|
636
|
+
}, ur = (a) => {
|
|
637
|
+
const n = x(ne), e = x(ge), t = x(Z), { drawings: r, hasArrange: o = !0, hasTransform: i = !0, hasAlign: s = !0, hasCropper: l = !0, hasGroup: g = !0 } = a, u = r[0];
|
|
638
638
|
if (u == null)
|
|
639
639
|
return;
|
|
640
640
|
const { unitId: d } = u, h = e.getRenderById(d), f = h == null ? void 0 : h.scene;
|
|
@@ -645,29 +645,29 @@ const Fe = {
|
|
|
645
645
|
const P = v.clearControl$.subscribe((D) => {
|
|
646
646
|
D === !0 && (p(!1), _(!1), S(!1), b(!1), I(!0));
|
|
647
647
|
}), N = v.changeStart$.subscribe((D) => {
|
|
648
|
-
const { objects:
|
|
649
|
-
|
|
650
|
-
}),
|
|
648
|
+
const { objects: le } = D, W = Ae(le, n);
|
|
649
|
+
W.length === 0 ? (p(!1), _(!1), S(!1), b(!1), I(!0)) : W.length === 1 ? (p(!0), _(!0), S(!1), b(!0), I(!1)) : (p(!0), _(!1), S(!0), b(!1), I(!1));
|
|
650
|
+
}), B = n.focus$.subscribe((D) => {
|
|
651
651
|
D.length === 0 ? (p(!1), _(!1), S(!1), b(!1), I(!0)) : D.length === 1 ? (p(!0), _(!0), S(!1), b(!0), I(!1)) : (p(!0), _(!1), S(!0), b(!1), I(!1));
|
|
652
652
|
});
|
|
653
653
|
return () => {
|
|
654
|
-
N.unsubscribe(), P.unsubscribe(),
|
|
654
|
+
N.unsubscribe(), P.unsubscribe(), B.unsubscribe();
|
|
655
655
|
};
|
|
656
|
-
}, []), /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("div", { style: { display: y === !0 ? "block" : "none", height: "100%" } }, /* @__PURE__ */ c.createElement("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", top: "50%", marginTop: "-100px" } }, /* @__PURE__ */ c.createElement("span", null, t.t("image-panel.null")))), /* @__PURE__ */ c.createElement(
|
|
657
|
-
},
|
|
658
|
-
imagePopupMenu:
|
|
659
|
-
imagePopupMenuItem:
|
|
660
|
-
imagePopupMenuItemIcon:
|
|
661
|
-
imagePopupMenuItemTitle:
|
|
662
|
-
imagePopupMenuItemHide:
|
|
663
|
-
btnContainer:
|
|
664
|
-
btnContainerExpand:
|
|
665
|
-
},
|
|
656
|
+
}, []), /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("div", { style: { display: y === !0 ? "block" : "none", height: "100%" } }, /* @__PURE__ */ c.createElement("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", top: "50%", marginTop: "-100px" } }, /* @__PURE__ */ c.createElement("span", null, t.t("image-panel.null")))), /* @__PURE__ */ c.createElement(bn, { arrangeShow: o === !0 ? w : !1, drawings: r }), /* @__PURE__ */ c.createElement(yn, { transformShow: i === !0 ? E : !1, drawings: r }), /* @__PURE__ */ c.createElement(En, { alignShow: s === !0 ? M : !1, drawings: r }), /* @__PURE__ */ c.createElement(Rn, { cropperShow: l === !0 ? R : !1, drawings: r }), /* @__PURE__ */ c.createElement(Mn, { hasGroup: g, drawings: r }));
|
|
657
|
+
}, On = "univer-image-popup-menu", Nn = "univer-image-popup-menu-item", Dn = "univer-image-popup-menu-item-icon", Tn = "univer-image-popup-menu-item-title", Bn = "univer-image-popup-menu-item-hide", jn = "univer-btn-container", Un = "univer-btn-container-expand", he = {
|
|
658
|
+
imagePopupMenu: On,
|
|
659
|
+
imagePopupMenuItem: Nn,
|
|
660
|
+
imagePopupMenuItemIcon: Dn,
|
|
661
|
+
imagePopupMenuItemTitle: Tn,
|
|
662
|
+
imagePopupMenuItemHide: Bn,
|
|
663
|
+
btnContainer: jn,
|
|
664
|
+
btnContainerExpand: Un
|
|
665
|
+
}, Hn = (a) => {
|
|
666
666
|
var v, w;
|
|
667
667
|
const n = (w = (v = a.popup) == null ? void 0 : v.extraProps) == null ? void 0 : w.menuItems;
|
|
668
668
|
if (!n)
|
|
669
669
|
return null;
|
|
670
|
-
const e =
|
|
670
|
+
const e = x(ce), t = x(Z), [r, o] = L(!1), [i, s] = L(!1), l = () => {
|
|
671
671
|
s(!0);
|
|
672
672
|
}, g = () => {
|
|
673
673
|
s(!1);
|
|
@@ -707,23 +707,23 @@ const Fe = {
|
|
|
707
707
|
})
|
|
708
708
|
},
|
|
709
709
|
/* @__PURE__ */ c.createElement(
|
|
710
|
-
|
|
710
|
+
lt,
|
|
711
711
|
{
|
|
712
712
|
style: { color: "#35322B" },
|
|
713
713
|
extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
|
|
714
714
|
}
|
|
715
715
|
),
|
|
716
|
-
h && /* @__PURE__ */ c.createElement(
|
|
716
|
+
h && /* @__PURE__ */ c.createElement(dt, { style: { color: "#CCCCCC", fontSize: "8px", marginLeft: "8px" } })
|
|
717
717
|
)
|
|
718
718
|
)
|
|
719
719
|
);
|
|
720
|
-
},
|
|
721
|
-
var
|
|
722
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
720
|
+
}, Ln = "COMPONENT_IMAGE_POPUP_MENU";
|
|
721
|
+
var An = Object.defineProperty, Vn = Object.getOwnPropertyDescriptor, xn = (a, n, e, t) => {
|
|
722
|
+
for (var r = t > 1 ? void 0 : t ? Vn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
723
723
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
724
|
-
return t && r &&
|
|
724
|
+
return t && r && An(n, e, r), r;
|
|
725
725
|
}, ye = (a, n) => (e, t) => n(e, t, a);
|
|
726
|
-
let
|
|
726
|
+
let Me = class extends Ue {
|
|
727
727
|
constructor(n, e, t, r) {
|
|
728
728
|
super();
|
|
729
729
|
Q(this, "_sceneListenerOnDrawingMap", /* @__PURE__ */ new WeakSet());
|
|
@@ -736,7 +736,7 @@ let Re = class extends je {
|
|
|
736
736
|
this._recoveryImages(), this._drawingAddListener(), this._drawingRemoveListener(), this._drawingUpdateListener(), this._commandExecutedListener(), this._drawingArrangeListener(), this._drawingGroupListener(), this._drawingRefreshListener(), this._drawingVisibleListener();
|
|
737
737
|
}
|
|
738
738
|
_recoveryImages() {
|
|
739
|
-
const n = this._drawingManagerService.drawingManagerData, e =
|
|
739
|
+
const n = this._drawingManagerService.drawingManagerData, e = $e(this._currentUniverService);
|
|
740
740
|
if (e == null)
|
|
741
741
|
return;
|
|
742
742
|
const { unitId: t, subUnitId: r } = e;
|
|
@@ -752,7 +752,7 @@ let Re = class extends je {
|
|
|
752
752
|
_commandExecutedListener() {
|
|
753
753
|
this.disposeWithMe(
|
|
754
754
|
this._commandService.onCommandExecuted((n) => {
|
|
755
|
-
if (n.id ===
|
|
755
|
+
if (n.id === Ke.id) {
|
|
756
756
|
const e = n.params;
|
|
757
757
|
if (e == null)
|
|
758
758
|
return;
|
|
@@ -811,19 +811,19 @@ let Re = class extends je {
|
|
|
811
811
|
if (s == null)
|
|
812
812
|
return;
|
|
813
813
|
const { scene: l, transformer: g } = s;
|
|
814
|
-
this._commandService.syncExecuteCommand(
|
|
814
|
+
this._commandService.syncExecuteCommand(oe.id);
|
|
815
815
|
const u = [];
|
|
816
816
|
if (t.forEach((f) => {
|
|
817
|
-
const v =
|
|
817
|
+
const v = G(f), w = l.getObjectIncludeInGroup(v);
|
|
818
818
|
if (w == null || u.includes(w))
|
|
819
819
|
return;
|
|
820
820
|
u.push(w);
|
|
821
821
|
const { transform: p } = f;
|
|
822
|
-
p != null && (w.classType ===
|
|
822
|
+
p != null && (w.classType === Xe.GROUP ? w.transformByState({ left: p.left, top: p.top }) : w.transformByState(p));
|
|
823
823
|
}), u.length === 0)
|
|
824
824
|
return;
|
|
825
|
-
const d =
|
|
826
|
-
l.addObject(h,
|
|
825
|
+
const d = G({ unitId: r, subUnitId: o, drawingId: i }), h = new pe(d);
|
|
826
|
+
l.addObject(h, ze).attachTransformerTo(h), h.addObjects(...u), e.transform && h.transformByState({ left: e.transform.left, top: e.transform.top }), g.clearSelectedObjects(), g.setSelectedControl(h);
|
|
827
827
|
}
|
|
828
828
|
// private _regroupDrawings(drawings: IDrawingSearch[]) {
|
|
829
829
|
// const renderObject = this._getSceneAndTransformerByDrawingSearch(drawings[0].unitId);
|
|
@@ -870,15 +870,15 @@ let Re = class extends je {
|
|
|
870
870
|
return;
|
|
871
871
|
const { scene: o, transformer: i } = r;
|
|
872
872
|
t.forEach((d) => {
|
|
873
|
-
const h =
|
|
873
|
+
const h = G(d), f = o.getObjectIncludeInGroup(h);
|
|
874
874
|
if (f == null)
|
|
875
875
|
return !0;
|
|
876
876
|
if (f == null)
|
|
877
877
|
return;
|
|
878
878
|
const { transform: v } = d;
|
|
879
|
-
v != null && (f.classType ===
|
|
879
|
+
v != null && (f.classType === Xe.GROUP ? f.transformByState({ left: v.left, top: v.top }) : f.transformByState(v));
|
|
880
880
|
});
|
|
881
|
-
const s =
|
|
881
|
+
const s = G(e), l = o.getObject(s), { width: g, height: u } = l;
|
|
882
882
|
l.getObjects().forEach((d) => {
|
|
883
883
|
l.removeSelfObjectAndTransform(d.oKey, g, u);
|
|
884
884
|
}), l.dispose(), i.clearSelectedObjects();
|
|
@@ -998,7 +998,7 @@ let Re = class extends je {
|
|
|
998
998
|
return;
|
|
999
999
|
const { scene: i, transformer: s } = o;
|
|
1000
1000
|
r.forEach((l) => {
|
|
1001
|
-
const g =
|
|
1001
|
+
const g = G({ unitId: e, subUnitId: t, drawingId: l }), u = i.getObject(g);
|
|
1002
1002
|
if (u == null)
|
|
1003
1003
|
return;
|
|
1004
1004
|
const d = this._drawingManagerService.getDrawingOrder(e, t).indexOf(l);
|
|
@@ -1035,7 +1035,7 @@ let Re = class extends je {
|
|
|
1035
1035
|
const { unitId: t, subUnitId: r, drawingId: o } = e, i = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1036
1036
|
if (i == null)
|
|
1037
1037
|
return;
|
|
1038
|
-
const { scene: s, transformer: l } = i, g =
|
|
1038
|
+
const { scene: s, transformer: l } = i, g = G({ unitId: t, subUnitId: r, drawingId: o }), u = s.getObject(g);
|
|
1039
1039
|
u != null && (u.dispose(), (d = s.getTransformer()) == null || d.clearSelectedObjects());
|
|
1040
1040
|
});
|
|
1041
1041
|
})
|
|
@@ -1054,7 +1054,7 @@ let Re = class extends je {
|
|
|
1054
1054
|
const { scene: u, transformer: d } = g;
|
|
1055
1055
|
if (s == null)
|
|
1056
1056
|
return !0;
|
|
1057
|
-
const { left: h = 0, top: f = 0, width: v = 0, height: w = 0, angle: p = 0, flipX: E = !1, flipY: _ = !1, skewX: M = 0, skewY: S = 0 } = s, R =
|
|
1057
|
+
const { left: h = 0, top: f = 0, width: v = 0, height: w = 0, angle: p = 0, flipX: E = !1, flipY: _ = !1, skewX: M = 0, skewY: S = 0 } = s, R = G({ unitId: t, subUnitId: r, drawingId: o }), b = u.getObject(R);
|
|
1058
1058
|
if (b == null)
|
|
1059
1059
|
return !0;
|
|
1060
1060
|
b.transformByState({ left: h, top: f, width: v, height: w, angle: p, flipX: E, flipY: _, skewX: M, skewY: S });
|
|
@@ -1069,7 +1069,7 @@ let Re = class extends je {
|
|
|
1069
1069
|
const { unitId: t, subUnitId: r, drawingId: o } = e, i = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1070
1070
|
if (i == null)
|
|
1071
1071
|
return;
|
|
1072
|
-
const { scene: s, transformer: l } = i, g =
|
|
1072
|
+
const { scene: s, transformer: l } = i, g = G({ unitId: t, subUnitId: r, drawingId: o }), u = s.getObject(g), d = this._drawingManagerService.getDrawingByParam(e);
|
|
1073
1073
|
if (d == null)
|
|
1074
1074
|
return;
|
|
1075
1075
|
const { transform: h } = d;
|
|
@@ -1090,7 +1090,7 @@ let Re = class extends je {
|
|
|
1090
1090
|
const { unitId: t, subUnitId: r, drawingId: o, visible: i } = e, s = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1091
1091
|
if (s == null)
|
|
1092
1092
|
return;
|
|
1093
|
-
const { scene: l, transformer: g } = s, u =
|
|
1093
|
+
const { scene: l, transformer: g } = s, u = G({ unitId: t, subUnitId: r, drawingId: o }), d = l.getObject(u);
|
|
1094
1094
|
if (d == null)
|
|
1095
1095
|
return !0;
|
|
1096
1096
|
i ? d.show() : d.hide();
|
|
@@ -1103,7 +1103,7 @@ let Re = class extends je {
|
|
|
1103
1103
|
if (t == null)
|
|
1104
1104
|
return !1;
|
|
1105
1105
|
const { transform: o } = t;
|
|
1106
|
-
return
|
|
1106
|
+
return at(o, e == null ? void 0 : e[r]);
|
|
1107
1107
|
});
|
|
1108
1108
|
}
|
|
1109
1109
|
// group?.getObjects().forEach((o) => {
|
|
@@ -1130,8 +1130,8 @@ let Re = class extends je {
|
|
|
1130
1130
|
if (M) {
|
|
1131
1131
|
const { unitId: S, subUnitId: R, drawingId: b } = M;
|
|
1132
1132
|
s.push({ unitId: S, subUnitId: R, drawingId: b });
|
|
1133
|
-
const { left: y, top: I, height: P, width: N, angle:
|
|
1134
|
-
return { left: y, top: I, height: P, width: N, angle:
|
|
1133
|
+
const { left: y, top: I, height: P, width: N, angle: B } = _;
|
|
1134
|
+
return { left: y, top: I, height: P, width: N, angle: B };
|
|
1135
1135
|
}
|
|
1136
1136
|
} else if (E != null) {
|
|
1137
1137
|
const { unitId: _, subUnitId: M, drawingId: S } = E;
|
|
@@ -1144,60 +1144,64 @@ let Re = class extends je {
|
|
|
1144
1144
|
), this.disposeWithMe(
|
|
1145
1145
|
Ce(
|
|
1146
1146
|
e.changeEnd$.subscribe((r) => {
|
|
1147
|
-
const { objects: o } = r, i = this._filterUpdateParams(
|
|
1147
|
+
const { objects: o } = r, i = this._filterUpdateParams(Ae(o, this._drawingManagerService), t);
|
|
1148
1148
|
i.length > 0 && this._drawingManagerService.featurePluginUpdateNotification(i);
|
|
1149
1149
|
})
|
|
1150
1150
|
)
|
|
1151
1151
|
);
|
|
1152
1152
|
}
|
|
1153
1153
|
};
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
ye(0,
|
|
1157
|
-
ye(1,
|
|
1154
|
+
Me = xn([
|
|
1155
|
+
He(Le.Rendered, Me),
|
|
1156
|
+
ye(0, Fe),
|
|
1157
|
+
ye(1, ce),
|
|
1158
1158
|
ye(2, ge),
|
|
1159
1159
|
ye(3, ne)
|
|
1160
|
-
],
|
|
1161
|
-
const
|
|
1160
|
+
], Me);
|
|
1161
|
+
const Gn = (a) => {
|
|
1162
1162
|
const { src: n } = a;
|
|
1163
1163
|
return n ? /* @__PURE__ */ c.createElement("div", null, /* @__PURE__ */ c.createElement("img", { src: n, alt: "Univer Image Viewer", style: { width: "100%", height: "100%", position: "relative" } })) : null;
|
|
1164
|
-
},
|
|
1165
|
-
|
|
1166
|
-
|
|
1164
|
+
}, wt = "COMPONENT_IMAGE_VIEWER", vt = {
|
|
1165
|
+
id: "sheet.operation.image-reset-size",
|
|
1166
|
+
type: we.OPERATION,
|
|
1167
|
+
handler: (a, n) => !0
|
|
1168
|
+
};
|
|
1169
|
+
var Wn = Object.defineProperty, $n = Object.getOwnPropertyDescriptor, kn = (a, n, e, t) => {
|
|
1170
|
+
for (var r = t > 1 ? void 0 : t ? $n(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1167
1171
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1168
|
-
return t && r &&
|
|
1172
|
+
return t && r && Wn(n, e, r), r;
|
|
1169
1173
|
}, fe = (a, n) => (e, t) => n(e, t, a);
|
|
1170
|
-
let
|
|
1174
|
+
let Oe = class extends Ue {
|
|
1171
1175
|
constructor(a, n, e, t, r) {
|
|
1172
1176
|
super(), this._injector = a, this._componentManager = n, this._menuService = e, this._commandService = t, this._localeService = r, this._init();
|
|
1173
1177
|
}
|
|
1174
1178
|
_initCustomComponents() {
|
|
1175
1179
|
const a = this._componentManager;
|
|
1176
|
-
this.disposeWithMe(a.register(
|
|
1180
|
+
this.disposeWithMe(a.register(Ln, Hn)), this.disposeWithMe(a.register(wt, Gn));
|
|
1177
1181
|
}
|
|
1178
1182
|
_initMenus() {
|
|
1179
1183
|
}
|
|
1180
1184
|
_initCommands() {
|
|
1181
1185
|
[
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1186
|
+
ke,
|
|
1187
|
+
oe,
|
|
1188
|
+
vt,
|
|
1189
|
+
Ke,
|
|
1190
|
+
je
|
|
1187
1191
|
].forEach((a) => this.disposeWithMe(this._commandService.registerCommand(a)));
|
|
1188
1192
|
}
|
|
1189
1193
|
_init() {
|
|
1190
1194
|
this._initCommands(), this._initCustomComponents(), this._initMenus();
|
|
1191
1195
|
}
|
|
1192
1196
|
};
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
fe(0,
|
|
1196
|
-
fe(1,
|
|
1197
|
+
Oe = kn([
|
|
1198
|
+
He(Le.Rendered, Oe),
|
|
1199
|
+
fe(0, se(st)),
|
|
1200
|
+
fe(1, se(xt)),
|
|
1197
1201
|
fe(2, Gt),
|
|
1198
|
-
fe(3,
|
|
1199
|
-
fe(4,
|
|
1200
|
-
],
|
|
1202
|
+
fe(3, ce),
|
|
1203
|
+
fe(4, se(Z))
|
|
1204
|
+
], Oe);
|
|
1201
1205
|
class Ee extends Bt {
|
|
1202
1206
|
constructor(e, t) {
|
|
1203
1207
|
t == null && (t = {}), t.transformerConfig = {
|
|
@@ -1291,12 +1295,12 @@ class Ee extends Bt {
|
|
|
1291
1295
|
});
|
|
1292
1296
|
}
|
|
1293
1297
|
}
|
|
1294
|
-
var
|
|
1295
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1298
|
+
var zn = Object.defineProperty, Fn = Object.getOwnPropertyDescriptor, Kn = (a, n, e, t) => {
|
|
1299
|
+
for (var r = t > 1 ? void 0 : t ? Fn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1296
1300
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1297
|
-
return t && r &&
|
|
1298
|
-
},
|
|
1299
|
-
let
|
|
1301
|
+
return t && r && zn(n, e, r), r;
|
|
1302
|
+
}, me = (a, n) => (e, t) => n(e, t, a);
|
|
1303
|
+
let Ne = class extends Ue {
|
|
1300
1304
|
constructor(n, e, t, r, o, i) {
|
|
1301
1305
|
super();
|
|
1302
1306
|
Q(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
|
|
@@ -1308,7 +1312,7 @@ let Oe = class extends je {
|
|
|
1308
1312
|
_initAutoCrop() {
|
|
1309
1313
|
this.disposeWithMe(
|
|
1310
1314
|
this._commandService.onCommandExecuted((n) => {
|
|
1311
|
-
if (n.id !==
|
|
1315
|
+
if (n.id !== je.id)
|
|
1312
1316
|
return;
|
|
1313
1317
|
const e = n.params;
|
|
1314
1318
|
if (e == null)
|
|
@@ -1319,16 +1323,16 @@ let Oe = class extends je {
|
|
|
1319
1323
|
const o = r[0], { unitId: i, subUnitId: s, drawingId: l } = o, g = this._renderManagerService.getRenderById(i), u = g == null ? void 0 : g.scene;
|
|
1320
1324
|
if (u == null)
|
|
1321
1325
|
return !0;
|
|
1322
|
-
this._searchCropObject(u) != null && this._commandService.syncExecuteCommand(
|
|
1323
|
-
const h =
|
|
1326
|
+
this._searchCropObject(u) != null && this._commandService.syncExecuteCommand(oe.id, { isAuto: !0 });
|
|
1327
|
+
const h = G({ unitId: i, subUnitId: s, drawingId: l }), f = u.getObject(h);
|
|
1324
1328
|
if (!(f instanceof We)) {
|
|
1325
1329
|
this._messageService.show({
|
|
1326
|
-
type:
|
|
1330
|
+
type: qe.Error,
|
|
1327
1331
|
content: this._localeService.t("image-cropper.error")
|
|
1328
1332
|
});
|
|
1329
1333
|
return;
|
|
1330
1334
|
}
|
|
1331
|
-
f != null && (this._updateCropperObject(t, f), this._commandService.executeCommand(
|
|
1335
|
+
f != null && (this._updateCropperObject(t, f), this._commandService.executeCommand(ke.id, { unitId: i, subUnitId: s, drawingId: l }));
|
|
1332
1336
|
})
|
|
1333
1337
|
);
|
|
1334
1338
|
}
|
|
@@ -1348,34 +1352,34 @@ let Oe = class extends je {
|
|
|
1348
1352
|
const { left: t, top: r, width: o, height: i } = e.calculateTransformWithSrcRect();
|
|
1349
1353
|
let s;
|
|
1350
1354
|
switch (n) {
|
|
1351
|
-
case
|
|
1355
|
+
case j.R1_1:
|
|
1352
1356
|
s = this._calculateSrcRectByRatio(t, r, o, i, 1, 1);
|
|
1353
1357
|
break;
|
|
1354
|
-
case
|
|
1358
|
+
case j.R16_9:
|
|
1355
1359
|
s = this._calculateSrcRectByRatio(t, r, o, i, 16, 9);
|
|
1356
1360
|
break;
|
|
1357
|
-
case
|
|
1361
|
+
case j.R9_16:
|
|
1358
1362
|
s = this._calculateSrcRectByRatio(t, r, o, i, 9, 16);
|
|
1359
1363
|
break;
|
|
1360
|
-
case
|
|
1364
|
+
case j.R5_4:
|
|
1361
1365
|
s = this._calculateSrcRectByRatio(t, r, o, i, 5, 4);
|
|
1362
1366
|
break;
|
|
1363
|
-
case
|
|
1367
|
+
case j.R4_5:
|
|
1364
1368
|
s = this._calculateSrcRectByRatio(t, r, o, i, 4, 5);
|
|
1365
1369
|
break;
|
|
1366
|
-
case
|
|
1370
|
+
case j.R4_3:
|
|
1367
1371
|
s = this._calculateSrcRectByRatio(t, r, o, i, 4, 3);
|
|
1368
1372
|
break;
|
|
1369
|
-
case
|
|
1373
|
+
case j.R3_4:
|
|
1370
1374
|
s = this._calculateSrcRectByRatio(t, r, o, i, 3, 4);
|
|
1371
1375
|
break;
|
|
1372
|
-
case
|
|
1376
|
+
case j.R3_2:
|
|
1373
1377
|
s = this._calculateSrcRectByRatio(t, r, o, i, 3, 2);
|
|
1374
1378
|
break;
|
|
1375
|
-
case
|
|
1379
|
+
case j.R2_3:
|
|
1376
1380
|
s = this._calculateSrcRectByRatio(t, r, o, i, 2, 3);
|
|
1377
1381
|
break;
|
|
1378
|
-
case
|
|
1382
|
+
case j.FREE:
|
|
1379
1383
|
}
|
|
1380
1384
|
if (s == null)
|
|
1381
1385
|
return;
|
|
@@ -1391,7 +1395,7 @@ let Oe = class extends je {
|
|
|
1391
1395
|
_initOpenCrop() {
|
|
1392
1396
|
this.disposeWithMe(
|
|
1393
1397
|
this._commandService.onCommandExecuted((n) => {
|
|
1394
|
-
if (n.id !==
|
|
1398
|
+
if (n.id !== ke.id)
|
|
1395
1399
|
return;
|
|
1396
1400
|
const e = n.params;
|
|
1397
1401
|
if (e == null)
|
|
@@ -1401,12 +1405,12 @@ let Oe = class extends je {
|
|
|
1401
1405
|
return !0;
|
|
1402
1406
|
if (this._sceneListenerOnImageMap.has(s) || (this._addListenerOnImage(s), this._sceneListenerOnImageMap.add(s)), this._drawingManagerService.getDrawingByParam({ unitId: t, subUnitId: r, drawingId: o }) == null)
|
|
1403
1407
|
return;
|
|
1404
|
-
const g =
|
|
1408
|
+
const g = G({ unitId: t, subUnitId: r, drawingId: o }), u = s.getObject(g);
|
|
1405
1409
|
if (u == null)
|
|
1406
1410
|
return;
|
|
1407
1411
|
if (!(u instanceof We)) {
|
|
1408
1412
|
this._messageService.show({
|
|
1409
|
-
type:
|
|
1413
|
+
type: qe.Error,
|
|
1410
1414
|
content: this._localeService.t("image-cropper.error")
|
|
1411
1415
|
});
|
|
1412
1416
|
return;
|
|
@@ -1430,41 +1434,48 @@ let Oe = class extends je {
|
|
|
1430
1434
|
}
|
|
1431
1435
|
_initCloseCrop() {
|
|
1432
1436
|
this.disposeWithMe(
|
|
1433
|
-
this._commandService.onCommandExecuted((
|
|
1434
|
-
if (
|
|
1437
|
+
this._commandService.onCommandExecuted((e) => {
|
|
1438
|
+
if (e.id !== oe.id)
|
|
1435
1439
|
return;
|
|
1436
|
-
const
|
|
1437
|
-
if (
|
|
1440
|
+
const t = this._univerInstanceService.getFocusedUnit();
|
|
1441
|
+
if (t == null)
|
|
1438
1442
|
return;
|
|
1439
|
-
const
|
|
1440
|
-
if (o == null)
|
|
1441
|
-
return !0;
|
|
1442
|
-
const i = this._searchCropObject(o);
|
|
1443
|
+
const r = t.getUnitId(), o = this._renderManagerService.getRenderById(r), i = o == null ? void 0 : o.scene;
|
|
1443
1444
|
if (i == null)
|
|
1444
|
-
return;
|
|
1445
|
-
const s = this.
|
|
1445
|
+
return !0;
|
|
1446
|
+
const s = this._searchCropObject(i);
|
|
1446
1447
|
if (s == null)
|
|
1447
1448
|
return;
|
|
1448
|
-
const l =
|
|
1449
|
-
l
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1449
|
+
const l = this._getApplyObjectByCropObject(s);
|
|
1450
|
+
if (l == null)
|
|
1451
|
+
return;
|
|
1452
|
+
const g = i.getTransformerByCreate();
|
|
1453
|
+
g.detachFrom(s), g.clearCopperControl();
|
|
1454
|
+
const u = this._getSrcRectByTransformState(l, s), d = this._drawingManagerService.getDrawingOKey(l.oKey);
|
|
1455
|
+
if (d != null) {
|
|
1456
|
+
const { left: h, top: f, height: v, width: w } = s;
|
|
1453
1457
|
this._drawingManagerService.featurePluginUpdateNotification([{
|
|
1454
|
-
...
|
|
1458
|
+
...d,
|
|
1455
1459
|
transform: {
|
|
1456
|
-
...
|
|
1457
|
-
left:
|
|
1458
|
-
top:
|
|
1459
|
-
height:
|
|
1460
|
-
width:
|
|
1460
|
+
...d.transform,
|
|
1461
|
+
left: h,
|
|
1462
|
+
top: f,
|
|
1463
|
+
height: v,
|
|
1464
|
+
width: w
|
|
1461
1465
|
},
|
|
1462
|
-
srcRect:
|
|
1466
|
+
srcRect: u.srcRectAngle
|
|
1463
1467
|
}]);
|
|
1464
1468
|
}
|
|
1465
|
-
|
|
1469
|
+
l.setSrcRect({ ...u.srcRectAngle }), l.closeRenderByCropper(), l.makeDirty(!0), s == null || s.dispose();
|
|
1466
1470
|
})
|
|
1467
1471
|
);
|
|
1472
|
+
const n = this._univerInstanceService.getCurrentTypeOfUnit$(Re.UNIVER_SHEET).pipe(
|
|
1473
|
+
kt((e) => !!e),
|
|
1474
|
+
zt((e) => e.activeSheet$)
|
|
1475
|
+
);
|
|
1476
|
+
this.disposeWithMe(n.subscribe(() => {
|
|
1477
|
+
this._commandService.syncExecuteCommand(oe.id);
|
|
1478
|
+
}));
|
|
1468
1479
|
}
|
|
1469
1480
|
_getApplyObjectByCropObject(n) {
|
|
1470
1481
|
const e = n.oKey, t = e.slice(0, e.length - 5), r = n.getScene().getObject(t);
|
|
@@ -1487,7 +1498,7 @@ let Oe = class extends je {
|
|
|
1487
1498
|
if (i == null || !(i instanceof Ee))
|
|
1488
1499
|
return;
|
|
1489
1500
|
const { left: s, top: l, height: g, width: u, angle: d } = i;
|
|
1490
|
-
if (!
|
|
1501
|
+
if (!at({ left: s, top: l, height: g, width: u, angle: d }, t))
|
|
1491
1502
|
return;
|
|
1492
1503
|
const h = this._getApplyObjectByCropObject(i);
|
|
1493
1504
|
if (h == null)
|
|
@@ -1500,11 +1511,11 @@ let Oe = class extends je {
|
|
|
1500
1511
|
_addHoverForImageCopper(n) {
|
|
1501
1512
|
this.disposeWithMe(
|
|
1502
1513
|
n.onPointerEnter$.subscribeEvent(() => {
|
|
1503
|
-
n.cursor =
|
|
1514
|
+
n.cursor = Te.MOVE;
|
|
1504
1515
|
})
|
|
1505
1516
|
), this.disposeWithMe(
|
|
1506
1517
|
n.onPointerLeave$.subscribeEvent(() => {
|
|
1507
|
-
n.cursor =
|
|
1518
|
+
n.cursor = Te.DEFAULT;
|
|
1508
1519
|
})
|
|
1509
1520
|
);
|
|
1510
1521
|
}
|
|
@@ -1512,7 +1523,7 @@ let Oe = class extends je {
|
|
|
1512
1523
|
const e = n.getTransformerByCreate();
|
|
1513
1524
|
this.disposeWithMe(
|
|
1514
1525
|
e.clearControl$.subscribe((t) => {
|
|
1515
|
-
t === !0 && this._commandService.syncExecuteCommand(
|
|
1526
|
+
t === !0 && this._commandService.syncExecuteCommand(oe.id);
|
|
1516
1527
|
})
|
|
1517
1528
|
);
|
|
1518
1529
|
}
|
|
@@ -1524,12 +1535,12 @@ let Oe = class extends je {
|
|
|
1524
1535
|
bottom: h - p - o
|
|
1525
1536
|
}, _ = { ...E };
|
|
1526
1537
|
if (f !== 0) {
|
|
1527
|
-
const M = t + i / 2, S = r + o / 2, R = new
|
|
1528
|
-
P.rotateByPoint(
|
|
1538
|
+
const M = t + i / 2, S = r + o / 2, R = new xe(M, S), b = d / 2 + g, y = h / 2 + u, I = new xe(b, y), P = new xe(g, u);
|
|
1539
|
+
P.rotateByPoint(Je(f), I);
|
|
1529
1540
|
const N = P.clone();
|
|
1530
|
-
N.rotateByPoint(
|
|
1531
|
-
const
|
|
1532
|
-
_.left =
|
|
1541
|
+
N.rotateByPoint(Je(-f), R);
|
|
1542
|
+
const B = t - N.x, D = r - N.y;
|
|
1543
|
+
_.left = B, _.top = D, _.right = d - B - i, _.bottom = h - D - o;
|
|
1533
1544
|
}
|
|
1534
1545
|
return {
|
|
1535
1546
|
srcRect: E,
|
|
@@ -1537,22 +1548,22 @@ let Oe = class extends je {
|
|
|
1537
1548
|
};
|
|
1538
1549
|
}
|
|
1539
1550
|
};
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
],
|
|
1549
|
-
var
|
|
1550
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1551
|
+
Ne = Kn([
|
|
1552
|
+
He(Le.Rendered, Ne),
|
|
1553
|
+
me(0, ce),
|
|
1554
|
+
me(1, ne),
|
|
1555
|
+
me(2, ge),
|
|
1556
|
+
me(3, Fe),
|
|
1557
|
+
me(4, Wt),
|
|
1558
|
+
me(5, se(Z))
|
|
1559
|
+
], Ne);
|
|
1560
|
+
var Zn = Object.defineProperty, Yn = Object.getOwnPropertyDescriptor, Xn = (a, n, e, t) => {
|
|
1561
|
+
for (var r = t > 1 ? void 0 : t ? Yn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1551
1562
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1552
|
-
return t && r &&
|
|
1563
|
+
return t && r && Zn(n, e, r), r;
|
|
1553
1564
|
}, ae = (a, n) => (e, t) => n(e, t, a);
|
|
1554
|
-
const
|
|
1555
|
-
let
|
|
1565
|
+
const et = 50;
|
|
1566
|
+
let De = class extends Ue {
|
|
1556
1567
|
constructor(a, n, e, t, r, o, i) {
|
|
1557
1568
|
super(), this._commandService = a, this._renderManagerService = n, this._drawingManagerService = e, this._dialogService = t, this._imageIoService = r, this._currentUniverService = o, this._drawingRenderService = i, this._initialize();
|
|
1558
1569
|
}
|
|
@@ -1563,7 +1574,7 @@ let Ne = class extends je {
|
|
|
1563
1574
|
this._recoveryImages(), this._drawingAddListener(), this._commandExecutedListener(), this._imageUpdateListener();
|
|
1564
1575
|
}
|
|
1565
1576
|
_recoveryImages() {
|
|
1566
|
-
const a = this._drawingManagerService.drawingManagerData, n =
|
|
1577
|
+
const a = this._drawingManagerService.drawingManagerData, n = $e(this._currentUniverService);
|
|
1567
1578
|
if (n == null)
|
|
1568
1579
|
return;
|
|
1569
1580
|
const { unitId: e, subUnitId: t } = n;
|
|
@@ -1579,7 +1590,7 @@ let Ne = class extends je {
|
|
|
1579
1590
|
_commandExecutedListener() {
|
|
1580
1591
|
this.disposeWithMe(
|
|
1581
1592
|
this._commandService.onCommandExecuted((a) => {
|
|
1582
|
-
if (a.id ===
|
|
1593
|
+
if (a.id === vt.id) {
|
|
1583
1594
|
const n = a.params;
|
|
1584
1595
|
if (n == null)
|
|
1585
1596
|
return;
|
|
@@ -1603,7 +1614,7 @@ let Ne = class extends je {
|
|
|
1603
1614
|
const { unitId: r, subUnitId: o, drawingId: i } = t, s = this._getSceneAndTransformerByDrawingSearch(r);
|
|
1604
1615
|
if (s == null)
|
|
1605
1616
|
return;
|
|
1606
|
-
const { scene: l, transformer: g } = s, u =
|
|
1617
|
+
const { scene: l, transformer: g } = s, u = G({ unitId: r, subUnitId: o, drawingId: i }), d = l.getObject(u);
|
|
1607
1618
|
if (d == null)
|
|
1608
1619
|
return !0;
|
|
1609
1620
|
const h = this._drawingManagerService.getDrawingByParam(t);
|
|
@@ -1637,14 +1648,15 @@ let Ne = class extends je {
|
|
|
1637
1648
|
}
|
|
1638
1649
|
_insertImages(a) {
|
|
1639
1650
|
a.forEach(async (n) => {
|
|
1640
|
-
|
|
1641
|
-
|
|
1651
|
+
var g;
|
|
1652
|
+
const { unitId: e, subUnitId: t, drawingId: r } = n, o = this._getSceneAndTransformerByDrawingSearch(e), i = (g = $e(this._currentUniverService)) == null ? void 0 : g.subUnitId;
|
|
1653
|
+
if (o == null || i !== t)
|
|
1642
1654
|
return;
|
|
1643
|
-
const
|
|
1644
|
-
if (
|
|
1655
|
+
const s = this._drawingManagerService.getDrawingByParam(n);
|
|
1656
|
+
if (s == null)
|
|
1645
1657
|
return;
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1658
|
+
const l = await this._drawingRenderService.renderImage(s, o.scene);
|
|
1659
|
+
l && (this._addHoverForImage(l), this._addDialogForImage(l));
|
|
1648
1660
|
});
|
|
1649
1661
|
}
|
|
1650
1662
|
_imageUpdateListener() {
|
|
@@ -1663,7 +1675,7 @@ let Ne = class extends je {
|
|
|
1663
1675
|
const { scene: f, transformer: v } = h;
|
|
1664
1676
|
if (i == null)
|
|
1665
1677
|
return !0;
|
|
1666
|
-
const w =
|
|
1678
|
+
const w = G({ unitId: e, subUnitId: t, drawingId: r }), p = f.getObject(w);
|
|
1667
1679
|
if (p == null)
|
|
1668
1680
|
return !0;
|
|
1669
1681
|
p.setSrcRect(l), p.setPrstGeom(g);
|
|
@@ -1675,13 +1687,13 @@ let Ne = class extends je {
|
|
|
1675
1687
|
this.disposeWithMe(
|
|
1676
1688
|
Ce(
|
|
1677
1689
|
a.onPointerEnter$.subscribeEvent(() => {
|
|
1678
|
-
a.cursor =
|
|
1690
|
+
a.cursor = Te.GRAB;
|
|
1679
1691
|
})
|
|
1680
1692
|
)
|
|
1681
1693
|
), this.disposeWithMe(
|
|
1682
1694
|
Ce(
|
|
1683
1695
|
a.onPointerLeave$.subscribeEvent(() => {
|
|
1684
|
-
a.cursor =
|
|
1696
|
+
a.cursor = Te.DEFAULT;
|
|
1685
1697
|
})
|
|
1686
1698
|
)
|
|
1687
1699
|
);
|
|
@@ -1691,13 +1703,13 @@ let Ne = class extends je {
|
|
|
1691
1703
|
Ce(
|
|
1692
1704
|
a.onDblclick$.subscribeEvent(() => {
|
|
1693
1705
|
var s;
|
|
1694
|
-
const n = `${a.oKey}-viewer-dialog`, e = a.getNativeSize(), t = window.innerWidth -
|
|
1706
|
+
const n = `${a.oKey}-viewer-dialog`, e = a.getNativeSize(), t = window.innerWidth - et, r = window.innerHeight - et, o = this._adjustImageSize(e.width, e.height, t, r), i = this._dialogService.open({
|
|
1695
1707
|
width: o.width,
|
|
1696
1708
|
id: n,
|
|
1697
1709
|
style: { margin: "0", top: "50%", left: "50%", transform: "translate(-50%, -50%)" },
|
|
1698
1710
|
children: {
|
|
1699
1711
|
label: {
|
|
1700
|
-
name:
|
|
1712
|
+
name: wt,
|
|
1701
1713
|
props: {
|
|
1702
1714
|
src: (s = a.getNative()) == null ? void 0 : s.src,
|
|
1703
1715
|
width: o.width,
|
|
@@ -1728,24 +1740,24 @@ let Ne = class extends je {
|
|
|
1728
1740
|
};
|
|
1729
1741
|
}
|
|
1730
1742
|
};
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
ae(0,
|
|
1743
|
+
De = Xn([
|
|
1744
|
+
He(Le.Rendered, De),
|
|
1745
|
+
ae(0, ce),
|
|
1734
1746
|
ae(1, ge),
|
|
1735
1747
|
ae(2, ne),
|
|
1736
1748
|
ae(3, $t),
|
|
1737
|
-
ae(4,
|
|
1738
|
-
ae(5,
|
|
1739
|
-
ae(6,
|
|
1740
|
-
],
|
|
1741
|
-
var
|
|
1742
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1749
|
+
ae(4, rt),
|
|
1750
|
+
ae(5, Fe),
|
|
1751
|
+
ae(6, se(Be))
|
|
1752
|
+
], De);
|
|
1753
|
+
var Jn = Object.defineProperty, qn = Object.getOwnPropertyDescriptor, Qn = (a, n, e, t) => {
|
|
1754
|
+
for (var r = t > 1 ? void 0 : t ? qn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1743
1755
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1744
|
-
return t && r &&
|
|
1745
|
-
},
|
|
1746
|
-
const
|
|
1756
|
+
return t && r && Jn(n, e, r), r;
|
|
1757
|
+
}, tt = (a, n) => (e, t) => n(e, t, a);
|
|
1758
|
+
const er = "DRAWING_UI_PLUGIN";
|
|
1747
1759
|
var Ge;
|
|
1748
|
-
let
|
|
1760
|
+
let nt = (Ge = class extends Lt {
|
|
1749
1761
|
constructor(a, n, e) {
|
|
1750
1762
|
super(), this._injector = n, this._localeService = e;
|
|
1751
1763
|
}
|
|
@@ -1755,28 +1767,30 @@ let tt = (Ge = class extends Lt {
|
|
|
1755
1767
|
_initDependencies(a) {
|
|
1756
1768
|
[
|
|
1757
1769
|
// services
|
|
1758
|
-
[
|
|
1770
|
+
[Be],
|
|
1759
1771
|
// controllers
|
|
1760
|
-
[Re],
|
|
1761
1772
|
[Me],
|
|
1762
1773
|
[Oe],
|
|
1763
|
-
[Ne]
|
|
1774
|
+
[Ne],
|
|
1775
|
+
[De]
|
|
1764
1776
|
].forEach((e) => a.add(e));
|
|
1765
1777
|
}
|
|
1766
|
-
}, Q(Ge, "pluginName",
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
],
|
|
1778
|
+
}, Q(Ge, "pluginName", er), Ge);
|
|
1779
|
+
nt = Qn([
|
|
1780
|
+
tt(1, se(st)),
|
|
1781
|
+
tt(2, se(Z))
|
|
1782
|
+
], nt);
|
|
1771
1783
|
export {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1784
|
+
je as AutoImageCropOperation,
|
|
1785
|
+
Ln as COMPONENT_IMAGE_POPUP_MENU,
|
|
1786
|
+
oe as CloseImageCropOperation,
|
|
1787
|
+
ur as DrawingCommonPanel,
|
|
1788
|
+
Be as DrawingRenderService,
|
|
1776
1789
|
Ee as ImageCropperObject,
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1790
|
+
Hn as ImagePopupMenu,
|
|
1791
|
+
vt as ImageResetSizeOperation,
|
|
1792
|
+
ke as OpenImageCropOperation,
|
|
1793
|
+
Ke as SetDrawingAlignOperation,
|
|
1794
|
+
nt as UniverDrawingUIPlugin,
|
|
1795
|
+
Ae as getUpdateParams
|
|
1782
1796
|
};
|