[DE] Fix Bug 48354

This commit is contained in:
Julia Radzhabova 2021-01-22 15:59:23 +03:00
parent c7eebb33a8
commit ae7135459e

View file

@ -79,6 +79,7 @@ define([
this._originalTextFormProps = null; this._originalTextFormProps = null;
this._originalFormProps = null; this._originalFormProps = null;
this._originalProps = null; this._originalProps = null;
this.forceUpdate = false;
this.render(); this.render();
}, },
@ -332,6 +333,7 @@ define([
onKeyChanged: function(combo, record) { onKeyChanged: function(combo, record) {
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
this.forceUpdate = true;
var props = this._originalProps || new AscCommon.CContentControlPr(); var props = this._originalProps || new AscCommon.CContentControlPr();
var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); var formPr = this._originalFormProps || new AscCommon.CSdtFormPr();
formPr.put_Key(record.value); formPr.put_Key(record.value);
@ -343,6 +345,7 @@ define([
onPlaceholderChanged: function(input, newValue, oldValue, e) { onPlaceholderChanged: function(input, newValue, oldValue, e) {
if (this.api && !this._noApply && (newValue!==oldValue)) { if (this.api && !this._noApply && (newValue!==oldValue)) {
this.forceUpdate = true;
var props = this._originalProps || new AscCommon.CContentControlPr(); var props = this._originalProps || new AscCommon.CContentControlPr();
props.put_PlaceholderText(newValue || ' '); props.put_PlaceholderText(newValue || ' ');
this.api.asc_SetContentControlProperties(props, this.internalId); this.api.asc_SetContentControlProperties(props, this.internalId);
@ -353,6 +356,7 @@ define([
onHelpChanged: function(input, newValue, oldValue, e) { onHelpChanged: function(input, newValue, oldValue, e) {
if (this.api && !this._noApply && (newValue!==oldValue)) { if (this.api && !this._noApply && (newValue!==oldValue)) {
this.forceUpdate = true;
var props = this._originalProps || new AscCommon.CContentControlPr(); var props = this._originalProps || new AscCommon.CContentControlPr();
var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); var formPr = this._originalFormProps || new AscCommon.CSdtFormPr();
formPr.put_HelpText(newValue); formPr.put_HelpText(newValue);
@ -383,6 +387,7 @@ define([
onMaxCharsChange: function(field, newValue, oldValue, eOpts){ onMaxCharsChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
this.forceUpdate = true;
var props = this._originalProps || new AscCommon.CContentControlPr(); var props = this._originalProps || new AscCommon.CContentControlPr();
var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr();
var checked = (this.chMaxChars.getValue()=='checked' || this.chComb.getValue()=='checked'); var checked = (this.chMaxChars.getValue()=='checked' || this.chComb.getValue()=='checked');
@ -420,6 +425,7 @@ define([
onWidthChange: function(field, newValue, oldValue, eOpts){ onWidthChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
this.forceUpdate = true;
var props = this._originalProps || new AscCommon.CContentControlPr(); var props = this._originalProps || new AscCommon.CContentControlPr();
var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr();
if (this.spnWidth.getValue()) { if (this.spnWidth.getValue()) {
@ -436,6 +442,7 @@ define([
onGroupKeyChanged: function(combo, record) { onGroupKeyChanged: function(combo, record) {
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
this.forceUpdate = true;
var props = this._originalProps || new AscCommon.CContentControlPr(); var props = this._originalProps || new AscCommon.CContentControlPr();
var specProps = this._originalCheckProps || new AscCommon.CSdtCheckBoxPr(); var specProps = this._originalCheckProps || new AscCommon.CSdtCheckBoxPr();
specProps.put_GroupKey(record.value); specProps.put_GroupKey(record.value);
@ -587,9 +594,10 @@ define([
this._noApply = true; this._noApply = true;
this.internalId = props.get_InternalId(); this.internalId = props.get_InternalId();
this.forceUpdate = this.forceUpdate && (this.internalId !== this._state.internalId);
var val = props.get_PlaceholderText(); var val = props.get_PlaceholderText();
if (this._state.placeholder !== val) { if (this._state.placeholder !== val || this.forceUpdate) {
this.txtPlaceholder.setValue(val ? val : ''); this.txtPlaceholder.setValue(val ? val : '');
this._state.placeholder = val; this._state.placeholder = val;
} }
@ -654,7 +662,7 @@ define([
this.labelFormName.text(this.textImage); this.labelFormName.text(this.textImage);
} else } else
data = this.api.asc_GetTextFormKeys(); data = this.api.asc_GetTextFormKeys();
if (!this._state.arrKey || _.difference(this._state.arrKey, data).length>0) { if (!this._state.arrKey || _.difference(this._state.arrKey, data).length>0 || this.forceUpdate) {
var arr = []; var arr = [];
data.forEach(function(item) { data.forEach(function(item) {
arr.push({ displayValue: item, value: item }); arr.push({ displayValue: item, value: item });
@ -664,7 +672,7 @@ define([
} }
val = formPr.get_Key(); val = formPr.get_Key();
if (this._state.Key!==val) { if (this._state.Key!==val || this.forceUpdate) {
this.cmbKey.setValue(val ? val : ''); this.cmbKey.setValue(val ? val : '');
this._state.Key=val; this._state.Key=val;
} }
@ -676,7 +684,7 @@ define([
connected && this.labelConnectedFields.text(this.textConnected + ': ' + val); connected && this.labelConnectedFields.text(this.textConnected + ': ' + val);
val = formPr.get_HelpText(); val = formPr.get_HelpText();
if (this._state.help!==val) { if (this._state.help!==val || this.forceUpdate) {
this.textareaHelp.setValue(val ? val : ''); this.textareaHelp.setValue(val ? val : '');
this._state.help=val; this._state.help=val;
} }
@ -686,7 +694,7 @@ define([
var ischeckbox = (typeof val !== 'string'); var ischeckbox = (typeof val !== 'string');
if (!ischeckbox) { if (!ischeckbox) {
data = this.api.asc_GetRadioButtonGroupKeys(); data = this.api.asc_GetRadioButtonGroupKeys();
if (!this._state.arrGroupKey || _.difference(this._state.arrGroupKey, data).length>0) { if (!this._state.arrGroupKey || _.difference(this._state.arrGroupKey, data).length>0 || this.forceUpdate) {
var arr = []; var arr = [];
data.forEach(function(item) { data.forEach(function(item) {
arr.push({ displayValue: item, value: item }); arr.push({ displayValue: item, value: item });
@ -695,7 +703,7 @@ define([
this._state.arrGroupKey=data; this._state.arrGroupKey=data;
} }
if (this._state.groupKey!==val) { if (this._state.groupKey!==val || this.forceUpdate) {
this.cmbGroupKey.setValue(val ? val : ''); this.cmbGroupKey.setValue(val ? val : '');
this._state.groupKey=val; this._state.groupKey=val;
} }
@ -720,7 +728,7 @@ define([
this.spnWidth.setDisabled(!val); this.spnWidth.setDisabled(!val);
val = formTextPr.get_Width(); val = formTextPr.get_Width();
if ( (val===undefined || this._state.Width===undefined)&&(this._state.Width!==val) || Math.abs(this._state.Width-val)>0.1) { if ( (val===undefined || this._state.Width===undefined)&&(this._state.Width!==val) || Math.abs(this._state.Width-val)>0.1 || this.forceUpdate) {
this.spnWidth.setValue(val!==0 && val!==undefined ? Common.Utils.Metric.fnRecalcFromMM(val * 25.4 / 20 / 72.0) : -1, true); this.spnWidth.setValue(val!==0 && val!==undefined ? Common.Utils.Metric.fnRecalcFromMM(val * 25.4 / 20 / 72.0) : -1, true);
this._state.Width=val; this._state.Width=val;
} }
@ -734,7 +742,7 @@ define([
val = formTextPr.get_MaxCharacters(); val = formTextPr.get_MaxCharacters();
this.chMaxChars.setValue(val && val>=0); this.chMaxChars.setValue(val && val>=0);
this.spnMaxChars.setDisabled(!val || val<0); this.spnMaxChars.setDisabled(!val || val<0);
if ( (val===undefined || this._state.MaxChars===undefined)&&(this._state.MaxChars!==val) || Math.abs(this._state.MaxChars-val)>0.1) { if ( (val===undefined || this._state.MaxChars===undefined)&&(this._state.MaxChars!==val) || Math.abs(this._state.MaxChars-val)>0.1 || this.forceUpdate) {
this.spnMaxChars.setValue(val && val>=0 ? val : 10, true); this.spnMaxChars.setValue(val && val>=0 ? val : 10, true);
this._state.MaxChars=val; this._state.MaxChars=val;
} }
@ -776,6 +784,7 @@ define([
this.type = type; this.type = type;
this._state.internalId = this.internalId; this._state.internalId = this.internalId;
this.forceUpdate = false;
} }
}, },