mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[JS] Take into account all the required fields for some computations
- Fix Field::getArray in order to collect only the fields which have a value; - Fix AFSimple_Calculate: * allow to have a string with a list of field names as argument; * since a field can be non-terminal, use Field::getArray to collect the field under it and then apply the calculation on all the descendants.
This commit is contained in:
parent
c6cc7c6e6a
commit
e756bb69e4
4 changed files with 154 additions and 10 deletions
|
@ -500,14 +500,18 @@ class AForm {
|
|||
|
||||
const event = globalThis.event;
|
||||
const values = [];
|
||||
|
||||
cFields = this.AFMakeArrayFromList(cFields);
|
||||
for (const cField of cFields) {
|
||||
const field = this._document.getField(cField);
|
||||
if (!field) {
|
||||
continue;
|
||||
}
|
||||
const number = this.AFMakeNumber(field.value);
|
||||
if (number !== null) {
|
||||
values.push(number);
|
||||
for (const child of field.getArray()) {
|
||||
const number = this.AFMakeNumber(child.value);
|
||||
if (number !== null) {
|
||||
values.push(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue