@beinformed/ui 1.14.5 → 1.16.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 +19 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/index.js.map +1 -1
- package/esm/hooks/useAllFormsOnModel.js +110 -0
- package/esm/hooks/useAllFormsOnModel.js.map +1 -0
- package/esm/hooks/useAuthentication.js +4 -1
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js +4 -4
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js +4 -0
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/SignIn.js +9 -0
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js +5 -0
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +43 -0
- package/esm/utils/helpers/checkResource.js.map +1 -0
- package/esm/utils/index.js +1 -1
- package/esm/utils/index.js.map +1 -1
- package/lib/hooks/index.js +13 -0
- package/lib/hooks/index.js.flow +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useAllFormsOnModel.js +131 -0
- package/lib/hooks/useAllFormsOnModel.js.flow +92 -0
- package/lib/hooks/useAllFormsOnModel.js.map +1 -0
- package/lib/hooks/useAuthentication.js +3 -0
- package/lib/hooks/useAuthentication.js.flow +7 -5
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js +4 -4
- package/lib/models/attributes/AttributeContent.js.flow +3 -3
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js +4 -0
- package/lib/redux/actions/FormAttributeSet.js.flow +7 -2
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/SignIn.js +14 -2
- package/lib/redux/actions/SignIn.js.flow +8 -0
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js +5 -0
- package/lib/redux/reducers/AuthReducer.js.flow +3 -0
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +52 -13
- package/lib/redux/types.js.flow +6 -1
- package/lib/utils/helpers/__tests__/checkResource.spec.js.flow +56 -0
- package/lib/utils/helpers/checkResource.js +57 -0
- package/{src/utils/helpers/checkResourceExists.js → lib/utils/helpers/checkResource.js.flow} +19 -0
- package/lib/utils/helpers/checkResource.js.map +1 -0
- package/lib/utils/index.js +4 -4
- package/lib/utils/index.js.flow +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +9 -9
- package/src/hooks/index.js +1 -0
- package/src/hooks/useAllFormsOnModel.js +92 -0
- package/src/hooks/useAuthentication.js +7 -5
- package/src/models/attributes/AttributeContent.js +3 -3
- package/src/redux/actions/FormAttributeSet.js +7 -2
- package/src/redux/actions/SignIn.js +8 -0
- package/src/redux/reducers/AuthReducer.js +3 -0
- package/src/redux/reducers/__tests__/AuthReducer.spec.js +52 -13
- package/src/redux/types.js +6 -1
- package/src/utils/helpers/__tests__/checkResource.spec.js +56 -0
- package/{lib/utils/helpers/checkResourceExists.js.flow → src/utils/helpers/checkResource.js} +19 -0
- package/src/utils/index.js +1 -1
- package/esm/utils/helpers/checkResourceExists.js +0 -23
- package/esm/utils/helpers/checkResourceExists.js.map +0 -1
- package/lib/utils/helpers/checkResourceExists.js +0 -34
- package/lib/utils/helpers/checkResourceExists.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.16.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.15.1...v1.16.0) (2022-03-22)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **authentication:** add action to reset authentication errors in auth reducer ([600c130](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/600c130bd5684f7d6fb677d6115f58145a709de7))
|
|
10
|
+
- **check-resource:** add method to check if a resource redirects to secureLogin ([ec5346b](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/ec5346b602e277dcb2c5a8c11efc8dfa6be4086e))
|
|
11
|
+
|
|
12
|
+
### [1.15.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.15.0...v1.15.1) (2022-03-21)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **validate:** set dynamic validations to enabled when not set in options ([3681a7a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/3681a7a2686b8bc3f528776a4daa2c3d6176c813))
|
|
17
|
+
|
|
18
|
+
## [1.15.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.14.5...v1.15.0) (2022-03-17)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **hooks:** add useRetrieveFormsOnModel hook ([042ba49](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/042ba49b33e62c1b6ac18c594b7ec358a153394a))
|
|
23
|
+
|
|
5
24
|
### [1.14.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.14.4...v1.14.5) (2022-03-15)
|
|
6
25
|
|
|
7
26
|
### Bug Fixes
|
package/esm/hooks/index.js
CHANGED
package/esm/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/index.js"],"names":[],"mappings":"AACA,cAAc,qBAAd;AACA,cAAc,cAAd;AACA,cAAc,WAAd;AACA,cAAc,WAAd;AACA,cAAc,YAAd;AACA,cAAc,mBAAd;AACA,cAAc,aAAd;AACA,cAAc,gBAAd;AACA,cAAc,qBAAd;AACA,cAAc,qBAAd;AACA,cAAc,uBAAd;AACA,cAAc,mBAAd;AACA,cAAc,iBAAd;AACA,cAAc,wBAAd;AACA,cAAc,aAAd","sourcesContent":["// @flow\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.js"],"names":[],"mappings":"AACA,cAAc,qBAAd;AACA,cAAc,cAAd;AACA,cAAc,WAAd;AACA,cAAc,WAAd;AACA,cAAc,YAAd;AACA,cAAc,mBAAd;AACA,cAAc,aAAd;AACA,cAAc,gBAAd;AACA,cAAc,qBAAd;AACA,cAAc,qBAAd;AACA,cAAc,uBAAd;AACA,cAAc,mBAAd;AACA,cAAc,iBAAd;AACA,cAAc,wBAAd;AACA,cAAc,aAAd;AACA,cAAc,sBAAd","sourcesContent":["// @flow\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\nexport * from \"./useAllFormsOnModel\";\n"],"file":"index.js"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime-corejs3/helpers/esm/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
4
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
5
|
+
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
6
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
7
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
8
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
9
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
10
|
+
import { useState, useEffect } from "react";
|
|
11
|
+
import { useModularUIRequest } from "./useModularUIRequest";
|
|
12
|
+
import { HTTP_METHODS } from "../constants";
|
|
13
|
+
import ListModel from "../models/list/ListModel";
|
|
14
|
+
import FormModel from "../models/form/FormModel";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Retrieve all forms configured on a model with actions
|
|
18
|
+
* @param model
|
|
19
|
+
* @returns Object - { actionName: FormModel }
|
|
20
|
+
*/
|
|
21
|
+
export var useRetrieveFormsOnModel = function useRetrieveFormsOnModel(model) {
|
|
22
|
+
var modularui = useModularUIRequest();
|
|
23
|
+
|
|
24
|
+
var _useState = useState(null),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
forms = _useState2[0],
|
|
27
|
+
setForms = _useState2[1];
|
|
28
|
+
|
|
29
|
+
var _useState3 = useState(0),
|
|
30
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
31
|
+
requestCount = _useState4[0],
|
|
32
|
+
setRequestCount = _useState4[1];
|
|
33
|
+
|
|
34
|
+
var _useState5 = useState(0),
|
|
35
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
|
+
responseCount = _useState6[0],
|
|
37
|
+
setResponseCount = _useState6[1];
|
|
38
|
+
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
var _context;
|
|
41
|
+
|
|
42
|
+
var requests = _mapInstanceProperty(_context = getActions(model)).call(_context, function (action) {
|
|
43
|
+
var href = action.selfhref.addParameter("commit", "false");
|
|
44
|
+
return modularui(href, {
|
|
45
|
+
method: HTTP_METHODS.POST
|
|
46
|
+
}).fetch().then(function (form) {
|
|
47
|
+
if (form instanceof FormModel) {
|
|
48
|
+
form.tokens = [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return _defineProperty({}, action.name, form);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
setRequestCount(requests.length);
|
|
56
|
+
|
|
57
|
+
_Promise.all(requests).then(function (responses) {
|
|
58
|
+
var _context2;
|
|
59
|
+
|
|
60
|
+
// put response array in object
|
|
61
|
+
var actionForms = _Object$assign.apply(Object, _concatInstanceProperty(_context2 = [{}]).call(_context2, _toConsumableArray(responses)));
|
|
62
|
+
|
|
63
|
+
setForms(actionForms);
|
|
64
|
+
setResponseCount(responses.length);
|
|
65
|
+
});
|
|
66
|
+
}, [model, modularui]);
|
|
67
|
+
|
|
68
|
+
if (responseCount === requestCount) {
|
|
69
|
+
return forms;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var getActions = function getActions(model) {
|
|
76
|
+
var _context3;
|
|
77
|
+
|
|
78
|
+
if (!model.actionCollection) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var createActions = _filterInstanceProperty(_context3 = model.actionCollection.getActionsByType("create")).call(_context3, function (action) {
|
|
83
|
+
return !action.isDisabled;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
var allActions = _toConsumableArray(createActions);
|
|
87
|
+
|
|
88
|
+
if (model instanceof ListModel) {
|
|
89
|
+
model.listItemCollection.forEach(function (listItem) {
|
|
90
|
+
var _context4;
|
|
91
|
+
|
|
92
|
+
var updateActions = _filterInstanceProperty(_context4 = listItem.actionCollection.getActionsByType("update")).call(_context4, function (action) {
|
|
93
|
+
return !action.isDisabled;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
allActions.push.apply(allActions, _toConsumableArray(updateActions));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var actions = [];
|
|
101
|
+
var unique = [];
|
|
102
|
+
allActions.forEach(function (action) {
|
|
103
|
+
if (!_includesInstanceProperty(unique).call(unique, action.name)) {
|
|
104
|
+
unique.push(action.name);
|
|
105
|
+
actions.push(action);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return actions;
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=useAllFormsOnModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useAllFormsOnModel.js"],"names":["useState","useEffect","useModularUIRequest","HTTP_METHODS","ListModel","FormModel","useRetrieveFormsOnModel","model","modularui","forms","setForms","requestCount","setRequestCount","responseCount","setResponseCount","requests","getActions","action","href","selfhref","addParameter","method","POST","fetch","then","form","tokens","name","length","all","responses","actionForms","Object","actionCollection","createActions","getActionsByType","isDisabled","allActions","listItemCollection","forEach","listItem","updateActions","push","actions","unique"],"mappings":";;;;;;;;;AACA,SAASA,QAAT,EAAmBC,SAAnB,QAAoC,OAApC;AAEA,SAASC,mBAAT,QAAoC,uBAApC;AAEA,SAASC,YAAT,QAA6B,cAA7B;AAEA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,OAAOC,SAAP,MAAsB,0BAAtB;;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,uBAAuB,GAAG,SAA1BA,uBAA0B,CACrCC,KADqC,EAEU;AAC/C,MAAMC,SAAS,GAAGN,mBAAmB,EAArC;;AACA,kBAA0BF,QAAQ,CAAC,IAAD,CAAlC;AAAA;AAAA,MAAOS,KAAP;AAAA,MAAcC,QAAd;;AACA,mBAAwCV,QAAQ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KADiB,EAEM;AAAA;;AACvB,MAAI,CAACA,KAAK,CAAC0B,gBAAX,EAA6B;AAC3B,WAAO,EAAP;AACD;;AAED,MAAMC,aAAa,GAAG,oCAAA3B,KAAK,CAAC0B,gBAAN,CACnBE,gBADmB,CACF,QADE,mBAEZ,UAAClB,MAAD;AAAA,WAAY,CAACA,MAAM,CAACmB,UAApB;AAAA,GAFY,CAAtB;;AAIA,MAAMC,UAAU,sBAAOH,aAAP,CAAhB;;AAEA,MAAI3B,KAAK,YAAYH,SAArB,EAAgC;AAC9BG,IAAAA,KAAK,CAAC+B,kBAAN,CAAyBC,OAAzB,CAAiC,UAACC,QAAD,EAAc;AAAA;;AAC7C,UAAMC,aAAa,GAAG,oCAAAD,QAAQ,CAACP,gBAAT,CACnBE,gBADmB,CACF,QADE,mBAEZ,UAAClB,MAAD;AAAA,eAAY,CAACA,MAAM,CAACmB,UAApB;AAAA,OAFY,CAAtB;;AAIAC,MAAAA,UAAU,CAACK,IAAX,OAAAL,UAAU,qBAASI,aAAT,EAAV;AACD,KAND;AAOD;;AAED,MAAME,OAAO,GAAG,EAAhB;AACA,MAAMC,MAAM,GAAG,EAAf;AACAP,EAAAA,UAAU,CAACE,OAAX,CAAmB,UAACtB,MAAD,EAAY;AAC7B,QAAI,CAAC,0BAAA2B,MAAM,MAAN,CAAAA,MAAM,EAAU3B,MAAM,CAACU,IAAjB,CAAX,EAAmC;AACjCiB,MAAAA,MAAM,CAACF,IAAP,CAAYzB,MAAM,CAACU,IAAnB;AACAgB,MAAAA,OAAO,CAACD,IAAR,CAAazB,MAAb;AACD;AACF,GALD;AAOA,SAAO0B,OAAP;AACD,CAjCD","sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\n\nimport { HTTP_METHODS } from \"../constants\";\n\nimport ListModel from \"../models/list/ListModel\";\nimport FormModel from \"../models/form/FormModel\";\n\nimport type DetailModel from \"../models/detail/DetailModel\";\nimport type TabModel from \"../models/tab/TabModel\";\nimport type ActionModel from \"../models/actions/ActionModel\";\n\n/**\n * Retrieve all forms configured on a model with actions\n * @param model\n * @returns Object - { actionName: FormModel }\n */\nexport const useRetrieveFormsOnModel = (\n model: ListModel | DetailModel | TabModel\n): null | { [actionName: string]: FormModel } => {\n const modularui = useModularUIRequest();\n const [forms, setForms] = useState(null);\n const [requestCount, setRequestCount] = useState(0);\n const [responseCount, setResponseCount] = useState(0);\n\n useEffect(() => {\n const requests = getActions(model).map((action) => {\n const href = action.selfhref.addParameter(\"commit\", \"false\");\n\n return modularui(href, { method: HTTP_METHODS.POST })\n .fetch()\n .then((form) => {\n if (form instanceof FormModel) {\n form.tokens = [];\n }\n return { [action.name]: form };\n });\n });\n\n setRequestCount(requests.length);\n\n Promise.all(requests).then((responses) => {\n // put response array in object\n const actionForms = Object.assign({}, ...responses);\n setForms(actionForms);\n setResponseCount(responses.length);\n });\n }, [model, modularui]);\n\n if (responseCount === requestCount) {\n return forms;\n }\n\n return null;\n};\n\nconst getActions = (\n model: ListModel | DetailModel | TabModel\n): Array<ActionModel> => {\n if (!model.actionCollection) {\n return [];\n }\n\n const createActions = model.actionCollection\n .getActionsByType(\"create\")\n .filter((action) => !action.isDisabled);\n\n const allActions = [...createActions];\n\n if (model instanceof ListModel) {\n model.listItemCollection.forEach((listItem) => {\n const updateActions = listItem.actionCollection\n .getActionsByType(\"update\")\n .filter((action) => !action.isDisabled);\n\n allActions.push(...updateActions);\n });\n }\n\n const actions = [];\n const unique = [];\n allActions.forEach((action) => {\n if (!unique.includes(action.name)) {\n unique.push(action.name);\n actions.push(action);\n }\n });\n\n return actions;\n};\n"],"file":"useAllFormsOnModel.js"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
2
|
import { useSelector, useDispatch } from "react-redux";
|
|
3
3
|
import { getApplication } from "../redux/_modularui/selectors";
|
|
4
|
-
import { login as _login, logout as _logout } from "../redux/actions";
|
|
4
|
+
import { login as _login, logout as _logout, resetAuthErrors } from "../redux/actions";
|
|
5
5
|
import UserServicesModel from "../models/user/UserServicesModel";
|
|
6
6
|
import { useState, useEffect } from "react";
|
|
7
7
|
|
|
@@ -31,6 +31,9 @@ export var useLogin = function useLogin() {
|
|
|
31
31
|
return {
|
|
32
32
|
isAuthenticated: getIsAuthenticated(auth.isAuthenticated, application),
|
|
33
33
|
errorMessage: auth.error,
|
|
34
|
+
resetErrors: function resetErrors() {
|
|
35
|
+
return dispatch(resetAuthErrors());
|
|
36
|
+
},
|
|
34
37
|
login: function login(username, password) {
|
|
35
38
|
return dispatch(_login(username, password));
|
|
36
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useAuthentication.js"],"names":["useSelector","useDispatch","getApplication","login","logout","UserServicesModel","useState","useEffect","getIsAuthenticated","isAuthenticated","application","userServicesModel","userServices","isLoggedIn","useLogin","dispatch","auth","state","errorMessage","error","username","password","useLogout","cancel","setCancel","setIsAuthenticated","then"],"mappings":";AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,cAAT,QAA+B,+BAA/B;AACA,SAASC,KAAK,IAALA,MAAT,EAAgBC,MAAM,IAANA,OAAhB,
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useAuthentication.js"],"names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","UserServicesModel","useState","useEffect","getIsAuthenticated","isAuthenticated","application","userServicesModel","userServices","isLoggedIn","useLogin","dispatch","auth","state","errorMessage","error","resetErrors","username","password","useLogout","cancel","setCancel","setIsAuthenticated","then"],"mappings":";AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,cAAT,QAA+B,+BAA/B;AACA,SAASC,KAAK,IAALA,MAAT,EAAgBC,MAAM,IAANA,OAAhB,EAAwBC,eAAxB,QAA+C,kBAA/C;AACA,OAAOC,iBAAP,MAA8B,kC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AK,CAACD,IAAN,4DAAYP,eAAZ,KAA+B,KAA1C;AAAA,GAAD,CAAxB;;AAEA,kBAA4BH,QAAQ,CAAC,KAAD,CAApC;AAAA;AAAA,MAAOkB,MAAP;AAAA,MAAeC,SAAf;;AACA,mBAA8CnB,QAAQ,CAAC;AAAA,WACrDE,kBAAkB,CAACQ,IAAD,EAAON,WAAP,CADmC;AAAA,GAAD,CAAtD;AAAA;AAAA,MAAOD,eAAP;AAAA,MAAwBiB,kBAAxB,iBANyC,CAUzC;AACA;;;AACAnB,EAAAA,SAAS,CAAC,YAAM;AACd,WAAO,YAAM;AACXkB,MAAAA,SAAS,CAAC,IAAD,CAAT;AACD,KAFD;AAGD,GAJQ,EAIN,EAJM,CAAT;AAMA,SAAO;AACLhB,IAAAA,eAAe,EAAfA,eADK;AAELN,IAAAA,MAAM,EAAE;AAAA,aACNY,QAAQ,CAACZ,OAAM,EAAP,CAAR,CAAmBwB,IAAnB,CAAwB,YAAM;AAC5B,YAAI,CAACH,MAAL,EAAa;AACXE,UAAAA,kBAAkB,CAAC,KAAD,CAAlB;AACD;AACF,OAJD,CADM;AAAA;AAFH,GAAP;AASD,CA3BM","sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { getApplication } from \"../redux/_modularui/selectors\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\nimport UserServicesModel from \"../models/user/UserServicesModel\";\nimport { useState, useEffect } from \"react\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\ntype LoginHook = {\n isAuthenticated: boolean,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n logout: () => void,\n};\n\nconst getIsAuthenticated = (isAuthenticated, application) => {\n if (!application) {\n return false;\n }\n\n const userServicesModel = application.userServices;\n if (userServicesModel instanceof UserServicesModel) {\n return isAuthenticated && userServicesModel.isLoggedIn;\n }\n\n return false;\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n const dispatch = useDispatch();\n\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth);\n\n return {\n isAuthenticated: getIsAuthenticated(auth.isAuthenticated, application),\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth?.isAuthenticated || false);\n\n const [cancel, setCancel] = useState(false);\n const [isAuthenticated, setIsAuthenticated] = useState(() =>\n getIsAuthenticated(auth, application)\n );\n\n // set cancel to true when the component this hook is used on, has been unmounted\n // prevents state changes after unmount\n useEffect(() => {\n return () => {\n setCancel(true);\n };\n }, []);\n\n return {\n isAuthenticated,\n logout: () =>\n dispatch(logout()).then(() => {\n if (!cancel) {\n setIsAuthenticated(false);\n }\n }),\n };\n};\n"],"file":"useAuthentication.js"}
|
|
@@ -92,7 +92,7 @@ var AttributeContent = /*#__PURE__*/function () {
|
|
|
92
92
|
|
|
93
93
|
return (_this$_content$elemen = this._content.elements) === null || _this$_content$elemen === void 0 ? void 0 : _mapInstanceProperty(_this$_content$elemen).call(_this$_content$elemen, function (element) {
|
|
94
94
|
if ("propertyElement" in element) {
|
|
95
|
-
// $FlowIssue[
|
|
95
|
+
// $FlowIssue[incompatible-use]
|
|
96
96
|
var _element$propertyElem = element.propertyElement,
|
|
97
97
|
label = _element$propertyElem.label,
|
|
98
98
|
layouthint = _element$propertyElem.layouthint,
|
|
@@ -107,8 +107,8 @@ var AttributeContent = /*#__PURE__*/function () {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if ("textFragmentElement" in element) {
|
|
110
|
-
|
|
111
|
-
element.textFragmentElement,
|
|
110
|
+
// $FlowIssue[incompatible-use]
|
|
111
|
+
var _element$textFragment = element.textFragmentElement,
|
|
112
112
|
_label = _element$textFragment.label,
|
|
113
113
|
_layouthint = _element$textFragment.layouthint,
|
|
114
114
|
textfragments = _element$textFragment.textfragments;
|
|
@@ -126,7 +126,7 @@ var AttributeContent = /*#__PURE__*/function () {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
if ("contentElement" in element) {
|
|
129
|
-
// $FlowIssue[
|
|
129
|
+
// $FlowIssue[incompatible-use]
|
|
130
130
|
var _element$contentEleme = element.contentElement,
|
|
131
131
|
_label2 = _element$contentEleme.label,
|
|
132
132
|
_layouthint2 = _element$contentEleme.layouthint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","isPlainObject","AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels","types","type","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AAEA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,QAA8B,aAA9B;;IAaMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOL,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAGE;AAAA;;AACA,UAAIO,WAAW,GAAG,IAAlB;AACA,UAAIC,iBAAiB,GAAG,IAAxB;AAEA,UAAMC,KAAK,qBAAG,KAAKH,QAAR,4EAAG,eAAeI,MAAlB,0DAAG,sBAAuBD,KAArC;;AACA,UAAIA,KAAJ,EAAW;AACTF,QAAAA,WAAW,GAAGE,KAAd;AACD;;AAED,U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,gBAHK,EAGa,UAHb,EAGyBF,MAHzB,CAAP;AAID;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMK,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKV,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCS,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,qBAAST,OAAO,CAACW,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe7B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"propertyElement\" in element) {\n // $FlowIssue[prop-missing]\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (\"textFragmentElement\" in element) {\n const { label, layouthint, textfragments } =\n // $FlowIssue[prop-missing]\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (\"contentElement\" in element) {\n // $FlowIssue[prop-missing]\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","isPlainObject","AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels","types","type","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AAEA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,QAA8B,aAA9B;;IAaMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOL,mBAAmB,EAA1B;AACD;AAED;AACF;;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;AAC3D,aAAO,yCAAKR,QAAL,kBAAqB,UAACC,OAAD;AAAA,eAAa,0BAAAO,KAAK,MAAL,CAAAA,KAAK,EAAUP,OAAO,CAACQ,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;AACA;;;;WACE,6BAAoBJ,MAApB,EAAgE;AAC9D,aAAO,KAAKE,mCAAL,CAGL,gBAHK,EAGa,UAHb,EAGyBF,MAHzB,CAAP;AAID;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMK,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKV,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCS,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,qBAAST,OAAO,CAACW,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe7B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (\"propertyElement\" in element) {\n // $FlowIssue[incompatible-use]\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (\"textFragmentElement\" in element) {\n // $FlowIssue[incompatible-use]\n const { label, layouthint, textfragments } =\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (\"contentElement\" in element) {\n // $FlowIssue[incompatible-use]\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
@@ -17,6 +17,10 @@ export var updateFormAttribute = function updateFormAttribute(form, formObject,
|
|
|
17
17
|
return function (dispatch) {
|
|
18
18
|
var newForm = form.clone();
|
|
19
19
|
|
|
20
|
+
if (!options.validate) {
|
|
21
|
+
options.validate = true;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
if (newForm.currentFormObject && newForm.currentFormObject.equals(formObject)) {
|
|
21
25
|
newForm.currentFormObject.updateAttribute(attribute, inputvalue);
|
|
22
26
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/FormAttributeSet.js"],"names":["updateModel","getSetting","validateFormObject","autosaveFormObject","autosubmitFormObject","updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","isChanged","hasDynamicValidations"],"mappings":"AACA,SAASA,WAAT,QAA4B,uBAA5B;AAEA,SAASC,UAAT,QAA2B,0BAA3B;AAEA,SAASC,kBAAT,QAAmC,mBAAnC;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SAASC,oBAAT,QAAqC,kBAArC;;AAOA;AACA;AACA;AACA,OAAO,IAAMC,mBAAmB,GAC9B,SADWA,mBACX,CACEC,IADF,EAEEC,UAFF,EAGEC,SAHF,EAIEC,UAJF;AAAA,MAKEC,OALF,uEAK+B;AAC3BC,IAAAA,UAAU,EAAE,KADe;AAE3BC,IAAAA,QAAQ,EAAE,KAFiB;AAG3BC,IAAAA,WAAW,EAAE,KAHc;AAI3BC,IAAAA,QAAQ,EAAE;AAJiB,GAL/B;AAAA,SAYA,UAACC,QAAD,EAAwB;AACtB,QAAMC,OAAO,GAAGV,IAAI,CAACW,KAAL,EAAhB;;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/FormAttributeSet.js"],"names":["updateModel","getSetting","validateFormObject","autosaveFormObject","autosubmitFormObject","updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","isChanged","hasDynamicValidations"],"mappings":"AACA,SAASA,WAAT,QAA4B,uBAA5B;AAEA,SAASC,UAAT,QAA2B,0BAA3B;AAEA,SAASC,kBAAT,QAAmC,mBAAnC;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SAASC,oBAAT,QAAqC,kBAArC;;AAOA;AACA;AACA;AACA,OAAO,IAAMC,mBAAmB,GAC9B,SADWA,mBACX,CACEC,IADF,EAEEC,UAFF,E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,OAAO,CAACE,iBAAR,IACAR,OAAO,CAACI,QADR,IAEAE,OAAO,CAACE,iBAAR,CAA0BS,qBAF1B,IAGA1B,UAAU,CAAC,+BAAD,CAJZ,EAKE;AACAc,MAAAA,QAAQ,CAACb,kBAAkB,CAACc,OAAD,CAAnB,CAAR;AACD;;AAED,WAAOD,QAAQ,CAACf,WAAW,CAACgB,OAAD,CAAZ,CAAf;AACD,GAzDD;AAAA,CADK","sourcesContent":["// @flow\nimport { updateModel } from \"../_modularui/actions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false,\n forceUpdate: false,\n validate: true,\n }\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (!options.validate) {\n options.validate = true;\n }\n\n if (\n newForm.currentFormObject &&\n newForm.currentFormObject.equals(formObject)\n ) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n\n if (\n newForm.currentFormObject &&\n options.validate &&\n newForm.currentFormObject.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n dispatch(validateFormObject(newForm));\n }\n\n return dispatch(updateModel(newForm));\n };\n"],"file":"FormAttributeSet.js"}
|
|
@@ -15,6 +15,15 @@ export var loginFailed = function loginFailed(errorMessage) {
|
|
|
15
15
|
payload: errorMessage
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Resets any authentication errors
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export var resetAuthErrors = function resetAuthErrors() {
|
|
23
|
+
return {
|
|
24
|
+
type: "AUTHENTICATION_RESET_ERRORS"
|
|
25
|
+
};
|
|
26
|
+
};
|
|
18
27
|
/**
|
|
19
28
|
* Send login success action
|
|
20
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/SignIn.js"],"names":["Cache","Authenticate","reloadApplication","startProgress","finishProgress","push","CHANGEPASSWORD_PATH","loginFailed","errorMessage","type","payload","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","login","username","password","then","addItem","catch","error","id","dispatchedReloadApplication","resolve"],"mappings":";AACA,OAAOA,KAAP,MAAkB,2BAAlB;AACA,OAAOC,YAAP,MAAyB,8BAAzB;AAEA,SAASC,iBAAT,QAAkC,eAAlC;AAEA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,qBAA9C;AACA,SAASC,IAAT,QAAqB,oBAArB;AACA,SAASC,mBAAT,QAAoC,2BAApC;;
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/SignIn.js"],"names":["Cache","Authenticate","reloadApplication","startProgress","finishProgress","push","CHANGEPASSWORD_PATH","loginFailed","errorMessage","type","payload","resetAuthErrors","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","login","username","password","then","addItem","catch","error","id","dispatchedReloadApplication","resolve"],"mappings":";AACA,OAAOA,KAAP,MAAk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6B;AAAA,CAAvB;AAeP;AACA;;AACA,OAAO,IAAMO,KAAK,GAChB,SADWA,KACX,CAACC,QAAD,EAAmBC,QAAnB;AAAA,SACA,UAACX,QAAD,EAAc;AACZA,IAAAA,QAAQ,CAACX,aAAa,EAAd,CAAR;AAEA,WAAO,IAAIF,YAAJ,GACJsB,KADI,CACEC,QADF,EACYC,QADZ,EAEJC,IAFI,CAEC;AAAA,aAAMZ,QAAQ,CAACZ,iBAAiB,EAAlB,CAAd;AAAA,KAFD,EAGJwB,IAHI,CAGC,YAAM;AACV1B,MAAAA,KAAK,CAAC2B,OAAN,CAAc,MAAd,EAAsB,IAAtB;AACAb,MAAAA,QAAQ,CAACF,YAAY,EAAb,CAAR;AAEA,aAAOE,QAAQ,CAACV,cAAc,EAAf,CAAf;AACD,KARI,EASJwB,KATI,CASE,UAACC,KAAD,EAAW;AAChB,UAAIA,KAAK,CAACC,EAAN,KAAa,8BAAjB,EAAiD;AAC/C,YAAMC,2BAA2B,GAAGjB,QAAQ,CAACZ,iBAAiB,EAAlB,CAA5C;AAEA,eAAO,SAAQ8B,OAAR,CAAgBD,2BAAhB,EAA6CL,IAA7C,CAAkD,YAAM;AAC7D1B,UAAAA,KAAK,CAAC2B,OAAN,CAAc,MAAd,EAAsB,IAAtB;AACA,iBAAOb,QAAQ,CAACD,cAAc,EAAf,CAAf;AACD,SAHM,CAAP;AAID;;AAEDC,MAAAA,QAAQ,CAACP,WAAW,CAACsB,KAAK,CAACC,EAAP,CAAZ,CAAR;AACA,aAAOhB,QAAQ,CAACV,cAAc,EAAf,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 ResetAuthErrorsAction,\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 * Resets any authentication errors\n */\nexport const resetAuthErrors = (): ResetAuthErrorsAction => ({\n type: \"AUTHENTICATION_RESET_ERRORS\",\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"}
|
|
@@ -42,6 +42,11 @@ var AuthReducer = function AuthReducer() {
|
|
|
42
42
|
error: action.payload
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
+
case "AUTHENTICATION_RESET_ERRORS":
|
|
46
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
47
|
+
error: null
|
|
48
|
+
});
|
|
49
|
+
|
|
45
50
|
case "AUTHENTICATION_LOGOUT":
|
|
46
51
|
{
|
|
47
52
|
// clear cache because of cached contributions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/reducers/AuthReducer.js"],"names":["Cache","initialState","isAuthenticated","mustChangePassword","error","AuthReducer","state","action","type","payload","clear"],"mappings":";;;;;;;;;;;AACA,OAAOA,KAAP,MAAkB,2BAAlB;AAKA;AACA,IAAMC,YAAuB,GAAG;AAC9BC,EAAAA,eAAe,EAAE,KADa;AAE9BC,EAAAA,kBAAkB,EAAE,KAFU;AAG9BC,EAAAA,KAAK,EAAE;AAHuB,CAAhC;AAMA;AACA;AACA;;AACA,IAAMC,WAA4C,GAAG,SAA/CA,WAA+C,GAGhD;AAAA,MAFHC,KAEG,uEAFKL,YAEL;AAAA,MADHM,MACG;;AACH,MAAI,CAACA,MAAL,EAAa;AACX,WAAOD,KAAP;AACD;;AAED,UAAQC,MAAM,CAACC,IAAf;AACE,SAAK,wBAAL;AACE,6CACKF,KADL;AAEEJ,QAAAA,eAAe,EAAE,IAFnB;AAGEE,QAAAA,KAAK,EAAE,IAHT;AAIED,QAAAA,kBAAkB,EAAE;AAJtB;;AAOF,SAAK,sBAAL;AACE,6CAAYG,KAAZ;AAAmBH,QAAAA,kBAAkB,EAAE,KAAvC;AAA8CC,QAAAA,KAAK,EAAEG,MAAM,CAACE;AAA5D;;AAEF,SAAK,uBAAL;AAA8B;AAC5B;AACA,
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/reducers/AuthReducer.js"],"names":["Cache","initialState","isAuthenticated","mustChangePassword","error","AuthReducer","state","action","type","payload","clear"],"mappings":";;;;;;;;;;;AACA,OAAOA,KAAP,MAAkB,2BAAlB;AAKA;AACA,IAAMC,YAAuB,GAAG;AAC9BC,EAAAA,eAAe,EAAE,KADa;AAE9BC,EAAAA,kBAAkB,EAAE,KAFU;AAG9BC,EAAAA,KAAK,EAAE;AAHuB,CAAhC;AAMA;AACA;AACA;;AACA,IAAMC,WAA4C,GAAG,SAA/CA,WAA+C,GAGhD;AAAA,MAFHC,KAEG,uEAFKL,YAEL;AAAA,MADHM,MACG;;AACH,MAAI,CAACA,MAAL,EAAa;AACX,WAAOD,KAAP;AACD;;AAED,UAAQC,MAAM,CAACC,IAAf;AACE,SAAK,wBAAL;AACE,6CACKF,KADL;AAEEJ,QAAAA,eAAe,EAAE,IAFnB;AAGEE,QAAAA,KAAK,EAAE,IAHT;AAIED,QAAAA,kBAAkB,EAAE;AAJtB;;AAOF,SAAK,sBAAL;AACE,6CAAYG,KAAZ;AAAmBH,QAAAA,kBAAkB,EAAE,KAAvC;AAA8CC,QAAAA,KAAK,EAAEG,MAAM,CAACE;AAA5D;;AAEF,SAAK,6BAAL;AACE,6CAAYH,KAAZ;AAAmBF,QAAAA,KAAK,EAAE;AAA1B;;AAEF,SAAK,uBAAL;AAA8B;AAC5B;AACA,YAAIE,KAAK,CAACJ,eAAV,EAA2B;AACzBF,UAAAA,KAAK,CAACU,KAAN;AACD;;AAED,+CACKJ,KADL;AAEEH,UAAAA,kBAAkB,EAAE,KAFtB;AAGED,UAAAA,eAAe,EAAE,KAHnB;AAIEE,UAAAA,KAAK,EAAE;AAJT;AAMD;;AAED,SAAK,iBAAL;AACE,6CACKE,KADL;AAEEJ,QAAAA,eAAe,EAAE,IAFnB;AAGEC,QAAAA,kBAAkB,EAAE,IAHtB;AAIEC,QAAAA,KAAK,EAAE;AAJT;;AAOF;AACE,aAAOE,KAAP;AAtCJ;AAwCD,CAhDD;;AAkDA,eAAeD,WAAf","sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { AuthState, ReduxAction } from \"../types\";\n\n// REDUCER\nconst initialState: AuthState = {\n isAuthenticated: false,\n mustChangePassword: false,\n error: null,\n};\n\n/**\n * Auth reducer\n */\nconst AuthReducer: Reducer<AuthState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"AUTHENTICATION_SUCCESS\":\n return {\n ...state,\n isAuthenticated: true,\n error: null,\n mustChangePassword: false,\n };\n\n case \"AUTHENTICATION_ERROR\":\n return { ...state, mustChangePassword: false, error: action.payload };\n\n case \"AUTHENTICATION_RESET_ERRORS\":\n return { ...state, error: null };\n\n case \"AUTHENTICATION_LOGOUT\": {\n // clear cache because of cached contributions\n if (state.isAuthenticated) {\n Cache.clear();\n }\n\n return {\n ...state,\n mustChangePassword: false,\n isAuthenticated: false,\n error: null,\n };\n }\n\n case \"CHANGE_PASSWORD\":\n return {\n ...state,\n isAuthenticated: true,\n mustChangePassword: true,\n error: null,\n };\n\n default:\n return state;\n }\n};\n\nexport default AuthReducer;\n"],"file":"AuthReducer.js"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
2
|
+
import _endsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/ends-with";
|
|
3
|
+
import { BASE } from "../../constants/Constants";
|
|
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
|
+
|
|
12
|
+
export var resourceExists = function resourceExists(url) {
|
|
13
|
+
var _context;
|
|
14
|
+
|
|
15
|
+
var fullUrl = _concatInstanceProperty(_context = "".concat(BASE, "/")).call(_context, url).replace(/\/\//g, "/");
|
|
16
|
+
|
|
17
|
+
var xhr = new XMLHttpRequest();
|
|
18
|
+
xhr.open("HEAD", fullUrl, false);
|
|
19
|
+
xhr.setRequestHeader("Accept", "application/json");
|
|
20
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
|
21
|
+
xhr.send();
|
|
22
|
+
return xhr.status !== 404;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Indicates if a request to the given url resuls in a redirect to /secureRedirect
|
|
26
|
+
* @param url
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
export var resourceRedirectsToSecureLogin = function resourceRedirectsToSecureLogin(url) {
|
|
31
|
+
var _context2, _xhr$responseURL;
|
|
32
|
+
|
|
33
|
+
var fullUrl = _concatInstanceProperty(_context2 = "".concat(BASE, "/")).call(_context2, url).replace(/\/\//g, "/");
|
|
34
|
+
|
|
35
|
+
var xhr = new XMLHttpRequest();
|
|
36
|
+
xhr.open("HEAD", fullUrl, false);
|
|
37
|
+
xhr.setRequestHeader("Accept", "application/json");
|
|
38
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
|
39
|
+
xhr.send();
|
|
40
|
+
var responseURL = (_xhr$responseURL = xhr.responseURL) !== null && _xhr$responseURL !== void 0 ? _xhr$responseURL : "";
|
|
41
|
+
return xhr.status === 400 && _endsWithInstanceProperty(responseURL).call(responseURL, "/secureLogin");
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=checkResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/helpers/checkResource.js"],"names":["BASE","resourceExists","url","fullUrl","replace","xhr","XMLHttpRequest","open","setRequestHeader","send","status","resourceRedirectsToSecureLogin","responseURL"],"mappings":";;AACA,SAASA,IAAT,QAAqB,2BAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,GAAD,EAA0B;AAAA;;AACtD,MAAMC,OAAO,GAAG,6CAAGH,IAAH,uBAAWE,GAAX,EAAiBE,OAAjB,CAAyB,OAAzB,EAAkC,GAAlC,CAAhB;;AAEA,MAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;AACAD,EAAAA,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBJ,OAAjB,EAA0B,KAA1B;AACAE,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;AAYP;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,8BAA8B,GAAG,SAAjCA,8BAAiC,CAACT,GAAD,EAA0B;AAAA;;AACtE,MAAMC,OAAO,GAAG,8CAAGH,IAAH,wBAAWE,GAAX,EAAiBE,OAAjB,CAAyB,OAAzB,EAAkC,GAAlC,CAAhB;;AAEA,MAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;AACAD,EAAAA,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBJ,OAAjB,EAA0B,KAA1B;AACAE,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,MAAMG,WAAW,uBAAGP,GAAG,CAACO,WAAP,+DAAsB,EAAvC;AAEA,SAAOP,GAAG,CAACK,MAAJ,KAAe,GAAf,IAAsB,0BAAAE,WAAW,MAAX,CAAAA,WAAW,EAAU,cAAV,CAAxC;AACD,CAZM","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\n/**\n * Indicates if a request to the given url resuls in a redirect to /secureRedirect\n * @param url\n * @returns {boolean}\n */\nexport const resourceRedirectsToSecureLogin = (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 const responseURL = xhr.responseURL ?? \"\";\n\n return xhr.status === 400 && responseURL.endsWith(\"/secureLogin\");\n};\n"],"file":"checkResource.js"}
|
package/esm/utils/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { default as createUUID } from "./helpers/createUUID";
|
|
|
13
13
|
export * from "./helpers/sanitizeHtml";
|
|
14
14
|
export * from "./helpers/objects";
|
|
15
15
|
export * from "./helpers/text";
|
|
16
|
-
export * from "./helpers/
|
|
16
|
+
export * from "./helpers/checkResource"; // number
|
|
17
17
|
|
|
18
18
|
export { default as DecimalFormat } from "./number/DecimalFormat";
|
|
19
19
|
export { default as formatValue } from "./number/formatValue";
|
package/esm/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.js"],"names":["default","Cache","serverFetch","universalFetch","xhr","createUUID","DecimalFormat","formatValue"],"mappings":"AAEA;AACA,SAASA,OAAO,IAAIC,KAApB,QAAiC,iBAAjC;AACA,cAAc,mBAAd,C,CAEA;;AACA,cAAc,yBAAd,C,CAEA;;AACA,SAASD,OAAO,IAAIE,WAApB,QAAuC,qBAAvC;AACA,SAASF,OAAO,IAAIG,cAApB,QAA0C,wBAA1C;AACA,SAASH,OAAO,IAAII,GAApB,QAA+B,aAA/B;AAGA;AACA,cAAc,sBAAd;AACA,SAASJ,OAAO,IAAIK,UAApB,QAAsC,sBAAtC;AACA,cAAc,wBAAd;AACA,cAAc,mBAAd;AACA,cAAc,gBAAd;AACA,cAAc
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.js"],"names":["default","Cache","serverFetch","universalFetch","xhr","createUUID","DecimalFormat","formatValue"],"mappings":"AAEA;AACA,SAASA,OAAO,IAAIC,KAApB,QAAiC,iBAAjC;AACA,cAAc,mBAAd,C,CAEA;;AACA,cAAc,yBAAd,C,CAEA;;AACA,SAASD,OAAO,IAAIE,WAApB,QAAuC,qBAAvC;AACA,SAASF,OAAO,IAAIG,cAApB,QAA0C,wBAA1C;AACA,SAASH,OAAO,IAAII,GAApB,QAA+B,aAA/B;AAGA;AACA,cAAc,sBAAd;AACA,SAASJ,OAAO,IAAIK,UAApB,QAAsC,sBAAtC;AACA,cAAc,wBAAd;AACA,cAAc,mBAAd;AACA,cAAc,gBAAd;AACA,cAAc,yBAAd,C,CAEA;;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,wBAAzC;AACA,SAASN,OAAO,IAAIO,WAApB,QAAuC,sBAAvC;AACA,cAAc,uBAAd","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/checkResource\";\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/lib/hooks/index.js
CHANGED
|
@@ -200,4 +200,17 @@ _Object$keys(_useRouter).forEach(function (key) {
|
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
202
|
});
|
|
203
|
+
|
|
204
|
+
var _useAllFormsOnModel = require("./useAllFormsOnModel");
|
|
205
|
+
|
|
206
|
+
_Object$keys(_useAllFormsOnModel).forEach(function (key) {
|
|
207
|
+
if (key === "default" || key === "__esModule") return;
|
|
208
|
+
if (key in exports && exports[key] === _useAllFormsOnModel[key]) return;
|
|
209
|
+
Object.defineProperty(exports, key, {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: function get() {
|
|
212
|
+
return _useAllFormsOnModel[key];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
});
|
|
203
216
|
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.flow
CHANGED
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/index.js"],"names":[],"mappings":";;;;;;;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// @flow\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.js"],"names":[],"mappings":";;;;;;;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// @flow\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\nexport * from \"./useAllFormsOnModel\";\n"],"file":"index.js"}
|