@beinformed/ui 1.36.0 → 1.37.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/esm/constants/LayoutHintConfig.js +3 -3
  3. package/esm/constants/LayoutHintConfig.js.map +1 -1
  4. package/esm/models/attributes/AttributeSetModel.js +32 -0
  5. package/esm/models/attributes/AttributeSetModel.js.map +1 -1
  6. package/esm/models/taskgroup/TaskGroupCollection.js +1 -1
  7. package/esm/models/taskgroup/TaskGroupCollection.js.map +1 -1
  8. package/esm/models/taskgroup/TaskGroupModel.js +8 -0
  9. package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
  10. package/lib/constants/LayoutHintConfig.js +3 -3
  11. package/lib/constants/LayoutHintConfig.js.flow +3 -3
  12. package/lib/constants/LayoutHintConfig.js.map +1 -1
  13. package/lib/models/attributes/AttributeSetModel.js +32 -0
  14. package/lib/models/attributes/AttributeSetModel.js.flow +44 -0
  15. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  16. package/lib/models/list/__tests__/ListDetailModel.hierarchy.spec.js.flow +88 -0
  17. package/lib/models/taskgroup/TaskGroupCollection.js +1 -1
  18. package/lib/models/taskgroup/TaskGroupCollection.js.flow +1 -4
  19. package/lib/models/taskgroup/TaskGroupCollection.js.map +1 -1
  20. package/lib/models/taskgroup/TaskGroupModel.js +8 -0
  21. package/lib/models/taskgroup/TaskGroupModel.js.flow +8 -0
  22. package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
  23. package/package.json +9 -9
  24. package/src/constants/LayoutHintConfig.js +3 -3
  25. package/src/models/attributes/AttributeSetModel.js +44 -0
  26. package/src/models/list/__tests__/ListDetailModel.hierarchy.spec.js +88 -0
  27. package/src/models/list/__tests__/hierarchy.json +185 -0
  28. package/src/models/list/__tests__/hierarchyContributions.json +582 -0
  29. package/src/models/taskgroup/TaskGroupCollection.js +1 -4
  30. package/src/models/taskgroup/TaskGroupModel.js +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -108,22 +108,22 @@
108
108
  "@babel/preset-env": "^7.23.2",
109
109
  "@babel/preset-flow": "^7.22.15",
110
110
  "@babel/preset-react": "^7.22.15",
111
- "@commitlint/cli": "^17.7.2",
112
- "@commitlint/config-conventional": "^17.7.0",
113
- "@testing-library/react": "^14.0.0",
111
+ "@commitlint/cli": "^18.2.0",
112
+ "@commitlint/config-conventional": "^18.1.0",
113
+ "@testing-library/react": "^14.1.0",
114
114
  "auditjs": "^4.0.41",
115
115
  "babel-jest": "^29.7.0",
116
116
  "babel-plugin-styled-components": "^2.1.4",
117
117
  "cherry-pick": "^0.5.0",
118
- "commit-and-tag-version": "^11.3.0",
118
+ "commit-and-tag-version": "^12.0.0",
119
119
  "cross-env": "^7.0.3",
120
120
  "documentation": "^14.0.2",
121
- "eslint": "^8.52.0",
121
+ "eslint": "^8.53.0",
122
122
  "eslint-config-prettier": "^9.0.0",
123
123
  "eslint-plugin-babel": "^5.3.1",
124
124
  "eslint-plugin-ft-flow": "^3.0.1",
125
125
  "eslint-plugin-import": "^2.29.0",
126
- "eslint-plugin-jest": "^27.4.3",
126
+ "eslint-plugin-jest": "^27.6.0",
127
127
  "eslint-plugin-jsdoc": "^46.8.2",
128
128
  "eslint-plugin-react": "^7.33.2",
129
129
  "eslint-plugin-react-hooks": "^4.5.0",
@@ -131,14 +131,14 @@
131
131
  "flow-bin": "^0.200.1",
132
132
  "flow-copy-source": "^2.0.9",
133
133
  "flow-typed": "^3.9.0",
134
- "hermes-eslint": "^0.17.0",
134
+ "hermes-eslint": "^0.16.0",
135
135
  "history": "^4.0.0",
136
136
  "husky": "^8.0.3",
137
137
  "jest": "^29.7.0",
138
138
  "jest-environment-jsdom": "^29.7.0",
139
139
  "jest-junit": "^16.0.0",
140
140
  "jest-sonar-reporter": "^2.0.0",
141
- "jscodeshift": "^0.15.0",
141
+ "jscodeshift": "^0.15.1",
142
142
  "lint-staged": "^13.2.3",
143
143
  "polished": "^4.0.0",
144
144
  "prettier": "^3.0.3",
@@ -161,10 +161,10 @@ export const LayoutHintConfiguration = {
161
161
  HIDE_IN_USER_INTERFACE: {
162
162
  hint: "hide-in-user-interface",
163
163
  description: {
164
- NL: "Verberg een link in de user interface.",
165
- EN: "Hide a link in the user interface.",
164
+ NL: "Verberg een tab in de user interface.",
165
+ EN: "Hide a tab in the user interface.",
166
166
  },
167
167
  link: "",
168
- component: ["tab", "taskgroup"],
168
+ component: ["tab"],
169
169
  },
170
170
  };
@@ -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
+ const childAttributeSets = [];
88
+
89
+ if (this.contributions.objects) {
90
+ for (const key of Object.keys(this.contributions.objects)) {
91
+ if (key in this.data) {
92
+ if (Array.isArray(this.data[key])) {
93
+ for (const [i, dataObject] of this.data[key].entries()) {
94
+ childAttributeSets.push(
95
+ this.createChildAttributeSetModel(key, dataObject, i),
96
+ );
97
+ }
98
+ } else {
99
+ childAttributeSets.push(
100
+ this.createChildAttributeSetModel(key, this.data[key]),
101
+ );
102
+ }
103
+ }
104
+ }
105
+ }
106
+
107
+ return childAttributeSets;
108
+ }
65
109
  }
@@ -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
+ }