Merge pull request #1909 from Basher03/feature/cell-style-groups

Groups table templates in documenteditor and presentationeditor
This commit is contained in:
Julia Radzhabova 2022-08-24 01:55:21 +03:00 committed by GitHub
commit a7c0bcade1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 300 additions and 27 deletions

View file

@ -353,6 +353,32 @@
.view .dataview, .dropdown-menu {
padding: 1px;
}
.dataview {
.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 {

View file

@ -761,6 +761,14 @@ define([
this._state.beginPreviewStyles = true;
this._state.currentStyleFound = false;
this._state.previewStylesCount = count;
this._state.groups = {
'menu-table-group-custom': {id: 'menu-table-group-custom', caption: this.txtGroupTable_Custom, index: 0, templateCount: 0},
'menu-table-group-plain': {id: 'menu-table-group-plain', caption: this.txtGroupTable_Plain, index: 1, templateCount: 0},
'menu-table-group-grid': {id: 'menu-table-group-grid', caption: this.txtGroupTable_Grid, index: 2, templateCount: 0},
'menu-table-group-list': {id: 'menu-table-group-list', caption: this.txtGroupTable_List, index: 3, templateCount: 0},
'menu-table-group-bordered-and-lined': {id: 'menu-table-group-bordered-and-lined', caption: this.txtGroupTable_BorderedAndLined, index: 4, templateCount: 0},
'menu-table-group-no-name': {id: 'menu-table-group-no-name', caption: '&nbsp', index: 5, templateCount: 0},
};
},
onEndTableStylesPreview: function(){
@ -774,29 +782,73 @@ define([
onAddTableStylesPreview: function(Templates){
var self = this;
var arr = [];
_.each(Templates, function(template){
var tip = template.asc_getDisplayName();
var groupItem = '';
if (template.asc_getType()==0) {
['Table Grid', 'Plain Table', 'Grid Table', 'List Table', 'Light', 'Dark', 'Colorful', 'Accent'].forEach(function(item){
var str = 'txtTable_' + item.replace(' ', '');
var arr = tip.split(' ');
if(new RegExp('Table Grid', 'i').test(tip)){
groupItem = 'menu-table-group-plain';
}
else if(new RegExp('Lined|Bordered', 'i').test(tip)) {
groupItem = 'menu-table-group-bordered-and-lined';
}
else{
if(arr[0]){
groupItem = 'menu-table-group-' + arr[0].toLowerCase();
}
if(self._state.groups.hasOwnProperty(groupItem) == false) {
groupItem = 'menu-table-group-no-name';
}
}
['Table Grid', 'Plain Table', 'Grid Table', 'List Table', 'Light', 'Dark', 'Colorful', 'Accent', 'Bordered & Lined', 'Bordered', 'Lined'].forEach(function(item){
var str = 'txtTable_' + item.replace('&', 'And').replace(new RegExp(' ', 'g'), '');
if (self[str])
tip = tip.replace(item, self[str]);
});
}
arr.push({
else {
groupItem = 'menu-table-group-custom'
}
var templateObj = {
imageUrl: template.asc_getImage(),
id : Common.UI.getId(),
group : groupItem,
templateId: template.asc_getId(),
tip : tip
});
};
var templateIndex = 0;
for(var group in self._state.groups) {
if(self._state.groups[group].index <= self._state.groups[groupItem].index) {
templateIndex += self._state.groups[group].templateCount;
}
}
if (self._state.beginPreviewStyles) {
self._state.beginPreviewStyles = false;
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.groups.reset(self._state.groups[groupItem]);
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.reset(templateObj);
self.mnuTableTemplatePicker.groups.comparator = function(item) {
return item.get('index');
};
}
else {
if(self._state.groups[groupItem].templateCount == 0) {
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.groups.add(self._state.groups[groupItem]);
}
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.add(templateObj, {at: templateIndex});
}
self._state.groups[groupItem].templateCount += 1;
});
if (this._state.beginPreviewStyles) {
this._state.beginPreviewStyles = false;
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.reset(arr);
} else
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.add(arr);
!this._state.currentStyleFound && this.selectCurrentTableStyle();
},
@ -989,7 +1041,15 @@ define([
txtTable_Dark: 'Dark',
txtTable_Colorful: 'Colorful',
txtTable_Accent: 'Accent',
textConvert: 'Convert Table to Text'
txtTable_Lined: 'Lined',
txtTable_Bordered: 'Bordered',
txtTable_BorderedAndLined: 'Bordered & Lined',
txtGroupTable_Custom: 'Custom',
txtGroupTable_Plain: 'Plain Tables',
txtGroupTable_Grid: 'Grid Tables',
txtGroupTable_List: 'List Tables',
txtGroupTable_BorderedAndLined: 'Bordered & Lined Tables',
textConvert: 'Convert Table to Text',
}, DE.Views.TableSettings || {}));
});

View file

@ -2563,12 +2563,20 @@
"DE.Views.TableSettings.txtNoBorders": "No borders",
"DE.Views.TableSettings.txtTable_Accent": "Accent",
"DE.Views.TableSettings.txtTable_Colorful": "Colorful",
"DE.Views.TableSettings.txtTable_Lined": "Lined",
"DE.Views.TableSettings.txtTable_Bordered": "Bordered",
"DE.Views.TableSettings.txtTable_BorderedAndLined": "Bordered & Lined",
"DE.Views.TableSettings.txtTable_Dark": "Dark",
"DE.Views.TableSettings.txtTable_GridTable": "Grid Table",
"DE.Views.TableSettings.txtTable_Light": "Light",
"DE.Views.TableSettings.txtTable_ListTable": "List Table",
"DE.Views.TableSettings.txtTable_PlainTable": "Plain Table",
"DE.Views.TableSettings.txtTable_TableGrid": "Table Grid",
"DE.Views.TableSettings.txtGroupTable_Custom": "Custom",
"DE.Views.TableSettings.txtGroupTable_Plain": "Plain Tables",
"DE.Views.TableSettings.txtGroupTable_Grid": "Grid Tables",
"DE.Views.TableSettings.txtGroupTable_List": "List Tables",
"DE.Views.TableSettings.txtGroupTable_BorderedAndLined": "Bordered & Lined Tables",
"DE.Views.TableSettingsAdvanced.textAlign": "Alignment",
"DE.Views.TableSettingsAdvanced.textAlignment": "Alignment",
"DE.Views.TableSettingsAdvanced.textAllowSpacing": "Spacing between cells",

View file

@ -2532,6 +2532,14 @@
"DE.Views.TableSettings.txtTable_ListTable": "Список-таблица",
"DE.Views.TableSettings.txtTable_PlainTable": "Таблица простая",
"DE.Views.TableSettings.txtTable_TableGrid": "Сетка таблицы",
"DE.Views.TableSettings.txtTable_Lined": "C подкладкой",
"DE.Views.TableSettings.txtTable_Bordered": "C границей",
"DE.Views.TableSettings.txtTable_BorderedAndLined": "C границей и подкладкой",
"DE.Views.TableSettings.txtGroupTable_Custom": "Пользовательский",
"DE.Views.TableSettings.txtGroupTable_Plain": "Таблицы простые",
"DE.Views.TableSettings.txtGroupTable_Grid": "Таблицы сеткой",
"DE.Views.TableSettings.txtGroupTable_List": "Таблицы списком",
"DE.Views.TableSettings.txtGroupTable_BorderedAndLined": "Таблицы с границей и подкладкой",
"DE.Views.TableSettingsAdvanced.textAlign": "Выравнивание",
"DE.Views.TableSettingsAdvanced.textAlignment": "Выравнивание",
"DE.Views.TableSettingsAdvanced.textAllowSpacing": "Интервалы между ячейками",

View file

@ -168,3 +168,25 @@
margin-top: 4px;
}
}
#id-table-menu-template {
.group-description {
padding: 3px 0 3px 10px;
.font-weight-bold();
}
.group-items-container {
.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;
}
}
}
}

