@beinformed/ui 1.62.1 → 1.62.3
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 +15 -0
- package/esm/hooks/__tests__/useModelCatalog.spec.js.flow +19 -0
- package/esm/hooks/useModelCatalog.d.ts +1 -0
- package/esm/hooks/useModelCatalog.js +22 -2
- package/esm/hooks/useModelCatalog.js.flow +31 -3
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.d.ts +4 -7
- package/esm/models/concepts/ConceptLinkModel.js +7 -1
- package/esm/models/concepts/ConceptLinkModel.js.flow +8 -8
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.d.ts +3 -0
- package/esm/models/concepts/SourceReferenceModel.js +7 -1
- package/esm/models/concepts/SourceReferenceModel.js.flow +7 -1
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/concepts/__tests__/RelatedConcepts.spec.js.flow +6 -8
- package/esm/models/concepts/__tests__/SourceReferenceModel.spec.js.flow +3 -3
- package/esm/models/content/ContentLinkModel.js +3 -1
- package/esm/models/content/ContentLinkModel.js.flow +1 -1
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/__tests__/Formalsource.spec.js.flow +30 -0
- package/esm/models/types.d.ts +0 -1
- package/esm/models/types.js.flow +0 -1
- package/esm/models/types.js.map +1 -1
- package/lib/hooks/useModelCatalog.d.ts +1 -0
- package/lib/hooks/useModelCatalog.js +24 -3
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.d.ts +4 -7
- package/lib/models/concepts/ConceptLinkModel.js +7 -1
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.d.ts +3 -0
- package/lib/models/concepts/SourceReferenceModel.js +7 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +3 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/types.d.ts +0 -1
- package/lib/models/types.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/__tests__/useModelCatalog.spec.js +19 -0
- package/src/hooks/useModelCatalog.js +31 -3
- package/src/models/concepts/ConceptLinkModel.js +8 -8
- package/src/models/concepts/SourceReferenceModel.js +7 -1
- package/src/models/concepts/__mock__/related_concepts_data.json +871 -755
- package/src/models/concepts/__tests__/RelatedConcepts.spec.js +6 -8
- package/src/models/concepts/__tests__/SourceReferenceModel.spec.js +3 -3
- package/src/models/content/ContentLinkModel.js +1 -1
- package/src/models/content/__tests__/Formalsource.spec.js +30 -0
- package/src/models/types.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.2...v1.62.3) (2025-06-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **content:** add useCompleteSource to handle complete=true on toc ([64d39c4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/64d39c49ff732afc0401e33c10008e0be447fbb8))
|
|
11
|
+
|
|
12
|
+
## [1.62.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.1...v1.62.2) (2025-06-04)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **content-link:** don't add complete on sections ([413c23a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/413c23a6a62290969d5628f24ca346d86f13510d))
|
|
18
|
+
* **sources:** update format of fragments on content ([7e38a81](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/7e38a814c83d40816c527215127f4939479d65e3))
|
|
19
|
+
|
|
5
20
|
## [1.62.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.0...v1.62.1) (2025-06-04)
|
|
6
21
|
|
|
7
22
|
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
useContentTOC,
|
|
22
22
|
useModelCatalog,
|
|
23
23
|
useContentType,
|
|
24
|
+
useCompleteSource,
|
|
24
25
|
} from "../useModelCatalog";
|
|
25
26
|
import { DateUtil } from "../../utils";
|
|
26
27
|
|
|
@@ -149,6 +150,24 @@ describe("modelcatalog hooks", () => {
|
|
|
149
150
|
);
|
|
150
151
|
});
|
|
151
152
|
|
|
153
|
+
// eslint-disable-next-line jest/expect-expect
|
|
154
|
+
it("useCompleteSource", () => {
|
|
155
|
+
assertTargetModel(
|
|
156
|
+
() => useCompleteSource("/contentdetail"),
|
|
157
|
+
"content",
|
|
158
|
+
"/content/contentdetail?complete=true&entryDate=" + DateUtil.now(),
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// eslint-disable-next-line jest/expect-expect
|
|
163
|
+
it("useCompleteSource 2", () => {
|
|
164
|
+
assertTargetModel(
|
|
165
|
+
() => useCompleteSource("/contentdetail?complete=false"),
|
|
166
|
+
"content",
|
|
167
|
+
"/content/contentdetail?complete=true&entryDate=" + DateUtil.now(),
|
|
168
|
+
);
|
|
169
|
+
});
|
|
170
|
+
|
|
152
171
|
// eslint-disable-next-line jest/expect-expect
|
|
153
172
|
it("useContentType", () => {
|
|
154
173
|
assertTargetModel(
|
|
@@ -11,6 +11,7 @@ export function useConceptDetail(concept: string | Href, key?: string, options?:
|
|
|
11
11
|
export function useContentIndex(href: string | Href, key?: string, options?: UseModularUIBasicOptions<ContentIndexModel>): ContentIndexModel | null;
|
|
12
12
|
export function useContentTOC(content: string | Href, key?: string, options?: UseModularUIBasicOptions<ContentTOCModel>): ContentTOCModel | null;
|
|
13
13
|
export function useContent(content: string | Href, key?: string, options?: UseModularUIBasicOptions<ContentModel>): (ContentModel | (ContentTOCModel | null)) | null;
|
|
14
|
+
export function useCompleteSource(content: string | Href, key?: string, options?: UseModularUIBasicOptions<ContentModel>): (ContentModel | (ContentTOCModel | null)) | null;
|
|
14
15
|
export function useContentType(contentType: string | Href, key?: string, options?: UseModularUIBasicOptions<ContentTypeModel>): ContentTypeModel | null;
|
|
15
16
|
export function useConceptSearch(filters: SearchFilter, key?: string, options?: UseModularUIBasicOptions<ConceptIndexModel>): ConceptIndexModel | null;
|
|
16
17
|
export function useContentSearch(filters: SearchFilter, key?: string, options?: UseModularUIBasicOptions<ContentIndexModel>): ContentIndexModel | null;
|
|
@@ -13,6 +13,7 @@ import { useModularUIBasic } from "./useModularUIBasic";
|
|
|
13
13
|
import { ContentTypeModel } from "../models";
|
|
14
14
|
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
15
15
|
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
16
|
+
import Href from "../models/href/Href";
|
|
16
17
|
/**
|
|
17
18
|
*/
|
|
18
19
|
export const useModelCatalog = options => useModularUIBasic("modelcatalog", "/modelcatalog", {
|
|
@@ -76,7 +77,7 @@ export const useContentTOC = function (content) {
|
|
|
76
77
|
entryDate
|
|
77
78
|
} = useEntryDate();
|
|
78
79
|
const location = useLocation();
|
|
79
|
-
const href = createHref("content", content, entryDate, location, []);
|
|
80
|
+
const href = createHref("content", content, entryDate, location, ["complete"]);
|
|
80
81
|
return useModularUIBasic(key, href, {
|
|
81
82
|
expectedModels: ["ContentTOC"],
|
|
82
83
|
targetModel: ContentTOCModel,
|
|
@@ -93,7 +94,26 @@ export const useContent = function (content) {
|
|
|
93
94
|
entryDate
|
|
94
95
|
} = useEntryDate();
|
|
95
96
|
const location = useLocation();
|
|
96
|
-
const href = createHref("content", content, entryDate, location, []);
|
|
97
|
+
const href = createHref("content", content, entryDate, location, ["complete"]);
|
|
98
|
+
return useModularUIBasic(key, href, {
|
|
99
|
+
expectedModels: ["Content", "ContentTOC"],
|
|
100
|
+
...options
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
*/
|
|
106
|
+
export const useCompleteSource = function (content) {
|
|
107
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "content";
|
|
108
|
+
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
109
|
+
const {
|
|
110
|
+
entryDate
|
|
111
|
+
} = useEntryDate();
|
|
112
|
+
const location = useLocation();
|
|
113
|
+
let contentHref = new Href(content);
|
|
114
|
+
contentHref.removeParameter("complete");
|
|
115
|
+
contentHref.addParameter("complete", "true");
|
|
116
|
+
const href = createHref("content", contentHref, entryDate, location, ["complete"]);
|
|
97
117
|
return useModularUIBasic(key, href, {
|
|
98
118
|
expectedModels: ["Content", "ContentTOC"],
|
|
99
119
|
...options
|
|
@@ -18,7 +18,7 @@ import { ContentTypeModel } from "../models";
|
|
|
18
18
|
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
19
19
|
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
20
20
|
|
|
21
|
-
import
|
|
21
|
+
import Href from "../models/href/Href";
|
|
22
22
|
import type { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
23
23
|
import type { UpdateEntryDateAction } from "../redux";
|
|
24
24
|
export type SearchFilter = {
|
|
@@ -108,7 +108,9 @@ export const useContentTOC = (
|
|
|
108
108
|
const { entryDate } = useEntryDate();
|
|
109
109
|
const location = useLocation();
|
|
110
110
|
|
|
111
|
-
const href = createHref("content", content, entryDate, location, [
|
|
111
|
+
const href = createHref("content", content, entryDate, location, [
|
|
112
|
+
"complete",
|
|
113
|
+
]);
|
|
112
114
|
|
|
113
115
|
return useModularUIBasic(key, href, {
|
|
114
116
|
expectedModels: ["ContentTOC"],
|
|
@@ -127,7 +129,33 @@ export const useContent = (
|
|
|
127
129
|
const { entryDate } = useEntryDate();
|
|
128
130
|
const location = useLocation();
|
|
129
131
|
|
|
130
|
-
const href = createHref("content", content, entryDate, location, [
|
|
132
|
+
const href = createHref("content", content, entryDate, location, [
|
|
133
|
+
"complete",
|
|
134
|
+
]);
|
|
135
|
+
|
|
136
|
+
return useModularUIBasic(key, href, {
|
|
137
|
+
expectedModels: ["Content", "ContentTOC"],
|
|
138
|
+
...options,
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
*/
|
|
144
|
+
export const useCompleteSource = (
|
|
145
|
+
content: string | Href,
|
|
146
|
+
key?: string = "content",
|
|
147
|
+
options?: UseModularUIBasicOptions<ContentModel>,
|
|
148
|
+
): ?ContentModel | ?ContentTOCModel => {
|
|
149
|
+
const { entryDate } = useEntryDate();
|
|
150
|
+
const location = useLocation();
|
|
151
|
+
|
|
152
|
+
let contentHref = new Href(content);
|
|
153
|
+
contentHref.removeParameter("complete");
|
|
154
|
+
contentHref.addParameter("complete", "true");
|
|
155
|
+
|
|
156
|
+
const href = createHref("content", contentHref, entryDate, location, [
|
|
157
|
+
"complete",
|
|
158
|
+
]);
|
|
131
159
|
|
|
132
160
|
return useModularUIBasic(key, href, {
|
|
133
161
|
expectedModels: ["Content", "ContentTOC"],
|
|
@@ -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","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","setParameter","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","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 type 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\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\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,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,i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B,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBnB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGkB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOR,eAAe,CAACZ,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMU,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAM0B,QAAQ,GAAGrD,WAAW,CAAC,CAAC;EAC9B,MAAM0B,SAAS,GAAG3B,WAAW,CAACe,YAAY,CAAC;EAE3C,OAAO;IACLY,SAAS;IACT4B,YAAY,EAAG5B,SAAmB,IAAK2B,QAAQ,CAACtC,eAAe,CAACW,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"],"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,0CA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,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGsB,aAAa,CAAC,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":[]}
|
|
@@ -64,6 +64,9 @@ export default class ConceptLinkModel extends BaseModel {
|
|
|
64
64
|
*
|
|
65
65
|
*/
|
|
66
66
|
get modelCategory(): string;
|
|
67
|
+
/**
|
|
68
|
+
*/
|
|
69
|
+
get sectionId(): string;
|
|
67
70
|
/**
|
|
68
71
|
*
|
|
69
72
|
*/
|
|
@@ -75,11 +78,5 @@ import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
|
75
78
|
import LinkModel from "../links/LinkModel";
|
|
76
79
|
import { ModularUIModel } from "../types";
|
|
77
80
|
import Href from "../href/Href";
|
|
78
|
-
|
|
79
|
-
sectionId: string;
|
|
80
|
-
text: string;
|
|
81
|
-
startOffset: number;
|
|
82
|
-
endOffset: number;
|
|
83
|
-
};
|
|
81
|
+
import { SectionFragment } from "../types";
|
|
84
82
|
import { ModelOptions } from "../types";
|
|
85
|
-
export {};
|
|
@@ -148,11 +148,17 @@ export default class ConceptLinkModel extends BaseModel {
|
|
|
148
148
|
return this.getData("modelCategory");
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
*/
|
|
153
|
+
get sectionId() {
|
|
154
|
+
return this.data.section?._id;
|
|
155
|
+
}
|
|
156
|
+
|
|
151
157
|
/**
|
|
152
158
|
*
|
|
153
159
|
*/
|
|
154
160
|
get fragment() {
|
|
155
|
-
return this.
|
|
161
|
+
return this.data.section?.fragment;
|
|
156
162
|
}
|
|
157
163
|
}
|
|
158
164
|
//# sourceMappingURL=ConceptLinkModel.js.map
|
|
@@ -9,16 +9,10 @@ import type {
|
|
|
9
9
|
IModelWithChildModels,
|
|
10
10
|
ModelOptions,
|
|
11
11
|
ModularUIModel,
|
|
12
|
+
SectionFragment,
|
|
12
13
|
} from "../types";
|
|
13
14
|
import type Href from "../href/Href";
|
|
14
15
|
|
|
15
|
-
type SectionFragment = {
|
|
16
|
-
sectionId: string,
|
|
17
|
-
text: string,
|
|
18
|
-
startOffset: number,
|
|
19
|
-
endOffset: number,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
16
|
/**
|
|
23
17
|
* Link to a concept
|
|
24
18
|
*/
|
|
@@ -199,10 +193,16 @@ export default class ConceptLinkModel
|
|
|
199
193
|
return this.getData("modelCategory");
|
|
200
194
|
}
|
|
201
195
|
|
|
196
|
+
/**
|
|
197
|
+
*/
|
|
198
|
+
get sectionId(): string {
|
|
199
|
+
return this.data.section?._id;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
202
|
/**
|
|
203
203
|
*
|
|
204
204
|
*/
|
|
205
205
|
get fragment(): SectionFragment {
|
|
206
|
-
return this.
|
|
206
|
+
return this.data.section?.fragment;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptLinkModel.js","names":["BaseModel","LinkModel","LinkCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptLinkModel","constructor","data","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_entryDate","getInitialChildModelLinks","conceptTypeLink","isCacheable","setChildModels","models","href","conceptTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","conceptType","_conceptType","key","_id","label","getData","links","_links","Array","isArray","selflink","getLinkByKey","Error","addParameter","concepttypeHref","taxonomyType","asLinkModel","link","create","isOfConceptType","conceptTypeId","modelCategory","fragment"],"sources":["../../../src/models/concepts/ConceptLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n IModelWithChildModels,\n ModelOptions,\n ModularUIModel,\n} from \"../types\";\nimport type Href from \"../href/Href\";\n\
|
|
1
|
+
{"version":3,"file":"ConceptLinkModel.js","names":["BaseModel","LinkModel","LinkCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptLinkModel","constructor","data","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_entryDate","getInitialChildModelLinks","conceptTypeLink","isCacheable","setChildModels","models","href","conceptTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","conceptType","_conceptType","key","_id","label","getData","links","_links","Array","isArray","selflink","getLinkByKey","Error","addParameter","concepttypeHref","taxonomyType","asLinkModel","link","create","isOfConceptType","conceptTypeId","modelCategory","sectionId","section","fragment"],"sources":["../../../src/models/concepts/ConceptLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n IModelWithChildModels,\n ModelOptions,\n ModularUIModel,\n SectionFragment,\n} from \"../types\";\nimport type Href from \"../href/Href\";\n\n/**\n * Link to a concept\n */\nexport default class ConceptLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _conceptType: ?ConceptTypeDetailModel;\n\n /**\n * Construct ConceptLinkModel\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.conceptTypeLink) {\n this.conceptTypeLink.isCacheable = true;\n return [this.conceptTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n if (this.conceptTypeLink) {\n const href = this.conceptTypeLink.href;\n const conceptTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (conceptTypeModel?.type === \"ConceptTypeDetail\") {\n this.conceptType = conceptTypeModel;\n }\n }\n }\n\n /**\n * Retrieve concept type\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n * Set concept type\n */\n set conceptType(conceptType: ?ModularUIModel) {\n this._conceptType =\n conceptType instanceof ConceptTypeDetailModel ? conceptType : null;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.data._id;\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n const label = this.getData(\"label\");\n\n if (label) {\n return label;\n }\n\n return this.getData(\"conceptLabel\", \"\");\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this.modelOptions,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get conceptTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"concepttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get concepttypeHref(): Href | null {\n return this.conceptTypeLink?.href ?? null;\n }\n\n /**\n */\n get taxonomyType(): string {\n return \"default\";\n }\n\n /**\n */\n asLinkModel(): LinkModel {\n const link = LinkModel.create(\n this.key,\n this.selfhref.href,\n this.label,\n this.modelOptions,\n );\n link.href = this.selfhref;\n\n return link;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n\n /**\n *\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\");\n }\n\n /**\n */\n get sectionId(): string {\n return this.data.section?._id;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment {\n return this.data.section?.fragment;\n }\n}\n"],"mappings":";;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,SAASC,uBAAuB,QAAQ,2BAA2B;AAUnE;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAC3BL,SAAS,CAEnB;EAKE;AACF;AACA;EACEM,WAAWA,CACTC,IAAY,EAGZ;IAAA,IAFAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,YAA2B,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAE3B,KAAK,CAACJ,IAAI,EAAE,CAAC,CAAC,EAAEK,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAE9B,IAAI,CAACC,UAAU,GAAGN,SAAS;EAC7B;;EAEA;AACF;EACEO,yBAAyBA,CAAA,EAAqB;I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B,IAAI,CAAChB,GAAG,EACR,IAAI,CAACL,QAAQ,CAACL,IAAI,EAClB,IAAI,CAACY,KAAK,EACV,IAAI,CAACpB,YACP,CAAC;IACDiC,IAAI,CAACzB,IAAI,GAAG,IAAI,CAACK,QAAQ;IAEzB,OAAOoB,IAAI;EACb;;EAEA;AACF;AACA;EACEE,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAACpB,WAAW,EAAEmB,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;;EAEA;AACF;AACA;EACE,IAAIC,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAI,CAAChB,OAAO,CAAC,eAAe,CAAC;EACtC;;EAEA;AACF;EACE,IAAIiB,SAASA,CAAA,EAAW;IACtB,OAAO,IAAI,CAAC3C,IAAI,CAAC4C,OAAO,EAAEpB,GAAG;EAC/B;;EAEA;AACF;AACA;EACE,IAAIqB,QAAQA,CAAA,EAAoB;IAC9B,OAAO,IAAI,CAAC7C,IAAI,CAAC4C,OAAO,EAAEC,QAAQ;EACpC;AACF","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ class SourceReferenceModel {
|
|
|
25
25
|
/**
|
|
26
26
|
*/
|
|
27
27
|
get link() {
|
|
28
|
-
const section = this.
|
|
28
|
+
const section = this.sectionId || this._sourceReference._links.self.href.replace(`${this._sourceReference._links.content.href}/`, "");
|
|
29
29
|
return new ContentLinkModel({
|
|
30
30
|
...this._sourceReference,
|
|
31
31
|
section
|
|
@@ -69,6 +69,12 @@ class SourceReferenceModel {
|
|
|
69
69
|
return createHashFromHref(this.selfhref);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
*/
|
|
74
|
+
get sectionId() {
|
|
75
|
+
return this._sourceReference.sectionId;
|
|
76
|
+
}
|
|
77
|
+
|
|
72
78
|
/**
|
|
73
79
|
*
|
|
74
80
|
*/
|
|
@@ -32,7 +32,7 @@ class SourceReferenceModel {
|
|
|
32
32
|
*/
|
|
33
33
|
get link(): ContentLinkModel {
|
|
34
34
|
const section =
|
|
35
|
-
this.
|
|
35
|
+
this.sectionId ||
|
|
36
36
|
this._sourceReference._links.self.href.replace(
|
|
37
37
|
`${this._sourceReference._links.content.href}/`,
|
|
38
38
|
"",
|
|
@@ -85,6 +85,12 @@ class SourceReferenceModel {
|
|
|
85
85
|
return createHashFromHref(this.selfhref);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
*/
|
|
90
|
+
get sectionId(): string {
|
|
91
|
+
return this._sourceReference.sectionId;
|
|
92
|
+
}
|
|
93
|
+
|
|
88
94
|
/**
|
|
89
95
|
*
|
|
90
96
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePathModularUI","SourceReferenceModel","constructor","sourceReference","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_sourceReference","_entryDate","_modelOptions","origin","contextPath","link","section","
|
|
1
|
+
{"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePathModularUI","SourceReferenceModel","constructor","sourceReference","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_sourceReference","_entryDate","_modelOptions","origin","contextPath","link","section","sectionId","_links","self","href","replace","content","selfhref","type","label","sourceLabel","sourceAbbreviation","referenceHash","fragment","sectionFragment"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\nimport type { ModelOptions, SectionFragment } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section =\n this.sectionId ||\n this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return this.link.selfhref;\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n *\n */\n get sourceAbbreviation(): string {\n return this._sourceReference.sourceAbbreviation;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n get sectionId(): string {\n return this._sourceReference.sectionId;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment | void {\n return this._sourceReference.sectionFragment;\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SAASC,oBAAoB,QAAQ,iBAAiB;AAGtD;AACA;AACA,MAAMC,oBAAoB,CAAC;EAKzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EAGvB;IAAA,IAFAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,YAA2B,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAAE,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAE3B,IAAI,CAACC,gBAAgB,GAAGP,eAAe;IACvC,IAAI,CAACQ,UAAU,GAAGP,SAAS;I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Y,QAAQA,CAAA,EAA2B;IACrC,OAAO,IAAI,CAACnB,gBAAgB,CAACoB,eAAe;EAC9C;AACF;AAEA,eAAe7B,oBAAoB","ignoreList":[]}
|
|
@@ -9,10 +9,10 @@ describe("Related concepts", () => {
|
|
|
9
9
|
|
|
10
10
|
expect(relatedConcepts.label).toBe("Related concepts of content");
|
|
11
11
|
expect(relatedConcepts.selfhref.toString()).toBe(
|
|
12
|
-
"/content/bundle-com.beinformed.source.Highlevelrequirements/ResearchGrant/High%20level%20requirements.formalsource/relatedConcepts?entryDate=2025-06-
|
|
12
|
+
"/content/bundle-com.beinformed.source.Highlevelrequirements/ResearchGrant/High%20level%20requirements.formalsource/relatedConcepts?entryDate=2025-06-04",
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
expect(relatedConcepts.entryDate).toBe("2025-06-
|
|
15
|
+
expect(relatedConcepts.entryDate).toBe("2025-06-04");
|
|
16
16
|
expect(relatedConcepts.modelCategoryFilter.label).toBe("Model category");
|
|
17
17
|
|
|
18
18
|
expect(relatedConcepts.items.size).toBe(116);
|
|
@@ -26,16 +26,14 @@ describe("Related concepts", () => {
|
|
|
26
26
|
);
|
|
27
27
|
expect(firstItem.modelCategory).toBe("Requirements");
|
|
28
28
|
expect(firstItem.selfhref.toString()).toBe(
|
|
29
|
-
"/concepts/bundle-com.beinformed.frames.ResearchGrantRequirements/frames.beimodel.json/SystemMustSendAutomatedNotificationsForStatusChanges?entryDate=2025-06-
|
|
29
|
+
"/concepts/bundle-com.beinformed.frames.ResearchGrantRequirements/frames.beimodel.json/SystemMustSendAutomatedNotificationsForStatusChanges?entryDate=2025-06-04",
|
|
30
30
|
);
|
|
31
31
|
expect(firstItem.conceptTypeLink.href.toString()).toBe(
|
|
32
32
|
"/concepttypes/bundle-com.beinformed.research.grant.metamodels/High%20level%20requirements.bixml/ArchitecturalSignificantRequirement",
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
expect(firstItem.
|
|
36
|
-
|
|
37
|
-
);
|
|
38
|
-
expect(firstItem.fragment.text).toBeUndefined();
|
|
35
|
+
expect(firstItem.sectionId).toBe("AutomatedNotifications_Requirement");
|
|
36
|
+
expect(firstItem.fragment).toBeUndefined();
|
|
39
37
|
|
|
40
38
|
const secondItem = relatedConcepts.items.get(1);
|
|
41
39
|
|
|
@@ -48,7 +46,7 @@ describe("Related concepts", () => {
|
|
|
48
46
|
|
|
49
47
|
expect(secondItem.modelCategory).toBe("Requirements");
|
|
50
48
|
|
|
51
|
-
expect(secondItem.
|
|
49
|
+
expect(secondItem.sectionId).toBe(
|
|
52
50
|
"MaximumFlexibilityWithinPolicyConstraints",
|
|
53
51
|
);
|
|
54
52
|
expect(secondItem.fragment.text).toBe(
|
|
@@ -14,8 +14,8 @@ const data = {
|
|
|
14
14
|
href: "/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource",
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
+
sectionId: "Chapter4",
|
|
17
18
|
sectionFragment: {
|
|
18
|
-
sectionId: "Chapter4",
|
|
19
19
|
text: "Research Grant",
|
|
20
20
|
startOffset: 32,
|
|
21
21
|
endOffset: 18,
|
|
@@ -39,6 +39,8 @@ describe("sourceReferenceModel", () => {
|
|
|
39
39
|
expect(sourceReference.type).toBe("Reference");
|
|
40
40
|
expect(sourceReference.sourceAbbreviation).toBe("GFA-TC-01");
|
|
41
41
|
expect(sourceReference.referenceHash).toBe(10443215482258);
|
|
42
|
+
|
|
43
|
+
expect(sourceReference.sectionId).toBe("Chapter4");
|
|
42
44
|
expect(sourceReference.fragment.text).toBe("Research Grant");
|
|
43
45
|
expect(sourceReference.fragment.startOffset).toBe(32);
|
|
44
46
|
expect(sourceReference.fragment.endOffset).toBe(18);
|
|
@@ -60,7 +62,6 @@ describe("sourceReferenceModel", () => {
|
|
|
60
62
|
contextPath: "/BeInformed",
|
|
61
63
|
fragment: {
|
|
62
64
|
endOffset: 18,
|
|
63
|
-
sectionId: "Chapter4",
|
|
64
65
|
startOffset: 32,
|
|
65
66
|
text: "Research Grant",
|
|
66
67
|
},
|
|
@@ -95,7 +96,6 @@ describe("sourceReferenceModel", () => {
|
|
|
95
96
|
contextPath: "/BeInformed",
|
|
96
97
|
fragment: {
|
|
97
98
|
endOffset: 18,
|
|
98
|
-
sectionId: "Chapter4",
|
|
99
99
|
startOffset: 32,
|
|
100
100
|
text: "Research Grant",
|
|
101
101
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
2
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
3
|
+
import _endsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/ends-with";
|
|
3
4
|
import BaseModel from "../base/BaseModel";
|
|
4
5
|
import Href from "../href/Href";
|
|
5
6
|
import LinkModel from "../links/LinkModel";
|
|
@@ -140,10 +141,11 @@ export default class ContentLinkModel extends BaseModel {
|
|
|
140
141
|
get selflink() {
|
|
141
142
|
let selflink = this.links.getLinkByKey("self");
|
|
142
143
|
if (getSetting("COMPLETE_SOURCE", false)) {
|
|
144
|
+
var _context;
|
|
143
145
|
if (this.links.hasLinkByKey("content")) {
|
|
144
146
|
selflink = this.links.getLinkByKey("content");
|
|
145
147
|
}
|
|
146
|
-
if (selflink != null) {
|
|
148
|
+
if (selflink != null && !_endsWithInstanceProperty(_context = selflink.href.path).call(_context, this.data.section)) {
|
|
147
149
|
selflink.href.addParameter("complete", "true");
|
|
148
150
|
selflink.href.hash = this.data.section;
|
|
149
151
|
}
|
|
@@ -183,7 +183,7 @@ export default class ContentLinkModel
|
|
|
183
183
|
selflink = this.links.getLinkByKey("content");
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
if (selflink != null) {
|
|
186
|
+
if (selflink != null && !selflink.href.path.endsWith(this.data.section)) {
|
|
187
187
|
selflink.href.addParameter("complete", "true");
|
|
188
188
|
selflink.href.hash = this.data.section;
|
|
189
189
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLinkModel.js","names":["BaseModel","Href","LinkModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","getSetting","LinkCollection","ContentLinkModel","constructor","data","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_entryDate","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","key","getData","label","sourceLabel","abbreviation","createEncodedHref","startURI","selfHref","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","links","Array","isArray","selflink","getLinkByKey","hasLinkByKey","hash","Error","state","fragment","subSectionID","contentTypeHref","sectionFragment","items","_items"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type {\n ModularUIModel,\n IModelWithChildModels,\n ModelOptions,\n SectionFragment,\n} from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n *\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\") || this.getData(\"sourceAbbreviation\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n const startURI = \"/content/\";\n const selfHref = new Href(\n this.data._links.self.href,\n \"\",\n this.modelOptions,\n );\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this.modelOptions,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n let selflink = this.links.getLinkByKey(\"self\");\n\n if (getSetting(\"COMPLETE_SOURCE\", false)) {\n if (this.links.hasLinkByKey(\"content\")) {\n selflink = this.links.getLinkByKey(\"content\");\n }\n\n if (selflink != null) {\n selflink.href.addParameter(\"complete\", \"true\");\n selflink.href.hash = this.data.section;\n }\n }\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n if (!selflink.href.state) {\n selflink.href.state = {\n fragment: this.fragment,\n };\n } else {\n selflink.href.state.fragment = this.fragment;\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get fragment(): SectionFragment | void {\n return this.data.sectionFragment;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,UAAU,QA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,CAAC3C,eAAe,EAAE;MACxB,OAAO,IAAI,CAACA,eAAe,CAACI,IAAI;IAClC;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIqC,QAAQA,CAAA,EAA2B;IACrC,OAAO,IAAI,CAAClD,IAAI,CAACqD,eAAe;EAClC;;EAEA;AACF;AACA;EACE,IAAIC,KAAKA,CAACA,KAA8B,EAAE;IACxC,IAAI,CAACC,MAAM,GAAGD,KAAK;EACrB;;EAEA;AACF;EACE,IAAIA,KAAKA,CAAA,EAA4B;IACnC,OAAO,IAAI,CAACC,MAAM;EACpB;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ContentLinkModel.js","names":["BaseModel","Href","LinkModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","getSetting","LinkCollection","ContentLinkModel","constructor","data","entryDate","arguments","length","undefined","modelOptions","_defineProperty","_entryDate","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","key","getData","label","sourceLabel","abbreviation","createEncodedHref","startURI","selfHref","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","links","Array","isArray","selflink","getLinkByKey","_context","hasLinkByKey","_endsWithInstanceProperty","hash","Error","state","fragment","subSectionID","contentTypeHref","sectionFragment","items","_items"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type {\n ModularUIModel,\n IModelWithChildModels,\n ModelOptions,\n SectionFragment,\n} from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n *\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\") || this.getData(\"sourceAbbreviation\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n const startURI = \"/content/\";\n const selfHref = new Href(\n this.data._links.self.href,\n \"\",\n this.modelOptions,\n );\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this.modelOptions,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n let selflink = this.links.getLinkByKey(\"self\");\n\n if (getSetting(\"COMPLETE_SOURCE\", false)) {\n if (this.links.hasLinkByKey(\"content\")) {\n selflink = this.links.getLinkByKey(\"content\");\n }\n\n if (selflink != null && !selflink.href.path.endsWith(this.data.section)) {\n selflink.href.addParameter(\"complete\", \"true\");\n selflink.href.hash = this.data.section;\n }\n }\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n if (!selflink.href.state) {\n selflink.href.state = {\n fragment: this.fragment,\n };\n } else {\n selflink.href.state.fragment = this.fragment;\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get fragment(): SectionFragment | void {\n return this.data.sectionFragment;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAOC,cAAc,MAAM,yBAAyB;AASpD;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAC3BP,SAAS,CAEnB;EAME;AACF;EACEQ,WAAWA,CACTC,IAAY,EAGZ;IAAA,IAFAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,YAA2B,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAE3B,KAAK,CAACJ,IAAI,EAAE,CAAC,CAAC,EAAEK,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBAVQ,IAAI;IAAAA,eAAA;IAY1C,IAAI,CAACC,UAAU,GAAGN,SAAS;EAC7B;;EAEA;AACF;EACE;EACAO,yBAAyBA,CAAA,EAAqB;IAC5C,IAAI,IAAI,CAACC,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,CAACC,WAAW,GAAG,IAAI;MACvC,OAAO,CAAC,IAAI,CAACD,eAAe,CAAC;IAC/B;IAEA,OAAO,EAAE;EACX;;EAEA;AACF;EACE;EACAE,cAAcA,CAACC,MAA6B,EAAE;IAC5C,IAAI,IAAI,CAACH,eAAe,EAAE;MACxB,MAAMI,IAAI,GAAG,IAAI,CAACJ,eAAe,CAACI,IAAI;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