@beinformed/ui 1.9.0-beta.6 → 1.9.1
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 +50 -0
- package/esm/constants/Settings.js +10 -8
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/hooks/useNotification.js.map +1 -1
- package/esm/hooks/useRouter.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js +126 -58
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeDataHelper.js +1 -1
- package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js +3 -3
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +4 -4
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/HelptextAttributeModel.js +17 -1
- package/esm/models/attributes/HelptextAttributeModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +26 -12
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/content/SectionModel.js +2 -1
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/content/SubSectionModel.js +3 -1
- package/esm/models/content/SubSectionModel.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationResults.js +2 -2
- package/esm/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +8 -2
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/layouthint/LayoutHintCollection.js +3 -2
- package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +25 -0
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/list/ListModel.js +22 -16
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +19 -17
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +2 -1
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/utils/helpers/text.js +19 -0
- package/esm/utils/helpers/text.js.map +1 -0
- package/esm/utils/index.js +2 -1
- package/esm/utils/index.js.map +1 -1
- package/lib/constants/Settings.js +12 -1
- package/lib/constants/Settings.js.flow +9 -5
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useForm.js.flow +10 -5
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useNotification.js.flow +5 -2
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/hooks/useRouter.js.flow +12 -5
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js +136 -59
- package/lib/models/attributes/AttributeContent.js.flow +91 -39
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js +1 -1
- package/lib/models/attributes/AttributeDataHelper.js.flow +2 -1
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +1 -1
- package/lib/models/attributes/AttributeModel.js.flow +2 -3
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +3 -3
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +4 -7
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/HelptextAttributeModel.js +17 -1
- package/lib/models/attributes/HelptextAttributeModel.js.flow +11 -1
- package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +10 -2
- package/lib/models/attributes/__tests__/AttributeDataHelper.spec.js.flow +9 -3
- package/lib/models/attributes/__tests__/HelptextAttributeModel.spec.js.flow +39 -1
- package/lib/models/caseview/CaseViewModel.js +27 -13
- package/lib/models/caseview/CaseViewModel.js.flow +17 -7
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/caseview/__tests__/CaseViewModel.spec.js.flow +68 -184
- package/lib/models/concepts/__mock__/business_scenario.js.flow +14 -1
- package/lib/models/concepts/__mock__/conceptdetail.js.flow +15 -6
- package/lib/models/concepts/__tests__/BusinessScenarioModel.spec.js.flow +5 -6
- package/lib/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +58 -3
- package/lib/models/content/SectionModel.js +3 -1
- package/lib/models/content/SectionModel.js.flow +2 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js +4 -1
- package/lib/models/content/SubSectionModel.js.flow +3 -1
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationResults.js +2 -2
- package/lib/models/contentconfiguration/ContentConfigurationResults.js.flow +2 -2
- package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/lib/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js.flow +6 -6
- package/lib/models/form/FormObjectModel.js +8 -2
- package/lib/models/form/FormObjectModel.js.flow +5 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/form/__tests__/FormObjectModel.spec.js.flow +2 -2
- package/lib/models/layouthint/LayoutHintCollection.js +4 -2
- package/lib/models/layouthint/LayoutHintCollection.js.flow +8 -7
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/list/ListDetailModel.js +25 -0
- package/lib/models/list/ListDetailModel.js.flow +19 -0
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListModel.js +23 -16
- package/lib/models/list/ListModel.js.flow +9 -5
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/list/__tests__/ListDetailModel.spec.js.flow +64 -0
- package/lib/models/list/__tests__/ListModel.spec.js.flow +64 -2
- package/lib/models/panels/GroupingPanelModel.js +21 -18
- package/lib/models/panels/GroupingPanelModel.js.flow +10 -9
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/panels/__tests__/GroupingPanelModel.spec.js.flow +90 -0
- package/lib/models/types.js.flow +38 -11
- package/lib/modularui/ModularUIRequest.js +2 -1
- package/lib/modularui/ModularUIRequest.js.flow +1 -0
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/utils/helpers/text.js +28 -0
- package/lib/utils/helpers/text.js.flow +23 -0
- package/lib/utils/helpers/text.js.map +1 -0
- package/lib/utils/index.js +14 -0
- package/lib/utils/index.js.flow +1 -0
- package/lib/utils/index.js.map +1 -1
- package/package.json +13 -13
- package/src/constants/Settings.js +9 -5
- package/src/hooks/useForm.js +10 -5
- package/src/hooks/useNotification.js +5 -2
- package/src/hooks/useRouter.js +12 -5
- package/src/models/attributes/AttributeContent.js +91 -39
- package/src/models/attributes/AttributeDataHelper.js +2 -1
- package/src/models/attributes/AttributeModel.js +2 -3
- package/src/models/attributes/ChoiceAttributeOptionModel.js +4 -7
- package/src/models/attributes/HelptextAttributeModel.js +11 -1
- package/src/models/attributes/__tests__/AttributeContent.spec.js +10 -2
- package/src/models/attributes/__tests__/AttributeDataHelper.spec.js +9 -3
- package/src/models/attributes/__tests__/HelptextAttributeModel.spec.js +39 -1
- package/src/models/caseview/CaseViewModel.js +17 -7
- package/src/models/caseview/__tests__/CaseViewModel.spec.js +68 -184
- package/src/models/caseview/__tests__/caseview.json +38 -0
- package/src/models/caseview/__tests__/caseviewContributions.json +147 -0
- package/src/models/concepts/__mock__/business_scenario.js +14 -1
- package/src/models/concepts/__mock__/business_scenario_step.json +64 -0
- package/src/models/concepts/__mock__/conceptdetail.js +15 -6
- package/src/models/concepts/__mock__/conceptdetail_data.json +117 -17
- package/src/models/concepts/__mock__/concepttype_Calculation.json +75 -0
- package/src/models/concepts/__tests__/BusinessScenarioModel.spec.js +5 -6
- package/src/models/concepts/__tests__/ConceptDetailModel.spec.js +58 -3
- package/src/models/content/SectionModel.js +2 -1
- package/src/models/content/SubSectionModel.js +3 -1
- package/src/models/contentconfiguration/ContentConfigurationResults.js +2 -2
- package/src/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js +6 -6
- package/src/models/form/FormObjectModel.js +5 -1
- package/src/models/form/__tests__/FormObjectModel.spec.js +2 -2
- package/src/models/form/__tests__/FormWithContentData.json +1 -0
- package/src/models/layouthint/LayoutHintCollection.js +8 -7
- package/src/models/list/ListDetailModel.js +19 -0
- package/src/models/list/ListModel.js +9 -5
- package/src/models/list/__tests__/ListDetailModel.spec.js +64 -0
- package/src/models/list/__tests__/ListModel.spec.js +64 -2
- package/src/models/list/__tests__/caselist-34.contributions.json +1 -1
- package/src/models/list/__tests__/listContributions.json +1 -1
- package/src/models/panels/GroupingPanelModel.js +10 -9
- package/src/models/panels/__tests__/GroupingPanelModel.spec.js +90 -0
- package/src/models/panels/__tests__/groupingPanel.json +30 -0
- package/src/models/panels/__tests__/groupingPanelContributions.json +46 -0
- package/src/models/types.js +38 -11
- package/src/modularui/ModularUIRequest.js +1 -0
- package/src/utils/helpers/text.js +23 -0
- package/src/utils/index.js +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/AttributeModel.js"],"names":["AttributeModel","attribute","attributeContributions","ConstraintCollection","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","hasContentConfiguration","conceptLink","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","_parentKey","parentKey","type","_hasContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","configuredLabelProperty","some","_id","firstConfiguredLabel","alignmentHints","getByLayoutHint","alignment","substring","defaultAlignment","downloadLink","links","getLinksByGroup","first","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","referenceDate","isCacheable","_concept","ConceptDetailModel","date","inputvalue","toString","getInputValue","validate","hasValue","inError","name","getFormData","getValue","updateLastModification","_validatedValue","_readonly","readonly","static","isResult","disabled","getContribution","format","validateValue","constraints","add","_serverConstraints","MandatoryConstraint","minLength","maxLength","StringLengthConstraint","addConstraints","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","constraintCollection","undefined","IllegalArgumentException","collection","invalidConstraints","isChangedSince","error","properties","removeServerError","errorCollection","serverErrors","hasItems","defaultMessage","addConstraint","params","forEach","paramKey","paramValue","formatValue","errors","resetErrors","formatParameters","addServerConstraint","_lastModification","Date","timestamp","UnsupportedOperationException","oldAttribute","isValid","update","changedAttribute","_isEditable","isEditable","_isHidden","isHidden","otherAttribute","ATTRIBUTE_WIDTH","MEDIUM","_layoutHintRules","rules","attributes","layoutHintRules","process","ALL_CONTENT_IN_DATA_SETTING","AttributeContent","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAMA;;AAEA;;AAYA;;;;;;AAEA;AACA;AACA;IACqBA,c;;;;;AA0BnB;AACF;AACE,0BAAYC,SAAZ,EAA+BC,sBAA/B,EAA+D;AAAA;;AAAA;AAC7D,8BAAMD,SAAN,EAAiBC,sBAAjB;AAD6D;AAAA,oGA1BnC,CA0BmC;AAAA;AAAA;AAAA;AAAA;AAAA,qGAnBpB,IAAIC,6BAAJ,EAmBoB;AAAA,2GAlB3B,0BAAW,2BAAX,CAkB2B;AAAA,2FAjB3C,IAiB2C;AAAA;AAAA,8FAfxC,KAewC;AAAA,2FAdzB,IAcyB;AAAA;AAAA;AAAA,4FAX1C,KAW0C;AAAA;AAAA,4FAT1C,KAS0C;AAAA;AAAA;AAAA;AAAA;AAAA;;AAG7D,QAAI,MAAKC,kBAAL,IAA2B,MAA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O;AACL,WAAKA,QAAL,GAAgB,KAAhB;AACD;AAED;AACF;;;;WACE,gBAAO;AACL,WAAKA,QAAL,GAAgB,IAAhB;AACD;AAED;AACF;;;;WACE,gBAAOC,cAAP,EAA+C;AAC7C,aACE,KAAK5G,GAAL,KAAa4G,cAAc,CAAC5G,GAA5B,IACA,KAAKE,SAAL,KAAmB0G,cAAc,CAAC1G,SAFpC;AAID;AAED;AACF;AACA;;;;SACE,eAAmD;AACjD,aAAO2G,2BAAgBC,MAAvB;AACD;AAED;AACF;;;;SACE,eAAgD;AAC9C,aAAO,KAAKC,gBAAZ;AACD;AAED;AACF;;SACE,aAAoBC,KAApB,EAAqD;AACnD,WAAKD,gBAAL,GAAwBC,KAAxB;AACD;AAED;AACF;;;;WACE,gCAAuBC,UAAvB,EAAwD;AACtD,UAAI,KAAKF,gBAAT,EAA2B;AACzB,aAAKG,eAAL,CAAqBC,OAArB,CAA6B,IAA7B,EAAmCF,UAAnC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAO,0BAAWG,sCAAX,EAAwC,IAAxC,CAAP;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,IAAIC,yBAAJ,CAAqB,KAAKvJ,IAAL,CAAUL,OAA/B,CAAP;AACD;;;WAv1BD,2BAAyBG,aAAzB,EAAyD;AACvD,UAAI,CAAC,4BAAcA,aAAd,CAAL,EAAmC;AACjC,cAAM,IAAI+G,oCAAJ,CACJ,oEADI,CAAN;AAGD;;AAED,aAAO,KAAP;AACD;;;EA1EyC2C,mB","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 { MANDATORY, DISABLED } from \"../../constants/LayoutHints\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type { AttributeType, FormErrorAnchor, ModularUIModel } 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 extends BaseModel {\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 );\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>) {\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(contentConfiguration: ContentConfiguration) {\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 \"\";\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) {\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() {\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) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties\n );\n }\n\n /**\n */\n removeServerError(id: string) {\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() {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError() {\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 = {};\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>) {\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.forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties)\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() {\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() {\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) {\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() {\n this.isHidden = false;\n }\n\n /**\n */\n hide() {\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) {\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 getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n }\n\n /**\n */\n get content(): AttributeContent {\n return new AttributeContent(this.data.content);\n }\n}\n"],"file":"AttributeModel.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/AttributeModel.js"],"names":["AttributeModel","attribute","attributeContributions","ConstraintCollection","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","hasContentConfiguration","conceptLink","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","_parentKey","parentKey","type","_hasContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","configuredLabelProperty","some","_id","firstConfiguredLabel","alignmentHints","getByLayoutHint","alignment","substring","defaultAlignment","downloadLink","links","getLinksByGroup","first","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","referenceDate","isCacheable","_concept","ConceptDetailModel","date","inputvalue","toString","getInputValue","validate","hasValue","inError","name","getFormData","getValue","updateLastModification","_validatedValue","_readonly","readonly","static","isResult","disabled","getContribution","format","validateValue","constraints","add","_serverConstraints","MandatoryConstraint","minLength","maxLength","StringLengthConstraint","addConstraints","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","constraintCollection","undefined","IllegalArgumentException","collection","invalidConstraints","isChangedSince","error","properties","removeServerError","errorCollection","serverErrors","hasItems","defaultMessage","addConstraint","params","forEach","paramKey","paramValue","formatValue","errors","resetErrors","formatParameters","addServerConstraint","_lastModification","Date","timestamp","UnsupportedOperationException","oldAttribute","isValid","update","changedAttribute","_isEditable","isEditable","_isHidden","isHidden","otherAttribute","ATTRIBUTE_WIDTH","MEDIUM","_layoutHintRules","rules","attributes","layoutHintRules","process","AttributeContent","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAKA;;AAEA;;AAYA;;;;;;AAEA;AACA;AACA;IACqBA,c;;;;;AA0BnB;AACF;AACE,0BAAYC,SAAZ,EAA+BC,sBAA/B,EAA+D;AAAA;;AAAA;AAC7D,8BAAMD,SAAN,EAAiBC,sBAAjB;AAD6D;AAAA,oGA1BnC,CA0BmC;AAAA;AAAA;AAAA;AAAA;AAAA,qGAnBpB,IAAIC,6BAAJ,EAmBoB;AAAA,2GAlB3B,0BAAW,2BAAX,CAkB2B;AAAA,2FAjB3C,IAiB2C;AAAA;AAAA,8FAfxC,KAewC;AAAA,2FAdzB,IAcyB;AAAA;AAAA;AAAA,4FAX1C,KAW0C;AAAA;AAAA,4FAT1C,KAS0C;AAAA;AAAA;AAAA;AAAA;AAAA;;AAG7D,QAAI,MAAKC,kBAAL,IAA2B,MAAKC,OAAL,CAAaC,KAA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GAAgB,KAAhB;AACD;AAED;AACF;;;;WACE,gBAAO;AACL,WAAKA,QAAL,GAAgB,IAAhB;AACD;AAED;AACF;;;;WACE,gBAAOC,cAAP,EAA+C;AAC7C,aACE,KAAK5G,GAAL,KAAa4G,cAAc,CAAC5G,GAA5B,IACA,KAAKE,SAAL,KAAmB0G,cAAc,CAAC1G,SAFpC;AAID;AAED;AACF;AACA;;;;SACE,eAAmD;AACjD,aAAO2G,2BAAgBC,MAAvB;AACD;AAED;AACF;;;;SACE,eAAgD;AAC9C,aAAO,KAAKC,gBAAZ;AACD;AAED;AACF;;SACE,aAAoBC,KAApB,EAAqD;AACnD,WAAKD,gBAAL,GAAwBC,KAAxB;AACD;AAED;AACF;;;;WACE,gCAAuBC,UAAvB,EAAwD;AACtD,UAAI,KAAKF,gBAAT,EAA2B;AACzB,aAAKG,eAAL,CAAqBC,OAArB,CAA6B,IAA7B,EAAmCF,UAAnC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAO,oCAAP;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,IAAIG,yBAAJ,CAAqB,KAAKtJ,IAAL,CAAUL,OAA/B,CAAP;AACD;;;WAv1BD,2BAAyBG,aAAzB,EAAyD;AACvD,UAAI,CAAC,4BAAcA,aAAd,CAAL,EAAmC;AACjC,cAAM,IAAI+G,oCAAJ,CACJ,oEADI,CAAN;AAGD;;AAED,aAAO,KAAP;AACD;;;EA1EyC0C,mB","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 { MANDATORY, DISABLED } 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 { AttributeType, FormErrorAnchor, ModularUIModel } 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 extends BaseModel {\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 );\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>) {\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(contentConfiguration: ContentConfiguration) {\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 \"\";\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) {\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() {\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) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties\n );\n }\n\n /**\n */\n removeServerError(id: string) {\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() {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError() {\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 = {};\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>) {\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.forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties)\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() {\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() {\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) {\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() {\n this.isHidden = false;\n }\n\n /**\n */\n hide() {\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) {\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"],"file":"AttributeModel.js"}
|
|
@@ -45,14 +45,14 @@ var _Constants = require("../../constants/Constants");
|
|
|
45
45
|
|
|
46
46
|
var _LayoutHints = require("../../constants/LayoutHints");
|
|
47
47
|
|
|
48
|
+
var _Settings = require("../../constants/Settings");
|
|
49
|
+
|
|
48
50
|
var _LinkCollection = _interopRequireDefault(require("../links/LinkCollection"));
|
|
49
51
|
|
|
50
52
|
var _AttributeCollection = _interopRequireDefault(require("./AttributeCollection"));
|
|
51
53
|
|
|
52
54
|
var _ConceptDetailModel = _interopRequireDefault(require("../concepts/ConceptDetailModel"));
|
|
53
55
|
|
|
54
|
-
var _constants = require("../../constants");
|
|
55
|
-
|
|
56
56
|
var _AttributeContent = _interopRequireDefault(require("./AttributeContent"));
|
|
57
57
|
|
|
58
58
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -420,7 +420,7 @@ var ChoiceAttributeOptionModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
420
420
|
}, {
|
|
421
421
|
key: "hasContentFromData",
|
|
422
422
|
get: function get() {
|
|
423
|
-
return (0,
|
|
423
|
+
return (0, _Settings.hasAllContentInData)();
|
|
424
424
|
}
|
|
425
425
|
/**
|
|
426
426
|
*/
|
|
@@ -4,21 +4,18 @@ import ChoiceAttributeOptionCollection from "./ChoiceAttributeOptionCollection";
|
|
|
4
4
|
|
|
5
5
|
import { DateUtil } from "../../utils/datetime/DateTimeUtil";
|
|
6
6
|
import { has } from "../../utils/helpers/objects";
|
|
7
|
-
import {
|
|
8
|
-
ALL_CONTENT_IN_DATA_SETTING,
|
|
9
|
-
TIMEVERSION_FILTER_NAME,
|
|
10
|
-
} from "../../constants/Constants";
|
|
7
|
+
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
11
8
|
import { TITLE } from "../../constants/LayoutHints";
|
|
9
|
+
import { hasAllContentInData } from "../../constants/Settings";
|
|
12
10
|
|
|
13
11
|
import LinkCollection from "../links/LinkCollection";
|
|
14
12
|
import AttributeCollection from "./AttributeCollection";
|
|
15
13
|
import ConceptDetailModel from "../concepts/ConceptDetailModel";
|
|
14
|
+
import AttributeContent from "./AttributeContent";
|
|
16
15
|
|
|
17
16
|
import type { ModularUIModel } from "../types";
|
|
18
17
|
import type ListItemModel from "../list/ListItemModel";
|
|
19
18
|
import type LinkModel from "../links/LinkModel";
|
|
20
|
-
import { getSetting } from "../../constants";
|
|
21
|
-
import AttributeContent from "./AttributeContent";
|
|
22
19
|
|
|
23
20
|
/**
|
|
24
21
|
*/
|
|
@@ -358,7 +355,7 @@ class ChoiceAttributeOptionModel extends BaseModel {
|
|
|
358
355
|
* Indicates if content comes from the data service
|
|
359
356
|
*/
|
|
360
357
|
get hasContentFromData(): boolean {
|
|
361
|
-
return
|
|
358
|
+
return hasAllContentInData();
|
|
362
359
|
}
|
|
363
360
|
|
|
364
361
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"names":["ChoiceAttributeOptionModel","selectedValues","option","referenceDate","DateUtil","now","code","contributions","key","_isSelected","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","LinkCollection","_content","AttributeContent","content","initialLinks","hasContentFromData","conceptLink","push","children","getInitialChildModelLinks","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","setChildModels","_code","toString","attributeCollection","getContribution","data","AttributeCollection","label","hasItems","title","getAttributeByLayoutHint","TITLE","readonlyvalue","first","contentConfiguration","configuredLabelProperties","labelConfig","types","length","configuredLabels","getLabelElementByIds","configuredLabel","value","configuredLabelProperty","some","_id","selected","ChoiceAttributeOptionCollection","create","options","links","date","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","isCacheable","_concept","ConceptDetailModel","level","withOption","mergeOptions","ALL_CONTENT_IN_DATA_SETTING","listitem","id","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAIA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;;;;;AAEA;AACA;IACMA,0B;;;;;AAWJ;AACF;AACE,wCAIE;AAAA;;AAAA;;AAAA,QAHAC,cAGA,uEAHgC,EAGhC;AAAA,QAFAC,MAEA,uEAFiB,EAEjB;AAAA,QADAC,aACA,uEAD0BC,uBAASC,GAAT,EAC1B;AAAA;AACA,8BAAM,EAAN,EAAUH,MAAV;AADA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,UAAKI,IAAL,oCAAY,MAAKC,aAAL,CAAmBD,IAA/B,yEAAuC,MAAKC,aAAL,CAAmBC,GAA1D,uCAAiE,EAAjE;AAEA,UAAKC,WAAL,GAAmB,uBAAAR,cAAc,MAAd,CAAAA,cAAc,EAAU,MAAKK,IAAf,CA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;AACpC,WAAKwC,QAAL,GAAgBxC,OAAO,YAAYyC,2BAAnB,GAAwCzC,OAAxC,GAAkD,IAAlE;AACD;AAED;AACF;AACA;;;;SACE,eAAoB;AAClB,aAAO,KAAKnB,MAAZ;AACD;AAED;AACF;AACA;;SACE,aAAU6D,KAAV,EAAyB;AACvB,WAAK7D,MAAL,GAAc6D,KAAd;AACD;AAED;AACF;;;;SACE,eAA6B;AAC3B,aAAO,KAAKlC,eAAL,CAAqB,eAArB,EAAsC,KAAtC,CAAP;AACD;AAED;AACF;;;;SACE,eAAmC;AACjC,aAAO,KAAKA,eAAL,CAAqB,qBAArB,EAA4C,KAA5C,CAAP;AACD;AAED;AACF;;;;WACE,qBAAYmC,UAAZ,EAAoD;AAClD,WAAK3C,OAAL,GAAe2C,UAAU,CAAC3C,OAA1B;;AAEA,UAAI,KAAKL,QAAL,IAAiB,IAAjB,IAAyBgD,UAAU,CAAChD,QAAX,IAAuB,IAApD,EAA0D;AACxD,aAAKA,QAAL,CAAciD,YAAd,CAA2BD,UAAU,CAAChD,QAAtC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAO,2BAAWkD,sCAAX,EAAwC,IAAxC,CAAP;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,KAAKzD,QAAZ;AACD;;;WAjTD,iCACE0D,QADF,EAE8B;AAC5B,UAAM1E,MAAM,GAAG,IAAIF,0BAAJ,EAAf;AAEAE,MAAAA,MAAM,CAACI,IAAP,GAAcsE,QAAQ,CAACC,EAAT,CAAYzC,QAAZ,EAAd;AACAlC,MAAAA,MAAM,CAACmC,mBAAP,GAA6BuC,QAAQ,CAACvC,mBAAtC;AACAnC,MAAAA,MAAM,CAAC8D,KAAP,GAAeY,QAAQ,CAACZ,KAAxB;AAEA,aAAO9D,MAAP;AACD;;;EAhDsC4E,mB;;eA0V1B9E,0B","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 {\n ALL_CONTENT_IN_DATA_SETTING,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport { getSetting } from \"../../constants\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n */\nclass ChoiceAttributeOptionModel extends BaseModel {\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;\n option.links = listitem.links;\n\n return option;\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 * 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 getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"file":"ChoiceAttributeOptionModel.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"names":["ChoiceAttributeOptionModel","selectedValues","option","referenceDate","DateUtil","now","code","contributions","key","_isSelected","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","LinkCollection","_content","AttributeContent","content","initialLinks","hasContentFromData","conceptLink","push","children","getInitialChildModelLinks","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","setChildModels","_code","toString","attributeCollection","getContribution","data","AttributeCollection","label","hasItems","title","getAttributeByLayoutHint","TITLE","readonlyvalue","first","contentConfiguration","configuredLabelProperties","labelConfig","types","length","configuredLabels","getLabelElementByIds","configuredLabel","value","configuredLabelProperty","some","_id","selected","ChoiceAttributeOptionCollection","create","options","links","date","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","isCacheable","_concept","ConceptDetailModel","level","withOption","mergeOptions","listitem","id","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAC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aAAO,oCAAP;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,KAAKP,QAAZ;AACD;;;WAjTD,iCACEyD,QADF,EAE8B;AAC5B,UAAMzE,MAAM,GAAG,IAAIF,0BAAJ,EAAf;AAEAE,MAAAA,MAAM,CAACI,IAAP,GAAcqE,QAAQ,CAACC,EAAT,CAAYxC,QAAZ,EAAd;AACAlC,MAAAA,MAAM,CAACmC,mBAAP,GAA6BsC,QAAQ,CAACtC,mBAAtC;AACAnC,MAAAA,MAAM,CAAC8D,KAAP,GAAeW,QAAQ,CAACX,KAAxB;AAEA,aAAO9D,MAAP;AACD;;;EAhDsC2E,mB;;eA0V1B7E,0B","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 { ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n */\nclass ChoiceAttributeOptionModel extends BaseModel {\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;\n option.links = listitem.links;\n\n return option;\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 * 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"],"file":"ChoiceAttributeOptionModel.js"}
|
|
@@ -55,7 +55,23 @@ var HelptextAttributeModel = /*#__PURE__*/function (_LabelAttributeModel) {
|
|
|
55
55
|
}, {
|
|
56
56
|
key: "text",
|
|
57
57
|
get: function get() {
|
|
58
|
-
|
|
58
|
+
var dataText = this.getData("value");
|
|
59
|
+
|
|
60
|
+
if (dataText) {
|
|
61
|
+
var _dataText$message;
|
|
62
|
+
|
|
63
|
+
return (_dataText$message = dataText.message) !== null && _dataText$message !== void 0 ? _dataText$message : dataText;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var contributionText = this.getContribution("text");
|
|
67
|
+
|
|
68
|
+
if (contributionText) {
|
|
69
|
+
var _contributionText$mes;
|
|
70
|
+
|
|
71
|
+
return (_contributionText$mes = contributionText.message) !== null && _contributionText$mes !== void 0 ? _contributionText$mes : contributionText;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null;
|
|
59
75
|
}
|
|
60
76
|
}], [{
|
|
61
77
|
key: "isApplicableModel",
|
|
@@ -26,6 +26,16 @@ export default class HelptextAttributeModel extends LabelAttributeModel {
|
|
|
26
26
|
* Get helptext text
|
|
27
27
|
*/
|
|
28
28
|
get text(): string | null {
|
|
29
|
-
|
|
29
|
+
const dataText = this.getData("value");
|
|
30
|
+
if (dataText) {
|
|
31
|
+
return dataText.message ?? dataText;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const contributionText = this.getContribution("text");
|
|
35
|
+
if (contributionText) {
|
|
36
|
+
return contributionText.message ?? contributionText;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return null;
|
|
30
40
|
}
|
|
31
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/HelptextAttributeModel.js"],"names":["HelptextAttributeModel","getContribution","contributions","type","readonly","LabelAttributeModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;;;;;AAEA;AACA;AACA;IACqBA,sB;;;;;;;;;;;;;AAUnB;AACF;AACE,mBAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;AACA;;;;SACE,eAA0B;AACxB,
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/HelptextAttributeModel.js"],"names":["HelptextAttributeModel","dataText","getData","message","contributionText","getContribution","contributions","type","readonly","LabelAttributeModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;;;;;AAEA;AACA;AACA;IACqBA,sB;;;;;;;;;;;;;AAUnB;AACF;AACE,mBAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;AACA;;;;SACE,eAA0B;AACxB,UAAMC,QAAQ,GAAG,KAAKC,OAAL,CAAa,OAAb,CAAjB;;AACA,UAAID,QAAJ,EAAc;AAAA;;AACZ,oCAAOA,QAAQ,CAACE,OAAhB,iEAA2BF,QAA3B;AACD;;AAED,UAAMG,gBAAgB,GAAG,KAAKC,eAAL,CAAqB,MAArB,CAAzB;;AACA,UAAID,gBAAJ,EAAsB;AAAA;;AACpB,wCAAOA,gBAAgB,CAACD,OAAxB,yEAAmCC,gBAAnC;AACD;;AAED,aAAO,IAAP;AACD;;;;AA9BD;AACF;AACE,+BAAyBE,aAAzB,EAAyD;AACvD,aACEA,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCD,aAAa,CAACE,QAAd,IAA0B,kBAAIF,aAAJ,EAAmB,MAAnB,CAF7B;AAID;;;EARiDG,6B","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport LabelAttributeModel from \"./LabelAttributeModel\";\n\n/**\n * Helptext attribute\n */\nexport default class HelptextAttributeModel extends LabelAttributeModel {\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type === \"helptext\" ||\n (contributions.readonly && has(contributions, \"text\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"helptext\";\n }\n\n /**\n * Get helptext text\n */\n get text(): string | null {\n const dataText = this.getData(\"value\");\n if (dataText) {\n return dataText.message ?? dataText;\n }\n\n const contributionText = this.getContribution(\"text\");\n if (contributionText) {\n return contributionText.message ?? contributionText;\n }\n\n return null;\n }\n}\n"],"file":"HelptextAttributeModel.js"}
|
|
@@ -2,6 +2,12 @@ import AttributeContent from "../AttributeContent";
|
|
|
2
2
|
import SectionModel from "../../content/SectionModel";
|
|
3
3
|
|
|
4
4
|
const json = {
|
|
5
|
+
header: {
|
|
6
|
+
label: "Header label",
|
|
7
|
+
description: {
|
|
8
|
+
message: "Dit is de beschrijving",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
5
11
|
label: "Blaastest geslaagd",
|
|
6
12
|
elements: [
|
|
7
13
|
{
|
|
@@ -38,7 +44,7 @@ const json = {
|
|
|
38
44
|
{
|
|
39
45
|
type: "Description",
|
|
40
46
|
label: "Description",
|
|
41
|
-
text: "Dit is een text fragment",
|
|
47
|
+
text: { message: "Dit is een text fragment" },
|
|
42
48
|
},
|
|
43
49
|
],
|
|
44
50
|
},
|
|
@@ -147,6 +153,8 @@ describe("AttributeContent", () => {
|
|
|
147
153
|
it("Handles basic content elements", () => {
|
|
148
154
|
const content = new AttributeContent(json);
|
|
149
155
|
expect(content.label).toBe("Blaastest geslaagd");
|
|
156
|
+
expect(content.header.label).toBe("Header label");
|
|
157
|
+
expect(content.header.description).toBe("Dit is de beschrijving");
|
|
150
158
|
expect(content.properties).toHaveLength(2);
|
|
151
159
|
expect(content.textfragments).toHaveLength(1);
|
|
152
160
|
expect(content.sections).toHaveLength(1);
|
|
@@ -218,6 +226,6 @@ describe("AttributeContent", () => {
|
|
|
218
226
|
it("can retrieve all content", () => {
|
|
219
227
|
const content = new AttributeContent(json);
|
|
220
228
|
|
|
221
|
-
expect(content.
|
|
229
|
+
expect(content.elements).toHaveLength(4);
|
|
222
230
|
});
|
|
223
231
|
});
|
|
@@ -499,18 +499,20 @@ describe("attributeDataHelper", () => {
|
|
|
499
499
|
key: "results",
|
|
500
500
|
content: {
|
|
501
501
|
InvestigationNecessary: {
|
|
502
|
+
header: {
|
|
503
|
+
label: "label",
|
|
504
|
+
description: "description",
|
|
505
|
+
},
|
|
502
506
|
elements: [
|
|
503
507
|
{
|
|
504
508
|
textFragmentElement: {
|
|
505
509
|
label: "Text fragment: Description",
|
|
506
510
|
textfragments: [
|
|
507
511
|
{
|
|
508
|
-
type: "Description",
|
|
509
|
-
label: "Description",
|
|
510
512
|
text: "Text fragment for investigation necessary",
|
|
511
513
|
},
|
|
512
514
|
],
|
|
513
|
-
|
|
515
|
+
layouthint: ["full"],
|
|
514
516
|
},
|
|
515
517
|
},
|
|
516
518
|
],
|
|
@@ -536,6 +538,10 @@ describe("attributeDataHelper", () => {
|
|
|
536
538
|
expect(firstChild.dynamicschemaId).toBe("results.InvestigationNecessary");
|
|
537
539
|
expect(firstChild.key).toBe("InvestigationNecessary");
|
|
538
540
|
expect(firstChild.value).toBe(true);
|
|
541
|
+
expect(firstChild.content.header).toStrictEqual({
|
|
542
|
+
label: "label",
|
|
543
|
+
description: "description",
|
|
544
|
+
});
|
|
539
545
|
expect(firstChild.content.elements).toHaveLength(1);
|
|
540
546
|
|
|
541
547
|
expect(firstChild.dynamicschema).toBeUndefined();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import HelptextAttributeModel from "../HelptextAttributeModel";
|
|
2
2
|
|
|
3
3
|
describe("helptextAttributeModel", () => {
|
|
4
|
-
it("should be able to create
|
|
4
|
+
it("should be able to create a HelptextAttribute object", () => {
|
|
5
5
|
const attribute = new HelptextAttributeModel();
|
|
6
6
|
|
|
7
7
|
expect(attribute).toBeInstanceOf(HelptextAttributeModel);
|
|
@@ -15,4 +15,42 @@ describe("helptextAttributeModel", () => {
|
|
|
15
15
|
|
|
16
16
|
expect(attributeWithText.text).toBe("Example helptext text");
|
|
17
17
|
});
|
|
18
|
+
|
|
19
|
+
it("should be able to handle content in data", () => {
|
|
20
|
+
const attributeWithText = new HelptextAttributeModel(
|
|
21
|
+
{
|
|
22
|
+
key: "CarDetails",
|
|
23
|
+
value: {
|
|
24
|
+
id: "CarDetails.text",
|
|
25
|
+
properties: {
|
|
26
|
+
PersonPrivateCar: "Ferrari GTO",
|
|
27
|
+
PersonLessFavoriteCars: "Mercedes",
|
|
28
|
+
PersonFavoriteCars: "BMW 5 Series, Fiat Panda",
|
|
29
|
+
},
|
|
30
|
+
message:
|
|
31
|
+
"<p>Currently the person drives in a Ferrari GTO, although his favorite cars are BMW 5 Series, Fiat Panda. Less favorite cars of the person are Mercedes.</p>",
|
|
32
|
+
},
|
|
33
|
+
static: true,
|
|
34
|
+
dynamicschemaId: "CarDetails",
|
|
35
|
+
isResult: false,
|
|
36
|
+
children: [],
|
|
37
|
+
content: null,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "string",
|
|
41
|
+
label: "Car details",
|
|
42
|
+
mandatory: false,
|
|
43
|
+
readonly: true,
|
|
44
|
+
text: {
|
|
45
|
+
id: "CarDetails.text",
|
|
46
|
+
message:
|
|
47
|
+
"<p>Currently the person drives in a ${PersonPrivateCar}, although his favorite cars are ${PersonFavoriteCars}. Less favorite cars of the person are ${PersonLessFavoriteCars}.</p>",
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
expect(attributeWithText.text).toBe(
|
|
53
|
+
"<p>Currently the person drives in a Ferrari GTO, although his favorite cars are BMW 5 Series, Fiat Panda. Less favorite cars of the person are Mercedes.</p>"
|
|
54
|
+
);
|
|
55
|
+
});
|
|
18
56
|
});
|
|
@@ -9,12 +9,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
13
|
-
|
|
14
12
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
15
13
|
|
|
16
14
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
17
15
|
|
|
16
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
17
|
+
|
|
18
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
19
19
|
|
|
20
20
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
@@ -122,6 +122,7 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
122
122
|
return this.attributeCollection.getAttributeByLayoutHint(_LayoutHints.TITLE);
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
|
+
* Retrieve the case label, this can be configured with a case property with the layout hint 'title'
|
|
125
126
|
*/
|
|
126
127
|
|
|
127
128
|
}, {
|
|
@@ -129,6 +130,15 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
129
130
|
get: function get() {
|
|
130
131
|
return this.casename ? this.casename.value : "";
|
|
131
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Retrieve the label that was configured on the caseview
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
}, {
|
|
138
|
+
key: "viewLabel",
|
|
139
|
+
get: function get() {
|
|
140
|
+
return this.getContribution("label", "");
|
|
141
|
+
}
|
|
132
142
|
/**
|
|
133
143
|
* Check if an introtext exists for this caseview
|
|
134
144
|
*/
|
|
@@ -145,16 +155,20 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
145
155
|
}, {
|
|
146
156
|
key: "introtext",
|
|
147
157
|
get: function get() {
|
|
148
|
-
if (this.
|
|
149
|
-
var
|
|
158
|
+
if (this.data._text) {
|
|
159
|
+
var _this$data$_text$mess;
|
|
150
160
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
161
|
+
return (_this$data$_text$mess = this.data._text.message) !== null && _this$data$_text$mess !== void 0 ? _this$data$_text$mess : this.data._text;
|
|
162
|
+
}
|
|
154
163
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
164
|
+
if (this.contributions.text) {
|
|
165
|
+
var _this$contributions$t;
|
|
166
|
+
|
|
167
|
+
return (_this$contributions$t = this.contributions.text.message) !== null && _this$contributions$t !== void 0 ? _this$contributions$t : this.contributions.text;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (Array.isArray(this.contributions.texts)) {
|
|
171
|
+
return this.contributions.texts[0].text;
|
|
158
172
|
}
|
|
159
173
|
|
|
160
174
|
return "";
|
|
@@ -180,15 +194,15 @@ var CaseViewModel = /*#__PURE__*/function (_DetailModel) {
|
|
|
180
194
|
}, {
|
|
181
195
|
key: "createTaskGroupCollection",
|
|
182
196
|
value: function createTaskGroupCollection() {
|
|
183
|
-
var
|
|
197
|
+
var _context;
|
|
184
198
|
|
|
185
199
|
var allTaskgroupData = this.getData("taskgroups", []);
|
|
186
200
|
var allTaskgroupContributions = this.getContribution("taskgroups", []);
|
|
187
|
-
this.taskGroupCollection = (0, _map.default)(
|
|
201
|
+
this.taskGroupCollection = (0, _map.default)(_context = (0, _filter.default)(allTaskgroupData).call(allTaskgroupData, function (taskgroup) {
|
|
188
202
|
return allTaskgroupContributions.some(function (taskgroupContribution) {
|
|
189
203
|
return taskgroupContribution.name === taskgroup.name;
|
|
190
204
|
});
|
|
191
|
-
})).call(
|
|
205
|
+
})).call(_context, function (taskgroup) {
|
|
192
206
|
var taskgroupContributions = (0, _find.default)(allTaskgroupContributions).call(allTaskgroupContributions, function (taskgroupContribution) {
|
|
193
207
|
return taskgroupContribution.name === taskgroup.name;
|
|
194
208
|
});
|