diff --git a/apps/common/mobile/resources/less/common.less b/apps/common/mobile/resources/less/common.less index d14b0f595e..1ccb1fc63b 100644 --- a/apps/common/mobile/resources/less/common.less +++ b/apps/common/mobile/resources/less/common.less @@ -879,28 +879,48 @@ input[type="number"]::-webkit-inner-spin-button { .functions-list { height: 175px; + width: 360px; overflow-y: auto; - position: absolute; - top: 30px; - right: 0; + overflow-x: hidden; background-color: @white; - .list { - margin: 0; - ul:before { - display: none; - } - .item-content { - padding-left: 0; - } - .item-inner { - padding-left: calc(var(--f7-list-item-padding-horizontal) + var(--f7-safe-area-left) - var(--menu-list-offset)); - } - .item-title { - font-size: 15px; + &__mobile { + position: absolute; + top: 30px; + right: 0; + left: 0; + width: 100%; + box-shadow: 0px 10px 10px -10px rgba(0, 0, 0, 0.3); + .list { + margin: 0; + ul:before { + display: none; + } + .item-content { + padding-left: 0; + } + .item-inner { + padding-left: calc(var(--f7-list-item-padding-horizontal) + var(--f7-safe-area-left) - var(--menu-list-offset)); + } + .item-title { + font-size: 15px; + } } } } +.popover__functions { + box-shadow: 0px 10px 100px rgba(0, 0, 0, 0.3); +} + +.target-function-list { + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 0; + height: 100%; +} + diff --git a/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx b/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx index fe0a158744..9f41efbd57 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/CellEditor.jsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import CellEditorView from '../view/CellEditor'; import { f7 } from 'framework7-react'; +import { Device } from '../../../../common/mobile/utils/device'; const CellEditor = props => { useEffect(() => { @@ -24,7 +25,15 @@ const CellEditor = props => { setCoauthDisabled(info.asc_getLocked() === true || info.asc_getLockedTable() === true || info.asc_getLockedPivotTable()===true); } - const onFormulaCompleteMenu = funcArr => setFuncArr(funcArr); + const onFormulaCompleteMenu = funcArr => { + setFuncArr(funcArr); + + if(!Device.isPhone && funcArr) { + f7.popover.open('#idx-functions-list', '#idx-list-target'); + } else { + f7.popover.close('#idx-functions-list'); + } + } const insertFormula = (name, type) => { const api = Common.EditorApi.get(); diff --git a/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx b/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx index bdafdfa0ee..f57bf3e3da 100644 --- a/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/CellEditor.jsx @@ -1,10 +1,10 @@ -import React, { useState } from 'react'; -import { Input, View, Button, Link, Popover, ListItem, List, Icon, f7 } from 'framework7-react'; +import React, { Fragment, useState } from 'react'; +import { Input, View, Button, Link, Popover, ListItem, List, Icon, f7, Page, Navbar, NavRight } from 'framework7-react'; import {observer, inject} from "mobx-react"; -// import {PageFunctionInfo} from "./add/AddFunction"; import { __interactionsRef } from 'scheduler/tracing'; import { Device } from '../../../../common/mobile/utils/device'; +import { useTranslation } from 'react-i18next'; const viewStyle = { height: 30 @@ -14,6 +14,74 @@ const contentStyle = { flexGrow: 1 }; +const FunctionInfo = props => { + const { t } = useTranslation(); + const _t = t('View.Add', {returnObjects: true}); + const functionObj = props.functionObj; + const functionInfo = props.functionInfo; + + return ( + + + + props.insertFormula(functionObj.name, functionObj.type)}> + + +
+

{`${functionInfo.caption} ${functionInfo.args}`}

+

{functionInfo.descr}

+
+
+ ) +} + +const FunctionsList = props => { + const { t } = useTranslation(); + const isPhone = Device.isPhone; + const functions = props.functions; + const funcArr = props.funcArr; + + return ( +
+ + {funcArr.map((elem, index) => { + return ( + props.insertFormula(elem.name, elem.type)}> +
{ + e.stopPropagation(); + let functionInfo = functions[elem.name]; + + if(functionInfo) { + if(isPhone) { + f7.dialog.create({ + title: functionInfo.caption, + content: `

${functionInfo.caption} ${functionInfo.args}

${functionInfo.descr}

`, + buttons: [ + {text: t('View.Add.textCancel')}, + { + text: t('View.Add.textInsert'), + onClick: () => props.insertFormula(elem.name, elem.type) + } + ] + }).open(); + } else { + f7.views.current.router.navigate('/function-info/', {props: {functionInfo, functionObj: elem, insertFormula: props.insertFormula}}); + } + } + }}> + +
+
+ ) + })} +
+
+ ) +} + + + const CellEditorView = props => { const [expanded, setExpanded] = useState(false); const isPhone = Device.isPhone; @@ -27,7 +95,9 @@ const CellEditorView = props => { setExpanded(!expanded); }; - return + return ( + <> +
+