[SSE] FormatSettingsDialog: add custom format to the list of formats.

This commit is contained in:
Julia Radzhabova 2017-01-19 14:34:37 +03:00
parent ad8c469c21
commit 973b55315d
2 changed files with 14 additions and 2 deletions

View file

@ -104,6 +104,7 @@ define([
multiselect: false, multiselect: false,
sparklines_disabled: false, sparklines_disabled: false,
numformattype: undefined, numformattype: undefined,
numformat: undefined,
langId: undefined langId: undefined
}; };
@ -908,7 +909,7 @@ define([
} }
Common.NotificationCenter.trigger('edit:complete', me.toolbar); Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}, },
props : {formatType: me._state.numformattype, langId: value} props : {formatType: me._state.numformattype, format: me._state.numformat, langId: value}
})).show(); })).show();
Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Number Format'); Common.component.Analytics.trackEvent('ToolBar', 'Number Format');
@ -1935,6 +1936,7 @@ define([
} }
val = info.asc_getNumFormatType(); val = info.asc_getNumFormatType();
this._state.numformat = info.asc_getNumFormat();
if (this._state.numformattype !== val) { if (this._state.numformattype !== val) {
toolbar.cmbNumberFormat.setValue(val, toolbar.txtCustom); toolbar.cmbNumberFormat.setValue(val, toolbar.txtCustom);
this._state.numformattype = val; this._state.numformattype = val;

View file

@ -162,6 +162,7 @@ define([
this.FormatType = Asc.c_oAscNumFormatType.General; this.FormatType = Asc.c_oAscNumFormatType.General;
this.Format = "General"; this.Format = "General";
this.CustomFormat = null;
}, },
render: function() { render: function() {
@ -262,6 +263,9 @@ define([
this.langId = props.langId; this.langId = props.langId;
this.cmbFormat.setValue(props.formatType, this.txtCustom); this.cmbFormat.setValue(props.formatType, this.txtCustom);
if ((props.formatType == Asc.c_oAscNumFormatType.Custom) && props.format)
this.CustomFormat = this.Format = props.format;
this.onFormatSelect(this.cmbFormat, this.cmbFormat.getSelectedRecord()); this.onFormatSelect(this.cmbFormat, this.cmbFormat.getSelectedRecord());
// for fraction - if props.format not in cmbType - setValue(this.txtCustom) // for fraction - if props.format not in cmbType - setValue(this.txtCustom)
// for date/time - if props.format not in cmbType - setValue(this.api.asc_getLocaleExample(props.format, 37973)) // for date/time - if props.format not in cmbType - setValue(this.api.asc_getLocaleExample(props.format, 37973))
@ -433,10 +437,16 @@ define([
info.asc_setSymbol(this.langId); info.asc_setSymbol(this.langId);
var formatsarr = this.api.asc_getFormatCells(info), var formatsarr = this.api.asc_getFormatCells(info),
data = []; data = [],
isCustom = (this.CustomFormat) ? true : false;
formatsarr.forEach(function(item) { formatsarr.forEach(function(item) {
data.push({value: item, displayValue: item}); data.push({value: item, displayValue: item});
if (me.CustomFormat == item)
isCustom = false;
}); });
if (isCustom) {
data.push({value: this.CustomFormat, displayValue: this.CustomFormat});
}
this.cmbCode.setData(data); this.cmbCode.setData(data);
this.cmbCode.setValue(this.Format); this.cmbCode.setValue(this.Format);
} }