@beinformed/ui 1.27.5 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/esm/constants/LayoutHintConfig.js +0 -9
  3. package/esm/constants/LayoutHintConfig.js.map +1 -1
  4. package/esm/constants/LayoutHints.js +0 -4
  5. package/esm/constants/LayoutHints.js.map +1 -1
  6. package/esm/constants/Settings.js +0 -4
  7. package/esm/constants/Settings.js.map +1 -1
  8. package/esm/hooks/useForm.js.map +1 -1
  9. package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
  10. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  11. package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -2
  12. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  13. package/esm/models/attributes/DatetimeAttributeModel.js +3 -29
  14. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  15. package/esm/react-client/Init.js +2 -2
  16. package/esm/react-client/Init.js.map +1 -1
  17. package/esm/react-client/client.js +80 -52
  18. package/esm/react-client/client.js.map +1 -1
  19. package/esm/redux/_modularui/ModularUIActions.js +7 -0
  20. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  21. package/esm/redux/_modularui/ModularUIReducer.js +1 -0
  22. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  23. package/esm/redux/_modularui/types.js.map +1 -1
  24. package/esm/redux/actions/Form.js +2 -2
  25. package/esm/redux/actions/Form.js.map +1 -1
  26. package/esm/redux/actions/FormAttributeSet.js +2 -2
  27. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  28. package/esm/redux/actions/FormAttributeSetRepeatable.js +4 -4
  29. package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  30. package/esm/redux/actions/FormAutosave.js +2 -2
  31. package/esm/redux/actions/FormAutosave.js.map +1 -1
  32. package/esm/redux/actions/FormValidations.js +2 -2
  33. package/esm/redux/actions/FormValidations.js.map +1 -1
  34. package/esm/redux/connectors/Form.js.map +1 -1
  35. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  36. package/esm/redux/store/configureStore.js +4 -4
  37. package/esm/redux/store/configureStore.js.map +1 -1
  38. package/esm/redux/types.js.map +1 -1
  39. package/lib/constants/LayoutHintConfig.js +0 -9
  40. package/lib/constants/LayoutHintConfig.js.flow +0 -9
  41. package/lib/constants/LayoutHintConfig.js.map +1 -1
  42. package/lib/constants/LayoutHints.js +2 -7
  43. package/lib/constants/LayoutHints.js.flow +0 -4
  44. package/lib/constants/LayoutHints.js.map +1 -1
  45. package/lib/constants/Settings.js +0 -4
  46. package/lib/constants/Settings.js.flow +0 -6
  47. package/lib/constants/Settings.js.map +1 -1
  48. package/lib/hooks/__tests__/useForm.spec.js.flow +4 -4
  49. package/lib/hooks/useForm.js.flow +5 -5
  50. package/lib/hooks/useForm.js.map +1 -1
  51. package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
  52. package/lib/models/attributes/ChoiceAttributeModel.js.flow +1 -0
  53. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  54. package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -2
  55. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +2 -2
  56. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  57. package/lib/models/attributes/DatetimeAttributeModel.js +3 -29
  58. package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -41
  59. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  60. package/lib/models/attributes/__tests__/DateAttributeModel.spec.js.flow +1 -35
  61. package/lib/models/attributes/__tests__/DatetimeAttributeModel.spec.js.flow +158 -216
  62. package/lib/models/attributes/__tests__/TimestampModel.spec.js.flow +0 -5
  63. package/lib/react-client/Init.js +2 -2
  64. package/lib/react-client/Init.js.flow +3 -3
  65. package/lib/react-client/Init.js.map +1 -1
  66. package/lib/react-client/client.js +83 -53
  67. package/lib/react-client/client.js.flow +106 -67
  68. package/lib/react-client/client.js.map +1 -1
  69. package/lib/redux/_modularui/ModularUIActions.js +9 -1
  70. package/lib/redux/_modularui/ModularUIActions.js.flow +8 -0
  71. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  72. package/lib/redux/_modularui/ModularUIReducer.js +1 -0
  73. package/lib/redux/_modularui/ModularUIReducer.js.flow +1 -0
  74. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  75. package/lib/redux/_modularui/types.js.flow +5 -0
  76. package/lib/redux/_modularui/types.js.map +1 -1
  77. package/lib/redux/actions/Form.js +1 -1
  78. package/lib/redux/actions/Form.js.flow +4 -4
  79. package/lib/redux/actions/Form.js.map +1 -1
  80. package/lib/redux/actions/FormAttributeSet.js +1 -1
  81. package/lib/redux/actions/FormAttributeSet.js.flow +3 -2
  82. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  83. package/lib/redux/actions/FormAttributeSetRepeatable.js +3 -3
  84. package/lib/redux/actions/FormAttributeSetRepeatable.js.flow +8 -8
  85. package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  86. package/lib/redux/actions/FormAutosave.js +1 -1
  87. package/lib/redux/actions/FormAutosave.js.flow +2 -2
  88. package/lib/redux/actions/FormAutosave.js.map +1 -1
  89. package/lib/redux/actions/FormValidations.js +1 -1
  90. package/lib/redux/actions/FormValidations.js.flow +2 -2
  91. package/lib/redux/actions/FormValidations.js.map +1 -1
  92. package/lib/redux/actions/__tests__/Form.spec.js.flow +1 -1
  93. package/lib/redux/connectors/Form.js.flow +2 -5
  94. package/lib/redux/connectors/Form.js.map +1 -1
  95. package/lib/redux/connectors/FormAttributeSet.js.flow +5 -5
  96. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  97. package/lib/redux/store/configureStore.js +4 -4
  98. package/lib/redux/store/configureStore.js.flow +5 -5
  99. package/lib/redux/store/configureStore.js.map +1 -1
  100. package/lib/redux/types.js.flow +2 -0
  101. package/lib/redux/types.js.map +1 -1
  102. package/package.json +17 -19
  103. package/src/constants/LayoutHintConfig.js +0 -9
  104. package/src/constants/LayoutHints.js +0 -4
  105. package/src/constants/Settings.js +0 -6
  106. package/src/hooks/__tests__/useForm.spec.js +4 -4
  107. package/src/hooks/useForm.js +5 -5
  108. package/src/models/attributes/ChoiceAttributeModel.js +1 -0
  109. package/src/models/attributes/ChoiceAttributeOptionModel.js +2 -2
  110. package/src/models/attributes/DatetimeAttributeModel.js +7 -41
  111. package/src/models/attributes/__tests__/DateAttributeModel.spec.js +1 -35
  112. package/src/models/attributes/__tests__/DatetimeAttributeModel.spec.js +158 -216
  113. package/src/models/attributes/__tests__/TimestampModel.spec.js +0 -5
  114. package/src/react-client/Init.js +3 -3
  115. package/src/react-client/client.js +106 -67
  116. package/src/redux/_modularui/ModularUIActions.js +8 -0
  117. package/src/redux/_modularui/ModularUIReducer.js +1 -0
  118. package/src/redux/_modularui/types.js +5 -0
  119. package/src/redux/actions/Form.js +4 -4
  120. package/src/redux/actions/FormAttributeSet.js +3 -2
  121. package/src/redux/actions/FormAttributeSetRepeatable.js +8 -8
  122. package/src/redux/actions/FormAutosave.js +2 -2
  123. package/src/redux/actions/FormValidations.js +2 -2
  124. package/src/redux/actions/__tests__/Form.spec.js +1 -1
  125. package/src/redux/connectors/Form.js +2 -5
  126. package/src/redux/connectors/FormAttributeSet.js +5 -5
  127. package/src/redux/store/configureStore.js +5 -5
  128. package/src/redux/types.js +2 -0
  129. package/types/constants/LayoutHintConfig.d.ts +8 -23
  130. package/types/constants/LayoutHints.d.ts +0 -4
  131. package/types/models/actions/ActionCollection.d.ts +1 -1
  132. package/types/models/attributes/DatetimeAttributeModel.d.ts +8 -2
  133. package/types/redux/_modularui/types.d.ts +4 -0
  134. package/types/redux/types.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,22 @@
