c2-clinical 1.0.119 → 1.0.121
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.
|
@@ -8,61 +8,15 @@ class BuildTreeFlowItem {
|
|
|
8
8
|
bank = [];
|
|
9
9
|
execute(questions) {
|
|
10
10
|
this.bank = questions;
|
|
11
|
-
//extrai os elements raiz (sem parent)
|
|
12
|
-
// const rootFormUnit: IFormUnit[] = questions
|
|
13
|
-
// .filter((q: IFormUnit) => !q.parent)
|
|
14
|
-
// .map((q: IFormUnit) => {
|
|
15
|
-
// return {
|
|
16
|
-
// ...q,
|
|
17
|
-
// children: []
|
|
18
|
-
// };
|
|
19
|
-
// });
|
|
20
|
-
// rootFormUnit.sort((a, b) => a.line - b.line);
|
|
21
|
-
// //extrai os elements que tem algum parent
|
|
22
|
-
// const children: IFormUnit[] = questions.filter((q: IFormUnit) => !!q.parent);
|
|
23
|
-
// rootFormUnit?.forEach((q: IFormUnit) => {
|
|
24
|
-
// this.iterate(q, children);
|
|
25
|
-
// });
|
|
26
|
-
// return rootFormUnit;
|
|
27
11
|
const rootFormUnit = questions.filter((q) => !q.parent);
|
|
28
12
|
return this.buildRows({ parent: undefined, children: rootFormUnit });
|
|
29
13
|
}
|
|
30
|
-
iterate(parent, children) {
|
|
31
|
-
parent.children = children.filter((child) => child.parent?._id?.toString() === parent?._id?.toString());
|
|
32
|
-
parent.children.sort((a, b) => a.line - b.line);
|
|
33
|
-
const lines = parent.children.reduce((acc, item) => {
|
|
34
|
-
if (!acc.some((a) => a.line === item.line)) {
|
|
35
|
-
acc.push({
|
|
36
|
-
id: GenerateUUIDFlowItem_1.default.execute(),
|
|
37
|
-
line: item.line,
|
|
38
|
-
collumns: []
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
acc.find((a) => a.line === item.line)?.collumns.push(item);
|
|
42
|
-
return acc;
|
|
43
|
-
}, []);
|
|
44
|
-
parent.lines?.forEach((line, index) => {
|
|
45
|
-
line.collumns?.sort((a, b) => a.column - b.column);
|
|
46
|
-
});
|
|
47
|
-
if (parent.children.length > 0) {
|
|
48
|
-
parent.children.forEach((parentPossible) => {
|
|
49
|
-
this.iterate(parentPossible, children);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// private iterate2(config: { parent?: IFormUnit; children: IFormUnit[] }): IRow[] {
|
|
54
|
-
// config.children.sort((a, b) => a.line - b.line);
|
|
55
|
-
// if (!config.parent) {
|
|
56
|
-
// return this.buildRows(config);
|
|
57
|
-
// }
|
|
58
|
-
// return this.buildRows(config);
|
|
59
|
-
// }
|
|
60
14
|
buildRows(config) {
|
|
61
15
|
config.children.sort((a, b) => a.line - b.line);
|
|
62
16
|
const lines = config.children.reduce((acc, item) => {
|
|
63
17
|
if (!acc.some((a) => a.line === item.line)) {
|
|
64
18
|
acc.push({
|
|
65
|
-
id: GenerateUUIDFlowItem_1.default.execute(),
|
|
19
|
+
id: item.lineId ?? GenerateUUIDFlowItem_1.default.execute(),
|
|
66
20
|
line: item.line,
|
|
67
21
|
collumns: []
|
|
68
22
|
});
|
|
@@ -11,7 +11,7 @@ class ConvertRowToFormUnitsFlowItem {
|
|
|
11
11
|
iterate(row) {
|
|
12
12
|
let formUnits = [];
|
|
13
13
|
row.collumns?.forEach((collumn) => {
|
|
14
|
-
formUnits.push({ ...collumn,
|
|
14
|
+
formUnits.push({ ...collumn, lineId: row.id });
|
|
15
15
|
if (collumn.lines?.length) {
|
|
16
16
|
collumn.lines.forEach((line) => {
|
|
17
17
|
formUnits = [...formUnits, ...this.iterate(line)];
|
package/package.json
CHANGED