@beinformed/ui 1.57.1 → 1.57.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/esm/constants/Settings.js +14 -6
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useAuthentication.js +3 -3
  5. package/esm/hooks/useAuthentication.js.map +1 -1
  6. package/esm/hooks/useModelCatalog.js.map +1 -1
  7. package/esm/hooks/useModularUI.js +9 -8
  8. package/esm/hooks/useModularUI.js.map +1 -1
  9. package/esm/hooks/useModularUIBasic.js +2 -4
  10. package/esm/hooks/useModularUIBasic.js.map +1 -1
  11. package/esm/hooks/useModularUIModel.js.map +1 -1
  12. package/esm/models/actions/ActionCollection.js +2 -3
  13. package/esm/models/actions/ActionCollection.js.map +1 -1
  14. package/esm/models/actions/ActionModel.js +13 -23
  15. package/esm/models/actions/ActionModel.js.map +1 -1
  16. package/esm/models/application/ApplicationModel.js +1 -1
  17. package/esm/models/application/ApplicationModel.js.map +1 -1
  18. package/esm/models/attributes/AttributeCollection.js +6 -3
  19. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  20. package/esm/models/attributes/AttributeModel.js +3 -3
  21. package/esm/models/attributes/AttributeModel.js.map +1 -1
  22. package/esm/models/attributes/AttributeSetModel.js +7 -4
  23. package/esm/models/attributes/AttributeSetModel.js.map +1 -1
  24. package/esm/models/attributes/BooleanAttributeModel.js +6 -3
  25. package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
  26. package/esm/models/attributes/ChoiceAttributeModel.js +6 -3
  27. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  28. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +18 -14
  29. package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  30. package/esm/models/attributes/ChoiceAttributeOptionModel.js +17 -10
  31. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  32. package/esm/models/attributes/CompositeAttributeChildCollection.js +7 -7
  33. package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  34. package/esm/models/attributes/CompositeAttributeModel.js +3 -3
  35. package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
  36. package/esm/models/attributes/DatetimeAttributeModel.js +2 -2
  37. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  38. package/esm/models/attributes/StringAttributeModel.js +2 -2
  39. package/esm/models/attributes/StringAttributeModel.js.map +1 -1
  40. package/esm/models/attributes/_createAttribute.js +2 -2
  41. package/esm/models/attributes/_createAttribute.js.map +1 -1
  42. package/esm/models/base/BaseModel.js +27 -1
  43. package/esm/models/base/BaseModel.js.map +1 -1
  44. package/esm/models/base/ResourceModel.js +3 -23
  45. package/esm/models/base/ResourceModel.js.map +1 -1
  46. package/esm/models/caseview/CaseViewModel.js +1 -1
  47. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  48. package/esm/models/concepts/ConceptDetailModel.js +2 -2
  49. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  50. package/esm/models/concepts/ConceptIndexModel.js +2 -2
  51. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  52. package/esm/models/concepts/ConceptLinkModel.js +4 -10
  53. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  54. package/esm/models/concepts/ConceptRelationCollection.js +11 -4
  55. package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
  56. package/esm/models/concepts/ConceptRelationModel.js +8 -1
  57. package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
  58. package/esm/models/concepts/SourceReferenceCollection.js +2 -4
  59. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  60. package/esm/models/concepts/SourceReferenceModel.js +9 -10
  61. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  62. package/esm/models/content/ContentIndexModel.js +2 -2
  63. package/esm/models/content/ContentIndexModel.js.map +1 -1
  64. package/esm/models/content/ContentLinkModel.js +4 -11
  65. package/esm/models/content/ContentLinkModel.js.map +1 -1
  66. package/esm/models/content/ContentModel.js +2 -2
  67. package/esm/models/content/ContentModel.js.map +1 -1
  68. package/esm/models/content/ContentTOCModel.js +7 -7
  69. package/esm/models/content/ContentTOCModel.js.map +1 -1
  70. package/esm/models/content/SectionModel.js +6 -12
  71. package/esm/models/content/SectionModel.js.map +1 -1
  72. package/esm/models/detail/DetailModel.js +9 -3
  73. package/esm/models/detail/DetailModel.js.map +1 -1
  74. package/esm/models/error/ErrorResponse.js +8 -10
  75. package/esm/models/error/ErrorResponse.js.map +1 -1
  76. package/esm/models/filters/AssignmentFilterModel.js +2 -2
  77. package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
  78. package/esm/models/filters/BaseFilterModel.js +3 -3
  79. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  80. package/esm/models/filters/ConceptIndexFilterModel.js +2 -3
  81. package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
  82. package/esm/models/filters/FilterCollection.js +8 -7
  83. package/esm/models/filters/FilterCollection.js.map +1 -1
  84. package/esm/models/filters/StringFilterModel.js +2 -2
  85. package/esm/models/filters/StringFilterModel.js.map +1 -1
  86. package/esm/models/form/FormModel.js +4 -4
  87. package/esm/models/form/FormModel.js.map +1 -1
  88. package/esm/models/form/FormObjectModel.js +7 -4
  89. package/esm/models/form/FormObjectModel.js.map +1 -1
  90. package/esm/models/grouping/GroupingModel.js +10 -7
  91. package/esm/models/grouping/GroupingModel.js.map +1 -1
  92. package/esm/models/href/Href.js +9 -8
  93. package/esm/models/href/Href.js.map +1 -1
  94. package/esm/models/links/LinkCollection.js +2 -3
  95. package/esm/models/links/LinkCollection.js.map +1 -1
  96. package/esm/models/links/LinkModel.js +7 -7
  97. package/esm/models/links/LinkModel.js.map +1 -1
  98. package/esm/models/list/ListDetailModel.js +1 -1
  99. package/esm/models/list/ListDetailModel.js.map +1 -1
  100. package/esm/models/list/ListItemCollection.js +1 -1
  101. package/esm/models/list/ListItemCollection.js.map +1 -1
  102. package/esm/models/list/ListItemModel.js +3 -3
  103. package/esm/models/list/ListItemModel.js.map +1 -1
  104. package/esm/models/list/ListModel.js +3 -3
  105. package/esm/models/list/ListModel.js.map +1 -1
  106. package/esm/models/lookup/LookupOptionCollection.js +5 -2
  107. package/esm/models/lookup/LookupOptionCollection.js.map +1 -1
  108. package/esm/models/lookup/LookupOptionsModel.js +2 -2
  109. package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
  110. package/esm/models/panels/GroupingPanelModel.js +1 -1
  111. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  112. package/esm/models/tab/TabModel.js +2 -2
  113. package/esm/models/tab/TabModel.js.map +1 -1
  114. package/esm/models/taskgroup/TaskGroupModel.js +4 -5
  115. package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
  116. package/esm/models/types.js.map +1 -1
  117. package/esm/models/user/UserProfileModel.js +4 -1
  118. package/esm/models/user/UserProfileModel.js.map +1 -1
  119. package/esm/modularui/CaptchaRequest.js +3 -3
  120. package/esm/modularui/CaptchaRequest.js.map +1 -1
  121. package/esm/modularui/ModularUIRequest.js +8 -5
  122. package/esm/modularui/ModularUIRequest.js.map +1 -1
  123. package/esm/modularui/ModularUIResponse.js +12 -3
  124. package/esm/modularui/ModularUIResponse.js.map +1 -1
  125. package/esm/modularui/UploadRequest.js +3 -3
  126. package/esm/modularui/UploadRequest.js.map +1 -1
  127. package/esm/react-client/client.js +3 -3
  128. package/esm/react-client/client.js.map +1 -1
  129. package/esm/react-server/renderSSRComplete.js +2 -2
  130. package/esm/react-server/renderSSRComplete.js.map +1 -1
  131. package/esm/react-server/renderSSRMinimal.js +2 -2
  132. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  133. package/esm/redux/_modularui/ModularUIActions.js +8 -2
  134. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  135. package/esm/redux/_modularui/ModularUIUtils.js +8 -11
  136. package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
  137. package/esm/utils/browser/Cookies.js +3 -3
  138. package/esm/utils/browser/Cookies.js.map +1 -1
  139. package/esm/utils/helpers/createHref.js +23 -3
  140. package/esm/utils/helpers/createHref.js.map +1 -1
  141. package/esm/utils/helpers/repositoryResource.js +2 -2
  142. package/esm/utils/helpers/repositoryResource.js.map +1 -1
  143. package/lib/constants/Settings.js +18 -8
  144. package/lib/constants/Settings.js.flow +16 -6
  145. package/lib/constants/Settings.js.map +1 -1
  146. package/lib/hooks/useAuthentication.js +2 -2
  147. package/lib/hooks/useAuthentication.js.flow +3 -3
  148. package/lib/hooks/useAuthentication.js.map +1 -1
  149. package/lib/hooks/useModelCatalog.js.flow +7 -6
  150. package/lib/hooks/useModelCatalog.js.map +1 -1
  151. package/lib/hooks/useModularUI.js +9 -8
  152. package/lib/hooks/useModularUI.js.flow +12 -9
  153. package/lib/hooks/useModularUI.js.map +1 -1
  154. package/lib/hooks/useModularUIBasic.js +2 -4
  155. package/lib/hooks/useModularUIBasic.js.flow +3 -4
  156. package/lib/hooks/useModularUIBasic.js.map +1 -1
  157. package/lib/hooks/useModularUIModel.js.flow +16 -11
  158. package/lib/hooks/useModularUIModel.js.map +1 -1
  159. package/lib/models/actions/ActionCollection.js +2 -2
  160. package/lib/models/actions/ActionCollection.js.flow +3 -8
  161. package/lib/models/actions/ActionCollection.js.map +1 -1
  162. package/lib/models/actions/ActionModel.js +12 -22
  163. package/lib/models/actions/ActionModel.js.flow +7 -24
  164. package/lib/models/actions/ActionModel.js.map +1 -1
  165. package/lib/models/application/ApplicationModel.js +1 -1
  166. package/lib/models/application/ApplicationModel.js.flow +1 -2
  167. package/lib/models/application/ApplicationModel.js.map +1 -1
  168. package/lib/models/attributes/AttributeCollection.js +6 -3
  169. package/lib/models/attributes/AttributeCollection.js.flow +12 -4
  170. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  171. package/lib/models/attributes/AttributeModel.js +3 -3
  172. package/lib/models/attributes/AttributeModel.js.flow +8 -2
  173. package/lib/models/attributes/AttributeModel.js.map +1 -1
  174. package/lib/models/attributes/AttributeSetModel.js +7 -3
  175. package/lib/models/attributes/AttributeSetModel.js.flow +11 -3
  176. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  177. package/lib/models/attributes/BooleanAttributeModel.js +6 -3
  178. package/lib/models/attributes/BooleanAttributeModel.js.flow +8 -4
  179. package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
  180. package/lib/models/attributes/ChoiceAttributeModel.js +6 -3
  181. package/lib/models/attributes/ChoiceAttributeModel.js.flow +13 -4
  182. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  183. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +18 -13
  184. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +30 -28
  185. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  186. package/lib/models/attributes/ChoiceAttributeOptionModel.js +17 -10
  187. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +30 -11
  188. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  189. package/lib/models/attributes/CompositeAttributeChildCollection.js +7 -7
  190. package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +8 -1
  191. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  192. package/lib/models/attributes/CompositeAttributeModel.js +3 -3
  193. package/lib/models/attributes/CompositeAttributeModel.js.flow +8 -3
  194. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  195. package/lib/models/attributes/DatetimeAttributeModel.js +2 -2
  196. package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -2
  197. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  198. package/lib/models/attributes/StringAttributeModel.js +2 -2
  199. package/lib/models/attributes/StringAttributeModel.js.flow +7 -3
  200. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  201. package/lib/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js.flow +1 -1
  202. package/lib/models/attributes/_createAttribute.js +2 -2
  203. package/lib/models/attributes/_createAttribute.js.flow +3 -2
  204. package/lib/models/attributes/_createAttribute.js.map +1 -1
  205. package/lib/models/base/BaseModel.js +27 -1
  206. package/lib/models/base/BaseModel.js.flow +31 -1
  207. package/lib/models/base/BaseModel.js.map +1 -1
  208. package/lib/models/base/ResourceModel.js +3 -22
  209. package/lib/models/base/ResourceModel.js.flow +6 -23
  210. package/lib/models/base/ResourceModel.js.map +1 -1
  211. package/lib/models/base/__tests__/BaseModel.spec.js.flow +4 -0
  212. package/lib/models/caseview/CaseViewModel.js +1 -1
  213. package/lib/models/caseview/CaseViewModel.js.flow +1 -2
  214. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  215. package/lib/models/concepts/ConceptDetailModel.js +2 -2
  216. package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
  217. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  218. package/lib/models/concepts/ConceptIndexModel.js +2 -2
  219. package/lib/models/concepts/ConceptIndexModel.js.flow +9 -6
  220. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  221. package/lib/models/concepts/ConceptLinkModel.js +4 -10
  222. package/lib/models/concepts/ConceptLinkModel.js.flow +15 -12
  223. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  224. package/lib/models/concepts/ConceptRelationCollection.js +11 -4
  225. package/lib/models/concepts/ConceptRelationCollection.js.flow +17 -3
  226. package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
  227. package/lib/models/concepts/ConceptRelationModel.js +8 -1
  228. package/lib/models/concepts/ConceptRelationModel.js.flow +18 -2
  229. package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
  230. package/lib/models/concepts/SourceReferenceCollection.js +2 -3
  231. package/lib/models/concepts/SourceReferenceCollection.js.flow +3 -8
  232. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  233. package/lib/models/concepts/SourceReferenceModel.js +8 -8
  234. package/lib/models/concepts/SourceReferenceModel.js.flow +10 -11
  235. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  236. package/lib/models/content/ContentIndexModel.js +2 -2
  237. package/lib/models/content/ContentIndexModel.js.flow +10 -5
  238. package/lib/models/content/ContentIndexModel.js.map +1 -1
  239. package/lib/models/content/ContentLinkModel.js +4 -10
  240. package/lib/models/content/ContentLinkModel.js.flow +10 -13
  241. package/lib/models/content/ContentLinkModel.js.map +1 -1
  242. package/lib/models/content/ContentModel.js +2 -2
  243. package/lib/models/content/ContentModel.js.flow +6 -1
  244. package/lib/models/content/ContentModel.js.map +1 -1
  245. package/lib/models/content/ContentTOCModel.js +7 -7
  246. package/lib/models/content/ContentTOCModel.js.flow +19 -11
  247. package/lib/models/content/ContentTOCModel.js.map +1 -1
  248. package/lib/models/content/SectionModel.js +6 -11
  249. package/lib/models/content/SectionModel.js.flow +9 -21
  250. package/lib/models/content/SectionModel.js.map +1 -1
  251. package/lib/models/detail/DetailModel.js +9 -3
  252. package/lib/models/detail/DetailModel.js.flow +3 -4
  253. package/lib/models/detail/DetailModel.js.map +1 -1
  254. package/lib/models/error/ErrorResponse.js +7 -9
  255. package/lib/models/error/ErrorResponse.js.flow +9 -20
  256. package/lib/models/error/ErrorResponse.js.map +1 -1
  257. package/lib/models/filters/AssignmentFilterModel.js +2 -2
  258. package/lib/models/filters/AssignmentFilterModel.js.flow +7 -3
  259. package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
  260. package/lib/models/filters/BaseFilterModel.js +3 -3
  261. package/lib/models/filters/BaseFilterModel.js.flow +16 -7
  262. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  263. package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
  264. package/lib/models/filters/ConceptIndexFilterModel.js.flow +8 -2
  265. package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
  266. package/lib/models/filters/FilterCollection.js +8 -7
  267. package/lib/models/filters/FilterCollection.js.flow +13 -7
  268. package/lib/models/filters/FilterCollection.js.map +1 -1
  269. package/lib/models/filters/StringFilterModel.js +2 -2
  270. package/lib/models/filters/StringFilterModel.js.flow +7 -3
  271. package/lib/models/filters/StringFilterModel.js.map +1 -1
  272. package/lib/models/form/FormModel.js +4 -4
  273. package/lib/models/form/FormModel.js.flow +8 -2
  274. package/lib/models/form/FormModel.js.map +1 -1
  275. package/lib/models/form/FormObjectModel.js +7 -4
  276. package/lib/models/form/FormObjectModel.js.flow +17 -4
  277. package/lib/models/form/FormObjectModel.js.map +1 -1
  278. package/lib/models/grouping/GroupingModel.js +10 -7
  279. package/lib/models/grouping/GroupingModel.js.flow +21 -5
  280. package/lib/models/grouping/GroupingModel.js.map +1 -1
  281. package/lib/models/href/Href.js +8 -7
  282. package/lib/models/href/Href.js.flow +17 -10
  283. package/lib/models/href/Href.js.map +1 -1
  284. package/lib/models/href/__tests__/Href.spec.js.flow +5 -8
  285. package/lib/models/links/LinkCollection.js +2 -3
  286. package/lib/models/links/LinkCollection.js.flow +3 -3
  287. package/lib/models/links/LinkCollection.js.map +1 -1
  288. package/lib/models/links/LinkModel.js +7 -7
  289. package/lib/models/links/LinkModel.js.flow +8 -15
  290. package/lib/models/links/LinkModel.js.map +1 -1
  291. package/lib/models/list/ListDetailModel.js +1 -1
  292. package/lib/models/list/ListDetailModel.js.flow +6 -1
  293. package/lib/models/list/ListDetailModel.js.map +1 -1
  294. package/lib/models/list/ListItemCollection.js +1 -1
  295. package/lib/models/list/ListItemCollection.js.flow +1 -2
  296. package/lib/models/list/ListItemCollection.js.map +1 -1
  297. package/lib/models/list/ListItemModel.js +3 -3
  298. package/lib/models/list/ListItemModel.js.flow +4 -4
  299. package/lib/models/list/ListItemModel.js.map +1 -1
  300. package/lib/models/list/ListModel.js +3 -3
  301. package/lib/models/list/ListModel.js.flow +12 -8
  302. package/lib/models/list/ListModel.js.map +1 -1
  303. package/lib/models/lookup/LookupOptionCollection.js +5 -1
  304. package/lib/models/lookup/LookupOptionCollection.js.flow +17 -6
  305. package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
  306. package/lib/models/lookup/LookupOptionsModel.js +2 -2
  307. package/lib/models/lookup/LookupOptionsModel.js.flow +2 -0
  308. package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
  309. package/lib/models/panels/GroupingPanelModel.js +1 -1
  310. package/lib/models/panels/GroupingPanelModel.js.flow +1 -2
  311. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  312. package/lib/models/tab/TabModel.js +2 -2
  313. package/lib/models/tab/TabModel.js.flow +2 -4
  314. package/lib/models/tab/TabModel.js.map +1 -1
  315. package/lib/models/taskgroup/TaskGroupModel.js +4 -4
  316. package/lib/models/taskgroup/TaskGroupModel.js.flow +5 -6
  317. package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
  318. package/lib/models/types.js.flow +5 -0
  319. package/lib/models/types.js.map +1 -1
  320. package/lib/models/user/UserProfileModel.js +4 -1
  321. package/lib/models/user/UserProfileModel.js.flow +1 -0
  322. package/lib/models/user/UserProfileModel.js.map +1 -1
  323. package/lib/modularui/CaptchaRequest.js +2 -2
  324. package/lib/modularui/CaptchaRequest.js.flow +7 -3
  325. package/lib/modularui/CaptchaRequest.js.map +1 -1
  326. package/lib/modularui/ModularUIRequest.js +7 -4
  327. package/lib/modularui/ModularUIRequest.js.flow +8 -5
  328. package/lib/modularui/ModularUIRequest.js.map +1 -1
  329. package/lib/modularui/ModularUIResponse.js +11 -2
  330. package/lib/modularui/ModularUIResponse.js.flow +13 -3
  331. package/lib/modularui/ModularUIResponse.js.map +1 -1
  332. package/lib/modularui/UploadRequest.js +2 -2
  333. package/lib/modularui/UploadRequest.js.flow +7 -3
  334. package/lib/modularui/UploadRequest.js.map +1 -1
  335. package/lib/react-client/client.js +2 -2
  336. package/lib/react-client/client.js.flow +7 -3
  337. package/lib/react-client/client.js.map +1 -1
  338. package/lib/react-server/renderSSRComplete.js +1 -1
  339. package/lib/react-server/renderSSRComplete.js.flow +2 -2
  340. package/lib/react-server/renderSSRComplete.js.map +1 -1
  341. package/lib/react-server/renderSSRMinimal.js +1 -1
  342. package/lib/react-server/renderSSRMinimal.js.flow +2 -2
  343. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  344. package/lib/redux/_modularui/ModularUIActions.js +8 -2
  345. package/lib/redux/_modularui/ModularUIActions.js.flow +8 -7
  346. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  347. package/lib/redux/_modularui/ModularUIUtils.js +8 -11
  348. package/lib/redux/_modularui/ModularUIUtils.js.flow +13 -14
  349. package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
  350. package/lib/utils/browser/Cookies.js +2 -2
  351. package/lib/utils/browser/Cookies.js.flow +3 -3
  352. package/lib/utils/browser/Cookies.js.map +1 -1
  353. package/lib/utils/helpers/__tests__/createHref.spec.js.flow +13 -8
  354. package/lib/utils/helpers/createHref.js +23 -3
  355. package/lib/utils/helpers/createHref.js.flow +37 -8
  356. package/lib/utils/helpers/createHref.js.map +1 -1
  357. package/lib/utils/helpers/repositoryResource.js +1 -1
  358. package/lib/utils/helpers/repositoryResource.js.flow +2 -2
  359. package/lib/utils/helpers/repositoryResource.js.map +1 -1
  360. package/package.json +4 -4
  361. package/src/constants/Settings.js +16 -6
  362. package/src/hooks/useAuthentication.js +3 -3
  363. package/src/hooks/useModelCatalog.js +7 -6
  364. package/src/hooks/useModularUI.js +12 -9
  365. package/src/hooks/useModularUIBasic.js +3 -4
  366. package/src/hooks/useModularUIModel.js +16 -11
  367. package/src/models/actions/ActionCollection.js +3 -8
  368. package/src/models/actions/ActionModel.js +7 -24
  369. package/src/models/application/ApplicationModel.js +1 -2
  370. package/src/models/attributes/AttributeCollection.js +12 -4
  371. package/src/models/attributes/AttributeModel.js +8 -2
  372. package/src/models/attributes/AttributeSetModel.js +11 -3
  373. package/src/models/attributes/BooleanAttributeModel.js +8 -4
  374. package/src/models/attributes/ChoiceAttributeModel.js +13 -4
  375. package/src/models/attributes/ChoiceAttributeOptionCollection.js +30 -28
  376. package/src/models/attributes/ChoiceAttributeOptionModel.js +30 -11
  377. package/src/models/attributes/CompositeAttributeChildCollection.js +8 -1
  378. package/src/models/attributes/CompositeAttributeModel.js +8 -3
  379. package/src/models/attributes/DatetimeAttributeModel.js +7 -2
  380. package/src/models/attributes/StringAttributeModel.js +7 -3
  381. package/src/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js +1 -1
  382. package/src/models/attributes/_createAttribute.js +3 -2
  383. package/src/models/base/BaseModel.js +31 -1
  384. package/src/models/base/ResourceModel.js +6 -23
  385. package/src/models/base/__tests__/BaseModel.spec.js +4 -0
  386. package/src/models/caseview/CaseViewModel.js +1 -2
  387. package/src/models/concepts/ConceptDetailModel.js +2 -2
  388. package/src/models/concepts/ConceptIndexModel.js +9 -6
  389. package/src/models/concepts/ConceptLinkModel.js +15 -12
  390. package/src/models/concepts/ConceptRelationCollection.js +17 -3
  391. package/src/models/concepts/ConceptRelationModel.js +18 -2
  392. package/src/models/concepts/SourceReferenceCollection.js +3 -8
  393. package/src/models/concepts/SourceReferenceModel.js +10 -11
  394. package/src/models/content/ContentIndexModel.js +10 -5
  395. package/src/models/content/ContentLinkModel.js +10 -13
  396. package/src/models/content/ContentModel.js +6 -1
  397. package/src/models/content/ContentTOCModel.js +19 -11
  398. package/src/models/content/SectionModel.js +9 -21
  399. package/src/models/detail/DetailModel.js +3 -4
  400. package/src/models/error/ErrorResponse.js +9 -20
  401. package/src/models/filters/AssignmentFilterModel.js +7 -3
  402. package/src/models/filters/BaseFilterModel.js +16 -7
  403. package/src/models/filters/ConceptIndexFilterModel.js +8 -2
  404. package/src/models/filters/FilterCollection.js +13 -7
  405. package/src/models/filters/StringFilterModel.js +7 -3
  406. package/src/models/form/FormModel.js +8 -2
  407. package/src/models/form/FormObjectModel.js +17 -4
  408. package/src/models/grouping/GroupingModel.js +21 -5
  409. package/src/models/href/Href.js +17 -10
  410. package/src/models/href/__tests__/Href.spec.js +5 -8
  411. package/src/models/links/LinkCollection.js +3 -3
  412. package/src/models/links/LinkModel.js +8 -15
  413. package/src/models/list/ListDetailModel.js +6 -1
  414. package/src/models/list/ListItemCollection.js +1 -2
  415. package/src/models/list/ListItemModel.js +4 -4
  416. package/src/models/list/ListModel.js +12 -8
  417. package/src/models/lookup/LookupOptionCollection.js +17 -6
  418. package/src/models/lookup/LookupOptionsModel.js +2 -0
  419. package/src/models/panels/GroupingPanelModel.js +1 -2
  420. package/src/models/tab/TabModel.js +2 -4
  421. package/src/models/taskgroup/TaskGroupModel.js +5 -6
  422. package/src/models/types.js +5 -0
  423. package/src/models/user/UserProfileModel.js +1 -0
  424. package/src/modularui/CaptchaRequest.js +7 -3
  425. package/src/modularui/ModularUIRequest.js +8 -5
  426. package/src/modularui/ModularUIResponse.js +13 -3
  427. package/src/modularui/UploadRequest.js +7 -3
  428. package/src/react-client/client.js +7 -3
  429. package/src/react-server/renderSSRComplete.js +2 -2
  430. package/src/react-server/renderSSRMinimal.js +2 -2
  431. package/src/redux/_modularui/ModularUIActions.js +8 -7
  432. package/src/redux/_modularui/ModularUIUtils.js +13 -14
  433. package/src/utils/browser/Cookies.js +3 -3
  434. package/src/utils/helpers/__tests__/createHref.spec.js +13 -8
  435. package/src/utils/helpers/createHref.js +37 -8
  436. package/src/utils/helpers/repositoryResource.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 [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.57.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.2...v1.57.3) (2024-10-30)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **basepath:** separate basepath in modular ui and server variant ([e594011](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/e594011b8ffafc439b4f988b3f01eff140e07a05))
