@beinformed/ui 1.55.2 → 1.57.0-contextpath.0

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 (224) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/esm/constants/Settings.js +4 -1
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useForm.js +3 -1
  5. package/esm/hooks/useForm.js.map +1 -1
  6. package/esm/hooks/useModularUIBasic.js +11 -1
  7. package/esm/hooks/useModularUIBasic.js.map +1 -1
  8. package/esm/hooks/useModularUIModel.js +36 -25
  9. package/esm/hooks/useModularUIModel.js.map +1 -1
  10. package/esm/models/actions/ActionCollection.js +2 -2
  11. package/esm/models/actions/ActionCollection.js.map +1 -1
  12. package/esm/models/actions/ActionModel.js +27 -8
  13. package/esm/models/actions/ActionModel.js.map +1 -1
  14. package/esm/models/application/ApplicationModel.js +1 -1
  15. package/esm/models/application/ApplicationModel.js.map +1 -1
  16. package/esm/models/base/ResourceModel.js +25 -3
  17. package/esm/models/base/ResourceModel.js.map +1 -1
  18. package/esm/models/caseview/CaseViewModel.js +2 -2
  19. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  20. package/esm/models/concepts/ConceptLinkModel.js +1 -0
  21. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  22. package/esm/models/concepts/SourceReferenceModel.js +2 -1
  23. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  24. package/esm/models/content/ContentIndexModel.js +2 -2
  25. package/esm/models/content/ContentIndexModel.js.map +1 -1
  26. package/esm/models/content/ContentLinkModel.js +2 -0
  27. package/esm/models/content/ContentLinkModel.js.map +1 -1
  28. package/esm/models/content/SectionModel.js +1 -0
  29. package/esm/models/content/SectionModel.js.map +1 -1
  30. package/esm/models/detail/DetailModel.js +1 -1
  31. package/esm/models/detail/DetailModel.js.map +1 -1
  32. package/esm/models/error/ErrorResponse.js +2 -0
  33. package/esm/models/error/ErrorResponse.js.map +1 -1
  34. package/esm/models/form/FormModel.js +1 -1
  35. package/esm/models/form/FormModel.js.map +1 -1
  36. package/esm/models/href/Href.js +50 -3
  37. package/esm/models/href/Href.js.map +1 -1
  38. package/esm/models/href/ListHref.js +1 -1
  39. package/esm/models/href/ListHref.js.map +1 -1
  40. package/esm/models/links/LinkCollection.js +3 -1
  41. package/esm/models/links/LinkCollection.js.map +1 -1
  42. package/esm/models/links/LinkModel.js +10 -9
  43. package/esm/models/links/LinkModel.js.map +1 -1
  44. package/esm/models/list/ListItemModel.js +3 -1
  45. package/esm/models/list/ListItemModel.js.map +1 -1
  46. package/esm/models/list/ListModel.js +1 -1
  47. package/esm/models/list/ListModel.js.map +1 -1
  48. package/esm/models/panels/GroupingPanelModel.js +1 -1
  49. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  50. package/esm/models/tab/TabModel.js +2 -2
  51. package/esm/models/tab/TabModel.js.map +1 -1
  52. package/esm/models/taskgroup/TaskGroupModel.js +4 -2
  53. package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
  54. package/esm/modularui/Authenticate.js +2 -1
  55. package/esm/modularui/Authenticate.js.map +1 -1
  56. package/esm/modularui/ModularUIRequest.js +43 -7
  57. package/esm/modularui/ModularUIRequest.js.map +1 -1
  58. package/esm/modularui/ModularUIResponse.js +31 -0
  59. package/esm/modularui/ModularUIResponse.js.map +1 -1
  60. package/esm/redux/_modularui/ModularUIActions.js +3 -1
  61. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  62. package/esm/redux/_modularui/ModularUIMiddleware.js +6 -0
  63. package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  64. package/esm/redux/_modularui/ModularUISelectors.js +11 -0
  65. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  66. package/esm/redux/_modularui/types.js.map +1 -1
  67. package/esm/redux/actions/Application.js +2 -0
  68. package/esm/redux/actions/Application.js.map +1 -1
  69. package/esm/redux/connectors/PanelRenderer.js +2 -0
  70. package/esm/redux/connectors/PanelRenderer.js.map +1 -1
  71. package/esm/utils/fetch/types.js.map +1 -1
  72. package/esm/utils/helpers/checkResource.js +2 -0
  73. package/esm/utils/helpers/checkResource.js.map +1 -1
  74. package/lib/constants/Settings.js +4 -1
  75. package/lib/constants/Settings.js.flow +2 -2
  76. package/lib/constants/Settings.js.map +1 -1
  77. package/lib/hooks/useForm.js +3 -1
  78. package/lib/hooks/useForm.js.flow +2 -0
  79. package/lib/hooks/useForm.js.map +1 -1
  80. package/lib/hooks/useModularUIBasic.js +11 -1
  81. package/lib/hooks/useModularUIBasic.js.flow +14 -0
  82. package/lib/hooks/useModularUIBasic.js.map +1 -1
  83. package/lib/hooks/useModularUIModel.js +36 -24
  84. package/lib/hooks/useModularUIModel.js.flow +58 -11
  85. package/lib/hooks/useModularUIModel.js.map +1 -1
  86. package/lib/models/actions/ActionCollection.js +2 -2
  87. package/lib/models/actions/ActionCollection.js.flow +14 -2
  88. package/lib/models/actions/ActionCollection.js.map +1 -1
  89. package/lib/models/actions/ActionModel.js +31 -12
  90. package/lib/models/actions/ActionModel.js.flow +38 -16
  91. package/lib/models/actions/ActionModel.js.map +1 -1
  92. package/lib/models/application/ApplicationModel.js +1 -1
  93. package/lib/models/application/ApplicationModel.js.flow +7 -1
  94. package/lib/models/application/ApplicationModel.js.map +1 -1
  95. package/lib/models/base/ResourceModel.js +24 -3
  96. package/lib/models/base/ResourceModel.js.flow +35 -10
  97. package/lib/models/base/ResourceModel.js.map +1 -1
  98. package/lib/models/caseview/CaseViewModel.js +2 -2
  99. package/lib/models/caseview/CaseViewModel.js.flow +3 -1
  100. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  101. package/lib/models/concepts/ConceptLinkModel.js +1 -0
  102. package/lib/models/concepts/ConceptLinkModel.js.flow +1 -0
  103. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  104. package/lib/models/concepts/SourceReferenceModel.js +2 -1
  105. package/lib/models/concepts/SourceReferenceModel.js.flow +2 -1
  106. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  107. package/lib/models/content/ContentIndexModel.js +2 -2
  108. package/lib/models/content/ContentIndexModel.js.flow +2 -2
  109. package/lib/models/content/ContentIndexModel.js.map +1 -1
  110. package/lib/models/content/ContentLinkModel.js +2 -0
  111. package/lib/models/content/ContentLinkModel.js.flow +2 -0
  112. package/lib/models/content/ContentLinkModel.js.map +1 -1
  113. package/lib/models/content/SectionModel.js +1 -0
  114. package/lib/models/content/SectionModel.js.flow +1 -0
  115. package/lib/models/content/SectionModel.js.map +1 -1
  116. package/lib/models/detail/DetailModel.js +1 -1
  117. package/lib/models/detail/DetailModel.js.flow +2 -0
  118. package/lib/models/detail/DetailModel.js.map +1 -1
  119. package/lib/models/error/ErrorResponse.js +2 -0
  120. package/lib/models/error/ErrorResponse.js.flow +2 -0
  121. package/lib/models/error/ErrorResponse.js.map +1 -1
  122. package/lib/models/form/FormModel.js +1 -1
  123. package/lib/models/form/FormModel.js.flow +1 -1
  124. package/lib/models/form/FormModel.js.map +1 -1
  125. package/lib/models/href/Href.js +50 -3
  126. package/lib/models/href/Href.js.flow +58 -3
  127. package/lib/models/href/Href.js.map +1 -1
  128. package/lib/models/href/ListHref.js +1 -1
  129. package/lib/models/href/ListHref.js.flow +1 -1
  130. package/lib/models/href/ListHref.js.map +1 -1
  131. package/lib/models/links/LinkCollection.js +3 -1
  132. package/lib/models/links/LinkCollection.js.flow +8 -2
  133. package/lib/models/links/LinkCollection.js.map +1 -1
  134. package/lib/models/links/LinkModel.js +10 -9
  135. package/lib/models/links/LinkModel.js.flow +24 -16
  136. package/lib/models/links/LinkModel.js.map +1 -1
  137. package/lib/models/list/ListItemModel.js +3 -1
  138. package/lib/models/list/ListItemModel.js.flow +4 -0
  139. package/lib/models/list/ListItemModel.js.map +1 -1
  140. package/lib/models/list/ListModel.js +1 -1
  141. package/lib/models/list/ListModel.js.flow +6 -1
  142. package/lib/models/list/ListModel.js.map +1 -1
  143. package/lib/models/panels/GroupingPanelModel.js +1 -1
  144. package/lib/models/panels/GroupingPanelModel.js.flow +2 -0
  145. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  146. package/lib/models/tab/TabModel.js +2 -2
  147. package/lib/models/tab/TabModel.js.flow +4 -0
  148. package/lib/models/tab/TabModel.js.map +1 -1
  149. package/lib/models/taskgroup/TaskGroupModel.js +4 -2
  150. package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
  151. package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
  152. package/lib/modularui/Authenticate.js +2 -1
  153. package/lib/modularui/Authenticate.js.flow +2 -1
  154. package/lib/modularui/Authenticate.js.map +1 -1
  155. package/lib/modularui/ModularUIRequest.js +43 -7
  156. package/lib/modularui/ModularUIRequest.js.flow +49 -8
  157. package/lib/modularui/ModularUIRequest.js.map +1 -1
  158. package/lib/modularui/ModularUIResponse.js +31 -0
  159. package/lib/modularui/ModularUIResponse.js.flow +35 -0
  160. package/lib/modularui/ModularUIResponse.js.map +1 -1
  161. package/lib/modularui/__tests__/CustomContextPath.spec.js.flow +61 -0
  162. package/lib/redux/_modularui/ModularUIActions.js +3 -1
  163. package/lib/redux/_modularui/ModularUIActions.js.flow +6 -1
  164. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  165. package/lib/redux/_modularui/ModularUIMiddleware.js +6 -0
  166. package/lib/redux/_modularui/ModularUIMiddleware.js.flow +10 -0
  167. package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  168. package/lib/redux/_modularui/ModularUISelectors.js +13 -1
  169. package/lib/redux/_modularui/ModularUISelectors.js.flow +13 -0
  170. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  171. package/lib/redux/_modularui/types.js.flow +2 -0
  172. package/lib/redux/_modularui/types.js.map +1 -1
  173. package/lib/redux/actions/Application.js +2 -0
  174. package/lib/redux/actions/Application.js.flow +1 -0
  175. package/lib/redux/actions/Application.js.map +1 -1
  176. package/lib/redux/connectors/PanelRenderer.js +2 -0
  177. package/lib/redux/connectors/PanelRenderer.js.flow +1 -0
  178. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  179. package/lib/utils/fetch/types.js.flow +2 -0
  180. package/lib/utils/fetch/types.js.map +1 -1
  181. package/lib/utils/helpers/checkResource.js +2 -0
  182. package/lib/utils/helpers/checkResource.js.flow +2 -0
  183. package/lib/utils/helpers/checkResource.js.map +1 -1
  184. package/package.json +1 -1
  185. package/src/constants/Settings.js +2 -2
  186. package/src/hooks/useForm.js +2 -0
  187. package/src/hooks/useModularUIBasic.js +14 -0
  188. package/src/hooks/useModularUIModel.js +58 -11
  189. package/src/models/actions/ActionCollection.js +14 -2
  190. package/src/models/actions/ActionModel.js +38 -16
  191. package/src/models/application/ApplicationModel.js +7 -1
  192. package/src/models/base/ResourceModel.js +35 -10
  193. package/src/models/caseview/CaseViewModel.js +3 -1
  194. package/src/models/concepts/ConceptLinkModel.js +1 -0
  195. package/src/models/concepts/SourceReferenceModel.js +2 -1
  196. package/src/models/content/ContentIndexModel.js +2 -2
  197. package/src/models/content/ContentLinkModel.js +2 -0
  198. package/src/models/content/SectionModel.js +1 -0
  199. package/src/models/detail/DetailModel.js +2 -0
  200. package/src/models/error/ErrorResponse.js +2 -0
  201. package/src/models/form/FormModel.js +1 -1
  202. package/src/models/href/Href.js +58 -3
  203. package/src/models/href/ListHref.js +1 -1
  204. package/src/models/links/LinkCollection.js +8 -2
  205. package/src/models/links/LinkModel.js +24 -16
  206. package/src/models/list/ListItemModel.js +4 -0
  207. package/src/models/list/ListModel.js +6 -1
  208. package/src/models/panels/GroupingPanelModel.js +2 -0
  209. package/src/models/tab/TabModel.js +4 -0
  210. package/src/models/taskgroup/TaskGroupModel.js +6 -0
  211. package/src/modularui/Authenticate.js +2 -1
  212. package/src/modularui/ModularUIRequest.js +49 -8
  213. package/src/modularui/ModularUIResponse.js +35 -0
  214. package/src/modularui/__tests__/CustomContextPath.spec.js +61 -0
  215. package/src/modularui/__tests__/contributions.json +312 -0
  216. package/src/modularui/__tests__/data.json +263 -0
  217. package/src/redux/_modularui/ModularUIActions.js +6 -1
  218. package/src/redux/_modularui/ModularUIMiddleware.js +10 -0
  219. package/src/redux/_modularui/ModularUISelectors.js +13 -0
  220. package/src/redux/_modularui/types.js +2 -0
  221. package/src/redux/actions/Application.js +1 -0
  222. package/src/redux/connectors/PanelRenderer.js +1 -0
  223. package/src/utils/fetch/types.js +2 -0
  224. package/src/utils/helpers/checkResource.js +2 -0
