@beinformed/ui 1.9.0-beta.1 → 1.9.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/esm/constants/Settings.js +10 -8
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useForm.js.map +1 -1
  5. package/esm/hooks/useModelCatalog.js +12 -5
  6. package/esm/hooks/useModelCatalog.js.map +1 -1
  7. package/esm/hooks/useNotification.js.map +1 -1
  8. package/esm/hooks/useRouter.js.map +1 -1
  9. package/esm/models/attributes/AttributeContent.js +132 -30
  10. package/esm/models/attributes/AttributeContent.js.map +1 -1
  11. package/esm/models/attributes/AttributeDataHelper.js +43 -53
  12. package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
  13. package/esm/models/attributes/AttributeModel.js +6 -4
  14. package/esm/models/attributes/AttributeModel.js.map +1 -1
  15. package/esm/models/attributes/ChoiceAttributeOptionModel.js +5 -5
  16. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  17. package/esm/models/attributes/HelptextAttributeModel.js +17 -1
  18. package/esm/models/attributes/HelptextAttributeModel.js.map +1 -1
  19. package/esm/models/caseview/CaseViewModel.js +16 -12
  20. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  21. package/esm/models/content/SectionModel.js +2 -1
  22. package/esm/models/content/SectionModel.js.map +1 -1
  23. package/esm/models/content/SubSectionModel.js +3 -1
  24. package/esm/models/content/SubSectionModel.js.map +1 -1
  25. package/esm/models/form/FormObjectModel.js +7 -1
  26. package/esm/models/form/FormObjectModel.js.map +1 -1
  27. package/esm/models/list/ListDetailModel.js +32 -3
  28. package/esm/models/list/ListDetailModel.js.map +1 -1
  29. package/esm/models/list/ListModel.js +22 -16
  30. package/esm/models/list/ListModel.js.map +1 -1
  31. package/esm/models/panels/GroupingPanelModel.js +19 -17
  32. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  33. package/esm/modularui/ModularUIRequest.js +2 -1
  34. package/esm/modularui/ModularUIRequest.js.map +1 -1
  35. package/esm/utils/helpers/text.js +19 -0
  36. package/esm/utils/helpers/text.js.map +1 -0
  37. package/esm/utils/index.js +2 -1
  38. package/esm/utils/index.js.map +1 -1
  39. package/lib/constants/Settings.js +12 -1
  40. package/lib/constants/Settings.js.flow +9 -5
  41. package/lib/constants/Settings.js.map +1 -1
  42. package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +3 -3
  43. package/lib/hooks/useForm.js.flow +10 -5
  44. package/lib/hooks/useForm.js.map +1 -1
  45. package/lib/hooks/useModelCatalog.js +13 -5
  46. package/lib/hooks/useModelCatalog.js.flow +12 -4
  47. package/lib/hooks/useModelCatalog.js.map +1 -1
  48. package/lib/hooks/useNotification.js.flow +5 -2
  49. package/lib/hooks/useNotification.js.map +1 -1
  50. package/lib/hooks/useRouter.js.flow +12 -5
  51. package/lib/hooks/useRouter.js.map +1 -1
  52. package/lib/models/attributes/AttributeContent.js +142 -31
  53. package/lib/models/attributes/AttributeContent.js.flow +104 -21
  54. package/lib/models/attributes/AttributeContent.js.map +1 -1
  55. package/lib/models/attributes/AttributeDataHelper.js +45 -52
  56. package/lib/models/attributes/AttributeDataHelper.js.flow +31 -32
  57. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  58. package/lib/models/attributes/AttributeModel.js +4 -2
  59. package/lib/models/attributes/AttributeModel.js.flow +3 -4
  60. package/lib/models/attributes/AttributeModel.js.map +1 -1
  61. package/lib/models/attributes/ChoiceAttributeOptionModel.js +4 -4
  62. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +5 -8
  63. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  64. package/lib/models/attributes/HelptextAttributeModel.js +17 -1
  65. package/lib/models/attributes/HelptextAttributeModel.js.flow +11 -1
  66. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  67. package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +137 -93
  68. package/lib/models/attributes/__tests__/AttributeDataHelper.spec.js.flow +177 -88
  69. package/lib/models/attributes/__tests__/HelptextAttributeModel.spec.js.flow +39 -1
  70. package/lib/models/caseview/CaseViewModel.js +17 -13
  71. package/lib/models/caseview/CaseViewModel.js.flow +9 -7
  72. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  73. package/lib/models/caseview/__tests__/CaseViewModel.spec.js.flow +68 -184
  74. package/lib/models/content/SectionModel.js +3 -1
  75. package/lib/models/content/SectionModel.js.flow +2 -1
  76. package/lib/models/content/SectionModel.js.map +1 -1
  77. package/lib/models/content/SubSectionModel.js +4 -1
  78. package/lib/models/content/SubSectionModel.js.flow +3 -1
  79. package/lib/models/content/SubSectionModel.js.map +1 -1
  80. package/lib/models/form/FormObjectModel.js +7 -1
  81. package/lib/models/form/FormObjectModel.js.flow +4 -0
  82. package/lib/models/form/FormObjectModel.js.map +1 -1
  83. package/lib/models/form/__tests__/FormWithContent.spec.js.flow +10 -2
  84. package/lib/models/list/ListDetailModel.js +32 -3
  85. package/lib/models/list/ListDetailModel.js.flow +21 -0
  86. package/lib/models/list/ListDetailModel.js.map +1 -1
  87. package/lib/models/list/ListModel.js +23 -16
  88. package/lib/models/list/ListModel.js.flow +9 -5
  89. package/lib/models/list/ListModel.js.map +1 -1
  90. package/lib/models/list/__tests__/ListDetailModel.spec.js.flow +64 -0
  91. package/lib/models/list/__tests__/ListModel.spec.js.flow +64 -2
  92. package/lib/models/panels/GroupingPanelModel.js +21 -18
  93. package/lib/models/panels/GroupingPanelModel.js.flow +10 -9
  94. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  95. package/lib/models/panels/__tests__/GroupingPanelModel.spec.js.flow +90 -0
  96. package/lib/models/types.js.flow +75 -0
  97. package/lib/modularui/ModularUIRequest.js +2 -1
  98. package/lib/modularui/ModularUIRequest.js.flow +1 -0
  99. package/lib/modularui/ModularUIRequest.js.map +1 -1
  100. package/lib/utils/helpers/text.js +28 -0
  101. package/lib/utils/helpers/text.js.flow +23 -0
  102. package/lib/utils/helpers/text.js.map +1 -0
  103. package/lib/utils/index.js +14 -0
  104. package/lib/utils/index.js.flow +1 -0
  105. package/lib/utils/index.js.map +1 -1
  106. package/package.json +19 -18
  107. package/src/constants/Settings.js +9 -5
  108. package/src/hooks/__tests__/useModelCatalog.spec.js +3 -3
  109. package/src/hooks/useForm.js +10 -5
  110. package/src/hooks/useModelCatalog.js +12 -4
  111. package/src/hooks/useNotification.js +5 -2
  112. package/src/hooks/useRouter.js +12 -5
  113. package/src/models/attributes/AttributeContent.js +104 -21
  114. package/src/models/attributes/AttributeDataHelper.js +31 -32
  115. package/src/models/attributes/AttributeModel.js +3 -4
  116. package/src/models/attributes/ChoiceAttributeOptionModel.js +5 -8
  117. package/src/models/attributes/HelptextAttributeModel.js +11 -1
  118. package/src/models/attributes/__tests__/AttributeContent.spec.js +137 -93
  119. package/src/models/attributes/__tests__/AttributeDataHelper.spec.js +177 -88
  120. package/src/models/attributes/__tests__/HelptextAttributeModel.spec.js +39 -1
  121. package/src/models/caseview/CaseViewModel.js +9 -7
  122. package/src/models/caseview/__tests__/CaseViewModel.spec.js +68 -184
  123. package/src/models/caseview/__tests__/caseview.json +38 -0
  124. package/src/models/caseview/__tests__/caseviewContributions.json +147 -0
  125. package/src/models/content/SectionModel.js +2 -1
  126. package/src/models/content/SubSectionModel.js +3 -1
  127. package/src/models/form/FormObjectModel.js +4 -0
  128. package/src/models/form/__tests__/FormWithContent.spec.js +10 -2
  129. package/src/models/form/__tests__/FormWithContentData.json +177 -80
  130. package/src/models/list/ListDetailModel.js +21 -0
  131. package/src/models/list/ListModel.js +9 -5
  132. package/src/models/list/__tests__/ListDetailModel.spec.js +64 -0
  133. package/src/models/list/__tests__/ListModel.spec.js +64 -2
  134. package/src/models/list/__tests__/caselist-34.contributions.json +1 -1
  135. package/src/models/list/__tests__/listContributions.json +1 -1
  136. package/src/models/panels/GroupingPanelModel.js +10 -9
  137. package/src/models/panels/__tests__/GroupingPanelModel.spec.js +90 -0
  138. package/src/models/panels/__tests__/groupingPanel.json +30 -0
  139. package/src/models/panels/__tests__/groupingPanelContributions.json +46 -0
  140. package/src/models/types.js +75 -0
  141. package/src/modularui/ModularUIRequest.js +1 -0
  142. package/src/utils/helpers/text.js +23 -0
  143. package/src/utils/index.js +1 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,71 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.9.0-beta.13](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.12...v1.9.0-beta.13) (2021-09-21)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **data-helper:** handle content on result elements ([13be04c](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/13be04ca46198ddec964401c5eda001111555260))