11
+ * **connector:** return href to handle origin and contextpath ([98bf76a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/98bf76a704bafe5d0c42cfefd554bdb5b9cd1901))
12
+ * **context:** put origin and context on basemodel ([d364e96](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/d364e961f8a0e1952279fce004208a47f9b5193a))
13
+ * **hooks:** allow Href as input url for modularui hooks ([3e6ad6f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/3e6ad6f5884f8e460e5150ad87d8729ca350aaae))
14
+ * **href:** allow null in equals method ([5aba392](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/5aba39293be47c38ea9fe2cdc75233509a1af723))
15
+ * **usemodularui:** send href to usemodularui hook i.s.o. string ([cb5ba9f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/cb5ba9fd214cefc91d672f7c008421220398c089))
16
+
17
+ ## [1.57.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.1...v1.57.2) (2024-10-25)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **usemodularui:** avoid throwing of exception when wrong model ([9e258a9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/9e258a96bd12593a46a53b6043b78c01f05bb978))
23
+ * **usemodularui:** force load of model when it is removed from the store ([2dc4f12](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/2dc4f124ae0777cea5a9e54201127400f4b4cd0d))
24
+
5
25
  ## [1.57.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.0...v1.57.1) (2024-10-23)
6
26
 
7
27
 
@@ -101,18 +101,26 @@ export const allSettings = () => settings;
101
101
  export const cacheContributions = () => getSetting("CACHE_CONTRIBUTIONS", true);
