@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;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["elementClosest","window","parseDataToJSON","data","JSON","parse","error","JsonParseException","client","props","contextPath","Error","dataElement","document","querySelector","textContent","Cache","clear","browserHistory","createBrowserHistory","basename","getBasePath","history","store","configureStore","customReducers","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","dispatch","loginSuccess","has","FetchException","response","handleError","listen","location","action","locationChange","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","showXHRErrorNotification","body","className","beforeRenderHooks","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","addEventListener","applicationNode","isSSR","mount","hydrate","reactRender"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n/* polyfills needed for ie11 */\nimport elementClosest from \"element-closest\";\nelementClosest(window);\n\n/* polyfill for focus-visible */\nimport \"focus-visible\";\n\nimport { hydrate, render as reactRender } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath } from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport Init from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type { ComponentType } from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\n/**\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, used client side when JavaScript is enabled.\n */\nconst client = (props: Props) => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]'\n );\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return;\n }\n\n const data = parseDataToJSON(dataElement.textContent);\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { history, store } = configureStore(\n browserHistory,\n props.customReducers ?? {},\n rehydrate(data)\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data.error.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n history.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n /**\n */\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (props.beforeRenderHooks) {\n handleBeforeRenderHooks(props.beforeRenderHooks, { store });\n }\n\n addContentLoadedEvent(\n store,\n history,\n props.theme,\n props.render,\n props.ErrorFallbackComponent\n );\n};\n\n/**\n */\nconst addContentLoadedEvent = (\n store: ReduxStore,\n history: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (applicationNode) {\n const isSSR = applicationNode.querySelector(\".application\");\n const mount = isSSR ? hydrate : reactRender;\n mount(\n <Init\n store={store}\n history={history}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n applicationNode\n );\n } else {\n throw new Error(\n \"No DOM element with id application found to attach client to\"\n );\n }\n });\n};\n\nexport default client;\n"],"mappings":";;;;;;;;AAEA;AAIA;AAEA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AAEA;AAIA;AAEA;AACA;AAEA;AAEA;AAEA;AAEA;AAA2E;AAnC3E;AAEA,IAAAA,uBAAc,EAACC,MAAM,CAAC;;AAEtB;;AA+CA;AACA;AACA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,CAAC;EAC7D;EAEAgC,qBAAqB,CACnBhC,KAAK,EACLD,OAAO,EACPb,KAAK,CAAC+C,KAAK,EACX/C,KAAK,CAACgD,MAAM,EACZhD,KAAK,CAACiD,sBAAsB,CAC7B;AACH,CAAC;;AAED;AACA;AACA,MAAMH,qBAAqB,GAAG,CAC5BhC,KAAiB,EACjBD,OAAsB,EACtBkC,KAA4B,EAC5BC,MAAgB,EAChBC,sBAAqD,KAClD;EACHzD,MAAM,CAAC0D,gBAAgB,CAAC,kBAAkB,EAAE,MAAM;IAChD,MAAMC,eAAe,GAAG/C,QAAQ,CAACC,aAAa,CAAC,cAAc,CAAC;IAC9D,IAAI8C,eAAe,EAAE;MACnB,MAAMC,KAAK,GAAGD,eAAe,CAAC9C,aAAa,CAAC,cAAc,CAAC;MAC3D,MAAMgD,KAAK,GAAGD,KAAK,GAAGE,iBAAO,GAAGC,gBAAW;MAC3CF,KAAK,eACH,qBAAC,aAAI;QACH,KAAK,EAAEvC,KAAM;QACb,OAAO,EAAED,OAAQ;QACjB,WAAW,EAAErB,MAAM,CAACS,WAAY;QAChC,KAAK,EAAE8C,KAAM;QACb,sBAAsB,EAAEE,sBAAuB;QAAA,UAE9CD,MAAM;MAAE,EACJ,EACPG,eAAe,CAChB;IACH,CAAC,MAAM;MACL,MAAM,IAAIjD,KAAK,CACb,8DAA8D,CAC/D;IACH;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,eAEaH,MAAM;AAAA"}
1
+ {"version":3,"file":"client.js","names":["parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","dataElement","document","querySelector","Error","textContent","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","setupClient","customReducers","beforeRenderHooks","contextPath","Cache","clear","browserHistory","createBrowserHistory","basename","getBasePath","routerHistory","configureStore","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","loginSuccess","has","FetchException","response","handleError","listen","location","action","locationChange","body","className","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","mountClient","initComponent","isSSR","hydrate","client"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath } from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport Init from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]'\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data)\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: Function\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\"\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n initComponent: ReactElement<ElementType>\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(initComponent, applicationNode);\n } else {\n render(initComponent, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nconst client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mountClient\n );\n};\n\nexport default client;\n"],"mappings":";;;;;;;;AACA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AAEA;AAIA;AAEA;AACA;AAEA;AAEA;AAEA;AAEA;AAA2E;AAqB3E;AACA;AACA;AACA,MAAMA,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIC,8BAAkB,CAAE,yBAAwBJ,IAAK,EAAC,CAAC;EAC/D;AACF,CAAC;AAED,MAAMK,iBAAiB,GAAG,MAAM;EAAA;EAC9B,MAAMC,WAAW,GAAGC,QAAQ,CAACC,aAAa,CACxC,4DAA4D,CAC7D;EAED,IAAI,CAACF,WAAW,EAAE;IAChB,MAAM,IAAIG,KAAK,CAAC,qCAAq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,KAAe,KACZ;EACH7C,MAAM,CAAC8C,gBAAgB,CAAC,kBAAkB,EAAE,MAAM;IAChD,MAAMC,eAAe,GAAGrD,QAAQ,CAACC,aAAa,CAAC,cAAc,CAAC;IAC9D,IAAI,CAACoD,eAAe,EAAE;MACpB,MAAM,IAAInD,KAAK,CACb,8DAA8D,CAC/D;IACH;IAEAiD,KAAK,CACHE,eAAe,eACf,qBAAC,aAAI;MACH,KAAK,EAAEhD,KAAM;MACb,aAAa,EAAEsB,aAAc;MAC7B,WAAW,EAAErB,MAAM,CAACc,WAAY;MAChC,KAAK,EAAE4B,KAAM;MACb,sBAAsB,EAAEE,sBAAuB;MAAA,UAE9CD,MAAM;IAAE,EACJ,CACR;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AADA;AAEA,MAAMK,WAAW,GAAG,CAClBD,eAAwB,EACxBE,aAAwC,KACrC;EACH,MAAMC,KAAK,GAAGH,eAAe,CAACpD,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIuD,KAAK,EAAE;IACT,IAAAC,iBAAO,EAACF,aAAa,EAAEF,eAAe,CAAC;EACzC,CAAC,MAAM;IACL,IAAAJ,gBAAM,EAACM,aAAa,EAAEF,eAAe,CAAC;EACxC;AACF,CAAC;;AAED;AACA;AACA;AACA,MAAMK,MAAM,GAAG,QAMF;EAAA,IANG;IACdxC,cAAc;IACd8B,KAAK;IACLC,MAAM;IACN9B,iBAAiB;IACjB+B;EACK,CAAC;EACN,MAAM;IAAE7C,KAAK;IAAEsB;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdC,iBAAiB,CAClB;EAED4B,qBAAqB,CACnB1C,KAAK,EACLsB,aAAa,EACbqB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBI,WAAW,CACZ;AACH,CAAC;AAAC,eAEaI,MAAM;AAAA"}
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.updateStatus = exports.updateModel = exports.setModel = exports.resetModularUI = exports.removeModelByKey = exports.reloadModel = exports.loadModularUI = exports.loadModel = exports.initModels = void 0;
7
+ exports.updateStatus = exports.updateModel = exports.updateForm = exports.setModel = exports.resetModularUI = exports.removeModelByKey = exports.reloadModel = exports.loadModularUI = exports.loadModel = exports.initModels = void 0;
8
8
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
9
9
  var _Constants = require("../../constants/Constants");
