From 5a0cc476d600067f7368183099cfcb382be551da Mon Sep 17 00:00:00 2001 From: ShimaginAndrey Date: Tue, 29 Jun 2021 16:02:49 +0300 Subject: [PATCH 1/2] [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 eee0461b7..e4fd86005 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 ef9a13408..917e46388 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 5338e8a1f..281be641d 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 From cf2ff32462c0e9a3f6b8abad99c68a0cf151e016 Mon Sep 17 00:00:00 2001 From: ShimaginAndrey Date: Tue, 29 Jun 2021 18:38:04 +0300 Subject: [PATCH 2/2] Correct dialog window --- .../mobile/src/controller/add/AddFilter.jsx | 9 ++++++--- apps/spreadsheeteditor/mobile/src/less/app.less | 12 ------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx index 917e46388..634b8d32d 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx @@ -44,6 +44,9 @@ class AddFilterController extends Component { const { t } = this.props; const _t = t('View.Add', {returnObjects: true}); + f7.popup.close('.add-popup'); + f7.popover.close('#add-popover'); + let typeCheck = type == 'down' ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending; if( api.asc_sortCellsRangeExpand()) { f7.dialog.create({ @@ -52,23 +55,23 @@ class AddFilterController extends Component { buttons: [ { text: _t.txtExpand, + bold: true, onClick: () => { api.asc_sortColFilter(typeCheck, '', undefined, undefined, true); - f7.popup.close('.add-popup'); } }, { text: _t.txtSortSelected, + bold: true, onClick: () => { api.asc_sortColFilter(typeCheck, '', undefined, undefined); - f7.popup.close('.add-popup'); } }, { text: _t.textCancel } ], - cssClass: 'type-sort' + verticalButtons: true, }).open(); } else api.asc_sortColFilter(typeCheck, '', undefined, undefined, api.asc_sortCellsRangeExpand() !== null); diff --git a/apps/spreadsheeteditor/mobile/src/less/app.less b/apps/spreadsheeteditor/mobile/src/less/app.less index 281be641d..a3bcb96d9 100644 --- a/apps/spreadsheeteditor/mobile/src/less/app.less +++ b/apps/spreadsheeteditor/mobile/src/less/app.less @@ -84,15 +84,3 @@ } } } - -.type-sort{ - - .dialog-inner{ - text-align: center; - } - .dialog-buttons{ - height: 130px; - flex-direction: column; - justify-content: space-between; - } -} \ No newline at end of file