[SSE] Add dialog Sorting

This commit is contained in:
ShimaginAndrey 2021-06-29 16:02:49 +03:00
parent 9112378308
commit 5a0cc476d6
3 changed files with 52 additions and 2 deletions

View file

@ -272,6 +272,11 @@
"textInvalidRange": "ERROR! Invalid cells range", "textInvalidRange": "ERROR! Invalid cells range",
"textSortAndFilter": "Sort and Filter", "textSortAndFilter": "Sort and Filter",
"textFilter": "Filter", "textFilter": "Filter",
"txtSorting": "Sorting",
"txtExpandSort": "The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",
"txtExpand": "Expand and sort",
"txtSortSelected": "Sort selected",
"textCancel": "Cancel",
"textComment": "Comment" "textComment": "Comment"
}, },
"Edit" : { "Edit" : {

View file

@ -1,4 +1,6 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import { withTranslation } from 'react-i18next';
import AddSortAndFilter from '../../view/add/AddFilter'; import AddSortAndFilter from '../../view/add/AddFilter';
@ -7,6 +9,7 @@ class AddFilterController extends Component {
super(props); super(props);
this.onInsertFilter = this.onInsertFilter.bind(this); this.onInsertFilter = this.onInsertFilter.bind(this);
this.uncheckedFilter = this.uncheckedFilter.bind(this); this.uncheckedFilter = this.uncheckedFilter.bind(this);
this.onInsertSort = this.onInsertSort.bind(this);
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
@ -38,7 +41,37 @@ class AddFilterController extends Component {
onInsertSort (type) { onInsertSort (type) {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_sortColFilter(type == 'down' ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending, '', undefined, undefined, true); const { t } = this.props;
const _t = t('View.Add', {returnObjects: true});
let typeCheck = type == 'down' ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending;
if( api.asc_sortCellsRangeExpand()) {
f7.dialog.create({
title: _t.txtSorting,
text: _t.txtExpandSort,
buttons: [
{
text: _t.txtExpand,
onClick: () => {
api.asc_sortColFilter(typeCheck, '', undefined, undefined, true);
f7.popup.close('.add-popup');
}
},
{
text: _t.txtSortSelected,
onClick: () => {
api.asc_sortColFilter(typeCheck, '', undefined, undefined);
f7.popup.close('.add-popup');
}
},
{
text: _t.textCancel
}
],
cssClass: 'type-sort'
}).open();
} else
api.asc_sortColFilter(typeCheck, '', undefined, undefined, api.asc_sortCellsRangeExpand() !== null);
} }
onInsertFilter (checked) { onInsertFilter (checked) {
@ -64,4 +97,4 @@ class AddFilterController extends Component {
} }
} }
export default AddFilterController; export default withTranslation()(AddFilterController);

View file

@ -83,4 +83,16 @@
width: 25px; width: 25px;
} }
} }
}
.type-sort{
.dialog-inner{
text-align: center;
}
.dialog-buttons{
height: 130px;
flex-direction: column;
justify-content: space-between;
}
} }