From 4940291ce6975a5a0ebc2e7d2ca6965d65563ed4 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 1 Jul 2021 22:11:42 +0300 Subject: [PATCH 1/3] [SSE mobile] Fix Bug 43270 --- apps/spreadsheeteditor/mobile/locale/en.json | 1 + .../mobile/src/controller/edit/EditCell.jsx | 27 ++++++++++-- .../mobile/src/view/edit/EditCell.jsx | 42 ++++++++++--------- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 02681d4f8..730a81fc1 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -318,6 +318,7 @@ "textThin": "Thin", "textMedium": "Medium", "textThick": "Thick", + "textFraction": "Fraction", "textGeneral": "General", "textNumber": "Number", "textInteger": "Integer", diff --git a/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx index b0d7bd9b7..a54d9ec07 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx @@ -116,10 +116,29 @@ class EditCellController extends Component { api.asc_setCellAngle(angle); } - onCellFormat(value) { + onCellFormat(format) { const api = Common.EditorApi.get(); - let type = decodeURIComponent(atob(value)); - api.asc_setCellFormat(type); + // let type = decodeURIComponent(atob(value)); + api.asc_setCellFormat(format); + } + + onCurrencyCellFormat(format) { + const api = Common.EditorApi.get(); + api.asc_setCellFormat(format); + } + + onAccountingCellFormat(value) { + const api = Common.EditorApi.get(); + let info = new Asc.asc_CFormatCellsInfo(); + + info.asc_setType(Asc.c_oAscNumFormatType.Accounting); + info.asc_setSeparator(false); + info.asc_setSymbol(value); + + let format = api.asc_getFormatCells(info); + + if (format && format.length > 0) + api.asc_setCellFormat(format[0]); } onBorderStyle(type, borderInfo) { @@ -168,6 +187,8 @@ class EditCellController extends Component { onCellFormat={this.onCellFormat} onTextOrientationChange={this.onTextOrientationChange} onBorderStyle={this.onBorderStyle} + onCurrencyCellFormat={this.onCurrencyCellFormat} + onAccountingCellFormat={this.onAccountingCellFormat} /> ) } diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx index e66e49045..3a48110e8 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -88,7 +88,9 @@ const EditCell = props => { {!isAndroid ? : null @@ -757,25 +759,25 @@ const PageFormatCell = props => { } - props.onCellFormat('R2VuZXJhbA==')}> + props.onCellFormat('General')}> - props.onCellFormat('MC4wMA==')}> + props.onCellFormat('0.00')}> - props.onCellFormat('JTIzMA==')}> + props.onCellFormat('# ?/?')}> - props.onCellFormat('MC4wMEUlMkIwMA==')}> + props.onCellFormat('0.00E+00')}> @@ -789,10 +791,10 @@ const PageFormatCell = props => { }}> - props.onCellFormat('MC4wMCUyNQ==')}> + props.onCellFormat('0.00%')}> - props.onCellFormat('JTQw')}> + props.onCellFormat('@')}> @@ -815,19 +817,19 @@ const PageAccountingFormatCell = props => { props.onCellFormat('XyglMjQqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglMjQqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglMjQqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}> + onClick={() => props.onAccountingCellFormat(1033)}> props.onCellFormat('XyglRTIlODIlQUMqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglRTIlODIlQUMqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglRTIlODIlQUMqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}> + onClick={() => props.onAccountingCellFormat(1031)}> props.onCellFormat('XyglQzIlQTMqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglQzIlQTMqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglQzIlQTMqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}> + onClick={() => props.onAccountingCellFormat(2057)}> props.onCellFormat('Xy0qJTIwJTIzJTJDJTIzJTIzMC4wMCU1QiUyNCVEMSU4MC4tNDE5JTVEXy0lM0ItKiUyMCUyMyUyQyUyMyUyMzAuMDAlNUIlMjQlRDElODAuLTQxOSU1RF8tJTNCXy0qJTIwJTIyLSUyMiUzRiUzRiU1QiUyNCVEMSU4MC4tNDE5JTVEXy0lM0JfLSU0MF8t')}> + onClick={() => props.onAccountingCellFormat(1049)}> props.onCellFormat('XyglQzIlQTUqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglQzIlQTUqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglQzIlQTUqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}> + onClick={() => props.onAccountingCellFormat(1041)}> @@ -840,7 +842,7 @@ const PageCurrencyFormatCell = props => { return ( - + {Device.phone && @@ -849,19 +851,19 @@ const PageCurrencyFormatCell = props => { props.onCellFormat('JTI0JTIzJTJDJTIzJTIzMC4wMA==')}> + onClick={() => props.onCurrencyCellFormat('[$$-409]#,##0.00')}> props.onCellFormat('JUUyJTgyJUFDJTIzJTJDJTIzJTIzMC4wMA==')}> + onClick={() => props.onCurrencyCellFormat('#,##0.00\ [$€-407]')}> props.onCellFormat('JUMyJUEzJTIzJTJDJTIzJTIzMC4wMA==')}> + onClick={() => props.onCurrencyCellFormat('[$£-809]#,##0.00')}> props.onCellFormat('JTIzJTJDJTIzJTIzMC4wMCUyMiVEMSU4MC4lMjI=')}> + onClick={() => props.onCurrencyCellFormat('#,##0.00\ [$₽-419]')}> props.onCellFormat('JUMyJUE1JTIzJTJDJTIzJTIzMC4wMA==')}> + onClick={() => props.onCurrencyCellFormat('[$¥-411]#,##0.00')}> From 35ed5979003909afdaa1e75166d551982de8dfa9 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Fri, 2 Jul 2021 20:47:58 +0300 Subject: [PATCH 2/3] [SSE mobile] Fix Bug 48032 --- .../mobile/src/controller/edit/EditCell.jsx | 32 ++++++-- .../mobile/src/view/edit/EditCell.jsx | 73 +++++++------------ 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx index a54d9ec07..8554350ce 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx @@ -1,12 +1,33 @@ import React, {Component} from 'react'; import { f7 } from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; +import {observer, inject} from "mobx-react"; import { EditCell } from '../../view/edit/EditCell'; class EditCellController extends Component { constructor (props) { super(props); + this.dateFormats = this.initFormats(Asc.c_oAscNumFormatType.Date, 38822); + this.timeFormats = this.initFormats(Asc.c_oAscNumFormatType.Time, 1.534); + } + + initFormats(type, exampleVal) { + const api = Common.EditorApi.get(); + let info = new Asc.asc_CFormatCellsInfo(); + + info.asc_setType(type); + info.asc_setDecimalPlaces(0); + info.asc_setSeparator(false); + + let formatsArr = api.asc_getFormatCells(info), + data = []; + + formatsArr.forEach(function(item) { + data.push({value: item, displayValue: api.asc_getLocaleExample(item, exampleVal)}); + }); + + return data; } toggleBold(value) { @@ -117,12 +138,6 @@ class EditCellController extends Component { } onCellFormat(format) { - const api = Common.EditorApi.get(); - // let type = decodeURIComponent(atob(value)); - api.asc_setCellFormat(format); - } - - onCurrencyCellFormat(format) { const api = Common.EditorApi.get(); api.asc_setCellFormat(format); } @@ -187,11 +202,12 @@ class EditCellController extends Component { onCellFormat={this.onCellFormat} onTextOrientationChange={this.onTextOrientationChange} onBorderStyle={this.onBorderStyle} - onCurrencyCellFormat={this.onCurrencyCellFormat} onAccountingCellFormat={this.onAccountingCellFormat} + dateFormats={this.dateFormats} + timeFormats={this.timeFormats} /> ) } } -export default EditCellController; \ No newline at end of file +export default inject("storeCellSettings")(observer(EditCellController)); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx index 3a48110e8..282238517 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -1,4 +1,4 @@ -import React, {Fragment, useState} from 'react'; +import React, {Fragment, useState, useEffect} from 'react'; import {observer, inject} from "mobx-react"; import {f7, List, ListItem, Icon, Row, Button, Page, Navbar, Segmented, BlockTitle, NavRight, Link, Toggle} from 'framework7-react'; import { useTranslation } from 'react-i18next'; @@ -90,7 +90,9 @@ const EditCell = props => { {!isAndroid ? : null @@ -777,17 +779,19 @@ const PageFormatCell = props => { @@ -851,19 +855,19 @@ const PageCurrencyFormatCell = props => { props.onCurrencyCellFormat('[$$-409]#,##0.00')}> + onClick={() => props.onCellFormat('[$$-409]#,##0.00')}> props.onCurrencyCellFormat('#,##0.00\ [$€-407]')}> + onClick={() => props.onCellFormat('#,##0.00\ [$€-407]')}> props.onCurrencyCellFormat('[$£-809]#,##0.00')}> + onClick={() => props.onCellFormat('[$£-809]#,##0.00')}> props.onCurrencyCellFormat('#,##0.00\ [$₽-419]')}> + onClick={() => props.onCellFormat('#,##0.00\ [$₽-419]')}> props.onCurrencyCellFormat('[$¥-411]#,##0.00')}> + onClick={() => props.onCellFormat('[$¥-411]#,##0.00')}> @@ -873,6 +877,7 @@ const PageCurrencyFormatCell = props => { const PageDateFormatCell = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); + const dateFormats = props.dateFormats; return ( @@ -884,26 +889,12 @@ const PageDateFormatCell = props => { } - props.onCellFormat('TU0tZGQteXk=')}> - props.onCellFormat('TU0tZGQteXl5eQ==')}> - - props.onCellFormat('ZGQtTU0teXk=')}> - - props.onCellFormat('ZGQtTU0teXl5eQ==')}> - - props.onCellFormat('ZGQtTU1NLXl5eXk=')}> - - props.onCellFormat('ZGQtTU1N')}> - - props.onCellFormat('TU1NLXl5')}> - + {dateFormats.map((format, index) => { + return ( + props.onCellFormat(format.value)}> + ) + })} ) @@ -912,6 +903,7 @@ const PageDateFormatCell = props => { const PageTimeFormatCell = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); + const timeFormats = props.timeFormats; return ( @@ -923,21 +915,12 @@ const PageTimeFormatCell = props => { } - props.onCellFormat('aCUzQW1tJTNCJTQw')}> - - props.onCellFormat('aCUzQW1tJTNBc3MlM0IlNDA=')}> - - props.onCellFormat('aCUzQW1tJTIwQU0lMkZQTSUzQiU0MA==')}> - - props.onCellFormat('aCUzQW1tJTNBc3MlMjBBTSUyRlBNJTNCJTQw')}> - - props.onCellFormat('JTVCaCU1RCUzQW1tJTNBc3MlM0IlNDA=')}> - + {timeFormats.map((format, index) => { + return ( + props.onCellFormat(format.value)}> + ) + })} ) From 292a517152b59e8eebf638ee32b109f4ece25cc1 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Sat, 3 Jul 2021 16:37:22 +0300 Subject: [PATCH 3/3] [SSE mobile] Correct in edit cell --- .../mobile/src/controller/edit/EditCell.jsx | 6 +----- apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx index 8554350ce..37fd07f14 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/edit/EditCell.jsx @@ -1,8 +1,4 @@ import React, {Component} from 'react'; -import { f7 } from 'framework7-react'; -import {Device} from '../../../../../common/mobile/utils/device'; -import {observer, inject} from "mobx-react"; - import { EditCell } from '../../view/edit/EditCell'; class EditCellController extends Component { @@ -210,4 +206,4 @@ class EditCellController extends Component { } } -export default inject("storeCellSettings")(observer(EditCellController)); \ No newline at end of file +export default EditCellController; \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx index 282238517..c2980ee4a 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -1,4 +1,4 @@ -import React, {Fragment, useState, useEffect} from 'react'; +import React, {Fragment, useState} from 'react'; import {observer, inject} from "mobx-react"; import {f7, List, ListItem, Icon, Row, Button, Page, Navbar, Segmented, BlockTitle, NavRight, Link, Toggle} from 'framework7-react'; import { useTranslation } from 'react-i18next';