[SSE mobile] Fix Bug 55857
This commit is contained in:
parent
edfb2b9ae6
commit
b58b501303
|
@ -360,7 +360,12 @@
|
||||||
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
|
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
|
||||||
"txtSorting": "Sorting",
|
"txtSorting": "Sorting",
|
||||||
"txtSortSelected": "Sort selected",
|
"txtSortSelected": "Sort selected",
|
||||||
"txtYes": "Yes"
|
"txtYes": "Yes",
|
||||||
|
"textThisRowHint": "Choose only this row of the specified column",
|
||||||
|
"textAllTableHint": "Returns the entire contents of the table or specified table columns including column headers, data and total rows",
|
||||||
|
"textDataTableHint": "Returns the data cells of the table or specified table columns",
|
||||||
|
"textHeadersTableHint": "Returns the column headers for the table or specified table columns",
|
||||||
|
"textTotalsTableHint": "Returns the total rows for the table or specified table columns"
|
||||||
},
|
},
|
||||||
"Edit": {
|
"Edit": {
|
||||||
"notcriticalErrorTitle": "Warning",
|
"notcriticalErrorTitle": "Warning",
|
||||||
|
|
|
@ -3,8 +3,11 @@ import React, { useEffect, useState } from 'react';
|
||||||
import CellEditorView from '../view/CellEditor';
|
import CellEditorView from '../view/CellEditor';
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
import { Device } from '../../../../common/mobile/utils/device';
|
import { Device } from '../../../../common/mobile/utils/device';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const CellEditor = props => {
|
const CellEditor = props => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Common.Notifications.on('engineCreated', api => {
|
Common.Notifications.on('engineCreated', api => {
|
||||||
api.asc_registerCallback('asc_onSelectionNameChanged', onApiCellSelection.bind(this));
|
api.asc_registerCallback('asc_onSelectionNameChanged', onApiCellSelection.bind(this));
|
||||||
|
@ -16,6 +19,7 @@ const CellEditor = props => {
|
||||||
const [cellName, setCellName] = useState('');
|
const [cellName, setCellName] = useState('');
|
||||||
const [stateFunctions, setFunctionshDisabled] = useState(null);
|
const [stateFunctions, setFunctionshDisabled] = useState(null);
|
||||||
const [stateFuncArr, setFuncArr] = useState('');
|
const [stateFuncArr, setFuncArr] = useState('');
|
||||||
|
const [stateHintArr, setHintArr] = useState('');
|
||||||
|
|
||||||
const onApiCellSelection = info => {
|
const onApiCellSelection = info => {
|
||||||
setCellName(typeof(info)=='string' ? info : info.asc_getName());
|
setCellName(typeof(info)=='string' ? info : info.asc_getName());
|
||||||
|
@ -36,9 +40,52 @@ const CellEditor = props => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onFormulaCompleteMenu = funcArr => {
|
const onFormulaCompleteMenu = funcArr => {
|
||||||
|
if(funcArr) {
|
||||||
|
funcArr.sort(function (a, b) {
|
||||||
|
let atype = a.asc_getType(),
|
||||||
|
btype = b.asc_getType(),
|
||||||
|
aname = a.asc_getName(true).toLocaleUpperCase(),
|
||||||
|
bname = b.asc_getName(true).toLocaleUpperCase();
|
||||||
|
|
||||||
|
if (atype === Asc.c_oAscPopUpSelectorType.TableThisRow) return -1;
|
||||||
|
if (btype === Asc.c_oAscPopUpSelectorType.TableThisRow) return 1;
|
||||||
|
if ((atype === Asc.c_oAscPopUpSelectorType.TableColumnName || btype === Asc.c_oAscPopUpSelectorType.TableColumnName) && atype !== btype)
|
||||||
|
return atype === Asc.c_oAscPopUpSelectorType.TableColumnName ? -1 : 1;
|
||||||
|
if (aname < bname) return -1;
|
||||||
|
if (aname > bname) return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
let hintArr = funcArr.map(item => {
|
||||||
|
let type = item.asc_getType(),
|
||||||
|
name = item.asc_getName(true),
|
||||||
|
hint = '';
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case Asc.c_oAscPopUpSelectorType.TableThisRow:
|
||||||
|
hint = t('View.Add.textThisRowHint');
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscPopUpSelectorType.TableAll:
|
||||||
|
hint = t('View.Add.textAllTableHint');
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscPopUpSelectorType.TableData:
|
||||||
|
hint = t('View.Add.textDataTableHint');
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscPopUpSelectorType.TableHeaders:
|
||||||
|
hint = t('View.Add.textHeadersTableHint');
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscPopUpSelectorType.TableTotals:
|
||||||
|
hint = t('View.Add.textTotalsTableHint');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {name, type, hint};
|
||||||
|
});
|
||||||
|
|
||||||
|
setHintArr(hintArr);
|
||||||
setFuncArr(funcArr);
|
setFuncArr(funcArr);
|
||||||
|
|
||||||
if(funcArr) {
|
|
||||||
f7.popover.open('#idx-functions-list', '#idx-list-target');
|
f7.popover.open('#idx-functions-list', '#idx-list-target');
|
||||||
} else {
|
} else {
|
||||||
f7.popover.close('#idx-functions-list');
|
f7.popover.close('#idx-functions-list');
|
||||||
|
@ -56,6 +103,7 @@ const CellEditor = props => {
|
||||||
stateFunctions={stateFunctions}
|
stateFunctions={stateFunctions}
|
||||||
onClickToOpenAddOptions={props.onClickToOpenAddOptions}
|
onClickToOpenAddOptions={props.onClickToOpenAddOptions}
|
||||||
funcArr={stateFuncArr}
|
funcArr={stateFuncArr}
|
||||||
|
hintArr={stateHintArr}
|
||||||
insertFormula={insertFormula}
|
insertFormula={insertFormula}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
@ -28,18 +28,21 @@ const FunctionInfo = props => {
|
||||||
</NavRight>
|
</NavRight>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
<div className='function-info'>
|
<div className='function-info'>
|
||||||
|
{/* {(functionInfo.caption && functionInfo.args) &&
|
||||||
<h3>{`${functionInfo.caption} ${functionInfo.args}`}</h3>
|
<h3>{`${functionInfo.caption} ${functionInfo.args}`}</h3>
|
||||||
<p>{functionInfo.descr}</p>
|
} */}
|
||||||
|
<h3>{functionInfo.caption && functionInfo.args ? `${functionInfo.caption} ${functionInfo.args}` : functionInfo.name}</h3>
|
||||||
|
<p>{functionInfo.descr || functionInfo.hint}</p>
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const FunctionsList = props => {
|
const FunctionsList = props => {
|
||||||
const { t } = useTranslation();
|
|
||||||
const isPhone = Device.isPhone;
|
const isPhone = Device.isPhone;
|
||||||
const functions = props.functions;
|
const functions = props.functions;
|
||||||
const funcArr = props.funcArr;
|
const funcArr = props.funcArr;
|
||||||
|
const hintArr = props.hintArr;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={isPhone ? 'functions-list functions-list__mobile' : 'functions-list'}>
|
<div className={isPhone ? 'functions-list functions-list__mobile' : 'functions-list'}>
|
||||||
|
@ -47,16 +50,18 @@ const FunctionsList = props => {
|
||||||
{funcArr.map((elem, index) => {
|
{funcArr.map((elem, index) => {
|
||||||
return (
|
return (
|
||||||
<ListItem key={index} title={elem.name} className="no-indicator" onClick={() => props.insertFormula(elem.name, elem.type)}>
|
<ListItem key={index} title={elem.name} className="no-indicator" onClick={() => props.insertFormula(elem.name, elem.type)}>
|
||||||
|
{(functions[elem.name] || hintArr[index]?.hint) &&
|
||||||
<div slot='after'
|
<div slot='after'
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let functionInfo = functions[elem.name];
|
let functionInfo = functions[elem.name] || hintArr[index];
|
||||||
if(functionInfo) {
|
if(functionInfo) {
|
||||||
f7.views.current.router.navigate('/function-info/', {props: {functionInfo, functionObj: elem, insertFormula: props.insertFormula}});
|
f7.views.current.router.navigate('/function-info/', {props: {functionInfo, functionObj: elem, insertFormula: props.insertFormula}});
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<Icon icon='icon-info'/>
|
<Icon icon='icon-info'/>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
@ -65,8 +70,6 @@ const FunctionsList = props => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const CellEditorView = props => {
|
const CellEditorView = props => {
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
const isPhone = Device.isPhone;
|
const isPhone = Device.isPhone;
|
||||||
|
@ -78,6 +81,7 @@ const CellEditorView = props => {
|
||||||
const functions = storeFunctions.functions;
|
const functions = storeFunctions.functions;
|
||||||
const isEdit = storeAppOptions.isEdit;
|
const isEdit = storeAppOptions.isEdit;
|
||||||
const funcArr = props.funcArr;
|
const funcArr = props.funcArr;
|
||||||
|
const hintArr = props.hintArr;
|
||||||
|
|
||||||
const expandClick = e => {
|
const expandClick = e => {
|
||||||
setExpanded(!expanded);
|
setExpanded(!expanded);
|
||||||
|
@ -115,6 +119,7 @@ const CellEditorView = props => {
|
||||||
<FunctionsList
|
<FunctionsList
|
||||||
functions={functions}
|
functions={functions}
|
||||||
funcArr={funcArr}
|
funcArr={funcArr}
|
||||||
|
hintArr={hintArr}
|
||||||
insertFormula={props.insertFormula}
|
insertFormula={props.insertFormula}
|
||||||
/>
|
/>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
Loading…
Reference in a new issue