From 83170b1a12aebe7a04a169b4ee461657f12cae05 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Fri, 4 Mar 2022 20:12:14 +0400 Subject: [PATCH] [SSE mobile] Fix Bug 55874 --- .../mobile/src/controller/CellEditor.jsx | 34 ++++++++++++------- .../mobile/src/view/CellEditor.jsx | 5 +-- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx b/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx index 7718d459a..1f99abb82 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx @@ -4,10 +4,9 @@ import CellEditorView from '../view/CellEditor'; import { f7 } from 'framework7-react'; import { Device } from '../../../../common/mobile/utils/device'; import { useTranslation } from 'react-i18next'; +import {observer, inject} from "mobx-react"; -const CellEditor = props => { - const { t } = useTranslation(); - +const CellEditor = inject("storeFunctions")(observer(props => { useEffect(() => { Common.Notifications.on('engineCreated', api => { api.asc_registerCallback('asc_onSelectionNameChanged', onApiCellSelection.bind(this)); @@ -16,6 +15,7 @@ const CellEditor = props => { }); }, []); + const { t } = useTranslation(); const [cellName, setCellName] = useState(''); const [stateFunctions, setFunctionshDisabled] = useState(null); const [stateFuncArr, setFuncArr] = useState(''); @@ -40,6 +40,10 @@ const CellEditor = props => { } const onFormulaCompleteMenu = funcArr => { + const api = Common.EditorApi.get(); + const storeFunctions = props.storeFunctions; + const functions = storeFunctions.functions; + if(funcArr) { funcArr.sort(function (a, b) { let atype = a.asc_getType(), @@ -60,27 +64,33 @@ const CellEditor = props => { let hintArr = funcArr.map(item => { let type = item.asc_getType(), name = item.asc_getName(true), - hint = ''; - + origName = api.asc_getFormulaNameByLocale(name), + args = functions[origName]?.args || '', + caption = name, + descr = ''; + switch (type) { + case Asc.c_oAscPopUpSelectorType.Func: + descr = functions && functions[origName] ? functions[origName].descr : ''; + break; case Asc.c_oAscPopUpSelectorType.TableThisRow: - hint = t('View.Add.textThisRowHint'); + descr = t('View.Add.textThisRowHint'); break; case Asc.c_oAscPopUpSelectorType.TableAll: - hint = t('View.Add.textAllTableHint'); + descr = t('View.Add.textAllTableHint'); break; case Asc.c_oAscPopUpSelectorType.TableData: - hint = t('View.Add.textDataTableHint'); + descr = t('View.Add.textDataTableHint'); break; case Asc.c_oAscPopUpSelectorType.TableHeaders: - hint = t('View.Add.textHeadersTableHint'); + descr = t('View.Add.textHeadersTableHint'); break; case Asc.c_oAscPopUpSelectorType.TableTotals: - hint = t('View.Add.textTotalsTableHint'); + descr = t('View.Add.textTotalsTableHint'); break; } - return {name, type, hint}; + return {name, type, descr, caption, args}; }); setHintArr(hintArr); @@ -108,6 +118,6 @@ const CellEditor = props => { insertFormula={insertFormula} /> ) -}; +})); export default CellEditor; \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx b/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx index cfd9d3ea6..66b83692e 100644 --- a/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx @@ -29,7 +29,7 @@ const FunctionInfo = props => {

{functionInfo.caption && functionInfo.args ? `${functionInfo.caption} ${functionInfo.args}` : functionInfo.name}

-

{functionInfo.descr || functionInfo.hint}

+

{functionInfo.descr}

) @@ -47,11 +47,12 @@ const FunctionsList = props => { {funcArr.map((elem, index) => { return ( props.insertFormula(elem.name, elem.type)}> - {(functions[elem.name] || hintArr[index]?.hint) && + {(functions[elem.name] || hintArr[index]?.descr) &&
{ e.stopPropagation(); let functionInfo = functions[elem.name] || hintArr[index]; + if(functionInfo) { f7.views.current.router.navigate('/function-info/', {props: {functionInfo, functionObj: elem, insertFormula: props.insertFormula}}); }