From 750ebbf77a99f6772f5e2cf02d9fd4084406f2bf Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 11 Mar 2021 19:19:58 +0300 Subject: [PATCH] [SSE] Clear rule format --- .../main/app/view/FormatRulesEditDlg.js | 65 +++++++++---------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index a795dd7d0..008020c71 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -71,10 +71,6 @@ define([ '', '
', '', - // '
', - // '', - // '
', - // '
', '', '', '', @@ -91,12 +87,18 @@ define([ '', '
', '
', - '
','
', + '
', + '', + '', + '', + '', + '
', + '
','
', '
','
', - // '
','
', '
','
', '
', '
', + '', '
', '', '', @@ -483,8 +485,8 @@ define([ editable : false, cls : 'input-group-nr', data : [ - {value: 0, displayValue: 'Item'}, - {value: 1, displayValue: 'Percent'} + {value: 0, displayValue: this.textItem}, + {value: 1, displayValue: this.textPercent} ] }).on('selected', function(combo, record) { var percent = !!record.value; @@ -517,7 +519,7 @@ define([ fontColor: preset[0], fillColor: preset[1], borderColor: preset[2], - displayValue: preset[0] ? 'absdef' : '', + displayValue: preset[0] ? Common.define.conditionalData.exampleText : '', styleObj: {'background-color': preset[1] ? '#' + preset[1] : 'transparent', color: preset[0] ? '#' + preset[0] : 'transparent', border: preset[2] ? '1px solid #' + preset[2] : '', 'text-align': 'center' }, styleStr: 'background-color: ' + (preset[1] ? '#' + preset[1] : 'transparent') + ';color:' + (preset[0] ? '#' + preset[0] : 'transparent') + ';' + (preset[2] ? 'border: 1px solid #' + preset[2] + ';' : '' + 'text-align: center;') }); @@ -569,26 +571,6 @@ define([ }); this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this)); - // this.btnSuperscript = new Common.UI.Button({ - // parentEl: $('#format-rules-superscript'), - // cls: 'btn-toolbar', - // iconCls: 'toolbar__icon btn-superscript', - // enableToggle: true, - // toggleGroup: 'superscriptFRGroup', - // hint: this.textSuperscript - // }); - // // this.btnSuperscript.on('click', _.bind(this.onSuperscriptClick, this)); - // - // this.btnSubscript = new Common.UI.Button({ - // parentEl: $('#format-rules-subscript'), - // cls: 'btn-toolbar', - // iconCls: 'toolbar__icon btn-subscript', - // enableToggle: true, - // toggleGroup: 'superscriptFRGroup', - // hint: this.textSubscript - // }); - // this.btnSubscript.on('click', _.bind(this.onSubscriptClick, this)); - var initNewColor = function(btn, picker_el, transparent) { if (btn && btn.cmpEl) { btn.currentColor = '#000000'; @@ -836,7 +818,7 @@ define([ this.cmbNumberFormat = new Common.UI.ComboBox({ el : $('#format-rules-edit-combo-num-format'), cls : 'input-group-nr', - style : 'width: 100px;', + style : 'width: 111px;', menuStyle : 'min-width: 100%;max-height: 211px;', hint : this.tipNumFormat, itemsTemplate: formatTemplate, @@ -846,6 +828,11 @@ define([ this.cmbNumberFormat.setValue(Asc.c_oAscNumFormatType.General); this.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this)); + this.btnClear = new Common.UI.Button({ + el: $('#format-rules-edit-btn-clear') + }); + this.btnClear.on('click', _.bind(this.clearFormat, this)); + // Scale this.scaleControls = []; this.lblMidScale = this.$window.find('#format-rules-edit-lbl-scale-2'); @@ -1712,9 +1699,9 @@ define([ onFormatsSelect: function(combo, record) { var xfs = new AscCommonExcel.CellXfs(); - record.fontColor && xfs.asc_setFontColor(Common.Utils.ThemeColor.getRgbColor(record.fontColor)); - record.fillColor && xfs.asc_setFillColor(Common.Utils.ThemeColor.getRgbColor(record.fillColor)); - if (record.borderColor) { + record && record.fontColor && xfs.asc_setFontColor(Common.Utils.ThemeColor.getRgbColor(record.fontColor)); + record && record.fillColor && xfs.asc_setFillColor(Common.Utils.ThemeColor.getRgbColor(record.fillColor)); + if (record && record.borderColor) { var new_borders = [], bordersWidth = Asc.c_oAscBorderStyles.Thin, bordersColor = Common.Utils.ThemeColor.getRgbColor(record.borderColor); @@ -1730,6 +1717,14 @@ define([ this.previewFormat(); }, + clearFormat: function() { + this.xfsFormat = null; + this._changedProps && this._changedProps.asc_setDxf(null); + this.fillXfsFormatInfo(new AscCommonExcel.CellXfs()); + this.cmbFormats.setValue(this.textCustom); + this.previewFormat(); + }, + onBoldClick: function() { !this.xfsFormat && (this.xfsFormat = new AscCommonExcel.CellXfs()); this.xfsFormat.asc_setFontBold(this.btnBold.isActive()); @@ -2307,7 +2302,9 @@ define([ textSingleRef: 'This type of reference cannot be used in a conditional formatting formula.
Change the reference to a single cell, or use the reference with a worksheet function, such as =SUM(A1:B5).', textRelativeRef: 'You cannot use relative references in conditional formatting criteria for color scales, data bars, and icon sets.', textErrorGreater: 'The value for the {0} must be greater than the value for the {1}.', - textInvalid: 'Invalid data range.' + textInvalid: 'Invalid data range.', + textClear: 'Clear', + textItem: 'Item' }, SSE.Views.FormatRulesEditDlg || {})); }); \ No newline at end of file