@beinformed/ui 1.9.3 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.9.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.3...v1.9.4) (2021-09-27)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **results:** only render result attributes that are present in data service ([dbd620a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/dbd620a9a76d9ffabc7040c3b355a2ef8fba9da4))
10
+
5
11
  ### [1.9.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.2...v1.9.3) (2021-09-27)
6
12
 
7
13
  ### Bug Fixes
@@ -211,11 +211,24 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
211
211
  if (has(this.data, "resultSection.results") && has(this.contributions, "resultSection.results")) {
212
212
  var _this$data$content;
213
213
 
214
+ var resultsData = this.data.resultSection.results;
215
+ var resultsContributions = this.contributions.resultSection.results;
216
+
217
+ if (resultsContributions.type === "composite") {
218
+ var _context2;
219
+
220
+ resultsContributions.children = _filterInstanceProperty(_context2 = resultsContributions.children).call(_context2, function (child) {
221
+ var childKey = _Object$keys(child)[0];
222
+
223
+ return childKey in resultsData;
224
+ });
225
+ }
226
+
214
227
  var results = createAttribute("results", _objectSpread({
215
228
  key: "results",
216
229
  dynamicschema: this.data.dynamicschema,
217
230
  content: (_this$data$content = this.data.content) === null || _this$data$content === void 0 ? void 0 : _this$data$content.results
218
- }, this.data.resultSection), this.contributions.resultSection.results);
231
+ }, this.data.resultSection), resultsContributions);
219
232
 
