[SSE] Add text import settings
This commit is contained in:
parent
9b0fba8ba6
commit
7b36d55cd1
|
@ -291,10 +291,12 @@ define([
|
|||
}
|
||||
|
||||
var decimal = this.separatorOptions ? this.separatorOptions.decimal : undefined,
|
||||
thousands = this.separatorOptions ? this.separatorOptions.thousands : undefined;
|
||||
thousands = this.separatorOptions ? this.separatorOptions.thousands : undefined,
|
||||
qualifier = this.separatorOptions ? this.separatorOptions.qualifier : undefined;
|
||||
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
||||
decimal && options.asc_setNumberDecimalSeparator(decimal);
|
||||
thousands && options.asc_setNumberGroupSeparator(thousands);
|
||||
qualifier && options.asc_setTextQualifier(qualifier);
|
||||
this.handler.call(this, state, {
|
||||
textOptions: options,
|
||||
range: this.txtDestRange ? this.txtDestRange.getValue() : '',
|
||||
|
@ -433,6 +435,7 @@ define([
|
|||
if (this.separatorOptions) {
|
||||
options.asc_setNumberDecimalSeparator(this.separatorOptions.decimal);
|
||||
options.asc_setNumberGroupSeparator(this.separatorOptions.thousands);
|
||||
options.asc_setTextQualifier(this.separatorOptions.qualifier);
|
||||
}
|
||||
this.api.asc_TextImport(options, _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste);
|
||||
break;
|
||||
|
@ -441,6 +444,7 @@ define([
|
|||
if (this.separatorOptions) {
|
||||
options.asc_setNumberDecimalSeparator(this.separatorOptions.decimal);
|
||||
options.asc_setNumberGroupSeparator(this.separatorOptions.thousands);
|
||||
options.asc_setTextQualifier(this.separatorOptions.qualifier);
|
||||
}
|
||||
this.api.asc_decodeBuffer(this.preview, options, _.bind(this.previewCallback, this));
|
||||
break;
|
||||
|
@ -536,17 +540,20 @@ define([
|
|||
|
||||
var me = this,
|
||||
decimal = this.api.asc_getDecimalSeparator(),
|
||||
thousands = this.api.asc_getGroupSeparator();
|
||||
thousands = this.api.asc_getGroupSeparator(),
|
||||
qualifier = this.settings ? this.settings.asc_getTextQualifier() : '"';
|
||||
(new SSE.Views.AdvancedSeparatorDialog({
|
||||
props: {
|
||||
decimal: decimal,
|
||||
thousands: thousands
|
||||
thousands: thousands,
|
||||
qualifier: qualifier
|
||||
},
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
me.separatorOptions = {
|
||||
decimal: (value.decimal.length > 0) ? value.decimal : decimal,
|
||||
thousands: (value.thousands.length > 0) ? value.thousands : thousands
|
||||
thousands: (value.thousands.length > 0) ? value.thousands : thousands,
|
||||
qualifier: (value.qualifier.length > 0) ? value.qualifier : qualifier
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,12 @@ define([
|
|||
'<div style="margin-bottom: 10px;">',
|
||||
'<div id="id-adv-separator-thousands" class=""></div><label class="input-row" style="margin-left: 10px; padding-top: 4px;">' + this.strThousandsSeparator + '</label>',
|
||||
'</div>',
|
||||
'<div class="input-row" style="margin-bottom: 8px;">',
|
||||
'<label>' + this.textQualifier + '</label>',
|
||||
'</div>',
|
||||
'<div style="margin-bottom: 12px;">',
|
||||
'<div id="id-adv-separator-qualifier" class="input-group-nr"></div>',
|
||||
'</div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
|
@ -92,6 +98,19 @@ define([
|
|||
validateOnBlur: false
|
||||
});
|
||||
|
||||
this.cmbQualifier = new Common.UI.ComboBox({
|
||||
el: $('#id-adv-separator-qualifier'),
|
||||
style: 'width: 100px;',
|
||||
menuStyle: 'min-width: 100px;',
|
||||
cls: 'input-group-nr',
|
||||
data: [
|
||||
{value: '"', displayValue: '"'},
|
||||
{value: '\'', displayValue: '\''},
|
||||
{value: null, displayValue: this.txtNone}],
|
||||
editable: false,
|
||||
takeFocusOnClose: true
|
||||
});
|
||||
|
||||
var $window = this.getChild();
|
||||
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
|
||||
|
||||
|
@ -99,7 +118,7 @@ define([
|
|||
},
|
||||
|
||||
getFocusedComponents: function() {
|
||||
return [this.inputDecimalSeparator, this.inputThousandsSeparator];
|
||||
return [this.inputDecimalSeparator, this.inputThousandsSeparator, this.cmbQualifier];
|
||||
},
|
||||
|
||||
getDefaultFocusableComponent: function () {
|
||||
|
@ -114,6 +133,7 @@ define([
|
|||
if (props) {
|
||||
this.inputDecimalSeparator.setValue(props.decimal || '');
|
||||
this.inputThousandsSeparator.setValue(props.thousands || '');
|
||||
this.cmbQualifier.setValue(props.qualifier || null);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -128,7 +148,8 @@ define([
|
|||
|
||||
_handleInput: function(state) {
|
||||
if (this.options.handler) {
|
||||
this.options.handler.call(this, state, {decimal: this.inputDecimalSeparator.getValue(), thousands: this.inputThousandsSeparator.getValue()});
|
||||
this.options.handler.call(this, state, {decimal: this.inputDecimalSeparator.getValue(), thousands: this.inputThousandsSeparator.getValue(),
|
||||
qualifier: this.cmbQualifier.getValue()});
|
||||
}
|
||||
|
||||
this.close();
|
||||
|
@ -137,7 +158,9 @@ define([
|
|||
textTitle: 'Advanced Settings',
|
||||
textLabel: 'Settings used to recognize numeric data',
|
||||
strDecimalSeparator: 'Decimal separator',
|
||||
strThousandsSeparator: 'Thousands separator'
|
||||
strThousandsSeparator: 'Thousands separator',
|
||||
txtNone: '(none)',
|
||||
textQualifier: 'Text qualifier'
|
||||
|
||||
}, SSE.Views.AdvancedSeparatorDialog || {}));
|
||||
});
|
|
@ -1432,6 +1432,8 @@
|
|||
"SSE.Views.AdvancedSeparatorDialog.strThousandsSeparator": "Thousands separator",
|
||||
"SSE.Views.AdvancedSeparatorDialog.textLabel": "Settings used to recognize numeric data",
|
||||
"SSE.Views.AdvancedSeparatorDialog.textTitle": "Advanced Settings",
|
||||
"SSE.Views.AdvancedSeparatorDialog.txtNone": "(none)",
|
||||
"SSE.Views.AdvancedSeparatorDialog.textQualifier": "Text qualifier",
|
||||
"SSE.Views.AutoFilterDialog.btnCustomFilter": "Custom Filter",
|
||||
"SSE.Views.AutoFilterDialog.textAddSelection": "Add current selection to filter",
|
||||
"SSE.Views.AutoFilterDialog.textEmptyItem": "{Blanks}",
|
||||
|
|
Loading…
Reference in a new issue