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.

chore(core): 1. remove csstype 2. delete core module 3. fix protection dependencies

Dushusir351b40b20b96
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 75daeb498d..f2dcf8afe7 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -21,7 +21,6 @@
"compositionstart",
"compositionupdate",
"CRDT",
- "csstype",
"customd",
"Datas",
"esbuild",
diff --git a/docs/about-zh.md b/docs/about-zh.md
index 834833dc64..077ebf240d 100644
--- a/docs/about-zh.md
+++ b/docs/about-zh.md
@@ -16,5 +16,4 @@
- [reflect-metadata](https://github.com/rbuckton/reflect-metadata)
- [es6-proxy-polyfill](https://github.com/ambit-tsai/es6-proxy-polyfill)
- [react-colorful](https://github.com/omgovich/react-colorful)
-- [css-vars-ponyfill](https://github.com/jhildenbiddle/css-vars-ponyfill)
-- [csstype](https://github.com/frenic/csstype)
\ No newline at end of file
+- [css-vars-ponyfill](https://github.com/jhildenbiddle/css-vars-ponyfill)
\ No newline at end of file
diff --git a/examples/univer-preact-ts/package.json b/examples/univer-preact-ts/package.json
index 77a748aefc..f9efea256d 100644
--- a/examples/univer-preact-ts/package.json
+++ b/examples/univer-preact-ts/package.json
@@ -61,7 +61,6 @@
"@univer/sheets-plugin-filter": "^0.0.1",
"@univer/base-sheets": "^0.0.1",
"@univer/style-universheet": "^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/examples/univer-vanilla-ts/package.json b/examples/univer-vanilla-ts/package.json
index a775fa8bfe..22a1c0ea50 100644
--- a/examples/univer-vanilla-ts/package.json
+++ b/examples/univer-vanilla-ts/package.json
@@ -41,7 +41,6 @@
"@univer/base-component": "^0.0.1",
"@univer/core": "^0.0.1",
"@univer/style-universheet": "^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/base-component/package.json b/packages/base-component/package.json
index 12ccd15915..e0cdfb8d2e 100644
--- a/packages/base-component/package.json
+++ b/packages/base-component/package.json
@@ -53,7 +53,6 @@
"@univer/base-render": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"css-vars-ponyfill": "^2.4.6",
- "csstype": "^3.0.11",
"nanoid": "^4.0.0",
"preact": "^10.5.14",
"react-colorful": "^5.3.0"
diff --git a/packages/base-render/package.json b/packages/base-render/package.json
index bb514d4379..6269c4ed2d 100644
--- a/packages/base-render/package.json
+++ b/packages/base-render/package.json
@@ -45,7 +45,6 @@
"vite-plugin-external": "1.2.3"
},
"dependencies": {
- "@univer/core": "workspace:^0.0.1",
- "csstype": "^3.0.11"
+ "@univer/core": "workspace:^0.0.1"
}
}
diff --git a/packages/base-sheets/package.json b/packages/base-sheets/package.json
index 2c408b0c7b..0968150790 100644
--- a/packages/base-sheets/package.json
+++ b/packages/base-sheets/package.json
@@ -54,7 +54,6 @@
"@univer/sheets-plugin-formula": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
"css-vars-ponyfill": "^2.4.6",
- "csstype": "^3.0.11",
"nanoid": "4.0.0",
"preact": "^10.5.14"
}
diff --git a/packages/common-plugin-collaboration/package.json b/packages/common-plugin-collaboration/package.json
index 63d8aa215b..2c91df590c 100644
--- a/packages/common-plugin-collaboration/package.json
+++ b/packages/common-plugin-collaboration/package.json
@@ -33,7 +33,6 @@
"@univer/base-component": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/base-sheets": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"es6-proxy-polyfill": "^2.1.1",
"reflect-metadata": "^0.1.13"
},
diff --git a/packages/core/src/Command/RegisterAction.ts b/packages/core/src/Command/RegisterAction.ts
index 87d0f79e32..522b9ad338 100644
--- a/packages/core/src/Command/RegisterAction.ts
+++ b/packages/core/src/Command/RegisterAction.ts
@@ -1,26 +1,28 @@
import { ACTION_NAMES } from '../Const';
-import {
- AddNamedRangeAction,
- DeleteNamedRangeAction,
- SetNamedRangeAction,
-} from '../Module/NamedRange/Action';
import {
AddMergeAction,
+ AddNamedRangeAction,
ClearRangeAction,
+ DeleteNamedRangeAction,
DeleteRangeAction,
+ InsertColumnAction,
InsertColumnDataAction,
InsertRangeAction,
InsertRowAction,
InsertRowDataAction,
+ InsertSheetAction,
+ RemoveColumnAction,
RemoveColumnDataAction,
RemoveMergeAction,
RemoveRowAction,
RemoveRowDataAction,
+ RemoveSheetAction,
SetBorderAction,
SetColumnHideAction,
SetColumnShowAction,
SetColumnWidthAction,
SetHiddenGridlinesAction,
+ SetNamedRangeAction,
SetRangeDataAction,
SetRangeFormatAction,
SetRangeFormulaAction,
@@ -38,13 +40,9 @@ import {
SetWorkSheetHideAction,
SetWorkSheetNameAction,
SetWorkSheetStatusAction,
+ SetZoomRatioAction,
} from '../Sheets/Action';
-import { InsertColumnAction } from '../Sheets/Action/InsertColumnAction';
-import { InsertSheetAction } from '../Sheets/Action/InsertSheetAction';
-import { RemoveColumnAction } from '../Sheets/Action/removeColumnAction';
-import { RemoveSheetAction } from '../Sheets/Action/RemoveSheetAction';
import { CommandManager } from './CommandManager';
-import { SetZoomRatioAction } from '../Sheets/Action/SetZoomRatioAction';
/**
* All Commands are registered statically. For each new Command, a static registration method must be added here.
diff --git a/packages/core/src/Module/NamedRange/INamedRange.ts b/packages/core/src/Interfaces/INamedRange.ts
similarity index 76%
rename from packages/core/src/Module/NamedRange/INamedRange.ts
rename to packages/core/src/Interfaces/INamedRange.ts
index 9948c2566c..bf5f7bcc43 100644
--- a/packages/core/src/Module/NamedRange/INamedRange.ts
+++ b/packages/core/src/Interfaces/INamedRange.ts
@@ -1,5 +1,5 @@
-import { DEFAULT_SELECTION } from '../../Const';
-import { IGridRange } from '../../Interfaces';
+import { DEFAULT_SELECTION } from '../Const';
+import { IGridRange } from './index';
export interface INamedRange {
namedRangeId: string;
diff --git a/packages/core/src/Interfaces/IWorkbookData.ts b/packages/core/src/Interfaces/IWorkbookData.ts
index 040f89d829..c2ae7a100d 100644
--- a/packages/core/src/Interfaces/IWorkbookData.ts
+++ b/packages/core/src/Interfaces/IWorkbookData.ts
@@ -1,6 +1,6 @@
import { IKeyType, Nullable } from '../Shared/Types';
import { BooleanNumber, LocaleType } from '../Enum';
-import { INamedRange } from '../Module/NamedRange/INamedRange';
+import { INamedRange } from './INamedRange';
import { IStyleData } from './IStyleData';
import { IWorksheetConfig } from './IWorksheetData';
diff --git a/packages/core/src/Module/NamedRange/Action/index.ts b/packages/core/src/Module/NamedRange/Action/index.ts
deleted file mode 100644
index a9776b0b57..0000000000
--- a/packages/core/src/Module/NamedRange/Action/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-// @index('./*.ts', f => `export * from '${f.path}'`)
-export * from './AddNamedRangeAction';
-export * from './DeleteNamedRangeAction';
-export * from './SetNamedRangeAction';
-// @endindex
diff --git a/packages/core/src/Module/NamedRange/Service/index.ts b/packages/core/src/Module/NamedRange/Service/index.ts
deleted file mode 100644
index 80812baca1..0000000000
--- a/packages/core/src/Module/NamedRange/Service/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-// @index('./*.ts', f => `export * from '${f.path}'`)
-export * from './AddNamedRangeService';
-export * from './DeleteNamedRangeService';
-export * from './SetNamedRangeService';
-// @endindex
diff --git a/packages/core/src/Operation/IOperation.ts b/packages/core/src/Operation/IOperation.ts
deleted file mode 100644
index b5db129b2c..0000000000
--- a/packages/core/src/Operation/IOperation.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Operation
- */
-export interface IOperation {}
diff --git a/packages/core/src/Operation/IOperationSet.ts b/packages/core/src/Operation/IOperationSet.ts
deleted file mode 100644
index 7f67d100cc..0000000000
--- a/packages/core/src/Operation/IOperationSet.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Set of operation
- */
-export interface IOperationSet {}
diff --git a/packages/core/src/Operation/MemberManger.ts b/packages/core/src/Operation/MemberManger.ts
deleted file mode 100644
index 1c70f19724..0000000000
--- a/packages/core/src/Operation/MemberManger.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Member Manger
- */
-export class MemberManger {}
diff --git a/packages/core/src/Operation/OperationManager.ts b/packages/core/src/Operation/OperationManager.ts
deleted file mode 100644
index 89401dada7..0000000000
--- a/packages/core/src/Operation/OperationManager.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Operation Manager
- */
-export class OperationManager {}
diff --git a/packages/core/src/Operation/index.ts b/packages/core/src/Operation/index.ts
deleted file mode 100644
index ae3a396d64..0000000000
--- a/packages/core/src/Operation/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-// @index('./*.ts', f => `export * from '${f.path}'`)
-export * from './IOperation';
-export * from './IOperationSet';
-export * from './MemberManger';
-export * from './OperationManager';
-// @endindex
diff --git a/packages/core/src/ProxyData/IProxyData.ts b/packages/core/src/ProxyData/IProxyData.ts
deleted file mode 100644
index ac3f266f9a..0000000000
--- a/packages/core/src/ProxyData/IProxyData.ts
+++ /dev/null
@@ -1 +0,0 @@
-export interface IProxyData {}
diff --git a/packages/core/src/Module/NamedRange/Action/AddNamedRangeAction.ts b/packages/core/src/Sheets/Action/AddNamedRangeAction.ts
similarity index 74%
rename from packages/core/src/Module/NamedRange/Action/AddNamedRangeAction.ts
rename to packages/core/src/Sheets/Action/AddNamedRangeAction.ts
index 793976cf6e..dd744420a8 100644
--- a/packages/core/src/Module/NamedRange/Action/AddNamedRangeAction.ts
+++ b/packages/core/src/Sheets/Action/AddNamedRangeAction.ts
@@ -1,15 +1,10 @@
-import {
- ActionBase,
- ActionObservers,
- ActionType,
- IActionData,
-} from '../../../Command';
-import { ACTION_NAMES, CONVERTOR_OPERATION } from '../../../Const';
-import { WorkSheetConvertor } from '../../../Convertor';
-import { Workbook } from '../../../Sheets/Domain';
-import { INamedRange } from '../INamedRange';
-import { AddNamedRangeService } from '../Service/AddNamedRangeService';
-import { DeleteNamedRangeService } from '../Service/DeleteNamedRangeService';
+import { IActionData, ActionBase, ActionObservers, ActionType } from '../../Command';
+import { CONVERTOR_OPERATION, ACTION_NAMES } from '../../Const';
+import { WorkSheetConvertor } from '../../Convertor';
+import { INamedRange } from '../../Interfaces/INamedRange';
+import { AddNamedRange } from '../Apply/AddNamedRange';
+import { DeleteNamedRange } from '../Apply/DeleteNamedRange';
+import { Workbook } from '../Domain';
import { IDeleteNamedRangeActionData } from './DeleteNamedRangeAction';
export interface IAddNamedRangeActionData extends IActionData {
@@ -49,7 +44,7 @@ export class AddNamedRangeAction extends ActionBase<
data: this._doActionData,
action: this,
});
- AddNamedRangeService(namedRanges, namedRange);
+ AddNamedRange(namedRanges, namedRange);
}
redo(): void {
@@ -70,7 +65,7 @@ export class AddNamedRangeAction extends ActionBase<
this._doActionData = {
actionName: ACTION_NAMES.ADD_NAMED_RANGE_ACTION,
sheetId,
- namedRange: DeleteNamedRangeService(namedRanges, namedRangeId),
+ namedRange: DeleteNamedRange(namedRanges, namedRangeId),
};
}
diff --git a/packages/core/src/Module/NamedRange/Action/DeleteNamedRangeAction.ts b/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts
similarity index 75%
rename from packages/core/src/Module/NamedRange/Action/DeleteNamedRangeAction.ts
rename to packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts
index 7a9144336e..76215e37bf 100644
--- a/packages/core/src/Module/NamedRange/Action/DeleteNamedRangeAction.ts
+++ b/packages/core/src/Sheets/Action/DeleteNamedRangeAction.ts
@@ -1,15 +1,10 @@
-import {
- ActionBase,
- ActionObservers,
- ActionType,
- IActionData,
-} from '../../../Command';
-import { ACTION_NAMES, CONVERTOR_OPERATION } from '../../../Const';
-import { WorkSheetConvertor } from '../../../Convertor';
-import { Workbook } from '../../../Sheets/Domain';
-import { INamedRange } from '../INamedRange';
-import { AddNamedRangeService } from '../Service/AddNamedRangeService';
-import { DeleteNamedRangeService } from '../Service/DeleteNamedRangeService';
+import { IActionData, ActionBase, ActionObservers, ActionType } from '../../Command';
+import { CONVERTOR_OPERATION, ACTION_NAMES } from '../../Const';
+import { WorkSheetConvertor } from '../../Convertor';
+import { INamedRange } from '../../Interfaces/INamedRange';
+import { AddNamedRange } from '../Apply/AddNamedRange';
+import { DeleteNamedRange } from '../Apply/DeleteNamedRange';
+import { Workbook } from '../Domain';
import { IAddNamedRangeActionData } from './AddNamedRangeAction';
export interface IDeleteNamedRangeActionData extends IActionData {
@@ -48,7 +43,7 @@ export class DeleteNamedRangeAction extends ActionBase<
data: this._doActionData,
action: this,
});
- return DeleteNamedRangeService(namedRanges, namedRangeId);
+ return DeleteNamedRange(namedRanges, namedRangeId);
}
redo(): void {
@@ -71,7 +66,7 @@ export class DeleteNamedRangeAction extends ActionBase<
data: this._oldActionData,
action: this,
});
- AddNamedRangeService(namedRanges, namedRange);
+ AddNamedRange(namedRanges, namedRange);
}
validate(): boolean {
diff --git a/packages/core/src/Sheets/Action/SetFrozenColumnsAction.ts b/packages/core/src/Sheets/Action/SetFrozenColumnsAction.ts
deleted file mode 100644
index 3a05f55986..0000000000
--- a/packages/core/src/Sheets/Action/SetFrozenColumnsAction.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { SetFrozenColumns } from '../Apply';
-import { Workbook } from '../Domain/Workbook';
-import { ActionBase, IActionData } from '../../Command/ActionBase';
-import { ActionObservers, ActionType } from '../../Command/ActionObservers';
-
-/**
- * @internal
- */
-export interface ISetFrozenColumnsActionData extends IActionData {
- numColumns: number;
-}
-
-/**
- * @internal
- */
-export class SetFrozenColumnsAction extends ActionBase<ISetFrozenColumnsActionData> {
- constructor(
- actionData: ISetFrozenColumnsActionData,
- workbook: Workbook,
- observers: ActionObservers
- ) {
- super(actionData, workbook, observers);
- this._doActionData = {
- ...actionData,
- convertor: [],
- };
-
- this._oldActionData = {
- ...actionData,
- numColumns: this.do(),
- convertor: [],
- };
- this.validate();
- }
-
- do(): number {
- const worksheet = this.getWorkSheet();
-
- const result = SetFrozenColumns(worksheet, this._doActionData.numColumns);
-
- this._observers.notifyObservers({
- type: ActionType.REDO,
- data: this._doActionData,
- action: this,
- });
-
- return result;
- }
-
- redo(): void {
- this.do();
- }
-
- undo(): void {
- const { numColumns, sheetId } = this._oldActionData;
- const worksheet = this.getWorkSheet();
-
- SetFrozenColumns(worksheet, this._oldActionData.numColumns);
-
- this._observers.notifyObservers({
- type: ActionType.UNDO,
- data: this._oldActionData,
- action: this,
- });
- }
-
- validate(): boolean {
- return false;
- }
-}
diff --git a/packages/core/src/Sheets/Action/SetFrozenRowsAction.ts b/packages/core/src/Sheets/Action/SetFrozenRowsAction.ts
deleted file mode 100644
index d2fa41fd04..0000000000
--- a/packages/core/src/Sheets/Action/SetFrozenRowsAction.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { SetFrozenRows } from '../Apply';
-import { Workbook } from '../Domain/Workbook';
-import { ActionBase, IActionData } from '../../Command/ActionBase';
-import { ActionObservers, ActionType } from '../../Command/ActionObservers';
-
-/**
- * @internal
- */
-export interface ISetFrozenRowsActionData extends IActionData {
- numRows: number;
-}
-
-/**
- * @internal
- */
-export class SetFrozenRowsAction extends ActionBase<ISetFrozenRowsActionData> {
- constructor(
- actionData: ISetFrozenRowsActionData,
- workbook: Workbook,
- observers: ActionObservers
- ) {
- super(actionData, workbook, observers);
- this._doActionData = {
- ...actionData,
- convertor: [],
- };
-
- this._oldActionData = {
- ...actionData,
- numRows: this.do(),
- convertor: [],
- };
- this.validate();
- }
-
- do(): number {
- const worksheet = this.getWorkSheet();
-
- const result = SetFrozenRows(worksheet, this._doActionData.numRows);
-
- this._observers.notifyObservers({
- type: ActionType.REDO,
- data: this._doActionData,
- action: this,
- });
-
- return result;
- }
-
- redo(): void {
- this.do();
- }
-
- undo(): void {
- const { numRows, sheetId } = this._oldActionData;
- const worksheet = this.getWorkSheet();
-
- SetFrozenRows(worksheet, this._oldActionData.numRows);
-
- this._observers.notifyObservers({
- type: ActionType.UNDO,
- data: this._oldActionData,
- action: this,
- });
- }
-
- validate(): boolean {
- return false;
- }
-}
diff --git a/packages/core/src/Module/NamedRange/Action/SetNamedRangeAction.ts b/packages/core/src/Sheets/Action/SetNamedRangeAction.ts
similarity index 77%
rename from packages/core/src/Module/NamedRange/Action/SetNamedRangeAction.ts
rename to packages/core/src/Sheets/Action/SetNamedRangeAction.ts
index 7ed42110c0..51466c10b7 100644
--- a/packages/core/src/Module/NamedRange/Action/SetNamedRangeAction.ts
+++ b/packages/core/src/Sheets/Action/SetNamedRangeAction.ts
@@ -1,14 +1,9 @@
-import {
- ActionBase,
- ActionObservers,
- ActionType,
- IActionData,
-} from '../../../Command';
-import { ACTION_NAMES, CONVERTOR_OPERATION } from '../../../Const';
-import { WorkSheetConvertor } from '../../../Convertor';
-import { Workbook } from '../../../Sheets/Domain';
-import { INamedRange } from '../INamedRange';
-import { SetNamedRangeService } from '../Service/SetNamedRangeService';
+import { IActionData, ActionBase, ActionObservers, ActionType } from '../../Command';
+import { CONVERTOR_OPERATION, ACTION_NAMES } from '../../Const';
+import { WorkSheetConvertor } from '../../Convertor';
+import { INamedRange } from '../../Interfaces/INamedRange';
+import { SetNamedRange } from '../Apply/SetNamedRange';
+import { Workbook } from '../Domain';
export interface ISetNamedRangeActionData extends IActionData {
namedRange: INamedRange;
@@ -46,7 +41,7 @@ export class SetNamedRangeAction extends ActionBase<
data: this._doActionData,
action: this,
});
- return SetNamedRangeService(namedRanges, namedRange);
+ return SetNamedRange(namedRanges, namedRange);
}
redo(): void {
@@ -72,7 +67,7 @@ export class SetNamedRangeAction extends ActionBase<
this._doActionData = {
actionName: ACTION_NAMES.SET_NAMED_RANGE_ACTION,
sheetId,
- namedRange: SetNamedRangeService(namedRanges, namedRange),
+ namedRange: SetNamedRange(namedRanges, namedRange),
};
}
diff --git a/packages/core/src/Sheets/Action/index.ts b/packages/core/src/Sheets/Action/index.ts
index e41f035f9c..903142049e 100644
--- a/packages/core/src/Sheets/Action/index.ts
+++ b/packages/core/src/Sheets/Action/index.ts
@@ -1,6 +1,8 @@
// @index('./*.ts', f => `export * from '${f.path}'`)
export * from './AddMergeAction';
+export * from './AddNamedRangeAction';
export * from './ClearRangeAction';
+export * from './DeleteNamedRangeAction';
export * from './DeleteRangeAction';
export * from './InsertColumnAction';
export * from './InsertColumnDataAction';
@@ -19,6 +21,7 @@ export * from './SetColumnHideAction';
export * from './SetColumnShowAction';
export * from './SetColumnWidthAction';
export * from './SetHiddenGridlinesAction';
+export * from './SetNamedRangeAction';
export * from './SetRangeDataAction';
export * from './SetRangeFormatAction';
export * from './SetRangeFormulaAction';
@@ -36,4 +39,5 @@ export * from './SetWorkSheetActivateAction';
export * from './SetWorkSheetHideAction';
export * from './SetWorkSheetNameAction';
export * from './SetWorkSheetStatusAction';
+export * from './SetZoomRatioAction';
// @endindex
diff --git a/packages/core/src/Module/NamedRange/Service/AddNamedRangeService.ts b/packages/core/src/Sheets/Apply/AddNamedRange.ts
similarity index 54%
rename from packages/core/src/Module/NamedRange/Service/AddNamedRangeService.ts
rename to packages/core/src/Sheets/Apply/AddNamedRange.ts
index e1f3855e51..a6c394e790 100644
--- a/packages/core/src/Module/NamedRange/Service/AddNamedRangeService.ts
+++ b/packages/core/src/Sheets/Apply/AddNamedRange.ts
@@ -1,6 +1,6 @@
-import { INamedRange } from '../INamedRange';
+import { INamedRange } from '../../Interfaces/INamedRange';
-export function AddNamedRangeService(
+export function AddNamedRange(
namedRanges: INamedRange[],
namedRange: INamedRange
): void {
diff --git a/packages/core/src/Module/NamedRange/Service/DeleteNamedRangeService.ts b/packages/core/src/Sheets/Apply/DeleteNamedRange.ts
similarity index 73%
rename from packages/core/src/Module/NamedRange/Service/DeleteNamedRangeService.ts
rename to packages/core/src/Sheets/Apply/DeleteNamedRange.ts
index ba1c789061..61114ec56f 100644
--- a/packages/core/src/Module/NamedRange/Service/DeleteNamedRangeService.ts
+++ b/packages/core/src/Sheets/Apply/DeleteNamedRange.ts
@@ -1,6 +1,6 @@
-import { INamedRange } from '../INamedRange';
+import { INamedRange } from '../../Interfaces/INamedRange';
-export function DeleteNamedRangeService(
+export function DeleteNamedRange(
namedRanges: INamedRange[],
namedRangeId: string
): INamedRange {
@@ -10,5 +10,6 @@ export function DeleteNamedRangeService(
namedRanges.splice(i, 1);
return currentNamedRange;
}
+ return null;
})!;
}
diff --git a/packages/core/src/Module/NamedRange/Service/SetNamedRangeService.ts b/packages/core/src/Sheets/Apply/SetNamedRange.ts
similarity index 75%
rename from packages/core/src/Module/NamedRange/Service/SetNamedRangeService.ts
rename to packages/core/src/Sheets/Apply/SetNamedRange.ts
index 5f0028e0d2..fc0fd8a9b5 100644
--- a/packages/core/src/Module/NamedRange/Service/SetNamedRangeService.ts
+++ b/packages/core/src/Sheets/Apply/SetNamedRange.ts
@@ -1,6 +1,6 @@
-import { INamedRange } from '../INamedRange';
+import { INamedRange } from '../../Interfaces/INamedRange';
-export function SetNamedRangeService(
+export function SetNamedRange(
namedRanges: INamedRange[],
namedRange: INamedRange
): INamedRange {
@@ -10,5 +10,6 @@ export function SetNamedRangeService(
namedRanges[i] = namedRange;
return currentNamedRange;
}
+ return null;
})!;
}
diff --git a/packages/core/src/Sheets/Apply/index.ts b/packages/core/src/Sheets/Apply/index.ts
index fc233b678b..f9d655e01d 100644
--- a/packages/core/src/Sheets/Apply/index.ts
+++ b/packages/core/src/Sheets/Apply/index.ts
@@ -1,6 +1,8 @@
// @index('./*.ts', f => `export * from '${f.path}'`)
export * from './AddMerge';
+export * from './AddNamedRange';
export * from './ClearRange';
+export * from './DeleteNamedRange';
export * from './DeleteRange';
export * from './HideSheet';
export * from './InsertColumn';
@@ -21,6 +23,7 @@ export * from './SetColumnShow';
export * from './SetColumnWidth';
export * from './SetHiddenGridlines';
export * from './SetHideRows';
+export * from './SetNamedRange';
export * from './SetRangeData';
export * from './SetRangeFormat';
export * from './SetRangeFormula';
@@ -36,4 +39,5 @@ export * from './SetTabColor';
export * from './SetWorkSheetActivate';
export * from './SetWorkSheetName';
export * from './SetWorkSheetStatus';
+export * from './SetZoomRatio';
// @endindex
diff --git a/packages/core/src/Module/NamedRange/NamedRange.ts b/packages/core/src/Sheets/Domain/NamedRange.ts
similarity index 97%
rename from packages/core/src/Module/NamedRange/NamedRange.ts
rename to packages/core/src/Sheets/Domain/NamedRange.ts
index 6855b0433d..9d3165346f 100644
--- a/packages/core/src/Module/NamedRange/NamedRange.ts
+++ b/packages/core/src/Sheets/Domain/NamedRange.ts
@@ -1,13 +1,13 @@
import { Context } from '../../Basics';
import { Command, CommandManager } from '../../Command';
import { ACTION_NAMES } from '../../Const';
-import { Workbook, Worksheet } from '../../Sheets/Domain';
+import { Workbook, Worksheet } from './index';
import {
IAddNamedRangeActionData,
IDeleteNamedRangeActionData,
ISetNamedRangeActionData,
-} from './Action';
-import { INamedRange } from './INamedRange';
+} from '../../Module/NamedRange/Action';
+import { INamedRange } from '../../Interfaces/INamedRange';
/**
* Create, access and modify named ranges in a spreadsheet. Named ranges are ranges that have associated string aliases.
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 203970f992..ba0b913f1e 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -21,7 +21,6 @@ export * from './Enum';
export * from './Interfaces';
export * from './IOC';
export * from './Observer';
-export * from './Operation';
export * from './Plugin';
export * from './Server';
export * from './Shared';
diff --git a/packages/core/test/Module/NamedRange/Action/AddNamedRangeAction.test.ts b/packages/core/test/Module/NamedRange/Action/AddNamedRangeAction.test.ts
index 78bfa71f2f..4e590d965a 100644
--- a/packages/core/test/Module/NamedRange/Action/AddNamedRangeAction.test.ts
+++ b/packages/core/test/Module/NamedRange/Action/AddNamedRangeAction.test.ts
@@ -6,7 +6,7 @@ import { Context } from '../../../../src/Basics';
import { ActionObservers } from '../../../../src/Command';
import { Workbook, Worksheet } from '../../../../src/Sheets/Domain';
import { AddNamedRangeAction } from '../../../../src/Module/NamedRange/Action';
-import { INamedRange } from '../../../../src/Module/NamedRange/INamedRange';
+import { INamedRange } from '../../../../src/Interfaces/INamedRange';
import { IOCContainerStartUpReady } from '../../../ContainerStartUp';
jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
diff --git a/packages/core/test/Module/NamedRange/Action/DeleteNamedRangeAction.test.ts b/packages/core/test/Module/NamedRange/Action/DeleteNamedRangeAction.test.ts
index a58493be0a..c9902938b7 100644
--- a/packages/core/test/Module/NamedRange/Action/DeleteNamedRangeAction.test.ts
+++ b/packages/core/test/Module/NamedRange/Action/DeleteNamedRangeAction.test.ts
@@ -9,7 +9,7 @@ import {
AddNamedRangeAction,
DeleteNamedRangeAction,
} from '../../../../src/Module/NamedRange/Action';
-import { INamedRange } from '../../../../src/Module/NamedRange/INamedRange';
+import { INamedRange } from '../../../../src/Interfaces/INamedRange';
import { IOCContainerStartUpReady } from '../../../ContainerStartUp';
jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
diff --git a/packages/core/test/Module/NamedRange/Action/SetNamedRangeAction.test.ts b/packages/core/test/Module/NamedRange/Action/SetNamedRangeAction.test.ts
index d0c52db791..3e21198e4c 100644
--- a/packages/core/test/Module/NamedRange/Action/SetNamedRangeAction.test.ts
+++ b/packages/core/test/Module/NamedRange/Action/SetNamedRangeAction.test.ts
@@ -9,7 +9,7 @@ import {
AddNamedRangeAction,
SetNamedRangeAction,
} from '../../../../src/Module/NamedRange/Action';
-import { INamedRange } from '../../../../src/Module/NamedRange/INamedRange';
+import { INamedRange } from '../../../../src/Interfaces/INamedRange';
import { IOCContainerStartUpReady } from '../../../ContainerStartUp';
jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
diff --git a/packages/core/test/Module/NamedRange/NamedRange.test.ts b/packages/core/test/Module/NamedRange/NamedRange.test.ts
index e41aa73601..0b6b61dada 100644
--- a/packages/core/test/Module/NamedRange/NamedRange.test.ts
+++ b/packages/core/test/Module/NamedRange/NamedRange.test.ts
@@ -5,8 +5,8 @@ import { Context, Workbook, Worksheet } from '../../../src';
import {
DEFAULT_NAMED_RANGE,
INamedRange,
-} from '../../../src/Module/NamedRange/INamedRange';
-import { NamedRange } from '../../../src/Module/NamedRange/NamedRange';
+} from '../../../src/Interfaces/INamedRange';
+import { NamedRange } from '../../../src/Sheets/Domain/NamedRange';
import { IOCContainerStartUpReady } from '../../ContainerStartUp';
jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
diff --git a/packages/sheets-plugin-alternating-colors/package.json b/packages/sheets-plugin-alternating-colors/package.json
index e22be49279..e949bd7fbe 100644
--- a/packages/sheets-plugin-alternating-colors/package.json
+++ b/packages/sheets-plugin-alternating-colors/package.json
@@ -47,12 +47,11 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
"@univer/sheets-plugin-protection": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-clipboard/package.json b/packages/sheets-plugin-clipboard/package.json
index 25ae0a69ac..d7d8209691 100644
--- a/packages/sheets-plugin-clipboard/package.json
+++ b/packages/sheets-plugin-clipboard/package.json
@@ -41,11 +41,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-conditional-format": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"nanoid": "^4.0.0",
"preact": "^10.5.14"
}
diff --git a/packages/sheets-plugin-comment/package.json b/packages/sheets-plugin-comment/package.json
index eb016ab7ad..df756c468c 100644
--- a/packages/sheets-plugin-comment/package.json
+++ b/packages/sheets-plugin-comment/package.json
@@ -46,11 +46,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-conditional-format/package.json b/packages/sheets-plugin-conditional-format/package.json
index 10ca4c1cce..fe4b7ad619 100644
--- a/packages/sheets-plugin-conditional-format/package.json
+++ b/packages/sheets-plugin-conditional-format/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-data-validation/package.json b/packages/sheets-plugin-data-validation/package.json
index 9237b6275a..2e6a7d66d6 100644
--- a/packages/sheets-plugin-data-validation/package.json
+++ b/packages/sheets-plugin-data-validation/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-filter/package.json b/packages/sheets-plugin-filter/package.json
index 8e8b2e2c2b..1e8f1fd077 100644
--- a/packages/sheets-plugin-filter/package.json
+++ b/packages/sheets-plugin-filter/package.json
@@ -41,11 +41,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-conditional-format": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"nanoid": "^4.0.0",
"preact": "^10.5.14"
}
diff --git a/packages/sheets-plugin-find/package.json b/packages/sheets-plugin-find/package.json
index 1a3370238e..3d96c6905f 100644
--- a/packages/sheets-plugin-find/package.json
+++ b/packages/sheets-plugin-find/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-format/package.json b/packages/sheets-plugin-format/package.json
index 1bf19ac689..9d3d590400 100644
--- a/packages/sheets-plugin-format/package.json
+++ b/packages/sheets-plugin-format/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14",
"ssf": "0.11.2"
}
diff --git a/packages/sheets-plugin-formula/package.json b/packages/sheets-plugin-formula/package.json
index 6535a58576..dc64263b8b 100644
--- a/packages/sheets-plugin-formula/package.json
+++ b/packages/sheets-plugin-formula/package.json
@@ -47,13 +47,12 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
- "@univer/core": "workspace:^0.0.1",
- "@univer/sheets-plugin-filter": "workspace:^0.0.1",
"@univer/base-formula-engine": "workspace:^0.0.1",
"@univer/base-sheets": "workspace:^0.0.1",
+ "@univer/core": "workspace:^0.0.1",
+ "@univer/sheets-plugin-filter": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
"css-vars-ponyfill": "^2.4.6",
- "csstype": "^3.0.11",
"preact": "^10.5.14",
"react-colorful": "^5.3.0"
}
diff --git a/packages/sheets-plugin-freeze/package.json b/packages/sheets-plugin-freeze/package.json
index 93672234b3..2aaa6f3a0f 100644
--- a/packages/sheets-plugin-freeze/package.json
+++ b/packages/sheets-plugin-freeze/package.json
@@ -46,11 +46,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-image/package.json b/packages/sheets-plugin-image/package.json
index d67f9ae218..4b30567943 100644
--- a/packages/sheets-plugin-image/package.json
+++ b/packages/sheets-plugin-image/package.json
@@ -48,11 +48,10 @@
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
"@univer/base-render": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-link/package.json b/packages/sheets-plugin-link/package.json
index 23cf85fc38..357c77f8ea 100644
--- a/packages/sheets-plugin-link/package.json
+++ b/packages/sheets-plugin-link/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-pivot-table/package.json b/packages/sheets-plugin-pivot-table/package.json
index 8995793157..ba70304bad 100644
--- a/packages/sheets-plugin-pivot-table/package.json
+++ b/packages/sheets-plugin-pivot-table/package.json
@@ -46,11 +46,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-print/package.json b/packages/sheets-plugin-print/package.json
index a8c6ef5414..88b5193ead 100644
--- a/packages/sheets-plugin-print/package.json
+++ b/packages/sheets-plugin-print/package.json
@@ -46,11 +46,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-protection/package.json b/packages/sheets-plugin-protection/package.json
index 6e376e7cf4..16106e665b 100644
--- a/packages/sheets-plugin-protection/package.json
+++ b/packages/sheets-plugin-protection/package.json
@@ -46,11 +46,11 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-render": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-protection/src/Action/AddAllowedAction.ts b/packages/sheets-plugin-protection/src/Action/AddAllowedAction.ts
index 077f53aded..6c18ea13a1 100644
--- a/packages/sheets-plugin-protection/src/Action/AddAllowedAction.ts
+++ b/packages/sheets-plugin-protection/src/Action/AddAllowedAction.ts
@@ -1,6 +1,7 @@
-import { ActionBase, ActionObservers, ACTION_NAMES, CONVERTOR_OPERATION, IActionData, Workbook, WorkSheetConvertor } from '@univer/core';
+import { ActionBase, ActionObservers, CONVERTOR_OPERATION, IActionData, Workbook, WorkSheetConvertor } from '@univer/core';
import { Allowed } from '../Controller';
import { AddAllowed, RemoveAllowed } from '../Apply';
+import { ACTION_NAMES } from '../Basic/Enum/ACTION_NAMES';
export interface IAddAllowedActionData extends IActionData {
allowed: Allowed;
@@ -14,7 +15,7 @@ export class AddAllowedAction extends ActionBase<IAddAllowedActionData, IAddAllo
convertor: [new WorkSheetConvertor(CONVERTOR_OPERATION.SET)],
};
this._oldActionData = {
- actionName: ACTION_NAMES.SET_FROZEN_COLUMNS_ACTION,
+ actionName: ACTION_NAMES.ADD_ALLOWED_ACTION,
sheetId: actionData.sheetId,
allowed: actionData.allowed,
convertor: [new WorkSheetConvertor(CONVERTOR_OPERATION.SET)],
diff --git a/packages/sheets-plugin-protection/src/Action/AddUnlockAction.ts b/packages/sheets-plugin-protection/src/Action/AddUnlockAction.ts
index 380f39c997..7eb9f5ea96 100644
--- a/packages/sheets-plugin-protection/src/Action/AddUnlockAction.ts
+++ b/packages/sheets-plugin-protection/src/Action/AddUnlockAction.ts
@@ -1,5 +1,6 @@
-import { ActionBase, ActionObservers, ACTION_NAMES, CONVERTOR_OPERATION, IActionData, Range, Workbook, WorkSheetConvertor } from '@univer/core';
+import { ActionBase, ActionObservers, CONVERTOR_OPERATION, IActionData, Range, Workbook, WorkSheetConvertor } from '@univer/core';
import { AddUnlock, RemoveUnlock } from '../Apply';
+import { ACTION_NAMES } from '../Basic/Enum/ACTION_NAMES';
export interface IAddUnlockActionData extends IActionData {
unlock: Range;
@@ -13,7 +14,7 @@ export class AddUnlockAction extends ActionBase<IAddUnlockActionData, IAddUnlock
convertor: [new WorkSheetConvertor(CONVERTOR_OPERATION.SET)],
};
this._oldActionData = {
- actionName: ACTION_NAMES.SET_FROZEN_COLUMNS_ACTION,
+ actionName: ACTION_NAMES.ADD_UNLOCK_ACTION,
sheetId: actionData.sheetId,
unlock: actionData.unlock,
convertor: [new WorkSheetConvertor(CONVERTOR_OPERATION.SET)],
diff --git a/packages/sheets-plugin-protection/src/Action/RegisterAction.ts b/packages/sheets-plugin-protection/src/Action/RegisterAction.ts
new file mode 100644
index 0000000000..16748a62db
--- /dev/null
+++ b/packages/sheets-plugin-protection/src/Action/RegisterAction.ts
@@ -0,0 +1,9 @@
+import { CommandManager } from '@univer/core';
+import { ACTION_NAMES } from '../Basic/Enum/ACTION_NAMES';
+import { AddAllowedAction } from './AddAllowedAction';
+import { AddUnlockAction } from './AddUnlockAction';
+import { SetProtectionAction } from './SetProtectionAction';
+
+CommandManager.register(ACTION_NAMES.ADD_ALLOWED_ACTION, AddAllowedAction);
+CommandManager.register(ACTION_NAMES.ADD_UNLOCK_ACTION, AddUnlockAction);
+CommandManager.register(ACTION_NAMES.SET_PROTECTION_ACTION, SetProtectionAction);
diff --git a/packages/sheets-plugin-protection/src/Action/SetProtectionAction.ts b/packages/sheets-plugin-protection/src/Action/SetProtectionAction.ts
index 9511e1fa35..21ec454036 100644
--- a/packages/sheets-plugin-protection/src/Action/SetProtectionAction.ts
+++ b/packages/sheets-plugin-protection/src/Action/SetProtectionAction.ts
@@ -1,5 +1,6 @@
-import { ActionBase, ActionObservers, ACTION_NAMES, CONVERTOR_OPERATION, IActionData, Workbook, WorkSheetConvertor } from '@univer/core';
+import { ActionBase, ActionObservers, CONVERTOR_OPERATION, IActionData, Workbook, WorkSheetConvertor } from '@univer/core';
import { SetProtection } from '../Apply';
+import { ACTION_NAMES } from '../Basic/Enum/ACTION_NAMES';
export interface ISetProtectionActionData extends IActionData {
enable: boolean;
@@ -16,7 +17,7 @@ export class SetProtectionAction extends ActionBase<ISetProtectionActionData, IS
convertor: [new WorkSheetConvertor(CONVERTOR_OPERATION.SET)],
};
this._oldActionData = {
- actionName: ACTION_NAMES.SET_FROZEN_COLUMNS_ACTION,
+ actionName: ACTION_NAMES.SET_PROTECTION_ACTION,
sheetId: actionData.sheetId,
enable: actionData.enable,
password: actionData.password,
diff --git a/packages/sheets-plugin-protection/src/Basic/Const/PLUGIN_NAME.ts b/packages/sheets-plugin-protection/src/Basic/Const/PLUGIN_NAME.ts
index eb632b9ba6..477331fd61 100644
--- a/packages/sheets-plugin-protection/src/Basic/Const/PLUGIN_NAME.ts
+++ b/packages/sheets-plugin-protection/src/Basic/Const/PLUGIN_NAME.ts
@@ -1 +1 @@
-export const PTOTECTION_PLUGIN_NAME = 'protection';
+export const PROTECTION_PLUGIN_NAME = 'protection';
diff --git a/packages/sheets-plugin-protection/src/Basic/Enum/ACTION_NAMES.ts b/packages/sheets-plugin-protection/src/Basic/Enum/ACTION_NAMES.ts
new file mode 100644
index 0000000000..3c79529df7
--- /dev/null
+++ b/packages/sheets-plugin-protection/src/Basic/Enum/ACTION_NAMES.ts
@@ -0,0 +1,7 @@
+export enum ACTION_NAMES {
+ ADD_ALLOWED_ACTION = 'AddAllowedAction',
+ ADD_UNLOCK_ACTION = 'AddUnlockAction',
+ SET_PROTECTION_ACTION = 'SetProtectionAction',
+}
+
+export type ACTION_NAMES_TYPE = `${ACTION_NAMES}`;
diff --git a/packages/sheets-plugin-protection/src/ProtectionPlugin.tsx b/packages/sheets-plugin-protection/src/ProtectionPlugin.tsx
index 8cbc9062b5..b132e2fadf 100644
--- a/packages/sheets-plugin-protection/src/ProtectionPlugin.tsx
+++ b/packages/sheets-plugin-protection/src/ProtectionPlugin.tsx
@@ -1,12 +1,12 @@
import { ISlotElement, ISlotProps, IToolBarItemProps } from '@univer/base-component';
import { Context, IOCContainer, UniverSheet, Plugin, PLUGIN_NAMES } from '@univer/core';
import { SpreadsheetPlugin } from '@univer/base-sheets';
-import { PTOTECTION_PLUGIN_NAME } from './Basic/Const/PLUGIN_NAME';
-import { Protection } from './Controller/Protection';
+import { PROTECTION_PLUGIN_NAME } from './Basic/Const/PLUGIN_NAME';
import { IConfig } from './IData/IProtection';
import { en, zh } from './Locale';
import { ProtectionButton } from './UI/ProtectionButton';
import { ProtectionSide } from './UI/ProtectionSide';
+import { Protection } from './Controller';
type IPluginConfig = {};
@@ -14,7 +14,7 @@ export class ProtectionPlugin extends Plugin {
_protectionSilder: Protection;
constructor(config?: IPluginConfig) {
- super(PTOTECTION_PLUGIN_NAME);
+ super(PROTECTION_PLUGIN_NAME);
}
static create(config?: IPluginConfig) {
@@ -40,7 +40,7 @@ export class ProtectionPlugin extends Plugin {
};
const item: IToolBarItemProps = {
- locale: PTOTECTION_PLUGIN_NAME,
+ locale: PROTECTION_PLUGIN_NAME,
type: ISlotElement.JSX,
show: true,
label: <ProtectionButton config={config} />,
diff --git a/packages/sheets-plugin-protection/src/UI/ProtectionButton.tsx b/packages/sheets-plugin-protection/src/UI/ProtectionButton.tsx
index 7a119811cd..d38777ec9f 100644
--- a/packages/sheets-plugin-protection/src/UI/ProtectionButton.tsx
+++ b/packages/sheets-plugin-protection/src/UI/ProtectionButton.tsx
@@ -2,7 +2,7 @@ import { BaseComponentSheet, BaseIconProps, BaseSingleButtonProps, Component, Fu
import { PLUGIN_NAMES, Nullable, Observer, Workbook } from '@univer/core';
import { SpreadsheetPlugin } from '@univer/base-sheets';
-import { PTOTECTION_PLUGIN_NAME } from '../Basic/Const';
+import { PROTECTION_PLUGIN_NAME } from '../Basic/Const';
import { IProps } from '../IData/IProtection';
// Types for state
@@ -31,7 +31,7 @@ export class ProtectionButton extends Component<IProps, IState> {
label: <this.LockIcon />,
show: true,
onClick: () => {
- this._context.getPluginManager().getPluginByName<SpreadsheetPlugin>(PLUGIN_NAMES.SPREADSHEET)?.showSiderByName(PTOTECTION_PLUGIN_NAME, true);
+ this._context.getPluginManager().getPluginByName<SpreadsheetPlugin>(PLUGIN_NAMES.SPREADSHEET)?.showSiderByName(PROTECTION_PLUGIN_NAME, true);
},
};
this.state = {
diff --git a/packages/sheets-plugin-protection/src/UI/ProtectionSide/ProtectionSide.tsx b/packages/sheets-plugin-protection/src/UI/ProtectionSide/ProtectionSide.tsx
index 8d39c0f8df..dfcd67aa28 100644
--- a/packages/sheets-plugin-protection/src/UI/ProtectionSide/ProtectionSide.tsx
+++ b/packages/sheets-plugin-protection/src/UI/ProtectionSide/ProtectionSide.tsx
@@ -1,7 +1,8 @@
import { BaseComponentSheet, BaseSiderModalProps, Component, createRef, FunctionComponent } from '@univer/base-component';
import { Context, IRangeData, Nullable, Observer, Workbook } from '@univer/core';
-import { PTOTECTION_PLUGIN_NAME } from '../../Basic/Const';
-import { Protection } from '../../Controller';
+import { PROTECTION_PLUGIN_NAME } from '../../Basic/Const';
+import { Protection } from '../../Controller/Protection';
+
import styles from './index.module.less';
type IConfig = {
@@ -89,10 +90,10 @@ class ProtectionSide extends Component<IProps, IState> {
<this.SiderModal
title={this.state.locale.protectionLabel}
closeSide={() => {
- // this.context.coreContext.getPluginManager().getPluginByName<StyleUniverSheet>('styleUniverSheet')?.showSiderByName(PTOTECTION_PLUGIN_NAME, false);
+ // this.context.coreContext.getPluginManager().getPluginByName<StyleUniverSheet>('styleUniverSheet')?.showSiderByName(PROTECTION_PLUGIN_NAME, false);
}}
footer={this.footer()}
- pluginName={PTOTECTION_PLUGIN_NAME}
+ pluginName={PROTECTION_PLUGIN_NAME}
className={styles.protectionSide}
style={{ ...style }}
>
diff --git a/packages/sheets-plugin-protection/src/main.tsx b/packages/sheets-plugin-protection/src/main.tsx
index d1a700a90e..8c3deab04d 100644
--- a/packages/sheets-plugin-protection/src/main.tsx
+++ b/packages/sheets-plugin-protection/src/main.tsx
@@ -1,67 +1,22 @@
-import { UniverSheet } from '@univer/core';
-import { StyleUniverSheet } from '@univer/style-universheet';
+import { defaultWorkbookData, UniverSheet } from '@univer/core';
+import { RenderEngine } from '@univer/base-render';
+import { SpreadsheetPlugin } from '@univer/base-sheets';
+import { UniverComponentSheet } from '@univer/style-universheet';
+
import { FilterPlugin } from '@univer/sheets-plugin-filter';
import { ProtectionPlugin } from './ProtectionPlugin';
-const defaultWorkbookData = {
- locale: 'zh',
- creator: '',
- name: '',
- skin: 'default',
- timeZone: '',
- createdTime: '',
- modifiedTime: '',
- appVersion: '',
- lastModifiedBy: '',
- sheets: [],
-};
-const defaultWorkbookDataDown = {
- locale: 'en',
- creator: '',
- name: '',
- skin: 'dark',
- timeZone: '',
- createdTime: '',
- modifiedTime: '',
- appVersion: '',
- lastModifiedBy: '',
- sheets: [],
-};
const uiDefaultConfigUp = {
- containerId: 'universheet-demo-up',
+ containerId: 'universheet-demo',
layout: 'auto',
};
-const uiDefaultConfigDown = {
- containerId: 'universheet-demo-down',
- layout: {
- outerLeft: false,
-
- outerRight: true,
-
- innerLeft: false,
-
- innerRight: false,
-
- toolBar: true,
-
- toolBarConfig: {
- undoRedo: true,
- font: true,
- },
- contentSplit: true,
- },
-};
const univerSheetUp = UniverSheet.newInstance(defaultWorkbookData);
-univerSheetUp.installPlugin(new StyleUniverSheet(uiDefaultConfigUp));
+univerSheetUp.installPlugin(new RenderEngine());
+univerSheetUp.installPlugin(new UniverComponentSheet());
+
+univerSheetUp.installPlugin(new SpreadsheetPlugin(uiDefaultConfigUp));
univerSheetUp.installPlugin(new FilterPlugin());
univerSheetUp.installPlugin(new ProtectionPlugin());
-
-// const univerSheetDown = UniverSheet.newInstance(defaultWorkbookData);
-
-// univerSheetDown.installPlugin(new StyleUniverSheet(uiDefaultConfigDown));
-
-// univerSheetDown.installPlugin(new FilterPlugin());
-// univerSheetDown.installPlugin(new ProtectionPlugin());
diff --git a/packages/sheets-plugin-screenshot/package.json b/packages/sheets-plugin-screenshot/package.json
index 0e03c4017a..62acd84285 100644
--- a/packages/sheets-plugin-screenshot/package.json
+++ b/packages/sheets-plugin-screenshot/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-sort/package.json b/packages/sheets-plugin-sort/package.json
index 3e773b5591..319c44867e 100644
--- a/packages/sheets-plugin-sort/package.json
+++ b/packages/sheets-plugin-sort/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/sheets-plugin-split-column/package.json b/packages/sheets-plugin-split-column/package.json
index 417228f7b0..c2fa7b8534 100644
--- a/packages/sheets-plugin-split-column/package.json
+++ b/packages/sheets-plugin-split-column/package.json
@@ -47,11 +47,10 @@
},
"dependencies": {
"@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-sheets": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"@univer/sheets-plugin-filter": "workspace:^0.0.1",
- "@univer/base-sheets": "workspace:^0.0.1",
"@univer/style-universheet": "workspace:^0.0.1",
- "csstype": "^3.0.11",
"preact": "^10.5.14"
}
}
diff --git a/packages/style-universheet/package.json b/packages/style-universheet/package.json
index 391378ea39..07b8c5b3a7 100644
--- a/packages/style-universheet/package.json
+++ b/packages/style-universheet/package.json
@@ -50,7 +50,6 @@
"@univer/base-component": "workspace:^0.0.1",
"@univer/core": "workspace:^0.0.1",
"css-vars-ponyfill": "^2.4.6",
- "csstype": "^3.0.11",
"nanoid": "^4.0.0",
"preact": "^10.5.14",
"react-colorful": "^5.3.0"