@beinformed/ui 1.21.0 → 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 +21 -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 +46 -32
  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 +6 -3
  33. package/lib/models/error/ErrorModel.js.map +1 -1
  34. package/lib/models/error/ErrorResponse.js +46 -32
  35. package/lib/models/error/ErrorResponse.js.flow +31 -24
  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 +6 -3
  51. package/src/models/error/ErrorResponse.js +31 -24
  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":"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;EAGD;EAED;AACF;;;EACgB,IAAVC,UAAU,GAIM;IAClB,QAAQ,KAAKD,IAAb;MACE,KAAK,MAAL;QACE,OAAOE,sBAAP;;MACF,KAAK,WAAL;QACE,OAAOC,2BAAP;;MACF,KAAK,UAAL;QACE,OAAOC,0BAAP;;MACF;QACE,OAAOC,sBAAP;IARJ;EAUD;EAED;AACF;;;EACEC,YAAY,GAAkB;IAC5B,IAAIC,KAAK,GAAG,KAAKC,IAAL,CAAUD,KAAtB;;IACA,IAAIA,KAAK,IAAI,IAAb,EAAmB;MACjB,IAAI,KAAKP,IAAL,KAAc,MAAd,IAAwBO,KAAK,CAACE,MAAN,KAAiB,CAA7C,EAAgD;QAC9CF,KAAK,aAAMA,KAAN,QAAL;MACD,CAHgB,CAKjB;;;MACA,IAAI,KAAKP,IAAL,KAAc,UAAd,IAA4B,uBAAAO,KAAK,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A;;;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_W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B,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"}
@@ -19,6 +19,8 @@ var _BaseCollection = _interopRequireDefault(require("../base/BaseCollection"));
19
19
 
20
20
  var _ErrorModel = _interopRequireDefault(require("./ErrorModel"));
21
21
 
22
+ var _LayoutHintCollection = _interopRequireDefault(require("../layouthint/LayoutHintCollection"));
23
+
22
24
  /**
23
25
  * Form Objects
24
26
  */
