Refactoring open dialog
This commit is contained in:
parent
1f62dbf053
commit
7311cd0c8c
|
@ -264,7 +264,7 @@ define([
|
||||||
_handleInput: function(state) {
|
_handleInput: function(state) {
|
||||||
if (this.handler) {
|
if (this.handler) {
|
||||||
if (this.type == Common.Utils.importTextType.DRM) {
|
if (this.type == Common.Utils.importTextType.DRM) {
|
||||||
this.handler.call(this, state, this.inputPwd.getValue());
|
this.handler.call(this, state, {drmOptions: new Asc.asc_CDRMAdvancedOptions(this.inputPwd.getValue())});
|
||||||
} else {
|
} else {
|
||||||
if ( this.type == Common.Utils.importTextType.Data && state == 'ok' && !this.isRangeValid() ) {
|
if ( this.type == Common.Utils.importTextType.Data && state == 'ok' && !this.isRangeValid() ) {
|
||||||
return;
|
return;
|
||||||
|
@ -281,7 +281,14 @@ define([
|
||||||
|
|
||||||
var decimal = this.separatorOptions ? this.separatorOptions.decimal : undefined,
|
var decimal = this.separatorOptions ? this.separatorOptions.decimal : undefined,
|
||||||
thousands = this.separatorOptions ? this.separatorOptions.thousands : undefined;
|
thousands = this.separatorOptions ? this.separatorOptions.thousands : undefined;
|
||||||
this.handler.call(this, state, encoding, delimiter, delimiterChar, decimal, thousands, this.txtDestRange ? this.txtDestRange.getValue() : '');
|
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
||||||
|
decimal && options.asc_setNumberDecimalSeparator(decimal);
|
||||||
|
thousands && options.asc_setNumberGroupSeparator(thousands);
|
||||||
|
this.handler.call(this, state, {
|
||||||
|
textOptions: options,
|
||||||
|
range: this.txtDestRange ? this.txtDestRange.getValue() : '',
|
||||||
|
data: this.data
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2147,15 +2147,15 @@ define([
|
||||||
codepages: advOptions.asc_getCodePages(),
|
codepages: advOptions.asc_getCodePages(),
|
||||||
settings: advOptions.asc_getRecommendedSettings(),
|
settings: advOptions.asc_getRecommendedSettings(),
|
||||||
api: me.api,
|
api: me.api,
|
||||||
handler: function (result, encoding) {
|
handler: function (result, settings) {
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
if (me && me.api) {
|
if (me && me.api) {
|
||||||
if (mode==2) {
|
if (mode==2) {
|
||||||
formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding));
|
formatOptions && formatOptions.asc_setAdvancedOptions(settings.textOptions);
|
||||||
me.api.asc_DownloadAs(formatOptions);
|
me.api.asc_DownloadAs(formatOptions);
|
||||||
} else
|
} else
|
||||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding));
|
me.api.asc_setAdvancedOptions(type, settings.textOptions);
|
||||||
me.loadMask && me.loadMask.show();
|
me.loadMask && me.loadMask.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2174,7 +2174,7 @@ define([
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
if (me.api) {
|
if (me.api) {
|
||||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value));
|
me.api.asc_setAdvancedOptions(type, value.drmOptions);
|
||||||
me.loadMask && me.loadMask.show();
|
me.loadMask && me.loadMask.show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1978,7 +1978,7 @@ define([
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
if (me.api) {
|
if (me.api) {
|
||||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value));
|
me.api.asc_setAdvancedOptions(type, value.drmOptions);
|
||||||
me.loadMask && me.loadMask.show();
|
me.loadMask && me.loadMask.show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -209,14 +209,9 @@ define([
|
||||||
previewData: data,
|
previewData: data,
|
||||||
settings: me._state.CSVOptions,
|
settings: me._state.CSVOptions,
|
||||||
api: me.api,
|
api: me.api,
|
||||||
handler: function (result, encoding, delimiter, delimiterChar, decimal, thousands) {
|
handler: function (result, settings) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok' && me.api) {
|
||||||
if (me && me.api) {
|
me.api.asc_TextToColumns(settings.textOptions);
|
||||||
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
|
||||||
decimal && options.asc_setNumberDecimalSeparator(decimal);
|
|
||||||
thousands && options.asc_setNumberGroupSeparator(thousands);
|
|
||||||
me.api.asc_TextToColumns(options);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})).show();
|
})).show();
|
||||||
|
@ -263,16 +258,10 @@ define([
|
||||||
settings: advOptions ? advOptions.asc_getRecommendedSettings() : me._state.CSVOptions,
|
settings: advOptions ? advOptions.asc_getRecommendedSettings() : me._state.CSVOptions,
|
||||||
codepages: advOptions ? advOptions.asc_getCodePages() : null,
|
codepages: advOptions ? advOptions.asc_getCodePages() : null,
|
||||||
api: me.api,
|
api: me.api,
|
||||||
handler: function (result, encoding, delimiter, delimiterChar, decimal, thousands, range) {
|
handler: function (result, settings) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok' && me.api) {
|
||||||
if (me && me.api) {
|
me.api.asc_TextToColumns(settings.textOptions, settings.data, settings.range);
|
||||||
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
|
||||||
decimal && options.asc_setNumberDecimalSeparator(decimal);
|
|
||||||
thousands && options.asc_setNumberGroupSeparator(thousands);
|
|
||||||
me.api.asc_TextToColumns(options, me.api.asc_getTextFromFileOrUrl(), range);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
me.api.asc_cleanTextFromFileOrUrl();
|
|
||||||
}
|
}
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
|
|
@ -2557,16 +2557,12 @@ define([
|
||||||
type: Common.Utils.importTextType.Paste,
|
type: Common.Utils.importTextType.Paste,
|
||||||
preview: true,
|
preview: true,
|
||||||
api: me.api,
|
api: me.api,
|
||||||
handler: function (result, encoding, delimiter, delimiterChar, decimal, thousands) {
|
handler: function (result, settings) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
if (me && me.api) {
|
if (me && me.api) {
|
||||||
var props = new Asc.SpecialPasteProps();
|
var props = new Asc.SpecialPasteProps();
|
||||||
props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport);
|
props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport);
|
||||||
|
props.asc_setAdvancedOptions(settings.textOptions);
|
||||||
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
|
||||||
decimal && options.asc_setNumberDecimalSeparator(decimal);
|
|
||||||
thousands && options.asc_setNumberGroupSeparator(thousands);
|
|
||||||
props.asc_setAdvancedOptions(options);
|
|
||||||
me.api.asc_SpecialPaste(props);
|
me.api.asc_SpecialPaste(props);
|
||||||
}
|
}
|
||||||
me._state.lastSpecPasteChecked = item;
|
me._state.lastSpecPasteChecked = item;
|
||||||
|
|
|
@ -1869,15 +1869,15 @@ define([
|
||||||
codepages: advOptions.asc_getCodePages(),
|
codepages: advOptions.asc_getCodePages(),
|
||||||
settings: advOptions.asc_getRecommendedSettings(),
|
settings: advOptions.asc_getRecommendedSettings(),
|
||||||
api: me.api,
|
api: me.api,
|
||||||
handler: function (result, encoding, delimiter, delimiterChar) {
|
handler: function (result, settings) {
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
if (me && me.api) {
|
if (me && me.api) {
|
||||||
if (mode==2) {
|
if (mode==2) {
|
||||||
formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar));
|
formatOptions && formatOptions.asc_setAdvancedOptions(settings.textOptions);
|
||||||
me.api.asc_DownloadAs(formatOptions);
|
me.api.asc_DownloadAs(formatOptions);
|
||||||
} else
|
} else
|
||||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar));
|
me.api.asc_setAdvancedOptions(type, settings.textOptions);
|
||||||
me.loadMask && me.loadMask.show();
|
me.loadMask && me.loadMask.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1896,7 +1896,7 @@ define([
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
if (me && me.api) {
|
if (me && me.api) {
|
||||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value));
|
me.api.asc_setAdvancedOptions(type, value.drmOptions);
|
||||||
me.loadMask && me.loadMask.show();
|
me.loadMask && me.loadMask.show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue