@univerjs/sheets-drawing 0.21.1 → 0.22.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 +31 -16
- package/lib/cjs/facade.js +6 -6
- package/lib/cjs/index.js +29 -29
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +29 -29
- package/lib/facade.js +6 -6
- package/lib/index.js +29 -29
- package/lib/umd/index.js +1 -1
- package/package.json +17 -11
package/README.md
CHANGED
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
# @univerjs/sheets-drawing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://npmjs.com/package/@univerjs/sheets-drawing)
|
|
4
|
+
[](https://npmjs.com/package/@univerjs/sheets-drawing)
|
|
5
|
+
[](https://npmjs.com/package/@univerjs/sheets-drawing)
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
| --- | --- | --- | --- | --- | :---: | :---: |
|
|
7
|
-
| `@univerjs/sheets-drawing` | `UniverSheetsDrawing` | [![][npm-version-shield]][npm-version-link] | ![][npm-license-shield] | ![][npm-downloads-shield] | ❌ | ❌ |
|
|
7
|
+
`@univerjs/sheets-drawing` connects the shared drawing model to Univer Sheets so worksheets can host drawing objects.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Package Overview
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
| Package | UMD global | CSS | Locales | Facade entry |
|
|
12
|
+
| --- | --- | :---: | :---: | :---: |
|
|
13
|
+
| `@univerjs/sheets-drawing` | `UniverSheetsDrawing` | No | No | Yes |
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
## Installation
|
|
14
16
|
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
+
```sh
|
|
18
|
+
pnpm add @univerjs/sheets-drawing
|
|
19
|
+
# or
|
|
17
20
|
npm install @univerjs/sheets-drawing
|
|
21
|
+
```
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
Keep all `@univerjs/*` packages on the same version.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { UniverSheetsDrawingPlugin } from '@univerjs/sheets-drawing';
|
|
29
|
+
|
|
30
|
+
univer.registerPlugin(UniverSheetsDrawingPlugin);
|
|
21
31
|
```
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
## Integration Notes
|
|
34
|
+
|
|
35
|
+
Use this package with `@univerjs/sheets-drawing-ui` when users need drawing interactions in the sheet UI.
|
|
36
|
+
|
|
37
|
+
## Resources
|
|
38
|
+
|
|
39
|
+
- [Documentation](https://docs.univer.ai)
|
|
40
|
+
- [NPM package](https://npmjs.com/package/@univerjs/sheets-drawing)
|
|
41
|
+
- [GitHub repository](https://github.com/dream-num/univer)
|
|
42
|
+
|
package/lib/cjs/facade.js
CHANGED
|
@@ -5,7 +5,7 @@ let _univerjs_sheets = require("@univerjs/sheets");
|
|
|
5
5
|
let _univerjs_sheets_drawing = require("@univerjs/sheets-drawing");
|
|
6
6
|
let _univerjs_sheets_facade = require("@univerjs/sheets/facade");
|
|
7
7
|
|
|
8
|
-
//#region \0@oxc-project+runtime@0.
|
|
8
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
9
9
|
function _typeof(o) {
|
|
10
10
|
"@babel/helpers - typeof";
|
|
11
11
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -16,7 +16,7 @@ function _typeof(o) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
|
-
//#region \0@oxc-project+runtime@0.
|
|
19
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
20
20
|
function toPrimitive(t, r) {
|
|
21
21
|
if ("object" != _typeof(t) || !t) return t;
|
|
22
22
|
var e = t[Symbol.toPrimitive];
|
|
@@ -29,14 +29,14 @@ function toPrimitive(t, r) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
|
-
//#region \0@oxc-project+runtime@0.
|
|
32
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
33
33
|
function toPropertyKey(t) {
|
|
34
34
|
var i = toPrimitive(t, "string");
|
|
35
35
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region \0@oxc-project+runtime@0.
|
|
39
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
40
40
|
function _defineProperty(e, r, t) {
|
|
41
41
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
42
42
|
value: t,
|
|
@@ -47,7 +47,7 @@ function _defineProperty(e, r, t) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
|
-
//#region \0@oxc-project+runtime@0.
|
|
50
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
51
51
|
function __decorateParam(paramIndex, decorator) {
|
|
52
52
|
return function(target, key) {
|
|
53
53
|
decorator(target, key, paramIndex);
|
|
@@ -55,7 +55,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
//#endregion
|
|
58
|
-
//#region \0@oxc-project+runtime@0.
|
|
58
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
59
59
|
function __decorate(decorators, target, key, desc) {
|
|
60
60
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
61
61
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
package/lib/cjs/index.js
CHANGED
|
@@ -104,27 +104,27 @@ const SetDrawingApplyMutation = {
|
|
|
104
104
|
drawingManagerService.applyJson1(unitId, subUnitId, op);
|
|
105
105
|
sheetDrawingService.applyJson1(unitId, subUnitId, op);
|
|
106
106
|
switch (type) {
|
|
107
|
-
case
|
|
107
|
+
case 0:
|
|
108
108
|
drawingManagerService.addNotification(objects);
|
|
109
109
|
sheetDrawingService.addNotification(objects);
|
|
110
110
|
break;
|
|
111
|
-
case
|
|
111
|
+
case 1:
|
|
112
112
|
drawingManagerService.removeNotification(objects);
|
|
113
113
|
sheetDrawingService.removeNotification(objects);
|
|
114
114
|
break;
|
|
115
|
-
case
|
|
115
|
+
case 2:
|
|
116
116
|
drawingManagerService.updateNotification(objects);
|
|
117
117
|
sheetDrawingService.updateNotification(objects);
|
|
118
118
|
break;
|
|
119
|
-
case
|
|
119
|
+
case 3:
|
|
120
120
|
drawingManagerService.orderNotification(objects);
|
|
121
121
|
sheetDrawingService.orderNotification(objects);
|
|
122
122
|
break;
|
|
123
|
-
case
|
|
123
|
+
case 4:
|
|
124
124
|
drawingManagerService.groupUpdateNotification(objects);
|
|
125
125
|
sheetDrawingService.groupUpdateNotification(objects);
|
|
126
126
|
break;
|
|
127
|
-
case
|
|
127
|
+
case 5:
|
|
128
128
|
drawingManagerService.ungroupUpdateNotification(objects);
|
|
129
129
|
sheetDrawingService.ungroupUpdateNotification(objects);
|
|
130
130
|
break;
|
|
@@ -175,7 +175,7 @@ const InsertSheetDrawingCommand = {
|
|
|
175
175
|
subUnitId,
|
|
176
176
|
op: redo,
|
|
177
177
|
objects,
|
|
178
|
-
type:
|
|
178
|
+
type: 0
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
181
|
{
|
|
@@ -193,7 +193,7 @@ const InsertSheetDrawingCommand = {
|
|
|
193
193
|
subUnitId,
|
|
194
194
|
op: undo,
|
|
195
195
|
objects,
|
|
196
|
-
type:
|
|
196
|
+
type: 1
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
199
|
{
|
|
@@ -202,7 +202,7 @@ const InsertSheetDrawingCommand = {
|
|
|
202
202
|
},
|
|
203
203
|
...intercepted.undos
|
|
204
204
|
];
|
|
205
|
-
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService)) {
|
|
205
|
+
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService).result) {
|
|
206
206
|
undoRedoService.pushUndoRedo({
|
|
207
207
|
unitID: unitId,
|
|
208
208
|
undoMutations,
|
|
@@ -241,7 +241,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
241
241
|
subUnitId,
|
|
242
242
|
op: redo,
|
|
243
243
|
objects,
|
|
244
|
-
type:
|
|
244
|
+
type: 1
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
{
|
|
@@ -259,7 +259,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
259
259
|
subUnitId,
|
|
260
260
|
op: undo,
|
|
261
261
|
objects,
|
|
262
|
-
type:
|
|
262
|
+
type: 0
|
|
263
263
|
}
|
|
264
264
|
},
|
|
265
265
|
{
|
|
@@ -268,7 +268,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
268
268
|
},
|
|
269
269
|
...intercepted.undos
|
|
270
270
|
];
|
|
271
|
-
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService)) {
|
|
271
|
+
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService).result) {
|
|
272
272
|
undoRedoService.pushUndoRedo({
|
|
273
273
|
unitID: unitId,
|
|
274
274
|
undoMutations,
|
|
@@ -308,7 +308,7 @@ const SetDrawingArrangeCommand = {
|
|
|
308
308
|
unitId,
|
|
309
309
|
subUnitId,
|
|
310
310
|
objects,
|
|
311
|
-
type:
|
|
311
|
+
type: 3
|
|
312
312
|
})) {
|
|
313
313
|
undoRedoService.pushUndoRedo({
|
|
314
314
|
unitID: unitId,
|
|
@@ -319,7 +319,7 @@ const SetDrawingArrangeCommand = {
|
|
|
319
319
|
unitId,
|
|
320
320
|
subUnitId,
|
|
321
321
|
objects,
|
|
322
|
-
type:
|
|
322
|
+
type: 3
|
|
323
323
|
}
|
|
324
324
|
}],
|
|
325
325
|
redoMutations: [{
|
|
@@ -329,7 +329,7 @@ const SetDrawingArrangeCommand = {
|
|
|
329
329
|
unitId,
|
|
330
330
|
subUnitId,
|
|
331
331
|
objects,
|
|
332
|
-
type:
|
|
332
|
+
type: 3
|
|
333
333
|
}
|
|
334
334
|
}]
|
|
335
335
|
});
|
|
@@ -366,7 +366,7 @@ const SetSheetDrawingCommand = {
|
|
|
366
366
|
subUnitId,
|
|
367
367
|
op: redo,
|
|
368
368
|
objects,
|
|
369
|
-
type:
|
|
369
|
+
type: 2
|
|
370
370
|
}
|
|
371
371
|
},
|
|
372
372
|
{
|
|
@@ -384,7 +384,7 @@ const SetSheetDrawingCommand = {
|
|
|
384
384
|
subUnitId,
|
|
385
385
|
op: undo,
|
|
386
386
|
objects,
|
|
387
|
-
type:
|
|
387
|
+
type: 2
|
|
388
388
|
}
|
|
389
389
|
},
|
|
390
390
|
{
|
|
@@ -393,7 +393,7 @@ const SetSheetDrawingCommand = {
|
|
|
393
393
|
},
|
|
394
394
|
...intercepted.undos
|
|
395
395
|
];
|
|
396
|
-
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService)) {
|
|
396
|
+
if ((0, _univerjs_core.sequenceExecute)(redoMutations, commandService).result) {
|
|
397
397
|
undoRedoService.pushUndoRedo({
|
|
398
398
|
unitID: unitId,
|
|
399
399
|
undoMutations,
|
|
@@ -406,7 +406,7 @@ const SetSheetDrawingCommand = {
|
|
|
406
406
|
};
|
|
407
407
|
|
|
408
408
|
//#endregion
|
|
409
|
-
//#region \0@oxc-project+runtime@0.
|
|
409
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
410
410
|
function __decorateParam(paramIndex, decorator) {
|
|
411
411
|
return function(target, key) {
|
|
412
412
|
decorator(target, key, paramIndex);
|
|
@@ -414,7 +414,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
//#endregion
|
|
417
|
-
//#region \0@oxc-project+runtime@0.
|
|
417
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
418
418
|
function __decorate(decorators, target, key, desc) {
|
|
419
419
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
420
420
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -506,7 +506,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
506
506
|
unitId: jsonOpUnitId,
|
|
507
507
|
subUnitId: jsonOpSubUnitId,
|
|
508
508
|
objects,
|
|
509
|
-
type:
|
|
509
|
+
type: 1
|
|
510
510
|
}
|
|
511
511
|
}],
|
|
512
512
|
undos: [{
|
|
@@ -516,7 +516,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
516
516
|
unitId: jsonOpUnitId,
|
|
517
517
|
subUnitId: jsonOpSubUnitId,
|
|
518
518
|
objects,
|
|
519
|
-
type:
|
|
519
|
+
type: 0
|
|
520
520
|
}
|
|
521
521
|
}]
|
|
522
522
|
};
|
|
@@ -550,7 +550,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
550
550
|
unitId: jsonOpUnitId,
|
|
551
551
|
subUnitId: jsonOpSubUnitId,
|
|
552
552
|
objects,
|
|
553
|
-
type:
|
|
553
|
+
type: 0
|
|
554
554
|
}
|
|
555
555
|
}],
|
|
556
556
|
undos: [{
|
|
@@ -560,7 +560,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
560
560
|
unitId: jsonOpUnitId,
|
|
561
561
|
subUnitId: jsonOpSubUnitId,
|
|
562
562
|
objects,
|
|
563
|
-
type:
|
|
563
|
+
type: 1
|
|
564
564
|
}
|
|
565
565
|
}]
|
|
566
566
|
};
|
|
@@ -584,7 +584,7 @@ SheetsDrawingLoadController = __decorate([
|
|
|
584
584
|
//#endregion
|
|
585
585
|
//#region package.json
|
|
586
586
|
var name = "@univerjs/sheets-drawing";
|
|
587
|
-
var version = "0.
|
|
587
|
+
var version = "0.22.0";
|
|
588
588
|
|
|
589
589
|
//#endregion
|
|
590
590
|
//#region src/config/config.ts
|
|
@@ -608,7 +608,7 @@ const configSymbol = Symbol(SHEETS_DRAWING_PLUGIN_CONFIG_KEY);
|
|
|
608
608
|
const defaultPluginConfig = {};
|
|
609
609
|
|
|
610
610
|
//#endregion
|
|
611
|
-
//#region \0@oxc-project+runtime@0.
|
|
611
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
612
612
|
function _typeof(o) {
|
|
613
613
|
"@babel/helpers - typeof";
|
|
614
614
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -619,7 +619,7 @@ function _typeof(o) {
|
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
//#endregion
|
|
622
|
-
//#region \0@oxc-project+runtime@0.
|
|
622
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
623
623
|
function toPrimitive(t, r) {
|
|
624
624
|
if ("object" != _typeof(t) || !t) return t;
|
|
625
625
|
var e = t[Symbol.toPrimitive];
|
|
@@ -632,14 +632,14 @@ function toPrimitive(t, r) {
|
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
//#endregion
|
|
635
|
-
//#region \0@oxc-project+runtime@0.
|
|
635
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
636
636
|
function toPropertyKey(t) {
|
|
637
637
|
var i = toPrimitive(t, "string");
|
|
638
638
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
639
639
|
}
|
|
640
640
|
|
|
641
641
|
//#endregion
|
|
642
|
-
//#region \0@oxc-project+runtime@0.
|
|
642
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
643
643
|
function _defineProperty(e, r, t) {
|
|
644
644
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
645
645
|
value: t,
|
package/lib/es/facade.js
CHANGED
|
@@ -5,7 +5,7 @@ import { SheetSkeletonService, convertPositionCellToSheetOverGrid, convertPositi
|
|
|
5
5
|
import { ISheetDrawingService, InsertSheetDrawingCommand, RemoveSheetDrawingCommand, SetDrawingArrangeCommand, SetSheetDrawingCommand, SheetDrawingAnchorType, transformToAxisAlignPosition } from "@univerjs/sheets-drawing";
|
|
6
6
|
import { FWorksheet } from "@univerjs/sheets/facade";
|
|
7
7
|
|
|
8
|
-
//#region \0@oxc-project+runtime@0.
|
|
8
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
9
9
|
function _typeof(o) {
|
|
10
10
|
"@babel/helpers - typeof";
|
|
11
11
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -16,7 +16,7 @@ function _typeof(o) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
|
-
//#region \0@oxc-project+runtime@0.
|
|
19
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
20
20
|
function toPrimitive(t, r) {
|
|
21
21
|
if ("object" != _typeof(t) || !t) return t;
|
|
22
22
|
var e = t[Symbol.toPrimitive];
|
|
@@ -29,14 +29,14 @@ function toPrimitive(t, r) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
|
-
//#region \0@oxc-project+runtime@0.
|
|
32
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
33
33
|
function toPropertyKey(t) {
|
|
34
34
|
var i = toPrimitive(t, "string");
|
|
35
35
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region \0@oxc-project+runtime@0.
|
|
39
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
40
40
|
function _defineProperty(e, r, t) {
|
|
41
41
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
42
42
|
value: t,
|
|
@@ -47,7 +47,7 @@ function _defineProperty(e, r, t) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
|
-
//#region \0@oxc-project+runtime@0.
|
|
50
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
51
51
|
function __decorateParam(paramIndex, decorator) {
|
|
52
52
|
return function(target, key) {
|
|
53
53
|
decorator(target, key, paramIndex);
|
|
@@ -55,7 +55,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
//#endregion
|
|
58
|
-
//#region \0@oxc-project+runtime@0.
|
|
58
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
59
59
|
function __decorate(decorators, target, key, desc) {
|
|
60
60
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
61
61
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
package/lib/es/index.js
CHANGED
|
@@ -103,27 +103,27 @@ const SetDrawingApplyMutation = {
|
|
|
103
103
|
drawingManagerService.applyJson1(unitId, subUnitId, op);
|
|
104
104
|
sheetDrawingService.applyJson1(unitId, subUnitId, op);
|
|
105
105
|
switch (type) {
|
|
106
|
-
case
|
|
106
|
+
case 0:
|
|
107
107
|
drawingManagerService.addNotification(objects);
|
|
108
108
|
sheetDrawingService.addNotification(objects);
|
|
109
109
|
break;
|
|
110
|
-
case
|
|
110
|
+
case 1:
|
|
111
111
|
drawingManagerService.removeNotification(objects);
|
|
112
112
|
sheetDrawingService.removeNotification(objects);
|
|
113
113
|
break;
|
|
114
|
-
case
|
|
114
|
+
case 2:
|
|
115
115
|
drawingManagerService.updateNotification(objects);
|
|
116
116
|
sheetDrawingService.updateNotification(objects);
|
|
117
117
|
break;
|
|
118
|
-
case
|
|
118
|
+
case 3:
|
|
119
119
|
drawingManagerService.orderNotification(objects);
|
|
120
120
|
sheetDrawingService.orderNotification(objects);
|
|
121
121
|
break;
|
|
122
|
-
case
|
|
122
|
+
case 4:
|
|
123
123
|
drawingManagerService.groupUpdateNotification(objects);
|
|
124
124
|
sheetDrawingService.groupUpdateNotification(objects);
|
|
125
125
|
break;
|
|
126
|
-
case
|
|
126
|
+
case 5:
|
|
127
127
|
drawingManagerService.ungroupUpdateNotification(objects);
|
|
128
128
|
sheetDrawingService.ungroupUpdateNotification(objects);
|
|
129
129
|
break;
|
|
@@ -174,7 +174,7 @@ const InsertSheetDrawingCommand = {
|
|
|
174
174
|
subUnitId,
|
|
175
175
|
op: redo,
|
|
176
176
|
objects,
|
|
177
|
-
type:
|
|
177
|
+
type: 0
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
180
|
{
|
|
@@ -192,7 +192,7 @@ const InsertSheetDrawingCommand = {
|
|
|
192
192
|
subUnitId,
|
|
193
193
|
op: undo,
|
|
194
194
|
objects,
|
|
195
|
-
type:
|
|
195
|
+
type: 1
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
198
|
{
|
|
@@ -201,7 +201,7 @@ const InsertSheetDrawingCommand = {
|
|
|
201
201
|
},
|
|
202
202
|
...intercepted.undos
|
|
203
203
|
];
|
|
204
|
-
if (sequenceExecute(redoMutations, commandService)) {
|
|
204
|
+
if (sequenceExecute(redoMutations, commandService).result) {
|
|
205
205
|
undoRedoService.pushUndoRedo({
|
|
206
206
|
unitID: unitId,
|
|
207
207
|
undoMutations,
|
|
@@ -240,7 +240,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
240
240
|
subUnitId,
|
|
241
241
|
op: redo,
|
|
242
242
|
objects,
|
|
243
|
-
type:
|
|
243
|
+
type: 1
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
246
|
{
|
|
@@ -258,7 +258,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
258
258
|
subUnitId,
|
|
259
259
|
op: undo,
|
|
260
260
|
objects,
|
|
261
|
-
type:
|
|
261
|
+
type: 0
|
|
262
262
|
}
|
|
263
263
|
},
|
|
264
264
|
{
|
|
@@ -267,7 +267,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
267
267
|
},
|
|
268
268
|
...intercepted.undos
|
|
269
269
|
];
|
|
270
|
-
if (sequenceExecute(redoMutations, commandService)) {
|
|
270
|
+
if (sequenceExecute(redoMutations, commandService).result) {
|
|
271
271
|
undoRedoService.pushUndoRedo({
|
|
272
272
|
unitID: unitId,
|
|
273
273
|
undoMutations,
|
|
@@ -307,7 +307,7 @@ const SetDrawingArrangeCommand = {
|
|
|
307
307
|
unitId,
|
|
308
308
|
subUnitId,
|
|
309
309
|
objects,
|
|
310
|
-
type:
|
|
310
|
+
type: 3
|
|
311
311
|
})) {
|
|
312
312
|
undoRedoService.pushUndoRedo({
|
|
313
313
|
unitID: unitId,
|
|
@@ -318,7 +318,7 @@ const SetDrawingArrangeCommand = {
|
|
|
318
318
|
unitId,
|
|
319
319
|
subUnitId,
|
|
320
320
|
objects,
|
|
321
|
-
type:
|
|
321
|
+
type: 3
|
|
322
322
|
}
|
|
323
323
|
}],
|
|
324
324
|
redoMutations: [{
|
|
@@ -328,7 +328,7 @@ const SetDrawingArrangeCommand = {
|
|
|
328
328
|
unitId,
|
|
329
329
|
subUnitId,
|
|
330
330
|
objects,
|
|
331
|
-
type:
|
|
331
|
+
type: 3
|
|
332
332
|
}
|
|
333
333
|
}]
|
|
334
334
|
});
|
|
@@ -365,7 +365,7 @@ const SetSheetDrawingCommand = {
|
|
|
365
365
|
subUnitId,
|
|
366
366
|
op: redo,
|
|
367
367
|
objects,
|
|
368
|
-
type:
|
|
368
|
+
type: 2
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
371
|
{
|
|
@@ -383,7 +383,7 @@ const SetSheetDrawingCommand = {
|
|
|
383
383
|
subUnitId,
|
|
384
384
|
op: undo,
|
|
385
385
|
objects,
|
|
386
|
-
type:
|
|
386
|
+
type: 2
|
|
387
387
|
}
|
|
388
388
|
},
|
|
389
389
|
{
|
|
@@ -392,7 +392,7 @@ const SetSheetDrawingCommand = {
|
|
|
392
392
|
},
|
|
393
393
|
...intercepted.undos
|
|
394
394
|
];
|
|
395
|
-
if (sequenceExecute(redoMutations, commandService)) {
|
|
395
|
+
if (sequenceExecute(redoMutations, commandService).result) {
|
|
396
396
|
undoRedoService.pushUndoRedo({
|
|
397
397
|
unitID: unitId,
|
|
398
398
|
undoMutations,
|
|
@@ -405,7 +405,7 @@ const SetSheetDrawingCommand = {
|
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
//#endregion
|
|
408
|
-
//#region \0@oxc-project+runtime@0.
|
|
408
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
409
409
|
function __decorateParam(paramIndex, decorator) {
|
|
410
410
|
return function(target, key) {
|
|
411
411
|
decorator(target, key, paramIndex);
|
|
@@ -413,7 +413,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
//#endregion
|
|
416
|
-
//#region \0@oxc-project+runtime@0.
|
|
416
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
417
417
|
function __decorate(decorators, target, key, desc) {
|
|
418
418
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
419
419
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -505,7 +505,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
505
505
|
unitId: jsonOpUnitId,
|
|
506
506
|
subUnitId: jsonOpSubUnitId,
|
|
507
507
|
objects,
|
|
508
|
-
type:
|
|
508
|
+
type: 1
|
|
509
509
|
}
|
|
510
510
|
}],
|
|
511
511
|
undos: [{
|
|
@@ -515,7 +515,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
515
515
|
unitId: jsonOpUnitId,
|
|
516
516
|
subUnitId: jsonOpSubUnitId,
|
|
517
517
|
objects,
|
|
518
|
-
type:
|
|
518
|
+
type: 0
|
|
519
519
|
}
|
|
520
520
|
}]
|
|
521
521
|
};
|
|
@@ -549,7 +549,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
549
549
|
unitId: jsonOpUnitId,
|
|
550
550
|
subUnitId: jsonOpSubUnitId,
|
|
551
551
|
objects,
|
|
552
|
-
type:
|
|
552
|
+
type: 0
|
|
553
553
|
}
|
|
554
554
|
}],
|
|
555
555
|
undos: [{
|
|
@@ -559,7 +559,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
559
559
|
unitId: jsonOpUnitId,
|
|
560
560
|
subUnitId: jsonOpSubUnitId,
|
|
561
561
|
objects,
|
|
562
|
-
type:
|
|
562
|
+
type: 1
|
|
563
563
|
}
|
|
564
564
|
}]
|
|
565
565
|
};
|
|
@@ -583,7 +583,7 @@ SheetsDrawingLoadController = __decorate([
|
|
|
583
583
|
//#endregion
|
|
584
584
|
//#region package.json
|
|
585
585
|
var name = "@univerjs/sheets-drawing";
|
|
586
|
-
var version = "0.
|
|
586
|
+
var version = "0.22.0";
|
|
587
587
|
|
|
588
588
|
//#endregion
|
|
589
589
|
//#region src/config/config.ts
|
|
@@ -607,7 +607,7 @@ const configSymbol = Symbol(SHEETS_DRAWING_PLUGIN_CONFIG_KEY);
|
|
|
607
607
|
const defaultPluginConfig = {};
|
|
608
608
|
|
|
609
609
|
//#endregion
|
|
610
|
-
//#region \0@oxc-project+runtime@0.
|
|
610
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
611
611
|
function _typeof(o) {
|
|
612
612
|
"@babel/helpers - typeof";
|
|
613
613
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -618,7 +618,7 @@ function _typeof(o) {
|
|
|
618
618
|
}
|
|
619
619
|
|
|
620
620
|
//#endregion
|
|
621
|
-
//#region \0@oxc-project+runtime@0.
|
|
621
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
622
622
|
function toPrimitive(t, r) {
|
|
623
623
|
if ("object" != _typeof(t) || !t) return t;
|
|
624
624
|
var e = t[Symbol.toPrimitive];
|
|
@@ -631,14 +631,14 @@ function toPrimitive(t, r) {
|
|
|
631
631
|
}
|
|
632
632
|
|
|
633
633
|
//#endregion
|
|
634
|
-
//#region \0@oxc-project+runtime@0.
|
|
634
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
635
635
|
function toPropertyKey(t) {
|
|
636
636
|
var i = toPrimitive(t, "string");
|
|
637
637
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
//#endregion
|
|
641
|
-
//#region \0@oxc-project+runtime@0.
|
|
641
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
642
642
|
function _defineProperty(e, r, t) {
|
|
643
643
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
644
644
|
value: t,
|
package/lib/facade.js
CHANGED
|
@@ -5,7 +5,7 @@ import { SheetSkeletonService, convertPositionCellToSheetOverGrid, convertPositi
|
|
|
5
5
|
import { ISheetDrawingService, InsertSheetDrawingCommand, RemoveSheetDrawingCommand, SetDrawingArrangeCommand, SetSheetDrawingCommand, SheetDrawingAnchorType, transformToAxisAlignPosition } from "@univerjs/sheets-drawing";
|
|
6
6
|
import { FWorksheet } from "@univerjs/sheets/facade";
|
|
7
7
|
|
|
8
|
-
//#region \0@oxc-project+runtime@0.
|
|
8
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
9
9
|
function _typeof(o) {
|
|
10
10
|
"@babel/helpers - typeof";
|
|
11
11
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -16,7 +16,7 @@ function _typeof(o) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
|
-
//#region \0@oxc-project+runtime@0.
|
|
19
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
20
20
|
function toPrimitive(t, r) {
|
|
21
21
|
if ("object" != _typeof(t) || !t) return t;
|
|
22
22
|
var e = t[Symbol.toPrimitive];
|
|
@@ -29,14 +29,14 @@ function toPrimitive(t, r) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
|
-
//#region \0@oxc-project+runtime@0.
|
|
32
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
33
33
|
function toPropertyKey(t) {
|
|
34
34
|
var i = toPrimitive(t, "string");
|
|
35
35
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region \0@oxc-project+runtime@0.
|
|
39
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
40
40
|
function _defineProperty(e, r, t) {
|
|
41
41
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
42
42
|
value: t,
|
|
@@ -47,7 +47,7 @@ function _defineProperty(e, r, t) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
|
-
//#region \0@oxc-project+runtime@0.
|
|
50
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
51
51
|
function __decorateParam(paramIndex, decorator) {
|
|
52
52
|
return function(target, key) {
|
|
53
53
|
decorator(target, key, paramIndex);
|
|
@@ -55,7 +55,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
//#endregion
|
|
58
|
-
//#region \0@oxc-project+runtime@0.
|
|
58
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
59
59
|
function __decorate(decorators, target, key, desc) {
|
|
60
60
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
61
61
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
package/lib/index.js
CHANGED
|
@@ -103,27 +103,27 @@ const SetDrawingApplyMutation = {
|
|
|
103
103
|
drawingManagerService.applyJson1(unitId, subUnitId, op);
|
|
104
104
|
sheetDrawingService.applyJson1(unitId, subUnitId, op);
|
|
105
105
|
switch (type) {
|
|
106
|
-
case
|
|
106
|
+
case 0:
|
|
107
107
|
drawingManagerService.addNotification(objects);
|
|
108
108
|
sheetDrawingService.addNotification(objects);
|
|
109
109
|
break;
|
|
110
|
-
case
|
|
110
|
+
case 1:
|
|
111
111
|
drawingManagerService.removeNotification(objects);
|
|
112
112
|
sheetDrawingService.removeNotification(objects);
|
|
113
113
|
break;
|
|
114
|
-
case
|
|
114
|
+
case 2:
|
|
115
115
|
drawingManagerService.updateNotification(objects);
|
|
116
116
|
sheetDrawingService.updateNotification(objects);
|
|
117
117
|
break;
|
|
118
|
-
case
|
|
118
|
+
case 3:
|
|
119
119
|
drawingManagerService.orderNotification(objects);
|
|
120
120
|
sheetDrawingService.orderNotification(objects);
|
|
121
121
|
break;
|
|
122
|
-
case
|
|
122
|
+
case 4:
|
|
123
123
|
drawingManagerService.groupUpdateNotification(objects);
|
|
124
124
|
sheetDrawingService.groupUpdateNotification(objects);
|
|
125
125
|
break;
|
|
126
|
-
case
|
|
126
|
+
case 5:
|
|
127
127
|
drawingManagerService.ungroupUpdateNotification(objects);
|
|
128
128
|
sheetDrawingService.ungroupUpdateNotification(objects);
|
|
129
129
|
break;
|
|
@@ -174,7 +174,7 @@ const InsertSheetDrawingCommand = {
|
|
|
174
174
|
subUnitId,
|
|
175
175
|
op: redo,
|
|
176
176
|
objects,
|
|
177
|
-
type:
|
|
177
|
+
type: 0
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
180
|
{
|
|
@@ -192,7 +192,7 @@ const InsertSheetDrawingCommand = {
|
|
|
192
192
|
subUnitId,
|
|
193
193
|
op: undo,
|
|
194
194
|
objects,
|
|
195
|
-
type:
|
|
195
|
+
type: 1
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
198
|
{
|
|
@@ -201,7 +201,7 @@ const InsertSheetDrawingCommand = {
|
|
|
201
201
|
},
|
|
202
202
|
...intercepted.undos
|
|
203
203
|
];
|
|
204
|
-
if (sequenceExecute(redoMutations, commandService)) {
|
|
204
|
+
if (sequenceExecute(redoMutations, commandService).result) {
|
|
205
205
|
undoRedoService.pushUndoRedo({
|
|
206
206
|
unitID: unitId,
|
|
207
207
|
undoMutations,
|
|
@@ -240,7 +240,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
240
240
|
subUnitId,
|
|
241
241
|
op: redo,
|
|
242
242
|
objects,
|
|
243
|
-
type:
|
|
243
|
+
type: 1
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
246
|
{
|
|
@@ -258,7 +258,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
258
258
|
subUnitId,
|
|
259
259
|
op: undo,
|
|
260
260
|
objects,
|
|
261
|
-
type:
|
|
261
|
+
type: 0
|
|
262
262
|
}
|
|
263
263
|
},
|
|
264
264
|
{
|
|
@@ -267,7 +267,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
267
267
|
},
|
|
268
268
|
...intercepted.undos
|
|
269
269
|
];
|
|
270
|
-
if (sequenceExecute(redoMutations, commandService)) {
|
|
270
|
+
if (sequenceExecute(redoMutations, commandService).result) {
|
|
271
271
|
undoRedoService.pushUndoRedo({
|
|
272
272
|
unitID: unitId,
|
|
273
273
|
undoMutations,
|
|
@@ -307,7 +307,7 @@ const SetDrawingArrangeCommand = {
|
|
|
307
307
|
unitId,
|
|
308
308
|
subUnitId,
|
|
309
309
|
objects,
|
|
310
|
-
type:
|
|
310
|
+
type: 3
|
|
311
311
|
})) {
|
|
312
312
|
undoRedoService.pushUndoRedo({
|
|
313
313
|
unitID: unitId,
|
|
@@ -318,7 +318,7 @@ const SetDrawingArrangeCommand = {
|
|
|
318
318
|
unitId,
|
|
319
319
|
subUnitId,
|
|
320
320
|
objects,
|
|
321
|
-
type:
|
|
321
|
+
type: 3
|
|
322
322
|
}
|
|
323
323
|
}],
|
|
324
324
|
redoMutations: [{
|
|
@@ -328,7 +328,7 @@ const SetDrawingArrangeCommand = {
|
|
|
328
328
|
unitId,
|
|
329
329
|
subUnitId,
|
|
330
330
|
objects,
|
|
331
|
-
type:
|
|
331
|
+
type: 3
|
|
332
332
|
}
|
|
333
333
|
}]
|
|
334
334
|
});
|
|
@@ -365,7 +365,7 @@ const SetSheetDrawingCommand = {
|
|
|
365
365
|
subUnitId,
|
|
366
366
|
op: redo,
|
|
367
367
|
objects,
|
|
368
|
-
type:
|
|
368
|
+
type: 2
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
371
|
{
|
|
@@ -383,7 +383,7 @@ const SetSheetDrawingCommand = {
|
|
|
383
383
|
subUnitId,
|
|
384
384
|
op: undo,
|
|
385
385
|
objects,
|
|
386
|
-
type:
|
|
386
|
+
type: 2
|
|
387
387
|
}
|
|
388
388
|
},
|
|
389
389
|
{
|
|
@@ -392,7 +392,7 @@ const SetSheetDrawingCommand = {
|
|
|
392
392
|
},
|
|
393
393
|
...intercepted.undos
|
|
394
394
|
];
|
|
395
|
-
if (sequenceExecute(redoMutations, commandService)) {
|
|
395
|
+
if (sequenceExecute(redoMutations, commandService).result) {
|
|
396
396
|
undoRedoService.pushUndoRedo({
|
|
397
397
|
unitID: unitId,
|
|
398
398
|
undoMutations,
|
|
@@ -405,7 +405,7 @@ const SetSheetDrawingCommand = {
|
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
//#endregion
|
|
408
|
-
//#region \0@oxc-project+runtime@0.
|
|
408
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
409
409
|
function __decorateParam(paramIndex, decorator) {
|
|
410
410
|
return function(target, key) {
|
|
411
411
|
decorator(target, key, paramIndex);
|
|
@@ -413,7 +413,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
//#endregion
|
|
416
|
-
//#region \0@oxc-project+runtime@0.
|
|
416
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
417
417
|
function __decorate(decorators, target, key, desc) {
|
|
418
418
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
419
419
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -505,7 +505,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
505
505
|
unitId: jsonOpUnitId,
|
|
506
506
|
subUnitId: jsonOpSubUnitId,
|
|
507
507
|
objects,
|
|
508
|
-
type:
|
|
508
|
+
type: 1
|
|
509
509
|
}
|
|
510
510
|
}],
|
|
511
511
|
undos: [{
|
|
@@ -515,7 +515,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
515
515
|
unitId: jsonOpUnitId,
|
|
516
516
|
subUnitId: jsonOpSubUnitId,
|
|
517
517
|
objects,
|
|
518
|
-
type:
|
|
518
|
+
type: 0
|
|
519
519
|
}
|
|
520
520
|
}]
|
|
521
521
|
};
|
|
@@ -549,7 +549,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
549
549
|
unitId: jsonOpUnitId,
|
|
550
550
|
subUnitId: jsonOpSubUnitId,
|
|
551
551
|
objects,
|
|
552
|
-
type:
|
|
552
|
+
type: 0
|
|
553
553
|
}
|
|
554
554
|
}],
|
|
555
555
|
undos: [{
|
|
@@ -559,7 +559,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends Disp
|
|
|
559
559
|
unitId: jsonOpUnitId,
|
|
560
560
|
subUnitId: jsonOpSubUnitId,
|
|
561
561
|
objects,
|
|
562
|
-
type:
|
|
562
|
+
type: 1
|
|
563
563
|
}
|
|
564
564
|
}]
|
|
565
565
|
};
|
|
@@ -583,7 +583,7 @@ SheetsDrawingLoadController = __decorate([
|
|
|
583
583
|
//#endregion
|
|
584
584
|
//#region package.json
|
|
585
585
|
var name = "@univerjs/sheets-drawing";
|
|
586
|
-
var version = "0.
|
|
586
|
+
var version = "0.22.0";
|
|
587
587
|
|
|
588
588
|
//#endregion
|
|
589
589
|
//#region src/config/config.ts
|
|
@@ -607,7 +607,7 @@ const configSymbol = Symbol(SHEETS_DRAWING_PLUGIN_CONFIG_KEY);
|
|
|
607
607
|
const defaultPluginConfig = {};
|
|
608
608
|
|
|
609
609
|
//#endregion
|
|
610
|
-
//#region \0@oxc-project+runtime@0.
|
|
610
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
611
611
|
function _typeof(o) {
|
|
612
612
|
"@babel/helpers - typeof";
|
|
613
613
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -618,7 +618,7 @@ function _typeof(o) {
|
|
|
618
618
|
}
|
|
619
619
|
|
|
620
620
|
//#endregion
|
|
621
|
-
//#region \0@oxc-project+runtime@0.
|
|
621
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
622
622
|
function toPrimitive(t, r) {
|
|
623
623
|
if ("object" != _typeof(t) || !t) return t;
|
|
624
624
|
var e = t[Symbol.toPrimitive];
|
|
@@ -631,14 +631,14 @@ function toPrimitive(t, r) {
|
|
|
631
631
|
}
|
|
632
632
|
|
|
633
633
|
//#endregion
|
|
634
|
-
//#region \0@oxc-project+runtime@0.
|
|
634
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
635
635
|
function toPropertyKey(t) {
|
|
636
636
|
var i = toPrimitive(t, "string");
|
|
637
637
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
//#endregion
|
|
641
|
-
//#region \0@oxc-project+runtime@0.
|
|
641
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
642
642
|
function _defineProperty(e, r, t) {
|
|
643
643
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
644
644
|
value: t,
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/sheets`),require(`@univerjs/core`),require(`@univerjs/drawing`),require(`@univerjs/engine-render`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/sheets`,`@univerjs/core`,`@univerjs/drawing`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsDrawing={},e.UniverSheets,e.UniverCore,e.UniverDrawing,e.UniverEngineRender))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e,n){if(!n)return;let{unitId:r,sheetId:i,skeleton:a}=n,{from:o,to:s,flipY:c=!1,flipX:l=!1,angle:u=0,skewX:d=0,skewY:f=0}=e,{left:p,top:m,width:h,height:g}=(0,t.convertPositionSheetOverGridToAbsolute)(r,i,{from:o,to:s},a),_=a.rowHeaderWidth+a.columnTotalWidth,v=a.columnHeaderHeight+a.rowTotalHeight;return p+h>_&&(p=_-h),m+g>v&&(m=v-g),{flipY:c,flipX:l,angle:u,skewX:d,skewY:f,left:p,top:m,width:h,height:g}}function o(e,t){let{left:n=0,top:r=0,width:i=0,height:a=0,flipY:o=!1,flipX:s=!1,angle:c=0,skewX:l=0,skewY:u=0}=e;return{flipY:o,flipX:s,angle:c,skewX:l,skewY:u,from:t.getCellIndexAndOffsetByPosition(n,r),to:t.getCellIndexAndOffsetByPosition(n+i,r+a)}}function s(e,t){let{left:n=0,top:r=0,width:i=0,height:a=0,angle:s=0}=e,c=(s%360+360)%360;return o(c>=45&&c<135||c>=225&&c<315?{...e,left:n+i/2-a/2,top:r+a/2-i/2,width:a,height:i}:e,t)}let c=function(e){return e.Position=`0`,e.Both=`1`,e.None=`2`,e}({});var l=class extends r.UnitDrawingService{};let u=(0,n.createIdentifier)(`sheets-drawing.sheet-drawing.service`),d=function(e){return e[e.INSERT=0]=`INSERT`,e[e.REMOVE=1]=`REMOVE`,e[e.UPDATE=2]=`UPDATE`,e[e.ARRANGE=3]=`ARRANGE`,e[e.GROUP=4]=`GROUP`,e[e.UNGROUP=5]=`UNGROUP`,e}({}),f={id:`sheet.mutation.set-drawing-apply`,type:n.CommandType.MUTATION,handler:(e,t)=>{let n=e.get(r.IDrawingManagerService),i=e.get(u),{op:a,unitId:o,subUnitId:s,type:c,objects:l}=t;switch(n.applyJson1(o,s,a),i.applyJson1(o,s,a),c){case d.INSERT:n.addNotification(l),i.addNotification(l);break;case d.REMOVE:n.removeNotification(l),i.removeNotification(l);break;case d.UPDATE:n.updateNotification(l),i.updateNotification(l);break;case d.ARRANGE:n.orderNotification(l),i.orderNotification(l);break;case d.GROUP:n.groupUpdateNotification(l),i.groupUpdateNotification(l);break;case d.UNGROUP:n.ungroupUpdateNotification(l),i.ungroupUpdateNotification(l);break}return!0}},p={id:`sheet.operation.clear-drawing-transformer`,type:n.CommandType.MUTATION,handler:(e,t)=>{let n=e.get(i.IRenderManagerService);return t.forEach(e=>{var t;(t=n.getRenderById(e))==null||(t=t.scene.getTransformer())==null||t.debounceRefreshControls()}),!0}},m={id:`sheet.command.insert-sheet-image`,type:n.CommandType.COMMAND,handler:(e,r)=>{var i,a;if(!r)return!1;let o=e.get(n.ICommandService),s=e.get(n.IUndoRedoService),c=e.get(u),l=e.get(t.SheetInterceptorService),h=r.drawings,{unitId:g,subUnitId:_,undo:v,redo:y,objects:b}=c.getBatchAddOp(h),x=l.onCommandExecute({id:m.id,params:r}),S=[...(i=x.preRedos)==null?[]:i,{id:f.id,params:{unitId:g,subUnitId:_,op:y,objects:b,type:d.INSERT}},{id:p.id,params:[g]},...x.redos],C=[...(a=x.preUndos)==null?[]:a,{id:f.id,params:{unitId:g,subUnitId:_,op:v,objects:b,type:d.REMOVE}},{id:p.id,params:[g]},...x.undos];return(0,n.sequenceExecute)(S,o)?(s.pushUndoRedo({unitID:g,undoMutations:C,redoMutations:S}),!0):!1}},h={id:`sheet.command.remove-sheet-image`,type:n.CommandType.COMMAND,handler:(e,r)=>{var i,a;if(!r)return!1;let o=e.get(n.ICommandService),s=e.get(n.IUndoRedoService),c=e.get(t.SheetInterceptorService),l=e.get(u),{drawings:m}=r,{unitId:g,subUnitId:_,undo:v,redo:y,objects:b}=l.getBatchRemoveOp(m),x=c.onCommandExecute({id:h.id,params:r}),S=[...(i=x.preRedos)==null?[]:i,{id:f.id,params:{unitId:g,subUnitId:_,op:y,objects:b,type:d.REMOVE}},{id:p.id,params:[g]},...x.redos],C=[...(a=x.preUndos)==null?[]:a,{id:f.id,params:{unitId:g,subUnitId:_,op:v,objects:b,type:d.INSERT}},{id:p.id,params:[g]},...x.undos];return(0,n.sequenceExecute)(S,o)?(s.pushUndoRedo({unitID:g,undoMutations:C,redoMutations:S}),!0):!1}},g={id:`sheet.command.set-drawing-arrange`,type:n.CommandType.COMMAND,handler:(e,t)=>{let r=e.get(n.ICommandService),i=e.get(n.IUndoRedoService);if(!t)return!1;let a=e.get(u),{unitId:o,subUnitId:s,drawingIds:c,arrangeType:l}=t,p={unitId:o,subUnitId:s,drawingIds:c},m;if(l===n.ArrangeTypeEnum.forward?m=a.getForwardDrawingsOp(p):l===n.ArrangeTypeEnum.backward?m=a.getBackwardDrawingOp(p):l===n.ArrangeTypeEnum.front?m=a.getFrontDrawingsOp(p):l===n.ArrangeTypeEnum.back&&(m=a.getBackDrawingsOp(p)),m==null)return!1;let{objects:h,redo:g,undo:_}=m;return r.syncExecuteCommand(f.id,{op:g,unitId:o,subUnitId:s,objects:h,type:d.ARRANGE})?(i.pushUndoRedo({unitID:o,undoMutations:[{id:f.id,params:{op:_,unitId:o,subUnitId:s,objects:h,type:d.ARRANGE}}],redoMutations:[{id:f.id,params:{op:g,unitId:o,subUnitId:s,objects:h,type:d.ARRANGE}}]}),!0):!1}},_={id:`sheet.command.set-sheet-image`,type:n.CommandType.COMMAND,handler:(e,r)=>{var i,a;if(!r)return!1;let o=e.get(n.ICommandService),s=e.get(n.IUndoRedoService),c=e.get(u),l=e.get(t.SheetInterceptorService),{drawings:m}=r,{unitId:h,subUnitId:g,undo:v,redo:y,objects:b}=c.getBatchUpdateOp(m),x=l.onCommandExecute({id:_.id,params:r}),S=[...(i=x.preRedos)==null?[]:i,{id:f.id,params:{unitId:h,subUnitId:g,op:y,objects:b,type:d.UPDATE}},{id:p.id,params:[h]},...x.redos],C=[...(a=x.preUndos)==null?[]:a,{id:f.id,params:{unitId:h,subUnitId:g,op:v,objects:b,type:d.UPDATE}},{id:p.id,params:[h]},...x.undos];return(0,n.sequenceExecute)(S,o)?(s.pushUndoRedo({unitID:h,undoMutations:C,redoMutations:S}),!0):!1}};function v(e,t){return function(n,r){t(n,r,e)}}function y(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let b=`SHEET_DRAWING_PLUGIN`,x=class extends n.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._commandService=n,this._sheetDrawingService=r,this._drawingManagerService=i,this._resourceManagerService=a,this._initCommands(),this._initSnapshot(),this._initSheetChange(),this.disposeWithMe(this._commandService.registerCommand(f))}_initCommands(){[_,m,h,g,p].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_initSnapshot(){let e=(e,t)=>{let n=t||this._sheetDrawingService.getDrawingDataForUnit(e);return n?JSON.stringify(n):``},t=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:b,businesses:[n.UniverInstanceType.UNIVER_SHEET],toJson:(t,n)=>e(t,n),parseJson:e=>t(e),onUnLoad:e=>{this._sheetDrawingService.removeDrawingDataForUnit(e),this._drawingManagerService.removeDrawingDataForUnit(e)},onLoad:(e,t)=>{this._sheetDrawingService.registerDrawingData(e,t),this._drawingManagerService.registerDrawingData(e,t)}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===t.RemoveSheetCommand.id){var r;let t=e.params,i=t.unitId||this._univerInstanceService.getCurrentUnitOfType(n.UniverInstanceType.UNIVER_SHEET).getUnitId(),a=t.subUnitId||((r=this._univerInstanceService.getCurrentUnitOfType(n.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:r.getSheetId());if(!i||!a)return{redos:[],undos:[]};let o=this._sheetDrawingService.getDrawingData(i,a),s=Object.values(o).filter(e=>e.drawingType!==n.DrawingTypeEnum.DRAWING_CHART);if(s.length===0)return{redos:[],undos:[]};let{unitId:c,subUnitId:l,undo:u,redo:p,objects:m}=this._sheetDrawingService.getBatchRemoveOp(s);return{redos:[{id:f.id,params:{op:p,unitId:c,subUnitId:l,objects:m,type:d.REMOVE}}],undos:[{id:f.id,params:{op:u,unitId:c,subUnitId:l,objects:m,type:d.INSERT}}]}}else if(e.id===t.CopySheetCommand.id){let{unitId:t,subUnitId:r,targetSubUnitId:i}=e.params;if(!t||!r||!i)return{redos:[],undos:[]};let a=this._sheetDrawingService.getDrawingData(t,r),o=Object.values(a).filter(e=>e.drawingType!==n.DrawingTypeEnum.DRAWING_CHART).map(e=>({...e,subUnitId:i,drawingId:(0,n.generateRandomId)(6)}));if(o.length===0)return{redos:[],undos:[]};let{unitId:s,subUnitId:c,undo:l,redo:u,objects:p}=this._sheetDrawingService.getBatchAddOp(o);return{redos:[{id:f.id,params:{op:u,unitId:s,subUnitId:c,objects:p,type:d.INSERT}}],undos:[{id:f.id,params:{op:l,unitId:s,subUnitId:c,objects:p,type:d.REMOVE}}]}}return{redos:[],undos:[]}}}))}};x=y([v(0,(0,n.Inject)(t.SheetInterceptorService)),v(1,(0,n.Inject)(n.IUniverInstanceService)),v(2,n.ICommandService),v(3,u),v(4,r.IDrawingManagerService),v(5,n.IResourceManagerService)],x);var S=`@univerjs/sheets-drawing`,C=`0.21.1`;let w=`sheets-drawing.config`;Symbol(w);let T={};function E(e){"@babel/helpers - typeof";return E=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},E(e)}function D(e,t){if(E(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(E(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function O(e){var t=D(e,`string`);return E(t)==`symbol`?t:t+``}function k(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let A=class extends n.Plugin{constructor(e=T,t,r){super(),this._config=e,this._injector=t,this._configService=r;let{...i}=(0,n.merge)({},T,this._config);this._configService.setConfig(w,i)}onStarting(){[[x],[u,{useClass:l}]].forEach(e=>this._injector.add(e)),this._injector.get(x)}};k(A,`pluginName`,b),k(A,`packageName`,S),k(A,`version`,C),k(A,`type`,n.UniverInstanceType.UNIVER_SHEET),A=y([(0,n.DependentOn)(r.UniverDrawingPlugin),v(1,(0,n.Inject)(n.Injector)),v(2,n.IConfigService)],A),e.ClearSheetDrawingTransformerOperation=p,e.DrawingApplyType=d,e.ISheetDrawingService=u,e.InsertSheetDrawingCommand=m,e.RemoveSheetDrawingCommand=h,e.SHEET_DRAWING_PLUGIN=b,e.SetDrawingApplyMutation=f,e.SetDrawingArrangeCommand=g,e.SetSheetDrawingCommand=_,e.SheetDrawingAnchorType=c,Object.defineProperty(e,`UniverSheetsDrawingPlugin`,{enumerable:!0,get:function(){return A}}),e.drawingPositionToTransform=a,e.transformToAxisAlignPosition=s,e.transformToDrawingPosition=o});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/sheets`),require(`@univerjs/core`),require(`@univerjs/drawing`),require(`@univerjs/engine-render`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/sheets`,`@univerjs/core`,`@univerjs/drawing`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsDrawing={},e.UniverSheets,e.UniverCore,e.UniverDrawing,e.UniverEngineRender))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e,n){if(!n)return;let{unitId:r,sheetId:i,skeleton:a}=n,{from:o,to:s,flipY:c=!1,flipX:l=!1,angle:u=0,skewX:d=0,skewY:f=0}=e,{left:p,top:m,width:h,height:g}=(0,t.convertPositionSheetOverGridToAbsolute)(r,i,{from:o,to:s},a),_=a.rowHeaderWidth+a.columnTotalWidth,v=a.columnHeaderHeight+a.rowTotalHeight;return p+h>_&&(p=_-h),m+g>v&&(m=v-g),{flipY:c,flipX:l,angle:u,skewX:d,skewY:f,left:p,top:m,width:h,height:g}}function o(e,t){let{left:n=0,top:r=0,width:i=0,height:a=0,flipY:o=!1,flipX:s=!1,angle:c=0,skewX:l=0,skewY:u=0}=e;return{flipY:o,flipX:s,angle:c,skewX:l,skewY:u,from:t.getCellIndexAndOffsetByPosition(n,r),to:t.getCellIndexAndOffsetByPosition(n+i,r+a)}}function s(e,t){let{left:n=0,top:r=0,width:i=0,height:a=0,angle:s=0}=e,c=(s%360+360)%360;return o(c>=45&&c<135||c>=225&&c<315?{...e,left:n+i/2-a/2,top:r+a/2-i/2,width:a,height:i}:e,t)}let c=function(e){return e.Position=`0`,e.Both=`1`,e.None=`2`,e}({});var l=class extends r.UnitDrawingService{};let u=(0,n.createIdentifier)(`sheets-drawing.sheet-drawing.service`),d=function(e){return e[e.INSERT=0]=`INSERT`,e[e.REMOVE=1]=`REMOVE`,e[e.UPDATE=2]=`UPDATE`,e[e.ARRANGE=3]=`ARRANGE`,e[e.GROUP=4]=`GROUP`,e[e.UNGROUP=5]=`UNGROUP`,e}({}),f={id:`sheet.mutation.set-drawing-apply`,type:n.CommandType.MUTATION,handler:(e,t)=>{let n=e.get(r.IDrawingManagerService),i=e.get(u),{op:a,unitId:o,subUnitId:s,type:c,objects:l}=t;switch(n.applyJson1(o,s,a),i.applyJson1(o,s,a),c){case 0:n.addNotification(l),i.addNotification(l);break;case 1:n.removeNotification(l),i.removeNotification(l);break;case 2:n.updateNotification(l),i.updateNotification(l);break;case 3:n.orderNotification(l),i.orderNotification(l);break;case 4:n.groupUpdateNotification(l),i.groupUpdateNotification(l);break;case 5:n.ungroupUpdateNotification(l),i.ungroupUpdateNotification(l);break}return!0}},p={id:`sheet.operation.clear-drawing-transformer`,type:n.CommandType.MUTATION,handler:(e,t)=>{let n=e.get(i.IRenderManagerService);return t.forEach(e=>{var t;(t=n.getRenderById(e))==null||(t=t.scene.getTransformer())==null||t.debounceRefreshControls()}),!0}},m={id:`sheet.command.insert-sheet-image`,type:n.CommandType.COMMAND,handler:(e,r)=>{var i,a;if(!r)return!1;let o=e.get(n.ICommandService),s=e.get(n.IUndoRedoService),c=e.get(u),l=e.get(t.SheetInterceptorService),d=r.drawings,{unitId:h,subUnitId:g,undo:_,redo:v,objects:y}=c.getBatchAddOp(d),b=l.onCommandExecute({id:m.id,params:r}),x=[...(i=b.preRedos)==null?[]:i,{id:f.id,params:{unitId:h,subUnitId:g,op:v,objects:y,type:0}},{id:p.id,params:[h]},...b.redos],S=[...(a=b.preUndos)==null?[]:a,{id:f.id,params:{unitId:h,subUnitId:g,op:_,objects:y,type:1}},{id:p.id,params:[h]},...b.undos];return(0,n.sequenceExecute)(x,o).result?(s.pushUndoRedo({unitID:h,undoMutations:S,redoMutations:x}),!0):!1}},h={id:`sheet.command.remove-sheet-image`,type:n.CommandType.COMMAND,handler:(e,r)=>{var i,a;if(!r)return!1;let o=e.get(n.ICommandService),s=e.get(n.IUndoRedoService),c=e.get(t.SheetInterceptorService),l=e.get(u),{drawings:d}=r,{unitId:m,subUnitId:g,undo:_,redo:v,objects:y}=l.getBatchRemoveOp(d),b=c.onCommandExecute({id:h.id,params:r}),x=[...(i=b.preRedos)==null?[]:i,{id:f.id,params:{unitId:m,subUnitId:g,op:v,objects:y,type:1}},{id:p.id,params:[m]},...b.redos],S=[...(a=b.preUndos)==null?[]:a,{id:f.id,params:{unitId:m,subUnitId:g,op:_,objects:y,type:0}},{id:p.id,params:[m]},...b.undos];return(0,n.sequenceExecute)(x,o).result?(s.pushUndoRedo({unitID:m,undoMutations:S,redoMutations:x}),!0):!1}},g={id:`sheet.command.set-drawing-arrange`,type:n.CommandType.COMMAND,handler:(e,t)=>{let r=e.get(n.ICommandService),i=e.get(n.IUndoRedoService);if(!t)return!1;let a=e.get(u),{unitId:o,subUnitId:s,drawingIds:c,arrangeType:l}=t,d={unitId:o,subUnitId:s,drawingIds:c},p;if(l===n.ArrangeTypeEnum.forward?p=a.getForwardDrawingsOp(d):l===n.ArrangeTypeEnum.backward?p=a.getBackwardDrawingOp(d):l===n.ArrangeTypeEnum.front?p=a.getFrontDrawingsOp(d):l===n.ArrangeTypeEnum.back&&(p=a.getBackDrawingsOp(d)),p==null)return!1;let{objects:m,redo:h,undo:g}=p;return r.syncExecuteCommand(f.id,{op:h,unitId:o,subUnitId:s,objects:m,type:3})?(i.pushUndoRedo({unitID:o,undoMutations:[{id:f.id,params:{op:g,unitId:o,subUnitId:s,objects:m,type:3}}],redoMutations:[{id:f.id,params:{op:h,unitId:o,subUnitId:s,objects:m,type:3}}]}),!0):!1}},_={id:`sheet.command.set-sheet-image`,type:n.CommandType.COMMAND,handler:(e,r)=>{var i,a;if(!r)return!1;let o=e.get(n.ICommandService),s=e.get(n.IUndoRedoService),c=e.get(u),l=e.get(t.SheetInterceptorService),{drawings:d}=r,{unitId:m,subUnitId:h,undo:g,redo:v,objects:y}=c.getBatchUpdateOp(d),b=l.onCommandExecute({id:_.id,params:r}),x=[...(i=b.preRedos)==null?[]:i,{id:f.id,params:{unitId:m,subUnitId:h,op:v,objects:y,type:2}},{id:p.id,params:[m]},...b.redos],S=[...(a=b.preUndos)==null?[]:a,{id:f.id,params:{unitId:m,subUnitId:h,op:g,objects:y,type:2}},{id:p.id,params:[m]},...b.undos];return(0,n.sequenceExecute)(x,o).result?(s.pushUndoRedo({unitID:m,undoMutations:S,redoMutations:x}),!0):!1}};function v(e,t){return function(n,r){t(n,r,e)}}function y(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let b=`SHEET_DRAWING_PLUGIN`,x=class extends n.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._commandService=n,this._sheetDrawingService=r,this._drawingManagerService=i,this._resourceManagerService=a,this._initCommands(),this._initSnapshot(),this._initSheetChange(),this.disposeWithMe(this._commandService.registerCommand(f))}_initCommands(){[_,m,h,g,p].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_initSnapshot(){let e=(e,t)=>{let n=t||this._sheetDrawingService.getDrawingDataForUnit(e);return n?JSON.stringify(n):``},t=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:b,businesses:[n.UniverInstanceType.UNIVER_SHEET],toJson:(t,n)=>e(t,n),parseJson:e=>t(e),onUnLoad:e=>{this._sheetDrawingService.removeDrawingDataForUnit(e),this._drawingManagerService.removeDrawingDataForUnit(e)},onLoad:(e,t)=>{this._sheetDrawingService.registerDrawingData(e,t),this._drawingManagerService.registerDrawingData(e,t)}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===t.RemoveSheetCommand.id){var r;let t=e.params,i=t.unitId||this._univerInstanceService.getCurrentUnitOfType(n.UniverInstanceType.UNIVER_SHEET).getUnitId(),a=t.subUnitId||((r=this._univerInstanceService.getCurrentUnitOfType(n.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:r.getSheetId());if(!i||!a)return{redos:[],undos:[]};let o=this._sheetDrawingService.getDrawingData(i,a),s=Object.values(o).filter(e=>e.drawingType!==n.DrawingTypeEnum.DRAWING_CHART);if(s.length===0)return{redos:[],undos:[]};let{unitId:c,subUnitId:l,undo:u,redo:d,objects:p}=this._sheetDrawingService.getBatchRemoveOp(s);return{redos:[{id:f.id,params:{op:d,unitId:c,subUnitId:l,objects:p,type:1}}],undos:[{id:f.id,params:{op:u,unitId:c,subUnitId:l,objects:p,type:0}}]}}else if(e.id===t.CopySheetCommand.id){let{unitId:t,subUnitId:r,targetSubUnitId:i}=e.params;if(!t||!r||!i)return{redos:[],undos:[]};let a=this._sheetDrawingService.getDrawingData(t,r),o=Object.values(a).filter(e=>e.drawingType!==n.DrawingTypeEnum.DRAWING_CHART).map(e=>({...e,subUnitId:i,drawingId:(0,n.generateRandomId)(6)}));if(o.length===0)return{redos:[],undos:[]};let{unitId:s,subUnitId:c,undo:l,redo:u,objects:d}=this._sheetDrawingService.getBatchAddOp(o);return{redos:[{id:f.id,params:{op:u,unitId:s,subUnitId:c,objects:d,type:0}}],undos:[{id:f.id,params:{op:l,unitId:s,subUnitId:c,objects:d,type:1}}]}}return{redos:[],undos:[]}}}))}};x=y([v(0,(0,n.Inject)(t.SheetInterceptorService)),v(1,(0,n.Inject)(n.IUniverInstanceService)),v(2,n.ICommandService),v(3,u),v(4,r.IDrawingManagerService),v(5,n.IResourceManagerService)],x);var S=`@univerjs/sheets-drawing`,C=`0.22.0`;let w=`sheets-drawing.config`;Symbol(w);let T={};function E(e){"@babel/helpers - typeof";return E=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},E(e)}function D(e,t){if(E(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(E(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function O(e){var t=D(e,`string`);return E(t)==`symbol`?t:t+``}function k(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let A=class extends n.Plugin{constructor(e=T,t,r){super(),this._config=e,this._injector=t,this._configService=r;let{...i}=(0,n.merge)({},T,this._config);this._configService.setConfig(w,i)}onStarting(){[[x],[u,{useClass:l}]].forEach(e=>this._injector.add(e)),this._injector.get(x)}};k(A,`pluginName`,b),k(A,`packageName`,S),k(A,`version`,C),k(A,`type`,n.UniverInstanceType.UNIVER_SHEET),A=y([(0,n.DependentOn)(r.UniverDrawingPlugin),v(1,(0,n.Inject)(n.Injector)),v(2,n.IConfigService)],A),e.ClearSheetDrawingTransformerOperation=p,e.DrawingApplyType=d,e.ISheetDrawingService=u,e.InsertSheetDrawingCommand=m,e.RemoveSheetDrawingCommand=h,e.SHEET_DRAWING_PLUGIN=b,e.SetDrawingApplyMutation=f,e.SetDrawingArrangeCommand=g,e.SetSheetDrawingCommand=_,e.SheetDrawingAnchorType=c,Object.defineProperty(e,`UniverSheetsDrawingPlugin`,{enumerable:!0,get:function(){return A}}),e.drawingPositionToTransform=a,e.transformToAxisAlignPosition=s,e.transformToDrawingPosition=o});
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-drawing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "",
|
|
6
|
-
"author": "DreamNum <developer@univer.ai>",
|
|
5
|
+
"description": "Drawing model integration for Univer Sheets.",
|
|
6
|
+
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"funding": {
|
|
9
9
|
"type": "opencollective",
|
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/dream-num/univer/issues"
|
|
19
19
|
},
|
|
20
|
-
"keywords": [
|
|
20
|
+
"keywords": [
|
|
21
|
+
"univer",
|
|
22
|
+
"sheets",
|
|
23
|
+
"drawing",
|
|
24
|
+
"spreadsheet",
|
|
25
|
+
"plugin"
|
|
26
|
+
],
|
|
21
27
|
"exports": {
|
|
22
28
|
".": {
|
|
23
29
|
"import": "./lib/es/index.js",
|
|
@@ -53,15 +59,15 @@
|
|
|
53
59
|
"lib"
|
|
54
60
|
],
|
|
55
61
|
"dependencies": {
|
|
56
|
-
"@univerjs/drawing": "0.
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/core": "0.
|
|
59
|
-
"@univerjs/
|
|
62
|
+
"@univerjs/drawing": "0.22.0",
|
|
63
|
+
"@univerjs/engine-render": "0.22.0",
|
|
64
|
+
"@univerjs/core": "0.22.0",
|
|
65
|
+
"@univerjs/sheets": "0.22.0"
|
|
60
66
|
},
|
|
61
67
|
"devDependencies": {
|
|
62
|
-
"typescript": "^6.0.
|
|
63
|
-
"vitest": "^4.1.
|
|
64
|
-
"@univerjs-infra/shared": "0.
|
|
68
|
+
"typescript": "^6.0.3",
|
|
69
|
+
"vitest": "^4.1.5",
|
|
70
|
+
"@univerjs-infra/shared": "0.22.0"
|
|
65
71
|
},
|
|
66
72
|
"scripts": {
|
|
67
73
|
"test": "vitest run",
|