@beinformed/ui 1.9.0-beta.9 → 1.9.3

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 (130) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/esm/hooks/useForm.js.map +1 -1
  3. package/esm/hooks/useNotification.js.map +1 -1
  4. package/esm/hooks/useRouter.js.map +1 -1
  5. package/esm/models/attributes/AttributeContent.js +49 -20
  6. package/esm/models/attributes/AttributeContent.js.map +1 -1
  7. package/esm/models/attributes/AttributeDataHelper.js +1 -1
  8. package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
  9. package/esm/models/attributes/HelptextAttributeModel.js +3 -1
  10. package/esm/models/attributes/HelptextAttributeModel.js.map +1 -1
  11. package/esm/models/caseview/CaseViewModel.js +26 -12
  12. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  13. package/esm/models/contentconfiguration/ContentConfigurationResults.js +2 -2
  14. package/esm/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  15. package/esm/models/form/FormObjectModel.js +8 -2
  16. package/esm/models/form/FormObjectModel.js.map +1 -1
  17. package/esm/models/layouthint/LayoutHintCollection.js +3 -2
  18. package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
  19. package/esm/models/list/ListDetailModel.js +25 -0
  20. package/esm/models/list/ListDetailModel.js.map +1 -1
  21. package/esm/models/list/ListModel.js +22 -16
  22. package/esm/models/list/ListModel.js.map +1 -1
  23. package/esm/models/panels/GroupingPanelModel.js +19 -17
  24. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  25. package/esm/modularui/ModularUIRequest.js +2 -1
  26. package/esm/modularui/ModularUIRequest.js.map +1 -1
  27. package/esm/redux/actions/FormAutosave.js +2 -1
  28. package/esm/redux/actions/FormAutosave.js.map +1 -1
  29. package/esm/redux/actions/FormValidations.js +2 -1
  30. package/esm/redux/actions/FormValidations.js.map +1 -1
  31. package/lib/hooks/useForm.js.flow +10 -5
  32. package/lib/hooks/useForm.js.map +1 -1
  33. package/lib/hooks/useNotification.js.flow +5 -2
  34. package/lib/hooks/useNotification.js.map +1 -1
  35. package/lib/hooks/useRouter.js.flow +12 -5
  36. package/lib/hooks/useRouter.js.map +1 -1
  37. package/lib/models/attributes/AttributeContent.js +51 -20
  38. package/lib/models/attributes/AttributeContent.js.flow +38 -13
  39. package/lib/models/attributes/AttributeContent.js.map +1 -1
  40. package/lib/models/attributes/AttributeDataHelper.js +1 -1
  41. package/lib/models/attributes/AttributeDataHelper.js.flow +2 -1
  42. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  43. package/lib/models/attributes/HelptextAttributeModel.js +3 -1
  44. package/lib/models/attributes/HelptextAttributeModel.js.flow +1 -1
  45. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  46. package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +4 -2
  47. package/lib/models/attributes/__tests__/AttributeDataHelper.spec.js.flow +9 -3
  48. package/lib/models/attributes/__tests__/HelptextAttributeModel.spec.js.flow +1 -1
  49. package/lib/models/caseview/CaseViewModel.js +27 -13
  50. package/lib/models/caseview/CaseViewModel.js.flow +17 -7
  51. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  52. package/lib/models/caseview/__tests__/CaseViewModel.spec.js.flow +68 -184
  53. package/lib/models/concepts/__mock__/business_scenario.js.flow +14 -1
  54. package/lib/models/concepts/__mock__/conceptdetail.js.flow +15 -6
  55. package/lib/models/concepts/__tests__/BusinessScenarioModel.spec.js.flow +5 -6
  56. package/lib/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +58 -3
  57. package/lib/models/contentconfiguration/ContentConfigurationResults.js +2 -2
  58. package/lib/models/contentconfiguration/ContentConfigurationResults.js.flow +2 -2
  59. package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  60. package/lib/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js.flow +6 -6
  61. package/lib/models/form/FormObjectModel.js +8 -2
  62. package/lib/models/form/FormObjectModel.js.flow +5 -1
  63. package/lib/models/form/FormObjectModel.js.map +1 -1
  64. package/lib/models/form/__tests__/FormObjectModel.spec.js.flow +2 -2
  65. package/lib/models/layouthint/LayoutHintCollection.js +4 -2
  66. package/lib/models/layouthint/LayoutHintCollection.js.flow +8 -7
  67. package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
  68. package/lib/models/list/ListDetailModel.js +25 -0
  69. package/lib/models/list/ListDetailModel.js.flow +19 -0
  70. package/lib/models/list/ListDetailModel.js.map +1 -1
  71. package/lib/models/list/ListModel.js +23 -16
  72. package/lib/models/list/ListModel.js.flow +9 -5
  73. package/lib/models/list/ListModel.js.map +1 -1
  74. package/lib/models/list/__tests__/ListDetailModel.spec.js.flow +64 -0
  75. package/lib/models/list/__tests__/ListModel.spec.js.flow +64 -2
  76. package/lib/models/panels/GroupingPanelModel.js +21 -18
  77. package/lib/models/panels/GroupingPanelModel.js.flow +10 -9
  78. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  79. package/lib/models/panels/__tests__/GroupingPanelModel.spec.js.flow +90 -0
  80. package/lib/models/types.js.flow +24 -6
  81. package/lib/modularui/ModularUIRequest.js +2 -1
  82. package/lib/modularui/ModularUIRequest.js.flow +1 -0
  83. package/lib/modularui/ModularUIRequest.js.map +1 -1
  84. package/lib/redux/actions/FormAutosave.js +2 -1
  85. package/lib/redux/actions/FormAutosave.js.flow +1 -0
  86. package/lib/redux/actions/FormAutosave.js.map +1 -1
  87. package/lib/redux/actions/FormValidations.js +2 -1
  88. package/lib/redux/actions/FormValidations.js.flow +1 -0
  89. package/lib/redux/actions/FormValidations.js.map +1 -1
  90. package/package.json +15 -15
  91. package/src/hooks/useForm.js +10 -5
  92. package/src/hooks/useNotification.js +5 -2
  93. package/src/hooks/useRouter.js +12 -5
  94. package/src/models/attributes/AttributeContent.js +38 -13
  95. package/src/models/attributes/AttributeDataHelper.js +2 -1
  96. package/src/models/attributes/HelptextAttributeModel.js +1 -1
  97. package/src/models/attributes/__tests__/AttributeContent.spec.js +4 -2
  98. package/src/models/attributes/__tests__/AttributeDataHelper.spec.js +9 -3
  99. package/src/models/attributes/__tests__/HelptextAttributeModel.spec.js +1 -1
  100. package/src/models/caseview/CaseViewModel.js +17 -7
  101. package/src/models/caseview/__tests__/CaseViewModel.spec.js +68 -184
  102. package/src/models/caseview/__tests__/caseview.json +38 -0
  103. package/src/models/caseview/__tests__/caseviewContributions.json +147 -0
  104. package/src/models/concepts/__mock__/business_scenario.js +14 -1
  105. package/src/models/concepts/__mock__/business_scenario_step.json +64 -0
  106. package/src/models/concepts/__mock__/conceptdetail.js +15 -6
  107. package/src/models/concepts/__mock__/conceptdetail_data.json +117 -17
  108. package/src/models/concepts/__mock__/concepttype_Calculation.json +75 -0
  109. package/src/models/concepts/__tests__/BusinessScenarioModel.spec.js +5 -6
  110. package/src/models/concepts/__tests__/ConceptDetailModel.spec.js +58 -3
  111. package/src/models/contentconfiguration/ContentConfigurationResults.js +2 -2
  112. package/src/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js +6 -6
  113. package/src/models/form/FormObjectModel.js +5 -1
  114. package/src/models/form/__tests__/FormObjectModel.spec.js +2 -2
  115. package/src/models/form/__tests__/FormWithContentData.json +2 -1
  116. package/src/models/layouthint/LayoutHintCollection.js +8 -7
  117. package/src/models/list/ListDetailModel.js +19 -0
  118. package/src/models/list/ListModel.js +9 -5
  119. package/src/models/list/__tests__/ListDetailModel.spec.js +64 -0
  120. package/src/models/list/__tests__/ListModel.spec.js +64 -2
  121. package/src/models/list/__tests__/caselist-34.contributions.json +1 -1
  122. package/src/models/list/__tests__/listContributions.json +1 -1
  123. package/src/models/panels/GroupingPanelModel.js +10 -9
  124. package/src/models/panels/__tests__/GroupingPanelModel.spec.js +90 -0
  125. package/src/models/panels/__tests__/groupingPanel.json +30 -0
  126. package/src/models/panels/__tests__/groupingPanelContributions.json +46 -0
  127. package/src/models/types.js +24 -6
  128. package/src/modularui/ModularUIRequest.js +1 -0
  129. package/src/redux/actions/FormAutosave.js +1 -0
  130. package/src/redux/actions/FormValidations.js +1 -0
