@legalplace/prerenderx 3.8.18-staging.2 → 3.8.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/libs/DocumentRender.d.ts +2 -3
- package/dist/libs/DocumentRender.js +4 -13
- package/dist/libs/FillPdfForm.d.ts +1 -1
- package/dist/libs/FillPdfForm.js +15 -25
- package/dist/libs/OptionRender.d.ts +0 -4
- package/dist/libs/OptionRender.js +29 -125
- package/dist/libs/OutputParser.d.ts +1 -1
- package/dist/libs/OutputParser.js +6 -18
- package/dist/libs/Prerender.d.ts +2 -5
- package/dist/libs/Prerender.js +27 -97
- package/dist/libs/SectionRender.d.ts +0 -3
- package/dist/libs/SectionRender.js +22 -64
- package/dist/libs/misc/FillPdfFormBase.d.ts +1 -1
- package/dist/libs/misc/FillPdfFormBase.js +37 -11
- package/dist/types/types.d.ts +0 -13
- package/package.json +9 -8
- package/src/libs/DocumentRender.ts +5 -33
- package/src/libs/FillPdfForm.ts +22 -39
- package/src/libs/OptionRender.ts +63 -218
- package/src/libs/OutputParser.ts +9 -40
- package/src/libs/Prerender.ts +38 -153
- package/src/libs/SectionRender.ts +28 -111
- package/src/libs/misc/FillPdfFormBase.ts +67 -34
- package/src/types/types.ts +0 -27
- package/dist/libs/outputTableRendering.d.ts +0 -16
- package/dist/libs/outputTableRendering.js +0 -130
- package/dist/libs/regionHelpers.d.ts +0 -5
- package/dist/libs/regionHelpers.js +0 -22
- package/dist/libs/tableOutputExpansion.d.ts +0 -20
- package/dist/libs/tableOutputExpansion.js +0 -68
- package/src/libs/tableOutputExpansion.ts +0 -145
- package/tests/Prerender.documentMultiple.test.ts +0 -187
|
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
var OptionRender_1 = __importDefault(require("./OptionRender"));
|
|
16
16
|
var SectionRender = (function () {
|
|
17
17
|
function SectionRender(options) {
|
|
18
|
-
var _a;
|
|
19
18
|
this.outputs = [];
|
|
20
19
|
this.references = options.references;
|
|
21
20
|
this.conditions = options.conditions;
|
|
@@ -23,88 +22,47 @@ var SectionRender = (function () {
|
|
|
23
22
|
this.currentSection = options.currentSection;
|
|
24
23
|
this.ovc = options.ovc;
|
|
25
24
|
this.NumAuto = options.numauto;
|
|
26
|
-
this.baseIndex = (_a = options.baseIndex) !== null && _a !== void 0 ? _a : 0;
|
|
27
25
|
this.renderSection();
|
|
28
26
|
}
|
|
29
27
|
SectionRender.prototype.getOutputs = function () {
|
|
30
28
|
return this.outputs;
|
|
31
29
|
};
|
|
32
|
-
SectionRender.prototype.getDocumentMultipleSource = function () {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
var docMultiple = (_b = (_a = this.references.documents[this.documentName]) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.multiple;
|
|
35
|
-
if ((docMultiple === null || docMultiple === void 0 ? void 0 : docMultiple.enabled) !== true)
|
|
36
|
-
return undefined;
|
|
37
|
-
return typeof docMultiple.repeatOption === "number"
|
|
38
|
-
? docMultiple.repeatOption
|
|
39
|
-
: undefined;
|
|
40
|
-
};
|
|
41
30
|
SectionRender.prototype.renderSection = function () {
|
|
42
31
|
var _this = this;
|
|
43
32
|
var section = this.references.sections[this.documentName][this.currentSection];
|
|
44
33
|
var conditionObject = this.references.conditions.sections[this.documentName][this.currentSection];
|
|
45
34
|
var condition = conditionObject === undefined
|
|
46
35
|
? true
|
|
47
|
-
: this.conditions.executeCondition(conditionObject, 0,
|
|
48
|
-
if (condition
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
: this.conditions.executeCondition(conditionObject, 0, 0, "sections");
|
|
37
|
+
if (condition === true) {
|
|
38
|
+
section.options.forEach(function (optionId) {
|
|
39
|
+
var option = _this.references.options[optionId];
|
|
40
|
+
var repeatOption = optionId;
|
|
41
|
+
if (option.meta.type === "repeated") {
|
|
42
|
+
if (option.meta.repeatOption === undefined)
|
|
43
|
+
return;
|
|
44
|
+
repeatOption =
|
|
45
|
+
typeof option.meta.repeatOption === "number"
|
|
46
|
+
? option.meta.repeatOption
|
|
47
|
+
: parseInt(option.meta.repeatOption, 10);
|
|
48
|
+
}
|
|
49
|
+
var inputs = _this.ovc.options[repeatOption] || [
|
|
50
|
+
!["radio", "checkbox"].includes(option.meta.type),
|
|
51
|
+
];
|
|
52
|
+
inputs.forEach(function (value, index) {
|
|
53
|
+
if (value !== true)
|
|
54
|
+
return;
|
|
57
55
|
_this.outputs = __spreadArray(__spreadArray([], _this.outputs, true), new OptionRender_1.default({
|
|
58
56
|
references: _this.references,
|
|
59
|
-
id:
|
|
57
|
+
id: optionId,
|
|
60
58
|
ovc: _this.ovc,
|
|
61
|
-
index:
|
|
59
|
+
index: index,
|
|
62
60
|
conditions: _this.conditions,
|
|
63
61
|
numauto: _this.NumAuto,
|
|
64
62
|
}).getOutputs(), true);
|
|
65
63
|
});
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
var repeatOption = optionId;
|
|
69
|
-
if (option.meta.type === "repeated") {
|
|
70
|
-
if (option.meta.repeatOption === undefined)
|
|
71
|
-
return;
|
|
72
|
-
repeatOption =
|
|
73
|
-
typeof option.meta.repeatOption === "number"
|
|
74
|
-
? option.meta.repeatOption
|
|
75
|
-
: parseInt(option.meta.repeatOption, 10);
|
|
76
|
-
}
|
|
77
|
-
var inputs = _this.ovc.options[repeatOption] || [
|
|
78
|
-
!["radio", "checkbox"].includes(option.meta.type),
|
|
79
|
-
];
|
|
80
|
-
if (documentMultipleSource !== undefined &&
|
|
81
|
-
option.meta.type !== "repeated") {
|
|
82
|
-
var valueAtIndex = _this.baseIndex < inputs.length ? inputs[_this.baseIndex] : inputs[0];
|
|
83
|
-
if (valueAtIndex !== true)
|
|
84
|
-
return;
|
|
85
|
-
_this.outputs = __spreadArray(__spreadArray([], _this.outputs, true), new OptionRender_1.default({
|
|
86
|
-
references: _this.references,
|
|
87
|
-
id: optionId,
|
|
88
|
-
ovc: _this.ovc,
|
|
89
|
-
index: _this.baseIndex,
|
|
90
|
-
conditions: _this.conditions,
|
|
91
|
-
numauto: _this.NumAuto,
|
|
92
|
-
}).getOutputs(), true);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
inputs.forEach(function (value, index) {
|
|
96
|
-
if (value !== true)
|
|
97
|
-
return;
|
|
98
|
-
_this.outputs = __spreadArray(__spreadArray([], _this.outputs, true), new OptionRender_1.default({
|
|
99
|
-
references: _this.references,
|
|
100
|
-
id: optionId,
|
|
101
|
-
ovc: _this.ovc,
|
|
102
|
-
index: index,
|
|
103
|
-
conditions: _this.conditions,
|
|
104
|
-
numauto: _this.NumAuto,
|
|
105
|
-
}).getOutputs(), true);
|
|
106
64
|
});
|
|
107
|
-
}
|
|
65
|
+
}
|
|
108
66
|
};
|
|
109
67
|
return SectionRender;
|
|
110
68
|
}());
|
|
@@ -6,11 +6,11 @@ declare class FillPdfFormBase {
|
|
|
6
6
|
conditions: ConditionsRunner;
|
|
7
7
|
ovc: InputsType;
|
|
8
8
|
constructor(references: Types.ReferencesType, conditions: ConditionsRunner, ovc: InputsType);
|
|
9
|
-
private readonly conditionEvaluator;
|
|
10
9
|
isVariableDisplayed(id: number, index: number): boolean;
|
|
11
10
|
isOptionDisplayed(id: number, index: number): boolean;
|
|
12
11
|
private getVariableCondition;
|
|
13
12
|
private getOptionCondition;
|
|
14
13
|
private getSectionCondition;
|
|
14
|
+
private getOptionParentSection;
|
|
15
15
|
}
|
|
16
16
|
export default FillPdfFormBase;
|
|
@@ -1,25 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var referencesparser_1 = require("@legalplace/referencesparser");
|
|
4
12
|
var FillPdfFormBase = (function () {
|
|
5
13
|
function FillPdfFormBase(references, conditions, ovc) {
|
|
6
|
-
var _this = this;
|
|
7
|
-
this.conditionEvaluator = function (type, id, index) {
|
|
8
|
-
if (type === "options")
|
|
9
|
-
return _this.getOptionCondition(id, index);
|
|
10
|
-
if (type === "variables")
|
|
11
|
-
return _this.getVariableCondition(id, index);
|
|
12
|
-
return _this.getSectionCondition(id);
|
|
13
|
-
};
|
|
14
14
|
this.references = references;
|
|
15
15
|
this.conditions = conditions;
|
|
16
16
|
this.ovc = ovc;
|
|
17
17
|
}
|
|
18
18
|
FillPdfFormBase.prototype.isVariableDisplayed = function (id, index) {
|
|
19
|
-
|
|
19
|
+
var _a;
|
|
20
|
+
var variableCondition = this.getVariableCondition(id, index);
|
|
21
|
+
var variableParents = ((_a = this.references.relations.variables[id]) === null || _a === void 0 ? void 0 : _a.parents) || [];
|
|
22
|
+
var parentOptionIsDisplayed = this.isOptionDisplayed(variableParents[0], index);
|
|
23
|
+
return ([variableCondition, parentOptionIsDisplayed].filter(function (c) { return c !== true; })
|
|
24
|
+
.length === 0);
|
|
20
25
|
};
|
|
21
26
|
FillPdfFormBase.prototype.isOptionDisplayed = function (id, index) {
|
|
22
|
-
|
|
27
|
+
var _this = this;
|
|
28
|
+
var _a;
|
|
29
|
+
var optionCondition = this.getOptionCondition(id, index);
|
|
30
|
+
var optionParents = ((_a = this.references.relations.options[id]) === null || _a === void 0 ? void 0 : _a.parents) || [];
|
|
31
|
+
var parentsConditions = optionParents.map(function (optionId) { return _this.getOptionCondition(optionId, index) !== false; });
|
|
32
|
+
var parentsInputs = optionParents.map(function (optionId) { return _this.ovc.options[optionId][index]; });
|
|
33
|
+
var parentSectionId = this.getOptionParentSection(id);
|
|
34
|
+
var parentSectionCondition = this.getSectionCondition(parentSectionId) !== false;
|
|
35
|
+
return (__spreadArray(__spreadArray([
|
|
36
|
+
optionCondition,
|
|
37
|
+
parentSectionCondition
|
|
38
|
+
], parentsConditions, true), parentsInputs, true).filter(function (c) { return c !== true; }).length === 0);
|
|
23
39
|
};
|
|
24
40
|
FillPdfFormBase.prototype.getVariableCondition = function (id, index) {
|
|
25
41
|
var conditionObject = this.references.conditions.variables[id];
|
|
@@ -39,6 +55,16 @@ var FillPdfFormBase = (function () {
|
|
|
39
55
|
? true
|
|
40
56
|
: this.conditions.executeCondition(conditionObject, id, 0, "sections");
|
|
41
57
|
};
|
|
58
|
+
FillPdfFormBase.prototype.getOptionParentSection = function (id) {
|
|
59
|
+
var parents = this.references.relations.options[id].parents;
|
|
60
|
+
var rootId = parents.length > 0 ? parents[parents.length - 1] : id;
|
|
61
|
+
var sections = Object.values(this.references.sections.main);
|
|
62
|
+
for (var i = 0; i < sections.length; i += 1) {
|
|
63
|
+
if (sections[i].options.includes(rootId))
|
|
64
|
+
return sections[i].id;
|
|
65
|
+
}
|
|
66
|
+
throw new Error("Cannot find parent section for option ".concat(id, " (Root option id: ").concat(rootId, ")"));
|
|
67
|
+
};
|
|
42
68
|
return FillPdfFormBase;
|
|
43
69
|
}());
|
|
44
70
|
exports.default = FillPdfFormBase;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
1
|
-
import type { DocumentLayoutV3 } from "@legalplace/models-v3-types";
|
|
2
1
|
export type DocumentOutputIndex = {
|
|
3
2
|
name: string;
|
|
4
3
|
slug: string;
|
|
5
4
|
pdf: boolean;
|
|
6
5
|
docx: boolean;
|
|
7
|
-
occurrenceIndex?: number;
|
|
8
6
|
};
|
|
9
7
|
export type DocumentPdfFormIndex = {
|
|
10
8
|
name: string;
|
|
11
9
|
slug: string;
|
|
12
10
|
form: boolean;
|
|
13
11
|
fdf: FDFType;
|
|
14
|
-
occurrenceIndex?: number;
|
|
15
12
|
};
|
|
16
13
|
export type DocumentIndex = Record<string, DocumentOutputIndex | DocumentPdfFormIndex>;
|
|
17
14
|
export type FDFType = {
|
|
18
15
|
id: string;
|
|
19
16
|
fields: Record<string, string>;
|
|
20
17
|
};
|
|
21
|
-
export type DocumentLayout = {
|
|
22
|
-
header?: string;
|
|
23
|
-
footer?: string;
|
|
24
|
-
firstPageHeader?: string;
|
|
25
|
-
firstPageFooter?: string;
|
|
26
|
-
differentFirstPage: boolean;
|
|
27
|
-
margins?: DocumentLayoutV3["margins"];
|
|
28
|
-
headerDistance?: number;
|
|
29
|
-
footerDistance?: number;
|
|
30
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/prerenderx",
|
|
3
|
-
"version": "3.8.18
|
|
3
|
+
"version": "3.8.18",
|
|
4
4
|
"description": "PrerenderX",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://git.legalplace.eu/legalplace/prerenderx",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"release": "standard-version -a --no-verify"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@legalplace/conditions-runner": "2.2.15
|
|
19
|
+
"@legalplace/conditions-runner": "^2.2.15",
|
|
20
20
|
"@legalplace/eslint-config-base": "^1.2.0",
|
|
21
|
-
"@legalplace/lplogic": "2.3.
|
|
22
|
-
"@legalplace/models-v3-types": "5.17.
|
|
23
|
-
"@legalplace/ovc-converter": "2.2.15
|
|
21
|
+
"@legalplace/lplogic": "2.3.1",
|
|
22
|
+
"@legalplace/models-v3-types": "^5.17.11",
|
|
23
|
+
"@legalplace/ovc-converter": "^2.2.15",
|
|
24
24
|
"@legalplace/prettier-config": "^2.1.3",
|
|
25
|
-
"@legalplace/referencesparser": "3.2.34
|
|
25
|
+
"@legalplace/referencesparser": "^3.2.34",
|
|
26
26
|
"@legalplace/yousign": "^0.9.13",
|
|
27
27
|
"crypto": "^1.0.1",
|
|
28
28
|
"standard-version": "^9.3.1"
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/core": "^7.7.2",
|
|
32
32
|
"@babel/preset-typescript": "^7.7.2",
|
|
33
|
-
"@legalplace/types": "^2.22.
|
|
33
|
+
"@legalplace/types": "^2.22.4",
|
|
34
34
|
"@types/jest": "^24.0.15",
|
|
35
35
|
"jest": "^24.8.0",
|
|
36
36
|
"redux-mock-store": "^1.5.3",
|
|
37
37
|
"ts-jest": "^24.0.2"
|
|
38
38
|
},
|
|
39
|
-
"prettier": "@legalplace/prettier-config"
|
|
39
|
+
"prettier": "@legalplace/prettier-config",
|
|
40
|
+
"gitHead": "f6ad1703d378aab24d9b57997178ddaded524b74"
|
|
40
41
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
import type { Types } from "@legalplace/referencesparser";
|
|
1
2
|
import type ConditionsRunner from "@legalplace/conditions-runner";
|
|
2
|
-
import {
|
|
3
|
-
getSectionIdsForRole,
|
|
4
|
-
type OutputRegionRole,
|
|
5
|
-
type Types,
|
|
6
|
-
} from "@legalplace/referencesparser";
|
|
7
3
|
import type InputsType from "@legalplace/types/dist/inputs";
|
|
8
4
|
import SectionRender from "./SectionRender";
|
|
9
5
|
import type NumAuto from "./NumAuto";
|
|
@@ -29,42 +25,18 @@ class DocumentRender {
|
|
|
29
25
|
this.NumAuto = numauto;
|
|
30
26
|
}
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
* Renders a document body. When `baseIndex` is provided (document multiple),
|
|
34
|
-
* the index is propagated through the section/option render pipeline
|
|
35
|
-
* so that variables referenced anywhere in the document resolve at the
|
|
36
|
-
* correct occurrence.
|
|
37
|
-
*/
|
|
38
|
-
public renderDocument(documentName: string, baseIndex = 0) {
|
|
39
|
-
return this.renderRegion(documentName, "body", baseIndex);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Renders a document output region (body, header, footer, first page variants).
|
|
44
|
-
*/
|
|
45
|
-
public renderRegion(
|
|
46
|
-
documentName: string,
|
|
47
|
-
role: OutputRegionRole,
|
|
48
|
-
baseIndex = 0
|
|
49
|
-
) {
|
|
28
|
+
public renderDocument(documentName: string) {
|
|
50
29
|
const documentOutputs: string[] = [];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const sectionIds = getSectionIdsForRole(
|
|
54
|
-
this.references.sections[documentName],
|
|
55
|
-
role
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
sectionIds.forEach((sectionId) => {
|
|
30
|
+
this.NumAuto.resetIndexes();
|
|
31
|
+
Object.keys(this.references.sections[documentName]).forEach((sectionId) => {
|
|
59
32
|
documentOutputs.push(
|
|
60
33
|
...new SectionRender({
|
|
61
34
|
references: this.references,
|
|
62
35
|
conditions: this.conditions,
|
|
63
36
|
documentName,
|
|
64
37
|
ovc: this.ovc,
|
|
65
|
-
currentSection: sectionId,
|
|
38
|
+
currentSection: parseInt(sectionId, 10),
|
|
66
39
|
numauto: this.NumAuto,
|
|
67
|
-
baseIndex,
|
|
68
40
|
}).getOutputs()
|
|
69
41
|
);
|
|
70
42
|
});
|
package/src/libs/FillPdfForm.ts
CHANGED
|
@@ -6,13 +6,7 @@ type FDFType = {
|
|
|
6
6
|
fields: Record<string, string>;
|
|
7
7
|
};
|
|
8
8
|
class FillPdfForm extends FillPdfFormBase {
|
|
9
|
-
|
|
10
|
-
* Fills a PDF form template with values from `ovc`. When `baseIndex` is
|
|
11
|
-
* provided (document multiple), variables and options are read at that
|
|
12
|
-
* occurrence index instead of always reading slot 0. Each occurrence of
|
|
13
|
-
* a multiple PDF form document yields its own filled FDF.
|
|
14
|
-
*/
|
|
15
|
-
public fillDocument(documentName: string, baseIndex = 0) {
|
|
9
|
+
public fillDocument(documentName: string) {
|
|
16
10
|
const result: FDFType = {
|
|
17
11
|
id: "",
|
|
18
12
|
fields: {},
|
|
@@ -30,13 +24,13 @@ class FillPdfForm extends FillPdfFormBase {
|
|
|
30
24
|
// Filling inputs
|
|
31
25
|
form.inputs.forEach((input) => {
|
|
32
26
|
const id = `${input.name}`;
|
|
33
|
-
result.fields[id] = this.getInputValue(input
|
|
27
|
+
result.fields[id] = this.getInputValue(input);
|
|
34
28
|
});
|
|
35
29
|
|
|
36
30
|
// Filling boxes
|
|
37
31
|
form.boxes.forEach((box) => {
|
|
38
32
|
const id = `${box.name}`;
|
|
39
|
-
const value = this.getBoxValue(box
|
|
33
|
+
const value = this.getBoxValue(box);
|
|
40
34
|
if (
|
|
41
35
|
!(
|
|
42
36
|
value === "" &&
|
|
@@ -50,14 +44,13 @@ class FillPdfForm extends FillPdfFormBase {
|
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
/**
|
|
53
|
-
* Returns an input value
|
|
47
|
+
* Returns an input value
|
|
54
48
|
* @param input Input
|
|
55
|
-
* @param index Occurrence index (defaults to 0)
|
|
56
49
|
*/
|
|
57
|
-
private getInputValue(input: FDFInputsV3
|
|
50
|
+
private getInputValue(input: FDFInputsV3): string {
|
|
58
51
|
for (let i = 0; i < input.variables.length; i += 1) {
|
|
59
52
|
const variable = input.variables[i];
|
|
60
|
-
const currentValue = this.getVariableValue(variable.id
|
|
53
|
+
const currentValue = this.getVariableValue(variable.id);
|
|
61
54
|
|
|
62
55
|
if (currentValue !== false) {
|
|
63
56
|
// Date values
|
|
@@ -117,14 +110,13 @@ class FillPdfForm extends FillPdfFormBase {
|
|
|
117
110
|
}
|
|
118
111
|
|
|
119
112
|
/**
|
|
120
|
-
* Return a box value
|
|
113
|
+
* Return a box value
|
|
121
114
|
* @param box Box
|
|
122
|
-
* @param index Occurrence index (defaults to 0)
|
|
123
115
|
*/
|
|
124
|
-
private getBoxValue(box: FDFBoxesV3
|
|
116
|
+
private getBoxValue(box: FDFBoxesV3): string {
|
|
125
117
|
for (let i = 0; i < box.options.length; i += 1) {
|
|
126
118
|
const option = box.options[i];
|
|
127
|
-
const currentValue = this.getOptionValue(option.id
|
|
119
|
+
const currentValue = this.getOptionValue(option.id);
|
|
128
120
|
|
|
129
121
|
if (currentValue === true) {
|
|
130
122
|
if (
|
|
@@ -140,34 +132,25 @@ class FillPdfForm extends FillPdfFormBase {
|
|
|
140
132
|
}
|
|
141
133
|
|
|
142
134
|
/**
|
|
143
|
-
* Returns a variable's value
|
|
144
|
-
* to slot 0 when the requested index is missing (e.g. a non-multiple
|
|
145
|
-
* variable inside a multiple document).
|
|
135
|
+
* Returns a variable's value
|
|
146
136
|
*/
|
|
147
|
-
private getVariableValue(variableId: number
|
|
148
|
-
// Checking if variable is displayed
|
|
149
|
-
if (this.isVariableDisplayed(variableId,
|
|
137
|
+
private getVariableValue(variableId: number) {
|
|
138
|
+
// Checking if variable is displayed
|
|
139
|
+
if (this.isVariableDisplayed(variableId, 0) === false) return false;
|
|
150
140
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
variableValues?.[index] !== undefined
|
|
154
|
-
? variableValues[index]
|
|
155
|
-
: variableValues?.[0] || "";
|
|
156
|
-
|
|
157
|
-
return (value ?? "").toString();
|
|
141
|
+
// Returning variable's value
|
|
142
|
+
return (this.ovc.variables[variableId]?.[0] || "").toString();
|
|
158
143
|
}
|
|
159
144
|
|
|
160
145
|
/**
|
|
161
|
-
* Returns
|
|
146
|
+
* Returns a option's value
|
|
162
147
|
*/
|
|
163
|
-
private getOptionValue(optionId: number
|
|
164
|
-
// Checking if option is displayed
|
|
165
|
-
if (this.isOptionDisplayed(optionId,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return
|
|
169
|
-
? optionValues[index] === true
|
|
170
|
-
: optionValues?.[0] === true;
|
|
148
|
+
private getOptionValue(optionId: number) {
|
|
149
|
+
// Checking if option is displayed
|
|
150
|
+
if (this.isOptionDisplayed(optionId, 0) === false) return false;
|
|
151
|
+
|
|
152
|
+
// Returning option's value
|
|
153
|
+
return this.ovc.options[optionId]?.[0] === true;
|
|
171
154
|
}
|
|
172
155
|
}
|
|
173
156
|
|