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
flush
jerry365478ad0141
diff --git a/packages/ui-plugin-sheets/src/Controller/InfoBarUIController.ts b/packages/ui-plugin-sheets/src/Controller/InfoBarUIController.tsindex 071936c849..c5c617ba97 100644--- a/packages/ui-plugin-sheets/src/Controller/InfoBarUIController.ts+++ b/packages/ui-plugin-sheets/src/Controller/InfoBarUIController.ts@@ -1,64 +1,65 @@import { Plugin } from '@univerjs/core';import { InfoBarModel } from '../Model/InfoBarModel';-import { InfoBar } from '../View';+import { InfoBar } from '../View/InfoBar';type IProps = {locale?: string;label?: string;+ onBlur?: (e: FocusEvent) => void;};export interface BaseInfoBarProps {back: IProps;- update: IProps;- save: IProps;rename: IProps;- sheetName: string;+ save: IProps;+ sheet: IProps;+ update: IProps;}export class InfoBarUIController {- private _infoList: BaseInfoBarProps;-- private _plugin: Plugin;+ private _infoBarModel: InfoBarModel;private _infoBar: InfoBar;- private _infoBarModel: InfoBarModel;+ private _plugin: Plugin;- constructor(plugin: Plugin) {- this._plugin = plugin;+ private _infoList: BaseInfoBarProps;+ private _refreshComponent(): void {+ const name = this._plugin.getContext().getUniver().getCurrentUniverSheetInstance().getWorkBook().getConfig().name;+ this._infoBarModel = new InfoBarModel(name);this._infoList = {back: {locale: 'info.return',},+ rename: {+ locale: 'info.tips',+ },update: {locale: 'info.detailUpdate',},save: {locale: 'info.detailSave',},- rename: {- locale: 'info.tips',+ sheet: {+ label: name,+ onBlur: (e) => {+ this.setSheetName(e);+ },},- sheetName: 'UniverSheet',};- this._initialize();}- private _initialize() {}+ constructor(plugin: Plugin) {+ this._plugin = plugin;+ }- // 获取Toolbar组件getComponent = (ref: InfoBar) => {this._infoBar = ref;+ this._refreshComponent();this.resetInfoList(this._infoList);};- setSheetName(e: FocusEvent) {- const target = e.target as HTMLInputElement;- const name = target.value;- this._infoBarModel.setName(name);- }-resetInfoList(list: BaseInfoBarProps) {const locale = this._plugin.getContext().getLocale();for (let k in list) {@@ -69,5 +70,9 @@ export class InfoBarUIController {this._infoBar.setInfoList(list);}- renameSheet() {}+ setSheetName(e: FocusEvent) {+ const target = e.target as HTMLInputElement;+ const name = target.value;+ this._infoBarModel.setName(name);+ }}diff --git a/packages/ui-plugin-sheets/src/View/InfoBar/InfoBar.tsx b/packages/ui-plugin-sheets/src/View/InfoBar/InfoBar.tsxindex 29219f53e7..d2ce4d4dd4 100644--- a/packages/ui-plugin-sheets/src/View/InfoBar/InfoBar.tsx+++ b/packages/ui-plugin-sheets/src/View/InfoBar/InfoBar.tsx@@ -32,7 +32,7 @@ export class InfoBar extends Component<IProps, IState> {const { renameSheet } = this.props;if (!this.state.infoList) return;- const { back, sheetName, update, save, rename } = this.state.infoList;+ const { back, sheet, update, save, rename } = this.state.infoList;return (<Container className={styles.infoDetail}>@@ -46,7 +46,7 @@ export class InfoBar extends Component<IProps, IState> {{/* <LogoIcon style={{ width: '152px', height: '32px' }} /> */}<div className={styles.sheetName}><Tooltip title={rename.label} placement={'bottom'}>- <Input bordered={false} value={sheetName} onBlur={renameSheet} />+ <Input bordered={false} value={sheet.label} onBlur={renameSheet} /></Tooltip></div><div className={styles.infoDetailUpdate}>{update.label}</div>