[SSE mobile] fix according to mobx v. 6
This commit is contained in:
parent
56c323c0e1
commit
4c38321d72
|
@ -1,15 +1,40 @@
|
||||||
import {action, observable} from 'mobx';
|
import {makeObservable, action, observable} from 'mobx';
|
||||||
export class storeApplicationSettings {
|
|
||||||
|
|
||||||
@observable unitMeasurement = Common.Utils.Metric.getCurrentMetric();
|
export class storeApplicationSettings {
|
||||||
@observable macrosMode = 0;
|
constructor() {
|
||||||
@observable formulaLang = Common.Locale.currentLang || dataLang[0].value;
|
makeObservable(this, {
|
||||||
@observable regCode = undefined;
|
unitMeasurement: observable
|
||||||
@observable regExample = '';
|
, macrosMode: observable
|
||||||
@observable regData = [];
|
, formulaLang: observable
|
||||||
@observable isRefStyle = false;
|
, regCode: observable
|
||||||
@observable isComments = true;
|
, regExample: observable
|
||||||
@observable isResolvedComments = true;
|
, regData: observable
|
||||||
|
, isRefStyle: observable
|
||||||
|
, isComments: observable
|
||||||
|
, isResolvedComments: observable
|
||||||
|
, initRegData: action
|
||||||
|
, getRegCode: action
|
||||||
|
, changeRegCode: action
|
||||||
|
, setRegExample: action
|
||||||
|
, changeUnitMeasurement: action
|
||||||
|
, changeMacrosSettings: action
|
||||||
|
, changeDisplayComments: action
|
||||||
|
, changeDisplayResolved: action
|
||||||
|
, changeRefStyle: action
|
||||||
|
, changeFormulaLang: action
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
unitMeasurement = Common.Utils.Metric.getCurrentMetric();
|
||||||
|
macrosMode = 0;
|
||||||
|
formulaLang = Common.Locale.currentLang || dataLang[0].value;
|
||||||
|
regCode = undefined;
|
||||||
|
regExample = '';
|
||||||
|
regData = [];
|
||||||
|
isRefStyle = false;
|
||||||
|
isComments = true;
|
||||||
|
isResolvedComments = true;
|
||||||
|
|
||||||
getFormulaLanguages() {
|
getFormulaLanguages() {
|
||||||
const dataLang = [
|
const dataLang = [
|
||||||
|
@ -35,7 +60,7 @@ export class storeApplicationSettings {
|
||||||
return regDataCode;
|
return regDataCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action initRegData() {
|
initRegData() {
|
||||||
const regDataCodes = this.getRegDataCodes();
|
const regDataCodes = this.getRegDataCodes();
|
||||||
|
|
||||||
regDataCodes.forEach(item => {
|
regDataCodes.forEach(item => {
|
||||||
|
@ -44,7 +69,7 @@ export class storeApplicationSettings {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@action getRegCode() {
|
getRegCode() {
|
||||||
const regData = this.regData;
|
const regData = this.regData;
|
||||||
let value = Number(Common.localStorage.getItem('sse-settings-regional'));
|
let value = Number(Common.localStorage.getItem('sse-settings-regional'));
|
||||||
|
|
||||||
|
@ -59,36 +84,36 @@ export class storeApplicationSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeRegCode(value) {
|
changeRegCode(value) {
|
||||||
this.regCode = value;
|
this.regCode = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action setRegExample(value) {
|
setRegExample(value) {
|
||||||
this.regExample = value;
|
this.regExample = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeUnitMeasurement(value) {
|
changeUnitMeasurement(value) {
|
||||||
this.unitMeasurement = +value;
|
this.unitMeasurement = +value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeMacrosSettings(value) {
|
changeMacrosSettings(value) {
|
||||||
this.macrosMode = +value;
|
this.macrosMode = +value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeDisplayComments(value) {
|
changeDisplayComments(value) {
|
||||||
this.isComments = value;
|
this.isComments = value;
|
||||||
if (!value) this.changeDisplayResolved(value);
|
if (!value) this.changeDisplayResolved(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeDisplayResolved(value) {
|
changeDisplayResolved(value) {
|
||||||
this.isResolvedComments = value;
|
this.isResolvedComments = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeRefStyle(value) {
|
changeRefStyle(value) {
|
||||||
this.isRefStyle = value;
|
this.isRefStyle = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeFormulaLang(value) {
|
changeFormulaLang(value) {
|
||||||
this.formulaLang = value;
|
this.formulaLang = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,47 +1,78 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {makeObservable, action, observable, computed} from 'mobx';
|
||||||
|
|
||||||
export class storeCellSettings {
|
export class storeCellSettings {
|
||||||
|
constructor() {
|
||||||
|
makeObservable(this, {
|
||||||
|
styleSize: observable
|
||||||
|
, borderInfo: observable
|
||||||
|
, borderStyle: observable
|
||||||
|
, cellStyles: observable
|
||||||
|
, fontsArray: observable
|
||||||
|
, fontInfo: observable
|
||||||
|
, fillColor: observable
|
||||||
|
, fontColor: observable
|
||||||
|
, styleName: observable
|
||||||
|
, isBold: observable
|
||||||
|
, isItalic: observable
|
||||||
|
, isUnderline: observable
|
||||||
|
, hAlignStr: observable
|
||||||
|
, vAlignStr: observable
|
||||||
|
, isWrapText: observable
|
||||||
|
, orientationStr: observable
|
||||||
|
, initCellSettings: action
|
||||||
|
, initTextFormat: action
|
||||||
|
, initTextOrientation: action
|
||||||
|
, initFontSettings: action
|
||||||
|
, initEditorFonts: action
|
||||||
|
, initCellStyles: action
|
||||||
|
, initFontInfo: action
|
||||||
|
, changeFontColor: action
|
||||||
|
, changeFillColor: action
|
||||||
|
, changeBorderColor: action
|
||||||
|
, changeBorderSize: action
|
||||||
|
, changeBorderStyle: action
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@observable styleSize = {
|
styleSize = {
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 50
|
height: 50
|
||||||
};
|
};
|
||||||
|
|
||||||
@observable borderInfo = {
|
borderInfo = {
|
||||||
color: '000000',
|
color: '000000',
|
||||||
width: Asc.c_oAscBorderStyles.Medium
|
width: 12 // Asc.c_oAscBorderStyles.Medium
|
||||||
};
|
};
|
||||||
|
|
||||||
@observable borderStyle = 'none';
|
borderStyle = 'none';
|
||||||
|
|
||||||
@observable cellStyles = [];
|
cellStyles = [];
|
||||||
@observable fontsArray = [];
|
fontsArray = [];
|
||||||
@observable fontInfo = {};
|
fontInfo = {};
|
||||||
|
|
||||||
@observable fillColor = undefined;
|
fillColor = undefined;
|
||||||
@observable fontColor = undefined;
|
fontColor = undefined;
|
||||||
@observable styleName = undefined;
|
styleName = undefined;
|
||||||
|
|
||||||
@observable isBold = false;
|
isBold = false;
|
||||||
@observable isItalic = false;
|
isItalic = false;
|
||||||
@observable isUnderline = false;
|
isUnderline = false;
|
||||||
|
|
||||||
@observable hAlignStr = 'left';
|
hAlignStr = 'left';
|
||||||
@observable vAlignStr = 'bottom';
|
vAlignStr = 'bottom';
|
||||||
@observable isWrapText;
|
isWrapText;
|
||||||
|
|
||||||
@observable orientationStr = 'horizontal';
|
orientationStr = 'horizontal';
|
||||||
|
|
||||||
@action initCellSettings(cellInfo) {
|
initCellSettings(cellInfo) {
|
||||||
|
|
||||||
let xfs = cellInfo.asc_getXfs();
|
let xfs = cellInfo.asc_getXfs();
|
||||||
|
|
||||||
this.initFontSettings(xfs);
|
this.initFontSettings(xfs);
|
||||||
|
|
||||||
let color = xfs.asc_getFillColor();
|
let color = xfs.asc_getFillColor();
|
||||||
// console.log(color);
|
// console.log(color);
|
||||||
|
|
||||||
let clr = color.get_auto() ? 'transparent' : this.resetColor(color);
|
const clr = color.get_auto() ? 'transparent' : this.resetColor(color);
|
||||||
|
|
||||||
this.fillColor = clr;
|
this.fillColor = clr;
|
||||||
this.styleName = cellInfo.asc_getStyleName();
|
this.styleName = cellInfo.asc_getStyleName();
|
||||||
|
@ -51,7 +82,7 @@ export class storeCellSettings {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@action initTextFormat(xfs) {
|
initTextFormat(xfs) {
|
||||||
let hAlign = xfs.asc_getHorAlign();
|
let hAlign = xfs.asc_getHorAlign();
|
||||||
let vAlign = xfs.asc_getVertAlign();
|
let vAlign = xfs.asc_getVertAlign();
|
||||||
let isWrapText = xfs.asc_getWrapText();
|
let isWrapText = xfs.asc_getWrapText();
|
||||||
|
@ -73,10 +104,8 @@ export class storeCellSettings {
|
||||||
this.isWrapText = isWrapText;
|
this.isWrapText = isWrapText;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action initTextOrientation(xfs) {
|
initTextOrientation(xfs) {
|
||||||
let textAngle = xfs.asc_getAngle();
|
switch( xfs.asc_getAngle() ) {
|
||||||
|
|
||||||
switch(textAngle) {
|
|
||||||
case 45: this.orientationStr = 'anglecount'; break;
|
case 45: this.orientationStr = 'anglecount'; break;
|
||||||
case -45: this.orientationStr = 'angleclock'; break;
|
case -45: this.orientationStr = 'angleclock'; break;
|
||||||
case 255: this.orientationStr = 'vertical'; break;
|
case 255: this.orientationStr = 'vertical'; break;
|
||||||
|
@ -86,8 +115,7 @@ export class storeCellSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action initFontSettings(xfs) {
|
initFontSettings(xfs) {
|
||||||
|
|
||||||
this.fontInfo.name = xfs.asc_getFontName();
|
this.fontInfo.name = xfs.asc_getFontName();
|
||||||
this.fontInfo.size = xfs.asc_getFontSize();
|
this.fontInfo.size = xfs.asc_getFontSize();
|
||||||
|
|
||||||
|
@ -100,7 +128,7 @@ export class storeCellSettings {
|
||||||
this.isUnderline = xfs.asc_getFontUnderline();
|
this.isUnderline = xfs.asc_getFontUnderline();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action initEditorFonts(fonts, select) {
|
initEditorFonts(fonts, select) {
|
||||||
let array = [];
|
let array = [];
|
||||||
|
|
||||||
for (let font of fonts) {
|
for (let font of fonts) {
|
||||||
|
@ -117,31 +145,31 @@ export class storeCellSettings {
|
||||||
this.fontsArray = array;
|
this.fontsArray = array;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action initCellStyles(styles) {
|
initCellStyles(styles) {
|
||||||
this.cellStyles = styles;
|
this.cellStyles = styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action initFontInfo(fontObj) {
|
initFontInfo(fontObj) {
|
||||||
this.fontInfo = fontObj;
|
this.fontInfo = fontObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeFontColor(color) {
|
changeFontColor(color) {
|
||||||
this.fontColor = color;
|
this.fontColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeFillColor(color) {
|
changeFillColor(color) {
|
||||||
this.fillColor = color;
|
this.fillColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeBorderColor(color) {
|
changeBorderColor(color) {
|
||||||
this.borderInfo.color = color;
|
this.borderInfo.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeBorderSize(size) {
|
changeBorderSize(size) {
|
||||||
this.borderInfo.width = size;
|
this.borderInfo.width = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeBorderStyle(type) {
|
changeBorderStyle(type) {
|
||||||
this.borderStyle = type;
|
this.borderStyle = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue