@beinformed/ui 1.9.0-beta.8 → 1.9.0-beta.9

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 (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/esm/constants/Settings.js +10 -8
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/models/attributes/AttributeContent.js +92 -68
  5. package/esm/models/attributes/AttributeContent.js.map +1 -1
  6. package/esm/models/attributes/AttributeModel.js +3 -3
  7. package/esm/models/attributes/AttributeModel.js.map +1 -1
  8. package/esm/models/attributes/ChoiceAttributeOptionModel.js +4 -4
  9. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  10. package/esm/models/attributes/HelptextAttributeModel.js +15 -1
  11. package/esm/models/attributes/HelptextAttributeModel.js.map +1 -1
  12. package/lib/constants/Settings.js +12 -1
  13. package/lib/constants/Settings.js.flow +9 -5
  14. package/lib/constants/Settings.js.map +1 -1
  15. package/lib/models/attributes/AttributeContent.js +93 -69
  16. package/lib/models/attributes/AttributeContent.js.flow +66 -43
  17. package/lib/models/attributes/AttributeContent.js.map +1 -1
  18. package/lib/models/attributes/AttributeModel.js +1 -1
  19. package/lib/models/attributes/AttributeModel.js.flow +2 -3
  20. package/lib/models/attributes/AttributeModel.js.map +1 -1
  21. package/lib/models/attributes/ChoiceAttributeOptionModel.js +3 -3
  22. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +4 -7
  23. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  24. package/lib/models/attributes/HelptextAttributeModel.js +15 -1
  25. package/lib/models/attributes/HelptextAttributeModel.js.flow +11 -1
  26. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  27. package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +9 -3
  28. package/lib/models/attributes/__tests__/HelptextAttributeModel.spec.js.flow +39 -1
  29. package/lib/models/types.js.flow +9 -4
  30. package/package.json +1 -1
  31. package/src/constants/Settings.js +9 -5
  32. package/src/models/attributes/AttributeContent.js +66 -43
  33. package/src/models/attributes/AttributeModel.js +2 -3
  34. package/src/models/attributes/ChoiceAttributeOptionModel.js +4 -7
  35. package/src/models/attributes/HelptextAttributeModel.js +11 -1
  36. package/src/models/attributes/__tests__/AttributeContent.spec.js +9 -3
  37. package/src/models/attributes/__tests__/HelptextAttributeModel.spec.js +39 -1
  38. package/src/models/form/__tests__/FormWithContentData.json +1 -1
  39. package/src/models/types.js +9 -4
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.9.0-beta.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.8...v1.9.0-beta.9) (2021-09-14)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **helptext-attribute:** allow for content in data ([b5228c9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/b5228c90737f9de33ef4ca0b0c24a976f97bc684))
10
+
5
11
  ## [1.9.0-beta.8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.7...v1.9.0-beta.8) (2021-09-13)
6
12
 
7
13
  ## [1.9.0-beta.7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.9.0-beta.6...v1.9.0-beta.7) (2021-09-13)
@@ -1,5 +1,6 @@
1
1
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
2
2
  import { isPlainObject, has } from "../utils/helpers/objects";
