Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
chore(operation): clipboard merged into operation
Dushusir4d13470ad046
diff --git a/examples/univer-preact-ts/package.json b/examples/univer-preact-ts/package.jsonindex 235289498a..d018820be8 100644--- a/examples/univer-preact-ts/package.json+++ b/examples/univer-preact-ts/package.json@@ -43,7 +43,7 @@"@univerjs/common-plugin-collaboration": "workspace:^0.0.1","@univerjs/common-plugin-data": "workspace:^0.0.1","@univerjs/core": "workspace:^0.0.1",- "@univerjs/sheets-plugin-clipboard": "workspace:^0.0.1",+ "@univerjs/sheets-plugin-operation": "workspace:^0.0.1","@univerjs/sheets-plugin-formula": "workspace:^0.0.1","@univerjs/sheets-plugin-import-xlsx": "workspace:^0.0.1","@univerjs/sheets-plugin-numfmt": "workspace:^0.0.1",diff --git a/examples/univer-preact-ts/src/index.ts b/examples/univer-preact-ts/src/index.tsindex 175972a1aa..7c228f8753 100644--- a/examples/univer-preact-ts/src/index.ts+++ b/examples/univer-preact-ts/src/index.ts@@ -10,10 +10,10 @@ import { ISlidePluginConfig, SlidePlugin } from '@univerjs/base-slides';// import { CollaborationPlugin, ICollaborationPluginConfig } from '@univerjs/common-plugin-collaboration';import { IFormulaConfig } from '@univerjs/sheets-plugin-formula';import { CollaborationPlugin, ICollaborationPluginConfig } from '@univerjs/common-plugin-collaboration';-import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';+import { OperationPlugin } from '@univerjs/sheets-plugin-operation';import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';// import { INumfmtPluginConfig, NumfmtPlugin } from '@univerjs/sheets-plugin-numfmt';-// import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';+// import { OperationPlugin } from '@univerjs/sheets-plugin-operation';// import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';interface ISheetPropsCustom {@@ -48,7 +48,7 @@ class UniverSheetCustom {// universheet.installPlugin(new NumfmtPlugin(config.numfmtConfig));// FormulaPlugin.create(config.formulaConfig).installTo(universheet);- universheet.installPlugin(new ClipboardPlugin());+ universheet.installPlugin(new OperationPlugin());universheet.installPlugin(new ImportXlsxPlugin());return universheet;@@ -154,5 +154,5 @@ export * as CommonPluginData from '@univerjs/common-plugin-data';// export * as CommonPluginCollaboration from '@univerjs/common-plugin-collaboration';// export * as SheetsPluginFormula from '@univerjs/sheets-plugin-formula';// export * as SheetsPluginNumfmt from '@univerjs/sheets-plugin-numfmt';-// export * as SheetsPluginClipboard from '@univerjs/sheets-plugin-clipboard';+// export * as SheetsPluginClipboard from '@univerjs/sheets-plugin-operation';// export * as SheetsPluginImportXlsx from '@univerjs/sheets-plugin-import-xlsx';diff --git a/examples/univer-sheet-ts/package.json b/examples/univer-sheet-ts/package.jsonindex 273ebeaafa..19edc4dd58 100644--- a/examples/univer-sheet-ts/package.json+++ b/examples/univer-sheet-ts/package.json@@ -46,7 +46,7 @@"@univerjs/base-ui": "workspace:^0.0.1","@univerjs/common-plugin-data": "workspace:^0.0.1","@univerjs/core": "workspace:^0.0.1",- "@univerjs/sheets-plugin-clipboard": "workspace:^0.0.1",+ "@univerjs/sheets-plugin-operation": "workspace:^0.0.1","@univerjs/sheets-plugin-formula": "workspace:^0.0.1","@univerjs/sheets-plugin-import-xlsx": "workspace:^0.0.1","@univerjs/sheets-plugin-numfmt": "workspace:^0.0.1",diff --git a/examples/univer-sheet-ts/src/main.tsx b/examples/univer-sheet-ts/src/main.tsxindex e9c7fdbd16..bad0ee124f 100644--- a/examples/univer-sheet-ts/src/main.tsx+++ b/examples/univer-sheet-ts/src/main.tsx@@ -3,7 +3,7 @@ import { RenderEngine } from '@univerjs/base-render';import { SheetPlugin } from '@univerjs/base-sheets';import { SheetUIPlugin } from '@univerjs/ui-plugin-sheets';import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/common-plugin-data';-import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';+import { OperationPlugin } from '@univerjs/sheets-plugin-operation';import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';const uiDefaultConfigDemo = {@@ -64,5 +64,5 @@ univer.install(// FormulaPlugin.create(DEFAULT_FORMULA_DATA_DEMO).installTo(universheet);// FindPlugin.create().installTo(universheet);-universheet.installPlugin(new ClipboardPlugin());+universheet.installPlugin(new OperationPlugin());universheet.installPlugin(new ImportXlsxPlugin());diff --git a/examples/univer-vanilla-ts/package.json b/examples/univer-vanilla-ts/package.jsonindex 8ce316061d..0c2606c447 100644--- a/examples/univer-vanilla-ts/package.json+++ b/examples/univer-vanilla-ts/package.json@@ -43,7 +43,7 @@"@univerjs/base-ui": "workspace:^0.0.1","@univerjs/common-plugin-data": "workspace:^0.0.1","@univerjs/core": "workspace:^0.0.1",- "@univerjs/sheets-plugin-clipboard": "workspace:^0.0.1",+ "@univerjs/sheets-plugin-operation": "workspace:^0.0.1","@univerjs/sheets-plugin-formula": "workspace:^0.0.1","@univerjs/sheets-plugin-import-xlsx": "workspace:^0.0.1","@univerjs/sheets-plugin-numfmt": "workspace:^0.0.1",diff --git a/packages/base-sheets/src/Controller/Selection/SelectionManager.ts b/packages/base-sheets/src/Controller/Selection/SelectionManager.tsindex 76f3eec1ee..d27464d1fd 100644--- a/packages/base-sheets/src/Controller/Selection/SelectionManager.ts+++ b/packages/base-sheets/src/Controller/Selection/SelectionManager.ts@@ -236,7 +236,7 @@ export class SelectionManager {* @param curCellRange* @returns*/- addControlToCurrentByRangeData(selectionRange: IRangeData, curCellRange: Nullable<IRangeCellData>, command: boolean = true) {+ addControlToCurrentByRangeData(selectionRange: IRangeData, curCellRange: Nullable<IRangeCellData>) {const currentControls = this.getCurrentControls();if (!currentControls) {return;@@ -271,12 +271,7 @@ export class SelectionManager {currentControls.push(control);- if (command) {- this.setSelectionModel();- } else {- const models = this._selectionControls.map((control) => control.model.getValue());- return models;- }+ this.setSelectionModel();}clearSelectionControls() {diff --git a/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionFactory.ts b/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionFactory.tsindex 919581600c..c1b6992009 100644--- a/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionFactory.ts+++ b/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionFactory.ts@@ -1,4 +1,4 @@-import { IActionData, Nullable, Plugin } from '@univerjs/core';+import { Plugin } from '@univerjs/core';import { IClipboardData } from '../../Interfaces/IClipboardData';/**@@ -11,7 +11,7 @@ export class BaseClipboardExtension<T extends Plugin = Plugin> {/*** Execute the core logic after the check is successful*/- execute(): Nullable<IActionData> {}+ execute() {}}/**diff --git a/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionManager.ts b/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionManager.tsindex e7a8171910..6ee58fbf96 100644--- a/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionManager.ts+++ b/packages/base-ui/src/Basics/Register/Clipboard/ClipboardExtensionManager.ts@@ -67,25 +67,16 @@ export class ClipboardExtensionManager {*/private _checkExtension(data: IClipboardData) {if (!this._clipboardExtensionFactoryList) return false;-- // TODO how to use range- const range = this._plugin.getUniver().getCurrentUniverSheetInstance().getWorkBook().getActiveSheet().getRange('A1');-+ // const globelCollectoiion =let extension: BaseClipboardExtension | false = false;for (let index = 0; index < this._clipboardExtensionFactoryList.length; index++) {const extensionFactory = this._clipboardExtensionFactoryList[index];extension = extensionFactory.check(data);if (extension !== false) {- const action = extension.execute();- if (!action) {- continue;- }- range.addAction(action);- // break;+ const actionData = extension.execute();+ // xxx.push(actionData)}}-- range.invokeCommand();- // return extension;+ // xxxx.invoke()}}diff --git a/packages/core/src/Basics/ContextBase.ts b/packages/core/src/Basics/ContextBase.tsindex a22b14206a..4aa1948e01 100644--- a/packages/core/src/Basics/ContextBase.ts+++ b/packages/core/src/Basics/ContextBase.ts@@ -33,10 +33,10 @@ export abstract class ContextBase {}onUniver(univer: Univer): void {- const glboalContext = univer.getGlobalContext();+ const globalContext = univer.getGlobalContext();this._univer = univer;- this._undoManager = glboalContext.getUndoManager();- this._commandManager = glboalContext.getCommandManager();+ this._undoManager = globalContext.getUndoManager();+ this._commandManager = globalContext.getCommandManager();}getHook<T>(path: string): Nullable<ObservableHooks<T>> {diff --git a/packages/core/src/Interfaces/IWorkbookData.ts b/packages/core/src/Interfaces/IWorkbookData.tsindex e4a6c92ff4..4f748d3ae7 100644--- a/packages/core/src/Interfaces/IWorkbookData.ts+++ b/packages/core/src/Interfaces/IWorkbookData.ts@@ -1,4 +1,4 @@-import { IKeyType, Nullable } from '../Shared/Types';+import { IKeyType, IKeyValue, Nullable } from '../Shared/Types';import { BooleanNumber, LocaleType } from '../Enum';import { IStyleData } from './IStyleData';import { IWorksheetConfig } from './IWorksheetData';@@ -25,6 +25,6 @@ export interface IWorkbookConfig {styles: IKeyType<Nullable<IStyleData>>;sheets: { [sheetId: string]: Partial<IWorksheetConfig> };sheetOrder: string[]; // sheet id order list ['xxxx-sheet3', 'xxxx-sheet1','xxxx-sheet2']- pluginMeta: object;+ pluginMeta: IKeyValue;namedRanges: INamedRange[];}diff --git a/packages/core/src/Interfaces/IWorksheetData.ts b/packages/core/src/Interfaces/IWorksheetData.tsindex 4c79415dc9..908569d6c5 100644--- a/packages/core/src/Interfaces/IWorksheetData.ts+++ b/packages/core/src/Interfaces/IWorksheetData.ts@@ -1,4 +1,5 @@import { BooleanNumber, SheetTypes } from '../Enum';+import { IKeyValue } from '../Shared';import { ObjectArrayType } from '../Shared/ObjectArray';import { ObjectMatrixPrimitiveType } from '../Shared/ObjectMatrix';import { ICellData } from './ICellData';@@ -63,5 +64,5 @@ export interface IWorksheetConfig {selections: IRangeType[];rightToLeft: BooleanNumber;// metaData: MetaData[];- pluginMeta: {};+ pluginMeta: IKeyValue;}diff --git a/packages/core/src/Sheets/Domain/Range.ts b/packages/core/src/Sheets/Domain/Range.tsindex ec88ce04ae..0488872050 100644--- a/packages/core/src/Sheets/Domain/Range.ts+++ b/packages/core/src/Sheets/Domain/Range.ts@@ -12,12 +12,7 @@ import {SetRangeStyleAction,} from '../Action';-import {- CommandManager,- ISheetActionData,- Command,- IActionData,-} from '../../Command';+import { CommandManager, ISheetActionData, Command } from '../../Command';import { DEFAULT_RANGE, DEFAULT_STYLES, ACTION_NAMES } from '../../Const';@@ -53,7 +48,6 @@ import {import {Nullable,- ObjectArrayPrimitiveType,ObjectMatrix,ObjectMatrixPrimitiveType,Tools,@@ -63,6 +57,9 @@ import {import { DropCell } from '../../Shared/DropCell';import { Worksheet } from './Worksheet';+// type FromProps<T> = T extends ISty+export type PropsFrom<T> = T extends Nullable<infer Props> ? Props : T;+/*** getObjectValues options type*/@@ -92,8 +89,6 @@ export class Range {private _worksheet: Worksheet;- private _actionList: IActionData[] = [];-constructor(workSheet: Worksheet, range: IRangeType) {this._context = workSheet.getContext();this._commandManager = this._context.getCommandManager();@@ -334,7 +329,7 @@ export class Range {*/getObjectValues(options: IValueOptionsType = {}- ): ObjectArrayPrimitiveType<ICellData> {+ ): ObjectMatrixPrimitiveType<ICellData> {const { startRow, endRow, startColumn, endColumn } = this._rangeData;// get object values from sheet matrix, or use this.getMatrix() create a new matrix then this.getMatrix().getData()@@ -397,7 +392,7 @@ export class Range {* Returns the font families of the cells in the range.*/getFontFamilies(): string[][] {- return this._getStyles('ff');+ return this._getStyles('ff') as string[][];}/**@@ -411,7 +406,7 @@ export class Range {* Returns the underlines of the cells in the range.*/getUnderlines(): ITextDecoration[][] {- return this._getStyles('ul');+ return this._getStyles('ul') as ITextDecoration[][];}/**@@ -425,7 +420,7 @@ export class Range {* Returns the overlines of the cells in the range.*/getOverlines(): ITextDecoration[][] {- return this._getStyles('ol');+ return this._getStyles('ol') as ITextDecoration[][];}/**@@ -439,7 +434,7 @@ export class Range {* Returns the strikeThroughs of the cells in the range.*/getStrikeThroughs(): ITextDecoration[][] {- return this._getStyles('st');+ return this._getStyles('st') as ITextDecoration[][];}/**@@ -460,7 +455,7 @@ export class Range {* Returns the font sizes of the cells in the range.*/getFontSizes(): number[][] {- return this._getStyles('fs');+ return this._getStyles('fs') as number[][];}/**@@ -472,7 +467,7 @@ export class Range {}getBorders(): IBorderData[][] {- return this._getStyles('bd');+ return this._getStyles('bd') as IBorderData[][];}/**@@ -486,7 +481,7 @@ export class Range {* Returns the font styles of the cells in the range.*/getFontStyles(): FontItalic[][] {- return this._getStyles('it');+ return this._getStyles('it') as FontItalic[][];}/**@@ -500,7 +495,7 @@ export class Range {* Returns the font weights of the cells in the range.*/getFontWeights(): FontWeight[][] {- return this._getStyles('bl');+ return this._getStyles('bl') as FontWeight[][];}/**@@ -551,7 +546,7 @@ export class Range {*Returns the horizontal alignments of the cells in the range.*/getHorizontalAlignments(): HorizontalAlign[][] {- return this._getStyles('ht');+ return this._getStyles('ht') as HorizontalAlign[][];}/**@@ -742,7 +737,7 @@ export class Range {* Returns the text directions for the cells in the range.*/getTextDirections(): number[][] {- return this._getStyles('td');+ return this._getStyles('td') as number[][];}/**@@ -791,7 +786,7 @@ export class Range {* Returns the vertical alignments of the cells in the range.*/getVerticalAlignments(): VerticalAlign[][] {- return this._getStyles('vt');+ return this._getStyles('vt') as VerticalAlign[][];}/**@@ -818,20 +813,20 @@ export class Range {* Returns whether the text in the cells wrap.*/getWraps(): BooleanNumber[][] {- return this._getStyles('tb');+ return this._getStyles('tb') as BooleanNumber[][];}/*** Returns the text wrapping strategies for the cells in the range.*/- getWrapStrategies(): Array<Array<Nullable<WrapStrategy>>> {- return this._getStyles('tb');+ getWrapStrategies(): WrapStrategy[][] {+ return this._getStyles('tb') as WrapStrategy[][];}/*** Returns the text wrapping strategy for the top left cell of the range.*/- getWrapStrategy(): Nullable<WrapStrategy> {+ getWrapStrategy(): WrapStrategy {return this.getWrapStrategies()[0][0];}@@ -3519,7 +3514,7 @@ export class Range {const newRowList = Array.from(new Set(rowList.flat()));- const newData = {};+ const newData: { [key: number]: { [key: number]: ICellData } } = {};newRowList.forEach((item, i) => {newData[i] = newCellValue[item];@@ -3629,28 +3624,6 @@ export class Range {return true;}- /**- * Paste the action, assemble all the actions- */- addAction(action: IActionData) {- this._actionList.push(action);- }-- /**- * Paste the action, send them together- */- invokeCommand() {- console.info('Range invoke=====', this._actionList);- const { _context, _commandManager } = this;- let command = new Command(- {- WorkBookUnit: _context.getWorkBook(),- },- ...this._actionList- );- _commandManager.invoke(command);- }-/*** en:*@@ -3776,7 +3749,9 @@ export class Range {* @param arg Shorthand for the style that gets* @returns style value*/- private _getStyles(arg: string) {+ private _getStyles<K>(+ arg: keyof IStyleData+ ): Array<Array<IStyleData[keyof IStyleData]>> {return this.getValues().map((row) =>row.map((cell: Nullable<ICellData>) => {const styles = this._context.getWorkBook().getStyles();diff --git a/packages/core/src/Sheets/Domain/RangeList.ts b/packages/core/src/Sheets/Domain/RangeList.tsindex a6b8a7b4e2..cc06b6bfc4 100644--- a/packages/core/src/Sheets/Domain/RangeList.ts+++ b/packages/core/src/Sheets/Domain/RangeList.ts@@ -209,15 +209,6 @@ export class RangeList {return this.clear({ contentsOnly: true });}- /**- * Clears the note for each Range in the range list.- *- * @returns This range list, for chaining.- */- clearNote(): RangeList {- return this.clear({ commentsOnly: true });- }-/*** Sets the background color for each Range in the range list.*diff --git a/packages/core/src/Sheets/Domain/Workbook.ts b/packages/core/src/Sheets/Domain/Workbook.tsindex 118423134c..e1cab2c980 100644--- a/packages/core/src/Sheets/Domain/Workbook.ts+++ b/packages/core/src/Sheets/Domain/Workbook.ts@@ -19,6 +19,7 @@ import {import {IColumnStartEndData,IGridRange,+ IRangeArrayData,IRangeData,IRangeStringData,IRangeType,@@ -486,7 +487,7 @@ export class Workbook {});if (!activeSheetId) {console.warn('No active sheet, get first sheet');- return this._worksheets[0];+ return this._worksheets.get(sheetOrder[0]) as Worksheet;}return this._worksheets.get(activeSheetId) as Worksheet;}@@ -767,13 +768,14 @@ export class Workbook {return gridRange;}if (typeof range !== 'string' && 'row' in range) {+ const rangeArrayData = range as IRangeArrayData;return {sheetId: '',rangeData: {- startRow: range.row[0],- startColumn: range.column[0],- endRow: range.row[1],- endColumn: range.column[1],+ startRow: rangeArrayData.row[0],+ startColumn: rangeArrayData.column[0],+ endRow: rangeArrayData.row[1],+ endColumn: rangeArrayData.column[1],},};// ref : https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-the-in-operator@@ -839,7 +841,8 @@ export class Workbook {this._worksheets.forEach((sheet) => {sheet.setStatus(BooleanNumber.FALSE);});- this._worksheets[0].setStatus(BooleanNumber.TRUE);+ const { sheetOrder } = this._config;+ this._worksheets.get(sheetOrder[0])?.setStatus(BooleanNumber.TRUE);}}diff --git a/packages/core/src/Sheets/Domain/Worksheet.ts b/packages/core/src/Sheets/Domain/Worksheet.tsindex 711c68e21a..473385099e 100644--- a/packages/core/src/Sheets/Domain/Worksheet.ts+++ b/packages/core/src/Sheets/Domain/Worksheet.ts@@ -1145,24 +1145,6 @@ export class Worksheet {return this;}- /**- * Clears the sheet of all notes.- * @returns WorkSheet Instance- */- clearNotes(): Worksheet {- const { _config } = this;- const { rowCount, columnCount } = _config;- this.getRange({- startRow: 0,- endRow: rowCount,- startColumn: 0,- endColumn: columnCount,- }).clear({- commentsOnly: true,- });- return this;- }-/*** Deletes the column at the given column position.* @param columnPosition column indexdiff --git a/packages/sheets-plugin-clipboard/src/Action/AddFilterAction.ts b/packages/sheets-plugin-clipboard/src/Action/AddFilterAction.tsdeleted file mode 100644index 534344e2fa..0000000000--- a/packages/sheets-plugin-clipboard/src/Action/AddFilterAction.ts+++ /dev/null@@ -1,46 +0,0 @@-import { SheetActionBase, ActionObservers, ISheetActionData, Nullable, Workbook } from '@univerjs/core';-import { IFilter } from '../Domain';-import { ACTION_NAMES, FILTER_PLUGIN } from '../Const';-import { AddFilter, RemoveFilter } from '../Apply';-import { IRemoveFilterActionData } from './RemoveFilterAction';--export interface IAddFilterActionData extends ISheetActionData {- filter: Nullable<IFilter>;-}--export class AddFilterAction extends SheetActionBase<IAddFilterActionData, IRemoveFilterActionData> {- constructor(actionData: IAddFilterActionData, workbook: Workbook, observers: ActionObservers) {- super(actionData, workbook, observers);- this._doActionData = {- ...actionData,- };- this._oldActionData = {- sheetId: this._doActionData.sheetId,- actionName: ACTION_NAMES.ADD_FILTER_ACTION,- };- this.do();- this.validate();- }-- redo(): void {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- AddFilter(manager.getRequirePluginByName(FILTER_PLUGIN), this._doActionData.sheetId, this._doActionData.filter);- }-- undo(): void {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- RemoveFilter(manager.getRequirePluginByName(FILTER_PLUGIN), this._oldActionData.sheetId);- }-- do(): void {- this.redo();- }-- validate(): boolean {- throw new Error('Method not implemented.');- }-}diff --git a/packages/sheets-plugin-clipboard/src/Action/AddFilterCriteriaAction.ts b/packages/sheets-plugin-clipboard/src/Action/AddFilterCriteriaAction.tsdeleted file mode 100644index c0c95ab78b..0000000000--- a/packages/sheets-plugin-clipboard/src/Action/AddFilterCriteriaAction.ts+++ /dev/null@@ -1,49 +0,0 @@-import { SheetActionBase, ActionObservers, ISheetActionData, Nullable, Workbook } from '@univerjs/core';-import { IFilterCriteriaColumn } from '../Domain/FilterCriteriaColumn';-import { ACTION_NAMES } from '../Const/ACTION_NAME';-import { FILTER_PLUGIN } from '../Const';-import { AddFilterCriteria, RemoveFilterCriteria } from '../Apply';-import { IRemoveFilterCriteriaAction } from './RemoveFilterCriteriaAction';--export interface IAddFilterCriteriaActionData extends ISheetActionData {- columnPosition: number;- criteriaColumn: Nullable<IFilterCriteriaColumn>;-}--export class AddFilterCriteriaAction extends SheetActionBase<IAddFilterCriteriaActionData, IRemoveFilterCriteriaAction> {- constructor(actionData: IAddFilterCriteriaActionData, workbook: Workbook, observers: ActionObservers) {- super(actionData, workbook, observers);- this._doActionData = {- ...actionData,- };- this._oldActionData = {- columnPosition: actionData.columnPosition,- sheetId: actionData.sheetId,- actionName: ACTION_NAMES.ADD_FILTER_CRITERIA_ACTION,- };- this.do();- this.validate();- }-- do(): void {- this.redo();- }-- redo(): void {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- AddFilterCriteria(manager.getRequirePluginByName(FILTER_PLUGIN), this._doActionData.sheetId, this._doActionData.criteriaColumn);- }-- undo(): void {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- RemoveFilterCriteria(manager.getRequirePluginByName(FILTER_PLUGIN), this._oldActionData.sheetId, this._oldActionData.columnPosition);- }-- validate(): boolean {- return false;- }-}diff --git a/packages/sheets-plugin-clipboard/src/Action/RemoveFilterAction.ts b/packages/sheets-plugin-clipboard/src/Action/RemoveFilterAction.tsdeleted file mode 100644index d182ae63d6..0000000000--- a/packages/sheets-plugin-clipboard/src/Action/RemoveFilterAction.ts+++ /dev/null@@ -1,44 +0,0 @@-import { SheetActionBase, ActionObservers, ISheetActionData, Nullable, Workbook } from '@univerjs/core';-import { AddFilter, RemoveFilter } from '../Apply';-import { ACTION_NAMES, FILTER_PLUGIN } from '../Const';-import { IFilter } from '../Domain';-import { IAddFilterActionData } from './AddFilterAction';--export interface IRemoveFilterActionData extends ISheetActionData {}--export class RemoveFilterAction extends SheetActionBase<IRemoveFilterActionData, IAddFilterActionData> {- constructor(actionData: IRemoveFilterActionData, workbook: Workbook, observers: ActionObservers) {- super(actionData, workbook, observers);- this._doActionData = {- ...actionData,- };- this._oldActionData = {- sheetId: this._doActionData.sheetId,- actionName: ACTION_NAMES.REMOVE_FILTER_ACTION,- filter: this.do(),- };- this.validate();- }-- redo(): Nullable<IFilter> {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- return RemoveFilter(manager.getRequirePluginByName(FILTER_PLUGIN), this._doActionData.sheetId);- }-- undo(): void {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- AddFilter(manager.getRequirePluginByName(FILTER_PLUGIN), this._doActionData.sheetId, this._oldActionData.filter);- }-- do(): Nullable<IFilter> {- return this.redo();- }-- validate(): boolean {- throw new Error('Method not implemented.');- }-}diff --git a/packages/sheets-plugin-clipboard/src/Action/RemoveFilterCriteriaAction.ts b/packages/sheets-plugin-clipboard/src/Action/RemoveFilterCriteriaAction.tsdeleted file mode 100644index 857f7370b6..0000000000--- a/packages/sheets-plugin-clipboard/src/Action/RemoveFilterCriteriaAction.ts+++ /dev/null@@ -1,47 +0,0 @@-import { SheetActionBase, ActionObservers, ISheetActionData, Nullable, Workbook } from '@univerjs/core';-import { AddFilterCriteria, RemoveFilterCriteria } from '../Apply';-import { ACTION_NAMES, FILTER_PLUGIN } from '../Const';-import { IFilterCriteriaColumn } from '../Domain';-import { IAddFilterCriteriaActionData } from './AddFilterCriteriaAction';--export interface IRemoveFilterCriteriaAction extends ISheetActionData {- columnPosition: number;-}--export class RemoveFilterCriteriaAction extends SheetActionBase<IRemoveFilterCriteriaAction, IAddFilterCriteriaActionData> {- constructor(actionData: IRemoveFilterCriteriaAction, workbook: Workbook, observers: ActionObservers) {- super(actionData, workbook, observers);- this._doActionData = {- ...actionData,- };- this._oldActionData = {- actionName: ACTION_NAMES.ADD_FILTER_CRITERIA_ACTION,- sheetId: actionData.sheetId,- columnPosition: actionData.columnPosition,- criteriaColumn: this.do(),- };- this.validate();- }-- do(): Nullable<IFilterCriteriaColumn> {- return this.redo();- }-- redo(): Nullable<IFilterCriteriaColumn> {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- return RemoveFilterCriteria(manager.getRequirePluginByName(FILTER_PLUGIN), this._oldActionData.sheetId, this._doActionData.columnPosition);- }-- undo(): void {- const worksheet = this.getWorkSheet();- const context = worksheet.getContext();- const manager = context.getPluginManager();- AddFilterCriteria(manager.getRequirePluginByName(FILTER_PLUGIN), this._doActionData.sheetId, this._oldActionData.criteriaColumn);- }-- validate(): boolean {- return false;- }-}diff --git a/packages/sheets-plugin-clipboard/src/Action/index.ts b/packages/sheets-plugin-clipboard/src/Action/index.tsdeleted file mode 100644index 58d3e905df..0000000000--- a/packages/sheets-plugin-clipboard/src/Action/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './IAction';-export * from './IActionSet';-export * from './ActionFilter';-export * from './SetFilterCriteriaAction';diff --git a/packages/sheets-plugin-clipboard/src/Apply/AddFilter.ts b/packages/sheets-plugin-clipboard/src/Apply/AddFilter.tsdeleted file mode 100644index bbf57f9f9b..0000000000--- a/packages/sheets-plugin-clipboard/src/Apply/AddFilter.ts+++ /dev/null@@ -1,10 +0,0 @@-import { Nullable } from '@univerjs/core';-import { Filter, IFilter } from '../Domain';-import { ClipboardPlugin } from '../ClipboardPlugin';--export function AddFilter(plugin: ClipboardPlugin, sheetId: string, filter: Nullable<IFilter>) {- const filterList = plugin.getFilterList();- if (filter) {- filterList.addFilter(sheetId, Filter.fromSequence<Filter>(filter).withContext(plugin.getContext()));- }-}diff --git a/packages/sheets-plugin-clipboard/src/Apply/AddFilterCriteria.ts b/packages/sheets-plugin-clipboard/src/Apply/AddFilterCriteria.tsdeleted file mode 100644index b826459376..0000000000--- a/packages/sheets-plugin-clipboard/src/Apply/AddFilterCriteria.ts+++ /dev/null@@ -1,12 +0,0 @@-import { Nullable } from '@univerjs/core';-import { FilterCriteriaColumn, IFilterCriteriaColumn } from '../Domain';-import { ClipboardPlugin } from '../ClipboardPlugin';--export function AddFilterCriteria(plugin: ClipboardPlugin, sheetId: string, criteriaColumn: Nullable<IFilterCriteriaColumn>) {- const filterList = plugin.getFilterList();- const filterModel = filterList.getFilter(sheetId);- const criteriaModel = filterModel.getGroupModel();- if (criteriaColumn) {- criteriaModel[criteriaColumn.column] = FilterCriteriaColumn.fromSequence<FilterCriteriaColumn>(criteriaColumn).withContext(plugin.getContext());- }-}diff --git a/packages/sheets-plugin-clipboard/src/Apply/RemoveFilter.ts b/packages/sheets-plugin-clipboard/src/Apply/RemoveFilter.tsdeleted file mode 100644index c8650d1452..0000000000--- a/packages/sheets-plugin-clipboard/src/Apply/RemoveFilter.ts+++ /dev/null@@ -1,11 +0,0 @@-import { Nullable } from '@univerjs/core';-import { ClipboardPlugin } from '../ClipboardPlugin';-import { IFilter } from '../Domain';--export function RemoveFilter(plugin: ClipboardPlugin, sheetId: string): Nullable<IFilter> {- const filterList = plugin.getFilterList();- const filterModel = filterList.getGroupModel();- const filter = filterModel[sheetId];- delete filterModel[sheetId];- return filter.toSequence();-}diff --git a/packages/sheets-plugin-clipboard/src/Apply/RemoveFilterCriteria.ts b/packages/sheets-plugin-clipboard/src/Apply/RemoveFilterCriteria.tsdeleted file mode 100644index fc0999061f..0000000000--- a/packages/sheets-plugin-clipboard/src/Apply/RemoveFilterCriteria.ts+++ /dev/null@@ -1,12 +0,0 @@-import { Nullable } from '@univerjs/core';-import { ClipboardPlugin } from '../ClipboardPlugin';-import { IFilterCriteriaColumn } from '../Domain';--export function RemoveFilterCriteria(plugin: ClipboardPlugin, sheetId: string, column: number): Nullable<IFilterCriteriaColumn> {- const filterList = plugin.getFilterList();- const filterModel = filterList.getFilter(sheetId);- const criteriaModel = filterModel.getGroupModel();- const criteria = criteriaModel[column];- delete criteriaModel[column];- return criteria.toSequence();-}diff --git a/packages/sheets-plugin-clipboard/src/Apply/index.ts b/packages/sheets-plugin-clipboard/src/Apply/index.tsdeleted file mode 100644index c11e36e997..0000000000--- a/packages/sheets-plugin-clipboard/src/Apply/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './AddFilterCriteria';-export * from './RemoveFilterCriteria';-export * from './AddFilter';-export * from './RemoveFilter';diff --git a/packages/sheets-plugin-clipboard/src/Const/ACTION_NAME.ts b/packages/sheets-plugin-clipboard/src/Const/ACTION_NAME.tsdeleted file mode 100644index 356873ce46..0000000000--- a/packages/sheets-plugin-clipboard/src/Const/ACTION_NAME.ts+++ /dev/null@@ -1,9 +0,0 @@-export enum ACTION_NAMES {- ADD_FILTER_ACTION = 'AddFilterAction',- REMOVE_FILTER_ACTION = 'RemoveFilterAction',-- ADD_FILTER_CRITERIA_ACTION = 'AddFilterCriteriaAction',- REMOVE_FILTER_CRITERIA_ACTION = 'RemoveFilterCriteriaAction',-- SET_FILTER_CRITERIA_ACTION = 'setFilterCriteriaAction',-}diff --git a/packages/sheets-plugin-clipboard/src/Const/FILTER_CRITERIA_DEFINED.ts b/packages/sheets-plugin-clipboard/src/Const/FILTER_CRITERIA_DEFINED.tsdeleted file mode 100644index 3e7d4f73ae..0000000000--- a/packages/sheets-plugin-clipboard/src/Const/FILTER_CRITERIA_DEFINED.ts+++ /dev/null@@ -1,7 +0,0 @@-export const FilterCriteriaDefined = {- CELL_EMPTY: 'whenCellEmpty',- CELL_NOT_EMPTY: 'whenCellNotEmpty',- DATE_AFTER: 'whenDateAfter',- DATE_BEFORE: 'whenDateBefore',- DATE_EQUAL_TO: 'whenDateEqualTo',-};diff --git a/packages/sheets-plugin-clipboard/src/Const/PLUGIN_NAME.ts b/packages/sheets-plugin-clipboard/src/Const/PLUGIN_NAME.tsdeleted file mode 100644index e4aebe4304..0000000000--- a/packages/sheets-plugin-clipboard/src/Const/PLUGIN_NAME.ts+++ /dev/null@@ -1 +0,0 @@-export const CLIPBOARD_PLUGIN = 'ClipboardPlugin';diff --git a/packages/sheets-plugin-clipboard/src/Const/index.ts b/packages/sheets-plugin-clipboard/src/Const/index.tsdeleted file mode 100644index 5681768dab..0000000000--- a/packages/sheets-plugin-clipboard/src/Const/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './FILTER_CRITERIA_DEFINED';-export * from './ACTION_NAME';-export * from './PLUGIN_NAME';diff --git a/packages/sheets-plugin-clipboard/src/Enum/BooleanCriteria.ts b/packages/sheets-plugin-clipboard/src/Enum/BooleanCriteria.tsdeleted file mode 100644index b9e1f08f61..0000000000--- a/packages/sheets-plugin-clipboard/src/Enum/BooleanCriteria.ts+++ /dev/null@@ -1,73 +0,0 @@-export enum BooleanCriteria {- // The criteria is met when a cell is empty.- CELL_EMPTY = 'CELL_EMPTY',-- // The criteria is met when a cell is not empty.- CELL_NOT_EMPTY = 'CELL_NOT_EMPTY',-- // The criteria is met when a date is after the given value.- DATE_AFTER = 'DATE_AFTER',-- // The criteria is met when a date is before the given value.- DATE_BEFORE = 'DATE_BEFORE',-- // The criteria is met when a date is equal to the given value.- DATE_EQUAL_TO = 'DATE_EQUAL_TO',-- // The criteria is met when a date is not equal to the given value.- DATE_NOT_EQUAL_TO = 'DATE_NOT_EQUAL_TO',-- // The criteria is met when a date is after the relative date value.- DATE_AFTER_RELATIVE = 'DATE_AFTER_RELATIVE',-- // The criteria is met when a date is before the relative date value.- DATE_BEFORE_RELATIVE = 'DATE_BEFORE_RELATIVE',-- // The criteria is met when a date is equal to the relative date value.- DATE_EQUAL_TO_RELATIVE = 'DATE_EQUAL_TO_RELATIVE',-- // The criteria is met when a number that is between the given values.- NUMBER_BETWEEN = 'NUMBER_BETWEEN',-- // The criteria is met when a number that is equal to the given value.- NUMBER_EQUAL_TO = 'NUMBER_EQUAL_TO',-- // The criteria is met when a number that is greater than the given value.- NUMBER_GREATER_THAN = 'NUMBER_GREATER_THAN',-- // The criteria is met when a number that is greater than or equal to the given value.- NUMBER_GREATER_THAN_OR_EQUAL_TO = 'NUMBER_GREATER_THAN_OR_EQUAL_TO',-- // The criteria is met when a number that is less than the given value.- NUMBER_LESS_THAN = 'NUMBER_LESS_THAN',-- // The criteria is met when a number that is less than or equal to the given value.- NUMBER_LESS_THAN_OR_EQUAL_TO = 'NUMBER_LESS_THAN_OR_EQUAL_TO',-- // The criteria is met when a number that is not between the given values.- NUMBER_NOT_BETWEEN = 'NUMBER_NOT_BETWEEN',-- // The criteria is met when a number that is not equal to the given value.- NUMBER_NOT_EQUAL_TO = 'NUMBER_NOT_EQUAL_TO',-- // The criteria is met when the input contains the given value.- TEXT_CONTAINS = 'TEXT_CONTAINS',-- // The criteria is met when the input does not contain the given value.- TEXT_DOES_NOT_CONTAIN = 'TEXT_DOES_NOT_CONTAIN',-- // The criteria is met when the input is equal to the given value.- TEXT_EQUAL_TO = 'TEXT_EQUAL_TO',-- // The criteria is met when the input is not equal to the given value.- TEXT_NOT_EQUAL_TO = 'TEXT_NOT_EQUAL_TO',-- // The criteria is met when the input begins with the given value.- TEXT_STARTS_WITH = 'TEXT_STARTS_WITH',-- // The criteria is met when the input ends with the given value.- TEXT_ENDS_WITH = 'TEXT_ENDS_WITH',-- // The criteria is met when the input makes the given formula evaluate to true.- CUSTOM_FORMULA = 'CUSTOM_FORMULA',-}diff --git a/packages/sheets-plugin-clipboard/src/IData/FilterType.ts b/packages/sheets-plugin-clipboard/src/IData/FilterType.tsdeleted file mode 100644index d44d7957bf..0000000000--- a/packages/sheets-plugin-clipboard/src/IData/FilterType.ts+++ /dev/null@@ -1,24 +0,0 @@-import { IColor, IRangeData, Nullable } from '@univerjs/core';--export type IFilterType = {- range: IRangeData;- sortSpecs: {};- filterSpecs: IFilterSpecsType[];-};--export type IFilterSpecsType = {- filterCriteria: Nullable<IFilterCriteria>;- // Union field reference can be only one of the following:- columnIndex: number;- dataSourceColumnReference: {};- // End of list of possible types for union field reference.-};--type IFilterCriteria = {- hiddenValues: string[];- condition: BooleanCondition;- visibleBackgroundColor: IColor;- // visibleBackgroundColorStyle: IColorStyle;- visibleForegroundColor: IColor;- // visibleForegroundColorStyle: IColorStyle;-};diff --git a/packages/sheets-plugin-clipboard/src/IData/index.ts b/packages/sheets-plugin-clipboard/src/IData/index.tsdeleted file mode 100644index 1d99946701..0000000000--- a/packages/sheets-plugin-clipboard/src/IData/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './FilterType';diff --git a/packages/sheets-plugin-clipboard/src/index.ts b/packages/sheets-plugin-clipboard/src/index.tsdeleted file mode 100644index 394bfa5251..0000000000--- a/packages/sheets-plugin-clipboard/src/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './ClipboardPlugin';-diff --git a/packages/sheets-plugin-clipboard/test/FilterPlugin.test.tsx b/packages/sheets-plugin-clipboard/test/FilterPlugin.test.tsxdeleted file mode 100644index 62a0d2f6e3..0000000000--- a/packages/sheets-plugin-clipboard/test/FilterPlugin.test.tsx+++ /dev/null@@ -1,7 +0,0 @@-import {FilterPlugin} from "../src";--jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));--test('FilterPlugin', () => {- new FilterPlugin({});-});diff --git a/packages/sheets-plugin-clipboard/README-zh.md b/packages/sheets-plugin-operation/README-zh.mdsimilarity index 100%rename from packages/sheets-plugin-clipboard/README-zh.mdrename to packages/sheets-plugin-operation/README-zh.mddiff --git a/packages/sheets-plugin-clipboard/README.md b/packages/sheets-plugin-operation/README.mdsimilarity index 100%rename from packages/sheets-plugin-clipboard/README.mdrename to packages/sheets-plugin-operation/README.mddiff --git a/packages/sheets-plugin-clipboard/index.html b/packages/sheets-plugin-operation/index.htmlsimilarity index 100%rename from packages/sheets-plugin-clipboard/index.htmlrename to packages/sheets-plugin-operation/index.htmldiff --git a/packages/sheets-plugin-clipboard/jest.config.js b/packages/sheets-plugin-operation/jest.config.jssimilarity index 100%rename from packages/sheets-plugin-clipboard/jest.config.jsrename to packages/sheets-plugin-operation/jest.config.jsdiff --git a/packages/sheets-plugin-clipboard/package.json b/packages/sheets-plugin-operation/package.jsonsimilarity index 89%rename from packages/sheets-plugin-clipboard/package.jsonrename to packages/sheets-plugin-operation/package.jsonindex 610260c227..b36135ac12 100644--- a/packages/sheets-plugin-clipboard/package.json+++ b/packages/sheets-plugin-operation/package.json@@ -1,5 +1,5 @@{- "name": "@univerjs/sheets-plugin-clipboard",+ "name": "@univerjs/sheets-plugin-operation","version": "0.0.1","description": "UniverSheet normal plugin UI manager","keywords": [],@@ -9,8 +9,8 @@"module": "./src/index.ts","types": "./src/Types/index.d.ts","publishConfig": {- "main": "./lib/univer-sheets-plugin-clipboard.cjs.js",- "module": "./lib/univer-sheets-plugin-clipboard.es.js",+ "main": "./lib/univer-sheets-plugin-operation.cjs.js",+ "module": "./lib/univer-sheets-plugin-operation.es.js","types": "./lib/index.d.ts"},"exports": {diff --git a/packages/sheets-plugin-operation/src/Action/index.ts b/packages/sheets-plugin-operation/src/Action/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/packages/sheets-plugin-operation/src/Apply/index.ts b/packages/sheets-plugin-operation/src/Apply/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/ClipboardExtension.tssimilarity index 84%rename from packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardExtension.tsrename to packages/sheets-plugin-operation/src/Basics/Register/ClipboardExtension.tsindex 449834888d..80f4802c93 100644--- a/packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardExtension.ts+++ b/packages/sheets-plugin-operation/src/Basics/Register/ClipboardExtension.ts@@ -8,9 +8,10 @@ import {handleTableRowGroup,IClipboardData,} from '@univerjs/base-ui';-import { ClipboardPlugin } from '../../ClipboardPlugin';+import { OperationPlugin } from '../../OperationPlugin';-export class ClipboardExtension extends BaseClipboardExtension<ClipboardPlugin> {+// copy paste delete cut insert // SheetsPluginOperation+export class ClipboardExtension extends BaseClipboardExtension<OperationPlugin> {execute() {let content = this._data.html || this._data.plain;@@ -30,7 +31,7 @@ export class ClipboardExtension extends BaseClipboardExtension<ClipboardPlugin>data = handlePlainToJson(content);}}-+ //this._plugin.getUniverPaste().pasteTo({data,colInfo,@@ -39,7 +40,7 @@ export class ClipboardExtension extends BaseClipboardExtension<ClipboardPlugin>}}-export class ClipboardExtensionFactory extends BaseClipboardExtensionFactory<ClipboardPlugin> {+export class ClipboardExtensionFactory extends BaseClipboardExtensionFactory<OperationPlugin> {get zIndex(): number {return 1;}diff --git a/packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardOfficeExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/ClipboardOfficeExtension.tssimilarity index 79%rename from packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardOfficeExtension.tsrename to packages/sheets-plugin-operation/src/Basics/Register/ClipboardOfficeExtension.tsindex d1b3e5ff29..206541cb50 100644--- a/packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardOfficeExtension.ts+++ b/packages/sheets-plugin-operation/src/Basics/Register/ClipboardOfficeExtension.ts@@ -1,14 +1,14 @@import { BaseClipboardExtension, BaseClipboardExtensionFactory, IClipboardData } from '@univerjs/base-ui';-import { ClipboardPlugin } from '../../ClipboardPlugin';+import { OperationPlugin } from '../../OperationPlugin';/*** TODO*/-export class ClipboardOfficeExtension extends BaseClipboardExtension<ClipboardPlugin> {+export class ClipboardOfficeExtension extends BaseClipboardExtension<OperationPlugin> {execute() {}}-export class ClipboardOfficeExtensionFactory extends BaseClipboardExtensionFactory<ClipboardPlugin> {+export class ClipboardOfficeExtensionFactory extends BaseClipboardExtensionFactory<OperationPlugin> {get zIndex(): number {return 2;}diff --git a/packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardSelectionExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/ClipboardSelectionExtension.tssimilarity index 53%rename from packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardSelectionExtension.tsrename to packages/sheets-plugin-operation/src/Basics/Register/ClipboardSelectionExtension.tsindex 24cb01df76..1fa04b25ec 100644--- a/packages/sheets-plugin-clipboard/src/Basics/Register/ClipboardSelectionExtension.ts+++ b/packages/sheets-plugin-operation/src/Basics/Register/ClipboardSelectionExtension.ts@@ -1,49 +1,30 @@import { BaseClipboardExtension, BaseClipboardExtensionFactory, IClipboardData } from '@univerjs/base-ui';-import { ACTION_NAMES, ISetSelectionValueActionData, SheetPlugin } from '@univerjs/base-sheets';+import { SheetPlugin } from '@univerjs/base-sheets';import { DEFAULT_CELL, DEFAULT_SELECTION, PLUGIN_NAMES } from '@univerjs/core';-import { ClipboardPlugin } from '../../ClipboardPlugin';+import { OperationPlugin } from '../../OperationPlugin';/**- * TODO+ * TODO move to ClipboardExtension*/-export class ClipboardSelectionExtension extends BaseClipboardExtension<ClipboardPlugin> {+export class ClipboardSelectionExtension extends BaseClipboardExtension<OperationPlugin> {execute() {let content = this._data.html || this._data.plain;- const selection = this.handleSelection();- return selection;- }-- /**- * TODO Calculated based on the currently active cell and pasted range- * @returns- */- handleSelection() {- const sheetId = this._plugin.getContext().getWorkBook().getActiveSheet().getSheetId();const selectionManager = this._plugin.getContext().getPluginManager().getRequirePluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET).getSelectionManager();+ // TODO get info from contentconst selectionRange = DEFAULT_SELECTION;const curCellRange = DEFAULT_CELL;- return null;selectionManager.clearSelectionControls();- const models = selectionManager.addControlToCurrentByRangeData(selectionRange, curCellRange, false);-- if (!models) {- return null;- }+ selectionManager.addControlToCurrentByRangeData(selectionRange, curCellRange);selectionManager.updatePreviousSelection();- let action: ISetSelectionValueActionData = {- sheetId,- actionName: ACTION_NAMES.SET_SELECTION_VALUE_ACTION,- selections: models,- };-- return action;+ const actionData = {};+ return actionData;}}-export class ClipboardSelectionExtensionFactory extends BaseClipboardExtensionFactory<ClipboardPlugin> {+export class ClipboardSelectionExtensionFactory extends BaseClipboardExtensionFactory<OperationPlugin> {get zIndex(): number {return 3;}diff --git a/packages/sheets-plugin-operation/src/Const/PLUGIN_NAME.ts b/packages/sheets-plugin-operation/src/Const/PLUGIN_NAME.tsnew file mode 100644index 0000000000..c35c1e9df7--- /dev/null+++ b/packages/sheets-plugin-operation/src/Const/PLUGIN_NAME.ts@@ -0,0 +1 @@+export const OPERATION_PLUGIN = 'OperationPlugin';diff --git a/packages/sheets-plugin-operation/src/Const/index.ts b/packages/sheets-plugin-operation/src/Const/index.tsnew file mode 100644index 0000000000..caeb42be51--- /dev/null+++ b/packages/sheets-plugin-operation/src/Const/index.ts@@ -0,0 +1 @@+export * from './PLUGIN_NAME';diff --git a/packages/sheets-plugin-clipboard/src/Domain/Clipboard.ts b/packages/sheets-plugin-operation/src/Domain/Clipboard.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Domain/Clipboard.tsrename to packages/sheets-plugin-operation/src/Domain/Clipboard.tsdiff --git a/packages/sheets-plugin-clipboard/src/Domain/Copy.ts b/packages/sheets-plugin-operation/src/Domain/Copy.tssimilarity index 98%rename from packages/sheets-plugin-clipboard/src/Domain/Copy.tsrename to packages/sheets-plugin-operation/src/Domain/Copy.tsindex 414036bdce..691322a0cd 100644--- a/packages/sheets-plugin-clipboard/src/Domain/Copy.ts+++ b/packages/sheets-plugin-operation/src/Domain/Copy.ts@@ -3,7 +3,7 @@ import { SheetPlugin, SelectionModel, SelectionControl } from '@univerjs/base-shimport { RightMenuProps, SheetUIPlugin, SHEET_UI_PLUGIN_NAME, RightMenuItem } from '@univerjs/ui-plugin-sheets';import { Clipboard } from '@univerjs/base-ui';// import { ClipboardInput } from '../UI/ClipboardInput';-import { CLIPBOARD_PLUGIN } from '../Const';+import { OPERATION_PLUGIN } from '../Const';export abstract class Copy {private _context: SheetContext;@@ -44,9 +44,9 @@ export abstract class Copy {.getMainSlotController();for (let i = 0; i < component.length; i++) {- // SheetPlugin.registerComponent(CLIPBOARD_PLUGIN + component[i].name, component[i]);+ // SheetPlugin.registerComponent(OPERATION_PLUGIN + component[i].name, component[i]);- mainSlotController.addSlot(CLIPBOARD_PLUGIN + component[i].name, {+ mainSlotController.addSlot(OPERATION_PLUGIN + component[i].name, {component: component[i],});}@@ -86,7 +86,7 @@ export class UniverCopy extends Copy {},{// customLabel: {- // name: CLIPBOARD_PLUGIN + ClipboardInput.name,+ // name: OPERATION_PLUGIN + ClipboardInput.name,// props: {// prefixLocale: 'rightClick.array3',// placeholder1Locale: 'rightClick.row',diff --git a/packages/sheets-plugin-clipboard/src/Domain/Cut.ts b/packages/sheets-plugin-operation/src/Domain/Cut.tssimilarity index 99%rename from packages/sheets-plugin-clipboard/src/Domain/Cut.tsrename to packages/sheets-plugin-operation/src/Domain/Cut.tsindex 966e7aab6a..a9ca6f7dbd 100644--- a/packages/sheets-plugin-clipboard/src/Domain/Cut.ts+++ b/packages/sheets-plugin-operation/src/Domain/Cut.ts@@ -2,7 +2,7 @@ import { handleJsonToDom, handleStyleToString } from '@univerjs/base-ui';import { SheetContext, PLUGIN_NAMES, Tools } from '@univerjs/core';import { SheetPlugin, SelectionModel, RightMenuProps, SelectionControl } from '@univerjs/base-sheets';import { Clipboard } from './Clipboard';-import { CLIPBOARD_PLUGIN } from '../Const';+import { OPERATION_PLUGIN } from '../Const';export abstract class Cut {private _context: SheetContext;@@ -30,7 +30,7 @@ export abstract class Cut {private _initRegisterComponent(component: any[]) {const SheetPlugin = this._context.getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET)!;for (let i = 0; i < component.length; i++) {- SheetPlugin.registerComponent(CLIPBOARD_PLUGIN + component[i].name, component[i]);+ SheetPlugin.registerComponent(OPERATION_PLUGIN + component[i].name, component[i]);}}}diff --git a/packages/sheets-plugin-clipboard/src/Domain/Paste.ts b/packages/sheets-plugin-operation/src/Domain/Paste.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Domain/Paste.tsrename to packages/sheets-plugin-operation/src/Domain/Paste.tsdiff --git a/packages/sheets-plugin-clipboard/src/Domain/index.ts b/packages/sheets-plugin-operation/src/Domain/index.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Domain/index.tsrename to packages/sheets-plugin-operation/src/Domain/index.tsdiff --git a/packages/sheets-plugin-operation/src/Enum/index.ts b/packages/sheets-plugin-operation/src/Enum/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/packages/sheets-plugin-clipboard/src/IData.ts b/packages/sheets-plugin-operation/src/IData.tssimilarity index 51%rename from packages/sheets-plugin-clipboard/src/IData.tsrename to packages/sheets-plugin-operation/src/IData.tsindex 4e9190e13a..9f11e1c0c7 100644--- a/packages/sheets-plugin-clipboard/src/IData.ts+++ b/packages/sheets-plugin-operation/src/IData.ts@@ -1,9 +1,9 @@import { SheetContext } from '@univerjs/core';-import { ClipboardPlugin } from './ClipboardPlugin';+import { OperationPlugin } from './OperationPlugin';export type IConfig = {context: SheetContext;};// Types for props-export type IProps = { config: IConfig; super: ClipboardPlugin };+export type IProps = { config: IConfig; super: OperationPlugin };diff --git a/packages/sheets-plugin-operation/src/IData/index.ts b/packages/sheets-plugin-operation/src/IData/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/packages/sheets-plugin-clipboard/src/Locale/en.ts b/packages/sheets-plugin-operation/src/Locale/en.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Locale/en.tsrename to packages/sheets-plugin-operation/src/Locale/en.tsdiff --git a/packages/sheets-plugin-clipboard/src/Locale/index.ts b/packages/sheets-plugin-operation/src/Locale/index.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Locale/index.tsrename to packages/sheets-plugin-operation/src/Locale/index.tsdiff --git a/packages/sheets-plugin-clipboard/src/Locale/zh.ts b/packages/sheets-plugin-operation/src/Locale/zh.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Locale/zh.tsrename to packages/sheets-plugin-operation/src/Locale/zh.tsdiff --git a/packages/sheets-plugin-clipboard/src/ClipboardPlugin.tsx b/packages/sheets-plugin-operation/src/OperationPlugin.tssimilarity index 95%rename from packages/sheets-plugin-clipboard/src/ClipboardPlugin.tsxrename to packages/sheets-plugin-operation/src/OperationPlugin.tsindex 66fec3929f..d208f3b7b6 100644--- a/packages/sheets-plugin-clipboard/src/ClipboardPlugin.tsx+++ b/packages/sheets-plugin-operation/src/OperationPlugin.ts@@ -1,7 +1,7 @@import { SheetContext, Plugin, UniverSheet } from '@univerjs/core';import { SheetUIPlugin, SHEET_UI_PLUGIN_NAME } from '@univerjs/ui-plugin-sheets';import { en, zh } from './Locale';-import { CLIPBOARD_PLUGIN } from './Const';+import { OPERATION_PLUGIN } from './Const';import { Copy, Paste, UniverCopy, UniverPaste } from './Domain';import { ClipboardExtensionFactory } from './Basics/Register/ClipboardExtension';import { ClipboardOfficeExtensionFactory } from './Basics/Register/ClipboardOfficeExtension';@@ -17,7 +17,7 @@ interface PasteResolver {resolver: Paste;}-export class ClipboardPlugin extends Plugin<any, SheetContext> {+export class OperationPlugin extends Plugin<any, SheetContext> {private _copyResolvers: CopyResolver[] = [];private _pasteResolvers: PasteResolver[] = [];@@ -31,11 +31,11 @@ export class ClipboardPlugin extends Plugin<any, SheetContext> {private _clipboardSelectionExtensionFactory: ClipboardSelectionExtensionFactory;constructor() {- super(CLIPBOARD_PLUGIN);+ super(OPERATION_PLUGIN);}static create() {- return new ClipboardPlugin();+ return new OperationPlugin();}initialize() {diff --git a/packages/sheets-plugin-clipboard/src/Types/index.d.ts b/packages/sheets-plugin-operation/src/Types/index.d.tssimilarity index 72%rename from packages/sheets-plugin-clipboard/src/Types/index.d.tsrename to packages/sheets-plugin-operation/src/Types/index.d.tsindex 789d7342a3..0a4e753204 100644--- a/packages/sheets-plugin-clipboard/src/Types/index.d.ts+++ b/packages/sheets-plugin-operation/src/Types/index.d.ts@@ -1,5 +1,5 @@export * from '../index';-declare module '@univerjs/sheets-plugin-clipboard' {}+declare module '@univerjs/sheets-plugin-operation' {}// use css moduledeclare module '*.less' {diff --git a/packages/sheets-plugin-clipboard/src/Types/preact.d.ts b/packages/sheets-plugin-operation/src/Types/preact.d.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Types/preact.d.tsrename to packages/sheets-plugin-operation/src/Types/preact.d.tsdiff --git a/packages/sheets-plugin-clipboard/src/UI/ClipboardInput.tsx b/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsxsimilarity index 100%rename from packages/sheets-plugin-clipboard/src/UI/ClipboardInput.tsxrename to packages/sheets-plugin-operation/src/UI/ClipboardInput.tsxdiff --git a/packages/sheets-plugin-clipboard/src/Util/Util.ts b/packages/sheets-plugin-operation/src/Util/Util.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/src/Util/Util.tsrename to packages/sheets-plugin-operation/src/Util/Util.tsdiff --git a/packages/sheets-plugin-operation/src/index.ts b/packages/sheets-plugin-operation/src/index.tsnew file mode 100644index 0000000000..85d773275a--- /dev/null+++ b/packages/sheets-plugin-operation/src/index.ts@@ -0,0 +1,2 @@+export * from './OperationPlugin';+diff --git a/packages/sheets-plugin-clipboard/test/StartUp.ts b/packages/sheets-plugin-operation/test/StartUp.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/test/StartUp.tsrename to packages/sheets-plugin-operation/test/StartUp.tsdiff --git a/packages/sheets-plugin-clipboard/tsconfig.json b/packages/sheets-plugin-operation/tsconfig.jsonsimilarity index 100%rename from packages/sheets-plugin-clipboard/tsconfig.jsonrename to packages/sheets-plugin-operation/tsconfig.jsondiff --git a/packages/sheets-plugin-clipboard/vite.config.ts b/packages/sheets-plugin-operation/vite.config.tssimilarity index 100%rename from packages/sheets-plugin-clipboard/vite.config.tsrename to packages/sheets-plugin-operation/vite.config.ts