@beinformed/ui 1.13.1 → 1.13.5
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.
- package/CHANGELOG.md +20 -0
- package/esm/constants/LayoutHintConfig.js +9 -0
- package/esm/constants/LayoutHintConfig.js.map +1 -1
- package/esm/constants/LayoutHints.js +5 -0
- package/esm/constants/LayoutHints.js.map +1 -1
- package/esm/constants/Settings.js +2 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js +3 -3
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js +1 -0
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +2 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +8 -3
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/ResourceCollection.js +4 -2
- package/esm/models/base/ResourceCollection.js.map +1 -1
- package/esm/models/base/ResourceModel.js +1 -0
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +2 -1
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +2 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +2 -0
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/href/Href.js +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +1 -2
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/serverNoSSR.js +1 -1
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/redux/_modularui/actions.js +16 -17
- package/esm/redux/_modularui/actions.js.map +1 -1
- package/esm/redux/_modularui/reducer.js +1 -2
- package/esm/redux/_modularui/reducer.js.map +1 -1
- package/esm/redux/actions/SignIn.js +5 -9
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/utils/fetch/xhr.js +2 -1
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/objects.js +2 -1
- package/esm/utils/helpers/objects.js.map +1 -1
- package/lib/constants/LayoutHintConfig.js +9 -0
- package/lib/constants/LayoutHintConfig.js.flow +9 -0
- package/lib/constants/LayoutHintConfig.js.map +1 -1
- package/lib/constants/LayoutHints.js +8 -2
- package/lib/constants/LayoutHints.js.flow +4 -0
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js +2 -1
- package/lib/constants/Settings.js.flow +2 -0
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +1 -0
- package/lib/models/attributes/AttributeContent.js +3 -3
- package/lib/models/attributes/AttributeContent.js.flow +3 -3
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.flow +10 -2
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js +1 -0
- package/lib/models/attributes/BooleanAttributeModel.js.flow +4 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +4 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +5 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +2 -1
- package/lib/models/attributes/CompositeAttributeModel.js.flow +1 -0
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +9 -3
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -4
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/StringAttributeModel.spec.js.flow +1 -1
- package/lib/models/base/BaseCollection.js.flow +2 -2
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/ResourceCollection.js +4 -2
- package/lib/models/base/ResourceCollection.js.flow +4 -6
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js +1 -0
- package/lib/models/base/ResourceModel.js.flow +3 -2
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/base/__tests__/BaseModel.spec.js.flow +5 -5
- package/lib/models/concepts/BusinessScenarioModel.js +3 -1
- package/lib/models/concepts/BusinessScenarioModel.js.flow +2 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +3 -1
- package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.flow +5 -2
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js.flow +6 -2
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +2 -0
- package/lib/models/content/ContentLinkModel.js.flow +2 -0
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/href/Href.js +1 -1
- package/lib/models/href/Href.js.flow +4 -3
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/types.js.flow +2 -2
- package/lib/react-server/__tests__/serverUtil.spec.js.flow +15 -14
- package/lib/react-server/renderSSRComplete.js +1 -2
- package/lib/react-server/renderSSRComplete.js.flow +2 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +1 -1
- package/lib/react-server/serverNoSSR.js.flow +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -0
- package/lib/redux/_modularui/actions.js +12 -12
- package/lib/redux/_modularui/actions.js.flow +12 -12
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/_modularui/reducer.js +1 -2
- package/lib/redux/_modularui/reducer.js.flow +0 -1
- package/lib/redux/_modularui/reducer.js.map +1 -1
- package/lib/redux/actions/SignIn.js +6 -9
- package/lib/redux/actions/SignIn.js.flow +5 -11
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/__tests__/Application.spec.js.flow +1 -0
- package/lib/redux/actions/__tests__/CustomErrorResponseHandler.spec.js.flow +2 -0
- package/lib/utils/fetch/__tests__/xhr.spec.js.flow +1 -0
- package/lib/utils/fetch/xhr.js +3 -1
- package/lib/utils/fetch/xhr.js.flow +3 -1
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/objects.js +3 -1
- package/lib/utils/helpers/objects.js.flow +2 -2
- package/lib/utils/helpers/objects.js.map +1 -1
- package/package.json +25 -25
- package/src/constants/LayoutHintConfig.js +9 -0
- package/src/constants/LayoutHints.js +4 -0
- package/src/constants/Settings.js +2 -0
- package/src/hooks/__tests__/useAuthentication.spec.js +1 -0
- package/src/models/attributes/AttributeContent.js +3 -3
- package/src/models/attributes/AttributeModel.js +10 -2
- package/src/models/attributes/BooleanAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +1 -1
- package/src/models/attributes/ChoiceAttributeOptionModel.js +5 -2
- package/src/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/src/models/attributes/CompositeAttributeModel.js +1 -0
- package/src/models/attributes/DatetimeAttributeModel.js +7 -4
- package/src/models/attributes/__tests__/StringAttributeModel.spec.js +1 -1
- package/src/models/base/BaseCollection.js +2 -2
- package/src/models/base/ResourceCollection.js +4 -6
- package/src/models/base/ResourceModel.js +3 -2
- package/src/models/base/__tests__/BaseModel.spec.js +5 -5
- package/src/models/concepts/BusinessScenarioModel.js +2 -1
- package/src/models/concepts/ConceptDetailModel.js +2 -2
- package/src/models/concepts/ConceptLinkModel.js +5 -2
- package/src/models/concepts/ConceptRelationModel.js +6 -2
- package/src/models/content/ContentLinkModel.js +2 -0
- package/src/models/href/Href.js +4 -3
- package/src/models/types.js +2 -2
- package/src/react-server/__tests__/serverUtil.spec.js +15 -14
- package/src/react-server/renderSSRComplete.js +2 -1
- package/src/react-server/serverNoSSR.js +1 -1
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -0
- package/src/redux/_modularui/actions.js +12 -12
- package/src/redux/_modularui/reducer.js +0 -1
- package/src/redux/actions/SignIn.js +5 -11
- package/src/redux/actions/__tests__/Application.spec.js +1 -0
- package/src/redux/actions/__tests__/CustomErrorResponseHandler.spec.js +2 -0
- package/src/utils/fetch/__tests__/xhr.spec.js +1 -0
- package/src/utils/fetch/xhr.js +3 -1
- package/src/utils/helpers/objects.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.13.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.13.4...v1.13.5) (2022-02-10)
|
|
6
|
+
|
|
7
|
+
### [1.13.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.13.3...v1.13.4) (2022-02-04)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **date-format:** add hint that makes it possible to ignore global date format for specific attribute ([ff94f03](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/ff94f03014eb035e37c88f880dbac1de1c60da33))
|
|
12
|
+
|
|
13
|
+
### [1.13.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.13.2...v1.13.3) (2022-02-04)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **date-format:** add hint that makes it possible to ignore global date format for specific attribute ([dc54191](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/dc5419151a6c42a013901f0e12634c1943ff0644))
|
|
18
|
+
|
|
19
|
+
### [1.13.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.13.1...v1.13.2) (2022-01-28)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **xhr:** add global setting for xhr timeout ([793f945](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/793f9458c5b237d857f504f01f725b1b347949d2))
|
|
24
|
+
|
|
5
25
|
### [1.13.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.13.0...v1.13.1) (2021-12-23)
|
|
6
26
|
|
|
7
27
|
### Bug Fixes
|
|
@@ -89,6 +89,15 @@ export var LayoutHintConfiguration = {
|
|
|
89
89
|
link: "",
|
|
90
90
|
component: ["attribute/number"]
|
|
91
91
|
},
|
|
92
|
+
IGNORE_FORMAT_SETTING: {
|
|
93
|
+
hint: "ignore-format-setting",
|
|
94
|
+
description: {
|
|
95
|
+
NL: "Maakt het mogelijk om de global date format setting te negeren voor een specifiek attribuut",
|
|
96
|
+
EN: "Makes it possible to ignore the global date format for a specific attribute"
|
|
97
|
+
},
|
|
98
|
+
link: "",
|
|
99
|
+
component: ["attribute/date", "attribute/datetime"]
|
|
100
|
+
},
|
|
92
101
|
CREATE_ACTION: {
|
|
93
102
|
hint: "create",
|
|
94
103
|
description: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/LayoutHintConfig.js"],"names":["LayoutHintConfiguration","MANDATORY","hint","description","NL","EN","link","component","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE_ACTION","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CONFIRM_PASSWORD","TITLE","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","CREATE_ACTION","UPDATE_ACTION","DELETE_ACTION","SORT_OPTIONS","CASEVIEW_LINK","DISABLED"],"mappings":"AACA,OAAO,IAAMA,uBAAuB,GAAG;AACrCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,WADG;AAETC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,iGADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFJ;AAMTC,IAAAA,IAAI,EAAE,EANG;AAOTC,IAAAA,SAAS,EAAE,CAAC,WAAD;AAPF,GAD0B;AAUrCC,EAAAA,2BAA2B,EAAE;AAC3BN,IAAAA,IAAI,EAAE,wCADqB;AAE3BC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,2MADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFc;AAM3BC,IAAAA,IAAI,EAAE,EANqB;AAO3BC,IAAAA,SAAS,EAAE,CAAC,mBAAD,EAAsB,kBAAtB;AAPgB,GAVQ;AAmBrCE,EAAAA,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AE;AACXC,MAAAA,EAAE,EAAE,+BADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFA;AAMbE,IAAAA,SAAS,EAAE,CAAC,MAAD;AANE,GAtHsB;AA8HrCY,EAAAA,aAAa,EAAE;AACbjB,IAAAA,IAAI,EAAE,QADO;AAEbC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,kCADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFA;AAMbE,IAAAA,SAAS,EAAE,CAAC,MAAD;AANE,GA9HsB;AAsIrCa,EAAAA,YAAY,EAAE;AACZlB,IAAAA,IAAI,EAAE,cADM;AAEZC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,4BADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFD;AAMZE,IAAAA,SAAS,EAAE,CAAC,kBAAD;AANC,GAtIuB;AA8IrCc,EAAAA,aAAa,EAAE;AACbnB,IAAAA,IAAI,EAAE,gBADO;AAEbC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,uHADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFA;AAMbE,IAAAA,SAAS,EAAE,CAAC,qBAAD,EAAwB,sBAAxB;AANE,GA9IsB;AAsJrCe,EAAAA,QAAQ,EAAE;AACRpB,IAAAA,IAAI,EAAE,UADE;AAERC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,8CADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFL;AAMRC,IAAAA,IAAI,EAAE,EANE;AAORC,IAAAA,SAAS,EAAE,CAAC,WAAD;AAPH;AAtJ2B,CAAhC","sourcesContent":["// @flow\nexport const LayoutHintConfiguration = {\n MANDATORY: {\n hint: \"mandatory\",\n description: {\n NL: \"Geeft aan of een attribuut verplicht is. Dient samen met de dependency hint gebruikt te worden.\",\n EN: \"Indicates a mandatory attribute.\\nShould be used together with the dependency hint.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n DEPENDENT_ATTRIBUTE_CONTROL: {\n hint: \"dependent-control:${unique-control-id}\",\n description: {\n NL: \"Geeft aan dat dit het attribuut is waar attributen van afhankelijk zijn. Het unique-control-id is een uniek id dat kan worden gebruikt in the hint voor de show|hide actie op het afhankelijke attribuut.\",\n EN: \"Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\",\n },\n link: \"\",\n component: [\"attribute/boolean\", \"attribute/choice\"],\n },\n DEPENDENT_ATTRIBUTE_ACTION: {\n hint: \"dependent-attribute:(show|hide) when dependent-control:${unique-control-id} (equals|includes|notEquals|notIncludes) [${codemaps}]\",\n description: {\n NL: \"Toon of verberg een attribute dat afhankelijk is van de geselecteerde opties van een keuze attribute\",\n EN: \"To show or hide an attribute dependent on options of the choice control codemap that are selected or not selected.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n SHOW_ONE_RESULT_AS_DETAIL: {\n hint: \"show-one-result-as-detail\",\n description: {\n NL: \"Een lijst met maar één item mag direct als detail getoond worden.\",\n EN: \"A list with only one detail must be shown as a detail.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n HIDE_WHEN_EMPTY: {\n hint: \"hide-when-empty\",\n description: {\n NL: \"Een lijst zonder lijst-items en lijst-taken dient niet getoond worden.\",\n EN: \"A list without list-items and list-tasks should not be shown.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n INITIAL_FILTER: {\n hint: \"initial-filter:${filter-name}=${initial-value}\",\n description: {\n NL: \"Laad de lijst met een standaardwaarde voor een filter, er is geen controle op het bestaan van het filter. Als het filter niet is geconfigureerd, treedt er een fout op. Houd er rekening mee dat filters hoofdlettergevoelig zijn.\",\n EN: \"Load the list with a default value for a filter, there is no check for the existence of the filter. If the filter is not configured, an error occurs. Keep in mind that filters are case sensitive.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n CONFIRM_PASSWORD: {\n hint: \"confirm-password\",\n description: {\n NL: \"Wachtwoord attribuut moet bevestigd worden dmv een tweede wachtwoord attribuut.\",\n EN: \"Password attribute must be confirmed using a second password attribute.\",\n },\n link: \"\",\n component: [\"attribute/password\"],\n },\n TITLE: {\n hint: \"title\",\n description: {\n NL: \"Markeert een attribuut als een titel attribuut\",\n EN: \"Marks an attribute as a title attribute\",\n },\n link: \"\",\n component: [\n \"caseview_table\",\n \"codemap\",\n \"list/appointment_table\",\n \"list/assignment_table\",\n \"list/caseproperties_table\",\n \"list/document_table\",\n \"list/timelimit_table\",\n \"list/eventhistory_table\",\n \"list/note_table\",\n \"list/record_table\",\n \"list/case_table\",\n \"list/casesearch_table\",\n \"list/datastore_table\",\n \"list/datastoreview_table\",\n \"list/instrumentresult_table\",\n \"list/event_table\",\n \"list/user_table\",\n \"list/organization_table\",\n ],\n },\n INITIAL_TOTAL_FILESIZE: {\n hint: \"initial-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de reeds gebruikte file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n MAX_TOTAL_FILESIZE: {\n hint: \"max-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de maximaal toegestane file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n CREATE_ACTION: {\n hint: \"create\",\n description: {\n NL: \"Markeer taak als creëer taak.\",\n EN: \"Mark task as create task\",\n },\n component: [\"form\"],\n },\n UPDATE_ACTION: {\n hint: \"update\",\n description: {\n NL: \"Markeer taak als bewerk taak.\",\n EN: \"Mark task as update task\",\n },\n component: [\"form\"],\n },\n DELETE_ACTION: {\n hint: \"delete\",\n description: {\n NL: \"Markeer taak als verwijder taak.\",\n EN: \"Mark task as delete task\",\n },\n component: [\"form\"],\n },\n SORT_OPTIONS: {\n hint: \"sort-options\",\n description: {\n NL: \"Sorteer opties alfabetisch\",\n EN: \"Sort options alphabetically\",\n },\n component: [\"attribute/choice\"],\n },\n CASEVIEW_LINK: {\n hint: \"case-view-link\",\n description: {\n NL: \"Markeer een case id reference attribute als de referentie naar de case view. Vervangt de self link van een lijst item\",\n EN: \"Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\",\n },\n component: [\"attribute/reference\", \"list/datastore_table\"],\n },\n DISABLED: {\n hint: \"disabled\",\n description: {\n NL: \"Geeft aan of een attribuut uitgeschakeld is.\",\n EN: \"Indicates a disabled attribute.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n};\n"],"file":"LayoutHintConfig.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/constants/LayoutHintConfig.js"],"names":["LayoutHintConfiguration","MANDATORY","hint","description","NL","EN","link","component","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE_ACTION","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CONFIRM_PASSWORD","TITLE","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","IGNORE_FORMAT_SETTING","CREATE_ACTION","UPDATE_ACTION","DELETE_ACTION","SORT_OPTIONS","CASEVIEW_LINK","DISABLED"],"mappings":"AACA,OAAO,IAAMA,uBAAuB,GAAG;AACrCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,WADG;AAETC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,iGADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFJ;AAMTC,IAAAA,IAAI,EAAE,EANG;AAOTC,IAAAA,SAAS,EAAE,CAAC,WAAD;AAPF,GAD0B;AAUrCC,EAAAA,2BAA2B,EAAE;AAC3BN,IAAAA,IAAI,EAAE,wCADqB;AAE3BC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,2MADO;AAEXC,M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AAI,EAAE,UADE;AAERC,IAAAA,WAAW,EAAE;AACXC,MAAAA,EAAE,EAAE,8CADO;AAEXC,MAAAA,EAAE,EAAE;AAFO,KAFL;AAMRC,IAAAA,IAAI,EAAE,EANE;AAORC,IAAAA,SAAS,EAAE,CAAC,WAAD;AAPH;AA/J2B,CAAhC","sourcesContent":["// @flow\nexport const LayoutHintConfiguration = {\n MANDATORY: {\n hint: \"mandatory\",\n description: {\n NL: \"Geeft aan of een attribuut verplicht is. Dient samen met de dependency hint gebruikt te worden.\",\n EN: \"Indicates a mandatory attribute.\\nShould be used together with the dependency hint.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n DEPENDENT_ATTRIBUTE_CONTROL: {\n hint: \"dependent-control:${unique-control-id}\",\n description: {\n NL: \"Geeft aan dat dit het attribuut is waar attributen van afhankelijk zijn. Het unique-control-id is een uniek id dat kan worden gebruikt in the hint voor de show|hide actie op het afhankelijke attribuut.\",\n EN: \"Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\",\n },\n link: \"\",\n component: [\"attribute/boolean\", \"attribute/choice\"],\n },\n DEPENDENT_ATTRIBUTE_ACTION: {\n hint: \"dependent-attribute:(show|hide) when dependent-control:${unique-control-id} (equals|includes|notEquals|notIncludes) [${codemaps}]\",\n description: {\n NL: \"Toon of verberg een attribute dat afhankelijk is van de geselecteerde opties van een keuze attribute\",\n EN: \"To show or hide an attribute dependent on options of the choice control codemap that are selected or not selected.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n SHOW_ONE_RESULT_AS_DETAIL: {\n hint: \"show-one-result-as-detail\",\n description: {\n NL: \"Een lijst met maar één item mag direct als detail getoond worden.\",\n EN: \"A list with only one detail must be shown as a detail.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n HIDE_WHEN_EMPTY: {\n hint: \"hide-when-empty\",\n description: {\n NL: \"Een lijst zonder lijst-items en lijst-taken dient niet getoond worden.\",\n EN: \"A list without list-items and list-tasks should not be shown.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n INITIAL_FILTER: {\n hint: \"initial-filter:${filter-name}=${initial-value}\",\n description: {\n NL: \"Laad de lijst met een standaardwaarde voor een filter, er is geen controle op het bestaan van het filter. Als het filter niet is geconfigureerd, treedt er een fout op. Houd er rekening mee dat filters hoofdlettergevoelig zijn.\",\n EN: \"Load the list with a default value for a filter, there is no check for the existence of the filter. If the filter is not configured, an error occurs. Keep in mind that filters are case sensitive.\",\n },\n link: \"\",\n component: [\"list\"],\n },\n CONFIRM_PASSWORD: {\n hint: \"confirm-password\",\n description: {\n NL: \"Wachtwoord attribuut moet bevestigd worden dmv een tweede wachtwoord attribuut.\",\n EN: \"Password attribute must be confirmed using a second password attribute.\",\n },\n link: \"\",\n component: [\"attribute/password\"],\n },\n TITLE: {\n hint: \"title\",\n description: {\n NL: \"Markeert een attribuut als een titel attribuut\",\n EN: \"Marks an attribute as a title attribute\",\n },\n link: \"\",\n component: [\n \"caseview_table\",\n \"codemap\",\n \"list/appointment_table\",\n \"list/assignment_table\",\n \"list/caseproperties_table\",\n \"list/document_table\",\n \"list/timelimit_table\",\n \"list/eventhistory_table\",\n \"list/note_table\",\n \"list/record_table\",\n \"list/case_table\",\n \"list/casesearch_table\",\n \"list/datastore_table\",\n \"list/datastoreview_table\",\n \"list/instrumentresult_table\",\n \"list/event_table\",\n \"list/user_table\",\n \"list/organization_table\",\n ],\n },\n INITIAL_TOTAL_FILESIZE: {\n hint: \"initial-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de reeds gebruikte file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n MAX_TOTAL_FILESIZE: {\n hint: \"max-total-file-size\",\n description: {\n NL: \"Wordt gebruikt in samenwerking met een upload attribuut, deze hint moet worden gezet op een readonly attribuut dat de maximaal toegestane file grootte bevat.\",\n EN: \"Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\",\n },\n link: \"\",\n component: [\"attribute/number\"],\n },\n IGNORE_FORMAT_SETTING: {\n hint: \"ignore-format-setting\",\n description: {\n NL: \"Maakt het mogelijk om de global date format setting te negeren voor een specifiek attribuut\",\n EN: \"Makes it possible to ignore the global date format for a specific attribute\",\n },\n link: \"\",\n component: [\"attribute/date\", \"attribute/datetime\"],\n },\n CREATE_ACTION: {\n hint: \"create\",\n description: {\n NL: \"Markeer taak als creëer taak.\",\n EN: \"Mark task as create task\",\n },\n component: [\"form\"],\n },\n UPDATE_ACTION: {\n hint: \"update\",\n description: {\n NL: \"Markeer taak als bewerk taak.\",\n EN: \"Mark task as update task\",\n },\n component: [\"form\"],\n },\n DELETE_ACTION: {\n hint: \"delete\",\n description: {\n NL: \"Markeer taak als verwijder taak.\",\n EN: \"Mark task as delete task\",\n },\n component: [\"form\"],\n },\n SORT_OPTIONS: {\n hint: \"sort-options\",\n description: {\n NL: \"Sorteer opties alfabetisch\",\n EN: \"Sort options alphabetically\",\n },\n component: [\"attribute/choice\"],\n },\n CASEVIEW_LINK: {\n hint: \"case-view-link\",\n description: {\n NL: \"Markeer een case id reference attribute als de referentie naar de case view. Vervangt de self link van een lijst item\",\n EN: \"Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\",\n },\n component: [\"attribute/reference\", \"list/datastore_table\"],\n },\n DISABLED: {\n hint: \"disabled\",\n description: {\n NL: \"Geeft aan of een attribuut uitgeschakeld is.\",\n EN: \"Indicates a disabled attribute.\",\n },\n link: \"\",\n component: [\"attribute\"],\n },\n};\n"],"file":"LayoutHintConfig.js"}
|
|
@@ -58,6 +58,11 @@ export var SORT_OPTIONS = getHint("SORT_OPTIONS");
|
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
60
|
export var TITLE = getHint("TITLE");
|
|
61
|
+
/**
|
|
62
|
+
* Layout-hint: Ignore the global input format for specific attribute
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
export var IGNORE_FORMAT_SETTING = getHint("IGNORE_FORMAT_SETTING");
|
|
61
66
|
/*
|
|
62
67
|
* --------------------------------
|
|
63
68
|
* FORM
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/LayoutHints.js"],"names":["LayoutHintConfiguration","getHint","hint","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"mappings":"AACA,SAASA,uBAAT,QAAwC,oBAAxC;AAEA;AACA;AACA;;AACA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAA0B;AACxC,MAAIF,uBAAuB,CAACE,IAAD,CAA3B,EAAmC;AACjC,WAAOF,uBAAuB,CAACE,IAAD,CAAvB,CAA8BA,IAArC;AACD;;AAED,SAAO,EAAP;AACD,CAND;AAQA;AACA;AACA;;;AACA,OAAO,IAAMC,SAAiB,GAAGF,OAAO,CAAC,WAAD,CAAjC;AAEP;AACA;AACA;AACA;;AACA,OAAO,IAAMG,QAAgB,GAAGH,OAAO,CAAC,UAAD,CAAhC;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,IAAMI,2BAA2B,GAAG,mBAApC;AACP;AACA;;AACA,OAAO,IAAMC,mBAAmB,GAAG,sBAA5B;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,IAAMC,gBAAwB,GAAGN,OAAO,CAAC,kBAAD,CAAxC;AACP;AACA;AACA;;AACA,OAAO,IAAMO,YAAoB,GAAGP,OAAO,CAAC,cAAD,CAApC;AACP;AACA;AACA;;AACA,OAAO,IAAMQ,KAAa,GAAGR,OAAO,CAAC,OAAD,CAA7B;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,
|
|
1
|
+
{"version":3,"sources":["../../src/constants/LayoutHints.js"],"names":["LayoutHintConfiguration","getHint","hint","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","IGNORE_FORMAT_SETTING","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"mappings":"AACA,SAASA,uBAAT,QAAwC,oBAAxC;AAEA;AACA;AACA;;AACA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAA0B;AACxC,MAAIF,uBAAuB,CAACE,IAAD,CAA3B,EAAmC;AACjC,WAAOF,uBAAuB,CAACE,IAAD,CAAvB,CAA8BA,IAArC;AACD;;AAED,SAAO,EAAP;AACD,CAND;AAQA;AACA;AACA;;;AACA,OAAO,IAAMC,SAAiB,GAAGF,OAAO,CAAC,WAAD,CAAjC;AAEP;AACA;AACA;AACA;;AACA,OAAO,IAAMG,QAAgB,GAAGH,OAAO,CAAC,UAAD,CAAhC;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,IAAMI,2BAA2B,GAAG,mBAApC;AACP;AACA;;AACA,OAAO,IAAMC,mBAAmB,GAAG,sBAA5B;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,IAAMC,gBAAwB,GAAGN,OAAO,CAAC,kBAAD,CAAxC;AACP;AACA;AACA;;AACA,OAAO,IAAMO,YAAoB,GAAGP,OAAO,CAAC,cAAD,CAApC;AACP;AACA;AACA;;AACA,OAAO,IAAMQ,KAAa,GAAGR,OAAO,CAAC,OAAD,CAA7B;AACP;AACA;AACA;;AACA,OAAO,IAAMS,qBAA6B,GAAGT,OAAO,CAAC,uBAAD,CAA7C;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,IAAMU,aAAqB,GAAGV,OAAO,CAAC,eAAD,CAArC;AACP;AACA;AACA;;AACA,OAAO,IAAMW,aAAqB,GAAGX,OAAO,CAAC,eAAD,CAArC;AACP;AACA;AACA;;AACA,OAAO,IAAMY,aAAqB,GAAGZ,OAAO,CAAC,eAAD,CAArC;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,IAAMa,sBAA8B,GAAGb,OAAO,CAAC,wBAAD,CAA9C;AACP;AACA;AACA;;AACA,OAAO,IAAMc,kBAA0B,GAAGd,OAAO,CAAC,oBAAD,CAA1C;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;AACA,OAAO,IAAMe,yBAAiC,GAAGf,OAAO,CACtD,2BADsD,CAAjD;AAGP;AACA;AACA;;AACA,OAAO,IAAMgB,eAAuB,GAAGhB,OAAO,CAAC,iBAAD,CAAvC;AACP;AACA;AACA;;AACA,OAAO,IAAMiB,cAAsB,GAAG,iBAA/B;AACP;AACA;AACA;;AACA,OAAO,IAAMC,aAAqB,GAAGlB,OAAO,CAAC,eAAD,CAArC;AAEP;AACA;AACA;;AACA,OAAO,IAAMmB,oBAAoB,GAAG,sBAA7B;AAEP;AACA;;AACA,OAAO,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA6B;AAAA,SAAcrB,uBAAd;AAAA,CAAnC;AAEP,eAAeC,OAAf","sourcesContent":["// @flow\nimport { LayoutHintConfiguration } from \"./LayoutHintConfig\";\n\n/**\n * Retrieve layout hint by id from the layout hint configuration\n */\nconst getHint = (hint: string): string => {\n if (LayoutHintConfiguration[hint]) {\n return LayoutHintConfiguration[hint].hint;\n }\n\n return \"\";\n};\n\n/**\n * Layout-hint: Indicates a mandatory attribute. Should be used together with the dependency hint.\n */\nexport const MANDATORY: string = getHint(\"MANDATORY\");\n\n/**\n * Layout-hint: Indicates a disabled attribute.\n * @constant\n */\nexport const DISABLED: string = getHint(\"DISABLED\");\n\n/*\n * --------------------------------\n * SELECT DEPENDENT ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\n */\nexport const DEPENDENT_ATTRIBUTE_CONTROL = \"dependent-control\";\n/**\n */\nexport const DEPENDENT_ATTRIBUTE = \"dependent-attribute:\";\n\n/*\n * --------------------------------\n * ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Password attribute must be confirmed using a second password attribute.\n */\nexport const CONFIRM_PASSWORD: string = getHint(\"CONFIRM_PASSWORD\");\n/**\n * Layout-hint: Sort options alphabetically\n */\nexport const SORT_OPTIONS: string = getHint(\"SORT_OPTIONS\");\n/**\n * Layout-hint: Marks an attribute as a title attribute\n */\nexport const TITLE: string = getHint(\"TITLE\");\n/**\n * Layout-hint: Ignore the global input format for specific attribute\n */\nexport const IGNORE_FORMAT_SETTING: string = getHint(\"IGNORE_FORMAT_SETTING\");\n\n/*\n * --------------------------------\n * FORM\n * --------------------------------\n */\n/**\n * Layout-hint: Mark task as delete task\n */\nexport const DELETE_ACTION: string = getHint(\"DELETE_ACTION\");\n/**\n * Layout-hint: Mark task as update task\n */\nexport const UPDATE_ACTION: string = getHint(\"UPDATE_ACTION\");\n/**\n * Layout-hint: Mark task as create task\n */\nexport const CREATE_ACTION: string = getHint(\"CREATE_ACTION\");\n\n/*\n * --------------------------------\n * UPLOAD TOTAL FILE SIZE\n * --------------------------------\n */\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\n */\nexport const INITIAL_TOTAL_FILESIZE: string = getHint(\"INITIAL_TOTAL_FILESIZE\");\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\n */\nexport const MAX_TOTAL_FILESIZE: string = getHint(\"MAX_TOTAL_FILESIZE\");\n\n/*\n * --------------------------------\n * LISTS\n * --------------------------------\n */\n/**\n * Layout-hint: A list with only one detail must be shown as a detail\n */\nexport const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(\n \"SHOW_ONE_RESULT_AS_DETAIL\"\n);\n/**\n * Layout-hint: A list without list-items and list-tasks should not be shown.\n */\nexport const HIDE_WHEN_EMPTY: string = getHint(\"HIDE_WHEN_EMPTY\");\n/**\n * Layout-hint: Sets a default value on a filter\n */\nexport const INITIAL_FILTER: string = \"initial-filter:\";\n/**\n * Layout-hint: Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\n */\nexport const CASEVIEW_LINK: string = getHint(\"CASEVIEW_LINK\");\n\n/**\n * Layout-hint: Set on configuration of instruments to show content in a popover on a label\n */\nexport const RENDER_SECTION_LABEL = \"render-section-label\";\n\n/**\n */\nexport const getLayoutHintConfiguration = (): Object => LayoutHintConfiguration;\n\nexport default getHint;\n"],"file":"LayoutHints.js"}
|
|
@@ -41,7 +41,8 @@ var defaultSettings = {
|
|
|
41
41
|
// disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1
|
|
42
42
|
ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,
|
|
43
43
|
// reload the complete page on signout, usefull when third party authentication is in place
|
|
44
|
-
PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false
|
|
44
|
+
PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,
|
|
45
|
+
XHR_TIMEOUT_MS: 300000
|
|
45
46
|
};
|
|
46
47
|
var settings = defaultSettings;
|
|
47
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/Settings.js"],"names":["isPlainObject","has","ALL_CONTENT_IN_DATA_SETTING","defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AACA,SAASC,2BAAT,QAA4C,aAA5C;AAIA,IAAMC,eAAe,GAAG;AACtB;AACAC,EAAAA,4BAA4B,EAAE,IAFR;AAItB;AACAC,EAAAA,yBAAyB,EAAE,IALL;AAOtB;AACAC,EAAAA,kBAAkB,EAAE,KARE;AAUtB;AACAC,EAAAA,sBAAsB,EAAE,IAXF;AAatB;AACAC,EAAAA,qCAAqC,EAAE,IAdjB;AAgBtB;AACAC,EAAAA,oCAAoC,EAAE,KAjBhB;AAmBtB;AACAC,EAAAA,oBAAoB,EAAE,CAAC,UAAD,EAAa,WAAb,CApBA;AAsBtB;AACAC,EAAAA,yBAAyB,EAAE,IAvBL;AAyBtB;AACAC,EAAAA,6BAA6B,EAAE,IA1BT;AA4BtB;AACAC,EAAAA,eAAe,EAAE,CAAC,IAAD,EAAO,IAAP,CA7BK;AA+BtB;AACAC,EAAAA,qBAAqB,EAAE,IAhCD;AAkCtB;AACAC,EAAAA,wBAAwB,EAAE,GAnCJ;AAqCtB;AACAC,EAAAA,+BAA+B,EAAE,kCAtCX;AAwCtB;AACAC,EAAAA,iBAAiB,EAAE,EAzCG;AA2CtB;AACAC,EAAAA,oBAAoB,EAAE,EA5CA;AA8CtB;AACAC,EAAAA,uBAAuB,EAAE,CA/CH;AAiDtB;AACAC,EAAAA,iCAAiC,EAAE,CAlDb;AAoDtB;AACAC,EAAAA,aAAa,EAAE,EArDO;AAuDtB;AACAC,EAAAA,6BAA6B,EAAE,IAxDT;AA0DtB;AACAC,EAAAA,iCAAiC,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../src/constants/Settings.js"],"names":["isPlainObject","has","ALL_CONTENT_IN_DATA_SETTING","defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AACA,SAASC,2BAAT,QAA4C,aAA5C;AAIA,IAAMC,eAAe,GAAG;AACtB;AACAC,EAAAA,4BAA4B,EAAE,IAFR;AAItB;AACAC,EAAAA,yBAAyB,EAAE,IALL;AAOtB;AACAC,EAAAA,kBAAkB,EAAE,KARE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AAKC,SAA5C,EAAuD;AACrD,UAAM,IAAIC,KAAJ,6BACiBH,GADjB,0CAAN;AAGD;;AAED,0BAAOJ,QAAQ,CAACI,GAAD,CAAf,yDAAwBC,YAAxB;AACD,CARM;AAUP;AACA;;AACA,OAAO,IAAMG,UAAU,GAAG,SAAbA,UAAa,CAACJ,GAAD,EAAcK,KAAd,EAA6B;AACrDT,EAAAA,QAAQ,CAACI,GAAD,CAAR,GAAgBK,KAAhB;AACD,CAFM;AAIP;AACA;;AACA,OAAO,IAAMC,WAAW,GAAG,SAAdA,WAAc;AAAA,SAAmCV,QAAnC;AAAA,CAApB;AAEP;AACA;;AACA,OAAO,IAAMW,mBAAmB,GAAG,SAAtBA,mBAAsB;AAAA,SACjCR,UAAU,CAAC1B,2BAAD,EAA8B,IAA9B,CADuB;AAAA,CAA5B","sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { ALL_CONTENT_IN_DATA_SETTING } from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n"],"file":"Settings.js"}
|
|
@@ -92,7 +92,7 @@ var AttributeContent = /*#__PURE__*/function () {
|
|
|
92
92
|
|
|
93
93
|
return (_this$_content$elemen = this._content.elements) === null || _this$_content$elemen === void 0 ? void 0 : _mapInstanceProperty(_this$_content$elemen).call(_this$_content$elemen, function (element) {
|
|
94
94
|
if ("propertyElement" in element) {
|
|
95
|
-
// $FlowIssue
|
|
95
|
+
// $FlowIssue[prop-missing]
|
|
96
96
|
var _element$propertyElem = element.propertyElement,
|
|
97
97
|
label = _element$propertyElem.label,
|
|
98
98
|
layouthint = _element$propertyElem.layouthint,
|
|
@@ -107,7 +107,7 @@ var AttributeContent = /*#__PURE__*/function () {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if ("textFragmentElement" in element) {
|
|
110
|
-
var _element$textFragment = // $FlowIssue
|
|
110
|
+
var _element$textFragment = // $FlowIssue[prop-missing]
|
|
111
111
|
element.textFragmentElement,
|
|
112
112
|
_label = _element$textFragment.label,
|
|
113
113
|
_layouthint = _element$textFragment.layouthint,
|
|
@@ -126,7 +126,7 @@ var AttributeContent = /*#__PURE__*/function () {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
if ("contentElement" in element) {
|
|
129
|
-
// $FlowIssue
|
|
129
|
+
// $FlowIssue[prop-missing]
|
|
130
130
|
var _element$contentEleme = element.contentElement,
|
|
131
131
|
_label2 = _element$contentEleme.label,
|
|
132
132
|
_layouthint2 = _element$contentEleme.layouthint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","isPlainObject","AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels","types","type","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AAEA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,Q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,CAGL,qBAHK,EAGkB,eAHlB,EAGmCF,MAHnC,CAAP;AAID;AAED;AACF;;;;SACE,eAAoC;AAClC,aAAO,KAAKC,4BAAL,CACL,gBADK,EAEL,UAFK,CAAP;AAID;AAED;AACF;;;;WACE,2BAAkBE,KAAlB,EAA6D;AAAA;;AAC3D,aAAO,yCAAKR,QAAL,kBAAqB,UAACC,OAAD;AAAA,eAAa,0BAAAO,KAAK,MAAL,CAAAA,KAAK,EAAUP,OAAO,CAACQ,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;AACA;;;;WACE,6BAAoBJ,MAApB,EAAgE;AAC9D,aAAO,KAAKE,mCAAL,CAGL,gBAHK,EAGa,UAHb,EAGyBF,MAHzB,CAAP;AAID;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMK,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKV,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCS,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,qBAAST,OAAO,CAACW,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe7B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"propertyElement\" in element) {\n // $FlowIssue\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (\"textFragmentElement\" in element) {\n const { label, layouthint, textfragments } =\n // $FlowIssue\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (\"contentElement\" in element) {\n // $FlowIssue\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","isPlainObject","AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels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AAL,CAGL,iBAHK,EAGc,YAHd,EAG4BF,MAH5B,CAAP;AAID;AAED;AACF;;;;SACE,eAA6C;AAC3C,aAAO,KAAKC,4BAAL,CACL,qBADK,EAEL,eAFK,CAAP;AAID;AAED;AACF;AACA;;;;WACE,kCAAyBD,MAAzB,EAAyE;AACvE,aAAO,KAAKE,mCAAL,CAGL,qBAHK,EAGkB,eAHlB,EAGmCF,MAHnC,CAAP;AAID;AAED;AACF;;;;SACE,eAAoC;AAClC,aAAO,KAAKC,4BAAL,CACL,gBADK,EAEL,UAFK,CAAP;AAID;AAED;AACF;;;;WACE,2BAAkBE,KAAlB,EAA6D;AAAA;;AAC3D,aAAO,yCAAKR,QAAL,kBAAqB,UAACC,OAAD;AAAA,eAAa,0BAAAO,KAAK,MAAL,CAAAA,KAAK,EAAUP,OAAO,CAACQ,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;AACA;;;;WACE,6BAAoBJ,MAApB,EAAgE;AAC9D,aAAO,KAAKE,mCAAL,CAGL,gBAHK,EAGa,UAHb,EAGyBF,MAHzB,CAAP;AAID;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMK,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKV,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCS,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,qBAAST,OAAO,CAACW,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe7B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"propertyElement\" in element) {\n // $FlowIssue[prop-missing]\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (\"textFragmentElement\" in element) {\n const { label, layouthint, textfragments } =\n // $FlowIssue[prop-missing]\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (\"contentElement\" in element) {\n // $FlowIssue[prop-missing]\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/AttributeModel.js"],"names":["DateUtil","isPlainObject","BaseModel","ConstraintCollection","ErrorCollection","LinkCollection","StringLengthConstraint","MandatoryConstraint","ConceptDetailModel","MANDATORY","DISABLED","ATTRIBUTE_WIDTH","TIMEVERSION_FILTER_NAME","getSetting","hasAllContentInData","IllegalArgumentException","UnsupportedOperationException","AttributeContent","AttributeModel","attribute","attributeContributions","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","hasContentConfiguration","conceptLink","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","_parentKey","parentKey","type","_hasContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","configuredLabelProperty","some","_id","firstConfiguredLabel","alignmentHints","getByLayoutHint","alignment","substring","defaultAlignment","downloadLink","links","getLinksByGroup","first","getLinkByKey","addParameter","referenceDate","isCacheable","_concept","date","inputvalue","toString","getInputValue","validate","hasValue","inError","name","getFormData","getValue","updateLastModification","_validatedValue","_readonly","readonly","static","isResult","disabled","getContribution","format","validateValue","constraints","add","_serverConstraints","minLength","maxLength","addConstraints","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","constraintCollection","undefined","collection","invalidConstraints","isChangedSince","error","properties","removeServerError","errorCollection","serverErrors","hasItems","defaultMessage","addConstraint","params","forEach","paramKey","paramValue","formatValue","errors","resetErrors","formatParameters","addServerConstraint","_lastModification","Date","timestamp","oldAttribute","isValid","update","changedAttribute","_isEditable","isEditable","_isHidden","isHidden","otherAttribute","MEDIUM","_layoutHintRules","rules","attributes","layoutHintRules","process"],"mappings":";;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AP,EAA+C;AAC7C,aACE,KAAKtG,GAAL,KAAasG,cAAc,CAACtG,GAA5B,IACA,KAAKE,SAAL,KAAmBoG,cAAc,CAACpG,SAFpC;AAID;AAED;AACF;AACA;;;;SACE,eAAmD;AACjD,aAAO/C,eAAe,CAACoJ,MAAvB;AACD;AAED;AACF;;;;SACE,eAAgD;AAC9C,aAAO,KAAKC,gBAAZ;AACD;AAED;AACF;;SACE,aAAoBC,KAApB,EAAqD;AACnD,WAAKD,gBAAL,GAAwBC,KAAxB;AACD;AAED;AACF;;;;WACE,gCAAuBC,UAAvB,EAAwD;AACtD,UAAI,KAAKF,gBAAT,EAA2B;AACzB,aAAKG,eAAL,CAAqBC,OAArB,CAA6B,IAA7B,EAAmCF,UAAnC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAOpJ,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,IAAIG,gBAAJ,CAAqB,KAAKU,IAAL,CAAUL,OAA/B,CAAP;AACD;;;WAv1BD,2BAAyBG,aAAzB,EAAyD;AACvD,UAAI,CAACxB,aAAa,CAACwB,aAAD,CAAlB,EAAmC;AACjC,cAAM,IAAIV,wBAAJ,CACJ,oEADI,CAAN;AAGD;;AAED,aAAO,KAAP;AACD;;;;EA1EyCb,S;;SAAvBgB,c","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 { MANDATORY, DISABLED } 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 { AttributeType, FormErrorAnchor, ModularUIModel } 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\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel extends BaseModel {\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 );\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(models: Array<ModularUIModel>) {\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(contentConfiguration: ContentConfiguration) {\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 \"\";\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) {\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() {\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) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties\n );\n }\n\n /**\n */\n removeServerError(id: string) {\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() {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError() {\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 = {};\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>) {\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.forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties)\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() {\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() {\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) {\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() {\n this.isHidden = false;\n }\n\n /**\n */\n hide() {\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) {\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"],"file":"AttributeModel.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/AttributeModel.js"],"names":["DateUtil","isPlainObject","BaseModel","ConstraintCollection","ErrorCollection","LinkCollection","StringLengthConstraint","MandatoryConstraint","ConceptDetailModel","MANDATORY","DISABLED","ATTRIBUTE_WIDTH","TIMEVERSION_FILTER_NAME","getSetting","hasAllContentInData","IllegalArgumentException","UnsupportedOperationException","AttributeContent","AttributeModel","attribute","attributeContributions","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","hasContentConfiguration","conceptLink","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","_parentKey","parentKey","type","_hasContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","configuredLabelProperty","some","_id","firstConfiguredLabel","alignmentHints","getByLayoutHint","alignment","substring","defaultAlignment","downloadLink","links","getLinksByGroup","first","getLinkByKey","addParameter","referenceDate","isCacheable","_concept","date","inputvalue","toString","getInputValue","validate","hasValue","inError","name","getFormData","getValue","updateLastModification","_validatedValue","_readonly","readonly","static","isResult","disabled","getContribution","format","validateValue","constraints","add","_serverConstraints","minLength","maxLength","addConstraints","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","constraintCollection","undefined","collection","invalidConstraints","isChangedSince","error","properties","removeServerError","errorCollection","serverErrors","hasItems","defaultMessage","addConstraint","params","forEach","paramKey","paramValue","formatValue","errors","resetErrors","formatParameters","addServerConstraint","_lastModification","Date","timestamp","oldAttribute","isValid","update","changedAttribute","_isEditable","isEditable","_isHidden","isHidden","otherAttribute","MEDIUM","_layoutHintRules","rules","attributes","layoutHintRules","process"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,SAASA,QAAT,QAAyB,mCAAzB;AACA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,OAAOC,SAAP,MAAsB,mBAAtB;AACA,OAAOC,oBAAP,MAAiC,0CAAjC;AACA,OAAOC,eAAP,MAA4B,0BAA5B;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AAEA,OAAOC,sBAAP,MAAmC,4CAAnC;AACA,OAAOC,mBAAP,MAAgC,yCAAhC;AAEA,OAAOC,kBAAP,MAA+B,gCAA/B;AAEA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,6BAApC;AACA,SACEC,eADF,EAEEC,uBAFF,QAGO,2BAHP;AAKA,SAASC,UAAT,EAAqBC,mBAArB,QAAgD,0BAAhD;AAEA,SACEC,wBADF,EAEEC,6BAFF,QAGO,kBAHP;AAiBA,OAAOC,gBAAP,MAA6B,oBAA7B;AAEA;AACA;AACA;;IACqBC,c;;;;;AA6BnB;AACF;AACE,0BAAYC,SAAZ,EAA+BC,sBAA/B,EAA+D;AAAA;;AAAA;;AAC7D,8BAAMD,SAAN,EAAiBC,sBAAjB;;AAD6D;;AAAA,wEA1BnC,CA0BmC;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,yEAnBpB,IAAIjB,oB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AED,aAAO,KAAP;AACD;;;;EA5EOb,S;;SADWgB,c","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 { MANDATORY, DISABLED } 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\";\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 );\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(models: Array<ModularUIModel>) {\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(contentConfiguration: ContentConfiguration) {\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 \"\";\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) {\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() {\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) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties\n );\n }\n\n /**\n */\n removeServerError(id: string) {\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() {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError() {\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 = {};\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>) {\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.forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties)\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() {\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() {\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) {\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() {\n this.isHidden = false;\n }\n\n /**\n */\n hide() {\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) {\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"],"file":"AttributeModel.js"}
|
|
@@ -182,6 +182,7 @@ var BooleanAttributeModel = /*#__PURE__*/function (_AttributeModel) {
|
|
|
182
182
|
get: function get() {
|
|
183
183
|
var _context3;
|
|
184
184
|
|
|
185
|
+
// $FlowFixMe[incompatible-call]
|
|
185
186
|
return _mapInstanceProperty(_context3 = this.options.selected).call(_context3, function (option) {
|
|
186
187
|
return option.code;
|
|
187
188
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/BooleanAttributeModel.js"],"names":["AttributeModel","DateUtil","ChoiceAttributeOptionCollection","ContentConfigurationElements","ChoiceAttributeOptionModel","RENDER_SECTION_LABEL","ATTRIBUTE_WIDTH","BooleanAttributeModel","attribute","attributeContributions","_referenceDate","getData","now","_options","create","referenceDate","date","options","hint","layouthint","has","_hasContentConfiguration","hasContentConfiguration","contentConfiguration","contributions","content","optionElements","optionElementConfig","optionElement","contentElement","selected","option","code","label","join","Array","isArray","_initvalue","length","disableOption","enableOption","deselectAll","select","inputvalue","getInputValue","deselect","oldAttribute","readonly","concept","isValid","update","value","updateLastModification","values","isMultiple","split","forEach","val","toggleOption","some","toString","inError","hasValue","choicetype","name","hasAlternativeLabel","SMALL","EXTRA_SMALL","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,cAAP,MAA2B,kBAA3B;AAEA,SAASC,QAAT,QAAyB,mCAAzB;AAEA,OAAOC,+BAAP,MAA4C,mCAA5C;AACA,OAAOC,4BAAP,MAAyC,sDAAzC;AACA,OAAOC,0BAAP,MAAuC,8BAAvC;AAEA,SAASC,oBAAT,QAAqC,6BAArC;AACA,SAASC,eAAT,QAAgC,iBAAhC;;AAIA;AACA;AACA;IACqBC,qB;;;;;AAKnB;AACF;AACE,iCAAYC,SAAZ,EAA+BC,sBAA/B,EAA+D;AAAA;;AAAA;;AAC7D,8BAAMD,SAAN,EAAiBC,sBAAjB;;AAD6D;;AAAA;;AAAA,+EAJ3B,KAI2B;;AAG7D,UAAKC,cAAL,GAAsB,MAAKC,OAAL,CAAa,eAAb,EAA8BV,QAAQ,CAACW,GAAT,EAA9B,CAAtB;AACA,UAAKC,QAAL,GAAgBX,+BAA+B,CAACY,MAAhC,CACdN,SADc,EAEdC,sBAFc,EAGd,MAAKM,aAHS,CAAhB;AAJ6D;AAS9D;AAED;AACF;;;;;;AAKE;AACF;AACE,mBAAmB;AACjB,aAAO,SAAP;AACD;AAED;AACF;AACA;;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CAACG,OAAP,CAAe,UAACC,GAAD,EAAS;AACtB,YAAIA,GAAG,YAAYrD,0BAAnB,EAA+C;AAC7C,UAAA,MAAI,CAACsD,YAAL,CAAkBD,GAAG,CAACzB,IAAtB;AACD,SAFD,MAEO,IACL,OAAOyB,GAAP,KAAe,QAAf,IACA,MAAI,CAACxC,OAAL,CAAa0C,IAAb,CAAkB,UAAC5B,MAAD;AAAA,iBAAYA,MAAM,CAACC,IAAP,CAAY4B,QAAZ,OAA2BH,GAAvC;AAAA,SAAlB,CAFK,EAGL;AACA,UAAA,MAAI,CAACC,YAAL,CAAkBD,GAAlB;AACD;AACF,OATD;AAWA,aAAO,IAAP;AACD;AAED;AACF;;;;WACE,uBAAmD;AACjD,UAAI,KAAKI,OAAL,EAAJ,EAAoB;AAClB,eAAO,IAAP;AACD;;AAED,UAAI,CAAC,KAAKC,QAAL,EAAL,EAAsB;AACpB;AACA,YAAI,KAAKC,UAAL,KAAoB,UAApB,IAAkC,KAAKA,UAAL,KAAoB,QAA1D,EAAoE;AAClE,qCAAU,KAAKC,IAAf,EAAsB,KAAtB;AACD;;AAED,mCAAU,KAAKA,IAAf,EAAsB,IAAtB;AACD;;AAED,iCAAU,KAAKA,IAAf,EAAsB,KAAKb,KAAL,KAAe,MAArC;AACD;AAED;AACF;;;;SACE,eAAmD;AACjD,UAAI,KAAKlC,OAAL,CAAa0C,IAAb,CAAkB,UAAC5B,MAAD;AAAA,eAAYA,MAAM,CAACkC,mBAAnB;AAAA,OAAlB,CAAJ,EAA+D;AAC7D,eAAO3D,eAAe,CAAC4D,KAAvB;AACD;;AAED,aAAO5D,eAAe,CAAC6D,WAAvB;AACD;;;WAnQD,2BAAyB3C,aAAzB,EAAyD;AACvD,aAAOA,aAAa,CAAC4C,IAAd,KAAuB,SAA9B;AACD;;;;EAtBgDpE,c;;SAA9BO,qB","sourcesContent":["// @flow\nimport AttributeModel from \"./AttributeModel\";\n\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\n\nimport { RENDER_SECTION_LABEL } from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { AttributeType } from \"../types\";\n\n/**\n * Model for a boolean attribute\n */\nexport default class BooleanAttributeModel extends AttributeModel {\n _referenceDate: string;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean = false;\n\n /**\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\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return contributions.type === \"boolean\";\n }\n\n /**\n */\n get type(): string {\n return \"boolean\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): string {\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 * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype(): \"checkbox\" | \"radiobutton\" | \"combobox\" | \"toggle\" {\n return (\n [\"checkbox\", \"radiobutton\", \"combobox\", \"toggle\"].find((hint) =>\n this.layouthint.has(hint)\n ) || \"radiobutton\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return false;\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return false;\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 * 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 return this.options.selected.map<string>((option) => option.code);\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 this.options.deselectAll();\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 * Reset boolean 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 BooleanAttributeModel) {\n this.concept = oldAttribute.concept;\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): BooleanAttributeModel {\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\n values.forEach((val) => {\n if (val instanceof ChoiceAttributeOptionModel) {\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 getFormData(): { [string]: boolean | null } | null {\n if (this.inError()) {\n return null;\n }\n\n if (!this.hasValue()) {\n // no value for checkbox and toggle is same as a false value\n if (this.choicetype === \"checkbox\" || this.choicetype === \"toggle\") {\n return { [this.name]: false };\n }\n\n return { [this.name]: null };\n }\n\n return { [this.name]: this.value === \"true\" };\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.options.some((option) => option.hasAlternativeLabel)) {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.EXTRA_SMALL;\n }\n}\n"],"file":"BooleanAttributeModel.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/BooleanAttributeModel.js"],"names":["AttributeModel","DateUtil","ChoiceAttributeOptionCollection","ContentConfigurationElements","ChoiceAttributeOptionModel","RENDER_SECTION_LABEL","ATTRIBUTE_WIDTH","BooleanAttributeModel","attribute","attributeContributions","_referenceDate","getData","now","_options","create","referenceDate","date","options","hint","layouthint","has","_hasContentConfiguration","hasContentConfiguration","contentConfiguration","contributions","content","optionElements","optionElementConfig","optionElement","contentElement","selected","option","code","label","join","Array","isArray","_initvalue","length","disableOption","enableOption","deselectAll","select","inputvalue","getInputValue","deselect","oldAttribute","readonly","concept","isValid","update","value","updateLastModification","values","isMultiple","split","forEach","val","toggleOption","some","toString","inError","hasValue","choicetype","name","hasAlternativeLabel","SMALL","EXTRA_SMALL","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,cAAP,MAA2B,kBAA3B;AAEA,SAASC,QAAT,QAAyB,mCAAzB;AAEA,OAAOC,+BAAP,MAA4C,mCAA5C;AACA,OAAOC,4BAAP,MAAyC,sDAAzC;AACA,OAAOC,0BAAP,MAAuC,8BAAvC;AAEA,SAASC,oBAAT,QAAqC,6BAArC;AACA,SAASC,eAAT,QAAgC,iBAAhC;;AAIA;AACA;AACA;IACqBC,qB;;;;;AAKnB;AACF;AACE,iCAAYC,SAAZ,EAA+BC,sBAA/B,EAA+D;AAAA;;AAAA;;AAC7D,8BAAMD,SAAN,EAAiBC,sBAAjB;;AAD6D;;AAAA;;AAAA,+EAJ3B,KAI2B;;AAG7D,UAAKC,cAAL,GAAsB,MAAKC,OAAL,CAAa,eAAb,EAA8BV,QAAQ,CAACW,GAAT,EAA9B,CAAtB;AACA,UAAKC,QAAL,GAAgBX,+BAA+B,CAACY,MAAhC,CACdN,SADc,EAEdC,sBAFc,EAGd,MAAKM,aAHS,CAAhB;AAJ6D;AAS9D;AAED;AACF;;;;;;AAKE;AACF;AACE,mBAAmB;AACjB,aAAO,SAAP;AACD;AAED;AACF;AACA;;;;SACE,eAA4B;AAC1B,aAAO,KAAKL,cAAZ;AACD;AAED;AACF;AACA;;SACE,aAAkBM,IAAlB,EAAgC;AAC9B,WAAKN,cAAL,GAAsBM,IAAtB;AAEA,WAAKC,OAAL,CAAaF,aAAb,GAA6BC,IAA7B;AACD;AAED;AACF;AACA;;;;SACE,eAAqE;AAAA;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CAAa0C,IAAb,CAAkB,UAAC5B,MAAD;AAAA,iBAAYA,MAAM,CAACC,IAAP,CAAY4B,QAAZ,OAA2BH,GAAvC;AAAA,SAAlB,CAFK,EAGL;AACA,UAAA,MAAI,CAACC,YAAL,CAAkBD,GAAlB;AACD;AACF,OATD;AAWA,aAAO,IAAP;AACD;AAED;AACF;;;;WACE,uBAAmD;AACjD,UAAI,KAAKI,OAAL,EAAJ,EAAoB;AAClB,eAAO,IAAP;AACD;;AAED,UAAI,CAAC,KAAKC,QAAL,EAAL,EAAsB;AACpB;AACA,YAAI,KAAKC,UAAL,KAAoB,UAApB,IAAkC,KAAKA,UAAL,KAAoB,QAA1D,EAAoE;AAClE,qCAAU,KAAKC,IAAf,EAAsB,KAAtB;AACD;;AAED,mCAAU,KAAKA,IAAf,EAAsB,IAAtB;AACD;;AAED,iCAAU,KAAKA,IAAf,EAAsB,KAAKb,KAAL,KAAe,MAArC;AACD;AAED;AACF;;;;SACE,eAAmD;AACjD,UAAI,KAAKlC,OAAL,CAAa0C,IAAb,CAAkB,UAAC5B,MAAD;AAAA,eAAYA,MAAM,CAACkC,mBAAnB;AAAA,OAAlB,CAAJ,EAA+D;AAC7D,eAAO3D,eAAe,CAAC4D,KAAvB;AACD;;AAED,aAAO5D,eAAe,CAAC6D,WAAvB;AACD;;;WAtQD,2BAAyB3C,aAAzB,EAAyD;AACvD,aAAOA,aAAa,CAAC4C,IAAd,KAAuB,SAA9B;AACD;;;;EAtBgDpE,c;;SAA9BO,qB","sourcesContent":["// @flow\nimport AttributeModel from \"./AttributeModel\";\n\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\n\nimport { RENDER_SECTION_LABEL } from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { AttributeType } from \"../types\";\n\n/**\n * Model for a boolean attribute\n */\nexport default class BooleanAttributeModel extends AttributeModel {\n _referenceDate: string;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean = false;\n\n /**\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\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return contributions.type === \"boolean\";\n }\n\n /**\n */\n get type(): string {\n return \"boolean\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): string {\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 * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype(): \"checkbox\" | \"radiobutton\" | \"combobox\" | \"toggle\" {\n return (\n [\"checkbox\", \"radiobutton\", \"combobox\", \"toggle\"].find((hint) =>\n this.layouthint.has(hint)\n ) || \"radiobutton\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return false;\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return false;\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 * 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 this.options.deselectAll();\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 * Reset boolean 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 BooleanAttributeModel) {\n this.concept = oldAttribute.concept;\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): BooleanAttributeModel {\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\n values.forEach((val) => {\n if (val instanceof ChoiceAttributeOptionModel) {\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 getFormData(): { [string]: boolean | null } | null {\n if (this.inError()) {\n return null;\n }\n\n if (!this.hasValue()) {\n // no value for checkbox and toggle is same as a false value\n if (this.choicetype === \"checkbox\" || this.choicetype === \"toggle\") {\n return { [this.name]: false };\n }\n\n return { [this.name]: null };\n }\n\n return { [this.name]: this.value === \"true\" };\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.options.some((option) => option.hasAlternativeLabel)) {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.EXTRA_SMALL;\n }\n}\n"],"file":"BooleanAttributeModel.js"}
|
|
@@ -185,6 +185,7 @@ var ChoiceAttributeModel = /*#__PURE__*/function (_AttributeModel) {
|
|
|
185
185
|
get: function get() {
|
|
186
186
|
var _context;
|
|
187
187
|
|
|
188
|
+
// $FlowFixMe[incompatible-call]
|
|
188
189
|
return _mapInstanceProperty(_context = this.options.selected).call(_context, function (option) {
|
|
189
190
|
return option.code;
|
|
190
191
|
});
|