3
+ import { ALL_CONTENT_IN_DATA_SETTING } from "./Constants";
3
4
  var defaultSettings = {
4
5
  // Debug missing i18n messages in layout
5
6
  DEBUG_I18N_MESSAGE_NOT_FOUND: true,
@@ -46,7 +47,7 @@ var settings = defaultSettings;
46
47
  /**
47
48
  */
48
49
 
49
- var setSettings = function setSettings(config) {
50
+ export var setSettings = function setSettings(config) {
50
51
  if (isPlainObject(config)) {
51
52
  settings = _Object$assign(defaultSettings, config);
52
53
  }
@@ -54,8 +55,7 @@ var setSettings = function setSettings(config) {
54
55
  /**
55
56
  */
56
57
 
57
-
58
- var getSetting = function getSetting(key, defaultValue) {
58
+ export var getSetting = function getSetting(key, defaultValue) {
59
59
  var _settings$key;
60
60
 
61
61
  if (!has(settings, key) && defaultValue === undefined) {
@@ -67,17 +67,19 @@ var getSetting = function getSetting(key, defaultValue) {
67
67
  /**
68
68
  */
69
69
 
70
-
71
- var setSetting = function setSetting(key, value) {
70
+ export var setSetting = function setSetting(key, value) {
72
71
  settings[key] = value;
73
72
  };
74
73
  /**
75
74
  */
76
75
 
77
-
78
- var allSettings = function allSettings() {
76
+ export var allSettings = function allSettings() {
79
77
  return settings;
80
78
  };
79
+ /**
80
+ */
81
81
 
82
- export { getSetting, setSetting, setSettings, allSettings };
82
+ export var hasAllContentInData = function hasAllContentInData() {
83
+ return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
84
+ };
83
85
  //# sourceMappingURL=Settings.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/Settings.js"],"names":["isPlainObject","has","defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AAIA,IAAMC,eAAe,GAAG;AACtB;AACAC,EAAAA,4BAA4B,EAAE,IAFR;AAItB;AACAC,EAAAA,yBAAyB,EAAE,IALL;AAOtB;AACAC,EAAAA,kBAAkB,EAAE,KARE;AAUtB;AACAC,EAAAA,sBAAsB,EAAE,IAXF;AAatB;AACAC,EAAAA,qCAAqC,EAAE,IAdjB;AAgBtB;AACAC,EAAAA,oCAAoC,EAAE,KAjBhB;AAmBtB;AACAC,EAAAA,oBAAoB,EAAE,CAAC,UAAD,EAAa,WAAb,CApBA;AAsBtB;AACAC,EAAAA,yBAAyB,EAAE,IAvBL;AAyBtB;AACAC,EAAAA,6BAA6B,EAAE,IA1BT;AA4BtB;AACAC,EAAAA,eAAe,EAAE,CAAC,IAAD,EAAO,IAAP,CA7BK;AA+BtB;AACAC,EAAAA,qBAAqB,EAAE,IAhCD;AAkCtB;AACAC,EAAAA,wBAAwB,EAAE,GAnCJ;AAqCtB;AACAC,EAAAA,+BAA+B,EAAE,kCAtCX;AAwCtB;AACAC,EAAAA,iBAAiB,EAAE,YAzCG;AA2CtB;AACAC,EAAAA,oBAAoB,EAAE,YA5CA;AA8CtB;AACAC,EAAAA,uBAAuB,EAAE,CA/CH;AAiDtB;AACAC,EAAAA,iCAAiC,EAAE,CAlDb;AAoDtB;AACAC,EAAAA,aAAa,EAAE,EArDO;AAuDtB;AACAC,EAAAA,6BAA6B,EAAE,IAxDT;AA0DtB;AACAC,EAAAA,iCAAiC,EAAE;AA3Db,CAAxB;AA8DA,IAAIC,QAAQ,GAAGrB,eAAf;AAEA;AACA;;AACA,IAAMsB,WAAW,GAAG,SAAdA,WAAc,CAACC,MAAD,EAAoB;AACtC,MAAIzB,aAAa,CAACyB,MAAD,CAAjB,EAA2B;AACzBF,IAAAA,QAAQ,GAAG,eAAcrB,eAAd,EAA+BuB,MAA/B,CAAX;AACD;AACF,CAJD;AAMA;AACA;;;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAACC,GAAD,EAAcC,YAAd,EAA0C;AAAA;;AAC3D,MAAI,CAAC3B,GAAG,CAACsB,QAAD,EAAWI,GAAX,CAAJ,IAAuBC,YAAY,KAAKC,SAA5C,EAAuD;AACrD,UAAM,IAAIC,KAAJ,6BACiBH,GADjB,0CAAN;AAGD;;AAED,0BAAOJ,QAAQ,CAACI,GAAD,CAAf,yDAAwBC,YAAxB;AACD,CARD;AAUA;AACA;;;AACA,IAAMG,UAAU,GAAG,SAAbA,UAAa,CAACJ,GAAD,EAAcK,KAAd,EAA6B;AAC9CT,EAAAA,QAAQ,CAACI,GAAD,CAAR,GAAgBK,KAAhB;AACD,CAFD;AAIA;AACA;;;AACA,IAAMC,WAAW,GAAG,SAAdA,WAAc;AAAA,SAAmCV,QAAnC;AAAA,CAApB;;AAEA,SAASG,UAAT,EAAqBK,UAArB,EAAiCP,WAAjC,EAA8CS,WAA9C","sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // input format for dates\n DATE_INPUT_FORMAT: \"dd-MM-yyyy\",\n\n // readonly format for dates\n DATE_READONLY_FORMAT: \"dd-MM-yyyy\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nconst setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nconst getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nconst setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nconst allSettings = (): { [name: string]: Setting } => settings;\n\nexport { getSetting, setSetting, setSettings, allSettings };\n"],"file":"Settings.js"}
1
+ {"version":3,"sources":["../../src/constants/Settings.js"],"names":["isPlainObject","has","ALL_CONTENT_IN_DATA_SETTING","defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AACA,SAASC,2BAAT,QAA4C,aAA5C;AAIA,IAAMC,eAAe,GAAG;AACtB;AACAC,EAAAA,4BAA4B,EAAE,IAFR;AAItB;AACAC,EAAAA,yBAAyB,EAAE,IALL;AAOtB;AACAC,EAAAA,kBAAkB,EAAE,KARE;AAUtB;AACAC,EAAAA,sBAAsB,EAAE,IAXF;AAatB;AACAC,EAAAA,qCAAqC,EAAE,IAdjB;AAgBtB;AACAC,EAAAA,oCAAoC,EAAE,KAjBhB;AAmBtB;AACAC,EAAAA,oBAAoB,EAAE,CAAC,UAAD,EAAa,WAAb,CApBA;AAsBtB;AACAC,EAAAA,yBAAyB,EAAE,IAvBL;AAyBtB;AACAC,EAAAA,6BAA6B,EAAE,IA1BT;AA4BtB;AACAC,EAAAA,eAAe,EAAE,CAAC,IAAD,EAAO,IAAP,CA7BK;AA+BtB;AACAC,EAAAA,qBAAqB,EAAE,IAhCD;AAkCtB;AACAC,EAAAA,wBAAwB,EAAE,GAnCJ;AAqCtB;AACAC,EAAAA,+BAA+B,EAAE,kCAtCX;AAwCtB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esContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { ALL_CONTENT_IN_DATA_SETTING } from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // input format for dates\n DATE_INPUT_FORMAT: \"dd-MM-yyyy\",\n\n // readonly format for dates\n DATE_READONLY_FORMAT: \"dd-MM-yyyy\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n"],"file":"Settings.js"}
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
5
5
 
6
6
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
7
7
 
8
- function _unsupportedIterableToArray(o, minLen) { var _context9; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context9 = Object.prototype.toString.call(o)).call(_context9, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _unsupportedIterableToArray(o, minLen) { var _context7; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context7 = Object.prototype.toString.call(o)).call(_context7, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
9
 
10
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
11
11
 
@@ -13,8 +13,8 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
13
13
 
14
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
15
 
16
- import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
17
16
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
17
+ import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
18
18
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
19
19
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
20
20
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
@@ -26,7 +26,7 @@ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
26
26
  import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
27
27
  import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
28
28
  import { retrieveText } from "../../utils/helpers/text";
29
- import { ALL_CONTENT_IN_DATA_SETTING, getSetting } from "../../constants";
29
+ import { hasAllContentInData } from "../../constants/Settings";
30
30
  import SectionModel from "../content/SectionModel";
31
31
 
32
32
  var AttributeContent = /*#__PURE__*/function () {
@@ -44,34 +44,72 @@ var AttributeContent = /*#__PURE__*/function () {
44
44
  _createClass(AttributeContent, [{
45
45
  key: "fromData",
46
46
  get: function get() {
47
- return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
47
+ return hasAllContentInData();
48
48
  }
49
49
  /**
50
50
  */
51
51
 
52
52
  }, {
53
- key: "label",
53
+ key: "header",
54
54
  get: function get() {
55
- var _this$_content;
56
-
57
- return (_this$_content = this._content) === null || _this$_content === void 0 ? void 0 : _this$_content.label;
55
+ var _this$_content, _this$_content$header, _this$_content2, _this$_content2$heade, _this$_content2$heade2;
56
+
57
+ var label = (_this$_content = this._content) === null || _this$_content === void 0 ? void 0 : (_this$_content$header = _this$_content.header) === null || _this$_content$header === void 0 ? void 0 : _this$_content$header.label;
58
+ var description = (_this$_content2 = this._content) === null || _this$_content2 === void 0 ? void 0 : (_this$_content2$heade = _this$_content2.header) === null || _this$_content2$heade === void 0 ? void 0 : (_this$_content2$heade2 = _this$_content2$heade.description) === null || _this$_content2$heade2 === void 0 ? void 0 : _this$_content2$heade2.message;
59
+ return {
60
+ label: label,
61
+ description: description
62
+ };
58
63
  }
59
64
  /**
60
65
  */
61
66
 
62
67
  }, {
63
- key: "getContentElements",
64
- value: function getContentElements(elementName, collectionName) {
65
- var _this$_content2;
68
+ key: "elements",
69
+ get: function get() {
70
+ var _this$_content3;
71
+
72
+ if ((_this$_content3 = this._content) !== null && _this$_content3 !== void 0 && _this$_content3.elements) {
73
+ var _this$_content$elemen;
74
+
75
+ return (_this$_content$elemen = this._content.elements) === null || _this$_content$elemen === void 0 ? void 0 : _mapInstanceProperty(_this$_content$elemen).call(_this$_content$elemen, function (element) {
76
+ if ("textFragmentElement" in element) {
77
+ // $FlowIssue
78
+ var _element$textFragment = element.textFragmentElement,
79
+ label = _element$textFragment.label,
80
+ id = _element$textFragment.id,
81
+ textfragments = _element$textFragment.textfragments;
82
+ return {
83
+ textFragmentElement: {
84
+ id: id,
85
+ label: label,
86
+ textfragments: _mapInstanceProperty(textfragments).call(textfragments, function (textfragment) {
87
+ return _objectSpread(_objectSpread({}, textfragment), {}, {
88
+ text: retrieveText(textfragment.text)
89
+ });
90
+ })
91
+ }
92
+ };
93
+ }
94
+
95
+ if ("contentElement" in element) {
96
+ // $FlowIssue
97
+ var _element$contentEleme = element.contentElement,
98
+ _label = _element$contentEleme.label,
99
+ sections = _element$contentEleme.sections;
100
+ return {
101
+ contentElement: {
102
+ label: _label,
103
+ sections: _mapInstanceProperty(sections).call(sections, function (section) {
104
+ return new SectionModel(section, null);
105
+ })
106
+ }
107
+ };
108
+ } // $FlowIssue
66
109
 
67
- if ((_this$_content2 = this._content) !== null && _this$_content2 !== void 0 && _this$_content2.elements) {
68
- var _context, _context2, _context3;
69
110
 
70
- return _flatInstanceProperty(_context = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this._content.elements).call(_context3, function (element) {
71
- return elementName in element;
72
- })).call(_context2, function (element) {
73
- return element[elementName][collectionName];
74
- })).call(_context);
111
+ return element;
112
+ });
75
113
  }
76
114
 
77
115
  return [];
@@ -79,6 +117,36 @@ var AttributeContent = /*#__PURE__*/function () {
79
117
  /**
80
118
  */
81
119
 
120
+ }, {
121
+ key: "label",
122
+ get: function get() {
123
+ return this.header.label;
124
+ }
125
+ /**
126
+ */
127
+
128
+ }, {
129
+ key: "description",
130
+ get: function get() {
131
+ return this.header.description;
132
+ }
133
+ /**
134
+ */
135
+
136
+ }, {
137
+ key: "getContentElements",
138
+ value: function getContentElements(elementName, collectionName) {
139
+ var _context, _context2, _context3;
140
+
141
+ return _flatInstanceProperty(_context = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this.elements).call(_context3, function (element) {
142
+ return elementName in element;
143
+ })).call(_context2, function (element) {
144
+ return element[elementName][collectionName];
145
+ })).call(_context);
146
+ }
147
+ /**
148
+ */
149
+
82
150
  }, {
83
151
  key: "properties",
84
152
  get: function get() {
@@ -103,13 +171,7 @@ var AttributeContent = /*#__PURE__*/function () {
103
171
  }, {
104
172
  key: "textfragments",
105
173
  get: function get() {
106
- var _context5;
107
-
108
- return _mapInstanceProperty(_context5 = this.getContentElements("textFragmentElement", "textfragments")).call(_context5, function (textFragment) {
109
- return _objectSpread(_objectSpread({}, textFragment), {}, {
110
- text: retrieveText(textFragment.text)
111
- });
112
- });
174
+ return this.getContentElements("textFragmentElement", "textfragments");
113
175
  }
114
176
  /**
115
177
  * Get concept text fragments by type
@@ -118,9 +180,9 @@ var AttributeContent = /*#__PURE__*/function () {
118
180
  }, {
119
181
  key: "getTextFragmentByKeys",
120
182
  value: function getTextFragmentByKeys(keys) {
121
- var _context6;
183
+ var _context5;
122
184
 
123
- return _filterInstanceProperty(_context6 = this.textfragments).call(_context6, function (textfragment) {
185
+ return _filterInstanceProperty(_context5 = this.textfragments).call(_context5, function (textfragment) {
124
186
  return _includesInstanceProperty(keys).call(keys, textfragment.type);
125
187
  });
126
188
  }
@@ -130,11 +192,7 @@ var AttributeContent = /*#__PURE__*/function () {
130
192
  }, {
131
193
  key: "sections",
132
194
  get: function get() {
133
- var _context7;
134
-
135
- return _mapInstanceProperty(_context7 = this.getContentElements("contentElement", "sections")).call(_context7, function (section) {
136
- return new SectionModel(section, null);
137
- });
195
+ return this.getContentElements("contentElement", "sections");
138
196
  }
139
197
  /**
140
198
  */
@@ -142,9 +200,9 @@ var AttributeContent = /*#__PURE__*/function () {
142
200
  }, {
143
201
  key: "getSectionsByType",
144
202
  value: function getSectionsByType(types) {
145
- var _context8;
203
+ var _context6;
146
204
 
147
- return _filterInstanceProperty(_context8 = this.sections).call(_context8, function (section) {
205
+ return _filterInstanceProperty(_context6 = this.sections).call(_context6, function (section) {
148
206
  return _includesInstanceProperty(types).call(types, section.type);
149
207
  });
150
208
  }
@@ -172,40 +230,6 @@ var AttributeContent = /*#__PURE__*/function () {
172
230
 
173
231
  return referredSections;
174
232
  }
175
- /**
176
- */
177
-
178
- }, {
179
- key: "all",
180
- get: function get() {
181
- var _this$_content3;
182
-
183
- if ((_this$_content3 = this._content) !== null && _this$_content3 !== void 0 && _this$_content3.elements) {
184
- var _this$_content$elemen;
185
-
186
- return (_this$_content$elemen = this._content.elements) === null || _this$_content$elemen === void 0 ? void 0 : _mapInstanceProperty(_this$_content$elemen).call(_this$_content$elemen, function (element) {
187
- if ("contentElement" in element) {
188
- // $FlowIssue
189
- var _element$contentEleme = element.contentElement,
190
- label = _element$contentEleme.label,
191
- sections = _element$contentEleme.sections;
192
- return {
193
- contentElement: {
194
- label: label,
195
- sections: _mapInstanceProperty(sections).call(sections, function (section) {
196
- return new SectionModel(section, null);
197
- })
198
- }
199
- };
200
- } // $FlowIssue
201
-
202
-
203
- return element;
204
- });
205
- }
206
-
207
- return [];
208
- }
209
233
  }]);
210
234
 
211
235
  return AttributeContent;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","ALL_CONTENT_IN_DATA_SETTING","getSetting","SectionModel","AttributeContent","content","_content","label","elementName","collectionName","elements","element","getContentElements","ids","properties","property","type","textFragment","text","keys","textfragments","textfragment","section","types","sections","referredSections","push","getReferredSections","contentElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,2BAAT,EAAsCC,UAAtC,QAAwD,iBAAxD;AACA,OAAOC,YAAP,MAAyB,yBAAzB;;IAUMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;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IAAInB,YAAJ,CAAiBmB,OAAjB,EAA0B,IAA1B,CAAb;AAAA,iBADgB;AAFJ;AADX,aAAP;AAQD,WAZ6C,CAc9C;;;AACA,iBAAOX,OAAP;AACD,SAhBM,CAAP;AAiBD;;AAED,aAAO,EAAP;AACD;;;;;;AAGH,eAAeP,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { ALL_CONTENT_IN_DATA_SETTING, getSetting } from \"../../constants\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport type {\n ContentData,\n PropertyData,\n TextFragmentData,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string, collectionName: string): Array<T> {\n if (this._content?.elements) {\n return this._content.elements\n .filter((element) => elementName in element)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n return [];\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElements<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<PropertyData> {\n return this.properties.filter((property) => ids.includes(property.type));\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElements<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n ).map((textFragment) => ({\n ...textFragment,\n text: retrieveText(textFragment.text),\n }));\n }\n\n /**\n * Get concept text fragments by type\n */\n getTextFragmentByKeys(keys: Array<string>): Array<TextFragmentData> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type)\n );\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElements<SectionModel>(\n \"contentElement\",\n \"sections\"\n ).map((section) => new SectionModel(section, null));\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n\n /**\n */\n get all(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"contentElement\" in element) {\n // $FlowIssue\n const { label, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","AttributeContent","content","_content","label","header","description","message","elements","element","textFragmentElement","id","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","ids","properties","property","type","keys","types","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;;IAUMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOH,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAGE;AAAA;;AACA,UAAMK,KAAK,qBAAG,KAAKD,QAAR,4EAAG,eAAeE,MAAlB,0DAAG,sBAAuBD,KAArC;AACA,UAAME,WAAW,sBAAG,KAAKH,QAAR,6EAAG,gBAAeE,MAAlB,oFAAG,sBAAuBC,WAA1B,2DAAG,uBAAoCC,OAAxD;AAEA,aAAO;AAAEH,QAAAA,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AACO,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMG,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKX,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCU,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,qBAASV,OAAO,CAACY,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe1B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport type {\n ContentData,\n PropertyData,\n TextFragmentData,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n const label = this._content?.header?.label;\n const description = this._content?.header?.description?.message;\n\n return { label, description };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"textFragmentElement\" in element) {\n // $FlowIssue\n const { label, id, textfragments } = element.textFragmentElement;\n return {\n textFragmentElement: {\n id,\n label,\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (\"contentElement\" in element) {\n // $FlowIssue\n const { label, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this.header.label;\n }\n\n /**\n */\n get description(): ?string {\n return this.header.description;\n }\n\n /**\n */\n getContentElements<T>(elementName: string, collectionName: string): Array<T> {\n return this.elements\n .filter((element) => elementName in element)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElements<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<PropertyData> {\n return this.properties.filter((property) => ids.includes(property.type));\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElements<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by type\n */\n getTextFragmentByKeys(keys: Array<string>): Array<TextFragmentData> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type)\n );\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElements<SectionModel>(\"contentElement\", \"sections\");\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
@@ -27,8 +27,8 @@ import StringLengthConstraint from "./input-constraints/StringLengthConstraint";
27
27
  import MandatoryConstraint from "./input-constraints/MandatoryConstraint";
28
28
  import ConceptDetailModel from "../concepts/ConceptDetailModel";
29
29
  import { MANDATORY, DISABLED } from "../../constants/LayoutHints";
30
- import { ALL_CONTENT_IN_DATA_SETTING, ATTRIBUTE_WIDTH, TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
31
- import { getSetting } from "../../constants/Settings";
30
+ import { ATTRIBUTE_WIDTH, TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
31
+ import { getSetting, hasAllContentInData } from "../../constants/Settings";
32
32
  import { IllegalArgumentException, UnsupportedOperationException } from "../../exceptions";
33
33
  import AttributeContent from "./AttributeContent";
34
34
  /**
@@ -1043,7 +1043,7 @@ var AttributeModel = /*#__PURE__*/function (_BaseModel) {
1043
1043
  }, {
1044
1044
  key: "hasContentFromData",
1045
1045
  get: function get() {
1046
- return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
1046
+ return hasAllContentInData();
1047
1047
  }
1048
1048
  /**
1049
1049
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/AttributeModel.js"],"names":["DateUtil","isPlainObject","BaseModel","ConstraintCollection","ErrorCollection","LinkCollection","StringLengthConstraint","MandatoryConstraint","ConceptDetailModel","MANDATORY","DISABLED","ALL_CONTENT_IN_DATA_SETTING","ATTRIBUTE_WIDTH","TIMEVERSION_FILTER_NAME","getSetting","IllegalArgumentException","UnsupportedOperationException","AttributeContent","AttributeModel","attribute","attributeContributions","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","_errorCollection","message","addServerError","id","parameters","_referenceDate","getData","now","_isResult","_mandatory","mandatory","_links","hasContentConfiguration","conceptLink","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","_parentKey","parentKey","type","_hasContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","configuredLabelProperty","some","_id","firstConfiguredLabel","alignmentHints","getByLayoutHint","alignment","substring","defaultAlignment","downloadLink","links","getLinksByGroup","first","getLinkByKey","addParameter","referenceDate","isCacheable","_concept","date","inputvalue","toString","getInputValue","validate","hasValue","inError","name","getFormData","getValue","updateLastModification","_validatedValue","_readonly","readonly","static","isResult","disabled","getContribution","format","validateValue","constraints","add","_serverConstraints","minLength","maxLength","addConstraints","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","constraintCollection","undefined","collection","invalidConstraints","isChangedSince","error","properties","removeServerError","errorCollection","serverErrors","hasItems","defaultMessage","addConstraint","params","forEach","paramKey","paramValue","formatValue","errors","resetErrors","formatParameters","addServerConstraint","_lastModification","Date","timestamp","oldAttribute","isValid","update","changedAttribute","_isEditable","isEditable","_isHidden","isHidden","otherAttribute","MEDIUM","_layoutHintRules","rules","attributes","layoutHintRules","process"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,SAASA,QAAT,QAAyB,mCAAzB;AACA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,OAAOC,SAAP,MAAsB,mBAAtB;AACA,OAAOC,oBAAP,MAAiC,0CAAjC;AACA,OAAOC,eAAP,MAA4B,0BAA5B;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AAEA,OAAOC,sBAAP,MAAmC,4CAAnC;AACA,OAAOC,mBAAP,MAAgC,yCAAhC;AAEA,OAAOC,kBAAP,MAA+B,gCAA/B;AAEA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,6BAApC;AACA,SACEC,2BADF,EAEEC,eAFF,EAGEC,uBAHF,QAIO,2BAJP;AAMA,SAASC,UAAT,QAA2B,0BAA3B;AAEA,SACEC,wBADF,EAEEC,6BAFF,QAGO,kBAHP;AAYA,OAAOC,gBAAP,MAA6B,oBAA7B;AAEA;AACA;AACA;;IACqBC,c;;;;;AA0BnB;AACF;AACE,0BAAYC,SAAZ,EAA+BC,sBAA/B,EAA+D;AAAA;;AAAA;;AAC7D,8BAAMD,SAAN,EAAiBC,sBAAjB;;AAD6D;;AAAA,wEA1BnC,CA0BmC;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,yEAnBpB,IAAIjB,oBAAJ,EAmBoB;;AAAA,+EAlB3BW,UAAU,CAAC,2BAAD,CAkBiB;;AAAA,+DAjB3C,IAiB2C;;AAAA;;AAAA,kEAfxC,KAewC;;AAAA,+DAdzB,IAcyB;;AAAA;;AAAA;;AAAA,gEAX1C,KAW0C;;AA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B;AACtB,aAAO,KAAKA,SAAZ;AACD;AAED;AACF;;SACE,aAAaC,QAAb,EAAgC;AAC9B,WAAKD,SAAL,GAAiBC,QAAjB;AACD;AAED;AACF;AACA;;;;WACE,gBAAO;AACL,WAAKA,QAAL,GAAgB,KAAhB;AACD;AAED;AACF;;;;WACE,gBAAO;AACL,WAAKA,QAAL,GAAgB,IAAhB;AACD;AAED;AACF;;;;WACE,gBAAOC,cAAP,EAA+C;AAC7C,aACE,KAAKtG,GAAL,KAAasG,cAAc,CAACtG,GAA5B,IACA,KAAKE,SAAL,KAAmBoG,cAAc,CAACpG,SAFpC;AAID;AAED;AACF;AACA;;;;SACE,eAAmD;AACjD,aAAO9C,eAAe,CAACmJ,MAAvB;AACD;AAED;AACF;;;;SACE,eAAgD;AAC9C,aAAO,KAAKC,gBAAZ;AACD;AAED;AACF;;SACE,aAAoBC,KAApB,EAAqD;AACnD,WAAKD,gBAAL,GAAwBC,KAAxB;AACD;AAED;AACF;;;;WACE,gCAAuBC,UAAvB,EAAwD;AACtD,UAAI,KAAKF,gBAAT,EAA2B;AACzB,aAAKG,eAAL,CAAqBC,OAArB,CAA6B,IAA7B,EAAmCF,UAAnC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAOpJ,UAAU,CAACH,2BAAD,EAA8B,IAA9B,CAAjB;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,IAAIM,gBAAJ,CAAqB,KAAKU,IAAL,CAAUL,OAA/B,CAAP;AACD;;;WAv1BD,2BAAyBG,aAAzB,EAAyD;AACvD,UAAI,CAACxB,aAAa,CAACwB,aAAD,CAAlB,EAAmC;AACjC,cAAM,IAAIV,wBAAJ,CACJ,oEADI,CAAN;AAGD;;AAED,aAAO,KAAP;AACD;;;;EA1EyCb,S;;SAAvBgB,c","sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { MANDATORY, DISABLED } from \"../../constants/LayoutHints\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type { AttributeType, FormErrorAnchor, ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel extends BaseModel {\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters\n );\n }\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n\n this._isResult = this.getData(\"isResult\", false);\n\n this._mandatory =\n this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links\n );\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n if (!isPlainObject(contributions)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a contributions object\"\n );\n }\n\n return false;\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): any {\n return value;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n !this.hasContentFromData &&\n this.hasContentConfiguration &&\n this.conceptLink\n ) {\n return [this.conceptLink];\n }\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const conceptHref = this.conceptLink?.href;\n if (conceptHref) {\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref)\n );\n }\n }\n\n /**\n * Getting the attribute key\n */\n get key(): string {\n return this.data.key;\n }\n\n /**\n */\n get parentKey(): string {\n return this._parentKey || \"\";\n }\n\n /**\n */\n set parentKey(parentKey: string) {\n this._parentKey = parentKey;\n }\n\n /**\n * Getting the attribute name\n */\n get name(): string {\n return this.key;\n }\n\n /**\n * Getting the type of the attribute\n */\n get type(): string {\n return this.contributions.type;\n }\n\n /**\n * Getting the label of the attribute\n */\n get label(): string {\n return this._label || \"\";\n }\n\n /**\n * Set the label of this attribute\n */\n set label(label: string) {\n this._label = label;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration = hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration || false;\n }\n\n /**\n */\n indicateContentConfiguration(contentConfiguration: ContentConfiguration) {\n if (contentConfiguration) {\n const hasQuestionConfig = contentConfiguration.questions?.hasConfig();\n\n const hasEndResultConfig =\n contentConfiguration.isConfiguredEndResultAttribute(this.key);\n const hasIntermediateResultConfig =\n contentConfiguration.isConfiguredIntermediateResultAttribute(this.key);\n\n this.hasContentConfiguration =\n hasQuestionConfig || hasEndResultConfig || hasIntermediateResultConfig;\n }\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(\n contentConfiguration: ?ContentConfigurationElements\n ): string {\n if (this.hasContentFromData) {\n return this.content.label ?? this.label;\n }\n\n const configuredLabelProperties =\n contentConfiguration && contentConfiguration.labelConfig.length > 0\n ? contentConfiguration.labelConfig[0].types\n : [];\n\n if (this.concept && configuredLabelProperties.length > 0) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\"\n );\n\n if (configuredLabels.length > 0) {\n const [firstConfiguredLabel] = configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n );\n\n if (firstConfiguredLabel) {\n return firstConfiguredLabel.value;\n }\n }\n }\n\n return this.label;\n }\n\n /**\n */\n get defaultAlignment(): \"left\" | \"center\" | \"right\" {\n return \"left\";\n }\n\n /**\n * Handles layout hint align-left, align-center and align-right\n */\n get alignment(): \"left\" | \"center\" | \"right\" {\n const alignmentHints = this.layouthint.getByLayoutHint(\"align-\");\n\n // return alignment based on layouthint or the default alignment for the attribute\n const alignment = alignmentHints\n ? alignmentHints.substring(\"align-\".length)\n : this.defaultAlignment;\n\n if (\n alignment === \"left\" ||\n alignment === \"center\" ||\n alignment === \"right\"\n ) {\n return alignment;\n }\n\n return this.defaultAlignment;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links\n );\n }\n\n return this._links;\n }\n\n /**\n * Retrieve link of attribute when available\n */\n get downloadLink(): ?LinkModel {\n const downloadLink = this.links.getLinksByGroup(\"download\").first;\n\n if (downloadLink && downloadLink.key === this.key) {\n return downloadLink;\n }\n\n return null;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): ?LinkModel {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept ?? null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n * to get information in correct time version\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Initial value received from the modular ui service\n */\n get initvalue(): any {\n return this._initvalue;\n }\n\n /**\n * Retrieve input value\n */\n getInputValue(): string {\n const inputvalue = this._inputvalue;\n\n return inputvalue ? inputvalue.toString() : \"\";\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Value that is used when retrieving an error collection of this attribute\n * Mostly this is the input value, but sometimes a different value is needed,\n * for example iban and postcode need to validate length without spaces\n */\n get validateValue(): string {\n return this.inputvalue;\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.value = value;\n\n this.validate(value);\n }\n\n /**\n */\n hasValue(): boolean {\n return this._value != null && this._value !== \"\";\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): any {\n return this.hasValue() ? this._value : null;\n }\n\n /**\n * Getting data ready to be send to the modular ui\n * Returns null when the attribute should not be send to the server\n */\n getFormData(): { [string]: any } | null {\n if (this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return this.getFormData();\n }\n\n /**\n */\n getEmptyFormData(): { [string]: null } {\n return { [this.name]: null };\n }\n\n /**\n * Getting the value of the attribute\n */\n get value(): any {\n return this.getValue();\n }\n\n /**\n * Setting a value in the element\n */\n set value(value: ?string) {\n this.updateLastModification();\n\n this._value = value;\n }\n\n /**\n */\n formatValue(value: string): string {\n return value;\n }\n\n /**\n * Getting the readonly value, iso value converted for human reading\n */\n get readonlyvalue(): string {\n return this.value ? this.value.toString() : \"\";\n }\n\n /**\n * Getting mandatory status of attribute\n */\n get mandatory(): boolean {\n return this._mandatory || false;\n }\n\n /**\n */\n get configuredMandatory(): ?boolean {\n return this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n }\n\n /**\n * Set mandatory status of attribute\n */\n set mandatory(mandatory: boolean) {\n if (mandatory !== this._mandatory) {\n this._validatedValue = null;\n }\n this._mandatory = mandatory;\n }\n\n /**\n */\n get readonly(): boolean {\n return (\n this._readonly ||\n this.contributions.readonly === true ||\n this.data.static === true ||\n this.isResult === true\n );\n }\n\n /**\n */\n set readonly(readonly: boolean) {\n this._readonly = readonly;\n }\n\n /**\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n */\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._isResult;\n }\n\n /**\n */\n set isResult(isResult: boolean) {\n this._isResult = isResult;\n }\n\n /**\n * Getting the display and input format of a attribute\n */\n get format(): string | null {\n return this.getContribution(\"format\");\n }\n\n /**\n */\n get formatLabel(): string {\n return this.format || \"\";\n }\n\n /**\n * Get minimum string length\n */\n get minLength(): number | null {\n return this.getContribution(\"minLength\");\n }\n\n /**\n * Get maximum string length\n */\n get maxLength(): number | null {\n return this.getContribution(\"maxLength\");\n }\n\n /**\n */\n get operator(): string {\n return \"\";\n }\n\n /**\n * Get assistant message\n */\n get assistantMessage(): string | null {\n return this.getContribution(\"assistant\");\n }\n\n /**\n * Get valid status\n */\n get isValid(): boolean {\n return this.validate(this.validateValue);\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this._serverConstraints);\n\n // Mandatory constraint\n if (this.mandatory) {\n constraints.add(new MandatoryConstraint());\n }\n\n if (this.minLength || this.maxLength) {\n constraints.add(\n new StringLengthConstraint(this.minLength, this.maxLength)\n );\n }\n\n constraints.add(this.addConstraints());\n\n return constraints;\n }\n\n /**\n * Template method for class extending this model to add extra constraints\n * @abstract\n */\n addConstraints(): ConstraintCollection {\n return new ConstraintCollection();\n }\n\n /**\n * Used to programmatically overwrite the setting USE_CLIENTSIDE_VALIDATION\n */\n setUseClientsideValidation(enabled: boolean) {\n this._useClientsideValidation = enabled;\n }\n\n /**\n * Indicates if client side validation is enabled\n * @returns {boolean}\n */\n useClientsideValidation(): boolean {\n return this._useClientsideValidation ?? true;\n }\n\n /**\n * Validate input on client side constraint\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== value) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = value;\n\n return this._isValid;\n }\n\n /**\n * Indicates if attribute is optional and empty\n */\n isOptionalAndEmpty(value: string): boolean {\n if (value === undefined) {\n throw new IllegalArgumentException(\n \"isOptionalAndEmpty method needs value argument\"\n );\n }\n\n return !this.mandatory && value === \"\";\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n const collection = new ErrorCollection(\"attribute\", this._errorCollection);\n\n collection.addConstraints(\n this.constraintCollection.invalidConstraints(this.validateValue)\n );\n\n return collection;\n }\n\n /**\n * Check if attribute is in error\n */\n inError(): boolean {\n return !this._isValid && this.isChangedSince(0);\n }\n\n /**\n * Reset static error messages on attribute\n */\n resetErrors() {\n this._errorCollection = new ErrorCollection(\"attribute\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties\n );\n }\n\n /**\n */\n removeServerError(id: string) {\n this._errorCollection.removeServerError(id);\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return this.errorCollection.serverErrors.length > 0;\n }\n\n /**\n */\n hasErrors(): boolean {\n return this.errorCollection.hasItems;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError() {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError() {\n this.removeServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n addServerConstraint(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters\n ) {\n this._serverConstraints.addConstraint(\n id,\n null,\n defaultMessage,\n parameters,\n this.useClientsideValidation()\n );\n }\n\n /**\n */\n formatParameters(parameters: Object): { [string]: string | number } {\n if (parameters == null) {\n return {};\n }\n\n const params = {};\n\n Object.keys(parameters).forEach((paramKey: string) => {\n const paramValue = parameters[paramKey];\n if (paramKey.endsWith(\"-number\") || paramKey.endsWith(\"-date\")) {\n params[paramKey] = this.formatValue(paramValue);\n } else {\n params[paramKey] = paramValue;\n }\n });\n\n return params;\n }\n\n /**\n */\n get hasDynamicValidationData(): boolean {\n return true;\n }\n\n /**\n */\n updateValidations(errors: Array<Object>) {\n if (\n errors.some((error) => error.id === \"Constraint.Mandatory\") ||\n this.layouthint.has(MANDATORY)\n ) {\n this.mandatory = true;\n } else if (!this.hasValue()) {\n this.mandatory = false;\n }\n\n this._serverConstraints = new ConstraintCollection();\n this.resetErrors();\n\n errors.forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties)\n );\n } else {\n this.addServerConstraint(\n error.id,\n error.message,\n this.formatParameters(error.properties)\n );\n }\n });\n }\n\n /**\n * Set last modification to current timestamp\n */\n updateLastModification() {\n this._lastModification = Date.now();\n }\n\n /**\n * Inidicates if attribute is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return this._lastModification > timestamp;\n }\n\n /**\n * Abstract reset method which should be implemented on each attribute that has this attribute as a base class.\n *\n * @abstract\n */\n reset() {\n throw new UnsupportedOperationException(\n `Reset method not implemented for ${this.type}`\n );\n }\n\n /**\n * Merge old attribute with the attribute from the server.\n * Readonly attributes always need to show the value from the server\n */\n mergeAttribute(oldAttribute: AttributeType) {\n this.concept = oldAttribute.concept;\n\n if (\n !oldAttribute.readonly &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(oldAttribute.inputvalue);\n }\n }\n\n /**\n * Abstract update method which should be implemented on each attribute that has this attribute as a base class.\n * @abstract\n */\n // eslint-disable-next-line no-unused-vars\n update(value: string, changedAttribute?: AttributeType): AttributeType {\n throw new UnsupportedOperationException(\n `Update method not implemented for ${this.type}`\n );\n }\n\n /**\n * Indicate if attribute is editable\n */\n set isEditable(isEditable: boolean) {\n this._isEditable = isEditable;\n }\n\n /**\n * Retrieve if attribute is editable\n */\n get isEditable(): boolean {\n return this._isEditable;\n }\n\n /**\n * Indicates if the attribute is visible\n */\n get isVisible(): boolean {\n return !this._isHidden;\n }\n\n /**\n */\n get isHidden(): boolean {\n return this._isHidden;\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n this._isHidden = isHidden;\n }\n\n /**\n * Explicitly toggle visibility of this attribute\n */\n show() {\n this.isHidden = false;\n }\n\n /**\n */\n hide() {\n this.isHidden = true;\n }\n\n /**\n */\n equals(otherAttribute: AttributeType): boolean {\n return (\n this.key === otherAttribute.key &&\n this.parentKey === otherAttribute.parentKey\n );\n }\n\n /**\n * Readonly attribute width indicates the proposed width of this attribute\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n\n /**\n */\n get layoutHintRules(): LayoutHintRuleCollection {\n return this._layoutHintRules;\n }\n\n /**\n */\n set layoutHintRules(rules: LayoutHintRuleCollection) {\n this._layoutHintRules = rules;\n }\n\n /**\n */\n processLayoutHintRules(attributes: AttributeCollection) {\n if (this._layoutHintRules) {\n this.layoutHintRules.process(this, attributes);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n }\n\n /**\n */\n get content(): AttributeContent {\n return new AttributeContent(this.data.content);\n }\n}\n"],"file":"AttributeModel.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/AttributeModel.js"],"names":["DateUtil","isPlainObject","BaseModel","ConstraintCollection","ErrorCollection","LinkCollection","StringLengthConstraint","MandatoryConstraint","ConceptDetailModel","MANDATORY","DISABLED","ATTRIBUTE_WIDTH","TIMEVERSION_FILTER_NAME","getSetting","hasAllContentInData","IllegalArgumentException","UnsupportedOperationException","AttributeContent","AttributeModel","attribute","attributeContributions","hasContentFromData","content","label","_label","contributions","_initvalue","data","value","_inputvalue","getInitialInputValue","_value","_disabled","layouthint","has","_errorCollection","message","addServerError","id","parameters","_referenceDate","getData","now","_isResult","_mandatory","mandatory","_links","hasContentConfiguration","conceptLink","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","key","_parentKey","parentKey","type","_hasContentConfiguration","contentConfiguration","hasQuestionConfig","questions","hasConfig","hasEndResultConfig","isConfiguredEndResultAttribute","hasIntermediateResultConfig","isConfiguredIntermediateResultAttribute","configuredLabelProperties","labelConfig","length","types","configuredLabels","getLabelElementByIds","configuredLabel","configuredLabelProperty","some","_id","firstConfiguredLabel","alignmentHints","getByLayoutHint","alignment","substring","defaultAlignment","downloadLink","links","getLinksByGroup","first","getLinkByKey","addParameter","referenceDate","isCacheable","_concept","date","inputvalue","toString","getInputValue","validate","hasValue","inError","name","getFormData","getValue","updateLastModification","_validatedValue","_readonly","readonly","static","isResult","disabled","getContribution","format","validateValue","constraints","add","_serverConstraints","minLength","maxLength","addConstraints","enabled","_useClientsideValidation","useClientsideValidation","isOptionalAndEmpty","_isValid","constraintCollection","undefined","collection","invalidConstraints","isChangedSince","error","properties","removeServerError","errorCollection","serverErrors","hasItems","defaultMessage","addConstraint","params","forEach","paramKey","paramValue","formatValue","errors","resetErrors","formatParameters","addServerConstraint","_lastModification","Date","timestamp","oldAttribute","isValid","update","changedAttribute","_isEditable","isEditable","_isHidden","isHidden","otherAttribute","MEDIUM","_layoutHintRules","rules","attributes","layoutHintRules","process"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,SAASA,QAAT,QAAyB,mCAAzB;AACA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,OAAOC,SAAP,MAAsB,mBAAtB;AACA,OAAOC,oBAAP,MAAiC,0CAAjC;AACA,OAAOC,eAAP,MAA4B,0BAA5B;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AAEA,OAAOC,sBAAP,MAAmC,4CAAnC;AACA,OAAOC,mBAAP,MAAgC,yCAAhC;AAEA,OAAOC,kBAAP,MAA+B,gCAA/B;AAEA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,6BAApC;AACA,SACEC,eADF,EAEEC,uBAFF,QAGO,2BAHP;AAKA,SAASC,UAAT,EAAqBC,mBAArB,Q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CF,UAAnC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAOpJ,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,IAAIG,gBAAJ,CAAqB,KAAKU,IAAL,CAAUL,OAA/B,CAAP;AACD;;;WAv1BD,2BAAyBG,aAAzB,EAAyD;AACvD,UAAI,CAACxB,aAAa,CAACwB,aAAD,CAAlB,EAAmC;AACjC,cAAM,IAAIV,wBAAJ,CACJ,oEADI,CAAN;AAGD;;AAED,aAAO,KAAP;AACD;;;;EA1EyCb,S;;SAAvBgB,c","sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport ErrorCollection from \"../error/ErrorCollection\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport StringLengthConstraint from \"./input-constraints/StringLengthConstraint\";\nimport MandatoryConstraint from \"./input-constraints/MandatoryConstraint\";\n\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport { MANDATORY, DISABLED } from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\n\nimport { getSetting, hasAllContentInData } from \"../../constants/Settings\";\n\nimport {\n IllegalArgumentException,\n UnsupportedOperationException,\n} from \"../../exceptions\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport type { AttributeType, FormErrorAnchor, ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ContentConfiguration from \"../contentconfiguration/ContentConfiguration\";\nimport type ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\nimport type LayoutHintRuleCollection from \"./layouthint-rules/LayoutHintRuleCollection\";\nimport type AttributeCollection from \"./AttributeCollection\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n * Attribute model, base model for all kind of attributes\n */\nexport default class AttributeModel extends BaseModel {\n _label: string;\n _lastModification: number = 0;\n\n _initvalue: any;\n _inputvalue: string;\n _value: any;\n\n _errorCollection: ErrorCollection;\n _serverConstraints: ConstraintCollection = new ConstraintCollection();\n _useClientsideValidation: boolean = getSetting(\"USE_CLIENTSIDE_VALIDATION\");\n _isValid: boolean = true;\n _validatedValue: string | null;\n _isEditable: boolean = false;\n _concept: ConceptDetailModel | null = null;\n _referenceDate: ISO_DATE;\n _isResult: boolean;\n _isHidden: boolean = false;\n _readonly: boolean;\n _disabled: boolean = false;\n _mandatory: boolean;\n _links: LinkCollection;\n _parentKey: ?string;\n _hasContentConfiguration: boolean;\n _layoutHintRules: LayoutHintRuleCollection;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n if (this.hasContentFromData && this.content.label) {\n this._label = this.content.label;\n } else {\n this._label = this.contributions.label;\n }\n\n this._initvalue = this.data.value;\n this._inputvalue = this.getInitialInputValue(this.data.value);\n this._value = this.data.value;\n this._disabled = this.layouthint.has(DISABLED);\n\n this._errorCollection = new ErrorCollection(\"attribute\");\n if (attribute && attribute.message) {\n this._errorCollection.addServerError(\n attribute.message.id,\n attribute.message.message,\n attribute.message.parameters\n );\n }\n\n this._referenceDate = this.getData(\"referenceDate\", DateUtil.now());\n\n this._isResult = this.getData(\"isResult\", false);\n\n this._mandatory =\n this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links\n );\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n if (!isPlainObject(contributions)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a contributions object\"\n );\n }\n\n return false;\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): any {\n return value;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n !this.hasContentFromData &&\n this.hasContentConfiguration &&\n this.conceptLink\n ) {\n return [this.conceptLink];\n }\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const conceptHref = this.conceptLink?.href;\n if (conceptHref) {\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref)\n );\n }\n }\n\n /**\n * Getting the attribute key\n */\n get key(): string {\n return this.data.key;\n }\n\n /**\n */\n get parentKey(): string {\n return this._parentKey || \"\";\n }\n\n /**\n */\n set parentKey(parentKey: string) {\n this._parentKey = parentKey;\n }\n\n /**\n * Getting the attribute name\n */\n get name(): string {\n return this.key;\n }\n\n /**\n * Getting the type of the attribute\n */\n get type(): string {\n return this.contributions.type;\n }\n\n /**\n * Getting the label of the attribute\n */\n get label(): string {\n return this._label || \"\";\n }\n\n /**\n * Set the label of this attribute\n */\n set label(label: string) {\n this._label = label;\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration = hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration || false;\n }\n\n /**\n */\n indicateContentConfiguration(contentConfiguration: ContentConfiguration) {\n if (contentConfiguration) {\n const hasQuestionConfig = contentConfiguration.questions?.hasConfig();\n\n const hasEndResultConfig =\n contentConfiguration.isConfiguredEndResultAttribute(this.key);\n const hasIntermediateResultConfig =\n contentConfiguration.isConfiguredIntermediateResultAttribute(this.key);\n\n this.hasContentConfiguration =\n hasQuestionConfig || hasEndResultConfig || hasIntermediateResultConfig;\n }\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(\n contentConfiguration: ?ContentConfigurationElements\n ): string {\n if (this.hasContentFromData) {\n return this.content.label ?? this.label;\n }\n\n const configuredLabelProperties =\n contentConfiguration && contentConfiguration.labelConfig.length > 0\n ? contentConfiguration.labelConfig[0].types\n : [];\n\n if (this.concept && configuredLabelProperties.length > 0) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\"\n );\n\n if (configuredLabels.length > 0) {\n const [firstConfiguredLabel] = configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n );\n\n if (firstConfiguredLabel) {\n return firstConfiguredLabel.value;\n }\n }\n }\n\n return this.label;\n }\n\n /**\n */\n get defaultAlignment(): \"left\" | \"center\" | \"right\" {\n return \"left\";\n }\n\n /**\n * Handles layout hint align-left, align-center and align-right\n */\n get alignment(): \"left\" | \"center\" | \"right\" {\n const alignmentHints = this.layouthint.getByLayoutHint(\"align-\");\n\n // return alignment based on layouthint or the default alignment for the attribute\n const alignment = alignmentHints\n ? alignmentHints.substring(\"align-\".length)\n : this.defaultAlignment;\n\n if (\n alignment === \"left\" ||\n alignment === \"center\" ||\n alignment === \"right\"\n ) {\n return alignment;\n }\n\n return this.defaultAlignment;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links\n );\n }\n\n return this._links;\n }\n\n /**\n * Retrieve link of attribute when available\n */\n get downloadLink(): ?LinkModel {\n const downloadLink = this.links.getLinksByGroup(\"download\").first;\n\n if (downloadLink && downloadLink.key === this.key) {\n return downloadLink;\n }\n\n return null;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): ?LinkModel {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept ?? null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n * to get information in correct time version\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Initial value received from the modular ui service\n */\n get initvalue(): any {\n return this._initvalue;\n }\n\n /**\n * Retrieve input value\n */\n getInputValue(): string {\n const inputvalue = this._inputvalue;\n\n return inputvalue ? inputvalue.toString() : \"\";\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Value that is used when retrieving an error collection of this attribute\n * Mostly this is the input value, but sometimes a different value is needed,\n * for example iban and postcode need to validate length without spaces\n */\n get validateValue(): string {\n return this.inputvalue;\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.value = value;\n\n this.validate(value);\n }\n\n /**\n */\n hasValue(): boolean {\n return this._value != null && this._value !== \"\";\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): any {\n return this.hasValue() ? this._value : null;\n }\n\n /**\n * Getting data ready to be send to the modular ui\n * Returns null when the attribute should not be send to the server\n */\n getFormData(): { [string]: any } | null {\n if (this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return this.getFormData();\n }\n\n /**\n */\n getEmptyFormData(): { [string]: null } {\n return { [this.name]: null };\n }\n\n /**\n * Getting the value of the attribute\n */\n get value(): any {\n return this.getValue();\n }\n\n /**\n * Setting a value in the element\n */\n set value(value: ?string) {\n this.updateLastModification();\n\n this._value = value;\n }\n\n /**\n */\n formatValue(value: string): string {\n return value;\n }\n\n /**\n * Getting the readonly value, iso value converted for human reading\n */\n get readonlyvalue(): string {\n return this.value ? this.value.toString() : \"\";\n }\n\n /**\n * Getting mandatory status of attribute\n */\n get mandatory(): boolean {\n return this._mandatory || false;\n }\n\n /**\n */\n get configuredMandatory(): ?boolean {\n return this.layouthint.has(MANDATORY) || this.contributions.mandatory;\n }\n\n /**\n * Set mandatory status of attribute\n */\n set mandatory(mandatory: boolean) {\n if (mandatory !== this._mandatory) {\n this._validatedValue = null;\n }\n this._mandatory = mandatory;\n }\n\n /**\n */\n get readonly(): boolean {\n return (\n this._readonly ||\n this.contributions.readonly === true ||\n this.data.static === true ||\n this.isResult === true\n );\n }\n\n /**\n */\n set readonly(readonly: boolean) {\n this._readonly = readonly;\n }\n\n /**\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n */\n set disabled(disabled: boolean) {\n this._disabled = disabled;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._isResult;\n }\n\n /**\n */\n set isResult(isResult: boolean) {\n this._isResult = isResult;\n }\n\n /**\n * Getting the display and input format of a attribute\n */\n get format(): string | null {\n return this.getContribution(\"format\");\n }\n\n /**\n */\n get formatLabel(): string {\n return this.format || \"\";\n }\n\n /**\n * Get minimum string length\n */\n get minLength(): number | null {\n return this.getContribution(\"minLength\");\n }\n\n /**\n * Get maximum string length\n */\n get maxLength(): number | null {\n return this.getContribution(\"maxLength\");\n }\n\n /**\n */\n get operator(): string {\n return \"\";\n }\n\n /**\n * Get assistant message\n */\n get assistantMessage(): string | null {\n return this.getContribution(\"assistant\");\n }\n\n /**\n * Get valid status\n */\n get isValid(): boolean {\n return this.validate(this.validateValue);\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(this._serverConstraints);\n\n // Mandatory constraint\n if (this.mandatory) {\n constraints.add(new MandatoryConstraint());\n }\n\n if (this.minLength || this.maxLength) {\n constraints.add(\n new StringLengthConstraint(this.minLength, this.maxLength)\n );\n }\n\n constraints.add(this.addConstraints());\n\n return constraints;\n }\n\n /**\n * Template method for class extending this model to add extra constraints\n * @abstract\n */\n addConstraints(): ConstraintCollection {\n return new ConstraintCollection();\n }\n\n /**\n * Used to programmatically overwrite the setting USE_CLIENTSIDE_VALIDATION\n */\n setUseClientsideValidation(enabled: boolean) {\n this._useClientsideValidation = enabled;\n }\n\n /**\n * Indicates if client side validation is enabled\n * @returns {boolean}\n */\n useClientsideValidation(): boolean {\n return this._useClientsideValidation ?? true;\n }\n\n /**\n * Validate input on client side constraint\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== value) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = value;\n\n return this._isValid;\n }\n\n /**\n * Indicates if attribute is optional and empty\n */\n isOptionalAndEmpty(value: string): boolean {\n if (value === undefined) {\n throw new IllegalArgumentException(\n \"isOptionalAndEmpty method needs value argument\"\n );\n }\n\n return !this.mandatory && value === \"\";\n }\n\n /**\n * Retrieve error messages of this attribute\n */\n get errorCollection(): ErrorCollection {\n const collection = new ErrorCollection(\"attribute\", this._errorCollection);\n\n collection.addConstraints(\n this.constraintCollection.invalidConstraints(this.validateValue)\n );\n\n return collection;\n }\n\n /**\n * Check if attribute is in error\n */\n inError(): boolean {\n return !this._isValid && this.isChangedSince(0);\n }\n\n /**\n * Reset static error messages on attribute\n */\n resetErrors() {\n this._errorCollection = new ErrorCollection(\"attribute\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n error.properties\n );\n }\n\n /**\n */\n removeServerError(id: string) {\n this._errorCollection.removeServerError(id);\n }\n\n /**\n */\n hasServerErrors(): boolean {\n return this.errorCollection.serverErrors.length > 0;\n }\n\n /**\n */\n hasErrors(): boolean {\n return this.errorCollection.hasItems;\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError() {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n removeMissingError() {\n this.removeServerError(\"Constraint.Missing\");\n }\n\n /**\n */\n addServerConstraint(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters\n ) {\n this._serverConstraints.addConstraint(\n id,\n null,\n defaultMessage,\n parameters,\n this.useClientsideValidation()\n );\n }\n\n /**\n */\n formatParameters(parameters: Object): { [string]: string | number } {\n if (parameters == null) {\n return {};\n }\n\n const params = {};\n\n Object.keys(parameters).forEach((paramKey: string) => {\n const paramValue = parameters[paramKey];\n if (paramKey.endsWith(\"-number\") || paramKey.endsWith(\"-date\")) {\n params[paramKey] = this.formatValue(paramValue);\n } else {\n params[paramKey] = paramValue;\n }\n });\n\n return params;\n }\n\n /**\n */\n get hasDynamicValidationData(): boolean {\n return true;\n }\n\n /**\n */\n updateValidations(errors: Array<Object>) {\n if (\n errors.some((error) => error.id === \"Constraint.Mandatory\") ||\n this.layouthint.has(MANDATORY)\n ) {\n this.mandatory = true;\n } else if (!this.hasValue()) {\n this.mandatory = false;\n }\n\n this._serverConstraints = new ConstraintCollection();\n this.resetErrors();\n\n errors.forEach((error) => {\n if (this.hasValue()) {\n this._errorCollection.addServerError(\n error.id,\n error.message,\n this.formatParameters(error.properties)\n );\n } else {\n this.addServerConstraint(\n error.id,\n error.message,\n this.formatParameters(error.properties)\n );\n }\n });\n }\n\n /**\n * Set last modification to current timestamp\n */\n updateLastModification() {\n this._lastModification = Date.now();\n }\n\n /**\n * Inidicates if attribute is changed since a given timestamp (Date.now)\n */\n isChangedSince(timestamp: number): boolean {\n return this._lastModification > timestamp;\n }\n\n /**\n * Abstract reset method which should be implemented on each attribute that has this attribute as a base class.\n *\n * @abstract\n */\n reset() {\n throw new UnsupportedOperationException(\n `Reset method not implemented for ${this.type}`\n );\n }\n\n /**\n * Merge old attribute with the attribute from the server.\n * Readonly attributes always need to show the value from the server\n */\n mergeAttribute(oldAttribute: AttributeType) {\n this.concept = oldAttribute.concept;\n\n if (\n !oldAttribute.readonly &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(oldAttribute.inputvalue);\n }\n }\n\n /**\n * Abstract update method which should be implemented on each attribute that has this attribute as a base class.\n * @abstract\n */\n // eslint-disable-next-line no-unused-vars\n update(value: string, changedAttribute?: AttributeType): AttributeType {\n throw new UnsupportedOperationException(\n `Update method not implemented for ${this.type}`\n );\n }\n\n /**\n * Indicate if attribute is editable\n */\n set isEditable(isEditable: boolean) {\n this._isEditable = isEditable;\n }\n\n /**\n * Retrieve if attribute is editable\n */\n get isEditable(): boolean {\n return this._isEditable;\n }\n\n /**\n * Indicates if the attribute is visible\n */\n get isVisible(): boolean {\n return !this._isHidden;\n }\n\n /**\n */\n get isHidden(): boolean {\n return this._isHidden;\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n this._isHidden = isHidden;\n }\n\n /**\n * Explicitly toggle visibility of this attribute\n */\n show() {\n this.isHidden = false;\n }\n\n /**\n */\n hide() {\n this.isHidden = true;\n }\n\n /**\n */\n equals(otherAttribute: AttributeType): boolean {\n return (\n this.key === otherAttribute.key &&\n this.parentKey === otherAttribute.parentKey\n );\n }\n\n /**\n * Readonly attribute width indicates the proposed width of this attribute\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n\n /**\n */\n get layoutHintRules(): LayoutHintRuleCollection {\n return this._layoutHintRules;\n }\n\n /**\n */\n set layoutHintRules(rules: LayoutHintRuleCollection) {\n this._layoutHintRules = rules;\n }\n\n /**\n */\n processLayoutHintRules(attributes: AttributeCollection) {\n if (this._layoutHintRules) {\n this.layoutHintRules.process(this, attributes);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return new AttributeContent(this.data.content);\n }\n}\n"],"file":"AttributeModel.js"}
@@ -20,16 +20,16 @@ import BaseModel from "../base/BaseModel";
20
20
  import ChoiceAttributeOptionCollection from "./ChoiceAttributeOptionCollection";
21
21
  import { DateUtil } from "../../utils/datetime/DateTimeUtil";
22
22
  import { has } from "../../utils/helpers/objects";
23
- import { ALL_CONTENT_IN_DATA_SETTING, TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
23
+ import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
24
24
  import { TITLE } from "../../constants/LayoutHints";
25
+ import { hasAllContentInData } from "../../constants/Settings";
25
26
  import LinkCollection from "../links/LinkCollection";
26
27
  import AttributeCollection from "./AttributeCollection";
27
28
  import ConceptDetailModel from "../concepts/ConceptDetailModel";
28
- import { getSetting } from "../../constants";
29
29
  import AttributeContent from "./AttributeContent";
30
+
30
31
  /**
31
32
  */
32
-
33
33
  var ChoiceAttributeOptionModel = /*#__PURE__*/function (_BaseModel) {
34
34
  _inherits(ChoiceAttributeOptionModel, _BaseModel);
35
35
 
@@ -401,7 +401,7 @@ var ChoiceAttributeOptionModel = /*#__PURE__*/function (_BaseModel) {
401
401
  }, {
402
402
  key: "hasContentFromData",
403
403
  get: function get() {
404
- return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
404
+ return hasAllContentInData();
405
405
  }
406
406
  /**
407
407
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"names":["BaseModel","ChoiceAttributeOptionCollection","DateUtil","has","ALL_CONTENT_IN_DATA_SETTING","TIMEVERSION_FILTER_NAME","TITLE","LinkCollection","AttributeCollection","ConceptDetailModel","getSetting","AttributeContent","ChoiceAttributeOptionModel","selectedValues","option","referenceDate","now","code","contributions","key","_isSelected","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","_content","content","initialLinks","hasContentFromData","conceptLink","push","children","getInitialChildModelLinks","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","setChildModels","_code","toString","attributeCollection","getContribution","data","label","hasItems","title","getAttributeByLayoutHint","readonlyvalue","first","contentConfiguration","configuredLabelProperties","labelConfig","types","length","configuredLabels","getLabelElementByIds","configuredLabel","value","configuredLabelProperty","some","_id","selected","create","options","links","date","getLinkByKey","addParameter","isCacheable","_concept","level","withOption","mergeOptions","listitem","id"],"mappings":";;;;;;;;;;;;;;;;;;AACA,OAAOA,SAAP,MAAsB,mBAAtB;AACA,OAAOC,+BAAP,MAA4C,mCAA5C;AAEA,SAASC,QAAT,QAAyB,mCAAzB;AACA,SAASC,GAAT,QAAoB,6BAApB;AACA,SACEC,2BADF,EAEEC,uBAFF,QAGO,2BAHP;AAIA,SAASC,KAAT,QAAsB,6BAAtB;AAEA,OAAOC,cAAP,MAA2B,yBAA3B;AACA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,OAAOC,kBAAP,MAA+B,gCAA/B;AAKA,SAASC,UAAT,QAA2B,iBAA3B;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AAEA;AACA;;IACMC,0B;;;;;AAWJ;AACF;AACE,wCAIE;AAAA;;AAAA;;AAAA,QAHAC,cAGA,uEAHgC,EAGhC;AAAA,QAFAC,MAEA,uEAFiB,EAEjB;AAAA,QADAC,aACA,uEAD0Bb,QAAQ,CAACc,GAAT,EAC1B;;AAAA;;AACA,8BAAM,EAAN,EAAUF,MAAV;;AADA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAGA,UAAKG,IAAL,oCAAY,MAAKC,aAAL,CAAmBD,IAA/B,yEAAuC,MAAKC,aAAL,CAAmBC,GAA1D,uCAAiE,EAAjE;AAEA,UAAKC,WAAL,GAAmB,0BAAAP,cAAc,MAAd,CAAAA,cAAc,EAAU,MAAKI,IAAf,CAAjC;AAEA,UAAKI,cAAL,GAAsBN,aAAtB;AAEA,UAAKO,MAAL,GAAc,CAAd;AAEA,UAAKC,oBAAL,GAA4B,MAAKC,yBAAL,EAA5B;AACA,UAAKC,SAAL,GAAiB,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O,KAAKjB,MAAZ;AACD;AAED;AACF;AACA;;SACE,aAAUsD,KAAV,EAAyB;AACvB,WAAKtD,MAAL,GAAcsD,KAAd;AACD;AAED;AACF;;;;SACE,eAA6B;AAC3B,aAAO,KAAK7B,eAAL,CAAqB,eAArB,EAAsC,KAAtC,CAAP;AACD;AAED;AACF;;;;SACE,eAAmC;AACjC,aAAO,KAAKA,eAAL,CAAqB,qBAArB,EAA4C,KAA5C,CAAP;AACD;AAED;AACF;;;;WACE,qBAAY8B,UAAZ,EAAoD;AAClD,WAAKtC,OAAL,GAAesC,UAAU,CAACtC,OAA1B;;AAEA,UAAI,KAAKL,QAAL,IAAiB,IAAjB,IAAyB2C,UAAU,CAAC3C,QAAX,IAAuB,IAApD,EAA0D;AACxD,aAAKA,QAAL,CAAc4C,YAAd,CAA2BD,UAAU,CAAC3C,QAAtC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAOxB,UAAU,CAACN,2BAAD,EAA8B,IAA9B,CAAjB;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,KAAKwB,QAAZ;AACD;;;WAjTD,iCACEmD,QADF,EAE8B;AAC5B,UAAMjE,MAAM,GAAG,IAAIF,0BAAJ,EAAf;AAEAE,MAAAA,MAAM,CAACG,IAAP,GAAc8D,QAAQ,CAACC,EAAT,CAAYnC,QAAZ,EAAd;AACA/B,MAAAA,MAAM,CAACgC,mBAAP,GAA6BiC,QAAQ,CAACjC,mBAAtC;AACAhC,MAAAA,MAAM,CAACwD,KAAP,GAAeS,QAAQ,CAACT,KAAxB;AAEA,aAAOxD,MAAP;AACD;;;;EAhDsCd,S;;AA0VzC,eAAeY,0BAAf","sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { has } from \"../../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n TIMEVERSION_FILTER_NAME,\n} from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\nimport { getSetting } from \"../../constants\";\nimport AttributeContent from \"./AttributeContent\";\n\n/**\n */\nclass ChoiceAttributeOptionModel extends BaseModel {\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate = referenceDate;\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection();\n this._children = this.addChildren(selectedValues, option, referenceDate);\n\n this._links = new LinkCollection(this.contributions._links);\n\n this._content = new AttributeContent(option.content);\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection;\n option.links = listitem.links;\n\n return option;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref)\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, true);\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n if (this.attributeCollection.first) {\n return this.attributeCollection.first.readonlyvalue;\n }\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\"\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection();\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n referenceDate\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"file":"ChoiceAttributeOptionModel.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/ChoiceAttributeOptionModel.js"],"names":["BaseModel","ChoiceAttributeOptionCollection","DateUtil","has","TIMEVERSION_FILTER_NAME","TITLE","hasAllContentInData","LinkCollection","AttributeCollection","ConceptDetailModel","AttributeContent","ChoiceAttributeOptionModel","selectedValues","option","referenceDate","now","code","contributions","key","_isSelected","_referenceDate","_level","_attributeCollection","createAttributeCollection","_children","addChildren","_links","_content","content","initialLinks","hasContentFromData","conceptLink","push","children","getInitialChildModelLinks","models","conceptHref","href","concept","model","selfhref","equalsWithParameters","setChildModels","_code","toString","attributeCollection","getContribution","data","label","hasItems","title","getAttributeByLayoutHint","readonlyvalue","first","contentConfiguration","configuredLabelProperties","labelConfig","types","length","configuredLabels","getLabelElementByIds","configuredLabel","value","configuredLabelProperty","some","_id","selected","create","options","links","date","getLinkByKey","addParameter","isCacheable","_concept","level","withOption","mergeOptions","listitem","id"],"mappings":";;;;;;;;;;;;;;;;;;AACA,OAAOA,SAAP,MAAsB,mBAAtB;AACA,OAAOC,+BAAP,MAA4C,mCAA5C;AAEA,SAASC,QAAT,QAAyB,mCAAzB;AACA,SAASC,GAAT,QAAoB,6BAApB;AACA,SA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AA1B;;AAEA,UAAI,KAAKL,QAAL,IAAiB,IAAjB,IAAyB2C,UAAU,CAAC3C,QAAX,IAAuB,IAApD,EAA0D;AACxD,aAAKA,QAAL,CAAc4C,YAAd,CAA2BD,UAAU,CAAC3C,QAAtC;AACD;AACF;AAED;AACF;AACA;;;;SACE,eAAkC;AAChC,aAAO3B,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAAgC;AAC9B,aAAO,KAAKqB,QAAZ;AACD;;;WAjTD,iCACEmD,QADF,EAE8B;AAC5B,UAAMjE,MAAM,GAAG,IAAIF,0BAAJ,EAAf;AAEAE,MAAAA,MAAM,CAACG,IAAP,GAAc8D,QAAQ,CAACC,EAAT,CAAYnC,QAAZ,EAAd;AACA/B,MAAAA,MAAM,CAACgC,mBAAP,GAA6BiC,QAAQ,CAACjC,mBAAtC;AACAhC,MAAAA,MAAM,CAACwD,KAAP,GAAeS,QAAQ,CAACT,KAAxB;AAEA,aAAOxD,MAAP;AACD;;;;EAhDsCb,S;;AA0VzC,eAAeW,0BAAf","sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\n\nimport { DateUtil } from \"../../utils/datetime/DateTimeUtil\";\nimport { has } from \"../../utils/helpers/objects\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport { TITLE } from \"../../constants/LayoutHints\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport AttributeCollection from \"./AttributeCollection\";\nimport ConceptDetailModel from \"../concepts/ConceptDetailModel\";\nimport AttributeContent from \"./AttributeContent\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type ListItemModel from \"../list/ListItemModel\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n */\nclass ChoiceAttributeOptionModel extends BaseModel {\n _code: string;\n _isSelected: boolean;\n _referenceDate: ISO_DATE;\n _level: number;\n _children: ChoiceAttributeOptionCollection;\n _concept: ?ConceptDetailModel;\n _links: LinkCollection;\n _attributeCollection: AttributeCollection;\n _content: AttributeContent;\n\n /**\n */\n constructor(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ) {\n super({}, option);\n\n this.code = this.contributions.code ?? this.contributions.key ?? \"\";\n\n this._isSelected = selectedValues.includes(this.code);\n\n this._referenceDate = referenceDate;\n\n this._level = 0;\n\n this._attributeCollection = this.createAttributeCollection();\n this._children = this.addChildren(selectedValues, option, referenceDate);\n\n this._links = new LinkCollection(this.contributions._links);\n\n this._content = new AttributeContent(option.content);\n }\n\n /**\n */\n static createFromListItemModel(\n listitem: ListItemModel\n ): ChoiceAttributeOptionModel {\n const option = new ChoiceAttributeOptionModel();\n\n option.code = listitem.id.toString();\n option.attributeCollection = listitem.attributeCollection;\n option.links = listitem.links;\n\n return option;\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const initialLinks = [];\n\n if (!this.hasContentFromData && this.conceptLink !== null) {\n initialLinks.push(this.conceptLink);\n }\n\n if (this.children) {\n initialLinks.push(...this.children.getInitialChildModelLinks());\n }\n\n return initialLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n if (this.conceptLink !== null) {\n const conceptHref = this.conceptLink.href;\n\n this.concept = models.find((model) =>\n model.selfhref.equalsWithParameters(conceptHref)\n );\n }\n\n if (this.children) {\n this.children.setChildModels(models);\n }\n }\n\n /**\n * Get code of option\n */\n get code(): string {\n return this._code;\n }\n\n /**\n */\n set code(code: string) {\n this._code = code;\n }\n\n /**\n */\n equals(model: ChoiceAttributeOptionModel): boolean {\n return this.code.toString() === model.code.toString();\n }\n\n /**\n * Retrieve attributes for Composite codemaps (e.g. table and case list codemaps)\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(attributeCollection: AttributeCollection) {\n this._attributeCollection = attributeCollection;\n }\n\n /**\n */\n createAttributeCollection(): AttributeCollection {\n const contributions = this.getContribution(\"elementsContributions\", []);\n\n if (has(this.contributions, \"elements\")) {\n const data = this.getContribution(\"elements\", {});\n return new AttributeCollection(data, contributions, true);\n }\n\n return new AttributeCollection();\n }\n\n /**\n * Get label of option for simple codemaps (e.g. static codemap)\n */\n get label(): string {\n if (this.contributions.label) {\n return this.contributions.label;\n }\n\n if (this.attributeCollection.hasItems) {\n const title = this.attributeCollection.getAttributeByLayoutHint(TITLE);\n\n if (title) {\n return title.readonlyvalue;\n }\n\n if (this.attributeCollection.first) {\n return this.attributeCollection.first.readonlyvalue;\n }\n }\n\n return \"\";\n }\n\n /**\n * Retrieve the first permitted label to render when a concept and contentConfiguration is available\n * Be aware that permission could be in place for labels from a concept.\n */\n getContentConfiguredLabel(contentConfiguration: Object): string {\n const configuredLabelProperties =\n contentConfiguration?.labelConfig?.[0]?.types ?? [];\n\n if (\n !this.hasContentFromData &&\n this.concept &&\n configuredLabelProperties.length > 0\n ) {\n const configuredLabels = this.concept\n .getLabelElementByIds(configuredLabelProperties)\n .filter(\n (configuredLabel) =>\n configuredLabel.value && configuredLabel.value !== \"\"\n );\n\n if (configuredLabels.length > 0) {\n return configuredLabelProperties\n .filter((configuredLabelProperty) =>\n configuredLabels.some(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )\n .map((configuredLabelProperty) =>\n configuredLabels.find(\n (configuredLabel) =>\n configuredLabel._id === configuredLabelProperty\n )\n )[0].value;\n }\n }\n\n return this.label;\n }\n\n /**\n * Indicates if option is selected\n */\n get selected(): boolean {\n return this._isSelected;\n }\n\n /**\n * Set selected property of option\n */\n set selected(selected: boolean) {\n this._isSelected = selected;\n }\n\n /**\n * Retrieve count of filter for option\n */\n get count(): number | null {\n return this.getContribution(\"count\");\n }\n\n /**\n */\n addChildren(\n selectedValues: Array<string> = [],\n option: Object = {},\n referenceDate: ISO_DATE = DateUtil.now()\n ): ChoiceAttributeOptionCollection {\n // When contributions contain elements this is a list not nested options\n if (has(option, \"elements\")) {\n return new ChoiceAttributeOptionCollection();\n }\n\n return ChoiceAttributeOptionCollection.create(\n {\n value: selectedValues,\n },\n { options: option?.children ?? [] },\n referenceDate\n );\n }\n\n /**\n * get children of option\n */\n get children(): ChoiceAttributeOptionCollection {\n return this._children;\n }\n\n /**\n * Retrieve links of attribute\n */\n get links(): LinkCollection {\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * referenceDate received from attribute\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n */\n set referenceDate(date: ISO_DATE) {\n this._referenceDate = date;\n }\n\n /**\n * Retrieve concept link of attribute when available\n */\n get conceptLink(): LinkModel | null {\n const conceptLink = this.links.getLinkByKey(\"concept\");\n if (conceptLink !== null) {\n conceptLink.href = conceptLink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this.referenceDate\n );\n\n conceptLink.isCacheable = true;\n }\n\n return conceptLink;\n }\n\n /**\n * Get concept information\n */\n get concept(): ConceptDetailModel | null {\n return this._concept || null;\n }\n\n /**\n * Set the concept\n */\n set concept(concept: ?ModularUIModel) {\n this._concept = concept instanceof ConceptDetailModel ? concept : null;\n }\n\n /**\n * Get level of option, used in tree view choice attributes (taxonomy)\n */\n get level(): number {\n return this._level;\n }\n\n /**\n * Set level of option\n */\n set level(level: number) {\n this._level = level;\n }\n\n /**\n */\n get isBooleanType(): boolean {\n return this.getContribution(\"isBooleanType\", false);\n }\n\n /**\n */\n get hasAlternativeLabel(): boolean {\n return this.getContribution(\"hasAlternativeLabel\", false);\n }\n\n /**\n */\n mergeOption(withOption: ChoiceAttributeOptionModel) {\n this.concept = withOption.concept;\n\n if (this.children != null && withOption.children != null) {\n this.children.mergeOptions(withOption.children);\n }\n }\n\n /**\n * Indicates if content comes from the data service\n */\n get hasContentFromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get content(): AttributeContent {\n return this._content;\n }\n}\n\nexport default ChoiceAttributeOptionModel;\n"],"file":"ChoiceAttributeOptionModel.js"}
@@ -41,7 +41,21 @@ var HelptextAttributeModel = /*#__PURE__*/function (_LabelAttributeModel) {
41
41
  }, {
42
42
  key: "text",
43
43
  get: function get() {
44
- return this.getContribution("text");
44
+ var dataText = this.getData("value");
45
+
46
+ if (dataText) {
47
+ return dataText.message;
48
+ }
49
+
50
+ var contributionText = this.getContribution("text");
51
+
52
+ if (contributionText) {
53
+ var _contributionText$mes;
54
+
55
+ return (_contributionText$mes = contributionText.message) !== null && _contributionText$mes !== void 0 ? _contributionText$mes : contributionText;
56
+ }
57
+
58
+ return null;
45
59
  }
46
60
  }], [{
47
61
  key: "isApplicableModel",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/models/attributes/HelptextAttributeModel.js"],"names":["has","LabelAttributeModel","HelptextAttributeModel","getContribution","contributions","type","readonly"],"mappings":";;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,mBAAP,MAAgC,uBAAhC;AAEA;AACA;AACA;;IACqBC,sB;;;;;;;;;;;;;;AAUnB;AACF;AACE,mBAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;AACA;;;;SACE,eAA0B;AACxB,aAAO,KAAKC,eAAL,CAAqB,MAArB,CAAP;AACD;;;;AApBD;AACF;AACE,+BAAyBC,aAAzB,EAAyD;AACvD,aACEA,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCD,aAAa,CAACE,QAAd,IAA0BN,GAAG,CAACI,aAAD,EAAgB,MAAhB,CAFhC;AAID;;;;EARiDH,mB;;SAA/BC,sB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport LabelAttributeModel from \"./LabelAttributeModel\";\n\n/**\n * Helptext attribute\n */\nexport default class HelptextAttributeModel extends LabelAttributeModel {\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type === \"helptext\" ||\n (contributions.readonly && has(contributions, \"text\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"helptext\";\n }\n\n /**\n * Get helptext text\n */\n get text(): string | null {\n return this.getContribution(\"text\");\n }\n}\n"],"file":"HelptextAttributeModel.js"}
1
+ {"version":3,"sources":["../../../src/models/attributes/HelptextAttributeModel.js"],"names":["has","LabelAttributeModel","HelptextAttributeModel","dataText","getData","message","contributionText","getContribution","contributions","type","readonly"],"mappings":";;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,6BAApB;AAEA,OAAOC,mBAAP,MAAgC,uBAAhC;AAEA;AACA;AACA;;IACqBC,sB;;;;;;;;;;;;;;AAUnB;AACF;AACE,mBAAmB;AACjB,aAAO,UAAP;AACD;AAED;AACF;AACA;;;;SACE,eAA0B;AACxB,UAAMC,QAAQ,GAAG,KAAKC,OAAL,CAAa,OAAb,CAAjB;;AACA,UAAID,QAAJ,EAAc;AACZ,eAAOA,QAAQ,CAACE,OAAhB;AACD;;AAED,UAAMC,gBAAgB,GAAG,KAAKC,eAAL,CAAqB,MAArB,CAAzB;;AACA,UAAID,gBAAJ,EAAsB;AAAA;;AACpB,wCAAOA,gBAAgB,CAACD,OAAxB,yEAAmCC,gBAAnC;AACD;;AAED,aAAO,IAAP;AACD;;;;AA9BD;AACF;AACE,+BAAyBE,aAAzB,EAAyD;AACvD,aACEA,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCD,aAAa,CAACE,QAAd,IAA0BV,GAAG,CAACQ,aAAD,EAAgB,MAAhB,CAFhC;AAID;;;;EARiDP,mB;;SAA/BC,sB","sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport LabelAttributeModel from \"./LabelAttributeModel\";\n\n/**\n * Helptext attribute\n */\nexport default class HelptextAttributeModel extends LabelAttributeModel {\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type === \"helptext\" ||\n (contributions.readonly && has(contributions, \"text\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"helptext\";\n }\n\n /**\n * Get helptext text\n */\n get text(): string | null {\n const dataText = this.getData(\"value\");\n if (dataText) {\n return dataText.message;\n }\n\n const contributionText = this.getContribution(\"text\");\n if (contributionText) {\n return contributionText.message ?? contributionText;\n }\n\n return null;\n }\n}\n"],"file":"HelptextAttributeModel.js"}
@@ -5,12 +5,14 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.allSettings = exports.setSettings = exports.setSetting = exports.getSetting = void 0;
8
+ exports.hasAllContentInData = exports.allSettings = exports.setSetting = exports.getSetting = exports.setSettings = void 0;
9
9
 
10
10
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
11
11
 
12
12
  var _objects = require("../utils/helpers/objects");
13
13
 
14
+ var _Constants = require("./Constants");
15
+
14
16
  var defaultSettings = {
15
17
  // Debug missing i18n messages in layout
16
18
  DEBUG_I18N_MESSAGE_NOT_FOUND: true,
@@ -95,6 +97,15 @@ exports.setSetting = setSetting;
95
97
  var allSettings = function allSettings() {
96
98
  return settings;
97
99
  };
100
+ /**
101
+ */
102
+
98
103
 
99
104
  exports.allSettings = allSettings;
105
+
106
+ var hasAllContentInData = function hasAllContentInData() {
107
+ return getSetting(_Constants.ALL_CONTENT_IN_DATA_SETTING, true);
108
+ };
109
+
110
+ exports.hasAllContentInData = hasAllContentInData;
100
111
  //# sourceMappingURL=Settings.js.map
@@ -1,5 +1,6 @@
1
1
  // @flow
2
2
  import { isPlainObject, has } from "../utils/helpers/objects";
3
+ import { ALL_CONTENT_IN_DATA_SETTING } from "./Constants";
3
4
 
4
5
  type Setting = boolean | string | number | Array<string>;
5
6
 
@@ -69,7 +70,7 @@ let settings = defaultSettings;
69
70
 
70
71
  /**
71
72
  */
72
- const setSettings = (config: Object) => {
73
+ export const setSettings = (config: Object) => {
73
74
  if (isPlainObject(config)) {
74
75
  settings = Object.assign(defaultSettings, config);
75
76
  }
@@ -77,7 +78,7 @@ const setSettings = (config: Object) => {
77
78
 
78
79
  /**
79
80
  */
80
- const getSetting = (key: string, defaultValue?: any): any => {
81
+ export const getSetting = (key: string, defaultValue?: any): any => {
81
82
  if (!has(settings, key) && defaultValue === undefined) {
82
83
  throw new Error(
83
84
  `Setting with name ${key} not found and no defaultValue given`
@@ -89,12 +90,15 @@ const getSetting = (key: string, defaultValue?: any): any => {
89
90
 
90
91
  /**
91
92
  */
92
- const setSetting = (key: string, value: any) => {
93
+ export const setSetting = (key: string, value: any) => {
93
94
  settings[key] = value;
94
95
  };
95
96
 
96
97
  /**
97
98
  */
98
- const allSettings = (): { [name: string]: Setting } => settings;
99
+ export const allSettings = (): { [name: string]: Setting } => settings;
99
100
 
100
- export { getSetting, setSetting, setSettings, allSettings };
101
+ /**
102
+ */
103
+ export const hasAllContentInData = (): boolean =>
104
+ getSetting(ALL_CONTENT_IN_DATA_SETTING, true);