@beinformed/ui 1.25.2 → 1.25.5
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 +18 -0
- package/esm/constants/Constants.js +5 -0
- package/esm/constants/Constants.js.map +1 -1
- package/esm/hooks/useAuthentication.js +5 -5
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +7 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js +9 -1
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/hooks/useModularUIRequest.js +5 -7
- package/esm/hooks/useModularUIRequest.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +9 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +7 -0
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +6 -0
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +6 -0
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +6 -0
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +6 -0
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +6 -0
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentModel.js +6 -0
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +6 -0
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/ContentTypeModel.js +6 -0
- package/esm/models/content/ContentTypeModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +6 -0
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/form/FormModel.js +6 -0
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +6 -0
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/list/ListModel.js +6 -0
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/lookup/LookupOptionsModel.js +6 -0
- package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
- package/esm/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/esm/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +6 -0
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/resolveModel.js +4 -4
- package/esm/models/resolveModel.js.map +1 -1
- package/esm/models/search/CaseSearchModel.js +6 -0
- package/esm/models/search/CaseSearchModel.js.map +1 -1
- package/esm/models/tab/TabModel.js +6 -0
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +6 -0
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/esm/models/user/UserModel.js +6 -0
- package/esm/models/user/UserModel.js.map +1 -1
- package/esm/models/user/UserProfileModel.js +6 -0
- package/esm/models/user/UserProfileModel.js.map +1 -1
- package/esm/models/user/UserServicesModel.js +6 -0
- package/esm/models/user/UserServicesModel.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +54 -10
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/types.js +2 -0
- package/esm/modularui/types.js.map +1 -0
- package/esm/redux/_modularui/ModularUIActions.js +2 -0
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +1 -0
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/utils/fetch/types.js.map +1 -1
- package/lib/constants/Constants.js +7 -1
- package/lib/constants/Constants.js.flow +6 -0
- package/lib/constants/Constants.js.map +1 -1
- package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -1
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +1 -1
- package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +2 -2
- package/lib/hooks/useAuthentication.js +4 -4
- package/lib/hooks/useAuthentication.js.flow +17 -5
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModularUI.js.flow +2 -2
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +7 -1
- package/lib/hooks/useModularUIBasic.js.flow +14 -4
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js +11 -2
- package/lib/hooks/useModularUIModel.js.flow +19 -10
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js +5 -7
- package/lib/hooks/useModularUIRequest.js.flow +12 -11
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +8 -1
- package/lib/models/application/ApplicationModel.js.flow +10 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +7 -0
- package/lib/models/base/ResourceModel.js.flow +7 -0
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +6 -0
- package/lib/models/caseview/CaseViewModel.js.flow +6 -0
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +6 -0
- package/lib/models/concepts/BusinessScenarioModel.js.flow +6 -0
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +6 -0
- package/lib/models/concepts/ConceptDetailModel.js.flow +6 -0
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +6 -0
- package/lib/models/concepts/ConceptIndexModel.js.flow +6 -0
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.flow +6 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +6 -0
- package/lib/models/content/ContentIndexModel.js.flow +6 -0
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +6 -0
- package/lib/models/content/ContentModel.js.flow +6 -0
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +6 -0
- package/lib/models/content/ContentTOCModel.js.flow +6 -0
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/ContentTypeModel.js +6 -0
- package/lib/models/content/ContentTypeModel.js.flow +6 -0
- package/lib/models/content/ContentTypeModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +6 -0
- package/lib/models/detail/DetailModel.js.flow +6 -0
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/form/FormModel.js +6 -0
- package/lib/models/form/FormModel.js.flow +6 -0
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js +6 -0
- package/lib/models/list/ListDetailModel.js.flow +6 -0
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListModel.js +6 -0
- package/lib/models/list/ListModel.js.flow +6 -0
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js +6 -0
- package/lib/models/lookup/LookupOptionsModel.js.flow +6 -0
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/lib/models/modelcatalog/ModelCatalogModel.js.flow +6 -0
- package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js +6 -0
- package/lib/models/panels/GroupingPanelModel.js.flow +6 -0
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/resolveModel.js +4 -3
- package/lib/models/resolveModel.js.flow +6 -4
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/search/CaseSearchModel.js +6 -0
- package/lib/models/search/CaseSearchModel.js.flow +6 -0
- package/lib/models/search/CaseSearchModel.js.map +1 -1
- package/lib/models/tab/TabModel.js +6 -0
- package/lib/models/tab/TabModel.js.flow +6 -0
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/types.js.flow +1 -1
- package/lib/models/types.js.map +1 -1
- package/lib/models/user/UserModel.js +6 -0
- package/lib/models/user/UserModel.js.flow +6 -0
- package/lib/models/user/UserModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js +6 -0
- package/lib/models/user/UserProfileModel.js.flow +6 -0
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js +6 -0
- package/lib/models/user/UserServicesModel.js.flow +6 -0
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +54 -10
- package/lib/modularui/ModularUIRequest.js.flow +83 -17
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/__tests__/ModularUIRequest.spec.js.flow +4 -9
- package/lib/modularui/types.js +2 -0
- package/lib/modularui/types.js.flow +4 -0
- package/lib/modularui/types.js.map +1 -0
- package/lib/redux/_modularui/ModularUIActions.js +2 -0
- package/lib/redux/_modularui/ModularUIActions.js.flow +6 -4
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +1 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +5 -2
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +5 -3
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.flow +2 -2
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/utils/fetch/types.js.flow +12 -4
- package/lib/utils/fetch/types.js.map +1 -1
- package/package.json +7 -7
- package/src/constants/Constants.js +6 -0
- package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -1
- package/src/hooks/__tests__/useModelCatalog.spec.js +1 -1
- package/src/hooks/__tests__/useModularUIBasic.spec.js +2 -2
- package/src/hooks/useAuthentication.js +17 -5
- package/src/hooks/useModularUI.js +2 -2
- package/src/hooks/useModularUIBasic.js +14 -4
- package/src/hooks/useModularUIModel.js +19 -10
- package/src/hooks/useModularUIRequest.js +12 -11
- package/src/models/application/ApplicationModel.js +10 -1
- package/src/models/base/ResourceModel.js +7 -0
- package/src/models/caseview/CaseViewModel.js +6 -0
- package/src/models/concepts/BusinessScenarioModel.js +6 -0
- package/src/models/concepts/ConceptDetailModel.js +6 -0
- package/src/models/concepts/ConceptIndexModel.js +6 -0
- package/src/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/src/models/content/ContentIndexModel.js +6 -0
- package/src/models/content/ContentModel.js +6 -0
- package/src/models/content/ContentTOCModel.js +6 -0
- package/src/models/content/ContentTypeModel.js +6 -0
- package/src/models/detail/DetailModel.js +6 -0
- package/src/models/form/FormModel.js +6 -0
- package/src/models/list/ListDetailModel.js +6 -0
- package/src/models/list/ListModel.js +6 -0
- package/src/models/lookup/LookupOptionsModel.js +6 -0
- package/src/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/src/models/panels/GroupingPanelModel.js +6 -0
- package/src/models/resolveModel.js +6 -4
- package/src/models/search/CaseSearchModel.js +6 -0
- package/src/models/tab/TabModel.js +6 -0
- package/src/models/taskgroup/TaskGroupModel.js +6 -0
- package/src/models/types.js +1 -1
- package/src/models/user/UserModel.js +6 -0
- package/src/models/user/UserProfileModel.js +6 -0
- package/src/models/user/UserServicesModel.js +6 -0
- package/src/modularui/ModularUIRequest.js +83 -17
- package/src/modularui/__tests__/ModularUIRequest.spec.js +4 -9
- package/src/modularui/types.js +4 -0
- package/src/redux/_modularui/ModularUIActions.js +6 -4
- package/src/redux/_modularui/ModularUIMiddleware.js +5 -2
- package/src/redux/_modularui/types.js +5 -3
- package/src/redux/_modularui/withModularUI.js +2 -2
- package/src/utils/fetch/types.js +12 -4
- package/types/constants/Constants.d.ts +5 -0
- package/types/models/base/ResourceModel.d.ts +4 -0
- package/types/models/form/FormObjectModel.d.ts +28 -2
- package/types/models/resolveModel.d.ts +1 -1
- package/types/models/types.d.ts +1 -1
- package/types/modularui/ModularUIRequest.d.ts +15 -7
- package/types/modularui/types.d.ts +2 -0
- package/types/redux/_modularui/types.d.ts +2 -2
- package/types/utils/fetch/types.d.ts +8 -5
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ResetModularUIAction,
|
|
16
16
|
UpdateStatusAction,
|
|
17
17
|
} from "./types";
|
|
18
|
-
import type {
|
|
18
|
+
import type { RequestModularUIOptions } from "../../utils/fetch/types";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
*/
|
|
@@ -90,11 +90,12 @@ const loadModelSuccessAction = (
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
+
* This action is handled by the modularui middleware
|
|
93
94
|
*/
|
|
94
95
|
export const loadModel = (
|
|
95
96
|
key: string,
|
|
96
97
|
href: Href | string,
|
|
97
|
-
options?:
|
|
98
|
+
options?: RequestModularUIOptions
|
|
98
99
|
): ModularUIAction => ({
|
|
99
100
|
type: "MODULARUI/FETCH",
|
|
100
101
|
payload: {
|
|
@@ -104,6 +105,7 @@ export const loadModel = (
|
|
|
104
105
|
locale: options?.locale ?? "en",
|
|
105
106
|
childmodels: options?.childmodels,
|
|
106
107
|
targetModel: options?.targetModel,
|
|
108
|
+
forceTargetModel: options?.forceTargetModel,
|
|
107
109
|
/**
|
|
108
110
|
*/
|
|
109
111
|
successAction: (model) =>
|
|
@@ -131,7 +133,7 @@ export const loadModularUI =
|
|
|
131
133
|
(
|
|
132
134
|
key: string,
|
|
133
135
|
href: Href | string,
|
|
134
|
-
options?:
|
|
136
|
+
options?: RequestModularUIOptions
|
|
135
137
|
): ThunkAction =>
|
|
136
138
|
(dispatch: Dispatch) => {
|
|
137
139
|
dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));
|
|
@@ -154,7 +156,7 @@ export const loadModularUI =
|
|
|
154
156
|
*/
|
|
155
157
|
export const reloadModel = (
|
|
156
158
|
model: ModularUIModel,
|
|
157
|
-
options?:
|
|
159
|
+
options?: RequestModularUIOptions
|
|
158
160
|
): ThunkAction =>
|
|
159
161
|
loadModularUI(model.connectKey, model.selfhref, {
|
|
160
162
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIActions.js","names":["setModel","key","model","connectKey","type","payload","updateModel","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {
|
|
1
|
+
{"version":3,"file":"ModularUIActions.js","names":["setModel","key","model","connectKey","type","payload","updateModel","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate: ?ModularUIModel\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":"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"}
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
import type { ModularUIModel } from "../../models/types";
|
|
17
17
|
import type Href from "../../models/href/Href";
|
|
18
18
|
import type { ModularUIAction, SuccessAction, ErrorAction } from "./types";
|
|
19
|
+
import type { TargetModel } from "../../modularui/types";
|
|
19
20
|
|
|
20
21
|
type RequestOptions = {
|
|
21
22
|
href: Href,
|
|
@@ -23,14 +24,15 @@ type RequestOptions = {
|
|
|
23
24
|
data?: string | { [key: string]: string },
|
|
24
25
|
locale: string,
|
|
25
26
|
childmodels?: boolean,
|
|
26
|
-
targetModel?:
|
|
27
|
+
targetModel?: TargetModel,
|
|
28
|
+
forceTargetModel?: boolean,
|
|
27
29
|
isReload?: boolean,
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Symbol key that carries API call info interpreted by this Redux middleware.
|
|
32
34
|
*/
|
|
33
|
-
const createRequest = (modularui: RequestOptions) => {
|
|
35
|
+
const createRequest = (modularui: RequestOptions): ModularUIRequest => {
|
|
34
36
|
const request = new ModularUIRequest(modularui.href, {
|
|
35
37
|
method: modularui.method || HTTP_METHODS.GET,
|
|
36
38
|
data: modularui.data || {},
|
|
@@ -41,6 +43,7 @@ const createRequest = (modularui: RequestOptions) => {
|
|
|
41
43
|
|
|
42
44
|
if (modularui.targetModel) {
|
|
43
45
|
request.targetModel = modularui.targetModel;
|
|
46
|
+
request.forceTargetModel = modularui.forceTargetModel ?? false;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
return request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIMiddleware.js","names":["createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","targetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?:
|
|
1
|
+
{"version":3,"file":"ModularUIMiddleware.js","names":["createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch\n) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next\n );\n }\n\n return next(action);\n };\n"],"mappings":"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"}
|
|
@@ -7,13 +7,14 @@ import typeof {
|
|
|
7
7
|
HTTP_METHODS,
|
|
8
8
|
MODULARUI_STATUS,
|
|
9
9
|
} from "../../constants/Constants";
|
|
10
|
-
import type { RequestBaseOptions } from "../../utils/fetch/types";
|
|
11
10
|
import type { ComponentType } from "react";
|
|
11
|
+
import type { TargetModel } from "../../modularui/types";
|
|
12
|
+
import type { RequestModularUIOptions } from "../../utils/fetch/types";
|
|
12
13
|
|
|
13
14
|
export type ModularUIOptions = {
|
|
14
15
|
propName?: string,
|
|
15
16
|
removeOnUnmount?: boolean,
|
|
16
|
-
...
|
|
17
|
+
...RequestModularUIOptions,
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export type ModelEntry = {
|
|
@@ -56,7 +57,8 @@ export type ModularUIAction = {
|
|
|
56
57
|
data?: string | { [key: string]: string },
|
|
57
58
|
locale: string,
|
|
58
59
|
childmodels?: boolean,
|
|
59
|
-
targetModel?:
|
|
60
|
+
targetModel?: TargetModel,
|
|
61
|
+
forceTargetModel?: boolean,
|
|
60
62
|
successAction: (
|
|
61
63
|
model: ModularUIModel
|
|
62
64
|
) => UpdateModelAction | SetModelAction,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n successAction: (\n model: ModularUIModel\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>\n) => ComponentType<any>;\n"],"mappings":""}
|
|
@@ -21,9 +21,9 @@ import type {
|
|
|
21
21
|
} from "../types";
|
|
22
22
|
import type Href from "../../models/href/Href";
|
|
23
23
|
import type { ModularUIModel } from "../../models/types";
|
|
24
|
-
import type { RequestBaseOptions } from "../../utils/fetch/types";
|
|
25
24
|
import type FetchException from "../../exceptions/FetchException";
|
|
26
25
|
import type { ComponentType } from "react";
|
|
26
|
+
import type { RequestModularUIOptions } from "../../utils/fetch/types";
|
|
27
27
|
|
|
28
28
|
type StateProps = {
|
|
29
29
|
modularui: (href: Href, options: any) => ModularUIRequest,
|
|
@@ -35,7 +35,7 @@ type DispatchProps = {
|
|
|
35
35
|
finishProgress: () => FinishProgressAction,
|
|
36
36
|
reloadModel: (
|
|
37
37
|
model: ModularUIModel,
|
|
38
|
-
options?:
|
|
38
|
+
options?: RequestModularUIOptions
|
|
39
39
|
) => ThunkAction,
|
|
40
40
|
handleError: (error: Error | FetchException) => ThunkAction,
|
|
41
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withModularUI.js","names":["modularui","createSelector","getLocale","localeCode","href","options","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type
|
|
1
|
+
{"version":3,"file":"withModularUI.js","names":["modularui","createSelector","getLocale","localeCode","href","options","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\ntype StateProps = {\n modularui: (href: Href, options: any) => ModularUIRequest,\n locale: string,\n};\n\ntype DispatchProps = {\n startProgress: () => StartProgressAction,\n finishProgress: () => FinishProgressAction,\n reloadModel: (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n ) => ThunkAction,\n handleError: (error: Error | FetchException) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst modularui = createSelector(\n [getLocale],\n (localeCode) =>\n (href, options = {}) => {\n const modularuiRequest = new ModularUIRequest(href, options);\n modularuiRequest.locale = localeCode;\n return modularuiRequest;\n }\n);\n\n/**\n */\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n modularui: modularui(state),\n locale: state.i18n.locale,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n startProgress,\n finishProgress,\n reloadModel,\n handleError,\n};\n\n/**\n * Injects the modular ui service and the progress start and finish actions\n * This can be used to request modular ui services inside react view components\n */\nconst withModularui: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n\nexport default withModularui;\n"],"mappings":";;;;;;;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAkCA,MAAMA,SAAS,GAAG,IAAAC,wBAAc,EAC9B,CAACC,eAAS,CAAC,EACVC,UAAU,IACT,UAACC,IAAI,EAAmB;EAAA,IAAjBC,OAAO,uEAAG,CAAC,CAAC;EACjB,MAAMC,gBAAgB,GAAG,IAAIC,yBAAgB,CAACH,IAAI,EAAEC,OAAO,CAAC;EAC5DC,gBAAgB,CAACE,MAAM,GAAGL,UAAU;EACpC,OAAOG,gBAAgB;AACzB,CAAC,CACJ;;AAED;AACA;AACA,MAAMG,eAAe,GAAIC,KAAiB,KAAkB;EAC1DV,SAAS,EAAEA,SAAS,CAACU,KAAK,CAAC;EAC3BF,MAAM,EAAEE,KAAK,CAACC,IAAI,CAACH;AACrB,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,aAAa,EAAbA,gCAAa;EACbC,cAAc,EAAdA,iCAAc;EACdC,WAAW,EAAXA,6BAAW;EACXC,WAAW,EAAXA;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAiC,GAAG,IAAAC,mBAAO,EAO/CT,eAAe,EAAEG,kBAAkB,CAAC;AAAC,eAExBK,aAAa;AAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import typeof { HTTP_METHODS } from "../../constants/Constants";
|
|
3
3
|
import type { ModularUIModel } from "../../models/types";
|
|
4
|
+
import type { TargetModel } from "../../modularui/types";
|
|
4
5
|
|
|
5
6
|
export type RequestURLOptions = {
|
|
6
7
|
url: string,
|
|
7
8
|
};
|
|
9
|
+
|
|
8
10
|
export type RequestBaseOptions = {
|
|
9
11
|
method?: $Keys<HTTP_METHODS>,
|
|
10
12
|
params?: string,
|
|
@@ -24,11 +26,17 @@ export type RequestBaseOptions = {
|
|
|
24
26
|
includeContext?: boolean,
|
|
25
27
|
locale?: string,
|
|
26
28
|
cache?: boolean,
|
|
29
|
+
isReload?: boolean,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };
|
|
33
|
+
|
|
34
|
+
export type RequestModularUIOptions = {
|
|
35
|
+
...RequestBaseOptions,
|
|
36
|
+
targetModel?: TargetModel,
|
|
37
|
+
forceTargetModel?: boolean,
|
|
38
|
+
updateModel?: ModularUIModel,
|
|
27
39
|
childmodels?: boolean,
|
|
28
40
|
isValidationRequest?: boolean,
|
|
29
|
-
targetModel?: Class<ModularUIModel>,
|
|
30
|
-
updateModel?: ModularUIModel,
|
|
31
|
-
isReload?: boolean,
|
|
32
41
|
removeOnUnmount?: boolean,
|
|
33
42
|
};
|
|
34
|
-
export type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\nexport type RequestBaseOptions = {\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: string | { [key: string]: string },\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\n\nexport type RequestBaseOptions = {\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: string | { [key: string]: string },\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n isReload?: boolean,\n};\n\nexport type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };\n\nexport type RequestModularUIOptions = {\n ...RequestBaseOptions,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n updateModel?: ModularUIModel,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n removeOnUnmount?: boolean,\n};\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.5",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@babel/cli": "^7.20.7",
|
|
103
|
-
"@babel/core": "^7.20.
|
|
103
|
+
"@babel/core": "^7.20.12",
|
|
104
104
|
"@babel/eslint-parser": "^7.19.1",
|
|
105
105
|
"@babel/eslint-plugin": "^7.19.1",
|
|
106
106
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"@babel/preset-env": "^7.20.2",
|
|
110
110
|
"@babel/preset-flow": "^7.18.6",
|
|
111
111
|
"@babel/preset-react": "^7.18.6",
|
|
112
|
-
"@commitlint/cli": "^17.
|
|
113
|
-
"@commitlint/config-conventional": "^17.
|
|
112
|
+
"@commitlint/cli": "^17.4.1",
|
|
113
|
+
"@commitlint/config-conventional": "^17.4.0",
|
|
114
114
|
"@testing-library/react": "^13.4.0",
|
|
115
115
|
"auditjs": "^4.0.39",
|
|
116
116
|
"babel-jest": "^29.3.1",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"eslint-plugin-babel": "^5.3.1",
|
|
124
124
|
"eslint-plugin-ft-flow": "^2.0.3",
|
|
125
125
|
"eslint-plugin-import": "^2.26.0",
|
|
126
|
-
"eslint-plugin-jest": "^27.2.
|
|
126
|
+
"eslint-plugin-jest": "^27.2.1",
|
|
127
127
|
"eslint-plugin-jsdoc": "^39.6.4",
|
|
128
128
|
"eslint-plugin-react": "^7.31.11",
|
|
129
129
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"flow-typed": "^3.8.0",
|
|
134
134
|
"glob": "^8.0.3",
|
|
135
135
|
"history": "^4.0.0",
|
|
136
|
-
"husky": "^8.0.
|
|
136
|
+
"husky": "^8.0.3",
|
|
137
137
|
"jest": "^29.3.1",
|
|
138
138
|
"jest-environment-jsdom": "^29.3.1",
|
|
139
139
|
"jest-junit": "^15.0.0",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"jscodeshift": "^0.14.0",
|
|
142
142
|
"lint-staged": "^13.1.0",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^2.8.
|
|
144
|
+
"prettier": "^2.8.2",
|
|
145
145
|
"react": "^18.0.0",
|
|
146
146
|
"react-dom": "^18.0.0",
|
|
147
147
|
"react-helmet-async": "^1.0.0",
|
|
@@ -193,3 +193,9 @@ export const LOGIN_PATH_SETTING = "FormClient.login_url";
|
|
|
193
193
|
export const LOGIN_USERNAME_SETTING = "FormClient.username_field_name";
|
|
194
194
|
export const LOGIN_PASSWORD_SETTING = "FormClient.password_field_name";
|
|
195
195
|
export const LOGOUT_PATH_SETTING = "FormClient.logout_url";
|
|
196
|
+
|
|
197
|
+
export const fallbackDefaultAuthenticationType = {
|
|
198
|
+
name: "Form based authentication",
|
|
199
|
+
authentication: "DefaultFormClient",
|
|
200
|
+
isPrimary: true,
|
|
201
|
+
};
|
|
@@ -54,7 +54,7 @@ describe("modularui hooks", () => {
|
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
expect(result.current).
|
|
57
|
+
expect(result.current).toBeNull();
|
|
58
58
|
|
|
59
59
|
expect(store.getActions()).toStrictEqual([
|
|
60
60
|
{
|
|
@@ -104,7 +104,7 @@ describe("modularui hooks", () => {
|
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
106
|
|
|
107
|
-
expect(result.current).
|
|
107
|
+
expect(result.current).toBeNull();
|
|
108
108
|
|
|
109
109
|
expect(store.getActions()).toStrictEqual([
|
|
110
110
|
{
|
|
@@ -5,7 +5,11 @@ import { getApplication } from "../redux/_modularui/ModularUISelectors";
|
|
|
5
5
|
import { login, logout, resetAuthErrors } from "../redux/actions";
|
|
6
6
|
|
|
7
7
|
import Cache from "../utils/browser/Cache";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
BASE,
|
|
10
|
+
fallbackDefaultAuthenticationType,
|
|
11
|
+
getSetting,
|
|
12
|
+
} from "../constants";
|
|
9
13
|
|
|
10
14
|
import type { ResetAuthErrorsAction } from "../redux/types";
|
|
11
15
|
import type { AuthenticationType } from "../models/types";
|
|
@@ -38,7 +42,9 @@ export const useLogin = (): LoginHook => {
|
|
|
38
42
|
|
|
39
43
|
return {
|
|
40
44
|
isAuthenticated,
|
|
41
|
-
authenticationTypes: application?.authenticationTypes ?? [
|
|
45
|
+
authenticationTypes: application?.authenticationTypes ?? [
|
|
46
|
+
fallbackDefaultAuthenticationType,
|
|
47
|
+
],
|
|
42
48
|
errorMessage: auth.error,
|
|
43
49
|
resetErrors: () => dispatch(resetAuthErrors()),
|
|
44
50
|
login: (username: string, password: string) =>
|
|
@@ -47,13 +53,17 @@ export const useLogin = (): LoginHook => {
|
|
|
47
53
|
if (Cache.getItem("isRedirectLogin")) {
|
|
48
54
|
// prevent endless loop in redirects when authentication type can't be redirected
|
|
49
55
|
throw new IllegalStateException(
|
|
50
|
-
`Could not redirect to '${
|
|
56
|
+
`Could not redirect to '${
|
|
57
|
+
authenticationType.authentication
|
|
58
|
+
}' using url: '${authenticationType.redirectUri ?? ""}'`
|
|
51
59
|
);
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
if (!isAuthenticated) {
|
|
55
63
|
Cache.setItem("isRedirectLogin", true);
|
|
56
|
-
window.location.assign(
|
|
64
|
+
window.location.assign(
|
|
65
|
+
`${BASE}${authenticationType.redirectUri ?? ""}`
|
|
66
|
+
);
|
|
57
67
|
}
|
|
58
68
|
},
|
|
59
69
|
};
|
|
@@ -70,7 +80,9 @@ export const useLogout = (): LogoutHook => {
|
|
|
70
80
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
71
81
|
return {
|
|
72
82
|
isAuthenticated,
|
|
73
|
-
authenticationTypes: application?.authenticationTypes ?? [
|
|
83
|
+
authenticationTypes: application?.authenticationTypes ?? [
|
|
84
|
+
fallbackDefaultAuthenticationType,
|
|
85
|
+
],
|
|
74
86
|
logout: () => {
|
|
75
87
|
if (Cache.getItem("isRedirectLogin")) {
|
|
76
88
|
const origin = window.location.origin;
|
|
@@ -13,7 +13,7 @@ import useDeepCompareEffect from "./useDeepCompareEffect";
|
|
|
13
13
|
import { useLocale } from "./useI18n";
|
|
14
14
|
|
|
15
15
|
import type Href from "../models/href/Href";
|
|
16
|
-
import type {
|
|
16
|
+
import type { RequestModularUIOptions } from "../utils";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
*/
|
|
@@ -28,7 +28,7 @@ const useKeyForHook = (modelKey: string, url: string) => {
|
|
|
28
28
|
export const useModularUI = (
|
|
29
29
|
modelKey: string,
|
|
30
30
|
url: string | Href,
|
|
31
|
-
options:
|
|
31
|
+
options: RequestModularUIOptions = {
|
|
32
32
|
method: HTTP_METHODS.GET,
|
|
33
33
|
removeOnUnmount: false,
|
|
34
34
|
}
|
|
@@ -7,9 +7,10 @@ import { IllegalArgumentException, IllegalStateException } from "../exceptions";
|
|
|
7
7
|
|
|
8
8
|
import type { ModularUIModel, Href } from "../models";
|
|
9
9
|
|
|
10
|
-
type UseModularUIBasicOptions<T> = {
|
|
10
|
+
type UseModularUIBasicOptions<T: ModularUIModel> = {
|
|
11
11
|
expectedModels: Array<string>,
|
|
12
|
-
targetModel?: Class<T
|
|
12
|
+
targetModel?: Class<T> | Array<Class<T>>,
|
|
13
|
+
forceTargetModel?: boolean,
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -20,16 +21,22 @@ export const useModularUIBasic = <T: ModularUIModel>(
|
|
|
20
21
|
options: UseModularUIBasicOptions<T> = {
|
|
21
22
|
expectedModels: [],
|
|
22
23
|
targetModel: undefined,
|
|
24
|
+
forceTargetModel: false,
|
|
23
25
|
}
|
|
24
|
-
):
|
|
26
|
+
): T | null => {
|
|
25
27
|
const location = useLocation();
|
|
26
28
|
if (!href) {
|
|
27
29
|
throw new IllegalArgumentException("Missing href");
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
const useModularUIOptions = {
|
|
32
|
+
const useModularUIOptions = {
|
|
33
|
+
targetModel: undefined,
|
|
34
|
+
forceTargetModel: undefined,
|
|
35
|
+
isReload: false,
|
|
36
|
+
};
|
|
31
37
|
if (options.targetModel) {
|
|
32
38
|
useModularUIOptions.targetModel = options.targetModel;
|
|
39
|
+
useModularUIOptions.forceTargetModel = options.forceTargetModel;
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
// reload when the modular service starts with the current location
|
|
@@ -37,6 +44,7 @@ export const useModularUIBasic = <T: ModularUIModel>(
|
|
|
37
44
|
useModularUIOptions.isReload = true;
|
|
38
45
|
}
|
|
39
46
|
|
|
47
|
+
// $FlowFixMe[incompatible-call]
|
|
40
48
|
const modularUI = useModularUI(key, href, useModularUIOptions);
|
|
41
49
|
|
|
42
50
|
if (modularUI?.model) {
|
|
@@ -54,4 +62,6 @@ export const useModularUIBasic = <T: ModularUIModel>(
|
|
|
54
62
|
|
|
55
63
|
return model;
|
|
56
64
|
}
|
|
65
|
+
|
|
66
|
+
return null;
|
|
57
67
|
};
|
|
@@ -14,7 +14,7 @@ import { useModularUIBasic } from "./useModularUIBasic";
|
|
|
14
14
|
/**
|
|
15
15
|
* Load application
|
|
16
16
|
*/
|
|
17
|
-
export const useApplication = ():
|
|
17
|
+
export const useApplication = (): ApplicationModel | null =>
|
|
18
18
|
useModularUIBasic("application", "/", {
|
|
19
19
|
expectedModels: ["Application"],
|
|
20
20
|
targetModel: ApplicationModel,
|
|
@@ -23,7 +23,7 @@ export const useApplication = (): ?ApplicationModel =>
|
|
|
23
23
|
/**
|
|
24
24
|
* Load a tab by href
|
|
25
25
|
*/
|
|
26
|
-
export const useTab = (href: string):
|
|
26
|
+
export const useTab = (href: string): TabModel | null =>
|
|
27
27
|
useModularUIBasic("tab", href, {
|
|
28
28
|
expectedModels: ["Tab"],
|
|
29
29
|
targetModel: TabModel,
|
|
@@ -32,7 +32,7 @@ export const useTab = (href: string): ?TabModel =>
|
|
|
32
32
|
/**
|
|
33
33
|
* Load caseview by href
|
|
34
34
|
*/
|
|
35
|
-
export const useCaseView = (href: string):
|
|
35
|
+
export const useCaseView = (href: string): CaseViewModel | null =>
|
|
36
36
|
useModularUIBasic("caseview", href, {
|
|
37
37
|
expectedModels: ["CaseView"],
|
|
38
38
|
targetModel: CaseViewModel,
|
|
@@ -42,14 +42,14 @@ export const useCaseView = (href: string): ?CaseViewModel =>
|
|
|
42
42
|
*/
|
|
43
43
|
export const usePanel = (
|
|
44
44
|
href: string
|
|
45
|
-
):
|
|
45
|
+
): ListModel | GroupingPanelModel | DetailModel | null =>
|
|
46
46
|
useModularUIBasic("panel", href, {
|
|
47
47
|
expectedModels: ["List", "GroupingPanel", "Detail"],
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
*/
|
|
52
|
-
export const useList = (href: string):
|
|
52
|
+
export const useList = (href: string): ListModel | null =>
|
|
53
53
|
useModularUIBasic("list", href, {
|
|
54
54
|
expectedModels: ["List"],
|
|
55
55
|
targetModel: ListModel,
|
|
@@ -57,15 +57,24 @@ export const useList = (href: string): ?ListModel =>
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
*/
|
|
60
|
-
export const
|
|
60
|
+
export const useListOrDetail = (href: string): ListModel | DetailModel | null =>
|
|
61
|
+
useModularUIBasic("list", href, {
|
|
62
|
+
expectedModels: ["List", "Detail"],
|
|
63
|
+
targetModel: [ListModel, DetailModel],
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*/
|
|
68
|
+
export const useListDetail = (href: string): ListDetailModel | null =>
|
|
61
69
|
useModularUIBasic("listdetail", href, {
|
|
62
70
|
expectedModels: ["ListDetail"],
|
|
63
71
|
targetModel: ListDetailModel,
|
|
72
|
+
forceTargetModel: true,
|
|
64
73
|
});
|
|
65
74
|
|
|
66
75
|
/**
|
|
67
76
|
*/
|
|
68
|
-
export const useGroupingPanel = (href: string):
|
|
77
|
+
export const useGroupingPanel = (href: string): GroupingPanelModel | null =>
|
|
69
78
|
useModularUIBasic("groupingpanel", href, {
|
|
70
79
|
expectedModels: ["GroupingPanel"],
|
|
71
80
|
targetModel: GroupingPanelModel,
|
|
@@ -73,7 +82,7 @@ export const useGroupingPanel = (href: string): ?GroupingPanelModel =>
|
|
|
73
82
|
|
|
74
83
|
/**
|
|
75
84
|
*/
|
|
76
|
-
export const useDetailPanel = (href: string):
|
|
85
|
+
export const useDetailPanel = (href: string): DetailModel | null =>
|
|
77
86
|
useModularUIBasic("detailpanel", href, {
|
|
78
87
|
expectedModels: ["Detail"],
|
|
79
88
|
targetModel: DetailModel,
|
|
@@ -81,7 +90,7 @@ export const useDetailPanel = (href: string): ?DetailModel =>
|
|
|
81
90
|
|
|
82
91
|
/**
|
|
83
92
|
*/
|
|
84
|
-
export const useQuicksearch = (href: string):
|
|
93
|
+
export const useQuicksearch = (href: string): CaseSearchModel | null =>
|
|
85
94
|
useModularUIBasic("quicksearch", href, {
|
|
86
95
|
expectedModels: ["CaseSearch"],
|
|
87
96
|
targetModel: CaseSearchModel,
|
|
@@ -89,7 +98,7 @@ export const useQuicksearch = (href: string): ?CaseSearchModel =>
|
|
|
89
98
|
|
|
90
99
|
/**
|
|
91
100
|
*/
|
|
92
|
-
export const useUserProfile = (href: string):
|
|
101
|
+
export const useUserProfile = (href: string): UserProfileModel | null =>
|
|
93
102
|
useModularUIBasic("userprofile", href, {
|
|
94
103
|
expectedModels: ["UserProfile"],
|
|
95
104
|
targetModel: UserProfileModel,
|