@beinformed/ui 1.62.5 → 1.62.7
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 +14 -0
- package/esm/hooks/useModelCatalog.d.ts +1 -0
- package/esm/hooks/useModelCatalog.js +17 -0
- package/esm/hooks/useModelCatalog.js.flow +18 -0
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +3 -2
- package/esm/models/list/ListDetailModel.js.flow +5 -5
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/lib/hooks/useModelCatalog.d.ts +1 -0
- package/lib/hooks/useModelCatalog.js +19 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/models/list/ListDetailModel.js +3 -2
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useModelCatalog.js +18 -0
- package/src/models/list/ListDetailModel.js +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.62.7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.6...v1.62.7) (2025-06-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **list-detail-model:** improve isApplicableModel to be case insensitive ([bc6f88d](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/bc6f88d6a22dfd95d20ad79b1530bc3024651752))
|
|
11
|
+
|
|
12
|
+
## [1.62.6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.5...v1.62.6) (2025-06-10)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **related-concepts:** add separate hook for related concepts ([defcc40](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/defcc4088819564bdcc89bebdb78ca68b2be916a))
|
|
18
|
+
|
|
5
19
|
## [1.62.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.4...v1.62.5) (2025-06-06)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -19,6 +19,7 @@ export function useEntryDate(): ({
|
|
|
19
19
|
entryDate: ISO_DATE;
|
|
20
20
|
setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction;
|
|
21
21
|
});
|
|
22
|
+
export function useRelatedConcepts(href: string | Href, key?: string, options?: UseModularUIBasicOptions<ConceptIndexModel>): ConceptIndexModel | null;
|
|
22
23
|
import { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
23
24
|
import ModelCatalogModel from "../models/modelcatalog/ModelCatalogModel";
|
|
24
25
|
import Href from "../models/href/Href";
|
|
@@ -179,4 +179,21 @@ export const useEntryDate = () => {
|
|
|
179
179
|
setEntryDate: entryDate => dispatch(updateEntryDate(entryDate))
|
|
180
180
|
};
|
|
181
181
|
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
*/
|
|
185
|
+
export const useRelatedConcepts = function (href) {
|
|
186
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "relatedconcepts";
|
|
187
|
+
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
188
|
+
const {
|
|
189
|
+
entryDate
|
|
190
|
+
} = useEntryDate();
|
|
191
|
+
const url = filterParameters(href, ["modelcategory"]);
|
|
192
|
+
url.setParameter("entryDate", entryDate);
|
|
193
|
+
return useModularUIBasic(key, url, {
|
|
194
|
+
expectedModels: ["ConceptIndex"],
|
|
195
|
+
targetModel: ConceptIndexModel,
|
|
196
|
+
...options
|
|
197
|
+
});
|
|
198
|
+
};
|
|
182
199
|
//# sourceMappingURL=useModelCatalog.js.map
|
|
@@ -236,3 +236,21 @@ export const useEntryDate = (): ({
|
|
|
236
236
|
setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),
|
|
237
237
|
};
|
|
238
238
|
};
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
*/
|
|
242
|
+
export const useRelatedConcepts = (
|
|
243
|
+
href: string | Href,
|
|
244
|
+
key?: string = "relatedconcepts",
|
|
245
|
+
options?: UseModularUIBasicOptions<ConceptIndexModel>,
|
|
246
|
+
): ?ConceptIndexModel => {
|
|
247
|
+
const { entryDate } = useEntryDate();
|
|
248
|
+
const url = filterParameters(href, ["modelcategory"]);
|
|
249
|
+
url.setParameter("entryDate", entryDate);
|
|
250
|
+
|
|
251
|
+
return useModularUIBasic(key, url, {
|
|
252
|
+
expectedModels: ["ConceptIndex"],
|
|
253
|
+
targetModel: ConceptIndexModel,
|
|
254
|
+
...options,
|
|
255
|
+
});
|
|
256
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["useSelector","useDispatch","useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","getEntryDate","updateEntryDate","Href","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","setParameter","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","useCompleteSource","contentHref","removeParameter","addParameter","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","setEntryDate"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAI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C,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOZ,eAAe,CAACZ,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMU,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAM8B,QAAQ,GAAG1D,WAAW,CAAC,CAAC;EAC9B,MAAM2B,SAAS,GAAG5B,WAAW,CAACe,YAAY,CAAC;EAE3C,OAAO;IACLa,SAAS;IACTgC,YAAY,EAAGhC,SAAmB,IAAK+B,QAAQ,CAAC3C,eAAe,CAACY,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useModelCatalog.js","names":["useSelector","useDispatch","useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","getEntryDate","updateEntryDate","Href","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","setParameter","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","useCompleteSource","contentHref","removeParameter","addParameter","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","setEntryDate","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,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
|
|
75
75
|
static isApplicableModel(data) {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
let resourcetype = data.contributions?.resourcetype ?? "unknown";
|
|
77
|
+
resourcetype = resourcetype.toLowerCase();
|
|
78
|
+
return _endsWithInstanceProperty(resourcetype).call(resourcetype, "listdetail") || _endsWithInstanceProperty(resourcetype).call(resourcetype, "listpaneldetail") || _endsWithInstanceProperty(resourcetype).call(resourcetype, "datastorepaneldetail");
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
/**
|
|
@@ -93,13 +93,13 @@ export default class ListDetailModel extends DetailModel {
|
|
|
93
93
|
/**
|
|
94
94
|
*/
|
|
95
95
|
static isApplicableModel(data: ModularUIResponse): boolean {
|
|
96
|
-
|
|
96
|
+
let resourcetype = data.contributions?.resourcetype ?? "unknown";
|
|
97
|
+
resourcetype = resourcetype.toLowerCase();
|
|
97
98
|
|
|
98
99
|
return (
|
|
99
|
-
resourcetype.endsWith("
|
|
100
|
-
resourcetype.endsWith("
|
|
101
|
-
resourcetype
|
|
102
|
-
resourcetype === "CaseRelatedDataStorePanelDetail"
|
|
100
|
+
resourcetype.endsWith("listdetail") ||
|
|
101
|
+
resourcetype.endsWith("listpaneldetail") ||
|
|
102
|
+
resourcetype.endsWith("datastorepaneldetail")
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListDetailModel.js","names":["has","ActionCollection","DetailModel","ContentConfiguration","AttributeSetModel","createAttribute","CompositeAttributeModel","ListDetailModel","constructor","modularUIResponse","_defineProperty","_actionCollection","_contentConfiguration","contributions","content","setResultSection","setEventData","getInitialChildModelLinks","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","givenAnswers","setChildModels","models","errors","_attributeCollection","type","modelName","isApplicableModel","data","resourcetype","_endsWithInstanceProperty","call","_listitem","actionCollection","panelLinks","contentConfiguration","configuration","introtext","_content","text","message","Array","isArray","texts","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","_context","children","_filterInstanceProperty","child","childKey","_Object$keys","key","dynamicschema","isResult","indicateContentConfiguration","_results","_context2","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","hasEventData","eventdata","addAttributes","eventData","eventContributions","_eventdata","modelOptions","forEach","eventDataContribution","eventDataData","i"],"sources":["../../../src/models/list/ListDetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {},\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\n\n if (this.results) {\n this.results.setChildModels(models, errors);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models, errors);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ListDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._content) {\n return this.data._content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n },\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions,\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions,\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(\n key,\n eventData,\n eventContributions,\n this.modelOptions,\n ),\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,WAAW,MAAM,uBAAuB;AAC/C,OAAOC,oBAAoB,MAAM,8CAA8C;AAC/E,OAAOC,iBAAiB,MAAM,iCAAiC;AAE/D,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,uBAAuB,MAAM,uCAAuC;AAS3E;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASL,WAAW,CAAC;EAOvD;AACF;AACA;EACEM,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIV,gBAAgB,CAAC,CAAC;IAE/C,IAAI,CAACW,qBAAqB,GAAG,IAAIT,oBAAoB,CACnD,IAAI,CAACU,aAAa,GAAG,IAAI,CAACA,aAAa,CAACC,OAAO,GAAG,CAAC,CACrD,CAAC;IAED,IA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d,IAAI,CAACsC,SAAS,CAACX,GAAG,CAAC,CAAC,EAAE;YAC3C,IAAI,CAAC3B,IAAI,CAACsC,SAAS,CAACX,GAAG,CAAC,CAACiB,OAAO,CAAC,CAACE,aAAa,EAAEC,CAAC,KAAK;cACrD,IAAI,CAACR,aAAa,CAChB,GAAGZ,GAAG,IAAIoB,CAAC,GAAG,CAAC,EAAE,EACjB;gBACE,GAAGD,aAAa;gBAChBlB,aAAa,EAAE,IAAI,CAAC5B,IAAI,CAAC4B;cAC3B,CAAC,EACDiB,qBAAqB,CAAClB,GAAG,CAC3B,CAAC;YACH,CAAC,CAAC;UACJ,CAAC,MAAM;YACL,IAAI,CAACY,aAAa,CAChBZ,GAAG,EACH;cACE,GAAG,IAAI,CAAC3B,IAAI,CAACsC,SAAS,CAACX,GAAG,CAAC;cAC3BC,aAAa,EAAE,IAAI,CAAC5B,IAAI,CAAC4B;YAC3B,CAAC,EACDiB,qBAAqB,CAAClB,GAAG,CAC3B,CAAC;UACH;QACF;MACF,CAAC,CAAC;IACJ;EACF;;EAEA;AACF;EACE,IAAIW,SAASA,CAAA,EAA6B;IACxC,OAAO,IAAI,CAACI,UAAU;EACxB;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ListDetailModel.js","names":["has","ActionCollection","DetailModel","ContentConfiguration","AttributeSetModel","createAttribute","CompositeAttributeModel","ListDetailModel","constructor","modularUIResponse","_defineProperty","_actionCollection","_contentConfiguration","contributions","content","setResultSection","setEventData","getInitialChildModelLinks","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","givenAnswers","setChildModels","models","errors","_attributeCollection","type","modelName","isApplicableModel","data","resourcetype","toLowerCase","_endsWithInstanceProperty","call","_listitem","actionCollection","panelLinks","contentConfiguration","configuration","introtext","_content","text","message","Array","isArray","texts","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","_context","children","_filterInstanceProperty","child","childKey","_Object$keys","key","dynamicschema","isResult","indicateContentConfiguration","_results","_context2","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","hasEventData","eventdata","addAttributes","eventData","eventContributions","_eventdata","modelOptions","forEach","eventDataContribution","eventDataData","i"],"sources":["../../../src/models/list/ListDetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {},\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\n\n if (this.results) {\n this.results.setChildModels(models, errors);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models, errors);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ListDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n let resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n resourcetype = resourcetype.toLowerCase();\n\n return (\n resourcetype.endsWith(\"listdetail\") ||\n resourcetype.endsWith(\"listpaneldetail\") ||\n resourcetype.endsWith(\"datastorepaneldetail\")\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._content) {\n return this.data._content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n },\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions,\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions,\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(\n key,\n eventData,\n eventContributions,\n this.modelOptions,\n ),\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,WAAW,MAAM,uBAAuB;AAC/C,OAAOC,oBAAoB,MAAM,8CAA8C;AAC/E,OAAOC,iBAAiB,MAAM,iCAAiC;AAE/D,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,uBAAuB,MAAM,uCAAuC;AAS3E;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASL,WAAW,CAAC;EAOvD;AACF;AACA;EACEM,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIV,gBAAgB,CAAC,CAAC;IAE/C,IAAI,CAACW,qBAAqB,GAAG,IAAIT,oBAAoB,CACnD,IAAI,CAACU,aAAa,GAAG,IAAI,CAACA,aAAa,CAACC,OAAO,GAAG,CAAC,CACrD,CAAC;IAED,IAAI,CAACC,gBAAgB,CAAC,CAAC;IACvB,IAAI,CAACC,YAAY,CAAC,CAAC;EACrB;;EAEA;AACF;AACA;EACEC,yBAAyBA,CAAA,EAAqB;IAC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EAAE;YAC3C,IAAI,CAAC5B,IAAI,CAACuC,SAAS,CAACX,GAAG,CAAC,CAACiB,OAAO,CAAC,CAACE,aAAa,EAAEC,CAAC,KAAK;cACrD,IAAI,CAACR,aAAa,CAChB,GAAGZ,GAAG,IAAIoB,CAAC,GAAG,CAAC,EAAE,EACjB;gBACE,GAAGD,aAAa;gBAChBlB,aAAa,EAAE,IAAI,CAAC7B,IAAI,CAAC6B;cAC3B,CAAC,EACDiB,qBAAqB,CAAClB,GAAG,CAC3B,CAAC;YACH,CAAC,CAAC;UACJ,CAAC,MAAM;YACL,IAAI,CAACY,aAAa,CAChBZ,GAAG,EACH;cACE,GAAG,IAAI,CAAC5B,IAAI,CAACuC,SAAS,CAACX,GAAG,CAAC;cAC3BC,aAAa,EAAE,IAAI,CAAC7B,IAAI,CAAC6B;YAC3B,CAAC,EACDiB,qBAAqB,CAAClB,GAAG,CAC3B,CAAC;UACH;QACF;MACF,CAAC,CAAC;IACJ;EACF;;EAEA;AACF;EACE,IAAIW,SAASA,CAAA,EAA6B;IACxC,OAAO,IAAI,CAACI,UAAU;EACxB;AACF","ignoreList":[]}
|
|
@@ -19,6 +19,7 @@ export function useEntryDate(): ({
|
|
|
19
19
|
entryDate: ISO_DATE;
|
|
20
20
|
setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction;
|
|
21
21
|
});
|
|
22
|
+
export function useRelatedConcepts(href: string | Href, key?: string, options?: UseModularUIBasicOptions<ConceptIndexModel>): ConceptIndexModel | null;
|
|
22
23
|
import { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
23
24
|
import ModelCatalogModel from "../models/modelcatalog/ModelCatalogModel";
|
|
24
25
|
import Href from "../models/href/Href";
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useModelCatalog = exports.useEntryDate = exports.useContentType = exports.useContentTOC = exports.useContentSearch = exports.useContentIndex = exports.useContent = exports.useConceptSearch = exports.useConceptIndex = exports.useConceptDetail = exports.useCompleteSource = void 0;
|
|
7
|
+
exports.useRelatedConcepts = exports.useModelCatalog = exports.useEntryDate = exports.useContentType = exports.useContentTOC = exports.useContentSearch = exports.useContentIndex = exports.useContent = exports.useConceptSearch = exports.useConceptIndex = exports.useConceptDetail = exports.useCompleteSource = void 0;
|
|
8
8
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
9
9
|
var _reactRedux = require("react-redux");
|
|
10
10
|
var _useRouter = require("./useRouter");
|
|
@@ -196,5 +196,23 @@ const useEntryDate = () => {
|
|
|
196
196
|
setEntryDate: entryDate => dispatch((0, _ModelCatalog.updateEntryDate)(entryDate))
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
*/
|
|
199
202
|
exports.useEntryDate = useEntryDate;
|
|
203
|
+
const useRelatedConcepts = function (href) {
|
|
204
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "relatedconcepts";
|
|
205
|
+
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
206
|
+
const {
|
|
207
|
+
entryDate
|
|
208
|
+
} = useEntryDate();
|
|
209
|
+
const url = (0, _createHref.filterParameters)(href, ["modelcategory"]);
|
|
210
|
+
url.setParameter("entryDate", entryDate);
|
|
211
|
+
return (0, _useModularUIBasic.useModularUIBasic)(key, url, {
|
|
212
|
+
expectedModels: ["ConceptIndex"],
|
|
213
|
+
targetModel: _ConceptIndexModel.default,
|
|
214
|
+
...options
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
exports.useRelatedConcepts = useRelatedConcepts;
|
|
200
218
|
//# sourceMappingURL=useModelCatalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","_Href","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","removeParameter","addParameter","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","updateEntryDate"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,mBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,sBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,kBAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AACA,IAAAS,gBAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,aAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAEA,IAAAW,kBAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAEA,IAAAa,aAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAEA,IAAAe,KAAA,GAAAX,sBAAA,CAAAJ,OAAA;AAWA;AACA;AACO,MAAMgB,eAAe,GAC1BC,OAAqD,IAErD,IAAAC,oCAAiB,EAAC,cAAc,EAAE,eAAe,EAAE;EACjDC,cAAc,EAAE,CAAC,cAAc,CAAC;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AAU,EAAEE,OAAO,CAAC;EAC/C,OAAOhB,eAAe,CAAChB,IAAI,EAAEC,GAAG,EAAER,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AAFAK,OAAA,CAAA8C,gBAAA,GAAAA,gBAAA;AAGO,MAAMtC,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAMuC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAMzC,SAAS,GAAG,IAAA0C,uBAAW,EAACC,0BAAY,CAAC;EAE3C,OAAO;IACL3C,SAAS;IACT4C,YAAY,EAAG5C,SAAmB,IAAKwC,QAAQ,CAAC,IAAAK,6BAAe,EAAC7C,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC;AAACP,OAAA,CAAAQ,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","_Href","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","removeParameter","addParameter","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","updateEntryDate","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParame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G5C,SAAmB,IAAKwC,QAAQ,CAAC,IAAAK,6BAAe,EAAC7C,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC;;AAED;AACA;AADAP,OAAA,CAAAQ,YAAA,GAAAA,YAAA;AAEO,MAAM6C,kBAAkB,GAAG,SAAAA,CAChCnD,IAAmB,EAGI;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,iBAAiB;EAAA,IAChCT,OAAqD,GAAAS,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAM;IAAEC;EAAU,CAAC,GAAGC,YAAY,CAAC,CAAC;EACpC,MAAMC,GAAG,GAAG,IAAAC,4BAAgB,EAACR,IAAI,EAAE,CAAC,eAAe,CAAC,CAAC;EACrDO,GAAG,CAACE,YAAY,CAAC,WAAW,EAAEJ,SAAS,CAAC;EAExC,OAAO,IAAAX,oCAAiB,EAACO,GAAG,EAAEM,GAAG,EAAE;IACjCZ,cAAc,EAAE,CAAC,cAAc,CAAC;IAChCC,WAAW,EAAEc,0BAAiB;IAC9B,GAAGjB;EACL,CAAC,CAAC;AACJ,CAAC;AAACK,OAAA,CAAAqD,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -80,8 +80,9 @@ class ListDetailModel extends _DetailModel.default {
|
|
|
80
80
|
/**
|
|
81
81
|
*/
|
|
82
82
|
static isApplicableModel(data) {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
let resourcetype = data.contributions?.resourcetype ?? "unknown";
|
|
84
|
+
resourcetype = resourcetype.toLowerCase();
|
|
85
|
+
return (0, _endsWith.default)(resourcetype).call(resourcetype, "listdetail") || (0, _endsWith.default)(resourcetype).call(resourcetype, "listpaneldetail") || (0, _endsWith.default)(resourcetype).call(resourcetype, "datastorepaneldetail");
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListDetailModel.js","names":["_objects","require","_ActionCollection","_interopRequireDefault","_DetailModel","_ContentConfiguration","_AttributeSetModel","_createAttribute","_CompositeAttributeModel","ListDetailModel","DetailModel","constructor","modularUIResponse","_defineProperty2","default","_actionCollection","ActionCollection","_contentConfiguration","ContentConfiguration","contributions","content","setResultSection","setEventData","getInitialChildModelLinks","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","givenAnswers","setChildModels","models","errors","_attributeCollection","type","modelName","isApplicableModel","data","resourcetype","_endsWith","call","_listitem","actionCollection","panelLinks","contentConfiguration","configuration","introtext","_content","text","message","Array","isArray","texts","has","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","_context","children","_filter","child","childKey","_keys","createAttribute","key","dynamicschema","CompositeAttributeModel","isResult","indicateContentConfiguration","_results","_context2","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","hasEventData","eventdata","addAttributes","eventData","eventContributions","_eventdata","AttributeSetModel","modelOptions","forEach","eventDataContribution","eventDataData","i","exports"],"sources":["../../../src/models/list/ListDetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {},\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\n\n if (this.results) {\n this.results.setChildModels(models, errors);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models, errors);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ListDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._content) {\n return this.data._content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n },\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions,\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions,\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(\n key,\n eventData,\n eventContributions,\n this.modelOptions,\n ),\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,qBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,kBAAA,GAAAH,sBAAA,CAAAF,OAAA;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,IAAI,CAACa,aAAa,CAChBb,GAAG,EACH;cACE,GAAG,IAAI,CAAC7B,IAAI,CAACyC,SAAS,CAACZ,GAAG,CAAC;cAC3BC,aAAa,EAAE,IAAI,CAAC9B,IAAI,CAAC8B;YAC3B,CAAC,EACDmB,qBAAqB,CAACpB,GAAG,CAC3B,CAAC;UACH;QACF;MACF,CAAC,CAAC;IACJ;EACF;;EAEA;AACF;EACE,IAAIY,SAASA,CAAA,EAA6B;IACxC,OAAO,IAAI,CAACI,UAAU;EACxB;AACF;AAACO,OAAA,CAAA9E,OAAA,GAAAL,eAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ListDetailModel.js","names":["_objects","require","_ActionCollection","_interopRequireDefault","_DetailModel","_ContentConfiguration","_AttributeSetModel","_createAttribute","_CompositeAttributeModel","ListDetailModel","DetailModel","constructor","modularUIResponse","_defineProperty2","default","_actionCollection","ActionCollection","_contentConfiguration","ContentConfiguration","contributions","content","setResultSection","setEventData","getInitialChildModelLinks","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","givenAnswers","setChildModels","models","errors","_attributeCollection","type","modelName","isApplicableModel","data","resourcetype","toLowerCase","_endsWith","call","_listitem","actionCollection","panelLinks","contentConfiguration","configuration","introtext","_content","text","message","Array","isArray","texts","has","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","_context","children","_filter","child","childKey","_keys","createAttribute","key","dynamicschema","CompositeAttributeModel","isResult","indicateContentConfiguration","_results","_context2","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","hasEventData","eventdata","addAttributes","eventData","eventContributions","_eventdata","AttributeSetModel","modelOptions","forEach","eventDataContribution","eventDataData","i","exports"],"sources":["../../../src/models/list/ListDetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {},\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\n\n if (this.results) {\n this.results.setChildModels(models, errors);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models, errors);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ListDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n let resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n resourcetype = resourcetype.toLowerCase();\n\n return (\n resourcetype.endsWith(\"listdetail\") ||\n resourcetype.endsWith(\"listpaneldetail\") ||\n resourcetype.endsWith(\"datastorepaneldetail\")\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._content) {\n return this.data._content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n },\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions,\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions,\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(\n key,\n eventData,\n eventContributions,\n this.modelOptions,\n ),\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key],\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,qBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,kBAAA,GAAAH,sBAAA,CAAAF,OAAA;AAEA,IAAAM,gBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,wBAAA,GAAAL,sBAAA,CAAAF,OAAA;AASA;AACA;AACA;AACe,MAAMQ,eAAe,SAASC,oBAAW,CAAC;EAOvD;AACF;AACA;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAgB,CAAC,CAAC;IAE/C,IAAI,CAACC,qBAAqB,GAAG,IAAIC,6BAAoB,CACnD,IAAI,CAACC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACC,OAAO,GAAG,CAAC,CACrD,CAAC;IAED,IAAI,CAACC,gBAAgB,CAAC,CAAC;IACvB,IAAI,CAACC,YAAY,CAAC,CAAC;EACrB;;EAEA;AACF;AACA;EACEC,yBAAyBA,CAAA,EAAqB;IAC5C,MAAMC,cAAc,GAAG,IAAI,CAACC,QAAQ,GAChC,IAAI,CAACA,QAAQ,CAACC,KAAK,CAACC,eAAe,CAAC,OAAO,CAAC,CAACC,GAAG,GAChD,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AAC0C,SAAS,EAAE;UAC9B,IAAI5B,KAAK,CAACC,OAAO,CAAC,IAAI,CAACf,IAAI,CAAC0C,SAAS,CAACZ,GAAG,CAAC,CAAC,EAAE;YAC3C,IAAI,CAAC9B,IAAI,CAAC0C,SAAS,CAACZ,GAAG,CAAC,CAACmB,OAAO,CAAC,CAACE,aAAa,EAAEC,CAAC,KAAK;cACrD,IAAI,CAACT,aAAa,CAChB,GAAGb,GAAG,IAAIsB,CAAC,GAAG,CAAC,EAAE,EACjB;gBACE,GAAGD,aAAa;gBAChBpB,aAAa,EAAE,IAAI,CAAC/B,IAAI,CAAC+B;cAC3B,CAAC,EACDmB,qBAAqB,CAACpB,GAAG,CAC3B,CAAC;YACH,CAAC,CAAC;UACJ,CAAC,MAAM;YACL,IAAI,CAACa,aAAa,CAChBb,GAAG,EACH;cACE,GAAG,IAAI,CAAC9B,IAAI,CAAC0C,SAAS,CAACZ,GAAG,CAAC;cAC3BC,aAAa,EAAE,IAAI,CAAC/B,IAAI,CAAC+B;YAC3B,CAAC,EACDmB,qBAAqB,CAACpB,GAAG,CAC3B,CAAC;UACH;QACF;MACF,CAAC,CAAC;IACJ;EACF;;EAEA;AACF;EACE,IAAIY,SAASA,CAAA,EAA6B;IACxC,OAAO,IAAI,CAACI,UAAU;EACxB;AACF;AAACO,OAAA,CAAA/E,OAAA,GAAAL,eAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -236,3 +236,21 @@ export const useEntryDate = (): ({
|
|
|
236
236
|
setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),
|
|
237
237
|
};
|
|
238
238
|
};
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
*/
|
|
242
|
+
export const useRelatedConcepts = (
|
|
243
|
+
href: string | Href,
|
|
244
|
+
key?: string = "relatedconcepts",
|
|
245
|
+
options?: UseModularUIBasicOptions<ConceptIndexModel>,
|
|
246
|
+
): ?ConceptIndexModel => {
|
|
247
|
+
const { entryDate } = useEntryDate();
|
|
248
|
+
const url = filterParameters(href, ["modelcategory"]);
|
|
249
|
+
url.setParameter("entryDate", entryDate);
|
|
250
|
+
|
|
251
|
+
return useModularUIBasic(key, url, {
|
|
252
|
+
expectedModels: ["ConceptIndex"],
|
|
253
|
+
targetModel: ConceptIndexModel,
|
|
254
|
+
...options,
|
|
255
|
+
});
|
|
256
|
+
};
|
|
@@ -93,13 +93,13 @@ export default class ListDetailModel extends DetailModel {
|
|
|
93
93
|
/**
|
|
94
94
|
*/
|
|
95
95
|
static isApplicableModel(data: ModularUIResponse): boolean {
|
|
96
|
-
|
|
96
|
+
let resourcetype = data.contributions?.resourcetype ?? "unknown";
|
|
97
|
+
resourcetype = resourcetype.toLowerCase();
|
|
97
98
|
|
|
98
99
|
return (
|
|
99
|
-
resourcetype.endsWith("
|
|
100
|
-
resourcetype.endsWith("
|
|
101
|
-
resourcetype
|
|
102
|
-
resourcetype === "CaseRelatedDataStorePanelDetail"
|
|
100
|
+
resourcetype.endsWith("listdetail") ||
|
|
101
|
+
resourcetype.endsWith("listpaneldetail") ||
|
|
102
|
+
resourcetype.endsWith("datastorepaneldetail")
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
|