@beinformed/ui 1.63.2 → 1.63.4

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 (466) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/esm/constants/Settings.js +3 -14
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/exceptions/NotFoundException.js +1 -2
  5. package/esm/exceptions/NotFoundException.js.map +1 -1
  6. package/esm/hooks/useI18n.js +1 -6
  7. package/esm/hooks/useI18n.js.map +1 -1
  8. package/esm/hooks/useModal.js +3 -4
  9. package/esm/hooks/useModal.js.map +1 -1
  10. package/esm/hooks/useModelCatalog.js +10 -30
  11. package/esm/hooks/useModelCatalog.js.map +1 -1
  12. package/esm/hooks/useModularUI.js +4 -5
  13. package/esm/hooks/useModularUI.js.map +1 -1
  14. package/esm/hooks/useModularUIBasic.js +7 -8
  15. package/esm/hooks/useModularUIBasic.js.map +1 -1
  16. package/esm/i18n/Locale.js +2 -5
  17. package/esm/i18n/Locale.js.map +1 -1
  18. package/esm/i18n/Locales.js +2 -5
  19. package/esm/i18n/Locales.js.map +1 -1
  20. package/esm/i18n/Message.js +9 -10
  21. package/esm/i18n/Message.js.map +1 -1
  22. package/esm/i18n/withMessage.js +1 -6
  23. package/esm/i18n/withMessage.js.map +1 -1
  24. package/esm/models/actions/ActionCollection.js +3 -6
  25. package/esm/models/actions/ActionCollection.js.map +1 -1
  26. package/esm/models/actions/ActionModel.js +1 -4
  27. package/esm/models/actions/ActionModel.js.map +1 -1
  28. package/esm/models/application/ApplicationModel.js +2 -2
  29. package/esm/models/application/ApplicationModel.js.map +1 -1
  30. package/esm/models/attributes/AttributeCollection.js +4 -14
  31. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  32. package/esm/models/attributes/AttributeDataHelper.js +1 -2
  33. package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
  34. package/esm/models/attributes/AttributeSetModel.js +1 -5
  35. package/esm/models/attributes/AttributeSetModel.js.map +1 -1
  36. package/esm/models/attributes/CaptchaAttributeModel.js +2 -2
  37. package/esm/models/attributes/CaptchaAttributeModel.js.map +1 -1
  38. package/esm/models/attributes/ChoiceAttributeModel.js +1 -3
  39. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  40. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +3 -9
  41. package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  42. package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -8
  43. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  44. package/esm/models/attributes/PasswordAttributeModel.js +2 -2
  45. package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
  46. package/esm/models/attributes/UploadAttributeModel.js +2 -2
  47. package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
  48. package/esm/models/attributes/input-constraints/ConstraintCollection.js +1 -2
  49. package/esm/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
  50. package/esm/models/attributes/input-constraints/ConstraintModel.js +1 -2
  51. package/esm/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
  52. package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js +1 -4
  53. package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
  54. package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js +1 -6
  55. package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  56. package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js +1 -4
  57. package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
  58. package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +1 -2
  59. package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
  60. package/esm/models/attributes/layouthint-rules/DependentAttribute.js +2 -2
  61. package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
  62. package/esm/models/base/BaseCollection.js +1 -2
  63. package/esm/models/base/BaseCollection.js.map +1 -1
  64. package/esm/models/base/BaseModel.js +6 -9
  65. package/esm/models/base/BaseModel.js.map +1 -1
  66. package/esm/models/base/ResourceModel.js +1 -2
  67. package/esm/models/base/ResourceModel.js.map +1 -1
  68. package/esm/models/concepts/BusinessScenarioModel.js +2 -2
  69. package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
  70. package/esm/models/concepts/ConceptDetailModel.js +1 -2
  71. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  72. package/esm/models/concepts/ConceptLinkModel.js +1 -3
  73. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  74. package/esm/models/concepts/ConceptRelationCollection.js +1 -4
  75. package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
  76. package/esm/models/concepts/ConceptRelationModel.js +1 -3
  77. package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
  78. package/esm/models/concepts/SourceReferenceCollection.js +1 -4
  79. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  80. package/esm/models/concepts/SourceReferenceModel.js +7 -3
  81. package/esm/models/concepts/SourceReferenceModel.js.flow +6 -0
  82. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  83. package/esm/models/content/ContentLinkModel.js +1 -3
  84. package/esm/models/content/ContentLinkModel.js.map +1 -1
  85. package/esm/models/content/ContentTOCModel.js +2 -2
  86. package/esm/models/content/ContentTOCModel.js.map +1 -1
  87. package/esm/models/contentconfiguration/ContentConfigurationElements.js +1 -2
  88. package/esm/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
  89. package/esm/models/error/ErrorModel.js +1 -3
  90. package/esm/models/error/ErrorModel.js.map +1 -1
  91. package/esm/models/filters/FilterCollection.js +1 -4
  92. package/esm/models/filters/FilterCollection.js.map +1 -1
  93. package/esm/models/form/FormModel.js +3 -9
  94. package/esm/models/form/FormModel.js.map +1 -1
  95. package/esm/models/form/FormObjectModel.js +2 -4
  96. package/esm/models/form/FormObjectModel.js.map +1 -1
  97. package/esm/models/href/Href.js +3 -6
  98. package/esm/models/href/Href.js.map +1 -1
  99. package/esm/models/href/ListHref.js +1 -2
  100. package/esm/models/href/ListHref.js.map +1 -1
  101. package/esm/models/layouthint/LayoutHintCollection.js +3 -10
  102. package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
  103. package/esm/models/links/LinkCollection.js +6 -15
  104. package/esm/models/links/LinkCollection.js.map +1 -1
  105. package/esm/models/list/ListModel.js +2 -2
  106. package/esm/models/list/ListModel.js.map +1 -1
  107. package/esm/models/modelcatalog/ModelCategoryCollection.js +1 -2
  108. package/esm/models/modelcatalog/ModelCategoryCollection.js.map +1 -1
  109. package/esm/models/parameter/Parameter.js +2 -4
  110. package/esm/models/parameter/Parameter.js.map +1 -1
  111. package/esm/models/resolveModel.js +1 -2
  112. package/esm/models/resolveModel.js.map +1 -1
  113. package/esm/models/sorting/SortingModel.js +1 -2
  114. package/esm/models/sorting/SortingModel.js.map +1 -1
  115. package/esm/models/user/UserServicesModel.js +2 -2
  116. package/esm/models/user/UserServicesModel.js.map +1 -1
  117. package/esm/modularui/Authenticate.js +4 -6
  118. package/esm/modularui/Authenticate.js.flow +6 -6
  119. package/esm/modularui/Authenticate.js.map +1 -1
  120. package/esm/modularui/ModularUIRequest.js +1 -2
  121. package/esm/modularui/ModularUIRequest.js.map +1 -1
  122. package/esm/react/ErrorBoundary.js +2 -2
  123. package/esm/react/ErrorBoundary.js.map +1 -1
  124. package/esm/react/ErrorBoundaryFallback.js +13 -16
  125. package/esm/react/ErrorBoundaryFallback.js.map +1 -1
  126. package/esm/react/utils.js +1 -3
  127. package/esm/react/utils.js.map +1 -1
  128. package/esm/react-client/Init.js +20 -23
  129. package/esm/react-client/Init.js.map +1 -1
  130. package/esm/react-client/client.js +9 -13
  131. package/esm/react-client/client.js.map +1 -1
  132. package/esm/react-server/renderSSRComplete.js +9 -10
  133. package/esm/react-server/renderSSRComplete.js.map +1 -1
  134. package/esm/react-server/renderSSRMinimal.js +7 -8
  135. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  136. package/esm/react-server/serverNoSSR.js +11 -12
  137. package/esm/react-server/serverNoSSR.js.map +1 -1
  138. package/esm/react-server/serverSSR.js +11 -12
  139. package/esm/react-server/serverSSR.js.map +1 -1
  140. package/esm/react-server/serverUtil.js +1 -3
  141. package/esm/react-server/serverUtil.js.map +1 -1
  142. package/esm/react-theme/ThemeProvider.js +7 -11
  143. package/esm/react-theme/ThemeProvider.js.map +1 -1
  144. package/esm/react-theme/createTheme.js +3 -10
  145. package/esm/react-theme/createTheme.js.map +1 -1
  146. package/esm/react-theme/utils/background.js +3 -4
  147. package/esm/react-theme/utils/background.js.map +1 -1
  148. package/esm/react-theme/utils/colors.js +7 -16
  149. package/esm/react-theme/utils/colors.js.map +1 -1
  150. package/esm/react-theme/utils/contrast.js +11 -19
  151. package/esm/react-theme/utils/contrast.js.map +1 -1
  152. package/esm/react-theme/utils/corners.js +10 -16
  153. package/esm/react-theme/utils/corners.js.map +1 -1
  154. package/esm/react-theme/utils/spacers.js +15 -38
  155. package/esm/react-theme/utils/spacers.js.map +1 -1
  156. package/esm/react-theme/utils/themeProps.js +7 -22
  157. package/esm/react-theme/utils/themeProps.js.map +1 -1
  158. package/esm/redux/_i18n/I18nReducer.js +5 -8
  159. package/esm/redux/_i18n/I18nReducer.js.map +1 -1
  160. package/esm/redux/_modularui/ModularUIActions.js +19 -23
  161. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  162. package/esm/redux/_modularui/ModularUIConnector.js +4 -5
  163. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  164. package/esm/redux/_modularui/ModularUIReducer.js +14 -19
  165. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  166. package/esm/redux/_modularui/ModularUIUtils.js +1 -2
  167. package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
  168. package/esm/redux/_modularui/withModularUI.js +1 -2
  169. package/esm/redux/_modularui/withModularUI.js.map +1 -1
  170. package/esm/redux/_router/RouterReducer.js +1 -3
  171. package/esm/redux/_router/RouterReducer.js.map +1 -1
  172. package/esm/redux/actions/FormAttributeSet.js +34 -37
  173. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  174. package/esm/redux/actions/FormAutosubmit.js +1 -2
  175. package/esm/redux/actions/FormAutosubmit.js.map +1 -1
  176. package/esm/redux/actions/Preferences.js +8 -15
  177. package/esm/redux/actions/Preferences.js.map +1 -1
  178. package/esm/redux/connectors/CaseView.js +3 -6
  179. package/esm/redux/connectors/CaseView.js.map +1 -1
  180. package/esm/redux/connectors/ConceptDetail.js +4 -7
  181. package/esm/redux/connectors/ConceptDetail.js.map +1 -1
  182. package/esm/redux/connectors/ContentBrowser.js +3 -6
  183. package/esm/redux/connectors/ContentBrowser.js.map +1 -1
  184. package/esm/redux/connectors/ContentDetail.js +4 -7
  185. package/esm/redux/connectors/ContentDetail.js.map +1 -1
  186. package/esm/redux/connectors/ContentDetailSection.js +5 -8
  187. package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
  188. package/esm/redux/connectors/Form.js +4 -5
  189. package/esm/redux/connectors/Form.js.map +1 -1
  190. package/esm/redux/connectors/FormAttributeSet.js +5 -8
  191. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  192. package/esm/redux/connectors/ListDetail.js +3 -6
  193. package/esm/redux/connectors/ListDetail.js.map +1 -1
  194. package/esm/redux/connectors/ModelCatalog.js +3 -6
  195. package/esm/redux/connectors/ModelCatalog.js.map +1 -1
  196. package/esm/redux/connectors/PanelRenderer.js +5 -6
  197. package/esm/redux/connectors/PanelRenderer.js.map +1 -1
  198. package/esm/redux/connectors/QuickSearch.js +3 -6
  199. package/esm/redux/connectors/QuickSearch.js.map +1 -1
  200. package/esm/redux/connectors/Tab.js +3 -6
  201. package/esm/redux/connectors/Tab.js.map +1 -1
  202. package/esm/redux/reducers/AuthReducer.js +1 -3
  203. package/esm/redux/reducers/AuthReducer.js.map +1 -1
  204. package/esm/redux/reducers/ErrorReducer.js +1 -3
  205. package/esm/redux/reducers/ErrorReducer.js.map +1 -1
  206. package/esm/redux/reducers/ModalsReducer.js +1 -3
  207. package/esm/redux/reducers/ModalsReducer.js.map +1 -1
  208. package/esm/redux/reducers/ModelCatalogReducer.js +1 -3
  209. package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
  210. package/esm/redux/reducers/NotificationReducer.js +1 -3
  211. package/esm/redux/reducers/NotificationReducer.js.map +1 -1
  212. package/esm/redux/reducers/PreferencesReducer.js +1 -3
  213. package/esm/redux/reducers/PreferencesReducer.js.map +1 -1
  214. package/esm/redux/reducers/ProgressIndicatorReducer.js +1 -3
  215. package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
  216. package/esm/redux/store/beforeRenderHooks.js +1 -3
  217. package/esm/redux/store/beforeRenderHooks.js.map +1 -1
  218. package/esm/utils/browser/Cache.js +1 -5
  219. package/esm/utils/browser/Cache.js.map +1 -1
  220. package/esm/utils/datetime/DateTimeUtil.js +45 -91
  221. package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
  222. package/esm/utils/fetch/xhr.js +1 -2
  223. package/esm/utils/fetch/xhr.js.map +1 -1
  224. package/esm/utils/helpers/repositoryResource.js +1 -3
  225. package/esm/utils/helpers/repositoryResource.js.map +1 -1
  226. package/esm/utils/helpers/sanitizeHtml.js +3 -4
  227. package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
  228. package/esm/utils/number/DecimalFormat.js +1 -2
  229. package/esm/utils/number/DecimalFormat.js.map +1 -1
  230. package/esm/utils/number/formatValue.js +1 -4
  231. package/esm/utils/number/formatValue.js.map +1 -1
  232. package/esm/utils/number/parseNumbers.js +2 -6
  233. package/esm/utils/number/parseNumbers.js.map +1 -1
  234. package/lib/constants/Settings.js +3 -14
  235. package/lib/constants/Settings.js.map +1 -1
  236. package/lib/exceptions/NotFoundException.js +1 -2
  237. package/lib/exceptions/NotFoundException.js.map +1 -1
  238. package/lib/hooks/useI18n.js +1 -6
  239. package/lib/hooks/useI18n.js.map +1 -1
  240. package/lib/hooks/useModal.js +3 -4
  241. package/lib/hooks/useModal.js.map +1 -1
  242. package/lib/hooks/useModelCatalog.js +10 -30
  243. package/lib/hooks/useModelCatalog.js.map +1 -1
  244. package/lib/hooks/useModularUI.js +4 -5
  245. package/lib/hooks/useModularUI.js.map +1 -1
  246. package/lib/hooks/useModularUIBasic.js +7 -8
  247. package/lib/hooks/useModularUIBasic.js.map +1 -1
  248. package/lib/i18n/Locale.js +2 -5
  249. package/lib/i18n/Locale.js.map +1 -1
  250. package/lib/i18n/Locales.js +2 -5
  251. package/lib/i18n/Locales.js.map +1 -1
  252. package/lib/i18n/Message.js +9 -10
  253. package/lib/i18n/Message.js.map +1 -1
  254. package/lib/i18n/withMessage.js +1 -6
  255. package/lib/i18n/withMessage.js.map +1 -1
  256. package/lib/models/actions/ActionCollection.js +3 -6
  257. package/lib/models/actions/ActionCollection.js.map +1 -1
  258. package/lib/models/actions/ActionModel.js +1 -4
  259. package/lib/models/actions/ActionModel.js.map +1 -1
  260. package/lib/models/application/ApplicationModel.js +2 -2
  261. package/lib/models/application/ApplicationModel.js.map +1 -1
  262. package/lib/models/attributes/AttributeCollection.js +4 -14
  263. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  264. package/lib/models/attributes/AttributeDataHelper.js +1 -2
  265. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  266. package/lib/models/attributes/AttributeSetModel.js +1 -5
  267. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  268. package/lib/models/attributes/CaptchaAttributeModel.js +2 -2
  269. package/lib/models/attributes/CaptchaAttributeModel.js.map +1 -1
  270. package/lib/models/attributes/ChoiceAttributeModel.js +1 -3
  271. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  272. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +3 -9
  273. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  274. package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -8
  275. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  276. package/lib/models/attributes/PasswordAttributeModel.js +2 -2
  277. package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
  278. package/lib/models/attributes/UploadAttributeModel.js +2 -2
  279. package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
  280. package/lib/models/attributes/input-constraints/ConstraintCollection.js +1 -2
  281. package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
  282. package/lib/models/attributes/input-constraints/ConstraintModel.js +1 -2
  283. package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
  284. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js +1 -4
  285. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
  286. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js +1 -6
  287. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  288. package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js +1 -4
  289. package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
  290. package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +1 -2
  291. package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
  292. package/lib/models/attributes/layouthint-rules/DependentAttribute.js +2 -2
  293. package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
  294. package/lib/models/base/BaseCollection.js +1 -2
  295. package/lib/models/base/BaseCollection.js.map +1 -1
  296. package/lib/models/base/BaseModel.js +6 -9
  297. package/lib/models/base/BaseModel.js.map +1 -1
  298. package/lib/models/base/ResourceModel.js +1 -2
  299. package/lib/models/base/ResourceModel.js.map +1 -1
  300. package/lib/models/concepts/BusinessScenarioModel.js +2 -2
  301. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  302. package/lib/models/concepts/ConceptDetailModel.js +1 -2
  303. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  304. package/lib/models/concepts/ConceptLinkModel.js +1 -3
  305. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  306. package/lib/models/concepts/ConceptRelationCollection.js +1 -4
  307. package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
  308. package/lib/models/concepts/ConceptRelationModel.js +1 -3
  309. package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
  310. package/lib/models/concepts/SourceReferenceCollection.js +1 -4
  311. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  312. package/lib/models/concepts/SourceReferenceModel.js +7 -3
  313. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  314. package/lib/models/content/ContentLinkModel.js +1 -3
  315. package/lib/models/content/ContentLinkModel.js.map +1 -1
  316. package/lib/models/content/ContentTOCModel.js +2 -2
  317. package/lib/models/content/ContentTOCModel.js.map +1 -1
  318. package/lib/models/contentconfiguration/ContentConfigurationElements.js +1 -2
  319. package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
  320. package/lib/models/error/ErrorModel.js +1 -3
  321. package/lib/models/error/ErrorModel.js.map +1 -1
  322. package/lib/models/filters/FilterCollection.js +1 -4
  323. package/lib/models/filters/FilterCollection.js.map +1 -1
  324. package/lib/models/form/FormModel.js +3 -9
  325. package/lib/models/form/FormModel.js.map +1 -1
  326. package/lib/models/form/FormObjectModel.js +2 -4
  327. package/lib/models/form/FormObjectModel.js.map +1 -1
  328. package/lib/models/href/Href.js +3 -6
  329. package/lib/models/href/Href.js.map +1 -1
  330. package/lib/models/href/ListHref.js +1 -2
  331. package/lib/models/href/ListHref.js.map +1 -1
  332. package/lib/models/layouthint/LayoutHintCollection.js +3 -10
  333. package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
  334. package/lib/models/links/LinkCollection.js +6 -15
  335. package/lib/models/links/LinkCollection.js.map +1 -1
  336. package/lib/models/list/ListModel.js +2 -2
  337. package/lib/models/list/ListModel.js.map +1 -1
  338. package/lib/models/modelcatalog/ModelCategoryCollection.js +1 -2
  339. package/lib/models/modelcatalog/ModelCategoryCollection.js.map +1 -1
  340. package/lib/models/parameter/Parameter.js +2 -4
  341. package/lib/models/parameter/Parameter.js.map +1 -1
  342. package/lib/models/resolveModel.js +1 -2
  343. package/lib/models/resolveModel.js.map +1 -1
  344. package/lib/models/sorting/SortingModel.js +1 -2
  345. package/lib/models/sorting/SortingModel.js.map +1 -1
  346. package/lib/models/user/UserServicesModel.js +2 -2
  347. package/lib/models/user/UserServicesModel.js.map +1 -1
  348. package/lib/modularui/Authenticate.js +4 -6
  349. package/lib/modularui/Authenticate.js.map +1 -1
  350. package/lib/modularui/ModularUIRequest.js +1 -2
  351. package/lib/modularui/ModularUIRequest.js.map +1 -1
  352. package/lib/react/ErrorBoundary.js +2 -2
  353. package/lib/react/ErrorBoundary.js.map +1 -1
  354. package/lib/react/ErrorBoundaryFallback.js +13 -16
  355. package/lib/react/ErrorBoundaryFallback.js.map +1 -1
  356. package/lib/react/utils.js +1 -3
  357. package/lib/react/utils.js.map +1 -1
  358. package/lib/react-client/Init.js +20 -23
  359. package/lib/react-client/Init.js.map +1 -1
  360. package/lib/react-client/client.js +9 -13
  361. package/lib/react-client/client.js.map +1 -1
  362. package/lib/react-server/renderSSRComplete.js +9 -10
  363. package/lib/react-server/renderSSRComplete.js.map +1 -1
  364. package/lib/react-server/renderSSRMinimal.js +7 -8
  365. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  366. package/lib/react-server/serverNoSSR.js +11 -12
  367. package/lib/react-server/serverNoSSR.js.map +1 -1
  368. package/lib/react-server/serverSSR.js +11 -12
  369. package/lib/react-server/serverSSR.js.map +1 -1
  370. package/lib/react-server/serverUtil.js +1 -3
  371. package/lib/react-server/serverUtil.js.map +1 -1
  372. package/lib/react-theme/ThemeProvider.js +7 -11
  373. package/lib/react-theme/ThemeProvider.js.map +1 -1
  374. package/lib/react-theme/createTheme.js +3 -10
  375. package/lib/react-theme/createTheme.js.map +1 -1
  376. package/lib/react-theme/utils/background.js +3 -4
  377. package/lib/react-theme/utils/background.js.map +1 -1
  378. package/lib/react-theme/utils/colors.js +7 -16
  379. package/lib/react-theme/utils/colors.js.map +1 -1
  380. package/lib/react-theme/utils/contrast.js +11 -19
  381. package/lib/react-theme/utils/contrast.js.map +1 -1
  382. package/lib/react-theme/utils/corners.js +10 -16
  383. package/lib/react-theme/utils/corners.js.map +1 -1
  384. package/lib/react-theme/utils/spacers.js +15 -38
  385. package/lib/react-theme/utils/spacers.js.map +1 -1
  386. package/lib/react-theme/utils/themeProps.js +7 -22
  387. package/lib/react-theme/utils/themeProps.js.map +1 -1
  388. package/lib/redux/_i18n/I18nReducer.js +5 -8
  389. package/lib/redux/_i18n/I18nReducer.js.map +1 -1
  390. package/lib/redux/_modularui/ModularUIActions.js +19 -23
  391. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  392. package/lib/redux/_modularui/ModularUIConnector.js +4 -5
  393. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  394. package/lib/redux/_modularui/ModularUIReducer.js +14 -19
  395. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  396. package/lib/redux/_modularui/ModularUIUtils.js +1 -2
  397. package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
  398. package/lib/redux/_modularui/withModularUI.js +1 -2
  399. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  400. package/lib/redux/_router/RouterReducer.js +1 -3
  401. package/lib/redux/_router/RouterReducer.js.map +1 -1
  402. package/lib/redux/actions/FormAttributeSet.js +34 -37
  403. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  404. package/lib/redux/actions/FormAutosubmit.js +1 -2
  405. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  406. package/lib/redux/actions/Preferences.js +8 -15
  407. package/lib/redux/actions/Preferences.js.map +1 -1
  408. package/lib/redux/connectors/CaseView.js +3 -6
  409. package/lib/redux/connectors/CaseView.js.map +1 -1
  410. package/lib/redux/connectors/ConceptDetail.js +4 -7
  411. package/lib/redux/connectors/ConceptDetail.js.map +1 -1
  412. package/lib/redux/connectors/ContentBrowser.js +3 -6
  413. package/lib/redux/connectors/ContentBrowser.js.map +1 -1
  414. package/lib/redux/connectors/ContentDetail.js +4 -7
  415. package/lib/redux/connectors/ContentDetail.js.map +1 -1
  416. package/lib/redux/connectors/ContentDetailSection.js +5 -8
  417. package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
  418. package/lib/redux/connectors/Form.js +4 -5
  419. package/lib/redux/connectors/Form.js.map +1 -1
  420. package/lib/redux/connectors/FormAttributeSet.js +5 -8
  421. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  422. package/lib/redux/connectors/ListDetail.js +3 -6
  423. package/lib/redux/connectors/ListDetail.js.map +1 -1
  424. package/lib/redux/connectors/ModelCatalog.js +3 -6
  425. package/lib/redux/connectors/ModelCatalog.js.map +1 -1
  426. package/lib/redux/connectors/PanelRenderer.js +5 -6
  427. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  428. package/lib/redux/connectors/QuickSearch.js +3 -6
  429. package/lib/redux/connectors/QuickSearch.js.map +1 -1
  430. package/lib/redux/connectors/Tab.js +3 -6
  431. package/lib/redux/connectors/Tab.js.map +1 -1
  432. package/lib/redux/reducers/AuthReducer.js +1 -3
  433. package/lib/redux/reducers/AuthReducer.js.map +1 -1
  434. package/lib/redux/reducers/ErrorReducer.js +1 -3
  435. package/lib/redux/reducers/ErrorReducer.js.map +1 -1
  436. package/lib/redux/reducers/ModalsReducer.js +1 -3
  437. package/lib/redux/reducers/ModalsReducer.js.map +1 -1
  438. package/lib/redux/reducers/ModelCatalogReducer.js +1 -3
  439. package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
  440. package/lib/redux/reducers/NotificationReducer.js +1 -3
  441. package/lib/redux/reducers/NotificationReducer.js.map +1 -1
  442. package/lib/redux/reducers/PreferencesReducer.js +1 -3
  443. package/lib/redux/reducers/PreferencesReducer.js.map +1 -1
  444. package/lib/redux/reducers/ProgressIndicatorReducer.js +1 -3
  445. package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
  446. package/lib/redux/store/beforeRenderHooks.js +1 -3
  447. package/lib/redux/store/beforeRenderHooks.js.map +1 -1
  448. package/lib/utils/browser/Cache.js +1 -5
  449. package/lib/utils/browser/Cache.js.map +1 -1
  450. package/lib/utils/datetime/DateTimeUtil.js +45 -91
  451. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  452. package/lib/utils/fetch/xhr.js +1 -2
  453. package/lib/utils/fetch/xhr.js.map +1 -1
  454. package/lib/utils/helpers/repositoryResource.js +1 -3
  455. package/lib/utils/helpers/repositoryResource.js.map +1 -1
  456. package/lib/utils/helpers/sanitizeHtml.js +3 -4
  457. package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
  458. package/lib/utils/number/DecimalFormat.js +1 -2
  459. package/lib/utils/number/DecimalFormat.js.map +1 -1
  460. package/lib/utils/number/formatValue.js +1 -4
  461. package/lib/utils/number/formatValue.js.map +1 -1
  462. package/lib/utils/number/parseNumbers.js +2 -6
  463. package/lib/utils/number/parseNumbers.js.map +1 -1
  464. package/package.json +23 -23
  465. package/src/models/concepts/SourceReferenceModel.js +6 -0
  466. package/src/modularui/Authenticate.js +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","Href","method","HTTP_METHODS","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","retryCount","arguments","length","undefined","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_promise","default","resolve","setTimeout","startProgress","loadModelPromise","then","finishProgress","catch","handleError","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAmBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEO,MAAMO,UAAU,GACrBC,MAAqD,KAChC;EACrBJ,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEG;AACX,CAAC,CAAC;;AAEF;AAC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,CAAC,CAAC;MACrE,IAAID,kBAAkB,IAAIZ,UAAU,GAAG,CAAC,EAAE;QACxC,OAAO,IAAAc,QAAA,CAAAC,OAAA,CAAaC,OAAO,IAAK;UAC9BC,UAAU,CAAC,MAAM;YACfD,OAAO,CACLX,QAAQ,CACNN,aAAa,CAACrD,GAAG,EAAEuB,IAAI,EAAEC,OAAO,EAAE8B,UAAU,GAAG,CAAC,EAAEI,UAAU,CAC9D,CACF,CAAC;UACH,CAAC,EAAEA,UAAU,CAAC;QAChB,CAAC,CAAC;MACJ;;MAEA;MACA,OAAOU,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAAC,CAAC;IAC1B;IAEAX,QAAQ,CAAC,IAAAa,gCAAa,EAAC,CAAC,CAAC;IAEzB,MAAMC,gBAAgB,GAAGd,QAAQ,CAACrC,SAAS,CAACtB,GAAG,EAAEuB,IAAI,EAAEC,OAAO,CAAC,CAAC;IAEhE,OAAO4C,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAACG,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMf,QAAQ,CAAC,IAAAgB,iCAAc,EAAC,CAAC,CAAC,CAAC,CACtCC,KAAK,CAAE9B,KAAK,IAAKa,QAAQ,CAAC,IAAAkB,kBAAW,EAAC/B,KAAK,CAAC,CAAC,CAAC;EACnD,CAAC;AAAA;;AAEH;AACA;AADAzC,OAAA,CAAAgD,aAAA,GAAAA,aAAA;AAEO,MAAMyB,WAAW,GAAGA,CACzB7E,KAAqB,EACrBuB,OAAiC,KAEjC6B,aAAa,CAACpD,KAAK,CAACC,UAAU,EAAED,KAAK,CAAC8E,QAAQ,EAAE;EAC9C,GAAGvD,OAAO;EACVkB,QAAQ,EAAE;AACZ,CAAC,CAAC;AAACrC,OAAA,CAAAyE,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","Href","method","HTTP_METHODS","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","retryCount","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_promise","default","resolve","setTimeout","startProgress","loadModelPromise","then","finishProgress","catch","handleError","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAmBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,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rC,OAAA,CAAAsE,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -36,11 +36,10 @@ const patchUpdateModelOption = oldOptions => {
36
36
 
37
37
  /**
38
38
  */
39
- const modularUIConnector = function (name, resource) {
40
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
41
- propName: "data",
42
- removeOnUnmount: false
43
- };
39
+ const modularUIConnector = (name, resource, options = {
40
+ propName: "data",
41
+ removeOnUnmount: false
42
+ }) => {
44
43
  const {
45
44
  propName = "data",
46
45
  removeOnUnmount = false,
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","arguments","length","undefined","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\nimport FormModel from \"../../models/form/FormModel\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n // explicit property for removeOnMount overwrite the setting\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, {\n ...patchUpdateModelOption(otherOptions),\n isReload: true,\n }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (finalRemoveOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey, finalRemoveOnUnmount]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry?.model ?? null,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAMA,IAAAU,UAAA,GAAAL,sBAAA,CAAAL,OAAA;AAAoD,IAAAW,WAAA,GAAAX,OAAA;AAcpD,MAAMY,sBAAsB,GAAIC,UAAkB,IAAK;EACrD,IACE,aAAa,IAAIA,UAAU,IAC3BA,UAAU,CAACC,WAAW,YAAYC,kBAAS,EAC3C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,GAAGgB,UAAU,EAAEG,KAAK,IAAI,IAAI;QACrCV,QAAQ;QACR6B,MAAM,EAAEtB,UAAU,EAAEsB,MAAM,IAAI,IAAI;QAClCC,gBAAgB,EAAEvB,UAAU,EAAEuB,gBAAgB,IAAI,IAAI;QACtDC,QAAQ,EAAEC,OAAO,CAACzB,UAAU,CAAC;QAC7BmB,MAAM;QACNO,cAAc,EAAElB,WAAW;QAC3BD,WAAW,EAAEF;MACf,CAAC;MAED,oBAAO,IAAAtC,WAAA,CAAA4D,GAAA,EAACxC,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMgC;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDjC,gBAAgB,CAACS,WAAW,GAAG,gBAAgB,IAAAC,qBAAc,EAC3DV,gBAAgB,EAChBV,IACF,CAAC,EAAE;IAEH,OAAOU,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEarD,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\nimport FormModel from \"../../models/form/FormModel\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n // explicit property for removeOnMount overwrite the setting\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, {\n ...patchUpdateModelOption(otherOptions),\n isReload: true,\n }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (finalRemoveOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey, finalRemoveOnUnmount]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry?.model ?? null,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;A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AE,CAACX,QAAQ,EAAEW,QAAQ,EAAEZ,oBAAoB,CAAC,CAAC;;MAE9C;MACA,MAAM6B,MAAM,GAAG,IAAAC,kBAAS,EAAC,CAAC;MAC1B,MAAMC,QAAuB,GAAG;QAC9BnB,QAAQ;QACR,CAAClB,QAAQ,GAAGgB,UAAU,EAAEG,KAAK,IAAI,IAAI;QACrCV,QAAQ;QACR6B,MAAM,EAAEtB,UAAU,EAAEsB,MAAM,IAAI,IAAI;QAClCC,gBAAgB,EAAEvB,UAAU,EAAEuB,gBAAgB,IAAI,IAAI;QACtDC,QAAQ,EAAEC,OAAO,CAACzB,UAAU,CAAC;QAC7BmB,MAAM;QACNO,cAAc,EAAElB,WAAW;QAC3BD,WAAW,EAAEF;MACf,CAAC;MAED,oBAAO,IAAAnC,WAAA,CAAAyD,GAAA,EAACxC,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMgC;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDjC,gBAAgB,CAACS,WAAW,GAAG,gBAAgB,IAAAC,qBAAc,EAC3DV,gBAAgB,EAChBP,IACF,CAAC,EAAE;IAEH,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalD,kBAAkB","ignoreList":[]}
@@ -12,12 +12,11 @@ var _Constants = require("../../constants/Constants");
12
12
  var _models = require("../../models");
13
13
  /**
14
14
  */
15
- const updateStatus = (state, _ref) => {
16
- let {
17
- key,
18
- status,
19
- requestOptions
20
- } = _ref;
15
+ const updateStatus = (state, {
16
+ key,
17
+ status,
18
+ requestOptions
19
+ }) => {
21
20
  // model should always be available when status is not loading
22
21
  if (status !== _Constants.MODULARUI_STATUS.LOADING && !state[key]) {
23
22
  return state;
@@ -35,11 +34,10 @@ const updateStatus = (state, _ref) => {
35
34
 
36
35
  /**
37
36
  */
38
- const setModel = (state, _ref2) => {
39
- let {
40
- key,
41
- model
42
- } = _ref2;
37
+ const setModel = (state, {
38
+ key,
39
+ model
40
+ }) => {
43
41
  if (!state[key]) {
44
42
  return state;
45
43
  }
@@ -64,11 +62,10 @@ const setModel = (state, _ref2) => {
64
62
  */
65
63
  const initModularUI = (state, models) => {
66
64
  const newState = (0, _assign.default)({}, state);
67
- models.forEach(_ref3 => {
68
- let {
69
- key,
70
- model
71
- } = _ref3;
65
+ models.forEach(({
66
+ key,
67
+ model
68
+ }) => {
72
69
  newState[key] = {
73
70
  status: _Constants.MODULARUI_STATUS.FINISHED,
74
71
  lastModification: Date.now(),
@@ -131,9 +128,7 @@ const initialState = {};
131
128
  /**
132
129
  * Modular UI Reducer
133
130
  */
134
- const ModularUIReducer = function () {
135
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
136
- let action = arguments.length > 1 ? arguments[1] : undefined;
131
+ const ModularUIReducer = (state = initialState, action) => {
137
132
  if (!action) {
138
133
  return state;
139
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIReducer.js","names":["_Constants","require","_models","updateStatus","state","_ref","key","status","requestOptions","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","_ref2","model","FINISHED","console","debug","initModularUI","models","newState","_assign","default","forEach","_ref3","getModelKey","_context","_find","_keys","call","connectKey","updateModel","modelKey","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","arguments","length","undefined","action","type","payload","exports"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n {\n key,\n status,\n requestOptions,\n }: {\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n },\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n requestOptions: requestOptions || state[key]?.requestOptions,\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel },\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n },\n };\n }\n\n // eslint-disable-next-line no-console\n console.debug(\"No model for setModel\");\n return state;\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>,\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`,\n );\n return state;\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAOA;AACA;AACA,MAAME,YAAY,GAAGA,CACnBC,KAAqB,EAAAC,IAAA,KAUlB;EAAA,IATH;IACEC,GAAG;IACHC,MAAM;IACNC;EAKF,CAAC,GAAAH,IAAA;EAED;EACA,IAAIE,MAAM,KAAKE,2BAAgB,CAACC,OAAO,IAAI,CAACN,KAAK,CAACE,GAAG,CAAC,EAAE;IACtD,OAAOF,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACE,GAAG,GAAG;MACL,GAAGF,KAAK,CAACE,GAAG,CAAC;MACbC,MAAM;MACNI,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MAC5BL,cAAc,EAAEA,cAAc,IAAIJ,KAAK,CAACE,GAAG,CAAC,EAAEE;IAChD;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMM,QAAQ,GAAGA,CACfV,KAAqB,EAAAW,KAAA,KAElB;EAAA,IADH;IAAET,GAAG;IAAEU;EAA+C,CAAC,GAAAD,KAAA;EAEvD,IAAI,CAACX,KAAK,CAACE,GAAG,CAAC,EAAE;IACf,OAAOF,KAAK;EACd;EAEA,IAAIY,KAAK,EAAE;IACT,OAAO;MACL,GAAGZ,KAAK;MACR,CAACE,GAAG,GAAG;QACL,GAAGF,KAAK,CAACE,GAAG,CAAC;QACbU,KAA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CAACE,OAAO,CAAC;IAE7C,KAAK,iBAAiB;MACpB,OAAOT,cAAc,CAAChC,KAAK,CAAC;IAE9B,KAAK,kBAAkB;MACrB,OAAOD,YAAY,CAACC,KAAK,EAAEuC,MAAM,CAACE,OAAO,CAAC;IAE5C,KAAK,eAAe;MAClB,OAAO/B,QAAQ,CAACV,KAAK,EAAEuC,MAAM,CAACE,OAAO,CAAC;IAExC,KAAK,kBAAkB;IACvB,KAAK,uBAAuB;MAC1B,OAAOZ,WAAW,CAAC7B,KAAK,EAAEuC,MAAM,CAACE,OAAO,CAAC;IAE3C,KAAK,sBAAsB;MACzB,OAAOV,SAAS,CAACQ,MAAM,CAACE,OAAO,EAAEzC,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAChB;AACF,CAAC;AAAC0C,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIReducer.js","names":["_Constants","require","_models","updateStatus","state","key","status","requestOptions","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","model","FINISHED","console","debug","initModularUI","models","newState","_assign","default","forEach","getModelKey","_context","_find","_keys","call","connectKey","updateModel","modelKey","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","action","type","payload","exports"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n {\n key,\n status,\n requestOptions,\n }: {\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n },\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n requestOptions: requestOptions || state[key]?.requestOptions,\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel },\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n },\n };\n }\n\n // eslint-disable-next-line no-console\n console.debug(\"No model for setModel\");\n return state;\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>,\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`,\n );\n return state;\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAOA;AACA;AACA,MAAME,YAAY,GAAGA,CACnBC,KAAqB,EACrB;EACEC,GAAG;EACHC,MAAM;EACNC;AAKF,CAAC,KACE;EACH;EACA,IAAID,MAAM,KAAKE,2BAAgB,CAACC,OAAO,IAAI,CAACL,KAAK,CAACC,GAAG,CAAC,EAAE;IACtD,OAAOD,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACC,GAAG,GAAG;MACL,GAAGD,KAAK,CAACC,GAAG,CAAC;MACbC,MAAM;MACNI,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MAC5BL,cAAc,EAAEA,cAAc,IAAIH,KAAK,CAACC,GAAG,CAAC,EAAEE;IAChD;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMM,QAAQ,GAAGA,CACfT,KAAqB,EACrB;EAAEC,GAAG;EAAES;AAA+C,CAAC,KACpD;EACH,IAAI,CAACV,KAAK,CAACC,GAAG,CAAC,EAAE;IACf,OAAOD,KAAK;EACd;EAEA,IAAIU,KAAK,EAAE;IACT,OAAO;MACL,GAAGV,KAAK;MACR,CAACC,GAAG,GAAG;QACL,GAAGD,KAAK,CAACC,GAAG,CAAC;QACbS,KAAK;QACLJ,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;QAC5BN,MAAM,EAAEE,2BAAgB,CAACO;MAC3B;IACF,CAAC;EACH;;EAEA;EACAC,OAAO,CAACC,K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ACE,OAAO,CAAC;IAE3C,KAAK,sBAAsB;MACzB,OAAOP,SAAS,CAACK,MAAM,CAACE,OAAO,EAAEnC,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAChB;AACF,CAAC;AAACoC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -70,8 +70,7 @@ const getKey = (WrappedComponent, name, url) => {
70
70
  * Check if the model corresponding to a modular ui service should be reloaded
71
71
  */
72
72
  exports.getKey = getKey;
73
- const useReload = function (modelEntry) {
74
- let reload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
73
+ const useReload = (modelEntry, reload = 0) => {
75
74
  if (reload > 0) {
76
75
  const isFullyLoaded = modelEntry?.status === _Constants.MODULARUI_STATUS.FINISHED;
77
76
  const lastModification = modelEntry?.lastModification ?? 0;
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIUtils.js","names":["_react","require","_utils","_Constants","_Href","_interopRequireDefault","getUrl","resource","props","url","Href","useUrl","_context","previousUrl","setPreviousUrl","useState","previousExact","setPreviousExact","match","equalsWithParameters","isExact","Function","call","bind","_startsWith","default","exports","getKey","WrappedComponent","name","getDisplayName","split","useReload","modelEntry","reload","arguments","length","undefined","isFullyLoaded","status","MODULARUI_STATUS","FINISHED","lastModification"],"sources":["../../../src/redux/_modularui/ModularUIUtils.js"],"sourcesContent":["// @flow\nimport { useState } from \"react\";\n\nimport { getDisplayName } from \"../../react/utils\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Generate modular ui url\n */\nconst getUrl = (resource: string | Function | Href, props: Object): Href => {\n const url = typeof resource === \"function\" ? resource(props) : resource;\n\n if (url instanceof Href) {\n return url;\n }\n\n return new Href(url);\n};\n\n/**\n */\nexport const useUrl = (\n resource: string | Function | Href,\n props: Object,\n): Href => {\n const [previousUrl, setPreviousUrl] = useState(null);\n const [previousExact, setPreviousExact] = useState(false);\n\n const url = getUrl(resource, props);\n\n if (url == null && previousUrl == null) {\n return new Href(\"\");\n }\n\n const { match } = props;\n\n // when match is not available through props,\n // this is a direct call to the modular ui hoc, not using a route\n if (!match) {\n return url;\n }\n\n if (url.equalsWithParameters(previousUrl)) {\n return previousUrl || url;\n }\n\n // Always create an url when the match is exact\n // Or when the match is not exact AND the original match also was not exact\n // Or when the new start uri is different from the previous url --> different resource for same panel\n if (\n match.isExact === true ||\n previousExact === match.isExact ||\n !previousUrl?.startsWith(match.url)\n ) {\n setPreviousUrl(url);\n setPreviousExact(match.isExact);\n\n return url;\n }\n\n return previousUrl || new Href(\"\");\n};\n\n/**\n * Create key for modularui request based on component name and requested url\n */\nexport const getKey = (\n WrappedComponent: ComponentType<any>,\n name: string,\n url: string,\n): string => {\n if (url) {\n return `${getDisplayName(WrappedComponent, name)}(${url.split(\"?\")[0]})`;\n }\n\n return getDisplayName(WrappedComponent, name);\n};\n\n/**\n * Check if the model corresponding to a modular ui service should be reloaded\n */\nexport const useReload = (modelEntry: Object, reload: number = 0): boolean => {\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAIA;AACA;AACA;AACA,MAAMK,MAAM,GAAGA,CAACC,QAAkC,EAAEC,KAAa,KAAW;EAC1E,MAAMC,GAAG,GAAG,OAAOF,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACC,KAAK,CAAC,GAAGD,QAAQ;EAEvE,IAAIE,GAAG,YAAYC,aAAI,EAAE;IACvB,OAAOD,GAAG;EACZ;EAEA,OAAO,IAAIC,aAAI,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,GAAW,KACA;EACX,IAAIA,GAAG,EAAE;IACP,OAAO,GAAG,IAAAqB,qBAAc,EAACF,gBAAgB,EAAEC,IAAI,CAAC,IAAIpB,GAAG,CAACsB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;EAC1E;EAEA,OAAO,IAAAD,qBAAc,EAACF,gBAAgB,EAAEC,IAAI,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AAFAH,OAAA,CAAAC,MAAA,GAAAA,MAAA;AAGO,MAAMK,SAAS,GAAG,SAAAA,CAACC,UAAkB,EAAkC;EAAA,IAAhCC,MAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC9D,IAAID,MAAM,GAAG,CAAC,EAAE;IACd,MAAMI,aAAa,GAAGL,UAAU,EAAEM,MAAM,KAAKC,2BAAgB,CAACC,QAAQ;IACtE,MAAMC,gBAAgB,GAAGT,UAAU,EAAES,gBAAgB,IAAI,CAAC;IAE1D,IAAIJ,aAAa,IAAII,gBAAgB,GAAGR,MAAM,EAAE;MAC9C,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC;AAACR,OAAA,CAAAM,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIUtils.js","names":["_react","require","_utils","_Constants","_Href","_interopRequireDefault","getUrl","resource","props","url","Href","useUrl","_context","previousUrl","setPreviousUrl","useState","previousExact","setPreviousExact","match","equalsWithParameters","isExact","Function","call","bind","_startsWith","default","exports","getKey","WrappedComponent","name","getDisplayName","split","useReload","modelEntry","reload","isFullyLoaded","status","MODULARUI_STATUS","FINISHED","lastModification"],"sources":["../../../src/redux/_modularui/ModularUIUtils.js"],"sourcesContent":["// @flow\nimport { useState } from \"react\";\n\nimport { getDisplayName } from \"../../react/utils\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Generate modular ui url\n */\nconst getUrl = (resource: string | Function | Href, props: Object): Href => {\n const url = typeof resource === \"function\" ? resource(props) : resource;\n\n if (url instanceof Href) {\n return url;\n }\n\n return new Href(url);\n};\n\n/**\n */\nexport const useUrl = (\n resource: string | Function | Href,\n props: Object,\n): Href => {\n const [previousUrl, setPreviousUrl] = useState(null);\n const [previousExact, setPreviousExact] = useState(false);\n\n const url = getUrl(resource, props);\n\n if (url == null && previousUrl == null) {\n return new Href(\"\");\n }\n\n const { match } = props;\n\n // when match is not available through props,\n // this is a direct call to the modular ui hoc, not using a route\n if (!match) {\n return url;\n }\n\n if (url.equalsWithParameters(previousUrl)) {\n return previousUrl || url;\n }\n\n // Always create an url when the match is exact\n // Or when the match is not exact AND the original match also was not exact\n // Or when the new start uri is different from the previous url --> different resource for same panel\n if (\n match.isExact === true ||\n previousExact === match.isExact ||\n !previousUrl?.startsWith(match.url)\n ) {\n setPreviousUrl(url);\n setPreviousExact(match.isExact);\n\n return url;\n }\n\n return previousUrl || new Href(\"\");\n};\n\n/**\n * Create key for modularui request based on component name and requested url\n */\nexport const getKey = (\n WrappedComponent: ComponentType<any>,\n name: string,\n url: string,\n): string => {\n if (url) {\n return `${getDisplayName(WrappedComponent, name)}(${url.split(\"?\")[0]})`;\n }\n\n return getDisplayName(WrappedComponent, name);\n};\n\n/**\n * Check if the model corresponding to a modular ui service should be reloaded\n */\nexport const useReload = (modelEntry: Object, reload: number = 0): boolean => {\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAIA;AACA;A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BAAgB,CAACC,KAAK,CAACE,OAAO,CAAC;IAE/B,OAAOX,GAAG;EACZ;EAEA,OAAOI,WAAW,IAAI,IAAIH,aAAI,CAAC,EAAE,CAAC;AACpC,CAAC;;AAED;AACA;AACA;AAFAgB,OAAA,CAAAf,MAAA,GAAAA,MAAA;AAGO,MAAMgB,MAAM,GAAGA,CACpBC,gBAAoC,EACpCC,IAAY,EACZpB,GAAW,KACA;EACX,IAAIA,GAAG,EAAE;IACP,OAAO,GAAG,IAAAqB,qBAAc,EAACF,gBAAgB,EAAEC,IAAI,CAAC,IAAIpB,GAAG,CAACsB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;EAC1E;EAEA,OAAO,IAAAD,qBAAc,EAACF,gBAAgB,EAAEC,IAAI,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AAFAH,OAAA,CAAAC,MAAA,GAAAA,MAAA;AAGO,MAAMK,SAAS,GAAGA,CAACC,UAAkB,EAAEC,MAAc,GAAG,CAAC,KAAc;EAC5E,IAAIA,MAAM,GAAG,CAAC,EAAE;IACd,MAAMC,aAAa,GAAGF,UAAU,EAAEG,MAAM,KAAKC,2BAAgB,CAACC,QAAQ;IACtE,MAAMC,gBAAgB,GAAGN,UAAU,EAAEM,gBAAgB,IAAI,CAAC;IAE1D,IAAIJ,aAAa,IAAII,gBAAgB,GAAGL,MAAM,EAAE;MAC9C,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC;AAACR,OAAA,CAAAM,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -12,8 +12,7 @@ var _ProgressIndicator = require("../actions/ProgressIndicator");
12
12
  var _Error = require("../actions/Error");
13
13
  var _i18n = require("../selectors/i18n");
14
14
  var _ModularUIActions = require("./ModularUIActions");
15
- const modularui = (0, _reselect.createSelector)([_i18n.getLocale], localeCode => function (href) {
16
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15
+ const modularui = (0, _reselect.createSelector)([_i18n.getLocale], localeCode => (href, options = {}) => {
17
16
  const modularuiRequest = new _ModularUIRequest.default(href, options);
18
17
  modularuiRequest.locale = localeCode;
19
18
  return modularuiRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"withModularUI.js","names":["_reactRedux","require","_reselect","_ModularUIRequest","_interopRequireDefault","_ProgressIndicator","_Error","_i18n","_ModularUIActions","modularui","createSelector","getLocale","localeCode","href","options","arguments","length","undefined","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect","_default","exports","default"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\ntype StateProps = {\n modularui: (href: Href, options: any) => ModularUIRequest,\n locale: string,\n};\n\ntype DispatchProps = {\n startProgress: () => StartProgressAction,\n finishProgress: () => FinishProgressAction,\n reloadModel: (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n ) => ThunkAction,\n handleError: (error: Error | FetchException) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst modularui = createSelector(\n [getLocale],\n (localeCode) =>\n (href, options = {}) => {\n const modularuiRequest = new ModularUIRequest(href, options);\n modularuiRequest.locale = localeCode;\n return modularuiRequest;\n },\n);\n\n/**\n */\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n modularui: modularui(state),\n locale: state.i18n.locale,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n startProgress,\n finishProgress,\n reloadModel,\n handleError,\n};\n\n/**\n * Injects the modular ui service and the progress start and finish actions\n * This can be used to request modular ui services inside react view components\n */\nconst withModularui: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _,\n>(mapStateToProps, mapDispatchToProps);\n\nexport default withModularui;\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,iBAAA,GAAAP,OAAA;AAkCA,MAAMQ,SAAS,GAAG,IAAAC,wBAAc,EAC9B,CAACC,eAAS,CAAC,EACVC,UAAU,IACT,UAACC,IAAI,EAAmB;EAAA,IAAjBC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACjB,MAAMG,gBAAgB,GAAG,IAAIC,yBAAgB,CAACN,IAAI,EAAEC,OAAO,CAAC;EAC5DI,gBAAgB,CAACE,MAAM,GAAGR,UAAU;EACpC,OAAOM,gBAAgB;AACzB,CACJ,CAAC;;AAED;AACA;AACA,MAAMG,eAAe,GAAIC,KAAiB,KAAkB;EAC1Db,SAAS,EAAEA,SAAS,CAACa,KAAK,CAAC;EAC3BF,MAAM,EAAEE,KAAK,CAACC,IAAI,CAACH;AACrB,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,aAAa,EAAbA,gCAAa;EACbC,cAAc,EAAdA,iCAAc;EACdC,WAAW,EAAXA,6BAAW;EACXC,WAAW,EAAXA;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAiC,GAAG,IAAAC,mBAAO,EAO/CT,eAAe,EAAEG,kBAAkB,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExBJ,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"withModularUI.js","names":["_reactRedux","require","_reselect","_ModularUIRequest","_interopRequireDefault","_ProgressIndicator","_Error","_i18n","_ModularUIActions","modularui","createSelector","getLocale","localeCode","href","options","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect","_default","exports","default"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\ntype StateProps = {\n modularui: (href: Href, options: any) => ModularUIRequest,\n locale: string,\n};\n\ntype DispatchProps = {\n startProgress: () => StartProgressAction,\n finishProgress: () => FinishProgressAction,\n reloadModel: (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n ) => ThunkAction,\n handleError: (error: Error | FetchException) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst modularui = createSelector(\n [getLocale],\n (localeCode) =>\n (href, options = {}) => {\n const modularuiRequest = new ModularUIRequest(href, options);\n modularuiRequest.locale = localeCode;\n return modularuiRequest;\n },\n);\n\n/**\n */\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n modularui: modularui(state),\n locale: state.i18n.locale,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n startProgress,\n finishProgress,\n reloadModel,\n handleError,\n};\n\n/**\n * Injects the modular ui service and the progress start and finish actions\n * This can be used to request modular ui services inside react view components\n */\nconst withModularui: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _,\n>(mapStateToProps, mapDispatchToProps);\n\nexport default withModularui;\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,iBAAA,GAAAP,OAAA;AAkCA,MAAMQ,SAAS,GAAG,IAAAC,wBAAc,EAC9B,CAACC,eAAS,CAAC,EACVC,UAAU,IACT,CAACC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,KAAK;EACtB,MAAMC,gBAAgB,GAAG,IAAIC,yBAAgB,CAACH,IAAI,EAAEC,OAAO,CAAC;EAC5DC,gBAAgB,CAACE,MAAM,GAAGL,UAAU;EACpC,OAAOG,gBAAgB;AACzB,CACJ,CAAC;;AAED;AACA;AACA,MAAMG,eAAe,GAAIC,KAAiB,KAAkB;EAC1DV,SAAS,EAAEA,SAAS,CAACU,KAAK,CAAC;EAC3BF,MAAM,EAAEE,KAAK,CAACC,IAAI,CAACH;AACrB,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,aAAa,EAAbA,gCAAa;EACbC,cAAc,EAAdA,iCAAc;EACdC,WAAW,EAAXA,6BAAW;EACXC,WAAW,EAAXA;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAiC,GAAG,IAAAC,mBAAO,EAO/CT,eAAe,EAAEG,kBAAkB,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExBJ,aAAa","ignoreList":[]}
@@ -10,9 +10,7 @@ const initialState = {};
10
10
  /**
11
11
  * Router reducer
12
12
  */
13
- const RouterReducer = function () {
14
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
15
- let action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
13
+ const RouterReducer = (state = initialState, action = null) => {
16
14
  if (action && action.type === "ROUTER/LOCATION_CHANGE") {
17
15
  return action.payload;
18
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RouterReducer.js","names":["initialState","RouterReducer","state","arguments","length","undefined","action","type","payload","exports"],"sources":["../../../src/redux/_router/RouterReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { RouterState } from \"./types\";\n\n// REDUCER\nconst initialState: $Shape<RouterState> = {};\n\n/**\n * Router reducer\n */\nexport const RouterReducer: Reducer<RouterState, ReduxAction> = (\n state = initialState,\n action = null,\n) => {\n if (action && action.type === \"ROUTER/LOCATION_CHANGE\") {\n return action.payload;\n }\n\n return state;\n};\n"],"mappings":";;;;;;AAKA;AACA,MAAMA,YAAiC,GAAG,CAAC,CAAC;;AAE5C;AACA;AACA;AACO,MAAMC,aAAgD,GAAG,SAAAA,CAAA,EAG3D;EAAA,IAFHC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGH,YAAY;EAAA,IACpBM,MAAM,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAEb,IAAIG,MAAM,IAAIA,MAAM,CAACC,IAAI,KAAK,wBAAwB,EAAE;IACtD,OAAOD,MAAM,CAACE,OAAO;EACvB;EAEA,OAAON,KAAK;AACd,CAAC;AAACO,OAAA,CAAAR,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"RouterReducer.js","names":["initialState","RouterReducer","state","action","type","payload","exports"],"sources":["../../../src/redux/_router/RouterReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { RouterState } from \"./types\";\n\n// REDUCER\nconst initialState: $Shape<RouterState> = {};\n\n/**\n * Router reducer\n */\nexport const RouterReducer: Reducer<RouterState, ReduxAction> = (\n state = initialState,\n action = null,\n) => {\n if (action && action.type === \"ROUTER/LOCATION_CHANGE\") {\n return action.payload;\n }\n\n return state;\n};\n"],"mappings":";;;;;;AAKA;AACA,MAAMA,YAAiC,GAAG,CAAC,CAAC;;AAE5C;AACA;AACA;AACO,MAAMC,aAAgD,GAAGA,CAC9DC,KAAK,GAAGF,YAAY,EACpBG,MAAM,GAAG,IAAI,KACV;EACH,IAAIA,MAAM,IAAIA,MAAM,CAACC,IAAI,KAAK,wBAAwB,EAAE;IACtD,OAAOD,MAAM,CAACE,OAAO;EACvB;EAEA,OAAOH,KAAK;AACd,CAAC;AAACI,OAAA,CAAAL,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -13,46 +13,43 @@ var _FormAutoupdate = require("./FormAutoupdate");
13
13
  /**
14
14
  * Update an attribute on a form
15
15
  */
16
- const updateFormAttribute = function (form, formObject, attribute, inputvalue) {
17
- let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
18
- autosubmit: false,
19
- autosave: false,
20
- // autosave commits the form in the background
21
- autoupdate: false,
22
- // autoupdate does not commit and updates the form with for example a new dynamicschema (work-around for form-tree iq)
23
- forceUpdate: false,
24
- validate: true
25
- };
26
- return dispatch => {
27
- const newForm = form.clone();
28
- if (options.validate === undefined) {
29
- options.validate = true;
30
- }
31
- if (newForm.currentFormObject?.equals(formObject)) {
32
- newForm.currentFormObject.updateAttribute(attribute, inputvalue);
33
- } else {
34
- newForm.completedFormObjects.forEach(completeObject => {
35
- if (completeObject.equals(formObject)) {
36
- completeObject.updateAttribute(attribute, inputvalue);
37
- }
38
- });
39
- }
40
- if (options.autosubmit && newForm.isValid) {
41
- const autosubmitAction = (0, _FormAutosubmit.autosubmitFormObject)(newForm, attribute, options.forceUpdate);
42
- if (autosubmitAction) {
43
- return dispatch(autosubmitAction);
16
+ const updateFormAttribute = (form, formObject, attribute, inputvalue, options = {
17
+ autosubmit: false,
18
+ autosave: false,
19
+ // autosave commits the form in the background
20
+ autoupdate: false,
21
+ // autoupdate does not commit and updates the form with for example a new dynamicschema (work-around for form-tree iq)
22
+ forceUpdate: false,
23
+ validate: true
24
+ }) => dispatch => {
25
+ const newForm = form.clone();
26
+ if (options.validate === undefined) {
27
+ options.validate = true;
28
+ }
29
+ if (newForm.currentFormObject?.equals(formObject)) {
30
+ newForm.currentFormObject.updateAttribute(attribute, inputvalue);
31
+ } else {
32
+ newForm.completedFormObjects.forEach(completeObject => {
33
+ if (completeObject.equals(formObject)) {
34
+ completeObject.updateAttribute(attribute, inputvalue);
44
35
  }
36
+ });
37
+ }
38
+ if (options.autosubmit && newForm.isValid) {
39
+ const autosubmitAction = (0, _FormAutosubmit.autosubmitFormObject)(newForm, attribute, options.forceUpdate);
40
+ if (autosubmitAction) {
41
+ return dispatch(autosubmitAction);
45
42
  }
46
- if (options.autoupdate && newForm.isValid) {
47
- const autoupdateAction = (0, _FormAutoupdate.autoupdateFormObject)(newForm, attribute);
48
- if (autoupdateAction) {
49
- return dispatch(autoupdateAction);
50
- }
43
+ }
44
+ if (options.autoupdate && newForm.isValid) {
45
+ const autoupdateAction = (0, _FormAutoupdate.autoupdateFormObject)(newForm, attribute);
46
+ if (autoupdateAction) {
47
+ return dispatch(autoupdateAction);
51
48
  }
52
- handleAutoSave(dispatch, newForm, options);
53
- handleValidate(dispatch, newForm, options);
54
- return dispatch((0, _ModularUIActions.updateForm)(newForm));
55
- };
49
+ }
50
+ handleAutoSave(dispatch, newForm, options);
51
+ handleValidate(dispatch, newForm, options);
52
+ return dispatch((0, _ModularUIActions.updateForm)(newForm));
56
53
  };
57
54
  exports.updateFormAttribute = updateFormAttribute;
58
55
  const handleAutoSave = (dispatch, newForm, options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"FormAttributeSet.js","names":["_ModularUIActions","require","_Settings","_FormValidations","_FormAutosave","_FormAutosubmit","_FormAutoupdate","updateFormAttribute","form","formObject","attribute","inputvalue","options","arguments","length","undefined","autosubmit","autosave","autoupdate","forceUpdate","validate","dispatch","newForm","clone","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","autosubmitFormObject","autoupdateAction","autoupdateFormObject","handleAutoSave","handleValidate","updateForm","exports","isChanged","autosaveFormObject","hasDynamicValidations","getSetting","validateFormObject"],"sources":["../../../src/redux/actions/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\nimport { autoupdateFormObject } from \"./FormAutoupdate\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false, // autosave commits the form in the background\n autoupdate: false, // autoupdate does not commit and updates the form with for example a new dynamicschema (work-around for form-tree iq)\n forceUpdate: false,\n validate: true,\n },\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (newForm.currentFormObject?.equals(formObject)) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate,\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autoupdate && newForm.isValid) {\n const autoupdateAction = autoupdateFormObject(newForm, attribute);\n if (autoupdateAction) {\n return dispatch(autoupdateAction);\n }\n }\n\n handleAutoSave(dispatch, newForm, options);\n\n handleValidate(dispatch, newForm, options);\n\n return dispatch(updateForm(newForm));\n };\n\nconst handleAutoSave = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n};\n\nconst handleValidate = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (\n options.validate &&\n newForm.currentFormObject?.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n // server form validations happens async, don't wait for the form to return\n dispatch(validateFormObject(newForm));\n }\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAOA;AACA;AACA;AACO,MAAMM,mBAAmB,GAC9B,SAAAA,CACEC,IAAe,EACfC,UAA2B,EAC3BC,SAAwB,EACxBC,UAAkB;EAAA,IAClBC,OAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IAC3BG,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE,KAAK;IAAE;IACjBC,UAA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CAAC,IAAAgB,4BAAU,EAACf,OAAO,CAAC,CAAC;EACtC,CAAC;AAAA;AAACgB,OAAA,CAAA/B,mBAAA,GAAAA,mBAAA;AAEJ,MAAM4B,cAAc,GAAGA,CACrBd,QAAkB,EAClBC,OAAkB,EAClBV,OAA0B,KACvB;EACH,IAAIA,OAAO,CAACK,QAAQ,IAAIK,OAAO,CAACQ,OAAO,IAAIR,OAAO,CAACiB,SAAS,CAAC,CAAC,EAAE;IAC9DlB,QAAQ,CAAC,IAAAmB,gCAAkB,EAAClB,OAAO,CAAC,CAAC;EACvC;AACF,CAAC;AAED,MAAMc,cAAc,GAAGA,CACrBf,QAAkB,EAClBC,OAAkB,EAClBV,OAA0B,KACvB;EACH,IACEA,OAAO,CAACQ,QAAQ,IAChBE,OAAO,CAACE,iBAAiB,EAAEiB,qBAAqB,IAChD,IAAAC,oBAAU,EAAC,+BAA+B,CAAC,EAC3C;IACA;IACArB,QAAQ,CAAC,IAAAsB,mCAAkB,EAACrB,OAAO,CAAC,CAAC;EACvC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"FormAttributeSet.js","names":["_ModularUIActions","require","_Settings","_FormValidations","_FormAutosave","_FormAutosubmit","_FormAutoupdate","updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","autoupdate","forceUpdate","validate","dispatch","newForm","clone","undefined","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","autosubmitFormObject","autoupdateAction","autoupdateFormObject","handleAutoSave","handleValidate","updateForm","exports","isChanged","autosaveFormObject","hasDynamicValidations","getSetting","validateFormObject"],"sources":["../../../src/redux/actions/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\nimport { autoupdateFormObject } from \"./FormAutoupdate\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false, // autosave commits the form in the background\n autoupdate: false, // autoupdate does not commit and updates the form with for example a new dynamicschema (work-around for form-tree iq)\n forceUpdate: false,\n validate: true,\n },\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (newForm.currentFormObject?.equals(formObject)) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate,\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autoupdate && newForm.isValid) {\n const autoupdateAction = autoupdateFormObject(newForm, attribute);\n if (autoupdateAction) {\n return dispatch(autoupdateAction);\n }\n }\n\n handleAutoSave(dispatch, newForm, options);\n\n handleValidate(dispatch, newForm, options);\n\n return dispatch(updateForm(newForm));\n };\n\nconst handleAutoSave = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n};\n\nconst handleValidate = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (\n options.validate &&\n newForm.currentFormObject?.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n // server form validations happens async, don't wait for the form to return\n dispatch(validateFormObject(newForm));\n }\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAOA;AACA;AACA;AACO,MAAMM,mBAAmB,GAC9BA,CACEC,IAAe,EACfC,UAA2B,EAC3BC,SAAwB,EACxBC,UAAkB,EAClBC,OAA0B,GAAG;EAC3BC,UAAU,EAAE,KAAK;EACjBC,QAAQ,EAAE,KAAK;EAAE;EACjBC,UAAU,EAAE,KAAK;EAAE;EACnBC,WAAW,EAAE,KAAK;EAClBC,QAAQ,EAAE;AACZ,CAAC,KAEFC,QAAkB,IAAK;EACtB,MAAMC,OAAO,GAAGX,IAAI,CAACY,KAAK,CAAC,CAAC;EAE5B,IAAIR,OAAO,CAACK,QAAQ,KAAKI,SAAS,EAAE;IAClCT,OAAO,CAACK,QAAQ,GAAG,IAAI;EACzB;EAEA,IAAIE,OAAO,CAACG,iBAAiB,EAAEC,MAAM,CAACd,UAAU,CAAC,EAAE;IACjDU,OAAO,CAACG,iBAAiB,CAACE,eAAe,CAACd,SAAS,EAAEC,UAAU,CAAC;EAClE,CAAC,MAAM;IACLQ,OAAO,CAACM,oBAAoB,CAACC,OAAO,CAAEC,cAAc,IAAK;MACvD,IAAIA,cAAc,CAACJ,MAAM,CAACd,UAAU,CAAC,EAAE;QACrCkB,cAAc,CAACH,eAAe,CAACd,SAAS,EAAEC,UAAU,CAAC;MACvD;IACF,CAAC,CAAC;EACJ;EAEA,IAAIC,OAAO,CAACC,UAAU,IAAIM,OAAO,CAACS,OAAO,EAAE;IACzC,MAAMC,gBAAgB,GAAG,IAAAC,oCAAoB,EAC3CX,OAAO,EACPT,SAAS,EACTE,OAAO,CAACI,WACV,CAAC;IACD,IAAIa,gBAAgB,EAAE;MACpB,OAAOX,QAAQ,CAACW,gBAAgB,CAAC;IACnC;EACF;EAEA,IAAIjB,OAAO,CAACG,UAAU,IAAII,OAAO,CAACS,OAAO,EAAE;IACzC,MAAMG,gBAAgB,GAAG,IAAAC,oCAAoB,EAACb,OAAO,EAAET,SAAS,CAAC;IACjE,IAAIqB,gBAAgB,EAAE;MACpB,OAAOb,QAAQ,CAACa,gBAAgB,CAAC;IACnC;EACF;EAEAE,cAAc,CAACf,QAAQ,EAAEC,OAAO,EAAEP,OAAO,CAAC;EAE1CsB,cAAc,CAAChB,QAAQ,EAAEC,OAAO,EAAEP,OAAO,CAAC;EAE1C,OAAOM,QAAQ,CAAC,IAAAiB,4BAAU,EAAChB,OAAO,CAAC,CAAC;AACtC,CAAC;AAACiB,OAAA,CAAA7B,mBAAA,GAAAA,mBAAA;AAEJ,MAAM0B,cAAc,GAAGA,CACrBf,QAAkB,EAClBC,OAAkB,EAClBP,OAA0B,KACvB;EACH,IAAIA,OAAO,CAACE,QAAQ,IAAIK,OAAO,CAACS,OAAO,IAAIT,OAAO,CAACkB,SAAS,CAAC,CAAC,EAAE;IAC9DnB,QAAQ,CAAC,IAAAoB,gCAAkB,EAACnB,OAAO,CAAC,CAAC;EACvC;AACF,CAAC;AAED,MAAMe,cAAc,GAAGA,CACrBhB,QAAkB,EAClBC,OAAkB,EAClBP,OAA0B,KACvB;EACH,IACEA,OAAO,CAACK,QAAQ,IAChBE,OAAO,CAACG,iBAAiB,EAAEiB,qBAAqB,IAChD,IAAAC,oBAAU,EAAC,+BAA+B,CAAC,EAC3C;IACA;IACAtB,QAAQ,CAAC,IAAAuB,mCAAkB,EAACtB,OAAO,CAAC,CAAC;EACvC;AACF,CAAC","ignoreList":[]}
@@ -10,8 +10,7 @@ var _Constants = require("../../constants/Constants");
10
10
  var _FormModel = _interopRequireDefault(require("../../models/form/FormModel"));
11
11
  /**
12
12
  */
13
- const autosubmitFormObject = function (form, attribute) {
14
- let forceUpdate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
13
+ const autosubmitFormObject = (form, attribute, forceUpdate = false) => {
15
14
  // As long as we have form objects,
16
15
  // and the current attribute is not found in the current form object, go back.
17
16
  // When a form has a result, the current form object is null
@@ -1 +1 @@
1
- {"version":3,"file":"FormAutosubmit.js","names":["_ModularUIActions","require","_Constants","_FormModel","_interopRequireDefault","autosubmitFormObject","form","attribute","forceUpdate","arguments","length","undefined","allObjects","currentFormObject","hasAttributeByKey","key","setPreviousObject","isChanged","loadModularUI","connectKey","selfhref","method","HTTP_METHODS","POST","data","formdata","updateHandler","newModel","FormModel","clonedModel","clone","update","exports"],"sources":["../../../src/redux/actions/FormAutosubmit.js"],"sourcesContent":["// @flow\nimport { loadModularUI } from \"../_modularui/ModularUIActions\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ModularUIModel, AttributeType } from \"../../models/types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const autosubmitFormObject = (\n form: FormModel,\n attribute: AttributeType,\n forceUpdate: boolean = false,\n): ?ThunkAction => {\n // As long as we have form objects,\n // and the current attribute is not found in the current form object, go back.\n // When a form has a result, the current form object is null\n while (\n form.allObjects.length > 0 &&\n (!form.currentFormObject ||\n !form.currentFormObject.hasAttributeByKey(attribute.key))\n ) {\n form.setPreviousObject();\n }\n\n if (form.isChanged() || forceUpdate) {\n return loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n const clonedModel: FormModel = form.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n });\n }\n\n return null;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA;AACA;AACO,MAAMI,oBAAoB,GAAG,SAAAA,CAClCC,IAAe,EACfC,SAAwB,EAEP;EAAA,IADjBC,WAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAE5B;EACA;EACA;EACA,OACEH,IAAI,CAACM,UAAU,CAACF,MAAM,GAAG,CAAC,KACzB,CAACJ,IAAI,CAACO,iBAAiB,IACtB,CAACP,IAAI,CAACO,iBAAiB,CAACC,iBAAiB,CAACP,SAAS,CAACQ,GAAG,CAAC,CAAC,EAC3D;IACAT,IAAI,CAACU,iBAAiB,CAAC,CAAC;EAC1B;EAEA,IAAIV,IAAI,CAACW,SAAS,CAAC,CAAC,IAAIT,WAAW,EAAE;IACnC,OAAO,IAAAU,+BAAa,EAACZ,IAAI,CAACa,UAAU,EAAEb,IAAI,CAACc,QAAQ,EAAE;MACnDC,MAAM,EAAEC,uBAAY,CAACC,IAAI;MACzBC,IAAI,EAAElB,IAAI,CAACmB,QAAQ;MACnBC,aAAa,EAAGC,QAAwB,IAAqB;QAC3D,IAAIA,QAAQ,YAAYC,kBAAS,EAAE;UACjC,MAAMC,WAAsB,GAAGvB,IAAI,CAACwB,KAAK,CAAC,CAAC;UAC3CD,WAAW,CAACE,MAAM,CAACJ,QAAQ,CAAC;UAC5B,OAAOE,WAAW;QACpB;QACA,OAAOF,QAAQ;MACjB;IACF,CAAC,CAAC;EACJ;EAEA,OAAO,IAAI;AACb,CAAC;AAACK,OAAA,CAAA3B,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"file":"FormAutosubmit.js","names":["_ModularUIActions","require","_Constants","_FormModel","_interopRequireDefault","autosubmitFormObject","form","attribute","forceUpdate","allObjects","length","currentFormObject","hasAttributeByKey","key","setPreviousObject","isChanged","loadModularUI","connectKey","selfhref","method","HTTP_METHODS","POST","data","formdata","updateHandler","newModel","FormModel","clonedModel","clone","update","exports"],"sources":["../../../src/redux/actions/FormAutosubmit.js"],"sourcesContent":["// @flow\nimport { loadModularUI } from \"../_modularui/ModularUIActions\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ModularUIModel, AttributeType } from \"../../models/types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const autosubmitFormObject = (\n form: FormModel,\n attribute: AttributeType,\n forceUpdate: boolean = false,\n): ?ThunkAction => {\n // As long as we have form objects,\n // and the current attribute is not found in the current form object, go back.\n // When a form has a result, the current form object is null\n while (\n form.allObjects.length > 0 &&\n (!form.currentFormObject ||\n !form.currentFormObject.hasAttributeByKey(attribute.key))\n ) {\n form.setPreviousObject();\n }\n\n if (form.isChanged() || forceUpdate) {\n return loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n const clonedModel: FormModel = form.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n });\n }\n\n return null;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA;AACA;AACO,MAAMI,oBAAoB,GAAGA,CAClCC,IAAe,EACfC,SAAwB,EACxBC,WAAoB,GAAG,KAAK,KACX;EACjB;EACA;EACA;EACA,OACEF,IAAI,CAACG,UAAU,CAACC,MAAM,GAAG,CAAC,KACzB,CAACJ,IAAI,CAACK,iBAAiB,IACtB,CAACL,IAAI,CAACK,iBAAiB,CAACC,iBAAiB,CAACL,SAAS,CAACM,GAAG,CAAC,CAAC,EAC3D;IACAP,IAAI,CAACQ,iBAAiB,CAAC,CAAC;EAC1B;EAEA,IAAIR,IAAI,CAACS,SAAS,CAAC,CAAC,IAAIP,WAAW,EAAE;IACnC,OAAO,IAAAQ,+BAAa,EAACV,IAAI,CAACW,UAAU,EAAEX,IAAI,CAACY,QAAQ,EAAE;MACnDC,MAAM,EAAEC,uBAAY,CAACC,IAAI;MACzBC,IAAI,EAAEhB,IAAI,CAACiB,QAAQ;MACnBC,aAAa,EAAGC,QAAwB,IAAqB;QAC3D,IAAIA,QAAQ,YAAYC,kBAAS,EAAE;UACjC,MAAMC,WAAsB,GAAGrB,IAAI,CAACsB,KAAK,CAAC,CAAC;UAC3CD,WAAW,CAACE,MAAM,CAACJ,QAAQ,CAAC;UAC5B,OAAOE,WAAW;QACpB;QACA,OAAOF,QAAQ;MACjB;IACF,CAAC,CAAC;EACJ;EAEA,OAAO,IAAI;AACb,CAAC;AAACK,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -14,9 +14,7 @@ var _Settings = require("../../constants/Settings");
14
14
  var _constants = require("../../constants");
15
15
  /**
16
16
  */
17
- const getServerPreferenceValue = function (preferenceName) {
18
- let defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
19
- let type = arguments.length > 2 ? arguments[2] : undefined;
17
+ const getServerPreferenceValue = (preferenceName, defaultValue = null, type) => {
20
18
  let value = null;
21
19
  if (typeof preferencesProvider !== "undefined") {
22
20
  value = preferencesProvider.getPreferenceByName(preferenceName);
@@ -33,9 +31,7 @@ const getServerPreferenceValue = function (preferenceName) {
33
31
 
34
32
  /**
35
33
  */
36
- const setServerPreference = function (propertyName) {
37
- let defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
38
- let type = arguments.length > 2 ? arguments[2] : undefined;
34
+ const setServerPreference = (propertyName, defaultValue = null, type) => {
39
35
  const value = getServerPreferenceValue(propertyName, defaultValue, type);
40
36
  return setPreference(propertyName, value);
41
37
  };
@@ -43,15 +39,12 @@ const setServerPreference = function (propertyName) {
43
39
  /**
44
40
  */
45
41
  exports.setServerPreference = setServerPreference;
46
- const setPreference = function (propertyName) {
47
- let propertyValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
48
- return {
49
- type: "SET_PREFERENCE",
50
- payload: {
51
- [propertyName]: propertyValue
52
- }
53
- };
54
- };
42
+ const setPreference = (propertyName, propertyValue = null) => ({
43
+ type: "SET_PREFERENCE",
44
+ payload: {
45
+ [propertyName]: propertyValue
46
+ }
47
+ });
55
48
 
56
49
  /**
57
50
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Preferences.js","names":["_objects","require","_exceptions","_Settings","_constants","getServerPreferenceValue","preferenceName","defaultValue","arguments","length","undefined","type","value","preferencesProvider","getPreferenceByName","_includes","default","call","_context","_map","split","val","_trim","setServerPreference","propertyName","setPreference","exports","propertyValue","payload","setPreferences","preferences","setThemePreference","configTheme","themeData","JSON","parse","error","JsonParseException","isPlainObject","setSettings","settings","setAllContentInDataSetting","state","allContentInDataSetting","getModularUIContentInData","ALL_CONTENT_IN_DATA_SETTING","setSetting","setDateTimeSettings","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","setLoginPreferences","loginSettings","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING"],"sources":["../../../src/redux/actions/Preferences.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport { JsonParseException } from \"../../exceptions\";\nimport { setSetting, setSettings } from \"../../constants/Settings\";\n\nimport type {\n PreferenceValue,\n ReduxState,\n SetPreferenceAction,\n SetPreferencesAction,\n} from \"../types\";\n\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n LOGIN_TYPE,\n LOGIN_PASSWORD_SETTING,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"../../constants\";\n\n/**\n */\nconst getServerPreferenceValue = (\n preferenceName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n) => {\n let value: PreferenceValue = null;\n if (typeof preferencesProvider !== \"undefined\") {\n value = preferencesProvider.getPreferenceByName(preferenceName);\n }\n\n if (value == null) {\n value = defaultValue;\n }\n\n if (typeof value === \"string\" && type !== \"string\" && value.includes(\",\")) {\n value = value.split(\",\").map((val) => val.trim());\n }\n\n return value;\n};\n\n/**\n */\nexport const setServerPreference = (\n propertyName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n): SetPreferenceAction => {\n const value = getServerPreferenceValue(propertyName, defaultValue, type);\n return setPreference(propertyName, value);\n};\n\n/**\n */\nexport const setPreference = (\n propertyName: string,\n propertyValue: PreferenceValue = null,\n): SetPreferenceAction => ({\n type: \"SET_PREFERENCE\",\n payload: {\n [propertyName]: propertyValue,\n },\n});\n\n/**\n */\nexport const setPreferences = (preferences: Object): SetPreferencesAction => ({\n type: \"SET_PREFERENCES\",\n payload: {\n ...preferences,\n },\n});\n\n/**\n */\nexport const setThemePreference = (\n configTheme: string,\n): SetPreferenceAction => {\n let themeData;\n\n try {\n themeData = configTheme ? JSON.parse(configTheme) : null;\n } catch (error) {\n throw new JsonParseException(`Theme file contains invalid JSON: ${error}`);\n }\n\n if (themeData && isPlainObject(themeData)) {\n setSettings(themeData.settings);\n }\n\n return setPreference(\"theme\", themeData);\n};\n\n/**\n * Make modular-ui-content-in-data preference available client side\n */\nexport const setAllContentInDataSetting = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let allContentInDataSetting: PreferenceValue = false;\n\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.getModularUIContentInData !== \"undefined\"\n ) {\n allContentInDataSetting = preferencesProvider.getModularUIContentInData();\n } else if (typeof state !== \"undefined\") {\n allContentInDataSetting = state.preferences[ALL_CONTENT_IN_DATA_SETTING];\n }\n\n setSetting(ALL_CONTENT_IN_DATA_SETTING, !!allContentInDataSetting);\n return setPreference(ALL_CONTENT_IN_DATA_SETTING, allContentInDataSetting);\n};\n\n/**\n * Retrieve settings for date time conversion\n */\nexport const setDateTimeSettings = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let isIncludeTimeOffsetInDateTimes: PreferenceValue = false;\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.isIncludeTimeOffsetInDateTimes !== \"undefined\"\n ) {\n isIncludeTimeOffsetInDateTimes =\n preferencesProvider.isIncludeTimeOffsetInDateTimes();\n } else if (typeof state !== \"undefined\") {\n isIncludeTimeOffsetInDateTimes = state.preferences[INCLUDE_TIME_OFFSET];\n }\n\n setSetting(INCLUDE_TIME_OFFSET, !!isIncludeTimeOffsetInDateTimes);\n return setPreference(INCLUDE_TIME_OFFSET, isIncludeTimeOffsetInDateTimes);\n};\n\n/**\n * Retrieves login settings from runtime preferences and sets them as setting in the preference reducer\n */\nexport const setLoginPreferences = (\n state?: ReduxState,\n): SetPreferencesAction => {\n const loginSettings = {\n [LOGIN_TYPE]: getServerPreferenceValue(\n LOGIN_TYPE,\n state?.preferences[LOGIN_TYPE],\n ),\n [LOGIN_PATH_SETTING]: getServerPreferenceValue(\n LOGIN_PATH_SETTING,\n state?.preferences[LOGIN_PATH_SETTING] ??\n `/callback?client_name=FormClient`,\n ),\n [LOGIN_USERNAME_SETTING]: getServerPreferenceValue(\n LOGIN_USERNAME_SETTING,\n state?.preferences[LOGIN_USERNAME_SETTING] ?? \"j_username\",\n ),\n [LOGIN_PASSWORD_SETTING]: getServerPreferenceValue(\n LOGIN_PASSWORD_SETTING,\n state?.preferences[LOGIN_PASSWORD_SETTING] ?? \"j_password\",\n ),\n [LOGOUT_PATH_SETTING]: getServerPreferenceValue(\n LOGOUT_PATH_SETTING,\n state?.preferences[LOGOUT_PATH_SETTING] ?? `/logout`,\n ),\n };\n\n setSettings(loginSettings);\n return setPreferences(loginSettings);\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AASA,IAAAG,UAAA,GAAAH,OAAA;AAUA;AACA;AACA,MAAMI,wBAA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J,CAAC;IACD,CAACC,iCAAsB,GAAGjD,wBAAwB,CAChDiD,iCAAsB,EACtBZ,KAAK,EAAEZ,WAAW,CAACwB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,iCAAsB,GAAGlD,wBAAwB,CAChDkD,iCAAsB,EACtBb,KAAK,EAAEZ,WAAW,CAACyB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,8BAAmB,GAAGnD,wBAAwB,CAC7CmD,8BAAmB,EACnBd,KAAK,EAAEZ,WAAW,CAAC0B,8BAAmB,CAAC,IAAI,SAC7C;EACF,CAAC;EAED,IAAAjB,qBAAW,EAACY,aAAa,CAAC;EAC1B,OAAOtB,cAAc,CAACsB,aAAa,CAAC;AACtC,CAAC;AAACzB,OAAA,CAAAwB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Preferences.js","names":["_objects","require","_exceptions","_Settings","_constants","getServerPreferenceValue","preferenceName","defaultValue","type","value","preferencesProvider","getPreferenceByName","_includes","default","call","_context","_map","split","val","_trim","setServerPreference","propertyName","setPreference","exports","propertyValue","payload","setPreferences","preferences","setThemePreference","configTheme","themeData","JSON","parse","error","JsonParseException","isPlainObject","setSettings","settings","setAllContentInDataSetting","state","allContentInDataSetting","getModularUIContentInData","ALL_CONTENT_IN_DATA_SETTING","setSetting","setDateTimeSettings","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","setLoginPreferences","loginSettings","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING"],"sources":["../../../src/redux/actions/Preferences.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport { JsonParseException } from \"../../exceptions\";\nimport { setSetting, setSettings } from \"../../constants/Settings\";\n\nimport type {\n PreferenceValue,\n ReduxState,\n SetPreferenceAction,\n SetPreferencesAction,\n} from \"../types\";\n\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n LOGIN_TYPE,\n LOGIN_PASSWORD_SETTING,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"../../constants\";\n\n/**\n */\nconst getServerPreferenceValue = (\n preferenceName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n) => {\n let value: PreferenceValue = null;\n if (typeof preferencesProvider !== \"undefined\") {\n value = preferencesProvider.getPreferenceByName(preferenceName);\n }\n\n if (value == null) {\n value = defaultValue;\n }\n\n if (typeof value === \"string\" && type !== \"string\" && value.includes(\",\")) {\n value = value.split(\",\").map((val) => val.trim());\n }\n\n return value;\n};\n\n/**\n */\nexport const setServerPreference = (\n propertyName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n): SetPreferenceAction => {\n const value = getServerPreferenceValue(propertyName, defaultValue, type);\n return setPreference(propertyName, value);\n};\n\n/**\n */\nexport const setPreference = (\n propertyName: string,\n propertyValue: PreferenceValue = null,\n): SetPreferenceAction => ({\n type: \"SET_PREFERENCE\",\n payload: {\n [propertyName]: propertyValue,\n },\n});\n\n/**\n */\nexport const setPreferences = (preferences: Object): SetPreferencesAction => ({\n type: \"SET_PREFERENCES\",\n payload: {\n ...preferences,\n },\n});\n\n/**\n */\nexport const setThemePreference = (\n configTheme: string,\n): SetPreferenceAction => {\n let themeData;\n\n try {\n themeData = configTheme ? JSON.parse(configTheme) : null;\n } catch (error) {\n throw new JsonParseException(`Theme file contains invalid JSON: ${error}`);\n }\n\n if (themeData && isPlainObject(themeData)) {\n setSettings(themeData.settings);\n }\n\n return setPreference(\"theme\", themeData);\n};\n\n/**\n * Make modular-ui-content-in-data preference available client side\n */\nexport const setAllContentInDataSetting = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let allContentInDataSetting: PreferenceValue = false;\n\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.getModularUIContentInData !== \"undefined\"\n ) {\n allContentInDataSetting = preferencesProvider.getModularUIContentInData();\n } else if (typeof state !== \"undefined\") {\n allContentInDataSetting = state.preferences[ALL_CONTENT_IN_DATA_SETTING];\n }\n\n setSetting(ALL_CONTENT_IN_DATA_SETTING, !!allContentInDataSetting);\n return setPreference(ALL_CONTENT_IN_DATA_SETTING, allContentInDataSetting);\n};\n\n/**\n * Retrieve settings for date time conversion\n */\nexport const setDateTimeSettings = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let isIncludeTimeOffsetInDateTimes: PreferenceValue = false;\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.isIncludeTimeOffsetInDateTimes !== \"undefined\"\n ) {\n isIncludeTimeOffsetInDateTimes =\n preferencesProvider.isIncludeTimeOffsetInDateTimes();\n } else if (typeof state !== \"undefined\") {\n isIncludeTimeOffsetInDateTimes = state.preferences[INCLUDE_TIME_OFFSET];\n }\n\n setSetting(INCLUDE_TIME_OFFSET, !!isIncludeTimeOffsetInDateTimes);\n return setPreference(INCLUDE_TIME_OFFSET, isIncludeTimeOffsetInDateTimes);\n};\n\n/**\n * Retrieves login settings from runtime preferences and sets them as setting in the preference reducer\n */\nexport const setLoginPreferences = (\n state?: ReduxState,\n): SetPreferencesAction => {\n const loginSettings = {\n [LOGIN_TYPE]: getServerPreferenceValue(\n LOGIN_TYPE,\n state?.preferences[LOGIN_TYPE],\n ),\n [LOGIN_PATH_SETTING]: getServerPreferenceValue(\n LOGIN_PATH_SETTING,\n state?.preferences[LOGIN_PATH_SETTING] ??\n `/callback?client_name=FormClient`,\n ),\n [LOGIN_USERNAME_SETTING]: getServerPreferenceValue(\n LOGIN_USERNAME_SETTING,\n state?.preferences[LOGIN_USERNAME_SETTING] ?? \"j_username\",\n ),\n [LOGIN_PASSWORD_SETTING]: getServerPreferenceValue(\n LOGIN_PASSWORD_SETTING,\n state?.preferences[LOGIN_PASSWORD_SETTING] ?? \"j_password\",\n ),\n [LOGOUT_PATH_SETTING]: getServerPreferenceValue(\n LOGOUT_PATH_SETTING,\n state?.preferences[LOGOUT_PATH_SETTING] ?? `/logout`,\n ),\n };\n\n setSettings(loginSettings);\n return setPreferences(loginSettings);\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AASA,IAAAG,UAAA,GAAAH,OAAA;AAUA;AACA;AACA,MAAMI,wBAAwB,GAAGA,CAC/BC,cAAsB,EACtBC,YAA6B,GAAG,IAAI,EACpCC,IAAa,KACV;EACH,IAAIC,KAAsB,GAAG,IAAI;EACjC,IAAI,OAAOC,mBAAmB,KAAK,WAAW,EAAE;IAC9CD,KAAK,GAAGC,mBAAmB,CAACC,mBAAmB,CAACL,cAAc,CAAC;EACjE;EAEA,IAAIG,KAAK,IAAI,IAAI,EAAE;IACjBA,KAAK,GAAGF,YAAY;EACtB;EAEA,IAAI,OAAOE,KAAK,KAAK,QAAQ,IAAID,IAAI,KAAK,QAAQ,IAAI,IAAAI,SAAA,CAAAC,OAAA,EAAAJ,KAAK,EAAAK,IAAA,CAALL,KAAK,EAAU,GAAG,CAAC,EAAE;IAAA,IAAAM,QAAA;IACzEN,KAAK,GAAG,IAAAO,IAAA,CAAAH,OAAA,EAAAE,QAAA,GAAAN,KAAK,CAACQ,KAAK,CAAC,GAAG,CAAC,EAAAH,IAAA,CAAAC,QAAA,EAAMG,GAAG,IAAK,IAAAC,KAAA,CAAAN,OAAA,EAAAK,GAAG,EAAAJ,IAAA,CAAHI,GAAS,CAAC,CAAC;EACnD;EAEA,OAAOT,KAAK;AACd,CAAC;;AAED;AACA;AACO,MAAMW,mBAAmB,GAAGA,CACjCC,YAAoB,EACpBd,YAA6B,GAAG,IAAI,EACpCC,IAAa,KACW;EACxB,MAAMC,KAAK,GAAGJ,wBAAwB,CAACgB,YAAY,EAAEd,YAAY,EAAEC,IAAI,CAAC;EACxE,OAAOc,aAAa,CAACD,YAAY,EAAE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,WAAW,CAACwB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,iCAAsB,GAAG/C,wBAAwB,CAChD+C,iCAAsB,EACtBb,KAAK,EAAEZ,WAAW,CAACyB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,8BAAmB,GAAGhD,wBAAwB,CAC7CgD,8BAAmB,EACnBd,KAAK,EAAEZ,WAAW,CAAC0B,8BAAmB,CAAC,IAAI,SAC7C;EACF,CAAC;EAED,IAAAjB,qBAAW,EAACY,aAAa,CAAC;EAC1B,OAAOtB,cAAc,CAACsB,aAAa,CAAC;AACtC,CAAC;AAACzB,OAAA,CAAAwB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -8,12 +8,9 @@ exports.connectCaseView = void 0;
8
8
  var _ModularUIConnector = _interopRequireDefault(require("../_modularui/ModularUIConnector"));
9
9
  /**
10
10
  */
11
- const connectCaseView = exports.connectCaseView = (0, _ModularUIConnector.default)("CaseView", _ref => {
12
- let {
13
- match
14
- } = _ref;
15
- return match.url;
16
- }, {
11
+ const connectCaseView = exports.connectCaseView = (0, _ModularUIConnector.default)("CaseView", ({
12
+ match
13
+ }) => match.url, {
17
14
  propName: "caseview"
18
15
  });
19
16
  //# sourceMappingURL=CaseView.js.map