@beinformed/ui 1.20.9 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/esm/constants/Settings.js +2 -0
- package/esm/constants/Settings.js.map +1 -1
- package/esm/models/attributes/AttributeDataHelper.js +6 -1
- package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
- package/esm/models/error/ErrorModel.js +12 -1
- package/esm/models/error/ErrorModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +111 -0
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/lib/constants/Settings.js +5 -1
- package/lib/constants/Settings.js.flow +3 -0
- package/lib/constants/Settings.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js +6 -1
- package/lib/models/attributes/AttributeDataHelper.js.flow +5 -1
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/error/ErrorModel.js +11 -0
- package/lib/models/error/ErrorModel.js.flow +9 -1
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +110 -0
- package/lib/models/error/ErrorResponse.js.flow +102 -0
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/types.js.flow +1 -0
- package/lib/models/types.js.map +1 -1
- package/lib/redux/actions/__tests__/Error-server.spec.js.flow +0 -1
- package/package.json +5 -5
- package/src/constants/Settings.js +3 -0
- package/src/models/attributes/AttributeDataHelper.js +5 -1
- package/src/models/error/ErrorModel.js +9 -1
- package/src/models/error/ErrorResponse.js +102 -0
- package/src/models/types.js +1 -0
- package/src/redux/actions/__tests__/Error-server.spec.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.21.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.21.0...v1.21.1) (2022-08-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **error:** handle new error response messages ([9ce4d99](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/9ce4d9997a542a98164ff999e83ee0a8a40b0525))
|
|
11
|
+
|
|
12
|
+
## [1.21.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.20.10...v1.21.0) (2022-08-10)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **error:** handle new error response messages ([4373b18](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/4373b18675b2c74119b37734ce106239252c0883))
|
|
18
|
+
|
|
19
|
+
### [1.20.10](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.20.9...v1.20.10) (2022-08-09)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **filter:** handle filters with name 'name' or name 'param' ([1c43e4d](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/1c43e4d5d187885a9c7896b12d023bbb23e63320))
|
|
24
|
+
- **login:** export LOGIN_PATH and LOGOUT_PATH to prevent regression in older layouts ([5382d02](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/5382d02e8adfdffaed1674f27198e4cbd3d499a7))
|
|
25
|
+
|
|
5
26
|
### [1.20.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.20.8...v1.20.9) (2022-08-03)
|
|
6
27
|
|
|
7
28
|
### Bug Fixes
|
|
@@ -117,4 +117,6 @@ export const loginPasswordField = () => getSetting(LOGIN_PASSWORD_SETTING, "j_pa
|
|
|
117
117
|
*/
|
|
118
118
|
|
|
119
119
|
export const logoutPath = () => getSetting(LOGOUT_PATH_SETTING, "/Logoff");
|
|
120
|
+
export const LOGIN_PATH = loginPath();
|
|
121
|
+
export const LOGOUT_PATH = logoutPath();
|
|
120
122
|
//# sourceMappingURL=Settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["isPlainObject","has","ALL_CONTENT_IN_DATA_SETTING","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_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_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","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","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData","loginType","loginPath","loginUsernameField","loginPasswordField","logoutPath"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} 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 // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\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 // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\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 XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: 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\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AACA,SACEC,2BADF,EAEEC,UAFF,EAGEC,kBAHF,EAIEC,sBAJF,EAKEC,sBALF,EAMEC,mBANF,QAOO,aAPP;AAWA,MAAMC,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAOtB;EACAC,kBAAkB,EAAE,KARE;EAUtB;EACAC,sBAAsB,EAAE,IAXF;EAatB;EACAC,qCAAqC,EAAE,IAdjB;EAgBtB;EACAC,oCAAoC,EAAE,KAjBhB;EAmBtB;EACAC,oBAAoB,EAAE,CAAC,UAAD,EAAa,WAAb,CApBA;EAsBtB;EACAC,yBAAyB,EAAE,IAvBL;EAyBtB;EACAC,6BAA6B,EAAE,IA1BT;EA4BtB;EACAC,eAAe,EAAE,CAAC,IAAD,EAAO,IAAP,CA7BK;EA+BtB;EACAC,wBAAwB,EAAE,KAhCJ;EAkCtB;EACAC,yBAAyB,EAAE,KAnCL;EAqCtB;EACAC,wCAAwC,EAAE,KAtCpB;EAwCtB;EACAC,UAAU,EAAE,SAzCU;EA2CtB;EACAC,wBAAwB,EAAE,EA5CJ;EA8CtB;EACAC,WAAW,EAAE,UA/CS;EAiDtB;EACAC,qBAAqB,EAAE,IAlDD;EAoDtB;EACAC,wBAAwB,EAAE,GArDJ;EAuDtB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mB,GAAG,MACjCR,UAAU,CAACzC,2BAAD,EAA8B,IAA9B,CADL;AAGP;AACA;AACA;;AACA,OAAO,MAAMkD,SAAS,GAAG,MAAcT,UAAU,CAACxC,UAAD,EAAa,MAAb,CAA1C;AAEP;AACA;;AACA,OAAO,MAAMkD,SAAS,GAAG,MACvBV,UAAU,CAACvC,kBAAD,EAAqB,mBAArB,CADL;AAEP;AACA;;AACA,OAAO,MAAMkD,kBAAkB,GAAG,MAChCX,UAAU,CAACtC,sBAAD,EAAyB,YAAzB,CADL;AAEP;AACA;;AACA,OAAO,MAAMkD,kBAAkB,GAAG,MAChCZ,UAAU,CAACrC,sBAAD,EAAyB,YAAzB,CADL;AAEP;AACA;;AACA,OAAO,MAAMkD,UAAU,GAAG,MACxBb,UAAU,CAACpC,mBAAD,EAAsB,SAAtB,CADL"}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["isPlainObject","has","ALL_CONTENT_IN_DATA_SETTING","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_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_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","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","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData","loginType","loginPath","loginUsernameField","loginPasswordField","logoutPath"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} 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 // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\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 // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\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 XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: 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\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AACA,SACEC,2BADF,EAEEC,UAFF,EAGEC,kBAHF,EAIEC,sBAJF,EAKEC,sBALF,EAMEC,mBANF,QAOO,aAPP;AAWA,MAAMC,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAOtB;EACAC,kBAAkB,EAAE,KARE;EAUtB;EACAC,sBAAsB,EAAE,IAXF;EAatB;EACAC,qCAAqC,EAAE,IAdjB;EAgBtB;EACAC,oCAAoC,EAAE,KAjBhB;EAmBtB;EACAC,oB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,YAAd,KAA0C;EAAA;;EAClE,IAAI,CAAC5C,GAAG,CAACuC,QAAD,EAAWI,GAAX,CAAJ,IAAuBC,YAAY,KAAKC,SAA5C,EAAuD;IACrD,MAAM,IAAIC,KAAJ,6BACiBH,GADjB,0CAAN;EAGD;;EAED,wBAAOJ,QAAQ,CAACI,GAAD,CAAf,yDAAwBC,YAAxB;AACD,CARM;AAUP;AACA;;AACA,OAAO,MAAMG,UAAU,GAAG,CAACJ,GAAD,EAAcK,KAAd,KAA6B;EACrDT,QAAQ,CAACI,GAAD,CAAR,GAAgBK,KAAhB;AACD,CAFM;AAIP;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,MAAmCV,QAAvD;AAEP;AACA;;AACA,OAAO,MAAMW,mBAAmB,GAAG,MACjCR,UAAU,CAACzC,2BAAD,EAA8B,IAA9B,CADL;AAGP;AACA;AACA;;AACA,OAAO,MAAMkD,SAAS,GAAG,MAAcT,UAAU,CAACxC,UAAD,EAAa,MAAb,CAA1C;AAEP;AACA;;AACA,OAAO,MAAMkD,SAAS,GAAG,MACvBV,UAAU,CAACvC,kBAAD,EAAqB,mBAArB,CADL;AAEP;AACA;;AACA,OAAO,MAAMkD,kBAAkB,GAAG,MAChCX,UAAU,CAACtC,sBAAD,EAAyB,YAAzB,CADL;AAEP;AACA;;AACA,OAAO,MAAMkD,kBAAkB,GAAG,MAChCZ,UAAU,CAACrC,sBAAD,EAAyB,YAAzB,CADL;AAEP;AACA;;AACA,OAAO,MAAMkD,UAAU,GAAG,MACxBb,UAAU,CAACpC,mBAAD,EAAsB,SAAtB,CADL;AAGP,OAAO,MAAMe,UAAkB,GAAG+B,SAAS,EAApC;AACP,OAAO,MAAM7B,WAAmB,GAAGgC,UAAU,EAAtC"}
|
|
@@ -36,7 +36,12 @@ class AttributeDataHelper {
|
|
|
36
36
|
const attributeData = cloneDeep(data);
|
|
37
37
|
attributeData._links = pick(data._links, ["concept", "download", "lookupOptions", "lookupList"]);
|
|
38
38
|
this._attribute = attributeData;
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
if (data[key] === undefined || "name" in data && "param" in data) {
|
|
41
|
+
this._value = this.getValue(data);
|
|
42
|
+
} else {
|
|
43
|
+
this._value = data[key];
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
this._children = this.createChildren(data, childrenKeys);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeDataHelper.js","names":["cloneDeep","pick","has","isPlainObject","AttributeDataHelper","constructor","data","key","childrenKeys","_key","Array","isArray","_attribute","attr","elementid","name","param","_value","getValue","attributeData","_links","undefined","_children","createChildren","childData","parentKey","childKey","elements","element","parentData","content","createChild","keyObject","dynamicschema","dynamicschemaId","children","childrenIsArray","value","attribute","suggestions","suggestion","options","option","selected","code","static","links","attrDS","message","isResult","referenceDate","pickedContent","length","getData","child","subChild"],"sources":["../../../src/models/attributes/AttributeDataHelper.js"],"sourcesContent":["// @flow\nimport cloneDeep from \"lodash/cloneDeep\";\nimport pick from \"lodash/pick\";\n\nimport { has, isPlainObject } from \"../../utils/helpers/objects\";\n\n/**\n * This util helps to normalize various attribute data formats available in the modular ui.\n * It fixes differences in choice attributes with dynamic schema's, links on download attributes, composites with various children, etc\n *\n * @private\n */\nclass AttributeDataHelper {\n _key: string;\n _attribute: Object;\n _value: any;\n _children: Array<AttributeDataHelper>;\n\n /**\n */\n constructor(\n data: Object | Array<Object>,\n key: string,\n childrenKeys: Array<Object>\n ) {\n this._key = key;\n\n if (Array.isArray(data)) {\n this._attribute =\n data.find(\n (attr) =>\n attr.elementid === key || attr.name === key || attr.param === key\n ) || {};\n this._value = this.getValue(this._attribute);\n } else {\n const attributeData = cloneDeep(data);\n attributeData._links = pick(data._links, [\n \"concept\",\n \"download\",\n \"lookupOptions\",\n \"lookupList\",\n ]);\n\n this._attribute = attributeData;\n\n this._value = data[key] === undefined ? this.getValue(data) : data[key];\n }\n\n this._children = this.createChildren(data, childrenKeys);\n }\n\n /**\n */\n childData(\n data: Object | Array<Object>,\n parentKey: string,\n childKey: string\n ): Object {\n if (Array.isArray(data)) {\n if (Array.isArray(this._attribute.elements)) {\n return this._attribute.elements.find(\n (element) => element.elementid === childKey\n );\n }\n } else if (has(data, parentKey) && isPlainObject(data[parentKey])) {\n const parentData = data[parentKey];\n if (isPlainObject(parentData) && data.content?.[childKey]) {\n return { ...parentData, content: data.content[childKey] };\n }\n return parentData;\n } else if (has(data, childKey) && isPlainObject(data[childKey])) {\n return data[childKey];\n }\n\n if (isPlainObject(data)) {\n return data;\n }\n\n return {};\n }\n\n /**\n */\n createChild(\n data: Object | Array<Object>,\n childData: Object,\n keyObject: Object\n ): AttributeDataHelper {\n const dynamicschema =\n isPlainObject(data) && !Array.isArray(data)\n ? data.dynamicschema\n : undefined;\n\n let dynamicschemaId = null;\n if (keyObject.dynamicschemaId) {\n dynamicschemaId = keyObject.dynamicschemaId;\n } else if (\n isPlainObject(data) &&\n typeof data.key === \"string\" &&\n keyObject.key\n ) {\n dynamicschemaId = `${data.key}.${keyObject.key}`;\n }\n\n return new AttributeDataHelper(\n {\n ...childData,\n dynamicschema,\n dynamicschemaId,\n },\n keyObject.key,\n keyObject.children\n );\n }\n\n /**\n */\n createChildren(\n data: Object | Array<Object>,\n childrenKeys: Array<Object> = []\n ): Array<AttributeDataHelper> {\n const childrenIsArray = Array.isArray(this.value);\n\n if (childrenIsArray) {\n return this.value.map((value) =>\n childrenKeys.map((keyObject) => {\n const childData = this.childData(value, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n })\n );\n }\n\n return childrenKeys.map((keyObject) => {\n const childData = this.childData(data, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n });\n }\n\n /**\n */\n getValue(attribute: Object): any {\n if (\"values\" in attribute) {\n return attribute.values;\n }\n\n if (\"value\" in attribute) {\n return attribute.value;\n }\n\n if (\"suggestions\" in attribute) {\n return attribute.suggestions;\n }\n\n if (\"suggestion\" in attribute) {\n return attribute.suggestion;\n }\n\n if (Array.isArray(attribute.options)) {\n return attribute.options\n .filter((option) => option.selected)\n .map((option) => option.code || option.key);\n }\n\n return null;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n get value(): any {\n return this._value;\n }\n\n /**\n */\n get static(): boolean {\n return this._attribute.static || false;\n }\n\n /**\n */\n get links(): any {\n return this._attribute._links || void 0;\n }\n\n /**\n */\n get dynamicschemaId(): string {\n return this._attribute.dynamicschemaId || this.key;\n }\n\n /*\n retrieve the dynamischema by the dynamischemaId\n mentioned in the contributions of the attribute\n */\n /**\n */\n get dynamicschema(): any {\n const { dynamicschema } = this._attribute;\n if (!dynamicschema) {\n return void 0;\n }\n\n if (Array.isArray(dynamicschema)) {\n return dynamicschema;\n } else if (dynamicschema[this.dynamicschemaId]) {\n const attrDS = dynamicschema[this.dynamicschemaId];\n return attrDS.map((attr) => {\n if (attr.elements) {\n return {\n ...attr,\n elements: {\n ...attr.elements,\n dynamicschema,\n },\n };\n }\n\n return attr;\n });\n }\n\n return void 0;\n }\n\n /**\n */\n get options(): any {\n return this._attribute.options || void 0;\n }\n\n /**\n */\n get message(): any {\n return this._attribute.message || void 0;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._attribute.isResult || false;\n }\n\n /**\n */\n get referenceDate(): any {\n return this._attribute.referenceDate || void 0;\n }\n\n /**\n */\n get children(): Array<AttributeDataHelper> {\n return this._children || [];\n }\n\n /**\n */\n get content(): Object {\n if (this._attribute.content) {\n const pickedContent = pick(this._attribute.content, [\n \"header\",\n \"label\",\n \"elements\",\n \"layouthint\",\n \"text\",\n ]);\n\n if (Object.keys(pickedContent).length > 0) {\n return pickedContent;\n }\n }\n\n return null;\n }\n\n /**\n */\n getData(): Object {\n return {\n key: this.key,\n value: this.value,\n static: this.static,\n _links: this.links,\n dynamicschema: this.dynamicschema,\n dynamicschemaId: this.dynamicschemaId,\n options: this.options,\n message: this.message,\n isResult: this.isResult,\n referenceDate: this.referenceDate,\n children: this.children.map((child) =>\n Array.isArray(child)\n ? child.map((subChild) => subChild.getData())\n : child.getData()\n ),\n content: this.content,\n };\n }\n}\n\nexport default AttributeDataHelper;\n"],"mappings":";;;;;;;AACA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,IAAP,MAAiB,aAAjB;AAEA,SAASC,GAAT,EAAcC,aAAd,QAAmC,6BAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAN,CAA0B;EAMxB;AACF;EACEC,WAAW,CACTC,IADS,EAETC,GAFS,EAGTC,YAHS,EAIT;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,IAAL,GAAYF,GAAZ;;IAEA,IAAIG,KAAK,CAACC,OAAN,CAAcL,IAAd,CAAJ,EAAyB;MACvB,KAAKM,UAAL,GACE,sBAAAN,IAAI,MAAJ,CAAAA,IAAI,EACDO,IAAD,IACEA,IAAI,CAACC,SAAL,KAAmBP,GAAnB,IAA0BM,IAAI,CAACE,IAAL,KAAcR,GAAxC,IAA+CM,IAAI,CAACG,KAAL,KAAeT,GAF9D,CAAJ,IAGK,EAJP;MAKA,KAAKU,MAAL,GAAc,KAAKC,QAAL,CAAc,KAAKN,UAAnB,CAAd;IACD,CAPD,MAOO;MACL,MAAMO,aAAa,GAAGnB,SAAS,CAACM,IAAD,CAA/B;MACAa,aAAa,CAACC,MAAd,GAAuBnB,IAAI,CAACK,IAAI,CAACc,MAAN,EAAc,CACvC,SADuC,EAEvC,UAFuC,EAGvC,eAHuC,EAIvC,YAJuC,CAAd,CAA3B;MAOA,KAAKR,UAAL,GAAkBO,aAAlB;MAEA,KAAKF,MAAL,GAAcX,IAAI,CAACC,GAAD,CAAJ,KAAcc,SAAd,GAA0B,KAAKH,QAAL,CAAcZ,IAAd,CAA1B,GAAgDA,IAAI,CAACC,GAAD,CAAlE;IACD;;IAED,KAAKe,SAAL,GAAiB,KAAKC,cAAL,CAAoBjB,IAApB,EAA0BE,YAA1B,CAAjB;EACD;EAED;AACF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;;MAQA,IAAI,aAAYqB,aAAZ,EAA2BC,MAA3B,GAAoC,CAAxC,EAA2C;QACzC,OAAOD,aAAP;MACD;IACF;;IAED,OAAO,IAAP;EACD;EAED;AACF;;;EACEE,OAAO,GAAW;IAAA;;IAChB,OAAO;MACL9C,GAAG,EAAE,KAAKA,GADL;MAEL8B,KAAK,EAAE,KAAKA,KAFP;MAGLQ,MAAM,EAAE,KAAKA,MAHR;MAILzB,MAAM,EAAE,KAAK0B,KAJR;MAKLb,aAAa,EAAE,KAAKA,aALf;MAMLC,eAAe,EAAE,KAAKA,eANjB;MAOLO,OAAO,EAAE,KAAKA,OAPT;MAQLO,OAAO,EAAE,KAAKA,OART;MASLC,QAAQ,EAAE,KAAKA,QATV;MAULC,aAAa,EAAE,KAAKA,aAVf;MAWLf,QAAQ,EAAE,sCAAKA,QAAL,kBAAmBmB,KAAD,IAC1B5C,KAAK,CAACC,OAAN,CAAc2C,KAAd,IACI,qBAAAA,KAAK,MAAL,CAAAA,KAAK,EAAMC,QAAD,IAAcA,QAAQ,CAACF,OAAT,EAAnB,CADT,GAEIC,KAAK,CAACD,OAAN,EAHI,CAXL;MAgBLvB,OAAO,EAAE,KAAKA;IAhBT,CAAP;EAkBD;;AAnSuB;;AAsS1B,eAAe1B,mBAAf"}
|
|
1
|
+
{"version":3,"file":"AttributeDataHelper.js","names":["cloneDeep","pick","has","isPlainObject","AttributeDataHelper","constructor","data","key","childrenKeys","_key","Array","isArray","_attribute","attr","elementid","name","param","_value","getValue","attributeData","_links","undefined","_children","createChildren","childData","parentKey","childKey","elements","element","parentData","content","createChild","keyObject","dynamicschema","dynamicschemaId","children","childrenIsArray","value","attribute","suggestions","suggestion","options","option","selected","code","static","links","attrDS","message","isResult","referenceDate","pickedContent","length","getData","child","subChild"],"sources":["../../../src/models/attributes/AttributeDataHelper.js"],"sourcesContent":["// @flow\nimport cloneDeep from \"lodash/cloneDeep\";\nimport pick from \"lodash/pick\";\n\nimport { has, isPlainObject } from \"../../utils/helpers/objects\";\n\n/**\n * This util helps to normalize various attribute data formats available in the modular ui.\n * It fixes differences in choice attributes with dynamic schema's, links on download attributes, composites with various children, etc\n *\n * @private\n */\nclass AttributeDataHelper {\n _key: string;\n _attribute: Object;\n _value: any;\n _children: Array<AttributeDataHelper>;\n\n /**\n */\n constructor(\n data: Object | Array<Object>,\n key: string,\n childrenKeys: Array<Object>\n ) {\n this._key = key;\n\n if (Array.isArray(data)) {\n this._attribute =\n data.find(\n (attr) =>\n attr.elementid === key || attr.name === key || attr.param === key\n ) || {};\n this._value = this.getValue(this._attribute);\n } else {\n const attributeData = cloneDeep(data);\n attributeData._links = pick(data._links, [\n \"concept\",\n \"download\",\n \"lookupOptions\",\n \"lookupList\",\n ]);\n\n this._attribute = attributeData;\n\n if (data[key] === undefined || (\"name\" in data && \"param\" in data)) {\n this._value = this.getValue(data);\n } else {\n this._value = data[key];\n }\n }\n\n this._children = this.createChildren(data, childrenKeys);\n }\n\n /**\n */\n childData(\n data: Object | Array<Object>,\n parentKey: string,\n childKey: string\n ): Object {\n if (Array.isArray(data)) {\n if (Array.isArray(this._attribute.elements)) {\n return this._attribute.elements.find(\n (element) => element.elementid === childKey\n );\n }\n } else if (has(data, parentKey) && isPlainObject(data[parentKey])) {\n const parentData = data[parentKey];\n if (isPlainObject(parentData) && data.content?.[childKey]) {\n return { ...parentData, content: data.content[childKey] };\n }\n return parentData;\n } else if (has(data, childKey) && isPlainObject(data[childKey])) {\n return data[childKey];\n }\n\n if (isPlainObject(data)) {\n return data;\n }\n\n return {};\n }\n\n /**\n */\n createChild(\n data: Object | Array<Object>,\n childData: Object,\n keyObject: Object\n ): AttributeDataHelper {\n const dynamicschema =\n isPlainObject(data) && !Array.isArray(data)\n ? data.dynamicschema\n : undefined;\n\n let dynamicschemaId = null;\n if (keyObject.dynamicschemaId) {\n dynamicschemaId = keyObject.dynamicschemaId;\n } else if (\n isPlainObject(data) &&\n typeof data.key === \"string\" &&\n keyObject.key\n ) {\n dynamicschemaId = `${data.key}.${keyObject.key}`;\n }\n\n return new AttributeDataHelper(\n {\n ...childData,\n dynamicschema,\n dynamicschemaId,\n },\n keyObject.key,\n keyObject.children\n );\n }\n\n /**\n */\n createChildren(\n data: Object | Array<Object>,\n childrenKeys: Array<Object> = []\n ): Array<AttributeDataHelper> {\n const childrenIsArray = Array.isArray(this.value);\n\n if (childrenIsArray) {\n return this.value.map((value) =>\n childrenKeys.map((keyObject) => {\n const childData = this.childData(value, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n })\n );\n }\n\n return childrenKeys.map((keyObject) => {\n const childData = this.childData(data, this.key, keyObject.key);\n\n return this.createChild(data, childData, keyObject);\n });\n }\n\n /**\n */\n getValue(attribute: Object): any {\n if (\"values\" in attribute) {\n return attribute.values;\n }\n\n if (\"value\" in attribute) {\n return attribute.value;\n }\n\n if (\"suggestions\" in attribute) {\n return attribute.suggestions;\n }\n\n if (\"suggestion\" in attribute) {\n return attribute.suggestion;\n }\n\n if (Array.isArray(attribute.options)) {\n return attribute.options\n .filter((option) => option.selected)\n .map((option) => option.code || option.key);\n }\n\n return null;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n get value(): any {\n return this._value;\n }\n\n /**\n */\n get static(): boolean {\n return this._attribute.static || false;\n }\n\n /**\n */\n get links(): any {\n return this._attribute._links || void 0;\n }\n\n /**\n */\n get dynamicschemaId(): string {\n return this._attribute.dynamicschemaId || this.key;\n }\n\n /*\n retrieve the dynamischema by the dynamischemaId\n mentioned in the contributions of the attribute\n */\n /**\n */\n get dynamicschema(): any {\n const { dynamicschema } = this._attribute;\n if (!dynamicschema) {\n return void 0;\n }\n\n if (Array.isArray(dynamicschema)) {\n return dynamicschema;\n } else if (dynamicschema[this.dynamicschemaId]) {\n const attrDS = dynamicschema[this.dynamicschemaId];\n return attrDS.map((attr) => {\n if (attr.elements) {\n return {\n ...attr,\n elements: {\n ...attr.elements,\n dynamicschema,\n },\n };\n }\n\n return attr;\n });\n }\n\n return void 0;\n }\n\n /**\n */\n get options(): any {\n return this._attribute.options || void 0;\n }\n\n /**\n */\n get message(): any {\n return this._attribute.message || void 0;\n }\n\n /**\n */\n get isResult(): boolean {\n return this._attribute.isResult || false;\n }\n\n /**\n */\n get referenceDate(): any {\n return this._attribute.referenceDate || void 0;\n }\n\n /**\n */\n get children(): Array<AttributeDataHelper> {\n return this._children || [];\n }\n\n /**\n */\n get content(): Object {\n if (this._attribute.content) {\n const pickedContent = pick(this._attribute.content, [\n \"header\",\n \"label\",\n \"elements\",\n \"layouthint\",\n \"text\",\n ]);\n\n if (Object.keys(pickedContent).length > 0) {\n return pickedContent;\n }\n }\n\n return null;\n }\n\n /**\n */\n getData(): Object {\n return {\n key: this.key,\n value: this.value,\n static: this.static,\n _links: this.links,\n dynamicschema: this.dynamicschema,\n dynamicschemaId: this.dynamicschemaId,\n options: this.options,\n message: this.message,\n isResult: this.isResult,\n referenceDate: this.referenceDate,\n children: this.children.map((child) =>\n Array.isArray(child)\n ? child.map((subChild) => subChild.getData())\n : child.getData()\n ),\n content: this.content,\n };\n }\n}\n\nexport default AttributeDataHelper;\n"],"mappings":";;;;;;;AACA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,IAAP,MAAiB,aAAjB;AAEA,SAASC,GAAT,EAAcC,aAAd,QAAmC,6BAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAN,CAA0B;EAMxB;AACF;EACEC,WAAW,CACTC,IADS,EAETC,GAFS,EAGTC,YAHS,EAIT;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,IAAL,GAAYF,GAAZ;;IAEA,IAAIG,KAAK,CAACC,OAAN,CAAcL,IAAd,CAAJ,EAAyB;MACvB,KAAKM,UAAL,GACE,sBAAAN,IAAI,MAAJ,CAAAA,IAAI,EACDO,IAAD,IACEA,IAAI,CAACC,SAAL,KAAmBP,GAAnB,IAA0BM,IAAI,CAACE,IAAL,KAAcR,GAAxC,IAA+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,IAC1B5C,KAAK,CAACC,OAAN,CAAc2C,KAAd,IACI,qBAAAA,KAAK,MAAL,CAAAA,KAAK,EAAMC,QAAD,IAAcA,QAAQ,CAACF,OAAT,EAAnB,CADT,GAEIC,KAAK,CAACD,OAAN,EAHI,CAXL;MAgBLvB,OAAO,EAAE,KAAKA;IAhBT,CAAP;EAkBD;;AAvSuB;;AA0S1B,eAAe1B,mBAAf"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
|
-
|
|
2
|
+
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
3
3
|
/**
|
|
4
4
|
* Wrapper around an error message / object
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
class ErrorModel {
|
|
7
8
|
/**
|
|
8
9
|
* Contruct
|
|
@@ -18,10 +19,13 @@ class ErrorModel {
|
|
|
18
19
|
|
|
19
20
|
_defineProperty(this, "_isClientConstraint", void 0);
|
|
20
21
|
|
|
22
|
+
_defineProperty(this, "_layouthint", void 0);
|
|
23
|
+
|
|
21
24
|
this._id = id;
|
|
22
25
|
this._parameters = parameters;
|
|
23
26
|
this._defaultMessage = defaultMessage;
|
|
24
27
|
this._isClientConstraint = isClientConstraint;
|
|
28
|
+
this._layouthint = new LayoutHintCollection();
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Get id of error
|
|
@@ -56,6 +60,13 @@ class ErrorModel {
|
|
|
56
60
|
*/
|
|
57
61
|
|
|
58
62
|
|
|
63
|
+
get layouthint() {
|
|
64
|
+
return this._layouthint;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
|
|
59
70
|
get isMandatoryConstraint() {
|
|
60
71
|
return this.id === "Constraint.Mandatory";
|
|
61
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorModel.js","names":["ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","_id","_parameters","_defaultMessage","_isClientConstraint","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n
|
|
1
|
+
{"version":3,"file":"ErrorModel.js","names":["LayoutHintCollection","ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","_id","_parameters","_defaultMessage","_isClientConstraint","_layouthint","layouthint","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n _layouthint: LayoutHintCollection;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n this._isClientConstraint = isClientConstraint;\n this._layouthint = new LayoutHintCollection();\n }\n\n /**\n * Get id of error\n */\n get id(): string {\n return this._id;\n }\n\n /**\n */\n get defaultMessage(): ?string {\n return this._defaultMessage;\n }\n\n /**\n */\n get parameters(): ?MessageParameters {\n return this._parameters;\n }\n\n /**\n */\n get isClientConstraint(): boolean {\n return this._isClientConstraint || false;\n }\n\n /**\n */\n get layouthint(): LayoutHintCollection {\n return this._layouthint;\n }\n\n /**\n */\n get isMandatoryConstraint(): boolean {\n return this.id === \"Constraint.Mandatory\";\n }\n}\n\nexport default ErrorModel;\n"],"mappings":";AAEA,OAAOA,oBAAP,MAAiC,oCAAjC;AAEA;AACA;AACA;;AACA,MAAMC,UAAN,CAAiB;EAOf;AACF;AACA;EACEC,WAAW,CACTC,EADS,EAETC,cAFS,EAGTC,UAHS,EAKT;IAAA,IADAC,kBACA,uEAD8B,KAC9B;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,GAAL,GAAWJ,EAAX;IACA,KAAKK,WAAL,GAAmBH,UAAnB;IACA,KAAKI,eAAL,GAAuBL,cAAvB;IACA,KAAKM,mBAAL,GAA2BJ,kBAA3B;IACA,KAAKK,WAAL,GAAmB,IAAIX,oBAAJ,EAAnB;EACD;EAED;AACF;AACA;;;EACQ,IAAFG,EAAE,GAAW;IACf,OAAO,KAAKI,GAAZ;EACD;EAED;AACF;;;EACoB,IAAdH,cAAc,GAAY;IAC5B,OAAO,KAAKK,eAAZ;EACD;EAED;AACF;;;EACgB,IAAVJ,UAAU,GAAuB;IACnC,OAAO,KAAKG,WAAZ;EACD;EAED;AACF;;;EACwB,IAAlBF,kBAAkB,GAAY;IAChC,OAAO,KAAKI,mBAAL,IAA4B,KAAnC;EACD;EAED;AACF;;;EACgB,IAAVE,UAAU,GAAyB;IACrC,OAAO,KAAKD,WAAZ;EACD;EAED;AACF;;;EAC2B,IAArBE,qBAAqB,GAAY;IACnC,OAAO,KAAKV,EAAL,KAAY,sBAAnB;EACD;;AA1Dc;;AA6DjB,eAAeF,UAAf"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
2
|
import Href from "../href/Href";
|
|
3
|
+
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
4
|
+
/**
|
|
5
|
+
*/
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Error response model
|
|
@@ -69,6 +72,114 @@ export default class ErrorResponse {
|
|
|
69
72
|
get message() {
|
|
70
73
|
return this.error.message || this.id;
|
|
71
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Return error title
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
get title() {
|
|
81
|
+
return this.error.title || null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Return error title message
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
get titleMessage() {
|
|
89
|
+
var _this$error$title;
|
|
90
|
+
|
|
91
|
+
return ((_this$error$title = this.error.title) === null || _this$error$title === void 0 ? void 0 : _this$error$title.message) || undefined;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Return error title Id
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
get titleId() {
|
|
99
|
+
var _this$error$title2;
|
|
100
|
+
|
|
101
|
+
return ((_this$error$title2 = this.error.title) === null || _this$error$title2 === void 0 ? void 0 : _this$error$title2.id) || undefined;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Return error title properties
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
get titleProperties() {
|
|
109
|
+
var _this$error$title3;
|
|
110
|
+
|
|
111
|
+
return ((_this$error$title3 = this.error.title) === null || _this$error$title3 === void 0 ? void 0 : _this$error$title3.properties) || null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Return error redirect
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
get redirect() {
|
|
119
|
+
return this.error.redirect || null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Return error redirect text
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
get redirectText() {
|
|
127
|
+
var _this$error$redirect;
|
|
128
|
+
|
|
129
|
+
return ((_this$error$redirect = this.error.redirect) === null || _this$error$redirect === void 0 ? void 0 : _this$error$redirect.text) || null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Return error redirect text id
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
get redirectTextID() {
|
|
137
|
+
var _this$error$redirect2, _this$error$redirect3;
|
|
138
|
+
|
|
139
|
+
return ((_this$error$redirect2 = this.error.redirect) === null || _this$error$redirect2 === void 0 ? void 0 : (_this$error$redirect3 = _this$error$redirect2.text) === null || _this$error$redirect3 === void 0 ? void 0 : _this$error$redirect3.id) || undefined;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Return error redirect text properties
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
get redirectTextProperties() {
|
|
147
|
+
var _this$error$redirect4, _this$error$redirect5;
|
|
148
|
+
|
|
149
|
+
return ((_this$error$redirect4 = this.error.redirect) === null || _this$error$redirect4 === void 0 ? void 0 : (_this$error$redirect5 = _this$error$redirect4.text) === null || _this$error$redirect5 === void 0 ? void 0 : _this$error$redirect5.properties) || null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Return error redirect text message
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
get redirectMessage() {
|
|
157
|
+
var _this$error$redirect6, _this$error$redirect7;
|
|
158
|
+
|
|
159
|
+
return ((_this$error$redirect6 = this.error.redirect) === null || _this$error$redirect6 === void 0 ? void 0 : (_this$error$redirect7 = _this$error$redirect6.text) === null || _this$error$redirect7 === void 0 ? void 0 : _this$error$redirect7.message) || undefined;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Return error redirect href
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
get redirectHref() {
|
|
167
|
+
var _this$error$redirect8;
|
|
168
|
+
|
|
169
|
+
if ((_this$error$redirect8 = this.error.redirect) !== null && _this$error$redirect8 !== void 0 && _this$error$redirect8.href) {
|
|
170
|
+
return new Href(this.error.redirect.href);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return new Href();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Return error layouthint
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
get layouthint() {
|
|
181
|
+
return new LayoutHintCollection(this.error.layouthint);
|
|
182
|
+
}
|
|
72
183
|
/**
|
|
73
184
|
*/
|
|
74
185
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorResponse.js","names":["Href","ErrorResponse","constructor","data","connectKey","_error","_connectKey","key","error","status","NO_RESPONSE_CODE","DECIMAL_RADIX","parseInt","id","isResourceNotFound","name","message","response","properties","parameters","RESOURCE_NOT_FOUND_RESPONSE_CODE","isResourceNotFoundAfterReload","isReload","isUnauthorized","UNAUTHORIZED_RESPONSE_CODE","hasUnauthorizedStatus","hasUnauthorizedErrorId","hasLoginAction","action","isChangePassword","isConcurrentUser","isConcurrentError","isBlocked","isInvalidUsername","isTimeoutError","isRemoteServiceException","changePasswordHref","redirect","isBasicAuthentication","loginFailed","shouldThrowOnServer"],"sources":["../../../src/models/error/ErrorResponse.js"],"sourcesContent":["// @flow\nimport Href from \"../href/Href\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\n\n/**\n * Error response model\n */\nexport default class ErrorResponse {\n _error: Object;\n _connectKey: ?string;\n\n /**\n * Construct ErrorResponse\n */\n constructor(data: Object, connectKey?: string) {\n this._error = data;\n this._connectKey = connectKey;\n }\n\n /**\n */\n set connectKey(key: string) {\n this._connectKey = key;\n }\n\n /**\n */\n get connectKey(): ?string {\n return this._connectKey;\n }\n\n /**\n * Return error information\n */\n get error(): Object {\n return this._error ?? {};\n }\n\n /**\n * Get request status code\n */\n get status(): number {\n const NO_RESPONSE_CODE = 0;\n const DECIMAL_RADIX = 10;\n return this.error.status\n ? parseInt(this.error.status, DECIMAL_RADIX)\n : NO_RESPONSE_CODE;\n }\n\n /**\n * Return error type information\n */\n get id(): string {\n if (this.isResourceNotFound && this.error.id !== \"Error.NotAuthorized\") {\n return \"Error.ResourceNotFound\";\n }\n\n return this.error.id || this.error.name || \"Error.GeneralError\";\n }\n\n /**\n */\n get message(): string {\n return this.error.message || this.id;\n }\n\n /**\n */\n get response(): Object {\n return this.error.response || {};\n }\n\n /**\n */\n get properties(): Object {\n const { properties } = this.error;\n if (properties != null && typeof properties == \"object\") {\n return properties;\n }\n\n return {};\n }\n\n /**\n * Return error parameters\n */\n get parameters(): ?MessageParameters {\n return this.error.parameters || null;\n }\n\n /**\n */\n get isResourceNotFound(): boolean {\n const RESOURCE_NOT_FOUND_RESPONSE_CODE = 404;\n\n return this.status === RESOURCE_NOT_FOUND_RESPONSE_CODE;\n }\n\n /**\n */\n get isResourceNotFoundAfterReload(): boolean {\n return this.isResourceNotFound && this.error.isReload;\n }\n\n /**\n * Check if the error message is an authorization error\n */\n get isUnauthorized(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n\n const hasUnauthorizedStatus = this.status === UNAUTHORIZED_RESPONSE_CODE;\n const hasUnauthorizedErrorId =\n this.id === \"Error.NotAuthorized\" ||\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidUsername\" ||\n this.id === \"Error.Authentication.InvalidCredentials\";\n\n const hasLoginAction = this.error.action\n ? this.error.action.name === \"login\"\n : false;\n\n return hasUnauthorizedStatus || hasUnauthorizedErrorId || hasLoginAction;\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this.id === \"Error.ChangePasswordRequired\";\n }\n\n /**\n */\n get isConcurrentUser(): boolean {\n return this.id === \"Error.Authentication.ConcurrentUser\";\n }\n\n /**\n */\n get isConcurrentError(): boolean {\n return (\n this.id === \"Error.Case.ConcurrentModification\" ||\n this.id === \"Error.DataStore.ConcurrentModification\" ||\n this.id === \"Error.DataStore.RecordAlreadyExists\" ||\n this.id === \"Error.DataStore.RowCannotBeLocked\"\n );\n }\n\n /**\n */\n get isBlocked(): boolean {\n return this.id === \"Error.Authentication.BlockedUser\";\n }\n\n /**\n */\n get isInvalidUsername(): boolean {\n return this.id === \"Error.Authentication.InvalidUsername\";\n }\n\n /**\n */\n get isTimeoutError(): boolean {\n return this.id === \"Error.CodemapLookup.InvalidToken\";\n }\n\n /**\n * A RemoteServiceException occurs when an exception occurs connecting to an external system,\n * for example when using the service list panels\n */\n get isRemoteServiceException(): boolean {\n return this.id === \"Error.RemoteServiceException\";\n }\n\n /**\n * Get response url\n */\n get changePasswordHref(): ?Href {\n return this.properties.redirect ? new Href(this.properties.redirect) : null;\n }\n\n /**\n * When no action information is present in the unauthorized response, for now we assume it is Basic Authentication\n */\n get isBasicAuthentication(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n return (\n this.isUnauthorized &&\n this.status === UNAUTHORIZED_RESPONSE_CODE &&\n this.response.error === \"No responseText\"\n );\n }\n\n /**\n * Retrieve a failed login attempt\n */\n get loginFailed(): boolean {\n return (\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidCredentials\"\n );\n }\n\n /**\n */\n get shouldThrowOnServer(): boolean {\n return !this.isChangePassword && !this.isBlocked && !this.isConcurrentUser;\n }\n}\n"],"mappings":";AACA,OAAOA,IAAP,MAAiB,cAAjB;;AAIA;AACA;AACA;AACA,eAAe,MAAMC,aAAN,CAAoB;EAIjC;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,UAAf,EAAoC;IAAA;;IAAA;;IAC7C,KAAKC,MAAL,GAAcF,IAAd;IACA,KAAKG,WAAL,GAAmBF,UAAnB;EACD;EAED;AACF;;;EACgB,IAAVA,UAAU,CAACG,GAAD,EAAc;IAC1B,KAAKD,WAAL,GAAmBC,GAAnB;EACD;EAED;AACF;;;EACgB,IAAVH,UAAU,GAAY;IACxB,OAAO,KAAKE,WAAZ;EACD;EAED;AACF;AACA;;;EACW,IAALE,KAAK,GAAW;IAAA;;IAClB,uBAAO,KAAKH,MAAZ,uDAAsB,EAAtB;EACD;EAED;AACF;AACA;;;EACY,IAANI,MAAM,G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B,IAAIrC,IAAJ,CAAS,KAAKkB,UAAL,CAAgBmB,QAAzB,CAA3B,GAAgE,IAAvE;EACD;EAED;AACF;AACA;;;EAC2B,IAArBC,qBAAqB,GAAY;IACnC,MAAMd,0BAA0B,GAAG,GAAnC;IACA,OACE,KAAKD,cAAL,IACA,KAAKd,MAAL,KAAgBe,0BADhB,IAEA,KAAKP,QAAL,CAAcT,KAAd,KAAwB,iBAH1B;EAKD;EAED;AACF;AACA;;;EACiB,IAAX+B,WAAW,GAAY;IACzB,OACE,KAAK1B,EAAL,KAAY,+BAAZ,IACA,KAAKA,EAAL,KAAY,yCAFd;EAID;EAED;AACF;;;EACyB,IAAnB2B,mBAAmB,GAAY;IACjC,OAAO,CAAC,KAAKX,gBAAN,IAA0B,CAAC,KAAKG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AAvMgC"}
|
|
1
|
+
{"version":3,"file":"ErrorResponse.js","names":["Href","LayoutHintCollection","ErrorResponse","constructor","data","connectKey","_error","_connectKey","key","error","status","NO_RESPONSE_CODE","DECIMAL_RADIX","parseInt","id","isResourceNotFound","name","message","title","titleMessage","undefined","titleId","titleProperties","properties","redirect","redirectText","text","redirectTextID","redirectTextProperties","redirectMessage","redirectHref","href","layouthint","response","parameters","RESOURCE_NOT_FOUND_RESPONSE_CODE","isResourceNotFoundAfterReload","isReload","isUnauthorized","UNAUTHORIZED_RESPONSE_CODE","hasUnauthorizedStatus","hasUnauthorizedErrorId","hasLoginAction","action","isChangePassword","isConcurrentUser","isConcurrentError","isBlocked","isInvalidUsername","isTimeoutError","isRemoteServiceException","changePasswordHref","isBasicAuthentication","loginFailed","shouldThrowOnServer"],"sources":["../../../src/models/error/ErrorResponse.js"],"sourcesContent":["// @flow\nimport Href from \"../href/Href\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n */\nexport type TitleObject = {\n +id: string,\n +properties?: Object,\n +message?: string,\n};\n/**\n */\nexport type RedirectTextObject = {\n +id: string,\n +properties?: Object,\n +message?: string,\n};\n\n/**\n */\nexport type RedirectObject = {\n +href: Href,\n +text?: RedirectTextObject,\n};\n\n/**\n * Error response model\n */\nexport default class ErrorResponse {\n _error: Object;\n _connectKey: ?string;\n\n /**\n * Construct ErrorResponse\n */\n constructor(data: Object, connectKey?: string) {\n this._error = data;\n this._connectKey = connectKey;\n }\n\n /**\n */\n set connectKey(key: string) {\n this._connectKey = key;\n }\n\n /**\n */\n get connectKey(): ?string {\n return this._connectKey;\n }\n\n /**\n * Return error information\n */\n get error(): Object {\n return this._error ?? {};\n }\n\n /**\n * Get request status code\n */\n get status(): number {\n const NO_RESPONSE_CODE = 0;\n const DECIMAL_RADIX = 10;\n return this.error.status\n ? parseInt(this.error.status, DECIMAL_RADIX)\n : NO_RESPONSE_CODE;\n }\n\n /**\n * Return error type information\n */\n get id(): string {\n if (this.isResourceNotFound && this.error.id !== \"Error.NotAuthorized\") {\n return \"Error.ResourceNotFound\";\n }\n\n return this.error.id || this.error.name || \"Error.GeneralError\";\n }\n\n /**\n */\n get message(): string {\n return this.error.message || this.id;\n }\n\n /**\n * Return error title\n */\n get title(): TitleObject {\n return this.error.title || null;\n }\n\n /**\n * Return error title message\n */\n get titleMessage(): string {\n return this.error.title?.message || undefined;\n }\n\n /**\n * Return error title Id\n */\n get titleId(): string {\n return this.error.title?.id || undefined;\n }\n\n /**\n * Return error title properties\n */\n get titleProperties(): Object {\n return this.error.title?.properties || null;\n }\n\n /**\n * Return error redirect\n */\n get redirect(): RedirectObject {\n return this.error.redirect || null;\n }\n /**\n * Return error redirect text\n */\n get redirectText(): RedirectTextObject {\n return this.error.redirect?.text || null;\n }\n\n /**\n * Return error redirect text id\n */\n get redirectTextID(): string {\n return this.error.redirect?.text?.id || undefined;\n }\n\n /**\n * Return error redirect text properties\n */\n get redirectTextProperties(): Object {\n return this.error.redirect?.text?.properties || null;\n }\n\n /**\n * Return error redirect text message\n */\n get redirectMessage(): string {\n return this.error.redirect?.text?.message || undefined;\n }\n\n /**\n * Return error redirect href\n */\n get redirectHref(): Href {\n if (this.error.redirect?.href) {\n return new Href(this.error.redirect.href);\n }\n return new Href();\n }\n\n /**\n * Return error layouthint\n */\n get layouthint(): LayoutHintCollection {\n return new LayoutHintCollection(this.error.layouthint);\n }\n\n /**\n */\n get response(): Object {\n return this.error.response || {};\n }\n\n /**\n */\n get properties(): Object {\n const { properties } = this.error;\n if (properties != null && typeof properties == \"object\") {\n return properties;\n }\n\n return {};\n }\n\n /**\n * Return error parameters\n */\n get parameters(): ?MessageParameters {\n return this.error.parameters || null;\n }\n\n /**\n */\n get isResourceNotFound(): boolean {\n const RESOURCE_NOT_FOUND_RESPONSE_CODE = 404;\n\n return this.status === RESOURCE_NOT_FOUND_RESPONSE_CODE;\n }\n\n /**\n */\n get isResourceNotFoundAfterReload(): boolean {\n return this.isResourceNotFound && this.error.isReload;\n }\n\n /**\n * Check if the error message is an authorization error\n */\n get isUnauthorized(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n\n const hasUnauthorizedStatus = this.status === UNAUTHORIZED_RESPONSE_CODE;\n const hasUnauthorizedErrorId =\n this.id === \"Error.NotAuthorized\" ||\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidUsername\" ||\n this.id === \"Error.Authentication.InvalidCredentials\";\n\n const hasLoginAction = this.error.action\n ? this.error.action.name === \"login\"\n : false;\n\n return hasUnauthorizedStatus || hasUnauthorizedErrorId || hasLoginAction;\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this.id === \"Error.ChangePasswordRequired\";\n }\n\n /**\n */\n get isConcurrentUser(): boolean {\n return this.id === \"Error.Authentication.ConcurrentUser\";\n }\n\n /**\n */\n get isConcurrentError(): boolean {\n return (\n this.id === \"Error.Case.ConcurrentModification\" ||\n this.id === \"Error.DataStore.ConcurrentModification\" ||\n this.id === \"Error.DataStore.RecordAlreadyExists\" ||\n this.id === \"Error.DataStore.RowCannotBeLocked\"\n );\n }\n\n /**\n */\n get isBlocked(): boolean {\n return this.id === \"Error.Authentication.BlockedUser\";\n }\n\n /**\n */\n get isInvalidUsername(): boolean {\n return this.id === \"Error.Authentication.InvalidUsername\";\n }\n\n /**\n */\n get isTimeoutError(): boolean {\n return this.id === \"Error.CodemapLookup.InvalidToken\";\n }\n\n /**\n * A RemoteServiceException occurs when an exception occurs connecting to an external system,\n * for example when using the service list panels\n */\n get isRemoteServiceException(): boolean {\n return this.id === \"Error.RemoteServiceException\";\n }\n\n /**\n * Get response url\n */\n get changePasswordHref(): ?Href {\n return this.properties.redirect ? new Href(this.properties.redirect) : null;\n }\n\n /**\n * When no action information is present in the unauthorized response, for now we assume it is Basic Authentication\n */\n get isBasicAuthentication(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n return (\n this.isUnauthorized &&\n this.status === UNAUTHORIZED_RESPONSE_CODE &&\n this.response.error === \"No responseText\"\n );\n }\n\n /**\n * Retrieve a failed login attempt\n */\n get loginFailed(): boolean {\n return (\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidCredentials\"\n );\n }\n\n /**\n */\n get shouldThrowOnServer(): boolean {\n return !this.isChangePassword && !this.isBlocked && !this.isConcurrentUser;\n }\n}\n"],"mappings":";AACA,OAAOA,IAAP,MAAiB,cAAjB;AAGA,OAAOC,oBAAP,MAAiC,oCAAjC;AAEA;AACA;;AAqBA;AACA;AACA;AACA,eAAe,MAAMC,aAAN,CAAoB;EAIjC;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,UAAf,EAAoC;IAAA;;IAAA;;IAC7C,KAAKC,MAAL,GAAcF,IAAd;IACA,KAAKG,WAAL,GAAmBF,UAAnB;EACD;EAED;AACF;;;EACgB,IAAVA,UAAU,CAACG,GAAD,EAAc;IAC1B,KAAKD,WAAL,GAAmBC,GAAnB;EACD;EAED;AACF;;;EACgB,IAAVH,UAAU,GAAY;IACxB,OAAO,KAAKE,WAAZ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ATiC,SAAS,GAAY;IACvB,OAAO,KAAKjC,EAAL,KAAY,kCAAnB;EACD;EAED;AACF;;;EACuB,IAAjBkC,iBAAiB,GAAY;IAC/B,OAAO,KAAKlC,EAAL,KAAY,sCAAnB;EACD;EAED;AACF;;;EACoB,IAAdmC,cAAc,GAAY;IAC5B,OAAO,KAAKnC,EAAL,KAAY,kCAAnB;EACD;EAED;AACF;AACA;AACA;;;EAC8B,IAAxBoC,wBAAwB,GAAY;IACtC,OAAO,KAAKpC,EAAL,KAAY,8BAAnB;EACD;EAED;AACF;AACA;;;EACwB,IAAlBqC,kBAAkB,GAAU;IAC9B,OAAO,KAAK5B,UAAL,CAAgBC,QAAhB,GAA2B,IAAIxB,IAAJ,CAAS,KAAKuB,UAAL,CAAgBC,QAAzB,CAA3B,GAAgE,IAAvE;EACD;EAED;AACF;AACA;;;EAC2B,IAArB4B,qBAAqB,GAAY;IACnC,MAAMb,0BAA0B,GAAG,GAAnC;IACA,OACE,KAAKD,cAAL,IACA,KAAK5B,MAAL,KAAgB6B,0BADhB,IAEA,KAAKN,QAAL,CAAcxB,KAAd,KAAwB,iBAH1B;EAKD;EAED;AACF;AACA;;;EACiB,IAAX4C,WAAW,GAAY;IACzB,OACE,KAAKvC,EAAL,KAAY,+BAAZ,IACA,KAAKA,EAAL,KAAY,yCAFd;EAID;EAED;AACF;;;EACyB,IAAnBwC,mBAAmB,GAAY;IACjC,OAAO,CAAC,KAAKV,gBAAN,IAA0B,CAAC,KAAKG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AAtRgC"}
|
package/esm/models/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint?: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.setSettings = exports.setSetting = exports.logoutPath = exports.loginUsernameField = exports.loginType = exports.loginPath = exports.loginPasswordField = exports.hasAllContentInData = exports.getSetting = exports.allSettings = void 0;
|
|
8
|
+
exports.setSettings = exports.setSetting = exports.logoutPath = exports.loginUsernameField = exports.loginType = exports.loginPath = exports.loginPasswordField = exports.hasAllContentInData = exports.getSetting = exports.allSettings = exports.LOGOUT_PATH = exports.LOGIN_PATH = void 0;
|
|
9
9
|
|
|
10
10
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
11
11
|
|
|
@@ -158,4 +158,8 @@ exports.loginPasswordField = loginPasswordField;
|
|
|
158
158
|
const logoutPath = () => getSetting(_Constants.LOGOUT_PATH_SETTING, "/Logoff");
|
|
159
159
|
|
|
160
160
|
exports.logoutPath = logoutPath;
|
|
161
|
+
const LOGIN_PATH = loginPath();
|
|
162
|
+
exports.LOGIN_PATH = LOGIN_PATH;
|
|
163
|
+
const LOGOUT_PATH = logoutPath();
|
|
164
|
+
exports.LOGOUT_PATH = LOGOUT_PATH;
|
|
161
165
|
//# sourceMappingURL=Settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["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_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","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","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","isPlainObject","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} 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 // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\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 // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\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 XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: 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\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAWA,MAAMA,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAOtB;EACAC,kBAAkB,EAAE,KARE;EAUtB;EACAC,sBAAsB,EAAE,IAXF;EAatB;EACAC,qCAAqC,EAAE,IAdjB;EAgBtB;EACAC,oCAAoC,EAAE,KAjBhB;EAmBtB;EACAC,oBAAoB,EAAE,CAAC,UAAD,EAAa,WAAb,CApBA;EAsBtB;EACAC,yBAAyB,EAAE,IAvBL;EAyBtB;EACAC,6BAA6B,EAAE,IA1BT;EA4BtB;EACAC,eAAe,EAAE,CAAC,IAAD,EAAO,IAAP,CA7BK;EA+BtB;EACAC,wBAAwB,EAAE,KAhCJ;EAkCtB;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AwBC,YAAxB;AACD,CARM;AAUP;AACA;;;;;AACO,MAAMI,UAAU,GAAG,CAACL,GAAD,EAAcM,KAAd,KAA6B;EACrDX,QAAQ,CAACK,GAAD,CAAR,GAAgBM,KAAhB;AACD,CAFM;AAIP;AACA;;;;;AACO,MAAMC,WAAW,GAAG,MAAmCZ,QAAvD;AAEP;AACA;;;;;AACO,MAAMa,mBAAmB,GAAG,MACjCT,UAAU,CAACU,sCAAD,EAA8B,IAA9B,CADL;AAGP;AACA;AACA;;;;;AACO,MAAMC,SAAS,GAAG,MAAcX,UAAU,CAACY,qBAAD,EAAa,MAAb,CAA1C;AAEP;AACA;;;;;AACO,MAAMC,SAAS,GAAG,MACvBb,UAAU,CAACc,6BAAD,EAAqB,mBAArB,CADL;AAEP;AACA;;;;;AACO,MAAMC,kBAAkB,GAAG,MAChCf,UAAU,CAACgB,iCAAD,EAAyB,YAAzB,CADL;AAEP;AACA;;;;;AACO,MAAMC,kBAAkB,GAAG,MAChCjB,UAAU,CAACkB,iCAAD,EAAyB,YAAzB,CADL;AAEP;AACA;;;;;AACO,MAAMC,UAAU,GAAG,MACxBnB,UAAU,CAACoB,8BAAD,EAAsB,SAAtB,CADL"}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["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_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","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","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","isPlainObject","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} 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 // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\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 // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\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 XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: 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\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAWA,MAAMA,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAOtB;EACAC,kBAAkB,EAAE,KARE;EAUtB;EACAC,sBAAs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|
|
51
51
|
attributeData._links = (0, _pick.default)(data._links, ["concept", "download", "lookupOptions", "lookupList"]);
|
|
52
52
|
this._attribute = attributeData;
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
if (data[key] === undefined || "name" in data && "param" in data) {
|
|
55
|
+
this._value = this.getValue(data);
|
|
56
|
+
} else {
|
|
57
|
+
this._value = data[key];
|
|
58
|
+
}
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
this._children = this.createChildren(data, childrenKeys);
|
|
@@ -43,7 +43,11 @@ class AttributeDataHelper {
|
|
|
43
43
|
|
|
44
44
|
this._attribute = attributeData;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
if (data[key] === undefined || ("name" in data && "param" in data)) {
|
|
47
|
+
this._value = this.getValue(data);
|
|
48
|
+
} else {
|
|
49
|
+
this._value = data[key];
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
this._children = this.createChildren(data, childrenKeys);
|