[DE mobile] Corrected stores according to mobx v. 6
This commit is contained in:
parent
32f5bd693e
commit
2ab1d32e97
|
@ -3,20 +3,20 @@ import {makeObservable, action, observable} from 'mobx';
|
||||||
export class storeApplicationSettings {
|
export class storeApplicationSettings {
|
||||||
constructor() {
|
constructor() {
|
||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
unitMeasurement: observable
|
unitMeasurement: observable,
|
||||||
, isSpellChecking: observable
|
isSpellChecking: observable,
|
||||||
, isNonprintingCharacters: observable
|
isNonprintingCharacters: observable,
|
||||||
, isHiddenTableBorders: observable
|
isHiddenTableBorders: observable,
|
||||||
, isComments: observable
|
isComments: observable,
|
||||||
, isResolvedComments: observable
|
isResolvedComments: observable,
|
||||||
, macrosMode: observable
|
macrosMode: observable,
|
||||||
, changeSpellCheck: action
|
changeSpellCheck: action,
|
||||||
, changeUnitMeasurement: action
|
changeUnitMeasurement: action,
|
||||||
, changeNoCharacters: action
|
changeNoCharacters: action,
|
||||||
, changeShowTableEmptyLine: action
|
changeShowTableEmptyLine: action,
|
||||||
, changeDisplayComments: action
|
changeDisplayComments: action,
|
||||||
, changeDisplayResolved: action
|
changeDisplayResolved: action,
|
||||||
, changeMacrosSettings: action
|
changeMacrosSettings: action
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storeChartSettings {
|
export class storeChartSettings {
|
||||||
|
constructor() {
|
||||||
|
makeObservable(this, {
|
||||||
|
chartStyles: observable,
|
||||||
|
fillColor: observable,
|
||||||
|
borderColor: observable,
|
||||||
|
clearChartStyles: action,
|
||||||
|
updateChartStyles: action,
|
||||||
|
styles: computed,
|
||||||
|
types: computed,
|
||||||
|
setFillColor: action,
|
||||||
|
getFillColor: action,
|
||||||
|
setBorderColor: action,
|
||||||
|
initBorderColor: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
wrapTypesTransform () {
|
wrapTypesTransform () {
|
||||||
const map = [
|
const map = [
|
||||||
{ ui:'inline', sdk: Asc.c_oAscWrapStyle2.Inline },
|
{ ui:'inline', sdk: Asc.c_oAscWrapStyle2.Inline },
|
||||||
|
@ -56,14 +72,18 @@ export class storeChartSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// style
|
// style
|
||||||
@observable chartStyles = null;
|
|
||||||
@action clearChartStyles () {
|
chartStyles = null;
|
||||||
|
|
||||||
|
clearChartStyles () {
|
||||||
this.chartStyles = null;
|
this.chartStyles = null;
|
||||||
}
|
}
|
||||||
@action updateChartStyles (styles) {
|
|
||||||
|
updateChartStyles (styles) {
|
||||||
this.chartStyles = styles;
|
this.chartStyles = styles;
|
||||||
}
|
}
|
||||||
@computed get styles () {
|
|
||||||
|
get styles () {
|
||||||
if (!this.chartStyles) return null;
|
if (!this.chartStyles) return null;
|
||||||
const widthContainer = document.querySelector(".page-content").clientWidth;
|
const widthContainer = document.querySelector(".page-content").clientWidth;
|
||||||
const columns = parseInt(widthContainer / 70); // magic
|
const columns = parseInt(widthContainer / 70); // magic
|
||||||
|
@ -78,7 +98,8 @@ export class storeChartSettings {
|
||||||
});
|
});
|
||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
@computed get types () {
|
|
||||||
|
get types () {
|
||||||
const types = [
|
const types = [
|
||||||
{ type: Asc.c_oAscChartTypeSettings.barNormal, thumb: 'chart-03.png'},
|
{ type: Asc.c_oAscChartTypeSettings.barNormal, thumb: 'chart-03.png'},
|
||||||
{ type: Asc.c_oAscChartTypeSettings.barStacked, thumb: 'chart-02.png'},
|
{ type: Asc.c_oAscChartTypeSettings.barStacked, thumb: 'chart-02.png'},
|
||||||
|
@ -120,10 +141,13 @@ export class storeChartSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill Color
|
// Fill Color
|
||||||
@observable fillColor = undefined;
|
|
||||||
|
fillColor = undefined;
|
||||||
|
|
||||||
setFillColor (color) {
|
setFillColor (color) {
|
||||||
this.fillColor = color;
|
this.fillColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFillColor (shapeProperties) {
|
getFillColor (shapeProperties) {
|
||||||
let fill = shapeProperties.get_fill();
|
let fill = shapeProperties.get_fill();
|
||||||
const fillType = fill.get_type();
|
const fillType = fill.get_type();
|
||||||
|
@ -144,10 +168,13 @@ export class storeChartSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Border size and border color
|
// Border size and border color
|
||||||
@observable borderColor;
|
|
||||||
|
borderColor;
|
||||||
|
|
||||||
setBorderColor (color) {
|
setBorderColor (color) {
|
||||||
this.borderColor = color;
|
this.borderColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
initBorderColor (stroke) {
|
initBorderColor (stroke) {
|
||||||
let color = 'transparent';
|
let color = 'transparent';
|
||||||
if (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
|
if (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
|
||||||
|
@ -164,6 +191,7 @@ export class storeChartSettings {
|
||||||
this.borderColor = color;
|
this.borderColor = color;
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
borderSizeTransform () {
|
borderSizeTransform () {
|
||||||
const _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
|
const _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,33 @@
|
||||||
import { action, observable } from "mobx";
|
import {action, observable, makeObservable} from "mobx";
|
||||||
|
|
||||||
export class storeDocumentInfo {
|
export class storeDocumentInfo {
|
||||||
@observable infoObj = {
|
constructor() {
|
||||||
|
makeObservable(this, {
|
||||||
|
infoObj: observable,
|
||||||
|
isLoaded: observable,
|
||||||
|
dataDoc: observable,
|
||||||
|
switchIsLoaded: action,
|
||||||
|
changeCount: action,
|
||||||
|
setDataDoc: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
infoObj = {
|
||||||
pageCount: 0,
|
pageCount: 0,
|
||||||
wordsCount: 0,
|
wordsCount: 0,
|
||||||
paragraphCount: 0,
|
paragraphCount: 0,
|
||||||
symbolsCount: 0,
|
symbolsCount: 0,
|
||||||
symbolsWSCount: 0,
|
symbolsWSCount: 0,
|
||||||
};
|
};
|
||||||
@observable isLoaded = false;
|
|
||||||
@observable dataDoc;
|
|
||||||
|
|
||||||
@action switchIsLoaded(value) {
|
isLoaded = false;
|
||||||
|
dataDoc;
|
||||||
|
|
||||||
|
switchIsLoaded(value) {
|
||||||
this.isLoaded = value;
|
this.isLoaded = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeCount(obj) {
|
changeCount(obj) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
if (obj.get_PageCount() > -1)
|
if (obj.get_PageCount() > -1)
|
||||||
this.infoObj.pageCount = obj.get_PageCount();
|
this.infoObj.pageCount = obj.get_PageCount();
|
||||||
|
@ -30,7 +42,7 @@ export class storeDocumentInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action setDataDoc(obj) {
|
setDataDoc(obj) {
|
||||||
this.dataDoc = obj;
|
this.dataDoc = obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,15 +1,31 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storeDocumentSettings {
|
export class storeDocumentSettings {
|
||||||
@observable isPortrait = true;
|
constructor() {
|
||||||
@action resetPortrait (isPortrait) {
|
makeObservable(this, {
|
||||||
|
isPortrait: observable,
|
||||||
|
widthDocument: observable,
|
||||||
|
heightDocument: observable,
|
||||||
|
allSchemes: observable,
|
||||||
|
resetPortrait: action,
|
||||||
|
changeDocSize: action,
|
||||||
|
pageSizesIndex: computed,
|
||||||
|
addSchemes: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
isPortrait = true;
|
||||||
|
|
||||||
|
resetPortrait (isPortrait) {
|
||||||
this.isPortrait = isPortrait === true;
|
this.isPortrait = isPortrait === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Document Formats
|
//Document Formats
|
||||||
@observable widthDocument;
|
|
||||||
@observable heightDocument;
|
widthDocument;
|
||||||
@action changeDocSize (width, height) {
|
heightDocument;
|
||||||
|
|
||||||
|
changeDocSize (width, height) {
|
||||||
let w = width;
|
let w = width;
|
||||||
let h = height;
|
let h = height;
|
||||||
if (!this.isPortrait) {
|
if (!this.isPortrait) {
|
||||||
|
@ -20,6 +36,7 @@ export class storeDocumentSettings {
|
||||||
this.widthDocument = w;
|
this.widthDocument = w;
|
||||||
this.heightDocument = h;
|
this.heightDocument = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPageSizesList () {
|
getPageSizesList () {
|
||||||
const txtCm = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm);
|
const txtCm = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm);
|
||||||
const pageSizes = [
|
const pageSizes = [
|
||||||
|
@ -43,7 +60,8 @@ export class storeDocumentSettings {
|
||||||
];
|
];
|
||||||
return pageSizes;
|
return pageSizes;
|
||||||
}
|
}
|
||||||
@computed get pageSizesIndex () {
|
|
||||||
|
get pageSizesIndex () {
|
||||||
let w = this.widthDocument;
|
let w = this.widthDocument;
|
||||||
let h = this.heightDocument;
|
let h = this.heightDocument;
|
||||||
let ind = -1;
|
let ind = -1;
|
||||||
|
@ -61,9 +79,9 @@ export class storeDocumentSettings {
|
||||||
|
|
||||||
// Color Schemes
|
// Color Schemes
|
||||||
|
|
||||||
@observable allSchemes;
|
allSchemes;
|
||||||
|
|
||||||
@action addSchemes(arr) {
|
addSchemes(arr) {
|
||||||
this.allSchemes = arr;
|
this.allSchemes = arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,32 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storeFocusObjects {
|
export class storeFocusObjects {
|
||||||
@observable _focusObjects = [];
|
constructor() {
|
||||||
@observable _headerType = 1;
|
makeObservable(this, {
|
||||||
|
_focusObjects: observable,
|
||||||
|
_headerType: observable,
|
||||||
|
resetFocusObjects: action,
|
||||||
|
settings: computed,
|
||||||
|
headerType: computed,
|
||||||
|
headerObject: computed,
|
||||||
|
paragraphObject: computed,
|
||||||
|
shapeObject: computed,
|
||||||
|
imageObject: computed,
|
||||||
|
tableObject: computed,
|
||||||
|
isTableInStack: computed,
|
||||||
|
chartObject: computed,
|
||||||
|
linkObject: computed
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@action resetFocusObjects (objects) {
|
_focusObjects = [];
|
||||||
|
_headerType = 1;
|
||||||
|
|
||||||
|
resetFocusObjects (objects) {
|
||||||
this._focusObjects = objects;
|
this._focusObjects = objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get settings() {
|
get settings() {
|
||||||
const _settings = [];
|
const _settings = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
let type = object.get_ObjectType();
|
let type = object.get_ObjectType();
|
||||||
|
@ -34,7 +52,8 @@ export class storeFocusObjects {
|
||||||
}
|
}
|
||||||
return _settings.filter((value, index, self) => self.indexOf(value) === index);
|
return _settings.filter((value, index, self) => self.indexOf(value) === index);
|
||||||
}
|
}
|
||||||
@computed get headerType() {
|
|
||||||
|
get headerType() {
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
const type = object.get_ObjectType();
|
const type = object.get_ObjectType();
|
||||||
if (Asc.c_oAscTypeSelectElement.Header === type) {
|
if (Asc.c_oAscTypeSelectElement.Header === type) {
|
||||||
|
@ -43,7 +62,8 @@ export class storeFocusObjects {
|
||||||
}
|
}
|
||||||
return this._headerType;
|
return this._headerType;
|
||||||
}
|
}
|
||||||
@computed get headerObject() {
|
|
||||||
|
get headerObject() {
|
||||||
const headers = [];
|
const headers = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Header) {
|
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Header) {
|
||||||
|
@ -57,7 +77,8 @@ export class storeFocusObjects {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@computed get paragraphObject() {
|
|
||||||
|
get paragraphObject() {
|
||||||
const paragraphs = [];
|
const paragraphs = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectType() === Asc.c_oAscTypeSelectElement.Paragraph) {
|
if (object.get_ObjectType() === Asc.c_oAscTypeSelectElement.Paragraph) {
|
||||||
|
@ -71,7 +92,8 @@ export class storeFocusObjects {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@computed get shapeObject() {
|
|
||||||
|
get shapeObject() {
|
||||||
const shapes = [];
|
const shapes = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectType() === Asc.c_oAscTypeSelectElement.Image) {
|
if (object.get_ObjectType() === Asc.c_oAscTypeSelectElement.Image) {
|
||||||
|
@ -87,7 +109,8 @@ export class storeFocusObjects {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@computed get imageObject() {
|
|
||||||
|
get imageObject() {
|
||||||
const images = [];
|
const images = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Image) {
|
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Image) {
|
||||||
|
@ -104,7 +127,8 @@ export class storeFocusObjects {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@computed get tableObject() {
|
|
||||||
|
get tableObject() {
|
||||||
const tables = [];
|
const tables = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Table) {
|
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Table) {
|
||||||
|
@ -118,7 +142,8 @@ export class storeFocusObjects {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@computed get isTableInStack() {
|
|
||||||
|
get isTableInStack() {
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Table) {
|
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Table) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -126,7 +151,8 @@ export class storeFocusObjects {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@computed get chartObject() {
|
|
||||||
|
get chartObject() {
|
||||||
const charts = [];
|
const charts = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectValue() && object.get_ObjectValue().get_ChartProperties()) {
|
if (object.get_ObjectValue() && object.get_ObjectValue().get_ChartProperties()) {
|
||||||
|
@ -140,7 +166,8 @@ export class storeFocusObjects {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@computed get linkObject() {
|
|
||||||
|
get linkObject() {
|
||||||
const links = [];
|
const links = [];
|
||||||
for (let object of this._focusObjects) {
|
for (let object of this._focusObjects) {
|
||||||
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Hyperlink) {
|
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Hyperlink) {
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
import {action, observable} from 'mobx';
|
import {action, observable, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storePalette {
|
export class storePalette {
|
||||||
@observable customColors = [];
|
constructor() {
|
||||||
|
makeObservable(this, {
|
||||||
|
customColors: observable,
|
||||||
|
changeCustomColors: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@action changeCustomColors (colors) {
|
customColors = [];
|
||||||
|
|
||||||
|
changeCustomColors (colors) {
|
||||||
this.customColors = colors;
|
this.customColors = colors;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +1,33 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storeParagraphSettings {
|
export class storeParagraphSettings {
|
||||||
@observable styles = [];
|
constructor() {
|
||||||
@observable styleThumbSize = null;
|
makeObservable(this, {
|
||||||
@observable styleName = undefined;
|
styles: observable,
|
||||||
|
styleThumbSize: observable,
|
||||||
|
styleName: observable,
|
||||||
|
backColor: observable,
|
||||||
|
initEditorStyles: action,
|
||||||
|
paragraphStyles: computed,
|
||||||
|
changeParaStyleName: action,
|
||||||
|
setBackColor: action,
|
||||||
|
getBackgroundColor: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@action initEditorStyles (styles) {
|
styles = [];
|
||||||
|
styleThumbSize = null;
|
||||||
|
styleName = undefined;
|
||||||
|
|
||||||
|
initEditorStyles (styles) {
|
||||||
this.styles = styles.get_MergedStyles();
|
this.styles = styles.get_MergedStyles();
|
||||||
this.styleThumbSize = {
|
this.styleThumbSize = {
|
||||||
width : styles.STYLE_THUMBNAIL_WIDTH,
|
width : styles.STYLE_THUMBNAIL_WIDTH,
|
||||||
height : styles.STYLE_THUMBNAIL_HEIGHT
|
height : styles.STYLE_THUMBNAIL_HEIGHT
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@computed get paragraphStyles () {
|
|
||||||
|
get paragraphStyles () {
|
||||||
let _styles = [];
|
let _styles = [];
|
||||||
for (let style of this.styles) {
|
for (let style of this.styles) {
|
||||||
_styles.push({
|
_styles.push({
|
||||||
|
@ -22,14 +37,17 @@ export class storeParagraphSettings {
|
||||||
}
|
}
|
||||||
return _styles;
|
return _styles;
|
||||||
}
|
}
|
||||||
@action changeParaStyleName (name) {
|
|
||||||
|
changeParaStyleName (name) {
|
||||||
this.styleName = name;
|
this.styleName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observable backColor = undefined;
|
backColor = undefined;
|
||||||
|
|
||||||
setBackColor (color) {
|
setBackColor (color) {
|
||||||
this.backColor = color;
|
this.backColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBackgroundColor (paragraphObject) {
|
getBackgroundColor (paragraphObject) {
|
||||||
const shade = paragraphObject.get_Shade();
|
const shade = paragraphObject.get_Shade();
|
||||||
let backColor = 'transparent';
|
let backColor = 'transparent';
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storeReview {
|
export class storeReview {
|
||||||
@observable displayMode = 'markup';
|
constructor() {
|
||||||
|
makeObservable(this, {
|
||||||
|
displayMode: observable,
|
||||||
|
dataChanges: observable,
|
||||||
|
changeDisplayMode: action,
|
||||||
|
changeArrReview: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@action changeDisplayMode (mode) {
|
displayMode = 'markup';
|
||||||
|
|
||||||
|
changeDisplayMode (mode) {
|
||||||
this.displayMode = mode;
|
this.displayMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observable dataChanges = [];
|
dataChanges = [];
|
||||||
|
|
||||||
@action changeArrReview (data) {
|
changeArrReview (data) {
|
||||||
this.dataChanges = data && data.length > 0 ? data : [];
|
this.dataChanges = data && data.length > 0 ? data : [];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,17 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storeShapeSettings {
|
export class storeShapeSettings {
|
||||||
|
constructor() {
|
||||||
|
makeObservable(this, {
|
||||||
|
fillColor: observable,
|
||||||
|
borderColorView: observable,
|
||||||
|
setFillColor: action,
|
||||||
|
getFillColor: action,
|
||||||
|
setBorderColor: action,
|
||||||
|
initBorderColorView: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getStyleGroups () {
|
getStyleGroups () {
|
||||||
const styles = [
|
const styles = [
|
||||||
{
|
{
|
||||||
|
@ -136,6 +147,7 @@ export class storeShapeSettings {
|
||||||
}
|
}
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapTypesTransform () {
|
wrapTypesTransform () {
|
||||||
const map = [
|
const map = [
|
||||||
{ ui:'inline', sdk: Asc.c_oAscWrapStyle2.Inline },
|
{ ui:'inline', sdk: Asc.c_oAscWrapStyle2.Inline },
|
||||||
|
@ -191,10 +203,13 @@ export class storeShapeSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill Color
|
// Fill Color
|
||||||
@observable fillColor = undefined;
|
|
||||||
|
fillColor = undefined;
|
||||||
|
|
||||||
setFillColor (color) {
|
setFillColor (color) {
|
||||||
this.fillColor = color;
|
this.fillColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFillColor (shapeObject) {
|
getFillColor (shapeObject) {
|
||||||
let fill = shapeObject.get_ShapeProperties().get_fill();
|
let fill = shapeObject.get_ShapeProperties().get_fill();
|
||||||
const fillType = fill.get_type();
|
const fillType = fill.get_type();
|
||||||
|
@ -215,10 +230,13 @@ export class storeShapeSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Border size and color
|
// Border size and color
|
||||||
@observable borderColorView;
|
|
||||||
|
borderColorView;
|
||||||
|
|
||||||
setBorderColor (color) {
|
setBorderColor (color) {
|
||||||
this.borderColorView = color;
|
this.borderColorView = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
initBorderColorView (shapeObject) {
|
initBorderColorView (shapeObject) {
|
||||||
const stroke = shapeObject.get_ShapeProperties().get_stroke();
|
const stroke = shapeObject.get_ShapeProperties().get_stroke();
|
||||||
let color = 'transparent';
|
let color = 'transparent';
|
||||||
|
@ -236,6 +254,7 @@ export class storeShapeSettings {
|
||||||
this.borderColorView = color;
|
this.borderColorView = color;
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
borderSizeTransform () {
|
borderSizeTransform () {
|
||||||
const _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
|
const _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,25 @@ import {f7} from 'framework7-react';
|
||||||
|
|
||||||
export class storeTableSettings {
|
export class storeTableSettings {
|
||||||
constructor() {
|
constructor() {
|
||||||
makeObservable(this)
|
makeObservable(this, {
|
||||||
|
_templates: observable,
|
||||||
|
cellBorders: observable,
|
||||||
|
cellBorderWidth: observable,
|
||||||
|
cellBorderColor: observable,
|
||||||
|
initTableTemplates: action,
|
||||||
|
styles: computed,
|
||||||
|
updateCellBorderWidth: action,
|
||||||
|
updateCellBorderColor: action,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@observable _templates = [];
|
_templates = [];
|
||||||
@action initTableTemplates (templates) {
|
|
||||||
|
initTableTemplates (templates) {
|
||||||
this._templates = templates;
|
this._templates = templates;
|
||||||
}
|
}
|
||||||
@computed get styles () {
|
|
||||||
|
get styles () {
|
||||||
let styles = [];
|
let styles = [];
|
||||||
for (let template of this._templates) {
|
for (let template of this._templates) {
|
||||||
styles.push({
|
styles.push({
|
||||||
|
@ -69,9 +80,10 @@ export class storeTableSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Border style
|
// Border style
|
||||||
@observable cellBorders;
|
|
||||||
@observable cellBorderWidth = 0.5;
|
cellBorders;
|
||||||
@observable cellBorderColor = '000000';
|
cellBorderWidth = 0.5;
|
||||||
|
cellBorderColor = '000000';
|
||||||
|
|
||||||
borderSizeTransform () {
|
borderSizeTransform () {
|
||||||
const _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
|
const _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
|
||||||
|
|
|
@ -1,25 +1,64 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
|
|
||||||
export class storeTextSettings {
|
export class storeTextSettings {
|
||||||
@observable fontsArray = [];
|
constructor() {
|
||||||
@observable fontName = '';
|
makeObservable(this, {
|
||||||
@observable fontSize = undefined;
|
fontsArray: observable,
|
||||||
@observable isBold = false;
|
fontName: observable,
|
||||||
@observable isItalic = false;
|
fontSize: observable,
|
||||||
@observable isUnderline = false;
|
isBold: observable,
|
||||||
@observable isStrikethrough = false;
|
isItalic: observable,
|
||||||
@observable typeBaseline = undefined;
|
isUnderline: observable,
|
||||||
@observable listType = undefined;
|
isStrikethrough: observable,
|
||||||
@observable typeBullets = undefined;
|
typeBaseline: observable,
|
||||||
@observable typeNumbers = undefined;
|
listType: observable,
|
||||||
@observable paragraphAlign = undefined;
|
typeBullets: observable,
|
||||||
@observable textColor = undefined;
|
typeNumbers: observable,
|
||||||
@observable customTextColors = [];
|
paragraphAlign: observable,
|
||||||
@observable lineSpacing = undefined;
|
textColor: observable,
|
||||||
@observable backgroundColor = undefined;
|
customTextColors: observable,
|
||||||
|
lineSpacing: observable,
|
||||||
|
backgroundColor: observable,
|
||||||
|
initEditorFonts: action,
|
||||||
|
resetFontName: action,
|
||||||
|
resetFontSize: action,
|
||||||
|
resetIsBold: action,
|
||||||
|
resetIsItalic: action,
|
||||||
|
resetIsUnderline: action,
|
||||||
|
resetIsStrikeout: action,
|
||||||
|
resetTypeBaseline: action,
|
||||||
|
isSuperscript: computed,
|
||||||
|
isSubscript: computed,
|
||||||
|
resetListType: action,
|
||||||
|
resetBullets: action,
|
||||||
|
resetNumbers: action,
|
||||||
|
resetParagraphAlign: action,
|
||||||
|
resetTextColor: action,
|
||||||
|
changeCustomTextColors: action,
|
||||||
|
resetLineSpacing: action,
|
||||||
|
resetBackgroundColor: action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fontsArray = [];
|
||||||
|
fontName = '';
|
||||||
|
fontSize = undefined;
|
||||||
|
isBold = false;
|
||||||
|
isItalic = false;
|
||||||
|
isUnderline = false;
|
||||||
|
isStrikethrough = false;
|
||||||
|
typeBaseline = undefined;
|
||||||
|
listType = undefined;
|
||||||
|
typeBullets = undefined;
|
||||||
|
typeNumbers = undefined;
|
||||||
|
paragraphAlign = undefined;
|
||||||
|
textColor = undefined;
|
||||||
|
customTextColors = [];
|
||||||
|
lineSpacing = undefined;
|
||||||
|
backgroundColor = undefined;
|
||||||
|
|
||||||
|
|
||||||
@action initEditorFonts (fonts, select) {
|
initEditorFonts (fonts, select) {
|
||||||
let array = [];
|
let array = [];
|
||||||
for (let font of fonts) {
|
for (let font of fonts) {
|
||||||
let fontId = font.asc_getFontId();
|
let fontId = font.asc_getFontId();
|
||||||
|
@ -33,49 +72,49 @@ export class storeTextSettings {
|
||||||
}
|
}
|
||||||
this.fontsArray = array;
|
this.fontsArray = array;
|
||||||
}
|
}
|
||||||
@action resetFontName (font) {
|
resetFontName (font) {
|
||||||
let name = (typeof font.get_Name) === "function" ? font.get_Name() : font.asc_getName();
|
let name = (typeof font.get_Name) === "function" ? font.get_Name() : font.asc_getName();
|
||||||
this.fontName = name;
|
this.fontName = name;
|
||||||
}
|
}
|
||||||
@action resetFontSize (size) {
|
resetFontSize (size) {
|
||||||
this.fontSize = size;
|
this.fontSize = size;
|
||||||
}
|
}
|
||||||
@action resetIsBold (isBold) {
|
resetIsBold (isBold) {
|
||||||
this.isBold = isBold;
|
this.isBold = isBold;
|
||||||
}
|
}
|
||||||
@action resetIsItalic (isItalic) {
|
resetIsItalic (isItalic) {
|
||||||
this.isItalic = isItalic;
|
this.isItalic = isItalic;
|
||||||
}
|
}
|
||||||
@action resetIsUnderline (isUnderline) {
|
resetIsUnderline (isUnderline) {
|
||||||
this.isUnderline = isUnderline;
|
this.isUnderline = isUnderline;
|
||||||
}
|
}
|
||||||
@action resetIsStrikeout (isStrikethrough) {
|
resetIsStrikeout (isStrikethrough) {
|
||||||
this.isStrikethrough = isStrikethrough;
|
this.isStrikethrough = isStrikethrough;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vertical align
|
// vertical align
|
||||||
@action resetTypeBaseline (typeBaseline) {
|
resetTypeBaseline (typeBaseline) {
|
||||||
this.typeBaseline = typeBaseline;
|
this.typeBaseline = typeBaseline;
|
||||||
}
|
}
|
||||||
@computed get isSuperscript() {
|
get isSuperscript() {
|
||||||
return (this.typeBaseline === 1);
|
return (this.typeBaseline === 1);
|
||||||
}
|
}
|
||||||
@computed get isSubscript() {
|
get isSubscript() {
|
||||||
return (this.typeBaseline === 2);
|
return (this.typeBaseline === 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bullets
|
// bullets
|
||||||
@action resetListType (type) {
|
resetListType (type) {
|
||||||
this.listType = type;
|
this.listType = type;
|
||||||
}
|
}
|
||||||
@action resetBullets (type) {
|
resetBullets (type) {
|
||||||
this.typeBullets = type;
|
this.typeBullets = type;
|
||||||
}
|
}
|
||||||
@action resetNumbers (type) {
|
resetNumbers (type) {
|
||||||
this.typeNumbers = type;
|
this.typeNumbers = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action resetParagraphAlign (align) {
|
resetParagraphAlign (align) {
|
||||||
let value;
|
let value;
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -94,7 +133,7 @@ export class storeTextSettings {
|
||||||
this.paragraphAlign = value;
|
this.paragraphAlign = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action resetTextColor (color) {
|
resetTextColor (color) {
|
||||||
let value;
|
let value;
|
||||||
if (color) {
|
if (color) {
|
||||||
if (color.get_auto()) {
|
if (color.get_auto()) {
|
||||||
|
@ -113,16 +152,16 @@ export class storeTextSettings {
|
||||||
this.textColor = value;
|
this.textColor = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeCustomTextColors (colors) {
|
changeCustomTextColors (colors) {
|
||||||
this.customTextColors = colors;
|
this.customTextColors = colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action resetLineSpacing (vc) {
|
resetLineSpacing (vc) {
|
||||||
let line = (vc.get_Line() === null || vc.get_LineRule() === null || vc.get_LineRule() != 1) ? -1 : vc.get_Line();
|
let line = (vc.get_Line() === null || vc.get_LineRule() === null || vc.get_LineRule() != 1) ? -1 : vc.get_Line();
|
||||||
this.lineSpacing = line;
|
this.lineSpacing = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action resetBackgroundColor (color) {
|
resetBackgroundColor (color) {
|
||||||
let value;
|
let value;
|
||||||
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
|
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
|
||||||
value = {
|
value = {
|
||||||
|
|
Loading…
Reference in a new issue