Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(mobile): init basic mobile features (#2443)
Wenzhao Hu3583fe59ed0e
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 874e799827..c240cced5c 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -85,6 +85,27 @@ During the refactoring process, it is recommended to remove legacy folders suchAvoid creating barrel imports (index.ts) unless it is the main root index.ts file of a plugin.+#### Desktop & Mobile++We added experimental support for mobile platforms since June 2024. After that, all UI plugins should split ui related code by their running platforms:++```+|- controllers/+ |- render-controllers/+ |- common/+ |- desktop/+ |- mobile/+|- views/+ |- components/+ |- common/+ |- desktop/+ |- mobile/+ |- parts/+ |- common/+ |- desktop/+ |- mobile/+```+### Connecting contextTo effectively contribute as a member of a software engineering team (and community as well!), it is crucial to establish strong contextual connections. Providing links to relevant resources can greatly assist others in understanding the context. Consider the following practices:diff --git a/examples/esbuild.config.mjs b/examples/esbuild.config.mjsindex 2486e9f96a..33903b39b7 100644--- a/examples/esbuild.config.mjs+++ b/examples/esbuild.config.mjs@@ -92,7 +92,12 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({// uni'./src/uni/main.ts',++ // mobile sheet+ './src/mobile-s/main.ts',+ './src/mobile-s/worker.ts',],+outdir: './local',define: {diff --git a/examples/public/mobile-s/index.html b/examples/public/mobile-s/index.htmlnew file mode 100644index 0000000000..c228b9f521--- /dev/null+++ b/examples/public/mobile-s/index.html@@ -0,0 +1,31 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta content="width=device-width, initial-scale=1" name="viewport" />+ <title>Univer Sheets</title>++ <link rel="icon" type="image/x-icon" href="../favicon.svg" />+ <link rel="stylesheet" href="./main.css" />+ <style>+ html,+ body {+ height: 100%;+ margin: 0;+ }+ </style>++ <script>+ new EventSource('/esbuild').addEventListener('change', () => {+ console.info('reload--');+ location.reload();+ });+ </script>+ </head>++ <body style="overflow: hidden">+ <div id="app" style="height: 100%"></div>++ <script src="./main.js"></script>+ </body>+</html>diff --git a/examples/src/main.tsx b/examples/src/main.tsxindex 878f47ef64..198bf5d14a 100644--- a/examples/src/main.tsx+++ b/examples/src/main.tsx@@ -55,6 +55,9 @@ function Examples() {}, {title: '🌌 Universe',href: './uni/',+ }, {+ title: '📱 Mobile',+ href: './mobile-s/',}];return (diff --git a/packages/ui/src/components/menu/index.ts b/examples/src/mobile-s/lazy.tssimilarity index 67%rename from packages/ui/src/components/menu/index.tsrename to examples/src/mobile-s/lazy.tsindex bd51e70ac3..a1a2a0c52e 100644--- a/packages/ui/src/components/menu/index.ts+++ b/examples/src/mobile-s/lazy.ts@@ -14,4 +14,11 @@* limitations under the License.*/-export * from './Menu';+import type { Plugin, PluginCtor } from '@univerjs/core';+import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';++export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {+ return [+ [UniverSheetsFilterUIPlugin],+ ];+}diff --git a/examples/src/mobile-s/main.ts b/examples/src/mobile-s/main.tsnew file mode 100644index 0000000000..e1a39a3bb3--- /dev/null+++ b/examples/src/mobile-s/main.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 { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';+import { defaultTheme } from '@univerjs/design';+import { UniverDocsPlugin } from '@univerjs/docs';+import { UniverDocsUIPlugin } from '@univerjs/docs-ui';+import { UniverRenderEnginePlugin } from '@univerjs/engine-render';+import { UniverSheetsPlugin } from '@univerjs/sheets';+import { UniverSheetsMobileUIPlugin } from '@univerjs/sheets-ui';+import { UniverMobileUIPlugin } from '@univerjs/ui';+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';+import type { FUniver } from '@univerjs/facade';+import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';+import { UniverSheetsFilterMobileUIPlugin } from '@univerjs/sheets-filter-ui';+import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';+import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';+import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';+import { UniverSheetsFormulaMobilePlugin } from '@univerjs/sheets-formula';+import { UniverSheetsDataValidationMobilePlugin } from '@univerjs/sheets-data-validation';+import { UniverSheetsConditionalFormattingMobileUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';+import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data/sheets/demo/default-workbook-data-demo';+import { enUS } from '../locales';++// univer+const univer = new Univer({+ theme: defaultTheme,+ locale: LocaleType.EN_US,+ locales: {+ [LocaleType.EN_US]: enUS,+ },+ logLevel: LogLevel.VERBOSE,+});++univer.registerPlugin(UniverFormulaEnginePlugin);++// core plugins+univer.registerPlugin(UniverDocsPlugin, {+ hasScroll: false,+});+univer.registerPlugin(UniverRenderEnginePlugin);+univer.registerPlugin(UniverMobileUIPlugin, { container: 'app', contextMenu: true });+univer.registerPlugin(UniverRPCMainThreadPlugin, {+ workerURL: './worker.js',+} as IUniverRPCMainThreadConfig);++univer.registerPlugin(UniverDocsUIPlugin);+univer.registerPlugin(UniverSheetsPlugin);++univer.registerPlugin(UniverSheetsMobileUIPlugin);+univer.registerPlugin(UniverSheetsFilterPlugin);+univer.registerPlugin(UniverSheetsFilterMobileUIPlugin);+univer.registerPlugin(UniverSheetsNumfmtPlugin);+univer.registerPlugin(UniverSheetsFormulaMobilePlugin);+univer.registerPlugin(UniverSheetsConditionalFormattingMobileUIPlugin);+univer.registerPlugin(UniverSheetsDataValidationMobilePlugin);++const mockUser = {+ userID: 'Owner_qxVnhPbQ',+ name: 'Owner',+ avatar: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgBtZU9TxtBEIbfWRzFSIdkikhBSqRQkJqkCKTCFkqVInSUSaT0wC8w/gXxD4gU2nRJkXQWhAZowDUUWKIwEgWWbEEB3mVmx3dn4DA2nB/ppNuPeWd29mMIPXDr+RxwtgRHeW6+guNPRxogqnL7Dwz9psJ27S4NShaeZTH3kwXy6I81dlRKcmRui88swdq9AcSFL7Buz1Vmlns64MiLsCjzwnIYHLH57tbfFbs7KRaXyEU8FVZofqccOfA5l7Q8LPIkGrwnb2RPNEXWFVMUF3L+kDCk0btDDAMzOm5YfAHDwp4tG74wnzAsiOYMnJ3GoDybA7IT98/jm5+JNnfiIzAS6LlqHQBN/i6b2t/cV1Hh6BfwYlHnHP4AXi5q/8kmMMpOs8+BixZw/Fd6xUEHEbnkgclvQP2fGp7uShRKnQ3G32rkjV1th8JhIGG7tR/JyjGteSOZELwGMmNqIIigRCLRh2OZIE6BjItdd7pCW6Uhm1zzkUtungSxwEUzNpQ+GQumtH1ej1MqgmNT6vwmhCq5yuwq56EYTbgeQUz3yvrpV1b4ok3nYJ+eYhgYmjRUqErx2EDq0Fr8FhG++iqVGqxlUJI/70Ar0UgJaWHj6hYVHJrfKssAHot1JfqwE9WVWzXZVd5z2Ws/4PnmtEjkXeKJDvxUecLbWOXH/DP6QQ4J72NS0adedp1aseBfXP8odlZFfPvBF7SN/8hky1TYuPOAXAEipMx15u5ToAAAAABJRU5ErkJggg==',+ anonymous: false,+ canBindAnonymous: false,+};++const injector = univer.__getInjector();+const userManagerService = injector.get(UserManagerService);+userManagerService.setCurrentUser(mockUser);++declare global {+ // eslint-disable-next-line ts/naming-convention+ interface Window {+ univer?: Univer;+ univerAPI?: ReturnType<typeof FUniver.newAPI>;+ }+}++univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);diff --git a/examples/src/mobile-s/worker.ts b/examples/src/mobile-s/worker.tsnew file mode 100644index 0000000000..179c9d99cb--- /dev/null+++ b/examples/src/mobile-s/worker.ts@@ -0,0 +1,33 @@+/**+ * 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 { LocaleType, LogLevel, Univer } from '@univerjs/core';+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';+import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc';+import { UniverSheetsPlugin } from '@univerjs/sheets';++// Univer web worker is also a univer application.+const univer = new Univer({+ locale: LocaleType.ZH_CN,+ logLevel: LogLevel.VERBOSE,+});++univer.registerPlugin(UniverSheetsPlugin, { onlyRegisterFormulaRelatedMutations: true });+univer.registerPlugin(UniverFormulaEnginePlugin);+univer.registerPlugin(UniverRPCWorkerThreadPlugin);++declare let self: WorkerGlobalScope & typeof globalThis & { univer: Univer };+self.univer = univer;diff --git a/examples/src/sheets-uniscript/draw-univer-logo.js b/examples/src/sheets-uniscript/draw-univer-logo.jsindex c4c0b4b1f3..d72f3db7dd 100644--- a/examples/src/sheets-uniscript/draw-univer-logo.js+++ b/examples/src/sheets-uniscript/draw-univer-logo.js@@ -16,6 +16,7 @@/* eslint-disable */+const newSheet = univerAPI.getActiveWorkbook().create("Draw Univer Logo", 80, 80);newSheet.setRowHeights(0, 80, 6);newSheet.setColumnWidths(0, 80, 6);@@ -1548,4 +1549,5 @@ const key = setInterval(() => {}index += 1;-}, 23);\ No newline at end of file+}, 23);+diff --git a/packages/core/src/common/array.ts b/packages/core/src/common/array.tsindex 2a8b7f14a1..76f7065656 100644--- a/packages/core/src/common/array.ts+++ b/packages/core/src/common/array.ts@@ -83,3 +83,9 @@ export function groupBy<T>(arr: Readonly<T[]>, keyFn: (v: T) => string): Map<strreturn groups;}++export function makeArray<T>(thing: T | T[]): T[] {+ if (Array.isArray(thing)) return thing;++ return [thing];+}diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex adf9588b48..5f6842a0a3 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -23,7 +23,7 @@ export { Univer } from './univer';export { shallowEqual, isRangesEqual, isUnitRangesEqual } from './common/equal';export { isNumeric, isSafeNumeric } from './common/number';export { isBooleanString } from './common/boolean';-export { dedupe, remove, rotate, groupBy } from './common/array';+export { dedupe, remove, rotate, groupBy, makeArray } from './common/array';export { mergeSets } from './common/set';export {DEFAULT_EMPTY_DOCUMENT_VALUE,diff --git a/packages/core/src/shared/after-init-apply.ts b/packages/core/src/shared/after-init-apply.tsindex 6b3b7d055d..90cfc64c9a 100644--- a/packages/core/src/shared/after-init-apply.ts+++ b/packages/core/src/shared/after-init-apply.ts@@ -23,7 +23,7 @@ import { fromCallback } from './rxjs';export const afterInitApply = (commandService: ICommandService) => {return new Promise<void>((res) => {merge(- fromCallback(commandService.onCommandExecuted).pipe(filter(([info]) => {+ fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe(filter(([info]) => {return info.type === CommandType.MUTATION;})),timer(300)diff --git a/packages/core/src/shared/rxjs.ts b/packages/core/src/shared/rxjs.tsindex 3465fc06ca..ea22df6f3e 100644--- a/packages/core/src/shared/rxjs.ts+++ b/packages/core/src/shared/rxjs.ts@@ -19,6 +19,15 @@ import { Observable } from 'rxjs';type CallbackFn<T extends readonly unknown[]> = (cb: (...args: T) => void) => IDisposable;+/**+ * Creates an observable from a callback function.+ *+ * @param callback The callback function that will be called when the observable is subscribed to. **Please not that the+ * if the callback function has `this` context, it will be lost when the callback is called. So you probably+ * should bind the callback to the correct context.**+ *+ * @returns The observable that will emit when the callback function gets called.+ */export function fromCallback<T extends readonly unknown[]>(callback: CallbackFn<T>): Observable<T> {return new Observable((subscriber) => {const disposable: IDisposable | undefined = callback((...args: T) => subscriber.next(args));diff --git a/packages/core/src/univer.ts b/packages/core/src/univer.tsindex d677f63fac..9a5125bc70 100644--- a/packages/core/src/univer.ts+++ b/packages/core/src/univer.ts@@ -174,7 +174,7 @@ function createUniverInjector(parentInjector?: Injector, override?: DependencyOv[IUniverInstanceService, { useClass: UniverInstanceService }],[IPermissionService, { useClass: PermissionService }],[ILogService, { useClass: DesktopLogService, lazy: true }],- [ICommandService, { useClass: CommandService, lazy: true }],+ [ICommandService, { useClass: CommandService }],[IUndoRedoService, { useClass: LocalUndoRedoService, lazy: true }],[IConfigService, { useClass: ConfigService }],[IContextService, { useClass: ContextService }],diff --git a/packages/docs-ui/src/index.ts b/packages/docs-ui/src/index.tsindex 1faa26530e..53894f4c2f 100644--- a/packages/docs-ui/src/index.ts+++ b/packages/docs-ui/src/index.ts@@ -18,5 +18,6 @@ export * from './basics';export * from './docs-ui-plugin';export { DocRenderController } from './controllers/render-controllers/doc.render-controller';export * from './services';+export { DocsRenderService } from './services/docs-render.service';export { DocCanvasPopManagerService } from './services/doc-popup-manager.service';export { docDrawingPositionToTransform, transformToDocDrawingPosition } from './basics/transform-position';diff --git a/packages/engine-render/docs/render-unit.excalidraw b/packages/engine-render/docs/render-unit.excalidrawindex 1a4177b63c..f515e39eb0 100644--- a/packages/engine-render/docs/render-unit.excalidraw+++ b/packages/engine-render/docs/render-unit.excalidraw@@ -4,63 +4,63 @@"source": "https://marketplace.visualstudio.com/items?itemName=pomdtr.excalidraw-editor","elements": [{- "id": "IBVejM0r0TQVE-0-p3RxE","type": "rectangle",- "x": 91.83155737142101,- "y": 220.13715350011813,- "width": 829.3333740234375,- "height": 489.99999999999994,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 99,+ "versionNonce": 1365776174,+ "isDeleted": false,+ "id": "IBVejM0r0TQVE-0-p3RxE","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "dashed","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 78.97441451427824,+ "y": 230.61335850848866,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 829.3333740234375,+ "height": 489.99999999999994,+ "seed": 1879243605,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},- "seed": 1879243605,- "version": 92,- "versionNonce": 1266388603,- "isDeleted": false,"boundElements": [{"id": "jc7ODye4ptpQd167_PYRv","type": "arrow"}],- "updated": 1714274868727,+ "updated": 1718607813225,"link": null,"locked": false},{- "id": "KEWFTg8JZggzBDocaVvJd","type": "rectangle",- "x": 131.7574267833137,- "y": 631.2482646112292,- "width": 745.9260050455729,- "height": 45.92597113715283,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 97,+ "versionNonce": 2004001710,+ "isDeleted": false,+ "id": "KEWFTg8JZggzBDocaVvJd","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 118.90028392617091,+ "y": 641.7244696195996,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 745.9260050455729,+ "height": 45.92597113715283,+ "seed": 929366709,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},- "seed": 929366709,- "version": 90,- "versionNonce": 1086797883,- "isDeleted": false,"boundElements": [{"type": "text",@@ -83,70 +83,70 @@"type": "arrow"}],- "updated": 1714274866577,+ "updated": 1718607813225,"link": null,"locked": false},{- "id": "Up3wzUquRvDnRNpQUaVzr","type": "text",- "x": 392.6805199433072,- "y": 641.7112501798056,- "width": 224.07981872558594,- "height": 25,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 74,+ "versionNonce": 1023278574,+ "isDeleted": false,+ "id": "Up3wzUquRvDnRNpQUaVzr","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 379.82337708616444,+ "y": 652.187455188176,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 224.07981872558594,+ "height": 25,+ "seed": 1638851125,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,- "seed": 1638851125,- "version": 67,- "versionNonce": 1500764085,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866443,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "text": "IRenderManagerService","fontSize": 20,"fontFamily": 1,+ "text": "IRenderManagerService","textAlign": "center","verticalAlign": "middle",- "baseline": 17,"containerId": "KEWFTg8JZggzBDocaVvJd","originalText": "IRenderManagerService",- "lineHeight": 1.25+ "lineHeight": 1.25,+ "baseline": 20},{- "id": "MRTrbIVi5I2EBhrQxSsSb","type": "ellipse",- "x": 519.9055188748937,- "y": 549.026042500118,- "width": 121.48145887586801,- "height": 48.888888888888914,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 392,+ "versionNonce": 1906018606,+ "isDeleted": false,+ "id": "MRTrbIVi5I2EBhrQxSsSb","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 507.0483760177509,+ "y": 559.5022475084886,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 121.48145887586801,+ "height": 48.888888888888914,+ "seed": 1697074453,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 1697074453,- "version": 385,- "versionNonce": 1964234037,- "isDeleted": false,"boundElements": [{"type": "text",@@ -161,50 +161,50 @@"type": "arrow"}],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false},{- "id": "Kwe2mTHNGPbwifimOXvPM","type": "text",- "x": 542.8660953195706,- "y": 561.185654515558,- "width": 75.65994262695312,- "height": 25,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 519,+ "versionNonce": 468595566,+ "isDeleted": false,+ "id": "Kwe2mTHNGPbwifimOXvPM","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 530.0089524624278,+ "y": 571.6618595239286,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 75.65994262695312,+ "height": 25,+ "seed": 397215797,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,- "seed": 397215797,- "version": 512,- "versionNonce": 1856857749,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866443,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "text": "IRender","fontSize": 20,"fontFamily": 1,+ "text": "IRender","textAlign": "center","verticalAlign": "middle",- "baseline": 17,"containerId": "MRTrbIVi5I2EBhrQxSsSb","originalText": "IRender",- "lineHeight": 1.25+ "lineHeight": 1.25,+ "baseline": 20},{"type": "ellipse",- "version": 396,- "versionNonce": 269030069,+ "version": 403,+ "versionNonce": 2123268654,"isDeleted": false,"id": "za2rn7AFBmFoI-51I40Jl","fillStyle": "solid",@@ -213,15 +213,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 613.238885659182,- "y": 490.507467356455,+ "x": 600.3817428020392,+ "y": 500.9836723648255,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 121.48145887586801,"height": 48.888888888888914,"seed": 449360437,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},@@ -239,14 +239,14 @@"type": "arrow"}],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 523,- "versionNonce": 1126102037,+ "version": 530,+ "versionNonce": 1645874286,"isDeleted": false,"id": "wTCVfYSq9-lJ3Q7XOZnTf","fillStyle": "solid",@@ -255,18 +255,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 636.1994621038589,- "y": 502.66707937189494,+ "x": 623.3423192467161,+ "y": 513.1432843802654,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 75.65994262695312,"height": 25,"seed": 599696277,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -277,12 +277,12 @@"containerId": "za2rn7AFBmFoI-51I40Jl","originalText": "IRender","lineHeight": 1.25,- "baseline": 17+ "baseline": 20},{"type": "ellipse",- "version": 405,- "versionNonce": 900960309,+ "version": 412,+ "versionNonce": 1908210478,"isDeleted": false,"id": "tRUJ3yhRUAChJJdmoboEM","fillStyle": "solid",@@ -291,15 +291,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 689.5352045610916,- "y": 558.65569462425,+ "x": 676.6780617039489,+ "y": 569.1318996326206,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 121.48145887586801,"height": 48.888888888888914,"seed": 278855643,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},@@ -313,14 +313,14 @@"type": "arrow"}],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 533,- "versionNonce": 429769109,+ "version": 540,+ "versionNonce": 990995822,"isDeleted": false,"id": "kCW2Dq4fbHGYXL9zFlh5R","fillStyle": "solid",@@ -329,18 +329,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 712.4957810057685,- "y": 570.81530663969,+ "x": 699.6386381486258,+ "y": 581.2915116480606,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 75.65994262695312,"height": 25,"seed": 302533755,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -351,12 +351,12 @@"containerId": "tRUJ3yhRUAChJJdmoboEM","originalText": "IRender","lineHeight": 1.25,- "baseline": 17+ "baseline": 20},{"type": "ellipse",- "version": 436,- "versionNonce": 1129324629,+ "version": 443,+ "versionNonce": 1632461294,"isDeleted": false,"id": "vmPLfAnG1ul50xcKUSwOR","fillStyle": "solid",@@ -365,15 +365,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 765.831455646161,- "y": 500.50756908171536,+ "x": 752.9743127890182,+ "y": 510.9837740900859,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 121.48145887586801,"height": 48.888888888888914,"seed": 1777031381,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},@@ -387,14 +387,14 @@"type": "arrow"}],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 564,- "versionNonce": 1098075573,+ "version": 571,+ "versionNonce": 291959854,"isDeleted": false,"id": "CQMwkK1CaPE6YOPDK9aPm","fillStyle": "solid",@@ -403,18 +403,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 788.7920320908379,- "y": 512.6671810971553,+ "x": 775.9348892336951,+ "y": 523.1433861055259,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 75.65994262695312,"height": 25,"seed": 1360229941,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -425,32 +425,32 @@"containerId": "vmPLfAnG1ul50xcKUSwOR","originalText": "IRender","lineHeight": 1.25,- "baseline": 17+ "baseline": 20},{- "id": "PlFtNF4_Nc-UXjNYQGGpd","type": "rectangle",- "x": 147.3130162472894,- "y": 283.84086850662857,- "width": 285.18520779079864,- "height": 40.00000000000001,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 106,+ "versionNonce": 1629372590,+ "isDeleted": false,+ "id": "PlFtNF4_Nc-UXjNYQGGpd","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 134.45587339014662,+ "y": 294.3170735149991,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 285.18520779079864,+ "height": 40.00000000000001,+ "seed": 1440702741,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},- "seed": 1440702741,- "version": 99,- "versionNonce": 839459957,- "isDeleted": false,"boundElements": [{"type": "text",@@ -465,85 +465,74 @@"type": "arrow"}],- "updated": 1714274866443,+ "updated": 1718607813225,"link": null,"locked": false},{- "id": "OY0qyzruohmafJysXk5-Q","type": "text",- "x": 178.3357272593879,- "y": 291.34086850662857,- "width": 223.13978576660156,- "height": 25,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 92,+ "versionNonce": 154008302,+ "isDeleted": false,+ "id": "OY0qyzruohmafJysXk5-Q","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 165.47858440224513,+ "y": 301.8170735149991,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 223.13978576660156,+ "height": 25,+ "seed": 718783541,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,- "seed": 718783541,- "version": 85,- "versionNonce": 1454820821,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866443,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "text": "ColumnHeaderController","fontSize": 20,"fontFamily": 1,+ "text": "ColumnHeaderController","textAlign": "center","verticalAlign": "middle",- "baseline": 17,"containerId": "PlFtNF4_Nc-UXjNYQGGpd","originalText": "ColumnHeaderController",- "lineHeight": 1.25+ "lineHeight": 1.25,+ "baseline": 20},{- "id": "oxHm_eWq5qrkzaArcOFdh","type": "arrow",- "x": 284.84668982491235,- "y": 331.2482646112292,- "width": 244.50896265486745,- "height": 217.95199990563327,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 239,+ "versionNonce": 288979374,+ "isDeleted": false,+ "id": "oxHm_eWq5qrkzaArcOFdh","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 271.98954696776957,+ "y": 341.72446961959974,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 244.50896265486745,+ "height": 217.95199990563327,+ "seed": 168572437,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 168572437,- "version": 222,- "versionNonce": 1155310971,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866578,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "points": [- [- 0,- 0- ],- [- 244.50896265486745,- 217.95199990563327- ]- ],- "lastCommittedPoint": null,"startBinding": {"elementId": "PlFtNF4_Nc-UXjNYQGGpd","focus": 0.21696632056354012,@@ -554,53 +543,53 @@"focus": -0.3610680050675144,"gap": 9.77747106069502},+ "lastCommittedPoint": null,"startArrowhead": null,- "endArrowhead": "arrow"+ "endArrowhead": "arrow",+ "points": [+ [+ 0,+ 0+ ],+ [+ 244.50896265486745,+ 217.95199990563327+ ]+ ]},{- "id": "jcyX81arBvRpKolPh3ECc","type": "arrow",- "x": 376.61412424297396,- "y": 331.2482646112292,- "width": 261.04444411996496,- "height": 153.97031788335522,- "angle": 0,- "strokeColor": "#e03131",- "backgroundColor": "transparent",+ "version": 177,+ "versionNonce": 1668944878,+ "isDeleted": false,+ "id": "jcyX81arBvRpKolPh3ECc","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 363.7569813858312,+ "y": 341.72446961959974,+ "strokeColor": "#e03131",+ "backgroundColor": "transparent",+ "width": 261.04444411996496,+ "height": 153.97031788335522,+ "seed": 1657708219,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 1657708219,- "version": 160,- "versionNonce": 99074747,- "isDeleted": false,"boundElements": [{"type": "text","id": "v-DFW4N_zizeBk587RJpL"}],- "updated": 1714274866578,+ "updated": 1718607813225,"link": null,"locked": false,- "points": [- [- 0,- 0- ],- [- 261.04444411996496,- 153.97031788335522- ]- ],- "lastCommittedPoint": null,"startBinding": {"elementId": "PlFtNF4_Nc-UXjNYQGGpd","focus": -0.2279955211858477,@@ -611,84 +600,84 @@"focus": 0.19160883165664302,"gap": 9.75451902242311},+ "lastCommittedPoint": null,"startArrowhead": null,- "endArrowhead": "arrow"+ "endArrowhead": "arrow",+ "points": [+ [+ 0,+ 0+ ],+ [+ 261.04444411996496,+ 153.97031788335522+ ]+ ]},{- "id": "v-DFW4N_zizeBk587RJpL","type": "text",- "x": 582.4548514925706,- "y": 363.6240478305666,- "width": 165.6998748779297,- "height": 25,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 37,+ "versionNonce": 1527600882,+ "isDeleted": false,+ "id": "v-DFW4N_zizeBk587RJpL","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 582.4548514925706,+ "y": 363.6240478305666,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 165.6998748779297,+ "height": 25,+ "seed": 600446363,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,- "seed": 600446363,- "version": 35,- "versionNonce": 1782639605,- "isDeleted": false,- "boundElements": null,- "updated": 1714274835999,+ "boundElements": [],+ "updated": 1718607812247,"link": null,"locked": false,- "text": "Fails to connect!","fontSize": 20,"fontFamily": 1,+ "text": "Fails to connect!","textAlign": "center","verticalAlign": "middle",- "baseline": 17,"containerId": "jcyX81arBvRpKolPh3ECc","originalText": "Fails to connect!",- "lineHeight": 1.25+ "lineHeight": 1.25,+ "baseline": 20},{- "id": "tDllldNgZGPRuDlBspG4N","type": "arrow",- "x": 525.4460507435656,- "y": 594.9362583896415,- "width": 27.65038433606469,- "height": 31.12679843078911,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 208,+ "versionNonce": 1328375342,+ "isDeleted": false,+ "id": "tDllldNgZGPRuDlBspG4N","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 512.5889078864228,+ "y": 605.412463398012,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 27.65038433606469,+ "height": 31.12679843078911,+ "seed": 207098427,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 207098427,- "version": 191,- "versionNonce": 641503227,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866578,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "points": [- [- 0,- 0- ],- [- -27.65038433606469,- 31.12679843078911- ]- ],- "lastCommittedPoint": null,"startBinding": {"elementId": "MRTrbIVi5I2EBhrQxSsSb","focus": 0.5601365346114884,@@ -699,48 +688,48 @@"focus": -0.08117017349776119,"gap": 5.185207790798586},+ "lastCommittedPoint": null,"startArrowhead": null,- "endArrowhead": "arrow"+ "endArrowhead": "arrow",+ "points": [+ [+ 0,+ 0+ ],+ [+ -27.65038433606469,+ 31.12679843078911+ ]+ ]},{- "id": "44g_3EKFT_LBf3pYbhcrW","type": "arrow",- "x": 671.2470009506276,- "y": 543.1191954377834,- "width": 13.479010020929422,- "height": 79.24018028455691,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 222,+ "versionNonce": 87847022,+ "isDeleted": false,+ "id": "44g_3EKFT_LBf3pYbhcrW","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 658.3898580934848,+ "y": 553.5954004461539,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 13.479010020929422,+ "height": 79.24018028455691,+ "seed": 1935129269,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 1935129269,- "version": 205,- "versionNonce": 1127157051,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866578,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "points": [- [- 0,- 0- ],- [- -13.479010020929422,- 79.24018028455691- ]- ],- "lastCommittedPoint": null,"startBinding": {"elementId": "za2rn7AFBmFoI-51I40Jl","focus": -0.03381461850579168,@@ -751,48 +740,48 @@"focus": 0.39172610019025456,"gap": 8.8888888888888},+ "lastCommittedPoint": null,"startArrowhead": null,- "endArrowhead": "arrow"+ "endArrowhead": "arrow",+ "points": [+ [+ 0,+ 0+ ],+ [+ -13.479010020929422,+ 79.24018028455691+ ]+ ]},{- "id": "AT2cJA5Y8I3o21KUGizN1","type": "arrow",- "x": 749.5352384695116,- "y": 608.2852790426529,- "width": 3.7037489149304292,- "height": 14.814860026041629,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 105,+ "versionNonce": 829436590,+ "isDeleted": false,+ "id": "AT2cJA5Y8I3o21KUGizN1","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 736.6780956123688,+ "y": 618.7614840510234,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 3.7037489149304292,+ "height": 14.814860026041629,+ "seed": 541526165,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 541526165,- "version": 88,- "versionNonce": 99593691,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866578,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "points": [- [- 0,- 0- ],- [- -3.7037489149304292,- 14.814860026041629- ]- ],- "lastCommittedPoint": null,"startBinding": {"elementId": "tRUJ3yhRUAChJJdmoboEM","focus": -0.09100549654888022,@@ -803,48 +792,48 @@"focus": 0.6161364379120247,"gap": 8.148125542534672},+ "lastCommittedPoint": null,"startArrowhead": null,- "endArrowhead": "arrow"+ "endArrowhead": "arrow",+ "points": [+ [+ 0,+ 0+ ],+ [+ -3.7037489149304292,+ 14.814860026041629+ ]+ ]},{- "id": "qfOjrJlcQr4ehDYe3G_RI","type": "arrow",- "x": 843.247909510083,- "y": 550.6099093825718,- "width": 0.1595555161794664,- "height": 70.26800746390052,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 172,+ "versionNonce": 510766318,+ "isDeleted": false,+ "id": "qfOjrJlcQr4ehDYe3G_RI","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 830.3907666529402,+ "y": 561.0861143909424,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 0.1595555161794664,+ "height": 70.26800746390052,+ "seed": 1244445787,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 1244445787,- "version": 155,- "versionNonce": 492581659,- "isDeleted": false,- "boundElements": null,- "updated": 1714274866578,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "points": [- [- 0,- 0- ],- [- 0.1595555161794664,- 70.26800746390052- ]- ],- "lastCommittedPoint": null,"startBinding": {"elementId": "vmPLfAnG1ul50xcKUSwOR","focus": -0.2735801332226862,@@ -855,13 +844,24 @@"focus": 0.9081741861799392,"gap": 10.370347764756843},+ "lastCommittedPoint": null,"startArrowhead": null,- "endArrowhead": "arrow"+ "endArrowhead": "arrow",+ "points": [+ [+ 0,+ 0+ ],+ [+ 0.1595555161794664,+ 70.26800746390052+ ]+ ]},{"type": "rectangle",- "version": 156,- "versionNonce": 1050700731,+ "version": 361,+ "versionNonce": 1506402094,"isDeleted": false,"id": "rz9Fdsy8H7oWjot8Dsnpr","fillStyle": "solid",@@ -870,15 +870,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1164.9868614449183,- "y": 185.85964676285744,+ "x": 77.19659958777578,+ "y": 779.5023498181026,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 829.3333740234375,"height": 570.868021082176,"seed": 695485173,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},@@ -888,14 +888,14 @@"type": "arrow"}],- "updated": 1714274868727,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "rectangle",- "version": 120,- "versionNonce": 2061898773,+ "version": 312,+ "versionNonce": 402811822,"isDeleted": false,"id": "78JwqCbYWieixUBaq4vy9","fillStyle": "solid",@@ -904,15 +904,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1203.7234584263397,- "y": 598.1600303044397,+ "x": 115.93319656919715,+ "y": 1191.8027333596847,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 745.9260050455729,"height": 45.92597113715283,"seed": 540679253,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},@@ -920,32 +920,16 @@{"type": "text","id": "fKa9_Y7NiiFZWnvyPKaMq"- },- {- "id": "SjFTcsbt6plduhRD6v2eU",- "type": "arrow"- },- {- "id": "v5cTF76fez4IUzEl4KJWK",- "type": "arrow"- },- {- "id": "T22CXB2qfbQGxs0PBPsb2",- "type": "arrow"- },- {- "id": "jgLPxPPq25tNHGNudN4zK",- "type": "arrow"}],- "updated": 1714274835999,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 97,- "versionNonce": 491037627,+ "version": 285,+ "versionNonce": 1213515246,"isDeleted": false,"id": "fKa9_Y7NiiFZWnvyPKaMq","fillStyle": "solid",@@ -954,18 +938,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1464.6465515863333,- "y": 608.6230158730161,+ "x": 376.8562897291908,+ "y": 1202.2657189282613,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 224.07981872558594,"height": 25,"seed": 1740491189,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274835999,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -976,12 +960,12 @@"containerId": "78JwqCbYWieixUBaq4vy9","originalText": "IRenderManagerService","lineHeight": 1.25,- "baseline": 17+ "baseline": 20},{"type": "ellipse",- "version": 501,- "versionNonce": 1100269941,+ "version": 690,+ "versionNonce": 1776408622,"isDeleted": false,"id": "8Mc9DL9Lrv2JSQwI2_b_5","fillStyle": "solid",@@ -990,15 +974,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1258.5382462489465,- "y": 254.03307535292674,+ "x": 170.74798439180398,+ "y": 847.6757784081719,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 291.0052974640376,"height": 197.46031746031753,"seed": 1361365781,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},@@ -1006,20 +990,16 @@{"type": "text","id": "onIL1G2FDTSi6QmEqtmpI"- },- {- "id": "SjFTcsbt6plduhRD6v2eU",- "type": "arrow"}],- "updated": 1714274835999,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 639,- "versionNonce": 1712223323,+ "version": 827,+ "versionNonce": 1955766894,"isDeleted": false,"id": "onIL1G2FDTSi6QmEqtmpI","fillStyle": "solid",@@ -1028,18 +1008,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1352.1250247496264,- "y": 287.95046933736603,+ "x": 264.33476289248387,+ "y": 881.5931723926112,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 104.05992126464844,"height": 25,"seed": 1826922613,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -1050,12 +1030,12 @@"containerId": "8Mc9DL9Lrv2JSQwI2_b_5","originalText": "RenderUnit","lineHeight": 1.25,- "baseline": 17+ "baseline": 20},{"type": "ellipse",- "version": 492,- "versionNonce": 528863957,+ "version": 681,+ "versionNonce": 2066752686,"isDeleted": false,"id": "EATsYMKTgP7uvlNEQ4cdt","fillStyle": "solid",@@ -1064,15 +1044,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1603.3001844618063,- "y": 315.5145002092638,+ "x": 515.5099226046638,+ "y": 909.157203264509,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 121.48145887586801,"height": 85,"seed": 549636565,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},@@ -1080,20 +1060,16 @@{"type": "text","id": "Iamvp-3VSUg2kE4tvqRgE"- },- {- "id": "v5cTF76fez4IUzEl4KJWK",- "type": "arrow"}],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 628,- "versionNonce": 1653944571,+ "version": 816,+ "versionNonce": 1331912430,"isDeleted": false,"id": "Iamvp-3VSUg2kE4tvqRgE","fillStyle": "solid",@@ -1102,18 +1078,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1631.7107578547254,- "y": 332.96246200883553,+ "x": 543.9204959975829,+ "y": 926.6051650640807,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 64.75994873046875,"height": 50,"seed": 2111096629,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -1124,12 +1100,12 @@"containerId": "EATsYMKTgP7uvlNEQ4cdt","originalText": "RenderUnit","lineHeight": 1.25,- "baseline": 42+ "baseline": 45},{"type": "ellipse",- "version": 473,- "versionNonce": 558805045,+ "version": 662,+ "versionNonce": 632639790,"isDeleted": false,"id": "5To1jdAnBtcc5zszQBkYM","fillStyle": "solid",@@ -1138,15 +1114,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1735.7868632967516,- "y": 409.3770131913443,+ "x": 647.996601439609,+ "y": 1003.0197162465895,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 121.48145887586801,"height": 85,"seed": 1451235477,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},@@ -1154,20 +1130,16 @@{"type": "text","id": "-ScLYn7Ifj8Rqb0FvM8FW"- },- {- "id": "jgLPxPPq25tNHGNudN4zK",- "type": "arrow"}],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 611,- "versionNonce": 1683708315,+ "version": 799,+ "versionNonce": 965671790,"isDeleted": false,"id": "-ScLYn7Ifj8Rqb0FvM8FW","fillStyle": "solid",@@ -1176,18 +1148,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1764.1974366896707,- "y": 426.824974990916,+ "x": 676.4071748325281,+ "y": 1020.4676780461612,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 64.75994873046875,"height": 50,"seed": 343555573,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -1198,12 +1170,12 @@"containerId": "5To1jdAnBtcc5zszQBkYM","originalText": "RenderUnit","lineHeight": 1.25,- "baseline": 42+ "baseline": 45},{"type": "ellipse",- "version": 521,- "versionNonce": 617931157,+ "version": 710,+ "versionNonce": 1899584942,"isDeleted": false,"id": "UwXy1GEREQwLvgJHn7QrF","fillStyle": "solid",@@ -1212,15 +1184,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1828.273561507937,- "y": 297.8954961867562,+ "x": 740.4832996507945,+ "y": 891.5381992420014,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 121.48145887586801,"height": 85,"seed": 1321776981,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},@@ -1228,20 +1200,16 @@{"type": "text","id": "cfg0GfbnR_Umv8teYzGnK"- },- {- "id": "T22CXB2qfbQGxs0PBPsb2",- "type": "arrow"}],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 659,- "versionNonce": 1754492475,+ "version": 847,+ "versionNonce": 31291374,"isDeleted": false,"id": "cfg0GfbnR_Umv8teYzGnK","fillStyle": "solid",@@ -1250,18 +1218,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1856.6841349008562,- "y": 315.3434579863279,+ "x": 768.8938730437136,+ "y": 908.986161041573,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 64.75994873046875,"height": 50,"seed": 532743349,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -1272,12 +1240,12 @@"containerId": "UwXy1GEREQwLvgJHn7QrF","originalText": "RenderUnit","lineHeight": 1.25,- "baseline": 42+ "baseline": 45},{"type": "arrow",- "version": 447,- "versionNonce": 154154011,+ "version": 1005,+ "versionNonce": 327436846,"isDeleted": false,"id": "SjFTcsbt6plduhRD6v2eU","fillStyle": "solid",@@ -1286,32 +1254,24 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1403.8732253847531,- "y": 460.6708975523097,+ "x": 316.0829635276106,+ "y": 1054.3136006075547,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 116.18427633471083,"height": 132.3039249613313,"seed": 1838495989,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,- "startBinding": {- "elementId": "8Mc9DL9Lrv2JSQwI2_b_5",- "gap": 9.177568135052496,- "focus": 0.5601365346114884- },- "endBinding": {- "elementId": "78JwqCbYWieixUBaq4vy9",- "gap": 5.1852077907986995,- "focus": -0.08117017349776107- },+ "startBinding": null,+ "endBinding": null,"lastCommittedPoint": null,"startArrowhead": null,"endArrowhead": "arrow",@@ -1328,8 +1288,8 @@},{"type": "arrow",- "version": 419,- "versionNonce": 137424661,+ "version": 977,+ "versionNonce": 1695994990,"isDeleted": false,"id": "v5cTF76fez4IUzEl4KJWK","fillStyle": "solid",@@ -1338,32 +1298,24 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1676.2196961376676,- "y": 403.42927957067013,+ "x": 588.429434280525,+ "y": 997.0719826259153,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 41.46618498778844,"height": 185.84186184488078,"seed": 1624003157,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,- "startBinding": {- "elementId": "EATsYMKTgP7uvlNEQ4cdt",- "focus": -0.03381461850579475,- "gap": 3.746988344428633- },- "endBinding": {- "elementId": "78JwqCbYWieixUBaq4vy9",- "focus": 0.39172610019025556,- "gap": 8.8888888888888- },+ "startBinding": null,+ "endBinding": null,"lastCommittedPoint": null,"startArrowhead": null,"endArrowhead": "arrow",@@ -1380,8 +1332,8 @@},{"type": "arrow",- "version": 220,- "versionNonce": 48822459,+ "version": 778,+ "versionNonce": 1885214382,"isDeleted": false,"id": "jgLPxPPq25tNHGNudN4zK","fillStyle": "solid",@@ -1390,32 +1342,24 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1803.2577809280156,- "y": 495.1177946347682,+ "x": 715.467519070873,+ "y": 1088.7604976900134,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 2.7357477831142205,"height": 94.89411012713674,"seed": 77152181,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,- "startBinding": {- "elementId": "5To1jdAnBtcc5zszQBkYM",- "focus": -0.09100549654888396,- "gap": 1- },- "endBinding": {- "elementId": "78JwqCbYWieixUBaq4vy9",- "focus": 0.6161364379120272,- "gap": 8.148125542534785- },+ "startBinding": null,+ "endBinding": null,"lastCommittedPoint": null,"startArrowhead": null,"endArrowhead": "arrow",@@ -1432,8 +1376,8 @@},{"type": "arrow",- "version": 349,- "versionNonce": 919356533,+ "version": 907,+ "versionNonce": 235081966,"isDeleted": false,"id": "T22CXB2qfbQGxs0PBPsb2","fillStyle": "solid",@@ -1442,32 +1386,24 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1907.243294893115,- "y": 383.11737610058196,+ "x": 819.4530330359725,+ "y": 976.760079155827,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 7.689693996358983,"height": 204.6723064391008,"seed": 1864466709,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,- "startBinding": {- "elementId": "UwXy1GEREQwLvgJHn7QrF",- "focus": -0.27358013322268926,- "gap": 2.138854545565696- },- "endBinding": {- "elementId": "78JwqCbYWieixUBaq4vy9",- "focus": 0.9081741861799406,- "gap": 10.370347764756957- },+ "startBinding": null,+ "endBinding": null,"lastCommittedPoint": null,"startArrowhead": null,"endArrowhead": "arrow",@@ -1483,87 +1419,79 @@]},{- "id": "FYEC6rDC9nUZULAzb_Udx","type": "rectangle",- "x": 1345.4068936588428,- "y": 390.71230615036853,- "width": 115.19066323718017,- "height": 35,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 280,+ "versionNonce": 428786478,+ "isDeleted": false,+ "id": "FYEC6rDC9nUZULAzb_Udx","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 257.6166318017003,+ "y": 984.3550092056137,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 115.19066323718017,+ "height": 35,+ "seed": 1348360853,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},- "seed": 1348360853,- "version": 90,- "versionNonce": 2038012533,- "isDeleted": false,"boundElements": [{"type": "text","id": "0CSQ5x3TO5y-e-KhjNq1k"- },- {- "id": "WQheXZ0KSf53P5JJBTthX",- "type": "arrow"- },- {- "id": "Ght2mBCL-EhNs7QN7zdf5",- "type": "arrow"}],- "updated": 1714274854921,+ "updated": 1718607813225,"link": null,"locked": false},{- "id": "0CSQ5x3TO5y-e-KhjNq1k","type": "text",- "x": 1363.622258541593,- "y": 395.71230615036853,- "width": 78.75993347167969,- "height": 25,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 266,+ "versionNonce": 359279982,+ "isDeleted": false,+ "id": "0CSQ5x3TO5y-e-KhjNq1k","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 275.83199668445053,+ "y": 989.3550092056137,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 78.75993347167969,+ "height": 25,+ "seed": 1993298965,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,- "seed": 1993298965,- "version": 78,- "versionNonce": 370535893,- "isDeleted": false,- "boundElements": null,- "updated": 1714274836000,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,- "text": "Injector","fontSize": 20,"fontFamily": 1,+ "text": "Injector","textAlign": "center","verticalAlign": "middle",- "baseline": 17,"containerId": "FYEC6rDC9nUZULAzb_Udx","originalText": "Injector",- "lineHeight": 1.25+ "lineHeight": 1.25,+ "baseline": 20},{"type": "rectangle",- "version": 180,- "versionNonce": 1894270459,+ "version": 369,+ "versionNonce": 1323192238,"isDeleted": false,"id": "9V7ArbFM639eE6aUF98GS","fillStyle": "solid",@@ -1572,15 +1500,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1270.9159358672216,- "y": 327.3544313949746,+ "x": 183.12567401007908,+ "y": 920.9971344502196,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 265.0491995424694,"height": 35,"seed": 1156396149,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},@@ -1588,20 +1516,16 @@{"type": "text","id": "RB266YIk77btv51U9KXln"- },- {- "id": "WQheXZ0KSf53P5JJBTthX",- "type": "arrow"}],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 248,- "versionNonce": 623078197,+ "version": 436,+ "versionNonce": 34875886,"isDeleted": false,"id": "RB266YIk77btv51U9KXln","fillStyle": "solid",@@ -1610,18 +1534,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1291.8706427551556,- "y": 332.3544313949746,+ "x": 204.08038089801306,+ "y": 925.9971344502196,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 223.13978576660156,"height": 25,"seed": 312008149,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274836000,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -1632,36 +1556,41 @@"containerId": "9V7ArbFM639eE6aUF98GS","originalText": "ColumnHeaderController","lineHeight": 1.25,- "baseline": 17+ "baseline": 20},{- "id": "WQheXZ0KSf53P5JJBTthX","type": "arrow",- "x": 1410.9939243055246,- "y": 367.8166577043984,- "width": 12.085344415948612,- "height": 14.50243542809892,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 579,+ "versionNonce": 2115288110,+ "isDeleted": false,+ "id": "WQheXZ0KSf53P5JJBTthX","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 323.2036624483821,+ "y": 961.4593607596435,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 12.085344415948612,+ "height": 14.50243542809892,+ "seed": 1989669787,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 1989669787,- "version": 21,- "versionNonce": 1099157147,- "isDeleted": false,- "boundElements": null,- "updated": 1714274836000,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,+ "startBinding": null,+ "endBinding": null,+ "lastCommittedPoint": null,+ "startArrowhead": null,+ "endArrowhead": "arrow","points": [[0,@@ -1671,25 +1600,12 @@-12.085344415948612,14.50243542809892]- ],- "lastCommittedPoint": null,- "startBinding": {- "elementId": "9V7ArbFM639eE6aUF98GS",- "focus": -0.18142156941575915,- "gap": 5.462226309423784- },- "endBinding": {- "elementId": "FYEC6rDC9nUZULAzb_Udx",- "focus": -0.35566324078294237,- "gap": 8.393213017871233- },- "startArrowhead": null,- "endArrowhead": "arrow"+ ]},{"type": "rectangle",- "version": 183,- "versionNonce": 284377397,+ "version": 372,+ "versionNonce": 1221133934,"isDeleted": false,"id": "1lAbYsIz1BiAQDeEHbDvK","fillStyle": "solid",@@ -1698,15 +1614,15 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1437.9603733629324,- "y": 688.2085225711124,+ "x": 350.17011150578986,+ "y": 1281.8512256263575,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 287.1669168175475,"height": 41.19731883037922,"seed": 1031358971,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 3},@@ -1714,20 +1630,16 @@{"type": "text","id": "8DUwBNi3bEBiu1fgANZEL"- },- {- "id": "Ght2mBCL-EhNs7QN7zdf5",- "type": "arrow"}],- "updated": 1714274854921,+ "updated": 1718607813225,"link": null,"locked": false},{"type": "text",- "version": 226,- "versionNonce": 1008018485,+ "version": 414,+ "versionNonce": 1123682478,"isDeleted": false,"id": "8DUwBNi3bEBiu1fgANZEL","fillStyle": "solid",@@ -1736,18 +1648,18 @@"roughness": 1,"opacity": 100,"angle": 0,- "x": 1513.16388792405,- "y": 696.307181986302,+ "x": 425.37362606690743,+ "y": 1289.949885041547,"strokeColor": "#1e1e1e","backgroundColor": "transparent","width": 136.7598876953125,"height": 25,"seed": 1565807259,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": null,"boundElements": [],- "updated": 1714274852240,+ "updated": 1718607813225,"link": null,"locked": false,"fontSize": 20,@@ -1758,36 +1670,41 @@"containerId": "1lAbYsIz1BiAQDeEHbDvK","originalText": "UniverInjector","lineHeight": 1.25,- "baseline": 17+ "baseline": 20},{- "id": "Ght2mBCL-EhNs7QN7zdf5","type": "arrow",- "x": 1377.563521804376,- "y": 429.27638895879215,- "width": 88.31213021694543,- "height": 247.1190546866485,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 646,+ "versionNonce": 1280361198,+ "isDeleted": false,+ "id": "Ght2mBCL-EhNs7QN7zdf5","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "dashed","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 289.7732599472335,+ "y": 1022.9190920140372,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 88.31213021694543,+ "height": 247.1190546866485,+ "seed": 660912699,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 660912699,- "version": 88,- "versionNonce": 544735707,- "isDeleted": false,- "boundElements": null,- "updated": 1714274858282,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,+ "startBinding": null,+ "endBinding": null,+ "lastCommittedPoint": null,+ "startArrowhead": null,+ "endArrowhead": "arrow","points": [[0,@@ -1801,76 +1718,91 @@88.31213021694543,247.1190546866485]- ],- "lastCommittedPoint": null,- "startBinding": {- "elementId": "FYEC6rDC9nUZULAzb_Udx",- "focus": 0.4443940202958461,- "gap": 3.5640828084236205- },- "endBinding": {- "elementId": "1lAbYsIz1BiAQDeEHbDvK",- "focus": -0.574003345337201,- "gap": 11.813078925671846- },- "startArrowhead": null,- "endArrowhead": "arrow"+ ]},{- "id": "jc7ODye4ptpQd167_PYRv","type": "arrow",- "x": 939.5978622448522,- "y": 475.79750665693257,- "width": 210.49479640200855,- "height": 20.08024719798857,- "angle": 0,- "strokeColor": "#1e1e1e",- "backgroundColor": "transparent",+ "version": 539,+ "versionNonce": 1733702958,+ "isDeleted": false,+ "id": "jc7ODye4ptpQd167_PYRv","fillStyle": "solid","strokeWidth": 2,"strokeStyle": "solid","roughness": 1,"opacity": 100,+ "angle": 0,+ "x": 935.4073453642719,+ "y": 652.9403376418654,+ "strokeColor": "#1e1e1e",+ "backgroundColor": "transparent",+ "width": 124.28905341167888,+ "height": 178.33443535474203,+ "seed": 546149749,"groupIds": [],- "frameId": null,+ "frameId": "T2xq8kvbFC9W22HUWEU9K","roundness": {"type": 2},- "seed": 546149749,- "version": 114,- "versionNonce": 745813269,- "isDeleted": false,- "boundElements": null,- "updated": 1714274878142,+ "boundElements": [],+ "updated": 1718607813225,"link": null,"locked": false,+ "startBinding": {+ "elementId": "IBVejM0r0TQVE-0-p3RxE",+ "focus": -0.28756795373299066,+ "gap": 27.09955682655618+ },+ "endBinding": {+ "elementId": "rz9Fdsy8H7oWjot8Dsnpr",+ "focus": 0.12461063999254421,+ "gap": 24.234584371789197+ },+ "lastCommittedPoint": null,+ "startArrowhead": null,+ "endArrowhead": "arrow","points": [[0,0],[- 111.64626603040938,- -20.08024719798857+ 119.64626603040938,+ 91.91975280201143],[- 210.49479640200855,- -2.3784359831222446+ -4.6427873812695,+ 178.33443535474203]- ],- "lastCommittedPoint": null,- "startBinding": {- "elementId": "IBVejM0r0TQVE-0-p3RxE",- "focus": 0.2771006535957784,- "gap": 18.43293084999368- },- "endBinding": {- "elementId": "rz9Fdsy8H7oWjot8Dsnpr",- "focus": -0.21977447144204101,- "gap": 14.89420279805745- },- "startArrowhead": null,- "endArrowhead": "arrow"+ ]+ },+ {+ "id": "T2xq8kvbFC9W22HUWEU9K",+ "type": "frame",+ "x": 52.3698709797423,+ "y": 180.3885340572237,+ "width": 1009.0477207728793,+ "height": 1219.0475899832586,+ "angle": 0,+ "strokeColor": "#bbb",+ "backgroundColor": "transparent",+ "fillStyle": "solid",+ "strokeWidth": 2,+ "strokeStyle": "solid",+ "roughness": 0,+ "opacity": 100,+ "groupIds": [],+ "frameId": null,+ "roundness": null,+ "seed": 2075089966,+ "version": 81,+ "versionNonce": 2071389422,+ "isDeleted": false,+ "boundElements": null,+ "updated": 1718607813225,+ "link": null,+ "locked": false,+ "name": null}],"appState": {diff --git a/packages/facade/src/apis/__tests__/create-test-bed.ts b/packages/facade/src/apis/__tests__/create-test-bed.tsindex 8a48fb4388..a4a68bedf7 100644--- a/packages/facade/src/apis/__tests__/create-test-bed.ts+++ b/packages/facade/src/apis/__tests__/create-test-bed.ts@@ -48,7 +48,7 @@ import { Inject, Injector } from '@wendellhu/redi';import { Engine, IRenderingEngine, IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';import { ISelectionRenderService, SelectionRenderService, SheetRenderController, SheetSkeletonManagerService, SheetsRenderService } from '@univerjs/sheets-ui';-import { DesktopPlatformService, DesktopShortcutService, IPlatformService, IShortcutService } from '@univerjs/ui';+import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';import { SheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';import { FUniver } from '../facade';@@ -143,8 +143,8 @@ export function createFacadeTestBed(workbookData?: IWorkbookData, dependencies?:injector.add([IRenderManagerService, { useClass: RenderManagerService }]);injector.add([ISelectionRenderService, { useClass: SelectionRenderService }]);injector.add([SheetsRenderService]);- injector.add([IShortcutService, { useClass: DesktopShortcutService }]);- injector.add([IPlatformService, { useClass: DesktopPlatformService }]);+ injector.add([IShortcutService, { useClass: ShortcutService }]);+ injector.add([IPlatformService, { useClass: PlatformService }]);injector.add([SheetSkeletonManagerService]);injector.add([FormulaDataModel]);injector.add([LexerTreeBuilder]);diff --git a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts b/packages/facade/src/apis/docs/__tests__/create-test-bed.tsindex 96ffa9ad34..daa65b5be3 100644--- a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts+++ b/packages/facade/src/apis/docs/__tests__/create-test-bed.ts@@ -30,8 +30,8 @@ import type { Dependency } from '@wendellhu/redi';import { Inject, Injector } from '@wendellhu/redi';import { DocSkeletonManagerService, DocStateChangeManagerService, IMEInputManagerService, TextSelectionManagerService } from '@univerjs/docs';import { IRenderManagerService, ITextSelectionRenderManager, RenderManagerService, TextSelectionRenderManager } from '@univerjs/engine-render';+import { DocsRenderService } from '@univerjs/docs-ui';-import { DocsRenderService } from '@univerjs/docs-ui/services/docs-render.service.js';import { FUniver } from '../../facade';function getTestDocumentDataDemo(): IDocumentData {diff --git a/packages/find-replace/src/services/find-replace.service.ts b/packages/find-replace/src/services/find-replace.service.tsindex c24bd9e42b..65d9f85d3f 100644--- a/packages/find-replace/src/services/find-replace.service.ts+++ b/packages/find-replace/src/services/find-replace.service.ts@@ -15,7 +15,7 @@*/import type { Nullable } from '@univerjs/core';-import { Disposable, DisposableCollection, IContextService, ILogService, IUniverInstanceService, toDisposable } from '@univerjs/core';+import { Disposable, DisposableCollection, IContextService, IUniverInstanceService, toDisposable } from '@univerjs/core';import { RENDER_RAW_FORMULA_KEY } from '@univerjs/engine-render';import type { IDisposable } from '@wendellhu/redi';import { createIdentifier, Inject, Injector } from '@wendellhu/redi';@@ -207,8 +207,7 @@ export class FindReplaceModel extends Disposable {constructor(private readonly _state: FindReplaceState,private readonly _providers: Set<IFindReplaceProvider>,- @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,- @ILogService private readonly _logService: ILogService+ @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService) {super();diff --git a/packages/sheets-conditional-formatting-ui/src/index.ts b/packages/sheets-conditional-formatting-ui/src/index.tsindex b769076633..e8d5b95762 100644--- a/packages/sheets-conditional-formatting-ui/src/index.ts+++ b/packages/sheets-conditional-formatting-ui/src/index.ts@@ -14,6 +14,7 @@* limitations under the License.*/+export { UniverSheetsConditionalFormattingMobileUIPlugin } from './mobile-plugin';export { UniverSheetsConditionalFormattingUIPlugin } from './plugin';export { AddCfCommand } from './commands/commands/add-cf.command';export type { IAddCfCommandParams } from './commands/commands/add-cf.command';diff --git a/packages/sheets-conditional-formatting-ui/src/mobile-plugin.ts b/packages/sheets-conditional-formatting-ui/src/mobile-plugin.tsnew file mode 100644index 0000000000..a011accf03--- /dev/null+++ b/packages/sheets-conditional-formatting-ui/src/mobile-plugin.ts@@ -0,0 +1,96 @@+/**+ * 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 { ICommandService, Plugin, Tools, UniverInstanceType } from '@univerjs/core';+import { Inject, Injector } from '@wendellhu/redi';+import { SHEET_CONDITIONAL_FORMATTING_PLUGIN, SheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';+import { AddAverageCfCommand } from './commands/commands/add-average-cf.command';+import { AddColorScaleConditionalRuleCommand } from './commands/commands/add-color-scale-cf.command';+import { AddDataBarConditionalRuleCommand } from './commands/commands/add-data-bar-cf.command';+import { AddDuplicateValuesCfCommand } from './commands/commands/add-duplicate-values-cf.command';+import { AddNumberCfCommand } from './commands/commands/add-number-cf.command';+import { AddRankCfCommand } from './commands/commands/add-rank-cf.command';+import { AddTextCfCommand } from './commands/commands/add-text-cf.command';+import { AddTimePeriodCfCommand } from './commands/commands/add-time-period-cf.command';+import { AddUniqueValuesCfCommand } from './commands/commands/add-unique-values-cf.command';+import { ClearRangeCfCommand } from './commands/commands/clear-range-cf.command';+import { ClearWorksheetCfCommand } from './commands/commands/clear-worksheet-cf.command';+import { OpenConditionalFormattingOperator } from './commands/operations/open-conditional-formatting-panel';+import { DeleteCfCommand } from './commands/commands/delete-cf.command';+import { SetCfCommand } from './commands/commands/set-cf.command';+import { moveCfCommand } from './commands/commands/move-cf.command';+import { AddCfCommand } from './commands/commands/add-cf.command';++import { SheetsCfRenderController } from './controllers/cf.render.controller';+import { ConditionalFormattingCopyPasteController } from './controllers/cf.copy-paste.controller';+import type { IUniverSheetsConditionalFormattingUIConfig } from './controllers/cf.menu.controller';+import { DefaultSheetConditionalFormattingUiConfig } from './controllers/cf.menu.controller';+import { ConditionalFormattingI18nController } from './controllers/cf.i18n.controller';+import { SheetsCfRefRangeController } from './controllers/cf.ref-range.controller';+import { ConditionalFormattingPermissionController } from './controllers/cf.permission.controller';+import { UniverSheetsConditionalFormattingUIPlugin } from './plugin';++export class UniverSheetsConditionalFormattingMobileUIPlugin extends Plugin {+ static override pluginName = SHEET_CONDITIONAL_FORMATTING_PLUGIN;+ static override type = UniverInstanceType.UNIVER_SHEET;++ static commandList = [+ AddAverageCfCommand,+ AddColorScaleConditionalRuleCommand,+ AddDataBarConditionalRuleCommand,+ AddDuplicateValuesCfCommand,+ AddNumberCfCommand,+ AddRankCfCommand,+ AddTextCfCommand,+ AddTimePeriodCfCommand,+ AddUniqueValuesCfCommand,+ OpenConditionalFormattingOperator,+ DeleteCfCommand,+ SetCfCommand,+ moveCfCommand,+ AddCfCommand,+ ClearRangeCfCommand,+ ClearWorksheetCfCommand,+ ];++ constructor(+ private readonly _config: Partial<IUniverSheetsConditionalFormattingUIConfig> = {},+ @Inject(Injector) override readonly _injector: Injector,+ @Inject(ICommandService) private _commandService: ICommandService+ ) {+ super();+ this._config = Tools.deepMerge({}, DefaultSheetConditionalFormattingUiConfig, this._config);++ this._initCommand();+ SheetsConditionalFormattingPlugin.dependencyList.forEach((dependency) => {+ this._injector.add(dependency);+ });+ this._injector.add([SheetsCfRenderController]);+ this._injector.add([SheetsCfRefRangeController]);+ this._injector.add([ConditionalFormattingCopyPasteController]);+ this._injector.add([ConditionalFormattingPermissionController]);+ this._injector.add([ConditionalFormattingI18nController]);+ }++ private _initCommand() {+ [+ ...SheetsConditionalFormattingPlugin.mutationList,+ ...UniverSheetsConditionalFormattingUIPlugin.commandList,+ ].forEach((m) => {+ this._commandService.registerCommand(m);+ });+ }+}diff --git a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts b/packages/sheets-data-validation/src/controllers/dv-render.controller.tsindex a0545a7f4b..fb26c72f53 100644--- a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts+++ b/packages/sheets-data-validation/src/controllers/dv-render.controller.ts@@ -19,7 +19,7 @@ import { DataValidationRenderMode, DataValidationStatus, DataValidationType, ICoimport { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';import type { MenuConfig } from '@univerjs/ui';import { ComponentManager, IMenuService } from '@univerjs/ui';-import { Inject, Injector } from '@wendellhu/redi';+import { Inject, Injector, Optional } from '@wendellhu/redi';import { AutoHeightController, IEditorBridgeService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';import type { Spreadsheet } from '@univerjs/engine-render';import { IRenderManagerService } from '@univerjs/engine-render';@@ -49,15 +49,11 @@ const INVALID_MARK = {},};-/**- * @todo RenderUnit- */@OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationRenderController)export class SheetsDataValidationRenderController extends RxDisposable {constructor(private readonly _config: Partial<IUniverSheetsDataValidation>,@ICommandService private readonly _commandService: ICommandService,- @IEditorBridgeService private readonly _editorBridgeService: IEditorBridgeService,@IMenuService private _menuService: IMenuService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@@ -67,7 +63,8 @@ export class SheetsDataValidationRenderController extends RxDisposable {@Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,@Inject(DataValidatorRegistryService) private readonly _dataValidatorRegistryService: DataValidatorRegistryService,@Inject(Injector) private readonly _injector: Injector,- @Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService+ @Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService,+ @Optional(IEditorBridgeService) private readonly _editorBridgeService?: IEditorBridgeService) {super();@@ -125,12 +122,16 @@ export class SheetsDataValidationRenderController extends RxDisposable {}private _initDropdown() {+ if (!this._editorBridgeService) {+ return;+ }+this.disposeWithMe(this._editorBridgeService.visible$.subscribe((visible) => {if (!visible.visible) {return;}- const state = this._editorBridgeService.getEditCellState();+ const state = this._editorBridgeService!.getEditCellState();if (state) {const { unitId, sheetId, row, column } = state;const workbook = this._univerInstanceService.getUniverSheetInstance(unitId);@@ -357,3 +358,201 @@ export class SheetsDataValidationRenderController extends RxDisposable {});}}++// The mobile version does not provide the ability to change data validation model.+@OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationMobileRenderController)+export class SheetsDataValidationMobileRenderController extends RxDisposable {+ constructor(+ private readonly _config: Partial<IUniverSheetsDataValidation>,+ @ICommandService private readonly _commandService: ICommandService,+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,+ @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,+ @Inject(AutoHeightController) private readonly _autoHeightController: AutoHeightController,+ @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,+ @Inject(DataValidatorRegistryService) private readonly _dataValidatorRegistryService: DataValidatorRegistryService,+ @Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService+ ) {+ super();++ this._initSkeletonChange();+ this._initViewModelIntercept();+ this._initAutoHeight();+ }++ private _initSkeletonChange() {+ const markSkeletonDirty = () => {+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);+ if (!workbook) return;++ const unitId = workbook.getUnitId();+ const subUnitId = workbook.getActiveSheet()?.getSheetId();+ if (!subUnitId) return;++ const skeleton = this._renderManagerService.getRenderById(unitId)+ ?.with(SheetSkeletonManagerService).getUnitSkeleton(unitId, subUnitId)+ ?.skeleton;+ const currentRender = this._renderManagerService.getRenderById(unitId);++ skeleton?.makeDirty(true);+ skeleton?.calculate();++ if (currentRender) {+ (currentRender.mainComponent as Spreadsheet).makeForceDirty();+ }+ };++ this.disposeWithMe(this._dataValidationModel.ruleChange$.subscribe(() => markSkeletonDirty()));+ this.disposeWithMe(this._dataValidationModel.validStatusChange$.subscribe(() => markSkeletonDirty()));+ }++ // eslint-disable-next-line max-lines-per-function+ private _initViewModelIntercept() {+ this.disposeWithMe(+ this._sheetInterceptorService.intercept(+ INTERCEPTOR_POINT.CELL_CONTENT,+ {+ priority: 200,+ // eslint-disable-next-line max-lines-per-function+ handler: (cell, pos, next) => {+ const { row, col, unitId, subUnitId, workbook, worksheet } = pos;+ const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;+ if (!manager) {+ return next(cell);+ }++ const skeleton = this._renderManagerService.getRenderById(unitId)+ ?.with(SheetSkeletonManagerService).getUnitSkeleton(unitId, subUnitId)+ ?.skeleton;+ if (!skeleton) {+ return next(cell);+ }++ const styleMap = pos.workbook.getStyles();+ const defaultStyle = (typeof cell?.s === 'string' ? styleMap.get(cell?.s) : cell?.s) || {};+ const ruleId = manager.getRuleIdByLocation(row, col);+ if (!ruleId) {+ return next(cell);+ }+ const rule = manager.getRuleById(ruleId);++ if (!rule) {+ return next(cell);+ }+ const cellRaw = pos.worksheet.getCellRaw(pos.row, pos.col);+ const validStatus = this._dataValidationModel.validator(getCellValueOrigin(cellRaw), rule, pos);+ const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);+ const cellValue = getCellValueOrigin(cell);++ let extra: ICellDataForSheetInterceptor = {};+ if (rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) {+ extra = {+ interceptorStyle: {+ ...cell?.interceptorStyle,+ tb: (defaultStyle.tb !== WrapStrategy.OVERFLOW ? defaultStyle.tb : WrapStrategy.CLIP) ?? WrapStrategy.WRAP,+ },+ };+ }++ if (rule.type === DataValidationType.CHECKBOX) {+ const { formula2 } = (validator as CheckboxValidator).parseFormulaSync(rule, pos.unitId, pos.subUnitId);+ if (!cellValue) {+ extra = {+ v: formula2,+ t: 1,+ p: null,+ interceptorStyle: {+ ...cell?.interceptorStyle,+ tb: WrapStrategy.CLIP,+ },+ };+ }+ }++ if (rule.type === DataValidationType.LIST && (rule.renderMode === DataValidationRenderMode.ARROW || rule.renderMode === DataValidationRenderMode.TEXT)) {+ const colorMap = (validator as ListValidator).getListWithColorMap(rule);+ const valueStr = `${getCellValueOrigin(cell) ?? ''}`;+ const color = colorMap[valueStr];+ if (color) {+ extra = {+ ...extra,+ interceptorStyle: {+ ...extra.interceptorStyle,+ bg: {+ rgb: color,+ },+ },+ };+ }+ }++ return next({+ ...cell,+ ...extra,+ dataValidation: {+ ruleId,+ validStatus,+ rule,+ validator,+ },+ markers: {+ ...cell?.markers,+ ...validStatus === DataValidationStatus.INVALID ? INVALID_MARK : null,+ },+ customRender: [+ ...(cell?.customRender ?? []),+ ...(validator?.canvasRender ? [validator.canvasRender] : []),+ ],+ // @ts-ignore+ fontRenderExtension: {+ // @ts-ignore+ ...cell?.fontRenderExtension,+ isSkip: validator?.skipDefaultFontRender(rule, cellValue, pos),+ },+ interceptorStyle: {+ ...cell?.interceptorStyle,+ ...extra.interceptorStyle,+ },+ get interceptorAutoHeight() {+ const mergeCell = skeleton.mergeData.find((range) => {+ const { startColumn, startRow, endColumn, endRow } = range;+ return row >= startRow && col >= startColumn && row <= endRow && col <= endColumn;+ });++ const info: ICellRenderContext = {+ data: {+ ...cell,+ dataValidation: {+ ruleId,+ validStatus,+ rule,+ validator,+ },+ },+ style: skeleton.getsStyles().getStyleByCell(cell),+ primaryWithCoord: skeleton.getCellByIndex(mergeCell?.startRow ?? row, mergeCell?.startColumn ?? col),+ unitId,+ subUnitId,+ row,+ col,+ worksheet,+ workbook,+ };+ return validator?.canvasRender?.calcCellAutoHeight?.(info);+ },+ });+ },+ }+ )+ );+ }++ private _initAutoHeight() {+ this._dataValidationModel.ruleChange$.subscribe((info) => {+ if (info.rule?.ranges) {+ const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(info.rule.ranges);+ sequenceExecute(mutations.redos, this._commandService);+ }+ });+ }+}+diff --git a/packages/sheets-data-validation/src/index.ts b/packages/sheets-data-validation/src/index.tsindex 0cf15e03fd..36910beaa2 100644--- a/packages/sheets-data-validation/src/index.ts+++ b/packages/sheets-data-validation/src/index.ts@@ -15,6 +15,8 @@*/export { UniverSheetsDataValidationPlugin } from './plugin';+export { UniverSheetsDataValidationMobilePlugin } from './mobile-plugin';+export type { IAddSheetDataValidationCommandParams, IUpdateSheetDataValidationRangeCommandParams } from './commands/commands/data-validation.command';export { ICommandService, LocaleService, Plugin } from '@univerjs/core';export { SheetsDataValidationRenderController } from './controllers/dv-render.controller';diff --git a/packages/sheets-data-validation/src/mobile-plugin.ts b/packages/sheets-data-validation/src/mobile-plugin.tsnew file mode 100644index 0000000000..d3e1eb73d9--- /dev/null+++ b/packages/sheets-data-validation/src/mobile-plugin.ts@@ -0,0 +1,101 @@+/**+ * 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 { DependentOn, ICommandService, LocaleService, Plugin, Tools, UniverInstanceType } from '@univerjs/core';+import { type Dependency, Inject, Injector } from '@wendellhu/redi';+import { UniverDataValidationPlugin } from '@univerjs/data-validation';+import { UniverSheetsPlugin } from '@univerjs/sheets';+import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';+import type { IUniverSheetsDataValidation } from './controllers/dv-render.controller';+import { DefaultSheetsDataValidation, SheetsDataValidationMobileRenderController } from './controllers/dv-render.controller';+import { DataValidationController } from './controllers/dv.controller';+import { SheetDataValidationService } from './services/dv.service';+import { DataValidationAlertController } from './controllers/dv-alert.controller';+import { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, UpdateSheetDataValidationRangeCommand } from './commands/commands/data-validation.command';+import { DataValidationCacheService } from './services/dv-cache.service';+import { DataValidationFormulaService } from './services/dv-formula.service';+import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';+import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';+import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';+import { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';+import { DataValidationModelController } from './controllers/dv-model.controller';+import { DataValidationDropdownManagerService } from './services/dropdown-manager.service';+import { CloseValidationPanelOperation, HideDataValidationDropdown, OpenValidationPanelOperation, ShowDataValidationDropdown, ToggleValidationPanelOperation } from './commands/operations/data-validation.operation';+import { DataValidationPanelService } from './services/data-validation-panel.service';+import { DataValidationFormulaController } from './controllers/dv-formula.controller';+import { DataValidationPermissionController } from './controllers/dv-permission.controller';+import { SheetsDataValidationValidatorService } from './services/dv-validator-service';++@DependentOn(UniverDataValidationPlugin, UniverSheetsPlugin, UniverSheetsUIPlugin)+export class UniverSheetsDataValidationMobilePlugin extends Plugin {+ static override pluginName = DATA_VALIDATION_PLUGIN_NAME;+ static override type = UniverInstanceType.UNIVER_SHEET;++ constructor(+ private _config: Partial<IUniverSheetsDataValidation> = {},+ @Inject(Injector) protected _injector: Injector,+ @ICommandService private readonly _commandService: ICommandService,+ @Inject(LocaleService) private readonly _localeService: LocaleService+ ) {+ super();++ this._config = Tools.deepMerge({}, DefaultSheetsDataValidation, this._config);+ }++ override onStarting(injector: Injector) {+ ([+ [DataValidationPanelService],+ [SheetDataValidationService],+ [DataValidationCacheService],+ [DataValidationFormulaService],+ [DataValidationCustomFormulaService],+ [DataValidationDropdownManagerService],+ [SheetsDataValidationValidatorService],++ // controller+ [DataValidationModelController],+ [DataValidationController],+ [+ SheetsDataValidationMobileRenderController,+ {+ useFactory: () => this._injector.createInstance(SheetsDataValidationMobileRenderController, this._config),+ },+ ],+ [DataValidationAlertController],+ [DataValidationRefRangeController],+ [DataValidationPermissionController],+ [DataValidationCopyPasteController],+ [DataValidationFormulaController],+ ] as Dependency[]).forEach((dep) => {+ injector.add(dep);+ });++ [+ AddSheetDataValidationCommand,+ AddSheetDataValidationAndOpenCommand,+ UpdateSheetDataValidationRangeCommand,++ // operation+ ShowDataValidationDropdown,+ HideDataValidationDropdown,+ CloseValidationPanelOperation,+ OpenValidationPanelOperation,+ ToggleValidationPanelOperation,+ ].forEach((command) => {+ this._commandService.registerCommand(command);+ });+ }+}diff --git a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.tsindex 7c0395bb80..80b4ba5600 100644--- a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts+++ b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts@@ -19,7 +19,7 @@ import { AuthzIoLocalService, DisposableCollection, IAuthzIoService, ICommandSerimport { NORMAL_SELECTION_PLUGIN_NAME, RangeProtectionRuleModel, RefRangeService, SelectionManagerService, SetWorksheetActiveOperation, SheetInterceptorService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';import type { ISetSheetsFilterCriteriaMutationParams, ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filter';import { RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';-import { DesktopMenuService, DesktopPlatformService, DesktopShortcutService, IMenuService, IPlatformService, IShortcutService } from '@univerjs/ui';+import { IMenuService, IPlatformService, IShortcutService, MenuService, PlatformService, ShortcutService } from '@univerjs/ui';import { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, SmartToggleSheetsFilterCommand } from '../../commands/sheets-filter.command';@@ -61,11 +61,11 @@ function createSheetsFilterMenuTestBed() {}override onStarting(injector: Injector): void {- injector.add([IPlatformService, { useClass: DesktopPlatformService }]);+ injector.add([IPlatformService, { useClass: PlatformService }]);injector.add([RefRangeService]);injector.add([SelectionManagerService]);- injector.add([IShortcutService, { useClass: DesktopShortcutService }]);- injector.add([IMenuService, { useClass: DesktopMenuService }]);+ injector.add([IShortcutService, { useClass: ShortcutService }]);+ injector.add([IMenuService, { useClass: MenuService }]);injector.add([WorksheetPermissionService]);injector.add([WorksheetProtectionPointModel]);injector.add([WorkbookPermissionService]);diff --git a/packages/sheets-filter-ui/src/controllers/sheets-filter-mobile-ui.controller.ts b/packages/sheets-filter-ui/src/controllers/sheets-filter-mobile-ui.controller.tsnew file mode 100644index 0000000000..f538d85b74--- /dev/null+++ b/packages/sheets-filter-ui/src/controllers/sheets-filter-mobile-ui.controller.ts@@ -0,0 +1,35 @@+/**+ * 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 { LifecycleStages, runOnLifecycle, RxDisposable, UniverInstanceType } from '@univerjs/core';+import { IRenderManagerService } from '@univerjs/engine-render';+import { SheetsFilterRenderController } from './sheets-filter-render.controller';++export class SheetsFilterMobileUIController extends RxDisposable {+ constructor(+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService+ ) {+ super();++ this._initRenderControllers();+ }++ private _initRenderControllers(): void {+ this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, SheetsFilterRenderController));+ }+}++runOnLifecycle(LifecycleStages.Rendered, SheetsFilterMobileUIController);diff --git a/packages/sheets-filter-ui/src/controllers/sheets-filter-render.controller.ts b/packages/sheets-filter-ui/src/controllers/sheets-filter-render.controller.tsindex 0004def04b..77af222924 100644--- a/packages/sheets-filter-ui/src/controllers/sheets-filter-render.controller.ts+++ b/packages/sheets-filter-ui/src/controllers/sheets-filter-render.controller.ts@@ -93,7 +93,7 @@ export class SheetsFilterRenderController extends RxDisposable implements IRendeskeleton: skeletonParams.skeleton,});- return fromCallback(this._commandService.onCommandExecuted).pipe(+ return fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(filter(([command]) =>command.type === CommandType.MUTATION&& (command.params as ISheetCommandSharedParams).unitId === workbook.getUnitId()diff --git a/packages/sheets-filter-ui/src/controllers/sheets-filter-ui.controller.ts b/packages/sheets-filter-ui/src/controllers/sheets-filter-ui.controller.tsindex 348c560352..a7d2ebb35c 100644--- a/packages/sheets-filter-ui/src/controllers/sheets-filter-ui.controller.ts+++ b/packages/sheets-filter-ui/src/controllers/sheets-filter-ui.controller.ts@@ -15,7 +15,7 @@*/import type { Nullable } from '@univerjs/core';-import { ICommandService, IContextService, LifecycleStages, LocaleService, OnLifecycle, RxDisposable, UniverInstanceType } from '@univerjs/core';+import { ICommandService, IContextService, LifecycleStages, LocaleService, OnLifecycle } from '@univerjs/core';import { ComponentManager, IMenuService, IMessageService, IShortcutService } from '@univerjs/ui';import type { IMenuItemFactory, MenuConfig } from '@univerjs/ui';import type { IDisposable } from '@wendellhu/redi';@@ -34,7 +34,7 @@ import { ChangeFilterByOperation, CloseFilterPanelOperation, FILTER_PANEL_OPENEDimport { SheetsFilterPanelService } from '../services/sheets-filter-panel.service';import { SmartToggleFilterShortcut } from './sheets-filter.shortcut';import { ClearFilterCriteriaMenuItemFactory, ReCalcFilterMenuItemFactory, SmartToggleFilterMenuItemFactory } from './sheets-filter.menu';-import { SheetsFilterRenderController } from './sheets-filter-render.controller';+import { SheetsFilterMobileUIController } from './sheets-filter-mobile-ui.controller';export interface IUniverSheetsFilterUIConfig {menu: MenuConfig;@@ -48,7 +48,7 @@ export const FILTER_PANEL_POPUP_KEY = 'FILTER_PANEL_POPUP';* This controller controls the UI of "filter" features. Menus, commands and filter panel etc. Except for the rendering.*/@OnLifecycle(LifecycleStages.Ready, SheetsFilterUIController)-export class SheetsFilterUIController extends RxDisposable {+export class SheetsFilterUIController extends SheetsFilterMobileUIController {constructor(private readonly _config: Partial<IUniverSheetsFilterUIConfig>,@Inject(Injector) private readonly _injector: Injector,@@ -57,20 +57,19 @@ export class SheetsFilterUIController extends RxDisposable {@Inject(SheetCanvasPopManagerService) private _sheetCanvasPopupService: SheetCanvasPopManagerService,@Inject(SheetsFilterService) private _sheetsFilterService: SheetsFilterService,@Inject(LocaleService) private _localeService: LocaleService,- @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@IShortcutService private readonly _shortcutService: IShortcutService,@ICommandService private readonly _commandService: ICommandService,@IMenuService private readonly _menuService: IMenuService,@IContextService private readonly _contextService: IContextService,- @IMessageService private readonly _messageService: IMessageService+ @IMessageService private readonly _messageService: IMessageService,+ @IRenderManagerService _renderManagerService: IRenderManagerService) {- super();+ super(_renderManagerService);this._initCommands();this._initShortcuts();this._initMenuItems();this._initUI();- this._initRenderControllers();}override dispose(): void {@@ -135,10 +134,6 @@ export class SheetsFilterUIController extends RxDisposable {}));}- private _initRenderControllers(): void {- this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, SheetsFilterRenderController));- }-private _popupDisposable?: Nullable<IDisposable>;private _openFilterPopup(): void {const currentFilterModel = this._sheetsFilterPanelService.filterModel;diff --git a/packages/sheets-filter-ui/src/index.ts b/packages/sheets-filter-ui/src/index.tsindex b614825792..c46d99cb74 100644--- a/packages/sheets-filter-ui/src/index.ts+++ b/packages/sheets-filter-ui/src/index.ts@@ -15,6 +15,7 @@*/export { UniverSheetsFilterUIPlugin } from './plugin';+export { UniverSheetsFilterMobileUIPlugin } from './mobile-plugin';export { OpenFilterPanelOperation } from './commands/sheets-filter.operation';export type { IOpenFilterPanelOperationParams } from './commands/sheets-filter.operation';export { SmartToggleSheetsFilterCommand } from './commands/sheets-filter.command';diff --git a/packages/sheets-filter-ui/src/mobile-plugin.ts b/packages/sheets-filter-ui/src/mobile-plugin.tsnew file mode 100644index 0000000000..c7a82bbed0--- /dev/null+++ b/packages/sheets-filter-ui/src/mobile-plugin.ts@@ -0,0 +1,49 @@+/**+ * 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 { DependentOn, Plugin, Tools, UniverInstanceType } from '@univerjs/core';+import type { Dependency } from '@wendellhu/redi';+import { Inject, Injector } from '@wendellhu/redi';+import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';++import type { IUniverSheetsFilterUIConfig } from './controllers/sheets-filter-ui.controller';+import { DefaultSheetFilterUiConfig } from './controllers/sheets-filter-ui.controller';+import { SheetsFilterPermissionController } from './controllers/sheets-filter-permission.controller';+import { SheetsFilterMobileUIController } from './controllers/sheets-filter-mobile-ui.controller';++const NAME = 'SHEET_FILTER_UI_PLUGIN';++@DependentOn(UniverSheetsFilterPlugin)+export class UniverSheetsFilterMobileUIPlugin extends Plugin {+ static override type = UniverInstanceType.UNIVER_SHEET;+ static override pluginName = NAME;++ constructor(+ private readonly _config: Partial<IUniverSheetsFilterUIConfig> = {},+ @Inject(Injector) protected readonly _injector: Injector+ ) {+ super();++ this._config = Tools.deepMerge({}, DefaultSheetFilterUiConfig, this._config);+ }++ override onStarting(injector: Injector): void {+ ([+ [SheetsFilterPermissionController],+ [SheetsFilterMobileUIController],+ ] as Dependency[]).forEach((d) => injector.add(d));+ }+}diff --git a/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx b/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsxindex 85b6fe373c..89dd3799db 100644--- a/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx+++ b/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx@@ -20,9 +20,10 @@ import { RediContext } from '@wendellhu/redi/react-bindings';import type { Injector } from '@wendellhu/redi';import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import type { IWorkbookData } from '@univerjs/core';-import { ICommandService, ILogService, LocaleService, LocaleType, LogLevel, Plugin, Univer, UniverInstanceType } from '@univerjs/core';-import { RefRangeService, SelectionManagerService, SheetInterceptorService, WorksheetPermissionService, WorksheetProtectionPointModel } from '@univerjs/sheets';-import { DesktopMenuService, DesktopShortcutService, IMenuService, IShortcutService } from '@univerjs/ui';+import { CommandType, ICommandService, ILogService, LocaleService, LocaleType, LogLevel, Plugin, Univer, UniverInstanceType } from '@univerjs/core';+import { RefRangeService, SelectionManagerService, SheetInterceptorService, WorksheetProtectionPointModel } from '@univerjs/sheets';+import { IMenuService, IShortcutService, MenuService, ShortcutService } from '@univerjs/ui';+import { SetCellEditVisibleOperation } from '@univerjs/sheets-ui';import { SheetsFilterPanelService } from '../../services/sheets-filter-panel.service';import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, SetSheetsFilterCriteriaCommand, SmartToggleSheetsFilterCommand } from '../../commands/sheets-filter.command';import type { IOpenFilterPanelOperationParams } from '../../commands/sheets-filter.operation';@@ -41,12 +42,15 @@ const meta: Meta<typeof FilterPanel> = {export default meta;+const FakeCetCellEditVisibleOperation = {+ id: SetCellEditVisibleOperation.id,+ type: CommandType.OPERATION,+ handler: () => true,+};+function createFilterStorybookBed(workbookData: IWorkbookData, locale: LocaleType = LocaleType.EN_US) {const univer = new Univer();const injector = univer.__getInjector();- const get = injector.get.bind(injector);-- const commandService = get(ICommandService);class TestPlugin extends Plugin {static override type = UniverInstanceType.UNIVER_SHEET;@@ -58,15 +62,17 @@ function createFilterStorybookBed(workbookData: IWorkbookData, locale: LocaleTypoverride onStarting(injector: Injector): void {injector.add([SelectionManagerService]);- injector.add([IShortcutService, { useClass: DesktopShortcutService }]);- injector.add([IMenuService, { useClass: DesktopMenuService }]);- injector.add([WorksheetPermissionService]);+ injector.add([IShortcutService, { useClass: ShortcutService }]);+ injector.add([IMenuService, { useClass: MenuService }]);injector.add([WorksheetProtectionPointModel]);injector.add([SheetInterceptorService]);injector.add([SheetsFilterPanelService]);injector.add([RefRangeService]);+ const commandService = injector.get(ICommandService);+[+ FakeCetCellEditVisibleOperation,SmartToggleSheetsFilterCommand,SetSheetsFilterCriteriaCommand,ClearSheetsFilterCriteriaCommand,@@ -75,11 +81,17 @@ function createFilterStorybookBed(workbookData: IWorkbookData, locale: LocaleTypCloseFilterPanelOperation,ChangeFilterByOperation,].forEach((command) => commandService.registerCommand(command));++ commandService.syncExecuteCommand(OpenFilterPanelOperation.id, {+ unitId: 'test',+ subUnitId: 'sheet1',+ col: 0,+ } as IOpenFilterPanelOperationParams);}}- univer.registerPlugin(TestPlugin);univer.registerPlugin(UniverSheetsFilterPlugin);+ univer.registerPlugin(TestPlugin);injector.get(LocaleService).setLocale(locale);injector.get(LocaleService).load({ enUS, zhCN, ruRU });@@ -87,15 +99,11 @@ function createFilterStorybookBed(workbookData: IWorkbookData, locale: LocaleTypconst sheet = univer.createUniverSheet(workbookData);- commandService.syncExecuteCommand(OpenFilterPanelOperation.id, {- unitId: 'test',- subUnitId: 'sheet1',- col: 0,- } as IOpenFilterPanelOperationParams);-return { univer, injector, sheet };}+// TODO@ybzky: not working properly+export const FilterWithConditions = {render() {const [bed] = useState(() => createFilterStorybookBed(WithCustomFilterModelFactory()));diff --git a/packages/sheets-filter-ui/src/views/widgets/filter-button.shape.ts b/packages/sheets-filter-ui/src/views/widgets/filter-button.shape.tsindex ce4f525afc..94e42c61de 100644--- a/packages/sheets-filter-ui/src/views/widgets/filter-button.shape.ts+++ b/packages/sheets-filter-ui/src/views/widgets/filter-button.shape.ts@@ -114,7 +114,9 @@ export class SheetsFilterButtonShape extends Shape<ISheetsFilterButtonShapePropsconst { col, unitId, subUnitId } = this._filterParams!;const opened = this._contextService.getContextValue(FILTER_PANEL_OPENED_KEY);- if (opened) return;+ if (opened || !this._commandService.hasCommand(OpenFilterPanelOperation.id)) {+ return;+ }setTimeout(() => {this._commandService.executeCommand(OpenFilterPanelOperation.id, {diff --git a/packages/sheets-filter/src/services/sheet-filter.service.ts b/packages/sheets-filter/src/services/sheet-filter.service.tsindex 2a64ae0cf6..bfa989a3ac 100644--- a/packages/sheets-filter/src/services/sheet-filter.service.ts+++ b/packages/sheets-filter/src/services/sheet-filter.service.ts@@ -152,7 +152,7 @@ export class SheetsFilterService extends Disposable {this.disposeWithMe(merge(// source1: executing filter related mutations- fromCallback(this._commandService.onCommandExecuted)+ fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(filter(([command]) => command.type === CommandType.MUTATION && FILTER_MUTATIONS.has(command.id))),// source2: activate sheet changesdiff --git a/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts b/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.tsindex 6397b64f9d..851e99380c 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@@ -211,7 +211,7 @@ export class SheetFindModel extends FindModel {}));this.disposeWithMe(- fromCallback(this._commandService.onCommandExecuted)+ fromCallback(this._commandService.onCommandExecuted.bind(this._commandService.onCommandExecuted)).pipe(filter(([command, options]) => command.id === SetWorksheetActiveOperation.id && !options?.fromFindReplace))@@ -232,7 +232,7 @@ export class SheetFindModel extends FindModel {// When the sheet model changes, we should re-search.this.disposeWithMe(- fromCallback(this._commandService.onCommandExecuted)+ fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(filter(([command]) => command.type === CommandType.MUTATION&& (command.params as ISheetCommandSharedParams).unitId === this._workbook.getUnitId()@@ -325,7 +325,7 @@ export class SheetFindModel extends FindModel {this.disposeWithMe(merge(- fromCallback(this._commandService.onCommandExecuted).pipe(+ fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(filter(([command]) => {// If there mutations happens on this unit, we should re-search.if (command.type === CommandType.MUTATION && (command.params as ISheetCommandSharedParams).unitId === this._workbook.getUnitId()) {diff --git a/packages/sheets-formula/src/controllers/__tests__/formula-auto-fill.controller.spec.ts b/packages/sheets-formula/src/controllers/__tests__/formula-auto-fill.controller.spec.tsindex c944a660d8..128c82a386 100644--- a/packages/sheets-formula/src/controllers/__tests__/formula-auto-fill.controller.spec.ts+++ b/packages/sheets-formula/src/controllers/__tests__/formula-auto-fill.controller.spec.ts@@ -43,7 +43,7 @@ import {SelectionRenderService,SheetsRenderService,} from '@univerjs/sheets-ui';-import { DesktopPlatformService, DesktopShortcutService, IPlatformService, IShortcutService } from '@univerjs/ui';+import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';import type { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';@@ -77,8 +77,8 @@ describe('Test auto fill with formula', () => {[ISelectionRenderService, { useClass: SelectionRenderService }],[AutoFillController],[IAutoFillService, { useClass: AutoFillService }],- [IShortcutService, { useClass: DesktopShortcutService }],- [IPlatformService, { useClass: DesktopPlatformService }],+ [IShortcutService, { useClass: ShortcutService }],+ [IPlatformService, { useClass: PlatformService }],[FormulaAutoFillController],[RangeProtectionRuleModel],[RangeProtectionService],diff --git a/packages/sheets-formula/src/formula-ui-plugin.ts b/packages/sheets-formula/src/formula-ui-plugin.tsindex 13db46ec00..03224e318c 100644--- a/packages/sheets-formula/src/formula-ui-plugin.ts+++ b/packages/sheets-formula/src/formula-ui-plugin.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { DependentOn, LocaleService, Plugin, Tools, UniverInstanceType } from '@univerjs/core';+import { DependentOn, Plugin, Tools, UniverInstanceType } from '@univerjs/core';import type { Dependency } from '@wendellhu/redi';import { Inject, Injector } from '@wendellhu/redi';@@ -56,8 +56,7 @@ export class UniverSheetsFormulaPlugin extends Plugin {constructor(private readonly _config: Partial<IUniverSheetsFormulaConfig> = {},@Inject(Injector) override readonly _injector: Injector,- @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,- @Inject(LocaleService) private readonly _localeService: LocaleService+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService) {super();@@ -69,10 +68,10 @@ export class UniverSheetsFormulaPlugin extends Plugin {}override onRendered(): void {- this._registerRenderControllers();+ this._registerRenderModules();}- private _registerRenderControllers(): void {+ private _registerRenderModules(): void {([FormulaAlertRenderController,@@ -119,3 +118,48 @@ export class UniverSheetsFormulaPlugin extends Plugin {dependencies.forEach((dependency) => this._injector.add(dependency));}}++export class UniverSheetsFormulaMobilePlugin extends Plugin {+ static override pluginName = FORMULA_UI_PLUGIN_NAME;+ static override type = UniverInstanceType.UNIVER_SHEET;++ constructor(+ private readonly _config: Partial<IUniverSheetsFormulaConfig> = {},+ @Inject(Injector) override readonly _injector: Injector+ ) {+ super();++ this._config = Tools.deepMerge({}, DefaultSheetFormulaConfig, this._config);+ }++ override onStarting(): void {+ this._init();+ }++ _init(): void {+ const dependencies: Dependency[] = [+ // services+ [IFormulaPromptService, { useClass: FormulaPromptService }],+ [+ IDescriptionService,+ {+ useFactory: () => this._injector.createInstance(DescriptionService, this._config?.description),+ },+ ],+ [IFormulaCustomFunctionService, { useClass: FormulaCustomFunctionService }],+ [IRegisterFunctionService, { useClass: RegisterFunctionService }],+ [FormulaRefRangeService],+ [RegisterOtherFormulaService],+ [FormulaClipboardController],+ [ArrayFormulaDisplayController],+ [TriggerCalculationController],+ [UpdateFormulaController],+ [ActiveDirtyController],+ [DefinedNameController],+ [FormulaRenderManagerController],+ [FormulaAlertRenderController],+ ];++ dependencies.forEach((dependency) => this._injector.add(dependency));+ }+}diff --git a/packages/sheets-formula/src/index.ts b/packages/sheets-formula/src/index.tsindex c190916145..4dc9f1c04b 100644--- a/packages/sheets-formula/src/index.ts+++ b/packages/sheets-formula/src/index.ts@@ -14,7 +14,7 @@* limitations under the License.*/-export { UniverSheetsFormulaPlugin } from './formula-ui-plugin';+export { UniverSheetsFormulaPlugin, UniverSheetsFormulaMobilePlugin } from './formula-ui-plugin';export { IDescriptionService } from './services/description.service';export { DescriptionService } from './services/description.service';export {diff --git a/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.tsindex b1870d24c3..ec283d5205 100644--- a/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts+++ b/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts@@ -42,7 +42,7 @@ import {transformCellsToRange,} from '@univerjs/sheets';import { IEditorBridgeService } from '@univerjs/sheets-ui';-import { Inject, Injector } from '@wendellhu/redi';+import { Inject, Injector, Optional } from '@wendellhu/redi';import { getPatternType } from '../utils/pattern';@@ -77,7 +77,7 @@ export class NumfmtEditorController extends Disposable {@Inject(INumfmtService) private _numfmtService: INumfmtService,@Inject(IUniverInstanceService) private _univerInstanceService: IUniverInstanceService,@Inject(Injector) private _injector: Injector,- @Inject(IEditorBridgeService) private _editorBridgeService: IEditorBridgeService+ @Optional(IEditorBridgeService) private _editorBridgeService?: IEditorBridgeService) {super();this._initInterceptorEditorStart();@@ -86,6 +86,10 @@ export class NumfmtEditorController extends Disposable {}private _initInterceptorEditorStart() {+ if (!this._editorBridgeService) {+ return;+ }+this.disposeWithMe(toDisposable(this._editorBridgeService.interceptor.intercept(@@ -133,6 +137,10 @@ export class NumfmtEditorController extends Disposable {* @memberof NumfmtService*/private _initInterceptorEditorEnd() {+ if (!this._editorBridgeService) {+ return;+ }+this.disposeWithMe(toDisposable(this._editorBridgeService.interceptor.intercept(diff --git a/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.ts b/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.tsindex a4f99489c6..482cff5757 100644--- a/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.ts+++ b/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.ts@@ -33,7 +33,7 @@ import {SetRangeValuesMutation,SetSelectionsOperation,} from '@univerjs/sheets';-import { DesktopPlatformService, DesktopShortcutService, EditorService, IEditorService, IPlatformService, IShortcutService } from '@univerjs/ui';+import { EditorService, IEditorService, IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';import type { Injector } from '@wendellhu/redi';import { beforeEach, describe, expect, it } from 'vitest';@@ -284,8 +284,8 @@ describe('Test auto fill rules in controller', () => {const testBed = createCommandTestBed(TEST_WORKBOOK_DATA, [[ISelectionRenderService, { useClass: SelectionRenderService }],[IAutoFillService, { useClass: AutoFillService }],- [IShortcutService, { useClass: DesktopShortcutService }],- [IPlatformService, { useClass: DesktopPlatformService }],+ [IShortcutService, { useClass: ShortcutService }],+ [IPlatformService, { useClass: PlatformService }],[IEditorBridgeService, { useClass: EditorBridgeService }],[IEditorService, { useClass: EditorService }],[IRenderManagerService, { useClass: RenderManagerService }],diff --git a/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts b/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.tsindex 1e5aac9fb0..5a61123e20 100644--- a/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts+++ b/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts@@ -23,7 +23,7 @@ import { RangeProtectionRefRangeService, RangeProtectionRenderModel, RangeProtecWorksheetProtectionPointModel,WorksheetProtectionRuleModel,} from '@univerjs/sheets';-import { DesktopMenuService, DesktopPlatformService, DesktopShortcutService, IMenuService, IPlatformService, IShortcutService } from '@univerjs/ui';+import { IMenuService, IPlatformService, IShortcutService, MenuService, PlatformService, ShortcutService } from '@univerjs/ui';import { Inject, Injector } from '@wendellhu/redi';import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';@@ -67,10 +67,10 @@ export function createMenuTestBed() {}override onStarting(injector: Injector): void {- injector.add([IPlatformService, { useClass: DesktopPlatformService }]);+ injector.add([IPlatformService, { useClass: PlatformService }]);injector.add([SelectionManagerService]);- injector.add([IShortcutService, { useClass: DesktopShortcutService }]);- injector.add([IMenuService, { useClass: DesktopMenuService }]);+ injector.add([IShortcutService, { useClass: ShortcutService }]);+ injector.add([IMenuService, { useClass: MenuService }]);injector.add([WorkbookPermissionService]);injector.add([WorksheetPermissionService]);injector.add([WorksheetProtectionPointModel]);diff --git a/packages/sheets-ui/src/controllers/menu/menu.ts b/packages/sheets-ui/src/controllers/menu/menu.tsindex 200c7125df..f288c4c27f 100644--- a/packages/sheets-ui/src/controllers/menu/menu.ts+++ b/packages/sheets-ui/src/controllers/menu/menu.ts@@ -118,9 +118,9 @@ import { FormatPainterStatus, IFormatPainterService } from '../../services/formaimport { deriveStateFromActiveSheet$, getCurrentRangeDisable$ } from './menu-util';export enum SheetMenuPosition {- ROW_HEADER_CONTEXT_MENU = 'rowHeaderContextMenu',- COL_HEADER_CONTEXT_MENU = 'colHeaderContextMenu',- SHEET_BAR = 'sheetBar',+ ROW_HEADER_CONTEXT_MENU = 'ROW_HEADER_CONTEXT_MENU',+ COL_HEADER_CONTEXT_MENU = 'COL_HEADER_CONTEXT_MENU',+ SHEET_BAR = 'SHEET_BAR',}export function FormatPainterMenuItemFactory(accessor: IAccessor): IMenuButtonItem {diff --git a/packages/sheets-ui/src/controllers/mobile/mobile-sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/mobile/mobile-sheet-ui.controller.tsnew file mode 100644index 0000000000..94ab09e448--- /dev/null+++ b/packages/sheets-ui/src/controllers/mobile/mobile-sheet-ui.controller.ts@@ -0,0 +1,438 @@+/**+ * 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, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';+import {+ SetBoldCommand,+ SetFontFamilyCommand,+ SetFontSizeCommand,+ SetItalicCommand,+ SetStrikeThroughCommand,+ SetUnderlineCommand,+} from '@univerjs/sheets';+import type { IMenuItemFactory, MenuConfig } from '@univerjs/ui';+import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuService, IShortcutService, IUIPartsService } from '@univerjs/ui';+import { Inject, Injector } from '@wendellhu/redi';++import { connectInjector } from '@wendellhu/redi/react-bindings';+import {+ AddWorksheetMergeAllCommand,+ AddWorksheetMergeCommand,+ AddWorksheetMergeHorizontalCommand,+ AddWorksheetMergeVerticalCommand,+} from '../../commands/commands/add-worksheet-merge.command';+import { DeleteRangeMoveLeftConfirmCommand } from '../../commands/commands/delete-range-move-left-confirm.command ';+import { DeleteRangeMoveUpConfirmCommand } from '../../commands/commands/delete-range-move-up-confirm.command';+import { HideColConfirmCommand, HideRowConfirmCommand } from '../../commands/commands/hide-row-col-confirm.command';+import {+ SetRangeBoldCommand,+ SetRangeFontFamilyCommand,+ SetRangeFontSizeCommand,+ SetRangeItalicCommand,+ SetRangeStrickThroughCommand,+ SetRangeSubscriptCommand,+ SetRangeSuperscriptCommand,+ SetRangeTextColorCommand,+ SetRangeUnderlineCommand,+} from '../../commands/commands/inline-format.command';+import { InsertRangeMoveDownConfirmCommand } from '../../commands/commands/insert-range-move-down-confirm.command';+import { InsertRangeMoveRightConfirmCommand } from '../../commands/commands/insert-range-move-right-confirm.command';+import { RefillCommand } from '../../commands/commands/refill.command';+import { RemoveColConfirmCommand, RemoveRowConfirmCommand } from '../../commands/commands/remove-row-col-confirm.command';+import { RemoveSheetConfirmCommand } from '../../commands/commands/remove-sheet-confirm.command';+import {+ ApplyFormatPainterCommand,+ SetInfiniteFormatPainterCommand,+ SetOnceFormatPainterCommand,+} from '../../commands/commands/set-format-painter.command';+import {+ CancelFrozenCommand,+ SetColumnFrozenCommand,+ SetRowFrozenCommand,+ SetSelectionFrozenCommand,+} from '../../commands/commands/set-frozen.command';+import { ScrollCommand, ScrollToCellCommand, SetScrollRelativeCommand } from '../../commands/commands/set-scroll.command';+import {+ ExpandSelectionCommand,+ MoveSelectionCommand,+ MoveSelectionEnterAndTabCommand,+ SelectAllCommand,+} from '../../commands/commands/set-selection.command';+import { ChangeZoomRatioCommand, SetZoomRatioCommand } from '../../commands/commands/set-zoom-ratio.command';+import { ShowMenuListCommand } from '../../commands/commands/unhide.command';+import { SetActivateCellEditOperation } from '../../commands/operations/activate-cell-edit.operation';+import {+ SetCellEditVisibleArrowOperation,+ SetCellEditVisibleOperation,+ SetCellEditVisibleWithF2Operation,+} from '../../commands/operations/cell-edit.operation';+import { RenameSheetOperation } from '../../commands/operations/rename-sheet.operation';+import { SetScrollOperation } from '../../commands/operations/scroll.operation';+import { SetFormatPainterOperation } from '../../commands/operations/set-format-painter.operation';+import { SetZoomRatioOperation } from '../../commands/operations/set-zoom-ratio.operation';+import { BorderPanel } from '../../components/border-panel/BorderPanel';+import { BORDER_PANEL_COMPONENT } from '../../components/border-panel/interface';+import { COLOR_PICKER_COMPONENT, ColorPicker } from '../../components/color-picker';+import {+ FONT_FAMILY_COMPONENT,+ FONT_FAMILY_ITEM_COMPONENT,+ FontFamily,+ FontFamilyItem,+} from '../../components/font-family';+import { FONT_SIZE_COMPONENT, FontSize } from '../../components/font-size';+import { MENU_ITEM_INPUT_COMPONENT, MenuItemInput } from '../../components/menu-item-input';+import { DEFINED_NAME_CONTAINER } from '../../views/defined-name/component-name';+import { DefinedNameContainer } from '../../views/defined-name/DefinedNameContainer';+import { SidebarDefinedNameOperation } from '../../commands/operations/sidebar-defined-name.operation';+import { AutoClearContentCommand, AutoFillCommand } from '../../commands/commands/auto-fill.command';++import { SheetPermissionOpenPanelOperation } from '../../commands/operations/sheet-permission-open-panel.operation';+import { SheetPermissionOpenDialogOperation } from '../../commands/operations/sheet-permission-open-dialog.operation';+import { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, DeleteRangeProtectionFromContextMenuCommand, SetProtectionCommand, SetRangeProtectionFromContextMenuCommand, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand } from '../../commands/commands/range-protection.command';+import { AddWorksheetProtectionCommand, ChangeSheetProtectionFromSheetBarCommand, DeleteWorksheetProtectionCommand, DeleteWorksheetProtectionFormSheetBarCommand, SetWorksheetProtectionCommand } from '../../commands/commands/worksheet-protection.command';++import {+ CopyMenuItemFactory,+} from '../menu/menu';++import {+ EditorBreakLineShortcut,+ EditorCursorEnterShortcut,+ EditorCursorEscShortcut,+ EditorCursorTabShortcut,+ EditorDeleteLeftShortcut,+ EditorDeleteLeftShortcutInActive,+ generateArrowSelectionShortCutItem,+ StartEditWithF2Shortcut,+} from '../shortcuts/editor.shortcut';+import { SetColHiddenShortcutItem, SetRowHiddenShortcutItem } from '../shortcuts/operation.shortcut';+import {+ ExpandSelectionDownShortcutItem,+ ExpandSelectionEndDownShortcutItem,+ ExpandSelectionEndLeftShortcutItem,+ ExpandSelectionEndRightShortcutItem,+ ExpandSelectionEndUpShortcutItem,+ ExpandSelectionLeftShortcutItem,+ ExpandSelectionRightShortcutItem,+ ExpandSelectionUpShortcutItem,+ // MoveBackSelectionShortcutItem,+ MoveSelectionDownShortcutItem,+ MoveSelectionEndDownShortcutItem,+ MoveSelectionEndLeftShortcutItem,+ MoveSelectionEndRightShortcutItem,+ MoveSelectionEndUpShortcutItem,+ MoveSelectionEnterShortcutItem,+ MoveSelectionEnterUpShortcutItem,+ MoveSelectionLeftShortcutItem,+ MoveSelectionRightShortcutItem,+ MoveSelectionTabLeftShortcutItem,+ MoveSelectionTabShortcutItem,+ MoveSelectionUpShortcutItem,+ SelectAllShortcutItem,+} from '../shortcuts/selection.shortcut';+import {+ SetBoldShortcutItem,+ SetItalicShortcutItem,+ SetStrikeThroughShortcutItem,+ SetUnderlineShortcutItem,+} from '../shortcuts/style.shortcut';+import { ClearSelectionValueShortcutItem } from '../shortcuts/value.shortcut';+import {+ PreventDefaultResetZoomShortcutItem,+ PreventDefaultZoomInShortcutItem,+ PreventDefaultZoomOutShortcutItem,+ ResetZoomShortcutItem,+ ZoomInShortcutItem,+ ZoomOutShortcutItem,+} from '../shortcuts/view.shortcut';+import { MobileSheetBar } from '../../views/mobile/sheet-bar/MobileSheetBar';++export interface IUniverSheetsUIConfig {+ menu: MenuConfig;+}++export const DefaultSheetUiConfig = {};++@OnLifecycle(LifecycleStages.Ready, SheetUIMobileController)+export class SheetUIMobileController extends Disposable {+ constructor(+ private readonly _config: Partial<IUniverSheetsUIConfig>,+ @Inject(Injector) private readonly _injector: Injector,+ @Inject(ComponentManager) private readonly _componentManager: ComponentManager,+ @ILayoutService private readonly _layoutService: ILayoutService,+ @ICommandService private readonly _commandService: ICommandService,+ @IShortcutService private readonly _shortcutService: IShortcutService,+ @IMenuService private readonly _menuService: IMenuService,+ @IUIPartsService private readonly _uiPartsService: IUIPartsService+ ) {+ super();++ this._init();+ }++ private _init(): void {+ this._initCustomComponents();+ this._initCommands();+ this._initMenus();+ this._initShortcuts();+ this._initWorkbenchParts();+ this._initFocusHandler();+ }++ private _initCustomComponents(): void {+ const componentManager = this._componentManager;+ this.disposeWithMe(componentManager.register(MENU_ITEM_INPUT_COMPONENT, MenuItemInput));+ this.disposeWithMe(componentManager.register(BORDER_PANEL_COMPONENT, BorderPanel));+ this.disposeWithMe(componentManager.register(COLOR_PICKER_COMPONENT, ColorPicker));+ this.disposeWithMe(componentManager.register(FONT_FAMILY_COMPONENT, FontFamily));+ this.disposeWithMe(componentManager.register(FONT_FAMILY_ITEM_COMPONENT, FontFamilyItem));+ this.disposeWithMe(componentManager.register(FONT_SIZE_COMPONENT, FontSize));+ this.disposeWithMe(componentManager.register(DEFINED_NAME_CONTAINER, DefinedNameContainer));+ }++ private _initCommands(): void {+ [+ AddWorksheetMergeAllCommand,+ AddWorksheetMergeCommand,+ AddWorksheetMergeHorizontalCommand,+ AddWorksheetMergeVerticalCommand,+ ChangeZoomRatioCommand,+ ExpandSelectionCommand,+ MoveSelectionCommand,+ MoveSelectionEnterAndTabCommand,+ RenameSheetOperation,+ RemoveSheetConfirmCommand,+ RemoveRowConfirmCommand,+ RemoveColConfirmCommand,+ HideRowConfirmCommand,+ HideColConfirmCommand,+ ScrollCommand,+ ScrollToCellCommand,+ SelectAllCommand,+ SetActivateCellEditOperation,+ SetBoldCommand,+ SetCellEditVisibleArrowOperation,+ SetCellEditVisibleOperation,+ SetCellEditVisibleWithF2Operation,+ SetRangeBoldCommand,+ SetRangeItalicCommand,+ SetRangeUnderlineCommand,+ SetRangeStrickThroughCommand,+ SetRangeSubscriptCommand,+ SetRangeSuperscriptCommand,+ SetRangeFontSizeCommand,+ SetRangeFontFamilyCommand,+ SetRangeTextColorCommand,+ SetItalicCommand,+ SetStrikeThroughCommand,+ SetFontFamilyCommand,+ SetFontSizeCommand,+ SetFormatPainterOperation,+ SetInfiniteFormatPainterCommand,+ SetOnceFormatPainterCommand,+ ApplyFormatPainterCommand,+ SetScrollOperation,+ SetScrollRelativeCommand,+ SetSelectionFrozenCommand,+ SetRowFrozenCommand,+ SetColumnFrozenCommand,+ CancelFrozenCommand,+ SetUnderlineCommand,+ SetZoomRatioCommand,+ SetZoomRatioOperation,+ ShowMenuListCommand,+ RefillCommand,+ InsertRangeMoveDownConfirmCommand,+ DeleteRangeMoveUpConfirmCommand,+ InsertRangeMoveRightConfirmCommand,+ DeleteRangeMoveLeftConfirmCommand,+ SidebarDefinedNameOperation,+ AutoFillCommand,+ AutoClearContentCommand,++ // permission+ SheetPermissionOpenPanelOperation,+ SheetPermissionOpenDialogOperation,+ AddRangeProtectionFromToolbarCommand,+ AddRangeProtectionFromContextMenuCommand,+ ViewSheetPermissionFromContextMenuCommand,+ AddRangeProtectionFromSheetBarCommand,+ ViewSheetPermissionFromSheetBarCommand,+ ChangeSheetProtectionFromSheetBarCommand,+ DeleteRangeProtectionFromContextMenuCommand,+ SetRangeProtectionFromContextMenuCommand,+ AddWorksheetProtectionCommand,+ DeleteWorksheetProtectionCommand,+ SetWorksheetProtectionCommand,+ DeleteWorksheetProtectionFormSheetBarCommand,+ SetProtectionCommand,+ ].forEach((c) => {+ this.disposeWithMe(this._commandService.registerCommand(c));+ });+ }++ private _initMenus(): void {+ const { menu = {} } = this._config;++ (+ [+ // context menu+ CopyMenuItemFactory,+ // PasteMenuItemFactory,+ // PasteSpacialMenuItemFactory,+ // PasteValueMenuItemFactory,+ // PasteFormatMenuItemFactory,+ // PasteColWidthMenuItemFactory,+ // PasteBesidesBorderMenuItemFactory,+ // ClearSelectionContentMenuItemFactory,+ // ClearSelectionFormatMenuItemFactory,+ // ClearSelectionAllMenuItemFactory,+ // ClearSelectionMenuItemFactory,+ // ColInsertMenuItemFactory,+ // RowInsertMenuItemFactory,+ // CellInsertMenuItemFactory,+ // InsertRowBeforeMenuItemFactory,+ // InsertRowAfterMenuItemFactory,+ // InsertColBeforeMenuItemFactory,+ // InsertColAfterMenuItemFactory,+ // RemoveRowMenuItemFactory,+ // HideRowMenuItemFactory,+ // ShowRowMenuItemFactory,+ // HideColMenuItemFactory,+ // ShowColMenuItemFactory,+ // RemoveColMenuItemFactory,+ // SetRowHeightMenuItemFactory,+ // FitContentMenuItemFactory,+ // SetColWidthMenuItemFactory,+ // DeleteRangeMenuItemFactory,+ // DeleteRangeMoveLeftMenuItemFactory,+ // DeleteRangeMoveUpMenuItemFactory,+ // InsertRangeMoveRightMenuItemFactory,+ // InsertRangeMoveDownMenuItemFactory,+ // FrozenMenuItemFactory,+ // FrozenRowMenuItemFactory,+ // FrozenColMenuItemFactory,+ // CancelFrozenMenuItemFactory,+ // SheetFrozenMenuItemFactory,+ // SheetFrozenHeaderMenuItemFactory,++ // toolbar+ // FormatPainterMenuItemFactory,+ // BoldMenuItemFactory,+ // ItalicMenuItemFactory,+ // UnderlineMenuItemFactory,+ // StrikeThroughMenuItemFactory,+ // FontFamilySelectorMenuItemFactory,+ // FontSizeSelectorMenuItemFactory,+ // ResetTextColorMenuItemFactory,+ // TextColorSelectorMenuItemFactory,+ // ResetBackgroundColorMenuItemFactory,+ // BackgroundColorSelectorMenuItemFactory,+ // CellBorderSelectorMenuItemFactory,+ // CellMergeMenuItemFactory,+ // CellMergeAllMenuItemFactory,+ // CellMergeVerticalMenuItemFactory,+ // CellMergeHorizontalMenuItemFactory,+ // CellMergeCancelMenuItemFactory,+ // HorizontalAlignMenuItemFactory,+ // VerticalAlignMenuItemFactory,+ // WrapTextMenuItemFactory,+ // TextRotateMenuItemFactory,++ // sheetbar+ // DeleteSheetMenuItemFactory,+ // CopySheetMenuItemFactory,+ // RenameSheetMenuItemFactory,+ // ChangeColorSheetMenuItemFactory,+ // HideSheetMenuItemFactory,+ // ShowMenuItemFactory,+ ] as IMenuItemFactory[]+ ).forEach((factory) => {+ this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));+ });+ }++ private _initShortcuts(): void {+ [+ // selection shortcuts+ MoveSelectionDownShortcutItem,+ MoveSelectionUpShortcutItem,+ MoveSelectionLeftShortcutItem,+ MoveSelectionRightShortcutItem,+ MoveSelectionTabShortcutItem,+ MoveSelectionTabLeftShortcutItem,+ MoveSelectionEnterShortcutItem,+ MoveSelectionEnterUpShortcutItem,+ // MoveBackSelectionShortcutItem,+ MoveSelectionEndDownShortcutItem,+ MoveSelectionEndUpShortcutItem,+ MoveSelectionEndLeftShortcutItem,+ MoveSelectionEndRightShortcutItem,+ ExpandSelectionDownShortcutItem,+ ExpandSelectionUpShortcutItem,+ ExpandSelectionLeftShortcutItem,+ ExpandSelectionRightShortcutItem,+ ExpandSelectionEndDownShortcutItem,+ ExpandSelectionEndUpShortcutItem,+ ExpandSelectionEndLeftShortcutItem,+ ExpandSelectionEndRightShortcutItem,+ SelectAllShortcutItem,++ // view shortcuts+ ZoomInShortcutItem,+ ZoomOutShortcutItem,+ ResetZoomShortcutItem,+ PreventDefaultResetZoomShortcutItem,+ PreventDefaultZoomInShortcutItem,+ PreventDefaultZoomOutShortcutItem,++ // toggle cell style shortcuts+ SetBoldShortcutItem,+ SetItalicShortcutItem,+ SetUnderlineShortcutItem,+ SetStrikeThroughShortcutItem,++ // cell content editing shortcuts+ ClearSelectionValueShortcutItem,+ ...generateArrowSelectionShortCutItem(),+ EditorCursorEnterShortcut,+ StartEditWithF2Shortcut,+ EditorCursorTabShortcut,+ EditorBreakLineShortcut,+ EditorDeleteLeftShortcut,+ EditorDeleteLeftShortcutInActive,+ EditorCursorEscShortcut,++ // operation shortcuts+ SetRowHiddenShortcutItem,+ SetColHiddenShortcutItem,+ ].forEach((item) => {+ this.disposeWithMe(this._shortcutService.registerShortcut(item));+ });+ }++ private _initWorkbenchParts(): void {+ this._uiPartsService.registerComponent(BuiltInUIPart.HEADER, () => connectInjector(MobileSheetBar, this._injector));+ }++ private _initFocusHandler(): void {+ this.disposeWithMe(+ this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_SHEET, (_unitId: string) => {+ // TODO@wzhudev: focus is different on mobile devices+ })+ );+ }+}diff --git a/packages/sheets-ui/src/controllers/permission/sheet-permission-interceptor-canvas-render.controller.ts b/packages/sheets-ui/src/controllers/permission/sheet-permission-interceptor-canvas-render.controller.tsindex b1065975b1..7b86a4b2ca 100644--- a/packages/sheets-ui/src/controllers/permission/sheet-permission-interceptor-canvas-render.controller.ts+++ b/packages/sheets-ui/src/controllers/permission/sheet-permission-interceptor-canvas-render.controller.ts@@ -17,8 +17,7 @@import type { ICellDataForSheetInterceptor, IRange, Nullable, Workbook } from '@univerjs/core';import { DisposableCollection, IPermissionService, IUniverInstanceService, LifecycleStages, OnLifecycle, Rectangle, RxDisposable, UniverInstanceType } from '@univerjs/core';import { getSheetCommandTarget, RangeProtectionRuleModel, SelectionManagerService, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission } from '@univerjs/sheets';-import { Inject } from '@wendellhu/redi';-import { IDialogService } from '@univerjs/ui';+import { Inject, Optional } from '@wendellhu/redi';import type { IRenderContext, IRenderModule, Scene, SpreadsheetSkeleton } from '@univerjs/engine-render';import { UnitAction } from '@univerjs/protocol';@@ -41,12 +40,11 @@ export class SheetPermissionInterceptorCanvasRenderController extends RxDisposab@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@IPermissionService private readonly _permissionService: IPermissionService,@Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,- @IDialogService private readonly _dialogService: IDialogService,@Inject(RangeProtectionRuleModel) private _rangeProtectionRuleModel: RangeProtectionRuleModel,@Inject(HeaderMoveRenderController) private _headerMoveRenderController: HeaderMoveRenderController,- @Inject(HeaderResizeRenderController) private _headerResizeRenderController: HeaderResizeRenderController,@ISelectionRenderService private _selectionRenderService: ISelectionRenderService,- @Inject(HeaderFreezeRenderController) private _headerFreezeRenderController: HeaderFreezeRenderController+ @Inject(HeaderFreezeRenderController) private _headerFreezeRenderController: HeaderFreezeRenderController,+ @Optional(HeaderResizeRenderController) private _headerResizeRenderController?: HeaderResizeRenderController) {super();this._initHeaderMovePermissionInterceptor();@@ -101,6 +99,10 @@ export class SheetPermissionInterceptorCanvasRenderController extends RxDisposab}private _initHeaderResizePermissionInterceptor() {+ if (!this._headerResizeRenderController) {+ return;+ }+this.disposeWithMe(this._headerResizeRenderController.interceptor.intercept(this._headerResizeRenderController.interceptor.getInterceptPoints().HEADER_RESIZE_PERMISSION_CHECK, {handler: (defaultValue: Nullable<boolean>, rangeParams: { row?: number; col?: number }) => {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.tsindex 20a1751140..7ea88204a0 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@@ -15,14 +15,13 @@*/import { Disposable, IPermissionService, LifecycleStages, OnLifecycle } from '@univerjs/core';-import type { IMenuItemFactory, MenuConfig } from '@univerjs/ui';+import type { MenuConfig } from '@univerjs/ui';import { ComponentManager, IMenuService } from '@univerjs/ui';import { Inject, Injector } from '@wendellhu/redi';import { CheckMarkSingle, DeleteSingle, LockSingle, ProtectSingle, WriteSingle } from '@univerjs/icons';import { RangeProtectionRuleModel } from '@univerjs/sheets';-import type { IRenderContext, Spreadsheet } from '@univerjs/engine-render';+import type { IRenderContext, IRenderModule, Spreadsheet } from '@univerjs/engine-render';import { merge, throttleTime } from 'rxjs';-import { sheetPermissionAddProtectContextMenuFactory, sheetPermissionChangeSheetPermissionSheetBarMenuFactory, sheetPermissionContextMenuFactory, sheetPermissionEditProtectContextMenuFactory, sheetPermissionProtectSheetInSheetBarMenuFactory, sheetPermissionRemoveProtectContextMenuFactory, sheetPermissionRemoveProtectionSheetBarMenuFactory, sheetPermissionToolbarMenuFactory, sheetPermissionViewAllProtectRuleContextMenuFactory, sheetPermissionViewAllProtectRuleSheetBarMenuFactory } from '../menu/permission.menu';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 { SheetPermissionDialog, SheetPermissionPanel, SheetPermissionPanelFooter, SheetPermissionUserDialog } from '../../views/permission';import { UNIVER_SHEET_PERMISSION_ALERT_DIALOG } from '../../views/permission/error-msg-dialog/interface';@@ -49,37 +48,9 @@ export class SheetPermissionRenderManagerController extends Disposable {}private _init() {- this._initToolbarMenu();- this._initContextMenu();this._initComponents();}- private _initToolbarMenu() {- const { menu = {} } = this._config;- ([- sheetPermissionToolbarMenuFactory,- ]).forEach((menuFactory) => {- this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(menuFactory), menu));- });- }-- private _initContextMenu() {- const { menu = {} } = this._config;- ([- sheetPermissionContextMenuFactory,- sheetPermissionAddProtectContextMenuFactory,- sheetPermissionEditProtectContextMenuFactory,- sheetPermissionRemoveProtectContextMenuFactory,- sheetPermissionViewAllProtectRuleContextMenuFactory,- sheetPermissionProtectSheetInSheetBarMenuFactory,- sheetPermissionRemoveProtectionSheetBarMenuFactory,- sheetPermissionChangeSheetPermissionSheetBarMenuFactory,- sheetPermissionViewAllProtectRuleSheetBarMenuFactory,- ] as IMenuItemFactory[]).forEach((factory) => {- this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));- });- }-private _initComponents() {([[permissionMenuIconKey, ProtectSingle],@@ -101,7 +72,7 @@ export class SheetPermissionRenderManagerController extends Disposable {}}-export class SheetPermissionRenderController extends Disposable {+export class SheetPermissionRenderController extends Disposable implements IRenderModule {private _rangeProtectionCanViewRenderExtension = new RangeProtectionCanViewRenderExtension();private _rangeProtectionCanNotViewRenderExtension = new RangeProtectionCanNotViewRenderExtension();diff --git a/packages/sheets-ui/src/controllers/render-controllers/contextmenu.render-controller.ts b/packages/sheets-ui/src/controllers/render-controllers/contextmenu.render-controller.tsindex c6cc902fc8..6e8d6cadf7 100644--- a/packages/sheets-ui/src/controllers/render-controllers/contextmenu.render-controller.ts+++ b/packages/sheets-ui/src/controllers/render-controllers/contextmenu.render-controller.ts@@ -38,16 +38,18 @@ export class SheetContextMenuRenderController extends Disposable implements IRenconstructor(private readonly _context: IRenderContext<Workbook>,@IContextMenuService private readonly _contextMenuService: IContextMenuService,- @Inject(SelectionManagerService)- private readonly _selectionManagerService: SelectionManagerService,+ @Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,@ISelectionRenderService private readonly _selectionRenderService: ISelectionRenderService) {super();- this._addListeners();++ this._init();}- private _addListeners(): void {+ private _init(): void {const spreadsheetPointerDownObserver = (this._context?.mainComponent as Spreadsheet)?.onPointerDownObserver;++ // Content range context menuconst spreadsheetObserver = spreadsheetPointerDownObserver.add((event) => {if (event.button === 2) {const selections = this._selectionManagerService.getSelections();@@ -89,6 +91,7 @@ export class SheetContextMenuRenderController extends Disposable implements IRen});this.disposeWithMe(toDisposable(() => spreadsheetPointerDownObserver.remove(spreadsheetObserver)));+ // Row header context menuconst spreadsheetColumnHeader = this._context.components.get(SHEET_VIEW_KEY.COLUMN) as SpreadsheetColumnHeader;const spreadsheetRowHeader = this._context.components.get(SHEET_VIEW_KEY.ROW) as SpreadsheetHeader;const rowHeaderPointerDownObserver = spreadsheetRowHeader.onPointerDownObserver;@@ -99,6 +102,7 @@ export class SheetContextMenuRenderController extends Disposable implements IRen});this.disposeWithMe(toDisposable(() => spreadsheetPointerDownObserver.remove(rowHeaderObserver)));+ // Col header context menuconst colHeaderPointerDownObserver = spreadsheetColumnHeader.onPointerDownObserver;const colHeaderObserver = colHeaderPointerDownObserver.add((event) => {if (event.button === 2) {diff --git a/packages/sheets-ui/src/controllers/render-controllers/header-resize.render-controller.ts b/packages/sheets-ui/src/controllers/render-controllers/header-resize.render-controller.tsindex b814fa4cb3..ad317561c3 100644--- a/packages/sheets-ui/src/controllers/render-controllers/header-resize.render-controller.ts+++ b/packages/sheets-ui/src/controllers/render-controllers/header-resize.render-controller.ts@@ -25,7 +25,7 @@ import {toDisposable,} from '@univerjs/core';import type { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, SpreadsheetColumnHeader, SpreadsheetHeader } from '@univerjs/engine-render';-import { CURSOR_TYPE, DeviceInputEventType, Rect, SHEET_VIEWPORT_KEY, Vector2 } from '@univerjs/engine-render';+import { CURSOR_TYPE, Rect, SHEET_VIEWPORT_KEY, Vector2 } from '@univerjs/engine-render';import type {IDeltaColumnWidthCommandParams,IDeltaRowHeightCommand,@@ -35,7 +35,6 @@ import { DeltaColumnWidthCommand, DeltaRowHeightCommand, SetWorksheetRowIsAutoHeimport { Inject } from '@wendellhu/redi';import { SHEET_COMPONENT_HEADER_LAYER_INDEX, SHEET_VIEW_KEY } from '../../common/keys';-import { IEditorBridgeService } from '../../services/editor-bridge.service';import { SheetSkeletonManagerService } from '../../services/sheet-skeleton-manager.service';import {HEADER_MENU_SHAPE_THUMB_SIZE,@@ -89,8 +88,7 @@ export class HeaderResizeRenderController extends Disposable implements IRenderMconstructor(private readonly _context: IRenderContext<Workbook>,@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICommandService private readonly _commandService: ICommandService,- @IEditorBridgeService private readonly _editorBridgeService: IEditorBridgeService+ @ICommandService private readonly _commandService: ICommandService) {super();@@ -375,10 +373,11 @@ export class HeaderResizeRenderController extends Disposable implements IRenderMscene.disableEvent();- this._editorBridgeService.changeVisible({- visible: false,- eventType: DeviceInputEventType.PointerDown,- });+ // TODO: do it in another way+ // this._editorBridgeService.changeVisible({+ // visible: false,+ // eventType: DeviceInputEventType.PointerDown,+ // });this._moveObserver = scene.onPointerMoveObserver.add((moveEvt: IPointerEvent | IMouseEvent) => {const relativeCoords = scene.getRelativeCoord(diff --git a/packages/sheets-ui/src/controllers/render-controllers/mobile/mobile-contextmenu.render-controller.ts b/packages/sheets-ui/src/controllers/render-controllers/mobile/mobile-contextmenu.render-controller.tsnew file mode 100644index 0000000000..ec8e4b164c--- /dev/null+++ b/packages/sheets-ui/src/controllers/render-controllers/mobile/mobile-contextmenu.render-controller.ts@@ -0,0 +1,71 @@+/**+ * 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 { Workbook } from '@univerjs/core';+import { Disposable, Rectangle } from '@univerjs/core';+import type { IPointerEvent, IRenderContext, IRenderModule } from '@univerjs/engine-render';+import { IContextMenuService, ILayoutService, MenuPosition } from '@univerjs/ui';+import { SelectionManagerService } from '@univerjs/sheets';+import { Inject } from '@wendellhu/redi';+import { ISelectionRenderService } from '../../../services/selection/selection-render.service';++/**+ * On mobile devices, the context menu would popup when+ *+ * @ignore+ */+export class SheetContextMenuMobileRenderController extends Disposable implements IRenderModule {+ constructor(+ private readonly _context: IRenderContext<Workbook>,+ @ILayoutService private readonly _layoutService: ILayoutService,+ @IContextMenuService private readonly _contextMenuService: IContextMenuService,+ @Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,+ @ISelectionRenderService private readonly _selectionRenderService: ISelectionRenderService+ ) {+ super();++ this._init();+ }++ private _init(): void {+ let listenToSelectionChangeEvent = false;++ this.disposeWithMe(this._selectionManagerService.selectionMoveStart$.subscribe(() => listenToSelectionChangeEvent = true));+ this.disposeWithMe(this._selectionManagerService.selectionMoveEnd$.subscribe((selection) => {+ if (!selection || listenToSelectionChangeEvent === false) {+ return;+ }++ listenToSelectionChangeEvent = false;++ const selectionRange = selection[0];+ if (!selectionRange.primary || Rectangle.equals(selectionRange.range, selectionRange.primary)) {+ return;+ }++ const canvasRect = this._layoutService.getCanvasElement().getBoundingClientRect();+ const range = this._selectionRenderService.attachSelectionWithCoord(selectionRange);+ this._contextMenuService.triggerContextMenu({+ // TODO@wzhudev: there is an offset with the rangeWithCoord.endX and rangeWithCoord.endY+ // with the client rect+ clientX: range.rangeWithCoord.startX + canvasRect.left,+ clientY: range.rangeWithCoord.endY + canvasRect.top,+ preventDefault: () => {},+ stopPropagation: () => {},+ } as unknown as IPointerEvent, MenuPosition.CONTEXT_MENU);+ }));+ }+}diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.tsindex eb695d75be..6297484a7a 100644--- a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts+++ b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts@@ -228,6 +228,7 @@ import {} from './shortcuts/view.shortcut';import { CellBorderSelectorMenuItemFactory } from './menu/border.menu';import { CellMergeAllMenuItemFactory, CellMergeCancelMenuItemFactory, CellMergeHorizontalMenuItemFactory, CellMergeMenuItemFactory, CellMergeVerticalMenuItemFactory } from './menu/merge.menu';+import { sheetPermissionAddProtectContextMenuFactory, sheetPermissionChangeSheetPermissionSheetBarMenuFactory, sheetPermissionContextMenuFactory, sheetPermissionEditProtectContextMenuFactory, sheetPermissionProtectSheetInSheetBarMenuFactory, sheetPermissionRemoveProtectContextMenuFactory, sheetPermissionRemoveProtectionSheetBarMenuFactory, sheetPermissionToolbarMenuFactory, sheetPermissionViewAllProtectRuleContextMenuFactory, sheetPermissionViewAllProtectRuleSheetBarMenuFactory } from './menu/permission.menu';export interface IUniverSheetsUIConfig {menu: MenuConfig;@@ -355,6 +356,7 @@ export class SheetUIController extends Disposable {});}+ // eslint-disable-next-line max-lines-per-functionprivate _initMenus(): void {const { menu = {} } = this._config;@@ -430,6 +432,18 @@ export class SheetUIController extends Disposable {ChangeColorSheetMenuItemFactory,HideSheetMenuItemFactory,ShowMenuItemFactory,++ // sheet protection+ sheetPermissionContextMenuFactory,+ sheetPermissionAddProtectContextMenuFactory,+ sheetPermissionEditProtectContextMenuFactory,+ sheetPermissionRemoveProtectContextMenuFactory,+ sheetPermissionViewAllProtectRuleContextMenuFactory,+ sheetPermissionProtectSheetInSheetBarMenuFactory,+ sheetPermissionRemoveProtectionSheetBarMenuFactory,+ sheetPermissionChangeSheetPermissionSheetBarMenuFactory,+ sheetPermissionViewAllProtectRuleSheetBarMenuFactory,+ sheetPermissionToolbarMenuFactory,] as IMenuItemFactory[]).forEach((factory) => {this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.tsindex 525d668133..3b5637c380 100644--- a/packages/sheets-ui/src/index.ts+++ b/packages/sheets-ui/src/index.ts@@ -107,3 +107,4 @@ export { SheetPermissionInterceptorBaseController } from './controllers/permissiexport type { IRangeProtectionRenderCellData } from './views/permission/extensions/range-protection.render';export { ScrollToRangeOperation } from './commands/operations/scroll-to-range.operation';export { SheetPrintInterceptorService } from './services/print-interceptor.service';+export { UniverSheetsMobileUIPlugin } from './mobile-sheets-ui-plugin';diff --git a/packages/sheets-ui/src/mobile-sheets-ui-plugin.ts b/packages/sheets-ui/src/mobile-sheets-ui-plugin.tsnew file mode 100644index 0000000000..5b21d4fa46--- /dev/null+++ b/packages/sheets-ui/src/mobile-sheets-ui-plugin.ts@@ -0,0 +1,213 @@+/**+ * 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 { Workbook } from '@univerjs/core';+import { DependentOn, IUniverInstanceService, Plugin, Tools, UniverInstanceType } from '@univerjs/core';+import type { Dependency } from '@wendellhu/redi';+import { Inject, Injector } from '@wendellhu/redi';+import { filter } from 'rxjs/operators';++import { IRenderManagerService } from '@univerjs/engine-render';+import { UniverSheetsPlugin } from '@univerjs/sheets';+import { UniverMobileUIPlugin } from '@univerjs/ui';+import { ActiveWorksheetController } from './controllers/active-worksheet/active-worksheet.controller';+import { AutoHeightController } from './controllers/auto-height.controller';+import { SheetClipboardController } from './controllers/clipboard/clipboard.controller';+import { FormatPainterRenderController } from './controllers/render-controllers/format-painter.render-controller';+import { HeaderFreezeRenderController } from './controllers/render-controllers/freeze.render-controller';+import { HeaderMoveRenderController } from './controllers/render-controllers/header-move.render-controller';+import { MarkSelectionRenderController } from './controllers/mark-selection.controller';+import { SelectionRenderController } from './controllers/render-controllers/selection.render-controller';+import { SheetsRenderService } from './services/sheets-render.service';+import type { IUniverSheetsUIConfig } from './controllers/sheet-ui.controller';+import { DefaultSheetUiConfig } from './controllers/sheet-ui.controller';+import { StatusBarController } from './controllers/status-bar.controller';+import { AutoFillService, IAutoFillService } from './services/auto-fill/auto-fill.service';+import { ISheetClipboardService, SheetClipboardService } from './services/clipboard/clipboard.service';+import { FormatPainterService, IFormatPainterService } from './services/format-painter/format-painter.service';+import { IMarkSelectionService, MarkSelectionService } from './services/mark-selection/mark-selection.service';+import { ScrollManagerService } from './services/scroll-manager.service';+import { ISelectionRenderService, SelectionRenderService } from './services/selection/selection-render.service';+import { ISheetBarService, SheetBarService } from './services/sheet-bar/sheet-bar.service';+import { SheetSkeletonManagerService } from './services/sheet-skeleton-manager.service';+import { ShortcutExperienceService } from './services/shortcut-experience.service';+import { IStatusBarService, StatusBarService } from './services/status-bar.service';+import { HoverRenderController } from './controllers/hover-render.controller';+import { HoverManagerService } from './services/hover-manager.service';+import { CellAlertManagerService } from './services/cell-alert-manager.service';+import { CellAlertRenderController } from './controllers/cell-alert.controller';+import { CellCustomRenderController } from './controllers/cell-custom-render.controller';+import { SheetCanvasPopManagerService } from './services/canvas-pop-manager.service';+import { ForceStringRenderController } from './controllers/force-string-render.controller';+import { ForceStringAlertRenderController } from './controllers/force-string-alert-render.controller';+import { SheetsZoomRenderController } from './controllers/render-controllers/zoom.render-controller';+import { SheetsScrollRenderController } from './controllers/render-controllers/scroll.render-controller';+// import { SheetContextMenuRenderController } from './controllers/render-controllers/contextmenu.render-controller';+import { DragRenderController } from './controllers/drag-render.controller';+import { DragManagerService } from './services/drag-manager.service';+import { SheetPermissionInterceptorClipboardController } from './controllers/permission/sheet-permission-interceptor-clipboard.controller';+import { SheetPermissionInterceptorBaseController } from './controllers/permission/sheet-permission-interceptor-base.controller';+import { SheetPermissionInitController } from './controllers/permission/sheet-permission-init.controller';+import { SheetPermissionRenderController, SheetPermissionRenderManagerController } from './controllers/permission/sheet-permission-render.controller';+import { SheetPermissionInterceptorCanvasRenderController } from './controllers/permission/sheet-permission-interceptor-canvas-render.controller';+import { SheetPermissionInterceptorFormulaRenderController } from './controllers/permission/sheet-permission-interceptor-formula-render.controller';+import { SheetPermissionPanelModel } from './services/permission/sheet-permission-panel.model';+import { SheetPermissionUserManagerService } from './services/permission/sheet-permission-user-list.service';+import { WorksheetProtectionRenderService } from './services/permission/worksheet-permission-render.service';+import { SheetPrintInterceptorService } from './services/print-interceptor.service';+import { SheetUIMobileController } from './controllers/mobile/mobile-sheet-ui.controller';+import { SheetContextMenuMobileRenderController } from './controllers/render-controllers/mobile/mobile-contextmenu.render-controller';+import { SheetRenderController } from './controllers/render-controllers/sheet.render-controller';++/**+ * @ignore+ */+@DependentOn(UniverSheetsPlugin, UniverMobileUIPlugin)+export class UniverSheetsMobileUIPlugin extends Plugin {+ static override pluginName = 'SHEET_UI_PLUGIN';+ static override type = UniverInstanceType.UNIVER_SHEET;++ constructor(+ private readonly _config: Partial<IUniverSheetsUIConfig> = {},+ @Inject(Injector) override readonly _injector: Injector,+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,+ @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService+ ) {+ super();++ this._config = Tools.deepMerge({}, DefaultSheetUiConfig, this._config);+ }++ override onStarting(injector: Injector): void {+ (+ [+ // services+ [ShortcutExperienceService],+ [ISheetClipboardService, { useClass: SheetClipboardService }],+ [ISheetBarService, { useClass: SheetBarService }],+ [IFormatPainterService, { useClass: FormatPainterService }],+ [IAutoFillService, { useClass: AutoFillService }],+ [SheetPrintInterceptorService],++ [ScrollManagerService],+ // This would be removed from global injector and moved into RenderUnit provider.+ // [SheetSkeletonManagerService],+ [ISelectionRenderService, { useClass: SelectionRenderService }],+ [IStatusBarService, { useClass: StatusBarService }],+ [IMarkSelectionService, { useClass: MarkSelectionService }],+ [HoverManagerService],+ [DragManagerService],+ [SheetCanvasPopManagerService],+ [CellAlertManagerService],++ // controllers+ [ActiveWorksheetController],+ [AutoHeightController],+ [HeaderFreezeRenderController],+ [SheetClipboardController],+ [SheetsRenderService],+ [+ SheetUIMobileController,+ {+ useFactory: () => this._injector.createInstance(SheetUIMobileController, this._config),+ },+ ],+ [StatusBarController],+ // [AutoFillController],+ // [FormatPainterController],++ // permission+ [SheetPermissionPanelModel],+ [SheetPermissionUserManagerService],+ [WorksheetProtectionRenderService],+ [SheetPermissionInterceptorClipboardController],+ [SheetPermissionInterceptorBaseController],+ [SheetPermissionInitController],+ ] as Dependency[]+ ).forEach((d) => injector.add(d));++ this._injector.add(+ [+ SheetPermissionRenderManagerController,+ {+ useFactory: () => this._injector.createInstance(SheetPermissionRenderManagerController, this._config),+ },+ ]++ );+ }++ override onReady(): void {+ this._markSheetAsFocused();+ this._registerRenderBasics();+ }++ override onRendered(): void {+ this._registerRenderModules();+ }++ private _registerRenderBasics(): void {+ ([+ SheetSkeletonManagerService,+ SheetRenderController,+ ]).forEach((controller) => {+ this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, controller));+ });+ }++ // We have to let render basics get bootstrapped before. Because some render controllers relies on+ // a correct skeleton when they get loaded.+ private _registerRenderModules(): void {+ ([+ // https://github.com/dream-num/univer-pro/issues/669+ // HeaderMoveRenderController(HMRC) must be initialized before SelectionRenderController(SRC).+ // Before HMRC expected selections remain unchanged when user clicks on the header. If we don't initialize HMRC before SRC,+ // the selections will be changed by SRC first. Maybe we should merge row/col header related render controllers to one class.+ HeaderMoveRenderController,+ SelectionRenderController,+ HeaderFreezeRenderController,+ // HeaderUnhideRenderController,+ // HeaderResizeRenderController,+ SheetsZoomRenderController,+ SheetsScrollRenderController,+ FormatPainterRenderController,+ // HeaderMenuRenderController,+ CellAlertRenderController,+ ForceStringAlertRenderController,+ MarkSelectionRenderController,+ HoverRenderController,+ DragRenderController,+ ForceStringRenderController,+ CellCustomRenderController,+ SheetContextMenuMobileRenderController,++ SheetPermissionInterceptorCanvasRenderController,+ SheetPermissionInterceptorFormulaRenderController,+ SheetPermissionRenderController,+ ]).forEach((controller) => {+ this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, controller));+ });+ }++ private _markSheetAsFocused() {+ const univerInstanceService = this._univerInstanceService;+ univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET)+ .pipe(filter((v) => !!v))+ .subscribe((workbook) => {+ univerInstanceService.focusUnit(workbook!.getUnitId());+ });+ }+}diff --git a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts b/packages/sheets-ui/src/services/clipboard/clipboard.service.tsindex 9594eb111f..6a9354d870 100644--- a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts+++ b/packages/sheets-ui/src/services/clipboard/clipboard.service.ts@@ -486,13 +486,8 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard}});- const pasteTarget = this._getPastedRange(- cellMatrix- );-- if (!pasteTarget) {- return false;- }+ const pasteTarget = this._getPastedRange(cellMatrix);+ if (!pasteTarget) return false;const worksheet = this._univerInstanceService.getUniverSheetInstance(pasteTarget.unitId)diff --git a/packages/sheets-ui/src/services/selection/__test__/selection-render.test.ts b/packages/sheets-ui/src/services/selection/__test__/selection-render.test.tsindex d4203b8f91..364e0efb73 100644--- a/packages/sheets-ui/src/services/selection/__test__/selection-render.test.ts+++ b/packages/sheets-ui/src/services/selection/__test__/selection-render.test.ts@@ -25,7 +25,7 @@ import {ThinEngine,} from '@univerjs/engine-render';import type { ISelectionWithCoordAndStyle } from '@univerjs/sheets';-import { DesktopPlatformService, DesktopShortcutService, IPlatformService, IShortcutService } from '@univerjs/ui';+import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';import type { Injector } from '@wendellhu/redi';import { beforeEach, describe, expect, it } from 'vitest';@@ -179,10 +179,10 @@ describe('Test indirect', () => {beforeEach(() => {const testBed = createCommandTestBed(undefined, [- [IShortcutService, { useClass: DesktopShortcutService }],+ [IShortcutService, { useClass: ShortcutService }],[SheetSkeletonManagerService],[SelectionRenderService],- [IPlatformService, { useClass: DesktopPlatformService }],+ [IPlatformService, { useClass: PlatformService }],[IRenderManagerService, { useClass: RenderManagerService }],]);diff --git a/packages/sheets-ui/src/sheets-ui-plugin.ts b/packages/sheets-ui/src/sheets-ui-plugin.tsindex ffd7220855..1907c832b4 100644--- a/packages/sheets-ui/src/sheets-ui-plugin.ts+++ b/packages/sheets-ui/src/sheets-ui-plugin.ts@@ -22,7 +22,6 @@ import { filter } from 'rxjs/operators';import { IRenderManagerService } from '@univerjs/engine-render';import { UniverSheetsPlugin } from '@univerjs/sheets';-import { UniverUIPlugin } from '@univerjs/ui';import { ActiveWorksheetController } from './controllers/active-worksheet/active-worksheet.controller';import { AutoHeightController } from './controllers/auto-height.controller';import { SheetClipboardController } from './controllers/clipboard/clipboard.controller';@@ -85,7 +84,7 @@ import { WorksheetProtectionRenderService } from './services/permission/worksheeimport { SheetPrintInterceptorService } from './services/print-interceptor.service';import { MoveRangeController } from './controllers/move-range.controller';-@DependentOn(UniverSheetsPlugin, UniverUIPlugin)+@DependentOn(UniverSheetsPlugin)export class UniverSheetsUIPlugin extends Plugin {static override pluginName = 'SHEET_UI_PLUGIN';static override type = UniverInstanceType.UNIVER_SHEET;diff --git a/packages/sheets-ui/src/views/desktop/.gitkeep b/packages/sheets-ui/src/views/desktop/.gitkeepnew file mode 100644index 0000000000..e69de29bb2diff --git a/packages/sheets-ui/src/views/mobile/sheet-bar/MobileSheetBar.tsx b/packages/sheets-ui/src/views/mobile/sheet-bar/MobileSheetBar.tsxnew file mode 100644index 0000000000..5ea2702140--- /dev/null+++ b/packages/sheets-ui/src/views/mobile/sheet-bar/MobileSheetBar.tsx@@ -0,0 +1,131 @@+/**+ * 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 React, { useCallback, useEffect, useState } from 'react';+import clsx from 'clsx';+import { useDependency } from '@wendellhu/redi/react-bindings';+import type { ICommandInfo, Workbook } from '@univerjs/core';+import { ICommandService } from '@univerjs/core';+import type { ISetWorksheetActiveOperationParams } from '@univerjs/sheets';+import {+ InsertSheetMutation,+ RemoveSheetMutation,+ SetWorksheetActiveOperation,+ SetWorksheetHideMutation,+ SetWorksheetNameMutation,+ SetWorksheetOrderMutation,+} from '@univerjs/sheets';+import type { IBaseSheetBarProps } from '../../sheet-bar/sheet-bar-tabs/SheetBarItem';+import { useActiveWorkbook } from '../../../components/hook';++import styles from './index.module.less';++export function MobileSheetBar() {+ const workbook = useActiveWorkbook();+ if (!workbook) {+ return null;+ }++ return <MobileSheetBarImpl workbook={workbook} />;+}++function MobileSheetBarImpl(props: { workbook: Workbook }) {+ const { workbook } = props;+ const [sheetList, setSheetList] = useState<IBaseSheetBarProps[]>([]);+ const [activeKey, setActiveKey] = useState('');+ const tabMapRef = React.useRef<Map<string, HTMLElement | null>>(new Map());++ const commandService = useDependency(ICommandService);++ const updateSheetItems = useCallback(() => {+ const currentSubUnitId = workbook.getActiveSheet()!.getSheetId();+ const sheets = workbook.getSheets();+ const activeSheet = workbook.getActiveSheet();+ const sheetListItems = sheets+ .filter((sheet) => !sheet.isSheetHidden())+ .map((sheet, index) => {+ return {+ sheetId: sheet.getSheetId(),+ label: sheet.getName(),+ index,+ selected: activeSheet === sheet,+ color: sheet.getTabColor() ?? undefined,+ };+ });++ setSheetList(sheetListItems);+ setActiveKey(currentSubUnitId);++ if (tabMapRef.current.has(currentSubUnitId)) {+ const element = tabMapRef.current.get(currentSubUnitId);+ if (element) {+ element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });+ }+ }++ tabMapRef.current.clear();+ }, [workbook]);++ useEffect(() => updateSheetItems(), [updateSheetItems]);++ const onTabClick = useCallback((sheetId: string) => {+ commandService.executeCommand(SetWorksheetActiveOperation.id, {+ unitId: workbook.getUnitId(),+ subUnitId: sheetId,+ } as ISetWorksheetActiveOperationParams);+ }, [commandService, workbook]);++ useEffect(() => {+ const disposable = commandService.onCommandExecuted((commandInfo: ICommandInfo) => {+ switch (commandInfo.id) {+ case SetWorksheetHideMutation.id:+ case RemoveSheetMutation.id:+ case SetWorksheetNameMutation.id:+ case InsertSheetMutation.id:+ case SetWorksheetOrderMutation.id:+ case SetWorksheetActiveOperation.id:+ updateSheetItems();+ break;+ default:+ break;+ }+ });++ return () => disposable.dispose();+ }, [commandService, updateSheetItems]);++ return (+ <div className={styles.mobileSheetBarContainer}>+ <div className={styles.mobileSheetBarSlider}>+ {sheetList.map((sheet) => (+ <div+ className={clsx(+ styles.mobileSheetBarItem,+ {+ [styles.mobileSheetBarItemActivated]: sheet.sheetId === activeKey,+ }+ )}+ key={sheet.sheetId}+ onClick={() => onTabClick(sheet.sheetId!)}+ ref={(element) => tabMapRef.current.set(sheet.sheetId!, element)}+ >+ {sheet.label}+ </div>+ ))}+ </div>+ </div>+ );+}diff --git a/packages/sheets-ui/src/views/mobile/sheet-bar/index.module.less b/packages/sheets-ui/src/views/mobile/sheet-bar/index.module.lessnew file mode 100644index 0000000000..929e78f324--- /dev/null+++ b/packages/sheets-ui/src/views/mobile/sheet-bar/index.module.less@@ -0,0 +1,40 @@+.mobile-sheet-bar {+ &-container {+ width: 100%;+ overflow-x: scroll;+ height: 32px;+ background-color: rgb(var(--bg-color));+ }++ &-slider {+ display: flex;+ flex-wrap: nowrap;+ align-items: center;+ height: 32px;+ }++ &-item {+ align-items: center;+ box-sizing: border-box;+ flex-grow: 1;+ flex-shrink: 0;+ flex-wrap: nowrap;+ font-size: 12px;+ height: 100%;+ line-height: 28px;+ min-width: 48px;+ overflow: hidden;+ padding: 2px 4px;+ text-align: center;+ white-space: nowrap;+ border-right: 1px solid rgb(var(--border-color));+ background-color: rgb(var(--bg-color));+ text-overflow: ellipsis;+ max-width: 120px;++ &.mobile-sheet-bar-item-activated {+ color: rgb(var(--primary-color));+ background-color: rgb(var(--bg-color-secondary));+ }+ }+}diff --git a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsx b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsxindex 6332531953..84d9a91812 100644--- a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsx+++ b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsx@@ -97,6 +97,7 @@ export function SheetBarMenu(props: ISheetBarMenuProps) {});setMenu(worksheetMenuItems);+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [workbook, worksheetProtectionRuleModel]);const setupStatusUpdate = useCallback(() =>diff --git a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsxindex cdbed3d4ba..2978da8146 100644--- a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx+++ b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx@@ -38,18 +38,18 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';import { LockSingle } from '@univerjs/icons';import { merge } from 'rxjs';+import { Quantity } from '@wendellhu/redi';import { SheetMenuPosition } from '../../../controllers/menu/menu';import { ISelectionRenderService } from '../../../services/selection/selection-render.service';import { ISheetBarService } from '../../../services/sheet-bar/sheet-bar.service';import { IEditorBridgeService } from '../../../services/editor-bridge.service';+import { useActiveWorkbook } from '../../../components/hook';import styles from './index.module.less';import type { IBaseSheetBarProps } from './SheetBarItem';import { SheetBarItem } from './SheetBarItem';import type { IScrollState } from './utils/slide-tab-bar';import { SlideTabBar } from './utils/slide-tab-bar';-export interface ISheetBarTabsProps { }-export function SheetBarTabs() {const [sheetList, setSheetList] = useState<IBaseSheetBarProps[]>([]);const [activeKey, setActiveKey] = useState('');@@ -65,15 +65,15 @@ export function SheetBarTabs() {const localeService = useDependency(LocaleService);const confirmService = useDependency(IConfirmService);const selectionRenderService = useDependency(ISelectionRenderService);- const editorBridgeService = useDependency(IEditorBridgeService);+ const editorBridgeService = useDependency(IEditorBridgeService, Quantity.OPTIONAL);const worksheetProtectionRuleModel = useDependency(WorksheetProtectionRuleModel);const rangeProtectionRuleModel = useDependency(RangeProtectionRuleModel);const resetOrder = useObservable(worksheetProtectionRuleModel.resetOrder$);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;+ const workbook = useActiveWorkbook()!;const permissionService = useDependency(IPermissionService);- const statusInit = useCallback(() => {+ const updateSheetItems = useCallback(() => {const currentSubUnitId = workbook.getActiveSheet()?.getSheetId() || '';setActiveKey(currentSubUnitId);@@ -93,6 +93,7 @@ export function SheetBarTabs() {</>): <span>{sheet.getName()}</span>;+return {sheetId: sheet.getSheetId(),label: name,@@ -101,11 +102,13 @@ export function SheetBarTabs() {color: sheet.getTabColor() ?? undefined,};});+setSheetList(sheetListItems);- }, [workbook, worksheetProtectionRuleModel]);+ setActiveKey(currentSubUnitId);+ }, [rangeProtectionRuleModel, workbook, worksheetProtectionRuleModel]);useEffect(() => {- statusInit();+ updateSheetItems();const slideTabBar = setupSlideTabBarInit();const disposable = setupStatusUpdate();const subscribeList = [@@ -133,13 +136,13 @@ export function SheetBarTabs() {worksheetProtectionRuleModel.ruleChange$,rangeProtectionRuleModel.ruleChange$).subscribe(() => {- statusInit();+ updateSheetItems();});return () => {subscription.unsubscribe();};- }, [worksheetProtectionRuleModel, statusInit]);+ }, [worksheetProtectionRuleModel, updateSheetItems]);const setupSlideTabBarInit = () => {const slideTabBar = new SlideTabBar({@@ -292,7 +295,7 @@ export function SheetBarTabs() {case InsertSheetMutation.id:case SetWorksheetOrderMutation.id:case SetWorksheetActiveOperation.id:- statusInit();+ updateSheetItems();break;default:break;@@ -360,9 +363,10 @@ export function SheetBarTabs() {};const onVisibleChange = (visible: boolean) => {- if (editorBridgeService.isForceKeepVisible()) {+ if (editorBridgeService?.isForceKeepVisible()) {return;}+if (visible) {const { left: containerLeft } = slideTabBarContainerRef.current?.getBoundingClientRect() ?? {};// current active tab positiondiff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.tsindex 5d19d0f67c..1585a62d2c 100644--- a/packages/ui/src/components/index.ts+++ b/packages/ui/src/components/index.ts@@ -17,5 +17,4 @@export * from './custom-label';export * from './font-family';export * from './font-size';-export * from './menu';export { useScrollYOverContainer } from './hooks/layout';diff --git a/packages/ui/src/components/menu/common/hook.ts b/packages/ui/src/components/menu/common/hook.tsnew file mode 100644index 0000000000..9edee02f9e--- /dev/null+++ b/packages/ui/src/components/menu/common/hook.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.+ */++import { useObservable } from '@wendellhu/redi/react-bindings';+import type { IDisplayMenuItem, IMenuItem } from '../../../services/menu/menu';++export function useMenuItemState(+ menuItem: IDisplayMenuItem<IMenuItem>+) {+ const disabled = useObservable<boolean>(menuItem.disabled$, false);+ const activated = useObservable<boolean>(menuItem.activated$, false);+};diff --git a/packages/ui/src/components/menu/Menu.tsx b/packages/ui/src/components/menu/desktop/Menu.tsxsimilarity index 93%rename from packages/ui/src/components/menu/Menu.tsxrename to packages/ui/src/components/menu/desktop/Menu.tsxindex 8e3483b345..040b6558d7 100644--- a/packages/ui/src/components/menu/Menu.tsx+++ b/packages/ui/src/components/menu/desktop/Menu.tsx@@ -35,13 +35,13 @@ import type {IMenuSelectorItem,IValueOption,MenuItemDefaultValueType,-} from '../../services/menu/menu';-import { MenuGroup, MenuItemType } from '../../services/menu/menu';-import { IMenuService } from '../../services/menu/menu.service';-import { CustomLabel } from '../custom-label/CustomLabel';-import { useObservable } from '../hooks/observable';-import { useScrollYOverContainer } from '../hooks/layout.ts';-import { ILayoutService } from '../../services/layout/layout.service';+} from '../../../services/menu/menu.ts';+import { MenuGroup, MenuItemType } from '../../../services/menu/menu.ts';+import { IMenuService } from '../../../services/menu/menu.service.ts';+import { CustomLabel } from '../../custom-label/CustomLabel.tsx';+import { useObservable } from '../../hooks/observable.ts';+import { useScrollYOverContainer } from '../../hooks/layout.ts';+import { ILayoutService } from '../../../services/layout/layout.service.ts';import styles from './index.module.less';// TODO: @jikkai disabled and hidden are not working@@ -64,7 +64,9 @@ function MenuWrapper(props: IBaseMenuProps) {const { menuType, onOptionSelect } = props;const menuService = useDependency(IMenuService);- if (!menuType) return;+ if (!menuType) {+ return null;+ };if (Array.isArray(menuType)) {const menuTypes = menuType.map((type) => menuService.getMenuItems(type));@@ -190,18 +192,17 @@ export const Menu = (props: IBaseMenuProps) => {interface IMenuItemProps {menuItem: IDisplayMenuItem<IMenuItem>;- onClick: (params: Partial<IValueOption>) => void;+ onClick: (object: Partial<IValueOption>) => void;}function MenuItem({ menuItem, onClick }: IMenuItemProps) {const menuService = useDependency(IMenuService);- const menuItems = menuItem.id ? menuService.getMenuItems(menuItem.id) : [];-const disabled = useObservable<boolean>(menuItem.disabled$, false);const activated = useObservable<boolean>(menuItem.activated$, false);const hidden = useObservable(menuItem.hidden$, false);const value = useObservable<MenuItemDefaultValueType>(menuItem.value$);+const item = menuItem as IDisplayMenuItem<IMenuSelectorItem>;const selectionsFromObservable = useObservable(isObservable(item.selections) ? item.selections : undefined);const [inputValue, setInputValue] = useState(value);@@ -291,6 +292,7 @@ function MenuItem({ menuItem, onClick }: IMenuItemProps) {);};+ const subMenuItems = menuItem.id ? menuService.getMenuItems(menuItem.id) : [];const renderSubItemsType = () => {const item = menuItem as IDisplayMenuItem<IMenuSelectorItem>;@@ -306,7 +308,7 @@ function MenuItem({ menuItem, onClick }: IMenuItemProps) {)}expandIcon={<MoreSingle className={styles.menuItemMoreIcon} />}>- {menuItems.length && <MenuWrapper menuType={item.id} parentKey={item.id} onOptionSelect={onClick} />}+ {subMenuItems.length && <MenuWrapper menuType={item.id} parentKey={item.id} onOptionSelect={onClick} />}</DesignSubMenu>);};diff --git a/packages/ui/src/components/menu/index.module.less b/packages/ui/src/components/menu/desktop/index.module.lesssimilarity index 100%rename from packages/ui/src/components/menu/index.module.lessrename to packages/ui/src/components/menu/desktop/index.module.lessdiff --git a/packages/ui/src/components/menu/mobile/MobileMenu.stories.tsx b/packages/ui/src/components/menu/mobile/MobileMenu.stories.tsxnew file mode 100644index 0000000000..42eddcdf35--- /dev/null+++ b/packages/ui/src/components/menu/mobile/MobileMenu.stories.tsx@@ -0,0 +1,129 @@+/**+ * 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 { Meta } from '@storybook/react';+import React, { useState } from 'react';+import { LocaleType, Plugin, Univer, UniverInstanceType } from '@univerjs/core';+import { RediContext } from '@wendellhu/redi/react-bindings';+import type { IAccessor } from '@wendellhu/redi';+import { Inject, Injector } from '@wendellhu/redi';+import { of } from 'rxjs';+import { IMenuService, MenuService } from '../../../services/menu/menu.service';+import { IShortcutService, ShortcutService } from '../../../services/shortcut/shortcut.service';+import { IPlatformService, PlatformService } from '../../../services/platform/platform.service';+import type { IMenuButtonItem } from '../../../services/menu/menu';+import { MenuItemType, MenuPosition } from '../../../services/menu/menu';+import { ComponentManager } from '../../../common';+import { MobileMenu } from './MobileMenu';++const meta: Meta = {+ title: 'Components / MobileMenuItem',+ parameters: {+ layout: 'centered',+ },+ tags: ['autodocs'],+};++export default meta;++function MockMenuItemFactory(_accessor: IAccessor): IMenuButtonItem {+ return {+ id: 'mock-menu-item',+ type: MenuItemType.BUTTON,+ title: 'Copy',+ icon: 'Copy',+ positions: [+ MenuPosition.CONTEXT_MENU,+ ],+ disabled$: of(false),+ };+}++function MockMenuItemFactory2(_accessor: IAccessor): IMenuButtonItem {+ return {+ id: 'mock-menu-item-2',+ type: MenuItemType.BUTTON,+ title: 'Paste',+ icon: 'PasteSpecial',+ positions: [+ MenuPosition.CONTEXT_MENU,+ ],+ disabled$: of(false),+ };+}++function MockMenuItemFactory3(_accessor: IAccessor): IMenuButtonItem {+ return {+ id: 'mock-menu-item-3',+ type: MenuItemType.BUTTON,+ title: 'Paste All',+ icon: 'PasteSpecial',+ positions: [+ MenuPosition.CONTEXT_MENU,+ ],+ disabled$: of(false),+ };+}++function createMobileMenuStorybookBed() {+ const univer = new Univer({+ locale: LocaleType.EN_US,+ locales: {+ [LocaleType.EN_US]: {},+ },+ });+ const injector = univer.__getInjector();++ class TestPlugin extends Plugin {+ static override type = UniverInstanceType.UNIVER_UNKNOWN;+ static override pluginName = 'test-plugin';++ constructor(+ private readonly _config: undefined,+ @Inject(Injector) protected override _injector: Injector+ ) {+ super();+ }++ override onStarting(injector: Injector): void {+ injector.add([IPlatformService, { useClass: PlatformService }]);+ injector.add([IShortcutService, { useClass: ShortcutService }]);+ injector.add([IMenuService, { useClass: MenuService }]);+ injector.add([ComponentManager]);++ const menuService = injector.get(IMenuService);+ menuService.addMenuItem(injector.invoke(MockMenuItemFactory), {});+ menuService.addMenuItem(injector.invoke(MockMenuItemFactory2), {});+ menuService.addMenuItem(injector.invoke(MockMenuItemFactory3), {});+ }+ }++ univer.registerPlugin(TestPlugin);++ return { univer, injector };+}++export const Playground = {+ render() {+ const [bed] = useState(() => createMobileMenuStorybookBed());++ return (+ <RediContext.Provider value={{ injector: bed.injector }}>+ <MobileMenu menuType={MenuPosition.CONTEXT_MENU} />+ </RediContext.Provider>+ );+ },+};diff --git a/packages/ui/src/components/menu/mobile/MobileMenu.tsx b/packages/ui/src/components/menu/mobile/MobileMenu.tsxnew file mode 100644index 0000000000..064db9e4aa--- /dev/null+++ b/packages/ui/src/components/menu/mobile/MobileMenu.tsx@@ -0,0 +1,94 @@+/**+ * 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 React from 'react';+import { useDependency, useObservable } from '@wendellhu/redi/react-bindings';+import { makeArray } from '@univerjs/core';+import { clsx } from 'clsx';+import type { IBaseMenuProps } from '../desktop/Menu';+import { IMenuService } from '../../../services/menu/menu.service';+import type { IDisplayMenuItem, IMenuItem, IValueOption, MenuItemDefaultValueType } from '../../../services/menu/menu';+import { MenuItemType } from '../../../services/menu/menu';++import { CustomLabel } from '../../custom-label';+import styles from './index.module.less';++/**+ * The mobile context menu wrapper.+ */+export function MobileMenu(props: IBaseMenuProps) {+ const { menuType, onOptionSelect } = props;+ const menuService = useDependency(IMenuService);++ if (!menuType) {+ return null;+ }++ // There is no submenu on mobile devices, so if there are sub menu items, we should flat them.+ const flattedMenuItems = makeArray<string>(menuType).map(menuService.getMenuItems.bind(menuService)).flat();+ return (+ <div+ className={styles.mobileMenuContainer}+ style={{+ gridTemplateColumns: `repeat(${Math.min(2, flattedMenuItems.length)}, 48px)`,+ }}+ >+ {flattedMenuItems.map((item) => (+ <MobileMenuItem+ key={item.id}+ menuItem={item}+ onClick={(object: Partial<IValueOption>) => onOptionSelect?.({ value: '', label: item.id, ...object })}+ />+ ))}+ </div>+ );+}++interface IMobileMenuItemProps {+ menuItem: IDisplayMenuItem<IMenuItem>;+ onClick: (object: Partial<IValueOption>) => void;+}++function MobileMenuItem(props: IMobileMenuItemProps) {+ const { menuItem, onClick } = props;+ const { id, type, title, label, icon } = menuItem;++ if (type !== MenuItemType.BUTTON) {+ throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${id}".`);+ }++ const disabled = useObservable<boolean>(menuItem.disabled$, false);+ const activated = useObservable<boolean>(menuItem.activated$, false);+ const hidden = useObservable(menuItem.hidden$, false);+ const value = useObservable<MenuItemDefaultValueType>(menuItem.value$);++ const className = clsx(styles.mobileMenuItem, {+ [styles.mobileMenuItemActivated]: activated,+ [styles.mobileMenuItemHidden]: hidden,+ });++ return (+ <button+ type="button"+ className={className}+ key={id}+ disabled={disabled}+ onClick={() => onClick({ id })}+ >+ <CustomLabel value={value} title={title} label={label} icon={icon} />+ </button>+ );+}diff --git a/packages/ui/src/components/menu/mobile/index.module.less b/packages/ui/src/components/menu/mobile/index.module.lessnew file mode 100644index 0000000000..06c74e1901--- /dev/null+++ b/packages/ui/src/components/menu/mobile/index.module.less@@ -0,0 +1,39 @@+.mobile {+ &-menu {+ &-container {+ min-width: 32px;+ max-width: 200px;+ display: grid;+ grid-gap: 4px;+ background-color: black;+ border-radius: 4px;+ padding: 4px 8px;+ }++ &-item {+ display: flex;+ flex-direction: column;+ justify-content: center;+ align-items: center;+ border: none;+ background: none;+ color: white;+ width: 48px;++ > svg {+ font-size: 18px;+ height: 18px;+ width: 18px;+ }++ > span {+ width: 100%;+ margin-top: 2px;+ font-size: 13px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ }+ }+}diff --git a/packages/ui/src/controllers/shared-shortcut.controller.ts b/packages/ui/src/controllers/shared-shortcut.controller.tsindex b2be11900a..52a4f6d524 100644--- a/packages/ui/src/controllers/shared-shortcut.controller.ts+++ b/packages/ui/src/controllers/shared-shortcut.controller.ts@@ -94,7 +94,7 @@ export const RedoShortcutItem: IShortcutItem = {@OnLifecycle(LifecycleStages.Ready, SharedController)export class SharedController extends Disposable {constructor(- private readonly _config: Partial<IUniverUIConfig>,+ private readonly _config: Pick<IUniverUIConfig, 'menu'> | undefined,@Inject(Injector) private readonly _injector: Injector,@IMenuService private readonly _menuService: IMenuService,@IShortcutService private readonly _shortcutService: IShortcutService,@@ -112,7 +112,7 @@ export class SharedController extends Disposable {}private _registerMenus(): void {- const { menu = {} } = this._config;+ const menu = this._config?.menu ?? {};[UndoMenuItemFactory, RedoMenuItemFactory].forEach((factory) => {this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));diff --git a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx b/packages/ui/src/controllers/ui/ui-desktop.controller.tsxindex 25761b7161..2eb0c41cf1 100644--- a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx+++ b/packages/ui/src/controllers/ui/ui-desktop.controller.tsx@@ -14,27 +14,27 @@* limitations under the License.*/-import { Disposable, isInternalEditorID, IUniverInstanceService, LifecycleService, LifecycleStages, toDisposable } from '@univerjs/core';+import { Disposable, isInternalEditorID, LifecycleService, LifecycleStages, OnLifecycle, toDisposable } from '@univerjs/core';import { IRenderManagerService } from '@univerjs/engine-render';import type { IDisposable } from '@wendellhu/redi';import { Inject, Injector, Optional } from '@wendellhu/redi';import { connectInjector } from '@wendellhu/redi/react-bindings';import { render as createRoot, unmount } from 'rc-util/lib/React/render';import React from 'react';-import { delay, filter, take } from 'rxjs';import { ILayoutService } from '../../services/layout/layout.service';-import { App } from '../../views/App';+import { DesktopApp } from '../../views/DesktopApp';import { BuiltInUIPart, IUIPartsService } from '../../services/parts/parts.service';import { CanvasPopup } from '../../views/components/popup/CanvasPopup';import { FloatDom } from '../../views/components/dom/FloatDom';-import type { IWorkbenchOptions } from './ui.controller';+import type { IUniverUIConfig, IWorkbenchOptions } from './ui.controller';const STEADY_TIMEOUT = 3000;+@OnLifecycle(LifecycleStages.Ready, DesktopUIController)export class DesktopUIController extends Disposable {constructor(- @IUniverInstanceService private readonly _instanceService: IUniverInstanceService,+ private readonly _config: IUniverUIConfig,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@Inject(Injector) private readonly _injector: Injector,@Inject(LifecycleService) private readonly _lifecycleService: LifecycleService,@@ -42,12 +42,15 @@ export class DesktopUIController extends Disposable {@Optional(ILayoutService) private readonly _layoutService?: ILayoutService) {super();+this._initBuiltinComponents();++ Promise.resolve().then(() => this._bootstrapWorkbench());}- bootstrapWorkbench(options: IWorkbenchOptions): void {+ private _bootstrapWorkbench(): void {this.disposeWithMe(- bootstrap(this._injector, options, (canvasElement, containerElement) => {+ bootstrap(this._injector, this._config, (canvasElement, containerElement) => {if (this._layoutService) {this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement));this.disposeWithMe(this._layoutService.registerCanvasElement(canvasElement as HTMLCanvasElement));@@ -64,16 +67,12 @@ export class DesktopUIController extends Disposable {}});- this._lifecycleService.lifecycle$.pipe(- filter((lifecycle) => lifecycle === LifecycleStages.Ready),- delay(300),- take(1)- ).subscribe(() => {+ setTimeout(() => {const engine = this._renderManagerService.getFirst()?.engine;engine?.setContainer(canvasElement);this._lifecycleService.stage = LifecycleStages.Rendered;setTimeout(() => this._lifecycleService.stage = LifecycleStages.Steady, STEADY_TIMEOUT);- });+ }, 300);}));}@@ -105,7 +104,7 @@ function bootstrap(mountContainer = createContainer('univer');}- const ConnectedApp = connectInjector(App, injector);+ const ConnectedApp = connectInjector(DesktopApp, injector);const onRendered = (canvasElement: HTMLElement) => callback(canvasElement, mountContainer);function render() {diff --git a/packages/ui/src/controllers/ui/ui-mobile.controller.tsx b/packages/ui/src/controllers/ui/ui-mobile.controller.tsxnew file mode 100644index 0000000000..7715c8daa0--- /dev/null+++ b/packages/ui/src/controllers/ui/ui-mobile.controller.tsx@@ -0,0 +1,134 @@+/**+ * 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, IUniverInstanceService, LifecycleService, LifecycleStages, toDisposable, UniverInstanceType } from '@univerjs/core';+import { IRenderManagerService } from '@univerjs/engine-render';+import type { IDisposable } from '@wendellhu/redi';+import { Inject, Injector, Optional } from '@wendellhu/redi';+import { connectInjector } from '@wendellhu/redi/react-bindings';+import { render as createRoot, unmount } from 'rc-util/lib/React/render';+import React from 'react';++import { ILayoutService } from '../../services/layout/layout.service';+import { BuiltInUIPart, IUIPartsService } from '../../services/parts/parts.service';+import { CanvasPopup } from '../../views/components/popup/CanvasPopup';+import { FloatDom } from '../../views/components/dom/FloatDom';+import { MobileApp } from '../../views/MobileApp';+import type { IUIController, IUniverUIConfig, IWorkbenchOptions } from './ui.controller';++const STEADY_TIMEOUT = 3000;++export class MobileUIController extends Disposable implements IUIController {+ constructor(+ private readonly _config: IUniverUIConfig,+ @IUniverInstanceService private readonly _instanceService: IUniverInstanceService,+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,+ @Inject(Injector) private readonly _injector: Injector,+ @Inject(LifecycleService) private readonly _lifecycleService: LifecycleService,+ @IUIPartsService private readonly _uiPartsService: IUIPartsService,+ @Optional(ILayoutService) private readonly _layoutService?: ILayoutService+ ) {+ super();++ this._initBuiltinComponents();++ Promise.resolve().then(() => this._bootstrapWorkbench());+ }++ private _bootstrapWorkbench(): void {+ this.disposeWithMe(+ bootstrap(this._injector, this._config, (canvasElement, containerElement) => {+ if (this._layoutService) {+ this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement));+ this.disposeWithMe(this._layoutService.registerCanvasElement(canvasElement as HTMLCanvasElement));+ }++ this._renderManagerService.currentRender$.subscribe((renderId) => {+ if (renderId) {+ const render = this._renderManagerService.getRenderById(renderId)!;+ if (!render.unitId) return;++ const unitType = this._instanceService.getUnitType(render.unitId);+ if (unitType !== UniverInstanceType.UNIVER_SHEET) return;++ render.engine.setContainer(canvasElement);+ }+ });++ setTimeout(() => {+ const engine = this._renderManagerService.getFirst()?.engine;+ engine?.setContainer(canvasElement);+ this._lifecycleService.stage = LifecycleStages.Rendered;+ setTimeout(() => this._lifecycleService.stage = LifecycleStages.Steady, STEADY_TIMEOUT);+ }, 300);+ })+ );+ }++ private _initBuiltinComponents() {+ this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(CanvasPopup, this._injector)));+ this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(FloatDom, this._injector)));+ }+}++function bootstrap(+ injector: Injector,+ options: IWorkbenchOptions,+ callback: (canvasEl: HTMLElement, containerElement: HTMLElement) => void+): IDisposable {+ let mountContainer: HTMLElement;++ const container = options.container;+ if (typeof container === 'string') {+ const containerElement = document.getElementById(container);+ if (!containerElement) {+ mountContainer = createContainer(container);+ } else {+ mountContainer = containerElement;+ }+ } else if (container instanceof HTMLElement) {+ mountContainer = container;+ } else {+ mountContainer = createContainer('univer');+ }++ const ConnectedApp = connectInjector(MobileApp, injector);+ const onRendered = (canvasElement: HTMLElement) => callback(canvasElement, mountContainer);++ function render() {+ createRoot(+ <ConnectedApp+ {...options}+ mountContainer={mountContainer}+ onRendered={onRendered}+ />,+ mountContainer+ );+ }++ render();++ return toDisposable(() => {+ unmount(mountContainer);+ });+}++function createContainer(id: string): HTMLElement {+ const element = document.createElement('div');+ element.id = id;+ // FIXME: the element is not append to the DOM tree. So it won't be rendered.+ return element;+}diff --git a/packages/ui/src/controllers/ui/ui.controller.ts b/packages/ui/src/controllers/ui/ui.controller.tsindex 9ea5b8f535..76ec9cf507 100644--- a/packages/ui/src/controllers/ui/ui.controller.ts+++ b/packages/ui/src/controllers/ui/ui.controller.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import type { DependencyOverride } from '@univerjs/core';+import { type DependencyOverride, LifecycleStages, runOnLifecycle } from '@univerjs/core';import { createIdentifier } from '@wendellhu/redi';import type { MenuConfig } from '../../services/menu/menu';@@ -26,11 +26,9 @@ export interface IWorkbenchOptions {contextMenu?: boolean;}-export interface IUIController {- bootstrapWorkbench(options: IWorkbenchOptions): void;-}--export const IUIController = createIdentifier<IUIController>('univer.ui-controller');+export interface IUIController {}+export const IUIController = createIdentifier<IUIController>('univer.ui.ui-controller');+runOnLifecycle(LifecycleStages.Ready, IUIController);export interface IUniverUIConfig extends IWorkbenchOptions {/** Disable auto focus when Univer bootstraps. */diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.tsindex 395a613a2e..87082d84a8 100644--- a/packages/ui/src/index.ts+++ b/packages/ui/src/index.ts@@ -41,7 +41,7 @@ export {export { IConfirmService } from './services/confirm/confirm.service';export { DesktopConfirmService } from './services/confirm/desktop-confirm.service';export {- DesktopContextMenuService,+ ContextMenuService,type IContextMenuHandler,IContextMenuService,} from './services/contextmenu/contextmenu.service';@@ -63,22 +63,24 @@ export {MenuPosition,type MenuItemDefaultValueType,} from './services/menu/menu';-export { DesktopMenuService, IMenuService } from './services/menu/menu.service';+export { MenuService, IMenuService } from './services/menu/menu.service';export { DesktopMessageService } from './services/message/desktop-message.service';export { IMessageService } from './services/message/message.service';export { DesktopNotificationService } from './services/notification/desktop-notification.service';export { type NotificationType, type INotificationOptions } from './components/notification/Notification';export { INotificationService } from './services/notification/notification.service';-export { DesktopPlatformService, IPlatformService } from './services/platform/platform.service';+export { PlatformService, IPlatformService } from './services/platform/platform.service';export { DesktopGlobalZoneService } from './services/global-zone/desktop-global-zone.service';export { IGlobalZoneService } from './services/global-zone/global-zone.service';export { KeyCode, MetaKeys } from './services/shortcut/keycode';-export { DesktopShortcutService, type IShortcutItem, IShortcutService } from './services/shortcut/shortcut.service';+export { ShortcutService, type IShortcutItem, IShortcutService } from './services/shortcut/shortcut.service';export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';export { ISidebarService } from './services/sidebar/sidebar.service';export { IZenZoneService } from './services/zen-zone/zen-zone.service';export { UniverUIPlugin, DISABLE_AUTO_FOCUS_KEY } from './ui-plugin';+export { UniverMobileUIPlugin } from './mobile-ui-plugin';export * from './utils';+export { Menu } from './components/menu/desktop/Menu';export { type IConfirmPartMethodOptions } from './views/components/confirm-part/interface';export { ComponentContainer, useComponentsOfPart, type IComponentContainerProps } from './views/components/ComponentContainer';export { IEditorService, EditorService } from './services/editor/editor.service';@@ -98,7 +100,7 @@ export type { IProgressStep } from './services/progress/progress.service';export { GlobalZone } from './views/components/global-zone/GlobalZone';export { builtInGlobalComponents } from './views/parts';-export { ContextMenu } from './views/components/context-menu/ContextMenu';+export { DesktopContextMenu as ContextMenu } from './views/components/context-menu/ContextMenu';export { Sidebar } from './views/components/sidebar/Sidebar';export { ZenZone } from './views/components/zen-zone/ZenZone';export { CanvasPopup } from './views/components/popup/CanvasPopup';diff --git a/packages/ui/src/mobile-ui-plugin.ts b/packages/ui/src/mobile-ui-plugin.tsnew file mode 100644index 0000000000..71b0d00811--- /dev/null+++ b/packages/ui/src/mobile-ui-plugin.ts@@ -0,0 +1,121 @@+/**+ * 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 { DependentOn, IContextService, ILocalStorageService, mergeOverrideWithDependencies, Plugin } from '@univerjs/core';+import type { Dependency } from '@wendellhu/redi';+import { Inject, Injector } from '@wendellhu/redi';+import { UniverRenderEnginePlugin } from '@univerjs/engine-render';+import { CanvasPopupService, ICanvasPopupService } from './services/popup/canvas-popup.service';+import { DesktopGlobalZoneService } from './services/global-zone/desktop-global-zone.service';+import { IGlobalZoneService } from './services/global-zone/global-zone.service';+import { ComponentManager } from './common/component-manager';+import { ZIndexManager } from './common/z-index-manager';+import { ErrorController } from './controllers/error/error.controller';+import { SharedController } from './controllers/shared-shortcut.controller';+import type { IUniverUIConfig } from './controllers/ui/ui.controller';+import { IUIController } from './controllers/ui/ui.controller';+import { DesktopBeforeCloseService, IBeforeCloseService } from './services/before-close/before-close.service';+import { BrowserClipboardService, IClipboardInterfaceService } from './services/clipboard/clipboard-interface.service';+import { IConfirmService } from './services/confirm/confirm.service';+import { DesktopConfirmService } from './services/confirm/desktop-confirm.service';+import { ContextMenuService, IContextMenuService } from './services/contextmenu/contextmenu.service';+import { DesktopDialogService } from './services/dialog/desktop-dialog.service';+import { IDialogService } from './services/dialog/dialog.service';+import { DesktopLayoutService, ILayoutService } from './services/layout/layout.service';+import { DesktopLocalStorageService } from './services/local-storage/local-storage.service';+import { IMenuService, MenuService } from './services/menu/menu.service';+import { DesktopMessageService } from './services/message/desktop-message.service';+import { IMessageService } from './services/message/message.service';+import { DesktopNotificationService } from './services/notification/desktop-notification.service';+import { INotificationService } from './services/notification/notification.service';+import { IPlatformService, PlatformService } from './services/platform/platform.service';+import { IShortcutService, ShortcutService } from './services/shortcut/shortcut.service';+import { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';+import { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';+import { ISidebarService } from './services/sidebar/sidebar.service';+import { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';+import { IZenZoneService } from './services/zen-zone/zen-zone.service';+import { EditorService, IEditorService } from './services/editor/editor.service';+import { IRangeSelectorService, RangeSelectorService } from './services/range-selector/range-selector.service';+import { IProgressService, ProgressService } from './services/progress/progress.service';+import { IUIPartsService, UIPartsService } from './services/parts/parts.service';+import { CanvasFloatDomService } from './services/dom/canvas-dom-layer.service';+import { MobileUIController } from './controllers/ui/ui-mobile.controller';++export const UNIVER_MOBILE_UI_PLUGIN_NAME = 'UNIVER_MOBILE_UI_PLUGIN';++/**+ * @ignore+ */+@DependentOn(UniverRenderEnginePlugin)+export class UniverMobileUIPlugin extends Plugin {+ static override pluginName = UNIVER_MOBILE_UI_PLUGIN_NAME;++ constructor(+ private _config: IUniverUIConfig,+ @IContextService private readonly _contextService: IContextService,+ @Inject(Injector) protected readonly _injector: Injector+ ) {+ super();+ }++ override onStarting(injector: Injector): void {+ const dependencies: Dependency[] = mergeOverrideWithDependencies([+ [ComponentManager],+ [ZIndexManager],++ // services+ [ShortcutPanelService],+ [IUIPartsService, { useClass: UIPartsService }],+ [ILayoutService, { useClass: DesktopLayoutService }],+ [IShortcutService, { useClass: ShortcutService }],+ [IPlatformService, { useClass: PlatformService }],+ [IMenuService, { useClass: MenuService }],+ [IContextMenuService, { useClass: ContextMenuService }],+ [IClipboardInterfaceService, { useClass: BrowserClipboardService, lazy: true }],+ [INotificationService, { useClass: DesktopNotificationService, lazy: true }],+ [IDialogService, { useClass: DesktopDialogService, lazy: true }],+ [IConfirmService, { useClass: DesktopConfirmService, lazy: true }],+ [ISidebarService, { useClass: DesktopSidebarService, lazy: true }],+ [IZenZoneService, { useClass: DesktopZenZoneService, lazy: true }],+ [IGlobalZoneService, { useClass: DesktopGlobalZoneService, lazy: true }],+ [IMessageService, { useClass: DesktopMessageService, lazy: true }],+ [ILocalStorageService, { useClass: DesktopLocalStorageService, lazy: true }],+ [IBeforeCloseService, { useClass: DesktopBeforeCloseService }],+ [IEditorService, { useClass: EditorService }],+ [IRangeSelectorService, { useClass: RangeSelectorService }],+ [ICanvasPopupService, { useClass: CanvasPopupService }],+ [IProgressService, { useClass: ProgressService }],+ [CanvasFloatDomService],++ // controllers+ [+ IUIController, {+ useFactory: (injector: Injector) => injector.createInstance(MobileUIController, this._config),+ deps: [Injector] },+ ],+ [+ SharedController,+ {+ useFactory: () => this._injector.createInstance(SharedController, this._config),+ },+ ],+ [ErrorController],+ ]);++ dependencies.forEach((dependency) => injector.add(dependency));+ }+}diff --git a/packages/ui/src/services/contextmenu/contextmenu.service.ts b/packages/ui/src/services/contextmenu/contextmenu.service.tsindex 6b2927e7a6..50791df3fc 100644--- a/packages/ui/src/services/contextmenu/contextmenu.service.ts+++ b/packages/ui/src/services/contextmenu/contextmenu.service.ts@@ -30,12 +30,13 @@ export interface IContextMenuService {enable(): void;disable(): void;triggerContextMenu(event: IPointerEvent | IMouseEvent, menuType: string): void;+registerContextMenuHandler(handler: IContextMenuHandler): IDisposable;}-export const IContextMenuService = createIdentifier<IContextMenuService>('univer.context-menu-service');+export const IContextMenuService = createIdentifier<IContextMenuService>('ui.contextmenu.service');-export class DesktopContextMenuService extends Disposable implements IContextMenuService {+export class ContextMenuService extends Disposable implements IContextMenuService {private _currentHandler: IContextMenuHandler | null = null;disabled: boolean = false;@@ -52,7 +53,6 @@ export class DesktopContextMenuService extends Disposable implements IContextMenevent.stopPropagation();if (this.disabled) return;-this._currentHandler?.handleContextMenu(event, menuType);}@@ -62,9 +62,6 @@ export class DesktopContextMenuService extends Disposable implements IContextMen}this._currentHandler = handler;-- return toDisposable(() => {- this._currentHandler = null;- });+ return toDisposable(() => this._currentHandler = null);}}diff --git a/packages/ui/src/services/layout/layout.service.ts b/packages/ui/src/services/layout/layout.service.tsindex 2cf8fe168c..911b999b2d 100644--- a/packages/ui/src/services/layout/layout.service.ts+++ b/packages/ui/src/services/layout/layout.service.ts@@ -15,7 +15,7 @@*/import type { ContextService, Nullable } from '@univerjs/core';-import { Disposable, DocumentDataModel, FOCUSING_UNIVER_EDITOR, IContextService, ILogService, IUniverInstanceService, LifecycleStages, OnLifecycle, remove, SlideDataModel, toDisposable, UniverInstanceType, Workbook } from '@univerjs/core';+import { Disposable, DocumentDataModel, FOCUSING_UNIVER_EDITOR, IContextService, IUniverInstanceService, LifecycleStages, OnLifecycle, remove, SlideDataModel, toDisposable, UniverInstanceType, Workbook } from '@univerjs/core';import { createIdentifier, type IDisposable } from '@wendellhu/redi';import { fromEvent } from 'rxjs';import { IEditorService } from '../editor/editor.service';@@ -48,6 +48,8 @@ export interface ILayoutService {/** Register an element as a container, especially floating components like Dialogs and Notifications. */registerContainerElement(container: HTMLElement): IDisposable;+ getCanvasElement(): HTMLCanvasElement;+checkElementInCurrentContainers(element: HTMLElement): boolean;checkCanvasIsFocused(): boolean;}@@ -74,7 +76,6 @@ export class DesktopLayoutService extends Disposable implements ILayoutService {constructor(@IContextService private readonly _contextService: ContextService,@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,- @ILogService private readonly _logService: ILogService,@IEditorService private readonly _editorService: IEditorService) {super();@@ -125,6 +126,10 @@ export class DesktopLayoutService extends Disposable implements ILayoutService {throw new Error('[DesktopLayoutService]: canvas container already registered!');}+ getCanvasElement(): HTMLCanvasElement {+ return this._canvasContainers[0];+ }+registerRootContainerElement(container: HTMLElement): IDisposable {if (this._rootContainerElement) {throw new Error('[DesktopLayoutService]: root container already registered!');diff --git a/packages/ui/src/services/menu/menu.service.ts b/packages/ui/src/services/menu/menu.service.tsindex b071194fec..595a4739a7 100644--- a/packages/ui/src/services/menu/menu.service.ts+++ b/packages/ui/src/services/menu/menu.service.ts@@ -38,7 +38,7 @@ export interface IMenuService {getMenuItem(id: string): IMenuItem | null;}-export class DesktopMenuService extends Disposable implements IMenuService {+export class MenuService extends Disposable implements IMenuService {private readonly _menuItemMap = new Map<string, IMenuItem>();private readonly _menuByPositions = new Map<MenuPosition | string, Array<[string, IMenuItem]>>();diff --git a/packages/ui/src/services/platform/platform.service.ts b/packages/ui/src/services/platform/platform.service.tsindex 2785793814..8b254c7bad 100644--- a/packages/ui/src/services/platform/platform.service.ts+++ b/packages/ui/src/services/platform/platform.service.ts@@ -25,9 +25,9 @@ export interface IPlatformService {readonly isLinux: boolean;}-export const IPlatformService = createIdentifier<IPlatformService>('univer.platform-service');+export const IPlatformService = createIdentifier<IPlatformService>('ui.platform.service');-export class DesktopPlatformService implements IPlatformService {+export class PlatformService implements IPlatformService {get isMac(): boolean {return /Mac/.test(navigator.appVersion);}diff --git a/packages/ui/src/services/shortcut/shortcut.service.ts b/packages/ui/src/services/shortcut/shortcut.service.tsindex f26fc7c6c1..ef3ab3cc9c 100644--- a/packages/ui/src/services/shortcut/shortcut.service.ts+++ b/packages/ui/src/services/shortcut/shortcut.service.ts@@ -68,7 +68,7 @@ export interface IShortcutService {export const IShortcutService = createIdentifier<IShortcutService>('univer.shortcut');-export class DesktopShortcutService extends Disposable implements IShortcutService {+export class ShortcutService extends Disposable implements IShortcutService {private readonly _shortCutMapping = new Map<number, Set<IShortcutItem>>();private readonly _commandIDMapping = new Map<string, Set<IShortcutItem>>();diff --git a/packages/ui/src/ui-plugin.ts b/packages/ui/src/ui-plugin.tsindex 6fafa06539..755f7714ae 100644--- a/packages/ui/src/ui-plugin.ts+++ b/packages/ui/src/ui-plugin.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { DependentOn, IContextService, ILocalStorageService, LocaleService, mergeOverrideWithDependencies, Plugin, Tools } from '@univerjs/core';+import { DependentOn, IContextService, ILocalStorageService, mergeOverrideWithDependencies, Plugin, Tools } from '@univerjs/core';import type { Dependency } from '@wendellhu/redi';import { Inject, Injector } from '@wendellhu/redi';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';@@ -34,18 +34,18 @@ import { DesktopBeforeCloseService, IBeforeCloseService } from './services/beforimport { BrowserClipboardService, IClipboardInterfaceService } from './services/clipboard/clipboard-interface.service';import { IConfirmService } from './services/confirm/confirm.service';import { DesktopConfirmService } from './services/confirm/desktop-confirm.service';-import { DesktopContextMenuService, IContextMenuService } from './services/contextmenu/contextmenu.service';+import { ContextMenuService, IContextMenuService } from './services/contextmenu/contextmenu.service';import { DesktopDialogService } from './services/dialog/desktop-dialog.service';import { IDialogService } from './services/dialog/dialog.service';import { DesktopLayoutService, ILayoutService } from './services/layout/layout.service';import { DesktopLocalStorageService } from './services/local-storage/local-storage.service';-import { DesktopMenuService, IMenuService } from './services/menu/menu.service';+import { IMenuService, MenuService } from './services/menu/menu.service';import { DesktopMessageService } from './services/message/desktop-message.service';import { IMessageService } from './services/message/message.service';import { DesktopNotificationService } from './services/notification/desktop-notification.service';import { INotificationService } from './services/notification/notification.service';-import { DesktopPlatformService, IPlatformService } from './services/platform/platform.service';-import { DesktopShortcutService, IShortcutService } from './services/shortcut/shortcut.service';+import { IPlatformService, PlatformService } from './services/platform/platform.service';+import { IShortcutService, ShortcutService } from './services/shortcut/shortcut.service';import { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';import { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';import { ISidebarService } from './services/sidebar/sidebar.service';@@ -73,8 +73,7 @@ export class UniverUIPlugin extends Plugin {constructor(private _config: Partial<IUniverUIConfig> = {},@IContextService private readonly _contextService: IContextService,- @Inject(Injector) protected readonly _injector: Injector,- @Inject(LocaleService) private readonly _localeService: LocaleService+ @Inject(Injector) protected readonly _injector: Injector) {super();@@ -85,16 +84,7 @@ export class UniverUIPlugin extends Plugin {}}- override onStarting(_injector: Injector): void {- this._initDependencies(_injector);- }-- override onReady(): void {- // TODO@Jocs: this has to be on Ready hook because of editor related modules' sequence problem.- this._initUI();- }-- private _initDependencies(injector: Injector): void {+ override onStarting(injector: Injector): void {const dependencies: Dependency[] = mergeOverrideWithDependencies([[ComponentManager],[ZIndexManager],@@ -103,10 +93,10 @@ export class UniverUIPlugin extends Plugin {[ShortcutPanelService],[IUIPartsService, { useClass: UIPartsService }],[ILayoutService, { useClass: DesktopLayoutService }],- [IShortcutService, { useClass: DesktopShortcutService }],- [IPlatformService, { useClass: DesktopPlatformService }],- [IMenuService, { useClass: DesktopMenuService }],- [IContextMenuService, { useClass: DesktopContextMenuService }],+ [IShortcutService, { useClass: ShortcutService }],+ [IPlatformService, { useClass: PlatformService }],+ [IMenuService, { useClass: MenuService }],+ [IContextMenuService, { useClass: ContextMenuService }],[IClipboardInterfaceService, { useClass: BrowserClipboardService, lazy: true }],[INotificationService, { useClass: DesktopNotificationService, lazy: true }],[IDialogService, { useClass: DesktopDialogService, lazy: true }],@@ -122,8 +112,14 @@ export class UniverUIPlugin extends Plugin {[ICanvasPopupService, { useClass: CanvasPopupService }],[IProgressService, { useClass: ProgressService }],[CanvasFloatDomService],+// controllers- [IUIController, { useClass: DesktopUIController }],+ [+ IUIController, {+ useFactory: (injector: Injector) => injector.createInstance(DesktopUIController, this._config),+ deps: [Injector],+ },+ ],[SharedController,{@@ -141,9 +137,4 @@ export class UniverUIPlugin extends Plugin {dependencies.forEach((dependency) => injector.add(dependency));}-- private _initUI(): void {- // We need to run this async to let other modules do their `onReady` jobs first.- setTimeout(() => this._injector.get(IUIController).bootstrapWorkbench(this._config), 16);- }}diff --git a/packages/ui/src/views/App.tsx b/packages/ui/src/views/DesktopApp.tsxsimilarity index 97%rename from packages/ui/src/views/App.tsxrename to packages/ui/src/views/DesktopApp.tsxindex c87e0f6dd7..d6695b9fb4 100644--- a/packages/ui/src/views/App.tsx+++ b/packages/ui/src/views/DesktopApp.tsx@@ -28,7 +28,7 @@ import { Toolbar } from './components/doc-bars/Toolbar';import { Sidebar } from './components/sidebar/Sidebar';import { ZenZone } from './components/zen-zone/ZenZone';import { builtInGlobalComponents } from './parts';-import { ContextMenu } from './components/context-menu/ContextMenu';+import { DesktopContextMenu } from './components/context-menu/ContextMenu';export interface IUniverAppProps extends IWorkbenchOptions {mountContainer: HTMLElement;@@ -36,7 +36,7 @@ export interface IUniverAppProps extends IWorkbenchOptions {onRendered?: (container: HTMLElement) => void;}-export function App(props: IUniverAppProps) {+export function DesktopApp(props: IUniverAppProps) {const {header = true,footer = true,@@ -152,7 +152,7 @@ export function App(props: IUniverAppProps) {</div><ComponentContainer key="global" components={globalComponents} /><ComponentContainer key="built-in-global" components={builtInGlobalComponents} />- {contextMenu && <ContextMenu />}+ {contextMenu && <DesktopContextMenu />}</ConfigProvider>);}diff --git a/packages/ui/src/views/MobileApp.tsx b/packages/ui/src/views/MobileApp.tsxnew file mode 100644index 0000000000..7b0777b7d9--- /dev/null+++ b/packages/ui/src/views/MobileApp.tsx@@ -0,0 +1,155 @@+/**+ * 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 { LocaleService, ThemeService } from '@univerjs/core';+import type { ILocale } from '@univerjs/design';+import { ConfigProvider, defaultTheme, themeInstance } from '@univerjs/design';+import { useDependency } from '@wendellhu/redi/react-bindings';+import React, { useEffect, useMemo, useRef, useState } from 'react';+import type { IWorkbenchOptions } from '../controllers/ui/ui.controller';+import { IMessageService } from '../services/message/message.service';+import { BuiltInUIPart } from '../services/parts/parts.service';+import styles from './mobile-app.module.less';+import { ComponentContainer, useComponentsOfPart } from './components/ComponentContainer';+import { Sidebar } from './components/sidebar/Sidebar';+import { ZenZone } from './components/zen-zone/ZenZone';+import { builtInGlobalComponents } from './parts';+import { MobileContextMenu } from './components/context-menu/MobileContextMenu';++export interface IUniverAppProps extends IWorkbenchOptions {+ mountContainer: HTMLElement;++ onRendered?: (container: HTMLElement) => void;+}++export function MobileApp(props: IUniverAppProps) {+ const {+ header = true,+ footer = true,+ contextMenu = true,+ mountContainer,+ onRendered,+ } = props;++ const localeService = useDependency(LocaleService);+ const themeService = useDependency(ThemeService);+ const messageService = useDependency(IMessageService);+ const contentRef = useRef<HTMLDivElement>(null);++ const footerComponents = useComponentsOfPart(BuiltInUIPart.FOOTER);+ const headerComponents = useComponentsOfPart(BuiltInUIPart.HEADER);+ const headerMenuComponents = useComponentsOfPart(BuiltInUIPart.HEADER_MENU);+ const contentComponents = useComponentsOfPart(BuiltInUIPart.CONTENT);+ const leftSidebarComponents = useComponentsOfPart(BuiltInUIPart.LEFT_SIDEBAR);+ const globalComponents = useComponentsOfPart(BuiltInUIPart.GLOBAL);++ useEffect(() => {+ if (!themeService.getCurrentTheme()) {+ themeService.setTheme(defaultTheme);+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);++ useEffect(() => {+ if (contentRef.current) {+ onRendered?.(contentRef.current);+ }+ }, [onRendered]);++ const [locale, setLocale] = useState<ILocale>(localeService.getLocales() as unknown as ILocale);++ // Create a portal container for injecting global component themes.+ const portalContainer = useMemo<HTMLElement>(() => document.createElement('div'), []);++ useEffect(() => {+ document.body.appendChild(portalContainer);+ messageService.setContainer(portalContainer);++ const subscriptions = [+ localeService.localeChanged$.subscribe(() => {+ setLocale(localeService.getLocales() as unknown as ILocale);+ }),+ themeService.currentTheme$.subscribe((theme) => {+ themeInstance.setTheme(mountContainer, theme);+ portalContainer && themeInstance.setTheme(portalContainer, theme);+ }),+ ];++ return () => {+ // batch unsubscribe+ subscriptions.forEach((subscription) => subscription.unsubscribe());++ // cleanup+ document.body.removeChild(portalContainer);+ };+ }, [localeService, messageService, mountContainer, portalContainer, themeService.currentTheme$]);++ return (+ <ConfigProvider locale={locale?.design} mountContainer={portalContainer}>+ {/**+ * IMPORTANT! This `tabIndex` should not be moved. This attribute allows the element to catch+ * all focusin event merged from its descendants. The DesktopLayoutService would listen to focusin events+ * bubbled to this element and refocus the input element.+ */}+ <div className={styles.appLayout} tabIndex={-1} onBlur={(e) => e.stopPropagation()}>+ {/* header */}+ {header && (+ <header className={styles.appContainerHeader}></header>+ )}++ {/* content */}+ <section className={styles.appContainer}>+ <div className={styles.appContainerWrapper}>+ <aside className={styles.appContainerLeftSidebar}>+ <ComponentContainer key="left-sidebar" components={leftSidebarComponents} />+ </aside>++ <section className={styles.appContainerContent}>+ <header className={styles.appHeader}>+ {header && <ComponentContainer key="header" components={headerComponents} />}+ </header>++ <section+ className={styles.appContainerCanvas}+ ref={contentRef}+ data-range-selector+ onContextMenu={(e) => e.preventDefault()}+ >+ <ComponentContainer key="content" components={contentComponents} />+ </section>+ </section>++ <aside className={styles.appContainerSidebar}>+ <Sidebar />+ </aside>+ </div>++ {/* footer */}+ {footer && (+ <footer className={styles.appFooter}>+ <ComponentContainer key="footer" components={footerComponents} />+ </footer>+ )}++ <ZenZone />+ </section>+ </div>+ <ComponentContainer key="global" components={globalComponents} />+ <ComponentContainer key="built-in-global" components={builtInGlobalComponents} />+ {contextMenu && <MobileContextMenu />}+ </ConfigProvider>+ );+}diff --git a/packages/ui/src/views/components/context-menu/ContextMenu.tsx b/packages/ui/src/views/components/context-menu/ContextMenu.tsxindex 0d163e160b..69ac484479 100644--- a/packages/ui/src/views/components/context-menu/ContextMenu.tsx+++ b/packages/ui/src/views/components/context-menu/ContextMenu.tsx@@ -21,10 +21,10 @@ import { ITextSelectionRenderManager } from '@univerjs/engine-render';import { useDependency, useInjector } from '@wendellhu/redi/react-bindings';import React, { useEffect, useState } from 'react';-import { Menu } from '../../../components/menu/Menu';+import { Menu } from '../../../components/menu/desktop/Menu';import { IContextMenuService } from '../../../services/contextmenu/contextmenu.service';-export function ContextMenu() {+export function DesktopContextMenu() {const [visible, setVisible] = useState(false);const [menuType, setMenuType] = useState('');const [offset, setOffset] = useState<[number, number]>([0, 0]);@@ -46,7 +46,7 @@ export function ContextMenu() {document.removeEventListener('wheel', handleClose);disposables.dispose();};- }, []);+ }, [contextMenuService]);function handleContextMenu(event: IMouseEvent, menuType: string) {setMenuType(menuType);diff --git a/packages/ui/src/views/components/context-menu/MobileContextMenu.tsx b/packages/ui/src/views/components/context-menu/MobileContextMenu.tsxnew file mode 100644index 0000000000..920d801a6c--- /dev/null+++ b/packages/ui/src/views/components/context-menu/MobileContextMenu.tsx@@ -0,0 +1,76 @@+/**+ * 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 { ICommandService } from '@univerjs/core';+import { useDependency } from '@wendellhu/redi/react-bindings';+import React, { useEffect, useState } from 'react';+import { Popup } from '@univerjs/design';+import type { IMouseEvent } from '@univerjs/engine-render';+import { IContextMenuService } from '../../../services/contextmenu/contextmenu.service';+import { MobileMenu } from '../../../components/menu/mobile/MobileMenu';++export function MobileContextMenu() {+ const [visible, setVisible] = useState(false);+ const [menuType, setMenuType] = useState('');+ const [offset, setOffset] = useState<[number, number]>([0, 0]);++ const contextMenuService = useDependency(IContextMenuService);+ const commandService = useDependency(ICommandService);++ useEffect(() => {+ const disposables = contextMenuService.registerContextMenuHandler({+ handleContextMenu,+ });++ document.addEventListener('pointerdown', handleClose);+ document.addEventListener('wheel', handleClose);++ return () => {+ document.removeEventListener('pointerdown', handleClose);+ document.removeEventListener('wheel', handleClose);+ disposables.dispose();+ };+ }, [contextMenuService]);++ function handleContextMenu(event: IMouseEvent, menuType: string) {+ setMenuType(menuType);+ setOffset([event.clientX, event.clientY]);+ setVisible(true);+ }++ function handleClose() {+ setVisible(false);+ }++ return (+ <Popup visible={visible} offset={offset}>+ <section onPointerDown={(e) => e.stopPropagation()}>+ {/* TODO@wzhudev: maybe we should add another component for mobile devices. */}+ {menuType && (+ // TODO@wzhudev: change to mobile menu+ <MobileMenu+ menuType={[menuType]}+ onOptionSelect={(params) => {+ const { label: commandId, value } = params;+ commandService && commandService.executeCommand(commandId as string, { value });+ setVisible(false);+ }}+ />+ )}+ </section>+ </Popup>+ );+}diff --git a/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx b/packages/ui/src/views/components/doc-bars/ToolbarItem.tsxindex ab682affa0..860b000113 100644--- a/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx+++ b/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx@@ -26,7 +26,7 @@ import clsx from 'clsx';import { ComponentManager } from '../../../common/component-manager';import { CustomLabel } from '../../../components/custom-label/CustomLabel';import { useObservable } from '../../../components/hooks/observable';-import { Menu } from '../../../components/menu/Menu';+import { Menu } from '../../../components/menu/desktop/Menu';import type { IDisplayMenuItem, IMenuItem, IMenuSelectorItem, IValueOption } from '../../../services/menu/menu';import { MenuItemType } from '../../../services/menu/menu';import { ILayoutService } from '../../../services/layout/layout.service';diff --git a/packages/ui/src/views/mobile-app.module.less b/packages/ui/src/views/mobile-app.module.lessnew file mode 100644index 0000000000..f726b571e8--- /dev/null+++ b/packages/ui/src/views/mobile-app.module.less@@ -0,0 +1,65 @@+.app {+ &-layout {+ display: flex;+ flex-direction: column;+ height: 100%;+ background-color: rgb(var(--bg-color));+ min-height: 0;+ position: relative;+ }++ &-header {+ width: 100vw;+ }++ &-container {+ position: relative;+ display: flex;+ flex: 1;+ flex-direction: column;+ min-height: 0;++ &-header {+ position: relative;+ z-index: 10;+ width: 100%;+ }++ &-wrapper {+ display: grid;+ grid-template-columns: auto 1fr auto;+ grid-template-rows: 100%;+ height: 100%;+ overflow: hidden;+ }++ &-content {+ position: relative;++ overflow: hidden;+ display: grid;+ grid-template-rows: auto 1fr;+ flex: 1;++ background-color: rgb(var(--bg-color-secondary));+ border-bottom: 1px solid rgb(var(--border-color));+ }++ &-canvas {+ position: relative;+ overflow: hidden;+ }++ &-left-sidebar {+ height: 100%;+ }++ &-sidebar {+ height: 100%;+ }+ }++ &-footer {+ // height: 36px;+ }+}