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.

feat: add crosshair highlight plugin for Univer Sheet (#3118)

Wenzhao Hu3e9c34c99ed2
diff --git a/examples/package.json b/examples/package.json
index 26599cc1ae..114822d9b5 100644
--- a/examples/package.json
+++ b/examples/package.json
@@ -30,11 +30,12 @@
"@univerjs/engine-render": "workspace:*",
"@univerjs/facade": "workspace:*",
"@univerjs/find-replace": "workspace:*",
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/rpc": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-conditional-formatting": "workspace:*",
"@univerjs/sheets-conditional-formatting-ui": "workspace:*",
+ "@univerjs/sheets-crosshair-highlight": "workspace:*",
"@univerjs/sheets-data-validation": "workspace:*",
"@univerjs/sheets-drawing": "workspace:*",
"@univerjs/sheets-drawing-ui": "workspace:*",
diff --git a/examples/src/sheets/lazy.ts b/examples/src/sheets/lazy.ts
index 41dc02ab98..b10c232d50 100644
--- a/examples/src/sheets/lazy.ts
+++ b/examples/src/sheets/lazy.ts
@@ -17,6 +17,7 @@
import type { Plugin, PluginCtor } from '@univerjs/core';
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
+import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
// import { UniverUniscriptPlugin } from '@univerjs/uniscript';
export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {
@@ -32,7 +33,9 @@ export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCt
// return './vs/editor/editor.worker.js';
// },
// },
+
// ],
+ [UniverSheetsCrosshairHighlightPlugin],
[UniverSheetsFilterUIPlugin, { useRemoteFilterValuesGenerator: true }],
[UniverSheetsFindReplacePlugin],
];
diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.ts
index c6f3b31097..37a3eb744e 100644
--- a/examples/src/sheets/main.ts
+++ b/examples/src/sheets/main.ts
@@ -42,6 +42,7 @@ import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
import { UniverDocsHyperLinkPlugin } from '@univerjs/docs-hyper-link';
+
import { enUS, ruRU, viVN, zhCN, zhTW } from '../locales';
import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data/sheets/demo/default-workbook-data-demo';
diff --git a/packages-experimental/uni-docs-ui/package.json b/packages-experimental/uni-docs-ui/package.json
index 9f648679d0..dfb33f5f97 100644
--- a/packages-experimental/uni-docs-ui/package.json
+++ b/packages-experimental/uni-docs-ui/package.json
@@ -67,7 +67,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages-experimental/uni-formula-ui/package.json b/packages-experimental/uni-formula-ui/package.json
index 212c43be4a..e3de7d232c 100644
--- a/packages-experimental/uni-formula-ui/package.json
+++ b/packages-experimental/uni-formula-ui/package.json
@@ -78,7 +78,7 @@
"@univerjs/docs": "workspace:*",
"@univerjs/docs-ui": "workspace:*",
"@univerjs/engine-render": "workspace:*",
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/rpc": "workspace:*",
"@univerjs/shared": "workspace:*",
"@univerjs/sheets-formula": "workspace:*",
diff --git a/packages-experimental/uni-formula/package.json b/packages-experimental/uni-formula/package.json
index a722e45637..cefce0b4fb 100644
--- a/packages-experimental/uni-formula/package.json
+++ b/packages-experimental/uni-formula/package.json
@@ -63,7 +63,7 @@
"@univerjs/core": "workspace:*"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages-experimental/uni-sheets-ui/package.json b/packages-experimental/uni-sheets-ui/package.json
index 0c21187517..8fbba2c42c 100644
--- a/packages-experimental/uni-sheets-ui/package.json
+++ b/packages-experimental/uni-sheets-ui/package.json
@@ -69,7 +69,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages-experimental/uni-slides-ui/package.json b/packages-experimental/uni-slides-ui/package.json
index f676a23bfb..1beec57996 100644
--- a/packages-experimental/uni-slides-ui/package.json
+++ b/packages-experimental/uni-slides-ui/package.json
@@ -69,7 +69,7 @@
"react": "^16.9.0 || ^17.0.0 || ^18.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages-experimental/uniui/package.json b/packages-experimental/uniui/package.json
index d7b0426477..c4992a3b5f 100644
--- a/packages-experimental/uniui/package.json
+++ b/packages-experimental/uniui/package.json
@@ -73,7 +73,7 @@
},
"dependencies": {
"@floating-ui/react-dom": "^2.1.1",
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@xyflow/react": "^12.0.4",
"rc-util": "^5.43.0"
},
diff --git a/packages/design/package.json b/packages/design/package.json
index 808ea44ca8..a603a9ecdc 100644
--- a/packages/design/package.json
+++ b/packages/design/package.json
@@ -74,7 +74,7 @@
"@rc-component/color-picker": "^2.0.1",
"@rc-component/trigger": "^2.2.1",
"@types/react-mentions": "^4.1.13",
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"rc-dialog": "^9.5.2",
"rc-dropdown": "^4.2.0",
"rc-input": "^1.6.3",
diff --git a/packages/docs-drawing-ui/package.json b/packages/docs-drawing-ui/package.json
index ef55479bcc..9004ed31f8 100644
--- a/packages/docs-drawing-ui/package.json
+++ b/packages/docs-drawing-ui/package.json
@@ -77,7 +77,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages/docs-hyper-link-ui/package.json b/packages/docs-hyper-link-ui/package.json
index ebea8dee2c..a85288e49a 100644
--- a/packages/docs-hyper-link-ui/package.json
+++ b/packages/docs-hyper-link-ui/package.json
@@ -71,7 +71,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages/docs-thread-comment-ui/package.json b/packages/docs-thread-comment-ui/package.json
index 0d98314837..e201e347f6 100644
--- a/packages/docs-thread-comment-ui/package.json
+++ b/packages/docs-thread-comment-ui/package.json
@@ -68,7 +68,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages/docs-ui/package.json b/packages/docs-ui/package.json
index c97a76f357..8532d278ee 100644
--- a/packages/docs-ui/package.json
+++ b/packages/docs-ui/package.json
@@ -75,7 +75,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@types/react": "^18.3.3",
diff --git a/packages/drawing-ui/package.json b/packages/drawing-ui/package.json
index 5452607e44..bb416236dc 100644
--- a/packages/drawing-ui/package.json
+++ b/packages/drawing-ui/package.json
@@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages/drawing/package.json b/packages/drawing/package.json
index 2f0d91a0c9..d74f28253c 100644
--- a/packages/drawing/package.json
+++ b/packages/drawing/package.json
@@ -62,7 +62,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"ot-json1": "^1.0.2"
},
"devDependencies": {
diff --git a/packages/facade/package.json b/packages/facade/package.json
index 86bef20f9e..92aebbe705 100644
--- a/packages/facade/package.json
+++ b/packages/facade/package.json
@@ -85,6 +85,7 @@
"@univerjs/shared": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-conditional-formatting": "workspace:*",
+ "@univerjs/sheets-crosshair-highlight": "workspace:*",
"@univerjs/sheets-data-validation": "workspace:*",
"@univerjs/sheets-filter": "workspace:*",
"@univerjs/sheets-filter-ui": "workspace:*",
diff --git a/packages/facade/src/apis/facade.ts b/packages/facade/src/apis/facade.ts
index 0ea1f4c230..9d9f680efd 100644
--- a/packages/facade/src/apis/facade.ts
+++ b/packages/facade/src/apis/facade.ts
@@ -53,6 +53,8 @@ import type {
import { IRenderManagerService } from '@univerjs/engine-render';
import { SHEET_VIEW_KEY } from '@univerjs/sheets-ui';
import { SetFormulaCalculationStartMutation } from '@univerjs/engine-formula';
+import type { ISetCrosshairHighlightColorOperationParams } from '@univerjs/sheets-crosshair-highlight';
+import { DisableCrosshairHighlightOperation, EnableCrosshairHighlightOperation, SetCrosshairHighlightColorOperation } from '@univerjs/sheets-crosshair-highlight';
import { FDocument } from './docs/f-document';
import { FWorkbook } from './sheets/f-workbook';
import { FSheetHooks } from './sheets/f-sheet-hooks';
@@ -471,6 +473,32 @@ export class FUniver {
sheetRow.setCustomHeader(cfg);
}
+ // #region API applies to all workbooks
+
+ /**
+ * Enable or disable crosshair highlight.
+ * @param {boolean} enabled if crosshair highlight should be enabled
+ */
+ setCrosshairHighlightEnabled(enabled: boolean): void {
+ if (enabled) {
+ this._commandService.executeCommand(EnableCrosshairHighlightOperation.id);
+ } else {
+ this._commandService.executeCommand(DisableCrosshairHighlightOperation.id);
+ }
+ }
+
+ /**
+ * Set the color of the crosshair highlight.
+ * @param {string} color the color of the crosshair highlight
+ */
+ setCrosshairHighlightColor(color: string): void {
+ this._commandService.executeCommand(SetCrosshairHighlightColorOperation.id, {
+ value: color,
+ } as ISetCrosshairHighlightColorOperationParams);
+ }
+
+ // #endregion
+
/**
* Get the PermissionInstance.
*
diff --git a/packages/sheets-ui/src/basics/index.ts b/packages/facade/src/apis/sheets/f-all-sheets.ts
similarity index 96%
rename from packages/sheets-ui/src/basics/index.ts
rename to packages/facade/src/apis/sheets/f-all-sheets.ts
index a0d584ae3f..cf732b1e13 100644
--- a/packages/sheets-ui/src/basics/index.ts
+++ b/packages/facade/src/apis/sheets/f-all-sheets.ts
@@ -14,4 +14,3 @@
* limitations under the License.
*/
-export * from './const';
diff --git a/packages/find-replace/package.json b/packages/find-replace/package.json
index 8db690cd1a..a1ebacafd5 100644
--- a/packages/find-replace/package.json
+++ b/packages/find-replace/package.json
@@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@types/react": "^18.3.3",
diff --git a/packages/sheets-conditional-formatting-ui/package.json b/packages/sheets-conditional-formatting-ui/package.json
index 798c836621..3ee05c6c14 100644
--- a/packages/sheets-conditional-formatting-ui/package.json
+++ b/packages/sheets-conditional-formatting-ui/package.json
@@ -79,7 +79,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/protocol": "0.1.39-alpha.9",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
diff --git a/packages/sheets-crosshair-highlight/README.md b/packages/sheets-crosshair-highlight/README.md
new file mode 100644
index 0000000000..de095ce346
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/README.md
@@ -0,0 +1,29 @@
+# @univerjs/sheets-crosshair-highlight
+
+## Package Overview
+
+| Package Name | UMD Namespace | Version | License | Downloads | Contains CSS | Contains i18n locales |
+| --- | --- | --- | --- | --- | :---: | :---: |
+| `@univerjs/sheets-crosshair-highlight` | `UniverSheetsCrosshairHighlight` | [![][npm-version-shield]][npm-version-link] | ![][npm-license-shield] | ![][npm-downloads-shield] | ⭕️ | ⭕️ |
+
+## Introduction
+
+This plugin adds a crosshair highlight to the Univer Sheet.
+
+## Usage
+
+### Installation
+
+```shell
+# Using npm
+npm i @univerjs/sheets-crosshair-highlight
+
+# Using pnpm
+pnpm add @univerjs/sheets-crosshair-highlight
+```
+
+<!-- Links -->
+[npm-version-shield]: https://img.shields.io/npm/v/@univerjs/sheets-crosshair-highlight?style=flat-square
+[npm-version-link]: https://npmjs.com/package/@univerjs/sheets-crosshair-highlight
+[npm-license-shield]: https://img.shields.io/npm/l/@univerjs/sheets-crosshair-highlight?style=flat-square
+[npm-downloads-shield]: https://img.shields.io/npm/dm/@univerjs/sheets-crosshair-highlight?style=flat-square
diff --git a/packages/sheets-crosshair-highlight/package.json b/packages/sheets-crosshair-highlight/package.json
new file mode 100644
index 0000000000..110ed18121
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/package.json
@@ -0,0 +1,108 @@
+{
+ "name": "@univerjs/sheets-crosshair-highlight",
+ "version": "0.0.1",
+ "private": true,
+ "description": "",
+ "author": "DreamNum <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [],
+ "sideEffects": [
+ "**/*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
+ },
+ "main": "./lib/cjs/index.js",
+ "module": "./lib/es/index.js",
+ "types": "./lib/types/index.d.ts",
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/cjs/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./*": {
+ "import": "./lib/es/*",
+ "require": "./lib/cjs/*",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./lib/*": "./lib/*",
+ "./locale/*": "./lib/locale/*.json"
+ }
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "test": "vitest run",
+ "test:watch": "vitest",
+ "coverage": "vitest run --coverage",
+ "lint:types": "tsc --noEmit",
+ "build": "tsc && vite build"
+ },
+ "peerDependencies": {
+ "@univerjs/core": "workspace:*",
+ "@univerjs/engine-render": "workspace:*",
+ "@univerjs/sheets": "workspace:*",
+ "@univerjs/sheets-ui": "workspace:*",
+ "@univerjs/ui": "workspace:*",
+ "clsx": ">=2.0.0",
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/icons": "^0.1.77"
+ },
+ "devDependencies": {
+ "@univerjs/core": "workspace:*",
+ "@univerjs/design": "workspace:*",
+ "@univerjs/engine-render": "workspace:*",
+ "@univerjs/icons": "^0.1.77",
+ "@univerjs/shared": "workspace:*",
+ "@univerjs/sheets": "workspace:*",
+ "@univerjs/sheets-ui": "workspace:*",
+ "@univerjs/ui": "workspace:*",
+ "clsx": "^2.1.1",
+ "less": "^4.2.0",
+ "react": "18.3.1",
+ "rxjs": "^7.8.1",
+ "typescript": "^5.5.4",
+ "vite": "^5.4.1",
+ "vitest": "^2.0.5"
+ },
+ "univerSpace": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./*": {
+ "import": "./lib/es/*",
+ "require": "./lib/cjs/*",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./lib/*": "./lib/*",
+ "./locale/*": "./lib/locale/*.json"
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/commands/operations/operation.ts b/packages/sheets-crosshair-highlight/src/commands/operations/operation.ts
new file mode 100644
index 0000000000..14b22800d5
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/commands/operations/operation.ts
@@ -0,0 +1,91 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { CommandType, type IOperation } from '@univerjs/core';
+import { SheetsCrosshairHighlightService } from '../../services/crosshair.service';
+
+/**
+ * A {@link CommandType.OPERATION} to toggle the crosshair highlight.
+ */
+export const ToggleCrosshairHighlightOperation: IOperation = {
+ id: 'sheet.operation.toggle-crosshair-highlight',
+ type: CommandType.OPERATION,
+ handler(accessor) {
+ const service = accessor.get(SheetsCrosshairHighlightService);
+ const turnedOn = service.enabled;
+ service.setEnabled(!turnedOn);
+ return true;
+ },
+};
+
+/**
+ * A {@link CommandType.OPERATION} to set the crosshair highlight color.
+ * @property {string} value - The color value to set.
+ */
+export interface ISetCrosshairHighlightColorOperationParams {
+ value: string;
+}
+
+/**
+ * A {@link CommandType.OPERATION} to set the crosshair highlight color. It the crosshair highlight is not enabled,
+ * it will be enabled.
+ *
+ * Its params {@link ISetCrosshairHighlightColorOperationParams} contains the color value to set as and is required.
+ */
+export const SetCrosshairHighlightColorOperation: IOperation<ISetCrosshairHighlightColorOperationParams> = {
+ id: 'sheet.operation.set-crosshair-highlight-color',
+ type: CommandType.OPERATION,
+ handler(accessor, { value }) {
+ const service = accessor.get(SheetsCrosshairHighlightService);
+ if (!service.enabled) service.setEnabled(true);
+ service.setColor(value);
+ return true;
+ },
+};
+
+/**
+ * A {@link CommandType.OPERATION} to enable the crosshair highlight.
+ */
+export const EnableCrosshairHighlightOperation: IOperation = {
+ id: 'sheet.operation.enable-crosshair-highlight',
+ type: CommandType.OPERATION,
+ handler(accessor) {
+ const service = accessor.get(SheetsCrosshairHighlightService);
+ if (service.enabled) {
+ return false;
+ }
+
+ service.setEnabled(true);
+ return true;
+ },
+};
+
+/**
+ * A {@link CommandType.OPERATION} to disable the crosshair highlight.
+ */
+export const DisableCrosshairHighlightOperation: IOperation = {
+ id: 'sheet.operation.disable-crosshair-highlight',
+ type: CommandType.OPERATION,
+ handler(accessor) {
+ const service = accessor.get(SheetsCrosshairHighlightService);
+ if (!service.enabled) {
+ return false;
+ }
+
+ service.setEnabled(false);
+ return true;
+ },
+};
diff --git a/packages/sheets-ui/src/basics/const/index.ts b/packages/sheets-crosshair-highlight/src/const.ts
similarity index 90%
rename from packages/sheets-ui/src/basics/const/index.ts
rename to packages/sheets-crosshair-highlight/src/const.ts
index 82f7b0bf5f..c5ce95f358 100644
--- a/packages/sheets-ui/src/basics/const/index.ts
+++ b/packages/sheets-crosshair-highlight/src/const.ts
@@ -14,5 +14,4 @@
* limitations under the License.
*/
-export * from './plugin-name';
-export * from './ui-name.ts';
+export const SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX = 1;
diff --git a/packages/sheets-crosshair-highlight/src/controllers/crosshair.controller.tsx b/packages/sheets-crosshair-highlight/src/controllers/crosshair.controller.tsx
new file mode 100644
index 0000000000..aeeb77fe4b
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/controllers/crosshair.controller.tsx
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Disposable, ICommandService, Inject, Injector } from '@univerjs/core';
+import { ComponentManager, IMenuService } from '@univerjs/ui';
+import { CrossHighlightingSingle } from '@univerjs/icons';
+import {
+ DisableCrosshairHighlightOperation,
+ EnableCrosshairHighlightOperation,
+ SetCrosshairHighlightColorOperation,
+ ToggleCrosshairHighlightOperation,
+} from '../commands/operations/operation';
+import { CrosshairOverlay } from '../views/components/CrosshairHighlight';
+import { CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT, CrosshairHighlightMenuItemFactory } from './crosshair.menu';
+
+export class SheetsCrosshairHighlightController extends Disposable {
+ constructor(
+ @Inject(Injector) private readonly _injector: Injector,
+ @Inject(ComponentManager) private readonly _componentMgr: ComponentManager,
+ @IMenuService private readonly _menuService: IMenuService,
+ @ICommandService private readonly _cmdSrv: ICommandService
+ ) {
+ super();
+
+ this._initCommands();
+ this._initMenus();
+ this._initComponents();
+ }
+
+ private _initCommands(): void {
+ ([
+ ToggleCrosshairHighlightOperation,
+ SetCrosshairHighlightColorOperation,
+ EnableCrosshairHighlightOperation,
+ DisableCrosshairHighlightOperation,
+ ]).forEach((c) => this._cmdSrv.registerCommand(c));
+ }
+
+ private _initMenus(): void {
+ this._menuService.addMenuItem(this._injector.invoke(CrosshairHighlightMenuItemFactory), {});
+ }
+
+ private _initComponents(): void {
+ this._componentMgr.register(CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT, CrosshairOverlay);
+ this._componentMgr.register('CrossHighlightingSingle', CrossHighlightingSingle);
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/controllers/crosshair.menu.ts b/packages/sheets-crosshair-highlight/src/controllers/crosshair.menu.ts
new file mode 100644
index 0000000000..3cd974586a
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/controllers/crosshair.menu.ts
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { type IAccessor, UniverInstanceType } from '@univerjs/core';
+import { getMenuHiddenObservable, type IMenuSelectorItem, MenuItemType } from '@univerjs/ui';
+import { SheetMenuPosition } from '@univerjs/sheets-ui';
+import { SheetsCrosshairHighlightService } from '../services/crosshair.service';
+import { SetCrosshairHighlightColorOperation, ToggleCrosshairHighlightOperation } from '../commands/operations/operation';
+
+export const CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT = 'CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT';
+
+export function CrosshairHighlightMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string> {
+ const crosshairHighlightService = accessor.get(SheetsCrosshairHighlightService);
+
+ return {
+ id: ToggleCrosshairHighlightOperation.id,
+ tooltip: 'crosshair.button.tooltip',
+ type: MenuItemType.BUTTON_SELECTOR,
+ icon: 'CrossHighlightingSingle',
+ selections: [
+ {
+ label: {
+ name: CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT,
+ hoverable: false,
+ },
+ },
+ ],
+ selectionsCommandId: SetCrosshairHighlightColorOperation.id,
+ activated$: crosshairHighlightService.enabled$,
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
+ positions: [SheetMenuPosition.SHEET_FOOTER],
+ };
+}
diff --git a/packages/sheets-crosshair-highlight/src/index.ts b/packages/sheets-crosshair-highlight/src/index.ts
new file mode 100644
index 0000000000..102274a3c0
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/index.ts
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { UniverSheetsCrosshairHighlightPlugin } from './plugin';
+export { CROSSHAIR_HIGHLIGHT_COLORS } from './services/crosshair.service';
+
+// #region commands
+
+export {
+ ToggleCrosshairHighlightOperation,
+ DisableCrosshairHighlightOperation,
+ EnableCrosshairHighlightOperation,
+ SetCrosshairHighlightColorOperation,
+ type ISetCrosshairHighlightColorOperationParams,
+} from './commands/operations/operation';
+
+// #endregion
diff --git a/packages/sheets-crosshair-highlight/src/locale/en-US.ts b/packages/sheets-crosshair-highlight/src/locale/en-US.ts
new file mode 100644
index 0000000000..1a90f12432
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/locale/en-US.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type zhCN from './zh-CN';
+
+const locale: typeof zhCN = {
+ crosshair: {
+ button: {
+ tooltip: 'Crosshair Highlight',
+ },
+ },
+};
+
+export default locale;
diff --git a/packages/sheets-crosshair-highlight/src/locale/ru-RU.ts b/packages/sheets-crosshair-highlight/src/locale/ru-RU.ts
new file mode 100644
index 0000000000..82342d9f61
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/locale/ru-RU.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type zhCN from './zh-CN';
+
+const locale: typeof zhCN = {
+ crosshair: {
+ button: {
+ tooltip: 'Перекрестный выделение',
+ },
+ },
+};
+
+export default locale;
diff --git a/packages/sheets-crosshair-highlight/src/locale/vi-VN.ts b/packages/sheets-crosshair-highlight/src/locale/vi-VN.ts
new file mode 100644
index 0000000000..955190de3c
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/locale/vi-VN.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type zhCN from './zh-CN';
+
+const locale: typeof zhCN = {
+ crosshair: {
+ button: {
+ tooltip: 'Đánh dấu chéo',
+ },
+ },
+};
+
+export default locale;
diff --git a/packages/sheets-crosshair-highlight/src/locale/zh-CN.ts b/packages/sheets-crosshair-highlight/src/locale/zh-CN.ts
new file mode 100644
index 0000000000..b00923a5c8
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/locale/zh-CN.ts
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const locale = {
+ crosshair: {
+ button: {
+ tooltip: '十字高亮',
+ },
+ },
+};
+
+export default locale;
diff --git a/packages/sheets-crosshair-highlight/src/locale/zh-TW.ts b/packages/sheets-crosshair-highlight/src/locale/zh-TW.ts
new file mode 100644
index 0000000000..4f4e2b9ad3
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/locale/zh-TW.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type zhCN from './zh-CN';
+
+const locale: typeof zhCN = {
+ crosshair: {
+ button: {
+ tooltip: '十字高亮',
+ },
+ },
+};
+
+export default locale;
diff --git a/packages/sheets-crosshair-highlight/src/plugin.ts b/packages/sheets-crosshair-highlight/src/plugin.ts
new file mode 100644
index 0000000000..b87f1beee5
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/plugin.ts
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Dependency } from '@univerjs/core';
+import { Inject, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
+import { IRenderManagerService } from '@univerjs/engine-render';
+import { SheetsCrosshairHighlightController } from './controllers/crosshair.controller';
+import { SheetsCrosshairHighlightService } from './services/crosshair.service';
+import { SheetCrosshairHighlightRenderController } from './views/widgets/crosshair-highlight.render-controller';
+
+export class UniverSheetsCrosshairHighlightPlugin extends Plugin {
+ constructor(
+ @Inject(Injector) protected readonly _injector: Injector,
+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService
+ ) {
+ super();
+ }
+
+ override onStarting(): void {
+ ([
+ [SheetsCrosshairHighlightService],
+ [SheetsCrosshairHighlightController],
+ ] as Dependency[]).forEach((d) => this._injector.add(d));
+ }
+
+ override onReady(): void {
+ ([
+ [SheetCrosshairHighlightRenderController],
+ ] as Dependency[]).forEach((d) => this._injector.add(d));
+ this._injector.get(SheetsCrosshairHighlightController);
+ this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, [SheetCrosshairHighlightRenderController] as Dependency);
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/services/crosshair.service.ts b/packages/sheets-crosshair-highlight/src/services/crosshair.service.ts
new file mode 100644
index 0000000000..df0859e791
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/services/crosshair.service.ts
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Disposable } from '@univerjs/core';
+import { BehaviorSubject } from 'rxjs';
+
+// Currently these colors are hard-coded, but in the future they could be customizable.
+export const CROSSHAIR_HIGHLIGHT_COLORS = [
+ 'rgba(158, 109, 227, 0.3)',
+ 'rgba(254, 75, 75, 0.3)',
+ 'rgba(255, 140, 81, 0.3)',
+ 'rgba(164, 220, 22, 0.3)',
+ 'rgba(45, 174, 255, 0.3)',
+ 'rgba(58, 96, 247, 0.3)',
+ 'rgba(242, 72, 166, 0.3)',
+ 'rgba(153, 153, 153, 0.3)',
+ 'rgba(158, 109, 227, 0.15)',
+ 'rgba(254, 75, 75, 0.15)',
+ 'rgba(255, 140, 81, 0.15)',
+ 'rgba(164, 220, 22, 0.15)',
+ 'rgba(45, 174, 255, 0.15)',
+ 'rgba(58, 96, 247, 0.15)',
+ 'rgba(242, 72, 166, 0.15)',
+ 'rgba(153, 153, 153, 0.15)',
+];
+
+export class SheetsCrosshairHighlightService extends Disposable {
+ private readonly _enabled$ = new BehaviorSubject<boolean>(false);
+ readonly enabled$ = this._enabled$.asObservable();
+ get enabled(): boolean { return this._enabled$.getValue(); }
+
+ private readonly _color$ = new BehaviorSubject<string>(CROSSHAIR_HIGHLIGHT_COLORS[0]);
+ readonly color$ = this._color$.asObservable();
+ get color(): string { return this._color$.getValue(); }
+
+ override dispose(): void {
+ this._enabled$.complete();
+ }
+
+ setEnabled(value: boolean): void {
+ this._enabled$.next(value);
+ }
+
+ setColor(value: string): void {
+ this._color$.next(value);
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/util.ts b/packages/sheets-crosshair-highlight/src/util.ts
new file mode 100644
index 0000000000..b03e062d6b
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/util.ts
@@ -0,0 +1,74 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { IRange } from '@univerjs/core';
+import { RANGE_TYPE, Rectangle } from '@univerjs/core';
+
+export class CrossHairRangeCollection {
+ private _selectedRanges: IRange[] = [];
+ private _ranges: IRange[] = [];
+
+ public addRange(range: IRange) {
+ if (range.rangeType === RANGE_TYPE.COLUMN || range.rangeType === RANGE_TYPE.ROW || range.rangeType === RANGE_TYPE.ALL) {
+ return;
+ }
+ const intersects = this._getIntersects(range);
+
+ const splitRanges = this._getSplitRanges(range, intersects);
+ if (splitRanges.length > 0) {
+ this._ranges.push(...splitRanges);
+ }
+ }
+
+ public setSelectedRanges(selectedRange: IRange[]) {
+ this._selectedRanges = selectedRange;
+ }
+
+ private _getSplitRanges(range: IRange, intersects: IRange[]) {
+ let splitRanges: IRange[] = [range];
+ for (const intersect of intersects.concat(this._selectedRanges)) {
+ const newRanges = [];
+ for (const splitRange of splitRanges) {
+ const split = Rectangle.subtract(splitRange, intersect);
+ if (split && split.length > 0) {
+ newRanges.push(...split);
+ }
+ }
+ splitRanges = newRanges;
+ }
+ return splitRanges.filter((range) => range.startRow <= range.endRow && range.startColumn <= range.endColumn);
+ }
+
+ private _getIntersects(addRange: IRange) {
+ const intersects = [];
+ for (const range of this._ranges) {
+ const intersect = Rectangle.getIntersects(range, addRange);
+ if (intersect) {
+ intersects.push(intersect);
+ }
+ }
+ return intersects;
+ }
+
+ getRanges() {
+ return this._ranges;
+ }
+
+ reset() {
+ this._ranges = [];
+ this._selectedRanges = [];
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/views/components/CrosshairHighlight.tsx b/packages/sheets-crosshair-highlight/src/views/components/CrosshairHighlight.tsx
new file mode 100644
index 0000000000..2c8e333672
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/views/components/CrosshairHighlight.tsx
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useDependency, useObservable } from '@univerjs/core';
+import React, { useCallback } from 'react';
+import clsx from 'clsx';
+
+import { CROSSHAIR_HIGHLIGHT_COLORS, SheetsCrosshairHighlightService } from '../../services/crosshair.service';
+
+import styles from './index.module.less';
+
+export interface ICrosshairOverlayProps {
+ onChange?: (value: string) => void;
+}
+
+export function CrosshairOverlay(props: ICrosshairOverlayProps) {
+ const { onChange } = props;
+
+ const crosshairSrv = useDependency(SheetsCrosshairHighlightService);
+
+ const currentColor = useObservable(crosshairSrv.color$);
+
+ const handleColorPicked = useCallback((color: string) => {
+ onChange?.(color);
+ }, [onChange]);
+
+ return (
+ <div className={styles.crosshairHighlightOverlay}>
+ {CROSSHAIR_HIGHLIGHT_COLORS.map((color: string) => {
+ return (
+ <div
+ key={color}
+ className={clsx(styles.crosshairHighlightItem, {
+ [styles.crosshairHighlightItemSelected]: color === currentColor,
+ })}
+ style={{ backgroundColor: color }}
+ onClick={() => handleColorPicked(color)}
+ >
+ </div>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/packages/sheets-crosshair-highlight/src/views/components/index.module.less b/packages/sheets-crosshair-highlight/src/views/components/index.module.less
new file mode 100644
index 0000000000..e2ec66c240
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/views/components/index.module.less
@@ -0,0 +1,19 @@
+.crosshair-highlight-overlay {
+ display: grid;
+ row-gap: 12px;
+ column-gap: 8px;
+ grid-template-columns: repeat(8, 20px);
+}
+
+.crosshair-highlight-item {
+ width: 20px;
+ height: 20px;
+ box-sizing: border-box;
+ border-radius: 4px;
+ border: 0.5px solid rgb(var(--grey-400));
+
+ &-selected {
+ outline: 1.5px solid rgb(var(--primary-color));
+ outline-offset: 1.5px;
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/views/widgets/crosshair-highlight-shape.ts b/packages/sheets-crosshair-highlight/src/views/widgets/crosshair-highlight-shape.ts
new file mode 100644
index 0000000000..618ce71759
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/views/widgets/crosshair-highlight-shape.ts
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { IRgbColor, Nullable } from '@univerjs/core';
+import type { IShapeProps, UniverRenderingContext } from '@univerjs/engine-render';
+import { Rect, Shape } from '@univerjs/engine-render';
+
+export interface ISheetCrossHairHighlightShapeProps extends IShapeProps {
+ color: IRgbColor;
+}
+
+export class SheetCrossHairHighlightShape extends Shape<ISheetCrossHairHighlightShapeProps> {
+ // protected _showHighLight = false;
+ protected _color: Nullable<IRgbColor>;
+
+ constructor(key?: string, props?: ISheetCrossHairHighlightShapeProps) {
+ super(key, props);
+
+ if (props) {
+ this.setShapeProps(props);
+ }
+ }
+
+ setShapeProps(props: Partial<ISheetCrossHairHighlightShapeProps>): void {
+ if (typeof props.color !== 'undefined') {
+ this._color = props.color;
+ }
+
+ this.transformByState({
+ width: props.width!,
+ height: props.height!,
+ });
+ }
+
+ protected override _draw(ctx: CanvasRenderingContext2D): void {
+ const color = `rgba(${this._color!.r}, ${this._color!.g}, ${this._color!.b}, ${this._color!.a})`;
+
+ Rect.drawWith(ctx as UniverRenderingContext, {
+ width: this.width,
+ height: this.height,
+ fill: color,
+ stroke: undefined,
+ strokeWidth: 0,
+ evented: false,
+ });
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/views/widgets/crosshair-highlight.render-controller.ts b/packages/sheets-crosshair-highlight/src/views/widgets/crosshair-highlight.render-controller.ts
new file mode 100644
index 0000000000..cb5b634089
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/views/widgets/crosshair-highlight.render-controller.ts
@@ -0,0 +1,179 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { IRange, Nullable, Workbook, Worksheet } from '@univerjs/core';
+import { ColorKit, Disposable, IContextService, Inject, RANGE_TYPE } from '@univerjs/core';
+
+import type { IRenderContext, IRenderModule, Scene, SpreadsheetSkeleton } from '@univerjs/engine-render';
+import { getCoordByCell, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
+import type { ISelectionWithStyle } from '@univerjs/sheets';
+import { DISABLE_NORMAL_SELECTIONS, IRefSelectionsService, SheetsSelectionsService } from '@univerjs/sheets';
+import { combineLatest, merge, startWith, tap } from 'rxjs';
+import { SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX } from '../../const';
+import { CrossHairRangeCollection } from '../../util';
+import { SheetsCrosshairHighlightService } from '../../services/crosshair.service';
+import { SheetCrossHairHighlightShape } from './crosshair-highlight-shape';
+
+export class SheetCrosshairHighlightRenderController extends Disposable implements IRenderModule {
+ private _shapes: SheetCrossHairHighlightShape[] = [];
+ private _rangeCollection = new CrossHairRangeCollection();
+ private _color: string = 'rgba(255,0,0,0.5)';
+
+ constructor(
+ private readonly _context: IRenderContext<Workbook>,
+ @Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,
+ @Inject(SheetsSelectionsService) private readonly _sheetsSelectionsService: SheetsSelectionsService,
+ @Inject(SheetsCrosshairHighlightService) private readonly _sheetsCrosshairHighlightService: SheetsCrosshairHighlightService,
+ @Inject(IContextService) private readonly _contextService: IContextService,
+ @IRefSelectionsService private readonly _refSelectionsService: SheetsSelectionsService
+ ) {
+ super();
+
+ this._initRenderListener();
+ }
+
+ private _transformSelection(selectionData: Nullable<ISelectionWithStyle[]>, sheet: Worksheet): void {
+ if (!selectionData) {
+ return;
+ }
+ const rowCount = sheet.getRowCount();
+ const columnCount = sheet.getColumnCount();
+ const ranges = [];
+ // remove the selection that covers the whole row or column
+ for (const selection of selectionData) {
+ const { startRow, endRow, startColumn, endColumn } = selection.range;
+ if (endRow - startRow + 1 === rowCount || endColumn - startColumn + 1 === columnCount) {
+ continue;
+ }
+ ranges.push(selection.range);
+ }
+
+ this._rangeCollection.setSelectedRanges(ranges);
+ for (const range of ranges) {
+ this.addSelection(range, sheet);
+ }
+ }
+
+ private _initRenderListener(): void {
+ const workbook = this._context.unit;
+ this.disposeWithMe(combineLatest([
+ this._contextService.subscribeContextValue$(DISABLE_NORMAL_SELECTIONS).pipe(startWith(false)),
+ this._sheetSkeletonManagerService.currentSkeleton$,
+ this._sheetsCrosshairHighlightService.enabled$,
+ this._sheetsCrosshairHighlightService.color$.pipe(tap((color) => (this._color = color))),
+ merge(this._sheetsSelectionsService.selectionMoveStart$, this._sheetsSelectionsService.selectionMoving$, this._sheetsSelectionsService.selectionMoveEnd$),
+ merge(this._refSelectionsService.selectionMoveStart$, this._refSelectionsService.selectionMoving$, this._refSelectionsService.selectionMoveEnd$),
+ ]).subscribe(([normalSelDisabled, _, enabled, _color, normalSelections, refSelection]) => {
+ this._clear();
+
+ if (!enabled) return;
+ const selections = normalSelDisabled ? refSelection : normalSelections;
+
+ this._rangeCollection.reset();
+ this._transformSelection(selections, workbook.getActiveSheet());
+ this.render(this._rangeCollection.getRanges());
+ }));
+ }
+
+ addSelection(range: IRange, sheet: Worksheet): void {
+ if (range.rangeType === RANGE_TYPE.COLUMN || range.rangeType === RANGE_TYPE.ROW || range.rangeType === RANGE_TYPE.ALL) {
+ return;
+ }
+ const maxRow = sheet.getRowCount();
+ const maxColumn = sheet.getColumnCount();
+ const { startRow, endRow, startColumn, endColumn } = range;
+ const left = {
+ startRow,
+ endRow,
+ startColumn: 0,
+ endColumn: startColumn - 1,
+ };
+ const right = {
+ startRow,
+ endRow,
+ startColumn: endColumn + 1,
+ endColumn: maxColumn,
+ };
+ const top = {
+ startRow: 0,
+ endRow: startRow - 1,
+ startColumn,
+ endColumn,
+ };
+ const bottom = {
+ startRow: endRow + 1,
+ endRow: maxRow,
+ startColumn,
+ endColumn,
+ };
+
+ for (const range of [left, right, top, bottom]) {
+ // test if the range is valid
+ if (range.startRow <= range.endRow && range.startColumn <= range.endColumn) {
+ this._rangeCollection.addRange(range);
+ }
+ }
+ }
+
+ private _clear(): void {
+ this._shapes.forEach((shape) => {
+ shape.dispose();
+ });
+ this._shapes = [];
+ }
+
+ private _addShapes(range: IRange, index: number, scene: Scene, skeleton: SpreadsheetSkeleton): void {
+ const { startRow, endRow, startColumn, endColumn } = range;
+ const startPosition = getCoordByCell(startRow, startColumn, scene, skeleton);
+ const endPosition = getCoordByCell(endRow, endColumn, scene, skeleton);
+ const { startX, startY } = startPosition;
+ const { endX, endY } = endPosition;
+ const width = endX - startX;
+ const height = endY - startY;
+
+ const shapeProps = {
+ left: startX,
+ top: startY,
+ color: new ColorKit(this._color).toRgb(),
+ width,
+ height,
+ zIndex: SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX,
+ evented: false,
+ };
+ const currentShapes = new SheetCrossHairHighlightShape(`crosshair-${index}`, shapeProps);
+ this._shapes.push(currentShapes);
+ scene.addObject(currentShapes);
+ }
+
+ render(ranges: IRange[]): void {
+ const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
+ if (!skeleton) {
+ return;
+ }
+
+ const { scene } = this._context;
+ this._clear();
+ for (let i = 0; i < ranges.length; i++) {
+ const range = ranges[i];
+ this._addShapes(range, i, scene, skeleton);
+ }
+ scene.makeDirty(true);
+ }
+
+ override async dispose(): Promise<void> {
+ super.dispose();
+ }
+}
diff --git a/packages/sheets-crosshair-highlight/src/vite-env.d.ts b/packages/sheets-crosshair-highlight/src/vite-env.d.ts
new file mode 100644
index 0000000000..11f02fe2a0
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/src/vite-env.d.ts
@@ -0,0 +1 @@
+/// <reference types="vite/client" />
diff --git a/packages/sheets-crosshair-highlight/tsconfig.json b/packages/sheets-crosshair-highlight/tsconfig.json
new file mode 100644
index 0000000000..d676ad2a20
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "@univerjs/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "references": [{ "path": "./tsconfig.node.json" }],
+ "include": ["src"]
+}
diff --git a/packages/sheets-crosshair-highlight/tsconfig.node.json b/packages/sheets-crosshair-highlight/tsconfig.node.json
new file mode 100644
index 0000000000..e53dac8868
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/tsconfig.node.json
@@ -0,0 +1,4 @@
+{
+ "extends": "@univerjs/shared/tsconfigs/node",
+ "include": ["vite.config.ts"]
+}
diff --git a/packages/sheets-crosshair-highlight/vite.config.ts b/packages/sheets-crosshair-highlight/vite.config.ts
new file mode 100644
index 0000000000..925b530b4d
--- /dev/null
+++ b/packages/sheets-crosshair-highlight/vite.config.ts
@@ -0,0 +1,12 @@
+import createViteConfig from '@univerjs/shared/vite';
+import pkg from './package.json';
+
+export default ({ mode }) => createViteConfig({}, {
+ mode,
+ pkg,
+ features: {
+ react: false,
+ css: true,
+ dom: true,
+ },
+});
diff --git a/packages/sheets-data-validation/package.json b/packages/sheets-data-validation/package.json
index 86a739b96f..4c1f9e373f 100644
--- a/packages/sheets-data-validation/package.json
+++ b/packages/sheets-data-validation/package.json
@@ -78,7 +78,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/protocol": "0.1.39-alpha.9"
},
"devDependencies": {
diff --git a/packages/sheets-drawing-ui/package.json b/packages/sheets-drawing-ui/package.json
index 3a5e8ebac3..a5e1cf5414 100644
--- a/packages/sheets-drawing-ui/package.json
+++ b/packages/sheets-drawing-ui/package.json
@@ -77,7 +77,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages/sheets-filter-ui/package.json b/packages/sheets-filter-ui/package.json
index e5072d20de..6a89bde083 100644
--- a/packages/sheets-filter-ui/package.json
+++ b/packages/sheets-filter-ui/package.json
@@ -76,7 +76,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"rc-virtual-list": "^3.14.5"
},
"devDependencies": {
diff --git a/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts b/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts
index ff6bf76da1..b81951ea8d 100644
--- a/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts
+++ b/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts
@@ -444,7 +444,7 @@ export class SheetFindModel extends FindModel {
private _disposeHighlights(): void {
this._highlightShapes.forEach((shape) => {
- shape.getScene().makeDirty();
+ shape.getScene()?.makeDirty();
shape.dispose();
});
diff --git a/packages/sheets-formula/package.json b/packages/sheets-formula/package.json
index 9ddea7fa33..9cd787d05c 100644
--- a/packages/sheets-formula/package.json
+++ b/packages/sheets-formula/package.json
@@ -77,7 +77,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@types/react": "^18.3.3",
diff --git a/packages/sheets-hyper-link-ui/package.json b/packages/sheets-hyper-link-ui/package.json
index 32e598b011..30a6c60a69 100644
--- a/packages/sheets-hyper-link-ui/package.json
+++ b/packages/sheets-hyper-link-ui/package.json
@@ -80,7 +80,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/sheets-hyper-link": "workspace:*"
},
"devDependencies": {
diff --git a/packages/sheets-numfmt/package.json b/packages/sheets-numfmt/package.json
index 6df4b97ac3..282e082de7 100644
--- a/packages/sheets-numfmt/package.json
+++ b/packages/sheets-numfmt/package.json
@@ -76,7 +76,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@types/react": "^18.3.3",
diff --git a/packages/sheets-sort-ui/package.json b/packages/sheets-sort-ui/package.json
index 9aa9e9bd02..a84f565cd1 100644
--- a/packages/sheets-sort-ui/package.json
+++ b/packages/sheets-sort-ui/package.json
@@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"rc-virtual-list": "^3.14.5"
},
"devDependencies": {
diff --git a/packages/sheets-thread-comment/package.json b/packages/sheets-thread-comment/package.json
index 53a78370fb..afb7c29887 100644
--- a/packages/sheets-thread-comment/package.json
+++ b/packages/sheets-thread-comment/package.json
@@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages/sheets-ui/package.json b/packages/sheets-ui/package.json
index 274e1f5e92..b445a23229 100644
--- a/packages/sheets-ui/package.json
+++ b/packages/sheets-ui/package.json
@@ -77,7 +77,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/protocol": "0.1.39-alpha.9"
},
"devDependencies": {
diff --git a/packages/sheets-ui/src/commands/operations/sheet-permission-open-dialog.operation.ts b/packages/sheets-ui/src/commands/operations/sheet-permission-open-dialog.operation.ts
index 24cf5080bf..80b929138c 100644
--- a/packages/sheets-ui/src/commands/operations/sheet-permission-open-dialog.operation.ts
+++ b/packages/sheets-ui/src/commands/operations/sheet-permission-open-dialog.operation.ts
@@ -17,7 +17,7 @@
import type { ICommand } from '@univerjs/core';
import { CommandType } from '@univerjs/core';
import { IDialogService } from '@univerjs/ui';
-import { UNIVER_SHEET_PERMISSION_DIALOG, UNIVER_SHEET_PERMISSION_DIALOG_ID } from '../../basics/const/permission';
+import { UNIVER_SHEET_PERMISSION_DIALOG, UNIVER_SHEET_PERMISSION_DIALOG_ID } from '../../consts/permission';
export const SheetPermissionOpenDialogOperation: ICommand = {
type: CommandType.OPERATION,
diff --git a/packages/sheets-ui/src/commands/operations/sheet-permission-open-panel.operation.ts b/packages/sheets-ui/src/commands/operations/sheet-permission-open-panel.operation.ts
index ac4d389c9f..0f5f0bcf97 100644
--- a/packages/sheets-ui/src/commands/operations/sheet-permission-open-panel.operation.ts
+++ b/packages/sheets-ui/src/commands/operations/sheet-permission-open-panel.operation.ts
@@ -19,7 +19,7 @@ import { CommandType } from '@univerjs/core';
import { ISidebarService } from '@univerjs/ui';
import { SheetPermissionPanelModel } from '../../services/permission/sheet-permission-panel.model';
import { SheetPermissionUserManagerService } from '../../services/permission/sheet-permission-user-list.service';
-import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../basics/const/permission';
+import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../consts/permission';
export interface IPermissionOpenPanelParam {
fromSheetBar?: boolean;
diff --git a/packages/sheets-ui/src/basics/const/permission.ts b/packages/sheets-ui/src/consts/permission.ts
similarity index 99%
rename from packages/sheets-ui/src/basics/const/permission.ts
rename to packages/sheets-ui/src/consts/permission.ts
index 502ab20dc4..7f0a2818de 100644
--- a/packages/sheets-ui/src/basics/const/permission.ts
+++ b/packages/sheets-ui/src/consts/permission.ts
@@ -17,16 +17,10 @@
import { UnitAction } from '@univerjs/protocol';
export const UNIVER_SHEET_PERMISSION_PLUGIN_NAME = 'UNIVER_SHEET_PERMISSION_PLUGIN';
-
export const UNIVER_SHEET_PERMISSION_PANEL = 'UNIVER_SHEET_PERMISSION_PANEL';
-
export const UNIVER_SHEET_PERMISSION_PANEL_FOOTER = 'UNIVER_SHEET_PERMISSION_PANEL_FOOTER';
-
export const UNIVER_SHEET_PERMISSION_USER_DIALOG = 'UNIVER_SHEET_PERMISSION_USER_DIALOG';
-
export const UNIVER_SHEET_PERMISSION_DIALOG = 'UNIVER_SHEET_PERMISSION_DIALOG';
-
-// id
export const UNIVER_SHEET_PERMISSION_USER_DIALOG_ID = 'UNIVER_SHEET_PERMISSION_USER_DIALOG_ID';
export const UNIVER_SHEET_PERMISSION_DIALOG_ID = 'UNIVER_SHEET_PERMISSION_DIALOG_ID';
diff --git a/packages/sheets-ui/src/basics/const/plugin-name.ts b/packages/sheets-ui/src/consts/plugin-name.ts
similarity index 100%
rename from packages/sheets-ui/src/basics/const/plugin-name.ts
rename to packages/sheets-ui/src/consts/plugin-name.ts
diff --git a/packages/sheets-ui/src/basics/const/ui-name.ts b/packages/sheets-ui/src/consts/ui-name.ts
similarity index 94%
rename from packages/sheets-ui/src/basics/const/ui-name.ts
rename to packages/sheets-ui/src/consts/ui-name.ts
index 1ce8451c9e..c19c165b49 100644
--- a/packages/sheets-ui/src/basics/const/ui-name.ts
+++ b/packages/sheets-ui/src/consts/ui-name.ts
@@ -16,4 +16,5 @@
export enum SheetsUIPart {
FILTER_PANEL_EMBED_POINT = 'filter-panel-embed-point',
+ SHEETS_FOOTER = 'sheets-footer',
}
diff --git a/packages/sheets-ui/src/controllers/menu/menu.ts b/packages/sheets-ui/src/controllers/menu/menu.ts
index f900b40e1f..33930afb0f 100644
--- a/packages/sheets-ui/src/controllers/menu/menu.ts
+++ b/packages/sheets-ui/src/controllers/menu/menu.ts
@@ -122,6 +122,7 @@ export enum SheetMenuPosition {
ROW_HEADER_CONTEXT_MENU = 'ROW_HEADER_CONTEXT_MENU',
COL_HEADER_CONTEXT_MENU = 'COL_HEADER_CONTEXT_MENU',
SHEET_BAR = 'SHEET_BAR',
+ SHEET_FOOTER = 'SHEET_FOOTER',
}
export function FormatPainterMenuItemFactory(accessor: IAccessor): IMenuButtonItem {
diff --git a/packages/sheets-ui/src/controllers/menu/permission.menu.ts b/packages/sheets-ui/src/controllers/menu/permission.menu.ts
index ae70bcbf15..30ebf9222f 100644
--- a/packages/sheets-ui/src/controllers/menu/permission.menu.ts
+++ b/packages/sheets-ui/src/controllers/menu/permission.menu.ts
@@ -20,7 +20,7 @@ import type { IAccessor } from '@univerjs/core';
import { UniverInstanceType } from '@univerjs/core';
import { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, DeleteRangeProtectionFromContextMenuCommand, SetRangeProtectionFromContextMenuCommand, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand } from '../../commands/commands/range-protection.command';
-import { permissionLockIconKey, permissionMenuIconKey } from '../../basics/const/permission';
+import { permissionLockIconKey, permissionMenuIconKey } from '../../consts/permission';
import { ChangeSheetProtectionFromSheetBarCommand, DeleteWorksheetProtectionFormSheetBarCommand } from '../../commands/commands/worksheet-protection.command';
import { getAddPermissionDisableBase$, getAddPermissionFromSheetBarDisable$, getAddPermissionHidden$, getEditPermissionHidden$, getPermissionDisableBase$, getRemovePermissionDisable$, getRemovePermissionFromSheetBarDisable$, getSetPermissionFromSheetBarDisable$, getViewPermissionDisable$ } from './permission-menu-util';
import { SheetMenuPosition } from './menu';
diff --git a/packages/sheets-ui/src/controllers/permission/sheet-permission-render.controller.ts b/packages/sheets-ui/src/controllers/permission/sheet-permission-render.controller.ts
index 6ff3143e98..b72edf82f0 100644
--- a/packages/sheets-ui/src/controllers/permission/sheet-permission-render.controller.ts
+++ b/packages/sheets-ui/src/controllers/permission/sheet-permission-render.controller.ts
@@ -21,7 +21,7 @@ import { CheckMarkSingle, DeleteSingle, LockSingle, ProtectSingle, WriteSingle }
import { RangeProtectionRuleModel } from '@univerjs/sheets';
import type { IRenderContext, IRenderModule, Spreadsheet } from '@univerjs/engine-render';
import { merge, throttleTime } from 'rxjs';
-import { permissionCheckIconKey, permissionDeleteIconKey, permissionEditIconKey, permissionLockIconKey, permissionMenuIconKey, UNIVER_SHEET_PERMISSION_DIALOG, UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER, UNIVER_SHEET_PERMISSION_USER_DIALOG } from '../../basics/const/permission';
+import { permissionCheckIconKey, permissionDeleteIconKey, permissionEditIconKey, permissionLockIconKey, permissionMenuIconKey, UNIVER_SHEET_PERMISSION_DIALOG, UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER, UNIVER_SHEET_PERMISSION_USER_DIALOG } from '../../consts/permission';
import { SheetPermissionDialog, SheetPermissionPanel, SheetPermissionPanelFooter, SheetPermissionUserDialog } from '../../views/permission';
import { UNIVER_SHEET_PERMISSION_ALERT_DIALOG } from '../../views/permission/error-msg-dialog/interface';
import { AlertDialog } from '../../views/permission/error-msg-dialog';
diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.ts
index d246a24269..d7c2afd3ad 100644
--- a/packages/sheets-ui/src/index.ts
+++ b/packages/sheets-ui/src/index.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-export * from './basics';
+export { SheetsUIPart } from './consts/ui-name';
+export { SHEET_UI_PLUGIN_NAME } from './consts/plugin-name';
export { getEditorObject } from './basics/editor/get-editor-object';
export { SheetsScrollRenderController } from './controllers/render-controllers/scroll.render-controller';
export { deriveStateFromActiveSheet$, getCurrentRangeDisable$ } from './controllers/menu/menu-util';
diff --git a/packages/sheets-ui/src/views/desktop/.gitkeep b/packages/sheets-ui/src/views/desktop/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsx b/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsx
index 062f2728bd..36d96c231d 100644
--- a/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsx
+++ b/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsx
@@ -25,7 +25,7 @@ import { SheetPermissionUserManagerService } from '../../../services/permission/
import { getUserListEqual } from '../../../common/utils';
import { SetProtectionCommand } from '../../../commands/commands/range-protection.command';
import { AddWorksheetProtectionCommand } from '../../../commands/commands/worksheet-protection.command';
-import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../basics/const/permission';
+import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../consts/permission';
import styles from './index.module.less';
export const SheetPermissionPanelDetailFooter = () => {
diff --git a/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsx b/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsx
index 8b6b183b85..c46d09027d 100644
--- a/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsx
+++ b/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsx
@@ -21,7 +21,7 @@ import { ISidebarService, useObservable } from '@univerjs/ui';
import type { Workbook } from '@univerjs/core';
import { WorkbookEditablePermission, WorkbookManageCollaboratorPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';
import { SheetPermissionPanelModel } from '../../../services/permission/sheet-permission-panel.model';
-import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../basics/const/permission';
+import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../consts/permission';
import styles from './index.module.less';
export const SheetPermissionPanelAddFooter = () => {
diff --git a/packages/sheets-ui/src/views/permission/panel-detail/index.tsx b/packages/sheets-ui/src/views/permission/panel-detail/index.tsx
index b76de2be10..f0c26ecc0f 100644
--- a/packages/sheets-ui/src/views/permission/panel-detail/index.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-detail/index.tsx
@@ -28,7 +28,7 @@ import { UserEmptyBase64 } from '../user-dialog/constant';
import Spin from '../spin';
import { editState, SheetPermissionPanelModel, viewState } from '../../../services/permission/sheet-permission-panel.model';
import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';
-import { UNIVER_SHEET_PERMISSION_USER_DIALOG, UNIVER_SHEET_PERMISSION_USER_DIALOG_ID } from '../../../basics/const/permission';
+import { UNIVER_SHEET_PERMISSION_USER_DIALOG, UNIVER_SHEET_PERMISSION_USER_DIALOG_ID } from '../../../consts/permission';
import styles from './index.module.less';
export const SheetPermissionPanelDetail = ({ fromSheetBar }: { fromSheetBar: boolean }) => {
diff --git a/packages/sheets-ui/src/views/permission/panel-list/index.tsx b/packages/sheets-ui/src/views/permission/panel-list/index.tsx
index adbb3b18b2..7acd06014a 100644
--- a/packages/sheets-ui/src/views/permission/panel-list/index.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-list/index.tsx
@@ -32,7 +32,7 @@ import { serializeRange } from '@univerjs/engine-formula';
import { DeleteWorksheetProtectionCommand } from '../../../commands/commands/worksheet-protection.command';
import type { IPermissionPanelRule } from '../../../services/permission/sheet-permission-panel.model';
import { SheetPermissionPanelModel } from '../../../services/permission/sheet-permission-panel.model';
-import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../basics/const/permission';
+import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../consts/permission';
import { useHighlightRange } from '../../../hooks/useHighlightRange';
import { panelListEmptyBase64 } from './constant';
import styles from './index.module.less';
diff --git a/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx b/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx
index 8bf9fcc20c..4de95efc14 100644
--- a/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx
+++ b/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx
@@ -25,7 +25,7 @@ import { getAllWorksheetPermissionPoint, SetWorksheetPermissionPointsCommand, Wo
import type { ICollaborator, UnitAction } from '@univerjs/protocol';
import { ObjectScope, UnitObject, UnitRole } from '@univerjs/protocol';
import Spin from '../spin';
-import { defaultWorksheetUnitActionList, subUnitPermissionTypeMap, UNIVER_SHEET_PERMISSION_DIALOG_ID } from '../../../basics/const/permission';
+import { defaultWorksheetUnitActionList, subUnitPermissionTypeMap, UNIVER_SHEET_PERMISSION_DIALOG_ID } from '../../../consts/permission';
import styles from './index.module.less';
interface IPermissionMap {
diff --git a/packages/sheets-ui/src/views/permission/user-dialog/index.tsx b/packages/sheets-ui/src/views/permission/user-dialog/index.tsx
index 5e05e1db7c..e70c38cb4c 100644
--- a/packages/sheets-ui/src/views/permission/user-dialog/index.tsx
+++ b/packages/sheets-ui/src/views/permission/user-dialog/index.tsx
@@ -22,7 +22,7 @@ import { IDialogService } from '@univerjs/ui';
import { type ICollaborator, UnitRole } from '@univerjs/protocol';
import { CheckMarkSingle } from '@univerjs/icons';
import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';
-import { UNIVER_SHEET_PERMISSION_USER_DIALOG_ID } from '../../../basics/const/permission';
+import { UNIVER_SHEET_PERMISSION_USER_DIALOG_ID } from '../../../consts/permission';
import styles from './index.module.less';
import { UserEmptyBase64 } from './constant';
diff --git a/packages/sheets-ui/src/views/sheet-bar/index.module.less b/packages/sheets-ui/src/views/sheet-bar/index.module.less
index 26b30fe6a5..dec9a70df6 100644
--- a/packages/sheets-ui/src/views/sheet-bar/index.module.less
+++ b/packages/sheets-ui/src/views/sheet-bar/index.module.less
@@ -14,7 +14,7 @@
max-width: calc(100% - @zoom-slider-width);
height: 100%;
- background-color: rgb(var(--bg-color));
+ background-color: rgb(var(--bg-color-secondary));
&-options {
display: flex;
diff --git a/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsx b/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsx
index cd40b9e76a..3420c318e5 100644
--- a/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsx
+++ b/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsx
@@ -17,7 +17,7 @@
import { IUniverInstanceService, UniverInstanceType, useDependency } from '@univerjs/core';
import type { Workbook } from '@univerjs/core';
import React, { useMemo } from 'react';
-import { useObservable } from '@univerjs/ui';
+import { ToolbarItem, useObservable, useSimpleToolbarGroups } from '@univerjs/ui';
import { CountBar } from '../count-bar/CountBar';
import { EditorContainer } from '../editor-container/EditorContainer';
@@ -26,15 +26,18 @@ import { OperateContainer } from '../operate-container/OperateContainer';
import { SheetBar } from '../sheet-bar/SheetBar';
import { StatusBar } from '../status-bar/StatusBar';
import { useActiveWorkbook } from '../../components/hook';
+import { SheetMenuPosition } from '../../controllers/menu/menu';
import styles from './index.module.less';
export function RenderSheetFooter() {
const workbook = useActiveWorkbook();
- if (!workbook) return null;
+ const footerMenus = useSimpleToolbarGroups(SheetMenuPosition.SHEET_FOOTER);
+ if (!workbook) return null;
return (
<section className={styles.sheetContainer} data-range-selector>
<SheetBar />
+ {footerMenus.map((item) => <ToolbarItem key={item.id} {...item} />)}
<StatusBar />
<CountBar />
</section>
@@ -68,5 +71,9 @@ export function RenderSheetContent() {
function useHasWorkbook(): boolean {
const univerInstanceService = useDependency(IUniverInstanceService);
const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET), null, false, []);
- return useMemo(() => univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).length > 0, [univerInstanceService, workbook]);
+ return useMemo(
+ () => univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).length > 0,
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [univerInstanceService, workbook]
+ );
}
diff --git a/packages/sheets-ui/src/views/sheet-container/index.module.less b/packages/sheets-ui/src/views/sheet-container/index.module.less
index 763cccb8df..e3516d5442 100644
--- a/packages/sheets-ui/src/views/sheet-container/index.module.less
+++ b/packages/sheets-ui/src/views/sheet-container/index.module.less
@@ -12,4 +12,6 @@
box-sizing: border-box;
height: @sheet-footer-bar-height;
padding: 0 var(--padding-xl);
+
+ background-color: rgb(var(--bg-color-secondary));
}
diff --git a/packages/sheets-zen-editor/package.json b/packages/sheets-zen-editor/package.json
index eaeee0f42f..c349d6029c 100644
--- a/packages/sheets-zen-editor/package.json
+++ b/packages/sheets-zen-editor/package.json
@@ -76,7 +76,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/sheets": "workspace:*"
},
"devDependencies": {
diff --git a/packages/slides-ui/package.json b/packages/slides-ui/package.json
index ad64a4b8f7..2af2192b40 100644
--- a/packages/slides-ui/package.json
+++ b/packages/slides-ui/package.json
@@ -77,7 +77,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74"
+ "@univerjs/icons": "^0.1.77"
},
"devDependencies": {
"@types/react": "^18.3.3",
diff --git a/packages/thread-comment-ui/package.json b/packages/thread-comment-ui/package.json
index 345a2dceb9..cbcc38e885 100644
--- a/packages/thread-comment-ui/package.json
+++ b/packages/thread-comment-ui/package.json
@@ -75,7 +75,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"@univerjs/protocol": "0.1.39-alpha.9"
},
"devDependencies": {
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 03d8f054b0..6f86ad951b 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -76,7 +76,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.74",
+ "@univerjs/icons": "^0.1.77",
"localforage": "^1.10.0",
"rc-notification": "^5.6.0",
"rc-util": "^5.43.0"
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index fdc43f94c0..ca761d93bc 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -88,7 +88,7 @@ export { IEditorService, EditorService, Editor } from './services/editor/editor.
export { TextEditor } from './components/editor/TextEditor';
export { RangeSelector } from './components/range-selector/RangeSelector';
export { ProgressBar } from './components/progress-bar/ProgressBar';
-export { type IMenuGroup, useToolbarGroups, useToolbarItemStatus, useToolbarCollapseObserver } from './views/components/doc-bars/hook';
+export { type IMenuGroup, useSimpleToolbarGroups, useToolbarGroups, useToolbarItemStatus, useToolbarCollapseObserver } from './views/components/doc-bars/hook';
export { mergeMenuConfigs } from './common/menu-merge-configs';
export { ShortcutPanelController } from './controllers/shortcut-display/shortcut-panel.controller';
export { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
diff --git a/packages/ui/src/services/menu/menu.ts b/packages/ui/src/services/menu/menu.ts
index 44489541b4..d76065fc89 100644
--- a/packages/ui/src/services/menu/menu.ts
+++ b/packages/ui/src/services/menu/menu.ts
@@ -28,6 +28,7 @@ export enum MenuPosition {
TOOLBAR_VIEW = 'uiToolbar.view',
TOOLBAR_OTHERS = 'uiToolbar.others',
CONTEXT_MENU = 'contextMenu',
+ FOOTER = 'footer',
}
export enum MenuGroup {
@@ -131,6 +132,13 @@ export interface ICustomComponentProps<T> {
export interface IMenuSelectorItem<V = MenuItemDefaultValueType, T = undefined> extends IMenuItemBase<V> {
type: MenuItemType.SELECTOR | MenuItemType.BUTTON_SELECTOR | MenuItemType.SUBITEMS;
+ /**
+ * If this property is set, changing the value of the selection will trigger the command with this id,
+ * instead of {@link IMenuItemBase.id} or {@link IMenuItemBase.commandId}. At the same title,
+ * clicking the button will trigger IMenuItemBase.id or IMenuItemBase.commandId.
+ */
+ selectionsCommandId?: string;
+
// selections 子菜单可以为三种类型
// 一个是当前 menu 的 options,选中后直接使用其 value 触发 command
// 一个是一个特殊组件,比如 color picker,选中后直接使用其 value 触发 command
diff --git a/packages/ui/src/views/components/ComponentContainer.tsx b/packages/ui/src/views/components/ComponentContainer.tsx
index 56fa444476..ec58fc8867 100644
--- a/packages/ui/src/views/components/ComponentContainer.tsx
+++ b/packages/ui/src/views/components/ComponentContainer.tsx
@@ -17,7 +17,7 @@
import { useDependency } from '@univerjs/core';
import type { ComponentType } from 'react';
import React, { useMemo, useRef } from 'react';
-import { filter, map, startWith } from 'rxjs';
+import { debounceTime, filter, map, startWith } from 'rxjs';
import type { Injector } from '@univerjs/core';
import { useObservable } from '../../components/hooks/observable';
import { IUIPartsService } from '../../services/parts/parts.service';
@@ -46,10 +46,12 @@ export function ComponentContainer(props: IComponentContainerProps) {
*/
export function useComponentsOfPart(part: string, injector?: Injector) {
const uiPartsService = injector?.get(IUIPartsService) ?? useDependency(IUIPartsService);
+
const updateCounterRef = useRef<number>(0);
const componentPartUpdateCount = useObservable(
() => uiPartsService.componentRegistered$.pipe(
filter((key) => key === part),
+ debounceTime(200),
map(() => updateCounterRef.current += 1),
startWith(updateCounterRef.current += 1) // trigger update when subscribe
),
diff --git a/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx b/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx
index 55a54d434c..53555d117e 100644
--- a/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx
+++ b/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx
@@ -44,7 +44,7 @@ export const ToolbarItem = forwardRef((props: IDisplayMenuItem<IMenuItem>, ref:
const { value, hidden, disabled, activated } = useToolbarItemStatus(props);
- const handleCommandExecuted = (commandId: string, params?: Record<string, any>) => {
+ const executeCommand = (commandId: string, params?: Record<string, any>) => {
layoutService.focus();
commandService.executeCommand(commandId, params);
};
@@ -61,7 +61,7 @@ export const ToolbarItem = forwardRef((props: IDisplayMenuItem<IMenuItem>, ref:
}
}
- const { tooltip, shortcut, icon, title, label, id } = props;
+ const { tooltip, shortcut, icon, title, label, id, commandId } = props;
const tooltipTitle = localeService.t(tooltip ?? '') + (shortcut ? ` (${shortcut})` : '');
@@ -91,37 +91,31 @@ export const ToolbarItem = forwardRef((props: IDisplayMenuItem<IMenuItem>, ref:
const iconToDisplay = useObservable(icon$, undefined, true);
function renderSelectorType(menuType: MenuItemType) {
- function handleSelect(option: IValueOption) {
- if (disabled) {
- return;
- }
+ const selectionsCommandId = (props as IDisplayMenuItem<IMenuSelectorItem>).selectionsCommandId;
+ const bId = commandId ?? id;
+ const sId = selectionsCommandId ?? commandId ?? id;
- let commandId = id;
- const value = option;
+ function handleSelect(option: IValueOption) {
+ if (disabled) return;
+ let commandId = sId;
if (option.id) {
commandId = option.id;
}
- handleCommandExecuted(commandId, value);
+ executeCommand(commandId, { value: option.value });
}
- function handleChange(value: string | number) {
- if (disabled) {
- return;
- }
-
- const commandId = id;
- handleCommandExecuted(commandId, { value });
+ function handleSelectionsValueChange(value: string | number) {
+ if (disabled) return;
+ executeCommand(sId, { value });
}
function handleClick() {
- if (disabled) {
- return;
- }
+ if (disabled) return;
+
if (menuType === MenuItemType.BUTTON_SELECTOR) {
- const commandId = id;
- handleCommandExecuted(commandId, { value });
+ executeCommand(bId, { value });
}
}
@@ -141,7 +135,7 @@ export const ToolbarItem = forwardRef((props: IDisplayMenuItem<IMenuItem>, ref:
title={title!}
value={value}
label={label}
- onChange={handleChange}
+ onChange={handleSelectionsValueChange}
/>
</div>
<Dropdown
@@ -186,7 +180,7 @@ export const ToolbarItem = forwardRef((props: IDisplayMenuItem<IMenuItem>, ref:
title={title!}
value={value}
label={label}
- onChange={handleChange}
+ onChange={handleSelectionsValueChange}
/>
<div
className={clsx(styles.toolbarItemSelectArrow, {
@@ -208,8 +202,8 @@ export const ToolbarItem = forwardRef((props: IDisplayMenuItem<IMenuItem>, ref:
className={styles.toolbarItemTextButton}
active={activated}
disabled={disabled}
- onClick={() => handleCommandExecuted(props.commandId ?? props.id)}
- onDoubleClick={() => props.subId && handleCommandExecuted(props.subId)}
+ onClick={() => executeCommand(props.commandId ?? props.id)}
+ onDoubleClick={() => props.subId && executeCommand(props.subId)}
>
{isCustomComponent
? (
diff --git a/packages/ui/src/views/components/doc-bars/hook.ts b/packages/ui/src/views/components/doc-bars/hook.ts
index abffe0b846..a332d4ef25 100644
--- a/packages/ui/src/views/components/doc-bars/hook.ts
+++ b/packages/ui/src/views/components/doc-bars/hook.ts
@@ -43,6 +43,22 @@ export interface IToolbarRenderHookHandler {
groupsByKey: Record<MenuGroup, Array<IDisplayMenuItem<IMenuItem>>>;
}
+export function useSimpleToolbarGroups(category: MenuPositionWithCustom): IDisplayMenuItem<IMenuItem>[] {
+ const menuService = useDependency(IMenuService);
+ const [visibleItems, setVisibleItems] = useState<IDisplayMenuItem<IMenuItem>[]>([]);
+
+ useEffect(() => {
+ const s = menuService.menuChanged$.subscribe(() => {
+ const menuItems = menuService.getMenuItems(category);
+ setVisibleItems(menuItems);
+ });
+
+ return () => s.unsubscribe();
+ }, [menuService, category]);
+
+ return visibleItems;
+}
+
/**
* If your custom toolbar component need to render menu items by their category,
* you can use this hook to get the toolbar status.
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1b95798701..3e7665a62d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -10,7 +10,7 @@ importers:
devDependencies:
'@antfu/eslint-config':
specifier: 2.25.0
'@commitlint/cli':
specifier: ^19.4.0
version: 19.4.0(@types/[email protected])([email protected])
@@ -31,7 +31,7 @@ importers:
'@storybook/react':
specifier: 8.2.8
'@types/node':
specifier: ^22.2.0
version: 22.3.0
@@ -46,7 +46,7 @@ importers:
version: link:common/shared
'@vitejs/plugin-react':
specifier: ^4.3.1
eslint:
specifier: 9.9.0
version: 9.9.0([email protected])
@@ -133,7 +133,7 @@ importers:
'@storybook/addon-interactions':
specifier: 8.2.8
'@storybook/addon-links':
specifier: 8.2.8
@@ -151,7 +151,7 @@ importers:
'@storybook/react':
specifier: 8.2.8
'@storybook/react-webpack5':
specifier: 8.2.8
@@ -175,7 +175,7 @@ importers:
storybook:
specifier: 8.2.8
- version: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ version: 8.2.8(@babel/[email protected])
storybook-addon-swc:
specifier: ^1.2.0
@@ -250,8 +250,8 @@ importers:
specifier: workspace:*
version: link:../packages/find-replace
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/rpc':
specifier: workspace:*
version: link:../packages/rpc
@@ -264,6 +264,9 @@ importers:
'@univerjs/sheets-conditional-formatting-ui':
specifier: workspace:*
version: link:../packages/sheets-conditional-formatting-ui
+ '@univerjs/sheets-crosshair-highlight':
+ specifier: workspace:*
+ version: link:../packages/sheets-crosshair-highlight
'@univerjs/sheets-data-validation':
specifier: workspace:*
version: link:../packages/sheets-data-validation
@@ -410,8 +413,8 @@ importers:
specifier: workspace:*
version: link:../../packages/engine-render
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -453,8 +456,8 @@ importers:
packages-experimental/uni-formula:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -503,8 +506,8 @@ importers:
specifier: workspace:*
version: link:../../packages/engine-render
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/rpc':
specifier: workspace:*
version: link:../../packages/rpc
@@ -545,8 +548,8 @@ importers:
packages-experimental/uni-sheets-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/sheets-drawing-ui':
specifier: workspace:*
version: link:../../packages/sheets-drawing-ui
@@ -600,8 +603,8 @@ importers:
packages-experimental/uni-slides-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -658,8 +661,8 @@ importers:
specifier: ^2.1.1
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/sheets':
specifier: workspace:*
version: link:../../packages/sheets
@@ -864,8 +867,8 @@ importers:
specifier: ^4.1.13
version: 4.1.13
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
rc-dialog:
specifier: ^9.5.2
@@ -1013,8 +1016,8 @@ importers:
packages/docs-drawing-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -1104,8 +1107,8 @@ importers:
specifier: workspace:*
version: link:../docs-ui
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -1240,8 +1243,8 @@ importers:
specifier: workspace:*
version: link:../engine-render
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -1286,8 +1289,8 @@ importers:
packages/docs-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@types/react':
specifier: ^18.3.3
@@ -1335,8 +1338,8 @@ importers:
packages/drawing:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
ot-json1:
specifier: ^1.0.2
version: 1.0.2
@@ -1366,8 +1369,8 @@ importers:
packages/drawing-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -1527,6 +1530,9 @@ importers:
'@univerjs/sheets-conditional-formatting':
specifier: workspace:*
version: link:../sheets-conditional-formatting
+ '@univerjs/sheets-crosshair-highlight':
+ specifier: workspace:*
+ version: link:../sheets-crosshair-highlight
'@univerjs/sheets-data-validation':
specifier: workspace:*
version: link:../sheets-data-validation
@@ -1570,8 +1576,8 @@ importers:
packages/find-replace:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@types/react':
specifier: ^18.3.3
@@ -1738,8 +1744,8 @@ importers:
packages/sheets-conditional-formatting-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/protocol':
specifier: 0.1.39-alpha.9
version: 0.1.39-alpha.9(@grpc/[email protected])([email protected])
@@ -1820,11 +1826,60 @@ importers:
specifier: ^2.0.5
+ packages/sheets-crosshair-highlight:
+ dependencies:
+ '@univerjs/icons':
+ specifier: ^0.1.77
+ devDependencies:
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../core
+ '@univerjs/design':
+ specifier: workspace:*
+ version: link:../design
+ '@univerjs/engine-render':
+ specifier: workspace:*
+ version: link:../engine-render
+ '@univerjs/shared':
+ specifier: workspace:*
+ version: link:../../common/shared
+ '@univerjs/sheets':
+ specifier: workspace:*
+ version: link:../sheets
+ '@univerjs/sheets-ui':
+ specifier: workspace:*
+ version: link:../sheets-ui
+ '@univerjs/ui':
+ specifier: workspace:*
+ version: link:../ui
+ clsx:
+ specifier: ^2.1.1
+ version: 2.1.1
+ less:
+ specifier: ^4.2.0
+ version: 4.2.0
+ react:
+ specifier: 18.3.1
+ version: 18.3.1
+ rxjs:
+ specifier: ^7.8.1
+ version: 7.8.1
+ typescript:
+ specifier: ^5.5.4
+ version: 5.5.4
+ vite:
+ specifier: ^5.4.1
+ vitest:
+ specifier: ^2.0.5
+
packages/sheets-data-validation:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/protocol':
specifier: 0.1.39-alpha.9
version: 0.1.39-alpha.9(@grpc/[email protected])([email protected])
@@ -1914,8 +1969,8 @@ importers:
packages/sheets-drawing-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -1996,8 +2051,8 @@ importers:
packages/sheets-filter-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
rc-virtual-list:
specifier: ^3.14.5
@@ -2097,8 +2152,8 @@ importers:
packages/sheets-formula:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@types/react':
specifier: ^18.3.3
@@ -2198,8 +2253,8 @@ importers:
specifier: workspace:*
version: link:../design
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/sheets-hyper-link':
specifier: workspace:*
version: link:../sheets-hyper-link
@@ -2253,8 +2308,8 @@ importers:
packages/sheets-numfmt:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@types/react':
specifier: ^18.3.3
@@ -2338,8 +2393,8 @@ importers:
specifier: workspace:*
version: link:../engine-formula
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
rc-virtual-list:
specifier: ^3.14.5
@@ -2396,8 +2451,8 @@ importers:
specifier: workspace:*
version: link:../engine-render
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/sheets':
specifier: workspace:*
version: link:../sheets
@@ -2491,8 +2546,8 @@ importers:
packages/sheets-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/protocol':
specifier: 0.1.39-alpha.9
version: 0.1.39-alpha.9(@grpc/[email protected])([email protected])
@@ -2549,8 +2604,8 @@ importers:
packages/sheets-zen-editor:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/sheets':
specifier: workspace:*
version: link:../sheets
@@ -2625,8 +2680,8 @@ importers:
packages/slides-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
devDependencies:
'@types/react':
specifier: ^18.3.3
@@ -2705,8 +2760,8 @@ importers:
packages/thread-comment-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/protocol':
specifier: 0.1.39-alpha.9
version: 0.1.39-alpha.9(@grpc/[email protected])([email protected])
@@ -2760,8 +2815,8 @@ importers:
packages/ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.74
+ specifier: ^0.1.77
'@univerjs/ui':
specifier: workspace:*
version: 'link:'
@@ -5510,8 +5565,8 @@ packages:
'@univerjs/[email protected]':
resolution: {integrity: sha512-XLvM4AnZpHXMC9yNj2EJMea3fZ2PhuHq4cIsxmIgW4kWdCCGHlVTu/Xj3fAxYpvb4PgyPKA8KoRbKM+xh4WfGw==}
- '@univerjs/[email protected]':
- resolution: {integrity: sha512-JP1NUDod6jg5OOHzK1FmcJ+0qXF24MisyBC333Nz8SXAk1IKsdr89AyTEpbSXFDl8vI7xRpttCvW6hQ84s0lLg==}
+ '@univerjs/[email protected]':
+ resolution: {integrity: sha512-ADkX1PkXG+rptU+OJzrPX+asVawRVKF6v+Ce3DYq/pVKOnKm8qPbKsbVmCMyxPOCq9N5Cd0TAkjJavyft+XsEw==}
peerDependencies:
react: '*'
react-dom: '*'
@@ -10772,6 +10827,37 @@ packages:
terser:
optional: true
+ resolution: {integrity: sha512-1oE6yuNXssjrZdblI9AfBbHCC41nnyoVoEZxQnID6yvQZAFBzxxkqoFLtHUMkYunL8hwOLEjgTuxpkRxvba3kA==}
+ engines: {node: ^18.0.0 || >=20.0.0}
+ hasBin: true
+ peerDependencies:
+ '@types/node': ^18.0.0 || >=20.0.0
+ less: '*'
+ lightningcss: ^1.21.0
+ sass: '*'
+ sass-embedded: '*'
+ stylus: '*'
+ sugarss: '*'
+ terser: ^5.4.0
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+ less:
+ optional: true
+ lightningcss:
+ optional: true
+ sass:
+ optional: true
+ sass-embedded:
+ optional: true
+ stylus:
+ optional: true
+ sugarss:
+ optional: true
+ terser:
+ optional: true
+
resolution: {integrity: sha512-8GUxONfauuIdeSl5f9GTgVEpg5BTOlplET4WEDaeY2QBiN8wSm68vxN/tb5z405OwppfoCavnwXafiaYBC/xOA==}
engines: {node: ^18.0.0 || >=20.0.0}
@@ -11062,7 +11148,7 @@ snapshots:
dependencies:
'@babel/runtime': 7.25.0
dependencies:
'@antfu/install-pkg': 0.3.3
'@clack/prompts': 0.7.0
@@ -11087,7 +11173,7 @@ snapshots:
eslint-plugin-toml: 0.11.1([email protected]([email protected]))
eslint-plugin-unicorn: 55.0.0([email protected]([email protected]))
eslint-plugin-vue: 9.27.0([email protected]([email protected]))
eslint-plugin-yml: 1.14.0([email protected]([email protected]))
eslint-processor-vue-blocks: 0.1.2(@vue/[email protected])([email protected]([email protected]))
@@ -13004,21 +13090,21 @@ snapshots:
'@types/uuid': 9.0.8
dequal: 2.0.3
polished: 4.3.1
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
uuid: 9.0.1
dependencies:
'@storybook/global': 5.0.0
memoizerific: 1.11.3
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
dependencies:
dequal: 2.0.3
lodash: 4.17.21
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
@@ -13028,14 +13114,14 @@ snapshots:
'@storybook/csf-plugin': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/global': 5.0.0
'@types/react': 18.3.3
fs-extra: 11.2.0
react: 18.3.1
react-dom: 18.3.1([email protected])
rehype-external-links: 3.0.0
rehype-slug: 6.0.0
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
transitivePeerDependencies:
- supports-color
@@ -13051,7 +13137,7 @@ snapshots:
'@storybook/addon-outline': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/addon-toolbars': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/addon-viewport': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
transitivePeerDependencies:
- supports-color
@@ -13059,15 +13145,15 @@ snapshots:
dependencies:
'@storybook/global': 5.0.0
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
'@storybook/global': 5.0.0
'@storybook/instrumenter': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
polished: 4.3.1
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
transitivePeerDependencies:
- '@jest/globals'
@@ -13080,7 +13166,7 @@ snapshots:
dependencies:
'@storybook/csf': 0.1.11
'@storybook/global': 5.0.0
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
optionalDependencies:
react: 18.3.1
@@ -13088,13 +13174,13 @@ snapshots:
dependencies:
'@storybook/global': 5.0.0
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
tiny-invariant: 1.3.3
dependencies:
'@storybook/global': 5.0.0
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
@@ -13104,12 +13190,12 @@ snapshots:
dependencies:
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
memoizerific: 1.11.3
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
@@ -13132,7 +13218,7 @@ snapshots:
memoizerific: 1.11.3
polished: 4.3.1
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
telejson: 7.2.0
ts-dedent: 2.2.0
util-deprecate: 1.0.2
@@ -13159,7 +13245,7 @@ snapshots:
path-browserify: 1.0.1
process: 0.11.10
semver: 7.6.3
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
@@ -13190,7 +13276,7 @@ snapshots:
'@types/cross-spawn': 6.0.6
cross-spawn: 7.0.3
globby: 14.0.2
- jscodeshift: 0.15.2(@babel/[email protected](@babel/[email protected]))
+ jscodeshift: 0.15.2(@babel/[email protected])
lodash: 4.17.21
prettier: 3.3.3
recast: 0.23.9
@@ -13200,14 +13286,14 @@ snapshots:
- supports-color
- utf-8-validate
dependencies:
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
'@types/node': 18.19.44
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
'@storybook/[email protected]':
@@ -13230,7 +13316,7 @@ snapshots:
dependencies:
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
unplugin: 1.12.1
'@storybook/[email protected]':
@@ -13248,19 +13334,19 @@ snapshots:
dependencies:
'@storybook/global': 5.0.0
'@vitest/utils': 1.6.0
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
util: 0.12.5
dependencies:
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
'@storybook/[email protected]': {}
dependencies:
'@storybook/core-webpack': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/react-docgen-typescript-plugin': 1.0.6--canary.9.0c3f3b7.0([email protected])([email protected](@swc/[email protected])([email protected]))
'@types/node': 18.19.44
'@types/semver': 7.5.8
@@ -13272,7 +13358,7 @@ snapshots:
react-dom: 18.3.1([email protected])
resolve: 1.22.8
semver: 7.6.3
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
tsconfig-paths: 4.2.0
webpack: 5.93.0(@swc/[email protected])([email protected])
optionalDependencies:
@@ -13284,9 +13370,9 @@ snapshots:
- uglify-js
- webpack-cli
dependencies:
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
@@ -13302,21 +13388,21 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
react: 18.3.1
react-dom: 18.3.1([email protected])
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
'@types/node': 18.19.44
react: 18.3.1
react-dom: 18.3.1([email protected])
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:
@@ -13327,14 +13413,14 @@ snapshots:
- uglify-js
- webpack-cli
dependencies:
- '@storybook/components': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
+ '@storybook/components': 8.2.8([email protected](@babel/[email protected]))
'@storybook/global': 5.0.0
- '@storybook/manager-api': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
- '@storybook/preview-api': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
- '@storybook/theming': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
+ '@storybook/manager-api': 8.2.8([email protected](@babel/[email protected]))
+ '@storybook/preview-api': 8.2.8([email protected](@babel/[email protected]))
+ '@storybook/theming': 8.2.8([email protected](@babel/[email protected]))
'@types/escodegen': 0.0.6
'@types/estree': 0.0.51
'@types/node': 18.19.44
@@ -13349,23 +13435,23 @@ snapshots:
react-dom: 18.3.1([email protected])
react-element-to-jsx-string: 15.0.0([email protected]([email protected]))([email protected])
semver: 7.6.3
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
ts-dedent: 2.2.0
type-fest: 2.19.0
util-deprecate: 1.0.2
optionalDependencies:
typescript: 5.5.4
dependencies:
'@storybook/csf': 0.1.11
'@storybook/instrumenter': 8.2.8([email protected](@babel/[email protected](@babel/[email protected])))
'@testing-library/dom': 10.1.0
'@testing-library/user-event': 14.5.2(@testing-library/[email protected])
'@vitest/expect': 1.6.0
'@vitest/spy': 1.6.0
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
util: 0.12.5
transitivePeerDependencies:
- '@jest/globals'
@@ -13374,13 +13460,13 @@ snapshots:
- jest
- vitest
dependencies:
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
- storybook: 8.2.8(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.8(@babel/[email protected])
dependencies:
@@ -13496,7 +13582,7 @@ snapshots:
lz-string: 1.5.0
pretty-format: 27.5.1
dependencies:
'@adobe/css-tools': 4.4.0
'@babel/runtime': 7.25.0
@@ -13950,7 +14036,7 @@ snapshots:
'@univerjs/[email protected]': {}
dependencies:
react: 18.3.1
react-dom: 18.3.1([email protected])
@@ -13971,6 +14057,17 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ '@babel/core': 7.24.7
+ '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/[email protected])
+ '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/[email protected])
+ '@types/babel__core': 7.20.5
+ react-refresh: 0.14.2
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
@@ -16023,7 +16120,7 @@ snapshots:
optionalDependencies:
dependencies:
'@typescript-eslint/utils': 7.18.0([email protected]([email protected]))([email protected])
eslint: 9.9.0([email protected])
@@ -17170,7 +17267,7 @@ snapshots:
dependencies:
'@babel/core': 7.25.2
'@babel/parser': 7.25.3
@@ -19254,7 +19351,7 @@ snapshots:
webpack: 5.93.0(@swc/[email protected])([email protected])
dependencies:
'@babel/core': 7.25.2
'@babel/types': 7.25.2
@@ -19274,7 +19371,7 @@ snapshots:
fs-extra: 11.2.0
giget: 1.2.3
globby: 14.0.2
- jscodeshift: 0.15.2(@babel/[email protected](@babel/[email protected]))
+ jscodeshift: 0.15.2(@babel/[email protected])
leven: 3.1.0
ora: 5.4.1
prettier: 3.3.3
@@ -19851,7 +19948,7 @@ snapshots:
debug: 4.3.6
pathe: 1.1.2
tinyrainbow: 1.2.0
transitivePeerDependencies:
- '@types/node'
- less
@@ -19895,6 +19992,18 @@ snapshots:
sass: 1.77.5
terser: 5.31.5
+ dependencies:
+ esbuild: 0.21.5
+ postcss: 8.4.41
+ rollup: 4.20.0
+ optionalDependencies:
+ '@types/node': 22.3.0
+ fsevents: 2.3.3
+ less: 4.2.0
+ sass: 1.77.5
+ terser: 5.31.5
+
dependencies:
'@ampproject/remapping': 2.3.0