[SSE mobile] Bug 48058

This commit is contained in:
SergeyEzhin 2021-05-28 15:12:21 +03:00
parent 9888430691
commit edd4ed6629
3 changed files with 25 additions and 6 deletions

View file

@ -222,6 +222,8 @@
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"textEmptyImgUrl": "You need to specify image URL.",
"notcriticalErrorTitle": "Warning",
"errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",
"errorMaxRows": "ERROR! The maximum number of data series per chart is 255.",
"textLink": "Link",
"textAddLink": "Add Link",
"textLinkType": "Link Type",

View file

@ -1,6 +1,7 @@
import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import { withTranslation } from 'react-i18next';
import AddChart from '../../view/add/AddChart';
@ -20,10 +21,24 @@ class AddChartController extends Component {
onInsertChart (type) {
const api = Common.EditorApi.get();
const settings = api.asc_getChartObject();
settings.changeType(type);
api.asc_addChartDrawingObject(settings);
this.closeModal();
const { t } = this.props;
const _t = t('View.Add', {returnObjects: true});
const settings = api.asc_getChartObject(true);
const info = api.asc_getCellInfo();
const selType = info.asc_getSelectionType();
const isChartEdit = (selType == Asc.c_oAscSelectionType.RangeChart || selType == Asc.c_oAscSelectionType.RangeChartText);
if (settings) {
isChartEdit ? settings.changeType(type) : settings.putType(type);
let range = settings.getRange(),
isValid = !!range ? api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, range, true, !settings.getInColumns(), settings.getType()) : Asc.c_oAscError.ID.No;
if (isValid == Asc.c_oAscError.ID.No) {
isChartEdit ? api.asc_editChartDrawingObject(settings) : api.asc_addChartDrawingObject(settings);
this.closeModal();
} else {
f7.dialog.alert((isValid == Asc.c_oAscError.ID.StockChartError) ? _t.errorStockChart : ((isValid == Asc.c_oAscError.ID.MaxDataSeriesError) ? _t.errorMaxRows : _t.txtInvalidRange), _t.notcriticalErrorTitle);
}
}
}
render () {
@ -34,4 +49,6 @@ class AddChartController extends Component {
}
}
export default AddChartController;
const AddChartControllerTranslated = withTranslation()(AddChartController);
export {AddChartControllerTranslated as AddChartController};

View file

@ -5,7 +5,7 @@ import {f7} from 'framework7-react';
import { observer, inject } from "mobx-react";
import {Device} from '../../../../../common/mobile/utils/device';
import AddChartController from "../../controller/add/AddChart";
import {AddChartController} from "../../controller/add/AddChart";
import {AddFunctionController} from "../../controller/add/AddFunction";
import {PageFunctionGroup, PageFunctionInfo} from "./AddFunction";
import AddShapeController from "../../controller/add/AddShape";