@beinformed/ui 1.43.7 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/esm/models/attributes/AttributeModel.js +0 -7
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +22 -24
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js +2 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +8 -0
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +2 -6
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/user/UserModel.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +0 -7
- package/lib/models/attributes/AttributeModel.js.flow +0 -7
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +22 -24
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +6 -10
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js +2 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +1 -0
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +8 -0
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +9 -0
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/__tests__/ChoiceAttributeModel.spec.js.flow +27 -0
- package/lib/models/detail/DetailModel.js +2 -6
- package/lib/models/detail/DetailModel.js.flow +8 -16
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/user/UserModel.js.flow +1 -1
- package/lib/models/user/UserModel.js.map +1 -1
- package/package.json +1 -1
- package/src/models/attributes/AttributeModel.js +0 -7
- package/src/models/attributes/ChoiceAttributeModel.js +6 -10
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +1 -0
- package/src/models/attributes/ChoiceAttributeOptionModel.js +9 -0
- package/src/models/attributes/__tests__/ChoiceAttributeModel.spec.js +27 -0
- package/src/models/detail/DetailModel.js +8 -16
- package/src/models/user/UserModel.js +1 -1
|
@@ -33,6 +33,7 @@ class ChoiceAttributeOptionModel extends BaseModel {
|
|
|
33
33
|
_defineProperty(this, "_links", void 0);
|
|
34
34
|
_defineProperty(this, "_attributeCollection", void 0);
|
|
35
35
|
_defineProperty(this, "_content", void 0);
|
|
36
|
+
_defineProperty(this, "_isUser", false);
|
|
36
37
|
this.code = this.contributions.code ?? this.contributions.key ?? "";
|
|
37
38
|
this._isSelected = _includesInstanceProperty(selectedValues).call(selectedValues, this.code);
|
|
38
39
|
this._referenceDate = referenceDate;
|
|
@@ -41,6 +42,7 @@ class ChoiceAttributeOptionModel extends BaseModel {
|
|
|
41
42
|
this._children = this.addChildren(selectedValues, option, referenceDate);
|
|
42
43
|
this._links = new LinkCollection(this.contributions._links);
|
|
43
44
|
this._content = new AttributeContent(option.content);
|
|
45
|
+
this._isUser = option.optionType === "user";
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
/**
|
|
@@ -316,6 +318,12 @@ class ChoiceAttributeOptionModel extends BaseModel {
|
|
|
316
318
|
get content() {
|
|
317
319
|
return this._content;
|
|
318
320
|
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
*/
|
|
324
|
+
get isUser() {
|
|
325
|
+
return this._isUser;
|
|
326
|
+
}
|
|
319
327
|
}
|
|
320
328
|
export default ChoiceAttributeOptionModel;
|
|
321
329
|
//# sourceMappingURL=ChoiceAttributeOptionModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceAttributeOptionModel.js","names":["BaseModel","ChoiceAttributeOptionCollection","DateUtil","has","TIMEVERSION_FILTER_NAME","TITLE","hasAllContentInData","LinkCollection","AttributeCollection","ConceptDetailModel","AttributeContent","ChoiceAttributeOptionModel","constructor","selectedValues","arguments","length","undefined","option","referenceDate","now","_defineProperty","code","contributions","key","_isSelected","_includesInstanceProperty","call","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","_content","content","createFromListItemModel","listitem","id","toString","attributeCollection","clone","links","isChoiceAttributeOptionModel","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","conceptHref","href","concept","_findInstanceProperty","model","selfhref","equalsWithParameters","_code","equals","getContribution","data","label","hasItems","title","getAttributeByLayoutHint","readonlyvalue","first","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","_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"],"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\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 { IModelWithChildModels, ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\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\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now(),\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 = referenceDate;\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection();\n this._children = this.addChildren(selectedValues, option, referenceDate);\n\n this._links = new LinkCollection(this.contributions._links);\n\n this._content = new AttributeContent(option.content);\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>) {\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);\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(): 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, true);\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 referenceDate: ISO_DATE = DateUtil.now(),\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection();\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n referenceDate,\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\nexport default ChoiceAttributeOptionModel;\n"],"mappings":";;;;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,+BAA+B,MAAM,mCAAmC;AAE/E,SAASC,QAAQ,QAAQ,mCAAmC;AAC5D,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;AAMjD;AACA;AACA,MAAMC,0BAA0B,SACtBX,SAAS,CAEnB;EAWE;AACF;EACEY,WAAWA,CAAA,EAIT;IAAA,IAHAC,cAA6B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAA,IAClCG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,IACnBI,aAAuB,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGZ,QAAQ,CAACiB,GAAG,CAAC,CAAC;IAExC,KAAK,CAAC,CAAC,CAAC,EAAEF,MAAM,CAAC;IAACG,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAA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oreList":[]}
|
|
1
|
+
{"version":3,"file":"ChoiceAttributeOptionModel.js","names":["BaseModel","ChoiceAttributeOptionCollection","DateUtil","has","TIMEVERSION_FILTER_NAME","TITLE","hasAllContentInData","LinkCollection","AttributeCollection","ConceptDetailModel","AttributeContent","ChoiceAttributeOptionModel","constructor","selectedValues","arguments","length","undefined","option","referenceDate","now","_defineProperty","code","contributions","key","_isSelected","_includesInstanceProperty","call","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","_content","content","_isUser","optionType","createFromListItemModel","listitem","id","toString","attributeCollection","clone","links","isChoiceAttributeOptionModel","getInitialChildModelLinks","initialLinks","hasContentFromData","conceptLink","push","children","setChildModels","models","conceptHref","href","concept","_findInstanceProperty","model","selfhref","equalsWithParameters","_code","equals","getContribution","data","label","hasItems","title","getAttributeByLayoutHint","readonlyvalue","first","getContentConfiguredLabel","contentConfiguration","configuredLabelProperties","labelConfig","types","_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 { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\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 { IModelWithChildModels, ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\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 referenceDate: ISO_DATE = DateUtil.now(),\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 = referenceDate;\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection();\n this._children = this.addChildren(selectedValues, option, referenceDate);\n\n this._links = new LinkCollection(this.contributions._links);\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>) {\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);\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(): 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, true);\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 referenceDate: ISO_DATE = DateUtil.now(),\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection();\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n referenceDate,\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,QAAQ,QAAQ,mCAAmC;AAC5D,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;AAMjD;AACA;AACA,MAAMC,0BAA0B,SACtBX,SAAS,CAEnB;EAYE;AACF;EACEY,WAAWA,CAAA,EAIT;IAAA,IAHAC,cAA6B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAA,IAClCG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,IACnBI,aAAuB,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SA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AQ,IAAI,IAAI,EAAE;MACxD,IAAI,CAACA,QAAQ,CAACmD,YAAY,CAACD,UAAU,CAAClD,QAAQ,CAAC;IACjD;EACF;;EAEA;AACF;AACA;EACE,IAAIH,kBAAkBA,CAAA,EAAY;IAChC,OAAO1C,mBAAmB,CAAC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAI6B,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAI,CAACD,QAAQ;EACtB;;EAEA;AACF;EACE,IAAIqE,MAAMA,CAAA,EAAY;IACpB,OAAO,IAAI,CAACnE,OAAO;EACrB;AACF;AAEA,eAAezB,0BAA0B","ignoreList":[]}
|
|
@@ -171,9 +171,7 @@ export default class DetailModel extends ResourceModel {
|
|
|
171
171
|
*/
|
|
172
172
|
get avatarForTitleAttribute() {
|
|
173
173
|
var _context5;
|
|
174
|
-
|
|
175
|
-
const avatarForTitleAttribute = _findInstanceProperty(avatarAttributes).call(avatarAttributes, attribute => attribute.layouthint.hasExact(AVATAR_IN_TITLE));
|
|
176
|
-
return avatarForTitleAttribute || null;
|
|
174
|
+
return _findInstanceProperty(_context5 = this._attributeCollection).call(_context5, attribute => attribute.layouthint.hasExact(AVATAR_IN_TITLE) && attribute.layouthint.hasExact(AVATAR));
|
|
177
175
|
}
|
|
178
176
|
|
|
179
177
|
/**
|
|
@@ -181,9 +179,7 @@ export default class DetailModel extends ResourceModel {
|
|
|
181
179
|
*/
|
|
182
180
|
get titleAttribute() {
|
|
183
181
|
var _context6;
|
|
184
|
-
|
|
185
|
-
const titleAttribute = _findInstanceProperty(nonAvatarAttributes).call(nonAvatarAttributes, attribute => attribute.layouthint.has(TITLE));
|
|
186
|
-
return titleAttribute || null;
|
|
182
|
+
return _findInstanceProperty(_context6 = this._attributeCollection).call(_context6, attribute => attribute.layouthint.has(TITLE) && !attribute.layouthint.hasExact(AVATAR));
|
|
187
183
|
}
|
|
188
184
|
|
|
189
185
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailModel.js","names":["has","ActionCollection","AttributeCollection","ResourceModel","AVATAR","AVATAR_IN_TITLE","TITLE","DetailModel","constructor","modularuiResponse","_defineProperty","createAttributeCollection","createMetadataCollection","createActionCollection","type","modelName","isApplicableModel","data","_context","resourceType","contributions","resourcetype","_endsWithInstanceProperty","call","_includesInstanceProperty","getInitialChildModelLinks","_attributeCollection","setChildModels","models","id","getData","key","label","getContribution","_context2","attributeContributions","attributes","_filterInstanceProperty","contribution","_Object$keys","attributeCollection","collection","_context3","all","attribute","hasTitle","layouthint","hasExact","hasAvatar","hasAvatarForTitle","isHidden","getAttributeByKey","_context4","metadataContributions","metadata","_mapInstanceProperty","metadataKey","metadataCollection","_metadataCollection","_actionCollection","actions","actionCollection","isCase","avatarForTitleAttribute","_context5","avatarAttributes","_findInstanceProperty","titleAttribute","_context6","nonAvatarAttributes","update","model","clonedModel","clone","equals","toString"],"sources":["../../../src/models/detail/DetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport { AVATAR, AVATAR_IN_TITLE, TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Base class for details<br/>\n * For instance the details of case 1<br/>\n * For instance the details of record 12<br/>\n */\nexport default class DetailModel extends ResourceModel {\n _attributeCollection: AttributeCollection;\n _metadataCollection: AttributeCollection;\n _actionCollection: ActionCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createAttributeCollection();\n this.createMetadataCollection();\n this.createActionCollection();\n }\n\n /**\n */\n get type(): string {\n return \"Detail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"DetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype;\n return (\n resourceType &&\n (resourceType.endsWith(\"DetailPanel\") ||\n [\"Detail\", \"CasePropertiesPanel\", \"CasePropertiesPanelDetail\"].includes(\n resourceType,\n ))\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n }\n\n /**\n * Getting the unique identifier of the details\n */\n get id(): string {\n return this.getData(\"_id\", this.key);\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Attribute collection\n */\n createAttributeCollection() {\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [key] = Object.keys(contribution);\n return has(this.data, key);\n })\n : [];\n\n this.attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n true,\n );\n }\n\n /**\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n * Retrieve list of visible attributes\n */\n get attributes(): Array<AttributeType> {\n return this.attributeCollection.all.filter((attribute) => {\n const hasTitle = attribute.layouthint.hasExact(TITLE);\n const hasAvatar = attribute.layouthint.hasExact(AVATAR);\n const hasAvatarForTitle = attribute.layouthint.hasExact(AVATAR_IN_TITLE);\n return (\n !attribute.isHidden &&\n (!hasTitle || (hasTitle && hasAvatar)) &&\n (!hasAvatarForTitle || (hasAvatarForTitle && !hasAvatar))\n );\n });\n }\n\n /**\n * Retrieve an attribute by it's key\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this._attributeCollection.getAttributeByKey(key);\n }\n\n /**\n * Metadata collection\n */\n createMetadataCollection() {\n const metadataContributions = this.contributions.metadata\n ? Object.keys(this.contributions.metadata).map((metadataKey) => ({\n [metadataKey]: this.contributions.metadata[metadataKey],\n }))\n : [];\n\n this.metadataCollection = new AttributeCollection(\n this.data,\n metadataContributions,\n true,\n );\n }\n\n /**\n */\n get metadataCollection(): AttributeCollection {\n return this._metadataCollection;\n }\n\n /**\n */\n set metadataCollection(collection: AttributeCollection) {\n this._metadataCollection = collection;\n }\n\n /**\n * Action collection\n */\n createActionCollection() {\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n );\n }\n\n /**\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n */\n set actionCollection(actionCollection: ActionCollection) {\n this._actionCollection = actionCollection;\n }\n\n /**\n * Determines if this is a case\n */\n get isCase(): boolean {\n return this.contributions.resourcetype === \"CaseView\";\n }\n\n /**\n * Getting the attribute that has as layout hint 'avatar-for-title'\n */\n get avatarForTitleAttribute(): ?AttributeType {\n const avatarAttributes = this._attributeCollection.all.filter((attribute) =>\n attribute.layouthint.hasExact(AVATAR),\n );\n\n const avatarForTitleAttribute = avatarAttributes.find((attribute) =>\n attribute.layouthint.hasExact(AVATAR_IN_TITLE),\n );\n\n return avatarForTitleAttribute || null;\n }\n\n /**\n * Getting the attribute that has as layout hint 'title'\n */\n get titleAttribute(): ?AttributeType {\n const nonAvatarAttributes = this._attributeCollection.all.filter(\n (attribute) => !attribute.layouthint.hasExact(AVATAR),\n );\n\n const titleAttribute = nonAvatarAttributes.find((attribute) =>\n attribute.layouthint.has(TITLE),\n );\n\n return titleAttribute || null;\n }\n\n /**\n * Update current detail with a new detail model and return a cloned version of the model\n */\n update(model: ModularUIModel): DetailModel {\n if (model instanceof DetailModel) {\n const clonedModel = this.clone();\n\n clonedModel.attributeCollection = model._attributeCollection;\n clonedModel.metadataCollection = model._metadataCollection;\n clonedModel.actionCollection = model._actionCollection;\n\n return clonedModel;\n }\n\n return this;\n }\n\n /**\n */\n equals(model: DetailModel): boolean {\n return this.id.toString() === model.id.toString();\n }\n}\n"],"mappings":";;;;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,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;EACEG,MAAMA,CAACC,KAAqB,EAAe;IACzC,IAAIA,KAAK,YAAYhE,WAAW,EAAE;MAChC,MAAMiE,WAAW,GAAG,IAAI,CAACC,KAAK,CAAC,CAAC;MAEhCD,WAAW,CAAChC,mBAAmB,GAAG+B,KAAK,CAAC7C,oBAAoB;MAC5D8C,WAAW,CAACf,kBAAkB,GAAGc,KAAK,CAACb,mBAAmB;MAC1Dc,WAAW,CAACX,gBAAgB,GAAGU,KAAK,CAACZ,iBAAiB;MAEtD,OAAOa,WAAW;IACpB;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACEE,MAAMA,CAACH,KAAkB,EAAW;IAClC,OAAO,IAAI,CAAC1C,EAAE,CAAC8C,QAAQ,CAAC,CAAC,KAAKJ,KAAK,CAAC1C,EAAE,CAAC8C,QAAQ,CAAC,CAAC;EACnD;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"DetailModel.js","names":["has","ActionCollection","AttributeCollection","ResourceModel","AVATAR","AVATAR_IN_TITLE","TITLE","DetailModel","constructor","modularuiResponse","_defineProperty","createAttributeCollection","createMetadataCollection","createActionCollection","type","modelName","isApplicableModel","data","_context","resourceType","contributions","resourcetype","_endsWithInstanceProperty","call","_includesInstanceProperty","getInitialChildModelLinks","_attributeCollection","setChildModels","models","id","getData","key","label","getContribution","_context2","attributeContributions","attributes","_filterInstanceProperty","contribution","_Object$keys","attributeCollection","collection","_context3","all","attribute","hasTitle","layouthint","hasExact","hasAvatar","hasAvatarForTitle","isHidden","getAttributeByKey","_context4","metadataContributions","metadata","_mapInstanceProperty","metadataKey","metadataCollection","_metadataCollection","_actionCollection","actions","actionCollection","isCase","avatarForTitleAttribute","_context5","_findInstanceProperty","titleAttribute","_context6","update","model","clonedModel","clone","equals","toString"],"sources":["../../../src/models/detail/DetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport { AVATAR, AVATAR_IN_TITLE, TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Base class for details<br/>\n * For instance the details of case 1<br/>\n * For instance the details of record 12<br/>\n */\nexport default class DetailModel extends ResourceModel {\n _attributeCollection: AttributeCollection;\n _metadataCollection: AttributeCollection;\n _actionCollection: ActionCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createAttributeCollection();\n this.createMetadataCollection();\n this.createActionCollection();\n }\n\n /**\n */\n get type(): string {\n return \"Detail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"DetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype;\n return (\n resourceType &&\n (resourceType.endsWith(\"DetailPanel\") ||\n [\"Detail\", \"CasePropertiesPanel\", \"CasePropertiesPanelDetail\"].includes(\n resourceType,\n ))\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this._attributeCollection.setChildModels(models);\n }\n\n /**\n * Getting the unique identifier of the details\n */\n get id(): string {\n return this.getData(\"_id\", this.key);\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Attribute collection\n */\n createAttributeCollection() {\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [key] = Object.keys(contribution);\n return has(this.data, key);\n })\n : [];\n\n this.attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n true,\n );\n }\n\n /**\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n * Retrieve list of visible attributes\n */\n get attributes(): Array<AttributeType> {\n return this.attributeCollection.all.filter((attribute) => {\n const hasTitle = attribute.layouthint.hasExact(TITLE);\n const hasAvatar = attribute.layouthint.hasExact(AVATAR);\n const hasAvatarForTitle = attribute.layouthint.hasExact(AVATAR_IN_TITLE);\n return (\n !attribute.isHidden &&\n (!hasTitle || (hasTitle && hasAvatar)) &&\n (!hasAvatarForTitle || (hasAvatarForTitle && !hasAvatar))\n );\n });\n }\n\n /**\n * Retrieve an attribute by it's key\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this._attributeCollection.getAttributeByKey(key);\n }\n\n /**\n * Metadata collection\n */\n createMetadataCollection() {\n const metadataContributions = this.contributions.metadata\n ? Object.keys(this.contributions.metadata).map((metadataKey) => ({\n [metadataKey]: this.contributions.metadata[metadataKey],\n }))\n : [];\n\n this.metadataCollection = new AttributeCollection(\n this.data,\n metadataContributions,\n true,\n );\n }\n\n /**\n */\n get metadataCollection(): AttributeCollection {\n return this._metadataCollection;\n }\n\n /**\n */\n set metadataCollection(collection: AttributeCollection) {\n this._metadataCollection = collection;\n }\n\n /**\n * Action collection\n */\n createActionCollection() {\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n );\n }\n\n /**\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n */\n set actionCollection(actionCollection: ActionCollection) {\n this._actionCollection = actionCollection;\n }\n\n /**\n * Determines if this is a case\n */\n get isCase(): boolean {\n return this.contributions.resourcetype === \"CaseView\";\n }\n\n /**\n * Getting the attribute that has as layout hint 'avatar-for-title'\n */\n get avatarForTitleAttribute(): ?AttributeType {\n return this._attributeCollection.find(\n (attribute) =>\n attribute.layouthint.hasExact(AVATAR_IN_TITLE) &&\n attribute.layouthint.hasExact(AVATAR),\n );\n }\n\n /**\n * Getting the attribute that has as layout hint 'title'\n */\n get titleAttribute(): ?AttributeType {\n return this._attributeCollection.find(\n (attribute) =>\n attribute.layouthint.has(TITLE) &&\n !attribute.layouthint.hasExact(AVATAR),\n );\n }\n\n /**\n * Update current detail with a new detail model and return a cloned version of the model\n */\n update(model: ModularUIModel): DetailModel {\n if (model instanceof DetailModel) {\n const clonedModel = this.clone();\n\n clonedModel.attributeCollection = model._attributeCollection;\n clonedModel.metadataCollection = model._metadataCollection;\n clonedModel.actionCollection = model._actionCollection;\n\n return clonedModel;\n }\n\n return this;\n }\n\n /**\n */\n equals(model: DetailModel): boolean {\n return this.id.toString() === model.id.toString();\n }\n}\n"],"mappings":";;;;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,mBAAmB,MAAM,mCAAmC;AACnE,OAAOC,aAAa,MAAM,uBAAuB;AAEjD,SAASC,MAAM,EAAEC,eAAe,EAAEC,KAAK,QAAQ,6BAA6B;AAM5E;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,WAAW,SAASJ,aAAa,CAAC;EAKrD;AACF;EACEK,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,yBAAyB,CAAC,CAAC;IAChC,IAAI,CAACC,wBAAwB,CAAC,CAAC;IAC/B,IAAI,CAACC,sBAAsB,CAAC,CAAC;EAC/B;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,QAAQ;EACjB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,aAAa;EACtB;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IAAA,IAAAC,QAAA;IACzD,MAAMC,YAAY,GAAGF,IAAI,CAACG,aAAa,EAAEC,YAAY;IACrD,OACEF,YAAY,KACXG,yBAAA,CAAAH,YAAY,EAAAI,IAAA,CAAZJ,YAAY,EAAU,aAAa,CAAC,IACnCK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U,CAACC,QAAQ,CAAC3C,MAAM,CACzC,CAAC;EACH;;EAEA;AACF;AACA;EACEgE,MAAMA,CAACC,KAAqB,EAAe;IACzC,IAAIA,KAAK,YAAY9D,WAAW,EAAE;MAChC,MAAM+D,WAAW,GAAG,IAAI,CAACC,KAAK,CAAC,CAAC;MAEhCD,WAAW,CAAC9B,mBAAmB,GAAG6B,KAAK,CAAC3C,oBAAoB;MAC5D4C,WAAW,CAACb,kBAAkB,GAAGY,KAAK,CAACX,mBAAmB;MAC1DY,WAAW,CAACT,gBAAgB,GAAGQ,KAAK,CAACV,iBAAiB;MAEtD,OAAOW,WAAW;IACpB;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACEE,MAAMA,CAACH,KAAkB,EAAW;IAClC,OAAO,IAAI,CAACxC,EAAE,CAAC4C,QAAQ,CAAC,CAAC,KAAKJ,KAAK,CAACxC,EAAE,CAAC4C,QAAQ,CAAC,CAAC;EACnD;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserModel.js","names":["ResourceModel","UserModel","type","modelName","isApplicableModel","data","contributions","resourcetype","avatar","Avatar","username","Username","fullname","Fullname","label"],"sources":["../../../src/models/user/UserModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * User model\n */\nexport default class UserModel extends ResourceModel {\n /**\n */\n get type(): string {\n return \"User\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"UserModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"userdata\"\n );\n }\n\n /**\n * Retrieve username of user\n */\n get avatar(): string {\n return this.data.Avatar;\n }\n\n /**\n * Retrieve username of user\n */\n get username(): string {\n return this.data.Username || \"Guest\";\n }\n\n /**\n * retrieve the fullname of the user\n */\n get fullname(): string {\n return this.data.Fullname || \"Guest\";\n }\n\n /**\n */\n get label(): string {\n return this.contributions.label;\n }\n}\n"],"mappings":"AACA,OAAOA,aAAa,MAAM,uBAAuB;AAIjD;AACA;AACA;AACA,eAAe,MAAMC,SAAS,SAASD,aAAa,CAAC;EACnD;AACF;EACE,IAAIE,IAAIA,CAAA,EAAW;IACjB,OAAO,MAAM;EACf;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,WAAW;EACpB;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,UAAU;EAElD;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,
|
|
1
|
+
{"version":3,"file":"UserModel.js","names":["ResourceModel","UserModel","type","modelName","isApplicableModel","data","contributions","resourcetype","avatar","Avatar","username","Username","fullname","Fullname","label"],"sources":["../../../src/models/user/UserModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * User model\n */\nexport default class UserModel extends ResourceModel {\n /**\n */\n get type(): string {\n return \"User\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"UserModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"userdata\"\n );\n }\n\n /**\n * Retrieve username of user\n */\n get avatar(): string | null {\n return this.data.Avatar;\n }\n\n /**\n * Retrieve username of user\n */\n get username(): string {\n return this.data.Username || \"Guest\";\n }\n\n /**\n * retrieve the fullname of the user\n */\n get fullname(): string {\n return this.data.Fullname || \"Guest\";\n }\n\n /**\n */\n get label(): string {\n return this.contributions.label;\n }\n}\n"],"mappings":"AACA,OAAOA,aAAa,MAAM,uBAAuB;AAIjD;AACA;AACA;AACA,eAAe,MAAMC,SAAS,SAASD,aAAa,CAAC;EACnD;AACF;EACE,IAAIE,IAAIA,CAAA,EAAW;IACjB,OAAO,MAAM;EACf;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,WAAW;EACpB;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,UAAU;EAElD;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,EAAkB;IAC1B,OAAO,IAAI,CAACH,IAAI,CAACI,MAAM;EACzB;;EAEA;AACF;AACA;EACE,IAAIC,QAAQA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACL,IAAI,CAACM,QAAQ,IAAI,OAAO;EACtC;;EAEA;AACF;AACA;EACE,IAAIC,QAAQA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACP,IAAI,CAACQ,QAAQ,IAAI,OAAO;EACtC;;EAEA;AACF;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACR,aAAa,CAACQ,KAAK;EACjC;AACF","ignoreList":[]}
|
|
@@ -450,13 +450,6 @@ class AttributeModel extends _BaseModel.default {
|
|
|
450
450
|
this._isResult = isResult;
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
/**
|
|
454
|
-
*
|
|
455
|
-
*/
|
|
456
|
-
get isAvatar() {
|
|
457
|
-
return this.contributions?.optionType === "user" ?? false;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
453
|
/**
|
|
461
454
|
* Getting the display and input format of a attribute
|
|
462
455
|
*/
|
|
@@ -554,13 +554,6 @@ export default class AttributeModel
|
|
|
554
554
|
this._isResult = isResult;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
/**
|
|
558
|
-
*
|
|
559
|
-
*/
|
|
560
|
-
get isAvatar(): boolean {
|
|
561
|
-
return this.contributions?.optionType === "user" ?? false;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
557
|
/**
|
|
565
558
|
* Getting the display and input format of a attribute
|
|
566
559
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeModel.js","names":["_DateTimeUtil","require","_objects","_BaseModel","_interopRequireDefault","_ConstraintCollection","_ErrorCollection","_LinkCollection","_StringLengthConstraint","_MandatoryConstraint","_ConceptDetailModel","_LayoutHints","_Constants","_Settings","_exceptions","_AttributeContent","AttributeModel","BaseModel","constructor","attribute","attributeContributions","_defineProperty2","default","ConstraintCollection","getSetting","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","DISABLED","_errorCollection","ErrorCollection","message","addServerError","id","parameters","_referenceDate","getData","DateUtil","now","_isResult","_mandatory","MANDATORY","mandatory","_links","LinkCollection","isApplicableModel","isPlainObject","IllegalArgumentException","getInitialChildModelLinks","hasContentConfiguration","conceptLink","setChildModels","models","conceptHref","href","concept","_find","call","model","selfhref","equalsWithParameters","key","parentKey","_parentKey","name","type","_hasContentConfiguration","indicateContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","getContentConfiguredLabel","configuredLabelProperties","labelConfig","length","types","_context","configuredLabels","_filter","getLabelElementByIds","configuredLabel","_context2","firstConfiguredLabel","_map","configuredLabelProperty","some","_id","defaultAlignment","alignment","alignmentHints","getByLayoutHint","substring","links","downloadLink","getLinksByGroup","first","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","referenceDate","isCacheable","_concept","ConceptDetailModel","date","initvalue","getInputValue","inputvalue","toString","validateValue","validate","hasValue","getValue","getFormData","inError","formdata","getEmptyFormData","updateLastModification","formatValue","readonlyvalue","configuredMandatory","_validatedValue","readonly","_readonly","static","isResult","disabled","isAvatar","optionType","format","getContribution","formatLabel","minLength","maxLength","operator","assistantMessage","isValid","constraintCollection","constraints","add","_serverConstraints","MandatoryConstraint","StringLengthConstraint","addConstraints","setUseClientsideValidation","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","undefined","errorCollection","collection","invalidConstraints","isChangedSince","resetErrors","error","properties","removeServerError","hasServerErrors","serverErrors","hasErrors","hasItems","addMissingError","removeMissingError","addServerConstraint","defaultMessage","addConstraint","formatParameters","params","_keys","forEach","paramKey","paramValue","_endsWith","hasDynamicValidationData","updateValidations","errors","_lastModification","Date","timestamp","reset","UnsupportedOperationException","mergeAttribute","oldAttribute","update","changedAttribute","isEditable","_isEditable","isVisible","_isHidden","isHidden","show","hide","equals","otherAttribute","readonlyWidth","ATTRIBUTE_WIDTH","MEDIUM","layoutHintRules","_layoutHintRules","rules","processLayoutHintRules","attributes","process","hasAllContentInData","AttributeContent","exports"],"sources":["../../../src/models/attributes/AttributeModel.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { DISABLED, MANDATORY } from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting, hasAllContentInData } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type {\n AttributeType,\n FormErrorAnchor,\n IModelWithChildModels,\n ModularUIModel,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters,\n attribute.message.layouthint,\n );\n }\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n\n this._isResult = this.getData(\"isResult\", false);\n\n this._mandatory =\n this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n if (!isPlainObject(contributions)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a contributions object\",\n );\n }\n\n return false;\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): any {\n return value;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n !this.hasContentFromData &&\n this.hasContentConfiguration &&\n this.conceptLink\n ) {\n return [this.conceptLink];\n }\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>): void {\n const conceptHref = this.conceptLink?.href;\n if (conceptHref) {\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n }\n\n /**\n * Getting the attribute key\n */\n get key(): string {\n return this.data.key;\n }\n\n /**\n */\n get parentKey(): string {\n return this._parentKey || \"\";\n }\n\n /**\n */\n set parentKey(parentKey: string) {\n this._parentKey = parentKey;\n }\n\n /**\n * Getting the attribute name\n */\n get name(): string {\n return this.key;\n }\n\n /**\n * Getting the type of the attribute\n */\n get type(): string {\n return this.contributions.type;\n }\n\n /**\n * Getting the label of the attribute\n */\n get label(): string {\n return this._label || \"\";\n }\n\n /**\n * Set the label of this attribute\n */\n set label(label: string) {\n this._label = label;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration = hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration || false;\n }\n\n /**\n */\n indicateContentConfiguration(\n contentConfiguration: ContentConfiguration,\n ): void {\n if (contentConfiguration) {\n const hasQuestionConfig = contentConfiguration.questions?.hasConfig();\n\n const hasEndResultConfig =\n contentConfiguration.isConfiguredEndResultAttribute(this.key);\n const hasIntermediateResultConfig =\n contentConfiguration.isConfiguredIntermediateResultAttribute(this.key);\n\n this.hasContentConfiguration =\n hasQuestionConfig || hasEndResultConfig || hasIntermediateResultConfig;\n }\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(\n contentConfiguration: ?ContentConfigurationElements,\n ): string {\n if (this.hasContentFromData) {\n return this.content.label ?? this.label;\n }\n\n const configuredLabelProperties =\n contentConfiguration && contentConfiguration.labelConfig.length > 0\n ? contentConfiguration.labelConfig[0].types\n : [];\n\n if (this.concept && configuredLabelProperties.length > 0) {\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 const [firstConfiguredLabel] = 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 );\n\n if (firstConfiguredLabel) {\n return firstConfiguredLabel.value;\n }\n }\n }\n\n return this.label;\n }\n\n /**\n */\n get defaultAlignment(): \"left\" | \"center\" | \"right\" {\n return \"left\";\n }\n\n /**\n * Handles layout hint align-left, align-center and align-right\n */\n get alignment(): \"left\" | \"center\" | \"right\" {\n const alignmentHints = this.layouthint.getByLayoutHint(\"align-\");\n\n // return alignment based on layouthint or the default alignment for the attribute\n const alignment = alignmentHints\n ? alignmentHints.substring(\"align-\".length)\n : this.defaultAlignment;\n\n if (\n alignment === \"left\" ||\n alignment === \"center\" ||\n alignment === \"right\"\n ) {\n return alignment;\n }\n\n return this.defaultAlignment;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Retrieve link of attribute when available\n */\n get downloadLink(): ?LinkModel {\n const downloadLink = this.links.getLinksByGroup(\"download\").first;\n\n if (downloadLink && downloadLink.key === this.key) {\n return downloadLink;\n }\n\n return null;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): ?LinkModel {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n\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 * 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 * Retrieve reference date of attribute which can be used as entryDate for content\n * to get information in correct time version\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Initial value received from the modular ui service\n */\n get initvalue(): any {\n return this._initvalue;\n }\n\n /**\n * Retrieve input value\n */\n getInputValue(): string {\n const inputvalue = this._inputvalue;\n\n return inputvalue ? inputvalue.toString() : \"\";\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Value that is used when retrieving an error collection of this attribute\n * Mostly this is the input value, but sometimes a different value is needed,\n * for example iban and postcode need to validate length without spaces\n */\n get validateValue(): string {\n return this.inputvalue;\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.value = value;\n\n this.validate(value);\n }\n\n /**\n */\n hasValue(): boolean {\n return this._value != null && this._value !== \"\";\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): any {\n return this.hasValue() ? this._value : null;\n }\n\n /**\n * Getting data ready to be send to the modular ui\n * Returns null when the attribute should not be send to the server\n */\n getFormData(): { [string]: any } | null {\n if (this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return this.getFormData();\n }\n\n /**\n */\n getEmptyFormData(): { [string]: null } {\n return { [this.name]: null };\n }\n\n /**\n * Getting the value of the attribute\n */\n get value(): any {\n return this.getValue();\n }\n\n /**\n * Setting a value in the element\n */\n set value(value: ?string) {\n this.updateLastModification();\n\n this._value = value;\n }\n\n /**\n */\n formatValue(value: string): string {\n return value;\n }\n\n /**\n * Getting the readonly value, iso value converted for human reading\n */\n get readonlyvalue(): string {\n return this.value ? this.value.toString() : \"\";\n }\n\n /**\n * Getting mandatory status of attribute\n */\n get mandatory(): boolean {\n return this._mandatory || false;\n }\n\n /**\n */\n get configuredMandatory(): ?boolean {\n return this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n }\n\n /**\n * Set mandatory status of attribute\n */\n set mandatory(mandatory: boolean) {\n if (mandatory !== this._mandatory) {\n this._validatedValue = null;\n }\n this._mandatory = mandatory;\n }\n\n /**\n */\n get readonly(): boolean {\n return (\n this._readonly ||\n this.contributions.readonly === true ||\n this.data.static === true ||\n this.isResult === true\n );\n }\n\n /**\n */\n set readonly(readonly: boolean) {\n this._readonly = readonly;\n }\n\n /**\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n */\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._isResult;\n }\n\n /**\n */\n set isResult(isResult: boolean) {\n this._isResult = isResult;\n }\n\n /**\n *\n */\n get isAvatar(): boolean {\n return this.contributions?.optionType === \"user\" ?? false;\n }\n\n /**\n * Getting the display and input format of a attribute\n */\n get format(): string | null {\n return this.getContribution(\"format\");\n }\n\n /**\n */\n get formatLabel(): string {\n return this.format || \"\";\n }\n\n /**\n * Get minimum string length\n */\n get minLength(): number | null {\n return this.getContribution(\"minLength\");\n }\n\n /**\n * Get maximum string length\n */\n get maxLength(): number | null {\n return this.getContribution(\"maxLength\");\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n * Get assistant message\n */\n get assistantMessage(): string | null {\n return this.getContribution(\"assistant\");\n }\n\n /**\n * Get valid status\n */\n get isValid(): boolean {\n return this.validate(this.validateValue);\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this._serverConstraints);\n\n // Mandatory constraint\n if (this.mandatory) {\n constraints.add(new MandatoryConstraint());\n }\n\n if (this.minLength || this.maxLength) {\n constraints.add(\n new StringLengthConstraint(this.minLength, this.maxLength),\n );\n }\n\n constraints.add(this.addConstraints());\n\n return constraints;\n }\n\n /**\n * Template method for class extending this model to add extra constraints\n * @abstract\n */\n addConstraints(): ConstraintCollection {\n return new ConstraintCollection();\n }\n\n /**\n * Used to programmatically overwrite the setting USE_CLIENTSIDE_VALIDATION\n */\n setUseClientsideValidation(enabled: boolean): void {\n this._useClientsideValidation = enabled;\n }\n\n /**\n * Indicates if client side validation is enabled\n * @returns {boolean}\n */\n useClientsideValidation(): boolean {\n return this._useClientsideValidation ?? true;\n }\n\n /**\n * Validate input on client side constraint\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== value) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = value;\n\n return this._isValid;\n }\n\n /**\n * Indicates if attribute is optional and empty\n */\n isOptionalAndEmpty(value: string): boolean {\n if (value === undefined) {\n throw new IllegalArgumentException(\n \"isOptionalAndEmpty method needs value argument\",\n );\n }\n\n return !this.mandatory && value === \"\";\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n const collection = new ErrorCollection(\"attribute\", this._errorCollection);\n\n collection.addConstraints(\n this.constraintCollection.invalidConstraints(this.validateValue),\n );\n\n return collection;\n }\n\n /**\n * Check if attribute is in error\n */\n inError(): boolean {\n return !this._isValid && this.isChangedSince(0);\n }\n\n /**\n * Reset static error messages on attribute\n */\n resetErrors(): void {\n this._errorCollection = new ErrorCollection(\"attribute\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor): void {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n\n /**\n */\n removeServerError(id: string): void {\n this._errorCollection.removeServerError(id);\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return this.errorCollection.serverErrors.length > 0;\n }\n\n /**\n */\n hasErrors(): boolean {\n return this.errorCollection.hasItems;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(): void {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError(): void {\n this.removeServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n addServerConstraint(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters,\n ) {\n this._serverConstraints.addConstraint(\n id,\n null,\n defaultMessage,\n parameters,\n this.useClientsideValidation(),\n );\n }\n\n /**\n */\n formatParameters(parameters: Object): { [string]: string | number } {\n if (parameters == null) {\n return {};\n }\n\n const params: { [name: string]: string | number } = {};\n\n Object.keys(parameters).forEach((paramKey: string) => {\n const paramValue = parameters[paramKey];\n if (paramKey.endsWith(\"-number\") || paramKey.endsWith(\"-date\")) {\n params[paramKey] = this.formatValue(paramValue);\n } else {\n params[paramKey] = paramValue;\n }\n });\n\n return params;\n }\n\n /**\n */\n get hasDynamicValidationData(): boolean {\n return true;\n }\n\n /**\n */\n updateValidations(errors: Array<Object>): void {\n if (\n errors.some((error) => error.id === \"Constraint.Mandatory\") ||\n this.layouthint.has(MANDATORY)\n ) {\n this.mandatory = true;\n } else if (!this.hasValue()) {\n this.mandatory = false;\n }\n\n this._serverConstraints = new ConstraintCollection();\n this.resetErrors();\n\n errors\n .filter(\n (error) => error.id !== \"Constraint.Mandatory\" || !this.hasValue(),\n )\n .forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n error.layouthint,\n );\n } else {\n this.addServerConstraint(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n );\n }\n });\n }\n\n /**\n * Set last modification to current timestamp\n */\n updateLastModification(): void {\n this._lastModification = Date.now();\n }\n\n /**\n * Inidicates if attribute is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return this._lastModification > timestamp;\n }\n\n /**\n * Abstract reset method which should be implemented on each attribute that has this attribute as a base class.\n *\n * @abstract\n */\n reset(): void {\n throw new UnsupportedOperationException(\n `Reset method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Merge old attribute with the attribute from the server.\n * Readonly attributes always need to show the value from the server\n */\n mergeAttribute(oldAttribute: AttributeType): void {\n this.concept = oldAttribute.concept;\n\n if (\n !oldAttribute.readonly &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(oldAttribute.inputvalue);\n }\n }\n\n /**\n * Abstract update method which should be implemented on each attribute that has this attribute as a base class.\n * @abstract\n */\n // eslint-disable-next-line no-unused-vars\n update(value: string, changedAttribute?: AttributeType): AttributeType {\n throw new UnsupportedOperationException(\n `Update method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Indicate if attribute is editable\n */\n set isEditable(isEditable: boolean) {\n this._isEditable = isEditable;\n }\n\n /**\n * Retrieve if attribute is editable\n */\n get isEditable(): boolean {\n return this._isEditable;\n }\n\n /**\n * Indicates if the attribute is visible\n */\n get isVisible(): boolean {\n return !this._isHidden;\n }\n\n /**\n */\n get isHidden(): boolean {\n return this._isHidden;\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n this._isHidden = isHidden;\n }\n\n /**\n * Explicitly toggle visibility of this attribute\n */\n show(): void {\n this.isHidden = false;\n }\n\n /**\n */\n hide(): void {\n this.isHidden = true;\n }\n\n /**\n */\n equals(otherAttribute: AttributeType): boolean {\n return (\n this.key === otherAttribute.key &&\n this.parentKey === otherAttribute.parentKey\n );\n }\n\n /**\n * Readonly attribute width indicates the proposed width of this attribute\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n\n /**\n */\n get layoutHintRules(): LayoutHintRuleCollection {\n return this._layoutHintRules;\n }\n\n /**\n */\n set layoutHintRules(rules: LayoutHintRuleCollection) {\n this._layoutHintRules = rules;\n }\n\n /**\n */\n processLayoutHintRules(attributes: AttributeCollection): void {\n if (this._layoutHintRules) {\n this.layoutHintRules.process(this, attributes);\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 new AttributeContent(this.data.content);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,gBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,eAAA,GAAAH,sBAAA,CAAAH,OAAA;AAEA,IAAAO,uBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,oBAAA,GAAAL,sBAAA,CAAAH,OAAA;AAEA,IAAAS,mBAAA,GAAAN,sBAAA,CAAAH,OAAA;AAEA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAKA,IAAAY,SAAA,GAAAZ,OAAA;AAEA,IAAAa,WAAA,GAAAb,OAAA;AAiBA,IAAAc,iBAAA,GAAAX,sBAAA,CAAAH,OAAA;AAEA;AACA;AACA;AACe,MAAMe,cAAc,SACzBC,kBAAS,CAEnB;EA0BE;AACF;EACEC,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,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,KAAK;EACvB;;EAEA;AACF;EACEE,IAAIA,CAAA,EAAS;IACX,IAAI,CAACF,QAAQ,GAAG,IAAI;EACtB;;EAEA;AACF;EACEG,MAAMA,CAACC,cAA6B,EAAW;IAC7C,OACE,IAAI,CAAC1I,GAAG,KAAK0I,cAAc,CAAC1I,GAAG,IAC/B,IAAI,CAACC,SAAS,KAAKyI,cAAc,CAACzI,SAAS;EAE/C;;EAEA;AACF;AACA;EACE,IAAI0I,aAAaA,CAAA,EAAkC;IACjD,OAAOC,0BAAe,CAACC,MAAM;EAC/B;;EAEA;AACF;EACE,IAAIC,eAAeA,CAAA,EAA6B;IAC9C,OAAO,IAAI,CAACC,gBAAgB;EAC9B;;EAEA;AACF;EACE,IAAID,eAAeA,CAACE,KAA+B,EAAE;IACnD,IAAI,CAACD,gBAAgB,GAAGC,KAAK;EAC/B;;EAEA;AACF;EACEC,sBAAsBA,CAACC,UAA+B,EAAQ;IAC5D,IAAI,IAAI,CAACH,gBAAgB,EAAE;MACzB,IAAI,CAACD,eAAe,CAACK,OAAO,CAAC,IAAI,EAAED,UAAU,CAAC;IAChD;EACF;;EAEA;AACF;AACA;EACE,IAAIjM,kBAAkBA,CAAA,EAAY;IAChC,OAAO,IAAAmM,6BAAmB,EAAC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAIlM,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAImM,yBAAgB,CAAC,IAAI,CAAC9L,IAAI,CAACL,OAAO,CAAC;EAChD;AACF;AAACoM,OAAA,CAAAxM,OAAA,GAAAN,cAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"AttributeModel.js","names":["_DateTimeUtil","require","_objects","_BaseModel","_interopRequireDefault","_ConstraintCollection","_ErrorCollection","_LinkCollection","_StringLengthConstraint","_MandatoryConstraint","_ConceptDetailModel","_LayoutHints","_Constants","_Settings","_exceptions","_AttributeContent","AttributeModel","BaseModel","constructor","attribute","attributeContributions","_defineProperty2","default","ConstraintCollection","getSetting","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","DISABLED","_errorCollection","ErrorCollection","message","addServerError","id","parameters","_referenceDate","getData","DateUtil","now","_isResult","_mandatory","MANDATORY","mandatory","_links","LinkCollection","isApplicableModel","isPlainObject","IllegalArgumentException","getInitialChildModelLinks","hasContentConfiguration","conceptLink","setChildModels","models","conceptHref","href","concept","_find","call","model","selfhref","equalsWithParameters","key","parentKey","_parentKey","name","type","_hasContentConfiguration","indicateContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","getContentConfiguredLabel","configuredLabelProperties","labelConfig","length","types","_context","configuredLabels","_filter","getLabelElementByIds","configuredLabel","_context2","firstConfiguredLabel","_map","configuredLabelProperty","some","_id","defaultAlignment","alignment","alignmentHints","getByLayoutHint","substring","links","downloadLink","getLinksByGroup","first","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","referenceDate","isCacheable","_concept","ConceptDetailModel","date","initvalue","getInputValue","inputvalue","toString","validateValue","validate","hasValue","getValue","getFormData","inError","formdata","getEmptyFormData","updateLastModification","formatValue","readonlyvalue","configuredMandatory","_validatedValue","readonly","_readonly","static","isResult","disabled","format","getContribution","formatLabel","minLength","maxLength","operator","assistantMessage","isValid","constraintCollection","constraints","add","_serverConstraints","MandatoryConstraint","StringLengthConstraint","addConstraints","setUseClientsideValidation","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","undefined","errorCollection","collection","invalidConstraints","isChangedSince","resetErrors","error","properties","removeServerError","hasServerErrors","serverErrors","hasErrors","hasItems","addMissingError","removeMissingError","addServerConstraint","defaultMessage","addConstraint","formatParameters","params","_keys","forEach","paramKey","paramValue","_endsWith","hasDynamicValidationData","updateValidations","errors","_lastModification","Date","timestamp","reset","UnsupportedOperationException","mergeAttribute","oldAttribute","update","changedAttribute","isEditable","_isEditable","isVisible","_isHidden","isHidden","show","hide","equals","otherAttribute","readonlyWidth","ATTRIBUTE_WIDTH","MEDIUM","layoutHintRules","_layoutHintRules","rules","processLayoutHintRules","attributes","process","hasAllContentInData","AttributeContent","exports"],"sources":["../../../src/models/attributes/AttributeModel.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { DISABLED, MANDATORY } from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting, hasAllContentInData } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type {\n AttributeType,\n FormErrorAnchor,\n IModelWithChildModels,\n ModularUIModel,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters,\n attribute.message.layouthint,\n );\n }\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n\n this._isResult = this.getData(\"isResult\", false);\n\n this._mandatory =\n this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n if (!isPlainObject(contributions)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a contributions object\",\n );\n }\n\n return false;\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): any {\n return value;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n !this.hasContentFromData &&\n this.hasContentConfiguration &&\n this.conceptLink\n ) {\n return [this.conceptLink];\n }\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>): void {\n const conceptHref = this.conceptLink?.href;\n if (conceptHref) {\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref),\n );\n }\n }\n\n /**\n * Getting the attribute key\n */\n get key(): string {\n return this.data.key;\n }\n\n /**\n */\n get parentKey(): string {\n return this._parentKey || \"\";\n }\n\n /**\n */\n set parentKey(parentKey: string) {\n this._parentKey = parentKey;\n }\n\n /**\n * Getting the attribute name\n */\n get name(): string {\n return this.key;\n }\n\n /**\n * Getting the type of the attribute\n */\n get type(): string {\n return this.contributions.type;\n }\n\n /**\n * Getting the label of the attribute\n */\n get label(): string {\n return this._label || \"\";\n }\n\n /**\n * Set the label of this attribute\n */\n set label(label: string) {\n this._label = label;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration = hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration || false;\n }\n\n /**\n */\n indicateContentConfiguration(\n contentConfiguration: ContentConfiguration,\n ): void {\n if (contentConfiguration) {\n const hasQuestionConfig = contentConfiguration.questions?.hasConfig();\n\n const hasEndResultConfig =\n contentConfiguration.isConfiguredEndResultAttribute(this.key);\n const hasIntermediateResultConfig =\n contentConfiguration.isConfiguredIntermediateResultAttribute(this.key);\n\n this.hasContentConfiguration =\n hasQuestionConfig || hasEndResultConfig || hasIntermediateResultConfig;\n }\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(\n contentConfiguration: ?ContentConfigurationElements,\n ): string {\n if (this.hasContentFromData) {\n return this.content.label ?? this.label;\n }\n\n const configuredLabelProperties =\n contentConfiguration && contentConfiguration.labelConfig.length > 0\n ? contentConfiguration.labelConfig[0].types\n : [];\n\n if (this.concept && configuredLabelProperties.length > 0) {\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 const [firstConfiguredLabel] = 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 );\n\n if (firstConfiguredLabel) {\n return firstConfiguredLabel.value;\n }\n }\n }\n\n return this.label;\n }\n\n /**\n */\n get defaultAlignment(): \"left\" | \"center\" | \"right\" {\n return \"left\";\n }\n\n /**\n * Handles layout hint align-left, align-center and align-right\n */\n get alignment(): \"left\" | \"center\" | \"right\" {\n const alignmentHints = this.layouthint.getByLayoutHint(\"align-\");\n\n // return alignment based on layouthint or the default alignment for the attribute\n const alignment = alignmentHints\n ? alignmentHints.substring(\"align-\".length)\n : this.defaultAlignment;\n\n if (\n alignment === \"left\" ||\n alignment === \"center\" ||\n alignment === \"right\"\n ) {\n return alignment;\n }\n\n return this.defaultAlignment;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Retrieve link of attribute when available\n */\n get downloadLink(): ?LinkModel {\n const downloadLink = this.links.getLinksByGroup(\"download\").first;\n\n if (downloadLink && downloadLink.key === this.key) {\n return downloadLink;\n }\n\n return null;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): ?LinkModel {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n\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 * 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 * Retrieve reference date of attribute which can be used as entryDate for content\n * to get information in correct time version\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Initial value received from the modular ui service\n */\n get initvalue(): any {\n return this._initvalue;\n }\n\n /**\n * Retrieve input value\n */\n getInputValue(): string {\n const inputvalue = this._inputvalue;\n\n return inputvalue ? inputvalue.toString() : \"\";\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Value that is used when retrieving an error collection of this attribute\n * Mostly this is the input value, but sometimes a different value is needed,\n * for example iban and postcode need to validate length without spaces\n */\n get validateValue(): string {\n return this.inputvalue;\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.value = value;\n\n this.validate(value);\n }\n\n /**\n */\n hasValue(): boolean {\n return this._value != null && this._value !== \"\";\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): any {\n return this.hasValue() ? this._value : null;\n }\n\n /**\n * Getting data ready to be send to the modular ui\n * Returns null when the attribute should not be send to the server\n */\n getFormData(): { [string]: any } | null {\n if (this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return this.getFormData();\n }\n\n /**\n */\n getEmptyFormData(): { [string]: null } {\n return { [this.name]: null };\n }\n\n /**\n * Getting the value of the attribute\n */\n get value(): any {\n return this.getValue();\n }\n\n /**\n * Setting a value in the element\n */\n set value(value: ?string) {\n this.updateLastModification();\n\n this._value = value;\n }\n\n /**\n */\n formatValue(value: string): string {\n return value;\n }\n\n /**\n * Getting the readonly value, iso value converted for human reading\n */\n get readonlyvalue(): string {\n return this.value ? this.value.toString() : \"\";\n }\n\n /**\n * Getting mandatory status of attribute\n */\n get mandatory(): boolean {\n return this._mandatory || false;\n }\n\n /**\n */\n get configuredMandatory(): ?boolean {\n return this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n }\n\n /**\n * Set mandatory status of attribute\n */\n set mandatory(mandatory: boolean) {\n if (mandatory !== this._mandatory) {\n this._validatedValue = null;\n }\n this._mandatory = mandatory;\n }\n\n /**\n */\n get readonly(): boolean {\n return (\n this._readonly ||\n this.contributions.readonly === true ||\n this.data.static === true ||\n this.isResult === true\n );\n }\n\n /**\n */\n set readonly(readonly: boolean) {\n this._readonly = readonly;\n }\n\n /**\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n */\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._isResult;\n }\n\n /**\n */\n set isResult(isResult: boolean) {\n this._isResult = isResult;\n }\n\n /**\n * Getting the display and input format of a attribute\n */\n get format(): string | null {\n return this.getContribution(\"format\");\n }\n\n /**\n */\n get formatLabel(): string {\n return this.format || \"\";\n }\n\n /**\n * Get minimum string length\n */\n get minLength(): number | null {\n return this.getContribution(\"minLength\");\n }\n\n /**\n * Get maximum string length\n */\n get maxLength(): number | null {\n return this.getContribution(\"maxLength\");\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n * Get assistant message\n */\n get assistantMessage(): string | null {\n return this.getContribution(\"assistant\");\n }\n\n /**\n * Get valid status\n */\n get isValid(): boolean {\n return this.validate(this.validateValue);\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this._serverConstraints);\n\n // Mandatory constraint\n if (this.mandatory) {\n constraints.add(new MandatoryConstraint());\n }\n\n if (this.minLength || this.maxLength) {\n constraints.add(\n new StringLengthConstraint(this.minLength, this.maxLength),\n );\n }\n\n constraints.add(this.addConstraints());\n\n return constraints;\n }\n\n /**\n * Template method for class extending this model to add extra constraints\n * @abstract\n */\n addConstraints(): ConstraintCollection {\n return new ConstraintCollection();\n }\n\n /**\n * Used to programmatically overwrite the setting USE_CLIENTSIDE_VALIDATION\n */\n setUseClientsideValidation(enabled: boolean): void {\n this._useClientsideValidation = enabled;\n }\n\n /**\n * Indicates if client side validation is enabled\n * @returns {boolean}\n */\n useClientsideValidation(): boolean {\n return this._useClientsideValidation ?? true;\n }\n\n /**\n * Validate input on client side constraint\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== value) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = value;\n\n return this._isValid;\n }\n\n /**\n * Indicates if attribute is optional and empty\n */\n isOptionalAndEmpty(value: string): boolean {\n if (value === undefined) {\n throw new IllegalArgumentException(\n \"isOptionalAndEmpty method needs value argument\",\n );\n }\n\n return !this.mandatory && value === \"\";\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n const collection = new ErrorCollection(\"attribute\", this._errorCollection);\n\n collection.addConstraints(\n this.constraintCollection.invalidConstraints(this.validateValue),\n );\n\n return collection;\n }\n\n /**\n * Check if attribute is in error\n */\n inError(): boolean {\n return !this._isValid && this.isChangedSince(0);\n }\n\n /**\n * Reset static error messages on attribute\n */\n resetErrors(): void {\n this._errorCollection = new ErrorCollection(\"attribute\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor): void {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties,\n error.layouthint,\n );\n }\n\n /**\n */\n removeServerError(id: string): void {\n this._errorCollection.removeServerError(id);\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return this.errorCollection.serverErrors.length > 0;\n }\n\n /**\n */\n hasErrors(): boolean {\n return this.errorCollection.hasItems;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(): void {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError(): void {\n this.removeServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n addServerConstraint(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters,\n ) {\n this._serverConstraints.addConstraint(\n id,\n null,\n defaultMessage,\n parameters,\n this.useClientsideValidation(),\n );\n }\n\n /**\n */\n formatParameters(parameters: Object): { [string]: string | number } {\n if (parameters == null) {\n return {};\n }\n\n const params: { [name: string]: string | number } = {};\n\n Object.keys(parameters).forEach((paramKey: string) => {\n const paramValue = parameters[paramKey];\n if (paramKey.endsWith(\"-number\") || paramKey.endsWith(\"-date\")) {\n params[paramKey] = this.formatValue(paramValue);\n } else {\n params[paramKey] = paramValue;\n }\n });\n\n return params;\n }\n\n /**\n */\n get hasDynamicValidationData(): boolean {\n return true;\n }\n\n /**\n */\n updateValidations(errors: Array<Object>): void {\n if (\n errors.some((error) => error.id === \"Constraint.Mandatory\") ||\n this.layouthint.has(MANDATORY)\n ) {\n this.mandatory = true;\n } else if (!this.hasValue()) {\n this.mandatory = false;\n }\n\n this._serverConstraints = new ConstraintCollection();\n this.resetErrors();\n\n errors\n .filter(\n (error) => error.id !== \"Constraint.Mandatory\" || !this.hasValue(),\n )\n .forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n error.layouthint,\n );\n } else {\n this.addServerConstraint(\n error.id,\n error.message,\n this.formatParameters(error.properties),\n );\n }\n });\n }\n\n /**\n * Set last modification to current timestamp\n */\n updateLastModification(): void {\n this._lastModification = Date.now();\n }\n\n /**\n * Inidicates if attribute is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return this._lastModification > timestamp;\n }\n\n /**\n * Abstract reset method which should be implemented on each attribute that has this attribute as a base class.\n *\n * @abstract\n */\n reset(): void {\n throw new UnsupportedOperationException(\n `Reset method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Merge old attribute with the attribute from the server.\n * Readonly attributes always need to show the value from the server\n */\n mergeAttribute(oldAttribute: AttributeType): void {\n this.concept = oldAttribute.concept;\n\n if (\n !oldAttribute.readonly &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(oldAttribute.inputvalue);\n }\n }\n\n /**\n * Abstract update method which should be implemented on each attribute that has this attribute as a base class.\n * @abstract\n */\n // eslint-disable-next-line no-unused-vars\n update(value: string, changedAttribute?: AttributeType): AttributeType {\n throw new UnsupportedOperationException(\n `Update method not implemented for ${this.type}`,\n );\n }\n\n /**\n * Indicate if attribute is editable\n */\n set isEditable(isEditable: boolean) {\n this._isEditable = isEditable;\n }\n\n /**\n * Retrieve if attribute is editable\n */\n get isEditable(): boolean {\n return this._isEditable;\n }\n\n /**\n * Indicates if the attribute is visible\n */\n get isVisible(): boolean {\n return !this._isHidden;\n }\n\n /**\n */\n get isHidden(): boolean {\n return this._isHidden;\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n this._isHidden = isHidden;\n }\n\n /**\n * Explicitly toggle visibility of this attribute\n */\n show(): void {\n this.isHidden = false;\n }\n\n /**\n */\n hide(): void {\n this.isHidden = true;\n }\n\n /**\n */\n equals(otherAttribute: AttributeType): boolean {\n return (\n this.key === otherAttribute.key &&\n this.parentKey === otherAttribute.parentKey\n );\n }\n\n /**\n * Readonly attribute width indicates the proposed width of this attribute\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n\n /**\n */\n get layoutHintRules(): LayoutHintRuleCollection {\n return this._layoutHintRules;\n }\n\n /**\n */\n set layoutHintRules(rules: LayoutHintRuleCollection) {\n this._layoutHintRules = rules;\n }\n\n /**\n */\n processLayoutHintRules(attributes: AttributeCollection): void {\n if (this._layoutHintRules) {\n this.layoutHintRules.process(this, attributes);\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 new AttributeContent(this.data.content);\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AEA;AACF;EACEC,sBAAsBA,CAACC,UAA+B,EAAQ;IAC5D,IAAI,IAAI,CAACH,gBAAgB,EAAE;MACzB,IAAI,CAACD,eAAe,CAACK,OAAO,CAAC,IAAI,EAAED,UAAU,CAAC;IAChD;EACF;;EAEA;AACF;AACA;EACE,IAAI/L,kBAAkBA,CAAA,EAAY;IAChC,OAAO,IAAAiM,6BAAmB,EAAC,CAAC;EAC9B;;EAEA;AACF;EACE,IAAIhM,OAAOA,CAAA,EAAqB;IAC9B,OAAO,IAAIiM,yBAAgB,CAAC,IAAI,CAAC5L,IAAI,CAACL,OAAO,CAAC;EAChD;AACF;AAACkM,OAAA,CAAAtM,OAAA,GAAAN,cAAA","ignoreList":[]}
|
|
@@ -53,6 +53,12 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
53
53
|
return "choice";
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
*/
|
|
58
|
+
get optionType() {
|
|
59
|
+
return this.contributions?.optionType ?? "generic";
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
/**
|
|
57
63
|
*/
|
|
58
64
|
getInitialChildModelLinks() {
|
|
@@ -96,14 +102,6 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
96
102
|
return this.contributions.lookupList?.label ?? "";
|
|
97
103
|
}
|
|
98
104
|
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
*/
|
|
102
|
-
get avatarLink() {
|
|
103
|
-
var _context;
|
|
104
|
-
return (0, _find.default)(_context = this.options.collection).call(_context, option => option.code === this.value)?.avatarLink || null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
105
|
/**
|
|
108
106
|
* Retrieve reference date of attribute which can be used as entryDate for content
|
|
109
107
|
*/
|
|
@@ -130,17 +128,17 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
130
128
|
* Getting all enabled options
|
|
131
129
|
*/
|
|
132
130
|
get selected() {
|
|
133
|
-
var
|
|
131
|
+
var _context;
|
|
134
132
|
// $FlowFixMe[incompatible-call]
|
|
135
|
-
return (0, _map.default)(
|
|
133
|
+
return (0, _map.default)(_context = this.options.selected).call(_context, option => option.code);
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
/**
|
|
139
137
|
* Flatten options and filter out the options that are not selected
|
|
140
138
|
*/
|
|
141
139
|
get readonlyvalue() {
|
|
142
|
-
var
|
|
143
|
-
return (0, _map.default)(
|
|
140
|
+
var _context2;
|
|
141
|
+
return (0, _map.default)(_context2 = this.options.selected).call(_context2, option => option.label).join(", ");
|
|
144
142
|
}
|
|
145
143
|
|
|
146
144
|
/**
|
|
@@ -156,8 +154,8 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
156
154
|
* Retrieve list of selected options, joined with comma
|
|
157
155
|
*/
|
|
158
156
|
getValue() {
|
|
159
|
-
var
|
|
160
|
-
return this.options.selected.length > 0 ? (0, _map.default)(
|
|
157
|
+
var _context3;
|
|
158
|
+
return this.options.selected.length > 0 ? (0, _map.default)(_context3 = this.options.selected).call(_context3, option => option.code).join(",") : null;
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
/**
|
|
@@ -177,8 +175,8 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
177
175
|
* Setting an option selected or unselected based on the current state
|
|
178
176
|
*/
|
|
179
177
|
toggleOption(code) {
|
|
180
|
-
var
|
|
181
|
-
if ((0, _includes.default)(
|
|
178
|
+
var _context4;
|
|
179
|
+
if ((0, _includes.default)(_context4 = this.selected).call(_context4, code)) {
|
|
182
180
|
this.disableOption(code);
|
|
183
181
|
} else {
|
|
184
182
|
this.enableOption(code);
|
|
@@ -208,11 +206,11 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
208
206
|
* Add a new option to the collection of lookup options
|
|
209
207
|
*/
|
|
210
208
|
addOption(option) {
|
|
211
|
-
var
|
|
209
|
+
var _context5;
|
|
212
210
|
if (!this.isMultiple) {
|
|
213
211
|
this.options.deselectAll();
|
|
214
212
|
}
|
|
215
|
-
if ((0, _find.default)(
|
|
213
|
+
if ((0, _find.default)(_context5 = this.options).call(_context5, opt => opt.code === option.code) === null) {
|
|
216
214
|
this.options.addOption(option.code, option);
|
|
217
215
|
}
|
|
218
216
|
}
|
|
@@ -221,8 +219,8 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
221
219
|
* Getting the type of choice filter. For instance checkbox, radiobutton, combobox.
|
|
222
220
|
*/
|
|
223
221
|
get choicetype() {
|
|
224
|
-
var
|
|
225
|
-
return (0, _find.default)(
|
|
222
|
+
var _context6;
|
|
223
|
+
return (0, _find.default)(_context6 = ["checkbox", "radiobutton", "combobox", "list", "listview", "table", "longlist", "toggle"]).call(_context6, hint => this.layouthint.has(hint)) || "checkbox";
|
|
226
224
|
}
|
|
227
225
|
|
|
228
226
|
/**
|
|
@@ -308,13 +306,13 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
308
306
|
* content configuration for instrument questions is available on the form object
|
|
309
307
|
*/
|
|
310
308
|
get contentConfiguration() {
|
|
311
|
-
var
|
|
309
|
+
var _context7;
|
|
312
310
|
if (!this.contributions.content || !this.contributions.content.optionElements) {
|
|
313
311
|
return null;
|
|
314
312
|
}
|
|
315
313
|
|
|
316
314
|
// Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps
|
|
317
|
-
const optionElementConfig = (0, _map.default)(
|
|
315
|
+
const optionElementConfig = (0, _map.default)(_context7 = this.contributions.content.optionElements).call(_context7, optionElement => {
|
|
318
316
|
if ("contentElement" in optionElement) {
|
|
319
317
|
return {
|
|
320
318
|
contentElement: {
|
|
@@ -347,9 +345,9 @@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
347
345
|
} = error;
|
|
348
346
|
const ANSWER_OPTION_KEY = "answer-option-key";
|
|
349
347
|
if (properties && (0, _objects.has)(properties, ANSWER_OPTION_KEY)) {
|
|
350
|
-
var
|
|
348
|
+
var _context8;
|
|
351
349
|
const optionKey = properties[ANSWER_OPTION_KEY];
|
|
352
|
-
const foundOption = (0, _find.default)(
|
|
350
|
+
const foundOption = (0, _find.default)(_context8 = this.options).call(_context8, option => option.code === optionKey);
|
|
353
351
|
if (foundOption) {
|
|
354
352
|
properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(this.contentConfiguration);
|
|
355
353
|
}
|