Merge pull request #964 from ONLYOFFICE/feature/Bug_43270
Feature/bug 43270
This commit is contained in:
commit
fe1b82ee8b
|
@ -318,6 +318,7 @@
|
|||
"textThin": "Thin",
|
||||
"textMedium": "Medium",
|
||||
"textThick": "Thick",
|
||||
"textFraction": "Fraction",
|
||||
"textGeneral": "General",
|
||||
"textNumber": "Number",
|
||||
"textInteger": "Integer",
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import React, {Component} from 'react';
|
||||
import { f7 } from 'framework7-react';
|
||||
import {Device} from '../../../../../common/mobile/utils/device';
|
||||
|
||||
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) {
|
||||
|
@ -116,10 +133,23 @@ 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);
|
||||
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 +198,9 @@ class EditCellController extends Component {
|
|||
onCellFormat={this.onCellFormat}
|
||||
onTextOrientationChange={this.onTextOrientationChange}
|
||||
onBorderStyle={this.onBorderStyle}
|
||||
onAccountingCellFormat={this.onAccountingCellFormat}
|
||||
dateFormats={this.dateFormats}
|
||||
timeFormats={this.timeFormats}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -88,7 +88,11 @@ const EditCell = props => {
|
|||
</List>
|
||||
<List>
|
||||
<ListItem title={_t.textFormat} link="/edit-format-cell/" routeProps={{
|
||||
onCellFormat: props.onCellFormat
|
||||
onCellFormat: props.onCellFormat,
|
||||
onCurrencyCellFormat: props.onCurrencyCellFormat,
|
||||
onAccountingCellFormat: props.onAccountingCellFormat,
|
||||
dateFormats: props.dateFormats,
|
||||
timeFormats: props.timeFormats
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-format-general"></Icon> : null
|
||||
|
@ -757,20 +761,20 @@ const PageFormatCell = props => {
|
|||
}
|
||||
</Navbar>
|
||||
<List>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textGeneral} onClick={() => props.onCellFormat('R2VuZXJhbA==')}>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textGeneral} onClick={() => props.onCellFormat('General')}>
|
||||
<Icon slot="media" icon="icon-format-general"></Icon>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textNumber} onClick={() => props.onCellFormat('MC4wMA==')}>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textNumber} onClick={() => props.onCellFormat('0.00')}>
|
||||
<Icon slot="media" icon="icon-format-number"></Icon>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textInteger} onClick={() => props.onCellFormat('JTIzMA==')}>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textFraction} onClick={() => props.onCellFormat('# ?/?')}>
|
||||
<Icon slot="media" icon="icon-format-integer"></Icon>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textScientific} onClick={() => props.onCellFormat('MC4wMEUlMkIwMA==')}>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textScientific} onClick={() => props.onCellFormat('0.00E+00')}>
|
||||
<Icon slot="media" icon="icon-format-scientific"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title={_t.textAccounting} link="/edit-accounting-format-cell/" routeProps={{
|
||||
onCellFormat: props.onCellFormat
|
||||
onAccountingCellFormat: props.onAccountingCellFormat
|
||||
}}>
|
||||
<Icon slot="media" icon="icon-format-accounting"></Icon>
|
||||
</ListItem>
|
||||
|
@ -780,19 +784,21 @@ const PageFormatCell = props => {
|
|||
<Icon slot="media" icon="icon-format-currency"></Icon>
|
||||
</ListItem>
|
||||
<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>
|
||||
</ListItem>
|
||||
<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>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textPercentage} onClick={() => props.onCellFormat('MC4wMCUyNQ==')}>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textPercentage} onClick={() => props.onCellFormat('0.00%')}>
|
||||
<Icon slot="media" icon="icon-format-percentage"></Icon>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textText} onClick={() => props.onCellFormat('JTQw')}>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textText} onClick={() => props.onCellFormat('@')}>
|
||||
<Icon slot="media" icon="icon-format-text"></Icon>
|
||||
</ListItem>
|
||||
</List>
|
||||
|
@ -815,19 +821,19 @@ const PageAccountingFormatCell = props => {
|
|||
</Navbar>
|
||||
<List>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textDollar} after='$'
|
||||
onClick={() => props.onCellFormat('XyglMjQqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglMjQqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglMjQqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}>
|
||||
onClick={() => props.onAccountingCellFormat(1033)}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textEuro} after='€'
|
||||
onClick={() => props.onCellFormat('XyglRTIlODIlQUMqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglRTIlODIlQUMqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglRTIlODIlQUMqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}>
|
||||
onClick={() => props.onAccountingCellFormat(1031)}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textPound} after='£'
|
||||
onClick={() => props.onCellFormat('XyglQzIlQTMqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglQzIlQTMqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglQzIlQTMqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}>
|
||||
onClick={() => props.onAccountingCellFormat(2057)}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textRouble} after='₽'
|
||||
onClick={() => props.onCellFormat('Xy0qJTIwJTIzJTJDJTIzJTIzMC4wMCU1QiUyNCVEMSU4MC4tNDE5JTVEXy0lM0ItKiUyMCUyMyUyQyUyMyUyMzAuMDAlNUIlMjQlRDElODAuLTQxOSU1RF8tJTNCXy0qJTIwJTIyLSUyMiUzRiUzRiU1QiUyNCVEMSU4MC4tNDE5JTVEXy0lM0JfLSU0MF8t')}>
|
||||
onClick={() => props.onAccountingCellFormat(1049)}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textYen} after='¥'
|
||||
onClick={() => props.onCellFormat('XyglQzIlQTUqJTIwJTIzJTJDJTIzJTIzMC4wMF8pJTNCXyglQzIlQTUqJTIwKCUyMyUyQyUyMyUyMzAuMDApJTNCXyglQzIlQTUqJTIwJTIyLSUyMiUzRiUzRl8pJTNCXyglNDBfKQ==')}>
|
||||
onClick={() => props.onAccountingCellFormat(1041)}>
|
||||
</ListItem>
|
||||
</List>
|
||||
</Page>
|
||||
|
@ -840,7 +846,7 @@ const PageCurrencyFormatCell = props => {
|
|||
|
||||
return (
|
||||
<Page>
|
||||
<Navbar title={_t.textAccounting} backLink={_t.textBack}>
|
||||
<Navbar title={_t.textCurrency} backLink={_t.textBack}>
|
||||
{Device.phone &&
|
||||
<NavRight>
|
||||
<Link icon='icon-expand-down' sheetClose></Link>
|
||||
|
@ -849,19 +855,19 @@ const PageCurrencyFormatCell = props => {
|
|||
</Navbar>
|
||||
<List>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textDollar} after='$'
|
||||
onClick={() => props.onCellFormat('JTI0JTIzJTJDJTIzJTIzMC4wMA==')}>
|
||||
onClick={() => props.onCellFormat('[$$-409]#,##0.00')}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textEuro} after='€'
|
||||
onClick={() => props.onCellFormat('JUUyJTgyJUFDJTIzJTJDJTIzJTIzMC4wMA==')}>
|
||||
onClick={() => props.onCellFormat('#,##0.00\ [$€-407]')}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textPound} after='£'
|
||||
onClick={() => props.onCellFormat('JUMyJUEzJTIzJTJDJTIzJTIzMC4wMA==')}>
|
||||
onClick={() => props.onCellFormat('[$£-809]#,##0.00')}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textRouble} after='₽'
|
||||
onClick={() => props.onCellFormat('JTIzJTJDJTIzJTIzMC4wMCUyMiVEMSU4MC4lMjI=')}>
|
||||
onClick={() => props.onCellFormat('#,##0.00\ [$₽-419]')}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title={_t.textYen} after='¥'
|
||||
onClick={() => props.onCellFormat('JUMyJUE1JTIzJTJDJTIzJTIzMC4wMA==')}>
|
||||
onClick={() => props.onCellFormat('[$¥-411]#,##0.00')}>
|
||||
</ListItem>
|
||||
</List>
|
||||
</Page>
|
||||
|
@ -871,6 +877,7 @@ const PageCurrencyFormatCell = props => {
|
|||
const PageDateFormatCell = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t('View.Edit', {returnObjects: true});
|
||||
const dateFormats = props.dateFormats;
|
||||
|
||||
return (
|
||||
<Page>
|
||||
|
@ -882,26 +889,12 @@ const PageDateFormatCell = props => {
|
|||
}
|
||||
</Navbar>
|
||||
<List>
|
||||
<ListItem link='#' className='no-indicator' title='07-24-88' after='MM-dd-yy'
|
||||
onClick={() => props.onCellFormat('TU0tZGQteXk=')}></ListItem>
|
||||
<ListItem link='#' className='no-indicator' title='07-24-1988' after='MM-dd-yyyy'
|
||||
onClick={() => props.onCellFormat('TU0tZGQteXl5eQ==')}>
|
||||
</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>
|
||||
{dateFormats.map((format, index) => {
|
||||
return (
|
||||
<ListItem link='#' key={index} className='no-indicator' title={format.displayValue}
|
||||
onClick={() => props.onCellFormat(format.value)}></ListItem>
|
||||
)
|
||||
})}
|
||||
</List>
|
||||
</Page>
|
||||
)
|
||||
|
@ -910,6 +903,7 @@ const PageDateFormatCell = props => {
|
|||
const PageTimeFormatCell = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t('View.Edit', {returnObjects: true});
|
||||
const timeFormats = props.timeFormats;
|
||||
|
||||
return (
|
||||
<Page>
|
||||
|
@ -921,21 +915,12 @@ const PageTimeFormatCell = props => {
|
|||
}
|
||||
</Navbar>
|
||||
<List>
|
||||
<ListItem link='#' className='no-indicator' title='10:56' after='HH:mm'
|
||||
onClick={() => props.onCellFormat('aCUzQW1tJTNCJTQw')}>
|
||||
</ListItem>
|
||||
<ListItem link='#' className='no-indicator' title='21:56:00' after='HH:MM:ss'
|
||||
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>
|
||||
{timeFormats.map((format, index) => {
|
||||
return (
|
||||
<ListItem link='#' key={index} className='no-indicator' title={format.displayValue}
|
||||
onClick={() => props.onCellFormat(format.value)}></ListItem>
|
||||
)
|
||||
})}
|
||||
</List>
|
||||
</Page>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue