@beinformed/ui 1.60.6 → 1.61.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 (95) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/esm/models/attributes/AttributeCollection.js +2 -2
  3. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  4. package/esm/models/attributes/AttributeContent.js +1 -1
  5. package/esm/models/attributes/AttributeContent.js.flow +1 -1
  6. package/esm/models/attributes/AttributeContent.js.map +1 -1
  7. package/esm/models/attributes/CompositeAttributeChildCollection.js +4 -4
  8. package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  9. package/esm/models/concepts/ConceptDetailModel.js +9 -9
  10. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  11. package/esm/models/content/ContentTOCModel.d.ts +7 -0
  12. package/esm/models/content/ContentTOCModel.js +35 -8
  13. package/esm/models/content/ContentTOCModel.js.flow +36 -9
  14. package/esm/models/content/ContentTOCModel.js.map +1 -1
  15. package/esm/models/content/SectionModel.d.ts +3 -0
  16. package/esm/models/content/SectionModel.js +11 -2
  17. package/esm/models/content/SectionModel.js.flow +11 -0
  18. package/esm/models/content/SectionModel.js.map +1 -1
  19. package/esm/models/content/SubSectionModel.d.ts +1 -1
  20. package/esm/models/content/SubSectionModel.js.flow +1 -1
  21. package/esm/models/content/SubSectionModel.js.map +1 -1
  22. package/esm/models/content/__tests__/Formalsource.spec.js.flow +91 -0
  23. package/esm/models/form/FormModel.js +33 -33
  24. package/esm/models/form/FormModel.js.map +1 -1
  25. package/esm/models/form/FormObjectModel.d.ts +13 -12
  26. package/esm/models/form/FormObjectModel.js +10 -9
  27. package/esm/models/form/FormObjectModel.js.flow +41 -27
  28. package/esm/models/form/FormObjectModel.js.map +1 -1
  29. package/esm/models/form/__tests__/FormValidation.spec.js.flow +79 -0
  30. package/esm/models/href/Href.js +6 -6
  31. package/esm/models/href/Href.js.map +1 -1
  32. package/esm/models/links/LinkCollection.js +4 -4
  33. package/esm/models/links/LinkCollection.js.map +1 -1
  34. package/esm/redux/_modularui/ModularUISelectors.js +2 -2
  35. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  36. package/esm/utils/helpers/text.d.ts +1 -1
  37. package/esm/utils/helpers/text.js +1 -1
  38. package/esm/utils/helpers/text.js.flow +2 -2
  39. package/esm/utils/helpers/text.js.map +1 -1
  40. package/lib/hooks/useDeepCompareEffect.js +1 -2
  41. package/lib/hooks/useDeepCompareEffect.js.map +1 -1
  42. package/lib/i18n/index.js +1 -2
  43. package/lib/i18n/index.js.map +1 -1
  44. package/lib/models/attributes/AttributeCollection.js +2 -2
  45. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  46. package/lib/models/attributes/AttributeContent.js +1 -1
  47. package/lib/models/attributes/AttributeContent.js.map +1 -1
  48. package/lib/models/attributes/CompositeAttributeChildCollection.js +4 -4
  49. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  50. package/lib/models/concepts/ConceptDetailModel.js +9 -9
  51. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  52. package/lib/models/content/ContentTOCModel.d.ts +7 -0
  53. package/lib/models/content/ContentTOCModel.js +35 -8
  54. package/lib/models/content/ContentTOCModel.js.map +1 -1
  55. package/lib/models/content/SectionModel.d.ts +3 -0
  56. package/lib/models/content/SectionModel.js +11 -2
  57. package/lib/models/content/SectionModel.js.map +1 -1
  58. package/lib/models/content/SubSectionModel.d.ts +1 -1
  59. package/lib/models/content/SubSectionModel.js.map +1 -1
  60. package/lib/models/form/FormModel.js +33 -33
  61. package/lib/models/form/FormModel.js.map +1 -1
  62. package/lib/models/form/FormObjectModel.d.ts +13 -12
  63. package/lib/models/form/FormObjectModel.js +10 -9
  64. package/lib/models/form/FormObjectModel.js.map +1 -1
  65. package/lib/models/href/Href.js +6 -6
  66. package/lib/models/href/Href.js.map +1 -1
  67. package/lib/models/index.js +1 -2
  68. package/lib/models/index.js.map +1 -1
  69. package/lib/models/links/LinkCollection.js +4 -4
  70. package/lib/models/links/LinkCollection.js.map +1 -1
  71. package/lib/react-server/serverUtil.js +1 -2
  72. package/lib/react-server/serverUtil.js.map +1 -1
  73. package/lib/redux/_modularui/ModularUISelectors.js +2 -2
  74. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  75. package/lib/utils/helpers/text.d.ts +1 -1
  76. package/lib/utils/helpers/text.js +1 -1
  77. package/lib/utils/helpers/text.js.map +1 -1
  78. package/package.json +17 -17
  79. package/src/models/attributes/AttributeContent.js +1 -1
  80. package/src/models/content/ContentTOCModel.js +36 -9
  81. package/src/models/content/SectionModel.js +11 -0
  82. package/src/models/content/SubSectionModel.js +1 -1
  83. package/src/models/content/__tests__/Formalsource.spec.js +91 -0
  84. package/src/models/content/__tests__/formalsource-complete.json +234 -0
  85. package/src/models/content/__tests__/formalsource-contributions.json +110 -0
  86. package/src/models/content/__tests__/formalsource-section-contributions.json +84 -0
  87. package/src/models/content/__tests__/formalsource-section.json +60 -0
  88. package/src/models/content/__tests__/formalsource-toc.json +119 -0
  89. package/src/models/form/FormObjectModel.js +41 -27
  90. package/src/models/form/__tests__/FormValidation.spec.js +79 -0
  91. package/src/models/form/__tests__/FormValidationContributions.json +45 -0
  92. package/src/models/form/__tests__/FormValidationDataInitial.json +33 -0
  93. package/src/models/form/__tests__/FormValidationDataUpdate1.json +25 -0
  94. package/src/models/form/__tests__/FormValidationDataUpdate2.json +33 -0
  95. package/src/utils/helpers/text.js +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTOCModel.js","names":["has","ResourceModel","FilterCollection","ContentLinkModel","ContentTypeModel","Href","TIMEVERSION_FILTER_NAME","getItems","items","entryDate","modelOptions","_mapInstanceProperty","call","item","link","section","_id","ContentTOCModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","model","label","getData","selfhref","href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","categories","_context","category","_contentType","_filterCollection","_context2","_filterInstanceProperty","_context3","key","_Object$keys","timeversionFilter","getFilterByAttributeKey","attribute"],"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 { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\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\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 (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentTOC\"\n );\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 return this.data.items\n ? getItems(this.data.items, this.entryDate, this.modelOptions)\n : [];\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"],"mappings":";;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACj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ACF,CAAC;IAED,OAAOuD,iBAAiB,EAAEE,SAAS,EAAEjB,KAAK,IAAI,IAAI;EACpD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ContentTOCModel.js","names":["has","ResourceModel","FilterCollection","ContentLinkModel","ContentTypeModel","Href","SectionModel","TIMEVERSION_FILTER_NAME","getItems","items","entryDate","modelOptions","_mapInstanceProperty","call","item","link","section","_id","sections","ContentTOCModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","model","label","getData","selfhref","href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","_context","categories","_context2","category","_contentType","_filterCollection","_context3","_filterInstanceProperty","_context4","key","_Object$keys","timeversionFilter","getFilterByAttributeKey","attribute","isCompleteSource","completeFilter"],"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,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAE/B,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,SAASC,uBAAuB,QAAQ,2BAA2B;AAKnE;AACA;AACA;AACA,MAAMC,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1BC,YAA2B,KAE3BC,oBAAA,CAAAH,KAAK,EAAAI,IAAA,CAALJ,KAAK,EAAMK,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIZ,gBAAgB,CAC/B;IACE,GAAGW,IAAI;IACPE,OAAO,EAAEF,IAAI,CAACG;EAChB,CAAC,EACDP,SAAS,EACTC,YACF,CAAC;EAED,IAAIG,IAAI,CAACL,KAAK,EAAE;IACdM,IAAI,CAACN,KAAK,GAAGD,QAAQ,CAACM,I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AI,CAACnD,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAAC+C,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAIhD,SAASA,CAAA,EAAoB;IAC/B,MAAMsD,iBAAiB,GAAG,IAAI,CAACrB,gBAAgB,CAACsB,uBAAuB,CACrE1D,uBACF,CAAC;IAED,OAAOyD,iBAAiB,EAAEE,SAAS,EAAElB,KAAK,IAAI,IAAI;EACpD;;EAEA;AACF;EACE,IAAImB,gBAAgBA,CAAA,EAAY;IAC9B,MAAMC,cAAc,GAClB,IAAI,CAACzB,gBAAgB,CAACsB,uBAAuB,CAAC,UAAU,CAAC;IAC3D,OAAOG,cAAc,EAAEF,SAAS,EAAElB,KAAK,KAAK,MAAM;EACpD;AACF","ignoreList":[]}
