Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(base-sheets): render sheet bar

Dushusir488b364ec1c3
diff --git a/packages/base-render/src/Shape/Picture.ts b/packages/base-render/src/Shape/Picture.ts
index 417a6d4b05..9f0379c3af 100644
--- a/packages/base-render/src/Shape/Picture.ts
+++ b/packages/base-render/src/Shape/Picture.ts
@@ -13,7 +13,11 @@ export class Picture extends Shape<IPictureProps> {
static drawWith(ctx: CanvasRenderingContext2D, picture: Picture) {
if (picture._native.complete) {
const { width, height } = picture;
- ctx.drawImage(picture._native, 0, 0, width, height);
+ try {
+ ctx.drawImage(picture._native, 0, 0, width, height);
+ } catch (error) {
+ console.error(error);
+ }
}
}
diff --git a/packages/base-sheets/index.html b/packages/base-sheets/index.html
index f30c93fbe0..dccf011f6c 100644
--- a/packages/base-sheets/index.html
+++ b/packages/base-sheets/index.html
@@ -17,7 +17,7 @@
<body>
<div id="app" style="z-index: 1; position: fixed; font-size: 20px; color: green;"></div>
- <div id="universheet-demo-up" style="height: 100vh;"></div>
+ <div id="universheet-demo-up" style="height: 80vh;"></div>
<!-- <div id="universheet-demo-down" style="height: 50vh;"></div> -->
<script type="module" src="/src/main.tsx"></script>
</body>
diff --git a/packages/base-sheets/src/SheetPlugin.tsx b/packages/base-sheets/src/SheetPlugin.tsx
index a5c5538210..992cafcff7 100644
--- a/packages/base-sheets/src/SheetPlugin.tsx
+++ b/packages/base-sheets/src/SheetPlugin.tsx
@@ -152,10 +152,11 @@ export class SheetPlugin extends Plugin<SheetPluginObserve, SheetContext> {
this._rightMenuControl = new RightMenuController(this);
this._toolBarControl = new ToolBarController(this);
this._infoBarControl = new InfoBarController(this);
- // this._sheetBarControl = new SheetBarControl(this);
+ this._sheetBarControl = new SheetBarControl(this);
this._cellEditorControl = new CellEditorController(this);
this._antLineController = new AntLineControl(this);
this._countBarController = new CountBarController(this);
+ // this._sheetContainerController = new SheetContainerController(this);
// render sheet container
render(<SheetContainer config={config} />, sheetContainer);
diff --git a/packages/base-sheets/src/View/UI/SheetBar/SheetBar.tsx b/packages/base-sheets/src/View/UI/SheetBar/SheetBar.tsx
index 66f7c1168b..6d265250c8 100644
--- a/packages/base-sheets/src/View/UI/SheetBar/SheetBar.tsx
+++ b/packages/base-sheets/src/View/UI/SheetBar/SheetBar.tsx
@@ -4,6 +4,8 @@ import { Ul } from '@univer/style-universheet';
import { SlideTabBar } from '../../../Basics/SlideTabBar/SlideTabBar';
import styles from './index.module.less';
+console.info('styles', styles);
+
type SheetState = {
sheetList: BaseSheetBarProps[];
menuList: BaseSheetBarProps[];
@@ -213,7 +215,7 @@ export class SheetBar extends Component<BaseSheetBarProps, SheetState> {
* destory
*/
componentWillUnmount() {
- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);
+ // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);
}
componentDidUpdate() {
diff --git a/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsx b/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsx
index 5525c6b404..fb0d31e014 100644
--- a/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsx
+++ b/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsx
@@ -72,11 +72,7 @@ export interface ILayout {
sheetBar?: boolean;
// Whether to show the toolbar
- infoBar?: boolean;
- formulaBar?: boolean;
toolBar?: boolean;
- sheetBar?: boolean;
- countBar?: boolean;
// Custom configuration toolbar,can be used in conjunction with showToolBar, showToolBarConfig has a higher priority
toolBarConfig?: IShowToolBarConfig;
@@ -139,15 +135,15 @@ export const defaultLayout: ILayout = {
frozenContent: true,
- infoBar: false,
+ infoBar: true,
- formulaBar: false,
+ formulaBar: true,
- toolBar: false,
+ toolBar: true,
- countBar: false,
+ countBar: true,
- sheetBar: false,
+ sheetBar: true,
toolBarConfig: {
undoRedo: true, // Undo redo
@@ -254,6 +250,8 @@ export class SheetContainer extends Component<BaseSheetContainerProps, IState> {
showSider: false,
renderState: 0,
};
+
+ console.log('this.state', this.state);
}
/**