mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 11:31:19 +08:00
[PDF] Add settings for combobox/listbox fields
This commit is contained in:
@ -18,17 +18,17 @@
|
||||
</tr>
|
||||
</table>
|
||||
<table cols="2" role="presentation">
|
||||
<tr class="form-list">
|
||||
<tr class="form-list-common">
|
||||
<td colspan="2" class="padding-small">
|
||||
<div class="separator horizontal"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-list">
|
||||
<tr class="form-list-common">
|
||||
<td colspan="2" class="padding-small">
|
||||
<label class="input-label"><%= scope.textValue %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-list" style="vertical-align: top;">
|
||||
<tr class="form-list-common" style="vertical-align: top;">
|
||||
<td class="padding-small">
|
||||
<div id="form-txt-new-value" style="width:164px;" class="margin-right-5"></div>
|
||||
</td>
|
||||
@ -36,16 +36,31 @@
|
||||
<div id="form-list-add" class="margin-left-5"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-list" style="vertical-align: top;">
|
||||
<td class="padding-small">
|
||||
<tr class="form-list-common" style="vertical-align: top;">
|
||||
<td class="padding-large">
|
||||
<div id="form-list-list" style="width:164px; height: 95px;" class="margin-right-5"></div>
|
||||
</td>
|
||||
<td class="padding-small">
|
||||
<td class="padding-large">
|
||||
<div id="form-list-delete" style="margin-bottom: 5px;" class="margin-left-5"></div>
|
||||
<div id="form-list-up" style="margin-bottom: 5px;" class="margin-left-5"></div>
|
||||
<div id="form-list-down" class="margin-left-5"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-combo">
|
||||
<td colspan="2" class="padding-small">
|
||||
<div id="form-chb-custom-text"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-list">
|
||||
<td colspan="2" class="padding-small">
|
||||
<div id="form-chb-multisel"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-list-common">
|
||||
<td colspan="2" class="padding-small">
|
||||
<div id="form-chb-commit"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cols="1" role="presentation">
|
||||
<tr class="form-text">
|
||||
@ -53,19 +68,11 @@
|
||||
<div class="separator horizontal"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-combo">
|
||||
<td class="padding-small"></td>
|
||||
</tr>
|
||||
<tr class="form-autofit">
|
||||
<td class="padding-small">
|
||||
<div id="form-chb-autofit"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-combo">
|
||||
<td class="padding-small">
|
||||
<div id="form-chb-custom-text"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-text">
|
||||
<td class="padding-small">
|
||||
<div id="form-chb-multiline"></div>
|
||||
|
||||
@ -85,7 +85,8 @@ define([
|
||||
scope: this
|
||||
}));
|
||||
this.PlaceholderSettings = el.find('.form-placeholder');
|
||||
this.ListOnlySettings = el.find('.form-list');
|
||||
this.ListSettings = el.find('.form-list-common');
|
||||
this.ListboxOnlySettings = el.find('.form-list');
|
||||
this.AutofitSettings = el.find('.form-autofit');
|
||||
this.TextSettings = el.find('.form-text');
|
||||
this.ComboSettings = el.find('.form-combo');
|
||||
@ -277,6 +278,18 @@ define([
|
||||
dataHintOffset: 'small'
|
||||
});
|
||||
this.chCustomText.on('change', this.onChCustomText.bind(this));
|
||||
this.lockedControls.push(this.chCustomText);
|
||||
|
||||
// dropdown list
|
||||
this.chMultisel = new Common.UI.CheckBox({
|
||||
el: $markup.findById('#form-chb-multisel'),
|
||||
labelText: this.textMultisel,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'left',
|
||||
dataHintOffset: 'small'
|
||||
});
|
||||
this.chMultisel.on('change', this.onChMultisel.bind(this));
|
||||
this.lockedControls.push(this.chMultisel);
|
||||
|
||||
// combobox & dropdown list
|
||||
this.txtNewValue = new Common.UI.InputField({
|
||||
@ -360,6 +373,16 @@ define([
|
||||
this.btnListDown.on('click', _.bind(this.onMoveItem, this, false));
|
||||
this.lockedControls.push(this.btnListDown);
|
||||
|
||||
this.chCommit = new Common.UI.CheckBox({
|
||||
el: $markup.findById('#form-chb-commit'),
|
||||
labelText: this.textCommit,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'left',
|
||||
dataHintOffset: 'small'
|
||||
});
|
||||
this.chCommit.on('change', this.onChCommit.bind(this));
|
||||
this.lockedControls.push(this.chCommit);
|
||||
|
||||
this.UpdateThemeColors();
|
||||
},
|
||||
|
||||
@ -547,6 +570,20 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
onChMultisel: function(field, newValue, oldValue, eOpts){
|
||||
if (this.api && !this._noApply) {
|
||||
this.api.SetListboxFieldMultiSelect(field.getValue()=='checked');
|
||||
this.fireEvent('editcomplete', this);
|
||||
}
|
||||
},
|
||||
|
||||
onChCommit: function(field, newValue, oldValue, eOpts){
|
||||
if (this.api && !this._noApply) {
|
||||
this.api.SetListFieldCommitOnSelChange(field.getValue()=='checked');
|
||||
this.fireEvent('editcomplete', this);
|
||||
}
|
||||
},
|
||||
|
||||
onChMaxCharsChanged: function(field, newValue, oldValue, eOpts){
|
||||
var checked = (field.getValue()=='checked');
|
||||
if (this.api && !this._noApply) {
|
||||
@ -735,7 +772,14 @@ define([
|
||||
this.chCustomText.setValue(!!val, true);
|
||||
this._state.CustomText=val;
|
||||
}
|
||||
this.chCustomText.setDisabled(this._state.DisabledControls);
|
||||
}
|
||||
|
||||
if (type == AscPDF.FIELD_TYPES.listbox && specProps) {
|
||||
val = specProps.asc_getMultipleSelection();
|
||||
if ( this._state.Multisel!==val ) {
|
||||
this.chMultisel.setValue(!!val, true);
|
||||
this._state.Multisel=val;
|
||||
}
|
||||
}
|
||||
|
||||
//for list controls
|
||||
@ -766,6 +810,12 @@ define([
|
||||
this.btnListAdd.setDisabled(true);
|
||||
this._state.listValue = this._state.listIndex = undefined;
|
||||
}
|
||||
|
||||
val = specProps.asc_getCommitOnSelChange();
|
||||
if ( this._state.Commit!==val ) {
|
||||
this.chCommit.setValue(!!val, true);
|
||||
this._state.Commit=val;
|
||||
}
|
||||
}
|
||||
this.disableListButtons();
|
||||
}
|
||||
@ -891,9 +941,10 @@ define([
|
||||
isListbox = type === AscPDF.FIELD_TYPES.listbox;
|
||||
this.PlaceholderSettings.toggleClass('hidden', !(isCombobox || isText));
|
||||
this.AutofitSettings.toggleClass('hidden', !(isCombobox || isText));
|
||||
this.ListOnlySettings.toggleClass('hidden', !(isCombobox || isListbox));
|
||||
this.ListSettings.toggleClass('hidden', !(isCombobox || isListbox));
|
||||
this.TextSettings.toggleClass('hidden', !isText);
|
||||
this.ComboSettings.toggleClass('hidden', !isCombobox);
|
||||
this.ListboxOnlySettings.toggleClass('hidden', !isListbox);
|
||||
}
|
||||
|
||||
}, PDFE.Views.FormSettings || {}));
|
||||
|
||||
@ -1407,6 +1407,8 @@
|
||||
"PDFE.Views.FormSettings.textCustomText": "Allow custom text",
|
||||
"PDFE.Views.FormSettings.textMaxChars": "Characters limit",
|
||||
"PDFE.Views.FormSettings.textComb": "Comb of characters",
|
||||
"PDFE.Views.FormSettings.textCommit": "Commit selected value immediately",
|
||||
"PDFE.Views.FormSettings.textMultisel": "Multiple selection",
|
||||
"PDFE.Views.FormsTab.capBtnCheckBox": "Checkbox",
|
||||
"PDFE.Views.FormsTab.capBtnComboBox": "Combo Box",
|
||||
"PDFE.Views.FormsTab.capBtnDownloadForm": "Download As PDF",
|
||||
|
||||
Reference in New Issue
Block a user