From 1a0a47a4a616a4cc496a12f150637c106320ec87 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 3 Feb 2021 19:44:11 +0300 Subject: [PATCH] [SSE mobile] Add insert of functions (insert functions from groups, page info) --- .../mobile/resources/less/common-ios.less | 7 +- .../resources/less/common-material.less | 7 +- .../mobile/src/controller/add/AddFunction.jsx | 3 +- .../mobile/src/less/app.less | 9 ++ .../mobile/src/view/add/Add.jsx | 16 ++- .../mobile/src/view/add/AddFunction.jsx | 104 +++++++++++++++++- 6 files changed, 133 insertions(+), 13 deletions(-) diff --git a/apps/common/mobile/resources/less/common-ios.less b/apps/common/mobile/resources/less/common-ios.less index 6060c5f6b..0a43c970b 100644 --- a/apps/common/mobile/resources/less/common-ios.less +++ b/apps/common/mobile/resources/less/common-ios.less @@ -198,8 +198,11 @@ } li.no-indicator { .item-link { - .item-inner:before { - content: none; + .item-inner { + padding-right: 15px; + &:before { + content: none; + } } } } diff --git a/apps/common/mobile/resources/less/common-material.less b/apps/common/mobile/resources/less/common-material.less index 18af81ee1..2dbc3ddf3 100644 --- a/apps/common/mobile/resources/less/common-material.less +++ b/apps/common/mobile/resources/less/common-material.less @@ -152,8 +152,11 @@ .list { li.no-indicator { .item-link { - .item-inner:before { - content: none; + .item-inner{ + padding-right: 15px; + &:before { + content: none; + } } } } diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddFunction.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddFunction.jsx index 1cc27de06..46220d98d 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/add/AddFunction.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddFunction.jsx @@ -5,7 +5,7 @@ import {Device} from '../../../../../common/mobile/utils/device'; import {LocalStorage} from '../../../../../common/mobile/utils/LocalStorage'; -import AddFunction from '../../view/add/AddFunction'; +import {AddFunction} from '../../view/add/AddFunction'; class _FunctionGroups extends Component { constructor (props) { @@ -79,6 +79,7 @@ class AddFunctionController extends Component { render () { return ( ) } diff --git a/apps/spreadsheeteditor/mobile/src/less/app.less b/apps/spreadsheeteditor/mobile/src/less/app.less index 49f02cf9f..3941298d0 100644 --- a/apps/spreadsheeteditor/mobile/src/less/app.less +++ b/apps/spreadsheeteditor/mobile/src/less/app.less @@ -30,3 +30,12 @@ --f7-popover-width: 360px; //--f7-page-content-extra-padding-top: 37px; } + +.function-info { + padding: 0 15px; +} +.page-function-info { + &.page-content, .page-content { + background-color: @white; + } +} \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx index 0d7d682b3..27046c42e 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx @@ -7,10 +7,20 @@ import {Device} from '../../../../../common/mobile/utils/device'; import AddChartController from "../../controller/add/AddChart"; import {AddFunctionController} from "../../controller/add/AddFunction"; +import {PageFunctionGroup, PageFunctionInfo} from "./AddFunction"; //import AddShapeController from "../../controller/add/AddShape"; //import {AddOtherController} from "../../controller/add/AddOther"; const routes = [ + // Functions + { + path: '/add-function-group/', + component: PageFunctionGroup + }, + { + path: '/add-function-info/', + component: PageFunctionInfo + } ]; const AddLayoutNavbar = ({ tabs, inPopover }) => { @@ -62,7 +72,7 @@ const AddTabs = props => { caption: _t.textFunction, id: 'add-function', icon: 'icon-add-formula', - component: + component: }); } /*tabs.push({ @@ -93,8 +103,8 @@ class AddView extends Component { this.onoptionclick = this.onoptionclick.bind(this); } - onoptionclick(page){ - f7.views.current.router.navigate(page); + onoptionclick(page, props){ + f7.views.current.router.navigate(page, props); } render() { const show_popover = this.props.usePopover; diff --git a/apps/spreadsheeteditor/mobile/src/view/add/AddFunction.jsx b/apps/spreadsheeteditor/mobile/src/view/add/AddFunction.jsx index 33ac4ba67..a979d5c3d 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/AddFunction.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/AddFunction.jsx @@ -1,7 +1,61 @@ import React, {Fragment, useState} from 'react'; import {observer, inject} from "mobx-react"; import { useTranslation } from 'react-i18next'; -import {List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button} from 'framework7-react'; +import {List, ListItem, Page, Navbar, Icon, BlockTitle} from 'framework7-react'; + +const PageInfo = props => { + const { t } = useTranslation(); + const _t = t('View.Add', {returnObjects: true}); + const f = props.functionInfo; + return( + + +
+

{`${f.caption} ${f.args}`}

+

{f.descr}

+
+
+ ) +}; + +const PageGroup = ({name, type, functions, onInsertFunction, f7router}) => { + const { t } = useTranslation(); + const _t = t('View.Add', {returnObjects: true}); + const items = []; + for (let k in functions) { + if (functions[k].group == type) + items.push(functions[k]); + } + return ( + + + + {items.map((f, index) => { + return( + {onInsertFunction(f.type);}} + > +
{ + f7router.navigate('/add-function-info/', { + props: { + functionInfo: f + } + }); + event.stopPropagation(); + }}> + +
+
+ ) + })} +
+
+ ) +}; const AddFunction = props => { const { t } = useTranslation(); @@ -16,7 +70,10 @@ const AddFunction = props => { ]; if (functions) { quickFunctions.forEach((quickFunction) => { - quickFunction.caption = functions[quickFunction.type].caption; + const f = functions[quickFunction.type]; + quickFunction.caption = f.caption; + quickFunction.args = f.args; + quickFunction.descr = f.descr; }); } let name = ''; @@ -24,7 +81,11 @@ const AddFunction = props => { const groups = []; for (let i = 0; i < descriptions.length; i++) { name = descriptions[i]; - groups[name] = _t['sCat' + name] || name; + name = _t['sCat' + name] || name; + groups.push({ + type: descriptions[i], + name: name + }) } return ( @@ -37,13 +98,46 @@ const AddFunction = props => { link='#' onClick={() => {props.onInsertFunction(f.type);}} > -
+
{ + props.onOptionClick('/add-function-info/', { + props: { + functionInfo: f + } + }); + event.stopPropagation(); + }}> + +
) })} + {_t.textGroups} + + {groups.map((group, index) => { + return( + + ) + })} +
) }; -export default inject("storeFunctions")(observer(AddFunction)); \ No newline at end of file +const AddFunctionContainer = inject("storeFunctions")(observer(AddFunction)); + +export { + AddFunctionContainer as AddFunction, + PageGroup as PageFunctionGroup, + PageInfo as PageFunctionInfo +}; \ No newline at end of file