[SSE mobile] Fix Bug 48032

This commit is contained in:
SergeyEzhin 2021-07-02 20:47:58 +03:00
parent 4940291ce6
commit 35ed597900
2 changed files with 52 additions and 53 deletions

View file

@ -1,12 +1,33 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import { f7 } from 'framework7-react'; import { f7 } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device'; import {Device} from '../../../../../common/mobile/utils/device';
import {observer, inject} from "mobx-react";
import { EditCell } from '../../view/edit/EditCell'; import { EditCell } from '../../view/edit/EditCell';
class EditCellController extends Component { class EditCellController extends Component {
constructor (props) { constructor (props) {
super(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) { toggleBold(value) {
@ -117,12 +138,6 @@ class EditCellController extends Component {
} }
onCellFormat(format) { onCellFormat(format) {
const api = Common.EditorApi.get();
// let type = decodeURIComponent(atob(value));
api.asc_setCellFormat(format);
}
onCurrencyCellFormat(format) {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_setCellFormat(format); api.asc_setCellFormat(format);
} }
@ -187,11 +202,12 @@ class EditCellController extends Component {
onCellFormat={this.onCellFormat} onCellFormat={this.onCellFormat}
onTextOrientationChange={this.onTextOrientationChange} onTextOrientationChange={this.onTextOrientationChange}
onBorderStyle={this.onBorderStyle} onBorderStyle={this.onBorderStyle}
onCurrencyCellFormat={this.onCurrencyCellFormat}
onAccountingCellFormat={this.onAccountingCellFormat} onAccountingCellFormat={this.onAccountingCellFormat}
dateFormats={this.dateFormats}
timeFormats={this.timeFormats}
/> />
) )
} }
} }
export default EditCellController; export default inject("storeCellSettings")(observer(EditCellController));

View file

