@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.
Files changed (134) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/esm/constants/LayoutHintConfig.js +0 -9
  3. package/esm/constants/LayoutHintConfig.js.map +1 -1
  4. package/esm/constants/LayoutHints.js +0 -4
  5. package/esm/constants/LayoutHints.js.map +1 -1
  6. package/esm/constants/Settings.js +0 -4
  7. package/esm/constants/Settings.js.map +1 -1
  8. package/esm/hooks/useForm.js.map +1 -1
  9. package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
  10. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  11. package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -2
  12. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  13. package/esm/models/attributes/DatetimeAttributeModel.js +3 -29
  14. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  15. package/esm/react-client/Init.js +2 -2
  16. package/esm/react-client/Init.js.map +1 -1
  17. package/esm/react-client/client.js +80 -52
  18. package/esm/react-client/client.js.map +1 -1
  19. package/esm/redux/_modularui/ModularUIActions.js +7 -0
  20. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  21. package/esm/redux/_modularui/ModularUIReducer.js +1 -0
  22. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  23. package/esm/redux/_modularui/types.js.map +1 -1
  24. package/esm/redux/actions/Form.js +2 -2
  25. package/esm/redux/actions/Form.js.map +1 -1
  26. package/esm/redux/actions/FormAttributeSet.js +2 -2
  27. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  28. package/esm/redux/actions/FormAttributeSetRepeatable.js +4 -4
  29. package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  30. package/esm/redux/actions/FormAutosave.js +2 -2
  31. package/esm/redux/actions/FormAutosave.js.map +1 -1
  32. package/esm/redux/actions/FormValidations.js +2 -2
  33. package/esm/redux/actions/FormValidations.js.map +1 -1
  34. package/esm/redux/connectors/Form.js.map +1 -1
  35. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  36. package/esm/redux/store/configureStore.js +4 -4
  37. package/esm/redux/store/configureStore.js.map +1 -1
  38. package/esm/redux/types.js.map +1 -1
  39. package/lib/constants/LayoutHintConfig.js +0 -9
  40. package/lib/constants/LayoutHintConfig.js.flow +0 -9
  41. package/lib/constants/LayoutHintConfig.js.map +1 -1
  42. package/lib/constants/LayoutHints.js +2 -7
  43. package/lib/constants/LayoutHints.js.flow +0 -4
  44. package/lib/constants/LayoutHints.js.map +1 -1
  45. package/lib/constants/Settings.js +0 -4
  46. package/lib/constants/Settings.js.flow +0 -6
  47. package/lib/constants/Settings.js.map +1 -1
  48. package/lib/hooks/__tests__/useForm.spec.js.flow +4 -4
  49. package/lib/hooks/useForm.js.flow +5 -5
  50. package/lib/hooks/useForm.js.map +1 -1
  51. package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
  52. package/lib/models/attributes/ChoiceAttributeModel.js.flow +1 -0
  53. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  54. package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -2
  55. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +2 -2
  56. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  57. package/lib/models/attributes/DatetimeAttributeModel.js +3 -29
  58. package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -41
  59. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  60. package/lib/models/attributes/__tests__/DateAttributeModel.spec.js.flow +1 -35
  61. package/lib/models/attributes/__tests__/DatetimeAttributeModel.spec.js.flow +158 -216
  62. package/lib/models/attributes/__tests__/TimestampModel.spec.js.flow +0 -5
  63. package/lib/react-client/Init.js +2 -2
  64. package/lib/react-client/Init.js.flow +3 -3
  65. package/lib/react-client/Init.js.map +1 -1
  66. package/lib/react-client/client.js +83 -53
  67. package/lib/react-client/client.js.flow +106 -67
  68. package/lib/react-client/client.js.map +1 -1
  69. package/lib/redux/_modularui/ModularUIActions.js +9 -1
  70. package/lib/redux/_modularui/ModularUIActions.js.flow +8 -0
  71. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  72. package/lib/redux/_modularui/ModularUIReducer.js +1 -0
  73. package/lib/redux/_modularui/ModularUIReducer.js.flow +1 -0
  74. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  75. package/lib/redux/_modularui/types.js.flow +5 -0
  76. package/lib/redux/_modularui/types.js.map +1 -1
  77. package/lib/redux/actions/Form.js +1 -1
  78. package/lib/redux/actions/Form.js.flow +4 -4
  79. package/lib/redux/actions/Form.js.map +1 -1
  80. package/lib/redux/actions/FormAttributeSet.js +1 -1
  81. package/lib/redux/actions/FormAttributeSet.js.flow +3 -2
  82. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  83. package/lib/redux/actions/FormAttributeSetRepeatable.js +3 -3
  84. package/lib/redux/actions/FormAttributeSetRepeatable.js.flow +8 -8
  85. package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  86. package/lib/redux/actions/FormAutosave.js +1 -1
  87. package/lib/redux/actions/FormAutosave.js.flow +2 -2
  88. package/lib/redux/actions/FormAutosave.js.map +1 -1
  89. package/lib/redux/actions/FormValidations.js +1 -1
  90. package/lib/redux/actions/FormValidations.js.flow +2 -2
  91. package/lib/redux/actions/FormValidations.js.map +1 -1
  92. package/lib/redux/actions/__tests__/Form.spec.js.flow +1 -1
  93. package/lib/redux/connectors/Form.js.flow +2 -5
  94. package/lib/redux/connectors/Form.js.map +1 -1
  95. package/lib/redux/connectors/FormAttributeSet.js.flow +5 -5
  96. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  97. package/lib/redux/store/configureStore.js +4 -4
  98. package/lib/redux/store/configureStore.js.flow +5 -5
  99. package/lib/redux/store/configureStore.js.map +1 -1
  100. package/lib/redux/types.js.flow +2 -0
  101. package/lib/redux/types.js.map +1 -1
  102. package/package.json +17 -19
  103. package/src/constants/LayoutHintConfig.js +0 -9
  104. package/src/constants/LayoutHints.js +0 -4
  105. package/src/constants/Settings.js +0 -6
  106. package/src/hooks/__tests__/useForm.spec.js +4 -4
  107. package/src/hooks/useForm.js +5 -5
  108. package/src/models/attributes/ChoiceAttributeModel.js +1 -0
  109. package/src/models/attributes/ChoiceAttributeOptionModel.js +2 -2
  110. package/src/models/attributes/DatetimeAttributeModel.js +7 -41
  111. package/src/models/attributes/__tests__/DateAttributeModel.spec.js +1 -35
  112. package/src/models/attributes/__tests__/DatetimeAttributeModel.spec.js +158 -216
  113. package/src/models/attributes/__tests__/TimestampModel.spec.js +0 -5
  114. package/src/react-client/Init.js +3 -3
  115. package/src/react-client/client.js +106 -67
  116. package/src/redux/_modularui/ModularUIActions.js +8 -0
  117. package/src/redux/_modularui/ModularUIReducer.js +1 -0
  118. package/src/redux/_modularui/types.js +5 -0
  119. package/src/redux/actions/Form.js +4 -4
  120. package/src/redux/actions/FormAttributeSet.js +3 -2
  121. package/src/redux/actions/FormAttributeSetRepeatable.js +8 -8
  122. package/src/redux/actions/FormAutosave.js +2 -2
  123. package/src/redux/actions/FormValidations.js +2 -2
  124. package/src/redux/actions/__tests__/Form.spec.js +1 -1
  125. package/src/redux/connectors/Form.js +2 -5
  126. package/src/redux/connectors/FormAttributeSet.js +5 -5
  127. package/src/redux/store/configureStore.js +5 -5
  128. package/src/redux/types.js +2 -0
  129. package/types/constants/LayoutHintConfig.d.ts +8 -23
  130. package/types/constants/LayoutHints.d.ts +0 -4
  131. package/types/models/actions/ActionCollection.d.ts +1 -1
  132. package/types/models/attributes/DatetimeAttributeModel.d.ts +8 -2
  133. package/types/redux/_modularui/types.d.ts +4 -0
  134. package/types/redux/types.d.ts +1 -1