102
102
 
103
103
  /**
104
- * Base path
105
- * This uses contextPath set from property from server
106
- * When requesting a remote server with CORS enabled, add the origin, for example:
107
- * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';
104
+ * The context path is retrieved on the server using the context path property as set in the runtime properties
105
+ * This can be manually override by setting the UI setting 'CONTEXT_PATH'
108
106
  */
109
107
  export const getBasePath = () => getSetting("CONTEXT_PATH", "/BeInformed");
110
108
 
109
+ /**
110
+ * The context path to modular ui rest services
111
+ */
112
+ export const getBasePathModularUI = () => getSetting("CONTEXT_PATH_SERVER", getBasePath());
113
+
114
+ /**
115
+ * Used to link the css and js files in the server templates
116
+ */
117
+ export const getBasePathServer = () => getSetting("CONTEXT_PATH_SERVER", getBasePath());
118
+
111
119
  /**
112
120
  * Path to upload service
113
121
  */
114
122
  export const getUploadPath = function () {
115
- let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBasePath();
123
+ let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBasePathModularUI();
116
124
  let origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
117
125
  return `${origin}${contextPath}${UPLOAD_PATH}`;
118
126
  };
@@ -121,7 +129,7 @@ export const getUploadPath = function () {
121
129
  * Path to captcha service
122
130
  */
123
131
  export const getCaptchaPath = function () {
124
- let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBasePath();
132
+ let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBasePathModularUI();
125
133
  let origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
126
134
  return `${origin}${contextPath}${CAPTCHA_PATH}`;
127
135
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","arguments","length","origin","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePath(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePath(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;EAE/C;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,6BAA6B,EAAE,IAAI;EAEnC;EACAC,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EAE7B;EACAC,wBAAwB,EAAE,KAAK;EAE/B;EACAC,yBAAyB,EAAE,KAAK;EAEhC;EACAC,wCAAwC,EAAE,KAAK;EAE/C;EACAC,UAAU,EAAE,SAAS;EAErB;EACAC,wBAAwB,EAAE,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,UAAkB,GAAAR,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAR,SAAA,GAAAQ,SAAA,MAAG,YAAY;EAAA,OACzDX,UAAU,CAAChD,kBAAkB,EAAE,yBAAyBmE,UAAU,EAAE,CAAC;AAAA;AACvE;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAChCpB,UAAU,CAAC/C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAMoE,kBAAkB,GAAGA,CAAA,KAChCrB,UAAU,CAAC9C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAMoE,UAAU,GAAGA,CAAA,KACxBtB,UAAU,CAAC7C,mBAAmB,EAAE,SAAS,CAAC;AAE5C,OAAO,MAAMuB,UAAkB,GAAGwC,SAAS,CAAC,CAAC;AAC7C,OAAO,MAAMtC,WAAmB,GAAG0C,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAGxB,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAACyB,2BAAA,CAAAD,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO5E,wBAAwB,CAAC4E,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAIhE,WAAmB,IAAK;EACrD0C,UAAU,CAAC,cAAc,EAAE1C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMiE,IAAY,GAAGnB,WAAW,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","arguments","length","origin","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually override by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK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AAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAG1B,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC2B,2BAAA,CAAAD,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO9E,wBAAwB,CAAC8E,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAIlE,WAAmB,IAAK;EACrD0C,UAAU,CAAC,cAAc,EAAE1C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMmE,IAAY,GAAGrB,WAAW,CAAC,CAAC","ignoreList":[]}
@@ -2,7 +2,7 @@ import { useSelector, useDispatch } from "react-redux";
2
2
  import { getApplication } from "../redux/_modularui/ModularUISelectors";
3
3
  import { login, logout, resetAuthErrors } from "../redux/actions";
4
4
  import Cache from "../utils/browser/Cache";
5
- import { DEFAULT_AUTHENTICATION_TYPE, getBasePath, logoutPath } from "../constants";
5
+ import { DEFAULT_AUTHENTICATION_TYPE, getBasePathServer, logoutPath } from "../constants";
6
6
  import { IllegalStateException } from "../exceptions";
7
7
  /**
8
8
  */
@@ -25,7 +25,7 @@ export const useLogin = () => {
25
25
  }
26
26
  if (!isAuthenticated) {
27
27
  Cache.setItem("isRedirectLogin", true);
28
- window.location.assign(`${getBasePath()}${authenticationType.redirectUri ?? ""}`);
28
+ window.location.assign(`${getBasePathServer()}${authenticationType.redirectUri ?? ""}`);
29
29
  }
30
30
  }
31
31
  };
@@ -37,7 +37,7 @@ export const useLogout = () => {
37
37
  const dispatch = useDispatch();
38
38
  const application = useSelector(getApplication);
39
39
  const LOGOUT_PATH = logoutPath();
40
- const BASE_PATH = getBasePath();
40
+ const BASE_PATH = getBasePathServer();
41
41
  const isAuthenticated = application?.isLoggedIn ?? false;
42
42
  return {
43
43
  isAuthenticated,
@@ -1 +1 @@
1
- {"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","getBasePath","logoutPath","IllegalStateException","useLogin","setItem","dispatch","application","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","errorMessage","error","resetErrors","username","password","redirectLogin","authenticationType","getItem","authentication","redirectUri","window","location","assign","useLogout","LOGOUT_PATH","BASE_PATH","origin","url"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { getApplication } from \"../redux/_modularui/ModularUISelectors\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\n\nimport Cache from \"../utils/browser/Cache\";\nimport {\n DEFAULT_AUTHENTICATION_TYPE,\n getBasePath,\n logoutPath,\n} from \"../constants\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\nimport { IllegalStateException } from \"../exceptions\";\ntype LoginHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => void,\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getBasePath()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useSelector(getApplication);\n\n const LOGOUT_PATH = logoutPath();\n const BASE_PATH = getBasePath();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE_PATH}/logout?url=${origin}${BASE_PATH}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,cAAc,QAAQ,wCAAwC;AACvE,SAASC,KAAK,EAAEC,MAAM,EAAEC,eAAe,QAAQ,kBAAkB;AAEjE,OAAOC,KAAK,MAAM,wBAAwB;AAC1C,SACEC,2BAA2B,EAC3BC,WAAW,EACXC,UAAU,QACL,cAAc;AAIrB,SAASC,qBAAqB,QAAQ,eAAe;AAerD;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAiB;EACvCL,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAGZ,WAAW,CAAC,CAAC;EAE9B,MAAMa,WAAW,GAAGd,WAAW,CAACE,cAAc,CAAC;EAC/C,MAAMa,IAAI,GAAGf,WAAW,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E,mBAAmB,EAAEL,WAAW,EAAEK,mBAAmB,IAAI,CACvDZ,2BAA2B,CAC5B;IACDH,MAAM,EAAEA,CAAA,KAAM;MACZ,IAAIE,KAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC,MAAMS,MAAM,GAAGN,MAAM,CAACC,QAAQ,CAACK,MAAM;QACrC,MAAMC,GAAG,GAAG,GAAGD,MAAM,GAAGD,SAAS,eAAeC,MAAM,GAAGD,SAAS,GAAGD,WAAW,EAAE;QAClF5B,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACK,GAAG,CAAC;MAC7B,CAAC,MAAM;QACL,OAAOxB,QAAQ,CAACT,MAAM,CAAC,CAAC,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","getBasePathServer","logoutPath","IllegalStateException","useLogin","setItem","dispatch","application","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","errorMessage","error","resetErrors","username","password","redirectLogin","authenticationType","getItem","authentication","redirectUri","window","location","assign","useLogout","LOGOUT_PATH","BASE_PATH","origin","url"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { getApplication } from \"../redux/_modularui/ModularUISelectors\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\n\nimport Cache from \"../utils/browser/Cache\";\nimport {\n DEFAULT_AUTHENTICATION_TYPE,\n getBasePathServer,\n logoutPath,\n} from \"../constants\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\nimport { IllegalStateException } from \"../exceptions\";\ntype LoginHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => void,\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useSelector(getApplication);\n\n const LOGOUT_PATH = logoutPath();\n const BASE_PATH = getBasePathServer();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE_PATH}/logout?url=${origin}${BASE_PATH}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n"],"mappings":"AACA,SAASA,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E,IAAI,CAAC;QACtCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CACpB,GAAGxB,iBAAiB,CAAC,CAAC,GAAGkB,kBAAkB,CAACG,WAAW,IAAI,EAAE,EAC/D,CAAC;MACH;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMI,SAAS,GAAGA,CAAA,KAAkB;EACzC,MAAMpB,QAAQ,GAAGZ,WAAW,CAAC,CAAC;EAC9B,MAAMa,WAAW,GAAGd,WAAW,CAACE,cAAc,CAAC;EAE/C,MAAMgC,WAAW,GAAGzB,UAAU,CAAC,CAAC;EAChC,MAAM0B,SAAS,GAAG3B,iBAAiB,CAAC,CAAC;EAErC,MAAMS,eAAe,GAAGH,WAAW,EAAEI,UAAU,IAAI,KAAK;EACxD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEL,WAAW,EAAEK,mBAAmB,IAAI,CACvDZ,2BAA2B,CAC5B;IACDH,MAAM,EAAEA,CAAA,KAAM;MACZ,IAAIE,KAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC,MAAMS,MAAM,GAAGN,MAAM,CAACC,QAAQ,CAACK,MAAM;QACrC,MAAMC,GAAG,GAAG,GAAGD,MAAM,GAAGD,SAAS,eAAeC,MAAM,GAAGD,SAAS,GAAGD,WAAW,EAAE;QAClF5B,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACK,GAAG,CAAC;MAC7B,CAAC,MAAM;QACL,OAAOxB,QAAQ,CAACT,MAAM,CAAC,CAAC,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useModelCatalog.js","names":["useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","url","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\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\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const url = filterParameters(href, [\n \"entryDate\",\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAW5C;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,OAAqD,IAErDH,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDI,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEb,iBAAiB;EAC9B,GAAGW;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAAG,SAAAA,CAC7BC,IAAY,EAGW;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,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I,CAAC,GAAG,CAAC,EAAE,GAAGR,GAAG;AACvE,CAAC;;AAED;AACA;AACA,OAAO,MAAMW,gBAAgB,GAAG,SAAAA,CAC9BV,OAAqB,EAGE;EAAA,IAFvBjB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAOnB,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAMiC,gBAAgB,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBjB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOT,eAAe,CAACT,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModelCatalog.js","names":["useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","url","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\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\nimport type Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const url = filterParameters(href, [\n \"entryDate\",\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAY5C;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,OAAqD,IAErDH,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDI,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEb,iBAAiB;EAC9B,GAAGW;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAAG,SAAAA,CAC7BC,IAAmB,EAGI;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,cAAc;EAAA,IAC7BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMC,GAAG,GAAGrB,gBAAgB,CAACgB,IAAI,EAAE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D,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAOnB,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAMiC,gBAAgB,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBjB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOT,eAAe,CAACT,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC","ignoreList":[]}
@@ -24,29 +24,31 @@ export const useModularUI = function (modelKey, url) {
24
24
  const dispatch = useDispatch();
25
25
  const href = useMemo(() => url?.toString() || "", [url]);
26
26
  const key = useKeyForHook(modelKey, href);
27
+ const modelSelector = useMemo(() => state => state.modularui[key], [key]);
28
+ const model = useSelector(modelSelector);
27
29
  if (url instanceof Href) {
28
30
  options.origin = options.origin ?? url.origin;
29
31
  options.contextPath = options.contextPath ?? url.contextPath;
30
32
  }
31
33
  const location = useLocation();
32
34
  const redirectLocation = location.state?.redirectLocation;
33
- const forceReload = redirectLocation instanceof Href ? redirectLocation?.equals(href) : false;
35
+ const forceLoad = model == null || (redirectLocation instanceof Href ? redirectLocation?.equals(href) : false);
34
36
  const prevOptions = useRef(options);
35
37
  const prevHref = useRef(href);
36
- const prevForceReload = useRef(forceReload);
38
+ const prevForceLoad = useRef(forceLoad);
37
39
 
38
40
  // dispatch loadModularUI
39
41
  useDeepCompareEffect(() => {
40
42
  // prevent reloads when previous option had the isReload, but the new options not
41
43
  const isOldReload = prevHref.current === href && prevOptions.current.isReload && !options.isReload;
42
- const doForceReload = forceReload && !prevForceReload.current;
43
- if (href !== "" && (doForceReload || !isOldReload)) {
44
+ const doForceLoad = forceLoad && !prevForceLoad.current;
45
+ if (href !== "" && (doForceLoad || !isOldReload)) {
44
46
  dispatch(loadModularUI(key, href, options));
45
47
  }
46
48
  prevOptions.current = options;
47
49
  prevHref.current = href;
48
- prevForceReload.current = forceReload;
49
- }, [key, href, options, forceReload]);
50
+ prevForceLoad.current = forceLoad;
51
+ }, [key, href, options, forceLoad]);
50
52
  useEffect(() => {
51
53
  if (options.removeOnUnmount) {
52
54
  return () => {
@@ -54,7 +56,6 @@ export const useModularUI = function (modelKey, url) {
54
56
  };
55
57
  }
56
58
  }, [dispatch, key, options.removeOnUnmount]);
57
- const selector = useMemo(() => state => state.modularui[key], [key]);
58
- return useSelector(selector);
59
+ return model;
59
60
  };
60
61
  //# sourceMappingURL=useModularUI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUI.js","names":["useEffect","useRef","useMemo","useDispatch","useSelector","useLocation","HTTP_METHODS","loadModularUI","removeModelByKey","useDeepCompareEffect","useLocale","Href","useKeyForHook","modelKey","url","locale","split","useModularUI","options","arguments","length","undefined","method","GET","removeOnUnmount","dispatch","href","toString","key","origin","contextPath","location","redirectLocation","state","forceReload","equals","prevOptions","prevHref","prevForceReload","isOldReload","current","isReload","doForceReload","selector","modularui"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useRef, useMemo } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { HTTP_METHODS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\n\nimport { useLocale } from \"./useI18n\";\nimport Href from \"../models/href/Href\";\n\nimport type { RequestModularUIOptions } from \"../utils\";\n\n/**\n */\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useLocale();\n return useMemo(\n () => `${modelKey}(${url.split(\"?\")[0]})(${locale})`,\n [modelKey, url, locale],\n );\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n },\n): any => {\n const dispatch = useDispatch();\n const href = useMemo(() => url?.toString() || \"\", [url]);\n const key = useKeyForHook(modelKey, href);\n\n if (url instanceof Href) {\n options.origin = options.origin ?? url.origin;\n options.contextPath = options.contextPath ?? url.contextPath;\n }\n\n const location = useLocation();\n const redirectLocation = location.state?.redirectLocation;\n const forceReload =\n redirectLocation instanceof Href ? redirectLocation?.equals(href) : false;\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n const prevForceReload = useRef(forceReload);\n\n // dispatch loadModularUI\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n const doForceReload = forceReload && !prevForceReload.current;\n\n if (href !== \"\" && (doForceReload || !isOldReload)) {\n dispatch(loadModularUI(key, href, options));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n prevForceReload.current = forceReload;\n }, [key, href, options, forceReload]);\n\n useEffect(() => {\n if (options.removeOnUnmount) {\n return () => {\n dispatch(removeModelByKey(key));\n };\n }\n }, [dispatch, key, options.removeOnUnmount]);\n\n const selector = useMemo(() => (state) => state.modularui[key], [key]);\n return useSelector(selector);\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,YAAY,QAAQ,cAAc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AAG,CAAC,EAAE,CAACA,GAAG,CAAC,CAAC;EACtE,OAAOxB,WAAW,CAACuC,QAAQ,CAAC;AAC9B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModularUI.js","names":["useEffect","useRef","useMemo","useDispatch","useSelector","useLocation","HTTP_METHODS","loadModularUI","removeModelByKey","useDeepCompareEffect","useLocale","Href","useKeyForHook","modelKey","url","locale","split","useModularUI","options","arguments","length","undefined","method","GET","removeOnUnmount","dispatch","href","toString","key","modelSelector","state","modularui","model","origin","contextPath","location","redirectLocation","forceLoad","equals","prevOptions","prevHref","prevForceLoad","isOldReload","current","isReload","doForceLoad"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useRef, useMemo } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { HTTP_METHODS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\n\nimport { useLocale } from \"./useI18n\";\nimport Href from \"../models/href/Href\";\n\nimport type { RequestModularUIOptions } from \"../utils\";\n\n/**\n */\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useLocale();\n return useMemo(\n () => `${modelKey}(${url.split(\"?\")[0]})(${locale})`,\n [modelKey, url, locale],\n );\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n },\n): any => {\n const dispatch = useDispatch();\n const href = useMemo(() => url?.toString() || \"\", [url]);\n const key = useKeyForHook(modelKey, href);\n\n const modelSelector = useMemo(() => (state) => state.modularui[key], [key]);\n const model = useSelector(modelSelector);\n\n if (url instanceof Href) {\n options.origin = options.origin ?? url.origin;\n options.contextPath = options.contextPath ?? url.contextPath;\n }\n\n const location = useLocation();\n const redirectLocation = location.state?.redirectLocation;\n const forceLoad =\n model == null ||\n (redirectLocation instanceof Href ? redirectLocation?.equals(href) : false);\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n const prevForceLoad = useRef(forceLoad);\n\n // dispatch loadModularUI\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n const doForceLoad = forceLoad && !prevForceLoad.current;\n\n if (href !== \"\" && (doForceLoad || !isOldReload)) {\n dispatch(loadModularUI(key, href, options));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n prevForceLoad.current = forceLoad;\n }, [key, href, options, forceLoad]);\n\n useEffect(() => {\n if (options.removeOnUnmount) {\n return () => {\n dispatch(removeModelByKey(key));\n };\n }\n }, [dispatch, key, options.removeOnUnmount]);\n\n return model;\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,YAAY,QAAQ,cAAc;AAC3C,SACEC,aAAa,EACbC,gBAAgB,QACX,sCAAsC;AAE7C,OAAOC,oBAAoB,MAAM,wBAAwB;AAEzD,SAASC,SAAS,QAAQ,WAAW;AACrC,OAAOC,IAAI,MAAM,qBAAqB;AAItC;AACA;AACA,MAAMC,aAAa,GAAGA,CAACC,QAAgB,EAAEC,GAAW,KAAK;EACvD,MAAMC,MAAM,GAAGL,SAAS,CAAC,CAAC;EAC1B,OAAOR,OAAO,CACZ,MAAM,GAAGW,QAAQ,IAAIC,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAKD,MAAM,GAAG,EACpD,CAACF,QAAQ,EAAEC,GAAG,EAAEC,MAAM,CACxB,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,YAAY,GAAG,SAAAA,CA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AS,CAAC;;EAEvC;EACA5B,oBAAoB,CAAC,MAAM;IACzB;IACA,MAAMiC,WAAW,GACfF,QAAQ,CAACG,OAAO,KAAKjB,IAAI,IACzBa,WAAW,CAACI,OAAO,CAACC,QAAQ,IAC5B,CAAC1B,OAAO,CAAC0B,QAAQ;IAEnB,MAAMC,WAAW,GAAGR,SAAS,IAAI,CAACI,aAAa,CAACE,OAAO;IAEvD,IAAIjB,IAAI,KAAK,EAAE,KAAKmB,WAAW,IAAI,CAACH,WAAW,CAAC,EAAE;MAChDjB,QAAQ,CAAClB,aAAa,CAACqB,GAAG,EAAEF,IAAI,EAAER,OAAO,CAAC,CAAC;IAC7C;IAEAqB,WAAW,CAACI,OAAO,GAAGzB,OAAO;IAC7BsB,QAAQ,CAACG,OAAO,GAAGjB,IAAI;IACvBe,aAAa,CAACE,OAAO,GAAGN,SAAS;EACnC,CAAC,EAAE,CAACT,GAAG,EAAEF,IAAI,EAAER,OAAO,EAAEmB,SAAS,CAAC,CAAC;EAEnCrC,SAAS,CAAC,MAAM;IACd,IAAIkB,OAAO,CAACM,eAAe,EAAE;MAC3B,OAAO,MAAM;QACXC,QAAQ,CAACjB,gBAAgB,CAACoB,GAAG,CAAC,CAAC;MACjC,CAAC;IACH;EACF,CAAC,EAAE,CAACH,QAAQ,EAAEG,GAAG,EAAEV,OAAO,CAACM,eAAe,CAAC,CAAC;EAE5C,OAAOQ,KAAK;AACd,CAAC","ignoreList":[]}
@@ -2,7 +2,6 @@ import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/i
2
2
  import { useMemo } from "react";
3
3
  import { useModularUI } from "./useModularUI";
4
4
  import { useLocation } from "./useRouter";
5
- import { IllegalStateException } from "../exceptions";
6
5
  // Helper to create useModularUI options
7
6
  const createUseModularUIOptions = (options, href, location) => {
8
7
  var _context;
@@ -42,8 +41,7 @@ const validateModel = (model, expectedModels) => {
42
41
  if (expectedModels.length > 0) {
43
42
  const isCorrectModel = expectedModels.some(expectedModel => model.type === expectedModel);
44
43
  if (!isCorrectModel) {
45
- console.error(model, "is not of instance", expectedModels);
46
- throw new IllegalStateException("Resolved model has incorrect type");
44
+ console.warn(model, "is not of instance", expectedModels);
47
45
  }
48
46
  }
49
47
  };
@@ -62,7 +60,7 @@ export const useModularUIBasic = function (key, href) {
62
60
  const location = useLocation();
63
61
  const memoizedHref = useMemo(() => href.toString(), [href]);
64
62
  const useModularUIOptions = useMemo(() => createUseModularUIOptions(options, memoizedHref, location), [options, memoizedHref, location]);
65
- const modularUI = useModularUI(key, memoizedHref, useModularUIOptions);
63
+ const modularUI = useModularUI(key, href, useModularUIOptions);
66
64
  const expectedModels = useMemo(() => options.expectedModels ?? [], [options.expectedModels]);
67
65
  return useMemo(() => {
68
66
  if (modularUI?.model) {
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIBasic.js","names":["useMemo","useModularUI","useLocation","IllegalStateException","createUseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWithInstanceProperty","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","error","useModularUIBasic","key","arguments","memoizedHref","toString","useModularUIOptions","modularUI"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\nimport { useLocation } from \"./useRouter\";\nimport { IllegalStateException } from \"../exceptions\";\nimport type { ModularUIModel, Href } from \"../models\";\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n};\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T: ModularUIModel>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: any,\n): Object => {\n const baseOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (location.state?.reload && location.pathname.startsWith(href)) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: any, expectedModels: Array<string>) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some(\n (expectedModel) => model.type === expectedModel,\n );\n if (!isCorrectModel) {\n console.error(model, \"is not of instance\", expectedModels);\n throw new IllegalStateException(\"Resolved model has incorrect type\");\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | null => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key, memoizedHref, useModularUIOptions);\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n return useMemo((): T | null => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model;\n }\n return null;\n }, [expectedModels, modularUI]);\n};\n"],"mappings":";AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,qBAAqB,QAAQ,eAAe;AAYrD;AACA,MAAMC,yBAAyB,GAAGA,CAChCC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UseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWithInstanceProperty","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","warn","useModularUIBasic","key","arguments","memoizedHref","toString","useModularUIOptions","modularUI"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n};\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T: ModularUIModel>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: any,\n): Object => {\n const baseOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (location.state?.reload && location.pathname.startsWith(href)) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: any, expectedModels: Array<string>) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some(\n (expectedModel) => model.type === expectedModel,\n );\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | null => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key, href, useModularUIOptions);\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n return useMemo((): T | null => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model;\n }\n return null;\n }, [expectedModels, modularUI]);\n};\n"],"mappings":";AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,aAAa;AAazC;AACA,MAAMC,yBAAyB,GAAGA,CAChCC,OAAoC,EACpCC,IAAY,EACZC,QAAa,KACF;EAAA,IAAAC,QAAA;EACX,MAAMC,WAAW,GAAG;IAClBC,WAAW,EAAEC,SAAS;IACtBC,gBAAgB,EAAED,SAAS;IAC3BE,QAAQ,EAAE,KAAK;IACfC,MAAM,EAAEH,SAAS;IACjBI,WAAW,EAAEJ,SAAS;IACtBK,KAAK,EAAE;EACT,CAAC;;EAED;EACA,IAAIX,OAAO,CAACK,WAAW,EAAE;IACvBD,WAAW,CAACC,WAAW,GAAGL,OAAO,CAACK,WAAW;IAC7CD,WAAW,CAACG,gBAAgB,GAAGP,OAAO,CAACO,gBAAgB;EACzD;;EAEA;EACA,IAAIP,OAAO,CAACW,KAAK,EAAE;IACjBP,WAAW,CAACO,KAAK,GAAGX,OAAO,CAACW,KAAK;EACnC;;EAEA;EACA,IAAIT,QAAQ,CAACU,KAAK,EAAEC,MAAM,IAAIC,2BAAA,CAAAX,QAAA,GAAAD,QAAQ,CAACa,QAAQ,EAAAC,IAAA,CAAAb,QAAA,EAAYF,IAAI,CAAC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CAAC;EAED,MAAM+B,SAAS,GAAGpC,YAAY,CAAC+B,GAAG,EAAE3B,IAAI,EAAE+B,mBAAmB,CAAC;EAC9D,MAAMb,cAAc,GAAGvB,OAAO,CAC5B,MAAMI,OAAO,CAACmB,cAAc,IAAI,EAAE,EAClC,CAACnB,OAAO,CAACmB,cAAc,CACzB,CAAC;EAED,OAAOvB,OAAO,CAAC,MAAgB;IAC7B,IAAIqC,SAAS,EAAEf,KAAK,EAAE;MACpBD,aAAa,CAACgB,SAAS,CAACf,KAAK,EAAEC,cAAc,CAAC;MAC9C,OAAOc,SAAS,CAACf,KAAK;IACxB;IACA,OAAO,IAAI;EACb,CAAC,EAAE,CAACC,cAAc,EAAEc,SAAS,CAAC,CAAC;AACjC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","ListModel","GroupingPanelModel","DetailModel","CaseSearchModel","ListDetailModel","UserProfileModel","useModularUIBasic","useApplication","options","expectedModels","targetModel","useTab","href","useCaseView","usePanel","useList","useListOrDetail","useListDetail","forceTargetModel","useGroupingPanel","useDetailPanel","useQuicksearch","useSearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\ntype HookOptions = {\n origin?: string,\n contextPath?: string,\n};\n\n/**\n * Load application\n */\nexport const useApplication = (\n options?: HookOptions,\n): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (href: string, options?: HookOptions): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (\n href: string,\n options?: HookOptions,\n): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\n/**\n */\nexport const usePanel = (\n href: string,\n options?: HookOptions,\n): ListModel | GroupingPanelModel | DetailModel | null =>\n useModularUIBasic(\"panel\", href, {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n ...options,\n });\n\n/**\n */\nexport const useList = (\n href: string,\n options?: HookOptions,\n): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\n/**\n */\nexport const useListOrDetail = (\n href: string,\n options?: HookOptions,\n): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\n/**\n */\nexport const useListDetail = (\n href: string,\n options?: HookOptions,\n): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\n/**\n */\nexport const useGroupingPanel = (\n href: string,\n options?: HookOptions,\n): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\n/**\n */\nexport const useDetailPanel = (\n href: string,\n options?: HookOptions,\n): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\n/**\n */\nexport const useQuicksearch = (\n href: string,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useSearch = (\n href: string,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useUserProfile = (\n href: string,\n options?: HookOptions,\n): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n"],"mappings":"AACA,OAAOA,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,kBAAkB,MAAM,qCAAqC;AACpE,OAAOC,WAAW,MAAM,8BAA8B;AACtD,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,gBAAgB,MAAM,iCAAiC;AAE9D,SAASC,iBAAiB,QAAQ,qBAAqB;AAOvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GACzBC,OAAqB,IAErBF,iBAAiB,CAAC,aAAa,EAAE,GAAG,EAAE;EACpCG,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEb,gBAAgB;EAC7B,GAAGW;AACL,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,OAAO,MAAMG,MAAM,GAAGA,CAACC,IAAY,EAAEJ,OAAqB,KACxDF,iBAAiB,CAAC,KAAK,EAAEM,IAAI,EAAE;EAC7BH,cAAc,EAAE,CAAC,KAAK,CAAC;EACvBC,WAAW,EAAEX,QAAQ;EACrB,GAAGS;AACL,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,OAAO,MAAMK,WAA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E;EACvCH,cAAc,EAAE,CAAC,eAAe,CAAC;EACjCC,WAAW,EAAET,kBAAkB;EAC/B,GAAGO;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMY,cAAc,GAAGA,CAC5BR,IAAY,EACZJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,QAAQ,CAAC;EAC1BC,WAAW,EAAER,WAAW;EACxB,GAAGM;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMa,cAAc,GAAGA,CAC5BT,IAAY,EACZJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEP,eAAe;EAC5B,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMc,SAAS,GAAGA,CACvBV,IAAY,EACZJ,OAAqB,KAErBF,iBAAiB,CAAC,QAAQ,EAAEM,IAAI,EAAE;EAChCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEP,eAAe;EAC5B,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMe,cAAc,GAAGA,CAC5BX,IAAY,EACZJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEL,gBAAgB;EAC7B,GAAGG;AACL,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","ListModel","GroupingPanelModel","DetailModel","CaseSearchModel","ListDetailModel","UserProfileModel","useModularUIBasic","useApplication","options","expectedModels","targetModel","useTab","href","useCaseView","usePanel","useList","useListOrDetail","useListDetail","forceTargetModel","useGroupingPanel","useDetailPanel","useQuicksearch","useSearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\nimport type Href from \"../models/href/Href\";\n\ntype HookOptions = {\n origin?: string,\n contextPath?: string,\n};\n\n/**\n * Load application\n */\nexport const useApplication = (\n options?: HookOptions,\n): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (\n href: string | Href,\n options?: HookOptions,\n): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (\n href: string | Href,\n options?: HookOptions,\n): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\n/**\n */\nexport const usePanel = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | GroupingPanelModel | DetailModel | null =>\n useModularUIBasic(\"panel\", href, {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n ...options,\n });\n\n/**\n */\nexport const useList = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\n/**\n */\nexport const useListOrDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\n/**\n */\nexport const useListDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\n/**\n */\nexport const useGroupingPanel = (\n href: string | Href,\n options?: HookOptions,\n): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\n/**\n */\nexport const useDetailPanel = (\n href: string | Href,\n options?: HookOptions,\n): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\n/**\n */\nexport const useQuicksearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useSearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useUserProfile = (\n href: string | Href,\n options?: HookOptions,\n): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n"],"mappings":"AACA,OAAOA,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,kBAAkB,MAAM,qCAAqC;AACpE,OAAOC,WAAW,MAAM,8BAA8B;AACtD,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,OAAO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AChCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEP,eAAe;EAC5B,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMe,cAAc,GAAGA,CAC5BX,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEL,gBAAgB;EAC7B,GAAGG;AACL,CAAC,CAAC","ignoreList":[]}
@@ -4,12 +4,11 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/ins
4
4
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
5
5
  import BaseCollection from "../base/BaseCollection";
6
6
  import ActionModel from "./ActionModel";
7
-
8
7
  /**
9
8
  * Collection of actions
10
9
  */
11
10
  export default class ActionCollection extends BaseCollection {
12
- constructor(actions, actionsContributions, origin, contextPath) {
11
+ constructor(actions, actionsContributions, modelOptions) {
13
12
  super();
14
13
 
15
14
  // no actions gives an empty collection
@@ -20,7 +19,7 @@ export default class ActionCollection extends BaseCollection {
20
19
  for (const actionData of actions) {
21
20
  const actionContribution = _findInstanceProperty(actionsContributions).call(actionsContributions, actionContribution => actionContribution.name === actionData.name && actionContribution.type !== "service-operation");
22
21
  if (actionContribution) {
23
- actionModels.push(new ActionModel(actionData, actionContribution, origin, contextPath));
22
+ actionModels.push(new ActionModel(actionData, actionContribution, modelOptions));
24
23
  }
25
24
  }
26
25
  this.collection = actionModels;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionCollection.js","names":["BaseCollection","ActionModel","ActionCollection","constructor","actions","actionsContributions","origin","contextPath","Array","isArray","collection","actionModels","actionData","actionContribution","_findInstanceProperty","call","name","type","push","getActionByKey","key","_context","newCollection","_filterInstanceProperty","action","first","getActionsByType","_context2","_includesInstanceProperty","getActionsByLayoutHint","_context3","_len","arguments","length","hints","_key","layouthint","has","hasActionsByLayoutHint","routePath","_context4","enabledRoutes","isDisabled","path","_mapInstanceProperty","selfhref","join"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n origin?: string,\n contextPath?: string,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (actionContribution) =>\n actionContribution.name === actionData.name &&\n actionContribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(\n new ActionModel(\n actionData,\n actionContribution,\n origin,\n contextPath,\n ),\n );\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,WAAW,MAAM,eAAe;;AAEvC;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,cAAc,CAAc;EACxEG,WAAWA,CACTC,OAAgB,EAChBC,oBAA6B,EAC7BC,MAAe,EACfC,WAAoB,EACpB;IACA,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACL,OAAO,CAAC,EAAE;MAC3B,IAAI,CAACM,UAAU,GAAG,EAAE;IACtB,CAAC,MAAM,IAAIF,KAAK,CAACC,OAAO,CAACJ,oBAAoB,CAAC,EAAE;MAC9C,MAAMM,YAAY,GAAG,EAAE;MACvB,KAAK,MAAMC,UAAU,IAAIR,OAAO,EAAE;QAChC,MAAMS,kBAAkB,GAAGC,qBAAA,CAAAT,oBAAoB,EAAAU,IAAA,CAApBV,oBAAoB,EAC5CQ,kBAAkB,IACjBA,kBAAkB,CAACG,IAAI,KAAKJ,UAAU,CAACI,IAAI,IAC3CH,kBAAkB,CAACI,IAAI,KAAK,mBAChC,CAAC;QAED,IAAIJ,kBAAkB,EAAE;UACtBF,YAAY,CAACO,IAAI,CACf,IAAIjB,WAAW,CACbW,UAAU,EACVC,kBAAkB,EAClBP,MAAM,EACNC,WACF,CACF,CAAC;QACH;MACF;MAEA,IAAI,CAACG,UAAU,GAAGC,YAAY;IAChC;EACF;;EAEA;AACF;AACA;EACEQ,cAAcA,CAACC,GAAW,EAAsB;IAAA,IAAAC,QAAA;IAC9C,MAAMC,aAAa,GAAG,IAAIpB,gBAAgB,CAAC,CAAC;IAE5CoB,aAAa,CAACZ,UAAU,GAAGa,uBAAA,CAAAF,QAAA,OAAI,EAAAN,IAAA,CAAAM,QAAA,EAASG,MAAM,IAAKA,MAAM,CAACJ,GAAG,KAAKA,GAAG,CAAC;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SAAA,OAAI,CAAC9B,UAAU,EAAAK,IAAA,CAAAyB,SAAA,EAClChB,MAAM,IAAK,CAACA,MAAM,CAACkB,UACtB,CAAC;IAED,IAAID,aAAa,CAACR,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMU,IAAI,GAAGC,oBAAA,CAAAH,aAAa,EAAA1B,IAAA,CAAb0B,aAAa,EAAMjB,MAAM,IAAKA,MAAM,CAACqB,QAAQ,CAACF,IAAI,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE1E,OAAO,IAAI,CAACb,MAAM,GAAG,CAAC,GAAG,IAAIU,IAAI,GAAG,GAAGA,IAAI;EAC7C;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ActionCollection.js","names":["BaseCollection","ActionModel","ActionCollection","constructor","actions","actionsContributions","modelOptions","Array","isArray","collection","actionModels","actionData","actionContribution","_findInstanceProperty","call","name","type","push","getActionByKey","key","_context","newCollection","_filterInstanceProperty","action","first","getActionsByType","_context2","_includesInstanceProperty","getActionsByLayoutHint","_context3","_len","arguments","length","hints","_key","layouthint","has","hasActionsByLayoutHint","routePath","_context4","enabledRoutes","isDisabled","path","_mapInstanceProperty","selfhref","join"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (actionContribution) =>\n actionContribution.name === actionData.name &&\n actionContribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(\n new ActionModel(actionData, actionContribution, modelOptions),\n );\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,WAAW,MAAM,eAAe;AAGvC;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,cAAc,CAAc;EACxEG,WAAWA,CACTC,OAAgB,EAChBC,oBAA6B,EAC7BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;MAC3B,IAAI,CAACK,UAAU,GAAG,EAAE;IACtB,CAAC,MAAM,IAAIF,KAAK,CAACC,OAAO,CAACH,oBAAoB,CAAC,EAAE;MAC9C,MAAMK,YAAY,GAAG,EAAE;MACvB,K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SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAxCC,KAAK,OAAA1B,KAAA,CAAAuB,IAAA,GAAAI,IAAA,MAAAA,IAAA,GAAAJ,IAAA,EAAAI,IAAA;MAALD,KAAK,CAAAC,IAAA,IAAAH,SAAA,CAAAG,IAAA;IAAA;IAC7B,MAAMb,aAAa,GAAG,IAAInB,gBAAgB,CAAC,CAAC;IAE5CmB,aAAa,CAACZ,UAAU,GAAGa,uBAAA,CAAAO,SAAA,OAAI,EAAAf,IAAA,CAAAe,SAAA,EAASN,MAAM,IAC5CA,MAAM,CAACY,UAAU,CAACC,GAAG,CAAC,GAAGH,KAAK,CAChC,CAAC;IAED,OAAOZ,aAAa;EACtB;;EAEA;AACF;AACA;EACEgB,sBAAsBA,CAAA,EAAmC;IACvD,OAAO,IAAI,CAACT,sBAAsB,CAAC,GAAAG,SAAQ,CAAC,CAACC,MAAM,GAAG,CAAC;EACzD;;EAEA;AACF;AACA;EACE,IAAIM,SAASA,CAAA,EAAW;IAAA,IAAAC,SAAA;IACtB,MAAMC,aAAa,GAAGlB,uBAAA,CAAAiB,SAAA,OAAI,CAAC9B,UAAU,EAAAK,IAAA,CAAAyB,SAAA,EAClChB,MAAM,IAAK,CAACA,MAAM,CAACkB,UACtB,CAAC;IAED,IAAID,aAAa,CAACR,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMU,IAAI,GAAGC,oBAAA,CAAAH,aAAa,EAAA1B,IAAA,CAAb0B,aAAa,EAAMjB,MAAM,IAAKA,MAAM,CAACqB,QAAQ,CAACF,IAAI,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE1E,OAAO,IAAI,CAACb,MAAM,GAAG,CAAC,GAAG,IAAIU,IAAI,GAAG,GAAGA,IAAI;EAC7C;AACF","ignoreList":[]}
@@ -6,21 +6,20 @@ import ProcessStatusSettingsModel from "../process/ProcessStatusSettingsModel";
6
6
  import AttributeCollection from "../attributes/AttributeCollection";
7
7
  import BaseModel from "../base/BaseModel";
8
8
  import Href from "../href/Href";
9
- import { getBasePath, HTTP_METHODS, CREATE_ACTION, UPDATE_ACTION, DELETE_ACTION } from "../../constants";
9
+ import { HTTP_METHODS, CREATE_ACTION, UPDATE_ACTION, DELETE_ACTION } from "../../constants";
10
10
  /**
11
11
  * Defines an Action. For instance an action on the tab 'books', which leads to a form
12
12
  */
13
13
  export default class ActionModel extends BaseModel {
14
- constructor(data, contributions, origin, contextPath) {
15
- super(data, contributions);
14
+ constructor(data, contributions, modelOptions) {
15
+ super(data, contributions, modelOptions);
16
16
  _defineProperty(this, "_fieldCollection", void 0);
17
17
  _defineProperty(this, "_href", void 0);
18
18
  _defineProperty(this, "_icon", void 0);
19
- _defineProperty(this, "_origin", void 0);
20
- _defineProperty(this, "_contextPath", void 0);
21
- this._fieldCollection = new AttributeCollection(this.data.fields, this.contributions.fields);
22
- this._origin = origin;
23
- this._contextPath = contextPath;
19
+ this._fieldCollection = new AttributeCollection(this.data.fields, this.contributions.fields, {
20
+ ...modelOptions,
21
+ isReadonly: false
22
+ });
24
23
  }
25
24
 
26
25
  /**
@@ -38,7 +37,10 @@ export default class ActionModel extends BaseModel {
38
37
  label: label ?? name,
39
38
  type
40
39
  };
41
- return new ActionModel(data, contributions, origin, contextPath);
40
+ return new ActionModel(data, contributions, {
41
+ origin,
42
+ contextPath
43
+ });
42
44
  }
43
45
 
44
46
  /**
@@ -47,23 +49,11 @@ export default class ActionModel extends BaseModel {
47
49
  return this.data.href == null;
48
50
  }
49
51
 
50
- /**
51
- */
52
- get origin() {
53
- return this._origin ?? "";
54
- }
55
-
56
- /**
57
- */
58
- get contextPath() {
59
- return this._contextPath ?? getBasePath();
60
- }
61
-
62
52
  /**
63
53
  * retrieve href of action
64
54
  */
65
55
  get selfhref() {
66
- return this._href ?? new Href(`${this.data.href}?${this.querystring}`, "Form", this.origin, this.contextPath);
56
+ return this._href ?? new Href(`${this.data.href}?${this.querystring}`, "Form", this.modelOptions);
67
57
  }
68
58
 
69
59
  /**
@@ -176,7 +166,7 @@ export default class ActionModel extends BaseModel {
176
166
  */
177
167
  get processStatus() {
178
168
  if (this.isProcessTask) {
179
- return new ProcessStatusSettingsModel(this.getData("processStatus", {}), this.getContribution("processTask", {}));
169
+ return new ProcessStatusSettingsModel(this.getData("processStatus", {}), this.getContribution("processTask", {}), this.modelOptions);
180
170
  }
181
171
  return null;
182
172
  }