Commit cfb39ba8 authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] Sparkline settings: change type of Line Weight component.

parent 73cfc7ef
...@@ -75,7 +75,6 @@ define([ ...@@ -75,7 +75,6 @@ define([
}); });
Common.UI.ComboBorderSize = Common.UI.ComboBox.extend(_.extend({ Common.UI.ComboBorderSize = Common.UI.ComboBox.extend(_.extend({
allowNoBorders: true,
template: _.template([ template: _.template([
'<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">', '<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="<%= style %>"></div>', '<div class="form-control" style="<%= style %>"></div>',
...@@ -105,7 +104,7 @@ define([ ...@@ -105,7 +104,7 @@ define([
{displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100}, {displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100},
{displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120} {displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120}
]; ];
if (options.allowNoBorders) if (options.allowNoBorders !== false)
data.unshift({displayValue: this.txtNoBorders, value: 0, pxValue: 0 }); data.unshift({displayValue: this.txtNoBorders, value: 0, pxValue: 0 });
Common.UI.ComboBox.prototype.initialize.call(this, _.extend({ Common.UI.ComboBox.prototype.initialize.call(this, _.extend({
...@@ -192,13 +191,8 @@ define([ ...@@ -192,13 +191,8 @@ define([
initialize : function(options) { initialize : function(options) {
this.txtNoBorders = options.txtNoBorders || this.txtNoBorders; this.txtNoBorders = options.txtNoBorders || this.txtNoBorders;
var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),
data = [
Common.UI.ComboBox.prototype.initialize.call(this, _.extend({
editable: true,
store: new Common.UI.BordersStore(),
data: [
{displayValue: this.txtNoBorders, value: 0, pxValue: 0 },
{displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0}, {displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0},
{displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20}, {displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20},
{displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40}, {displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40},
...@@ -206,7 +200,15 @@ define([ ...@@ -206,7 +200,15 @@ define([
{displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80}, {displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80},
{displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100}, {displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100},
{displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120} {displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120}
], ];
if (options.allowNoBorders !== false)
data.unshift({displayValue: this.txtNoBorders, value: 0, pxValue: 0 });
Common.UI.ComboBox.prototype.initialize.call(this, _.extend({
editable: true,
store: new Common.UI.BordersStore(),
data: data,
menuStyle: 'min-width: 150px;' menuStyle: 'min-width: 150px;'
}, options)); }, options));
}, },
......
...@@ -65,6 +65,7 @@ define([ ...@@ -65,6 +65,7 @@ define([
initialize: function () { initialize: function () {
this._initSettings = true; this._initSettings = true;
this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this._state = { this._state = {
Width: 0, Width: 0,
...@@ -233,12 +234,13 @@ define([ ...@@ -233,12 +234,13 @@ define([
} }
}); });
if (_selectedItem) if (_selectedItem)
this.cmbBorderSize.setValue(_selectedItem.get('value')); this.cmbBorderSize.selectRecord(_selectedItem);
else { else {
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : '');
} }
this.BorderSize = w; this.BorderSize = w;
} }
this.cmbBorderSize.setDisabled(this._locked || this._state.SparkType!==Asc.c_oAscSparklineType.Line);
var color = props.asc_getColorSeries(); var color = props.asc_getColorSeries();
if (color) { if (color) {
...@@ -793,10 +795,10 @@ define([ ...@@ -793,10 +795,10 @@ define([
this.mnuSparkStylePicker.on('item:click', _.bind(this.onSelectSparkStyle, this, this.btnSparkStyle)); this.mnuSparkStylePicker.on('item:click', _.bind(this.onSelectSparkStyle, this, this.btnSparkStyle));
this.lockedControls.push(this.btnSparkStyle); this.lockedControls.push(this.btnSparkStyle);
this.cmbBorderSize = new Common.UI.ComboBorderSize({ this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({
el : $('#spark-combo-line-type'), el : $('#spark-combo-line-type'),
style : 'width: 90px;', style : 'width: 90px;',
hasNoBorders: false allowNoBorders: false
}).on('selected', _.bind(this.onBorderSizeSelect, this)); }).on('selected', _.bind(this.onBorderSizeSelect, this));
this.BorderSize = this.cmbBorderSize.store.at(1).get('value'); this.BorderSize = this.cmbBorderSize.store.at(1).get('value');
this.cmbBorderSize.setValue(this.BorderSize); this.cmbBorderSize.setValue(this.BorderSize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment