@beinformed/ui 1.27.4 → 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 +12 -0
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +10 -16
- package/esm/models/actions/ActionCollection.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/actions/ActionCollection.js +10 -16
- package/lib/models/actions/ActionCollection.js.flow +12 -20
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/__tests__/ActionCollection.spec.js.flow +16 -4
- 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/actions/ActionCollection.js +12 -20
- package/src/models/actions/__tests__/ActionCollection.spec.js +16 -4
- 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":"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 = (
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import BaseCollection from "../base/BaseCollection";
|
|
3
3
|
import ActionModel from "./ActionModel";
|
|
4
|
-
import { IllegalArgumentException } from "../../exceptions";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Collection of actions
|
|
@@ -11,28 +10,21 @@ export default class ActionCollection extends BaseCollection<ActionModel> {
|
|
|
11
10
|
super();
|
|
12
11
|
|
|
13
12
|
// no actions gives an empty collection
|
|
14
|
-
if (!actions) {
|
|
13
|
+
if (!Array.isArray(actions)) {
|
|
15
14
|
this.collection = [];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const contributions = actionsContributions.find(
|
|
26
|
-
(actionContribution) => actionContribution.name === action.name
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
if (contributions) {
|
|
30
|
-
return new ActionModel(action, contributions);
|
|
31
|
-
}
|
|
15
|
+
} else if (Array.isArray(actionsContributions)) {
|
|
16
|
+
const actionModels = [];
|
|
17
|
+
for (const actionData of actions) {
|
|
18
|
+
const actionContribution = actionsContributions.find(
|
|
19
|
+
(actionContribution) => actionContribution.name === actionData.name
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
if (actionContribution) {
|
|
23
|
+
actionModels.push(new ActionModel(actionData, actionContribution));
|
|
32
24
|
}
|
|
25
|
+
}
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
});
|
|
27
|
+
this.collection = actionModels;
|
|
36
28
|
}
|
|
37
29
|
}
|
|
38
30
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ActionCollection from "../ActionCollection";
|
|
2
2
|
import ActionModel from "../ActionModel";
|
|
3
|
-
import { IllegalArgumentException } from "../../../exceptions";
|
|
4
3
|
|
|
5
4
|
describe("actionCollection", () => {
|
|
6
5
|
const collectionData = [
|
|
@@ -62,9 +61,8 @@ describe("actionCollection", () => {
|
|
|
62
61
|
});
|
|
63
62
|
|
|
64
63
|
it("should throw an error when action data is available but no contributions", () => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}).toThrow(IllegalArgumentException);
|
|
64
|
+
const coll = new ActionCollection(collectionData);
|
|
65
|
+
expect(coll).toHaveLength(0);
|
|
68
66
|
});
|
|
69
67
|
|
|
70
68
|
it("should be able to create an ActionCollection with standard modular ui json", () => {
|
|
@@ -83,4 +81,18 @@ describe("actionCollection", () => {
|
|
|
83
81
|
ActionModel
|
|
84
82
|
);
|
|
85
83
|
});
|
|
84
|
+
|
|
85
|
+
it("should be able to create an ActionCollection with part of contributions available", () => {
|
|
86
|
+
const actionCollection = new ActionCollection(collectionData, [
|
|
87
|
+
{
|
|
88
|
+
name: "sample2",
|
|
89
|
+
label: "Example of an action by layouthint",
|
|
90
|
+
type: "generic",
|
|
91
|
+
layouthint: ["testaction"],
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
expect(actionCollection).toHaveLength(1);
|
|
96
|
+
expect(actionCollection.getActionsByType("form")).toHaveLength(0);
|
|
97
|
+
});
|
|
86
98
|
});
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import { goBack } from "../_router/RouterActions";
|
|
3
|
-
import {
|
|
3
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
4
4
|
import { logoutSuccess } from "./SignOut";
|
|
5
5
|
import { reloadApplication } from "./Application";
|
|
6
6
|
import { startProgress, finishProgress } from "./ProgressIndicator";
|
|
@@ -9,17 +9,17 @@ import Authenticate from "../../modularui/Authenticate";
|
|
|
9
9
|
|
|
10
10
|
import type { Dispatch, GetState, ThunkAction } from "../types";
|
|
11
11
|
import type FormModel from "../../models/form/FormModel";
|
|
12
|
-
import type {
|
|
12
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Go back to previous object (back button on form)
|
|
16
16
|
*/
|
|
17
|
-
export const previousObject = (form: FormModel):
|
|
17
|
+
export const previousObject = (form: FormModel): UpdateFormAction => {
|
|
18
18
|
const newForm = form.clone();
|
|
19
19
|
|
|
20
20
|
newForm.setPreviousObject();
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return updateForm(newForm);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
3
3
|
|
|
4
4
|
import { getSetting } from "../../constants/Settings";
|
|
5
5
|
|
|
@@ -68,5 +68,6 @@ export const updateFormAttribute =
|
|
|
68
68
|
// server form validations happens async, don't wait for the form to return
|
|
69
69
|
dispatch(validateFormObject(newForm));
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
return dispatch(updateForm(newForm));
|
|
72
73
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
3
3
|
|
|
4
4
|
import type FormModel from "../../models/form/FormModel";
|
|
5
5
|
import type FormObjectModel from "../../models/form/FormObjectModel";
|
|
6
|
-
import type {
|
|
6
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*/
|
|
10
10
|
export const addRepeatableAttributeSet = (
|
|
11
11
|
form: FormModel
|
|
12
|
-
):
|
|
12
|
+
): UpdateFormAction => {
|
|
13
13
|
const newForm = form.clone();
|
|
14
14
|
|
|
15
15
|
newForm.addEmptyFormObject();
|
|
16
16
|
|
|
17
|
-
return
|
|
17
|
+
return updateForm(newForm);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -22,13 +22,13 @@ export const addRepeatableAttributeSet = (
|
|
|
22
22
|
export const cancelRepeatableAttributeSet = (
|
|
23
23
|
form: FormModel,
|
|
24
24
|
formObject: FormObjectModel
|
|
25
|
-
):
|
|
25
|
+
): UpdateFormAction => {
|
|
26
26
|
const newForm = form.clone();
|
|
27
27
|
|
|
28
28
|
newForm.addEmptyFormObject();
|
|
29
29
|
newForm.removeFormObject(formObject);
|
|
30
30
|
|
|
31
|
-
return
|
|
31
|
+
return updateForm(newForm);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -36,10 +36,10 @@ export const cancelRepeatableAttributeSet = (
|
|
|
36
36
|
export const removeRepeatableAttributeSet = (
|
|
37
37
|
form: FormModel,
|
|
38
38
|
formObject: FormObjectModel
|
|
39
|
-
):
|
|
39
|
+
): UpdateFormAction => {
|
|
40
40
|
const newForm = form.clone();
|
|
41
41
|
|
|
42
42
|
newForm.removeFormObject(formObject);
|
|
43
43
|
|
|
44
|
-
return
|
|
44
|
+
return updateForm(newForm);
|
|
45
45
|
};
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
AUTOSAVE_STATUS,
|
|
11
11
|
} from "../../constants/Constants";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
14
14
|
|
|
15
15
|
import type { UpdateAutosaveAction, ThunkAction, Dispatch } from "../types";
|
|
16
16
|
|
|
@@ -49,7 +49,7 @@ const autosave = (dispatch: Dispatch, form: FormModel) => {
|
|
|
49
49
|
// send the existing form to prevent updates in the ui based on autosave results
|
|
50
50
|
form.lastServerUpdate = savedForm.lastServerUpdate;
|
|
51
51
|
|
|
52
|
-
dispatch(
|
|
52
|
+
dispatch(updateForm(form));
|
|
53
53
|
dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));
|
|
54
54
|
}
|
|
55
55
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import debounce from "lodash/debounce";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { updateForm } from "../_modularui/ModularUIActions";
|
|
5
5
|
|
|
6
6
|
import ModularUIRequest from "../../modularui/ModularUIRequest";
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ const updateValidations =
|
|
|
30
30
|
validatedForm.updateValidations(formWithValidations.data);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
dispatch(
|
|
33
|
+
dispatch(updateForm(validatedForm));
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -16,10 +16,7 @@ import type { AbstractComponent } from "react";
|
|
|
16
16
|
import type FormModel from "../../models/form/FormModel";
|
|
17
17
|
import type { ContextRouter } from "react-router";
|
|
18
18
|
import type { ReduxState, ThunkAction } from "../types";
|
|
19
|
-
import type {
|
|
20
|
-
ModularUIConnector,
|
|
21
|
-
UpdateModelAction,
|
|
22
|
-
} from "../_modularui/types";
|
|
19
|
+
import type { ModularUIConnector, UpdateFormAction } from "../_modularui/types";
|
|
23
20
|
|
|
24
21
|
type OwnProps = {
|
|
25
22
|
...?ContextRouter,
|
|
@@ -33,7 +30,7 @@ type StateProps = {
|
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
type DispatchProps = {
|
|
36
|
-
onPrevious: (form: FormModel) =>
|
|
33
|
+
onPrevious: (form: FormModel) => UpdateFormAction,
|
|
37
34
|
onCancel: (form: FormModel) => ThunkAction,
|
|
38
35
|
showFormNotification: (form: FormModel) => ThunkAction,
|
|
39
36
|
};
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
} from "../actions/FormAttributeSetRepeatable";
|
|
10
10
|
|
|
11
11
|
import type { ThunkAction, UpdateFormOptions } from "../types";
|
|
12
|
-
import type {
|
|
12
|
+
import type { UpdateFormAction } from "../_modularui/types";
|
|
13
13
|
import type { AttributeType } from "../../models/types";
|
|
14
14
|
import type FormModel from "../../models/form/FormModel";
|
|
15
15
|
import type FormObjectModel from "../../models/form/FormObjectModel";
|
|
16
16
|
import type { DispatchAPI } from "redux";
|
|
17
17
|
import type { ComponentType } from "react";
|
|
18
18
|
|
|
19
|
-
type Dispatch = DispatchAPI<
|
|
19
|
+
type Dispatch = DispatchAPI<UpdateFormAction> & DispatchAPI<ThunkAction>;
|
|
20
20
|
|
|
21
21
|
type OwnProps = {
|
|
22
22
|
form: FormModel,
|
|
@@ -32,9 +32,9 @@ type DispatchProps = {
|
|
|
32
32
|
value: string,
|
|
33
33
|
options: UpdateFormOptions
|
|
34
34
|
) => ThunkAction,
|
|
35
|
-
onAddAttributeSetClick: () =>
|
|
36
|
-
onCancelAttributeSetClick: (formObject: FormObjectModel) =>
|
|
37
|
-
onRemoveAttributeSetClick: (formObject: FormObjectModel) =>
|
|
35
|
+
onAddAttributeSetClick: () => UpdateFormAction,
|
|
36
|
+
onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
|
|
37
|
+
onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
type Props = {
|
package/src/redux/types.js
CHANGED
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
UpdateStatusAction,
|
|
22
22
|
SetModelAction,
|
|
23
23
|
UpdateModelAction,
|
|
24
|
+
UpdateFormAction,
|
|
24
25
|
RemoveModelByKeyAction,
|
|
25
26
|
ResetModularUIAction,
|
|
26
27
|
InitModelAction,
|
|
@@ -138,6 +139,7 @@ export type ReduxAction =
|
|
|
138
139
|
| SetModelAction
|
|
139
140
|
| InitModelAction
|
|
140
141
|
| UpdateModelAction
|
|
142
|
+
| UpdateFormAction
|
|
141
143
|
| RemoveModelByKeyAction
|
|
142
144
|
| ResetModularUIAction
|
|
143
145
|
| SaveErrorAction
|