@beinformed/ui 1.12.0 → 1.13.1

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 (305) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/esm/builder/mergeLayoutHintConfigurations.js +3 -3
  3. package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
  4. package/esm/exceptions/ConfigurationException.js +2 -1
  5. package/esm/exceptions/ConfigurationException.js.map +1 -1
  6. package/esm/exceptions/FetchException.js +4 -3
  7. package/esm/exceptions/FetchException.js.map +1 -1
  8. package/esm/exceptions/IllegalArgumentException.js +2 -1
  9. package/esm/exceptions/IllegalArgumentException.js.map +1 -1
  10. package/esm/exceptions/IllegalReturnException.js +2 -1
  11. package/esm/exceptions/IllegalReturnException.js.map +1 -1
  12. package/esm/exceptions/IllegalStateException.js +2 -1
  13. package/esm/exceptions/IllegalStateException.js.map +1 -1
  14. package/esm/exceptions/JsonParseException.js +2 -1
  15. package/esm/exceptions/JsonParseException.js.map +1 -1
  16. package/esm/exceptions/MissingPropertyException.js +2 -1
  17. package/esm/exceptions/MissingPropertyException.js.map +1 -1
  18. package/esm/exceptions/NetworkException.js +2 -1
  19. package/esm/exceptions/NetworkException.js.map +1 -1
  20. package/esm/exceptions/NotAllowedUriException.js +2 -1
  21. package/esm/exceptions/NotAllowedUriException.js.map +1 -1
  22. package/esm/exceptions/NotFoundException.js +2 -1
  23. package/esm/exceptions/NotFoundException.js.map +1 -1
  24. package/esm/exceptions/ServerRequestException.js +2 -1
  25. package/esm/exceptions/ServerRequestException.js.map +1 -1
  26. package/esm/exceptions/ThemePropertyException.js +2 -1
  27. package/esm/exceptions/ThemePropertyException.js.map +1 -1
  28. package/esm/exceptions/TimeoutException.js +2 -1
  29. package/esm/exceptions/TimeoutException.js.map +1 -1
  30. package/esm/exceptions/UnauthorizedException.js +2 -1
  31. package/esm/exceptions/UnauthorizedException.js.map +1 -1
  32. package/esm/exceptions/UnsupportedOperationException.js +2 -1
  33. package/esm/exceptions/UnsupportedOperationException.js.map +1 -1
  34. package/esm/hooks/useContent.js +2 -2
  35. package/esm/hooks/useContent.js.map +1 -1
  36. package/esm/hooks/useDeepCompareEffect.js +2 -1
  37. package/esm/hooks/useDeepCompareEffect.js.map +1 -1
  38. package/esm/hooks/useForm.js.map +1 -1
  39. package/esm/hooks/useModal.js +2 -2
  40. package/esm/hooks/useModal.js.map +1 -1
  41. package/esm/hooks/useModularUI.js +0 -1
  42. package/esm/hooks/useModularUI.js.map +1 -1
  43. package/esm/hooks/useProgressIndicator.js +2 -2
  44. package/esm/i18n/Locale.js +11 -4
  45. package/esm/i18n/Locale.js.map +1 -1
  46. package/esm/i18n/Locales.js +2 -2
  47. package/esm/i18n/Message.js +2 -2
  48. package/esm/i18n/languages.js +2 -1
  49. package/esm/i18n/languages.js.map +1 -1
  50. package/esm/models/attributes/AttributeCollection.js +2 -2
  51. package/esm/models/attributes/AttributeContent.js +58 -30
  52. package/esm/models/attributes/AttributeContent.js.map +1 -1
  53. package/esm/models/attributes/AttributeDataHelper.js +3 -3
  54. package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
  55. package/esm/models/attributes/BooleanAttributeModel.js +2 -2
  56. package/esm/models/attributes/ChoiceAttributeModel.js +2 -2
  57. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +2 -2
  58. package/esm/models/attributes/CompositeAttributeChildCollection.js +2 -2
  59. package/esm/models/attributes/HelptextAttributeModel.js +24 -9
  60. package/esm/models/attributes/HelptextAttributeModel.js.map +1 -1
  61. package/esm/models/attributes/_createAttribute.js +2 -2
  62. package/esm/models/base/ResourceModel.js +2 -2
  63. package/esm/models/caseview/CaseViewModel.js +4 -5
  64. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  65. package/esm/models/concepts/ConceptDetailModel.js +2 -2
  66. package/esm/models/concepts/SourceReferenceModel.js +2 -2
  67. package/esm/models/content/ContentTOCModel.js +2 -2
  68. package/esm/models/filters/AssignmentFilterModel.js +2 -2
  69. package/esm/models/filters/BaseFilterModel.js +2 -2
  70. package/esm/models/filters/ConceptIndexFilterModel.js +2 -1
  71. package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
  72. package/esm/models/filters/FilterCollection.js +2 -2
  73. package/esm/models/filters/FilterModel.js +2 -1
  74. package/esm/models/filters/FilterModel.js.map +1 -1
  75. package/esm/models/form/FormModel.js +28 -4
  76. package/esm/models/form/FormModel.js.map +1 -1
  77. package/esm/models/form/FormObjectModel.js +5 -7
  78. package/esm/models/form/FormObjectModel.js.map +1 -1
  79. package/esm/models/grouping/GroupingModel.js +2 -2
  80. package/esm/models/links/normalizeLinkJSON.js +2 -2
  81. package/esm/models/list/ListDetailModel.js +4 -6
  82. package/esm/models/list/ListDetailModel.js.map +1 -1
  83. package/esm/models/list/ListItemCollection.js +38 -0
  84. package/esm/models/list/ListItemCollection.js.map +1 -1
  85. package/esm/models/list/ListItemModel.js +14 -2
  86. package/esm/models/list/ListItemModel.js.map +1 -1
  87. package/esm/models/list/ListModel.js +19 -74
  88. package/esm/models/list/ListModel.js.map +1 -1
  89. package/esm/models/lookup/LookupOptionCollection.js +2 -2
  90. package/esm/models/panels/GroupingPanelModel.js +2 -4
  91. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  92. package/esm/modularui/ModularUIError.js +2 -1
  93. package/esm/modularui/ModularUIError.js.map +1 -1
  94. package/esm/modularui/ModularUIRequest.js +71 -49
  95. package/esm/modularui/ModularUIRequest.js.map +1 -1
  96. package/esm/react-server/serverUtil.js +2 -2
  97. package/esm/react-theme/createTheme.js +2 -2
  98. package/esm/redux/_i18n/reducer.js +2 -2
  99. package/esm/redux/_modularui/actions.js +2 -2
  100. package/esm/redux/_modularui/connector.js +2 -2
  101. package/esm/redux/_modularui/reducer.js +2 -2
  102. package/esm/redux/_modularui/selectors.js +2 -2
  103. package/esm/redux/reducers/AuthReducer.js +2 -2
  104. package/esm/redux/reducers/ModalsReducer.js +2 -2
  105. package/esm/redux/reducers/NotificationReducer.js +2 -2
  106. package/esm/redux/reducers/PreferencesReducer.js +2 -2
  107. package/esm/redux/reducers/ProgressIndicatorReducer.js +2 -2
  108. package/esm/redux/store/configureStore.js +2 -2
  109. package/esm/utils/browser/Cookies.js +18 -32
  110. package/esm/utils/browser/Cookies.js.map +1 -1
  111. package/esm/utils/fetch/xhr.js +4 -3
  112. package/esm/utils/fetch/xhr.js.map +1 -1
  113. package/lib/builder/mergeLayoutHintConfigurations.js +3 -3
  114. package/lib/builder/mergeLayoutHintConfigurations.js.flow +3 -3
  115. package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
  116. package/lib/exceptions/ConfigurationException.js +3 -1
  117. package/lib/exceptions/ConfigurationException.js.map +1 -1
  118. package/lib/exceptions/FetchException.js +5 -3
  119. package/lib/exceptions/FetchException.js.map +1 -1
  120. package/lib/exceptions/IllegalArgumentException.js +3 -1
  121. package/lib/exceptions/IllegalArgumentException.js.map +1 -1
  122. package/lib/exceptions/IllegalReturnException.js +3 -1
  123. package/lib/exceptions/IllegalReturnException.js.map +1 -1
  124. package/lib/exceptions/IllegalStateException.js +3 -1
  125. package/lib/exceptions/IllegalStateException.js.map +1 -1
  126. package/lib/exceptions/JsonParseException.js +3 -1
  127. package/lib/exceptions/JsonParseException.js.map +1 -1
  128. package/lib/exceptions/MissingPropertyException.js +3 -1
  129. package/lib/exceptions/MissingPropertyException.js.map +1 -1
  130. package/lib/exceptions/NetworkException.js +3 -1
  131. package/lib/exceptions/NetworkException.js.map +1 -1
  132. package/lib/exceptions/NotAllowedUriException.js +3 -1
  133. package/lib/exceptions/NotAllowedUriException.js.map +1 -1
  134. package/lib/exceptions/NotFoundException.js +3 -1
  135. package/lib/exceptions/NotFoundException.js.map +1 -1
  136. package/lib/exceptions/ServerRequestException.js +3 -1
  137. package/lib/exceptions/ServerRequestException.js.map +1 -1
  138. package/lib/exceptions/ThemePropertyException.js +3 -1
  139. package/lib/exceptions/ThemePropertyException.js.map +1 -1
  140. package/lib/exceptions/TimeoutException.js +3 -1
  141. package/lib/exceptions/TimeoutException.js.map +1 -1
  142. package/lib/exceptions/UnauthorizedException.js +3 -1
  143. package/lib/exceptions/UnauthorizedException.js.map +1 -1
  144. package/lib/exceptions/UnsupportedOperationException.js +3 -1
  145. package/lib/exceptions/UnsupportedOperationException.js.map +1 -1
  146. package/lib/hooks/useContent.js +2 -2
  147. package/lib/hooks/useContent.js.flow +2 -2
  148. package/lib/hooks/useContent.js.map +1 -1
  149. package/lib/hooks/useDeepCompareEffect.js +2 -1
  150. package/lib/hooks/useDeepCompareEffect.js.flow +1 -1
  151. package/lib/hooks/useDeepCompareEffect.js.map +1 -1
  152. package/lib/hooks/useForm.js.flow +1 -2
  153. package/lib/hooks/useForm.js.map +1 -1
  154. package/lib/hooks/useModal.js +2 -2
  155. package/lib/hooks/useModal.js.flow +1 -1
  156. package/lib/hooks/useModal.js.map +1 -1
  157. package/lib/hooks/useModularUI.js +0 -1
  158. package/lib/hooks/useModularUI.js.flow +0 -2
  159. package/lib/hooks/useModularUI.js.map +1 -1
  160. package/lib/hooks/useProgressIndicator.js +2 -2
  161. package/lib/i18n/Locale.js +11 -5
  162. package/lib/i18n/Locale.js.flow +7 -0
  163. package/lib/i18n/Locale.js.map +1 -1
  164. package/lib/i18n/Locales.js +2 -2
  165. package/lib/i18n/Message.js +2 -2
  166. package/lib/i18n/__tests__/Locale.spec.js.flow +14 -0
  167. package/lib/i18n/languages.js +2 -1
  168. package/lib/i18n/languages.js.flow +1 -0
  169. package/lib/i18n/languages.js.map +1 -1
  170. package/lib/i18n/types.js.flow +1 -0
  171. package/lib/models/attributes/AttributeCollection.js +2 -2
  172. package/lib/models/attributes/AttributeContent.js +59 -31
  173. package/lib/models/attributes/AttributeContent.js.flow +63 -16
  174. package/lib/models/attributes/AttributeContent.js.map +1 -1
  175. package/lib/models/attributes/AttributeDataHelper.js +3 -3
  176. package/lib/models/attributes/AttributeDataHelper.js.flow +1 -0
  177. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  178. package/lib/models/attributes/BooleanAttributeModel.js +2 -2
  179. package/lib/models/attributes/ChoiceAttributeModel.js +2 -2
  180. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +2 -2
  181. package/lib/models/attributes/CompositeAttributeChildCollection.js +2 -2
  182. package/lib/models/attributes/HelptextAttributeModel.js +24 -9
  183. package/lib/models/attributes/HelptextAttributeModel.js.flow +18 -5
  184. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  185. package/lib/models/attributes/__tests__/AttributeCollection.spec.js.flow +4 -4
  186. package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +13 -19
  187. package/lib/models/attributes/__tests__/HelptextAttributeModel.spec.js.flow +18 -10
  188. package/lib/models/attributes/_createAttribute.js +2 -2
  189. package/lib/models/base/ResourceModel.js +2 -2
  190. package/lib/models/caseview/CaseViewModel.js +5 -5
  191. package/lib/models/caseview/CaseViewModel.js.flow +5 -3
  192. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  193. package/lib/models/caseview/__tests__/CaseViewModel.spec.js.flow +43 -4
  194. package/lib/models/concepts/ConceptDetailModel.js +2 -2
  195. package/lib/models/concepts/SourceReferenceModel.js +2 -2
  196. package/lib/models/content/ContentTOCModel.js +2 -2
  197. package/lib/models/filters/AssignmentFilterModel.js +2 -2
  198. package/lib/models/filters/BaseFilterModel.js +2 -2
  199. package/lib/models/filters/ConceptIndexFilterModel.js +3 -1
  200. package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
  201. package/lib/models/filters/FilterCollection.js +2 -2
  202. package/lib/models/filters/FilterModel.js +3 -1
  203. package/lib/models/filters/FilterModel.js.map +1 -1
  204. package/lib/models/form/FormModel.js +28 -4
  205. package/lib/models/form/FormModel.js.flow +18 -1
  206. package/lib/models/form/FormModel.js.map +1 -1
  207. package/lib/models/form/FormObjectModel.js +5 -7
  208. package/lib/models/form/FormObjectModel.js.flow +2 -4
  209. package/lib/models/form/FormObjectModel.js.map +1 -1
  210. package/lib/models/form/__tests__/FormModel.getters.spec.js.flow +15 -0
  211. package/lib/models/form/__tests__/FormObjectModel.spec.js.flow +29 -3
  212. package/lib/models/grouping/GroupingModel.js +2 -2
  213. package/lib/models/links/normalizeLinkJSON.js +2 -2
  214. package/lib/models/list/ListDetailModel.js +4 -6
  215. package/lib/models/list/ListDetailModel.js.flow +2 -2
  216. package/lib/models/list/ListDetailModel.js.map +1 -1
  217. package/lib/models/list/ListItemCollection.js +40 -0
  218. package/lib/models/list/ListItemCollection.js.flow +38 -1
  219. package/lib/models/list/ListItemCollection.js.map +1 -1
  220. package/lib/models/list/ListItemModel.js +14 -2
  221. package/lib/models/list/ListItemModel.js.flow +15 -0
  222. package/lib/models/list/ListItemModel.js.map +1 -1
  223. package/lib/models/list/ListModel.js +18 -75
  224. package/lib/models/list/ListModel.js.flow +3 -47
  225. package/lib/models/list/ListModel.js.map +1 -1
  226. package/lib/models/list/__tests__/ListDetailModel.spec.js.flow +5 -3
  227. package/lib/models/list/__tests__/ListItemCollection.spec.js.flow +22 -0
  228. package/lib/models/list/__tests__/ListModel.spec.js.flow +5 -5
  229. package/lib/models/lookup/LookupOptionCollection.js +2 -2
  230. package/lib/models/panels/GroupingPanelModel.js +2 -4
  231. package/lib/models/panels/GroupingPanelModel.js.flow +2 -2
  232. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  233. package/lib/models/panels/__tests__/GroupingPanelModel.spec.js.flow +43 -24
  234. package/lib/models/process/__tests__/ProcessStatusSettingsModel.spec.js.flow +11 -0
  235. package/lib/models/types.js.flow +3 -3
  236. package/lib/modularui/ModularUIError.js +3 -1
  237. package/lib/modularui/ModularUIError.js.map +1 -1
  238. package/lib/modularui/ModularUIRequest.js +69 -49
  239. package/lib/modularui/ModularUIRequest.js.flow +38 -22
  240. package/lib/modularui/ModularUIRequest.js.map +1 -1
  241. package/lib/react-server/serverUtil.js +2 -2
  242. package/lib/react-theme/createTheme.js +2 -2
  243. package/lib/redux/_i18n/reducer.js +2 -2
  244. package/lib/redux/_modularui/actions.js +2 -2
  245. package/lib/redux/_modularui/connector.js +2 -2
  246. package/lib/redux/_modularui/reducer.js +2 -2
  247. package/lib/redux/_modularui/selectors.js +2 -2
  248. package/lib/redux/reducers/AuthReducer.js +2 -2
  249. package/lib/redux/reducers/ModalsReducer.js +2 -2
  250. package/lib/redux/reducers/NotificationReducer.js +2 -2
  251. package/lib/redux/reducers/PreferencesReducer.js +2 -2
  252. package/lib/redux/reducers/ProgressIndicatorReducer.js +2 -2
  253. package/lib/redux/store/configureStore.js +2 -2
  254. package/lib/utils/browser/Cookies.js +18 -31
  255. package/lib/utils/browser/Cookies.js.flow +22 -28
  256. package/lib/utils/browser/Cookies.js.map +1 -1
  257. package/lib/utils/browser/__tests__/Cookies.spec.js.flow +51 -0
  258. package/lib/utils/fetch/xhr.js +4 -3
  259. package/lib/utils/fetch/xhr.js.flow +3 -1
  260. package/lib/utils/fetch/xhr.js.map +1 -1
  261. package/package.json +36 -34
  262. package/src/builder/mergeLayoutHintConfigurations.js +3 -3
  263. package/src/hooks/useContent.js +2 -2
  264. package/src/hooks/useDeepCompareEffect.js +1 -1
  265. package/src/hooks/useForm.js +1 -2
  266. package/src/hooks/useModal.js +1 -1
  267. package/src/hooks/useModularUI.js +0 -2
  268. package/src/i18n/Locale.js +7 -0
  269. package/src/i18n/__tests__/Locale.spec.js +14 -0
  270. package/src/i18n/languages.js +1 -0
  271. package/src/i18n/types.js +1 -0
  272. package/src/models/attributes/AttributeContent.js +63 -16
  273. package/src/models/attributes/AttributeDataHelper.js +1 -0
  274. package/src/models/attributes/HelptextAttributeModel.js +18 -5
  275. package/src/models/attributes/__mock__/_FormCollectionContribution.json +9 -0
  276. package/src/models/attributes/__mock__/_FormCollectionData.json +12 -3
  277. package/src/models/attributes/__tests__/AttributeCollection.spec.js +4 -4
  278. package/src/models/attributes/__tests__/AttributeContent.spec.js +13 -19
  279. package/src/models/attributes/__tests__/HelptextAttributeModel.spec.js +18 -10
  280. package/src/models/caseview/CaseViewModel.js +5 -3
  281. package/src/models/caseview/__tests__/CaseViewModel.spec.js +43 -4
  282. package/src/models/caseview/__tests__/caseview.json +14 -3
  283. package/src/models/caseview/__tests__/caseviewContributions.json +48 -77
  284. package/src/models/caseview/__tests__/caseview_local_taskgroup.json +57 -0
  285. package/src/models/form/FormModel.js +18 -1
  286. package/src/models/form/FormObjectModel.js +2 -4
  287. package/src/models/form/__tests__/FormModel.getters.spec.js +15 -0
  288. package/src/models/form/__tests__/FormObjectModel.spec.js +29 -3
  289. package/src/models/list/ListDetailModel.js +2 -2
  290. package/src/models/list/ListItemCollection.js +38 -1
  291. package/src/models/list/ListItemModel.js +15 -0
  292. package/src/models/list/ListModel.js +3 -47
  293. package/src/models/list/__tests__/ListDetailModel.spec.js +5 -3
  294. package/src/models/list/__tests__/ListItemCollection.spec.js +22 -0
  295. package/src/models/list/__tests__/ListModel.spec.js +5 -5
  296. package/src/models/panels/GroupingPanelModel.js +2 -2
  297. package/src/models/panels/__tests__/GroupingPanelModel.spec.js +43 -24
  298. package/src/models/panels/__tests__/groupingPanel.json +20 -1
  299. package/src/models/panels/__tests__/groupingPanelContributions.json +14 -1
  300. package/src/models/process/__tests__/ProcessStatusSettingsModel.spec.js +11 -0
  301. package/src/models/types.js +3 -3
  302. package/src/modularui/ModularUIRequest.js +38 -22
  303. package/src/utils/browser/Cookies.js +22 -28
  304. package/src/utils/browser/__tests__/Cookies.spec.js +51 -0
  305. package/src/utils/fetch/xhr.js +3 -1