10
+
11
+ ## [1.9.0-beta.12](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.11...v1.9.0-beta.12) (2021-09-21)
12
+
13
+ ### Bug Fixes
14
+
15
+ - **attribute-content:** update structure of content ([d7496d2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/d7496d2862021d658a433fb5d016fc481acd5777))
16
+
17
+ ## [1.9.0-beta.11](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.10...v1.9.0-beta.11) (2021-09-20)
18
+
19
+ ### Bug Fixes
20
+
21
+ - **text:** update for new structure of introtext in contributions ([47bf99d](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/47bf99d4143678608b52f556be9158f6ced41807))
22
+
23
+ ## [1.9.0-beta.10](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.9...v1.9.0-beta.10) (2021-09-16)
24
+
25
+ ## [1.9.0-beta.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.8...v1.9.0-beta.9) (2021-09-14)
26
+
27
+ ### Bug Fixes
28
+
29
+ - **helptext-attribute:** allow for content in data ([b5228c9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/b5228c90737f9de33ef4ca0b0c24a976f97bc684))
30
+
31
+ ## [1.9.0-beta.8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.7...v1.9.0-beta.8) (2021-09-13)
32
+
33
+ ## [1.9.0-beta.7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.6...v1.9.0-beta.7) (2021-09-13)
34
+
35
+ ### Bug Fixes
36
+
37
+ - **content:** support text with placeholders in text-fragment and content ([0803157](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/080315782f766b2b98b654575533fc5afa5fab1c))
38
+
39
+ ## [1.9.0-beta.6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.5...v1.9.0-beta.6) (2021-09-10)
40
+
41
+ ### Bug Fixes
42
+
43
+ - **content:** allow for header in content element ([38af8b7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/38af8b733dc1c1288c1e7d033b2c67882580c57d))
44
+
45
+ ## [1.9.0-beta.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.4...v1.9.0-beta.5) (2021-09-08)
46
+
47
+ ### Bug Fixes
48
+
49
+ - **content:** update list detail model with content for instrument results ([b4d99ba](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/b4d99baa241494878c8892ea9308d07ddd8e6244))
50
+ - **content:** use correct property for propertyElement ([215c955](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/215c955f614214efd8ef2348353c48a241fc34ff))
51
+
52
+ ## [1.9.0-beta.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.3...v1.9.0-beta.4) (2021-09-07)
53
+
54
+ ### Bug Fixes
55
+
56
+ - **content:** update content model for new structure of content in data ([96bb2fc](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/96bb2fc9e0e4d71861f57ddf119b8d57bf7e9fbb))
57
+
58
+ ## [1.9.0-beta.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.2...v1.9.0-beta.3) (2021-09-03)
59
+
60
+ ### Bug Fixes
61
+
62
+ - **concept-property:** rename key to type ([9846969](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/984696962f794fe3f52a92202a3c9128b00a28b4))
63
+
64
+ ## [1.9.0-beta.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.1...v1.9.0-beta.2) (2021-09-02)
65
+
66
+ ### Bug Fixes
67
+
68
+ - **content:** improve useContentType hook ([908641d](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/908641d9d18a14df0568669dd8674c2471ce5ba6))
69
+
5
70
  ## [1.9.0-beta.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.0...v1.9.0-beta.1) (2021-09-02)
