@beinformed/ui 1.61.1 → 1.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/esm/models/attributes/__tests__/AttributeContent.spec.js.flow +1 -1
  3. package/esm/models/concepts/ConceptIndexModel.js +1 -1
  4. package/esm/models/concepts/ConceptIndexModel.js.flow +3 -1
  5. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  6. package/esm/models/concepts/ConceptLinkModel.d.ts +15 -0
  7. package/esm/models/concepts/ConceptLinkModel.js +14 -0
  8. package/esm/models/concepts/ConceptLinkModel.js.flow +21 -0
  9. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  10. package/esm/models/concepts/SourceReferenceModel.d.ts +9 -0
  11. package/esm/models/concepts/SourceReferenceModel.js +14 -0
  12. package/esm/models/concepts/SourceReferenceModel.js.flow +15 -1
  13. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  14. package/esm/models/concepts/__mock__/related_concepts.js.flow +12 -0
  15. package/esm/models/concepts/__tests__/RelatedConcepts.spec.js.flow +60 -0
  16. package/esm/models/concepts/__tests__/SourceReferenceModel.spec.js.flow +58 -0
  17. package/esm/models/content/ContentLinkModel.d.ts +8 -0
  18. package/esm/models/content/ContentLinkModel.js +20 -0
  19. package/esm/models/content/ContentLinkModel.js.flow +22 -0
  20. package/esm/models/content/ContentLinkModel.js.map +1 -1
  21. package/esm/models/content/ContentTOCModel.d.ts +3 -0
  22. package/esm/models/content/ContentTOCModel.js +6 -0
  23. package/esm/models/content/ContentTOCModel.js.flow +6 -0
  24. package/esm/models/content/ContentTOCModel.js.map +1 -1
  25. package/esm/models/content/__tests__/ContentIndexModel.spec.js.flow +3 -0
  26. package/esm/models/content/__tests__/ContentModel.spec.js.flow +5 -5
  27. package/esm/models/content/__tests__/Formalsource.spec.js.flow +4 -0
  28. package/esm/models/types.d.ts +6 -0
  29. package/esm/models/types.js.flow +7 -0
  30. package/esm/models/types.js.map +1 -1
  31. package/esm/utils/helpers/__tests__/createHash.spec.js.flow +5 -5
  32. package/esm/utils/helpers/createHash.d.ts +2 -1
  33. package/esm/utils/helpers/createHash.js +10 -9
  34. package/esm/utils/helpers/createHash.js.flow +10 -10
  35. package/esm/utils/helpers/createHash.js.map +1 -1
  36. package/lib/models/concepts/ConceptIndexModel.js +1 -1
  37. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  38. package/lib/models/concepts/ConceptLinkModel.d.ts +15 -0
  39. package/lib/models/concepts/ConceptLinkModel.js +14 -0
  40. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  41. package/lib/models/concepts/SourceReferenceModel.d.ts +9 -0
  42. package/lib/models/concepts/SourceReferenceModel.js +14 -0
  43. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  44. package/lib/models/content/ContentLinkModel.d.ts +8 -0
  45. package/lib/models/content/ContentLinkModel.js +20 -0
  46. package/lib/models/content/ContentLinkModel.js.map +1 -1
  47. package/lib/models/content/ContentTOCModel.d.ts +3 -0
  48. package/lib/models/content/ContentTOCModel.js +6 -0
  49. package/lib/models/content/ContentTOCModel.js.map +1 -1
  50. package/lib/models/types.d.ts +6 -0
  51. package/lib/models/types.js.map +1 -1
  52. package/lib/utils/helpers/createHash.d.ts +2 -1
  53. package/lib/utils/helpers/createHash.js +11 -9
  54. package/lib/utils/helpers/createHash.js.map +1 -1
  55. package/package.json +3 -1
  56. package/src/models/attributes/__tests__/AttributeContent.spec.js +1 -1
  57. package/src/models/concepts/ConceptIndexModel.js +3 -1
  58. package/src/models/concepts/ConceptLinkModel.js +21 -0
  59. package/src/models/concepts/SourceReferenceModel.js +15 -1
  60. package/src/models/concepts/__mock__/related_concepts.js +12 -0
  61. package/src/models/concepts/__mock__/related_concepts_contributions.json +41 -0
  62. package/src/models/concepts/__mock__/related_concepts_data.json +2292 -0
  63. package/src/models/concepts/__tests__/RelatedConcepts.spec.js +60 -0
  64. package/src/models/concepts/__tests__/SourceReferenceModel.spec.js +58 -0
  65. package/src/models/content/ContentLinkModel.js +22 -0
  66. package/src/models/content/ContentTOCModel.js +6 -0
  67. package/src/models/content/__tests__/ContentIndexModel.spec.js +3 -0
  68. package/src/models/content/__tests__/ContentModel.spec.js +5 -5
  69. package/src/models/content/__tests__/Formalsource.spec.js +4 -0
  70. package/src/models/content/__tests__/content-index.json +1 -0
  71. package/src/models/content/__tests__/formalsource-complete.json +1 -0
  72. package/src/models/types.js +7 -0
  73. package/src/utils/helpers/__tests__/createHash.spec.js +5 -5
  74. package/src/utils/helpers/createHash.js +10 -10
