@arquimedes.co/eureka-forms 1.9.128-test → 1.9.128
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/App.js +2 -2
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +15 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +411 -0
- package/dist/{Form → FormComponents/Form}/ConfirmationDialog/ConfirmationDialog.d.ts +1 -1
- package/dist/{Form → FormComponents/Form}/Form.d.ts +8 -19
- package/dist/FormComponents/Form/Form.js +147 -0
- package/dist/{Form/FormTypes → FormComponents/Form}/StepperForm/StepperForm.d.ts +1 -1
- package/dist/{Form → FormComponents}/Section/MaterialSection/MaterialSection.js +1 -1
- package/dist/{Form → FormComponents}/Section/Section.d.ts +4 -1
- package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRElementStep/CBRElementStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRElementStep/CBRElementStep.js +2 -2
- package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/CBRIncidentsStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +2 -2
- package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRPropertyStep/CBRPropertyStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRPropertyStep/CBRPropertyStep.js +2 -2
- package/dist/{FormSteps → FormComponents/Step}/AYFStepMapper.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/AYFStepMapper.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/ApiSelectorStep/ApiSelectorStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/ApiSelectorStep/ApiSelectorStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +4 -4
- package/dist/{FormSteps → FormComponents/Step}/CBRStepMapper.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/CBRStepMapper.js +2 -2
- package/dist/{FormSteps → FormComponents/Step}/CheckBoxStep/CheckBoxStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/CheckBoxStep/CheckBoxStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/ClassifierSelectorStep/ClassifierSelectorStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -2
- package/dist/{FormSteps → FormComponents/Step}/CollapsibleStep/CollapsibleStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/CollapsibleStep/CollapsibleStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/DatePickerStep/DatePickerStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/DatePickerStep/DatePickerStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/EntityValueStep/EntityValuePickerStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/EntityValueStep/EntityValuePickerStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +4 -4
- package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/FileUploadStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/FileUploadStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +4 -4
- package/dist/{FormSteps → FormComponents/Step}/MapperStep/MapperStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/MapperStep/MapperStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/MapperElement.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/MaterialMapperStep.js +6 -6
- package/dist/{FormSteps → FormComponents/Step}/RatingStep/MaterialRatingStep/MaterialRatingStep.js +2 -2
- package/dist/{FormSteps → FormComponents/Step}/RatingStep/RatingStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/RatingStep/RatingStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +2 -2
- package/dist/{FormSteps → FormComponents/Step}/SelectorStep/SelectorStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/SelectorStep/SelectorStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/SeparatorStep/SeparatorStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/SeparatorStep/SeparatorStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/SmartSelectStep/SmartSelectStep.d.ts +4 -4
- package/dist/{FormSteps → FormComponents/Step}/SmartSelectStep/SmartSelectStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/Step.d.ts +2 -2
- package/dist/{FormSteps → FormComponents/Step}/Step.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/StepFunctions.d.ts +2 -2
- package/dist/{FormSteps → FormComponents/Step}/StepFunctions.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TextAreaStep/TextAreaStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TextAreaStep/TextAreaStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TextInputStep/TextInputStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TextInputStep/TextInputStep.js +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TitleStep/TitleStep.d.ts +1 -1
- package/dist/{FormSteps → FormComponents/Step}/TitleStep/TitleStep.js +1 -1
- package/dist/{Form/Terms → FormComponents}/Term/MaterialTerm/MaterialTerm.js +2 -2
- package/dist/{Form/Terms → FormComponents}/Term/Term.d.ts +1 -1
- package/dist/{Form/Terms → FormComponents}/Term/Term.js +1 -1
- package/dist/index.lib.d.ts +2 -2
- package/dist/index.lib.js +1 -1
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +1 -1
- package/package.json +1 -1
- package/dist/Form/Form.js +0 -264
- package/dist/Form/FormFunctions.d.ts +0 -6
- package/dist/Form/FormFunctions.js +0 -201
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +0 -4
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +0 -106
- package/dist/Form/Terms/Terms.d.ts +0 -4
- package/dist/Form/Terms/Terms.js +0 -37
- /package/dist/{Form/FormTypes → FormComponents/Form}/ColumnForm/ColumnForm.module.css +0 -0
- /package/dist/{Form → FormComponents/Form}/ConfirmationDialog/ConfirmationDialog.js +0 -0
- /package/dist/{Form → FormComponents/Form}/ConfirmationDialog/ConfirmationDialog.module.css +0 -0
- /package/dist/{Form → FormComponents/Form}/Form.module.css +0 -0
- /package/dist/{Form/FormTypes → FormComponents/Form}/StepperForm/StepperForm.js +0 -0
- /package/dist/{Form/FormTypes → FormComponents/Form}/StepperForm/StepperForm.module.css +0 -0
- /package/dist/{Form → FormComponents}/Section/MaterialSection/MaterialSection.d.ts +0 -0
- /package/dist/{Form → FormComponents}/Section/MaterialSection/MaterialSection.module.css +0 -0
- /package/dist/{Form → FormComponents}/Section/Section.js +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/@Construction/CBRPropertyStep/CBRPropertyStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/RatingStep/MaterialRatingStep/MaterialRatingStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TextAreaStep/MaterialTextAreaStep/DraftEditor.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.module.css +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TitleStep/MaterialTitleStep/MaterialTitleStep.js +0 -0
- /package/dist/{FormSteps → FormComponents/Step}/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +0 -0
- /package/dist/{Form/Terms → FormComponents}/Term/MaterialTerm/MaterialTerm.d.ts +0 -0
- /package/dist/{Form/Terms → FormComponents}/Term/MaterialTerm/MaterialTerm.module.css +0 -0
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import Types from '
|
|
24
|
+
import Types from '../../constants/FormStepTypes';
|
|
25
25
|
import SelectorStep from './SelectorStep/SelectorStep';
|
|
26
26
|
import SeparatorStep from './SeparatorStep/SeparatorStep';
|
|
27
27
|
import TextInputStep from './TextInputStep/TextInputStep';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormSize } from '
|
|
2
|
-
import { ApiSelector, CheckBox, ClassifierSelector, EntityValuePicker, FormSelector, FormStep } from '
|
|
1
|
+
import { FormSize } from '../../@Types/Form';
|
|
2
|
+
import { ApiSelector, CheckBox, ClassifierSelector, EntityValuePicker, FormSelector, FormStep } from '../../@Types/FormStep';
|
|
3
3
|
export declare function calcFillerSize(step: FormSelector | ClassifierSelector | EntityValuePicker | ApiSelector | CheckBox, steps: Record<string, FormStep>, values: Record<string, unknown>, size: FormSize): number;
|
|
4
4
|
export declare function recursivelyCheckOpenSize(idStep: string, steps: Record<string, FormStep>, values: Record<string, any>): number;
|
|
5
5
|
export declare const calcStepWidth: (stepSize: 1 | 2 | 3 | 4, size: FormSize) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Types, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, OptionTypes, } from '
|
|
1
|
+
import Types, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, OptionTypes, } from '../../constants/FormStepTypes';
|
|
2
2
|
export function calcFillerSize(step, steps, values, size) {
|
|
3
3
|
var _a;
|
|
4
4
|
var maxSize = (_a = step.maxSize) !== null && _a !== void 0 ? _a : size.blockNum;
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import RoundedTextField from '
|
|
24
|
+
import RoundedTextField from '../../../../shared/RoundedTextField/RoundedTextField';
|
|
25
25
|
import styles from './MaterialTextAreaStep.module.css';
|
|
26
26
|
import { Controller } from 'react-hook-form';
|
|
27
27
|
import { Editor } from 'react-draft-wysiwyg'; //Load programatically only if step has editor
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TextArea } from '
|
|
2
|
+
import { TextArea } from '../../../@Types/FormStep';
|
|
3
3
|
import { StepProps } from '../Step';
|
|
4
4
|
export interface TextAreaStepProps extends StepProps {
|
|
5
5
|
/** The TextAreaStep to display */
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { FormStyleTypes } from '
|
|
13
|
+
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
14
14
|
import MaterialTextAreaStep from './MaterialTextAreaStep/MaterialTextAreaStep';
|
|
15
15
|
function TextAreaStep(props) {
|
|
16
16
|
switch (props.formStyle.type) {
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import RoundedTextField from '
|
|
24
|
+
import RoundedTextField from '../../../../shared/RoundedTextField/RoundedTextField';
|
|
25
25
|
import styles from './MaterialTextInputStep.module.css';
|
|
26
26
|
import { Controller } from 'react-hook-form';
|
|
27
27
|
import { calcStepWidth } from '../../StepFunctions';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TextInput } from '
|
|
2
|
+
import { TextInput } from '../../../@Types/FormStep';
|
|
3
3
|
import { StepProps } from '../Step';
|
|
4
4
|
export interface TextInputStepProps extends StepProps {
|
|
5
5
|
/** The TextInputStep to display */
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { FormStyleTypes } from '
|
|
13
|
+
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
14
14
|
import MaterialTextInputStep from './MaterialTextInputStep/MaterialTextInputStep';
|
|
15
15
|
function TextInputStep(props) {
|
|
16
16
|
switch (props.formStyle.type) {
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { FormStyleTypes } from '
|
|
24
|
+
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
25
25
|
import MaterialTitleStep from './MaterialTitleStep/MaterialTitleStep';
|
|
26
26
|
function TitleStep(_a) {
|
|
27
27
|
var step = _a.step, formStyle = _a.formStyle, others = __rest(_a, ["step", "formStyle"]);
|
|
@@ -25,8 +25,8 @@ import { Dialog } from '@material-ui/core';
|
|
|
25
25
|
import React from 'react';
|
|
26
26
|
import { useState } from 'react';
|
|
27
27
|
import { Controller } from 'react-hook-form';
|
|
28
|
-
import RoundedButton from '
|
|
29
|
-
import RoundedCheckBox from '
|
|
28
|
+
import RoundedButton from '../../../shared/RoundedButton/RoundedButton';
|
|
29
|
+
import RoundedCheckBox from '../../../shared/RoundedCheckBox/RoundedCheckBox';
|
|
30
30
|
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
|
|
31
31
|
import styles from './MaterialTerm.module.css';
|
|
32
32
|
function TermComponent(_a) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Control, FieldValues } from 'react-hook-form';
|
|
3
|
-
import { Form, FormStyle, Term } from '
|
|
3
|
+
import { Form, FormStyle, Term } from '../../@Types/Form';
|
|
4
4
|
export interface TermComponentProps {
|
|
5
5
|
term: Term;
|
|
6
6
|
form: Form;
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { FormStyleTypes } from '
|
|
13
|
+
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
14
14
|
import MaterialTerm from './MaterialTerm/MaterialTerm';
|
|
15
15
|
function TermComponent(props) {
|
|
16
16
|
switch (props.formStyle.type) {
|
package/dist/index.lib.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EurekaForm, { AppProps as EurekaFormProps } from './App';
|
|
2
|
-
import { StepProps } from './
|
|
3
|
-
import * as StepFunctions from './
|
|
2
|
+
import { StepProps } from './FormComponents/Step/Step';
|
|
3
|
+
import * as StepFunctions from './FormComponents/Step/StepFunctions';
|
|
4
4
|
export type { StepProps, EurekaFormProps };
|
|
5
5
|
export { EurekaForm, StepFunctions };
|
|
6
6
|
export default EurekaForm;
|
package/dist/index.lib.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EurekaForm from './App';
|
|
2
|
-
import * as StepFunctions from './
|
|
2
|
+
import * as StepFunctions from './FormComponents/Step/StepFunctions';
|
|
3
3
|
export { EurekaForm, StepFunctions };
|
|
4
4
|
export default EurekaForm;
|
|
5
5
|
export { default as ReactFromModule } from 'react';
|
|
@@ -40,7 +40,7 @@ import React, { cloneElement } from 'react';
|
|
|
40
40
|
import { makeStyles } from '@material-ui/core/styles';
|
|
41
41
|
import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
|
|
42
42
|
import { DatePicker, DateTimePicker, } from '@material-ui/pickers';
|
|
43
|
-
import { getLocale } from '../../Form/Form';
|
|
43
|
+
import { getLocale } from '../../FormComponents/Form/Form';
|
|
44
44
|
import { format } from 'date-fns';
|
|
45
45
|
var useDatePickerStyles = function (props) {
|
|
46
46
|
return makeStyles(function () { return ({
|
package/package.json
CHANGED
package/dist/Form/Form.js
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
-
var t = {};
|
|
50
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
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';
|
|
62
|
-
import styles from './Form.module.css';
|
|
63
|
-
import InternalFormStyle from '../constants/InternalFormStyle';
|
|
64
|
-
import enLocale from 'date-fns/locale/en-US';
|
|
65
|
-
import esLocale from 'date-fns/locale/es';
|
|
66
|
-
import ColumnForm from './FormTypes/ColumnForm/ColumnForm';
|
|
67
|
-
import StepperForm from './FormTypes/StepperForm/StepperForm';
|
|
68
|
-
import { FormStyleTypes, FormTypes, } from '../constants/FormStepTypes';
|
|
69
|
-
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
|
|
70
|
-
import DateFnsUtils from '@date-io/date-fns';
|
|
71
|
-
import { createGenerateClassName, createTheme, StylesProvider, ThemeProvider, } from '@material-ui/core';
|
|
72
|
-
import { SEED } from '../constants/MaterialClassNameSeed';
|
|
73
|
-
import { calcDependencies, calcValue } from './FormFunctions';
|
|
74
|
-
import { useForm } from 'react-hook-form';
|
|
75
|
-
import widgetInstance from '../AxiosWidget';
|
|
76
|
-
import axiosInstance from '../AxiosAPI';
|
|
77
|
-
import ReCAPTCHA from 'react-google-recaptcha';
|
|
78
|
-
import ConfirmationDialog from './ConfirmationDialog/ConfirmationDialog';
|
|
79
|
-
var localeMap = {
|
|
80
|
-
en: enLocale,
|
|
81
|
-
'en-US': enLocale,
|
|
82
|
-
es: esLocale,
|
|
83
|
-
};
|
|
84
|
-
export var getLocale = function () {
|
|
85
|
-
var _a;
|
|
86
|
-
return ((_a = localeMap[navigator.languages && navigator.languages.length
|
|
87
|
-
? navigator.languages[0]
|
|
88
|
-
: navigator.userLanguage ||
|
|
89
|
-
navigator.language ||
|
|
90
|
-
navigator.browserLanguage]) !== null && _a !== void 0 ? _a : localeMap.es);
|
|
91
|
-
};
|
|
92
|
-
function FormComponent(_a) {
|
|
93
|
-
var _this = this;
|
|
94
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
95
|
-
var form = _a.form, isWidget = _a.isWidget, internal = _a.internal, postview = _a.postview, branding = _a.branding, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "isWidget", "internal", "postview", "branding", "organization", "containerRef"]);
|
|
96
|
-
var apiKey = others.apiKey, domain = others.domain, customSteps = others.customSteps, originalValues = others.originalValues, customSend = others.customSend;
|
|
97
|
-
var _m = useState(calcDependencies(form.steps, originalValues, customSteps)), dependencyStore = _m[0], setDependencyStore = _m[1];
|
|
98
|
-
var formController = useForm({
|
|
99
|
-
defaultValues: originalValues,
|
|
100
|
-
mode: 'onTouched',
|
|
101
|
-
shouldFocusError: true,
|
|
102
|
-
});
|
|
103
|
-
var recaptchaRef = useRef();
|
|
104
|
-
var _o = useState(), showConfirmation = _o[0], setShowConfirmation = _o[1];
|
|
105
|
-
var onSubmit = function (values) { return __awaiter(_this, void 0, void 0, function () {
|
|
106
|
-
var token, token_1, newValues, deleteIds, _i, _a, idStep, _b, deleteIds_1, id, customResp, params, url, axios, resp, error_1;
|
|
107
|
-
return __generator(this, function (_c) {
|
|
108
|
-
switch (_c.label) {
|
|
109
|
-
case 0:
|
|
110
|
-
token = null;
|
|
111
|
-
if (!(form.hasCaptcha && !internal && !customSend)) return [3 /*break*/, 2];
|
|
112
|
-
token_1 = recaptchaRef.current.getValue();
|
|
113
|
-
if (!!token_1) return [3 /*break*/, 2];
|
|
114
|
-
return [4 /*yield*/, (recaptchaRef === null || recaptchaRef === void 0 ? void 0 : recaptchaRef.current.executeAsync())];
|
|
115
|
-
case 1:
|
|
116
|
-
token_1 = _c.sent();
|
|
117
|
-
_c.label = 2;
|
|
118
|
-
case 2:
|
|
119
|
-
if (!apiKey && !internal && !customSend)
|
|
120
|
-
return [2 /*return*/];
|
|
121
|
-
_c.label = 3;
|
|
122
|
-
case 3:
|
|
123
|
-
_c.trys.push([3, 7, , 8]);
|
|
124
|
-
newValues = {};
|
|
125
|
-
deleteIds = [];
|
|
126
|
-
for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
|
|
127
|
-
idStep = _a[_i];
|
|
128
|
-
newValues[idStep] = calcValue(idStep, form.steps, values, customSteps, deleteIds);
|
|
129
|
-
}
|
|
130
|
-
for (_b = 0, deleteIds_1 = deleteIds; _b < deleteIds_1.length; _b++) {
|
|
131
|
-
id = deleteIds_1[_b];
|
|
132
|
-
delete newValues[id];
|
|
133
|
-
}
|
|
134
|
-
if (!customSend) return [3 /*break*/, 5];
|
|
135
|
-
return [4 /*yield*/, customSend(newValues, others.reload)];
|
|
136
|
-
case 4:
|
|
137
|
-
customResp = _c.sent();
|
|
138
|
-
return [2 /*return*/, customResp];
|
|
139
|
-
case 5:
|
|
140
|
-
params = new URLSearchParams();
|
|
141
|
-
if (domain || internal)
|
|
142
|
-
params.set('idOrganization', domain !== null && domain !== void 0 ? domain : '');
|
|
143
|
-
if (token)
|
|
144
|
-
params.set('token', token);
|
|
145
|
-
url = "/ticket/".concat(internal ? form.apiKey : apiKey);
|
|
146
|
-
if (params.toString()) {
|
|
147
|
-
url += "?".concat(params.toString());
|
|
148
|
-
}
|
|
149
|
-
axios = domain || internal ? widgetInstance : axiosInstance;
|
|
150
|
-
return [4 /*yield*/, axios.post(url, newValues)];
|
|
151
|
-
case 6:
|
|
152
|
-
resp = _c.sent();
|
|
153
|
-
setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
|
|
154
|
-
return [3 /*break*/, 8];
|
|
155
|
-
case 7:
|
|
156
|
-
error_1 = _c.sent();
|
|
157
|
-
console.error(error_1);
|
|
158
|
-
return [3 /*break*/, 8];
|
|
159
|
-
case 8: return [2 /*return*/];
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}); };
|
|
163
|
-
var _p = useState(undefined), widthStats = _p[0], setWidthStats = _p[1];
|
|
164
|
-
/** Calcs the currentBreakPoint and if is mobile */
|
|
165
|
-
var handleResize = function () {
|
|
166
|
-
var _a;
|
|
167
|
-
var currentWidth = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
168
|
-
if (currentWidth !== undefined) {
|
|
169
|
-
var currentBreakPoint = form.size.blockNum;
|
|
170
|
-
var padding = postview || internal || !form.isStandAlone ? 0 : 40;
|
|
171
|
-
while (currentWidth <
|
|
172
|
-
(form.size.blockSize + form.size.spacingSize) *
|
|
173
|
-
currentBreakPoint +
|
|
174
|
-
padding) {
|
|
175
|
-
currentBreakPoint--;
|
|
176
|
-
}
|
|
177
|
-
setWidthStats({
|
|
178
|
-
isResponsive: currentWidth <
|
|
179
|
-
(form.size.blockSize + form.size.spacingSize) *
|
|
180
|
-
form.size.blockNum +
|
|
181
|
-
padding,
|
|
182
|
-
isMobile: currentWidth <
|
|
183
|
-
(form.size.blockSize + form.size.spacingSize) * 2 + padding,
|
|
184
|
-
currentBreakPoint: currentBreakPoint,
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
useEffect(function () {
|
|
189
|
-
/** On load add a resize listener to calc the currentBreakpoint */
|
|
190
|
-
window.addEventListener('resize', handleResize);
|
|
191
|
-
handleResize();
|
|
192
|
-
return function () {
|
|
193
|
-
window.removeEventListener('resize', handleResize);
|
|
194
|
-
};
|
|
195
|
-
}, [containerRef.current, (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth]);
|
|
196
|
-
var formStyle = useMemo(function () {
|
|
197
|
-
var _a;
|
|
198
|
-
return internal
|
|
199
|
-
? InternalFormStyle
|
|
200
|
-
: __assign(__assign({}, InternalFormStyle), ((_a = form.style) !== null && _a !== void 0 ? _a : {}));
|
|
201
|
-
}, []);
|
|
202
|
-
if (!widthStats)
|
|
203
|
-
return _jsx("div", {});
|
|
204
|
-
var renderForm = function () {
|
|
205
|
-
return (_jsxs(React.Fragment, { children: [showConfirmation !== undefined && (_jsx(ConfirmationDialog, { formStyle: formStyle, confirmation: showConfirmation, onClose: function () {
|
|
206
|
-
others.reload();
|
|
207
|
-
setShowConfirmation(undefined);
|
|
208
|
-
} })), form.hasCaptcha && !internal && (_jsx(ReCAPTCHA, { ref: recaptchaRef, sitekey: "6LcL22kkAAAAAEotDeAFbRATob-u5vbibbCyWL2p", size: 'invisible', badge: 'bottomright' })), _jsx(FormTypeComponent, __assign({}, others, { branding: branding, widthStats: widthStats, form: form, internal: internal, postview: postview, organization: organization, formStyle: formStyle, onSubmit: onSubmit, formController: formController, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }))] }));
|
|
209
|
-
};
|
|
210
|
-
//If currently displaying internal or form is standalone
|
|
211
|
-
if ((postview || internal || !form.isStandAlone) &&
|
|
212
|
-
widthStats !== undefined) {
|
|
213
|
-
return (_jsx("div", __assign({ style: {
|
|
214
|
-
backgroundColor: internal
|
|
215
|
-
? 'transparent'
|
|
216
|
-
: (_d = (_c = form.style) === null || _c === void 0 ? void 0 : _c.backgroundColor) !== null && _d !== void 0 ? _d : InternalFormStyle.backgroundColor,
|
|
217
|
-
minHeight: form.isStandAlone && !isWidget ? '100vh' : '100%',
|
|
218
|
-
} }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: renderForm() })) })));
|
|
219
|
-
}
|
|
220
|
-
else if (organization && widthStats !== undefined) {
|
|
221
|
-
//Standalone cant have widget
|
|
222
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: branding === null || branding === void 0 ? void 0 : branding.images.logoUrl, color: (_f = (_e = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _e === void 0 ? void 0 : _e.navbarColor) !== null && _f !== void 0 ? _f : (_g = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _g === void 0 ? void 0 : _g.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
|
|
223
|
-
background: (_j = (_h = form.style) === null || _h === void 0 ? void 0 : _h.standAloneBackgroundColor) !== null && _j !== void 0 ? _j : '#ffffff',
|
|
224
|
-
} }, { children: _jsx("div", __assign({ className: widthStats.isResponsive
|
|
225
|
-
? styles.fullScreenStandAloneForm
|
|
226
|
-
: styles.standAloneFormCard, style: {
|
|
227
|
-
backgroundColor: (_l = (_k = form.style) === null || _k === void 0 ? void 0 : _k.backgroundColor) !== null && _l !== void 0 ? _l : InternalFormStyle.backgroundColor,
|
|
228
|
-
// visibility: loaded ? 'visible' : 'hidden',
|
|
229
|
-
} }, { children: renderForm() })) }))] }));
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
return _jsx("div", {});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
export default FormComponent;
|
|
236
|
-
var muiTheme = createTheme({
|
|
237
|
-
typography: {
|
|
238
|
-
fontFamily: 'inherit',
|
|
239
|
-
},
|
|
240
|
-
});
|
|
241
|
-
var generateClassName = createGenerateClassName({
|
|
242
|
-
seed: SEED,
|
|
243
|
-
productionPrefix: 'efjss',
|
|
244
|
-
});
|
|
245
|
-
function FormTypeComponent(_a) {
|
|
246
|
-
var props = __rest(_a, []);
|
|
247
|
-
var renderTypes = function () {
|
|
248
|
-
switch (props.form.type) {
|
|
249
|
-
case FormTypes.STEPPER: {
|
|
250
|
-
return _jsx(StepperForm, __assign({}, props));
|
|
251
|
-
}
|
|
252
|
-
case FormTypes.COLUMN:
|
|
253
|
-
default: {
|
|
254
|
-
return _jsx(ColumnForm, __assign({}, props));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
switch (props.formStyle.type) {
|
|
259
|
-
case FormStyleTypes.MATERIAL:
|
|
260
|
-
return (_jsx(StylesProvider, __assign({ generateClassName: generateClassName }, { children: _jsx(ThemeProvider, __assign({ theme: muiTheme }, { children: _jsx(MuiPickersUtilsProvider, __assign({ utils: DateFnsUtils, locale: getLocale() }, { children: renderTypes() })) })) })));
|
|
261
|
-
default:
|
|
262
|
-
return renderTypes();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FormStep } from '../@Types/FormStep';
|
|
2
|
-
import { CustomStep } from '../App';
|
|
3
|
-
import { DependencyStore, StepDependency } from './Form';
|
|
4
|
-
export declare const calcValue: (idStep: string, steps: Record<string, FormStep>, values: Record<string, any>, customSteps: Record<string, CustomStep>, deleteIds: string[], value?: any) => any;
|
|
5
|
-
export declare function calcDependencies(steps: Record<string, FormStep>, originalValues: Record<string, any>, customSteps?: Record<string, CustomStep>, allSteps?: Record<string, FormStep>, dependencies?: DependencyStore): DependencyStore;
|
|
6
|
-
export declare function calcStepDependencyValue(depStep: FormStep, originalValues: Record<string, any>, customSteps?: Record<string, CustomStep>): StepDependency['value'];
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
import { convertToRaw } from 'draft-js';
|
|
22
|
-
import StepTypes, { EntityValueDataTypes } from '../constants/FormStepTypes';
|
|
23
|
-
export var calcValue = function (idStep, steps, values, customSteps, deleteIds, value) {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
if (value === void 0) { value = values[idStep]; }
|
|
26
|
-
var step = steps[idStep];
|
|
27
|
-
if (!step)
|
|
28
|
-
return value;
|
|
29
|
-
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
30
|
-
if (custom !== undefined) {
|
|
31
|
-
return (_b = (_a = custom.calcValue) === null || _a === void 0 ? void 0 : _a.call(custom, step, value)) !== null && _b !== void 0 ? _b : value;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
switch (step === null || step === void 0 ? void 0 : step.type) {
|
|
35
|
-
case StepTypes.TEXTAREA: {
|
|
36
|
-
if (step.hasTextEditor) {
|
|
37
|
-
var currentContent = value.getCurrentContent();
|
|
38
|
-
return {
|
|
39
|
-
value: currentContent.getPlainText(),
|
|
40
|
-
draft: convertToRaw(currentContent),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return {
|
|
45
|
-
value: value,
|
|
46
|
-
draft: stringToDraft(value),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
case StepTypes.FILEUPLOAD: {
|
|
51
|
-
return value.map(function (val) { return ({
|
|
52
|
-
fileName: val.fileName,
|
|
53
|
-
S3Key: val.S3Key,
|
|
54
|
-
}); });
|
|
55
|
-
}
|
|
56
|
-
case StepTypes.SELECTOR:
|
|
57
|
-
case StepTypes.CLASSIFIER_SELECTOR: {
|
|
58
|
-
return value.value;
|
|
59
|
-
}
|
|
60
|
-
case StepTypes.COLLAPSIBLE: {
|
|
61
|
-
return !!value;
|
|
62
|
-
}
|
|
63
|
-
case StepTypes.MAPPER: {
|
|
64
|
-
var elements = value === null || value === void 0 ? void 0 : value.filter(function (element) { return element.deleted !== true; });
|
|
65
|
-
var mappedValues = [];
|
|
66
|
-
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
|
|
67
|
-
var element = elements_1[_i];
|
|
68
|
-
var newValue = {
|
|
69
|
-
id: element.id,
|
|
70
|
-
};
|
|
71
|
-
for (var _c = 0, _d = Object.keys(element.originalValues); _c < _d.length; _c++) {
|
|
72
|
-
var key = _d[_c];
|
|
73
|
-
newValue[key] = element.originalValues[key];
|
|
74
|
-
}
|
|
75
|
-
if (element.value)
|
|
76
|
-
newValue.value = element.value;
|
|
77
|
-
for (var _e = 0, _f = Object.keys(step.steps); _e < _f.length; _e++) {
|
|
78
|
-
var idStep_1 = _f[_e];
|
|
79
|
-
var mappedId = element.ids[idStep_1];
|
|
80
|
-
if (values[mappedId] !== undefined) {
|
|
81
|
-
newValue[idStep_1] = calcValue(idStep_1, step.steps, values, customSteps, deleteIds, values[mappedId]);
|
|
82
|
-
deleteIds.push(mappedId);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
mappedValues.push(newValue);
|
|
86
|
-
}
|
|
87
|
-
return mappedValues;
|
|
88
|
-
}
|
|
89
|
-
default:
|
|
90
|
-
if ((step === null || step === void 0 ? void 0 : step.type) === 'CBR_INCIDENCIAS') {
|
|
91
|
-
return value === null || value === void 0 ? void 0 : value.filter(function (incidencia) { return incidencia.deleted !== true; });
|
|
92
|
-
}
|
|
93
|
-
return value;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
function stringToDraft(text) {
|
|
98
|
-
var draftStructure = {
|
|
99
|
-
blocks: [],
|
|
100
|
-
entityMap: {},
|
|
101
|
-
};
|
|
102
|
-
text.split('\n').forEach(function (element, index) {
|
|
103
|
-
draftStructure.blocks.push({
|
|
104
|
-
key: String(index),
|
|
105
|
-
text: element,
|
|
106
|
-
type: 'unstyled',
|
|
107
|
-
depth: 0,
|
|
108
|
-
inlineStyleRanges: [],
|
|
109
|
-
entityRanges: [],
|
|
110
|
-
data: {},
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
return draftStructure;
|
|
114
|
-
}
|
|
115
|
-
export function calcDependencies(steps, originalValues, customSteps, allSteps, dependencies) {
|
|
116
|
-
var _a, _b, _c, _d;
|
|
117
|
-
if (customSteps === void 0) { customSteps = {}; }
|
|
118
|
-
if (allSteps === void 0) { allSteps = steps; }
|
|
119
|
-
if (dependencies === void 0) { dependencies = {}; }
|
|
120
|
-
for (var _i = 0, _e = Object.values(steps); _i < _e.length; _i++) {
|
|
121
|
-
var step = _e[_i];
|
|
122
|
-
if (step.dependencies) {
|
|
123
|
-
for (var _f = 0, _g = step.dependencies; _f < _g.length; _f++) {
|
|
124
|
-
var idDep = _g[_f];
|
|
125
|
-
var depStep = allSteps[idDep];
|
|
126
|
-
if (depStep && dependencies[idDep] === undefined) {
|
|
127
|
-
dependencies[idDep] = {
|
|
128
|
-
type: depStep.type,
|
|
129
|
-
value: calcStepDependencyValue(depStep, originalValues, customSteps),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
else if (dependencies[idDep] === undefined) {
|
|
133
|
-
dependencies[idDep] = {
|
|
134
|
-
type: (_a = depStep === null || depStep === void 0 ? void 0 : depStep.type) !== null && _a !== void 0 ? _a : 'ORIGINAL',
|
|
135
|
-
value: originalValues[idDep],
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (step.type === StepTypes.MAPPER) {
|
|
141
|
-
var newSteps = {};
|
|
142
|
-
var elements = (_b = originalValues[step.id]) !== null && _b !== void 0 ? _b : [];
|
|
143
|
-
var _loop_1 = function (element) {
|
|
144
|
-
for (var _o = 0, _p = Object.keys(step.steps); _o < _p.length; _o++) {
|
|
145
|
-
var idSubStep = _p[_o];
|
|
146
|
-
var subStep = step.steps[idSubStep];
|
|
147
|
-
var mappedId = element.ids[idSubStep];
|
|
148
|
-
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; }) });
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
for (var _h = 0, elements_2 = elements; _h < elements_2.length; _h++) {
|
|
152
|
-
var element = elements_2[_h];
|
|
153
|
-
_loop_1(element);
|
|
154
|
-
}
|
|
155
|
-
if (elements.length === 0) {
|
|
156
|
-
newSteps = step.steps;
|
|
157
|
-
}
|
|
158
|
-
calcDependencies(newSteps, originalValues, customSteps, __assign(__assign({}, allSteps), newSteps), dependencies);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/** After all steps have been checked check missing entityvalue dependencies */
|
|
162
|
-
for (var _j = 0, _k = Object.values(steps); _j < _k.length; _j++) {
|
|
163
|
-
var step = _k[_j];
|
|
164
|
-
if (step.type === StepTypes.ENTITYVALUEPICKER) {
|
|
165
|
-
for (var _l = 0, _m = __spreadArray(__spreadArray([], step.path, true), step.filters, true); _l < _m.length; _l++) {
|
|
166
|
-
var path = _m[_l];
|
|
167
|
-
if (path.type !== EntityValueDataTypes.STEP)
|
|
168
|
-
continue;
|
|
169
|
-
if ((_d = step.dependencies) === null || _d === void 0 ? void 0 : _d.includes(path.idStep))
|
|
170
|
-
continue;
|
|
171
|
-
if (dependencies[path.idStep] === undefined) {
|
|
172
|
-
dependencies[path.idStep] = originalValues[path.idStep];
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return dependencies;
|
|
178
|
-
}
|
|
179
|
-
export function calcStepDependencyValue(depStep, originalValues, customSteps) {
|
|
180
|
-
var _a, _b, _c, _d;
|
|
181
|
-
if (customSteps === void 0) { customSteps = {}; }
|
|
182
|
-
var custom = customSteps[depStep === null || depStep === void 0 ? void 0 : depStep.type];
|
|
183
|
-
if (custom === null || custom === void 0 ? void 0 : custom.calcDependencyValue) {
|
|
184
|
-
return custom.calcDependencyValue(depStep, originalValues[depStep.id]);
|
|
185
|
-
}
|
|
186
|
-
switch (depStep.type) {
|
|
187
|
-
case StepTypes.TEXTAREA: {
|
|
188
|
-
if (depStep.hasTextEditor) {
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
return (_a = originalValues[depStep.id]) === null || _a === void 0 ? void 0 : _a.value;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
case StepTypes.MAPPER: {
|
|
196
|
-
return ((_c = (_b = originalValues[depStep.id]) === null || _b === void 0 ? void 0 : _b.map(function (mapperValue) { var _a; return (_a = mapperValue.value) !== null && _a !== void 0 ? _a : mapperValue; })) !== null && _c !== void 0 ? _c : null);
|
|
197
|
-
}
|
|
198
|
-
default:
|
|
199
|
-
return (_d = originalValues[depStep.id]) !== null && _d !== void 0 ? _d : null;
|
|
200
|
-
}
|
|
201
|
-
}
|