View file

@ -694,6 +694,14 @@ define([
this._state.beginPreviewStyles = true;
this._state.currentStyleFound = false;
this._state.previewStylesCount = count;
this._state.groups = {
'menu-table-group-custom': {id: 'menu-table-group-custom', caption: this.txtGroupTable_Custom, index: 0, templateCount: 0},
'menu-table-group-optimal': {id: 'menu-table-group-optimal', caption: this.txtGroupTable_Optimal, index: 1, templateCount: 0},
'menu-table-group-light': {id: 'menu-table-group-light', caption: this.txtGroupTable_Light, index: 2, templateCount: 0},
'menu-table-group-medium': {id: 'menu-table-group-medium', caption: this.txtGroupTable_Medium, index: 3, templateCount: 0},
'menu-table-group-dark': {id: 'menu-table-group-dark', caption: this.txtGroupTable_Dark, index: 4, templateCount: 0},
'menu-table-group-no-name': {id: 'menu-table-group-no-name', caption: '&nbsp', index: 5, templateCount: 0},
};
},
onEndTableStylesPreview: function(){
@ -707,28 +715,68 @@ define([
onAddTableStylesPreview: function(Templates){
var self = this;
var arr = [];
_.each(Templates, function(template){
var tip = template.asc_getDisplayName();
var groupItem = '';
if (template.asc_getType()==0) {
var arr = tip.split(' ');
if(new RegExp('No Style|Themed Style', 'i').test(tip)){
groupItem = 'menu-table-group-optimal';
}
else{
if(arr[0]){
groupItem = 'menu-table-group-' + arr[0].toLowerCase();
}
if(self._state.groups.hasOwnProperty(groupItem) == false) {
groupItem = 'menu-table-group-no-name';
}
}
['No Style', 'No Grid', 'Table Grid', 'Themed Style', 'Light Style', 'Medium Style', 'Dark Style', 'Accent'].forEach(function(item){
var str = 'txtTable_' + item.replace(' ', '');
if (self[str])
tip = tip.replace(new RegExp(item, 'g'), self[str]);
});
}
arr.push({
else {
groupItem = 'menu-table-group-custom'
}
var templateObj = {
imageUrl: template.asc_getImage(),
id : Common.UI.getId(),
templateId: template.asc_getId(),
group : groupItem,
tip : tip
});
};
var templateIndex = 0;
for(var group in self._state.groups) {
if(self._state.groups[group].index <= self._state.groups[groupItem].index) {
templateIndex += self._state.groups[group].templateCount;
}
}
if (self._state.beginPreviewStyles) {
self._state.beginPreviewStyles = false;
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.groups.reset(self._state.groups[groupItem]);
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.reset(templateObj);
self.mnuTableTemplatePicker.groups.comparator = function(item) {
return item.get('index');
};
}
else {
if(self._state.groups[groupItem].templateCount == 0) {
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.groups.add(self._state.groups[groupItem]);
}
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.add(templateObj, {at: templateIndex});
}
self._state.groups[groupItem].templateCount += 1;
});
if (this._state.beginPreviewStyles) {
this._state.beginPreviewStyles = false;
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.reset(arr);
} else
self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.add(arr);
!this._state.currentStyleFound && this.selectCurrentTableStyle();
},
@ -878,7 +926,12 @@ define([
txtTable_LightStyle: 'Light Style',
txtTable_MediumStyle: 'Medium Style',
txtTable_DarkStyle: 'Dark Style',
txtTable_Accent: 'Accent'
txtTable_Accent: 'Accent',
txtGroupTable_Custom: 'Custom',
txtGroupTable_Optimal: 'Best Match for Document',
txtGroupTable_Light: 'Light',
txtGroupTable_Medium: 'Medium',
txtGroupTable_Dark: 'Dark',
}, PE.Views.TableSettings || {}));
});

View file

@ -2088,6 +2088,11 @@
"PE.Views.TableSettings.txtTable_NoStyle": "No Style",
"PE.Views.TableSettings.txtTable_TableGrid": "Table Grid",
"PE.Views.TableSettings.txtTable_ThemedStyle": "Themed Style",
"PE.Views.TableSettings.txtGroupTable_Custom": "Custom",
"PE.Views.TableSettings.txtGroupTable_Optimal": "Best Match for Document",
"PE.Views.TableSettings.txtGroupTable_Light": "Light",
"PE.Views.TableSettings.txtGroupTable_Medium": "Medium",
"PE.Views.TableSettings.txtGroupTable_Dark": "Dark",
"PE.Views.TableSettingsAdvanced.textAlt": "Alternative Text",
"PE.Views.TableSettingsAdvanced.textAltDescription": "Description",
"PE.Views.TableSettingsAdvanced.textAltTip": "The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart, or table.",

View file

@ -2078,6 +2078,11 @@
"PE.Views.TableSettings.txtTable_NoStyle": "Нет стиля",
"PE.Views.TableSettings.txtTable_TableGrid": "сетка таблицы",
"PE.Views.TableSettings.txtTable_ThemedStyle": "Стиль из темы",
"PE.Views.TableSettings.txtGroupTable_Custom": "Пользовательский",
"PE.Views.TableSettings.txtGroupTable_Optimal": "Оптимальный для документа",
"PE.Views.TableSettings.txtGroupTable_Light": "Светлый",
"PE.Views.TableSettings.txtGroupTable_Medium": "Средний",
"PE.Views.TableSettings.txtGroupTable_Dark": "Темный",
"PE.Views.TableSettingsAdvanced.textAlt": "Альтернативный текст",
"PE.Views.TableSettingsAdvanced.textAltDescription": "Описание",
"PE.Views.TableSettingsAdvanced.textAltTip": "Альтернативное текстовое представление информации о визуальном объекте, которое будет зачитываться для людей с нарушениями зрения или когнитивными нарушениями, чтобы помочь им лучше понять, какую информацию содержит изображение, автофигура, диаграмма или таблица.",

View file

@ -102,3 +102,25 @@
}
}
}
#id-table-menu-template {
.group-description {
padding: 3px 0 3px 10px;
.font-weight-bold();
}
.group-items-container {
.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;
}
}
}
}

