[SSE] Change check sorted range

This commit is contained in:
Julia Radzhabova 2021-08-11 00:24:12 +03:00
parent aad4885398
commit dea0fb93d5
6 changed files with 161 additions and 70 deletions

View file

@ -279,29 +279,52 @@ define([
},
onCustomSort: function() {
Common.NotificationCenter.trigger('protect:check', this.onCustomSortCallback, this);
},
onCustomSortCallback: function() {
var me = this;
if (this.api) {
var res = this.api.asc_sortCellsRangeExpand();
if (res) {
var config = {
width: 500,
title: this.toolbar.txtSorting,
msg: this.toolbar.txtExpandSort,
buttons: [ {caption: this.toolbar.txtExpand, primary: true, value: 'expand'},
{caption: this.toolbar.txtSortSelected, primary: true, value: 'sort'},
'cancel'],
callback: function(btn){
if (btn == 'expand' || btn == 'sort') {
setTimeout(function(){
me.showCustomSort(btn == 'expand');
},1);
switch (res) {
case Asc.c_oAscSelectionSortExpand.showExpandMessage:
var config = {
width: 500,
title: this.toolbar.txtSorting,
msg: this.toolbar.txtExpandSort,
buttons: [ {caption: this.toolbar.txtExpand, primary: true, value: 'expand'},
{caption: this.toolbar.txtSortSelected, primary: true, value: 'sort'},
'cancel'],
callback: function(btn){
if (btn == 'expand' || btn == 'sort') {
setTimeout(function(){
me.showCustomSort(btn == 'expand');
},1);
}
}
}
};
Common.UI.alert(config);
} else
me.showCustomSort(res !== null);
};
Common.UI.alert(config);
break;
case Asc.c_oAscSelectionSortExpand.showLockMessage:
var config = {
width: 500,
title: this.toolbar.txtSorting,
msg: this.toolbar.txtLockSort,
buttons: ['yes', 'no'],
primary: 'yes',
callback: function(btn){
(btn == 'yes') && setTimeout(function(){
me.showCustomSort(false);
},1);
}
};
Common.UI.alert(config);
break;
case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
me.showCustomSort(res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
break;
}
}
},
@ -326,7 +349,7 @@ define([
var me = this;
if (this.api) {
var res = this.api.asc_sortCellsRangeExpand();
if (res) {
if (res===Asc.c_oAscSelectionSortExpand.showExpandMessage) {
var config = {
width: 500,
title: this.txtRemDuplicates,
@ -343,8 +366,8 @@ define([
}
};
Common.UI.alert(config);
} else
me.showRemDuplicates(res !== null);
} else if (res !== Asc.c_oAscSelectionSortExpand.showLockMessage)
me.showRemDuplicates(res===Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
}
},

View file

@ -436,28 +436,46 @@ define([
}
if (this.api) {
var res = this.api.asc_sortCellsRangeExpand();
if (res) {
var config = {
width: 500,
title: this.txtSorting,
msg: this.txtExpandSort,
buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
{caption: this.txtSortSelected, primary: true, value: 'sort'},
'cancel'],
callback: _.bind(function(btn){
if (btn == 'expand' || btn == 'sort') {
this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, btn == 'expand');
}
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
}, this)
};
Common.UI.alert(config);
} else {
this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, res !== null);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
switch (res) {
case Asc.c_oAscSelectionSortExpand.showExpandMessage:
var config = {
width: 500,
title: this.txtSorting,
msg: this.txtExpandSort,
buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
{caption: this.txtSortSelected, primary: true, value: 'sort'},
'cancel'],
callback: _.bind(function(btn){
if (btn == 'expand' || btn == 'sort') {
this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, btn == 'expand');
}
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
}, this)
};
Common.UI.alert(config);
break;
case Asc.c_oAscSelectionSortExpand.showLockMessage:
var config = {
width: 500,
title: this.txtSorting,
msg: this.txtLockSort,
buttons: ['yes', 'no'],
primary: 'yes',
callback: _.bind(function(btn){
(btn == 'yes') && this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, false);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
}, this)
};
Common.UI.alert(config);
break;
case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
break;
}
}
},
@ -3924,7 +3942,8 @@ define([
txtImportWizard: 'Text Import Wizard',
textPasteSpecial: 'Paste special',
textStopExpand: 'Stop automatically expanding tables',
textAutoCorrectSettings: 'AutoCorrect options'
textAutoCorrectSettings: 'AutoCorrect options',
txtLockSort: 'Data is found next to your selection, but you do not have sufficient permissions to change those cells.<br>Do you wish to continue with the current selection?'
}, SSE.Controllers.DocumentHolder || {}));
});

View file

