@univerjs/sheets-drawing 1.0.0-rc.0 → 1.0.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 +65 -16
- package/lib/cjs/index.js +165 -96
- package/lib/es/facade.js +66 -17
- package/lib/es/index.js +164 -97
- package/lib/facade.js +66 -17
- package/lib/index.js +164 -97
- package/lib/types/commands/commands/set-worksheet-background-image.command.d.ts +22 -0
- package/lib/types/commands/mutations/set-worksheet-background-image.mutation.d.ts +22 -0
- package/lib/types/facade/f-over-grid-image.d.ts +36 -12
- package/lib/types/facade/f-worksheet.d.ts +25 -5
- package/lib/types/index.d.ts +5 -1
- package/lib/types/services/sheet-drawing.service.d.ts +7 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
package/lib/cjs/facade.js
CHANGED
|
@@ -7,7 +7,7 @@ let _univerjs_sheets_drawing = require("@univerjs/sheets-drawing");
|
|
|
7
7
|
let _univerjs_engine_render = require("@univerjs/engine-render");
|
|
8
8
|
let _univerjs_sheets_facade = require("@univerjs/sheets/facade");
|
|
9
9
|
|
|
10
|
-
//#region \0@oxc-project+runtime@0.
|
|
10
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
11
11
|
function _typeof(o) {
|
|
12
12
|
"@babel/helpers - typeof";
|
|
13
13
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -18,7 +18,7 @@ function _typeof(o) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
|
-
//#region \0@oxc-project+runtime@0.
|
|
21
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
22
22
|
function toPrimitive(t, r) {
|
|
23
23
|
if ("object" != _typeof(t) || !t) return t;
|
|
24
24
|
var e = t[Symbol.toPrimitive];
|
|
@@ -31,14 +31,14 @@ function toPrimitive(t, r) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
|
-
//#region \0@oxc-project+runtime@0.
|
|
34
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
35
35
|
function toPropertyKey(t) {
|
|
36
36
|
var i = toPrimitive(t, "string");
|
|
37
37
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region \0@oxc-project+runtime@0.
|
|
41
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
42
42
|
function _defineProperty(e, r, t) {
|
|
43
43
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
44
44
|
value: t,
|
|
@@ -49,7 +49,7 @@ function _defineProperty(e, r, t) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
//#endregion
|
|
52
|
-
//#region \0@oxc-project+runtime@0.
|
|
52
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
53
53
|
function __decorateParam(paramIndex, decorator) {
|
|
54
54
|
return function(target, key) {
|
|
55
55
|
decorator(target, key, paramIndex);
|
|
@@ -57,7 +57,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region \0@oxc-project+runtime@0.
|
|
60
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
61
61
|
function __decorate(decorators, target, key, desc) {
|
|
62
62
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
63
63
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -661,14 +661,38 @@ let FOverGridImageBuilder = class FOverGridImageBuilder {
|
|
|
661
661
|
this._image.angle = angle;
|
|
662
662
|
return this;
|
|
663
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Sets the workbook unit ID of the image to build.
|
|
666
|
+
* @param {string} unitId The target workbook unit ID.
|
|
667
|
+
* @returns {FOverGridImageBuilder} This builder, for chaining.
|
|
668
|
+
*/
|
|
664
669
|
setUnitId(unitId) {
|
|
665
670
|
this._image.unitId = unitId;
|
|
666
671
|
return this;
|
|
667
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Sets the worksheet ID of the image to build.
|
|
675
|
+
* @param {string} subUnitId The target worksheet ID.
|
|
676
|
+
* @returns {FOverGridImageBuilder} This builder, for chaining.
|
|
677
|
+
*/
|
|
668
678
|
setSubUnitId(subUnitId) {
|
|
669
679
|
this._image.subUnitId = subUnitId;
|
|
670
680
|
return this;
|
|
671
681
|
}
|
|
682
|
+
/**
|
|
683
|
+
* Builds image data for insertion or updating; this does not insert the image.
|
|
684
|
+
* An explicit placement takes precedence over the individual position and size fields.
|
|
685
|
+
* Without explicit placement, zero width or height is filled from the source image's intrinsic size.
|
|
686
|
+
* @returns {Promise<ISheetImage>} A promise resolving to the built sheet image data.
|
|
687
|
+
* @example
|
|
688
|
+
* ```ts
|
|
689
|
+
* const sheet = univerAPI.getActiveWorkbook()?.getActiveSheet();
|
|
690
|
+
* if (sheet) {
|
|
691
|
+
* const image = await sheet.newOverGridImage().setSource('https://example.com/image.png').buildAsync();
|
|
692
|
+
* sheet.insertImages([image]);
|
|
693
|
+
* }
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
672
696
|
async buildAsync() {
|
|
673
697
|
var _this$_placement;
|
|
674
698
|
const sheetSkeletonService = this._sheetSkeletonService;
|
|
@@ -695,7 +719,7 @@ let FOverGridImageBuilder = class FOverGridImageBuilder {
|
|
|
695
719
|
rowOffset: top + height
|
|
696
720
|
}
|
|
697
721
|
};
|
|
698
|
-
|
|
722
|
+
const image = {
|
|
699
723
|
...this._image,
|
|
700
724
|
transform: {
|
|
701
725
|
left,
|
|
@@ -710,7 +734,8 @@ let FOverGridImageBuilder = class FOverGridImageBuilder {
|
|
|
710
734
|
},
|
|
711
735
|
sheetTransform,
|
|
712
736
|
axisAlignSheetTransform: sheetTransform
|
|
713
|
-
}
|
|
737
|
+
};
|
|
738
|
+
return (0, _univerjs_sheets_drawing.applySheetDrawingPlacement)(image, this._placement);
|
|
714
739
|
}
|
|
715
740
|
const image = convertFOverGridImageToSheetImage(this._image, sheetSkeletonService);
|
|
716
741
|
if (!this._placement) return image;
|
|
@@ -780,11 +805,12 @@ let FOverGridImage = class FOverGridImage extends _univerjs_core_facade.FBase {
|
|
|
780
805
|
* ```
|
|
781
806
|
*/
|
|
782
807
|
getPlacement() {
|
|
783
|
-
|
|
808
|
+
const current = this._sheetDrawingService.getDrawingByParam({
|
|
784
809
|
unitId: this._image.unitId,
|
|
785
810
|
subUnitId: this._image.subUnitId,
|
|
786
811
|
drawingId: this._image.drawingId
|
|
787
|
-
})
|
|
812
|
+
});
|
|
813
|
+
return (0, _univerjs_sheets_drawing.getSheetDrawingPlacement)(current ?? this._image);
|
|
788
814
|
}
|
|
789
815
|
/**
|
|
790
816
|
* Set this image's explicit placement through the drawing command.
|
|
@@ -905,7 +931,7 @@ let FOverGridImage = class FOverGridImage extends _univerjs_core_facade.FBase {
|
|
|
905
931
|
* Set the size of the image
|
|
906
932
|
* @param {number} width - The width of the image, pixel unit
|
|
907
933
|
* @param {number} height - The height of the image, pixel unit
|
|
908
|
-
* @returns {boolean}
|
|
934
|
+
* @returns {Promise<boolean>} A promise resolving to whether the image update succeeded.
|
|
909
935
|
* @example
|
|
910
936
|
* ```ts
|
|
911
937
|
* // set the image width 120px and height 50px
|
|
@@ -913,7 +939,7 @@ let FOverGridImage = class FOverGridImage extends _univerjs_core_facade.FBase {
|
|
|
913
939
|
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
914
940
|
* if (!fWorksheet) return;
|
|
915
941
|
* const image = fWorksheet.getImages()[0];
|
|
916
|
-
* const result = image?.setSizeAsync(120, 50);
|
|
942
|
+
* const result = await image?.setSizeAsync(120, 50);
|
|
917
943
|
* console.log(result);
|
|
918
944
|
* ```
|
|
919
945
|
*/
|
|
@@ -929,10 +955,10 @@ let FOverGridImage = class FOverGridImage extends _univerjs_core_facade.FBase {
|
|
|
929
955
|
}
|
|
930
956
|
/**
|
|
931
957
|
* Set the cropping region of the image by defining the top, bottom, left, and right edges, thereby displaying the specific part of the image you want.
|
|
932
|
-
* @param {number} top - The number of pixels to crop from the top of the image
|
|
933
|
-
* @param {number} left - The number of pixels to crop from the left side of the image
|
|
934
|
-
* @param {number} bottom - The number of pixels to crop from the bottom of the image
|
|
935
|
-
* @param {number} right - The number of pixels to crop from the right side of the image
|
|
958
|
+
* @param {number} [top] - The number of pixels to crop from the top of the image
|
|
959
|
+
* @param {number} [left] - The number of pixels to crop from the left side of the image
|
|
960
|
+
* @param {number} [bottom] - The number of pixels to crop from the bottom of the image
|
|
961
|
+
* @param {number} [right] - The number of pixels to crop from the right side of the image
|
|
936
962
|
* @returns {boolean} true if the crop is set successfully, otherwise false
|
|
937
963
|
* @example
|
|
938
964
|
* ```ts
|
|
@@ -1093,6 +1119,29 @@ var FWorksheetDrawingMixin = class extends _univerjs_sheets_facade.FWorksheet {
|
|
|
1093
1119
|
get _undoRedoService() {
|
|
1094
1120
|
return this._injector.get(_univerjs_core.IUndoRedoService);
|
|
1095
1121
|
}
|
|
1122
|
+
getBackgroundImage() {
|
|
1123
|
+
const backgroundImage = this._worksheet.getConfig().backgroundImage;
|
|
1124
|
+
return backgroundImage ? { ...backgroundImage } : null;
|
|
1125
|
+
}
|
|
1126
|
+
setBackgroundImage(source, imageSourceType = _univerjs_core.ImageSourceType.URL) {
|
|
1127
|
+
this._commandService.syncExecuteCommand(_univerjs_sheets_drawing.SetWorksheetBackgroundImageCommand.id, {
|
|
1128
|
+
unitId: this._fWorkbook.getId(),
|
|
1129
|
+
subUnitId: this.getSheetId(),
|
|
1130
|
+
backgroundImage: {
|
|
1131
|
+
source,
|
|
1132
|
+
imageSourceType
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
return this;
|
|
1136
|
+
}
|
|
1137
|
+
deleteBackgroundImage() {
|
|
1138
|
+
this._commandService.syncExecuteCommand(_univerjs_sheets_drawing.SetWorksheetBackgroundImageCommand.id, {
|
|
1139
|
+
unitId: this._fWorkbook.getId(),
|
|
1140
|
+
subUnitId: this.getSheetId(),
|
|
1141
|
+
backgroundImage: null
|
|
1142
|
+
});
|
|
1143
|
+
return this;
|
|
1144
|
+
}
|
|
1096
1145
|
async insertImage(url, column, row, offsetX, offsetY) {
|
|
1097
1146
|
const imageBuilder = this.newOverGridImage();
|
|
1098
1147
|
if (typeof url === "string") imageBuilder.setSource(url);
|
package/lib/cjs/index.js
CHANGED
|
@@ -127,7 +127,6 @@ const SetDrawingApplyMutation = {
|
|
|
127
127
|
case 5:
|
|
128
128
|
drawingManagerService.ungroupUpdateNotification(objects);
|
|
129
129
|
sheetDrawingService.ungroupUpdateNotification(objects);
|
|
130
|
-
break;
|
|
131
130
|
}
|
|
132
131
|
return true;
|
|
133
132
|
}
|
|
@@ -596,7 +595,7 @@ function normalizeNonRotatableAngleUpdate(drawing, sheetDrawingService) {
|
|
|
596
595
|
drawingId: drawing.drawingId
|
|
597
596
|
});
|
|
598
597
|
if (!current) return drawing;
|
|
599
|
-
|
|
598
|
+
const resolveTarget = {
|
|
600
599
|
...current,
|
|
601
600
|
...drawing,
|
|
602
601
|
drawingType: drawing.drawingType ?? current.drawingType,
|
|
@@ -604,7 +603,8 @@ function normalizeNonRotatableAngleUpdate(drawing, sheetDrawingService) {
|
|
|
604
603
|
...current.transform,
|
|
605
604
|
...drawing.transform
|
|
606
605
|
}
|
|
607
|
-
}
|
|
606
|
+
};
|
|
607
|
+
if (resolveSheetDrawingRotateEnabled(resolveTarget, sheetDrawingService)) return drawing;
|
|
608
608
|
const normalized = { ...drawing };
|
|
609
609
|
if (((_drawing$transform2 = drawing.transform) === null || _drawing$transform2 === void 0 ? void 0 : _drawing$transform2.angle) !== void 0) normalized.transform = preserveAngle(drawing.transform, current.transform);
|
|
610
610
|
if (((_drawing$sheetTransfo2 = drawing.sheetTransform) === null || _drawing$sheetTransfo2 === void 0 ? void 0 : _drawing$sheetTransfo2.angle) !== void 0) normalized.sheetTransform = preserveAngle(drawing.sheetTransform, current.sheetTransform);
|
|
@@ -680,7 +680,63 @@ const SetSheetDrawingCommand = {
|
|
|
680
680
|
};
|
|
681
681
|
|
|
682
682
|
//#endregion
|
|
683
|
-
//#region
|
|
683
|
+
//#region src/commands/mutations/set-worksheet-background-image.mutation.ts
|
|
684
|
+
const SetWorksheetBackgroundImageMutation = {
|
|
685
|
+
id: "sheet.mutation.set-worksheet-background-image",
|
|
686
|
+
type: _univerjs_core.CommandType.MUTATION,
|
|
687
|
+
handler: (accessor, params) => {
|
|
688
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
689
|
+
if (!target) return false;
|
|
690
|
+
const config = target.worksheet.getConfig();
|
|
691
|
+
if (params.backgroundImage) config.backgroundImage = { ...params.backgroundImage };
|
|
692
|
+
else delete config.backgroundImage;
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/commands/commands/set-worksheet-background-image.command.ts
|
|
699
|
+
const SetWorksheetBackgroundImageCommand = {
|
|
700
|
+
id: "sheet.command.set-worksheet-background-image",
|
|
701
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
702
|
+
handler: (accessor, params) => {
|
|
703
|
+
if (!params) return false;
|
|
704
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
705
|
+
if (!target) return false;
|
|
706
|
+
const { unitId, subUnitId, worksheet } = target;
|
|
707
|
+
const previous = worksheet.getConfig().backgroundImage;
|
|
708
|
+
const next = params.backgroundImage;
|
|
709
|
+
if ((previous === null || previous === void 0 ? void 0 : previous.source) === (next === null || next === void 0 ? void 0 : next.source) && (previous === null || previous === void 0 ? void 0 : previous.imageSourceType) === (next === null || next === void 0 ? void 0 : next.imageSourceType)) return false;
|
|
710
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
711
|
+
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
712
|
+
const redoParams = {
|
|
713
|
+
unitId,
|
|
714
|
+
subUnitId,
|
|
715
|
+
backgroundImage: next ? { ...next } : null
|
|
716
|
+
};
|
|
717
|
+
const undoParams = {
|
|
718
|
+
unitId,
|
|
719
|
+
subUnitId,
|
|
720
|
+
backgroundImage: previous ? { ...previous } : null
|
|
721
|
+
};
|
|
722
|
+
if (!commandService.syncExecuteCommand(SetWorksheetBackgroundImageMutation.id, redoParams)) return false;
|
|
723
|
+
undoRedoService.pushUndoRedo({
|
|
724
|
+
unitID: unitId,
|
|
725
|
+
undoMutations: [{
|
|
726
|
+
id: SetWorksheetBackgroundImageMutation.id,
|
|
727
|
+
params: undoParams
|
|
728
|
+
}],
|
|
729
|
+
redoMutations: [{
|
|
730
|
+
id: SetWorksheetBackgroundImageMutation.id,
|
|
731
|
+
params: redoParams
|
|
732
|
+
}]
|
|
733
|
+
});
|
|
734
|
+
return true;
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
//#endregion
|
|
739
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
684
740
|
function __decorateParam(paramIndex, decorator) {
|
|
685
741
|
return function(target, key) {
|
|
686
742
|
decorator(target, key, paramIndex);
|
|
@@ -688,7 +744,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
688
744
|
}
|
|
689
745
|
|
|
690
746
|
//#endregion
|
|
691
|
-
//#region \0@oxc-project+runtime@0.
|
|
747
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
692
748
|
function __decorate(decorators, target, key, desc) {
|
|
693
749
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
694
750
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -727,6 +783,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
727
783
|
this._initSnapshot();
|
|
728
784
|
this._initSheetChange();
|
|
729
785
|
this.disposeWithMe(this._commandService.registerCommand(SetDrawingApplyMutation));
|
|
786
|
+
this.disposeWithMe(this._commandService.registerCommand(SetWorksheetBackgroundImageMutation));
|
|
730
787
|
}
|
|
731
788
|
_initCommands() {
|
|
732
789
|
[
|
|
@@ -735,6 +792,7 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
735
792
|
RemoveSheetDrawingCommand,
|
|
736
793
|
SetDrawingArrangeCommand,
|
|
737
794
|
SetSheetDrawingPlacementCommand,
|
|
795
|
+
SetWorksheetBackgroundImageCommand,
|
|
738
796
|
ClearSheetDrawingTransformerOperation
|
|
739
797
|
].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
|
|
740
798
|
}
|
|
@@ -817,7 +875,8 @@ let SheetsDrawingLoadController = class SheetsDrawingLoadController extends _uni
|
|
|
817
875
|
redos: [],
|
|
818
876
|
undos: []
|
|
819
877
|
};
|
|
820
|
-
const
|
|
878
|
+
const sourceDrawings = getDrawingsInOrder(this._sheetDrawingService.getDrawingData(unitId, subUnitId), this._sheetDrawingService.getDrawingOrder(unitId, subUnitId));
|
|
879
|
+
const drawings = (0, _univerjs_drawing.getOrCreateDrawingCopyPlan)(copyContext, sourceDrawings, {
|
|
821
880
|
unitId,
|
|
822
881
|
sourceSubUnitId: subUnitId,
|
|
823
882
|
targetSubUnitId
|
|
@@ -869,7 +928,7 @@ SheetsDrawingLoadController = __decorate([
|
|
|
869
928
|
//#endregion
|
|
870
929
|
//#region package.json
|
|
871
930
|
var name = "@univerjs/sheets-drawing";
|
|
872
|
-
var version = "1.0.0
|
|
931
|
+
var version = "1.0.0";
|
|
873
932
|
|
|
874
933
|
//#endregion
|
|
875
934
|
//#region src/config/config.ts
|
|
@@ -893,7 +952,7 @@ const configSymbol = Symbol(SHEETS_DRAWING_PLUGIN_CONFIG_KEY);
|
|
|
893
952
|
const defaultPluginConfig = {};
|
|
894
953
|
|
|
895
954
|
//#endregion
|
|
896
|
-
//#region \0@oxc-project+runtime@0.
|
|
955
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
897
956
|
function _typeof(o) {
|
|
898
957
|
"@babel/helpers - typeof";
|
|
899
958
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -904,7 +963,7 @@ function _typeof(o) {
|
|
|
904
963
|
}
|
|
905
964
|
|
|
906
965
|
//#endregion
|
|
907
|
-
//#region \0@oxc-project+runtime@0.
|
|
966
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
908
967
|
function toPrimitive(t, r) {
|
|
909
968
|
if ("object" != _typeof(t) || !t) return t;
|
|
910
969
|
var e = t[Symbol.toPrimitive];
|
|
@@ -917,14 +976,14 @@ function toPrimitive(t, r) {
|
|
|
917
976
|
}
|
|
918
977
|
|
|
919
978
|
//#endregion
|
|
920
|
-
//#region \0@oxc-project+runtime@0.
|
|
979
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
921
980
|
function toPropertyKey(t) {
|
|
922
981
|
var i = toPrimitive(t, "string");
|
|
923
982
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
924
983
|
}
|
|
925
984
|
|
|
926
985
|
//#endregion
|
|
927
|
-
//#region \0@oxc-project+runtime@0.
|
|
986
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
928
987
|
function _defineProperty(e, r, t) {
|
|
929
988
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
930
989
|
value: t,
|
|
@@ -1307,39 +1366,41 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1307
1366
|
let newSheetTransform = null;
|
|
1308
1367
|
let newTransform = null;
|
|
1309
1368
|
let axisAlignSheetTransform;
|
|
1310
|
-
if (type === 0 && fromRow >= startRow && toRow <= endRow)
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
else {
|
|
1316
|
-
const param = this._shrinkCol(startColumn, endColumn, {
|
|
1317
|
-
sheetSkeletonParam,
|
|
1318
|
-
sheetTransform,
|
|
1319
|
-
transform,
|
|
1320
|
-
anchorType
|
|
1369
|
+
if (type === 0 && fromRow >= startRow && toRow <= endRow) {
|
|
1370
|
+
if (fromColumn >= startColumn && toColumn <= endColumn) deleteDrawings.push({
|
|
1371
|
+
unitId,
|
|
1372
|
+
subUnitId,
|
|
1373
|
+
drawingId
|
|
1321
1374
|
});
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1375
|
+
else {
|
|
1376
|
+
const param = this._shrinkCol(startColumn, endColumn, {
|
|
1377
|
+
sheetSkeletonParam,
|
|
1378
|
+
sheetTransform,
|
|
1379
|
+
transform,
|
|
1380
|
+
anchorType
|
|
1381
|
+
});
|
|
1382
|
+
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1383
|
+
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1384
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1385
|
+
}
|
|
1386
|
+
} else if (type === 1 && fromColumn >= startColumn && toColumn <= endColumn) {
|
|
1387
|
+
if (fromRow >= startRow && toRow <= endRow) deleteDrawings.push({
|
|
1388
|
+
unitId,
|
|
1389
|
+
subUnitId,
|
|
1390
|
+
drawingId
|
|
1337
1391
|
});
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1392
|
+
else {
|
|
1393
|
+
const param = this._shrinkRow(startRow, endRow, {
|
|
1394
|
+
sheetSkeletonParam,
|
|
1395
|
+
sheetTransform,
|
|
1396
|
+
transform,
|
|
1397
|
+
anchorType
|
|
1398
|
+
});
|
|
1399
|
+
newSheetTransform = param === null || param === void 0 ? void 0 : param.newSheetTransform;
|
|
1400
|
+
newTransform = param === null || param === void 0 ? void 0 : param.newTransform;
|
|
1401
|
+
axisAlignSheetTransform = (param === null || param === void 0 ? void 0 : param.axisAlignSheetTransform) ?? void 0;
|
|
1402
|
+
}
|
|
1403
|
+
} else if (type === 2) {
|
|
1343
1404
|
const param = this._expandRow(startRow, endRow, {
|
|
1344
1405
|
sheetSkeletonParam,
|
|
1345
1406
|
sheetTransform,
|
|
@@ -1894,20 +1955,22 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1894
1955
|
};
|
|
1895
1956
|
newSheetTransform = transformToDrawingPosition(newTransform, skeleton);
|
|
1896
1957
|
axisAlignSheetTransform = transformToAxisAlignPosition(newTransform, skeleton);
|
|
1897
|
-
} else if (toColumn >= colEndIndex)
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1958
|
+
} else if (toColumn >= colEndIndex) {
|
|
1959
|
+
if (anchorType === "1") {
|
|
1960
|
+
newSheetTransform = {
|
|
1961
|
+
from: { ...from },
|
|
1962
|
+
to: {
|
|
1963
|
+
...to,
|
|
1964
|
+
column: toColumn + colCount
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
newTransform = drawingPositionToTransform(newSheetTransform, sheetSkeletonParam);
|
|
1968
|
+
} else return {
|
|
1969
|
+
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
1970
|
+
newTransform: transform,
|
|
1971
|
+
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
1904
1972
|
};
|
|
1905
|
-
|
|
1906
|
-
} else return {
|
|
1907
|
-
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
1908
|
-
newTransform: transform,
|
|
1909
|
-
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
1910
|
-
};
|
|
1973
|
+
}
|
|
1911
1974
|
if (newSheetTransform && newTransform) return {
|
|
1912
1975
|
newSheetTransform,
|
|
1913
1976
|
newTransform,
|
|
@@ -1943,21 +2006,22 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
1943
2006
|
};
|
|
1944
2007
|
newTransform = drawingPositionToTransform(newSheetTransform, sheetSkeletonParam);
|
|
1945
2008
|
} else if (fromColumn >= colStartIndex && toColumn <= colEndIndex) return null;
|
|
1946
|
-
else if (fromColumn < colStartIndex && toColumn > colEndIndex)
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2009
|
+
else if (fromColumn < colStartIndex && toColumn > colEndIndex) {
|
|
2010
|
+
if (anchorType === "1") {
|
|
2011
|
+
newSheetTransform = {
|
|
2012
|
+
from: { ...from },
|
|
2013
|
+
to: {
|
|
2014
|
+
...to,
|
|
2015
|
+
column: toColumn - colCount
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
newTransform = drawingPositionToTransform(newSheetTransform, sheetSkeletonParam);
|
|
2019
|
+
} else return {
|
|
2020
|
+
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
2021
|
+
newTransform: transform,
|
|
2022
|
+
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
1953
2023
|
};
|
|
1954
|
-
|
|
1955
|
-
} else return {
|
|
1956
|
-
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
1957
|
-
newTransform: transform,
|
|
1958
|
-
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
1959
|
-
};
|
|
1960
|
-
else if (fromColumn >= colStartIndex && fromColumn <= colEndIndex) {
|
|
2024
|
+
} else if (fromColumn >= colStartIndex && fromColumn <= colEndIndex) {
|
|
1961
2025
|
if (anchorType === "1") {
|
|
1962
2026
|
newSheetTransform = {
|
|
1963
2027
|
from: {
|
|
@@ -2044,20 +2108,22 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
2044
2108
|
};
|
|
2045
2109
|
newSheetTransform = transformToDrawingPosition(newTransform, skeleton);
|
|
2046
2110
|
axisAlignSheetTransform = transformToAxisAlignPosition(newTransform, skeleton);
|
|
2047
|
-
} else if (toRow >= rowEndIndex)
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2111
|
+
} else if (toRow >= rowEndIndex) {
|
|
2112
|
+
if (anchorType === "1") {
|
|
2113
|
+
newSheetTransform = {
|
|
2114
|
+
from: { ...from },
|
|
2115
|
+
to: {
|
|
2116
|
+
...to,
|
|
2117
|
+
row: toRow + rowCount
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
newTransform = drawingPositionToTransform(newSheetTransform, sheetSkeletonParam);
|
|
2121
|
+
} else return {
|
|
2122
|
+
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
2123
|
+
newTransform: transform,
|
|
2124
|
+
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
2054
2125
|
};
|
|
2055
|
-
|
|
2056
|
-
} else return {
|
|
2057
|
-
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
2058
|
-
newTransform: transform,
|
|
2059
|
-
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
2060
|
-
};
|
|
2126
|
+
}
|
|
2061
2127
|
if (newSheetTransform && newTransform) return {
|
|
2062
2128
|
newSheetTransform,
|
|
2063
2129
|
newTransform,
|
|
@@ -2093,21 +2159,22 @@ let SheetDrawingTransformAffectedController = class SheetDrawingTransformAffecte
|
|
|
2093
2159
|
};
|
|
2094
2160
|
newTransform = drawingPositionToTransform(newSheetTransform, sheetSkeletonParam);
|
|
2095
2161
|
} else if (fromRow >= rowStartIndex && toRow <= rowEndIndex) return null;
|
|
2096
|
-
else if (fromRow < rowStartIndex && toRow > rowEndIndex)
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2162
|
+
else if (fromRow < rowStartIndex && toRow > rowEndIndex) {
|
|
2163
|
+
if (anchorType === "1") {
|
|
2164
|
+
newSheetTransform = {
|
|
2165
|
+
from: { ...from },
|
|
2166
|
+
to: {
|
|
2167
|
+
...to,
|
|
2168
|
+
row: toRow - rowCount
|
|
2169
|
+
}
|
|
2170
|
+
};
|
|
2171
|
+
newTransform = drawingPositionToTransform(newSheetTransform, sheetSkeletonParam);
|
|
2172
|
+
} else return {
|
|
2173
|
+
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
2174
|
+
newTransform: transform,
|
|
2175
|
+
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
2103
2176
|
};
|
|
2104
|
-
|
|
2105
|
-
} else return {
|
|
2106
|
-
newSheetTransform: transformToDrawingPosition({ ...transform }, skeleton),
|
|
2107
|
-
newTransform: transform,
|
|
2108
|
-
axisAlignSheetTransform: transformToAxisAlignPosition({ ...transform }, skeleton)
|
|
2109
|
-
};
|
|
2110
|
-
else if (fromRow >= rowStartIndex && fromRow <= rowEndIndex) {
|
|
2177
|
+
} else if (fromRow >= rowStartIndex && fromRow <= rowEndIndex) {
|
|
2111
2178
|
if (anchorType === "1") {
|
|
2112
2179
|
newSheetTransform = {
|
|
2113
2180
|
from: {
|
|
@@ -2284,6 +2351,8 @@ exports.SetDrawingApplyMutation = SetDrawingApplyMutation;
|
|
|
2284
2351
|
exports.SetDrawingArrangeCommand = SetDrawingArrangeCommand;
|
|
2285
2352
|
exports.SetSheetDrawingCommand = SetSheetDrawingCommand;
|
|
2286
2353
|
exports.SetSheetDrawingPlacementCommand = SetSheetDrawingPlacementCommand;
|
|
2354
|
+
exports.SetWorksheetBackgroundImageCommand = SetWorksheetBackgroundImageCommand;
|
|
2355
|
+
exports.SetWorksheetBackgroundImageMutation = SetWorksheetBackgroundImageMutation;
|
|
2287
2356
|
exports.SheetDrawingAnchorType = SheetDrawingAnchorType;
|
|
2288
2357
|
exports.SheetDrawingService = SheetDrawingService;
|
|
2289
2358
|
exports.SheetDrawingTransformPlanService = SheetDrawingTransformPlanService;
|