@beinformed/ui 1.58.3 → 1.58.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/esm/models/content/SectionModel.js +1 -1
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/content/SubSectionModel.js +12 -4
- package/esm/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +1 -1
- package/lib/models/content/SectionModel.js.flow +2 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js +12 -3
- package/lib/models/content/SubSectionModel.js.flow +20 -3
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/content/__tests__/ContentModel.spec.js.flow +3 -3
- package/package.json +2 -2
- package/src/models/content/SectionModel.js +2 -1
- package/src/models/content/SubSectionModel.js +20 -3
- package/src/models/content/__tests__/ContentModel.spec.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.58.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.58.3...v1.58.4) (2024-11-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **modelcatalog:** add entry date to related concepts link of subsections ([e0a20dc](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/e0a20dc1b3bb69cc967bd1a1c1dbf4cd677e0f93))
|
|
11
|
+
|
|
5
12
|
## [1.58.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.58.2...v1.58.3) (2024-11-20)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -139,7 +139,7 @@ class SectionModel extends BaseModel {
|
|
|
139
139
|
*/
|
|
140
140
|
get subSections() {
|
|
141
141
|
var _context4;
|
|
142
|
-
return this.data.subSections ? _mapInstanceProperty(_context4 = this.data.subSections).call(_context4, subSection => new SubSectionModel(subSection)) : [];
|
|
142
|
+
return this.data.subSections ? _mapInstanceProperty(_context4 = this.data.subSections).call(_context4, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\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 get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection)
|
|
1
|
+
{"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\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 get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAA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AAA,EAA0C;IAC3D,MAAML,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAC/B,QAAQ,EAAE;QACvB4B,QAAQ,CAACM,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMd,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzB4B,QAAQ,CAACM,IAAI,CAACb,YAAY,CAAC;MAC7B;MAEA,MAAMc,cAAc,GAAGd,YAAY,CAACY,mBAAmB,CAAC,CAAC;MACzDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOP,QAAQ;EACjB;AACF;AAEA,eAAenC,YAAY","ignoreList":[]}
|
|
@@ -7,16 +7,17 @@ import LinkCollection from "../links/LinkCollection";
|
|
|
7
7
|
import Href from "../href/Href";
|
|
8
8
|
import LinkModel from "../links/LinkModel";
|
|
9
9
|
import { retrieveText } from "../../utils";
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Link to a concept
|
|
13
12
|
*/
|
|
14
13
|
export default class SubSectionModel extends BaseModel {
|
|
15
14
|
/**
|
|
16
15
|
*/
|
|
17
|
-
constructor(data) {
|
|
18
|
-
super(data, {});
|
|
16
|
+
constructor(data, entryDate, modelOptions) {
|
|
17
|
+
super(data, {}, modelOptions);
|
|
18
|
+
_defineProperty(this, "_entryDate", void 0);
|
|
19
19
|
_defineProperty(this, "_links", void 0);
|
|
20
|
+
this._entryDate = entryDate;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -65,7 +66,7 @@ export default class SubSectionModel extends BaseModel {
|
|
|
65
66
|
*/
|
|
66
67
|
get subSections() {
|
|
67
68
|
var _context;
|
|
68
|
-
return this.data.subSections ? _mapInstanceProperty(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection)) : [];
|
|
69
|
+
return this.data.subSections ? _mapInstanceProperty(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/**
|
|
@@ -92,6 +93,12 @@ export default class SubSectionModel extends BaseModel {
|
|
|
92
93
|
return this.selflink ? this.selflink.href : null;
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
/**
|
|
97
|
+
*/
|
|
98
|
+
get entryDate() {
|
|
99
|
+
return this._entryDate;
|
|
100
|
+
}
|
|
101
|
+
|
|
95
102
|
/**
|
|
96
103
|
*/
|
|
97
104
|
get relatedConceptsHrefs() {
|
|
@@ -121,6 +128,7 @@ export default class SubSectionModel extends BaseModel {
|
|
|
121
128
|
href.path = firstPart + "/" + href.hash;
|
|
122
129
|
href.hash = _includesInstanceProperty(_context3 = href.hash).call(_context3, "#") ? href.hash.substring(href.hash.indexOf("#")) : "";
|
|
123
130
|
}
|
|
131
|
+
href.addParameter("entryDate", this.entryDate);
|
|
124
132
|
href.setReferenceHash(this.referenceHash);
|
|
125
133
|
return href;
|
|
126
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubSectionModel.js","names":["createHashFromHref","BaseModel","LinkCollection","Href","LinkModel","retrieveText","SubSectionModel","constructor","data","_defineProperty","referred","id","_id","key","body","getData","number","label","subSections","_context","_mapInstanceProperty","call","subSection","links","_links","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includesInstanceProperty","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","setReferenceHash","referenceHash","getReferredSections","sections","referredChilds"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _links: LinkCollection;\n\n /**\n */\n constructor(data: Object) {\n super(data, {});\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection)
|
|
1
|
+
{"version":3,"file":"SubSectionModel.js","names":["createHashFromHref","BaseModel","LinkCollection","Href","LinkModel","retrieveText","SubSectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","id","_id","key","body","getData","number","label","subSections","_context","_mapInstanceProperty","call","subSection","links","_links","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includesInstanceProperty","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","addParameter","setReferenceHash","referenceHash","getReferredSections","sections","referredChilds"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _links: LinkCollection;\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 get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n * Retrieve links of section\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel | null {\n return this.links.getLinkByKey(\"self\");\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href | null {\n return this.selflink ? this.selflink.href : null;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n\n if (href.hash.includes(\"/relatedConcepts\")) {\n const firstPart = href.path.substring(0, href.path.lastIndexOf(\"/\"));\n href.path = firstPart + \"/\" + href.hash;\n href.hash = href.hash.includes(\"#\")\n ? href.hash.substring(href.hash.indexOf(\"#\"))\n : \"\";\n }\n\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n const selfhref = this.selfhref || new Href();\n return createHashFromHref(selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n"],"mappings":";;;AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,SAASC,YAAY,QAAQ,aAAa;AAG1C;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASL,SAAS,CAAC;EAIrD;AACF;EACEM,WAAWA,CACTC,IAAY,EACZC,SAA0B,EAC1BC,YAA2B,EAC3B;IACA,KAAK,CAACF,IAAI,EAAE,CAAC,CAAC,EAAEE,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAE9B,IAAI,CAACC,UAAU,GAAGH,SAAS;EAC7B;;EAEA;AACF;EACE,IAAII,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACL,IAAI,CAACK,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,EAAEA,CAAA,EAAW;IACf,OAAO,IAAI,CAACN,IAAI,CAACM,EAAE,IAAI,IAAI,CAACN,IAAI,CAACO,GAAG;EACtC;;EAEA;AACF;AACA;EAC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AO,CAAC,GAAG,CAAC,CAAC,GAC3C,EAAE;MACR;MAEAf,IAAI,CAACgB,YAAY,CAAC,WAAW,EAAE,IAAI,CAACvC,SAAS,CAAC;MAC9CuB,IAAI,CAACiB,gBAAgB,CAAC,IAAI,CAACC,aAAa,CAAC;MAEzC,OAAOlB,IAAI;IACb;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIkB,aAAaA,CAAA,EAAW;IAC1B,MAAMnB,QAAQ,GAAG,IAAI,CAACA,QAAQ,IAAI,IAAI5B,IAAI,CAAC,CAAC;IAC5C,OAAOH,kBAAkB,CAAC+B,QAAQ,CAAC;EACrC;;EAEA;AACF;EACEoB,mBAAmBA,CAAA,EAA2B;IAC5C,MAAMC,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAM3B,UAAU,IAAI,IAAI,CAACJ,WAAW,EAAE;MACzC,IAAII,UAAU,CAACZ,QAAQ,EAAE;QACvBuC,QAAQ,CAAChB,IAAI,CAACX,UAAU,CAAC;MAC3B;MAEA,MAAM4B,cAAc,GAAG5B,UAAU,CAAC0B,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAAChB,IAAI,CAAC,GAAGiB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF","ignoreList":[]}
|
|
@@ -146,7 +146,7 @@ class SectionModel extends _BaseModel.default {
|
|
|
146
146
|
*/
|
|
147
147
|
get subSections() {
|
|
148
148
|
var _context4;
|
|
149
|
-
return this.data.subSections ? (0, _map.default)(_context4 = this.data.subSections).call(_context4, subSection => new _SubSectionModel.default(subSection)) : [];
|
|
149
|
+
return this.data.subSections ? (0, _map.default)(_context4 = this.data.subSections).call(_context4, subSection => new _SubSectionModel.default(subSection, this.entryDate, this.modelOptions)) : [];
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/**
|
|
@@ -170,7 +170,8 @@ class SectionModel extends BaseModel {
|
|
|
170
170
|
get subSections(): Array<SubSectionModel> {
|
|
171
171
|
return this.data.subSections
|
|
172
172
|
? this.data.subSections.map(
|
|
173
|
-
(subSection) =>
|
|
173
|
+
(subSection) =>
|
|
174
|
+
new SubSectionModel(subSection, this.entryDate, this.modelOptions),
|
|
174
175
|
)
|
|
175
176
|
: [];
|
|
176
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ContentLinkModel","_SubSectionModel","_createHash","_LinkModel","_utils","SectionModel","BaseModel","constructor","data","entryDate","modelOptions","_defineProperty2","default","_entryDate","referred","selflink","_selflink","LinkModel","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","retrieveText","childSectionLinks","_context","childSections","_map","call","childSection","ContentLinkModel","section","selfContentLink","_childSections","_context2","_context3","_filter","sections","subSections","_context4","subSection","SubSectionModel","referenceHash","createHashFromHref","getReferredSections","push","referredChilds","_default","exports"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\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 get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection)
|
|
1
|
+
{"version":3,"file":"SectionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ContentLinkModel","_SubSectionModel","_createHash","_LinkModel","_utils","SectionModel","BaseModel","constructor","data","entryDate","modelOptions","_defineProperty2","default","_entryDate","referred","selflink","_selflink","LinkModel","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","retrieveText","childSectionLinks","_context","childSections","_map","call","childSection","ContentLinkModel","section","selfContentLink","_childSections","_context2","_context3","_filter","sections","subSections","_context4","subSection","SubSectionModel","referenceHash","createHashFromHref","getReferredSections","push","referredChilds","_default","exports"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\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 get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA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e,CAACD,UAAU,EAAE,IAAI,CAACvC,SAAS,EAAE,IAAI,CAACC,YAAY,CACrE,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAIwC,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAAC,8BAAkB,EAAC,IAAI,CAAC/B,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACEgC,mBAAmBA,CAAA,EAA0C;IAC3D,MAAMP,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAClC,QAAQ,EAAE;QACvB+B,QAAQ,CAACQ,IAAI,CAACL,UAAU,CAAC;MAC3B;MAEA,MAAMM,cAAc,GAAGN,UAAU,CAACI,mBAAmB,CAAC,CAAC;MACvDP,QAAQ,CAACQ,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMjB,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACvB,QAAQ,EAAE;QACzB+B,QAAQ,CAACQ,IAAI,CAAChB,YAAY,CAAC;MAC7B;MAEA,MAAMiB,cAAc,GAAGjB,YAAY,CAACe,mBAAmB,CAAC,CAAC;MACzDP,QAAQ,CAACQ,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOT,QAAQ;EACjB;AACF;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAEcP,YAAY","ignoreList":[]}
|
|
@@ -20,9 +20,11 @@ var _utils = require("../../utils");
|
|
|
20
20
|
class SubSectionModel extends _BaseModel.default {
|
|
21
21
|
/**
|
|
22
22
|
*/
|
|
23
|
-
constructor(data) {
|
|
24
|
-
super(data, {});
|
|
23
|
+
constructor(data, entryDate, modelOptions) {
|
|
24
|
+
super(data, {}, modelOptions);
|
|
25
|
+
(0, _defineProperty2.default)(this, "_entryDate", void 0);
|
|
25
26
|
(0, _defineProperty2.default)(this, "_links", void 0);
|
|
27
|
+
this._entryDate = entryDate;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -71,7 +73,7 @@ class SubSectionModel extends _BaseModel.default {
|
|
|
71
73
|
*/
|
|
72
74
|
get subSections() {
|
|
73
75
|
var _context;
|
|
74
|
-
return this.data.subSections ? (0, _map.default)(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection)) : [];
|
|
76
|
+
return this.data.subSections ? (0, _map.default)(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/**
|
|
@@ -98,6 +100,12 @@ class SubSectionModel extends _BaseModel.default {
|
|
|
98
100
|
return this.selflink ? this.selflink.href : null;
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
/**
|
|
104
|
+
*/
|
|
105
|
+
get entryDate() {
|
|
106
|
+
return this._entryDate;
|
|
107
|
+
}
|
|
108
|
+
|
|
101
109
|
/**
|
|
102
110
|
*/
|
|
103
111
|
get relatedConceptsHrefs() {
|
|
@@ -127,6 +135,7 @@ class SubSectionModel extends _BaseModel.default {
|
|
|
127
135
|
href.path = firstPart + "/" + href.hash;
|
|
128
136
|
href.hash = (0, _includes.default)(_context3 = href.hash).call(_context3, "#") ? href.hash.substring(href.hash.indexOf("#")) : "";
|
|
129
137
|
}
|
|
138
|
+
href.addParameter("entryDate", this.entryDate);
|
|
130
139
|
href.setReferenceHash(this.referenceHash);
|
|
131
140
|
return href;
|
|
132
141
|
}
|
|
@@ -6,17 +6,25 @@ import LinkCollection from "../links/LinkCollection";
|
|
|
6
6
|
import Href from "../href/Href";
|
|
7
7
|
import LinkModel from "../links/LinkModel";
|
|
8
8
|
import { retrieveText } from "../../utils";
|
|
9
|
+
import type { ModelOptions } from "../types";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Link to a concept
|
|
12
13
|
*/
|
|
13
14
|
export default class SubSectionModel extends BaseModel {
|
|
15
|
+
_entryDate: ISO_DATE | null;
|
|
14
16
|
_links: LinkCollection;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
*/
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
20
|
+
constructor(
|
|
21
|
+
data: Object,
|
|
22
|
+
entryDate: ISO_DATE | null,
|
|
23
|
+
modelOptions?: ModelOptions,
|
|
24
|
+
) {
|
|
25
|
+
super(data, {}, modelOptions);
|
|
26
|
+
|
|
27
|
+
this._entryDate = entryDate;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
/**
|
|
@@ -66,7 +74,8 @@ export default class SubSectionModel extends BaseModel {
|
|
|
66
74
|
get subSections(): Array<SubSectionModel> {
|
|
67
75
|
return this.data.subSections
|
|
68
76
|
? this.data.subSections.map(
|
|
69
|
-
(subSection) =>
|
|
77
|
+
(subSection) =>
|
|
78
|
+
new SubSectionModel(subSection, this.entryDate, this.modelOptions),
|
|
70
79
|
)
|
|
71
80
|
: [];
|
|
72
81
|
}
|
|
@@ -99,6 +108,12 @@ export default class SubSectionModel extends BaseModel {
|
|
|
99
108
|
return this.selflink ? this.selflink.href : null;
|
|
100
109
|
}
|
|
101
110
|
|
|
111
|
+
/**
|
|
112
|
+
*/
|
|
113
|
+
get entryDate(): ISO_DATE | null {
|
|
114
|
+
return this._entryDate;
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
/**
|
|
103
118
|
*/
|
|
104
119
|
get relatedConceptsHrefs(): Array<Href> {
|
|
@@ -131,7 +146,9 @@ export default class SubSectionModel extends BaseModel {
|
|
|
131
146
|
: "";
|
|
132
147
|
}
|
|
133
148
|
|
|
149
|
+
href.addParameter("entryDate", this.entryDate);
|
|
134
150
|
href.setReferenceHash(this.referenceHash);
|
|
151
|
+
|
|
135
152
|
return href;
|
|
136
153
|
}
|
|
137
154
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubSectionModel.js","names":["_createHash","require","_BaseModel","_interopRequireDefault","_LinkCollection","_Href","_LinkModel","_utils","SubSectionModel","BaseModel","constructor","data","_defineProperty2","default","referred","id","_id","key","body","getData","retrieveText","number","label","subSections","_context","_map","call","subSection","links","_links","LinkCollection","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includes","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","setReferenceHash","referenceHash","Href","createHashFromHref","getReferredSections","sections","referredChilds","exports"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _links: LinkCollection;\n\n /**\n */\n constructor(data: Object) {\n super(data, {});\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection)
|
|
1
|
+
{"version":3,"file":"SubSectionModel.js","names":["_createHash","require","_BaseModel","_interopRequireDefault","_LinkCollection","_Href","_LinkModel","_utils","SubSectionModel","BaseModel","constructor","data","entryDate","modelOptions","_defineProperty2","default","_entryDate","referred","id","_id","key","body","getData","retrieveText","number","label","subSections","_context","_map","call","subSection","links","_links","LinkCollection","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includes","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","addParameter","setReferenceHash","referenceHash","Href","createHashFromHref","getReferredSections","sections","referredChilds","exports"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _links: LinkCollection;\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 get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n * Retrieve links of section\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel | null {\n return this.links.getLinkByKey(\"self\");\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href | null {\n return this.selflink ? this.selflink.href : null;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n\n if (href.hash.includes(\"/relatedConcepts\")) {\n const firstPart = href.path.substring(0, href.path.lastIndexOf(\"/\"));\n href.path = firstPart + \"/\" + href.hash;\n href.hash = href.hash.includes(\"#\")\n ? href.hash.substring(href.hash.indexOf(\"#\"))\n : \"\";\n }\n\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n const selfhref = this.selfhref || new Href();\n return createHashFromHref(selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,UAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAGA;AACA;AACA;AACe,MAAMO,eAAe,SAASC,kBAAS,CAAC;EA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,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAAClB,IAAI,CAAC,GAAGmB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF;AAACE,OAAA,CAAA/C,OAAA,GAAAP,eAAA","ignoreList":[]}
|
|
@@ -133,10 +133,10 @@ describe("contentmodel", () => {
|
|
|
133
133
|
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1/relatedConcepts?entryDate=2024-07-17",
|
|
134
134
|
);
|
|
135
135
|
expect(contentModel.relatedConceptsHrefs[1].toString()).toBe(
|
|
136
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts",
|
|
136
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts?entryDate=2024-07-17",
|
|
137
137
|
);
|
|
138
138
|
expect(contentModel.relatedConceptsHrefs[2].toString()).toBe(
|
|
139
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts",
|
|
139
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts?entryDate=2024-07-17",
|
|
140
140
|
);
|
|
141
141
|
});
|
|
142
142
|
|
|
@@ -196,7 +196,7 @@ describe("contentmodel", () => {
|
|
|
196
196
|
);
|
|
197
197
|
expect(firstSubSection.relatedConceptsHrefs).toHaveLength(1);
|
|
198
198
|
expect(firstSubSection.relatedConceptsHref.href.toString()).toBe(
|
|
199
|
-
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts",
|
|
199
|
+
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts?entryDate=2021-08-31",
|
|
200
200
|
);
|
|
201
201
|
expect(firstSubSection.relatedConceptsHref.getReferenceHash()).toBe(
|
|
202
202
|
145842294,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.58.
|
|
3
|
+
"version": "1.58.4",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"jscodeshift": "^17.1.1",
|
|
142
142
|
"lint-staged": "^15.2.10",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^3.
|
|
144
|
+
"prettier": "^3.4.0",
|
|
145
145
|
"react": "^18.3.1",
|
|
146
146
|
"react-dom": "^18.3.1",
|
|
147
147
|
"react-helmet-async": "^2.0.5",
|
|
@@ -170,7 +170,8 @@ class SectionModel extends BaseModel {
|
|
|
170
170
|
get subSections(): Array<SubSectionModel> {
|
|
171
171
|
return this.data.subSections
|
|
172
172
|
? this.data.subSections.map(
|
|
173
|
-
(subSection) =>
|
|
173
|
+
(subSection) =>
|
|
174
|
+
new SubSectionModel(subSection, this.entryDate, this.modelOptions),
|
|
174
175
|
)
|
|
175
176
|
: [];
|
|
176
177
|
}
|
|
@@ -6,17 +6,25 @@ import LinkCollection from "../links/LinkCollection";
|
|
|
6
6
|
import Href from "../href/Href";
|
|
7
7
|
import LinkModel from "../links/LinkModel";
|
|
8
8
|
import { retrieveText } from "../../utils";
|
|
9
|
+
import type { ModelOptions } from "../types";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Link to a concept
|
|
12
13
|
*/
|
|
13
14
|
export default class SubSectionModel extends BaseModel {
|
|
15
|
+
_entryDate: ISO_DATE | null;
|
|
14
16
|
_links: LinkCollection;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
*/
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
20
|
+
constructor(
|
|
21
|
+
data: Object,
|
|
22
|
+
entryDate: ISO_DATE | null,
|
|
23
|
+
modelOptions?: ModelOptions,
|
|
24
|
+
) {
|
|
25
|
+
super(data, {}, modelOptions);
|
|
26
|
+
|
|
27
|
+
this._entryDate = entryDate;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
/**
|
|
@@ -66,7 +74,8 @@ export default class SubSectionModel extends BaseModel {
|
|
|
66
74
|
get subSections(): Array<SubSectionModel> {
|
|
67
75
|
return this.data.subSections
|
|
68
76
|
? this.data.subSections.map(
|
|
69
|
-
(subSection) =>
|
|
77
|
+
(subSection) =>
|
|
78
|
+
new SubSectionModel(subSection, this.entryDate, this.modelOptions),
|
|
70
79
|
)
|
|
71
80
|
: [];
|
|
72
81
|
}
|
|
@@ -99,6 +108,12 @@ export default class SubSectionModel extends BaseModel {
|
|
|
99
108
|
return this.selflink ? this.selflink.href : null;
|
|
100
109
|
}
|
|
101
110
|
|
|
111
|
+
/**
|
|
112
|
+
*/
|
|
113
|
+
get entryDate(): ISO_DATE | null {
|
|
114
|
+
return this._entryDate;
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
/**
|
|
103
118
|
*/
|
|
104
119
|
get relatedConceptsHrefs(): Array<Href> {
|
|
@@ -131,7 +146,9 @@ export default class SubSectionModel extends BaseModel {
|
|
|
131
146
|
: "";
|
|
132
147
|
}
|
|
133
148
|
|
|
149
|
+
href.addParameter("entryDate", this.entryDate);
|
|
134
150
|
href.setReferenceHash(this.referenceHash);
|
|
151
|
+
|
|
135
152
|
return href;
|
|
136
153
|
}
|
|
137
154
|
|
|
@@ -133,10 +133,10 @@ describe("contentmodel", () => {
|
|
|
133
133
|
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1/relatedConcepts?entryDate=2024-07-17",
|
|
134
134
|
);
|
|
135
135
|
expect(contentModel.relatedConceptsHrefs[1].toString()).toBe(
|
|
136
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts",
|
|
136
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts?entryDate=2024-07-17",
|
|
137
137
|
);
|
|
138
138
|
expect(contentModel.relatedConceptsHrefs[2].toString()).toBe(
|
|
139
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts",
|
|
139
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts?entryDate=2024-07-17",
|
|
140
140
|
);
|
|
141
141
|
});
|
|
142
142
|
|
|
@@ -196,7 +196,7 @@ describe("contentmodel", () => {
|
|
|
196
196
|
);
|
|
197
197
|
expect(firstSubSection.relatedConceptsHrefs).toHaveLength(1);
|
|
198
198
|
expect(firstSubSection.relatedConceptsHref.href.toString()).toBe(
|
|
199
|
-
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts",
|
|
199
|
+
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts?entryDate=2021-08-31",
|
|
200
200
|
);
|
|
201
201
|
expect(firstSubSection.relatedConceptsHref.getReferenceHash()).toBe(
|
|
202
202
|
145842294,
|