Added groups fot pivot table templates

This commit is contained in:
Basher 2022-07-30 14:04:45 +03:00
parent 34979a046a
commit 47048623e2
5 changed files with 95 additions and 9 deletions

View file

@ -350,9 +350,31 @@
position: static; position: static;
} }
.view .dataview, .dropdown-menu { .dataview {
padding: 1px; .item {
&:hover {
.box-shadow(0 0 0 2px @border-preview-hover-ie) !important;
.box-shadow(0 0 0 @scaled-two-px-value @border-preview-hover) !important;
}
&.selected {
.box-shadow(0 0 0 2px @border-preview-select-ie) !important;
.box-shadow(0 0 0 @scaled-two-px-value @border-preview-select) !important;
}
}
} }
.dropdown-menu {
padding: 5px 1px 5px 1px;
.dataview {
.group-description {
padding: 3px 0 3px 10px;
.font-weight-bold();
}
}
}
} }
.combo-slicer-style { .combo-slicer-style {

View file

@ -355,8 +355,8 @@ define([
var self = this, var self = this,
styles = this.view.pivotStyles; styles = this.view.pivotStyles;
this._isTemplatesChanged = true; this._isTemplatesChanged = true;
var count = styles.menuPicker.store.length; var count = styles.menuPicker.store.length;
if (count>0 && count==Templates.length) { if (count>0 && count==Templates.length) {
var data = styles.menuPicker.dataViewItems; var data = styles.menuPicker.dataViewItems;
data && _.each(Templates, function(template, index){ data && _.each(Templates, function(template, index){
@ -367,20 +367,62 @@ define([
styles.fieldPicker.store.reset(styles.fieldPicker.store.models); styles.fieldPicker.store.reset(styles.fieldPicker.store.models);
} else { } else {
styles.menuPicker.store.reset([]); styles.menuPicker.store.reset([]);
var arr = []; var templates = [];
_.each(Templates, function(template){ var groups = [
arr.push({ {id: 'menu-table-group-custom', caption: self.view.__proto__.txtGroupPivot_Custom, templates: []},
{id: 'menu-table-group-light', caption: self.view.__proto__.txtGroupPivot_Light, templates: []},
{id: 'menu-table-group-medium', caption: self.view.__proto__.txtGroupPivot_Medium, templates: []},
{id: 'menu-table-group-dark', caption: self.view.__proto__.txtGroupPivot_Dark, templates: []},
{id: 'menu-table-group-no-name', caption: '&nbsp', templates: []},
];
_.each(Templates, function(template, index){
var tip = template.asc_getDisplayName();
var groupItem = '';
if (template.asc_getType()==0) {
var arr = tip.split(' '),
last = arr.pop();
if(tip == 'None'){
groupItem = 'menu-table-group-light';
}
else {
if(arr.length > 0){
groupItem = 'menu-table-group-' + arr[arr.length - 1].toLowerCase();
}
if(groups.some(function(item) {return item.id === groupItem;}) == false) {
groupItem = 'menu-table-group-no-name';
}
}
arr = 'txtTable_' + arr.join('');
tip = self.view.__proto__[arr] ? self.view.__proto__[arr] + ' ' + last : tip;
}
else {
groupItem = 'menu-table-group-custom'
}
groups.filter(function(item){ return item.id == groupItem; })[0].templates.push({
id : Common.UI.getId(), id : Common.UI.getId(),
name : template.asc_getName(), name : template.asc_getName(),
caption : template.asc_getDisplayName(), caption : template.asc_getDisplayName(),
type : template.asc_getType(), type : template.asc_getType(),
imageUrl : template.asc_getImage(), imageUrl : template.asc_getImage(),
group : groupItem,
allowSelected : true, allowSelected : true,
selected : false, selected : false,
tip : template.asc_getDisplayName() tip : tip
}); });
}); });
styles.menuPicker.store.add(arr); groups = groups.filter(function(item, index){
return item.templates.length > 0
});
groups.forEach(function(item){
templates = templates.concat(item.templates);
delete item.templates;
});
styles.groups.reset(groups);
styles.menuPicker.store.reset(templates);
} }
}, },

View file

@ -276,6 +276,7 @@ define([
itemWidth : 61, itemWidth : 61,
itemHeight : 49, itemHeight : 49,
menuMaxHeight : 300, menuMaxHeight : 300,
groups : new Common.UI.DataViewGroupStore(),
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells'], _set['PivotTables']], lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells'], _set['PivotTables']],
beforeOpenHandler: function(e) { beforeOpenHandler: function(e) {
var cmp = this, var cmp = this,
@ -428,7 +429,14 @@ define([
tipSubtotals: 'Show or hide subtotals', tipSubtotals: 'Show or hide subtotals',
txtSelect: 'Select', txtSelect: 'Select',
tipSelect: 'Select entire pivot table', tipSelect: 'Select entire pivot table',
txtPivotTable: 'Pivot Table' txtPivotTable: 'Pivot Table',
txtTable_PivotStyleMedium: 'Pivot Table Style Medium',
txtTable_PivotStyleDark: 'Pivot Table Style Dark',
txtTable_PivotStyleLight: 'Pivot Table Style Light',
txtGroupPivot_Custom: 'Custom',
txtGroupPivot_Light: 'Light',
txtGroupPivot_Medium: 'Medium',
txtGroupPivot_Dark: 'Dark'
} }
}()), SSE.Views.PivotTable || {})); }()), SSE.Views.PivotTable || {}));
}); });