@ -1202,25 +1202,43 @@ define([
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
} else {
var me = this;
var res = this.api.asc_sortCellsRangeExpand();
if (res) {
var config = {
width: 500,
title: this.txtSorting,
msg: this.txtExpandSort,
buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
{caption: this.txtSortSelected, primary: true, value: 'sort'},
'cancel'],
callback: _.bind(function(btn){
if (btn == 'expand' || btn == 'sort') {
this.api.asc_sortColFilter(type, '', undefined, undefined, btn == 'expand');
switch (res) {
case Asc.c_oAscSelectionSortExpand.showExpandMessage:
var config = {
width: 500,
title: this.txtSorting,
msg: this.txtExpandSort,
buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
{caption: this.txtSortSelected, primary: true, value: 'sort'},
'cancel'],
callback: function(btn){
if (btn == 'expand' || btn == 'sort') {
me.api.asc_sortColFilter(type, '', undefined, undefined, btn == 'expand')
}
}
}, this)
};
Common.UI.alert(config);
} else
this.api.asc_sortColFilter(type, '', undefined, undefined, res !== null);
};
Common.UI.alert(config);
break;
case Asc.c_oAscSelectionSortExpand.showLockMessage:
var config = {
width: 500,
title: this.txtSorting,
msg: this.txtLockSort,
buttons: ['yes', 'no'],
primary: 'yes',
callback: function(btn){
(btn == 'yes') && me.api.asc_sortColFilter(type, '', undefined, undefined, false);
}
};
Common.UI.alert(config);
break;
case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
this.api.asc_sortColFilter(type, '', undefined, undefined, res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
break;
}
}
}
},
@ -4403,7 +4421,8 @@ define([
textDirectional: 'Directional',
textShapes: 'Shapes',
textIndicator: 'Indicators',
textRating: 'Ratings'
textRating: 'Ratings',
txtLockSort: 'Data is found next to your selection, but you do not have sufficient permissions to change those cells.<br>Do you wish to continue with the current selection?'
}, SSE.Controllers.Toolbar || {}));
});

View file

@ -587,6 +587,7 @@
"SSE.Controllers.DocumentHolder.txtUndoExpansion": "Undo table autoexpansion",
"SSE.Controllers.DocumentHolder.txtUseTextImport": "Use text import wizard",
"SSE.Controllers.DocumentHolder.txtWidth": "Width",
"SSE.Controllers.DocumentHolder.txtLockSort": "Data is found next to your selection, but you do not have sufficient permissions to change those cells.<br>Do you wish to continue with the current selection?",
"SSE.Controllers.FormulaDialog.sCategoryAll": "All",
"SSE.Controllers.FormulaDialog.sCategoryCube": "Cube",
"SSE.Controllers.FormulaDialog.sCategoryDatabase": "Database",
@ -1401,6 +1402,7 @@
"SSE.Controllers.Toolbar.txtTable_TableStyleMedium": "Table Style Medium",
"SSE.Controllers.Toolbar.warnLongOperation": "The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?",
"SSE.Controllers.Toolbar.warnMergeLostData": "Only the data from the upper-left cell will remain in the merged cell. <br>Are you sure you want to continue?",
"SSE.Controllers.Toolbar.txtLockSort": "Data is found next to your selection, but you do not have sufficient permissions to change those cells.<br>Do you wish to continue with the current selection?",
"SSE.Controllers.Viewport.textFreezePanes": "Freeze Panes",
"SSE.Controllers.Viewport.textFreezePanesShadow": "Show Frozen Panes Shadow",
"SSE.Controllers.Viewport.textHideFBar": "Hide Formula Bar",

View file

@ -333,7 +333,10 @@
"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?",
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"txtSorting": "Sorting",
"txtSortSelected": "Sort selected"
"txtSortSelected": "Sort selected",
"txtLockSort": "Data is found next to your selection, but you do not have sufficient permissions to change those cells.<br>Do you wish to continue with the current selection?",
"txtYes": "Yes",
"txtNo": "No"
},
"Edit": {
"notcriticalErrorTitle": "Warning",

View file

@ -48,7 +48,9 @@ class AddFilterController extends Component {
f7.popover.close('#add-popover');
let typeCheck = type == 'down' ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending;
if( api.asc_sortCellsRangeExpand()) {
let res = api.asc_sortCellsRangeExpand();
switch (res) {
case Asc.c_oAscSelectionSortExpand.showExpandMessage:
f7.dialog.create({
title: _t.txtSorting,
text: _t.txtExpandSort,
@ -63,18 +65,41 @@ class AddFilterController extends Component {
{
text: _t.txtSortSelected,
bold: true,
onClick: () => {
api.asc_sortColFilter(typeCheck, '', undefined, undefined);
onClick: () => {
api.asc_sortColFilter(typeCheck, '', undefined, undefined);
}
},
{
text: _t.textCancel
}
],
verticalButtons: true,
verticalButtons: true
}).open();
} else
api.asc_sortColFilter(typeCheck, '', undefined, undefined, api.asc_sortCellsRangeExpand() !== null);
break;
case Asc.c_oAscSelectionSortExpand.showLockMessage:
f7.dialog.create({
title: _t.txtSorting,
text: _t.txtLockSort,
buttons: [
{
text: _t.txtYes,
bold: true,
onClick: () => {
api.asc_sortColFilter(typeCheck, '', undefined, undefined, false);
}
},
{
text: _t.txtNo
}
],
verticalButtons: true
}).open();
break;
case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
api.asc_sortColFilter(typeCheck, '', undefined, undefined, res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
break;
}
}
onInsertFilter (checked) {