@arquimedes.co/eureka-forms 1.9.134 → 2.0.1-test
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/dist/@Types/Form.d.ts +1 -1
- package/dist/@Types/FormStep.d.ts +2 -2
- package/dist/@Types/GenericFormSteps.d.ts +1 -0
- package/dist/App/App.css +6 -0
- package/dist/{App.d.ts → App/App.d.ts} +13 -21
- package/dist/App/App.js +76 -0
- package/dist/App/AppFunctions.d.ts +17 -0
- package/dist/App/AppFunctions.js +210 -0
- package/dist/App/AppHooks.d.ts +10 -0
- package/dist/App/AppHooks.js +235 -0
- package/dist/Contexts/CustomContext.d.ts +11 -0
- package/dist/Contexts/CustomContext.js +6 -0
- package/dist/Contexts/FormContext.d.ts +4 -0
- package/dist/Contexts/FormContext.js +19 -0
- package/dist/Contexts/SectionContext.d.ts +3 -0
- package/dist/Contexts/SectionContext.js +3 -0
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.d.ts +2 -4
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +3 -1
- package/dist/Form/Form.d.ts +17 -34
- package/dist/Form/Form.js +73 -124
- package/dist/Form/FormFunctions.d.ts +5 -4
- package/dist/Form/FormFunctions.js +24 -25
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +1 -1
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +34 -58
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.module.css +0 -4
- package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +1 -1
- package/dist/Form/FormTypes/StepperForm/StepperForm.js +122 -3
- package/dist/Form/FormTypes/StepperForm/StepperForm.module.css +53 -0
- package/dist/Form/Hooks.d.ts +9 -0
- package/dist/Form/Hooks.js +7 -0
- package/dist/Form/Section/MaterialSection/MaterialSection.d.ts +1 -1
- package/dist/Form/Section/MaterialSection/MaterialSection.js +15 -16
- package/dist/Form/Section/Section.d.ts +2 -34
- package/dist/Form/Section/Section.js +11 -5
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.d.ts +1 -1
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +19 -14
- package/dist/Form/Terms/Term/Term.d.ts +1 -8
- package/dist/Form/Terms/Term/Term.js +3 -1
- package/dist/Form/Terms/Terms.d.ts +1 -2
- package/dist/Form/Terms/Terms.js +17 -8
- package/dist/Form/Terms/Terms.module.css +3 -0
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.d.ts +3 -3
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +49 -38
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +3 -1
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +2 -2
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +11 -5
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +29 -27
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.module.css +0 -6
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +39 -31
- package/dist/FormSteps/AYFStepMapper.js +42 -43
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.d.ts +1 -1
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.js +4 -14
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +84 -97
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.module.css +0 -9
- package/dist/FormSteps/CBRStepMapper.js +78 -74
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.d.ts +1 -1
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.js +4 -14
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +33 -26
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +17 -0
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +1 -1
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.js +4 -14
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +34 -27
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.d.ts +1 -1
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.js +4 -2
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +16 -11
- package/dist/FormSteps/CustomStep.d.ts +22 -0
- package/dist/FormSteps/CustomStep.js +37 -0
- package/dist/FormSteps/DatePickerStep/DatePickerStep.js +3 -1
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +1 -1
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +26 -14
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.d.ts +1 -1
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.js +4 -14
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +93 -112
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css +0 -9
- package/dist/FormSteps/FileUploadStep/FileUploadStep.js +3 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +1 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +1 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +0 -7
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +32 -18
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +0 -7
- package/dist/FormSteps/MapperStep/MapperStep.d.ts +2 -2
- package/dist/FormSteps/MapperStep/MapperStep.js +4 -14
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.d.ts +1 -9
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +7 -2
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +3 -2
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElement.js +18 -10
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +1 -9
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +7 -2
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +1 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +44 -228
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +0 -7
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +30 -14
- package/dist/FormSteps/RatingStep/RatingStep.js +3 -1
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +36 -26
- package/dist/FormSteps/SelectorStep/SelectorStep.d.ts +1 -1
- package/dist/FormSteps/SelectorStep/SelectorStep.js +4 -14
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +1 -1
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +3 -1
- package/dist/FormSteps/SeparatorStep/SeparatorStep.d.ts +1 -1
- package/dist/FormSteps/SeparatorStep/SeparatorStep.js +4 -14
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +5 -2
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +119 -199
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +9 -10
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.js +3 -1
- package/dist/FormSteps/Step.d.ts +3 -4
- package/dist/FormSteps/Step.js +12 -8
- package/dist/FormSteps/StepFunctions.d.ts +10 -0
- package/dist/FormSteps/StepFunctions.js +156 -1
- package/dist/FormSteps/StepHooks.d.ts +23 -0
- package/dist/FormSteps/StepHooks.js +87 -0
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.d.ts +10 -0
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +148 -0
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +1 -6
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +40 -186
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +0 -9
- package/dist/FormSteps/TextAreaStep/TextAreaStep.js +8 -2
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +1 -1
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +43 -42
- package/dist/FormSteps/TextInputStep/TextInputStep.js +3 -1
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +11 -6
- package/dist/FormSteps/TitleStep/TitleStep.d.ts +1 -1
- package/dist/FormSteps/TitleStep/TitleStep.js +4 -14
- package/dist/Icons/Construction/LeakIcon.d.ts +2 -2
- package/dist/Icons/Construction/LeakIcon.js +2 -1
- package/dist/Icons/Construction/ProjectIcon.d.ts +2 -2
- package/dist/Icons/Construction/ProjectIcon.js +2 -1
- package/dist/Icons/Construction/PropertyIcon.d.ts +2 -2
- package/dist/Icons/Construction/PropertyIcon.js +2 -1
- package/dist/Icons/Construction/SpaceIcon.d.ts +2 -2
- package/dist/Icons/Construction/SpaceIcon.js +2 -1
- package/dist/Icons/DocumentIcon.d.ts +2 -2
- package/dist/Icons/DocumentIcon.js +2 -1
- package/dist/Icons/Entities/CheckListIcon.d.ts +2 -2
- package/dist/Icons/Entities/CheckListIcon.js +2 -1
- package/dist/Icons/Entities/GenericEntityIcon.d.ts +2 -1
- package/dist/Icons/Entities/GenericEntityIcon.js +1 -1
- package/dist/Icons/Entities/HandshakeIcon.d.ts +2 -1
- package/dist/Icons/Entities/HandshakeIcon.js +1 -1
- package/dist/Icons/Entities/SupplierIcon.d.ts +2 -1
- package/dist/Icons/Entities/SupplierIcon.js +4 -1
- package/dist/{controllers → Services}/FileService.d.ts +1 -1
- package/dist/{controllers → Services}/FileService.js +5 -5
- package/dist/Services/FormService.d.ts +5 -0
- package/dist/Services/FormService.js +59 -0
- package/dist/Services/OrganizationService.d.ts +2 -0
- package/dist/Services/OrganizationService.js +65 -0
- package/dist/Shared/Navbar/Navbar.module.css +8 -0
- package/dist/{shared → Shared}/Rating/Rating.d.ts +1 -1
- package/dist/Shared/Rating/Rating.module.css +18 -0
- package/dist/{shared → Shared}/Rating/Ratings/LikeRating.js +5 -5
- package/dist/{shared → Shared}/Rating/Ratings/SatisfactionRating.js +9 -9
- package/dist/{shared → Shared}/Rating/Ratings/ScaleRating.js +1 -2
- package/dist/{shared → Shared}/RoundedCheckBox/RoundedCheckBox.d.ts +1 -1
- package/dist/{shared → Shared}/RoundedSmartSelect/RoundedSmartSelect.js +4 -4
- package/dist/{shared → Shared}/RoundedTextField/RoundedTextField.d.ts +1 -1
- package/dist/{shared → Shared}/RoundedTextField/RoundedTextField.js +3 -2
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.d.ts +24 -0
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +25 -0
- package/dist/States/GlobalStateReducer.d.ts +35 -0
- package/dist/States/GlobalStateReducer.js +34 -0
- package/dist/States/SiteStateReducer.d.ts +63 -0
- package/dist/States/SiteStateReducer.js +110 -0
- package/dist/States/WidthStatsStateReducer.d.ts +11 -0
- package/dist/States/WidthStatsStateReducer.js +64 -0
- package/dist/Utils/DraftFunctions.d.ts +3 -0
- package/dist/Utils/DraftFunctions.js +42 -0
- package/dist/Utils/MaterialProviders.d.ts +6 -0
- package/dist/Utils/MaterialProviders.js +31 -0
- package/dist/Utils/store.d.ts +25 -0
- package/dist/Utils/store.js +52 -0
- package/dist/Widget.js +3 -3
- package/dist/constants/CBRFormStepTypes.d.ts +2 -2
- package/dist/constants/CBRFormStepTypes.js +22 -22
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.js +7 -0
- package/dist/index.js +1 -1
- package/dist/index.lib.d.ts +1 -1
- package/dist/index.lib.js +1 -1
- package/package.json +63 -44
- package/dist/App.js +0 -472
- package/dist/shared/Navbar/Navbar.module.css +0 -18
- package/dist/shared/Rating/Rating.module.css +0 -32
- package/dist/{App.module.css → App/App.module.css} +0 -0
- package/dist/{shared → Shared}/InputIcon/InputIcon.d.ts +0 -0
- package/dist/{shared → Shared}/InputIcon/InputIcon.js +0 -0
- package/dist/{shared → Shared}/Loader/Loader.d.ts +0 -0
- package/dist/{shared → Shared}/Loader/Loader.js +0 -0
- package/dist/{shared → Shared}/Loader/Loader.module.css +0 -0
- package/dist/{shared → Shared}/Navbar/Navbar.d.ts +0 -0
- package/dist/{shared → Shared}/Navbar/Navbar.js +0 -0
- package/dist/{shared → Shared}/Rating/Rating.js +2 -2
- /package/dist/{shared → Shared}/Rating/Ratings/LikeRating.d.ts +0 -0
- /package/dist/{shared → Shared}/Rating/Ratings/SatisfactionRating.d.ts +0 -0
- /package/dist/{shared → Shared}/Rating/Ratings/ScaleRating.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedButton/RoundedButton.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedButton/RoundedButton.js +0 -0
- /package/dist/{shared → Shared}/RoundedCheckBox/RoundedCheckBox.js +0 -0
- /package/dist/{shared → Shared}/RoundedDatePicker/RoundedDatePicker.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedDatePicker/RoundedDatePicker.js +0 -0
- /package/dist/{shared → Shared}/RoundedSelect/RoundedSelect.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedSelect/RoundedSelect.js +0 -0
- /package/dist/{shared → Shared}/RoundedSmartSelect/RoundedSmartSelect.d.ts +0 -0
- /package/dist/{AxiosAPI.d.ts → Utils/AxiosAPI.d.ts} +0 -0
- /package/dist/{AxiosAPI.js → Utils/AxiosAPI.js} +0 -0
- /package/dist/{AxiosWidget.d.ts → Utils/AxiosWidget.d.ts} +0 -0
- /package/dist/{AxiosWidget.js → Utils/AxiosWidget.js} +0 -0
- /package/dist/{utils/CbrFunctions.d.ts → Utils/CBRFunctions.d.ts} +0 -0
- /package/dist/{utils/CbrFunctions.js → Utils/CBRFunctions.js} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
var FormContext = createContext({
|
|
3
|
+
firstSection: 'FIRST',
|
|
4
|
+
sections: {
|
|
5
|
+
FIRST: {
|
|
6
|
+
id: 'FIRST',
|
|
7
|
+
name: 'FIRST',
|
|
8
|
+
steps: [],
|
|
9
|
+
nextSection: null,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
steps: {},
|
|
13
|
+
size: {
|
|
14
|
+
blockSize: 0,
|
|
15
|
+
blockNum: 4,
|
|
16
|
+
spacingSize: 0,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export default FormContext;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FormStyle } from '../../@Types/Form';
|
|
3
2
|
interface ConfirmationDialogProps {
|
|
4
3
|
confirmation: {
|
|
5
4
|
case: string;
|
|
6
5
|
url: string;
|
|
7
6
|
};
|
|
8
|
-
onClose:
|
|
9
|
-
formStyle: FormStyle;
|
|
7
|
+
onClose: () => void;
|
|
10
8
|
}
|
|
11
|
-
declare function ConfirmationDialog({ confirmation,
|
|
9
|
+
declare function ConfirmationDialog({ confirmation, onClose, }: ConfirmationDialogProps): JSX.Element;
|
|
12
10
|
export default ConfirmationDialog;
|
|
@@ -14,8 +14,10 @@ import CheckCircleOutlineRoundedIcon from '@material-ui/icons/CheckCircleOutline
|
|
|
14
14
|
import styles from './ConfirmationDialog.module.css';
|
|
15
15
|
import Dialog from '@material-ui/core/Dialog';
|
|
16
16
|
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
|
|
17
|
+
import { useAppSelector } from '../../hooks';
|
|
17
18
|
function ConfirmationDialog(_a) {
|
|
18
|
-
var confirmation = _a.confirmation,
|
|
19
|
+
var confirmation = _a.confirmation, onClose = _a.onClose;
|
|
20
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
19
21
|
return (_jsx(Dialog, __assign({ PaperProps: {
|
|
20
22
|
style: {
|
|
21
23
|
borderRadius: '20px',
|
package/dist/Form/Form.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Organization } from '../@Types/@Types';
|
|
3
|
-
import { Form, FormStyle } from '../@Types/Form';
|
|
4
|
-
import { CustomStep } from '../App';
|
|
5
2
|
import { Branding } from '../@Types/Branding';
|
|
6
3
|
import StepTypes from '../constants/FormStepTypes';
|
|
7
|
-
import { FieldValues
|
|
4
|
+
import { FieldValues } from 'react-hook-form';
|
|
5
|
+
import { AppProps } from '../App/App';
|
|
6
|
+
import CBRFormStepTypes from '../constants/CBRFormStepTypes';
|
|
7
|
+
import { Form } from '../@Types';
|
|
8
|
+
import { FormStep } from '../@Types/FormStep';
|
|
9
|
+
import { CBRFormStep } from '../@Types/CBRFormStep';
|
|
8
10
|
export declare const getLocale: () => any;
|
|
9
11
|
export interface StepDependency {
|
|
12
|
+
dependents: (FormStep | CBRFormStep)[];
|
|
10
13
|
value: any | undefined;
|
|
11
|
-
type: StepTypes | 'ORIGINAL';
|
|
14
|
+
type: StepTypes | CBRFormStepTypes | 'ORIGINAL';
|
|
12
15
|
empty?: boolean;
|
|
13
16
|
}
|
|
14
17
|
export type DependencyStore = Record<string, StepDependency>;
|
|
@@ -17,39 +20,19 @@ export interface WidthStats {
|
|
|
17
20
|
isResponsive: boolean;
|
|
18
21
|
isMobile: boolean;
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
type CustomAppProps = Pick<AppProps, 'customSteps' | 'customSubmitBtns'>;
|
|
24
|
+
export interface BaseFormProps extends CustomAppProps {
|
|
21
25
|
form: Form;
|
|
22
|
-
formController: UseFormReturn;
|
|
23
|
-
organization: Organization;
|
|
24
26
|
branding?: Branding;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
customStepProps: Record<string, any>;
|
|
28
|
-
customSend?: (values: any, reload: Function) => Promise<any>;
|
|
29
|
-
customSubmit?: JSX.Element;
|
|
30
|
-
widthStats: WidthStats;
|
|
31
|
-
internal: boolean;
|
|
32
|
-
reload: Function;
|
|
33
|
-
partial: boolean;
|
|
34
|
-
postview: boolean;
|
|
35
|
-
preview: boolean;
|
|
36
|
-
formStyle: FormStyle;
|
|
37
|
-
domain?: string;
|
|
27
|
+
reload: () => void;
|
|
28
|
+
isWidget: boolean;
|
|
38
29
|
apiKey: string | undefined;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/** The custom send label to display */
|
|
44
|
-
sendLabel?: string;
|
|
30
|
+
customSubmit: AppProps['customSubmit'];
|
|
31
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
32
|
+
}
|
|
33
|
+
export interface FormComponentProps extends CustomAppProps {
|
|
45
34
|
/** Function called when users clicks submit */
|
|
46
35
|
onSubmit: (values: FieldValues) => Promise<any>;
|
|
47
|
-
dependencyStore: DependencyStore;
|
|
48
|
-
setDependencyStore: React.Dispatch<React.SetStateAction<DependencyStore>>;
|
|
49
36
|
}
|
|
50
|
-
declare function FormComponent({ form,
|
|
51
|
-
containerRef: any;
|
|
52
|
-
organization: Organization | null;
|
|
53
|
-
isWidget: boolean;
|
|
54
|
-
}): JSX.Element;
|
|
37
|
+
declare function FormComponent({ form, apiKey, reload, isWidget, branding, customSteps, containerRef, customSubmit, customSubmitBtns, }: BaseFormProps): JSX.Element;
|
|
55
38
|
export default FormComponent;
|
package/dist/Form/Form.js
CHANGED
|
@@ -45,20 +45,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
t[p] = s[p];
|
|
52
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
-
t[p[i]] = s[p[i]];
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
};
|
|
59
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
60
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
61
|
-
import Navbar from '../shared/Navbar/Navbar';
|
|
48
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
49
|
+
import React, { useCallback, useContext, useEffect, useRef, useState, } from 'react';
|
|
50
|
+
import Navbar from '../Shared/Navbar/Navbar';
|
|
62
51
|
import styles from './Form.module.css';
|
|
63
52
|
import InternalFormStyle from '../constants/InternalFormStyle';
|
|
64
53
|
import enLocale from 'date-fns/locale/en-US';
|
|
@@ -66,16 +55,18 @@ import esLocale from 'date-fns/locale/es';
|
|
|
66
55
|
import ColumnForm from './FormTypes/ColumnForm/ColumnForm';
|
|
67
56
|
import StepperForm from './FormTypes/StepperForm/StepperForm';
|
|
68
57
|
import { FormStyleTypes, FormTypes, } from '../constants/FormStepTypes';
|
|
69
|
-
import {
|
|
70
|
-
import
|
|
71
|
-
import
|
|
72
|
-
import
|
|
73
|
-
import { calcDependencies, calcValue } from './FormFunctions';
|
|
74
|
-
import { useForm } from 'react-hook-form';
|
|
75
|
-
import widgetInstance from '../AxiosWidget';
|
|
76
|
-
import axiosInstance from '../AxiosAPI';
|
|
58
|
+
import { calcValue } from './FormFunctions';
|
|
59
|
+
import { FormProvider, useForm } from 'react-hook-form';
|
|
60
|
+
import widgetInstance from '../Utils/AxiosWidget';
|
|
61
|
+
import axiosInstance from '../Utils/AxiosAPI';
|
|
77
62
|
import ReCAPTCHA from 'react-google-recaptcha';
|
|
78
63
|
import ConfirmationDialog from './ConfirmationDialog/ConfirmationDialog';
|
|
64
|
+
import MaterialProviders from '../Utils/MaterialProviders';
|
|
65
|
+
import { useWidthStats } from '../States/WidthStatsStateReducer';
|
|
66
|
+
import { useAppDispatch, useAppSelector } from '../hooks';
|
|
67
|
+
import FormContext from '../Contexts/FormContext';
|
|
68
|
+
import { getAppState } from '../Utils/store';
|
|
69
|
+
import { focusStep } from '../States/SiteStateReducer';
|
|
79
70
|
var localeMap = {
|
|
80
71
|
en: enLocale,
|
|
81
72
|
'en-US': enLocale,
|
|
@@ -91,38 +82,46 @@ export var getLocale = function () {
|
|
|
91
82
|
};
|
|
92
83
|
function FormComponent(_a) {
|
|
93
84
|
var _this = this;
|
|
94
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
95
|
-
var form = _a.form,
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
var formController = useForm({
|
|
99
|
-
defaultValues: originalValues,
|
|
85
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
86
|
+
var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, isWidget = _a.isWidget, branding = _a.branding, customSteps = _a.customSteps, containerRef = _a.containerRef, customSubmit = _a.customSubmit, customSubmitBtns = _a.customSubmitBtns;
|
|
87
|
+
var _l = useAppSelector(function (state) { return state.global; }), idOrganization = _l.idOrganization, internal = _l.internal, postview = _l.postview;
|
|
88
|
+
var formMethods = useForm({
|
|
100
89
|
mode: 'onTouched',
|
|
101
90
|
shouldFocusError: true,
|
|
102
91
|
});
|
|
103
92
|
var recaptchaRef = useRef();
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
|
|
93
|
+
var dispatch = useAppDispatch();
|
|
94
|
+
var _m = useState(), showConfirmation = _m[0], setShowConfirmation = _m[1];
|
|
95
|
+
var idFocusStep = useAppSelector(function (state) { return state.site.focusStep; });
|
|
96
|
+
useEffect(function () {
|
|
97
|
+
if (idFocusStep) {
|
|
98
|
+
formMethods.setFocus(idFocusStep);
|
|
99
|
+
dispatch(focusStep(undefined));
|
|
100
|
+
}
|
|
101
|
+
}, [idFocusStep]);
|
|
102
|
+
var onSubmit = useCallback(function (values) { return __awaiter(_this, void 0, void 0, function () {
|
|
103
|
+
var token, state, newValues, deleteIds, _i, _a, idStep, _b, deleteIds_1, id, params, url, axios, resp, error_1;
|
|
107
104
|
return __generator(this, function (_c) {
|
|
108
105
|
switch (_c.label) {
|
|
109
106
|
case 0:
|
|
110
|
-
values = __assign(__assign({}, originalValues), values);
|
|
111
107
|
token = null;
|
|
112
|
-
if (!(form.hasCaptcha && !internal && !
|
|
113
|
-
|
|
114
|
-
if (!!
|
|
108
|
+
if (!(form.hasCaptcha && !internal && !customSubmit)) return [3 /*break*/, 2];
|
|
109
|
+
token = recaptchaRef.current.getValue();
|
|
110
|
+
if (!!token) return [3 /*break*/, 2];
|
|
115
111
|
return [4 /*yield*/, (recaptchaRef === null || recaptchaRef === void 0 ? void 0 : recaptchaRef.current.executeAsync())];
|
|
116
112
|
case 1:
|
|
117
|
-
|
|
113
|
+
token = _c.sent();
|
|
118
114
|
_c.label = 2;
|
|
119
115
|
case 2:
|
|
120
|
-
if (!apiKey && !internal && !
|
|
116
|
+
if (!apiKey && !internal && !customSubmit)
|
|
121
117
|
return [2 /*return*/];
|
|
122
118
|
_c.label = 3;
|
|
123
119
|
case 3:
|
|
124
|
-
_c.trys.push([3,
|
|
125
|
-
|
|
120
|
+
_c.trys.push([3, 8, , 9]);
|
|
121
|
+
return [4 /*yield*/, dispatch(getAppState()).unwrap()];
|
|
122
|
+
case 4:
|
|
123
|
+
state = _c.sent();
|
|
124
|
+
newValues = __assign({}, state.site.values.global);
|
|
126
125
|
deleteIds = [];
|
|
127
126
|
for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
|
|
128
127
|
idStep = _a[_i];
|
|
@@ -132,121 +131,71 @@ function FormComponent(_a) {
|
|
|
132
131
|
id = deleteIds_1[_b];
|
|
133
132
|
delete newValues[id];
|
|
134
133
|
}
|
|
135
|
-
if (!
|
|
136
|
-
return [4 /*yield*/,
|
|
137
|
-
case
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
if (!customSubmit) return [3 /*break*/, 6];
|
|
135
|
+
return [4 /*yield*/, customSubmit(newValues, reload)];
|
|
136
|
+
case 5: return [2 /*return*/, _c.sent()];
|
|
137
|
+
case 6:
|
|
138
|
+
if (customSubmitBtns)
|
|
139
|
+
return [2 /*return*/, newValues];
|
|
141
140
|
params = new URLSearchParams();
|
|
142
|
-
if (
|
|
143
|
-
params.set('idOrganization',
|
|
141
|
+
if (idOrganization || internal)
|
|
142
|
+
params.set('idOrganization', idOrganization !== null && idOrganization !== void 0 ? idOrganization : '');
|
|
144
143
|
if (token)
|
|
145
144
|
params.set('token', token);
|
|
146
145
|
url = "/ticket/".concat(internal ? form.apiKey : apiKey);
|
|
147
146
|
if (params.toString()) {
|
|
148
147
|
url += "?".concat(params.toString());
|
|
149
148
|
}
|
|
150
|
-
axios =
|
|
149
|
+
axios = idOrganization || internal ? widgetInstance : axiosInstance;
|
|
151
150
|
return [4 /*yield*/, axios.post(url, newValues)];
|
|
152
|
-
case
|
|
151
|
+
case 7:
|
|
153
152
|
resp = _c.sent();
|
|
154
153
|
setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
|
|
155
|
-
return [3 /*break*/,
|
|
156
|
-
case
|
|
154
|
+
return [3 /*break*/, 9];
|
|
155
|
+
case 8:
|
|
157
156
|
error_1 = _c.sent();
|
|
158
157
|
console.error(error_1);
|
|
159
|
-
return [3 /*break*/,
|
|
160
|
-
case
|
|
158
|
+
return [3 /*break*/, 9];
|
|
159
|
+
case 9: return [2 /*return*/];
|
|
161
160
|
}
|
|
162
161
|
});
|
|
163
|
-
}); };
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
var handleResize = function () {
|
|
167
|
-
var _a;
|
|
168
|
-
var currentWidth = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
169
|
-
if (currentWidth !== undefined) {
|
|
170
|
-
var currentBreakPoint = form.size.blockNum;
|
|
171
|
-
var padding = postview || internal || !form.isStandAlone ? 0 : 40;
|
|
172
|
-
while (currentWidth <
|
|
173
|
-
(form.size.blockSize + form.size.spacingSize) *
|
|
174
|
-
currentBreakPoint +
|
|
175
|
-
padding) {
|
|
176
|
-
currentBreakPoint--;
|
|
177
|
-
}
|
|
178
|
-
setWidthStats({
|
|
179
|
-
isResponsive: currentWidth <
|
|
180
|
-
(form.size.blockSize + form.size.spacingSize) *
|
|
181
|
-
form.size.blockNum +
|
|
182
|
-
padding,
|
|
183
|
-
isMobile: currentWidth <
|
|
184
|
-
(form.size.blockSize + form.size.spacingSize) * 2 + padding,
|
|
185
|
-
currentBreakPoint: currentBreakPoint,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
useEffect(function () {
|
|
190
|
-
/** On load add a resize listener to calc the currentBreakpoint */
|
|
191
|
-
window.addEventListener('resize', handleResize);
|
|
192
|
-
handleResize();
|
|
193
|
-
return function () {
|
|
194
|
-
window.removeEventListener('resize', handleResize);
|
|
195
|
-
};
|
|
196
|
-
}, [containerRef.current, (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth]);
|
|
197
|
-
var formStyle = useMemo(function () {
|
|
198
|
-
var _a;
|
|
199
|
-
return internal
|
|
200
|
-
? InternalFormStyle
|
|
201
|
-
: __assign(__assign({}, InternalFormStyle), ((_a = form.style) !== null && _a !== void 0 ? _a : {}));
|
|
202
|
-
}, []);
|
|
203
|
-
if (!widthStats)
|
|
204
|
-
return _jsx("div", {});
|
|
162
|
+
}); }, [customSteps, internal, customSubmit, idOrganization]);
|
|
163
|
+
useWidthStats(containerRef, form, postview, internal);
|
|
164
|
+
var isResponsive = useAppSelector(function (state) { return state.widthStats.isResponsive; });
|
|
205
165
|
var renderForm = function () {
|
|
206
|
-
return (_jsxs(React.Fragment, { children: [showConfirmation !== undefined && (_jsx(ConfirmationDialog, {
|
|
207
|
-
|
|
166
|
+
return (_jsxs(React.Fragment, { children: [showConfirmation !== undefined && (_jsx(ConfirmationDialog, { confirmation: showConfirmation, onClose: function () {
|
|
167
|
+
reload();
|
|
208
168
|
setShowConfirmation(undefined);
|
|
209
|
-
} })), form.hasCaptcha && !internal && (_jsx(ReCAPTCHA, { ref: recaptchaRef, sitekey: "6LcL22kkAAAAAEotDeAFbRATob-u5vbibbCyWL2p", size: 'invisible', badge: 'bottomright' })), _jsx(
|
|
169
|
+
} })), form.hasCaptcha && !internal && (_jsx(ReCAPTCHA, { ref: recaptchaRef, sitekey: "6LcL22kkAAAAAEotDeAFbRATob-u5vbibbCyWL2p", size: 'invisible', badge: 'bottomright' })), _jsx(FormProvider, __assign({}, formMethods, { children: _jsx(FormContext.Provider, __assign({ value: form }, { children: _jsx(FormTypeComponent, { onSubmit: onSubmit, customSubmitBtns: customSubmitBtns }) })) }))] }));
|
|
210
170
|
};
|
|
171
|
+
if (!idOrganization)
|
|
172
|
+
return _jsx(_Fragment, {});
|
|
211
173
|
//If currently displaying internal or form is standalone
|
|
212
|
-
if (
|
|
213
|
-
widthStats !== undefined) {
|
|
174
|
+
if (postview || internal || !form.isStandAlone) {
|
|
214
175
|
return (_jsx("div", __assign({ style: {
|
|
215
176
|
backgroundColor: internal
|
|
216
177
|
? 'transparent'
|
|
217
|
-
: (
|
|
178
|
+
: (_c = (_b = form.style) === null || _b === void 0 ? void 0 : _b.backgroundColor) !== null && _c !== void 0 ? _c : InternalFormStyle.backgroundColor,
|
|
218
179
|
minHeight: form.isStandAlone && !isWidget ? '100vh' : '100%',
|
|
219
180
|
} }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: renderForm() })) })));
|
|
220
181
|
}
|
|
221
|
-
else
|
|
182
|
+
else {
|
|
222
183
|
//Standalone cant have widget
|
|
223
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: branding === null || branding === void 0 ? void 0 : branding.images.logoUrl, color: (
|
|
224
|
-
background: (
|
|
225
|
-
} }, { children: _jsx("div", __assign({ className:
|
|
184
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: branding === null || branding === void 0 ? void 0 : branding.images.logoUrl, color: (_e = (_d = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _d === void 0 ? void 0 : _d.navbarColor) !== null && _e !== void 0 ? _e : (_f = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _f === void 0 ? void 0 : _f.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
|
|
185
|
+
background: (_h = (_g = form.style) === null || _g === void 0 ? void 0 : _g.standAloneBackgroundColor) !== null && _h !== void 0 ? _h : '#ffffff',
|
|
186
|
+
} }, { children: _jsx("div", __assign({ className: isResponsive
|
|
226
187
|
? styles.fullScreenStandAloneForm
|
|
227
188
|
: styles.standAloneFormCard, style: {
|
|
228
|
-
backgroundColor: (
|
|
229
|
-
// visibility: loaded ? 'visible' : 'hidden',
|
|
189
|
+
backgroundColor: (_k = (_j = form.style) === null || _j === void 0 ? void 0 : _j.backgroundColor) !== null && _k !== void 0 ? _k : InternalFormStyle.backgroundColor,
|
|
230
190
|
} }, { children: renderForm() })) }))] }));
|
|
231
191
|
}
|
|
232
|
-
else {
|
|
233
|
-
return _jsx("div", {});
|
|
234
|
-
}
|
|
235
192
|
}
|
|
236
193
|
export default FormComponent;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
var generateClassName = createGenerateClassName({
|
|
243
|
-
seed: SEED,
|
|
244
|
-
productionPrefix: 'efjss',
|
|
245
|
-
});
|
|
246
|
-
function FormTypeComponent(_a) {
|
|
247
|
-
var props = __rest(_a, []);
|
|
194
|
+
function FormTypeComponent(props) {
|
|
195
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
196
|
+
var form = useContext(FormContext);
|
|
248
197
|
var renderTypes = function () {
|
|
249
|
-
switch (
|
|
198
|
+
switch (form.type) {
|
|
250
199
|
case FormTypes.STEPPER: {
|
|
251
200
|
return _jsx(StepperForm, __assign({}, props));
|
|
252
201
|
}
|
|
@@ -256,9 +205,9 @@ function FormTypeComponent(_a) {
|
|
|
256
205
|
}
|
|
257
206
|
}
|
|
258
207
|
};
|
|
259
|
-
switch (
|
|
208
|
+
switch (formStyle.type) {
|
|
260
209
|
case FormStyleTypes.MATERIAL:
|
|
261
|
-
return
|
|
210
|
+
return _jsx(MaterialProviders, { children: renderTypes() });
|
|
262
211
|
default:
|
|
263
212
|
return renderTypes();
|
|
264
213
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormStep } from '../@Types/FormStep';
|
|
2
|
-
import { CustomStep } from '../App';
|
|
3
2
|
import { DependencyStore, StepDependency } from './Form';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare
|
|
3
|
+
import { CustomStep } from '../FormSteps/CustomStep';
|
|
4
|
+
import { CBRFormStep } from '../@Types/CBRFormStep';
|
|
5
|
+
export declare const calcValue: (idStep: string, steps: Record<string, FormStep>, values: Record<string, any>, customSteps: Record<string, CustomStep> | undefined, deleteIds: string[], value?: any) => any;
|
|
6
|
+
export declare function calcDependencies(steps: Record<string, FormStep | CBRFormStep>, originalValues?: Record<string, any>, customSteps?: Record<string, CustomStep>, allSteps?: Record<string, FormStep | CBRFormStep>, dependencies?: DependencyStore): DependencyStore;
|
|
7
|
+
export declare function calcStepDependency(idStep: string, steps: Record<string, FormStep | CBRFormStep>, originalValues: Record<string, any>, customSteps: Record<string, CustomStep>): StepDependency;
|
|
@@ -26,7 +26,7 @@ export var calcValue = function (idStep, steps, values, customSteps, deleteIds,
|
|
|
26
26
|
var step = steps[idStep];
|
|
27
27
|
if (!step)
|
|
28
28
|
return value;
|
|
29
|
-
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
29
|
+
var custom = customSteps === null || customSteps === void 0 ? void 0 : customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
30
30
|
if (custom !== undefined) {
|
|
31
31
|
return (_b = (_a = custom.calcValue) === null || _a === void 0 ? void 0 : _a.call(custom, step, value)) !== null && _b !== void 0 ? _b : value;
|
|
32
32
|
}
|
|
@@ -114,6 +114,7 @@ function stringToDraft(text) {
|
|
|
114
114
|
}
|
|
115
115
|
export function calcDependencies(steps, originalValues, customSteps, allSteps, dependencies) {
|
|
116
116
|
var _a, _b, _c;
|
|
117
|
+
if (originalValues === void 0) { originalValues = {}; }
|
|
117
118
|
if (customSteps === void 0) { customSteps = {}; }
|
|
118
119
|
if (allSteps === void 0) { allSteps = steps; }
|
|
119
120
|
if (dependencies === void 0) { dependencies = {}; }
|
|
@@ -122,24 +123,37 @@ export function calcDependencies(steps, originalValues, customSteps, allSteps, d
|
|
|
122
123
|
if (step.dependencies) {
|
|
123
124
|
for (var _e = 0, _f = step.dependencies; _e < _f.length; _e++) {
|
|
124
125
|
var idDep = _f[_e];
|
|
125
|
-
if (dependencies[idDep]
|
|
126
|
+
if (dependencies[idDep] === undefined)
|
|
127
|
+
dependencies[idDep] = calcStepDependency(idDep, allSteps, originalValues, customSteps);
|
|
128
|
+
dependencies[idDep].dependents.push(step);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (step.type === StepTypes.ENTITYVALUEPICKER) {
|
|
132
|
+
for (var _g = 0, _h = __spreadArray(__spreadArray([], step.path, true), step.filters, true); _g < _h.length; _g++) {
|
|
133
|
+
var path = _h[_g];
|
|
134
|
+
if (path.type !== EntityValueDataTypes.STEP)
|
|
135
|
+
continue;
|
|
136
|
+
if ((_a = step.dependencies) === null || _a === void 0 ? void 0 : _a.includes(path.idStep))
|
|
126
137
|
continue;
|
|
127
|
-
dependencies[
|
|
138
|
+
if (dependencies[path.idStep] === undefined) {
|
|
139
|
+
dependencies[path.idStep] = calcStepDependency(path.idStep, allSteps, originalValues, customSteps);
|
|
140
|
+
}
|
|
141
|
+
dependencies[path.idStep].dependents.push(step);
|
|
128
142
|
}
|
|
129
143
|
}
|
|
130
144
|
if (step.type === StepTypes.MAPPER) {
|
|
131
145
|
var newSteps = {};
|
|
132
|
-
var elements = (
|
|
146
|
+
var elements = (_b = originalValues[step.id]) !== null && _b !== void 0 ? _b : [];
|
|
133
147
|
var _loop_1 = function (element) {
|
|
134
|
-
for (var
|
|
135
|
-
var idSubStep =
|
|
148
|
+
for (var _k = 0, _l = Object.keys(step.steps); _k < _l.length; _k++) {
|
|
149
|
+
var idSubStep = _l[_k];
|
|
136
150
|
var subStep = step.steps[idSubStep];
|
|
137
151
|
var mappedId = element.ids[idSubStep];
|
|
138
|
-
newSteps[mappedId] = __assign(__assign({}, subStep), { id: mappedId, dependencies: (
|
|
152
|
+
newSteps[mappedId] = __assign(__assign({}, subStep), { id: mappedId, dependencies: (_c = subStep.dependencies) === null || _c === void 0 ? void 0 : _c.map(function (dep) { var _a; return (_a = element.ids[dep]) !== null && _a !== void 0 ? _a : dep; }) });
|
|
139
153
|
}
|
|
140
154
|
};
|
|
141
|
-
for (var
|
|
142
|
-
var element = elements_2[
|
|
155
|
+
for (var _j = 0, elements_2 = elements; _j < elements_2.length; _j++) {
|
|
156
|
+
var element = elements_2[_j];
|
|
143
157
|
_loop_1(element);
|
|
144
158
|
}
|
|
145
159
|
if (elements.length === 0) {
|
|
@@ -148,22 +162,6 @@ export function calcDependencies(steps, originalValues, customSteps, allSteps, d
|
|
|
148
162
|
calcDependencies(newSteps, originalValues, customSteps, __assign(__assign({}, allSteps), newSteps), dependencies);
|
|
149
163
|
}
|
|
150
164
|
}
|
|
151
|
-
/** After all steps have been checked check missing entityvalue dependencies */
|
|
152
|
-
for (var _h = 0, _j = Object.values(steps); _h < _j.length; _h++) {
|
|
153
|
-
var step = _j[_h];
|
|
154
|
-
if (step.type === StepTypes.ENTITYVALUEPICKER) {
|
|
155
|
-
for (var _k = 0, _l = __spreadArray(__spreadArray([], step.path, true), step.filters, true); _k < _l.length; _k++) {
|
|
156
|
-
var path = _l[_k];
|
|
157
|
-
if (path.type !== EntityValueDataTypes.STEP)
|
|
158
|
-
continue;
|
|
159
|
-
if ((_c = step.dependencies) === null || _c === void 0 ? void 0 : _c.includes(path.idStep))
|
|
160
|
-
continue;
|
|
161
|
-
if (dependencies[path.idStep] === undefined) {
|
|
162
|
-
dependencies[path.idStep] = calcStepDependency(path.idStep, allSteps, originalValues, customSteps);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
165
|
return dependencies;
|
|
168
166
|
}
|
|
169
167
|
export function calcStepDependency(idStep, steps, originalValues, customSteps) {
|
|
@@ -174,6 +172,7 @@ export function calcStepDependency(idStep, steps, originalValues, customSteps) {
|
|
|
174
172
|
value: depStep
|
|
175
173
|
? calcStepDependencyValue(depStep, originalValues, customSteps)
|
|
176
174
|
: (_b = originalValues[idStep]) !== null && _b !== void 0 ? _b : null,
|
|
175
|
+
dependents: [],
|
|
177
176
|
};
|
|
178
177
|
}
|
|
179
178
|
function calcStepDependencyValue(depStep, originalValues, customSteps) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormComponentProps } from '../../Form';
|
|
3
|
-
declare function ColumnForm({ onSubmit,
|
|
3
|
+
declare function ColumnForm({ onSubmit, customSubmitBtns, }: FormComponentProps): JSX.Element;
|
|
4
4
|
export default ColumnForm;
|