@beinformed/ui 1.36.1 → 1.38.0
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 +15 -0
- package/esm/models/attributes/AttributeModel.js +2 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/AttributeSetModel.js +33 -0
- package/esm/models/attributes/AttributeSetModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupCollection.js +1 -1
- package/esm/models/taskgroup/TaskGroupCollection.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +8 -0
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +2 -1
- package/lib/models/attributes/AttributeModel.js.flow +3 -1
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js +33 -0
- package/lib/models/attributes/AttributeSetModel.js.flow +44 -0
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/__tests__/AttributeModel.spec.js.flow +17 -0
- package/lib/models/list/__tests__/ListDetailModel.hierarchy.spec.js.flow +88 -0
- package/lib/models/taskgroup/TaskGroupCollection.js +1 -1
- package/lib/models/taskgroup/TaskGroupCollection.js.flow +1 -4
- package/lib/models/taskgroup/TaskGroupCollection.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +8 -0
- package/lib/models/taskgroup/TaskGroupModel.js.flow +8 -0
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/package.json +19 -19
- package/src/models/attributes/AttributeModel.js +3 -1
- package/src/models/attributes/AttributeSetModel.js +44 -0
- package/src/models/attributes/__tests__/AttributeModel.spec.js +17 -0
- package/src/models/list/__tests__/ListDetailModel.hierarchy.spec.js +88 -0
- package/src/models/list/__tests__/hierarchy.json +185 -0
- package/src/models/list/__tests__/hierarchyContributions.json +582 -0
- package/src/models/taskgroup/TaskGroupCollection.js +1 -4
- package/src/models/taskgroup/TaskGroupModel.js +8 -0
|
@@ -102,7 +102,9 @@ export default class AttributeModel
|
|
|
102
102
|
this._isResult = this.getData("isResult", false);
|
|
103
103
|
|
|
104
104
|
this._mandatory =
|
|
105
|
-
this.layouthint.has(MANDATORY) ||
|
|
105
|
+
this.layouthint.has(MANDATORY) ||
|
|
106
|
+
this.contributions.mandatory ||
|
|
107
|
+
this.contributions.nullable === false; // nullable must be explicitly false to make this mandatory
|
|
106
108
|
|
|
107
109
|
this._links = new LinkCollection(
|
|
108
110
|
this.data._links,
|
|
@@ -62,4 +62,48 @@ export default class AttributeSetModel extends BaseModel {
|
|
|
62
62
|
set attributeCollection(collection: AttributeCollection) {
|
|
63
63
|
this._attributeCollection = collection;
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*/
|
|
68
|
+
createChildAttributeSetModel(
|
|
69
|
+
key: string,
|
|
70
|
+
dataObject: Object,
|
|
71
|
+
index?: number,
|
|
72
|
+
): AttributeSetModel {
|
|
73
|
+
return new AttributeSetModel(
|
|
74
|
+
index ? `${key}-${index + 1}` : key,
|
|
75
|
+
{
|
|
76
|
+
...dataObject,
|
|
77
|
+
dynamicschema: this.data.dynamicschema,
|
|
78
|
+
},
|
|
79
|
+
this.contributions.objects[key],
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Retrieve child {@code AttributeSetModel}s
|
|
85
|
+
*/
|
|
86
|
+
getChildAttributeSets(): Array<AttributeSetModel> {
|
|
87
|
+
if (!this.contributions.objects) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const childAttributeSets = [];
|
|
92
|
+
for (const key of Object.keys(this.contributions.objects)) {
|
|
93
|
+
if (key in this.data) {
|
|
94
|
+
if (Array.isArray(this.data[key])) {
|
|
95
|
+
for (const [i, dataObject] of this.data[key].entries()) {
|
|
96
|
+
childAttributeSets.push(
|
|
97
|
+
this.createChildAttributeSetModel(key, dataObject, i),
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
childAttributeSets.push(
|
|
102
|
+
this.createChildAttributeSetModel(key, this.data[key]),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return childAttributeSets;
|
|
108
|
+
}
|
|
65
109
|
}
|
|
@@ -257,4 +257,21 @@ describe("attributeModel", () => {
|
|
|
257
257
|
expect(attribute.concept).toBeInstanceOf(ConceptDetailModel);
|
|
258
258
|
expect(attribute.concept.type).toBe("ConceptDetail");
|
|
259
259
|
});
|
|
260
|
+
|
|
261
|
+
it("indicates correct mandatory", () => {
|
|
262
|
+
let attribute = new AttributeModel({}, { mandatory: true });
|
|
263
|
+
expect(attribute.mandatory).toBe(true);
|
|
264
|
+
|
|
265
|
+
attribute = new AttributeModel({}, { mandatory: false });
|
|
266
|
+
expect(attribute.mandatory).toBe(false);
|
|
267
|
+
|
|
268
|
+
attribute = new AttributeModel({}, { mandatory: false, nullable: false });
|
|
269
|
+
expect(attribute.mandatory).toBe(true);
|
|
270
|
+
|
|
271
|
+
attribute = new AttributeModel(
|
|
272
|
+
{},
|
|
273
|
+
{ mandatory: false, layouthint: ["mandatory"] },
|
|
274
|
+
);
|
|
275
|
+
expect(attribute.mandatory).toBe(true);
|
|
276
|
+
});
|
|
260
277
|
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import ListDetailModel from "../ListDetailModel";
|
|
2
|
+
|
|
3
|
+
import Href from "../../href/Href";
|
|
4
|
+
|
|
5
|
+
import mockDetail from "./hierarchy.json";
|
|
6
|
+
import mockDetailContributions from "./hierarchyContributions.json";
|
|
7
|
+
|
|
8
|
+
describe("listDetailModel", () => {
|
|
9
|
+
describe("Event details", () => {
|
|
10
|
+
it("should be able to create a detail from a hierarchical modular UI json structure", () => {
|
|
11
|
+
const detail = new ListDetailModel({
|
|
12
|
+
request: {
|
|
13
|
+
href: new Href(
|
|
14
|
+
"/service-operation/service-operation/44/history/127",
|
|
15
|
+
"EventListPanelDetail",
|
|
16
|
+
),
|
|
17
|
+
},
|
|
18
|
+
key: "event",
|
|
19
|
+
data: mockDetail.event,
|
|
20
|
+
contributions: mockDetailContributions.event,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
expect(detail).toBeInstanceOf(ListDetailModel);
|
|
24
|
+
|
|
25
|
+
expect(detail.key).toBe("event");
|
|
26
|
+
|
|
27
|
+
expect(detail.id).toBe(127);
|
|
28
|
+
|
|
29
|
+
const selfLink = new Href(
|
|
30
|
+
"/service-operation/service-operation/44/history/127",
|
|
31
|
+
"EventListPanelDetail",
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
expect(detail.selfhref).toStrictEqual(selfLink);
|
|
35
|
+
|
|
36
|
+
expect(detail.attributeCollection.size).toBe(3);
|
|
37
|
+
|
|
38
|
+
expect(detail.hasEventData).toBe(true);
|
|
39
|
+
|
|
40
|
+
expect(detail.eventdata).toHaveLength(6);
|
|
41
|
+
|
|
42
|
+
expect(detail.eventdata[0].label).toBe("Company");
|
|
43
|
+
expect(detail.eventdata[0].getChildAttributeSets()).toHaveLength(3);
|
|
44
|
+
|
|
45
|
+
expect(detail.eventdata[0].getChildAttributeSets()[0].label).toBe(
|
|
46
|
+
"Company contact details",
|
|
47
|
+
);
|
|
48
|
+
expect(detail.eventdata[0].getChildAttributeSets()[1].label).toBe(
|
|
49
|
+
"Company contact details",
|
|
50
|
+
);
|
|
51
|
+
expect(detail.eventdata[0].getChildAttributeSets()[2].label).toBe("CEO");
|
|
52
|
+
|
|
53
|
+
expect(
|
|
54
|
+
detail.eventdata[0].getChildAttributeSets()[1].getChildAttributeSets(),
|
|
55
|
+
).toHaveLength(0);
|
|
56
|
+
expect(
|
|
57
|
+
detail.eventdata[0].getChildAttributeSets()[2].getChildAttributeSets(),
|
|
58
|
+
).toHaveLength(1);
|
|
59
|
+
|
|
60
|
+
expect(
|
|
61
|
+
detail.eventdata[0]
|
|
62
|
+
.getChildAttributeSets()[2]
|
|
63
|
+
.getChildAttributeSets()[0].label,
|
|
64
|
+
).toBe("CEO Business location");
|
|
65
|
+
expect(
|
|
66
|
+
detail.eventdata[0]
|
|
67
|
+
.getChildAttributeSets()[2]
|
|
68
|
+
.getChildAttributeSets()[0]
|
|
69
|
+
.getChildAttributeSets(),
|
|
70
|
+
).toHaveLength(2);
|
|
71
|
+
|
|
72
|
+
expect(
|
|
73
|
+
detail.eventdata[0]
|
|
74
|
+
.getChildAttributeSets()[2]
|
|
75
|
+
.getChildAttributeSets()[0]
|
|
76
|
+
.getChildAttributeSets()[1]
|
|
77
|
+
.attributeCollection.getAttributeByKey("CEOBLC_Type").label,
|
|
78
|
+
).toBe("Type");
|
|
79
|
+
expect(
|
|
80
|
+
detail.eventdata[0]
|
|
81
|
+
.getChildAttributeSets()[2]
|
|
82
|
+
.getChildAttributeSets()[0]
|
|
83
|
+
.getChildAttributeSets()[1]
|
|
84
|
+
.attributeCollection.getAttributeByKey("CEOBLC_Type").value,
|
|
85
|
+
).toBe("Email");
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
"event": {
|
|
3
|
+
"_links": {
|
|
4
|
+
"self": {
|
|
5
|
+
"href": "/service-operation/service-operation/44/history/127"
|
|
6
|
+
},
|
|
7
|
+
"api_doc": {
|
|
8
|
+
"href": "/api-docs/v3/service-operation/service-operation/(case-id)/history/(history-record-id)?id=HierarchicalInputAndOutputWithRootSingletonAndRepeat"
|
|
9
|
+
},
|
|
10
|
+
"contributions": {
|
|
11
|
+
"href": "/contributions/service-operation/service-operation/(case-id)/history/(history-record-id)?id=HierarchicalInputAndOutputWithRootSingletonAndRepeat"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dynamicschema": {
|
|
15
|
+
"EventType": [
|
|
16
|
+
{
|
|
17
|
+
"code": "HierarchicalInputAndOutputWithRootSingletonAndRepeat",
|
|
18
|
+
"label": "Hierarchical input and output with root singleton and repeat"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"User": [
|
|
22
|
+
{
|
|
23
|
+
"code": "2",
|
|
24
|
+
"label": "Arnold"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"_id": 127,
|
|
29
|
+
"EventType": "HierarchicalInputAndOutputWithRootSingletonAndRepeat",
|
|
30
|
+
"CreationDateTime": "2023-11-08T10:06:55.845",
|
|
31
|
+
"User": "2",
|
|
32
|
+
"eventdata": {
|
|
33
|
+
"Company": {
|
|
34
|
+
"Company_Name": "Be Informed",
|
|
35
|
+
"CompanyContactDetails": [
|
|
36
|
+
{
|
|
37
|
+
"Company_Type": "Mobile",
|
|
38
|
+
"Company_Value": "+49 309 289 5500"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"Company_Type": "Email",
|
|
42
|
+
"Company_Value": "info@beinformed.com"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"CEO": {
|
|
46
|
+
"CEO_Name": "René Louter",
|
|
47
|
+
"CEOBusinessLocation": {
|
|
48
|
+
"CEOBL_Address": "Laan van Westenenk, Room 2.1, Apeldoorn",
|
|
49
|
+
"CEOBusinessLocationContactDetails": [
|
|
50
|
+
{
|
|
51
|
+
"CEOBLC_Type": "Mobile",
|
|
52
|
+
"CEOBLC_Value": "+49 309 289 5503"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"CEOBLC_Type": "Email",
|
|
56
|
+
"CEOBLC_Value": "r.louter@beinformed.com"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"Employee": [
|
|
63
|
+
{
|
|
64
|
+
"Employee_Name": "Jesper",
|
|
65
|
+
"DurationTemporaryEmploymentContract": {
|
|
66
|
+
"DurationContract": {
|
|
67
|
+
"StartDate": "2023-06-21",
|
|
68
|
+
"EndDate": "2024-06-21"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"EmployeeBusinessLocation": {
|
|
72
|
+
"EmployeeBL_Address": "Laan van Westenenk, Floor 3, Apeldoorn",
|
|
73
|
+
"EmployeeBusinessLocationContactDetails": [
|
|
74
|
+
{
|
|
75
|
+
"EmployeeBLC_Type": "Mobile",
|
|
76
|
+
"EmployeeBLC_Value": "+49 308 888 4321"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"EmployeeBLC_Type": "Email",
|
|
80
|
+
"EmployeeBLC_Value": "jesper@beinformed.com"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"Employee_Name": "Harold",
|
|
87
|
+
"DurationTemporaryEmploymentContract": {
|
|
88
|
+
"DurationContract": {
|
|
89
|
+
"StartDate": "2023-06-21",
|
|
90
|
+
"EndDate": "2023-12-21"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"EmployeeBusinessLocation": {
|
|
94
|
+
"EmployeeBL_Address": "Laan van Westenenk, Floor 3, Apeldoorn",
|
|
95
|
+
"EmployeeBusinessLocationContactDetails": [
|
|
96
|
+
{
|
|
97
|
+
"EmployeeBLC_Type": "Mobile",
|
|
98
|
+
"EmployeeBLC_Value": "+49 309 289 5510"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"EmployeeBLC_Type": "Email",
|
|
102
|
+
"EmployeeBLC_Value": "harold@beinformed.com"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"Company_result": {
|
|
109
|
+
"Company_Name": "Be Informed",
|
|
110
|
+
"CompanyContactDetails": [
|
|
111
|
+
{
|
|
112
|
+
"Company_Type": "Mobile",
|
|
113
|
+
"Company_Value": "+49 309 289 5500"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"Company_Type": "Email",
|
|
117
|
+
"Company_Value": "info@beinformed.com"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"CEO": {
|
|
121
|
+
"CEO_Name": "René Louter",
|
|
122
|
+
"CEOBusinessLocation": {
|
|
123
|
+
"CEOBL_Address": "Laan van Westenenk, Room 2.1, Apeldoorn",
|
|
124
|
+
"CEOBusinessLocationContactDetails": [
|
|
125
|
+
{
|
|
126
|
+
"CEOBLC_Type": "Mobile",
|
|
127
|
+
"CEOBLC_Value": "+49 309 289 5503"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"CEOBLC_Type": "Email",
|
|
131
|
+
"CEOBLC_Value": "r.louter@beinformed.com"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"Employee_result": [
|
|
138
|
+
{
|
|
139
|
+
"Employee_Name": "Jesper",
|
|
140
|
+
"DurationTemporaryEmploymentContract": {
|
|
141
|
+
"DurationContract": {
|
|
142
|
+
"StartDate": "2023-06-21",
|
|
143
|
+
"EndDate": "2024-06-21"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"EmployeeBusinessLocation": {
|
|
147
|
+
"EmployeeBL_Address": "Laan van Westenenk, Floor 3, Apeldoorn",
|
|
148
|
+
"EmployeeBusinessLocationContactDetails": [
|
|
149
|
+
{
|
|
150
|
+
"EmployeeBLC_Type": "Mobile",
|
|
151
|
+
"EmployeeBLC_Value": "+49 308 888 4321"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"EmployeeBLC_Type": "Email",
|
|
155
|
+
"EmployeeBLC_Value": "jesper@beinformed.com"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"Employee_Name": "Harold",
|
|
162
|
+
"DurationTemporaryEmploymentContract": {
|
|
163
|
+
"DurationContract": {
|
|
164
|
+
"StartDate": "2023-06-21",
|
|
165
|
+
"EndDate": "2023-12-21"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"EmployeeBusinessLocation": {
|
|
169
|
+
"EmployeeBL_Address": "Laan van Westenenk, Floor 3, Apeldoorn",
|
|
170
|
+
"EmployeeBusinessLocationContactDetails": [
|
|
171
|
+
{
|
|
172
|
+
"EmployeeBLC_Type": "Mobile",
|
|
173
|
+
"EmployeeBLC_Value": "+49 309 289 5510"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"EmployeeBLC_Type": "Email",
|
|
177
|
+
"EmployeeBLC_Value": "harold@beinformed.com"
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|