@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
package/CHANGELOG.md CHANGED
@@ -2,6 +2,54 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.9.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.2...v1.9.3) (2021-09-27)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **validations:** send locale with validation request to retrieve errors in correct language ([48cb17f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/48cb17fbc8e95c4da9fb8eaa4dedd079e42f6e5a))
10
+
11
+ ### [1.9.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.1...v1.9.2) (2021-09-24)
12
+
13
+ ### Bug Fixes
14
+
15
+ - **caseview:** add viewLabel on case view model for configured label ([49cedf6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/49cedf69b8a2a443f55e972321127f35f97f4139))
16
+
17
+ ### [1.9.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0...v1.9.1) (2021-09-23)
18
+
19
+ ## [1.9.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.15...v1.9.0) (2021-09-23)
20
+
21
+ ## [1.9.0-beta.15](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.14...v1.9.0-beta.15) (2021-09-23)
22
+
23
+ ### Bug Fixes
24
+
25
+ - **messages:** rename rawText to message, update textfragment structure ([4b73c77](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/4b73c7772786458828073d0196f9d9d63cbcd332))
26
+
27
+ ## [1.9.0-beta.14](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.13...v1.9.0-beta.14) (2021-09-21)
28
+
29
+ ### Bug Fixes
30
+
31
+ - **form-content:** update structure of content in data ([044078f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/044078f5ced2c61c9fcba7fe585029a022e3f3dd))
32
+
33
+ ## [1.9.0-beta.13](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.12...v1.9.0-beta.13) (2021-09-21)
34
+
35
+ ### Bug Fixes
36
+
37
+ - **data-helper:** handle content on result elements ([13be04c](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/13be04ca46198ddec964401c5eda001111555260))
38
+
39
+ ## [1.9.0-beta.12](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.11...v1.9.0-beta.12) (2021-09-21)
40
+
41
+ ### Bug Fixes
42
+
43
+ - **attribute-content:** update structure of content ([d7496d2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/d7496d2862021d658a433fb5d016fc481acd5777))
44
+
45
+ ## [1.9.0-beta.11](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.10...v1.9.0-beta.11) (2021-09-20)
46
+
47
+ ### Bug Fixes
48
+
49
+ - **text:** update for new structure of introtext in contributions ([47bf99d](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/47bf99d4143678608b52f556be9158f6ced41807))
50
+
51
+ ## [1.9.0-beta.10](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.9...v1.9.0-beta.10) (2021-09-16)
52
+
5
53
  ## [1.9.0-beta.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.8...v1.9.0-beta.9) (2021-09-14)
6
54
 
