@beinformed/ui 1.63.4 → 1.63.5
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 +8 -0
- package/esm/constants/Settings.js +1 -1
- package/esm/constants/Settings.js.flow +1 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +5 -1
- package/esm/models/concepts/ConceptDetailModel.js.flow +6 -0
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js +9 -2
- package/esm/models/concepts/SourceReferenceCollection.js.flow +12 -4
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +6 -0
- package/esm/models/concepts/SourceReferenceModel.js.flow +6 -0
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/constants/Settings.js +1 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +5 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js +9 -2
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +6 -0
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/Settings.js +1 -1
- package/src/models/concepts/ConceptDetailModel.js +6 -0
- package/src/models/concepts/SourceReferenceCollection.js +12 -4
- package/src/models/concepts/SourceReferenceModel.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.63.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.4...v1.63.5) (2025-10-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **constants:** correct typo in getBasePath comment ([18c6ded](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/18c6ded64df5e453fff0fcd749a560b3f770b6dc))
|
|
11
|
+
* **source-ref:** add typeLabel property and support sectionReferenceTypes in collection ([44787b5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/44787b54b346dfe8dd0d7c516db22042638d1f62))
|
|
12
|
+
|
|
5
13
|
## [1.63.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.2...v1.63.4) (2025-10-15)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -104,7 +104,7 @@ export const cacheContributions = () => getSetting("CACHE_CONTRIBUTIONS", true);
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* The context path is retrieved on the server using the context path property as set in the runtime properties
|
|
107
|
-
* This can be manually
|
|
107
|
+
* This can be manually overriden by setting the UI setting 'CONTEXT_PATH'
|
|
108
108
|
*/
|
|
109
109
|
export const getBasePath = () => getSetting("CONTEXT_PATH", "/BeInformed");
|
|
110
110
|
|
|
@@ -166,7 +166,7 @@ export const cacheContributions = (): boolean =>
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* The context path is retrieved on the server using the context path property as set in the runtime properties
|
|
169
|
-
* This can be manually
|
|
169
|
+
* This can be manually overriden by setting the UI setting 'CONTEXT_PATH'
|
|
170
170
|
*/
|
|
171
171
|
export const getBasePath = (): string =>
|
|
172
172
|
getSetting("CONTEXT_PATH", "/BeInformed");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","getEnabledLocales","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: 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 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually override by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;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uB,UAAkB,GAAG4C,SAAS,CAAC,CAAC;AAC7C,OAAO,MAAM1C,WAAmB,GAAG8C,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAG1B,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC2B,2BAAA,CAAAD,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAOjF,wBAAwB,CAACiF,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAIpE,WAAmB,IAAK;EACrD4C,UAAU,CAAC,cAAc,EAAE5C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMqE,IAAY,GAAGrB,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","getEnabledLocales","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: 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 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,C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F,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAIpE,WAAmB,IAAK;EACrD4C,UAAU,CAAC,cAAc,EAAE5C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMqE,IAAY,GAAGrB,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -222,7 +222,11 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
222
222
|
*/
|
|
223
223
|
getSourceReferenceCollection(availableLocales = []) {
|
|
224
224
|
if (!this._sourceReferences) {
|
|
225
|
-
|
|
225
|
+
let sectionReferenceTypes = [];
|
|
226
|
+
if (this.conceptType && this.conceptType.sectionReferenceTypes) {
|
|
227
|
+
sectionReferenceTypes = this.conceptType.sectionReferenceTypes;
|
|
228
|
+
}
|
|
229
|
+
this._sourceReferences = new SourceReferenceCollection(this.getSourceReferencesForCurrentLanguage(availableLocales), sectionReferenceTypes, this.entryDate, this.modelOptions);
|
|
226
230
|
}
|
|
227
231
|
return this._sourceReferences;
|
|
228
232
|
}
|
|
@@ -271,8 +271,14 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
271
271
|
availableLocales: Array<string> = [],
|
|
272
272
|
): SourceReferenceCollection {
|
|
273
273
|
if (!this._sourceReferences) {
|
|
274
|
+
let sectionReferenceTypes = [];
|
|
275
|
+
if (this.conceptType && this.conceptType.sectionReferenceTypes) {
|
|
276
|
+
sectionReferenceTypes = this.conceptType.sectionReferenceTypes;
|
|
277
|
+
}
|
|
278
|
+
|
|
274
279
|
this._sourceReferences = new SourceReferenceCollection(
|
|
275
280
|
this.getSourceReferencesForCurrentLanguage(availableLocales),
|
|
281
|
+
sectionReferenceTypes,
|
|
276
282
|
this.entryDate,
|
|
277
283
|
this.modelOptions,
|
|
278
284
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_mapInstanceProperty","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filterInstanceProperty","_includesInstanceProperty","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context9","textFragments","textFragment","_context8","textFragmentConfig","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context0","getSourceReferenceCollection","availableLocales","_sourceReferences","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context1","_context12","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context10","_context11","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType && this.conceptType.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType && this.conceptType.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig =\n this.conceptType &&\n this.conceptType.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments =\n this.conceptType && this.conceptType.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,uBAAuB,QAAQ,2BAA2B;AAcnE;AACA;AACA;AACA,eAAe,MAAMC,kBAAkB,SAASL,aAAa,CAAC;EAK5D;AACF;EACEM,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIR,yBAAyB,CAC7C,IAAI,CAACS,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,eAAe;EACxB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,oBAAoB;EAC7B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACN,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACO,aAAa,CAACC,YAAY,IAC/BR,IAAI,CAACO,aAAa,CAACC,YAAY,KAAK,eAAe;EAEvD;;EAEA;AACF;EACEC,yBAAyBA,CAAA,EAAqB;IAC5C,MAAMC,eAAe,GAAG,IAAI,CAACC,KAAK,CAACC,YAAY,CAAC,aAAa,CAAC;IAC9D,MAAMC,wBAAwB,GAC5B,IAAI,CAACC,mBAAmB,CAACL,y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AAIA,MAAM,CAACK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACtC,CAAC;;MAED;MACA,OAAO5C,uBAAA,CAAAiC,UAAA,OAAI,CAACnF,IAAI,CAACiF,gBAAgB,EAAA5D,IAAA,CAAA8D,UAAA,EAC9BE,eAAe,IACd,CAAClC,yBAAA,CAAA0C,kBAAkB,EAAAxE,IAAA,CAAlBwE,kBAAkB,EACjBR,eAAe,CAACjF,IAAI,CAACkF,SAAS,CAC5BD,eAAe,CAACjF,IAAI,CAACmF,MAAM,GAAGP,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAI9E,SAASA,CAAA,EAAkB;IAC7B,OAAOgD,uBAAA,KAAI,CAAClD,IAAI,IAAUN,uBAAuB,CAAC,EAAEqG,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAC1E,WAAW,EAAEyE,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_mapInstanceProperty","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filterInstanceProperty","_includesInstanceProperty","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context9","textFragments","textFragment","_context8","textFragmentConfig","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context0","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context1","_context12","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context10","_context11","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType && this.conceptType.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType && this.conceptType.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig =\n this.conceptType &&\n this.conceptType.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments =\n this.conceptType && this.conceptType.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType && this.conceptType.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,yBAAyB,MAA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F,gBAAgB,EAAA7D,IAAA,CAAA+D,UAAA,EAC9BE,eAAe,IACd,CAACnC,yBAAA,CAAA2C,kBAAkB,EAAAzE,IAAA,CAAlByE,kBAAkB,EACjBR,eAAe,CAAClF,IAAI,CAACmF,SAAS,CAC5BD,eAAe,CAAClF,IAAI,CAACoF,MAAM,GAAGP,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAI/E,SAASA,CAAA,EAAkB;IAC7B,OAAOgD,uBAAA,KAAI,CAAClD,IAAI,IAAUN,uBAAuB,CAAC,EAAEsG,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAC3E,WAAW,EAAE0E,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
2
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
2
3
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
3
4
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
4
5
|
import BaseCollection from "../base/BaseCollection";
|
|
@@ -9,9 +10,15 @@ import SourceReferenceModel from "./SourceReferenceModel";
|
|
|
9
10
|
export default class SourceReferenceCollection extends BaseCollection {
|
|
10
11
|
/**
|
|
11
12
|
*/
|
|
12
|
-
constructor(sourceReferences = [], entryDate = null, modelOptions) {
|
|
13
|
+
constructor(sourceReferences = [], sectionReferenceTypes = [], entryDate = null, modelOptions) {
|
|
13
14
|
super();
|
|
14
|
-
this.collection = sourceReferences ? _mapInstanceProperty(sourceReferences).call(sourceReferences, sourceReference =>
|
|
15
|
+
this.collection = sourceReferences ? _mapInstanceProperty(sourceReferences).call(sourceReferences, sourceReference => {
|
|
16
|
+
const sectionReferenceType = _findInstanceProperty(sectionReferenceTypes).call(sectionReferenceTypes, sectionReferenceType => sectionReferenceType._id === sourceReference.type);
|
|
17
|
+
return new SourceReferenceModel({
|
|
18
|
+
typeLabel: sectionReferenceType?.label,
|
|
19
|
+
...sourceReference
|
|
20
|
+
}, entryDate, modelOptions);
|
|
21
|
+
}) : [];
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
/**
|
|
@@ -11,16 +11,24 @@ export default class SourceReferenceCollection extends BaseCollection<SourceRefe
|
|
|
11
11
|
*/
|
|
12
12
|
constructor(
|
|
13
13
|
sourceReferences: Array<Object> = [],
|
|
14
|
+
sectionReferenceTypes: Array<Object> = [],
|
|
14
15
|
entryDate: ?ISO_DATE = null,
|
|
15
16
|
modelOptions?: ModelOptions,
|
|
16
17
|
) {
|
|
17
18
|
super();
|
|
18
19
|
|
|
19
20
|
this.collection = sourceReferences
|
|
20
|
-
? sourceReferences.map(
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
? sourceReferences.map((sourceReference) => {
|
|
22
|
+
const sectionReferenceType = sectionReferenceTypes.find(
|
|
23
|
+
(sectionReferenceType) =>
|
|
24
|
+
sectionReferenceType._id === sourceReference.type,
|
|
25
|
+
);
|
|
26
|
+
return new SourceReferenceModel(
|
|
27
|
+
{ typeLabel: sectionReferenceType?.label, ...sourceReference },
|
|
28
|
+
entryDate,
|
|
29
|
+
modelOptions,
|
|
30
|
+
);
|
|
31
|
+
})
|
|
24
32
|
: [];
|
|
25
33
|
}
|
|
26
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceReferenceCollection.js","names":["BaseCollection","SourceReferenceModel","SourceReferenceCollection","constructor","sourceReferences","entryDate","modelOptions","collection","_mapInstanceProperty","call","sourceReference","byTypes","types","_context","_filterInstanceProperty","sourceRef","_includesInstanceProperty"
|
|
1
|
+
{"version":3,"file":"SourceReferenceCollection.js","names":["BaseCollection","SourceReferenceModel","SourceReferenceCollection","constructor","sourceReferences","sectionReferenceTypes","entryDate","modelOptions","collection","_mapInstanceProperty","call","sourceReference","sectionReferenceType","_findInstanceProperty","_id","type","typeLabel","label","byTypes","types","_context","_filterInstanceProperty","sourceRef","_includesInstanceProperty"],"sources":["../../../src/models/concepts/SourceReferenceCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport SourceReferenceModel from \"./SourceReferenceModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Source reference collection\n */\nexport default class SourceReferenceCollection extends BaseCollection<SourceReferenceModel> {\n /**\n */\n constructor(\n sourceReferences: Array<Object> = [],\n sectionReferenceTypes: Array<Object> = [],\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n this.collection = sourceReferences\n ? sourceReferences.map((sourceReference) => {\n const sectionReferenceType = sectionReferenceTypes.find(\n (sectionReferenceType) =>\n sectionReferenceType._id === sourceReference.type,\n );\n return new SourceReferenceModel(\n { typeLabel: sectionReferenceType?.label, ...sourceReference },\n entryDate,\n modelOptions,\n );\n })\n : [];\n }\n\n /**\n */\n byTypes(types: string): Array<SourceReferenceModel> {\n return this.filter((sourceRef) => types.includes(sourceRef.type));\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,oBAAoB,MAAM,wBAAwB;AAGzD;AACA;AACA;AACA,eAAe,MAAMC,yBAAyB,SAASF,cAAc,CAAuB;EAC1F;AACF;EACEG,WAAWA,CACTC,gBAA+B,GAAG,EAAE,EACpCC,qBAAoC,GAAG,EAAE,EACzCC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;IAEP,IAAI,CAACC,UAAU,GAAGJ,gBAAgB,GAC9BK,oBAAA,CAAAL,gBAAgB,EAAAM,IAAA,CAAhBN,gBAAgB,EAAMO,eAAe,IAAK;MACxC,MAAMC,oBAAoB,GAAGC,qBAAA,CAAAR,qBAAqB,EAAAK,IAAA,CAArBL,qBAAqB,EAC/CO,oBAAoB,IACnBA,oBAAoB,CAACE,GAAG,KAAKH,eAAe,CAACI,IACjD,CAAC;MACD,OAAO,IAAId,oBAAoB,CAC7B;QAAEe,SAAS,EAAEJ,oBAAoB,EAAEK,KAAK;QAAE,GAAGN;MAAgB,CAAC,EAC9DL,SAAS,EACTC,YACF,CAAC;IACH,CAAC,CAAC,GACF,EAAE;EACR;;EAEA;AACF;EACEW,OAAOA,CAACC,KAAa,EAA+B;IAAA,IAAAC,QAAA;IAClD,OAAOC,uBAAA,CAAAD,QAAA,OAAI,EAAAV,IAAA,CAAAU,QAAA,EAASE,SAAS,IAAKC,yBAAA,CAAAJ,KAAK,EAAAT,IAAA,CAALS,KAAK,EAAUG,SAAS,CAACP,IAAI,CAAC,CAAC;EACnE;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePathModularUI","LinkCollection","SourceReferenceModel","constructor","sourceReference","entryDate","modelOptions","_defineProperty","_sourceReference","_entryDate","_modelOptions","origin","contextPath","links","_links","link","section","sectionId","self","href","replace","content","selfhref","type","number","label","sourceLabel","sourceAbbreviation","referenceHash","fragment","sectionFragment"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport type { ModelOptions, SectionFragment } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get links(): LinkCollection {\n return new LinkCollection(\n this._sourceReference._links,\n null,\n this._modelOptions,\n );\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section =\n this.sectionId ||\n this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return this.link.selfhref;\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get number(): string {\n return this._sourceReference.number;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n *\n */\n get sourceAbbreviation(): string {\n return this._sourceReference.sourceAbbreviation;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n get sectionId(): string {\n return this._sourceReference.sectionId;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment | void {\n return this._sourceReference.sectionFragment;\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SAASC,oBAAoB,QAAQ,iBAAiB;AAEtD,OAAOC,cAAc,MAAM,yBAAyB;AAGpD;AACA;AACA,MAAMC,oBAAoB,CAAC;EAKzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EACvBC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACA,IAAI,CAACC,gBAAgB,GAAGJ,eAAe;IACvC,IAAI,CAACK,UAAU,GAAGJ,SAAS;IAC3B,IAAI,CAACK,aAAa,GAAGJ,YAAY,IAAI;MACnCK,MAAM,EAAE,EAAE;MACVC,WAAW,EAAEZ,oBAAoB,CAAC;IACpC,CAAC;EACH;;EAEA;AACF;EACE,IAAIa,KAAKA,CAAA,EAAmB;IAC1B,OAAO,IAAIZ,cAAc,CACvB,IAAI,CAACO,gBAAgB,CAACM,MAAM,EAC5B,IAAI,EACJ,IAAI,CAACJ,aACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIK,IAAIA,CAAA,EAAqB;IAC3B,MAAMC,OAAO,GACX,IAAI,CAACC,SAAS,IACd,IAAI,CAACT,gBAAgB,CAACM,MAAM,CAACI,IAAI,CAACC,IAAI,CAACC,OAAO,CAC5C,GAAG,IAAI,CAACZ,gBAAgB,CAACM,MAAM,CAACO,OAAO,CAACF,IAAI,GAAG,EAC/C,EACF,CAAC;IAEH,OAAO,IAAIrB,gBAAgB,CACzB;MACE,GAAG,IAAI,CAACU,gBAAgB;MACxBQ;IACF,CAAC,EACD,IAAI,CAACP,UAAU,EACf,IAAI,CAACC,aACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIY,QAAQA,CAAA,EAAS;IACnB,OAAO,IAAI,CAACP,IAAI,CAACO,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACf,gBAAgB,CAACe,IAAI;EACnC;;EAEA;AACF;EACE,IAAIC,
|
|
1
|
+
{"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePathModularUI","LinkCollection","SourceReferenceModel","constructor","sourceReference","entryDate","modelOptions","_defineProperty","_sourceReference","_entryDate","_modelOptions","origin","contextPath","links","_links","link","section","sectionId","self","href","replace","content","selfhref","type","typeLabel","number","label","sourceLabel","sourceAbbreviation","referenceHash","fragment","sectionFragment"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport type { ModelOptions, SectionFragment } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get links(): LinkCollection {\n return new LinkCollection(\n this._sourceReference._links,\n null,\n this._modelOptions,\n );\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section =\n this.sectionId ||\n this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return this.link.selfhref;\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get typeLabel(): string {\n return this._sourceReference.typeLabel;\n }\n\n /**\n */\n get number(): string {\n return this._sourceReference.number;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n *\n */\n get sourceAbbreviation(): string {\n return this._sourceReference.sourceAbbreviation;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n get sectionId(): string {\n return this._sourceReference.sectionId;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment | void {\n return this._sourceReference.sectionFragment;\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AA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CAACe,IAAI;EACnC;;EAEA;AACF;EACE,IAAIC,SAASA,CAAA,EAAW;IACtB,OAAO,IAAI,CAAChB,gBAAgB,CAACgB,SAAS;EACxC;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACjB,gBAAgB,CAACiB,MAAM;EACrC;;EAEA;AACF;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAAClB,gBAAgB,CAACkB,KAAK;EACpC;;EAEA;AACF;EACE,IAAIC,WAAWA,CAAA,EAAW;IACxB,OAAO,IAAI,CAACnB,gBAAgB,CAACmB,WAAW;EAC1C;;EAEA;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAW;IAC/B,OAAO,IAAI,CAACpB,gBAAgB,CAACoB,kBAAkB;EACjD;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAW;IAC1B,OAAOhC,kBAAkB,CAAC,IAAI,CAACyB,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACE,IAAIL,SAASA,CAAA,EAAW;IACtB,OAAO,IAAI,CAACT,gBAAgB,CAACS,SAAS;EACxC;;EAEA;AACF;AACA;EACE,IAAIa,QAAQA,CAAA,EAA2B;IACrC,OAAO,IAAI,CAACtB,gBAAgB,CAACuB,eAAe;EAC9C;AACF;AAEA,eAAe7B,oBAAoB","ignoreList":[]}
|
|
@@ -115,7 +115,7 @@ const cacheContributions = () => getSetting("CACHE_CONTRIBUTIONS", true);
|
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* The context path is retrieved on the server using the context path property as set in the runtime properties
|
|
118
|
-
* This can be manually
|
|
118
|
+
* This can be manually overriden by setting the UI setting 'CONTEXT_PATH'
|
|
119
119
|
*/
|
|
120
120
|
exports.cacheContributions = cacheContributions;
|
|
121
121
|
const getBasePath = () => getSetting("CONTEXT_PATH", "/BeInformed");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","isPlainObject","_assign","default","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","getEnabledLocales","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","clientName","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: 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 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually override by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAeA,MAAMG,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAA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AtC,OAAA,CAAAqC,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAInF,WAAmB,IAAK;EACrDgD,UAAU,CAAC,cAAc,EAAEhD,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAyC,OAAA,CAAA0C,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAA3C,OAAA,CAAA2C,IAAA,GAAGhC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","isPlainObject","_assign","default","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","getEnabledLocales","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","clientName","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: 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 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAeA,MAAMG,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;EAE/C;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,6BAA6B,EAAE,IAAI;EAEnC;EACAC,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EAE7B;EACAC,wBAAwB,EAAE,KAAK;EAE/B;EACAC,yBAAyB,EAAE,KAAK;EAEhC;EACAC,wCAAwC,EAAE,KAAK;EAE/C;EACAC,UAAU,EAAE,SAAS;EAErB;EACAC,wBAAwB,EAAE,EAAE;EAE5B;EACAC,WAAW,EAAE,UAAU;EAEvB;EACAC,qBAAqB,EAAE,IAAI;EAE3B;EACAC,wBAAwB,EAAE,GAAG;EAE7B;EACAC,+BAA+B,EAAE,kCAAkC;EAEnE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AME,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAGrC,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC,IAAAsC,WAAA,CAAAxC,OAAA,EAAAuC,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO,IAAAG,4CAAwB,EAACH,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AAFAtC,OAAA,CAAAqC,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAInF,WAAmB,IAAK;EACrDgD,UAAU,CAAC,cAAc,EAAEhD,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAyC,OAAA,CAAA0C,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAA3C,OAAA,CAAA2C,IAAA,GAAGhC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -229,7 +229,11 @@ class ConceptDetailModel extends _ResourceModel.default {
|
|
|
229
229
|
*/
|
|
230
230
|
getSourceReferenceCollection(availableLocales = []) {
|
|
231
231
|
if (!this._sourceReferences) {
|
|
232
|
-
|
|
232
|
+
let sectionReferenceTypes = [];
|
|
233
|
+
if (this.conceptType && this.conceptType.sectionReferenceTypes) {
|
|
234
|
+
sectionReferenceTypes = this.conceptType.sectionReferenceTypes;
|
|
235
|
+
}
|
|
236
|
+
this._sourceReferences = new _SourceReferenceCollection.default(this.getSourceReferencesForCurrentLanguage(availableLocales), sectionReferenceTypes, this.entryDate, this.modelOptions);
|
|
233
237
|
}
|
|
234
238
|
return this._sourceReferences;
|
|
235
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptDetailModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ConceptRelationCollection","_SourceReferenceCollection","_ConceptTypeDetailModel","_Constants","ConceptDetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_relations","ConceptRelationCollection","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_find","call","model","ConceptTypeDetailModel","conceptType","key","getData","selfhref","href","selflink","setParameter","TIMEVERSION_FILTER_NAME","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_map","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filter","_includes","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context9","textFragments","textFragment","_context8","textFragmentConfig","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context0","getSourceReferenceCollection","availableLocales","_sourceReferences","SourceReferenceCollection","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context1","_context12","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context10","_context11","_endsWith","availableLanguages","split","value","isOfConceptType","conceptTypeId","exports"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType && this.conceptType.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType && this.conceptType.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig =\n this.conceptType &&\n this.conceptType.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments =\n this.conceptType && this.conceptType.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAcA;AACA;AACA;AACe,MAAMK,kBAAkB,SAASC,sBAAa,CAAC;EAK5D;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIC,kCAAyB,CAC7C,IAAI,CAACC,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,eAAe;EACxB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,oBAAoB;EAC7B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACN,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACO,aAAa,CAACC,YAAY,IAC/BR,IAAI,CAACO,aAAa,CAACC,YAAY,KAAK,eAAe;EAEvD;;EAEA;AACF;EACEC,yBAAyBA,CAAA,EAAqB;IAC5C,MAAMC,eAAe,GAAG,IAAI,CAACC,KAAK,CAACC,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AA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ConceptDetailModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ConceptRelationCollection","_SourceReferenceCollection","_ConceptTypeDetailModel","_Constants","ConceptDetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_relations","ConceptRelationCollection","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_find","call","model","ConceptTypeDetailModel","conceptType","key","getData","selfhref","href","selflink","setParameter","TIMEVERSION_FILTER_NAME","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_map","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filter","_includes","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context9","textFragments","textFragment","_context8","textFragmentConfig","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context0","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","SourceReferenceCollection","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context1","_context12","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context10","_context11","_endsWith","availableLanguages","split","value","isOfConceptType","conceptTypeId","exports"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType && this.conceptType.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType && this.conceptType.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig =\n this.conceptType &&\n this.conceptType.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments =\n this.conceptType && this.conceptType.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType && this.conceptType.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAcA;AACA;AACA;AACe,MAAMK,kBAAkB,SAASC,sBAAa,CAAC;EAK5D;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIC,kCAAyB,CAC7C,IAAI,CAACC,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,eAAe;EACxB;;EAEA;AACF;EACE,WAAWC,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AkB,EACjBR,eAAe,CAACrF,IAAI,CAACsF,SAAS,CAC5BD,eAAe,CAACrF,IAAI,CAACuF,MAAM,GAAGP,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIlF,SAASA,CAAA,EAAkB;IAC7B,OAAO,IAAAkD,OAAA,CAAAvD,OAAA,MAAI,CAACG,IAAI,IAAU+B,kCAAuB,CAAC,EAAEoE,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAC7E,WAAW,EAAE4E,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF;AAACC,OAAA,CAAAzG,OAAA,GAAAL,kBAAA","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
9
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
9
10
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
10
11
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
11
12
|
var _BaseCollection = _interopRequireDefault(require("../base/BaseCollection"));
|
|
@@ -16,9 +17,15 @@ var _SourceReferenceModel = _interopRequireDefault(require("./SourceReferenceMod
|
|
|
16
17
|
class SourceReferenceCollection extends _BaseCollection.default {
|
|
17
18
|
/**
|
|
18
19
|
*/
|
|
19
|
-
constructor(sourceReferences = [], entryDate = null, modelOptions) {
|
|
20
|
+
constructor(sourceReferences = [], sectionReferenceTypes = [], entryDate = null, modelOptions) {
|
|
20
21
|
super();
|
|
21
|
-
this.collection = sourceReferences ? (0, _map.default)(sourceReferences).call(sourceReferences, sourceReference =>
|
|
22
|
+
this.collection = sourceReferences ? (0, _map.default)(sourceReferences).call(sourceReferences, sourceReference => {
|
|
23
|
+
const sectionReferenceType = (0, _find.default)(sectionReferenceTypes).call(sectionReferenceTypes, sectionReferenceType => sectionReferenceType._id === sourceReference.type);
|
|
24
|
+
return new _SourceReferenceModel.default({
|
|
25
|
+
typeLabel: sectionReferenceType?.label,
|
|
26
|
+
...sourceReference
|
|
27
|
+
}, entryDate, modelOptions);
|
|
28
|
+
}) : [];
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceReferenceCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_SourceReferenceModel","SourceReferenceCollection","BaseCollection","constructor","sourceReferences","entryDate","modelOptions","collection","_map","default","call","sourceReference","SourceReferenceModel","byTypes","types","_context","_filter","sourceRef","_includes","
|
|
1
|
+
{"version":3,"file":"SourceReferenceCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_SourceReferenceModel","SourceReferenceCollection","BaseCollection","constructor","sourceReferences","sectionReferenceTypes","entryDate","modelOptions","collection","_map","default","call","sourceReference","sectionReferenceType","_find","_id","type","SourceReferenceModel","typeLabel","label","byTypes","types","_context","_filter","sourceRef","_includes","exports"],"sources":["../../../src/models/concepts/SourceReferenceCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport SourceReferenceModel from \"./SourceReferenceModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Source reference collection\n */\nexport default class SourceReferenceCollection extends BaseCollection<SourceReferenceModel> {\n /**\n */\n constructor(\n sourceReferences: Array<Object> = [],\n sectionReferenceTypes: Array<Object> = [],\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n this.collection = sourceReferences\n ? sourceReferences.map((sourceReference) => {\n const sectionReferenceType = sectionReferenceTypes.find(\n (sectionReferenceType) =>\n sectionReferenceType._id === sourceReference.type,\n );\n return new SourceReferenceModel(\n { typeLabel: sectionReferenceType?.label, ...sourceReference },\n entryDate,\n modelOptions,\n );\n })\n : [];\n }\n\n /**\n */\n byTypes(types: string): Array<SourceReferenceModel> {\n return this.filter((sourceRef) => types.includes(sourceRef.type));\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA;AACA;AACA;AACe,MAAME,yBAAyB,SAASC,uBAAc,CAAuB;EAC1F;AACF;EACEC,WAAWA,CACTC,gBAA+B,GAAG,EAAE,EACpCC,qBAAoC,GAAG,EAAE,EACzCC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;IAEP,IAAI,CAACC,UAAU,GAAGJ,gBAAgB,GAC9B,IAAAK,IAAA,CAAAC,OAAA,EAAAN,gBAAgB,EAAAO,IAAA,CAAhBP,gBAAgB,EAAMQ,eAAe,IAAK;MACxC,MAAMC,oBAAoB,GAAG,IAAAC,KAAA,CAAAJ,OAAA,EAAAL,qBAAqB,EAAAM,IAAA,CAArBN,qBAAqB,EAC/CQ,oBAAoB,IACnBA,oBAAoB,CAACE,GAAG,KAAKH,eAAe,CAACI,IACjD,CAAC;MACD,OAAO,IAAIC,6BAAoB,CAC7B;QAAEC,SAAS,EAAEL,oBAAoB,EAAEM,KAAK;QAAE,GAAGP;MAAgB,CAAC,EAC9DN,SAAS,EACTC,YACF,CAAC;IACH,CAAC,CAAC,GACF,EAAE;EACR;;EAEA;AACF;EACEa,OAAOA,CAACC,KAAa,EAA+B;IAAA,IAAAC,QAAA;IAClD,OAAO,IAAAC,OAAA,CAAAb,OAAA,EAAAY,QAAA,OAAI,EAAAX,IAAA,CAAAW,QAAA,EAASE,SAAS,IAAK,IAAAC,SAAA,CAAAf,OAAA,EAAAW,KAAK,EAAAV,IAAA,CAALU,KAAK,EAAUG,SAAS,CAACR,IAAI,CAAC,CAAC;EACnE;AACF;AAACU,OAAA,CAAAhB,OAAA,GAAAT,yBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceReferenceModel.js","names":["_createHash","require","_ContentLinkModel","_interopRequireDefault","_Href","_constants","_LinkCollection","SourceReferenceModel","constructor","sourceReference","entryDate","modelOptions","_defineProperty2","default","_sourceReference","_entryDate","_modelOptions","origin","contextPath","getBasePathModularUI","links","LinkCollection","_links","link","section","sectionId","self","href","replace","content","ContentLinkModel","selfhref","type","number","label","sourceLabel","sourceAbbreviation","referenceHash","createHashFromHref","fragment","sectionFragment","_default","exports"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport type { ModelOptions, SectionFragment } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get links(): LinkCollection {\n return new LinkCollection(\n this._sourceReference._links,\n null,\n this._modelOptions,\n );\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section =\n this.sectionId ||\n this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return this.link.selfhref;\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get number(): string {\n return this._sourceReference.number;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n *\n */\n get sourceAbbreviation(): string {\n return this._sourceReference.sourceAbbreviation;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n get sectionId(): string {\n return this._sourceReference.sectionId;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment | void {\n return this._sourceReference.sectionFragment;\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAH,sBAAA,CAAAF,OAAA;AAGA;AACA;AACA,MAAMM,oBAAoB,CAAC;EAKzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EACvBC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IACA,IAAI,CAACC,gBAAgB,GAAGL,eAAe;IACvC,IAAI,CAACM,UAAU,GAAGL,SAAS;IAC3B,IAAI,CAACM,aAAa,GAAGL,YAAY,IAAI;MACnCM,MAAM,EAAE,EAAE;MACVC,WAAW,EAAE,IAAAC,+BAAoB,EAAC;IACpC,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,KAAKA,CAAA,EAAmB;IAC1B,OAAO,IAAIC,uBAAc,CACvB,IAAI,CAACP,gBAAgB,CAACQ,MAAM,EAC5B,IAAI,EACJ,IAAI,CAACN,aACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIO,IAAIA,CAAA,EAAqB;IAC3B,MAAMC,OAAO,GACX,IAAI,CAACC,SAAS,IACd,IAAI,CAACX,gBAAgB,CAACQ,MAAM,CAACI,IAAI,CAACC,IAAI,CAACC,OAAO,CAC5C,GAAG,IAAI,CAACd,gBAAgB,CAACQ,MAAM,CAACO,OAAO,CAACF,IAAI,GAAG,EAC/C,EACF,CAAC;IAEH,OAAO,IAAIG,yBAAgB,CACzB;MACE,GAAG,IAAI,CAAChB,gBAAgB;MACxBU;IACF,CAAC,EACD,IAAI,CAACT,UAAU,EACf,IAAI,CAACC,aACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIe,QAAQA,CAAA,EAAS;IACnB,OAAO,IAAI,CAACR,IAAI,CAACQ,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAAClB,gBAAgB,CAACkB,IAAI;EACnC;;EAEA;AACF;EACE,IAAIC,
|
|
1
|
+
{"version":3,"file":"SourceReferenceModel.js","names":["_createHash","require","_ContentLinkModel","_interopRequireDefault","_Href","_constants","_LinkCollection","SourceReferenceModel","constructor","sourceReference","entryDate","modelOptions","_defineProperty2","default","_sourceReference","_entryDate","_modelOptions","origin","contextPath","getBasePathModularUI","links","LinkCollection","_links","link","section","sectionId","self","href","replace","content","ContentLinkModel","selfhref","type","typeLabel","number","label","sourceLabel","sourceAbbreviation","referenceHash","createHashFromHref","fragment","sectionFragment","_default","exports"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport type { ModelOptions, SectionFragment } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get links(): LinkCollection {\n return new LinkCollection(\n this._sourceReference._links,\n null,\n this._modelOptions,\n );\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section =\n this.sectionId ||\n this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return this.link.selfhref;\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get typeLabel(): string {\n return this._sourceReference.typeLabel;\n }\n\n /**\n */\n get number(): string {\n return this._sourceReference.number;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n *\n */\n get sourceAbbreviation(): string {\n return this._sourceReference.sourceAbbreviation;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n get sectionId(): string {\n return this._sourceReference.sectionId;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment | void {\n return this._sourceReference.sectionFragment;\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAH,sBAAA,CAAAF,OAAA;AAGA;AACA;AACA,MAAMM,oBAAoB,CAAC;EAKzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EACvBC,SAAoB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AAO,IAAI,CAACpB,gBAAgB,CAACoB,MAAM;EACrC;;EAEA;AACF;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACrB,gBAAgB,CAACqB,KAAK;EACpC;;EAEA;AACF;EACE,IAAIC,WAAWA,CAAA,EAAW;IACxB,OAAO,IAAI,CAACtB,gBAAgB,CAACsB,WAAW;EAC1C;;EAEA;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAW;IAC/B,OAAO,IAAI,CAACvB,gBAAgB,CAACuB,kBAAkB;EACjD;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAAC,8BAAkB,EAAC,IAAI,CAACR,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACE,IAAIN,SAASA,CAAA,EAAW;IACtB,OAAO,IAAI,CAACX,gBAAgB,CAACW,SAAS;EACxC;;EAEA;AACF;AACA;EACE,IAAIe,QAAQA,CAAA,EAA2B;IACrC,OAAO,IAAI,CAAC1B,gBAAgB,CAAC2B,eAAe;EAC9C;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEcN,oBAAoB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -166,7 +166,7 @@ export const cacheContributions = (): boolean =>
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* The context path is retrieved on the server using the context path property as set in the runtime properties
|
|
169
|
-
* This can be manually
|
|
169
|
+
* This can be manually overriden by setting the UI setting 'CONTEXT_PATH'
|
|
170
170
|
*/
|
|
171
171
|
export const getBasePath = (): string =>
|
|
172
172
|
getSetting("CONTEXT_PATH", "/BeInformed");
|
|
@@ -271,8 +271,14 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
271
271
|
availableLocales: Array<string> = [],
|
|
272
272
|
): SourceReferenceCollection {
|
|
273
273
|
if (!this._sourceReferences) {
|
|
274
|
+
let sectionReferenceTypes = [];
|
|
275
|
+
if (this.conceptType && this.conceptType.sectionReferenceTypes) {
|
|
276
|
+
sectionReferenceTypes = this.conceptType.sectionReferenceTypes;
|
|
277
|
+
}
|
|
278
|
+
|
|
274
279
|
this._sourceReferences = new SourceReferenceCollection(
|
|
275
280
|
this.getSourceReferencesForCurrentLanguage(availableLocales),
|
|
281
|
+
sectionReferenceTypes,
|
|
276
282
|
this.entryDate,
|
|
277
283
|
this.modelOptions,
|
|
278
284
|
);
|
|
@@ -11,16 +11,24 @@ export default class SourceReferenceCollection extends BaseCollection<SourceRefe
|
|
|
11
11
|
*/
|
|
12
12
|
constructor(
|
|
13
13
|
sourceReferences: Array<Object> = [],
|
|
14
|
+
sectionReferenceTypes: Array<Object> = [],
|
|
14
15
|
entryDate: ?ISO_DATE = null,
|
|
15
16
|
modelOptions?: ModelOptions,
|
|
16
17
|
) {
|
|
17
18
|
super();
|
|
18
19
|
|
|
19
20
|
this.collection = sourceReferences
|
|
20
|
-
? sourceReferences.map(
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
? sourceReferences.map((sourceReference) => {
|
|
22
|
+
const sectionReferenceType = sectionReferenceTypes.find(
|
|
23
|
+
(sectionReferenceType) =>
|
|
24
|
+
sectionReferenceType._id === sourceReference.type,
|
|
25
|
+
);
|
|
26
|
+
return new SourceReferenceModel(
|
|
27
|
+
{ typeLabel: sectionReferenceType?.label, ...sourceReference },
|
|
28
|
+
entryDate,
|
|
29
|
+
modelOptions,
|
|
30
|
+
);
|
|
31
|
+
})
|
|
24
32
|
: [];
|
|
25
33
|
}
|
|
26
34
|
|