@beinformed/ui 1.57.2 → 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 (430) hide show
  1. package/CHANGELOG.md +12 -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/useModularUIBasic.js +1 -1
  8. package/esm/hooks/useModularUIBasic.js.map +1 -1
  9. package/esm/hooks/useModularUIModel.js.map +1 -1
  10. package/esm/models/actions/ActionCollection.js +2 -3
  11. package/esm/models/actions/ActionCollection.js.map +1 -1
  12. package/esm/models/actions/ActionModel.js +13 -23
  13. package/esm/models/actions/ActionModel.js.map +1 -1
  14. package/esm/models/application/ApplicationModel.js +1 -1
  15. package/esm/models/application/ApplicationModel.js.map +1 -1
  16. package/esm/models/attributes/AttributeCollection.js +6 -3
  17. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  18. package/esm/models/attributes/AttributeModel.js +3 -3
  19. package/esm/models/attributes/AttributeModel.js.map +1 -1
  20. package/esm/models/attributes/AttributeSetModel.js +7 -4
  21. package/esm/models/attributes/AttributeSetModel.js.map +1 -1
  22. package/esm/models/attributes/BooleanAttributeModel.js +6 -3
  23. package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
  24. package/esm/models/attributes/ChoiceAttributeModel.js +6 -3
  25. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  26. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +18 -14
  27. package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  28. package/esm/models/attributes/ChoiceAttributeOptionModel.js +17 -10
  29. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  30. package/esm/models/attributes/CompositeAttributeChildCollection.js +7 -7
  31. package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  32. package/esm/models/attributes/CompositeAttributeModel.js +3 -3
  33. package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
  34. package/esm/models/attributes/DatetimeAttributeModel.js +2 -2
  35. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  36. package/esm/models/attributes/StringAttributeModel.js +2 -2
  37. package/esm/models/attributes/StringAttributeModel.js.map +1 -1
  38. package/esm/models/attributes/_createAttribute.js +2 -2
  39. package/esm/models/attributes/_createAttribute.js.map +1 -1
  40. package/esm/models/base/BaseModel.js +27 -1
  41. package/esm/models/base/BaseModel.js.map +1 -1
  42. package/esm/models/base/ResourceModel.js +3 -23
  43. package/esm/models/base/ResourceModel.js.map +1 -1
  44. package/esm/models/caseview/CaseViewModel.js +1 -1
  45. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  46. package/esm/models/concepts/ConceptDetailModel.js +2 -2
  47. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  48. package/esm/models/concepts/ConceptIndexModel.js +2 -2
  49. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  50. package/esm/models/concepts/ConceptLinkModel.js +4 -10
  51. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  52. package/esm/models/concepts/ConceptRelationCollection.js +11 -4
  53. package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
  54. package/esm/models/concepts/ConceptRelationModel.js +8 -1
  55. package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
  56. package/esm/models/concepts/SourceReferenceCollection.js +2 -4
  57. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  58. package/esm/models/concepts/SourceReferenceModel.js +9 -10
  59. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  60. package/esm/models/content/ContentIndexModel.js +2 -2
  61. package/esm/models/content/ContentIndexModel.js.map +1 -1
  62. package/esm/models/content/ContentLinkModel.js +4 -11
  63. package/esm/models/content/ContentLinkModel.js.map +1 -1
  64. package/esm/models/content/ContentModel.js +2 -2
  65. package/esm/models/content/ContentModel.js.map +1 -1
  66. package/esm/models/content/ContentTOCModel.js +7 -7
  67. package/esm/models/content/ContentTOCModel.js.map +1 -1
  68. package/esm/models/content/SectionModel.js +6 -12
  69. package/esm/models/content/SectionModel.js.map +1 -1
  70. package/esm/models/detail/DetailModel.js +9 -3
  71. package/esm/models/detail/DetailModel.js.map +1 -1
  72. package/esm/models/error/ErrorResponse.js +8 -10
  73. package/esm/models/error/ErrorResponse.js.map +1 -1
  74. package/esm/models/filters/AssignmentFilterModel.js +2 -2
  75. package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
  76. package/esm/models/filters/BaseFilterModel.js +3 -3
  77. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  78. package/esm/models/filters/ConceptIndexFilterModel.js +2 -3
  79. package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
  80. package/esm/models/filters/FilterCollection.js +8 -7
  81. package/esm/models/filters/FilterCollection.js.map +1 -1
  82. package/esm/models/filters/StringFilterModel.js +2 -2
  83. package/esm/models/filters/StringFilterModel.js.map +1 -1
  84. package/esm/models/form/FormModel.js +4 -4
  85. package/esm/models/form/FormModel.js.map +1 -1
  86. package/esm/models/form/FormObjectModel.js +7 -4
  87. package/esm/models/form/FormObjectModel.js.map +1 -1
  88. package/esm/models/grouping/GroupingModel.js +10 -7
  89. package/esm/models/grouping/GroupingModel.js.map +1 -1
  90. package/esm/models/href/Href.js +9 -8
  91. package/esm/models/href/Href.js.map +1 -1
  92. package/esm/models/links/LinkCollection.js +2 -3
  93. package/esm/models/links/LinkCollection.js.map +1 -1
  94. package/esm/models/links/LinkModel.js +7 -7
  95. package/esm/models/links/LinkModel.js.map +1 -1
  96. package/esm/models/list/ListDetailModel.js +1 -1
  97. package/esm/models/list/ListDetailModel.js.map +1 -1
  98. package/esm/models/list/ListItemCollection.js +1 -1
  99. package/esm/models/list/ListItemCollection.js.map +1 -1
  100. package/esm/models/list/ListItemModel.js +3 -3
  101. package/esm/models/list/ListItemModel.js.map +1 -1
  102. package/esm/models/list/ListModel.js +3 -3
  103. package/esm/models/list/ListModel.js.map +1 -1
  104. package/esm/models/lookup/LookupOptionCollection.js +5 -2
  105. package/esm/models/lookup/LookupOptionCollection.js.map +1 -1
  106. package/esm/models/lookup/LookupOptionsModel.js +2 -2
  107. package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
  108. package/esm/models/panels/GroupingPanelModel.js +1 -1
  109. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  110. package/esm/models/tab/TabModel.js +2 -2
  111. package/esm/models/tab/TabModel.js.map +1 -1
  112. package/esm/models/taskgroup/TaskGroupModel.js +4 -5
  113. package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
  114. package/esm/models/types.js.map +1 -1
  115. package/esm/models/user/UserProfileModel.js +4 -1
  116. package/esm/models/user/UserProfileModel.js.map +1 -1
  117. package/esm/modularui/CaptchaRequest.js +3 -3
  118. package/esm/modularui/CaptchaRequest.js.map +1 -1
  119. package/esm/modularui/ModularUIRequest.js +8 -5
  120. package/esm/modularui/ModularUIRequest.js.map +1 -1
  121. package/esm/modularui/ModularUIResponse.js +12 -3
  122. package/esm/modularui/ModularUIResponse.js.map +1 -1
  123. package/esm/modularui/UploadRequest.js +3 -3
  124. package/esm/modularui/UploadRequest.js.map +1 -1
  125. package/esm/react-client/client.js +3 -3
  126. package/esm/react-client/client.js.map +1 -1
  127. package/esm/react-server/renderSSRComplete.js +2 -2
  128. package/esm/react-server/renderSSRComplete.js.map +1 -1
  129. package/esm/react-server/renderSSRMinimal.js +2 -2
  130. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  131. package/esm/redux/_modularui/ModularUIActions.js +8 -2
  132. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  133. package/esm/redux/_modularui/ModularUIUtils.js +8 -11
  134. package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
  135. package/esm/utils/browser/Cookies.js +3 -3
  136. package/esm/utils/browser/Cookies.js.map +1 -1
  137. package/esm/utils/helpers/createHref.js +23 -3
  138. package/esm/utils/helpers/createHref.js.map +1 -1
  139. package/esm/utils/helpers/repositoryResource.js +2 -2
  140. package/esm/utils/helpers/repositoryResource.js.map +1 -1
  141. package/lib/constants/Settings.js +18 -8
  142. package/lib/constants/Settings.js.flow +16 -6
  143. package/lib/constants/Settings.js.map +1 -1
  144. package/lib/hooks/useAuthentication.js +2 -2
  145. package/lib/hooks/useAuthentication.js.flow +3 -3
  146. package/lib/hooks/useAuthentication.js.map +1 -1
  147. package/lib/hooks/useModelCatalog.js.flow +7 -6
  148. package/lib/hooks/useModelCatalog.js.map +1 -1
  149. package/lib/hooks/useModularUIBasic.js +1 -1
  150. package/lib/hooks/useModularUIBasic.js.flow +1 -1
  151. package/lib/hooks/useModularUIBasic.js.map +1 -1
  152. package/lib/hooks/useModularUIModel.js.flow +16 -11
  153. package/lib/hooks/useModularUIModel.js.map +1 -1
  154. package/lib/models/actions/ActionCollection.js +2 -2
  155. package/lib/models/actions/ActionCollection.js.flow +3 -8
  156. package/lib/models/actions/ActionCollection.js.map +1 -1
  157. package/lib/models/actions/ActionModel.js +12 -22
  158. package/lib/models/actions/ActionModel.js.flow +7 -24
  159. package/lib/models/actions/ActionModel.js.map +1 -1
  160. package/lib/models/application/ApplicationModel.js +1 -1
  161. package/lib/models/application/ApplicationModel.js.flow +1 -2
  162. package/lib/models/application/ApplicationModel.js.map +1 -1
  163. package/lib/models/attributes/AttributeCollection.js +6 -3
  164. package/lib/models/attributes/AttributeCollection.js.flow +12 -4
  165. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  166. package/lib/models/attributes/AttributeModel.js +3 -3
  167. package/lib/models/attributes/AttributeModel.js.flow +8 -2
  168. package/lib/models/attributes/AttributeModel.js.map +1 -1
  169. package/lib/models/attributes/AttributeSetModel.js +7 -3
  170. package/lib/models/attributes/AttributeSetModel.js.flow +11 -3
  171. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  172. package/lib/models/attributes/BooleanAttributeModel.js +6 -3
  173. package/lib/models/attributes/BooleanAttributeModel.js.flow +8 -4
  174. package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
  175. package/lib/models/attributes/ChoiceAttributeModel.js +6 -3
  176. package/lib/models/attributes/ChoiceAttributeModel.js.flow +13 -4
  177. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  178. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +18 -13
  179. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +30 -28
  180. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  181. package/lib/models/attributes/ChoiceAttributeOptionModel.js +17 -10
  182. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +30 -11
  183. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  184. package/lib/models/attributes/CompositeAttributeChildCollection.js +7 -7
  185. package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +8 -1
  186. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  187. package/lib/models/attributes/CompositeAttributeModel.js +3 -3
  188. package/lib/models/attributes/CompositeAttributeModel.js.flow +8 -3
  189. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  190. package/lib/models/attributes/DatetimeAttributeModel.js +2 -2
  191. package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -2
  192. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  193. package/lib/models/attributes/StringAttributeModel.js +2 -2
  194. package/lib/models/attributes/StringAttributeModel.js.flow +7 -3
  195. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  196. package/lib/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js.flow +1 -1
  197. package/lib/models/attributes/_createAttribute.js +2 -2
  198. package/lib/models/attributes/_createAttribute.js.flow +3 -2
  199. package/lib/models/attributes/_createAttribute.js.map +1 -1
  200. package/lib/models/base/BaseModel.js +27 -1
  201. package/lib/models/base/BaseModel.js.flow +31 -1
  202. package/lib/models/base/BaseModel.js.map +1 -1
  203. package/lib/models/base/ResourceModel.js +3 -22
  204. package/lib/models/base/ResourceModel.js.flow +6 -23
  205. package/lib/models/base/ResourceModel.js.map +1 -1
  206. package/lib/models/base/__tests__/BaseModel.spec.js.flow +4 -0
  207. package/lib/models/caseview/CaseViewModel.js +1 -1
  208. package/lib/models/caseview/CaseViewModel.js.flow +1 -2
  209. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  210. package/lib/models/concepts/ConceptDetailModel.js +2 -2
  211. package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
  212. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  213. package/lib/models/concepts/ConceptIndexModel.js +2 -2
  214. package/lib/models/concepts/ConceptIndexModel.js.flow +9 -6
  215. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  216. package/lib/models/concepts/ConceptLinkModel.js +4 -10
  217. package/lib/models/concepts/ConceptLinkModel.js.flow +15 -12
  218. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  219. package/lib/models/concepts/ConceptRelationCollection.js +11 -4
  220. package/lib/models/concepts/ConceptRelationCollection.js.flow +17 -3
  221. package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
  222. package/lib/models/concepts/ConceptRelationModel.js +8 -1
  223. package/lib/models/concepts/ConceptRelationModel.js.flow +18 -2
  224. package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
  225. package/lib/models/concepts/SourceReferenceCollection.js +2 -3
  226. package/lib/models/concepts/SourceReferenceCollection.js.flow +3 -8
  227. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  228. package/lib/models/concepts/SourceReferenceModel.js +8 -8
  229. package/lib/models/concepts/SourceReferenceModel.js.flow +10 -11
  230. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  231. package/lib/models/content/ContentIndexModel.js +2 -2
  232. package/lib/models/content/ContentIndexModel.js.flow +10 -5
  233. package/lib/models/content/ContentIndexModel.js.map +1 -1
  234. package/lib/models/content/ContentLinkModel.js +4 -10
  235. package/lib/models/content/ContentLinkModel.js.flow +10 -13
  236. package/lib/models/content/ContentLinkModel.js.map +1 -1
  237. package/lib/models/content/ContentModel.js +2 -2
  238. package/lib/models/content/ContentModel.js.flow +6 -1
  239. package/lib/models/content/ContentModel.js.map +1 -1
  240. package/lib/models/content/ContentTOCModel.js +7 -7
  241. package/lib/models/content/ContentTOCModel.js.flow +19 -11
  242. package/lib/models/content/ContentTOCModel.js.map +1 -1
  243. package/lib/models/content/SectionModel.js +6 -11
  244. package/lib/models/content/SectionModel.js.flow +9 -21
  245. package/lib/models/content/SectionModel.js.map +1 -1
  246. package/lib/models/detail/DetailModel.js +9 -3
  247. package/lib/models/detail/DetailModel.js.flow +3 -4
  248. package/lib/models/detail/DetailModel.js.map +1 -1
  249. package/lib/models/error/ErrorResponse.js +7 -9
  250. package/lib/models/error/ErrorResponse.js.flow +9 -20
  251. package/lib/models/error/ErrorResponse.js.map +1 -1
  252. package/lib/models/filters/AssignmentFilterModel.js +2 -2
  253. package/lib/models/filters/AssignmentFilterModel.js.flow +7 -3
  254. package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
  255. package/lib/models/filters/BaseFilterModel.js +3 -3
  256. package/lib/models/filters/BaseFilterModel.js.flow +16 -7
  257. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  258. package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
  259. package/lib/models/filters/ConceptIndexFilterModel.js.flow +8 -2
  260. package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
  261. package/lib/models/filters/FilterCollection.js +8 -7
  262. package/lib/models/filters/FilterCollection.js.flow +13 -7
  263. package/lib/models/filters/FilterCollection.js.map +1 -1
  264. package/lib/models/filters/StringFilterModel.js +2 -2
  265. package/lib/models/filters/StringFilterModel.js.flow +7 -3
  266. package/lib/models/filters/StringFilterModel.js.map +1 -1
  267. package/lib/models/form/FormModel.js +4 -4
  268. package/lib/models/form/FormModel.js.flow +8 -2
  269. package/lib/models/form/FormModel.js.map +1 -1
  270. package/lib/models/form/FormObjectModel.js +7 -4
  271. package/lib/models/form/FormObjectModel.js.flow +17 -4
  272. package/lib/models/form/FormObjectModel.js.map +1 -1
  273. package/lib/models/grouping/GroupingModel.js +10 -7
  274. package/lib/models/grouping/GroupingModel.js.flow +21 -5
  275. package/lib/models/grouping/GroupingModel.js.map +1 -1
  276. package/lib/models/href/Href.js +8 -7
  277. package/lib/models/href/Href.js.flow +17 -10
  278. package/lib/models/href/Href.js.map +1 -1
  279. package/lib/models/href/__tests__/Href.spec.js.flow +5 -8
  280. package/lib/models/links/LinkCollection.js +2 -3
  281. package/lib/models/links/LinkCollection.js.flow +3 -3
  282. package/lib/models/links/LinkCollection.js.map +1 -1
  283. package/lib/models/links/LinkModel.js +7 -7
  284. package/lib/models/links/LinkModel.js.flow +8 -15
  285. package/lib/models/links/LinkModel.js.map +1 -1
  286. package/lib/models/list/ListDetailModel.js +1 -1
  287. package/lib/models/list/ListDetailModel.js.flow +6 -1
  288. package/lib/models/list/ListDetailModel.js.map +1 -1
  289. package/lib/models/list/ListItemCollection.js +1 -1
  290. package/lib/models/list/ListItemCollection.js.flow +1 -2
  291. package/lib/models/list/ListItemCollection.js.map +1 -1
  292. package/lib/models/list/ListItemModel.js +3 -3
  293. package/lib/models/list/ListItemModel.js.flow +4 -4
  294. package/lib/models/list/ListItemModel.js.map +1 -1
  295. package/lib/models/list/ListModel.js +3 -3
  296. package/lib/models/list/ListModel.js.flow +12 -8
  297. package/lib/models/list/ListModel.js.map +1 -1
  298. package/lib/models/lookup/LookupOptionCollection.js +5 -1
  299. package/lib/models/lookup/LookupOptionCollection.js.flow +17 -6
  300. package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
  301. package/lib/models/lookup/LookupOptionsModel.js +2 -2
  302. package/lib/models/lookup/LookupOptionsModel.js.flow +2 -0
  303. package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
  304. package/lib/models/panels/GroupingPanelModel.js +1 -1
  305. package/lib/models/panels/GroupingPanelModel.js.flow +1 -2
  306. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  307. package/lib/models/tab/TabModel.js +2 -2
  308. package/lib/models/tab/TabModel.js.flow +2 -4
  309. package/lib/models/tab/TabModel.js.map +1 -1
  310. package/lib/models/taskgroup/TaskGroupModel.js +4 -4
  311. package/lib/models/taskgroup/TaskGroupModel.js.flow +5 -6
  312. package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
  313. package/lib/models/types.js.flow +5 -0
  314. package/lib/models/types.js.map +1 -1
  315. package/lib/models/user/UserProfileModel.js +4 -1
  316. package/lib/models/user/UserProfileModel.js.flow +1 -0
  317. package/lib/models/user/UserProfileModel.js.map +1 -1
  318. package/lib/modularui/CaptchaRequest.js +2 -2
  319. package/lib/modularui/CaptchaRequest.js.flow +7 -3
  320. package/lib/modularui/CaptchaRequest.js.map +1 -1
  321. package/lib/modularui/ModularUIRequest.js +7 -4
  322. package/lib/modularui/ModularUIRequest.js.flow +8 -5
  323. package/lib/modularui/ModularUIRequest.js.map +1 -1
  324. package/lib/modularui/ModularUIResponse.js +11 -2
  325. package/lib/modularui/ModularUIResponse.js.flow +13 -3
  326. package/lib/modularui/ModularUIResponse.js.map +1 -1
  327. package/lib/modularui/UploadRequest.js +2 -2
  328. package/lib/modularui/UploadRequest.js.flow +7 -3
  329. package/lib/modularui/UploadRequest.js.map +1 -1
  330. package/lib/react-client/client.js +2 -2
  331. package/lib/react-client/client.js.flow +7 -3
  332. package/lib/react-client/client.js.map +1 -1
  333. package/lib/react-server/renderSSRComplete.js +1 -1
  334. package/lib/react-server/renderSSRComplete.js.flow +2 -2
  335. package/lib/react-server/renderSSRComplete.js.map +1 -1
  336. package/lib/react-server/renderSSRMinimal.js +1 -1
  337. package/lib/react-server/renderSSRMinimal.js.flow +2 -2
  338. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  339. package/lib/redux/_modularui/ModularUIActions.js +8 -2
  340. package/lib/redux/_modularui/ModularUIActions.js.flow +8 -7
  341. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  342. package/lib/redux/_modularui/ModularUIUtils.js +8 -11
  343. package/lib/redux/_modularui/ModularUIUtils.js.flow +13 -14
  344. package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
  345. package/lib/utils/browser/Cookies.js +2 -2
  346. package/lib/utils/browser/Cookies.js.flow +3 -3
  347. package/lib/utils/browser/Cookies.js.map +1 -1
  348. package/lib/utils/helpers/__tests__/createHref.spec.js.flow +13 -8
  349. package/lib/utils/helpers/createHref.js +23 -3
  350. package/lib/utils/helpers/createHref.js.flow +37 -8
  351. package/lib/utils/helpers/createHref.js.map +1 -1
  352. package/lib/utils/helpers/repositoryResource.js +1 -1
  353. package/lib/utils/helpers/repositoryResource.js.flow +2 -2
  354. package/lib/utils/helpers/repositoryResource.js.map +1 -1
  355. package/package.json +4 -4
  356. package/src/constants/Settings.js +16 -6
  357. package/src/hooks/useAuthentication.js +3 -3
  358. package/src/hooks/useModelCatalog.js +7 -6
  359. package/src/hooks/useModularUIBasic.js +1 -1
  360. package/src/hooks/useModularUIModel.js +16 -11
  361. package/src/models/actions/ActionCollection.js +3 -8
  362. package/src/models/actions/ActionModel.js +7 -24
  363. package/src/models/application/ApplicationModel.js +1 -2
  364. package/src/models/attributes/AttributeCollection.js +12 -4
  365. package/src/models/attributes/AttributeModel.js +8 -2
  366. package/src/models/attributes/AttributeSetModel.js +11 -3
  367. package/src/models/attributes/BooleanAttributeModel.js +8 -4
  368. package/src/models/attributes/ChoiceAttributeModel.js +13 -4
  369. package/src/models/attributes/ChoiceAttributeOptionCollection.js +30 -28
  370. package/src/models/attributes/ChoiceAttributeOptionModel.js +30 -11
  371. package/src/models/attributes/CompositeAttributeChildCollection.js +8 -1
  372. package/src/models/attributes/CompositeAttributeModel.js +8 -3
  373. package/src/models/attributes/DatetimeAttributeModel.js +7 -2
  374. package/src/models/attributes/StringAttributeModel.js +7 -3
  375. package/src/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js +1 -1
  376. package/src/models/attributes/_createAttribute.js +3 -2
  377. package/src/models/base/BaseModel.js +31 -1
  378. package/src/models/base/ResourceModel.js +6 -23
  379. package/src/models/base/__tests__/BaseModel.spec.js +4 -0
  380. package/src/models/caseview/CaseViewModel.js +1 -2
  381. package/src/models/concepts/ConceptDetailModel.js +2 -2
  382. package/src/models/concepts/ConceptIndexModel.js +9 -6
  383. package/src/models/concepts/ConceptLinkModel.js +15 -12
  384. package/src/models/concepts/ConceptRelationCollection.js +17 -3
  385. package/src/models/concepts/ConceptRelationModel.js +18 -2
  386. package/src/models/concepts/SourceReferenceCollection.js +3 -8
  387. package/src/models/concepts/SourceReferenceModel.js +10 -11
  388. package/src/models/content/ContentIndexModel.js +10 -5
  389. package/src/models/content/ContentLinkModel.js +10 -13
  390. package/src/models/content/ContentModel.js +6 -1
  391. package/src/models/content/ContentTOCModel.js +19 -11
  392. package/src/models/content/SectionModel.js +9 -21
  393. package/src/models/detail/DetailModel.js +3 -4
  394. package/src/models/error/ErrorResponse.js +9 -20
  395. package/src/models/filters/AssignmentFilterModel.js +7 -3
  396. package/src/models/filters/BaseFilterModel.js +16 -7
  397. package/src/models/filters/ConceptIndexFilterModel.js +8 -2
  398. package/src/models/filters/FilterCollection.js +13 -7
  399. package/src/models/filters/StringFilterModel.js +7 -3
  400. package/src/models/form/FormModel.js +8 -2
  401. package/src/models/form/FormObjectModel.js +17 -4
  402. package/src/models/grouping/GroupingModel.js +21 -5
  403. package/src/models/href/Href.js +17 -10
  404. package/src/models/href/__tests__/Href.spec.js +5 -8
  405. package/src/models/links/LinkCollection.js +3 -3
  406. package/src/models/links/LinkModel.js +8 -15
  407. package/src/models/list/ListDetailModel.js +6 -1
  408. package/src/models/list/ListItemCollection.js +1 -2
  409. package/src/models/list/ListItemModel.js +4 -4
  410. package/src/models/list/ListModel.js +12 -8
  411. package/src/models/lookup/LookupOptionCollection.js +17 -6
  412. package/src/models/lookup/LookupOptionsModel.js +2 -0
  413. package/src/models/panels/GroupingPanelModel.js +1 -2
  414. package/src/models/tab/TabModel.js +2 -4
  415. package/src/models/taskgroup/TaskGroupModel.js +5 -6
  416. package/src/models/types.js +5 -0
  417. package/src/models/user/UserProfileModel.js +1 -0
  418. package/src/modularui/CaptchaRequest.js +7 -3
  419. package/src/modularui/ModularUIRequest.js +8 -5
  420. package/src/modularui/ModularUIResponse.js +13 -3
  421. package/src/modularui/UploadRequest.js +7 -3
  422. package/src/react-client/client.js +7 -3
  423. package/src/react-server/renderSSRComplete.js +2 -2
  424. package/src/react-server/renderSSRMinimal.js +2 -2
  425. package/src/redux/_modularui/ModularUIActions.js +8 -7
  426. package/src/redux/_modularui/ModularUIUtils.js +13 -14
  427. package/src/utils/browser/Cookies.js +3 -3
  428. package/src/utils/helpers/__tests__/createHref.spec.js +13 -8
  429. package/src/utils/helpers/createHref.js +37 -8
  430. package/src/utils/helpers/repositoryResource.js +2 -2
