c2-clinical 1.0.106 → 1.0.108
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.
|
@@ -22,7 +22,7 @@ class BuildTreeFlowItem {
|
|
|
22
22
|
// });
|
|
23
23
|
// return rootFormUnit;
|
|
24
24
|
const rootFormUnit = questions.filter((q) => !q.parent);
|
|
25
|
-
return this.
|
|
25
|
+
return this.buildRows({ parent: undefined, children: rootFormUnit });
|
|
26
26
|
}
|
|
27
27
|
iterate(parent, children) {
|
|
28
28
|
parent.children = children.filter((child) => child.parent?._id?.toString() === parent?._id?.toString());
|
|
@@ -47,34 +47,15 @@ class BuildTreeFlowItem {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
iterate2(config) {
|
|
50
|
+
// private iterate2(config: { parent?: IFormUnit; children: IFormUnit[] }): IRow[] {
|
|
51
|
+
// config.children.sort((a, b) => a.line - b.line);
|
|
52
|
+
// if (!config.parent) {
|
|
53
|
+
// return this.buildRows(config);
|
|
54
|
+
// }
|
|
55
|
+
// return this.buildRows(config);
|
|
56
|
+
// }
|
|
57
|
+
buildRows(config) {
|
|
51
58
|
config.children.sort((a, b) => a.line - b.line);
|
|
52
|
-
if (!parent) {
|
|
53
|
-
const lines = config.children.reduce((acc, item) => {
|
|
54
|
-
if (!acc.some((a) => a.line === item.line)) {
|
|
55
|
-
acc.push({
|
|
56
|
-
id: (0, node_crypto_1.randomUUID)(),
|
|
57
|
-
line: item.line,
|
|
58
|
-
collumns: []
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
acc.find((a) => a.line === item.line)?.collumns.push(item);
|
|
62
|
-
return acc;
|
|
63
|
-
}, []);
|
|
64
|
-
lines?.forEach((line, index) => {
|
|
65
|
-
line.collumns?.sort((a, b) => a.column - b.column);
|
|
66
|
-
line.collumns?.forEach((collumn) => {
|
|
67
|
-
const newChildren = this.bank.filter((child) => child.parent?._id?.toString() === collumn?._id?.toString());
|
|
68
|
-
if (newChildren?.length) {
|
|
69
|
-
collumn.lines = this.iterate2({ parent: collumn, children: newChildren });
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
return lines;
|
|
74
|
-
}
|
|
75
|
-
// const siblings = children.filter(
|
|
76
|
-
// (child: IFormUnit) => child.parent?._id?.toString() === parent?._id?.toString()
|
|
77
|
-
// );
|
|
78
59
|
const lines = config.children.reduce((acc, item) => {
|
|
79
60
|
if (!acc.some((a) => a.line === item.line)) {
|
|
80
61
|
acc.push({
|
|
@@ -91,34 +72,11 @@ class BuildTreeFlowItem {
|
|
|
91
72
|
line.collumns?.forEach((collumn) => {
|
|
92
73
|
const newChildren = this.bank.filter((child) => child.parent?._id?.toString() === collumn?._id?.toString());
|
|
93
74
|
if (newChildren?.length) {
|
|
94
|
-
collumn.lines = this.
|
|
75
|
+
collumn.lines = this.buildRows({ parent: collumn, children: newChildren });
|
|
95
76
|
}
|
|
96
77
|
});
|
|
97
78
|
});
|
|
98
79
|
return lines;
|
|
99
|
-
// parent.children = children.filter(
|
|
100
|
-
// (child: IFormUnit) => child.parent?._id?.toString() === parent?._id?.toString()
|
|
101
|
-
// );
|
|
102
|
-
// parent.children.sort((a, b) => a.line - b.line);
|
|
103
|
-
// const lines: IRow[] = parent.children.reduce((acc: IRow[], item) => {
|
|
104
|
-
// if (!acc.some((a: IRow) => a.line === item.line)) {
|
|
105
|
-
// acc.push({
|
|
106
|
-
// id: randomUUID(),
|
|
107
|
-
// line: item.line,
|
|
108
|
-
// collumns: []
|
|
109
|
-
// });
|
|
110
|
-
// }
|
|
111
|
-
// acc.find((a: IRow) => a.line === item.line)?.collumns.push(item);
|
|
112
|
-
// return acc;
|
|
113
|
-
// }, []);
|
|
114
|
-
// parent.lines?.forEach((line: IRow, index: number) => {
|
|
115
|
-
// line.collumns?.sort((a, b) => a.column - b.column);
|
|
116
|
-
// });
|
|
117
|
-
// if (parent.children.length > 0) {
|
|
118
|
-
// parent.children.forEach((parentPossible: IFormUnit) => {
|
|
119
|
-
// this.iterate(parentPossible, children);
|
|
120
|
-
// });
|
|
121
|
-
// }
|
|
122
80
|
}
|
|
123
81
|
}
|
|
124
82
|
exports.default = new BuildTreeFlowItem();
|
package/package.json
CHANGED