@legalplace/prerenderx 2.6.3 → 2.6.4
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/libs/ConditionsRunner.d.ts +24 -0
- package/dist/libs/ConditionsRunner.js +77 -0
- package/dist/libs/DataPopulator.d.ts +53 -0
- package/dist/libs/DataPopulator.js +175 -0
- package/dist/libs/DocumentRender.d.ts +13 -0
- package/dist/libs/DocumentRender.js +32 -0
- package/dist/libs/FillPdfForm.d.ts +13 -0
- package/dist/libs/FillPdfForm.js +121 -0
- package/dist/libs/InputsInitiator.d.ts +21 -0
- package/dist/libs/InputsInitiator.js +80 -0
- package/dist/libs/NumAuto.d.ts +8 -0
- package/dist/libs/NumAuto.js +32 -0
- package/dist/libs/OptionRender.d.ts +25 -0
- package/dist/libs/OptionRender.js +66 -0
- package/dist/libs/OutputParser.d.ts +11 -0
- package/dist/libs/OutputParser.js +93 -0
- package/dist/libs/OvcConverter.d.ts +21 -0
- package/dist/libs/OvcConverter.js +132 -0
- package/dist/libs/Prerender.d.ts +42 -0
- package/dist/libs/Prerender.js +105 -0
- package/dist/libs/SectionRender.d.ts +24 -0
- package/dist/libs/SectionRender.js +60 -0
- package/dist/libs/misc/FillPdfFormBase.d.ts +16 -0
- package/dist/libs/misc/FillPdfFormBase.js +62 -0
- package/dist/libs/ovc.type.d.ts +9 -0
- package/dist/libs/ovc.type.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
3
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
4
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
5
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
6
|
+
r[k] = a[j];
|
|
7
|
+
return r;
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
var FillPdfFormBase = (function () {
|
|
11
|
+
function FillPdfFormBase(references, conditions, ovc) {
|
|
12
|
+
this.references = references;
|
|
13
|
+
this.conditions = conditions;
|
|
14
|
+
this.ovc = ovc;
|
|
15
|
+
}
|
|
16
|
+
FillPdfFormBase.prototype.isVariableDisplayed = function (id, index) {
|
|
17
|
+
var _a;
|
|
18
|
+
var variableCondition = this.getVariableCondition(id, index);
|
|
19
|
+
var variableParents = ((_a = this.references.relations.variables[id]) === null || _a === void 0 ? void 0 : _a.parents) || [];
|
|
20
|
+
var parentOptionIsDisplayed = this.isOptionDisplayed(variableParents[0], index);
|
|
21
|
+
return [variableCondition, parentOptionIsDisplayed].filter(function (c) { return c !== true; }).length === 0;
|
|
22
|
+
};
|
|
23
|
+
FillPdfFormBase.prototype.isOptionDisplayed = function (id, index) {
|
|
24
|
+
var _this = this;
|
|
25
|
+
var _a;
|
|
26
|
+
var optionCondition = this.getOptionCondition(id, index);
|
|
27
|
+
var optionParents = ((_a = this.references.relations.options[id]) === null || _a === void 0 ? void 0 : _a.parents) || [];
|
|
28
|
+
var parentsConditions = optionParents.map(function (optionId) {
|
|
29
|
+
return _this.getOptionCondition(optionId, index) !== false;
|
|
30
|
+
});
|
|
31
|
+
var parentsInputs = optionParents.map(function (optionId) {
|
|
32
|
+
return _this.ovc.options[optionId][index];
|
|
33
|
+
});
|
|
34
|
+
var parentSectionId = this.getOptionParentSection(id);
|
|
35
|
+
var parentSectionCondition = this.getSectionCondition(parentSectionId) !== false;
|
|
36
|
+
return __spreadArrays([optionCondition, parentSectionCondition], parentsConditions, parentsInputs).filter(function (c) { return c !== true; }).length === 0;
|
|
37
|
+
};
|
|
38
|
+
FillPdfFormBase.prototype.getVariableCondition = function (id, index) {
|
|
39
|
+
var conditionObject = this.references.conditions.variables[id];
|
|
40
|
+
return conditionObject === undefined ? true : this.conditions.executeCondition(conditionObject, id, index, 'variables');
|
|
41
|
+
};
|
|
42
|
+
FillPdfFormBase.prototype.getOptionCondition = function (id, index) {
|
|
43
|
+
var conditionObject = this.references.conditions.options[id];
|
|
44
|
+
return conditionObject === undefined ? true : this.conditions.executeCondition(conditionObject, id, index, 'options');
|
|
45
|
+
};
|
|
46
|
+
FillPdfFormBase.prototype.getSectionCondition = function (id) {
|
|
47
|
+
var conditionObject = this.references.conditions.sections.main[id];
|
|
48
|
+
return conditionObject === undefined ? true : this.conditions.executeCondition(conditionObject, id, 0, 'sections');
|
|
49
|
+
};
|
|
50
|
+
FillPdfFormBase.prototype.getOptionParentSection = function (id) {
|
|
51
|
+
var parents = this.references.relations.options[id].parents;
|
|
52
|
+
var rootId = parents.length > 0 ? parents[parents.length - 1] : id;
|
|
53
|
+
var sections = Object.values(this.references.sections.main);
|
|
54
|
+
for (var i = 0; i < sections.length; i += 1) {
|
|
55
|
+
if (sections[i].options.includes(rootId))
|
|
56
|
+
return sections[i].id;
|
|
57
|
+
}
|
|
58
|
+
throw new Error("Cannot find parent section for option " + id + " (Root option id: " + rootId + ")");
|
|
59
|
+
};
|
|
60
|
+
return FillPdfFormBase;
|
|
61
|
+
}());
|
|
62
|
+
exports.default = FillPdfFormBase;
|