@@ -95,6 +95,13 @@ class ContentLinkModel extends _BaseModel.default {
95
95
  return this.getData("sourceLabel");
96
96
  }
97
97
 
98
+ /**
99
+ *
100
+ */
101
+ get abbreviation() {
102
+ return this.getData("abbreviation") || this.getData("sourceAbbreviation");
103
+ }
104
+
98
105
  /**
99
106
  */
100
107
  createEncodedHref() {
@@ -141,6 +148,13 @@ class ContentLinkModel extends _BaseModel.default {
141
148
  if (selflink === null) {
142
149
  throw new Error(`Could not find self link for ${this.key === null ? "unknown" : this.key}`);
143
150
  }
151
+ if (!selflink.href.state) {
152
+ selflink.href.state = {
153
+ fragment: this.fragment
154
+ };
155
+ } else {
156
+ selflink.href.state.fragment = this.fragment;
157
+ }
144
158
  return selflink;
145
159
  }
146
160
 
@@ -176,6 +190,12 @@ class ContentLinkModel extends _BaseModel.default {
176
190
  return null;
177
191
  }
178
192
 
193
+ /**
194
+ */
195
+ get fragment() {
196
+ return this.data.sectionFragment;
197
+ }
198
+
179
199
  /**
180
200
  * Children of link model in TOC
181
201
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ContentLinkModel.js","names":["_BaseModel","_interopRequireDefault","require","_Href","_LinkModel","_ContentTypeModel","_Constants","_LinkCollection","ContentLinkModel","BaseModel","constructor","data","entryDate","arguments","length","undefined","modelOptions","_defineProperty2","default","_entryDate","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_find","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","ContentTypeModel","key","getData","label","sourceLabel","createEncodedHref","startURI","selfHref","Href","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","TIMEVERSION_FILTER_NAME","links","LinkCollection","Array","isArray","selflink","getLinkByKey","Error","subSectionID","hash","contentTypeHref","items","_items","exports"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type {\n ModularUIModel,\n IModelWithChildModels,\n ModelOptions,\n} from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n const startURI = \"/content/\";\n const selfHref = new Href(\n this.data._links.self.href,\n \"\",\n this.modelOptions,\n );\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this.modelOptions,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAQA;AACA;AACA;AACe,MAAMM,gBAAgB,SAC3BC,kBAAS,CAEnB;EAME;AACF;EACEC,WAAWA,CACTC,IAAY,EAGZ;IAAA,IAFAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,YAA2B,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAE3B,KAAK,CAACJ,IAAI,EAAE,CAAC,CAAC,EAAEK,YAAY,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,wBAVQ,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAY1C,IAAI,CAACC,UAAU,GAAGP,SAAS;EAC7B;;EAEA;AACF;EACE;EACAQ,yBAAyBA,CAAA,EAA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A,CAACA,KAA8B,EAAE;IACxC,IAAI,CAACC,MAAM,GAAGD,KAAK;EACrB;;EAEA;AACF;EACE,IAAIA,KAAKA,CAAA,EAA4B;IACnC,OAAO,IAAI,CAACC,MAAM;EACpB;AACF;AAACC,OAAA,CAAAjD,OAAA,GAAAV,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"ContentLinkModel.js","names":["_BaseModel","_interopRequireDefault","require","_Href","_LinkModel","_ContentTypeModel","_Constants","_LinkCollection","ContentLinkModel","BaseModel","constructor","data","entryDate","arguments","length","undefined","modelOptions","_defineProperty2","default","_entryDate","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_find","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","ContentTypeModel","key","getData","label","sourceLabel","abbreviation","createEncodedHref","startURI","selfHref","Href","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","TIMEVERSION_FILTER_NAME","links","LinkCollection","Array","isArray","selflink","getLinkByKey","Error","state","fragment","subSectionID","hash","contentTypeHref","sectionFragment","items","_items","exports"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type {\n ModularUIModel,\n IModelWithChildModels,\n ModelOptions,\n SectionFragment,\n} from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n *\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\") || this.getData(\"sourceAbbreviation\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n const startURI = \"/content/\";\n const selfHref = new Href(\n this.data._links.self.href,\n \"\",\n this.modelOptions,\n );\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this.modelOptions,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n if (!selflink.href.state) {\n selflink.href.state = {\n fragment: this.fragment,\n };\n } else {\n selflink.href.state.fragment = this.fragment;\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get fragment(): SectionFragment | void {\n return this.data.sectionFragment;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAA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IA,KAAKA,CAAA,EAA4B;IACnC,OAAO,IAAI,CAACC,MAAM;EACpB;AACF;AAACC,OAAA,CAAArD,OAAA,GAAAV,gBAAA","ignoreList":[]}
@@ -14,6 +14,9 @@ export default class ContentTOCModel extends ResourceModel {
14
14
  * Retrieve content type model
15
15
  */
16
16
  get contentType(): ContentTypeModel | null;
17
+ /**
18
+ */
19
+ get abbreviation(): string | null;
17
20
  /**
18
21
  */
19
22
  get selfContentLink(): ContentLinkModel;
@@ -85,6 +85,12 @@ class ContentTOCModel extends _ResourceModel.default {
85
85
  return this.getData("label", "");
86
86
  }
87
87
 
88
+ /**
89
+ */
90
+ get abbreviation() {
91
+ return this.getData("abbreviation");
92
+ }
93
+
88
94
  /**
89
95
  * Getting the self link of this list
90
96
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTOCModel.js","names":["_objects","require","_ResourceModel","_interopRequireDefault","_FilterCollection","_ContentLinkModel","_ContentTypeModel","_Href","_SectionModel","_Constants","getItems","items","entryDate","modelOptions","_map","default","call","item","link","ContentLinkModel","section","_id","sections","ContentTOCModel","ResourceModel","constructor","arguments","_defineProperty2","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","model","label","getData","selfhref","href","Href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","_context","SectionModel","categories","_context2","category","_contentType","ContentTypeModel","_filterCollection","_context3","FilterCollection","_filter","_context4","key","_keys","has","timeversionFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","attribute","isCompleteSource","completeFilter","exports"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport SectionModel from \"./SectionModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n if (item.sections) {\n link.items = getItems(item.sections, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return data.contributions?.resourcetype === \"ContentTOC\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\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 selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n if (this.data.items) {\n return getItems(this.data.items, this.entryDate, this.modelOptions);\n }\n\n if (this.data.sections) {\n return getItems(this.data.sections, this.entryDate, this.modelOptions);\n }\n\n return [];\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n\n /**\n */\n get isCompleteSource(): boolean {\n const completeFilter =\n this.filterCollection.getFilterByAttributeKey(\"complete\");\n return completeFilter?.attribute?.value === \"true\";\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAA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A,GAAAQ,eAAA","ignoreList":[]}
1
+ {"version":3,"file":"ContentTOCModel.js","names":["_objects","require","_ResourceModel","_interopRequireDefault","_FilterCollection","_ContentLinkModel","_ContentTypeModel","_Href","_SectionModel","_Constants","getItems","items","entryDate","modelOptions","_map","default","call","item","link","ContentLinkModel","section","_id","sections","ContentTOCModel","ResourceModel","constructor","arguments","_defineProperty2","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","model","label","getData","abbreviation","selfhref","href","Href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","_context","SectionModel","categories","_context2","category","_contentType","ContentTypeModel","_filterCollection","_context3","FilterCollection","_filter","_context4","key","_keys","has","timeversionFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","attribute","isCompleteSource","completeFilter","exports"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport SectionModel from \"./SectionModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n if (item.sections) {\n link.items = getItems(item.sections, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return data.contributions?.resourcetype === \"ContentTOC\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\");\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 selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n if (this.data.items) {\n return getItems(this.data.items, this.entryDate, this.modelOptions);\n }\n\n if (this.data.sections) {\n return getItems(this.data.sections, this.entryDate, this.modelOptions);\n }\n\n return [];\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n\n /**\n */\n get isCompleteSource(): boolean {\n const completeFilter =\n this.filterCollection.getFilterByAttributeKey(\"complete\");\n return completeFilter?.attribute?.value === \"true\";\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,KAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAEA,IAAAO,aAAA,GAAAL,sBAAA,CAAAF,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAKA;AACA;AACA;AACA,MAAMS,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1BC,YAA2B,KAE3B,IAAAC,IAAA,CAAAC,OAAA,EAAAJ,KAAK,EAAAK,IAAA,CAALL,KAAK,EAAMM,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIC,yBAAgB,CAC/B;IACE,GAAGF,IAAI;IACPG,OAAO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;QACEqB,MAAM,EAAE,IAAAkB,OAAA,CAAAvD,OAAA,EAAAqD,SAAA,OAAAE,OAAA,CAAAvD,OAAA,MAAI,CAACiB,aAAa,GAAAhB,IAAA,CAAAoD,SAAA,EAAgBhB,MAAM,IAAK;UAAA,IAAAmB,SAAA;UACnD,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAC,KAAA,CAAA1D,OAAA,EAAYqC,MAAM,CAAC;UACjC,OAAO,IAAAsB,YAAG,GAAAH,SAAA,GAAC,IAAI,CAACxC,IAAI,yBAAAuC,OAAA,CAAAvD,OAAA,EAAAwD,SAAA,GAAUC,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,EACD,IAAI,CAAC3D,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAACsD,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAIvD,SAASA,CAAA,EAAoB;IAC/B,MAAM+D,iBAAiB,GAAG,IAAI,CAACzB,gBAAgB,CAAC0B,uBAAuB,CACrEC,kCACF,CAAC;IAED,OAAOF,iBAAiB,EAAEG,SAAS,EAAEvB,KAAK,IAAI,IAAI;EACpD;;EAEA;AACF;EACE,IAAIwB,gBAAgBA,CAAA,EAAY;IAC9B,MAAMC,cAAc,GAClB,IAAI,CAAC9B,gBAAgB,CAAC0B,uBAAuB,CAAC,UAAU,CAAC;IAC3D,OAAOI,cAAc,EAAEF,SAAS,EAAEvB,KAAK,KAAK,MAAM;EACpD;AACF;AAAC0B,OAAA,CAAAlE,OAAA,GAAAQ,eAAA","ignoreList":[]}
@@ -155,6 +155,12 @@ type ContentData = {
155
155
  label?: string | undefined;
156
156
  elements: (PropertyElement | TextFragmentElement | ContentElement)[];
157
157
  };
158
+ type SectionFragment = {
159
+ sectionId?: string | undefined;
160
+ text: string;
161
+ startOffset: number;
162
+ endOffset: number;
163
+ };
158
164
  type ModelOptions = {
159
165
  origin?: string | null | undefined;
160
166
  contextPath?: string | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {\n _id: string,\n label: string,\n value: string,\n};\n\nexport type propertyJSON = {\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n};\n\nexport type textfragmentJSON = {\n label: string,\n text: string,\n type: string,\n};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri?: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped,\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {\n _id: string,\n label: string,\n value: string,\n};\n\nexport type propertyJSON = {\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n};\n\nexport type textfragmentJSON = {\n label: string,\n text: string,\n type: string,\n};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri?: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped,\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n\nexport type SectionFragment = {\n sectionId?: string,\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
@@ -4,5 +4,6 @@
4
4
  export function createHash(str: string): number;
5
5
  /**
6
6
  */
7
- export function createHashFromHref(href: Href): number;
7
+ export function createHashFromHref(href: Href, fragment?: SectionFragment): number;
8
8
  import Href from "../../models/href/Href";
9
+ import { SectionFragment } from "../../models";
@@ -1,28 +1,30 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.createHashFromHref = exports.createHash = void 0;
8
+ var _hashIt = _interopRequireDefault(require("hash-it"));
7
9
  /**
8
10
  * https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
9
11
  */
10
12
  const createHash = str => {
11
- if (!str) return 0;
12
- let hash = 0;
13
- for (let i = 0; i < str.length; i++) {
14
- hash = (hash << 5) - hash + str.charCodeAt(i);
15
- hash = hash & hash;
16
- }
17
- return hash;
13
+ return (0, _hashIt.default)(str);
18
14
  };
19
15
 
20
16
  /**
21
17
  */
22
18
  exports.createHash = createHash;
23
- const createHashFromHref = href => {
19
+ const createHashFromHref = (href, fragment) => {
24
20
  const hrefString = href.hash ? [href.toString(), href.hash].join("#") : href.toString();
25
- return createHash(hrefString);
21
+ if (fragment) {
22
+ return (0, _hashIt.default)({
23
+ hrefString,
24
+ fragment
25
+ });
26
+ }
27
+ return (0, _hashIt.default)(hrefString);
26
28
  };
27
29
  exports.createHashFromHref = createHashFromHref;
28
30
  //# sourceMappingURL=createHash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createHash.js","names":["createHash","str","hash","i","length","charCodeAt","exports","createHashFromHref","href","hrefString","toString","join"],"sources":["../../../src/utils/helpers/createHash.js"],"sourcesContent":["// @flow\nimport type Href from \"../../models/href/Href\";\n\n/**\n * https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n */\nconst createHash = (str: string): number => {\n if (!str) return 0;\n\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i);\n hash = hash & hash;\n }\n return hash;\n};\n\n/**\n */\nconst createHashFromHref = (href: Href): number => {\n const hrefString = href.hash\n ? [href.toString(), href.hash].join(\"#\")\n : href.toString();\n\n return createHash(hrefString);\n};\n\nexport { createHash, createHashFromHref };\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA,MAAMA,UAAU,GAAIC,GAAW,IAAa;EAC1C,IAAI,CAACA,GAAG,EAAE,OAAO,CAAC;EAElB,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACnCD,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGD,GAAG,CAACI,UAAU,CAACF,CAAC,CAAC;IAC7CD,IAAI,GAAGA,IAAI,GAAGA,IAAI;EACpB;EACA,OAAOA,IAAI;AACb,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,UAAA,GAAAA,UAAA;AAEA,MAAMO,kBAAkB,GAAIC,IAAU,IAAa;EACjD,MAAMC,UAAU,GAAGD,IAAI,CAACN,IAAI,GACxB,CAACM,IAAI,CAACE,QAAQ,CAAC,CAAC,EAAEF,IAAI,CAACN,IAAI,CAAC,CAACS,IAAI,CAAC,GAAG,CAAC,GACtCH,IAAI,CAACE,QAAQ,CAAC,CAAC;EAEnB,OAAOV,UAAU,CAACS,UAAU,CAAC;AAC/B,CAAC;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"createHash.js","names":["_hashIt","_interopRequireDefault","require","createHash","str","hash","exports","createHashFromHref","href","fragment","hrefString","toString","join"],"sources":["../../../src/utils/helpers/createHash.js"],"sourcesContent":["// @flow\nimport hash from \"hash-it\";\n\nimport type Href from \"../../models/href/Href\";\nimport type { SectionFragment } from \"../../models\";\n\n/**\n * https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n */\nconst createHash = (str: string): number => {\n return hash(str);\n};\n\n/**\n */\nconst createHashFromHref = (href: Href, fragment?: SectionFragment): number => {\n const hrefString = href.hash\n ? [href.toString(), href.hash].join(\"#\")\n : href.toString();\n\n if (fragment) {\n return hash({ hrefString, fragment });\n }\n\n return hash(hrefString);\n};\n\nexport { createHash, createHashFromHref };\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA;AACA;AACA;AACA,MAAMC,UAAU,GAAIC,GAAW,IAAa;EAC1C,OAAO,IAAAC,eAAI,EAACD,GAAG,CAAC;AAClB,CAAC;;AAED;AACA;AADAE,OAAA,CAAAH,UAAA,GAAAA,UAAA;AAEA,MAAMI,kBAAkB,GAAGA,CAACC,IAAU,EAAEC,QAA0B,KAAa;EAC7E,MAAMC,UAAU,GAAGF,IAAI,CAACH,IAAI,GACxB,CAACG,IAAI,CAACG,QAAQ,CAAC,CAAC,EAAEH,IAAI,CAACH,IAAI,CAAC,CAACO,IAAI,CAAC,GAAG,CAAC,GACtCJ,IAAI,CAACG,QAAQ,CAAC,CAAC;EAEnB,IAAIF,QAAQ,EAAE;IACZ,OAAO,IAAAJ,eAAI,EAAC;MAAEK,UAAU;MAAED;IAAS,CAAC,CAAC;EACvC;EAEA,OAAO,IAAAJ,eAAI,EAACK,UAAU,CAAC;AACzB,CAAC;AAACJ,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.61.1",
3
+ "version": "1.62.0",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "https://support.beinformed.com",
@@ -27,6 +27,7 @@
27
27
  "clean": "rimraf lib dist esm coverage && npm run clean:proxies",
28
28
  "clean:proxies": "node .build/proxies.js --clean",
29
29
  "lint": "eslint --cache .",
30
+ "lint:fix": "eslint --cache . --fix",
30
31
  "prettier": "prettier --write \"./src/**/*.js\"",
31
32
  "flow": "flow",
32
33
  "flow:ci": "flow check",
@@ -76,6 +77,7 @@
76
77
  "dequal": "^2.0.3",
77
78
  "file-size": "^1.0.0",
78
79
  "format-message": "^6.2.4",
80
+ "hash-it": "^6.0.0",
79
81
  "html-entities": "^2.6.0",
80
82
  "iban": "^0.0.14",
81
83
  "js-cookie": "^3.0.5",
@@ -205,7 +205,7 @@ describe("AttributeContent", () => {
205
205
 
206
206
  expect(firstSection.childSections).toHaveLength(2);
207
207
  expect(firstSection.subSections).toHaveLength(2);
208
- expect(firstSection.referenceHash).toBe(-1954774597);
208
+ expect(firstSection.referenceHash).toBe(4345174491453);
209
209
  });
210
210
 
211
211
  it("can handle referredSections", () => {
@@ -67,7 +67,9 @@ export default class ConceptIndexModel extends ResourceModel {
67
67
  static isApplicableModel(data: ModularUIResponse): boolean {
68
68
  const resourceType = data.contributions?.resourcetype;
69
69
  return (
70
- resourceType === "ConceptSearch" || resourceType === "relatedConcepts"
70
+ resourceType === "ConceptSearch" ||
71
+ resourceType === "relatedConcepts" ||
72
+ resourceType === "RelatedConcepts"
71
73
  );
72
74
  }
73
75
 
@@ -12,6 +12,13 @@ import type {
12
12
  } from "../types";
13
13
  import type Href from "../href/Href";
14
14
 
15
+ type SectionFragment = {
16
+ sectionId: string,
17
+ text: string,
18
+ startOffset: number,
19
+ endOffset: number,
20
+ };
21
+
15
22
  /**
16
23
  * Link to a concept
17
24
  */
@@ -184,4 +191,18 @@ export default class ConceptLinkModel
184
191
  isOfConceptType(conceptTypeId: string): boolean {
185
192
  return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;
186
193
  }
194
+
195
+ /**
196
+ *
197
+ */
198
+ get modelCategory(): string {
199
+ return this.getData("modelCategory");
200
+ }
201
+
202
+ /**
203
+ *
204
+ */
205
+ get fragment(): SectionFragment {
206
+ return this.getData("sectionFragment");
207
+ }
187
208
  }
@@ -4,7 +4,7 @@ import { createHashFromHref } from "../../utils/helpers/createHash";
4
4
  import ContentLinkModel from "../content/ContentLinkModel";
5
5
  import Href from "../href/Href";
6
6
  import { getBasePathModularUI } from "../../constants";
7
- import type { ModelOptions } from "../types";
7
+ import type { ModelOptions, SectionFragment } from "../types";
8
8
 
9
9
  /**
10
10
  */
@@ -74,11 +74,25 @@ class SourceReferenceModel {
74
74
  return this._sourceReference.sourceLabel;
75
75
  }
76
76
 
77
+ /**
78
+ *
79
+ */
80
+ get sourceAbbreviation(): string {
81
+ return this._sourceReference.sourceAbbreviation;
82
+ }
83
+
77
84
  /**
78
85
  */
79
86
  get referenceHash(): number {
80
87
  return createHashFromHref(this.selfhref);
81
88
  }
89
+
90
+ /**
91
+ *
92
+ */
93
+ get fragment(): SectionFragment | void {
94
+ return this._sourceReference.sectionFragment;
95
+ }
82
96
  }
83
97
 
84
98
  export default SourceReferenceModel;
@@ -0,0 +1,12 @@
1
+ import ModularUIResponse from "../../../modularui/ModularUIResponse";
2
+ import data from "./related_concepts_data.json";
3
+ import contributions from "./related_concepts_contributions.json";
4
+ import ConceptIndexModel from "../ConceptIndexModel";
5
+
6
+ const response = ModularUIResponse.create({
7
+ key: "concept",
8
+ data,
9
+ contributions,
10
+ });
11
+
12
+ export const relatedConcepts = new ConceptIndexModel(response);
@@ -0,0 +1,41 @@
1
+ {
2
+ "RelatedConceptsOfContentSection": {
3
+ "label": "Related concepts of content",
4
+ "resourcetype": "RelatedConcepts",
5
+ "filter": [
6
+ {
7
+ "entryDate": {
8
+ "type": "datefilter",
9
+ "label": "Entry date",
10
+ "format": "dd-MM-yyyy",
11
+ "formatlabel": "dd-mm-yyyy",
12
+ "operator": "greater-than-or-equal"
13
+ }
14
+ },
15
+ {
16
+ "modelCategory": {
17
+ "type": "stringfilter",
18
+ "label": "Model category",
19
+ "multiplechoice": false
20
+ }
21
+ }
22
+ ],
23
+ "results": {
24
+ "concept": {
25
+ "metadata": {
26
+ "_id": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "attributes": [
31
+ {
32
+ "label": {
33
+ "type": "string",
34
+ "label": "concept label"
35
+ }
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ }
41
+ }