@beinformed/ui 1.65.24 → 1.65.26
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 +18 -0
- package/esm/builder/mergeLayoutHintConfigurations.js +7 -5
- package/esm/builder/mergeLayoutHintConfigurations.js.flow +12 -5
- package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/esm/constants/Settings.js +4 -1
- package/esm/constants/Settings.js.flow +3 -3
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useAuthentication.js +7 -3
- package/esm/hooks/useAuthentication.js.flow +6 -3
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModelCatalog.js +1 -1
- package/esm/hooks/useModelCatalog.js.flow +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/i18n/Locale.js +7 -1
- package/esm/i18n/Locale.js.flow +4 -2
- package/esm/i18n/Locale.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +1 -1
- package/esm/models/actions/ActionCollection.js.flow +3 -3
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +6 -1
- package/esm/models/application/ApplicationModel.js.flow +7 -2
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +3 -5
- package/esm/models/attributes/ChoiceAttributeModel.js.flow +3 -5
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js.flow +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/NumberAttributeModel.js +3 -1
- package/esm/models/attributes/NumberAttributeModel.js.flow +2 -1
- package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
- package/esm/models/attributes/StringAttributeModel.js +9 -4
- package/esm/models/attributes/StringAttributeModel.js.flow +7 -4
- package/esm/models/attributes/StringAttributeModel.js.map +1 -1
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.flow +1 -1
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
- package/esm/models/base/BaseModel.js +8 -5
- package/esm/models/base/BaseModel.js.flow +8 -5
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +6 -7
- package/esm/models/base/ResourceModel.js.flow +4 -4
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +16 -16
- package/esm/models/concepts/ConceptDetailModel.js.flow +16 -19
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js.flow +1 -2
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +6 -6
- package/esm/models/content/ContentLinkModel.js.flow +6 -6
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js +3 -5
- package/esm/models/filters/BaseFilterModel.js.flow +4 -5
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/StringFilterModel.js +4 -2
- package/esm/models/filters/StringFilterModel.js.flow +3 -2
- package/esm/models/filters/StringFilterModel.js.map +1 -1
- package/esm/models/form/FormModel.js +1 -1
- package/esm/models/form/FormModel.js.flow +1 -2
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +1 -1
- package/esm/models/form/FormObjectModel.js.flow +2 -3
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/href/Href.js +2 -2
- package/esm/models/href/Href.js.flow +2 -2
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/index.js +2 -2
- package/esm/models/index.js.flow +1 -2
- package/esm/models/index.js.map +1 -1
- package/esm/models/links/normalizeLinkJSON.js +1 -1
- package/esm/models/links/normalizeLinkJSON.js.flow +1 -1
- package/esm/models/links/normalizeLinkJSON.js.map +1 -1
- package/esm/modularui/Authenticate.js +7 -2
- package/esm/modularui/Authenticate.js.flow +4 -2
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +2 -5
- package/esm/modularui/ModularUIRequest.js.flow +2 -6
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/UploadRequest.js +3 -1
- package/esm/modularui/UploadRequest.js.flow +3 -1
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/react-client/client.js +22 -10
- package/esm/react-client/client.js.flow +17 -11
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-client/contextPath.js +3 -1
- package/esm/react-client/contextPath.js.flow +2 -1
- package/esm/react-client/contextPath.js.map +1 -1
- package/esm/redux/_i18n/I18nReducer.js +1 -4
- package/esm/redux/_i18n/I18nReducer.js.flow +1 -4
- package/esm/redux/_i18n/I18nReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +1 -4
- package/esm/redux/_modularui/ModularUIActions.js.flow +1 -5
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js +3 -4
- package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -1
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +6 -3
- package/esm/redux/_modularui/ModularUIReducer.js.flow +2 -2
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/actions/Authorization.js +4 -2
- package/esm/redux/actions/Authorization.js.flow +3 -2
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/Preferences.js +4 -4
- package/esm/redux/actions/Preferences.js.flow +6 -10
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/reducers/ModelCatalogReducer.js +7 -9
- package/esm/redux/reducers/ModelCatalogReducer.js.flow +8 -9
- package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/esm/redux/store/configureStore.js +6 -1
- package/esm/redux/store/configureStore.js.flow +4 -1
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/redux/types.js.flow +10 -1
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/browser/Cache.js +3 -1
- package/esm/utils/browser/Cache.js.flow +2 -1
- package/esm/utils/browser/Cache.js.map +1 -1
- package/esm/utils/browser/__tests__/Cookies.spec.js.flow +2 -1
- package/esm/utils/datetime/DateTimeUtil.js +6 -5
- package/esm/utils/datetime/DateTimeUtil.js.flow +5 -11
- package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
- package/esm/utils/datetime/__tests__/DateTimeFormat.spec.js.flow +0 -6
- package/esm/utils/fetch/universalFetch.js +7 -8
- package/esm/utils/fetch/universalFetch.js.flow +13 -14
- package/esm/utils/fetch/universalFetch.js.map +1 -1
- package/esm/utils/fetch/xhr.js +2 -5
- package/esm/utils/fetch/xhr.js.flow +2 -6
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/createHref.js +4 -1
- package/esm/utils/helpers/createHref.js.flow +2 -1
- package/esm/utils/helpers/createHref.js.map +1 -1
- package/esm/utils/helpers/createUUID.js +2 -1
- package/esm/utils/helpers/createUUID.js.flow +1 -1
- package/esm/utils/helpers/createUUID.js.map +1 -1
- package/esm/utils/number/parseNumbers.js +6 -3
- package/esm/utils/number/parseNumbers.js.flow +4 -3
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js +7 -5
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/Settings.js +4 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useAuthentication.js +7 -3
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModelCatalog.js +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/i18n/Locale.js +7 -1
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/models/actions/ActionCollection.js +1 -1
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +6 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +3 -5
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js +3 -1
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js +9 -4
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
- package/lib/models/base/BaseModel.js +8 -5
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +6 -7
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +16 -16
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +6 -6
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js +3 -5
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/StringFilterModel.js +4 -2
- package/lib/models/filters/StringFilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/href/Href.js +2 -2
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/index.js.map +1 -1
- package/lib/models/links/normalizeLinkJSON.js +1 -1
- package/lib/models/links/normalizeLinkJSON.js.map +1 -1
- package/lib/modularui/Authenticate.js +7 -2
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +2 -5
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/UploadRequest.js +3 -1
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/react-client/client.js +22 -10
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/contextPath.js +4 -1
- package/lib/react-client/contextPath.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js +1 -4
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +1 -4
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js +3 -4
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +6 -3
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/actions/Authorization.js +4 -2
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Preferences.js +4 -4
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/reducers/ModelCatalogReducer.js +7 -9
- package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/lib/redux/store/configureStore.js +6 -1
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/browser/Cache.js +3 -1
- package/lib/utils/browser/Cache.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js +6 -5
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js +7 -8
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js +2 -5
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/createHref.js +4 -1
- package/lib/utils/helpers/createHref.js.map +1 -1
- package/lib/utils/helpers/createUUID.js +3 -1
- package/lib/utils/helpers/createUUID.js.map +1 -1
- package/lib/utils/number/parseNumbers.js +6 -3
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 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\n */\nexport const loginType = (): string | Array<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,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c,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":[]}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","_globalThis2","default","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","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 // $FlowIssue\n globalThis?.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\n */\nexport const loginType = (): string | Array<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;EACV;EACAI,YAAA,CAAAC,OAAA,EAAYC,WAAW,IACvB,aAAa;EAEf;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;EACAC,8BA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A,KAAM;EAC3D,IAAIC,cAAc,GAAGrC,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC,IAAAsC,WAAA,CAAAhF,OAAA,EAAA+E,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,GAAIlF,WAAmB,IAAK;EACrD+C,UAAU,CAAC,cAAc,EAAE/C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAwC,OAAA,CAAA0C,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAA3C,OAAA,CAAA2C,IAAA,GAAGhC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useLogout = exports.useLogin = void 0;
|
|
8
|
+
var _globalThis2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/global-this"));
|
|
8
9
|
var _reactRedux = require("react-redux");
|
|
9
10
|
var _actions = require("../redux/actions");
|
|
10
11
|
var _Cache = _interopRequireDefault(require("../utils/browser/Cache"));
|
|
@@ -36,7 +37,8 @@ const useLogin = () => {
|
|
|
36
37
|
}
|
|
37
38
|
if (!isAuthenticated) {
|
|
38
39
|
_Cache.default.setItem("isRedirectLogin", true);
|
|
39
|
-
|
|
40
|
+
// $FlowIssue
|
|
41
|
+
_globalThis2.default.location.assign(`${(0, _constants.getBasePathServer)()}${authenticationType.redirectUri ?? ""}`);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
};
|
|
@@ -64,10 +66,12 @@ const useLogout = () => {
|
|
|
64
66
|
return; // Redirects stop execution
|
|
65
67
|
}
|
|
66
68
|
if (_Cache.default.getItem("isRedirectLogin")) {
|
|
67
|
-
|
|
69
|
+
// $FlowIssue
|
|
70
|
+
const origin = _globalThis2.default.location.origin;
|
|
68
71
|
const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;
|
|
69
72
|
_Cache.default.setItem("isRedirectLogin", false);
|
|
70
|
-
|
|
73
|
+
// $FlowIssue
|
|
74
|
+
_globalThis2.default.location.assign(url);
|
|
71
75
|
return;
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthentication.js","names":["_reactRedux","require","_actions","_Cache","_interopRequireDefault","_constants","_exceptions","_modularui","_useModularUIModel","useLogin","Cache","setItem","dispatch","useDispatch","application","useApplication","auth","useSelector","state","isAuthenticated","isLoggedIn","cachedType","getItem","primaryAuthenticationType","authenticationTypes","errorMessage","error","resetErrors","resetAuthErrors","login","username","password","redirectLogin","authenticationType","IllegalStateException","authentication","redirectUri","
|
|
1
|
+
{"version":3,"file":"useAuthentication.js","names":["_reactRedux","require","_actions","_Cache","_interopRequireDefault","_constants","_exceptions","_modularui","_useModularUIModel","useLogin","Cache","setItem","dispatch","useDispatch","application","useApplication","auth","useSelector","state","isAuthenticated","isLoggedIn","cachedType","getItem","primaryAuthenticationType","authenticationTypes","errorMessage","error","resetErrors","resetAuthErrors","login","username","password","redirectLogin","authenticationType","IllegalStateException","authentication","redirectUri","_globalThis2","default","location","assign","getBasePathServer","exports","useLogout","BASE_PATH","getBasePath","authenticate","Authenticate","logout","type","INTERNAL_LOGIN_TYPE","PAC4J_INDIRECT","redirectToLogout","origin","url","getLogoutUrl","logoutUrl"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\nimport Cache from \"../utils/browser/Cache\";\nimport {\n getBasePath,\n getBasePathServer,\n INTERNAL_LOGIN_TYPE,\n} from \"../constants\";\nimport { IllegalStateException } from \"../exceptions\";\nimport { Authenticate } from \"../modularui\";\nimport { useApplication } from \"./useModularUIModel\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\n\ntype LoginHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: ?AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => any, // Changed to any for Promise support\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\n\ntype LogoutHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: ?AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => any, // Changed to any for Promise support\n logoutUrl: string,\n};\n\n/**\n * Hook for handling login logic\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n const application = useApplication();\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n const cachedType = Cache.getItem(\"primaryAuthenticationType\");\n\n return {\n isAuthenticated,\n // Safely fallback to the first available type if nothing is cached\n primaryAuthenticationType:\n cachedType ?? application?.authenticationTypes?.[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n throw new IllegalStateException(\n `Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n // $FlowIssue\n globalThis.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n * Hook for handling logout logic\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useApplication();\n const BASE_PATH = getBasePath();\n const authenticate = new Authenticate();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n const cachedType = Cache.getItem(\"primaryAuthenticationType\");\n\n return {\n isAuthenticated,\n primaryAuthenticationType:\n cachedType ?? application?.authenticationTypes?.[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n logout: () => {\n const type = authenticate.authenticationType;\n\n if (type === INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT) {\n authenticate.redirectToLogout();\n return; // Redirects stop execution\n }\n\n if (Cache.getItem(\"isRedirectLogin\")) {\n // $FlowIssue\n const origin = globalThis.location.origin;\n const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n // $FlowIssue\n globalThis.location.assign(url);\n return;\n }\n\n // Returns the Promise from the logout thunk\n return dispatch(logout());\n },\n logoutUrl: authenticate.getLogoutUrl(),\n };\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AAuBA;AACA;AACA;AACO,MAAMQ,QAAQ,GAAGA,CAAA,KAAiB;EACvCC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAMC,WAAW,GAAG,IAAAC,iCAAc,EAAC,CAAC;EACpC,MAAMC,IAAI,GAAG,IAAAC,uBAAW,EAAEC,KAAK,IAAKA,KAAK,CAACF,IAAI,CAAC;EAE/C,MAAMG,eAAe,GAAGL,WAAW,EAAEM,UAAU,IAAI,KAAK;EACxD,MAAMC,UAAU,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uBAAY,CAAC,CAAC;EAEvC,MAAM5B,eAAe,GAAGL,WAAW,EAAEM,UAAU,IAAI,KAAK;EACxD,MAAMC,UAAU,GAAGX,cAAK,CAACY,OAAO,CAAC,2BAA2B,CAAC;EAE7D,OAAO;IACLH,eAAe;IACfI,yBAAyB,EACvBF,UAAU,IAAIP,WAAW,EAAEU,mBAAmB,GAAG,CAAC,CAAC;IACrDA,mBAAmB,EAAEV,WAAW,EAAEU,mBAAmB,IAAI,EAAE;IAC3DwB,MAAM,EAAEA,CAAA,KAAM;MACZ,MAAMC,IAAI,GAAGH,YAAY,CAACb,kBAAkB;MAE5C,IAAIgB,IAAI,KAAKC,8BAAmB,CAACC,cAAc,EAAE;QAC/CL,YAAY,CAACM,gBAAgB,CAAC,CAAC;QAC/B,OAAO,CAAC;MACV;MAEA,IAAI1C,cAAK,CAACY,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC;QACA,MAAM+B,MAAM,GAAGhB,YAAA,CAAAC,OAAA,CAAWC,QAAQ,CAACc,MAAM;QACzC,MAAMC,GAAG,GAAG,GAAGR,YAAY,CAACS,YAAY,CAAC,CAAC,QAAQF,MAAM,GAAGT,SAAS,EAAE;QACtElC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvC;QACA0B,YAAA,CAAAC,OAAA,CAAWC,QAAQ,CAACC,MAAM,CAACc,GAAG,CAAC;QAC/B;MACF;;MAEA;MACA,OAAO1C,QAAQ,CAAC,IAAAoC,eAAM,EAAC,CAAC,CAAC;IAC3B,CAAC;IACDQ,SAAS,EAAEV,YAAY,CAACS,YAAY,CAAC;EACvC,CAAC;AACH,CAAC;AAACb,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -175,7 +175,7 @@ const useEntryDate = () => {
|
|
|
175
175
|
const entryDate = (0, _reactRedux.useSelector)(_modelcatalog.getEntryDate);
|
|
176
176
|
return {
|
|
177
177
|
entryDate,
|
|
178
|
-
setEntryDate:
|
|
178
|
+
setEntryDate: date => dispatch((0, _ModelCatalog.updateEntryDate)(date))
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","_Href","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","removeParameter","addParameter","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","length","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","updateEntryDate","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,mBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,sBAAA,GAAAH,sBAAA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AAS,CAAC;EAExC,OAAO,IAAAR,oCAAiB,EAACO,GAAG,EAAEG,GAAG,EAAE;IACjCT,cAAc,EAAE,CAAC,cAAc,CAAC;IAChCC,WAAW,EAAEW,0BAAiB;IAC9B,GAAGd;EACL,CAAC,CAAC;AACJ,CAAC;AAACK,OAAA,CAAAmD,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","_Href","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","removeParameter","addParameter","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","length","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","date","updateEntryDate","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (date: ISO_DATE) => dispatch(updateEntryDate(date)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,kBAAA,GAA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4BAAgB,EAACL,IAAI,EAAE,CAAC,eAAe,CAAC,CAAC;EACrDI,GAAG,CAACE,YAAY,CAAC,WAAW,EAAEJ,SAAS,CAAC;EAExC,OAAO,IAAAR,oCAAiB,EAACO,GAAG,EAAEG,GAAG,EAAE;IACjCT,cAAc,EAAE,CAAC,cAAc,CAAC;IAChCC,WAAW,EAAEW,0BAAiB;IAC9B,GAAGd;EACL,CAAC,CAAC;AACJ,CAAC;AAACK,OAAA,CAAAoD,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/lib/i18n/Locale.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _replaceAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/replace-all"));
|
|
8
9
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
10
11
|
var _formatMessage = _interopRequireDefault(require("format-message"));
|
|
@@ -71,7 +72,12 @@ class Locale {
|
|
|
71
72
|
* This method converts the ${} to {}
|
|
72
73
|
*/
|
|
73
74
|
fixPlaceHoldersInObject(messages = {}) {
|
|
74
|
-
|
|
75
|
+
var _context, _context2;
|
|
76
|
+
return JSON.parse((0, _replaceAll.default)(_context = (0, _replaceAll.default)(_context2 = (0, _stringify.default)(messages)
|
|
77
|
+
// $FlowIssue
|
|
78
|
+
).call(_context2, /'\$\{(?<key>.*?)}'/g, "''{$<key>}''")
|
|
79
|
+
// $FlowIssue
|
|
80
|
+
).call(_context, /\$\{(?<key>.*?)}/g, "{$<key>}"));
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
/**
|
package/lib/i18n/Locale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Locale.js","names":["_formatMessage","_interopRequireDefault","require","_languages","_exceptions","_constants","Locale","constructor","locale","_defineProperty2","default","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","_nativeName","nativeName","formatMessage","setup","missingTranslation","aLocale","split","length","language","languages","lang","toUpperCase","IllegalStateException","fixPlaceHolders","message","replace","JSON","parse","_stringify","getBaseMessage","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","getSetting","console","debug","parameters","getMessage","update","_default","exports"],"sources":["../../src/i18n/Locale.js"],"sourcesContent":["// @flow\nimport formatMessage from \"format-message\";\n\nimport languages from \"./languages\";\nimport { IllegalStateException } from \"../exceptions\";\n\nimport { getSetting } from \"../constants\";\n\nimport type { LocaleConfiguration, MessageParameters } from \"./types\";\n\n/**\n * Create a locale\n */\nclass Locale {\n _code: string;\n _messages: { [string]: string };\n _errors: { [string]: string };\n _nativeName: ?string;\n\n constructor(locale: LocaleConfiguration) {\n this._code = locale.code;\n\n this._messages = this.fixPlaceHoldersInObject(locale.messages);\n this._errors = this.fixPlaceHoldersInObject(locale.errors);\n\n this._nativeName = locale.nativeName;\n\n formatMessage.setup({\n missingTranslation: \"ignore\",\n });\n }\n\n /**\n * Retrieve locale code\n */\n get code(): string {\n return this._code;\n }\n\n /**\n * Retrieve nativeName\n */\n get nativeName(): string {\n if (this._nativeName) {\n return this._nativeName;\n }\n\n const aLocale = this.code.split(\"-\");\n\n if (aLocale.length > 0) {\n const language = languages.lang[aLocale[0]];\n\n if (language) {\n return (\n language[1] + (aLocale[1] ? ` (${aLocale[1].toUpperCase()})` : \"\")\n );\n }\n }\n\n throw new IllegalStateException(\n `Can not find language name based on locale: ${this.code}`,\n );\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHolders(message: ?string): null | string {\n if (typeof message === \"string\") {\n return message\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\");\n }\n\n return null;\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHoldersInObject(messages: Object = {}): Object {\n return JSON.parse(\n JSON.stringify(messages)\n .
|
|
1
|
+
{"version":3,"file":"Locale.js","names":["_formatMessage","_interopRequireDefault","require","_languages","_exceptions","_constants","Locale","constructor","locale","_defineProperty2","default","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","_nativeName","nativeName","formatMessage","setup","missingTranslation","aLocale","split","length","language","languages","lang","toUpperCase","IllegalStateException","fixPlaceHolders","message","replace","_context","_context2","JSON","parse","_replaceAll","_stringify","call","getBaseMessage","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","getSetting","console","debug","parameters","getMessage","update","_default","exports"],"sources":["../../src/i18n/Locale.js"],"sourcesContent":["// @flow\nimport formatMessage from \"format-message\";\n\nimport languages from \"./languages\";\nimport { IllegalStateException } from \"../exceptions\";\n\nimport { getSetting } from \"../constants\";\n\nimport type { LocaleConfiguration, MessageParameters } from \"./types\";\n\n/**\n * Create a locale\n */\nclass Locale {\n _code: string;\n _messages: { [string]: string };\n _errors: { [string]: string };\n _nativeName: ?string;\n\n constructor(locale: LocaleConfiguration) {\n this._code = locale.code;\n\n this._messages = this.fixPlaceHoldersInObject(locale.messages);\n this._errors = this.fixPlaceHoldersInObject(locale.errors);\n\n this._nativeName = locale.nativeName;\n\n formatMessage.setup({\n missingTranslation: \"ignore\",\n });\n }\n\n /**\n * Retrieve locale code\n */\n get code(): string {\n return this._code;\n }\n\n /**\n * Retrieve nativeName\n */\n get nativeName(): string {\n if (this._nativeName) {\n return this._nativeName;\n }\n\n const aLocale = this.code.split(\"-\");\n\n if (aLocale.length > 0) {\n const language = languages.lang[aLocale[0]];\n\n if (language) {\n return (\n language[1] + (aLocale[1] ? ` (${aLocale[1].toUpperCase()})` : \"\")\n );\n }\n }\n\n throw new IllegalStateException(\n `Can not find language name based on locale: ${this.code}`,\n );\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHolders(message: ?string): null | string {\n if (typeof message === \"string\") {\n return message\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\");\n }\n\n return null;\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHoldersInObject(messages: Object = {}): Object {\n return JSON.parse(\n JSON.stringify(messages)\n // $FlowIssue\n .replaceAll(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n // $FlowIssue\n .replaceAll(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\"),\n );\n }\n\n /**\n * Retrieve message by id\n */\n getBaseMessage(id: string, defaultMessage?: string): string {\n if (!id && !defaultMessage) {\n return \"[message: id or defaultMessage missing]\";\n }\n\n const messageFromLocale = this._messages[id] || this._errors[id];\n\n if (\n (typeof process === \"undefined\" ||\n process.env.NODE_ENV !== \"production\") &&\n !messageFromLocale &&\n id &&\n getSetting(\"DEBUG_I18N_MESSAGE_NOT_FOUND\")\n ) {\n // eslint-disable-next-line no-console\n console.debug(\n `Message with id ${id} not found for locale ${this.code} in layout translations`,\n );\n }\n return messageFromLocale || this.fixPlaceHolders(defaultMessage) || id;\n }\n\n /**\n * Format message using formatMessage library\n */\n formatMessage(message: string, parameters?: MessageParameters): string {\n if (parameters) {\n return formatMessage(message, parameters);\n }\n\n return message;\n }\n\n /**\n * Retrieve a messages with replaced parameters\n */\n getMessage(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters,\n ): string {\n const message = this.getBaseMessage(id, defaultMessage);\n return this.formatMessage(message, parameters);\n }\n\n /**\n * Add or change messages for this locale. It is not possible to remove messages.\n */\n update(messages: Object = {}, errors: Object = {}) {\n this._messages = {\n ...this._messages,\n ...this.fixPlaceHoldersInObject(messages),\n };\n\n this._errors = {\n ...this._errors,\n ...this.fixPlaceHoldersInObject(errors),\n };\n }\n}\n\nexport default Locale;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAIA;AACA;AACA;AACA,MAAMI,MAAM,CAAC;EAMXC,WAAWA,CAACC,MAA2B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IACvC,IAAI,CAACC,KAAK,GAAGH,MAAM,CAACI,IAAI;IAExB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACC,uBAAuB,CAACN,MAAM,CAACO,QAAQ,CAAC;IAC9D,IAAI,CAACC,OAAO,GAAG,IAAI,CAACF,uBAAuB,CAACN,MAAM,CAACS,MAAM,CAAC;IAE1D,IAAI,CAACC,WAAW,GAAGV,MAAM,CAACW,UAAU;IAEpCC,sBAAa,CAACC,KAAK,CAAC;MAClBC,kBAAkB,EAAE;IACtB,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;EACE,IAAIV,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACD,KAAK;EACnB;;EAEA;AACF;AACA;EACE,IAAIQ,UAAUA,CAAA,EAAW;IACvB,IAAI,IAAI,CAACD,WAAW,EAAE;MACpB,OAAO,IAAI,CAACA,WAAW;IACzB;IAEA,MAAMK,OAAO,GAAG,IAAI,CAACX,IAAI,CAACY,KAAK,CAAC,GAAG,CAAC;IAEpC,IAAID,OAAO,CAACE,MAAM,GAAG,CAAC,EAAE;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
@@ -24,7 +24,7 @@ class ActionCollection extends _BaseCollection.default {
|
|
|
24
24
|
} else if (Array.isArray(actionsContributions)) {
|
|
25
25
|
const actionModels = [];
|
|
26
26
|
for (const actionData of actions) {
|
|
27
|
-
const actionContribution = (0, _find.default)(actionsContributions).call(actionsContributions,
|
|
27
|
+
const actionContribution = (0, _find.default)(actionsContributions).call(actionsContributions, contribution => contribution.name === actionData.name && contribution.type !== "service-operation");
|
|
28
28
|
if (actionContribution) {
|
|
29
29
|
actionModels.push(new _ActionModel.default(actionData, actionContribution, modelOptions));
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_ActionModel","ActionCollection","BaseCollection","constructor","actions","actionsContributions","modelOptions","Array","isArray","collection","actionModels","actionData","actionContribution","_find","default","call","name","type","push","ActionModel","getActionByKey","key","_context","newCollection","_filter","action","first","getActionsByType","_context2","_includes","getActionsByLayoutHint","hints","_context3","layouthint","has","hasActionsByLayoutHint","length","routePath","_context4","enabledRoutes","isDisabled","path","_map","selfhref","join","exports"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (
|
|
1
|
+
{"version":3,"file":"ActionCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_ActionModel","ActionCollection","BaseCollection","constructor","actions","actionsContributions","modelOptions","Array","isArray","collection","actionModels","actionData","actionContribution","_find","default","call","contribution","name","type","push","ActionModel","getActionByKey","key","_context","newCollection","_filter","action","first","getActionsByType","_context2","_includes","getActionsByLayoutHint","hints","_context3","layouthint","has","hasActionsByLayoutHint","length","routePath","_context4","enabledRoutes","isDisabled","path","_map","selfhref","join","exports"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (contribution) =>\n contribution.name === actionData.name &&\n contribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(\n new ActionModel(actionData, actionContribution, modelOptions),\n );\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA;AACA;AACA;AACe,MAAME,gBAAgB,SAASC,uBAAc,CAAc;EACxEC,WAAWA,CACTC,OAAgB,EAChBC,oBAA6B,EAC7BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;MAC3B,IAAI,CAACK,UAAU,GAAG,EAAE;IACtB,CAAC,MAAM,IAAIF,KAAK,CAACC,OAAO,CAACH,oBAAoB,CAAC,EAAE;MAC9C,MAAMK,YAAY,GAAG,EAAE;MACvB,KAAK,MAAMC,UAAU,IAAIP,OAAO,EAAE;QAChC,MAAMQ,kBAAkB,GAAG,IAAAC,KAAA,CAAAC,OAAA,EAAAT,oBAAoB,EAAAU,IAAA,CAApBV,oBAAoB,EAC5CW,YAAY,IACXA,YAAY,CAACC,IAAI,KAAKN,UAAU,CAACM,IAAI,IACrCD,YAAY,CAACE,IAAI,KAAK,mBAC1B,CAAC;QAED,IAAIN,kBAAkB,EAAE;UACtBF,YAAY,CAACS,IAAI,CACf,IAAIC,oBAAW,CAACT,UAAU,EAAEC,kBAAkB,EAAEN,YAAY,CAC9D,CAAC;QACH;MACF;MAEA,IAAI,CAACG,UAAU,GAAGC,YAAY;IAChC;EACF;;EAEA;AACF;AACA;EACEW,cAAcA,CAACC,GAAW,EAAsB;IAAA,IAAAC,QAAA;IAC9C,MAAMC,aAAa,GAAG,IAAIvB,gBAAgB,CAAC,CAAC;IAE5CuB,aAAa,CAACf,UAAU,GAAG,IAAAg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AAA,CAAAX,OAAA,EAAAyB,SAAA,OAAI,CAAC9B,UAAU,EAAAM,IAAA,CAAAwB,SAAA,EAClCb,MAAM,IAAK,CAACA,MAAM,CAACe,UACtB,CAAC;IAED,IAAID,aAAa,CAACH,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMK,IAAI,GAAG,IAAAC,IAAA,CAAA7B,OAAA,EAAA0B,aAAa,EAAAzB,IAAA,CAAbyB,aAAa,EAAMd,MAAM,IAAKA,MAAM,CAACkB,QAAQ,CAACF,IAAI,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE1E,OAAO,IAAI,CAACR,MAAM,GAAG,CAAC,GAAG,IAAIK,IAAI,GAAG,GAAGA,IAAI;EAC7C;AACF;AAACI,OAAA,CAAAhC,OAAA,GAAAb,gBAAA","ignoreList":[]}
|
|
@@ -79,7 +79,12 @@ class ApplicationModel extends _ResourceModel.default {
|
|
|
79
79
|
if (authenticationTypes) {
|
|
80
80
|
var _context;
|
|
81
81
|
//put primary first
|
|
82
|
-
return ((_context = authenticationTypes) == null ? void 0 : Function.call.bind((0, _sort.default)(_context), _context))?.((a, b) =>
|
|
82
|
+
return ((_context = authenticationTypes) == null ? void 0 : Function.call.bind((0, _sort.default)(_context), _context))?.((a, b) => {
|
|
83
|
+
if (a.isPrimary === b.isPrimary) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
return a.isPrimary ? -1 : 1;
|
|
87
|
+
});
|
|
83
88
|
}
|
|
84
89
|
return [_constants.DEFAULT_AUTHENTICATION_TYPE];
|
|
85
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationModel.js","names":["_ResourceModel","_interopRequireDefault","require","_LinkModel","_UserServicesModel","_exceptions","_constants","_Cache","ApplicationModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","Cache","setItem","primaryAuthenticationType","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","NotAllowedUriException","setChildModels","models","userServiceModel","_find","call","model","userServices","label","getContribution","authenticationTypes","DEFAULT_AUTHENTICATION_TYPE","_context","Function","bind","_sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","LinkModel","create","modelOptions","_userServices","UserServicesModel","isLoggedIn","userHref","userLink","userMustChangePassword","mustChangePassword","exports"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport { DEFAULT_AUTHENTICATION_TYPE } from \"../../constants\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n // store authentication type in session cache, to make it available when application is no longer available (when not permitted for example)\n Cache.setItem(\"primaryAuthenticationType\", this.primaryAuthenticationType);\n }\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ApplicationModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\",\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\",\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n const authenticationTypes = this.getContribution(\"security\", [\n DEFAULT_AUTHENTICATION_TYPE,\n ]);\n\n if (authenticationTypes) {\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType)
|
|
1
|
+
{"version":3,"file":"ApplicationModel.js","names":["_ResourceModel","_interopRequireDefault","require","_LinkModel","_UserServicesModel","_exceptions","_constants","_Cache","ApplicationModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","Cache","setItem","primaryAuthenticationType","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","NotAllowedUriException","setChildModels","models","userServiceModel","_find","call","model","userServices","label","getContribution","authenticationTypes","DEFAULT_AUTHENTICATION_TYPE","_context","Function","bind","_sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","LinkModel","create","modelOptions","_userServices","UserServicesModel","isLoggedIn","userHref","userLink","userMustChangePassword","mustChangePassword","exports"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport { DEFAULT_AUTHENTICATION_TYPE } from \"../../constants\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n // store authentication type in session cache, to make it available when application is no longer available (when not permitted for example)\n Cache.setItem(\"primaryAuthenticationType\", this.primaryAuthenticationType);\n }\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ApplicationModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\",\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\",\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n const authenticationTypes = this.getContribution(\"security\", [\n DEFAULT_AUTHENTICATION_TYPE,\n ]);\n\n if (authenticationTypes) {\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) => {\n if (a.isPrimary === b.isPrimary) {\n return 0;\n }\n\n return a.isPrimary ? -1 : 1;\n },\n );\n }\n\n return [DEFAULT_AUTHENTICATION_TYPE];\n }\n\n /**\n * Returns the primary authentication type\n * @returns {AuthenticationType}\n */\n get primaryAuthenticationType(): AuthenticationType {\n return this.authenticationTypes[0];\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\n \"modelcatalog\",\n \"/modelcatalog\",\n \"Model catalog\",\n this.modelOptions,\n );\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices?.userLink) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get userMustChangePassword(): boolean {\n return this.userServices?.mustChangePassword ?? false;\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAN,sBAAA,CAAAC,OAAA;AAOA;AACA;AACA;AACe,MAAMM,gBAAgB,SAASC,sBAAa,CAAC;EAG1DC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;;IAExB;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IACAC,cAAK,CAACC,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAACC,yBAAyB,CAAC;EAC5E;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,aAAa;EACtB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,C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@ class ChoiceAttributeModel extends _AttributeModel.default {
|
|
|
108
108
|
*/
|
|
109
109
|
get lookupParameterType() {
|
|
110
110
|
const parameterType = this.getContribution("parameterType");
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return _constants.PARAMETER_TYPES.BODY;
|
|
114
|
-
default:
|
|
115
|
-
return _constants.PARAMETER_TYPES.QUERY;
|
|
111
|
+
if (parameterType === "bodyParameter") {
|
|
112
|
+
return _constants.PARAMETER_TYPES.BODY;
|
|
116
113
|
}
|
|
114
|
+
return _constants.PARAMETER_TYPES.QUERY;
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceAttributeModel.js","names":["_full","require","_objects","_AttributeModel","_interopRequireDefault","_ChoiceAttributeOptionCollection","_ChoiceAttributeOptionModel","_CompositeAttributeModel","_ContentConfigurationElements","_LayoutHints","_constants","ChoiceAttributeModel","AttributeModel","constructor","attribute","attributeContributions","modelOptions","_defineProperty2","default","_referenceDate","getData","Date","toISOString","split","_options","ChoiceAttributeOptionCollection","create","referenceDate","layouthint","has","SORT_OPTIONS","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_find","call","model","selfhref","equalsWithParameters","link","getLinkByKey","lookupParameterType","PARAMETER_TYPES","BODY","method","HTTP_METHODS","POST","parameterType","QUERY","lookupListLabel","lookupList","label","date","selected","_context","_map","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includes","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","addNotExistingOptions","removeNotExistingOptions","readonly","mergeOptions","isValid","update","value","updateLastModification","values","forEach","val","isChoiceAttributeOptionModel","equals","newVal","klona","add","toString","updateByAttribute","otherAttribute","CompositeAttributeModel","otherValue","getChildrenIds","console","error","addMissingError","receivedAttribute","isChangedSince","_errorCollection","addServerError","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","RENDER_SECTION_LABEL","ContentConfigurationElements","placeholder","id","message","properties","ANSWER_OPTION_KEY","_context8","optionKey","foundOption","getContentConfiguredLabel","readonlyWidth","ATTRIBUTE_WIDTH","MEDIUM","exports"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { klona } from \"klona/full\";\n\nimport { has } from \"../../utils/helpers/objects\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport CompositeAttributeModel from \"./CompositeAttributeModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n PARAMETER_TYPES,\n HTTP_METHODS,\n} from \"../../constants\";\n\nimport type {\n ModularUIModel,\n AttributeType,\n FormErrorAnchor,\n ModelOptions,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(\n attribute: Object,\n attributeContributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(attribute, attributeContributions, modelOptions);\n\n this._referenceDate = this.getData(\n \"referenceDate\",\n new Date().toISOString().split(\"T\")[0],\n );\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n { ...modelOptions, referenceDate: this.referenceDate },\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref),\n );\n }\n\n this.options.setChildModels(models, errors);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n const link = this.links.getLinkByKey(\"lookupOptions\");\n if (link && this.lookupParameterType === PARAMETER_TYPES.BODY) {\n link.method = HTTP_METHODS.POST;\n }\n return link;\n }\n\n /**\n * Indicate if the lookup must be done with POST or GET\n */\n get lookupParameterType(): $Values<typeof PARAMETER_TYPES> {\n const parameterType = this.getContribution(\"parameterType\");\n switch (parameterType) {\n case \"bodyParameter\":\n return PARAMETER_TYPES.BODY;\n default:\n return PARAMETER_TYPES.QUERY;\n }\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code,\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(\n oldAttribute: AttributeType,\n addNotExistingOptions: boolean = false,\n removeNotExistingOptions: boolean = false,\n ) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(\n oldAttribute.options,\n addNotExistingOptions ?? this.type === \"lookup\",\n removeNotExistingOptions,\n );\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values = [];\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else if (value != null) {\n values = [value];\n }\n values.forEach((val) => {\n if (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\n // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options\n if (!this.options.some((option) => option.equals(val))) {\n const newVal = klona(val);\n newVal.selected = false;\n this.options.add(newVal);\n }\n this.toggleOption(val.code);\n } else if (\n (typeof val === \"number\" ||\n typeof val === \"string\" ||\n typeof val === \"boolean\") &&\n this.options.some((option) => option.code.toString() === val.toString())\n ) {\n this.toggleOption(val.toString());\n }\n });\n\n return this;\n }\n\n /**\n */\n updateByAttribute(otherAttribute: AttributeType): void {\n this.reset();\n if (\n otherAttribute instanceof ChoiceAttributeModel ||\n otherAttribute instanceof CompositeAttributeModel\n ) {\n let otherValue;\n if (otherAttribute instanceof ChoiceAttributeModel) {\n otherValue = otherAttribute.options.selected;\n } else if (otherAttribute instanceof CompositeAttributeModel) {\n otherValue = otherAttribute.getChildrenIds();\n }\n if (otherValue !== null) {\n this.update(otherValue);\n }\n } else {\n console.error(\n `update of choice attribute with ${otherAttribute.type} not supported`,\n );\n }\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(receivedAttribute?: AttributeType): void {\n if (this.isChangedSince(0)) {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n // update choice options\n if (receivedAttribute instanceof ChoiceAttributeModel) {\n this.mergeAttribute(receivedAttribute, true, true);\n }\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n },\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey,\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration,\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,2BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,wBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,6BAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,YAAA,GAAAR,OAAA;AAIA,IAAAS,UAAA,GAAAT,OAAA;AAeA;AACA;AACA;AACe,MAAMU,oBAAoB,SAASC,uBAAc,CAAC;EAK/D;AACF;AACA;EACEC,WAAWA,CACTC,SAAiB,EACjBC,sBAA8B,EAC9BC,YAA2B,EAC3B;IAC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CAACjB,oBACP,CAAC;MACH;IACF;IAEA,IAAI,CAACH,gBAAgB,CAACC,cAAc,CAACY,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAE/H,UAAU,CAAC;EAC3E;;EAEA;AACF;EACE,IAAIqI,aAAaA,CAAA,EAAkC;IACjD,OAAOC,0BAAe,CAACC,MAAM;EAC/B;AACF;AAACC,OAAA,CAAAlJ,OAAA,GAAAP,oBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ChoiceAttributeModel.js","names":["_full","require","_objects","_AttributeModel","_interopRequireDefault","_ChoiceAttributeOptionCollection","_ChoiceAttributeOptionModel","_CompositeAttributeModel","_ContentConfigurationElements","_LayoutHints","_constants","ChoiceAttributeModel","AttributeModel","constructor","attribute","attributeContributions","modelOptions","_defineProperty2","default","_referenceDate","getData","Date","toISOString","split","_options","ChoiceAttributeOptionCollection","create","referenceDate","layouthint","has","SORT_OPTIONS","sortOptions","isApplicableModel","contributions","type","optionMode","getContribution","hasLookupLink","lookupLink","lookupListLink","optionType","isUser","getInitialChildModelLinks","links","hasContentConfiguration","hasContentFromData","conceptLink","push","options","setChildModels","models","errors","conceptLinkHref","href","concept","_find","call","model","selfhref","equalsWithParameters","link","getLinkByKey","lookupParameterType","PARAMETER_TYPES","BODY","method","HTTP_METHODS","POST","parameterType","QUERY","lookupListLabel","lookupList","label","date","selected","_context","_map","option","code","readonlyvalue","_context2","join","initvalue","Array","isArray","_initvalue","length","getValue","_context3","hasValue","getInputValue","toggleOption","_context4","_includes","disableOption","enableOption","isMultiple","deselectAll","select","inputvalue","deselect","addOption","_context5","opt","choicetype","_context6","hint","multiplechoice","isTree","some","reset","mergeAttribute","oldAttribute","addNotExistingOptions","removeNotExistingOptions","readonly","mergeOptions","isValid","update","value","updateLastModification","values","forEach","val","isChoiceAttributeOptionModel","equals","newVal","klona","add","toString","updateByAttribute","otherAttribute","CompositeAttributeModel","otherValue","getChildrenIds","console","error","addMissingError","receivedAttribute","isChangedSince","_errorCollection","addServerError","_hasContentConfiguration","contentConfiguration","_context7","content","optionElements","optionElementConfig","optionElement","contentElement","RENDER_SECTION_LABEL","ContentConfigurationElements","placeholder","id","message","properties","ANSWER_OPTION_KEY","_context8","optionKey","foundOption","getContentConfiguredLabel","readonlyWidth","ATTRIBUTE_WIDTH","MEDIUM","exports"],"sources":["../../../src/models/attributes/ChoiceAttributeModel.js"],"sourcesContent":["// @flow\nimport { klona } from \"klona/full\";\n\nimport { has } from \"../../utils/helpers/objects\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ChoiceAttributeOptionCollection from \"./ChoiceAttributeOptionCollection\";\nimport ChoiceAttributeOptionModel from \"./ChoiceAttributeOptionModel\";\nimport CompositeAttributeModel from \"./CompositeAttributeModel\";\nimport ContentConfigurationElements from \"../contentconfiguration/ContentConfigurationElements\";\n\nimport {\n RENDER_SECTION_LABEL,\n SORT_OPTIONS,\n} from \"../../constants/LayoutHints\";\nimport {\n ATTRIBUTE_WIDTH,\n PARAMETER_TYPES,\n HTTP_METHODS,\n} from \"../../constants\";\n\nimport type {\n ModularUIModel,\n AttributeType,\n FormErrorAnchor,\n ModelOptions,\n} from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for a choice attribute\n */\nexport default class ChoiceAttributeModel extends AttributeModel {\n _referenceDate: ISO_DATE;\n _options: ChoiceAttributeOptionCollection;\n _hasContentConfiguration: boolean;\n\n /**\n * Constructs a choice attribute\n */\n constructor(\n attribute: Object,\n attributeContributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(attribute, attributeContributions, modelOptions);\n\n this._referenceDate = this.getData(\n \"referenceDate\",\n new Date().toISOString().split(\"T\")[0],\n );\n this._options = ChoiceAttributeOptionCollection.create(\n attribute,\n attributeContributions,\n { ...modelOptions, referenceDate: this.referenceDate },\n );\n\n if (this.layouthint.has(SORT_OPTIONS)) {\n this._options.sortOptions = true;\n }\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return (\n contributions.type !== \"composite\" &&\n contributions.type !== \"boolean\" &&\n (contributions.type === \"choice\" ||\n contributions.type === \"array\" ||\n has(contributions, \"enumerated\") ||\n has(contributions, \"options\"))\n );\n }\n\n /**\n */\n get type(): string {\n const optionMode = this.getContribution(\"optionMode\", \"\");\n const hasLookupLink = this.lookupLink || this.lookupListLink;\n\n if (\n optionMode === \"lookup\" ||\n (optionMode === \"dynamicWithThreshold\" && hasLookupLink)\n ) {\n return \"lookup\";\n }\n\n return \"choice\";\n }\n\n /**\n */\n get optionType(): string {\n return this.contributions?.optionType ?? \"generic\";\n }\n\n /**\n */\n get isUser(): boolean {\n return this.optionType === \"user\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const links = [];\n\n if (this.hasContentConfiguration) {\n if (!this.hasContentFromData && this.conceptLink) {\n links.push(this.conceptLink);\n }\n\n links.push(...this.options.getInitialChildModelLinks());\n }\n\n return links;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n const conceptLinkHref = this.conceptLink?.href;\n if (conceptLinkHref) {\n this.concept = models.find(\n (model) =>\n model.type === \"ConceptDetail\" &&\n model.selfhref.equalsWithParameters(conceptLinkHref),\n );\n }\n\n this.options.setChildModels(models, errors);\n }\n\n /**\n * Retrieve lookup service link\n */\n get lookupLink(): LinkModel | null {\n const link = this.links.getLinkByKey(\"lookupOptions\");\n if (link && this.lookupParameterType === PARAMETER_TYPES.BODY) {\n link.method = HTTP_METHODS.POST;\n }\n return link;\n }\n\n /**\n * Indicate if the lookup must be done with POST or GET\n */\n get lookupParameterType(): $Values<typeof PARAMETER_TYPES> {\n const parameterType = this.getContribution(\"parameterType\");\n if (parameterType === \"bodyParameter\") {\n return PARAMETER_TYPES.BODY;\n }\n return PARAMETER_TYPES.QUERY;\n }\n\n /**\n * Retrieve lookup service as list link\n */\n get lookupListLink(): LinkModel | null {\n return this.links.getLinkByKey(\"lookupList\");\n }\n\n /**\n */\n get lookupListLabel(): string {\n return this.contributions.lookupList?.label ?? \"\";\n }\n\n /**\n * Retrieve reference date of attribute which can be used as entryDate for content\n */\n get referenceDate(): ISO_DATE {\n return this._referenceDate;\n }\n\n /**\n * Set reference date for concepts and content\n */\n set referenceDate(date: string) {\n this._referenceDate = date;\n\n this.options.referenceDate = date;\n }\n\n /**\n * Retrieve available choice options\n */\n get options(): ChoiceAttributeOptionCollection {\n return this._options;\n }\n\n /**\n * Getting all enabled options\n */\n get selected(): Array<string> {\n // $FlowFixMe[incompatible-call]\n return this.options.selected.map<string, ChoiceAttributeOptionModel>(\n (option: ChoiceAttributeOptionModel) => option.code,\n );\n }\n\n /**\n * Flatten options and filter out the options that are not selected\n */\n get readonlyvalue(): string {\n return this.options.selected.map((option) => option.label).join(\", \");\n }\n\n /**\n */\n get initvalue(): any {\n if (Array.isArray(this._initvalue) && this._initvalue.length === 0) {\n return null;\n }\n\n return this._initvalue;\n }\n\n /**\n * Retrieve list of selected options, joined with comma\n */\n getValue(): string | null {\n return this.options.selected.length > 0\n ? this.options.selected.map((option) => option.code).join(\",\")\n : null;\n }\n\n /**\n */\n hasValue(): boolean {\n return this.options.selected.length > 0;\n }\n\n /**\n * Get input value of attribute\n */\n getInputValue(): string {\n return this.selected.join(\",\");\n }\n\n /**\n * Setting an option selected or unselected based on the current state\n */\n toggleOption(code: string) {\n if (this.selected.includes(code)) {\n this.disableOption(code);\n } else {\n this.enableOption(code);\n }\n }\n\n /**\n * Enable a option\n */\n enableOption(code: string) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n this.options.select(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Disable a option\n */\n disableOption(code: string) {\n this.options.deselect(code);\n this.inputvalue = this.getInputValue();\n }\n\n /**\n * Add a new option to the collection of lookup options\n */\n addOption(option: Object) {\n if (!this.isMultiple) {\n this.options.deselectAll();\n }\n\n if (this.options.find((opt) => opt.code === option.code) === null) {\n this.options.addOption(option.code, option);\n }\n }\n\n /**\n * Getting the type of choice filter. For instance checkbox, radiobutton, combobox.\n */\n get choicetype():\n | \"checkbox\"\n | \"radiobutton\"\n | \"combobox\"\n | \"list\"\n | \"listview\"\n | \"table\"\n | \"longlist\"\n | \"toggle\" {\n return (\n [\n \"checkbox\",\n \"radiobutton\",\n \"combobox\",\n \"list\",\n \"listview\",\n \"table\",\n \"longlist\",\n \"toggle\",\n ].find((hint) => this.layouthint.has(hint)) || \"checkbox\"\n );\n }\n\n /**\n * Can multiple options be selected\n */\n get isMultiple(): boolean {\n return this.contributions.multiplechoice || this.choicetype === \"checkbox\";\n }\n\n /**\n * Check if options need to be rendered as tree\n */\n get isTree(): boolean {\n return (\n has(this.contributions, \"options\") &&\n this.contributions.options.some((option) => has(option, \"children\"))\n );\n }\n\n /**\n * Reset choice attribute to unselected list\n */\n reset() {\n this.options.deselectAll();\n }\n\n /**\n */\n mergeAttribute(\n oldAttribute: AttributeType,\n addNotExistingOptions: boolean = false,\n removeNotExistingOptions: boolean = false,\n ) {\n // when attribute is readonly, don't merge the options no modifications necessary\n if (!this.readonly && oldAttribute instanceof ChoiceAttributeModel) {\n this.concept = oldAttribute.concept;\n this.options.mergeOptions(\n oldAttribute.options,\n addNotExistingOptions ?? this.type === \"lookup\",\n removeNotExistingOptions,\n );\n this.options.deselectAll();\n\n if (oldAttribute.isValid && oldAttribute.inputvalue !== null) {\n this.update(oldAttribute.inputvalue);\n }\n }\n }\n\n /**\n * Update attribute by name and value\n */\n update(value: any): ChoiceAttributeModel {\n if (this.readonly) {\n return this;\n }\n\n this.updateLastModification();\n\n let values = [];\n\n if (Array.isArray(value)) {\n values = value;\n } else if (typeof value === \"string\" && this.isMultiple) {\n values = value.split(\",\");\n } else if (value != null) {\n values = [value];\n }\n values.forEach((val) => {\n if (typeof val === \"object\" && val.isChoiceAttributeOptionModel) {\n // option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options\n if (!this.options.some((option) => option.equals(val))) {\n const newVal = klona(val);\n newVal.selected = false;\n this.options.add(newVal);\n }\n this.toggleOption(val.code);\n } else if (\n (typeof val === \"number\" ||\n typeof val === \"string\" ||\n typeof val === \"boolean\") &&\n this.options.some((option) => option.code.toString() === val.toString())\n ) {\n this.toggleOption(val.toString());\n }\n });\n\n return this;\n }\n\n /**\n */\n updateByAttribute(otherAttribute: AttributeType): void {\n this.reset();\n if (\n otherAttribute instanceof ChoiceAttributeModel ||\n otherAttribute instanceof CompositeAttributeModel\n ) {\n let otherValue;\n if (otherAttribute instanceof ChoiceAttributeModel) {\n otherValue = otherAttribute.options.selected;\n } else if (otherAttribute instanceof CompositeAttributeModel) {\n otherValue = otherAttribute.getChildrenIds();\n }\n if (otherValue !== null) {\n this.update(otherValue);\n }\n } else {\n console.error(\n `update of choice attribute with ${otherAttribute.type} not supported`,\n );\n }\n }\n\n /**\n * Registers a missing error that was received from the server\n */\n addMissingError(receivedAttribute?: AttributeType): void {\n if (this.isChangedSince(0)) {\n this._errorCollection.addServerError(\"Constraint.Missing\");\n }\n // update choice options\n if (receivedAttribute instanceof ChoiceAttributeModel) {\n this.mergeAttribute(receivedAttribute, true, true);\n }\n }\n\n /**\n */\n set hasContentConfiguration(hasContentConfiguration: boolean) {\n this._hasContentConfiguration =\n this.contentConfiguration !== null || hasContentConfiguration;\n }\n\n /**\n */\n get hasContentConfiguration(): boolean {\n return this._hasContentConfiguration;\n }\n\n /**\n * Get content configuration configured on the attribute.\n * Only applicable for taxonomy element and knowledge codemaps,\n * content configuration for instrument questions is available on the form object\n */\n get contentConfiguration(): ContentConfigurationElements | null {\n if (\n !this.contributions.content ||\n !this.contributions.content.optionElements\n ) {\n return null;\n }\n\n // Add RENDER_SECTION_LABEL to all content configuration to make sure the label of a section is always rendered on taxonomy and knowlege codemaps\n const optionElementConfig = this.contributions.content.optionElements.map(\n (optionElement) => {\n if (\"contentElement\" in optionElement) {\n return {\n contentElement: {\n ...optionElement.contentElement,\n layouthint: [RENDER_SECTION_LABEL],\n },\n };\n }\n\n return optionElement;\n },\n );\n\n return new ContentConfigurationElements(optionElementConfig);\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Registers an error that was received from a server response\n */\n addServerError(error: FormErrorAnchor) {\n const { id, message, properties, layouthint } = error;\n\n const ANSWER_OPTION_KEY = \"answer-option-key\";\n\n if (properties && has(properties, ANSWER_OPTION_KEY)) {\n const optionKey = properties[ANSWER_OPTION_KEY];\n const foundOption = this.options.find(\n (option) => option.code === optionKey,\n );\n if (foundOption) {\n properties[ANSWER_OPTION_KEY] = foundOption.getContentConfiguredLabel(\n this.contentConfiguration,\n );\n }\n }\n\n this._errorCollection.addServerError(id, message, properties, layouthint);\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,2BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,wBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,6BAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,YAAA,GAAAR,OAAA;AAIA,IAAAS,UAAA,GAAAT,OAAA;AAeA;AACA;AACA;AACe,MAAMU,oBAAoB,SAASC,uBAAc,CAAC;EAK/D;AACF;AACA;EACEC,WAAWA,CACTC,SAAiB,EACjBC,sBAA8B,EAC9BC,YAA2B,EAC3B;IACA,KAAK,CAACF,SAAS,EAAEC,sBAAsB,EAAEC,YAAY,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC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AIqI,aAAaA,CAAA,EAAkC;IACjD,OAAOC,0BAAe,CAACC,MAAM;EAC/B;AACF;AAACC,OAAA,CAAAlJ,OAAA,GAAAP,oBAAA","ignoreList":[]}
|
|
@@ -356,7 +356,7 @@ class CompositeAttributeModel extends _AttributeModel.default {
|
|
|
356
356
|
equals(otherAttribute) {
|
|
357
357
|
return this.key === otherAttribute.key && this.parentKey === otherAttribute.parentKey || this.children.some(
|
|
358
358
|
//$FlowFixMe[method-unbinding]
|
|
359
|
-
child => child.equals
|
|
359
|
+
child => child.equals?.(otherAttribute));
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
/**
|