@beinformed/ui 1.25.6 → 1.27.0-beta.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 +31 -0
- package/esm/constants/Constants.js +9 -35
- package/esm/constants/Constants.js.map +1 -1
- package/esm/constants/Settings.js +47 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useAuthentication.js +7 -6
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +2 -3
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js +3 -12
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/UploadAttributeModel.js +15 -3
- package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
- package/esm/models/error/ErrorModel.js +11 -0
- package/esm/models/error/ErrorModel.js.map +1 -1
- package/esm/models/href/Href.js +4 -4
- package/esm/models/href/Href.js.map +1 -1
- package/esm/modularui/Authenticate.js +6 -6
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/CaptchaRequest.js +46 -0
- package/esm/modularui/CaptchaRequest.js.map +1 -0
- package/esm/modularui/ModularUIRequest.js +48 -6
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/UploadRequest.js +104 -0
- package/esm/modularui/UploadRequest.js.map +1 -0
- package/esm/modularui/index.js +2 -0
- package/esm/modularui/index.js.map +1 -1
- package/esm/react-client/client.js +2 -2
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-server/contextPath.js +2 -2
- package/esm/react-server/contextPath.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +5 -4
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/renderSSRMinimal.js +2 -2
- package/esm/react-server/renderSSRMinimal.js.map +1 -1
- package/esm/react-server/serverNoSSR.js +2 -1
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/react-server/serverUtil.js +31 -5
- package/esm/react-server/serverUtil.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +7 -0
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +21 -1
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/store/configureStore.js +1 -1
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/browser/Cookies.js +6 -7
- package/esm/utils/browser/Cookies.js.map +1 -1
- package/esm/utils/fetch/serverFetch.js +2 -2
- package/esm/utils/fetch/serverFetch.js.map +1 -1
- package/esm/utils/fetch/types.js.map +1 -1
- package/esm/utils/fetch/universalFetch.js +4 -3
- package/esm/utils/fetch/universalFetch.js.map +1 -1
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +0 -3
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/esm/utils/helpers/index.js +8 -0
- package/esm/utils/helpers/index.js.map +1 -0
- package/esm/utils/helpers/repositoryResource.js +18 -0
- package/esm/utils/helpers/repositoryResource.js.map +1 -0
- package/esm/utils/index.js +1 -6
- package/esm/utils/index.js.map +1 -1
- package/lib/constants/Constants.js +13 -42
- package/lib/constants/Constants.js.flow +9 -41
- package/lib/constants/Constants.js.map +1 -1
- package/lib/constants/Settings.js +53 -1
- package/lib/constants/Settings.js.flow +60 -0
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useAuthentication.js +6 -5
- package/lib/hooks/useAuthentication.js.flow +9 -8
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +1 -1
- package/lib/models/application/ApplicationModel.js.flow +3 -2
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js +3 -12
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +3 -17
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/UploadAttributeModel.js +15 -3
- package/lib/models/attributes/UploadAttributeModel.js.flow +21 -0
- package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
- package/lib/models/error/ErrorModel.js +11 -0
- package/lib/models/error/ErrorModel.js.flow +12 -1
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/href/Href.js +6 -6
- package/lib/models/href/Href.js.flow +4 -4
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/__tests__/Href.spec.js.flow +2 -3
- package/lib/modularui/Authenticate.js +4 -4
- package/lib/modularui/Authenticate.js.flow +6 -5
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/CaptchaRequest.js +54 -0
- package/lib/modularui/CaptchaRequest.js.flow +45 -0
- package/lib/modularui/CaptchaRequest.js.map +1 -0
- package/lib/modularui/ModularUIRequest.js +46 -4
- package/lib/modularui/ModularUIRequest.js.flow +49 -10
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/UploadRequest.js +112 -0
- package/lib/modularui/UploadRequest.js.flow +125 -0
- package/lib/modularui/UploadRequest.js.map +1 -0
- package/lib/modularui/index.js +14 -0
- package/lib/modularui/index.js.flow +2 -0
- package/lib/modularui/index.js.map +1 -1
- package/lib/react-client/client.js +2 -2
- package/lib/react-client/client.js.flow +2 -2
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-server/contextPath.js +2 -2
- package/lib/react-server/contextPath.js.flow +2 -2
- package/lib/react-server/contextPath.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js +5 -4
- package/lib/react-server/renderSSRComplete.js.flow +6 -4
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js +2 -2
- package/lib/react-server/renderSSRMinimal.js.flow +2 -2
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +1 -0
- package/lib/react-server/serverNoSSR.js.flow +5 -0
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverUtil.js +32 -5
- package/lib/react-server/serverUtil.js.flow +40 -6
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +9 -1
- package/lib/redux/_modularui/ModularUIActions.js.flow +10 -0
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +21 -1
- package/lib/redux/_modularui/ModularUIReducer.js.flow +22 -0
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +9 -1
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/store/configureStore.js +1 -1
- package/lib/redux/store/configureStore.js.flow +1 -1
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.flow +2 -0
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/browser/Cookies.js +3 -3
- package/lib/utils/browser/Cookies.js.flow +10 -8
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/fetch/serverFetch.js +2 -2
- package/lib/utils/fetch/serverFetch.js.flow +2 -2
- package/lib/utils/fetch/serverFetch.js.map +1 -1
- package/lib/utils/fetch/types.js.flow +1 -1
- package/lib/utils/fetch/types.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js +3 -2
- package/lib/utils/fetch/universalFetch.js.flow +5 -3
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.flow +1 -1
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +0 -3
- package/lib/utils/helpers/checkResource.js.flow +0 -2
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/index.js +90 -0
- package/lib/utils/helpers/index.js.flow +8 -0
- package/lib/utils/helpers/index.js.map +1 -0
- package/lib/utils/helpers/repositoryResource.js +25 -0
- package/lib/utils/helpers/repositoryResource.js.flow +20 -0
- package/lib/utils/helpers/repositoryResource.js.map +1 -0
- package/lib/utils/index.js +4 -60
- package/lib/utils/index.js.flow +1 -6
- package/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/Constants.js +9 -41
- package/src/constants/Settings.js +60 -0
- package/src/hooks/useAuthentication.js +9 -8
- package/src/models/application/ApplicationModel.js +3 -2
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +3 -17
- package/src/models/attributes/UploadAttributeModel.js +21 -0
- package/src/models/error/ErrorModel.js +12 -1
- package/src/models/href/Href.js +4 -4
- package/src/models/href/__tests__/Href.spec.js +2 -3
- package/src/modularui/Authenticate.js +6 -5
- package/src/modularui/CaptchaRequest.js +45 -0
- package/src/modularui/ModularUIRequest.js +49 -10
- package/src/modularui/UploadRequest.js +125 -0
- package/src/modularui/index.js +2 -0
- package/src/react-client/client.js +2 -2
- package/src/react-server/contextPath.js +2 -2
- package/src/react-server/renderSSRComplete.js +6 -4
- package/src/react-server/renderSSRMinimal.js +2 -2
- package/src/react-server/serverNoSSR.js +5 -0
- package/src/react-server/serverUtil.js +40 -6
- package/src/redux/_modularui/ModularUIActions.js +10 -0
- package/src/redux/_modularui/ModularUIMiddleware.js +1 -1
- package/src/redux/_modularui/ModularUIReducer.js +22 -0
- package/src/redux/_modularui/types.js +9 -1
- package/src/redux/store/configureStore.js +1 -1
- package/src/redux/types.js +2 -0
- package/src/utils/browser/Cookies.js +10 -8
- package/src/utils/fetch/serverFetch.js +2 -2
- package/src/utils/fetch/types.js +1 -1
- package/src/utils/fetch/universalFetch.js +5 -3
- package/src/utils/fetch/xhr.js +1 -1
- package/src/utils/helpers/checkResource.js +0 -2
- package/src/utils/helpers/index.js +8 -0
- package/src/utils/helpers/repositoryResource.js +20 -0
- package/src/utils/index.js +1 -6
- package/types/constants/Constants.d.ts +8 -24
- package/types/constants/Settings.d.ts +12 -0
- package/types/models/attributes/ChoiceAttributeOptionCollection.d.ts +0 -3
- package/types/models/attributes/UploadAttributeModel.d.ts +6 -0
- package/types/models/error/ErrorModel.d.ts +5 -0
- package/types/models/href/Href.d.ts +1 -1
- package/types/modularui/CaptchaRequest.d.ts +17 -0
- package/types/modularui/ModularUIRequest.d.ts +13 -0
- package/types/modularui/UploadRequest.d.ts +29 -0
- package/types/modularui/index.d.ts +2 -0
- package/types/redux/_modularui/types.d.ts +9 -3
- package/types/redux/types.d.ts +1 -1
- package/types/utils/browser/Cookies.d.ts +0 -6
- package/types/utils/fetch/types.d.ts +2 -3
- package/types/utils/helpers/index.d.ts +7 -0
- package/types/utils/helpers/repositoryResource.d.ts +1 -0
- package/types/utils/index.d.ts +1 -6
|
@@ -36,6 +36,14 @@ export type SetModelAction = {
|
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
export type InitModelAction = {
|
|
40
|
+
type: "MODULARUI/INIT",
|
|
41
|
+
payload: Array<{
|
|
42
|
+
key: string,
|
|
43
|
+
model: ModularUIModel,
|
|
44
|
+
}>,
|
|
45
|
+
};
|
|
46
|
+
|
|
39
47
|
export type UpdateModelAction = {
|
|
40
48
|
type: "MODULARUI/UPDATE",
|
|
41
49
|
payload: ModularUIModel,
|
|
@@ -54,7 +62,7 @@ export type ModularUIAction = {
|
|
|
54
62
|
payload: {
|
|
55
63
|
href: Href,
|
|
56
64
|
method?: $Keys<HTTP_METHODS>,
|
|
57
|
-
data?:
|
|
65
|
+
data?: any,
|
|
58
66
|
locale: string,
|
|
59
67
|
childmodels?: boolean,
|
|
60
68
|
targetModel?: TargetModel,
|
package/src/redux/types.js
CHANGED
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
UpdateModelAction,
|
|
24
24
|
RemoveModelByKeyAction,
|
|
25
25
|
ResetModularUIAction,
|
|
26
|
+
InitModelAction,
|
|
26
27
|
} from "./_modularui/types";
|
|
27
28
|
import type {
|
|
28
29
|
RouterState,
|
|
@@ -135,6 +136,7 @@ export type UpdateAutosaveAction = {
|
|
|
135
136
|
export type ReduxAction =
|
|
136
137
|
| UpdateStatusAction
|
|
137
138
|
| SetModelAction
|
|
139
|
+
| InitModelAction
|
|
138
140
|
| UpdateModelAction
|
|
139
141
|
| RemoveModelByKeyAction
|
|
140
142
|
| ResetModularUIAction
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import Cookies from "js-cookie";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getBasePath } from "../../constants/Settings";
|
|
5
5
|
|
|
6
6
|
type CookieOptions = {
|
|
7
7
|
days?: number,
|
|
@@ -18,14 +18,18 @@ type CookieAttributes = {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
*/
|
|
21
|
-
const getCookie = (name: string): null | string => {
|
|
21
|
+
export const getCookie = (name: string): null | string => {
|
|
22
22
|
return Cookies.get(name);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
*/
|
|
27
|
-
const setCookie = (
|
|
28
|
-
|
|
27
|
+
export const setCookie = (
|
|
28
|
+
name: string,
|
|
29
|
+
value: any,
|
|
30
|
+
options?: CookieOptions
|
|
31
|
+
) => {
|
|
32
|
+
const attributes: CookieAttributes = { path: getBasePath() };
|
|
29
33
|
attributes.expires = options?.days;
|
|
30
34
|
attributes.sameSite = options?.sameSite ?? "Strict";
|
|
31
35
|
attributes.secure = options?.secure;
|
|
@@ -35,8 +39,6 @@ const setCookie = (name: string, value: any, options?: CookieOptions) => {
|
|
|
35
39
|
|
|
36
40
|
/**
|
|
37
41
|
*/
|
|
38
|
-
const clearCookie = (name: string) => {
|
|
39
|
-
Cookies.remove(name, { path:
|
|
42
|
+
export const clearCookie = (name: string) => {
|
|
43
|
+
Cookies.remove(name, { path: getBasePath() });
|
|
40
44
|
};
|
|
41
|
-
|
|
42
|
-
export { getCookie, setCookie, clearCookie };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { getBasePath } from "../../constants/Settings";
|
|
3
3
|
import { FetchException } from "../../exceptions";
|
|
4
4
|
|
|
5
5
|
import type { RequestOptions } from "./types";
|
|
@@ -11,7 +11,7 @@ export default function serverFetch(args: RequestOptions): Promise<any> {
|
|
|
11
11
|
// remove contextPath of url, when the request is internal the context path is not needed
|
|
12
12
|
const urlNoBase = args.url.includes("http")
|
|
13
13
|
? args.url
|
|
14
|
-
: args.url.replace(
|
|
14
|
+
: args.url.replace(getBasePath(), "");
|
|
15
15
|
const params = args.params
|
|
16
16
|
? args.params.replace("includeContext=true", "")
|
|
17
17
|
: "";
|
package/src/utils/fetch/types.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import { isPlainObject } from "../helpers/objects";
|
|
3
3
|
|
|
4
|
-
import { IS_SYNC
|
|
4
|
+
import { IS_SYNC } from "../../constants/Constants";
|
|
5
|
+
import { cacheContributions } from "../../constants";
|
|
6
|
+
|
|
5
7
|
import serverFetch from "./serverFetch";
|
|
6
8
|
import xhr from "./xhr";
|
|
7
9
|
import Cache from "../browser/Cache";
|
|
@@ -45,7 +47,7 @@ const waitForCachedItem = (cacheKey: string) => {
|
|
|
45
47
|
* @private
|
|
46
48
|
*/
|
|
47
49
|
const browserFetch = (args: RequestOptions) => {
|
|
48
|
-
if (
|
|
50
|
+
if (cacheContributions() && args.cache) {
|
|
49
51
|
const cacheKey = Cache.createResourceKey(args);
|
|
50
52
|
|
|
51
53
|
if (Cache.hasItem(cacheKey)) {
|
|
@@ -64,7 +66,7 @@ const browserFetch = (args: RequestOptions) => {
|
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
return xhr(args).then((response) => {
|
|
67
|
-
if (
|
|
69
|
+
if (cacheContributions() && args.cache) {
|
|
68
70
|
const cacheKey = Cache.createResourceKey(args);
|
|
69
71
|
|
|
70
72
|
Cache.addItem(cacheKey, response);
|
package/src/utils/fetch/xhr.js
CHANGED
|
@@ -11,8 +11,6 @@ import Href from "../../models/href/Href";
|
|
|
11
11
|
export const resourceExists = (url: string | Href): boolean => {
|
|
12
12
|
const fullUrl = new Href(url).absolutehref;
|
|
13
13
|
|
|
14
|
-
// const fullUrl = `${BASE}/${url}`.replace(/\/\//g, "/");
|
|
15
|
-
|
|
16
14
|
const xhr = new XMLHttpRequest();
|
|
17
15
|
xhr.open("HEAD", fullUrl, false);
|
|
18
16
|
xhr.setRequestHeader("Accept", "application/json");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { getBasePath, RESOURCE_PATH } from "../../constants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates an url to a resource in the Be Informed repository
|
|
6
|
+
* Only possible when serving using the UI Servlet of Be Informed
|
|
7
|
+
*/
|
|
8
|
+
export const getRepositoryResourceUrl = (resourceUrl: string): string => {
|
|
9
|
+
const basePath = getBasePath();
|
|
10
|
+
|
|
11
|
+
if (resourceUrl.startsWith(basePath)) {
|
|
12
|
+
return resourceUrl;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (resourceUrl.startsWith(RESOURCE_PATH)) {
|
|
16
|
+
return `${basePath}${resourceUrl}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return `${basePath}${RESOURCE_PATH}${resourceUrl}`;
|
|
20
|
+
};
|
package/src/utils/index.js
CHANGED
|
@@ -14,12 +14,7 @@ export { default as xhr } from "./fetch/xhr";
|
|
|
14
14
|
export type * from "./fetch/types";
|
|
15
15
|
|
|
16
16
|
// helpers
|
|
17
|
-
export * from "./helpers
|
|
18
|
-
export { default as createUUID } from "./helpers/createUUID";
|
|
19
|
-
export * from "./helpers/sanitizeHtml";
|
|
20
|
-
export * from "./helpers/objects";
|
|
21
|
-
export * from "./helpers/text";
|
|
22
|
-
export * from "./helpers/checkResource";
|
|
17
|
+
export * from "./helpers";
|
|
23
18
|
|
|
24
19
|
// number
|
|
25
20
|
export { default as DecimalFormat } from "./number/DecimalFormat";
|
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Indicates if contributions should be cached
|
|
3
|
-
*/
|
|
4
|
-
export const USE_CACHE: true;
|
|
5
|
-
/**
|
|
6
|
-
* Base path
|
|
7
|
-
* This uses contextPath set from property from server
|
|
8
|
-
* When requesting a remote server with CORS enabled, add the origin, for example:
|
|
9
|
-
* export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';
|
|
10
|
-
*/
|
|
11
|
-
export const BASE: string;
|
|
12
|
-
/**
|
|
13
|
-
* Path to the contributions api end point
|
|
14
|
-
* /contributions uri part is added through the _links in the data service
|
|
15
|
-
*/
|
|
16
|
-
export const MODULARUI_CONTRIBUTIONS: "/contributions";
|
|
17
|
-
/**
|
|
18
|
-
* Base Path
|
|
19
|
-
*/
|
|
20
|
-
export const APPLICATION_PATH: string;
|
|
21
1
|
/**
|
|
22
2
|
* path to content service
|
|
23
3
|
*/
|
|
24
|
-
export const CONTENT_PATH:
|
|
4
|
+
export const CONTENT_PATH: "/content";
|
|
25
5
|
/**
|
|
26
6
|
* Upload Path
|
|
27
7
|
*/
|
|
28
|
-
export const UPLOAD_PATH:
|
|
8
|
+
export const UPLOAD_PATH: "/uploadFile";
|
|
29
9
|
/**
|
|
30
10
|
* Captcha Path
|
|
31
11
|
*/
|
|
32
|
-
export const CAPTCHA_PATH:
|
|
12
|
+
export const CAPTCHA_PATH: "/captchaServices";
|
|
33
13
|
/**
|
|
34
14
|
* Path to change password page / component
|
|
35
15
|
*/
|
|
@@ -38,6 +18,10 @@ export const CHANGEPASSWORD_PATH: "/change-password";
|
|
|
38
18
|
* Path to user profile page / component
|
|
39
19
|
*/
|
|
40
20
|
export const USERPROFILE_PATH: "/user";
|
|
21
|
+
/**
|
|
22
|
+
* Path to resources in the Be Informed repository
|
|
23
|
+
*/
|
|
24
|
+
export const RESOURCE_PATH: "/resource";
|
|
41
25
|
/**
|
|
42
26
|
* Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment
|
|
43
27
|
*/
|
|
@@ -149,7 +133,7 @@ export const LOGIN_PATH_SETTING: "FormClient.login_url";
|
|
|
149
133
|
export const LOGIN_USERNAME_SETTING: "FormClient.username_field_name";
|
|
150
134
|
export const LOGIN_PASSWORD_SETTING: "FormClient.password_field_name";
|
|
151
135
|
export const LOGOUT_PATH_SETTING: "FormClient.logout_url";
|
|
152
|
-
export namespace
|
|
136
|
+
export namespace DEFAULT_AUTHENTICATION_TYPE {
|
|
153
137
|
const name: string;
|
|
154
138
|
const authentication: string;
|
|
155
139
|
const isPrimary: boolean;
|
|
@@ -4,6 +4,10 @@ export function setSetting(key: string, value: any): void;
|
|
|
4
4
|
export function allSettings(): {
|
|
5
5
|
[name: string]: Setting;
|
|
6
6
|
};
|
|
7
|
+
export function cacheContributions(): boolean;
|
|
8
|
+
export function getBasePath(): string;
|
|
9
|
+
export function getUploadPath(): string;
|
|
10
|
+
export function getCaptchaPath(): string;
|
|
7
11
|
export function hasAllContentInData(): boolean;
|
|
8
12
|
export function loginType(): string;
|
|
9
13
|
export function loginPath(): string;
|
|
@@ -12,5 +16,13 @@ export function loginPasswordField(): string;
|
|
|
12
16
|
export function logoutPath(): string;
|
|
13
17
|
export const LOGIN_PATH: string;
|
|
14
18
|
export const LOGOUT_PATH: string;
|
|
19
|
+
/**
|
|
20
|
+
* Model overview swim lane configuration
|
|
21
|
+
*/
|
|
22
|
+
export const getSwimLaneDiagramConfiguration: Object;
|
|
23
|
+
/**
|
|
24
|
+
* Backwards compatible export of BASE constant
|
|
25
|
+
*/
|
|
26
|
+
export const BASE: string;
|
|
15
27
|
type Setting = string | number | boolean | string[];
|
|
16
28
|
export {};
|
|
@@ -30,9 +30,6 @@ declare class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceA
|
|
|
30
30
|
/**
|
|
31
31
|
*/
|
|
32
32
|
addBooleanOption(code: "true" | "false", defaultLabel: string, data: string | Array<string>, options?: Array<Object>): void;
|
|
33
|
-
/**
|
|
34
|
-
*/
|
|
35
|
-
getDefaultValueForOption(value: any, contributions: Object): string;
|
|
36
33
|
/**
|
|
37
34
|
* Create two static options for true and false,
|
|
38
35
|
* there might be alternative labels configured for each option value
|
|
@@ -36,7 +36,13 @@ export default class UploadAttributeModel extends StringAttributeModel {
|
|
|
36
36
|
get uploadConstraints(): {
|
|
37
37
|
fileTypes: FiletypeConstraintsType;
|
|
38
38
|
maxFileSize: FilesizeConstraintsType;
|
|
39
|
+
acceptedFiles: Array<string>;
|
|
39
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Array of accepted file extensions and mime types.
|
|
43
|
+
* Convenience method for accept attribute of file input html control
|
|
44
|
+
*/
|
|
45
|
+
get acceptedFiles(): string[];
|
|
40
46
|
/**
|
|
41
47
|
*/
|
|
42
48
|
set files(arg: FilesType);
|
|
@@ -31,6 +31,11 @@ declare class ErrorModel {
|
|
|
31
31
|
/**
|
|
32
32
|
*/
|
|
33
33
|
get isMandatoryConstraint(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Returns a message object from the error
|
|
36
|
+
*/
|
|
37
|
+
getMessage(): MessageObject;
|
|
34
38
|
}
|
|
35
39
|
import { MessageParameters } from "../../i18n/types";
|
|
36
40
|
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
41
|
+
import { MessageObject } from "../../i18n/types";
|
|
@@ -141,7 +141,7 @@ declare class Href {
|
|
|
141
141
|
*/
|
|
142
142
|
setState(state: any): Href;
|
|
143
143
|
/**
|
|
144
|
-
* Retrieve the path combined with the
|
|
144
|
+
* Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed
|
|
145
145
|
*/
|
|
146
146
|
get absolutepath(): string;
|
|
147
147
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default CaptchaRequest;
|
|
2
|
+
/**
|
|
3
|
+
*/
|
|
4
|
+
declare class CaptchaRequest {
|
|
5
|
+
/**
|
|
6
|
+
*/
|
|
7
|
+
init(): Promise<CaptchaResponse>;
|
|
8
|
+
/**
|
|
9
|
+
*/
|
|
10
|
+
send(answer: string): Promise<CaptchaResponse>;
|
|
11
|
+
#private;
|
|
12
|
+
}
|
|
13
|
+
type CaptchaResponse = {
|
|
14
|
+
tokenId: string;
|
|
15
|
+
image: any;
|
|
16
|
+
valid: boolean;
|
|
17
|
+
};
|
|
@@ -11,6 +11,7 @@ declare class ModularUIRequest {
|
|
|
11
11
|
_href: Href;
|
|
12
12
|
_options: RequestModularUIOptions;
|
|
13
13
|
_targetModel: TargetModel | null;
|
|
14
|
+
_forceTargetModel: boolean;
|
|
14
15
|
_contributionsHref: string;
|
|
15
16
|
_locale: string;
|
|
16
17
|
_method: $Keys<{
|
|
@@ -69,6 +70,12 @@ declare class ModularUIRequest {
|
|
|
69
70
|
/**
|
|
70
71
|
*/
|
|
71
72
|
get withChildModels(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
*/
|
|
75
|
+
set forceTargetModel(arg: boolean);
|
|
76
|
+
/**
|
|
77
|
+
*/
|
|
78
|
+
get forceTargetModel(): boolean;
|
|
72
79
|
/**
|
|
73
80
|
*/
|
|
74
81
|
resolveModel(): Class<ModularUIModel>;
|
|
@@ -174,6 +181,12 @@ declare class ModularUIRequest {
|
|
|
174
181
|
* @returns {Promise<FormModel>}
|
|
175
182
|
*/
|
|
176
183
|
postForm(form: FormModel): Promise<FormModel>;
|
|
184
|
+
/**
|
|
185
|
+
* Simplified synchronous version of fetch (returns the model, not a Promise)
|
|
186
|
+
* This can be used on the server to retrieve a model. It only loads the request url and it's child models
|
|
187
|
+
*/
|
|
188
|
+
fetchSync(): ModularUIModel;
|
|
189
|
+
#private;
|
|
177
190
|
}
|
|
178
191
|
import ModularUIResponse from "./ModularUIResponse";
|
|
179
192
|
import Href from "../models/href/Href";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default UploadRequest;
|
|
2
|
+
/**
|
|
3
|
+
* Upload a file to the upload file service of Be Informed
|
|
4
|
+
*/
|
|
5
|
+
declare class UploadRequest {
|
|
6
|
+
constructor(uploadConstraints: {
|
|
7
|
+
fileTypes: FiletypeConstraintsType;
|
|
8
|
+
maxFileSize: FilesizeConstraintsType;
|
|
9
|
+
}, progressHandler: ProgressHandler);
|
|
10
|
+
/**
|
|
11
|
+
*/
|
|
12
|
+
getFileExtension(file: File): string;
|
|
13
|
+
/**
|
|
14
|
+
*/
|
|
15
|
+
isNotAllowedFileType(file: File): boolean;
|
|
16
|
+
/**
|
|
17
|
+
*/
|
|
18
|
+
exceedsMaxFileSize(file: File): boolean;
|
|
19
|
+
/**
|
|
20
|
+
*/
|
|
21
|
+
uploadFile(file: File): Promise<UploadResponse>;
|
|
22
|
+
#private;
|
|
23
|
+
}
|
|
24
|
+
type UploadResponse = {
|
|
25
|
+
token: string;
|
|
26
|
+
};
|
|
27
|
+
import { FiletypeConstraintsType } from "../models/types";
|
|
28
|
+
import { FilesizeConstraintsType } from "../models/types";
|
|
29
|
+
type ProgressHandler = (file: File, uploadInfo: Object) => void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as Authenticate } from "./Authenticate";
|
|
2
2
|
export { default as ModularUIRequest } from "./ModularUIRequest";
|
|
3
3
|
export { default as ModularUIResponse } from "./ModularUIResponse";
|
|
4
|
+
export { default as UploadRequest } from "./UploadRequest";
|
|
5
|
+
export { default as CaptchaRequest } from "./CaptchaRequest";
|
|
@@ -12,6 +12,13 @@ type SetModelAction = {
|
|
|
12
12
|
model: ModularUIModel;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
+
type InitModelAction = {
|
|
16
|
+
type: "MODULARUI/INIT";
|
|
17
|
+
payload: {
|
|
18
|
+
key: string;
|
|
19
|
+
model: ModularUIModel;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
15
22
|
type UpdateModelAction = {
|
|
16
23
|
type: "MODULARUI/UPDATE";
|
|
17
24
|
payload: ModularUIModel;
|
|
@@ -23,12 +30,11 @@ type ModularUIAction = {
|
|
|
23
30
|
payload: {
|
|
24
31
|
href: Href;
|
|
25
32
|
method?: $Keys<HTTP_METHODS>;
|
|
26
|
-
data?:
|
|
27
|
-
[key: string]: string;
|
|
28
|
-
};
|
|
33
|
+
data?: any;
|
|
29
34
|
locale: string;
|
|
30
35
|
childmodels?: boolean;
|
|
31
36
|
targetModel?: any;
|
|
37
|
+
forceTargetModel?: boolean;
|
|
32
38
|
successAction: (model: ModularUIModel) => SetModelAction | UpdateModelAction;
|
|
33
39
|
errorAction?: ErrorAction;
|
|
34
40
|
};
|
package/types/redux/types.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ type UpdateAutosaveAction = {
|
|
|
84
84
|
model: FormModel;
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
|
-
type ReduxAction = UpdateLocaleAction | SetLocalesAction | SetModelAction | UpdateModelAction | UpdateStatusAction | RemoveModelByKeyAction | NoAction | ModularUIAction | ResetModularUIAction | LocationChangeAction | PushAction | ReplaceAction | GoAction | GoBackAction | GoForwardAction | SaveErrorAction | ShowModalAction | CloseModalAction | DismissNotificationAction | ShowNotificationAction | SetPreferenceAction | SetPreferencesAction | StartProgressAction | FinishProgressAction | ResetProgressAction | UpdateProgressAction | SendAuthenticationErrorAction | ResetAuthErrorsAction | LoginSuccessAction | ChangePasswordAction | LogoutSuccessAction | UpdateAutosaveAction;
|
|
87
|
+
type ReduxAction = UpdateLocaleAction | SetLocalesAction | SetModelAction | InitModelAction | UpdateModelAction | UpdateStatusAction | RemoveModelByKeyAction | NoAction | ModularUIAction | ResetModularUIAction | LocationChangeAction | PushAction | ReplaceAction | GoAction | GoBackAction | GoForwardAction | SaveErrorAction | ShowModalAction | CloseModalAction | DismissNotificationAction | ShowNotificationAction | SetPreferenceAction | SetPreferencesAction | StartProgressAction | FinishProgressAction | ResetProgressAction | UpdateProgressAction | SendAuthenticationErrorAction | ResetAuthErrorsAction | LoginSuccessAction | ChangePasswordAction | LogoutSuccessAction | UpdateAutosaveAction;
|
|
88
88
|
type AuthState = {};
|
|
89
89
|
type ErrorState = ErrorResponse;
|
|
90
90
|
type ModalState = {};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*/
|
|
3
1
|
export function getCookie(name: string): null | string;
|
|
4
|
-
/**
|
|
5
|
-
*/
|
|
6
2
|
export function setCookie(name: string, value: any, options?: CookieOptions): void;
|
|
7
|
-
/**
|
|
8
|
-
*/
|
|
9
3
|
export function clearCookie(name: string): void;
|
|
10
4
|
type CookieOptions = {
|
|
11
5
|
days?: number;
|
|
@@ -4,9 +4,7 @@ type RequestURLOptions = {
|
|
|
4
4
|
type RequestBaseOptions = {
|
|
5
5
|
method?: $Keys<HTTP_METHODS>;
|
|
6
6
|
params?: string;
|
|
7
|
-
data?:
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
7
|
+
data?: any;
|
|
10
8
|
timeout?: number;
|
|
11
9
|
responseType?: string;
|
|
12
10
|
headers?: {
|
|
@@ -33,6 +31,7 @@ type RequestOptions = {
|
|
|
33
31
|
type RequestModularUIOptions = {
|
|
34
32
|
RequestBaseOptions: any;
|
|
35
33
|
targetModel?: any;
|
|
34
|
+
forceTargetModel?: boolean;
|
|
36
35
|
updateModel?: ModularUIModel;
|
|
37
36
|
childmodels?: boolean;
|
|
38
37
|
isValidationRequest?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getRepositoryResourceUrl(resourceUrl: string): string;
|
package/types/utils/index.d.ts
CHANGED
|
@@ -2,15 +2,10 @@ export { default as Cache } from "./browser/Cache";
|
|
|
2
2
|
export * from "./browser/Cookies";
|
|
3
3
|
export * from "./datetime/DateTimeUtil";
|
|
4
4
|
export * from "./fetch/types";
|
|
5
|
-
export * from "./helpers
|
|
6
|
-
export * from "./helpers/sanitizeHtml";
|
|
7
|
-
export * from "./helpers/objects";
|
|
8
|
-
export * from "./helpers/text";
|
|
9
|
-
export * from "./helpers/checkResource";
|
|
5
|
+
export * from "./helpers";
|
|
10
6
|
export * from "./number/parseNumbers";
|
|
11
7
|
export { default as serverFetch } from "./fetch/serverFetch";
|
|
12
8
|
export { default as universalFetch } from "./fetch/universalFetch";
|
|
13
9
|
export { default as xhr } from "./fetch/xhr";
|
|
14
|
-
export { default as createUUID } from "./helpers/createUUID";
|
|
15
10
|
export { default as DecimalFormat } from "./number/DecimalFormat";
|
|
16
11
|
export { default as formatValue } from "./number/formatValue";
|