diff --git a/common/shared/package.json b/common/shared/package.json index b518659addd..f0e43393325 100644 --- a/common/shared/package.json +++ b/common/shared/package.json @@ -17,13 +17,13 @@ "./vite": "./vite/index.js" }, "dependencies": { - "@typescript-eslint/parser": "^8.0.1", + "@typescript-eslint/parser": "^8.1.0", "@vitejs/plugin-react": "^4.3.1", "@vitest/coverage-istanbul": "^2.0.5", "happy-dom": "14.12.3", "javascript-obfuscator": "^4.1.1", "vite": "^5.4.0", - "vite-plugin-dts": "^4.0.2", + "vite-plugin-dts": "^4.0.3", "vitest": "^2.0.5" } } diff --git a/packages/ui/src/services/menu/menu.service.ts b/packages/ui/src/services/menu/menu.service.ts index dfabb41bbae..158d8a57ea2 100644 --- a/packages/ui/src/services/menu/menu.service.ts +++ b/packages/ui/src/services/menu/menu.service.ts @@ -120,6 +120,12 @@ export class MenuService extends Disposable implements IMenuService { setMenuItem(item: IMenuItem): void { this._menuItemMap.set(item.id, item); + if (Array.isArray(item.positions)) { + item.positions.forEach((menu) => this._updateMenuItems(item, menu)); + } else { + this._updateMenuItems(item, item.positions); + } + this._menuChanged$.next(); } @@ -167,4 +173,18 @@ export class MenuService extends Disposable implements IMenuService { menuList.push([menu.id, menu]); } + + private _updateMenuItems(menu: IMenuItem, position: MenuPosition | string) { + if (!this._menuByPositions.has(position)) { + this._menuByPositions.set(position, []); + } + + const menuList = this._menuByPositions.get(position)!; + const index = menuList.findIndex((m) => m[0] === menu.id); + if (index > -1) { + menuList[index] = [menu.id, menu]; + } else { + menuList.push([menu.id, menu]); + } + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e427fb4684..81ee937723c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,8 +99,8 @@ importers: common/shared: dependencies: '@typescript-eslint/parser': - specifier: ^8.0.1 - version: 8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) + specifier: ^8.1.0 + version: 8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) '@vitejs/plugin-react': specifier: ^4.3.1 version: 4.3.1(vite@5.4.0(@types/node@22.3.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)) @@ -117,8 +117,8 @@ importers: specifier: ^5.4.0 version: 5.4.0(@types/node@22.3.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5) vite-plugin-dts: - specifier: ^4.0.2 - version: 4.0.2(@types/node@22.3.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.4.0(@types/node@22.3.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)) + specifier: ^4.0.3 + version: 4.0.3(@types/node@22.3.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.4.0(@types/node@22.3.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)) vitest: specifier: ^2.0.5 version: 2.0.5(@types/node@22.3.0)(happy-dom@14.12.3)(jsdom@24.1.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5) @@ -5368,8 +5368,8 @@ packages: typescript: optional: true - '@typescript-eslint/parser@8.0.1': - resolution: {integrity: sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==} + '@typescript-eslint/parser@8.1.0': + resolution: {integrity: sha512-U7iTAtGgJk6DPX9wIWPPOlt1gO57097G06gIcl0N0EEnNw8RGD62c+2/DiP/zL7KrkqnnqF7gtFGR7YgzPllTA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -5386,6 +5386,10 @@ packages: resolution: {integrity: sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/scope-manager@8.1.0': + resolution: {integrity: sha512-DsuOZQji687sQUjm4N6c9xABJa7fjvfIdjqpSIIVOgaENf2jFXiM9hIBZOL3hb6DHK9Nvd2d7zZnoMLf9e0OtQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/type-utils@8.0.1': resolution: {integrity: sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -5403,6 +5407,10 @@ packages: resolution: {integrity: sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/types@8.1.0': + resolution: {integrity: sha512-q2/Bxa0gMOu/2/AKALI0tCKbG2zppccnRIRCW6BaaTlRVaPKft4oVYPp7WOPpcnsgbr0qROAVCVKCvIQ0tbWog==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/typescript-estree@7.18.0': resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==} engines: {node: ^18.18.0 || >=20.0.0} @@ -5421,6 +5429,15 @@ packages: typescript: optional: true + '@typescript-eslint/typescript-estree@8.1.0': + resolution: {integrity: sha512-NTHhmufocEkMiAord/g++gWKb0Fr34e9AExBRdqgWdVBaKoei2dIyYKD9Q0jBnvfbEA5zaf8plUFMUH6kQ0vGg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@typescript-eslint/utils@7.18.0': resolution: {integrity: sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==} engines: {node: ^18.18.0 || >=20.0.0} @@ -5441,6 +5458,10 @@ packages: resolution: {integrity: sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/visitor-keys@8.1.0': + resolution: {integrity: sha512-ba0lNI19awqZ5ZNKh6wCModMwoZs457StTebQ0q1NP58zSi2F6MOZRXwfKZy+jB78JNJ/WH8GSh2IQNzXX8Nag==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -10667,8 +10688,8 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true - vite-plugin-dts@4.0.2: - resolution: {integrity: sha512-Ni3EPG8yeLc5ivEzT4szreJ0rXpEQgvdYq3PaZ7OMoHc8uET4/HRUfzVPejJaUAojbxsKgaZbp6Zgm41sxb86Q==} + vite-plugin-dts@4.0.3: + resolution: {integrity: sha512-+xnTsaONwU2kV6zhRjtbRJSGN41uFR/whqmcb4k4fftLFDJElxthp0PP5Fq8gMeM9ytWMt1yk5gGgekLREWYQQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -11015,8 +11036,8 @@ snapshots: '@antfu/install-pkg': 0.3.3 '@clack/prompts': 0.7.0 '@stylistic/eslint-plugin': 2.6.2(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) - '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) - '@typescript-eslint/parser': 8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/parser': 8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) eslint: 9.9.0(jiti@1.21.6) eslint-config-flat-gitignore: 0.1.8 eslint-flat-config-utils: 0.3.0 @@ -11034,8 +11055,8 @@ snapshots: eslint-plugin-regexp: 2.6.0(eslint@9.9.0(jiti@1.21.6)) eslint-plugin-toml: 0.11.1(eslint@9.9.0(jiti@1.21.6)) eslint-plugin-unicorn: 55.0.0(eslint@9.9.0(jiti@1.21.6)) - eslint-plugin-unused-imports: 4.1.2(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6)) - eslint-plugin-vitest: 0.5.4(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)(vitest@2.0.5(@types/node@22.1.0)(happy-dom@14.12.3)(jsdom@24.1.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)) + eslint-plugin-unused-imports: 4.1.2(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6)) + eslint-plugin-vitest: 0.5.4(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)(vitest@2.0.5(@types/node@22.1.0)(happy-dom@14.12.3)(jsdom@24.1.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)) eslint-plugin-vue: 9.27.0(eslint@9.9.0(jiti@1.21.6)) eslint-plugin-yml: 1.14.0(eslint@9.9.0(jiti@1.21.6)) eslint-processor-vue-blocks: 0.1.2(@vue/compiler-sfc@3.4.35)(eslint@9.9.0(jiti@1.21.6)) @@ -13700,10 +13721,10 @@ snapshots: '@types/validator@13.12.0': {} - '@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/parser': 8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) '@typescript-eslint/scope-manager': 8.0.1 '@typescript-eslint/type-utils': 8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) '@typescript-eslint/utils': 8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) @@ -13718,12 +13739,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)': + '@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)': dependencies: - '@typescript-eslint/scope-manager': 8.0.1 - '@typescript-eslint/types': 8.0.1 - '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.0.1 + '@typescript-eslint/scope-manager': 8.1.0 + '@typescript-eslint/types': 8.1.0 + '@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.1.0 debug: 4.3.6 eslint: 9.9.0(jiti@1.21.6) optionalDependencies: @@ -13741,6 +13762,11 @@ snapshots: '@typescript-eslint/types': 8.0.1 '@typescript-eslint/visitor-keys': 8.0.1 + '@typescript-eslint/scope-manager@8.1.0': + dependencies: + '@typescript-eslint/types': 8.1.0 + '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/type-utils@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)': dependencies: '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) @@ -13757,6 +13783,8 @@ snapshots: '@typescript-eslint/types@8.0.1': {} + '@typescript-eslint/types@8.1.0': {} + '@typescript-eslint/typescript-estree@7.18.0(typescript@5.5.4)': dependencies: '@typescript-eslint/types': 7.18.0 @@ -13787,6 +13815,21 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/typescript-estree@8.1.0(typescript@5.5.4)': + dependencies: + '@typescript-eslint/types': 8.1.0 + '@typescript-eslint/visitor-keys': 8.1.0 + debug: 4.3.6 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.5.4) + optionalDependencies: + typescript: 5.5.4 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/utils@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.0(jiti@1.21.6)) @@ -13819,6 +13862,11 @@ snapshots: '@typescript-eslint/types': 8.0.1 eslint-visitor-keys: 3.4.3 + '@typescript-eslint/visitor-keys@8.1.0': + dependencies: + '@typescript-eslint/types': 8.1.0 + eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.0': {} '@univerjs/icons-svg@0.1.72': {} @@ -15895,18 +15943,18 @@ snapshots: semver: 7.6.3 strip-indent: 3.0.0 - eslint-plugin-unused-imports@4.1.2(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6)): + eslint-plugin-unused-imports@4.1.2(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6)): dependencies: eslint: 9.9.0(jiti@1.21.6) optionalDependencies: - '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) - eslint-plugin-vitest@0.5.4(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)(vitest@2.0.5(@types/node@22.1.0)(happy-dom@14.12.3)(jsdom@24.1.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)): + eslint-plugin-vitest@0.5.4(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)(vitest@2.0.5(@types/node@22.1.0)(happy-dom@14.12.3)(jsdom@24.1.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)): dependencies: '@typescript-eslint/utils': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) eslint: 9.9.0(jiti@1.21.6) optionalDependencies: - '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) vitest: 2.0.5(@types/node@22.1.0)(happy-dom@14.12.3)(jsdom@24.1.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5) transitivePeerDependencies: - supports-color @@ -16357,7 +16405,7 @@ snapshots: dependencies: basic-ftp: 5.0.5 data-uri-to-buffer: 6.0.2 - debug: 4.3.5 + debug: 4.3.6 fs-extra: 11.2.0 transitivePeerDependencies: - supports-color @@ -19755,7 +19803,7 @@ snapshots: - supports-color - terser - vite-plugin-dts@4.0.2(@types/node@22.3.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.4.0(@types/node@22.3.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)): + vite-plugin-dts@4.0.3(@types/node@22.3.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.4.0(@types/node@22.3.0)(less@4.2.0)(sass@1.77.5)(terser@5.31.5)): dependencies: '@microsoft/api-extractor': 7.47.4(@types/node@22.3.0) '@rollup/pluginutils': 5.1.0(rollup@4.20.0)