Merge pull request #1200 from ONLYOFFICE/feature/sse-text-qualifier
Feature/sse text qualifier
This commit is contained in:
commit
5f34dcab62
|
@ -291,10 +291,12 @@ 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,
|
||||||
|
qualifier = this.separatorOptions ? this.separatorOptions.qualifier : '"';
|
||||||
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
var options = new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar);
|
||||||
decimal && options.asc_setNumberDecimalSeparator(decimal);
|
decimal && options.asc_setNumberDecimalSeparator(decimal);
|
||||||
thousands && options.asc_setNumberGroupSeparator(thousands);
|
thousands && options.asc_setNumberGroupSeparator(thousands);
|
||||||
|
qualifier && options.asc_setTextQualifier(qualifier);
|
||||||
this.handler.call(this, state, {
|
this.handler.call(this, state, {
|
||||||
textOptions: options,
|
textOptions: options,
|
||||||
range: this.txtDestRange ? this.txtDestRange.getValue() : '',
|
range: this.txtDestRange ? this.txtDestRange.getValue() : '',
|
||||||
|
@ -433,6 +435,7 @@ define([
|
||||||
if (this.separatorOptions) {
|
if (this.separatorOptions) {
|
||||||
options.asc_setNumberDecimalSeparator(this.separatorOptions.decimal);
|
options.asc_setNumberDecimalSeparator(this.separatorOptions.decimal);
|
||||||
options.asc_setNumberGroupSeparator(this.separatorOptions.thousands);
|
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);
|
this.api.asc_TextImport(options, _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste);
|
||||||
break;
|
break;
|
||||||
|
@ -441,6 +444,7 @@ define([
|
||||||
if (this.separatorOptions) {
|
if (this.separatorOptions) {
|
||||||
options.asc_setNumberDecimalSeparator(this.separatorOptions.decimal);
|
options.asc_setNumberDecimalSeparator(this.separatorOptions.decimal);
|
||||||
options.asc_setNumberGroupSeparator(this.separatorOptions.thousands);
|
options.asc_setNumberGroupSeparator(this.separatorOptions.thousands);
|
||||||
|
options.asc_setTextQualifier(this.separatorOptions.qualifier);
|
||||||
}
|
}
|
||||||
this.api.asc_decodeBuffer(this.preview, options, _.bind(this.previewCallback, this));
|
this.api.asc_decodeBuffer(this.preview, options, _.bind(this.previewCallback, this));
|
||||||
break;
|
break;
|
||||||
|
@ -536,17 +540,20 @@ define([
|
||||||
|
|
||||||
var me = this,
|
var me = this,
|
||||||
decimal = this.api.asc_getDecimalSeparator(),
|
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({
|
(new SSE.Views.AdvancedSeparatorDialog({
|
||||||
props: {
|
props: {
|
||||||
decimal: decimal,
|
decimal: decimal,
|
||||||
thousands: thousands
|
thousands: thousands,
|
||||||
|
qualifier: qualifier
|
||||||
},
|
},
|
||||||
handler: function(result, value) {
|
handler: function(result, value) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
me.separatorOptions = {
|
me.separatorOptions = {
|
||||||
decimal: (value.decimal.length > 0) ? value.decimal : decimal,
|
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
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,12 @@ define([
|
||||||
'<div style="margin-bottom: 10px;">',
|
'<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 id="id-adv-separator-thousands" class=""></div><label class="input-row" style="margin-left: 10px; padding-top: 4px;">' + this.strThousandsSeparator + '</label>',
|
||||||
'</div>',
|
'</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>'
|
'</div>'
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
|
@ -92,14 +98,27 @@ define([
|
||||||
validateOnBlur: false
|
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();
|
var $window = this.getChild();
|
||||||
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
|
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||||
|
|
||||||
this.afterRender();
|
this.afterRender();
|
||||||
},
|
},
|
||||||
|
|
||||||
getFocusedComponents: function() {
|
getFocusedComponents: function() {
|
||||||
return [this.inputDecimalSeparator, this.inputThousandsSeparator];
|
return [this.inputDecimalSeparator, this.inputThousandsSeparator, this.cmbQualifier];
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultFocusableComponent: function () {
|
getDefaultFocusableComponent: function () {
|
||||||
|
@ -114,6 +133,7 @@ define([
|
||||||
if (props) {
|
if (props) {
|
||||||
this.inputDecimalSeparator.setValue(props.decimal || '');
|
this.inputDecimalSeparator.setValue(props.decimal || '');
|
||||||
this.inputThousandsSeparator.setValue(props.thousands || '');
|
this.inputThousandsSeparator.setValue(props.thousands || '');
|
||||||
|
this.cmbQualifier.setValue(props.qualifier || null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -128,7 +148,8 @@ define([
|
||||||
|
|
||||||
_handleInput: function(state) {
|
_handleInput: function(state) {
|
||||||
if (this.options.handler) {
|
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();
|
this.close();
|
||||||
|
@ -137,7 +158,9 @@ define([
|
||||||
textTitle: 'Advanced Settings',
|
textTitle: 'Advanced Settings',
|
||||||
textLabel: 'Settings used to recognize numeric data',
|
textLabel: 'Settings used to recognize numeric data',
|
||||||
strDecimalSeparator: 'Decimal separator',
|
strDecimalSeparator: 'Decimal separator',
|
||||||
strThousandsSeparator: 'Thousands separator'
|
strThousandsSeparator: 'Thousands separator',
|
||||||
|
txtNone: '(none)',
|
||||||
|
textQualifier: 'Text qualifier'
|
||||||
|
|
||||||
}, SSE.Views.AdvancedSeparatorDialog || {}));
|
}, SSE.Views.AdvancedSeparatorDialog || {}));
|
||||||
});
|
});
|
|
@ -1432,6 +1432,8 @@
|
||||||
"SSE.Views.AdvancedSeparatorDialog.strThousandsSeparator": "Thousands separator",
|
"SSE.Views.AdvancedSeparatorDialog.strThousandsSeparator": "Thousands separator",
|
||||||
"SSE.Views.AdvancedSeparatorDialog.textLabel": "Settings used to recognize numeric data",
|
"SSE.Views.AdvancedSeparatorDialog.textLabel": "Settings used to recognize numeric data",
|
||||||
"SSE.Views.AdvancedSeparatorDialog.textTitle": "Advanced Settings",
|
"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.btnCustomFilter": "Custom Filter",
|
||||||
"SSE.Views.AutoFilterDialog.textAddSelection": "Add current selection to filter",
|
"SSE.Views.AutoFilterDialog.textAddSelection": "Add current selection to filter",
|
||||||
"SSE.Views.AutoFilterDialog.textEmptyItem": "{Blanks}",
|
"SSE.Views.AutoFilterDialog.textEmptyItem": "{Blanks}",
|
||||||
|
|
Loading…
Reference in a new issue