@beinformed/ui 1.27.5 → 1.28.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 +17 -1
- package/esm/constants/LayoutHintConfig.js +0 -9
- package/esm/constants/LayoutHintConfig.js.map +1 -1
- package/esm/constants/LayoutHints.js +0 -4
- package/esm/constants/LayoutHints.js.map +1 -1
- package/esm/constants/Settings.js +0 -4
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +3 -29
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/react-client/Init.js +2 -2
- package/esm/react-client/Init.js.map +1 -1
- package/esm/react-client/client.js +80 -52
- package/esm/react-client/client.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/ModularUIReducer.js +1 -0
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/actions/Form.js +2 -2
- package/esm/redux/actions/Form.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js +2 -2
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAttributeSetRepeatable.js +4 -4
- package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js +2 -2
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormValidations.js +2 -2
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/store/configureStore.js +4 -4
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/redux/types.js.map +1 -1
- package/lib/constants/LayoutHintConfig.js +0 -9
- package/lib/constants/LayoutHintConfig.js.flow +0 -9
- package/lib/constants/LayoutHintConfig.js.map +1 -1
- package/lib/constants/LayoutHints.js +2 -7
- package/lib/constants/LayoutHints.js.flow +0 -4
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js +0 -4
- package/lib/constants/Settings.js.flow +0 -6
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/__tests__/useForm.spec.js.flow +4 -4
- package/lib/hooks/useForm.js.flow +5 -5
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +2 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +3 -29
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -41
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/DateAttributeModel.spec.js.flow +1 -35
- package/lib/models/attributes/__tests__/DatetimeAttributeModel.spec.js.flow +158 -216
- package/lib/models/attributes/__tests__/TimestampModel.spec.js.flow +0 -5
- package/lib/react-client/Init.js +2 -2
- package/lib/react-client/Init.js.flow +3 -3
- package/lib/react-client/Init.js.map +1 -1
- package/lib/react-client/client.js +83 -53
- package/lib/react-client/client.js.flow +106 -67
- package/lib/react-client/client.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +9 -1
- package/lib/redux/_modularui/ModularUIActions.js.flow +8 -0
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +1 -0
- package/lib/redux/_modularui/ModularUIReducer.js.flow +1 -0
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +5 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/Form.js +1 -1
- package/lib/redux/actions/Form.js.flow +4 -4
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js +1 -1
- package/lib/redux/actions/FormAttributeSet.js.flow +3 -2
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js +3 -3
- package/lib/redux/actions/FormAttributeSetRepeatable.js.flow +8 -8
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js +1 -1
- package/lib/redux/actions/FormAutosave.js.flow +2 -2
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormValidations.js +1 -1
- package/lib/redux/actions/FormValidations.js.flow +2 -2
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/__tests__/Form.spec.js.flow +1 -1
- package/lib/redux/connectors/Form.js.flow +2 -5
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.flow +5 -5
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/store/configureStore.js +4 -4
- package/lib/redux/store/configureStore.js.flow +5 -5
- 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/package.json +17 -19
- package/src/constants/LayoutHintConfig.js +0 -9
- package/src/constants/LayoutHints.js +0 -4
- package/src/constants/Settings.js +0 -6
- package/src/hooks/__tests__/useForm.spec.js +4 -4
- package/src/hooks/useForm.js +5 -5
- package/src/models/attributes/ChoiceAttributeModel.js +1 -0
- package/src/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/src/models/attributes/DatetimeAttributeModel.js +7 -41
- package/src/models/attributes/__tests__/DateAttributeModel.spec.js +1 -35
- package/src/models/attributes/__tests__/DatetimeAttributeModel.spec.js +158 -216
- package/src/models/attributes/__tests__/TimestampModel.spec.js +0 -5
- package/src/react-client/Init.js +3 -3
- package/src/react-client/client.js +106 -67
- package/src/redux/_modularui/ModularUIActions.js +8 -0
- package/src/redux/_modularui/ModularUIReducer.js +1 -0
- package/src/redux/_modularui/types.js +5 -0
- package/src/redux/actions/Form.js +4 -4
- package/src/redux/actions/FormAttributeSet.js +3 -2
- package/src/redux/actions/FormAttributeSetRepeatable.js +8 -8
- package/src/redux/actions/FormAutosave.js +2 -2
- package/src/redux/actions/FormValidations.js +2 -2
- package/src/redux/actions/__tests__/Form.spec.js +1 -1
- package/src/redux/connectors/Form.js +2 -5
- package/src/redux/connectors/FormAttributeSet.js +5 -5
- package/src/redux/store/configureStore.js +5 -5
- package/src/redux/types.js +2 -0
- package/types/constants/LayoutHintConfig.d.ts +8 -23
- package/types/constants/LayoutHints.d.ts +0 -4
- package/types/models/actions/ActionCollection.d.ts +1 -1
- package/types/models/attributes/DatetimeAttributeModel.d.ts +8 -2
- package/types/redux/_modularui/types.d.ts +4 -0
- package/types/redux/types.d.ts +1 -1
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
|
|
3
|
-
import elementClosest from "element-closest";
|
|
4
|
-
elementClosest(window);
|
|
5
|
-
|
|
6
|
-
/* polyfill for focus-visible */
|
|
7
|
-
import "focus-visible";
|
|
8
|
-
|
|
9
|
-
import { hydrate, render as reactRender } from "react-dom";
|
|
2
|
+
import { hydrate, render } from "react-dom";
|
|
10
3
|
|
|
11
4
|
import { has } from "../utils/helpers/objects";
|
|
12
5
|
import setImmediate from "setimmediate";
|
|
@@ -36,12 +29,17 @@ import Init from "./Init";
|
|
|
36
29
|
|
|
37
30
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
38
31
|
|
|
39
|
-
import type {
|
|
32
|
+
import type {
|
|
33
|
+
ComponentType,
|
|
34
|
+
Element as ReactElement,
|
|
35
|
+
ElementType,
|
|
36
|
+
} from "react";
|
|
40
37
|
import type { Theme } from "../react-theme/types";
|
|
41
38
|
import type { CustomReducers, ReduxStore } from "../redux/types";
|
|
42
39
|
import type { RouterHistory } from "react-router";
|
|
43
40
|
import type { BeforeRenderHook } from "../redux/store/beforeRenderHooks";
|
|
44
41
|
import type { Props as FallbackProps } from "../react/ErrorBoundaryFallback";
|
|
42
|
+
|
|
45
43
|
export type Props = {
|
|
46
44
|
customReducers?: CustomReducers,
|
|
47
45
|
theme?: Theme | Array<Theme>,
|
|
@@ -53,8 +51,6 @@ export type Props = {
|
|
|
53
51
|
/*
|
|
54
52
|
* deserialize serialized data from the server to provide a smooth dehydration.
|
|
55
53
|
*/
|
|
56
|
-
/**
|
|
57
|
-
*/
|
|
58
54
|
const parseDataToJSON = (data: string) => {
|
|
59
55
|
try {
|
|
60
56
|
return JSON.parse(data);
|
|
@@ -63,24 +59,48 @@ const parseDataToJSON = (data: string) => {
|
|
|
63
59
|
}
|
|
64
60
|
};
|
|
65
61
|
|
|
66
|
-
|
|
67
|
-
* Mount the webapplication to the DOM, used client side when JavaScript is enabled.
|
|
68
|
-
*/
|
|
69
|
-
const client = (props: Props) => {
|
|
70
|
-
if (typeof window.contextPath === "undefined") {
|
|
71
|
-
throw new Error("Missing contextPath on window object");
|
|
72
|
-
}
|
|
73
|
-
|
|
62
|
+
const getDataFromServer = () => {
|
|
74
63
|
const dataElement = document.querySelector(
|
|
75
64
|
'script[type="application/json"][data-app-state="app-json"]'
|
|
76
65
|
);
|
|
66
|
+
|
|
77
67
|
if (!dataElement) {
|
|
78
68
|
throw new Error("Error loading state, json not found");
|
|
79
69
|
} else if (dataElement.textContent.trim() === "") {
|
|
80
|
-
return;
|
|
70
|
+
return {};
|
|
81
71
|
}
|
|
82
72
|
|
|
83
|
-
|
|
73
|
+
return parseDataToJSON(dataElement.textContent);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
*/
|
|
78
|
+
export const setUnhandledRejectionEvent = (store: ReduxStore) => {
|
|
79
|
+
window.onunhandledrejection = (event) => {
|
|
80
|
+
if (event.detail) {
|
|
81
|
+
return setImmediate(() => {
|
|
82
|
+
const errorMessage = event.detail.reason.message.toString();
|
|
83
|
+
|
|
84
|
+
store.dispatch(showXHRErrorNotification(errorMessage));
|
|
85
|
+
throw event.detail.reason;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return event;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
*/
|
|
95
|
+
export const setupClient = (
|
|
96
|
+
customReducers: CustomReducers = {},
|
|
97
|
+
beforeRenderHooks: ?Array<BeforeRenderHook>
|
|
98
|
+
): { store: ReduxStore, routerHistory: RouterHistory } => {
|
|
99
|
+
if (typeof window.contextPath === "undefined") {
|
|
100
|
+
throw new Error("Missing contextPath on window object");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const data = getDataFromServer();
|
|
84
104
|
|
|
85
105
|
// remove all resources from cache
|
|
86
106
|
Cache.clear("^res:");
|
|
@@ -89,9 +109,9 @@ const client = (props: Props) => {
|
|
|
89
109
|
const browserHistory: RouterHistory = createBrowserHistory({
|
|
90
110
|
basename: getBasePath(),
|
|
91
111
|
});
|
|
92
|
-
const {
|
|
112
|
+
const { routerHistory, store } = configureStore(
|
|
93
113
|
browserHistory,
|
|
94
|
-
|
|
114
|
+
customReducers,
|
|
95
115
|
rehydrate(data)
|
|
96
116
|
);
|
|
97
117
|
|
|
@@ -106,7 +126,7 @@ const client = (props: Props) => {
|
|
|
106
126
|
});
|
|
107
127
|
|
|
108
128
|
if (has(data, "error.name")) {
|
|
109
|
-
const error = new FetchException(data
|
|
129
|
+
const error = new FetchException(data?.error?.response);
|
|
110
130
|
store.dispatch(handleError(error));
|
|
111
131
|
}
|
|
112
132
|
|
|
@@ -115,74 +135,93 @@ const client = (props: Props) => {
|
|
|
115
135
|
}
|
|
116
136
|
|
|
117
137
|
// listen to history change and update the redux router store
|
|
118
|
-
|
|
138
|
+
routerHistory.listen((location, action) => {
|
|
119
139
|
store.dispatch(locationChange(location, action));
|
|
120
140
|
});
|
|
121
141
|
|
|
122
|
-
|
|
123
|
-
*/
|
|
124
|
-
window.onunhandledrejection = (event) => {
|
|
125
|
-
if (event.detail) {
|
|
126
|
-
return setImmediate(() => {
|
|
127
|
-
const errorMessage = event.detail.reason.message.toString();
|
|
128
|
-
|
|
129
|
-
store.dispatch(showXHRErrorNotification(errorMessage));
|
|
130
|
-
throw event.detail.reason;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return event;
|
|
135
|
-
};
|
|
142
|
+
setUnhandledRejectionEvent(store);
|
|
136
143
|
|
|
137
144
|
if (document.body) {
|
|
138
145
|
document.body.className = "js";
|
|
139
146
|
}
|
|
140
147
|
|
|
141
|
-
if (
|
|
142
|
-
handleBeforeRenderHooks(
|
|
148
|
+
if (beforeRenderHooks) {
|
|
149
|
+
handleBeforeRenderHooks(beforeRenderHooks, { store });
|
|
143
150
|
}
|
|
144
151
|
|
|
145
|
-
|
|
146
|
-
store,
|
|
147
|
-
history,
|
|
148
|
-
props.theme,
|
|
149
|
-
props.render,
|
|
150
|
-
props.ErrorFallbackComponent
|
|
151
|
-
);
|
|
152
|
+
return { store, routerHistory };
|
|
152
153
|
};
|
|
153
154
|
|
|
154
155
|
/**
|
|
155
156
|
*/
|
|
156
|
-
const addContentLoadedEvent = (
|
|
157
|
+
export const addContentLoadedEvent = (
|
|
157
158
|
store: ReduxStore,
|
|
158
|
-
|
|
159
|
+
routerHistory: RouterHistory,
|
|
159
160
|
theme?: Theme | Array<Theme>,
|
|
160
161
|
render: Function,
|
|
161
|
-
ErrorFallbackComponent?: ComponentType<FallbackProps
|
|
162
|
+
ErrorFallbackComponent?: ComponentType<FallbackProps>,
|
|
163
|
+
mount: Function
|
|
162
164
|
) => {
|
|
163
165
|
window.addEventListener("DOMContentLoaded", () => {
|
|
164
166
|
const applicationNode = document.querySelector("#application");
|
|
165
|
-
if (applicationNode) {
|
|
166
|
-
const isSSR = applicationNode.querySelector(".application");
|
|
167
|
-
const mount = isSSR ? hydrate : reactRender;
|
|
168
|
-
mount(
|
|
169
|
-
<Init
|
|
170
|
-
store={store}
|
|
171
|
-
history={history}
|
|
172
|
-
contextPath={window.contextPath}
|
|
173
|
-
theme={theme}
|
|
174
|
-
ErrorFallbackComponent={ErrorFallbackComponent}
|
|
175
|
-
>
|
|
176
|
-
{render()}
|
|
177
|
-
</Init>,
|
|
178
|
-
applicationNode
|
|
179
|
-
);
|
|
180
|
-
} else {
|
|
167
|
+
if (!applicationNode) {
|
|
181
168
|
throw new Error(
|
|
182
169
|
"No DOM element with id application found to attach client to"
|
|
183
170
|
);
|
|
184
171
|
}
|
|
172
|
+
|
|
173
|
+
mount(
|
|
174
|
+
applicationNode,
|
|
175
|
+
<Init
|
|
176
|
+
store={store}
|
|
177
|
+
routerHistory={routerHistory}
|
|
178
|
+
contextPath={window.contextPath}
|
|
179
|
+
theme={theme}
|
|
180
|
+
ErrorFallbackComponent={ErrorFallbackComponent}
|
|
181
|
+
>
|
|
182
|
+
{render()}
|
|
183
|
+
</Init>
|
|
184
|
+
);
|
|
185
185
|
});
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
+
/**
|
|
189
|
+
*/
|
|
190
|
+
const mountClient = (
|
|
191
|
+
applicationNode: Element,
|
|
192
|
+
initComponent: ReactElement<ElementType>
|
|
193
|
+
) => {
|
|
194
|
+
const isSSR = applicationNode.querySelector(".application");
|
|
195
|
+
if (isSSR) {
|
|
196
|
+
hydrate(initComponent, applicationNode);
|
|
197
|
+
} else {
|
|
198
|
+
render(initComponent, applicationNode);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.
|
|
204
|
+
*/
|
|
205
|
+
const client = ({
|
|
206
|
+
customReducers,
|
|
207
|
+
theme,
|
|
208
|
+
render,
|
|
209
|
+
beforeRenderHooks,
|
|
210
|
+
ErrorFallbackComponent,
|
|
211
|
+
}: Props) => {
|
|
212
|
+
const { store, routerHistory } = setupClient(
|
|
213
|
+
customReducers,
|
|
214
|
+
beforeRenderHooks
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
addContentLoadedEvent(
|
|
218
|
+
store,
|
|
219
|
+
routerHistory,
|
|
220
|
+
theme,
|
|
221
|
+
render,
|
|
222
|
+
ErrorFallbackComponent,
|
|
223
|
+
mountClient
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
|
|
188
227
|
export default client;
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
SetModelAction,
|
|
13
13
|
InitModelAction,
|
|
14
14
|
UpdateModelAction,
|
|
15
|
+
UpdateFormAction,
|
|
15
16
|
RemoveModelByKeyAction,
|
|
16
17
|
ResetModularUIAction,
|
|
17
18
|
UpdateStatusAction,
|
|
@@ -51,6 +52,13 @@ export const updateModel = (model: ModularUIModel): UpdateModelAction => ({
|
|
|
51
52
|
payload: model,
|
|
52
53
|
});
|
|
53
54
|
|
|
55
|
+
/**
|
|
56
|
+
*/
|
|
57
|
+
export const updateForm = (model: ModularUIModel): UpdateFormAction => ({
|
|
58
|
+
type: "MODULARUI/UPDATE_FORM",
|
|
59
|
+
payload: model,
|
|
60
|
+
});
|
|
61
|
+
|
|
54
62
|
/**
|
|
55
63
|
*/
|
|
56
64
|
export const removeModelByKey = (key: string): RemoveModelByKeyAction => ({
|
|
@@ -144,6 +144,7 @@ export const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (
|
|
|
144
144
|
return setModel(state, action.payload);
|
|
145
145
|
|
|
146
146
|
case "MODULARUI/UPDATE":
|
|
147
|
+
case "MODULARUI/UPDATE_FORM":
|
|
147
148
|
return updateModel(state, action.payload);
|
|
148
149
|
|
|
149
150
|
case "MODULARUI/REMOVE_KEY":
|
|
@@ -49,6 +49,11 @@ export type UpdateModelAction = {
|
|
|
49
49
|
payload: ModularUIModel,
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
export type UpdateFormAction = {
|
|
53
|
+
type: "MODULARUI/UPDATE_FORM",
|
|
54
|
+
payload: ModularUIModel,
|
|
55
|
+
};
|
|
56
|
+
|
|
52
57
|
export type SuccessAction = (
|
|
53
58
|
model: ModularUIModel
|
|
54
59
|
) => UpdateModelAction | SetModelAction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import { goBack } from "../_router/RouterActions";
|
|
3
|
-
import {
|
|
3
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
4
4
|
import { logoutSuccess } from "./SignOut";
|
|
5
5
|
import { reloadApplication } from "./Application";
|
|
6
6
|
import { startProgress, finishProgress } from "./ProgressIndicator";
|
|
@@ -9,17 +9,17 @@ import Authenticate from "../../modularui/Authenticate";
|
|
|
9
9
|
|
|
10
10
|
import type { Dispatch, GetState, ThunkAction } from "../types";
|
|
11
11
|
import type FormModel from "../../models/form/FormModel";
|
|
12
|
-
import type {
|
|
12
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Go back to previous object (back button on form)
|
|
16
16
|
*/
|
|
17
|
-
export const previousObject = (form: FormModel):
|
|
17
|
+
export const previousObject = (form: FormModel): UpdateFormAction => {
|
|
18
18
|
const newForm = form.clone();
|
|
19
19
|
|
|
20
20
|
newForm.setPreviousObject();
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return updateForm(newForm);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
3
3
|
|
|
4
4
|
import { getSetting } from "../../constants/Settings";
|
|
5
5
|
|
|
@@ -68,5 +68,6 @@ export const updateFormAttribute =
|
|
|
68
68
|
// server form validations happens async, don't wait for the form to return
|
|
69
69
|
dispatch(validateFormObject(newForm));
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
return dispatch(updateForm(newForm));
|
|
72
73
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
3
3
|
|
|
4
4
|
import type FormModel from "../../models/form/FormModel";
|
|
5
5
|
import type FormObjectModel from "../../models/form/FormObjectModel";
|
|
6
|
-
import type {
|
|
6
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*/
|
|
10
10
|
export const addRepeatableAttributeSet = (
|
|
11
11
|
form: FormModel
|
|
12
|
-
):
|
|
12
|
+
): UpdateFormAction => {
|
|
13
13
|
const newForm = form.clone();
|
|
14
14
|
|
|
15
15
|
newForm.addEmptyFormObject();
|
|
16
16
|
|
|
17
|
-
return
|
|
17
|
+
return updateForm(newForm);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -22,13 +22,13 @@ export const addRepeatableAttributeSet = (
|
|
|
22
22
|
export const cancelRepeatableAttributeSet = (
|
|
23
23
|
form: FormModel,
|
|
24
24
|
formObject: FormObjectModel
|
|
25
|
-
):
|
|
25
|
+
): UpdateFormAction => {
|
|
26
26
|
const newForm = form.clone();
|
|
27
27
|
|
|
28
28
|
newForm.addEmptyFormObject();
|
|
29
29
|
newForm.removeFormObject(formObject);
|
|
30
30
|
|
|
31
|
-
return
|
|
31
|
+
return updateForm(newForm);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -36,10 +36,10 @@ export const cancelRepeatableAttributeSet = (
|
|
|
36
36
|
export const removeRepeatableAttributeSet = (
|
|
37
37
|
form: FormModel,
|
|
38
38
|
formObject: FormObjectModel
|
|
39
|
-
):
|
|
39
|
+
): UpdateFormAction => {
|
|
40
40
|
const newForm = form.clone();
|
|
41
41
|
|
|
42
42
|
newForm.removeFormObject(formObject);
|
|
43
43
|
|
|
44
|
-
return
|
|
44
|
+
return updateForm(newForm);
|
|
45
45
|
};
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
AUTOSAVE_STATUS,
|
|
11
11
|
} from "../../constants/Constants";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
14
14
|
|
|
15
15
|
import type { UpdateAutosaveAction, ThunkAction, Dispatch } from "../types";
|
|
16
16
|
|
|
@@ -49,7 +49,7 @@ const autosave = (dispatch: Dispatch, form: FormModel) => {
|
|
|
49
49
|
// send the existing form to prevent updates in the ui based on autosave results
|
|
50
50
|
form.lastServerUpdate = savedForm.lastServerUpdate;
|
|
51
51
|
|
|
52
|
-
dispatch(
|
|
52
|
+
dispatch(updateForm(form));
|
|
53
53
|
dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));
|
|
54
54
|
}
|
|
55
55
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import debounce from "lodash/debounce";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
5
5
|
|
|
6
6
|
import ModularUIRequest from "../../modularui/ModularUIRequest";
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ const updateValidations =
|
|
|
30
30
|
validatedForm.updateValidations(formWithValidations.data);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
dispatch(
|
|
33
|
+
dispatch(updateForm(validatedForm));
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -16,10 +16,7 @@ import type { AbstractComponent } from "react";
|
|
|
16
16
|
import type FormModel from "../../models/form/FormModel";
|
|
17
17
|
import type { ContextRouter } from "react-router";
|
|
18
18
|
import type { ReduxState, ThunkAction } from "../types";
|
|
19
|
-
import type {
|
|
20
|
-
ModularUIConnector,
|
|
21
|
-
UpdateModelAction,
|
|
22
|
-
} from "../_modularui/types";
|
|
19
|
+
import type { ModularUIConnector, UpdateFormAction } from "../_modularui/types";
|
|
23
20
|
|
|
24
21
|
type OwnProps = {
|
|
25
22
|
...?ContextRouter,
|
|
@@ -33,7 +30,7 @@ type StateProps = {
|
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
type DispatchProps = {
|
|
36
|
-
onPrevious: (form: FormModel) =>
|
|
33
|
+
onPrevious: (form: FormModel) => UpdateFormAction,
|
|
37
34
|
onCancel: (form: FormModel) => ThunkAction,
|
|
38
35
|
showFormNotification: (form: FormModel) => ThunkAction,
|
|
39
36
|
};
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
} from "../actions/FormAttributeSetRepeatable";
|
|
10
10
|
|
|
11
11
|
import type { ThunkAction, UpdateFormOptions } from "../types";
|
|
12
|
-
import type {
|
|
12
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
13
13
|
import type { AttributeType } from "../../models/types";
|
|
14
14
|
import type FormModel from "../../models/form/FormModel";
|
|
15
15
|
import type FormObjectModel from "../../models/form/FormObjectModel";
|
|
16
16
|
import type { DispatchAPI } from "redux";
|
|
17
17
|
import type { ComponentType } from "react";
|
|
18
18
|
|
|
19
|
-
type Dispatch = DispatchAPI<
|
|
19
|
+
type Dispatch = DispatchAPI<UpdateFormAction> & DispatchAPI<ThunkAction>;
|
|
20
20
|
|
|
21
21
|
type OwnProps = {
|
|
22
22
|
form: FormModel,
|
|
@@ -32,9 +32,9 @@ type DispatchProps = {
|
|
|
32
32
|
value: string,
|
|
33
33
|
options: UpdateFormOptions
|
|
34
34
|
) => ThunkAction,
|
|
35
|
-
onAddAttributeSetClick: () =>
|
|
36
|
-
onCancelAttributeSetClick: (formObject: FormObjectModel) =>
|
|
37
|
-
onRemoveAttributeSetClick: (formObject: FormObjectModel) =>
|
|
35
|
+
onAddAttributeSetClick: () => UpdateFormAction,
|
|
36
|
+
onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
|
|
37
|
+
onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
type Props = {
|
|
@@ -20,10 +20,10 @@ import type { Reducer } from "redux";
|
|
|
20
20
|
/**
|
|
21
21
|
*/
|
|
22
22
|
const configureStore = (
|
|
23
|
-
|
|
23
|
+
routerHistory: RouterHistory,
|
|
24
24
|
customReducers?: Object,
|
|
25
25
|
initialState?: $Shape<ReduxState>
|
|
26
|
-
): {
|
|
26
|
+
): { routerHistory: RouterHistory, store: ReduxStore } => {
|
|
27
27
|
let composeEnhancers = compose;
|
|
28
28
|
|
|
29
29
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
@@ -37,7 +37,7 @@ const configureStore = (
|
|
|
37
37
|
|
|
38
38
|
const middleware = applyMiddleware(
|
|
39
39
|
modularUIMiddleware,
|
|
40
|
-
routerMiddleware(
|
|
40
|
+
routerMiddleware(routerHistory),
|
|
41
41
|
thunk
|
|
42
42
|
);
|
|
43
43
|
|
|
@@ -50,9 +50,9 @@ const configureStore = (
|
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
if (!initialState?.router) {
|
|
53
|
-
store.dispatch(locationChange(
|
|
53
|
+
store.dispatch(locationChange(routerHistory.location, "PUSH"));
|
|
54
54
|
}
|
|
55
|
-
return {
|
|
55
|
+
return { routerHistory, store };
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export default configureStore;
|
package/src/redux/types.js
CHANGED
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
UpdateStatusAction,
|
|
22
22
|
SetModelAction,
|
|
23
23
|
UpdateModelAction,
|
|
24
|
+
UpdateFormAction,
|
|
24
25
|
RemoveModelByKeyAction,
|
|
25
26
|
ResetModularUIAction,
|
|
26
27
|
InitModelAction,
|
|
@@ -138,6 +139,7 @@ export type ReduxAction =
|
|
|
138
139
|
| SetModelAction
|
|
139
140
|
| InitModelAction
|
|
140
141
|
| UpdateModelAction
|
|
142
|
+
| UpdateFormAction
|
|
141
143
|
| RemoveModelByKeyAction
|
|
142
144
|
| ResetModularUIAction
|
|
143
145
|
| SaveErrorAction
|
|
@@ -143,7 +143,7 @@ export namespace LayoutHintConfiguration {
|
|
|
143
143
|
const component_9: string[];
|
|
144
144
|
export { component_9 as component };
|
|
145
145
|
}
|
|
146
|
-
namespace
|
|
146
|
+
namespace CREATE_ACTION {
|
|
147
147
|
const hint_10: string;
|
|
148
148
|
export { hint_10 as hint };
|
|
149
149
|
export namespace description_10 {
|
|
@@ -153,12 +153,10 @@ export namespace LayoutHintConfiguration {
|
|
|
153
153
|
export { EN_10 as EN };
|
|
154
154
|
}
|
|
155
155
|
export { description_10 as description };
|
|
156
|
-
const link_10: string;
|
|
157
|
-
export { link_10 as link };
|
|
158
156
|
const component_10: string[];
|
|
159
157
|
export { component_10 as component };
|
|
160
158
|
}
|
|
161
|
-
namespace
|
|
159
|
+
namespace UPDATE_ACTION {
|
|
162
160
|
const hint_11: string;
|
|
163
161
|
export { hint_11 as hint };
|
|
164
162
|
export namespace description_11 {
|
|
@@ -171,7 +169,7 @@ export namespace LayoutHintConfiguration {
|
|
|
171
169
|
const component_11: string[];
|
|
172
170
|
export { component_11 as component };
|
|
173
171
|
}
|
|
174
|
-
namespace
|
|
172
|
+
namespace DELETE_ACTION {
|
|
175
173
|
const hint_12: string;
|
|
176
174
|
export { hint_12 as hint };
|
|
177
175
|
export namespace description_12 {
|
|
@@ -184,7 +182,7 @@ export namespace LayoutHintConfiguration {
|
|
|
184
182
|
const component_12: string[];
|
|
185
183
|
export { component_12 as component };
|
|
186
184
|
}
|
|
187
|
-
namespace
|
|
185
|
+
namespace SORT_OPTIONS {
|
|
188
186
|
const hint_13: string;
|
|
189
187
|
export { hint_13 as hint };
|
|
190
188
|
export namespace description_13 {
|
|
@@ -197,7 +195,7 @@ export namespace LayoutHintConfiguration {
|
|
|
197
195
|
const component_13: string[];
|
|
198
196
|
export { component_13 as component };
|
|
199
197
|
}
|
|
200
|
-
namespace
|
|
198
|
+
namespace CASEVIEW_LINK {
|
|
201
199
|
const hint_14: string;
|
|
202
200
|
export { hint_14 as hint };
|
|
203
201
|
export namespace description_14 {
|
|
@@ -210,7 +208,7 @@ export namespace LayoutHintConfiguration {
|
|
|
210
208
|
const component_14: string[];
|
|
211
209
|
export { component_14 as component };
|
|
212
210
|
}
|
|
213
|
-
namespace
|
|
211
|
+
namespace DISABLED {
|
|
214
212
|
const hint_15: string;
|
|
215
213
|
export { hint_15 as hint };
|
|
216
214
|
export namespace description_15 {
|
|
@@ -220,22 +218,9 @@ export namespace LayoutHintConfiguration {
|
|
|
220
218
|
export { EN_15 as EN };
|
|
221
219
|
}
|
|
222
220
|
export { description_15 as description };
|
|
221
|
+
const link_10: string;
|
|
222
|
+
export { link_10 as link };
|
|
223
223
|
const component_15: string[];
|
|
224
224
|
export { component_15 as component };
|
|
225
225
|
}
|
|
226
|
-
namespace DISABLED {
|
|
227
|
-
const hint_16: string;
|
|
228
|
-
export { hint_16 as hint };
|
|
229
|
-
export namespace description_16 {
|
|
230
|
-
const NL_16: string;
|
|
231
|
-
export { NL_16 as NL };
|
|
232
|
-
const EN_16: string;
|
|
233
|
-
export { EN_16 as EN };
|
|
234
|
-
}
|
|
235
|
-
export { description_16 as description };
|
|
236
|
-
const link_11: string;
|
|
237
|
-
export { link_11 as link };
|
|
238
|
-
const component_16: string[];
|
|
239
|
-
export { component_16 as component };
|
|
240
|
-
}
|
|
241
226
|
}
|
|
@@ -26,10 +26,6 @@ export const SORT_OPTIONS: string;
|
|
|
26
26
|
* Layout-hint: Marks an attribute as a title attribute
|
|
27
27
|
*/
|
|
28
28
|
export const TITLE: string;
|
|
29
|
-
/**
|
|
30
|
-
* Layout-hint: Ignore the global input format for specific attribute
|
|
31
|
-
*/
|
|
32
|
-
export const IGNORE_FORMAT_SETTING: string;
|
|
33
29
|
/**
|
|
34
30
|
* Layout-hint: Mark task as delete task
|
|
35
31
|
*/
|
|
@@ -5,7 +5,8 @@ declare class DatetimeAttributeModel extends StringAttributeModel {
|
|
|
5
5
|
/**
|
|
6
6
|
*/
|
|
7
7
|
get formatUtil(): {
|
|
8
|
-
_isoFormat: string;
|
|
8
|
+
_isoFormat: string; /**
|
|
9
|
+
*/
|
|
9
10
|
getLocale(): Locale;
|
|
10
11
|
getOptions(): {
|
|
11
12
|
weekStartsOn: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
@@ -26,7 +27,9 @@ declare class DatetimeAttributeModel extends StringAttributeModel {
|
|
|
26
27
|
isSameDay(inputDate: string, compareDate: string, inputFormat?: string): boolean;
|
|
27
28
|
isOther(inputDate: string, compareDate: string, inputFormat?: string): boolean;
|
|
28
29
|
isWeekend(inputDate: string): boolean;
|
|
29
|
-
addSeconds(date: string, amount: number): string;
|
|
30
|
+
addSeconds(date: string, amount: number): string; /**
|
|
31
|
+
* Set placeholder text
|
|
32
|
+
*/
|
|
30
33
|
addMinutes(date: string, amount: number): string;
|
|
31
34
|
addHours(date: string, amount: number): string;
|
|
32
35
|
addDays(date: string, amount: number): string;
|
|
@@ -51,6 +54,9 @@ declare class DatetimeAttributeModel extends StringAttributeModel {
|
|
|
51
54
|
setHour(date: string, hour: number): string;
|
|
52
55
|
setMinute(date: string, minute: number): string;
|
|
53
56
|
setSecond(date: string, second: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* Add Date constraints for attribute
|
|
59
|
+
*/
|
|
54
60
|
setMilliseconds(date: string, milliseconds: number): string;
|
|
55
61
|
setTime(date: string, hours: number, minutes: number, seconds: number, milliseconds: number): string;
|
|
56
62
|
};
|