[DE mobile] Added the ability to add tables
This commit is contained in:
parent
e9dffd3a22
commit
8a8e51abb6
|
@ -337,7 +337,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataview {
|
.dataview, #add-table {
|
||||||
&.page-content {
|
&.page-content {
|
||||||
background-color: @white;
|
background-color: @white;
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,6 @@
|
||||||
.table-styles {
|
.table-styles {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
.row {
|
.row {
|
||||||
padding: 0;
|
|
||||||
&, li {
|
&, li {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,10 @@
|
||||||
"textTable": "Table",
|
"textTable": "Table",
|
||||||
"textShape": "Shape",
|
"textShape": "Shape",
|
||||||
"textImage": "Image",
|
"textImage": "Image",
|
||||||
"textOther": "Other"
|
"textOther": "Other",
|
||||||
|
"textTableSize": "Table Size",
|
||||||
|
"textColumns": "Columns",
|
||||||
|
"textRows": "Rows",
|
||||||
|
"textCancel": "Cancel"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,20 +1,93 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
import {observer, inject} from "mobx-react";
|
import { withTranslation} from 'react-i18next';
|
||||||
|
|
||||||
import { AddTable } from '../../view/add/AddTable';
|
import AddTable from '../../view/add/AddTable';
|
||||||
|
|
||||||
class AddTableController extends Component {
|
class AddTableController extends Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
this.onStyleClick = this.onStyleClick.bind(this);
|
||||||
|
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
api.asc_GetDefaultTableStyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeModal () {
|
||||||
|
if ( Device.phone ) {
|
||||||
|
f7.sheet.close('.add-popup', true);
|
||||||
|
} else {
|
||||||
|
f7.popover.close('#add-popover');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onStyleClick (type) {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
|
||||||
|
this.closeModal();
|
||||||
|
|
||||||
|
const { t } = this.props;
|
||||||
|
const _t = t("Add", { returnObjects: true });
|
||||||
|
|
||||||
|
let picker;
|
||||||
|
|
||||||
|
const dialog = f7.dialog.create({
|
||||||
|
title: _t.textTableSize,
|
||||||
|
text: '',
|
||||||
|
content:
|
||||||
|
'<div class="content-block">' +
|
||||||
|
'<div class="row">' +
|
||||||
|
'<div class="col-50">' + _t.textColumns + '</div>' +
|
||||||
|
'<div class="col-50">' + _t.textRows + '</div>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div id="picker-table-size"></div>' +
|
||||||
|
'</div>',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: _t.textCancel
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'OK',
|
||||||
|
bold: true,
|
||||||
|
onClick: function () {
|
||||||
|
const size = picker.value;
|
||||||
|
|
||||||
|
api.put_Table(parseInt(size[0]), parseInt(size[1]), type.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).open();
|
||||||
|
dialog.on('opened', () => {
|
||||||
|
picker = f7.picker.create({
|
||||||
|
containerEl: document.getElementById('picker-table-size'),
|
||||||
|
cols: [
|
||||||
|
{
|
||||||
|
textAlign: 'center',
|
||||||
|
width: '100%',
|
||||||
|
values: [1,2,3,4,5,6,7,8,9,10]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
textAlign: 'center',
|
||||||
|
width: '100%',
|
||||||
|
values: [1,2,3,4,5,6,7,8,9,10]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
toolbar: false,
|
||||||
|
rotateEffect: true,
|
||||||
|
value: [3, 3]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<AddTable
|
<AddTable onStyleClick={this.onStyleClick}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AddTableController;
|
const AddTableWithTranslation = withTranslation()(AddTableController);
|
||||||
|
|
||||||
|
export {AddTableWithTranslation as AddTableController};
|
|
@ -5,7 +5,7 @@ import {f7} from 'framework7-react';
|
||||||
import { observer, inject } from "mobx-react";
|
import { observer, inject } from "mobx-react";
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
|
|
||||||
import AddTableController from "../../controller/add/AddTable";
|
import {AddTableController} from "../../controller/add/AddTable";
|
||||||
import AddShapeController from "../../controller/add/AddShape";
|
import AddShapeController from "../../controller/add/AddShape";
|
||||||
//import AddImageController from "../../controller/add/AddImage";
|
//import AddImageController from "../../controller/add/AddImage";
|
||||||
//import AddOtherController from "../../controller/add/AddOther";
|
//import AddOtherController from "../../controller/add/AddOther";
|
||||||
|
|
|
@ -5,11 +5,22 @@ 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 styles = storeTableSettings.styles;
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<div className={'table-styles dataview'}>
|
||||||
|
<ul className="row">
|
||||||
</Fragment>
|
{styles.map((style, index) => {
|
||||||
|
return (
|
||||||
|
<li key={index}
|
||||||
|
onClick={() => {props.onStyleClick(style.templateId)}}>
|
||||||
|
<img src={style.imageUrl}/>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export {AddTable};
|
export default inject("storeTableSettings")(observer(AddTable));
|
Loading…
Reference in a new issue