@@ -1,12 +1,5 @@
1
1
  // @flow
2
- /* polyfills needed for ie11 */
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 { ComponentType } from "react";
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
- const data = parseDataToJSON(dataElement.textContent);
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 { history, store } = configureStore(
112
+ const { routerHistory, store } = configureStore(
93
113
  browserHistory,
94
- props.customReducers ?? {},
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.error.response);
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
- history.listen((location, action) => {
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 (props.beforeRenderHooks) {
142
- handleBeforeRenderHooks(props.beforeRenderHooks, { store });
148
+ if (beforeRenderHooks) {
149
+ handleBeforeRenderHooks(beforeRenderHooks, { store });
143
150
  }
144
151
 
145
- addContentLoadedEvent(
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
- history: RouterHistory,
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 { updateModel } from "../_modularui/ModularUIActions";
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 { UpdateModelAction } from "../_modularui/types";
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): UpdateModelAction => {
17
+ export const previousObject = (form: FormModel): UpdateFormAction => {
18
18
  const newForm = form.clone();
19
19
 
20
20
  newForm.setPreviousObject();
21
21
 
22
- return updateModel(newForm);
22
+ return updateForm(newForm);
23
23
  };
24
24
 
25
25
  /**
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import { updateModel } from "../_modularui/ModularUIActions";
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
- return dispatch(updateModel(newForm));
71
+
72
+ return dispatch(updateForm(newForm));
72
73
  };
@@ -1,20 +1,20 @@
1
1
  // @flow
2
- import { updateModel } from "../_modularui/ModularUIActions";
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 { UpdateModelAction } from "../_modularui/types";
6
+ import type { UpdateFormAction } from "../_modularui/types";
7
7
 
8
8
  /**
9
9
  */
10
10
  export const addRepeatableAttributeSet = (
11
11
  form: FormModel
12
- ): UpdateModelAction => {
12
+ ): UpdateFormAction => {
13
13
  const newForm = form.clone();
14
14
 
15
15
  newForm.addEmptyFormObject();
16
16
 
17
- return updateModel(newForm);
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
- ): UpdateModelAction => {
25
+ ): UpdateFormAction => {
26
26
  const newForm = form.clone();
27
27
 
28
28
  newForm.addEmptyFormObject();
29
29
  newForm.removeFormObject(formObject);
30
30
 
31
- return updateModel(newForm);
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
- ): UpdateModelAction => {
39
+ ): UpdateFormAction => {
40
40
  const newForm = form.clone();
41
41
 
42
42
  newForm.removeFormObject(formObject);
43
43
 
44
- return updateModel(newForm);
44
+ return updateForm(newForm);
45
45
  };
@@ -10,7 +10,7 @@ import {
10
10
  AUTOSAVE_STATUS,
11
11
  } from "../../constants/Constants";
12
12
 
13
- import { updateModel } from "../_modularui/ModularUIActions";
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(updateModel(form));
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 { updateModel } from "../_modularui/ModularUIActions";
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(updateModel(validatedForm));
33
+ dispatch(updateForm(validatedForm));
34
34
  }
35
35
  };
36
36
 
@@ -15,7 +15,7 @@ describe("form actions", () => {
15
15
 
16
16
  expect(store.getActions()).toStrictEqual([
17
17
  {
18
- type: "MODULARUI/UPDATE",
18
+ type: "MODULARUI/UPDATE_FORM",
19
19
  payload: expect.objectContaining({
20
20
  _contributions: expect.objectContaining({
21
21
  label: "Create person",
@@ -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) => UpdateModelAction,
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 { UpdateModelAction } from "../_modularui/types";
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<UpdateModelAction> & DispatchAPI<ThunkAction>;
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: () => UpdateModelAction,
36
- onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateModelAction,
37
- onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateModelAction,
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
- history: RouterHistory,
23
+ routerHistory: RouterHistory,
24
24
  customReducers?: Object,
25
25
  initialState?: $Shape<ReduxState>
26
- ): { history: RouterHistory, store: ReduxStore } => {
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(history),
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(history.location, "PUSH"));
53
+ store.dispatch(locationChange(routerHistory.location, "PUSH"));
54
54
  }
55
- return { history, store };
55
+ return { routerHistory, store };
56
56
  };
57
57
 
58
58
  export default configureStore;
@@ -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 IGNORE_FORMAT_SETTING {
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 CREATE_ACTION {
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 UPDATE_ACTION {
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 DELETE_ACTION {
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 SORT_OPTIONS {
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 CASEVIEW_LINK {
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
  */
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export default class ActionCollection extends BaseCollection<ActionModel> {
5
5
  constructor(actions?: Object, actionsContributions?: Object);
6
- collection: any;
6
+ collection: any[];
7
7
  /**
8
8
  * Retrieve action by key
9
9
  */
@@ -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
  };