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.

feat: disable confirm btn if function info after use search is null (#6477)

Roman Sergeev868ec826efac
diff --git a/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx b/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx
index 599fb96393..02f1867348 100644
--- a/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx
+++ b/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx
@@ -87,6 +87,7 @@ export function MoreFunctions() {
)}
{selectFunction && !!workbook && (
<Button
+ disabled={!functionInfo}
variant="primary"
onClick={handleConfirm}
className="univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0"
diff --git a/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx b/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx
index 859701327b..0fc5e09fa4 100644
--- a/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx
+++ b/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx
@@ -30,7 +30,7 @@ import { FunctionHelp } from '../function-help/FunctionHelp';
import { FunctionParams } from '../function-params/FunctionParams';
export interface ISelectFunctionProps {
- onChange: (functionInfo: IFunctionInfo) => void;
+ onChange: (functionInfo: IFunctionInfo | null) => void;
}
export function SelectFunction(props: ISelectFunctionProps) {
@@ -102,6 +102,7 @@ export function SelectFunction(props: ISelectFunctionProps) {
const setCurrentFunctionInfo = (selectedIndex: number) => {
if (selectList.length === 0) {
setFunctionInfo(null);
+ onChange(null);
return;
}
@@ -109,6 +110,7 @@ export function SelectFunction(props: ISelectFunctionProps) {
const functionInfo = descriptionService.getFunctionInfo(selectList[selectedIndex].name);
if (!functionInfo) {
setFunctionInfo(null);
+ onChange(null);
return;
}