From 4236ed0ee791f82e4b5a44c1c1aec41869e8690c Mon Sep 17 00:00:00 2001 From: Basher <89542751+Basher03@users.noreply.github.com> Date: Wed, 13 Jul 2022 19:22:06 +0300 Subject: [PATCH] Added style groups for table cells --- .../main/app/controller/Toolbar.js | 17 ++++++++++++++++- .../spreadsheeteditor/main/app/view/Toolbar.js | 18 ++++++++++++++++-- apps/spreadsheeteditor/main/locale/ru.json | 6 ++++++ .../main/resources/less/toolbar.less | 18 ++++++++++++++++++ 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 92ecc9081..7af54c087 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2198,6 +2198,13 @@ define([ var mainController = this.getApplication().getController('Main'); var count = listStyles.menuPicker.store.length; var rec = listStyles.menuPicker.getSelectedRec(); + var groups = []; + for (let i = 0; i < 4; i++) { groups.push('menu-style-group-color'); } + for (let i = 0; i < 8; i++) { groups.push('menu-style-group-model'); } + for (let i = 0; i < 6; i++) { groups.push('menu-style-group-title'); } + for (let i = 0; i < 24; i++) { groups.push('menu-style-group-themed'); } + for (let i = 0; i < 5; i++) { groups.push('menu-style-group-number'); } + if (count>0 && count==styles.length) { var data = listStyles.menuPicker.dataViewItems; data && _.each(styles, function(style, index){ @@ -2211,14 +2218,22 @@ define([ }); } else { var arr = []; - _.each(styles, function(style){ + var countCustomStyles = 0; + _.each(styles, function(style, index){ arr.push({ imageUrl: style.asc_getImage(), name : style.asc_getName(), + group : (style.asc_getType() == 0 ? groups[index - countCustomStyles] : 'menu-style-group-custom'), tip : mainController.translationTable[style.get_Name()] || style.get_Name(), uid : Common.UI.getId() }); + if(style.asc_getType() == 1){ + countCustomStyles += 1; + } }); + if(countCustomStyles == 0){ + listStyles.groups.remove(listStyles.groups.models.find(style => style.id === 'menu-style-group-custom')); + } listStyles.menuPicker.store.reset(arr); } if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) { diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index f92258cf8..29d6be757 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1285,7 +1285,15 @@ define([ itemWidth : 112, itemHeight : 40, style: 'min-width:158px;', - menuMaxHeight : 226, + groups: new Common.UI.DataViewGroupStore([ + {id: 'menu-style-group-custom', caption: this.textCustom }, + {id: 'menu-style-group-color', caption: this.textGoodBadAndNeutral }, + {id: 'menu-style-group-model', caption: this.textDataAndModel }, + {id: 'menu-style-group-title', caption: this.textTitlesAndHeadings }, + {id: 'menu-style-group-themed', caption: this.textThemedCallStyles }, + {id: 'menu-style-group-number', caption: this.textNumberFormat } + ]), + menuMaxHeight : 350, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], dataHint : '1', dataHintDirection: 'bottom', @@ -3280,6 +3288,12 @@ define([ textDone: 'Done', tipTextFormatting: 'More text formatting tools', tipHAligh: 'Horizontal Align', - tipVAligh: 'Vertical Align' + tipVAligh: 'Vertical Align', + textCustom: 'Custom', + textGoodBadAndNeutral: 'Good, Bad, and Neutral', + textDataAndModel: 'Data and Model', + textTitlesAndHeadings: 'Titles and Headings', + textThemedCallStyles: 'Themed Call Styles', + textNumberFormat: 'Number Format' }, SSE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/ru.json b/apps/spreadsheeteditor/main/locale/ru.json index b284af0d7..099fca402 100644 --- a/apps/spreadsheeteditor/main/locale/ru.json +++ b/apps/spreadsheeteditor/main/locale/ru.json @@ -3449,6 +3449,12 @@ "SSE.Views.Toolbar.textVertical": "Вертикальный текст", "SSE.Views.Toolbar.textWidth": "Ширина", "SSE.Views.Toolbar.textZoom": "Масштаб", + "SSE.Views.Toolbar.textCustom": "Пользовательский", + "SSE.Views.Toolbar.textGoodBadAndNeutral": "Хороший, плохой и нейтральный", + "SSE.Views.Toolbar.textDataAndModel": "Данные и модель", + "SSE.Views.Toolbar.textTitlesAndHeadings": "Названия и заголовки", + "SSE.Views.Toolbar.textThemedCallStyles": "Стили ячеек с темой", + "SSE.Views.Toolbar.textNumberFormat": "Числовой формат", "SSE.Views.Toolbar.tipAlignBottom": "Выровнять по нижнему краю", "SSE.Views.Toolbar.tipAlignCenter": "Выровнять по центру", "SSE.Views.Toolbar.tipAlignJust": "Выровнять по ширине", diff --git a/apps/spreadsheeteditor/main/resources/less/toolbar.less b/apps/spreadsheeteditor/main/resources/less/toolbar.less index 6c84ecc9e..b16f2157e 100644 --- a/apps/spreadsheeteditor/main/resources/less/toolbar.less +++ b/apps/spreadsheeteditor/main/resources/less/toolbar.less @@ -146,3 +146,21 @@ margin-right: 2px; } } + +.combo-styles { + .menu-picker-container .dataview { + padding: 10px 0 0 2px; + } + .dropdown-menu { + padding-bottom: 5px; + } +} + +.dataview { + padding: 0 0 0 2px; + + .group-description { + padding: 3px 0 3px 10px; + .font-weight-bold(); + } +}