@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
@@ -1 +1 @@
1
- {"version":3,"file":"useModelCatalog.js","names":["_useRouter","require","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","arguments","length","undefined","url","filterParameters","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","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,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,mBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,sBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,kBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,gBAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,aAAA,GAAAN,sBAAA,CAAAH,OAAA;AAEA,IAAAU,kBAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAWA;AACA;AACO,MAAMY,eAAe,GAC1BC,OAAqD,IAErD,IAAAC,oCAAiB,EAAC,cAAc,EAAE,eAAe,EAAE;EACjDC,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEC,0BAAiB;EAC9B,GAAGJ;AACL,CAAC,CAAC;;AAEJ;AACA;AADAK,OAAA,CAAAN,eAAA,GAAAA,eAAA;AAEO,MAAMO,eAAe,GAAG,SAAAA,CAC7BC,IAAY,EAGW;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,cAAc;EAAA,IAC7BT,OAAqD,GAAAS,SAAA,CAAAC,MAAA,OAAAD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CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;MACrC;MACAR,YAAY,CAACS,IAAI,CAAC,GAAGnC,GAAG,IAAI8B,KAAK,EAAE,CAAC;IACtC;EACF;EAEA,OAAOJ,YAAY,CAACxB,MAAM,GAAG,GAAGsB,GAAG,IAAIE,YAAY,CAACO,IAAI,CAAC,GAAG,CAAC,EAAE,GAAGT,GAAG;AACvE,CAAC;;AAED;AACA;AACO,MAAMY,gBAAgB,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBzB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BT,OAAqD,GAAAS,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGwB,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAO3B,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAER,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AADAK,OAAA,CAAAuC,gBAAA,GAAAA,gBAAA;AAEO,MAAMC,gBAAgB,GAAG,SAAAA,CAC9BZ,OAAqB,EAGE;EAAA,IAFvBzB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BT,OAAqD,GAAAS,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGwB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOb,eAAe,CAACb,IAAI,EAAEC,GAAG,EAAER,OAAO,CAAC;AAC5C,CAAC;AAACK,OAAA,CAAAwC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"useModelCatalog.js","names":["_useRouter","require","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","arguments","length","undefined","url","filterParameters","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","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,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,mBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,sBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,kBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,gBAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,aAAA,GAAAN,sBAAA,CAAAH,OAAA;AAEA,IAAAU,kBAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAYA;AACA;AACO,MAAMY,eAAe,GAC1BC,OAAqD,IAErD,IAAAC,oC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SAAA,MAAG,eAAe;EAAA,IAC9BT,OAAqD,GAAAS,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGwB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOb,eAAe,CAACb,IAAI,EAAEC,GAAG,EAAER,OAAO,CAAC;AAC5C,CAAC;AAACK,OAAA,CAAAwC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -31,29 +31,31 @@ const useModularUI = function (modelKey, url) {
31
31
  const dispatch = (0, _reactRedux.useDispatch)();
32
32
  const href = (0, _react.useMemo)(() => url?.toString() || "", [url]);
33
33
  const key = useKeyForHook(modelKey, href);
34
+ const modelSelector = (0, _react.useMemo)(() => state => state.modularui[key], [key]);
35
+ const model = (0, _reactRedux.useSelector)(modelSelector);
34
36
  if (url instanceof _Href.default) {
35
37
  options.origin = options.origin ?? url.origin;
36
38
  options.contextPath = options.contextPath ?? url.contextPath;
37
39
  }
38
40
  const location = (0, _reactRouter.useLocation)();
39
41
  const redirectLocation = location.state?.redirectLocation;
40
- const forceReload = redirectLocation instanceof _Href.default ? redirectLocation?.equals(href) : false;
42
+ const forceLoad = model == null || (redirectLocation instanceof _Href.default ? redirectLocation?.equals(href) : false);
41
43
  const prevOptions = (0, _react.useRef)(options);
42
44
  const prevHref = (0, _react.useRef)(href);
43
- const prevForceReload = (0, _react.useRef)(forceReload);
45
+ const prevForceLoad = (0, _react.useRef)(forceLoad);
44
46
 
45
47
  // dispatch loadModularUI
46
48
  (0, _useDeepCompareEffect.default)(() => {
47
49
  // prevent reloads when previous option had the isReload, but the new options not
48
50
  const isOldReload = prevHref.current === href && prevOptions.current.isReload && !options.isReload;
49
- const doForceReload = forceReload && !prevForceReload.current;
50
- if (href !== "" && (doForceReload || !isOldReload)) {
51
+ const doForceLoad = forceLoad && !prevForceLoad.current;
52
+ if (href !== "" && (doForceLoad || !isOldReload)) {
51
53
  dispatch((0, _ModularUIActions.loadModularUI)(key, href, options));
52
54
  }
53
55
  prevOptions.current = options;
54
56
  prevHref.current = href;
55
- prevForceReload.current = forceReload;
56
- }, [key, href, options, forceReload]);
57
+ prevForceLoad.current = forceLoad;
58
+ }, [key, href, options, forceLoad]);
57
59
  (0, _react.useEffect)(() => {
58
60
  if (options.removeOnUnmount) {
59
61
  return () => {
@@ -61,8 +63,7 @@ const useModularUI = function (modelKey, url) {
61
63
  };
62
64
  }
63
65
  }, [dispatch, key, options.removeOnUnmount]);
64
- const selector = (0, _react.useMemo)(() => state => state.modularui[key], [key]);
65
- return (0, _reactRedux.useSelector)(selector);
66
+ return model;
66
67
  };
67
68
  exports.useModularUI = useModularUI;
68
69
  //# sourceMappingURL=useModularUI.js.map
@@ -41,6 +41,9 @@ export const useModularUI = (
41
41
  const href = useMemo(() => url?.toString() || "", [url]);
42
42
  const key = useKeyForHook(modelKey, href);
43
43
 
44
+ const modelSelector = useMemo(() => (state) => state.modularui[key], [key]);
45
+ const model = useSelector(modelSelector);
46
+
44
47
  if (url instanceof Href) {
45
48
  options.origin = options.origin ?? url.origin;
46
49
  options.contextPath = options.contextPath ?? url.contextPath;
@@ -48,12 +51,13 @@ export const useModularUI = (
48
51
 
49
52
  const location = useLocation();
50
53
  const redirectLocation = location.state?.redirectLocation;
51
- const forceReload =
52
- redirectLocation instanceof Href ? redirectLocation?.equals(href) : false;
54
+ const forceLoad =
55
+ model == null ||
56
+ (redirectLocation instanceof Href ? redirectLocation?.equals(href) : false);
53
57
 
54
58
  const prevOptions = useRef(options);
55
59
  const prevHref = useRef(href);
56
- const prevForceReload = useRef(forceReload);
60
+ const prevForceLoad = useRef(forceLoad);
57
61
 
58
62
  // dispatch loadModularUI
59
63
  useDeepCompareEffect(() => {
@@ -63,16 +67,16 @@ export const useModularUI = (
63
67
  prevOptions.current.isReload &&
64
68
  !options.isReload;
65
69
 
66
- const doForceReload = forceReload && !prevForceReload.current;
70
+ const doForceLoad = forceLoad && !prevForceLoad.current;
67
71
 
68
- if (href !== "" && (doForceReload || !isOldReload)) {
72
+ if (href !== "" && (doForceLoad || !isOldReload)) {
69
73
  dispatch(loadModularUI(key, href, options));
70
74
  }
71
75
 
72
76
  prevOptions.current = options;
73
77
  prevHref.current = href;
74
- prevForceReload.current = forceReload;
75
- }, [key, href, options, forceReload]);
78
+ prevForceLoad.current = forceLoad;
79
+ }, [key, href, options, forceLoad]);
76
80
 
77
81
  useEffect(() => {
78
82
  if (options.removeOnUnmount) {
@@ -82,6 +86,5 @@ export const useModularUI = (
82
86
  }
83
87
  }, [dispatch, key, options.removeOnUnmount]);
84
88
 
85
- const selector = useMemo(() => (state) => state.modularui[key], [key]);
86
- return useSelector(selector);
89
+ return model;
87
90
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUI.js","names":["_react","require","_reactRedux","_reactRouter","_constants","_ModularUIActions","_useDeepCompareEffect","_interopRequireDefault","_useI18n","_Href","useKeyForHook","modelKey","url","locale","useLocale","useMemo","split","useModularUI","options","arguments","length","undefined","method","HTTP_METHODS","GET","removeOnUnmount","dispatch","useDispatch","href","toString","key","Href","origin","contextPath","location","useLocation","redirectLocation","state","forceReload","equals","prevOptions","useRef","prevHref","prevForceReload","useDeepCompareEffect","isOldReload","current","isReload","doForceReload","loadModularUI","useEffect","removeModelByKey","selector","modularui","useSelector","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAKA,IAAAK,qBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAEA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAF,sBAAA,CAAAN,OAAA;AAI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AACF,QAAQ,CAAC;AAC9B,CAAC;AAACG,OAAA,CAAAtC,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"file":"useModularUI.js","names":["_react","require","_reactRedux","_reactRouter","_constants","_ModularUIActions","_useDeepCompareEffect","_interopRequireDefault","_useI18n","_Href","useKeyForHook","modelKey","url","locale","useLocale","useMemo","split","useModularUI","options","arguments","length","undefined","method","HTTP_METHODS","GET","removeOnUnmount","dispatch","useDispatch","href","toString","key","modelSelector","state","modularui","model","useSelector","Href","origin","contextPath","location","useLocation","redirectLocation","forceLoad","equals","prevOptions","useRef","prevHref","prevForceLoad","useDeepCompareEffect","isOldReload","current","isReload","doForceLoad","loadModularUI","useEffect","removeModelByKey","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAKA,IAAAK,qBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAEA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAF,sBAAA,CAAAN,OAAA;AAIA;AACA;AACA,MAAMS,aAAa,GAAGA,CAACC,QAAgB,EAAEC,GAAW,KAAK;EACvD,MAAMC,MAAM,GAAG,IAAAC,kBAAS,EAAC,CAAC;EAC1B,OAAO,IAAAC,cAAO,EACZ,MAAM,GAAGJ,QAAQ,IAAIC,GAAG,CAACI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAKH,MAAM,GAAG,EACpD,CAACF,QAAQ,EAAEC,GAAG,EAAEC,MAAM,CACxB,CAAC;AACH,CAAC;;AA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QAAQ,GAAG,IAAAD,aAAM,EAACjB,IAAI,CAAC;EAC7B,MAAMmB,aAAa,GAAG,IAAAF,aAAM,EAACH,SAAS,CAAC;;EAEvC;EACA,IAAAM,6BAAoB,EAAC,MAAM;IACzB;IACA,MAAMC,WAAW,GACfH,QAAQ,CAACI,OAAO,KAAKtB,IAAI,IACzBgB,WAAW,CAACM,OAAO,CAACC,QAAQ,IAC5B,CAACjC,OAAO,CAACiC,QAAQ;IAEnB,MAAMC,WAAW,GAAGV,SAAS,IAAI,CAACK,aAAa,CAACG,OAAO;IAEvD,IAAItB,IAAI,KAAK,EAAE,KAAKwB,WAAW,IAAI,CAACH,WAAW,CAAC,EAAE;MAChDvB,QAAQ,CAAC,IAAA2B,+BAAa,EAACvB,GAAG,EAAEF,IAAI,EAAEV,OAAO,CAAC,CAAC;IAC7C;IAEA0B,WAAW,CAACM,OAAO,GAAGhC,OAAO;IAC7B4B,QAAQ,CAACI,OAAO,GAAGtB,IAAI;IACvBmB,aAAa,CAACG,OAAO,GAAGR,SAAS;EACnC,CAAC,EAAE,CAACZ,GAAG,EAAEF,IAAI,EAAEV,OAAO,EAAEwB,SAAS,CAAC,CAAC;EAEnC,IAAAY,gBAAS,EAAC,MAAM;IACd,IAAIpC,OAAO,CAACO,eAAe,EAAE;MAC3B,OAAO,MAAM;QACXC,QAAQ,CAAC,IAAA6B,kCAAgB,EAACzB,GAAG,CAAC,CAAC;MACjC,CAAC;IACH;EACF,CAAC,EAAE,CAACJ,QAAQ,EAAEI,GAAG,EAAEZ,OAAO,CAACO,eAAe,CAAC,CAAC;EAE5C,OAAOS,KAAK;AACd,CAAC;AAACsB,OAAA,CAAAvC,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -9,7 +9,6 @@ var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js
9
9
  var _react = require("react");
10
10
  var _useModularUI = require("./useModularUI");
11
11
  var _useRouter = require("./useRouter");
12
- var _exceptions = require("../exceptions");
13
12
  // Helper to create useModularUI options
14
13
  const createUseModularUIOptions = (options, href, location) => {
15
14
  var _context;
@@ -49,8 +48,7 @@ const validateModel = (model, expectedModels) => {
49
48
  if (expectedModels.length > 0) {
50
49
  const isCorrectModel = expectedModels.some(expectedModel => model.type === expectedModel);
51
50
  if (!isCorrectModel) {
52
- console.error(model, "is not of instance", expectedModels);
53
- throw new _exceptions.IllegalStateException("Resolved model has incorrect type");
51
+ console.warn(model, "is not of instance", expectedModels);
54
52
  }
55
53
  }
56
54
  };
@@ -69,7 +67,7 @@ const useModularUIBasic = function (key, href) {
69
67
  const location = (0, _useRouter.useLocation)();
70
68
  const memoizedHref = (0, _react.useMemo)(() => href.toString(), [href]);
71
69
  const useModularUIOptions = (0, _react.useMemo)(() => createUseModularUIOptions(options, memoizedHref, location), [options, memoizedHref, location]);
72
- const modularUI = (0, _useModularUI.useModularUI)(key, memoizedHref, useModularUIOptions);
70
+ const modularUI = (0, _useModularUI.useModularUI)(key, href, useModularUIOptions);
73
71
  const expectedModels = (0, _react.useMemo)(() => options.expectedModels ?? [], [options.expectedModels]);
74
72
  return (0, _react.useMemo)(() => {
75
73
  if (modularUI?.model) {
@@ -2,7 +2,7 @@
2
2
  import { useMemo } from "react";
3
3
  import { useModularUI } from "./useModularUI";
4
4
  import { useLocation } from "./useRouter";
5
- import { IllegalStateException } from "../exceptions";
5
+
6
6
  import type { ModularUIModel, Href } from "../models";
7
7
 
8
8
  export type UseModularUIBasicOptions<T: ModularUIModel> = {
@@ -59,8 +59,7 @@ const validateModel = (model: any, expectedModels: Array<string>) => {
59
59
  (expectedModel) => model.type === expectedModel,
60
60
  );
61
61
  if (!isCorrectModel) {
62
- console.error(model, "is not of instance", expectedModels);
63
- throw new IllegalStateException("Resolved model has incorrect type");
62
+ console.warn(model, "is not of instance", expectedModels);
64
63
  }
65
64
  }
66
65
  };
@@ -86,7 +85,7 @@ export const useModularUIBasic = <T: ModularUIModel>(
86
85
  [options, memoizedHref, location],
87
86
  );
88
87
 
89
- const modularUI = useModularUI(key, memoizedHref, useModularUIOptions);
88
+ const modularUI = useModularUI(key, href, useModularUIOptions);
90
89
  const expectedModels = useMemo(
91
90
  () => options.expectedModels ?? [],
92
91
  [options.expectedModels],
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIBasic.js","names":["_react","require","_useModularUI","_useRouter","_exceptions","createUseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWith","default","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","error","IllegalStateException","useModularUIBasic","key","arguments","useLocation","memoizedHref","useMemo","toString","useModularUIOptions","modularUI","useModularUI","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAYA;AACA,MAAMI,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,GAA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,EAAE,KAAK;IACvBE,MAAM,EAAEH,SAAS;IACjBI,WAAW,EAAEJ;EACf,CAAC;EAED,MAAMJ,QAAQ,GAAG,IAAA8B,sBAAW,EAAC,CAAC;EAC9B,MAAMC,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAMjC,IAAI,CAACkC,QAAQ,CAAC,CAAC,EAAE,CAAClC,IAAI,CAAC,CAAC;EAC3D,MAAMmC,mBAAmB,GAAG,IAAAF,cAAO,EACjC,MAAMnC,yBAAyB,CAACC,OAAO,EAAEiC,YAAY,EAAE/B,QAAQ,CAAC,EAChE,CAACF,OAAO,EAAEiC,YAAY,EAAE/B,QAAQ,CAClC,CAAC;EAED,MAAMmC,SAAS,GAAG,IAAAC,0BAAY,EAACR,GAAG,EAAEG,YAAY,EAAEG,mBAAmB,CAAC;EACtE,MAAMhB,cAAc,GAAG,IAAAc,cAAO,EAC5B,MAAMlC,OAAO,CAACoB,cAAc,IAAI,EAAE,EAClC,CAACpB,OAAO,CAACoB,cAAc,CACzB,CAAC;EAED,OAAO,IAAAc,cAAO,EAAC,MAAgB;IAC7B,IAAIG,SAAS,EAAElB,KAAK,EAAE;MACpBD,aAAa,CAACmB,SAAS,CAAClB,KAAK,EAAEC,cAAc,CAAC;MAC9C,OAAOiB,SAAS,CAAClB,KAAK;IACxB;IACA,OAAO,IAAI;EACb,CAAC,EAAE,CAACC,cAAc,EAAEiB,SAAS,CAAC,CAAC;AACjC,CAAC;AAACE,OAAA,CAAAV,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"useModularUIBasic.js","names":["_react","require","_useModularUI","_useRouter","createUseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWith","default","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","warn","useModularUIBasic","key","arguments","useLocation","memoizedHref","useMemo","toString","useModularUIOptions","modularUI","useModularUI","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAaA;AACA,MAAMG,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,IAAI,IAAAC,WAAA,CAAAC,OAAA,EAAAZ,QAAA,GAAAD,QAAQ,CAACc,QAAQ,EAAAC,IAAA,CAAAd,QAAA,EAAYF,IAAI,CAAC,EAAE;IAChEG,WAAW,CAACI,QAAQ,GAAG,IAAI;EAC7B;;EAEA;EACAJ,WAAW,CAACK,MAAM,GAAGT,OAAO,CAACS,MAAM,IAAIL,WAAW,CAACK,MAAM;EACzDL,WAAW,CAACM,WAAW,GAAGV,OAAO,CAACU,WAA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,EAAE,EAClC,CAACpB,OAAO,CAACoB,cAAc,CACzB,CAAC;EAED,OAAO,IAAAa,cAAO,EAAC,MAAgB;IAC7B,IAAIG,SAAS,EAAEjB,KAAK,EAAE;MACpBD,aAAa,CAACkB,SAAS,CAACjB,KAAK,EAAEC,cAAc,CAAC;MAC9C,OAAOgB,SAAS,CAACjB,KAAK;IACxB;IACA,OAAO,IAAI;EACb,CAAC,EAAE,CAACC,cAAc,EAAEgB,SAAS,CAAC,CAAC;AACjC,CAAC;AAACE,OAAA,CAAAV,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -11,6 +11,8 @@ import UserProfileModel from "../models/user/UserProfileModel";
11
11
 
12
12
  import { useModularUIBasic } from "./useModularUIBasic";
13
13
 
14
+ import type Href from "../models/href/Href";
15
+
14
16
  type HookOptions = {
15
17
  origin?: string,
16
18
  contextPath?: string,
@@ -31,7 +33,10 @@ export const useApplication = (
31
33
  /**
32
34
  * Load a tab by href
33
35
  */
34
- export const useTab = (href: string, options?: HookOptions): TabModel | null =>
36
+ export const useTab = (
37
+ href: string | Href,
38
+ options?: HookOptions,
39
+ ): TabModel | null =>
35
40
  useModularUIBasic("tab", href, {
36
41
  expectedModels: ["Tab"],
37
42
  targetModel: TabModel,
@@ -42,7 +47,7 @@ export const useTab = (href: string, options?: HookOptions): TabModel | null =>
42
47
  * Load caseview by href
43
48
  */
44
49
  export const useCaseView = (
45
- href: string,
50
+ href: string | Href,
46
51
  options?: HookOptions,
47
52
  ): CaseViewModel | null =>
48
53
  useModularUIBasic("caseview", href, {
@@ -54,7 +59,7 @@ export const useCaseView = (
54
59
  /**
55
60
  */
56
61
  export const usePanel = (
57
- href: string,
62
+ href: string | Href,
58
63
  options?: HookOptions,
59
64
  ): ListModel | GroupingPanelModel | DetailModel | null =>
60
65
  useModularUIBasic("panel", href, {
@@ -65,7 +70,7 @@ export const usePanel = (
65
70
  /**
66
71
  */
67
72
  export const useList = (
68
- href: string,
73
+ href: string | Href,
69
74
  options?: HookOptions,
70
75
  ): ListModel | null =>
71
76
  useModularUIBasic("list", href, {
@@ -77,7 +82,7 @@ export const useList = (
77
82
  /**
78
83
  */
79
84
  export const useListOrDetail = (
80
- href: string,
85
+ href: string | Href,
81
86
  options?: HookOptions,
82
87
  ): ListModel | DetailModel | null =>
83
88
  useModularUIBasic("list", href, {
@@ -89,7 +94,7 @@ export const useListOrDetail = (
89
94
  /**
90
95
  */
91
96
  export const useListDetail = (
92
- href: string,
97
+ href: string | Href,
93
98
  options?: HookOptions,
94
99
  ): ListDetailModel | null =>
95
100
  useModularUIBasic("listdetail", href, {
@@ -102,7 +107,7 @@ export const useListDetail = (
102
107
  /**
103
108
  */
104
109
  export const useGroupingPanel = (
105
- href: string,
110
+ href: string | Href,
106
111
  options?: HookOptions,
107
112
  ): GroupingPanelModel | null =>
108
113
  useModularUIBasic("groupingpanel", href, {
@@ -114,7 +119,7 @@ export const useGroupingPanel = (
114
119
  /**
115
120
  */
116
121
  export const useDetailPanel = (
117
- href: string,
122
+ href: string | Href,
118
123
  options?: HookOptions,
119
124
  ): DetailModel | null =>
120
125
  useModularUIBasic("detailpanel", href, {
@@ -126,7 +131,7 @@ export const useDetailPanel = (
126
131
  /**
127
132
  */
128
133
  export const useQuicksearch = (
129
- href: string,
134
+ href: string | Href,
130
135
  options?: HookOptions,
131
136
  ): CaseSearchModel | null =>
132
137
  useModularUIBasic("quicksearch", href, {
@@ -138,7 +143,7 @@ export const useQuicksearch = (
138
143
  /**
139
144
  */
140
145
  export const useSearch = (
141
- href: string,
146
+ href: string | Href,
142
147
  options?: HookOptions,
143
148
  ): CaseSearchModel | null =>
144
149
  useModularUIBasic("search", href, {
@@ -150,7 +155,7 @@ export const useSearch = (
150
155
  /**
151
156
  */
152
157
  export const useUserProfile = (
153
- href: string,
158
+ href: string | Href,
154
159
  options?: HookOptions,
155
160
  ): UserProfileModel | null =>
156
161
  useModularUIBasic("userprofile", href, {
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIModel.js","names":["_ApplicationModel","_interopRequireDefault","require","_CaseViewModel","_TabModel","_ListModel","_GroupingPanelModel","_DetailModel","_CaseSearchModel","_ListDetailModel","_UserProfileModel","_useModularUIBasic","useApplication","options","useModularUIBasic","expectedModels","targetModel","ApplicationModel","exports","useTab","href","TabModel","useCaseView","CaseViewModel","usePanel","useList","ListModel","useListOrDetail","DetailModel","useListDetail","ListDetailModel","forceTargetModel","useGroupingPanel","GroupingPanelModel","useDetailPanel","useQuicksearch","CaseSearchModel","useSearch","useUserProfile","UserProfileModel"],"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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","require","_CaseViewModel","_TabModel","_ListModel","_GroupingPanelModel","_DetailModel","_CaseSearchModel","_ListDetailModel","_UserProfileModel","_useModularUIBasic","useApplication","options","useModularUIBasic","expectedModels","targetModel","ApplicationModel","exports","useTab","href","TabModel","useCaseView","CaseViewModel","usePanel","useList","ListModel","useListOrDetail","DetailModel","useListDetail","ListDetailModel","forceTargetModel","useGroupingPanel","GroupingPanelModel","useDetailPanel","useQuicksearch","CaseSearchModel","useSearch","useUserProfile","UserProfileModel"],"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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AAA","ignoreList":[]}
@@ -15,7 +15,7 @@ var _ActionModel = _interopRequireDefault(require("./ActionModel"));
15
15
  * Collection of actions
16
16
  */
17
17
  class ActionCollection extends _BaseCollection.default {
18
- constructor(actions, actionsContributions, origin, contextPath) {
18
+ constructor(actions, actionsContributions, modelOptions) {
19
19
  super();
20
20
 
21
21
  // no actions gives an empty collection
@@ -26,7 +26,7 @@ class ActionCollection extends _BaseCollection.default {
26
26
  for (const actionData of actions) {
27
27
  const actionContribution = (0, _find.default)(actionsContributions).call(actionsContributions, actionContribution => actionContribution.name === actionData.name && actionContribution.type !== "service-operation");
28
28
  if (actionContribution) {
29
- actionModels.push(new _ActionModel.default(actionData, actionContribution, origin, contextPath));
29
+ actionModels.push(new _ActionModel.default(actionData, actionContribution, modelOptions));
30
30
  }
31
31
  }
32
32
  this.collection = actionModels;
@@ -1,6 +1,7 @@
1
1
  // @flow
2
2
  import BaseCollection from "../base/BaseCollection";
3
3
  import ActionModel from "./ActionModel";
4
+ import type { ModelOptions } from "../types";
4
5
 
5
6
  /**
6
7
  * Collection of actions
@@ -9,8 +10,7 @@ export default class ActionCollection extends BaseCollection<ActionModel> {
9
10
  constructor(
10
11
  actions?: Object,
11
12
  actionsContributions?: Object,
12
- origin?: string,
13
- contextPath?: string,
13
+ modelOptions?: ModelOptions,
14
14
  ) {
15
15
  super();
16
16
 
@@ -28,12 +28,7 @@ export default class ActionCollection extends BaseCollection<ActionModel> {
28
28
 
29
29
  if (actionContribution) {
30
30
  actionModels.push(
31
- new ActionModel(
32
- actionData,
33
- actionContribution,
34
- origin,
35
- contextPath,
36
- ),
31
+ new ActionModel(actionData, actionContribution, modelOptions),
37
32
  );
38
33
  }
39
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ActionCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_ActionModel","ActionCollection","BaseCollection","constructor","actions","actionsContributions","origin","contextPath","Array","isArray","collection","actionModels","actionData","actionContribution","_find","default","call","name","type","push","ActionModel","getActionByKey","key","_context","newCollection","_filter","action","first","getActionsByType","_context2","_includes","getActionsByLayoutHint","_context3","_len","arguments","length","hints","_key","layouthint","has","hasActionsByLayoutHint","routePath","_context4","enabledRoutes","isDisabled","path","_map","selfhref","join","exports"],"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,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAME,gBAAgB,SAASC,uBAAc,CAAc;EACxEC,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,GAAG,IAAAC,KAAA,CAAAC,OAAA,EAAAV,oBAAoB,EAAAW,IAAA,CAApBX,oBAAoB,EAC5CQ,kBAAkB,IACjBA,kBAAkB,CAACI,IAAI,KAAKL,UAAU,CAACK,IAAI,IAC3CJ,kBAAkB,CAACK,IAAI,KAAK,mBAChC,CAAC;QAED,IAAIL,kBAAkB,EAAE;UACtBF,YAAY,CAACQ,IAAI,CACf,IAAIC,oBAAW,CACbR,UAAU,EACVC,kBAAkB,EAClBP,MAAM,EACNC,WACF,CACF,CAAC;QACH;MACF;MAEA,IAAI,CAACG,UAAU,GAAGC,YAAY;IAChC;EACF;;EAEA;AACF;AACA;EACEU,cAAcA,CAACC,GAAW,EAAsB;IAAA,IAAAC,QAAA;IAC9C,MAAMC,aAAa,GAAG,IAAIvB,gBAAgB,CAAC,CAAC;IA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AsBA,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,GAAG,IAAAlB,OAAA,CAAAV,OAAA,EAAA2B,SAAA,OAAI,CAAChC,UAAU,EAAAM,IAAA,CAAA0B,SAAA,EAClChB,MAAM,IAAK,CAACA,MAAM,CAACkB,UACtB,CAAC;IAED,IAAID,aAAa,CAACR,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMU,IAAI,GAAG,IAAAC,IAAA,CAAA/B,OAAA,EAAA4B,aAAa,EAAA3B,IAAA,CAAb2B,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;AAACI,OAAA,CAAAlC,OAAA,GAAAd,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"ActionCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_ActionModel","ActionCollection","BaseCollection","constructor","actions","actionsContributions","modelOptions","Array","isArray","collection","actionModels","actionData","actionContribution","_find","default","call","name","type","push","ActionModel","getActionByKey","key","_context","newCollection","_filter","action","first","getActionsByType","_context2","_includes","getActionsByLayoutHint","_context3","_len","arguments","length","hints","_key","layouthint","has","hasActionsByLayoutHint","routePath","_context4","enabledRoutes","isDisabled","path","_map","selfhref","join","exports"],"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,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA;AACA;AACA;AACe,MAAME,gB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AED,IAAID,aAAa,CAACR,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMU,IAAI,GAAG,IAAAC,IAAA,CAAA/B,OAAA,EAAA4B,aAAa,EAAA3B,IAAA,CAAb2B,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;AAACI,OAAA,CAAAlC,OAAA,GAAAb,gBAAA","ignoreList":[]}
@@ -18,16 +18,15 @@ var _constants = require("../../constants");
18
18
  * Defines an Action. For instance an action on the tab 'books', which leads to a form
19
19
  */
20
20
  class ActionModel extends _BaseModel.default {
21
- constructor(data, contributions, origin, contextPath) {
22
- super(data, contributions);
21
+ constructor(data, contributions, modelOptions) {
22
+ super(data, contributions, modelOptions);
23
23
  (0, _defineProperty2.default)(this, "_fieldCollection", void 0);
24
24
  (0, _defineProperty2.default)(this, "_href", void 0);
25
25
  (0, _defineProperty2.default)(this, "_icon", void 0);
26
- (0, _defineProperty2.default)(this, "_origin", void 0);
27
- (0, _defineProperty2.default)(this, "_contextPath", void 0);
28
- this._fieldCollection = new _AttributeCollection.default(this.data.fields, this.contributions.fields);
29
- this._origin = origin;
30
- this._contextPath = contextPath;
26
+ this._fieldCollection = new _AttributeCollection.default(this.data.fields, this.contributions.fields, {
27
+ ...modelOptions,
28
+ isReadonly: false
29
+ });
31
30
  }
32
31
 
33
32
  /**
@@ -45,7 +44,10 @@ class ActionModel extends _BaseModel.default {
45
44
  label: label ?? name,
46
45
  type
47
46
  };
48
- return new ActionModel(data, contributions, origin, contextPath);
47
+ return new ActionModel(data, contributions, {
48
+ origin,
49
+ contextPath
50
+ });
49
51
  }
50
52
 
51
53
  /**
@@ -54,23 +56,11 @@ class ActionModel extends _BaseModel.default {
54
56
  return this.data.href == null;
55
57
  }
56
58
 
57
- /**
58
- */
59
- get origin() {
60
- return this._origin ?? "";
61
- }
62
-
63
- /**
64
- */
65
- get contextPath() {
66
- return this._contextPath ?? (0, _constants.getBasePath)();
67
- }
68
-
69
59
  /**
70
60
  * retrieve href of action
71
61
  */
72
62
  get selfhref() {
73
- return this._href ?? new _Href.default(`${this.data.href}?${this.querystring}`, "Form", this.origin, this.contextPath);
63
+ return this._href ?? new _Href.default(`${this.data.href}?${this.querystring}`, "Form", this.modelOptions);
74
64
  }
75
65
 
76
66
  /**
@@ -183,7 +173,7 @@ class ActionModel extends _BaseModel.default {
183
173
  */
184
174
  get processStatus() {
185
175
  if (this.isProcessTask) {
186
- return new _ProcessStatusSettingsModel.default(this.getData("processStatus", {}), this.getContribution("processTask", {}));
176
+ return new _ProcessStatusSettingsModel.default(this.getData("processStatus", {}), this.getContribution("processTask", {}), this.modelOptions);
187
177
  }
188
178
  return null;
189
179
  }