@@ -59,14 +61,14 @@ class ErrorCollection extends _BaseCollection.default {
59
61
  */
60
62
 
61
63
 
62
- addError(id, defaultMessage, parameters) {
64
+ addError(id, layouthint, defaultMessage, parameters) {
63
65
  const itemIdx = this.findById(id);
64
66
 
65
67
  if (itemIdx > -1) {
66
68
  this.removeByIndex(itemIdx);
67
69
  }
68
70
 
69
- this.add(new _ErrorModel.default(id, defaultMessage, parameters));
71
+ this.add(new _ErrorModel.default(id, defaultMessage, parameters, false, layouthint));
70
72
  }
71
73
  /**
72
74
  */
@@ -81,11 +83,11 @@ class ErrorCollection extends _BaseCollection.default {
81
83
  */
82
84
 
83
85
 
84
- addServerError(id, defaultMessage, parameters) {
86
+ addServerError(id, layouthint, defaultMessage, parameters) {
85
87
  if (parameters) {
86
- this.addError(id, defaultMessage, parameters);
88
+ this.addError(id, layouthint, defaultMessage, parameters);
87
89
  } else {
88
- this.addError(id, defaultMessage);
90
+ this.addError(id, layouthint, defaultMessage);
89
91
  }
90
92
  }
91
93
  /**
@@ -4,6 +4,7 @@ import ErrorModel from "./ErrorModel";
4
4
 
5
5
  import type { MessageParameters } from "../../i18n/types";
6
6
  import type { IConstraintModel } from "../types";
7
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
7
8
 
8
9
  /**
9
10
  * Form Objects
@@ -42,6 +43,7 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
42
43
  */
43
44
  addError(
44
45
  id: string,
46
+ layouthint?: LayoutHintCollection,
45
47
  defaultMessage?: string,
46
48
  parameters?: MessageParameters
47
49
  ) {
@@ -51,7 +53,7 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
51
53
  this.removeByIndex(itemIdx);
52
54
  }
53
55
 
54
- this.add(new ErrorModel(id, defaultMessage, parameters));
56
+ this.add(new ErrorModel(id, defaultMessage, parameters, false, layouthint));
55
57
  }
56
58
 
57
59
  /**
@@ -66,13 +68,14 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
66
68
  */
67
69
  addServerError(
68
70
  id: string,
71
+ layouthint?: LayoutHintCollection,
69
72
  defaultMessage?: string,
70
73
  parameters?: MessageParameters
71
74
  ) {
72
75
  if (parameters) {
73
- this.addError(id, defaultMessage, parameters);
76
+ this.addError(id, layouthint, defaultMessage, parameters);
74
77
  } else {
75
- this.addError(id, defaultMessage);
78
+ this.addError(id, layouthint, defaultMessage);
76
79
  }
77
80
  }
78
81
 
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorCollection.js","names":["ErrorCollection","BaseCollection","constructor","type","errorCollection","_type","collection","serverErrors","error","isClientConstraint","findById","id","item","addError","defaultMessage","parameters","itemIdx","removeByIndex","add","ErrorModel","removeError","addServerError","removeServerError","removeServerErrors","forEach","addErrors","errors","addConstraints","constraints","constraint","hasMandatoryError","some","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ErrorModel from \"./ErrorModel\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type { IConstraintModel } from \"../types\";\n\n/**\n * Form Objects\n */\nexport default class ErrorCollection extends BaseCollection<ErrorModel> {\n _type: string;\n\n /**\n * constructor\n */\n constructor(type: string, errorCollection?: ErrorCollection) {\n super();\n\n this._type = type;\n this.collection = [];\n\n if (errorCollection) {\n this.collection = [...errorCollection.collection];\n }\n }\n\n /**\n */\n get serverErrors(): Array<ErrorModel> {\n return this.collection.filter((error) => !error.isClientConstraint);\n }\n\n /**\n */\n findById(id: string): number {\n return this.collection.findIndex((item) => item.id === id);\n }\n\n /**\n * Add an error to the collection\n */\n addError(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters\n ) {\n const itemIdx = this.findById(id);\n\n if (itemIdx > -1) {\n this.removeByIndex(itemIdx);\n }\n\n this.add(new ErrorModel(id, defaultMessage, parameters));\n }\n\n /**\n */\n removeError(id: string) {\n const itemIdx = this.findById(id);\n this.removeByIndex(itemIdx);\n }\n\n /**\n * Add a server error to the collection\n */\n addServerError(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters\n ) {\n if (parameters) {\n this.addError(id, defaultMessage, parameters);\n } else {\n this.addError(id, defaultMessage);\n }\n }\n\n /**\n */\n removeServerError(id: string) {\n this.removeError(id);\n }\n\n /**\n */\n removeServerErrors() {\n this.serverErrors.forEach((error) => {\n this.removeError(error.id);\n });\n }\n\n /**\n */\n addErrors(errors: Array<ErrorModel>) {\n this.collection = [...this.collection, ...errors];\n }\n\n /**\n * Add constraints to error collection\n */\n addConstraints(constraints: Array<IConstraintModel>) {\n this.collection = [\n ...this.collection,\n ...constraints.map(\n (constraint) =>\n new ErrorModel(\n constraint.id,\n constraint.defaultMessage,\n constraint.parameters,\n true\n )\n ),\n ];\n }\n\n /**\n * Indicates if a mandatory constraint is available and if it is in error.\n * Rationale: When a mandatory constraint is in error other constraint probably don't mather because there is no value to check\n */\n hasMandatoryError(): boolean {\n return this.collection.some((error) => error.isMandatoryConstraint);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;AAKA;AACA;AACA;AACe,MAAMA,eAAN,SAA8BC,uBAA9B,CAAyD;EAGtE;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,eAAf,EAAkD;IAC3D;IAD2D;IAG3D,KAAKC,KAAL,GAAaF,IAAb;IACA,KAAKG,UAAL,GAAkB,EAAlB;;IAEA,IAAIF,eAAJ,EAAqB;MACnB,KAAKE,UAAL,GAAkB,CAAC,GAAGF,eAAe,CAACE,UAApB,CAAlB;IACD;EACF;EAED;AACF;;;EACkB,IAAZC,YAAY,GAAsB;IAAA;;IACpC,OAAO,qCAAKD,UAAL,iBAAwBE,KAAD,IAAW,CAACA,KAAK,CAACC,kBAAzC,CAAP;EACD;EAED;AACF;;;EACEC,QAAQ,CAACC,EAAD,EAAqB;IAAA;;IAC3B,OAAO,yCAAKL,UAAL,kBAA2BM,IAAD,IAAUA,IAAI,CAACD,EAAL,KAAYA,EAAhD,CAAP;EACD;EAED;AACF;AACA;;;EACEE,QAAQ,CACNF,EADM,EAENG,cAFM,EAGNC,UAHM,EAIN;IACA,MAAMC,OAAO,GAAG,KAAKN,QAAL,CAAcC,EAAd,CAAhB;;IAEA,IAAIK,OAAO,GAAG,CAAC,CAAf,EAAkB;MAChB,KAAKC,aAAL,CAAmBD,OAAnB;IACD;;IAED,KAAKE,GAAL,CAAS,IAAIC,mBAAJ,CAAeR,EAAf,EAAmBG,cAAnB,EAAmCC,UAAnC,CAAT;EACD;EAED;AACF;;;EACEK,WAAW,CAACT,EAAD,EAAa;IACtB,MAAMK,OAAO,GAAG,KAAKN,QAAL,CAAcC,EAAd,CAAhB;IACA,KAAKM,aAAL,CAAmBD,OAAnB;EACD;EAED;AACF;AACA;;;EACEK,cAAc,CACZV,EADY,EAEZG,cAFY,EAGZC,UAHY,EAIZ;IACA,IAAIA,UAAJ,EAAgB;MACd,KAAKF,QAAL,CAAcF,EAAd,EAAkBG,cAAlB,EAAkCC,UAAlC;IACD,CAFD,MAEO;MACL,KAAKF,QAAL,CAAcF,EAAd,EAAkBG,cAAlB;IACD;EACF;EAED;AACF;;;EACEQ,iBAAiB,CAACX,EAAD,EAAa;IAC5B,KAAKS,WAAL,CAAiBT,EAAjB;EACD;EAED;AACF;;;EACEY,kBAAkB,GAAG;IACnB,KAAKhB,YAAL,CAAkBiB,OAAlB,CAA2BhB,KAAD,IAAW;MACnC,KAAKY,WAAL,CAAiBZ,KAAK,CAACG,EAAvB;IACD,CAFD;EAGD;EAED;AACF;;;EACEc,SAAS,CAACC,MAAD,EAA4B;IACnC,KAAKpB,UAAL,GAAkB,CAAC,GAAG,KAAKA,UAAT,EAAqB,GAAGoB,MAAxB,CAAlB;EACD;EAED;AACF;AACA;;;EACEC,cAAc,CAACC,WAAD,EAAuC;IACnD,KAAKtB,UAAL,GAAkB,CAChB,GAAG,KAAKA,UADQ,EAEhB,GAAG,kBAAAsB,WAAW,MAAX,CAAAA,WAAW,EACXC,UAAD,IACE,IAAIV,mBAAJ,CACEU,UAAU,CAAClB,EADb,EAEEkB,UAAU,CAACf,cAFb,EAGEe,UAAU,CAACd,UAHb,EAIE,IAJF,CAFU,CAFE,CAAlB;EAYD;EAED;AACF;AACA;AACA;;;EACEe,iBAAiB,GAAY;IAC3B,OAAO,KAAKxB,UAAL,CAAgByB,IAAhB,CAAsBvB,KAAD,IAAWA,KAAK,CAACwB,qBAAtC,CAAP;EACD;;AAhHqE"}
1
+ {"version":3,"file":"ErrorCollection.js","names":["ErrorCollection","BaseCollection","constructor","type","errorCollection","_type","collection","serverErrors","error","isClientConstraint","findById","id","item","addError","layouthint","defaultMessage","parameters","itemIdx","removeByIndex","add","ErrorModel","removeError","addServerError","removeServerError","removeServerErrors","forEach","addErrors","errors","addConstraints","constraints","constraint","hasMandatoryError","some","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ErrorModel from \"./ErrorModel\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type { IConstraintModel } from \"../types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n * Form Objects\n */\nexport default class ErrorCollection extends BaseCollection<ErrorModel> {\n _type: string;\n\n /**\n * constructor\n */\n constructor(type: string, errorCollection?: ErrorCollection) {\n super();\n\n this._type = type;\n this.collection = [];\n\n if (errorCollection) {\n this.collection = [...errorCollection.collection];\n }\n }\n\n /**\n */\n get serverErrors(): Array<ErrorModel> {\n return this.collection.filter((error) => !error.isClientConstraint);\n }\n\n /**\n */\n findById(id: string): number {\n return this.collection.findIndex((item) => item.id === id);\n }\n\n /**\n * Add an error to the collection\n */\n addError(\n id: string,\n layouthint?: LayoutHintCollection,\n defaultMessage?: string,\n parameters?: MessageParameters\n ) {\n const itemIdx = this.findById(id);\n\n if (itemIdx > -1) {\n this.removeByIndex(itemIdx);\n }\n\n this.add(new ErrorModel(id, defaultMessage, parameters, false, layouthint));\n }\n\n /**\n */\n removeError(id: string) {\n const itemIdx = this.findById(id);\n this.removeByIndex(itemIdx);\n }\n\n /**\n * Add a server error to the collection\n */\n addServerError(\n id: string,\n layouthint?: LayoutHintCollection,\n defaultMessage?: string,\n parameters?: MessageParameters\n ) {\n if (parameters) {\n this.addError(id, layouthint, defaultMessage, parameters);\n } else {\n this.addError(id, layouthint, defaultMessage);\n }\n }\n\n /**\n */\n removeServerError(id: string) {\n this.removeError(id);\n }\n\n /**\n */\n removeServerErrors() {\n this.serverErrors.forEach((error) => {\n this.removeError(error.id);\n });\n }\n\n /**\n */\n addErrors(errors: Array<ErrorModel>) {\n this.collection = [...this.collection, ...errors];\n }\n\n /**\n * Add constraints to error collection\n */\n addConstraints(constraints: Array<IConstraintModel>) {\n this.collection = [\n ...this.collection,\n ...constraints.map(\n (constraint) =>\n new ErrorModel(\n constraint.id,\n constraint.defaultMessage,\n constraint.parameters,\n true\n )\n ),\n ];\n }\n\n /**\n * Indicates if a mandatory constraint is available and if it is in error.\n * Rationale: When a mandatory constraint is in error other constraint probably don't mather because there is no value to check\n */\n hasMandatoryError(): boolean {\n return this.collection.some((error) => error.isMandatoryConstraint);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;AAIA;;AAEA;AACA;AACA;AACe,MAAMA,eAAN,SAA8BC,uBAA9B,CAAyD;EAGtE;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,eAAf,EAAkD;IAC3D;IAD2D;IAG3D,KAAKC,KAAL,GAAaF,IAAb;IACA,KAAKG,UAAL,GAAkB,EAAlB;;IAEA,IAAIF,eAAJ,EAAqB;MACnB,KAAKE,UAAL,GAAkB,CAAC,GAAGF,eAAe,CAACE,UAApB,CAAlB;IACD;EACF;EAED;AACF;;;EACkB,IAAZC,YAAY,GAAsB;IAAA;;IACpC,OAAO,qCAAKD,UAAL,iBAAwBE,KAAD,IAAW,CAACA,KAAK,CAACC,kBAAzC,CAAP;EACD;EAED;AACF;;;EACEC,QAAQ,CAACC,EAAD,EAAqB;IAAA;;IAC3B,OAAO,yCAAKL,UAAL,kBAA2BM,IAAD,IAAUA,IAAI,CAACD,EAAL,KAAYA,EAAhD,CAAP;EACD;EAED;AACF;AACA;;;EACEE,QAAQ,CACNF,EADM,EAENG,UAFM,EAGNC,cAHM,EAINC,UAJM,EAKN;IACA,MAAMC,OAAO,GAAG,KAAKP,QAAL,CAAcC,EAAd,CAAhB;;IAEA,IAAIM,OAAO,GAAG,CAAC,CAAf,EAAkB;MAChB,KAAKC,aAAL,CAAmBD,OAAnB;IACD;;IAED,KAAKE,GAAL,CAAS,IAAIC,mBAAJ,CAAeT,EAAf,EAAmBI,cAAnB,EAAmCC,UAAnC,EAA+C,KAA/C,EAAsDF,UAAtD,CAAT;EACD;EAED;AACF;;;EACEO,WAAW,CAACV,EAAD,EAAa;IACtB,MAAMM,OAAO,GAAG,KAAKP,QAAL,C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
  let isClientConstraint = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
23
+ let layouthint = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new _LayoutHintCollection.default();
23
24
  (0, _defineProperty2.default)(this, "_id", void 0);
24
25
  (0, _defineProperty2.default)(this, "_defaultMessage", void 0);
25
26
  (0, _defineProperty2.default)(this, "_parameters", void 0);
@@ -29,7 +30,7 @@ class ErrorModel {
29
30
  this._parameters = parameters;
30
31
  this._defaultMessage = defaultMessage;
31
32
  this._isClientConstraint = isClientConstraint;
32
- this._layouthint = new _LayoutHintCollection.default();
33
+ this._layouthint = Array.isArray(layouthint) ? new _LayoutHintCollection.default(layouthint) : layouthint;
33
34
  }
34
35
  /**
35
36
  * Get id of error
@@ -19,13 +19,16 @@ class ErrorModel {
19
19
  id: string,
20
20
  defaultMessage: ?string,
21
21
  parameters: ?MessageParameters,
22
- isClientConstraint: boolean = false
22
+ isClientConstraint: boolean = false,
23
+ layouthint: LayoutHintCollection = new LayoutHintCollection()
23
24
  ) {
24
25
  this._id = id;
25
26
  this._parameters = parameters;
26
27
  this._defaultMessage = defaultMessage;
27
28
  this._isClientConstraint = isClientConstraint;
28
- this._layouthint = new LayoutHintCollection();
29
+ this._layouthint = Array.isArray(layouthint)
30
+ ? new LayoutHintCollection(layouthint)
31
+ : layouthint;
29
32
  }
30
33
 
31
34
  /**
@@ -55,7 +58,7 @@ class ErrorModel {
55
58
 
56
59
  /**
57
60
  */
58
- get layouthint(): ?LayoutHintCollection {
61
+ get layouthint(): LayoutHintCollection {
59
62
  return this._layouthint;
60
63
  }
61
64
 
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorModel.js","names":["ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","_id","_parameters","_defaultMessage","_isClientConstraint","_layouthint","LayoutHintCollection","layouthint","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n _layouthint: LayoutHintCollection;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n this._isClientConstraint = isClientConstraint;\n this._layouthint = new LayoutHintCollection();\n }\n\n /**\n * Get id of error\n */\n get id(): string {\n return this._id;\n }\n\n /**\n */\n get defaultMessage(): ?string {\n return this._defaultMessage;\n }\n\n /**\n */\n get parameters(): ?MessageParameters {\n return this._parameters;\n }\n\n /**\n */\n get isClientConstraint(): boolean {\n return this._isClientConstraint || false;\n }\n\n /**\n */\n get layouthint(): ?LayoutHintCollection {\n return this._layouthint;\n }\n\n /**\n */\n get isMandatoryConstraint(): boolean {\n return this.id === \"Constraint.Mandatory\";\n }\n}\n\nexport default ErrorModel;\n"],"mappings":";;;;;;;;;;;AAEA;;AAEA;AACA;AACA;AACA,MAAMA,UAAN,CAAiB;EAOf;AACF;AACA;EACEC,WAAW,CACTC,EADS,EAETC,cAFS,EAGTC,UAHS,EAKT;IAAA,IADAC,kBACA,uEAD8B,KAC9B;IAAA;IAAA;IAAA;IAAA;IAAA;IACA,KAAKC,GAAL,GAAWJ,EAAX;IACA,KAAKK,WAAL,GAAmBH,UAAnB;IACA,KAAKI,eAAL,GAAuBL,cAAvB;IACA,KAAKM,mBAAL,GAA2BJ,kBAA3B;IACA,KAAKK,WAAL,GAAmB,IAAIC,6BAAJ,EAAnB;EACD;EAED;AACF;AACA;;;EACQ,IAAFT,EAAE,GAAW;IACf,OAAO,KAAKI,GAAZ;EACD;EAED;AACF;;;EACoB,IAAdH,cAAc,GAAY;IAC5B,OAAO,KAAKK,eAAZ;EACD;EAED;AACF;;;EACgB,IAAVJ,UAAU,GAAuB;IACnC,OAAO,KAAKG,WAAZ;EACD;EAED;AACF;;;EACwB,IAAlBF,kBAAkB,GAAY;IAChC,OAAO,KAAKI,mBAAL,IAA4B,KAAnC;EACD;EAED;AACF;;;EACgB,IAAVG,UAAU,GAA0B;IACtC,OAAO,KAAKF,WAAZ;EACD;EAED;AACF;;;EAC2B,IAArBG,qBAAqB,GAAY;IACnC,OAAO,KAAKX,EAAL,KAAY,sBAAnB;EACD;;AA1Dc;;eA6DFF,U"}
1
+ {"version":3,"file":"ErrorModel.js","names":["ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","layouthint","LayoutHintCollection","_id","_parameters","_defaultMessage","_isClientConstraint","_layouthint","Array","isArray","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n _layouthint: LayoutHintCollection;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false,\n layouthint: LayoutHintCollection = new LayoutHintCollection()\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n this._isClientConstraint = isClientConstraint;\n this._layouthint = Array.isArray(layouthint)\n ? new LayoutHintCollection(layouthint)\n : layouthint;\n }\n\n /**\n * Get id of error\n */\n get id(): string {\n return this._id;\n }\n\n /**\n */\n get defaultMessage(): ?string {\n return this._defaultMessage;\n }\n\n /**\n */\n get parameters(): ?MessageParameters {\n return this._parameters;\n }\n\n /**\n */\n get isClientConstraint(): boolean {\n return this._isClientConstraint || false;\n }\n\n /**\n */\n get layouthint(): LayoutHintCollection {\n return this._layouthint;\n }\n\n /**\n */\n get isMandatoryConstraint(): boolean {\n return this.id === \"Constraint.Mandatory\";\n }\n}\n\nexport default ErrorModel;\n"],"mappings":";;;;;;;;;;;AAEA;;AAEA;AACA;AACA;AACA,MAAMA,UAAN,CAAiB;EAOf;AACF;AACA;EACEC,WAAW,CACTC,EADS,EAETC,cAFS,EAGTC,UAHS,EAMT;IAAA,IAFAC,kBAEA,uEAF8B,KAE9B;IAAA,IADAC,UACA,uEADmC,IAAIC,6BAAJ,EACnC;IAAA;IAAA;IAAA;IAAA;IAAA;IACA,KAAKC,GAAL,GAAWN,EAAX;IACA,KAAKO,WAAL,GAAmBL,UAAnB;IACA,KAAKM,eAAL,GAAuBP,cAAvB;IACA,KAAKQ,mBAAL,GAA2BN,kBAA3B;IACA,KAAKO,WAAL,GAAmBC,KAAK,CAACC,OAAN,CAAcR,UAAd,IACf,IAAIC,6BAAJ,CAAyBD,UAAzB,CADe,GAEfA,UAFJ;EAGD;EAED;AACF;AACA;;;EACQ,IAAFJ,EAAE,GAAW;IACf,OAAO,KAAKM,GAAZ;EACD;EAED;AACF;;;EACoB,IAAdL,cAAc,GAAY;IAC5B,OAAO,KAAKO,eAAZ;EACD;EAED;AACF;;;EACgB,IAAVN,UAAU,GAAuB;IACnC,OAAO,KAAKK,WAAZ;EACD;EAED;AACF;;;EACwB,IAAlBJ,kBAAkB,GAAY;IAChC,OAAO,KAAKM,mBAAL,IAA4B,KAAnC;EACD;EAED;AACF;;;EACgB,IAAVL,UAAU,GAAyB;IACrC,OAAO,KAAKM,WAAZ;EACD;EAED;AACF;;;EAC2B,IAArBG,qBAAqB,GAAY;IACnC,OAAO,KAAKb,EAAL,KAAY,sBAAnB;EACD;;AA7Dc;;eAgEFF,U"}
@@ -80,119 +80,133 @@ class ErrorResponse {
80
80
  return this.error.message || this.id;
81
81
  }
82
82
  /**
83
- * Return error title
83
+ * Return response error message
84
+ */
85
+
86
+
87
+ get responseMessage() {
88
+ return this.response.message || this.id;
89
+ }
90
+ /**
91
+ * Return response error title
84
92
  */
85
93
 
86
94
 
87
95
  get title() {
88
- return this.error.title || null;
96
+ return this.response.title || null;
89
97
  }
90
98
  /**
91
- * Return error title message
99
+ * Return response error title message
92
100
  */
93
101
 
94
102
 
95
103
  get titleMessage() {
96
- var _this$error$title;
104
+ var _this$response$title;
97
105
 
98
- return ((_this$error$title = this.error.title) === null || _this$error$title === void 0 ? void 0 : _this$error$title.message) || undefined;
106
+ return ((_this$response$title = this.response.title) === null || _this$response$title === void 0 ? void 0 : _this$response$title.message) || undefined;
99
107
  }
100
108
  /**
101
- * Return error title Id
109
+ * Return response error title Id
102
110
  */
103
111
 
104
112
 
105
113
  get titleId() {
106
- var _this$error$title2;
114
+ var _this$response$title2;
107
115
 
108
- return ((_this$error$title2 = this.error.title) === null || _this$error$title2 === void 0 ? void 0 : _this$error$title2.id) || undefined;
116
+ return ((_this$response$title2 = this.response.title) === null || _this$response$title2 === void 0 ? void 0 : _this$response$title2.id) || undefined;
109
117
  }
110
118
  /**
111
- * Return error title properties
119
+ * Return response error title properties
112
120
  */
113
121
 
114
122
 
115
123
  get titleProperties() {
116
- var _this$error$title3;
124
+ var _this$response$title3;
117
125
 
118
- return ((_this$error$title3 = this.error.title) === null || _this$error$title3 === void 0 ? void 0 : _this$error$title3.properties) || null;
126
+ return ((_this$response$title3 = this.response.title) === null || _this$response$title3 === void 0 ? void 0 : _this$response$title3.properties) || null;
119
127
  }
120
128
  /**
121
- * Return error redirect
129
+ * Return response error redirect
122
130
  */
123
131
 
124
132
 
125
133
  get redirect() {
126
- return this.error.redirect || null;
134
+ return this.response.redirect || null;
127
135
  }
128
136
  /**
129
- * Return error redirect text
137
+ * Return response error redirect text
130
138
  */
131
139
 
132
140
 
133
141
  get redirectText() {
134
- var _this$error$redirect;
142
+ var _this$response, _this$response$redire;
135
143
 
136
- return ((_this$error$redirect = this.error.redirect) === null || _this$error$redirect === void 0 ? void 0 : _this$error$redirect.text) || null;
144
+ return ((_this$response = this.response) === null || _this$response === void 0 ? void 0 : (_this$response$redire = _this$response.redirect) === null || _this$response$redire === void 0 ? void 0 : _this$response$redire.text) || null;
137
145
  }
138
146
  /**
139
- * Return error redirect text id
147
+ * Return response error redirect text id
140
148
  */
141
149
 
142
150
 
143
151
  get redirectTextID() {
144
- var _this$error$redirect2, _this$error$redirect3;
152
+ var _this$response$redire2, _this$response$redire3;
145
153
 
146
- return ((_this$error$redirect2 = this.error.redirect) === null || _this$error$redirect2 === void 0 ? void 0 : (_this$error$redirect3 = _this$error$redirect2.text) === null || _this$error$redirect3 === void 0 ? void 0 : _this$error$redirect3.id) || undefined;
154
+ return ((_this$response$redire2 = this.response.redirect) === null || _this$response$redire2 === void 0 ? void 0 : (_this$response$redire3 = _this$response$redire2.text) === null || _this$response$redire3 === void 0 ? void 0 : _this$response$redire3.id) || undefined;
147
155
  }
148
156
  /**
149
- * Return error redirect text properties
157
+ * Return response error redirect text properties
150
158
  */
151
159
 
152
160
 
153
161
  get redirectTextProperties() {
154
- var _this$error$redirect4, _this$error$redirect5;
162
+ var _this$response$redire4, _this$response$redire5;
155
163
 
156
- return ((_this$error$redirect4 = this.error.redirect) === null || _this$error$redirect4 === void 0 ? void 0 : (_this$error$redirect5 = _this$error$redirect4.text) === null || _this$error$redirect5 === void 0 ? void 0 : _this$error$redirect5.properties) || null;
164
+ return ((_this$response$redire4 = this.response.redirect) === null || _this$response$redire4 === void 0 ? void 0 : (_this$response$redire5 = _this$response$redire4.text) === null || _this$response$redire5 === void 0 ? void 0 : _this$response$redire5.properties) || null;
157
165
  }
158
166
  /**
159
- * Return error redirect text message
167
+ * Return response error redirect text message
160
168
  */
161
169
 
162
170
 
163
171
  get redirectMessage() {
164
- var _this$error$redirect6, _this$error$redirect7;
172
+ var _this$response$redire6, _this$response$redire7;
165
173
 
166
- return ((_this$error$redirect6 = this.error.redirect) === null || _this$error$redirect6 === void 0 ? void 0 : (_this$error$redirect7 = _this$error$redirect6.text) === null || _this$error$redirect7 === void 0 ? void 0 : _this$error$redirect7.message) || undefined;
174
+ return ((_this$response$redire6 = this.response.redirect) === null || _this$response$redire6 === void 0 ? void 0 : (_this$response$redire7 = _this$response$redire6.text) === null || _this$response$redire7 === void 0 ? void 0 : _this$response$redire7.message) || undefined;
167
175
  }
168
176
  /**
169
- * Return error redirect href
177
+ * Return response error redirect href
170
178
  */
171
179
 
172
180
 
173
181
  get redirectHref() {
174
- var _this$error$redirect8;
182
+ var _this$response$redire8;
183
+
184
+ if ((_this$response$redire8 = this.response.redirect) !== null && _this$response$redire8 !== void 0 && _this$response$redire8.href) {
185
+ var _this$response$redire9;
175
186
 
176
- if ((_this$error$redirect8 = this.error.redirect) !== null && _this$error$redirect8 !== void 0 && _this$error$redirect8.href) {
177
- return new _Href.default(this.error.redirect.href);
187
+ return new _Href.default((_this$response$redire9 = this.response.redirect) === null || _this$response$redire9 === void 0 ? void 0 : _this$response$redire9.href);
178
188
  }
179
189
 
180
190
  return new _Href.default();
181
191
  }
182
192
  /**
183
- * Return error layouthint
193
+ * Return error response layouthint
184
194
  */
185
195
 
186
196
 
187
197
  get layouthint() {
188
- return new _LayoutHintCollection.default(this.error.layouthint);
198
+ var _this$response2;
199
+
200
+ return new _LayoutHintCollection.default((_this$response2 = this.response) === null || _this$response2 === void 0 ? void 0 : _this$response2.layouthint);
189
201
  }
190
202
  /**
191
203
  */
192
204
 
193
205
 
194
206
  get response() {
195
- return this.error.response || {};
207
+ var _this$error, _this$error$response;
208
+
209
+ return ((_this$error = this.error) === null || _this$error === void 0 ? void 0 : (_this$error$response = _this$error.response) === null || _this$error$response === void 0 ? void 0 : _this$error$response.error) || {};
196
210
  }
197
211
  /**
198
212
  */
@@ -89,88 +89,95 @@ export default class ErrorResponse {
89
89
  }
90
90
 
91
91
  /**
92
- * Return error title
92
+ * Return response error message
93
+ */
94
+ get responseMessage(): string {
95
+ return this.response.message || this.id;
96
+ }
97
+
98
+ /**
99
+ * Return response error title
93
100
  */
94
101
  get title(): TitleObject {
95
- return this.error.title || null;
102
+ return this.response.title || null;
96
103
  }
97
104
 
98
105
  /**
99
- * Return error title message
106
+ * Return response error title message
100
107
  */
101
108
  get titleMessage(): string {
102
- return this.error.title?.message || undefined;
109
+ return this.response.title?.message || undefined;
103
110
  }
104
111
 
105
112
  /**
106
- * Return error title Id
113
+ * Return response error title Id
107
114
  */
108
115
  get titleId(): string {
109
- return this.error.title?.id || undefined;
116
+ return this.response.title?.id || undefined;
110
117
  }
111
118
 
112
119
  /**
113
- * Return error title properties
120
+ * Return response error title properties
114
121
  */
115
122
  get titleProperties(): Object {
116
- return this.error.title?.properties || null;
123
+ return this.response.title?.properties || null;
117
124
  }
118
125
 
119
126
  /**
120
- * Return error redirect
127
+ * Return response error redirect
121
128
  */
122
129
  get redirect(): RedirectObject {
123
- return this.error.redirect || null;
130
+ return this.response.redirect || null;
124
131
  }
125
132
  /**
126
- * Return error redirect text
133
+ * Return response error redirect text
127
134
  */
128
135
  get redirectText(): RedirectTextObject {
129
- return this.error.redirect?.text || null;
136
+ return this.response?.redirect?.text || null;
130
137
  }
131
138
 
132
139
  /**
133
- * Return error redirect text id
140
+ * Return response error redirect text id
134
141
  */
135
142
  get redirectTextID(): string {
136
- return this.error.redirect?.text?.id || undefined;
143
+ return this.response.redirect?.text?.id || undefined;
137
144
  }
138
145
 
139
146
  /**
140
- * Return error redirect text properties
147
+ * Return response error redirect text properties
141
148
  */
142
149
  get redirectTextProperties(): Object {
143
- return this.error.redirect?.text?.properties || null;
150
+ return this.response.redirect?.text?.properties || null;
144
151
  }
145
152
 
146
153
  /**
147
- * Return error redirect text message
154
+ * Return response error redirect text message
148
155
  */
149
156
  get redirectMessage(): string {
150
- return this.error.redirect?.text?.message || undefined;
157
+ return this.response.redirect?.text?.message || undefined;
151
158
  }
152
159
 
153
160
  /**
154
- * Return error redirect href
161
+ * Return response error redirect href
155
162
  */
156
163
  get redirectHref(): Href {
157
- if (this.error.redirect?.href) {
158
- return new Href(this.error.redirect.href);
164
+ if (this.response.redirect?.href) {
165
+ return new Href(this.response.redirect?.href);
159
166
  }
160
167
  return new Href();
161
168
  }
162
169
 
163
170
  /**
164
- * Return error layouthint
171
+ * Return error response layouthint
165
172
  */
166
173
  get layouthint(): LayoutHintCollection {
167
- return new LayoutHintCollection(this.error.layouthint);
174
+ return new LayoutHintCollection(this.response?.layouthint);
168
175
  }
169
176
 
170
177
  /**
171
178
  */
172
179
  get response(): Object {
173
- return this.error.response || {};
180
+ return this.error?.response?.error || {};
174
181
  }
175
182
 
176
183
  /**