[DE PE] Fix Bug 49364
This commit is contained in:
parent
5f34dcab62
commit
60350fbb13
|
@ -17,7 +17,9 @@ class EditTableController extends Component {
|
||||||
this.onRemoveColumn = this.onRemoveColumn.bind(this);
|
this.onRemoveColumn = this.onRemoveColumn.bind(this);
|
||||||
this.onRemoveRow = this.onRemoveRow.bind(this);
|
this.onRemoveRow = this.onRemoveRow.bind(this);
|
||||||
this.onWrapMoveText = this.onWrapMoveText.bind(this);
|
this.onWrapMoveText = this.onWrapMoveText.bind(this);
|
||||||
|
this.onGetTableStylesPreviews = this.onGetTableStylesPreviews.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
closeIfNeed () {
|
closeIfNeed () {
|
||||||
if (!this.props.storeFocusObjects.isTableInStack) {
|
if (!this.props.storeFocusObjects.isTableInStack) {
|
||||||
if ( Device.phone ) {
|
if ( Device.phone ) {
|
||||||
|
@ -160,6 +162,7 @@ class EditTableController extends Component {
|
||||||
onCheckTemplateChange (tableLook, type, isChecked) {
|
onCheckTemplateChange (tableLook, type, isChecked) {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const properties = new Asc.CTableProp();
|
const properties = new Asc.CTableProp();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case 0:
|
||||||
tableLook.put_FirstRow(isChecked);
|
tableLook.put_FirstRow(isChecked);
|
||||||
|
@ -184,6 +187,11 @@ class EditTableController extends Component {
|
||||||
api.tblApply(properties);
|
api.tblApply(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onGetTableStylesPreviews() {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
setTimeout(() => this.props.storeTableSettings.setStyles(api.asc_getTableStylesPreviews()),10);
|
||||||
|
}
|
||||||
|
|
||||||
onFillColor (color) {
|
onFillColor (color) {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const properties = new Asc.CTableProp();
|
const properties = new Asc.CTableProp();
|
||||||
|
@ -228,9 +236,10 @@ class EditTableController extends Component {
|
||||||
onCheckTemplateChange={this.onCheckTemplateChange}
|
onCheckTemplateChange={this.onCheckTemplateChange}
|
||||||
onFillColor={this.onFillColor}
|
onFillColor={this.onFillColor}
|
||||||
onBorderTypeClick={this.onBorderTypeClick}
|
onBorderTypeClick={this.onBorderTypeClick}
|
||||||
|
onGetTableStylesPreviews = {this.onGetTableStylesPreviews}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default inject("storeFocusObjects")(observer(EditTableController));
|
export default inject("storeFocusObjects", "storeTableSettings")(observer(EditTableController));
|
|
@ -46,6 +46,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Review
|
// Review
|
||||||
.page-review {
|
.page-review {
|
||||||
--f7-toolbar-link-color: @themeColor;
|
--f7-toolbar-link-color: @themeColor;
|
||||||
|
@ -96,6 +97,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#edit-table-style, #add-table {
|
||||||
|
.preloader-modal {
|
||||||
|
background-color: transparent;
|
||||||
|
.preloader {
|
||||||
|
--f7-preloader-color: var(--f7-theme-color-shade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.item-content {
|
.item-content {
|
||||||
.preview{
|
.preview{
|
||||||
color: @gray;
|
color: @gray;
|
||||||
|
|
|
@ -8,29 +8,39 @@ export class storeTableSettings {
|
||||||
cellBorders: observable,
|
cellBorders: observable,
|
||||||
cellBorderWidth: observable,
|
cellBorderWidth: observable,
|
||||||
cellBorderColor: observable,
|
cellBorderColor: observable,
|
||||||
|
arrayStyles: observable,
|
||||||
|
isRenderStyles:observable,
|
||||||
initTableTemplates: action,
|
initTableTemplates: action,
|
||||||
styles: computed,
|
resetFlagRender: action,
|
||||||
|
setStyles: action,
|
||||||
updateCellBorderWidth: action,
|
updateCellBorderWidth: action,
|
||||||
updateCellBorderColor: action,
|
updateCellBorderColor: action,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_templates = [];
|
_templates = [];
|
||||||
|
arrayStyles = [];
|
||||||
|
isRenderStyles;
|
||||||
|
|
||||||
initTableTemplates (templates) {
|
resetFlagRender (bool) {
|
||||||
this._templates = templates;
|
this.isRenderStyles = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
get styles () {
|
initTableTemplates () {
|
||||||
|
this.isRenderStyles = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setStyles (arrStyles) {
|
||||||
let styles = [];
|
let styles = [];
|
||||||
for (let template of this._templates) {
|
for (let template of arrStyles) {
|
||||||
styles.push({
|
styles.push({
|
||||||
imageUrl : template.asc_getImage(),
|
imageUrl : template.asc_getImage(),
|
||||||
templateId : template.asc_getId()
|
templateId : template.asc_getId()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return styles;
|
return this.arrayStyles = styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTableLook (tableObject) {
|
getTableLook (tableObject) {
|
||||||
return tableObject.get_TableLook()
|
return tableObject.get_TableLook()
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => {
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('Add', {returnObjects: true});
|
const _t = t('Add', {returnObjects: true});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Navbar>
|
<Navbar>
|
||||||
{tabs.length > 1 ?
|
{tabs.length > 1 ?
|
||||||
|
@ -64,11 +65,12 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddLayoutContent = ({ tabs }) => {
|
const AddLayoutContent = ({ tabs, onGetTableStylesPreviews }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs animated>
|
<Tabs animated>
|
||||||
{tabs.map((item, index) =>
|
{tabs.map((item, index) =>
|
||||||
<Tab key={"de-tab-" + item.id} id={item.id} className="page-content" tabActive={index === 0}>
|
<Tab key={"de-tab-" + item.id} onTabShow={(e) => {e.id === 'add-table' && onGetTableStylesPreviews()}} id={item.id} className="page-content" tabActive={index === 0}>
|
||||||
{item.component}
|
{item.component}
|
||||||
</Tab>
|
</Tab>
|
||||||
)}
|
)}
|
||||||
|
@ -76,7 +78,7 @@ const AddLayoutContent = ({ tabs }) => {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPanels, style, inPopover}) => {
|
const AddTabs = inject("storeFocusObjects", "storeTableSettings")(observer(({storeFocusObjects,storeTableSettings, showPanels, style, inPopover}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('Add', {returnObjects: true});
|
const _t = t('Add', {returnObjects: true});
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
|
@ -179,11 +181,21 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
||||||
component: <AddLinkController noNavbar={true}/>
|
component: <AddLinkController noNavbar={true}/>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onGetTableStylesPreviews = () => {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
if(storeTableSettings.isRenderStyles) {
|
||||||
|
f7.preloader.showIn('.preload');
|
||||||
|
setTimeout( () => storeTableSettings.setStyles(api.asc_getTableStylesPreviews()), 10);
|
||||||
|
storeTableSettings.resetFlagRender(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={style} stackPages={true} routes={routes}>
|
<View style={style} stackPages={true} routes={routes}>
|
||||||
<Page pageContent={false}>
|
<Page pageContent={false}>
|
||||||
<AddLayoutNavbar tabs={tabs} inPopover={inPopover}/>
|
<AddLayoutNavbar tabs={tabs} inPopover={inPopover}/>
|
||||||
<AddLayoutContent tabs={tabs} />
|
<AddLayoutContent tabs={tabs} onGetTableStylesPreviews={onGetTableStylesPreviews}/>
|
||||||
</Page>
|
</Page>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,14 +1,23 @@
|
||||||
import React, {Fragment, useState} from 'react';
|
import React, {Fragment, useState} from 'react';
|
||||||
import {observer, inject} from "mobx-react";
|
import {observer, inject} from "mobx-react";
|
||||||
|
import { f7 } from 'framework7-react';
|
||||||
import {Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon} from 'framework7-react';
|
import {Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon} from 'framework7-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
|
|
||||||
const AddTable = props => {
|
const AddTable = props => {
|
||||||
|
|
||||||
const storeTableSettings = props.storeTableSettings;
|
const storeTableSettings = props.storeTableSettings;
|
||||||
const styles = storeTableSettings.styles;
|
const styles = storeTableSettings.arrayStyles;
|
||||||
|
|
||||||
|
const onReadyStyles = () => {
|
||||||
|
f7.preloader.hideIn('.preload');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<div className={'table-styles dataview'}>
|
<div className={'table-styles dataview'}>
|
||||||
|
<div className="preload"></div>
|
||||||
<ul className="row">
|
<ul className="row">
|
||||||
{styles.map((style, index) => {
|
{styles.map((style, index) => {
|
||||||
return (
|
return (
|
||||||
|
@ -19,6 +28,7 @@ const AddTable = props => {
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
{onReadyStyles()}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, {Fragment, useState} from 'react';
|
import React, {Fragment, useEffect, useRef, useState} from 'react';
|
||||||
import {observer, inject} from "mobx-react";
|
import {observer, inject} from "mobx-react";
|
||||||
import {Page, Navbar, NavRight, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon, Link, Tabs, Tab} from 'framework7-react';
|
import {Page, Navbar, NavRight, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon, Link, Tabs, Tab} from 'framework7-react';
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
|
@ -173,12 +173,18 @@ const PageWrap = props => {
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
|
|
||||||
const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer(({onStyleClick,storeTableSettings,storeFocusObjects}) => {
|
const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer(({onStyleClick,storeTableSettings,onReadyStyles, onGetTableStylesPreviews,storeFocusObjects}) => {
|
||||||
const tableObject = storeFocusObjects.tableObject;
|
const tableObject = storeFocusObjects.tableObject;
|
||||||
const styleId = tableObject && tableObject.get_TableStyle();
|
const styleId = tableObject && tableObject.get_TableStyle();
|
||||||
const [stateId, setId] = useState(styleId);
|
const [stateId, setId] = useState(styleId);
|
||||||
const styles = storeTableSettings.styles;
|
const styles = storeTableSettings.arrayStyles;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (storeTableSettings.isRenderStyles) onGetTableStylesPreviews();
|
||||||
|
return () => {
|
||||||
|
storeTableSettings.resetFlagRender(false);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div className="dataview table-styles">
|
<div className="dataview table-styles">
|
||||||
<ul className="row">
|
<ul className="row">
|
||||||
|
@ -192,6 +198,7 @@ const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
{storeTableSettings.isRenderStyles && onReadyStyles()}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
|
@ -200,6 +207,9 @@ const PageStyleOptions = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('Edit', {returnObjects: true});
|
const _t = t('Edit', {returnObjects: true});
|
||||||
const tableObject = props.storeFocusObjects.tableObject;
|
const tableObject = props.storeFocusObjects.tableObject;
|
||||||
|
const nextStateRef = useRef();
|
||||||
|
const prevStateRef = useRef();
|
||||||
|
|
||||||
let tableLook, isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer;
|
let tableLook, isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer;
|
||||||
if (tableObject) {
|
if (tableObject) {
|
||||||
tableLook = tableObject.get_TableLook();
|
tableLook = tableObject.get_TableLook();
|
||||||
|
@ -210,9 +220,30 @@ const PageStyleOptions = props => {
|
||||||
isLastCol = tableLook.get_LastCol();
|
isLastCol = tableLook.get_LastCol();
|
||||||
isBandVer = tableLook.get_BandVer();
|
isBandVer = tableLook.get_BandVer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextStateRef.current = [isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
props.storeTableSettings.resetFlagRender(false);
|
||||||
|
prevStateRef.current = [...nextStateRef.current];
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (!(prevStateRef.current.every((item, index) => item === nextStateRef.current[index]))) {
|
||||||
|
props.onGetTableStylesPreviews();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const openIndicator = () => {
|
||||||
|
if ( !(prevStateRef.current.every((item, index) => item === nextStateRef.current[index]))) {
|
||||||
|
$$('.table-styles').hide();
|
||||||
|
f7.preloader.showIn('.preload');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<Navbar title={_t.textOptions} backLink={_t.textBack}>
|
<Navbar title={_t.textOptions} backLink={_t.textBack} onBackClick={openIndicator}>
|
||||||
{Device.phone &&
|
{Device.phone &&
|
||||||
<NavRight>
|
<NavRight>
|
||||||
<Link sheetClose='#edit-sheet'>
|
<Link sheetClose='#edit-sheet'>
|
||||||
|
@ -464,8 +495,6 @@ const TabBorder = inject("storeFocusObjects", "storeTableSettings")(observer(pro
|
||||||
const PageStyle = props => {
|
const PageStyle = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('Edit', {returnObjects: true});
|
const _t = t('Edit', {returnObjects: true});
|
||||||
const storeTableSettings = props.storeTableSettings;
|
|
||||||
const templates = storeTableSettings.styles;
|
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
|
||||||
const tableObject = props.storeFocusObjects.tableObject;
|
const tableObject = props.storeFocusObjects.tableObject;
|
||||||
|
@ -474,6 +503,11 @@ const PageStyle = props => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onReadyStyles = () => {
|
||||||
|
f7.preloader.hideIn('.preload');
|
||||||
|
$$('.table-styles').show();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<Navbar backLink={_t.textBack}>
|
<Navbar backLink={_t.textBack}>
|
||||||
|
@ -495,12 +529,14 @@ const PageStyle = props => {
|
||||||
<Tab key={"de-tab-table-style"} id={"edit-table-style"} className="page-content no-padding-top" tabActive={true}>
|
<Tab key={"de-tab-table-style"} id={"edit-table-style"} className="page-content no-padding-top" tabActive={true}>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<StyleTemplates templates={templates} onStyleClick={props.onStyleClick}/>
|
<div className="preload"></div>
|
||||||
|
<StyleTemplates onReadyStyles={onReadyStyles} onGetTableStylesPreviews={props.onGetTableStylesPreviews} onStyleClick={props.onStyleClick}/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<List>
|
<List>
|
||||||
<ListItem title={_t.textStyleOptions} link={'/edit-table-style-options/'} routeProps={{
|
<ListItem title={_t.textStyleOptions} link={'/edit-table-style-options/'} routeProps={{
|
||||||
onCheckTemplateChange: props.onCheckTemplateChange
|
onCheckTemplateChange: props.onCheckTemplateChange,
|
||||||
|
onGetTableStylesPreviews: props.onGetTableStylesPreviews,
|
||||||
}}/>
|
}}/>
|
||||||
</List>
|
</List>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
@ -560,6 +596,7 @@ const EditTable = props => {
|
||||||
<ListItem title={_t.textStyle} link='/edit-table-style/' routeProps={{
|
<ListItem title={_t.textStyle} link='/edit-table-style/' routeProps={{
|
||||||
onStyleClick: props.onStyleClick,
|
onStyleClick: props.onStyleClick,
|
||||||
onCheckTemplateChange: props.onCheckTemplateChange,
|
onCheckTemplateChange: props.onCheckTemplateChange,
|
||||||
|
onGetTableStylesPreviews: props.onGetTableStylesPreviews,
|
||||||
onFillColor: props.onFillColor,
|
onFillColor: props.onFillColor,
|
||||||
onBorderTypeClick: props.onBorderTypeClick
|
onBorderTypeClick: props.onBorderTypeClick
|
||||||
}}></ListItem>
|
}}></ListItem>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
|
import {observer, inject} from "mobx-react";
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
import { withTranslation} from 'react-i18next';
|
import { withTranslation} from 'react-i18next';
|
||||||
|
|
||||||
|
@ -10,6 +11,7 @@ class AddOtherController extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.onStyleClick = this.onStyleClick.bind(this);
|
this.onStyleClick = this.onStyleClick.bind(this);
|
||||||
this.initStyleTable = this.initStyleTable.bind(this);
|
this.initStyleTable = this.initStyleTable.bind(this);
|
||||||
|
this.onGetTableStylesPreviews = this.onGetTableStylesPreviews.bind(this);
|
||||||
|
|
||||||
this.initTable = false;
|
this.initTable = false;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +92,15 @@ class AddOtherController extends Component {
|
||||||
}).open();
|
}).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onGetTableStylesPreviews = () => {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
if (this.props.storeTableSettings.isRenderStyles) {
|
||||||
|
f7.preloader.showIn('.preload');
|
||||||
|
setTimeout(() => this.props.storeTableSettings.setStyles(api.asc_getTableStylesPreviews()) , 10);
|
||||||
|
this.props.storeTableSettings.resetFlagRender(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hideAddComment () {
|
hideAddComment () {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const stack = api.getSelectedElements();
|
const stack = api.getSelectedElements();
|
||||||
|
@ -122,11 +133,12 @@ class AddOtherController extends Component {
|
||||||
onStyleClick={this.onStyleClick}
|
onStyleClick={this.onStyleClick}
|
||||||
initStyleTable={this.initStyleTable}
|
initStyleTable={this.initStyleTable}
|
||||||
hideAddComment={this.hideAddComment}
|
hideAddComment={this.hideAddComment}
|
||||||
|
onGetTableStylesPreviews = {this.onGetTableStylesPreviews}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const AddOtherWithTranslation = withTranslation()(AddOtherController);
|
const AddOtherWithTranslation = inject("storeTableSettings")(withTranslation()(AddOtherController));
|
||||||
|
|
||||||
export {AddOtherWithTranslation as AddOtherController};
|
export {AddOtherWithTranslation as AddOtherController};
|
|
@ -16,6 +16,7 @@ class EditTableController extends Component {
|
||||||
this.onAddRowBelow = this.onAddRowBelow.bind(this);
|
this.onAddRowBelow = this.onAddRowBelow.bind(this);
|
||||||
this.onRemoveColumn = this.onRemoveColumn.bind(this);
|
this.onRemoveColumn = this.onRemoveColumn.bind(this);
|
||||||
this.onRemoveRow = this.onRemoveRow.bind(this);
|
this.onRemoveRow = this.onRemoveRow.bind(this);
|
||||||
|
this.onGetTableStylesPreviews = this.onGetTableStylesPreviews.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
closeIfNeed () {
|
closeIfNeed () {
|
||||||
|
@ -120,6 +121,11 @@ class EditTableController extends Component {
|
||||||
api.tblApply(properties);
|
api.tblApply(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onGetTableStylesPreviews() {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
this.props.storeTableSettings.setStyles(api.asc_getTableStylesPreviews());
|
||||||
|
}
|
||||||
|
|
||||||
onFillColor (color) {
|
onFillColor (color) {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const properties = new Asc.CTableProp();
|
const properties = new Asc.CTableProp();
|
||||||
|
@ -213,9 +219,10 @@ class EditTableController extends Component {
|
||||||
onBorderTypeClick={this.onBorderTypeClick}
|
onBorderTypeClick={this.onBorderTypeClick}
|
||||||
onReorder={this.onReorder}
|
onReorder={this.onReorder}
|
||||||
onAlign={this.onAlign}
|
onAlign={this.onAlign}
|
||||||
|
onGetTableStylesPreviews = {this.onGetTableStylesPreviews}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default inject("storeFocusObjects")(observer(EditTableController));
|
export default inject("storeFocusObjects", "storeTableSettings")(observer(EditTableController));
|
|
@ -84,6 +84,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#edit-table-style, #add-table {
|
||||||
|
.preloader-modal {
|
||||||
|
background-color: transparent;
|
||||||
|
.preloader {
|
||||||
|
--f7-preloader-color: var(--f7-theme-color-shade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.item-content {
|
.item-content {
|
||||||
.preview{
|
.preview{
|
||||||
color: @gray;
|
color: @gray;
|
||||||
|
|
|
@ -8,28 +8,37 @@ export class storeTableSettings {
|
||||||
cellBorders: observable,
|
cellBorders: observable,
|
||||||
cellBorderWidth: observable,
|
cellBorderWidth: observable,
|
||||||
cellBorderColor: observable,
|
cellBorderColor: observable,
|
||||||
|
arrayStyles: observable,
|
||||||
|
isRenderStyles:observable,
|
||||||
initTableTemplates: action,
|
initTableTemplates: action,
|
||||||
styles: computed,
|
resetFlagRender: action,
|
||||||
|
setStyles: action,
|
||||||
updateCellBorderWidth: action,
|
updateCellBorderWidth: action,
|
||||||
updateCellBorderColor: action,
|
updateCellBorderColor: action,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_templates = [];
|
_templates = [];
|
||||||
|
arrayStyles = [];
|
||||||
|
isRenderStyles;
|
||||||
|
|
||||||
initTableTemplates (templates) {
|
resetFlagRender (bool) {
|
||||||
this._templates = templates;
|
this.isRenderStyles = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
get styles () {
|
initTableTemplates () {
|
||||||
|
this.isRenderStyles = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setStyles (arrStyles) {
|
||||||
let styles = [];
|
let styles = [];
|
||||||
for (let template of this._templates) {
|
for (let template of arrStyles) {
|
||||||
styles.push({
|
styles.push({
|
||||||
imageUrl : template.asc_getImage(),
|
imageUrl : template.asc_getImage(),
|
||||||
templateId : template.asc_getId()
|
templateId : template.asc_getId()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return styles;
|
return this.arrayStyles = styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTableLook (tableObject) {
|
getTableLook (tableObject) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import {observer, inject} from "mobx-react";
|
import {observer, inject} from "mobx-react";
|
||||||
import {List, ListItem, Page, Navbar, Icon, ListButton, ListInput, BlockTitle, Segmented, Button} from 'framework7-react';
|
import {f7, List, ListItem, Page, Navbar, Icon, ListButton, ListInput, BlockTitle, Segmented, Button} from 'framework7-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {Device} from "../../../../../common/mobile/utils/device";
|
import {Device} from "../../../../../common/mobile/utils/device";
|
||||||
|
|
||||||
|
@ -9,10 +9,16 @@ const PageTable = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('View.Add', {returnObjects: true});
|
const _t = t('View.Add', {returnObjects: true});
|
||||||
const storeTableSettings = props.storeTableSettings;
|
const storeTableSettings = props.storeTableSettings;
|
||||||
const styles = storeTableSettings.styles;
|
const styles = storeTableSettings.arrayStyles;
|
||||||
|
|
||||||
|
const onReadyStyles = () => {
|
||||||
|
f7.preloader.hideIn('.preload');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page id={'add-table'}>
|
<Page id={'add-table'}>
|
||||||
<Navbar title={_t.textTable} backLink={_t.textBack}/>
|
<Navbar title={_t.textTable} backLink={_t.textBack}/>
|
||||||
|
<div className="preload"></div>
|
||||||
<div className={'table-styles dataview'}>
|
<div className={'table-styles dataview'}>
|
||||||
<ul className="row">
|
<ul className="row">
|
||||||
{styles.map((style, index) => {
|
{styles.map((style, index) => {
|
||||||
|
@ -24,6 +30,7 @@ const PageTable = props => {
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
{onReadyStyles()}
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
|
@ -36,7 +43,7 @@ const AddOther = props => {
|
||||||
const hideAddComment = props.hideAddComment();
|
const hideAddComment = props.hideAddComment();
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<ListItem title={_t.textTable} link={'/add-table/'} routeProps={{
|
<ListItem title={_t.textTable} link={'/add-table/'} onClick = {() => props.onGetTableStylesPreviews()} routeProps={{
|
||||||
onStyleClick: props.onStyleClick,
|
onStyleClick: props.onStyleClick,
|
||||||
initStyleTable: props.initStyleTable
|
initStyleTable: props.initStyleTable
|
||||||
}}>
|
}}>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, {Fragment, useState} from 'react';
|
import React, {Fragment, useState, useEffect, useRef} from 'react';
|
||||||
import {observer, inject} from "mobx-react";
|
import {observer, inject} from "mobx-react";
|
||||||
import {f7, Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon, Link, Tabs, Tab, NavRight} from 'framework7-react';
|
import {f7, Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon, Link, Tabs, Tab, NavRight} from 'framework7-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
@ -7,11 +7,18 @@ import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
|
|
||||||
const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer(({onStyleClick,storeTableSettings,storeFocusObjects}) => {
|
const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer(({onStyleClick, onReadyStyles, onGetTableStylesPreviews, storeTableSettings,storeFocusObjects}) => {
|
||||||
const tableObject = storeFocusObjects.tableObject;
|
const tableObject = storeFocusObjects.tableObject;
|
||||||
const styleId = tableObject ? tableObject.get_TableStyle() : null;
|
const styleId = tableObject ? tableObject.get_TableStyle() : null;
|
||||||
const [stateId, setId] = useState(styleId);
|
const [stateId, setId] = useState(styleId);
|
||||||
const styles = storeTableSettings.styles;
|
const styles = storeTableSettings.arrayStyles;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (storeTableSettings.isRenderStyles) onGetTableStylesPreviews();
|
||||||
|
return () => {
|
||||||
|
storeTableSettings.resetFlagRender(false);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
if (!tableObject && Device.phone) {
|
if (!tableObject && Device.phone) {
|
||||||
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
|
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
|
||||||
|
@ -31,6 +38,7 @@ const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
{storeTableSettings.isRenderStyles && onReadyStyles()}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
|
@ -38,8 +46,10 @@ const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer
|
||||||
const PageStyleOptions = props => {
|
const PageStyleOptions = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('View.Edit', {returnObjects: true});
|
const _t = t('View.Edit', {returnObjects: true});
|
||||||
|
|
||||||
const tableObject = props.storeFocusObjects.tableObject;
|
const tableObject = props.storeFocusObjects.tableObject;
|
||||||
|
const nextStateRef = useRef();
|
||||||
|
const prevStateRef = useRef();
|
||||||
|
|
||||||
let tableLook, isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer;
|
let tableLook, isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer;
|
||||||
if (tableObject) {
|
if (tableObject) {
|
||||||
tableLook = tableObject.get_TableLook();
|
tableLook = tableObject.get_TableLook();
|
||||||
|
@ -51,9 +61,29 @@ const PageStyleOptions = props => {
|
||||||
isBandVer = tableLook.get_BandVer();
|
isBandVer = tableLook.get_BandVer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextStateRef.current = [isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
props.storeTableSettings.resetFlagRender(false);
|
||||||
|
prevStateRef.current = [...nextStateRef.current];
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (!(prevStateRef.current.every((item, index) => item === nextStateRef.current[index]))) {
|
||||||
|
props.onGetTableStylesPreviews();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const openIndicator = () => {
|
||||||
|
if ( !(prevStateRef.current.every((item, index) => item === nextStateRef.current[index]))) {
|
||||||
|
$$('.table-styles').hide();
|
||||||
|
f7.preloader.showIn('.preload');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<Navbar title={_t.textOptions} backLink={_t.textBack}>
|
<Navbar title={_t.textOptions} backLink={_t.textBack} onBackClick={openIndicator}>
|
||||||
{Device.phone &&
|
{Device.phone &&
|
||||||
<NavRight>
|
<NavRight>
|
||||||
<Link sheetClose='#edit-sheet'>
|
<Link sheetClose='#edit-sheet'>
|
||||||
|
@ -311,10 +341,13 @@ const TabBorder = inject("storeFocusObjects", "storeTableSettings")(observer(pro
|
||||||
const PageStyle = props => {
|
const PageStyle = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('View.Edit', {returnObjects: true});
|
const _t = t('View.Edit', {returnObjects: true});
|
||||||
const storeTableSettings = props.storeTableSettings;
|
|
||||||
const templates = storeTableSettings.styles;
|
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
|
||||||
|
const onReadyStyles = () => {
|
||||||
|
f7.preloader.hideIn('.preload');
|
||||||
|
$$('.table-styles').show();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<Navbar backLink={_t.textBack}>
|
<Navbar backLink={_t.textBack}>
|
||||||
|
@ -336,12 +369,14 @@ const PageStyle = props => {
|
||||||
<Tab key={"pe-tab-table-style"} id={"edit-table-style"} className="page-content no-padding-top" tabActive={true}>
|
<Tab key={"pe-tab-table-style"} id={"edit-table-style"} className="page-content no-padding-top" tabActive={true}>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<StyleTemplates templates={templates} onStyleClick={props.onStyleClick}/>
|
<div className="preload"></div>
|
||||||
|
<StyleTemplates onReadyStyles={onReadyStyles} onGetTableStylesPreviews={props.onGetTableStylesPreviews} onStyleClick={props.onStyleClick}/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<List>
|
<List>
|
||||||
<ListItem title={_t.textStyleOptions} link={'/edit-table-style-options/'} routeProps={{
|
<ListItem title={_t.textStyleOptions} link={'/edit-table-style-options/'} routeProps={{
|
||||||
onCheckTemplateChange: props.onCheckTemplateChange
|
onCheckTemplateChange: props.onCheckTemplateChange,
|
||||||
|
onGetTableStylesPreviews: props.onGetTableStylesPreviews,
|
||||||
}}/>
|
}}/>
|
||||||
</List>
|
</List>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
@ -495,6 +530,7 @@ const EditTable = props => {
|
||||||
<ListItem title={_t.textStyle} link='/edit-table-style/' routeProps={{
|
<ListItem title={_t.textStyle} link='/edit-table-style/' routeProps={{
|
||||||
onStyleClick: props.onStyleClick,
|
onStyleClick: props.onStyleClick,
|
||||||
onCheckTemplateChange: props.onCheckTemplateChange,
|
onCheckTemplateChange: props.onCheckTemplateChange,
|
||||||
|
onGetTableStylesPreviews: props.onGetTableStylesPreviews,
|
||||||
onFillColor: props.onFillColor,
|
onFillColor: props.onFillColor,
|
||||||
onBorderTypeClick: props.onBorderTypeClick
|
onBorderTypeClick: props.onBorderTypeClick
|
||||||
}}></ListItem>
|
}}></ListItem>
|
||||||
|
|
Loading…
Reference in a new issue