@beinformed/ui 1.21.2 → 1.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/esm/models/attributes/AttributeModel.js +2 -2
  3. package/esm/models/attributes/AttributeModel.js.map +1 -1
  4. package/esm/models/attributes/ChoiceAttributeModel.js +2 -1
  5. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  6. package/esm/models/attributes/DatetimeAttributeModel.js +2 -1
  7. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  8. package/esm/models/error/ErrorCollection.js +7 -6
  9. package/esm/models/error/ErrorCollection.js.map +1 -1
  10. package/esm/models/error/ErrorModel.js +2 -1
  11. package/esm/models/error/ErrorModel.js.map +1 -1
  12. package/esm/models/error/ErrorResponse.js +11 -5
  13. package/esm/models/error/ErrorResponse.js.map +1 -1
  14. package/esm/models/form/FormModel.js +5 -4
  15. package/esm/models/form/FormModel.js.map +1 -1
  16. package/esm/models/form/FormObjectModel.js +1 -1
  17. package/esm/models/form/FormObjectModel.js.map +1 -1
  18. package/esm/models/types.js.map +1 -1
  19. package/lib/models/attributes/AttributeModel.js +2 -2
  20. package/lib/models/attributes/AttributeModel.js.flow +2 -0
  21. package/lib/models/attributes/AttributeModel.js.map +1 -1
  22. package/lib/models/attributes/ChoiceAttributeModel.js +2 -1
  23. package/lib/models/attributes/ChoiceAttributeModel.js.flow +2 -2
  24. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  25. package/lib/models/attributes/DatetimeAttributeModel.js +2 -1
  26. package/lib/models/attributes/DatetimeAttributeModel.js.flow +2 -2
  27. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  28. package/lib/models/error/ErrorCollection.js +7 -5
  29. package/lib/models/error/ErrorCollection.js.flow +6 -3
  30. package/lib/models/error/ErrorCollection.js.map +1 -1
  31. package/lib/models/error/ErrorModel.js +2 -1
  32. package/lib/models/error/ErrorModel.js.flow +5 -2
  33. package/lib/models/error/ErrorModel.js.map +1 -1
  34. package/lib/models/error/ErrorResponse.js +11 -5
  35. package/lib/models/error/ErrorResponse.js.flow +4 -4
  36. package/lib/models/error/ErrorResponse.js.map +1 -1
  37. package/lib/models/form/FormModel.js +5 -3
  38. package/lib/models/form/FormModel.js.flow +8 -1
  39. package/lib/models/form/FormModel.js.map +1 -1
  40. package/lib/models/form/FormObjectModel.js +1 -1
  41. package/lib/models/form/FormObjectModel.js.flow +1 -0
  42. package/lib/models/form/FormObjectModel.js.map +1 -1
  43. package/lib/models/types.js.flow +1 -1
  44. package/lib/models/types.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/models/attributes/AttributeModel.js +2 -0
  47. package/src/models/attributes/ChoiceAttributeModel.js +2 -2
  48. package/src/models/attributes/DatetimeAttributeModel.js +2 -2
  49. package/src/models/error/ErrorCollection.js +6 -3
  50. package/src/models/error/ErrorModel.js +5 -2
  51. package/src/models/error/ErrorResponse.js +4 -4
  52. package/src/models/form/FormModel.js +8 -1
  53. package/src/models/form/FormObjectModel.js +1 -0
  54. package/src/models/types.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint?: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
