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
refactor(ui): sheet bar menu
Dushusir89fc20342a92
diff --git a/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.ts b/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.tsindex 5b654d30d9..ec6fb0c9e2 100644--- a/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.ts+++ b/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.ts@@ -297,7 +297,7 @@ export class SheetBarUIController extends Disposable {},});- this._sheetBar.setSheetUlNeo(this._menuService.getMenuItems(MenuPosition.SHEET_BAR));+ // this._sheetBar.setSheetUlNeo(this._menuService.getMenuItems(MenuPosition.SHEET_BAR));}protected _refreshSheetData(): void {diff --git a/packages/ui-plugin-sheets/src/Controller/menu.ts b/packages/ui-plugin-sheets/src/Controller/menu.tsindex acb0eca163..1194d8fbed 100644--- a/packages/ui-plugin-sheets/src/Controller/menu.ts+++ b/packages/ui-plugin-sheets/src/Controller/menu.ts@@ -733,6 +733,7 @@ export function RenameSheetMenuItemFactory(accessor: IAccessor): IMenuButtonItemparentId: 'sheet-bar-right-menu',onClick:()=>{// TODO@Dushusir 这里能监听到点击事件,但是无法触发到 this._sheetBar.reNameSheet(this._dataId);+ // 或许不应该通过这里的onClick直接更新UI?console.info('rename=========')}};@@ -775,20 +776,4 @@ export function UnHideSheetMenuItemFactory(accessor: IAccessor): IMenuButtonItemtitle: 'sheetConfig.unhide',parentId: 'sheet-bar-right-menu',};-}--export function buildMenuTree(items: IMenuItem[], parentId?: string): IDisplayMenuItem[] {- const tree: IDisplayMenuItem[] = [];-- for (const item of items) {- if (item.parentId === parentId) {- const treeItem: IDisplayMenuItem = {- ...item,- subMenuItems: buildMenuTree(items, item.id),- };- tree.push(treeItem);- }- }-- return tree;-}+}\ No newline at end of filediff --git a/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsx b/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsxindex 8684472152..731948c7ad 100644--- a/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsx+++ b/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsx@@ -45,22 +45,6 @@ export class RightMenu extends Component<BaseRightMenuProps, IState> {});};- buildMenuTree(items: IMenuItem[], parentId?: string): IDisplayMenuItem<IMenuItem[]> {- const tree: IDisplayMenuItem[] = [];-- for (const item of items) {- if (item.parentId === parentId) {- const treeItem: IDisplayMenuItem = {- ...item,- subMenuItems: this.buildMenuTree(items, item.id),- };- tree.push(treeItem);- }- }-- return tree;- }-// TODO:添加到具体的元素override componentDidMount() {this.props.getComponent?.(this);diff --git a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsxindex 7811c64157..d510e3905f 100644--- a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx+++ b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx@@ -3,7 +3,6 @@ import { RefObject, Component, createRef } from 'preact';import { SheetBarMenu, ISheetBarMenuItem } from './SheetBarMenu';import styles from './index.module.less';import { SlideTabBar } from '../../Basics/SlideTabBar/SlideTabBar';-import { buildMenuTree } from '../../Controller/menu';type SheetState = {sheetList: BaseSheetBarProps[];@@ -58,11 +57,12 @@ export class SheetBar extends Component<BaseSheetBarProps, SheetState> {this.setState((prevState) => ({ ...value }), fn);};- setSheetUlNeo(menuItems: IMenuItem[]) {- this.setState({- menuItems: buildMenuTree(menuItems),- });- }+ // TODO@Dushusir remove after refactoring+ // setSheetUlNeo(menuItems: IMenuItem[]) {+ // this.setState({+ // menuItems: buildMenuTree(menuItems),+ // });+ // }// 点击按钮左右滑动scrollLeft = (e: MouseEvent) => {