From fc2a774c615bae8758ee5a99fb68e698096a123f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 21 Apr 2020 13:43:11 +0300 Subject: [PATCH] [SSE] Refactoring formula wizard --- .../main/app/view/FormulaWizard.js | 82 +++++++++++++------ 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormulaWizard.js b/apps/spreadsheeteditor/main/app/view/FormulaWizard.js index 7e4b7dd67..9f9020c68 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaWizard.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaWizard.js @@ -60,15 +60,20 @@ define([ this.template = [ '
', - '', - '
', - '', - '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '', + '', + '', + '', + '', '
', - '', - '', - '', - '', '
', '
' ].join(''); @@ -104,12 +109,9 @@ define([ $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('input').on('keypress', _.bind(this.onKeyPress, this)); - this.scrollerY = new Common.UI.Scroller({ - el: $window.find('#formula-wizard-tbl-args').parent(), - minScrollbarLength : 20, - alwaysVisibleY: true - }); - this.scrollerY.scrollTop(0); + this.panelArgs = $window.find('#formula-wizard-panel-args'); + this.tableArgs = $window.find('#formula-wizard-tbl-args').parent(); + this.panelDesc = $window.find('#formula-wizard-panel-desc'); this._preventCloseCellEditor = false; @@ -138,28 +140,44 @@ define([ }, setSettings: function () { + var me = this; if (this.funcprops) { var props = this.funcprops; props.args ? $('#formula-wizard-args').html('' + props.name + '' + props.args) : $('#formula-wizard-args').addClass('hidden'); props.desc ? $('#formula-wizard-desc').text(props.desc) : $('#formula-wizard-desc').addClass('hidden'); - } - if (this.props) { - var me = this; + props.name ? $('#formula-wizard-name').html('' + this.textFunction + ': ' + props.name) : $('#formula-wizard-name').addClass('hidden'); + this.$window.find('#formula-wizard-help').on('click', function (e) { + // me.close(); + SSE.getController('LeftMenu').getView('LeftMenu').showMenu('file:help', 'Functions\/' + me.funcprops.origin.toLocaleLowerCase() + '.htm'); + }) + } + var height = this.panelDesc.outerHeight(); + height = this.$window.find('.box').height() - height - 23;// #formula-wizard-name height + this.panelArgs.height(height); + height = parseInt((height-8)/30) * 30; + this.tableArgs.height(height); + this.scrollerY = new Common.UI.Scroller({ + el: this.tableArgs, + minScrollbarLength : 20, + alwaysVisibleY: true + }); + + if (this.props) { // fill arguments var props = this.props; var result = props.asc_getFormulaResult(); $('#formula-wizard-value').html('' + this.textValue + ': ' + ((result!==undefined && result!==null)? result : '')); - $('#formula-wizard-name').html('' + this.textFunction + ': ' + props.name); var tbl = this.$window.find('#formula-wizard-tbl-args'); - var argtpl = '' + - '
' + - '
'; + var argtpl = '
' + + '
' + + '
'; var argmin = props.asc_getArgumentMin(), argmax = props.asc_getArgumentMax(), argres = props.asc_getArgumentsResult(), argtype = props.asc_getArgumentsType(), + argval = props.asc_getArgumentsValue(), argcount = 0, lasttype; for (var i=0; i' + this.args[argcount].argName + ''); else this.args[argcount].lblName.html(this.args[argcount].argName); - this.args[argcount].lblValue.text(' = '+ (argres && (argres.length>argcount) && argres[argcount]!==null ? argres[argcount] : this.args[argcount].argType)); + this.args[argcount].lblValue.text(' = '+ (argres && (argres.length>argcount) && argres[argcount]!==null ? argres[argcount] : this.args[argcount].argTypeName)); argcount++; } } this.scrollerY.update(); + this.scrollerY.scrollTop(0); } }, @@ -229,12 +258,13 @@ define([ close: function () { Common.UI.Window.prototype.close.call(this); - !this._preventCloseCellEditor && this.api.asc_closeCellEditor(true); + this.api.asc_closeCellEditor(!this._preventCloseCellEditor); }, textTitle: 'Function Argumens', textValue: 'Formula result', - textFunction: 'Function' + textFunction: 'Function', + textHelp: 'Help on this function' }, SSE.Views.FormulaWizard || {})) }); \ No newline at end of file