@beinformed/ui 1.48.1 → 1.49.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/esm/hooks/useForm.js +17 -2
  3. package/esm/hooks/useForm.js.map +1 -1
  4. package/esm/models/attributes/AttributeModel.js +2 -1
  5. package/esm/models/attributes/AttributeModel.js.map +1 -1
  6. package/esm/models/attributes/ChoiceAttributeModel.js +16 -1
  7. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  8. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +10 -3
  9. package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  10. package/esm/models/concepts/ConceptDetailModel.js +7 -0
  11. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  12. package/esm/models/form/FormModel.js +22 -2
  13. package/esm/models/form/FormModel.js.map +1 -1
  14. package/esm/models/form/FormObjectModel.js +9 -1
  15. package/esm/models/form/FormObjectModel.js.map +1 -1
  16. package/esm/modularui/ModularUIRequest.js +1 -1
  17. package/esm/modularui/ModularUIRequest.js.map +1 -1
  18. package/esm/redux/_modularui/ModularUIActions.js +4 -10
  19. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  20. package/esm/redux/actions/FormAttributeSet.js +22 -6
  21. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  22. package/esm/redux/actions/FormAutosubmit.js +9 -1
  23. package/esm/redux/actions/FormAutosubmit.js.map +1 -1
  24. package/esm/redux/actions/FormAutoupdate.js +29 -0
  25. package/esm/redux/actions/FormAutoupdate.js.map +1 -0
  26. package/esm/redux/connectors/FormAttributeSet.js +3 -2
  27. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  28. package/esm/redux/types.js.map +1 -1
  29. package/esm/utils/fetch/types.js.map +1 -1
  30. package/lib/hooks/useForm.js +17 -2
  31. package/lib/hooks/useForm.js.flow +22 -7
  32. package/lib/hooks/useForm.js.map +1 -1
  33. package/lib/models/attributes/AttributeModel.js +2 -1
  34. package/lib/models/attributes/AttributeModel.js.flow +2 -1
  35. package/lib/models/attributes/AttributeModel.js.map +1 -1
  36. package/lib/models/attributes/ChoiceAttributeModel.js +16 -1
  37. package/lib/models/attributes/ChoiceAttributeModel.js.flow +23 -2
  38. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  39. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +10 -3
  40. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +16 -8
  41. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  42. package/lib/models/concepts/ConceptDetailModel.js +7 -0
  43. package/lib/models/concepts/ConceptDetailModel.js.flow +8 -0
  44. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  45. package/lib/models/form/FormModel.js +22 -2
  46. package/lib/models/form/FormModel.js.flow +25 -5
  47. package/lib/models/form/FormModel.js.map +1 -1
  48. package/lib/models/form/FormObjectModel.js +9 -1
  49. package/lib/models/form/FormObjectModel.js.flow +9 -1
  50. package/lib/models/form/FormObjectModel.js.map +1 -1
  51. package/lib/modularui/ModularUIRequest.js +1 -1
  52. package/lib/modularui/ModularUIRequest.js.flow +1 -1
  53. package/lib/modularui/ModularUIRequest.js.map +1 -1
  54. package/lib/redux/_modularui/ModularUIActions.js +4 -10
  55. package/lib/redux/_modularui/ModularUIActions.js.flow +8 -16
  56. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  57. package/lib/redux/actions/FormAttributeSet.js +22 -6
  58. package/lib/redux/actions/FormAttributeSet.js.flow +36 -11
  59. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  60. package/lib/redux/actions/FormAutosubmit.js +10 -1
  61. package/lib/redux/actions/FormAutosubmit.js.flow +10 -3
  62. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  63. package/lib/redux/actions/FormAutoupdate.js +37 -0
  64. package/lib/redux/actions/FormAutoupdate.js.flow +43 -0
  65. package/lib/redux/actions/FormAutoupdate.js.map +1 -0
  66. package/lib/redux/connectors/FormAttributeSet.js +3 -2
  67. package/lib/redux/connectors/FormAttributeSet.js.flow +4 -2
  68. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  69. package/lib/redux/types.js.flow +1 -0
  70. package/lib/redux/types.js.map +1 -1
  71. package/lib/utils/fetch/types.js.flow +2 -1
  72. package/lib/utils/fetch/types.js.map +1 -1
  73. package/package.json +1 -1
  74. package/src/hooks/useForm.js +22 -7
  75. package/src/models/attributes/AttributeModel.js +2 -1
  76. package/src/models/attributes/ChoiceAttributeModel.js +23 -2
  77. package/src/models/attributes/ChoiceAttributeOptionCollection.js +16 -8
  78. package/src/models/concepts/ConceptDetailModel.js +8 -0
  79. package/src/models/form/FormModel.js +25 -5
  80. package/src/models/form/FormObjectModel.js +9 -1
  81. package/src/modularui/ModularUIRequest.js +1 -1
  82. package/src/redux/_modularui/ModularUIActions.js +8 -16
  83. package/src/redux/actions/FormAttributeSet.js +36 -11
  84. package/src/redux/actions/FormAutosubmit.js +10 -3
  85. package/src/redux/actions/FormAutoupdate.js +43 -0
  86. package/src/redux/connectors/FormAttributeSet.js +4 -2
  87. package/src/redux/types.js +1 -0
  88. package/src/utils/fetch/types.js +2 -1
  89. package/types/hooks/useI18n.d.ts +1 -1
  90. package/types/models/application/ApplicationModel.d.ts +7 -0
  91. package/types/models/attributes/AttributeModel.d.ts +4 -3
  92. package/types/models/attributes/ChoiceAttributeModel.d.ts +4 -0
  93. package/types/models/attributes/ChoiceAttributeOptionCollection.d.ts +1 -1
  94. package/types/models/attributes/ChoiceAttributeOptionModel.d.ts +2 -1
  95. package/types/models/attributes/input-constraints/ConstraintModel.d.ts +1 -1
  96. package/types/models/base/ResourceCollection.d.ts +2 -1
  97. package/types/models/base/ResourceModel.d.ts +3 -2
  98. package/types/models/concepts/BusinessScenarioModel.d.ts +1 -1
  99. package/types/models/concepts/ConceptRelationModel.d.ts +19 -4
  100. package/types/models/content/ContentModel.d.ts +4 -0
  101. package/types/models/content/ContentTOCModel.d.ts +4 -0
  102. package/types/models/form/FormModel.d.ts +7 -1
  103. package/types/models/form/FormObjectModel.d.ts +11 -2
  104. package/types/models/links/normalizeLinkJSON.d.ts +2 -2
  105. package/types/models/list/ListModel.d.ts +4 -0
  106. package/types/models/panels/GroupingPanelModel.d.ts +4 -0
  107. package/types/models/tab/TabModel.d.ts +4 -0
  108. package/types/models/types.d.ts +2 -1
  109. package/types/models/user/UserServicesModel.d.ts +7 -0
  110. package/types/redux/types.d.ts +1 -0
  111. package/types/utils/fetch/types.d.ts +2 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
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
4
 
5
+ ## [1.49.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.49.2...v1.49.3) (2024-06-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **concept-detail:** retrieve diagram links ([d6e9fe6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/d6e9fe6cce7e6b070ba8f9ad44017af1da96a500))
11
+
12
+ ## [1.49.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.49.1...v1.49.2) (2024-06-26)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **concept-detail:** retrieve diagram links ([2f91f9e](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/2f91f9e6da223f4b59b0c6effae997d3463ab16a))
18
+
19
+ ## [1.49.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.49.0...v1.49.1) (2024-06-13)
20
+
21
+ ## [1.49.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.48.1...v1.49.0) (2024-06-13)
22
+
23
+
24
+ ### Features
25
+
26
+ * **autoupdate:** make it possible to update a single form question from the server ([bdceb60](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/bdceb600499f9a3fd31b1c774c9bd0726f67f2de))
27
+
5
28
  ## [1.48.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.48.0...v1.48.1) (2024-06-13)