7
55
  ### Bug Fixes
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","FormModel","useForm","href","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":"AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,IAAP,MAAiB,qBAAjB;AAEA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,cAAzC;AAEA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,qBAAhD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SACEC,yBADF,EAEEC,UAFF,EAGEC,4BAHF,EAIEC,cAJF,EAKEC,4BALF,EAMEC,oBANF,EAOEC,mBAPF,QAQO,kBARP;AAUA,OAAOC,SAAP,MAAsB,0BAAtB;;AAyBA;AACA;AACA;AACA,OAAO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAqC;AAC1D,MAAMC,QAAQ,GAAG,IAAIhB,IAAJ,CAASe,IAAT,CAAjB;;AAEA,MAAI,CAACd,UAAU,CAAC,oBAAD,CAAf,EAAuC;AACrCe,IAAAA,QAAQ,CAACC,YAAT,CAAsB,QAAtB,EAAgC,OAAhC;AACD;;AAED,MAAMC,IAAI,GAAGb,YAAY,CAAC,MAAD,EAASW,QAAT,EAAmB;AAC1CG,IAAAA,MAAM,EAAEjB,YAAY,CAACkB,IADqB;AAE1CC,IAAAA,WAAW,EAAER,SAF6B;AAG1CS,IAAAA,eAAe,EAAE;AAHyB,GAAnB,CAAzB;;AAMA,MAAIJ,IAAJ,aAAIA,IAAJ,eAAIA,IAAI,CAAEK,KAAV,EAAiB;AACf,WAAOL,IAAI,CAACK,KAAZ;AACD;AACF,CAhBM;AAkBP;AACA;AACA;;AACA,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,GAA0B;AACzD,MAAMC,QAAQ,GAAG1B,WAAW,EAA5B;;A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FK,EAGLC,OAHK;AAAA,WAIFf,QAAQ,CAACb,mBAAmB,CAACM,IAAD,EAAOmB,MAAP,EAAeC,SAAf,EAA0BC,KAA1B,EAAiCC,OAAjC,CAApB,CAJN;AAAA,GAAP;AAKD,CAXM;AAaP;AACA;AACA;;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACvB,IAAD,EAAuC;AACpE,MAAMO,QAAQ,GAAG1B,WAAW,EAA5B;AAEA,SAAO;AACL2C,IAAAA,IAAI,EAAE;AAAA,aAAMjB,QAAQ,CAACnB,yBAAyB,CAACY,IAAD,CAA1B,CAAd;AAAA,KADD;AAELS,IAAAA,MAAM,EAAE,gBAACU,MAAD;AAAA,aACNZ,QAAQ,CAACjB,4BAA4B,CAACU,IAAD,EAAOmB,MAAP,CAA7B,CADF;AAAA,KAFH;AAILH,IAAAA,MAAM,EAAE,gBAACG,MAAD;AAAA,aACNZ,QAAQ,CAACf,4BAA4B,CAACQ,IAAD,EAAOmB,MAAP,CAA7B,CADF;AAAA;AAJH,GAAP;AAOD,CAVM","sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel } from \"../models\";\nimport type { AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\ntype FormNavigationHook = {\n previous: (form: FormModel) => void,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => void,\n};\n\ntype AttributeSetHook = {\n save: () => void,\n cancel: (object: FormObjectModel) => void,\n remove: (object: FormObjectModel) => void,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"file":"useForm.js"}
1
+ {"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","FormModel","useForm","href","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":"AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,IAAP,MAAiB,qBAAjB;AAEA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,cAAzC;AAEA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,qBAAhD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SACEC,yBADF,EAEEC,UAFF,EAGEC,4BAHF,EAIEC,cAJF,EAKEC,4BALF,EAMEC,oBANF,EAOEC,mBAPF,QAQO,kBARP;AAUA,OAAOC,SAAP,MAAsB,0BAAtB;;AA8BA;AACA;AACA;AACA,OAAO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAqC;AAC1D,MAAMC,QAAQ,GAAG,IAAIhB,IAAJ,CAASe,IAAT,CAAjB;;AAEA,MAAI,CAACd,UAAU,CAAC,oBAAD,CAAf,EAAuC;AACrCe,IAAAA,QAAQ,CAACC,YAAT,CAAsB,QAAtB,EAAgC,OAAhC;AACD;;AAED,MAAMC,IAAI,GAAGb,YAAY,CAAC,MAAD,EAASW,QAAT,EAAmB;AAC1CG,IAAAA,MAAM,EAAEjB,YAAY,CAACkB,IADqB;AAE1CC,IAAAA,WAAW,EAAER,SAF6B;AAG1CS,IAAAA,eAAe,EAAE;AAHyB,GAAnB,CAAzB;;AAMA,MAAIJ,IAAJ,aAAIA,IAAJ,eAAIA,IAAI,CAAEK,KAAV,EAAiB;AACf,WAAOL,IAAI,CAACK,KAAZ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kB,GAAG,SAArBA,kBAAqB,CAChClB,IADgC,EAEhCmB,MAFgC,EAGR;AACxB,MAAMZ,QAAQ,GAAG1B,WAAW,EAA5B;AAEA,SAAO,UACLuC,SADK,EAELC,KAFK,EAGLC,OAHK;AAAA,WAIFf,QAAQ,CAACb,mBAAmB,CAACM,IAAD,EAAOmB,MAAP,EAAeC,SAAf,EAA0BC,KAA1B,EAAiCC,OAAjC,CAApB,CAJN;AAAA,GAAP;AAKD,CAXM;AAaP;AACA;AACA;;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACvB,IAAD,EAAuC;AACpE,MAAMO,QAAQ,GAAG1B,WAAW,EAA5B;AAEA,SAAO;AACL2C,IAAAA,IAAI,EAAE;AAAA,aAAMjB,QAAQ,CAACnB,yBAAyB,CAACY,IAAD,CAA1B,CAAd;AAAA,KADD;AAELS,IAAAA,MAAM,EAAE,gBAACU,MAAD;AAAA,aACNZ,QAAQ,CAACjB,4BAA4B,CAACU,IAAD,EAAOmB,MAAP,CAA7B,CADF;AAAA,KAFH;AAILH,IAAAA,MAAM,EAAE,gBAACG,MAAD;AAAA,aACNZ,QAAQ,CAACf,4BAA4B,CAACQ,IAAD,EAAOmB,MAAP,CAA7B,CADF;AAAA;AAJH,GAAP;AAOD,CAVM","sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel } from \"../models\";\nimport type { AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\nimport type {\n RemoveModelByKeyAction,\n UpdateModelAction,\n} from \"../redux/_modularui\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateModelAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateModelAction,\n cancel: (object: FormObjectModel) => UpdateModelAction,\n remove: (object: FormObjectModel) => UpdateModelAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"file":"useForm.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useNotification.js"],"names":["useSelector","useDispatch","dismissNotification","useNotification","dispatch","state","notification","render","messageType","message","error","dismiss"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,mBAAT,QAAoC,kBAApC;;AAQA;AACA;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;AACrD,MAAMC,QAAQ,GAAGH,WAAW,EAA5B;;AACA,qBAAgDD,WAAW,CACzD,UAACK,KAAD;AAAA,WAAWA,KAAK,CAACC,YAAjB;AAAA,GADyD,CAA3D;AAAA,MAAQC,MAAR,gBAAQA,MAAR;AAAA,MAAgBC,WAAhB,gBAAgBA,WAAhB;AAAA,MAA6BC,OAA7B,gBAA6BA,OAA7B;AAAA,MAAsCC,KAAtC,gBAAsCA,KAAtC;;AAIA,SAAO;AACLH,IAAAA,MAAM,EAANA,MADK;AAELC,IAAAA,WAAW,EAAXA,WAFK;AAGLC,IAAAA,OAAO,EAAPA,OAHK;AAILC,IAAAA,KAAK,EAALA,KAJK;AAKLC,IAAAA,OAAO,EAAE;AAAA,aAAMP,QAAQ,CAACF,mBAAmB,EAApB,CAAd;AAAA;AALJ,GAAP;AAOD,CAbM","sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification } from \"../redux/actions\";\n\nimport type { NotificationState } from \"../redux/types\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => void,\n};\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n"],"file":"useNotification.js"}
1
+ {"version":3,"sources":["../../src/hooks/useNotification.js"],"names":["useSelector","useDispatch","dismissNotification","useNotification","dispatch","state","notification","render","messageType","message","error","dismiss"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,mBAAT,QAAoC,kBAApC;;AAWA;AACA;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;AACrD,MAAMC,QAAQ,GAAGH,WAAW,EAA5B;;AACA,qBAAgDD,WAAW,CACzD,UAACK,KAAD;AAAA,WAAWA,KAAK,CAACC,YAAjB;AAAA,GADyD,CAA3D;AAAA,MAAQC,MAAR,gBAAQA,MAAR;AAAA,MAAgBC,WAAhB,gBAAgBA,WAAhB;AAAA,MAA6BC,OAA7B,gBAA6BA,OAA7B;AAAA,MAAsCC,KAAtC,gBAAsCA,KAAtC;;AAIA,SAAO;AACLH,IAAAA,MAAM,EAANA,MADK;AAELC,IAAAA,WAAW,EAAXA,WAFK;AAGLC,IAAAA,OAAO,EAAPA,OAHK;AAILC,IAAAA,KAAK,EAALA,KAJK;AAKLC,IAAAA,OAAO,EAAE;AAAA,aAAMP,QAAQ,CAACF,mBAAmB,EAApB,CAAd;AAAA;AALJ,GAAP;AAOD,CAbM","sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n} from \"../redux/types\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n"],"file":"useNotification.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useRouter.js"],"names":["useDispatch","useSelector","push","replace","go","goBack","goForward","useLocation","state","router","location","useLocationKey","key","useQuerystring","search","usePathname","pathname","useNavigation","dispatch","delta"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAGA,SAASC,IAAI,IAAJA,KAAT,EAAeC,OAAO,IAAPA,QAAf,EAAwBC,EAAE,IAAFA,GAAxB,EAA4BC,MAAM,IAANA,OAA5B,EAAoCC,SAAS,IAATA,UAApC,QAAqD,0BAArD;;AAcA;AACA;AACA,OAAO,IAAMC,WAA4B,GAAG,SAA/BA,WAA+B;AAAA,SAC1CN,WAAW,CAAC,UAACO,KAAD;AAAA,WAAWA,KAAK,CAACC,MAAN,CAAaC,QAAxB;AAAA,GAAD,CAD+B;AAAA,CAArC;AAGP;AACA;;AACA,OAAO,IAAMC,cAAkC,GAAG,SAArCA,cAAqC;AAAA;;AAAA,6CAChDJ,WAAW,EADqC,iDAChD,aAAeK,GADiC,+DAC1B,EAD0B;AAAA,CAA3C;AAGP;AACA;;AACA,OAAO,IAAMC,cAAkC,GAAG,SAArCA,cAAqC;AAAA;;AAAA,0BAAMN,WAAW,EAAjB,kDAAM,cAAeO,MAArB;AAAA,CAA3C;AAEP;AACA;;AACA,OAAO,IAAMC,WAA4B,GAAG,SAA/BA,WAA+B;AAAA;;AAAA,0BAAMR,WAAW,EAAjB,kDAAM,cAAeS,QAArB;AAAA,CAArC;AAEP;AACA;;AACA,OAAO,IAAMC,aAAgC,GAAG,SAAnCA,aAAmC,GAAM;AACpD,MAAMC,QAAQ,GAAGlB,WAAW,EAA5B;AAEA,SAAO;AACLE,IAAAA,IAAI,EAAE,cAACQ,QAAD,EAAmCF,KAAnC;AAAA,aACJU,QAAQ,CAAChB,KAAI,CAACQ,QAAD,EAAWF,KAAX,CAAL,CADJ;AAAA,KADD;AAGLL,IAAAA,OAAO,EAAE,iBAACO,QAAD,EAAmCF,KAAnC;AAAA,aACPU,QAAQ,CAACf,QAAO,CAACO,QAAD,EAAWF,KAAX,CAAR,CADD;AAAA,KAHJ;AAKLJ,IAAAA,EAAE,EAAE,YAACe,KAAD;AAAA,aAAmBD,QAAQ,CAACd,GAAE,CAACe,KAAD,CAAH,CAA3B;AAAA,KALC;AAMLd,IAAAA,MAAM,EAAE;AAAA,aAAMa,QAAQ,CAACb,OAAM,EAAP,CAAd;AAAA,KANH;AAOLC,IAAAA,SAAS,EAAE;AAAA,aAAMY,QAAQ,CAACZ,UAAS,EAAV,CAAd;AAAA;AAPN,GAAP;AASD,CAZM","sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport type { Location, LocationShape } from \"react-router\";\n\nimport { push, replace, go, goBack, goForward } from \"../redux/_router/actions\";\n\ntype UseLocationHook = () => Location;\ntype UseLocationKeyHook = () => string;\ntype UseQuerystringHook = () => string;\ntype UsePathnameHook = () => string;\ntype UseNavigationHook = () => {\n push: (location: LocationShape | string, state?: { ... }) => void,\n replace: (location: LocationShape | string, state?: { ... }) => void,\n go: (delta: number) => void,\n goBack: () => void,\n goForward: () => void,\n};\n\n/**\n */\nexport const useLocation: UseLocationHook = () =>\n useSelector((state) => state.router.location);\n\n/**\n */\nexport const useLocationKey: UseLocationKeyHook = () =>\n useLocation()?.key ?? \"\";\n\n/**\n */\nexport const useQuerystring: UseQuerystringHook = () => useLocation()?.search;\n\n/**\n */\nexport const usePathname: UsePathnameHook = () => useLocation()?.pathname;\n\n/**\n */\nexport const useNavigation: UseNavigationHook = () => {\n const dispatch = useDispatch();\n\n return {\n push: (location: LocationShape | string, state?: { ... }) =>\n dispatch(push(location, state)),\n replace: (location: LocationShape | string, state?: { ... }) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n"],"file":"useRouter.js"}
1
+ {"version":3,"sources":["../../src/hooks/useRouter.js"],"names":["useDispatch","useSelector","push","replace","go","goBack","goForward","useLocation","state","router","location","useLocationKey","key","useQuerystring","search","usePathname","pathname","useNavigation","dispatch","delta"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAGA,SAASC,IAAI,IAAJA,KAAT,EAAeC,OAAO,IAAPA,QAAf,EAAwBC,EAAE,IAAFA,GAAxB,EAA4BC,MAAM,IAANA,OAA5B,EAAoCC,SAAS,IAATA,UAApC,QAAqD,0BAArD;;AAqBA;AACA;AACA,OAAO,IAAMC,WAA4B,GAAG,SAA/BA,WAA+B;AAAA,SAC1CN,WAAW,CAAC,UAACO,KAAD;AAAA,WAAWA,KAAK,CAACC,MAAN,CAAaC,QAAxB;AAAA,GAAD,CAD+B;AAAA,CAArC;AAGP;AACA;;AACA,OAAO,IAAMC,cAAkC,GAAG,SAArCA,cAAqC;AAAA;;AAAA,6CAChDJ,WAAW,EADqC,iDAChD,aAAeK,GADiC,+DAC1B,EAD0B;AAAA,CAA3C;AAGP;AACA;;AACA,OAAO,IAAMC,cAAkC,GAAG,SAArCA,cAAqC;AAAA;;AAAA,0BAAMN,WAAW,EAAjB,kDAAM,cAAeO,MAArB;AAAA,CAA3C;AAEP;AACA;;AACA,OAAO,IAAMC,WAA4B,GAAG,SAA/BA,WAA+B;AAAA;;AAAA,0BAAMR,WAAW,EAAjB,kDAAM,cAAeS,QAArB;AAAA,CAArC;AAEP;AACA;;AACA,OAAO,IAAMC,aAAgC,GAAG,SAAnCA,aAAmC,GAAM;AACpD,MAAMC,QAAQ,GAAGlB,WAAW,EAA5B;AAEA,SAAO;AACLE,IAAAA,IAAI,EAAE,cAACQ,QAAD,EAAmCF,KAAnC;AAAA,aACJU,QAAQ,CAAChB,KAAI,CAACQ,QAAD,EAAWF,KAAX,CAAL,CADJ;AAAA,KADD;AAGLL,IAAAA,OAAO,EAAE,iBAACO,QAAD,EAAmCF,KAAnC;AAAA,aACPU,QAAQ,CAACf,QAAO,CAACO,QAAD,EAAWF,KAAX,CAAR,CADD;AAAA,KAHJ;AAKLJ,IAAAA,EAAE,EAAE,YAACe,KAAD;AAAA,aAAmBD,QAAQ,CAACd,GAAE,CAACe,KAAD,CAAH,CAA3B;AAAA,KALC;AAMLd,IAAAA,MAAM,EAAE;AAAA,aAAMa,QAAQ,CAACb,OAAM,EAAP,CAAd;AAAA,KANH;AAOLC,IAAAA,SAAS,EAAE;AAAA,aAAMY,QAAQ,CAACZ,UAAS,EAAV,CAAd;AAAA;AAPN,GAAP;AASD,CAZM","sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport type { Location, LocationShape } from \"react-router\";\n\nimport { push, replace, go, goBack, goForward } from \"../redux/_router/actions\";\nimport type {\n GoAction,\n GoBackAction,\n GoForwardAction,\n PushAction,\n ReplaceAction,\n} from \"../redux\";\n\ntype UseLocationHook = () => Location;\ntype UseLocationKeyHook = () => string;\ntype UseQuerystringHook = () => string;\ntype UsePathnameHook = () => string;\ntype UseNavigationHook = () => {\n push: (location: LocationShape | string, state?: { ... }) => PushAction,\n replace: (location: LocationShape | string, state?: { ... }) => ReplaceAction,\n go: (delta: number) => GoAction,\n goBack: () => GoBackAction,\n goForward: () => GoForwardAction,\n};\n\n/**\n */\nexport const useLocation: UseLocationHook = () =>\n useSelector((state) => state.router.location);\n\n/**\n */\nexport const useLocationKey: UseLocationKeyHook = () =>\n useLocation()?.key ?? \"\";\n\n/**\n */\nexport const useQuerystring: UseQuerystringHook = () => useLocation()?.search;\n\n/**\n */\nexport const usePathname: UsePathnameHook = () => useLocation()?.pathname;\n\n/**\n */\nexport const useNavigation: UseNavigationHook = () => {\n const dispatch = useDispatch();\n\n return {\n push: (location: LocationShape | string, state?: { ... }) =>\n dispatch(push(location, state)),\n replace: (location: LocationShape | string, state?: { ... }) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n"],"file":"useRouter.js"}
@@ -28,6 +28,8 @@ import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-meth
28
28
  import { retrieveText } from "../../utils/helpers/text";
