@beinformed/ui 1.57.5 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/esm/hooks/useModelCatalog.js +36 -5
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +1 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +1 -1
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/content/ContentModel.js +1 -1
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +1 -1
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/redux/actions/EntryDate.js +8 -0
- package/esm/redux/actions/EntryDate.js.map +1 -0
- package/esm/redux/actions/index.js +1 -0
- package/esm/redux/actions/index.js.map +1 -1
- package/esm/redux/reducers/ModelCatalogReducer.js +36 -0
- package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -0
- package/esm/redux/reducers/createReducer.js +2 -0
- package/esm/redux/reducers/createReducer.js.map +1 -1
- package/esm/redux/reducers/index.js +1 -0
- package/esm/redux/reducers/index.js.map +1 -1
- package/esm/redux/selectors/index.js +1 -0
- package/esm/redux/selectors/index.js.map +1 -1
- package/esm/redux/selectors/modelcatalog.js +8 -0
- package/esm/redux/selectors/modelcatalog.js.map +1 -0
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/helpers/createHref.js +10 -7
- package/esm/utils/helpers/createHref.js.map +1 -1
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +7 -6
- package/lib/hooks/useModelCatalog.js +38 -6
- package/lib/hooks/useModelCatalog.js.flow +39 -5
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.flow +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.flow +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +1 -1
- package/lib/models/content/ContentModel.js.flow +1 -1
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +1 -1
- package/lib/models/content/ContentTOCModel.js.flow +1 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/redux/actions/EntryDate.js +15 -0
- package/lib/redux/actions/EntryDate.js.flow +12 -0
- package/lib/redux/actions/EntryDate.js.map +1 -0
- package/lib/redux/actions/index.js +11 -0
- package/lib/redux/actions/index.js.flow +1 -0
- package/lib/redux/actions/index.js.map +1 -1
- package/lib/redux/reducers/ModelCatalogReducer.js +43 -0
- package/lib/redux/reducers/ModelCatalogReducer.js.flow +46 -0
- package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -0
- package/lib/redux/reducers/createReducer.js +2 -0
- package/lib/redux/reducers/createReducer.js.flow +4 -0
- package/lib/redux/reducers/createReducer.js.map +1 -1
- package/lib/redux/reducers/index.js +8 -0
- package/lib/redux/reducers/index.js.flow +1 -0
- package/lib/redux/reducers/index.js.map +1 -1
- package/lib/redux/selectors/index.js +11 -0
- package/lib/redux/selectors/index.js.flow +1 -0
- package/lib/redux/selectors/index.js.map +1 -1
- package/lib/redux/selectors/modelcatalog.js +15 -0
- package/lib/redux/selectors/modelcatalog.js.flow +11 -0
- package/lib/redux/selectors/modelcatalog.js.map +1 -0
- package/lib/redux/types.js.flow +11 -0
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/helpers/__tests__/createHref.spec.js.flow +13 -9
- package/lib/utils/helpers/createHref.js +10 -7
- package/lib/utils/helpers/createHref.js.flow +17 -9
- package/lib/utils/helpers/createHref.js.map +1 -1
- package/package.json +8 -8
- package/src/hooks/__tests__/useModelCatalog.spec.js +7 -6
- package/src/hooks/useModelCatalog.js +39 -5
- package/src/models/concepts/ConceptDetailModel.js +1 -1
- package/src/models/concepts/ConceptIndexModel.js +1 -1
- package/src/models/content/ContentModel.js +1 -1
- package/src/models/content/ContentTOCModel.js +1 -1
- package/src/redux/actions/EntryDate.js +12 -0
- package/src/redux/actions/index.js +1 -0
- package/src/redux/reducers/ModelCatalogReducer.js +46 -0
- package/src/redux/reducers/createReducer.js +4 -0
- package/src/redux/reducers/index.js +1 -0
- package/src/redux/selectors/index.js +1 -0
- package/src/redux/selectors/modelcatalog.js +11 -0
- package/src/redux/types.js +11 -0
- package/src/utils/helpers/__tests__/createHref.spec.js +13 -9
- package/src/utils/helpers/createHref.js +17 -9
- package/types/models/concepts/ConceptDetailModel.d.ts +1 -1
- package/types/models/concepts/ConceptIndexModel.d.ts +1 -1
- package/types/models/content/ContentModel.d.ts +1 -1
- package/types/models/content/ContentTOCModel.d.ts +1 -1
|
@@ -7,25 +7,29 @@ describe("createHref", () => {
|
|
|
7
7
|
const location = {
|
|
8
8
|
search: "?entryDate=2024-03-08&index=C¬Allowed=true",
|
|
9
9
|
};
|
|
10
|
+
const expectedSearch = "?index=C¬Allowed=true&entryDate=2010-01-01";
|
|
10
11
|
|
|
11
12
|
expect(createHref("concepts", dynamicPart)).toEqual(
|
|
12
13
|
new Href("/concepts/" + dynamicPart),
|
|
13
14
|
);
|
|
14
|
-
expect(createHref("concepts", dynamicPart, location)).toEqual(
|
|
15
|
-
new Href("/concepts/" + dynamicPart +
|
|
15
|
+
expect(createHref("concepts", dynamicPart, "2010-01-01", location)).toEqual(
|
|
16
|
+
new Href("/concepts/" + dynamicPart + expectedSearch),
|
|
16
17
|
);
|
|
17
18
|
expect(
|
|
18
|
-
createHref("concepts", dynamicPart, location, ["
|
|
19
|
+
createHref("concepts", dynamicPart, "2010-01-01", location, ["index"]),
|
|
19
20
|
).toEqual(
|
|
20
|
-
new Href("/concepts/" + dynamicPart + "?entryDate=
|
|
21
|
+
new Href("/concepts/" + dynamicPart + "?index=C&entryDate=2010-01-01"),
|
|
21
22
|
);
|
|
22
23
|
expect(
|
|
23
|
-
createHref(
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
createHref(
|
|
25
|
+
"concepts",
|
|
26
|
+
dynamicPart + location.search,
|
|
27
|
+
"2010-01-01",
|
|
28
|
+
location,
|
|
29
|
+
["index"],
|
|
30
|
+
),
|
|
27
31
|
).toEqual(
|
|
28
|
-
new Href("/concepts/" + dynamicPart + "?entryDate=
|
|
32
|
+
new Href("/concepts/" + dynamicPart + "?index=C&entryDate=2010-01-01"),
|
|
29
33
|
);
|
|
30
34
|
|
|
31
35
|
expect(createHref("concepts", dynamicPart + "#hash")).toEqual(
|
|
@@ -75,7 +75,7 @@ const filterParameters = (href, allowedParameters) => {
|
|
|
75
75
|
/**
|
|
76
76
|
*/
|
|
77
77
|
exports.filterParameters = filterParameters;
|
|
78
|
-
const createHref = (context, dynamicPart, location, allowedParameters) => {
|
|
78
|
+
const createHref = (context, dynamicPart, entryDate, location, allowedParameters) => {
|
|
79
79
|
let href = dynamicPart.toString();
|
|
80
80
|
if (!(0, _startsWith.default)(href).call(href, `/${context}/`)) {
|
|
81
81
|
href = `/${context}/${href}`;
|
|
@@ -86,13 +86,16 @@ const createHref = (context, dynamicPart, location, allowedParameters) => {
|
|
|
86
86
|
const search = (0, _startsWith.default)(_context = location.search).call(_context, "?") ? location.search.substring(1) : location.search;
|
|
87
87
|
href = `${href}?${search}`;
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
const finalHref = dynamicPart instanceof _Href.default ? filterParameters(new _Href.default(href, dynamicPart.resourcetype, {
|
|
90
|
+
origin: dynamicPart.origin,
|
|
91
|
+
contextPath: dynamicPart.contextPath
|
|
92
|
+
}), allowedParameters) : filterParameters(href, allowedParameters);
|
|
93
|
+
if (entryDate) {
|
|
94
|
+
finalHref.setParameter("entryDate", entryDate);
|
|
95
|
+
} else {
|
|
96
|
+
finalHref.removeParameter("entryDate");
|
|
94
97
|
}
|
|
95
|
-
return
|
|
98
|
+
return finalHref;
|
|
96
99
|
};
|
|
97
100
|
exports.createHref = createHref;
|
|
98
101
|
//# sourceMappingURL=createHref.js.map
|
|
@@ -77,6 +77,7 @@ export const filterParameters = (
|
|
|
77
77
|
export const createHref = (
|
|
78
78
|
context: string,
|
|
79
79
|
dynamicPart: string | Href,
|
|
80
|
+
entryDate?: ISO_DATE,
|
|
80
81
|
location?: ?Location,
|
|
81
82
|
allowedParameters?: Array<string>,
|
|
82
83
|
): Href => {
|
|
@@ -95,15 +96,22 @@ export const createHref = (
|
|
|
95
96
|
href = `${href}?${search}`;
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
const finalHref =
|
|
100
|
+
dynamicPart instanceof Href
|
|
101
|
+
? filterParameters(
|
|
102
|
+
new Href(href, dynamicPart.resourcetype, {
|
|
103
|
+
origin: dynamicPart.origin,
|
|
104
|
+
contextPath: dynamicPart.contextPath,
|
|
105
|
+
}),
|
|
106
|
+
allowedParameters,
|
|
107
|
+
)
|
|
108
|
+
: filterParameters(href, allowedParameters);
|
|
109
|
+
|
|
110
|
+
if (entryDate) {
|
|
111
|
+
finalHref.setParameter("entryDate", entryDate);
|
|
112
|
+
} else {
|
|
113
|
+
finalHref.removeParameter("entryDate");
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
return
|
|
116
|
+
return finalHref;
|
|
109
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHref.js","names":["_Href","_interopRequireDefault","require","parseUrl","href","Href","path","querystring","hash","_includes","default","call","hashSplit","split","qsSplit","exports","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_urlSearchParams","params","_from","_keys","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","location","_startsWith","replace","search","_context","substring"],"sources":["../../../src/utils/helpers/createHref.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const parseUrl = (\n href: string | Href,\n): { path: string, querystring: null | string, hash: null | string } => {\n if (href instanceof Href) {\n return {\n path: href.path,\n querystring: href.querystring,\n hash: href.hash,\n };\n }\n\n let path = href;\n let hash = null;\n let querystring = null;\n if (href.includes(\"#\")) {\n const hashSplit = href.split(\"#\");\n path = hashSplit[0];\n hash = hashSplit[1];\n }\n if (href.includes(\"?\")) {\n const qsSplit = path.split(\"?\");\n path = qsSplit[0];\n querystring = qsSplit[1];\n }\n return {\n path,\n querystring,\n hash,\n };\n};\n\n/**\n */\nexport const filterParameters = (\n href: string | Href,\n allowedParameters?: Array<string>,\n): Href => {\n if (!Array.isArray(allowedParameters)) {\n return new Href(href);\n }\n\n const url = parseUrl(href);\n let filteredUrl = url.path;\n if (url.querystring) {\n const searchParams = new URLSearchParams(url.querystring);\n const params = Array.from(searchParams.keys());\n for (const param of params) {\n if (!allowedParameters.includes(param)) {\n searchParams.delete(param);\n }\n }\n filteredUrl = filteredUrl + \"?\" + searchParams.toString();\n }\n if (url.hash) {\n filteredUrl = filteredUrl + \"#\" + url.hash;\n }\n\n if (href instanceof Href) {\n return new Href(filteredUrl, href.resourcetype, {\n origin: href.origin,\n contextPath: href.contextPath,\n });\n }\n\n return new Href(filteredUrl);\n};\n\n/**\n */\nexport const createHref = (\n context: string,\n dynamicPart: string | Href,\n location?: ?Location,\n allowedParameters?: Array<string>,\n): Href => {\n let href = dynamicPart.toString();\n\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search && !href.includes(\"?\")) {\n const search = location.search.startsWith(\"?\")\n ? location.search.substring(1)\n : location.search;\n href = `${href}?${search}`;\n }\n\n
|
|
1
|
+
{"version":3,"file":"createHref.js","names":["_Href","_interopRequireDefault","require","parseUrl","href","Href","path","querystring","hash","_includes","default","call","hashSplit","split","qsSplit","exports","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_urlSearchParams","params","_from","_keys","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","entryDate","location","_startsWith","replace","search","_context","substring","finalHref","setParameter","removeParameter"],"sources":["../../../src/utils/helpers/createHref.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const parseUrl = (\n href: string | Href,\n): { path: string, querystring: null | string, hash: null | string } => {\n if (href instanceof Href) {\n return {\n path: href.path,\n querystring: href.querystring,\n hash: href.hash,\n };\n }\n\n let path = href;\n let hash = null;\n let querystring = null;\n if (href.includes(\"#\")) {\n const hashSplit = href.split(\"#\");\n path = hashSplit[0];\n hash = hashSplit[1];\n }\n if (href.includes(\"?\")) {\n const qsSplit = path.split(\"?\");\n path = qsSplit[0];\n querystring = qsSplit[1];\n }\n return {\n path,\n querystring,\n hash,\n };\n};\n\n/**\n */\nexport const filterParameters = (\n href: string | Href,\n allowedParameters?: Array<string>,\n): Href => {\n if (!Array.isArray(allowedParameters)) {\n return new Href(href);\n }\n\n const url = parseUrl(href);\n let filteredUrl = url.path;\n if (url.querystring) {\n const searchParams = new URLSearchParams(url.querystring);\n const params = Array.from(searchParams.keys());\n for (const param of params) {\n if (!allowedParameters.includes(param)) {\n searchParams.delete(param);\n }\n }\n filteredUrl = filteredUrl + \"?\" + searchParams.toString();\n }\n if (url.hash) {\n filteredUrl = filteredUrl + \"#\" + url.hash;\n }\n\n if (href instanceof Href) {\n return new Href(filteredUrl, href.resourcetype, {\n origin: href.origin,\n contextPath: href.contextPath,\n });\n }\n\n return new Href(filteredUrl);\n};\n\n/**\n */\nexport const createHref = (\n context: string,\n dynamicPart: string | Href,\n entryDate?: ISO_DATE,\n location?: ?Location,\n allowedParameters?: Array<string>,\n): Href => {\n let href = dynamicPart.toString();\n\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search && !href.includes(\"?\")) {\n const search = location.search.startsWith(\"?\")\n ? location.search.substring(1)\n : location.search;\n href = `${href}?${search}`;\n }\n\n const finalHref =\n dynamicPart instanceof Href\n ? filterParameters(\n new Href(href, dynamicPart.resourcetype, {\n origin: dynamicPart.origin,\n contextPath: dynamicPart.contextPath,\n }),\n allowedParameters,\n )\n : filterParameters(href, allowedParameters);\n\n if (entryDate) {\n finalHref.setParameter(\"entryDate\", entryDate);\n } else {\n finalHref.removeParameter(\"entryDate\");\n }\n\n return finalHref;\n};\n"],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -108,10 +108,10 @@
|
|
|
108
108
|
"@babel/preset-env": "^7.26.0",
|
|
109
109
|
"@babel/preset-flow": "^7.25.9",
|
|
110
110
|
"@babel/preset-react": "^7.25.9",
|
|
111
|
-
"@commitlint/cli": "^19.
|
|
112
|
-
"@commitlint/config-conventional": "^19.
|
|
111
|
+
"@commitlint/cli": "^19.6.0",
|
|
112
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
113
113
|
"@testing-library/react": "^16.0.1",
|
|
114
|
-
"auditjs": "^4.0.
|
|
114
|
+
"auditjs": "^4.0.46",
|
|
115
115
|
"babel-jest": "^29.7.0",
|
|
116
116
|
"babel-plugin-styled-components": "^2.1.4",
|
|
117
117
|
"cherry-pick": "^0.5.0",
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
"eslint-plugin-babel": "^5.3.1",
|
|
124
124
|
"eslint-plugin-ft-flow": "^3.0.11",
|
|
125
125
|
"eslint-plugin-import": "^2.31.0",
|
|
126
|
-
"eslint-plugin-jest": "^28.
|
|
127
|
-
"eslint-plugin-jsdoc": "^50.
|
|
126
|
+
"eslint-plugin-jest": "^28.9.0",
|
|
127
|
+
"eslint-plugin-jsdoc": "^50.5.0",
|
|
128
128
|
"eslint-plugin-react": "^7.37.2",
|
|
129
129
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
130
130
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
|
|
@@ -133,12 +133,12 @@
|
|
|
133
133
|
"flow-typed": "^3.9.0",
|
|
134
134
|
"hermes-eslint": "^0.25.0",
|
|
135
135
|
"history": "^4.0.0",
|
|
136
|
-
"husky": "^9.1.
|
|
136
|
+
"husky": "^9.1.7",
|
|
137
137
|
"jest": "^29.7.0",
|
|
138
138
|
"jest-environment-jsdom": "^29.7.0",
|
|
139
139
|
"jest-junit": "^16.0.0",
|
|
140
140
|
"jest-sonar-reporter": "^2.0.0",
|
|
141
|
-
"jscodeshift": "^17.
|
|
141
|
+
"jscodeshift": "^17.1.1",
|
|
142
142
|
"lint-staged": "^15.2.10",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
144
|
"prettier": "^3.3.3",
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
useModelCatalog,
|
|
24
24
|
useContentType,
|
|
25
25
|
} from "../useModelCatalog";
|
|
26
|
+
import { DateUtil } from "../../utils";
|
|
26
27
|
|
|
27
28
|
const middlewares = [thunk];
|
|
28
29
|
const mockStore = configureMockStore(middlewares);
|
|
@@ -68,7 +69,7 @@ describe("modelcatalog hooks", () => {
|
|
|
68
69
|
{
|
|
69
70
|
type: "MODULARUI/FETCH",
|
|
70
71
|
payload: expect.objectContaining({
|
|
71
|
-
key: `${key}(${url})(en)`,
|
|
72
|
+
key: `${key}(${url.split("?")[0]})(en)`,
|
|
72
73
|
href: new Href(url),
|
|
73
74
|
locale: "en",
|
|
74
75
|
targetModel: targetModel,
|
|
@@ -106,7 +107,7 @@ describe("modelcatalog hooks", () => {
|
|
|
106
107
|
assertTargetModel(
|
|
107
108
|
() => useConceptIndex("/conceptindex"),
|
|
108
109
|
"conceptindex",
|
|
109
|
-
"/conceptindex",
|
|
110
|
+
"/conceptindex?entryDate=" + DateUtil.now(),
|
|
110
111
|
ConceptIndexModel,
|
|
111
112
|
);
|
|
112
113
|
});
|
|
@@ -116,7 +117,7 @@ describe("modelcatalog hooks", () => {
|
|
|
116
117
|
assertTargetModel(
|
|
117
118
|
() => useConceptDetail("/conceptdetail"),
|
|
118
119
|
"conceptdetail",
|
|
119
|
-
"/concepts/conceptdetail",
|
|
120
|
+
"/concepts/conceptdetail?entryDate=" + DateUtil.now(),
|
|
120
121
|
);
|
|
121
122
|
});
|
|
122
123
|
|
|
@@ -135,7 +136,7 @@ describe("modelcatalog hooks", () => {
|
|
|
135
136
|
assertTargetModel(
|
|
136
137
|
() => useContentTOC("/contenttoc"),
|
|
137
138
|
"contenttoc",
|
|
138
|
-
"/content/contenttoc",
|
|
139
|
+
"/content/contenttoc?entryDate=" + DateUtil.now(),
|
|
139
140
|
ContentTOCModel,
|
|
140
141
|
);
|
|
141
142
|
});
|
|
@@ -145,7 +146,7 @@ describe("modelcatalog hooks", () => {
|
|
|
145
146
|
assertTargetModel(
|
|
146
147
|
() => useContent("/contentdetail"),
|
|
147
148
|
"content",
|
|
148
|
-
"/content/contentdetail",
|
|
149
|
+
"/content/contentdetail?entryDate=" + DateUtil.now(),
|
|
149
150
|
ContentModel,
|
|
150
151
|
);
|
|
151
152
|
});
|
|
@@ -155,7 +156,7 @@ describe("modelcatalog hooks", () => {
|
|
|
155
156
|
assertTargetModel(
|
|
156
157
|
() => useContentType("/contenttypes/contenttype"),
|
|
157
158
|
"contenttypes",
|
|
158
|
-
"/contenttypes/contenttype",
|
|
159
|
+
"/contenttypes/contenttype?entryDate=" + DateUtil.now(),
|
|
159
160
|
ContentTypeModel,
|
|
160
161
|
);
|
|
161
162
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
+
import { useSelector, useDispatch } from "react-redux";
|
|
2
3
|
import { useLocation } from "./useRouter";
|
|
3
4
|
|
|
4
5
|
import { createHref, filterParameters } from "../utils/helpers/createHref";
|
|
@@ -14,8 +15,12 @@ import ContentModel from "../models/content/ContentModel";
|
|
|
14
15
|
import { useModularUIBasic } from "./useModularUIBasic";
|
|
15
16
|
import { ContentTypeModel } from "../models";
|
|
16
17
|
|
|
18
|
+
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
19
|
+
import { updateEntryDate } from "../redux/actions/EntryDate";
|
|
20
|
+
|
|
17
21
|
import type Href from "../models/href/Href";
|
|
18
22
|
import type { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
23
|
+
import type { UpdateEntryDateAction } from "../redux";
|
|
19
24
|
export type SearchFilter = {
|
|
20
25
|
index?: string,
|
|
21
26
|
label?: string,
|
|
@@ -42,13 +47,15 @@ export const useConceptIndex = (
|
|
|
42
47
|
key?: string = "conceptindex",
|
|
43
48
|
options?: UseModularUIBasicOptions<ConceptIndexModel>,
|
|
44
49
|
): ?ConceptIndexModel => {
|
|
50
|
+
const { entryDate } = useEntryDate();
|
|
45
51
|
const url = filterParameters(href, [
|
|
46
|
-
"entryDate",
|
|
47
52
|
"index",
|
|
48
53
|
"label",
|
|
49
54
|
"modelcategory",
|
|
50
55
|
"type",
|
|
51
56
|
]);
|
|
57
|
+
url.setParameter("entryDate", entryDate);
|
|
58
|
+
|
|
52
59
|
return useModularUIBasic(key, url, {
|
|
53
60
|
expectedModels: ["ConceptIndex"],
|
|
54
61
|
targetModel: ConceptIndexModel,
|
|
@@ -65,9 +72,11 @@ export const useConceptDetail = (
|
|
|
65
72
|
ConceptDetailModel | BusinessScenarioModel,
|
|
66
73
|
>,
|
|
67
74
|
): ?ConceptDetailModel | ?BusinessScenarioModel => {
|
|
75
|
+
const { entryDate } = useEntryDate();
|
|
68
76
|
const location = useLocation();
|
|
69
77
|
|
|
70
|
-
const href = createHref("concepts", concept, location, [
|
|
78
|
+
const href = createHref("concepts", concept, entryDate, location, []);
|
|
79
|
+
|
|
71
80
|
return useModularUIBasic(key, href, {
|
|
72
81
|
expectedModels: ["ConceptDetail", "BusinessScenario"],
|
|
73
82
|
...options,
|
|
@@ -96,8 +105,11 @@ export const useContentTOC = (
|
|
|
96
105
|
key?: string = "contenttoc",
|
|
97
106
|
options?: UseModularUIBasicOptions<ContentTOCModel>,
|
|
98
107
|
): ?ContentTOCModel => {
|
|
108
|
+
const { entryDate } = useEntryDate();
|
|
99
109
|
const location = useLocation();
|
|
100
|
-
|
|
110
|
+
|
|
111
|
+
const href = createHref("content", content, entryDate, location, []);
|
|
112
|
+
|
|
101
113
|
return useModularUIBasic(key, href, {
|
|
102
114
|
expectedModels: ["ContentTOC"],
|
|
103
115
|
targetModel: ContentTOCModel,
|
|
@@ -112,7 +124,10 @@ export const useContent = (
|
|
|
112
124
|
key?: string = "content",
|
|
113
125
|
options?: UseModularUIBasicOptions<ContentModel>,
|
|
114
126
|
): ?ContentModel => {
|
|
115
|
-
const
|
|
127
|
+
const { entryDate } = useEntryDate();
|
|
128
|
+
|
|
129
|
+
const href = createHref("content", contentSection, entryDate, null, []);
|
|
130
|
+
|
|
116
131
|
return useModularUIBasic(key, href, {
|
|
117
132
|
expectedModels: ["Content"],
|
|
118
133
|
targetModel: ContentModel,
|
|
@@ -127,7 +142,10 @@ export const useContentType = (
|
|
|
127
142
|
key?: string = "contenttypes",
|
|
128
143
|
options?: UseModularUIBasicOptions<ContentTypeModel>,
|
|
129
144
|
): ?ContentTypeModel => {
|
|
130
|
-
const
|
|
145
|
+
const { entryDate } = useEntryDate();
|
|
146
|
+
|
|
147
|
+
const href = createHref("contenttypes", contentType, entryDate, null, []);
|
|
148
|
+
|
|
131
149
|
return useModularUIBasic(key, href, {
|
|
132
150
|
expectedModels: ["ContentType"],
|
|
133
151
|
targetModel: ContentTypeModel,
|
|
@@ -177,3 +195,19 @@ export const useContentSearch = (
|
|
|
177
195
|
const href = getSearchHref("/content", filters);
|
|
178
196
|
return useContentIndex(href, key, options);
|
|
179
197
|
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Retrieve and update the entrydate for the modelcatalog
|
|
201
|
+
*/
|
|
202
|
+
export const useEntryDate = (): ({
|
|
203
|
+
entryDate: ISO_DATE,
|
|
204
|
+
setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,
|
|
205
|
+
}) => {
|
|
206
|
+
const dispatch = useDispatch();
|
|
207
|
+
const entryDate = useSelector(getEntryDate);
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
entryDate,
|
|
211
|
+
setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),
|
|
212
|
+
};
|
|
213
|
+
};
|
|
@@ -328,7 +328,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/**
|
|
331
|
-
* Retrieve
|
|
331
|
+
* Retrieve modelcatalog.js
|
|
332
332
|
*/
|
|
333
333
|
get entryDate(): string | null {
|
|
334
334
|
return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;
|
|
@@ -125,7 +125,7 @@ export default class ConceptIndexModel extends ResourceModel {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Retrieve
|
|
128
|
+
* Retrieve modelcatalog.js of content toc
|
|
129
129
|
*/
|
|
130
130
|
get entryDate(): string | null {
|
|
131
131
|
const timeversionFilter = this.filterCollection.getFilterByAttributeKey(
|
|
@@ -104,7 +104,7 @@ export default class ContentModel extends ResourceModel {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Retrieve
|
|
107
|
+
* Retrieve modelcatalog.js of content toc
|
|
108
108
|
*/
|
|
109
109
|
get entryDate(): ISO_DATE | null {
|
|
110
110
|
const entryDateFilter = this.filterCollection?.getFilterByAttributeKey(
|
|
@@ -173,7 +173,7 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
* Retrieve
|
|
176
|
+
* Retrieve modelcatalog.js of content toc
|
|
177
177
|
*/
|
|
178
178
|
get entryDate(): ISO_DATE | null {
|
|
179
179
|
const timeversionFilter = this.filterCollection.getFilterByAttributeKey(
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import type { UpdateEntryDateAction } from "../types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Update the entry date being used in the modelcatalog
|
|
6
|
+
*/
|
|
7
|
+
export const updateEntryDate = (
|
|
8
|
+
entryDate: ISO_DATE,
|
|
9
|
+
): UpdateEntryDateAction => ({
|
|
10
|
+
type: "UPDATE_ENTRYDATE",
|
|
11
|
+
payload: entryDate,
|
|
12
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { DateUtil } from "../../utils";
|
|
3
|
+
import Cache from "../../utils/browser/Cache";
|
|
4
|
+
|
|
5
|
+
import type { Reducer } from "redux";
|
|
6
|
+
import type { ReduxAction, ModelCatalogState } from "../types";
|
|
7
|
+
|
|
8
|
+
const getQueryParam = (paramName: string): ?string => {
|
|
9
|
+
if (typeof window !== "undefined") {
|
|
10
|
+
const urlParams = new URLSearchParams(window.location?.search);
|
|
11
|
+
return urlParams.get(paramName);
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const initialState: ModelCatalogState = {
|
|
17
|
+
entryDate:
|
|
18
|
+
getQueryParam("entryDate") ||
|
|
19
|
+
Cache.getItem("ModelCatalogEntryDate") ||
|
|
20
|
+
DateUtil.now(),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Keep track of the entry date for the modelcatalog
|
|
25
|
+
*/
|
|
26
|
+
const ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (
|
|
27
|
+
state = initialState,
|
|
28
|
+
action,
|
|
29
|
+
) => {
|
|
30
|
+
if (!action) {
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
switch (action.type) {
|
|
35
|
+
case "UPDATE_ENTRYDATE":
|
|
36
|
+
Cache.addItem("ModelCatalogEntryDate", action.payload);
|
|
37
|
+
return {
|
|
38
|
+
...state,
|
|
39
|
+
entryDate: action.payload,
|
|
40
|
+
};
|
|
41
|
+
default:
|
|
42
|
+
return state;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default ModelCatalogReducer;
|
|
@@ -6,6 +6,7 @@ import { I18nReducer } from "../_i18n/I18nReducer";
|
|
|
6
6
|
import ModalsReducer from "./ModalsReducer";
|
|
7
7
|
import AuthReducer from "./AuthReducer";
|
|
8
8
|
import ErrorReducer from "./ErrorReducer";
|
|
9
|
+
import ModelCatalogReducer from "./ModelCatalogReducer";
|
|
9
10
|
import NotificationReducer from "./NotificationReducer";
|
|
10
11
|
import ProgressIndicatorReducer from "./ProgressIndicatorReducer";
|
|
11
12
|
import PreferencesReducer from "./PreferencesReducer";
|
|
@@ -19,6 +20,7 @@ import type {
|
|
|
19
20
|
ModalsState,
|
|
20
21
|
ErrorState,
|
|
21
22
|
AuthState,
|
|
23
|
+
ModelCatalogState,
|
|
22
24
|
} from "../types";
|
|
23
25
|
import type { RouterState } from "../_router/types";
|
|
24
26
|
import type { ModularUIState } from "../_modularui/types";
|
|
@@ -29,6 +31,7 @@ type Reducers = {
|
|
|
29
31
|
error: Reducer<ErrorState, ReduxAction>,
|
|
30
32
|
i18n: Reducer<I18nState, ReduxAction>,
|
|
31
33
|
modals: Reducer<ModalsState, ReduxAction>,
|
|
34
|
+
modelcatalog: Reducer<ModelCatalogState, ReduxAction>,
|
|
32
35
|
modularui: Reducer<ModularUIState, ReduxAction>,
|
|
33
36
|
notification: Reducer<NotificationState, ReduxAction>,
|
|
34
37
|
preferences: Reducer<PreferencesState, ReduxAction>,
|
|
@@ -45,6 +48,7 @@ export const createReducer = (): Reducers => ({
|
|
|
45
48
|
auth: AuthReducer,
|
|
46
49
|
error: ErrorReducer,
|
|
47
50
|
modals: ModalsReducer,
|
|
51
|
+
modelcatalog: ModelCatalogReducer,
|
|
48
52
|
notification: NotificationReducer,
|
|
49
53
|
progressindicator: ProgressIndicatorReducer,
|
|
50
54
|
preferences: PreferencesReducer,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export * from "./createReducer";
|
|
3
3
|
|
|
4
4
|
export { default as AuthReducer } from "./AuthReducer";
|
|
5
|
+
export { default as ModelCatalogReducer } from "./ModelCatalogReducer";
|
|
5
6
|
export { default as ErrorReducer } from "./ErrorReducer";
|
|
6
7
|
export { default as ModalsReducer } from "./ModalsReducer";
|
|
7
8
|
export { default as NotificationReducer } from "./NotificationReducer";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { DateUtil } from "../../utils";
|
|
3
|
+
|
|
4
|
+
import type { ReduxState } from "../types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Retrieve entrydate for the model catalog
|
|
8
|
+
*/
|
|
9
|
+
export const getEntryDate = (state: ReduxState): ISO_DATE => {
|
|
10
|
+
return state.modelcatalog?.entryDate ?? DateUtil.now();
|
|
11
|
+
};
|
package/src/redux/types.js
CHANGED
|
@@ -135,6 +135,11 @@ export type UpdateAutosaveAction = {
|
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
export type UpdateEntryDateAction = {
|
|
139
|
+
type: "UPDATE_ENTRYDATE",
|
|
140
|
+
payload: ISO_DATE,
|
|
141
|
+
};
|
|
142
|
+
|
|
138
143
|
export type ReduxAction =
|
|
139
144
|
| UpdateStatusAction
|
|
140
145
|
| SetModelAction
|
|
@@ -162,6 +167,7 @@ export type ReduxAction =
|
|
|
162
167
|
| ChangePasswordAction
|
|
163
168
|
| LogoutSuccessAction
|
|
164
169
|
| UpdateAutosaveAction
|
|
170
|
+
| UpdateEntryDateAction
|
|
165
171
|
| LocationChangeAction
|
|
166
172
|
| PushAction
|
|
167
173
|
| ReplaceAction
|
|
@@ -206,11 +212,16 @@ export type ProgressIndicatorState = {
|
|
|
206
212
|
+percentComplete: number,
|
|
207
213
|
};
|
|
208
214
|
|
|
215
|
+
export type ModelCatalogState = {
|
|
216
|
+
entryDate: ISO_DATE,
|
|
217
|
+
};
|
|
218
|
+
|
|
209
219
|
export type ReduxState = {
|
|
210
220
|
+router: RouterState,
|
|
211
221
|
+modularui: ModularUIState,
|
|
212
222
|
+i18n: I18nState,
|
|
213
223
|
+auth: AuthState,
|
|
224
|
+
+modelcatalog: ModelCatalogState,
|
|
214
225
|
+error: ErrorState,
|
|
215
226
|
+modals: ModalsState,
|
|
216
227
|
+notification: NotificationState,
|
|
@@ -7,25 +7,29 @@ describe("createHref", () => {
|
|
|
7
7
|
const location = {
|
|
8
8
|
search: "?entryDate=2024-03-08&index=C¬Allowed=true",
|
|
9
9
|
};
|
|
10
|
+
const expectedSearch = "?index=C¬Allowed=true&entryDate=2010-01-01";
|
|
10
11
|
|
|
11
12
|
expect(createHref("concepts", dynamicPart)).toEqual(
|
|
12
13
|
new Href("/concepts/" + dynamicPart),
|
|
13
14
|
);
|
|
14
|
-
expect(createHref("concepts", dynamicPart, location)).toEqual(
|
|
15
|
-
new Href("/concepts/" + dynamicPart +
|
|
15
|
+
expect(createHref("concepts", dynamicPart, "2010-01-01", location)).toEqual(
|
|
16
|
+
new Href("/concepts/" + dynamicPart + expectedSearch),
|
|
16
17
|
);
|
|
17
18
|
expect(
|
|
18
|
-
createHref("concepts", dynamicPart, location, ["
|
|
19
|
+
createHref("concepts", dynamicPart, "2010-01-01", location, ["index"]),
|
|
19
20
|
).toEqual(
|
|
20
|
-
new Href("/concepts/" + dynamicPart + "?entryDate=
|
|
21
|
+
new Href("/concepts/" + dynamicPart + "?index=C&entryDate=2010-01-01"),
|
|
21
22
|
);
|
|
22
23
|
expect(
|
|
23
|
-
createHref(
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
createHref(
|
|
25
|
+
"concepts",
|
|
26
|
+
dynamicPart + location.search,
|
|
27
|
+
"2010-01-01",
|
|
28
|
+
location,
|
|
29
|
+
["index"],
|
|
30
|
+
),
|
|
27
31
|
).toEqual(
|
|
28
|
-
new Href("/concepts/" + dynamicPart + "?entryDate=
|
|
32
|
+
new Href("/concepts/" + dynamicPart + "?index=C&entryDate=2010-01-01"),
|
|
29
33
|
);
|
|
30
34
|
|
|
31
35
|
expect(createHref("concepts", dynamicPart + "#hash")).toEqual(
|
|
@@ -77,6 +77,7 @@ export const filterParameters = (
|
|
|
77
77
|
export const createHref = (
|
|
78
78
|
context: string,
|
|
79
79
|
dynamicPart: string | Href,
|
|
80
|
+
entryDate?: ISO_DATE,
|
|
80
81
|
location?: ?Location,
|
|
81
82
|
allowedParameters?: Array<string>,
|
|
82
83
|
): Href => {
|
|
@@ -95,15 +96,22 @@ export const createHref = (
|
|
|
95
96
|
href = `${href}?${search}`;
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
const finalHref =
|
|
100
|
+
dynamicPart instanceof Href
|
|
101
|
+
? filterParameters(
|
|
102
|
+
new Href(href, dynamicPart.resourcetype, {
|
|
103
|
+
origin: dynamicPart.origin,
|
|
104
|
+
contextPath: dynamicPart.contextPath,
|
|
105
|
+
}),
|
|
106
|
+
allowedParameters,
|
|
107
|
+
)
|
|
108
|
+
: filterParameters(href, allowedParameters);
|
|
109
|
+
|
|
110
|
+
if (entryDate) {
|
|
111
|
+
finalHref.setParameter("entryDate", entryDate);
|
|
112
|
+
} else {
|
|
113
|
+
finalHref.removeParameter("entryDate");
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
return
|
|
116
|
+
return finalHref;
|
|
109
117
|
};
|
|
@@ -60,7 +60,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
60
60
|
*/
|
|
61
61
|
getSourceReferencesForCurrentLanguage(availableLocales: Array<string>): Array<Object>;
|
|
62
62
|
/**
|
|
63
|
-
* Retrieve
|
|
63
|
+
* Retrieve modelcatalog.js
|
|
64
64
|
*/
|
|
65
65
|
get entryDate(): string;
|
|
66
66
|
/**
|