@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
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_useAllFormsOnModel","require","_Object$keys","forEach","key","exports","Object","defineProperty","enumerable","get","_useAuthentication","_useContent","_useForm","_useI18n","_useList","_useLookup","_useModal","_useModelCatalog","_useModels","_useModularUI","_useModularUIBasic","_useModularUIModel","_useModularUIRequest","_useNotification","_usePanel","_usePreference","_useProgressIndicator","_useRouter","_useSearch"],"sources":["../../src/hooks/index.js"],"sourcesContent":["// @flow\nexport * from \"./useAllFormsOnModel\";\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useList\";\nexport * from \"./useLookup\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePanel\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\nexport * from \"./useSearch\";\n"],"mappings":";;;;;;AACA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,YAAA,CAAAF,mBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,mBAAA,CAAAI,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,mBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,kBAAA,GAAAT,OAAA;AAAAC,YAAA,CAAAQ,kBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,kBAAA,CAAAN,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,kBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,WAAA,GAAAV,OAAA;AAAAC,YAAA,CAAAS,WAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,O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AD,GAAA,MAAAc,UAAA,CAAAd,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,UAAA,CAAAd,GAAA;IAAA;EAAA;AAAA;AACA,IAAAe,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_useAllFormsOnModel","require","_Object$keys","forEach","key","exports","Object","defineProperty","enumerable","get","_useAuthentication","_useContent","_useForm","_useI18n","_useList","_useLookup","_useModal","_useModelCatalog","_useModels","_useModelSelectors","_useModularUI","_useModularUIBasic","_useModularUIModel","_useModularUIRequest","_useNotification","_usePanel","_usePreference","_useProgressIndicator","_useRouter","_useSearch"],"sources":["../../src/hooks/index.js"],"sourcesContent":["// @flow\nexport * from \"./useAllFormsOnModel\";\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useList\";\nexport * from \"./useLookup\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModelSelectors\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePanel\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\nexport * from \"./useSearch\";\n"],"mappings":";;;;;;AACA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,YAAA,CAAAF,mBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,mBAAA,CAAAI,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,mBAAA,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A,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAuB,qBAAA,CAAAvB,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAkB,qBAAA,CAAAvB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAwB,UAAA,GAAA3B,OAAA;AAAAC,YAAA,CAAA0B,UAAA,EAAAzB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAwB,UAAA,CAAAxB,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAmB,UAAA,CAAAxB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAyB,UAAA,GAAA5B,OAAA;AAAAC,YAAA,CAAA2B,UAAA,EAAA1B,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAyB,UAAA,CAAAzB,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAoB,UAAA,CAAAzB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useModelByHref = exports.useKeyByHref = exports.useFirstModelByInstance = exports.useAllModelsByInstance = exports.useAllKeysByHref = exports.useAllFinishedModels = exports.useActiveModels = exports.useActiveModelByInstance = void 0;
|
|
8
|
+
var _reactRedux = require("react-redux");
|
|
9
|
+
var _ModularUISelectors = require("../redux/_modularui/ModularUISelectors");
|
|
10
|
+
var _Href = _interopRequireDefault(require("../models/href/Href"));
|
|
11
|
+
/**
|
|
12
|
+
* Returns all models in the store that are instances of the provided class
|
|
13
|
+
* and match the current application locale.
|
|
14
|
+
*/
|
|
15
|
+
const useAllModelsByInstance = instance => {
|
|
16
|
+
return (0, _reactRedux.useSelector)(state => (0, _ModularUISelectors.getAllModelsByInstance)(state, instance));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns the first model found in the store that is an instance of the
|
|
21
|
+
* provided class and matches the current locale.
|
|
22
|
+
*/
|
|
23
|
+
exports.useAllModelsByInstance = useAllModelsByInstance;
|
|
24
|
+
const useFirstModelByInstance = instance => {
|
|
25
|
+
return (0, _reactRedux.useSelector)(state => (0, _ModularUISelectors.getFirstModelByInstance)(state, instance));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns the model instance that is currently "active" based on the URL path.
|
|
30
|
+
* It checks if the current router location starts with the model's selfhref path.
|
|
31
|
+
*/
|
|
32
|
+
exports.useFirstModelByInstance = useFirstModelByInstance;
|
|
33
|
+
const useActiveModelByInstance = instance => {
|
|
34
|
+
return (0, _reactRedux.useSelector)(state => (0, _ModularUISelectors.getActiveModelByInstance)(state, instance));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves a specific model from the store based on its unique Href.
|
|
39
|
+
* @param {Href | string} href - The Href object or string path of the model.
|
|
40
|
+
* @returns {ModularUIModel | null} The model matching the href or null.
|
|
41
|
+
*/
|
|
42
|
+
exports.useActiveModelByInstance = useActiveModelByInstance;
|
|
43
|
+
const useModelByHref = href => {
|
|
44
|
+
return (0, _reactRedux.useSelector)(state => (0, _ModularUISelectors.modelByHref)(state, href));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns the unique store key (identifier) for a model associated with a specific Href.
|
|
49
|
+
* @param {Href | string} href - The Href object or string path.
|
|
50
|
+
* @returns {string | null | void} The internal key of the model.
|
|
51
|
+
*/
|
|
52
|
+
exports.useModelByHref = useModelByHref;
|
|
53
|
+
const useKeyByHref = href => {
|
|
54
|
+
return (0, _reactRedux.useSelector)(state => (0, _ModularUISelectors.keyByHref)(state, href));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns all internal keys found in the store for a specific Href.
|
|
59
|
+
* Useful if multiple versions/entries exist for the same path.
|
|
60
|
+
* @param {Href | string} href - The Href object or string path.
|
|
61
|
+
* @returns {Array<string>} An array of keys.
|
|
62
|
+
*/
|
|
63
|
+
exports.useKeyByHref = useKeyByHref;
|
|
64
|
+
const useAllKeysByHref = href => {
|
|
65
|
+
return (0, _reactRedux.useSelector)(state => (0, _ModularUISelectors.allKeysByHref)(state, href));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns a list of simplified model info (key, href, label, type) for all
|
|
70
|
+
* models currently active in the navigation context (breadcrumbs).
|
|
71
|
+
* @returns {Array<{key: string, href: Href, label: string, type: string}>}
|
|
72
|
+
*/
|
|
73
|
+
exports.useAllKeysByHref = useAllKeysByHref;
|
|
74
|
+
const useActiveModels = () => {
|
|
75
|
+
return (0, _reactRedux.useSelector)(_ModularUISelectors.getActiveModels);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Returns all models in the store that have a status of MODULARUI_STATUS.FINISHED.
|
|
80
|
+
* @returns {Array<ModularUIModel>} An array of fully loaded models.
|
|
81
|
+
*/
|
|
82
|
+
exports.useActiveModels = useActiveModels;
|
|
83
|
+
const useAllFinishedModels = () => {
|
|
84
|
+
return (0, _reactRedux.useSelector)(_ModularUISelectors.getAllFinishedModels);
|
|
85
|
+
};
|
|
86
|
+
exports.useAllFinishedModels = useAllFinishedModels;
|
|
87
|
+
//# sourceMappingURL=useModelSelectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModelSelectors.js","names":["_reactRedux","require","_ModularUISelectors","_Href","_interopRequireDefault","useAllModelsByInstance","instance","useSelector","state","getAllModelsByInstance","exports","useFirstModelByInstance","getFirstModelByInstance","useActiveModelByInstance","getActiveModelByInstance","useModelByHref","href","modelByHref","useKeyByHref","keyByHref","useAllKeysByHref","allKeysByHref","useActiveModels","getActiveModels","useAllFinishedModels","getAllFinishedModels"],"sources":["../../src/hooks/useModelSelectors.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\n\nimport {\n getAllModelsByInstance,\n getFirstModelByInstance,\n getActiveModelByInstance,\n modelByHref,\n keyByHref,\n allKeysByHref,\n getActiveModels,\n getAllFinishedModels,\n} from \"../redux/_modularui/ModularUISelectors\";\nimport type { ModularUIModel } from \"../models/types\";\nimport type { ReduxState } from \"../redux/types\";\nimport Href from \"../models/href/Href\";\n\n/**\n * Returns all models in the store that are instances of the provided class\n * and match the current application locale.\n */\nexport const useAllModelsByInstance = <T>(\n instance: Class<T>,\n): Array<ModularUIModel> => {\n return useSelector((state: ReduxState) =>\n getAllModelsByInstance(state, instance),\n );\n};\n\n/**\n * Returns the first model found in the store that is an instance of the\n * provided class and matches the current locale.\n */\nexport const useFirstModelByInstance = <T>(instance: Class<T>): T | null => {\n return useSelector((state: ReduxState) =>\n getFirstModelByInstance(state, instance),\n );\n};\n\n/**\n * Returns the model instance that is currently \"active\" based on the URL path.\n * It checks if the current router location starts with the model's selfhref path.\n */\nexport const useActiveModelByInstance = <T>(instance: Class<T>): T | null => {\n return useSelector((state: ReduxState) =>\n getActiveModelByInstance(state, instance),\n );\n};\n\n/**\n * Retrieves a specific model from the store based on its unique Href.\n * @param {Href | string} href - The Href object or string path of the model.\n * @returns {ModularUIModel | null} The model matching the href or null.\n */\nexport const useModelByHref = (href: Href | string): null | ModularUIModel => {\n return useSelector((state: ReduxState) => modelByHref(state, href));\n};\n\n/**\n * Returns the unique store key (identifier) for a model associated with a specific Href.\n * @param {Href | string} href - The Href object or string path.\n * @returns {string | null | void} The internal key of the model.\n */\nexport const useKeyByHref = (href: Href | string): ?string => {\n return useSelector((state: ReduxState) => keyByHref(state, href));\n};\n\n/**\n * Returns all internal keys found in the store for a specific Href.\n * Useful if multiple versions/entries exist for the same path.\n * @param {Href | string} href - The Href object or string path.\n * @returns {Array<string>} An array of keys.\n */\nexport const useAllKeysByHref = (href: Href | string): Array<string> => {\n return useSelector((state: ReduxState) => allKeysByHref(state, href));\n};\n\n/**\n * Returns a list of simplified model info (key, href, label, type) for all\n * models currently active in the navigation context (breadcrumbs).\n * @returns {Array<{key: string, href: Href, label: string, type: string}>}\n */\nexport const useActiveModels = (): Array<{\n key: string,\n href: Href,\n label: string,\n type: string,\n}> => {\n return useSelector(getActiveModels);\n};\n\n/**\n * Returns all models in the store that have a status of MODULARUI_STATUS.FINISHED.\n * @returns {Array<ModularUIModel>} An array of fully loaded models.\n */\nexport const useAllFinishedModels = (): Array<ModularUIModel> => {\n return useSelector(getAllFinishedModels);\n};\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAYA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMI,sBAAsB,GACjCC,QAAkB,IACQ;EAC1B,OAAO,IAAAC,uBAAW,EAAEC,KAAiB,IACnC,IAAAC,0CAAsB,EAACD,KAAK,EAAEF,QAAQ,CACxC,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AAHAI,OAAA,CAAAL,sBAAA,GAAAA,sBAAA;AAIO,MAAMM,uBAAuB,GAAOL,QAAkB,IAAe;EAC1E,OAAO,IAAAC,uBAAW,EAAEC,KAAiB,IACnC,IAAAI,2CAAuB,EAACJ,KAAK,EAAEF,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C,CAAC;AAACf,OAAA,CAAAc,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -14,13 +14,36 @@ var _useDeepCompareEffect = _interopRequireDefault(require("./useDeepCompareEffe
|
|
|
14
14
|
var _useModularUIKey = require("./useModularUIKey");
|
|
15
15
|
var _Href = _interopRequireDefault(require("../models/href/Href"));
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* A custom hook to fetch and manage Be Informed modular UI resources.
|
|
18
|
+
* It handles automatic data fetching based on URL/query changes, manages Redux state
|
|
19
|
+
* synchronization, and provides cleanup logic when components unmount.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} modelKey - A unique identifier for the type of model being fetched.
|
|
22
|
+
* @param {string | Href} url - The endpoint URL or Href instance to fetch data from.
|
|
23
|
+
* @param {RequestModularUIOptions} options - Configuration for the request (method, headers, etc.).
|
|
24
|
+
* @returns {ModelEntry} The model data retrieved from the Redux store.
|
|
18
25
|
*/
|
|
19
26
|
const useModularUI = (modelKey, url, options = {}) => {
|
|
20
27
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
|
|
29
|
+
// Normalize the URL input into a Href instance to safely access query params and paths
|
|
30
|
+
const hrefInstance = (0, _react.useMemo)(() => new _Href.default(url), [url]);
|
|
31
|
+
const requestUrl = (0, _react.useMemo)(() => hrefInstance.toString(), [hrefInstance]);
|
|
32
|
+
const currentQueryString = hrefInstance.querystring;
|
|
33
|
+
|
|
34
|
+
// Persistence ref to detect if query parameters have changed between renders
|
|
35
|
+
const prevQueryRef = (0, _react.useRef)(currentQueryString);
|
|
36
|
+
|
|
37
|
+
// Generate a unique key for the Redux store based on the model type and the full URL
|
|
38
|
+
const key = (0, _useModularUIKey.useModularUIKey)(modelKey, requestUrl);
|
|
39
|
+
|
|
40
|
+
// Select the specific piece of state corresponding to this modular UI component
|
|
23
41
|
const model = (0, _reactRedux.useSelector)(state => state.modularui[key]);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Memoize request options to prevent unnecessary re-renders.
|
|
45
|
+
* Merges default settings (GET method, auto-cleanup) with user-provided options.
|
|
46
|
+
*/
|
|
24
47
|
const requestOptions = (0, _react.useMemo)(() => {
|
|
25
48
|
const merged = {
|
|
26
49
|
method: _constants.HTTP_METHODS.GET,
|
|
@@ -35,14 +58,34 @@ const useModularUI = (modelKey, url, options = {}) => {
|
|
|
35
58
|
}, [options, url]);
|
|
36
59
|
const location = (0, _reactRouter.useLocation)();
|
|
37
60
|
const redirectLocation = location.state?.redirectLocation;
|
|
38
|
-
const shouldLoad = model == null || model.status === _constants.MODULARUI_STATUS.ERROR || (redirectLocation instanceof _Href.default ? redirectLocation.equals(href) : false) || requestOptions.isReload === true;
|
|
39
61
|
|
|
40
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Determines if a network request should be initiated.
|
|
64
|
+
* Logic includes:
|
|
65
|
+
* - Model doesn't exist yet (Initial load)
|
|
66
|
+
* - Previous request resulted in an error (Retry)
|
|
67
|
+
* - The query parameters changed (Filtering/Paging)
|
|
68
|
+
* - A redirect was triggered specifically for this URL
|
|
69
|
+
* - Manual 'isReload' flag is passed in options
|
|
70
|
+
*/
|
|
71
|
+
const shouldLoad = model == null || model.status === _constants.MODULARUI_STATUS.ERROR || prevQueryRef.current !== currentQueryString || (redirectLocation instanceof _Href.default ? redirectLocation.equals(requestUrl) : false) || requestOptions.isReload === true;
|
|
72
|
+
|
|
73
|
+
// Synchronize the ref after the render cycle determines if we should load
|
|
74
|
+
(0, _react.useEffect)(() => {
|
|
75
|
+
prevQueryRef.current = currentQueryString;
|
|
76
|
+
}, [currentQueryString]);
|
|
77
|
+
|
|
78
|
+
// Execute the load action. Deep compare is used on options to prevent
|
|
79
|
+
// infinite loops caused by passing inline object literals.
|
|
41
80
|
(0, _useDeepCompareEffect.default)(() => {
|
|
42
|
-
if (
|
|
43
|
-
dispatch((0, _ModularUIActions.loadModularUI)(key,
|
|
81
|
+
if (requestUrl !== "" && shouldLoad) {
|
|
82
|
+
dispatch((0, _ModularUIActions.loadModularUI)(key, requestUrl, requestOptions));
|
|
44
83
|
}
|
|
45
|
-
}, [key,
|
|
84
|
+
}, [key, requestUrl, requestOptions, shouldLoad]);
|
|
85
|
+
|
|
86
|
+
// Cleanup Effect:
|
|
87
|
+
// If 'removeOnUnmount' is true, this removes the model data from the Redux store
|
|
88
|
+
// when the component using this hook is destroyed.
|
|
46
89
|
(0, _react.useEffect)(() => {
|
|
47
90
|
if (requestOptions.removeOnUnmount) {
|
|
48
91
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUI.js","names":["_react","require","_reactRedux","_reactRouter","_constants","_ModularUIActions","_useDeepCompareEffect","_interopRequireDefault","_useModularUIKey","_Href","useModularUI","modelKey","url","options","dispatch","useDispatch","
|
|
1
|
+
{"version":3,"file":"useModularUI.js","names":["_react","require","_reactRedux","_reactRouter","_constants","_ModularUIActions","_useDeepCompareEffect","_interopRequireDefault","_useModularUIKey","_Href","useModularUI","modelKey","url","options","dispatch","useDispatch","hrefInstance","useMemo","Href","requestUrl","toString","currentQueryString","querystring","prevQueryRef","useRef","key","useModularUIKey","model","useSelector","state","modularui","requestOptions","merged","method","HTTP_METHODS","GET","removeOnUnmount","origin","contextPath","location","useLocation","redirectLocation","shouldLoad","status","MODULARUI_STATUS","ERROR","current","equals","isReload","useEffect","useDeepCompareEffect","loadModularUI","removeModelByKey","exports"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useMemo, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\nimport { useModularUIKey } from \"./useModularUIKey\";\n\nimport Href from \"../models/href/Href\";\n\nimport type { RequestModularUIOptions } from \"../utils\";\nimport type { ModelEntry } from \"../redux\";\n\n/**\n * A custom hook to fetch and manage Be Informed modular UI resources.\n * It handles automatic data fetching based on URL/query changes, manages Redux state\n * synchronization, and provides cleanup logic when components unmount.\n *\n * @param {string} modelKey - A unique identifier for the type of model being fetched.\n * @param {string | Href} url - The endpoint URL or Href instance to fetch data from.\n * @param {RequestModularUIOptions} options - Configuration for the request (method, headers, etc.).\n * @returns {ModelEntry} The model data retrieved from the Redux store.\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = (({}: any): RequestModularUIOptions),\n): any => {\n const dispatch = useDispatch();\n\n // Normalize the URL input into a Href instance to safely access query params and paths\n const hrefInstance = useMemo(() => new Href(url), [url]);\n const requestUrl = useMemo(() => hrefInstance.toString(), [hrefInstance]);\n const currentQueryString = hrefInstance.querystring;\n\n // Persistence ref to detect if query parameters have changed between renders\n const prevQueryRef = useRef(currentQueryString);\n\n // Generate a unique key for the Redux store based on the model type and the full URL\n const key = useModularUIKey(modelKey, requestUrl);\n\n // Select the specific piece of state corresponding to this modular UI component\n const model = useSelector((state) => state.modularui[key]);\n\n /**\n * Memoize request options to prevent unnecessary re-renders.\n * Merges default settings (GET method, auto-cleanup) with user-provided options.\n */\n const requestOptions = useMemo(() => {\n const merged = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: true,\n ...options,\n };\n\n if (url instanceof Href) {\n merged.origin = merged.origin ?? url.origin;\n merged.contextPath = merged.contextPath ?? url.contextPath;\n }\n return merged;\n }, [options, url]);\n\n const location = useLocation();\n const redirectLocation = location.state?.redirectLocation;\n\n /**\n * Determines if a network request should be initiated.\n * Logic includes:\n * - Model doesn't exist yet (Initial load)\n * - Previous request resulted in an error (Retry)\n * - The query parameters changed (Filtering/Paging)\n * - A redirect was triggered specifically for this URL\n * - Manual 'isReload' flag is passed in options\n */\n const shouldLoad =\n model == null ||\n model.status === MODULARUI_STATUS.ERROR ||\n prevQueryRef.current !== currentQueryString ||\n (redirectLocation instanceof Href\n ? redirectLocation.equals(requestUrl)\n : false) ||\n requestOptions.isReload === true;\n\n // Synchronize the ref after the render cycle determines if we should load\n useEffect(() => {\n prevQueryRef.current = currentQueryString;\n }, [currentQueryString]);\n\n // Execute the load action. Deep compare is used on options to prevent\n // infinite loops caused by passing inline object literals.\n useDeepCompareEffect(() => {\n if (requestUrl !== \"\" && shouldLoad) {\n dispatch(loadModularUI(key, requestUrl, requestOptions));\n }\n }, [key, requestUrl, requestOptions, shouldLoad]);\n\n // Cleanup Effect:\n // If 'removeOnUnmount' is true, this removes the model data from the Redux store\n // when the component using this hook is destroyed.\n useEffect(() => {\n if (requestOptions.removeOnUnmount) {\n return () => {\n dispatch(removeModelByKey(key));\n };\n }\n }, [dispatch, key, requestOptions.removeOnUnmount]);\n\n return model;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAKA,IAAAK,qBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAEA,IAAAQ,KAAA,GAAAF,sBAAA,CAAAN,OAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,YAAY,GAAGA,CAC1BC,QAAgB,EAChBC,GAAkB,EAClBC,OAAgC,GAAK,CAAC,CAAiC,KAC/D;EACR,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;;EAE9B;EACA,MAAMC,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,IAAIC,aAAI,CAACN,GAAG,CAAC,EAAE,CAACA,GAAG,CAAC,CAAC;EACxD,MAAMO,UAAU,GAAG,IAAAF,cAAO,EAAC,MAAMD,YAAY,CAACI,QAAQ,CAAC,CAAC,EAA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AAI;;EAElC;EACA,IAAAC,gBAAS,EAAC,MAAM;IACd1B,YAAY,CAACuB,OAAO,GAAGzB,kBAAkB;EAC3C,CAAC,EAAE,CAACA,kBAAkB,CAAC,CAAC;;EAExB;EACA;EACA,IAAA6B,6BAAoB,EAAC,MAAM;IACzB,IAAI/B,UAAU,KAAK,EAAE,IAAIuB,UAAU,EAAE;MACnC5B,QAAQ,CAAC,IAAAqC,+BAAa,EAAC1B,GAAG,EAAEN,UAAU,EAAEY,cAAc,CAAC,CAAC;IAC1D;EACF,CAAC,EAAE,CAACN,GAAG,EAAEN,UAAU,EAAEY,cAAc,EAAEW,UAAU,CAAC,CAAC;;EAEjD;EACA;EACA;EACA,IAAAO,gBAAS,EAAC,MAAM;IACd,IAAIlB,cAAc,CAACK,eAAe,EAAE;MAClC,OAAO,MAAM;QACXtB,QAAQ,CAAC,IAAAsC,kCAAgB,EAAC3B,GAAG,CAAC,CAAC;MACjC,CAAC;IACH;EACF,CAAC,EAAE,CAACX,QAAQ,EAAEW,GAAG,EAAEM,cAAc,CAACK,eAAe,CAAC,CAAC;EAEnD,OAAOT,KAAK;AACd,CAAC;AAAC0B,OAAA,CAAA3C,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -12,7 +12,21 @@ var _react = require("react");
|
|
|
12
12
|
var _useModularUI = require("./useModularUI");
|
|
13
13
|
var _constants = require("../constants");
|
|
14
14
|
var _useModularUIKey = require("./useModularUIKey");
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Configuration options for low-level modular UI requests.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Configuration options for the useModularUIBasic hook.
|
|
20
|
+
* Allows for type enforcement, caching control, and reload behavior.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Internal helper to transform high-level hook options into a configuration
|
|
24
|
+
* object compatible with the core useModularUI fetcher.
|
|
25
|
+
* Logic:
|
|
26
|
+
* 1. Defaults to GET method.
|
|
27
|
+
* 2. If 'formdata' is present, it switches to POST and assigns 'data'.
|
|
28
|
+
* 3. Forces 'isReload' if the useReload check returns true.
|
|
29
|
+
*/
|
|
16
30
|
const createUseModularUIOptions = (options, href, mustReload) => {
|
|
17
31
|
const baseOptions = {
|
|
18
32
|
expectedModels: [],
|
|
@@ -28,7 +42,10 @@ const createUseModularUIOptions = (options, href, mustReload) => {
|
|
|
28
42
|
return baseOptions;
|
|
29
43
|
};
|
|
30
44
|
|
|
31
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Validates that the returned model type matches one of the expected model strings.
|
|
47
|
+
* Logs a warning to the console if there is a mismatch (useful for debugging UI-backend contracts).
|
|
48
|
+
*/
|
|
32
49
|
const validateModel = (model, expectedModels) => {
|
|
33
50
|
if (expectedModels.length > 0) {
|
|
34
51
|
const isCorrectModel = (0, _includes.default)(expectedModels).call(expectedModels, model.type);
|
|
@@ -39,15 +56,28 @@ const validateModel = (model, expectedModels) => {
|
|
|
39
56
|
};
|
|
40
57
|
|
|
41
58
|
/**
|
|
42
|
-
*
|
|
59
|
+
* A simplified abstraction over useModularUI that includes automatic
|
|
60
|
+
* model validation and smart-reload logic based on router state.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} defaultKey - The default identifier for the model.
|
|
63
|
+
* @param {string | Href} href - The endpoint to fetch.
|
|
64
|
+
* @param {UseModularUIBasicOptions} options - Extended configuration options.
|
|
43
65
|
*/
|
|
44
66
|
const useModularUIBasic = (defaultKey, href, options = {}) => {
|
|
45
67
|
const memoizedHref = (0, _react.useMemo)(() => href.toString(), [href]);
|
|
68
|
+
|
|
69
|
+
// Use the key provided in options if available, otherwise fallback to the default
|
|
46
70
|
const key = options.key ?? defaultKey;
|
|
71
|
+
|
|
72
|
+
// Determine if we need to bypass cache based on navigation 'reload' signals
|
|
47
73
|
const mustReload = useReload(key, memoizedHref);
|
|
74
|
+
|
|
75
|
+
// Memoize options to prevent useModularUI from re-fetching on every parent render
|
|
48
76
|
const modularUIOptions = (0, _react.useMemo)(() => createUseModularUIOptions(options, memoizedHref, mustReload), [options, memoizedHref, mustReload]);
|
|
49
77
|
const modularUI = (0, _useModularUI.useModularUI)(key, href, modularUIOptions);
|
|
50
78
|
const expectedModels = (0, _react.useMemo)(() => options.expectedModels ?? [], [options.expectedModels]);
|
|
79
|
+
|
|
80
|
+
// Extract and validate the model from the modularUI wrapper object
|
|
51
81
|
return (0, _react.useMemo)(() => {
|
|
52
82
|
if (modularUI?.model) {
|
|
53
83
|
validateModel(modularUI.model, expectedModels);
|
|
@@ -58,18 +88,31 @@ const useModularUIBasic = (defaultKey, href, options = {}) => {
|
|
|
58
88
|
};
|
|
59
89
|
|
|
60
90
|
/**
|
|
61
|
-
*
|
|
91
|
+
* Determines if a model should be reloaded based on the 'reload' timestamp
|
|
92
|
+
* found in the React Router location state.
|
|
93
|
+
* This is used for "force refresh" scenarios where a user navigates to a
|
|
94
|
+
* page and expects fresh data (e.g., after a form submission elsewhere).
|
|
95
|
+
* @param {string} modelKey - The model type key.
|
|
96
|
+
* @param {string} url - The resource URL.
|
|
97
|
+
* @returns {boolean} True if the store data is stale compared to the reload signal.
|
|
62
98
|
*/
|
|
63
99
|
exports.useModularUIBasic = useModularUIBasic;
|
|
64
100
|
const useReload = (modelKey, url) => {
|
|
65
101
|
const location = (0, _reactRouter.useLocation)();
|
|
66
102
|
const key = (0, _useModularUIKey.useModularUIKey)(modelKey, url);
|
|
103
|
+
|
|
104
|
+
// Access the current entry in the Redux store
|
|
67
105
|
const modelEntry = (0, _reactRedux.useSelector)(state => state.modularui[key]);
|
|
68
106
|
if (modelEntry) {
|
|
69
107
|
const reload = location.state?.reload || 0;
|
|
108
|
+
|
|
109
|
+
// If a reload timestamp exists in the router state
|
|
70
110
|
if (reload > 0) {
|
|
71
111
|
const isFullyLoaded = modelEntry?.status === _constants.MODULARUI_STATUS.FINISHED;
|
|
72
112
|
const lastModification = modelEntry?.lastModification ?? 0;
|
|
113
|
+
|
|
114
|
+
// Trigger reload only if the model is already finished loading
|
|
115
|
+
// AND the data we have is older than the requested reload time.
|
|
73
116
|
if (isFullyLoaded && lastModification < reload) {
|
|
74
117
|
return true;
|
|
75
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIBasic.js","names":["_reactRouter","require","_reactRedux","_react","_useModularUI","_constants","_useModularUIKey","createUseModularUIOptions","options","href","mustReload","baseOptions","expectedModels","method","HTTP_METHODS","GET","data","undefined","isReload","formdata","POST","validateModel","model","length","isCorrectModel","_includes","default","call","type","console","warn","useModularUIBasic","defaultKey","memoizedHref","useMemo","toString","key","useReload","modularUIOptions","modularUI","useModularUI","exports","modelKey","url","location","useLocation","useModularUIKey","modelEntry","useSelector","state","modularui","reload","isFullyLoaded","status","MODULARUI_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":["_reactRouter","require","_reactRedux","_react","_useModularUI","_constants","_useModularUIKey","createUseModularUIOptions","options","href","mustReload","baseOptions","expectedModels","method","HTTP_METHODS","GET","data","undefined","isReload","formdata","POST","validateModel","model","length","isCorrectModel","_includes","default","call","type","console","warn","useModularUIBasic","defaultKey","memoizedHref","useMemo","toString","key","useReload","modularUIOptions","modularUI","useModularUI","exports","modelKey","url","location","useLocation","useModularUIKey","modelEntry","useSelector","state","modularui","reload","isFullyLoaded","status","MODULARUI_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,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AAIA;AACA;AACA;AASA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,yBAAyB,GAAGA,CAChCC,OAAoC,EACpCC,IAAY,EACZC,UAAmB,KACR;EACX,MAAMC,WAAW,GAAG;IAClBC,cAAc,EAAE,EAAE;IAClBC,MAAM,EAAEC,uBAAY,CAACC,GAAG;IACxBC,IAAI,EAAEC,SAAS;IACf,GAAGT,OAAO;IACVU,QAAQ,EAAER,UAAU,IAAIF,OAAO,CAACU;EAClC,CAAC;EAED,IAAIV,OAAO,CAACW,QAAQ,IAAI,IAAI,EAAE;IAC5BR,WAAW,CAACE,MAAM,GAAGC,uBAAY,CAACM,IAAI;IACtCT,WAAW,CAACK,IAAI,GAAGR,OAAO,CAACW,QAAQ;EACrC;EAEA,OAAOR,WAAW;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMU,aAAa,GAAGA,CAACC,KAAU,EAAEV,cAA6B,KAAK;EACnE,IAAIA,cAAc,CAACW,MAAM,GAAG,CAAC,EAAE;IAC7B,MAAMC,cAAc,GAAG,IAAAC,SAAA,CAAAC,OAAA,EAAAd,cAAc,EAAAe,IAAA,CAAdf,cAAc,EAAUU,KAAK,CAACM,IAAI,CAAC;IAC1D,IAAI,CAACJ,cAAc,EAAE;MACnBK,OAAO,CAACC,IAAI,CAACR,KAAK,EAAE,oBAAoB,EAAEV,cAAc,CAAC;IAC3D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EACnE,MAAMC,QAAQ,GAAG,IAAAC,wBAAW,EAAC,CAAC;EAC9B,MAAMT,GAAG,GAAG,IAAAU,gCAAe,EAACJ,QAAQ,EAAEC,GAAG,CAAC;;EAE1C;EACA,MAAMI,UAAU,GAAG,IAAAC,uBAAW,EAAEC,KAAK,IAAKA,KAAK,CAACC,SAAS,CAACd,GAAG,CAAC,CAAC;EAE/D,IAAIW,UAAU,EAAE;IACd,MAAMI,MAAM,GAAGP,QAAQ,CAACK,KAAK,EAAEE,MAAM,IAAI,CAAC;;IAE1C;IACA,IAAIA,MAAM,GAAG,CAAC,EAAE;MACd,MAAMC,aAAa,GAAGL,UAAU,EAAEM,MAAM,KAAKC,2BAAgB,CAACC,QAAQ;MACtE,MAAMC,gBAAgB,GAAGT,UAAU,EAAES,gBAAgB,IAAI,CAAC;;MAE1D;MACA;MACA,IAAIJ,aAAa,IAAII,gBAAgB,GAAGL,MAAM,EAAE;QAC9C,OAAO,IAAI;MACb;IACF;EACF;EACA,OAAO,KAAK;AACd,CAAC;AAACV,OAAA,CAAAJ,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _reactRedux = require("react-redux");
|
|
10
9
|
var _reactRouter = require("react-router");
|
|
11
10
|
var _ModularUIActions = require("./ModularUIActions");
|
|
@@ -13,6 +12,7 @@ var _Href = _interopRequireDefault(require("../../models/href/Href"));
|
|
|
13
12
|
var _utils = require("../../react/utils");
|
|
14
13
|
var _ModularUIUtils = require("./ModularUIUtils");
|
|
15
14
|
var _useModularUI = require("../../hooks/useModularUI");
|
|
15
|
+
var _useModularUIBasic = require("../../hooks/useModularUIBasic");
|
|
16
16
|
var _useI18n = require("../../hooks/useI18n");
|
|
17
17
|
var _FormModel = _interopRequireDefault(require("../../models/form/FormModel"));
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -35,77 +35,48 @@ const patchUpdateModelOption = oldOptions => {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead
|
|
38
39
|
*/
|
|
39
40
|
const modularUIConnector = (name, resource, options = {
|
|
40
41
|
propName: "data",
|
|
41
|
-
removeOnUnmount:
|
|
42
|
+
removeOnUnmount: true
|
|
42
43
|
}) => {
|
|
43
44
|
const {
|
|
44
45
|
propName = "data",
|
|
45
|
-
removeOnUnmount =
|
|
46
|
+
removeOnUnmount = true,
|
|
46
47
|
...otherOptions
|
|
47
48
|
} = options;
|
|
48
49
|
return Component => {
|
|
49
50
|
const WrappedComponent = props => {
|
|
50
|
-
// explicit property for removeOnMount overwrite the setting
|
|
51
51
|
const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;
|
|
52
52
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
53
53
|
const location = (0, _reactRouter.useLocation)();
|
|
54
|
+
const locale = (0, _useI18n.useLocale)();
|
|
54
55
|
const url = (0, _ModularUIUtils.useUrl)(resource, {
|
|
55
56
|
location,
|
|
56
57
|
...props
|
|
57
58
|
});
|
|
58
|
-
const displayName = (0, _utils.getDisplayName)(Component, name, props.contextId);
|
|
59
59
|
|
|
60
|
-
//
|
|
61
|
-
const
|
|
60
|
+
// $FlowFixMe
|
|
61
|
+
const model = (0, _useModularUIBasic.useModularUIBasic)(name, url, options);
|
|
62
|
+
const modelEntry = (0, _useModularUI.useModularUI)(name, url, {
|
|
62
63
|
...otherOptions,
|
|
63
64
|
removeOnUnmount: finalRemoveOnUnmount
|
|
64
65
|
});
|
|
65
|
-
const modelKey =
|
|
66
|
-
|
|
67
|
-
// handle manual reload of model
|
|
68
|
-
const handleManualReload = (model, reloadOptions) => {
|
|
69
|
-
dispatch((0, _ModularUIActions.reloadModel)(model, reloadOptions));
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// Provide connected models with a fetchModularUI method to be able
|
|
73
|
-
// to run the loadModularUI action from a handler / callback in the component
|
|
66
|
+
const modelKey = model?.connectKey ?? name;
|
|
74
67
|
const handleFetch = (href, fetchOptions) => {
|
|
75
68
|
dispatch((0, _ModularUIActions.loadModularUI)(modelKey, href, patchUpdateModelOption(fetchOptions)));
|
|
76
69
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const doReload = (0, _ModularUIUtils.useReload)(modelEntry, reload);
|
|
81
|
-
(0, _react.useEffect)(() => {
|
|
82
|
-
if (doReload) {
|
|
83
|
-
dispatch((0, _ModularUIActions.loadModularUI)(modelKey, url, {
|
|
84
|
-
...patchUpdateModelOption(otherOptions),
|
|
85
|
-
isReload: true
|
|
86
|
-
}));
|
|
87
|
-
}
|
|
88
|
-
}, [dispatch, doReload, url, modelKey]);
|
|
89
|
-
|
|
90
|
-
// Remove model when hoc unloads
|
|
91
|
-
(0, _react.useEffect)(
|
|
92
|
-
// prettier-ignore
|
|
93
|
-
() => () => {
|
|
94
|
-
//NOSONAR
|
|
95
|
-
if (finalRemoveOnUnmount) {
|
|
96
|
-
dispatch((0, _ModularUIActions.removeModelByKey)(modelKey));
|
|
97
|
-
}
|
|
98
|
-
}, [dispatch, modelKey, finalRemoveOnUnmount]);
|
|
99
|
-
|
|
100
|
-
// Create new properties object to inject modularui properties to own props
|
|
101
|
-
const locale = (0, _useI18n.useLocale)();
|
|
70
|
+
const handleManualReload = (m, o) => {
|
|
71
|
+
dispatch((0, _ModularUIActions.reloadModel)(m, o));
|
|
72
|
+
};
|
|
102
73
|
const newProps = {
|
|
103
74
|
modelKey,
|
|
104
|
-
[propName]:
|
|
75
|
+
[propName ?? "data"]: model,
|
|
105
76
|
location,
|
|
106
77
|
status: modelEntry?.status ?? null,
|
|
107
78
|
lastModification: modelEntry?.lastModification ?? null,
|
|
108
|
-
hasModel: Boolean(
|
|
79
|
+
hasModel: Boolean(model),
|
|
109
80
|
locale,
|
|
110
81
|
fetchModularUI: handleFetch,
|
|
111
82
|
reloadModel: handleManualReload
|
|
@@ -115,7 +86,7 @@ const modularUIConnector = (name, resource, options = {
|
|
|
115
86
|
...newProps
|
|
116
87
|
});
|
|
117
88
|
};
|
|
118
|
-
WrappedComponent.displayName = `BI.modularui(${(0, _utils.getDisplayName)(
|
|
89
|
+
WrappedComponent.displayName = `BI.modularui(${(0, _utils.getDisplayName)(Component, name)})`;
|
|
119
90
|
return WrappedComponent;
|
|
120
91
|
};
|
|
121
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIConnector.js","names":["
|
|
1
|
+
{"version":3,"file":"ModularUIConnector.js","names":["_reactRedux","require","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useModularUIBasic","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","locale","useLocale","url","useUrl","model","useModularUIBasic","modelEntry","useModularUI","modelKey","connectKey","handleFetch","href","fetchOptions","loadModularUI","handleManualReload","m","o","reloadModel","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","displayName","getDisplayName","_default","exports","default"],"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,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAEA,IAAAS,QAAA,GAAAT,OAAA;AAEA,IAAAU,UAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAAoD,IAAAW,WAAA,GAAAX,OAAA;AAmBpD,MAAMY,sBAAsB,GAAIC,UAAkB,IAAK;EACrD,IACE,aAAa,IAAIA,UAAU,IAC3BA,UAAU,CAACC,WAAW,YAAYC,kBAAS,EAC3C;IACA,OAAO;MACL,GAAGF,UAAU;MACbG,aAAa,EAAGC,QAAwB,IAAqB;QAC3D,IAAIA,QAAQ,YAAYF,kBAAS,EAAE;UACjC;UACA,MAAMG,WAAsB,GAAGL,UAAU,CAACC,WAAW,CAACK,KAAK,CAAC,CAAC;UAC7DD,WAAW,CAACE,MAAM,CAACH,QAAQ,CAAC;UAC5B,OAAOC,WAAW;QACpB;QACA,OAAOD,QAAQ;MACjB;IACF,CAAC;EACH;EAEA,OAAOJ,UAAU;AACnB,CAAC;;AAED;AACA;AACA;AACA,MAAMQ,kBAAkB,GAAGA,CACzBC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AAME,QAAuB,GAAG;QAC9BV,QAAQ;QACR,CAACnB,QAAQ,IAAI,MAAM,GAAGe,KAAK;QAC3BN,QAAQ;QACRqB,MAAM,EAAEb,UAAU,EAAEa,MAAM,IAAI,IAAI;QAClCC,gBAAgB,EAAEd,UAAU,EAAEc,gBAAgB,IAAI,IAAI;QACtDC,QAAQ,EAAEC,OAAO,CAAClB,KAAK,CAAC;QACxBJ,MAAM;QACNuB,cAAc,EAAEb,WAAW;QAC3BO,WAAW,EAAEH;MACf,CAAC;MAED,oBAAO,IAAAvC,WAAA,CAAAiD,GAAA,EAAChC,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMwB;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDzB,gBAAgB,CAACgC,WAAW,GAAG,gBAAgB,IAAAC,qBAAc,EAAClC,SAAS,EAAEN,IAAI,CAAC,GAAG;IACjF,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa5C,kBAAkB","ignoreList":[]}
|
|
@@ -7,30 +7,35 @@ exports.withQuerystring = exports.withPathname = exports.withNavigation = export
|
|
|
7
7
|
var _reactRedux = require("react-redux");
|
|
8
8
|
var _RouterActions = require("./RouterActions");
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useLocationKey' instead
|
|
10
11
|
*/
|
|
11
12
|
const withKey = exports.withKey = (0, _reactRedux.connect)(state => ({
|
|
12
13
|
locationKey: state.router.location?.key ?? ""
|
|
13
14
|
}));
|
|
14
15
|
|
|
15
16
|
/**
|
|
17
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'usePathname' instead
|
|
16
18
|
*/
|
|
17
19
|
const withPathname = exports.withPathname = (0, _reactRedux.connect)(state => ({
|
|
18
20
|
pathname: state.router.location?.pathname
|
|
19
21
|
}));
|
|
20
22
|
|
|
21
23
|
/**
|
|
24
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useLocation' instead
|
|
22
25
|
*/
|
|
23
26
|
const withLocation = exports.withLocation = (0, _reactRedux.connect)(state => ({
|
|
24
27
|
location: state.router.location
|
|
25
28
|
}));
|
|
26
29
|
|
|
27
30
|
/**
|
|
31
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useQuerystring' instead
|
|
28
32
|
*/
|
|
29
33
|
const withQuerystring = exports.withQuerystring = (0, _reactRedux.connect)(state => ({
|
|
30
34
|
querystring: state.router.location?.search
|
|
31
35
|
}));
|
|
32
36
|
|
|
33
37
|
/**
|
|
38
|
+
* @deprecated - will be removed in the future, use the equivalent hook 'useNavigation' instead
|
|
34
39
|
*/
|
|
35
40
|
const withNavigation = exports.withNavigation = (0, _reactRedux.connect)(null, {
|
|
36
41
|
push: _RouterActions.push,
|