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.

xiugai

tonytonychopper123f5d3910ccb31
diff --git a/packages/sheets-plugin-formula/src/Controller/FormulaController.ts b/packages/sheets-plugin-formula/src/Controller/FormulaController.tsx
similarity index 100%
rename from packages/sheets-plugin-formula/src/Controller/FormulaController.ts
rename to packages/sheets-plugin-formula/src/Controller/FormulaController.tsx
diff --git a/packages/sheets-plugin-formula/src/Controller/FormulaPromptController.ts b/packages/sheets-plugin-formula/src/Controller/FormulaPromptController.ts
index 1cf06aa6fa..1ce5c08a5b 100644
--- a/packages/sheets-plugin-formula/src/Controller/FormulaPromptController.ts
+++ b/packages/sheets-plugin-formula/src/Controller/FormulaPromptController.ts
@@ -2,10 +2,10 @@ import { $$ } from '@univerjs/base-ui';
import { SheetPlugin } from '@univerjs/base-sheets';
import { KeyCode, PLUGIN_NAMES, SheetContext } from '@univerjs/core';
import { SheetUIPlugin, SHEET_UI_PLUGIN_NAME } from '@univerjs/ui-plugin-sheets';
-import { FORMULA_PLUGIN_NAME } from '../Basic';
import { FormulaPlugin } from '../FormulaPlugin';
import { HelpFunction, SearchFunction } from '../View/UI/FormulaPrompt';
import { CellInputHandler } from './CellInputHandler';
+import { FORMULA_PLUGIN_NAME } from '../Basic';
export class FormulaPromptController {
private _context: SheetContext;
@@ -47,7 +47,6 @@ export class FormulaPromptController {
.getSheetContainerController()
.getMainSlotController()
.getSlot(FORMULA_PLUGIN_NAME + SearchFunction.name);
-
console.info('searchFunction====', searchFunction);
});
diff --git a/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.ts b/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.ts
index 0cf353c4da..a6f2e0ba50 100644
--- a/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.ts
+++ b/packages/ui-plugin-sheets/src/Controller/SheetBarUIContruller.ts
@@ -155,6 +155,7 @@ export class SheetBarUIController {
{
locale: 'sheetConfig.unhide',
onClick: () => {
+ this._sheetBar.ref.current.showMenu(true)
that.setUIObserve('onUIChangeObservable', { name: 'unHideSheet', value: this._dataId });
},
border: true,
diff --git a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx
index 7e28f0943a..1e7182044c 100644
--- a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx
+++ b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx
@@ -118,9 +118,7 @@ export class SheetBar extends Component<BaseSheetBarProps, SheetState> {
// 隐藏下拉
hideSelect = (e: MouseEvent) => {
- const current = this.ref.current;
const ulCurrent = this.ulRef.current;
- if (current) current.showMenu(false);
if (ulCurrent) ulCurrent.showMenu(false);
window.removeEventListener('click', this.hideSelect);
};
diff --git a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBarMenu.tsx b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBarMenu.tsx
index e5d60ba0d1..00111d8cc5 100644
--- a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBarMenu.tsx
+++ b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBarMenu.tsx
@@ -28,13 +28,14 @@ export class SheetBarMenu extends Component<SheetBarMenuProps, IState> {
}
handleClick(e: MouseEvent, item: SheetBarMenuItem) {
+ e.stopPropagation();
const { onClick } = this.props;
if (item.onClick) {
item.onClick(e);
}
onClick?.(e);
this.showMenu(false);
- window.removeEventListener('click', this.hideMenu);
+ window.removeEventListener('click', this.hideMenu, true);
}
hideMenu = () => {
@@ -42,20 +43,15 @@ export class SheetBarMenu extends Component<SheetBarMenuProps, IState> {
};
showMenu(show: boolean) {
- this.setState(
- {show},
- () => {
- if (show) {
- window.addEventListener('click', this.hideMenu, true);
- }
- }
- );
+ this.setState({ show }, () => {
+ if (true) window.addEventListener('click', this.hideMenu, true);
+ });
}
render() {
const { menu, style } = this.props;
const { show } = this.state;
-
+
return (
<ul className={styles.sheetBarMenu} style={{ ...style, display: show ? 'block' : ' none' }}>
{menu.map((item) => (
diff --git a/packages/ui-plugin-sheets/src/View/Slot/Slot.tsx b/packages/ui-plugin-sheets/src/View/Slot/Slot.tsx
index c7b5f1e6d6..e05a910c6a 100644
--- a/packages/ui-plugin-sheets/src/View/Slot/Slot.tsx
+++ b/packages/ui-plugin-sheets/src/View/Slot/Slot.tsx
@@ -4,9 +4,15 @@ interface IState {
slotGroup: Map<string, any>;
}
-export class Slot extends Component<BaseComponentProps, IState> {
+interface IProps extends BaseComponentProps {
+ ref?: Slot;
+}
+
+export class Slot extends Component<IProps, IState> {
refMap = new Map();
+ refs: any[] = [];
+
initialize() {
this.state = {
slotGroup: new Map(),
@@ -32,19 +38,21 @@ export class Slot extends Component<BaseComponentProps, IState> {
getRender(slotGroup: Map<string, any>) {
const group: JSX.Element[] = [];
- slotGroup.forEach((k) => {
+ slotGroup.forEach((v, k) => {
const Slot = slotGroup.get(k);
- group.push(<Slot ref={(ele: any) => this.refMap.set(k, ele)}></Slot>);
+ group.push(
+ <Slot
+ ref={(ele: any) => {
+ this.refMap.set(k, ele);
+ }}
+ ></Slot>
+ );
});
- // for (let k in slotGroup) {
- // const A = slotGroup.get(k);
- // group.push(<A ref={(ele: any) => this.refMap.set(k, ele)}></A>);
- // }
return group;
}
render() {
const { slotGroup } = this.state;
- return <>{this.getRender(slotGroup)}</>;
+ return <div>{this.getRender(slotGroup)}</div>;
}
}