@beinformed/ui 1.13.3 → 1.14.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 +20 -0
- package/esm/models/attributes/AttributeContent.js +3 -3
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js +1 -0
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +2 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +3 -2
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/ResourceCollection.js +4 -2
- package/esm/models/base/ResourceCollection.js.map +1 -1
- package/esm/models/base/ResourceModel.js +1 -0
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +2 -1
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +2 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +2 -0
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/href/Href.js +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +2 -1
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/serverNoSSR.js +1 -1
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/redux/_modularui/actions.js +16 -17
- package/esm/redux/_modularui/actions.js.map +1 -1
- package/esm/redux/_modularui/reducer.js +1 -2
- package/esm/redux/_modularui/reducer.js.map +1 -1
- package/esm/redux/actions/Authorization.js +2 -1
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/SignIn.js +5 -9
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/utils/helpers/checkResourceExists.js +23 -0
- package/esm/utils/helpers/checkResourceExists.js.map +1 -0
- package/esm/utils/helpers/objects.js +2 -1
- package/esm/utils/helpers/objects.js.map +1 -1
- package/esm/utils/index.js +2 -1
- package/esm/utils/index.js.map +1 -1
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +1 -0
- package/lib/models/attributes/AttributeContent.js +3 -3
- package/lib/models/attributes/AttributeContent.js.flow +3 -3
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.flow +10 -2
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js +1 -0
- package/lib/models/attributes/BooleanAttributeModel.js.flow +4 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +4 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +5 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +2 -1
- package/lib/models/attributes/CompositeAttributeModel.js.flow +1 -0
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +4 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +3 -5
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/base/BaseCollection.js.flow +2 -2
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/ResourceCollection.js +4 -2
- package/lib/models/base/ResourceCollection.js.flow +4 -6
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js +1 -0
- package/lib/models/base/ResourceModel.js.flow +3 -2
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +3 -1
- package/lib/models/concepts/BusinessScenarioModel.js.flow +2 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +3 -1
- package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.flow +5 -2
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js.flow +6 -2
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +2 -0
- package/lib/models/content/ContentLinkModel.js.flow +2 -0
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/href/Href.js +1 -1
- package/lib/models/href/Href.js.flow +2 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/types.js.flow +2 -2
- package/lib/react-server/__tests__/serverUtil.spec.js.flow +15 -14
- package/lib/react-server/renderSSRComplete.js +2 -1
- package/lib/react-server/renderSSRComplete.js.flow +4 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +1 -1
- package/lib/react-server/serverNoSSR.js.flow +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -0
- package/lib/redux/_modularui/actions.js +12 -12
- package/lib/redux/_modularui/actions.js.flow +12 -12
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/_modularui/reducer.js +1 -2
- package/lib/redux/_modularui/reducer.js.flow +0 -1
- package/lib/redux/_modularui/reducer.js.map +1 -1
- package/lib/redux/actions/Authorization.js +2 -1
- package/lib/redux/actions/Authorization.js.flow +1 -0
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/SignIn.js +6 -9
- package/lib/redux/actions/SignIn.js.flow +5 -11
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/__tests__/Application.spec.js.flow +1 -0
- package/lib/redux/actions/__tests__/CustomErrorResponseHandler.spec.js.flow +2 -0
- package/lib/utils/fetch/__tests__/xhr.spec.js.flow +1 -0
- package/lib/utils/helpers/checkResourceExists.js +34 -0
- package/lib/utils/helpers/checkResourceExists.js.flow +21 -0
- package/lib/utils/helpers/checkResourceExists.js.map +1 -0
- package/lib/utils/helpers/objects.js +3 -1
- package/lib/utils/helpers/objects.js.flow +2 -2
- package/lib/utils/helpers/objects.js.map +1 -1
- package/lib/utils/index.js +14 -0
- package/lib/utils/index.js.flow +1 -0
- package/lib/utils/index.js.map +1 -1
- package/package.json +17 -17
- package/src/hooks/__tests__/useAuthentication.spec.js +1 -0
- package/src/models/attributes/AttributeContent.js +3 -3
- package/src/models/attributes/AttributeModel.js +10 -2
- package/src/models/attributes/BooleanAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +1 -1
- package/src/models/attributes/ChoiceAttributeOptionModel.js +5 -2
- package/src/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/src/models/attributes/CompositeAttributeModel.js +1 -0
- package/src/models/attributes/DatetimeAttributeModel.js +3 -5
- package/src/models/base/BaseCollection.js +2 -2
- package/src/models/base/ResourceCollection.js +4 -6
- package/src/models/base/ResourceModel.js +3 -2
- package/src/models/concepts/BusinessScenarioModel.js +2 -1
- package/src/models/concepts/ConceptDetailModel.js +2 -2
- package/src/models/concepts/ConceptLinkModel.js +5 -2
- package/src/models/concepts/ConceptRelationModel.js +6 -2
- package/src/models/content/ContentLinkModel.js +2 -0
- package/src/models/href/Href.js +2 -1
- package/src/models/types.js +2 -2
- package/src/react-server/__tests__/serverUtil.spec.js +15 -14
- package/src/react-server/renderSSRComplete.js +4 -1
- package/src/react-server/serverNoSSR.js +1 -1
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -0
- package/src/redux/_modularui/actions.js +12 -12
- package/src/redux/_modularui/reducer.js +0 -1
- package/src/redux/actions/Authorization.js +1 -0
- package/src/redux/actions/SignIn.js +5 -11
- package/src/redux/actions/__tests__/Application.spec.js +1 -0
- package/src/redux/actions/__tests__/CustomErrorResponseHandler.spec.js +2 -0
- package/src/utils/fetch/__tests__/xhr.spec.js +1 -0
- package/src/utils/helpers/checkResourceExists.js +21 -0
- package/src/utils/helpers/objects.js +2 -2
- package/src/utils/index.js +1 -0
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.loginSuccess = exports.loginFailed = exports.login = exports.changePassword = void 0;
|
|
9
9
|
|
|
10
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
11
|
+
|
|
10
12
|
var _Cache = _interopRequireDefault(require("../../utils/browser/Cache"));
|
|
11
13
|
|
|
12
14
|
var _Authenticate = _interopRequireDefault(require("../../modularui/Authenticate"));
|
|
@@ -81,16 +83,11 @@ var login = function login(username, password) {
|
|
|
81
83
|
}).catch(function (error) {
|
|
82
84
|
if (error.id === "Error.ChangePasswordRequired") {
|
|
83
85
|
var dispatchedReloadApplication = dispatch((0, _Application.reloadApplication)());
|
|
86
|
+
return _promise.default.resolve(dispatchedReloadApplication).then(function () {
|
|
87
|
+
_Cache.default.addItem("auth", true);
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
_Cache.default.addItem("auth", true);
|
|
88
|
-
|
|
89
|
-
return dispatch(changePassword());
|
|
90
|
-
}).then(function () {
|
|
91
|
-
return dispatch((0, _ProgressIndicator.finishProgress)());
|
|
92
|
-
});
|
|
93
|
-
}
|
|
89
|
+
return dispatch(changePassword());
|
|
90
|
+
});
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
dispatch(loginFailed(error.id));
|
|
@@ -66,17 +66,11 @@ export const login =
|
|
|
66
66
|
.catch((error) => {
|
|
67
67
|
if (error.id === "Error.ChangePasswordRequired") {
|
|
68
68
|
const dispatchedReloadApplication = dispatch(reloadApplication());
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.then(() => {
|
|
75
|
-
Cache.addItem("auth", true);
|
|
76
|
-
return dispatch(changePassword());
|
|
77
|
-
})
|
|
78
|
-
.then(() => dispatch(finishProgress()));
|
|
79
|
-
}
|
|
69
|
+
|
|
70
|
+
return Promise.resolve(dispatchedReloadApplication).then(() => {
|
|
71
|
+
Cache.addItem("auth", true);
|
|
72
|
+
return dispatch(changePassword());
|
|
73
|
+
});
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
dispatch(loginFailed(error.id));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/SignIn.js"],"names":["loginFailed","errorMessage","type","payload","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","CHANGEPASSWORD_PATH","login","username","password","Authenticate","then","Cache","addItem","catch","error","id","dispatchedReloadApplication"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/SignIn.js"],"names":["loginFailed","errorMessage","type","payload","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","CHANGEPASSWORD_PATH","login","username","password","Authenticate","then","Cache","addItem","catch","error","id","dispatchedReloadApplication","resolve"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAQA;AACA;AACA;AACO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,YAAD;AAAA,SAA8C;AACvEC,IAAAA,IAAI,EAAE,sBADiE;AAEvEC,IAAAA,OAAO,EAAEF;AAF8D,GAA9C;AAAA,CAApB;AAKP;AACA;AACA;;;;;AACO,IAAMG,YAAY,GAAG,SAAfA,YAAe;AAAA,SAA2B;AACrDF,IAAAA,IAAI,EAAE;AAD+C,GAA3B;AAAA,CAArB;AAIP;AACA;AACA;;;;;AACO,IAAMG,cAAc,GAAG,SAAjBA,cAAiB;AAAA,SAAmB,UAACC,QAAD,EAAWC,QAAX,EAAwB;AAAA;;AACvED,IAAAA,QAAQ,CAAC;AACPJ,MAAAA,IAAI,EAAE;AADC,KAAD,CAAR;AAIA,QAAMM,OAAO,4BAAGD,QAAQ,GAAGE,MAAX,CAAkBC,QAArB,oFAAG,sBAA4BC,KAA/B,2DAAG,uBAAmCC,KAAnD;AACA,QAAMC,YAAY,6BAAGN,QAAQ,GAAGE,MAAX,CAAkBC,QAArB,qFAAG,uBAA4BC,KAA/B,2DAAG,uBAAmCG,IAAxD;AACA,WAAOR,QAAQ,CACb,mBAAKS,8BAAL,EAA0B;AACxBD,MAAAA,IAAI,EAAED,YAAY,GAAGA,YAAH,GAAkBN,QAAQ,GAAGE,MAAX,CAAkBC,QAD9B;AAExBE,MAAAA,KAAK,EAAEJ;AAFiB,KAA1B,CADa,CAAf;AAMD,GAb6B;AAAA,CAAvB;AAeP;AACA;;;;;AACO,IAAMQ,KAAK,GAChB,SADWA,KACX,CAACC,QAAD,EAAmBC,QAAnB;AAAA,SACA,UAACZ,QAAD,EAAc;AACZA,IAAAA,QAAQ,CAAC,uCAAD,CAAR;AAEA,WAAO,IAAIa,qBAAJ,GACJH,KADI,CACEC,QADF,EACYC,QADZ,EAEJE,IAFI,CAEC;AAAA,aAAMd,QAAQ,CAAC,qCAAD,CAAd;AAAA,KAFD,EAGJc,IAHI,CAGC,YAAM;AACVC,qBAAMC,OAAN,CAAc,MAAd,EAAsB,IAAtB;;AACAhB,MAAAA,QAAQ,CAACF,YAAY,EAAb,CAAR;AAEA,aAAOE,QAAQ,CAAC,wCAAD,CAAf;AACD,KARI,EASJiB,KATI,CASE,UAACC,KAAD,EAAW;AAChB,UAAIA,KAAK,CAACC,EAAN,KAAa,8BAAjB,EAAiD;AAC/C,YAAMC,2BAA2B,GAAGpB,QAAQ,CAAC,qCAAD,CAA5C;AAEA,eAAO,iBAAQqB,OAAR,CAAgBD,2BAAhB,EAA6CN,IAA7C,CAAkD,YAAM;AAC7DC,yBAAMC,OAAN,CAAc,MAAd,EAAsB,IAAtB;;AACA,iBAAOhB,QAAQ,CAACD,cAAc,EAAf,CAAf;AACD,SAHM,CAAP;AAID;;AAEDC,MAAAA,QAAQ,CAACN,WAAW,CAACwB,KAAK,CAACC,EAAP,CAAZ,CAAR;AACA,aAAOnB,QAAQ,CAAC,wCAAD,CAAf;AACD,KArBI,CAAP;AAsBD,GA1BD;AAAA,CADK","sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport { reloadApplication } from \"./Application\";\n\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { push } from \"../_router/actions\";\nimport { CHANGEPASSWORD_PATH } from \"../../constants/Constants\";\n\nimport type {\n LoginFailedAction,\n LoginSuccessAction,\n ThunkAction,\n} from \"../types\";\n\n/**\n * Send login failed action\n */\nexport const loginFailed = (errorMessage: string): LoginFailedAction => ({\n type: \"AUTHENTICATION_ERROR\",\n payload: errorMessage,\n});\n\n/**\n * Send login success action\n */\nexport const loginSuccess = (): LoginSuccessAction => ({\n type: \"AUTHENTICATION_SUCCESS\",\n});\n\n/**\n * Send change password action\n */\nexport const changePassword = (): ThunkAction => (dispatch, getState) => {\n dispatch({\n type: \"CHANGE_PASSWORD\",\n });\n\n const isModal = getState().router.location?.state?.modal;\n const locationFrom = getState().router.location?.state?.from;\n return dispatch(\n push(CHANGEPASSWORD_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n modal: isModal,\n })\n );\n};\n\n/**\n */\nexport const login =\n (username: string, password: string): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n\n return new Authenticate()\n .login(username, password)\n .then(() => dispatch(reloadApplication()))\n .then(() => {\n Cache.addItem(\"auth\", true);\n dispatch(loginSuccess());\n\n return dispatch(finishProgress());\n })\n .catch((error) => {\n if (error.id === \"Error.ChangePasswordRequired\") {\n const dispatchedReloadApplication = dispatch(reloadApplication());\n\n return Promise.resolve(dispatchedReloadApplication).then(() => {\n Cache.addItem(\"auth\", true);\n return dispatch(changePassword());\n });\n }\n\n dispatch(loginFailed(error.id));\n return dispatch(finishProgress());\n });\n };\n"],"file":"SignIn.js"}
|
|
@@ -27,6 +27,7 @@ describe("custom error response handling", () => {
|
|
|
27
27
|
const store = mockStore({});
|
|
28
28
|
|
|
29
29
|
setCustomErrorResponseHandler((error) => {
|
|
30
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
30
31
|
if (error.isRemoteServiceException) {
|
|
31
32
|
return {
|
|
32
33
|
type: "REMOTE_SERVICE_EXCEPTION",
|
|
@@ -50,6 +51,7 @@ describe("custom error response handling", () => {
|
|
|
50
51
|
const store = mockStore({});
|
|
51
52
|
|
|
52
53
|
setCustomErrorResponseHandler((error, defaultHandler) => (dispatch) => {
|
|
54
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
53
55
|
if (error.isRemoteServiceException) {
|
|
54
56
|
dispatch({
|
|
55
57
|
type: "REMOTE_SERVICE_EXCEPTION",
|
|
@@ -156,6 +156,7 @@ describe("xhr", () => {
|
|
|
156
156
|
onProgress: ({ type, loaded, total, lengthComputable }) => {
|
|
157
157
|
events.push({ type, loaded, total, lengthComputable });
|
|
158
158
|
|
|
159
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
159
160
|
if (type === "loadend") {
|
|
160
161
|
resolve(events);
|
|
161
162
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.resourceExists = void 0;
|
|
9
|
+
|
|
10
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
11
|
+
|
|
12
|
+
var _Constants = require("../../constants/Constants");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)
|
|
16
|
+
* When the resource returns a 404, the resource does not exists and the method returns false
|
|
17
|
+
*
|
|
18
|
+
* @param url
|
|
19
|
+
* @returns {boolean}
|
|
20
|
+
*/
|
|
21
|
+
var resourceExists = function resourceExists(url) {
|
|
22
|
+
var _context;
|
|
23
|
+
|
|
24
|
+
var fullUrl = (0, _concat.default)(_context = "".concat(_Constants.BASE, "/")).call(_context, url).replace(/\/\//g, "/");
|
|
25
|
+
var xhr = new XMLHttpRequest();
|
|
26
|
+
xhr.open("HEAD", fullUrl, false);
|
|
27
|
+
xhr.setRequestHeader("Accept", "application/json");
|
|
28
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
|
29
|
+
xhr.send();
|
|
30
|
+
return xhr.status !== 404;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.resourceExists = resourceExists;
|
|
34
|
+
//# sourceMappingURL=checkResourceExists.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { BASE } from "../../constants/Constants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)
|
|
6
|
+
* When the resource returns a 404, the resource does not exists and the method returns false
|
|
7
|
+
*
|
|
8
|
+
* @param url
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
export const resourceExists = (url: string): boolean => {
|
|
12
|
+
const fullUrl = `${BASE}/${url}`.replace(/\/\//g, "/");
|
|
13
|
+
|
|
14
|
+
const xhr = new XMLHttpRequest();
|
|
15
|
+
xhr.open("HEAD", fullUrl, false);
|
|
16
|
+
xhr.setRequestHeader("Accept", "application/json");
|
|
17
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
|
18
|
+
xhr.send();
|
|
19
|
+
|
|
20
|
+
return xhr.status !== 404;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/helpers/checkResourceExists.js"],"names":["resourceExists","url","fullUrl","BASE","replace","xhr","XMLHttpRequest","open","setRequestHeader","send","status"],"mappings":";;;;;;;;;;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,GAAD,EAA0B;AAAA;;AACtD,MAAMC,OAAO,GAAG,0CAAGC,eAAH,uBAAWF,GAAX,EAAiBG,OAAjB,CAAyB,OAAzB,EAAkC,GAAlC,CAAhB;AAEA,MAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;AACAD,EAAAA,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBL,OAAjB,EAA0B,KAA1B;AACAG,EAAAA,GAAG,CAACG,gBAAJ,CAAqB,QAArB,EAA+B,kBAA/B;AACAH,EAAAA,GAAG,CAACG,gBAAJ,CAAqB,cAArB,EAAqC,kBAArC;AACAH,EAAAA,GAAG,CAACI,IAAJ;AAEA,SAAOJ,GAAG,CAACK,MAAJ,KAAe,GAAtB;AACD,CAVM","sourcesContent":["// @flow\nimport { BASE } from \"../../constants/Constants\";\n\n/**\n * Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)\n * When the resource returns a 404, the resource does not exists and the method returns false\n *\n * @param url\n * @returns {boolean}\n */\nexport const resourceExists = (url: string): boolean => {\n const fullUrl = `${BASE}/${url}`.replace(/\\/\\//g, \"/\");\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send();\n\n return xhr.status !== 404;\n};\n"],"file":"checkResourceExists.js"}
|
|
@@ -11,10 +11,12 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/ty
|
|
|
11
11
|
|
|
12
12
|
var _has2 = _interopRequireDefault(require("lodash/has"));
|
|
13
13
|
|
|
14
|
+
var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
*/
|
|
16
18
|
var isPlainObject = function isPlainObject(value) {
|
|
17
|
-
return
|
|
19
|
+
return (0, _isPlainObject2.default)(value);
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
20
22
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import _has from "lodash/has";
|
|
3
|
+
import _isPlainObject from "lodash/isPlainObject";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
*/
|
|
6
|
-
export const isPlainObject = (value: any): boolean =>
|
|
7
|
-
Object.prototype.toString.call(value) === "[object Object]";
|
|
7
|
+
export const isPlainObject = (value: any): boolean => _isPlainObject(value);
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/helpers/objects.js"],"names":["isPlainObject","value","
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/helpers/objects.js"],"names":["isPlainObject","value","has","obj","propName","get","path","defaultValue","String","split","reduce","acc","v"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;AAAA,SAAyB,6BAAeA,KAAf,CAAzB;AAAA,CAAtB;AAEP;AACA;;;;;AACO,IAAMC,GAAG,GAAG,SAANA,GAAM,CAACC,GAAD,EAAWC,QAAX,EAAyC;AAC1D,MAAI,CAACJ,aAAa,CAACG,GAAD,CAAlB,EAAyB;AACvB,WAAO,KAAP;AACD;;AAED,SAAO,mBAAKA,GAAL,EAAUC,QAAV,CAAP;AACD,CANM;AAQP;AACA;AACA;AACA;;;;;AACO,IAAMC,GAAG,GAAG,SAANA,GAAM,CAACF,GAAD,EAAeG,IAAf,EAA6BC,YAA7B;AAAA,SACjBC,MAAM,CAACF,IAAD,CAAN,CACGG,KADH,CACS,GADT,EAEGC,MAFH,CAEU,UAACC,GAAD,EAAMC,CAAN,EAAY;AAClB,QAAI,sBAAOD,GAAP,MAAe,QAAnB,EAA6B;AAAA;;AAC3B,uBAAOA,GAAG,CAACC,CAAD,CAAV,2CAAiBL,YAAjB;AACD;;AACD,WAAOA,YAAP;AACD,GAPH,EAOKJ,GAPL,CADiB;AAAA,CAAZ","sourcesContent":["// @flow\nimport _has from \"lodash/has\";\nimport _isPlainObject from \"lodash/isPlainObject\";\n\n/**\n */\nexport const isPlainObject = (value: any): boolean => _isPlainObject(value);\n\n/**\n */\nexport const has = (obj: any, propName: string): boolean => {\n if (!isPlainObject(obj)) {\n return false;\n }\n\n return _has(obj, propName);\n};\n\n/**\n * Retrieve property of an object\n * When path is only one deep better use optional chaining\n */\nexport const get = (obj: { ... }, path: string, defaultValue?: any): any =>\n String(path)\n .split(\".\")\n .reduce((acc, v) => {\n if (typeof acc === \"object\") {\n return acc[v] ?? defaultValue;\n }\n return defaultValue;\n }, obj);\n"],"file":"objects.js"}
|
package/lib/utils/index.js
CHANGED
|
@@ -153,6 +153,20 @@ _Object$keys(_text).forEach(function (key) {
|
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
var _checkResourceExists = require("./helpers/checkResourceExists");
|
|
157
|
+
|
|
158
|
+
_Object$keys(_checkResourceExists).forEach(function (key) {
|
|
159
|
+
if (key === "default" || key === "__esModule") return;
|
|
160
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
161
|
+
if (key in exports && exports[key] === _checkResourceExists[key]) return;
|
|
162
|
+
Object.defineProperty(exports, key, {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function get() {
|
|
165
|
+
return _checkResourceExists[key];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
156
170
|
var _DecimalFormat = _interopRequireDefault(require("./number/DecimalFormat"));
|
|
157
171
|
|
|
158
172
|
var _formatValue = _interopRequireDefault(require("./number/formatValue"));
|
package/lib/utils/index.js.flow
CHANGED
|
@@ -19,6 +19,7 @@ export { default as createUUID } from "./helpers/createUUID";
|
|
|
19
19
|
export * from "./helpers/sanitizeHtml";
|
|
20
20
|
export * from "./helpers/objects";
|
|
21
21
|
export * from "./helpers/text";
|
|
22
|
+
export * from "./helpers/checkResourceExists";
|
|
22
23
|
|
|
23
24
|
// number
|
|
24
25
|
export { default as DecimalFormat } from "./number/DecimalFormat";
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AACA;;AACA;;AAIA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// @flow\n\n// browser\nexport { default as Cache } from \"./browser/Cache\";\nexport * from \"./browser/Cookies\";\n\n// datetime\nexport * from \"./datetime/DateTimeUtil\";\n\n// fetch\nexport { default as serverFetch } from \"./fetch/serverFetch\";\nexport { default as universalFetch } from \"./fetch/universalFetch\";\nexport { default as xhr } from \"./fetch/xhr\";\nexport type * from \"./fetch/types\";\n\n// helpers\nexport * from \"./helpers/createHash\";\nexport { default as createUUID } from \"./helpers/createUUID\";\nexport * from \"./helpers/sanitizeHtml\";\nexport * from \"./helpers/objects\";\nexport * from \"./helpers/text\";\n\n// number\nexport { default as DecimalFormat } from \"./number/DecimalFormat\";\nexport { default as formatValue } from \"./number/formatValue\";\nexport * from \"./number/parseNumbers\";\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AACA;;AACA;;AAIA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// @flow\n\n// browser\nexport { default as Cache } from \"./browser/Cache\";\nexport * from \"./browser/Cookies\";\n\n// datetime\nexport * from \"./datetime/DateTimeUtil\";\n\n// fetch\nexport { default as serverFetch } from \"./fetch/serverFetch\";\nexport { default as universalFetch } from \"./fetch/universalFetch\";\nexport { default as xhr } from \"./fetch/xhr\";\nexport type * from \"./fetch/types\";\n\n// helpers\nexport * from \"./helpers/createHash\";\nexport { default as createUUID } from \"./helpers/createUUID\";\nexport * from \"./helpers/sanitizeHtml\";\nexport * from \"./helpers/objects\";\nexport * from \"./helpers/text\";\nexport * from \"./helpers/checkResourceExists\";\n\n// number\nexport { default as DecimalFormat } from \"./number/DecimalFormat\";\nexport { default as formatValue } from \"./number/formatValue\";\nexport * from \"./number/parseNumbers\";\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"styled-components": "^5.2.0"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@babel/runtime-corejs3": "^7.17.
|
|
81
|
+
"@babel/runtime-corejs3": "^7.17.2",
|
|
82
82
|
"big.js": "^6.1.1",
|
|
83
83
|
"date-fns": "^2.28.0",
|
|
84
84
|
"deepmerge": "^4.2.2",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"element-closest": "^3.0.2",
|
|
87
87
|
"file-size": "^1.0.0",
|
|
88
88
|
"focus-visible": "^5.2.0",
|
|
89
|
-
"format-message": "^6.2.
|
|
89
|
+
"format-message": "^6.2.4",
|
|
90
90
|
"he": "^1.2.0",
|
|
91
91
|
"iban": "^0.0.14",
|
|
92
92
|
"js-cookie": "^3.0.1",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"setimmediate": "^1.0.5"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@babel/cli": "^7.17.
|
|
99
|
-
"@babel/core": "^7.17.
|
|
98
|
+
"@babel/cli": "^7.17.3",
|
|
99
|
+
"@babel/core": "^7.17.5",
|
|
100
100
|
"@babel/eslint-parser": "^7.17.0",
|
|
101
101
|
"@babel/eslint-plugin": "^7.16.5",
|
|
102
102
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
@@ -104,40 +104,40 @@
|
|
|
104
104
|
"@babel/preset-env": "^7.16.11",
|
|
105
105
|
"@babel/preset-flow": "^7.16.7",
|
|
106
106
|
"@babel/preset-react": "^7.16.7",
|
|
107
|
-
"@commitlint/cli": "^16.1
|
|
108
|
-
"@commitlint/config-conventional": "^16.
|
|
107
|
+
"@commitlint/cli": "^16.2.1",
|
|
108
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
109
109
|
"@testing-library/react-hooks": "^7.0.2",
|
|
110
|
-
"auditjs": "^4.0.
|
|
111
|
-
"babel-jest": "^27.
|
|
110
|
+
"auditjs": "^4.0.36",
|
|
111
|
+
"babel-jest": "^27.5.1",
|
|
112
112
|
"babel-plugin-styled-components": "^2.0.2",
|
|
113
113
|
"cherry-pick": "^0.5.0",
|
|
114
114
|
"cross-env": "^7.0.3",
|
|
115
115
|
"documentation": "^13.2.5",
|
|
116
|
-
"eslint": "^8.
|
|
116
|
+
"eslint": "^8.9.0",
|
|
117
117
|
"eslint-config-prettier": "^8.3.0",
|
|
118
118
|
"eslint-plugin-babel": "^5.3.1",
|
|
119
|
-
"eslint-plugin-
|
|
119
|
+
"eslint-plugin-ft-flow": "^2.0.1",
|
|
120
120
|
"eslint-plugin-import": "^2.25.4",
|
|
121
|
-
"eslint-plugin-jest": "^26.
|
|
122
|
-
"eslint-plugin-jsdoc": "^37.
|
|
121
|
+
"eslint-plugin-jest": "^26.1.1",
|
|
122
|
+
"eslint-plugin-jsdoc": "^37.9.4",
|
|
123
123
|
"eslint-plugin-react": "^7.28.0",
|
|
124
124
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
125
|
-
"flow-bin": "0.
|
|
125
|
+
"flow-bin": "^0.172.0",
|
|
126
126
|
"flow-copy-source": "^2.0.9",
|
|
127
127
|
"flow-typed": "^3.6.1",
|
|
128
128
|
"glob": "^7.2.0",
|
|
129
129
|
"history": "^4.0.0",
|
|
130
130
|
"husky": "^7.0.4",
|
|
131
|
-
"jest": "^27.
|
|
131
|
+
"jest": "^27.5.1",
|
|
132
132
|
"jest-junit": "^13.0.0",
|
|
133
133
|
"jest-sonar-reporter": "^2.0.0",
|
|
134
134
|
"jscodeshift": "^0.13.1",
|
|
135
|
-
"lint-staged": "^12.3.
|
|
135
|
+
"lint-staged": "^12.3.4",
|
|
136
136
|
"polished": "^4.1.4",
|
|
137
137
|
"prettier": "^2.5.1",
|
|
138
138
|
"react": "^17.0.2",
|
|
139
139
|
"react-dom": "^17.0.2",
|
|
140
|
-
"react-helmet-async": "^1.2.
|
|
140
|
+
"react-helmet-async": "^1.2.3",
|
|
141
141
|
"react-redux": "^7.2.6",
|
|
142
142
|
"react-router-dom": "^5.3.0",
|
|
143
143
|
"react-test-renderer": "^17.0.2",
|
|
@@ -62,7 +62,7 @@ class AttributeContent {
|
|
|
62
62
|
if (this._content?.elements) {
|
|
63
63
|
return this._content.elements?.map((element) => {
|
|
64
64
|
if ("propertyElement" in element) {
|
|
65
|
-
// $FlowIssue
|
|
65
|
+
// $FlowIssue[prop-missing]
|
|
66
66
|
const { label, layouthint, properties } = element.propertyElement;
|
|
67
67
|
|
|
68
68
|
return {
|
|
@@ -76,7 +76,7 @@ class AttributeContent {
|
|
|
76
76
|
|
|
77
77
|
if ("textFragmentElement" in element) {
|
|
78
78
|
const { label, layouthint, textfragments } =
|
|
79
|
-
// $FlowIssue
|
|
79
|
+
// $FlowIssue[prop-missing]
|
|
80
80
|
element.textFragmentElement;
|
|
81
81
|
return {
|
|
82
82
|
textFragmentElement: {
|
|
@@ -91,7 +91,7 @@ class AttributeContent {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if ("contentElement" in element) {
|
|
94
|
-
// $FlowIssue
|
|
94
|
+
// $FlowIssue[prop-missing]
|
|
95
95
|
const { label, layouthint, sections } = element.contentElement;
|
|
96
96
|
return {
|
|
97
97
|
contentElement: {
|
|
@@ -26,7 +26,12 @@ import {
|
|
|
26
26
|
} from "../../exceptions";
|
|
27
27
|
|
|
28
28
|
import type { MessageParameters } from "../../i18n/types";
|
|
29
|
-
import type {
|
|
29
|
+
import type {
|
|
30
|
+
AttributeType,
|
|
31
|
+
FormErrorAnchor,
|
|
32
|
+
IModelWithChildModels,
|
|
33
|
+
ModularUIModel,
|
|
34
|
+
} from "../types";
|
|
30
35
|
import type LinkModel from "../links/LinkModel";
|
|
31
36
|
import type ContentConfiguration from "../contentconfiguration/ContentConfiguration";
|
|
32
37
|
import type ContentConfigurationElements from "../contentconfiguration/ContentConfigurationElements";
|
|
@@ -37,7 +42,10 @@ import AttributeContent from "./AttributeContent";
|
|
|
37
42
|
/**
|
|
38
43
|
* Attribute model, base model for all kind of attributes
|
|
39
44
|
*/
|
|
40
|
-
export default class AttributeModel
|
|
45
|
+
export default class AttributeModel
|
|
46
|
+
extends BaseModel
|
|
47
|
+
implements IModelWithChildModels
|
|
48
|
+
{
|
|
41
49
|
_label: string;
|
|
42
50
|
_lastModification: number = 0;
|
|
43
51
|
|
|
@@ -142,7 +142,10 @@ export default class BooleanAttributeModel extends AttributeModel {
|
|
|
142
142
|
* Getting all enabled options
|
|
143
143
|
*/
|
|
144
144
|
get selected(): Array<string> {
|
|
145
|
-
|
|
145
|
+
// $FlowFixMe[incompatible-call]
|
|
146
|
+
return this.options.selected.map<string, ChoiceAttributeOptionModel>(
|
|
147
|
+
(option: ChoiceAttributeOptionModel) => option.code
|
|
148
|
+
);
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
/**
|
|
@@ -149,7 +149,10 @@ export default class ChoiceAttributeModel extends AttributeModel {
|
|
|
149
149
|
* Getting all enabled options
|
|
150
150
|
*/
|
|
151
151
|
get selected(): Array<string> {
|
|
152
|
-
|
|
152
|
+
// $FlowFixMe[incompatible-call]
|
|
153
|
+
return this.options.selected.map<string, ChoiceAttributeOptionModel>(
|
|
154
|
+
(option: ChoiceAttributeOptionModel) => option.code
|
|
155
|
+
);
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
/**
|
|
@@ -220,7 +220,7 @@ class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceAttribute
|
|
|
220
220
|
get selected(): Array<ChoiceAttributeOptionModel> {
|
|
221
221
|
const selectedOptions = [];
|
|
222
222
|
|
|
223
|
-
this.collection.forEach((option) => {
|
|
223
|
+
this.collection.forEach((option: ChoiceAttributeOptionModel) => {
|
|
224
224
|
if (option.selected && option.selected === true) {
|
|
225
225
|
selectedOptions.push(option);
|
|
226
226
|
}
|
|
@@ -13,13 +13,16 @@ import AttributeCollection from "./AttributeCollection";
|
|
|
13
13
|
import ConceptDetailModel from "../concepts/ConceptDetailModel";
|
|
14
14
|
import AttributeContent from "./AttributeContent";
|
|
15
15
|
|
|
16
|
-
import type { ModularUIModel } from "../types";
|
|
16
|
+
import type { IModelWithChildModels, ModularUIModel } from "../types";
|
|
17
17
|
import type ListItemModel from "../list/ListItemModel";
|
|
18
18
|
import type LinkModel from "../links/LinkModel";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
*/
|
|
22
|
-
class ChoiceAttributeOptionModel
|
|
22
|
+
class ChoiceAttributeOptionModel
|
|
23
|
+
extends BaseModel
|
|
24
|
+
implements IModelWithChildModels
|
|
25
|
+
{
|
|
23
26
|
_code: string;
|
|
24
27
|
_isSelected: boolean;
|
|
25
28
|
_referenceDate: ISO_DATE;
|
|
@@ -165,6 +165,7 @@ class CompositeAttributeChildCollection extends ResourceCollection<AttributeType
|
|
|
165
165
|
*/
|
|
166
166
|
get initvalue(): any {
|
|
167
167
|
if (this.first instanceof CompositeAttributeChildCollection) {
|
|
168
|
+
// $FlowFixMe[missing-type-arg]
|
|
168
169
|
return this.collection.map<Array<Object>>(
|
|
169
170
|
(collection) => collection.initvalue
|
|
170
171
|
);
|
|
@@ -195,7 +196,6 @@ class CompositeAttributeChildCollection extends ResourceCollection<AttributeType
|
|
|
195
196
|
|
|
196
197
|
this.collection.forEach((attribute) => {
|
|
197
198
|
if (attribute.formdata !== null && !attribute.readonly) {
|
|
198
|
-
// $FlowIgnore[cannot-spread-indexer]
|
|
199
199
|
children = {
|
|
200
200
|
...children,
|
|
201
201
|
...attribute.formdata,
|
|
@@ -375,6 +375,7 @@ class CompositeAttributeModel extends AttributeModel {
|
|
|
375
375
|
(this.key === otherAttribute.key &&
|
|
376
376
|
this.parentKey === otherAttribute.parentKey) ||
|
|
377
377
|
this.children.some(
|
|
378
|
+
//$FlowFixMe[method-unbinding]
|
|
378
379
|
(child) => child.equals && child.equals(otherAttribute)
|
|
379
380
|
)
|
|
380
381
|
);
|
|
@@ -18,6 +18,7 @@ import DateBoundaryConstraint from "./input-constraints/DateBoundaryConstraint";
|
|
|
18
18
|
|
|
19
19
|
import { ATTRIBUTE_WIDTH, ISO_DATE_FORMAT } from "../../constants";
|
|
20
20
|
import { getSetting } from "../../constants/Settings";
|
|
21
|
+
import { IGNORE_FORMAT_SETTING } from "../../constants/LayoutHints";
|
|
21
22
|
|
|
22
23
|
import type { FormErrorAnchor, IConstraintModel } from "../types";
|
|
23
24
|
|
|
@@ -239,11 +240,8 @@ class DatetimeAttributeModel extends StringAttributeModel {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
// setting for date input
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
false
|
|
245
|
-
);
|
|
246
|
-
if (!ignoreDateInputFormatSetting) {
|
|
243
|
+
const ignoreFormatSetting = this.layouthint.has(IGNORE_FORMAT_SETTING);
|
|
244
|
+
if (!ignoreFormatSetting) {
|
|
247
245
|
const dateInputFormatSetting = getSetting("DATE_INPUT_FORMAT", "");
|
|
248
246
|
if (dateInputFormatSetting) {
|
|
249
247
|
return dateInputFormatSetting;
|
|
@@ -154,9 +154,9 @@ class BaseCollection<T> {
|
|
|
154
154
|
*/
|
|
155
155
|
map<U>(
|
|
156
156
|
callbackfn: (value: T, index: number, array: Array<T>) => U,
|
|
157
|
-
thisArg?:
|
|
157
|
+
thisArg?: T
|
|
158
158
|
): Array<U> {
|
|
159
|
-
return this.collection.map<U>(callbackfn, thisArg);
|
|
159
|
+
return this.collection.map<U, ?T>(callbackfn, thisArg);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
@@ -16,11 +16,8 @@ class ResourceCollection<T: IModelWithChildModels> extends BaseCollection<T> {
|
|
|
16
16
|
const initialChildModelLinks = [];
|
|
17
17
|
|
|
18
18
|
this.collection.forEach((item: T) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
item.getInitialChildModelLinks &&
|
|
22
|
-
typeof item.getInitialChildModelLinks === "function"
|
|
23
|
-
) {
|
|
19
|
+
// $FlowFixMe[method-unbinding]
|
|
20
|
+
if (typeof item?.getInitialChildModelLinks === "function") {
|
|
24
21
|
initialChildModelLinks.push(...item.getInitialChildModelLinks());
|
|
25
22
|
}
|
|
26
23
|
});
|
|
@@ -33,7 +30,8 @@ class ResourceCollection<T: IModelWithChildModels> extends BaseCollection<T> {
|
|
|
33
30
|
*/
|
|
34
31
|
setChildModels(models: Array<ModularUIModel>) {
|
|
35
32
|
this.collection.forEach((item) => {
|
|
36
|
-
|
|
33
|
+
// $FlowFixMe[prop-missing]
|
|
34
|
+
if (typeof item["setChildModels"] === "function") {
|
|
37
35
|
item.setChildModels(models);
|
|
38
36
|
}
|
|
39
37
|
});
|
|
@@ -200,8 +200,9 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
200
200
|
...super.dehydrate(),
|
|
201
201
|
key: this._key,
|
|
202
202
|
locale: this._locale,
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
// $FlowFixMe[missing-type-arg]
|
|
204
|
+
childModels: this._childModels.map<ModularUIModel>(
|
|
205
|
+
(childModel: ModularUIModel) => childModel.dehydrate()
|
|
205
206
|
),
|
|
206
207
|
};
|
|
207
208
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import ConceptDetailModel from "./ConceptDetailModel";
|
|
3
|
+
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
3
4
|
|
|
4
5
|
import type { ModularUIResponse } from "../../modularui";
|
|
5
6
|
import type { ModularUIModel } from "../types";
|
|
@@ -58,7 +59,7 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
58
59
|
setChildModels(models: Array<ModularUIModel>) {
|
|
59
60
|
// $FlowExpectedError[incompatible-type]
|
|
60
61
|
this.conceptType = models.find(
|
|
61
|
-
(model) => model
|
|
62
|
+
(model) => model instanceof ConceptTypeDetailModel
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
const scenarioSteps = [];
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ResourceModel from "../base/ResourceModel";
|
|
3
3
|
import ConceptRelationCollection from "./ConceptRelationCollection";
|
|
4
4
|
import SourceReferenceCollection from "./SourceReferenceCollection";
|
|
5
|
+
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
5
6
|
|
|
6
7
|
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
7
8
|
|
|
@@ -14,7 +15,6 @@ import type {
|
|
|
14
15
|
import type { ModularUIResponse } from "../../modularui";
|
|
15
16
|
import type Href from "../href/Href";
|
|
16
17
|
import type LinkModel from "../links/LinkModel";
|
|
17
|
-
import type ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Model for concept details, available through modelcatalog
|
|
@@ -70,7 +70,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
70
70
|
setChildModels(models: Array<ModularUIModel>) {
|
|
71
71
|
// $FlowExpectedError[incompatible-type]
|
|
72
72
|
const conceptTypeModel: ?ConceptTypeDetailModel = models.find(
|
|
73
|
-
(model) => model
|
|
73
|
+
(model) => model instanceof ConceptTypeDetailModel
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
if (conceptTypeModel) {
|
|
@@ -5,12 +5,15 @@ import LinkCollection from "../links/LinkCollection";
|
|
|
5
5
|
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
6
6
|
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
7
7
|
|
|
8
|
-
import type { ModularUIModel } from "../types";
|
|
8
|
+
import type { IModelWithChildModels, ModularUIModel } from "../types";
|
|
9
9
|
import type Href from "../href/Href";
|
|
10
10
|
/**
|
|
11
11
|
* Link to a concept
|
|
12
12
|
*/
|
|
13
|
-
export default class ConceptLinkModel
|
|
13
|
+
export default class ConceptLinkModel
|
|
14
|
+
extends BaseModel
|
|
15
|
+
implements IModelWithChildModels
|
|
16
|
+
{
|
|
14
17
|
_links: ?LinkCollection;
|
|
15
18
|
_entryDate: ?ISO_DATE;
|
|
16
19
|
_conceptType: ?ConceptTypeDetailModel;
|