@univerjs/sheets-drawing 1.0.0-alpha.8 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +284 -21
- package/lib/cjs/index.js +252 -47
- package/lib/es/facade.js +285 -22
- package/lib/es/index.js +250 -49
- package/lib/facade.js +285 -22
- package/lib/index.js +250 -49
- package/lib/types/commands/commands/set-sheet-drawing-placement.command.d.ts +26 -0
- package/lib/types/facade/f-over-grid-image.d.ts +130 -4
- package/lib/types/facade/f-worksheet.d.ts +129 -1
- package/lib/types/index.d.ts +4 -0
- package/lib/types/services/sheet-drawing-placement.d.ts +86 -0
- package/lib/types/services/sheet-drawing.service.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
package/lib/cjs/index.js
CHANGED
|
@@ -154,7 +154,6 @@ const InsertSheetDrawingCommand = {
|
|
|
154
154
|
id: "sheet.command.insert-sheet-image",
|
|
155
155
|
type: _univerjs_core.CommandType.COMMAND,
|
|
156
156
|
handler: (accessor, params) => {
|
|
157
|
-
var _intercepted$preRedos, _intercepted$preUndos;
|
|
158
157
|
if (!params) return false;
|
|
159
158
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
160
159
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
@@ -167,7 +166,7 @@ const InsertSheetDrawingCommand = {
|
|
|
167
166
|
params
|
|
168
167
|
});
|
|
169
168
|
const redoMutations = [
|
|
170
|
-
...
|
|
169
|
+
...intercepted.preRedos ?? [],
|
|
171
170
|
{
|
|
172
171
|
id: SetDrawingApplyMutation.id,
|
|
173
172
|
params: {
|
|
@@ -185,7 +184,7 @@ const InsertSheetDrawingCommand = {
|
|
|
185
184
|
...intercepted.redos
|
|
186
185
|
];
|
|
187
186
|
const undoMutations = [
|
|
188
|
-
...
|
|
187
|
+
...intercepted.preUndos ?? [],
|
|
189
188
|
{
|
|
190
189
|
id: SetDrawingApplyMutation.id,
|
|
191
190
|
params: {
|
|
@@ -220,7 +219,6 @@ const RemoveSheetDrawingCommand = {
|
|
|
220
219
|
id: "sheet.command.remove-sheet-image",
|
|
221
220
|
type: _univerjs_core.CommandType.COMMAND,
|
|
222
221
|
handler: (accessor, params) => {
|
|
223
|
-
var _intercepted$preRedos, _intercepted$preUndos;
|
|
224
222
|
if (!params) return false;
|
|
225
223
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
226
224
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
@@ -234,7 +232,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
234
232
|
params
|
|
235
233
|
});
|
|
236
234
|
const redoMutations = [
|
|
237
|
-
...
|
|
235
|
+
...intercepted.preRedos ?? [],
|
|
238
236
|
{
|
|
239
237
|
id: SetDrawingApplyMutation.id,
|
|
240
238
|
params: {
|
|
@@ -252,7 +250,7 @@ const RemoveSheetDrawingCommand = {
|
|
|
252
250
|
...intercepted.redos
|
|
253
251
|
];
|
|
254
252
|
const undoMutations = [
|
|
255
|
-
...
|
|
253
|
+
...intercepted.preUndos ?? [],
|
|
256
254
|
{
|
|
257
255
|
id: SetDrawingApplyMutation.id,
|
|
258
256
|
params: {
|
|
@@ -340,6 +338,226 @@ const SetDrawingArrangeCommand = {
|
|
|
340
338
|
}
|
|
341
339
|
};
|
|
342
340
|
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/services/sheet-drawing-placement.ts
|
|
343
|
+
function getSheetDrawingPlacement(drawing) {
|
|
344
|
+
var _drawing$transform5, _drawing$transform6;
|
|
345
|
+
const anchorType = drawing.anchorType ?? "0";
|
|
346
|
+
if (anchorType === "2") {
|
|
347
|
+
var _drawing$transform, _drawing$transform2, _drawing$transform3, _drawing$transform4;
|
|
348
|
+
return {
|
|
349
|
+
kind: "2",
|
|
350
|
+
left: ((_drawing$transform = drawing.transform) === null || _drawing$transform === void 0 ? void 0 : _drawing$transform.left) ?? 0,
|
|
351
|
+
top: ((_drawing$transform2 = drawing.transform) === null || _drawing$transform2 === void 0 ? void 0 : _drawing$transform2.top) ?? 0,
|
|
352
|
+
width: ((_drawing$transform3 = drawing.transform) === null || _drawing$transform3 === void 0 ? void 0 : _drawing$transform3.width) ?? 0,
|
|
353
|
+
height: ((_drawing$transform4 = drawing.transform) === null || _drawing$transform4 === void 0 ? void 0 : _drawing$transform4.height) ?? 0
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
if (anchorType === "1") return {
|
|
357
|
+
kind: "1",
|
|
358
|
+
from: { ...drawing.sheetTransform.from },
|
|
359
|
+
to: { ...drawing.sheetTransform.to }
|
|
360
|
+
};
|
|
361
|
+
return {
|
|
362
|
+
kind: "0",
|
|
363
|
+
from: { ...drawing.sheetTransform.from },
|
|
364
|
+
width: ((_drawing$transform5 = drawing.transform) === null || _drawing$transform5 === void 0 ? void 0 : _drawing$transform5.width) ?? 0,
|
|
365
|
+
height: ((_drawing$transform6 = drawing.transform) === null || _drawing$transform6 === void 0 ? void 0 : _drawing$transform6.height) ?? 0
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function applySheetDrawingPlacement(drawing, input, skeleton) {
|
|
369
|
+
const placement = normalizeSheetDrawingPlacement(input, skeleton);
|
|
370
|
+
if (placement.kind === "2") {
|
|
371
|
+
const transform = withExistingTransform(drawing.transform, placement);
|
|
372
|
+
const sheetTransform = absoluteSheetTransform(placement, drawing.sheetTransform);
|
|
373
|
+
return {
|
|
374
|
+
...drawing,
|
|
375
|
+
anchorType: "2",
|
|
376
|
+
transform,
|
|
377
|
+
sheetTransform,
|
|
378
|
+
axisAlignSheetTransform: sheetTransform
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
if (!skeleton) throw new Error("SHEET_DRAWING_PLACEMENT_SKELETON_REQUIRED");
|
|
382
|
+
if (placement.kind === "0") {
|
|
383
|
+
const converted = (0, _univerjs_sheets.convertPositionCellToSheetOverGrid)(drawing.unitId, drawing.subUnitId, placement.from, placement.width, placement.height, skeleton);
|
|
384
|
+
const sheetTransform = withExistingSheetTransform(drawing.sheetTransform, converted.sheetTransform);
|
|
385
|
+
const transform = withExistingTransform(drawing.transform, converted.transform);
|
|
386
|
+
return {
|
|
387
|
+
...drawing,
|
|
388
|
+
anchorType: "0",
|
|
389
|
+
sheetTransform,
|
|
390
|
+
transform,
|
|
391
|
+
axisAlignSheetTransform: transformToAxisAlignPosition(transform, skeleton)
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
const sheetTransform = withExistingSheetTransform(drawing.sheetTransform, {
|
|
395
|
+
from: placement.from,
|
|
396
|
+
to: placement.to
|
|
397
|
+
});
|
|
398
|
+
const bounds = (0, _univerjs_sheets.convertPositionSheetOverGridToAbsolute)(drawing.unitId, drawing.subUnitId, sheetTransform, skeleton);
|
|
399
|
+
const transform = withExistingTransform(drawing.transform, bounds);
|
|
400
|
+
return {
|
|
401
|
+
...drawing,
|
|
402
|
+
anchorType: "1",
|
|
403
|
+
sheetTransform,
|
|
404
|
+
transform,
|
|
405
|
+
axisAlignSheetTransform: transformToAxisAlignPosition(transform, skeleton)
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Normalize exact markers or model-space bounds to the authoritative
|
|
410
|
+
* Position, Both, or None Placement.
|
|
411
|
+
*/
|
|
412
|
+
function normalizeSheetDrawingPlacement(input, skeleton) {
|
|
413
|
+
if (!("bounds" in input)) {
|
|
414
|
+
validatePlacement(input);
|
|
415
|
+
if (input.kind === "1" && skeleton) validateBounds((0, _univerjs_sheets.convertPositionSheetOverGridToAbsolute)(skeleton.worksheet.getUnitId(), skeleton.worksheet.getSheetId(), {
|
|
416
|
+
from: input.from,
|
|
417
|
+
to: input.to
|
|
418
|
+
}, skeleton));
|
|
419
|
+
return input;
|
|
420
|
+
}
|
|
421
|
+
validateBounds(input.bounds);
|
|
422
|
+
if (input.kind === "2") return {
|
|
423
|
+
kind: "2",
|
|
424
|
+
...input.bounds
|
|
425
|
+
};
|
|
426
|
+
if (!skeleton) throw new Error("SHEET_DRAWING_PLACEMENT_SKELETON_REQUIRED");
|
|
427
|
+
const sheetTransform = transformToDrawingPosition(input.bounds, skeleton);
|
|
428
|
+
if (input.kind === "0") return {
|
|
429
|
+
kind: "0",
|
|
430
|
+
from: sheetTransform.from,
|
|
431
|
+
width: input.bounds.width,
|
|
432
|
+
height: input.bounds.height
|
|
433
|
+
};
|
|
434
|
+
if (input.kind === "1") return {
|
|
435
|
+
kind: "1",
|
|
436
|
+
from: sheetTransform.from,
|
|
437
|
+
to: sheetTransform.to
|
|
438
|
+
};
|
|
439
|
+
throw new Error("SHEET_DRAWING_PLACEMENT_KIND_INVALID");
|
|
440
|
+
}
|
|
441
|
+
function withExistingSheetTransform(current, placement) {
|
|
442
|
+
return {
|
|
443
|
+
...current,
|
|
444
|
+
from: { ...placement.from },
|
|
445
|
+
to: { ...placement.to }
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function withExistingTransform(current, bounds) {
|
|
449
|
+
return {
|
|
450
|
+
...current,
|
|
451
|
+
left: bounds.left,
|
|
452
|
+
top: bounds.top,
|
|
453
|
+
width: bounds.width,
|
|
454
|
+
height: bounds.height
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
function absoluteSheetTransform(placement, current) {
|
|
458
|
+
return {
|
|
459
|
+
...current,
|
|
460
|
+
from: {
|
|
461
|
+
column: 0,
|
|
462
|
+
columnOffset: placement.left,
|
|
463
|
+
row: 0,
|
|
464
|
+
rowOffset: placement.top
|
|
465
|
+
},
|
|
466
|
+
to: {
|
|
467
|
+
column: 0,
|
|
468
|
+
columnOffset: placement.left + placement.width,
|
|
469
|
+
row: 0,
|
|
470
|
+
rowOffset: placement.top + placement.height
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function validatePlacement(placement) {
|
|
475
|
+
if (placement.kind === "0") {
|
|
476
|
+
validateCellPosition(placement.from);
|
|
477
|
+
validateExtent(placement.width, placement.height);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (placement.kind === "1") {
|
|
481
|
+
validateCellPosition(placement.from);
|
|
482
|
+
validateCellPosition(placement.to);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
if (placement.kind === "2") {
|
|
486
|
+
if (!Number.isFinite(placement.left) || !Number.isFinite(placement.top)) throw new TypeError("SHEET_DRAWING_PLACEMENT_POSITION_INVALID");
|
|
487
|
+
validateExtent(placement.width, placement.height);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
throw new Error("SHEET_DRAWING_PLACEMENT_KIND_INVALID");
|
|
491
|
+
}
|
|
492
|
+
function validateBounds(bounds) {
|
|
493
|
+
if (!Number.isFinite(bounds.left) || !Number.isFinite(bounds.top)) throw new TypeError("SHEET_DRAWING_PLACEMENT_POSITION_INVALID");
|
|
494
|
+
validateExtent(bounds.width, bounds.height);
|
|
495
|
+
}
|
|
496
|
+
function validateCellPosition(position) {
|
|
497
|
+
if (!Number.isInteger(position.row) || !Number.isInteger(position.column) || position.row < 0 || position.column < 0 || !Number.isFinite(position.rowOffset) || !Number.isFinite(position.columnOffset)) throw new Error("SHEET_DRAWING_PLACEMENT_CELL_INVALID");
|
|
498
|
+
}
|
|
499
|
+
function validateExtent(width, height) {
|
|
500
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) throw new Error("SHEET_DRAWING_PLACEMENT_EXTENT_INVALID");
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/commands/commands/set-sheet-drawing-placement.command.ts
|
|
505
|
+
const SetSheetDrawingPlacementCommand = {
|
|
506
|
+
id: "sheet.command.set-drawing-placement",
|
|
507
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
508
|
+
handler: (accessor, params) => {
|
|
509
|
+
if (!(params === null || params === void 0 ? void 0 : params.drawings.length)) return false;
|
|
510
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
511
|
+
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
512
|
+
const drawingService = accessor.get(ISheetDrawingService);
|
|
513
|
+
const skeleton = params.drawings.every(({ placement }) => placement.kind === "2") ? void 0 : accessor.get(_univerjs_sheets.SheetSkeletonService).ensureSkeleton(params.unitId, params.subUnitId);
|
|
514
|
+
const updatedDrawings = [];
|
|
515
|
+
for (const { drawingId, placement } of params.drawings) {
|
|
516
|
+
const drawing = drawingService.getDrawingByParam({
|
|
517
|
+
unitId: params.unitId,
|
|
518
|
+
subUnitId: params.subUnitId,
|
|
519
|
+
drawingId
|
|
520
|
+
});
|
|
521
|
+
if (!drawing) return false;
|
|
522
|
+
updatedDrawings.push(applySheetDrawingPlacement(drawing, placement, skeleton));
|
|
523
|
+
}
|
|
524
|
+
const { unitId, subUnitId, undo, redo, objects } = drawingService.getBatchUpdateOp(updatedDrawings);
|
|
525
|
+
const redoMutations = [{
|
|
526
|
+
id: SetDrawingApplyMutation.id,
|
|
527
|
+
params: {
|
|
528
|
+
unitId,
|
|
529
|
+
subUnitId,
|
|
530
|
+
op: redo,
|
|
531
|
+
objects,
|
|
532
|
+
type: 2
|
|
533
|
+
}
|
|
534
|
+
}, {
|
|
535
|
+
id: ClearSheetDrawingTransformerOperation.id,
|
|
536
|
+
params: [unitId]
|
|
537
|
+
}];
|
|
538
|
+
const undoMutations = [{
|
|
539
|
+
id: SetDrawingApplyMutation.id,
|
|
540
|
+
params: {
|
|
541
|
+
unitId,
|
|
542
|
+
subUnitId,
|
|
543
|
+
op: undo,
|
|
544
|
+
objects,
|
|
545
|
+
type: 2
|
|
546
|
+
}
|
|
547
|
+
}, {
|
|
548
|
+
id: ClearSheetDrawingTransformerOperation.id,
|
|
549
|
+
params: [unitId]
|
|
550
|
+
}];
|
|
551
|
+
if (!(0, _univerjs_core.sequenceExecute)(redoMutations, commandService).result) return false;
|
|
552
|
+
undoRedoService.pushUndoRedo({
|
|
553
|
+
unitID: unitId,
|
|
554
|
+
undoMutations,
|
|
555
|
+
redoMutations
|
|
556
|
+
});
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
343
561
|
//#endregion
|
|
344
562
|
//#region src/common/rotate-enabled.ts
|
|
345
563
|
function isKnownSheetNonRotatableDrawingType(drawingType) {
|
|
@@ -347,10 +565,7 @@ function isKnownSheetNonRotatableDrawingType(drawingType) {
|
|
|
347
565
|
}
|
|
348
566
|
function resolveSheetDrawingRotateEnabled(drawing, drawingService, getChildren) {
|
|
349
567
|
return (0, _univerjs_drawing.resolveDrawingRotateEnabled)(drawing, {
|
|
350
|
-
getChildren: (current) =>
|
|
351
|
-
var _getChildren;
|
|
352
|
-
return (_getChildren = getChildren === null || getChildren === void 0 ? void 0 : getChildren(current)) !== null && _getChildren !== void 0 ? _getChildren : drawingService.getDrawingsByGroup(current);
|
|
353
|
-
},
|
|
568
|
+
getChildren: (current) => (getChildren === null || getChildren === void 0 ? void 0 : getChildren(current)) ?? drawingService.getDrawingsByGroup(current),
|
|
354
569
|
isKnownNonRotatableType: isKnownSheetNonRotatableDrawingType
|
|
355
570
|
});
|
|
356
571
|
}
|
|
@@ -364,7 +579,7 @@ function hasIncomingAngle(drawing) {
|
|
|
364
579
|
function preserveAngle(incoming, current) {
|
|
365
580
|
const currentAngle = current === null || current === void 0 ? void 0 : current.angle;
|
|
366
581
|
const next = {
|
|
367
|
-
...current
|
|
582
|
+
...current ?? {},
|
|
368
583
|
...incoming
|
|
369
584
|
};
|
|
370
585
|
if (currentAngle === void 0) delete next.angle;
|
|
@@ -372,7 +587,7 @@ function preserveAngle(incoming, current) {
|
|
|
372
587
|
return next;
|
|
373
588
|
}
|
|
374
589
|
function normalizeNonRotatableAngleUpdate(drawing, sheetDrawingService) {
|
|
375
|
-
var _drawing$
|
|
590
|
+
var _drawing$transform2, _drawing$sheetTransfo2, _drawing$axisAlignShe2;
|
|
376
591
|
if (!drawing.drawingId || !drawing.unitId || !drawing.subUnitId || !hasIncomingAngle(drawing)) return drawing;
|
|
377
592
|
const current = sheetDrawingService.getDrawingByParam({
|
|
378
593
|
unitId: drawing.unitId,
|
|
@@ -383,7 +598,7 @@ function normalizeNonRotatableAngleUpdate(drawing, sheetDrawingService) {
|
|
|
383
598
|
if (resolveSheetDrawingRotateEnabled({
|
|
384
599
|
...current,
|
|
385
600
|
...drawing,
|
|
386
|
-
drawingType:
|
|
601
|
+
drawingType: drawing.drawingType ?? current.drawingType,
|
|
387
602
|
transform: {
|
|
388
603
|
...current.transform,
|
|
389
604
|
...drawing.transform
|
|
@@ -399,7 +614,6 @@ const SetSheetDrawingCommand = {
|
|
|
399
614
|
id: "sheet.command.set-sheet-image",
|
|
400
615
|
type: _univerjs_core.CommandType.COMMAND,
|
|
401
616
|
handler: (accessor, params) => {
|
|
402
|
-
var _intercepted$preRedos, _intercepted$preUndos;
|
|
403
617
|
if (!params) return false;
|
|
404
618
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
405
619
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
@@ -417,7 +631,7 @@ const SetSheetDrawingCommand = {
|
|
|
417
631
|
params: normalizedParams
|
|
418
632
|
});
|
|
419
633
|
const redoMutations = [
|
|
420
|
-
...
|
|
634
|
+
...intercepted.preRedos ?? [],
|
|
421
635
|
{
|
|
422
636
|
id: SetDrawingApplyMutation.id,
|
|
423
637
|
params: {
|
|
@@ -435,7 +649,7 @@ const SetSheetDrawingCommand = {
|
|
|
435
649
|
...intercepted.redos
|
|
436
650
|
];
|
|
437
651
|
const undoMutations = [
|
|
438
|
-
...
|
|
652
|
+
...intercepted.preUndos ?? [],
|
|
439
653
|
{
|
|
440
654
|
id: SetDrawingApplyMutation.id,
|
|
441
655
|
params: {
|
|
@@ -519,6 +733,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
519
733
|
InsertSheetDrawingCommand,
|
|
520
734
|
RemoveSheetDrawingCommand,
|
|
521
735
|
SetDrawingArrangeCommand,
|
|
736
|
+
SetSheetDrawingPlacementCommand,
|
|
522
737
|
ClearSheetDrawingTransformerOperation
|
|
523
738
|
].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
|
|
524
739
|
}
|
|
@@ -653,7 +868,7 @@ SheetsDrawingLoadController = __decorate([
|
|
|
653
868
|
//#endregion
|
|
654
869
|
//#region package.json
|
|
655
870
|
var name = "@univerjs/sheets-drawing";
|
|
656
|
-
var version = "1.0.0-
|
|
871
|
+
var version = "1.0.0-beta.0";
|
|
657
872
|
|
|
658
873
|
//#endregion
|
|
659
874
|
//#region src/config/config.ts
|
|
@@ -734,10 +949,7 @@ var SheetDrawingTransformPlanService = class {
|
|
|
734
949
|
}
|
|
735
950
|
register(extension) {
|
|
736
951
|
this._extensions.push(extension);
|
|
737
|
-
this._extensions.sort((a, b) =>
|
|
738
|
-
var _b$priority, _a$priority;
|
|
739
|
-
return ((_b$priority = b.priority) !== null && _b$priority !== void 0 ? _b$priority : 0) - ((_a$priority = a.priority) !== null && _a$priority !== void 0 ? _a$priority : 0);
|
|
740
|
-
});
|
|
952
|
+
this._extensions.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
741
953
|
return (0, _univerjs_core.toDisposable)(() => {
|
|
742
954
|
const index = this._extensions.indexOf(extension);
|
|
743
955
|
if (index >= 0) this._extensions.splice(index, 1);
|
|
@@ -745,13 +957,12 @@ var SheetDrawingTransformPlanService = class {
|
|
|
745
957
|
}
|
|
746
958
|
transform(plan) {
|
|
747
959
|
return this._extensions.reduce((all, extension) => {
|
|
748
|
-
var _next$preRedos, _next$redos, _next$preUndos, _next$undos;
|
|
749
960
|
const next = extension.transform(plan);
|
|
750
961
|
if (!next) return all;
|
|
751
|
-
all.preRedos.push(...
|
|
752
|
-
all.redos.push(...
|
|
753
|
-
all.preUndos.push(...
|
|
754
|
-
all.undos.push(...
|
|
962
|
+
all.preRedos.push(...next.preRedos ?? []);
|
|
963
|
+
all.redos.push(...next.redos ?? []);
|
|
964
|
+
all.preUndos.push(...next.preUndos ?? []);
|
|
965
|
+
all.undos.push(...next.undos ?? []);
|
|
755
966
|
return all;
|
|
756
967
|
}, createEmptyResult());
|
|
757
968
|
}
|
|
@@ -948,7 +1159,6 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
948
1159
|
deletes: new Set(deletes.map(({ drawingId }) => drawingId).filter((drawingId) => Boolean(drawingId)))
|
|
949
1160
|
};
|
|
950
1161
|
updates.forEach((patch) => {
|
|
951
|
-
var _patch$sheetTransform, _patch$axisAlignSheet;
|
|
952
1162
|
if (!patch.drawingId) return;
|
|
953
1163
|
const original = originals.get(patch.drawingId);
|
|
954
1164
|
if (!original) return;
|
|
@@ -959,8 +1169,8 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
959
1169
|
...original.transform,
|
|
960
1170
|
...patch.transform
|
|
961
1171
|
},
|
|
962
|
-
sheetTransform:
|
|
963
|
-
axisAlignSheetTransform:
|
|
1172
|
+
sheetTransform: patch.sheetTransform ?? original.sheetTransform,
|
|
1173
|
+
axisAlignSheetTransform: patch.axisAlignSheetTransform ?? original.axisAlignSheetTransform
|
|
964
1174
|
});
|
|
965
1175
|
});
|
|
966
1176
|
const feature = this._transformPlanService.transform(plan);
|
|
@@ -1102,7 +1312,6 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1102
1312
|
drawingId
|
|
1103
1313
|
});
|
|
1104
1314
|
else {
|
|
1105
|
-
var _param$axisAlignSheet;
|
|
1106
1315
|
const param = this._shrinkCol(startColumn, endColumn, {
|
|
1107
1316
|
sheetSkeletonParam,
|
|
1108
1317
|
sheetTransform,
|
|
@@ -1111,7 +1320,7 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1111
1320
|
});
|
|
1112
1321
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1113
1322
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1114
|
-
axisAlignSheetTransform = (
|
|
1323
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1115
1324
|
}
|
|
1116
1325
|
else if (type === 1 && fromColumn >= startColumn && toColumn <= endColumn) if (fromRow >= startRow && toRow <= endRow) deleteDrawings.push({
|
|
1117
1326
|
unitId,
|
|
@@ -1119,7 +1328,6 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1119
1328
|
drawingId
|
|
1120
1329
|
});
|
|
1121
1330
|
else {
|
|
1122
|
-
var _param$axisAlignSheet2;
|
|
1123
1331
|
const param = this._shrinkRow(startRow, endRow, {
|
|
1124
1332
|
sheetSkeletonParam,
|
|
1125
1333
|
sheetTransform,
|
|
@@ -1128,10 +1336,9 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1128
1336
|
});
|
|
1129
1337
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1130
1338
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1131
|
-
axisAlignSheetTransform = (
|
|
1339
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1132
1340
|
}
|
|
1133
1341
|
else if (type === 2) {
|
|
1134
|
-
var _param$axisAlignSheet3;
|
|
1135
1342
|
const param = this._expandRow(startRow, endRow, {
|
|
1136
1343
|
sheetSkeletonParam,
|
|
1137
1344
|
sheetTransform,
|
|
@@ -1140,9 +1347,8 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1140
1347
|
});
|
|
1141
1348
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1142
1349
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1143
|
-
axisAlignSheetTransform = (
|
|
1350
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1144
1351
|
} else if (type === 3) {
|
|
1145
|
-
var _param$axisAlignSheet4;
|
|
1146
1352
|
const param = this._expandCol(startColumn, endColumn, {
|
|
1147
1353
|
sheetSkeletonParam,
|
|
1148
1354
|
sheetTransform,
|
|
@@ -1151,7 +1357,7 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1151
1357
|
});
|
|
1152
1358
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1153
1359
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1154
|
-
axisAlignSheetTransform = (
|
|
1360
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1155
1361
|
}
|
|
1156
1362
|
if (newSheetTransform && newTransform) {
|
|
1157
1363
|
const newTransform = drawingPositionToTransform(newSheetTransform, sheetSkeletonParam);
|
|
@@ -1548,7 +1754,6 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1548
1754
|
let newTransform;
|
|
1549
1755
|
let axisAlignSheetTransform;
|
|
1550
1756
|
if (type === "insert") {
|
|
1551
|
-
var _param$axisAlignSheet5;
|
|
1552
1757
|
const param = this._expandRow(rowStartIndex, rowEndIndex, {
|
|
1553
1758
|
sheetSkeletonParam,
|
|
1554
1759
|
sheetTransform,
|
|
@@ -1557,7 +1762,7 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1557
1762
|
});
|
|
1558
1763
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1559
1764
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1560
|
-
axisAlignSheetTransform = (
|
|
1765
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1561
1766
|
} else {
|
|
1562
1767
|
const { from, to } = sheetTransform;
|
|
1563
1768
|
const { row: fromRow } = from;
|
|
@@ -1568,7 +1773,6 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1568
1773
|
drawingId
|
|
1569
1774
|
});
|
|
1570
1775
|
else {
|
|
1571
|
-
var _param$axisAlignSheet6;
|
|
1572
1776
|
const param = this._shrinkRow(rowStartIndex, rowEndIndex, {
|
|
1573
1777
|
sheetSkeletonParam,
|
|
1574
1778
|
sheetTransform,
|
|
@@ -1577,7 +1781,7 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1577
1781
|
});
|
|
1578
1782
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1579
1783
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1580
|
-
axisAlignSheetTransform = (
|
|
1784
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1581
1785
|
}
|
|
1582
1786
|
}
|
|
1583
1787
|
if (!newSheetTransform || !newTransform) return;
|
|
@@ -1618,7 +1822,6 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1618
1822
|
let newTransform;
|
|
1619
1823
|
let axisAlignSheetTransform;
|
|
1620
1824
|
if (type === "insert") {
|
|
1621
|
-
var _param$axisAlignSheet7;
|
|
1622
1825
|
const param = this._expandCol(colStartIndex, colEndIndex, {
|
|
1623
1826
|
sheetSkeletonParam,
|
|
1624
1827
|
sheetTransform,
|
|
@@ -1627,7 +1830,7 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1627
1830
|
});
|
|
1628
1831
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1629
1832
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1630
|
-
axisAlignSheetTransform = (
|
|
1833
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1631
1834
|
} else {
|
|
1632
1835
|
const { from, to } = sheetTransform;
|
|
1633
1836
|
const { column: fromColumn } = from;
|
|
@@ -1638,7 +1841,6 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1638
1841
|
drawingId
|
|
1639
1842
|
});
|
|
1640
1843
|
else {
|
|
1641
|
-
var _param$axisAlignSheet8;
|
|
1642
1844
|
const param = this._shrinkCol(colStartIndex, colEndIndex, {
|
|
1643
1845
|
sheetSkeletonParam,
|
|
1644
1846
|
sheetTransform,
|
|
@@ -1647,7 +1849,7 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1647
1849
|
});
|
|
1648
1850
|
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1649
1851
|
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1650
|
-
axisAlignSheetTransform = (
|
|
1852
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1651
1853
|
}
|
|
1652
1854
|
}
|
|
1653
1855
|
if (!newSheetTransform || !newTransform) return;
|
|
@@ -1984,9 +2186,8 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1984
2186
|
}));
|
|
1985
2187
|
}
|
|
1986
2188
|
_refreshDrawingTransform(command, unitId, subUnitId, ranges) {
|
|
1987
|
-
var _this$_drawingManager;
|
|
1988
2189
|
const sheetSkeletonParam = this._getCalculatedSkeletonParam(unitId, subUnitId);
|
|
1989
|
-
const drawingData =
|
|
2190
|
+
const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId) ?? {};
|
|
1990
2191
|
const updateDrawings = [];
|
|
1991
2192
|
Object.keys(drawingData).forEach((drawingId) => {
|
|
1992
2193
|
const drawing = drawingData[drawingId];
|
|
@@ -2081,6 +2282,7 @@ exports.SHEET_DRAWING_PLUGIN = SHEET_DRAWING_PLUGIN;
|
|
|
2081
2282
|
exports.SetDrawingApplyMutation = SetDrawingApplyMutation;
|
|
2082
2283
|
exports.SetDrawingArrangeCommand = SetDrawingArrangeCommand;
|
|
2083
2284
|
exports.SetSheetDrawingCommand = SetSheetDrawingCommand;
|
|
2285
|
+
exports.SetSheetDrawingPlacementCommand = SetSheetDrawingPlacementCommand;
|
|
2084
2286
|
exports.SheetDrawingAnchorType = SheetDrawingAnchorType;
|
|
2085
2287
|
exports.SheetDrawingService = SheetDrawingService;
|
|
2086
2288
|
exports.SheetDrawingTransformPlanService = SheetDrawingTransformPlanService;
|
|
@@ -2090,8 +2292,11 @@ Object.defineProperty(exports, 'UniverSheetsDrawingPlugin', {
|
|
|
2090
2292
|
return UniverSheetsDrawingPlugin;
|
|
2091
2293
|
}
|
|
2092
2294
|
});
|
|
2295
|
+
exports.applySheetDrawingPlacement = applySheetDrawingPlacement;
|
|
2093
2296
|
exports.drawingPositionToTransform = drawingPositionToTransform;
|
|
2297
|
+
exports.getSheetDrawingPlacement = getSheetDrawingPlacement;
|
|
2094
2298
|
exports.isKnownSheetNonRotatableDrawingType = isKnownSheetNonRotatableDrawingType;
|
|
2299
|
+
exports.normalizeSheetDrawingPlacement = normalizeSheetDrawingPlacement;
|
|
2095
2300
|
exports.resolveSheetDrawingRotateEnabled = resolveSheetDrawingRotateEnabled;
|
|
2096
2301
|
exports.transformToAxisAlignPosition = transformToAxisAlignPosition;
|
|
2097
2302
|
exports.transformToDrawingPosition = transformToDrawingPosition;
|