@beinformed/ui 1.27.5 → 1.27.6
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 +6 -0
- 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/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/types.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/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/types.js.flow +2 -0
- package/lib/redux/types.js.map +1 -1
- package/package.json +1 -1
- 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/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/types.js +2 -0
|
@@ -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.
|
|
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 {
|
|
3
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
4
4
|
import { logoutSuccess } from "./SignOut";
|
|
5
5
|
import { reloadApplication } from "./Application";
|
|
6
6
|
import { startProgress, finishProgress } from "./ProgressIndicator";
|
|
@@ -9,17 +9,17 @@ import Authenticate from "../../modularui/Authenticate";
|
|
|
9
9
|
|
|
10
10
|
import type { Dispatch, GetState, ThunkAction } from "../types";
|
|
11
11
|
import type FormModel from "../../models/form/FormModel";
|
|
12
|
-
import type {
|
|
12
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Go back to previous object (back button on form)
|
|
16
16
|
*/
|
|
17
|
-
export const previousObject = (form: FormModel):
|
|
17
|
+
export const previousObject = (form: FormModel): UpdateFormAction => {
|
|
18
18
|
const newForm = form.clone();
|
|
19
19
|
|
|
20
20
|
newForm.setPreviousObject();
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return updateForm(newForm);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","names":["previousObject","form","newForm","clone","setPreviousObject","
|
|
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.
|
|
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 {
|
|
2
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
3
3
|
|
|
4
4
|
import { getSetting } from "../../constants/Settings";
|
|
5
5
|
|
|
@@ -68,5 +68,6 @@ export const updateFormAttribute =
|
|
|
68
68
|
// server form validations happens async, don't wait for the form to return
|
|
69
69
|
dispatch(validateFormObject(newForm));
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
return dispatch(updateForm(newForm));
|
|
72
73
|
};
|
|
@@ -1 +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","
|
|
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.
|
|
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.
|
|
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.
|
|
32
|
+
return (0, _ModularUIActions.updateForm)(newForm);
|
|
33
33
|
};
|
|
34
34
|
exports.removeRepeatableAttributeSet = removeRepeatableAttributeSet;
|
|
35
35
|
//# sourceMappingURL=FormAttributeSetRepeatable.js.map
|
|
@@ -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"}
|
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
|
@@ -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
|
}
|
|
@@ -66,8 +66,8 @@ class ChoiceAttributeOptionModel
|
|
|
66
66
|
const option = new ChoiceAttributeOptionModel();
|
|
67
67
|
|
|
68
68
|
option.code = listitem.id.toString();
|
|
69
|
-
option.attributeCollection = listitem.attributeCollection;
|
|
70
|
-
option.links = listitem.links;
|
|
69
|
+
option.attributeCollection = listitem.attributeCollection.clone();
|
|
70
|
+
option.links = listitem.links.clone();
|
|
71
71
|
|
|
72
72
|
return option;
|
|
73
73
|
}
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
SetModelAction,
|
|
13
13
|
InitModelAction,
|
|
14
14
|
UpdateModelAction,
|
|
15
|
+
UpdateFormAction,
|
|
15
16
|
RemoveModelByKeyAction,
|
|
16
17
|
ResetModularUIAction,
|
|
17
18
|
UpdateStatusAction,
|
|
@@ -51,6 +52,13 @@ export const updateModel = (model: ModularUIModel): UpdateModelAction => ({
|
|
|
51
52
|
payload: model,
|
|
52
53
|
});
|
|
53
54
|
|
|
55
|
+
/**
|
|
56
|
+
*/
|
|
57
|
+
export const updateForm = (model: ModularUIModel): UpdateFormAction => ({
|
|
58
|
+
type: "MODULARUI/UPDATE_FORM",
|
|
59
|
+
payload: model,
|
|
60
|
+
});
|
|
61
|
+
|
|
54
62
|
/**
|
|
55
63
|
*/
|
|
56
64
|
export const removeModelByKey = (key: string): RemoveModelByKeyAction => ({
|
|
@@ -144,6 +144,7 @@ export const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (
|
|
|
144
144
|
return setModel(state, action.payload);
|
|
145
145
|
|
|
146
146
|
case "MODULARUI/UPDATE":
|
|
147
|
+
case "MODULARUI/UPDATE_FORM":
|
|
147
148
|
return updateModel(state, action.payload);
|
|
148
149
|
|
|
149
150
|
case "MODULARUI/REMOVE_KEY":
|
|
@@ -49,6 +49,11 @@ export type UpdateModelAction = {
|
|
|
49
49
|
payload: ModularUIModel,
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
export type UpdateFormAction = {
|
|
53
|
+
type: "MODULARUI/UPDATE_FORM",
|
|
54
|
+
payload: ModularUIModel,
|
|
55
|
+
};
|
|
56
|
+
|
|
52
57
|
export type SuccessAction = (
|
|
53
58
|
model: ModularUIModel
|
|
54
59
|
) => UpdateModelAction | SetModelAction;
|