From 5a0cc476d600067f7368183099cfcb382be551da Mon Sep 17 00:00:00 2001 From: ShimaginAndrey Date: Tue, 29 Jun 2021 16:02:49 +0300 Subject: [PATCH] [SSE] Add dialog Sorting --- apps/spreadsheeteditor/mobile/locale/en.json | 5 +++ .../mobile/src/controller/add/AddFilter.jsx | 37 ++++++++++++++++++- .../mobile/src/less/app.less | 12 ++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index eee0461b75..e4fd86005f 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -272,6 +272,11 @@ "textInvalidRange": "ERROR! Invalid cells range", "textSortAndFilter": "Sort and 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" }, "Edit" : { diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx index ef9a13408a..917e46388e 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx @@ -1,4 +1,6 @@ import React, {Component} from 'react'; +import { f7 } from 'framework7-react'; +import { withTranslation } from 'react-i18next'; import AddSortAndFilter from '../../view/add/AddFilter'; @@ -7,6 +9,7 @@ class AddFilterController extends Component { super(props); this.onInsertFilter = this.onInsertFilter.bind(this); this.uncheckedFilter = this.uncheckedFilter.bind(this); + this.onInsertSort = this.onInsertSort.bind(this); const api = Common.EditorApi.get(); @@ -38,7 +41,37 @@ class AddFilterController extends Component { onInsertSort (type) { 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) { @@ -64,4 +97,4 @@ class AddFilterController extends Component { } } -export default AddFilterController; \ No newline at end of file +export default withTranslation()(AddFilterController); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/less/app.less b/apps/spreadsheeteditor/mobile/src/less/app.less index 5338e8a1ff..281be641d9 100644 --- a/apps/spreadsheeteditor/mobile/src/less/app.less +++ b/apps/spreadsheeteditor/mobile/src/less/app.less @@ -83,4 +83,16 @@ width: 25px; } } +} + +.type-sort{ + + .dialog-inner{ + text-align: center; + } + .dialog-buttons{ + height: 130px; + flex-direction: column; + justify-content: space-between; + } } \ No newline at end of file