[SSE] Show formula arguments
This commit is contained in:
parent
92d57cd878
commit
09e95ddf0d
|
@ -96,6 +96,7 @@ define([
|
|||
|
||||
this._noApply = false;
|
||||
this.args = [];
|
||||
this.argsNames = [];
|
||||
this.repeatedArg = undefined;
|
||||
this.helpUrl = undefined;
|
||||
this.minArgCount = 1;
|
||||
|
@ -159,6 +160,7 @@ define([
|
|||
props.args ? $('#formula-wizard-args').html('<b>' + props.name + '</b>' + props.args) : $('#formula-wizard-args').addClass('hidden');
|
||||
props.desc ? $('#formula-wizard-desc').text(props.desc) : $('#formula-wizard-desc').addClass('hidden');
|
||||
props.name ? $('#formula-wizard-name').html(this.textFunction + ': ' + props.name) : $('#formula-wizard-name').addClass('hidden');
|
||||
this.parseArgsDesc(props.args);
|
||||
|
||||
this.$window.find('#formula-wizard-help').on('click', function (e) {
|
||||
me.showHelp();
|
||||
|
@ -239,6 +241,37 @@ define([
|
|||
(this.contentPanel.height() < this.innerPanel.height()) && this.recalcArgTableSize();
|
||||
},
|
||||
|
||||
parseArgsDesc: function(args) {
|
||||
if (args.charAt(0)=='(')
|
||||
args = args.substring(1);
|
||||
if (args.charAt(args.length-1)==')')
|
||||
args = args.substring(0, args.length-1);
|
||||
var arr = args.split(this.api.asc_getFunctionArgumentSeparator());
|
||||
arr.forEach(function(item, index){
|
||||
var str = item.trim();
|
||||
if (str.charAt(0)=='[')
|
||||
str = str.substring(1);
|
||||
if (str.charAt(str.length-1)==']')
|
||||
str = str.substring(0, str.length-1);
|
||||
str = str.trim();
|
||||
arr[index] = str.charAt(0).toUpperCase().concat(str.substring(1));
|
||||
});
|
||||
this.argsNames = arr;
|
||||
},
|
||||
|
||||
getArgumentName: function(argcount) {
|
||||
var name = '';
|
||||
if (argcount<this.argsNames.length && this.argsNames[argcount]!=='...') {
|
||||
name = this.argsNames[argcount];
|
||||
} else if (this.argsNames[this.argsNames.length-1]==='...') {
|
||||
var req = this.argsNames.length-1 - this.repeatedArg.length; // required
|
||||
var idx = this.repeatedArg.length - (argcount - req)%this.repeatedArg.length;
|
||||
name = this.argsNames[this.argsNames.length-1-idx];
|
||||
} else
|
||||
name = this.textArgument + (this.maxArgCount>1 ? (' ' + (argcount+1)) : '');
|
||||
return name;
|
||||
},
|
||||
|
||||
fillArgs: function (types, argval, argres) {
|
||||
var argcount = this.args.length;
|
||||
for (var j=0; j<types.length; j++) {
|
||||
|
@ -273,7 +306,7 @@ define([
|
|||
lblName: div.find('#formula-wizard-lbl-name-arg'+argcount),
|
||||
lblValue: div.find('#formula-wizard-lbl-val-arg'+argcount),
|
||||
argInput: txt,
|
||||
argName: me.textArgument + (this.maxArgCount>1 ? (' ' + (argcount+1)) : ''),
|
||||
argName: me.getArgumentName(argcount),
|
||||
// argDesc: 'some argument description',
|
||||
argType: argtype,
|
||||
argTypeName: me.getArgType(argtype)
|
||||
|
|
Loading…
Reference in a new issue