diff --git a/apps/spreadsheeteditor/mobile/src/controller/Encoding.jsx b/apps/spreadsheeteditor/mobile/src/controller/Encoding.jsx
new file mode 100644
index 000000000..ac2134523
--- /dev/null
+++ b/apps/spreadsheeteditor/mobile/src/controller/Encoding.jsx
@@ -0,0 +1,44 @@
+import React, { Component } from 'react';
+import { Device } from '../../../../common/mobile/utils/device';
+import { f7 } from "framework7-react";
+import { Encoding } from "../view/Encoding";
+import { observer, inject } from "mobx-react";
+
+class EncodingController extends Component {
+ constructor(props) {
+ super(props);
+ this.onSaveFormat = this.onSaveFormat.bind(this);
+ }
+
+ closeModal() {
+ if (Device.phone) {
+ f7.sheet.close('.encoding-popup', false);
+ } else {
+ f7.popover.close('#encoding-popover');
+ }
+ }
+
+ onSaveFormat(mode, valueEncoding, valueDelimeter) {
+ const api = Common.EditorApi.get();
+ const storeEncoding = this.props.storeEncoding;
+
+ if(mode === 2) {
+ this.closeModal();
+ const formatOptions = storeEncoding.formatOptions;
+ formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(valueEncoding, valueDelimeter));
+ api.asc_DownloadAs(formatOptions);
+ } else {
+ storeEncoding.setMode(1);
+ const type = storeEncoding.type;
+ api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(valueEncoding, valueDelimeter));
+ }
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+export default inject("storeEncoding")(observer(EncodingController));
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx
index d48a09f94..c0a16c96b 100644
--- a/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx
+++ b/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx
@@ -4,6 +4,7 @@ import { Device } from '../../../../../common/mobile/utils/device';
import { withTranslation, useTranslation } from 'react-i18next';
import { f7 } from 'framework7-react';
import { observer, inject } from "mobx-react";
+// import MainPage from '../../page/main';
class DownloadController extends Component {
constructor(props) {
@@ -11,6 +12,14 @@ class DownloadController extends Component {
this.onSaveFormat = this.onSaveFormat.bind(this);
}
+ closeModal() {
+ if (Device.phone) {
+ f7.sheet.close('.settings-popup', false);
+ } else {
+ f7.popover.close('#settings-popover');
+ }
+ }
+
onSaveFormat(format) {
const api = Common.EditorApi.get();
const { t } = this.props;
@@ -24,12 +33,15 @@ class DownloadController extends Component {
f7.dialog.confirm(
_t.warnDownloadAs,
_t.notcriticalErrorTitle,
- () => {
+ async () => {
const canRequestClose = this.props.storeAppOptions.canRequestClose;
+ await this.closeModal();
onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, advOptions, 2, new Asc.asc_CDownloadOptions(format), _t, true, canRequestClose, false, storeEncoding);
+ this.props.openOptions('encoding');
}
)
} else {
+ this.closeModal();
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
}
}
@@ -60,9 +72,9 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady
storeEncoding.changeEncoding(recommendedSettings.asc_getCodePage());
storeEncoding.changeDelimeter(recommendedSettings && recommendedSettings.asc_getDelimiter() ? recommendedSettings.asc_getDelimiter() : 4);
- if(mode === 2) {
- f7.views.current.router.navigate('/encoding/');
- }
+ // if(mode === 2) {
+ // f7.views.current.router.navigate('/encoding/');
+ // }
}
// let picker;
// const pages = [];
diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx
index 33b61eaf4..79acd15eb 100644
--- a/apps/spreadsheeteditor/mobile/src/page/main.jsx
+++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx
@@ -16,6 +16,7 @@ import { f7 } from 'framework7-react';
import {FunctionGroups} from "../controller/add/AddFunction";
import ContextMenu from '../controller/ContextMenu';
import { Toolbar } from "../controller/Toolbar";
+import EncodingController from "../controller/Encoding";
class MainPage extends Component {
constructor(props) {
@@ -26,6 +27,7 @@ class MainPage extends Component {
addShowOptions: null,
settingsVisible: false,
collaborationVisible: false,
+ encodingVisible: false
};
}
@@ -42,6 +44,8 @@ class MainPage extends Component {
};
else if ( opts == 'settings' )
return {settingsVisible: true};
+ else if ( opts == 'encoding' )
+ return {encodingVisible: true};
else if ( opts == 'coauth' )
return {collaborationVisible: true};
});
@@ -60,6 +64,8 @@ class MainPage extends Component {
return {addOptionsVisible: false};
else if ( opts == 'settings' )
return {settingsVisible: false};
+ else if ( opts == 'encoding' )
+ return {encodingVisible: false};
else if ( opts == 'coauth' )
return {collaborationVisible: false};
});
@@ -67,7 +73,7 @@ class MainPage extends Component {
f7.navbar.show('.main-navbar');
}
})();
- };
+ };
render() {
const appOptions = this.props.storeAppOptions;
@@ -106,13 +112,17 @@ class MainPage extends Component {
}
{
- !this.state.settingsVisible && this.props.storeEncoding.mode ? null :
+ !this.state.settingsVisible ? null :
}
{
!this.state.collaborationVisible ? null :
}
+ {
+ !this.state.encodingVisible && this.props.storeEncoding.mode ? null :
+
+ }
diff --git a/apps/spreadsheeteditor/mobile/src/view/Encoding.jsx b/apps/spreadsheeteditor/mobile/src/view/Encoding.jsx
new file mode 100644
index 000000000..1350570bb
--- /dev/null
+++ b/apps/spreadsheeteditor/mobile/src/view/Encoding.jsx
@@ -0,0 +1,153 @@
+import React, {Component, useEffect} from 'react';
+import { observer, inject } from "mobx-react";
+import { f7, Page, Navbar, List, ListItem, BlockTitle, ListButton, Popover, Popup, View, Link } from "framework7-react";
+import { useTranslation } from "react-i18next";
+import { Device } from '../../../../common/mobile/utils/device';
+
+const routes = [
+ {
+ path: '/encoding/',
+ component: PageEncoding
+ },
+ {
+ path: '/encoding-list/',
+ component: PageEncodingList
+ },
+ {
+ path: '/delimeter-list/',
+ component: PageDelimeterList
+ }
+];
+
+const PageEncoding = inject("storeEncoding")(observer(props => {
+ const { t } = useTranslation();
+ const _t = t("View.Settings", { returnObjects: true });
+ const storeEncoding = props.storeEncoding;
+ const valueEncoding = storeEncoding.valueEncoding;
+ const nameDelimeter = storeEncoding.nameDelimeter;
+ const valueDelimeter = storeEncoding.valueDelimeter;
+ const nameEncoding = storeEncoding.nameEncoding;
+ const mode = storeEncoding.mode;
+
+ return (
+
+
+
+ {_t.textDelimeter}
+
+
+
+ {_t.textEncoding}
+
+
+
+
+ props.onSaveFormat(mode, valueEncoding, valueDelimeter)}>
+
+
+
+
+ )
+}));
+
+const PageEncodingList = inject("storeEncoding")(observer(props => {
+ const { t } = useTranslation();
+ const _t = t("View.Settings", { returnObjects: true });
+ const storeEncoding = props.storeEncoding;
+ const valueEncoding = storeEncoding.valueEncoding;
+ const pages = storeEncoding.pages;
+ const pagesName = storeEncoding.pagesName;
+
+ return (
+
+
+ {_t.textChooseEncoding}
+
+ {pagesName.map((name, index) => {
+ return (
+ {
+ storeEncoding.changeEncoding(pages[index]);
+ f7.views.current.router.back();
+ }}>
+ )
+ })}
+
+
+ )
+}));
+
+const PageDelimeterList = inject("storeEncoding")(observer(props => {
+ const { t } = useTranslation();
+ const _t = t("View.Settings", { returnObjects: true });
+ const storeEncoding = props.storeEncoding;
+ const valueDelimeter = storeEncoding.valueDelimeter;
+ const namesDelimeter = storeEncoding.namesDelimeter;
+ const valuesDelimeter = storeEncoding.valuesDelimeter;
+
+ return (
+
+
+ {_t.textChooseDelimeter}
+
+ {namesDelimeter.map((name, index) => {
+ return (
+ {
+ storeEncoding.changeDelimeter(valuesDelimeter[index]);
+ f7.views.current.router.back();
+ }}>
+ )
+ })}
+
+
+ )
+}));
+
+// const Encoding = inject("storeEncoding")(observer(PageEncoding));
+// const EncodingList = inject("storeEncoding")(observer(PageEncodingList));
+// const DelimeterList = inject("storeEncoding")(observer(PageDelimeterList));
+
+class EncodingView extends Component {
+ constructor(props) {
+ super(props);
+ this.onoptionclick = this.onoptionclick.bind(this);
+ }
+
+ onoptionclick(page){
+ f7.views.current.router.navigate(page);
+ }
+
+ render() {
+ const show_popover = this.props.usePopover;
+ return (
+ show_popover ?
+ this.props.onclosed()}>
+
+ :
+ this.props.onclosed()}>
+
+
+ )
+ }
+}
+
+const Encoding = props => {
+ useEffect(() => {
+ if ( Device.phone )
+ f7.popup.open('.encoding-popup');
+ else f7.popover.open('#encoding-popover');
+
+ return () => {
+ }
+ });
+
+
+ const onviewclosed = () => {
+ if ( props.onclosed )
+ props.onclosed();
+ };
+
+ return
+};
+
+// export {EncodingList, Encoding, DelimeterList}
+export {Encoding, PageEncodingList, PageDelimeterList}
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx
index f5d0fab05..afde10636 100644
--- a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx
+++ b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx
@@ -64,18 +64,18 @@ const routes = [
path: '/about/',
component: About
},
- {
- path: '/encoding/',
- component: EncodingController
- },
- {
- path: '/encoding-list/',
- component: EncodingList
- },
- {
- path: '/delimeter-list/',
- component: DelimeterList
- }
+ // {
+ // path: '/encoding/',
+ // component: EncodingController
+ // },
+ // {
+ // path: '/encoding-list/',
+ // component: EncodingList
+ // },
+ // {
+ // path: '/delimeter-list/',
+ // component: DelimeterList
+ // }
];
@@ -138,7 +138,8 @@ const SettingsList = inject("storeAppOptions", "storeEncoding")(observer(props =
}
return (
-
+ // onClick={onoptionclick.bind(this, "/download/")}
+
{navbar}
@@ -160,7 +161,7 @@ const SettingsList = inject("storeAppOptions", "storeEncoding")(observer(props =
-
+