1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

JS -- Add support for buttons

* radio buttons
 * checkboxes
This commit is contained in:
Calixte Denizet 2020-11-18 18:54:26 +01:00
parent 9c99df7cac
commit 7c3facb174
10 changed files with 280 additions and 24 deletions

View file

@ -1944,18 +1944,19 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
getFieldObject() {
let type = "button";
let value = null;
let exportValues;
if (this.data.checkBox) {
type = "checkbox";
value = this.data.fieldValue && this.data.fieldValue !== "Off";
exportValues = this.data.exportValue;
} else if (this.data.radioButton) {
type = "radiobutton";
value = this.data.fieldValue === this.data.buttonValue;
exportValues = this.data.buttonValue;
}
return {
id: this.data.id,
value,
value: this.data.fieldValue || null,
defaultValue: this.data.defaultFieldValue,
exportValues,
editable: !this.data.readOnly,
name: this.data.fieldName,
rect: this.data.rect,
@ -2036,6 +2037,7 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
editable: !this.data.readOnly,
name: this.data.fieldName,
rect: this.data.rect,
numItems: this.data.fieldValue.length,
multipleSelection: this.data.multiSelect,
hidden: this.data.hidden,
actions: this.data.actions,