6
71
 
7
72
  ### Bug Fixes
@@ -1,5 +1,6 @@
1
1
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
2
2
  import { isPlainObject, has } from "../utils/helpers/objects";
3
+ import { ALL_CONTENT_IN_DATA_SETTING } from "./Constants";
3
4
  var defaultSettings = {
4
5
  // Debug missing i18n messages in layout
5
6
  DEBUG_I18N_MESSAGE_NOT_FOUND: true,
@@ -46,7 +47,7 @@ var settings = defaultSettings;
46
47
  /**
47
48
  */
48
49
 
49
- var setSettings = function setSettings(config) {
50
+ export var setSettings = function setSettings(config) {
50
51
  if (isPlainObject(config)) {
51
52
  settings = _Object$assign(defaultSettings, config);
52
53
  }
@@ -54,8 +55,7 @@ var setSettings = function setSettings(config) {
54
55
  /**
55
56
  */
56
57
 
57
-
58
- var getSetting = function getSetting(key, defaultValue) {
58
+ export var getSetting = function getSetting(key, defaultValue) {
59
59
  var _settings$key;
60
60
 
61
61
  if (!has(settings, key) && defaultValue === undefined) {
@@ -67,17 +67,19 @@ var getSetting = function getSetting(key, defaultValue) {
67
67
  /**
68
68
  */
69
69
 
70
-
71
- var setSetting = function setSetting(key, value) {
70
+ export var setSetting = function setSetting(key, value) {
72
71
  settings[key] = value;
73
72
  };
74
73
  /**
75
74
  */
76
75
 
77
-
78
- var allSettings = function allSettings() {
76
+ export var allSettings = function allSettings() {
79
77
  return settings;
80
78
  };
79
+ /**
80
+ */
81
81
 
82
- export { getSetting, setSetting, setSettings, allSettings };
82
+ export var hasAllContentInData = function hasAllContentInData() {
83
+ return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
84
+ };
83
85
  //# sourceMappingURL=Settings.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/Settings.js"],"names":["isPlainObject","has","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"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AAIA,IAAMC,e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AA;;AAC3D,MAAI,CAAC3B,GAAG,CAACsB,QAAD,EAAWI,GAAX,CAAJ,IAAuBC,YAAY,KAAKC,SAA5C,EAAuD;AACrD,UAAM,IAAIC,KAAJ,6BACiBH,GADjB,0CAAN;AAGD;;AAED,0BAAOJ,QAAQ,CAACI,GAAD,CAAf,yDAAwBC,YAAxB;AACD,CARD;AAUA;AACA;;;AACA,IAAMG,UAAU,GAAG,SAAbA,UAAa,CAACJ,GAAD,EAAcK,KAAd,EAA6B;AAC9CT,EAAAA,QAAQ,CAACI,GAAD,CAAR,GAAgBK,KAAhB;AACD,CAFD;AAIA;AACA;;;AACA,IAAMC,WAAW,GAAG,SAAdA,WAAc;AAAA,SAAmCV,QAAnC;AAAA,CAApB;;AAEA,SAASG,UAAT,EAAqBK,UAArB,EAAiCP,WAAjC,EAA8CS,WAA9C","sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\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\n DATE_INPUT_FORMAT: \"dd-MM-yyyy\",\n\n // readonly format for dates\n DATE_READONLY_FORMAT: \"dd-MM-yyyy\",\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\nlet settings = defaultSettings;\n\n/**\n */\nconst setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nconst 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 */\nconst setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nconst allSettings = (): { [name: string]: Setting } => settings;\n\nexport { getSetting, setSetting, setSettings, allSettings };\n"],"file":"Settings.js"}
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,YAzCG;AA2CtB;AACAC,EAAAA,oBAAoB,EAAE,YA5CA;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;AA3Db,CAAxB;AA8DA,IAAIC,QAAQ,GAAGrB,eAAf;AAEA;AACA;;AACA,OAAO,IAAMsB,WAAW,GAAG,SAAdA,WAAc,CAACC,MAAD,EAAoB;AAC7C,MAAI1B,aAAa,CAAC0B,MAAD,CAAjB,EAA2B;AACzBF,IAAAA,QAAQ,GAAG,eAAcrB,eAAd,EAA+BuB,MAA/B,CAAX;AACD;AACF,CAJM;AAMP;AACA;;AACA,OAAO,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAACC,GAAD,EAAcC,YAAd,EAA0C;AAAA;;AAClE,MAAI,CAAC5B,GAAG,CAACuB,QAAD,EAAWI,GAAX,CAAJ,IAAuBC,YAAY,KAAKC,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,CAACzB,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\n DATE_INPUT_FORMAT: \"dd-MM-yyyy\",\n\n // readonly format for dates\n DATE_READONLY_FORMAT: \"dd-MM-yyyy\",\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\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"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","FormModel","useForm","href","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":"AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,IAAP,MAAiB,qBAAjB;AAEA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,cAAzC;AAEA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,qBAAhD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SACEC,yBADF,EAEEC,UAFF,EAGEC,4BAHF,EAIEC,cAJF,EAKEC,4BALF,EAMEC,oBANF,EAOEC,mBAPF,QAQO,kBARP;AAUA,OAAOC,SAAP,MAAsB,0BAAtB;;AAyBA;AACA;AACA;AACA,OAAO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAqC;AAC1D,MAAMC,QAAQ,GAAG,IAAIhB,IAAJ,CAASe,IAAT,CAAjB;;AAEA,MAAI,CAAC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react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel } from \"../models\";\nimport type { AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\ntype FormNavigationHook = {\n previous: (form: FormModel) => void,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => void,\n};\n\ntype AttributeSetHook = {\n save: () => void,\n cancel: (object: FormObjectModel) => void,\n remove: (object: FormObjectModel) => void,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"file":"useForm.js"}
1
+ {"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","FormModel","useForm","href","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":"AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,IAAP,MAAiB,qBAAjB;AAEA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,cAAzC;AAEA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,qBAAhD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SACEC,yBADF,EAEEC,UAFF,EAGEC,4BAHF,EAIEC,cAJF,EAKEC,4BALF,EAMEC,oBANF,EAOEC,mBAPF,QAQO,kBARP;AAUA,OAAOC,SAAP,MAAsB,0BAAtB;;AA8BA;AACA;AACA;AACA,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;AAAA,aACNZ,QAAQ,CAACf,4BAA4B,CAACQ,IAAD,EAAOmB,MAAP,CAA7B,CADF;AAAA;AAJH,GAAP;AAOD,CAVM","sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel } from \"../models\";\nimport type { AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\nimport type {\n RemoveModelByKeyAction,\n UpdateModelAction,\n} from \"../redux/_modularui\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateModelAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateModelAction,\n cancel: (object: FormObjectModel) => UpdateModelAction,\n remove: (object: FormObjectModel) => UpdateModelAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"file":"useForm.js"}
@@ -1,3 +1,4 @@
1
+ import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
1
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
2
3
  import { useLocation } from "./useRouter";
3
4
  import ModelCatalogModel from "../models/modelcatalog/ModelCatalogModel";
@@ -29,14 +30,20 @@ export var useConceptIndex = function useConceptIndex(href) {
29
30
  };
30
31
 
31
32
  var getHref = function getHref(context, dynamic, location) {
32
- var _context;
33
+ var href = dynamic;
33
34
 
34
- var href = _concatInstanceProperty(_context = "/".concat(context, "/")).call(_context, dynamic).replace(/\/\//g, "/");
35
+ if (!_startsWithInstanceProperty(href).call(href, "/".concat(context, "/"))) {
36
+ var _context;
37
+
38
+ href = _concatInstanceProperty(_context = "/".concat(context, "/")).call(_context, href);
39
+ }
40
+
41
+ href = href.replace(/\/\//g, "/");
35
42
 
36
43
  if (location !== null && location !== void 0 && location.search) {
37
44
  var _context2;
38
45
 
39
- return _concatInstanceProperty(_context2 = "".concat(href)).call(_context2, location.search);
46
+ href = _concatInstanceProperty(_context2 = "".concat(href)).call(_context2, location.search);
40
47
  }
41
48
 
42
49
  return href;
@@ -86,8 +93,8 @@ export var useContent = function useContent(contentSection) {
86
93
  */
87
94
 
88
95
  export var useContentType = function useContentType(contentType) {
89
- var href = getHref("contenttype", contentType);
90
- return useModularUIBasic("contenttype", href, {
96
+ var href = getHref("contenttypes", contentType);
97
+ return useModularUIBasic("contenttypes", href, {
91
98
  expectedModels: ["ContentType"],
92
99
  targetModel: ContentTypeModel
93
100
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useModelCatalog.js"],"names":["useLocation","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","expectedModels","targetModel","useConceptIndex","href","getHref","context","dynamic","location","replace","search","useConceptDetail","concept","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType"],"mappings":";AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,iBAAP,MAA8B,0CAA9B;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;AACA,OAAOC,kBAAP,MAA+B,uCAA/B;AACA,SAASC,OAAO,IAAIC,qBAApB,QAAiD,0CAAjD;AACA,OAAOC,iBAAP,MAA8B,qCAA9B;AACA,OAAOC,eAAP,MAA4B,mCAA5B;AACA,OAAOC,YAAP,MAAyB,gCAAzB;AAEA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,gBAAT,QAAiC,WAAjC;AAEA;AACA;;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAC7BF,iBAAiB,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Ac,EAAE,CAAC,cAAD,CADsB;AAEtCC,IAAAA,WAAW,EAAEP;AAFyB,GAAvB,CADY;AAAA,CAAxB;AAMP;AACA;;AACA,OAAO,IAAMmB,aAAa,GAAG,SAAhBA,aAAgB,CAACC,OAAD,EAAuC;AAClE,MAAMP,QAAQ,GAAGnB,WAAW,EAA5B;AACA,MAAMe,IAAI,GAAGC,OAAO,CAAC,SAAD,EAAYU,OAAZ,EAAqBP,QAArB,CAApB;AACA,SAAOV,iBAAiB,CAAC,YAAD,EAAeM,IAAf,EAAqB;AAC3CH,IAAAA,cAAc,EAAE,CAAC,YAAD,CAD2B;AAE3CC,IAAAA,WAAW,EAAEN;AAF8B,GAArB,CAAxB;AAID,CAPM;AASP;AACA;;AACA,OAAO,IAAMoB,UAAU,GAAG,SAAbA,UAAa,CAACC,cAAD,EAA2C;AACnE,MAAMb,IAAI,GAAGC,OAAO,CAAC,SAAD,EAAYY,cAAZ,CAApB;AACA,SAAOnB,iBAAiB,CAAC,SAAD,EAAYM,IAAZ,EAAkB;AACxCH,IAAAA,cAAc,EAAE,CAAC,SAAD,CADwB;AAExCC,IAAAA,WAAW,EAAEL;AAF2B,GAAlB,CAAxB;AAID,CANM;AAQP;AACA;;AACA,OAAO,IAAMqB,cAAc,GAAG,SAAjBA,cAAiB,CAACC,WAAD,EAA4C;AACxE,MAAMf,IAAI,GAAGC,OAAO,CAAC,aAAD,EAAgBc,WAAhB,CAApB;AACA,SAAOrB,iBAAiB,CAAC,aAAD,EAAgBM,IAAhB,EAAsB;AAC5CH,IAAAA,cAAc,EAAE,CAAC,aAAD,CAD4B;AAE5CC,IAAAA,WAAW,EAAEH;AAF+B,GAAtB,CAAxB;AAID,CANM","sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel =>\n useModularUIBasic(\"conceptindex\", href, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n\nconst getHref = (context, dynamic, location) => {\n let href = `/${context}/${dynamic}`.replace(/\\/\\//g, \"/\");\n if (location?.search) {\n return `${href}${location.search}`;\n }\n return href;\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n const href = getHref(\"concepts\", concept, location);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel =>\n useModularUIBasic(\"contentindex\", href, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = getHref(\"content\", content, location);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = getHref(\"content\", contentSection);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = getHref(\"contenttype\", contentType);\n return useModularUIBasic(\"contenttype\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"file":"useModelCatalog.js"}
1
+ {"version":3,"sources":["../../src/hooks/useModelCatalog.js"],"names":["useLocation","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","expectedModels","targetModel","useConceptIndex","href","getHref","context","dynamic","location","replace","search","useConceptDetail","concept","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType"],"mappings":";;AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,iBAAP,MAA8B,0CAA9B;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;AACA,OAAOC,kBAAP,MAA+B,uCAA/B;AACA,SAASC,OAAO,IAAIC,qBAApB,QAAiD,0CAAjD;AACA,OAAOC,iBAAP,MAA8B,qCAA9B;AACA,OAAOC,eAAP,MAA4B,mCAA5B;AACA,OAAOC,YAAP,MAAyB,gCAAzB;AAEA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,gBAAT,QAAiC,WAAjC;AAEA;AACA;;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAC7BF,iBAAiB,CAAC,cAAD,EAAiB,eAAjB,EAAkC;AACjDG,IAAAA,cAAc,EAAE,CAAC,cAAD,CADiC;AAEjDC,IAAAA,WAAW,EAAEZ;AAFoC,GAAlC,CADY;AAAA,CAAxB;AAMP;AACA;;AACA,OAAO,IAAMa,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD;AAAA,SAC7BN,iBAAiB,CAAC,cAAD,EAAiBM,IAAjB,EAAuB;AACtCH,IAAAA,cAAc,EAAE,CAAC,cAAD,CADsB;AAEtCC,IAAAA,WAAW,EAAEX;AAFyB,GAAvB,CADY;AAAA,CAAxB;;AAMP,IAAMc,OAAO,GAAG,SAAVA,OAAU,CAACC,OA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SAAD,EAAYU,OAAZ,EAAqBP,QAArB,CAApB;AACA,SAAOV,iBAAiB,CAAC,YAAD,EAAeM,IAAf,EAAqB;AAC3CH,IAAAA,cAAc,EAAE,CAAC,YAAD,CAD2B;AAE3CC,IAAAA,WAAW,EAAEN;AAF8B,GAArB,CAAxB;AAID,CAPM;AASP;AACA;;AACA,OAAO,IAAMoB,UAAU,GAAG,SAAbA,UAAa,CAACC,cAAD,EAA2C;AACnE,MAAMb,IAAI,GAAGC,OAAO,CAAC,SAAD,EAAYY,cAAZ,CAApB;AACA,SAAOnB,iBAAiB,CAAC,SAAD,EAAYM,IAAZ,EAAkB;AACxCH,IAAAA,cAAc,EAAE,CAAC,SAAD,CADwB;AAExCC,IAAAA,WAAW,EAAEL;AAF2B,GAAlB,CAAxB;AAID,CANM;AAQP;AACA;;AACA,OAAO,IAAMqB,cAAc,GAAG,SAAjBA,cAAiB,CAACC,WAAD,EAA4C;AACxE,MAAMf,IAAI,GAAGC,OAAO,CAAC,cAAD,EAAiBc,WAAjB,CAApB;AACA,SAAOrB,iBAAiB,CAAC,cAAD,EAAiBM,IAAjB,EAAuB;AAC7CH,IAAAA,cAAc,EAAE,CAAC,aAAD,CAD6B;AAE7CC,IAAAA,WAAW,EAAEH;AAFgC,GAAvB,CAAxB;AAID,CANM","sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel =>\n useModularUIBasic(\"conceptindex\", href, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n\nconst getHref = (context, dynamic, location) => {\n let href = dynamic;\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search) {\n href = `${href}${location.search}`;\n }\n\n return href;\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = getHref(\"concepts\", concept, location);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel =>\n useModularUIBasic(\"contentindex\", href, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = getHref(\"content\", content, location);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = getHref(\"content\", contentSection);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = getHref(\"contenttypes\", contentType);\n return useModularUIBasic(\"contenttypes\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"file":"useModelCatalog.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useNotification.js"],"names":["useSelector","useDispatch","dismissNotification","useNotification","dispatch","state","notification","render","messageType","message","error","dismiss"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,mBAAT,QAAoC,kBAApC;;AAQA;AACA;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;AACrD,MAAMC,QAAQ,GAAGH,WAAW,EAA5B;;AACA,qBAAgDD,WAAW,CACzD,UAACK,KAAD;AAAA,WAAWA,KAAK,CAACC,YAAjB;AAAA,GADyD,CAA3D;AAAA,MAAQC,MAAR,gBAAQA,MAAR;AAAA,MAAgBC,WAAhB,gBAAgBA,WAAhB;AAAA,MAA6BC,OAA7B,gBAA6BA,OAA7B;AAAA,MAAsCC,KAAtC,gBAAsCA,KAAtC;;AAIA,SAAO;AACLH,IAAAA,MAAM,EAANA,MADK;AAELC,IAAAA,WAAW,EAAXA,WAFK;AAGLC,IAAAA,OAAO,EAAPA,OAHK;AAILC,IAAAA,KAAK,EAALA,KAJK;AAKLC,IAAAA,OAAO,EAAE;AAAA,aAAMP,QAAQ,CAACF,mBAAmB,EAApB,CAAd;AAAA;AALJ,GAAP;AAOD,CAbM","sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification } from \"../redux/actions\";\n\nimport type { NotificationState } from \"../redux/types\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => void,\n};\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n"],"file":"useNotification.js"}
1
+ {"version":3,"sources":["../../src/hooks/useNotification.js"],"names":["useSelector","useDispatch","dismissNotification","useNotification","dispatch","state","notification","render","messageType","message","error","dismiss"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,mBAAT,QAAoC,kBAApC;;AAWA;AACA;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;AACrD,MAAMC,QAAQ,GAAGH,WAAW,EAA5B;;AACA,qBAAgDD,WAAW,CACzD,UAACK,KAAD;AAAA,WAAWA,KAAK,CAACC,YAAjB;AAAA,GADyD,CAA3D;AAAA,MAAQC,MAAR,gBAAQA,MAAR;AAAA,MAAgBC,WAAhB,gBAAgBA,WAAhB;AAAA,MAA6BC,OAA7B,gBAA6BA,OAA7B;AAAA,MAAsCC,KAAtC,gBAAsCA,KAAtC;;AAIA,SAAO;AACLH,IAAAA,MAAM,EAANA,MADK;AAELC,IAAAA,WAAW,EAAXA,WAFK;AAGLC,IAAAA,OAAO,EAAPA,OAHK;AAILC,IAAAA,KAAK,EAALA,KAJK;AAKLC,IAAAA,OAAO,EAAE;AAAA,aAAMP,QAAQ,CAACF,mBAAmB,EAApB,CAAd;AAAA;AALJ,GAAP;AAOD,CAbM","sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n} from \"../redux/types\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n"],"file":"useNotification.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useRouter.js"],"names":["useDispatch","useSelector","push","replace","go","goBack","goForward","useLocation","state","router","location","useLocationKey","key","useQuerystring","search","usePathname","pathname","useNavigation","dispatch","delta"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAGA,SAASC,IAAI,IAAJA,KAAT,EAAeC,OAAO,IAAPA,QAAf,EAAwBC,EAAE,IAAFA,GAAxB,EAA4BC,MAAM,IAANA,OA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AMY,QAAQ,CAACZ,UAAS,EAAV,CAAd;AAAA;AAPN,GAAP;AASD,CAZM","sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport type { Location, LocationShape } from \"react-router\";\n\nimport { push, replace, go, goBack, goForward } from \"../redux/_router/actions\";\n\ntype UseLocationHook = () => Location;\ntype UseLocationKeyHook = () => string;\ntype UseQuerystringHook = () => string;\ntype UsePathnameHook = () => string;\ntype UseNavigationHook = () => {\n push: (location: LocationShape | string, state?: { ... }) => void,\n replace: (location: LocationShape | string, state?: { ... }) => void,\n go: (delta: number) => void,\n goBack: () => void,\n goForward: () => void,\n};\n\n/**\n */\nexport const useLocation: UseLocationHook = () =>\n useSelector((state) => state.router.location);\n\n/**\n */\nexport const useLocationKey: UseLocationKeyHook = () =>\n useLocation()?.key ?? \"\";\n\n/**\n */\nexport const useQuerystring: UseQuerystringHook = () => useLocation()?.search;\n\n/**\n */\nexport const usePathname: UsePathnameHook = () => useLocation()?.pathname;\n\n/**\n */\nexport const useNavigation: UseNavigationHook = () => {\n const dispatch = useDispatch();\n\n return {\n push: (location: LocationShape | string, state?: { ... }) =>\n dispatch(push(location, state)),\n replace: (location: LocationShape | string, state?: { ... }) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n"],"file":"useRouter.js"}
1
+ {"version":3,"sources":["../../src/hooks/useRouter.js"],"names":["useDispatch","useSelector","push","replace","go","goBack","goForward","useLocation","state","router","location","useLocationKey","key","useQuerystring","search","usePathname","pathname","useNavigation","dispatch","delta"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAGA,SAASC,IAAI,IAAJA,KAAT,EAAeC,OAAO,IAAPA,QAAf,EAAwBC,EAAE,IAAFA,GAAxB,EAA4BC,MAAM,IAANA,OAA5B,EAAoCC,SAAS,IAATA,UAApC,QAAqD,0BAArD;;AAqBA;AACA;AAC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CAZM","sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport type { Location, LocationShape } from \"react-router\";\n\nimport { push, replace, go, goBack, goForward } from \"../redux/_router/actions\";\nimport type {\n GoAction,\n GoBackAction,\n GoForwardAction,\n PushAction,\n ReplaceAction,\n} from \"../redux\";\n\ntype UseLocationHook = () => Location;\ntype UseLocationKeyHook = () => string;\ntype UseQuerystringHook = () => string;\ntype UsePathnameHook = () => string;\ntype UseNavigationHook = () => {\n push: (location: LocationShape | string, state?: { ... }) => PushAction,\n replace: (location: LocationShape | string, state?: { ... }) => ReplaceAction,\n go: (delta: number) => GoAction,\n goBack: () => GoBackAction,\n goForward: () => GoForwardAction,\n};\n\n/**\n */\nexport const useLocation: UseLocationHook = () =>\n useSelector((state) => state.router.location);\n\n/**\n */\nexport const useLocationKey: UseLocationKeyHook = () =>\n useLocation()?.key ?? \"\";\n\n/**\n */\nexport const useQuerystring: UseQuerystringHook = () => useLocation()?.search;\n\n/**\n */\nexport const usePathname: UsePathnameHook = () => useLocation()?.pathname;\n\n/**\n */\nexport const useNavigation: UseNavigationHook = () => {\n const dispatch = useDispatch();\n\n return {\n push: (location: LocationShape | string, state?: { ... }) =>\n dispatch(push(location, state)),\n replace: (location: LocationShape | string, state?: { ... }) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n"],"file":"useRouter.js"}
@@ -5,19 +5,30 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
5
5
 
6
6
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
7
7
 
8
- function _unsupportedIterableToArray(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context5 = Object.prototype.toString.call(o)).call(_context5, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _unsupportedIterableToArray(o, minLen) { var _context7; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context7 = Object.prototype.toString.call(o)).call(_context7, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
9
 
10
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
11
11
 
12
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13
+
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
+
16
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
17
+ import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
12
18
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
13
19
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
14
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
20
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
21
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
22
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
23
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
15
24
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
16
25
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
17
26
  import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
18
27
  import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
19
- import { ALL_CONTENT_IN_DATA_SETTING, getSetting } from "../../constants";
28
+ import { retrieveText } from "../../utils/helpers/text";
29
+ import { hasAllContentInData } from "../../constants/Settings";
20
30
  import SectionModel from "../content/SectionModel";
31
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
21
32
 
22
33
  var AttributeContent = /*#__PURE__*/function () {
23
34
  function AttributeContent(content) {
@@ -34,7 +45,92 @@ var AttributeContent = /*#__PURE__*/function () {
34
45
  _createClass(AttributeContent, [{
35
46
  key: "fromData",
36
47
  get: function get() {
37
- return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
48
+ return hasAllContentInData();
49
+ }
50
+ /**
51
+ */
52
+
53
+ }, {
54
+ key: "header",
55
+ get: function get() {
56
+ var _this$_content, _this$_content$header, _this$_content2, _this$_content2$heade, _this$_content2$heade2;
57
+
58
+ var label = (_this$_content = this._content) === null || _this$_content === void 0 ? void 0 : (_this$_content$header = _this$_content.header) === null || _this$_content$header === void 0 ? void 0 : _this$_content$header.label;
59
+ var description = (_this$_content2 = this._content) === null || _this$_content2 === void 0 ? void 0 : (_this$_content2$heade = _this$_content2.header) === null || _this$_content2$heade === void 0 ? void 0 : (_this$_content2$heade2 = _this$_content2$heade.description) === null || _this$_content2$heade2 === void 0 ? void 0 : _this$_content2$heade2.message;
60
+ return {
61
+ label: label,
62
+ description: description
63
+ };
64
+ }
65
+ /**
66
+ */
67
+
68
+ }, {
69
+ key: "elements",
70
+ get: function get() {
71
+ var _this$_content3;
72
+
73
+ if ((_this$_content3 = this._content) !== null && _this$_content3 !== void 0 && _this$_content3.elements) {
74
+ var _this$_content$elemen;
75
+
76
+ 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) {
77
+ if ("propertyElement" in element) {
78
+ // $FlowIssue
79
+ var _element$propertyElem = element.propertyElement,
80
+ label = _element$propertyElem.label,
81
+ layouthint = _element$propertyElem.layouthint,
82
+ properties = _element$propertyElem.properties;
83
+ return {
84
+ propertyElement: {
85
+ label: label,
86
+ layouthint: new LayoutHintCollection(layouthint),
87
+ properties: properties
88
+ }
89
+ };
90
+ }
91
+
92
+ if ("textFragmentElement" in element) {
93
+ var _element$textFragment = // $FlowIssue
94
+ element.textFragmentElement,
95
+ _label = _element$textFragment.label,
96
+ _layouthint = _element$textFragment.layouthint,
97
+ textfragments = _element$textFragment.textfragments;
98
+ return {
99
+ textFragmentElement: {
100
+ label: _label,
101
+ layouthint: new LayoutHintCollection(_layouthint),
102
+ textfragments: _mapInstanceProperty(textfragments).call(textfragments, function (textfragment) {
103
+ return _objectSpread(_objectSpread({}, textfragment), {}, {
104
+ text: retrieveText(textfragment.text)
105
+ });
106
+ })
107
+ }
108
+ };
109
+ }
110
+
111
+ if ("contentElement" in element) {
112
+ // $FlowIssue
113
+ var _element$contentEleme = element.contentElement,
114
+ _label2 = _element$contentEleme.label,
115
+ _layouthint2 = _element$contentEleme.layouthint,
116
+ sections = _element$contentEleme.sections;
117
+ return {
118
+ contentElement: {
119
+ label: _label2,
120
+ layouthint: new LayoutHintCollection(_layouthint2),
121
+ sections: _mapInstanceProperty(sections).call(sections, function (section) {
122
+ return new SectionModel(section, null);
123
+ })
124
+ }
125
+ };
126
+ } // $FlowIssue
127
+
128
+
129
+ return element;
130
+ });
131
+ }
132
+
133
+ return [];
38
134
  }
39
135
  /**
40
136
  */
@@ -42,9 +138,29 @@ var AttributeContent = /*#__PURE__*/function () {
42
138
  }, {
43
139
  key: "label",
44
140
  get: function get() {
45
- var _this$_content;
141
+ return this.header.label;
142
+ }
143
+ /**
144
+ */
145
+
146
+ }, {
147
+ key: "description",
148
+ get: function get() {
149
+ return this.header.description;
150
+ }
151
+ /**
152
+ */
46
153
 
47
- return (_this$_content = this._content) === null || _this$_content === void 0 ? void 0 : _this$_content.label;
154
+ }, {
155
+ key: "getContentElements",
156
+ value: function getContentElements(elementName, collectionName) {
157
+ var _context, _context2, _context3;
158
+
159
+ return _flatInstanceProperty(_context = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this.elements).call(_context3, function (element) {
160
+ return elementName in element;
161
+ })).call(_context2, function (element) {
162
+ return element[elementName][collectionName];
163
+ })).call(_context);
48
164
  }
49
165
  /**
50
166
  */
@@ -52,9 +168,7 @@ var AttributeContent = /*#__PURE__*/function () {
52
168
  }, {
53
169
  key: "properties",
54
170
  get: function get() {
55
- var _this$_content$proper, _this$_content2;
56
-
57
- return (_this$_content$proper = (_this$_content2 = this._content) === null || _this$_content2 === void 0 ? void 0 : _this$_content2.properties) !== null && _this$_content$proper !== void 0 ? _this$_content$proper : [];
171
+ return this.getContentElements("propertyElement", "properties");
58
172
  }
59
173
  /**
60
174
  * Get concept properties by id
@@ -63,10 +177,10 @@ var AttributeContent = /*#__PURE__*/function () {
63
177
  }, {
64
178
  key: "getConceptPropertiesByIds",
65
179
  value: function getConceptPropertiesByIds(ids) {
66
- var _context;
180
+ var _context4;
67
181
 
68
- return _filterInstanceProperty(_context = this.properties).call(_context, function (property) {
69
- return _includesInstanceProperty(ids).call(ids, property.key);
182
+ return _filterInstanceProperty(_context4 = this.properties).call(_context4, function (property) {
183
+ return _includesInstanceProperty(ids).call(ids, property.type);
70
184
  });
71
185
  }
72
186
  /**
@@ -75,9 +189,7 @@ var AttributeContent = /*#__PURE__*/function () {
75
189
  }, {
76
190
  key: "textfragments",
77
191
  get: function get() {
78
- var _this$_content$textfr, _this$_content3;
79
-
80
- return (_this$_content$textfr = (_this$_content3 = this._content) === null || _this$_content3 === void 0 ? void 0 : _this$_content3.textfragments) !== null && _this$_content$textfr !== void 0 ? _this$_content$textfr : [];
192
+ return this.getContentElements("textFragmentElement", "textfragments");
81
193
  }
82
194
  /**
83
195
  * Get concept text fragments by type
@@ -86,9 +198,9 @@ var AttributeContent = /*#__PURE__*/function () {
86
198
  }, {
87
199
  key: "getTextFragmentByKeys",
88
200
  value: function getTextFragmentByKeys(keys) {
89
- var _context2;
201
+ var _context5;
90
202
 
91
- return _filterInstanceProperty(_context2 = this.textfragments).call(_context2, function (textfragment) {
203
+ return _filterInstanceProperty(_context5 = this.textfragments).call(_context5, function (textfragment) {
92
204
  return _includesInstanceProperty(keys).call(keys, textfragment.type);
93
205
  });
94
206
  }
@@ -98,17 +210,7 @@ var AttributeContent = /*#__PURE__*/function () {
98
210
  }, {
99
211
  key: "sections",
100
212
  get: function get() {
101
- var _this$_content4;
102
-
103
- if (Array.isArray((_this$_content4 = this._content) === null || _this$_content4 === void 0 ? void 0 : _this$_content4.sections)) {
104
- var _context3;
105
-
106
- return _mapInstanceProperty(_context3 = this._content.sections).call(_context3, function (section) {
107
- return new SectionModel(section, null);
108
- });
109
- }
110
-
111
- return [];
213
+ return this.getContentElements("contentElement", "sections");
112
214
  }
113
215
  /**
114
216
  */
@@ -116,9 +218,9 @@ var AttributeContent = /*#__PURE__*/function () {
116
218
  }, {
117
219
  key: "getSectionsByType",
118
220
  value: function getSectionsByType(types) {
119
- var _context4;
221
+ var _context6;
120
222
 
121
- return _filterInstanceProperty(_context4 = this.sections).call(_context4, function (section) {
223
+ return _filterInstanceProperty(_context6 = this.sections).call(_context6, function (section) {
122
224
  return _includesInstanceProperty(types).call(types, section.type);
123
225
  });
124
226
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["ALL_CONTENT_IN_DATA_SETTING","getSetting","SectionModel","AttributeContent","content","_content","label","properties","ids","property","key","textfragments","keys","textfragment","type","Array","isArray","sections","section","types","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;AACA,SAASA,2BAAT,EAAsCC,UAAtC,QAAwD,iBAAxD;AACA,OAAOC,YAAP,MAAyB,yBAAzB;;IAaMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOH,UAAU,CAACD,2BAAD,EAA8B,IAA9B,CAAjB;AACD;AAED;AACF;;;;SACE,eAAqB;AAAA;;AACnB,+BAAO,KAAKK,QAAZ,mDAAO,eAAeC,KAAtB;AACD;AAED;AACF;;;;SACE,eAAsC;AAAA;;AACpC,yDAAO,KAAKD,QAAZ,oDAAO,gBAAeE,UAAtB,yEAAoC,EAApC;AACD;AAED;AACF;AACA;;;;WACE,mCAA0BC,GAA1B,EAAmE;AAAA;;AACjE,aAAO,wCAAKD,UAAL,iBAAuB,UAACE,QA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GH,eAAejB,gBAAf","sourcesContent":["// @flow\nimport { ALL_CONTENT_IN_DATA_SETTING, getSetting } from \"../../constants\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport type SubSectionModel from \"../content/SubSectionModel\";\ntype PropertyData = { key: string, label: string, value: string };\ntype TextFragmentData = { type: string, label: string, text: string };\ntype SectionData = { type: string, label?: string, body: string };\ntype ContentData = {\n label: string | null,\n properties: Array<PropertyData> | null,\n textfragments: Array<TextFragmentData> | null,\n sections: Array<SectionData> | null,\n};\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 getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this._content?.properties ?? [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<PropertyData> {\n return this.properties.filter((property) => ids.includes(property.key));\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this._content?.textfragments ?? [];\n }\n\n /**\n * Get concept text fragments by type\n */\n getTextFragmentByKeys(keys: Array<string>): Array<TextFragmentData> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type)\n );\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n if (Array.isArray(this._content?.sections)) {\n return this._content.sections.map(\n (section) => new SectionModel(section, null)\n );\n }\n return [];\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","AttributeContent","content","_content","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","ids","property","type","keys","types","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AASA,OAAOC,oBAAP,MAAiC,oCAAjC;;IAEMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOJ,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAGE;AAAA;;AACA,UAAMM,KAAK,qBAAG,KAAKD,QAAR,4EAAG,eAAeE,MAAlB,0DAAG,sBAAuBD,KAArC;AACA,UAAME,WAAW,sBAAG,KAAKH,QAAR,6EAAG,gBAAeE,MAAlB,oFAAG,sBAAuBC,WAA1B,2DAAG,uBAAoCC,OAAxD;AAEA,aAAO;AAAEH,QAAAA,KAAK,EAALA,KAAF;AAASE,QAAAA,WAAW,EAAXA;AAAT,OAAP;AACD;AAED;AACF;;;;SACE,eAA2B;AAAA;;AACzB,6BAAI,KAAKH,QAAT,4CAAI,gBAAeK,QAAnB,EAA6B;AAAA;;AAC3B,wCAAO,KAAKL,QAAL,CAAcK,QAArB,0DAAO,wEAA4B,UAACC,OAAD,EAAa;AAC9C,cAAI,qBAAqBA,OAAzB,EAAkC;AAChC;AACA,wCAA0CA,OAAO,CAACC,eAAlD;AAAA,gBAAQN,KAAR,yBAAQA,KAAR;AAAA,gBAAeO,UAAf,yBAAeA,UAAf;AAAA,gBAA2BC,UAA3B,yBAA2BA,UAA3B;AAEA,mBAAO;AACLF,cAAAA,eAAe,EAAE;AACfN,gBAAAA,KAAK,EAALA,KADe;AAEfO,gBAAAA,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OAAO,CAACM,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMG,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,eAAe3B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport type {\n ContentData,\n PropertyData,\n TextFragmentData,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n const label = this._content?.header?.label;\n const description = this._content?.header?.description?.message;\n\n return { label, description };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"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.header.label;\n }\n\n /**\n */\n get description(): ?string {\n return this.header.description;\n }\n\n /**\n */\n getContentElements<T>(elementName: string, collectionName: string): Array<T> {\n return this.elements\n .filter((element) => elementName in element)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElements<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<PropertyData> {\n return this.properties.filter((property) => ids.includes(property.type));\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElements<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by type\n */\n getTextFragmentByKeys(keys: Array<string>): Array<TextFragmentData> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type)\n );\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElements<SectionModel>(\"contentElement\", \"sections\");\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}