[DE] Add required option for form settings

This commit is contained in:
Julia Radzhabova 2021-05-20 00:38:09 +03:00
parent c44a6d4b99
commit fa803d0f4a
3 changed files with 66 additions and 2 deletions

View file

@ -34,6 +34,11 @@
<div id="form-txt-help"></div>
</td>
</tr>
<!--<tr class="form-textfield">-->
<!--<td class="padding-small">-->
<!--<div id="form-chb-fixed"></div>-->
<!--</td>-->
<!--</tr>-->
<tr class="form-textfield">
<td class="padding-small">
<div id="form-chb-max-chars" style="display: inline-block;margin-top: 4px;"></div>
@ -52,11 +57,16 @@
</td>
</tr>
<tr class="form-textfield">
<td class="padding-large">
<td class="padding-small">
<label class="input-label" style="margin-left: 22px;margin-top: 4px;"><%= scope.textColor %></label>
<div id="form-color-btn" style="display: inline-block; float: right;"></div>
</td>
</tr>
<tr class="form-textfield">
<td class="padding-large">
<div id="form-chb-required"></div>
</td>
</tr>
<tr class="form-image">
<td class="padding-large">
<div id="form-button-replace" style="width:100%;"></div>

View file

@ -189,6 +189,20 @@ define([
this.spnWidth.on('change', this.onWidthChange.bind(this));
this.spnWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);});
this.chRequired = new Common.UI.CheckBox({
el: $markup.findById('#form-chb-required'),
labelText: this.textRequired
});
this.chRequired.on('change', this.onChRequired.bind(this));
this.lockedControls.push(this.chRequired);
this.chFixed = new Common.UI.CheckBox({
el: $markup.findById('#form-chb-fixed'),
labelText: this.textFixed
});
this.chFixed.on('change', this.onChFixed.bind(this));
this.lockedControls.push(this.chFixed);
// Radio props
this.cmbGroupKey = new Common.UI.ComboBox({
el: $markup.findById('#form-combo-group-key'),
@ -432,6 +446,30 @@ define([
}
},
onChRequired: function(field, newValue, oldValue, eOpts){
var checked = (field.getValue()=='checked');
if (this.api && !this._noApply) {
var props = this._originalProps || new AscCommon.CContentControlPr();
var formPr = this._originalFormProps || new AscCommon.CSdtFormPr();
formPr.put_Required(checked);
props.put_FormPr(formPr);
this.api.asc_SetContentControlProperties(props, this.internalId);
this.fireEvent('editcomplete', this);
}
},
onChFixed: function(field, newValue, oldValue, eOpts){
var checked = (field.getValue()=='checked');
if (this.api && !this._noApply) {
var props = this._originalProps || new AscCommon.CContentControlPr();
var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr();
formTextPr.put_FixedSize(checked);
props.put_TextFormPr(formTextPr);
this.api.asc_SetContentControlProperties(props, this.internalId);
this.fireEvent('editcomplete', this);
}
},
onGroupKeyChanged: function(combo, record) {
if (this.api && !this._noApply) {
var props = this._originalProps || new AscCommon.CContentControlPr();
@ -679,6 +717,12 @@ define([
this._state.help=val;
}
val = formPr.get_Required();
if ( this._state.Required!==val ) {
this.chRequired.setValue(!!val, true);
this._state.Required=val;
}
if (type == Asc.c_oAscContentControlSpecificType.CheckBox && specProps) {
val = specProps.get_GroupKey();
var ischeckbox = (typeof val !== 'string');
@ -713,6 +757,12 @@ define([
this.chComb.setValue(!!val, true);
this._state.Comb=val;
}
//
// val = formTextPr.get_FixedSize();
// if ( this._state.Fixed!==val ) {
// this.chFixed.setValue(!!val, true);
// this._state.Fixed=val;
// }
this.btnColor.setDisabled(!val);
@ -915,7 +965,9 @@ define([
textColor: 'Border color',
textConnected: 'Fields connected',
textDisconnect: 'Disconnect',
textNoBorder: 'No border'
textNoBorder: 'No border',
textFixed: 'Fixed size field',
textRequired: 'Required'
}, DE.Views.FormSettings || {}));
});

View file

@ -1766,6 +1766,8 @@
"DE.Views.FormSettings.textUnlock": "Unlock",
"DE.Views.FormSettings.textValue": "Value Options",
"DE.Views.FormSettings.textWidth": "Cell width",
"DE.Views.FormSettings.textFixed": "Fixed size field",
"DE.Views.FormSettings.textRequired": "Required",
"DE.Views.FormsTab.capBtnCheckBox": "Checkbox",
"DE.Views.FormsTab.capBtnComboBox": "Combo Box",
"DE.Views.FormsTab.capBtnDropDown": "Dropdown",