29
29
  import { hasAllContentInData } from "../../constants/Settings";
30
30
  import SectionModel from "../content/SectionModel";
31
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
32
+ import { isPlainObject } from "../../utils";
31
33
 
32
34
  var AttributeContent = /*#__PURE__*/function () {
33
35
  function AttributeContent(content) {
@@ -52,13 +54,29 @@ var AttributeContent = /*#__PURE__*/function () {
52
54
  }, {
53
55
  key: "header",
54
56
  get: function get() {
55
- var _this$_content, _this$_content$header, _this$_content2, _this$_content2$heade, _this$_content2$heade2;
57
+ var _this$_content, _this$_content$header, _this$_content2, _this$_content2$heade;
56
58
 
59
+ var headerLabel = null;
60
+ var headerDescription = null;
57
61
  var label = (_this$_content = this._content) === null || _this$_content === void 0 ? void 0 : (_this$_content$header = _this$_content.header) === null || _this$_content$header === void 0 ? void 0 : _this$_content$header.label;
58
- var description = (_this$_content2 = this._content) === null || _this$_content2 === void 0 ? void 0 : (_this$_content2$heade = _this$_content2.header) === null || _this$_content2$heade === void 0 ? void 0 : (_this$_content2$heade2 = _this$_content2$heade.description) === null || _this$_content2$heade2 === void 0 ? void 0 : _this$_content2$heade2.message;
62
+
63
+ if (label) {
64
+ headerLabel = label;
65
+ }
66
+
67
+ var description = (_this$_content2 = this._content) === null || _this$_content2 === void 0 ? void 0 : (_this$_content2$heade = _this$_content2.header) === null || _this$_content2$heade === void 0 ? void 0 : _this$_content2$heade.description;
68
+
69
+ if (description) {
70
+ if (isPlainObject(description) && "message" in description) {
71
+ headerDescription = description.message;
72
+ } else if (typeof description === "string") {
73
+ headerDescription = description;
74
+ }
75
+ }
76
+
59
77
  return {
60
- label: label,
61
- description: description
78
+ label: headerLabel,
79
+ description: headerDescription
62
80
  };
63
81
  }
64
82
  /**
@@ -73,16 +91,31 @@ var AttributeContent = /*#__PURE__*/function () {
73
91
  var _this$_content$elemen;
74
92
 
75
93
  return (_this$_content$elemen = this._content.elements) === null || _this$_content$elemen === void 0 ? void 0 : _mapInstanceProperty(_this$_content$elemen).call(_this$_content$elemen, function (element) {
76
- if ("textFragmentElement" in element) {
94
+ if ("propertyElement" in element) {
77
95
  // $FlowIssue
78
- var _element$textFragment = element.textFragmentElement,
79
- label = _element$textFragment.label,
80
- id = _element$textFragment.id,
96
+ var _element$propertyElem = element.propertyElement,
97
+ label = _element$propertyElem.label,
98
+ layouthint = _element$propertyElem.layouthint,
99
+ properties = _element$propertyElem.properties;
100
+ return {
101
+ propertyElement: {
102
+ label: label,
103
+ layouthint: new LayoutHintCollection(layouthint),
104
+ properties: properties
105
+ }
106
+ };
107
+ }
108
+
109
+ if ("textFragmentElement" in element) {
110
+ var _element$textFragment = // $FlowIssue
111
+ element.textFragmentElement,
112
+ _label = _element$textFragment.label,
113
+ _layouthint = _element$textFragment.layouthint,
81
114
  textfragments = _element$textFragment.textfragments;
82
115
  return {
83
116
  textFragmentElement: {
84
- id: id,
85
- label: label,
117
+ label: _label,
118
+ layouthint: new LayoutHintCollection(_layouthint),
86
119
  textfragments: _mapInstanceProperty(textfragments).call(textfragments, function (textfragment) {
87
120
  return _objectSpread(_objectSpread({}, textfragment), {}, {
88
121
  text: retrieveText(textfragment.text)
@@ -95,11 +128,13 @@ var AttributeContent = /*#__PURE__*/function () {
95
128
  if ("contentElement" in element) {
96
129
  // $FlowIssue
97
130
  var _element$contentEleme = element.contentElement,
98
- _label = _element$contentEleme.label,
131
+ _label2 = _element$contentEleme.label,
132
+ _layouthint2 = _element$contentEleme.layouthint,
99
133
  sections = _element$contentEleme.sections;
100
134
  return {
101
135
  contentElement: {
102
- label: _label,
136
+ label: _label2,
137
+ layouthint: new LayoutHintCollection(_layouthint2),
103
138
  sections: _mapInstanceProperty(sections).call(sections, function (section) {
104
139
  return new SectionModel(section, null);
105
140
  })
@@ -120,15 +155,9 @@ var AttributeContent = /*#__PURE__*/function () {
120
155
  }, {
121
156
  key: "label",
122
157
  get: function get() {
123
- return this.header.label;
124
- }
125
- /**
126
- */
158
+ var _this$_content4;
127
159
 
128
- }, {
129
- key: "description",
130
- get: function get() {
131
- return this.header.description;
160
+ return (_this$_content4 = this._content) === null || _this$_content4 === void 0 ? void 0 : _this$_content4.label;
132
161
  }
133
162
  /**
134
163
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","AttributeContent","content","_content","label","header","description","message","elements","element","textFragmentElement","id","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","ids","properties","property","type","keys","types","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;;IAUMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOH,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAGE;AAAA;;AACA,UAAMK,KAAK,qBAAG,KAAKD,QAAR,4EAAG,eAAeE,MAAlB,0DAAG,sBAAuBD,KAArC;AACA,UAAME,WAAW,sBAAG,KAAKH,QAAR,6EAAG,gBAAeE,MAAlB,oFAAG,sBAAuBC,WAA1B,2DAAG,uBAAoCC,OAAxD;AAEA,aAAO;AAAEH,QAAAA,KAAK,EAALA,KAAF;AAASE,QAAAA,WAAW,EAAXA;AAAT,OAAP;AACD;AAED;AACF;;;;SACE,eAA2B;AAAA;;AACzB,6BAAI,KAAKH,QAAT,4CAAI,gBAAeK,QAAnB,EAA6B;AAAA;;AAC3B,wCAAO,KAAKL,QAAL,CAAcK,QAArB,0DAAO,wEAA4B,UAACC,OAAD,EAAa;AAC9C,cAAI,yBAAyBA,OAA7B,EAAsC;AACpC;AAC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AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe1B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport type {\n ContentData,\n PropertyData,\n TextFragmentData,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n const label = this._content?.header?.label;\n const description = this._content?.header?.description?.message;\n\n return { label, description };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"textFragmentElement\" in element) {\n // $FlowIssue\n const { label, id, textfragments } = element.textFragmentElement;\n return {\n textFragmentElement: {\n id,\n label,\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (\"contentElement\" in element) {\n // $FlowIssue\n const { label, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this.header.label;\n }\n\n /**\n */\n get description(): ?string {\n return this.header.description;\n }\n\n /**\n */\n getContentElements<T>(elementName: string, collectionName: string): Array<T> {\n return this.elements\n .filter((element) => elementName in element)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElements<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<PropertyData> {\n return this.properties.filter((property) => ids.includes(property.type));\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElements<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by type\n */\n getTextFragmentByKeys(keys: Array<string>): Array<TextFragmentData> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type)\n );\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElements<SectionModel>(\"contentElement\", \"sections\");\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","isPlainObject","AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","ids","property","type","keys","types","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AASA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,QAA8B,aAA9B;;IAEMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOL,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAGE;AAAA;;AACA,UAAIO,WAAW,GAAG,IAAlB;AACA,UAAIC,iBAAiB,GAAG,IAA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BAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe7B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport type {\n ContentData,\n PropertyData,\n TextFragmentData,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"propertyElement\" in element) {\n // $FlowIssue\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (\"textFragmentElement\" in element) {\n const { label, layouthint, textfragments } =\n // $FlowIssue\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (\"contentElement\" in element) {\n // $FlowIssue\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string, collectionName: string): Array<T> {\n return this.elements\n .filter((element) => elementName in element)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElements<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<PropertyData> {\n return this.properties.filter((property) => ids.includes(property.type));\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElements<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by type\n */\n getTextFragmentByKeys(keys: Array<string>): Array<TextFragmentData> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type)\n );\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElements<SectionModel>(\"contentElement\", \"sections\");\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
@@ -300,7 +300,7 @@ var AttributeDataHelper = /*#__PURE__*/function () {
300
300
  key: "content",
301
301
  get: function get() {
302
302
  if (this._attribute.content) {
303
- var pickedContent = pick(this._attribute.content, ["header", "label", "description", "elements"]);
303
+ var pickedContent = pick(this._attribute.content, ["header", "label", "elements", "layouthint"]);
304
304
 
305
305
  if (_Object$keys(pickedContent).length > 0) {
306
306
  return pickedContent;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/AttributeDataHelper.js"],"names":["cloneDeep","pick","has","isPlainObject","AttributeDataHelper","data","key","childrenKeys","_key","Array","isArray","_attribute","attr","elementid","name","param","_value","getValue","attributeData","_links","undefined","_children","createChildren","parentKey","childKey","elements","element","parentData","content","childData","keyObject","dynamicschema","dynamicschemaId","children","childrenIsArray","value","createChild","attribute","suggestions","suggestion","options","option","selected","code","static","attrDS","message","isResult","referenceDate","pickedContent","length","links","child","subChild","getData"],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,IAAP,MAAiB,aAAjB;AAEA,SAASC,GAAT,EAAcC,aAAd,QAAmC,6BAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;IACMC,mB;AAMJ;AACF;AACE,+BACEC,IADF,EAEEC,GAFF,EAGEC,YAHF,EAIE;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACA,SAAKC,IAAL,GAAYF,GAAZ;;AAEA,QAAIG,KAAK,CAACC,OAAN,CAAcL,IAAd,CAAJ,EAAyB;AACvB,WAAKM,UAAL,GACE,sBAAAN,IAAI,MAAJ,CAAAA,IAAI,EACF,UAACO,IAAD;AAAA,eACEA,IAAI,CAACC,SAAL,KAAmBP,GAAnB,IAA0BM,IAAI,CAACE,IAAL,KAAcR,GAAxC,IAA+CM,IAAI,CAACG,KAAL,KAAeT,GADhE;AAAA,OADE,CAAJ,IAGK,EAJP;AAKA,WAAKU,MAAL,GAAc,KAAKC,QAAL,CAAc,KAAKN,UAAnB,CAAd;AACD,KAPD,MAOO;AACL,UAAMO,aAAa,GAAGlB,SAAS,CAACK,IAAD,CAA/B;AACAa,MAAAA,aAAa,CAACC,MAAd,GAAuBlB,IAAI,CAACI,IAAI,CAACc,MAAN,EAAc,CACvC,SADuC,EAEvC,UAFuC,EAGvC,eAHuC,EAIvC,YAJuC,CAAd,CAA3B;AAOA,WAAKR,UAAL,GAAkBO,aAAlB;AAEA,WAAKF,MAAL,GAAcX,IAAI,CAACC,G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;SACE,eAAsB;AACpB,UAAI,KAAKV,UAAL,CAAgBiB,OAApB,EAA6B;AAC3B,YAAMqB,aAAa,GAAGhD,IAAI,CAAC,KAAKU,UAAL,CAAgBiB,OAAjB,EAA0B,CAClD,QADkD,EAElD,OAFkD,EAGlD,aAHkD,EAIlD,UAJkD,CAA1B,CAA1B;;AAMA,YAAI,aAAYqB,aAAZ,EAA2BC,MAA3B,GAAoC,CAAxC,EAA2C;AACzC,iBAAOD,aAAP;AACD;AACF;;AAED,aAAO,IAAP;AACD;AAED;AACF;;;;WACE,mBAAkB;AAAA;;AAChB,aAAO;AACL3C,QAAAA,GAAG,EAAE,KAAKA,GADL;AAEL6B,QAAAA,KAAK,EAAE,KAAKA,KAFP;AAGLS,QAAAA,MAAM,EAAE,KAAKA,MAHR;AAILzB,QAAAA,MAAM,EAAE,KAAKgC,KAJR;AAKLpB,QAAAA,aAAa,EAAE,KAAKA,aALf;AAMLC,QAAAA,eAAe,EAAE,KAAKA,eANjB;AAOLQ,QAAAA,OAAO,EAAE,KAAKA,OAPT;AAQLM,QAAAA,OAAO,EAAE,KAAKA,OART;AASLC,QAAAA,QAAQ,EAAE,KAAKA,QATV;AAULC,QAAAA,aAAa,EAAE,KAAKA,aAVf;AAWLf,QAAAA,QAAQ,EAAE,sCAAKA,QAAL,kBAAkB,UAACmB,KAAD;AAAA,iBAC1B3C,KAAK,CAACC,OAAN,CAAc0C,KAAd,IACI,qBAAAA,KAAK,MAAL,CAAAA,KAAK,EAAK,UAACC,QAAD;AAAA,mBAAcA,QAAQ,CAACC,OAAT,EAAd;AAAA,WAAL,CADT,GAEIF,KAAK,CAACE,OAAN,EAHsB;AAAA,SAAlB,CAXL;AAgBL1B,QAAAA,OAAO,EAAE,KAAKA;AAhBT,OAAP;AAkBD;;;;;;AAGH,eAAexB,mBAAf","sourcesContent":["// @flow\nimport cloneDeep from \"lodash/cloneDeep\";\nimport pick from \"lodash/pick\";\n\nimport { has, isPlainObject } from \"../../utils/helpers/objects\";\n\n/**\n * This util helps to normalize various attribute data formats available in the modular ui.\n * It fixes differences in choice attributes with dynamic schema's, links on download attributes, composites with various children, etc\n *\n * @private\n */\nclass AttributeDataHelper {\n _key: string;\n _attribute: Object;\n _value: any;\n _children: Array<AttributeDataHelper>;\n\n /**\n */\n constructor(\n data: Object | Array<Object>,\n key: string,\n childrenKeys: Array<Object>\n ) {\n this._key = key;\n\n if (Array.isArray(data)) {\n this._attribute =\n data.find(\n (attr) =>\n attr.elementid === key || attr.name === key || attr.param === key\n ) || {};\n this._value = this.getValue(this._attribute);\n } else {\n const attributeData = cloneDeep(data);\n attributeData._links = pick(data._links, [\n \"concept\",\n \"download\",\n \"lookupOptions\",\n \"lookupList\",\n ]);\n\n this._attribute = attributeData;\n\n this._value = data[key] === undefined ? this.getValue(data) : data[key];\n }\n\n this._children = this.createChildren(data, childrenKeys);\n }\n\n /**\n */\n childData(\n data: Object | Array<Object>,\n parentKey: string,\n childKey: string\n ): Object {\n if (Array.isArray(data)) {\n if (Array.isArray(this._attribute.elements)) {\n return this._attribute.elements.find(\n (element) => element.elementid === childKey\n );\n }\n } else if (has(data, parentKey) && isPlainObject(data[parentKey])) {\n const parentData = data[parentKey];\n if (isPlainObject(parentData) && data.content?.[childKey]) {\n return { ...parentData, content: data.content[childKey] };\n }\n return parentData;\n } else if (has(data, childKey) && isPlainObject(data[childKey])) {\n return data[childKey];\n }\n\n if (isPlainObject(data)) {\n return data;\n }\n\n return {};\n }\n\n /**\n */\n createChild(\n data: Object | Array<Object>,\n childData: Object,\n keyObject: Object\n ): AttributeDataHelper {\n const dynamicschema =\n isPlainObject(data) && !Array.isArray(data)\n ? data.dynamicschema\n : undefined;\n\n let dynamicschemaId = null;\n if (keyObject.dynamicschemaId) {\n dynamicschemaId = keyObject.dynamicschemaId;\n } else if (\n isPlainObject(data) &&\n typeof data.key === \"string\" &&\n keyObject.key\n ) {\n dynamicschemaId = `${data.key}.${keyObject.key}`;\n }\n\n return new AttributeDataHelper(\n {\n ...childData,\n dynamicschema,\n dynamicschemaId,\n },\n keyObject.key,\n keyObject.children\n );\n }\n\n /**\n */\n createChildren(\n data: Object | Array<Object>,\n childrenKeys: Array<Object> = []\n ): Array<AttributeDataHelper> {\n const childrenIsArray = Array.isArray(this.value);\n\n if (childrenIsArray) {\n return this.value.map((value) =>\n childrenKeys.map((keyObject) => {\n const childData = this.childData(value, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n })\n );\n }\n\n return childrenKeys.map((keyObject) => {\n const childData = this.childData(data, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n });\n }\n\n /**\n */\n getValue(attribute: Object): any {\n if (\"values\" in attribute) {\n return attribute.values;\n }\n\n if (\"value\" in attribute) {\n return attribute.value;\n }\n\n if (\"suggestions\" in attribute) {\n return attribute.suggestions;\n }\n\n if (\"suggestion\" in attribute) {\n return attribute.suggestion;\n }\n\n if (Array.isArray(attribute.options)) {\n return attribute.options\n .filter((option) => option.selected)\n .map((option) => option.code || option.key);\n }\n\n return null;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n get value(): any {\n return this._value;\n }\n\n /**\n */\n get static(): boolean {\n return this._attribute.static || false;\n }\n\n /**\n */\n get links(): any {\n return this._attribute._links || void 0;\n }\n\n /**\n */\n get dynamicschemaId(): string {\n return this._attribute.dynamicschemaId || this.key;\n }\n\n /*\n retrieve the dynamischema by the dynamischemaId\n mentioned in the contributions of the attribute\n */\n /**\n */\n get dynamicschema(): any {\n const { dynamicschema } = this._attribute;\n if (!dynamicschema) {\n return void 0;\n }\n\n if (Array.isArray(dynamicschema)) {\n return dynamicschema;\n } else if (dynamicschema[this.dynamicschemaId]) {\n const attrDS = dynamicschema[this.dynamicschemaId];\n return attrDS.map((attr) => {\n if (attr.elements) {\n return {\n ...attr,\n elements: {\n ...attr.elements,\n dynamicschema,\n },\n };\n }\n\n return attr;\n });\n }\n\n return void 0;\n }\n\n /**\n */\n get options(): any {\n return this._attribute.options || void 0;\n }\n\n /**\n */\n get message(): any {\n return this._attribute.message || void 0;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._attribute.isResult || false;\n }\n\n /**\n */\n get referenceDate(): any {\n return this._attribute.referenceDate || void 0;\n }\n\n /**\n */\n get children(): Array<AttributeDataHelper> {\n return this._children || [];\n }\n\n /**\n */\n get content(): Object {\n if (this._attribute.content) {\n const pickedContent = pick(this._attribute.content, [\n \"header\",\n \"label\",\n \"description\",\n \"elements\",\n ]);\n if (Object.keys(pickedContent).length > 0) {\n return pickedContent;\n }\n }\n\n return null;\n }\n\n /**\n */\n getData(): Object {\n return {\n key: this.key,\n value: this.value,\n static: this.static,\n _links: this.links,\n dynamicschema: this.dynamicschema,\n dynamicschemaId: this.dynamicschemaId,\n options: this.options,\n message: this.message,\n isResult: this.isResult,\n referenceDate: this.referenceDate,\n children: this.children.map((child) =>\n Array.isArray(child)\n ? child.map((subChild) => subChild.getData())\n : child.getData()\n ),\n content: this.content,\n };\n }\n}\n\nexport default AttributeDataHelper;\n"],"file":"AttributeDataHelper.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/AttributeDataHelper.js"],"names":["cloneDeep","pick","has","isPlainObject","AttributeDataHelper","data","key","childrenKeys","_key","Array","isArray","_attribute","attr","elementid","name","param","_value","getValue","attributeData","_links","undefined","_children","createChildren","parentKey","childKey","elements","element","parentData","content","childData","keyObject","dynamicschema","dynamicschemaId","children","childrenIsArray","value","createChild","attribute","suggestions","suggestion","options","option","selected","code","static","attrDS","message","isResult","referenceDate","pickedContent","length","links","child","subChild","getData"],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,IAAP,MAAiB,aAAjB;AAEA,SAASC,GAAT,EAAcC,aAAd,QAAmC,6BAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;IACMC,mB;AAMJ;AACF;AACE,+BACEC,IADF,EAEEC,GAFF,EAGEC,YAHF,EAIE;AAAA;;AAAA;;AAAA;;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pB,QAAAA,aAAa,EAAE,KAAKA,aALf;AAMLC,QAAAA,eAAe,EAAE,KAAKA,eANjB;AAOLQ,QAAAA,OAAO,EAAE,KAAKA,OAPT;AAQLM,QAAAA,OAAO,EAAE,KAAKA,OART;AASLC,QAAAA,QAAQ,EAAE,KAAKA,QATV;AAULC,QAAAA,aAAa,EAAE,KAAKA,aAVf;AAWLf,QAAAA,QAAQ,EAAE,sCAAKA,QAAL,kBAAkB,UAACmB,KAAD;AAAA,iBAC1B3C,KAAK,CAACC,OAAN,CAAc0C,KAAd,IACI,qBAAAA,KAAK,MAAL,CAAAA,KAAK,EAAK,UAACC,QAAD;AAAA,mBAAcA,QAAQ,CAACC,OAAT,EAAd;AAAA,WAAL,CADT,GAEIF,KAAK,CAACE,OAAN,EAHsB;AAAA,SAAlB,CAXL;AAgBL1B,QAAAA,OAAO,EAAE,KAAKA;AAhBT,OAAP;AAkBD;;;;;;AAGH,eAAexB,mBAAf","sourcesContent":["// @flow\nimport cloneDeep from \"lodash/cloneDeep\";\nimport pick from \"lodash/pick\";\n\nimport { has, isPlainObject } from \"../../utils/helpers/objects\";\n\n/**\n * This util helps to normalize various attribute data formats available in the modular ui.\n * It fixes differences in choice attributes with dynamic schema's, links on download attributes, composites with various children, etc\n *\n * @private\n */\nclass AttributeDataHelper {\n _key: string;\n _attribute: Object;\n _value: any;\n _children: Array<AttributeDataHelper>;\n\n /**\n */\n constructor(\n data: Object | Array<Object>,\n key: string,\n childrenKeys: Array<Object>\n ) {\n this._key = key;\n\n if (Array.isArray(data)) {\n this._attribute =\n data.find(\n (attr) =>\n attr.elementid === key || attr.name === key || attr.param === key\n ) || {};\n this._value = this.getValue(this._attribute);\n } else {\n const attributeData = cloneDeep(data);\n attributeData._links = pick(data._links, [\n \"concept\",\n \"download\",\n \"lookupOptions\",\n \"lookupList\",\n ]);\n\n this._attribute = attributeData;\n\n this._value = data[key] === undefined ? this.getValue(data) : data[key];\n }\n\n this._children = this.createChildren(data, childrenKeys);\n }\n\n /**\n */\n childData(\n data: Object | Array<Object>,\n parentKey: string,\n childKey: string\n ): Object {\n if (Array.isArray(data)) {\n if (Array.isArray(this._attribute.elements)) {\n return this._attribute.elements.find(\n (element) => element.elementid === childKey\n );\n }\n } else if (has(data, parentKey) && isPlainObject(data[parentKey])) {\n const parentData = data[parentKey];\n if (isPlainObject(parentData) && data.content?.[childKey]) {\n return { ...parentData, content: data.content[childKey] };\n }\n return parentData;\n } else if (has(data, childKey) && isPlainObject(data[childKey])) {\n return data[childKey];\n }\n\n if (isPlainObject(data)) {\n return data;\n }\n\n return {};\n }\n\n /**\n */\n createChild(\n data: Object | Array<Object>,\n childData: Object,\n keyObject: Object\n ): AttributeDataHelper {\n const dynamicschema =\n isPlainObject(data) && !Array.isArray(data)\n ? data.dynamicschema\n : undefined;\n\n let dynamicschemaId = null;\n if (keyObject.dynamicschemaId) {\n dynamicschemaId = keyObject.dynamicschemaId;\n } else if (\n isPlainObject(data) &&\n typeof data.key === \"string\" &&\n keyObject.key\n ) {\n dynamicschemaId = `${data.key}.${keyObject.key}`;\n }\n\n return new AttributeDataHelper(\n {\n ...childData,\n dynamicschema,\n dynamicschemaId,\n },\n keyObject.key,\n keyObject.children\n );\n }\n\n /**\n */\n createChildren(\n data: Object | Array<Object>,\n childrenKeys: Array<Object> = []\n ): Array<AttributeDataHelper> {\n const childrenIsArray = Array.isArray(this.value);\n\n if (childrenIsArray) {\n return this.value.map((value) =>\n childrenKeys.map((keyObject) => {\n const childData = this.childData(value, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n })\n );\n }\n\n return childrenKeys.map((keyObject) => {\n const childData = this.childData(data, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n });\n }\n\n /**\n */\n getValue(attribute: Object): any {\n if (\"values\" in attribute) {\n return attribute.values;\n }\n\n if (\"value\" in attribute) {\n return attribute.value;\n }\n\n if (\"suggestions\" in attribute) {\n return attribute.suggestions;\n }\n\n if (\"suggestion\" in attribute) {\n return attribute.suggestion;\n }\n\n if (Array.isArray(attribute.options)) {\n return attribute.options\n .filter((option) => option.selected)\n .map((option) => option.code || option.key);\n }\n\n return null;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n get value(): any {\n return this._value;\n }\n\n /**\n */\n get static(): boolean {\n return this._attribute.static || false;\n }\n\n /**\n */\n get links(): any {\n return this._attribute._links || void 0;\n }\n\n /**\n */\n get dynamicschemaId(): string {\n return this._attribute.dynamicschemaId || this.key;\n }\n\n /*\n retrieve the dynamischema by the dynamischemaId\n mentioned in the contributions of the attribute\n */\n /**\n */\n get dynamicschema(): any {\n const { dynamicschema } = this._attribute;\n if (!dynamicschema) {\n return void 0;\n }\n\n if (Array.isArray(dynamicschema)) {\n return dynamicschema;\n } else if (dynamicschema[this.dynamicschemaId]) {\n const attrDS = dynamicschema[this.dynamicschemaId];\n return attrDS.map((attr) => {\n if (attr.elements) {\n return {\n ...attr,\n elements: {\n ...attr.elements,\n dynamicschema,\n },\n };\n }\n\n return attr;\n });\n }\n\n return void 0;\n }\n\n /**\n */\n get options(): any {\n return this._attribute.options || void 0;\n }\n\n /**\n */\n get message(): any {\n return this._attribute.message || void 0;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._attribute.isResult || false;\n }\n\n /**\n */\n get referenceDate(): any {\n return this._attribute.referenceDate || void 0;\n }\n\n /**\n */\n get children(): Array<AttributeDataHelper> {\n return this._children || [];\n }\n\n /**\n */\n get content(): Object {\n if (this._attribute.content) {\n const pickedContent = pick(this._attribute.content, [\n \"header\",\n \"label\",\n \"elements\",\n \"layouthint\",\n ]);\n\n if (Object.keys(pickedContent).length > 0) {\n return pickedContent;\n }\n }\n\n return null;\n }\n\n /**\n */\n getData(): Object {\n return {\n key: this.key,\n value: this.value,\n static: this.static,\n _links: this.links,\n dynamicschema: this.dynamicschema,\n dynamicschemaId: this.dynamicschemaId,\n options: this.options,\n message: this.message,\n isResult: this.isResult,\n referenceDate: this.referenceDate,\n children: this.children.map((child) =>\n Array.isArray(child)\n ? child.map((subChild) => subChild.getData())\n : child.getData()\n ),\n content: this.content,\n };\n }\n}\n\nexport default AttributeDataHelper;\n"],"file":"AttributeDataHelper.js"}
@@ -44,7 +44,9 @@ var HelptextAttributeModel = /*#__PURE__*/function (_LabelAttributeModel) {
44
44
  var dataText = this.getData("value");
45
45
 
46
46
  if (dataText) {
47
- return dataText.message;
47
+ var _dataText$message;
48
+
49
+ return (_dataText$message = dataText.message) !== null && _dataText$message !== void 0 ? _dataText$message : dataText;
48
50
  }
49
51
 
50
52
  var contributionText = this.getContribution("text");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/HelptextAttributeModel.js"],"names":["has","LabelAttributeModel","HelptextAttributeModel","dataText","getData","message","contributionText","getContribution","contributions","type","readonly"],"mappings":";;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,mBAAP,MAAgC,uBAAhC;AAEA;AACA;AACA;;IACqBC,sB;;;;;;;;;;;;;;AAUnB;AACF;AACE,mBAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;AACA;;;;SACE,eAA0B;AACxB,UAAMC,QAAQ,GAAG,KAAKC,OAAL,CAAa,OAAb,CAAjB;;AACA,UAAID,QAAJ,EAAc;AACZ,eAAOA,QAAQ,CAACE,OAAhB;AACD;;AAED,UAAMC,gBAAgB,GAAG,KAAKC,eAAL,CAAqB,MAArB,CAAzB;;AACA,UAAID,gBAAJ,EAAsB;AAAA;;AACpB,wCAAOA,gBAAgB,CAACD,OAAxB,yEAAmCC,gBAAnC;AACD;;AAED,aAAO,IAAP;AACD;;;;AA9BD;AACF;AACE,+BAAyBE,aAAzB,EAAyD;AACvD,aACEA,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCD,aAAa,CAACE,QAAd,IAA0BV,GAAG,CAACQ,aAAD,EAAgB,MAAhB,CAFhC;AAID;;;;EARiDP,mB;;SAA/BC,sB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport LabelAttributeModel from \"./LabelAttributeModel\";\n\n/**\n * Helptext attribute\n */\nexport default class HelptextAttributeModel extends LabelAttributeModel {\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type === \"helptext\" ||\n (contributions.readonly && has(contributions, \"text\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"helptext\";\n }\n\n /**\n * Get helptext text\n */\n get text(): string | null {\n const dataText = this.getData(\"value\");\n if (dataText) {\n return dataText.message;\n }\n\n const contributionText = this.getContribution(\"text\");\n if (contributionText) {\n return contributionText.message ?? contributionText;\n }\n\n return null;\n }\n}\n"],"file":"HelptextAttributeModel.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/HelptextAttributeModel.js"],"names":["has","LabelAttributeModel","HelptextAttributeModel","dataText","getData","message","contributionText","getContribution","contributions","type","readonly"],"mappings":";;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,mBAAP,MAAgC,uBAAhC;AAEA;AACA;AACA;;IACqBC,sB;;;;;;;;;;;;;;AAUnB;AACF;AACE,mBAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;AACA;;;;SACE,eAA0B;AACxB,UAAMC,QAAQ,GAAG,KAAKC,OAAL,CAAa,OAAb,CAAjB;;AACA,UAAID,QAAJ,EAAc;AAAA;;AACZ,oCAAOA,QAAQ,CAACE,OAAhB,iEAA2BF,QAA3B;AACD;;AAED,UAAMG,gBAAgB,GAAG,KAAKC,eAAL,CAAqB,MAArB,CAAzB;;AACA,UAAID,gBAAJ,EAAsB;AAAA;;AACpB,wCAAOA,gBAAgB,CAACD,OAAxB,yEAAmCC,gBAAnC;AACD;;AAED,aAAO,IAAP;AACD;;;;AA9BD;AACF;AACE,+BAAyBE,aAAzB,EAAyD;AACvD,aACEA,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCD,aAAa,CAACE,QAAd,IAA0BV,GAAG,CAACQ,aAAD,EAAgB,MAAhB,CAFhC;AAID;;;;EARiDP,mB;;SAA/BC,sB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport LabelAttributeModel from \"./LabelAttributeModel\";\n\n/**\n * Helptext attribute\n */\nexport default class HelptextAttributeModel extends LabelAttributeModel {\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type === \"helptext\" ||\n (contributions.readonly && has(contributions, \"text\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"helptext\";\n }\n\n /**\n * Get helptext text\n */\n get text(): string | null {\n const dataText = this.getData(\"value\");\n if (dataText) {\n return dataText.message ?? dataText;\n }\n\n const contributionText = this.getContribution(\"text\");\n if (contributionText) {\n return contributionText.message ?? contributionText;\n }\n\n return null;\n }\n}\n"],"file":"HelptextAttributeModel.js"}
@@ -7,9 +7,9 @@ import _inherits from "@babel/runtime-corejs3/helpers/esm/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime-corejs3/helpers/esm/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
- import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
11
10
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
12
11
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
12
+ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
13
13
 
14
14
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
15
 
@@ -101,6 +101,7 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
101
101
  return this.attributeCollection.getAttributeByLayoutHint(TITLE);
102
102
  }
103
103
  /**
104
+ * Retrieve the case label, this can be configured with a case property with the layout hint 'title'
104
105
  */
105
106
 
106
107
  }, {
@@ -108,6 +109,15 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
108
109
  get: function get() {
109
110
  return this.casename ? this.casename.value : "";
110
111
  }
112
+ /**
113
+ * Retrieve the label that was configured on the caseview
114
+ */
115
+
116
+ }, {
117
+ key: "viewLabel",
118
+ get: function get() {
119
+ return this.getContribution("label", "");
120
+ }
111
121
  /**
112
122
  * Check if an introtext exists for this caseview
113
123
  */
@@ -124,16 +134,20 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
124
134
  }, {
125
135
  key: "introtext",
126
136
  get: function get() {
127
- if (this.contributions.texts) {
128
- var _context;
137
+ if (this.data._text) {
138
+ var _this$data$_text$mess;
129
139
 
130
- var text = _findInstanceProperty(_context = this.contributions.texts).call(_context, function (item) {
131
- return item.type === "master";
132
- });
140
+ return (_this$data$_text$mess = this.data._text.message) !== null && _this$data$_text$mess !== void 0 ? _this$data$_text$mess : this.data._text;
141
+ }
133
142
 
134
- if (text) {
135
- return text.text;
136
- }
143
+ if (this.contributions.text) {
144
+ var _this$contributions$t;
145
+
146
+ return (_this$contributions$t = this.contributions.text.message) !== null && _this$contributions$t !== void 0 ? _this$contributions$t : this.contributions.text;
147
+ }
148
+
149
+ if (Array.isArray(this.contributions.texts)) {
150
+ return this.contributions.texts[0].text;
137
151
  }
138
152
 
139
153
  return "";
@@ -159,15 +173,15 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
159
173
  }, {
160
174
  key: "createTaskGroupCollection",
161
175
  value: function createTaskGroupCollection() {
162
- var _context2;
176
+ var _context;
163
177
 
164
178
  var allTaskgroupData = this.getData("taskgroups", []);
165
179
  var allTaskgroupContributions = this.getContribution("taskgroups", []);
166
- this.taskGroupCollection = _mapInstanceProperty(_context2 = _filterInstanceProperty(allTaskgroupData).call(allTaskgroupData, function (taskgroup) {
180
+ this.taskGroupCollection = _mapInstanceProperty(_context = _filterInstanceProperty(allTaskgroupData).call(allTaskgroupData, function (taskgroup) {
167
181
  return allTaskgroupContributions.some(function (taskgroupContribution) {
168
182
  return taskgroupContribution.name === taskgroup.name;
169
183
  });
170
- })).call(_context2, function (taskgroup) {
184
+ })).call(_context, function (taskgroup) {
171
185
  var taskgroupContributions = _findInstanceProperty(allTaskgroupContributions).call(allTaskgroupContributions, function (taskgroupContribution) {
172
186
  return taskgroupContribution.name === taskgroup.name;
173
187
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/caseview/CaseViewModel.js"],"names":["DetailModel","Href","TaskGroupCollection","TaskGroupModel","TITLE","CaseViewModel","caseviewData","createTaskGroupCollection","links","getLinksByGroup","all","models","taskGroupModels","i","length","push","taskGroupCollection","add","attributeCollection","getAttributeByLayoutHint","casename","value","introtext","contributions","texts","text","item","type","selfLink","getLinkByKey","Error","href","allTaskgroupData","getData","allTaskgroupContributions","getContribution","taskgroup","some","taskgroupContribution","name","taskgroupContributions","create","_taskGroupCollection","taskgroups","hasItems","data","resourcetype"],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAOA,WAAP,MAAwB,uBAAxB;AACA,OAAOC,IAAP,MAAiB,cAAjB;AACA,OAAOC,mBAAP,MAAgC,kCAAhC;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA,SAASC,KAAT,QAAsB,6BAAtB;;AAOA;AACA;AACA;IACqBC,a;;;;;AAGnB;AACF;AACE,yBAAYC,YAAZ,EAA6C;AAAA;;AAAA;;AAC3C,8BAAMA,YAAN;;AAD2C;;AAG3C,UAAKC,yBAAL;;AAH2C;AAI5C;AAED;AACF;;;;;SACE,eAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;;;;;AAQE;AACF;AACE,yCAA8C;AAC5C,aAAO,KAAKC,KAAL,CAAWC,eAAX,CAA2B,WAA3B,EAAwCC,GAA/C;AACD;AAED;AACF;AACA;;;;SACE,eAAiC;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AAnB,KAAoC,UAFtC;AAID;;;;EAxBwC9C,W;;SAAtBK,a","sourcesContent":["// @flow\nimport DetailModel from \"../detail/DetailModel\";\nimport Href from \"../href/Href\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model containing the details of one case.\n */\nexport default class CaseViewModel extends DetailModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(caseviewData: ModularUIResponse) {\n super(caseviewData);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"CaseView\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"CaseView\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n super.setChildModels(models);\n\n const taskGroupModels = [];\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroupModels.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroupModels);\n }\n\n /**\n * Getting the case name\n */\n get casename(): ?AttributeType {\n return this.attributeCollection.getAttributeByLayoutHint(TITLE);\n }\n\n /**\n */\n get label(): string {\n return this.casename ? this.casename.value : \"\";\n }\n\n /**\n * Check if an introtext exists for this caseview\n */\n hasIntroText(): boolean {\n return this.introtext !== \"\";\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.contributions.texts) {\n const text = this.contributions.texts.find(\n (item) => item.type === \"master\"\n );\n\n if (text) {\n return text.text;\n }\n }\n\n return \"\";\n }\n\n /**\n * Getting the self href\n */\n get selfhref(): Href {\n const selfLink = this.links.getLinkByKey(\"self\");\n\n if (selfLink === null) {\n throw new Error(\"No self href available\");\n }\n\n return new Href(selfLink.href);\n }\n\n /**\n */\n createTaskGroupCollection() {\n const allTaskgroupData = this.getData(\"taskgroups\", []);\n const allTaskgroupContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupData\n .filter((taskgroup) =>\n allTaskgroupContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n )\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupContributions.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n );\n\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions\n );\n });\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection.hasItems;\n }\n}\n"],"file":"CaseViewModel.js"}
1
+ {"version":3,"sources":["../../../src/models/caseview/CaseViewModel.js"],"names":["DetailModel","Href","TaskGroupCollection","TaskGroupModel","TITLE","CaseViewModel","caseviewData","createTaskGroupCollection","links","getLinksByGroup","all","models","taskGroupModels","i","length","push","taskGroupCollection","add","attributeCollection","getAttributeByLayoutHint","casename","value","getContribution","introtext","data","_text","message","contributions","text","Array","isArray","texts","selfLink","getLinkByKey","Error","href","allTaskgroupData","getData","allTaskgroupContributions","taskgroup","some","taskgroupContribution","name","taskgroupContributions","create","_taskGroupCollection","taskgroups","hasItems","resourcetype"],"mappings":";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,CACE,UAACC,qBAAD;AAAA,iBACEA,qBAAqB,CAACC,IAAtB,KAA+BH,SAAS,CAACG,IAD3C;AAAA,SADF,CADM;AAAA,OADiC,CAAhB,iBAOpB,UAACH,SAAD,EAAe;AAClB,YAAMI,sBAAsB,GAAG,sBAAAL,yBAAyB,MAAzB,CAAAA,yBAAyB,EACtD,UAACG,qBAAD;AAAA,iBACEA,qBAAqB,CAACC,IAAtB,KAA+BH,SAAS,CAACG,IAD3C;AAAA,SADsD,CAAxD;;AAKA,eAAOvC,cAAc,CAACyC,MAAf,CACLL,SAAS,CAACG,IADL,EAELH,SAFK,EAGLI,sBAHK,CAAP;AAKD,OAlBwB,CAA3B;AAmBD;AAED;AACF;AACA;;;;;AAKE;AACF;AACA;AACE,mBAA+C;AAC7C,aAAO,KAAKE,oBAAZ;AACD;AAED;AACF;AACA;;SAbE,aAAwBC,UAAxB,EAA2D;AACzD,WAAKD,oBAAL,GAA4B,IAAI3C,mBAAJ,CAAwB4C,UAAxB,CAA5B;AACD;;;WAYD,yBAAyB;AACvB,aAAO,KAAK9B,mBAAL,IAA4B,KAAKA,mBAAL,CAAyB+B,QAA5D;AACD;;;WA7ID,2BAAyBvB,IAAzB,EAA2D;AACzD,aACEA,IAAI,CAACG,aAAL,CAAmBqB,YAAnB,IACAxB,IAAI,CAACG,aAAL,CAAmBqB,YAAnB,KAAoC,UAFtC;AAID;;;;EAxBwChD,W;;SAAtBK,a","sourcesContent":["// @flow\nimport DetailModel from \"../detail/DetailModel\";\nimport Href from \"../href/Href\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model containing the details of one case.\n */\nexport default class CaseViewModel extends DetailModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(caseviewData: ModularUIResponse) {\n super(caseviewData);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"CaseView\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"CaseView\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n super.setChildModels(models);\n\n const taskGroupModels = [];\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroupModels.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroupModels);\n }\n\n /**\n * Getting the case name\n */\n get casename(): ?AttributeType {\n return this.attributeCollection.getAttributeByLayoutHint(TITLE);\n }\n\n /**\n * Retrieve the case label, this can be configured with a case property with the layout hint 'title'\n */\n get label(): string {\n return this.casename ? this.casename.value : \"\";\n }\n\n /**\n * Retrieve the label that was configured on the caseview\n */\n get viewLabel(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Check if an introtext exists for this caseview\n */\n hasIntroText(): boolean {\n return this.introtext !== \"\";\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n * Getting the self href\n */\n get selfhref(): Href {\n const selfLink = this.links.getLinkByKey(\"self\");\n\n if (selfLink === null) {\n throw new Error(\"No self href available\");\n }\n\n return new Href(selfLink.href);\n }\n\n /**\n */\n createTaskGroupCollection() {\n const allTaskgroupData = this.getData(\"taskgroups\", []);\n const allTaskgroupContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupData\n .filter((taskgroup) =>\n allTaskgroupContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n )\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupContributions.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n );\n\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions\n );\n });\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection.hasItems;\n }\n}\n"],"file":"CaseViewModel.js"}
@@ -50,8 +50,8 @@ var ContentConfigurationResults = /*#__PURE__*/function () {
50
50
 
51
51
  var description = this._configuration.description;
52
52
 
53
- if (isPlainObject(description) && "rawText" in description) {
54
- return description.rawText;
53
+ if (isPlainObject(description) && "message" in description) {
54
+ return description.message;
55
55
  }
56
56
 
57
57
  return description;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/contentconfiguration/ContentConfigurationResults.js"],"names":["ContentConfigurationElements","LayoutHintCollection","isPlainObject","ContentConfigurationResults","configuration","_configuration","_layouthint","layouthint","label","description","rawText","attributes","all","hint","substring","length","elementKey","configElement","getFormConfigElement"],"mappings":";;;;;;;;AACA,OAAOA,4BAAP,MAAyC,gCAAzC;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA;AACA;;IACMC,2B;AAIJ;AACF;AACE,uCAAYC,aAAZ,EAAmC;AAAA;;AAAA;;AAAA;;AACj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AP;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,KAAKZ,WAAZ;AACD;;;;;;AAGH,eAAeH,2BAAf","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":["ContentConfigurationElements","LayoutHintCollection","isPlainObject","ContentConfigurationResults","configuration","_configuration","_layouthint","layouthint","label","description","message","attributes","all","hint","substring","length","elementKey","configElement","getFormConfigElement"],"mappings":";;;;;;;;AACA,OAAOA,4BAAP,MAAyC,gCAAzC;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA;AACA;;IACMC,2B;AAIJ;AACF;AACE,uCAAYC,aAAZ,EAAmC;AAAA;;AAAA;;AAAA;;AACjC,SAAKC,cAAL,GAAsBD,aAAa,IAAI,IAAvC;AAEA,SAAKE,WAAL,GAAmB,IAAIL,oBAAJ,CAAyBG,aAAzB,aAAyBA,aAAzB,uBAAyBA,aAAa,CAAEG,UAAxC,CAAnB;AACD;AAED;AACF;;;;;SACE,eAA2B;AACzB,UAAI,KAAKF,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAP;AACD;;AAED,aAAO,KAAKA,cAAL,CAAoBG,KAA3B;AACD;AAED;AACF;;;;SACE,eAAiC;AAC/B,UAAI,KAAKH,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAP;AACD;;AAED,UAAMI,WAAW,GAAG,KAAKJ,cAAL,CAAoBI,WAAxC;;AACA,UAAIP,aAAa,CAACO,WAAD,CAAb,IAA8B,aAAaA,WAA/C,EAA4D;AAC1D,eAAOA,WAAW,CAACC,OAAnB;AACD;;AAED,aAAOD,WAAP;AACD;AAED;AACF;;;;SACE,eAAgC;AAAA;;AAC9B,UAAI,KAAKJ,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,EAAP;AACD,OAH6B,CAK9B;AACA;;;AACA,sFACK,KAAKA,cAAL,CAAoBM,UADzB,sBAEK,0EAAKJ,UAAL,CAAgBK,GAAhB,kBACO,UAACC,IAAD;AAAA,eAAU,0BAAAA,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,KAAKX,cAAL,KAAwB,IAA5B,EAAkC;AAChC,eAAO,IAAIL,4BAAJ,CAAiC,EAAjC,CAAP;AACD;;AAED,UAAMiB,aAAa,GAAG,KAAKZ,cAAL,CAAoBW,UAApB,CAAtB;AAEA,aAAO,IAAIhB,4BAAJ,CAAiCiB,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,KAAKZ,WAAZ;AACD;;;;;;AAGH,eAAeH,2BAAf","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"}
@@ -361,9 +361,15 @@ var FormObjectModel = /*#__PURE__*/function (_BaseModel) {
361
361
  }, {
362
362
  key: "introText",
363
363
  get: function get() {
364
- var _this$contributions$i, _this$contributions$i2;
364
+ var _this$data$content, _this$contributions$i, _this$contributions$i2;
365
365
 
366
- 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;
366
+ if ((_this$data$content = this.data.content) !== null && _this$data$content !== void 0 && _this$data$content.text) {
367
+ var _this$data$content$te;
368
+
369
+ 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;
370
+ }
371
+
372
+ 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;
367
373
  }
368
374
  /**
369
375
  * Get assistent of form object