@@ -2,8 +2,7 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
2
  import { createHashFromHref } from "../../utils/helpers/createHash";
3
3
  import ContentLinkModel from "../content/ContentLinkModel";
4
4
  import Href from "../href/Href";
5
- import { getBasePath } from "../../constants";
6
-
5
+ import { getBasePathModularUI } from "../../constants";
7
6
  /**
8
7
  */
9
8
  class SourceReferenceModel {
@@ -11,16 +10,16 @@ class SourceReferenceModel {
11
10
  */
12
11
  constructor(sourceReference) {
13
12
  let entryDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
14
- let origin = arguments.length > 2 ? arguments[2] : undefined;
15
- let contextPath = arguments.length > 3 ? arguments[3] : undefined;
13
+ let modelOptions = arguments.length > 2 ? arguments[2] : undefined;
16
14
  _defineProperty(this, "_sourceReference", void 0);
17
15
  _defineProperty(this, "_entryDate", void 0);
18
- _defineProperty(this, "_origin", "");
19
- _defineProperty(this, "_contextPath", getBasePath());
16
+ _defineProperty(this, "_modelOptions", void 0);
20
17
  this._sourceReference = sourceReference;
21
18
  this._entryDate = entryDate;
22
- this._origin = origin || "";
23
- this._contextPath = contextPath || getBasePath();
19
+ this._modelOptions = modelOptions || {
20
+ origin: "",
21
+ contextPath: getBasePathModularUI()
22
+ };
24
23
  }
25
24
 
26
25
  /**
@@ -30,13 +29,13 @@ class SourceReferenceModel {
30
29
  return new ContentLinkModel({
31
30
  ...this._sourceReference,
32
31
  section
33
- }, this._entryDate, this._origin, this._contextPath);
32
+ }, this._entryDate, this._modelOptions);
34
33
  }
35
34
 
36
35
  /**
37
36
  */
38
37
  get selfhref() {
39
- return new Href(this._sourceReference._links.self.href, "SourceReference", this._origin, this._contextPath);
38
+ return new Href(this._sourceReference._links.self.href, "SourceReference", this._modelOptions);
40
39
  }
41
40
 
42
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePath","SourceReferenceModel","constructor","sourceReference","entryDate","arguments","length","undefined","origin","contextPath","_defineProperty","_sourceReference","_entryDate","_origin","_contextPath","link","section","_links","self","href","replace","content","selfhref","type","label","sourceLabel","referenceHash"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePath } from \"../../constants\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n origin?: string,\n contextPath?: string,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section = this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._origin,\n this._contextPath,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return new Href(\n this._sourceReference._links.self.href,\n \"SourceReference\",\n this._origin,\n this._contextPath,\n );\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA,MAAMC,oBAAoB,CAAC;EAMzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EAIvB;IAAA,IAHAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,MAAe,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAA,IACfE,WAAoB,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAAG,eAAA;IAAAA,eAAA;IAAAA,eAAA,kBATJ,EAAE;IAAAA,eAAA,uBACGV,WAAW,CAAC,CAAC;IAUlC,IAAI,CAACW,gBAAgB,GAAGR,eAAe;IACvC,IAAI,CAACS,UAAU,GAAGR,SAAS;IAC3B,IAAI,CAACS,OAAO,GAAGL,MAAM,IAAI,EAAE;IAC3B,IAAI,CAACM,YAAY,GAAGL,WAAW,IAAIT,WAAW,CAAC,CAAC;EAClD;;EAEA;AACF;EACE,IAAIe,IAAIA,CAAA,EAAqB;IAC3B,MAAMC,OAAO,GAAG,IAAI,CAACL,gBAAgB,CAACM,MAAM,CAACC,IAAI,CAACC,IAAI,CAACC,OAAO,CAC5D,GAAG,IAAI,CAACT,gBAAgB,CAACM,MAAM,CAACI,OAAO,CAACF,IAAI,GAAG,EAC/C,EACF,CAAC;IAED,OAAO,IAAIrB,gBAAgB,CACzB;MACE,GAAG,IAAI,CAACa,gBAAgB;MACxBK;IACF,CAAC,EACD,IAAI,CAACJ,UAAU,EACf,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIQ,QAAQA,CAAA,EAAS;IACnB,OAAO,IAAIvB,IAAI,CACb,IAAI,CAACY,gBAAgB,CAACM,MAAM,CAACC,IAAI,CAACC,IAAI,EACtC,iBAAiB,EACjB,IAAI,CAACN,OAAO,EACZ,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIS,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACZ,gBAAgB,CAACY,IAAI;EACnC;;EAEA;AACF;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACb,gBAAgB,CAACa,KAAK;EACpC;;EAEA;AACF;EACE,IAAIC,WAAWA,CAAA,EAAW;IACxB,OAAO,IAAI,CAACd,gBAAgB,CAACc,WAAW;EAC1C;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAW;IAC1B,OAAO7B,kBAAkB,CAAC,IAAI,CAACyB,QAAQ,CAAC;EAC1C;AACF;AAEA,eAAerB,oBAAoB","ignoreList":[]}
1
+ {"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePathModularUI","SourceReferenceModel","constructor","sourceReference","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_sourceReference","_entryDate","_modelOptions","origin","contextPath","link","section","_links","self","href","replace","content","selfhref","type","label","sourceLabel","referenceHash"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section = this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return new Href(\n this._sourceReference._links.self.href,\n \"SourceReference\",\n this._modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SAASC,oBAAoB,QAAQ,iBAAiB;AAGtD;AACA;AACA,MAAMC,oBAAoB,CAAC;EAKzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EAGvB;IAAA,IAFAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,YAA2B,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAAE,eAAA;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ContentIndexModel extends ResourceModel {
21
21
  this._filterCollection = new FilterCollection(_filterInstanceProperty(this.data), {
22
22
  filter: _filterInstanceProperty(this.contributions),
23
23
  dynamicschema: this.data.dynamicschema
24
- });
24
+ }, this.modelOptions);
25
25
  this._content = new ResourceCollection();
26
- this._content.collection = this.data._embedded ? _mapInstanceProperty(_context = this.data._embedded.results).call(_context, content => new ContentLinkModel(content.content)) : [];
26
+ this._content.collection = this.data._embedded ? _mapInstanceProperty(_context = this.data._embedded.results).call(_context, content => new ContentLinkModel(content.content, null, this.modelOptions)) : [];
27
27
  }
