[SSE] Refactoring range selection
This commit is contained in:
parent
2d1b26a6aa
commit
709cf9fb79
|
@ -258,7 +258,7 @@ define([
|
|||
click: function(e) {
|
||||
if (me.api) {
|
||||
me.api.isTextAreaBlur = false;
|
||||
if (e.target.localName == 'canvas' && !me.isEditFormula) {
|
||||
if (e.target.localName == 'canvas' && (!me.isEditFormula || me.rangeSelectionMode)) {
|
||||
if (me._preventClick)
|
||||
me._preventClick = false;
|
||||
else
|
||||
|
@ -2030,7 +2030,7 @@ define([
|
|||
},
|
||||
|
||||
onFormulaCompleteMenu: function(funcarr) {
|
||||
if (!this.documentHolder.funcMenu || Common.Utils.ModalWindow.isVisible()) return;
|
||||
if (!this.documentHolder.funcMenu || Common.Utils.ModalWindow.isVisible() || this.rangeSelectionMode) return;
|
||||
|
||||
if (funcarr) {
|
||||
var me = this,
|
||||
|
|
|
@ -103,11 +103,11 @@ define([
|
|||
setSettings: function(settings) {
|
||||
var me = this;
|
||||
|
||||
this.settings = settings;
|
||||
this.inputRange.setValue(settings.range ? settings.range : '');
|
||||
|
||||
if (settings.type===undefined)
|
||||
settings.type = Asc.c_oAscSelectionDialogType.Chart;
|
||||
this.type = settings.type;
|
||||
|
||||
if (settings.api) {
|
||||
me.api = settings.api;
|
||||
|
@ -122,12 +122,16 @@ define([
|
|||
if (settings.validation) {
|
||||
return settings.validation.call(me, value);
|
||||
} else {
|
||||
if (settings.type === Asc.c_oAscSelectionDialogType.Function) {
|
||||
settings.argvalues[settings.argindex] = value;
|
||||
me.api.asc_insertArgumentsInFormula(settings.argvalues);
|
||||
}
|
||||
var isvalid = (settings.type === Asc.c_oAscSelectionDialogType.Function) || me.api.asc_checkDataRange(settings.type, value, false);
|
||||
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.txtInvalidRange : true;
|
||||
}
|
||||
};
|
||||
|
||||
if (me.type == Asc.c_oAscSelectionDialogType.Function) {
|
||||
if (settings.type == Asc.c_oAscSelectionDialogType.Function) {
|
||||
_.delay(function(){
|
||||
me.inputRange._input.focus();
|
||||
if (settings.selection) {
|
||||
|
@ -147,7 +151,7 @@ define([
|
|||
},
|
||||
|
||||
onApiRangeChanged: function(name) {
|
||||
if (this.type == Asc.c_oAscSelectionDialogType.Function) {
|
||||
if (this.settings.type == Asc.c_oAscSelectionDialogType.Function) {
|
||||
var oldlen = this._addedTextLength || 0,
|
||||
val = this.inputRange.getValue(),
|
||||
input = this.inputRange._input[0],
|
||||
|
@ -159,6 +163,9 @@ define([
|
|||
val = val.substring(0, start) + add + name + val.substring(end, val.length);
|
||||
this.inputRange.setValue(val);
|
||||
input.selectionStart = input.selectionEnd = start + add.length + this._addedTextLength;
|
||||
|
||||
this.settings.argvalues[this.settings.argindex] = val;
|
||||
this.api.asc_insertArgumentsInFormula(this.settings.argvalues);
|
||||
} else
|
||||
this.inputRange.setValue(name);
|
||||
if (this.inputRange.cmpEl.hasClass('error'))
|
||||
|
|
|
@ -263,10 +263,8 @@ define([
|
|||
}).on('changing', function(input, newValue, oldValue, e) {
|
||||
if (newValue == oldValue) return;
|
||||
var index = input.options.index,
|
||||
arg = me.args[index],
|
||||
values = me.getArgumentsValue();
|
||||
(index<values.length) && (values[index] = newValue);
|
||||
var res = me.api.asc_insertArgumentsInFormula(values, index, arg.argType),
|
||||
arg = me.args[index];
|
||||
var res = me.api.asc_insertArgumentsInFormula(me.getArgumentsValue(), index, arg.argType),
|
||||
argres = res ? res.asc_getArgumentsResult() : undefined;
|
||||
argres = argres ? argres[index] : undefined;
|
||||
arg.lblValue.html('= '+ (argres!==null && argres !==undefined ? argres : '<span style="opacity: 0.5; font-weight: bold;">' + arg.argTypeName + '</span>' ));
|
||||
|
@ -367,7 +365,9 @@ define([
|
|||
api : me.api,
|
||||
range : !_.isEmpty(input.getValue()) ? input.getValue() : '',
|
||||
type : Asc.c_oAscSelectionDialogType.Function,
|
||||
selection: {start: input._input[0].selectionStart, end: input._input[0].selectionEnd}
|
||||
selection: {start: input._input[0].selectionStart, end: input._input[0].selectionEnd},
|
||||
argvalues : me.getArgumentsValue(),
|
||||
argindex : input.options.index
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue