Fix Bug 48186 addition

This commit is contained in:
ShimaginAndrey 2021-05-26 20:25:04 +03:00
parent 3c05927fbc
commit c51221e46e
3 changed files with 21 additions and 31 deletions

View file

@ -484,7 +484,6 @@
.row { .row {
&, li { &, li {
margin-bottom: 12px; margin-bottom: 12px;
padding-left: 5px;
} }
} }
@ -500,6 +499,12 @@
} }
} }
#edit-table-style {
.list ul ul {
padding-left: 0;
}
}
// Cell styles // Cell styles
.cell-styles-list { .cell-styles-list {

View file

@ -2,7 +2,7 @@
.dataview { .dataview {
.row { .row {
justify-content: flex-start; justify-content: space-around;
} }
ul { ul {

View file

@ -7,22 +7,11 @@ import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile
// Style // Style
const StyleTemplates = inject("storeFocusObjects")(observer(({templates, onStyleClick, storeFocusObjects}) => { const StyleTemplates = inject("storeFocusObjects","storeTableSettings")(observer(({onStyleClick,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 widthContainer = document.querySelector(".page-content").clientWidth;
const columns = parseInt((widthContainer - 47) / 70); // magic
const styles = [];
let row = -1;
templates.forEach((style, index) => {
if (0 == index % columns) {
styles.push([]);
row++
}
styles[row].push(style);
});
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,21 +20,17 @@ const StyleTemplates = inject("storeFocusObjects")(observer(({templates, onStyle
return ( return (
<div className="dataview table-styles"> <div className="dataview table-styles">
{styles.map((row, rowIndex) => { <ul className="row">
{styles.map((style, index) => {
return ( return (
<div className="row" key={`row-${rowIndex}`}> <li key={index}
{row.map((style, index)=>{
return(
<div key={`${rowIndex}-${index}`}
className={style.templateId === stateId ? 'active' : ''} className={style.templateId === stateId ? 'active' : ''}
onClick={() => {onStyleClick(style.templateId); setId(style.templateId)}}> onClick={() => {onStyleClick(style.templateId); setId(style.templateId)}}>
<img src={style.imageUrl} /> <img src={style.imageUrl}/>
</div> </li>
)
})}
</div>
) )
})} })}
</ul>
</div> </div>
) )
})); }));