@beinformed/ui 1.56.0 → 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.
- package/CHANGELOG.md +19 -0
- package/esm/constants/Settings.js +4 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useForm.js +3 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +11 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js +36 -25
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +2 -2
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js +27 -8
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +1 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +25 -3
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +2 -2
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js +1 -0
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +2 -1
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +2 -2
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +2 -0
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/SectionModel.js +1 -0
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +1 -1
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +2 -0
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/form/FormModel.js +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/href/Href.js +50 -3
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/href/ListHref.js +1 -1
- package/esm/models/href/ListHref.js.map +1 -1
- package/esm/models/links/LinkCollection.js +3 -1
- package/esm/models/links/LinkCollection.js.map +1 -1
- package/esm/models/links/LinkModel.js +10 -9
- package/esm/models/links/LinkModel.js.map +1 -1
- package/esm/models/list/ListItemModel.js +3 -1
- package/esm/models/list/ListItemModel.js.map +1 -1
- package/esm/models/list/ListModel.js +1 -1
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +1 -1
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/tab/TabModel.js +2 -2
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +4 -2
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +2 -1
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +43 -7
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/ModularUIResponse.js +31 -0
- package/esm/modularui/ModularUIResponse.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +3 -1
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +6 -0
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/actions/Application.js +2 -0
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +2 -0
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/utils/fetch/types.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +2 -0
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/lib/constants/Settings.js +4 -1
- package/lib/constants/Settings.js.flow +2 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useForm.js +3 -1
- package/lib/hooks/useForm.js.flow +2 -0
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +11 -1
- package/lib/hooks/useModularUIBasic.js.flow +14 -0
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js +36 -24
- package/lib/hooks/useModularUIModel.js.flow +58 -11
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/models/actions/ActionCollection.js +2 -2
- package/lib/models/actions/ActionCollection.js.flow +14 -2
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js +31 -12
- package/lib/models/actions/ActionModel.js.flow +38 -16
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +1 -1
- package/lib/models/application/ApplicationModel.js.flow +7 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +24 -3
- package/lib/models/base/ResourceModel.js.flow +35 -10
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +2 -2
- package/lib/models/caseview/CaseViewModel.js.flow +3 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js +1 -0
- package/lib/models/concepts/ConceptLinkModel.js.flow +1 -0
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +2 -1
- package/lib/models/concepts/SourceReferenceModel.js.flow +2 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +2 -2
- package/lib/models/content/ContentIndexModel.js.flow +2 -2
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +2 -0
- package/lib/models/content/ContentLinkModel.js.flow +2 -0
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +1 -0
- package/lib/models/content/SectionModel.js.flow +1 -0
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +1 -1
- package/lib/models/detail/DetailModel.js.flow +2 -0
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +2 -0
- package/lib/models/error/ErrorResponse.js.flow +2 -0
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/form/FormModel.js +1 -1
- package/lib/models/form/FormModel.js.flow +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/href/Href.js +50 -3
- package/lib/models/href/Href.js.flow +58 -3
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/ListHref.js +1 -1
- package/lib/models/href/ListHref.js.flow +1 -1
- package/lib/models/href/ListHref.js.map +1 -1
- package/lib/models/links/LinkCollection.js +3 -1
- package/lib/models/links/LinkCollection.js.flow +8 -2
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js +10 -9
- package/lib/models/links/LinkModel.js.flow +24 -16
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/list/ListItemModel.js +3 -1
- package/lib/models/list/ListItemModel.js.flow +4 -0
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js +1 -1
- package/lib/models/list/ListModel.js.flow +6 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js +1 -1
- package/lib/models/panels/GroupingPanelModel.js.flow +2 -0
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/tab/TabModel.js +2 -2
- package/lib/models/tab/TabModel.js.flow +4 -0
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +4 -2
- package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +2 -1
- package/lib/modularui/Authenticate.js.flow +2 -1
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +43 -7
- package/lib/modularui/ModularUIRequest.js.flow +49 -8
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js +31 -0
- package/lib/modularui/ModularUIResponse.js.flow +35 -0
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/modularui/__tests__/CustomContextPath.spec.js.flow +61 -0
- package/lib/redux/_modularui/ModularUIActions.js +3 -1
- package/lib/redux/_modularui/ModularUIActions.js.flow +6 -1
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +6 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +10 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +2 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/Application.js +2 -0
- package/lib/redux/actions/Application.js.flow +1 -0
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js +2 -0
- package/lib/redux/connectors/PanelRenderer.js.flow +1 -0
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/utils/fetch/types.js.flow +2 -0
- package/lib/utils/fetch/types.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +2 -0
- package/lib/utils/helpers/checkResource.js.flow +2 -0
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/Settings.js +2 -2
- package/src/hooks/useForm.js +2 -0
- package/src/hooks/useModularUIBasic.js +14 -0
- package/src/hooks/useModularUIModel.js +58 -11
- package/src/models/actions/ActionCollection.js +14 -2
- package/src/models/actions/ActionModel.js +38 -16
- package/src/models/application/ApplicationModel.js +7 -1
- package/src/models/base/ResourceModel.js +35 -10
- package/src/models/caseview/CaseViewModel.js +3 -1
- package/src/models/concepts/ConceptLinkModel.js +1 -0
- package/src/models/concepts/SourceReferenceModel.js +2 -1
- package/src/models/content/ContentIndexModel.js +2 -2
- package/src/models/content/ContentLinkModel.js +2 -0
- package/src/models/content/SectionModel.js +1 -0
- package/src/models/detail/DetailModel.js +2 -0
- package/src/models/error/ErrorResponse.js +2 -0
- package/src/models/form/FormModel.js +1 -1
- package/src/models/href/Href.js +58 -3
- package/src/models/href/ListHref.js +1 -1
- package/src/models/links/LinkCollection.js +8 -2
- package/src/models/links/LinkModel.js +24 -16
- package/src/models/list/ListItemModel.js +4 -0
- package/src/models/list/ListModel.js +6 -1
- package/src/models/panels/GroupingPanelModel.js +2 -0
- package/src/models/tab/TabModel.js +4 -0
- package/src/models/taskgroup/TaskGroupModel.js +6 -0
- package/src/modularui/Authenticate.js +2 -1
- package/src/modularui/ModularUIRequest.js +49 -8
- package/src/modularui/ModularUIResponse.js +35 -0
- package/src/modularui/__tests__/CustomContextPath.spec.js +61 -0
- package/src/modularui/__tests__/contributions.json +312 -0
- package/src/modularui/__tests__/data.json +263 -0
- package/src/redux/_modularui/ModularUIActions.js +6 -1
- package/src/redux/_modularui/ModularUIMiddleware.js +10 -0
- package/src/redux/_modularui/types.js +2 -0
- package/src/redux/actions/Application.js +1 -0
- package/src/redux/connectors/PanelRenderer.js +1 -0
- package/src/utils/fetch/types.js +2 -0
- package/src/utils/helpers/checkResource.js +2 -0
|
@@ -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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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;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;
|
|
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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CAAC,CAAC;;AAEJ;AACA;AADAK,OAAA,CAAAgB,cAAA,GAAAA,cAAA;AAEO,MAAMC,cAAc,GAAGA,CAC5Bf,IAAY,EACZP,OAAqB,KAErB,IAAAC,oCAAiB,EAAC,aAAa,EAAEM,IAAI,EAAE;EACrCL,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEoB,wBAAe;EAC5B,GAAGvB;AACL,CAAC,CAAC;;AAEJ;AACA;AADAK,OAAA,CAAAiB,cAAA,GAAAA,cAAA;AAEO,MAAME,SAAS,GAAGA,CACvBjB,IAAY,EACZP,OAAqB,KAErB,IAAAC,oCAAiB,EAAC,QAAQ,EAAEM,IAAI,EAAE;EAChCL,cAAc,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(
|
|
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(
|
|
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
|
|
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,IA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AAA;IAAA;IAC7B,MAAMb,aAAa,GAAG,IAAIvB,gBAAgB,CAAC,CAAC;IAE5CuB,aAAa,CAACd,UAAU,GAAG,IAAAe,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,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
|
|
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
|
-
|
|
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
|
|
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
|
|
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",
|
|
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(
|
|
93
|
+
if (this.layouthint.has(_constants.CREATE_ACTION)) {
|
|
75
94
|
return "create";
|
|
76
95
|
}
|
|
77
|
-
if (this.layouthint.has(
|
|
96
|
+
if (this.layouthint.has(_constants.UPDATE_ACTION)) {
|
|
78
97
|
return "update";
|
|
79
98
|
}
|
|
80
|
-
if (this.layouthint.has(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
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
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionModel.js","names":["_objects","require","_ProcessStatusSettingsModel","_interopRequireDefault","_AttributeCollection","_BaseModel","_Href","
|
|
1
|
+
{"version":3,"file":"ActionModel.js","names":["_objects","require","_ProcessStatusSettingsModel","_interopRequireDefault","_AttributeCollection","_BaseModel","_Href","_constants","ActionModel","BaseModel","constructor","data","contributions","origin","contextPath","_defineProperty2","default","_fieldCollection","AttributeCollection","fields","_origin","_contextPath","createFromHref","name","href","label","type","arguments","length","undefined","isDisabled","getBasePath","selfhref","_href","Href","querystring","method","getData","HTTP_METHODS","POST","layouthint","has","CREATE_ACTION","UPDATE_ACTION","DELETE_ACTION","getContribution","all","fieldCollection","_context","_context2","_map","_filter","call","attribute","value","join","getFieldByKey","key","getAttributeByKey","hasFieldByKey","isProcessTask","processStatus","ProcessStatusSettingsModel","icon","_icon","exports"],"sources":["../../../src/models/actions/ActionModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ProcessStatusSettingsModel from \"../process/ProcessStatusSettingsModel\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\n\nimport {\n getBasePath,\n HTTP_METHODS,\n CREATE_ACTION,\n UPDATE_ACTION,\n DELETE_ACTION,\n} from \"../../constants\";\n\nimport type { AttributeType } from \"../types\";\n\n/**\n * Defines an Action. For instance an action on the tab 'books', which leads to a form\n */\nexport default class ActionModel extends BaseModel {\n _fieldCollection: AttributeCollection;\n _href: Href;\n _icon: string;\n _origin: ?string;\n _contextPath: ?string;\n\n constructor(\n data: Object,\n contributions: Object,\n origin?: string,\n contextPath?: string,\n ) {\n super(data, contributions);\n\n this._fieldCollection = new AttributeCollection(\n this.data.fields,\n this.contributions.fields,\n );\n this._origin = origin;\n this._contextPath = contextPath;\n }\n\n /**\n */\n static createFromHref(\n name: string,\n href: string,\n label: string,\n type: string = \"form\",\n origin?: string,\n contextPath?: string,\n ): ActionModel {\n const data = { name, href };\n const contributions = { name, label: label ?? name, type };\n return new ActionModel(data, contributions, origin, contextPath);\n }\n\n /**\n */\n get isDisabled(): boolean {\n return this.data.href == null;\n }\n\n /**\n */\n get origin(): string {\n return this._origin ?? \"\";\n }\n\n /**\n */\n get contextPath(): string {\n return this._contextPath ?? getBasePath();\n }\n\n /**\n * retrieve href of action\n */\n get selfhref(): Href {\n return (\n this._href ??\n new Href(\n `${this.data.href}?${this.querystring}`,\n \"Form\",\n this.origin,\n this.contextPath,\n )\n );\n }\n\n /**\n */\n set selfhref(href: Href) {\n this._href = href;\n }\n\n /**\n * retrieve request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this.getData(\"method\", HTTP_METHODS.POST);\n }\n\n /**\n * Retrieve type of method\n */\n get type(): string {\n if (this.layouthint.has(CREATE_ACTION)) {\n return \"create\";\n }\n if (this.layouthint.has(UPDATE_ACTION)) {\n return \"update\";\n }\n if (this.layouthint.has(DELETE_ACTION)) {\n return \"delete\";\n }\n\n return this.getContribution(\"type\", \"general\");\n }\n\n /**\n * Retrieve name of action\n */\n get name(): string {\n return this.getData(\"name\", \"unknown\");\n }\n\n /**\n * retrieve the collection of field attributes as an array\n */\n get fields(): Array<AttributeType> {\n return this._fieldCollection.all;\n }\n\n /**\n * Retrieve the field collection\n */\n get fieldCollection(): AttributeCollection {\n return this._fieldCollection;\n }\n\n /**\n */\n set fieldCollection(fieldCollection: AttributeCollection) {\n this._fieldCollection = fieldCollection;\n }\n\n /**\n * Retrieve querystring of action\n */\n get querystring(): string {\n return this.fields\n .filter((attribute) => attribute.value != null && attribute.value !== \"\")\n .map((attribute) => {\n const { value } = attribute;\n if (value !== null) {\n return `${attribute.name}=${value}`;\n }\n return attribute.name;\n })\n .join(\"&\");\n }\n\n /**\n * Retrieve a field by it's key\n */\n getFieldByKey(key: string): AttributeType | null {\n return this._fieldCollection.getAttributeByKey(key);\n }\n\n /**\n * Indicates if field exists by the given key\n */\n hasFieldByKey(key: string): boolean {\n return this.getFieldByKey(key) !== null;\n }\n\n /**\n * Getting the key/name of this action\n */\n get key(): string {\n return this.data.name;\n }\n\n /**\n * Getting the label of the action\n */\n get label(): string {\n return this.getContribution(\"label\", this.key);\n }\n\n /**\n */\n get isProcessTask(): boolean {\n return has(this.contributions, \"processTask\");\n }\n\n /**\n */\n get processStatus(): ProcessStatusSettingsModel | null {\n if (this.isProcessTask) {\n return new ProcessStatusSettingsModel(\n this.getData(\"processStatus\", {}),\n this.getContribution(\"processTask\", {}),\n );\n }\n\n return null;\n }\n\n /**\n */\n get icon(): string {\n return this._icon;\n }\n\n /**\n */\n set icon(icon: string) {\n this._icon = icon;\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAD,sB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IA,GAAGA,CAAA,EAAW;IAChB,OAAO,IAAI,CAAC9C,IAAI,CAACY,IAAI;EACvB;;EAEA;AACF;AACA;EACE,IAAIE,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACoB,eAAe,CAAC,OAAO,EAAE,IAAI,CAACY,GAAG,CAAC;EAChD;;EAEA;AACF;EACE,IAAIG,aAAaA,CAAA,EAAY;IAC3B,OAAO,IAAAnB,YAAG,EAAC,IAAI,CAAC7B,aAAa,EAAE,aAAa,CAAC;EAC/C;;EAEA;AACF;EACE,IAAIiD,aAAaA,CAAA,EAAsC;IACrD,IAAI,IAAI,CAACD,aAAa,EAAE;MACtB,OAAO,IAAIE,mCAA0B,CACnC,IAAI,CAACzB,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EACjC,IAAI,CAACQ,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC,CACxC,CAAC;IACH;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIkB,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACC,KAAK;EACnB;;EAEA;AACF;EACE,IAAID,IAAIA,CAACA,IAAY,EAAE;IACrB,IAAI,CAACC,KAAK,GAAGD,IAAI;EACnB;AACF;AAACE,OAAA,CAAAjD,OAAA,GAAAR,WAAA","ignoreList":[]}
|
|
@@ -88,7 +88,7 @@ class ApplicationModel extends _ResourceModel.default {
|
|
|
88
88
|
* Get modelcatalog link
|
|
89
89
|
*/
|
|
90
90
|
get modelcatalog() {
|
|
91
|
-
return _LinkModel.default.create("modelcatalog", "/modelcatalog", "Model catalog");
|
|
91
|
+
return _LinkModel.default.create("modelcatalog", "/modelcatalog", "Model catalog", this.origin, this.contextPath);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -102,7 +102,13 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
102
102
|
* Get modelcatalog link
|
|
103
103
|
*/
|
|
104
104
|
get modelcatalog(): LinkModel {
|
|
105
|
-
return LinkModel.create(
|
|
105
|
+
return LinkModel.create(
|
|
106
|
+
"modelcatalog",
|
|
107
|
+
"/modelcatalog",
|
|
108
|
+
"Model catalog",
|
|
109
|
+
this.origin,
|
|
110
|
+
this.contextPath,
|
|
111
|
+
);
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationModel.js","names":["_ResourceModel","_interopRequireDefault","require","_LinkModel","_UserServicesModel","_exceptions","_constants","ApplicationModel","ResourceModel","constructor","arguments","_defineProperty2","default","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","NotAllowedUriException","setChildModels","models","userServiceModel","_find","call","model","userServices","label","getContribution","authenticationTypes","DEFAULT_AUTHENTICATION_TYPE","sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","LinkModel","create","_userServices","UserServicesModel","isLoggedIn","userHref","userLink","userMustChangePassword","mustChangePassword","exports"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport { DEFAULT_AUTHENTICATION_TYPE } from \"../../constants\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ApplicationModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\",\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\",\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n const authenticationTypes = this.getContribution(\"security\", [\n DEFAULT_AUTHENTICATION_TYPE,\n ]);\n\n if (authenticationTypes) {\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) =>\n a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1,\n );\n }\n\n return [DEFAULT_AUTHENTICATION_TYPE];\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\"modelcatalog\"
|
|
1
|
+
{"version":3,"file":"ApplicationModel.js","names":["_ResourceModel","_interopRequireDefault","require","_LinkModel","_UserServicesModel","_exceptions","_constants","ApplicationModel","ResourceModel","constructor","arguments","_defineProperty2","default","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","NotAllowedUriException","setChildModels","models","userServiceModel","_find","call","model","userServices","label","getContribution","authenticationTypes","DEFAULT_AUTHENTICATION_TYPE","sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","LinkModel","create","origin","contextPath","_userServices","UserServicesModel","isLoggedIn","userHref","userLink","userMustChangePassword","mustChangePassword","exports"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport { DEFAULT_AUTHENTICATION_TYPE } from \"../../constants\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ApplicationModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\",\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\",\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n const authenticationTypes = this.getContribution(\"security\", [\n DEFAULT_AUTHENTICATION_TYPE,\n ]);\n\n if (authenticationTypes) {\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) =>\n a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1,\n );\n }\n\n return [DEFAULT_AUTHENTICATION_TYPE];\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\n \"modelcatalog\",\n \"/modelcatalog\",\n \"Model catalog\",\n this.origin,\n this.contextPath,\n );\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices?.userLink) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get userMustChangePassword(): boolean {\n return this.userServices?.mustChangePassword ?? false;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAOA;AACA;AACA;AACe,MAAMK,gBAAgB,SAASC,sBAAa,CAAC;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA;EAAA;EAG1D;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,aAAa;EACtB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,aAAa;EA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