diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 78aa3fac89..9ff7ef1d8f 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -58,6 +58,7 @@ define([ 'pivottable:create': _.bind(this.onCreateClick, this), 'pivottable:refresh': _.bind(this.onRefreshClick, this), 'pivottable:select': _.bind(this.onSelectClick, this), + 'pivottable:calculated': _.bind(this.onCalculatedClick, this), 'pivottable:expand': _.bind(this.onExpandClick, this), 'pivottable:collapse': _.bind(this.onCollapseClick, this), 'pivottable:style': _.bind(this.onPivotStyleSelect, this), @@ -195,6 +196,21 @@ define([ Common.NotificationCenter.trigger('edit:complete', this); }, + onCalculatedClick: function(btn, opts){ + var pivotContextMenu = this.api.asc_getPivotInfo(); + var pivotInfo = pivotContextMenu.pivot; + var pivotFields = pivotInfo.asc_getPivotFields(); + var cacheFields = pivotInfo.asc_getCacheFields(); + // var pivotFieldIndex = pivotContextMenu.asc_getPivotFieldIndex(); + var pivotFieldIndex = 0; + var currentPivotField = pivotFields[pivotFieldIndex]; + + var winList = new SSE.Views.PivotCalculatedItemsDialog({ + api: this.api + }); + winList.show(); + }, + onExpandClick: function(){ if (this.api) { this._originalProps.asc_setExpandCollapseByActiveCell(this.api, true, true); @@ -481,6 +497,7 @@ define([ Common.Utils.lockControls(Common.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls}); Common.Utils.lockControls(Common.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot}); Common.Utils.lockControls(Common.enumLock.pivotExpandLock, !(pivotInfo && pivotInfo.asc_canExpandCollapseByActiveCell(this.api)), {array: [this.view.btnExpandField, this.view.btnCollapseField]}); + Common.Utils.lockControls(Common.enumLock.pivotCalcItemsLock, !(pivotInfo && pivotInfo.asc_canChangeCalculatedItemByActiveCell()), {array: [this.view.btnCalculatedItems]}); if (pivotInfo) this.ChangeSettings(pivotInfo); diff --git a/apps/spreadsheeteditor/main/app/view/PivotCalculatedItemsDialog.js b/apps/spreadsheeteditor/main/app/view/PivotCalculatedItemsDialog.js new file mode 100644 index 0000000000..da41fc9e54 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/PivotCalculatedItemsDialog.js @@ -0,0 +1,278 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2024 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * PivotCalculatedItemsDialog.js + * + * Created on 18.11.2024 + * + */ + +define([ + 'common/main/lib/view/AdvancedSettingsWindow' +], function () { 'use strict'; + + SSE.Views.PivotCalculatedItemsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 410, + contentHeight: 270, + separator: false, + buttons: ['close'], + id: 'pivot-calculated-dialog' + }, + + initialize : function(options) { + var me = this; + + this.api = options.api; + this.handler = options.handler; + + this.pivotInfo = this.api.asc_getPivotInfo().pivot; + this.pivotFieldIndex = this.pivotInfo.asc_getFieldIndexByActiveCell(); + this.itemsObject = this.pivotInfo.asc_getItemsObjectWithFormulas(this.pivotFieldIndex); + + var fieldTitle = this.pivotInfo.asc_getCacheFields()[this.pivotFieldIndex].asc_getName(); + + _.extend(this.options, { + title: this.txtTitle + " “" + fieldTitle + "“", + contentStyle: 'padding: 10px 10px 0 10px;', + contentTemplate: _.template([ + '
', + '
', + '', + '', + '', + '
', + '', + '
', + '
', + '
', + '
' + ].join(''))({scope: this}) + }, options); + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + console.log(this.api.asc_canChangeCalculatedItemByCell); + + this.btnNew = new Common.UI.Button({ + el: $('#pivot-calculated-btn-new') + }).on('click', _.bind(this.onEditItem, this, false, false)); + + this.btnDuplicate = new Common.UI.Button({ + el: $('#pivot-calculated-btn-duplicate'), + disabled: true + }).on('click', _.bind(this.onDuplicateItem, this)); + + this.btnEdit = new Common.UI.Button({ + el: $('#pivot-calculated-btn-edit'), + disabled: true + }).on('click', _.bind(this.onEditItem, this, true, false)); + + this.btnDelete = new Common.UI.Button({ + el: $('#pivot-calculated-btn-delete'), + disabled: true + }).on('click', _.bind(this.onDeleteItem, this)); + + + this.itemsList = new Common.UI.ListView({ + el: $('#pivot-calculated-items-list', this.$window), + store: new Common.UI.DataViewStore(), + emptyText: '', + headers: [ + {name: this.txtItemsName, width: 135}, + {name: this.txtFormula}, + ], + isRTL: true, + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', + '
<%= Common.Utils.String.htmlEncode(formula) %>
', + '
' + ].join('')), + tabindex: 1 + }); + this.itemsList.on('item:select', _.bind(this.onSelectItemsList, this)); + this.updateItemsListStore(); + + if(this.itemsList.store.length) { + this.itemsList.selectRecord(this.itemsList.store.at(0)); + } + else { + this.onEditItem(false, true); + } + }, + + updateItemsListStore: function() { + this.itemsObject = this.pivotInfo.asc_getItemsObjectWithFormulas(this.pivotFieldIndex); + this.itemsList.store.reset( + this.itemsObject.filter(function(el) { + var isValid = !!el.formula; + isValid && (el.formula = '= ' + el.formula); + return isValid; + }) + ); + }, + + generateUniqueName: function(baseName, existingNames) { + var uniqueName = baseName; + + if (existingNames.indexOf(baseName) !== -1) { + var index = 1; + while (existingNames.indexOf(baseName + " (" + index + ")") !== -1) { + index++; + } + uniqueName = baseName + " (" + index + ")"; + } + + return uniqueName; + }, + + selectLastItem: function() { + var lastItem = this.itemsList.store.at(-1); + this.itemsList.selectRecord(lastItem); + this.itemsList.scrollToRecord(lastItem); + }, + + getFocusedComponents: function() { + return []; + }, + + show: function() { + Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); + }, + + onSelectItemsList: function(lisvView, itemView, record) { + this.btnDuplicate.setDisabled(false); + this.btnEdit.setDisabled(false); + this.btnDelete.setDisabled(false); + }, + + onEditItem: function(isEdit, isInitialOpen) { + var me = this, + xy = Common.Utils.getOffset(me.$window), + selectedItem = this.itemsList.getSelectedRec(), + editableItem; + + if(isEdit && selectedItem) { + editableItem = { + item: selectedItem.get('item'), + name: selectedItem.get('name'), + formula: selectedItem.get('formula') + }; + } + + var winInsert = new SSE.Views.PivotInsertCalculatedItemDialog({ + api: this.api, + isEdit: isEdit, + editableItem: editableItem, + handler: function(type, options) { + if(type != 'ok') return; + + if(isEdit) { + me.pivotInfo.asc_modifyCalculatedItem(me.api, me.pivotFieldIndex, options.name, options.formula); + } else { + var uniqueName = me.generateUniqueName( + options.name, + me.itemsObject.map(function(item) { return item.name }) + ) + me.pivotInfo.asc_addCalculatedItem(me.api, me.pivotFieldIndex, uniqueName, options.formula); + } + me.updateItemsListStore(); + }, + }).on('close', function() { + if(me.itemsList.store.length) { + me.show(); + } else { + me.close(); + } + if(!isEdit) { + me.selectLastItem(); + } + }); + + me.hide(); + if(isInitialOpen) { + winInsert.show(); + } else { + winInsert.show(xy.left, xy.top); + } + }, + + onDuplicateItem: function() { + var selectedItem = this.itemsList.getSelectedRec(); + if(!selectedItem) return; + + var uniqueName = this.generateUniqueName( + selectedItem.get('name'), + this.itemsObject.map(function(item) { return item.name }) + ); + var convertedFormula = this.pivotInfo.asc_convertCalculatedFormula(selectedItem.get('formula'), this.pivotFieldIndex); + this.pivotInfo.asc_addCalculatedItem(this.api, this.pivotFieldIndex, uniqueName, convertedFormula); + this.updateItemsListStore(); + this.selectLastItem(); + }, + + onDeleteItem: function() { + var selectedItem = this.itemsList.getSelectedRec(); + if(!selectedItem) return; + + var deletedIndex = this.itemsList.store.indexOf(selectedItem); + this.pivotInfo.asc_removeCalculatedItem(this.api, this.pivotFieldIndex, selectedItem.get('name')); + this.updateItemsListStore(); + + if(this.itemsList.store.length > 0) { + var selectedIndex = deletedIndex < this.itemsList.store.length + ? deletedIndex + : this.itemsList.store.length - 1; + this.itemsList.selectByIndex(selectedIndex); + } else { + this.btnDuplicate.setDisabled(true); + this.btnEdit.setDisabled(true); + this.btnDelete.setDisabled(true); + } + }, + + txtTitle: 'Calculated Items in', + txtNew: 'New', + txtDuplicate: 'Duplicate', + txtEdit: 'Edit', + txtDelete: 'Delete', + txtItemsName: 'Items Name', + txtFormula: 'Formula' + + }, SSE.Views.PivotCalculatedItemsDialog || {})) +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/PivotInsertCalculatedItemDialog.js b/apps/spreadsheeteditor/main/app/view/PivotInsertCalculatedItemDialog.js new file mode 100644 index 0000000000..9c86baac85 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/PivotInsertCalculatedItemDialog.js @@ -0,0 +1,259 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2024 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * PivotInsertCalculatedItemDialog.js + * + * Created on 18.11.2024 + * + */ + +define([ + 'common/main/lib/view/AdvancedSettingsWindow' +], function () { 'use strict'; + + SSE.Views.PivotInsertCalculatedItemDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 290, + contentHeight: 350, + separator: false, + id: 'pivot-insert-calculated-dialog' + }, + + initialize : function(options) { + var me = this; + + + this.api = options.api; + this.isEdit = options.isEdit; + this.editableItem = options.editableItem; + this.handler = options.handler; + + this.pivotInfo = this.api.asc_getPivotInfo().pivot; + this.pivotFieldIndex = this.pivotInfo.asc_getFieldIndexByActiveCell(); + + var fieldTitle = this.pivotInfo.asc_getCacheFields()[this.pivotFieldIndex].asc_getName(); + + _.extend(this.options, { + title: this.txtTitle + " “" + fieldTitle + "“", + contentStyle: 'padding: 10px 10px 0 10px;', + contentTemplate: _.template([ + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '<%= scope.txtDescription %> ', + '<%= scope.txtReadMore %>', + '
' + ].join(''))({scope: this}) + }, options); + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + + var me = this; + + this.itemsList = new Common.UI.ListView({ + el: $('#pivot-insert-calculated-items-list'), + store: new Common.UI.DataViewStore( + this.pivotInfo.asc_getItemsObjectWithFormulas(this.pivotFieldIndex).filter(function(el) { + return !(me.editableItem && el.item == me.editableItem.item) + }) + ), + simpleAddMode: false, + cls: 'dbl-clickable', + itemTemplate: _.template([ + '
', + '
<%=name%>
', + '
', + '
' + ].join('')), + tabindex: 1 + }); + this.itemsList.on('item:click', _.bind(this.onClickItemsList, this)); + this.itemsList.on('item:dblclick', _.bind(this.onDblClickItemsList, this)); + + this.inputName = new Common.UI.InputField({ + el : $('#pivot-insert-calculated-input-name'), + value: this.editableItem ? this.editableItem.name : this.getNewItemName(), + disabled: !!this.editableItem + }); + + this.inputFormula = new Common.UI.InputField({ + el : $('#pivot-insert-calculated-input-formula'), + value: this.editableItem ? this.editableItem.formula : '= 0' + }); + }, + + getNewItemName: function() { + var indexMax = 0; + var textTranslate = this.txtItem; + this.itemsList.store.each(function(item) { + var itemName = item.get('name'); + if (0 == itemName.indexOf(textTranslate)){ + var index = parseInt(itemName.substr(textTranslate.length)); + if (!isNaN(index) && (indexMax < index)) + indexMax = index; + } + }); + indexMax++; + return textTranslate + ' ' + indexMax; + }, + + showWarningDialog: function(error) { + var message = ''; + switch (error) { + case Asc.c_oAscError.ID.PivotItemNameNotFound: + message = this.txtPivotItemNameNotFound; + break; + case Asc.c_oAscError.ID.CalculatedItemInPageField: + message = this.txtCalculatedItemInPageField; + break; + case Asc.c_oAscError.ID.NotUniqueFieldWithCalculated: + message = this.txtNotUniqueFieldWithCalculated; + break; + case Asc.c_oAscError.ID.WrongDataFieldSubtotalForCalculatedItems: + message = this.txtWrongDataFieldSubtotalForCalculatedItems; + break; + case Asc.c_oAscError.ID.PivotFieldCustomSubtotalsWithCalculatedItems: + message = this.txtPivotFieldCustomSubtotalsWithCalculatedItems; + break; + default: + message = this.textInvalid; + } + + Common.UI.warning({ + msg: message, + maxwidth: 600, + callback: function(btn){ + + } + }); + }, + + getFocusedComponents: function() { + return []; + }, + + show: function() { + Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); + }, + + + onClickItemsList: function(listView, itemView, record, event) { + var targetEL = $(event.target); + if(targetEL.hasClass('list-item-icon')) { + this.onAddItemInFormula(record.get('name')); + } + }, + + onDblClickItemsList: function(listView, itemView, record) { + this.onAddItemInFormula(record.get('name')); + }, + + onAddItemInFormula: function(name) { + var formulaValue = this.inputFormula.getValue(); + var formulaValueNoSpaces = formulaValue.trim().replaceAll(' ', ''); + if(formulaValueNoSpaces == '=0' || formulaValueNoSpaces == '=' || formulaValueNoSpaces == '') { + formulaValue = '= '; + } + formulaValue += ' ' + this.pivotInfo.asc_convertNameToFormula(name); + this.inputFormula.setValue(formulaValue); + this.inputFormula.focus(); + }, + + onPrimary: function() { + this.onDlgBtnClick('ok'); + return false; + }, + + onDlgBtnClick: function(event) { + var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; + + if(this.handler) { + if(state == 'ok') { + var returnedItem = { + name: this.inputName.getValue(), + formula: this.inputFormula.getValue() + }; + var formulaTrim = returnedItem.formula.trim(); + var convertedFormula; + + //If there is no equals sign at the beginning, show an error + if(formulaTrim[0] != '=') { + convertedFormula = Asc.c_oAscError.ID.PivotItemNameNotFound; + } else { + convertedFormula = this.pivotInfo.asc_convertCalculatedFormula(formulaTrim.slice(1), this.pivotFieldIndex); + } + + if (typeof convertedFormula === 'number') { + this.showWarningDialog(convertedFormula); + return false; + } else { + returnedItem.formula = convertedFormula; + this.handler.call(this, state, returnedItem); + } + } else { + this.handler.call(this, state); + } + } + this.close(); + }, + + txtTitle: 'Insert Calculated Item in', + txtItemName: 'Item name', + txtItem: 'Item', + txtFormula: 'Formula', + txtItems: 'Items', + txtDescription: 'You can use Calculated Items for basic calculations between different items within a single field', + txtReadMore: 'Read more', + + txtPivotItemNameNotFound: 'An item name cannot be found. Check that you\'ve typed name correctly and the item is present in the PivotTable report.', + txtCalculatedItemInPageField: 'The item cannot be added or modified. PivotTable report has this field in Filters.', + txtNotUniqueFieldWithCalculated: 'If one or more PivotTable have calculated items, no fields can be used in data area two or more times, or in the data area and another area at the same time.', + txtWrongDataFieldSubtotalForCalculatedItems: 'Averages, standard deviations, and variances are not supported when a PivotTable report has calculated items.', + txtPivotFieldCustomSubtotalsWithCalculatedItems: 'Calculated items do not work with custom subtotals.' + + }, SSE.Views.PivotInsertCalculatedItemDialog || {})) +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index 3e0a975799..e380cbfe42 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -68,6 +68,9 @@ define([ '
' + '' + '
' + + '
' + + '' + + '
' + '
' + '
' + '
' + @@ -137,6 +140,10 @@ define([ me.fireEvent('pivottable:select'); }); + this.btnCalculatedItems.on('click', function (e) { + me.fireEvent('pivottable:calculated'); + }); + this.btnExpandField.on('click', function (e) { me.fireEvent('pivottable:expand'); }); @@ -297,6 +304,17 @@ define([ }); this.lockedControls.push(this.btnSelectPivot); + this.btnCalculatedItems = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-select-pivot', + caption: this.txtCalculated, + lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set.pivotCalcItemsLock, _set['FormatCells'], _set['PivotTables']], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnCalculatedItems); + this.btnExpandField = new Common.UI.Button({ cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-expand-field', @@ -384,6 +402,7 @@ define([ btn.updateHint(me.tipCreatePivot); }); me.btnSelectPivot.updateHint(me.tipSelect); + me.btnCalculatedItems.updateHint(me.tipCalculated); me.btnPivotLayout.updateHint(me.capLayout); me.btnPivotLayout.setMenu(new Common.UI.Menu({ items: [ @@ -449,6 +468,7 @@ define([ this.btnRefreshPivot.render(this.$el.find('#slot-btn-refresh-pivot')); this.btnSelectPivot.render(this.$el.find('#slot-btn-select-pivot')); + this.btnCalculatedItems.render(this.$el.find('#slot-btn-calculated-items')); this.btnExpandField.render(this.$el.find('#slot-btn-expand-field')); this.btnCollapseField.render(this.$el.find('#slot-btn-collapse-field')); this.btnPivotLayout.render(this.$el.find('#slot-btn-pivot-report-layout')); @@ -508,6 +528,8 @@ define([ tipGrandTotals: 'Show or hide grand totals', tipSubtotals: 'Show or hide subtotals', txtSelect: 'Select', + txtCalculated: 'Calculated Items', + tipCalculated: 'Calculated Items', txtExpandEntire: 'Expand Entire Field', txtCollapseEntire: 'Collapse Entire Field', tipSelect: 'Select entire pivot table', diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 8a6685c456..e2fd4f91b5 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -100,6 +100,7 @@ define([ cantSort: 'cant-sort', pivotLock: 'pivot-lock', pivotExpandLock: 'pivot-expand-lock', + pivotCalcItemsLock: 'pivot-calculated-items-lock', tableHasSlicer: 'table-has-slicer', sheetView: 'sheet-view', wbLock: 'workbook-lock', diff --git a/apps/spreadsheeteditor/main/app_dev.js b/apps/spreadsheeteditor/main/app_dev.js index 083f59cacc..245efd8f27 100644 --- a/apps/spreadsheeteditor/main/app_dev.js +++ b/apps/spreadsheeteditor/main/app_dev.js @@ -278,6 +278,8 @@ require([ 'spreadsheeteditor/main/app/view/AdvancedSeparatorDialog', 'spreadsheeteditor/main/app/view/AutoFilterDialog', 'spreadsheeteditor/main/app/view/PivotGroupDialog', + 'spreadsheeteditor/main/app/view/PivotCalculatedItemsDialog', + 'spreadsheeteditor/main/app/view/PivotInsertCalculatedItemDialog' ]; window.compareVersions = true; diff --git a/apps/spreadsheeteditor/main/app_pack.js b/apps/spreadsheeteditor/main/app_pack.js index 0088e2a527..509ad541cf 100644 --- a/apps/spreadsheeteditor/main/app_pack.js +++ b/apps/spreadsheeteditor/main/app_pack.js @@ -84,6 +84,8 @@ require([ 'spreadsheeteditor/main/app/view/AdvancedSeparatorDialog', 'spreadsheeteditor/main/app/view/AutoFilterDialog', 'spreadsheeteditor/main/app/view/PivotGroupDialog', + 'spreadsheeteditor/main/app/view/PivotCalculatedItemsDialog', + 'spreadsheeteditor/main/app/view/PivotInsertCalculatedItemDialog' ], function () { Common.NotificationCenter.trigger('app-pack:loaded'); }); diff --git a/apps/spreadsheeteditor/main/resources/less/advanced-settings.less b/apps/spreadsheeteditor/main/resources/less/advanced-settings.less index 8cb0913446..28f972a21d 100644 --- a/apps/spreadsheeteditor/main/resources/less/advanced-settings.less +++ b/apps/spreadsheeteditor/main/resources/less/advanced-settings.less @@ -653,3 +653,92 @@ } } + +#pivot-calculated-dialog { + #pivot-calculated-btns-group { + display: flex; + justify-content: space-between; + margin-bottom: 8px; + } + #pivot-calculated-items-list { + width: 100%; + height: 230px; + + .item { + padding: 6px; + + .calculated-item { + display: inline-block; + vertical-align: middle; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .calculated-item-name { + width:135px; + } + + .calculated-item-formula { + width:261px; + } + } + } +} + +#pivot-insert-calculated-dialog { + .content-panel { + display: flex; + flex-direction: column; + } + .pivot-insert-calculated-row:not(:first-child) { + label { + margin-top: 8px; + } + } + #pivot-insert-calculated-description { + margin-top: 8px; + color: @text-secondary-ie; + color: @text-secondary; + a { + color: @text-secondary-ie; + color: @text-secondary; + text-decoration: underline; + } + } + #pivot-insert-calculated-items-list { + height: 183px; + + .item { + padding: 2px 12px 2px 8px; + .list-item { + line-height: 20px; + width: 100%; + display:inline-block; + display: flex; + align-items: center; + justify-content: space-between; + + .list-item-icon { + display: none; + border-radius: 2px; + width: 20px; + height: 20px; + pointer-events: initial; + &:hover { + background-color: @highlight-button-pressed-hover-ie; + background-color: @highlight-button-pressed-hover; + } + } + } + + &:hover .list-item-icon { + display: block; + } + + &.selected .list-item-icon{ + background-position-x: @button-small-active-icon-offset-x; + } + } + } +} \ No newline at end of file