@arquimedes.co/eureka-forms 2.0.61 → 2.0.64-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/Condition.d.ts +33 -2
- package/dist/@Types/Entity.d.ts +4 -1
- package/dist/@Types/FormStep.d.ts +21 -16
- package/dist/@Types/GenericFormSteps.d.ts +11 -0
- package/dist/@Types/Time.d.ts +6 -0
- package/dist/@Types/Time.js +1 -0
- package/dist/App/App.d.ts +3 -1
- package/dist/App/App.js +1 -1
- package/dist/App/AppFunctions.d.ts +0 -3
- package/dist/App/AppFunctions.js +9 -53
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +26 -3
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.module.css +10 -5
- package/dist/Form/Form.d.ts +4 -4
- package/dist/Form/Form.js +2 -2
- package/dist/Form/FormFunctions.js +13 -13
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +1 -1
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +18 -3
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +1 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +1 -1
- package/dist/FormSteps/Step.js +19 -15
- package/dist/FormSteps/StepFunctions.js +140 -53
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.d.ts +4 -0
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.js +29 -0
- package/dist/FormSteps/TimePickerStep/TimePickerStep.d.ts +12 -0
- package/dist/FormSteps/TimePickerStep/TimePickerStep.js +25 -0
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.d.ts +2 -2
- package/dist/Shared/RoundedSelect/RoundedSelect.d.ts +2 -2
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.d.ts +35 -0
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.js +293 -0
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.module.css +30 -0
- package/dist/Shared/Toggle/Toggle.d.ts +18 -0
- package/dist/Shared/Toggle/Toggle.js +31 -0
- package/dist/Utils/FormStepFunctions.d.ts +15 -0
- package/dist/Utils/FormStepFunctions.js +166 -0
- package/dist/constants/EntityPropertyTypes.d.ts +1 -0
- package/dist/constants/EntityPropertyTypes.js +1 -0
- package/dist/constants/FormStepTypes.d.ts +3 -2
- package/dist/constants/FormStepTypes.js +19 -18
- package/package.json +2 -2
|
@@ -45,8 +45,19 @@ 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
|
+
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
|
+
};
|
|
48
59
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
-
import { useCallback, useContext, useState } from 'react';
|
|
60
|
+
import { useCallback, useContext, useEffect, useState } from 'react';
|
|
50
61
|
import styles from './ColumnForm.module.css';
|
|
51
62
|
import React from 'react';
|
|
52
63
|
import Terms from '../../Terms/Terms';
|
|
@@ -61,7 +72,7 @@ import { getAppState } from '../../../Utils/store';
|
|
|
61
72
|
import { IdFormContext } from '../../../App/App';
|
|
62
73
|
function ColumnForm(_a) {
|
|
63
74
|
var _this = this;
|
|
64
|
-
var onSubmit = _a.onSubmit, customSubmitBtns = _a.customSubmitBtns;
|
|
75
|
+
var onSubmit = _a.onSubmit, customSubmitBtns = _a.customSubmitBtns, props = __rest(_a, ["onSubmit", "customSubmitBtns"]);
|
|
65
76
|
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
66
77
|
var _c = useAppSelector(function (state) { return state.global; }), postview = _c.postview, editable = _c.editable, formStyle = _c.formStyle;
|
|
67
78
|
var _d = useFormContext(), trigger = _d.trigger, getValues = _d.getValues, handleSubmit = _d.handleSubmit;
|
|
@@ -72,6 +83,10 @@ function ColumnForm(_a) {
|
|
|
72
83
|
var previous = useAppSelector(function (state) { return state.site.previousSections; });
|
|
73
84
|
var next = useAppSelector(function (state) { return state.site.nextSections; });
|
|
74
85
|
var idCurrent = useAppSelector(function (state) { return state.site.idCurrentSection; });
|
|
86
|
+
useEffect(function () {
|
|
87
|
+
if (props.submit)
|
|
88
|
+
props.submit(submit);
|
|
89
|
+
}, [props.submit]);
|
|
75
90
|
/** Esto se usa para no tener que escuchar todo el tiempo los errores del formulario */
|
|
76
91
|
var handleErrors = handleSubmit(function () { }, function (errors) {
|
|
77
92
|
console.error('Errors:', errors);
|
|
@@ -105,6 +120,6 @@ function ColumnForm(_a) {
|
|
|
105
120
|
}
|
|
106
121
|
});
|
|
107
122
|
}); }, []);
|
|
108
|
-
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }), previous.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), next.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), _jsx(Terms, {}), !postview && editable && (_jsxs(React.Fragment, { children: [
|
|
123
|
+
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }), previous.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), next.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), _jsx(Terms, {}), !postview && editable && (_jsxs(React.Fragment, { children: [customSubmitBtns === undefined && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsx(CustomBtn, { onClick: submit, width: "calc(100% - 70px)", label: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar', backgroundColor: formStyle.primaryColor, color: formStyle.primaryContrastColor, loading: loading, "data-testid": "form__submit" }) }))), customSubmitBtns === null || customSubmitBtns === void 0 ? void 0 : customSubmitBtns(submit, loading)] }))] })));
|
|
109
124
|
}
|
|
110
125
|
export default ColumnForm;
|
|
@@ -106,7 +106,7 @@ var getElementOptions = function (idOrganization, step, dependencyStore) { retur
|
|
|
106
106
|
case 1:
|
|
107
107
|
response = (_d.sent()).data;
|
|
108
108
|
father_1 = (_c = dependencyStore[step.dependencies[1]]) === null || _c === void 0 ? void 0 : _c.value;
|
|
109
|
-
if (father_1
|
|
109
|
+
if (father_1 && father_1.id === undefined) {
|
|
110
110
|
return [2 /*return*/, null];
|
|
111
111
|
}
|
|
112
112
|
return [2 /*return*/, response.filter(function (locativa) {
|
|
@@ -90,7 +90,7 @@ function MapperComponent(_a) {
|
|
|
90
90
|
margin: step.description
|
|
91
91
|
? '10px 0px'
|
|
92
92
|
: '0px 0px 5px 0px',
|
|
93
|
-
} }, { children: step.description }))), mapElements(), _jsx("input", { id: step.id, ref: inputRef, className: 'hidden-input', readOnly: true, value: inputValue }), step.creatable !== false &&
|
|
93
|
+
} }, { children: step.description }))), mapElements(), _jsx("input", { id: step.id + '-input', ref: inputRef, className: 'hidden-input', readOnly: true, value: inputValue }), step.creatable !== false &&
|
|
94
94
|
(!step.max ||
|
|
95
95
|
elements.filter(function (elem) { return !elem.deleted; }).length < step.max) && (_jsxs("div", __assign({ className: styles.btnContainer }, { children: [!customAdd && (_jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel +
|
|
96
96
|
(step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
package/dist/FormSteps/Step.js
CHANGED
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
-
import
|
|
24
|
+
import FormStepTypes from '../constants/FormStepTypes';
|
|
25
25
|
import SelectorStep from './SelectorStep/SelectorStep';
|
|
26
26
|
import SeparatorStep from './SeparatorStep/SeparatorStep';
|
|
27
27
|
import TextInputStep from './TextInputStep/TextInputStep';
|
|
@@ -43,6 +43,7 @@ import { useAppSelector } from '../hooks';
|
|
|
43
43
|
import { useContext } from 'react';
|
|
44
44
|
import CustomContext from '../Contexts/CustomContext';
|
|
45
45
|
import { selectOriginalValue, useCondition } from './StepHooks';
|
|
46
|
+
import TimePickerStep from './TimePickerStep/TimePickerStep';
|
|
46
47
|
function StepComponent(_a) {
|
|
47
48
|
var _b;
|
|
48
49
|
var step = _a.step, props = __rest(_a, ["step"]);
|
|
@@ -69,46 +70,49 @@ function StepComponent(_a) {
|
|
|
69
70
|
return (_jsx(CustomStep, __assign({}, props, { step: step, editable: editable, customStep: customStep })));
|
|
70
71
|
}
|
|
71
72
|
switch (step.type) {
|
|
72
|
-
case
|
|
73
|
+
case FormStepTypes.TITLE: {
|
|
73
74
|
return (_jsx(TitleStep, __assign({}, props, { step: step, editable: editable })));
|
|
74
75
|
}
|
|
75
|
-
case
|
|
76
|
+
case FormStepTypes.TIMEPICKER: {
|
|
77
|
+
return (_jsx(TimePickerStep, __assign({}, props, { step: step, editable: editable })));
|
|
78
|
+
}
|
|
79
|
+
case FormStepTypes.SELECTOR: {
|
|
76
80
|
return (_jsx(SelectorStep, __assign({}, props, { step: step, editable: editable })));
|
|
77
81
|
}
|
|
78
|
-
case
|
|
82
|
+
case FormStepTypes.CHECKBOX: {
|
|
79
83
|
return (_jsx(CheckBoxStep, __assign({}, props, { step: step, editable: editable })));
|
|
80
84
|
}
|
|
81
|
-
case
|
|
85
|
+
case FormStepTypes.CLASSIFIER_SELECTOR: {
|
|
82
86
|
return (_jsx(ClassifierSelectorStep, __assign({}, props, { step: step, editable: editable })));
|
|
83
87
|
}
|
|
84
|
-
case
|
|
88
|
+
case FormStepTypes.TEXTAREA: {
|
|
85
89
|
return (_jsx(TextAreaStep, __assign({}, props, { step: step, editable: editable })));
|
|
86
90
|
}
|
|
87
|
-
case
|
|
91
|
+
case FormStepTypes.TEXTINPUT: {
|
|
88
92
|
return (_jsx(TextInputStep, __assign({}, props, { step: step, editable: editable })));
|
|
89
93
|
}
|
|
90
|
-
case
|
|
94
|
+
case FormStepTypes.DATEPICKER: {
|
|
91
95
|
return (_jsx(DatePickerStep, __assign({}, props, { step: step, editable: editable })));
|
|
92
96
|
}
|
|
93
|
-
case
|
|
97
|
+
case FormStepTypes.SEPARATOR: {
|
|
94
98
|
return (_jsx(SeparatorStep, __assign({}, props, { step: step, editable: editable })));
|
|
95
99
|
}
|
|
96
|
-
case
|
|
100
|
+
case FormStepTypes.FILEUPLOAD: {
|
|
97
101
|
return (_jsx(FileUploadStep, __assign({}, props, { step: step, editable: editable })));
|
|
98
102
|
}
|
|
99
|
-
case
|
|
103
|
+
case FormStepTypes.RATING: {
|
|
100
104
|
return (_jsx(RatingStep, __assign({}, props, { step: step, editable: editable })));
|
|
101
105
|
}
|
|
102
|
-
case
|
|
106
|
+
case FormStepTypes.COLLAPSIBLE: {
|
|
103
107
|
return (_jsx(CollapsibleStep, __assign({}, props, { step: step, editable: editable })));
|
|
104
108
|
}
|
|
105
|
-
case
|
|
109
|
+
case FormStepTypes.ENTITYVALUEPICKER: {
|
|
106
110
|
return (_jsx(EntityValuePickerStep, __assign({}, props, { step: step, editable: editable })));
|
|
107
111
|
}
|
|
108
|
-
case
|
|
112
|
+
case FormStepTypes.API_SELECTOR: {
|
|
109
113
|
return (_jsx(ApiSelectorStep, __assign({}, props, { step: step, editable: editable })));
|
|
110
114
|
}
|
|
111
|
-
case
|
|
115
|
+
case FormStepTypes.MAPPER: {
|
|
112
116
|
return (_jsx(MapperStep, __assign({}, props, { step: step, editable: editable })));
|
|
113
117
|
}
|
|
114
118
|
default:
|
|
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes,
|
|
10
|
+
import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
|
|
11
11
|
import CBRFormStepTypes from '../constants/CBRFormStepTypes';
|
|
12
12
|
import AYFFormStepTypes from '../constants/AYFFormStepTypes';
|
|
13
13
|
import { getRawText } from '../Utils/DraftFunctions';
|
|
@@ -29,7 +29,7 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
29
29
|
var step = steps[idStep];
|
|
30
30
|
var value = values[idStep];
|
|
31
31
|
switch (step.type) {
|
|
32
|
-
case
|
|
32
|
+
case FormStepTypes.SELECTOR: {
|
|
33
33
|
var size = step.size;
|
|
34
34
|
if (value) {
|
|
35
35
|
var currentOption = step.options.find(function (option) { return option.value === value.value; });
|
|
@@ -45,7 +45,7 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
45
45
|
}
|
|
46
46
|
return size;
|
|
47
47
|
}
|
|
48
|
-
case
|
|
48
|
+
case FormStepTypes.CLASSIFIER_SELECTOR: {
|
|
49
49
|
var size = step.size;
|
|
50
50
|
if (value) {
|
|
51
51
|
var currentOption = step.options[value];
|
|
@@ -60,7 +60,7 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
60
60
|
}
|
|
61
61
|
return size;
|
|
62
62
|
}
|
|
63
|
-
case
|
|
63
|
+
case FormStepTypes.ENTITYVALUEPICKER: {
|
|
64
64
|
var size = step.size;
|
|
65
65
|
if (value) {
|
|
66
66
|
var currentOption = step.options[value];
|
|
@@ -75,7 +75,7 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
75
75
|
}
|
|
76
76
|
return size;
|
|
77
77
|
}
|
|
78
|
-
case
|
|
78
|
+
case FormStepTypes.API_SELECTOR: {
|
|
79
79
|
var size = step.size;
|
|
80
80
|
if (value) {
|
|
81
81
|
var currentOption = step.options[value];
|
|
@@ -90,7 +90,7 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
90
90
|
}
|
|
91
91
|
return size;
|
|
92
92
|
}
|
|
93
|
-
case
|
|
93
|
+
case FormStepTypes.CHECKBOX: {
|
|
94
94
|
var size = step.size;
|
|
95
95
|
var stepSteps = value ? step.steps : step.uncheckedSteps;
|
|
96
96
|
var optionSize = 0;
|
|
@@ -101,8 +101,8 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
101
101
|
size += optionSize;
|
|
102
102
|
return size;
|
|
103
103
|
}
|
|
104
|
-
case
|
|
105
|
-
case
|
|
104
|
+
case FormStepTypes.DATEPICKER:
|
|
105
|
+
case FormStepTypes.TEXTINPUT: {
|
|
106
106
|
return step.size;
|
|
107
107
|
}
|
|
108
108
|
default:
|
|
@@ -115,35 +115,37 @@ export var calcStepWidth = function (stepSize, size) {
|
|
|
115
115
|
export var calcDefaultValue = function (step) {
|
|
116
116
|
var _a, _b;
|
|
117
117
|
switch (step.type) {
|
|
118
|
-
case
|
|
118
|
+
case FormStepTypes.CHECKBOX:
|
|
119
119
|
return (_a = step.defaultValue) !== null && _a !== void 0 ? _a : false;
|
|
120
|
-
case
|
|
120
|
+
case FormStepTypes.TITLE:
|
|
121
121
|
return undefined;
|
|
122
|
-
case
|
|
122
|
+
case FormStepTypes.TIMEPICKER:
|
|
123
|
+
return step.defaultValue;
|
|
124
|
+
case FormStepTypes.SELECTOR:
|
|
123
125
|
if (step.defaultValue)
|
|
124
126
|
return ((_b = step.options.find(function (option) { return option.value === step.defaultValue; })) !== null && _b !== void 0 ? _b : '');
|
|
125
127
|
return '';
|
|
126
|
-
case
|
|
127
|
-
case
|
|
128
|
+
case FormStepTypes.TEXTINPUT:
|
|
129
|
+
case FormStepTypes.CLASSIFIER_SELECTOR:
|
|
128
130
|
return '';
|
|
129
|
-
case
|
|
131
|
+
case FormStepTypes.TEXTAREA:
|
|
130
132
|
if (step.hasTextEditor)
|
|
131
133
|
return getRawText();
|
|
132
134
|
else
|
|
133
135
|
return '';
|
|
134
|
-
case
|
|
135
|
-
case
|
|
136
|
-
case
|
|
137
|
-
case
|
|
136
|
+
case FormStepTypes.RATING:
|
|
137
|
+
case FormStepTypes.DATEPICKER:
|
|
138
|
+
case FormStepTypes.API_SELECTOR:
|
|
139
|
+
case FormStepTypes.ENTITYVALUEPICKER:
|
|
138
140
|
return null;
|
|
139
|
-
case
|
|
141
|
+
case FormStepTypes.MAPPER:
|
|
140
142
|
return { elements: [], page: 0 };
|
|
141
|
-
case
|
|
143
|
+
case FormStepTypes.FILEUPLOAD:
|
|
142
144
|
case CBRFormStepTypes.CBR_INCIDENCIAS:
|
|
143
145
|
return [];
|
|
144
|
-
case
|
|
146
|
+
case FormStepTypes.COLLAPSIBLE:
|
|
145
147
|
return false;
|
|
146
|
-
case
|
|
148
|
+
case FormStepTypes.SEPARATOR:
|
|
147
149
|
default:
|
|
148
150
|
return undefined;
|
|
149
151
|
}
|
|
@@ -155,7 +157,7 @@ export var iterateNestedSteps = function (idStep, steps, iteration) {
|
|
|
155
157
|
return;
|
|
156
158
|
}
|
|
157
159
|
iteration(step);
|
|
158
|
-
if (step.type ===
|
|
160
|
+
if (step.type === FormStepTypes.MAPPER) {
|
|
159
161
|
for (var _i = 0, _a = step.rootSteps; _i < _a.length; _i++) {
|
|
160
162
|
var idStep_1 = _a[_i];
|
|
161
163
|
iterateNestedSteps(idStep_1, step.steps, iteration);
|
|
@@ -189,7 +191,7 @@ export var calcSubSteps = function (idStep, allSteps, idModifier) {
|
|
|
189
191
|
}
|
|
190
192
|
};
|
|
191
193
|
switch (step.type) {
|
|
192
|
-
case
|
|
194
|
+
case FormStepTypes.SELECTOR: {
|
|
193
195
|
for (var _i = 0, _b = step.options; _i < _b.length; _i++) {
|
|
194
196
|
var option = _b[_i];
|
|
195
197
|
if (option.type === OptionTypes.NESTED) {
|
|
@@ -198,7 +200,7 @@ export var calcSubSteps = function (idStep, allSteps, idModifier) {
|
|
|
198
200
|
}
|
|
199
201
|
break;
|
|
200
202
|
}
|
|
201
|
-
case
|
|
203
|
+
case FormStepTypes.CLASSIFIER_SELECTOR:
|
|
202
204
|
for (var _c = 0, _d = Object.keys(step.options); _c < _d.length; _c++) {
|
|
203
205
|
var idOption = _d[_c];
|
|
204
206
|
var option = step.options[idOption];
|
|
@@ -207,7 +209,7 @@ export var calcSubSteps = function (idStep, allSteps, idModifier) {
|
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
break;
|
|
210
|
-
case
|
|
212
|
+
case FormStepTypes.RATING:
|
|
211
213
|
if (step.nestedSteps) {
|
|
212
214
|
for (var _e = 0, _f = step.nestedSteps; _e < _f.length; _e++) {
|
|
213
215
|
var steps = _f[_e];
|
|
@@ -215,18 +217,18 @@ export var calcSubSteps = function (idStep, allSteps, idModifier) {
|
|
|
215
217
|
}
|
|
216
218
|
}
|
|
217
219
|
break;
|
|
218
|
-
case
|
|
220
|
+
case FormStepTypes.COLLAPSIBLE: {
|
|
219
221
|
handleSteps(step.steps);
|
|
220
222
|
break;
|
|
221
223
|
}
|
|
222
|
-
case
|
|
224
|
+
case FormStepTypes.CHECKBOX: {
|
|
223
225
|
if (step.steps)
|
|
224
226
|
handleSteps(step.steps);
|
|
225
227
|
if (step.uncheckedSteps)
|
|
226
228
|
handleSteps(step.uncheckedSteps);
|
|
227
229
|
break;
|
|
228
230
|
}
|
|
229
|
-
case
|
|
231
|
+
case FormStepTypes.ENTITYVALUEPICKER:
|
|
230
232
|
if (idModifier) {
|
|
231
233
|
for (var _g = 0, _h = step.path; _g < _h.length; _g++) {
|
|
232
234
|
var path = _h[_g];
|
|
@@ -303,7 +305,7 @@ export var evaluateCondition = function (condition, dependencies, entityValue) {
|
|
|
303
305
|
return !boolFactor;
|
|
304
306
|
}
|
|
305
307
|
var dependency = dependencies[condition.idStep];
|
|
306
|
-
var
|
|
308
|
+
var value_2 = dependencies[condition.idStep].value;
|
|
307
309
|
switch (condition.stepType) {
|
|
308
310
|
// case FormStepTypes.AGENTPICKER:
|
|
309
311
|
// return await evaluateAgentCondition(
|
|
@@ -312,32 +314,77 @@ export var evaluateCondition = function (condition, dependencies, entityValue) {
|
|
|
312
314
|
// );
|
|
313
315
|
case FormStepTypes.CHECKBOX: {
|
|
314
316
|
var boolFactor = condition.operator === OperatorTypes.EQUAL;
|
|
315
|
-
return
|
|
317
|
+
return value_2 === condition.value ? boolFactor : !boolFactor;
|
|
318
|
+
}
|
|
319
|
+
case FormStepTypes.TIMEPICKER: {
|
|
320
|
+
var boolFactor = condition.operator === OperatorTypes.INCLUDES;
|
|
321
|
+
if (!value_2)
|
|
322
|
+
return !boolFactor;
|
|
323
|
+
var evaluateCondition_1 = function (condition) {
|
|
324
|
+
var property = condition.property;
|
|
325
|
+
if (property === 'working') {
|
|
326
|
+
var boolFactor_1 = condition.propertyOperator ===
|
|
327
|
+
OperatorTypes.EQUAL;
|
|
328
|
+
if (value_2.working === condition.value) {
|
|
329
|
+
return boolFactor_1;
|
|
330
|
+
}
|
|
331
|
+
return !boolFactor_1;
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
var time = value_2;
|
|
335
|
+
switch (condition.propertyOperator) {
|
|
336
|
+
case OperatorTypes.EQUAL: {
|
|
337
|
+
return time[property] === condition.value;
|
|
338
|
+
}
|
|
339
|
+
case OperatorTypes.NOTEQUAL: {
|
|
340
|
+
return time[property] !== condition.value;
|
|
341
|
+
}
|
|
342
|
+
case OperatorTypes.LESS: {
|
|
343
|
+
var propValue = time[property];
|
|
344
|
+
if (!propValue)
|
|
345
|
+
return false;
|
|
346
|
+
return propValue < condition.value;
|
|
347
|
+
}
|
|
348
|
+
case OperatorTypes.MORE: {
|
|
349
|
+
var propValue = time[property];
|
|
350
|
+
if (!propValue)
|
|
351
|
+
return false;
|
|
352
|
+
return propValue > condition.value;
|
|
353
|
+
}
|
|
354
|
+
default: {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
return evaluateCondition_1(condition)
|
|
361
|
+
? boolFactor
|
|
362
|
+
: !boolFactor;
|
|
316
363
|
}
|
|
317
364
|
case FormStepTypes.DATEPICKER: {
|
|
318
|
-
if (!(
|
|
365
|
+
if (!(value_2 instanceof Date) || isNaN(value_2.getTime())) {
|
|
319
366
|
return condition.operator === OperatorTypes.NOTEQUAL;
|
|
320
367
|
}
|
|
321
368
|
var propertyDate = new Date(condition.value);
|
|
322
369
|
switch (condition.operator) {
|
|
323
370
|
case OperatorTypes.EQUAL:
|
|
324
|
-
return (
|
|
371
|
+
return (value_2.toUTCString().split('T')[0] ===
|
|
325
372
|
propertyDate.toUTCString().split('T')[0]);
|
|
326
373
|
case OperatorTypes.NOTEQUAL:
|
|
327
|
-
return (
|
|
374
|
+
return (value_2.toUTCString().split('T')[0] !==
|
|
328
375
|
propertyDate.toUTCString().split('T')[0]);
|
|
329
376
|
case OperatorTypes.LESS:
|
|
330
|
-
return
|
|
377
|
+
return value_2.getTime() < propertyDate.getTime();
|
|
331
378
|
case OperatorTypes.MORE:
|
|
332
|
-
return
|
|
379
|
+
return value_2.getTime() > propertyDate.getTime();
|
|
333
380
|
default:
|
|
334
381
|
return false;
|
|
335
382
|
}
|
|
336
383
|
}
|
|
337
384
|
case FormStepTypes.SELECTOR: {
|
|
338
385
|
var val = dependency.type === 'ORIGINAL'
|
|
339
|
-
?
|
|
340
|
-
: (_a =
|
|
386
|
+
? value_2
|
|
387
|
+
: (_a = value_2 === null || value_2 === void 0 ? void 0 : value_2.value) !== null && _a !== void 0 ? _a : null;
|
|
341
388
|
if (condition.operator === OperatorTypes.EQUAL) {
|
|
342
389
|
return condition.value === val;
|
|
343
390
|
}
|
|
@@ -347,18 +394,18 @@ export var evaluateCondition = function (condition, dependencies, entityValue) {
|
|
|
347
394
|
}
|
|
348
395
|
case FormStepTypes.TEXTINPUT: {
|
|
349
396
|
if (condition.operator === OperatorTypes.INCLUDES) {
|
|
350
|
-
return (_b =
|
|
397
|
+
return (_b = value_2 === null || value_2 === void 0 ? void 0 : value_2.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(condition.value.toLowerCase());
|
|
351
398
|
}
|
|
352
399
|
else if (condition.operator === OperatorTypes.NOTINCLUDES) {
|
|
353
|
-
return !((_c =
|
|
400
|
+
return !((_c = value_2 === null || value_2 === void 0 ? void 0 : value_2.toLowerCase()) === null || _c === void 0 ? void 0 : _c.includes(condition.value.toLowerCase()));
|
|
354
401
|
}
|
|
355
402
|
else if (condition.operator === OperatorTypes.EQUAL) {
|
|
356
403
|
return (condition.value.toLowerCase() ===
|
|
357
|
-
(
|
|
404
|
+
(value_2 === null || value_2 === void 0 ? void 0 : value_2.toLowerCase()));
|
|
358
405
|
}
|
|
359
406
|
else if (condition.operator === OperatorTypes.NOTEQUAL) {
|
|
360
407
|
return !(condition.value.toLowerCase() ===
|
|
361
|
-
(
|
|
408
|
+
(value_2 === null || value_2 === void 0 ? void 0 : value_2.toLowerCase()));
|
|
362
409
|
}
|
|
363
410
|
else {
|
|
364
411
|
return false;
|
|
@@ -372,36 +419,36 @@ export var evaluateCondition = function (condition, dependencies, entityValue) {
|
|
|
372
419
|
}
|
|
373
420
|
regx += ')\\b';
|
|
374
421
|
if (condition.operator === OperatorTypes.INCLUDES) {
|
|
375
|
-
return (
|
|
422
|
+
return (value_2 && new RegExp(regx).test(value_2.toLowerCase()));
|
|
376
423
|
}
|
|
377
424
|
else {
|
|
378
|
-
return (!
|
|
379
|
-
!new RegExp(regx).test(
|
|
425
|
+
return (!value_2 ||
|
|
426
|
+
!new RegExp(regx).test(value_2.toLowerCase()));
|
|
380
427
|
}
|
|
381
428
|
}
|
|
382
429
|
case FormStepTypes.RATING: {
|
|
383
|
-
if (!
|
|
430
|
+
if (!value_2 || isNaN(value_2)) {
|
|
384
431
|
return condition.operator === OperatorTypes.NOTEQUAL;
|
|
385
432
|
}
|
|
386
433
|
switch (condition.operator) {
|
|
387
434
|
case OperatorTypes.EQUAL:
|
|
388
435
|
case OperatorTypes.NOTEQUAL: {
|
|
389
436
|
var boolFactor = condition.operator === OperatorTypes.EQUAL;
|
|
390
|
-
if (
|
|
437
|
+
if (value_2 === condition.value)
|
|
391
438
|
return boolFactor;
|
|
392
439
|
return !boolFactor;
|
|
393
440
|
}
|
|
394
441
|
case OperatorTypes.LESS:
|
|
395
|
-
return
|
|
442
|
+
return value_2 < condition.value;
|
|
396
443
|
case OperatorTypes.MORE:
|
|
397
|
-
return
|
|
444
|
+
return value_2 > condition.value;
|
|
398
445
|
default:
|
|
399
446
|
return false;
|
|
400
447
|
}
|
|
401
448
|
}
|
|
402
449
|
case FormStepTypes.CLASSIFIER_SELECTOR: {
|
|
403
450
|
var boolFactor = condition.operator === OperatorTypes.EQUAL;
|
|
404
|
-
if ((
|
|
451
|
+
if ((value_2 === null || value_2 === void 0 ? void 0 : value_2.value) === condition.idValue) {
|
|
405
452
|
//Si op es EQUALS (boolfactor true) evaluará a true
|
|
406
453
|
//Si op es NOTEQUALS (boolfactor false) evaluará a false
|
|
407
454
|
return boolFactor;
|
|
@@ -414,7 +461,7 @@ export var evaluateCondition = function (condition, dependencies, entityValue) {
|
|
|
414
461
|
var boolFactor = condition.operator === OperatorTypes.EQUAL;
|
|
415
462
|
for (var _g = 0, _h = condition.values; _g < _h.length; _g++) {
|
|
416
463
|
var idEntityValue = _h[_g];
|
|
417
|
-
if ((
|
|
464
|
+
if ((value_2 === null || value_2 === void 0 ? void 0 : value_2._id) === idEntityValue) {
|
|
418
465
|
return boolFactor;
|
|
419
466
|
}
|
|
420
467
|
}
|
|
@@ -466,8 +513,8 @@ var evaluateEntityValueCondition = function (condition, entity, entityValue) {
|
|
|
466
513
|
var evaluateEntityPropertyCondition = function (condition, entity, entityValue) {
|
|
467
514
|
if (isEntityPropertyExistance(condition)) {
|
|
468
515
|
var boolFactor = condition.propertyOperator === OperatorTypes.EXISTS;
|
|
469
|
-
var
|
|
470
|
-
if (
|
|
516
|
+
var value_3 = entityValue[condition.idProperty];
|
|
517
|
+
if (value_3 !== undefined) {
|
|
471
518
|
return boolFactor;
|
|
472
519
|
}
|
|
473
520
|
return !boolFactor;
|
|
@@ -530,6 +577,46 @@ var evaluateEntityPropertyCondition = function (condition, entity, entityValue)
|
|
|
530
577
|
}
|
|
531
578
|
return false;
|
|
532
579
|
}
|
|
580
|
+
case EntityPropertyTypes.TIMEPICKER: {
|
|
581
|
+
var boolFactor = condition.propertyOperator === OperatorTypes.INCLUDES;
|
|
582
|
+
var evaluateCondition_2 = function (condition) {
|
|
583
|
+
var timeProperty = condition.property;
|
|
584
|
+
if (timeProperty === 'working') {
|
|
585
|
+
var boolFactor_2 = condition.timePropertyOperator === OperatorTypes.EQUAL;
|
|
586
|
+
if (value.working === condition.value) {
|
|
587
|
+
return boolFactor_2;
|
|
588
|
+
}
|
|
589
|
+
return !boolFactor_2;
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
var time = value;
|
|
593
|
+
switch (condition.timePropertyOperator) {
|
|
594
|
+
case OperatorTypes.EQUAL: {
|
|
595
|
+
return time[timeProperty] === condition.value;
|
|
596
|
+
}
|
|
597
|
+
case OperatorTypes.NOTEQUAL: {
|
|
598
|
+
return time[timeProperty] !== condition.value;
|
|
599
|
+
}
|
|
600
|
+
case OperatorTypes.LESS: {
|
|
601
|
+
var propValue = time[timeProperty];
|
|
602
|
+
if (!propValue)
|
|
603
|
+
return false;
|
|
604
|
+
return propValue < condition.value;
|
|
605
|
+
}
|
|
606
|
+
case OperatorTypes.MORE: {
|
|
607
|
+
var propValue = time[timeProperty];
|
|
608
|
+
if (!propValue)
|
|
609
|
+
return false;
|
|
610
|
+
return propValue > condition.value;
|
|
611
|
+
}
|
|
612
|
+
default: {
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
return evaluateCondition_2(condition) ? boolFactor : !boolFactor;
|
|
619
|
+
}
|
|
533
620
|
case EntityPropertyTypes.SELECTOR:
|
|
534
621
|
case EntityPropertyTypes.TEXTAREA:
|
|
535
622
|
case EntityPropertyTypes.TEXTINPUT: {
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import RoundedTimePicker from '../../../Shared/RoundedTimePicker/RoundedTimePicker';
|
|
14
|
+
import { useAppSelector } from '../../../hooks';
|
|
15
|
+
import { useFormStep } from '../../StepHooks';
|
|
16
|
+
import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
|
|
17
|
+
function TimePickerStep(_a) {
|
|
18
|
+
var _b;
|
|
19
|
+
var step = _a.step, editable = _a.editable, defaultValue = _a.defaultValue;
|
|
20
|
+
var _c = useAppSelector(function (state) { return state.global; }), formStyle = _c.formStyle, postview = _c.postview;
|
|
21
|
+
var _d = useFormStep(step, {
|
|
22
|
+
defaultValue: defaultValue,
|
|
23
|
+
rules: {
|
|
24
|
+
required: step ? 'Este campo es obligatorio' : undefined,
|
|
25
|
+
},
|
|
26
|
+
}), ref = _d.ref, value = _d.value, onChange = _d.onChange, error = _d.error, field = _d.field;
|
|
27
|
+
return (_jsx(MaterialInputContainer, __assign({ step: step, editable: editable }, { children: _jsx(RoundedTimePicker, __assign({}, field, { value: value, onChange: onChange, inputRef: ref, cantEdit: !editable || postview, errorColor: formStyle.errorColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, helperTextColor: formStyle.descriptionTextColor, backgroundColor: formStyle.stepBackgroundColor, fontWeight: 400, label: step.label, helperText: (_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : step.description, error: !!error, required: step.required, pickDays: step.pickDays, pickHours: step.pickHours, pickMinutes: step.pickMinutes, working: step.working })) })));
|
|
28
|
+
}
|
|
29
|
+
export default TimePickerStep;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TimePicker } from '../../@Types/FormStep';
|
|
3
|
+
import { StepProps } from '../Step';
|
|
4
|
+
import { Time } from '../../@Types/Time';
|
|
5
|
+
export interface TimePickerStepProps extends StepProps {
|
|
6
|
+
/** The TimePickerStep to display */
|
|
7
|
+
step: TimePicker;
|
|
8
|
+
/** Default value to display */
|
|
9
|
+
defaultValue?: Time;
|
|
10
|
+
}
|
|
11
|
+
declare function TimePickerStep(props: TimePickerStepProps): JSX.Element;
|
|
12
|
+
export default TimePickerStep;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
14
|
+
import { useAppSelector } from '../../hooks';
|
|
15
|
+
import MaterialTimePickerStep from './MaterialTimePickerStep/MaterialTimePickerStep';
|
|
16
|
+
function TimePickerStep(props) {
|
|
17
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
18
|
+
switch (formStyle.type) {
|
|
19
|
+
case FormStyleTypes.MATERIAL:
|
|
20
|
+
default: {
|
|
21
|
+
return _jsx(MaterialTimePickerStep, __assign({}, props));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export default TimePickerStep;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GSmartSelect } from '../../../@Types/GenericFormSteps';
|
|
3
|
-
import { CheckBox, DatePicker, ClassifierSelector, FormSelector } from '../../../@Types/FormStep';
|
|
3
|
+
import { CheckBox, DatePicker, ClassifierSelector, FormSelector, TimePicker } from '../../../@Types/FormStep';
|
|
4
4
|
interface MaterialInputProps {
|
|
5
|
-
step: GSmartSelect | CheckBox | ClassifierSelector | DatePicker | FormSelector;
|
|
5
|
+
step: GSmartSelect | CheckBox | ClassifierSelector | DatePicker | TimePicker | FormSelector;
|
|
6
6
|
editable: boolean;
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
children: React.ReactNode;
|