220
233
  if (results instanceof CompositeAttributeModel) {
221
234
  results.isResult = true;
@@ -231,13 +244,13 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
231
244
  key: "setGivenAnswers",
232
245
  value: function setGivenAnswers() {
233
246
  if (has(this.data, "resultSection.givenAnswers") && has(this.contributions, "resultSection.givenAnswers")) {
234
- var _context2, _this$data$content2;
247
+ var _context3, _this$data$content2;
235
248
 
236
249
  var givenAnswersData = this.data.resultSection.givenAnswers;
237
250
  var givenAnswersContributions = this.contributions.resultSection.givenAnswers;
238
251
 
239
252
  var filteredContributions = _objectSpread(_objectSpread({}, givenAnswersContributions), {}, {
240
- children: _filterInstanceProperty(_context2 = givenAnswersContributions.children).call(_context2, function (child) {
253
+ children: _filterInstanceProperty(_context3 = givenAnswersContributions.children).call(_context3, function (child) {
241
254
  var childKey = _Object$keys(child)[0];
242
255
 
243
256
  return childKey in givenAnswersData;
@@ -314,9 +327,9 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
314
327
  if (key in _this2.data.eventdata) {
315
328
  if (Array.isArray(_this2.data.eventdata[key])) {
316
329
  _this2.data.eventdata[key].forEach(function (eventDataData, i) {
317
- var _context3;
330
+ var _context4;
318
331
 
319
- _this2.addAttributes(_concatInstanceProperty(_context3 = "".concat(key, "-")).call(_context3, i + 1), _objectSpread(_objectSpread({}, eventDataData), {}, {
332
+ _this2.addAttributes(_concatInstanceProperty(_context4 = "".concat(key, "-")).call(_context4, i + 1), _objectSpread(_objectSpread({}, eventDataData), {}, {
320
333
  dynamicschema: _this2.data.dynamicschema
321
334
  }), eventDataContribution[key]);
322
335
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["has","ActionCollection","DetailModel","ContentConfiguration","AttributeSetModel","createAttribute","CompositeAttributeModel","ListDetailModel","modularUIResponse","_actionCollection","_contentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","key","dynamicschema","resultSection","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","children","child","childKey","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,WAAP,MAAwB,uBAAxB;AACA,OAAOC,oBAAP,MAAiC,8CAAjC;AACA,OAAOC,iBAAP,MAA8B,iCAA9B;AAEA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,uBAAP,MAAoC,uCAApC;;AAQA;AACA;AACA;IACqBC,e;;;;;AAOnB;AACF;AACA;AACE,2BAAYC,iBAAZ,EAAkD;AAAA;;AAAA;;AAChD,8BAAMA,iBAAN;;AADgD;;AAAA;;AAAA;;AAAA;;AAAA;;AAGhD,UAAKC,iBAAL,GAAyB,IAAIR,gBAAJ,EAAzB;AAEA,UAAKS,qBAAL,GAA6B,IAAIP,oBAAJ,CAC3B,MAAKQ,aAAL,GAAqB,MAAKA,aAAL,CAAmBC,OAAxC,GAAkD,EADvB,CAA7B;;AAIA,UAAKC,gBAAL;;AACA,UAAKC,YAAL;;AAVgD;AAWjD;AAED;AACF;AACA;;;;;WACE,qCAA8C;AAAA;;AAC5C,UAAMC,cAAc,GAAG,KAAKC,QAAL,GACnB,KAAKA,QAAL,CAAcC,KAAd,CAAoBC,eAApB,CAAoC,OAApC,EAA6CC,GAD1B,GAEnB,EAFJ;;AAIA,UAAMF,KAAK,gMAA6CF,cAA7C,EAAX;;AAEA,UAAI,KAAKK,UAAT,EAAqB;AACnB,YAAI,KAAKC,OAAT,EAAkB;AAChBJ,UAAAA,KAAK,CAACK,IAAN,OAAAL,KAAK,qBAAS,KAAKI,OAAL,CAAaE,yBAAb,EAAT,EAAL;AACD;;AACD,YAAI,KAAKC,YAAT,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;SACE,eAA0C;AACxC,aAAO,KAAKiB,UAAZ;AACD;;;WA1ND,2BAAyB1B,IAAzB,EAA2D;AAAA;;AACzD,UAAMiC,YAAY,mDAAGjC,IAAI,CAACpB,aAAR,wDAAG,oBAAoBqD,YAAvB,yEAAuC,SAAzD;AAEA,aACE,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;;EA5E0C9D,W;;SAAxBK,e","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n this.contributions.resultSection.results\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
1
+ {"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["has","ActionCollection","DetailModel","ContentConfiguration","AttributeSetModel","createAttribute","CompositeAttributeModel","ListDetailModel","modularUIResponse","_actionCollection","_contentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","type","children","child","childKey","key","dynamicschema","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,gBAAP,MAA6B,6BAA7B;AACA,OAAOC,WAAP,MAAwB,uBAAxB;AACA,OAAOC,oBAAP,MAAiC,8CAAjC;AACA,OAAOC,iBAAP,MAA8B,iCAA9B;AAEA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,uBAAP,MAAoC,uCAApC;;AAQA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;;;WArOD,2BAAyB7B,IAAzB,EAA2D;AAAA;;AACzD,UAAMoC,YAAY,mDAAGpC,IAAI,CAACpB,aAAR,wDAAG,oBAAoBwD,YAAvB,yEAAuC,SAAzD;AAEA,aACE,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,0BAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;;EA5E0CjE,W;;SAAxBK,e","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n }\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
@@ -238,11 +238,23 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
238
238
  if ((0, _objects.has)(this.data, "resultSection.results") && (0, _objects.has)(this.contributions, "resultSection.results")) {
239
239
  var _this$data$content;
240
240
 
241
+ var resultsData = this.data.resultSection.results;
242
+ var resultsContributions = this.contributions.resultSection.results;
243
+
244
+ if (resultsContributions.type === "composite") {
245
+ var _context2;
246
+
247
+ resultsContributions.children = (0, _filter.default)(_context2 = resultsContributions.children).call(_context2, function (child) {
248
+ var childKey = (0, _keys.default)(child)[0];
249
+ return childKey in resultsData;
250
+ });
251
+ }
252
+
241
253
  var results = (0, _createAttribute.default)("results", _objectSpread({
242
254
  key: "results",
243
255
  dynamicschema: this.data.dynamicschema,
244
256
  content: (_this$data$content = this.data.content) === null || _this$data$content === void 0 ? void 0 : _this$data$content.results
245
- }, this.data.resultSection), this.contributions.resultSection.results);
257
+ }, this.data.resultSection), resultsContributions);
246
258
 
247
259
  if (results instanceof _CompositeAttributeModel.default) {
248
260
  results.isResult = true;
@@ -258,13 +270,13 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
258
270
  key: "setGivenAnswers",
259
271
  value: function setGivenAnswers() {
260
272
  if ((0, _objects.has)(this.data, "resultSection.givenAnswers") && (0, _objects.has)(this.contributions, "resultSection.givenAnswers")) {
261
- var _context2, _this$data$content2;
273
+ var _context3, _this$data$content2;
262
274
 
263
275
  var givenAnswersData = this.data.resultSection.givenAnswers;
264
276
  var givenAnswersContributions = this.contributions.resultSection.givenAnswers;
265
277
 
266
278
  var filteredContributions = _objectSpread(_objectSpread({}, givenAnswersContributions), {}, {
267
- children: (0, _filter.default)(_context2 = givenAnswersContributions.children).call(_context2, function (child) {
279
+ children: (0, _filter.default)(_context3 = givenAnswersContributions.children).call(_context3, function (child) {
268
280
  var childKey = (0, _keys.default)(child)[0];
269
281
  return childKey in givenAnswersData;
270
282
  })
@@ -340,9 +352,9 @@ var ListDetailModel = /*#__PURE__*/function (_DetailModel) {
340
352
  if (key in _this2.data.eventdata) {
341
353
  if (Array.isArray(_this2.data.eventdata[key])) {
342
354
  _this2.data.eventdata[key].forEach(function (eventDataData, i) {
343
- var _context3;
355
+ var _context4;
344
356
 
345
- _this2.addAttributes((0, _concat.default)(_context3 = "".concat(key, "-")).call(_context3, i + 1), _objectSpread(_objectSpread({}, eventDataData), {}, {
357
+ _this2.addAttributes((0, _concat.default)(_context4 = "".concat(key, "-")).call(_context4, i + 1), _objectSpread(_objectSpread({}, eventDataData), {}, {
346
358
  dynamicschema: _this2.data.dynamicschema
347
359
  }), eventDataContribution[key]);
348
360
  });
@@ -171,6 +171,17 @@ export default class ListDetailModel extends DetailModel {
171
171
  has(this.data, "resultSection.results") &&
172
172
  has(this.contributions, "resultSection.results")
173
173
  ) {
174
+ const resultsData = this.data.resultSection.results;
175
+ const resultsContributions = this.contributions.resultSection.results;
176
+ if (resultsContributions.type === "composite") {
177
+ resultsContributions.children = resultsContributions.children.filter(
178
+ (child) => {
179
+ const childKey = Object.keys(child)[0];
180
+ return childKey in resultsData;
181
+ }
182
+ );
183
+ }
184
+
174
185
  const results = createAttribute(
175
186
  "results",
176
187
  {
@@ -179,7 +190,7 @@ export default class ListDetailModel extends DetailModel {
179
190
  content: this.data.content?.results,
180
191
  ...this.data.resultSection,
181
192
  },
182
- this.contributions.resultSection.results
193
+ resultsContributions
183
194
  );
184
195
 
185
196
  if (results instanceof CompositeAttributeModel) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["ListDetailModel","modularUIResponse","_actionCollection","ActionCollection","_contentConfiguration","ContentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","key","dynamicschema","resultSection","CompositeAttributeModel","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","children","child","childKey","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","AttributeSetModel","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype","DetailModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAQA;AACA;AACA;IACqBA,e;;;;;AAOnB;AACF;AACA;AACE,2BAAYC,iBAAZ,EAAkD;AAAA;;AAAA;AAChD,8BAAMA,iBAAN;AADgD;AAAA;AAAA;AAAA;AAAA;AAGhD,UAAKC,iBAAL,GAAyB,IAAIC,yBAAJ,EAAzB;AAEA,UAAKC,qBAAL,GAA6B,IAAIC,6BAAJ,CAC3B,MAAKC,aAAL,GAAqB,MAAKA,aAAL,CAAmBC,OAAxC,GAAkD,EADvB,CAA7B;;AAIA,UAAKC,gBAAL;;AACA,UAAKC,YAAL;;AAVgD;AAWjD;AAED;AACF;AACA;;;;;WACE,qCAA8C;AAAA;;AAC5C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MAWO;AACL,cAAA,MAAI,CAACyB,aAAL,CACEzB,GADF,kCAGO,MAAI,CAACT,IAAL,CAAUwB,SAAV,CAAoBf,GAApB,CAHP;AAIIC,gBAAAA,aAAa,EAAE,MAAI,CAACV,IAAL,CAAUU;AAJ7B,kBAMEqB,qBAAqB,CAACtB,GAAD,CANvB;AAQD;AACF;AACF,SAzBD;AA0BD;AACF;AAED;AACF;;;;SACE,eAA0C;AACxC,aAAO,KAAKkB,UAAZ;AACD;;;WA1ND,2BAAyB3B,IAAzB,EAA2D;AAAA;;AACzD,UAAMmC,YAAY,mDAAGnC,IAAI,CAACpB,aAAR,wDAAG,oBAAoBuD,YAAvB,yEAAuC,SAAzD;AAEA,aACE,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;EA5E0CC,qB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n this.contributions.resultSection.results\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
1
+ {"version":3,"sources":["../../../src/models/list/ListDetailModel.js"],"names":["ListDetailModel","modularUIResponse","_actionCollection","ActionCollection","_contentConfiguration","ContentConfiguration","contributions","content","setResultSection","setEventData","listitemPanels","listitem","links","getLinksByGroup","all","hasResults","results","push","getInitialChildModelLinks","givenAnswers","models","_attributeCollection","setChildModels","_listitem","actionCollection","configuration","data","_text","message","text","Array","isArray","texts","setResults","setGivenAnswers","resultsData","resultSection","resultsContributions","type","children","child","childKey","key","dynamicschema","CompositeAttributeModel","isResult","indicateContentConfiguration","contentConfiguration","_results","givenAnswersData","givenAnswersContributions","filteredContributions","_givenAnswers","eventdata","eventData","eventContributions","_eventdata","AttributeSetModel","hasEventData","forEach","eventDataContribution","eventDataData","i","addAttributes","resourcetype","DetailModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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zD,UAAMsC,YAAY,mDAAGtC,IAAI,CAACpB,aAAR,wDAAG,oBAAoB0D,YAAvB,yEAAuC,SAAzD;AAEA,aACE,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,iBAAV,CAAZ,IACA,uBAAAA,YAAY,MAAZ,CAAAA,YAAY,EAAU,YAAV,CADZ,IAEAA,YAAY,KAAK,sCAFjB,IAGAA,YAAY,KAAK,iCAJnB;AAMD;;;EA5E0CC,qB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport DetailModel from \"../detail/DetailModel\";\nimport ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport AttributeSetModel from \"../attributes/AttributeSetModel\";\n\nimport createAttribute from \"../attributes/_createAttribute\";\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Detail of a list item\n */\nexport default class ListDetailModel extends DetailModel {\n _contentConfiguration: ContentConfiguration;\n _listitem: ListItemModel;\n _givenAnswers: ?CompositeAttributeModel;\n _results: ?CompositeAttributeModel;\n _eventdata: Array<AttributeSetModel>;\n\n /**\n * Construct\n */\n constructor(modularUIResponse: ModularUIResponse) {\n super(modularUIResponse);\n\n this._actionCollection = new ActionCollection();\n\n this._contentConfiguration = new ContentConfiguration(\n this.contributions ? this.contributions.content : {}\n );\n\n this.setResultSection();\n this.setEventData();\n }\n\n /**\n * Add links to expand on initialization of this model\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const listitemPanels = this.listitem\n ? this.listitem.links.getLinksByGroup(\"panel\").all\n : [];\n\n const links = [...super.getInitialChildModelLinks(), ...listitemPanels];\n\n if (this.hasResults) {\n if (this.results) {\n links.push(...this.results.getInitialChildModelLinks());\n }\n if (this.givenAnswers) {\n links.push(...this.givenAnswers.getInitialChildModelLinks());\n }\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n\n if (this.results) {\n this.results.setChildModels(models);\n }\n\n if (this.givenAnswers) {\n this.givenAnswers.setChildModels(models);\n }\n }\n\n /**\n */\n get type(): string {\n return \"ListDetail\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourcetype = data.contributions?.resourcetype ?? \"unknown\";\n\n return (\n resourcetype.endsWith(\"ListPanelDetail\") ||\n resourcetype.endsWith(\"ListDetail\") ||\n resourcetype === \"DatastoreRelatedDatastorePanelDetail\" ||\n resourcetype === \"CaseRelatedDataStorePanelDetail\"\n );\n }\n\n /**\n * Set listitem of this listdetail and transfer listitem actions to listdetail actions\n */\n set listitem(listitem: ListItemModel) {\n this._listitem = listitem;\n\n // transfer listitem actions to _actions\n this._actionCollection = listitem.actionCollection;\n }\n\n /**\n * Get listitem\n */\n get listitem(): ListItemModel {\n return this._listitem;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.listitem.links.getLinksByGroup(\"panel\");\n }\n\n /**\n * Getting the contentConfiguration\n */\n get contentConfiguration(): ContentConfiguration {\n return this._contentConfiguration;\n }\n\n /**\n */\n set contentConfiguration(configuration: ContentConfiguration) {\n this._contentConfiguration = configuration;\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._text) {\n return this.data._text.message ?? this.data._text;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n */\n setResultSection() {\n if (\n has(this.contributions, \"resultSection\") &&\n has(this.data, \"resultSection\")\n ) {\n this.setResults();\n this.setGivenAnswers();\n }\n }\n\n /**\n */\n setResults() {\n if (\n has(this.data, \"resultSection.results\") &&\n has(this.contributions, \"resultSection.results\")\n ) {\n const resultsData = this.data.resultSection.results;\n const resultsContributions = this.contributions.resultSection.results;\n if (resultsContributions.type === \"composite\") {\n resultsContributions.children = resultsContributions.children.filter(\n (child) => {\n const childKey = Object.keys(child)[0];\n return childKey in resultsData;\n }\n );\n }\n\n const results = createAttribute(\n \"results\",\n {\n key: \"results\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.results,\n ...this.data.resultSection,\n },\n resultsContributions\n );\n\n if (results instanceof CompositeAttributeModel) {\n results.isResult = true;\n results.indicateContentConfiguration(this.contentConfiguration);\n this._results = results;\n }\n }\n }\n\n /**\n */\n setGivenAnswers() {\n if (\n has(this.data, \"resultSection.givenAnswers\") &&\n has(this.contributions, \"resultSection.givenAnswers\")\n ) {\n const givenAnswersData = this.data.resultSection.givenAnswers;\n const givenAnswersContributions =\n this.contributions.resultSection.givenAnswers;\n\n const filteredContributions = {\n ...givenAnswersContributions,\n children: givenAnswersContributions.children.filter((child) => {\n const childKey = Object.keys(child)[0];\n return childKey in givenAnswersData;\n }),\n };\n\n const givenAnswers = createAttribute(\n \"givenAnswers\",\n {\n key: \"givenAnswers\",\n dynamicschema: this.data.dynamicschema,\n content: this.data.content?.givenAnswers,\n ...this.data.resultSection,\n },\n filteredContributions\n );\n\n if (givenAnswers instanceof CompositeAttributeModel) {\n givenAnswers.isResult = true;\n this._givenAnswers = givenAnswers;\n }\n }\n }\n\n /**\n */\n get givenAnswers(): ?CompositeAttributeModel {\n return this._givenAnswers;\n }\n\n /**\n */\n get hasResults(): boolean {\n return has(this.contributions, \"resultSection\");\n }\n\n /**\n */\n get results(): ?CompositeAttributeModel {\n return this._results;\n }\n\n /**\n */\n get hasEventData(): boolean {\n return (\n has(this.contributions, \"eventdata\") &&\n has(this.data, \"eventdata\") &&\n this.data.eventdata != null &&\n this.contributions.eventdata != null\n );\n }\n\n /**\n */\n addAttributes(key: string, eventData: Object, eventContributions: Object) {\n this._eventdata.push(\n new AttributeSetModel(key, eventData, eventContributions)\n );\n }\n\n /**\n */\n setEventData() {\n if (this.hasEventData) {\n this._eventdata = [];\n\n this.contributions.eventdata.forEach((eventDataContribution) => {\n const [key] = Object.keys(eventDataContribution);\n if (key in this.data.eventdata) {\n if (Array.isArray(this.data.eventdata[key])) {\n this.data.eventdata[key].forEach((eventDataData, i) => {\n this.addAttributes(\n `${key}-${i + 1}`,\n {\n ...eventDataData,\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n });\n } else {\n this.addAttributes(\n key,\n {\n ...this.data.eventdata[key],\n dynamicschema: this.data.dynamicschema,\n },\n eventDataContribution[key]\n );\n }\n }\n });\n }\n }\n\n /**\n */\n get eventdata(): Array<AttributeSetModel> {\n return this._eventdata;\n }\n}\n"],"file":"ListDetailModel.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.9.3",
3
+ "version": "1.9.4",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -171,6 +171,17 @@ export default class ListDetailModel extends DetailModel {
171
171
  has(this.data, "resultSection.results") &&
172
172
  has(this.contributions, "resultSection.results")
173
173
  ) {
174
+ const resultsData = this.data.resultSection.results;
175
+ const resultsContributions = this.contributions.resultSection.results;
176
+ if (resultsContributions.type === "composite") {
177
+ resultsContributions.children = resultsContributions.children.filter(
178
+ (child) => {
179
+ const childKey = Object.keys(child)[0];
180
+ return childKey in resultsData;
181
+ }
182
+ );
183
+ }
184
+
174
185
  const results = createAttribute(
175
186
  "results",
176
187
  {
@@ -179,7 +190,7 @@ export default class ListDetailModel extends DetailModel {
179
190
  content: this.data.content?.results,
180
191
  ...this.data.resultSection,
181
192
  },
182
- this.contributions.resultSection.results
193
+ resultsContributions
183
194
  );
184
195
 
185
196
  if (results instanceof CompositeAttributeModel) {