28
28
 
29
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ContentIndexModel.js","names":["ResourceModel","ResourceCollection","FilterCollection","ContentLinkModel","Href","ChoiceAttributeModel","ContentIndexModel","constructor","modularuiResponse","_context","_defineProperty","_filterCollection","_filterInstanceProperty","data","filter","contributions","dynamicschema","_content","collection","_embedded","_mapInstanceProperty","results","call","content","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","hasIndexFilter","filterAttribute","attribute","options","length","hasFiltersSet","some","isActive","hasNoFiltersSet","getFirstCharHref","firstChar","_context2","option","code","addParameter"],"sources":["../../../src/models/content/ContentIndexModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport ChoiceAttributeModel from \"../attributes/ChoiceAttributeModel\";\n\nimport type { FilterType, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Get Index of concepts, to filter model catalog\n */\nexport default class ContentIndexModel extends ResourceModel {\n _filterCollection: FilterCollection;\n _content: ResourceCollection<ContentLinkModel>;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._filterCollection = new FilterCollection(this.data.filter, {\n filter: this.contributions.filter,\n dynamicschema: this.data.dynamicschema,\n });\n\n this._content = new ResourceCollection();\n this._content.collection = this.data._embedded\n ? this.data._embedded.results.map(\n (content) => new ContentLinkModel(content.content),\n )\n : [];\n }\n\n /**\n */\n get type(): string {\n return \"ContentIndex\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentIndexModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentSearch\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.items.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this.items.setChildModels(models, errors);\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = this.selflink.href;\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\");\n }\n\n /**\n * Retrieve filters of conceptindex model\n */\n get filterCollection(): FilterCollection {\n return this._filterCollection;\n }\n\n /**\n * Get index filter\n */\n get indexfilter(): FilterType | null {\n return this._filterCollection.getFilterByAttributeKey(\"index\");\n }\n\n /**\n * Retrieve content collection\n */\n get items(): ResourceCollection<ContentLinkModel> {\n return this._content;\n }\n\n /**\n */\n hasIndexFilter(): boolean {\n const filterAttribute = this.indexfilter?.attribute;\n\n return (\n filterAttribute instanceof ChoiceAttributeModel &&\n filterAttribute.options.length > 0\n );\n }\n\n /**\n */\n hasFiltersSet(): boolean {\n return this.filterCollection.some((filter) => filter.isActive());\n }\n\n /**\n */\n hasNoFiltersSet(): boolean {\n return !this.hasFiltersSet();\n }\n\n /**\n */\n getFirstCharHref(): Href {\n const filterAttribute = this.indexfilter?.attribute;\n\n let firstChar = \"#\";\n if (filterAttribute instanceof ChoiceAttributeModel) {\n firstChar = filterAttribute.options.filter(\n (option) => option.code !== \"0\",\n )[0].code;\n }\n\n return new Href(this.selfhref).addParameter(\"index\", firstChar);\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,oBAAoB,MAAM,oCAAoC;AAOrE;AACA;AACA;AACA,eAAe,MAAMC,iBAAiB,SAASN,aAAa,CAAC;EAI3D;AACF;EACEO,WAAWA,CAACC,iBAAoC,EAAE;IAAA,IAAAC,QAAA;IAChD,KAAK,CAACD,iBAAiB,CAAC;IAACE,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIT,gBAAgB,CAAAU,uBAAA,CAAC,IAAI,CAACC,IAAI,GAAS;MAC9DC,MAAM,EAAAF,uBAAA,CAAE,IAAI,CAACG,aAAa,CAAO;MACjCC,aAAa,EAAE,IAAI,CAACH,IAAI,CAACG;IAC3B,CAAC,CAAC;IAEF,IAAI,CAACC,QAAQ,GAAG,IAAIhB,kBAAkB,CAAC,CAAC;IACxC,IAAI,CAACgB,QAAQ,CAACC,UAAU,GAAG,IAAI,CAACL,IAAI,CAACM,SAAS,GAC1CC,oBAAA,CAAAX,QAAA,OAAI,CAACI,IAAI,CAACM,SAAS,CAACE,OAAO,EAAAC,IAAA,CAAAb,QAAA,EACxBc,OAAO,IAAK,IAAIpB,gBAAgB,CAACoB,OAAO,CAACA,OAAO,CACnD,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAIC,IAAIA,C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IAAI,CAACnC,iBAAiB,CAACoC,uBAAuB,CAAC,OAAO,CAAC;EAChE;;EAEA;AACF;AACA;EACE,IAAIlB,KAAKA,CAAA,EAAyC;IAChD,OAAO,IAAI,CAACZ,QAAQ;EACtB;;EAEA;AACF;EACE+B,cAAcA,CAAA,EAAY;IACxB,MAAMC,eAAe,GAAG,IAAI,CAACH,WAAW,EAAEI,SAAS;IAEnD,OACED,eAAe,YAAY5C,oBAAoB,IAC/C4C,eAAe,CAACE,OAAO,CAACC,MAAM,GAAG,CAAC;EAEtC;;EAEA;AACF;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACjB,gBAAgB,CAACkB,IAAI,CAAExC,MAAM,IAAKA,MAAM,CAACyC,QAAQ,CAAC,CAAC,CAAC;EAClE;;EAEA;AACF;EACEC,eAAeA,CAAA,EAAY;IACzB,OAAO,CAAC,IAAI,CAACH,aAAa,CAAC,CAAC;EAC9B;;EAEA;AACF;EACEI,gBAAgBA,CAAA,EAAS;IACvB,MAAMR,eAAe,GAAG,IAAI,CAACH,WAAW,EAAEI,SAAS;IAEnD,IAAIQ,SAAS,GAAG,GAAG;IACnB,IAAIT,eAAe,YAAY5C,oBAAoB,EAAE;MAAA,IAAAsD,SAAA;MACnDD,SAAS,GAAG9C,uBAAA,CAAA+C,SAAA,GAAAV,eAAe,CAACE,OAAO,EAAA7B,IAAA,CAAAqC,SAAA,EAChCC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAK,GAC9B,CAAC,CAAC,CAAC,CAAC,CAACA,IAAI;IACX;IAEA,OAAO,IAAIzD,IAAI,CAAC,IAAI,CAAC6B,QAAQ,CAAC,CAAC6B,YAAY,CAAC,OAAO,EAAEJ,SAAS,CAAC;EACjE;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ContentIndexModel.js","names":["ResourceModel","ResourceCollection","FilterCollection","ContentLinkModel","Href","ChoiceAttributeModel","ContentIndexModel","constructor","modularuiResponse","_context","_defineProperty","_filterCollection","_filterInstanceProperty","data","filter","contributions","dynamicschema","modelOptions","_content","collection","_embedded","_mapInstanceProperty","results","call","content","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","hasIndexFilter","filterAttribute","attribute","options","length","hasFiltersSet","some","isActive","hasNoFiltersSet","getFirstCharHref","firstChar","_context2","option","code","addParameter"],"sources":["../../../src/models/content/ContentIndexModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport ChoiceAttributeModel from \"../attributes/ChoiceAttributeModel\";\n\nimport type { FilterType, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Get Index of concepts, to filter model catalog\n */\nexport default class ContentIndexModel extends ResourceModel {\n _filterCollection: FilterCollection;\n _content: ResourceCollection<ContentLinkModel>;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter,\n dynamicschema: this.data.dynamicschema,\n },\n this.modelOptions,\n );\n\n this._content = new ResourceCollection();\n this._content.collection = this.data._embedded\n ? this.data._embedded.results.map(\n (content) =>\n new ContentLinkModel(content.content, null, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get type(): string {\n return \"ContentIndex\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentIndexModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentSearch\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.items.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this.items.setChildModels(models, errors);\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = this.selflink.href;\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\");\n }\n\n /**\n * Retrieve filters of conceptindex model\n */\n get filterCollection(): FilterCollection {\n return this._filterCollection;\n }\n\n /**\n * Get index filter\n */\n get indexfilter(): FilterType | null {\n return this._filterCollection.getFilterByAttributeKey(\"index\");\n }\n\n /**\n * Retrieve content collection\n */\n get items(): ResourceCollection<ContentLinkModel> {\n return this._content;\n }\n\n /**\n */\n hasIndexFilter(): boolean {\n const filterAttribute = this.indexfilter?.attribute;\n\n return (\n filterAttribute instanceof ChoiceAttributeModel &&\n filterAttribute.options.length > 0\n );\n }\n\n /**\n */\n hasFiltersSet(): boolean {\n return this.filterCollection.some((filter) => filter.isActive());\n }\n\n /**\n */\n hasNoFiltersSet(): boolean {\n return !this.hasFiltersSet();\n }\n\n /**\n */\n getFirstCharHref(): Href {\n const filterAttribute = this.indexfilter?.attribute;\n\n let firstChar = \"#\";\n if (filterAttribute instanceof ChoiceAttributeModel) {\n firstChar = filterAttribute.options.filter(\n (option) => option.code !== \"0\",\n )[0].code;\n }\n\n return new Href(this.selfhref).addParameter(\"index\", firstChar);\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,oBAAoB,MAAM,oCAAoC;AAOrE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zC,MAAM,IAAKA,MAAM,CAAC0C,QAAQ,CAAC,CAAC,CAAC;EAClE;;EAEA;AACF;EACEC,eAAeA,CAAA,EAAY;IACzB,OAAO,CAAC,IAAI,CAACH,aAAa,CAAC,CAAC;EAC9B;;EAEA;AACF;EACEI,gBAAgBA,CAAA,EAAS;IACvB,MAAMR,eAAe,GAAG,IAAI,CAACH,WAAW,EAAEI,SAAS;IAEnD,IAAIQ,SAAS,GAAG,GAAG;IACnB,IAAIT,eAAe,YAAY7C,oBAAoB,EAAE;MAAA,IAAAuD,SAAA;MACnDD,SAAS,GAAG/C,uBAAA,CAAAgD,SAAA,GAAAV,eAAe,CAACE,OAAO,EAAA7B,IAAA,CAAAqC,SAAA,EAChCC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAK,GAC9B,CAAC,CAAC,CAAC,CAAC,CAACA,IAAI;IACX;IAEA,OAAO,IAAI1D,IAAI,CAAC,IAAI,CAAC8B,QAAQ,CAAC,CAAC6B,YAAY,CAAC,OAAO,EAAEJ,SAAS,CAAC;EACjE;AACF","ignoreList":[]}
@@ -6,8 +6,6 @@ import LinkModel from "../links/LinkModel";
6
6
  import ContentTypeModel from "./ContentTypeModel";