@ -1,4 +1,4 @@
import React, {Fragment, useState} from 'react'; import React, {Fragment, useState, useEffect} from 'react';
import {observer, inject} from "mobx-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 {f7, List, ListItem, Icon, Row, Button, Page, Navbar, Segmented, BlockTitle, NavRight, Link, Toggle} from 'framework7-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -90,7 +90,9 @@ const EditCell = props => {
<ListItem title={_t.textFormat} link="/edit-format-cell/" routeProps={{ <ListItem title={_t.textFormat} link="/edit-format-cell/" routeProps={{
onCellFormat: props.onCellFormat, onCellFormat: props.onCellFormat,
onCurrencyCellFormat: props.onCurrencyCellFormat, onCurrencyCellFormat: props.onCurrencyCellFormat,
onAccountingCellFormat: props.onAccountingCellFormat onAccountingCellFormat: props.onAccountingCellFormat,
dateFormats: props.dateFormats,
timeFormats: props.timeFormats
}}> }}>
{!isAndroid ? {!isAndroid ?
<Icon slot="media" icon="icon-format-general"></Icon> : null <Icon slot="media" icon="icon-format-general"></Icon> : null
@ -777,17 +779,19 @@ const PageFormatCell = props => {
<Icon slot="media" icon="icon-format-accounting"></Icon> <Icon slot="media" icon="icon-format-accounting"></Icon>
</ListItem> </ListItem>
<ListItem title={_t.textCurrency} link="/edit-currency-format-cell/" routeProps={{ <ListItem title={_t.textCurrency} link="/edit-currency-format-cell/" routeProps={{
onCurrencyCellFormat: props.onCurrencyCellFormat onCellFormat: props.onCellFormat
}}> }}>
<Icon slot="media" icon="icon-format-currency"></Icon> <Icon slot="media" icon="icon-format-currency"></Icon>
</ListItem> </ListItem>
<ListItem title={_t.textDate} link='/edit-date-format-cell/' routeProps={{ <ListItem title={_t.textDate} link='/edit-date-format-cell/' routeProps={{
onCellFormat: props.onCellFormat onCellFormat: props.onCellFormat,
dateFormats: props.dateFormats
}}> }}>
<Icon slot="media" icon="icon-format-date"></Icon> <Icon slot="media" icon="icon-format-date"></Icon>
</ListItem> </ListItem>
<ListItem title={_t.textTime} link='/edit-time-format-cell/' routeProps={{ <ListItem title={_t.textTime} link='/edit-time-format-cell/' routeProps={{
onCellFormat: props.onCellFormat onCellFormat: props.onCellFormat,
timeFormats: props.timeFormats
}}> }}>
<Icon slot="media" icon="icon-format-time"></Icon> <Icon slot="media" icon="icon-format-time"></Icon>
</ListItem> </ListItem>
@ -851,19 +855,19 @@ const PageCurrencyFormatCell = props => {
</Navbar> </Navbar>
<List> <List>
<ListItem link='#' className='no-indicator' title={_t.textDollar} after='$' <ListItem link='#' className='no-indicator' title={_t.textDollar} after='$'
onClick={() => props.onCurrencyCellFormat('[$$-409]#,##0.00')}> onClick={() => props.onCellFormat('[$$-409]#,##0.00')}>
</ListItem> </ListItem>
<ListItem link='#' className='no-indicator' title={_t.textEuro} after='€' <ListItem link='#' className='no-indicator' title={_t.textEuro} after='€'
onClick={() => props.onCurrencyCellFormat('#,##0.00\ [$€-407]')}> onClick={() => props.onCellFormat('#,##0.00\ [$€-407]')}>
</ListItem> </ListItem>
<ListItem link='#' className='no-indicator' title={_t.textPound} after='£' <ListItem link='#' className='no-indicator' title={_t.textPound} after='£'
onClick={() => props.onCurrencyCellFormat('[$£-809]#,##0.00')}> onClick={() => props.onCellFormat('[$£-809]#,##0.00')}>
</ListItem> </ListItem>
<ListItem link='#' className='no-indicator' title={_t.textRouble} after='₽' <ListItem link='#' className='no-indicator' title={_t.textRouble} after='₽'
onClick={() => props.onCurrencyCellFormat('#,##0.00\ [$₽-419]')}> onClick={() => props.onCellFormat('#,##0.00\ [$₽-419]')}>
</ListItem> </ListItem>
<ListItem link='#' className='no-indicator' title={_t.textYen} after='¥' <ListItem link='#' className='no-indicator' title={_t.textYen} after='¥'
onClick={() => props.onCurrencyCellFormat('[$¥-411]#,##0.00')}> onClick={() => props.onCellFormat('[$¥-411]#,##0.00')}>
</ListItem> </ListItem>
</List> </List>
</Page> </Page>
@ -873,6 +877,7 @@ const PageCurrencyFormatCell = props => {
const PageDateFormatCell = props => { const PageDateFormatCell = props => {
const { t } = useTranslation(); const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true}); const _t = t('View.Edit', {returnObjects: true});
const dateFormats = props.dateFormats;
return ( return (
<Page> <Page>
@ -884,26 +889,12 @@ const PageDateFormatCell = props => {
} }
</Navbar> </Navbar>
<List> <List>
<ListItem link='#' className='no-indicator' title='07-24-88' after='MM-dd-yy' {dateFormats.map((format, index) => {
onClick={() => props.onCellFormat('TU0tZGQteXk=')}></ListItem> return (
<ListItem link='#' className='no-indicator' title='07-24-1988' after='MM-dd-yyyy' <ListItem link='#' key={index} className='no-indicator' title={format.displayValue}
onClick={() => props.onCellFormat('TU0tZGQteXl5eQ==')}> onClick={() => props.onCellFormat(format.value)}></ListItem>
</ListItem> )
<ListItem link='#' className='no-indicator' title='24-07-88' after='dd-MM-yy' })}
onClick={() => props.onCellFormat('ZGQtTU0teXk=')}>
</ListItem>
<ListItem link='#' className='no-indicator' title='24-07-1988' after='dd-MM-yyyy'
onClick={() => props.onCellFormat('ZGQtTU0teXl5eQ==')}>
</ListItem>
<ListItem link='#' className='no-indicator' title='24-Jul-1988' after='dd-MMM-yyyy'
onClick={() => props.onCellFormat('ZGQtTU1NLXl5eXk=')}>
</ListItem>
<ListItem link='#' className='no-indicator' title='24-Jul' after='dd-MMM'
onClick={() => props.onCellFormat('ZGQtTU1N')}>
</ListItem>
<ListItem link='#' className='no-indicator' title='Jul-88' after='MMM-yy'
onClick={() => props.onCellFormat('TU1NLXl5')}>
</ListItem>
</List> </List>
</Page> </Page>
) )
@ -912,6 +903,7 @@ const PageDateFormatCell = props => {
const PageTimeFormatCell = props => { const PageTimeFormatCell = props => {
const { t } = useTranslation(); const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true}); const _t = t('View.Edit', {returnObjects: true});
const timeFormats = props.timeFormats;
return ( return (
<Page> <Page>
@ -923,21 +915,12 @@ const PageTimeFormatCell = props => {
} }
</Navbar> </Navbar>
<List> <List>
<ListItem link='#' className='no-indicator' title='10:56' after='HH:mm' {timeFormats.map((format, index) => {
onClick={() => props.onCellFormat('aCUzQW1tJTNCJTQw')}> return (
</ListItem> <ListItem link='#' key={index} className='no-indicator' title={format.displayValue}
<ListItem link='#' className='no-indicator' title='21:56:00' after='HH:MM:ss' onClick={() => props.onCellFormat(format.value)}></ListItem>
onClick={() => props.onCellFormat('aCUzQW1tJTNBc3MlM0IlNDA=')}> )
</ListItem> })}
<ListItem link='#' className='no-indicator' title='05:56 AM' after='hh:mm tt'
onClick={() => props.onCellFormat('aCUzQW1tJTIwQU0lMkZQTSUzQiU0MA==')}>
</ListItem>
<ListItem link='#' className='no-indicator' title='05:56:00 AM' after='hh:mm:ss tt'
onClick={() => props.onCellFormat('aCUzQW1tJTNBc3MlMjBBTSUyRlBNJTNCJTQw')}>
</ListItem>
<ListItem link='#' className='no-indicator' title='38:56:00' after='[h]:mm:ss'
onClick={() => props.onCellFormat('JTVCaCU1RCUzQW1tJTNBc3MlM0IlNDA=')}>
</ListItem>
</List> </List>
</Page> </Page>
) )