@@ -18,99 +18,111 @@ var _useModularUIBasic = require("./useModularUIBasic");
18
18
  /**
19
19
  * Load application
20
20
  */
21
- const useApplication = () => (0, _useModularUIBasic.useModularUIBasic)("application", "/", {
21
+ const useApplication = options => (0, _useModularUIBasic.useModularUIBasic)("application", "/", {
22
22
  expectedModels: ["Application"],
23
- targetModel: _ApplicationModel.default
23
+ targetModel: _ApplicationModel.default,
24
+ ...options
24
25
  });
25
26
 
26
27
  /**
27
28
  * Load a tab by href
28
29
  */
29
30
  exports.useApplication = useApplication;
30
- const useTab = href => (0, _useModularUIBasic.useModularUIBasic)("tab", href, {
31
+ const useTab = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("tab", href, {
31
32
  expectedModels: ["Tab"],
32
- targetModel: _TabModel.default
33
+ targetModel: _TabModel.default,
34
+ ...options
33
35
  });
34
36
 
35
37
  /**
36
38
  * Load caseview by href
37
39
  */
38
40
  exports.useTab = useTab;
39
- const useCaseView = href => (0, _useModularUIBasic.useModularUIBasic)("caseview", href, {
41
+ const useCaseView = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("caseview", href, {
40
42
  expectedModels: ["CaseView"],
41
- targetModel: _CaseViewModel.default
43
+ targetModel: _CaseViewModel.default,
44
+ ...options
42
45
  });
43
46
 
44
47
  /**
45
48
  */
46
49
  exports.useCaseView = useCaseView;
47
- const usePanel = href => (0, _useModularUIBasic.useModularUIBasic)("panel", href, {
48
- expectedModels: ["List", "GroupingPanel", "Detail"]
50
+ const usePanel = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("panel", href, {
51
+ expectedModels: ["List", "GroupingPanel", "Detail"],
52
+ ...options
49
53
  });
50
54
 
51
55
  /**
52
56
  */
53
57
  exports.usePanel = usePanel;
54
- const useList = href => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
58
+ const useList = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
55
59
  expectedModels: ["List"],
56
- targetModel: _ListModel.default
60
+ targetModel: _ListModel.default,
61
+ ...options
57
62
  });
58
63
 
59
64
  /**
60
65
  */
61
66
  exports.useList = useList;
62
- const useListOrDetail = href => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
67
+ const useListOrDetail = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
63
68
  expectedModels: ["List", "Detail"],
64
- targetModel: [_ListModel.default, _DetailModel.default]
69
+ targetModel: [_ListModel.default, _DetailModel.default],
70
+ ...options
65
71
  });
66
72
 
67
73
  /**
68
74
  */
69
75
  exports.useListOrDetail = useListOrDetail;
70
- const useListDetail = href => (0, _useModularUIBasic.useModularUIBasic)("listdetail", href, {
76
+ const useListDetail = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("listdetail", href, {
71
77
  expectedModels: ["ListDetail"],
72
78
  targetModel: _ListDetailModel.default,
73
- forceTargetModel: true
79
+ forceTargetModel: true,
80
+ ...options
74
81
  });
75
82
 
76
83
  /**
77
84
  */
78
85
  exports.useListDetail = useListDetail;
79
- const useGroupingPanel = href => (0, _useModularUIBasic.useModularUIBasic)("groupingpanel", href, {
86
+ const useGroupingPanel = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("groupingpanel", href, {
80
87
  expectedModels: ["GroupingPanel"],
81
- targetModel: _GroupingPanelModel.default
88
+ targetModel: _GroupingPanelModel.default,
89
+ ...options
82
90
  });
83
91
 
84
92
  /**
85
93
  */
86
94
  exports.useGroupingPanel = useGroupingPanel;
87
- const useDetailPanel = href => (0, _useModularUIBasic.useModularUIBasic)("detailpanel", href, {
95
+ const useDetailPanel = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("detailpanel", href, {
88
96
  expectedModels: ["Detail"],
89
- targetModel: _DetailModel.default
97
+ targetModel: _DetailModel.default,
98
+ ...options
90
99
  });
91
100
 
92
101
  /**
93
102
  */
94
103
  exports.useDetailPanel = useDetailPanel;
95
- const useQuicksearch = href => (0, _useModularUIBasic.useModularUIBasic)("quicksearch", href, {
104
+ const useQuicksearch = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("quicksearch", href, {
96
105
  expectedModels: ["CaseSearch"],
97
- targetModel: _CaseSearchModel.default
106
+ targetModel: _CaseSearchModel.default,
107
+ ...options
98
108
  });
99
109
 
100
110
  /**
101
111
  */
102
112
  exports.useQuicksearch = useQuicksearch;
103
- const useSearch = href => (0, _useModularUIBasic.useModularUIBasic)("search", href, {
113
+ const useSearch = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("search", href, {
104
114
  expectedModels: ["CaseSearch"],
105
- targetModel: _CaseSearchModel.default
115
+ targetModel: _CaseSearchModel.default,
116
+ ...options
106
117
  });
107
118
 
108
119
  /**
109
120
  */
110
121
  exports.useSearch = useSearch;
111
- const useUserProfile = href => (0, _useModularUIBasic.useModularUIBasic)("userprofile", href, {
122
+ const useUserProfile = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("userprofile", href, {
112
123
  expectedModels: ["UserProfile"],
113
- targetModel: _UserProfileModel.default
124
+ targetModel: _UserProfileModel.default,
125
+ ...options
114
126
  });
115
127
  exports.useUserProfile = useUserProfile;
116
128
  //# sourceMappingURL=useModularUIModel.js.map
@@ -11,103 +11,150 @@ import UserProfileModel from "../models/user/UserProfileModel";
11
11
 
12
12
  import { useModularUIBasic } from "./useModularUIBasic";
13
13
 
14
+ type HookOptions = {
15
+ origin?: string,
16
+ contextPath?: string,
17
+ };
18
+
14
19
  /**
15
20
  * Load application
16
21
  */
17
- export const useApplication = (): ApplicationModel | null =>
22
+ export const useApplication = (
23
+ options?: HookOptions,
24
+ ): ApplicationModel | null =>
18
25
  useModularUIBasic("application", "/", {
19
26
  expectedModels: ["Application"],
20
27
  targetModel: ApplicationModel,
28
+ ...options,
21
29
  });
22
30
 
23
31
  /**
24
32
  * Load a tab by href
25
33
  */
26
- export const useTab = (href: string): TabModel | null =>
34
+ export const useTab = (href: string, options?: HookOptions): TabModel | null =>
27
35
  useModularUIBasic("tab", href, {
28
36
  expectedModels: ["Tab"],
29
37
  targetModel: TabModel,
38
+ ...options,
30
39
  });
31
40
 
32
41
  /**
33
42
  * Load caseview by href
34
43
  */
35
- export const useCaseView = (href: string): CaseViewModel | null =>
44
+ export const useCaseView = (
45
+ href: string,
46
+ options?: HookOptions,
47
+ ): CaseViewModel | null =>
36
48
  useModularUIBasic("caseview", href, {
37
49
  expectedModels: ["CaseView"],
38
50
  targetModel: CaseViewModel,
51
+ ...options,
39
52
  });
40
53
 
41
54
  /**
42
55
  */
43
56
  export const usePanel = (
44
57
  href: string,
58
+ options?: HookOptions,
45
59
  ): ListModel | GroupingPanelModel | DetailModel | null =>
46
60
  useModularUIBasic("panel", href, {
47
61
  expectedModels: ["List", "GroupingPanel", "Detail"],
62
+ ...options,
48
63
  });
49
64
 
50
65
  /**
51
66
  */
52
- export const useList = (href: string): ListModel | null =>
67
+ export const useList = (
68
+ href: string,
69
+ options?: HookOptions,
70
+ ): ListModel | null =>
53
71
  useModularUIBasic("list", href, {
54
72
  expectedModels: ["List"],
55
73
  targetModel: ListModel,
74
+ ...options,
56
75
  });
57
76
 
58
77
  /**
59
78
  */
60
- export const useListOrDetail = (href: string): ListModel | DetailModel | null =>
79
+ export const useListOrDetail = (
80
+ href: string,
81
+ options?: HookOptions,
82
+ ): ListModel | DetailModel | null =>
61
83
  useModularUIBasic("list", href, {
62
84
  expectedModels: ["List", "Detail"],
63
85
  targetModel: [ListModel, DetailModel],
86
+ ...options,
64
87
  });
65
88
 
66
89
  /**
67
90
  */
68
- export const useListDetail = (href: string): ListDetailModel | null =>
91
+ export const useListDetail = (
92
+ href: string,
93
+ options?: HookOptions,
94
+ ): ListDetailModel | null =>
69
95
  useModularUIBasic("listdetail", href, {
70
96
  expectedModels: ["ListDetail"],
71
97
  targetModel: ListDetailModel,
72
98
  forceTargetModel: true,
99
+ ...options,
73
100
  });
74
101
 
75
102
  /**
76
103
  */
77
- export const useGroupingPanel = (href: string): GroupingPanelModel | null =>
104
+ export const useGroupingPanel = (
105
+ href: string,
106
+ options?: HookOptions,
107
+ ): GroupingPanelModel | null =>
78
108
  useModularUIBasic("groupingpanel", href, {
79
109
  expectedModels: ["GroupingPanel"],
80
110
  targetModel: GroupingPanelModel,
111
+ ...options,
81
112
  });
82
113
 
83
114
  /**
84
115
  */
85
- export const useDetailPanel = (href: string): DetailModel | null =>
116
+ export const useDetailPanel = (
117
+ href: string,
118
+ options?: HookOptions,
119
+ ): DetailModel | null =>
86
120
  useModularUIBasic("detailpanel", href, {
87
121
  expectedModels: ["Detail"],
88
122
  targetModel: DetailModel,
123
+ ...options,
89
124
  });
90
125
 
91
126
  /**
92
127
  */
93
- export const useQuicksearch = (href: string): CaseSearchModel | null =>
128
+ export const useQuicksearch = (
129
+ href: string,
130
+ options?: HookOptions,
131
+ ): CaseSearchModel | null =>
94
132
  useModularUIBasic("quicksearch", href, {
95
133
  expectedModels: ["CaseSearch"],
96
134
  targetModel: CaseSearchModel,
135
+ ...options,
97
136
  });
98
137
 
99
138
  /**
100
139
  */
101
- export const useSearch = (href: string): CaseSearchModel | null =>
140
+ export const useSearch = (
141
+ href: string,
142
+ options?: HookOptions,
143
+ ): CaseSearchModel | null =>
102
144
  useModularUIBasic("search", href, {
103
145
  expectedModels: ["CaseSearch"],
104
146
  targetModel: CaseSearchModel,
147
+ ...options,
105
148
  });
106
149
 
107
150
  /**
108
151
  */
109
- export const useUserProfile = (href: string): UserProfileModel | null =>
152
+ export const useUserProfile = (
153
+ href: string,
154
+ options?: HookOptions,
155
+ ): UserProfileModel | null =>
110
156
  useModularUIBasic("userprofile", href, {
111
157
  expectedModels: ["UserProfile"],
112
158
  targetModel: UserProfileModel,
159
+ ...options,
113
160
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIModel.js","names":["_ApplicationModel","_interopRequireDefault","require","_CaseViewModel","_TabModel","_ListModel","_GroupingPanelModel","_DetailModel","_CaseSearchModel","_ListDetailModel","_UserProfileModel","_useModularUIBasic","useApplication","useModularUIBasic","expectedModels","targetModel","ApplicationModel","exports","useTab","href","TabModel","useCaseView","CaseViewModel","usePanel","useList","ListModel","useListOrDetail","DetailModel","useListDetail","ListDetailModel","forceTargetModel","useGroupingPanel","GroupingPanelModel","useDetailPanel","useQuicksearch","CaseSearchModel","useSearch","useUserProfile","UserProfileModel"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\n/**\n * Load application\n */\nexport const useApplication = (): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (href: string): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (href: string): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n });\n\n/**\n */\nexport const usePanel = (\n href: string,\n): ListModel | GroupingPanelModel | DetailModel | null =>\n useModularUIBasic(\"panel\", href, {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n });\n\n/**\n */\nexport const useList = (href: string): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n });\n\n/**\n */\nexport const useListOrDetail = (href: string): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n });\n\n/**\n */\nexport const useListDetail = (href: string): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n });\n\n/**\n */\nexport const useGroupingPanel = (href: string): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n });\n\n/**\n */\nexport const useDetailPanel = (href: string): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n });\n\n/**\n */\nexport const useQuicksearch = (href: string): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n });\n\n/**\n */\nexport const useSearch = (href: string): CaseSearchModel | null =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n });\n\n/**\n */\nexport const useUserProfile = (href: string): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n });\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,mBAAA,GAAAL,sBAAA,CAAAC,OAAA;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EO,MAAME,SAAS,GAAIjB,IAAY,IACpC,IAAAN,oCAAiB,EAAC,QAAQ,EAAEM,IAAI,EAAE;EAChCL,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEoB;AACf,CAAC,CAAC;;AAEJ;AACA;AADAlB,OAAA,CAAAmB,SAAA,GAAAA,SAAA;AAEO,MAAMC,cAAc,GAAIlB,IAAY,IACzC,IAAAN,oCAAiB,EAAC,aAAa,EAAEM,IAAI,EAAE;EACrCL,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEuB;AACf,CAAC,CAAC;AAACrB,OAAA,CAAAoB,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"file":"useModularUIModel.js","names":["_ApplicationModel","_interopRequireDefault","require","_CaseViewModel","_TabModel","_ListModel","_GroupingPanelModel","_DetailModel","_CaseSearchModel","_ListDetailModel","_UserProfileModel","_useModularUIBasic","useApplication","options","useModularUIBasic","expectedModels","targetModel","ApplicationModel","exports","useTab","href","TabModel","useCaseView","CaseViewModel","usePanel","useList","ListModel","useListOrDetail","DetailModel","useListDetail","ListDetailModel","forceTargetModel","useGroupingPanel","GroupingPanelModel","useDetailPanel","useQuicksearch","CaseSearchModel","useSearch","useUserProfile","UserProfileModel"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\ntype HookOptions = {\n origin?: string,\n contextPath?: string,\n};\n\n/**\n * Load application\n */\nexport const useApplication = (\n options?: HookOptions,\n): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (href: string, options?: HookOptions): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (\n href: string,\n options?: HookOptions,\n): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\n/**\n */\nexport const usePanel = (\n href: string,\n options?: HookOptions,\n): ListModel | GroupingPanelModel | DetailModel | null =>\n useModularUIBasic(\"panel\", href, {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n ...options,\n });\n\n/**\n */\nexport const useList = (\n href: string,\n options?: HookOptions,\n): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\n/**\n */\nexport const useListOrDetail = (\n href: string,\n options?: HookOptions,\n): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\n/**\n */\nexport const useListDetail = (\n href: string,\n options?: HookOptions,\n): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\n/**\n */\nexport const useGroupingPanel = (\n href: string,\n options?: HookOptions,\n): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\n/**\n */\nexport const useDetailPanel = (\n href: string,\n options?: HookOptions,\n): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\n/**\n */\nexport const useQuicksearch = (\n href: string,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useSearch = (\n href: string,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useUserProfile = (\n href: string,\n options?: HookOptions,\n): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,mBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,YAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,iBAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,IAAAS,kBAAA,GAAAT,OAAA;AAOA;AACA;AACA;AACO,MAAMU,cAAc,GACzBC,OAAqB,IAErB,IAAAC,oCAAiB,EAAC,aAAa,EAAE,GAAG,EAAE;EACpCC,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEC,yBAAgB;EAC7B,GAAGJ;AACL,CAAC,CAAC;;AAEJ;AACA;AACA;AAFAK,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAGO,MAAMO,MAAM,GAAGA,CAACC,IA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Ac,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEoB,wBAAe;EAC5B,GAAGvB;AACL,CAAC,CAAC;;AAEJ;AACA;AADAK,OAAA,CAAAmB,SAAA,GAAAA,SAAA;AAEO,MAAMC,cAAc,GAAGA,CAC5BlB,IAAY,EACZP,OAAqB,KAErB,IAAAC,oCAAiB,EAAC,aAAa,EAAEM,IAAI,EAAE;EACrCL,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEuB,yBAAgB;EAC7B,GAAG1B;AACL,CAAC,CAAC;AAACK,OAAA,CAAAoB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -15,7 +15,7 @@ var _ActionModel = _interopRequireDefault(require("./ActionModel"));
15
15
  * Collection of actions
16
16
  */
17
17
  class ActionCollection extends _BaseCollection.default {
18
- constructor(actions, actionsContributions) {
18
+ constructor(actions, actionsContributions, origin, contextPath) {
19
19
  super();
20
20
 
21
21
  // no actions gives an empty collection
@@ -26,7 +26,7 @@ class ActionCollection extends _BaseCollection.default {
26
26
  for (const actionData of actions) {
27
27
  const actionContribution = (0, _find.default)(actionsContributions).call(actionsContributions, actionContribution => actionContribution.name === actionData.name && actionContribution.type !== "service-operation");
28
28
  if (actionContribution) {
29
- actionModels.push(new _ActionModel.default(actionData, actionContribution));
29
+ actionModels.push(new _ActionModel.default(actionData, actionContribution, origin, contextPath));
30
30
  }
31
31
  }
32
32
  this.collection = actionModels;
@@ -6,7 +6,12 @@ import ActionModel from "./ActionModel";
6
6
  * Collection of actions
7
7
  */
8
8
  export default class ActionCollection extends BaseCollection<ActionModel> {
9
- constructor(actions?: Object, actionsContributions?: Object) {
9
+ constructor(
10
+ actions?: Object,
11
+ actionsContributions?: Object,
12
+ origin?: string,
13
+ contextPath?: string,
14
+ ) {
10
15
  super();
11
16
 
12
17
  // no actions gives an empty collection
@@ -22,7 +27,14 @@ export default class ActionCollection extends BaseCollection<ActionModel> {
22
27
  );
23
28
 
24
29
  if (actionContribution) {
25
- actionModels.push(new ActionModel(actionData, actionContribution));
30
+ actionModels.push(
31
+ new ActionModel(
32
+ actionData,
33
+ actionContribution,
34
+ origin,
35
+ contextPath,
36
+ ),
37
+ );
26
38
  }
27
39
  }
28
40
 
@@ -1 +1 @@
1
- {"version":3,"file":"ActionCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_ActionModel","ActionCollection","BaseCollection","constructor","actions","actionsContributions","Array","isArray","collection","actionModels","actionData","actionContribution","_find","default","call","name","type","push","ActionModel","getActionByKey","key","_context","newCollection","_filter","action","first","getActionsByType","_context2","_includes","getActionsByLayoutHint","_context3","_len","arguments","length","hints","_key","layouthint","has","hasActionsByLayoutHint","routePath","_context4","enabledRoutes","isDisabled","path","_map","selfhref","join","exports"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(actions?: Object, actionsContributions?: Object) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (actionContribution) =>\n actionContribution.name === actionData.name &&\n actionContribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(new ActionModel(actionData, actionContribution));\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAME,gBAAgB,SAASC,uBAAc,CAAc;EACxEC,WAAWA,CAACC,OAAgB,EAAEC,oBAA6B,EAAE;IAC3D,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,OAAO,CAAC,EAAE;MAC3B,IAAI,CAACI,UAAU,GAAG,EAAE;IACtB,CAAC,MAAM,IAAIF,KAAK,CAACC,OAAO,CAACF,oBAAoB,CAAC,EAAE;MAC9C,MAAMI,YAAY,GAAG,EAAE;MACvB,KAAK,MAAMC,UAAU,IAAIN,OAAO,EAAE;QAChC,MAAMO,kBAAkB,GAAG,IAAAC,KAAA,CAAAC,OAAA,EAAAR,oBAAoB,EAAAS,IAAA,CAApBT,oBAAoB,EAC5CM,kBAAkB,IACjBA,kBAAkB,CAACI,IAAI,KAAKL,UAAU,CAACK,IAAI,IAC3CJ,kBAAkB,CAACK,IAAI,KAAK,mBAChC,CAAC;QAED,IAAIL,kBAAkB,EAAE;UACtBF,YAAY,CAACQ,IAAI,CAAC,IAAIC,oBAAW,CAACR,UAAU,EAA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AAAe,OAAA,CAAAV,OAAA,EAAAiB,SAAA,OAAI,EAAAhB,IAAA,CAAAgB,SAAA,EAASN,MAAM,IAC5CA,MAAM,CAACY,UAAU,CAACC,GAAG,CAAC,GAAGH,KAAK,CAChC,CAAC;IAED,OAAOZ,aAAa;EACtB;;EAEA;AACF;AACA;EACEgB,sBAAsBA,CAAA,EAAmC;IACvD,OAAO,IAAI,CAACT,sBAAsB,CAAC,GAAAG,SAAQ,CAAC,CAACC,MAAM,GAAG,CAAC;EACzD;;EAEA;AACF;AACA;EACE,IAAIM,SAASA,CAAA,EAAW;IAAA,IAAAC,SAAA;IACtB,MAAMC,aAAa,GAAG,IAAAlB,OAAA,CAAAV,OAAA,EAAA2B,SAAA,OAAI,CAAChC,UAAU,EAAAM,IAAA,CAAA0B,SAAA,EAClChB,MAAM,IAAK,CAACA,MAAM,CAACkB,UACtB,CAAC;IAED,IAAID,aAAa,CAACR,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMU,IAAI,GAAG,IAAAC,IAAA,CAAA/B,OAAA,EAAA4B,aAAa,EAAA3B,IAAA,CAAb2B,aAAa,EAAMjB,MAAM,IAAKA,MAAM,CAACqB,QAAQ,CAACF,IAAI,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE1E,OAAO,IAAI,CAACb,MAAM,GAAG,CAAC,GAAG,IAAIU,IAAI,GAAG,GAAGA,IAAI;EAC7C;AACF;AAACI,OAAA,CAAAlC,OAAA,GAAAZ,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"ActionCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_ActionModel","ActionCollection","BaseCollection","constructor","actions","actionsContributions","origin","contextPath","Array","isArray","collection","actionModels","actionData","actionContribution","_find","default","call","name","type","push","ActionModel","getActionByKey","key","_context","newCollection","_filter","action","first","getActionsByType","_context2","_includes","getActionsByLayoutHint","_context3","_len","arguments","length","hints","_key","layouthint","has","hasActionsByLayoutHint","routePath","_context4","enabledRoutes","isDisabled","path","_map","selfhref","join","exports"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n origin?: string,\n contextPath?: string,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (actionContribution) =>\n actionContribution.name === actionData.name &&\n actionContribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(\n new ActionModel(\n actionData,\n actionContribution,\n origin,\n contextPath,\n ),\n );\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAME,gBAAgB,SAASC,uBAAc,CAAc;EACxEC,WAAWA,CACTC,OAAgB,EAChBC,oBAA6B,EAC7BC,MAAe,EACfC,WAAoB,EACpB;IACA,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACL,OAAO,CAAC,EAAE;MAC3B,IAAI,CAACM,UAAU,GAAG,EAAE;IACtB,CAAC,MAAM,IAAIF,KAAK,CAACC,OAAO,CAACJ,oBAAoB,CAAC,EAAE;MAC9C,MAAMM,YAAY,GAAG,EAAE;MACvB,KAAK,MAAMC,UAAU,IAAIR,OAAO,EAAE;QAChC,MAAMS,kBAAkB,GAAG,IAAAC,KAAA,CAAAC,OAAA,EAAAV,oBAAoB,EAAAW,IAAA,CAApBX,oBAAoB,EAC5CQ,kBAAkB,IACjBA,kBAAkB,CAACI,IAAI,KAAKL,UAAU,CAACK,IAAI,IAC3CJ,kBAAkB,CAACK,IAAI,KAAK,mBAChC,CAAC;QAED,IAAIL,kBAAkB,EAAE;UACtBF,YAAY,CAACQ,IAAI,CACf,IAAIC,oBAAW,CACbR,UAAU,EACVC,kBAAkB,EAClBP,MAAM,EACNC,WACF,CACF,CAAC;QACH;MACF;MAEA,IAAI,CAACG,UAAU,GAAGC,YAAY;IAChC;EACF;;EAEA;AACF;AACA;EACEU,cAAcA,CAACC,GAAW,EAAsB;IAAA,IAAAC,QAAA;IAC9C,MAAMC,aAAa,GAAG,IAAIvB,gBAAgB,CAAC,CAAC;IAE5CuB,aAAa,CAACd,UAAU,GAAG,IAAAe,OAAA,CAAAV,OAAA,EAAAQ,QAAA,OAAI,EAAAP,IAAA,CAAAO,QAAA,EAASG,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AEA;AACF;AACA;EACE,IAAIM,SAASA,CAAA,EAAW;IAAA,IAAAC,SAAA;IACtB,MAAMC,aAAa,GAAG,IAAAlB,OAAA,CAAAV,OAAA,EAAA2B,SAAA,OAAI,CAAChC,UAAU,EAAAM,IAAA,CAAA0B,SAAA,EAClChB,MAAM,IAAK,CAACA,MAAM,CAACkB,UACtB,CAAC;IAED,IAAID,aAAa,CAACR,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMU,IAAI,GAAG,IAAAC,IAAA,CAAA/B,OAAA,EAAA4B,aAAa,EAAA3B,IAAA,CAAb2B,aAAa,EAAMjB,MAAM,IAAKA,MAAM,CAACqB,QAAQ,CAACF,IAAI,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE1E,OAAO,IAAI,CAACb,MAAM,GAAG,CAAC,GAAG,IAAIU,IAAI,GAAG,GAAGA,IAAI;EAC7C;AACF;AAACI,OAAA,CAAAlC,OAAA,GAAAd,gBAAA","ignoreList":[]}
@@ -13,32 +13,39 @@ var _ProcessStatusSettingsModel = _interopRequireDefault(require("../process/Pro
13
13
  var _AttributeCollection = _interopRequireDefault(require("../attributes/AttributeCollection"));
14
14
  var _BaseModel = _interopRequireDefault(require("../base/BaseModel"));
15
15
  var _Href = _interopRequireDefault(require("../href/Href"));
16
- var _Constants = require("../../constants/Constants");
17
- var _LayoutHints = require("../../constants/LayoutHints");
16
+ var _constants = require("../../constants");
18
17
  /**
19
18
  * Defines an Action. For instance an action on the tab 'books', which leads to a form
20
19
  */
21
20
  class ActionModel extends _BaseModel.default {
22
- constructor(data, contributions) {
21
+ constructor(data, contributions, origin, contextPath) {
23
22
  super(data, contributions);
24
23
  (0, _defineProperty2.default)(this, "_fieldCollection", void 0);
25
24
  (0, _defineProperty2.default)(this, "_href", void 0);
26
25
  (0, _defineProperty2.default)(this, "_icon", void 0);
26
+ (0, _defineProperty2.default)(this, "_origin", void 0);
27
+ (0, _defineProperty2.default)(this, "_contextPath", void 0);
27
28
  this._fieldCollection = new _AttributeCollection.default(this.data.fields, this.contributions.fields);
29
+ this._origin = origin;
30
+ this._contextPath = contextPath;
28
31
  }
29
32
 
30
33
  /**
31
34
  */
32
35
  static createFromHref(name, href, label) {
33
36
  let type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "form";
34
- return new ActionModel({
37
+ let origin = arguments.length > 4 ? arguments[4] : undefined;
38
+ let contextPath = arguments.length > 5 ? arguments[5] : undefined;
39
+ const data = {
35
40
  name,
36
41
  href
37
- }, {
42
+ };
43
+ const contributions = {
38
44
  name,
39
- label: label || name,
45
+ label: label ?? name,
40
46
  type
41
- });
47
+ };
48
+ return new ActionModel(data, contributions, origin, contextPath);
42
49
  }
43
50
 
44
51
  /**
@@ -47,11 +54,23 @@ class ActionModel extends _BaseModel.default {
47
54
  return this.data.href == null;
48
55
  }
49
56
 
57
+ /**
58
+ */
59
+ get origin() {
60
+ return this._origin ?? "";
61
+ }
62
+
63
+ /**
64
+ */
65
+ get contextPath() {
66
+ return this._contextPath ?? (0, _constants.getBasePath)();
67
+ }
68
+
50
69
  /**
51
70
  * retrieve href of action
52
71
  */
53
72
  get selfhref() {
54
- return this._href || new _Href.default(`${this.data.href}?${this.querystring}`, "Form");
73
+ return this._href ?? new _Href.default(`${this.data.href}?${this.querystring}`, "Form", this.origin, this.contextPath);
55
74
  }
56
75
 
57
76
  /**
@@ -64,20 +83,20 @@ class ActionModel extends _BaseModel.default {
64
83
  * retrieve request method
65
84
  */
66
85
  get method() {
67
- return this.getData("method", _Constants.HTTP_METHODS.POST);
86
+ return this.getData("method", _constants.HTTP_METHODS.POST);
68
87
  }
69
88
 
70
89
  /**
71
90
  * Retrieve type of method
72
91
  */
73
92
  get type() {
74
- if (this.layouthint.has(_LayoutHints.CREATE_ACTION)) {
93
+ if (this.layouthint.has(_constants.CREATE_ACTION)) {
75
94
  return "create";
76
95
  }
77
- if (this.layouthint.has(_LayoutHints.UPDATE_ACTION)) {
96
+ if (this.layouthint.has(_constants.UPDATE_ACTION)) {
78
97
  return "update";
79
98
  }
80
- if (this.layouthint.has(_LayoutHints.DELETE_ACTION)) {
99
+ if (this.layouthint.has(_constants.DELETE_ACTION)) {
81
100
  return "delete";
82
101
  }
83
102
  return this.getContribution("type", "general");
@@ -6,12 +6,13 @@ import AttributeCollection from "../attributes/AttributeCollection";
6
6
  import BaseModel from "../base/BaseModel";
7
7
  import Href from "../href/Href";
8
8
 
9
- import { HTTP_METHODS } from "../../constants/Constants";
10
9
  import {
10
+ getBasePath,
11
+ HTTP_METHODS,
11
12
  CREATE_ACTION,
12
13
  UPDATE_ACTION,
13
14
  DELETE_ACTION,
14
- } from "../../constants/LayoutHints";
15
+ } from "../../constants";
15
16
 
16
17
  import type { AttributeType } from "../types";
17
18
 
@@ -22,14 +23,23 @@ export default class ActionModel extends BaseModel {
22
23
  _fieldCollection: AttributeCollection;
23
24
  _href: Href;
24
25
  _icon: string;
25
-
26
- constructor(data: Object, contributions: Object) {
26
+ _origin: ?string;
27
+ _contextPath: ?string;
28
+
29
+ constructor(
30
+ data: Object,
31
+ contributions: Object,
32
+ origin?: string,
33
+ contextPath?: string,
34
+ ) {
27
35
  super(data, contributions);
28
36
 
29
37
  this._fieldCollection = new AttributeCollection(
30
38
  this.data.fields,
31
39
  this.contributions.fields,
32
40
  );
41
+ this._origin = origin;
42
+ this._contextPath = contextPath;
33
43
  }
34
44
 
35
45
  /**
@@ -39,18 +49,12 @@ export default class ActionModel extends BaseModel {
39
49
  href: string,
40
50
  label: string,
41
51
  type: string = "form",
52
+ origin?: string,
53
+ contextPath?: string,
42
54
  ): ActionModel {
43
- return new ActionModel(
44
- {
45
- name,
46
- href,
47
- },
48
- {
49
- name,
50
- label: label || name,
51
- type,
52
- },
53
- );
55
+ const data = { name, href };
56
+ const contributions = { name, label: label ?? name, type };
57
+ return new ActionModel(data, contributions, origin, contextPath);
54
58
  }
55
59
 
56
60
  /**
@@ -59,12 +63,30 @@ export default class ActionModel extends BaseModel {
59
63
  return this.data.href == null;
60
64
  }
61
65
 
66
+ /**
67
+ */
68
+ get origin(): string {
69
+ return this._origin ?? "";
70
+ }
71
+
72
+ /**
73
+ */
74
+ get contextPath(): string {
75
+ return this._contextPath ?? getBasePath();
76
+ }
77
+
62
78
  /**
63
79
  * retrieve href of action
64
80
  */
65
81
  get selfhref(): Href {
66
82
  return (
67
- this._href || new Href(`${this.data.href}?${this.querystring}`, "Form")
83
+ this._href ??
84
+ new Href(
85
+ `${this.data.href}?${this.querystring}`,
86
+ "Form",
87
+ this.origin,
88
+ this.contextPath,
89
+ )
68
90
  );
69
91
  }
70
92