7
7
  import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
8
8
  import LinkCollection from "../links/LinkCollection";
9
- import { getBasePath } from "../../constants";
10
-
11
9
  /**
12
10
  * Link to a concept
13
11
  */
@@ -16,18 +14,13 @@ export default class ContentLinkModel extends BaseModel {
16
14
  */
17
15
  constructor(data) {
18
16
  let entryDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
19
- let origin = arguments.length > 2 ? arguments[2] : undefined;
20
- let contextPath = arguments.length > 3 ? arguments[3] : undefined;
21
- super(data, {});
17
+ let modelOptions = arguments.length > 2 ? arguments[2] : undefined;
18
+ super(data, {}, modelOptions);
22
19
  _defineProperty(this, "_links", void 0);
23
20
  _defineProperty(this, "_entryDate", void 0);
24
21
  _defineProperty(this, "_contentType", null);
25
22
  _defineProperty(this, "_items", void 0);
26
- _defineProperty(this, "_origin", "");
27
- _defineProperty(this, "_contextPath", getBasePath());
28
23
  this._entryDate = entryDate;
29
- this._origin = origin || "";
30
- this._contextPath = contextPath || getBasePath();
31
24
  }
32
25
 
33
26
  /**
@@ -99,7 +92,7 @@ export default class ContentLinkModel extends BaseModel {
99
92
  */
100
93
  createEncodedHref() {
101
94
  const startURI = "/content/";
102
- const selfHref = new Href(this.data._links.self.href, this._origin, this._contextPath);
95
+ const selfHref = new Href(this.data._links.self.href, "", this.modelOptions);
103
96
  const href = selfHref.path;
104
97
  const section = this.data.section;
105
98
  const sourceId = section ? href.substring(startURI.length, href.lastIndexOf("/")) : href.substring(startURI.length);
@@ -128,7 +121,7 @@ export default class ContentLinkModel extends BaseModel {
128
121
  */
129
122
  get links() {
130
123
  if (!this._links) {
131
- this._links = new LinkCollection(Array.isArray(this.data._links) ? this.data._links[0] : this.data._links, null, this._origin, this._contextPath);
124
+ this._links = new LinkCollection(Array.isArray(this.data._links) ? this.data._links[0] : this.data._links, null, this.modelOptions);
132
125
  }
133
126
  return this._links;
134
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContentLinkModel.js","names":["BaseModel","Href","LinkModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","LinkCollection","getBasePath","ContentLinkModel","constructor","data","entryDate","arguments","length","undefined","origin","contextPath","_defineProperty","_entryDate","_origin","_contextPath","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","key","getData","label","sourceLabel","createEncodedHref","startURI","selfHref","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","links","Array","isArray","selflink","getLinkByKey","Error","subSectionID","hash","contentTypeHref","items","_items"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type { ModularUIModel, IModelWithChildModels } from \"../types\";\nimport { getBasePath } from \"../../constants\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n origin?: string,\n contextPath?: string,\n ) {\n super(data, {});\n\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n const startURI = \"/content/\";\n const selfHref = new Href(\n this.data._links.self.href,\n this._origin,\n this._contextPath,\n );\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this._origin,\n this._contextPath,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AAEnE,OAAOC,cAAc,MAAM,yBAAyB;AAGpD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAC3BP,SAAS,CAEnB;EAQE;AACF;EACEQ,WAAWA,CACTC,IAAY,EAIZ;IAAA,IAHAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,MAAe,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAA,IACfE,WAAoB,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAEpB,KAAK,CAACJ,IAAI,EAAE,CAAC,CAAC,CAAC;IAACO,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBAbsB,IAAI;IAAAA,eAAA;IAAAA,eAAA,kBAE1B,EAAE;IAAAA,eAAA,uBACGV,WAAW,CAAC,CAAC;IAYlC,IAAI,CAACW,UAAU,GAAGP,SAAS;IAC3B,IAAI,CAACQ,OAAO,GAAGJ,MAAM,IAAI,EAAE;IAC3B,IAAI,CAACK,YAAY,GAAGJ,WAAW,IAAIT,WAAW,CAAC,CAAC;EAClD;;EAEA;AACF;EACE;EACAc,yBAAyBA,CAAA,EAAqB;IAC5C,IAAI,IAAI,CAACC,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,CAACC,WAAW,GAAG,IAAI;MACvC,OAAO,CAAC,IAAI,CAACD,eAAe,CAAC;IAC/B;IAE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;IACnC,OAAO,IAAI,CAACC,MAAM;EACpB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ContentLinkModel.js","names":["BaseModel","Href","LinkModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","LinkCollection","ContentLinkModel","constructor","data","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_entryDate","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","key","getData","label","sourceLabel","createEncodedHref","startURI","selfHref","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","links","Array","isArray","selflink","getLinkByKey","Error","subSectionID","hash","contentTypeHref","items","_items"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type {\n ModularUIModel,\n IModelWithChildModels,\n ModelOptions,\n} from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n const startURI = \"/content/\";\n const selfHref = new Href(\n this.data._links.self.href,\n \"\",\n this.modelOptions,\n );\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this.modelOptions,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AAEnE,OAAOC,cAAc,MAAM,yBAAyB;AAQpD;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAC3BN,SAAS,CAEnB;EAME;AACF;EACEO,WAAWA,CACTC,IAAY,EAGZ;IAAA,IAFAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,YAA2B,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAE3B,KAAK,CAACJ,IAAI,EAAE,CAAC,CAAC,EAAEK,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBAVQ,IAAI;IAAAA,eAAA;IAY1C,IAAI,CAACC,UAAU,GAAGN,SAAS;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O,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIoC,KAAKA,CAACA,KAA8B,EAAE;IACxC,IAAI,CAACC,MAAM,GAAGD,KAAK;EACrB;;EAEA;AACF;EACE,IAAIA,KAAKA,CAAA,EAA4B;IACnC,OAAO,IAAI,CAACC,MAAM;EACpB;AACF","ignoreList":[]}
@@ -19,7 +19,7 @@ export default class ContentModel extends ResourceModel {
19
19
  _defineProperty(this, "_section", void 0);
20
20
  _defineProperty(this, "_contentType", null);
21
21
  _defineProperty(this, "_filterCollection", void 0);
22
- this._section = new SectionModel(this.data, this.entryDate);
22
+ this._section = new SectionModel(this.data, this.entryDate, this.modelOptions);
23
23
  }
24
24
 
25
25
  /**
@@ -77,7 +77,7 @@ export default class ContentModel extends ResourceModel {
77
77
  entryDate: _filterInstanceProperty(this.data).entryDate
78
78
  }, {
79
79
  filter: _filterInstanceProperty(this.contributions)
80
- });
80
+ }, this.modelOptions);
81
81
  }
82
82
  return this._filterCollection;
83
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContentModel.js","names":["ModularUIResponse","ResourceModel","FilterCollection","ContentLinkModel","SubSectionModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","SectionModel","ContentModel","constructor","response","_defineProperty","_section","data","entryDate","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","call","model","section","id","_id","filterCollection","_filterCollection","_filterInstanceProperty","filter","entryDateFilter","getFilterByAttributeKey","attribute","value","_contentType","label","number","body","childSectionLinks","selfContentLink","childSections","sections","subSections","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","subSection","relatedConceptsLink","href","addParameter","setReferenceHash","referenceHash"],"sources":["../../../src/models/content/ContentModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport ContentTypeModel from \"./ContentTypeModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type Href from \"../href/Href\";\nimport SectionModel from \"./SectionModel\";\n\n/**\n * Content detail model\n */\nexport default class ContentModel extends ResourceModel {\n _section: SectionModel;\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n constructor(response: ModularUIResponse) {\n super(response);\n\n this._section = new SectionModel(this.data, this.entryDate);\n }\n\n /**\n */\n get type(): string {\n return \"Content\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n */\n get section(): SectionModel {\n return this._section;\n }\n\n /**\n */\n get id(): string {\n return this.data._id;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection && this.data.filter?.entryDate) {\n this._filterCollection = new FilterCollection(\n {\n entryDate: this.data.filter.entryDate,\n },\n {\n filter: this.contributions.filter,\n },\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve entrydate of content toc\n */\n get entryDate(): ISO_DATE | null {\n const entryDateFilter = this.filterCollection?.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n if (entryDateFilter && entryDateFilter.attribute) {\n return entryDateFilter.attribute.value;\n }\n\n return null;\n }\n\n /**\n * Get conceptType of concept\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.section.label;\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.section.number;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return this.section.body;\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.section.childSectionLinks;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return this.section.selfContentLink;\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n return this.section.childSections;\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this.section.childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.section.subSections;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n return this.section.referenceHash;\n }\n}\n"],"mappings":";;;AACA,OAAOA,iBAAiB,MAAM,mCAAmC;AAEjE,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,OAA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A,CAAA,EAAW;IAC1B,OAAO,IAAI,CAAC9B,OAAO,CAAC8B,aAAa;EACnC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ContentModel.js","names":["ModularUIResponse","ResourceModel","FilterCollection","ContentLinkModel","SubSectionModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","SectionModel","ContentModel","constructor","response","_defineProperty","_section","data","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","call","model","section","id","_id","filterCollection","_filterCollection","_filterInstanceProperty","filter","entryDateFilter","getFilterByAttributeKey","attribute","value","_contentType","label","number","body","childSectionLinks","selfContentLink","childSections","sections","subSections","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","subSection","relatedConceptsLink","href","addParameter","setReferenceHash","referenceHash"],"sources":["../../../src/models/content/ContentModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport ContentTypeModel from \"./ContentTypeModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type Href from \"../href/Href\";\nimport SectionModel from \"./SectionModel\";\n\n/**\n * Content detail model\n */\nexport default class ContentModel extends ResourceModel {\n _section: SectionModel;\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n constructor(response: ModularUIResponse) {\n super(response);\n\n this._section = new SectionModel(\n this.data,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"Content\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n */\n get section(): SectionModel {\n return this._section;\n }\n\n /**\n */\n get id(): string {\n return this.data._id;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection && this.data.filter?.entryDate) {\n this._filterCollection = new FilterCollection(\n {\n entryDate: this.data.filter.entryDate,\n },\n {\n filter: this.contributions.filter,\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve entrydate of content toc\n */\n get entryDate(): ISO_DATE | null {\n const entryDateFilter = this.filterCollection?.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n if (entryDateFilter && entryDateFilter.attribute) {\n return entryDateFilter.attribute.value;\n }\n\n return null;\n }\n\n /**\n * Get conceptType of concept\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.section.label;\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.section.number;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return this.section.body;\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.section.childSectionLinks;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return this.section.selfContentLink;\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n return this.section.childSections;\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this.section.childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.section.subSections;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n return this.section.referenceHash;\n }\n}\n"],"mappings":";;;AACA,OAAOA,iBAAiB,MAAM,mCAAmC;AAEjE,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,SAASC,uBAAuB,QAAQ,2BAA2B;AAKnE,OAAOC,YAAY,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,eAAe,MAAMC,YAAY,SAASP,aAAa,CAAC;EAKtDQ,WAAWA,CAACC,QAA2B,EAAE;IACvC,KAAK,CAACA,QAAQ,CAAC;IAACC,eAAA;IAAAA,eAAA,uBAJsB,IAAI;IAAAA,eAAA;IAM1C,IAAI,CAACC,QAAQ,GAAG,IAAIL,YAAY,CAC9B,IAAI,CAACM,IAAI,EACT,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,SAAS;EAClB;;EAEA;AACF;EACE,WAAWC,SAASA,C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WAAW;EACjC;;EAEA;AACF;EACE,IAAIC,oBAAoBA,CAAA,EAAgB;IACtC,MAAMC,KAAK,GAAG,EAAE;IAChB,IAAI,IAAI,CAACC,mBAAmB,EAAE;MAC5BD,KAAK,CAACE,IAAI,CAAC,IAAI,CAACD,mBAAmB,CAAC;IACtC;IAEA,IAAI,CAACH,WAAW,CAACK,OAAO,CAAEC,UAAU,IAAK;MACvCJ,KAAK,CAACE,IAAI,CAAC,GAAGE,UAAU,CAACL,oBAAoB,CAAC;IAChD,CAAC,CAAC;IAEF,OAAOC,KAAK;EACd;;EAEA;AACF;AACA;EACE,IAAIC,mBAAmBA,CAAA,EAAgB;IACrC,MAAMI,mBAAmB,GAAG,IAAI,CAAClC,KAAK,CAACC,YAAY,CAAC,iBAAiB,CAAC;IAEtE,IAAIiC,mBAAmB,EAAE;MACvB,MAAM;QAAEC;MAAK,CAAC,GAAGD,mBAAmB;MACpCC,IAAI,CAACC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC7C,SAAS,CAAC;MAC9C4C,IAAI,CAACE,gBAAgB,CAAC,IAAI,CAACC,aAAa,CAAC;MACzC,OAAOH,IAAI;IACb;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIG,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAI,CAAC9B,OAAO,CAAC8B,aAAa;EACnC;AACF","ignoreList":[]}
@@ -13,13 +13,13 @@ import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
13
13
  /**
14
14
  * Get content items recursively
15
15
  */
16
- const getItems = (items, entryDate) => _mapInstanceProperty(items).call(items, item => {
16
+ const getItems = (items, entryDate, modelOptions) => _mapInstanceProperty(items).call(items, item => {
17
17
  const link = new ContentLinkModel({
18
18
  ...item,
19
19
  section: item._id
20
- }, entryDate);
20
+ }, entryDate, modelOptions);
21
21
  if (item.items) {
22
- link.items = getItems(item.items, entryDate);
22
+ link.items = getItems(item.items, entryDate, modelOptions);
23
23
  }
24
24
  return link;
25
25
  });
@@ -94,14 +94,14 @@ export default class ContentTOCModel extends ResourceModel {
94
94
  /**
95
95
  */
96
96
  get selfContentLink() {
97
- return new ContentLinkModel(this.data, this.entryDate);
97
+ return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);
98
98
  }
99
99
 
100
100
  /**
101
101
  * Get sub items of toc
102
102
  */
103
103
  get items() {
104
- return this.data.items ? getItems(this.data.items, this.entryDate) : [];
104
+ return this.data.items ? getItems(this.data.items, this.entryDate, this.modelOptions) : [];
105
105
  }
106
106
 
107
107
  /**
@@ -110,7 +110,7 @@ export default class ContentTOCModel extends ResourceModel {
110
110
  get categories() {
111
111
  if (this.data.categories) {
112
112
  var _context;
113
- return _mapInstanceProperty(_context = this.data.categories).call(_context, category => new ContentLinkModel(category));
113
+ return _mapInstanceProperty(_context = this.data.categories).call(_context, category => new ContentLinkModel(category, null, this.modelOptions));
114
114
  }
115
115
  return [];
116
116
  }
@@ -139,7 +139,7 @@ export default class ContentTOCModel extends ResourceModel {
139
139
  const [key] = _Object$keys(filter);
140
140
  return has(this.data?.filter, key);
141
141
  })
142
- });
142
+ }, this.modelOptions);
143
143
  }
144
144
  return this._filterCollection;
145
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTOCModel.js","names":["has","ResourceModel","FilterCollection","ContentLinkModel","ContentTypeModel","Href","TIMEVERSION_FILTER_NAME","getItems","items","entryDate","_mapInstanceProperty","call","item","link","section","_id","ContentTOCModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","model","label","getData","selfhref","href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","categories","_context","category","_contentType","_filterCollection","_context2","_filterInstanceProperty","key","_Object$keys","timeversionFilter","getFilterByAttributeKey","attribute"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentTOC\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n return this.data.items ? getItems(this.data.items, this.entryDate) : [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(this.data.filter, {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n });\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve entrydate of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n}\n"],"mappings":";;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAE/B,SAASC,uBAAuB,QAAQ,2BAA2B;AAMnE;AACA;AACA;AACA,MAAMC,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,KAE1BC,oBAAA,CAAAF,KAAK,EAAAG,IAAA,CAALH,KAAK,EAAMI,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIV,gBAAgB,CAC/B;IACE,GAAGS,IAAI;IACPE,OAAO,EAAEF,IAAI,CAACG;EAChB,C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AAG4B,WAAW,GAAG,IAAI;EAChE;;EAEA;AACF;AACA;EACE,IAAIQ,gBAAgBA,CAAA,EAAqB;IACvC,IAAI,CAAC,IAAI,CAACc,iBAAiB,EAAE;MAAA,IAAAC,SAAA;MAC3B,IAAI,CAACD,iBAAiB,GAAG,IAAIpD,gBAAgB,CAAAsD,uBAAA,CAAC,IAAI,CAACjC,IAAI,GAAS;QAC9DmB,MAAM,EAAEc,uBAAA,CAAAD,SAAA,GAAAC,uBAAA,KAAI,CAAChC,aAAa,GAAAb,IAAA,CAAA4C,SAAA,EAAgBb,MAAM,IAAK;UACnD,MAAM,CAACe,GAAG,CAAC,GAAGC,YAAA,CAAYhB,MAAM,CAAC;UACjC,OAAO1C,GAAG,CAAC,IAAI,CAACuB,IAAI,EAAEmB,MAAM,EAAEe,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,CAAC;IACJ;IAEA,OAAO,IAAI,CAACH,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAI7C,SAASA,CAAA,EAAoB;IAC/B,MAAMkD,iBAAiB,GAAG,IAAI,CAACnB,gBAAgB,CAACoB,uBAAuB,CACrEtD,uBACF,CAAC;IAED,OAAOqD,iBAAiB,EAAEE,SAAS,EAAEhB,KAAK,IAAI,IAAI;EACpD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ContentTOCModel.js","names":["has","ResourceModel","FilterCollection","ContentLinkModel","ContentTypeModel","Href","TIMEVERSION_FILTER_NAME","getItems","items","entryDate","modelOptions","_mapInstanceProperty","call","item","link","section","_id","ContentTOCModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","model","label","getData","selfhref","href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","categories","_context","category","_contentType","_filterCollection","_context2","_filterInstanceProperty","key","_Object$keys","timeversionFilter","getFilterByAttributeKey","attribute"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentTOC\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n return this.data.items\n ? getItems(this.data.items, this.entryDate, this.modelOptions)\n : [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve entrydate of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n}\n"],"mappings":";;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAE/B,SAASC,uBAAuB,QAAQ,2BAA2B;AAMnE;AACA;AACA;AACA,MAAMC,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1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AIlD,gBAAgB,CAACkD,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC3C,YAAY,CACtE,CAAC;IACH;IAEA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIuB,WAAWA,CAAA,EAA4B;IACzC,OAAO,IAAI,CAACqB,YAAY;EAC1B;;EAEA;AACF;EACE,IAAIrB,WAAWA,CAACA,WAA4B,EAAE;IAC5C,IAAI,CAACqB,YAAY,GACfrB,WAAW,YAAY7B,gBAAgB,GAAG6B,WAAW,GAAG,IAAI;EAChE;;EAEA;AACF;AACA;EACE,IAAIQ,gBAAgBA,CAAA,EAAqB;IACvC,IAAI,CAAC,IAAI,CAACc,iBAAiB,EAAE;MAAA,IAAAC,SAAA;MAC3B,IAAI,CAACD,iBAAiB,GAAG,IAAIrD,gBAAgB,CAAAuD,uBAAA,CAC3C,IAAI,CAACjC,IAAI,GACT;QACEmB,MAAM,EAAEc,uBAAA,CAAAD,SAAA,GAAAC,uBAAA,KAAI,CAAChC,aAAa,GAAAb,IAAA,CAAA4C,SAAA,EAAgBb,MAAM,IAAK;UACnD,MAAM,CAACe,GAAG,CAAC,GAAGC,YAAA,CAAYhB,MAAM,CAAC;UACjC,OAAO3C,GAAG,CAAC,IAAI,CAACwB,IAAI,EAAEmB,MAAM,EAAEe,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,EACD,IAAI,CAAChD,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAAC6C,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAI9C,SAASA,CAAA,EAAoB;IAC/B,MAAMmD,iBAAiB,GAAG,IAAI,CAACnB,gBAAgB,CAACoB,uBAAuB,CACrEvD,uBACF,CAAC;IAED,OAAOsD,iBAAiB,EAAEE,SAAS,EAAEhB,KAAK,IAAI,IAAI;EACpD;AACF","ignoreList":[]}
@@ -7,21 +7,15 @@ import SubSectionModel from "./SubSectionModel";
7
7
  import { createHashFromHref } from "../../utils/helpers/createHash";
8
8
  import LinkModel from "../links/LinkModel";
9
9
  import { retrieveText } from "../../utils";
10
- import { getBasePath } from "../../constants";
11
-
12
10
  /**
13
11
  */
14
12
  class SectionModel extends BaseModel {
15
- constructor(data, entryDate, origin, contextPath) {
16
- super(data, {});
13
+ constructor(data, entryDate, modelOptions) {
14
+ super(data, {}, modelOptions);
17
15
  _defineProperty(this, "_entryDate", void 0);
18
16
  _defineProperty(this, "_selflink", void 0);
19
17
  _defineProperty(this, "_childSections", void 0);
20
- _defineProperty(this, "_origin", "");
21
- _defineProperty(this, "_contextPath", getBasePath());
22
18
  this._entryDate = entryDate;
23
- this._origin = origin || "";
24
- this._contextPath = contextPath || getBasePath();
25
19
  }
26
20
 
27
21
  /**
@@ -34,7 +28,7 @@ class SectionModel extends BaseModel {
34
28
  */
35
29
  get selflink() {
36
30
  if (!this._selflink) {
37
- this._selflink = new LinkModel(this.data._links?.self, null, this._origin, this._contextPath);
31
+ this._selflink = new LinkModel(this.data._links?.self, null, this.modelOptions);
38
32
  }
39
33
  return this._selflink;
40
34
  }
@@ -107,7 +101,7 @@ class SectionModel extends BaseModel {
107
101
  label: childSection.label,
108
102
  sourceLabel: childSection.sourceLabel,
109
103
  _links: childSection._links
110
- }, this.entryDate, this._origin, this._contextPath)) : [];
104
+ }, this.entryDate, this.modelOptions)) : [];
111
105
  }
112
106
 
113
107
  /**
@@ -119,7 +113,7 @@ class SectionModel extends BaseModel {
119
113
  label: this.data.label,
120
114
  sourceLabel: this.data.sourceLabel,
121
115
  _links: this.data._links
122
- }, this.entryDate, this._origin, this._contextPath);
116
+ }, this.entryDate, this.modelOptions);
123
117
  }
124
118
 
125
119
  /**
@@ -128,7 +122,7 @@ class SectionModel extends BaseModel {
128
122
  get childSections() {
129
123
  if (!this._childSections && this.data.childSections) {
130
124
  var _context2, _context3;
131
- this._childSections = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate, this._origin, this._contextPath));
125
+ this._childSections = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate, this.modelOptions));
132
126
  }
133
127
  return this._childSections || [];
134
128
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","getBasePath","SectionModel","constructor","data","entryDate","origin","contextPath","_defineProperty","_entryDate","_origin","_contextPath","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport type Href from \"../href/Href\";\nimport { retrieveText } from \"../../utils\";\nimport { getBasePath } from \"../../constants\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n origin?: string,\n contextPath?: string,\n ) {\n super(data, {});\n\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this._origin,\n this._contextPath,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this._origin,\n this._contextPath,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this._origin,\n this._contextPath,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(\n childSection,\n this.entryDate,\n this._origin,\n this._contextPath,\n ),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,OAAOC,SAAS,MAAM,oBAAoB;AAG1C,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA,MAAMC,YAAY,SAASP,SAAS,CAAC;EAOnCQ,WAAWA,CACTC,IAAY,EACZC,SAA0B,EAC1BC,MAAe,EACfC,WAAoB,EACpB;IACA,KAAK,CAACH,IAAI,EAAE,CAAC,CAAC,CAAC;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,kBATA,EAAE;IAAAA,eAAA,uBACGP,WAAW,CAAC,CAAC;IAUlC,IAAI,CAACQ,UAAU,GAAGJ,SAAS;IAC3B,IAAI,CAACK,OAAO,GAAGJ,MAAM,IAAI,EAAE;IAC3B,IAAI,CAACK,YAAY,GAAGJ,WAAW,IAAIN,WAAW,CAAC,CAAC;EAClD;;EAEA;AACF;EACE,IAAIW,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACR,IAAI,CAACQ,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAc;IACxB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAIf,SAAS,CAC5B,IAAI,CAACK,IAAI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AC;IAClC;IAEA,OAAOP,QAAQ;EACjB;AACF;AAEA,eAAetC,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,OAAOC,SAAS,MAAM,oBAAoB;AAE1C,SAASC,YAAY,QAAQ,aAAa;AAK1C;AACA;AACA,MAAMC,YAAY,SAASN,SAAS,CAAC;EAKnCO,WAAWA,CACTC,IAAY,EACZC,SAA0B,EAC1BC,YAA2B,EAC3B;IACA,KAAK,CAACF,IAAI,EAAE,CAAC,CAAC,EAAEE,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAE9B,IAAI,CAACC,UAAU,GAAGH,SAAS;EAC7B;;EAEA;AACF;EACE,IAAII,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACL,IAAI,CAACK,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAc;IACxB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAIX,SAAS,CAC5B,IAAI,CAACI,IAAI,CAACQ,MAAM,EAAEC,IAAI,EACtB,IAAI,EACJ,IAAI,CAACP,YACP,CAAC;IACH;IACA,OAAO,IAAI,CAACK,SAAS;EACvB;;EAEA;AACF;EACE,IAAIG,QAAQA,CAAA,EAAS;IACnB,OAAO,IAAI,CAACJ,QAAQ,CAACK,IAAI;EAC3B;;EAEA;AACF;EACE,IAAIV,SAASA,CAAA,EAAoB;IAC/B,OAAO,IAAI,CAACG,UAAU;EACxB;;EAEA;AACF;EACE,IAAIQ,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACZ,IAAI,CAACY,IAAI;EACvB;;EAEA;AACF;EACE,IAAIC,WAAWA,CAAA,EAAW;IACxB,OAAO,IAAI,CAACb,IAAI,CAACa,WAAW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,EAAW;IAC1B,OAAO1C,kBAAkB,CAAC,IAAI,CAACe,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACE4B,mBAAmBA,CAAA,EAA0C;IAC3D,MAAML,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAC/B,QAAQ,EAAE;QACvB4B,QAAQ,CAACM,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMd,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzB4B,QAAQ,CAACM,IAAI,CAACb,YAAY,CAAC;MAC7B;MAEA,MAAMc,cAAc,GAAGd,YAAY,CAACY,mBAAmB,CAAC,CAAC;MACzDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOP,QAAQ;EACjB;AACF;AAEA,eAAenC,YAAY","ignoreList":[]}
@@ -82,7 +82,10 @@ export default class DetailModel extends ResourceModel {
82
82
  const [key] = _Object$keys(contribution);
83
83
  return has(this.data, key);
84
84
  }) : [];
85
- this.attributeCollection = new AttributeCollection(this.data, attributeContributions, true);
85
+ this.attributeCollection = new AttributeCollection(this.data, attributeContributions, {
86
+ ...this.modelOptions,
87
+ isReadonly: true
88
+ });
86
89
  }
87
90
 
88
91
  /**
@@ -125,7 +128,10 @@ export default class DetailModel extends ResourceModel {
125
128
  const metadataContributions = this.contributions.metadata ? _mapInstanceProperty(_context4 = _Object$keys(this.contributions.metadata)).call(_context4, metadataKey => ({
126
129
  [metadataKey]: this.contributions.metadata[metadataKey]
127
130
  })) : [];
128
- this.metadataCollection = new AttributeCollection(this.data, metadataContributions, true);
131
+ this.metadataCollection = new AttributeCollection(this.data, metadataContributions, {
132
+ ...this.modelOptions,
133
+ isReadonly: true
134
+ });
129
135
  }
130
136
 
131
137
  /**
@@ -144,7 +150,7 @@ export default class DetailModel extends ResourceModel {
144
150
  * Action collection
145
151
  */
146
152
  createActionCollection() {
147
- this._actionCollection = new ActionCollection(this.data.actions, this.contributions.actions, this.origin, this.contextPath);
153
+ this._actionCollection = new ActionCollection(this.data.actions, this.contributions.actions, this.modelOptions);
148
154
  }
149
155
 
150
156
  /**