@beinformed/ui 1.27.5 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/esm/constants/LayoutHintConfig.js +0 -9
- package/esm/constants/LayoutHintConfig.js.map +1 -1
- package/esm/constants/LayoutHints.js +0 -4
- package/esm/constants/LayoutHints.js.map +1 -1
- package/esm/constants/Settings.js +0 -4
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +3 -29
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/react-client/Init.js +2 -2
- package/esm/react-client/Init.js.map +1 -1
- package/esm/react-client/client.js +80 -52
- package/esm/react-client/client.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +7 -0
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +1 -0
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/actions/Form.js +2 -2
- package/esm/redux/actions/Form.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js +2 -2
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAttributeSetRepeatable.js +4 -4
- package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js +2 -2
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormValidations.js +2 -2
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/store/configureStore.js +4 -4
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/redux/types.js.map +1 -1
- package/lib/constants/LayoutHintConfig.js +0 -9
- package/lib/constants/LayoutHintConfig.js.flow +0 -9
- package/lib/constants/LayoutHintConfig.js.map +1 -1
- package/lib/constants/LayoutHints.js +2 -7
- package/lib/constants/LayoutHints.js.flow +0 -4
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js +0 -4
- package/lib/constants/Settings.js.flow +0 -6
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/__tests__/useForm.spec.js.flow +4 -4
- package/lib/hooks/useForm.js.flow +5 -5
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +2 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +3 -29
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -41
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/DateAttributeModel.spec.js.flow +1 -35
- package/lib/models/attributes/__tests__/DatetimeAttributeModel.spec.js.flow +158 -216
- package/lib/models/attributes/__tests__/TimestampModel.spec.js.flow +0 -5
- package/lib/react-client/Init.js +2 -2
- package/lib/react-client/Init.js.flow +3 -3
- package/lib/react-client/Init.js.map +1 -1
- package/lib/react-client/client.js +83 -53
- package/lib/react-client/client.js.flow +106 -67
- package/lib/react-client/client.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +9 -1
- package/lib/redux/_modularui/ModularUIActions.js.flow +8 -0
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +1 -0
- package/lib/redux/_modularui/ModularUIReducer.js.flow +1 -0
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +5 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/Form.js +1 -1
- package/lib/redux/actions/Form.js.flow +4 -4
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js +1 -1
- package/lib/redux/actions/FormAttributeSet.js.flow +3 -2
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js +3 -3
- package/lib/redux/actions/FormAttributeSetRepeatable.js.flow +8 -8
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js +1 -1
- package/lib/redux/actions/FormAutosave.js.flow +2 -2
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormValidations.js +1 -1
- package/lib/redux/actions/FormValidations.js.flow +2 -2
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/__tests__/Form.spec.js.flow +1 -1
- package/lib/redux/connectors/Form.js.flow +2 -5
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.flow +5 -5
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/store/configureStore.js +4 -4
- package/lib/redux/store/configureStore.js.flow +5 -5
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.flow +2 -0
- package/lib/redux/types.js.map +1 -1
- package/package.json +17 -19
- package/src/constants/LayoutHintConfig.js +0 -9
- package/src/constants/LayoutHints.js +0 -4
- package/src/constants/Settings.js +0 -6
- package/src/hooks/__tests__/useForm.spec.js +4 -4
- package/src/hooks/useForm.js +5 -5
- package/src/models/attributes/ChoiceAttributeModel.js +1 -0
- package/src/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/src/models/attributes/DatetimeAttributeModel.js +7 -41
- package/src/models/attributes/__tests__/DateAttributeModel.spec.js +1 -35
- package/src/models/attributes/__tests__/DatetimeAttributeModel.spec.js +158 -216
- package/src/models/attributes/__tests__/TimestampModel.spec.js +0 -5
- package/src/react-client/Init.js +3 -3
- package/src/react-client/client.js +106 -67
- package/src/redux/_modularui/ModularUIActions.js +8 -0
- package/src/redux/_modularui/ModularUIReducer.js +1 -0
- package/src/redux/_modularui/types.js +5 -0
- package/src/redux/actions/Form.js +4 -4
- package/src/redux/actions/FormAttributeSet.js +3 -2
- package/src/redux/actions/FormAttributeSetRepeatable.js +8 -8
- package/src/redux/actions/FormAutosave.js +2 -2
- package/src/redux/actions/FormValidations.js +2 -2
- package/src/redux/actions/__tests__/Form.spec.js +1 -1
- package/src/redux/connectors/Form.js +2 -5
- package/src/redux/connectors/FormAttributeSet.js +5 -5
- package/src/redux/store/configureStore.js +5 -5
- package/src/redux/types.js +2 -0
- package/types/constants/LayoutHintConfig.d.ts +8 -23
- package/types/constants/LayoutHints.d.ts +0 -4
- package/types/models/actions/ActionCollection.d.ts +1 -1
- package/types/models/attributes/DatetimeAttributeModel.d.ts +8 -2
- package/types/redux/_modularui/types.d.ts +4 -0
- package/types/redux/types.d.ts +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
3
3
|
|
|
4
4
|
import type FormModel from "../../models/form/FormModel";
|
|
5
5
|
import type FormObjectModel from "../../models/form/FormObjectModel";
|
|
6
|
-
import type {
|
|
6
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*/
|
|
10
10
|
export const addRepeatableAttributeSet = (
|
|
11
11
|
form: FormModel
|
|
12
|
-
):
|
|
12
|
+
): UpdateFormAction => {
|
|
13
13
|
const newForm = form.clone();
|
|
14
14
|
|
|
15
15
|
newForm.addEmptyFormObject();
|
|
16
16
|
|
|
17
|
-
return
|
|
17
|
+
return updateForm(newForm);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -22,13 +22,13 @@ export const addRepeatableAttributeSet = (
|
|
|
22
22
|
export const cancelRepeatableAttributeSet = (
|
|
23
23
|
form: FormModel,
|
|
24
24
|
formObject: FormObjectModel
|
|
25
|
-
):
|
|
25
|
+
): UpdateFormAction => {
|
|
26
26
|
const newForm = form.clone();
|
|
27
27
|
|
|
28
28
|
newForm.addEmptyFormObject();
|
|
29
29
|
newForm.removeFormObject(formObject);
|
|
30
30
|
|
|
31
|
-
return
|
|
31
|
+
return updateForm(newForm);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -36,10 +36,10 @@ export const cancelRepeatableAttributeSet = (
|
|
|
36
36
|
export const removeRepeatableAttributeSet = (
|
|
37
37
|
form: FormModel,
|
|
38
38
|
formObject: FormObjectModel
|
|
39
|
-
):
|
|
39
|
+
): UpdateFormAction => {
|
|
40
40
|
const newForm = form.clone();
|
|
41
41
|
|
|
42
42
|
newForm.removeFormObject(formObject);
|
|
43
43
|
|
|
44
|
-
return
|
|
44
|
+
return updateForm(newForm);
|
|
45
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAttributeSetRepeatable.js","names":["addRepeatableAttributeSet","form","newForm","clone","addEmptyFormObject","
|
|
1
|
+
{"version":3,"file":"FormAttributeSetRepeatable.js","names":["addRepeatableAttributeSet","form","newForm","clone","addEmptyFormObject","updateForm","cancelRepeatableAttributeSet","formObject","removeFormObject","removeRepeatableAttributeSet"],"sources":["../../../src/redux/actions/FormAttributeSetRepeatable.js"],"sourcesContent":["// @flow\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\nimport type { UpdateFormAction } from \"../_modularui/types\";\n\n/**\n */\nexport const addRepeatableAttributeSet = (\n form: FormModel\n): UpdateFormAction => {\n const newForm = form.clone();\n\n newForm.addEmptyFormObject();\n\n return updateForm(newForm);\n};\n\n/**\n */\nexport const cancelRepeatableAttributeSet = (\n form: FormModel,\n formObject: FormObjectModel\n): UpdateFormAction => {\n const newForm = form.clone();\n\n newForm.addEmptyFormObject();\n newForm.removeFormObject(formObject);\n\n return updateForm(newForm);\n};\n\n/**\n */\nexport const removeRepeatableAttributeSet = (\n form: FormModel,\n formObject: FormObjectModel\n): UpdateFormAction => {\n const newForm = form.clone();\n\n newForm.removeFormObject(formObject);\n\n return updateForm(newForm);\n};\n"],"mappings":";;;;;;AACA;AAMA;AACA;AACO,MAAMA,yBAAyB,GACpCC,IAAe,IACM;EACrB,MAAMC,OAAO,GAAGD,IAAI,CAACE,KAAK,EAAE;EAE5BD,OAAO,CAACE,kBAAkB,EAAE;EAE5B,OAAO,IAAAC,4BAAU,EAACH,OAAO,CAAC;AAC5B,CAAC;;AAED;AACA;AADA;AAEO,MAAMI,4BAA4B,GAAG,CAC1CL,IAAe,EACfM,UAA2B,KACN;EACrB,MAAML,OAAO,GAAGD,IAAI,CAACE,KAAK,EAAE;EAE5BD,OAAO,CAACE,kBAAkB,EAAE;EAC5BF,OAAO,CAACM,gBAAgB,CAACD,UAAU,CAAC;EAEpC,OAAO,IAAAF,4BAAU,EAACH,OAAO,CAAC;AAC5B,CAAC;;AAED;AACA;AADA;AAEO,MAAMO,4BAA4B,GAAG,CAC1CR,IAAe,EACfM,UAA2B,KACN;EACrB,MAAML,OAAO,GAAGD,IAAI,CAACE,KAAK,EAAE;EAE5BD,OAAO,CAACM,gBAAgB,CAACD,UAAU,CAAC;EAEpC,OAAO,IAAAF,4BAAU,EAACH,OAAO,CAAC;AAC5B,CAAC;AAAC"}
|
|
@@ -37,7 +37,7 @@ const autosave = (dispatch, form) => {
|
|
|
37
37
|
// update last server update to indicate an update has happened
|
|
38
38
|
// send the existing form to prevent updates in the ui based on autosave results
|
|
39
39
|
form.lastServerUpdate = savedForm.lastServerUpdate;
|
|
40
|
-
dispatch((0, _ModularUIActions.
|
|
40
|
+
dispatch((0, _ModularUIActions.updateForm)(form));
|
|
41
41
|
dispatch(updateAutosave(_Constants.AUTOSAVE_STATUS.FINISHED, savedForm));
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
AUTOSAVE_STATUS,
|
|
11
11
|
} from "../../constants/Constants";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
14
14
|
|
|
15
15
|
import type { UpdateAutosaveAction, ThunkAction, Dispatch } from "../types";
|
|
16
16
|
|
|
@@ -49,7 +49,7 @@ const autosave = (dispatch: Dispatch, form: FormModel) => {
|
|
|
49
49
|
// send the existing form to prevent updates in the ui based on autosave results
|
|
50
50
|
form.lastServerUpdate = savedForm.lastServerUpdate;
|
|
51
51
|
|
|
52
|
-
dispatch(
|
|
52
|
+
dispatch(updateForm(form));
|
|
53
53
|
dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));
|
|
54
54
|
}
|
|
55
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAutosave.js","names":["updateAutosave","status","model","type","payload","autosave","dispatch","form","AUTOSAVE_STATUS","START","formdata","getFormData","ModularUIRequest","selfhref","setParameter","method","HTTP_METHODS","POST","data","childmodels","locale","fetch","then","savedForm","FormModel","lastServerUpdate","
|
|
1
|
+
{"version":3,"file":"FormAutosave.js","names":["updateAutosave","status","model","type","payload","autosave","dispatch","form","AUTOSAVE_STATUS","START","formdata","getFormData","ModularUIRequest","selfhref","setParameter","method","HTTP_METHODS","POST","data","childmodels","locale","fetch","then","savedForm","FormModel","lastServerUpdate","updateForm","FINISHED","debouncedAutosave","debounce","VALIDATE_DEBOUNCE_TIMEOUT","autosaveFormObject"],"sources":["../../../src/redux/actions/FormAutosave.js"],"sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n AUTOSAVE_STATUS,\n} from \"../../constants/Constants\";\n\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport type { UpdateAutosaveAction, ThunkAction, Dispatch } from \"../types\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateAutosave = (\n status: $Keys<typeof AUTOSAVE_STATUS>,\n model: FormModel\n): UpdateAutosaveAction => ({\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status,\n model,\n },\n});\n\n/**\n */\nconst autosave = (dispatch: Dispatch, form: FormModel) => {\n dispatch(updateAutosave(AUTOSAVE_STATUS.START, form));\n\n const formdata = form.getFormData(true, false);\n\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"true\"), {\n method: HTTP_METHODS.POST,\n data: formdata,\n childmodels: false,\n locale: form.locale,\n })\n .fetch()\n .then((savedForm) => {\n if (savedForm instanceof FormModel) {\n // update last server update to indicate an update has happened\n // send the existing form to prevent updates in the ui based on autosave results\n form.lastServerUpdate = savedForm.lastServerUpdate;\n\n dispatch(updateForm(form));\n dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));\n }\n });\n};\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedAutosave = debounce((dispatch, form) => {\n autosave(dispatch, form);\n}, VALIDATE_DEBOUNCE_TIMEOUT);\n\n/**\n */\nexport const autosaveFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedAutosave(dispatch, form);\n"],"mappings":";;;;;;;AACA;AAEA;AACA;AAEA;AAMA;AAIA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,CACrBC,MAAqC,EACrCC,KAAgB,MACU;EAC1BC,IAAI,EAAE,wBAAwB;EAC9BC,OAAO,EAAE;IACPH,MAAM;IACNC;EACF;AACF,CAAC,CAAC;;AAEF;AACA;AACA,MAAMG,QAAQ,GAAG,CAACC,QAAkB,EAAEC,IAAe,KAAK;EACxDD,QAAQ,CAACN,cAAc,CAACQ,0BAAe,CAACC,KAAK,EAAEF,IAAI,CAAC,CAAC;EAErD,MAAMG,QAAQ,GAAGH,IAAI,CAACI,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;EAE9C,IAAIC,yBAAgB,CAACL,IAAI,CAACM,QAAQ,CAACC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE;IACjEC,MAAM,EAAEC,uBAAY,CAACC,IAAI;IACzBC,IAAI,EAAER,QAAQ;IACdS,WAAW,EAAE,KAAK;IAClBC,MAAM,EAAEb,IAAI,CAACa;EACf,CAAC,CAAC,CACCC,KAAK,EAAE,CACPC,IAAI,CAAEC,SAAS,IAAK;IACnB,IAAIA,SAAS,YAAYC,kBAAS,EAAE;MAClC;MACA;MACAjB,IAAI,CAACkB,gBAAgB,GAAGF,SAAS,CAACE,gBAAgB;MAElDnB,QAAQ,CAAC,IAAAoB,4BAAU,EAACnB,IAAI,CAAC,CAAC;MAC1BD,QAAQ,CAACN,cAAc,CAACQ,0BAAe,CAACmB,QAAQ,EAAEJ,SAAS,CAAC,CAAC;IAC/D;EACF,CAAC,CAAC;AACN,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,iBAAiB,GAAG,IAAAC,iBAAQ,EAAC,CAACvB,QAAQ,EAAEC,IAAI,KAAK;EACrDF,QAAQ,CAACC,QAAQ,EAAEC,IAAI,CAAC;AAC1B,CAAC,EAAEuB,oCAAyB,CAAC;;AAE7B;AACA;AACO,MAAMC,kBAAkB,GAC5BxB,IAAe,IACfD,QAAQ,IACPsB,iBAAiB,CAACtB,QAAQ,EAAEC,IAAI,CAAC;AAAC"}
|
|
@@ -21,7 +21,7 @@ const updateValidations = (form, formWithValidations) => (dispatch, getState) =>
|
|
|
21
21
|
if (validatedForm instanceof _FormModel.default) {
|
|
22
22
|
validatedForm.updateValidations(formWithValidations.data);
|
|
23
23
|
}
|
|
24
|
-
dispatch((0, _ModularUIActions.
|
|
24
|
+
dispatch((0, _ModularUIActions.updateForm)(validatedForm));
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import debounce from "lodash/debounce";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
5
5
|
|
|
6
6
|
import ModularUIRequest from "../../modularui/ModularUIRequest";
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ const updateValidations =
|
|
|
30
30
|
validatedForm.updateValidations(formWithValidations.data);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
dispatch(
|
|
33
|
+
dispatch(updateForm(validatedForm));
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormValidations.js","names":["updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","FormModel","data","
|
|
1
|
+
{"version":3,"file":"FormValidations.js","names":["updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","FormModel","data","updateForm","debouncedValidateFormObject","debounce","ModularUIRequest","selfhref","setParameter","method","HTTP_METHODS","POST","validationData","childmodels","isValidationRequest","locale","fetch","then","VALIDATE_DEBOUNCE_TIMEOUT","leading","trailing","validateFormObject"],"sources":["../../../src/redux/actions/FormValidations.js"],"sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n} from \"../../constants/Constants\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateValidations =\n (form: FormModel, formWithValidations: ModularUIModel) =>\n (dispatch: Dispatch, getState: GetState) => {\n const currentForm = getState().modularui[form.connectKey];\n\n if (currentForm) {\n const validatedForm = currentForm.model.clone();\n if (validatedForm instanceof FormModel) {\n validatedForm.updateValidations(formWithValidations.data);\n }\n\n dispatch(updateForm(validatedForm));\n }\n };\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedValidateFormObject = debounce<\n (dispatch: Dispatch, form: FormModel) => void\n>(\n (dispatch, form: FormModel) => {\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"false\"), {\n method: HTTP_METHODS.POST,\n data: form.validationData,\n childmodels: false,\n isValidationRequest: true,\n locale: form.locale,\n })\n .fetch()\n .then((formWithValidations) =>\n dispatch(updateValidations(form, formWithValidations))\n );\n },\n VALIDATE_DEBOUNCE_TIMEOUT,\n {\n leading: true,\n trailing: true,\n }\n);\n\n/**\n */\nexport const validateFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedValidateFormObject(dispatch, form);\n"],"mappings":";;;;;;;AACA;AAEA;AAEA;AAEA;AAKA;AAKA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GACrB,CAACC,IAAe,EAAEC,mBAAmC,KACrD,CAACC,QAAkB,EAAEC,QAAkB,KAAK;EAC1C,MAAMC,WAAW,GAAGD,QAAQ,EAAE,CAACE,SAAS,CAACL,IAAI,CAACM,UAAU,CAAC;EAEzD,IAAIF,WAAW,EAAE;IACf,MAAMG,aAAa,GAAGH,WAAW,CAACI,KAAK,CAACC,KAAK,EAAE;IAC/C,IAAIF,aAAa,YAAYG,kBAAS,EAAE;MACtCH,aAAa,CAACR,iBAAiB,CAACE,mBAAmB,CAACU,IAAI,CAAC;IAC3D;IAEAT,QAAQ,CAAC,IAAAU,4BAAU,EAACL,aAAa,CAAC,CAAC;EACrC;AACF,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,2BAA2B,GAAG,IAAAC,iBAAQ,EAG1C,CAACZ,QAAQ,EAAEF,IAAe,KAAK;EAC7B,IAAIe,yBAAgB,CAACf,IAAI,CAACgB,QAAQ,CAACC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;IAClEC,MAAM,EAAEC,uBAAY,CAACC,IAAI;IACzBT,IAAI,EAAEX,IAAI,CAACqB,cAAc;IACzBC,WAAW,EAAE,KAAK;IAClBC,mBAAmB,EAAE,IAAI;IACzBC,MAAM,EAAExB,IAAI,CAACwB;EACf,CAAC,CAAC,CACCC,KAAK,EAAE,CACPC,IAAI,CAAEzB,mBAAmB,IACxBC,QAAQ,CAACH,iBAAiB,CAACC,IAAI,EAAEC,mBAAmB,CAAC,CAAC,CACvD;AACL,CAAC,EACD0B,oCAAyB,EACzB;EACEC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;AACZ,CAAC,CACF;;AAED;AACA;AACO,MAAMC,kBAAkB,GAC5B9B,IAAe,IACfE,QAAQ,IACPW,2BAA2B,CAACX,QAAQ,EAAEF,IAAI,CAAC;AAAC"}
|
|
@@ -16,10 +16,7 @@ import type { AbstractComponent } from "react";
|
|
|
16
16
|
import type FormModel from "../../models/form/FormModel";
|
|
17
17
|
import type { ContextRouter } from "react-router";
|
|
18
18
|
import type { ReduxState, ThunkAction } from "../types";
|
|
19
|
-
import type {
|
|
20
|
-
ModularUIConnector,
|
|
21
|
-
UpdateModelAction,
|
|
22
|
-
} from "../_modularui/types";
|
|
19
|
+
import type { ModularUIConnector, UpdateFormAction } from "../_modularui/types";
|
|
23
20
|
|
|
24
21
|
type OwnProps = {
|
|
25
22
|
...?ContextRouter,
|
|
@@ -33,7 +30,7 @@ type StateProps = {
|
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
type DispatchProps = {
|
|
36
|
-
onPrevious: (form: FormModel) =>
|
|
33
|
+
onPrevious: (form: FormModel) => UpdateFormAction,
|
|
37
34
|
onCancel: (form: FormModel) => ThunkAction,
|
|
38
35
|
showFormNotification: (form: FormModel) => ThunkAction,
|
|
39
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","names":["mapStateToProps","state","ownProps","isModal","router","location","modal","mapDispatchToProps","onPrevious","previousObject","onCancel","cancelForm","showFormNotification","reduxConnectedForm","connect","moduiConnectedForm","modularui","href","formHref","Href","pathname","search","getSetting","addParameter","propName","method","HTTP_METHODS","POST","connectForm","compose"],"sources":["../../../src/redux/connectors/Form.js"],"sourcesContent":["// @flow\nimport { compose } from \"redux\";\nimport { connect } from \"react-redux\";\n\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { cancelForm, previousObject } from \"../actions/Form\";\nimport { showFormNotification } from \"../actions/Notification\";\n\nimport Href from \"../../models/href/Href\";\n\nimport type { AbstractComponent } from \"react\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { ContextRouter } from \"react-router\";\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type {
|
|
1
|
+
{"version":3,"file":"Form.js","names":["mapStateToProps","state","ownProps","isModal","router","location","modal","mapDispatchToProps","onPrevious","previousObject","onCancel","cancelForm","showFormNotification","reduxConnectedForm","connect","moduiConnectedForm","modularui","href","formHref","Href","pathname","search","getSetting","addParameter","propName","method","HTTP_METHODS","POST","connectForm","compose"],"sources":["../../../src/redux/connectors/Form.js"],"sourcesContent":["// @flow\nimport { compose } from \"redux\";\nimport { connect } from \"react-redux\";\n\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { cancelForm, previousObject } from \"../actions/Form\";\nimport { showFormNotification } from \"../actions/Notification\";\n\nimport Href from \"../../models/href/Href\";\n\nimport type { AbstractComponent } from \"react\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { ContextRouter } from \"react-router\";\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ModularUIConnector, UpdateFormAction } from \"../_modularui/types\";\n\ntype OwnProps = {\n ...?ContextRouter,\n href?: Href,\n isModal?: boolean,\n redirectTo?: string,\n};\n\ntype StateProps = {\n isModal: boolean,\n};\n\ntype DispatchProps = {\n onPrevious: (form: FormModel) => UpdateFormAction,\n onCancel: (form: FormModel) => ThunkAction,\n showFormNotification: (form: FormModel) => ThunkAction,\n};\n\ntype Props = {\n ...OwnProps,\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (\n state: ReduxState,\n ownProps: OwnProps\n): StateProps => ({\n isModal: state.router.location?.state?.modal || ownProps.isModal || false,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n onPrevious: previousObject,\n onCancel: cancelForm,\n showFormNotification,\n};\n\nconst reduxConnectedForm = connect<Props, OwnProps, StateProps, _, _, _>(\n mapStateToProps,\n mapDispatchToProps\n);\n\nconst moduiConnectedForm: ModularUIConnector = modularui(\n \"Form\",\n ({ href, location }) => {\n const formHref = href || new Href(`${location.pathname}${location.search}`);\n\n if (getSetting(\"ALWAYS_COMMIT_FORM\")) {\n return formHref;\n }\n\n return formHref.addParameter(\"commit\", \"false\");\n },\n { propName: \"form\", method: HTTP_METHODS.POST }\n);\n\n/**\n */\nexport const connectForm: (\n Component: AbstractComponent<Props>\n) => AbstractComponent<OwnProps> = compose(\n moduiConnectedForm,\n reduxConnectedForm\n);\n"],"mappings":";;;;;;;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AAEA;AA+BA,MAAMA,eAAe,GAAG,CACtBC,KAAiB,EACjBC,QAAkB,MACF;EAChBC,OAAO,EAAEF,KAAK,CAACG,MAAM,CAACC,QAAQ,EAAEJ,KAAK,EAAEK,KAAK,IAAIJ,QAAQ,CAACC,OAAO,IAAI;AACtE,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,UAAU,EAAEC,oBAAc;EAC1BC,QAAQ,EAAEC,gBAAU;EACpBC,oBAAoB,EAApBA;AACF,CAAC;AAED,MAAMC,kBAAkB,GAAG,IAAAC,mBAAO,EAChCd,eAAe,EACfO,kBAAkB,CACnB;AAED,MAAMQ,kBAAsC,GAAG,IAAAC,2BAAS,EACtD,MAAM,EACN,QAAwB;EAAA,IAAvB;IAAEC,IAAI;IAAEZ;EAAS,CAAC;EACjB,MAAMa,QAAQ,GAAGD,IAAI,IAAI,IAAIE,aAAI,CAAE,GAAEd,QAAQ,CAACe,QAAS,GAAEf,QAAQ,CAACgB,MAAO,EAAC,CAAC;EAE3E,IAAI,IAAAC,oBAAU,EAAC,oBAAoB,CAAC,EAAE;IACpC,OAAOJ,QAAQ;EACjB;EAEA,OAAOA,QAAQ,CAACK,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;AACjD,CAAC,EACD;EAAEC,QAAQ,EAAE,MAAM;EAAEC,MAAM,EAAEC,uBAAY,CAACC;AAAK,CAAC,CAChD;;AAED;AACA;AACO,MAAMC,WAEmB,GAAG,IAAAC,cAAO,EACxCd,kBAAkB,EAClBF,kBAAkB,CACnB;AAAC"}
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
} from "../actions/FormAttributeSetRepeatable";
|
|
10
10
|
|
|
11
11
|
import type { ThunkAction, UpdateFormOptions } from "../types";
|
|
12
|
-
import type {
|
|
12
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
13
13
|
import type { AttributeType } from "../../models/types";
|
|
14
14
|
import type FormModel from "../../models/form/FormModel";
|
|
15
15
|
import type FormObjectModel from "../../models/form/FormObjectModel";
|
|
16
16
|
import type { DispatchAPI } from "redux";
|
|
17
17
|
import type { ComponentType } from "react";
|
|
18
18
|
|
|
19
|
-
type Dispatch = DispatchAPI<
|
|
19
|
+
type Dispatch = DispatchAPI<UpdateFormAction> & DispatchAPI<ThunkAction>;
|
|
20
20
|
|
|
21
21
|
type OwnProps = {
|
|
22
22
|
form: FormModel,
|
|
@@ -32,9 +32,9 @@ type DispatchProps = {
|
|
|
32
32
|
value: string,
|
|
33
33
|
options: UpdateFormOptions
|
|
34
34
|
) => ThunkAction,
|
|
35
|
-
onAddAttributeSetClick: () =>
|
|
36
|
-
onCancelAttributeSetClick: (formObject: FormObjectModel) =>
|
|
37
|
-
onRemoveAttributeSetClick: (formObject: FormObjectModel) =>
|
|
35
|
+
onAddAttributeSetClick: () => UpdateFormAction,
|
|
36
|
+
onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
|
|
37
|
+
onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
type Props = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAttributeSet.js","names":["mapDispatchToProps","dispatch","ownProps","onAttributeChange","attribute","value","options","autosubmit","autosave","updateFormAttribute","form","object","onAddAttributeSetClick","addRepeatableAttributeSet","onCancelAttributeSetClick","formObject","cancelRepeatableAttributeSet","onRemoveAttributeSetClick","removeRepeatableAttributeSet","connectFormAttributeSet","connect"],"sources":["../../../src/redux/connectors/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { updateFormAttribute } from \"../actions/FormAttributeSet\";\nimport {\n addRepeatableAttributeSet,\n cancelRepeatableAttributeSet,\n removeRepeatableAttributeSet,\n} from \"../actions/FormAttributeSetRepeatable\";\n\nimport type { ThunkAction, UpdateFormOptions } from \"../types\";\nimport type {
|
|
1
|
+
{"version":3,"file":"FormAttributeSet.js","names":["mapDispatchToProps","dispatch","ownProps","onAttributeChange","attribute","value","options","autosubmit","autosave","updateFormAttribute","form","object","onAddAttributeSetClick","addRepeatableAttributeSet","onCancelAttributeSetClick","formObject","cancelRepeatableAttributeSet","onRemoveAttributeSetClick","removeRepeatableAttributeSet","connectFormAttributeSet","connect"],"sources":["../../../src/redux/connectors/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { updateFormAttribute } from \"../actions/FormAttributeSet\";\nimport {\n addRepeatableAttributeSet,\n cancelRepeatableAttributeSet,\n removeRepeatableAttributeSet,\n} from \"../actions/FormAttributeSetRepeatable\";\n\nimport type { ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { UpdateFormAction } from \"../_modularui/types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\nimport type { DispatchAPI } from \"redux\";\nimport type { ComponentType } from \"react\";\n\ntype Dispatch = DispatchAPI<UpdateFormAction> & DispatchAPI<ThunkAction>;\n\ntype OwnProps = {\n form: FormModel,\n object: FormObjectModel,\n formLayout?: \"vertical\" | \"horizontal\" | \"compact\",\n autosubmit?: boolean,\n autosave?: boolean,\n};\n\ntype DispatchProps = {\n onAttributeChange: (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => ThunkAction,\n onAddAttributeSetClick: () => UpdateFormAction,\n onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,\n onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,\n};\n\ntype Props = {\n ...OwnProps,\n ...DispatchProps,\n};\n\nconst mapDispatchToProps = (\n dispatch: Dispatch,\n ownProps: OwnProps\n): DispatchProps => ({\n onAttributeChange: (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions = {\n autosubmit: ownProps.autosubmit || false,\n autosave: ownProps.autosave || false,\n }\n ) =>\n dispatch(\n updateFormAttribute(\n ownProps.form,\n ownProps.object,\n attribute,\n value,\n options\n )\n ),\n onAddAttributeSetClick: () =>\n dispatch(addRepeatableAttributeSet(ownProps.form)),\n onCancelAttributeSetClick: (formObject: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(ownProps.form, formObject)),\n onRemoveAttributeSetClick: (formObject: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(ownProps.form, formObject)),\n});\n\n/**\n */\nexport const connectFormAttributeSet: ComponentType<any> = connect<\n Props,\n OwnProps,\n _,\n DispatchProps,\n _,\n _\n>(null, mapDispatchToProps);\n"],"mappings":";;;;;;AACA;AAEA;AACA;AAwCA,MAAMA,kBAAkB,GAAG,CACzBC,QAAkB,EAClBC,QAAkB,MACC;EACnBC,iBAAiB,EAAE,UACjBC,SAAwB,EACxBC,KAAa;IAAA,IACbC,OAA0B,uEAAG;MAC3BC,UAAU,EAAEL,QAAQ,CAACK,UAAU,IAAI,KAAK;MACxCC,QAAQ,EAAEN,QAAQ,CAACM,QAAQ,IAAI;IACjC,CAAC;IAAA,OAEDP,QAAQ,CACN,IAAAQ,qCAAmB,EACjBP,QAAQ,CAACQ,IAAI,EACbR,QAAQ,CAACS,MAAM,EACfP,SAAS,EACTC,KAAK,EACLC,OAAO,CACR,CACF;EAAA;EACHM,sBAAsB,EAAE,MACtBX,QAAQ,CAAC,IAAAY,qDAAyB,EAACX,QAAQ,CAACQ,IAAI,CAAC,CAAC;EACpDI,yBAAyB,EAAGC,UAA2B,IACrDd,QAAQ,CAAC,IAAAe,wDAA4B,EAACd,QAAQ,CAACQ,IAAI,EAAEK,UAAU,CAAC,CAAC;EACnEE,yBAAyB,EAAGF,UAA2B,IACrDd,QAAQ,CAAC,IAAAiB,wDAA4B,EAAChB,QAAQ,CAACQ,IAAI,EAAEK,UAAU,CAAC;AACpE,CAAC,CAAC;;AAEF;AACA;AACO,MAAMI,uBAA2C,GAAG,IAAAC,mBAAO,EAOhE,IAAI,EAAEpB,kBAAkB,CAAC;AAAC"}
|
|
@@ -13,7 +13,7 @@ var _createReducer = require("../reducers/createReducer");
|
|
|
13
13
|
var _RouterActions = require("../_router/RouterActions");
|
|
14
14
|
/**
|
|
15
15
|
*/
|
|
16
|
-
const configureStore = (
|
|
16
|
+
const configureStore = (routerHistory, customReducers, initialState) => {
|
|
17
17
|
let composeEnhancers = _redux.compose;
|
|
18
18
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
19
19
|
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || _redux.compose;
|
|
@@ -22,14 +22,14 @@ const configureStore = (history, customReducers, initialState) => {
|
|
|
22
22
|
...customReducers,
|
|
23
23
|
...(0, _createReducer.createReducer)()
|
|
24
24
|
});
|
|
25
|
-
const middleware = (0, _redux.applyMiddleware)(_ModularUIMiddleware.modularUIMiddleware, (0, _RouterMiddleware.routerMiddleware)(
|
|
25
|
+
const middleware = (0, _redux.applyMiddleware)(_ModularUIMiddleware.modularUIMiddleware, (0, _RouterMiddleware.routerMiddleware)(routerHistory), _reduxThunk.default);
|
|
26
26
|
const enhancers = composeEnhancers(middleware);
|
|
27
27
|
const store = (0, _redux.createStore)(combinedReducers, initialState, enhancers);
|
|
28
28
|
if (!initialState?.router) {
|
|
29
|
-
store.dispatch((0, _RouterActions.locationChange)(
|
|
29
|
+
store.dispatch((0, _RouterActions.locationChange)(routerHistory.location, "PUSH"));
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
|
-
|
|
32
|
+
routerHistory,
|
|
33
33
|
store
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -20,10 +20,10 @@ import type { Reducer } from "redux";
|
|
|
20
20
|
/**
|
|
21
21
|
*/
|
|
22
22
|
const configureStore = (
|
|
23
|
-
|
|
23
|
+
routerHistory: RouterHistory,
|
|
24
24
|
customReducers?: Object,
|
|
25
25
|
initialState?: $Shape<ReduxState>
|
|
26
|
-
): {
|
|
26
|
+
): { routerHistory: RouterHistory, store: ReduxStore } => {
|
|
27
27
|
let composeEnhancers = compose;
|
|
28
28
|
|
|
29
29
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
@@ -37,7 +37,7 @@ const configureStore = (
|
|
|
37
37
|
|
|
38
38
|
const middleware = applyMiddleware(
|
|
39
39
|
modularUIMiddleware,
|
|
40
|
-
routerMiddleware(
|
|
40
|
+
routerMiddleware(routerHistory),
|
|
41
41
|
thunk
|
|
42
42
|
);
|
|
43
43
|
|
|
@@ -50,9 +50,9 @@ const configureStore = (
|
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
if (!initialState?.router) {
|
|
53
|
-
store.dispatch(locationChange(
|
|
53
|
+
store.dispatch(locationChange(routerHistory.location, "PUSH"));
|
|
54
54
|
}
|
|
55
|
-
return {
|
|
55
|
+
return { routerHistory, store };
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export default configureStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configureStore.js","names":["configureStore","
|
|
1
|
+
{"version":3,"file":"configureStore.js","names":["configureStore","routerHistory","customReducers","initialState","composeEnhancers","compose","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","combinedReducers","combineReducers","createReducer","middleware","applyMiddleware","modularUIMiddleware","routerMiddleware","thunk","enhancers","store","createReduxStore","router","dispatch","locationChange","location"],"sources":["../../../src/redux/store/configureStore.js"],"sourcesContent":["// @flow\nimport {\n applyMiddleware,\n compose,\n combineReducers,\n createStore as createReduxStore,\n} from \"redux\";\nimport thunk from \"redux-thunk\";\n\nimport { routerMiddleware } from \"../_router/RouterMiddleware\";\nimport { modularUIMiddleware } from \"../_modularui/ModularUIMiddleware\";\n\nimport { createReducer } from \"../reducers/createReducer\";\nimport { locationChange } from \"../_router/RouterActions\";\n\nimport type { RouterHistory } from \"react-router\";\nimport type { ReduxAction, ReduxState, ReduxStore } from \"../types\";\nimport type { Reducer } from \"redux\";\n\n/**\n */\nconst configureStore = (\n routerHistory: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>\n): { routerHistory: RouterHistory, store: ReduxStore } => {\n let composeEnhancers = compose;\n\n if (process.env.NODE_ENV !== \"production\" && typeof window !== \"undefined\") {\n composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n }\n\n const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({\n ...customReducers,\n ...createReducer(),\n });\n\n const middleware = applyMiddleware(\n modularUIMiddleware,\n routerMiddleware(routerHistory),\n thunk\n );\n\n const enhancers = composeEnhancers(middleware);\n\n const store: ReduxStore = createReduxStore(\n combinedReducers,\n initialState,\n enhancers\n );\n\n if (!initialState?.router) {\n store.dispatch(locationChange(routerHistory.location, \"PUSH\"));\n }\n return { routerHistory, store };\n};\n\nexport default configureStore;\n"],"mappings":";;;;;;;AACA;AAMA;AAEA;AACA;AAEA;AACA;AAMA;AACA;AACA,MAAMA,cAAc,GAAG,CACrBC,aAA4B,EAC5BC,cAAuB,EACvBC,YAAiC,KACuB;EACxD,IAAIC,gBAAgB,GAAGC,cAAO;EAE9B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EL,gBAAgB,GAAGK,MAAM,CAACC,oCAAoC,IAAIL,cAAO;EAC3E;EAEA,MAAMM,gBAAkD,GAAG,IAAAC,sBAAe,EAAC;IACzE,GAAGV,cAAc;IACjB,GAAG,IAAAW,4BAAa;EAClB,CAAC,CAAC;EAEF,MAAMC,UAAU,GAAG,IAAAC,sBAAe,EAChCC,wCAAmB,EACnB,IAAAC,kCAAgB,EAAChB,aAAa,CAAC,EAC/BiB,mBAAK,CACN;EAED,MAAMC,SAAS,GAAGf,gBAAgB,CAACU,UAAU,CAAC;EAE9C,MAAMM,KAAiB,GAAG,IAAAC,kBAAgB,EACxCV,gBAAgB,EAChBR,YAAY,EACZgB,SAAS,CACV;EAED,IAAI,CAAChB,YAAY,EAAEmB,MAAM,EAAE;IACzBF,KAAK,CAACG,QAAQ,CAAC,IAAAC,6BAAc,EAACvB,aAAa,CAACwB,QAAQ,EAAE,MAAM,CAAC,CAAC;EAChE;EACA,OAAO;IAAExB,aAAa;IAAEmB;EAAM,CAAC;AACjC,CAAC;AAAC,eAEapB,cAAc;AAAA"}
|
package/lib/redux/types.js.flow
CHANGED
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
UpdateStatusAction,
|
|
22
22
|
SetModelAction,
|
|
23
23
|
UpdateModelAction,
|
|
24
|
+
UpdateFormAction,
|
|
24
25
|
RemoveModelByKeyAction,
|
|
25
26
|
ResetModularUIAction,
|
|
26
27
|
InitModelAction,
|
|
@@ -138,6 +139,7 @@ export type ReduxAction =
|
|
|
138
139
|
| SetModelAction
|
|
139
140
|
| InitModelAction
|
|
140
141
|
| UpdateModelAction
|
|
142
|
+
| UpdateFormAction
|
|
141
143
|
| RemoveModelByKeyAction
|
|
142
144
|
| ResetModularUIAction
|
|
143
145
|
| SaveErrorAction
|
package/lib/redux/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store, DispatchAPI } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;\nexport type PromiseAction = Promise<PossibleAction>;\nexport type Dispatch = DispatchAPI<PossibleAction>;\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\nexport type PossibleAction = ReduxAction | ThunkAction | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store, DispatchAPI } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | UpdateFormAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;\nexport type PromiseAction = Promise<PossibleAction>;\nexport type Dispatch = DispatchAPI<PossibleAction>;\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\nexport type PossibleAction = ReduxAction | ThunkAction | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"test:ci": "jest --ci",
|
|
34
34
|
"test:changed": "jest --onlyChanged",
|
|
35
35
|
"upgrade-interactive": "npm-check -u",
|
|
36
|
-
"release": "
|
|
37
|
-
"beta-release": "
|
|
36
|
+
"release": "commit-and-tag-version",
|
|
37
|
+
"beta-release": "commit-and-tag-version --prerelease beta",
|
|
38
38
|
"prepublishOnly": "npm run build",
|
|
39
39
|
"docs": "node ./.build/docs.mjs",
|
|
40
40
|
"prepare": "husky install",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"history": "^4.0.0",
|
|
74
74
|
"polished": "^4.0.0",
|
|
75
|
-
"react": "^
|
|
76
|
-
"react-dom": "^
|
|
75
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
76
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
77
77
|
"react-helmet-async": "^1.0.0",
|
|
78
78
|
"react-redux": "^7.0.0 || ^8.0.0",
|
|
79
79
|
"react-router": "^5.0.0",
|
|
@@ -87,9 +87,7 @@
|
|
|
87
87
|
"date-fns": "^2.29.3",
|
|
88
88
|
"deepmerge": "^4.3.0",
|
|
89
89
|
"dequal": "^2.0.3",
|
|
90
|
-
"element-closest": "^3.0.2",
|
|
91
90
|
"file-size": "^1.0.0",
|
|
92
|
-
"focus-visible": "^5.2.0",
|
|
93
91
|
"format-message": "^6.2.4",
|
|
94
92
|
"he": "^1.2.0",
|
|
95
93
|
"iban": "^0.0.14",
|
|
@@ -110,39 +108,40 @@
|
|
|
110
108
|
"@babel/preset-env": "^7.20.2",
|
|
111
109
|
"@babel/preset-flow": "^7.18.6",
|
|
112
110
|
"@babel/preset-react": "^7.18.6",
|
|
113
|
-
"@commitlint/cli": "^17.4.
|
|
114
|
-
"@commitlint/config-conventional": "^17.4.
|
|
115
|
-
"@testing-library/react": "^
|
|
111
|
+
"@commitlint/cli": "^17.4.4",
|
|
112
|
+
"@commitlint/config-conventional": "^17.4.4",
|
|
113
|
+
"@testing-library/react": "^14.0.0",
|
|
116
114
|
"auditjs": "^4.0.39",
|
|
117
|
-
"babel-jest": "^29.4.
|
|
115
|
+
"babel-jest": "^29.4.3",
|
|
118
116
|
"babel-plugin-styled-components": "^2.0.7",
|
|
119
117
|
"cherry-pick": "^0.5.0",
|
|
118
|
+
"commit-and-tag-version": "^11.1.0",
|
|
120
119
|
"cross-env": "^7.0.3",
|
|
121
120
|
"documentation": "^14.0.1",
|
|
122
|
-
"eslint": "^8.
|
|
121
|
+
"eslint": "^8.34.0",
|
|
123
122
|
"eslint-config-prettier": "^8.6.0",
|
|
124
123
|
"eslint-plugin-babel": "^5.3.1",
|
|
125
124
|
"eslint-plugin-ft-flow": "^2.0.3",
|
|
126
125
|
"eslint-plugin-import": "^2.27.5",
|
|
127
126
|
"eslint-plugin-jest": "^27.2.1",
|
|
128
|
-
"eslint-plugin-jsdoc": "^
|
|
127
|
+
"eslint-plugin-jsdoc": "^40.0.0",
|
|
129
128
|
"eslint-plugin-react": "^7.32.2",
|
|
130
129
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
131
130
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
|
|
132
|
-
"flow-bin": "^0.
|
|
131
|
+
"flow-bin": "^0.200.0",
|
|
133
132
|
"flow-copy-source": "^2.0.9",
|
|
134
133
|
"flow-typed": "^3.8.0",
|
|
135
134
|
"glob": "^8.1.0",
|
|
136
135
|
"history": "^4.0.0",
|
|
137
136
|
"husky": "^8.0.3",
|
|
138
|
-
"jest": "^29.4.
|
|
139
|
-
"jest-environment-jsdom": "^29.4.
|
|
137
|
+
"jest": "^29.4.3",
|
|
138
|
+
"jest-environment-jsdom": "^29.4.3",
|
|
140
139
|
"jest-junit": "^15.0.0",
|
|
141
140
|
"jest-sonar-reporter": "^2.0.0",
|
|
142
141
|
"jscodeshift": "^0.14.0",
|
|
143
|
-
"lint-staged": "^13.1.
|
|
142
|
+
"lint-staged": "^13.1.2",
|
|
144
143
|
"polished": "^4.0.0",
|
|
145
|
-
"prettier": "^2.8.
|
|
144
|
+
"prettier": "^2.8.4",
|
|
146
145
|
"react": "^18.0.0",
|
|
147
146
|
"react-dom": "^18.0.0",
|
|
148
147
|
"react-helmet-async": "^1.0.0",
|
|
@@ -153,7 +152,6 @@
|
|
|
153
152
|
"redux-mock-store": "^1.5.4",
|
|
154
153
|
"redux-thunk": "^2.4.2",
|
|
155
154
|
"rimraf": "^4.1.2",
|
|
156
|
-
"standard-version": "^9.5.0",
|
|
157
155
|
"styled-components": "^5.3.6",
|
|
158
156
|
"xhr-mock": "^2.5.1"
|
|
159
157
|
},
|
|
@@ -109,15 +109,6 @@ export const LayoutHintConfiguration = {
|
|
|
109
109
|
link: "",
|
|
110
110
|
component: ["attribute/number"],
|
|
111
111
|
},
|
|
112
|
-
IGNORE_FORMAT_SETTING: {
|
|
113
|
-
hint: "ignore-format-setting",
|
|
114
|
-
description: {
|
|
115
|
-
NL: "Maakt het mogelijk om de global date format setting te negeren voor een specifiek attribuut",
|
|
116
|
-
EN: "Makes it possible to ignore the global date format for a specific attribute",
|
|
117
|
-
},
|
|
118
|
-
link: "",
|
|
119
|
-
component: ["attribute/date", "attribute/datetime"],
|
|
120
|
-
},
|
|
121
112
|
CREATE_ACTION: {
|
|
122
113
|
hint: "create",
|
|
123
114
|
description: {
|
|
@@ -53,10 +53,6 @@ export const SORT_OPTIONS: string = getHint("SORT_OPTIONS");
|
|
|
53
53
|
* Layout-hint: Marks an attribute as a title attribute
|
|
54
54
|
*/
|
|
55
55
|
export const TITLE: string = getHint("TITLE");
|
|
56
|
-
/**
|
|
57
|
-
* Layout-hint: Ignore the global input format for specific attribute
|
|
58
|
-
*/
|
|
59
|
-
export const IGNORE_FORMAT_SETTING: string = getHint("IGNORE_FORMAT_SETTING");
|
|
60
56
|
|
|
61
57
|
/*
|
|
62
58
|
* --------------------------------
|
|
@@ -97,12 +97,6 @@ const defaultSettings: { [name: string]: Setting } = {
|
|
|
97
97
|
"/Library/KMTs/Business scenarios.bixml/Persona",
|
|
98
98
|
],
|
|
99
99
|
|
|
100
|
-
// Input format for dates. Without this setting having a value, the contributions format is used
|
|
101
|
-
DATE_INPUT_FORMAT: "",
|
|
102
|
-
|
|
103
|
-
// Readonly format for dates. Without this setting having a value, the contributions format is used
|
|
104
|
-
DATE_READONLY_FORMAT: "",
|
|
105
|
-
|
|
106
100
|
// indicates on what day the week starts (0 = Sunday)
|
|
107
101
|
CALENDAR_WEEK_STARTS_ON: 1,
|
|
108
102
|
|
|
@@ -140,7 +140,7 @@ describe("form hooks", () => {
|
|
|
140
140
|
|
|
141
141
|
expect(store.getActions()).toStrictEqual([
|
|
142
142
|
{
|
|
143
|
-
type: "MODULARUI/
|
|
143
|
+
type: "MODULARUI/UPDATE_FORM",
|
|
144
144
|
payload: expect.objectContaining({ _key: "form" }),
|
|
145
145
|
},
|
|
146
146
|
]);
|
|
@@ -252,7 +252,7 @@ describe("form hooks", () => {
|
|
|
252
252
|
result.current(zipCode, "1234AB");
|
|
253
253
|
expect(store.getActions()).toStrictEqual([
|
|
254
254
|
expect.objectContaining({
|
|
255
|
-
type: "MODULARUI/
|
|
255
|
+
type: "MODULARUI/UPDATE_FORM",
|
|
256
256
|
}),
|
|
257
257
|
]);
|
|
258
258
|
});
|
|
@@ -278,7 +278,7 @@ describe("form hooks", () => {
|
|
|
278
278
|
result.current.save();
|
|
279
279
|
|
|
280
280
|
expect(store.getActions()).toStrictEqual([
|
|
281
|
-
expect.objectContaining({ type: "MODULARUI/
|
|
281
|
+
expect.objectContaining({ type: "MODULARUI/UPDATE_FORM" }),
|
|
282
282
|
]);
|
|
283
283
|
|
|
284
284
|
store.clearActions();
|
|
@@ -286,7 +286,7 @@ describe("form hooks", () => {
|
|
|
286
286
|
result.current.cancel(form.currentFormObject);
|
|
287
287
|
|
|
288
288
|
expect(store.getActions()).toStrictEqual([
|
|
289
|
-
expect.objectContaining({ type: "MODULARUI/
|
|
289
|
+
expect.objectContaining({ type: "MODULARUI/UPDATE_FORM" }),
|
|
290
290
|
]);
|
|
291
291
|
|
|
292
292
|
store.clearActions();
|
package/src/hooks/useForm.js
CHANGED
|
@@ -24,11 +24,11 @@ import type { FormObjectModel, AttributeType } from "../models";
|
|
|
24
24
|
import type { UpdateFormOptions } from "../redux/types";
|
|
25
25
|
import type {
|
|
26
26
|
RemoveModelByKeyAction,
|
|
27
|
-
|
|
27
|
+
UpdateFormAction,
|
|
28
28
|
} from "../redux/_modularui";
|
|
29
29
|
|
|
30
30
|
type FormNavigationHook = {
|
|
31
|
-
previous: (form: FormModel) =>
|
|
31
|
+
previous: (form: FormModel) => UpdateFormAction,
|
|
32
32
|
cancel: (form: FormModel) => void,
|
|
33
33
|
submit: (form: FormModel) => void,
|
|
34
34
|
showFormNotification: (form: FormModel) => void,
|
|
@@ -36,9 +36,9 @@ type FormNavigationHook = {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
type AttributeSetHook = {
|
|
39
|
-
save: () =>
|
|
40
|
-
cancel: (object: FormObjectModel) =>
|
|
41
|
-
remove: (object: FormObjectModel) =>
|
|
39
|
+
save: () => UpdateFormAction,
|
|
40
|
+
cancel: (object: FormObjectModel) => UpdateFormAction,
|
|
41
|
+
remove: (object: FormObjectModel) => UpdateFormAction,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
type AttributeUpdateHook = (
|
|
@@ -324,6 +324,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
|
|
|
324
324
|
}
|
|
325
325
|
values.forEach((val) => {
|
|
326
326
|
if (val instanceof ChoiceAttributeOptionModel) {
|
|
327
|
+
// option does not exist in existing options, add it. This can happen when lookup list has other options then lookup options
|
|
327
328
|
if (!this.options.some((option) => option.equals(val))) {
|
|
328
329
|
this.options.add(val);
|
|
329
330
|
}
|