@beinformed/ui 1.67.2 → 1.67.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 +14 -0
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +7 -8
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.flow +3 -3
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.flow +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +7 -8
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.67.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.67.3...v1.67.4) (2026-03-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **composite-childs:** set dot as separator for readonly values ([50f5f82](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/50f5f82e84c7c56df09346844fe07fb3b821e3ee))
|
|
11
|
+
|
|
12
|
+
## [1.67.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.67.2...v1.67.3) (2026-03-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **choice-attribute:** render choice option readonlyvalue with multiple attributes ([a4687c3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/a4687c35e4c6f5885d7de93ca4de7b9caa401d00))
|
|
18
|
+
|
|
5
19
|
## [1.67.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.67.0...v1.67.2) (2026-02-16)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
2
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
3
3
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
4
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
4
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
5
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
6
6
|
import BaseModel from "../base/BaseModel";
|
|
7
7
|
import ChoiceAttributeOptionCollection from "./ChoiceAttributeOptionCollection";
|
|
8
8
|
import { has } from "../../utils/helpers/objects";
|
|
@@ -142,13 +142,12 @@ class ChoiceAttributeOptionModel extends BaseModel {
|
|
|
142
142
|
return this.contributions.label;
|
|
143
143
|
}
|
|
144
144
|
if (this.attributeCollection.hasItems) {
|
|
145
|
+
var _context;
|
|
145
146
|
const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);
|
|
146
147
|
if (title) {
|
|
147
148
|
return title.readonlyvalue;
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
-
return this.attributeCollection.first.readonlyvalue;
|
|
151
|
-
}
|
|
150
|
+
return _mapInstanceProperty(_context = this.attributeCollection.all).call(_context, attribute => attribute.readonlyvalue).join(" · ");
|
|
152
151
|
}
|
|
153
152
|
return "";
|
|
154
153
|
}
|
|
@@ -160,11 +159,11 @@ class ChoiceAttributeOptionModel extends BaseModel {
|
|
|
160
159
|
getContentConfiguredLabel(contentConfiguration) {
|
|
161
160
|
const configuredLabelProperties = contentConfiguration?.labelConfig?.[0]?.types ?? [];
|
|
162
161
|
if (!this.hasContentFromData && this.concept && configuredLabelProperties.length > 0) {
|
|
163
|
-
var
|
|
164
|
-
const configuredLabels = _filterInstanceProperty(
|
|
162
|
+
var _context2;
|
|
163
|
+
const configuredLabels = _filterInstanceProperty(_context2 = this.concept.getLabelElementByIds(configuredLabelProperties)).call(_context2, configuredLabel => configuredLabel.value && configuredLabel.value !== "");
|
|
165
164
|
if (configuredLabels.length > 0) {
|
|
166
|
-
var
|
|
167
|
-
return _mapInstanceProperty(
|
|
165
|
+
var _context3;
|
|
166
|
+
return _mapInstanceProperty(_context3 = _filterInstanceProperty(configuredLabelProperties).call(configuredLabelProperties, configuredLabelProperty => configuredLabels.some(configuredLabel => configuredLabel._id === configuredLabelProperty))).call(_context3, configuredLabelProperty => _findInstanceProperty(configuredLabels).call(configuredLabels, configuredLabel => configuredLabel._id === configuredLabelProperty))[0].value;
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
169
|
return this.label;
|
|
@@ -195,9 +195,9 @@ class ChoiceAttributeOptionModel
|
|
|
195
195
|
return title.readonlyvalue;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
return this.attributeCollection.all
|
|
199
|
+
.map((attribute) => attribute.readonlyvalue)
|
|
200
|
+
.join(" · ");
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
return "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceAttributeOptionModel.js","names":["BaseModel","ChoiceAttributeOptionCollection","has","TIMEVERSION_FILTER_NAME","TITLE","hasAllContentInData","LinkCollection","AttributeCollection","ConceptDetailModel","AttributeContent","ChoiceAttributeOptionModel","constructor","selectedValues","option","modelOptions","_defineProperty","code","contributions","key","_isSelected","_includesInstanceProperty","call","_referenceDate","referenceDate","Date","toISOString","split","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","origin","contextPath","_content","content","_isUser","optionType","createFromListItemModel","listitem","id","toString","attributeCollection","clone","links","isChoiceAttributeOptionModel","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","errors","conceptHref","href","concept","_findInstanceProperty","model","selfhref","equalsWithParameters","_code","equals","getContribution","data","isReadonly","label","hasItems","title","getAttributeByLayoutHint","readonlyvalue","first","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","length","_context","configuredLabels","_filterInstanceProperty","getLabelElementByIds","configuredLabel","value","_context2","_mapInstanceProperty","configuredLabelProperty","some","_id","selected","count","create","options","date","getLinkByKey","addParameter","isCacheable","avatarLink","_concept","level","isBooleanType","hasAlternativeLabel","mergeOption","withOption","mergeOptions","isUser"],"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { has } from \"../../utils/helpers/objects\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\nimport AttributeContent from \"./AttributeContent\";\n\nimport type {\n IModelWithChildModels,\n ModelOptions,\n ModularUIModel,\n} from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\nexport type ChoiceAttributeOptionModelOptions = {\n ...ModelOptions,\n referenceDate: ISO_DATE,\n};\n\n/**\n */\nclass ChoiceAttributeOptionModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n _isUser: boolean = false;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate =\n modelOptions?.referenceDate || new Date().toISOString().split(\"T\")[0];\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection(modelOptions);\n this._children = this.addChildren(selectedValues, option, modelOptions);\n\n this._links = new LinkCollection(\n this.contributions._links,\n {},\n { origin: modelOptions?.origin, contextPath: modelOptions?.contextPath },\n );\n\n this._content = new AttributeContent(option.content);\n\n this._isUser = option.optionType === \"user\";\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel,\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection.clone();\n option.links = listitem.links.clone();\n\n return option;\n }\n\n /**\n * Indicates that this a choice attribute option model, used when adding options to a choice attribute\n * @returns {boolean}\n */\n get isChoiceAttributeOptionModel(): boolean {\n return true;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models, errors);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, {\n origin: modelOptions?.origin,\n contextPath: modelOptions?.contextPath,\n isReadonly: true,\n });\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n if (this.attributeCollection.first) {\n return this.attributeCollection.first.readonlyvalue;\n }\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\",\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection(modelOptions);\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n modelOptions,\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate,\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n *\n */\n get avatarLink(): LinkModel | null {\n return this.links.getLinkByKey(\"avatar\");\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n\n /**\n */\n get isUser(): boolean {\n return this._isUser;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"mappings":";;;;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,+BAA+B,MAAM,mCAAmC;AAE/E,SAASC,GAAG,QAAQ,6BAA6B;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,KAAK,QAAQ,6BAA6B;AACnD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,kBAAkB,MAAM,gCAAgC;AAC/D,OAAOC,gBAAgB,MAAM,oBAAoB;AAgBjD;AACA;AACA,MAAMC,0BAA0B,SACtBV,SAAS,CAEnB;EAYE;AACF;EACEW,WAAWA,CACTC,cAA6B,GAAG,EAAE,EAClCC,MAAc,GAAG,CAAC,CAAC,EACnBC,YAAgD,EAChD;IACA,KAAK,CAAC,CAAC,CAAC,EAAED,MAAM,CAAC;IAACE,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,kBATD,KAAK;IAWtB,IAAI,CAACC,IAAI,GAAG,IAAI,CAACC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AC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAI+B,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAI,CAACD,QAAQ;EACtB;;EAEA;AACF;EACE,IAAIwE,MAAMA,CAAA,EAAY;IACpB,OAAO,IAAI,CAACtE,OAAO;EACrB;AACF;AAEA,eAAe3B,0BAA0B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ChoiceAttributeOptionModel.js","names":["BaseModel","ChoiceAttributeOptionCollection","has","TIMEVERSION_FILTER_NAME","TITLE","hasAllContentInData","LinkCollection","AttributeCollection","ConceptDetailModel","AttributeContent","ChoiceAttributeOptionModel","constructor","selectedValues","option","modelOptions","_defineProperty","code","contributions","key","_isSelected","_includesInstanceProperty","call","_referenceDate","referenceDate","Date","toISOString","split","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","origin","contextPath","_content","content","_isUser","optionType","createFromListItemModel","listitem","id","toString","attributeCollection","clone","links","isChoiceAttributeOptionModel","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","errors","conceptHref","href","concept","_findInstanceProperty","model","selfhref","equalsWithParameters","_code","equals","getContribution","data","isReadonly","label","hasItems","_context","title","getAttributeByLayoutHint","readonlyvalue","_mapInstanceProperty","all","attribute","join","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","length","_context2","configuredLabels","_filterInstanceProperty","getLabelElementByIds","configuredLabel","value","_context3","configuredLabelProperty","some","_id","selected","count","create","options","date","getLinkByKey","addParameter","isCacheable","avatarLink","_concept","level","isBooleanType","hasAlternativeLabel","mergeOption","withOption","mergeOptions","isUser"],"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { has } from \"../../utils/helpers/objects\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\nimport AttributeContent from \"./AttributeContent\";\n\nimport type {\n IModelWithChildModels,\n ModelOptions,\n ModularUIModel,\n} from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\nexport type ChoiceAttributeOptionModelOptions = {\n ...ModelOptions,\n referenceDate: ISO_DATE,\n};\n\n/**\n */\nclass ChoiceAttributeOptionModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n _isUser: boolean = false;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate =\n modelOptions?.referenceDate || new Date().toISOString().split(\"T\")[0];\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection(modelOptions);\n this._children = this.addChildren(selectedValues, option, modelOptions);\n\n this._links = new LinkCollection(\n this.contributions._links,\n {},\n { origin: modelOptions?.origin, contextPath: modelOptions?.contextPath },\n );\n\n this._content = new AttributeContent(option.content);\n\n this._isUser = option.optionType === \"user\";\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel,\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection.clone();\n option.links = listitem.links.clone();\n\n return option;\n }\n\n /**\n * Indicates that this a choice attribute option model, used when adding options to a choice attribute\n * @returns {boolean}\n */\n get isChoiceAttributeOptionModel(): boolean {\n return true;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models, errors);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, {\n origin: modelOptions?.origin,\n contextPath: modelOptions?.contextPath,\n isReadonly: true,\n });\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n return this.attributeCollection.all\n .map((attribute) => attribute.readonlyvalue)\n .join(\" · \");\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\",\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection(modelOptions);\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n modelOptions,\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate,\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n *\n */\n get avatarLink(): LinkModel | null {\n return this.links.getLinkByKey(\"avatar\");\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n\n /**\n */\n get isUser(): boolean {\n return this._isUser;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"mappings":";;;;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,+BAA+B,MAAM,mCAAmC;AAE/E,SAASC,GAAG,QAAQ,6BAA6B;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,KAAK,QAAQ,6BAA6B;AACnD,SAASC,mBAAmB,QAAQ,0BAA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IAAI,CAAC7E,MAAM,GAAG6E,KAAK;EACrB;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAY;IAC3B,OAAO,IAAI,CAACxC,eAAe,CAAC,eAAe,EAAE,KAAK,CAAC;EACrD;;EAEA;AACF;EACE,IAAIyC,mBAAmBA,CAAA,EAAY;IACjC,OAAO,IAAI,CAACzC,eAAe,CAAC,qBAAqB,EAAE,KAAK,CAAC;EAC3D;;EAEA;AACF;EACE0C,WAAWA,CAACC,UAAsC,EAAE;IAClD,IAAI,CAAClD,OAAO,GAAGkD,UAAU,CAAClD,OAAO;IAEjC,IAAI,IAAI,CAACN,QAAQ,IAAI,IAAI,IAAIwD,UAAU,CAACxD,QAAQ,IAAI,IAAI,EAAE;MACxD,IAAI,CAACA,QAAQ,CAACyD,YAAY,CAACD,UAAU,CAACxD,QAAQ,CAAC;IACjD;EACF;;EAEA;AACF;AACA;EACE,IAAIH,kBAAkBA,CAAA,EAAY;IAChC,OAAO5C,mBAAmB,CAAC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAI+B,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAI,CAACD,QAAQ;EACtB;;EAEA;AACF;EACE,IAAI2E,MAAMA,CAAA,EAAY;IACpB,OAAO,IAAI,CAACzE,OAAO;EACrB;AACF;AAEA,eAAe3B,0BAA0B","ignoreList":[]}
|
|
@@ -158,7 +158,7 @@ class CompositeAttributeChildCollection extends ResourceCollection {
|
|
|
158
158
|
var _context1, _context10;
|
|
159
159
|
if (this.first instanceof CompositeAttributeChildCollection) {
|
|
160
160
|
var _context0;
|
|
161
|
-
return _mapInstanceProperty(_context0 = this.collection).call(_context0, collection => collection.readonlyvalue).join("
|
|
161
|
+
return _mapInstanceProperty(_context0 = this.collection).call(_context0, collection => collection.readonlyvalue).join(" · ");
|
|
162
162
|
}
|
|
163
163
|
return _mapInstanceProperty(_context1 = _filterInstanceProperty(_context10 = this.collection).call(_context10, child => child.value !== null)).call(_context1, child => child.readonlyvalue).join(", ");
|
|
164
164
|
}
|
|
@@ -223,7 +223,7 @@ class CompositeAttributeChildCollection extends ResourceCollection<AttributeType
|
|
|
223
223
|
if (this.first instanceof CompositeAttributeChildCollection) {
|
|
224
224
|
return this.collection
|
|
225
225
|
.map((collection) => collection.readonlyvalue)
|
|
226
|
-
.join("
|
|
226
|
+
.join(" · ");
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
return this.collection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeAttributeChildCollection.js","names":["ResourceCollection","ErrorCollection","createAttribute","CompositeAttributeChildCollection","create","data","contributions","modelOptions","Array","isArray","children","isMultipleTableRows","createMultiData","createStandard","_context","_context2","compositeChildCollection","collection","_filterInstanceProperty","_mapInstanceProperty","call","contribution","_context3","_context4","key","_Object$keys","attributeData","_findInstanceProperty","attr","attributeContribution","_includesInstanceProperty","type","replace","attribute","dynamicschema","readonly","parentKey","_context5","childData","getInputValue","_context6","child","inputvalue","join","validate","every","isValid","errorCollection","hasServerErrors","serverErrors","length","some","hasErrors","hasItems","reset","forEach","initvalue","_context8","first","_context7","value","_context9","formdata","readonlyvalue","_context1","_context10","_context0","updateValidations","prefix","errors","attributeErrors","error","anchor","elementid","hasValue"],"sources":["../../../src/models/attributes/CompositeAttributeChildCollection.js"],"sourcesContent":["// @flow\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\n\nimport createAttribute from \"./_createAttribute\";\n\nimport type { AttributeType, ModelOptions } from \"../types\";\n\n/**\n * Collection of choice attribute options\n */\nclass CompositeAttributeChildCollection extends ResourceCollection<AttributeType> {\n /**\n */\n static create(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n if (\n data &&\n contributions &&\n Array.isArray(contributions.children) &&\n Array.isArray(data.children)\n ) {\n // a composite with multiple data elements and one contributions element\n // multiple 'composites' are returned\n const isMultipleTableRows = Array.isArray(data.children[0]);\n if (isMultipleTableRows) {\n return CompositeAttributeChildCollection.createMultiData(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return CompositeAttributeChildCollection.createStandard(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return new CompositeAttributeChildCollection();\n }\n\n /**\n */\n static createStandard(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = contributions.children\n .map((contribution) => {\n const [key] = Object.keys(contribution);\n\n const attributeData = Array.isArray(data.children)\n ? data.children.find((attr) => attr.key === key)\n : {};\n\n const attributeContribution = contribution[key];\n\n if (\n contributions.type.includes(\"range\") &&\n !attributeContribution.type\n ) {\n attributeContribution.type = contributions.type.replace(\"range\", \"\");\n }\n\n const attribute = createAttribute(\n key,\n {\n ...attributeData,\n dynamicschema: attributeData?.dynamicschema,\n },\n {\n ...attributeContribution,\n readonly: attributeContribution.readonly || contributions.readonly,\n },\n modelOptions,\n );\n\n if (attribute) {\n attribute.parentKey = data.key;\n }\n\n return attribute;\n })\n .filter((attribute) => attribute !== null);\n\n return compositeChildCollection;\n }\n\n /*\n * Creates a composite for each child data element using the same contributions\n */\n /**\n */\n static createMultiData(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = data.children.map((childData) =>\n CompositeAttributeChildCollection.create(\n {\n ...data,\n children: childData,\n },\n contributions,\n modelOptions,\n ),\n );\n\n return compositeChildCollection;\n }\n\n /**\n * Get input value of contributions\n */\n getInputValue(): string {\n return this.collection.map((child) => child.inputvalue).join(\",\");\n }\n\n /**\n * Validate input\n */\n validate(): boolean {\n return this.collection.every((child) => child.isValid);\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n return new ErrorCollection(\"compositechildren\");\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.serverErrors.length > 0 ||\n this.collection.some((child) => child.hasServerErrors())\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.collection.some((child) => child.hasErrors())\n );\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.collection.forEach((child) => {\n child.reset();\n });\n }\n\n /**\n */\n get initvalue(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n // $FlowFixMe[missing-type-arg]\n return this.collection.map<Array<Object>>(\n (collection) => collection.initvalue,\n );\n }\n\n const children: { [string]: any } = {};\n this.collection\n .filter((child) => child.initvalue !== null)\n .forEach((child) => {\n children[child.key] = child.initvalue;\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get value(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection.map((collection) => collection.value);\n }\n\n let children: { [string]: any } = {};\n\n this.collection.forEach((attribute) => {\n if (attribute.formdata !== null && !attribute.readonly) {\n children = {\n ...children,\n ...attribute.formdata,\n };\n }\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection\n .map((collection) => collection.readonlyvalue)\n .join(\" | \");\n }\n\n return this.collection\n .filter((child) => child.value !== null)\n .map((child) => child.readonlyvalue)\n .join(\", \");\n }\n\n /**\n */\n updateValidations(prefix: string, errors: Object) {\n this.collection.forEach((child) => {\n const attributeErrors = errors.filter(\n (error) => error.anchor?.elementid === `${prefix}${child.key}`,\n );\n\n child.updateValidations(attributeErrors);\n });\n }\n\n /**\n */\n hasValue(): boolean {\n return this.collection.some((child) => child.hasValue());\n }\n}\n\nexport default CompositeAttributeChildCollection;\n"],"mappings":";;;;;AACA,OAAOA,kBAAkB,MAAM,4BAA4B;AAC3D,OAAOC,eAAe,MAAM,0BAA0B;AAEtD,OAAOC,eAAe,MAAM,oBAAoB;AAIhD;AAC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IAAAC,SAAA,EAAAC,UAAA;IAC1B,IAAI,IAAI,CAACP,KAAK,YAAYvD,iCAAiC,EAAE;MAAA,IAAA+D,SAAA;MAC3D,OAAO/C,oBAAA,CAAA+C,SAAA,OAAI,CAACjD,UAAU,EAAAG,IAAA,CAAA8C,SAAA,EACdjD,UAAU,IAAKA,UAAU,CAAC8C,aAAa,CAAC,CAC7CpB,IAAI,CAAC,KAAK,CAAC;IAChB;IAEA,OAAOxB,oBAAA,CAAA6C,SAAA,GAAA9C,uBAAA,CAAA+C,UAAA,OAAI,CAAChD,UAAU,EAAAG,IAAA,CAAA6C,UAAA,EACXxB,KAAK,IAAKA,KAAK,CAACmB,KAAK,KAAK,IAAI,CAAC,EAAAxC,IAAA,CAAA4C,SAAA,EAClCvB,KAAK,IAAKA,KAAK,CAACsB,aAAa,CAAC,CACnCpB,IAAI,CAAC,IAAI,CAAC;EACf;;EAEA;AACF;EACEwB,iBAAiBA,CAACC,MAAc,EAAEC,MAAc,EAAE;IAChD,IAAI,CAACpD,UAAU,CAACsC,OAAO,CAAEd,KAAK,IAAK;MACjC,MAAM6B,eAAe,GAAGpD,uBAAA,CAAAmD,MAAM,EAAAjD,IAAA,CAANiD,MAAM,EAC3BE,KAAK,IAAKA,KAAK,CAACC,MAAM,EAAEC,SAAS,KAAK,GAAGL,MAAM,GAAG3B,KAAK,CAACjB,GAAG,EAC9D,CAAC;MAEDiB,KAAK,CAAC0B,iBAAiB,CAACG,eAAe,CAAC;IAC1C,CAAC,CAAC;EACJ;;EAEA;AACF;EACEI,QAAQA,CAAA,EAAY;IAClB,OAAO,IAAI,CAACzD,UAAU,CAACkC,IAAI,CAAEV,KAAK,IAAKA,KAAK,CAACiC,QAAQ,CAAC,CAAC,CAAC;EAC1D;AACF;AAEA,eAAevE,iCAAiC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"CompositeAttributeChildCollection.js","names":["ResourceCollection","ErrorCollection","createAttribute","CompositeAttributeChildCollection","create","data","contributions","modelOptions","Array","isArray","children","isMultipleTableRows","createMultiData","createStandard","_context","_context2","compositeChildCollection","collection","_filterInstanceProperty","_mapInstanceProperty","call","contribution","_context3","_context4","key","_Object$keys","attributeData","_findInstanceProperty","attr","attributeContribution","_includesInstanceProperty","type","replace","attribute","dynamicschema","readonly","parentKey","_context5","childData","getInputValue","_context6","child","inputvalue","join","validate","every","isValid","errorCollection","hasServerErrors","serverErrors","length","some","hasErrors","hasItems","reset","forEach","initvalue","_context8","first","_context7","value","_context9","formdata","readonlyvalue","_context1","_context10","_context0","updateValidations","prefix","errors","attributeErrors","error","anchor","elementid","hasValue"],"sources":["../../../src/models/attributes/CompositeAttributeChildCollection.js"],"sourcesContent":["// @flow\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\n\nimport createAttribute from \"./_createAttribute\";\n\nimport type { AttributeType, ModelOptions } from \"../types\";\n\n/**\n * Collection of choice attribute options\n */\nclass CompositeAttributeChildCollection extends ResourceCollection<AttributeType> {\n /**\n */\n static create(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n if (\n data &&\n contributions &&\n Array.isArray(contributions.children) &&\n Array.isArray(data.children)\n ) {\n // a composite with multiple data elements and one contributions element\n // multiple 'composites' are returned\n const isMultipleTableRows = Array.isArray(data.children[0]);\n if (isMultipleTableRows) {\n return CompositeAttributeChildCollection.createMultiData(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return CompositeAttributeChildCollection.createStandard(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return new CompositeAttributeChildCollection();\n }\n\n /**\n */\n static createStandard(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = contributions.children\n .map((contribution) => {\n const [key] = Object.keys(contribution);\n\n const attributeData = Array.isArray(data.children)\n ? data.children.find((attr) => attr.key === key)\n : {};\n\n const attributeContribution = contribution[key];\n\n if (\n contributions.type.includes(\"range\") &&\n !attributeContribution.type\n ) {\n attributeContribution.type = contributions.type.replace(\"range\", \"\");\n }\n\n const attribute = createAttribute(\n key,\n {\n ...attributeData,\n dynamicschema: attributeData?.dynamicschema,\n },\n {\n ...attributeContribution,\n readonly: attributeContribution.readonly || contributions.readonly,\n },\n modelOptions,\n );\n\n if (attribute) {\n attribute.parentKey = data.key;\n }\n\n return attribute;\n })\n .filter((attribute) => attribute !== null);\n\n return compositeChildCollection;\n }\n\n /*\n * Creates a composite for each child data element using the same contributions\n */\n /**\n */\n static createMultiData(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = data.children.map((childData) =>\n CompositeAttributeChildCollection.create(\n {\n ...data,\n children: childData,\n },\n contributions,\n modelOptions,\n ),\n );\n\n return compositeChildCollection;\n }\n\n /**\n * Get input value of contributions\n */\n getInputValue(): string {\n return this.collection.map((child) => child.inputvalue).join(\",\");\n }\n\n /**\n * Validate input\n */\n validate(): boolean {\n return this.collection.every((child) => child.isValid);\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n return new ErrorCollection(\"compositechildren\");\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.serverErrors.length > 0 ||\n this.collection.some((child) => child.hasServerErrors())\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.collection.some((child) => child.hasErrors())\n );\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.collection.forEach((child) => {\n child.reset();\n });\n }\n\n /**\n */\n get initvalue(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n // $FlowFixMe[missing-type-arg]\n return this.collection.map<Array<Object>>(\n (collection) => collection.initvalue,\n );\n }\n\n const children: { [string]: any } = {};\n this.collection\n .filter((child) => child.initvalue !== null)\n .forEach((child) => {\n children[child.key] = child.initvalue;\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get value(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection.map((collection) => collection.value);\n }\n\n let children: { [string]: any } = {};\n\n this.collection.forEach((attribute) => {\n if (attribute.formdata !== null && !attribute.readonly) {\n children = {\n ...children,\n ...attribute.formdata,\n };\n }\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection\n .map((collection) => collection.readonlyvalue)\n .join(\" · \");\n }\n\n return this.collection\n .filter((child) => child.value !== null)\n .map((child) => child.readonlyvalue)\n .join(\", \");\n }\n\n /**\n */\n updateValidations(prefix: string, errors: Object) {\n this.collection.forEach((child) => {\n const attributeErrors = errors.filter(\n (error) => error.anchor?.elementid === `${prefix}${child.key}`,\n );\n\n child.updateValidations(attributeErrors);\n });\n }\n\n /**\n */\n hasValue(): boolean {\n return this.collection.some((child) => child.hasValue());\n }\n}\n\nexport default CompositeAttributeChildCollection;\n"],"mappings":";;;;;AACA,OAAOA,kBAAkB,MAAM,4BAA4B;AAC3D,OAAOC,eAAe,MAAM,0BAA0B;AAEtD,OAAOC,eAAe,MAAM,oBAAoB;AAIhD;AACA;AACA;AACA,MAAMC,iCAAiC,SAASH,kBAAkB,CAAgB;EAChF;AACF;EACE,OAAOI,MAAMA,CACXC,IAAY,EACZC,aAAqB,EACrBC,YAA2B,EACQ;IACnC,IACEF,IAAI,IACJC,aAAa,IACbE,KAAK,CAACC,OAAO,CAACH,aAAa,CAACI,QAAQ,CAAC,IACrCF,KAAK,CAACC,OAAO,CAACJ,IAAI,CAACK,QAAQ,CAAC,EAC5B;MACA;MACA;MACA,MAAMC,mBAAmB,GAAGH,KAAK,CAACC,OAAO,CAACJ,IAAI,CAACK,QAAQ,CAAC,CAAC,CAAC,CAAC;MAC3D,IAAI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AAK,IAAKA,KAAK,CAACmB,KAAK,KAAK,IAAI,CAAC,EAAAxC,IAAA,CAAA4C,SAAA,EAClCvB,KAAK,IAAKA,KAAK,CAACsB,aAAa,CAAC,CACnCpB,IAAI,CAAC,IAAI,CAAC;EACf;;EAEA;AACF;EACEwB,iBAAiBA,CAACC,MAAc,EAAEC,MAAc,EAAE;IAChD,IAAI,CAACpD,UAAU,CAACsC,OAAO,CAAEd,KAAK,IAAK;MACjC,MAAM6B,eAAe,GAAGpD,uBAAA,CAAAmD,MAAM,EAAAjD,IAAA,CAANiD,MAAM,EAC3BE,KAAK,IAAKA,KAAK,CAACC,MAAM,EAAEC,SAAS,KAAK,GAAGL,MAAM,GAAG3B,KAAK,CAACjB,GAAG,EAC9D,CAAC;MAEDiB,KAAK,CAAC0B,iBAAiB,CAACG,eAAe,CAAC;IAC1C,CAAC,CAAC;EACJ;;EAEA;AACF;EACEI,QAAQA,CAAA,EAAY;IAClB,OAAO,IAAI,CAACzD,UAAU,CAACkC,IAAI,CAAEV,KAAK,IAAKA,KAAK,CAACiC,QAAQ,CAAC,CAAC,CAAC;EAC1D;AACF;AAEA,eAAevE,iCAAiC","ignoreList":[]}
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
9
9
|
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
10
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
11
10
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
11
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
13
13
|
var _BaseModel = _interopRequireDefault(require("../base/BaseModel"));
|
|
14
14
|
var _ChoiceAttributeOptionCollection = _interopRequireDefault(require("./ChoiceAttributeOptionCollection"));
|
|
@@ -149,13 +149,12 @@ class ChoiceAttributeOptionModel extends _BaseModel.default {
|
|
|
149
149
|
return this.contributions.label;
|
|
150
150
|
}
|
|
151
151
|
if (this.attributeCollection.hasItems) {
|
|
152
|
+
var _context;
|
|
152
153
|
const title = this.attributeCollection.getAttributeByLayoutHint(_LayoutHints.TITLE);
|
|
153
154
|
if (title) {
|
|
154
155
|
return title.readonlyvalue;
|
|
155
156
|
}
|
|
156
|
-
|
|
157
|
-
return this.attributeCollection.first.readonlyvalue;
|
|
158
|
-
}
|
|
157
|
+
return (0, _map.default)(_context = this.attributeCollection.all).call(_context, attribute => attribute.readonlyvalue).join(" · ");
|
|
159
158
|
}
|
|
160
159
|
return "";
|
|
161
160
|
}
|
|
@@ -167,11 +166,11 @@ class ChoiceAttributeOptionModel extends _BaseModel.default {
|
|
|
167
166
|
getContentConfiguredLabel(contentConfiguration) {
|
|
168
167
|
const configuredLabelProperties = contentConfiguration?.labelConfig?.[0]?.types ?? [];
|
|
169
168
|
if (!this.hasContentFromData && this.concept && configuredLabelProperties.length > 0) {
|
|
170
|
-
var
|
|
171
|
-
const configuredLabels = (0, _filter.default)(
|
|
169
|
+
var _context2;
|
|
170
|
+
const configuredLabels = (0, _filter.default)(_context2 = this.concept.getLabelElementByIds(configuredLabelProperties)).call(_context2, configuredLabel => configuredLabel.value && configuredLabel.value !== "");
|
|
172
171
|
if (configuredLabels.length > 0) {
|
|
173
|
-
var
|
|
174
|
-
return (0, _map.default)(
|
|
172
|
+
var _context3;
|
|
173
|
+
return (0, _map.default)(_context3 = (0, _filter.default)(configuredLabelProperties).call(configuredLabelProperties, configuredLabelProperty => configuredLabels.some(configuredLabel => configuredLabel._id === configuredLabelProperty))).call(_context3, configuredLabelProperty => (0, _find.default)(configuredLabels).call(configuredLabels, configuredLabel => configuredLabel._id === configuredLabelProperty))[0].value;
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
176
|
return this.label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceAttributeOptionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ChoiceAttributeOptionCollection","_objects","_Constants","_LayoutHints","_Settings","_LinkCollection","_AttributeCollection","_ConceptDetailModel","_AttributeContent","ChoiceAttributeOptionModel","BaseModel","constructor","selectedValues","option","modelOptions","_defineProperty2","default","code","contributions","key","_isSelected","_includes","call","_referenceDate","referenceDate","Date","toISOString","split","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","LinkCollection","origin","contextPath","_content","AttributeContent","content","_isUser","optionType","createFromListItemModel","listitem","id","toString","attributeCollection","clone","links","isChoiceAttributeOptionModel","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","errors","conceptHref","href","concept","_find","model","selfhref","equalsWithParameters","_code","equals","getContribution","has","data","AttributeCollection","isReadonly","label","hasItems","title","getAttributeByLayoutHint","TITLE","readonlyvalue","first","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","length","_context","configuredLabels","_filter","getLabelElementByIds","configuredLabel","value","_context2","_map","configuredLabelProperty","some","_id","selected","count","ChoiceAttributeOptionCollection","create","options","date","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","isCacheable","avatarLink","_concept","ConceptDetailModel","level","isBooleanType","hasAlternativeLabel","mergeOption","withOption","mergeOptions","hasAllContentInData","isUser","_default","exports"],"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { has } from \"../../utils/helpers/objects\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\nimport AttributeContent from \"./AttributeContent\";\n\nimport type {\n IModelWithChildModels,\n ModelOptions,\n ModularUIModel,\n} from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\nexport type ChoiceAttributeOptionModelOptions = {\n ...ModelOptions,\n referenceDate: ISO_DATE,\n};\n\n/**\n */\nclass ChoiceAttributeOptionModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n _isUser: boolean = false;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate =\n modelOptions?.referenceDate || new Date().toISOString().split(\"T\")[0];\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection(modelOptions);\n this._children = this.addChildren(selectedValues, option, modelOptions);\n\n this._links = new LinkCollection(\n this.contributions._links,\n {},\n { origin: modelOptions?.origin, contextPath: modelOptions?.contextPath },\n );\n\n this._content = new AttributeContent(option.content);\n\n this._isUser = option.optionType === \"user\";\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel,\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection.clone();\n option.links = listitem.links.clone();\n\n return option;\n }\n\n /**\n * Indicates that this a choice attribute option model, used when adding options to a choice attribute\n * @returns {boolean}\n */\n get isChoiceAttributeOptionModel(): boolean {\n return true;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models, errors);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, {\n origin: modelOptions?.origin,\n contextPath: modelOptions?.contextPath,\n isReadonly: true,\n });\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n if (this.attributeCollection.first) {\n return this.attributeCollection.first.readonlyvalue;\n }\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\",\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection(modelOptions);\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n modelOptions,\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate,\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n *\n */\n get avatarLink(): LinkModel | null {\n return this.links.getLinkByKey(\"avatar\");\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n\n /**\n */\n get isUser(): boolean {\n return this._isUser;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gCAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAAM,eAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,I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pC,IAAI,CAAC+C,QAAQ,GAAG/C,OAAO,YAAYgD,2BAAkB,GAAGhD,OAAO,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;EACE,IAAIiD,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAAClF,MAAM;EACpB;;EAEA;AACF;AACA;EACE,IAAIkF,KAAKA,CAACA,KAAa,EAAE;IACvB,IAAI,CAAClF,MAAM,GAAGkF,KAAK;EACrB;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAY;IAC3B,OAAO,IAAI,CAAC3C,eAAe,CAAC,eAAe,EAAE,KAAK,CAAC;EACrD;;EAEA;AACF;EACE,IAAI4C,mBAAmBA,CAAA,EAAY;IACjC,OAAO,IAAI,CAAC5C,eAAe,CAAC,qBAAqB,EAAE,KAAK,CAAC;EAC3D;;EAEA;AACF;EACE6C,WAAWA,CAACC,UAAsC,EAAE;IAClD,IAAI,CAACrD,OAAO,GAAGqD,UAAU,CAACrD,OAAO;IAEjC,IAAI,IAAI,CAACN,QAAQ,IAAI,IAAI,IAAI2D,UAAU,CAAC3D,QAAQ,IAAI,IAAI,EAAE;MACxD,IAAI,CAACA,QAAQ,CAAC4D,YAAY,CAACD,UAAU,CAAC3D,QAAQ,CAAC;IACjD;EACF;;EAEA;AACF;AACA;EACE,IAAIH,kBAAkBA,CAAA,EAAY;IAChC,OAAO,IAAAgE,6BAAmB,EAAC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAI7E,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAI,CAACF,QAAQ;EACtB;;EAEA;AACF;EACE,IAAIgF,MAAMA,CAAA,EAAY;IACpB,OAAO,IAAI,CAAC7E,OAAO;EACrB;AACF;AAAC,IAAA8E,QAAA,GAAAC,OAAA,CAAAvG,OAAA,GAEcP,0BAA0B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ChoiceAttributeOptionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ChoiceAttributeOptionCollection","_objects","_Constants","_LayoutHints","_Settings","_LinkCollection","_AttributeCollection","_ConceptDetailModel","_AttributeContent","ChoiceAttributeOptionModel","BaseModel","constructor","selectedValues","option","modelOptions","_defineProperty2","default","code","contributions","key","_isSelected","_includes","call","_referenceDate","referenceDate","Date","toISOString","split","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","LinkCollection","origin","contextPath","_content","AttributeContent","content","_isUser","optionType","createFromListItemModel","listitem","id","toString","attributeCollection","clone","links","isChoiceAttributeOptionModel","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","errors","conceptHref","href","concept","_find","model","selfhref","equalsWithParameters","_code","equals","getContribution","has","data","AttributeCollection","isReadonly","label","hasItems","_context","title","getAttributeByLayoutHint","TITLE","readonlyvalue","_map","all","attribute","join","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","length","_context2","configuredLabels","_filter","getLabelElementByIds","configuredLabel","value","_context3","configuredLabelProperty","some","_id","selected","count","ChoiceAttributeOptionCollection","create","options","date","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","isCacheable","avatarLink","_concept","ConceptDetailModel","level","isBooleanType","hasAlternativeLabel","mergeOption","withOption","mergeOptions","hasAllContentInData","isUser","_default","exports"],"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { has } from \"../../utils/helpers/objects\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\nimport AttributeContent from \"./AttributeContent\";\n\nimport type {\n IModelWithChildModels,\n ModelOptions,\n ModularUIModel,\n} from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\nexport type ChoiceAttributeOptionModelOptions = {\n ...ModelOptions,\n referenceDate: ISO_DATE,\n};\n\n/**\n */\nclass ChoiceAttributeOptionModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n _isUser: boolean = false;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate =\n modelOptions?.referenceDate || new Date().toISOString().split(\"T\")[0];\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection(modelOptions);\n this._children = this.addChildren(selectedValues, option, modelOptions);\n\n this._links = new LinkCollection(\n this.contributions._links,\n {},\n { origin: modelOptions?.origin, contextPath: modelOptions?.contextPath },\n );\n\n this._content = new AttributeContent(option.content);\n\n this._isUser = option.optionType === \"user\";\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel,\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection.clone();\n option.links = listitem.links.clone();\n\n return option;\n }\n\n /**\n * Indicates that this a choice attribute option model, used when adding options to a choice attribute\n * @returns {boolean}\n */\n get isChoiceAttributeOptionModel(): boolean {\n return true;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models, errors);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, {\n origin: modelOptions?.origin,\n contextPath: modelOptions?.contextPath,\n isReadonly: true,\n });\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n return this.attributeCollection.all\n .map((attribute) => attribute.readonlyvalue)\n .join(\" · \");\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\",\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty,\n ),\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n modelOptions?: ChoiceAttributeOptionModelOptions,\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection(modelOptions);\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n modelOptions,\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate,\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n *\n */\n get avatarLink(): LinkModel | null {\n return this.links.getLinkByKey(\"avatar\");\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n\n /**\n */\n get isUser(): boolean {\n return this._isUser;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gCAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAAM,eAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,oBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,mBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AAgBA;AACA;AACA,MAAMU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D,OAAO,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;EACE,IAAIoD,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACrF,MAAM;EACpB;;EAEA;AACF;AACA;EACE,IAAIqF,KAAKA,CAACA,KAAa,EAAE;IACvB,IAAI,CAACrF,MAAM,GAAGqF,KAAK;EACrB;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAY;IAC3B,OAAO,IAAI,CAAC9C,eAAe,CAAC,eAAe,EAAE,KAAK,CAAC;EACrD;;EAEA;AACF;EACE,IAAI+C,mBAAmBA,CAAA,EAAY;IACjC,OAAO,IAAI,CAAC/C,eAAe,CAAC,qBAAqB,EAAE,KAAK,CAAC;EAC3D;;EAEA;AACF;EACEgD,WAAWA,CAACC,UAAsC,EAAE;IAClD,IAAI,CAACxD,OAAO,GAAGwD,UAAU,CAACxD,OAAO;IAEjC,IAAI,IAAI,CAACN,QAAQ,IAAI,IAAI,IAAI8D,UAAU,CAAC9D,QAAQ,IAAI,IAAI,EAAE;MACxD,IAAI,CAACA,QAAQ,CAAC+D,YAAY,CAACD,UAAU,CAAC9D,QAAQ,CAAC;IACjD;EACF;;EAEA;AACF;AACA;EACE,IAAIH,kBAAkBA,CAAA,EAAY;IAChC,OAAO,IAAAmE,6BAAmB,EAAC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAIhF,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAI,CAACF,QAAQ;EACtB;;EAEA;AACF;EACE,IAAImF,MAAMA,CAAA,EAAY;IACpB,OAAO,IAAI,CAAChF,OAAO;EACrB;AACF;AAAC,IAAAiF,QAAA,GAAAC,OAAA,CAAA1G,OAAA,GAEcP,0BAA0B","ignoreList":[]}
|
|
@@ -165,7 +165,7 @@ class CompositeAttributeChildCollection extends _ResourceCollection.default {
|
|
|
165
165
|
var _context1, _context10;
|
|
166
166
|
if (this.first instanceof CompositeAttributeChildCollection) {
|
|
167
167
|
var _context0;
|
|
168
|
-
return (0, _map.default)(_context0 = this.collection).call(_context0, collection => collection.readonlyvalue).join("
|
|
168
|
+
return (0, _map.default)(_context0 = this.collection).call(_context0, collection => collection.readonlyvalue).join(" · ");
|
|
169
169
|
}
|
|
170
170
|
return (0, _map.default)(_context1 = (0, _filter.default)(_context10 = this.collection).call(_context10, child => child.value !== null)).call(_context1, child => child.readonlyvalue).join(", ");
|
|
171
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeAttributeChildCollection.js","names":["_ResourceCollection","_interopRequireDefault","require","_ErrorCollection","_createAttribute","CompositeAttributeChildCollection","ResourceCollection","create","data","contributions","modelOptions","Array","isArray","children","isMultipleTableRows","createMultiData","createStandard","_context","_context2","compositeChildCollection","collection","_filter","default","_map","call","contribution","_context3","_context4","key","_keys","attributeData","_find","attr","attributeContribution","_includes","type","replace","attribute","createAttribute","dynamicschema","readonly","parentKey","_context5","childData","getInputValue","_context6","child","inputvalue","join","validate","every","isValid","errorCollection","ErrorCollection","hasServerErrors","serverErrors","length","some","hasErrors","hasItems","reset","forEach","initvalue","_context8","first","_context7","value","_context9","formdata","readonlyvalue","_context1","_context10","_context0","updateValidations","prefix","errors","attributeErrors","error","anchor","elementid","hasValue","_default","exports"],"sources":["../../../src/models/attributes/CompositeAttributeChildCollection.js"],"sourcesContent":["// @flow\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\n\nimport createAttribute from \"./_createAttribute\";\n\nimport type { AttributeType, ModelOptions } from \"../types\";\n\n/**\n * Collection of choice attribute options\n */\nclass CompositeAttributeChildCollection extends ResourceCollection<AttributeType> {\n /**\n */\n static create(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n if (\n data &&\n contributions &&\n Array.isArray(contributions.children) &&\n Array.isArray(data.children)\n ) {\n // a composite with multiple data elements and one contributions element\n // multiple 'composites' are returned\n const isMultipleTableRows = Array.isArray(data.children[0]);\n if (isMultipleTableRows) {\n return CompositeAttributeChildCollection.createMultiData(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return CompositeAttributeChildCollection.createStandard(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return new CompositeAttributeChildCollection();\n }\n\n /**\n */\n static createStandard(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = contributions.children\n .map((contribution) => {\n const [key] = Object.keys(contribution);\n\n const attributeData = Array.isArray(data.children)\n ? data.children.find((attr) => attr.key === key)\n : {};\n\n const attributeContribution = contribution[key];\n\n if (\n contributions.type.includes(\"range\") &&\n !attributeContribution.type\n ) {\n attributeContribution.type = contributions.type.replace(\"range\", \"\");\n }\n\n const attribute = createAttribute(\n key,\n {\n ...attributeData,\n dynamicschema: attributeData?.dynamicschema,\n },\n {\n ...attributeContribution,\n readonly: attributeContribution.readonly || contributions.readonly,\n },\n modelOptions,\n );\n\n if (attribute) {\n attribute.parentKey = data.key;\n }\n\n return attribute;\n })\n .filter((attribute) => attribute !== null);\n\n return compositeChildCollection;\n }\n\n /*\n * Creates a composite for each child data element using the same contributions\n */\n /**\n */\n static createMultiData(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = data.children.map((childData) =>\n CompositeAttributeChildCollection.create(\n {\n ...data,\n children: childData,\n },\n contributions,\n modelOptions,\n ),\n );\n\n return compositeChildCollection;\n }\n\n /**\n * Get input value of contributions\n */\n getInputValue(): string {\n return this.collection.map((child) => child.inputvalue).join(\",\");\n }\n\n /**\n * Validate input\n */\n validate(): boolean {\n return this.collection.every((child) => child.isValid);\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n return new ErrorCollection(\"compositechildren\");\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.serverErrors.length > 0 ||\n this.collection.some((child) => child.hasServerErrors())\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.collection.some((child) => child.hasErrors())\n );\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.collection.forEach((child) => {\n child.reset();\n });\n }\n\n /**\n */\n get initvalue(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n // $FlowFixMe[missing-type-arg]\n return this.collection.map<Array<Object>>(\n (collection) => collection.initvalue,\n );\n }\n\n const children: { [string]: any } = {};\n this.collection\n .filter((child) => child.initvalue !== null)\n .forEach((child) => {\n children[child.key] = child.initvalue;\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get value(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection.map((collection) => collection.value);\n }\n\n let children: { [string]: any } = {};\n\n this.collection.forEach((attribute) => {\n if (attribute.formdata !== null && !attribute.readonly) {\n children = {\n ...children,\n ...attribute.formdata,\n };\n }\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection\n .map((collection) => collection.readonlyvalue)\n .join(\" | \");\n }\n\n return this.collection\n .filter((child) => child.value !== null)\n .map((child) => child.readonlyvalue)\n .join(\", \");\n }\n\n /**\n */\n updateValidations(prefix: string, errors: Object) {\n this.collection.forEach((child) => {\n const attributeErrors = errors.filter(\n (error) => error.anchor?.elementid === `${prefix}${child.key}`,\n );\n\n child.updateValidations(attributeErrors);\n });\n }\n\n /**\n */\n hasValue(): boolean {\n return this.collection.some((child) => child.hasValue());\n }\n}\n\nexport default CompositeAttributeChildCollection;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,gBAAA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;IAC1C,CAAC,CAAC;EACJ;;EAEA;AACF;EACEI,QAAQA,CAAA,EAAY;IAClB,OAAO,IAAI,CAAC5D,UAAU,CAACqC,IAAI,CAAEX,KAAK,IAAKA,KAAK,CAACkC,QAAQ,CAAC,CAAC,CAAC;EAC1D;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEcjB,iCAAiC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"CompositeAttributeChildCollection.js","names":["_ResourceCollection","_interopRequireDefault","require","_ErrorCollection","_createAttribute","CompositeAttributeChildCollection","ResourceCollection","create","data","contributions","modelOptions","Array","isArray","children","isMultipleTableRows","createMultiData","createStandard","_context","_context2","compositeChildCollection","collection","_filter","default","_map","call","contribution","_context3","_context4","key","_keys","attributeData","_find","attr","attributeContribution","_includes","type","replace","attribute","createAttribute","dynamicschema","readonly","parentKey","_context5","childData","getInputValue","_context6","child","inputvalue","join","validate","every","isValid","errorCollection","ErrorCollection","hasServerErrors","serverErrors","length","some","hasErrors","hasItems","reset","forEach","initvalue","_context8","first","_context7","value","_context9","formdata","readonlyvalue","_context1","_context10","_context0","updateValidations","prefix","errors","attributeErrors","error","anchor","elementid","hasValue","_default","exports"],"sources":["../../../src/models/attributes/CompositeAttributeChildCollection.js"],"sourcesContent":["// @flow\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\n\nimport createAttribute from \"./_createAttribute\";\n\nimport type { AttributeType, ModelOptions } from \"../types\";\n\n/**\n * Collection of choice attribute options\n */\nclass CompositeAttributeChildCollection extends ResourceCollection<AttributeType> {\n /**\n */\n static create(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n if (\n data &&\n contributions &&\n Array.isArray(contributions.children) &&\n Array.isArray(data.children)\n ) {\n // a composite with multiple data elements and one contributions element\n // multiple 'composites' are returned\n const isMultipleTableRows = Array.isArray(data.children[0]);\n if (isMultipleTableRows) {\n return CompositeAttributeChildCollection.createMultiData(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return CompositeAttributeChildCollection.createStandard(\n data,\n contributions,\n modelOptions,\n );\n }\n\n return new CompositeAttributeChildCollection();\n }\n\n /**\n */\n static createStandard(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = contributions.children\n .map((contribution) => {\n const [key] = Object.keys(contribution);\n\n const attributeData = Array.isArray(data.children)\n ? data.children.find((attr) => attr.key === key)\n : {};\n\n const attributeContribution = contribution[key];\n\n if (\n contributions.type.includes(\"range\") &&\n !attributeContribution.type\n ) {\n attributeContribution.type = contributions.type.replace(\"range\", \"\");\n }\n\n const attribute = createAttribute(\n key,\n {\n ...attributeData,\n dynamicschema: attributeData?.dynamicschema,\n },\n {\n ...attributeContribution,\n readonly: attributeContribution.readonly || contributions.readonly,\n },\n modelOptions,\n );\n\n if (attribute) {\n attribute.parentKey = data.key;\n }\n\n return attribute;\n })\n .filter((attribute) => attribute !== null);\n\n return compositeChildCollection;\n }\n\n /*\n * Creates a composite for each child data element using the same contributions\n */\n /**\n */\n static createMultiData(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ): CompositeAttributeChildCollection {\n const compositeChildCollection = new CompositeAttributeChildCollection();\n\n compositeChildCollection.collection = data.children.map((childData) =>\n CompositeAttributeChildCollection.create(\n {\n ...data,\n children: childData,\n },\n contributions,\n modelOptions,\n ),\n );\n\n return compositeChildCollection;\n }\n\n /**\n * Get input value of contributions\n */\n getInputValue(): string {\n return this.collection.map((child) => child.inputvalue).join(\",\");\n }\n\n /**\n * Validate input\n */\n validate(): boolean {\n return this.collection.every((child) => child.isValid);\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n return new ErrorCollection(\"compositechildren\");\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return (\n this.errorCollection.serverErrors.length > 0 ||\n this.collection.some((child) => child.hasServerErrors())\n );\n }\n\n /**\n */\n hasErrors(): boolean {\n return (\n this.errorCollection.hasItems ||\n this.collection.some((child) => child.hasErrors())\n );\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.collection.forEach((child) => {\n child.reset();\n });\n }\n\n /**\n */\n get initvalue(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n // $FlowFixMe[missing-type-arg]\n return this.collection.map<Array<Object>>(\n (collection) => collection.initvalue,\n );\n }\n\n const children: { [string]: any } = {};\n this.collection\n .filter((child) => child.initvalue !== null)\n .forEach((child) => {\n children[child.key] = child.initvalue;\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get value(): any {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection.map((collection) => collection.value);\n }\n\n let children: { [string]: any } = {};\n\n this.collection.forEach((attribute) => {\n if (attribute.formdata !== null && !attribute.readonly) {\n children = {\n ...children,\n ...attribute.formdata,\n };\n }\n });\n\n if (Object.keys(children).length === 0) {\n return null;\n }\n\n return children;\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (this.first instanceof CompositeAttributeChildCollection) {\n return this.collection\n .map((collection) => collection.readonlyvalue)\n .join(\" · \");\n }\n\n return this.collection\n .filter((child) => child.value !== null)\n .map((child) => child.readonlyvalue)\n .join(\", \");\n }\n\n /**\n */\n updateValidations(prefix: string, errors: Object) {\n this.collection.forEach((child) => {\n const attributeErrors = errors.filter(\n (error) => error.anchor?.elementid === `${prefix}${child.key}`,\n );\n\n child.updateValidations(attributeErrors);\n });\n }\n\n /**\n */\n hasValue(): boolean {\n return this.collection.some((child) => child.hasValue());\n }\n}\n\nexport default CompositeAttributeChildCollection;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,gBAAA,GAAAH,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CAAC,CAAC;EACJ;;EAEA;AACF;EACEI,QAAQA,CAAA,EAAY;IAClB,OAAO,IAAI,CAAC5D,UAAU,CAACqC,IAAI,CAAEX,KAAK,IAAKA,KAAK,CAACkC,QAAQ,CAAC,CAAC,CAAC;EAC1D;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEcjB,iCAAiC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.67.
|
|
3
|
+
"version": "1.67.4",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "https://support.beinformed.com",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@babel/runtime-corejs3": "^7.29.0",
|
|
72
72
|
"@date-fns/tz": "^1.4.1",
|
|
73
|
-
"baseline-browser-mapping": "^2.
|
|
73
|
+
"baseline-browser-mapping": "^2.10.0",
|
|
74
74
|
"big.js": "^7.0.1",
|
|
75
75
|
"date-fns": "^4.1.0",
|
|
76
76
|
"deepmerge": "^4.3.1",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"@babel/preset-env": "^7.29.0",
|
|
99
99
|
"@babel/preset-flow": "^7.27.1",
|
|
100
100
|
"@babel/preset-react": "^7.28.5",
|
|
101
|
-
"@commitlint/cli": "^20.4.
|
|
102
|
-
"@commitlint/config-conventional": "^20.4.
|
|
101
|
+
"@commitlint/cli": "^20.4.2",
|
|
102
|
+
"@commitlint/config-conventional": "^20.4.2",
|
|
103
103
|
"@testing-library/dom": "^10.4.1",
|
|
104
104
|
"@testing-library/react": "^16.3.2",
|
|
105
105
|
"auditjs": "^4.2.0",
|
|
@@ -113,8 +113,8 @@
|
|
|
113
113
|
"eslint-config-prettier": "^10.1.8",
|
|
114
114
|
"eslint-plugin-babel": "^5.3.1",
|
|
115
115
|
"eslint-plugin-ft-flow": "^3.0.11",
|
|
116
|
-
"eslint-plugin-jest": "^29.
|
|
117
|
-
"eslint-plugin-jsdoc": "^62.
|
|
116
|
+
"eslint-plugin-jest": "^29.15.0",
|
|
117
|
+
"eslint-plugin-jsdoc": "^62.7.1",
|
|
118
118
|
"eslint-plugin-react": "^7.37.5",
|
|
119
119
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
120
120
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"jest-junit": "^16.0.0",
|
|
130
130
|
"jest-sonar-reporter": "^2.0.0",
|
|
131
131
|
"jscodeshift": "^17.3.0",
|
|
132
|
-
"lint-staged": "^16.
|
|
132
|
+
"lint-staged": "^16.3.1",
|
|
133
133
|
"polished": "^4.3.1",
|
|
134
134
|
"prettier": "^3.8.1",
|
|
135
135
|
"react": "^19.2.4",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"redux": "^4.2.1",
|
|
142
142
|
"redux-mock-store": "^1.5.5",
|
|
143
143
|
"redux-thunk": "^2.4.2",
|
|
144
|
-
"rimraf": "^6.1.
|
|
144
|
+
"rimraf": "^6.1.3",
|
|
145
145
|
"styled-components": "^5.3.11",
|
|
146
146
|
"typescript": "^5.9.3",
|
|
147
147
|
"xhr-mock": "^2.5.1"
|