[DE PE mobile] Hide styles for combined charts

This commit is contained in:
JuliaSvinareva 2021-02-01 20:34:07 +03:00
parent 82f29b99de
commit 9d743bd814
9 changed files with 47 additions and 12 deletions

View file

@ -28,6 +28,10 @@
pointer-events: none; pointer-events: none;
} }
.text-content {
padding: 14px 10px 0 10px;
}
.shapes { .shapes {
li { li {
width: 70px; width: 70px;

View file

@ -217,7 +217,8 @@
"textFirstColumn": "First Column", "textFirstColumn": "First Column",
"textLastColumn": "Last Column", "textLastColumn": "Last Column",
"textBandedColumn": "Banded Column", "textBandedColumn": "Banded Column",
"textType": "Type" "textType": "Type",
"textNoStyles": "No styles for this type of charts."
}, },
"Add": { "Add": {
"textTable": "Table", "textTable": "Table",

View file

@ -14,8 +14,16 @@ class EditChartController extends Component {
this.onBorderColor = this.onBorderColor.bind(this); this.onBorderColor = this.onBorderColor.bind(this);
this.onBorderSize = this.onBorderSize.bind(this); this.onBorderSize = this.onBorderSize.bind(this);
const api = Common.EditorApi.get(); const type = props.storeFocusObjects.chartObject.get_ChartProperties().getType();
props.storeChartSettings.updateChartStyles(api.asc_getChartPreviews(props.storeFocusObjects.chartObject.get_ChartProperties().getType())); if (type==Asc.c_oAscChartTypeSettings.comboBarLine ||
type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
type==Asc.c_oAscChartTypeSettings.comboAreaBar ||
type==Asc.c_oAscChartTypeSettings.comboCustom) {
props.storeChartSettings.clearChartStyles();
} else {
const api = Common.EditorApi.get();
props.storeChartSettings.updateChartStyles(api.asc_getChartPreviews(type));
}
} }
onRemoveChart () { onRemoveChart () {

View file

@ -56,11 +56,15 @@ export class storeChartSettings {
} }
// style // style
@observable chartStyles; @observable chartStyles = null;
@action clearChartStyles () {
this.chartStyles = null;
}
@action updateChartStyles (styles) { @action updateChartStyles (styles) {
this.chartStyles = styles; this.chartStyles = styles;
} }
@computed get styles () { @computed get styles () {
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
let row = -1; let row = -1;

View file

@ -175,7 +175,7 @@ const PageStyle = props => {
</Tab> </Tab>
<Tab key={"de-tab-chart-style"} id={"edit-chart-style"} className="page-content no-padding-top dataview"> <Tab key={"de-tab-chart-style"} id={"edit-chart-style"} className="page-content no-padding-top dataview">
<div className={'chart-styles'}> <div className={'chart-styles'}>
{styles.map((row, rowIndex) => { {styles ? styles.map((row, rowIndex) => {
return ( return (
<ul className="row" key={`row-${rowIndex}`}> <ul className="row" key={`row-${rowIndex}`}>
{row.map((style, index)=>{ {row.map((style, index)=>{
@ -188,7 +188,9 @@ const PageStyle = props => {
})} })}
</ul> </ul>
) )
})} }) :
<div className={'text-content'}>{_t.textNoStyles}</div>
}
</div> </div>
</Tab> </Tab>
<Tab key={"de-tab-chart-fill"} id={"edit-chart-fill"} className="page-content no-padding-top"> <Tab key={"de-tab-chart-fill"} id={"edit-chart-fill"} className="page-content no-padding-top">

View file

@ -228,7 +228,8 @@
"textStyleOptions": "Style Options", "textStyleOptions": "Style Options",
"textRemoveTable": "Remove Table", "textRemoveTable": "Remove Table",
"textCellMargins": "Cell Margins", "textCellMargins": "Cell Margins",
"textRemoveChart": "Remove Chart" "textRemoveChart": "Remove Chart",
"textNoStyles": "No styles for this type of charts."
} }
}, },
"Common": { "Common": {

View file

@ -12,8 +12,16 @@ class EditChartController extends Component {
this.onBorderColor = this.onBorderColor.bind(this); this.onBorderColor = this.onBorderColor.bind(this);
this.onBorderSize = this.onBorderSize.bind(this); this.onBorderSize = this.onBorderSize.bind(this);
const api = Common.EditorApi.get(); const type = props.storeFocusObjects.chartObject.getType();
props.storeChartSettings.updateChartStyles(api.asc_getChartPreviews(props.storeFocusObjects.chartObject.getType())); if (type==Asc.c_oAscChartTypeSettings.comboBarLine ||
type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
type==Asc.c_oAscChartTypeSettings.comboAreaBar ||
type==Asc.c_oAscChartTypeSettings.comboCustom) {
props.storeChartSettings.clearChartStyles();
} else {
const api = Common.EditorApi.get();
props.storeChartSettings.updateChartStyles(api.asc_getChartPreviews(type));
}
} }
onRemoveChart () { onRemoveChart () {

View file

@ -4,13 +4,18 @@ export class storeChartSettings {
// Style // Style
@observable chartStyles; @observable chartStyles = null;
@action clearChartStyles () {
this.chartStyles = null;
}
@action updateChartStyles (styles) { @action updateChartStyles (styles) {
this.chartStyles = styles; this.chartStyles = styles;
} }
@computed get styles () { @computed get styles () {
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
let row = -1; let row = -1;

View file

@ -187,7 +187,7 @@ const PageStyle = props => {
</Tab> </Tab>
<Tab key={"pe-tab-chart-style"} id={"edit-chart-style"} className="page-content no-padding-top dataview"> <Tab key={"pe-tab-chart-style"} id={"edit-chart-style"} className="page-content no-padding-top dataview">
<div className={'chart-styles'}> <div className={'chart-styles'}>
{styles.map((row, rowIndex) => { {styles ? styles.map((row, rowIndex) => {
return ( return (
<ul className="row" key={`row-${rowIndex}`}> <ul className="row" key={`row-${rowIndex}`}>
{row.map((style, index)=>{ {row.map((style, index)=>{
@ -200,7 +200,9 @@ const PageStyle = props => {
})} })}
</ul> </ul>
) )
})} }) :
<div className={'text-content'}>{_t.textNoStyles}</div>
}
</div> </div>
</Tab> </Tab>
<Tab key={"pe-tab-chart-fill"} id={"edit-chart-fill"} className="page-content no-padding-top"> <Tab key={"pe-tab-chart-fill"} id={"edit-chart-fill"} className="page-content no-padding-top">