@@ -57,6 +57,9 @@ declare class SectionModel extends BaseModel {
57
57
  * Get tree of child sections
58
58
  */
59
59
  get childSections(): Array<SectionModel>;
60
+ /**
61
+ */
62
+ get sections(): Array<SectionModel>;
60
63
  /**
61
64
  * Get sub sections
62
65
  */
@@ -134,12 +134,21 @@ class SectionModel extends BaseModel {
134
134
  this._childSections = sections || [];
135
135
  }
136
136
 
137
+ /**
138
+ */
139
+ get sections() {
140
+ if (this.data.sections) {
141
+ var _context4;
142
+ return _mapInstanceProperty(_context4 = this.data.sections).call(_context4, section => new SectionModel(section, this.entryDate, this.modelOptions));
143
+ }
144
+ return [];
145
+ }
137
146
  /**
138
147
  * Get sub sections
139
148
  */
140
149
  get subSections() {
141
- var _context4;
142
- return this.data.subSections ? _mapInstanceProperty(_context4 = this.data.subSections).call(_context4, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
150
+ var _context5;
151
+ return this.data.subSections ? _mapInstanceProperty(_context5 = this.data.subSections).call(_context5, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
143
152
  }
144
153
 
145
154
  /**
@@ -164,6 +164,17 @@ class SectionModel extends BaseModel {
164
164
  this._childSections = sections || [];
165
165
  }
166
166
 
167
+ /**
168
+ */
169
+ get sections(): Array<SectionModel> {
170
+ if (this.data.sections) {
171
+ return this.data.sections.map(
172
+ (section) =>
173
+ new SectionModel(section, this.entryDate, this.modelOptions),
174
+ );
175
+ }
176
+ return [];
177
+ }
167
178
  /**
168
179
  * Get sub sections
169
180
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,OAAOC,SAAS,MAAM,oBAAoB;AAE1C,SAASC,YAAY,QAAQ,aAAa;AAK1C;AACA;AACA,MAAMC,YAAY,SAASN,SAAS,CAAC;EAKnCO,WAAWA,CACTC,IAAY,EACZC,SAA0B,EAC1BC,YAA2B,EAC3B;IACA,KAAK,CAACF,IAAI,EAAE,CAAC,CAAC,EAAEE,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAE9B,IAAI,CAACC,UAAU,GAAGH,SAAS;EAC7B;;EAEA;AACF;EACE,IAAII,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACL,IAAI,CAACK,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAc;IACxB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAIX,SAAS,CAC5B,IAAI,CAACI,IAAI,CAACQ,MAAM,EAAEC,IAAI,EACtB,IAAI,EACJ,IAAI,CAACP,YACP,CAAC;IACH;IACA,OAAO,IAAI,CAACK,SAAS;EACvB;;EAEA;AACF;EACE,IAAIG,QAAQA,CAAA,EAAS;IACnB,OAAO,IAAI,CAACJ,QAAQ,CAACK,IAAI;EAC3B;;EAEA;AACF;EACE,IAAIV,SAASA,CAAA,EAAoB;IAC/B,OAAO,IAAI,CAACG,UAAU;EACxB;;EAEA;AACF;EACE,IAA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IAAI,CAACkC,WAAW,EAAAT,IAAA,CAAAU,SAAA,EAClBC,UAAU,IACT,IAAI1C,eAAe,CAAC0C,UAAU,EAAE,IAAI,CAACnC,SAAS,EAAE,IAAI,CAACC,YAAY,CACrE,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAImC,aAAaA,CAAA,EAAW;IAC1B,OAAO1C,kBAAkB,CAAC,IAAI,CAACe,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACE4B,mBAAmBA,CAAA,EAA0C;IAC3D,MAAML,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAC/B,QAAQ,EAAE;QACvB4B,QAAQ,CAACM,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMd,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzB4B,QAAQ,CAACM,IAAI,CAACb,YAAY,CAAC;MAC7B;MAEA,MAAMc,cAAc,GAAGd,YAAY,CAACY,mBAAmB,CAAC,CAAC;MACzDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOP,QAAQ;EACjB;AACF;AAEA,eAAenC,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","_context4","subSections","_context5","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n */\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 * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,OAAOC,S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AA,CAAAW,SAAA,EAClBC,UAAU,IACT,IAAI3C,eAAe,CAAC2C,UAAU,EAAE,IAAI,CAACpC,SAAS,EAAE,IAAI,CAACC,YAAY,CACrE,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAIoC,aAAaA,CAAA,EAAW;IAC1B,OAAO3C,kBAAkB,CAAC,IAAI,CAACe,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACE6B,mBAAmBA,CAAA,EAA0C;IAC3D,MAAMN,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMI,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAChC,QAAQ,EAAE;QACvB4B,QAAQ,CAACO,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDN,QAAQ,CAACO,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMf,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzB4B,QAAQ,CAACO,IAAI,CAACd,YAAY,CAAC;MAC7B;MAEA,MAAMe,cAAc,GAAGf,YAAY,CAACa,mBAAmB,CAAC,CAAC;MACzDN,QAAQ,CAACO,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOR,QAAQ;EACjB;AACF;AAEA,eAAenC,YAAY","ignoreList":[]}
@@ -20,7 +20,7 @@ export default class SubSectionModel extends BaseModel {
20
20
  /**
21
21
  * Retrieve html body
22
22
  */
23
- get body(): string;
23
+ get body(): string | null;
24
24
  /**
25
25
  * Retrieve number of section
26
26
  */
@@ -49,7 +49,7 @@ export default class SubSectionModel extends BaseModel {
49
49
  /**
50
50
  * Retrieve html body
51
51
  */
52
- get body(): string {
52
+ get body(): string | null {
53
53
  const body = this.getData("body", "");
54
54
  return retrieveText(body);
55
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubSectionModel.js","names":["createHashFromHref","BaseModel","LinkCollection","Href","LinkModel","retrieveText","SubSectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","id","_id","key","body","getData","number","label","subSections","_context","_mapInstanceProperty","call","subSection","links","_links","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includesInstanceProperty","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","addParameter","setReferenceHash","referenceHash","getReferredSections","sections","referredChilds"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _links: LinkCollection;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n * Retrieve links of section\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel | null {\n return this.links.getLinkByKey(\"self\");\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href | null {\n return this.selflink ? this.selflink.href : null;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n\n if (href.hash.includes(\"/relatedConcepts\")) {\n const firstPart = href.path.substring(0, href.path.lastIndexOf(\"/\"));\n href.path = firstPart + \"/\" + href.hash;\n href.hash = href.hash.includes(\"#\")\n ? href.hash.substring(href.hash.indexOf(\"#\"))\n : \"\";\n }\n\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n const selfhref = this.selfhref || new Href();\n return createHashFromHref(selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n"],"mappings":";;;AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,IAAI,MAAM,cAAc;A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CAAC0B,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAAChB,IAAI,CAAC,GAAGiB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"SubSectionModel.js","names":["createHashFromHref","BaseModel","LinkCollection","Href","LinkModel","retrieveText","SubSectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","id","_id","key","body","getData","number","label","subSections","_context","_mapInstanceProperty","call","subSection","links","_links","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includesInstanceProperty","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","addParameter","setReferenceHash","referenceHash","getReferredSections","sections","referredChilds"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _links: LinkCollection;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string | null {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n * Retrieve links of section\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel | null {\n return this.links.getLinkByKey(\"self\");\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href | null {\n return this.selflink ? this.selflink.href : null;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n\n if (href.hash.includes(\"/relatedConcepts\")) {\n const firstPart = href.path.substring(0, href.path.lastIndexOf(\"/\"));\n href.path = firstPart + \"/\" + href.hash;\n href.hash = href.hash.includes(\"#\")\n ? href.hash.substring(href.hash.indexOf(\"#\"))\n : \"\";\n }\n\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n const selfhref = this.selfhref || new Href();\n return createHashFromHref(selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n"],"mappings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,WAAW,EAAE;MACzC,IAAII,UAAU,CAACZ,QAAQ,EAAE;QACvBuC,QAAQ,CAAChB,IAAI,CAACX,UAAU,CAAC;MAC3B;MAEA,MAAM4B,cAAc,GAAG5B,UAAU,CAAC0B,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAAChB,IAAI,CAAC,GAAGiB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF","ignoreList":[]}
@@ -0,0 +1,91 @@
1
+ import { ModularUIResponse } from "../../../modularui";
2
+
3
+ import toc from "./formalsource-toc.json";
4
+ import complete from "./formalsource-complete.json";
5
+ import contributions from "./formalsource-contributions.json";
6
+
7
+ import section from "./formalsource-section.json";
8
+ import sectionContributions from "./formalsource-section-contributions.json";
9
+
10
+ import ContentTOCModel from "../ContentTOCModel";
11
+ import ContentModel from "../ContentModel";
12
+
13
+ describe("formalsource", () => {
14
+ it("TOC model", () => {
15
+ const response = ModularUIResponse.create({
16
+ key: "contentmodel",
17
+ data: toc,
18
+ contributions,
19
+ });
20
+
21
+ const tocModel = new ContentTOCModel(response);
22
+
23
+ expect(tocModel).toBeInstanceOf(ContentTOCModel);
24
+
25
+ expect(tocModel.label).toBe(
26
+ "Grant Funding Agreement - Terms and Conditions",
27
+ );
28
+
29
+ expect(tocModel.items).toHaveLength(6);
30
+ expect(tocModel.items[0].items).toBeUndefined();
31
+ expect(tocModel.items[1].items).toHaveLength(2);
32
+
33
+ expect(tocModel.isCompleteSource).toBe(false);
34
+
35
+ const firstSection = tocModel.items[0];
36
+ expect(firstSection.label).toBe("1. Introduction");
37
+ });
38
+
39
+ it("Complete model", () => {
40
+ const response = ModularUIResponse.create({
41
+ key: "contentmodel",
42
+ data: complete,
43
+ contributions,
44
+ });
45
+
46
+ const completeModel = new ContentTOCModel(response);
47
+
48
+ expect(completeModel).toBeInstanceOf(ContentTOCModel);
49
+
50
+ expect(completeModel.items).toHaveLength(6);
51
+ expect(completeModel.items[0].items).toBeUndefined();
52
+ expect(completeModel.items[1].items).toHaveLength(2);
53
+
54
+ expect(completeModel.sections).toHaveLength(6);
55
+ expect(completeModel.sections[0].sections).toHaveLength(0);
56
+ expect(completeModel.sections[1].sections).toHaveLength(2);
57
+
58
+ expect(completeModel.isCompleteSource).toBe(true);
59
+
60
+ const firstSection = completeModel.sections[0];
61
+ expect(firstSection.label).toBe("Introduction");
62
+ expect(firstSection.number).toBe("1.");
63
+ expect(firstSection.body).toBe(null);
64
+ expect(firstSection.subSections).toHaveLength(3);
65
+ expect(firstSection.subSections[0].body).toHaveLength(169);
66
+
67
+ const secondSection = completeModel.sections[1];
68
+ expect(secondSection.label).toBe("Grant Offer");
69
+ expect(secondSection.number).toBe("2.");
70
+ expect(secondSection.body).toBe(null);
71
+ expect(secondSection.sections[0].label).toBe("Payment of Grant");
72
+ expect(secondSection.sections[0].number).toBe("2.1");
73
+ expect(secondSection.sections[0].body).toHaveLength(222);
74
+ });
75
+
76
+ it("Section model", () => {
77
+ const response = ModularUIResponse.create({
78
+ key: "contentmodel",
79
+ data: section,
80
+ contributions: sectionContributions,
81
+ });
82
+ const sectionModel = new ContentModel(response);
83
+
84
+ expect(sectionModel.label).toBe("Grant Offer");
85
+ expect(sectionModel.number).toBe("2.");
86
+ expect(sectionModel.body).toBe(null);
87
+ expect(sectionModel.subSections).toHaveLength(0);
88
+
89
+ expect(sectionModel.childSectionLinks).toHaveLength(2);
90
+ });
91
+ });
@@ -330,12 +330,12 @@ class FormModel extends ResourceModel {
330
330
  */
331
331
  setEndResultFormObjects() {
332
332
  if (this.data && this.data.results) {
333
- var _context10, _context11;
333
+ var _context0, _context1;
334
334
  const missingObjects = this.data.missing?.anchors ?? [];
335
335
  const missingObjectIds = _mapInstanceProperty(missingObjects).call(missingObjects, anchor => anchor.objectid);
336
336
 
337
337
  // Filter out intermediate results and rename elements property to result property
338
- const endResultAnchors = _mapInstanceProperty(_context10 = _filterInstanceProperty(_context11 = this.data.results).call(_context11, result => !_includesInstanceProperty(missingObjectIds).call(missingObjectIds, result.objectid))).call(_context10, result => {
338
+ const endResultAnchors = _mapInstanceProperty(_context0 = _filterInstanceProperty(_context1 = this.data.results).call(_context1, result => !_includesInstanceProperty(missingObjectIds).call(missingObjectIds, result.objectid))).call(_context0, result => {
339
339
  const {
340
340
  elements,
341
341
  ...otherProps
@@ -355,8 +355,8 @@ class FormModel extends ResourceModel {
355
355
  /**
356
356
  */
357
357
  get expectsEndResultFormObjects() {
358
- var _context12;
359
- const endResultKeys = _mapInstanceProperty(_context12 = this.endResultFormObjects).call(_context12, endResult => endResult.key);
358
+ var _context10;
359
+ const endResultKeys = _mapInstanceProperty(_context10 = this.endResultFormObjects).call(_context10, endResult => endResult.key);
360
360
  return this.objectKeys.some(objectKey => this.contributions.objects?.[objectKey]?.content?.results && !_includesInstanceProperty(endResultKeys).call(endResultKeys, objectKey));
361
361
  }
362
362
 
@@ -369,18 +369,18 @@ class FormModel extends ResourceModel {
369
369
  /**
370
370
  */
371
371
  getEndResultFormObjects() {
372
- var _context13;
373
- return _filterInstanceProperty(_context13 = this.endResultFormObjects).call(_context13, endResult => {
374
- var _context14;
375
- return !_includesInstanceProperty(_context14 = this.previousEndResultKeys).call(_context14, endResult.key);
372
+ var _context11;
373
+ return _filterInstanceProperty(_context11 = this.endResultFormObjects).call(_context11, endResult => {
374
+ var _context12;
375
+ return !_includesInstanceProperty(_context12 = this.previousEndResultKeys).call(_context12, endResult.key);
376
376
  });
377
377
  }
378
378
 
379
379
  /**
380
380
  */
381
381
  set endResultFormObjects(endResultFormObjects) {
382
- var _context15;
383
- this.previousEndResultKeys = _mapInstanceProperty(_context15 = this.endResultFormObjects).call(_context15, endResult => endResult.key);
382
+ var _context13;
383
+ this.previousEndResultKeys = _mapInstanceProperty(_context13 = this.endResultFormObjects).call(_context13, endResult => endResult.key);
384
384
  this._endResultFormObjects = endResultFormObjects;
385
385
  }
386
386
 
@@ -402,9 +402,9 @@ class FormModel extends ResourceModel {
402
402
  get isValid() {
403
403
  if (this.currentFormObject) {
404
404
  if (this.currentFormObject.isRepeatable) {
405
- var _context16, _context17;
405
+ var _context14, _context15;
406
406
  // repeating objects need at least one valid form object
407
- const hasOneValidQuestion = _findInstanceProperty(_context16 = _filterInstanceProperty(_context17 = this.allObjects).call(_context17, object => object.equals(this.currentFormObject, false))).call(_context16, object => object.isValid);
407
+ const hasOneValidQuestion = _findInstanceProperty(_context14 = _filterInstanceProperty(_context15 = this.allObjects).call(_context15, object => object.equals(this.currentFormObject, false))).call(_context14, object => object.isValid);
408
408
  if (hasOneValidQuestion) {
409
409
  return true;
410
410
  }
@@ -572,10 +572,10 @@ class FormModel extends ResourceModel {
572
572
  /**
573
573
  */
574
574
  selfhrefNoCommitParam() {
575
- var _context18;
575
+ var _context16;
576
576
  const selfhref = this.selflink.href;
577
577
  selfhref.method = HTTP_METHODS.POST;
578
- selfhref.parameters = _filterInstanceProperty(_context18 = this.parameters).call(_context18, parameter => parameter.name !== "commit");
578
+ selfhref.parameters = _filterInstanceProperty(_context16 = this.parameters).call(_context16, parameter => parameter.name !== "commit");
579
579
  return selfhref;
580
580
  }
581
581
 
@@ -648,11 +648,11 @@ class FormModel extends ResourceModel {
648
648
  /**
649
649
  */
650
650
  getFormDataObjects() {
651
- var _context19;
651
+ var _context17;
652
652
  let validOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
653
653
  let validationData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
654
654
  const formdata = [];
655
- const formObjects = _filterInstanceProperty(_context19 = this.allObjects).call(_context19, (formObject, index) => {
655
+ const formObjects = _filterInstanceProperty(_context17 = this.allObjects).call(_context17, (formObject, index) => {
656
656
  // repeatabe object without fixed nr of repeats, remove last form object from formdata,
657
657
  // because this is the formobject that is used as a placeholder for the create object
658
658
  // of the collection of repeats
@@ -739,9 +739,9 @@ class FormModel extends ResourceModel {
739
739
  * Form navigation: Go one object back (previous button)
740
740
  */
741
741
  get hasPreviousStep() {
742
- var _context20;
742
+ var _context18;
743
743
  const currentFormObjectKey = this.currentFormObject != null ? this.currentFormObject.key : "";
744
- return _filterInstanceProperty(_context20 = this.completedFormObjects).call(_context20, formObject => !formObject.isRepeatWithUnknownTotal || formObject.key !== currentFormObjectKey).length > 0;
744
+ return _filterInstanceProperty(_context18 = this.completedFormObjects).call(_context18, formObject => !formObject.isRepeatWithUnknownTotal || formObject.key !== currentFormObjectKey).length > 0;
745
745
  }
746
746
 
747
747
  /**
@@ -751,7 +751,7 @@ class FormModel extends ResourceModel {
751
751
  * a different key than the current form object
752
752
  */
753
753
  setPreviousObject() {
754
- var _context21, _context22, _context23, _context24, _context25;
754
+ var _context19, _context20, _context21, _context22, _context23;
755
755
  this.isComplete = false;
756
756
  this.isFinished = false;
757
757
  this.success = null;
@@ -760,10 +760,10 @@ class FormModel extends ResourceModel {
760
760
  this.previouslyEnteredFormObjects = [this.currentFormObject, ...this.previouslyEnteredFormObjects];
761
761
  }
762
762
  this.currentFormObject = this.completedFormObjects[this.completedFormObjects.length - 1];
763
- this.completedFormObjects = _sliceInstanceProperty(_context21 = this.completedFormObjects).call(_context21, 0, -1);
764
- const completedFormObjectKeys = _filterInstanceProperty(_context22 = _mapInstanceProperty(_context23 = this.completedFormObjects).call(_context23, formObject => formObject.key)).call(_context22, formObjectKey => formObjectKey !== this.currentFormObject?.key);
765
- this.endResultFormObjects = _filterInstanceProperty(_context24 = this._endResultFormObjects).call(_context24, endResult => _includesInstanceProperty(completedFormObjectKeys).call(completedFormObjectKeys, endResult.key));
766
- this.previousEndResultKeys = _mapInstanceProperty(_context25 = this.endResultFormObjects).call(_context25, endResult => endResult.key);
763
+ this.completedFormObjects = _sliceInstanceProperty(_context19 = this.completedFormObjects).call(_context19, 0, -1);
764
+ const completedFormObjectKeys = _filterInstanceProperty(_context20 = _mapInstanceProperty(_context21 = this.completedFormObjects).call(_context21, formObject => formObject.key)).call(_context20, formObjectKey => formObjectKey !== this.currentFormObject?.key);
765
+ this.endResultFormObjects = _filterInstanceProperty(_context22 = this._endResultFormObjects).call(_context22, endResult => _includesInstanceProperty(completedFormObjectKeys).call(completedFormObjectKeys, endResult.key));
766
+ this.previousEndResultKeys = _mapInstanceProperty(_context23 = this.endResultFormObjects).call(_context23, endResult => endResult.key);
767
767
 
768
768
  // while we are at the same repeating form object, go a step back
769
769
  if (this.currentFormObject && this.currentFormObject.equals(oldCurrentFormObject, this.currentFormObject.hasFixedNrOfRepeats)) {
@@ -775,7 +775,7 @@ class FormModel extends ResourceModel {
775
775
  * Form navigation: has next step or is last
776
776
  */
777
777
  get hasNextStep() {
778
- var _context26;
778
+ var _context24;
779
779
  if (this.isComplete || this.isFinished || this.hasNoQuestionsConfigured || !this.contributions.objects) {
780
780
  return false;
781
781
  }
@@ -787,7 +787,7 @@ class FormModel extends ResourceModel {
787
787
  if (this.expectsEndResultFormObjects) {
788
788
  return true;
789
789
  }
790
- const currentObjectIndex = _findIndexInstanceProperty(_context26 = this.objectKeys).call(_context26, objectKey => objectKey === this.currentFormObject?.key);
790
+ const currentObjectIndex = _findIndexInstanceProperty(_context24 = this.objectKeys).call(_context24, objectKey => objectKey === this.currentFormObject?.key);
791
791
  const isLastObject = this.objectKeys.length - 1 === currentObjectIndex;
792
792
 
793
793
  // current object is a repeating question but it is not the last one
@@ -933,11 +933,11 @@ class FormModel extends ResourceModel {
933
933
  * Received missing anchors in the response with an object id that is the current form object
934
934
  */
935
935
  processMissingErrors(receivedForm) {
936
- var _context27;
936
+ var _context25;
937
937
  if (this.currentFormObject === null) {
938
938
  return null;
939
939
  }
940
- _mapInstanceProperty(_context27 = this.currentFormObject.attributeCollection).call(_context27, attribute => {
940
+ _mapInstanceProperty(_context25 = this.currentFormObject.attributeCollection).call(_context25, attribute => {
941
941
  const receivedAttribute = receivedForm.currentFormObject?.getAttributeByKey(attribute.key);
942
942
  if (receivedAttribute) {
943
943
  attribute.addMissingError(receivedAttribute);
@@ -964,9 +964,9 @@ class FormModel extends ResourceModel {
964
964
  this.completedFormObjects = [...this.allObjects];
965
965
  this.currentFormObject = null;
966
966
  } else {
967
- var _context28;
967
+ var _context26;
968
968
  // check if received form exists in the previously entered form objects
969
- const previouslyEnteredFormObjects = _filterInstanceProperty(_context28 = this.previouslyEnteredFormObjects).call(_context28, formObject => formObject.equals(receivedCurrentFormObject, formObject.hasFixedNrOfRepeats));
969
+ const previouslyEnteredFormObjects = _filterInstanceProperty(_context26 = this.previouslyEnteredFormObjects).call(_context26, formObject => formObject.equals(receivedCurrentFormObject, formObject.hasFixedNrOfRepeats));
970
970
  if (previouslyEnteredFormObjects.length > 0) {
971
971
  this.handlePreviouslyEnteredFormObjects(receivedCurrentFormObject, previouslyEnteredFormObjects);
972
972
  } else {
@@ -993,14 +993,14 @@ class FormModel extends ResourceModel {
993
993
  /**
994
994
  */
995
995
  handlePreviouslyEnteredFormObjects(receivedCurrentFormObject, previouslyEnteredFormObjects) {
996
- var _context29;
996
+ var _context27;
997
997
  previouslyEnteredFormObjects.forEach(previouslyEnteredFormObject => {
998
998
  const mergedObject = this.mergePreviouslyEnteredObjects ? this.mergeObjects(receivedCurrentFormObject, previouslyEnteredFormObject) : receivedCurrentFormObject;
999
999
  this.addFormObject(mergedObject);
1000
1000
  });
1001
1001
 
1002
1002
  // remove the previously entered form object
1003
- this.previouslyEnteredFormObjects = _filterInstanceProperty(_context29 = this.previouslyEnteredFormObjects).call(_context29, formObject => {
1003
+ this.previouslyEnteredFormObjects = _filterInstanceProperty(_context27 = this.previouslyEnteredFormObjects).call(_context27, formObject => {
1004
1004
  const hasPreviouslyEnteredObject = _findInstanceProperty(previouslyEnteredFormObjects).call(previouslyEnteredFormObjects, previouslyEnteredFormObject => formObject.equals(previouslyEnteredFormObject));
1005
1005
  return !hasPreviouslyEnteredObject;
1006
1006
  });
@@ -1020,8 +1020,8 @@ class FormModel extends ResourceModel {
1020
1020
  let foundAttribute = null;
1021
1021
  this.allObjects.forEach(formObject => {
1022
1022
  if (foundAttribute === null) {
1023
- var _context30;
1024
- foundAttribute = _findInstanceProperty(_context30 = formObject.attributeCollection.all).call(_context30, item => findMethod(item)) || null;
1023
+ var _context28;
1024
+ foundAttribute = _findInstanceProperty(_context28 = formObject.attributeCollection.all).call(_context28, item => findMethod(item)) || null;
1025
1025
  }
1026
1026
  });
1027
1027
  return foundAttribute;