diff --git a/apps/common/main/lib/component/Tab.js b/apps/common/main/lib/component/Tab.js index e5615f93d..5d61c243a 100644 --- a/apps/common/main/lib/component/Tab.js +++ b/apps/common/main/lib/component/Tab.js @@ -52,7 +52,7 @@ define([ this.label = 'Tab'; this.cls = ''; this.index = -1; - this.template = _.template(['
  • ', + this.template = _.template(['
  • ', '<%- label %>', '
  • '].join('')); diff --git a/apps/spreadsheeteditor/main/app/view/Statusbar.js b/apps/spreadsheeteditor/main/app/view/Statusbar.js index 6761e16a5..6e2dcb7b4 100644 --- a/apps/spreadsheeteditor/main/app/view/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/view/Statusbar.js @@ -353,6 +353,21 @@ define([ }); }); + this.customizeStatusBarMenu = new Common.UI.Menu({ + style: 'margin-top: -14px; margin-left: -7px;', + menuAlign: 'bl-tl', + items: [ + //{template: _.template('
    ' + this.textCustomizeStatusBar + '
    ')}, + //{caption: '--'}, + {caption: this.itemAverage, value: 'average', checkable: true, checked: true, leaveopen: true}, + {caption: this.itemCount, value: 'count', checkable: true, checked: true, leaveopen: true}, + {caption: this.itemMinimum, value: 'min', checkable: true, checked: true, leaveopen: true}, + {caption: this.itemMaximum, value: 'max', checkable: true, checked: true, leaveopen: true}, + {caption: this.itemSum, value: 'sum', checkable: true, checked: true, leaveopen: true} + ], + leaveopen: true + }); + this.tabbar.$el.append(''); this.tabMenu.render(this.tabbar.$el); this.tabMenu.cmpEl.attr({tabindex: -1}); @@ -375,6 +390,28 @@ define([ this.boxZoom = $('#status-zoom-box', this.el); this.boxZoom.find('.separator').css('border-left-color','transparent'); + this.$el.append('
    '); + this.$customizeStatusBarMenu = this.$el.find('#statusbar-menu'); + this.$customizeStatusBarMenu.on({ + 'show.bs.dropdown': function () { + _.defer(function(){ + me.$customizeStatusBarMenu.find('ul').focus(); + }, 100); + }, + 'hide.bs.dropdown': function () { + _.defer(function(){ + me.api.asc_enableKeyEvents(true); + }, 100); + } + }); + this.$customizeStatusBarMenu.append(''); + this.customizeStatusBarMenu.render(this.$customizeStatusBarMenu); + this.customizeStatusBarMenu.cmpEl.attr({tabindex: -1}); + this.customizeStatusBarMenu.on('show:after', _.bind(this.onCustomizeStatusBarAfterShow, this)); + this.customizeStatusBarMenu.on('hide:after', _.bind(this.onCustomizeStatusBarAfterHide, this)); + this.customizeStatusBarMenu.on('item:click', _.bind(this.onCustomizeStatusBarClick, this)); + this.$el.on('contextmenu', _.bind(this.showCustomizeStatusBar, this)); + return this; }, @@ -641,6 +678,52 @@ define([ this.editMode = edit; }, + showCustomizeStatusBar: function (e) { + var el = $(e.target); + if ($('#status-zoom-box').find(el).length > 0 + || $(e.target).parent().hasClass('list-item') + || $('#status-tabs-scroll').find(el).length > 0 + || $('#status-addtabs-box').find(el).length > 0) return; + this.customizeStatusBarMenu.hide(); + this.customizeStatusBarMenu.atposition = { + left: e.clientX*Common.Utils.zoom(), + top: e.clientY*Common.Utils.zoom() + }; + this.customizeStatusBarMenu.show(); + }, + + onCustomizeStatusBarAfterShow: function (obj) { + if (obj.atposition) { + obj.setOffset(obj.atposition.left); + } + this.enableKeyEvents = true; + }, + + onCustomizeStatusBarAfterHide: function () { + if (!_.isUndefined(this.enableKeyEvents)) { + if (this.api) { + this.api.asc_enableKeyEvents(this.enableKeyEvents); + } + + this.enableKeyEvents = undefined; + } + }, + + onCustomizeStatusBarClick: function (o, item, event) { + var value = item.value, + checked = item.checked; + this.boxMath.find('#status-math-' + value)[checked ? 'removeClass' : 'addClass']('hide'); + if (this.boxMath.find('label').length === this.boxMath.find('label.hide').length) { + this.boxMath.find('.separator').hide(); + } else { + if (this.boxMath.find('.separator').is(":hidden")) { + this.boxMath.find('.separator').show(); + } + } + event.stopPropagation(); + item.$el.find('a').blur(); + }, + tipZoomIn : 'Zoom In', tipZoomOut : 'Zoom Out', tipZoomFactor : 'Magnification', @@ -668,7 +751,13 @@ define([ filteredRecordsText : '{0} of {1} records filtered', filteredText : 'Filter mode', selectAllSheets : 'Select All Sheets', - ungroupSheets : 'Ungroup Sheets' + ungroupSheets : 'Ungroup Sheets', + //textCustomizeStatusBar: 'Customize status bar', + itemAverage : 'Average', + itemCount : 'Count', + itemMinimum : 'Minimum', + itemMaximum : 'Maximum', + itemSum : 'Sum' }, SSE.Views.Statusbar || {})); SSE.Views.Statusbar.RenameDialog = Common.UI.Window.extend(_.extend({ diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 701e63c4f..d63896dee 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2429,6 +2429,11 @@ "SSE.Views.Statusbar.tipZoomOut": "Zoom out", "SSE.Views.Statusbar.ungroupSheets": "Ungroup Sheets", "SSE.Views.Statusbar.zoomText": "Zoom {0}%", + "SSE.Views.Statusbar.itemAverage": "Average", + "SSE.Views.Statusbar.itemCount": "Count", + "SSE.Views.Statusbar.itemMinimum": "Minimum", + "SSE.Views.Statusbar.itemMaximum": "Maximum", + "SSE.Views.Statusbar.itemSum": "Sum", "SSE.Views.TableOptionsDialog.errorAutoFilterDataRange": "The operation could not be done for the selected range of cells.
    Select a uniform data range different from the existing one and try again.", "SSE.Views.TableOptionsDialog.errorFTChangeTableRangeError": "Operation could not be completed for the selected cell range.
    Select a range so that the first table row was on the same row
    and the resulting table overlapped the current one.", "SSE.Views.TableOptionsDialog.errorFTRangeIncludedOtherTables": "Operation could not be completed for the selected cell range.
    Select a range which does not include other tables.", diff --git a/apps/spreadsheeteditor/main/resources/less/statusbar.less b/apps/spreadsheeteditor/main/resources/less/statusbar.less index 9453dd320..fe679eb1b 100644 --- a/apps/spreadsheeteditor/main/resources/less/statusbar.less +++ b/apps/spreadsheeteditor/main/resources/less/statusbar.less @@ -122,17 +122,16 @@ #status-math-box, #status-filtered-box { float: right; - padding-top: 6px; - padding-right: 14px; label { + padding-top: 6px; + height: 25px; &:not(:last-child) { - margin-right: 10px; + padding-right: 10px; + } + &:last-child { + padding-right: 14px; } - } - - .separator { - margin-top: -6px; } }