@beinformed/ui 1.65.18 → 1.65.20
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 +16 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/index.js.flow +1 -0
- package/esm/hooks/index.js.map +1 -1
- package/esm/hooks/useModelSelectors.js +73 -0
- package/esm/hooks/useModelSelectors.js.flow +98 -0
- package/esm/hooks/useModelSelectors.js.map +1 -0
- package/esm/hooks/useModularUI.js +52 -9
- package/esm/hooks/useModularUI.js.flow +50 -9
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +50 -4
- package/esm/hooks/useModularUIBasic.js.flow +49 -6
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js +17 -46
- package/esm/redux/_modularui/ModularUIConnector.js.flow +22 -60
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/esm/redux/_router/RouterConnectors.js +5 -0
- package/esm/redux/_router/RouterConnectors.js.flow +5 -0
- package/esm/redux/_router/RouterConnectors.js.map +1 -1
- package/esm/redux/connectors/Application.js +1 -0
- package/esm/redux/connectors/Application.js.flow +1 -0
- package/esm/redux/connectors/Application.js.map +1 -1
- package/esm/redux/connectors/Breadcrumb.js +1 -0
- package/esm/redux/connectors/Breadcrumb.js.flow +1 -0
- package/esm/redux/connectors/Breadcrumb.js.map +1 -1
- package/esm/redux/connectors/CaseView.js +1 -0
- package/esm/redux/connectors/CaseView.js.flow +1 -0
- package/esm/redux/connectors/CaseView.js.map +1 -1
- package/esm/redux/connectors/ConceptDetail.js +1 -0
- package/esm/redux/connectors/ConceptDetail.js.flow +1 -0
- package/esm/redux/connectors/ConceptDetail.js.map +1 -1
- package/esm/redux/connectors/ContentBrowser.js +1 -0
- package/esm/redux/connectors/ContentBrowser.js.flow +1 -0
- package/esm/redux/connectors/ContentBrowser.js.map +1 -1
- package/esm/redux/connectors/ContentDetail.js +1 -0
- package/esm/redux/connectors/ContentDetail.js.flow +1 -0
- package/esm/redux/connectors/ContentDetail.js.map +1 -1
- package/esm/redux/connectors/ContentDetailSection.js +1 -0
- package/esm/redux/connectors/ContentDetailSection.js.flow +1 -0
- package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
- package/esm/redux/connectors/Form.js +1 -0
- package/esm/redux/connectors/Form.js.flow +1 -0
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js +1 -0
- package/esm/redux/connectors/FormAttributeSet.js.flow +1 -0
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/connectors/ListDetail.js +1 -0
- package/esm/redux/connectors/ListDetail.js.flow +1 -0
- package/esm/redux/connectors/ListDetail.js.map +1 -1
- package/esm/redux/connectors/Modal.js +1 -0
- package/esm/redux/connectors/Modal.js.flow +1 -0
- package/esm/redux/connectors/Modal.js.map +1 -1
- package/esm/redux/connectors/ModelCatalog.js +1 -0
- package/esm/redux/connectors/ModelCatalog.js.flow +1 -0
- package/esm/redux/connectors/ModelCatalog.js.map +1 -1
- package/esm/redux/connectors/Notification.js +1 -0
- package/esm/redux/connectors/Notification.js.flow +1 -0
- package/esm/redux/connectors/Notification.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +1 -0
- package/esm/redux/connectors/PanelRenderer.js.flow +1 -0
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/redux/connectors/Preferences.js +2 -0
- package/esm/redux/connectors/Preferences.js.flow +2 -0
- package/esm/redux/connectors/Preferences.js.map +1 -1
- package/esm/redux/connectors/Progress.js +1 -0
- package/esm/redux/connectors/Progress.js.flow +1 -0
- package/esm/redux/connectors/Progress.js.map +1 -1
- package/esm/redux/connectors/ProgressIndicator.js +1 -0
- package/esm/redux/connectors/ProgressIndicator.js.flow +1 -0
- package/esm/redux/connectors/ProgressIndicator.js.map +1 -1
- package/esm/redux/connectors/QuickSearch.js +1 -0
- package/esm/redux/connectors/QuickSearch.js.flow +1 -0
- package/esm/redux/connectors/QuickSearch.js.map +1 -1
- package/esm/redux/connectors/SignIn.js +1 -0
- package/esm/redux/connectors/SignIn.js.flow +1 -0
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.js +1 -0
- package/esm/redux/connectors/SignOut.js.flow +1 -0
- package/esm/redux/connectors/SignOut.js.map +1 -1
- package/esm/redux/connectors/Tab.js +1 -0
- package/esm/redux/connectors/Tab.js.flow +1 -0
- package/esm/redux/connectors/Tab.js.map +1 -1
- package/lib/hooks/index.js +11 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useModelSelectors.js +87 -0
- package/lib/hooks/useModelSelectors.js.map +1 -0
- package/lib/hooks/useModularUI.js +51 -8
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +47 -4
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js +15 -44
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_router/RouterConnectors.js +5 -0
- package/lib/redux/_router/RouterConnectors.js.map +1 -1
- package/lib/redux/connectors/Application.js +1 -0
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js +1 -0
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js +1 -0
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js +1 -0
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js +1 -0
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js +1 -0
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js +1 -0
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js +1 -0
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js +1 -0
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js +1 -0
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/Modal.js +1 -0
- package/lib/redux/connectors/Modal.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js +1 -0
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/Notification.js +1 -0
- package/lib/redux/connectors/Notification.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js +1 -0
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js +2 -0
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/Progress.js +1 -0
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/ProgressIndicator.js +1 -0
- package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js +1 -0
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js +1 -0
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js +1 -0
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js +1 -0
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,6 +8,10 @@ import { HTTP_METHODS, MODULARUI_STATUS } from "../constants";
|
|
|
8
8
|
import { useModularUIKey } from "./useModularUIKey";
|
|
9
9
|
|
|
10
10
|
import type { ModularUIModel, Href } from "../models";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options for low-level modular UI requests.
|
|
14
|
+
*/
|
|
11
15
|
export type HookOptions = {
|
|
12
16
|
key?: string,
|
|
13
17
|
origin?: string,
|
|
@@ -16,8 +20,12 @@ export type HookOptions = {
|
|
|
16
20
|
formdata?: any,
|
|
17
21
|
};
|
|
18
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Configuration options for the useModularUIBasic hook.
|
|
25
|
+
* Allows for type enforcement, caching control, and reload behavior.
|
|
26
|
+
*/
|
|
19
27
|
export type UseModularUIBasicOptions<T: ModularUIModel> = {
|
|
20
|
-
expectedModels?: Array<string>,
|
|
28
|
+
expectedModels?: Array<string>, // List of model types (strings) that are valid for this call
|
|
21
29
|
targetModel?: Class<T> | Array<Class<T>>,
|
|
22
30
|
forceTargetModel?: boolean,
|
|
23
31
|
origin?: string,
|
|
@@ -26,10 +34,17 @@ export type UseModularUIBasicOptions<T: ModularUIModel> = {
|
|
|
26
34
|
key?: string,
|
|
27
35
|
isReload?: boolean,
|
|
28
36
|
removeOnUnmount?: boolean,
|
|
29
|
-
formdata?: any,
|
|
37
|
+
formdata?: any, // If present, the hook switches from GET to POST
|
|
30
38
|
};
|
|
31
39
|
|
|
32
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Internal helper to transform high-level hook options into a configuration
|
|
42
|
+
* object compatible with the core useModularUI fetcher.
|
|
43
|
+
* Logic:
|
|
44
|
+
* 1. Defaults to GET method.
|
|
45
|
+
* 2. If 'formdata' is present, it switches to POST and assigns 'data'.
|
|
46
|
+
* 3. Forces 'isReload' if the useReload check returns true.
|
|
47
|
+
*/
|
|
33
48
|
const createUseModularUIOptions = <T: ModularUIModel>(
|
|
34
49
|
options: UseModularUIBasicOptions<T>,
|
|
35
50
|
href: string,
|
|
@@ -51,7 +66,10 @@ const createUseModularUIOptions = <T: ModularUIModel>(
|
|
|
51
66
|
return baseOptions;
|
|
52
67
|
};
|
|
53
68
|
|
|
54
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Validates that the returned model type matches one of the expected model strings.
|
|
71
|
+
* Logs a warning to the console if there is a mismatch (useful for debugging UI-backend contracts).
|
|
72
|
+
*/
|
|
55
73
|
const validateModel = (model: any, expectedModels: Array<string>) => {
|
|
56
74
|
if (expectedModels.length > 0) {
|
|
57
75
|
const isCorrectModel = expectedModels.includes(model.type);
|
|
@@ -62,7 +80,12 @@ const validateModel = (model: any, expectedModels: Array<string>) => {
|
|
|
62
80
|
};
|
|
63
81
|
|
|
64
82
|
/**
|
|
65
|
-
*
|
|
83
|
+
* A simplified abstraction over useModularUI that includes automatic
|
|
84
|
+
* model validation and smart-reload logic based on router state.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} defaultKey - The default identifier for the model.
|
|
87
|
+
* @param {string | Href} href - The endpoint to fetch.
|
|
88
|
+
* @param {UseModularUIBasicOptions} options - Extended configuration options.
|
|
66
89
|
*/
|
|
67
90
|
export const useModularUIBasic = <T: ModularUIModel>(
|
|
68
91
|
defaultKey: string,
|
|
@@ -70,20 +93,27 @@ export const useModularUIBasic = <T: ModularUIModel>(
|
|
|
70
93
|
options: UseModularUIBasicOptions<T> = (({}: any): UseModularUIBasicOptions<T>),
|
|
71
94
|
): T | null => {
|
|
72
95
|
const memoizedHref = useMemo(() => href.toString(), [href]);
|
|
96
|
+
|
|
97
|
+
// Use the key provided in options if available, otherwise fallback to the default
|
|
73
98
|
const key = options.key ?? defaultKey;
|
|
74
99
|
|
|
100
|
+
// Determine if we need to bypass cache based on navigation 'reload' signals
|
|
75
101
|
const mustReload = useReload(key, memoizedHref);
|
|
102
|
+
|
|
103
|
+
// Memoize options to prevent useModularUI from re-fetching on every parent render
|
|
76
104
|
const modularUIOptions = useMemo(
|
|
77
105
|
() => createUseModularUIOptions(options, memoizedHref, mustReload),
|
|
78
106
|
[options, memoizedHref, mustReload],
|
|
79
107
|
);
|
|
80
108
|
|
|
81
109
|
const modularUI = useModularUI(key, href, modularUIOptions);
|
|
110
|
+
|
|
82
111
|
const expectedModels = useMemo(
|
|
83
112
|
() => options.expectedModels ?? [],
|
|
84
113
|
[options.expectedModels],
|
|
85
114
|
);
|
|
86
115
|
|
|
116
|
+
// Extract and validate the model from the modularUI wrapper object
|
|
87
117
|
return useMemo((): T | null => {
|
|
88
118
|
if (modularUI?.model) {
|
|
89
119
|
validateModel(modularUI.model, expectedModels);
|
|
@@ -94,18 +124,31 @@ export const useModularUIBasic = <T: ModularUIModel>(
|
|
|
94
124
|
};
|
|
95
125
|
|
|
96
126
|
/**
|
|
97
|
-
*
|
|
127
|
+
* Determines if a model should be reloaded based on the 'reload' timestamp
|
|
128
|
+
* found in the React Router location state.
|
|
129
|
+
* This is used for "force refresh" scenarios where a user navigates to a
|
|
130
|
+
* page and expects fresh data (e.g., after a form submission elsewhere).
|
|
131
|
+
* @param {string} modelKey - The model type key.
|
|
132
|
+
* @param {string} url - The resource URL.
|
|
133
|
+
* @returns {boolean} True if the store data is stale compared to the reload signal.
|
|
98
134
|
*/
|
|
99
135
|
export const useReload = (modelKey: string, url: string): boolean => {
|
|
100
136
|
const location = useLocation();
|
|
101
137
|
const key = useModularUIKey(modelKey, url);
|
|
138
|
+
|
|
139
|
+
// Access the current entry in the Redux store
|
|
102
140
|
const modelEntry = useSelector((state) => state.modularui[key]);
|
|
103
141
|
|
|
104
142
|
if (modelEntry) {
|
|
105
143
|
const reload = location.state?.reload || 0;
|
|
144
|
+
|
|
145
|
+
// If a reload timestamp exists in the router state
|
|
106
146
|
if (reload > 0) {
|
|
107
147
|
const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;
|
|
108
148
|
const lastModification = modelEntry?.lastModification ?? 0;
|
|
149
|
+
|
|
150
|
+
// Trigger reload only if the model is already finished loading
|
|
151
|
+
// AND the data we have is older than the requested reload time.
|
|
109
152
|
if (isFullyLoaded && lastModification < reload) {
|
|
110
153
|
return true;
|
|
111
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIBasic.js","names":["useLocation","useSelector","useMemo","useModularUI","HTTP_METHODS","MODULARUI_STATUS","useModularUIKey","createUseModularUIOptions","options","href","mustReload","baseOptions","expectedModels","method","GET","data","undefined","isReload","formdata","POST","validateModel","model","length","isCorrectModel","_includesInstanceProperty","call","type","console","warn","useModularUIBasic","defaultKey","memoizedHref","toString","key","useReload","modularUIOptions","modularUI","modelKey","url","location","modelEntry","state","modularui","reload","isFullyLoaded","status","FINISHED","lastModification"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"react-router\";\nimport { useSelector } from \"react-redux\";\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../constants\";\nimport { useModularUIKey } from \"./useModularUIKey\";\n\nimport type { ModularUIModel, Href } from \"../models\";\nexport type HookOptions = {\n key?: string,\n origin?: string,\n contextPath?: string,\n removeOnUnmount?: boolean,\n formdata?: any,\n};\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string
|
|
1
|
+
{"version":3,"file":"useModularUIBasic.js","names":["useLocation","useSelector","useMemo","useModularUI","HTTP_METHODS","MODULARUI_STATUS","useModularUIKey","createUseModularUIOptions","options","href","mustReload","baseOptions","expectedModels","method","GET","data","undefined","isReload","formdata","POST","validateModel","model","length","isCorrectModel","_includesInstanceProperty","call","type","console","warn","useModularUIBasic","defaultKey","memoizedHref","toString","key","useReload","modularUIOptions","modularUI","modelKey","url","location","modelEntry","state","modularui","reload","isFullyLoaded","status","FINISHED","lastModification"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"react-router\";\nimport { useSelector } from \"react-redux\";\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../constants\";\nimport { useModularUIKey } from \"./useModularUIKey\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\n/**\n * Configuration options for low-level modular UI requests.\n */\nexport type HookOptions = {\n key?: string,\n origin?: string,\n contextPath?: string,\n removeOnUnmount?: boolean,\n formdata?: any,\n};\n\n/**\n * Configuration options for the useModularUIBasic hook.\n * Allows for type enforcement, caching control, and reload behavior.\n */\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>, // List of model types (strings) that are valid for this call\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n key?: string,\n isReload?: boolean,\n removeOnUnmount?: boolean,\n formdata?: any, // If present, the hook switches from GET to POST\n};\n\n/**\n * Internal helper to transform high-level hook options into a configuration\n * object compatible with the core useModularUI fetcher.\n * Logic:\n * 1. Defaults to GET method.\n * 2. If 'formdata' is present, it switches to POST and assigns 'data'.\n * 3. Forces 'isReload' if the useReload check returns true.\n */\nconst createUseModularUIOptions = <T: ModularUIModel>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n mustReload: boolean,\n): Object => {\n const baseOptions = {\n expectedModels: [],\n method: HTTP_METHODS.GET,\n data: undefined,\n ...options,\n isReload: mustReload || options.isReload,\n };\n\n if (options.formdata != null) {\n baseOptions.method = HTTP_METHODS.POST;\n baseOptions.data = options.formdata;\n }\n\n return baseOptions;\n};\n\n/**\n * Validates that the returned model type matches one of the expected model strings.\n * Logs a warning to the console if there is a mismatch (useful for debugging UI-backend contracts).\n */\nconst validateModel = (model: any, expectedModels: Array<string>) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.includes(model.type);\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * A simplified abstraction over useModularUI that includes automatic\n * model validation and smart-reload logic based on router state.\n *\n * @param {string} defaultKey - The default identifier for the model.\n * @param {string | Href} href - The endpoint to fetch.\n * @param {UseModularUIBasicOptions} options - Extended configuration options.\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n defaultKey: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = (({}: any): UseModularUIBasicOptions<T>),\n): T | null => {\n const memoizedHref = useMemo(() => href.toString(), [href]);\n\n // Use the key provided in options if available, otherwise fallback to the default\n const key = options.key ?? defaultKey;\n\n // Determine if we need to bypass cache based on navigation 'reload' signals\n const mustReload = useReload(key, memoizedHref);\n\n // Memoize options to prevent useModularUI from re-fetching on every parent render\n const modularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, mustReload),\n [options, memoizedHref, mustReload],\n );\n\n const modularUI = useModularUI(key, href, modularUIOptions);\n\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n // Extract and validate the model from the modularUI wrapper object\n return useMemo((): T | null => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model;\n }\n return null;\n }, [expectedModels, modularUI]);\n};\n\n/**\n * Determines if a model should be reloaded based on the 'reload' timestamp\n * found in the React Router location state.\n * This is used for \"force refresh\" scenarios where a user navigates to a\n * page and expects fresh data (e.g., after a form submission elsewhere).\n * @param {string} modelKey - The model type key.\n * @param {string} url - The resource URL.\n * @returns {boolean} True if the store data is stale compared to the reload signal.\n */\nexport const useReload = (modelKey: string, url: string): boolean => {\n const location = useLocation();\n const key = useModularUIKey(modelKey, url);\n\n // Access the current entry in the Redux store\n const modelEntry = useSelector((state) => state.modularui[key]);\n\n if (modelEntry) {\n const reload = location.state?.reload || 0;\n\n // If a reload timestamp exists in the router state\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n // Trigger reload only if the model is already finished loading\n // AND the data we have is older than the requested reload time.\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n }\n return false;\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,cAAc;AAC1C,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,cAAc;AAC7D,SAASC,eAAe,QAAQ,mBAAmB;;AAInD;AACA;AACA;;AASA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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A;MACA,IAAIH,aAAa,IAAIG,gBAAgB,GAAGJ,MAAM,EAAE;QAC9C,OAAO,IAAI;MACb;IACF;EACF;EACA,OAAO,KAAK;AACd,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
1
|
import { useDispatch } from "react-redux";
|
|
3
2
|
import { useLocation } from "react-router";
|
|
4
|
-
import { loadModularUI, reloadModel
|
|
3
|
+
import { loadModularUI, reloadModel } from "./ModularUIActions";
|
|
5
4
|
import Href from "../../models/href/Href";
|
|
6
5
|
import { getDisplayName } from "../../react/utils";
|
|
7
|
-
import { useUrl
|
|
6
|
+
import { useUrl } from "./ModularUIUtils";
|
|
8
7
|
import { useModularUI } from "../../hooks/useModularUI";
|
|
8
|
+
import { useModularUIBasic } from "../../hooks/useModularUIBasic";
|
|
9
9
|
import { useLocale } from "../../hooks/useI18n";
|
|
10
10
|
import FormModel from "../../models/form/FormModel";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -28,77 +28,48 @@ const patchUpdateModelOption = oldOptions => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead
|
|
31
32
|
*/
|
|
32
33
|
const modularUIConnector = (name, resource, options = {
|
|
33
34
|
propName: "data",
|
|
34
|
-
removeOnUnmount:
|
|
35
|
+
removeOnUnmount: true
|
|
35
36
|
}) => {
|
|
36
37
|
const {
|
|
37
38
|
propName = "data",
|
|
38
|
-
removeOnUnmount =
|
|
39
|
+
removeOnUnmount = true,
|
|
39
40
|
...otherOptions
|
|
40
41
|
} = options;
|
|
41
42
|
return Component => {
|
|
42
43
|
const WrappedComponent = props => {
|
|
43
|
-
// explicit property for removeOnMount overwrite the setting
|
|
44
44
|
const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;
|
|
45
45
|
const dispatch = useDispatch();
|
|
46
46
|
const location = useLocation();
|
|
47
|
+
const locale = useLocale();
|
|
47
48
|
const url = useUrl(resource, {
|
|
48
49
|
location,
|
|
49
50
|
...props
|
|
50
51
|
});
|
|
51
|
-
const displayName = getDisplayName(Component, name, props.contextId);
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
const
|
|
53
|
+
// $FlowFixMe
|
|
54
|
+
const model = useModularUIBasic(name, url, options);
|
|
55
|
+
const modelEntry = useModularUI(name, url, {
|
|
55
56
|
...otherOptions,
|
|
56
57
|
removeOnUnmount: finalRemoveOnUnmount
|
|
57
58
|
});
|
|
58
|
-
const modelKey =
|
|
59
|
-
|
|
60
|
-
// handle manual reload of model
|
|
61
|
-
const handleManualReload = (model, reloadOptions) => {
|
|
62
|
-
dispatch(reloadModel(model, reloadOptions));
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// Provide connected models with a fetchModularUI method to be able
|
|
66
|
-
// to run the loadModularUI action from a handler / callback in the component
|
|
59
|
+
const modelKey = model?.connectKey ?? name;
|
|
67
60
|
const handleFetch = (href, fetchOptions) => {
|
|
68
61
|
dispatch(loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)));
|
|
69
62
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const doReload = useReload(modelEntry, reload);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (doReload) {
|
|
76
|
-
dispatch(loadModularUI(modelKey, url, {
|
|
77
|
-
...patchUpdateModelOption(otherOptions),
|
|
78
|
-
isReload: true
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
}, [dispatch, doReload, url, modelKey]);
|
|
82
|
-
|
|
83
|
-
// Remove model when hoc unloads
|
|
84
|
-
useEffect(
|
|
85
|
-
// prettier-ignore
|
|
86
|
-
() => () => {
|
|
87
|
-
//NOSONAR
|
|
88
|
-
if (finalRemoveOnUnmount) {
|
|
89
|
-
dispatch(removeModelByKey(modelKey));
|
|
90
|
-
}
|
|
91
|
-
}, [dispatch, modelKey, finalRemoveOnUnmount]);
|
|
92
|
-
|
|
93
|
-
// Create new properties object to inject modularui properties to own props
|
|
94
|
-
const locale = useLocale();
|
|
63
|
+
const handleManualReload = (m, o) => {
|
|
64
|
+
dispatch(reloadModel(m, o));
|
|
65
|
+
};
|
|
95
66
|
const newProps = {
|
|
96
67
|
modelKey,
|
|
97
|
-
[propName]:
|
|
68
|
+
[propName ?? "data"]: model,
|
|
98
69
|
location,
|
|
99
70
|
status: modelEntry?.status ?? null,
|
|
100
71
|
lastModification: modelEntry?.lastModification ?? null,
|
|
101
|
-
hasModel: Boolean(
|
|
72
|
+
hasModel: Boolean(model),
|
|
102
73
|
locale,
|
|
103
74
|
fetchModularUI: handleFetch,
|
|
104
75
|
reloadModel: handleManualReload
|
|
@@ -108,7 +79,7 @@ const modularUIConnector = (name, resource, options = {
|
|
|
108
79
|
...newProps
|
|
109
80
|
});
|
|
110
81
|
};
|
|
111
|
-
WrappedComponent.displayName = `BI.modularui(${getDisplayName(
|
|
82
|
+
WrappedComponent.displayName = `BI.modularui(${getDisplayName(Component, name)})`;
|
|
112
83
|
return WrappedComponent;
|
|
113
84
|
};
|
|
114
85
|
};
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import { useEffect } from "react";
|
|
3
2
|
import { useDispatch } from "react-redux";
|
|
4
3
|
import { useLocation } from "react-router";
|
|
5
4
|
|
|
6
|
-
import {
|
|
7
|
-
loadModularUI,
|
|
8
|
-
reloadModel,
|
|
9
|
-
removeModelByKey,
|
|
10
|
-
} from "./ModularUIActions";
|
|
5
|
+
import { loadModularUI, reloadModel } from "./ModularUIActions";
|
|
11
6
|
|
|
12
7
|
import Href from "../../models/href/Href";
|
|
13
8
|
import { getDisplayName } from "../../react/utils";
|
|
14
9
|
|
|
15
|
-
import { useUrl
|
|
10
|
+
import { useUrl } from "./ModularUIUtils";
|
|
16
11
|
import { useModularUI } from "../../hooks/useModularUI";
|
|
12
|
+
import { useModularUIBasic } from "../../hooks/useModularUIBasic";
|
|
13
|
+
|
|
17
14
|
import { useLocale } from "../../hooks/useI18n";
|
|
18
15
|
|
|
16
|
+
import FormModel from "../../models/form/FormModel";
|
|
17
|
+
|
|
19
18
|
import type { ComponentType, Node } from "react";
|
|
20
19
|
import type { Location } from "react-router";
|
|
21
20
|
import type { ModularUIModel } from "../../models/types";
|
|
22
21
|
import type { ModularUIOptions } from "./types";
|
|
23
|
-
import FormModel from "../../models/form/FormModel";
|
|
24
22
|
|
|
25
23
|
export type InjectedProps = {
|
|
26
24
|
+modelKey: string,
|
|
@@ -57,86 +55,54 @@ const patchUpdateModelOption = (oldOptions: Object) => {
|
|
|
57
55
|
};
|
|
58
56
|
|
|
59
57
|
/**
|
|
58
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead
|
|
60
59
|
*/
|
|
61
60
|
const modularUIConnector = (
|
|
62
61
|
name: string,
|
|
63
62
|
resource: string | Function,
|
|
64
|
-
options: ModularUIOptions = { propName: "data", removeOnUnmount:
|
|
63
|
+
options: ModularUIOptions = { propName: "data", removeOnUnmount: true },
|
|
65
64
|
): ((Component: ComponentType<any>) => (props: any) => Node) => {
|
|
66
65
|
const {
|
|
67
66
|
propName = "data",
|
|
68
|
-
removeOnUnmount =
|
|
67
|
+
removeOnUnmount = true,
|
|
69
68
|
...otherOptions
|
|
70
69
|
} = options;
|
|
71
70
|
|
|
72
71
|
return (Component: ComponentType<any>) => {
|
|
73
72
|
const WrappedComponent = (props: any) => {
|
|
74
|
-
// explicit property for removeOnMount overwrite the setting
|
|
75
73
|
const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;
|
|
76
74
|
|
|
77
75
|
const dispatch = useDispatch();
|
|
78
76
|
const location = useLocation();
|
|
79
|
-
|
|
77
|
+
const locale = useLocale();
|
|
80
78
|
const url = useUrl(resource, { location, ...props });
|
|
81
|
-
const displayName = getDisplayName(Component, name, props.contextId);
|
|
82
79
|
|
|
83
|
-
//
|
|
84
|
-
const
|
|
80
|
+
// $FlowFixMe
|
|
81
|
+
const model = useModularUIBasic<ModularUIModel>(name, url, options);
|
|
82
|
+
|
|
83
|
+
const modelEntry = useModularUI(name, url, {
|
|
85
84
|
...otherOptions,
|
|
86
85
|
removeOnUnmount: finalRemoveOnUnmount,
|
|
87
86
|
});
|
|
88
|
-
const modelKey =
|
|
89
|
-
|
|
90
|
-
// handle manual reload of model
|
|
91
|
-
const handleManualReload = (
|
|
92
|
-
model: ModularUIModel,
|
|
93
|
-
reloadOptions?: Object,
|
|
94
|
-
) => {
|
|
95
|
-
dispatch(reloadModel(model, reloadOptions));
|
|
96
|
-
};
|
|
87
|
+
const modelKey = model?.connectKey ?? name;
|
|
97
88
|
|
|
98
|
-
// Provide connected models with a fetchModularUI method to be able
|
|
99
|
-
// to run the loadModularUI action from a handler / callback in the component
|
|
100
89
|
const handleFetch = (href: string | Href, fetchOptions: Object) => {
|
|
101
90
|
dispatch(
|
|
102
91
|
loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),
|
|
103
92
|
);
|
|
104
93
|
};
|
|
105
94
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (doReload) {
|
|
111
|
-
dispatch(
|
|
112
|
-
loadModularUI(modelKey, url, {
|
|
113
|
-
...patchUpdateModelOption(otherOptions),
|
|
114
|
-
isReload: true,
|
|
115
|
-
}),
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
}, [dispatch, doReload, url, modelKey]);
|
|
119
|
-
|
|
120
|
-
// Remove model when hoc unloads
|
|
121
|
-
useEffect(
|
|
122
|
-
// prettier-ignore
|
|
123
|
-
() => () => { //NOSONAR
|
|
124
|
-
if (finalRemoveOnUnmount) {
|
|
125
|
-
dispatch(removeModelByKey(modelKey));
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
[dispatch, modelKey, finalRemoveOnUnmount],
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
// Create new properties object to inject modularui properties to own props
|
|
132
|
-
const locale = useLocale();
|
|
95
|
+
const handleManualReload = (m: ModularUIModel, o: Object) => {
|
|
96
|
+
dispatch(reloadModel(m, o));
|
|
97
|
+
};
|
|
98
|
+
|
|
133
99
|
const newProps: InjectedProps = {
|
|
134
100
|
modelKey,
|
|
135
|
-
[propName]:
|
|
101
|
+
[propName ?? "data"]: model,
|
|
136
102
|
location,
|
|
137
103
|
status: modelEntry?.status ?? null,
|
|
138
104
|
lastModification: modelEntry?.lastModification ?? null,
|
|
139
|
-
hasModel: Boolean(
|
|
105
|
+
hasModel: Boolean(model),
|
|
140
106
|
locale,
|
|
141
107
|
fetchModularUI: handleFetch,
|
|
142
108
|
reloadModel: handleManualReload,
|
|
@@ -145,11 +111,7 @@ const modularUIConnector = (
|
|
|
145
111
|
return <Component {...props} {...newProps} />;
|
|
146
112
|
};
|
|
147
113
|
|
|
148
|
-
WrappedComponent.displayName = `BI.modularui(${getDisplayName(
|
|
149
|
-
WrappedComponent,
|
|
150
|
-
name,
|
|
151
|
-
)}`;
|
|
152
|
-
|
|
114
|
+
WrappedComponent.displayName = `BI.modularui(${getDisplayName(Component, name)})`;
|
|
153
115
|
return WrappedComponent;
|
|
154
116
|
};
|
|
155
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIConnector.js","names":["
|
|
1
|
+
{"version":3,"file":"ModularUIConnector.js","names":["useDispatch","useLocation","loadModularUI","reloadModel","Href","getDisplayName","useUrl","useModularUI","useModularUIBasic","useLocale","FormModel","jsx","_jsx","patchUpdateModelOption","oldOptions","updateModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","location","locale","url","model","modelEntry","modelKey","connectKey","handleFetch","href","fetchOptions","handleManualReload","m","o","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","displayName"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { loadModularUI, reloadModel } from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useModularUIBasic } from \"../../hooks/useModularUIBasic\";\n\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: true },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = true,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n const locale = useLocale();\n const url = useUrl(resource, { location, ...props });\n\n // $FlowFixMe\n const model = useModularUIBasic<ModularUIModel>(name, url, options);\n\n const modelEntry = useModularUI(name, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = model?.connectKey ?? name;\n\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n const handleManualReload = (m: ModularUIModel, o: Object) => {\n dispatch(reloadModel(m, o));\n };\n\n const newProps: InjectedProps = {\n modelKey,\n [propName ?? \"data\"]: model,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(model),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(Component, name)})`;\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,aAAa,EAAEC,WAAW,QAAQ,oBAAoB;AAE/D,OAAOC,IAAI,MAAM,wBAAwB;AACzC,SAASC,cAAc,QAAQ,mBAAmB;AAElD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,iBAAiB,QAAQ,+BAA+B;AAEjE,SAASC,SAAS,QAAQ,qBAAqB;AAE/C,OAAOC,SAAS,MAAM,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAmBpD,MAAMC,sBAAsB,GAAIC,UAAkB,IAAK;EACrD,IACE,aAAa,IAAIA,UAAU,IAC3BA,UAAU,CAACC,WAAW,YAAYL,SAAS,EAC3C;IACA,OAAO;MACL,GAAGI,UAAU;MACbE,aAAa,EAAGC,QAAwB,IAA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QACjEV,QAAQ,CACN9B,aAAa,CAACoC,QAAQ,EAAEG,IAAI,EAAE5B,sBAAsB,CAAC6B,YAAY,CAAC,CACpE,CAAC;MACH,CAAC;MAED,MAAMC,kBAAkB,GAAGA,CAACC,CAAiB,EAAEC,CAAS,KAAK;QAC3Db,QAAQ,CAAC7B,WAAW,CAACyC,CAAC,EAAEC,CAAC,CAAC,CAAC;MAC7B,CAAC;MAED,MAAMC,QAAuB,GAAG;QAC9BR,QAAQ;QACR,CAACb,QAAQ,IAAI,MAAM,GAAGW,KAAK;QAC3BH,QAAQ;QACRc,MAAM,EAAEV,UAAU,EAAEU,MAAM,IAAI,IAAI;QAClCC,gBAAgB,EAAEX,UAAU,EAAEW,gBAAgB,IAAI,IAAI;QACtDC,QAAQ,EAAEC,OAAO,CAACd,KAAK,CAAC;QACxBF,MAAM;QACNiB,cAAc,EAAEX,WAAW;QAC3BrC,WAAW,EAAEwC;MACf,CAAC;MAED,oBAAO/B,IAAA,CAACgB,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMgB;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDjB,gBAAgB,CAACuB,WAAW,GAAG,gBAAgB/C,cAAc,CAACuB,SAAS,EAAEN,IAAI,CAAC,GAAG;IACjF,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAED,eAAeR,kBAAkB","ignoreList":[]}
|
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
import { connect } from "react-redux";
|
|
2
2
|
import { push, replace, go, goBack, goForward } from "./RouterActions";
|
|
3
3
|
/**
|
|
4
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useLocationKey' instead
|
|
4
5
|
*/
|
|
5
6
|
const withKey = connect(state => ({
|
|
6
7
|
locationKey: state.router.location?.key ?? ""
|
|
7
8
|
}));
|
|
8
9
|
|
|
9
10
|
/**
|
|
11
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'usePathname' instead
|
|
10
12
|
*/
|
|
11
13
|
const withPathname = connect(state => ({
|
|
12
14
|
pathname: state.router.location?.pathname
|
|
13
15
|
}));
|
|
14
16
|
|
|
15
17
|
/**
|
|
18
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useLocation' instead
|
|
16
19
|
*/
|
|
17
20
|
const withLocation = connect(state => ({
|
|
18
21
|
location: state.router.location
|
|
19
22
|
}));
|
|
20
23
|
|
|
21
24
|
/**
|
|
25
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useQuerystring' instead
|
|
22
26
|
*/
|
|
23
27
|
const withQuerystring = connect(state => ({
|
|
24
28
|
querystring: state.router.location?.search
|
|
25
29
|
}));
|
|
26
30
|
|
|
27
31
|
/**
|
|
32
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useNavigation' instead
|
|
28
33
|
*/
|
|
29
34
|
const withNavigation = connect(null, {
|
|
30
35
|
push,
|
|
@@ -31,6 +31,7 @@ type NavigationDispatchProps = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useLocationKey' instead
|
|
34
35
|
*/
|
|
35
36
|
const withKey: ComponentType<any> = connect<WithKeyStateProps, {}, _, _, _, _>(
|
|
36
37
|
(state: ReduxState) => ({
|
|
@@ -39,6 +40,7 @@ const withKey: ComponentType<any> = connect<WithKeyStateProps, {}, _, _, _, _>(
|
|
|
39
40
|
);
|
|
40
41
|
|
|
41
42
|
/**
|
|
43
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'usePathname' instead
|
|
42
44
|
*/
|
|
43
45
|
const withPathname: ComponentType<any> = connect<
|
|
44
46
|
WithPathnameProps,
|
|
@@ -52,6 +54,7 @@ const withPathname: ComponentType<any> = connect<
|
|
|
52
54
|
}));
|
|
53
55
|
|
|
54
56
|
/**
|
|
57
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useLocation' instead
|
|
55
58
|
*/
|
|
56
59
|
const withLocation: ComponentType<any> = connect<
|
|
57
60
|
WithLocationProps,
|
|
@@ -65,6 +68,7 @@ const withLocation: ComponentType<any> = connect<
|
|
|
65
68
|
}));
|
|
66
69
|
|
|
67
70
|
/**
|
|
71
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useQuerystring' instead
|
|
68
72
|
*/
|
|
69
73
|
const withQuerystring: ComponentType<any> = connect<
|
|
70
74
|
WithQuerystringProps,
|
|
@@ -78,6 +82,7 @@ const withQuerystring: ComponentType<any> = connect<
|
|
|
78
82
|
}));
|
|
79
83
|
|
|
80
84
|
/**
|
|
85
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useNavigation' instead
|
|
81
86
|
*/
|
|
82
87
|
const withNavigation: ComponentType<any> = connect<
|
|
83
88
|
NavigationDispatchProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterConnectors.js","names":["connect","push","replace","go","goBack","goForward","withKey","state","locationKey","router","location","key","withPathname","pathname","withLocation","withQuerystring","querystring","search","withNavigation"],"sources":["../../../src/redux/_router/RouterConnectors.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { push, replace, go, goBack, goForward } from \"./RouterActions\";\n\nimport type { Location, LocationShape } from \"react-router\";\nimport type {\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./types\";\nimport type { ComponentType } from \"react\";\nimport type { ReduxState } from \"../types\";\n\ntype WithKeyStateProps = { locationKey: string, ... };\n\ntype WithPathnameProps = { pathname: string, ... };\n\ntype WithLocationProps = { location: Location, ... };\n\ntype WithQuerystringProps = { querystring: string, ... };\n\ntype NavigationDispatchProps = {\n push: (location: LocationShape | string, state?: { ... }) => PushAction,\n replace: (location: LocationShape | string, state?: { ... }) => ReplaceAction,\n go: (delta: number) => GoAction,\n goBack: () => GoBackAction,\n goForward: () => GoForwardAction,\n};\n\n/**\n */\nconst withKey: ComponentType<any> = connect<WithKeyStateProps, {}, _, _, _, _>(\n (state: ReduxState) => ({\n locationKey: state.router.location?.key ?? \"\",\n }),\n);\n\n/**\n */\nconst withPathname: ComponentType<any> = connect<\n WithPathnameProps,\n {},\n _,\n _,\n _,\n _,\n>((state: ReduxState) => ({\n pathname: state.router.location?.pathname,\n}));\n\n/**\n */\nconst withLocation: ComponentType<any> = connect<\n WithLocationProps,\n {},\n _,\n _,\n _,\n _,\n>((state: ReduxState) => ({\n location: state.router.location,\n}));\n\n/**\n */\nconst withQuerystring: ComponentType<any> = connect<\n WithQuerystringProps,\n {},\n _,\n _,\n _,\n _,\n>((state: ReduxState) => ({\n querystring: state.router.location?.search,\n}));\n\n/**\n */\nconst withNavigation: ComponentType<any> = connect<\n NavigationDispatchProps,\n {},\n _,\n _,\n _,\n _,\n>(null, {\n push,\n replace,\n go,\n goBack,\n goForward,\n});\n\nexport { withKey, withPathname, withLocation, withQuerystring, withNavigation };\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,IAAI,EAAEC,OAAO,EAAEC,EAAE,EAAEC,MAAM,EAAEC,SAAS,QAAQ,iBAAiB;AA6BtE;AACA;AACA,MAAMC,OAA2B,GAAGN,OAAO,CACxCO,KAAiB,KAAM;EACtBC,WAAW,EAAED,KAAK,CAACE,MAAM,CAACC,QAAQ,EAAEC,GAAG,IAAI;AAC7C,CAAC,CACH,CAAC;;AAED;AACA;AACA,MAAMC,YAAgC,GAAGZ,OAAO,CAO7CO,KAAiB,KAAM;EACxBM,QAAQ,EAAEN,KAAK,CAACE,MAAM,CAACC,QAAQ,EAAEG;AACnC,CAAC,CAAC,CAAC;;AAEH;AACA;AACA,MAAMC,YAAgC,GAAGd,OAAO,CAO7CO,KAAiB,KAAM;EACxBG,QAAQ,EAAEH,KAAK,CAACE,MAAM,CAACC;AACzB,CAAC,CAAC,CAAC;;AAEH;AACA;AACA,MAAMK,eAAmC,GAAGf,OAAO,CAOhDO,KAAiB,KAAM;EACxBS,WAAW,EAAET,KAAK,CAACE,MAAM,CAACC,QAAQ,EAAEO;AACtC,CAAC,CAAC,CAAC;;AAEH;AACA;AACA,MAAMC,cAAkC,GAAGlB,OAAO,CAOhD,IAAI,EAAE;EACNC,IAAI;EACJC,OAAO;EACPC,EAAE;EACFC,MAAM;EACNC;AACF,CAAC,CAAC;AAEF,SAASC,OAAO,EAAEM,YAAY,EAAEE,YAAY,EAAEC,eAAe,EAAEG,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"RouterConnectors.js","names":["connect","push","replace","go","goBack","goForward","withKey","state","locationKey","router","location","key","withPathname","pathname","withLocation","withQuerystring","querystring","search","withNavigation"],"sources":["../../../src/redux/_router/RouterConnectors.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { push, replace, go, goBack, goForward } from \"./RouterActions\";\n\nimport type { Location, LocationShape } from \"react-router\";\nimport type {\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./types\";\nimport type { ComponentType } from \"react\";\nimport type { ReduxState } from \"../types\";\n\ntype WithKeyStateProps = { locationKey: string, ... };\n\ntype WithPathnameProps = { pathname: string, ... };\n\ntype WithLocationProps = { location: Location, ... };\n\ntype WithQuerystringProps = { querystring: string, ... };\n\ntype NavigationDispatchProps = {\n push: (location: LocationShape | string, state?: { ... }) => PushAction,\n replace: (location: LocationShape | string, state?: { ... }) => ReplaceAction,\n go: (delta: number) => GoAction,\n goBack: () => GoBackAction,\n goForward: () => GoForwardAction,\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useLocationKey' instead\n */\nconst withKey: ComponentType<any> = connect<WithKeyStateProps, {}, _, _, _, _>(\n (state: ReduxState) => ({\n locationKey: state.router.location?.key ?? \"\",\n }),\n);\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'usePathname' instead\n */\nconst withPathname: ComponentType<any> = connect<\n WithPathnameProps,\n {},\n _,\n _,\n _,\n _,\n>((state: ReduxState) => ({\n pathname: state.router.location?.pathname,\n}));\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useLocation' instead\n */\nconst withLocation: ComponentType<any> = connect<\n WithLocationProps,\n {},\n _,\n _,\n _,\n _,\n>((state: ReduxState) => ({\n location: state.router.location,\n}));\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useQuerystring' instead\n */\nconst withQuerystring: ComponentType<any> = connect<\n WithQuerystringProps,\n {},\n _,\n _,\n _,\n _,\n>((state: ReduxState) => ({\n querystring: state.router.location?.search,\n}));\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useNavigation' instead\n */\nconst withNavigation: ComponentType<any> = connect<\n NavigationDispatchProps,\n {},\n _,\n _,\n _,\n _,\n>(null, {\n push,\n replace,\n go,\n goBack,\n goForward,\n});\n\nexport { withKey, withPathname, withLocation, withQuerystring, withNavigation };\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,IAAI,EAAEC,OAAO,EAAEC,EAAE,EAAEC,MAAM,EAAEC,SAAS,QAAQ,iBAAiB;AA6BtE;AACA;AACA;AACA,MAAMC,OAA2B,GAAGN,OAAO,CACxCO,KAAiB,KAAM;EACtBC,WAAW,EAAED,KAAK,CAACE,MAAM,CAACC,QAAQ,EAAEC,GAAG,IAAI;AAC7C,CAAC,CACH,CAAC;;AAED;AACA;AACA;AACA,MAAMC,YAAgC,GAAGZ,OAAO,CAO7CO,KAAiB,KAAM;EACxBM,QAAQ,EAAEN,KAAK,CAACE,MAAM,CAACC,QAAQ,EAAEG;AACnC,CAAC,CAAC,CAAC;;AAEH;AACA;AACA;AACA,MAAMC,YAAgC,GAAGd,OAAO,CAO7CO,KAAiB,KAAM;EACxBG,QAAQ,EAAEH,KAAK,CAACE,MAAM,CAACC;AACzB,CAAC,CAAC,CAAC;;AAEH;AACA;AACA;AACA,MAAMK,eAAmC,GAAGf,OAAO,CAOhDO,KAAiB,KAAM;EACxBS,WAAW,EAAET,KAAK,CAACE,MAAM,CAACC,QAAQ,EAAEO;AACtC,CAAC,CAAC,CAAC;;AAEH;AACA;AACA;AACA,MAAMC,cAAkC,GAAGlB,OAAO,CAOhD,IAAI,EAAE;EACNC,IAAI;EACJC,OAAO;EACPC,EAAE;EACFC,MAAM;EACNC;AACF,CAAC,CAAC;AAEF,SAASC,OAAO,EAAEM,YAAY,EAAEE,YAAY,EAAEC,eAAe,EAAEG,cAAc","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import modularui from "../_modularui/ModularUIConnector";
|
|
|
4
4
|
import type { ModularUIConnector } from "../_modularui/types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useApplication' instead
|
|
7
8
|
*/
|
|
8
9
|
export const connectApplication: ModularUIConnector = modularui(
|
|
9
10
|
"Application",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.js","names":["modularui","connectApplication","propName"],"sources":["../../../src/redux/connectors/Application.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport type { ModularUIConnector } from \"../_modularui/types\";\n\n/**\n */\nexport const connectApplication: ModularUIConnector = modularui(\n \"Application\",\n \"/\",\n {\n propName: \"application\",\n },\n);\n"],"mappings":"AACA,OAAOA,SAAS,MAAM,kCAAkC;AAIxD;AACA;AACA,OAAO,MAAMC,kBAAsC,GAAGD,SAAS,CAC7D,aAAa,EACb,GAAG,EACH;EACEE,QAAQ,EAAE;AACZ,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Application.js","names":["modularui","connectApplication","propName"],"sources":["../../../src/redux/connectors/Application.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport type { ModularUIConnector } from \"../_modularui/types\";\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useApplication' instead\n */\nexport const connectApplication: ModularUIConnector = modularui(\n \"Application\",\n \"/\",\n {\n propName: \"application\",\n },\n);\n"],"mappings":"AACA,OAAOA,SAAS,MAAM,kCAAkC;AAIxD;AACA;AACA;AACA,OAAO,MAAMC,kBAAsC,GAAGD,SAAS,CAC7D,aAAa,EACb,GAAG,EACH;EACEE,QAAQ,EAAE;AACZ,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.js","names":["connect","getActiveModels","mapStateToProps","state","items","connectBreadcrumb"],"sources":["../../../src/redux/connectors/Breadcrumb.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { getActiveModels } from \"../_modularui/ModularUISelectors\";\n\nimport type { ReduxState } from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n items: Array<{ key: string, href: Href, label: string, type: string }>,\n};\ntype Props = { ...StateProps, ... };\n\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n items: getActiveModels(state),\n});\n\n/**\n */\nexport const connectBreadcrumb: ComponentType<any> = connect<\n Props,\n {},\n _,\n _,\n _,\n _,\n>(mapStateToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,eAAe,QAAQ,kCAAkC;AAWlE,MAAMC,eAAe,GAAIC,KAAiB,KAAkB;EAC1DC,KAAK,EAAEH,eAAe,CAACE,KAAK;AAC9B,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAME,iBAAqC,GAAGL,OAAO,CAO1DE,eAAe,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","names":["connect","getActiveModels","mapStateToProps","state","items","connectBreadcrumb"],"sources":["../../../src/redux/connectors/Breadcrumb.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { getActiveModels } from \"../_modularui/ModularUISelectors\";\n\nimport type { ReduxState } from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n items: Array<{ key: string, href: Href, label: string, type: string }>,\n};\ntype Props = { ...StateProps, ... };\n\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n items: getActiveModels(state),\n});\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useActiveModels' instead\n */\nexport const connectBreadcrumb: ComponentType<any> = connect<\n Props,\n {},\n _,\n _,\n _,\n _,\n>(mapStateToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,eAAe,QAAQ,kCAAkC;AAWlE,MAAMC,eAAe,GAAIC,KAAiB,KAAkB;EAC1DC,KAAK,EAAEH,eAAe,CAACE,KAAK;AAC9B,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAME,iBAAqC,GAAGL,OAAO,CAO1DE,eAAe,CAAC","ignoreList":[]}
|