@univerjs/drawing-ui 0.2.2 → 0.2.4-alpha.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/README.md +16 -5
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +95 -85
- package/lib/index.css +1 -1
- package/lib/locale/vi-VN.json +54 -0
- package/lib/locale/zh-TW.json +54 -0
- package/lib/types/controllers/drawing-ui.controller.d.ts +1 -2
- package/lib/types/locale/vi-VN.d.ts +4 -0
- package/lib/types/locale/zh-TW.d.ts +4 -0
- package/lib/types/plugin.d.ts +1 -2
- package/lib/umd/index.js +1 -1
- package/package.json +15 -17
package/lib/es/index.js
CHANGED
|
@@ -3,12 +3,10 @@ var Ot = (a, n, e) => n in a ? Mt(a, n, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var Q = (a, n, e) => Ot(a, typeof n != "symbol" ? n + "" : n, e);
|
|
4
4
|
import { getDrawingShapeKeyByDrawingSearch as G, DrawingTypeEnum as te, ImageSourceType as Nt, IDrawingManagerService as ne, IImageIoService as rt, ArrangeTypeEnum as Se } from "@univerjs/drawing";
|
|
5
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 {
|
|
8
|
-
import
|
|
9
|
-
import { Button as ie, InputNumber as de, Checkbox as At, Select as ot, Dropdown as Vt, MessageType as qe } from "@univerjs/design";
|
|
6
|
+
import { UniverInstanceType as Re, useDependency as x, 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, Inject as se, Injector as it, Plugin as Lt } from "@univerjs/core";
|
|
7
|
+
import c, { forwardRef as Y, useRef as ot, createElement as X, useState as L, useEffect as ve } from "react";
|
|
8
|
+
import { Button as ie, InputNumber as de, Checkbox as At, Select as st, Dropdown as Vt, MessageType as qe } from "@univerjs/design";
|
|
10
9
|
import T from "clsx";
|
|
11
|
-
import { Inject as se, Injector as st } from "@wendellhu/redi";
|
|
12
10
|
import { ComponentManager as xt, IMenuService as Gt, IMessageService as Wt, IDialogService as $t } from "@univerjs/ui";
|
|
13
11
|
import { filter as kt, switchMap as zt } from "rxjs";
|
|
14
12
|
function Ft(a, n, e, t) {
|
|
@@ -134,7 +132,7 @@ var $ = function() {
|
|
|
134
132
|
n.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(a, t[r]) && (e[t[r]] = a[t[r]]);
|
|
135
133
|
return e;
|
|
136
134
|
}, 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 =
|
|
135
|
+
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 = ot("_".concat(Qt()));
|
|
138
136
|
return ct(e, "".concat(t), { defIds: e.defIds, idSuffix: l.current }, $({ ref: n, className: s }, i), o);
|
|
139
137
|
});
|
|
140
138
|
function ct(a, n, e, t, r) {
|
|
@@ -233,20 +231,21 @@ var ln = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em"
|
|
|
233
231
|
}));
|
|
234
232
|
});
|
|
235
233
|
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-
|
|
234
|
+
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-subtitle", fn = "univer-image-common-panel-row", pn = "univer-image-common-panel-row-vertical", Cn = "univer-image-common-panel-column", wn = "univer-image-common-panel-column-center", vn = "univer-image-common-panel-inline", _n = "univer-image-common-panel-span2", Sn = "univer-image-common-panel-span3", bn = "univer-image-common-panel-input", m = {
|
|
237
235
|
imageCommonPanel: mn,
|
|
238
236
|
imageCommonPanelGrid: gn,
|
|
239
237
|
imageCommonPanelBorder: un,
|
|
240
238
|
imageCommonPanelTitle: dn,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
239
|
+
imageCommonPanelSubtitle: hn,
|
|
240
|
+
imageCommonPanelRow: fn,
|
|
241
|
+
imageCommonPanelRowVertical: pn,
|
|
242
|
+
imageCommonPanelColumn: Cn,
|
|
243
|
+
imageCommonPanelColumnCenter: wn,
|
|
244
|
+
imageCommonPanelInline: vn,
|
|
245
|
+
imageCommonPanelSpan2: _n,
|
|
246
|
+
imageCommonPanelSpan3: Sn,
|
|
247
|
+
imageCommonPanelInput: bn
|
|
248
|
+
}, In = (a) => {
|
|
250
249
|
const { arrangeShow: n, drawings: e } = a, t = x(Z), r = x(ne), o = (g) => g ? "block" : "none", [i, s] = L(e);
|
|
251
250
|
ve(() => {
|
|
252
251
|
const g = r.focus$.subscribe((u) => {
|
|
@@ -269,7 +268,7 @@ const mn = "univer-image-common-panel", gn = "univer-image-common-panel-grid", u
|
|
|
269
268
|
} }, /* @__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: () => {
|
|
270
269
|
l(Se.back);
|
|
271
270
|
} }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(mt, null), t.t("image-panel.arrange.back"))))));
|
|
272
|
-
}, re = 20,
|
|
271
|
+
}, re = 20, Pn = 20, yn = [-3600, 3600], Pe = 300, En = (a) => {
|
|
273
272
|
var Ye;
|
|
274
273
|
const n = x(Z), e = x(ne), t = x(ge), { drawings: r, transformShow: o } = a, i = r[0];
|
|
275
274
|
if (i == null)
|
|
@@ -305,7 +304,7 @@ const mn = "univer-image-common-panel", gn = "univer-image-common-panel-grid", u
|
|
|
305
304
|
const H = V[0];
|
|
306
305
|
if (H == null)
|
|
307
306
|
return;
|
|
308
|
-
const U = H
|
|
307
|
+
const { transform: U } = H;
|
|
309
308
|
if (U == null)
|
|
310
309
|
return;
|
|
311
310
|
const {
|
|
@@ -353,7 +352,7 @@ const mn = "univer-image-common-panel", gn = "univer-image-common-panel-grid", u
|
|
|
353
352
|
const H = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { width: C } };
|
|
354
353
|
if (Ve) {
|
|
355
354
|
let U = C / R * y;
|
|
356
|
-
if (U = Math.max(U,
|
|
355
|
+
if (U = Math.max(U, Pn), U > V)
|
|
357
356
|
return;
|
|
358
357
|
I(U), H.transform.height = U;
|
|
359
358
|
}
|
|
@@ -389,7 +388,7 @@ const mn = "univer-image-common-panel", gn = "univer-image-common-panel-grid", u
|
|
|
389
388
|
}, Pe), yt = (C) => {
|
|
390
389
|
if (C == null)
|
|
391
390
|
return;
|
|
392
|
-
const [A, V] =
|
|
391
|
+
const [A, V] = yn;
|
|
393
392
|
C < A && (C = A), C > V && (C = V);
|
|
394
393
|
const H = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { angle: C } };
|
|
395
394
|
W(C), e.featurePluginUpdateNotification([H]), w.refreshControls().changeNotification();
|
|
@@ -411,7 +410,7 @@ const Ke = {
|
|
|
411
410
|
id: "sheet.operation.set-image-align",
|
|
412
411
|
type: we.OPERATION,
|
|
413
412
|
handler: (a, n) => !0
|
|
414
|
-
},
|
|
413
|
+
}, Rn = (a) => {
|
|
415
414
|
const n = x(ce), e = x(Z), { alignShow: t } = a, [r, o] = L(O.default), i = [
|
|
416
415
|
{
|
|
417
416
|
label: e.t("image-panel.align.default"),
|
|
@@ -468,7 +467,7 @@ const Ke = {
|
|
|
468
467
|
});
|
|
469
468
|
}
|
|
470
469
|
const l = (g) => g ? "block" : "none";
|
|
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(
|
|
470
|
+
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(st, { value: r, options: i, onChange: s }))));
|
|
472
471
|
}, ke = {
|
|
473
472
|
id: "sheet.operation.open-image-crop",
|
|
474
473
|
type: we.OPERATION,
|
|
@@ -483,11 +482,11 @@ const je = {
|
|
|
483
482
|
id: "sheet.operation.Auto-image-crop",
|
|
484
483
|
type: we.OPERATION,
|
|
485
484
|
handler: (a, n) => !0
|
|
486
|
-
},
|
|
485
|
+
}, Mn = (a) => {
|
|
487
486
|
const n = x(ce), e = x(Z), { drawings: t, cropperShow: r } = a;
|
|
488
487
|
if (t[0] == null)
|
|
489
488
|
return;
|
|
490
|
-
const [i, s] = L(j.FREE), l =
|
|
489
|
+
const [i, s] = L(j.FREE), l = ot(!1), g = [
|
|
491
490
|
{
|
|
492
491
|
label: e.t("image-panel.crop.mode"),
|
|
493
492
|
value: j.FREE
|
|
@@ -552,8 +551,8 @@ const je = {
|
|
|
552
551
|
};
|
|
553
552
|
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
553
|
h(i);
|
|
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(
|
|
556
|
-
},
|
|
554
|
+
} }, /* @__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(st, { value: i, options: g, onChange: u }))));
|
|
555
|
+
}, On = (a) => {
|
|
557
556
|
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
557
|
const p = t.getFocusDrawings(), { unitId: E, subUnitId: _ } = p[0], M = Ht.generateRandomId(10), S = Dt(0, 0, p.map((y) => y.transform || {})), R = {
|
|
559
558
|
unitId: E,
|
|
@@ -633,7 +632,7 @@ const je = {
|
|
|
633
632
|
}, 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
633
|
w();
|
|
635
634
|
}, style: { display: h(u) } }, /* @__PURE__ */ c.createElement("span", { className: m.imageCommonPanelInline }, /* @__PURE__ */ c.createElement(Ct, null), n.t("image-panel.group.unGroup"))))));
|
|
636
|
-
},
|
|
635
|
+
}, gr = (a) => {
|
|
637
636
|
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
637
|
if (u == null)
|
|
639
638
|
return;
|
|
@@ -653,16 +652,16 @@ const je = {
|
|
|
653
652
|
return () => {
|
|
654
653
|
N.unsubscribe(), P.unsubscribe(), B.unsubscribe();
|
|
655
654
|
};
|
|
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
|
-
},
|
|
655
|
+
}, []), /* @__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(In, { arrangeShow: o === !0 ? w : !1, drawings: r }), /* @__PURE__ */ c.createElement(En, { transformShow: i === !0 ? E : !1, drawings: r }), /* @__PURE__ */ c.createElement(Rn, { alignShow: s === !0 ? M : !1, drawings: r }), /* @__PURE__ */ c.createElement(Mn, { cropperShow: l === !0 ? R : !1, drawings: r }), /* @__PURE__ */ c.createElement(On, { hasGroup: g, drawings: r }));
|
|
656
|
+
}, Nn = "univer-image-popup-menu", Dn = "univer-image-popup-menu-item", Tn = "univer-image-popup-menu-item-icon", Bn = "univer-image-popup-menu-item-title", jn = "univer-image-popup-menu-item-hide", Un = "univer-btn-container", Hn = "univer-btn-container-expand", he = {
|
|
657
|
+
imagePopupMenu: Nn,
|
|
658
|
+
imagePopupMenuItem: Dn,
|
|
659
|
+
imagePopupMenuItemIcon: Tn,
|
|
660
|
+
imagePopupMenuItemTitle: Bn,
|
|
661
|
+
imagePopupMenuItemHide: jn,
|
|
662
|
+
btnContainer: Un,
|
|
663
|
+
btnContainerExpand: Hn
|
|
664
|
+
}, Ln = (a) => {
|
|
666
665
|
var v, w;
|
|
667
666
|
const n = (w = (v = a.popup) == null ? void 0 : v.extraProps) == null ? void 0 : w.menuItems;
|
|
668
667
|
if (!n)
|
|
@@ -717,11 +716,11 @@ const je = {
|
|
|
717
716
|
)
|
|
718
717
|
)
|
|
719
718
|
);
|
|
720
|
-
},
|
|
721
|
-
var
|
|
722
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
719
|
+
}, An = "COMPONENT_IMAGE_POPUP_MENU";
|
|
720
|
+
var Vn = Object.defineProperty, xn = Object.getOwnPropertyDescriptor, Gn = (a, n, e, t) => {
|
|
721
|
+
for (var r = t > 1 ? void 0 : t ? xn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
723
722
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
724
|
-
return t && r &&
|
|
723
|
+
return t && r && Vn(n, e, r), r;
|
|
725
724
|
}, ye = (a, n) => (e, t) => n(e, t, a);
|
|
726
725
|
let Me = class extends Ue {
|
|
727
726
|
constructor(n, e, t, r) {
|
|
@@ -1069,15 +1068,26 @@ let Me = class extends Ue {
|
|
|
1069
1068
|
const { unitId: t, subUnitId: r, drawingId: o } = e, i = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1070
1069
|
if (i == null)
|
|
1071
1070
|
return;
|
|
1072
|
-
const { scene: s, transformer: l } = i, g = G({ unitId: t, subUnitId: r, drawingId: o }), u = s.getObject(g)
|
|
1071
|
+
const { scene: s, transformer: l } = i, g = G({ unitId: t, subUnitId: r, drawingId: o }), u = s.getObject(g);
|
|
1072
|
+
if (u == null)
|
|
1073
|
+
return !0;
|
|
1074
|
+
const d = this._drawingManagerService.getDrawingByParam(e);
|
|
1073
1075
|
if (d == null)
|
|
1074
1076
|
return;
|
|
1075
1077
|
const { transform: h } = d;
|
|
1076
1078
|
if (h == null)
|
|
1077
1079
|
return !0;
|
|
1078
|
-
const {
|
|
1079
|
-
|
|
1080
|
-
|
|
1080
|
+
const {
|
|
1081
|
+
left: f = 0,
|
|
1082
|
+
top: v = 0,
|
|
1083
|
+
width: w = 0,
|
|
1084
|
+
height: p = 0,
|
|
1085
|
+
angle: E = 0,
|
|
1086
|
+
flipX: _ = !1,
|
|
1087
|
+
flipY: M = !1,
|
|
1088
|
+
skewX: S = 0,
|
|
1089
|
+
skewY: R = 0
|
|
1090
|
+
} = h;
|
|
1081
1091
|
u.transformByState({ left: f, top: v, width: w, height: p, angle: E, flipX: _, flipY: M, skewX: S, skewY: R });
|
|
1082
1092
|
});
|
|
1083
1093
|
})
|
|
@@ -1144,21 +1154,21 @@ let Me = class extends Ue {
|
|
|
1144
1154
|
), this.disposeWithMe(
|
|
1145
1155
|
Ce(
|
|
1146
1156
|
e.changeEnd$.subscribe((r) => {
|
|
1147
|
-
const { objects: o } = r
|
|
1148
|
-
|
|
1157
|
+
const { objects: o } = r;
|
|
1158
|
+
this._filterUpdateParams(Ae(o, this._drawingManagerService), t).length > 0;
|
|
1149
1159
|
})
|
|
1150
1160
|
)
|
|
1151
1161
|
);
|
|
1152
1162
|
}
|
|
1153
1163
|
};
|
|
1154
|
-
Me =
|
|
1164
|
+
Me = Gn([
|
|
1155
1165
|
He(Le.Rendered, Me),
|
|
1156
1166
|
ye(0, Fe),
|
|
1157
1167
|
ye(1, ce),
|
|
1158
1168
|
ye(2, ge),
|
|
1159
1169
|
ye(3, ne)
|
|
1160
1170
|
], Me);
|
|
1161
|
-
const
|
|
1171
|
+
const Wn = (a) => {
|
|
1162
1172
|
const { src: n } = a;
|
|
1163
1173
|
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
1174
|
}, wt = "COMPONENT_IMAGE_VIEWER", vt = {
|
|
@@ -1166,10 +1176,10 @@ const Gn = (a) => {
|
|
|
1166
1176
|
type: we.OPERATION,
|
|
1167
1177
|
handler: (a, n) => !0
|
|
1168
1178
|
};
|
|
1169
|
-
var
|
|
1170
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1179
|
+
var $n = Object.defineProperty, kn = Object.getOwnPropertyDescriptor, zn = (a, n, e, t) => {
|
|
1180
|
+
for (var r = t > 1 ? void 0 : t ? kn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1171
1181
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1172
|
-
return t && r &&
|
|
1182
|
+
return t && r && $n(n, e, r), r;
|
|
1173
1183
|
}, fe = (a, n) => (e, t) => n(e, t, a);
|
|
1174
1184
|
let Oe = class extends Ue {
|
|
1175
1185
|
constructor(a, n, e, t, r) {
|
|
@@ -1177,7 +1187,7 @@ let Oe = class extends Ue {
|
|
|
1177
1187
|
}
|
|
1178
1188
|
_initCustomComponents() {
|
|
1179
1189
|
const a = this._componentManager;
|
|
1180
|
-
this.disposeWithMe(a.register(
|
|
1190
|
+
this.disposeWithMe(a.register(An, Ln)), this.disposeWithMe(a.register(wt, Wn));
|
|
1181
1191
|
}
|
|
1182
1192
|
_initMenus() {
|
|
1183
1193
|
}
|
|
@@ -1194,9 +1204,9 @@ let Oe = class extends Ue {
|
|
|
1194
1204
|
this._initCommands(), this._initCustomComponents(), this._initMenus();
|
|
1195
1205
|
}
|
|
1196
1206
|
};
|
|
1197
|
-
Oe =
|
|
1207
|
+
Oe = zn([
|
|
1198
1208
|
He(Le.Rendered, Oe),
|
|
1199
|
-
fe(0, se(
|
|
1209
|
+
fe(0, se(it)),
|
|
1200
1210
|
fe(1, se(xt)),
|
|
1201
1211
|
fe(2, Gt),
|
|
1202
1212
|
fe(3, ce),
|
|
@@ -1295,10 +1305,10 @@ class Ee extends Bt {
|
|
|
1295
1305
|
});
|
|
1296
1306
|
}
|
|
1297
1307
|
}
|
|
1298
|
-
var
|
|
1299
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1308
|
+
var Fn = Object.defineProperty, Kn = Object.getOwnPropertyDescriptor, Zn = (a, n, e, t) => {
|
|
1309
|
+
for (var r = t > 1 ? void 0 : t ? Kn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1300
1310
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1301
|
-
return t && r &&
|
|
1311
|
+
return t && r && Fn(n, e, r), r;
|
|
1302
1312
|
}, me = (a, n) => (e, t) => n(e, t, a);
|
|
1303
1313
|
let Ne = class extends Ue {
|
|
1304
1314
|
constructor(n, e, t, r, o, i) {
|
|
@@ -1548,7 +1558,7 @@ let Ne = class extends Ue {
|
|
|
1548
1558
|
};
|
|
1549
1559
|
}
|
|
1550
1560
|
};
|
|
1551
|
-
Ne =
|
|
1561
|
+
Ne = Zn([
|
|
1552
1562
|
He(Le.Rendered, Ne),
|
|
1553
1563
|
me(0, ce),
|
|
1554
1564
|
me(1, ne),
|
|
@@ -1557,10 +1567,10 @@ Ne = Kn([
|
|
|
1557
1567
|
me(4, Wt),
|
|
1558
1568
|
me(5, se(Z))
|
|
1559
1569
|
], Ne);
|
|
1560
|
-
var
|
|
1561
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1570
|
+
var Yn = Object.defineProperty, Xn = Object.getOwnPropertyDescriptor, Jn = (a, n, e, t) => {
|
|
1571
|
+
for (var r = t > 1 ? void 0 : t ? Xn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1562
1572
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1563
|
-
return t && r &&
|
|
1573
|
+
return t && r && Yn(n, e, r), r;
|
|
1564
1574
|
}, ae = (a, n) => (e, t) => n(e, t, a);
|
|
1565
1575
|
const et = 50;
|
|
1566
1576
|
let De = class extends Ue {
|
|
@@ -1614,22 +1624,22 @@ let De = class extends Ue {
|
|
|
1614
1624
|
const { unitId: r, subUnitId: o, drawingId: i } = t, s = this._getSceneAndTransformerByDrawingSearch(r);
|
|
1615
1625
|
if (s == null)
|
|
1616
1626
|
return;
|
|
1617
|
-
const { scene: l
|
|
1618
|
-
if (
|
|
1627
|
+
const { scene: l } = s, g = G({ unitId: r, subUnitId: o, drawingId: i }), u = l.getObject(g);
|
|
1628
|
+
if (u == null)
|
|
1619
1629
|
return !0;
|
|
1620
|
-
const
|
|
1621
|
-
if (
|
|
1630
|
+
const d = this._drawingManagerService.getDrawingByParam(t);
|
|
1631
|
+
if (d == null)
|
|
1622
1632
|
return !0;
|
|
1623
|
-
if (
|
|
1633
|
+
if (d.drawingType !== te.DRAWING_IMAGE)
|
|
1624
1634
|
return;
|
|
1625
|
-
|
|
1626
|
-
const { width:
|
|
1635
|
+
u.resetSize();
|
|
1636
|
+
const { width: h, height: f } = u.getNativeSize();
|
|
1627
1637
|
e.includes(l) === !1 && e.push(l), n.push({
|
|
1628
|
-
...
|
|
1638
|
+
...d,
|
|
1629
1639
|
transform: {
|
|
1630
|
-
...
|
|
1631
|
-
height:
|
|
1632
|
-
width:
|
|
1640
|
+
...d.transform,
|
|
1641
|
+
height: f,
|
|
1642
|
+
width: h,
|
|
1633
1643
|
angle: 0
|
|
1634
1644
|
},
|
|
1635
1645
|
srcRect: null,
|
|
@@ -1656,7 +1666,7 @@ let De = class extends Ue {
|
|
|
1656
1666
|
if (s == null)
|
|
1657
1667
|
return;
|
|
1658
1668
|
const l = await this._drawingRenderService.renderImage(s, o.scene);
|
|
1659
|
-
l && (this._addHoverForImage(l), this._addDialogForImage(l));
|
|
1669
|
+
l != null && (this._addHoverForImage(l), this._addDialogForImage(l));
|
|
1660
1670
|
});
|
|
1661
1671
|
}
|
|
1662
1672
|
_imageUpdateListener() {
|
|
@@ -1740,7 +1750,7 @@ let De = class extends Ue {
|
|
|
1740
1750
|
};
|
|
1741
1751
|
}
|
|
1742
1752
|
};
|
|
1743
|
-
De =
|
|
1753
|
+
De = Jn([
|
|
1744
1754
|
He(Le.Rendered, De),
|
|
1745
1755
|
ae(0, ce),
|
|
1746
1756
|
ae(1, ge),
|
|
@@ -1750,12 +1760,12 @@ De = Xn([
|
|
|
1750
1760
|
ae(5, Fe),
|
|
1751
1761
|
ae(6, se(Be))
|
|
1752
1762
|
], De);
|
|
1753
|
-
var
|
|
1754
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1763
|
+
var qn = Object.defineProperty, Qn = Object.getOwnPropertyDescriptor, er = (a, n, e, t) => {
|
|
1764
|
+
for (var r = t > 1 ? void 0 : t ? Qn(n, e) : n, o = a.length - 1, i; o >= 0; o--)
|
|
1755
1765
|
(i = a[o]) && (r = (t ? i(n, e, r) : i(r)) || r);
|
|
1756
|
-
return t && r &&
|
|
1766
|
+
return t && r && qn(n, e, r), r;
|
|
1757
1767
|
}, tt = (a, n) => (e, t) => n(e, t, a);
|
|
1758
|
-
const
|
|
1768
|
+
const tr = "DRAWING_UI_PLUGIN";
|
|
1759
1769
|
var Ge;
|
|
1760
1770
|
let nt = (Ge = class extends Lt {
|
|
1761
1771
|
constructor(a, n, e) {
|
|
@@ -1775,19 +1785,19 @@ let nt = (Ge = class extends Lt {
|
|
|
1775
1785
|
[De]
|
|
1776
1786
|
].forEach((e) => a.add(e));
|
|
1777
1787
|
}
|
|
1778
|
-
}, Q(Ge, "pluginName",
|
|
1779
|
-
nt =
|
|
1780
|
-
tt(1, se(
|
|
1788
|
+
}, Q(Ge, "pluginName", tr), Ge);
|
|
1789
|
+
nt = er([
|
|
1790
|
+
tt(1, se(it)),
|
|
1781
1791
|
tt(2, se(Z))
|
|
1782
1792
|
], nt);
|
|
1783
1793
|
export {
|
|
1784
1794
|
je as AutoImageCropOperation,
|
|
1785
|
-
|
|
1795
|
+
An as COMPONENT_IMAGE_POPUP_MENU,
|
|
1786
1796
|
oe as CloseImageCropOperation,
|
|
1787
|
-
|
|
1797
|
+
gr as DrawingCommonPanel,
|
|
1788
1798
|
Be as DrawingRenderService,
|
|
1789
1799
|
Ee as ImageCropperObject,
|
|
1790
|
-
|
|
1800
|
+
Ln as ImagePopupMenu,
|
|
1791
1801
|
vt as ImageResetSizeOperation,
|
|
1792
1802
|
ke as OpenImageCropOperation,
|
|
1793
1803
|
Ke as SetDrawingAlignOperation,
|
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-image-common-panel{text-align:center;padding:var(--padding-sm);font-size:var(--font-size-sm)}.univer-image-common-panel-grid{position:relative;width:100%}.univer-image-common-panel-border{border-top:1px solid rgb(var(--border-color));margin-top:20px}.univer-image-common-panel-title{color:rgb(var(--text-color-secondary));text-align:left}.univer-image-common-panel-row{position:relative;display:flex;justify-content:flex-start;align-items:flex-start;height:100%;margin-top:10px}.univer-image-common-panel-row-vertical{justify-content:center;align-items:center;height:36px}.univer-image-common-panel-column{width:100%}.univer-image-common-panel-column-center{display:flex;justify-content:center;align-items:center}.univer-image-common-panel-inline{display:flex;align-items:center;gap:var(--margin-xxs)}.univer-image-common-panel-span2{width:50%}.univer-image-common-panel-span3{width:33.33333333%}.univer-image-common-panel-input{width:90%}.univer-image-popup-menu{display:grid;gap:var(--margin-xxs);align-items:center;box-sizing:border-box;margin-top:0;margin-bottom:0;padding:var(--padding-sm);font-size:var(--font-size-base);background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);box-shadow:var(--box-shadow-lg)}.univer-image-popup-menu li{list-style:none}.univer-image-popup-menu-item{cursor:pointer;position:relative;display:flex;align-items:center;box-sizing:border-box;height:28px;font-size:var(--font-size-base);font-style:normal;line-height:20px;text-align:left;border-radius:4px;border-radius:var(--border-radius-base);transition:background .2s}.univer-image-popup-menu-item:hover{background-color:rgb(var(--bg-color-hover))}.univer-image-popup-menu-item-icon{position:absolute;top:50%;left:var(--padding-xs);transform:translateY(-50%);display:flex;align-items:center;justify-content:center}.univer-image-popup-menu-item-title{padding:var(--padding-xs) var(--padding-xs) var(--padding-xs) 0;vertical-align:middle}.univer-image-popup-menu-item-hide{color:rgb(var(--text-color-secondary))}.univer-image-popup-menu-item:hover{background:rgb(var(--grey-100))}.univer-btn-container{display:flex;align-items:center;justify-content:center;padding:3px;background:#fff;border:1px solid rgb(var(--grey-200, #e5e5e5));border-radius:4px}.univer-btn-container:hover,.univer-btn-container.univer-btn-container-expand{background:rgb(var(--grey-100, #f5f5f5))}
|
|
1
|
+
.univer-image-common-panel{text-align:center;padding:var(--padding-sm);font-size:var(--font-size-sm)}.univer-image-common-panel-grid{position:relative;width:100%}.univer-image-common-panel-border{border-top:1px solid rgb(var(--border-color));margin-top:20px}.univer-image-common-panel-title{color:rgb(var(--text-color-secondary));text-align:left}.univer-image-common-panel-subtitle{color:rgb(var(--text-color-primary));text-align:left}.univer-image-common-panel-row{position:relative;display:flex;justify-content:flex-start;align-items:flex-start;height:100%;margin-top:10px}.univer-image-common-panel-row-vertical{justify-content:center;align-items:center;height:36px}.univer-image-common-panel-column{width:100%}.univer-image-common-panel-column-center{display:flex;justify-content:center;align-items:center}.univer-image-common-panel-inline{display:flex;align-items:center;gap:var(--margin-xxs)}.univer-image-common-panel-span2{width:50%}.univer-image-common-panel-span3{width:33.33333333%}.univer-image-common-panel-input{width:90%}.univer-image-popup-menu{display:grid;gap:var(--margin-xxs);align-items:center;box-sizing:border-box;margin-top:0;margin-bottom:0;padding:var(--padding-sm);font-size:var(--font-size-base);background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);box-shadow:var(--box-shadow-lg)}.univer-image-popup-menu li{list-style:none}.univer-image-popup-menu-item{cursor:pointer;position:relative;display:flex;align-items:center;box-sizing:border-box;height:28px;font-size:var(--font-size-base);font-style:normal;line-height:20px;text-align:left;border-radius:4px;border-radius:var(--border-radius-base);transition:background .2s}.univer-image-popup-menu-item:hover{background-color:rgb(var(--bg-color-hover))}.univer-image-popup-menu-item-icon{position:absolute;top:50%;left:var(--padding-xs);transform:translateY(-50%);display:flex;align-items:center;justify-content:center}.univer-image-popup-menu-item-title{padding:var(--padding-xs) var(--padding-xs) var(--padding-xs) 0;vertical-align:middle}.univer-image-popup-menu-item-hide{color:rgb(var(--text-color-secondary))}.univer-image-popup-menu-item:hover{background:rgb(var(--grey-100))}.univer-btn-container{display:flex;align-items:center;justify-content:center;padding:3px;background:#fff;border:1px solid rgb(var(--grey-200, #e5e5e5));border-radius:4px}.univer-btn-container:hover,.univer-btn-container.univer-btn-container-expand{background:rgb(var(--grey-100, #f5f5f5))}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image-popup": {
|
|
3
|
+
"replace": "Thay thế",
|
|
4
|
+
"delete": "Xóa",
|
|
5
|
+
"edit": "Chỉnh sửa",
|
|
6
|
+
"crop": "Cắt",
|
|
7
|
+
"reset": "Đặt lại kích thước"
|
|
8
|
+
},
|
|
9
|
+
"image-cropper": {
|
|
10
|
+
"error": "Không thể cắt phần tử không phải hình ảnh"
|
|
11
|
+
},
|
|
12
|
+
"image-panel": {
|
|
13
|
+
"arrange": {
|
|
14
|
+
"title": "Sắp xếp",
|
|
15
|
+
"forward": "Di chuyển lên một lớp",
|
|
16
|
+
"backward": "Di chuyển xuống một lớp",
|
|
17
|
+
"front": "Đưa lên trên cùng",
|
|
18
|
+
"back": "Đưa xuống dưới cùng"
|
|
19
|
+
},
|
|
20
|
+
"transform": {
|
|
21
|
+
"title": "Biến đổi",
|
|
22
|
+
"rotate": "Xoay (°)",
|
|
23
|
+
"x": "X (px)",
|
|
24
|
+
"y": "Y (px)",
|
|
25
|
+
"width": "Chiều rộng (px)",
|
|
26
|
+
"height": "Chiều cao (px)",
|
|
27
|
+
"lock": "Khóa tỷ lệ (%)"
|
|
28
|
+
},
|
|
29
|
+
"crop": {
|
|
30
|
+
"title": "Cắt",
|
|
31
|
+
"start": "Bắt đầu cắt",
|
|
32
|
+
"mode": "Cắt tự do tỷ lệ"
|
|
33
|
+
},
|
|
34
|
+
"group": {
|
|
35
|
+
"title": "Nhóm",
|
|
36
|
+
"group": "Nhóm",
|
|
37
|
+
"reGroup": "Nhóm lại",
|
|
38
|
+
"unGroup": "Hủy nhóm"
|
|
39
|
+
},
|
|
40
|
+
"align": {
|
|
41
|
+
"title": "Căn chỉnh",
|
|
42
|
+
"default": "Chọn cách căn chỉnh",
|
|
43
|
+
"left": "Căn trái",
|
|
44
|
+
"center": "Căn giữa theo chiều ngang",
|
|
45
|
+
"right": "Căn phải",
|
|
46
|
+
"top": "Căn trên",
|
|
47
|
+
"middle": "Căn giữa theo chiều dọc",
|
|
48
|
+
"bottom": "Căn dưới",
|
|
49
|
+
"horizon": "Phân phối theo chiều ngang",
|
|
50
|
+
"vertical": "Phân phối theo chiều dọc"
|
|
51
|
+
},
|
|
52
|
+
"null": "Không có đối tượng nào được chọn"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image-popup": {
|
|
3
|
+
"replace": "替換",
|
|
4
|
+
"delete": "刪除",
|
|
5
|
+
"edit": "編輯",
|
|
6
|
+
"crop": "裁切",
|
|
7
|
+
"reset": "重置大小"
|
|
8
|
+
},
|
|
9
|
+
"image-cropper": {
|
|
10
|
+
"error": "無法裁切非圖片元素"
|
|
11
|
+
},
|
|
12
|
+
"image-panel": {
|
|
13
|
+
"arrange": {
|
|
14
|
+
"title": "排列",
|
|
15
|
+
"forward": "上移一層",
|
|
16
|
+
"backward": "下移一層",
|
|
17
|
+
"front": "置於頂層",
|
|
18
|
+
"back": "置於底層"
|
|
19
|
+
},
|
|
20
|
+
"transform": {
|
|
21
|
+
"title": "變換",
|
|
22
|
+
"rotate": "旋轉 (°)",
|
|
23
|
+
"x": "X (px)",
|
|
24
|
+
"y": "Y (px)",
|
|
25
|
+
"width": "寬度 (px)",
|
|
26
|
+
"height": "高度 (px)",
|
|
27
|
+
"lock": "鎖定比例 (%)"
|
|
28
|
+
},
|
|
29
|
+
"crop": {
|
|
30
|
+
"title": "裁切",
|
|
31
|
+
"start": "開始裁切",
|
|
32
|
+
"mode": "自由比例裁切"
|
|
33
|
+
},
|
|
34
|
+
"group": {
|
|
35
|
+
"title": "組合",
|
|
36
|
+
"group": "組合",
|
|
37
|
+
"reGroup": "重新組合",
|
|
38
|
+
"unGroup": "取消組合"
|
|
39
|
+
},
|
|
40
|
+
"align": {
|
|
41
|
+
"title": "對齊方式",
|
|
42
|
+
"default": "選擇對齊方式",
|
|
43
|
+
"left": "左對齊",
|
|
44
|
+
"center": "水平居中",
|
|
45
|
+
"right": "右對齊",
|
|
46
|
+
"top": "頂部對齊",
|
|
47
|
+
"middle": "垂直居中",
|
|
48
|
+
"bottom": "底部對齊",
|
|
49
|
+
"horizon": "水平分佈",
|
|
50
|
+
"vertical": "垂直分佈"
|
|
51
|
+
},
|
|
52
|
+
"null": "未選取任何物件"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Disposable, ICommandService, LocaleService } from '@univerjs/core';
|
|
1
|
+
import { Disposable, ICommandService, Injector, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { ComponentManager, IMenuService } from '@univerjs/ui';
|
|
3
|
-
import { Injector } from '@wendellhu/redi';
|
|
4
3
|
|
|
5
4
|
export declare class DrawingUIController extends Disposable {
|
|
6
5
|
private readonly _injector;
|
package/lib/types/plugin.d.ts
CHANGED