Merge branch 'feature/sse-from-text' into develop
This commit is contained in:
commit
77cd81322c
|
@ -114,7 +114,8 @@ Common.Utils = _.extend(new(function() {
|
||||||
CSV: 1,
|
CSV: 1,
|
||||||
TXT: 2,
|
TXT: 2,
|
||||||
Paste: 3,
|
Paste: 3,
|
||||||
Columns: 4
|
Columns: 4,
|
||||||
|
Data: 5
|
||||||
},
|
},
|
||||||
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
|
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
|
||||||
me = this,
|
me = this,
|
||||||
|
|
|
@ -57,10 +57,22 @@ define([
|
||||||
|
|
||||||
if (options.preview) {
|
if (options.preview) {
|
||||||
width = 414;
|
width = 414;
|
||||||
height = 277;
|
height = (options.type==Common.Utils.importTextType.Data) ? 385 : 277;
|
||||||
} else {
|
} else {
|
||||||
width = (options.type !== Common.Utils.importTextType.DRM) ? 340 : (options.warning ? 420 : 280);
|
width = (options.type !== Common.Utils.importTextType.DRM) ? 340 : (options.warning ? 420 : 280);
|
||||||
height = (options.type == Common.Utils.importTextType.CSV || options.type == Common.Utils.importTextType.Paste || options.type == Common.Utils.importTextType.Columns) ? 190 : (options.warning ? 187 : 147);
|
switch (options.type) {
|
||||||
|
case Common.Utils.importTextType.CSV:
|
||||||
|
case Common.Utils.importTextType.Paste:
|
||||||
|
case Common.Utils.importTextType.Columns:
|
||||||
|
height = 190;
|
||||||
|
break;
|
||||||
|
case Common.Utils.importTextType.Data:
|
||||||
|
height = 245;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
height = options.warning ? 187 : 147;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(_options, {
|
_.extend(_options, {
|
||||||
|
@ -114,13 +126,13 @@ define([
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<% } %>',
|
'<% } %>',
|
||||||
'<% if (type == Common.Utils.importTextType.Paste || type == Common.Utils.importTextType.Columns) { %>',
|
'<% if (type == Common.Utils.importTextType.Paste || type == Common.Utils.importTextType.Columns || type == Common.Utils.importTextType.Data) { %>',
|
||||||
'<div style="display: inline-block; margin-bottom:15px;width: 100%;">',
|
'<div style="display: inline-block; margin-bottom:15px;width: 100%;">',
|
||||||
'<label class="header">' + t.txtDelimiter + '</label>',
|
'<label class="header">' + t.txtDelimiter + '</label>',
|
||||||
'<div>',
|
'<div>',
|
||||||
'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 100px;display: inline-block; vertical-align: middle;"></div>',
|
'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 100px;display: inline-block; vertical-align: middle;"></div>',
|
||||||
'<div id="id-delimiter-other" class="input-row" style="display: inline-block; vertical-align: middle;margin-left: 10px;"></div>',
|
'<div id="id-delimiter-other" class="input-row" style="display: inline-block; vertical-align: middle;margin-left: 10px;"></div>',
|
||||||
'<button type="button" class="btn btn-text-default" id="id-delimiters-advanced" style="min-width:100px; display: inline-block;float:right;">' + t.txtAdvanced + '</button>',
|
'<button type="button" class="btn auto btn-text-default" id="id-delimiters-advanced" style="min-width:100px; display: inline-block;float:right;">' + t.txtAdvanced + '</button>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<% } %>',
|
'<% } %>',
|
||||||
|
@ -138,6 +150,10 @@ define([
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<% } %>',
|
'<% } %>',
|
||||||
|
'<% if (type == Common.Utils.importTextType.Data) { %>',
|
||||||
|
'<label class="header" style="margin-top:15px;">' + t.txtDestData + '</label>',
|
||||||
|
'<div id="id-open-data-range" class="input-row" style="width: 100%;"></div>',
|
||||||
|
'<% } %>',
|
||||||
'<% } %>',
|
'<% } %>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
|
@ -204,6 +220,19 @@ define([
|
||||||
(this.previewData) ? this.previewCallback(this.previewData) : this.updatePreview();
|
(this.previewData) ? this.previewCallback(this.previewData) : this.updatePreview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.type == Common.Utils.importTextType.Data) {
|
||||||
|
this.txtDestRange = new Common.UI.InputFieldBtn({
|
||||||
|
el : $('#id-open-data-range'),
|
||||||
|
name : 'range',
|
||||||
|
style : 'width: 100%;',
|
||||||
|
btnHint : this.textSelectData,
|
||||||
|
allowBlank : true,
|
||||||
|
validateOnChange: true,
|
||||||
|
validateOnBlur: false
|
||||||
|
});
|
||||||
|
this.txtDestRange.on('button:click', _.bind(this.onSelectData, this));
|
||||||
|
}
|
||||||
|
|
||||||
this.onPrimary = function() {
|
this.onPrimary = function() {
|
||||||
me._handleInput('ok');
|
me._handleInput('ok');
|
||||||
return false;
|
return false;
|
||||||
|
@ -235,8 +264,12 @@ 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() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var encoding = (this.cmbEncoding && !this.cmbEncoding.isDisabled()) ? this.cmbEncoding.getValue() :
|
var encoding = (this.cmbEncoding && !this.cmbEncoding.isDisabled()) ? this.cmbEncoding.getValue() :
|
||||||
((this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : 0),
|
((this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : 0),
|
||||||
delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
|
delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
|
||||||
|
@ -248,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);
|
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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +361,7 @@ define([
|
||||||
ul.find('li div').width(width);
|
ul.find('li div').width(width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type == Common.Utils.importTextType.CSV || this.type == Common.Utils.importTextType.Paste || this.type == Common.Utils.importTextType.Columns) {
|
if (this.type == Common.Utils.importTextType.CSV || this.type == Common.Utils.importTextType.Paste || this.type == Common.Utils.importTextType.Columns || this.type == Common.Utils.importTextType.Data) {
|
||||||
this.cmbDelimiter = new Common.UI.ComboBox({
|
this.cmbDelimiter = new Common.UI.ComboBox({
|
||||||
el: $('#id-delimiters-combo', this.$window),
|
el: $('#id-delimiters-combo', this.$window),
|
||||||
style: 'width: 100px;',
|
style: 'width: 100px;',
|
||||||
|
@ -351,7 +391,7 @@ define([
|
||||||
if (this.preview)
|
if (this.preview)
|
||||||
this.inputDelimiter.on ('changing', _.bind(this.updatePreview, this));
|
this.inputDelimiter.on ('changing', _.bind(this.updatePreview, this));
|
||||||
|
|
||||||
if (this.type == Common.Utils.importTextType.Paste || this.type == Common.Utils.importTextType.Columns) {
|
if (this.type == Common.Utils.importTextType.Paste || this.type == Common.Utils.importTextType.Columns || this.type == Common.Utils.importTextType.Data) {
|
||||||
this.btnAdvanced = new Common.UI.Button({
|
this.btnAdvanced = new Common.UI.Button({
|
||||||
el: $('#id-delimiters-advanced')
|
el: $('#id-delimiters-advanced')
|
||||||
});
|
});
|
||||||
|
@ -383,6 +423,14 @@ define([
|
||||||
}
|
}
|
||||||
this.api.asc_TextImport(options, _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste);
|
this.api.asc_TextImport(options, _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste);
|
||||||
break;
|
break;
|
||||||
|
case Common.Utils.importTextType.Data:
|
||||||
|
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
||||||
|
if (this.separatorOptions) {
|
||||||
|
options.asc_setNumberDecimalSeparator(this.separatorOptions.decimal);
|
||||||
|
options.asc_setNumberGroupSeparator(this.separatorOptions.thousands);
|
||||||
|
}
|
||||||
|
this.api.asc_decodeBuffer(this.preview, options, _.bind(this.previewCallback, this));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -424,7 +472,7 @@ define([
|
||||||
delete this.scrollerX;
|
delete this.scrollerX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type == Common.Utils.importTextType.CSV || this.type == Common.Utils.importTextType.Paste || this.type == Common.Utils.importTextType.Columns) {
|
if (this.type == Common.Utils.importTextType.CSV || this.type == Common.Utils.importTextType.Paste || this.type == Common.Utils.importTextType.Columns || this.type == Common.Utils.importTextType.Data) {
|
||||||
var maxlength = 0;
|
var maxlength = 0;
|
||||||
for (var i=0; i<data.length; i++) {
|
for (var i=0; i<data.length; i++) {
|
||||||
if (data[i].length>maxlength)
|
if (data[i].length>maxlength)
|
||||||
|
@ -492,6 +540,60 @@ define([
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSelectData: function(type) {
|
||||||
|
var me = this,
|
||||||
|
txtRange = me.txtDestRange;
|
||||||
|
|
||||||
|
if (me.api) {
|
||||||
|
var handlerDlg = function(dlg, result) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
var txt = dlg.getSettings();
|
||||||
|
me.dataDestValid = txt;
|
||||||
|
txtRange.setValue(txt);
|
||||||
|
txtRange.checkValidate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var win = new SSE.Views.CellRangeDialog({
|
||||||
|
handler: handlerDlg
|
||||||
|
}).on('close', function() {
|
||||||
|
me.show();
|
||||||
|
_.delay(function(){
|
||||||
|
txtRange.focus();
|
||||||
|
},1);
|
||||||
|
});
|
||||||
|
|
||||||
|
var xy = me.$window.offset();
|
||||||
|
me.hide();
|
||||||
|
win.show(xy.left + 160, xy.top + 125);
|
||||||
|
win.setSettings({
|
||||||
|
api : me.api,
|
||||||
|
range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : (me.dataDestValid),
|
||||||
|
type : Asc.c_oAscSelectionDialogType.Chart
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
isRangeValid: function() {
|
||||||
|
var isvalid = true,
|
||||||
|
txtError = '';
|
||||||
|
if (_.isEmpty(this.txtDestRange.getValue())) {
|
||||||
|
isvalid = false;
|
||||||
|
txtError = this.txtEmpty;
|
||||||
|
} else {
|
||||||
|
isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDestRange.getValue());
|
||||||
|
isvalid = (isvalid == Asc.c_oAscError.ID.No);
|
||||||
|
!isvalid && (txtError = this.textInvalidRange);
|
||||||
|
}
|
||||||
|
if (!isvalid) {
|
||||||
|
this.txtDestRange.showError([txtError]);
|
||||||
|
this.txtDestRange.focus();
|
||||||
|
return isvalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isvalid;
|
||||||
|
},
|
||||||
|
|
||||||
txtDelimiter : "Delimiter",
|
txtDelimiter : "Delimiter",
|
||||||
txtEncoding : "Encoding ",
|
txtEncoding : "Encoding ",
|
||||||
txtSpace : "Space",
|
txtSpace : "Space",
|
||||||
|
@ -508,7 +610,11 @@ define([
|
||||||
txtSemicolon: 'Semicolon',
|
txtSemicolon: 'Semicolon',
|
||||||
txtProtected: 'Once you enter the password and open the file, the current password to the file will be reset.',
|
txtProtected: 'Once you enter the password and open the file, the current password to the file will be reset.',
|
||||||
txtAdvanced: 'Advanced',
|
txtAdvanced: 'Advanced',
|
||||||
txtOpenFile: "Enter a password to open the file"
|
txtOpenFile: "Enter a password to open the file",
|
||||||
|
textSelectData: 'Select data',
|
||||||
|
txtDestData: 'Choose where to put the data',
|
||||||
|
txtEmpty: 'This field is required',
|
||||||
|
textInvalidRange: 'Invalid cells range'
|
||||||
|
|
||||||
}, Common.Views.OpenDialog || {}));
|
}, Common.Views.OpenDialog || {}));
|
||||||
});
|
});
|
|
@ -77,7 +77,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon.img-commonctrl {
|
||||||
float: left;
|
float: left;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
|
|
@ -2179,15 +2179,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2206,7 +2206,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 {
|
||||||
|
|
|
@ -2020,7 +2020,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 {
|
||||||
|
|
|
@ -92,7 +92,8 @@ define([
|
||||||
'data:groupsettings': this.onGroupSettings,
|
'data:groupsettings': this.onGroupSettings,
|
||||||
'data:sortcustom': this.onCustomSort,
|
'data:sortcustom': this.onCustomSort,
|
||||||
'data:remduplicates': this.onRemoveDuplicates,
|
'data:remduplicates': this.onRemoveDuplicates,
|
||||||
'data:datavalidation': this.onDataValidation
|
'data:datavalidation': this.onDataValidation,
|
||||||
|
'data:fromtext': this.onDataFromText
|
||||||
},
|
},
|
||||||
'Statusbar': {
|
'Statusbar': {
|
||||||
'sheet:changed': this.onApiSheetChanged
|
'sheet:changed': this.onApiSheetChanged
|
||||||
|
@ -208,15 +209,59 @@ 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);
|
})).show();
|
||||||
me.api.asc_TextToColumns(options);
|
},
|
||||||
|
|
||||||
|
onDataFromText: function(type) {
|
||||||
|
var me = this;
|
||||||
|
if (type === 'file') {
|
||||||
|
if (this.api)
|
||||||
|
this.api.asc_TextFromFileOrUrl(this._state.CSVOptions, _.bind(this.onDataFromTextCallback, this));
|
||||||
|
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
|
} else if (type === 'url') {
|
||||||
|
(new Common.Views.ImageFromUrlDialog({
|
||||||
|
handler: function(result, value) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
if (me.api) {
|
||||||
|
var checkUrl = value.replace(/\s/g, '');
|
||||||
|
if (!_.isEmpty(checkUrl)) {
|
||||||
|
me.api.asc_TextFromFileOrUrl(me._state.CSVOptions, _.bind(me.onDataFromTextCallback, me), checkUrl);
|
||||||
|
} else {
|
||||||
|
Common.UI.warning({
|
||||||
|
msg: me.textEmptyUrl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})).show();
|
||||||
|
} else if (type === 'storage') {
|
||||||
|
// Common.NotificationCenter.trigger('storage:data-load', 'add');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onDataFromTextCallback: function(advOptions) {
|
||||||
|
var me = this;
|
||||||
|
(new Common.Views.OpenDialog({
|
||||||
|
title: me.txtImportWizard,
|
||||||
|
closable: true,
|
||||||
|
type: Common.Utils.importTextType.Data,
|
||||||
|
preview: advOptions.asc_getData(),
|
||||||
|
settings: advOptions ? advOptions.asc_getRecommendedSettings() : me._state.CSVOptions,
|
||||||
|
codepages: advOptions ? advOptions.asc_getCodePages() : null,
|
||||||
|
api: me.api,
|
||||||
|
handler: function (result, settings) {
|
||||||
|
if (result == 'ok' && me.api) {
|
||||||
|
me.api.asc_TextToColumns(settings.textOptions, settings.data, settings.range);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
@ -379,7 +424,9 @@ define([
|
||||||
textColumns: 'Columns',
|
textColumns: 'Columns',
|
||||||
txtDataValidation: 'Data Validation',
|
txtDataValidation: 'Data Validation',
|
||||||
txtExtendDataValidation: 'The selection contains some cells without Data Validation settings.<br>Do you want to extend Data Validation to these cells?',
|
txtExtendDataValidation: 'The selection contains some cells without Data Validation settings.<br>Do you want to extend Data Validation to these cells?',
|
||||||
txtRemoveDataValidation: 'The selection contains more than one type of validation.<br>Erase current settings and continue?'
|
txtRemoveDataValidation: 'The selection contains more than one type of validation.<br>Erase current settings and continue?',
|
||||||
|
textEmptyUrl: 'You need to specify URL.',
|
||||||
|
txtImportWizard: 'Text Import Wizard'
|
||||||
|
|
||||||
}, SSE.Controllers.DataTab || {}));
|
}, SSE.Controllers.DataTab || {}));
|
||||||
});
|
});
|
|
@ -2592,16 +2592,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;
|
||||||
|
|
|
@ -1917,15 +1917,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1944,7 +1944,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 {
|
||||||
|
|
|
@ -199,6 +199,10 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="panel" data-tab="data">
|
<section class="panel" data-tab="data">
|
||||||
|
<div class="group">
|
||||||
|
<span class="btn-slot text x-huge" id="slot-btn-data-from-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="separator long"></div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<div class="elset">
|
<div class="elset">
|
||||||
<span class="btn-slot split slot-btn-setfilter"></span>
|
<span class="btn-slot split slot-btn-setfilter"></span>
|
||||||
|
|
|
@ -102,6 +102,12 @@ define([
|
||||||
me.btnCustomSort.on('click', function (b, e) {
|
me.btnCustomSort.on('click', function (b, e) {
|
||||||
me.fireEvent('data:sortcustom');
|
me.fireEvent('data:sortcustom');
|
||||||
});
|
});
|
||||||
|
me.btnDataFromText.menu ?
|
||||||
|
me.btnDataFromText.menu.on('item:click', function (menu, item, e) {
|
||||||
|
me.fireEvent('data:fromtext', [item.value]);
|
||||||
|
}) : me.btnDataFromText.on('click', function (b, e) {
|
||||||
|
me.fireEvent('data:fromtext', ['file']);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -117,6 +123,17 @@ define([
|
||||||
$host = me.toolbar.$el,
|
$host = me.toolbar.$el,
|
||||||
_set = SSE.enumLock;
|
_set = SSE.enumLock;
|
||||||
|
|
||||||
|
this.btnDataFromText = new Common.UI.Button({
|
||||||
|
parentEl: $host.find('#slot-btn-data-from-text'),
|
||||||
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
iconCls: 'toolbar__icon btn-import-data',
|
||||||
|
caption: this.capDataFromText,
|
||||||
|
menu: !this.toolbar.mode.isDesktopApp,
|
||||||
|
disabled: true,
|
||||||
|
lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.sheetLock, _set.lostConnect, _set.coAuth]
|
||||||
|
});
|
||||||
|
this.lockedControls.push(this.btnDataFromText);
|
||||||
|
|
||||||
this.btnGroup = new Common.UI.Button({
|
this.btnGroup = new Common.UI.Button({
|
||||||
parentEl: $host.find('#slot-btn-group'),
|
parentEl: $host.find('#slot-btn-group'),
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
@ -251,6 +268,15 @@ define([
|
||||||
});
|
});
|
||||||
me.btnGroup.setMenu(_menu);
|
me.btnGroup.setMenu(_menu);
|
||||||
|
|
||||||
|
me.btnDataFromText.updateHint(me.tipDataFromText);
|
||||||
|
me.btnDataFromText.menu && me.btnDataFromText.setMenu(new Common.UI.Menu({
|
||||||
|
items: [
|
||||||
|
{ caption: me.mniFromFile, value: 'file' },
|
||||||
|
{ caption: me.mniFromUrl, value: 'url' }
|
||||||
|
// { caption: me.mniImageFromStorage, value: 'storage'}
|
||||||
|
]
|
||||||
|
}));
|
||||||
|
|
||||||
me.btnTextToColumns.updateHint(me.tipToColumns);
|
me.btnTextToColumns.updateHint(me.tipToColumns);
|
||||||
me.btnRemoveDuplicates.updateHint(me.tipRemDuplicates);
|
me.btnRemoveDuplicates.updateHint(me.tipRemDuplicates);
|
||||||
me.btnDataValidation.updateHint(me.tipDataValidation);
|
me.btnDataValidation.updateHint(me.tipDataValidation);
|
||||||
|
@ -326,7 +352,11 @@ define([
|
||||||
capBtnTextRemDuplicates: 'Remove Duplicates',
|
capBtnTextRemDuplicates: 'Remove Duplicates',
|
||||||
tipRemDuplicates: 'Remove duplicate rows from a sheet',
|
tipRemDuplicates: 'Remove duplicate rows from a sheet',
|
||||||
capBtnTextDataValidation: 'Data Validation',
|
capBtnTextDataValidation: 'Data Validation',
|
||||||
tipDataValidation: 'Data validation'
|
tipDataValidation: 'Data validation',
|
||||||
|
capDataFromText: 'From Text/CSV',
|
||||||
|
tipDataFromText: 'Get data from Text/CSV file',
|
||||||
|
mniFromFile: 'Get Data from File',
|
||||||
|
mniFromUrl: 'Get Data from URL'
|
||||||
}
|
}
|
||||||
}()), SSE.Views.DataTab || {}));
|
}()), SSE.Views.DataTab || {}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -249,6 +249,10 @@
|
||||||
"Common.Views.OpenDialog.txtTab": "Tab",
|
"Common.Views.OpenDialog.txtTab": "Tab",
|
||||||
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
|
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
|
||||||
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
|
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
|
||||||
|
"Common.Views.OpenDialog.textSelectData": "Select data",
|
||||||
|
"Common.Views.OpenDialog.txtDestData": "Choose where to put the data",
|
||||||
|
"Common.Views.OpenDialog.txtEmpty": "This field is required",
|
||||||
|
"Common.Views.OpenDialog.textInvalidRange": "Invalid cells range",
|
||||||
"Common.Views.PasswordDialog.txtDescription": "Set a password to protect this document",
|
"Common.Views.PasswordDialog.txtDescription": "Set a password to protect this document",
|
||||||
"Common.Views.PasswordDialog.txtIncorrectPwd": "Confirmation password is not identical",
|
"Common.Views.PasswordDialog.txtIncorrectPwd": "Confirmation password is not identical",
|
||||||
"Common.Views.PasswordDialog.txtPassword": "Password",
|
"Common.Views.PasswordDialog.txtPassword": "Password",
|
||||||
|
@ -398,6 +402,8 @@
|
||||||
"SSE.Controllers.DataTab.txtRemDuplicates": "Remove Duplicates",
|
"SSE.Controllers.DataTab.txtRemDuplicates": "Remove Duplicates",
|
||||||
"SSE.Controllers.DataTab.txtRemoveDataValidation": "The selection contains more than one type of validation.<br>Erase current settings and continue?",
|
"SSE.Controllers.DataTab.txtRemoveDataValidation": "The selection contains more than one type of validation.<br>Erase current settings and continue?",
|
||||||
"SSE.Controllers.DataTab.txtRemSelected": "Remove in selected",
|
"SSE.Controllers.DataTab.txtRemSelected": "Remove in selected",
|
||||||
|
"SSE.Controllers.DataTab.textEmptyUrl": "You need to specify URL.",
|
||||||
|
"SSE.Controllers.DataTab.txtImportWizard": "Text Import Wizard",
|
||||||
"SSE.Controllers.DocumentHolder.alignmentText": "Alignment",
|
"SSE.Controllers.DocumentHolder.alignmentText": "Alignment",
|
||||||
"SSE.Controllers.DocumentHolder.centerText": "Center",
|
"SSE.Controllers.DocumentHolder.centerText": "Center",
|
||||||
"SSE.Controllers.DocumentHolder.deleteColumnText": "Delete Column",
|
"SSE.Controllers.DocumentHolder.deleteColumnText": "Delete Column",
|
||||||
|
@ -1673,6 +1679,10 @@
|
||||||
"SSE.Views.DataTab.tipRemDuplicates": "Remove duplicate rows from a sheet",
|
"SSE.Views.DataTab.tipRemDuplicates": "Remove duplicate rows from a sheet",
|
||||||
"SSE.Views.DataTab.tipToColumns": "Separate cell text into columns",
|
"SSE.Views.DataTab.tipToColumns": "Separate cell text into columns",
|
||||||
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
|
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
|
||||||
|
"SSE.Views.DataTab.capDataFromText": "From Text/CSV",
|
||||||
|
"SSE.Views.DataTab.tipDataFromText": "Get data from Text/CSV file",
|
||||||
|
"SSE.Views.DataTab.mniFromFile": "Get Data from File",
|
||||||
|
"SSE.Views.DataTab.mniFromUrl": "Get Data from URL",
|
||||||
"SSE.Views.DataValidationDialog.errorFormula": "The value currently evaluates to an error. Do you want to continue?",
|
"SSE.Views.DataValidationDialog.errorFormula": "The value currently evaluates to an error. Do you want to continue?",
|
||||||
"SSE.Views.DataValidationDialog.errorInvalid": "The value you entered for the field \"{0}\" is invalid.",
|
"SSE.Views.DataValidationDialog.errorInvalid": "The value you entered for the field \"{0}\" is invalid.",
|
||||||
"SSE.Views.DataValidationDialog.errorInvalidDate": "The date you entered for the field \"{0}\" is invalid.",
|
"SSE.Views.DataValidationDialog.errorInvalidDate": "The date you entered for the field \"{0}\" is invalid.",
|
||||||
|
|
Loading…
Reference in a new issue