From 57b7d0c4101a29c1fe360127367ca656a8a14182 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Sat, 26 Dec 2020 00:26:51 +0300 Subject: [PATCH] [PE mobile] Make Transition settings --- apps/common/mobile/resources/less/common.less | 47 ++++++++++++++++++ .../mobile/src/controller/Main.jsx | 6 ++- .../mobile/src/controller/edit/Effect.jsx | 16 +++++++ .../mobile/src/controller/edit/Transition.jsx | 27 +++++++++++ .../mobile/src/controller/edit/Type.jsx | 16 +++++++ .../mobile/src/store/effect.js | 5 ++ .../mobile/src/store/mainStore.js | 6 ++- .../mobile/src/store/transition.js | 17 ++++--- .../mobile/src/store/type.js | 5 ++ .../mobile/src/view/edit/Edit.jsx | 10 ++++ .../mobile/src/view/edit/Effect.jsx | 24 ++++++++++ .../mobile/src/view/edit/Transition.jsx | 48 +++++++++++++++---- .../mobile/src/view/edit/Type.jsx | 28 +++++++++++ 13 files changed, 236 insertions(+), 19 deletions(-) create mode 100644 apps/presentationeditor/mobile/src/controller/edit/Effect.jsx create mode 100644 apps/presentationeditor/mobile/src/controller/edit/Type.jsx create mode 100644 apps/presentationeditor/mobile/src/store/effect.js create mode 100644 apps/presentationeditor/mobile/src/store/type.js create mode 100644 apps/presentationeditor/mobile/src/view/edit/Effect.jsx create mode 100644 apps/presentationeditor/mobile/src/view/edit/Type.jsx diff --git a/apps/common/mobile/resources/less/common.less b/apps/common/mobile/resources/less/common.less index fbd950316..7a2d26d4e 100644 --- a/apps/common/mobile/resources/less/common.less +++ b/apps/common/mobile/resources/less/common.less @@ -154,3 +154,50 @@ } } +// Transition + +.slide-transition { + .splitter { + display: flex; + align-items: center; + color: @black; + label { + margin: 0 5px; + } + } + .buttons-row { + display: flex; + margin: 0; + min-width: 90px; + margin-left: 10px; + .button { + width: 100%; + } + .button:first-child { + border-radius: 5px 0 0 5px; + border-left-width: 1px; + border-left-style: solid; + } + .button:last-child { + border-radius: 0 5px 5px 0; + } + } + .range-slider { + .range-bar { + height: 2px; + } + .range-bar-active { + background: transparent; + } + } + .slide-apply-all { + color: @themeColor; + border: 0; + .item-inner { + justify-content: center; + } + } +} + + + diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 0d0693568..ae7481d58 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -4,7 +4,7 @@ import { inject } from "mobx-react"; import { withTranslation } from 'react-i18next'; import CollaborationController from '../../../../common/mobile/lib/controller/Collaboration.jsx' -@inject("storeFocusObjects", "storeAppOptions", "storePresentationInfo", "storePresentationSettings", "storeLayout", "storeTheme") +@inject("storeFocusObjects", "storeAppOptions", "storePresentationInfo", "storePresentationSettings", "storeLayout", "storeTheme", "storeTransition") class MainController extends Component { constructor(props) { super(props) @@ -193,6 +193,7 @@ class MainController extends Component { const storeFocusObjects = this.props.storeFocusObjects; const storeLayout = this.props.storeLayout; + const storeTransition = this.props.storeTransition; this.api.asc_registerCallback('asc_onFocusObject', objects => { console.log(objects); @@ -204,6 +205,9 @@ class MainController extends Component { if(settings[0] === "slide") { const slideObject = objects[0].get_ObjectValue(); storeLayout.changeSlideLayoutIndex(slideObject.get_LayoutIndex()); + // const timing = slideObject.get_transition(); + // console.log(timing); + storeTransition.addTransitionObj(slideObject.get_transition()); } }); diff --git a/apps/presentationeditor/mobile/src/controller/edit/Effect.jsx b/apps/presentationeditor/mobile/src/controller/edit/Effect.jsx new file mode 100644 index 000000000..147b57e61 --- /dev/null +++ b/apps/presentationeditor/mobile/src/controller/edit/Effect.jsx @@ -0,0 +1,16 @@ +import React, { Component } from "react"; +import Effect from "../../view/edit/Effect"; + +class EffectController extends Component { + constructor(props) { + super(props); + } + + render() { + return ( + + ); + } +} + +export default EffectController; \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/controller/edit/Transition.jsx b/apps/presentationeditor/mobile/src/controller/edit/Transition.jsx index 61722f0da..57f2674bc 100644 --- a/apps/presentationeditor/mobile/src/controller/edit/Transition.jsx +++ b/apps/presentationeditor/mobile/src/controller/edit/Transition.jsx @@ -6,6 +6,29 @@ class TransitionController extends Component { super(props); } + initTransitionView(timing) { + + const _effect = timing.get_TransitionType(); + // me.getView('EditSlide').fillEffectTypes(_effect); + // $('#edit-slide-effect .item-after').text(me.getView('EditSlide').getEffectName(_effect)); + // $('#edit-slide-effect-type').toggleClass('disabled', _effect == Asc.c_oAscSlideTransitionTypes.None); + // $('#edit-slide-duration').toggleClass('disabled', _effect == Asc.c_oAscSlideTransitionTypes.None); + + // _effectType = timing.get_TransitionOption(); + // $('#edit-slide-effect-type .item-after').text((_effect != Asc.c_oAscSlideTransitionTypes.None) ? me.getView('EditSlide').getEffectTypeName(_effectType) : ''); + + // _effectDuration = timing.get_TransitionDuration(); + // $('#edit-slide-duration .item-after label').text((_effectDuration!==null && _effectDuration!==undefined) ? (parseInt(_effectDuration/1000.) + ' ' + me.textSec) : ''); + + // $('#edit-slide-start-click input:checkbox').prop('checked', !!timing.get_SlideAdvanceOnMouseClick()); + // $('#edit-slide-delay input:checkbox').prop('checked', !!timing.get_SlideAdvanceAfter()); + // $('#edit-slide-delay .item-content:nth-child(2)').toggleClass('disabled',!timing.get_SlideAdvanceAfter()); + + // _effectDelay = timing.get_SlideAdvanceDuration(); + // $('#edit-slide-delay .item-content:nth-child(2) .item-after').text((_effectDelay!==null && _effectDelay!==undefined) ? (parseInt(_effectDelay/1000.) + ' ' + me.textSec) : ''); + // $('#edit-slide-delay .item-content:nth-child(2) input').val([(_effectDelay!==null && _effectDelay!==undefined) ? parseInt(_effectDelay/1000.) : 0]); + } + render() { return ( @@ -13,4 +36,8 @@ class TransitionController extends Component { } } +// const initTransitionView = (timing) => { + +// } + export default TransitionController; \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/controller/edit/Type.jsx b/apps/presentationeditor/mobile/src/controller/edit/Type.jsx new file mode 100644 index 000000000..c544d0187 --- /dev/null +++ b/apps/presentationeditor/mobile/src/controller/edit/Type.jsx @@ -0,0 +1,16 @@ +import React, { Component } from "react"; +import Type from "../../view/edit/Type"; + +class TypeController extends Component { + constructor(props) { + super(props); + } + + render() { + return ( + + ); + } +} + +export default TypeController; \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/store/effect.js b/apps/presentationeditor/mobile/src/store/effect.js new file mode 100644 index 000000000..aee5a0782 --- /dev/null +++ b/apps/presentationeditor/mobile/src/store/effect.js @@ -0,0 +1,5 @@ +import {action, observable} from 'mobx'; + +export class storeEffect { + +} \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/store/mainStore.js b/apps/presentationeditor/mobile/src/store/mainStore.js index a022c8999..604465a0a 100644 --- a/apps/presentationeditor/mobile/src/store/mainStore.js +++ b/apps/presentationeditor/mobile/src/store/mainStore.js @@ -9,6 +9,8 @@ import {storePresentationSettings} from './presentationSettings'; import { storeLayout } from './layout'; import { storeTransition } from './transition'; import { storeTheme } from './theme'; +import { storeEffect } from './effect'; +import { storeType } from './type'; // import {storeTextSettings} from "./textSettings"; // import {storeParagraphSettings} from "./paragraphSettings"; // import {storeShapeSettings} from "./shapeSettings"; @@ -26,7 +28,9 @@ export const stores = { storePresentationSettings: new storePresentationSettings(), storeLayout: new storeLayout(), storeTransition: new storeTransition(), - storeTheme: new storeTheme() + storeTheme: new storeTheme(), + storeEffect: new storeEffect(), + storeType: new storeType() // storeTextSettings: new storeTextSettings(), // storeParagraphSettings: new storeParagraphSettings(), // storeShapeSettings: new storeShapeSettings(), diff --git a/apps/presentationeditor/mobile/src/store/transition.js b/apps/presentationeditor/mobile/src/store/transition.js index 44d3308b9..912275696 100644 --- a/apps/presentationeditor/mobile/src/store/transition.js +++ b/apps/presentationeditor/mobile/src/store/transition.js @@ -2,15 +2,14 @@ import {action, observable} from 'mobx'; export class storeTransition { - // @observable arrayLayouts; - // @observable slideLayoutIndex = -1; - - // @action addArrayLayouts(array) { - // this.arrayLayouts = array; - // } + @observable isDelay = false; + @observable transitionObj = {}; - // @action changeSlideLayoutIndex(index) { - // this.slideLayoutIndex = index; - // } + @action toggleDelay() { + this.isDelay = !this.isDelay; + } + @action addTransitionObj(obj) { + this.transitionObj = obj; + } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/store/type.js b/apps/presentationeditor/mobile/src/store/type.js new file mode 100644 index 000000000..a019c6a94 --- /dev/null +++ b/apps/presentationeditor/mobile/src/store/type.js @@ -0,0 +1,5 @@ +import {action, observable} from 'mobx'; + +export class storeType { + +} \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/edit/Edit.jsx b/apps/presentationeditor/mobile/src/view/edit/Edit.jsx index 96c486499..db47714e8 100644 --- a/apps/presentationeditor/mobile/src/view/edit/Edit.jsx +++ b/apps/presentationeditor/mobile/src/view/edit/Edit.jsx @@ -10,6 +10,8 @@ import EditTextController from "../../controller/edit/EditText"; import LayoutController from "../../controller/edit/Layout"; import TransitionController from '../../controller/edit/Transition'; import ThemeController from '../../controller/edit/Theme'; +import EffectController from '../../controller/edit/Effect'; +import TypeController from '../../controller/edit/Type'; //import EditShapeController from "../../controller/edit/EditShape"; //import EditImageController from "../../controller/edit/EditImage"; //import EditTableController from "../../controller/edit/EditTable"; @@ -28,6 +30,14 @@ const routes = [ { path: '/transition/', component: TransitionController + }, + { + path: '/effect/', + component: EffectController + }, + { + path: '/type/', + component: TypeController } ]; diff --git a/apps/presentationeditor/mobile/src/view/edit/Effect.jsx b/apps/presentationeditor/mobile/src/view/edit/Effect.jsx new file mode 100644 index 000000000..0a6924890 --- /dev/null +++ b/apps/presentationeditor/mobile/src/view/edit/Effect.jsx @@ -0,0 +1,24 @@ +import React, {useState} from "react"; +import { observer, inject } from "mobx-react"; +import { Page, Navbar, List, ListItem, NavRight, Link, Toggle, Range, ListItemCell } from "framework7-react"; +import { useTranslation } from "react-i18next"; + +const PageEffect= props => { + const { t } = useTranslation(); + const _t = t("View.Edit", { returnObjects: true }); + + return ( + + + + + + + + + ); +}; + +const Effect = inject("storeEffect")(observer(PageEffect)); + +export default Effect; \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/edit/Transition.jsx b/apps/presentationeditor/mobile/src/view/edit/Transition.jsx index 9f4630bd0..c663be886 100644 --- a/apps/presentationeditor/mobile/src/view/edit/Transition.jsx +++ b/apps/presentationeditor/mobile/src/view/edit/Transition.jsx @@ -1,12 +1,14 @@ -import React, {Fragment} from "react"; +import React, {useState} from "react"; import { observer, inject } from "mobx-react"; -import { Page, Navbar, List, ListItem, BlockTitle, NavRight, Link } from "framework7-react"; +import { Page, Navbar, List, ListItem, NavRight, Link, Toggle, Range, ListItemCell } from "framework7-react"; import { useTranslation } from "react-i18next"; const PageTransition = props => { const { t } = useTranslation(); const _t = t("View.Edit", { returnObjects: true }); - // const storeInfo = props.storePresentationInfo; + const [stateRange, changeRange] = useState(0); + const store = props.storeTransition; + const isDelay = store.isDelay; // const dataApp = props.getAppProps(); // const dataModified = props.getModified; // const dataModifiedBy = props.getModifiedBy; @@ -14,18 +16,48 @@ const PageTransition = props => { // const dataDoc = JSON.parse(JSON.stringify(storeInfo.dataDoc)); return ( - + - - - + + +
+
+ +
+ +

+ - + + +

+
+
+
+ + + {_t.textStartOnClick} + + + + {_t.textDelay} + + + + + + + + {stateRange} s + + + + + {_t.textApplyAll} -
); }; diff --git a/apps/presentationeditor/mobile/src/view/edit/Type.jsx b/apps/presentationeditor/mobile/src/view/edit/Type.jsx new file mode 100644 index 000000000..d1dbb4de2 --- /dev/null +++ b/apps/presentationeditor/mobile/src/view/edit/Type.jsx @@ -0,0 +1,28 @@ +import React, {useState} from "react"; +import { observer, inject } from "mobx-react"; +import { Page, Navbar, List, ListItem, NavRight, Link, Toggle, Range, ListItemCell } from "framework7-react"; +import { useTranslation } from "react-i18next"; + +const PageType= props => { + const { t } = useTranslation(); + const _t = t("View.Edit", { returnObjects: true }); + + return ( + + + + + + + + + + + + + ); +}; + +const Type = inject("storeType")(observer(PageType)); + +export default Type; \ No newline at end of file