[SSE mobile] Fix Bug 55874

This commit is contained in:
SergeyEzhin 2022-03-04 20:12:14 +04:00
parent 6bec944f6f
commit 83170b1a12
2 changed files with 25 additions and 14 deletions

View file

@ -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;

View file

@ -29,7 +29,7 @@ const FunctionInfo = props => {
</Navbar>
<div className='function-info'>
<h3>{functionInfo.caption && functionInfo.args ? `${functionInfo.caption} ${functionInfo.args}` : functionInfo.name}</h3>
<p>{functionInfo.descr || functionInfo.hint}</p>
<p>{functionInfo.descr}</p>
</div>
</Page>
)
@ -47,11 +47,12 @@ const FunctionsList = props => {
{funcArr.map((elem, index) => {
return (
<ListItem key={index} title={elem.name} className="no-indicator" onClick={() => props.insertFormula(elem.name, elem.type)}>
{(functions[elem.name] || hintArr[index]?.hint) &&
{(functions[elem.name] || hintArr[index]?.descr) &&
<div slot='after'
onClick={(e) => {
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}});
}