@@ -714,7 +714,7 @@ class AttributeModel extends _BaseModel.default {
714
714
 
715
715
 
716
716
  addServerError(error) {
717
- this._errorCollection.addServerError(error.id, error.message, error.properties);
717
+ this._errorCollection.addServerError(error.id, error.layouthint, error.message, error.properties);
718
718
  }
719
719
  /**
720
720
  */
@@ -802,7 +802,7 @@ class AttributeModel extends _BaseModel.default {
802
802
  this.resetErrors();
803
803
  (0, _filter.default)(errors).call(errors, error => error.id !== "Constraint.Mandatory" || !this.hasValue()).forEach(error => {
804
804
  if (this.hasValue()) {
805
- this._errorCollection.addServerError(error.id, error.message, this.formatParameters(error.properties));
805
+ this._errorCollection.addServerError(error.id, error.layouthint, error.message, this.formatParameters(error.properties));
806
806
  } else {
807
807
  this.addServerConstraint(error.id, error.message, this.formatParameters(error.properties));
808
808
  }
@@ -710,6 +710,7 @@ export default class AttributeModel
710
710
  addServerError(error: FormErrorAnchor) {
711
711
  this._errorCollection.addServerError(
712
712
  error.id,
713
+ error.layouthint,
713
714
  error.message,
714
715
  error.properties
715
716
  );
@@ -812,6 +813,7 @@ export default class AttributeModel
812
813
  if (this.hasValue()) {
813
814
  this._errorCollection.addServerError(
814
815
  error.id,
816
+ error.layouthint,
815
817
  error.message,
816
818
  this.formatParameters(error.properties)
817
819
  );
@@ -1 +1 @@
1
- {"version":3,"file":"AttributeModel.js","names":["AttributeModel","BaseModel","constructor","attribute","attributeContributions","ConstraintCollection","getSetting","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","DISABLED","_errorCollection","ErrorCollection","message","addServerError","id","parameters","_referenceDate","getData","DateUtil","now","_isResult","_mandatory","MANDATORY","mandatory","_links","LinkCollection","isApplicableModel","isPlainObject","IllegalArgumentException","getInitialChildModelLinks","hasContentConfiguration","conceptLink","setChildModels","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","parentKey","_parentKey","name","type","_hasContentConfiguration","indicateContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","getContentConfiguredLabel","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","firstConfiguredLabel","configuredLabelProperty","some","_id","defaultAlignment","alignment","alignmentHints","getByLayoutHint","substring","links","downloadLink","getLinksByGroup","first","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","referenceDate","isCacheable","_concept","ConceptDetailModel","date","initvalue","getInputValue","inputvalue","toString","validateValue","validate","hasValue","getValue","getFormData","inError","formdata","getEmptyFormData","updateLastModification","formatValue","readonlyvalue","configuredMandatory","_validatedValue","readonly","_readonly","static","isResult","disabled","format","getContribution","formatLabel","minLength","maxLength","operator","assistantMessage","isValid","constraintCollection","constraints","add","_serverConstraints","MandatoryConstraint","StringLengthConstraint","addConstraints","setUseClientsideValidation","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","undefined","errorCollection","collection","invalidConstraints","isChangedSince","resetErrors","error","properties","removeServerError","hasServerErrors","serverErrors","hasErrors","hasItems","addMissingError","removeMissingError","addServerConstraint","defaultMessage","addConstraint","formatParameters","params","forEach","paramKey","paramValue","hasDynamicValidationData","updateValidations","errors","_lastModification","Date","timestamp","reset","UnsupportedOperationException","mergeAttribute","oldAttribute","update","changedAttribute","isEditable","_isEditable","isVisible","_isHidden","isHidden","show","hide","equals","otherAttribute","readonlyWidth","ATTRIBUTE_WIDTH","MEDIUM","layoutHintRules","_layoutHintRules","rules","processLayoutHintRules","attributes","process","hasAllContentInData","AttributeContent"],"sources":["../../../src/models/attributes/AttributeModel.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { DISABLED, MANDATORY } from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting, hasAllContentInData } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type {\n AttributeType,\n FormErrorAnchor,\n IModelWithChildModels,\n ModularUIModel,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters\n );\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\n .filter(\n (error) => error.id !== \"Constraint.Mandatory\" || !this.hasValue()\n )\n .forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties)\n );\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 /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;AACF;AACA;;;EACe,IAATC,SAAS,GAAY;IACvB,OAAO,CAAC,KAAKC,SAAb;EACD;EAED;AACF;;;EACc,IAARC,QAAQ,GAAY;IACtB,OAAO,KAAKD,SAAZ;EACD;EAED;AACF;;;EACc,IAARC,QAAQ,CAACA,QAAD,EAAoB;IAC9B,KAAKD,SAAL,GAAiBC,QAAjB;EACD;EAED;AACF;AACA;;;EACEC,IAAI,GAAG;IACL,KAAKD,QAAL,GAAgB,KAAhB;EACD;EAED;AACF;;;EACEE,IAAI,GAAG;IACL,KAAKF,QAAL,GAAgB,IAAhB;EACD;EAED;AACF;;;EACEG,MAAM,CAACC,cAAD,EAAyC;IAC7C,OACE,KAAKlI,GAAL,KAAakI,cAAc,CAAClI,GAA5B,IACA,KAAKC,SAAL,KAAmBiI,cAAc,CAACjI,SAFpC;EAID;EAED;AACF;AACA;;;EACmB,IAAbkI,aAAa,GAAkC;IACjD,OAAOC,0BAAA,CAAgBC,MAAvB;EACD;EAED;AACF;;;EACqB,IAAfC,eAAe,GAA6B;IAC9C,OAAO,KAAKC,gBAAZ;EACD;EAED;AACF;;;EACqB,IAAfD,eAAe,CAACE,KAAD,EAAkC;IACnD,KAAKD,gBAAL,GAAwBC,KAAxB;EACD;EAED;AACF;;;EACEC,sBAAsB,CAACC,UAAD,EAAkC;IACtD,IAAI,KAAKH,gBAAT,EAA2B;MACzB,KAAKD,eAAL,CAAqBK,OAArB,CAA6B,IAA7B,EAAmCD,UAAnC;IACD;EACF;EAED;AACF;AACA;;;EACwB,IAAlBvL,kBAAkB,GAAY;IAChC,OAAO,IAAAyL,6BAAA,GAAP;EACD;EAED;AACF;;;EACa,IAAPxL,OAAO,GAAqB;IAC9B,OAAO,IAAIyL,yBAAJ,CAAqB,KAAKpL,IAAL,CAAUL,OAA/B,CAAP;EACD;;AA75BH"}
1
+ {"version":3,"file":"AttributeModel.js","names":["AttributeModel","BaseModel","constructor","attribute","attributeContributions","ConstraintCollection","getSetting","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","DISABLED","_errorCollection","ErrorCollection","message","addServerError","id","parameters","_referenceDate","getData","DateUtil","now","_isResult","_mandatory","MANDATORY","mandatory","_links","LinkCollection","isApplicableModel","isPlainObject","IllegalArgumentException","getInitialChildModelLinks","hasContentConfiguration","conceptLink","setChildModels","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","parentKey","_parentKey","name","type","_hasContentConfiguration","indicateContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","getContentConfiguredLabel","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","firstConfiguredLabel","configuredLabelProperty","some","_id","defaultAlignment","alignment","alignmentHints","getByLayoutHint","substring","links","downloadLink","getLinksByGroup","first","getLinkByKey","addParameter","TIMEVERSION_FILTER_NAME","referenceDate","isCacheable","_concept","ConceptDetailModel","date","initvalue","getInputValue","inputvalue","toString","validateValue","validate","hasValue","getValue","getFormData","inError","formdata","getEmptyFormData","updateLastModification","formatValue","readonlyvalue","configuredMandatory","_validatedValue","readonly","_readonly","static","isResult","disabled","format","getContribution","formatLabel","minLength","maxLength","operator","assistantMessage","isValid","constraintCollection","constraints","add","_serverConstraints","MandatoryConstraint","StringLengthConstraint","addConstraints","setUseClientsideValidation","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","undefined","errorCollection","collection","invalidConstraints","isChangedSince","resetErrors","error","properties","removeServerError","hasServerErrors","serverErrors","hasErrors","hasItems","addMissingError","removeMissingError","addServerConstraint","defaultMessage","addConstraint","formatParameters","params","forEach","paramKey","paramValue","hasDynamicValidationData","updateValidations","errors","_lastModification","Date","timestamp","reset","UnsupportedOperationException","mergeAttribute","oldAttribute","update","changedAttribute","isEditable","_isEditable","isVisible","_isHidden","isHidden","show","hide","equals","otherAttribute","readonlyWidth","ATTRIBUTE_WIDTH","MEDIUM","layoutHintRules","_layoutHintRules","rules","processLayoutHintRules","attributes","process","hasAllContentInData","AttributeContent"],"sources":["../../../src/models/attributes/AttributeModel.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { DISABLED, MANDATORY } from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting, hasAllContentInData } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type {\n AttributeType,\n FormErrorAnchor,\n IModelWithChildModels,\n ModularUIModel,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters\n );\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.layouthint,\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\n .filter(\n (error) => error.id !== \"Constraint.Mandatory\" || !this.hasValue()\n )\n .forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.layouthint,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAKA;;AAEA;;AAiBA;;AAEA;AACA;AACA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;EACD;EAED;AACF;;;EACc,IAARC,QAAQ,CAACA,QAAD,EAAoB;IAC9B,KAAKD,SAAL,GAAiBC,QAAjB;EACD;EAED;AACF;AACA;;;EACEC,IAAI,GAAG;IACL,KAAKD,QAAL,GAAgB,KAAhB;EACD;EAED;AACF;;;EACEE,IAAI,GAAG;IACL,KAAKF,QAAL,GAAgB,IAAhB;EACD;EAED;AACF;;;EACEG,MAAM,CAACC,cAAD,EAAyC;IAC7C,OACE,KAAKlI,GAAL,KAAakI,cAAc,CAAClI,GAA5B,IACA,KAAKC,SAAL,KAAmBiI,cAAc,CAACjI,SAFpC;EAID;EAED;AACF;AACA;;;EACmB,IAAbkI,aAAa,GAAkC;IACjD,OAAOC,0BAAA,CAAgBC,MAAvB;EACD;EAED;AACF;;;EACqB,IAAfC,eAAe,GAA6B;IAC9C,OAAO,KAAKC,gBAAZ;EACD;EAED;AACF;;;EACqB,IAAfD,eAAe,CAACE,KAAD,EAAkC;IACnD,KAAKD,gBAAL,GAAwBC,KAAxB;EACD;EAED;AACF;;;EACEC,sBAAsB,CAACC,UAAD,EAAkC;IACtD,IAAI,KAAKH,gBAAT,EAA2B;MACzB,KAAKD,eAAL,CAAqBK,OAArB,CAA6B,IAA7B,EAAmCD,UAAnC;IACD;EACF;EAED;AACF;AACA;;;EACwB,IAAlBvL,kBAAkB,GAAY;IAChC,OAAO,IAAAyL,6BAAA,GAAP;EACD;EAED;AACF;;;EACa,IAAPxL,OAAO,GAAqB;IAC9B,OAAO,IAAIyL,yBAAJ,CAAqB,KAAKpL,IAAL,CAAUL,OAA/B,CAAP;EACD;;AA/5BH"}
@@ -404,6 +404,7 @@ class ChoiceAttributeModel extends _AttributeModel.default {
404
404
  addServerError(error) {
405
405
  const {
406
406
  id,
407
+ layouthint,
407
408
  message,
408
409
  properties
409
410
  } = error;
@@ -420,7 +421,7 @@ class ChoiceAttributeModel extends _AttributeModel.default {
420
421
  }
421
422
  }
422
423
 
423
- this._errorCollection.addServerError(id, message, properties);
424
+ this._errorCollection.addServerError(id, layouthint, message, properties);
424
425
  }
425
426
  /**
426
427
  */
@@ -396,7 +396,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
396
396
  * Registers an error that was received from a server response
397
397
  */
398
398
  addServerError(error: FormErrorAnchor) {
399
- const { id, message, properties } = error;
399
+ const { id, layouthint, message, properties } = error;
400
400
 
401
401
  const ANSWER_OPTION_KEY = "answer-option-key";
402
402
 
@@ -412,7 +412,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
412
412
  }
413
413
  }
414
414
 
415
- this._errorCollection.addServerError(id, message, properties);
415
+ this._errorCollection.addServerError(id, layouthint, message, properties);
416
416
  }
417
417
 
418
418
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceAttributeModel.js","names":["ChoiceAttributeModel","AttributeModel","constructor","attribute","attributeContributions","_referenceDate","getData","DateUtil","now","_options","ChoiceAttributeOptionCollection","create","referenceDate","layouthint","has","SORT_OPTIONS","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","conceptLinkHref","href","concept","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","option","code","readonlyvalue","join","initvalue","Array","isArray","_initvalue","length","getValue","hasValue","getInputValue","toggleOption","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","opt","choicetype","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","ChoiceAttributeOptionModel","equals","add","toString","_hasContentConfiguration","contentConfiguration","content","optionElements","optionElementConfig","optionElement","contentElement","RENDER_SECTION_LABEL","ContentConfigurationElements","placeholder","addServerError","error","id","message","properties","ANSWER_OPTION_KEY","optionKey","foundOption","getContentConfiguredLabel","_errorCollection","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","MEDIUM"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref)\n );\n }\n\n this.options.setChildModels(models);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\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: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(oldAttribute: AttributeType) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(oldAttribute.options, this.type === \"lookup\");\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (val instanceof ChoiceAttributeOptionModel) {\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n }\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"lookup\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAIA;;AAKA;AACA;AACA;AACe,MAAMA,oBAAN,SAAmCC,uBAAnC,CAAkD;EAK/D;AACF;AACA;EACEC,WAAW,CAACC,SAAD,EAAoBC,sBAApB,EAAoD;IAC7D,MAAMD,SAAN,EAAiBC,sBAAjB;IAD6D;IAAA;IAAA;IAG7D,KAAKC,cAAL,GAAsB,KAAKC,OAAL,CAAa,eAAb,EAA8BC,sBAAA,CAASC,GAAT,EAA9B,CAAtB;IACA,KAAKC,QAAL,GAAgBC,wCAAA,CAAgCC,MAAhC,CACdR,SADc,EAEdC,sBAFc,EAGd,KAAKQ,aAHS,CAAhB;;IAMA,IAAI,KAAKC,UAAL,CAAgBC,GAAhB,CAAoBC,yBAApB,CAAJ,EAAuC;MACrC,KAAKN,QAAL,CAAcO,WAAd,GAA4B,IAA5B;IACD;EACF;EAED;AACF;;;EAC0B,OAAjBC,iBAAiB,CAACC,aAAD,EAAiC;IACvD,OACEA,aAAa,CAACC,IAAd,KAAuB,WAAvB,IACAD,aAAa,CAACC,IAAd,KAAuB,SADvB,KAECD,aAAa,CAACC,IAAd,KAAuB,QAAvB,IACCD,aAAa,CAACC,IAAd,KAAuB,OADxB,IAEC,IAAAL,YAAA,EAAII,aAAJ,EAAmB,YAAnB,CAFD,IAGC,IAAAJ,YAAA,EAAII,aAAJ,EAAmB,SAAnB,CALF,CADF;EAQD;EAED;AACF;;;E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B,EAAuC;QACrC,OAAO;UACLC,cAAc,EAAE,EACd,GAAGD,aAAa,CAACC,cADH;YAEdnF,UAAU,EAAE,CAACoF,iCAAD;UAFE;QADX,CAAP;MAMD;;MAED,OAAOF,aAAP;IACD,CAZyB,CAA5B;IAeA,OAAO,IAAIG,qCAAJ,CAAiCJ,mBAAjC,CAAP;EACD;EAED;AACF;AACA;;;EACiB,IAAXK,WAAW,GAAW;IACxB,OAAO,KAAK9E,eAAL,CAAqB,aAArB,EAAoC,EAApC,CAAP;EACD;EAED;AACF;AACA;;;EACE+E,cAAc,CAACC,KAAD,EAAyB;IACrC,MAAM;MAAEC,EAAF;MAAMC,OAAN;MAAeC;IAAf,IAA8BH,KAApC;IAEA,MAAMI,iBAAiB,GAAG,mBAA1B;;IAEA,IAAID,UAAU,IAAI,IAAA1F,YAAA,EAAI0F,UAAJ,EAAgBC,iBAAhB,CAAlB,EAAsD;MAAA;;MACpD,MAAMC,SAAS,GAAGF,UAAU,CAACC,iBAAD,CAA5B;MACA,MAAME,WAAW,GAAG,oCAAK5E,OAAL,kBACjBe,MAAD,IAAYA,MAAM,CAACC,IAAP,KAAgB2D,SADV,CAApB;;MAGA,IAAIC,WAAJ,EAAiB;QACfH,UAAU,CAACC,iBAAD,CAAV,GAAgCE,WAAW,CAACC,yBAAZ,CAC9B,KAAKjB,oBADyB,CAAhC;MAGD;IACF;;IAED,KAAKkB,gBAAL,CAAsBT,cAAtB,CAAqCE,EAArC,EAAyCC,OAAzC,EAAkDC,UAAlD;EACD;EAED;AACF;;;EACmB,IAAbM,aAAa,GAAkC;IACjD,IAAI,KAAK3F,IAAL,KAAc,QAAlB,EAA4B;MAC1B,OAAO4F,0BAAA,CAAgBC,KAAvB;IACD;;IAED,OAAOD,0BAAA,CAAgBE,MAAvB;EACD;;AApZ8D"}
1
+ {"version":3,"file":"ChoiceAttributeModel.js","names":["ChoiceAttributeModel","AttributeModel","constructor","attribute","attributeContributions","_referenceDate","getData","DateUtil","now","_options","ChoiceAttributeOptionCollection","create","referenceDate","layouthint","has","SORT_OPTIONS","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","conceptLinkHref","href","concept","model","selfhref","equalsWithParameters","getLinkByKey","lookupListLabel","lookupList","label","date","selected","option","code","readonlyvalue","join","initvalue","Array","isArray","_initvalue","length","getValue","hasValue","getInputValue","toggleOption","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","opt","choicetype","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","readonly","mergeOptions","isValid","update","value","updateLastModification","values","split","forEach","val","ChoiceAttributeOptionModel","equals","add","toString","_hasContentConfiguration","contentConfiguration","content","optionElements","optionElementConfig","optionElement","contentElement","RENDER_SECTION_LABEL","ContentConfigurationElements","placeholder","addServerError","error","id","message","properties","ANSWER_OPTION_KEY","optionKey","foundOption","getContentConfiguredLabel","_errorCollection","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","MEDIUM"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport type { ModularUIModel, AttributeType, FormErrorAnchor } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n this.referenceDate\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref)\n );\n }\n\n this.options.setChildModels(models);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupOptions\");\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\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: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(oldAttribute: AttributeType) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(oldAttribute.options, this.type === \"lookup\");\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values;\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else {\n values = [value];\n }\n values.forEach((val) => {\n if (val instanceof ChoiceAttributeOptionModel) {\n if (!this.options.some((option) => option.equals(val))) {\n this.options.add(val);\n }\n\n this.toggleOption(val.code);\n } else if (\n typeof val === \"string\" &&\n this.options.some((option) => option.code.toString() === val)\n ) {\n this.toggleOption(val);\n }\n });\n\n return this;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n }\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, layouthint, message, properties } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration\n );\n }\n }\n\n this._errorCollection.addServerError(id, layouthint, message, properties);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"lookup\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAIA;;AAKA;AACA;AACA;AACe,MAAMA,oBAAN,SAAmCC,uBAAnC,CAAkD;EAK/D;AACF;AACA;EACEC,WAAW,CAACC,SAAD,EAAoBC,sBAApB,EAAoD;IAC7D,MAAMD,SAAN,EAAiBC,sBA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,EAAI0F,UAAJ,EAAgBC,iBAAhB,CAAlB,EAAsD;MAAA;;MACpD,MAAMC,SAAS,GAAGF,UAAU,CAACC,iBAAD,CAA5B;MACA,MAAME,WAAW,GAAG,oCAAK5E,OAAL,kBACjBe,MAAD,IAAYA,MAAM,CAACC,IAAP,KAAgB2D,SADV,CAApB;;MAGA,IAAIC,WAAJ,EAAiB;QACfH,UAAU,CAACC,iBAAD,CAAV,GAAgCE,WAAW,CAACC,yBAAZ,CAC9B,KAAKjB,oBADyB,CAAhC;MAGD;IACF;;IAED,KAAKkB,gBAAL,CAAsBT,cAAtB,CAAqCE,EAArC,EAAyCzF,UAAzC,EAAqD0F,OAArD,EAA8DC,UAA9D;EACD;EAED;AACF;;;EACmB,IAAbM,aAAa,GAAkC;IACjD,IAAI,KAAK3F,IAAL,KAAc,QAAlB,EAA4B;MAC1B,OAAO4F,0BAAA,CAAgBC,KAAvB;IACD;;IAED,OAAOD,0BAAA,CAAgBE,MAAvB;EACD;;AApZ8D"}
@@ -466,6 +466,7 @@ class DatetimeAttributeModel extends _StringAttributeModel.default {
466
466
  addServerError(error) {
467
467
  const {
468
468
  id,
469
+ layouthint,
469
470
  message,
470
471
  properties
471
472
  } = error;
@@ -474,7 +475,7 @@ class DatetimeAttributeModel extends _StringAttributeModel.default {
474
475
  properties.format = this.formatLabel;
475
476
  }
476
477
 
477
- this._errorCollection.addServerError(id, message, properties);
478
+ this._errorCollection.addServerError(id, layouthint, message, properties);
478
479
  }
479
480
  /**
480
481
  */
@@ -425,12 +425,12 @@ class DatetimeAttributeModel extends StringAttributeModel {
425
425
  * Registers an error that was received from a server response
426
426
  */
427
427
  addServerError(error: FormErrorAnchor) {
428
- const { id, message, properties } = error;
428
+ const { id, layouthint, message, properties } = error;
429
429
  if (properties && has(properties, "format") && this.formatLabel) {
430
430
  properties.format = this.formatLabel;
431
431
  }
432
432
 
433
- this._errorCollection.addServerError(id, message, properties);
433
+ this._errorCollection.addServerError(id, layouthint, message, properties);
434
434
  }
435
435
 
436
436
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DatetimeAttributeModel.js","names":["PRODUCT_DEFAULT_DATE_FORMAT","DatetimeAttributeModel","StringAttributeModel","constructor","attribute","attributeContributions","updateInitValue","isApplicableModel","contributions","type","formatUtil","TimeUtil","TimestampUtil","DateTimeUtil","DateUtil","getInitValue","value","data","length","split","hasTime","getTimeValue","timeValue","timeInputFormat","toLowerCase","setHour","setMinute","setSecond","setMilliseconds","_initvalue","_inputvalue","getInitialInputValue","_value","initValue","toFormat","inputFormat","getContribution","getInputValue","toString","inputvalue","validate","toISO","format","convertFormat","operator","hasDate","formatLabel","dateInputFormat","ignoreFormatSetting","layouthint","has","IGNORE_FORMAT_SETTING","dateInputFormatSetting","getSetting","dateFormat","replace","dateReadonlyFormat","readonlyFormatSetting","placeholder","_placeholder","timeFormatParts","push","timeFormat","join","timeReadonlyFormat","dateInputValue","timeInputValue","formatValue","hasFormat","ISO_DATE_FORMAT","dateTimeReadonlyFormat","readonlyvalue","mindate","maxdate","addServerError","error","id","message","properties","_errorCollection","getFormatConstraint","DateTimeDateFormatConstraint","DateTimeTimeFormatConstraint","DatetimeFormatConstraint","addConstraints","constraints","ConstraintCollection","add","DateBoundaryConstraint","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","MEDIUM"],"sources":["../../../src/models/attributes/DatetimeAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport {\n DateUtil,\n DateTimeUtil,\n TimeUtil,\n TimestampUtil,\n} from \"../../utils/datetime/DateTimeUtil\";\n\nimport StringAttributeModel from \"./StringAttributeModel\";\n\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport DateTimeDateFormatConstraint from \"./input-constraints/DateTimeDateFormatConstraint\";\nimport DateTimeTimeFormatConstraint from \"./input-constraints/DateTimeTimeFormatConstraint\";\nimport DatetimeFormatConstraint from \"./input-constraints/DatetimeFormatConstraint\";\nimport DateBoundaryConstraint from \"./input-constraints/DateBoundaryConstraint\";\n\nimport { ATTRIBUTE_WIDTH, ISO_DATE_FORMAT } from \"../../constants\";\nimport { getSetting } from \"../../constants/Settings\";\nimport { IGNORE_FORMAT_SETTING } from \"../../constants/LayoutHints\";\n\nimport type { FormErrorAnchor, IConstraintModel } from \"../types\";\n\n// date format of default\nconst PRODUCT_DEFAULT_DATE_FORMAT = \"dd-MM-yyyy\";\n\n/**\n */\nclass DatetimeAttributeModel extends StringAttributeModel {\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this.updateInitValue();\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return [\"date\", \"time\", \"datetime\", \"timestamp\"].includes(\n contributions.type\n );\n }\n\n /**\n */\n get formatUtil():\n | typeof TimeUtil\n | typeof TimestampUtil\n | typeof DateTimeUtil\n | typeof DateUtil {\n switch (this.type) {\n case \"time\":\n return TimeUtil;\n case \"timestamp\":\n return TimestampUtil;\n case \"datetime\":\n return DateTimeUtil;\n default:\n return DateUtil;\n }\n }\n\n /**\n */\n getInitValue(): string | null {\n let value = this.data.value;\n if (value != null) {\n if (this.type === \"time\" && value.length === 5) {\n value = `${value}:00`;\n }\n\n // handle old datetime values, which contained ms\n if (this.type === \"datetime\" && value.includes(\".\")) {\n value = value.split(\".\")[0];\n }\n\n if (this.hasTime) {\n value = this.getTimeValue(value);\n }\n }\n\n return value;\n }\n\n /**\n */\n getTimeValue(value: string): string {\n let timeValue = value;\n if (!this.timeInputFormat.toLowerCase().includes(\"h\")) {\n timeValue = this.formatUtil.setHour(value, 0);\n }\n if (!this.timeInputFormat.includes(\"m\")) {\n timeValue = this.formatUtil.setMinute(value, 0);\n }\n if (!this.timeInputFormat.includes(\"s\")) {\n timeValue = this.formatUtil.setSecond(value, 0);\n }\n if (this.type === \"timestamp\" && !this.timeInputFormat.includes(\"S\")) {\n timeValue = this.formatUtil.setMilliseconds(value, 0);\n }\n return timeValue;\n }\n\n /**\n * Set time in the correct value based on available elements in the time format\n */\n updateInitValue() {\n const value = this.getInitValue();\n if (value != null) {\n this._initvalue = value;\n this._inputvalue = this.getInitialInputValue(value);\n this._value = value;\n }\n }\n\n /**\n * Get initial user input value\n */\n getInitialInputValue(value?: string): string {\n if (!value) {\n return \"\";\n }\n\n let initValue = value;\n if (this.type === \"time\" && value.length === 5) {\n initValue = `${value}:00`;\n }\n\n return this.formatUtil.toFormat(initValue, this.inputFormat);\n }\n\n /**\n * Set type to date\n */\n get type(): string {\n return this.getContribution(\"type\", \"date\");\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 getInputValue(): string {\n return this._inputvalue ? this._inputvalue.toString() : \"\";\n }\n\n /**\n * Get input value\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this.validate(value);\n\n this._inputvalue = value;\n\n this.value =\n value !== null && value !== \"\"\n ? this.formatUtil.toISO(value, this.inputFormat)\n : null;\n }\n\n /**\n * Get date format\n */\n get format(): string {\n const format = this.getContribution(\"format\", \"\");\n return this.formatUtil.convertFormat(format);\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n */\n get hasDate(): boolean {\n return (\n this.type === \"date\" ||\n this.type === \"datetime\" ||\n this.type === \"timestamp\"\n );\n }\n\n /**\n */\n get hasTime(): boolean {\n return (\n this.type === \"time\" ||\n this.type === \"datetime\" ||\n this.type === \"timestamp\"\n );\n }\n\n /**\n */\n get formatLabel(): string {\n switch (this.type) {\n case \"date\":\n return this.dateInputFormat.toLowerCase();\n case \"time\":\n return this.timeInputFormat.toLowerCase();\n default:\n return this.format.toLowerCase();\n }\n }\n\n /**\n */\n get inputFormat(): string {\n if (this.hasDate && this.hasTime) {\n return `${this.dateInputFormat} ${this.timeInputFormat}`.trim();\n }\n\n if (this.hasDate) {\n return this.dateInputFormat;\n }\n\n if (this.hasTime) {\n return this.timeInputFormat;\n }\n\n return \"\";\n }\n\n /**\n */\n get dateInputFormat(): string {\n if (!this.hasDate) {\n return \"\";\n }\n\n // setting for date input\n const ignoreFormatSetting = this.layouthint.has(IGNORE_FORMAT_SETTING);\n if (!ignoreFormatSetting) {\n const dateInputFormatSetting = getSetting(\"DATE_INPUT_FORMAT\", \"\");\n if (dateInputFormatSetting) {\n return dateInputFormatSetting;\n }\n }\n\n let format = this.format;\n\n let dateFormat = this.hasTime\n ? format.replace(this.timeInputFormat, \"\").trim()\n : format;\n\n return dateFormat;\n }\n\n /**\n */\n get dateReadonlyFormat(): string {\n if (!this.hasDate) {\n return \"\";\n }\n\n let format = this.format;\n\n let dateFormat = this.hasTime\n ? format.replace(this.timeInputFormat, \"\").trim()\n : format;\n\n const readonlyFormatSetting = getSetting(\"DATE_READONLY_FORMAT\", \"\");\n\n if (dateFormat === PRODUCT_DEFAULT_DATE_FORMAT && readonlyFormatSetting) {\n dateFormat = readonlyFormatSetting;\n }\n\n return dateFormat;\n }\n\n /**\n * return attribute placeholder or, if DATE_INPUT_FORMAT setting is used, lowercased setting, otherwise return formatlabel without time input format from contributions\n */\n get placeholder(): string {\n if (this._placeholder !== \"\") {\n return this._placeholder;\n }\n\n const dateInputFormatSetting = getSetting(\"DATE_INPUT_FORMAT\", \"\");\n\n if (dateInputFormatSetting) {\n return dateInputFormatSetting.toLowerCase();\n }\n\n const formatLabel = this.getContribution(\"formatlabel\", \"\");\n\n if (this.hasDate && this.hasTime && formatLabel.includes(\" \")) {\n // return first part of formatlabel to keep placeholder matching date input\n return formatLabel.split(\" \")[0];\n }\n\n return formatLabel;\n }\n\n /**\n * Set placeholder text\n */\n set placeholder(placeholder: string) {\n this._placeholder = placeholder;\n }\n\n /**\n */\n get timeInputFormat(): string {\n if (!this.hasTime) {\n return \"\";\n }\n\n const format = this.format;\n\n let timeFormatParts = [];\n if (format.includes(\"H\")) {\n timeFormatParts.push(\"HH\");\n } else if (format.includes(\"h\")) {\n timeFormatParts.push(\"hh\");\n }\n if (format.includes(\"m\")) {\n timeFormatParts.push(\"mm\");\n }\n if (format.includes(\"s\")) {\n timeFormatParts.push(\"ss\");\n }\n\n let timeFormat = timeFormatParts.join(\":\");\n if (format.includes(\"S\")) {\n timeFormat = `${timeFormat}.SSS`;\n }\n if (format.includes(\"a\")) {\n return `${timeFormat} a`;\n }\n return timeFormat;\n }\n\n /**\n */\n get timeReadonlyFormat(): string {\n if (!this.hasTime) {\n return \"\";\n }\n\n return this.timeInputFormat;\n }\n\n /**\n */\n get dateInputValue(): string {\n return typeof this.value === \"string\" && this.dateInputFormat !== \"\"\n ? this.formatUtil.toFormat(this.value, this.dateInputFormat)\n : \"\";\n }\n\n /**\n */\n get timeInputValue(): string {\n return typeof this.value === \"string\" && this.timeInputFormat !== \"\"\n ? this.formatUtil.toFormat(this.value, this.timeInputFormat)\n : \"\";\n }\n\n // format value in readonly rendering\n /**\n */\n formatValue(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n // when the value is exactly an iso date, render as date\n if (\n (this.type === \"datetime\" || this.type === \"timestamp\") &&\n DateUtil.hasFormat(value, ISO_DATE_FORMAT)\n ) {\n return DateUtil.toFormat(value, this.dateReadonlyFormat);\n }\n\n if (this.hasDate && this.hasTime) {\n const dateTimeReadonlyFormat = `${this.dateReadonlyFormat} ${this.timeReadonlyFormat}`;\n return this.formatUtil.toFormat(value, dateTimeReadonlyFormat);\n }\n\n if (this.type === \"date\") {\n return this.formatUtil.toFormat(value, this.dateReadonlyFormat);\n }\n\n return this.formatUtil.toFormat(value, this.format);\n }\n\n /**\n * Retrieve readonly value, the date in the configurated format\n */\n get readonlyvalue(): string {\n if (typeof this.value === \"string\") {\n return this.formatValue(this.value.toString());\n }\n\n return \"\";\n }\n\n /**\n * Get minimum date\n */\n get mindate(): string | null {\n return this.getContribution(\"mindate\");\n }\n\n /**\n * Get maximum date\n */\n get maxdate(): string | null {\n return this.getContribution(\"maxdate\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties } = error;\n if (properties && has(properties, \"format\") && this.formatLabel) {\n properties.format = this.formatLabel;\n }\n\n this._errorCollection.addServerError(id, message, properties);\n }\n\n /**\n */\n getFormatConstraint(): IConstraintModel {\n switch (this.type) {\n case \"date\":\n return new DateTimeDateFormatConstraint(\n this.dateInputFormat,\n this.formatLabel\n );\n case \"time\":\n return new DateTimeTimeFormatConstraint(\n this.timeInputFormat,\n this.formatLabel\n );\n default:\n return new DatetimeFormatConstraint(\n this.type,\n this.inputFormat,\n this.formatLabel\n );\n }\n }\n\n /**\n * Add Date constraints for attribute\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this.getFormatConstraint());\n\n if (this.mindate || this.maxdate) {\n constraints.add(\n new DateBoundaryConstraint(\n this.type,\n this.mindate,\n this.maxdate,\n this.inputFormat\n )\n );\n }\n\n return constraints;\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"date\" || this.type === \"time\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n\nexport default DatetimeAttributeModel;\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AAOA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAIA;AACA,MAAMA,2BAA2B,GAAG,YAApC;AAEA;AACA;;AACA,MAAMC,sBAAN,SAAqCC,6BAArC,CAA0D;EACxD;AACF;EACEC,WAAW,CAACC,SAAD,EAAoBC,sBAApB,EAAoD;IAC7D,MAAMD,SAAN,EAAiBC,sBAAjB;IAEA,KAAKC,eAAL;EACD;EAED;AACF;;;EAC0B,OAAjBC,iBAAiB,CAACC,aAAD,EAAiC;IAAA;;IACvD,OAAO,mCAAC,MAAD,EAAS,MAAT,EAAiB,UAAjB,EAA6B,WAA7B,kBACLA,aAAa,CAACC,IADT,CAAP;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d,IAA2C,KAAKhC,WAApD,EAAiE;MAC/DgC,UAAU,CAACpC,MAAX,GAAoB,KAAKI,WAAzB;IACD;;IAED,KAAKiC,gBAAL,CAAsBL,cAAtB,CAAqCE,EAArC,EAAyCC,OAAzC,EAAkDC,UAAlD;EACD;EAED;AACF;;;EACEE,mBAAmB,GAAqB;IACtC,QAAQ,KAAKvE,IAAb;MACE,KAAK,MAAL;QACE,OAAO,IAAIwE,qCAAJ,CACL,KAAKlC,eADA,EAEL,KAAKD,WAFA,CAAP;;MAIF,KAAK,MAAL;QACE,OAAO,IAAIoC,qCAAJ,CACL,KAAK3D,eADA,EAEL,KAAKuB,WAFA,CAAP;;MAIF;QACE,OAAO,IAAIqC,iCAAJ,CACL,KAAK1E,IADA,EAEL,KAAK0B,WAFA,EAGL,KAAKW,WAHA,CAAP;IAZJ;EAkBD;EAED;AACF;AACA;;;EACEsC,cAAc,GAAyB;IACrC,MAAMC,WAAW,GAAG,IAAIC,6BAAJ,EAApB;IAEAD,WAAW,CAACE,GAAZ,CAAgB,KAAKP,mBAAL,EAAhB;;IAEA,IAAI,KAAKR,OAAL,IAAgB,KAAKC,OAAzB,EAAkC;MAChCY,WAAW,CAACE,GAAZ,CACE,IAAIC,+BAAJ,CACE,KAAK/E,IADP,EAEE,KAAK+D,OAFP,EAGE,KAAKC,OAHP,EAIE,KAAKtC,WAJP,CADF;IAQD;;IAED,OAAOkD,WAAP;EACD;EAED;AACF;;;EACmB,IAAbI,aAAa,GAAkC;IACjD,IAAI,KAAKhF,IAAL,KAAc,MAAd,IAAwB,KAAKA,IAAL,KAAc,MAA1C,EAAkD;MAChD,OAAOiF,0BAAA,CAAgBC,KAAvB;IACD;;IAED,OAAOD,0BAAA,CAAgBE,MAAvB;EACD;;AA3cuD;;eA8c3C3F,sB"}
1
+ {"version":3,"file":"DatetimeAttributeModel.js","names":["PRODUCT_DEFAULT_DATE_FORMAT","DatetimeAttributeModel","StringAttributeModel","constructor","attribute","attributeContributions","updateInitValue","isApplicableModel","contributions","type","formatUtil","TimeUtil","TimestampUtil","DateTimeUtil","DateUtil","getInitValue","value","data","length","split","hasTime","getTimeValue","timeValue","timeInputFormat","toLowerCase","setHour","setMinute","setSecond","setMilliseconds","_initvalue","_inputvalue","getInitialInputValue","_value","initValue","toFormat","inputFormat","getContribution","getInputValue","toString","inputvalue","validate","toISO","format","convertFormat","operator","hasDate","formatLabel","dateInputFormat","ignoreFormatSetting","layouthint","has","IGNORE_FORMAT_SETTING","dateInputFormatSetting","getSetting","dateFormat","replace","dateReadonlyFormat","readonlyFormatSetting","placeholder","_placeholder","timeFormatParts","push","timeFormat","join","timeReadonlyFormat","dateInputValue","timeInputValue","formatValue","hasFormat","ISO_DATE_FORMAT","dateTimeReadonlyFormat","readonlyvalue","mindate","maxdate","addServerError","error","id","message","properties","_errorCollection","getFormatConstraint","DateTimeDateFormatConstraint","DateTimeTimeFormatConstraint","DatetimeFormatConstraint","addConstraints","constraints","ConstraintCollection","add","DateBoundaryConstraint","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","MEDIUM"],"sources":["../../../src/models/attributes/DatetimeAttributeModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport {\n DateUtil,\n DateTimeUtil,\n TimeUtil,\n TimestampUtil,\n} from \"../../utils/datetime/DateTimeUtil\";\n\nimport StringAttributeModel from \"./StringAttributeModel\";\n\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport DateTimeDateFormatConstraint from \"./input-constraints/DateTimeDateFormatConstraint\";\nimport DateTimeTimeFormatConstraint from \"./input-constraints/DateTimeTimeFormatConstraint\";\nimport DatetimeFormatConstraint from \"./input-constraints/DatetimeFormatConstraint\";\nimport DateBoundaryConstraint from \"./input-constraints/DateBoundaryConstraint\";\n\nimport { ATTRIBUTE_WIDTH, ISO_DATE_FORMAT } from \"../../constants\";\nimport { getSetting } from \"../../constants/Settings\";\nimport { IGNORE_FORMAT_SETTING } from \"../../constants/LayoutHints\";\n\nimport type { FormErrorAnchor, IConstraintModel } from \"../types\";\n\n// date format of default\nconst PRODUCT_DEFAULT_DATE_FORMAT = \"dd-MM-yyyy\";\n\n/**\n */\nclass DatetimeAttributeModel extends StringAttributeModel {\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this.updateInitValue();\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return [\"date\", \"time\", \"datetime\", \"timestamp\"].includes(\n contributions.type\n );\n }\n\n /**\n */\n get formatUtil():\n | typeof TimeUtil\n | typeof TimestampUtil\n | typeof DateTimeUtil\n | typeof DateUtil {\n switch (this.type) {\n case \"time\":\n return TimeUtil;\n case \"timestamp\":\n return TimestampUtil;\n case \"datetime\":\n return DateTimeUtil;\n default:\n return DateUtil;\n }\n }\n\n /**\n */\n getInitValue(): string | null {\n let value = this.data.value;\n if (value != null) {\n if (this.type === \"time\" && value.length === 5) {\n value = `${value}:00`;\n }\n\n // handle old datetime values, which contained ms\n if (this.type === \"datetime\" && value.includes(\".\")) {\n value = value.split(\".\")[0];\n }\n\n if (this.hasTime) {\n value = this.getTimeValue(value);\n }\n }\n\n return value;\n }\n\n /**\n */\n getTimeValue(value: string): string {\n let timeValue = value;\n if (!this.timeInputFormat.toLowerCase().includes(\"h\")) {\n timeValue = this.formatUtil.setHour(value, 0);\n }\n if (!this.timeInputFormat.includes(\"m\")) {\n timeValue = this.formatUtil.setMinute(value, 0);\n }\n if (!this.timeInputFormat.includes(\"s\")) {\n timeValue = this.formatUtil.setSecond(value, 0);\n }\n if (this.type === \"timestamp\" && !this.timeInputFormat.includes(\"S\")) {\n timeValue = this.formatUtil.setMilliseconds(value, 0);\n }\n return timeValue;\n }\n\n /**\n * Set time in the correct value based on available elements in the time format\n */\n updateInitValue() {\n const value = this.getInitValue();\n if (value != null) {\n this._initvalue = value;\n this._inputvalue = this.getInitialInputValue(value);\n this._value = value;\n }\n }\n\n /**\n * Get initial user input value\n */\n getInitialInputValue(value?: string): string {\n if (!value) {\n return \"\";\n }\n\n let initValue = value;\n if (this.type === \"time\" && value.length === 5) {\n initValue = `${value}:00`;\n }\n\n return this.formatUtil.toFormat(initValue, this.inputFormat);\n }\n\n /**\n * Set type to date\n */\n get type(): string {\n return this.getContribution(\"type\", \"date\");\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 getInputValue(): string {\n return this._inputvalue ? this._inputvalue.toString() : \"\";\n }\n\n /**\n * Get input value\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this.validate(value);\n\n this._inputvalue = value;\n\n this.value =\n value !== null && value !== \"\"\n ? this.formatUtil.toISO(value, this.inputFormat)\n : null;\n }\n\n /**\n * Get date format\n */\n get format(): string {\n const format = this.getContribution(\"format\", \"\");\n return this.formatUtil.convertFormat(format);\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n */\n get hasDate(): boolean {\n return (\n this.type === \"date\" ||\n this.type === \"datetime\" ||\n this.type === \"timestamp\"\n );\n }\n\n /**\n */\n get hasTime(): boolean {\n return (\n this.type === \"time\" ||\n this.type === \"datetime\" ||\n this.type === \"timestamp\"\n );\n }\n\n /**\n */\n get formatLabel(): string {\n switch (this.type) {\n case \"date\":\n return this.dateInputFormat.toLowerCase();\n case \"time\":\n return this.timeInputFormat.toLowerCase();\n default:\n return this.format.toLowerCase();\n }\n }\n\n /**\n */\n get inputFormat(): string {\n if (this.hasDate && this.hasTime) {\n return `${this.dateInputFormat} ${this.timeInputFormat}`.trim();\n }\n\n if (this.hasDate) {\n return this.dateInputFormat;\n }\n\n if (this.hasTime) {\n return this.timeInputFormat;\n }\n\n return \"\";\n }\n\n /**\n */\n get dateInputFormat(): string {\n if (!this.hasDate) {\n return \"\";\n }\n\n // setting for date input\n const ignoreFormatSetting = this.layouthint.has(IGNORE_FORMAT_SETTING);\n if (!ignoreFormatSetting) {\n const dateInputFormatSetting = getSetting(\"DATE_INPUT_FORMAT\", \"\");\n if (dateInputFormatSetting) {\n return dateInputFormatSetting;\n }\n }\n\n let format = this.format;\n\n let dateFormat = this.hasTime\n ? format.replace(this.timeInputFormat, \"\").trim()\n : format;\n\n return dateFormat;\n }\n\n /**\n */\n get dateReadonlyFormat(): string {\n if (!this.hasDate) {\n return \"\";\n }\n\n let format = this.format;\n\n let dateFormat = this.hasTime\n ? format.replace(this.timeInputFormat, \"\").trim()\n : format;\n\n const readonlyFormatSetting = getSetting(\"DATE_READONLY_FORMAT\", \"\");\n\n if (dateFormat === PRODUCT_DEFAULT_DATE_FORMAT && readonlyFormatSetting) {\n dateFormat = readonlyFormatSetting;\n }\n\n return dateFormat;\n }\n\n /**\n * return attribute placeholder or, if DATE_INPUT_FORMAT setting is used, lowercased setting, otherwise return formatlabel without time input format from contributions\n */\n get placeholder(): string {\n if (this._placeholder !== \"\") {\n return this._placeholder;\n }\n\n const dateInputFormatSetting = getSetting(\"DATE_INPUT_FORMAT\", \"\");\n\n if (dateInputFormatSetting) {\n return dateInputFormatSetting.toLowerCase();\n }\n\n const formatLabel = this.getContribution(\"formatlabel\", \"\");\n\n if (this.hasDate && this.hasTime && formatLabel.includes(\" \")) {\n // return first part of formatlabel to keep placeholder matching date input\n return formatLabel.split(\" \")[0];\n }\n\n return formatLabel;\n }\n\n /**\n * Set placeholder text\n */\n set placeholder(placeholder: string) {\n this._placeholder = placeholder;\n }\n\n /**\n */\n get timeInputFormat(): string {\n if (!this.hasTime) {\n return \"\";\n }\n\n const format = this.format;\n\n let timeFormatParts = [];\n if (format.includes(\"H\")) {\n timeFormatParts.push(\"HH\");\n } else if (format.includes(\"h\")) {\n timeFormatParts.push(\"hh\");\n }\n if (format.includes(\"m\")) {\n timeFormatParts.push(\"mm\");\n }\n if (format.includes(\"s\")) {\n timeFormatParts.push(\"ss\");\n }\n\n let timeFormat = timeFormatParts.join(\":\");\n if (format.includes(\"S\")) {\n timeFormat = `${timeFormat}.SSS`;\n }\n if (format.includes(\"a\")) {\n return `${timeFormat} a`;\n }\n return timeFormat;\n }\n\n /**\n */\n get timeReadonlyFormat(): string {\n if (!this.hasTime) {\n return \"\";\n }\n\n return this.timeInputFormat;\n }\n\n /**\n */\n get dateInputValue(): string {\n return typeof this.value === \"string\" && this.dateInputFormat !== \"\"\n ? this.formatUtil.toFormat(this.value, this.dateInputFormat)\n : \"\";\n }\n\n /**\n */\n get timeInputValue(): string {\n return typeof this.value === \"string\" && this.timeInputFormat !== \"\"\n ? this.formatUtil.toFormat(this.value, this.timeInputFormat)\n : \"\";\n }\n\n // format value in readonly rendering\n /**\n */\n formatValue(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n // when the value is exactly an iso date, render as date\n if (\n (this.type === \"datetime\" || this.type === \"timestamp\") &&\n DateUtil.hasFormat(value, ISO_DATE_FORMAT)\n ) {\n return DateUtil.toFormat(value, this.dateReadonlyFormat);\n }\n\n if (this.hasDate && this.hasTime) {\n const dateTimeReadonlyFormat = `${this.dateReadonlyFormat} ${this.timeReadonlyFormat}`;\n return this.formatUtil.toFormat(value, dateTimeReadonlyFormat);\n }\n\n if (this.type === \"date\") {\n return this.formatUtil.toFormat(value, this.dateReadonlyFormat);\n }\n\n return this.formatUtil.toFormat(value, this.format);\n }\n\n /**\n * Retrieve readonly value, the date in the configurated format\n */\n get readonlyvalue(): string {\n if (typeof this.value === \"string\") {\n return this.formatValue(this.value.toString());\n }\n\n return \"\";\n }\n\n /**\n * Get minimum date\n */\n get mindate(): string | null {\n return this.getContribution(\"mindate\");\n }\n\n /**\n * Get maximum date\n */\n get maxdate(): string | null {\n return this.getContribution(\"maxdate\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, layouthint, message, properties } = error;\n if (properties && has(properties, \"format\") && this.formatLabel) {\n properties.format = this.formatLabel;\n }\n\n this._errorCollection.addServerError(id, layouthint, message, properties);\n }\n\n /**\n */\n getFormatConstraint(): IConstraintModel {\n switch (this.type) {\n case \"date\":\n return new DateTimeDateFormatConstraint(\n this.dateInputFormat,\n this.formatLabel\n );\n case \"time\":\n return new DateTimeTimeFormatConstraint(\n this.timeInputFormat,\n this.formatLabel\n );\n default:\n return new DatetimeFormatConstraint(\n this.type,\n this.inputFormat,\n this.formatLabel\n );\n }\n }\n\n /**\n * Add Date constraints for attribute\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this.getFormatConstraint());\n\n if (this.mindate || this.maxdate) {\n constraints.add(\n new DateBoundaryConstraint(\n this.type,\n this.mindate,\n this.maxdate,\n this.inputFormat\n )\n );\n }\n\n return constraints;\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.type === \"date\" || this.type === \"time\") {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n\nexport default DatetimeAttributeModel;\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AAOA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAIA;AACA,MAAMA,2BAA2B,GAAG,YAApC;AAEA;AACA;;AACA,MAAMC,sBAAN,SAAqCC,6BAArC,CAA0D;EACxD;AACF;EACEC,WAAW,CAACC,SAAD,EAAoBC,sBAApB,EAAoD;IAC7D,MAAMD,SAAN,EAAiBC,sBAAjB;IAEA,KAAKC,eAAL;EACD;EAED;AACF;;;EAC0B,OAAjBC,iBAAiB,CAACC,aAAD,EAAiC;IAAA;;IACvD,OAAO,mCAAC,MAAD,EAAS,MAAT,EAAiB,UAAjB,EAA6B,WAA7B,kBACLA,aAAa,CAACC,IADT,CAAP;EAGD;EAED;AACF;;;EACgB,IAAVC,UAAU,GAIM;IAClB,QAAQ,KAAKD,IAAb;MACE,KAAK,MAAL;QACE,OAAOE,sBAAP;;MACF,KAAK,WAAL;QACE,OAAOC,2BAAP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