@legalplace/tagextractor 1.1.5 → 1.1.8
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.
|
@@ -98,7 +98,6 @@ var DataPopulator = (function () {
|
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
DataPopulator.prototype.getVariableValues = function (variableId) {
|
|
101
|
-
var conditions = this.variableConditionValue(variableId);
|
|
102
101
|
var value = this.ovc.variables[variableId];
|
|
103
102
|
if (this.id === undefined || this.index === undefined) {
|
|
104
103
|
return value;
|
|
@@ -106,18 +105,9 @@ var DataPopulator = (function () {
|
|
|
106
105
|
var variableRootParent = this.getVariableRootParent(variableId);
|
|
107
106
|
var variableRootRelations = this.references.relations.options[variableRootParent];
|
|
108
107
|
if (variableRootRelations.children.options.includes(this.id) || variableRootRelations.dependants.includes(this.id) || this.id === variableRootParent) {
|
|
109
|
-
if (conditions !== undefined && conditions[this.index] === false)
|
|
110
|
-
return ['fAl$e'];
|
|
111
108
|
return [value[this.index]];
|
|
112
109
|
}
|
|
113
|
-
|
|
114
|
-
if (conditions === undefined)
|
|
115
|
-
return cleanValues;
|
|
116
|
-
return cleanValues.map(function (currentValue, index) {
|
|
117
|
-
if (conditions[index] === false)
|
|
118
|
-
return 'fAl$e';
|
|
119
|
-
return currentValue;
|
|
120
|
-
});
|
|
110
|
+
return this.cleanArrayFromNullValues(__spreadArrays(value));
|
|
121
111
|
};
|
|
122
112
|
DataPopulator.prototype.getVariableRootParent = function (variableId) {
|
|
123
113
|
var variableParents = this.references.relations.variables[variableId].parents;
|
|
@@ -134,7 +124,6 @@ var DataPopulator = (function () {
|
|
|
134
124
|
}
|
|
135
125
|
};
|
|
136
126
|
DataPopulator.prototype.getOptionInputs = function (optionId) {
|
|
137
|
-
var conditions = this.optionConditionValue(optionId);
|
|
138
127
|
var inputs = this.ovc.options[optionId];
|
|
139
128
|
if (this.id === undefined || this.index === undefined) {
|
|
140
129
|
return inputs;
|
|
@@ -142,17 +131,9 @@ var DataPopulator = (function () {
|
|
|
142
131
|
var optionRootParent = this.getOptionRootParent(optionId);
|
|
143
132
|
var optionRootRelations = this.references.relations.options[optionRootParent];
|
|
144
133
|
if (optionRootRelations.children.options.includes(this.id) || optionRootRelations.dependants.includes(this.id) || this.id === optionRootParent) {
|
|
145
|
-
if (conditions !== undefined && conditions[this.index] === false)
|
|
146
|
-
return [false];
|
|
147
134
|
return [inputs[this.index]];
|
|
148
135
|
}
|
|
149
|
-
|
|
150
|
-
return inputs;
|
|
151
|
-
return inputs.map(function (value, index) {
|
|
152
|
-
if (conditions[index] === false)
|
|
153
|
-
return false;
|
|
154
|
-
return value;
|
|
155
|
-
});
|
|
136
|
+
return inputs;
|
|
156
137
|
};
|
|
157
138
|
DataPopulator.prototype.getOptionRootParent = function (optionId) {
|
|
158
139
|
var optionParents = this.references.relations.options[optionId].parents;
|
package/dist/libs/Extractor.js
CHANGED
|
@@ -36,7 +36,7 @@ var TagExtractor = (function () {
|
|
|
36
36
|
var _this = this;
|
|
37
37
|
Object.keys(this.references.options).forEach(function (id) {
|
|
38
38
|
var _a = _this.references.options[id].meta, tags = _a.tags, label = _a.label;
|
|
39
|
-
if (Array.isArray(tags) && tags.length > 0) {
|
|
39
|
+
if (Array.isArray(tags) && tags.length > 0 && _this.inputs.options[id]) {
|
|
40
40
|
_this.inputs.options[id].forEach(function (v, index) {
|
|
41
41
|
tags.forEach(function (tag) {
|
|
42
42
|
if (_this.tags.options[tag] === undefined)
|
|
@@ -58,7 +58,7 @@ var TagExtractor = (function () {
|
|
|
58
58
|
var _this = this;
|
|
59
59
|
Object.keys(this.references.variables).forEach(function (id) {
|
|
60
60
|
var _a = _this.references.variables[id], tags = _a.tags, label = _a.label;
|
|
61
|
-
if (Array.isArray(tags) && tags.length > 0) {
|
|
61
|
+
if (Array.isArray(tags) && tags.length > 0 && _this.inputs.variables[id]) {
|
|
62
62
|
_this.inputs.variables[id].forEach(function (v, index) {
|
|
63
63
|
tags.forEach(function (tag) {
|
|
64
64
|
if (_this.tags.variables[tag] === undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/tagextractor",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "TagExtractor",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://git.legalplace.eu/legalplace/tagextractor",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"build": "tsc"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@legalplace/lplogic": "^2.1.
|
|
17
|
+
"@legalplace/lplogic": "^2.1.6",
|
|
18
18
|
"@legalplace/models-v3-types": "^3.4.47",
|
|
19
|
-
"@legalplace/referencesparser": "^1.
|
|
19
|
+
"@legalplace/referencesparser": "^1.6.1",
|
|
20
20
|
"crypto": "^1.0.1",
|
|
21
21
|
"typescript": "3.9.3"
|
|
22
22
|
},
|
|
@@ -38,4 +38,4 @@
|
|
|
38
38
|
"redux-mock-store": "^1.5.3",
|
|
39
39
|
"ts-jest": "^24.0.2"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
|
@@ -152,7 +152,6 @@ class DataPopulator {
|
|
|
152
152
|
* @param variableId Variable's id
|
|
153
153
|
*/
|
|
154
154
|
private getVariableValues(variableId: number): Readonly<(string | number)[]> {
|
|
155
|
-
const conditions = this.variableConditionValue(variableId)
|
|
156
155
|
const value = this.ovc.variables[variableId]
|
|
157
156
|
if (this.id === undefined || this.index === undefined) {
|
|
158
157
|
return value
|
|
@@ -162,19 +161,10 @@ class DataPopulator {
|
|
|
162
161
|
const variableRootParent = this.getVariableRootParent(variableId)
|
|
163
162
|
const variableRootRelations = this.references.relations.options[variableRootParent]
|
|
164
163
|
if (variableRootRelations.children.options.includes(this.id) || variableRootRelations.dependants.includes(this.id) || this.id === variableRootParent) {
|
|
165
|
-
// TODO: Replace fAl$e with a safer solution
|
|
166
|
-
if (conditions !== undefined && conditions[this.index] === false) return ['fAl$e']
|
|
167
164
|
return [value[this.index]]
|
|
168
165
|
}
|
|
169
166
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (conditions === undefined) return cleanValues
|
|
173
|
-
|
|
174
|
-
return cleanValues.map((currentValue, index) => {
|
|
175
|
-
if (conditions[index] === false) return 'fAl$e'
|
|
176
|
-
return currentValue
|
|
177
|
-
})
|
|
167
|
+
return this.cleanArrayFromNullValues([...value])
|
|
178
168
|
}
|
|
179
169
|
|
|
180
170
|
/**
|
|
@@ -213,7 +203,6 @@ class DataPopulator {
|
|
|
213
203
|
* @param optionId Option's id
|
|
214
204
|
*/
|
|
215
205
|
private getOptionInputs(optionId: number): Readonly<boolean[]> {
|
|
216
|
-
const conditions = this.optionConditionValue(optionId)
|
|
217
206
|
const inputs = this.ovc.options[optionId]
|
|
218
207
|
if (this.id === undefined || this.index === undefined) {
|
|
219
208
|
return inputs
|
|
@@ -223,16 +212,10 @@ class DataPopulator {
|
|
|
223
212
|
const optionRootParent = this.getOptionRootParent(optionId)
|
|
224
213
|
const optionRootRelations = this.references.relations.options[optionRootParent]
|
|
225
214
|
if (optionRootRelations.children.options.includes(this.id) || optionRootRelations.dependants.includes(this.id) || this.id === optionRootParent) {
|
|
226
|
-
if (conditions !== undefined && conditions[this.index] === false) return [false]
|
|
227
215
|
return [inputs[this.index]]
|
|
228
216
|
}
|
|
229
217
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return inputs.map((value, index) => {
|
|
233
|
-
if (conditions[index] === false) return false
|
|
234
|
-
return value
|
|
235
|
-
})
|
|
218
|
+
return inputs
|
|
236
219
|
}
|
|
237
220
|
|
|
238
221
|
/**
|
package/src/libs/Extractor.ts
CHANGED
|
@@ -46,7 +46,7 @@ class TagExtractor {
|
|
|
46
46
|
Object.keys(this.references.options).forEach(id => {
|
|
47
47
|
const { tags, label } = this.references.options[id].meta
|
|
48
48
|
|
|
49
|
-
if (Array.isArray(tags) && tags.length > 0) {
|
|
49
|
+
if (Array.isArray(tags) && tags.length > 0 && this.inputs.options[id]) {
|
|
50
50
|
this.inputs.options[id].forEach((v, index) => {
|
|
51
51
|
tags.forEach(tag => {
|
|
52
52
|
if (this.tags.options[tag] === undefined) this.tags.options[tag] = []
|
|
@@ -71,7 +71,7 @@ class TagExtractor {
|
|
|
71
71
|
Object.keys(this.references.variables).forEach(id => {
|
|
72
72
|
const { tags, label } = this.references.variables[id]
|
|
73
73
|
|
|
74
|
-
if (Array.isArray(tags) && tags.length > 0) {
|
|
74
|
+
if (Array.isArray(tags) && tags.length > 0 && this.inputs.variables[id]) {
|
|
75
75
|
this.inputs.variables[id].forEach((v, index) => {
|
|
76
76
|
tags.forEach(tag => {
|
|
77
77
|
if (this.tags.variables[tag] === undefined) this.tags.variables[tag] = []
|