@beinformed/ui 1.65.28 → 1.66.0
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 +15 -0
- package/README.md +59 -18
- package/esm/hooks/useErrorHandler.js +26 -0
- package/esm/hooks/useErrorHandler.js.flow +31 -0
- package/esm/hooks/useErrorHandler.js.map +1 -0
- package/esm/hooks/useI18n.js +16 -2
- package/esm/hooks/useI18n.js.flow +21 -2
- package/esm/hooks/useI18n.js.map +1 -1
- package/esm/hooks/useModelSelectors.js +13 -2
- package/esm/hooks/useModelSelectors.js.flow +15 -1
- package/esm/hooks/useModelSelectors.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +1 -0
- package/esm/models/concepts/BusinessScenarioModel.js.flow +1 -0
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +47 -49
- package/esm/models/concepts/ConceptDetailModel.js.flow +37 -52
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +27 -7
- package/esm/redux/_i18n/types.js.flow +16 -0
- package/esm/redux/_i18n/types.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +8 -2
- package/esm/redux/_modularui/ModularUISelectors.js.flow +12 -7
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/types.js.flow +72 -0
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/_router/types.js.flow +51 -0
- package/esm/redux/_router/types.js.map +1 -1
- package/esm/redux/types.js.flow +276 -1
- package/esm/redux/types.js.map +1 -1
- package/lib/hooks/useErrorHandler.js +33 -0
- package/lib/hooks/useErrorHandler.js.map +1 -0
- package/lib/hooks/useI18n.js +16 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModelSelectors.js +14 -1
- package/lib/hooks/useModelSelectors.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +1 -0
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +47 -49
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/redux/_i18n/types.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +8 -2
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_router/types.js.map +1 -1
- package/lib/redux/types.js.map +1 -1
- package/package.json +6 -6
package/lib/hooks/useI18n.js
CHANGED
|
@@ -4,13 +4,15 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useTranslate = exports.useMessage = exports.useLocaleCodes = exports.useLocale = void 0;
|
|
7
|
+
exports.useUpdateLocale = exports.useTranslate = exports.useMessage = exports.useLocaleCodes = exports.useLocale = void 0;
|
|
8
8
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
9
9
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
10
|
+
var _react = require("react");
|
|
10
11
|
var _reactRedux = require("react-redux");
|
|
11
12
|
var _reselect = require("reselect");
|
|
12
13
|
var _memoize = _interopRequireDefault(require("lodash/memoize"));
|
|
13
14
|
var _i18n = require("../redux/selectors/i18n");
|
|
15
|
+
var _I18nActions = require("../redux/_i18n/I18nActions");
|
|
14
16
|
const getMessage = (0, _reselect.createSelector)([_i18n.getLocales, _i18n.getLocale], (locales, localeCode) => (0, _memoize.default)((id, defaultMessage, placeholders) => locales.getLocale(localeCode).getMessage(id, defaultMessage, placeholders), (...args) => (0, _stringify.default)(args)));
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -33,5 +35,18 @@ const getLocaleCodes = (0, _reselect.createSelector)(state => state.i18n.locales
|
|
|
33
35
|
* Retrieve all available locale codes
|
|
34
36
|
*/
|
|
35
37
|
const useLocaleCodes = () => (0, _reactRedux.useSelector)(getLocaleCodes);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A hook that returns a memoized function to update the application locale.
|
|
41
|
+
*
|
|
42
|
+
* @returns {(locale: string) => void} A memoized function to update the locale.
|
|
43
|
+
*/
|
|
36
44
|
exports.useLocaleCodes = useLocaleCodes;
|
|
45
|
+
const useUpdateLocale = () => {
|
|
46
|
+
const dispatch = (0, _reactRedux.useDispatch)();
|
|
47
|
+
return (0, _react.useCallback)(locale => {
|
|
48
|
+
dispatch((0, _I18nActions.updateLocale)(locale));
|
|
49
|
+
}, [dispatch]);
|
|
50
|
+
};
|
|
51
|
+
exports.useUpdateLocale = useUpdateLocale;
|
|
37
52
|
//# sourceMappingURL=useI18n.js.map
|
package/lib/hooks/useI18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.js","names":["
|
|
1
|
+
{"version":3,"file":"useI18n.js","names":["_react","require","_reactRedux","_reselect","_memoize","_interopRequireDefault","_i18n","_I18nActions","getMessage","createSelector","getLocales","getLocale","locales","localeCode","memoize","id","defaultMessage","placeholders","args","_stringify","default","useMessage","useSelector","exports","useTranslate","useLocale","getLocaleCodes","state","i18n","_map","call","locale","code","useLocaleCodes","useUpdateLocale","dispatch","useDispatch","useCallback","updateLocale"],"sources":["../../src/hooks/useI18n.js"],"sourcesContent":["// @flow\nimport { useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { createSelector } from \"reselect\";\n\nimport memoize from \"lodash/memoize\";\n\nimport { getLocales, getLocale } from \"../redux/selectors/i18n\";\nimport { updateLocale } from \"../redux/_i18n/I18nActions\";\n\nconst getMessage = createSelector(\n [getLocales, getLocale],\n (locales, localeCode) =>\n memoize(\n (id: string, defaultMessage?: string, placeholders?: Object) =>\n locales\n .getLocale(localeCode)\n .getMessage(id, defaultMessage, placeholders),\n (...args) => JSON.stringify(args),\n ),\n);\n\n/**\n */\nconst useMessage = (\n id: string,\n defaultMessage?: string,\n placeholders?: Object | null,\n): any => useSelector(getMessage)(id, defaultMessage, placeholders);\n\n/**\n */\nconst useTranslate = (): ((...any) => any) => useSelector(getMessage);\n\n/**\n */\nconst useLocale = (): string => useSelector(getLocale);\n\nconst getLocaleCodes = createSelector(\n (state) => state.i18n.locales,\n (locales) => locales.map((locale) => locale.code),\n);\n\n/**\n * Retrieve all available locale codes\n */\nconst useLocaleCodes = (): Array<string> => useSelector(getLocaleCodes);\n\n/**\n * A hook that returns a memoized function to update the application locale.\n *\n * @returns {(locale: string) => void} A memoized function to update the locale.\n */\nconst useUpdateLocale = (): ((locale: string) => void) => {\n const dispatch = useDispatch();\n\n return useCallback(\n (locale: string) => {\n dispatch(updateLocale(locale));\n },\n [dispatch],\n );\n};\n\nexport { useTranslate, useMessage, useLocale, useLocaleCodes, useUpdateLocale };\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAEA,MAAMO,UAAU,GAAG,IAAAC,wBAAc,EAC/B,CAACC,gBAAU,EAAEC,eAAS,CAAC,EACvB,CAACC,OAAO,EAAEC,UAAU,KAClB,IAAAC,gBAAO,EACL,CAACC,EAAU,EAAEC,cAAuB,EAAEC,YAAqB,KACzDL,OAAO,CACJD,SAAS,CAACE,UAAU,CAAC,CACrBL,UAAU,CAACO,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC,EACjD,CAAC,GAAGC,IAAI,KAAK,IAAAC,UAAA,CAAAC,OAAA,EAAeF,IAAI,CAClC,CACJ,CAAC;;AAED;AACA;AACA,MAAMG,UAAU,GAAGA,CACjBN,EAAU,EACVC,cAAuB,EACvBC,YAA4B,KACpB,IAAAK,uBAAW,EAACd,UAAU,CAAC,CAACO,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC;;AAEnE;AACA;AADAM,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAEA,MAAMG,YAAY,GAAGA,CAAA,KAAyB,IAAAF,uBAAW,EAACd,UAAU,CAAC;;AAErE;AACA;AADAe,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAEA,MAAMC,SAAS,GAAGA,CAAA,KAAc,IAAAH,uBAAW,EAACX,eAAS,CAAC;AAACY,OAAA,CAAAE,SAAA,GAAAA,SAAA;AAEvD,MAAMC,cAAc,GAAG,IAAAjB,wBAAc,EAClCkB,KAAK,IAAKA,KAAK,CAACC,IAAI,CAAChB,OAAO,EAC5BA,OAAO,IAAK,IAAAiB,IAAA,CAAAT,OAAA,EAAAR,OAAO,EAAAkB,IAAA,CAAPlB,OAAO,EAAMmB,MAAM,IAAKA,MAAM,CAACC,IAAI,CAClD,CAAC;;AAED;AACA;AACA;AACA,MAAMC,cAAc,GAAGA,CAAA,KAAqB,IAAAX,uBAAW,EAACI,cAAc,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AAJAH,OAAA,CAAAU,cAAA,GAAAA,cAAA;AAKA,MAAMC,eAAe,GAAGA,CAAA,KAAkC;EACxD,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAE9B,OAAO,IAAAC,kBAAW,EACfN,MAAc,IAAK;IAClBI,QAAQ,CAAC,IAAAG,yBAAY,EAACP,MAAM,CAAC,CAAC;EAChC,CAAC,EACD,CAACI,QAAQ,CACX,CAAC;AACH,CAAC;AAACZ,OAAA,CAAAW,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -4,10 +4,11 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useModelByHref = exports.useKeyByHref = exports.useFirstModelByInstance = exports.useAllModelsByInstance = exports.useAllKeysByHref = exports.useAllFinishedModels = exports.useActiveModels = exports.useActiveModelByInstance = void 0;
|
|
7
|
+
exports.useModelByHref = exports.useKeyByHref = exports.useFirstModelByInstance = exports.useCurrentApplication = exports.useAllModelsByInstance = exports.useAllKeysByHref = exports.useAllFinishedModels = exports.useActiveModels = exports.useActiveModelByInstance = void 0;
|
|
8
8
|
var _reactRedux = require("react-redux");
|
|
9
9
|
var _ModularUISelectors = require("../redux/_modularui/ModularUISelectors");
|
|
10
10
|
var _Href = _interopRequireDefault(require("../models/href/Href"));
|
|
11
|
+
var _ApplicationModel = _interopRequireDefault(require("../models/application/ApplicationModel"));
|
|
11
12
|
/**
|
|
12
13
|
* Returns all models in the store that are instances of the provided class
|
|
13
14
|
* and match the current application locale.
|
|
@@ -83,5 +84,17 @@ exports.useActiveModels = useActiveModels;
|
|
|
83
84
|
const useAllFinishedModels = () => {
|
|
84
85
|
return (0, _reactRedux.useSelector)(_ModularUISelectors.getAllFinishedModels);
|
|
85
86
|
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns the current active application, without retrying to request it.
|
|
90
|
+
*/
|
|
86
91
|
exports.useAllFinishedModels = useAllFinishedModels;
|
|
92
|
+
const useCurrentApplication = () => {
|
|
93
|
+
const application = (0, _reactRedux.useSelector)(_ModularUISelectors.getApplication);
|
|
94
|
+
if (application instanceof _ApplicationModel.default) {
|
|
95
|
+
return application;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
};
|
|
99
|
+
exports.useCurrentApplication = useCurrentApplication;
|
|
87
100
|
//# sourceMappingURL=useModelSelectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelSelectors.js","names":["_reactRedux","require","_ModularUISelectors","_Href","_interopRequireDefault","useAllModelsByInstance","instance","useSelector","state","getAllModelsByInstance","exports","useFirstModelByInstance","getFirstModelByInstance","useActiveModelByInstance","getActiveModelByInstance","useModelByHref","href","modelByHref","useKeyByHref","keyByHref","useAllKeysByHref","allKeysByHref","useActiveModels","getActiveModels","useAllFinishedModels","getAllFinishedModels"],"sources":["../../src/hooks/useModelSelectors.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\n\nimport {\n getAllModelsByInstance,\n getFirstModelByInstance,\n getActiveModelByInstance,\n modelByHref,\n keyByHref,\n allKeysByHref,\n getActiveModels,\n getAllFinishedModels,\n} from \"../redux/_modularui/ModularUISelectors\";\nimport
|
|
1
|
+
{"version":3,"file":"useModelSelectors.js","names":["_reactRedux","require","_ModularUISelectors","_Href","_interopRequireDefault","_ApplicationModel","useAllModelsByInstance","instance","useSelector","state","getAllModelsByInstance","exports","useFirstModelByInstance","getFirstModelByInstance","useActiveModelByInstance","getActiveModelByInstance","useModelByHref","href","modelByHref","useKeyByHref","keyByHref","useAllKeysByHref","allKeysByHref","useActiveModels","getActiveModels","useAllFinishedModels","getAllFinishedModels","useCurrentApplication","application","getApplication","ApplicationModel"],"sources":["../../src/hooks/useModelSelectors.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\n\nimport {\n getAllModelsByInstance,\n getFirstModelByInstance,\n getActiveModelByInstance,\n modelByHref,\n keyByHref,\n allKeysByHref,\n getActiveModels,\n getAllFinishedModels,\n getApplication,\n} from \"../redux/_modularui/ModularUISelectors\";\nimport Href from \"../models/href/Href\";\nimport ApplicationModel from \"../models/application/ApplicationModel\";\n\nimport type { ModularUIModel } from \"../models/types\";\nimport type { ReduxState } from \"../redux/types\";\n\n/**\n * Returns all models in the store that are instances of the provided class\n * and match the current application locale.\n */\nexport const useAllModelsByInstance = <T>(\n instance: Class<T>,\n): Array<ModularUIModel> => {\n return useSelector((state: ReduxState) =>\n getAllModelsByInstance(state, instance),\n );\n};\n\n/**\n * Returns the first model found in the store that is an instance of the\n * provided class and matches the current locale.\n */\nexport const useFirstModelByInstance = <T>(instance: Class<T>): T | null => {\n return useSelector((state: ReduxState) =>\n getFirstModelByInstance(state, instance),\n );\n};\n\n/**\n * Returns the model instance that is currently \"active\" based on the URL path.\n * It checks if the current router location starts with the model's selfhref path.\n */\nexport const useActiveModelByInstance = <T>(instance: Class<T>): T | null => {\n return useSelector((state: ReduxState) =>\n getActiveModelByInstance(state, instance),\n );\n};\n\n/**\n * Retrieves a specific model from the store based on its unique Href.\n * @param {Href | string} href - The Href object or string path of the model.\n * @returns {ModularUIModel | null} The model matching the href or null.\n */\nexport const useModelByHref = (href: Href | string): null | ModularUIModel => {\n return useSelector((state: ReduxState) => modelByHref(state, href));\n};\n\n/**\n * Returns the unique store key (identifier) for a model associated with a specific Href.\n * @param {Href | string} href - The Href object or string path.\n * @returns {string | null | void} The internal key of the model.\n */\nexport const useKeyByHref = (href: Href | string): ?string => {\n return useSelector((state: ReduxState) => keyByHref(state, href));\n};\n\n/**\n * Returns all internal keys found in the store for a specific Href.\n * Useful if multiple versions/entries exist for the same path.\n * @param {Href | string} href - The Href object or string path.\n * @returns {Array<string>} An array of keys.\n */\nexport const useAllKeysByHref = (href: Href | string): Array<string> => {\n return useSelector((state: ReduxState) => allKeysByHref(state, href));\n};\n\n/**\n * Returns a list of simplified model info (key, href, label, type) for all\n * models currently active in the navigation context (breadcrumbs).\n * @returns {Array<{key: string, href: Href, label: string, type: string}>}\n */\nexport const useActiveModels = (): Array<{\n key: string,\n href: Href,\n label: string,\n type: string,\n}> => {\n return useSelector(getActiveModels);\n};\n\n/**\n * Returns all models in the store that have a status of MODULARUI_STATUS.FINISHED.\n * @returns {Array<ModularUIModel>} An array of fully loaded models.\n */\nexport const useAllFinishedModels = (): Array<ModularUIModel> => {\n return useSelector(getAllFinishedModels);\n};\n\n/**\n * Returns the current active application, without retrying to request it.\n */\nexport const useCurrentApplication = (): ApplicationModel | null => {\n const application = useSelector(getApplication);\n if (application instanceof ApplicationModel) {\n return application;\n }\n return null;\n};\n"],"mappings":";;;;;;;AACA,IAA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AN,OAAA,CAAAQ,YAAA,GAAAA,YAAA;AAMO,MAAME,gBAAgB,GAAIJ,IAAmB,IAAoB;EACtE,OAAO,IAAAT,uBAAW,EAAEC,KAAiB,IAAK,IAAAa,iCAAa,EAACb,KAAK,EAAEQ,IAAI,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJAN,OAAA,CAAAU,gBAAA,GAAAA,gBAAA;AAKO,MAAME,eAAe,GAAGA,CAAA,KAKzB;EACJ,OAAO,IAAAf,uBAAW,EAACgB,mCAAe,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AACA;AAHAb,OAAA,CAAAY,eAAA,GAAAA,eAAA;AAIO,MAAME,oBAAoB,GAAGA,CAAA,KAA6B;EAC/D,OAAO,IAAAjB,uBAAW,EAACkB,wCAAoB,CAAC;AAC1C,CAAC;;AAED;AACA;AACA;AAFAf,OAAA,CAAAc,oBAAA,GAAAA,oBAAA;AAGO,MAAME,qBAAqB,GAAGA,CAAA,KAA+B;EAClE,MAAMC,WAAW,GAAG,IAAApB,uBAAW,EAACqB,kCAAc,CAAC;EAC/C,IAAID,WAAW,YAAYE,yBAAgB,EAAE;IAC3C,OAAOF,WAAW;EACpB;EACA,OAAO,IAAI;AACb,CAAC;AAACjB,OAAA,CAAAgB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ var _ConceptDetailModel = _interopRequireDefault(require("./ConceptDetailModel")
|
|
|
14
14
|
var _ConceptTypeDetailModel = _interopRequireDefault(require("./ConceptTypeDetailModel"));
|
|
15
15
|
var _Settings = require("../../constants/Settings");
|
|
16
16
|
/**
|
|
17
|
+
* @deprecated use the ConceptDetailModel with concept type BusinessScenarios#BusinessScenario
|
|
17
18
|
*/
|
|
18
19
|
class BusinessScenarioModel extends _ConceptDetailModel.default {
|
|
19
20
|
constructor(...args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusinessScenarioModel.js","names":["_ConceptDetailModel","_interopRequireDefault","require","_ConceptTypeDetailModel","_Settings","BusinessScenarioModel","ConceptDetailModel","constructor","args","_defineProperty2","default","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingNames","Array","isArray","TypeError","pathToKmt","conceptTypeSettings","STEP","getSetting","PERSONA","SYSTEM","SCENARIO","decodedConceptTypeHref","decodeURIComponent","some","settingName","conceptTypeSetting","_endsWith","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_map","_filter","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","errors","conceptTypeModel","_find","model","ConceptTypeDetailModel","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","relationsToActor","newRelationToActor","actor","key","_default","exports"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n [\"SCENARIO\"],\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingNames: Array<\"STEP\" | \"PERSONA\" | \"SCENARIO\" | \"SYSTEM\">,\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n // Check if settingNames is an array\n if (!Array.isArray(settingNames)) {\n throw new TypeError(\"settingNames must be an array\");\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SYSTEM: getSetting(\"BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE\", [\n `${pathToKmt}/System`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);\n\n return settingNames.some(\n (settingName) =>\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n decodedConceptTypeHref.endsWith(conceptTypeSetting),\n ),\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const childModelLinks = super.getInitialChildModelLinks();\n\n const scenarioStepLinks = this.relationsCollection.all\n .filter(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n [\"STEP\"],\n ),\n )\n .map((relation) => relation.concept.asLinkModel());\n\n if (scenarioStepLinks.length > 0) {\n childModelLinks.push(...scenarioStepLinks);\n }\n\n return childModelLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n\n const scenarioSteps = [];\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n\n if (\n model instanceof ConceptDetailModel &&\n BusinessScenarioModel.isOfConceptType(\n model.conceptType?.selfhref.path,\n [\"STEP\"],\n )\n ) {\n scenarioSteps.push(model);\n }\n }\n\n this.scenarioSteps = scenarioSteps;\n }\n\n /**\n */\n set scenarioSteps(models: Array<ConceptDetailModel>) {\n this._scenarioSteps = models;\n }\n\n /**\n */\n get scenarioSteps(): Array<ConceptDetailModel> {\n return this._scenarioSteps;\n }\n\n /**\n */\n get actors(): Array<ConceptLinkModel> {\n const actors = [];\n\n this.scenarioSteps.forEach((scenarioStep) => {\n const relationsToActor = scenarioStep.relationsCollection.find(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n [\"PERSONA\", \"SYSTEM\"],\n ),\n );\n\n const newRelationToActor =\n relationsToActor &&\n !actors.some((actor) => actor.key === relationsToActor.concept.key);\n\n if (relationsToActor && newRelationToActor) {\n actors.push(relationsToActor.concept);\n }\n });\n\n return actors;\n }\n}\n\nexport default BusinessScenarioModel;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAQA;AACA;AACA,MAAMG,qBAAqB,SAASC,2BAAkB,CAAC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA;EAAA;EAGrD;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OAAOT,qBAAqB,CAACU,eAAe,CAC1CD,IAAI,EAAEA,IAAI,EAAEE,MAAM,EAAEC,WAAW,EAAEC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ACAY,aAAa,CAACT,IAAI,CAACM,KAAK,CAAC;MAC3B;IACF;IAEA,IAAI,CAACG,aAAa,GAAGA,aAAa;EACpC;;EAEA;AACF;EACE,IAAIA,aAAaA,CAACP,MAAiC,EAAE;IACnD,IAAI,CAACU,cAAc,GAAGV,MAAM;EAC9B;;EAEA;AACF;EACE,IAAIO,aAAaA,CAAA,EAA8B;IAC7C,OAAO,IAAI,CAACG,cAAc;EAC5B;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAA4B;IACpC,MAAMA,MAAM,GAAG,EAAE;IAEjB,IAAI,CAACJ,aAAa,CAACK,OAAO,CAAEC,YAAY,IAAK;MAAA,IAAAC,SAAA;MAC3C,MAAMC,gBAAgB,GAAG,IAAAZ,KAAA,CAAAjD,OAAA,EAAA4D,SAAA,GAAAD,YAAY,CAACxB,mBAAmB,EAAAR,IAAA,CAAAiC,SAAA,EACtDvB,QAAQ,IACPA,QAAQ,CAACC,SAAS,KAAK,UAAU,IACjC3C,qBAAqB,CAACU,eAAe,CACnCgC,QAAQ,CAACE,OAAO,CAACC,eAAe,EAAEC,IAAI,EACtC,CAAC,SAAS,EAAE,QAAQ,CACtB,CACJ,CAAC;MAED,MAAMqB,kBAAkB,GACtBD,gBAAgB,IAChB,CAACJ,MAAM,CAAClC,IAAI,CAAEwC,KAAK,IAAKA,KAAK,CAACC,GAAG,KAAKH,gBAAgB,CAACtB,OAAO,CAACyB,GAAG,CAAC;MAErE,IAAIH,gBAAgB,IAAIC,kBAAkB,EAAE;QAC1CL,MAAM,CAACb,IAAI,CAACiB,gBAAgB,CAACtB,OAAO,CAAC;MACvC;IACF,CAAC,CAAC;IAEF,OAAOkB,MAAM;EACf;AACF;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAlE,OAAA,GAEcL,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BusinessScenarioModel.js","names":["_ConceptDetailModel","_interopRequireDefault","require","_ConceptTypeDetailModel","_Settings","BusinessScenarioModel","ConceptDetailModel","constructor","args","_defineProperty2","default","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingNames","Array","isArray","TypeError","pathToKmt","conceptTypeSettings","STEP","getSetting","PERSONA","SYSTEM","SCENARIO","decodedConceptTypeHref","decodeURIComponent","some","settingName","conceptTypeSetting","_endsWith","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_map","_filter","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","errors","conceptTypeModel","_find","model","ConceptTypeDetailModel","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","relationsToActor","newRelationToActor","actor","key","_default","exports"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * @deprecated use the ConceptDetailModel with concept type BusinessScenarios#BusinessScenario\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n [\"SCENARIO\"],\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingNames: Array<\"STEP\" | \"PERSONA\" | \"SCENARIO\" | \"SYSTEM\">,\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n // Check if settingNames is an array\n if (!Array.isArray(settingNames)) {\n throw new TypeError(\"settingNames must be an array\");\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SYSTEM: getSetting(\"BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE\", [\n `${pathToKmt}/System`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);\n\n return settingNames.some(\n (settingName) =>\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n decodedConceptTypeHref.endsWith(conceptTypeSetting),\n ),\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const childModelLinks = super.getInitialChildModelLinks();\n\n const scenarioStepLinks = this.relationsCollection.all\n .filter(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n [\"STEP\"],\n ),\n )\n .map((relation) => relation.concept.asLinkModel());\n\n if (scenarioStepLinks.length > 0) {\n childModelLinks.push(...scenarioStepLinks);\n }\n\n return childModelLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n\n const scenarioSteps = [];\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n\n if (\n model instanceof ConceptDetailModel &&\n BusinessScenarioModel.isOfConceptType(\n model.conceptType?.selfhref.path,\n [\"STEP\"],\n )\n ) {\n scenarioSteps.push(model);\n }\n }\n\n this.scenarioSteps = scenarioSteps;\n }\n\n /**\n */\n set scenarioSteps(models: Array<ConceptDetailModel>) {\n this._scenarioSteps = models;\n }\n\n /**\n */\n get scenarioSteps(): Array<ConceptDetailModel> {\n return this._scenarioSteps;\n }\n\n /**\n */\n get actors(): Array<ConceptLinkModel> {\n const actors = [];\n\n this.scenarioSteps.forEach((scenarioStep) => {\n const relationsToActor = scenarioStep.relationsCollection.find(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n [\"PERSONA\", \"SYSTEM\"],\n ),\n );\n\n const newRelationToActor =\n relationsToActor &&\n !actors.some((actor) => actor.key === relationsToActor.concept.key);\n\n if (relationsToActor && newRelationToActor) {\n actors.push(relationsToActor.concept);\n }\n });\n\n return actors;\n }\n}\n\nexport default BusinessScenarioModel;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAQA;AACA;AACA;AACA,MAAMG,qBAAqB,SAASC,2BAAkB,CAAC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA;EAAA;EAGrD;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OAAOT,qBAAqB,CAACU,eAAe,CAC1CD,IAAI,EAAEA,IAAI,EAAEE,MAAM,EAAEC,WAAW,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
8
|
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
9
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
10
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
11
9
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
10
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
11
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
12
12
|
var _endsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/ends-with"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
14
|
var _ResourceModel = _interopRequireDefault(require("../base/ResourceModel"));
|
|
@@ -148,80 +148,78 @@ class ConceptDetailModel extends _ResourceModel.default {
|
|
|
148
148
|
return this.data.formula;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
154
|
+
getElements(propName, typePropName) {
|
|
155
|
+
// $FlowIssue
|
|
156
|
+
const elementTypes = this.conceptType?.[typePropName] ?? [];
|
|
157
|
+
const allElements = this.data[propName] ?? [];
|
|
158
|
+
const elements = [];
|
|
159
|
+
const usedElementTypes = [];
|
|
160
|
+
for (const element of allElements) {
|
|
161
|
+
const elementType = (0, _find.default)(elementTypes).call(elementTypes, elType => elType._id === element.type);
|
|
162
|
+
if (elementType) {
|
|
163
|
+
elements.push({
|
|
164
|
+
...elementType,
|
|
165
|
+
...element
|
|
166
|
+
});
|
|
167
|
+
usedElementTypes.push(elementType._id);
|
|
168
|
+
} else {
|
|
169
|
+
elements.push(element);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
for (const elementType of elementTypes) {
|
|
173
|
+
if (!(0, _includes.default)(usedElementTypes).call(usedElementTypes, elementType._id)) {
|
|
174
|
+
elements.push(elementType);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return elements;
|
|
178
|
+
}
|
|
179
|
+
|
|
151
180
|
/**
|
|
152
181
|
* Get additional labels of concept
|
|
153
182
|
*/
|
|
154
183
|
get labels() {
|
|
155
|
-
|
|
156
|
-
return this.conceptType?.labelTypes ? (0, _map.default)(_context = this.conceptType.labelTypes).call(_context, labelType => {
|
|
157
|
-
var _context2;
|
|
158
|
-
const setting = this.data.labels ? (0, _find.default)(_context2 = this.data.labels).call(_context2, label => label.type === labelType._id) : {};
|
|
159
|
-
return {
|
|
160
|
-
...labelType,
|
|
161
|
-
...setting
|
|
162
|
-
};
|
|
163
|
-
}) : [];
|
|
184
|
+
return this.getElements("labels", "labelTypes");
|
|
164
185
|
}
|
|
165
186
|
|
|
166
187
|
/**
|
|
167
188
|
* Get label elements by id
|
|
168
189
|
*/
|
|
169
190
|
getLabelElementByIds(ids) {
|
|
170
|
-
var
|
|
171
|
-
return (0, _filter.default)(
|
|
191
|
+
var _context;
|
|
192
|
+
return (0, _filter.default)(_context = this.labels).call(_context, label => (0, _includes.default)(ids).call(ids, label._id));
|
|
172
193
|
}
|
|
173
194
|
|
|
174
195
|
/**
|
|
175
196
|
* Get concept properties
|
|
176
197
|
*/
|
|
177
198
|
get conceptProperties() {
|
|
178
|
-
|
|
179
|
-
return this.conceptType?.propertyTypes ? (0, _map.default)(_context4 = this.conceptType.propertyTypes).call(_context4, propertyType => {
|
|
180
|
-
var _context5;
|
|
181
|
-
const setting = this.data.properties ? (0, _find.default)(_context5 = this.data.properties).call(_context5, property => property.type === propertyType._id) : {};
|
|
182
|
-
return {
|
|
183
|
-
...propertyType,
|
|
184
|
-
...setting
|
|
185
|
-
};
|
|
186
|
-
}) : [];
|
|
199
|
+
return this.getElements("properties", "propertyTypes");
|
|
187
200
|
}
|
|
188
201
|
|
|
189
202
|
/**
|
|
190
203
|
* Get concept properties by id
|
|
191
204
|
*/
|
|
192
205
|
getConceptPropertiesByIds(ids) {
|
|
193
|
-
var
|
|
194
|
-
return (0, _filter.default)(
|
|
206
|
+
var _context2;
|
|
207
|
+
return (0, _filter.default)(_context2 = this.conceptProperties).call(_context2, property => (0, _includes.default)(ids).call(ids, property._id));
|
|
195
208
|
}
|
|
196
209
|
|
|
197
210
|
/**
|
|
198
211
|
* Get Text fragments
|
|
199
212
|
*/
|
|
200
213
|
get textfragments() {
|
|
201
|
-
|
|
202
|
-
const textFragments = this.data.textFragments ? (0, _map.default)(_context7 = this.data.textFragments).call(_context7, textFragment => {
|
|
203
|
-
var _context8, _context9;
|
|
204
|
-
const textFragmentConfig = ((_context8 = this.conceptType) == null ? void 0 : Function.call.bind((0, _find.default)(_context9 = _context8.textFragmentTypes), _context9))?.(textFragmentType => textFragment.type === textFragmentType._id);
|
|
205
|
-
return {
|
|
206
|
-
...textFragmentConfig,
|
|
207
|
-
...textFragment
|
|
208
|
-
};
|
|
209
|
-
}) : [];
|
|
210
|
-
const notConfiguredTextFragments = this.conceptType?.textFragmentTypes ? (0, _filter.default)(_context0 = this.conceptType.textFragmentTypes).call(_context0, textFragmentType => {
|
|
211
|
-
if (!this.data.textFragments) {
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
return !this.data.textFragments.some(textfragment => textfragment.type === textFragmentType._id);
|
|
215
|
-
}) : [];
|
|
216
|
-
return [...textFragments, ...notConfiguredTextFragments];
|
|
214
|
+
return this.getElements("textFragments", "textFragmentTypes");
|
|
217
215
|
}
|
|
218
216
|
|
|
219
217
|
/**
|
|
220
218
|
* Get text fragments by id
|
|
221
219
|
*/
|
|
222
220
|
getTextFragmentByKeys(keys) {
|
|
223
|
-
var
|
|
224
|
-
return (0, _filter.default)(
|
|
221
|
+
var _context3;
|
|
222
|
+
return (0, _filter.default)(_context3 = this.textfragments).call(_context3, textfragment => (0, _includes.default)(keys).call(keys, textfragment.type));
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
/**
|
|
@@ -247,21 +245,21 @@ class ConceptDetailModel extends _ResourceModel.default {
|
|
|
247
245
|
getSourceReferencesForCurrentLanguage(availableLocales) {
|
|
248
246
|
const LANGUAGE_POSTFIX_LENGTH = 3;
|
|
249
247
|
if (this.data.sourceReferences) {
|
|
250
|
-
var
|
|
251
|
-
const availableLanguagesInSourceReferences = (0, _map.default)(
|
|
248
|
+
var _context4, _context7;
|
|
249
|
+
const availableLanguagesInSourceReferences = (0, _map.default)(_context4 = this.data.sourceReferences).call(_context4, sourceReference => sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH));
|
|
252
250
|
const currentLanguagePostfix = `_${this.locale}`;
|
|
253
251
|
if ((0, _includes.default)(availableLanguagesInSourceReferences).call(availableLanguagesInSourceReferences, currentLanguagePostfix)) {
|
|
254
|
-
var
|
|
252
|
+
var _context5;
|
|
255
253
|
// return all sourceReferences that end with language that is selected
|
|
256
|
-
return (0, _filter.default)(
|
|
257
|
-
var
|
|
258
|
-
return (0, _endsWith.default)(
|
|
254
|
+
return (0, _filter.default)(_context5 = this.data.sourceReferences).call(_context5, sourceReference => {
|
|
255
|
+
var _context6;
|
|
256
|
+
return (0, _endsWith.default)(_context6 = sourceReference.type).call(_context6, currentLanguagePostfix);
|
|
259
257
|
});
|
|
260
258
|
}
|
|
261
259
|
const availableLanguages = (0, _map.default)(availableLocales).call(availableLocales, locale => `_${locale.split("-")[0]}`);
|
|
262
260
|
|
|
263
261
|
// return all sourceReferences that do not end with language postfix
|
|
264
|
-
return (0, _filter.default)(
|
|
262
|
+
return (0, _filter.default)(_context7 = this.data.sourceReferences).call(_context7, sourceReference => !(0, _includes.default)(availableLanguages).call(availableLanguages, sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH)));
|
|
265
263
|
}
|
|
266
264
|
return [];
|
|
267
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptDetailModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ConceptRelationCollection","_SourceReferenceCollection","_ConceptTypeDetailModel","_Constants","ConceptDetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_relations","ConceptRelationCollection","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_find","call","model","ConceptTypeDetailModel","conceptType","key","getData","selfhref","href","selflink","setParameter","TIMEVERSION_FILTER_NAME","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_map","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filter","_includes","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context0","textFragments","textFragment","_context8","_context9","textFragmentConfig","Function","bind","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context1","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","SourceReferenceCollection","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context10","_context13","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context11","_context12","_endsWith","availableLanguages","split","value","isOfConceptType","conceptTypeId","exports"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType?.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType?.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig = this.conceptType?.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments = this.conceptType?.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAcA;AACA;AACA;AACe,MAAMK,kBAAkB,SAASC,sBAAa,CAAC;EAK5D;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIC,kCAAyB,CAC7C,IAAI,CAACC,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,eAAe;EACxB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,oBAAoB;EAC7B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACN,IA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AO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIrF,SAASA,CAAA,EAAkB;IAC7B,OAAO,IAAAkD,OAAA,CAAAvD,OAAA,MAAI,CAACG,IAAI,IAAU+B,kCAAuB,CAAC,EAAEuE,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAChF,WAAW,EAAE+E,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF;AAACC,OAAA,CAAA5G,OAAA,GAAAL,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ConceptDetailModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ConceptRelationCollection","_SourceReferenceCollection","_ConceptTypeDetailModel","_Constants","ConceptDetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_relations","ConceptRelationCollection","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_find","call","model","ConceptTypeDetailModel","conceptType","key","getData","selfhref","href","selflink","setParameter","TIMEVERSION_FILTER_NAME","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","getElements","propName","typePropName","elementTypes","allElements","elements","usedElementTypes","element","elementType","elType","_id","push","_includes","labels","getLabelElementByIds","ids","_context","_filter","conceptProperties","getConceptPropertiesByIds","_context2","property","textfragments","getTextFragmentByKeys","keys","_context3","textfragment","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","SourceReferenceCollection","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context4","_context7","availableLanguagesInSourceReferences","_map","sourceReference","substring","length","currentLanguagePostfix","locale","_context5","_context6","_endsWith","availableLanguages","split","value","isOfConceptType","conceptTypeId","exports"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * @private\n */\n getElements<T>(propName: string, typePropName: string): Array<T> {\n // $FlowIssue\n const elementTypes = this.conceptType?.[typePropName] ?? [];\n const allElements = this.data[propName] ?? [];\n\n const elements = [];\n const usedElementTypes = [];\n for (const element of allElements) {\n const elementType = elementTypes.find(\n (elType) => elType._id === element.type,\n );\n if (elementType) {\n elements.push({ ...elementType, ...element });\n usedElementTypes.push(elementType._id);\n } else {\n elements.push(element);\n }\n }\n\n for (const elementType of elementTypes) {\n if (!usedElementTypes.includes(elementType._id)) {\n elements.push(elementType);\n }\n }\n\n return elements;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.getElements<labelsJSON>(\"labels\", \"labelTypes\");\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.getElements<propertyJSON>(\"properties\", \"propertyTypes\");\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n return this.getElements<textfragmentJSON>(\n \"textFragments\",\n \"textFragmentTypes\",\n );\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAcA;AACA;AACA;AACe,MAAMK,kBAAkB,SAASC,sBAAa,CAAC;EAK5D;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIC,kCAAyB,CAC7C,IAAI,CAACC,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,I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C,CAAC;;MAED;MACA,OAAO,IAAA/B,OAAA,CAAA7D,OAAA,EAAAgF,SAAA,OAAI,CAAC7E,IAAI,CAAC2E,gBAAgB,EAAAtD,IAAA,CAAAwD,SAAA,EAC9BG,eAAe,IACd,CAAC,IAAA3B,SAAA,CAAAxD,OAAA,EAAA2F,kBAAkB,EAAAnE,IAAA,CAAlBmE,kBAAkB,EACjBR,eAAe,CAAC5E,IAAI,CAAC6E,SAAS,CAC5BD,eAAe,CAAC5E,IAAI,CAAC8E,MAAM,GAAGR,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIxE,SAASA,CAAA,EAAkB;IAC7B,OAAO,IAAAwD,OAAA,CAAA7D,OAAA,MAAI,CAACG,IAAI,IAAU+B,kCAAuB,CAAC,EAAE2D,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAACpE,WAAW,EAAEmE,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF;AAACC,OAAA,CAAAhG,OAAA,GAAAL,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_i18n/types.js"],"sourcesContent":["// @flow\nimport type Locales from \"../../i18n/Locales\";\n\nexport type I18nState = {\n +locales: Locales,\n +locale: string,\n};\n\nexport type UpdateLocaleAction = {\n type: \"UPDATE_LOCALE\",\n payload: string,\n};\n\nexport type SetLocalesAction = {\n type: \"SET_LOCALES\",\n payload: {\n locales: Locales,\n locale: string,\n },\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_i18n/types.js"],"sourcesContent":["// @flow\nimport type Locales from \"../../i18n/Locales\";\n\nexport type I18nState = {\n +locales: Locales,\n +locale: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useUpdateLocale) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateLocaleAction = {\n type: \"UPDATE_LOCALE\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SetLocalesAction = {\n type: \"SET_LOCALES\",\n payload: {\n locales: Locales,\n locale: string,\n },\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -254,10 +254,16 @@ const getModelsByType = (state, type) => {
|
|
|
254
254
|
/**
|
|
255
255
|
*/
|
|
256
256
|
exports.getModelsByType = getModelsByType;
|
|
257
|
-
const getAllFinishedModels = exports.getAllFinishedModels = (0, _reselect.createSelector)(state => state.modularui, modularui => {
|
|
257
|
+
const getAllFinishedModels = exports.getAllFinishedModels = (0, _reselect.createSelector)([state => state.modularui, state => state.i18n.locale], (modularui, locale) => {
|
|
258
258
|
if (modularui) {
|
|
259
259
|
var _context0, _context1;
|
|
260
|
-
return (0, _map.default)(_context0 = (0, _filter.default)(_context1 = (0, _keys.default)(modularui)).call(_context1, key =>
|
|
260
|
+
return (0, _map.default)(_context0 = (0, _filter.default)(_context1 = (0, _keys.default)(modularui)).call(_context1, key => {
|
|
261
|
+
if (modularui[key]) {
|
|
262
|
+
const item = modularui[key];
|
|
263
|
+
return item.status === _constants.MODULARUI_STATUS.FINISHED && item.model?.locale === locale;
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
266
|
+
})).call(_context0, key => modularui[key].model);
|
|
261
267
|
}
|
|
262
268
|
return [];
|
|
263
269
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUISelectors.js","names":["_reselect","require","_objects","_Href","_interopRequireDefault","_ContentModel","_ContentTOCModel","_ApplicationModel","_TabModel","_CaseViewModel","_FormModel","_constants","getAllModelsByInstance","state","instance","locale","i18n","modularui","_context","_context2","_map","default","_filter","_keys","call","key","model","exports","getFirstModelByInstance","_context3","foundKey","_find","entry","isInstance","localeMatches","getActiveModelByInstance","location","getLocation","_context4","_startsWith","selfhref","path","getApplication","ApplicationModel","getTab","TabModel","getCaseView","CaseViewModel","getForm","FormModel","modelByHref","href","_context5","findHref","Href","modelConfigKey","equals","keyByHref","_context6","allKeysByHref","_context7","router","pathname","getModels","models","forEach","modelKey","modelEntry","has","label","type","modelInfo","selfContentLink","ContentModel","ContentTOCModel","push","getActiveModels","createSelectorCreator","defaultMemoize","value","other","_stringify","contextModels","locationParts","split","reduce","accumulator","current","comparePath","decodeURIComponent","replace","foundEntry","encodedHref","toString","getPreference","preferenceName","preferences","getModelsByType","_context8","_context9","getAllFinishedModels","createSelector","_context0","_context1","status","MODULARUI_STATUS","FINISHED"],"sources":["../../../src/redux/_modularui/ModularUISelectors.js"],"sourcesContent":["// @flow\nimport {\n createSelector,\n createSelectorCreator,\n defaultMemoize,\n} from \"reselect\";\nimport { has } from \"../../utils/helpers/objects\";\n\nimport Href from \"../../models/href/Href\";\nimport ContentModel from \"../../models/content/ContentModel\";\nimport ContentTOCModel from \"../../models/content/ContentTOCModel\";\nimport ApplicationModel from \"../../models/application/ApplicationModel\";\nimport TabModel from \"../../models/tab/TabModel\";\nimport CaseViewModel from \"../../models/caseview/CaseViewModel\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ReduxState, PreferenceValue } from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport { MODULARUI_STATUS } from \"../../constants\";\n\n/**\n */\nexport const getAllModelsByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): Array<ModularUIModel> => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n return Object.keys(modularui)\n .filter((key) => {\n const { model } = modularui[key];\n return model instanceof instance && model.locale === locale;\n })\n .map((key) => modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getFirstModelByInstance = <T = ModularUIModel>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (!modularui) return null;\n\n const foundKey = Object.keys(modularui).find((key) => {\n const entry = modularui[key];\n if (!entry || !entry.model) return false;\n\n const isInstance = entry.model instanceof instance;\n const localeMatches = entry.model.locale === locale;\n\n return isInstance && localeMatches;\n });\n\n // $FlowIssue\n return foundKey ? modularui[foundKey].model : null;\n};\n\n/**\n */\nexport const getActiveModelByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const location = getLocation(state);\n\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n const key = Object.keys(modularui).find((key) => {\n const { model } = modularui[key];\n return (\n model instanceof instance &&\n model.locale === locale &&\n location.startsWith(model.selfhref.path)\n );\n });\n\n if (key) {\n const { model } = modularui[key];\n if (model instanceof instance) {\n return model;\n }\n }\n }\n\n return null;\n};\n\n/**\n * Get the application model, which is the model with selfhref '/'\n */\nexport const getApplication = (state: ReduxState): null | ApplicationModel =>\n getFirstModelByInstance(state, ApplicationModel);\n\n/**\n */\nexport const getTab = (state: ReduxState): null | TabModel =>\n getFirstModelByInstance(state, TabModel);\n\n/**\n */\nexport const getCaseView = (state: ReduxState): null | CaseViewModel =>\n getFirstModelByInstance(state, CaseViewModel);\n\n/**\n */\nexport const getForm = (state: ReduxState): null | FormModel =>\n getFirstModelByInstance(state, FormModel);\n\n/**\n * Get the model by it's href\n */\nexport const modelByHref = (\n state: ReduxState,\n href: Href | string,\n): null | ModularUIModel => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n const modelConfigKey = Object.keys(state.modularui).find((key) => {\n const model = state.modularui[key];\n\n return (\n model.model &&\n model.model.selfhref &&\n model.model.selfhref.equals(findHref)\n );\n });\n\n if (modelConfigKey) {\n return state.modularui[modelConfigKey].model;\n }\n }\n\n return null;\n};\n\n/**\n * Return the key of a model by the selfhref the model is saved in the reducer\n */\nexport const keyByHref = (state: ReduxState, href: Href | string): ?string => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).find((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return null;\n};\n\n/**\n * Returns all model keys found in the store, restrict on href\n */\nexport const allKeysByHref = (\n state: ReduxState,\n href: Href | string,\n): Array<string> => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).filter((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return [];\n};\n\n/**\n */\nconst getLocation = (state: ReduxState): string =>\n state?.router?.location.pathname;\n\n/**\n */\nconst getModels = (state: ReduxState) => {\n const models = [];\n\n Object.keys(state.modularui).forEach((modelKey: string) => {\n const modelEntry = state.modularui[modelKey];\n\n if (has(modelEntry, \"model\")) {\n const { key, selfhref, label, type } = modelEntry.model;\n\n const modelInfo = {\n key,\n selfhref,\n label,\n type,\n selfContentLink: null,\n };\n\n if (\n modelEntry.model instanceof ContentModel ||\n modelEntry.model instanceof ContentTOCModel\n ) {\n models.push({\n ...modelInfo,\n selfContentLink: modelEntry.model.selfContentLink,\n });\n } else {\n models.push(modelInfo);\n }\n }\n });\n\n return models;\n};\n\nexport const getActiveModels: (state: ReduxState) => Array<{\n key: string,\n href: Href,\n label: string,\n type: string,\n}> = createSelectorCreator(\n defaultMemoize,\n (value, other) => JSON.stringify(value) === JSON.stringify(other),\n)([getLocation, getModels], (location, models) => {\n const contextModels = [];\n\n if (location) {\n const locationParts = location.split(\"/\");\n\n locationParts.reduce((accumulator, current) => {\n const path = `${accumulator}/${current}`;\n\n // Remove modelcatalog part to match breadcrumb parts\n const comparePath = decodeURIComponent(path).replace(\n \"/modelcatalog/\",\n \"/\",\n );\n\n const foundEntry = models.find(\n (model) => model.selfhref && model.selfhref.equals(comparePath),\n );\n\n if (foundEntry) {\n const { key, label, type, selfhref, selfContentLink } = foundEntry;\n\n const href =\n path.startsWith(\"/modelcatalog/\") && selfContentLink\n ? new Href(`/modelcatalog${selfContentLink.encodedHref.toString()}`)\n : selfhref;\n\n contextModels.push({ key, href, label, type });\n }\n\n return path;\n });\n }\n\n return contextModels;\n});\n\n/**\n */\nexport const getPreference = (\n state: ReduxState,\n preferenceName: string,\n): null | PreferenceValue => {\n if (state && state.preferences) {\n return state.preferences[preferenceName];\n }\n\n return null;\n};\n\n/**\n * @deprecated - Use getFirstModelByInstance or the appropriate getter for the model type: getApplication, getTab, etc\n */\nexport const getModelsByType = (\n state: ReduxState,\n type: string,\n): Array<ModularUIModel> => {\n if (state && state.modularui) {\n return Object.keys(state.modularui)\n .filter(\n (key) =>\n state.modularui[key] &&\n state.modularui[key].model &&\n state.modularui[key].model.type === type,\n )\n .map((key) => state.modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getAllFinishedModels: (\n state: ReduxState,\n) => Array<ModularUIModel> = createSelector(\n (state: ReduxState) => state.modularui,\n (modularui): Array<ModularUIModel> => {\n if (modularui) {\n return Object.keys(modularui)\n .filter(\n (key) =>\n modularui[key] &&\n modularui[key].status === MODULARUI_STATUS.FINISHED,\n )\n .map((key) => modularui[key].model);\n }\n return [];\n },\n);\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,gBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,iBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,SAAA,GAAAJ,sBA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K,CAAC4C,IAAI,KAAKA,IACxC,CAAC,EAAA9C,IAAA,CAAA0E,SAAA,EACKzE,GAAG,IAAKZ,KAAK,CAACI,SAAS,CAACQ,GAAG,CAAC,CAACC,KAAK,CAAC;EAC7C;EAEA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AADAC,OAAA,CAAAsE,eAAA,GAAAA,eAAA;AAEO,MAAMG,oBAEa,GAAAzE,OAAA,CAAAyE,oBAAA,GAAG,IAAAC,wBAAc,EACxCxF,KAAiB,IAAKA,KAAK,CAACI,SAAS,EACrCA,SAAS,IAA4B;EACpC,IAAIA,SAAS,EAAE;IAAA,IAAAqF,SAAA,EAAAC,SAAA;IACb,OAAO,IAAAnF,IAAA,CAAAC,OAAA,EAAAiF,SAAA,OAAAhF,OAAA,CAAAD,OAAA,EAAAkF,SAAA,OAAAhF,KAAA,CAAAF,OAAA,EAAYJ,SAAS,CAAC,EAAAO,IAAA,CAAA+E,SAAA,EAExB9E,GAAG,IACFR,SAAS,CAACQ,GAAG,CAAC,IACdR,SAAS,CAACQ,GAAG,CAAC,CAAC+E,MAAM,KAAKC,2BAAgB,CAACC,QAC/C,CAAC,EAAAlF,IAAA,CAAA8E,SAAA,EACK7E,GAAG,IAAKR,SAAS,CAACQ,GAAG,CAAC,CAACC,KAAK,CAAC;EACvC;EACA,OAAO,EAAE;AACX,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ModularUISelectors.js","names":["_reselect","require","_objects","_Href","_interopRequireDefault","_ContentModel","_ContentTOCModel","_ApplicationModel","_TabModel","_CaseViewModel","_FormModel","_constants","getAllModelsByInstance","state","instance","locale","i18n","modularui","_context","_context2","_map","default","_filter","_keys","call","key","model","exports","getFirstModelByInstance","_context3","foundKey","_find","entry","isInstance","localeMatches","getActiveModelByInstance","location","getLocation","_context4","_startsWith","selfhref","path","getApplication","ApplicationModel","getTab","TabModel","getCaseView","CaseViewModel","getForm","FormModel","modelByHref","href","_context5","findHref","Href","modelConfigKey","equals","keyByHref","_context6","allKeysByHref","_context7","router","pathname","getModels","models","forEach","modelKey","modelEntry","has","label","type","modelInfo","selfContentLink","ContentModel","ContentTOCModel","push","getActiveModels","createSelectorCreator","defaultMemoize","value","other","_stringify","contextModels","locationParts","split","reduce","accumulator","current","comparePath","decodeURIComponent","replace","foundEntry","encodedHref","toString","getPreference","preferenceName","preferences","getModelsByType","_context8","_context9","getAllFinishedModels","createSelector","_context0","_context1","item","status","MODULARUI_STATUS","FINISHED"],"sources":["../../../src/redux/_modularui/ModularUISelectors.js"],"sourcesContent":["// @flow\nimport {\n createSelector,\n createSelectorCreator,\n defaultMemoize,\n} from \"reselect\";\nimport { has } from \"../../utils/helpers/objects\";\n\nimport Href from \"../../models/href/Href\";\nimport ContentModel from \"../../models/content/ContentModel\";\nimport ContentTOCModel from \"../../models/content/ContentTOCModel\";\nimport ApplicationModel from \"../../models/application/ApplicationModel\";\nimport TabModel from \"../../models/tab/TabModel\";\nimport CaseViewModel from \"../../models/caseview/CaseViewModel\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ReduxState, PreferenceValue } from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport { MODULARUI_STATUS } from \"../../constants\";\n\n/**\n */\nexport const getAllModelsByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): Array<ModularUIModel> => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n return Object.keys(modularui)\n .filter((key) => {\n const { model } = modularui[key];\n return model instanceof instance && model.locale === locale;\n })\n .map((key) => modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getFirstModelByInstance = <T = ModularUIModel>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (!modularui) return null;\n\n const foundKey = Object.keys(modularui).find((key) => {\n const entry = modularui[key];\n if (!entry || !entry.model) return false;\n\n const isInstance = entry.model instanceof instance;\n const localeMatches = entry.model.locale === locale;\n\n return isInstance && localeMatches;\n });\n\n // $FlowIssue\n return foundKey ? modularui[foundKey].model : null;\n};\n\n/**\n */\nexport const getActiveModelByInstance = <T>(\n state: ReduxState,\n instance: Class<T>,\n): T | null => {\n const location = getLocation(state);\n\n const locale = state?.i18n?.locale || \"en\";\n const modularui = state?.modularui;\n\n if (modularui) {\n const key = Object.keys(modularui).find((key) => {\n const { model } = modularui[key];\n return (\n model instanceof instance &&\n model.locale === locale &&\n location.startsWith(model.selfhref.path)\n );\n });\n\n if (key) {\n const { model } = modularui[key];\n if (model instanceof instance) {\n return model;\n }\n }\n }\n\n return null;\n};\n\n/**\n * Get the application model, which is the model with selfhref '/'\n */\nexport const getApplication = (state: ReduxState): null | ApplicationModel =>\n getFirstModelByInstance(state, ApplicationModel);\n\n/**\n */\nexport const getTab = (state: ReduxState): null | TabModel =>\n getFirstModelByInstance(state, TabModel);\n\n/**\n */\nexport const getCaseView = (state: ReduxState): null | CaseViewModel =>\n getFirstModelByInstance(state, CaseViewModel);\n\n/**\n */\nexport const getForm = (state: ReduxState): null | FormModel =>\n getFirstModelByInstance(state, FormModel);\n\n/**\n * Get the model by it's href\n */\nexport const modelByHref = (\n state: ReduxState,\n href: Href | string,\n): null | ModularUIModel => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n const modelConfigKey = Object.keys(state.modularui).find((key) => {\n const model = state.modularui[key];\n\n return (\n model.model &&\n model.model.selfhref &&\n model.model.selfhref.equals(findHref)\n );\n });\n\n if (modelConfigKey) {\n return state.modularui[modelConfigKey].model;\n }\n }\n\n return null;\n};\n\n/**\n * Return the key of a model by the selfhref the model is saved in the reducer\n */\nexport const keyByHref = (state: ReduxState, href: Href | string): ?string => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).find((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return null;\n};\n\n/**\n * Returns all model keys found in the store, restrict on href\n */\nexport const allKeysByHref = (\n state: ReduxState,\n href: Href | string,\n): Array<string> => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).filter((key) => {\n const { model } = state.modularui[key];\n return model && model.selfhref && model.selfhref.equals(findHref);\n });\n }\n\n return [];\n};\n\n/**\n */\nconst getLocation = (state: ReduxState): string =>\n state?.router?.location.pathname;\n\n/**\n */\nconst getModels = (state: ReduxState) => {\n const models = [];\n\n Object.keys(state.modularui).forEach((modelKey: string) => {\n const modelEntry = state.modularui[modelKey];\n\n if (has(modelEntry, \"model\")) {\n const { key, selfhref, label, type } = modelEntry.model;\n\n const modelInfo = {\n key,\n selfhref,\n label,\n type,\n selfContentLink: null,\n };\n\n if (\n modelEntry.model instanceof ContentModel ||\n modelEntry.model instanceof ContentTOCModel\n ) {\n models.push({\n ...modelInfo,\n selfContentLink: modelEntry.model.selfContentLink,\n });\n } else {\n models.push(modelInfo);\n }\n }\n });\n\n return models;\n};\n\nexport const getActiveModels: (state: ReduxState) => Array<{\n key: string,\n href: Href,\n label: string,\n type: string,\n}> = createSelectorCreator(\n defaultMemoize,\n (value, other) => JSON.stringify(value) === JSON.stringify(other),\n)([getLocation, getModels], (location, models) => {\n const contextModels = [];\n\n if (location) {\n const locationParts = location.split(\"/\");\n\n locationParts.reduce((accumulator, current) => {\n const path = `${accumulator}/${current}`;\n\n // Remove modelcatalog part to match breadcrumb parts\n const comparePath = decodeURIComponent(path).replace(\n \"/modelcatalog/\",\n \"/\",\n );\n\n const foundEntry = models.find(\n (model) => model.selfhref && model.selfhref.equals(comparePath),\n );\n\n if (foundEntry) {\n const { key, label, type, selfhref, selfContentLink } = foundEntry;\n\n const href =\n path.startsWith(\"/modelcatalog/\") && selfContentLink\n ? new Href(`/modelcatalog${selfContentLink.encodedHref.toString()}`)\n : selfhref;\n\n contextModels.push({ key, href, label, type });\n }\n\n return path;\n });\n }\n\n return contextModels;\n});\n\n/**\n */\nexport const getPreference = (\n state: ReduxState,\n preferenceName: string,\n): null | PreferenceValue => {\n if (state && state.preferences) {\n return state.preferences[preferenceName];\n }\n\n return null;\n};\n\n/**\n * @deprecated - Use getFirstModelByInstance or the appropriate getter for the model type: getApplication, getTab, etc\n */\nexport const getModelsByType = (\n state: ReduxState,\n type: string,\n): Array<ModularUIModel> => {\n if (state && state.modularui) {\n return Object.keys(state.modularui)\n .filter(\n (key) =>\n state.modularui[key] &&\n state.modularui[key].model &&\n state.modularui[key].model.type === type,\n )\n .map((key) => state.modularui[key].model);\n }\n\n return [];\n};\n\n/**\n */\nexport const getAllFinishedModels: (\n state: ReduxState,\n) => Array<ModularUIModel> = createSelector(\n [(state) => state.modularui, (state) => state.i18n.locale],\n (modularui, locale): Array<ModularUIModel> => {\n if (modularui) {\n return Object.keys(modularui)\n .filter((key) => {\n if (modularui[key]) {\n const item = modularui[key];\n return (\n item.status === MODULARUI_STATUS.FINISHED &&\n item.model?.locale === locale\n );\n }\n return false;\n })\n .map((key) => modularui[key].model);\n }\n return [];\n },\n);\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,gBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,iBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,SAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,cAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,UAAA,GAAAN,sBAAA,CAAAH,OAAA;AAIA,IAAAU,UAAA,GAAAV,OAAA;AAEA;AACA;AACO,MAAMW,sBAAsB,GAAGA,CACpCC,KAAiB,EACjBC,QAAkB,KACQ;EAC1B,MAAMC,MAAM,GAAGF,KAAK,EAAEG,IAAI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A,CAAAyE,oBAAA,GAAG,IAAAC,wBAAc,EACzC,CAAExF,KAAK,IAAKA,KAAK,CAACI,SAAS,EAAGJ,KAAK,IAAKA,KAAK,CAACG,IAAI,CAACD,MAAM,CAAC,EAC1D,CAACE,SAAS,EAAEF,MAAM,KAA4B;EAC5C,IAAIE,SAAS,EAAE;IAAA,IAAAqF,SAAA,EAAAC,SAAA;IACb,OAAO,IAAAnF,IAAA,CAAAC,OAAA,EAAAiF,SAAA,OAAAhF,OAAA,CAAAD,OAAA,EAAAkF,SAAA,OAAAhF,KAAA,CAAAF,OAAA,EAAYJ,SAAS,CAAC,EAAAO,IAAA,CAAA+E,SAAA,EAClB9E,GAAG,IAAK;MACf,IAAIR,SAAS,CAACQ,GAAG,CAAC,EAAE;QAClB,MAAM+E,IAAI,GAAGvF,SAAS,CAACQ,GAAG,CAAC;QAC3B,OACE+E,IAAI,CAACC,MAAM,KAAKC,2BAAgB,CAACC,QAAQ,IACzCH,IAAI,CAAC9E,KAAK,EAAEX,MAAM,KAAKA,MAAM;MAEjC;MACA,OAAO,KAAK;IACd,CAAC,CAAC,EAAAS,IAAA,CAAA8E,SAAA,EACI7E,GAAG,IAAKR,SAAS,CAACQ,GAAG,CAAC,CAACC,KAAK,CAAC;EACvC;EACA,OAAO,EAAE;AACX,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n +requestOptions?: any,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n key: string,\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n isReload?: boolean,\n withCredentials?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n requestOptions: any,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n +requestOptions?: any,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n key: string,\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n isReload?: boolean,\n withCredentials?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n requestOptions: any,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_router/types.js"],"sourcesContent":["// @flow\nimport type { HistoryAction, Location, LocationShape } from \"react-router\";\n\nexport type RouterState = {\n +location: Location,\n +action: HistoryAction,\n};\n\nexport type LocationChangeAction = {\n type: \"ROUTER/LOCATION_CHANGE\",\n payload: {\n location: Location,\n action: HistoryAction,\n },\n};\n\nexport type PushAction = {\n type: \"ROUTER/PUSH\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\nexport type ReplaceAction = {\n type: \"ROUTER/REPLACE\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\nexport type GoAction = {\n type: \"ROUTER/GO\",\n payload: {\n delta: number,\n },\n};\nexport type GoBackAction = {\n type: \"ROUTER/GOBACK\",\n};\n\nexport type GoForwardAction = {\n type: \"ROUTER/GOFORWARD\",\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_router/types.js"],"sourcesContent":["// @flow\nimport type { HistoryAction, Location, LocationShape } from \"react-router\";\n\nexport type RouterState = {\n +location: Location,\n +action: HistoryAction,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type LocationChangeAction = {\n type: \"ROUTER/LOCATION_CHANGE\",\n payload: {\n location: Location,\n action: HistoryAction,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type PushAction = {\n type: \"ROUTER/PUSH\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ReplaceAction = {\n type: \"ROUTER/REPLACE\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type GoAction = {\n type: \"ROUTER/GO\",\n payload: {\n delta: number,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type GoBackAction = {\n type: \"ROUTER/GOBACK\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type GoForwardAction = {\n type: \"ROUTER/GOFORWARD\",\n};\n"],"mappings":"","ignoreList":[]}
|