Merge pull request #601 from ONLYOFFICE/feature/sse-custom-format

Feature/sse custom format
This commit is contained in:
Julia Radzhabova 2020-12-02 12:06:57 +03:00 committed by GitHub
commit 2ae72903cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,6 +139,7 @@ define([
'<tr class="format-code">',
'<td colspan="1" class="padding-large">',
'<label class="header">', me.textFormat,'</label>',
'<div id="format-settings-txt-code" class="input-group-nr" style="height:22px;width:264px;margin-bottom: 8px;"></div>',
'<div id="format-settings-combo-code" class="input-group-nr" style="width:264px;"></div>',
'</td>',
'</tr>',
@ -239,6 +240,17 @@ define([
});
this.cmbCode.on('selected', _.bind(this.onCodeSelect, this));
this.inputCustomFormat = new Common.UI.InputField({
el : $('#format-settings-txt-code'),
allowBlank : true,
validateOnChange : true,
validation : function () { return true; }
}).on ('changing', function (input, value) {
(me.cmbCode.getValue() !== me.txtCustom) && me.cmbCode.setValue(me.txtCustom);
me.Format = me.api.asc_convertNumFormatLocal2NumFormat(value);
me.lblExample.text(me.api.asc_getLocaleExample(me.Format));
});
this._decimalPanel = this.$window.find('.format-decimal');
this._negativePanel = this.$window.find('.format-negative');
this._separatorPanel = this.$window.find('.format-separator');
@ -409,6 +421,7 @@ define([
onCodeSelect: function(combo, record){
this.Format = record.value;
this.lblExample.text(this.api.asc_getLocaleExample(this.Format));
this.inputCustomFormat.setValue(record.displayValue);
},
onFormatSelect: function(combo, record, e, initFormatInfo) {
@ -488,7 +501,7 @@ define([
data = [],
isCustom = (this.CustomFormat) ? true : false;
formatsarr.forEach(function(item) {
data.push({value: item, displayValue: item});
data.push({value: item, displayValue: me.api.asc_convertNumFormat2NumFormatLocal(item)});
if (me.CustomFormat == item)
isCustom = false;
});
@ -496,7 +509,9 @@ define([
data.push({value: this.CustomFormat, displayValue: this.CustomFormat});
}
this.cmbCode.setData(data);
this.cmbCode.setValue(this.Format);
var value = me.api.asc_convertNumFormat2NumFormatLocal(this.Format);
this.cmbCode.setValue(value);
this.inputCustomFormat.setValue(value);
}
this.lblExample.text(this.api.asc_getLocaleExample(this.Format));