10
10
  var _Href = _interopRequireDefault(require("../../models/href/Href"));
@@ -44,6 +44,14 @@ const updateModel = model => ({
44
44
  /**
45
45
  */
46
46
  exports.updateModel = updateModel;
47
+ const updateForm = model => ({
48
+ type: "MODULARUI/UPDATE_FORM",
49
+ payload: model
50
+ });
51
+
52
+ /**
53
+ */
54
+ exports.updateForm = updateForm;
47
55
  const removeModelByKey = key => ({
48
56
  type: "MODULARUI/REMOVE_KEY",
49
57
  payload: key
@@ -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 => ({
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIActions.js","names":["setModel","key","model","connectKey","type","payload","initModels","models","updateModel","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate: ?ModularUIModel\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA;AACA;AACA;AACA;AACA;AAeA;AACA;AACO,MAAMA,QAAQ,GAAG,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADA;AAEO,MAAMI,UAAU,GACrBC,MAAqD,KAChC;EACrBH,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEE;AACX,CAAC,CAAC;;AAEF;AACA;AADA;AAEO,MAAMC,WAAW,GAAIN,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AADA;AAEO,MAAMO,gBAAgB,GAAIR,GAAW,KAA8B;EACxEG,IAAI,EAAE,sBAAsB;EAC5BC,OAAO,EAAEJ;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AAFA;AAGO,MAAMS,cAAc,GAAG,OAA6B;EACzDN,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AADA;AAEO,MAAMO,YAAY,GAAG,CAC1BV,GAAW,EACXW,MAAsC,MACd;EACxBR,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAE;IAAEJ,GAAG;IAAEW;EAAO;AACzB,CAAC,CAAC;;AAEF;AACA;AADA;AAEA,MAAMC,sBAAsB,GAAG,CAC7BZ,GAAW,EACXC,KAAqB,EACrBY,aAA8B,KACS;EACvC,IAAIA,aAAa,EAAE;IACjB;IACA,IAAI,OAAOA,aAAa,CAAC,QAAQ,CAAC,KAAK,UAAU,EAAE;MACjD,MAAMC,WAAW,GAAGD,aAAa,CAACE,KAAK,EAAE;MACzCD,WAAW,CAACE,MAAM,CAACf,KAAK,CAAC;MAEzB,OAAOM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GAAW,EACXmB,IAAmB,EACnBC,OAAiC,KAElCoB,QAAkB,IAAK;EACtBA,QAAQ,CAAC9B,YAAY,CAACV,GAAG,EAAEqC,2BAAgB,CAACI,OAAO,CAAC,CAAC;EACrDD,QAAQ,CAAC,IAAAE,gCAAa,GAAE,CAAC;EAEzB,MAAMC,gBAAgB,GAAGH,QAAQ,CAACtB,SAAS,CAAClB,GAAG,EAAEmB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAO,iBAAQwB,OAAO,CAACD,gBAAgB,CAAC,CACrCE,IAAI,CAAEC,QAAQ,IAAK;IAClB,IAAIA,QAAQ,EAAE3C,IAAI,KAAK,iBAAiB,EAAE;MACxCqC,QAAQ,CAAC9B,YAAY,CAACV,GAAG,EAAEqC,2BAAgB,CAACU,QAAQ,CAAC,CAAC;IACxD;IAEA,OAAOP,QAAQ,CAAC,IAAAQ,iCAAc,GAAE,CAAC;EACnC,CAAC,CAAC,CACDC,KAAK,CAAEjB,KAAK,IAAKQ,QAAQ,CAAC,IAAAU,kBAAW,EAAClB,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AADA;AAEO,MAAMmB,WAAW,GAAG,CACzBlD,KAAqB,EACrBmB,OAAiC,KAEjCmB,aAAa,CAACtC,KAAK,CAACC,UAAU,EAAED,KAAK,CAACmD,QAAQ,EAAE;EAC9C,GAAGhC,OAAO;EACViC,QAAQ,EAAE;AACZ,CAAC,CAAC;AAAC"}
1
+ {"version":3,"file":"ModularUIActions.js","names":["setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate: ?ModularUIModel\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n): ThunkAction =>\n loadModular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AAG,EAAEsC,2BAAgB,CAACC,KAAK,CAAC;IAClD;EACF;AACF,CAAC,CAAC;;AAEF;AACA;AADA;AAEO,MAAMC,aAAa,GACxB,CACExC,GAAW,EACXoB,IAAmB,EACnBC,OAAiC,KAElCoB,QAAkB,IAAK;EACtBA,QAAQ,CAAC9B,YAAY,CAACX,GAAG,EAAEsC,2BAAgB,CAACI,OAAO,CAAC,CAAC;EACrDD,QAAQ,CAAC,IAAAE,gCAAa,GAAE,CAAC;EAEzB,MAAMC,gBAAgB,GAAGH,QAAQ,CAACtB,SAAS,CAACnB,GAAG,EAAEoB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAO,iBAAQwB,OAAO,CAACD,gBAAgB,CAAC,CACrCE,IAAI,CAAEC,QAAQ,IAAK;IAClB,IAAIA,QAAQ,EAAE5C,IAAI,KAAK,iBAAiB,EAAE;MACxCsC,QAAQ,CAAC9B,YAAY,CAACX,GAAG,EAAEsC,2BAAgB,CAACU,QAAQ,CAAC,CAAC;IACxD;IAEA,OAAOP,QAAQ,CAAC,IAAAQ,iCAAc,GAAE,CAAC;EACnC,CAAC,CAAC,CACDC,KAAK,CAAEjB,KAAK,IAAKQ,QAAQ,CAAC,IAAAU,kBAAW,EAAClB,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AADA;AAEO,MAAMmB,WAAW,GAAG,CACzBnD,KAAqB,EACrBoB,OAAiC,KAEjCmB,aAAa,CAACvC,KAAK,CAACC,UAAU,EAAED,KAAK,CAACoD,QAAQ,EAAE;EAC9C,GAAGhC,OAAO;EACViC,QAAQ,EAAE;AACZ,CAAC,CAAC;AAAC"}
@@ -139,6 +139,7 @@ const ModularUIReducer = function () {
139
139
  case "MODULARUI/SET":
140
140
  return setModel(state, action.payload);
141
141
  case "MODULARUI/UPDATE":
142
+ case "MODULARUI/UPDATE_FORM":
142
143
  return updateModel(state, action.payload);
143
144
  case "MODULARUI/REMOVE_KEY":
144
145
  return removeKey(action.payload, state);
@@ -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":
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIReducer.js","names":["updateStatus","state","key","status","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","model","IllegalArgumentException","initModularUI","models","newState","forEach","FINISHED","getModelKey","connectKey","updateModel","modelKey","Error","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","action","type","payload"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../../exceptions\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n { key, status }: { key: string, status: $Keys<typeof MODULARUI_STATUS> }\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel }\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n },\n };\n }\n\n throw new IllegalArgumentException(\"No model for setModel\");\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n throw new Error(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`\n );\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA;AACA;AACA;AAOA;AACA;AACA,MAAMA,YAAY,GAAG,CACnBC,KAAqB,WAElB;EAAA,IADH;IAAEC,GAAG;IAAEC;EAAgE,CAAC;EAExE;EACA,IAAIA,MAAM,KAAKC,2BAAgB,CAACC,OAAO,IAAI,CAACJ,KAAK,CAACC,GAAG,CAAC,EAAE;IACtD,OA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OAAOhB,aAAa,CAACX,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAE7C,KAAK,iBAAiB;MACpB,OAAON,cAAc,CAACtB,KAAK,CAAC;IAE9B,KAAK,kBAAkB;MACrB,OAAOD,YAAY,CAACC,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAE5C,KAAK,eAAe;MAClB,OAAOpB,QAAQ,CAACR,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAExC,KAAK,kBAAkB;MACrB,OAAOV,WAAW,CAAClB,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAE3C,KAAK,sBAAsB;MACzB,OAAOP,SAAS,CAACK,MAAM,CAACE,OAAO,EAAE5B,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAAC;AAEnB,CAAC;AAAC"}
1
+ {"version":3,"file":"ModularUIReducer.js","names":["updateStatus","state","key","status","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","model","IllegalArgumentException","initModularUI","models","newState","forEach","FINISHED","getModelKey","connectKey","updateModel","modelKey","Error","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","action","type","payload"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../../exceptions\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n { key, status }: { key: string, status: $Keys<typeof MODULARUI_STATUS> }\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel }\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n },\n };\n }\n\n throw new IllegalArgumentException(\"No model for setModel\");\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n throw new Error(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`\n );\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA;AACA;AACA;AAOA;AACA;AACA,MAAMA,YAAY,GAAG,CACnBC,KAAqB,WAElB;EAAA,IADH;IAAEC,GAAG;IAAEC;EAAgE,CAAC;EAExE;EACA,IAAIA,MAAM,KAAKC,2BAAgB,CAACC,OAAO,IAAI,CAACJ,KAAK,CAACC,GAAG,CAAC,EAAE;IACtD,OAAOD,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACC,GAAG,GAAG;MACL,GAAGD,KAAK,CAACC,GAAG,CAAC;MACbC,MAAM;MACNG,gBAAgB,EAAEC,IAAI,CAACC,GAAG;IAC5B;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMC,QAAQ,GAAG,CACfR,KAAqB,YAElB;EAAA,IADH;IAAEC,GAAG;IAAEQ;EAA+C,CAAC;EAEvD,IAAI,CAACT,KAAK,CAACC,GAAG,CAAC,EAAE;IACf,OAAOD,KAAK;EACd;EAEA,IAAIS,KAAK,EAAE;IACT,OAAO;MACL,GAAGT,KAAK;MACR,CAACC,GAAG,GAAG;QACL,GAAGD,KAAK,CAACC,GAAG,CAAC;QACbQ,KAAK;QACLJ,gBAAgB,EAAEC,IAAI,CAACC,GAAG;MAC5B;IACF,CAAC;EACH;EAEA,MAAM,IAAIG,oCAAwB,CAAC,uBAAuB,CAAC;AAC7D,CAAC;;AAED;AACA;AACA,MAAMC,aAAa,GAAG,CACpBX,KAAqB,EACrBY,MAAqD,KAClD;EACH,MAAMC,QAAQ,GAAG,qBAAc,CAAC,CAAC,EAAEb,KAAK,CAAC;EAEzCY,MAAM,CAACE,OAAO,CAAC,SAAoB;IAAA,IAAnB;MAAEb,GAAG;MAAEQ;IAAM,CAAC;IAC5BI,QAAQ,CAACZ,GAAG,CAAC,GAAG;MACdC,MAAM,EAAEC,2BAAgB,CAACY,QAAQ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,GAAG;MAAE,CAAC;IACnC;EACF;EAEA,OAAOY,QAAQ;AACjB,CAAC;AAED,MAAMW,YAA4B,GAAG,CAAC,CAAC;;AAEvC;AACA;AACA;AACO,MAAMC,gBAAsD,GAAG,YAGjE;EAAA,IAFHzB,KAAK,uEAAGwB,YAAY;EAAA,IACpBE,MAAM;EAEN,IAAI,CAACA,MAAM,EAAE;IACX,OAAO1B,KAAK;EACd;EAEA,QAAQ0B,MAAM,CAACC,IAAI;IACjB,KAAK,gBAAgB;MACnB,OAAOhB,aAAa,CAACX,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAE7C,KAAK,iBAAiB;MACpB,OAAON,cAAc,CAACtB,KAAK,CAAC;IAE9B,KAAK,kBAAkB;MACrB,OAAOD,YAAY,CAACC,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAE5C,KAAK,eAAe;MAClB,OAAOpB,QAAQ,CAACR,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAExC,KAAK,kBAAkB;IACvB,KAAK,uBAAuB;MAC1B,OAAOV,WAAW,CAAClB,KAAK,EAAE0B,MAAM,CAACE,OAAO,CAAC;IAE3C,KAAK,sBAAsB;MACzB,OAAOP,SAAS,CAACK,MAAM,CAACE,OAAO,EAAE5B,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAAC;AAEnB,CAAC;AAAC"}
@@ -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 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n successAction: (\n model: ModularUIModel\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>\n) => ComponentType<any>;\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n successAction: (\n model: ModularUIModel\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>\n) => ComponentType<any>;\n"],"mappings":""}
@@ -17,7 +17,7 @@ var _Authenticate = _interopRequireDefault(require("../../modularui/Authenticate
17
17
  const previousObject = form => {
18
18
  const newForm = form.clone();
19
19
  newForm.setPreviousObject();
20
- return (0, _ModularUIActions.updateModel)(newForm);
20
+ return (0, _ModularUIActions.updateForm)(newForm);
21
21
  };
22
22
 
23
23
  /**
@@ -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 +1 @@
1
- {"version":3,"file":"Form.js","names":["previousObject","form","newForm","clone","setPreviousObject","updateModel","cancelForm","dispatch","getState","key","auth","mustChangePassword","startProgress","Authenticate","logout","then","logoutSuccess","reloadApplication","finishProgress","goBack"],"sources":["../../../src/redux/actions/Form.js"],"sourcesContent":["// @flow\nimport { goBack } from \"../_router/RouterActions\";\nimport { updateModel } from \"../_modularui/ModularUIActions\";\nimport { logoutSuccess } from \"./SignOut\";\nimport { reloadApplication } from \"./Application\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\n\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { UpdateModelAction } from \"../_modularui/types\";\n\n/**\n * Go back to previous object (back button on form)\n */\nexport const previousObject = (form: FormModel): UpdateModelAction => {\n const newForm = form.clone();\n\n newForm.setPreviousObject();\n\n return updateModel(newForm);\n};\n\n/**\n */\nexport const cancelForm =\n (form: FormModel): ThunkAction =>\n (dispatch: Dispatch, getState: GetState) => {\n if (form.key === \"ChangePassword\" && getState().auth.mustChangePassword) {\n dispatch(startProgress());\n return new Authenticate().logout().then(() => {\n dispatch(logoutSuccess());\n dispatch(reloadApplication());\n dispatch(finishProgress());\n\n return dispatch(goBack());\n });\n }\n\n return dispatch(goBack());\n };\n"],"mappings":";;;;;;;AACA;AACA;AACA;AACA;AACA;AAEA;AAMA;AACA;AACA;AACO,MAAMA,cAAc,GAAIC,IAAe,IAAwB;EACpE,MAAMC,OAAO,GAAGD,IAAI,CAACE,KAAK,EAAE;EAE5BD,OAAO,CAACE,iBAAiB,EAAE;EAE3B,OAAO,IAAAC,6BAAW,EAACH,OAAO,CAAC;AAC7B,CAAC;;AAED;AACA;AADA;AAEO,MAAMI,UAAU,GACpBL,IAAe,IAChB,CAACM,QAAkB,EAAEC,QAAkB,KAAK;EAC1C,IAAIP,IAAI,CAACQ,GAAG,KAAK,gBAAgB,IAAID,QAAQ,EAAE,CAACE,IAAI,CAACC,kBAAkB,EAAE;IACvEJ,QAAQ,CAAC,IAAAK,gCAAa,GAAE,CAAC;IACzB,OAAO,IAAIC,qBAAY,EAAE,CAACC,MAAM,EAAE,CAACC,IAAI,CAAC,MAAM;MAC5CR,QAAQ,CAAC,IAAAS,sBAAa,GAAE,CAAC;MACzBT,QAAQ,CAAC,IAAAU,8BAAiB,GAAE,CAAC;MAC7BV,QAAQ,CAAC,IAAAW,iCAAc,GAAE,CAAC;MAE1B,OAAOX,QAAQ,CAAC,IAAAY,qBAAM,GAAE,CAAC;IAC3B,CAAC,CAAC;EACJ;EAEA,OAAOZ,QAAQ,CAAC,IAAAY,qBAAM,GAAE,CAAC;AAC3B,CAAC;AAAC"}
1
+ {"version":3,"file":"Form.js","names":["previousObject","form","newForm","clone","setPreviousObject","updateForm","cancelForm","dispatch","getState","key","auth","mustChangePassword","startProgress","Authenticate","logout","then","logoutSuccess","reloadApplication","finishProgress","goBack"],"sources":["../../../src/redux/actions/Form.js"],"sourcesContent":["// @flow\nimport { goBack } from \"../_router/RouterActions\";\nimport { updateForm } from \"../_modularui/ModularUIActions\";\nimport { logoutSuccess } from \"./SignOut\";\nimport { reloadApplication } from \"./Application\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\n\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { UpdateFormAction } from \"../_modularui/types\";\n\n/**\n * Go back to previous object (back button on form)\n */\nexport const previousObject = (form: FormModel): UpdateFormAction => {\n const newForm = form.clone();\n\n newForm.setPreviousObject();\n\n return updateForm(newForm);\n};\n\n/**\n */\nexport const cancelForm =\n (form: FormModel): ThunkAction =>\n (dispatch: Dispatch, getState: GetState) => {\n if (form.key === \"ChangePassword\" && getState().auth.mustChangePassword) {\n dispatch(startProgress());\n return new Authenticate().logout().then(() => {\n dispatch(logoutSuccess());\n dispatch(reloadApplication());\n dispatch(finishProgress());\n\n return dispatch(goBack());\n });\n }\n\n return dispatch(goBack());\n };\n"],"mappings":";;;;;;;AACA;AACA;AACA;AACA;AACA;AAEA;AAMA;AACA;AACA;AACO,MAAMA,cAAc,GAAIC,IAAe,IAAuB;EACnE,MAAMC,OAAO,GAAGD,IAAI,CAACE,KAAK,EAAE;EAE5BD,OAAO,CAACE,iBAAiB,EAAE;EAE3B,OAAO,IAAAC,4BAAU,EAACH,OAAO,CAAC;AAC5B,CAAC;;AAED;AACA;AADA;AAEO,MAAMI,UAAU,GACpBL,IAAe,IAChB,CAACM,QAAkB,EAAEC,QAAkB,KAAK;EAC1C,IAAIP,IAAI,CAACQ,GAAG,KAAK,gBAAgB,IAAID,QAAQ,EAAE,CAACE,IAAI,CAACC,kBAAkB,EAAE;IACvEJ,QAAQ,CAAC,IAAAK,gCAAa,GAAE,CAAC;IACzB,OAAO,IAAIC,qBAAY,EAAE,CAACC,MAAM,EAAE,CAACC,IAAI,CAAC,MAAM;MAC5CR,QAAQ,CAAC,IAAAS,sBAAa,GAAE,CAAC;MACzBT,QAAQ,CAAC,IAAAU,8BAAiB,GAAE,CAAC;MAC7BV,QAAQ,CAAC,IAAAW,iCAAc,GAAE,CAAC;MAE1B,OAAOX,QAAQ,CAAC,IAAAY,qBAAM,GAAE,CAAC;IAC3B,CAAC,CAAC;EACJ;EAEA,OAAOZ,QAAQ,CAAC,IAAAY,qBAAM,GAAE,CAAC;AAC3B,CAAC;AAAC"}
@@ -46,7 +46,7 @@ const updateFormAttribute = function (form, formObject, attribute, inputvalue) {
46
46
  // server form validations happens async, don't wait for the form to return
47
47
  dispatch((0, _FormValidations.validateFormObject)(newForm));
48
48
  }
49
- return dispatch((0, _ModularUIActions.updateModel)(newForm));
49
+ return dispatch((0, _ModularUIActions.updateForm)(newForm));
50
50
  };
51
51
  };
52
52
  exports.updateFormAttribute = updateFormAttribute;
@@ -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 +1 @@
1
- {"version":3,"file":"FormAttributeSet.js","names":["updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","undefined","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","autosubmitFormObject","isChanged","autosaveFormObject","hasDynamicValidations","getSetting","validateFormObject","updateModel"],"sources":["../../../src/redux/actions/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { updateModel } from \"../_modularui/ModularUIActions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false,\n forceUpdate: false,\n validate: true,\n }\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (newForm.currentFormObject?.equals(formObject)) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n\n if (\n options.validate &&\n newForm.currentFormObject?.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n // server form validations happens async, don't wait for the form to return\n dispatch(validateFormObject(newForm));\n }\n return dispatch(updateModel(newForm));\n };\n"],"mappings":";;;;;;AACA;AAEA;AAEA;AACA;AACA;AAOA;AACA;AACA;AACO,MAAMA,mBAAmB,GAC9B,UACEC,IAAe,EACfC,UAA2B,EAC3BC,SAAwB,EACxBC,UAAkB;EAAA,IAClBC,OAA0B,uEAAG;IAC3BC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE,KAAK;IACfC,WAAW,EAAE,KAAK;IAClBC,QAAQ,EAAE;EACZ,CAAC;EAAA,OAEFC,QAAkB,IAAK;IACtB,MAAMC,OAAO,GAAGV,IAAI,CAACW,KAAK,EAAE;IAE5B,IAAIP,OAAO,CAACI,QAAQ,KAAKI,SAAS,EAAE;MAClCR,OAAO,CAACI,QAAQ,GAAG,IAAI;IACzB;IAEA,IAAIE,OAAO,CAACG,iBAAiB,EAAEC,MAAM,CAACb,UAAU,CAAC,EAAE;MACjDS,OAAO,CAACG,iBAAiB,CAACE,eAAe,CAACb,SAAS,EAAEC,UAAU,CAAC;IAClE,CAAC,MAAM;MACLO,OAAO,CAACM,oBAAoB,CAACC,OAAO,CAAEC,cAAc,IAAK;QACvD,IAAIA,cAAc,CAACJ,MAAM,CAACb,UAAU,CAAC,EAAE;UACrCiB,cAAc,CAACH,eAAe,CAACb,SAAS,EAAEC,UAAU,CAAC;QACvD;MACF,CAAC,CAAC;IACJ;IAEA,IAAIC,OAAO,CAACC,UAAU,IAAIK,OAAO,CAACS,OAAO,EAAE;MACzC,MAAMC,gBAAgB,GAAG,IAAAC,oCAAoB,EAC3CX,OAAO,EACPR,SAAS,EACTE,OAAO,CAACG,WAAW,CACpB;MACD,IAAIa,gBAAgB,EAAE;QACpB,OAAOX,QAAQ,CAACW,gBAAgB,CAAC;MACnC;IACF;IAEA,IAAIhB,OAAO,CAACE,QAAQ,IAAII,OAAO,CAACS,OAAO,IAAIT,OAAO,CAACY,SAAS,EAAE,EAAE;MAC9Db,QAAQ,CAAC,IAAAc,gCAAkB,EAACb,OAAO,CAAC,CAAC;IACvC;IAEA,IACEN,OAAO,CAACI,QAAQ,IAChBE,OAAO,CAACG,iBAAiB,EAAEW,qBAAqB,IAChD,IAAAC,oBAAU,EAAC,+BAA+B,CAAC,EAC3C;MACA;MACAhB,QAAQ,CAAC,IAAAiB,mCAAkB,EAAChB,OAAO,CAAC,CAAC;IACvC;IACA,OAAOD,QAAQ,CAAC,IAAAkB,6BAAW,EAACjB,OAAO,CAAC,CAAC;EACvC,CAAC;AAAA;AAAC"}
1
+ {"version":3,"file":"FormAttributeSet.js","names":["updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","undefined","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","autosubmitFormObject","isChanged","autosaveFormObject","hasDynamicValidations","getSetting","validateFormObject","updateForm"],"sources":["../../../src/redux/actions/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false,\n forceUpdate: false,\n validate: true,\n }\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (newForm.currentFormObject?.equals(formObject)) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n\n if (\n options.validate &&\n newForm.currentFormObject?.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n // server form validations happens async, don't wait for the form to return\n dispatch(validateFormObject(newForm));\n }\n\n return dispatch(updateForm(newForm));\n };\n"],"mappings":";;;;;;AACA;AAEA;AAEA;AACA;AACA;AAOA;AACA;AACA;AACO,MAAMA,mBAAmB,GAC9B,UACEC,IAAe,EACfC,UAA2B,EAC3BC,SAAwB,EACxBC,UAAkB;EAAA,IAClBC,OAA0B,uEAAG;IAC3BC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE,KAAK;IACfC,WAAW,EAAE,KAAK;IAClBC,QAAQ,EAAE;EACZ,CAAC;EAAA,OAEFC,QAAkB,IAAK;IACtB,MAAMC,OAAO,GAAGV,IAAI,CAACW,KAAK,EAAE;IAE5B,IAAIP,OAAO,CAACI,QAAQ,KAAKI,SAAS,EAAE;MAClCR,OAAO,CAACI,QAAQ,GAAG,IAAI;IACzB;IAEA,IAAIE,OAAO,CAACG,iBAAiB,EAAEC,MAAM,CAACb,UAAU,CAAC,EAAE;MACjDS,OAAO,CAACG,iBAAiB,CAACE,eAAe,CAACb,SAAS,EAAEC,UAAU,CAAC;IAClE,CAAC,MAAM;MACLO,OAAO,CAACM,oBAAoB,CAACC,OAAO,CAAEC,cAAc,IAAK;QACvD,IAAIA,cAAc,CAACJ,MAAM,CAACb,UAAU,CAAC,EAAE;UACrCiB,cAAc,CAACH,eAAe,CAACb,SAAS,EAAEC,UAAU,CAAC;QACvD;MACF,CAAC,CAAC;IACJ;IAEA,IAAIC,OAAO,CAACC,UAAU,IAAIK,OAAO,CAACS,OAAO,EAAE;MACzC,MAAMC,gBAAgB,GAAG,IAAAC,oCAAoB,EAC3CX,OAAO,EACPR,SAAS,EACTE,OAAO,CAACG,WAAW,CACpB;MACD,IAAIa,gBAAgB,EAAE;QACpB,OAAOX,QAAQ,CAACW,gBAAgB,CAAC;MACnC;IACF;IAEA,IAAIhB,OAAO,CAACE,QAAQ,IAAII,OAAO,CAACS,OAAO,IAAIT,OAAO,CAACY,SAAS,EAAE,EAAE;MAC9Db,QAAQ,CAAC,IAAAc,gCAAkB,EAACb,OAAO,CAAC,CAAC;IACvC;IAEA,IACEN,OAAO,CAACI,QAAQ,IAChBE,OAAO,CAACG,iBAAiB,EAAEW,qBAAqB,IAChD,IAAAC,oBAAU,EAAC,+BAA+B,CAAC,EAC3C;MACA;MACAhB,QAAQ,CAAC,IAAAiB,mCAAkB,EAAChB,OAAO,CAAC,CAAC;IACvC;IAEA,OAAOD,QAAQ,CAAC,IAAAkB,4BAAU,EAACjB,OAAO,CAAC,CAAC;EACtC,CAAC;AAAA;AAAC"}
@@ -10,7 +10,7 @@ var _ModularUIActions = require("../_modularui/ModularUIActions");
10
10
  const addRepeatableAttributeSet = form => {
11
11
  const newForm = form.clone();
12
12
  newForm.addEmptyFormObject();
13
- return (0, _ModularUIActions.updateModel)(newForm);
13
+ return (0, _ModularUIActions.updateForm)(newForm);
14
14
  };
15
15
 
16
16
  /**
@@ -20,7 +20,7 @@ const cancelRepeatableAttributeSet = (form, formObject) => {
20
20
  const newForm = form.clone();
21
21
  newForm.addEmptyFormObject();
22
22
  newForm.removeFormObject(formObject);
23
- return (0, _ModularUIActions.updateModel)(newForm);
23
+ return (0, _ModularUIActions.updateForm)(newForm);
24
24
  };
25
25
 
26
26
  /**
@@ -29,7 +29,7 @@ exports.cancelRepeatableAttributeSet = cancelRepeatableAttributeSet;
29
29
  const removeRepeatableAttributeSet = (form, formObject) => {
30
30
  const newForm = form.clone();
31
31
  newForm.removeFormObject(formObject);
32
- return (0, _ModularUIActions.updateModel)(newForm);
32
+ return (0, _ModularUIActions.updateForm)(newForm);
33
33
  };
34
34
  exports.removeRepeatableAttributeSet = removeRepeatableAttributeSet;
35
35
  //# sourceMappingURL=FormAttributeSetRepeatable.js.map