@univerjs/sheets-drawing-ui 0.2.4-alpha.0 → 0.2.4
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 +65 -63
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +2 -1
- package/lib/types/controllers/sheet-drawing.controller.d.ts +2 -1
- package/lib/types/plugin.d.ts +2 -1
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +2 -1
- package/lib/types/views/menu/image.menu.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +23 -21
package/lib/es/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
var en = Object.defineProperty;
|
|
2
2
|
var tn = (i, e, n) => e in i ? en(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
3
|
var H = (i, e, n) => tn(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CommandType as F, ICommandService as V, IUndoRedoService as ge, LocaleService as _e, IUniverInstanceService as he,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import { CommandType as F, ICommandService as V, IUndoRedoService as ge, LocaleService as _e, IUniverInstanceService as he, RxDisposable as nn, UniverInstanceType as B, toDisposable as rn, FOCUSING_COMMON_DRAWINGS as we, OnLifecycle as ie, LifecycleStages as se, IContextService as _t, Disposable as oe, Direction as q, FOCUSING_FORMULA_EDITOR as sn, EDITOR_ACTIVATED as on, Rectangle as an, DrawingTypeEnum as Ye, DisposableCollection as cn, Tools as ne, UserManagerService as dn, IPermissionService as ln, Plugin as un, DependentOn as gn } from "@univerjs/core";
|
|
5
|
+
import { Inject as W, Injector as nt } from "@wendellhu/redi";
|
|
6
|
+
import { ImageCropperObject as hn, COMPONENT_IMAGE_POPUP_MENU as mn, OpenImageCropOperation as fn, ImageResetSizeOperation as pn, DrawingCommonPanel as wn, DrawingRenderService as _n, UniverDrawingUIPlugin as vn } from "@univerjs/drawing-ui";
|
|
7
|
+
import { ISheetDrawingService as k, SetDrawingApplyMutation as E, DrawingApplyType as y, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as Sn } from "@univerjs/sheets-drawing";
|
|
8
|
+
import { IDrawingManagerService as z, IImageIoService as vt, ArrangeTypeEnum as Ce, DrawingTypeEnum as Ve, DRAWING_IMAGE_COUNT_LIMIT as dt, ImageUploadStatusType as ke, DRAWING_IMAGE_ALLOW_SIZE as Cn, getImageSize as In, DRAWING_IMAGE_WIDTH_LIMIT as lt, DRAWING_IMAGE_HEIGHT_LIMIT as ut, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Rn, getDrawingShapeKeyByDrawingSearch as Mn, UniverDrawingPlugin as Dn } from "@univerjs/drawing";
|
|
9
|
+
import { IRenderManagerService as K, getGroupState as bn, transformObjectOutOfGroup as En, precisionTo as Q, Rect as yn, DRAWING_OBJECT_LAYER_INDEX as On, SHEET_VIEWPORT_KEY as Pn, RENDER_CLASS_TYPE as ae } from "@univerjs/engine-render";
|
|
10
|
+
import { SheetCanvasPopManagerService as Tn, ISheetSelectionRenderService as Ge, SheetSkeletonManagerService as re, attachRangeWithCoord as Un, getCurrentRangeDisable$ as An, SetScrollOperation as Nn, SetZoomRatioOperation as jn, SheetPrintInterceptorService as Ln, COPY_TYPE as gt, PREDEFINED_HOOK_NAME as Ie, virtualizeDiscreteRanges as Bn, ISheetClipboardService as Wn } from "@univerjs/sheets-ui";
|
|
11
|
+
import { takeUntil as ht, Subject as mt, BehaviorSubject as $n, combineLatest as Re, map as ft, filter as Me, distinctUntilChanged as De } from "rxjs";
|
|
12
|
+
import { ISidebarService as Vn, BuiltInUIPart as Gn, IUIPartsService as xn, IMessageService as Fn, MenuItemType as St, MenuPosition as Yn, MenuGroup as kn, getMenuHiddenObservable as Ct, KeyCode as ue, ComponentManager as Hn, IMenuService as Xn, IShortcutService as zn, CanvasFloatDomService as Kn } from "@univerjs/ui";
|
|
13
|
+
import { useDependency as ee, connectInjector as Jn } from "@wendellhu/redi/react-bindings";
|
|
12
14
|
import { getSheetCommandTarget as le, SheetsSelectionsService as Zn, WorkbookEditablePermission as Ze, WorksheetEditPermission as Pe, RangeProtectionPermissionEditPoint as qn, InsertRowCommand as It, InsertColCommand as Rt, RemoveRowCommand as Mt, RemoveColCommand as Dt, DeleteRangeMoveLeftCommand as bt, DeleteRangeMoveUpCommand as Et, InsertRangeMoveDownCommand as yt, InsertRangeMoveRightCommand as Ot, DeltaRowHeightCommand as qe, SetRowHeightCommand as Qe, DeltaColumnWidthCommand as Pt, SetColWidthCommand as Tt, SetRowHiddenCommand as Ut, SetSpecificRowsVisibleCommand as At, SetSpecificColsVisibleCommand as Nt, SetColHiddenCommand as jt, SetRowVisibleMutation as Qn, SetRowHiddenMutation as er, SetColVisibleMutation as tr, SetColHiddenMutation as nr, SetWorksheetRowHeightMutation as rr, SetWorksheetColWidthMutation as ir, SetWorksheetActiveOperation as sr, SheetInterceptorService as or, SetFrozenMutation as ar, WorkbookViewPermission as pt, WorksheetViewPermission as He } from "@univerjs/sheets";
|
|
13
15
|
import L, { useEffect as rt, forwardRef as Lt, useRef as Bt, createElement as Wt, useState as et } from "react";
|
|
14
16
|
import { MessageType as be, RadioGroup as cr, Radio as Xe } from "@univerjs/design";
|
|
@@ -51,7 +53,7 @@ const j = {
|
|
|
51
53
|
id: "sidebar.operation.sheet-image",
|
|
52
54
|
type: F.COMMAND,
|
|
53
55
|
handler: async (i, e) => {
|
|
54
|
-
const n = i.get(
|
|
56
|
+
const n = i.get(Vn), t = i.get(_e), r = i.get(he), s = i.get(z);
|
|
55
57
|
if (!le(r)) return !1;
|
|
56
58
|
switch (e.value) {
|
|
57
59
|
case "open":
|
|
@@ -85,7 +87,7 @@ const j = {
|
|
|
85
87
|
univerCircleAnimation: gr,
|
|
86
88
|
uploadLoadingBodyText: hr
|
|
87
89
|
}, mr = () => {
|
|
88
|
-
const i =
|
|
90
|
+
const i = ee(vt), e = ee(_e), [n, t] = L.useState(0);
|
|
89
91
|
return rt(() => {
|
|
90
92
|
const r = i.change$.subscribe((s) => {
|
|
91
93
|
t(s);
|
|
@@ -107,7 +109,7 @@ let Te = class extends nn {
|
|
|
107
109
|
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._init();
|
|
108
110
|
}
|
|
109
111
|
_init() {
|
|
110
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(B.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(
|
|
112
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(B.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(Gn.CONTENT, () => Jn(mr, this._injector));
|
|
111
113
|
}
|
|
112
114
|
_dispose(e) {
|
|
113
115
|
const n = e.getUnitId();
|
|
@@ -122,7 +124,7 @@ let Te = class extends nn {
|
|
|
122
124
|
_hasCropObject(e) {
|
|
123
125
|
const n = e.getAllObjects();
|
|
124
126
|
for (const t of n)
|
|
125
|
-
if (t instanceof
|
|
127
|
+
if (t instanceof hn)
|
|
126
128
|
return !0;
|
|
127
129
|
return !1;
|
|
128
130
|
}
|
|
@@ -136,7 +138,7 @@ let Te = class extends nn {
|
|
|
136
138
|
return;
|
|
137
139
|
let r;
|
|
138
140
|
this.disposeWithMe(
|
|
139
|
-
|
|
141
|
+
rn(
|
|
140
142
|
t.createControl$.subscribe(() => {
|
|
141
143
|
if (this._contextService.setContextValue(we, !0), this._hasCropObject(n))
|
|
142
144
|
return;
|
|
@@ -153,7 +155,7 @@ let Te = class extends nn {
|
|
|
153
155
|
return;
|
|
154
156
|
const { unitId: l, subUnitId: c, drawingId: u } = h;
|
|
155
157
|
r == null || r.dispose(), r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
156
|
-
componentKey:
|
|
158
|
+
componentKey: mn,
|
|
157
159
|
direction: "horizontal",
|
|
158
160
|
offset: [2, 0],
|
|
159
161
|
extraProps: {
|
|
@@ -195,14 +197,14 @@ let Te = class extends nn {
|
|
|
195
197
|
{
|
|
196
198
|
label: "image-popup.crop",
|
|
197
199
|
index: 2,
|
|
198
|
-
commandId:
|
|
200
|
+
commandId: fn.id,
|
|
199
201
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
200
202
|
disable: !1
|
|
201
203
|
},
|
|
202
204
|
{
|
|
203
205
|
label: "image-popup.reset",
|
|
204
206
|
index: 3,
|
|
205
|
-
commandId:
|
|
207
|
+
commandId: pn.id,
|
|
206
208
|
commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
|
|
207
209
|
disable: !1
|
|
208
210
|
}
|
|
@@ -213,11 +215,11 @@ Te = wr([
|
|
|
213
215
|
ie(se.Steady, Te),
|
|
214
216
|
te(0, W(nt)),
|
|
215
217
|
te(1, z),
|
|
216
|
-
te(2, W(
|
|
218
|
+
te(2, W(Tn)),
|
|
217
219
|
te(3, K),
|
|
218
220
|
te(4, he),
|
|
219
221
|
te(5, _t),
|
|
220
|
-
te(6, W(
|
|
222
|
+
te(6, W(xn))
|
|
221
223
|
], Te);
|
|
222
224
|
const xe = {
|
|
223
225
|
id: "sheet.operation.insert-float-image",
|
|
@@ -290,7 +292,7 @@ const xe = {
|
|
|
290
292
|
function _r(i) {
|
|
291
293
|
const e = [];
|
|
292
294
|
return i.forEach((n) => {
|
|
293
|
-
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, d =
|
|
295
|
+
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, d = bn(0, 0, r.map((c) => c.transform || {})), h = r.map((c) => {
|
|
294
296
|
const u = c.transform || { left: 0, top: 0 }, { unitId: g, subUnitId: f, drawingId: m } = c;
|
|
295
297
|
return {
|
|
296
298
|
unitId: g,
|
|
@@ -323,7 +325,7 @@ function vr(i) {
|
|
|
323
325
|
if (d == null)
|
|
324
326
|
return;
|
|
325
327
|
const h = r.map((c) => {
|
|
326
|
-
const { transform: u } = c, { unitId: g, subUnitId: f, drawingId: m } = c, p =
|
|
328
|
+
const { transform: u } = c, { unitId: g, subUnitId: f, drawingId: m } = c, p = En(u || {}, d, d.width || 0, d.height || 0);
|
|
327
329
|
return {
|
|
328
330
|
unitId: g,
|
|
329
331
|
subUnitId: f,
|
|
@@ -416,7 +418,7 @@ function $(i, e, n) {
|
|
|
416
418
|
if (v == null)
|
|
417
419
|
return;
|
|
418
420
|
const { startX: R, startY: _ } = C, { startX: b, startY: w } = v;
|
|
419
|
-
let P =
|
|
421
|
+
let P = Q(R + c, 1), D = Q(_ + g, 1), T = Q(b + m - P, 1), U = Q(w + S - D, 1);
|
|
420
422
|
C.startX === v.endX && (T = 0), C.startY === v.endY && (U = 0);
|
|
421
423
|
const M = n.getCurrentSkeleton(), I = M.rowHeaderWidth + M.columnTotalWidth, A = M.columnHeaderHeight + M.rowTotalHeight;
|
|
422
424
|
return P + T > I && (P = I - T), D + U > A && (D = A - U), {
|
|
@@ -437,17 +439,17 @@ function N(i, e) {
|
|
|
437
439
|
return;
|
|
438
440
|
const u = {
|
|
439
441
|
column: c.actualColumn,
|
|
440
|
-
columnOffset:
|
|
442
|
+
columnOffset: Q(n - c.startX, 1),
|
|
441
443
|
row: c.actualRow,
|
|
442
|
-
rowOffset:
|
|
444
|
+
rowOffset: Q(t - c.startY, 1)
|
|
443
445
|
}, g = e.getSelectionCellByPosition(n + r, t + s);
|
|
444
446
|
if (g == null)
|
|
445
447
|
return;
|
|
446
448
|
const f = {
|
|
447
449
|
column: g.actualColumn,
|
|
448
|
-
columnOffset:
|
|
450
|
+
columnOffset: Q(n + r - g.startX, 1),
|
|
449
451
|
row: g.actualRow,
|
|
450
|
-
rowOffset:
|
|
452
|
+
rowOffset: Q(t + s - g.startY, 1)
|
|
451
453
|
};
|
|
452
454
|
return {
|
|
453
455
|
flipY: o,
|
|
@@ -520,7 +522,7 @@ let Ue = class extends oe {
|
|
|
520
522
|
const v = C.message;
|
|
521
523
|
v === ke.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
522
524
|
type: be.Error,
|
|
523
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
525
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Cn / (1024 * 1024)))
|
|
524
526
|
}) : v === ke.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
525
527
|
type: be.Error,
|
|
526
528
|
content: this._localeService.t("update-status.invalidImageType")
|
|
@@ -534,7 +536,7 @@ let Ue = class extends oe {
|
|
|
534
536
|
const n = this._getUnitInfo();
|
|
535
537
|
if (n == null)
|
|
536
538
|
return;
|
|
537
|
-
const { unitId: t, subUnitId: r } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: d } = e, { width: h, height: l, image: c } = await
|
|
539
|
+
const { unitId: t, subUnitId: r } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: d } = e, { width: h, height: l, image: c } = await In(d || ""), u = this._renderManagerService.getRenderById(t);
|
|
538
540
|
if (u == null)
|
|
539
541
|
return;
|
|
540
542
|
const { width: g, height: f } = u.scene;
|
|
@@ -584,7 +586,7 @@ let Ue = class extends oe {
|
|
|
584
586
|
endColumn: 0
|
|
585
587
|
};
|
|
586
588
|
r && r.length > 0 && (s = r[r.length - 1].range);
|
|
587
|
-
const o =
|
|
589
|
+
const o = Un(this._skeletonManagerService.getCurrent().skeleton, s);
|
|
588
590
|
if (o == null)
|
|
589
591
|
return;
|
|
590
592
|
let { startColumn: a, startRow: d, startX: h, startY: l } = o, c = !1;
|
|
@@ -693,7 +695,7 @@ Ue = Ir([
|
|
|
693
695
|
X(4, k),
|
|
694
696
|
X(5, z),
|
|
695
697
|
X(6, _t),
|
|
696
|
-
X(7,
|
|
698
|
+
X(7, Fn),
|
|
697
699
|
X(8, W(_e)),
|
|
698
700
|
X(9, K)
|
|
699
701
|
], Ue);
|
|
@@ -754,10 +756,10 @@ const yr = "univer-upload-file-menu", Or = "univer-upload-file-menu-input", wt =
|
|
|
754
756
|
}, zt = "COMPONENT_UPLOAD_FILE_MENU";
|
|
755
757
|
var We = /* @__PURE__ */ ((i) => (i[i.cellImage = 0] = "cellImage", i[i.floatImage = 1] = "floatImage", i))(We || {});
|
|
756
758
|
const Pr = (i) => {
|
|
757
|
-
const { type: e } = i, n =
|
|
759
|
+
const { type: e } = i, n = ee(V), t = Bt(null), r = () => {
|
|
758
760
|
var a;
|
|
759
761
|
(a = t.current) == null || a.click();
|
|
760
|
-
}, s =
|
|
762
|
+
}, s = Rn.map((a) => `.${a.replace("image/", "")}`).join(","), o = (a) => {
|
|
761
763
|
const d = a.target.files;
|
|
762
764
|
if (d == null)
|
|
763
765
|
return;
|
|
@@ -780,12 +782,12 @@ function Tr(i) {
|
|
|
780
782
|
return {
|
|
781
783
|
id: Jt,
|
|
782
784
|
type: St.SUBITEMS,
|
|
783
|
-
positions: [
|
|
784
|
-
group:
|
|
785
|
+
positions: [Yn.TOOLBAR_START],
|
|
786
|
+
group: kn.TOOLBAR_FORMULAS_INSERT,
|
|
785
787
|
icon: Kt,
|
|
786
788
|
tooltip: "sheetImage.title",
|
|
787
789
|
hidden$: Ct(i, B.UNIVER_SHEET),
|
|
788
|
-
disabled$:
|
|
790
|
+
disabled$: An(i, { workbookTypes: [Ze], worksheetTypes: [Pe], rangeTypes: [qn] })
|
|
789
791
|
};
|
|
790
792
|
}
|
|
791
793
|
function Ur(i) {
|
|
@@ -821,7 +823,7 @@ const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", j
|
|
|
821
823
|
sheetImageMenuInput: Xr
|
|
822
824
|
}, zr = (i) => {
|
|
823
825
|
var v;
|
|
824
|
-
const e =
|
|
826
|
+
const e = ee(V), n = ee(_e), t = ee(z), r = ee(K), { drawings: s } = i, o = s[0];
|
|
825
827
|
if (o == null)
|
|
826
828
|
return;
|
|
827
829
|
const { unitId: a } = o, d = r.getRenderById(a), h = d == null ? void 0 : d.scene;
|
|
@@ -882,7 +884,7 @@ const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", j
|
|
|
882
884
|
const C = (R) => R ? "block" : "none";
|
|
883
885
|
return /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelGrid, Z.imageCommonPanelBorder), style: { display: C(c) } }, /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn, Z.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(cr, { value: f, onChange: S, direction: "vertical" }, /* @__PURE__ */ L.createElement(Xe, { value: O.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(Xe, { value: O.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(Xe, { value: O.None }, n.t("drawing-anchor.none"))))));
|
|
884
886
|
}, Kr = () => {
|
|
885
|
-
const i =
|
|
887
|
+
const i = ee(z), e = i.getFocusDrawings(), [n, t] = et(e);
|
|
886
888
|
return rt(() => {
|
|
887
889
|
const r = i.focus$.subscribe((s) => {
|
|
888
890
|
t(s);
|
|
@@ -890,7 +892,7 @@ const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", j
|
|
|
890
892
|
return () => {
|
|
891
893
|
r.unsubscribe();
|
|
892
894
|
};
|
|
893
|
-
}, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanel }, /* @__PURE__ */ L.createElement(
|
|
895
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanel }, /* @__PURE__ */ L.createElement(wn, { drawings: n }), /* @__PURE__ */ L.createElement(zr, { drawings: n }));
|
|
894
896
|
}, ve = {
|
|
895
897
|
id: "sheet.command.move-drawing",
|
|
896
898
|
type: F.COMMAND,
|
|
@@ -903,7 +905,7 @@ const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", j
|
|
|
903
905
|
if (c == null)
|
|
904
906
|
return null;
|
|
905
907
|
const u = { ...c }, { left: g = 0, top: f = 0 } = c;
|
|
906
|
-
return s ===
|
|
908
|
+
return s === q.UP ? u.top = f - 1 : s === q.DOWN ? u.top = f + 1 : s === q.LEFT ? u.left = g - 1 : s === q.RIGHT && (u.left = g + 1), {
|
|
907
909
|
...l,
|
|
908
910
|
transform: u,
|
|
909
911
|
sheetTransform: N(u, r)
|
|
@@ -937,7 +939,7 @@ const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", j
|
|
|
937
939
|
}
|
|
938
940
|
};
|
|
939
941
|
function Se(i) {
|
|
940
|
-
return !i.getContextValue(
|
|
942
|
+
return !i.getContextValue(sn) && !i.getContextValue(on) && i.getContextValue(we);
|
|
941
943
|
}
|
|
942
944
|
const Jr = {
|
|
943
945
|
id: ve.id,
|
|
@@ -947,7 +949,7 @@ const Jr = {
|
|
|
947
949
|
priority: 100,
|
|
948
950
|
preconditions: Se,
|
|
949
951
|
staticParameters: {
|
|
950
|
-
direction:
|
|
952
|
+
direction: q.DOWN
|
|
951
953
|
}
|
|
952
954
|
}, Zr = {
|
|
953
955
|
id: ve.id,
|
|
@@ -957,7 +959,7 @@ const Jr = {
|
|
|
957
959
|
priority: 100,
|
|
958
960
|
preconditions: Se,
|
|
959
961
|
staticParameters: {
|
|
960
|
-
direction:
|
|
962
|
+
direction: q.UP
|
|
961
963
|
}
|
|
962
964
|
}, qr = {
|
|
963
965
|
id: ve.id,
|
|
@@ -967,7 +969,7 @@ const Jr = {
|
|
|
967
969
|
priority: 100,
|
|
968
970
|
preconditions: Se,
|
|
969
971
|
staticParameters: {
|
|
970
|
-
direction:
|
|
972
|
+
direction: q.LEFT
|
|
971
973
|
}
|
|
972
974
|
}, Qr = {
|
|
973
975
|
id: ve.id,
|
|
@@ -977,7 +979,7 @@ const Jr = {
|
|
|
977
979
|
priority: 100,
|
|
978
980
|
preconditions: Se,
|
|
979
981
|
staticParameters: {
|
|
980
|
-
direction:
|
|
982
|
+
direction: q.RIGHT
|
|
981
983
|
}
|
|
982
984
|
}, ei = {
|
|
983
985
|
id: Zt.id,
|
|
@@ -1048,10 +1050,10 @@ let pe = class extends oe {
|
|
|
1048
1050
|
pe = ri([
|
|
1049
1051
|
ie(se.Rendered, pe),
|
|
1050
1052
|
me(1, W(nt)),
|
|
1051
|
-
me(2, W(
|
|
1052
|
-
me(3,
|
|
1053
|
+
me(2, W(Hn)),
|
|
1054
|
+
me(3, Xn),
|
|
1053
1055
|
me(4, V),
|
|
1054
|
-
me(5,
|
|
1056
|
+
me(5, zn)
|
|
1055
1057
|
], pe);
|
|
1056
1058
|
var si = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ai = (i, e, n, t) => {
|
|
1057
1059
|
for (var r = t > 1 ? void 0 : t ? oi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
@@ -1737,7 +1739,7 @@ let Ae = class extends oe {
|
|
|
1737
1739
|
const { from: h, to: l } = a, { row: c, column: u } = h, { row: g, column: f } = l;
|
|
1738
1740
|
for (let m = 0; m < n.length; m++) {
|
|
1739
1741
|
const p = n[m], { startRow: S, endRow: C, startColumn: v, endColumn: R } = p;
|
|
1740
|
-
if (
|
|
1742
|
+
if (an.intersects(
|
|
1741
1743
|
{
|
|
1742
1744
|
startRow: S,
|
|
1743
1745
|
endRow: C,
|
|
@@ -1776,7 +1778,7 @@ var li = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, gi = (i, e
|
|
|
1776
1778
|
return t && r && li(e, n, r), r;
|
|
1777
1779
|
}, de = (i, e) => (n, t) => e(n, t, i);
|
|
1778
1780
|
function hi(i, e, n, t) {
|
|
1779
|
-
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(
|
|
1781
|
+
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Pn.VIEW_MAIN), a = {
|
|
1780
1782
|
left: !0,
|
|
1781
1783
|
top: !0
|
|
1782
1784
|
};
|
|
@@ -1879,7 +1881,7 @@ let tt = class extends oe {
|
|
|
1879
1881
|
const { scene: u, canvas: g } = c;
|
|
1880
1882
|
if (h == null)
|
|
1881
1883
|
return !0;
|
|
1882
|
-
const { left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b } = h, w =
|
|
1884
|
+
const { left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b } = h, w = Mn({ unitId: t, subUnitId: r, drawingId: s }), P = u.getObject(w);
|
|
1883
1885
|
if (P != null) {
|
|
1884
1886
|
P.transformByState({ left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b });
|
|
1885
1887
|
return;
|
|
@@ -1890,9 +1892,9 @@ let tt = class extends oe {
|
|
|
1890
1892
|
width: p,
|
|
1891
1893
|
height: S,
|
|
1892
1894
|
zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
|
|
1893
|
-
}, T = new
|
|
1894
|
-
u.addObject(T,
|
|
1895
|
-
const U = this._ensureMap(t, r), M = new
|
|
1895
|
+
}, T = new yn(w, D);
|
|
1896
|
+
u.addObject(T, On).attachTransformerTo(T);
|
|
1897
|
+
const U = this._ensureMap(t, r), M = new cn(), I = ze(T, c.renderObject, d.skeleton, o.worksheet), A = new $n(I), G = {
|
|
1896
1898
|
dispose: M,
|
|
1897
1899
|
rect: T,
|
|
1898
1900
|
position$: A,
|
|
@@ -1944,10 +1946,10 @@ let tt = class extends oe {
|
|
|
1944
1946
|
}
|
|
1945
1947
|
});
|
|
1946
1948
|
};
|
|
1947
|
-
if (e.id ===
|
|
1949
|
+
if (e.id === Nn.id) {
|
|
1948
1950
|
const s = e.params, { unitId: o, sheetId: a } = s;
|
|
1949
1951
|
n(o, a);
|
|
1950
|
-
} else if (e.id ===
|
|
1952
|
+
} else if (e.id === jn.id) {
|
|
1951
1953
|
const s = e.params, { unitId: o } = s;
|
|
1952
1954
|
Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((d) => {
|
|
1953
1955
|
n(o, d);
|
|
@@ -2074,7 +2076,7 @@ tt = gi([
|
|
|
2074
2076
|
de(1, he),
|
|
2075
2077
|
de(2, W(V)),
|
|
2076
2078
|
de(3, z),
|
|
2077
|
-
de(4, W(
|
|
2079
|
+
de(4, W(Kn)),
|
|
2078
2080
|
de(5, k)
|
|
2079
2081
|
], tt);
|
|
2080
2082
|
var mi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, pi = (i, e, n, t) => {
|
|
@@ -2128,8 +2130,8 @@ let Ne = class extends oe {
|
|
|
2128
2130
|
};
|
|
2129
2131
|
Ne = pi([
|
|
2130
2132
|
ie(se.Rendered, Ne),
|
|
2131
|
-
Oe(0, W(
|
|
2132
|
-
Oe(1, W(
|
|
2133
|
+
Oe(0, W(Ln)),
|
|
2134
|
+
Oe(1, W(_n)),
|
|
2133
2135
|
Oe(2, z),
|
|
2134
2136
|
Oe(3, K)
|
|
2135
2137
|
], Ne);
|
|
@@ -2289,9 +2291,9 @@ je = vi([
|
|
|
2289
2291
|
ie(se.Rendered, je),
|
|
2290
2292
|
fe(0, z),
|
|
2291
2293
|
fe(1, K),
|
|
2292
|
-
fe(2,
|
|
2294
|
+
fe(2, ln),
|
|
2293
2295
|
fe(3, he),
|
|
2294
|
-
fe(4, W(
|
|
2296
|
+
fe(4, W(dn))
|
|
2295
2297
|
], je);
|
|
2296
2298
|
var Si = Object.defineProperty, Ci = Object.getOwnPropertyDescriptor, Ii = (i, e, n, t) => {
|
|
2297
2299
|
for (var r = t > 1 ? void 0 : t ? Ci(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
@@ -2357,7 +2359,7 @@ let Le = class extends oe {
|
|
|
2357
2359
|
const { copyRange: t } = n;
|
|
2358
2360
|
if (!t)
|
|
2359
2361
|
return { redos: [], undos: [] };
|
|
2360
|
-
const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [a, d], mapFunc: h } =
|
|
2362
|
+
const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [a, d], mapFunc: h } = Bn([t, e]), { row: l, col: c } = h(a.startRow, a.startColumn), { row: u, col: g } = h(d.startRow, d.startColumn), f = (D = this._renderManagerService.getRenderById(s)) == null ? void 0 : D.with(re);
|
|
2361
2363
|
if (!f)
|
|
2362
2364
|
return { redos: [], undos: [] };
|
|
2363
2365
|
const m = f.attachRangeWithCoord({
|
|
@@ -2426,7 +2428,7 @@ let Le = class extends oe {
|
|
|
2426
2428
|
};
|
|
2427
2429
|
Le = Ii([
|
|
2428
2430
|
ie(se.Ready, Le),
|
|
2429
|
-
Ke(0,
|
|
2431
|
+
Ke(0, Wn),
|
|
2430
2432
|
Ke(1, K),
|
|
2431
2433
|
Ke(2, k)
|
|
2432
2434
|
], Le);
|
|
@@ -2436,7 +2438,7 @@ var qt = Object.defineProperty, Ri = Object.getOwnPropertyDescriptor, Mi = (i, e
|
|
|
2436
2438
|
return t && r && qt(e, n, r), r;
|
|
2437
2439
|
}, Je = (i, e) => (n, t) => e(n, t, i), Qt = (i, e, n) => Mi(i, typeof e != "symbol" ? e + "" : e, n);
|
|
2438
2440
|
const bi = "SHEET_IMAGE_UI_PLUGIN";
|
|
2439
|
-
let $e = class extends
|
|
2441
|
+
let $e = class extends un {
|
|
2440
2442
|
constructor(e = {}, n, t, r) {
|
|
2441
2443
|
super();
|
|
2442
2444
|
H(this, "_pluginConfig");
|
|
@@ -2479,7 +2481,7 @@ let $e = class extends gn {
|
|
|
2479
2481
|
Qt($e, "type", B.UNIVER_SHEET);
|
|
2480
2482
|
Qt($e, "pluginName", bi);
|
|
2481
2483
|
$e = Di([
|
|
2482
|
-
|
|
2484
|
+
gn(Dn, vn, Sn),
|
|
2483
2485
|
Je(1, W(nt)),
|
|
2484
2486
|
Je(2, W(_e)),
|
|
2485
2487
|
Je(3, K)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IContextService,
|
|
1
|
+
import { IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
3
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
4
|
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
|
|
4
5
|
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DependencyOverride, Disposable, ICommandService
|
|
1
|
+
import { DependencyOverride, Disposable, ICommandService } from '@univerjs/core';
|
|
2
2
|
import { MenuConfig, ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
|
|
3
|
+
import { Injector } from '@wendellhu/redi';
|
|
3
4
|
|
|
4
5
|
export interface IUniverSheetsDrawingConfig {
|
|
5
6
|
menu?: MenuConfig;
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
3
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
4
|
import { IUniverSheetsDrawingConfig } from './controllers/sheet-drawing.controller';
|
|
4
5
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPosition, ITransformState, Worksheet, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
3
3
|
import { IBoundRectNoAngle, Scene, SpreadsheetSkeleton, IRenderManagerService } from '@univerjs/engine-render';
|
|
4
4
|
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
5
5
|
import { CanvasFloatDomService } from '@univerjs/ui';
|
|
6
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
6
7
|
|
|
7
8
|
export interface ICanvasFloatDom {
|
|
8
9
|
allowTransform: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IMenuItem } from '@univerjs/ui';
|
|
2
|
-
import { IAccessor } from '@
|
|
2
|
+
import { IAccessor } from '@wendellhu/redi';
|
|
3
3
|
|
|
4
4
|
export declare const IMAGE_UPLOAD_ICON = "addition-and-subtraction-single";
|
|
5
5
|
export declare function ImageMenuFactory(accessor: IAccessor): IMenuItem;
|