@@ -1,6 +1,9 @@
1
1
  import CaseViewModel from "../CaseViewModel";
2
2
  import DetailModel from "../../detail/DetailModel";
3
3
 
4
+ import caseviewJson from "./caseview.json";
5
+ import caseviewContributionsJson from "./caseviewContributions.json";
6
+
4
7
  describe("caseViewModel", () => {
5
8
  it("should be able to create an empty casedetail", () => {
6
9
  const caseview = new CaseViewModel({});
@@ -10,200 +13,81 @@ describe("caseViewModel", () => {
10
13
 
11
14
  it("should be able to create a casedetail from a typical modular UI json structure", () => {
12
15
  const caseDetail = new CaseViewModel({
16
+ key: "Book",
17
+ data: caseviewJson,
18
+ contributions: caseviewContributionsJson,
19
+ });
20
+
21
+ expect(caseDetail).toBeInstanceOf(CaseViewModel);
22
+ expect(caseDetail).toBeInstanceOf(DetailModel);
23
+
24
+ expect(caseDetail.key).toBe("Book");
25
+ expect(caseDetail.id).toBe(24);
26
+
27
+ expect(caseDetail.casename.value).toBe("The safety of objects");
28
+ });
29
+
30
+ it("should be able to handle different kind of introtext", () => {
31
+ const caseviewOldStructure = new CaseViewModel({
32
+ key: "Book",
33
+ data: caseviewJson,
34
+ contributions: caseviewContributionsJson,
35
+ });
36
+
37
+ expect(caseviewOldStructure.introtext).toBe("<p>This is introtext</p>");
38
+
39
+ const caseviewFromDataPlain = new CaseViewModel({
13
40
  key: "Book",
14
41
  data: {
15
- _links: {
16
- self: {
17
- href: "/books/book/24",
18
- },
19
- api_doc: {
20
- href: "/api-docs/books/book/24",
21
- },
22
- contributions: {
23
- href: "/contributions/books/book/24",
24
- },
25
- Creator: {
26
- href: "/books/book/24/creator",
27
- },
28
- Editions: {
29
- href: "/books/book/24/editions",
30
- },
31
- Activities: {
32
- href: "/books/book/24/activities",
33
- },
34
- taskgroup: [
35
- {
36
- href: "/books/book/24/Tasks",
37
- name: "Tasks",
38
- },
39
- ],
42
+ _text: "<p>This is introtext</p>",
43
+ ...caseviewJson,
44
+ },
45
+ contributions: caseviewContributionsJson,
46
+ });
47
+
48
+ expect(caseviewFromDataPlain.introtext).toBe("<p>This is introtext</p>");
49
+
50
+ const caseviewFromDataApplicationMessage = new CaseViewModel({
51
+ key: "Book",
52
+ data: {
53
+ ...caseviewJson,
54
+ _text: {
55
+ message: "<p>This is introtext</p>",
40
56
  },
41
- _id: 24,
42
- CaseName: "The safety of objects",
43
- CaseType: "Book",
44
- Owner: "Arnold",
45
- Format: "Paperback",
46
- ISBN10: "1847087302",
47
- ISBN13: "9781847087300",
48
- Language: "EN",
49
- NumberOfPages: 176,
50
- State: "Registered",
51
57
  },
58
+ contributions: caseviewContributionsJson,
59
+ });
60
+
61
+ expect(caseviewFromDataApplicationMessage.introtext).toBe(
62
+ "<p>This is introtext</p>"
63
+ );
64
+
65
+ const caseviewFromNewContributionsRawTextMessage = new CaseViewModel({
66
+ key: "Book",
67
+ data: caseviewJson,
52
68
  contributions: {
53
- label: "Book",
54
- resourcetype: "CaseView",
55
- texts: [
56
- {
57
- type: "master",
58
- text: "<p>This view contains all the data about this book. It contains a list of the creators and editions. A person can be an author(1) or an illustrator(2)<br /><br />This is a list of books that is ordered by the role (author (1), co-author, illustrator(2)) of the person that contributed to the book.<br /><br />1) An author is broadly defined as &quot;the person who originated or gave existence to anything&quot; and whose authorship determines responsibility for what was created. Narrowly defined, an author is the originator of any written work and can also be described as a writer.<br /><br />2) An illustrator is an artist who specializes in enhancing writing or elucidating concepts by providing a visual representation that corresponds to the content of the associated text or idea. The illustration may be intended to clarify complicated concepts or objects that are difficult to describe textually, which is the reason illustrations are often found in children&#39;s books.<br /></p>",
59
- },
60
- ],
61
- _links: {
62
- panel: [
63
- {
64
- name: "Creator",
65
- label: "Creator",
66
- resourcetype: "CaseRelationListPanel",
67
- },
68
- {
69
- name: "Editions",
70
- label: "Editions",
71
- resourcetype: "RecordListPanel",
72
- },
73
- {
74
- name: "Activities",
75
- label: "Activities",
76
- resourcetype: "GroupingPanel",
77
- },
78
- ],
79
- taskgroup: [
80
- {
81
- name: "Tasks",
82
- label: "Tasks",
83
- resourcetype: "TaskGroup",
84
- },
85
- ],
86
- },
87
- metadata: {
88
- _id: {
89
- label: "Id",
90
- type: "integer",
91
- },
69
+ ...caseviewContributionsJson,
70
+ text: {
71
+ message: "<p>This is introtext</p>",
92
72
  },
93
- attributes: [
94
- {
95
- CaseName: {
96
- label: "Case name",
97
- type: "string",
98
- layouthint: ["title"],
99
- },
100
- },
101
- {
102
- CaseType: {
103
- label: "Case type",
104
- type: "string",
105
- layouthint: ["type"],
106
- },
107
- },
108
- {
109
- Owner: {
110
- label: "Case owner",
111
- type: "string",
112
- layouthint: ["owner"],
113
- },
114
- },
115
- {
116
- State: {
117
- label: "State",
118
- type: "string",
119
- layouthint: ["state"],
120
- options: [
121
- {
122
- code: "Registered",
123
- label: "Registered",
124
- },
125
- ],
126
- },
127
- },
128
- {
129
- Format: {
130
- label: "Format",
131
- type: "string",
132
- multiplechoice: false,
133
- layouthint: ["combobox"],
134
- options: [
135
- {
136
- code: "Hardcover",
137
- label: "Hardcover",
138
- },
139
- {
140
- code: "Paperback",
141
- label: "Paperback",
142
- },
143
- {
144
- code: "Ebook",
145
- label: "Ebook",
146
- },
147
- {
148
- code: "Audio",
149
- label: "Audio book",
150
- },
151
- ],
152
- },
153
- },
154
- {
155
- ISBN10: {
156
- label: "ISBN10",
157
- type: "string",
158
- displaysize: 50,
159
- },
160
- },
161
- {
162
- ISBN13: {
163
- label: "ISBN13",
164
- type: "string",
165
- displaysize: 50,
166
- },
167
- },
168
- {
169
- Language: {
170
- label: "Language",
171
- type: "string",
172
- multiplechoice: false,
173
- layouthint: ["radiobutton"],
174
- options: [
175
- {
176
- code: "EN",
177
- label: "English",
178
- },
179
- {
180
- code: "DU",
181
- label: "Dutch",
182
- },
183
- ],
184
- },
185
- },
186
- {
187
- NumberOfPages: {
188
- label: "Number of pages",
189
- type: "number",
190
- format: "0",
191
- groupingSeparator: ".",
192
- decimalSeparator: ",",
193
- minimum: 1,
194
- maximum: 1000,
195
- },
196
- },
197
- ],
198
73
  },
199
74
  });
200
75
 
201
- expect(caseDetail).toBeInstanceOf(CaseViewModel);
202
- expect(caseDetail).toBeInstanceOf(DetailModel);
76
+ expect(caseviewFromNewContributionsRawTextMessage.introtext).toBe(
77
+ "<p>This is introtext</p>"
78
+ );
203
79
 
204
- expect(caseDetail.key).toBe("Book");
205
- expect(caseDetail.id).toBe(24);
80
+ const caseviewFromNewContributionsSimpleMessage = new CaseViewModel({
81
+ key: "Book",
82
+ data: caseviewJson,
83
+ contributions: {
84
+ ...caseviewContributionsJson,
85
+ text: "<p>This is introtext</p>",
86
+ },
87
+ });
206
88
 
207
- expect(caseDetail.casename.value).toBe("The safety of objects");
89
+ expect(caseviewFromNewContributionsSimpleMessage.introtext).toBe(
90
+ "<p>This is introtext</p>"
91
+ );
208
92
  });
209
93
  });
@@ -1,13 +1,26 @@
1
1
  import BusinessScenarioModel from "../BusinessScenarioModel";
2
2
  import ModularUIResponse from "../../../modularui/ModularUIResponse";
3
+ import ConceptDetailModel from "../ConceptDetailModel";
3
4
 
4
5
  import data from "./business_scenario_data.json";
5
6
  import contributions from "./conceptdetail_contributions.json";
6
7
 
8
+ import stepData from "./business_scenario_step.json";
9
+ import conceptType from "./concepttype";
10
+
7
11
  const response = ModularUIResponse.create({
8
12
  key: "business_scenario",
9
13
  data,
10
14
  contributions,
11
15
  });
16
+ const scenario = new BusinessScenarioModel(response);
17
+
18
+ const stepResponse = ModularUIResponse.create({
19
+ key: "business_scenario_step",
20
+ data: stepData,
21
+ contributions,
22
+ });
23
+ const step = new ConceptDetailModel(stepResponse);
24
+ step.conceptType = conceptType;
12
25
 
13
- export default new BusinessScenarioModel(response);
26
+ export { scenario, step };
@@ -1,18 +1,27 @@
1
1
  import ConceptDetailModel from "../ConceptDetailModel";
2
+ import ConceptTypeDetailModel from "../ConceptTypeDetailModel";
2
3
  import ModularUIResponse from "../../../modularui/ModularUIResponse";
3
4
 
4
5
  import data from "./conceptdetail_data.json";
5
6
  import contributions from "./conceptdetail_contributions.json";
7
+ import conceptTypeData from "./concepttype_Calculation.json";
8
+ import conceptTypeContributions from "./concepttype_contributions.json";
6
9
 
7
- import conceptType from "./concepttype";
8
-
9
- const response = ModularUIResponse.create({
10
- key: "conceptdetail",
10
+ const conceptResponse = ModularUIResponse.create({
11
+ key: "concept",
11
12
  data,
12
13
  contributions,
13
14
  });
14
15
 
15
- const conceptDetail = new ConceptDetailModel(response);
16
+ const conceptTypeResponse = ModularUIResponse.create({
17
+ key: "concepttype",
18
+ data: conceptTypeData,
19
+ contributions: conceptTypeContributions,
20
+ });
21
+
22
+ const conceptType = new ConceptTypeDetailModel(conceptTypeResponse);
23
+
24
+ const conceptDetail = new ConceptDetailModel(conceptResponse);
16
25
  conceptDetail.conceptType = conceptType;
17
26
 
18
- export default conceptDetail;
27
+ export { conceptDetail };
@@ -1,6 +1,5 @@
1
1
  import BusinessScenarioModel from "../BusinessScenarioModel";
2
- import businessScenario from "../__mock__/business_scenario";
3
- import conceptDetail from "../__mock__/conceptdetail";
2
+ import { scenario, step } from "../__mock__/business_scenario";
4
3
  import conceptType from "../__mock__/concepttype";
5
4
 
6
5
  describe("businessScenarioModel", () => {
@@ -12,16 +11,16 @@ describe("businessScenarioModel", () => {
12
11
  });
13
12
 
14
13
  it("can retrieve child model links", () => {
15
- const initialChildModelLinks = businessScenario.getInitialChildModelLinks();
14
+ const initialChildModelLinks = scenario.getInitialChildModelLinks();
16
15
 
17
16
  expect(initialChildModelLinks).toHaveLength(13);
18
17
  });
19
18
 
20
19
  it("can set scenarioSteps", () => {
21
- businessScenario.setChildModels([conceptType, conceptDetail]);
20
+ scenario.setChildModels([conceptType, step]);
22
21
 
23
- const scenarioSteps = businessScenario.scenarioSteps;
24
- const actors = businessScenario.actors;
22
+ const scenarioSteps = scenario.scenarioSteps;
23
+ const actors = scenario.actors;
25
24
 
26
25
  expect(scenarioSteps).toHaveLength(1);
27
26
  expect(actors).toHaveLength(1);
@@ -1,10 +1,65 @@
1
1
  import ConceptDetailModel from "../ConceptDetailModel";
2
2
 
3
- describe("conceptDetailModel", () => {
4
- it("should be able to create an empty ConceptDetailModel object", () => {
5
- const conceptDetail = new ConceptDetailModel();
3
+ import { conceptDetail } from "../__mock__/conceptdetail";
6
4
 
5
+ describe("conceptDetailModel", () => {
6
+ it("should be able to create a ConceptDetailModel object", () => {
7
7
  expect(conceptDetail).toBeInstanceOf(ConceptDetailModel);
8
8
  expect(conceptDetail.type).toBe("ConceptDetail");
9
+
10
+ expect(conceptDetail.key).toBe("DurationDrivingBan");
11
+ expect(conceptDetail.conceptType.label).toBe("Calculation");
12
+
13
+ expect(conceptDetail.label).toBe("Duration driving ban");
14
+ expect(conceptDetail.taxonomyType).toBe("default");
15
+
16
+ expect(conceptDetail.formula).toBe(
17
+ "IF (NoviceDriver) (NUMBER)DurationDrivingBanNoviceDriver ELSE IF\n(ExperiencedDriver) (NUMBER)DurationDrivingBanExperiencedDriver ENDIF ENDIF"
18
+ );
19
+ expect(conceptDetail.labels).toStrictEqual([
20
+ {
21
+ _id: "QuestionLabel",
22
+ label: "Question label",
23
+ },
24
+ {
25
+ _id: "ResultLabel",
26
+ label: "Result label",
27
+ type: "ResultLabel",
28
+ value: "Duration of driving ban (in months)",
29
+ },
30
+ ]);
31
+ expect(conceptDetail.conceptProperties).toStrictEqual([
32
+ {
33
+ _id: "PartnerService",
34
+ label: "Partner Service",
35
+ mandatory: "false",
36
+ type: "string",
37
+ },
38
+ {
39
+ _id: "Abbreviation",
40
+ label: "Abbreviation",
41
+ mandatory: "false",
42
+ type: "Abbreviation",
43
+ value: "DDB",
44
+ },
45
+ ]);
46
+ expect(conceptDetail.textfragments).toStrictEqual([
47
+ {
48
+ _id: "Description",
49
+ label: "Description",
50
+ id: "DurationDrivingBan.tv852.Description",
51
+ text: "Text fragment for duration driving ban",
52
+ type: "Description",
53
+ },
54
+ { _id: "Definition", label: "Definition" },
55
+ { _id: "IconSmall", label: "Icon-small" },
56
+ { _id: "IconMedium", label: "Icon-medium" },
57
+ { _id: "IconLarge", label: "Icon-large" },
58
+ { _id: "NonFunctionalRequirement", label: "Non functional requirement" },
59
+ { _id: "FunctionalRequirement", label: "Functional requirement" },
60
+ { _id: "Rationale", label: "Rationale" },
61
+ { _id: "tfNote", label: "NL TF NOTE" },
62
+ ]);
63
+ expect(conceptDetail.entryDate).toBe("2021-09-23");
9
64
  });
10
65
  });
@@ -66,8 +66,8 @@ var ContentConfigurationResults = /*#__PURE__*/function () {
66
66
 
67
67
  var description = this._configuration.description;
68
68
 
69
- if ((0, _utils.isPlainObject)(description) && "rawText" in description) {
70
- return description.rawText;
69
+ if ((0, _utils.isPlainObject)(description) && "message" in description) {
70
+ return description.message;
71
71
  }
72
72
 
73
73
  return description;
@@ -35,8 +35,8 @@ class ContentConfigurationResults {
35
35
  }
36
36
 
37
37
  const description = this._configuration.description;
38
- if (isPlainObject(description) && "rawText" in description) {
39
- return description.rawText;
38
+ if (isPlainObject(description) && "message" in description) {
39
+ return description.message;
40
40
  }
41
41
 
42
42
  return description;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/contentconfiguration/ContentConfigurationResults.js"],"names":["ContentConfigurationResults","configuration","_configuration","_layouthint","LayoutHintCollection","layouthint","label","description","rawText","attributes","all","hint","substring","length","elementKey","ContentConfigurationElements","configElement","getFormConfigElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;AACA;IACMA,2B;AAIJ;AACF;AACE,uCAAYC,aAAZ,EAAmC;AAAA;AAAA;AAAA;AACjC,SAAKC,cAAL,GAAsBD,aAAa,IAAI,IAAvC;AAEA,SAAKE,WAAL,GAAmB,IAAIC,6BAAJ,CAAyBH,aAAzB,aAAyBA,aAAzB,uBAAyBA,aAAa,CAAEI,UAAxC,CAAnB;AACD;AAED;AACF;;;;;SACE,eAA2B;AACzB,UAAI,KAAKH,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAP;AACD;;AAED,aAAO,KAAKA,cAAL,CAAoBI,KAA3B;AACD;AAED;AACF;;;;SACE,eAAiC;AAC/B,UAAI,KAAKJ,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAP;AACD;;AAED,UAAMK,WAAW,GAAG,KAAKL,cAAL,CAAoBK,WAAxC;;AACA,UAAI,0BAAcA,WAAd,KAA8B,aAAaA,WAA/C,EAA4D;AAC1D,eAAOA,WAAW,CAACC,OAAnB;AACD;;AAED,aAAOD,WAAP;AACD;AAED;AACF;;;;SACE,eAAgC;AAAA;;AAC9B,UAAI,KAAKL,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,EAAP;AACD,OAH6B,CAK9B;AACA;;;AACA,iGACK,KAAKA,cAAL,CAAoBO,UADzB,oCAEK,oEAAKJ,UAAL,CAAgBK,GAAhB,kBACO,UAACC,IAAD;AAAA,eAAU,uBAAAA,IAAI,MAAJ,CAAAA,IAAI,EAAU,YAAV,CAAd;AAAA,OADP,mBAEI,UAACA,IAAD;AAAA,eAAUA,IAAI,CAACC,SAAL,CAAe,aAAaC,MAA5B,CAAV;AAAA,OAFJ,CAFL;AAMD;AAED;AACF;;;;WACE,8BAAqBC,UAArB,EAAuE;AACrE,UAAI,KAAKZ,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAIa,qCAAJ,CAAiC,EAAjC,CAAP;AACD;;AAED,UAAMC,aAAa,GAAG,KAAKd,cAAL,CAAoBY,UAApB,CAAtB;AAEA,aAAO,IAAIC,qCAAJ,CAAiCC,aAAjC,CAAP;AACD;AAED;AACF;;;;SACE,eAA6D;AAC3D,aAAO,KAAKC,oBAAL,CAA0B,0BAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAA2D;AACzD,aAAO,KAAKA,oBAAL,CAA0B,wBAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAA2D;AACzD,aAAO,KAAKA,oBAAL,CAA0B,wBAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAAmD;AACjD,aAAO,KAAKA,oBAAL,CAA0B,gBAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAAuC;AACrC,aAAO,KAAKd,WAAZ;AACD;;;;;eAGYH,2B","sourcesContent":["// @flow\nimport ContentConfigurationElements from \"./ContentConfigurationElements\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\n/**\n */\nclass ContentConfigurationResults {\n _configuration: Object;\n _layouthint: LayoutHintCollection;\n\n /**\n */\n constructor(configuration: Object) {\n this._configuration = configuration || null;\n\n this._layouthint = new LayoutHintCollection(configuration?.layouthint);\n }\n\n /**\n */\n get label(): string | null {\n if (this._configuration === null) {\n return null;\n }\n\n return this._configuration.label;\n }\n\n /**\n */\n get description(): string | null {\n if (this._configuration === null) {\n return null;\n }\n\n const description = this._configuration.description;\n if (isPlainObject(description) && \"rawText\" in description) {\n return description.rawText;\n }\n\n return description;\n }\n\n /**\n */\n get attributes(): Array<string> {\n if (this._configuration === null) {\n return [];\n }\n\n // An issue with mapped attributes is giving us the wrong attribute keys in the attributes property\n // as a temporary fix a layouthint with the correct mapped attribute key can be set in the configuration of the end results\n return [\n ...this._configuration.attributes,\n ...this.layouthint.all\n .filter((hint) => hint.includes(\"attribute:\"))\n .map((hint) => hint.substring(\"attribute:\".length)),\n ];\n }\n\n /**\n */\n getFormConfigElement(elementKey: string): ContentConfigurationElements {\n if (this._configuration === null) {\n return new ContentConfigurationElements([]);\n }\n\n const configElement = this._configuration[elementKey];\n\n return new ContentConfigurationElements(configElement);\n }\n\n /**\n */\n get calculatedResultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"calculatedResultElements\");\n }\n\n /**\n */\n get positiveResultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"positiveResultElements\");\n }\n\n /**\n */\n get negativeResultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"negativeResultElements\");\n }\n\n /**\n */\n get resultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"resultElements\");\n }\n\n /**\n */\n get layouthint(): LayoutHintCollection {\n return this._layouthint;\n }\n}\n\nexport default ContentConfigurationResults;\n"],"file":"ContentConfigurationResults.js"}
1
+ {"version":3,"sources":["../../../src/models/contentconfiguration/ContentConfigurationResults.js"],"names":["ContentConfigurationResults","configuration","_configuration","_layouthint","LayoutHintCollection","layouthint","label","description","message","attributes","all","hint","substring","length","elementKey","ContentConfigurationElements","configElement","getFormConfigElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;AACA;IACMA,2B;AAIJ;AACF;AACE,uCAAYC,aAAZ,EAAmC;AAAA;AAAA;AAAA;AACjC,SAAKC,cAAL,GAAsBD,aAAa,IAAI,IAAvC;AAEA,SAAKE,WAAL,GAAmB,IAAIC,6BAAJ,CAAyBH,aAAzB,aAAyBA,aAAzB,uBAAyBA,aAAa,CAAEI,UAAxC,CAAnB;AACD;AAED;AACF;;;;;SACE,eAA2B;AACzB,UAAI,KAAKH,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAP;AACD;;AAED,aAAO,KAAKA,cAAL,CAAoBI,KAA3B;AACD;AAED;AACF;;;;SACE,eAAiC;AAC/B,UAAI,KAAKJ,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAP;AACD;;AAED,UAAMK,WAAW,GAAG,KAAKL,cAAL,CAAoBK,WAAxC;;AACA,UAAI,0BAAcA,WAAd,KAA8B,aAAaA,WAA/C,EAA4D;AAC1D,eAAOA,WAAW,CAACC,OAAnB;AACD;;AAED,aAAOD,WAAP;AACD;AAED;AACF;;;;SACE,eAAgC;AAAA;;AAC9B,UAAI,KAAKL,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,EAAP;AACD,OAH6B,CAK9B;AACA;;;AACA,iGACK,KAAKA,cAAL,CAAoBO,UADzB,oCAEK,oEAAKJ,UAAL,CAAgBK,GAAhB,kBACO,UAACC,IAAD;AAAA,eAAU,uBAAAA,IAAI,MAAJ,CAAAA,IAAI,EAAU,YAAV,CAAd;AAAA,OADP,mBAEI,UAACA,IAAD;AAAA,eAAUA,IAAI,CAACC,SAAL,CAAe,aAAaC,MAA5B,CAAV;AAAA,OAFJ,CAFL;AAMD;AAED;AACF;;;;WACE,8BAAqBC,UAArB,EAAuE;AACrE,UAAI,KAAKZ,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAIa,qCAAJ,CAAiC,EAAjC,CAAP;AACD;;AAED,UAAMC,aAAa,GAAG,KAAKd,cAAL,CAAoBY,UAApB,CAAtB;AAEA,aAAO,IAAIC,qCAAJ,CAAiCC,aAAjC,CAAP;AACD;AAED;AACF;;;;SACE,eAA6D;AAC3D,aAAO,KAAKC,oBAAL,CAA0B,0BAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAA2D;AACzD,aAAO,KAAKA,oBAAL,CAA0B,wBAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAA2D;AACzD,aAAO,KAAKA,oBAAL,CAA0B,wBAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAAmD;AACjD,aAAO,KAAKA,oBAAL,CAA0B,gBAA1B,CAAP;AACD;AAED;AACF;;;;SACE,eAAuC;AACrC,aAAO,KAAKd,WAAZ;AACD;;;;;eAGYH,2B","sourcesContent":["// @flow\nimport ContentConfigurationElements from \"./ContentConfigurationElements\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\n/**\n */\nclass ContentConfigurationResults {\n _configuration: Object;\n _layouthint: LayoutHintCollection;\n\n /**\n */\n constructor(configuration: Object) {\n this._configuration = configuration || null;\n\n this._layouthint = new LayoutHintCollection(configuration?.layouthint);\n }\n\n /**\n */\n get label(): string | null {\n if (this._configuration === null) {\n return null;\n }\n\n return this._configuration.label;\n }\n\n /**\n */\n get description(): string | null {\n if (this._configuration === null) {\n return null;\n }\n\n const description = this._configuration.description;\n if (isPlainObject(description) && \"message\" in description) {\n return description.message;\n }\n\n return description;\n }\n\n /**\n */\n get attributes(): Array<string> {\n if (this._configuration === null) {\n return [];\n }\n\n // An issue with mapped attributes is giving us the wrong attribute keys in the attributes property\n // as a temporary fix a layouthint with the correct mapped attribute key can be set in the configuration of the end results\n return [\n ...this._configuration.attributes,\n ...this.layouthint.all\n .filter((hint) => hint.includes(\"attribute:\"))\n .map((hint) => hint.substring(\"attribute:\".length)),\n ];\n }\n\n /**\n */\n getFormConfigElement(elementKey: string): ContentConfigurationElements {\n if (this._configuration === null) {\n return new ContentConfigurationElements([]);\n }\n\n const configElement = this._configuration[elementKey];\n\n return new ContentConfigurationElements(configElement);\n }\n\n /**\n */\n get calculatedResultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"calculatedResultElements\");\n }\n\n /**\n */\n get positiveResultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"positiveResultElements\");\n }\n\n /**\n */\n get negativeResultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"negativeResultElements\");\n }\n\n /**\n */\n get resultElements(): ContentConfigurationElements {\n return this.getFormConfigElement(\"resultElements\");\n }\n\n /**\n */\n get layouthint(): LayoutHintCollection {\n return this._layouthint;\n }\n}\n\nexport default ContentConfigurationResults;\n"],"file":"ContentConfigurationResults.js"}
@@ -33,14 +33,14 @@ describe("ContentConfigurationResults", () => {
33
33
  });
34
34
 
35
35
  it("can handle configuration with description object", () => {
36
- const rawText =
36
+ const message =
37
37
  "<p>The property value is ${EstimatedPropertyValue} and my personal deposit is ${MortgageDeposit}. The mortgage is a repayment mortgage for a term of ${MortgageTermInYears} years. The rate type is ${InterestRateType} for a period of ${PeriodOfInterestRate}.</p>";
38
38
 
39
39
  const contributions = {
40
40
  label: "Total cost of mortgage",
41
41
  description: {
42
42
  id: "CalculatorResults.TotalCostOfMortgage.introText",
43
- rawText,
43
+ message,
44
44
  },
45
45
  layouthint: ["render-description:TotalCostOfMortgage"],
46
46
  attributes: ["TotalCostOfMortgage"],
@@ -59,7 +59,7 @@ describe("ContentConfigurationResults", () => {
59
59
  );
60
60
 
61
61
  expect(contentConfigurationResults.label).toBe("Total cost of mortgage");
62
- expect(contentConfigurationResults.description).toBe(rawText);
62
+ expect(contentConfigurationResults.description).toBe(message);
63
63
  expect(contentConfigurationResults.attributes).toStrictEqual([
64
64
  "TotalCostOfMortgage",
65
65
  ]);
@@ -87,15 +87,15 @@ describe("ContentConfigurationResults", () => {
87
87
  });
88
88
 
89
89
  it("can handle configuration with description string", () => {
90
- const rawText =
90
+ const message =
91
91
  "<p>The property value is ${EstimatedPropertyValue} and my personal deposit is ${MortgageDeposit}. The mortgage is a repayment mortgage for a term of ${MortgageTermInYears} years. The rate type is ${InterestRateType} for a period of ${PeriodOfInterestRate}.</p>";
92
92
 
93
93
  const contentConfigurationResults = new ContentConfigurationResults({
94
94
  label: "Total cost of mortgage",
95
- description: rawText,
95
+ description: message,
96
96
  });
97
97
 
98
98
  expect(contentConfigurationResults.label).toBe("Total cost of mortgage");
99
- expect(contentConfigurationResults.description).toBe(rawText);
99
+ expect(contentConfigurationResults.description).toBe(message);
100
100
  });
101
101
  });
@@ -386,9 +386,15 @@ var FormObjectModel = /*#__PURE__*/function (_BaseModel) {
386
386
  }, {
387
387
  key: "introText",
388
388
  get: function get() {
389
- var _this$contributions$i, _this$contributions$i2;
389
+ var _this$data$content, _this$contributions$i, _this$contributions$i2;
390
390
 
391
- return (_this$contributions$i = (_this$contributions$i2 = this.contributions.introText) === null || _this$contributions$i2 === void 0 ? void 0 : _this$contributions$i2.rawText) !== null && _this$contributions$i !== void 0 ? _this$contributions$i : this.contributions.introText;
391
+ if ((_this$data$content = this.data.content) !== null && _this$data$content !== void 0 && _this$data$content.text) {
392
+ var _this$data$content$te;
393
+
394
+ return (_this$data$content$te = this.data.content.text.message) !== null && _this$data$content$te !== void 0 ? _this$data$content$te : this.data.content.text;
395
+ }
396
+
397
+ return (_this$contributions$i = (_this$contributions$i2 = this.contributions.introText) === null || _this$contributions$i2 === void 0 ? void 0 : _this$contributions$i2.message) !== null && _this$contributions$i !== void 0 ? _this$contributions$i : this.contributions.introText;
392
398
  }
393
399
  /**
394
400
  * Get assistent of form object
@@ -295,8 +295,12 @@ export default class FormObjectModel extends BaseModel {
295
295
  * Get introText of form object
296
296
  */
297
297
  get introText(): string {
298
+ if (this.data.content?.text) {
299
+ return this.data.content.text.message ?? this.data.content.text;
300
+ }
301
+
298
302
  return (
299
- this.contributions.introText?.rawText ?? this.contributions.introText
303
+ this.contributions.introText?.message ?? this.contributions.introText
300
304
  );
301
305
  }
302
306