[SSE] Add options for grouping cells

This commit is contained in:
Julia Radzhabova 2019-08-08 10:48:27 +03:00
parent 69051010cd
commit fc8ba6cf15
4 changed files with 67 additions and 19 deletions

View file

@ -63,7 +63,8 @@ define([
'data:ungroup': this.onUngroup,
'data:tocolumns': this.onTextToColumn,
'data:show': this.onShowClick,
'data:hide': this.onHideClick
'data:hide': this.onHideClick,
'data:groupsettings': this.onGroupSettings
}
});
@ -140,23 +141,40 @@ define([
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
onGroup: function(btn) {
var me = this,
val = me.api.asc_checkAddGroup();
if (val===null) {
(new SSE.Views.GroupDialog({
title: me.view.capBtnGroup,
props: 'rows',
handler: function (dlg, result) {
if (result=='ok') {
me.api.asc_group(dlg.getSettings());
onGroup: function(type, checked) {
if (type=='rows') {
(this.api.asc_checkAddGroup()!==undefined) && this.api.asc_group(true)
} else if (type=='columns') {
(this.api.asc_checkAddGroup()!==undefined) && this.api.asc_group(false)
} else if (type=='below') {
this.api.asc_setGroupSummary(checked, false);
} else if (type=='right') {
this.api.asc_setGroupSummary(checked, true);
} else {
var me = this,
val = me.api.asc_checkAddGroup();
if (val===null) {
(new SSE.Views.GroupDialog({
title: me.view.capBtnGroup,
props: 'rows',
handler: function (dlg, result) {
if (result=='ok') {
me.api.asc_group(dlg.getSettings());
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
} else if (val!==undefined) //undefined - error, true - rows, false - columns
me.api.asc_group(val);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
})).show();
} else if (val!==undefined) //undefined - error, true - rows, false - columns
me.api.asc_group(val);
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onGroupSettings: function(menu) {
var value = this.api.asc_getGroupSummaryBelow();
menu.items[3].setChecked(!!value, true);
value = this.api.asc_getGroupSummaryRight();
menu.items[4].setChecked(!!value, true);
},
onTextToColumn: function() {

View file

@ -54,9 +54,15 @@ define([
me.btnUngroup.on('click', function (b, e) {
me.fireEvent('data:ungroup');
});
me.btnGroup.menu.on('item:click', function (menu, item, e) {
me.fireEvent('data:group', [item.value, item.checked]);
});
me.btnGroup.on('click', function (b, e) {
me.fireEvent('data:group');
});
me.btnGroup.menu.on('show:before', function (menu, e) {
me.fireEvent('data:groupsettings', [menu]);
});
me.btnTextToColumns.on('click', function (b, e) {
me.fireEvent('data:tocolumns');
});
@ -105,7 +111,8 @@ define([
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-cell-group',
caption: this.capBtnGroup,
split: false,
split: true,
menu: true,
disabled: true,
lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.sheetLock, _set.lostConnect, _set.coAuth]
});
@ -193,6 +200,17 @@ define([
me.btnUngroup.setMenu(_menu);
me.btnGroup.updateHint(me.tipGroup);
_menu = new Common.UI.Menu({
items: [
{caption: me.textGroupRows, value: 'rows'},
{caption: me.textGroupColumns, value: 'columns'},
{caption: '--'},
{caption: me.textBelow, value: 'below', checkable: true},
{caption: me.textRightOf, value: 'right', checkable: true}
]
});
me.btnGroup.setMenu(_menu);
me.btnTextToColumns.updateHint(me.tipToColumns);
me.btnsSortDown.forEach( function(btn) {
@ -243,13 +261,17 @@ define([
capBtnUngroup: 'Ungroup',
textRows: 'Ungroup rows',
textColumns: 'Ungroup columns',
textGroupRows: 'Group rows',
textGroupColumns: 'Group columns',
textClear: 'Clear outline',
tipGroup: 'Group range of cells',
tipUngroup: 'Ungroup range of cells',
capBtnTextToCol: 'Text to Columns',
tipToColumns: 'Separate cell text into columns',
capBtnTextShow: 'Show details',
capBtnTextHide: 'Hide details'
capBtnTextHide: 'Hide details',
textBelow: 'Summary rows below detail',
textRightOf: 'Summary columns to right of detail'
}
}()), SSE.Views.DataTab || {}));
});

View file

@ -1349,6 +1349,10 @@
"SSE.Views.DataTab.tipGroup": "Group range of cells",
"SSE.Views.DataTab.tipToColumns": "Separate cell text into columns",
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
"SSE.Views.DataTab.textGroupRows": "Group rows",
"SSE.Views.DataTab.textGroupColumns": "Group columns",
"SSE.Views.DataTab.textBelow": "Summary rows below detail",
"SSE.Views.DataTab.textRightOf": "Summary columns to right of detail",
"SSE.Views.DigitalFilterDialog.cancelButtonText": "Cancel",
"SSE.Views.DigitalFilterDialog.capAnd": "And",
"SSE.Views.DigitalFilterDialog.capCondition1": "equals",

View file

@ -1348,6 +1348,10 @@
"SSE.Views.DataTab.tipGroup": "Сгруппировать диапазон ячеек",
"SSE.Views.DataTab.tipToColumns": "Разделить текст ячейки по столбцам",
"SSE.Views.DataTab.tipUngroup": "Разгруппировать диапазон ячеек",
"SSE.Views.DataTab.textGroupRows": "Сгруппировать строки",
"SSE.Views.DataTab.textGroupColumns": "Сгруппировать столбцы",
"SSE.Views.DataTab.textBelow": "Итоги в строках под данными",
"SSE.Views.DataTab.textRightOf": "Итоги в столбцах справа от данных",
"SSE.Views.DigitalFilterDialog.cancelButtonText": "Отмена",
"SSE.Views.DigitalFilterDialog.capAnd": "И",
"SSE.Views.DigitalFilterDialog.capCondition1": "равно",