From a93e9923fce490aa65728dda22045cdbdd9552de Mon Sep 17 00:00:00 2001 From: Danis Date: Tue, 14 Oct 2025 13:11:16 +0400 Subject: [PATCH] added show&hide in format --- .../main/app/controller/Toolbar.js | 36 ++++++++++ .../main/app/view/Toolbar.js | 70 ++++++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 6 ++ 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 29edc2b136..156a7babe4 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -508,6 +508,9 @@ define([ if (toolbar.btnCondFormat.rendered) { toolbar.btnCondFormat.menu.on('show:before', _.bind(this.onShowBeforeCondFormat, this, this.toolbar, 'toolbar')); } + if (toolbar.btnFormatCell.rendered) { + toolbar.btnFormatCell.menu.on('show:before', _.bind(this.onShowBeforeCellFormat, this, this.toolbar)); + } toolbar.btnInsertChartRecommend.on('click', _.bind(this.onChartRecommendedClick, this)); toolbar.btnFillNumbers.menu.on('item:click', _.bind(this.onFillNumMenu, this)); toolbar.btnFillNumbers.menu.on('show:before', _.bind(this.onShowBeforeFillNumMenu, this)); @@ -1695,6 +1698,39 @@ define([ Common.component.Analytics.trackEvent('ToolBar', 'Cell delete'); }, + onShowBeforeCellFormat: function(cmp, item, e) { + if (cmp.mnuShowSheets.menu.items.length>0) return; + + cmp.btnFormatCell.menu.items[2].menu.on('item:click', _.bind(this.onCellFormatMenu, this)); + cmp.btnFormatCell.menu.items[3].menu.on('item:click', _.bind(this.onCellFormatMenu, this)); + + cmp.mnuShowSheets.menu.addItem({caption: 'hello', type: 'asdasd', value: 'asd'}) + // Common.NotificationCenter.trigger('edit:complete', this.toolbar); + // Common.component.Analytics.trackEvent('ToolBar', 'Cell delete'); + }, + + onCellFormatMenu: function(menu, item, e) { + if (!this.api) return; + // let statusBar = this.getApplication().getController('Statusbar'); + // statusBar.setApi(this.api).hideWorksheet(true, 1) + // let selectTabs = this.statusbar.tabbar.selectTabs, + // arrIndex = []; + // selectTabs.forEach(function (item) { + // arrIndex.push(item.sheetindex); + // }); + + if (item.value === 'hideCell') + this.api[item.options.isRowMenu ? 'asc_hideRows' : 'asc_hideColumns'](); + if (item.value === 'showCell') + this.api[item.options.isRowMenu ? 'asc_showRows' : 'asc_showColumns'](); + if (item.value === 'hideSheet') { + // setTimeout(function () { + // statusBar.setApi(this.api).hideWorksheet(true, 1) + // }, 1); + } + console.log(item); + }, + onColorSchemaClick: function(menu, item) { if (this.api) { this.api.asc_ChangeColorSchemeByIdx(item.value); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 7fc17baf5c..5df74743e7 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1943,6 +1943,23 @@ define([ label: me.tipDeleteOpt }; + me.btnFormatCell = new Common.UI.Button({ + id : 'id-toolbar-btn-formatcell', + cls : 'btn-toolbar x-huge icon-top', + iconCls : 'toolbar__icon btn-formatcell', + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.itemsDisabled, _set.lostConnect, _set.coAuth, _set.userProtected], + caption : me.textCellFormat, + menu : true, + action: 'format-cell', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -6' + }); + me.shortcutHints.OpenDeleteCellsWindow = { + btn: me.btnFormatCell, + label: me.tipDeleteOpt + }; + me.btnCondFormat = new Common.UI.Button({ id : 'id-toolbar-btn-condformat', cls : 'btn-toolbar', @@ -2428,7 +2445,7 @@ define([ me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, me.btnMerge, me.btnTextDir, me.btnInsertFormula, me.btnNamedRange, me.btnFillNumbers, me.btnIncDecimal, me.btnInsertShape, me.btnInsertSmartArt, me.btnInsertEquation, me.btnInsertSymbol, me.btnInsertSlicer, me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, - me.btnTableTemplate, me.btnCellStyle, me.btnPercentStyle, me.btnCommaStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnCondFormat, + me.btnTableTemplate, me.btnCellStyle, me.btnPercentStyle, me.btnCommaStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnFormatCell, me.btnCondFormat, me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink, me.btnInsertChart, me.btnInsertChartRecommend, me.btnColorSchemas, me.btnInsertSparkline, me.btnCopy, me.btnPaste, me.btnCut, me.btnSelectAll, me.btnReplace, me.listStyles, me.btnPrint, @@ -2621,6 +2638,7 @@ define([ _injectComponent('#slot-btn-copystyle', this.btnCopyStyle); _injectComponent('#slot-btn-cell-ins', this.btnAddCell); _injectComponent('#slot-btn-cell-del', this.btnDeleteCell); + _injectComponent('#slot-btn-cell-format', this.btnFormatCell); _injectComponent('#slot-btn-colorschemas', this.btnColorSchemas); _injectComponent('#slot-btn-search', this.btnSearch); _injectComponent('#slot-btn-inschart', this.btnInsertChart); @@ -3269,6 +3287,56 @@ define([ ] })); } + + if (this.btnFormatCell && this.btnFormatCell.rendered) { + this.btnFormatCell.setMenu( new Common.UI.Menu({ + items: [ + { + // caption : this.txtRowHeight, ///// Перевод не работатет + // menu : new Common.UI.Menu({ + // cls: 'shifted-right', + // menuAlign: 'tl-tr', + // items : [ + // { caption: this.txtAutoRowHeight, value: 'auto-row-height' }, + // { caption: this.txtCustomRowHeight, value: 'row-height' } + // ] + // }) + }, + {caption: '--'}, + { + caption : this.textHide, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [ + { caption: this.textRows, type: Asc.c_oAscCFType.cellIs, value: 'hideCell', isRowMenu: true }, + { caption: this.textColumns, type: Asc.c_oAscCFType.cellIs, value: 'hideCell', isRowMenu: false }, + { caption: this.textSheet, type: Asc.c_oAscCFType.cellIs, value: 'hideSheet', isRowMenu: false } + ] + }) + }, + { + caption : this.textShow, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + items: [ + { caption: this.textRows, type: Asc.c_oAscCFType.cellIs, value: 'showCell', isRowMenu: true }, + { caption: this.textColumns, type: Asc.c_oAscCFType.cellIs, value: 'showCell', isRowMenu: false }, + this.mnuShowSheets = new Common.UI.MenuItem({ + caption: this.textSheet, + type: Asc.c_oAscCFType.cellIs, + menu : new Common.UI.Menu({ + menuAlign : 'tl-tr', + style: 'min-width: auto;', + items: [] + }) + }) + ] + }) + }, + {caption: '--'}, + ] + }) ) + } if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram && !this.mode.isEditOle) this.updateMetricUnit(); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 4617019d52..3a12bbda06 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -4771,6 +4771,11 @@ "SSE.Views.Toolbar.textEditVA": "Edit Visible Area", "SSE.Views.Toolbar.textEntireCol": "Entire column", "SSE.Views.Toolbar.textEntireRow": "Entire row", + "SSE.Views.Toolbar.textHide": "Hide", + "SSE.Views.Toolbar.textShow": "Show", + "SSE.Views.Toolbar.textRows": "Rows", + "SSE.Views.Toolbar.textColumns": "Columns", + "SSE.Views.Toolbar.textSheet": "Sheet", "SSE.Views.Toolbar.textEuro": "Euro Sign", "SSE.Views.Toolbar.textFewPages": "pages", "SSE.Views.Toolbar.textFillLeft": "Left", @@ -4867,6 +4872,7 @@ "SSE.Views.Toolbar.textWidth": "Width", "SSE.Views.Toolbar.textYen": "Yen Sign", "SSE.Views.Toolbar.textZoom": "Zoom", + "SSE.Views.Toolbar.textCellFormat": "Format", "SSE.Views.Toolbar.tipAlignBottom": "Align bottom", "SSE.Views.Toolbar.tipAlignCenter": "Align center", "SSE.Views.Toolbar.tipAlignJust": "Justified",