[DE PE mobile] Bug 50044

This commit is contained in:
JuliaSvinareva 2021-05-11 18:52:36 +03:00
parent 4ccd255fe5
commit cc7d9acfaa
6 changed files with 120 additions and 39 deletions

View file

@ -158,7 +158,8 @@ const PageWrap = props => {
// Style
const StyleTemplates = inject("storeFocusObjects")(observer(({templates, onStyleClick, storeFocusObjects}) => {
const styleId = storeFocusObjects.tableObject.get_TableStyle();
const tableObject = storeFocusObjects.tableObject;
const styleId = tableObject && tableObject.get_TableStyle();
const [stateId, setId] = useState(styleId);
const widthContainer = document.querySelector(".page-content").clientWidth;

View file

@ -128,11 +128,8 @@ const PageStyle = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeChartSettings = props.storeChartSettings;
// const chartProperties = props.storeFocusObjects.chartObject;
const chartProperties = props.storeFocusObjects.chartObject ? props.storeFocusObjects.chartObject.get_ChartProperties() : null;
// console.log(chartProperties);
const types = storeChartSettings.types;
// const curType = chartProperties.getType();
const curType = chartProperties ? chartProperties.getType() : null;
const styles = storeChartSettings.styles;
const shapeObject = props.storeFocusObjects.shapeObject;
@ -140,7 +137,6 @@ const PageStyle = props => {
let borderSize, borderType, borderColor;
if(shapeObject) {
// const shapeStroke = shapeObject.get_stroke();
const shapeStroke = shapeObject.get_stroke();
borderSize = shapeStroke.get_width() * 72.0 / 25.4;
borderType = shapeStroke.get_type();

View file

@ -1,6 +1,6 @@
import React, {useState, useEffect} from 'react';
import {observer, inject} from "mobx-react";
import {List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button} from 'framework7-react';
import {f7, List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../../../common/mobile/utils/device";
@ -9,6 +9,12 @@ const PageTypeLink = props => {
const _t = t('View.Edit', {returnObjects: true});
const [typeLink, setTypeLink] = useState(props.curType);
const settings = props.storeFocusObjects.settings;
if (settings.indexOf('hyperlink') === -1) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textLinkType} backLink={_t.textBack}/>
@ -48,6 +54,12 @@ const PageLinkTo = props => {
props.changeTo(4, value);
};
const settings = props.storeFocusObjects.settings;
if (settings.indexOf('hyperlink') === -1) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textLinkTo} backLink={_t.textBack}/>
@ -178,6 +190,9 @@ const PageLink = props => {
)
};
const _PageLinkTo = inject("storeFocusObjects")(observer(PageLinkTo));
const _PageTypeLink = inject("storeFocusObjects")(observer(PageTypeLink));
export {PageLink as EditLink,
PageLinkTo,
PageTypeLink}
_PageLinkTo as PageLinkTo,
_PageTypeLink as PageTypeLink}

View file

@ -87,26 +87,27 @@ const PageStyle = props => {
const storeFocusObjects = props.storeFocusObjects;
const storeShapeSettings = props.storeShapeSettings;
const shapeObject = storeFocusObjects.shapeObject;
let borderSize, borderType, transparent;
if (shapeObject) {
const stroke = shapeObject.get_stroke();
borderSize = stroke.get_width() * 72.0 / 25.4;
borderType = stroke.get_type();
transparent = shapeObject.get_fill().asc_getTransparent();
}
// Init border size
const borderSizeTransform = storeShapeSettings.borderSizeTransform();
const borderSize = stroke.get_width() * 72.0 / 25.4;
const borderType = stroke.get_type();
const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize);
const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize);
const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.indexSizeByValue(borderSize);
const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.sizeByValue(borderSize);
const [stateBorderSize, setBorderSize] = useState(displayBorderSize);
const [stateTextBorderSize, setTextBorderSize] = useState(displayTextBorderSize);
// Init border color
const borderColor = !storeShapeSettings.borderColorView ? storeShapeSettings.initBorderColorView(shapeObject) : storeShapeSettings.borderColorView;
const displayBorderColor = borderColor !== 'transparent' ? `#${(typeof borderColor === "object" ? borderColor.color : borderColor)}` : borderColor;
// Init opacity
const transparent = shapeObject.get_fill().asc_getTransparent();
const opacity = transparent !== null && transparent !== undefined ? transparent / 2.55 : 100;
const [stateOpacity, setOpacity] = useState(Math.round(opacity));
@ -201,16 +202,21 @@ const PageStyleNoFill = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeShapeSettings = props.storeShapeSettings;
const shapeObject = props.storeFocusObjects.shapeObject;
const storeFocusObjects = props.storeFocusObjects;
const shapeObject = storeFocusObjects.shapeObject;
let borderSize, borderType;
if (shapeObject) {
const stroke = shapeObject.get_stroke();
borderSize = stroke.get_width() * 72.0 / 25.4;
borderType = stroke.get_type();
}
// Init border size
const borderSizeTransform = storeShapeSettings.borderSizeTransform();
const borderSize = stroke.get_width() * 72.0 / 25.4;
const borderType = stroke.get_type();
const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize);
const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize);
const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.indexSizeByValue(borderSize);
const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.sizeByValue(borderSize);
const [stateBorderSize, setBorderSize] = useState(displayBorderSize);
const [stateTextBorderSize, setTextBorderSize] = useState(displayTextBorderSize);
@ -219,6 +225,11 @@ const PageStyleNoFill = props => {
const borderColor = !storeShapeSettings.borderColorView ? storeShapeSettings.initBorderColorView(shapeObject) : storeShapeSettings.borderColorView;
const displayBorderColor = borderColor !== 'transparent' ? `#${(typeof borderColor === "object" ? borderColor.color : borderColor)}` : borderColor;
if ((!shapeObject || storeFocusObjects.chartObject) && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar backLink={_t.textBack} title={_t.textBorder}></Navbar>

View file

@ -1,6 +1,6 @@
import React, {Fragment, useState} from 'react';
import {observer, inject} from "mobx-react";
import {Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon, Link, Tabs, Tab} from 'framework7-react';
import {f7, Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon, Link, Tabs, Tab} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from '../../../../../common/mobile/utils/device';
import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile/lib/component/ThemeColorPalette.jsx";
@ -8,7 +8,8 @@ import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile
// Style
const StyleTemplates = inject("storeFocusObjects")(observer(({templates, onStyleClick, storeFocusObjects}) => {
const styleId = storeFocusObjects.tableObject.get_TableStyle();
const tableObject = storeFocusObjects.tableObject;
const styleId = tableObject ? tableObject.get_TableStyle() : null;
const [stateId, setId] = useState(styleId);
const widthContainer = document.querySelector(".page-content").clientWidth;
@ -23,6 +24,11 @@ const StyleTemplates = inject("storeFocusObjects")(observer(({templates, onStyle
styles[row].push(style);
});
if (!tableObject && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<div className="dataview table-styles">
{styles.map((row, rowIndex) => {
@ -47,13 +53,18 @@ const StyleTemplates = inject("storeFocusObjects")(observer(({templates, onStyle
const PageStyleOptions = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const tableLook = props.storeFocusObjects.tableObject.get_TableLook();
const isFirstRow = tableLook.get_FirstRow();
const isLastRow = tableLook.get_LastRow();
const isBandHor = tableLook.get_BandHor();
const isFirstCol = tableLook.get_FirstCol();
const isLastCol = tableLook.get_LastCol();
const isBandVer = tableLook.get_BandVer();
const tableObject = props.storeFocusObjects.tableObject;
let tableLook, isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer;
if (tableObject) {
tableLook = tableObject.get_TableLook();
isFirstRow = tableLook.get_FirstRow();
isLastRow = tableLook.get_LastRow();
isBandHor = tableLook.get_BandHor();
isFirstCol = tableLook.get_FirstCol();
isLastCol = tableLook.get_LastCol();
isBandVer = tableLook.get_BandVer();
}
return (
<Page>
@ -88,7 +99,7 @@ const PageCustomFillColor = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const tableObject = props.storeFocusObjects.tableObject;
let fillColor = props.storeTableSettings.getFillColor(tableObject);
let fillColor = tableObject && props.storeTableSettings.getFillColor(tableObject);
if (typeof fillColor === 'object') {
fillColor = fillColor.color;
@ -112,7 +123,7 @@ const TabFillColor = inject("storeFocusObjects", "storeTableSettings", "storePal
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const tableObject = props.storeFocusObjects.tableObject;
const fillColor = props.storeTableSettings.getFillColor(tableObject);
const fillColor = tableObject && props.storeTableSettings.getFillColor(tableObject);
const customColors = props.storePalette.customColors;
const changeColor = (color, effectId, effectValue) => {
@ -323,6 +334,12 @@ const PageReorder = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const tableObject = props.storeFocusObjects.tableObject;
if (!tableObject && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textReorder} backLink={_t.textBack} />
@ -348,6 +365,12 @@ const PageAlign = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const tableObject = props.storeFocusObjects.tableObject;
if (!tableObject && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textAlign} backLink={_t.textBack} />

View file

@ -193,6 +193,12 @@ const PageFonts = props => {
});
};
const paragraph = props.storeFocusObjects.paragraphObject;
if (!paragraph && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textFonts} backLink={_t.textBack} />
@ -253,6 +259,12 @@ const PageFontColor = props => {
}
};
const paragraph = props.storeFocusObjects.paragraphObject;
if (!paragraph && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textFontColors} backLink={_t.textBack} />
@ -315,6 +327,11 @@ const PageAdditionalFormatting = props => {
letterSpacing = (paragraphObj.get_TextSpacing() === null || paragraphObj.get_TextSpacing() === undefined) ? paragraphObj.get_TextSpacing() : Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_TextSpacing());
}
if (!paragraphObj && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textAdditional} backLink={_t.textBack} />
@ -366,6 +383,12 @@ const PageBullets = props => {
const storeTextSettings = props.storeTextSettings;
const typeBullets = storeTextSettings.typeBullets;
const paragraph = props.storeFocusObjects.paragraphObject;
if (!paragraph && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page className='bullets dataview'>
<Navbar title={_t.textBullets} backLink={_t.textBack} />
@ -408,6 +431,12 @@ const PageNumbers = props => {
const storeTextSettings = props.storeTextSettings;
const typeNumbers = storeTextSettings.typeNumbers;
const paragraph = props.storeFocusObjects.paragraphObject;
if (!paragraph && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page className='numbers dataview'>
<Navbar title={_t.textNumbers} backLink={_t.textBack} />
@ -435,6 +464,12 @@ const PageLineSpacing = props => {
const storeTextSettings = props.storeTextSettings;
const lineSpacing = storeTextSettings.lineSpacing;
const paragraph = props.storeFocusObjects.paragraphObject;
if (!paragraph && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
<Navbar title={_t.textLineSpacing} backLink={_t.textBack} />
@ -452,12 +487,12 @@ const PageLineSpacing = props => {
const EditTextContainer = inject("storeTextSettings", "storeFocusObjects")(observer(EditText));
const PageTextFonts = inject("storeTextSettings", "storeFocusObjects")(observer(PageFonts));
const PageTextFontColor = inject("storeTextSettings", "storePalette")(observer(PageFontColor));
const PageTextFontColor = inject("storeTextSettings", "storePalette", "storeFocusObjects")(observer(PageFontColor));
const PageTextCustomFontColor = inject("storeTextSettings", "storePalette")(observer(PageCustomFontColor));
const PageTextAddFormatting = inject("storeTextSettings", "storeFocusObjects")(observer(PageAdditionalFormatting));
const PageTextBullets = inject("storeTextSettings")(observer(PageBullets));
const PageTextNumbers = inject("storeTextSettings")(observer(PageNumbers));
const PageTextLineSpacing = inject("storeTextSettings")(observer(PageLineSpacing));
const PageTextBullets = inject("storeTextSettings", "storeFocusObjects")(observer(PageBullets));
const PageTextNumbers = inject("storeTextSettings", "storeFocusObjects")(observer(PageNumbers));
const PageTextLineSpacing = inject("storeTextSettings", "storeFocusObjects")(observer(PageLineSpacing));
export {
EditTextContainer as EditText,