@legalplace/prerenderx 2.6.1 → 2.6.3
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 +27 -0
- package/package.json +5 -3
- package/src/libs/OutputParser.ts +11 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -7
- package/dist/libs/ConditionsRunner.d.ts +0 -24
- package/dist/libs/ConditionsRunner.js +0 -77
- package/dist/libs/DataPopulator.d.ts +0 -53
- package/dist/libs/DataPopulator.js +0 -175
- package/dist/libs/DocumentRender.d.ts +0 -13
- package/dist/libs/DocumentRender.js +0 -32
- package/dist/libs/FillPdfForm.d.ts +0 -13
- package/dist/libs/FillPdfForm.js +0 -121
- package/dist/libs/InputsInitiator.d.ts +0 -21
- package/dist/libs/InputsInitiator.js +0 -80
- package/dist/libs/NumAuto.d.ts +0 -8
- package/dist/libs/NumAuto.js +0 -32
- package/dist/libs/OptionRender.d.ts +0 -25
- package/dist/libs/OptionRender.js +0 -66
- package/dist/libs/OutputParser.d.ts +0 -11
- package/dist/libs/OutputParser.js +0 -89
- package/dist/libs/OvcConverter.d.ts +0 -21
- package/dist/libs/OvcConverter.js +0 -132
- package/dist/libs/Prerender.d.ts +0 -42
- package/dist/libs/Prerender.js +0 -103
- package/dist/libs/SectionRender.d.ts +0 -24
- package/dist/libs/SectionRender.js +0 -60
- package/dist/libs/misc/FillPdfFormBase.d.ts +0 -16
- package/dist/libs/misc/FillPdfFormBase.js +0 -62
- package/dist/libs/ovc.type.d.ts +0 -9
- package/dist/libs/ovc.type.js +0 -2
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
var OptionRender_1 = __importDefault(require("./OptionRender"));
|
|
14
|
-
var SectionRender = (function () {
|
|
15
|
-
function SectionRender(options) {
|
|
16
|
-
this.outputs = [];
|
|
17
|
-
this.references = options.references;
|
|
18
|
-
this.conditions = options.conditions;
|
|
19
|
-
this.documentName = options.documentName;
|
|
20
|
-
this.currentSection = options.currentSection;
|
|
21
|
-
this.ovc = options.ovc;
|
|
22
|
-
this.NumAuto = options.numauto;
|
|
23
|
-
this.renderSection();
|
|
24
|
-
}
|
|
25
|
-
SectionRender.prototype.getOutputs = function () {
|
|
26
|
-
return this.outputs;
|
|
27
|
-
};
|
|
28
|
-
SectionRender.prototype.renderSection = function () {
|
|
29
|
-
var _this = this;
|
|
30
|
-
var section = this.references.sections[this.documentName][this.currentSection];
|
|
31
|
-
var conditionObject = this.references.conditions.sections[this.documentName][this.currentSection];
|
|
32
|
-
var condition = conditionObject === undefined ? true : this.conditions.executeCondition(conditionObject, 0, 0, 'sections');
|
|
33
|
-
if (condition === true) {
|
|
34
|
-
section.options.forEach(function (optionId) {
|
|
35
|
-
var option = _this.references.options[optionId];
|
|
36
|
-
var repeatOption = optionId;
|
|
37
|
-
if (option.meta.type === 'repeated') {
|
|
38
|
-
if (option.meta.repeatOption === undefined)
|
|
39
|
-
return;
|
|
40
|
-
repeatOption = typeof option.meta.repeatOption === 'number' ? option.meta.repeatOption : parseInt(option.meta.repeatOption, 10);
|
|
41
|
-
}
|
|
42
|
-
var inputs = _this.ovc.options[repeatOption] || [!['radio', 'checkbox'].includes(option.meta.type)];
|
|
43
|
-
inputs.forEach(function (value, index) {
|
|
44
|
-
if (value !== true)
|
|
45
|
-
return;
|
|
46
|
-
_this.outputs = __spreadArrays(_this.outputs, new OptionRender_1.default({
|
|
47
|
-
references: _this.references,
|
|
48
|
-
id: optionId,
|
|
49
|
-
ovc: _this.ovc,
|
|
50
|
-
index: index,
|
|
51
|
-
conditions: _this.conditions,
|
|
52
|
-
numauto: _this.NumAuto
|
|
53
|
-
}).getOutputs());
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return SectionRender;
|
|
59
|
-
}());
|
|
60
|
-
exports.default = SectionRender;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Types } from '@legalplace/referencesparser';
|
|
2
|
-
import ConditionsRunner from '../ConditionsRunner';
|
|
3
|
-
import OVC_TYPE from '../ovc.type';
|
|
4
|
-
declare class FillPdfFormBase {
|
|
5
|
-
references: Types.ReferencesType;
|
|
6
|
-
conditions: ConditionsRunner;
|
|
7
|
-
ovc: OVC_TYPE;
|
|
8
|
-
constructor(references: Types.ReferencesType, conditions: ConditionsRunner, ovc: OVC_TYPE);
|
|
9
|
-
isVariableDisplayed(id: number, index: number): boolean;
|
|
10
|
-
isOptionDisplayed(id: number, index: number): boolean;
|
|
11
|
-
private getVariableCondition;
|
|
12
|
-
private getOptionCondition;
|
|
13
|
-
private getSectionCondition;
|
|
14
|
-
private getOptionParentSection;
|
|
15
|
-
}
|
|
16
|
-
export default FillPdfFormBase;
|
|
@@ -1,62 +0,0 @@
|
|
|
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;
|
package/dist/libs/ovc.type.d.ts
DELETED
package/dist/libs/ovc.type.js
DELETED