View file

@ -2762,6 +2762,13 @@
"SSE.Views.PivotTable.tipSubtotals": "Show or hide subtotals", "SSE.Views.PivotTable.tipSubtotals": "Show or hide subtotals",
"SSE.Views.PivotTable.txtCreate": "Insert Table", "SSE.Views.PivotTable.txtCreate": "Insert Table",
"SSE.Views.PivotTable.txtPivotTable": "Pivot Table", "SSE.Views.PivotTable.txtPivotTable": "Pivot Table",
"SSE.Views.PivotTable.txtTable_PivotStyleMedium": "Pivot Table Style Medium",
"SSE.Views.PivotTable.txtTable_PivotStyleDark": "Pivot Table Style Dark",
"SSE.Views.PivotTable.txtTable_PivotStyleLight": "Pivot Table Style Light",
"SSE.Views.PivotTable.txtGroupPivot_Custom": "Custom",
"SSE.Views.PivotTable.txtGroupPivot_Light": "Light",
"SSE.Views.PivotTable.txtGroupPivot_Medium": "Medium",
"SSE.Views.PivotTable.txtGroupPivot_Dark": "Dark",
"SSE.Views.PivotTable.txtRefresh": "Refresh", "SSE.Views.PivotTable.txtRefresh": "Refresh",
"SSE.Views.PivotTable.txtSelect": "Select", "SSE.Views.PivotTable.txtSelect": "Select",
"SSE.Views.PrintSettings.btnDownload": "Save & Download", "SSE.Views.PrintSettings.btnDownload": "Save & Download",

View file

@ -2760,6 +2760,13 @@
"SSE.Views.PivotTable.tipSubtotals": "Показать или скрыть промежуточные итоги", "SSE.Views.PivotTable.tipSubtotals": "Показать или скрыть промежуточные итоги",
"SSE.Views.PivotTable.txtCreate": "Вставить таблицу", "SSE.Views.PivotTable.txtCreate": "Вставить таблицу",
"SSE.Views.PivotTable.txtPivotTable": "Сводная таблица", "SSE.Views.PivotTable.txtPivotTable": "Сводная таблица",
"SSE.Views.PivotTable.txtTable_PivotStyleMedium": "Стиль сводной таблицы: средний",
"SSE.Views.PivotTable.txtTable_PivotStyleDark": "Стиль сводной таблицы: темный",
"SSE.Views.PivotTable.txtTable_PivotStyleLight": "Стиль сводной таблицы: светлый",
"SSE.Views.PivotTable.txtGroupPivot_Custom": "Пользовательский",
"SSE.Views.PivotTable.txtGroupPivot_Light": "Светлый",
"SSE.Views.PivotTable.txtGroupPivot_Medium": "Средний",
"SSE.Views.PivotTable.txtGroupPivot_Dark": "Темный",
"SSE.Views.PivotTable.txtRefresh": "Обновить", "SSE.Views.PivotTable.txtRefresh": "Обновить",
"SSE.Views.PivotTable.txtSelect": "Выделить", "SSE.Views.PivotTable.txtSelect": "Выделить",
"SSE.Views.PrintSettings.btnDownload": "Сохранить и скачать", "SSE.Views.PrintSettings.btnDownload": "Сохранить и скачать",