@@ -13,10 +13,8 @@ const json = {
13
13
  {
14
14
  propertyElement: {
15
15
  label: "Properties",
16
- id: "properties",
17
16
  properties: [
18
17
  {
19
- type: "Gemiddelde",
20
18
  label: "Gemiddelde",
21
19
  value: "80%",
22
20
  },
@@ -26,10 +24,8 @@ const json = {
26
24
  {
27
25
  propertyElement: {
28
26
  label: "Second Properties",
29
- id: "secondProperties",
30
27
  properties: [
31
28
  {
32
- type: "SecondGemiddelde",
33
29
  label: "Second Gemiddelde",
34
30
  value: "20%",
35
31
  },
@@ -38,20 +34,15 @@ const json = {
38
34
  },
39
35
  {
40
36
  textFragmentElement: {
41
- label: "Description",
42
- id: "Description",
37
+ label: "Description TextFragment",
43
38
  textfragments: [
44
- {
45
- type: "Description",
46
- label: "Description",
47
- text: { message: "Dit is een text fragment" },
48
- },
39
+ { id: "Description", text: { message: "Dit is een text fragment" } },
49
40
  ],
50
41
  },
51
42
  },
52
43
  {
53
44
  contentElement: {
54
- label: "Description",
45
+ label: "Description Content",
55
46
  sections: [
56
47
  {
57
48
  id: "Alert",
@@ -160,26 +151,29 @@ describe("AttributeContent", () => {
160
151
  expect(content.sections).toHaveLength(1);
161
152
 
162
153
  const firstProperty = content.properties[0];
163
- expect(firstProperty.type).toBe("Gemiddelde");
164
154
  expect(firstProperty.label).toBe("Gemiddelde");
165
155
  expect(firstProperty.value).toBe("80%");
166
156
 
167
157
  const firstTextFragment = content.textfragments[0];
168
- expect(firstTextFragment.type).toBe("Description");
169
- expect(firstTextFragment.label).toBe("Description");
170
158
  expect(firstTextFragment.text).toBe("Dit is een text fragment");
171
159
  });
172
160
 
173
161
  it("Can ask for elements by type", () => {
174
162
  const content = new AttributeContent(json);
175
163
 
176
- expect(content.getConceptPropertiesByIds("not-existing")).toHaveLength(0);
177
- expect(content.getTextFragmentByKeys("not-existing")).toHaveLength(0);
164
+ expect(content.getConceptPropertiesByLabels("not-existing")).toHaveLength(
165
+ 0
166
+ );
167
+ expect(content.getTextFragmentsByLabels("not-existing")).toHaveLength(0);
178
168
  expect(content.getSectionsByType("not-existing")).toHaveLength(0);
169
+ expect(content.getSectionsByLabels("not-existing")).toHaveLength(0);
179
170
 
180
- expect(content.getConceptPropertiesByIds("Gemiddelde")).toHaveLength(1);
181
- expect(content.getTextFragmentByKeys("Description")).toHaveLength(1);
171
+ expect(content.getConceptPropertiesByLabels("Properties")).toHaveLength(1);
172
+ expect(
173
+ content.getTextFragmentsByLabels("Description TextFragment")
174
+ ).toHaveLength(1);
182
175
  expect(content.getSectionsByType("Reference")).toHaveLength(1);
176
+ expect(content.getSectionsByLabels("Description Content")).toHaveLength(1);
183
177
  });
184
178
 
185
179
  it("Creates ContentModel when sections available", () => {
@@ -9,7 +9,14 @@ describe("helptextAttributeModel", () => {
9
9
  expect(attribute.text).toBeNull();
10
10
 
11
11
  const attributeWithText = new HelptextAttributeModel(
12
- {},
12
+ {
13
+ key: "CarDetails",
14
+ content: null,
15
+ static: true,
16
+ dynamicschemaId: "CarDetails",
17
+ isResult: false,
18
+ children: [],
19
+ },
13
20
  { text: "Example helptext text" }
14
21
  );
15
22
 
@@ -20,21 +27,22 @@ describe("helptextAttributeModel", () => {
20
27
  const attributeWithText = new HelptextAttributeModel(
21
28
  {
22
29
  key: "CarDetails",
23
- value: {
24
- id: "CarDetails.text",
25
- properties: {
26
- PersonPrivateCar: "Ferrari GTO",
27
- PersonLessFavoriteCars: "Mercedes",
28
- PersonFavoriteCars: "BMW 5 Series, Fiat Panda",
30
+ content: {
31
+ text: {
32
+ id: "CarDetails.text",
33
+ properties: {
34
+ PersonPrivateCar: "Ferrari GTO",
35
+ PersonLessFavoriteCars: "Mercedes",
36
+ PersonFavoriteCars: "BMW 5 Series, Fiat Panda",
37
+ },
38
+ message:
39
+ "<p>Currently the person drives in a Ferrari GTO, although his favorite cars are BMW 5 Series, Fiat Panda. Less favorite cars of the person are Mercedes.</p>",
29
40
  },
30
- message:
31
- "<p>Currently the person drives in a Ferrari GTO, although his favorite cars are BMW 5 Series, Fiat Panda. Less favorite cars of the person are Mercedes.</p>",
32
41
  },
33
42
  static: true,
34
43
  dynamicschemaId: "CarDetails",
35
44
  isResult: false,
36
45
  children: [],
37
- content: null,
38
46
  },
39
47
  {
40
48
  type: "string",
@@ -6,6 +6,8 @@ import TaskGroupModel from "../taskgroup/TaskGroupModel";
6
6
 
7
7
  import { TITLE } from "../../constants/LayoutHints";
8
8
 
9
+ import IllegalStateException from "../../exceptions/IllegalStateException";
10
+
9
11
  import type { ModularUIModel, AttributeType } from "../types";
10
12
  import type { ModularUIResponse } from "../../modularui";
11
13
  import type LinkCollection from "../links/LinkCollection";
@@ -100,8 +102,8 @@ export default class CaseViewModel extends DetailModel {
100
102
  * Getting the introduction text configured on the case view
101
103
  */
102
104
  get introtext(): string {
103
- if (this.data._text) {
104
- return this.data._text.message ?? this.data._text;
105
+ if (this.data._content) {
106
+ return this.data._content.text.message;
105
107
  }
106
108
 
107
109
  if (this.contributions.text) {
@@ -122,7 +124,7 @@ export default class CaseViewModel extends DetailModel {
122
124
  const selfLink = this.links.getLinkByKey("self");
123
125
 
124
126
  if (selfLink === null) {
125
- throw new Error("No self href available");
127
+ throw new IllegalStateException("No self href available");
126
128
  }
127
129
 
128
130
  return new Href(selfLink.href);
@@ -2,13 +2,26 @@ import CaseViewModel from "../CaseViewModel";
2
2
  import DetailModel from "../../detail/DetailModel";
3
3
 
4
4
  import caseviewJson from "./caseview.json";
5
+ import caseviewLocalTaskgroupJson from "./caseview_local_taskgroup.json";
5
6
  import caseviewContributionsJson from "./caseviewContributions.json";
6
7
 
8
+ import IllegalStateException from "../../../exceptions/IllegalStateException";
9
+
7
10
  describe("caseViewModel", () => {
8
11
  it("should be able to create an empty casedetail", () => {
9
12
  const caseview = new CaseViewModel({});
10
13
 
11
14
  expect(caseview).toBeInstanceOf(CaseViewModel);
15
+ expect(caseview.getInitialChildModelLinks()).toHaveLength(0);
16
+ expect(caseview.panelLinks).toHaveLength(0);
17
+ expect(caseview.introtext).toBe("");
18
+ });
19
+
20
+ it("throws when no self link is available", () => {
21
+ const caseview = new CaseViewModel({});
22
+ expect(() => {
23
+ caseview.selfhref;
24
+ }).toThrow(IllegalStateException);
12
25
  });
13
26
 
14
27
  it("should be able to create a casedetail from a typical modular UI json structure", () => {
@@ -18,6 +31,8 @@ describe("caseViewModel", () => {
18
31
  contributions: caseviewContributionsJson,
19
32
  });
20
33
 
34
+ expect(caseDetail.viewLabel).toBe("Book");
35
+ expect(caseDetail.hasIntroText()).toBe(true);
21
36
  expect(caseDetail).toBeInstanceOf(CaseViewModel);
22
37
  expect(caseDetail).toBeInstanceOf(DetailModel);
23
38
 
@@ -25,13 +40,35 @@ describe("caseViewModel", () => {
25
40
  expect(caseDetail.id).toBe(24);
26
41
 
27
42
  expect(caseDetail.casename.value).toBe("The safety of objects");
43
+
44
+ expect(caseDetail.hasTaskGroups()).toBe(false);
45
+ });
46
+
47
+ it("should be able to handle local taskgroup", () => {
48
+ const caseDetail = new CaseViewModel({
49
+ key: "Book",
50
+ data: caseviewLocalTaskgroupJson,
51
+ contributions: caseviewContributionsJson,
52
+ });
53
+
54
+ expect(caseDetail.hasTaskGroups()).toBe(true);
55
+ expect(caseDetail.taskGroupCollection).toHaveLength(1);
28
56
  });
29
57
 
30
58
  it("should be able to handle different kind of introtext", () => {
31
59
  const caseviewOldStructure = new CaseViewModel({
32
60
  key: "Book",
33
61
  data: caseviewJson,
34
- contributions: caseviewContributionsJson,
62
+ contributions: {
63
+ ...caseviewContributionsJson,
64
+ text: undefined,
65
+ texts: [
66
+ {
67
+ type: "master",
68
+ text: "<p>This is introtext</p>",
69
+ },
70
+ ],
71
+ },
35
72
  });
36
73
 
37
74
  expect(caseviewOldStructure.introtext).toBe("<p>This is introtext</p>");
@@ -39,7 +76,7 @@ describe("caseViewModel", () => {
39
76
  const caseviewFromDataPlain = new CaseViewModel({
40
77
  key: "Book",
41
78
  data: {
42
- _text: "<p>This is introtext</p>",
79
+ _content: { text: { message: "<p>This is introtext</p>" } },
43
80
  ...caseviewJson,
44
81
  },
45
82
  contributions: caseviewContributionsJson,
@@ -51,8 +88,10 @@ describe("caseViewModel", () => {
51
88
  key: "Book",
52
89
  data: {
53
90
  ...caseviewJson,
54
- _text: {
55
- message: "<p>This is introtext</p>",
91
+ _content: {
92
+ text: {
93
+ message: "<p>This is introtext</p>",
94
+ },
56
95
  },
57
96
  },
58
97
  contributions: caseviewContributionsJson,
@@ -4,10 +4,13 @@
4
4
  "href": "/books/book/24"
5
5
  },
6
6
  "api_doc": {
7
- "href": "/api-docs/books/book/24"
7
+ "href": "/api-docs/v3/books/book/(case-id)"
8
8
  },
9
9
  "contributions": {
10
- "href": "/contributions/books/book/24"
10
+ "href": "/contributions/books/book/(case-id)"
11
+ },
12
+ "Details": {
13
+ "href": "/books/book/24/details"
11
14
  },
12
15
  "Creator": {
13
16
  "href": "/books/book/24/creator"
@@ -19,6 +22,14 @@
19
22
  "href": "/books/book/24/activities"
20
23
  },
21
24
  "taskgroup": [
25
+ {
26
+ "href": "/books/book/24/contributors-tasks",
27
+ "name": "Contributors"
28
+ },
29
+ {
30
+ "href": "/books/book/24/delivery-tasks",
31
+ "name": "Delivery"
32
+ },
22
33
  {
23
34
  "href": "/books/book/24/Tasks",
24
35
  "name": "Tasks"
@@ -35,4 +46,4 @@
35
46
  "Language": "EN",
36
47
  "NumberOfPages": 176,
37
48
  "State": "Registered"
38
- }
49
+ }
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "label": "Book",
3
3
  "resourcetype": "CaseView",
4
- "texts": [
5
- {
6
- "type": "master",
7
- "text": "<p>This is introtext</p>"
8
- }
9
- ],
4
+ "text": {
5
+ "id": "Book_master",
6
+ "message": "<p>This is introtext</p>"
7
+ },
10
8
  "_links": {
11
9
  "panel": [
10
+ {
11
+ "name": "Details",
12
+ "label": "Details",
13
+ "resourcetype": "CasePropertiesPanel"
14
+ },
12
15
  {
13
16
  "name": "Creator",
14
17
  "label": "Creator",
@@ -27,12 +30,35 @@
27
30
  ],
28
31
  "taskgroup": [
29
32
  {
30
- "name": "Tasks",
31
- "label": "Tasks",
33
+ "name": "Contributors",
34
+ "label": "Contributors",
35
+ "resourcetype": "TaskGroup"
36
+ },
37
+ {
38
+ "name": "Delivery",
39
+ "label": "Delivery",
40
+ "resourcetype": "TaskGroup"
41
+ },
42
+ {
43
+ "name": "Book",
44
+ "label": "Book",
32
45
  "resourcetype": "TaskGroup"
33
46
  }
34
47
  ]
35
48
  },
49
+ "taskgroups": [
50
+ {
51
+ "name": "Book",
52
+ "label": "Book",
53
+ "actions": [
54
+ {
55
+ "name": "delete-book",
56
+ "label": "Delete book",
57
+ "type": "form"
58
+ }
59
+ ]
60
+ }
61
+ ],
36
62
  "metadata": {
37
63
  "_id": {
38
64
  "label": "Id",
@@ -42,44 +68,25 @@
42
68
  "attributes": [
43
69
  {
44
70
  "CaseName": {
45
- "label": "Case name",
46
- "type": "string",
47
- "layouthint": ["title"]
48
- }
49
- },
50
- {
51
- "CaseType": {
52
- "label": "Case type",
53
- "type": "string",
54
- "layouthint": ["type"]
55
- }
56
- },
57
- {
58
- "Owner": {
59
- "label": "Case owner",
60
- "type": "string",
61
- "layouthint": ["owner"]
62
- }
63
- },
64
- {
65
- "State": {
66
- "label": "State",
67
71
  "type": "string",
68
- "layouthint": ["state"],
69
- "options": [
70
- {
71
- "code": "Registered",
72
- "label": "Registered"
73
- }
74
- ]
72
+ "label": "Dossiernaam",
73
+ "layouthint": [
74
+ "title"
75
+ ],
76
+ "displaysize": 50,
77
+ "maxLength": 255
75
78
  }
76
79
  },
77
80
  {
78
81
  "Format": {
79
- "label": "Format",
80
82
  "type": "string",
83
+ "label": "Format",
84
+ "optionMode": "static",
81
85
  "multiplechoice": false,
82
- "layouthint": ["combobox"],
86
+ "layouthint": [
87
+ "combobox"
88
+ ],
89
+ "enumerated": true,
83
90
  "options": [
84
91
  {
85
92
  "code": "Hardcover",
@@ -102,46 +109,10 @@
102
109
  },
103
110
  {
104
111
  "ISBN10": {
105
- "label": "ISBN10",
106
- "type": "string",
107
- "displaysize": 50
108
- }
109
- },
110
- {
111
- "ISBN13": {
112
- "label": "ISBN13",
113
112
  "type": "string",
113
+ "label": "ISBN10",
114
114
  "displaysize": 50
115
115
  }
116
- },
117
- {
118
- "Language": {
119
- "label": "Language",
120
- "type": "string",
121
- "multiplechoice": false,
122
- "layouthint": ["radiobutton"],
123
- "options": [
124
- {
125
- "code": "EN",
126
- "label": "English"
127
- },
128
- {
129
- "code": "DU",
130
- "label": "Dutch"
131
- }
132
- ]
133
- }
134
- },
135
- {
136
- "NumberOfPages": {
137
- "label": "Number of pages",
138
- "type": "number",
139
- "format": "0",
140
- "groupingSeparator": ".",
141
- "decimalSeparator": ",",
142
- "minimum": 1,
143
- "maximum": 1000
144
- }
145
116
  }
146
117
  ]
147
- }
118
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "_links": {
3
+ "self": {
4
+ "href": "/books/book/24"
5
+ },
6
+ "api_doc": {
7
+ "href": "/api-docs/v3/books/book/(case-id)"
8
+ },
9
+ "contributions": {
10
+ "href": "/contributions/books/book/(case-id)"
11
+ },
12
+ "Details": {
13
+ "href": "/books/book/24/details"
14
+ },
15
+ "Creator": {
16
+ "href": "/books/book/24/creator"
17
+ },
18
+ "Editions": {
19
+ "href": "/books/book/24/editions"
20
+ },
21
+ "Activities": {
22
+ "href": "/books/book/24/activities"
23
+ },
24
+ "taskgroup": [
25
+ {
26
+ "href": "/books/book/24/contributors-tasks",
27
+ "name": "Contributors"
28
+ },
29
+ {
30
+ "href": "/books/book/24/delivery-tasks",
31
+ "name": "Delivery"
32
+ }
33
+ ]
34
+ },
35
+ "taskgroups": [
36
+ {
37
+ "name": "Book",
38
+ "actions": [
39
+ {
40
+ "name": "delete-book",
41
+ "method": "POST",
42
+ "href": "/books/book/24/delete-book"
43
+ }
44
+ ]
45
+ }
46
+ ],
47
+ "_id": 24,
48
+ "CaseName": "The safety of objects",
49
+ "CaseType": "Book",
50
+ "Owner": "Arnold",
51
+ "Format": "Paperback",
52
+ "ISBN10": "1847087302",
53
+ "ISBN13": "9781847087300",
54
+ "Language": "EN",
55
+ "NumberOfPages": 176,
56
+ "State": "Registered"
57
+ }
@@ -598,6 +598,12 @@ class FormModel extends ResourceModel {
598
598
  return this._redirectLocation || this.successRedirect;
599
599
  }
600
600
 
601
+ /**
602
+ */
603
+ getSuccessData(): Object {
604
+ return this.data.success?.data;
605
+ }
606
+
601
607
  /**
602
608
  * Href handling
603
609
  */
@@ -664,15 +670,26 @@ class FormModel extends ResourceModel {
664
670
  * Handle form tokens to indicate concurrent form use
665
671
  */
666
672
  get tokens(): Array<string> {
667
- return this._tokens ?? this.data.tokens ?? [];
673
+ if (!this._tokens) {
674
+ this._tokens = this.data.tokens ?? [];
675
+ }
676
+ return this._tokens;
668
677
  }
669
678
 
670
679
  /**
680
+ * Replaces all tokens with the given collection of tokens
671
681
  */
672
682
  set tokens(tokens: Array<string>) {
673
683
  this._tokens = tokens;
674
684
  }
675
685
 
686
+ /**
687
+ * Removes all tokens from the form
688
+ */
689
+ removeTokens() {
690
+ this._tokens = [];
691
+ }
692
+
676
693
  /**
677
694
  * Keep track of changed form
678
695
  */
@@ -296,16 +296,14 @@ export default class FormObjectModel extends BaseModel {
296
296
  */
297
297
  get introText(): string {
298
298
  if (this.data.content?.text) {
299
- return this.data.content.text.message ?? this.data.content.text;
299
+ return this.data.content.text.message;
300
300
  }
301
301
 
302
302
  if (this.contributions.text?.message) {
303
303
  return this.contributions.text.message;
304
304
  }
305
305
 
306
- return (
307
- this.contributions.introText?.message ?? this.contributions.introText
308
- );
306
+ return this.contributions.introText;
309
307
  }
310
308
 
311
309
  /**
@@ -73,6 +73,21 @@ describe("formModel getters", () => {
73
73
 
74
74
  form.tokens = ["Token"];
75
75
  expect(form.tokens).toHaveLength(1);
76
+
77
+ const formJSON = {
78
+ formresponse: {
79
+ tokens: ["form-token"],
80
+ },
81
+ };
82
+
83
+ const formData = ModularUIResponse.create({
84
+ data: formJSON,
85
+ contributions: FormContributionsJSON,
86
+ });
87
+ const formWithToken = new FormModel(formData);
88
+ expect(formWithToken.tokens).toStrictEqual(["form-token"]);
89
+ formWithToken.removeTokens();
90
+ expect(formWithToken.tokens).toHaveLength(0);
76
91
  });
77
92
 
78
93
  it("can handle last modification", () => {
@@ -19,7 +19,7 @@ const data = {
19
19
  const contributions = {
20
20
  repeatable: false,
21
21
  label: "Create person",
22
- introText: { id: "IntroTextID", message: "This is introtext" },
22
+ text: { id: "IntroTextID", message: "This is introtext" },
23
23
  attributes: [
24
24
  {
25
25
  Name: {
@@ -122,13 +122,15 @@ describe("formObjectModel", () => {
122
122
  const contributions2 = {
123
123
  repeatable: false,
124
124
  label: "Create person",
125
- introText: { id: "IntroTextID", message: "This is new introtext" },
126
125
  attributes: [],
127
126
  };
128
127
 
129
128
  const data2 = {};
130
129
 
131
- const formObject = new FormObjectModel(data2, contributions2);
130
+ const formObject = new FormObjectModel(data2, {
131
+ ...contributions2,
132
+ text: { id: "IntroTextID", message: "This is new introtext" },
133
+ });
132
134
  expect(formObject.introText).toBe("This is new introtext");
133
135
 
134
136
  const formObject2 = new FormObjectModel(data2, {
@@ -151,4 +153,28 @@ describe("formObjectModel", () => {
151
153
  const formObject = new FormObjectModel(data2, contributions2);
152
154
  expect(formObject.introText).toBe("This is new text");
153
155
  });
156
+
157
+ it("can handle new text in data", () => {
158
+ const contributions2 = {
159
+ repeatable: false,
160
+ label: "Create person",
161
+ text: { id: "IntroTextID", message: "This is new text ${USER.ID}" },
162
+ attributes: [],
163
+ };
164
+
165
+ const data2 = {
166
+ content: {
167
+ text: {
168
+ id: "IntroTextID",
169
+ message: "This is new text 1",
170
+ properties: {
171
+ "USER.ID": "1",
172
+ },
173
+ },
174
+ },
175
+ };
176
+
177
+ const formObject = new FormObjectModel(data2, contributions2);
178
+ expect(formObject.introText).toBe("This is new text 1");
179
+ });
154
180
  });
@@ -137,8 +137,8 @@ export default class ListDetailModel extends DetailModel {
137
137
  * Getting the introduction text configured on the case view
138
138
  */
139
139
  get introtext(): string {
140
- if (this.data._text) {
141
- return this.data._text.message ?? this.data._text;
140
+ if (this.data._content) {
141
+ return this.data._content.text.message;
142
142
  }
143
143
 
144
144
  if (this.contributions.text) {