6
29
 
7
30
 
@@ -34,7 +34,14 @@ export const useFormNavigation = () => {
34
34
  const submit = form => dispatch(loadModularUI(form.connectKey, form.selfhref, {
35
35
  method: HTTP_METHODS.POST,
36
36
  data: form.formdata,
37
- updateModel: form,
37
+ updateHandler: newModel => {
38
+ if (newModel instanceof FormModel) {
39
+ const clonedModel = form.clone();
40
+ clonedModel.update(newModel);
41
+ return clonedModel;
42
+ }
43
+ return newModel;
44
+ },
38
45
  targetModel: FormModel
39
46
  }));
40
47
  const remove = form => dispatch(removeModelByKey(form.connectKey));
@@ -49,7 +56,15 @@ export const useFormNavigation = () => {
49
56
  };
50
57
 
51
58
  /**
52
- * Update attributes of a form
59
+ * Hook that returns a function to update attributes of a form object.
60
+ * <br >
61
+ * The returned function accepts the following options:
62
+ *
63
+ * - autosubmit: Automatically submit the form after a change
64
+ * - autosav: Automatically save the form (in the background) after a change
65
+ * - autoupdate: Automatically update the current form object after a change
66
+ * - forceUpdate: Force the update even if conditions are not met.
67
+ * - validate: Activate/deactivate the form object validation by an update.
53
68
  */
54
69
  export const useAttributeUpdate = (form, object) => {
55
70
  const dispatch = useDispatch();
@@ -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","data","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","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, data?: Object): ?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 data,\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,GAAGA,CAACC,IAAmB,EAAEC,IAAa,KAAiB;EACzE,MAAMC,QAAQ,GAAG,IAAIjB,IAAI,CAACe,IAAI,CAAC;EAE/B,IAAI,CAACd,UAAU,CAAC,oBAAoB,CAAC,EAAE;IACrCgB,QAAQ,CAACC,YAA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MAAuB,KACC;EACxB,MAAMX,QAAQ,GAAG3B,WAAW,CAAC,CAAC;EAE9B,OAAO,CACLuC,SAAwB,EACxBC,KAAa,EACbC,OAA0B,KACvBd,QAAQ,CAACd,mBAAmB,CAACO,IAAI,EAAEkB,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,CAAC,CAAC;AAC7E,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAItB,IAAe,IAAuB;EACpE,MAAMO,QAAQ,GAAG3B,WAAW,CAAC,CAAC;EAE9B,OAAO;IACL2C,IAAI,EAAEA,CAAA,KAAMhB,QAAQ,CAACpB,yBAAyB,CAACa,IAAI,CAAC,CAAC;IACrDS,MAAM,EAAGS,MAAuB,IAC9BX,QAAQ,CAAClB,4BAA4B,CAACW,IAAI,EAAEkB,MAAM,CAAC,CAAC;IACtDH,MAAM,EAAGG,MAAuB,IAC9BX,QAAQ,CAAChB,4BAA4B,CAACS,IAAI,EAAEkB,MAAM,CAAC;EACvD,CAAC;AACH,CAAC","ignoreList":[]}
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","data","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","formdata","updateHandler","newModel","clonedModel","clone","update","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 type {\n RemoveModelByKeyAction,\n UpdateFormAction,\n} from \"../redux/_modularui\";\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 { AttributeType, FormObjectModel, ModularUIModel } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\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, data?: Object): ?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 data,\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 updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n const clonedModel: FormModel = form.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\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 * Hook that returns a function to update attributes of a form object.\n * <br >\n * The returned function accepts the following options:\n *\n * - autosubmit: Automatically submit the form after a change\n * - autosav: Automatically save the form (in the background) after a change\n * - autoupdate: Automatically update the current form object after a change\n * - forceUpdate: Force the update even if conditions are not met.\n * - validate: Activate/deactivate the form object validation by an update.\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;AAMvD,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;AAyBhD;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAGA,CAACC,IAAmB,EAAEC,IAAa,KAAiB;EACzE,MAAMC,QAAQ,GAAG,IAAIjB,IAAI,CAACe,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,IAAI,CAACW,UAAU,CAAC,CAAC;EAE7C,MAAMS,0BAA0B,GAAIpB,IAAe,IACjDO,QAAQ,CAACf,oBAAoB,CAACQ,IAAI,CAAC,CAAC;EAEtC,OAAO;IACLQ,QAAQ;IACRC,MAAM;IACNC,MAAM;IACNS,MAAM;IACN3B,oBAAoB,EAAE4B;EACxB,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGA,CAChCrB,IAAe,EACfsB,MAAuB,KACC;EACxB,MAAMf,QAAQ,GAAG3B,WAAW,CAAC,CAAC;EAE9B,OAAO,CACL2C,SAAwB,EACxBC,KAAa,EACbC,OAA0B,KACvBlB,QAAQ,CAACd,mBAAmB,CAACO,IAAI,EAAEsB,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,CAAC,CAAC;AAC7E,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAI1B,IAAe,IAAuB;EACpE,MAAMO,QAAQ,GAAG3B,WAAW,CAAC,CAAC;EAE9B,OAAO;IACL+C,IAAI,EAAEA,CAAA,KAAMpB,QAAQ,CAACpB,yBAAyB,CAACa,IAAI,CAAC,CAAC;IACrDS,MAAM,EAAGa,MAAuB,IAC9Bf,QAAQ,CAAClB,4BAA4B,CAACW,IAAI,EAAEsB,MAAM,CAAC,CAAC;IACtDH,MAAM,EAAGG,MAAuB,IAC9Bf,QAAQ,CAAChB,4BAA4B,CAACS,IAAI,EAAEsB,MAAM,CAAC;EACvD,CAAC;AACH,CAAC","ignoreList":[]}
@@ -610,7 +610,8 @@ export default class AttributeModel extends BaseModel {
610
610
  /**
611
611
  * Registers a missing error that was received from the server
612
612
  */
613
- addMissingError() {
613
+ // eslint-disable-next-line no-unused-vars
614
+ addMissingError(receivedAttribute) {
614
615
  this._errorCollection.addServerError("Constraint.Missing");
615
616
  }
616
617
 
@@ -1 +1 @@
1
- {"version":3,"file":"AttributeModel.js","names":["DateUtil","isPlainObject","BaseModel","ConstraintCollection","ErrorCollection","LinkCollection","StringLengthConstraint","MandatoryConstraint","ConceptDetailModel","DISABLED","MANDATORY","ATTRIBUTE_WIDTH","TIMEVERSION_FILTER_NAME","getSetting","hasAllContentInData","IllegalArgumentException","UnsupportedOperationException","AttributeContent","AttributeModel","constructor","attribute","attributeContributions","_defineProperty","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","_errorCollection","message","addServerError","id","parameters","_referenceDate","getData","now","_isResult","_mandatory","mandatory","_links","isApplicableModel","getInitialChildModelLinks","hasContentConfiguration","conceptLink","setChildModels","models","errors","conceptHref","href","concept","_findInstanceProperty","call","model","selfhref","equalsWithParameters","key","parentKey","_parentKey","name","type","_hasContentConfiguration","indicateContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","getContentConfiguredLabel","configuredLabelProperties","labelConfig","length","types","_context","configuredLabels","_filterInstanceProperty","getLabelElementByIds","configuredLabel","_context2","firstConfiguredLabel","_mapInstanceProperty","configuredLabelProperty","some","_id","defaultAlignment","alignment","alignmentHints","getByLayoutHint","substring","links","downloadLink","getLinksByGroup","first","getLinkByKey","addParameter","referenceDate","isCacheable","_concept","date","initvalue","getInputValue","inputvalue","toString","validateValue","validate","hasValue","getValue","getFormData","inError","formdata","getEmptyFormData","updateLastModification","formatValue","readonlyvalue","configuredMandatory","_validatedValue","readonly","_readonly","static","isResult","disabled","format","getContribution","formatLabel","minLength","maxLength","operator","assistantMessage","isValid","constraintCollection","constraints","add","_serverConstraints","addConstraints","setUseClientsideValidation","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","undefined","errorCollection","collection","invalidConstraints","isChangedSince","resetErrors","error","properties","removeServerError","hasServerErrors","serverErrors","hasErrors","hasItems","addMissingError","removeMissingError","addServerConstraint","defaultMessage","addConstraint","formatParameters","params","_Object$keys","forEach","paramKey","paramValue","_endsWithInstanceProperty","hasDynamicValidationData","updateValidations","_lastModification","Date","timestamp","reset","mergeAttribute","oldAttribute","update","changedAttribute","isEditable","_isEditable","isVisible","_isHidden","isHidden","show","hide","equals","otherAttribute","readonlyWidth","MEDIUM","layoutHintRules","_layoutHintRules","rules","processLayoutHintRules","attributes","process"],"sources":["../../../src/models/attributes/AttributeModel.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { DISABLED, MANDATORY } from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting, hasAllContentInData } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type {\n AttributeType,\n FormErrorAnchor,\n IModelWithChildModels,\n ModularUIModel,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters,\n attribute.message.layouthint,\n );\n }\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n\n this._isResult = this.getData(\"isResult\", false);\n\n this._mandatory =\n this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n if (!isPlainObject(contributions)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a contributions object\",\n );\n }\n\n return false;\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): any {\n return value;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n !this.hasContentFromData &&\n this.hasContentConfiguration &&\n this.conceptLink\n ) {\n return [this.conceptLink];\n }\n return [];\n }\n\n /**\n */\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>, // eslint-disable-line no-unused-vars\n ): void {\n const conceptHref = this.conceptLink?.href;\n if (conceptHref) {\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n }\n\n /**\n * Getting the attribute key\n */\n get key(): string {\n return this.data.key;\n }\n\n /**\n */\n get parentKey(): string {\n return this._parentKey || \"\";\n }\n\n /**\n */\n set parentKey(parentKey: string) {\n this._parentKey = parentKey;\n }\n\n /**\n * Getting the attribute name\n */\n get name(): string {\n return this.key;\n }\n\n /**\n * Getting the type of the attribute\n */\n get type(): string {\n return this.contributions.type;\n }\n\n /**\n * Getting the label of the attribute\n */\n get label(): string {\n return this._label || \"\";\n }\n\n /**\n * Set the label of this attribute\n */\n set label(label: string) {\n this._label = label;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration = hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration || false;\n }\n\n /**\n */\n indicateContentConfiguration(\n contentConfiguration: ContentConfiguration,\n ): void {\n if (contentConfiguration) {\n const hasQuestionConfig = contentConfiguration.questions?.hasConfig();\n\n const hasEndResultConfig =\n contentConfiguration.isConfiguredEndResultAttribute(this.key);\n const hasIntermediateResultConfig =\n contentConfiguration.isConfiguredIntermediateResultAttribute(this.key);\n\n this.hasContentConfiguration =\n hasQuestionConfig || hasEndResultConfig || hasIntermediateResultConfig;\n }\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(\n contentConfiguration: ?ContentConfigurationElements,\n ): string {\n if (this.hasContentFromData) {\n return this.content.label ?? this.label;\n }\n\n const configuredLabelProperties =\n contentConfiguration && contentConfiguration.labelConfig.length > 0\n ? contentConfiguration.labelConfig[0].types\n : [];\n\n if (this.concept && configuredLabelProperties.length > 0) {\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 const [firstConfiguredLabel] = 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 );\n\n if (firstConfiguredLabel) {\n return firstConfiguredLabel.value;\n }\n }\n }\n\n return this.label;\n }\n\n /**\n */\n get defaultAlignment(): \"left\" | \"center\" | \"right\" {\n return \"left\";\n }\n\n /**\n * Handles layout hint align-left, align-center and align-right\n */\n get alignment(): \"left\" | \"center\" | \"right\" {\n const alignmentHints = this.layouthint.getByLayoutHint(\"align-\");\n\n // return alignment based on layouthint or the default alignment for the attribute\n const alignment = alignmentHints\n ? alignmentHints.substring(\"align-\".length)\n : this.defaultAlignment;\n\n if (\n alignment === \"left\" ||\n alignment === \"center\" ||\n alignment === \"right\"\n ) {\n return alignment;\n }\n\n return this.defaultAlignment;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Retrieve link of attribute when available\n */\n get downloadLink(): ?LinkModel {\n const downloadLink = this.links.getLinksByGroup(\"download\").first;\n\n if (downloadLink && downloadLink.key === this.key) {\n return downloadLink;\n }\n\n return null;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): ?LinkModel {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n\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 * Retrieve reference date of attribute which can be used as entryDate for content\n * to get information in correct time version\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: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Initial value received from the modular ui service\n */\n get initvalue(): any {\n return this._initvalue;\n }\n\n /**\n * Retrieve input value\n */\n getInputValue(): string {\n const inputvalue = this._inputvalue;\n\n return inputvalue ? inputvalue.toString() : \"\";\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Value that is used when retrieving an error collection of this attribute\n * Mostly this is the input value, but sometimes a different value is needed,\n * for example iban and postcode need to validate length without spaces\n */\n get validateValue(): string {\n return this.inputvalue;\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.value = value;\n\n this.validate(value);\n }\n\n /**\n */\n hasValue(): boolean {\n return this._value != null && this._value !== \"\";\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): any {\n return this.hasValue() ? this._value : null;\n }\n\n /**\n * Getting data ready to be send to the modular ui\n * Returns null when the attribute should not be send to the server\n */\n getFormData(): { [string]: any } | null {\n if (this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return this.getFormData();\n }\n\n /**\n */\n getEmptyFormData(): { [string]: null } {\n return { [this.name]: null };\n }\n\n /**\n * Getting the value of the attribute\n */\n get value(): any {\n return this.getValue();\n }\n\n /**\n * Setting a value in the element\n */\n set value(value: ?string) {\n this.updateLastModification();\n\n this._value = value;\n }\n\n /**\n */\n formatValue(value: string): string {\n return value;\n }\n\n /**\n * Getting the readonly value, iso value converted for human reading\n */\n get readonlyvalue(): string {\n return this.value ? this.value.toString() : \"\";\n }\n\n /**\n * Getting mandatory status of attribute\n */\n get mandatory(): boolean {\n return this._mandatory || false;\n }\n\n /**\n */\n get configuredMandatory(): ?boolean {\n return this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n }\n\n /**\n * Set mandatory status of attribute\n */\n set mandatory(mandatory: boolean) {\n if (mandatory !== this._mandatory) {\n this._validatedValue = null;\n }\n this._mandatory = mandatory;\n }\n\n /**\n */\n get readonly(): boolean {\n return (\n this._readonly ||\n this.contributions.readonly === true ||\n this.data.static === true ||\n this.isResult === true\n );\n }\n\n /**\n */\n set readonly(readonly: boolean) {\n this._readonly = readonly;\n }\n\n /**\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n */\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._isResult;\n }\n\n /**\n */\n set isResult(isResult: boolean) {\n this._isResult = isResult;\n }\n\n /**\n * Getting the display and input format of a attribute\n */\n get format(): string | null {\n return this.getContribution(\"format\");\n }\n\n /**\n */\n get formatLabel(): string {\n return this.format || \"\";\n }\n\n /**\n * Get minimum string length\n */\n get minLength(): number | null {\n return this.getContribution(\"minLength\");\n }\n\n /**\n * Get maximum string length\n */\n get maxLength(): number | null {\n return this.getContribution(\"maxLength\");\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n * Get assistant message\n */\n get assistantMessage(): string | null {\n return this.getContribution(\"assistant\");\n }\n\n /**\n * Get valid status\n */\n get isValid(): boolean {\n return this.validate(this.validateValue);\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this._serverConstraints);\n\n // Mandatory constraint\n if (this.mandatory) {\n constraints.add(new MandatoryConstraint());\n }\n\n if (this.minLength || this.maxLength) {\n constraints.add(\n new StringLengthConstraint(this.minLength, this.maxLength),\n );\n }\n\n constraints.add(this.addConstraints());\n\n return constraints;\n }\n\n /**\n * Template method for class extending this model to add extra constraints\n * @abstract\n */\n addConstraints(): ConstraintCollection {\n return new ConstraintCollection();\n }\n\n /**\n * Used to programmatically overwrite the setting USE_CLIENTSIDE_VALIDATION\n */\n setUseClientsideValidation(enabled: boolean): void {\n this._useClientsideValidation = enabled;\n }\n\n /**\n * Indicates if client side validation is enabled\n * @returns {boolean}\n */\n useClientsideValidation(): boolean {\n return this._useClientsideValidation ?? true;\n }\n\n /**\n * Validate input on client side constraint\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== value) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = value;\n\n return this._isValid;\n }\n\n /**\n * Indicates if attribute is optional and empty\n */\n isOptionalAndEmpty(value: string): boolean {\n if (value === undefined) {\n throw new IllegalArgumentException(\n \"isOptionalAndEmpty method needs value argument\",\n );\n }\n\n return !this.mandatory && value === \"\";\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n const collection = new ErrorCollection(\"attribute\", this._errorCollection);\n\n collection.addConstraints(\n this.constraintCollection.invalidConstraints(this.validateValue),\n );\n\n return collection;\n }\n\n /**\n * Check if attribute is in error\n */\n inError(): boolean {\n return !this._isValid && this.isChangedSince(0);\n }\n\n /**\n * Reset static error messages on attribute\n */\n resetErrors(): void {\n this._errorCollection = new ErrorCollection(\"attribute\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor): void {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n\n /**\n */\n removeServerError(id: string): void {\n this._errorCollection.removeServerError(id);\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return this.errorCollection.serverErrors.length > 0;\n }\n\n /**\n */\n hasErrors(): boolean {\n return this.errorCollection.hasItems;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(): void {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError(): void {\n this.removeServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n addServerConstraint(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters,\n ) {\n this._serverConstraints.addConstraint(\n id,\n null,\n defaultMessage,\n parameters,\n this.useClientsideValidation(),\n );\n }\n\n /**\n */\n formatParameters(parameters: Object): { [string]: string | number } {\n if (parameters == null) {\n return {};\n }\n\n const params: { [name: string]: string | number } = {};\n\n Object.keys(parameters).forEach((paramKey: string) => {\n const paramValue = parameters[paramKey];\n if (paramKey.endsWith(\"-number\") || paramKey.endsWith(\"-date\")) {\n params[paramKey] = this.formatValue(paramValue);\n } else {\n params[paramKey] = paramValue;\n }\n });\n\n return params;\n }\n\n /**\n */\n get hasDynamicValidationData(): boolean {\n return true;\n }\n\n /**\n */\n updateValidations(errors: Array<Object>): void {\n if (\n errors.some((error) => error.id === \"Constraint.Mandatory\") ||\n this.layouthint.has(MANDATORY)\n ) {\n this.mandatory = true;\n } else if (!this.hasValue()) {\n this.mandatory = false;\n }\n\n this._serverConstraints = new ConstraintCollection();\n this.resetErrors();\n\n errors\n .filter(\n (error) => error.id !== \"Constraint.Mandatory\" || !this.hasValue(),\n )\n .forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n error.layouthint,\n );\n } else {\n this.addServerConstraint(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n );\n }\n });\n }\n\n /**\n * Set last modification to current timestamp\n */\n updateLastModification(): void {\n this._lastModification = Date.now();\n }\n\n /**\n * Inidicates if attribute is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return this._lastModification > timestamp;\n }\n\n /**\n * Abstract reset method which should be implemented on each attribute that has this attribute as a base class.\n *\n * @abstract\n */\n reset(): void {\n throw new UnsupportedOperationException(\n `Reset method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Merge old attribute with the attribute from the server.\n * Readonly attributes always need to show the value from the server\n */\n mergeAttribute(oldAttribute: AttributeType): void {\n this.concept = oldAttribute.concept;\n\n if (\n !oldAttribute.readonly &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(oldAttribute.inputvalue);\n }\n }\n\n /**\n * Abstract update method which should be implemented on each attribute that has this attribute as a base class.\n * @abstract\n */\n // eslint-disable-next-line no-unused-vars\n update(value: string, changedAttribute?: AttributeType): AttributeType {\n throw new UnsupportedOperationException(\n `Update method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Indicate if attribute is editable\n */\n set isEditable(isEditable: boolean) {\n this._isEditable = isEditable;\n }\n\n /**\n * Retrieve if attribute is editable\n */\n get isEditable(): boolean {\n return this._isEditable;\n }\n\n /**\n * Indicates if the attribute is visible\n */\n get isVisible(): boolean {\n return !this._isHidden;\n }\n\n /**\n */\n get isHidden(): boolean {\n return this._isHidden;\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n this._isHidden = isHidden;\n }\n\n /**\n * Explicitly toggle visibility of this attribute\n */\n show(): void {\n this.isHidden = false;\n }\n\n /**\n */\n hide(): void {\n this.isHidden = true;\n }\n\n /**\n */\n equals(otherAttribute: AttributeType): boolean {\n return (\n this.key === otherAttribute.key &&\n this.parentKey === otherAttribute.parentKey\n );\n }\n\n /**\n * Readonly attribute width indicates the proposed width of this attribute\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n\n /**\n */\n get layoutHintRules(): LayoutHintRuleCollection {\n return this._layoutHintRules;\n }\n\n /**\n */\n set layoutHintRules(rules: LayoutHintRuleCollection) {\n this._layoutHintRules = rules;\n }\n\n /**\n */\n processLayoutHintRules(attributes: AttributeCollection): void {\n if (this._layoutHintRules) {\n this.layoutHintRules.process(this, attributes);\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 new AttributeContent(this.data.content);\n }\n}\n"],"mappings":";;;;;;AACA,SAASA,QAAQ,QAAQ,mCAAmC;AAC5D,SAASC,aAAa,QAAQ,6BAA6B;AAE3D,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,oBAAoB,MAAM,0CAA0C;AAC3E,OAAOC,eAAe,MAAM,0BAA0B;AACtD,OAAOC,cAAc,MAAM,yBAAyB;AAEpD,OAAOC,sBAAsB,MAAM,4CAA4C;AAC/E,OAAOC,mBAAmB,MAAM,yCAAyC;AAEzE,OAAOC,kBAAkB,MAAM,gCAAgC;AAE/D,SAASC,QAAQ,EAAEC,SAAS,QAAQ,6BAA6B;AACjE,SACEC,eAAe,EACfC,uBAAuB,QAClB,2BAA2B;AAElC,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,0BAA0B;AAE1E,SACEC,wBAAwB,EACxBC,6BAA6B,QACxB,kBAAkB;AAczB,OAAOC,gBAAgB,MAAM,oBAAoB;AAGjD;AACA;AACA;AACA,eAAe,MAAMC,cAAc,SACzBhB,SAAS,CAEnB;EA0BE;AACF;EACEiB,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAACC,eAAA;IAAAA,eAAA,4BA3Bf,CAAC;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,6BAOc,IAAInB,oBAAoB,CAAC,CAAC;IAAAmB,eAAA,mCACjCT,UAAU,CAAC,2BAA2B,CAAC;IAAAS,eAAA,mBACvD,IAAI;IAAAA,eAAA;IAAAA,eAAA,sBAED,KAAK;IAAAA,eAAA,mBACU,IAAI;IAAAA,eA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,SAAS;EACxB;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACD,SAAS;EACvB;;EAEA;AACF;EACE,IAAIC,QAAQA,CAACA,QAAiB,EAAE;IAC9B,IAAI,CAACD,SAAS,GAAGC,QAAQ;EAC3B;;EAEA;AACF;AACA;EACEC,IAAIA,CAAA,EAAS;IACX,IAAI,CAACD,QAAQ,GAAG,KAAK;EACvB;;EAEA;AACF;EACEE,IAAIA,CAAA,EAAS;IACX,IAAI,CAACF,QAAQ,GAAG,IAAI;EACtB;;EAEA;AACF;EACEG,MAAMA,CAACC,cAA6B,EAAW;IAC7C,OACE,IAAI,CAAClI,GAAG,KAAKkI,cAAc,CAAClI,GAAG,IAC/B,IAAI,CAACC,SAAS,KAAKiI,cAAc,CAACjI,SAAS;EAE/C;;EAEA;AACF;AACA;EACE,IAAIkI,aAAaA,CAAA,EAAkC;IACjD,OAAOxL,eAAe,CAACyL,MAAM;EAC/B;;EAEA;AACF;EACE,IAAIC,eAAeA,CAAA,EAA6B;IAC9C,OAAO,IAAI,CAACC,gBAAgB;EAC9B;;EAEA;AACF;EACE,IAAID,eAAeA,CAACE,KAA+B,EAAE;IACnD,IAAI,CAACD,gBAAgB,GAAGC,KAAK;EAC/B;;EAEA;AACF;EACEC,sBAAsBA,CAACC,UAA+B,EAAQ;IAC5D,IAAI,IAAI,CAACH,gBAAgB,EAAE;MACzB,IAAI,CAACD,eAAe,CAACK,OAAO,CAAC,IAAI,EAAED,UAAU,CAAC;IAChD;EACF;;EAEA;AACF;AACA;EACE,IAAIlL,kBAAkBA,CAAA,EAAY;IAChC,OAAOT,mBAAmB,CAAC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAIU,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAIP,gBAAgB,CAAC,IAAI,CAACY,IAAI,CAACL,OAAO,CAAC;EAChD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"AttributeModel.js","names":["DateUtil","isPlainObject","BaseModel","ConstraintCollection","ErrorCollection","LinkCollection","StringLengthConstraint","MandatoryConstraint","ConceptDetailModel","DISABLED","MANDATORY","ATTRIBUTE_WIDTH","TIMEVERSION_FILTER_NAME","getSetting","hasAllContentInData","IllegalArgumentException","UnsupportedOperationException","AttributeContent","AttributeModel","constructor","attribute","attributeContributions","_defineProperty","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","_errorCollection","message","addServerError","id","parameters","_referenceDate","getData","now","_isResult","_mandatory","mandatory","_links","isApplicableModel","getInitialChildModelLinks","hasContentConfiguration","conceptLink","setChildModels","models","errors","conceptHref","href","concept","_findInstanceProperty","call","model","selfhref","equalsWithParameters","key","parentKey","_parentKey","name","type","_hasContentConfiguration","indicateContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","getContentConfiguredLabel","configuredLabelProperties","labelConfig","length","types","_context","configuredLabels","_filterInstanceProperty","getLabelElementByIds","configuredLabel","_context2","firstConfiguredLabel","_mapInstanceProperty","configuredLabelProperty","some","_id","defaultAlignment","alignment","alignmentHints","getByLayoutHint","substring","links","downloadLink","getLinksByGroup","first","getLinkByKey","addParameter","referenceDate","isCacheable","_concept","date","initvalue","getInputValue","inputvalue","toString","validateValue","validate","hasValue","getValue","getFormData","inError","formdata","getEmptyFormData","updateLastModification","formatValue","readonlyvalue","configuredMandatory","_validatedValue","readonly","_readonly","static","isResult","disabled","format","getContribution","formatLabel","minLength","maxLength","operator","assistantMessage","isValid","constraintCollection","constraints","add","_serverConstraints","addConstraints","setUseClientsideValidation","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","undefined","errorCollection","collection","invalidConstraints","isChangedSince","resetErrors","error","properties","removeServerError","hasServerErrors","serverErrors","hasErrors","hasItems","addMissingError","receivedAttribute","removeMissingError","addServerConstraint","defaultMessage","addConstraint","formatParameters","params","_Object$keys","forEach","paramKey","paramValue","_endsWithInstanceProperty","hasDynamicValidationData","updateValidations","_lastModification","Date","timestamp","reset","mergeAttribute","oldAttribute","update","changedAttribute","isEditable","_isEditable","isVisible","_isHidden","isHidden","show","hide","equals","otherAttribute","readonlyWidth","MEDIUM","layoutHintRules","_layoutHintRules","rules","processLayoutHintRules","attributes","process"],"sources":["../../../src/models/attributes/AttributeModel.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { DISABLED, MANDATORY } from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting, hasAllContentInData } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type {\n AttributeType,\n FormErrorAnchor,\n IModelWithChildModels,\n ModularUIModel,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters,\n attribute.message.layouthint,\n );\n }\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n\n this._isResult = this.getData(\"isResult\", false);\n\n this._mandatory =\n this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n if (!isPlainObject(contributions)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a contributions object\",\n );\n }\n\n return false;\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): any {\n return value;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n !this.hasContentFromData &&\n this.hasContentConfiguration &&\n this.conceptLink\n ) {\n return [this.conceptLink];\n }\n return [];\n }\n\n /**\n */\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>, // eslint-disable-line no-unused-vars\n ): void {\n const conceptHref = this.conceptLink?.href;\n if (conceptHref) {\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n }\n\n /**\n * Getting the attribute key\n */\n get key(): string {\n return this.data.key;\n }\n\n /**\n */\n get parentKey(): string {\n return this._parentKey || \"\";\n }\n\n /**\n */\n set parentKey(parentKey: string) {\n this._parentKey = parentKey;\n }\n\n /**\n * Getting the attribute name\n */\n get name(): string {\n return this.key;\n }\n\n /**\n * Getting the type of the attribute\n */\n get type(): string {\n return this.contributions.type;\n }\n\n /**\n * Getting the label of the attribute\n */\n get label(): string {\n return this._label || \"\";\n }\n\n /**\n * Set the label of this attribute\n */\n set label(label: string) {\n this._label = label;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration = hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration || false;\n }\n\n /**\n */\n indicateContentConfiguration(\n contentConfiguration: ContentConfiguration,\n ): void {\n if (contentConfiguration) {\n const hasQuestionConfig = contentConfiguration.questions?.hasConfig();\n\n const hasEndResultConfig =\n contentConfiguration.isConfiguredEndResultAttribute(this.key);\n const hasIntermediateResultConfig =\n contentConfiguration.isConfiguredIntermediateResultAttribute(this.key);\n\n this.hasContentConfiguration =\n hasQuestionConfig || hasEndResultConfig || hasIntermediateResultConfig;\n }\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(\n contentConfiguration: ?ContentConfigurationElements,\n ): string {\n if (this.hasContentFromData) {\n return this.content.label ?? this.label;\n }\n\n const configuredLabelProperties =\n contentConfiguration && contentConfiguration.labelConfig.length > 0\n ? contentConfiguration.labelConfig[0].types\n : [];\n\n if (this.concept && configuredLabelProperties.length > 0) {\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 const [firstConfiguredLabel] = 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 );\n\n if (firstConfiguredLabel) {\n return firstConfiguredLabel.value;\n }\n }\n }\n\n return this.label;\n }\n\n /**\n */\n get defaultAlignment(): \"left\" | \"center\" | \"right\" {\n return \"left\";\n }\n\n /**\n * Handles layout hint align-left, align-center and align-right\n */\n get alignment(): \"left\" | \"center\" | \"right\" {\n const alignmentHints = this.layouthint.getByLayoutHint(\"align-\");\n\n // return alignment based on layouthint or the default alignment for the attribute\n const alignment = alignmentHints\n ? alignmentHints.substring(\"align-\".length)\n : this.defaultAlignment;\n\n if (\n alignment === \"left\" ||\n alignment === \"center\" ||\n alignment === \"right\"\n ) {\n return alignment;\n }\n\n return this.defaultAlignment;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Retrieve link of attribute when available\n */\n get downloadLink(): ?LinkModel {\n const downloadLink = this.links.getLinksByGroup(\"download\").first;\n\n if (downloadLink && downloadLink.key === this.key) {\n return downloadLink;\n }\n\n return null;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): ?LinkModel {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n\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 * Retrieve reference date of attribute which can be used as entryDate for content\n * to get information in correct time version\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: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Initial value received from the modular ui service\n */\n get initvalue(): any {\n return this._initvalue;\n }\n\n /**\n * Retrieve input value\n */\n getInputValue(): string {\n const inputvalue = this._inputvalue;\n\n return inputvalue ? inputvalue.toString() : \"\";\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Value that is used when retrieving an error collection of this attribute\n * Mostly this is the input value, but sometimes a different value is needed,\n * for example iban and postcode need to validate length without spaces\n */\n get validateValue(): string {\n return this.inputvalue;\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.value = value;\n\n this.validate(value);\n }\n\n /**\n */\n hasValue(): boolean {\n return this._value != null && this._value !== \"\";\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): any {\n return this.hasValue() ? this._value : null;\n }\n\n /**\n * Getting data ready to be send to the modular ui\n * Returns null when the attribute should not be send to the server\n */\n getFormData(): { [string]: any } | null {\n if (this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return this.getFormData();\n }\n\n /**\n */\n getEmptyFormData(): { [string]: null } {\n return { [this.name]: null };\n }\n\n /**\n * Getting the value of the attribute\n */\n get value(): any {\n return this.getValue();\n }\n\n /**\n * Setting a value in the element\n */\n set value(value: ?string) {\n this.updateLastModification();\n\n this._value = value;\n }\n\n /**\n */\n formatValue(value: string): string {\n return value;\n }\n\n /**\n * Getting the readonly value, iso value converted for human reading\n */\n get readonlyvalue(): string {\n return this.value ? this.value.toString() : \"\";\n }\n\n /**\n * Getting mandatory status of attribute\n */\n get mandatory(): boolean {\n return this._mandatory || false;\n }\n\n /**\n */\n get configuredMandatory(): ?boolean {\n return this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n }\n\n /**\n * Set mandatory status of attribute\n */\n set mandatory(mandatory: boolean) {\n if (mandatory !== this._mandatory) {\n this._validatedValue = null;\n }\n this._mandatory = mandatory;\n }\n\n /**\n */\n get readonly(): boolean {\n return (\n this._readonly ||\n this.contributions.readonly === true ||\n this.data.static === true ||\n this.isResult === true\n );\n }\n\n /**\n */\n set readonly(readonly: boolean) {\n this._readonly = readonly;\n }\n\n /**\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n */\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._isResult;\n }\n\n /**\n */\n set isResult(isResult: boolean) {\n this._isResult = isResult;\n }\n\n /**\n * Getting the display and input format of a attribute\n */\n get format(): string | null {\n return this.getContribution(\"format\");\n }\n\n /**\n */\n get formatLabel(): string {\n return this.format || \"\";\n }\n\n /**\n * Get minimum string length\n */\n get minLength(): number | null {\n return this.getContribution(\"minLength\");\n }\n\n /**\n * Get maximum string length\n */\n get maxLength(): number | null {\n return this.getContribution(\"maxLength\");\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n * Get assistant message\n */\n get assistantMessage(): string | null {\n return this.getContribution(\"assistant\");\n }\n\n /**\n * Get valid status\n */\n get isValid(): boolean {\n return this.validate(this.validateValue);\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this._serverConstraints);\n\n // Mandatory constraint\n if (this.mandatory) {\n constraints.add(new MandatoryConstraint());\n }\n\n if (this.minLength || this.maxLength) {\n constraints.add(\n new StringLengthConstraint(this.minLength, this.maxLength),\n );\n }\n\n constraints.add(this.addConstraints());\n\n return constraints;\n }\n\n /**\n * Template method for class extending this model to add extra constraints\n * @abstract\n */\n addConstraints(): ConstraintCollection {\n return new ConstraintCollection();\n }\n\n /**\n * Used to programmatically overwrite the setting USE_CLIENTSIDE_VALIDATION\n */\n setUseClientsideValidation(enabled: boolean): void {\n this._useClientsideValidation = enabled;\n }\n\n /**\n * Indicates if client side validation is enabled\n * @returns {boolean}\n */\n useClientsideValidation(): boolean {\n return this._useClientsideValidation ?? true;\n }\n\n /**\n * Validate input on client side constraint\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== value) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = value;\n\n return this._isValid;\n }\n\n /**\n * Indicates if attribute is optional and empty\n */\n isOptionalAndEmpty(value: string): boolean {\n if (value === undefined) {\n throw new IllegalArgumentException(\n \"isOptionalAndEmpty method needs value argument\",\n );\n }\n\n return !this.mandatory && value === \"\";\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n const collection = new ErrorCollection(\"attribute\", this._errorCollection);\n\n collection.addConstraints(\n this.constraintCollection.invalidConstraints(this.validateValue),\n );\n\n return collection;\n }\n\n /**\n * Check if attribute is in error\n */\n inError(): boolean {\n return !this._isValid && this.isChangedSince(0);\n }\n\n /**\n * Reset static error messages on attribute\n */\n resetErrors(): void {\n this._errorCollection = new ErrorCollection(\"attribute\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor): void {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n\n /**\n */\n removeServerError(id: string): void {\n this._errorCollection.removeServerError(id);\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return this.errorCollection.serverErrors.length > 0;\n }\n\n /**\n */\n hasErrors(): boolean {\n return this.errorCollection.hasItems;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n // eslint-disable-next-line no-unused-vars\n addMissingError(receivedAttribute?: AttributeType): void {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError(): void {\n this.removeServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n addServerConstraint(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters,\n ) {\n this._serverConstraints.addConstraint(\n id,\n null,\n defaultMessage,\n parameters,\n this.useClientsideValidation(),\n );\n }\n\n /**\n */\n formatParameters(parameters: Object): { [string]: string | number } {\n if (parameters == null) {\n return {};\n }\n\n const params: { [name: string]: string | number } = {};\n\n Object.keys(parameters).forEach((paramKey: string) => {\n const paramValue = parameters[paramKey];\n if (paramKey.endsWith(\"-number\") || paramKey.endsWith(\"-date\")) {\n params[paramKey] = this.formatValue(paramValue);\n } else {\n params[paramKey] = paramValue;\n }\n });\n\n return params;\n }\n\n /**\n */\n get hasDynamicValidationData(): boolean {\n return true;\n }\n\n /**\n */\n updateValidations(errors: Array<Object>): void {\n if (\n errors.some((error) => error.id === \"Constraint.Mandatory\") ||\n this.layouthint.has(MANDATORY)\n ) {\n this.mandatory = true;\n } else if (!this.hasValue()) {\n this.mandatory = false;\n }\n\n this._serverConstraints = new ConstraintCollection();\n this.resetErrors();\n\n errors\n .filter(\n (error) => error.id !== \"Constraint.Mandatory\" || !this.hasValue(),\n )\n .forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n error.layouthint,\n );\n } else {\n this.addServerConstraint(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n );\n }\n });\n }\n\n /**\n * Set last modification to current timestamp\n */\n updateLastModification(): void {\n this._lastModification = Date.now();\n }\n\n /**\n * Inidicates if attribute is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return this._lastModification > timestamp;\n }\n\n /**\n * Abstract reset method which should be implemented on each attribute that has this attribute as a base class.\n *\n * @abstract\n */\n reset(): void {\n throw new UnsupportedOperationException(\n `Reset method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Merge old attribute with the attribute from the server.\n * Readonly attributes always need to show the value from the server\n */\n mergeAttribute(oldAttribute: AttributeType): void {\n this.concept = oldAttribute.concept;\n\n if (\n !oldAttribute.readonly &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(oldAttribute.inputvalue);\n }\n }\n\n /**\n * Abstract update method which should be implemented on each attribute that has this attribute as a base class.\n * @abstract\n */\n // eslint-disable-next-line no-unused-vars\n update(value: string, changedAttribute?: AttributeType): AttributeType {\n throw new UnsupportedOperationException(\n `Update method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Indicate if attribute is editable\n */\n set isEditable(isEditable: boolean) {\n this._isEditable = isEditable;\n }\n\n /**\n * Retrieve if attribute is editable\n */\n get isEditable(): boolean {\n return this._isEditable;\n }\n\n /**\n * Indicates if the attribute is visible\n */\n get isVisible(): boolean {\n return !this._isHidden;\n }\n\n /**\n */\n get isHidden(): boolean {\n return this._isHidden;\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n this._isHidden = isHidden;\n }\n\n /**\n * Explicitly toggle visibility of this attribute\n */\n show(): void {\n this.isHidden = false;\n }\n\n /**\n */\n hide(): void {\n this.isHidden = true;\n }\n\n /**\n */\n equals(otherAttribute: AttributeType): boolean {\n return (\n this.key === otherAttribute.key &&\n this.parentKey === otherAttribute.parentKey\n );\n }\n\n /**\n * Readonly attribute width indicates the proposed width of this attribute\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n\n /**\n */\n get layoutHintRules(): LayoutHintRuleCollection {\n return this._layoutHintRules;\n }\n\n /**\n */\n set layoutHintRules(rules: LayoutHintRuleCollection) {\n this._layoutHintRules = rules;\n }\n\n /**\n */\n processLayoutHintRules(attributes: AttributeCollection): void {\n if (this._layoutHintRules) {\n this.layoutHintRules.process(this, attributes);\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 new AttributeContent(this.data.content);\n }\n}\n"],"mappings":";;;;;;AACA,SAASA,QAAQ,QAAQ,mCAAmC;AAC5D,SAASC,aAAa,QAAQ,6BAA6B;AAE3D,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,oBAAoB,MAAM,0CAA0C;AAC3E,OAAOC,eAAe,MAAM,0BAA0B;AACtD,OAAOC,cAAc,MAAM,yBAAyB;AAEpD,OAAOC,sBAAsB,MAAM,4CAA4C;AAC/E,OAAOC,mBAAmB,MAAM,yCAAyC;AAEzE,OAAOC,kBAAkB,MAAM,gCAAgC;AAE/D,SAASC,QAAQ,EAAEC,SAAS,QAAQ,6BAA6B;AACjE,SACEC,eAAe,EACfC,uBAAuB,QAClB,2BAA2B;AAElC,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,0BAA0B;AAE1E,SACEC,wBAAwB,EACxBC,6BAA6B,QACxB,kBAAkB;AAczB,OAAOC,gBAAgB,MAAM,oBAAoB;AAGjD;AACA;AACA;AACA,eAAe,MAAMC,cAAc,SACzBhB,SAAS,CAEnB;EA0BE;AACF;EACEiB,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAACC,eAAA;IAAAA,eAAA,4BA3Bf,CAAC;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,6BAOc,IAAInB,oBAAoB,CAAC,CAAC;IAAAmB,eAAA,mCACjCT,UAAU,CAAC,2BAA2B,CAAC;IAAAS,eAAA,mBACvD,IAAI;IAAAA,eAAA;IAAAA,eAAA,sBAED,KAAK;IAAAA,eAAA,mB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 @@ export default class ChoiceAttributeModel extends AttributeModel {
246
246
  /**
247
247
  */
248
248
  mergeAttribute(oldAttribute) {
249
+ let addNotExistingOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
250
+ let removeNotExistingOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
249
251
  // when attribute is readonly, don't merge the options no modifications necessary
250
252
  if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {
251
253
  this.concept = oldAttribute.concept;
252
- this.options.mergeOptions(oldAttribute.options, this.type === "lookup");
254
+ this.options.mergeOptions(oldAttribute.options, addNotExistingOptions ?? this.type === "lookup", removeNotExistingOptions);
253
255
  this.options.deselectAll();
254
256
  if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {
255
257
  this.update(oldAttribute.inputvalue);
@@ -287,6 +289,19 @@ export default class ChoiceAttributeModel extends AttributeModel {
287
289
  return this;
288
290
  }
289
291
 
292
+ /**
293
+ * Registers a missing error that was received from the server
294
+ */
295
+ addMissingError(receivedAttribute) {
296
+ if (this.isChangedSince(0)) {
297
+ this._errorCollection.addServerError("Constraint.Missing");
298
+ }
299
+ // update choice options
300
+ if (receivedAttribute instanceof ChoiceAttributeModel) {
301
+ this.mergeAttribute(receivedAttribute, true, true);
302
+ }
303
+ }
304
+
290
305
  /**
291
306
  */
292
307
  set hasContentConfiguration(hasContentConfiguration) {
@@ -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","_defineProperty","_referenceDate","getData","now","_options","create","referenceDate","layouthint","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_findInstanceProperty","call","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","_context","_mapInstanceProperty","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includesInstanceProperty","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","isChoiceAttributeOptionModel","equals","add","toString","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","placeholder","addServerError","error","id","message","properties","ANSWER_OPTION_KEY","_context8","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\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\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 get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\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>, errors: Array<ErrorResponse>) {\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, errors);\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 (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\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,0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D;;EAEA;AACF;AACA;EACE,IAAIG,WAAWA,CAAA,EAAW;IACxB,OAAO,IAAI,CAAC1F,eAAe,CAAC,aAAa,EAAE,EAAE,CAAC;EAChD;;EAEA;AACF;AACA;EACE2F,cAAcA,CAACC,KAAsB,EAAE;IACrC,MAAM;MAAEC,EAAE;MAAEC,OAAO;MAAEC,UAAU;MAAErG;IAAW,CAAC,GAAGkG,KAAK;IAErD,MAAMI,iBAAiB,GAAG,mBAAmB;IAE7C,IAAID,UAAU,IAAIzH,GAAG,CAACyH,UAAU,EAAEC,iBAAiB,CAAC,EAAE;MAAA,IAAAC,SAAA;MACpD,MAAMC,SAAS,GAAGH,UAAU,CAACC,iBAAiB,CAAC;MAC/C,MAAMG,WAAW,GAAGhF,qBAAA,CAAA8E,SAAA,OAAI,CAACrF,OAAO,EAAAQ,IAAA,CAAA6E,SAAA,EAC7BjE,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKiE,SAC9B,CAAC;MACD,IAAIC,WAAW,EAAE;QACfJ,UAAU,CAACC,iBAAiB,CAAC,GAAGG,WAAW,CAACC,yBAAyB,CACnE,IAAI,CAACjB,oBACP,CAAC;MACH;IACF;IAEA,IAAI,CAACkB,gBAAgB,CAACV,cAAc,CAACE,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAErG,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAI4G,aAAaA,CAAA,EAAkC;IACjD,IAAI,IAAI,CAACxG,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAOhB,eAAe,CAACyH,KAAK;IAC9B;IAEA,OAAOzH,eAAe,CAAC0H,MAAM;EAC/B;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ChoiceAttributeModel.js","names":["has","DateUtil","AttributeModel","ChoiceAttributeOptionCollection","ChoiceAttributeOptionModel","ContentConfigurationElements","RENDER_SECTION_LABEL","SORT_OPTIONS","ATTRIBUTE_WIDTH","ChoiceAttributeModel","constructor","attribute","attributeContributions","_defineProperty","_referenceDate","getData","now","_options","create","referenceDate","layouthint","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_findInstanceProperty","call","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","_context","_mapInstanceProperty","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includesInstanceProperty","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","addNotExistingOptions","arguments","undefined","removeNotExistingOptions","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","isChoiceAttributeOptionModel","equals","add","toString","addMissingError","receivedAttribute","isChangedSince","_errorCollection","addServerError","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","placeholder","error","id","message","properties","ANSWER_OPTION_KEY","_context8","optionKey","foundOption","getContentConfiguredLabel","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\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\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 get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\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>, errors: Array<ErrorResponse>) {\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, errors);\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(\n oldAttribute: AttributeType,\n addNotExistingOptions: boolean = false,\n removeNotExistingOptions: boolean = false,\n ) {\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(\n oldAttribute.options,\n addNotExistingOptions ?? this.type === \"lookup\",\n removeNotExistingOptions,\n );\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 (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\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 * Registers a missing error that was received from the server\n */\n addMissingError(receivedAttribute?: AttributeType): void {\n if (this.isChangedSince(0)) {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n // update choice options\n if (receivedAttribute instanceof ChoiceAttributeModel) {\n this.mergeAttribute(receivedAttribute, true, true);\n }\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;AAMjD;AACA;AACA;AACA,eAAe,MAAMC,oBAAoB,SAASP,cAAc,CAAC;EAK/D;AACF;AACA;EACEQ,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzC,IAAI,CAACC,cAAc,GAAG,IAAI,CAACC,OAAO,CAAC,eAAe,EAAEd,QAAQ,CAACe,GAAG,CAAC,CAAC,CAAC;IACnE,IAAI,CAACC,QAAQ,GAAGd,+BAA+B,CAACe,MAAM,CACpDP,SAAS,EACTC,sBAAsB,EACtB,IAAI,CAACO,aACP,CAAC;IAED,IAAI,IAAI,CAACC,UAAU,CAACpB,GAAG,CAACO,YAAY,CAAC,EAAE;MACrC,IAAI,CAACU,QAAQ,CAACI,WAAW,GAAG,IAAI;IAClC;EACF;;EAEA;AACF;EACE,OAAOC,iBAAiB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E;MAAEC,OAAO;MAAEC,UAAU;MAAE7G;IAAW,CAAC,GAAG0G,KAAK;IAErD,MAAMI,iBAAiB,GAAG,mBAAmB;IAE7C,IAAID,UAAU,IAAIjI,GAAG,CAACiI,UAAU,EAAEC,iBAAiB,CAAC,EAAE;MAAA,IAAAC,SAAA;MACpD,MAAMC,SAAS,GAAGH,UAAU,CAACC,iBAAiB,CAAC;MAC/C,MAAMG,WAAW,GAAGxF,qBAAA,CAAAsF,SAAA,OAAI,CAAC7F,OAAO,EAAAQ,IAAA,CAAAqF,SAAA,EAC7BzE,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKyE,SAC9B,CAAC;MACD,IAAIC,WAAW,EAAE;QACfJ,UAAU,CAACC,iBAAiB,CAAC,GAAGG,WAAW,CAACC,yBAAyB,CACnE,IAAI,CAAChB,oBACP,CAAC;MACH;IACF;IAEA,IAAI,CAACH,gBAAgB,CAACC,cAAc,CAACW,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAE7G,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAImH,aAAaA,CAAA,EAAkC;IACjD,IAAI,IAAI,CAAC/G,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAOhB,eAAe,CAACgI,KAAK;IAC9B;IAEA,OAAOhI,eAAe,CAACiI,MAAM;EAC/B;AACF","ignoreList":[]}
@@ -256,15 +256,22 @@ class ChoiceAttributeOptionCollection extends ResourceCollection {
256
256
  */
257
257
  mergeOptions(withOptions) {
258
258
  let addNotExistingOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
259
- if (addNotExistingOptions) {
260
- this.collection = [...this.collection, ..._filterInstanceProperty(withOptions).call(withOptions, option => !this.collection.some(opt => opt.code === option.code))];
261
- }
259
+ let removeNotExistingOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
260
+ const newCollection = [];
262
261
  this.collection.forEach(option => {
263
262
  const foundOption = _findInstanceProperty(withOptions).call(withOptions, withOption => withOption.code === option.code);
264
263
  if (foundOption) {
265
264
  option.mergeOption(foundOption);
265
+ newCollection.push(option);
266
+ } else if (!removeNotExistingOptions) {
267
+ newCollection.push(option);
266
268
  }
267
269
  });
270
+ if (addNotExistingOptions) {
271
+ this.collection = [...newCollection, ..._filterInstanceProperty(withOptions).call(withOptions, option => !this.collection.some(opt => opt.code === option.code))];
272
+ } else {
273
+ this.collection = newCollection;
274
+ }
268
275
  }
269
276
 
270
277
  /**