View file

@ -355,8 +355,8 @@ define([
var self = this,
styles = this.view.pivotStyles;
this._isTemplatesChanged = true;
var count = styles.menuPicker.store.length;
if (count>0 && count==Templates.length) {
var data = styles.menuPicker.dataViewItems;
data && _.each(Templates, function(template, index){
@ -367,20 +367,62 @@ define([
styles.fieldPicker.store.reset(styles.fieldPicker.store.models);
} else {
styles.menuPicker.store.reset([]);
var arr = [];
_.each(Templates, function(template){
arr.push({
var templates = [];
var groups = [
{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(),
name : template.asc_getName(),
caption : template.asc_getDisplayName(),
type : template.asc_getType(),
imageUrl : template.asc_getImage(),
group : groupItem,
allowSelected : true,
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,
itemHeight : 49,
menuMaxHeight : 300,
groups : new Common.UI.DataViewGroupStore(),
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells'], _set['PivotTables']],
beforeOpenHandler: function(e) {
var cmp = this,
@ -428,7 +429,14 @@ define([
tipSubtotals: 'Show or hide subtotals',
txtSelect: 'Select',
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 || {}));
});

View file

@ -2766,6 +2766,13 @@
"SSE.Views.PivotTable.tipSubtotals": "Show or hide subtotals",
"SSE.Views.PivotTable.txtCreate": "Insert 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.txtSelect": "Select",
"SSE.Views.PrintSettings.btnDownload": "Save & Download",

View file

@ -2760,6 +2760,13 @@
"SSE.Views.PivotTable.tipSubtotals": "Показать или скрыть промежуточные итоги",
"SSE.Views.PivotTable.txtCreate": "Вставить таблицу",
"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.txtSelect": "Выделить",
"SSE.Views.PrintSettings.btnDownload": "Сохранить и скачать",