[SSE] Add cell indent

This commit is contained in:
Julia Radzhabova 2021-02-15 11:35:48 +03:00
parent 6429ec6861
commit 60ca0ddafe
3 changed files with 44 additions and 2 deletions

View file

@ -109,6 +109,16 @@
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2 class="">
<label class="header"><%= scope.textIndent %></label>
</td>
</tr>
<tr>
<td class="padding-large" colspan=2>
<div id="cell-spin-indent" style="display: inline-block;"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textOrientation %></label>

View file

@ -73,6 +73,7 @@ define([
DisabledControls: true,
DisabledFillPanels: false,
CellAngle: undefined,
CellIndent: undefined,
GradFillType: Asc.c_oAscFillGradType.GRAD_LINEAR,
CellColor: 'transparent',
FillType: Asc.c_oAscFill.FILL_TYPE_NOFILL,
@ -150,6 +151,10 @@ define([
this.api && this.api.asc_setCellAngle(field.getNumberValue());
},
onIndentChange: function(field, newValue, oldValue, eOpts) {
this.api && this.api.asc_setCellIndent(field.getNumberValue());
},
render: function () {
var el = $(this.el);
el.html(this.template({
@ -429,6 +434,21 @@ define([
});
this.lockedControls.push(this.btnBackColor);
this.spnIndent = new Common.UI.MetricSpinner({
el: $('#cell-spin-indent'),
step: 1,
width: 60,
defaultUnit : "",
value: '0',
allowDecimal: false,
maxValue: 250,
minValue: 0,
disabled: this._locked
});
this.lockedControls.push(this.spnIndent);
this.spnIndent.on('change', _.bind(this.onIndentChange, this));
this.spnIndent.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
this.spnAngle = new Common.UI.MetricSpinner({
el: $('#cell-spin-angle'),
step: 1,
@ -512,12 +532,21 @@ define([
this._noApply = true;
var xfs = props.asc_getXfs(),
value = xfs.asc_getAngle();
value = xfs.asc_getAngle(),
align = xfs.asc_getHorAlign();
if (Math.abs(this._state.CellAngle - value) > 0.1 || (this._state.CellAngle === undefined) && (this._state.CellAngle !== value)) {
this.spnAngle.setValue((value !== null) ? (value==255 ? 0 : value) : '', true);
this._state.CellAngle = value;
}
value = xfs.asc_getIndent();
if (Math.abs(this._state.CellIndent - value) > 0.1 || (this._state.CellIndent === undefined) && (this._state.CellIndent !== value)) {
this.spnIndent.setValue((value !== null) ? value : '', true);
this._state.CellIndent = value;
}
this._state.IndentDisabled = (this._state.CellAngle>0 || align!==AscCommon.align_Left && align!==AscCommon.align_Right);
this.spnIndent.setDisabled(this._locked || this._state.IndentDisabled);
value = xfs.asc_getWrapText();
if ( this._state.Wrap!==value ) {
this.chWrap.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
@ -898,6 +927,7 @@ define([
item.setDisabled(disable);
});
}
this.spnIndent.setDisabled(disable || this._state.IndentDisabled);
},
onFillSrcSelect: function(combo, record) {
@ -1319,7 +1349,8 @@ define([
textGradientColor: 'Color',
textPosition: 'Position',
tipAddGradientPoint: 'Add gradient point',
tipRemoveGradientPoint: 'Remove gradient point'
tipRemoveGradientPoint: 'Remove gradient point',
textIndent: 'Indent'
}, SSE.Views.CellSettings || {}));
});

View file

@ -1370,6 +1370,7 @@
"SSE.Views.CellSettings.tipRemoveGradientPoint": "Remove gradient point",
"SSE.Views.CellSettings.tipRight": "Set outer right border only",
"SSE.Views.CellSettings.tipTop": "Set outer top border only",
"SSE.Views.CellSettings.textIndent": "Indent",
"SSE.Views.ChartDataDialog.errorInFormula": "There's an error in formula you entered.",
"SSE.Views.ChartDataDialog.errorInvalidReference": "The reference is not valid. Reference must be to an open worksheet.",
"SSE.Views.ChartDataDialog.errorMaxPoints": "The maximum number of points in series per chart is 4096.",