Skip to content

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.

fix: update add action name

jerry559b536e9dc5
diff --git a/package.json b/package.json
index 32e1d07540..1b6e9515ca 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
"build:slide": "pnpm run --filter univer-slide-ts build:demo",
"link": "node scripts/link.js",
"build:customd": "cd cli/src/templates/univer-custom-build && npm run build:d",
- "clean": "npm cache clean --force && pnpm dlx rimraf node_modules **/node_modules/ package-lock.json yarn.lock pnpm-lock.yaml && pnpm install && pnpm dlx playwright install",
+ "clean": "npm cache clean --force && pnpm dlx [email protected] node_modules **/node_modules/ package-lock.json yarn.lock pnpm-lock.yaml && pnpm install && pnpm dlx playwright install",
"node-server": "node scripts/server.js",
"univer-cli": "cd cli && npm run cli",
"postinstall": "node scripts/postinstall.js",
diff --git a/packages/base-sheets/src/Controller/Selection/SelectionManager.ts b/packages/base-sheets/src/Controller/Selection/SelectionManager.ts
index cda65b8005..ff158f0e09 100644
--- a/packages/base-sheets/src/Controller/Selection/SelectionManager.ts
+++ b/packages/base-sheets/src/Controller/Selection/SelectionManager.ts
@@ -1,7 +1,7 @@
import { IMouseEvent, IPointerEvent, Rect, Spreadsheet, SpreadsheetColumnTitle, SpreadsheetRowTitle, ScrollTimer } from '@univer/base-render';
import { Nullable, Observer, Worksheet, ISelection, makeCellToSelection, IRangeData, RangeList, Range, IRangeCellData, ICellInfo, Command, Direction } from '@univer/core';
import { ACTION_NAMES, ISelectionsConfig } from '../../Basics';
-import { ISelectionModelValue, ISetSelectionValueActionData } from '../../Model/Action/SetSelectionValueAction';
+import { ISelectionModelValue, ISetSelectionValueActionData, SetSelectionValueAction } from '../../Model/Action/SetSelectionValueAction';
import { SelectionModel } from '../../Model/SelectionModel';
import { SheetPlugin } from '../../SheetPlugin';
import { SheetView } from '../../View/Render/Views/SheetView';
@@ -276,7 +276,7 @@ export class SelectionManager {
const value: ISetSelectionValueActionData = {
sheetId: this._worksheet.getSheetId(),
- actionName: ACTION_NAMES.SET_SELECTION_VALUE_ACTION,
+ actionName: SetSelectionValueAction.NAME,
selections: models,
};
diff --git a/packages/base-sheets/src/Controller/SheetBarController.ts b/packages/base-sheets/src/Controller/SheetBarController.ts
index d2911556c0..10f0b2ff93 100644
--- a/packages/base-sheets/src/Controller/SheetBarController.ts
+++ b/packages/base-sheets/src/Controller/SheetBarController.ts
@@ -1,5 +1,18 @@
import { BaseMenuItem, BaseUlProps } from '@univer/base-component';
-import { ACTION_NAMES, CommandManager, NameGen, Nullable, PLUGIN_NAMES, SheetActionBase } from '@univer/core';
+import {
+ CommandManager,
+ InsertSheetAction,
+ NameGen,
+ Nullable,
+ PLUGIN_NAMES,
+ RemoveSheetAction,
+ SetSheetOrderAction,
+ SetTabColorAction,
+ SetWorkSheetActivateAction,
+ SetWorkSheetNameAction,
+ SetWorkSheetStatusAction,
+ SheetActionBase,
+} from '@univer/core';
import { ColorPicker } from '@univer/style-univer';
import { SheetBarModel } from '../Model/SheetBarModel';
import { SheetBar } from '../View/UI/SheetBar';
@@ -254,13 +267,13 @@ class SheetBarUIController {
const { data } = actionEvent;
switch (data.actionName) {
- case ACTION_NAMES.SET_SHEET_ORDER_ACTION:
- case ACTION_NAMES.INSERT_SHEET_ACTION:
- case ACTION_NAMES.SET_TAB_COLOR_ACTION:
- case ACTION_NAMES.REMOVE_SHEET_ACTION:
- case ACTION_NAMES.SET_WORKSHEET_NAME_ACTION:
- case ACTION_NAMES.SET_WORKSHEET_ACTIVATE_ACTION:
- case ACTION_NAMES.SET_WORKSHEET_STATUS_ACTION: {
+ case SetSheetOrderAction.NAME:
+ case InsertSheetAction.NAME:
+ case SetTabColorAction.NAME:
+ case RemoveSheetAction.NAME:
+ case SetWorkSheetNameAction.NAME:
+ case SetWorkSheetActivateAction.NAME:
+ case SetWorkSheetStatusAction.NAME: {
// update data;
this._initializeData();
// set ui bar sheetList;
diff --git a/packages/base-sheets/src/Model/Action/SetSelectionValueAction.ts b/packages/base-sheets/src/Model/Action/SetSelectionValueAction.ts
index a8e12d3e74..abc14d927a 100644
--- a/packages/base-sheets/src/Model/Action/SetSelectionValueAction.ts
+++ b/packages/base-sheets/src/Model/Action/SetSelectionValueAction.ts
@@ -1,5 +1,5 @@
-import { SheetActionBase, ActionObservers, ActionType, ISheetActionData, ICellInfo, ISelection, Nullable, Workbook } from '@univer/core';
-import { ACTION_NAMES } from '../../Basics';
+import { SheetActionBase, ActionObservers, ActionType, ISheetActionData, ICellInfo, ISelection, Nullable, CommandUnit } from '@univer/core';
+import { ACTION_NAMES } from '@Basics';
import { SetSelectionValue } from '../Apply/SetSelectionValue';
export interface ISelectionModelValue {
@@ -12,8 +12,10 @@ export interface ISetSelectionValueActionData extends ISheetActionData {
}
export class SetSelectionValueAction extends SheetActionBase<ISetSelectionValueActionData, ISetSelectionValueActionData, ISelectionModelValue[]> {
- constructor(actionData: ISetSelectionValueActionData, workbook: Workbook, observers: ActionObservers) {
- super(actionData, workbook, observers);
+ static NAME = 'SetSelectionValueAction';
+
+ constructor(actionData: ISetSelectionValueActionData, commandUnit: CommandUnit, observers: ActionObservers) {
+ super(actionData, commandUnit, observers);
this._doActionData = {
...actionData,
diff --git a/packages/core/src/Command/RegisterAction.ts b/packages/core/src/Command/RegisterAction.ts
index 0c50cccafd..14dac8fe82 100644
--- a/packages/core/src/Command/RegisterAction.ts
+++ b/packages/core/src/Command/RegisterAction.ts
@@ -1,4 +1,3 @@
-import { ACTION_NAMES } from '../Const';
import {
AddMergeAction,
AddNamedRangeAction,
@@ -71,78 +70,51 @@ import {
* All Commands are registered statically. For each new Command, a static registration method must be added here.
*/
-CommandManager.register(ACTION_NAMES.INSERT_ROW_DATA_ACTION, InsertRowDataAction);
-CommandManager.register(ACTION_NAMES.INSERT_ROW_ACTION, InsertRowAction);
-CommandManager.register(ACTION_NAMES.REMOVE_ROW_DATA_ACTION, RemoveRowDataAction);
-CommandManager.register(ACTION_NAMES.REMOVE_ROW_ACTION, RemoveRowAction);
-CommandManager.register(ACTION_NAMES.SET_RANGE_STYLE_ACTION, SetRangeStyleAction);
-CommandManager.register(
- ACTION_NAMES.SET_WORKSHEET_STATUS_ACTION,
- SetWorkSheetStatusAction
-);
-CommandManager.register(
- ACTION_NAMES.SET_SELECTION_ACTION,
- SetSelectionActivateAction
-);
-CommandManager.register(ACTION_NAMES.SET_RANGE_DATA_ACTION, SetRangeDataAction);
-CommandManager.register(
- ACTION_NAMES.SET_RANGE_FORMATTED_VALUE_ACTION,
+CommandManager.register(InsertRowDataAction.NAME, InsertRowDataAction);
+CommandManager.register(InsertRowAction.NAME, InsertRowAction);
+CommandManager.register(RemoveRowDataAction.NAME, RemoveRowDataAction);
+CommandManager.register(RemoveRowAction.NAME, RemoveRowAction);
+CommandManager.register(SetRangeStyleAction.NAME, SetRangeStyleAction);
+CommandManager.register(SetWorkSheetStatusAction.NAME, SetWorkSheetStatusAction);
+CommandManager.register(SetSelectionActivateAction.NAME, SetSelectionActivateAction);
+CommandManager.register(SetRangeDataAction.NAME, SetRangeDataAction);
+CommandManager.register(
+ SetRangeFormattedValueAction.NAME,
SetRangeFormattedValueAction
);
-CommandManager.register(ACTION_NAMES.DELETE_RANGE_ACTION, DeleteRangeAction);
-CommandManager.register(ACTION_NAMES.CLEAR_RANGE_ACTION, ClearRangeAction);
-CommandManager.register(ACTION_NAMES.INSERT_RANGE_ACTION, InsertRangeAction);
-CommandManager.register(ACTION_NAMES.SET_TAB_COLOR_ACTION, SetTabColorAction);
-CommandManager.register(ACTION_NAMES.HIDE_SHEET_ACTION, SetWorkSheetHideAction);
-CommandManager.register(
- ACTION_NAMES.SET_WORKSHEET_ACTIVATE_ACTION,
- SetWorkSheetActivateAction
-);
-CommandManager.register(ACTION_NAMES.SET_HIDE_ROW_ACTION, SetRowHideAction);
-CommandManager.register(ACTION_NAMES.SET_SHOW_ROW_ACTION, SetRowShowAction);
-CommandManager.register(ACTION_NAMES.SET_HIDE_COLUMN_ACTION, SetColumnHideAction);
-CommandManager.register(ACTION_NAMES.SET_SHOW_COLUMN_ACTION, SetColumnShowAction);
-CommandManager.register(ACTION_NAMES.ADD_MERGE_ACTION, AddMergeAction);
-CommandManager.register(ACTION_NAMES.REMOVE_MERGE_ACTION, RemoveMergeAction);
-CommandManager.register(
- ACTION_NAMES.SET_WORKSHEET_NAME_ACTION,
- SetWorkSheetNameAction
-);
-CommandManager.register(
- ACTION_NAMES.SET_HIDDEN_GRIDLINES_ACTION,
- SetHiddenGridlinesAction
-);
-CommandManager.register(ACTION_NAMES.SET_COLUMN_WIDTH_ACTION, SetColumnWidthAction);
-CommandManager.register(ACTION_NAMES.SET_ROW_HEIGHT_ACTION, SetRowHeightAction);
-CommandManager.register(ACTION_NAMES.SET_BORDER_ACTION, SetBorderAction);
-CommandManager.register(ACTION_NAMES.SET_RIGHT_TO_LEFT_ACTION, SetRightToLeftAction);
-CommandManager.register(
- ACTION_NAMES.INSERT_COLUMN_DATA_ACTION,
- InsertColumnDataAction
-);
-CommandManager.register(
- ACTION_NAMES.REMOVE_COLUMN_DATA_ACTION,
- RemoveColumnDataAction
-);
-CommandManager.register(ACTION_NAMES.INSERT_COLUMN_ACTION, InsertColumnAction);
-CommandManager.register(ACTION_NAMES.REMOVE_COLUMN_ACTION, RemoveColumnAction);
-CommandManager.register(
- ACTION_NAMES.DELETE_NAMED_RANGE_ACTION,
- DeleteNamedRangeAction
-);
-CommandManager.register(ACTION_NAMES.SET_NAMED_RANGE_ACTION, SetNamedRangeAction);
-CommandManager.register(ACTION_NAMES.ADD_NAMED_RANGE_ACTION, AddNamedRangeAction);
-CommandManager.register(ACTION_NAMES.SET_RANGE_FORMAT_ACTION, SetRangeFormatAction);
-CommandManager.register(
- ACTION_NAMES.SET_RANGE_FORMULA_ACTION,
- SetRangeFormulaAction
-);
-CommandManager.register(ACTION_NAMES.SET_RANGE_NOTE_ACTION, SetRangeNoteAction);
-CommandManager.register(ACTION_NAMES.INSERT_SHEET_ACTION, InsertSheetAction);
-CommandManager.register(ACTION_NAMES.REMOVE_SHEET_ACTION, RemoveSheetAction);
-CommandManager.register(ACTION_NAMES.SET_SHEET_ORDER_ACTION, SetSheetOrderAction);
-CommandManager.register(ACTION_NAMES.SET_SHEET_ORDER_ACTION, SetSheetOrderAction);
-CommandManager.register(ACTION_NAMES.SET_ZOOM_RATIO_ACTION, SetZoomRatioAction);
+CommandManager.register(DeleteRangeAction.NAME, DeleteRangeAction);
+CommandManager.register(ClearRangeAction.NAME, ClearRangeAction);
+CommandManager.register(InsertRangeAction.NAME, InsertRangeAction);
+CommandManager.register(SetTabColorAction.NAME, SetTabColorAction);
+CommandManager.register(SetWorkSheetHideAction.NAME, SetWorkSheetHideAction);
+CommandManager.register(SetWorkSheetActivateAction.NAME, SetWorkSheetActivateAction);
+CommandManager.register(SetRowHideAction.NAME, SetRowHideAction);
+CommandManager.register(SetRowShowAction.NAME, SetRowShowAction);
+CommandManager.register(SetColumnHideAction.NAME, SetColumnHideAction);
+CommandManager.register(SetColumnShowAction.NAME, SetColumnShowAction);
+CommandManager.register(AddMergeAction.NAME, AddMergeAction);
+CommandManager.register(RemoveMergeAction.NAME, RemoveMergeAction);
+CommandManager.register(SetWorkSheetNameAction.NAME, SetWorkSheetNameAction);
+CommandManager.register(SetHiddenGridlinesAction.NAME, SetHiddenGridlinesAction);
+CommandManager.register(SetColumnWidthAction.NAME, SetColumnWidthAction);
+CommandManager.register(SetRowHeightAction.NAME, SetRowHeightAction);
+CommandManager.register(SetBorderAction.NAME, SetBorderAction);
+CommandManager.register(SetRightToLeftAction.NAME, SetRightToLeftAction);
+CommandManager.register(InsertColumnDataAction.NAME, InsertColumnDataAction);
+CommandManager.register(RemoveColumnDataAction.NAME, RemoveColumnDataAction);
+CommandManager.register(InsertColumnAction.NAME, InsertColumnAction);
+CommandManager.register(RemoveColumnAction.NAME, RemoveColumnAction);
+CommandManager.register(DeleteNamedRangeAction.NAME, DeleteNamedRangeAction);
+CommandManager.register(SetNamedRangeAction.NAME, SetNamedRangeAction);
+CommandManager.register(AddNamedRangeAction.NAME, AddNamedRangeAction);
+CommandManager.register(SetRangeFormatAction.NAME, SetRangeFormatAction);
+CommandManager.register(SetRangeFormulaAction.NAME, SetRangeFormulaAction);
+CommandManager.register(SetRangeNoteAction.NAME, SetRangeNoteAction);
+CommandManager.register(InsertSheetAction.NAME, InsertSheetAction);
+CommandManager.register(RemoveSheetAction.NAME, RemoveSheetAction);
+CommandManager.register(SetSheetOrderAction.NAME, SetSheetOrderAction);
+CommandManager.register(SetSheetOrderAction.NAME, SetSheetOrderAction);
+CommandManager.register(SetZoomRatioAction.NAME, SetZoomRatioAction);
///====================================================================================================
///====================================================================================================
diff --git a/packages/core/src/Docs/Action/DeleteTextAction.ts b/packages/core/src/Docs/Action/DeleteTextAction.ts
index be26e1d334..dca75b8466 100644
--- a/packages/core/src/Docs/Action/DeleteTextAction.ts
+++ b/packages/core/src/Docs/Action/DeleteTextAction.ts
@@ -15,6 +15,8 @@ export class DeleteTextAction extends DocActionBase<
IDeleteTextActionData,
IInsertTextActionData
> {
+ static Name = 'DeleteTextAction';
+
constructor(
actionData: IDeleteTextActionData,
commandUnit: CommandUnit,
diff --git a/packages/core/src/Docs/Action/InsertTextAction.ts b/packages/core/src/Docs/Action/InsertTextAction.ts
index 9306ef8448..e010a71d6c 100644
--- a/packages/core/src/Docs/Action/InsertTextAction.ts
+++ b/packages/core/src/Docs/Action/InsertTextAction.ts
@@ -15,6 +15,8 @@ export class InsertTextAction extends DocActionBase<
IInsertTextActionData,
IDeleteTextActionData
> {
+ static NAME = 'InsertTextAction';
+
constructor(
actionData: IInsertTextActionData,
commandUnit: CommandUnit,
diff --git a/packages/core/src/Sheets/Action/AddNamedRangeAction.ts b/packages/core/src/Sheets/Action/AddNamedRangeAction.ts
index b56cd23295..10efb5fc62 100644
--- a/packages/core/src/Sheets/Action/AddNamedRangeAction.ts
+++ b/packages/core/src/Sheets/Action/AddNamedRangeAction.ts
@@ -4,8 +4,8 @@ import {
ActionObservers,
ActionType,
CommandUnit,
+ DeleteNamedRangeAction,
} from '../../Command';
-import { ACTION_NAMES } from '../../Const';
import { INamedRange } from '../../Interfaces/INamedRange';
import { AddNamedRange } from '../Apply/AddNamedRange';
import { DeleteNamedRange } from '../Apply/DeleteNamedRange';
@@ -34,7 +34,8 @@ export class AddNamedRangeAction extends SheetActionBase<
};
this.do();
this._oldActionData = {
- actionName: ACTION_NAMES.DELETE_NAMED_RANGE_ACTION,
+ //actionName: ACTION_NAMES.DELETE_NAMED_RANGE_ACTION,
+ actionName: DeleteNamedRangeAction.NAME,
sheetId: actionData.sheetId,
namedRangeId: actionData.namedRange.namedRangeId,
};
@@ -68,7 +69,8 @@ export class AddNamedRangeAction extends SheetActionBase<
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.ADD_NAMED_RANGE_ACTION,
+ // actionName: ACTION_NAMES.ADD_NAMED_RANGE_ACTION,
+ actionName: AddNamedRangeAction.NAME,
sheetId,
namedRange: DeleteNamedRange(namedRanges, namedRangeId),
};
diff --git a/packages/core/src/Sheets/Action/ClearRangeAction.ts b/packages/core/src/Sheets/Action/ClearRangeAction.ts
index dddc196116..122a883edb 100644
--- a/packages/core/src/Sheets/Action/ClearRangeAction.ts
+++ b/packages/core/src/Sheets/Action/ClearRangeAction.ts
@@ -1,10 +1,9 @@
import { SetRangeData, ClearRange } from '../Apply';
-import { ACTION_NAMES } from '../../Const';
import { ICellData, IOptionsData, IRangeData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
-import { ISetRangeDataActionData } from './SetRangeDataAction';
+import { ISetRangeDataActionData, SetRangeDataAction } from './SetRangeDataAction';
import { CommandUnit } from '../../Command';
/**
@@ -67,7 +66,8 @@ export class ClearRangeAction extends SheetActionBase<
const { sheetId, rangeData } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ actionName: SetRangeDataAction.NAME,
sheetId,
cellValue: this.do(),
};
diff --git a/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts b/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts
index 96a47d7e6b..0bc1652a91 100644
--- a/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts
+++ b/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts
@@ -4,11 +4,10 @@ import {
ActionObservers,
ActionType,
CommandUnit,
+ AddNamedRangeAction,
} from '../../Command';
-import { ACTION_NAMES } from '../../Const';
-import { INamedRange } from '../../Interfaces/INamedRange';
-import { AddNamedRange } from '../Apply/AddNamedRange';
-import { DeleteNamedRange } from '../Apply/DeleteNamedRange';
+import { DeleteNamedRange, AddNamedRange } from '../Apply';
+import { INamedRange } from '../../Interfaces';
import { IAddNamedRangeActionData } from './AddNamedRangeAction';
export interface IDeleteNamedRangeActionData extends ISheetActionData {
@@ -33,7 +32,8 @@ export class DeleteNamedRangeAction extends SheetActionBase<
...actionData,
};
this._oldActionData = {
- actionName: ACTION_NAMES.ADD_NAMED_RANGE_ACTION,
+ // actionName: ACTION_NAMES.ADD_NAMED_RANGE_ACTION,
+ actionName: AddNamedRangeAction.NAME,
sheetId: actionData.sheetId,
namedRange: this.do(),
};
@@ -57,7 +57,8 @@ export class DeleteNamedRangeAction extends SheetActionBase<
this._oldActionData = {
sheetId,
- actionName: ACTION_NAMES.ADD_BANDING_ACTION,
+ // actionName: ACTION_NAMES.ADD_BANDING_ACTION,
+ actionName: AddNamedRangeAction.NAME,
namedRange: this.do(),
};
}
diff --git a/packages/core/src/Sheets/Action/DeleteRangeAction.ts b/packages/core/src/Sheets/Action/DeleteRangeAction.ts
index fe5aaad18a..de754728a5 100644
--- a/packages/core/src/Sheets/Action/DeleteRangeAction.ts
+++ b/packages/core/src/Sheets/Action/DeleteRangeAction.ts
@@ -1,11 +1,10 @@
import { DeleteRange, InsertRange } from '../Apply';
-import { ACTION_NAMES } from '../../Const';
import { Dimension } from '../../Enum/Dimension';
import { ICellData, IRangeData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
-import { IInsertRangeActionData } from './InsertRangeAction';
+import { IInsertRangeActionData, InsertRangeAction } from './InsertRangeAction';
import { CommandUnit } from '../../Command';
/**
@@ -72,7 +71,8 @@ export class DeleteRangeAction extends SheetActionBase<
const { sheetId, rangeData, shiftDimension } = this._doActionData;
this._oldActionData = {
sheetId,
- actionName: ACTION_NAMES.INSERT_RANGE_ACTION,
+ // actionName: ACTION_NAMES.INSERT_RANGE_ACTION,
+ actionName: InsertRangeAction.NAME,
shiftDimension,
rangeData,
cellValue: this.do(),
diff --git a/packages/core/src/Sheets/Action/InsertRangeAction.ts b/packages/core/src/Sheets/Action/InsertRangeAction.ts
index 3a80d000e7..82b95ed216 100644
--- a/packages/core/src/Sheets/Action/InsertRangeAction.ts
+++ b/packages/core/src/Sheets/Action/InsertRangeAction.ts
@@ -1,12 +1,11 @@
import { DeleteRange, InsertRange } from '../Apply';
-import { ACTION_NAMES } from '../../Const';
import { Dimension } from '../../Enum/Dimension';
import { ICellData, IRangeData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
import { IDeleteRangeActionData } from './DeleteRangeAction';
-import { CommandUnit } from '../../Command';
+import { CommandUnit, SetRangeDataAction } from '../../Command';
/**
* @internal
@@ -78,7 +77,8 @@ export class InsertRangeAction extends SheetActionBase<
if (worksheet) {
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ actionName: SetRangeDataAction.NAME,
sheetId,
cellValue: DeleteRange(
{
diff --git a/packages/core/src/Sheets/Action/SetNamedRangeAction.ts b/packages/core/src/Sheets/Action/SetNamedRangeAction.ts
index e3b6905848..34d7af5ac1 100644
--- a/packages/core/src/Sheets/Action/SetNamedRangeAction.ts
+++ b/packages/core/src/Sheets/Action/SetNamedRangeAction.ts
@@ -5,9 +5,8 @@ import {
ActionType,
CommandUnit,
} from '../../Command';
-import { ACTION_NAMES } from '../../Const';
-import { INamedRange } from '../../Interfaces/INamedRange';
-import { SetNamedRange } from '../Apply/SetNamedRange';
+import { SetNamedRange } from '../Apply';
+import { INamedRange } from '../../Interfaces';
export interface ISetNamedRangeActionData extends ISheetActionData {
namedRange: INamedRange;
@@ -31,9 +30,10 @@ export class SetNamedRangeAction extends SheetActionBase<
...actionData,
};
this._oldActionData = {
- actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,
- sheetId: actionData.sheetId,
+ // actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,
+ actionName: SetNamedRangeAction.NAME,
namedRange: this.do(),
+ sheetId: actionData.sheetId,
};
this.validate();
}
@@ -53,7 +53,8 @@ export class SetNamedRangeAction extends SheetActionBase<
// update pre data
const { sheetId, namedRange } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,
+ // actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,
+ actionName: SetNamedRangeAction.NAME,
sheetId,
namedRange: this.do(),
};
@@ -70,7 +71,8 @@ export class SetNamedRangeAction extends SheetActionBase<
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,
+ // actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,
+ actionName: SetNamedRangeAction.NAME,
sheetId,
namedRange: SetNamedRange(namedRanges, namedRange),
};
diff --git a/packages/core/src/Sheets/Action/SetRangeDataAction.ts b/packages/core/src/Sheets/Action/SetRangeDataAction.ts
index 7e71518470..0daf985477 100644
--- a/packages/core/src/Sheets/Action/SetRangeDataAction.ts
+++ b/packages/core/src/Sheets/Action/SetRangeDataAction.ts
@@ -1,5 +1,4 @@
import { SetRangeData } from '../Apply';
-import { ACTION_NAMES } from '../../Const';
import { ObjectMatrixPrimitiveType } from '../../Shared';
import {
SheetActionBase,
@@ -72,7 +71,8 @@ export class SetRangeDataAction extends SheetActionBase<
// update pre data
const { sheetId, options } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ actionName: SetRangeDataAction.NAME,
sheetId,
cellValue: this.do(),
options,
@@ -86,7 +86,8 @@ export class SetRangeDataAction extends SheetActionBase<
if (worksheet) {
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ actionName: SetRangeDataAction.NAME,
sheetId,
cellValue: SetRangeData(
worksheet.getCellMatrix(),
diff --git a/packages/core/src/Sheets/Action/SetRangeFormatAction.ts b/packages/core/src/Sheets/Action/SetRangeFormatAction.ts
index 3b157b8c95..b4d6c8d97d 100644
--- a/packages/core/src/Sheets/Action/SetRangeFormatAction.ts
+++ b/packages/core/src/Sheets/Action/SetRangeFormatAction.ts
@@ -1,5 +1,4 @@
import { SetRangeFormat } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { IRangeData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
@@ -64,7 +63,8 @@ export class SetRangeFormatAction extends SheetActionBase<
// update pre data
const { sheetId, rangeData } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_RANGE_FORMAT_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_FORMAT_ACTION,
+ actionName: SetRangeFormatAction.NAME,
sheetId,
cellFormat: this.do(),
rangeData,
@@ -78,7 +78,8 @@ export class SetRangeFormatAction extends SheetActionBase<
if (worksheet) {
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_RANGE_FORMAT_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_FORMAT_ACTION,
+ actionName: SetRangeFormatAction.NAME,
sheetId,
cellFormat: SetRangeFormat(
worksheet.getCellMatrix(),
diff --git a/packages/core/src/Sheets/Action/SetRangeFormattedValueAction.ts b/packages/core/src/Sheets/Action/SetRangeFormattedValueAction.ts
index cdea700e8c..6efb247087 100644
--- a/packages/core/src/Sheets/Action/SetRangeFormattedValueAction.ts
+++ b/packages/core/src/Sheets/Action/SetRangeFormattedValueAction.ts
@@ -1,10 +1,9 @@
import { SetRangeFormattedValue } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { ICellV, IRangeData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
-import { CommandUnit } from '../../Command';
+import { CommandUnit, SetRangeDataAction } from '../../Command';
/**
*
@@ -64,7 +63,8 @@ export class SetRangeFormattedValueAction extends SheetActionBase<
// update pre data
const { sheetId, rangeData } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ actionName: SetRangeDataAction.NAME,
sheetId,
cellValue: this.do(),
rangeData,
@@ -77,7 +77,8 @@ export class SetRangeFormattedValueAction extends SheetActionBase<
if (worksheet) {
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
+ actionName: SetRangeDataAction.NAME,
sheetId,
cellValue: SetRangeFormattedValue(
worksheet.getCellMatrix(),
diff --git a/packages/core/src/Sheets/Action/SetRangeFormulaAction.ts b/packages/core/src/Sheets/Action/SetRangeFormulaAction.ts
index 0e98267e04..7b731f0382 100644
--- a/packages/core/src/Sheets/Action/SetRangeFormulaAction.ts
+++ b/packages/core/src/Sheets/Action/SetRangeFormulaAction.ts
@@ -1,5 +1,4 @@
import { SetRangeFormula } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { IRangeData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
@@ -64,7 +63,8 @@ export class SetRangeFormulaAction extends SheetActionBase<
// update pre data
const { sheetId, rangeData } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_RANGE_FORMULA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_FORMULA_ACTION,
+ actionName: SetRangeFormulaAction.NAME,
sheetId,
cellFormula: this.do(),
rangeData,
@@ -77,7 +77,8 @@ export class SetRangeFormulaAction extends SheetActionBase<
if (worksheet) {
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_RANGE_FORMULA_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_FORMULA_ACTION,
+ actionName: SetRangeFormulaAction.NAME,
sheetId,
cellFormula: SetRangeFormula(
worksheet.getCellMatrix(),
diff --git a/packages/core/src/Sheets/Action/SetRangeNoteAction.ts b/packages/core/src/Sheets/Action/SetRangeNoteAction.ts
index 7d61607baa..3d42057ea1 100644
--- a/packages/core/src/Sheets/Action/SetRangeNoteAction.ts
+++ b/packages/core/src/Sheets/Action/SetRangeNoteAction.ts
@@ -1,5 +1,4 @@
import { SetRangeNote } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { IRangeData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
@@ -64,7 +63,8 @@ export class SetRangeNoteAction extends SheetActionBase<
// update pre data
const { sheetId, rangeData } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_RANGE_NOTE_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_NOTE_ACTION,
+ actionName: SetRangeNoteAction.NAME,
sheetId,
cellNote: this.do(),
rangeData,
@@ -77,7 +77,8 @@ export class SetRangeNoteAction extends SheetActionBase<
if (worksheet) {
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_RANGE_NOTE_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_NOTE_ACTION,
+ actionName: SetRangeNoteAction.NAME,
sheetId,
cellNote: SetRangeNote(
worksheet.getCellMatrix(),
diff --git a/packages/core/src/Sheets/Action/SetRangeStyleAction.ts b/packages/core/src/Sheets/Action/SetRangeStyleAction.ts
index b3b92a0e82..1c23b43924 100644
--- a/packages/core/src/Sheets/Action/SetRangeStyleAction.ts
+++ b/packages/core/src/Sheets/Action/SetRangeStyleAction.ts
@@ -1,5 +1,4 @@
import { SetRangeStyle } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { IRangeData, IStyleData } from '../../Interfaces';
import { ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
@@ -53,7 +52,8 @@ export class SetRangeStyleAction extends SheetActionBase<ISetRangeStyleActionDat
// update pre data
const { sheetId, rangeData } = this._doActionData;
this._oldActionData = {
- actionName: ACTION_NAMES.SET_RANGE_STYLE_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_STYLE_ACTION,
+ actionName: SetRangeStyleAction.NAME,
sheetId,
value: this.do(),
rangeData,
@@ -67,7 +67,8 @@ export class SetRangeStyleAction extends SheetActionBase<ISetRangeStyleActionDat
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_RANGE_STYLE_ACTION,
+ // actionName: ACTION_NAMES.SET_RANGE_STYLE_ACTION,
+ actionName: SetRangeStyleAction.NAME,
sheetId,
value: SetRangeStyle(cellMatrix, value, rangeData, styles),
rangeData,
diff --git a/packages/core/src/Sheets/Action/SetSelectionActivateAction.ts b/packages/core/src/Sheets/Action/SetSelectionActivateAction.ts
index f5ce6dd394..739e863a04 100644
--- a/packages/core/src/Sheets/Action/SetSelectionActivateAction.ts
+++ b/packages/core/src/Sheets/Action/SetSelectionActivateAction.ts
@@ -1,4 +1,3 @@
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { IRangeData } from '../../Interfaces';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
@@ -81,7 +80,8 @@ export class SetSelectionActivateAction extends SheetActionBase<
const { sheetId } = this._doActionData;
const { activeRangeList, activeRange, currentCell } = this.do();
this._oldActionData = {
- actionName: ACTION_NAMES.SET_SELECTION_ACTION,
+ // actionName: ACTION_NAMES.SET_SELECTION_ACTION,
+ actionName: SetSelectionActivateAction.NAME,
sheetId,
activeRangeList,
activeRange,
@@ -102,7 +102,8 @@ export class SetSelectionActivateAction extends SheetActionBase<
);
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_SELECTION_ACTION,
+ // actionName: ACTION_NAMES.SET_SELECTION_ACTION,
+ actionName: SetSelectionActivateAction.NAME,
sheetId,
activeRangeList: doData.activeRangeList,
activeRange: doData.activeRange,
diff --git a/packages/core/src/Sheets/Action/SetTabColorAction.ts b/packages/core/src/Sheets/Action/SetTabColorAction.ts
index 1c8d8a5f3f..27e71a8a4f 100644
--- a/packages/core/src/Sheets/Action/SetTabColorAction.ts
+++ b/packages/core/src/Sheets/Action/SetTabColorAction.ts
@@ -1,5 +1,4 @@
import { SetTabColor } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { Nullable } from '../../Shared/Types';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
@@ -59,7 +58,8 @@ export class SetTabColorAction extends SheetActionBase<
const { sheetId } = this._doActionData;
this._oldActionData = {
sheetId,
- actionName: ACTION_NAMES.SET_TAB_COLOR_ACTION,
+ // actionName: ACTION_NAMES.SET_TAB_COLOR_ACTION,
+ actionName: SetTabColorAction.NAME,
color: this.do(),
};
}
@@ -70,7 +70,8 @@ export class SetTabColorAction extends SheetActionBase<
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_TAB_COLOR_ACTION,
+ // actionName: ACTION_NAMES.SET_TAB_COLOR_ACTION,
+ actionName: SetTabColorAction.NAME,
sheetId,
color: SetTabColor(worksheet, color),
};
diff --git a/packages/core/src/Sheets/Action/SetWorkSheetActivateAction.ts b/packages/core/src/Sheets/Action/SetWorkSheetActivateAction.ts
index 116b3b4688..1afe341b6d 100644
--- a/packages/core/src/Sheets/Action/SetWorkSheetActivateAction.ts
+++ b/packages/core/src/Sheets/Action/SetWorkSheetActivateAction.ts
@@ -1,5 +1,4 @@
import { SetWorkSheetActivate } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
import { BooleanNumber } from '../../Enum';
@@ -69,7 +68,8 @@ export class SetWorkSheetActivateAction extends SheetActionBase<
// update pre data
const { oldSheetId, status } = this.do();
this._oldActionData = {
- actionName: ACTION_NAMES.SET_WORKSHEET_ACTIVATE_ACTION,
+ // actionName: ACTION_NAMES.SET_WORKSHEET_ACTIVATE_ACTION,
+ actionName: SetWorkSheetActivateAction.NAME,
sheetId: oldSheetId,
status,
};
@@ -86,7 +86,7 @@ export class SetWorkSheetActivateAction extends SheetActionBase<
);
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_WORKSHEET_ACTIVATE_ACTION,
+ actionName: SetWorkSheetActivateAction.NAME,
sheetId: oldSheetId,
status,
};
diff --git a/packages/core/src/Sheets/Action/SetWorkSheetHideAction.ts b/packages/core/src/Sheets/Action/SetWorkSheetHideAction.ts
index 1d7d5ffe91..e4ca564576 100644
--- a/packages/core/src/Sheets/Action/SetWorkSheetHideAction.ts
+++ b/packages/core/src/Sheets/Action/SetWorkSheetHideAction.ts
@@ -1,5 +1,4 @@
import { SetWorkSheetHideService } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { BooleanNumber } from '../../Enum';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
@@ -56,7 +55,8 @@ export class SetWorkSheetHideAction extends SheetActionBase<
const { sheetId } = this._doActionData;
this._oldActionData = {
sheetId,
- actionName: ACTION_NAMES.HIDE_SHEET_ACTION,
+ // actionName: ACTION_NAMES.HIDE_SHEET_ACTION,
+ actionName: SetWorkSheetHideAction.NAME,
hidden: this.do(),
};
}
@@ -66,7 +66,7 @@ export class SetWorkSheetHideAction extends SheetActionBase<
const worksheet = this.getWorkSheet();
this._doActionData = {
- actionName: ACTION_NAMES.HIDE_SHEET_ACTION,
+ actionName: SetWorkSheetHideAction.NAME,
sheetId,
hidden: SetWorkSheetHideService(worksheet, hidden),
};
diff --git a/packages/core/src/Sheets/Action/SetWorkSheetNameAction.ts b/packages/core/src/Sheets/Action/SetWorkSheetNameAction.ts
index 2bb2ac08f0..3d1ce32264 100644
--- a/packages/core/src/Sheets/Action/SetWorkSheetNameAction.ts
+++ b/packages/core/src/Sheets/Action/SetWorkSheetNameAction.ts
@@ -1,5 +1,4 @@
import { SetWorkSheetName } from '../Apply';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { SheetActionBase, ISheetActionData } from '../../Command/SheetActionBase';
import { ActionObservers, ActionType } from '../../Command/ActionObservers';
import { CommandUnit } from '../../Command';
@@ -57,7 +56,7 @@ export class SetWorkSheetNameAction extends SheetActionBase<
const { sheetId } = this._doActionData;
this._oldActionData = {
sheetId,
- actionName: ACTION_NAMES.SET_WORKSHEET_NAME_ACTION,
+ actionName: SetWorkSheetNameAction.NAME,
sheetName: this.do(),
};
}
@@ -68,7 +67,7 @@ export class SetWorkSheetNameAction extends SheetActionBase<
// update current data
this._doActionData = {
- actionName: ACTION_NAMES.SET_WORKSHEET_NAME_ACTION,
+ actionName: SetWorkSheetNameAction.NAME,
sheetId,
sheetName: SetWorkSheetName(worksheet, sheetName),
};
diff --git a/packages/core/src/Sheets/Domain/Freeze.ts b/packages/core/src/Sheets/Domain/Freeze.ts
index b83d1ffc68..44b2cf9499 100644
--- a/packages/core/src/Sheets/Domain/Freeze.ts
+++ b/packages/core/src/Sheets/Domain/Freeze.ts
@@ -1,7 +1,7 @@
import { SheetContext } from '../../Basics';
import { Command, CommandManager } from '../../Command';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
import { Worksheet } from './Worksheet';
+import { ACTION_NAMES } from '../../Const';
export class Freeze {
private _commandManager: CommandManager;
diff --git a/packages/core/src/Sheets/Domain/Merges.ts b/packages/core/src/Sheets/Domain/Merges.ts
index d9b3e397fa..eea4909169 100644
--- a/packages/core/src/Sheets/Domain/Merges.ts
+++ b/packages/core/src/Sheets/Domain/Merges.ts
@@ -9,13 +9,15 @@ import {
SheetActionBase,
ISheetActionData,
} from '../../Command';
-import { InsertColumnAction, RemoveColumnAction } from '../Action';
+import {
+ InsertColumnAction,
+ RemoveColumnAction,
+ RemoveMergeAction,
+} from '../Action';
import { ACTION_NAMES } from '../../Const';
import { IRangeData } from '../../Interfaces';
import { Worksheet } from './Worksheet';
-import { Nullable, Tools } from '../../Shared';
-import { Rectangle } from '../../Shared/Rectangle';
-import { Tuples } from '../../Shared/Tuples';
+import { Nullable, Tools, Rectangle, Tuples } from '../../Shared';
/**
* Manage merged cells
@@ -555,7 +557,7 @@ export class Merges {
const context = this._worksheet.getContext();
const removeMerge: IRemoveMergeActionData = {
- actionName: ACTION_NAMES.REMOVE_MERGE_ACTION,
+ actionName: RemoveMergeAction.NAME,
sheetId: this._worksheet.getSheetId(),
rectangles: originMerge,
};
diff --git a/packages/core/src/Sheets/Domain/NamedRange.ts b/packages/core/src/Sheets/Domain/NamedRange.ts
index 724ae398e0..69d98a745e 100644
--- a/packages/core/src/Sheets/Domain/NamedRange.ts
+++ b/packages/core/src/Sheets/Domain/NamedRange.ts
@@ -5,11 +5,11 @@ import {
IAddNamedRangeActionData,
IDeleteNamedRangeActionData,
ISetNamedRangeActionData,
+ AddNamedRangeAction,
} from '../../Command';
import { ACTION_NAMES } from '../../Const';
import { Workbook } from './index';
-
-import { INamedRange } from '../../Interfaces/INamedRange';
+import { INamedRange } from '../../Interfaces';
/**
* Create, access and modify named ranges in a spreadsheet. Named ranges are ranges that have associated string aliases.
@@ -51,7 +51,7 @@ export class NamedRange {
// };
// Organize action data
const actionData: IAddNamedRangeActionData = {
- actionName: ACTION_NAMES.ADD_NAMED_RANGE_ACTION,
+ actionName: AddNamedRangeAction.NAME,
namedRange,
sheetId: namedRange.range.sheetId,
};
diff --git a/packages/core/src/Sheets/Domain/Range.ts b/packages/core/src/Sheets/Domain/Range.ts
index d0f5e0f5c3..6bc4a29fdc 100644
--- a/packages/core/src/Sheets/Domain/Range.ts
+++ b/packages/core/src/Sheets/Domain/Range.ts
@@ -1,21 +1,24 @@
// import { nanoid } from 'nanoid';
import { SheetContext } from '../../Basics';
+
import {
- Command,
- CommandManager,
- ISheetActionData,
- IAddMergeActionData,
- IClearRangeActionData,
- IDeleteRangeActionData,
IInsertRangeActionData,
+ IClearRangeActionData,
+ IAddMergeActionData,
IRemoveMergeActionData,
+ IDeleteRangeActionData,
+ CommandManager,
+ ISheetActionData,
ISetRangeDataActionData,
+ Command,
ISetRangeFormulaActionData,
ISetRangeStyleActionData,
ISetRangeFormattedValueActionData,
+ SetRangeStyleAction,
} from '../../Command';
-import { DEFAULT_RANGE, DEFAULT_STYLES } from '../../Const';
-import { ACTION_NAMES } from '../../Const/ACTION_NAMES';
+
+import { DEFAULT_RANGE, DEFAULT_STYLES, ACTION_NAMES } from '../../Const';
+
import {
AutoFillSeries,
BooleanNumber,
@@ -29,8 +32,9 @@ import {
TextDirection,
VerticalAlign,
WrapStrategy,
+ CopyPasteType,
} from '../../Enum';
-import { CopyPasteType } from '../../Enum/CopyPasteType';
+
import {
IBorderStyleData,
ICellData,
@@ -44,6 +48,7 @@ import {
IStyleData,
ITextDecoration,
} from '../../Interfaces';
+
import {
Nullable,
ObjectArrayPrimitiveType,
@@ -51,6 +56,7 @@ import {
Tools,
Tuples,
} from '../../Shared';
+
import { DropCell } from '../../Shared/DropCell';
import { Worksheet } from './Worksheet';
@@ -376,11 +382,8 @@ export class Range {
return this.getValues().map((row) =>
row.map((cell: Nullable<ICellData>) => {
const styles = this._context.getWorkBook().getStyles();
- const cellStyle = styles.getStyleByCell(cell)
- return (
- cellStyle?.cl?.rgb ||
- DEFAULT_STYLES.cl?.rgb
- );
+ const cellStyle = styles.getStyleByCell(cell);
+ return cellStyle?.cl?.rgb || DEFAULT_STYLES.cl?.rgb;
})
);
}
@@ -880,7 +883,7 @@ export class Range {
const setStyle: ISetRangeStyleActionData = {
sheetId: _worksheet.getSheetId(),
- actionName: ACTION_NAMES.SET_RANGE_STYLE_ACTION,
+ actionName: SetRangeStyleAction.NAME,
value: stylesMatrix,
rangeData: this._rangeData,
};
diff --git a/packages/sheets-plugin-alternating-colors/src/Command/Action/AddBandingAction.ts b/packages/sheets-plugin-alternating-colors/src/Command/Action/AddBandingAction.ts
index 6d5eec187b..20a109d96d 100644
--- a/packages/sheets-plugin-alternating-colors/src/Command/Action/AddBandingAction.ts
+++ b/packages/sheets-plugin-alternating-colors/src/Command/Action/AddBandingAction.ts
@@ -1,4 +1,4 @@
-import { SheetActionBase, ActionObservers, ISheetActionData, Workbook } from '@univer/core';
+import { SheetActionBase, ActionObservers, ISheetActionData, CommandUnit } from '@univer/core';
import { AlternatingColorsPlugin } from '../../AlternatingColorsPlugin';
import { AddBanding } from '../../Apply/AddBanding';
import { DeleteBanding } from '../../Apply/DeleteBanding';
@@ -12,8 +12,10 @@ export interface IAddBandingActionData extends ISheetActionData {
}
export class AddBandingAction extends SheetActionBase<IAddBandingActionData, IDeleteBandingActionData, void> {
- constructor(actionData: IAddBandingActionData, workbook: Workbook, observers: ActionObservers) {
- super(actionData, workbook, observers);
+ static Name = 'AddBandingAction';
+
+ constructor(actionData: IAddBandingActionData, commandUnit: CommandUnit, observers: ActionObservers) {
+ super(actionData, commandUnit, observers);
this._doActionData = {
...actionData,
@@ -31,10 +33,10 @@ export class AddBandingAction extends SheetActionBase<IAddBandingActionData, IDe
const worksheet = this.getWorkSheet();
const context = worksheet.getContext();
const manager = context.getPluginManager();
- const plugin = <AlternatingColorsPlugin>manager.getPluginByName(ALTERNATING_COLORS_PLUGIN_NAME);
+ const plugin = manager.getPluginByName(ALTERNATING_COLORS_PLUGIN_NAME) as AlternatingColorsPlugin;
const { bandedRange } = this._doActionData;
- this._observers.onActionDoObserver.notifyObservers(this);
+ // this._observers.onActionDoObserver.notifyObservers(this);
AddBanding(plugin, bandedRange);
}
@@ -48,8 +50,8 @@ export class AddBandingAction extends SheetActionBase<IAddBandingActionData, IDe
const worksheet = this.getWorkSheet();
const context = worksheet.getContext();
const manager = context.getPluginManager();
- const plugin = <AlternatingColorsPlugin>manager.getPluginByName(ALTERNATING_COLORS_PLUGIN_NAME);
- this._observers.onActionUndoObserver.notifyObservers(this);
+ const plugin = manager.getPluginByName(ALTERNATING_COLORS_PLUGIN_NAME) as AlternatingColorsPlugin;
+ // this._observers.onActionUndoObserver.notifyObservers(this);
// update current data
this._doActionData = {