@beinformed/ui 1.50.0 → 1.50.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/esm/models/content/ContentIndexModel.js +9 -4
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/SubSectionModel.js +8 -0
- package/esm/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +9 -4
- package/lib/models/content/ContentIndexModel.js.flow +7 -6
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js +8 -0
- package/lib/models/content/SubSectionModel.js.flow +9 -0
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/content/__tests__/ContentModel.spec.js.flow +22 -0
- package/package.json +1 -1
- package/src/models/content/ContentIndexModel.js +7 -6
- package/src/models/content/SubSectionModel.js +9 -0
- package/src/models/content/__tests__/ContentModel.spec.js +22 -0
- package/src/models/content/__tests__/content-with-subsections2.json +79 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.50.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.50.1...v1.50.2) (2024-07-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **content:** handle incorrect relatedConcepts links ([265ee33](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/265ee33db296149766dac6d94e57963953c05dd2))
|
|
11
|
+
|
|
12
|
+
## [1.50.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.50.0...v1.50.1) (2024-07-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **content:** improve indication if filters on content index are active ([29c9fec](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/29c9fec3ed0c8663b5c3d6c95b0888fece168003))
|
|
18
|
+
|
|
5
19
|
## [1.50.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.49.6...v1.50.0) (2024-07-08)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -107,11 +107,16 @@ export default class ContentIndexModel extends ResourceModel {
|
|
|
107
107
|
return filterAttribute instanceof ChoiceAttributeModel && filterAttribute.options.length > 0;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
*/
|
|
112
|
+
hasFiltersSet() {
|
|
113
|
+
return this.filterCollection.some(filter => filter.isActive());
|
|
114
|
+
}
|
|
115
|
+
|
|
110
116
|
/**
|
|
111
117
|
*/
|
|
112
118
|
hasNoFiltersSet() {
|
|
113
|
-
|
|
114
|
-
return this.items.isEmpty && _filterInstanceProperty(_context2 = this.filterCollection).call(_context2, filter => filter.attribute?.inputvalue !== "").length === 0;
|
|
119
|
+
return !this.hasFiltersSet();
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
/**
|
|
@@ -120,8 +125,8 @@ export default class ContentIndexModel extends ResourceModel {
|
|
|
120
125
|
const filterAttribute = this.indexfilter?.attribute;
|
|
121
126
|
let firstChar = "#";
|
|
122
127
|
if (filterAttribute instanceof ChoiceAttributeModel) {
|
|
123
|
-
var
|
|
124
|
-
firstChar = _filterInstanceProperty(
|
|
128
|
+
var _context2;
|
|
129
|
+
firstChar = _filterInstanceProperty(_context2 = filterAttribute.options).call(_context2, option => option.code !== "0")[0].code;
|
|
125
130
|
}
|
|
126
131
|
return new Href(this.selfhref.path).addParameter("index", firstChar);
|
|
127
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentIndexModel.js","names":["ResourceModel","ResourceCollection","FilterCollection","ContentLinkModel","Href","ChoiceAttributeModel","ContentIndexModel","constructor","modularuiResponse","_context","_defineProperty","_filterCollection","_filterInstanceProperty","data","filter","contributions","dynamicschema","_content","collection","_embedded","_mapInstanceProperty","results","call","content","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","hasIndexFilter","filterAttribute","attribute","options","length","
|
|
1
|
+
{"version":3,"file":"ContentIndexModel.js","names":["ResourceModel","ResourceCollection","FilterCollection","ContentLinkModel","Href","ChoiceAttributeModel","ContentIndexModel","constructor","modularuiResponse","_context","_defineProperty","_filterCollection","_filterInstanceProperty","data","filter","contributions","dynamicschema","_content","collection","_embedded","_mapInstanceProperty","results","call","content","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","hasIndexFilter","filterAttribute","attribute","options","length","hasFiltersSet","some","isActive","hasNoFiltersSet","getFirstCharHref","firstChar","_context2","option","code","path","addParameter"],"sources":["../../../src/models/content/ContentIndexModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport ChoiceAttributeModel from \"../attributes/ChoiceAttributeModel\";\n\nimport type { FilterType, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Get Index of concepts, to filter model catalog\n */\nexport default class ContentIndexModel extends ResourceModel {\n _filterCollection: FilterCollection;\n _content: ResourceCollection<ContentLinkModel>;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._filterCollection = new FilterCollection(this.data.filter, {\n filter: this.contributions.filter,\n dynamicschema: this.data.dynamicschema,\n });\n\n this._content = new ResourceCollection();\n this._content.collection = this.data._embedded\n ? this.data._embedded.results.map(\n (content) => new ContentLinkModel(content.content),\n )\n : [];\n }\n\n /**\n */\n get type(): string {\n return \"ContentIndex\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentIndexModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentSearch\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.items.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this.items.setChildModels(models, errors);\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\");\n }\n\n /**\n * Retrieve filters of conceptindex model\n */\n get filterCollection(): FilterCollection {\n return this._filterCollection;\n }\n\n /**\n * Get index filter\n */\n get indexfilter(): FilterType | null {\n return this._filterCollection.getFilterByAttributeKey(\"index\");\n }\n\n /**\n * Retrieve content collection\n */\n get items(): ResourceCollection<ContentLinkModel> {\n return this._content;\n }\n\n /**\n */\n hasIndexFilter(): boolean {\n const filterAttribute = this.indexfilter?.attribute;\n\n return (\n filterAttribute instanceof ChoiceAttributeModel &&\n filterAttribute.options.length > 0\n );\n }\n\n /**\n */\n hasFiltersSet(): boolean {\n return this.filterCollection.some((filter) => filter.isActive());\n }\n\n /**\n */\n hasNoFiltersSet(): boolean {\n return !this.hasFiltersSet();\n }\n\n /**\n */\n getFirstCharHref(): Href {\n const filterAttribute = this.indexfilter?.attribute;\n\n let firstChar = \"#\";\n if (filterAttribute instanceof ChoiceAttributeModel) {\n firstChar = filterAttribute.options.filter(\n (option) => option.code !== \"0\",\n )[0].code;\n }\n\n return new Href(this.selfhref.path).addParameter(\"index\", firstChar);\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,oBAAoB,MAAM,oCAAoC;AAOrE;AACA;AACA;AACA,eAAe,MAAMC,iBAAiB,SAASN,aAAa,CAAC;EAI3D;AACF;EACEO,WAAWA,CAACC,iBAAoC,EAAE;IAAA,IAAAC,QAAA;IAChD,KAAK,CAACD,iBAAiB,CAAC;IAACE,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIT,gBAAgB,CAAAU,uBAAA,CAAC,IAAI,CAACC,IAAI,GAAS;MAC9DC,MAAM,EAAAF,uBAAA,CAAE,IAAI,CAACG,aAAa,CAAO;MACjCC,aAAa,EAAE,IAAI,CAACH,IAAI,CAACG;IAC3B,CAAC,CAAC;IAEF,IAAI,CAACC,QAAQ,GAAG,IAAIhB,kBAAkB,CAAC,CAAC;IACxC,IAAI,CAACgB,QAAQ,CAACC,UAAU,GAAG,IAAI,CAACL,IAAI,CAACM,SAAS,GAC1CC,oBAAA,CAAAX,QAAA,OAAI,CAACI,IAAI,CAACM,SAAS,CAACE,OAAO,EAAAC,IAAA,CAAAb,QAAA,EACxBc,OAAO,IAAK,IAAIpB,gBAAgB,CAACoB,OAAO,CAACA,OAAO,CACnD,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,cAAc;EACvB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,mBAAmB;EAC5B;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;EACE,IAAIlB,KAAKA,CAAA,EAAyC;IAChD,OAAO,IAAI,CAACZ,QAAQ;EACtB;;EAEA;AACF;EACE+B,cAAcA,CAAA,EAAY;IACxB,MAAMC,eAAe,GAAG,IAAI,CAACH,WAAW,EAAEI,SAAS;IAEnD,OACED,eAAe,YAAY5C,oBAAoB,IAC/C4C,eAAe,CAACE,OAAO,CAACC,MAAM,GAAG,CAAC;EAEtC;;EAEA;AACF;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACjB,gBAAgB,CAACkB,IAAI,CAAExC,MAAM,IAAKA,MAAM,CAACyC,QAAQ,CAAC,CAAC,CAAC;EAClE;;EAEA;AACF;EACEC,eAAeA,CAAA,EAAY;IACzB,OAAO,CAAC,IAAI,CAACH,aAAa,CAAC,CAAC;EAC9B;;EAEA;AACF;EACEI,gBAAgBA,CAAA,EAAS;IACvB,MAAMR,eAAe,GAAG,IAAI,CAACH,WAAW,EAAEI,SAAS;IAEnD,IAAIQ,SAAS,GAAG,GAAG;IACnB,IAAIT,eAAe,YAAY5C,oBAAoB,EAAE;MAAA,IAAAsD,SAAA;MACnDD,SAAS,GAAG9C,uBAAA,CAAA+C,SAAA,GAAAV,eAAe,CAACE,OAAO,EAAA7B,IAAA,CAAAqC,SAAA,EAChCC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAK,GAC9B,CAAC,CAAC,CAAC,CAAC,CAACA,IAAI;IACX;IAEA,OAAO,IAAIzD,IAAI,CAAC,IAAI,CAAC6B,QAAQ,CAAC6B,IAAI,CAAC,CAACC,YAAY,CAAC,OAAO,EAAEL,SAAS,CAAC;EACtE;AACF","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
3
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
3
4
|
import { createHashFromHref } from "../../utils/helpers/createHash";
|
|
4
5
|
import BaseModel from "../base/BaseModel";
|
|
5
6
|
import LinkCollection from "../links/LinkCollection";
|
|
@@ -110,9 +111,16 @@ export default class SubSectionModel extends BaseModel {
|
|
|
110
111
|
get relatedConceptsHref() {
|
|
111
112
|
const relatedConceptsLink = this.links.getLinkByKey("relatedConcepts");
|
|
112
113
|
if (relatedConceptsLink) {
|
|
114
|
+
var _context2;
|
|
113
115
|
const {
|
|
114
116
|
href
|
|
115
117
|
} = relatedConceptsLink;
|
|
118
|
+
if (_includesInstanceProperty(_context2 = href.hash).call(_context2, "/relatedConcepts")) {
|
|
119
|
+
var _context3;
|
|
120
|
+
const firstPart = href.path.substring(0, href.path.lastIndexOf("/"));
|
|
121
|
+
href.path = firstPart + "/" + href.hash;
|
|
122
|
+
href.hash = _includesInstanceProperty(_context3 = href.hash).call(_context3, "#") ? href.hash.substring(href.hash.indexOf("#")) : "";
|
|
123
|
+
}
|
|
116
124
|
href.setReferenceHash(this.referenceHash);
|
|
117
125
|
return href;
|
|
118
126
|
}
|
|
@@ -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","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) => new SubSectionModel(subSection),\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 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 href.setReferenceHash(this.referenceHash);\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":"
|
|
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) => new SubSectionModel(subSection),\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 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.setReferenceHash(this.referenceHash);\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;;AAE1C;AACA;AACA;AACA,eAAe,MAAMC,eAAe,SAASL,SAAS,CAAC;EAGrD;AACF;E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,IAAI;QACvCT,IAAI,CAACS,IAAI,GAAGD,yBAAA,CAAAE,SAAA,GAAAV,IAAI,CAACS,IAAI,EAAAjB,IAAA,CAAAkB,SAAA,EAAU,GAAG,CAAC,GAC/BV,IAAI,CAACS,IAAI,CAACI,SAAS,CAACb,IAAI,CAACS,IAAI,CAACM,OAAO,CAAC,GAAG,CAAC,CAAC,GAC3C,EAAE;MACR;MAEAf,IAAI,CAACgB,gBAAgB,CAAC,IAAI,CAACC,aAAa,CAAC;MACzC,OAAOjB,IAAI;IACb;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIiB,aAAaA,CAAA,EAAW;IAC1B,MAAMlB,QAAQ,GAAG,IAAI,CAACA,QAAQ,IAAI,IAAIzB,IAAI,CAAC,CAAC;IAC5C,OAAOH,kBAAkB,CAAC4B,QAAQ,CAAC;EACrC;;EAEA;AACF;EACEmB,mBAAmBA,CAAA,EAA2B;IAC5C,MAAMC,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAM1B,UAAU,IAAI,IAAI,CAACJ,WAAW,EAAE;MACzC,IAAII,UAAU,CAACZ,QAAQ,EAAE;QACvBsC,QAAQ,CAACf,IAAI,CAACX,UAAU,CAAC;MAC3B;MAEA,MAAM2B,cAAc,GAAG3B,UAAU,CAACyB,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAACf,IAAI,CAAC,GAAGgB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF","ignoreList":[]}
|
|
@@ -114,11 +114,16 @@ class ContentIndexModel extends _ResourceModel.default {
|
|
|
114
114
|
return filterAttribute instanceof _ChoiceAttributeModel.default && filterAttribute.options.length > 0;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/**
|
|
118
|
+
*/
|
|
119
|
+
hasFiltersSet() {
|
|
120
|
+
return this.filterCollection.some(filter => filter.isActive());
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
/**
|
|
118
124
|
*/
|
|
119
125
|
hasNoFiltersSet() {
|
|
120
|
-
|
|
121
|
-
return this.items.isEmpty && (0, _filter.default)(_context2 = this.filterCollection).call(_context2, filter => filter.attribute?.inputvalue !== "").length === 0;
|
|
126
|
+
return !this.hasFiltersSet();
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
/**
|
|
@@ -127,8 +132,8 @@ class ContentIndexModel extends _ResourceModel.default {
|
|
|
127
132
|
const filterAttribute = this.indexfilter?.attribute;
|
|
128
133
|
let firstChar = "#";
|
|
129
134
|
if (filterAttribute instanceof _ChoiceAttributeModel.default) {
|
|
130
|
-
var
|
|
131
|
-
firstChar = (0, _filter.default)(
|
|
135
|
+
var _context2;
|
|
136
|
+
firstChar = (0, _filter.default)(_context2 = filterAttribute.options).call(_context2, option => option.code !== "0")[0].code;
|
|
132
137
|
}
|
|
133
138
|
return new _Href.default(this.selfhref.path).addParameter("index", firstChar);
|
|
134
139
|
}
|
|
@@ -126,15 +126,16 @@ export default class ContentIndexModel extends ResourceModel {
|
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
*/
|
|
131
|
+
hasFiltersSet(): boolean {
|
|
132
|
+
return this.filterCollection.some((filter) => filter.isActive());
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
/**
|
|
130
136
|
*/
|
|
131
137
|
hasNoFiltersSet(): boolean {
|
|
132
|
-
return (
|
|
133
|
-
this.items.isEmpty &&
|
|
134
|
-
this.filterCollection.filter(
|
|
135
|
-
(filter) => filter.attribute?.inputvalue !== "",
|
|
136
|
-
).length === 0
|
|
137
|
-
);
|
|
138
|
+
return !this.hasFiltersSet();
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentIndexModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ResourceCollection","_FilterCollection","_ContentLinkModel","_Href","_ChoiceAttributeModel","ContentIndexModel","ResourceModel","constructor","modularuiResponse","_context","_defineProperty2","default","_filterCollection","FilterCollection","_filter","data","filter","contributions","dynamicschema","_content","ResourceCollection","collection","_embedded","_map","results","call","content","ContentLinkModel","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","Href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","hasIndexFilter","filterAttribute","attribute","ChoiceAttributeModel","options","length","
|
|
1
|
+
{"version":3,"file":"ContentIndexModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ResourceCollection","_FilterCollection","_ContentLinkModel","_Href","_ChoiceAttributeModel","ContentIndexModel","ResourceModel","constructor","modularuiResponse","_context","_defineProperty2","default","_filterCollection","FilterCollection","_filter","data","filter","contributions","dynamicschema","_content","ResourceCollection","collection","_embedded","_map","results","call","content","ContentLinkModel","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","Href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","hasIndexFilter","filterAttribute","attribute","ChoiceAttributeModel","options","length","hasFiltersSet","some","isActive","hasNoFiltersSet","getFirstCharHref","firstChar","_context2","option","code","path","addParameter","exports"],"sources":["../../../src/models/content/ContentIndexModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport ChoiceAttributeModel from \"../attributes/ChoiceAttributeModel\";\n\nimport type { FilterType, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Get Index of concepts, to filter model catalog\n */\nexport default class ContentIndexModel extends ResourceModel {\n _filterCollection: FilterCollection;\n _content: ResourceCollection<ContentLinkModel>;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._filterCollection = new FilterCollection(this.data.filter, {\n filter: this.contributions.filter,\n dynamicschema: this.data.dynamicschema,\n });\n\n this._content = new ResourceCollection();\n this._content.collection = this.data._embedded\n ? this.data._embedded.results.map(\n (content) => new ContentLinkModel(content.content),\n )\n : [];\n }\n\n /**\n */\n get type(): string {\n return \"ContentIndex\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentIndexModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentSearch\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.items.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this.items.setChildModels(models, errors);\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\");\n }\n\n /**\n * Retrieve filters of conceptindex model\n */\n get filterCollection(): FilterCollection {\n return this._filterCollection;\n }\n\n /**\n * Get index filter\n */\n get indexfilter(): FilterType | null {\n return this._filterCollection.getFilterByAttributeKey(\"index\");\n }\n\n /**\n * Retrieve content collection\n */\n get items(): ResourceCollection<ContentLinkModel> {\n return this._content;\n }\n\n /**\n */\n hasIndexFilter(): boolean {\n const filterAttribute = this.indexfilter?.attribute;\n\n return (\n filterAttribute instanceof ChoiceAttributeModel &&\n filterAttribute.options.length > 0\n );\n }\n\n /**\n */\n hasFiltersSet(): boolean {\n return this.filterCollection.some((filter) => filter.isActive());\n }\n\n /**\n */\n hasNoFiltersSet(): boolean {\n return !this.hasFiltersSet();\n }\n\n /**\n */\n getFirstCharHref(): Href {\n const filterAttribute = this.indexfilter?.attribute;\n\n let firstChar = \"#\";\n if (filterAttribute instanceof ChoiceAttributeModel) {\n firstChar = filterAttribute.options.filter(\n (option) => option.code !== \"0\",\n )[0].code;\n }\n\n return new Href(this.selfhref.path).addParameter(\"index\", firstChar);\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,qBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAOA;AACA;AACA;AACe,MAAMM,iBAAiB,SAASC,sBAAa,CAAC;EAI3D;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAAA,IAAAC,QAAA;IAChD,KAAK,CAACD,iBAAiB,CAAC;IAAC,IAAAE,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAgB,KAAAC,OAAA,CAAAH,OAAA,EAAC,IAAI,CAACI,IAAI,GAAS;MAC9DC,MAAM,MAAAF,OAAA,CAAAH,OAAA,EAAE,IAAI,CAACM,aAAa,CAAO;MACjCC,aAAa,EAAE,IAAI,CAACH,IAAI,CAACG;IAC3B,CAAC,CAAC;IAEF,IAAI,CAACC,QAAQ,GAAG,IAAIC,2BAAkB,CAAC,CAAC;IACxC,IAAI,CAACD,QAAQ,CAACE,UAAU,GAAG,IAAI,CAACN,IAAI,CAACO,SAAS,GAC1C,IAAAC,IAAA,CAAAZ,OAAA,EAAAF,QAAA,OAAI,CAACM,IAAI,CAACO,SAAS,CAACE,OAAO,EAAAC,IAAA,CAA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,EAAEL,SAAS,CAAC;EACtE;AACF;AAACM,OAAA,CAAA3D,OAAA,GAAAN,iBAAA","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
9
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
10
11
|
var _createHash = require("../../utils/helpers/createHash");
|
|
11
12
|
var _BaseModel = _interopRequireDefault(require("../base/BaseModel"));
|
|
@@ -116,9 +117,16 @@ class SubSectionModel extends _BaseModel.default {
|
|
|
116
117
|
get relatedConceptsHref() {
|
|
117
118
|
const relatedConceptsLink = this.links.getLinkByKey("relatedConcepts");
|
|
118
119
|
if (relatedConceptsLink) {
|
|
120
|
+
var _context2;
|
|
119
121
|
const {
|
|
120
122
|
href
|
|
121
123
|
} = relatedConceptsLink;
|
|
124
|
+
if ((0, _includes.default)(_context2 = href.hash).call(_context2, "/relatedConcepts")) {
|
|
125
|
+
var _context3;
|
|
126
|
+
const firstPart = href.path.substring(0, href.path.lastIndexOf("/"));
|
|
127
|
+
href.path = firstPart + "/" + href.hash;
|
|
128
|
+
href.hash = (0, _includes.default)(_context3 = href.hash).call(_context3, "#") ? href.hash.substring(href.hash.indexOf("#")) : "";
|
|
129
|
+
}
|
|
122
130
|
href.setReferenceHash(this.referenceHash);
|
|
123
131
|
return href;
|
|
124
132
|
}
|
|
@@ -122,6 +122,15 @@ export default class SubSectionModel extends BaseModel {
|
|
|
122
122
|
|
|
123
123
|
if (relatedConceptsLink) {
|
|
124
124
|
const { href } = relatedConceptsLink;
|
|
125
|
+
|
|
126
|
+
if (href.hash.includes("/relatedConcepts")) {
|
|
127
|
+
const firstPart = href.path.substring(0, href.path.lastIndexOf("/"));
|
|
128
|
+
href.path = firstPart + "/" + href.hash;
|
|
129
|
+
href.hash = href.hash.includes("#")
|
|
130
|
+
? href.hash.substring(href.hash.indexOf("#"))
|
|
131
|
+
: "";
|
|
132
|
+
}
|
|
133
|
+
|
|
125
134
|
href.setReferenceHash(this.referenceHash);
|
|
126
135
|
return href;
|
|
127
136
|
}
|
|
@@ -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","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) => new SubSectionModel(subSection),\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 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 href.setReferenceHash(this.referenceHash);\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":"
|
|
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) => new SubSectionModel(subSection),\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 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.setReferenceHash(this.referenceHash);\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;AAEA;AACA;AACA;AACe,MAAMO,eAAe,SAASC,kBAAS,CAAC;EAGrD;AACF;EACEC,WAAWA,CAACC,IAAY,EAAE;IACxB,KAAK,CAACA,IAAI,EAAE,CAAC,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;EAClB;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACH,IAAI,CAACG,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,EAAEA,CAAA,EAAW;IACf,OAAO,IAAI,CAACJ,IAAI,CAACI,EAAE,IAAI,IAAI,CAACJ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,CAAC,GAC3C,EAAE;MACR;MAEAf,IAAI,CAACgB,gBAAgB,CAAC,IAAI,CAACC,aAAa,CAAC;MACzC,OAAOjB,IAAI;IACb;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIiB,aAAaA,CAAA,EAAW;IAC1B,MAAMlB,QAAQ,GAAG,IAAI,CAACA,QAAQ,IAAI,IAAImB,aAAI,CAAC,CAAC;IAC5C,OAAO,IAAAC,8BAAkB,EAACpB,QAAQ,CAAC;EACrC;;EAEA;AACF;EACEqB,mBAAmBA,CAAA,EAA2B;IAC5C,MAAMC,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAM7B,UAAU,IAAI,IAAI,CAACJ,WAAW,EAAE;MACzC,IAAII,UAAU,CAACb,QAAQ,EAAE;QACvB0C,QAAQ,CAACjB,IAAI,CAACZ,UAAU,CAAC;MAC3B;MAEA,MAAM8B,cAAc,GAAG9B,UAAU,CAAC4B,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAACjB,IAAI,CAAC,GAAGkB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF;AAACE,OAAA,CAAA7C,OAAA,GAAAL,eAAA","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ import contributions from "./contributions.json";
|
|
|
6
6
|
|
|
7
7
|
import content from "./content.json";
|
|
8
8
|
import contentWithSubsections from "./content-with-subsections.json";
|
|
9
|
+
import contentWithSubsections2 from "./content-with-subsections2.json";
|
|
9
10
|
import contentWithChildsections from "./content-with-childsections.json";
|
|
10
11
|
import ContentLinkModel from "../ContentLinkModel";
|
|
11
12
|
|
|
@@ -118,6 +119,27 @@ describe("contentmodel", () => {
|
|
|
118
119
|
);
|
|
119
120
|
});
|
|
120
121
|
|
|
122
|
+
it("can handle content service with subsections and correct related concepts", () => {
|
|
123
|
+
const response = ModularUIResponse.create({
|
|
124
|
+
key: "contentmodel",
|
|
125
|
+
data: contentWithSubsections2,
|
|
126
|
+
contributions,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const contentModel = new ContentModel(response);
|
|
130
|
+
expect(contentModel.relatedConceptsHrefs).toHaveLength(3);
|
|
131
|
+
|
|
132
|
+
expect(contentModel.relatedConceptsHrefs[0].toString()).toBe(
|
|
133
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1/relatedConcepts?entryDate=2024-07-17",
|
|
134
|
+
);
|
|
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",
|
|
137
|
+
);
|
|
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",
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
121
143
|
it("can handle content service with subsections", () => {
|
|
122
144
|
const response = ModularUIResponse.create({
|
|
123
145
|
key: "contentmodel",
|
package/package.json
CHANGED
|
@@ -126,15 +126,16 @@ export default class ContentIndexModel extends ResourceModel {
|
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
*/
|
|
131
|
+
hasFiltersSet(): boolean {
|
|
132
|
+
return this.filterCollection.some((filter) => filter.isActive());
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
/**
|
|
130
136
|
*/
|
|
131
137
|
hasNoFiltersSet(): boolean {
|
|
132
|
-
return (
|
|
133
|
-
this.items.isEmpty &&
|
|
134
|
-
this.filterCollection.filter(
|
|
135
|
-
(filter) => filter.attribute?.inputvalue !== "",
|
|
136
|
-
).length === 0
|
|
137
|
-
);
|
|
138
|
+
return !this.hasFiltersSet();
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
/**
|
|
@@ -122,6 +122,15 @@ export default class SubSectionModel extends BaseModel {
|
|
|
122
122
|
|
|
123
123
|
if (relatedConceptsLink) {
|
|
124
124
|
const { href } = relatedConceptsLink;
|
|
125
|
+
|
|
126
|
+
if (href.hash.includes("/relatedConcepts")) {
|
|
127
|
+
const firstPart = href.path.substring(0, href.path.lastIndexOf("/"));
|
|
128
|
+
href.path = firstPart + "/" + href.hash;
|
|
129
|
+
href.hash = href.hash.includes("#")
|
|
130
|
+
? href.hash.substring(href.hash.indexOf("#"))
|
|
131
|
+
: "";
|
|
132
|
+
}
|
|
133
|
+
|
|
125
134
|
href.setReferenceHash(this.referenceHash);
|
|
126
135
|
return href;
|
|
127
136
|
}
|
|
@@ -6,6 +6,7 @@ import contributions from "./contributions.json";
|
|
|
6
6
|
|
|
7
7
|
import content from "./content.json";
|
|
8
8
|
import contentWithSubsections from "./content-with-subsections.json";
|
|
9
|
+
import contentWithSubsections2 from "./content-with-subsections2.json";
|
|
9
10
|
import contentWithChildsections from "./content-with-childsections.json";
|
|
10
11
|
import ContentLinkModel from "../ContentLinkModel";
|
|
11
12
|
|
|
@@ -118,6 +119,27 @@ describe("contentmodel", () => {
|
|
|
118
119
|
);
|
|
119
120
|
});
|
|
120
121
|
|
|
122
|
+
it("can handle content service with subsections and correct related concepts", () => {
|
|
123
|
+
const response = ModularUIResponse.create({
|
|
124
|
+
key: "contentmodel",
|
|
125
|
+
data: contentWithSubsections2,
|
|
126
|
+
contributions,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const contentModel = new ContentModel(response);
|
|
130
|
+
expect(contentModel.relatedConceptsHrefs).toHaveLength(3);
|
|
131
|
+
|
|
132
|
+
expect(contentModel.relatedConceptsHrefs[0].toString()).toBe(
|
|
133
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1/relatedConcepts?entryDate=2024-07-17",
|
|
134
|
+
);
|
|
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",
|
|
137
|
+
);
|
|
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",
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
121
143
|
it("can handle content service with subsections", () => {
|
|
122
144
|
const response = ModularUIResponse.create({
|
|
123
145
|
key: "contentmodel",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"section": {
|
|
3
|
+
"_id": "Chapter5_1",
|
|
4
|
+
"label": "Eligibility Criteria",
|
|
5
|
+
"number": "5.1",
|
|
6
|
+
"body": "<p>Applications will need to meet the following eligibility criteria:</p>",
|
|
7
|
+
"subSections": [
|
|
8
|
+
{
|
|
9
|
+
"_id": "Chapter5_1a",
|
|
10
|
+
"number": "a.",
|
|
11
|
+
"body": "<p>The research project can be classified as innovative. This includes innovation levels 2 and 3 as described in Annex A.</p>",
|
|
12
|
+
"_links": {
|
|
13
|
+
"self": {
|
|
14
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1#Chapter5_1a"
|
|
15
|
+
},
|
|
16
|
+
"api_doc": {
|
|
17
|
+
"href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
|
|
18
|
+
},
|
|
19
|
+
"contributions": {
|
|
20
|
+
"href": "/contributions/content/(content-identifier)/(section-identifier)"
|
|
21
|
+
},
|
|
22
|
+
"relatedConcepts": {
|
|
23
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1#Chapter5_1a/relatedConcepts"
|
|
24
|
+
},
|
|
25
|
+
"content": {
|
|
26
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"_id": "Chapter5_1b",
|
|
32
|
+
"number": "b.",
|
|
33
|
+
"body": "<p>The research project contributes to open source, which includes the following projects:</p>",
|
|
34
|
+
"subSections": [],
|
|
35
|
+
"_links": {
|
|
36
|
+
"self": {
|
|
37
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1#Chapter5_1b"
|
|
38
|
+
},
|
|
39
|
+
"api_doc": {
|
|
40
|
+
"href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
|
|
41
|
+
},
|
|
42
|
+
"contributions": {
|
|
43
|
+
"href": "/contributions/content/(content-identifier)/(section-identifier)"
|
|
44
|
+
},
|
|
45
|
+
"relatedConcepts": {
|
|
46
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1#Chapter5_1b/relatedConcepts"
|
|
47
|
+
},
|
|
48
|
+
"content": {
|
|
49
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"_links": {
|
|
55
|
+
"self": {
|
|
56
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1"
|
|
57
|
+
},
|
|
58
|
+
"api_doc": {
|
|
59
|
+
"href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
|
|
60
|
+
},
|
|
61
|
+
"contributions": {
|
|
62
|
+
"href": "/contributions/content/(content-identifier)/(section-identifier)"
|
|
63
|
+
},
|
|
64
|
+
"relatedConcepts": {
|
|
65
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1/relatedConcepts"
|
|
66
|
+
},
|
|
67
|
+
"content": {
|
|
68
|
+
"href": "/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"filter": {
|
|
72
|
+
"entryDate": {
|
|
73
|
+
"param": "entryDate",
|
|
74
|
+
"name": "entryDate",
|
|
75
|
+
"value": "2024-07-17"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|