From 07035bd7c325cf95d3661939fcba7b0e2b81d370 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 8 Jun 2020 20:09:33 +0300 Subject: [PATCH] [SSE] Add pivot filtering settings --- apps/common/main/lib/component/Window.js | 7 ++ .../main/app/view/AutoFilterDialog.js | 118 ++++++++++++++++-- 2 files changed, 113 insertions(+), 12 deletions(-) diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 9405cc200..063bed7bf 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -951,6 +951,13 @@ define([ this.$window.find('.resize-border').remove(); } this.resizable = resizable; + } else { + if (resizable) { + (minSize && minSize.length>1) && (this.initConfig.minwidth = minSize[0]); + (minSize && minSize.length>1) && (this.initConfig.minheight = minSize[1]); + (maxSize && maxSize.length>1) && (this.initConfig.maxwidth = maxSize[0]); + (maxSize && maxSize.length>1) && (this.initConfig.maxheight = maxSize[1]); + } } }, diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index 4cf0401c3..c01fb9108 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -469,9 +469,11 @@ define([ SSE.Views.AutoFilterDialog = Common.UI.Window.extend(_.extend({ initialize: function (options) { + this.menuPanelWidth = 195; + var t = this, _options = {}, width = undefined, height = undefined; if (Common.Utils.InternalSettings.get('sse-settings-size-filter-window')) { - width = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[0]; + width = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[0] + this.menuPanelWidth; height = Common.Utils.InternalSettings.get('sse-settings-size-filter-window')[1]; } @@ -505,7 +507,7 @@ define([ '', '', '', - '' @@ -685,6 +687,61 @@ define([ }); this.miReapply.on('click', _.bind(this.onReapply, this)); + this.miReapplySeparator = new Common.UI.MenuItem({ caption: '--' }); + + // pivot + this.miValueFilter = new Common.UI.MenuItem({ + caption : this.txtValueFilter, + toggleGroup : 'menufilterfilter', + checkable : true, + checked : false, + menu : new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + {value: Asc.c_oAscCustomAutoFilter.equals, caption: this.txtEquals, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.doesNotEqual, caption: this.txtNotEquals, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isGreaterThan, caption: this.txtGreater, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo, caption: this.txtGreaterEquals,checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isLessThan, caption: this.txtLess, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo, caption: this.txtLessEquals, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: -2, caption: this.txtBetween, checkable: true, type: Asc.c_oAscAutoFilterTypes.CustomFilters, pivot: true}, + {value: Asc.c_oAscCustomAutoFilter.top10, caption: this.txtTop10, checkable: true, type: Asc.c_oAscAutoFilterTypes.Top10, pivot: true} + ] + }) + }); + var items = this.miNumFilter.menu.items; + for (var i=0; i0); this.miSortFontColor.setVisible(hasColors); - this.miFilterFontColor.setVisible(hasColors); + this.miFilterFontColor.setVisible(!isPivot && hasColors); if (hasColors) { var colors = []; colorsFont.forEach(function(item, index) { @@ -1141,7 +1232,7 @@ define([ hasColors = (colorsFill && colorsFill.length>0); this.miSortCellColor.setVisible(hasColors); - this.miFilterCellColor.setVisible(hasColors); + this.miFilterCellColor.setVisible(!isPivot && hasColors); if (hasColors) { var colors = []; colorsFill.forEach(function(item, index) { @@ -1165,7 +1256,7 @@ define([ isAnd = (customFilter.asc_getAnd()), cond1 = customFilters[0].asc_getOperator(), cond2 = ((customFilters.length>1) ? (customFilters[1].asc_getOperator() || 0) : 0), - items = (isTextFilter) ? this.miTextFilter.menu.items : this.miNumFilter.menu.items, + items = isPivot ? (isValueFilter ? this.miValueFilter.menu.items : this.miLabelFilter.menu.items) : ((isTextFilter) ? this.miTextFilter.menu.items : this.miNumFilter.menu.items), isCustomConditions = true; if (customFilters.length==1) @@ -1174,7 +1265,7 @@ define([ item.setChecked(checked, true); if (checked) isCustomConditions = false; }); - else if (!isTextFilter && (cond1 == Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo && cond2 == Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo || + else if ((isPivot || !isTextFilter) && (cond1 == Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo && cond2 == Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo || cond1 == Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo && cond2 == Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo)){ items[6].setChecked(true, true); // between filter isCustomConditions = false; @@ -1195,7 +1286,7 @@ define([ } } else if (isDynamicFilter || isTop10) { var dynType = (isDynamicFilter) ? filterObj.asc_getFilter().asc_getType() : null, - items = this.miNumFilter.menu.items; + items = isPivot ? this.miValueFilter.menu.items : this.miNumFilter.menu.items; items.forEach(function(item){ item.setChecked(isDynamicFilter && (item.options.type == Asc.c_oAscAutoFilterTypes.DynamicFilter) && (item.value == dynType) || isTop10 && (item.options.type == Asc.c_oAscAutoFilterTypes.Top10), true); @@ -1394,6 +1485,7 @@ define([ this.$window.find('.combo-values').css({'height': size[1] - 100 + 'px'}); this.curSize.height = size[1]; } + size[0] -= this.menuPanelWidth; Common.Utils.InternalSettings.set('sse-settings-size-filter-window', size); }, @@ -1438,7 +1530,9 @@ define([ txtContains : "Contains...", txtNotContains : "Does not contain...", textSelectAllResults: 'Select All Search Results', - textAddSelection : 'Add current selection to filter' + textAddSelection : 'Add current selection to filter', + txtValueFilter: 'Value filter', + txtLabelFilter: 'Label filter' }, SSE.Views.AutoFilterDialog || {})); }); \ No newline at end of file