From dbcd9d05a4482c6c7378cb4926081cb9a4c41516 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Wed, 17 Sep 2025 13:02:21 +0300 Subject: [PATCH] Refactoring --- .../main/app/controller/DocumentHolderExt.js | 40 +++++++++++-------- apps/spreadsheeteditor/main/locale/en.json | 2 +- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js index 7d25bf9760..8d60131b78 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js @@ -3223,21 +3223,20 @@ define([], function () { } var funcdesc = this.getApplication().getController('FormulaDialog').getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")), hint = '', - args = ''; - if (funcdesc && funcdesc[name]) { - hint = this.api.asc_getFormulaLocaleName(name) + funcdesc[name].a; - hint = hint.replace(/[,;]/g, this.api.asc_getFunctionArgumentSeparator()); - args = funcdesc[name].a.replace(/[,;]/g, this.api.asc_getFunctionArgumentSeparator()); - } else { - var custom = this.api.asc_getCustomFunctionInfo(name), - arr_args = custom ? custom.asc_getArg() || [] : []; - hint = this.api.asc_getFormulaLocaleName(name) + '(' + arr_args.map(function (item) { return item.asc_getIsOptional() ? '[' + item.asc_getName() + ']' : item.asc_getName(); }).join(this.api.asc_getFunctionArgumentSeparator() + ' ') + ')'; - args = '(' + arr_args.map(function (item) { return item.asc_getIsOptional() ? '[' + item.asc_getName() + ']' : item.asc_getName(); }).join(this.api.asc_getFunctionArgumentSeparator() + ' ') + ')'; - } - var argstype = funcInfo.asc_getArgumentsType(), - activeArg = funcInfo.asc_getActiveArgPos(); + argstype = funcInfo.asc_getArgumentsType(), + activeArg = funcInfo.asc_getActiveArgPos(), + activeArgsCount = funcInfo.asc_getActiveArgsCount(); + + if (argstype && activeArg && activeArgsCount) { + var args = ''; + if (funcdesc && funcdesc[name]) { + args = funcdesc[name].a.replace(/[,;]/g, this.api.asc_getFunctionArgumentSeparator()); + } else { + var custom = this.api.asc_getCustomFunctionInfo(name), + arr_args = custom ? custom.asc_getArg() || [] : []; + args = '(' + arr_args.map(function (item) { return item.asc_getIsOptional() ? '[' + item.asc_getName() + ']' : item.asc_getName(); }).join(this.api.asc_getFunctionArgumentSeparator() + ' ') + ')'; + } - if (argstype && activeArg) { var argsNames = this.parseArgsDesc(args), minArgCount = funcInfo.asc_getArgumentMin(), maxArgCount = funcInfo.asc_getArgumentMax(), @@ -3269,13 +3268,22 @@ define([], function () { fillArgs(types); } - if (arr.length<=activeArg && repeatedArg) { // add repeated - while (arr.length<=activeArg) { + if (arr.length<=activeArgsCount && repeatedArg) { // add repeated + while (arr.length<=activeArgsCount) { fillArgs(repeatedArg); } } repeatedArg && arr.push('...'); hint = this.api.asc_getFormulaLocaleName(name) + '(' + arr.join(this.api.asc_getFunctionArgumentSeparator() + ' ') + ')'; + } else { + if (funcdesc && funcdesc[name]) { + hint = this.api.asc_getFormulaLocaleName(name) + funcdesc[name].a; + hint = hint.replace(/[,;]/g, this.api.asc_getFunctionArgumentSeparator()); + } else { + var custom = this.api.asc_getCustomFunctionInfo(name), + arr_args = custom ? custom.asc_getArg() || [] : []; + hint = this.api.asc_getFormulaLocaleName(name) + '(' + arr_args.map(function (item) { return item.asc_getIsOptional() ? '[' + item.asc_getName() + ']' : item.asc_getName(); }).join(this.api.asc_getFunctionArgumentSeparator() + ' ') + ')'; + } } if (functip.ref && functip.ref.isVisible()) { diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index da9ee5a1ef..73015df1c7 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1076,7 +1076,7 @@ "SSE.Controllers.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.To protect you computer, click only those hyperlinks from trusted sources. This location may be unsafe:

{0}

Are you sure you want to continue?", "SSE.Controllers.DocumentHolder.txtWidth": "Width", "SSE.Controllers.DocumentHolder.warnFilterError": "You need at least one field in the Values area in order to apply a value filter.", - "SSE.Controllers.DocumentHolder.textArgument": "Argument", + "SSE.Controllers.DocumentHolder.textArgument": "argument", "SSE.Controllers.FormulaDialog.sCategoryAll": "All", "SSE.Controllers.FormulaDialog.sCategoryCube": "Cube", "SSE.Controllers.FormulaDialog.sCategoryCustom": "Custom",