1
1
  # Changelog
2
2
 
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.
3
+ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
+
5
+ ## [1.28.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.27.6...v1.28.0) (2023-02-20)
6
+
7
+ ### Features
8
+
9
+ - **remove-setting:** settings DATE_INPUT_FORMAT and DATE_READONLY_FORMAT are removed ([4e536bd](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/4e536bde53e0c4e6fefbff459aa99bb492f642b5))
10
+
11
+ ### Bug Fixes
12
+
13
+ - **polyfill:** remove native supported polyfills ([9ebdf11](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/9ebdf1160a9b41c1f14c0aecf6b141beb9b252a7))
14
+
15
+ ### [1.27.6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.27.5...v1.27.6) (2023-02-07)
16
+
17
+ ### Bug Fixes
18
+
19
+ - **redux:** introduce updateForm action for easier debugging ([7e1550b](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/7e1550b6ed8b082a9e87ccdf84067462f6a36cc1))
4
20
 
5
21
  ### [1.27.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.27.4...v1.27.5) (2023-02-07)
6
22
 
@@ -89,15 +89,6 @@ export const LayoutHintConfiguration = {
89
89
  link: "",
90
90
  component: ["attribute/number"]
91
91
  },
92
- IGNORE_FORMAT_SETTING: {
93
- hint: "ignore-format-setting",
94
- description: {
95
- NL: "Maakt het mogelijk om de global date format setting te negeren voor een specifiek attribuut",
96
- EN: "Makes it possible to ignore the global date format for a specific attribute"
97
- },
98
- link: "",
99
- component: ["attribute/date", "attribute/datetime"]
100
- },
101
92
  CREATE_ACTION: {
102
93
  hint: "create",
103
94
  description: {
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutHintConfig.js","names":["LayoutHintConfiguration","MANDATORY","hint","description","NL","EN","link","component","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE_ACTION","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CONFIRM_PASSWORD","TITLE","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","IGNORE_FORMAT_SETTING","CREATE_ACTION","UPDATE_ACTION","DELETE_ACTION","SORT_OPTIONS","CASEVIEW_LINK","DISABLED"],"sources":["../../src/constants/LayoutHintConfig.js"],"sourcesContent":["// @flow\nexport const LayoutHintConfiguration = {\n MANDATORY: {\n hint: \"mandatory\",\n description: {\n NL: \"Geeft aan of een attribuut verplicht is. Dient samen met de dependency hint gebruikt te worden.\",\n EN: \"Indicates a mandatory attribute.\\nShould be used together with the dependency hint.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n DEPENDENT_ATTRIBUTE_CONTROL: {\n hint: \"dependent-control:${unique-control-id}\",\n description: {\n NL: \"Geeft aan dat dit het attribuut is waar attributen van afhankelijk zijn. Het unique-control-id is een uniek id dat kan worden gebruikt in the hint voor de show|hide actie op het afhankelijke attribuut.\",\n EN: \"Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\",\n },\n link: \"\",\n component: [\"attribute/boolean\", \"attribute/choice\"],\n },\n DEPENDENT_ATTRIBUTE_ACTION: {\n hint: \"dependent-attribute:(show|hide) when dependent-control:${unique-control-id} (equals|includes|notEquals|notIncludes) [${codemaps}]\",\n description: {\n NL: \"Toon of verberg een attribute dat afhankelijk is van de geselecteerde opties van een keuze attribute\",\n EN: \"To show or hide an attribute dependent on options of the choice control codemap that are selected or not selected.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n SHOW_ONE_RESULT_AS_DETAIL: {\n hint: \"show-one-result-as-detail\",\n description: {\n NL: \"Een lijst met maar één item mag direct als detail getoond worden.\",\n EN: \"A list with only one detail must be shown as a detail.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n HIDE_WHEN_EMPTY: {\n hint: \"hide-when-empty\",\n description: {\n NL: \"Een lijst zonder lijst-items en lijst-taken dient niet getoond worden.\",\n EN: \"A list without list-items and list-tasks should not be shown.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n INITIAL_FILTER: {\n hint: \"initial-filter:${filter-name}=${initial-value}\",\n description: {\n NL: \"Laad de lijst met een standaardwaarde voor een filter, er is geen controle op het bestaan van het filter. Als het filter niet is geconfigureerd, treedt er een fout op. Houd er rekening mee dat filters hoofdlettergevoelig zijn.\",\n EN: \"Load the list with a default value for a filter, there is no check for the existence of the filter. If the filter is not configured, an error occurs. Keep in mind that filters are case sensitive.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n CONFIRM_PASSWORD: {\n hint: \"confirm-password\",\n description: {\n NL: \"Wachtwoord attribuut moet bevestigd worden dmv een tweede wachtwoord attribuut.\",\n EN: \"Password attribute must be confirmed using a second password attribute.\",\n },\n link: \"\",\n component: [\"attribute/password\"],\n },\n TITLE: {\n hint: \"title\",\n description: {\n NL: \"Markeert een attribuut als een titel attribuut\",\n EN: \"Marks an attribute as a title attribute\",\n },\n link: \"\",\n component: [\n \"caseview_table\",\n \"codemap\",\n \"list/appointment_table\",\n \"list/assignment_table\",\n \"list/caseproperties_table\",\n \"list/document_table\",\n \"list/timelimit_table\",\n \"list/eventhistory_table\",\n \"list/note_table\",\n \"list/record_table\",\n \"list/case_table\",\n \"list/casesearch_table\",\n \"list/datastore_table\",\n \"list/datastoreview_table\",\n \"list/instrumentresult_table\",\n \"list/event_table\",\n \"list/user_table\",\n \"list/organization_table\",\n ],\n },\n INITIAL_TOTAL_FILESIZE: {\n hint: \"initial-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de reeds gebruikte file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n MAX_TOTAL_FILESIZE: {\n hint: \"max-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de maximaal toegestane file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n IGNORE_FORMAT_SETTING: {\n hint: \"ignore-format-setting\",\n description: {\n NL: \"Maakt het mogelijk om de global date format setting te negeren voor een specifiek attribuut\",\n EN: \"Makes it possible to ignore the global date format for a specific attribute\",\n },\n link: \"\",\n component: [\"attribute/date\", \"attribute/datetime\"],\n },\n CREATE_ACTION: {\n hint: \"create\",\n description: {\n NL: \"Markeer taak als creëer taak.\",\n EN: \"Mark task as create task\",\n },\n component: [\"form\"],\n },\n UPDATE_ACTION: {\n hint: \"update\",\n description: {\n NL: \"Markeer taak als bewerk taak.\",\n EN: \"Mark task as update task\",\n },\n component: [\"form\"],\n },\n DELETE_ACTION: {\n hint: \"delete\",\n description: {\n NL: \"Markeer taak als verwijder taak.\",\n EN: \"Mark task as delete task\",\n },\n component: [\"form\"],\n },\n SORT_OPTIONS: {\n hint: \"sort-options\",\n description: {\n NL: \"Sorteer opties alfabetisch\",\n EN: \"Sort options alphabetically\",\n },\n component: [\"attribute/choice\"],\n },\n CASEVIEW_LINK: {\n hint: \"case-view-link\",\n description: {\n NL: \"Markeer een case id reference attribute als de referentie naar de case view. Vervangt de self link van een lijst item\",\n EN: \"Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\",\n },\n component: [\"attribute/reference\", \"list/datastore_table\"],\n },\n DISABLED: {\n hint: \"disabled\",\n description: {\n NL: \"Geeft aan of een attribuut uitgeschakeld is.\",\n EN: \"Indicates a disabled attribute.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n};\n"],"mappings":"AACA,OAAO,MAAMA,uBAAuB,GAAG;EACrCC,SAAS,EAAE;IACTC,IAAI,EAAE,WAAW;IACj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,CAAC,MAAM;EACpB,CAAC;EACDY,aAAa,EAAE;IACbjB,IAAI,EAAE,QAAQ;IACdC,WAAW,EAAE;MACXC,EAAE,EAAE,+BAA+B;MACnCC,EAAE,EAAE;IACN,CAAC;IACDE,SAAS,EAAE,CAAC,MAAM;EACpB,CAAC;EACDa,aAAa,EAAE;IACblB,IAAI,EAAE,QAAQ;IACdC,WAAW,EAAE;MACXC,EAAE,EAAE,kCAAkC;MACtCC,EAAE,EAAE;IACN,CAAC;IACDE,SAAS,EAAE,CAAC,MAAM;EACpB,CAAC;EACDc,YAAY,EAAE;IACZnB,IAAI,EAAE,cAAc;IACpBC,WAAW,EAAE;MACXC,EAAE,EAAE,4BAA4B;MAChCC,EAAE,EAAE;IACN,CAAC;IACDE,SAAS,EAAE,CAAC,kBAAkB;EAChC,CAAC;EACDe,aAAa,EAAE;IACbpB,IAAI,EAAE,gBAAgB;IACtBC,WAAW,EAAE;MACXC,EAAE,EAAE,uHAAuH;MAC3HC,EAAE,EAAE;IACN,CAAC;IACDE,SAAS,EAAE,CAAC,qBAAqB,EAAE,sBAAsB;EAC3D,CAAC;EACDgB,QAAQ,EAAE;IACRrB,IAAI,EAAE,UAAU;IAChBC,WAAW,EAAE;MACXC,EAAE,EAAE,8CAA8C;MAClDC,EAAE,EAAE;IACN,CAAC;IACDC,IAAI,EAAE,EAAE;IACRC,SAAS,EAAE,CAAC,WAAW;EACzB;AACF,CAAC"}
1
+ {"version":3,"file":"LayoutHintConfig.js","names":["LayoutHintConfiguration","MANDATORY","hint","description","NL","EN","link","component","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE_ACTION","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CONFIRM_PASSWORD","TITLE","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","CREATE_ACTION","UPDATE_ACTION","DELETE_ACTION","SORT_OPTIONS","CASEVIEW_LINK","DISABLED"],"sources":["../../src/constants/LayoutHintConfig.js"],"sourcesContent":["// @flow\nexport const LayoutHintConfiguration = {\n MANDATORY: {\n hint: \"mandatory\",\n description: {\n NL: \"Geeft aan of een attribuut verplicht is. Dient samen met de dependency hint gebruikt te worden.\",\n EN: \"Indicates a mandatory attribute.\\nShould be used together with the dependency hint.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n DEPENDENT_ATTRIBUTE_CONTROL: {\n hint: \"dependent-control:${unique-control-id}\",\n description: {\n NL: \"Geeft aan dat dit het attribuut is waar attributen van afhankelijk zijn. Het unique-control-id is een uniek id dat kan worden gebruikt in the hint voor de show|hide actie op het afhankelijke attribuut.\",\n EN: \"Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\",\n },\n link: \"\",\n component: [\"attribute/boolean\", \"attribute/choice\"],\n },\n DEPENDENT_ATTRIBUTE_ACTION: {\n hint: \"dependent-attribute:(show|hide) when dependent-control:${unique-control-id} (equals|includes|notEquals|notIncludes) [${codemaps}]\",\n description: {\n NL: \"Toon of verberg een attribute dat afhankelijk is van de geselecteerde opties van een keuze attribute\",\n EN: \"To show or hide an attribute dependent on options of the choice control codemap that are selected or not selected.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n SHOW_ONE_RESULT_AS_DETAIL: {\n hint: \"show-one-result-as-detail\",\n description: {\n NL: \"Een lijst met maar één item mag direct als detail getoond worden.\",\n EN: \"A list with only one detail must be shown as a detail.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n HIDE_WHEN_EMPTY: {\n hint: \"hide-when-empty\",\n description: {\n NL: \"Een lijst zonder lijst-items en lijst-taken dient niet getoond worden.\",\n EN: \"A list without list-items and list-tasks should not be shown.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n INITIAL_FILTER: {\n hint: \"initial-filter:${filter-name}=${initial-value}\",\n description: {\n NL: \"Laad de lijst met een standaardwaarde voor een filter, er is geen controle op het bestaan van het filter. Als het filter niet is geconfigureerd, treedt er een fout op. Houd er rekening mee dat filters hoofdlettergevoelig zijn.\",\n EN: \"Load the list with a default value for a filter, there is no check for the existence of the filter. If the filter is not configured, an error occurs. Keep in mind that filters are case sensitive.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n CONFIRM_PASSWORD: {\n hint: \"confirm-password\",\n description: {\n NL: \"Wachtwoord attribuut moet bevestigd worden dmv een tweede wachtwoord attribuut.\",\n EN: \"Password attribute must be confirmed using a second password attribute.\",\n },\n link: \"\",\n component: [\"attribute/password\"],\n },\n TITLE: {\n hint: \"title\",\n description: {\n NL: \"Markeert een attribuut als een titel attribuut\",\n EN: \"Marks an attribute as a title attribute\",\n },\n link: \"\",\n component: [\n \"caseview_table\",\n \"codemap\",\n \"list/appointment_table\",\n \"list/assignment_table\",\n \"list/caseproperties_table\",\n \"list/document_table\",\n \"list/timelimit_table\",\n \"list/eventhistory_table\",\n \"list/note_table\",\n \"list/record_table\",\n \"list/case_table\",\n \"list/casesearch_table\",\n \"list/datastore_table\",\n \"list/datastoreview_table\",\n \"list/instrumentresult_table\",\n \"list/event_table\",\n \"list/user_table\",\n \"list/organization_table\",\n ],\n },\n INITIAL_TOTAL_FILESIZE: {\n hint: \"initial-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de reeds gebruikte file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n MAX_TOTAL_FILESIZE: {\n hint: \"max-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de maximaal toegestane file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n CREATE_ACTION: {\n hint: \"create\",\n description: {\n NL: \"Markeer taak als creëer taak.\",\n EN: \"Mark task as create task\",\n },\n component: [\"form\"],\n },\n UPDATE_ACTION: {\n hint: \"update\",\n description: {\n NL: \"Markeer taak als bewerk taak.\",\n EN: \"Mark task as update task\",\n },\n component: [\"form\"],\n },\n DELETE_ACTION: {\n hint: \"delete\",\n description: {\n NL: \"Markeer taak als verwijder taak.\",\n EN: \"Mark task as delete task\",\n },\n component: [\"form\"],\n },\n SORT_OPTIONS: {\n hint: \"sort-options\",\n description: {\n NL: \"Sorteer opties alfabetisch\",\n EN: \"Sort options alphabetically\",\n },\n component: [\"attribute/choice\"],\n },\n CASEVIEW_LINK: {\n hint: \"case-view-link\",\n description: {\n NL: \"Markeer een case id reference attribute als de referentie naar de case view. Vervangt de self link van een lijst item\",\n EN: \"Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\",\n },\n component: [\"attribute/reference\", \"list/datastore_table\"],\n },\n DISABLED: {\n hint: \"disabled\",\n description: {\n NL: \"Geeft aan of een attribuut uitgeschakeld is.\",\n EN: \"Indicates a disabled attribute.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n};\n"],"mappings":"AACA,OAAO,MAAMA,uBAAuB,GAAG;EACrCC,SAAS,EAAE;IACTC,IAAI,EAAE,WAAW;IACjBC,WAAW,EAAE;MACXC,EAAE,EAAE,iGAAiG;MACrGC,EAAE,EAAE;IACN,CAAC;IACDC,IAAI,EAAE,EAAE;IACRC,SAAS,EAAE,CAAC,WAAW;EACzB,CAAC;EACDC,2BAA2B,EAAE;IAC3BN,IAAI,EAAE,wCAAwC;IAC9CC,WAAW,EAAE;MACXC,EAAE,EAAE,2MAA2M;MAC/MC,EAAE,EAAE;IACN,CAAC;IACDC,IAAI,EAAE,EAAE;IACRC,SAAS,EAAE,CAAC,mBAAmB,EAAE,kBAAkB;EACrD,CAAC;EACDE,0BAA0B,EAAE;IAC1BP,IAAI,EAAE,mIAAmI;IACzIC,WAAW,EAAE;MACXC,EAAE,EAAE,sGAAsG;MAC1GC,EAAE,EAAE;IACN,CAAC;IACDC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AAC;EACDe,QAAQ,EAAE;IACRpB,IAAI,EAAE,UAAU;IAChBC,WAAW,EAAE;MACXC,EAAE,EAAE,8CAA8C;MAClDC,EAAE,EAAE;IACN,CAAC;IACDC,IAAI,EAAE,EAAE;IACRC,SAAS,EAAE,CAAC,WAAW;EACzB;AACF,CAAC"}
@@ -51,10 +51,6 @@ export const SORT_OPTIONS = getHint("SORT_OPTIONS");
51
51
  * Layout-hint: Marks an attribute as a title attribute
52
52
  */
53
53
  export const TITLE = getHint("TITLE");
54
- /**
55
- * Layout-hint: Ignore the global input format for specific attribute
56
- */
57
- export const IGNORE_FORMAT_SETTING = getHint("IGNORE_FORMAT_SETTING");
58
54
 
59
55
  /*
60
56
  * --------------------------------
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutHints.js","names":["LayoutHintConfiguration","getHint","hint","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","IGNORE_FORMAT_SETTING","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"sources":["../../src/constants/LayoutHints.js"],"sourcesContent":["// @flow\nimport { LayoutHintConfiguration } from \"./LayoutHintConfig\";\n\n/**\n * Retrieve layout hint by id from the layout hint configuration\n */\nconst getHint = (hint: string): string => {\n if (LayoutHintConfiguration[hint]) {\n return LayoutHintConfiguration[hint].hint;\n }\n\n return \"\";\n};\n\n/**\n * Layout-hint: Indicates a mandatory attribute. Should be used together with the dependency hint.\n */\nexport const MANDATORY: string = getHint(\"MANDATORY\");\n\n/**\n * Layout-hint: Indicates a disabled attribute.\n * @constant\n */\nexport const DISABLED: string = getHint(\"DISABLED\");\n\n/*\n * --------------------------------\n * SELECT DEPENDENT ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\n */\nexport const DEPENDENT_ATTRIBUTE_CONTROL = \"dependent-control\";\n/**\n */\nexport const DEPENDENT_ATTRIBUTE = \"dependent-attribute:\";\n\n/*\n * --------------------------------\n * ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Password attribute must be confirmed using a second password attribute.\n */\nexport const CONFIRM_PASSWORD: string = getHint(\"CONFIRM_PASSWORD\");\n/**\n * Layout-hint: Sort options alphabetically\n */\nexport const SORT_OPTIONS: string = getHint(\"SORT_OPTIONS\");\n/**\n * Layout-hint: Marks an attribute as a title attribute\n */\nexport const TITLE: string = getHint(\"TITLE\");\n/**\n * Layout-hint: Ignore the global input format for specific attribute\n */\nexport const IGNORE_FORMAT_SETTING: string = getHint(\"IGNORE_FORMAT_SETTING\");\n\n/*\n * --------------------------------\n * FORM\n * --------------------------------\n */\n/**\n * Layout-hint: Mark task as delete task\n */\nexport const DELETE_ACTION: string = getHint(\"DELETE_ACTION\");\n/**\n * Layout-hint: Mark task as update task\n */\nexport const UPDATE_ACTION: string = getHint(\"UPDATE_ACTION\");\n/**\n * Layout-hint: Mark task as create task\n */\nexport const CREATE_ACTION: string = getHint(\"CREATE_ACTION\");\n\n/*\n * --------------------------------\n * UPLOAD TOTAL FILE SIZE\n * --------------------------------\n */\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\n */\nexport const INITIAL_TOTAL_FILESIZE: string = getHint(\"INITIAL_TOTAL_FILESIZE\");\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\n */\nexport const MAX_TOTAL_FILESIZE: string = getHint(\"MAX_TOTAL_FILESIZE\");\n\n/*\n * --------------------------------\n * LISTS\n * --------------------------------\n */\n/**\n * Layout-hint: A list with only one detail must be shown as a detail\n */\nexport const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(\n \"SHOW_ONE_RESULT_AS_DETAIL\"\n);\n/**\n * Layout-hint: A list without list-items and list-tasks should not be shown.\n */\nexport const HIDE_WHEN_EMPTY: string = getHint(\"HIDE_WHEN_EMPTY\");\n/**\n * Layout-hint: Sets a default value on a filter\n */\nexport const INITIAL_FILTER: string = \"initial-filter:\";\n/**\n * Layout-hint: Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\n */\nexport const CASEVIEW_LINK: string = getHint(\"CASEVIEW_LINK\");\n\n/**\n * Layout-hint: Set on configuration of instruments to show content in a popover on a label\n */\nexport const RENDER_SECTION_LABEL = \"render-section-label\";\n\n/**\n */\nexport const getLayoutHintConfiguration = (): Object => LayoutHintConfiguration;\n\nexport default getHint;\n"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,oBAAoB;;AAE5D;AACA;AACA;AACA,MAAMC,OAAO,GAAIC,IAAY,IAAa;EACxC,IAAIF,uBAAuB,CAACE,IAAI,CAAC,EAAE;IACjC,OAAOF,uBAAuB,CAACE,IAAI,CAAC,CAACA,IAAI;EAC3C;EAEA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,SAAiB,GAAGF,OAAO,CAAC,WAAW,CAAC;;AAErD;AACA;AACA;AACA;AACA,OAAO,MAAMG,QAAgB,GAAGH,OAAO,CAAC,UAAU,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,2BAA2B,GAAG,mBAAmB;AAC9D;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAwB,GAAGN,OAAO,CAAC,kBAAkB,CAAC;AACnE;AACA;AACA;AACA,OAAO,MAAMO,YAAoB,GAAGP,OAAO,CAAC,cAAc,CAAC;AAC3D;AACA;AACA;AACA,OAAO,MAAMQ,KAAa,GAAGR,OAAO,CAAC,OAAO,CAAC;AAC7C;AACA;AACA;AACA,OAAO,MAAMS,qBAA6B,GAAGT,OAAO,CAAC,uBAAuB,CAAC;;AAE7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMU,aAAqB,GAAGV,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AACA,OAAO,MAAMW,aAAqB,GAAGX,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AACA,OAAO,MAAMY,aAAqB,GAAGZ,OAAO,CAAC,eAAe,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMa,sBAA8B,GAAGb,OAAO,CAAC,wBAAwB,CAAC;AAC/E;AACA;AACA;AACA,OAAO,MAAMc,kBAA0B,GAAGd,OAAO,CAAC,oBAAoB,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMe,yBAAiC,GAAGf,OAAO,CACtD,2BAA2B,CAC5B;AACD;AACA;AACA;AACA,OAAO,MAAMgB,eAAuB,GAAGhB,OAAO,CAAC,iBAAiB,CAAC;AACjE;AACA;AACA;AACA,OAAO,MAAMiB,cAAsB,GAAG,iBAAiB;AACvD;AACA;AACA;AACA,OAAO,MAAMC,aAAqB,GAAGlB,OAAO,CAAC,eAAe,CAAC;;AAE7D;AACA;AACA;AACA,OAAO,MAAMmB,oBAAoB,GAAG,sBAAsB;;AAE1D;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAG,MAAcrB,uBAAuB;AAE/E,eAAeC,OAAO"}
1
+ {"version":3,"file":"LayoutHints.js","names":["LayoutHintConfiguration","getHint","hint","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"sources":["../../src/constants/LayoutHints.js"],"sourcesContent":["// @flow\nimport { LayoutHintConfiguration } from \"./LayoutHintConfig\";\n\n/**\n * Retrieve layout hint by id from the layout hint configuration\n */\nconst getHint = (hint: string): string => {\n if (LayoutHintConfiguration[hint]) {\n return LayoutHintConfiguration[hint].hint;\n }\n\n return \"\";\n};\n\n/**\n * Layout-hint: Indicates a mandatory attribute. Should be used together with the dependency hint.\n */\nexport const MANDATORY: string = getHint(\"MANDATORY\");\n\n/**\n * Layout-hint: Indicates a disabled attribute.\n * @constant\n */\nexport const DISABLED: string = getHint(\"DISABLED\");\n\n/*\n * --------------------------------\n * SELECT DEPENDENT ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\n */\nexport const DEPENDENT_ATTRIBUTE_CONTROL = \"dependent-control\";\n/**\n */\nexport const DEPENDENT_ATTRIBUTE = \"dependent-attribute:\";\n\n/*\n * --------------------------------\n * ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Password attribute must be confirmed using a second password attribute.\n */\nexport const CONFIRM_PASSWORD: string = getHint(\"CONFIRM_PASSWORD\");\n/**\n * Layout-hint: Sort options alphabetically\n */\nexport const SORT_OPTIONS: string = getHint(\"SORT_OPTIONS\");\n/**\n * Layout-hint: Marks an attribute as a title attribute\n */\nexport const TITLE: string = getHint(\"TITLE\");\n\n/*\n * --------------------------------\n * FORM\n * --------------------------------\n */\n/**\n * Layout-hint: Mark task as delete task\n */\nexport const DELETE_ACTION: string = getHint(\"DELETE_ACTION\");\n/**\n * Layout-hint: Mark task as update task\n */\nexport const UPDATE_ACTION: string = getHint(\"UPDATE_ACTION\");\n/**\n * Layout-hint: Mark task as create task\n */\nexport const CREATE_ACTION: string = getHint(\"CREATE_ACTION\");\n\n/*\n * --------------------------------\n * UPLOAD TOTAL FILE SIZE\n * --------------------------------\n */\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\n */\nexport const INITIAL_TOTAL_FILESIZE: string = getHint(\"INITIAL_TOTAL_FILESIZE\");\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\n */\nexport const MAX_TOTAL_FILESIZE: string = getHint(\"MAX_TOTAL_FILESIZE\");\n\n/*\n * --------------------------------\n * LISTS\n * --------------------------------\n */\n/**\n * Layout-hint: A list with only one detail must be shown as a detail\n */\nexport const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(\n \"SHOW_ONE_RESULT_AS_DETAIL\"\n);\n/**\n * Layout-hint: A list without list-items and list-tasks should not be shown.\n */\nexport const HIDE_WHEN_EMPTY: string = getHint(\"HIDE_WHEN_EMPTY\");\n/**\n * Layout-hint: Sets a default value on a filter\n */\nexport const INITIAL_FILTER: string = \"initial-filter:\";\n/**\n * Layout-hint: Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\n */\nexport const CASEVIEW_LINK: string = getHint(\"CASEVIEW_LINK\");\n\n/**\n * Layout-hint: Set on configuration of instruments to show content in a popover on a label\n */\nexport const RENDER_SECTION_LABEL = \"render-section-label\";\n\n/**\n */\nexport const getLayoutHintConfiguration = (): Object => LayoutHintConfiguration;\n\nexport default getHint;\n"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,oBAAoB;;AAE5D;AACA;AACA;AACA,MAAMC,OAAO,GAAIC,IAAY,IAAa;EACxC,IAAIF,uBAAuB,CAACE,IAAI,CAAC,EAAE;IACjC,OAAOF,uBAAuB,CAACE,IAAI,CAAC,CAACA,IAAI;EAC3C;EAEA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,SAAiB,GAAGF,OAAO,CAAC,WAAW,CAAC;;AAErD;AACA;AACA;AACA;AACA,OAA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;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAG,MAAcpB,uBAAuB;AAE/E,eAAeC,OAAO"}
@@ -51,10 +51,6 @@ const defaultSettings = {
51
51
  BUSINESS_SCENARIO_CONCEPT_TYPE: ["/Library/KMTs/Business scenarios.bixml/BusinessScenario"],
52
52
  BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: ["/Library/KMTs/Business scenarios.bixml/ScenarioStep"],
53
53
  BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: ["/Library/KMTs/Business scenarios.bixml/Persona"],
54
- // Input format for dates. Without this setting having a value, the contributions format is used
55
- DATE_INPUT_FORMAT: "",
56
- // Readonly format for dates. Without this setting having a value, the contributions format is used
57
- DATE_READONLY_FORMAT: "",
58
54
  // indicates on what day the week starts (0 = Sunday)
59
55
  CALENDAR_WEEK_STARTS_ON: 1,
60
56
  // indicates which date indicates the first week of the year
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (): string => `${getBasePath()}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (): string => `${getBasePath()}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/callback?client_name=FormClient\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\"\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG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,EAAE,IAAI,CAAC;;AAE/C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM+D,SAAS,GAAG,MACvBb,UAAU,CAAChD,UAAU,EAAED,mBAAmB,CAAC+D,IAAI,CAAC;;AAElD;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MACvBf,UAAU,CAAC/C,kBAAkB,EAAE,kCAAkC,CAAC;AACpE;AACA;AACA,OAAO,MAAM+D,kBAAkB,GAAG,MAChChB,UAAU,CAAC9C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAM+D,kBAAkB,GAAG,MAChCjB,UAAU,CAAC7C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAM+D,UAAU,GAAG,MACxBlB,UAAU,CAAC5C,mBAAmB,EAAE,SAAS,CAAC;AAE5C,OAAO,MAAMuB,UAAkB,GAAGoC,SAAS,EAAE;AAC7C,OAAO,MAAMlC,WAAmB,GAAGqC,UAAU,EAAE;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAG,MAAM;EAC3D,IAAIC,cAAc,GAAGpB,UAAU,CAC7B,iCAAiC,EACjC,kCAAkC,CACnC;EACD,IAAI,CAAC,4BAAAoB,cAAc,OAAdA,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAI,IAAGA,cAAe,EAAC;EACvC;EACA,OAAOvE,wBAAwB,CAACuE,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,IAAY,GAAGZ,WAAW,EAAE"}
1
+ {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (): string => `${getBasePath()}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (): string => `${getBasePath()}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/callback?client_name=FormClient\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\"\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wB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AC;;AAE3E;AACA;AACA;AACA,OAAO,MAAMoD,cAAc,GAAG,MAAe,GAAEF,WAAW,EAAG,GAAEjD,YAAa,EAAC;;AAE7E;AACA;AACA,OAAO,MAAMoD,mBAAmB,GAAG,MACjCZ,UAAU,CAAChD,2BAA2B,EAAE,IAAI,CAAC;;AAE/C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM6D,SAAS,GAAG,MACvBb,UAAU,CAAC9C,UAAU,EAAED,mBAAmB,CAAC6D,IAAI,CAAC;;AAElD;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MACvBf,UAAU,CAAC7C,kBAAkB,EAAE,kCAAkC,CAAC;AACpE;AACA;AACA,OAAO,MAAM6D,kBAAkB,GAAG,MAChChB,UAAU,CAAC5C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAM6D,kBAAkB,GAAG,MAChCjB,UAAU,CAAC3C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAM6D,UAAU,GAAG,MACxBlB,UAAU,CAAC1C,mBAAmB,EAAE,SAAS,CAAC;AAE5C,OAAO,MAAMuB,UAAkB,GAAGkC,SAAS,EAAE;AAC7C,OAAO,MAAMhC,WAAmB,GAAGmC,UAAU,EAAE;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAG,MAAM;EAC3D,IAAIC,cAAc,GAAGpB,UAAU,CAC7B,iCAAiC,EACjC,kCAAkC,CACnC;EACD,IAAI,CAAC,4BAAAoB,cAAc,OAAdA,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAI,IAAGA,cAAe,EAAC;EACvC;EACA,OAAOrE,wBAAwB,CAACqE,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,IAAY,GAAGZ,WAAW,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"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"],"sources":["../../src/hooks/useForm.js"],"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, 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"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,OAAOC,IAAI,MAAM,qBAAqB;AAEtC,SAASC,UAAU,EAAEC,YAAY,QAAQ,cAAc;AAEvD,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,qBAAqB;AACrE,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SACEC,yBAAyB,EACzBC,UAAU,EACVC,4BAA4B,EAC5BC,cAAc,EACdC,4BAA4B,EAC5BC,oBAAoB,EACpBC,mBAAmB,QACd,kBAAkB;AAE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B,CAACO,IAAI,CAAC,CAAC;EAEtC,OAAO;IACLQ,QAAQ;IACRC,MAAM;IACNC,MAAM;IACNM,MAAM;IACNvB,oBAAoB,EAAEwB;EACxB,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,CAChClB,IAAe,EACfmB,MAAuB,KACC;EACxB,MAAMZ,QAAQ,GAAG1B,WAAW,EAAE;EAE9B,OAAO,CACLuC,SAAwB,EACxBC,KAAa,EACbC,OAA0B,KACvBf,QAAQ,CAACb,mBAAmB,CAACM,IAAI,EAAEmB,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,CAAC,CAAC;AAC7E,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAIvB,IAAe,IAAuB;EACpE,MAAMO,QAAQ,GAAG1B,WAAW,EAAE;EAE9B,OAAO;IACL2C,IAAI,EAAE,MAAMjB,QAAQ,CAACnB,yBAAyB,CAACY,IAAI,CAAC,CAAC;IACrDS,MAAM,EAAGU,MAAuB,IAC9BZ,QAAQ,CAACjB,4BAA4B,CAACU,IAAI,EAAEmB,MAAM,CAAC,CAAC;IACtDH,MAAM,EAAGG,MAAuB,IAC9BZ,QAAQ,CAACf,4BAA4B,CAACQ,IAAI,EAAEmB,MAAM,CAAC;EACvD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"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"],"sources":["../../src/hooks/useForm.js"],"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, AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\nimport type {\n RemoveModelByKeyAction,\n UpdateFormAction,\n} from \"../redux/_modularui\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateFormAction,\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: () => UpdateFormAction,\n cancel: (object: FormObjectModel) => UpdateFormAction,\n remove: (object: FormObjectModel) => UpdateFormAction,\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"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,OAAOC,IAAI,MAAM,qBAAqB;AAEtC,SAASC,UAAU,EAAEC,YAAY,QAAQ,cAAc;AAEvD,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,qBAAqB;AACrE,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SACEC,yBAAyB,EACzBC,UAAU,EACVC,4BAA4B,EAC5BC,cAAc,EACdC,4BAA4B,EAC5BC,oBAAoB,EACpBC,mBAAmB,QACd,kBAAkB;AAEzB,OAAOC,SAAS,MAAM,0BAA0B;AA6BhD;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAIC,IAAmB,IAAiB;EAC1D,MAAMC,QAAQ,GAAG,IAAIhB,IAAI,CAACe,IAAI,CAAC;EAE/B,IAAI,CAACd,UAAU,CAAC,oBAAoB,CAAC,EAAE;IACrCe,QAAQ,CAACC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC1C;EAEA,MAAMC,IAAI,GAAGb,YAAY,CAAC,MAA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KACvBf,QAAQ,CAACb,mBAAmB,CAACM,IAAI,EAAEmB,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,CAAC,CAAC;AAC7E,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAIvB,IAAe,IAAuB;EACpE,MAAMO,QAAQ,GAAG1B,WAAW,EAAE;EAE9B,OAAO;IACL2C,IAAI,EAAE,MAAMjB,QAAQ,CAACnB,yBAAyB,CAACY,IAAI,CAAC,CAAC;IACrDS,MAAM,EAAGU,MAAuB,IAC9BZ,QAAQ,CAACjB,4BAA4B,CAACU,IAAI,EAAEmB,MAAM,CAAC,CAAC;IACtDH,MAAM,EAAGG,MAAuB,IAC9BZ,QAAQ,CAACf,4BAA4B,CAACQ,IAAI,EAAEmB,MAAM,CAAC;EACvD,CAAC;AACH,CAAC"}
@@ -263,6 +263,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
263
263
  }
264
264
  values.forEach(val => {
265
265
  if (val instanceof ChoiceAttributeOptionModel) {
266
+ // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options
266
267
  if (!this.options.some(option => option.equals(val))) {
267
268
  this.options.add(val);
268
269
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceAttributeModel.js","names":["has","DateUtil","AttributeModel","ChoiceAttributeOptionCollection","ChoiceAttributeOptionModel","ContentConfigurationElements","RENDER_SECTION_LABEL","SORT_OPTIONS","ATTRIBUTE_WIDTH","ChoiceAttributeModel","constructor","attribute","attributeContributions","_referenceDate","getData","now","_options","create","referenceDate","layouthint","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","conceptLinkHref","href","concept","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","option","code","readonlyvalue","join","initvalue","Array","isArray","_initvalue","length","getValue","hasValue","getInputValue","toggleOption","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","opt","choicetype","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","equals","add","toString","_hasContentConfiguration","contentConfiguration","content","optionElements","optionElementConfig","optionElement","contentElement","placeholder","addServerError","error","id","message","properties","ANSWER_OPTION_KEY","optionKey","foundOption","getContentConfiguredLabel","_errorCollection","readonlyWidth","SMALL","MEDIUM"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref)\n );\n }\n\n this.options.setChildModels(models);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(oldAttribute: AttributeType) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(oldAttribute.options, this.type === \"lookup\");\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (val instanceof ChoiceAttributeOptionModel) {\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n }\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"lookup\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AACjD,SAASC,QAAQ,QAAQ,mCAAmC;AAE5D,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,+BAA+B,MAAM,mCAAmC;AAC/E,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,OAAOC,4BAA4B,MAAM,sDAAsD;AAE/F,SACEC,oBAAoB,EACpBC,YAAY,QACP,6BAA6B;AACpC,SAASC,eAAe,QAAQ,iBAAiB;AAKjD;AACA;AACA;AACA,eAAe,MAAMC,oBAAoB,SAASP,cAAc,CAAC;EAK/D;AACF;AACA;EACEQ,WAAW,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAAC;IAAA;IAAA;IAEzC,IAAI,CAACC,cAAc,GAAG,IAAI,CAACC,OAAO,CAAC,eAAe,EAAEb,QAAQ,CAACc,GAAG,EAAE,CAAC;IACnE,IAAI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ACrC,MAAM;MAAEC,EAAE;MAAEC,OAAO;MAAEC,UAAU;MAAEtF;IAAW,CAAC,GAAGmF,KAAK;IAErD,MAAMI,iBAAiB,GAAG,mBAAmB;IAE7C,IAAID,UAAU,IAAIzG,GAAG,CAACyG,UAAU,EAAEC,iBAAiB,CAAC,EAAE;MAAA;MACpD,MAAMC,SAAS,GAAGF,UAAU,CAACC,iBAAiB,CAAC;MAC/C,MAAME,WAAW,GAAG,sCAAI,CAACzE,OAAO,kBAC7Be,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKwD,SAAS,CACtC;MACD,IAAIC,WAAW,EAAE;QACfH,UAAU,CAACC,iBAAiB,CAAC,GAAGE,WAAW,CAACC,yBAAyB,CACnE,IAAI,CAACf,oBAAoB,CAC1B;MACH;IACF;IAEA,IAAI,CAACgB,gBAAgB,CAACT,cAAc,CAACE,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAEtF,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAI4F,aAAa,GAAkC;IACjD,IAAI,IAAI,CAACxF,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAOf,eAAe,CAACwG,KAAK;IAC9B;IAEA,OAAOxG,eAAe,CAACyG,MAAM;EAC/B;AACF"}
1
+ {"version":3,"file":"ChoiceAttributeModel.js","names":["has","DateUtil","AttributeModel","ChoiceAttributeOptionCollection","ChoiceAttributeOptionModel","ContentConfigurationElements","RENDER_SECTION_LABEL","SORT_OPTIONS","ATTRIBUTE_WIDTH","ChoiceAttributeModel","constructor","attribute","attributeContributions","_referenceDate","getData","now","_options","create","referenceDate","layouthint","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","conceptLinkHref","href","concept","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","option","code","readonlyvalue","join","initvalue","Array","isArray","_initvalue","length","getValue","hasValue","getInputValue","toggleOption","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","opt","choicetype","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","equals","add","toString","_hasContentConfiguration","contentConfiguration","content","optionElements","optionElementConfig","optionElement","contentElement","placeholder","addServerError","error","id","message","properties","ANSWER_OPTION_KEY","optionKey","foundOption","getContentConfiguredLabel","_errorCollection","readonlyWidth","SMALL","MEDIUM"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref)\n );\n }\n\n this.options.setChildModels(models);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(oldAttribute: AttributeType) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(oldAttribute.options, this.type === \"lookup\");\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (val instanceof ChoiceAttributeOptionModel) {\n // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n }\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"lookup\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AACjD,SAASC,QAAQ,QAAQ,mCAAmC;AAE5D,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,+BAA+B,MAAM,mCAAmC;AAC/E,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,OAAOC,4BAA4B,MAAM,sDAAsD;AAE/F,SACEC,oBAAoB,EACpBC,YAAY,QACP,6BAA6B;AACpC,SAASC,eAAe,QAAQ,iBAAiB;AAKjD;AACA;AACA;AACA,eAAe,MAAMC,oBAAoB,SAASP,cAAc,CAAC;EAK/D;AACF;AACA;EACEQ,WAAW,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAAC;IAAA;IAAA;IAEzC,IAAI,CAACC,cAAc,GAAG,IAAI,CAACC,OAA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EAAE,CAAC;EAChD;;EAEA;AACF;AACA;EACE4E,cAAc,CAACC,KAAsB,EAAE;IACrC,MAAM;MAAEC,EAAE;MAAEC,OAAO;MAAEC,UAAU;MAAEtF;IAAW,CAAC,GAAGmF,KAAK;IAErD,MAAMI,iBAAiB,GAAG,mBAAmB;IAE7C,IAAID,UAAU,IAAIzG,GAAG,CAACyG,UAAU,EAAEC,iBAAiB,CAAC,EAAE;MAAA;MACpD,MAAMC,SAAS,GAAGF,UAAU,CAACC,iBAAiB,CAAC;MAC/C,MAAME,WAAW,GAAG,sCAAI,CAACzE,OAAO,kBAC7Be,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKwD,SAAS,CACtC;MACD,IAAIC,WAAW,EAAE;QACfH,UAAU,CAACC,iBAAiB,CAAC,GAAGE,WAAW,CAACC,yBAAyB,CACnE,IAAI,CAACf,oBAAoB,CAC1B;MACH;IACF;IAEA,IAAI,CAACgB,gBAAgB,CAACT,cAAc,CAACE,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAEtF,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAI4F,aAAa,GAAkC;IACjD,IAAI,IAAI,CAACxF,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAOf,eAAe,CAACwG,KAAK;IAC9B;IAEA,OAAOxG,eAAe,CAACyG,MAAM;EAC/B;AACF"}
@@ -48,8 +48,8 @@ class ChoiceAttributeOptionModel extends BaseModel {
48
48
  static createFromListItemModel(listitem) {
49
49
  const option = new ChoiceAttributeOptionModel();
50
50
  option.code = listitem.id.toString();
51
- option.attributeCollection = listitem.attributeCollection;
52
- option.links = listitem.links;
51
+ option.attributeCollection = listitem.attributeCollection.clone();
52
+ option.links = listitem.links.clone();
53
53
  return option;
54
54
  }
55
55
 
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceAttributeOptionModel.js","names":["BaseModel","ChoiceAttributeOptionCollection","DateUtil","has","TIMEVERSION_FILTER_NAME","TITLE","hasAllContentInData","LinkCollection","AttributeCollection","ConceptDetailModel","AttributeContent","ChoiceAttributeOptionModel","constructor","selectedValues","option","referenceDate","now","code","contributions","key","_isSelected","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","_content","content","createFromListItemModel","listitem","id","toString","attributeCollection","links","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","_code","equals","getContribution","data","label","hasItems","title","getAttributeByLayoutHint","readonlyvalue","first","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","length","configuredLabels","getLabelElementByIds","configuredLabel","value","configuredLabelProperty","some","_id","selected","count","create","options","date","getLinkByKey","addParameter","isCacheable","_concept","level","isBooleanType","hasAlternativeLabel","mergeOption","withOption","mergeOptions"],"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { has } from \"../../utils/helpers/objects\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\nimport AttributeContent from \"./AttributeContent\";\n\nimport type { IModelWithChildModels, ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n */\nclass ChoiceAttributeOptionModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate = referenceDate;\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection();\n this._children = this.addChildren(selectedValues, option, referenceDate);\n\n this._links = new LinkCollection(this.contributions._links);\n\n this._content = new AttributeContent(option.content);\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection;\n option.links = listitem.links;\n\n return option;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref)\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, true);\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n if (this.attributeCollection.first) {\n return this.attributeCollection.first.readonlyvalue;\n }\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\"\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection();\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n referenceDate\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"mappings":";;;;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,+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ACE,IAAInC,OAAO,CAACA,OAAwB,EAAE;IACpC,IAAI,CAACmC,QAAQ,GAAGnC,OAAO,YAAYrC,kBAAkB,GAAGqC,OAAO,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;EACE,IAAIoC,KAAK,GAAW;IAClB,OAAO,IAAI,CAAC5D,MAAM;EACpB;;EAEA;AACF;AACA;EACE,IAAI4D,KAAK,CAACA,KAAa,EAAE;IACvB,IAAI,CAAC5D,MAAM,GAAG4D,KAAK;EACrB;;EAEA;AACF;EACE,IAAIC,aAAa,GAAY;IAC3B,OAAO,IAAI,CAAC/B,eAAe,CAAC,eAAe,EAAE,KAAK,CAAC;EACrD;;EAEA;AACF;EACE,IAAIgC,mBAAmB,GAAY;IACjC,OAAO,IAAI,CAAChC,eAAe,CAAC,qBAAqB,EAAE,KAAK,CAAC;EAC3D;;EAEA;AACF;EACEiC,WAAW,CAACC,UAAsC,EAAE;IAClD,IAAI,CAACxC,OAAO,GAAGwC,UAAU,CAACxC,OAAO;IAEjC,IAAI,IAAI,CAACL,QAAQ,IAAI,IAAI,IAAI6C,UAAU,CAAC7C,QAAQ,IAAI,IAAI,EAAE;MACxD,IAAI,CAACA,QAAQ,CAAC8C,YAAY,CAACD,UAAU,CAAC7C,QAAQ,CAAC;IACjD;EACF;;EAEA;AACF;AACA;EACE,IAAIH,kBAAkB,GAAY;IAChC,OAAOhC,mBAAmB,EAAE;EAC9B;;EAEA;AACF;EACE,IAAIuB,OAAO,GAAqB;IAC9B,OAAO,IAAI,CAACD,QAAQ;EACtB;AACF;AAEA,eAAejB,0BAA0B"}
1
+ {"version":3,"file":"ChoiceAttributeOptionModel.js","names":["BaseModel","ChoiceAttributeOptionCollection","DateUtil","has","TIMEVERSION_FILTER_NAME","TITLE","hasAllContentInData","LinkCollection","AttributeCollection","ConceptDetailModel","AttributeContent","ChoiceAttributeOptionModel","constructor","selectedValues","option","referenceDate","now","code","contributions","key","_isSelected","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","_content","content","createFromListItemModel","listitem","id","toString","attributeCollection","clone","links","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","_code","equals","getContribution","data","label","hasItems","title","getAttributeByLayoutHint","readonlyvalue","first","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","length","configuredLabels","getLabelElementByIds","configuredLabel","value","configuredLabelProperty","some","_id","selected","count","create","options","date","getLinkByKey","addParameter","isCacheable","_concept","level","isBooleanType","hasAlternativeLabel","mergeOption","withOption","mergeOptions"],"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { has } from \"../../utils/helpers/objects\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\nimport AttributeContent from \"./AttributeContent\";\n\nimport type { IModelWithChildModels, ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n */\nclass ChoiceAttributeOptionModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate = referenceDate;\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection();\n this._children = this.addChildren(selectedValues, option, referenceDate);\n\n this._links = new LinkCollection(this.contributions._links);\n\n this._content = new AttributeContent(option.content);\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection.clone();\n option.links = listitem.links.clone();\n\n return option;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref)\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, true);\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n if (this.attributeCollection.first) {\n return this.attributeCollection.first.readonlyvalue;\n }\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\"\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection();\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n referenceDate\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"mappings":";;;;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,+BAA+B,MAAM,mCAAmC;AAE/E,SAASC,QAAQ,QAAQ,mCAAmC;AAC5D,SAASC,GAAG,QAAQ,6BAA6B;AACjD,SAASC,uBAAuB,Q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AAYtC,kBAAkB,GAAGsC,OAAO,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;EACE,IAAIoC,KAAK,GAAW;IAClB,OAAO,IAAI,CAAC7D,MAAM;EACpB;;EAEA;AACF;AACA;EACE,IAAI6D,KAAK,CAACA,KAAa,EAAE;IACvB,IAAI,CAAC7D,MAAM,GAAG6D,KAAK;EACrB;;EAEA;AACF;EACE,IAAIC,aAAa,GAAY;IAC3B,OAAO,IAAI,CAAC/B,eAAe,CAAC,eAAe,EAAE,KAAK,CAAC;EACrD;;EAEA;AACF;EACE,IAAIgC,mBAAmB,GAAY;IACjC,OAAO,IAAI,CAAChC,eAAe,CAAC,qBAAqB,EAAE,KAAK,CAAC;EAC3D;;EAEA;AACF;EACEiC,WAAW,CAACC,UAAsC,EAAE;IAClD,IAAI,CAACxC,OAAO,GAAGwC,UAAU,CAACxC,OAAO;IAEjC,IAAI,IAAI,CAACL,QAAQ,IAAI,IAAI,IAAI6C,UAAU,CAAC7C,QAAQ,IAAI,IAAI,EAAE;MACxD,IAAI,CAACA,QAAQ,CAAC8C,YAAY,CAACD,UAAU,CAAC7C,QAAQ,CAAC;IACjD;EACF;;EAEA;AACF;AACA;EACE,IAAIH,kBAAkB,GAAY;IAChC,OAAOjC,mBAAmB,EAAE;EAC9B;;EAEA;AACF;EACE,IAAIuB,OAAO,GAAqB;IAC9B,OAAO,IAAI,CAACD,QAAQ;EACtB;AACF;AAEA,eAAejB,0BAA0B"}
@@ -9,11 +9,6 @@ import DateTimeTimeFormatConstraint from "./input-constraints/DateTimeTimeFormat
9
9
  import DatetimeFormatConstraint from "./input-constraints/DatetimeFormatConstraint";
10
10
  import DateBoundaryConstraint from "./input-constraints/DateBoundaryConstraint";
11
11
  import { ATTRIBUTE_WIDTH, ISO_DATE_FORMAT } from "../../constants";
12
- import { getSetting } from "../../constants/Settings";
13
- import { IGNORE_FORMAT_SETTING } from "../../constants/LayoutHints";
14
- // date format of default
15
- const PRODUCT_DEFAULT_DATE_FORMAT = "dd-MM-yyyy";
16
-
17
12
  /**
18
13
  */
19
14
  class DatetimeAttributeModel extends StringAttributeModel {
@@ -204,18 +199,7 @@ class DatetimeAttributeModel extends StringAttributeModel {
204
199
  if (!this.hasDate) {
205
200
  return "";
206
201
  }
207
-
208
- // setting for date input
209
- const ignoreFormatSetting = this.layouthint.has(IGNORE_FORMAT_SETTING);
210
- if (!ignoreFormatSetting) {
211
- const dateInputFormatSetting = getSetting("DATE_INPUT_FORMAT", "");
212
- if (dateInputFormatSetting) {
213
- return dateInputFormatSetting;
214
- }
215
- }
216
- let format = this.format;
217
- let dateFormat = this.hasTime ? _trimInstanceProperty(_context7 = format.replace(this.timeInputFormat, "")).call(_context7) : format;
218
- return dateFormat;
202
+ return this.hasTime ? _trimInstanceProperty(_context7 = this.format.replace(this.timeInputFormat, "")).call(_context7) : this.format;
219
203
  }
220
204
 
221
205
  /**
@@ -225,26 +209,16 @@ class DatetimeAttributeModel extends StringAttributeModel {
225
209
  if (!this.hasDate) {
226
210
  return "";
227
211
  }
228
- let format = this.format;
229
- let dateFormat = this.hasTime ? _trimInstanceProperty(_context8 = format.replace(this.timeInputFormat, "")).call(_context8) : format;
230
- const readonlyFormatSetting = getSetting("DATE_READONLY_FORMAT", "");
231
- if (dateFormat === PRODUCT_DEFAULT_DATE_FORMAT && readonlyFormatSetting) {
232
- dateFormat = readonlyFormatSetting;
233
- }
234
- return dateFormat;
212
+ return this.hasTime ? _trimInstanceProperty(_context8 = this.format.replace(this.timeInputFormat, "")).call(_context8) : this.format;
235
213
  }
236
214
 
237
215
  /**
238
- * return attribute placeholder or, if DATE_INPUT_FORMAT setting is used, lowercased setting, otherwise return formatlabel without time input format from contributions
216
+ * return attribute placeholder or return formatlabel without time input format from contributions
239
217
  */
240
218
  get placeholder() {
241
219
  if (this._placeholder !== "") {
242
220
  return this._placeholder;
243
221
  }
244
- const dateInputFormatSetting = getSetting("DATE_INPUT_FORMAT", "");
245
- if (dateInputFormatSetting) {
246
- return dateInputFormatSetting.toLowerCase();
247
- }
248
222
  const formatLabel = this.getContribution("formatlabel", "");
249
223
  if (this.hasDate && this.hasTime && _includesInstanceProperty(formatLabel).call(formatLabel, " ")) {
250
224
  // return first part of formatlabel to keep placeholder matching date input