Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
flush
jerrydd54d4b9dccb
diff --git a/packages/core/src/Sheets/Action/AddMergeAction.ts b/packages/core/src/Sheets/Action/AddMergeAction.tsindex 605f493214..31dab25187 100644--- a/packages/core/src/Sheets/Action/AddMergeAction.ts+++ b/packages/core/src/Sheets/Action/AddMergeAction.ts@@ -1,10 +1,9 @@-import { addMerge } from '../Apply/AddMerge';-import { RemoveMerge } from '../Apply/RemoveMerge';import { IRangeData } from '../../Interfaces';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers } from '../../Command/ActionObservers';-import { IRemoveMergeActionData } from './RemoveMergeAction';import { CommandUnit } from '../../Command';+import { IRemoveMergeActionData } from './RemoveMergeAction';+import { addMergeApply, RemoveMergeApply } from '../Apply';/*** @internal@@ -43,8 +42,7 @@ export class AddMergeAction extends SheetActionBase<}do(): IRangeData[] {- const worksheet = this.getWorkSheet();- return addMerge(worksheet.getMerges(), this._doActionData.rectangles);+ return addMergeApply(this._commandUnit, this._doActionData);}redo(): void {@@ -52,8 +50,7 @@ export class AddMergeAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();- RemoveMerge(worksheet.getMerges(), this._doActionData.rectangles);+ RemoveMergeApply(this._commandUnit, this._doActionData);}validate(): boolean {diff --git a/packages/core/src/Sheets/Action/AddNamedRangeAction.ts b/packages/core/src/Sheets/Action/AddNamedRangeAction.tsindex 10efb5fc62..56d7afca48 100644--- a/packages/core/src/Sheets/Action/AddNamedRangeAction.ts+++ b/packages/core/src/Sheets/Action/AddNamedRangeAction.ts@@ -7,8 +7,8 @@ import {DeleteNamedRangeAction,} from '../../Command';import { INamedRange } from '../../Interfaces/INamedRange';-import { AddNamedRange } from '../Apply/AddNamedRange';-import { DeleteNamedRange } from '../Apply/DeleteNamedRange';+import { AddNamedRangeApply } from '../Apply';+import { DeleteNamedRangeApply } from '../Apply/DeleteNamedRange';import { IDeleteNamedRangeActionData } from './DeleteNamedRangeAction';export interface IAddNamedRangeActionData extends ISheetActionData {@@ -43,14 +43,12 @@ export class AddNamedRangeAction extends SheetActionBase<}do(): void {- const { namedRange } = this._doActionData;- const namedRanges = this._workbook.getConfig().namedRanges;+ AddNamedRangeApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});- AddNamedRange(namedRanges, namedRange);}redo(): void {@@ -59,21 +57,23 @@ export class AddNamedRangeAction extends SheetActionBase<}undo(): void {- const { namedRangeId, sheetId } = this._oldActionData;- const namedRanges = this._workbook.getConfig().namedRanges;- this._observers.notifyObservers({- type: ActionType.UNDO,- data: this._oldActionData,- action: this,- });-+ const { sheetId } = this._oldActionData;// update current datathis._doActionData = {// actionName: ACTION_NAMES.ADD_NAMED_RANGE_ACTION,actionName: AddNamedRangeAction.NAME,sheetId,- namedRange: DeleteNamedRange(namedRanges, namedRangeId),+ namedRange: DeleteNamedRangeApply(+ this._commandUnit,+ this._oldActionData+ ),};++ this._observers.notifyObservers({+ type: ActionType.UNDO,+ data: this._oldActionData,+ action: this,+ });}validate(): boolean {diff --git a/packages/core/src/Sheets/Action/ClearRangeAction.ts b/packages/core/src/Sheets/Action/ClearRangeAction.tsindex 122a883edb..88114c45cc 100644--- a/packages/core/src/Sheets/Action/ClearRangeAction.ts+++ b/packages/core/src/Sheets/Action/ClearRangeAction.ts@@ -1,4 +1,4 @@-import { SetRangeData, ClearRange } from '../Apply';+import { ClearRangeApply, SetRangeDataApply } from '../Apply';import { ICellData, IOptionsData, IRangeData } from '../../Interfaces';import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';@@ -44,27 +44,18 @@ export class ClearRangeAction extends SheetActionBase<}do(): ObjectMatrixPrimitiveType<ICellData> {- const worksheet = this.getWorkSheet();-- const result = ClearRange(- worksheet.getCellMatrix(),- this._doActionData.options,- this._doActionData.rangeData- );-+ const result = ClearRangeApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}redo(): void {// update pre data- const { sheetId, rangeData } = this._doActionData;-+ const { sheetId } = this._doActionData;this._oldActionData = {// actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,actionName: SetRangeDataAction.NAME,@@ -75,13 +66,9 @@ export class ClearRangeAction extends SheetActionBase<undo(): void {const worksheet = this.getWorkSheet();- const { cellValue } = this._oldActionData;- const styles = this._workbook.getStyles();-if (worksheet) {- SetRangeData(worksheet.getCellMatrix(), cellValue, styles);+ SetRangeDataApply(this._commandUnit, this._oldActionData);// no need update current data-this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts b/packages/core/src/Sheets/Action/DeleteNamedRangeAction.tsindex 0bc1652a91..9d3584393e 100644--- a/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts+++ b/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts@@ -6,7 +6,7 @@ import {CommandUnit,AddNamedRangeAction,} from '../../Command';-import { DeleteNamedRange, AddNamedRange } from '../Apply';+import { AddNamedRangeApply, DeleteNamedRangeApply } from '../Apply';import { INamedRange } from '../../Interfaces';import { IAddNamedRangeActionData } from './AddNamedRangeAction';@@ -41,20 +41,18 @@ export class DeleteNamedRangeAction extends SheetActionBase<}do(): INamedRange {- const { namedRangeId } = this._doActionData;- const namedRanges = this._workbook.getConfig().namedRanges;+ const result = DeleteNamedRangeApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});- return DeleteNamedRange(namedRanges, namedRangeId);+ return result;}redo(): void {// update pre dataconst { sheetId } = this._doActionData;-this._oldActionData = {sheetId,// actionName: ACTION_NAMES.ADD_BANDING_ACTION,@@ -64,14 +62,12 @@ export class DeleteNamedRangeAction extends SheetActionBase<}undo(): void {- const { namedRange } = this._oldActionData;- const namedRanges = this._workbook.getConfig().namedRanges;+ AddNamedRangeApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,action: this,});- AddNamedRange(namedRanges, namedRange);}validate(): boolean {diff --git a/packages/core/src/Sheets/Action/DeleteRangeAction.ts b/packages/core/src/Sheets/Action/DeleteRangeAction.tsindex de754728a5..4569351294 100644--- a/packages/core/src/Sheets/Action/DeleteRangeAction.ts+++ b/packages/core/src/Sheets/Action/DeleteRangeAction.ts@@ -1,4 +1,3 @@-import { DeleteRange, InsertRange } from '../Apply';import { Dimension } from '../../Enum/Dimension';import { ICellData, IRangeData } from '../../Interfaces';import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';@@ -6,6 +5,7 @@ import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBaseimport { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IInsertRangeActionData, InsertRangeAction } from './InsertRangeAction';import { CommandUnit } from '../../Command';+import { DeleteRangeApply, InsertRangeApply } from '../Apply';/*** @internal@@ -45,18 +45,7 @@ export class DeleteRangeAction extends SheetActionBase<}do(): ObjectMatrixPrimitiveType<ICellData> {- const worksheet = this.getWorkSheet();-- const result = DeleteRange(- {- rowCount: worksheet.getConfig().rowCount,- columnCount: worksheet.getConfig().columnCount,- },- worksheet.getCellMatrix(),- this._doActionData.shiftDimension,- this._doActionData.rangeData- );-+ const result = DeleteRangeApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -81,19 +70,8 @@ export class DeleteRangeAction extends SheetActionBase<undo(): void {const worksheet = this.getWorkSheet();- const { shiftDimension, rangeData, cellValue } = this._oldActionData;if (worksheet) {- InsertRange(- {- rowCount: worksheet.getConfig().rowCount,- columnCount: worksheet.getConfig().columnCount,- },- worksheet.getCellMatrix(),- shiftDimension,- rangeData,- cellValue- );-+ InsertRangeApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/InsertColumnAction.ts b/packages/core/src/Sheets/Action/InsertColumnAction.tsindex d993a60777..1d9e36097d 100644--- a/packages/core/src/Sheets/Action/InsertColumnAction.ts+++ b/packages/core/src/Sheets/Action/InsertColumnAction.ts@@ -1,4 +1,4 @@-import { RemoveColumn, InsertColumn } from '../Apply';+import { InsertColumnApply, RemoveColumnApply } from '../Apply';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IRemoveColumnAction } from './removeColumnAction';@@ -40,15 +40,7 @@ export class InsertColumnAction extends SheetActionBase<}do(): void {- const worksheet = this.getWorkSheet();- const columnManager = worksheet.getColumnManager();-- InsertColumn(- this._doActionData.columnIndex,- this._doActionData.columnCount,- columnManager.getColumnData().toJSON()- );-+ InsertColumnApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -61,20 +53,12 @@ export class InsertColumnAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();- const columnManager = worksheet.getColumnManager();-+ RemoveColumnApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,action: this,});-- RemoveColumn(- this._oldActionData.columnIndex,- this._oldActionData.columnCount,- columnManager.getColumnData().toJSON()- );}validate(): boolean {diff --git a/packages/core/src/Sheets/Action/InsertColumnDataAction.ts b/packages/core/src/Sheets/Action/InsertColumnDataAction.tsindex 4a7b97381c..6de8948b0a 100644--- a/packages/core/src/Sheets/Action/InsertColumnDataAction.ts+++ b/packages/core/src/Sheets/Action/InsertColumnDataAction.ts@@ -1,11 +1,11 @@-import { InsertDataColumn, RemoveColumnData } from '../Apply';+import { InsertDataColumnApply, RemoveColumnDataApply } from '../Apply';import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';+import { ObjectArray } from '../../Shared';+import { CommandUnit } from '../../Command';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ICellData } from '../../Interfaces';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IRemoveColumnDataAction } from './RemoveColumnDataAction';-import { ObjectArray } from '../../Shared';-import { CommandUnit } from '../../Command';/*** @internal@@ -44,14 +44,7 @@ export class InsertColumnDataAction extends SheetActionBase<}do(): void {- const worksheet = this.getWorkSheet();-- InsertDataColumn(- this._doActionData.columnIndex,- this._doActionData.columnData,- worksheet.getCellMatrix().toJSON()- );-+ InsertDataColumnApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -64,14 +57,7 @@ export class InsertColumnDataAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();-- RemoveColumnData(- this._oldActionData.columnIndex,- this._oldActionData.columnCount,- worksheet.getCellMatrix().toJSON()- );-+ RemoveColumnDataApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/InsertRangeAction.ts b/packages/core/src/Sheets/Action/InsertRangeAction.tsindex 82b95ed216..60f9ce5ccc 100644--- a/packages/core/src/Sheets/Action/InsertRangeAction.ts+++ b/packages/core/src/Sheets/Action/InsertRangeAction.ts@@ -1,4 +1,3 @@-import { DeleteRange, InsertRange } from '../Apply';import { Dimension } from '../../Enum/Dimension';import { ICellData, IRangeData } from '../../Interfaces';import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';@@ -6,6 +5,7 @@ import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBaseimport { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IDeleteRangeActionData } from './DeleteRangeAction';import { CommandUnit, SetRangeDataAction } from '../../Command';+import { DeleteRangeApply, InsertRangeApply } from '../Apply';/*** @internal@@ -46,17 +46,7 @@ export class InsertRangeAction extends SheetActionBase<do(): void {const worksheet = this.getWorkSheet();if (worksheet) {- InsertRange(- {- rowCount: worksheet.getLastRow(),- columnCount: worksheet.getLastColumn(),- },- worksheet.getCellMatrix(),- this._doActionData.shiftDimension,- this._doActionData.rangeData,- this._doActionData.cellValue- );-+ InsertRangeApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -73,26 +63,16 @@ export class InsertRangeAction extends SheetActionBase<undo(): void {const { rangeData, sheetId, shiftDimension } = this._oldActionData;const worksheet = this.getWorkSheet();-if (worksheet) {// update current datathis._doActionData = {// actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,actionName: SetRangeDataAction.NAME,sheetId,- cellValue: DeleteRange(- {- rowCount: worksheet.getLastRow(),- columnCount: worksheet.getLastColumn(),- },- worksheet.getCellMatrix(),- shiftDimension,- rangeData- ),+ cellValue: DeleteRangeApply(this._commandUnit, this._oldActionData),rangeData,shiftDimension,};-this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/InsertRowAction.ts b/packages/core/src/Sheets/Action/InsertRowAction.tsindex 962543f60e..545f8e50a6 100644--- a/packages/core/src/Sheets/Action/InsertRowAction.ts+++ b/packages/core/src/Sheets/Action/InsertRowAction.ts@@ -5,7 +5,7 @@ import {ActionType,CommandUnit,} from '../../Command';-import { InsertRow, RemoveRow } from '../Apply';+import { InsertRowApply, RemoveRowApply } from '../Apply';import { IRemoveRowActionData } from './RemoveRowAction';/**@@ -44,15 +44,7 @@ export class InsertRowAction extends SheetActionBase<}do(): void {- const worksheet = this.getWorkSheet();- const rowManager = worksheet.getRowManager()!;-- InsertRow(- this._doActionData.rowIndex,- this._doActionData.rowCount,- rowManager.getRowData().toJSON()- );-+ InsertRowApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -65,20 +57,12 @@ export class InsertRowAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();- const rowManager = worksheet.getRowManager()!;-+ RemoveRowApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,action: this,});-- RemoveRow(- this._oldActionData.rowIndex,- this._oldActionData.rowCount,- rowManager.getRowData().toJSON()- );}validate(): boolean {diff --git a/packages/core/src/Sheets/Action/InsertRowDataAction.ts b/packages/core/src/Sheets/Action/InsertRowDataAction.tsindex a59b121e77..ef9a4f9eb3 100644--- a/packages/core/src/Sheets/Action/InsertRowDataAction.ts+++ b/packages/core/src/Sheets/Action/InsertRowDataAction.ts@@ -1,11 +1,11 @@-import { InsertDataRow, RemoveRowData } from '../Apply';+import { InsertDataRowApply, RemoveRowDataApply } from '../Apply';import { ICellData } from '../../Interfaces';import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';+import { ObjectArray } from '../../Shared';+import { CommandUnit } from '../../Command';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IRemoveRowDataActionData } from './RemoveRowDataAction';-import { ObjectArray } from '../../Shared';-import { CommandUnit } from '../../Command';/*** @internal@@ -44,14 +44,7 @@ export class InsertRowDataAction extends SheetActionBase<}do(): void {- const worksheet = this.getWorkSheet();-- InsertDataRow(- this._doActionData.rowIndex,- this._doActionData.rowData,- worksheet.getCellMatrix().toJSON()- );-+ InsertDataRowApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -64,14 +57,7 @@ export class InsertRowDataAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();-- RemoveRowData(- this._oldActionData.rowIndex,- this._oldActionData.rowCount,- worksheet.getCellMatrix().toJSON()- );-+ RemoveRowDataApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/InsertSheetAction.ts b/packages/core/src/Sheets/Action/InsertSheetAction.tsindex 4a385dfa11..641ce3f041 100644--- a/packages/core/src/Sheets/Action/InsertSheetAction.ts+++ b/packages/core/src/Sheets/Action/InsertSheetAction.ts@@ -1,9 +1,9 @@-import { InsertSheet, RemoveSheet } from '../Apply';+import { InsertSheetApply, RemoveSheetApply } from '../Apply';import { IWorksheetConfig } from '../../Interfaces';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';+import { CommandUnit } from '../../Command';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IRemoveSheetActionData } from './RemoveSheetAction';-import { CommandUnit } from '../../Command';export interface IInsertSheetActionData extends ISheetActionData {index: number;@@ -32,12 +32,7 @@ export class InsertSheetAction extends SheetActionBase<}do(): string {- const workbook = this.getWorkBook();- const result = InsertSheet(- workbook,- this._doActionData.index,- this._doActionData.sheet- );+ const result = InsertSheetApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -51,8 +46,7 @@ export class InsertSheetAction extends SheetActionBase<}undo(): void {- const workbook = this.getWorkBook();- RemoveSheet(workbook, this._oldActionData.sheetId);+ RemoveSheetApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/RemoveColumnDataAction.ts b/packages/core/src/Sheets/Action/RemoveColumnDataAction.tsindex a3f49a0832..f4dcad5e77 100644--- a/packages/core/src/Sheets/Action/RemoveColumnDataAction.ts+++ b/packages/core/src/Sheets/Action/RemoveColumnDataAction.ts@@ -1,4 +1,4 @@-import { InsertDataColumn, RemoveColumnData } from '../Apply';+import { InsertDataColumnApply, RemoveColumnDataApply } from '../Apply';import { ICellData } from '../../Interfaces';import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';@@ -42,20 +42,12 @@ export class RemoveColumnDataAction extends SheetActionBase<}do(): ObjectMatrixPrimitiveType<ICellData> {- const worksheet = this.getWorkSheet();-- const result = RemoveColumnData(- this._doActionData.columnIndex,- this._doActionData.columnCount,- worksheet.getCellMatrix().toJSON()- );-+ const result = RemoveColumnDataApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}@@ -64,14 +56,7 @@ export class RemoveColumnDataAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();-- InsertDataColumn(- this._oldActionData.columnIndex,- this._oldActionData.columnData,- worksheet.getCellMatrix().toJSON()- );-+ InsertDataColumnApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/RemoveMergeAction.ts b/packages/core/src/Sheets/Action/RemoveMergeAction.tsindex d04e21dee6..a0df4e194f 100644--- a/packages/core/src/Sheets/Action/RemoveMergeAction.ts+++ b/packages/core/src/Sheets/Action/RemoveMergeAction.ts@@ -1,9 +1,9 @@-import { addMerge, RemoveMerge } from '../Apply';+import { addMergeApply, RemoveMergeApply } from '../Apply';import { IRangeData } from '../../Interfaces';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';+import { CommandUnit } from '../../Command';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IAddMergeActionData } from './AddMergeAction';-import { CommandUnit } from '../../Command';/*** @internal@@ -41,19 +41,12 @@ export class RemoveMergeAction extends SheetActionBase<}do(): IRangeData[] {- const worksheet = this.getWorkSheet();-- const result = RemoveMerge(- worksheet.getMerges(),- this._doActionData.rectangles- );-+ const result = RemoveMergeApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}@@ -62,10 +55,7 @@ export class RemoveMergeAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();-- addMerge(worksheet.getMerges(), this._doActionData.rectangles);-+ addMergeApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/RemoveRowAction.ts b/packages/core/src/Sheets/Action/RemoveRowAction.tsindex cf01589caa..88713c925a 100644--- a/packages/core/src/Sheets/Action/RemoveRowAction.ts+++ b/packages/core/src/Sheets/Action/RemoveRowAction.ts@@ -1,8 +1,8 @@-import { InsertRow, RemoveRow } from '../Apply';+import { InsertRowApply, RemoveRowApply } from '../Apply';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';+import { CommandUnit } from '../../Command';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IInsertRowActionData } from './InsertRowAction';-import { CommandUnit } from '../../Command';/*** @internal@@ -40,15 +40,7 @@ export class RemoveRowAction extends SheetActionBase<}do(): number {- const worksheet = this.getWorkSheet();- const rowManager = worksheet.getRowManager()!;-- const result = RemoveRow(- this._doActionData.rowIndex,- this._doActionData.rowCount,- rowManager.getRowData().toJSON()- );-+ const result = RemoveRowApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -63,15 +55,7 @@ export class RemoveRowAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();- const rowManager = worksheet.getRowManager()!;-- InsertRow(- this._oldActionData.rowIndex,- this._oldActionData.rowCount,- rowManager.getRowData().toJSON()- );-+ InsertRowApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/RemoveRowDataAction.ts b/packages/core/src/Sheets/Action/RemoveRowDataAction.tsindex 1feab26bfb..5439c2b7ef 100644--- a/packages/core/src/Sheets/Action/RemoveRowDataAction.ts+++ b/packages/core/src/Sheets/Action/RemoveRowDataAction.ts@@ -1,10 +1,10 @@-import { InsertDataRow, RemoveRowData } from '../Apply';+import { InsertDataRowApply, RemoveRowDataApply } from '../Apply';import { ICellData } from '../../Interfaces';import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';+import { CommandUnit } from '../../Command';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IInsertRowDataActionData } from './InsertRowDataAction';-import { CommandUnit } from '../../Command';/*** @internal@@ -42,20 +42,12 @@ export class RemoveRowDataAction extends SheetActionBase<}do(): ObjectMatrixPrimitiveType<ICellData> {- const worksheet = this.getWorkSheet();-- const result = RemoveRowData(- this._doActionData.rowIndex,- this._doActionData.rowCount,- worksheet.getCellMatrix().toJSON()- );-+ const result = RemoveRowDataApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}@@ -64,14 +56,7 @@ export class RemoveRowDataAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();-- InsertDataRow(- this._oldActionData.rowIndex,- this._oldActionData.rowData,- worksheet.getCellMatrix().toJSON()- );-+ InsertDataRowApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/SetBorderAction.ts b/packages/core/src/Sheets/Action/SetBorderAction.tsindex b4a5398044..761dd9ad6f 100644--- a/packages/core/src/Sheets/Action/SetBorderAction.ts+++ b/packages/core/src/Sheets/Action/SetBorderAction.ts@@ -1,6 +1,6 @@import { ObjectMatrixPrimitiveType } from '../../Shared';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';-import { SetBorder } from '../Apply';+import { SetBorderApply } from '../Apply';import { IStyleData } from '../../Interfaces';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { CommandUnit } from '../../Command';@@ -41,20 +41,12 @@ export class SetBorderAction extends SheetActionBase<}do(): ObjectMatrixPrimitiveType<IStyleData> {- const workSheet = this.getWorkSheet();- const matrix = workSheet.getCellMatrix();- const context = workSheet.getContext();- const workBook = context.getWorkBook();- const styles = workBook.getStyles();-- const result = SetBorder(matrix, styles, this._doActionData.styles);-+ const result = SetBorderApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}@@ -63,14 +55,7 @@ export class SetBorderAction extends SheetActionBase<}undo(): void {- const wokSheet = this.getWorkSheet();- const matrix = wokSheet.getCellMatrix();- const context = wokSheet.getContext();- const workBook = context.getWorkBook();- const styles = workBook.getStyles();-- SetBorder(matrix, styles, this._oldActionData.styles);-+ SetBorderApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/SetColumnHideAction.ts b/packages/core/src/Sheets/Action/SetColumnHideAction.tsindex b0322fa86e..5e83698be8 100644--- a/packages/core/src/Sheets/Action/SetColumnHideAction.ts+++ b/packages/core/src/Sheets/Action/SetColumnHideAction.ts@@ -1,4 +1,4 @@-import { SetColumnHide, SetColumnShow } from '../Apply';+import { SetColumnHideApply, SetColumnShowApply } from '../Apply';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { ISetColumnShowActionData } from './SetColumnShowAction';@@ -40,14 +40,7 @@ export class SetColumnHideAction extends SheetActionBase<}do(): void {- const worksheet = this.getWorkSheet();-- SetColumnHide(- this._doActionData.columnIndex,- this._doActionData.columnCount,- worksheet.getColumnManager()- );-+ SetColumnHideApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -60,14 +53,7 @@ export class SetColumnHideAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();-- SetColumnShow(- this._doActionData.columnIndex,- this._doActionData.columnCount,- worksheet.getColumnManager()- );-+ SetColumnShowApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/SetColumnShowAction.ts b/packages/core/src/Sheets/Action/SetColumnShowAction.tsindex c025c7e12b..1c54fdfcb5 100644--- a/packages/core/src/Sheets/Action/SetColumnShowAction.ts+++ b/packages/core/src/Sheets/Action/SetColumnShowAction.ts@@ -1,4 +1,4 @@-import { SetColumnHide, SetColumnShow } from '../Apply';+import { SetColumnHideApply, SetColumnShowApply } from '../Apply';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { CommandUnit } from '../../Command';@@ -36,14 +36,7 @@ export class SetColumnShowAction extends SheetActionBase<ISetColumnShowActionDat}do(): void {- const worksheet = this.getWorkSheet();-- SetColumnShow(- this._doActionData.columnIndex,- this._doActionData.columnCount,- worksheet.getColumnManager()- );-+ SetColumnShowApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,@@ -56,14 +49,7 @@ export class SetColumnShowAction extends SheetActionBase<ISetColumnShowActionDat}undo(): void {- const worksheet = this.getWorkSheet();-- SetColumnHide(- this._doActionData.columnIndex,- this._doActionData.columnCount,- worksheet.getColumnManager()- );-+ SetColumnHideApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/SetColumnWidthAction.ts b/packages/core/src/Sheets/Action/SetColumnWidthAction.tsindex c995966639..167dccd526 100644--- a/packages/core/src/Sheets/Action/SetColumnWidthAction.ts+++ b/packages/core/src/Sheets/Action/SetColumnWidthAction.ts@@ -1,7 +1,7 @@-import { SetColumnWidth } from '../Apply';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { CommandUnit } from '../../Command';+import { SetColumnWidthApply } from '../Apply';/*** @internal@@ -36,20 +36,12 @@ export class SetColumnWidthAction extends SheetActionBase<ISetColumnWidthActionD}do(): number[] {- const worksheet = this.getWorkSheet();-- const result = SetColumnWidth(- this._doActionData.columnIndex,- this._doActionData.columnWidth,- worksheet.getColumnManager()- );-+ const result = SetColumnWidthApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}@@ -58,20 +50,12 @@ export class SetColumnWidthAction extends SheetActionBase<ISetColumnWidthActionD}undo(): number[] {- const worksheet = this.getWorkSheet();-- const result = SetColumnWidth(- this._oldActionData.columnIndex,- this._oldActionData.columnWidth,- worksheet.getColumnManager()- );-+ const result = SetColumnWidthApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,action: this,});-return result;}diff --git a/packages/core/src/Sheets/Action/SetHiddenGridlinesAction.ts b/packages/core/src/Sheets/Action/SetHiddenGridlinesAction.tsindex ad82b0c36d..1f0b370f66 100644--- a/packages/core/src/Sheets/Action/SetHiddenGridlinesAction.ts+++ b/packages/core/src/Sheets/Action/SetHiddenGridlinesAction.ts@@ -1,4 +1,4 @@-import { SetHiddenGridlines } from '../Apply';+import { SetHiddenGridlinesApply } from '../Apply';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { CommandUnit } from '../../Command';@@ -34,19 +34,15 @@ export class SetHiddenGridlinesAction extends SheetActionBase<ISetHiddenGridline}do(): boolean {- const worksheet = this.getWorkSheet();-- const result = SetHiddenGridlines(- worksheet,- this._doActionData.hideGridlines+ const result = SetHiddenGridlinesApply(+ this._commandUnit,+ this._doActionData);-this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}@@ -55,11 +51,7 @@ export class SetHiddenGridlinesAction extends SheetActionBase<ISetHiddenGridline}undo(): void {- const { hideGridlines, sheetId } = this._oldActionData;- const worksheet = this.getWorkSheet();-- SetHiddenGridlines(worksheet, this._oldActionData.hideGridlines);-+ SetHiddenGridlinesApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,diff --git a/packages/core/src/Sheets/Action/SetNamedRangeAction.ts b/packages/core/src/Sheets/Action/SetNamedRangeAction.tsindex 34d7af5ac1..c6015ead54 100644--- a/packages/core/src/Sheets/Action/SetNamedRangeAction.ts+++ b/packages/core/src/Sheets/Action/SetNamedRangeAction.ts@@ -5,7 +5,7 @@ import {ActionType,CommandUnit,} from '../../Command';-import { SetNamedRange } from '../Apply';+import { SetNamedRangeApply } from '../Apply';import { INamedRange } from '../../Interfaces';export interface ISetNamedRangeActionData extends ISheetActionData {@@ -39,19 +39,18 @@ export class SetNamedRangeAction extends SheetActionBase<}do(): INamedRange {- const { namedRange } = this._doActionData;- const namedRanges = this._workbook.getConfig().namedRanges;+ const result = SetNamedRangeApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});- return SetNamedRange(namedRanges, namedRange);+ return result;}redo(): void {// update pre data- const { sheetId, namedRange } = this._doActionData;+ const { sheetId } = this._doActionData;this._oldActionData = {// actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,actionName: SetNamedRangeAction.NAME,@@ -61,20 +60,18 @@ export class SetNamedRangeAction extends SheetActionBase<}undo(): void {- const { namedRange, sheetId } = this._oldActionData;- const namedRanges = this._workbook.getConfig().namedRanges;+ const { sheetId } = this._oldActionData;this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,action: this,});-// update current datathis._doActionData = {// actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,actionName: SetNamedRangeAction.NAME,sheetId,- namedRange: SetNamedRange(namedRanges, namedRange),+ namedRange: SetNamedRangeApply(this._commandUnit, this._oldActionData),};}diff --git a/packages/core/src/Sheets/Action/SetRangeDataAction.ts b/packages/core/src/Sheets/Action/SetRangeDataAction.tsindex 0daf985477..97c6281d94 100644--- a/packages/core/src/Sheets/Action/SetRangeDataAction.ts+++ b/packages/core/src/Sheets/Action/SetRangeDataAction.ts@@ -1,4 +1,4 @@-import { SetRangeData } from '../Apply';+import { SetRangeData, SetRangeDataApply } from '../Apply';import { ObjectMatrixPrimitiveType } from '../../Shared';import {SheetActionBase,@@ -48,16 +48,7 @@ export class SetRangeDataAction extends SheetActionBase<}do(): ObjectMatrixPrimitiveType<ICellData> {- const worksheet = this.getWorkSheet();- const styles = this._workbook.getStyles();-- const result = SetRangeData(- worksheet.getCellMatrix(),- this._doActionData.cellValue,- styles,- this._doActionData.options- );-+ const result = SetRangeDataApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,diff --git a/packages/core/src/Sheets/Action/removeColumnAction.ts b/packages/core/src/Sheets/Action/removeColumnAction.tsindex b3d5806857..143602ad17 100644--- a/packages/core/src/Sheets/Action/removeColumnAction.ts+++ b/packages/core/src/Sheets/Action/removeColumnAction.ts@@ -1,8 +1,8 @@-import { InsertColumn, RemoveColumn } from '../Apply';+import { InsertColumnApply, RemoveColumnApply } from '../Apply';+import { CommandUnit } from '../../Command';import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';import { ActionObservers, ActionType } from '../../Command/ActionObservers';import { IInsertColumnActionData } from './InsertColumnAction';-import { CommandUnit } from '../../Command';/*** @internal@@ -40,21 +40,12 @@ export class RemoveColumnAction extends SheetActionBase<}do(): number {- const worksheet = this.getWorkSheet();- const columnManager = worksheet.getColumnManager();-- const result = RemoveColumn(- this._doActionData.columnIndex,- this._doActionData.columnCount,- columnManager.getColumnData().toJSON()- );-+ const result = RemoveColumnApply(this._commandUnit, this._doActionData);this._observers.notifyObservers({type: ActionType.REDO,data: this._doActionData,action: this,});-return result;}@@ -63,15 +54,7 @@ export class RemoveColumnAction extends SheetActionBase<}undo(): void {- const worksheet = this.getWorkSheet();- const columnManager = worksheet.getColumnManager();-- InsertColumn(- this._oldActionData.columnIndex,- this._oldActionData.columnCount,- columnManager.getColumnData().toJSON()- );-+ InsertColumnApply(this._commandUnit, this._oldActionData);this._observers.notifyObservers({type: ActionType.UNDO,data: this._oldActionData,