@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.
Files changed (39) hide show
  1. package/dist/@Types/Condition.d.ts +33 -2
  2. package/dist/@Types/Entity.d.ts +4 -1
  3. package/dist/@Types/FormStep.d.ts +21 -16
  4. package/dist/@Types/GenericFormSteps.d.ts +11 -0
  5. package/dist/@Types/Time.d.ts +6 -0
  6. package/dist/@Types/Time.js +1 -0
  7. package/dist/App/App.d.ts +3 -1
  8. package/dist/App/App.js +1 -1
  9. package/dist/App/AppFunctions.d.ts +0 -3
  10. package/dist/App/AppFunctions.js +9 -53
  11. package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +26 -3
  12. package/dist/Form/ConfirmationDialog/ConfirmationDialog.module.css +10 -5
  13. package/dist/Form/Form.d.ts +4 -4
  14. package/dist/Form/Form.js +2 -2
  15. package/dist/Form/FormFunctions.js +13 -13
  16. package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +1 -1
  17. package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +18 -3
  18. package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +1 -1
  19. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +1 -1
  20. package/dist/FormSteps/Step.js +19 -15
  21. package/dist/FormSteps/StepFunctions.js +140 -53
  22. package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.d.ts +4 -0
  23. package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.js +29 -0
  24. package/dist/FormSteps/TimePickerStep/TimePickerStep.d.ts +12 -0
  25. package/dist/FormSteps/TimePickerStep/TimePickerStep.js +25 -0
  26. package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.d.ts +2 -2
  27. package/dist/Shared/RoundedSelect/RoundedSelect.d.ts +2 -2
  28. package/dist/Shared/RoundedTimePicker/RoundedTimePicker.d.ts +35 -0
  29. package/dist/Shared/RoundedTimePicker/RoundedTimePicker.js +293 -0
  30. package/dist/Shared/RoundedTimePicker/RoundedTimePicker.module.css +30 -0
  31. package/dist/Shared/Toggle/Toggle.d.ts +18 -0
  32. package/dist/Shared/Toggle/Toggle.js +31 -0
  33. package/dist/Utils/FormStepFunctions.d.ts +15 -0
  34. package/dist/Utils/FormStepFunctions.js +166 -0
  35. package/dist/constants/EntityPropertyTypes.d.ts +1 -0
  36. package/dist/constants/EntityPropertyTypes.js +1 -0
  37. package/dist/constants/FormStepTypes.d.ts +3 -2
  38. package/dist/constants/FormStepTypes.js +19 -18
  39. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SelectProps } from '@material-ui/core/Select';
3
- interface StyleProps {
3
+ export interface SelectorStyleProps {
4
4
  /** The color of the outline when selected and hovered on */
5
5
  focusColor?: string;
6
6
  /** The color of the outline when it is not selected */
@@ -32,7 +32,7 @@ interface StyleProps {
32
32
  /** If custom icon exists and should be displayed */
33
33
  showIcon?: boolean;
34
34
  }
35
- interface RoundedSelectProps extends Omit<SelectProps, 'color'>, StyleProps {
35
+ interface RoundedSelectProps extends Omit<SelectProps, 'color'>, SelectorStyleProps {
36
36
  /** children to display in the options */
37
37
  children?: any;
38
38
  /** Currently selected value */
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { SelectProps } from '@material-ui/core/Select';
3
+ import { SelectorStyleProps } from '../RoundedSelect/RoundedSelect';
4
+ import { Time } from '../../@Types/Time';
5
+ interface RoundedTimePickerProps extends Omit<SelectProps, 'color' | 'onChange'>, SelectorStyleProps {
6
+ /** Currently selected value */
7
+ value: Time | undefined;
8
+ /** function called when value changes */
9
+ onChange?: (time: Time) => void;
10
+ /** Strig to place in the label */
11
+ label: string;
12
+ /** Minimum width in px of the component */
13
+ minWidth?: number;
14
+ /** The helper Text to display */
15
+ helperText?: string | null;
16
+ /** The color of the outline when selected and hovered on */
17
+ focusColor?: string;
18
+ /** If outline should be error color */
19
+ highlightError?: boolean;
20
+ /** the margin around the selector */
21
+ containerMargin?: string;
22
+ /** The icon to display */
23
+ iconComponent?: any;
24
+ pickDays?: boolean;
25
+ pickHours?: boolean;
26
+ pickMinutes?: boolean;
27
+ working?: boolean;
28
+ }
29
+ /**
30
+ * Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
31
+ */
32
+ declare class RoundedTimePicker extends React.Component<RoundedTimePickerProps> {
33
+ render(): JSX.Element;
34
+ }
35
+ export default RoundedTimePicker;
@@ -0,0 +1,293 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ var __rest = (this && this.__rest) || function (s, e) {
28
+ var t = {};
29
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
+ t[p] = s[p];
31
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
+ t[p[i]] = s[p[i]];
35
+ }
36
+ return t;
37
+ };
38
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
39
+ import React, { useCallback, useState } from 'react';
40
+ import { makeStyles } from '@material-ui/core/styles';
41
+ import InputLabel from '@material-ui/core/InputLabel';
42
+ import FormControl from '@material-ui/core/FormControl';
43
+ import OutlinedInput from '@material-ui/core/OutlinedInput';
44
+ import Select from '@material-ui/core/Select';
45
+ import { ClickAwayListener, FormHelperText, MenuItem, Popper, } from '@material-ui/core';
46
+ import ScheduleRoundedIcon from '@material-ui/icons/ScheduleRounded';
47
+ import styles from './RoundedTimePicker.module.css';
48
+ import RoundedTextField from '../RoundedTextField/RoundedTextField';
49
+ import Toggle from '../Toggle/Toggle';
50
+ var useStyles = makeStyles(function (theme) { return ({
51
+ root: {
52
+ display: 'flex',
53
+ flexWrap: 'wrap',
54
+ },
55
+ formControl: {
56
+ margin: theme.spacing(1),
57
+ minWidth: 120,
58
+ },
59
+ selectEmpty: {
60
+ marginTop: theme.spacing(2),
61
+ },
62
+ }); });
63
+ var useOutlinedInputStyles = function (props) {
64
+ var _a;
65
+ return makeStyles({
66
+ root: {
67
+ cursor: props.cantEdit ? 'default' : 'default',
68
+ height: props.height,
69
+ borderRadius: props.borderRadius,
70
+ backgroundColor: props.backgroundColor,
71
+ fontSize: props.fontSize,
72
+ '& $notchedOutline': {
73
+ borderColor: props.outlineColor,
74
+ '& legend': {
75
+ fontSize: 'calc(' + props.fontSize + ' * 0.75)',
76
+ },
77
+ },
78
+ '&:hover $notchedOutline': {
79
+ borderColor: props.cantEdit
80
+ ? props.outlineColor
81
+ : props.focusColor,
82
+ },
83
+ '& .Mui-disabled': {
84
+ cursor: 'default',
85
+ color: props.color,
86
+ pointerEvents: 'none',
87
+ },
88
+ '& .Mui-error': {
89
+ color: props.errorColor,
90
+ },
91
+ '&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
92
+ borderColor: props.outlineColor,
93
+ },
94
+ '&.Mui-disabled .EF-MuiOutlinedInput-notchedOutline': {
95
+ borderColor: props.outlineColor,
96
+ },
97
+ '& .EF-MuiSelect-root': {
98
+ paddingLeft: props.paddingLeft,
99
+ paddingRight: props.paddingRight,
100
+ },
101
+ '&$focused $notchedOutline': {
102
+ borderColor: props.focusColor,
103
+ },
104
+ '& .EF-MuiSelect-icon': {
105
+ color: ((_a = props.color) === null || _a === void 0 ? void 0 : _a.startsWith('#'))
106
+ ? props.color + '8a'
107
+ : props.color,
108
+ },
109
+ '& .EF-MuiSelect-icon.Mui-disabled': {
110
+ color: props.outlineColor,
111
+ },
112
+ '& .EF-MuiSelect-icon.iconOutlined': {
113
+ right: 8,
114
+ },
115
+ '& .EF-MuiSelect-iconOpen': {
116
+ transform: props.showIcon ? 'none' : 'rotate(180deg)',
117
+ },
118
+ color: props.color,
119
+ },
120
+ focused: {},
121
+ notchedOutline: {},
122
+ });
123
+ };
124
+ var useLabelInputStyles = function (props) {
125
+ return makeStyles(function () {
126
+ var _a;
127
+ return ({
128
+ focused: {
129
+ color: props.focusColor + ' !important',
130
+ },
131
+ root: {
132
+ color: ((_a = props.color) === null || _a === void 0 ? void 0 : _a.startsWith('#'))
133
+ ? props.color + '8a'
134
+ : props.color,
135
+ fontWeight: props.fontWeight,
136
+ whiteSpace: 'nowrap',
137
+ overflow: 'hidden',
138
+ maxWidth: 'calc(100% - 45px)',
139
+ textOverflow: 'ellipsis',
140
+ marginTop: props.height != '40px' ? '-4px' : '0px',
141
+ '&.EF-MuiInputLabel-shrink': {
142
+ marginTop: '0px',
143
+ maxWidth: 'calc(100% - 5px)',
144
+ },
145
+ '& .Mui-error': {
146
+ color: props.errorColor,
147
+ },
148
+ '&.Mui-error': {
149
+ color: props.errorColor,
150
+ },
151
+ },
152
+ });
153
+ });
154
+ };
155
+ var useHelperTextStyles = function (props) {
156
+ return makeStyles(function () { return ({
157
+ root: {
158
+ color: props.helperTextColor,
159
+ '&.Mui-error': {
160
+ color: props.errorColor,
161
+ },
162
+ },
163
+ }); });
164
+ };
165
+ var useMenuStyles = function () {
166
+ return makeStyles(function () { return ({
167
+ root: {
168
+ '& .EF-MuiPaper-root': {
169
+ opacity: '0 !important',
170
+ },
171
+ },
172
+ }); });
173
+ };
174
+ function CustomSelect(_a) {
175
+ var _b, _c, _d;
176
+ var value = _a.value, onChange = _a.onChange, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _e = _a.color, color = _e === void 0 ? '#293241' : _e, _f = _a.errorColor, errorColor = _f === void 0 ? '#cc2936' : _f, _g = _a.focusColor, focusColor = _g === void 0 ? '#3d5a7f' : _g, _h = _a.outlineColor, outlineColor = _h === void 0 ? '#0000003b' : _h, _j = _a.helperTextColor, helperTextColor = _j === void 0 ? '#989898' : _j, _k = _a.backgroundColor, backgroundColor = _k === void 0 ? '#ffffff' : _k, _l = _a.readOnly, readOnly = _l === void 0 ? false : _l, _m = _a.borderRadius, borderRadius = _m === void 0 ? 10 : _m, _o = _a.paddingLeft, paddingLeft = _o === void 0 ? 14 : _o, _p = _a.paddingRight, paddingRight = _p === void 0 ? 32 : _p, _q = _a.cantEdit, cantEdit = _q === void 0 ? false : _q, _r = _a.containerMargin, containerMargin = _r === void 0 ? '8px' : _r, _s = _a.height, height = _s === void 0 ? '40px' : _s, _t = _a.fontSize, fontSize = _t === void 0 ? '1rem' : _t, required = _a.required, error = _a.error, pickDays = _a.pickDays, pickMinutes = _a.pickMinutes, pickHours = _a.pickHours, working = _a.working, others = __rest(_a, ["value", "onChange", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "backgroundColor", "readOnly", "borderRadius", "paddingLeft", "paddingRight", "cantEdit", "containerMargin", "height", "fontSize", "required", "error", "pickDays", "pickMinutes", "pickHours", "working"]);
177
+ var StyleProps = {
178
+ color: color,
179
+ height: height,
180
+ readOnly: readOnly,
181
+ fontSize: fontSize,
182
+ cantEdit: cantEdit,
183
+ errorColor: errorColor,
184
+ focusColor: focusColor,
185
+ paddingLeft: paddingLeft,
186
+ paddingRight: paddingRight,
187
+ outlineColor: outlineColor,
188
+ borderRadius: borderRadius,
189
+ helperTextColor: helperTextColor,
190
+ backgroundColor: backgroundColor,
191
+ showIcon: true,
192
+ };
193
+ var classes = useStyles();
194
+ var outlinedInputClasses = useOutlinedInputStyles(StyleProps)();
195
+ var labelClasses = useLabelInputStyles(StyleProps)();
196
+ var helperTextClasses = useHelperTextStyles(StyleProps)();
197
+ var menuClasses = useMenuStyles()();
198
+ var _u = useState(false), open = _u[0], setOpen = _u[1];
199
+ var ref = React.useRef(null);
200
+ var handleChange = useCallback(function (value) {
201
+ if (value.days === 0) {
202
+ delete value.days;
203
+ }
204
+ if (value.hours === 0) {
205
+ delete value.hours;
206
+ }
207
+ if (value.minutes === 0) {
208
+ delete value.minutes;
209
+ }
210
+ if (working !== undefined) {
211
+ value.working = working;
212
+ }
213
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
214
+ }, []);
215
+ var calcLabel = function () {
216
+ var parts = [label];
217
+ if (working === true)
218
+ parts.push('(Hábil)');
219
+ if (required)
220
+ parts.push('*');
221
+ return parts.join(' ');
222
+ };
223
+ return (_jsxs(React.Fragment, { children: [open && (_jsx(ClickAwayListener, __assign({ mouseEvent: "onMouseDown", onClickAway: function () { return setOpen(false); } }, { children: _jsx(Popper, __assign({ open: true, anchorEl: ref.current, placement: 'bottom-start', modifiers: {
224
+ preventOverflow: {
225
+ enabled: true,
226
+ priority: ['top', 'bottom', 'left', 'right'],
227
+ boundariesElement: 'window',
228
+ padding: 20,
229
+ },
230
+ }, style: { zIndex: 1301 } }, { children: _jsxs("div", __assign({ className: styles.container }, { children: [pickDays && (_jsx("div", __assign({ className: styles.numberPickerContainer }, { children: _jsx(RoundedTextField, { label: "D\u00EDas", type: "number", inputProps: { min: 0 }, value: ((_b = value === null || value === void 0 ? void 0 : value.days) !== null && _b !== void 0 ? _b : '0') + '', onChange: function (e) {
231
+ handleChange(__assign(__assign({}, value), { days: parseInt(e.target.value) }));
232
+ } }) }))), pickHours && (_jsx("div", __assign({ className: styles.numberPickerContainer }, { children: _jsx(RoundedTextField, { label: "Horas", type: "number", inputProps: { min: 0 }, value: ((_c = value === null || value === void 0 ? void 0 : value.hours) !== null && _c !== void 0 ? _c : '0') + '', onChange: function (e) {
233
+ handleChange(__assign(__assign({}, value), { hours: parseInt(e.target.value) }));
234
+ } }) }))), pickMinutes && (_jsx("div", __assign({ className: styles.numberPickerContainer }, { children: _jsx(RoundedTextField, { label: "Minutos", type: "number", inputProps: { min: 0 }, value: ((_d = value === null || value === void 0 ? void 0 : value.minutes) !== null && _d !== void 0 ? _d : '0') + '', onChange: function (e) {
235
+ handleChange(__assign(__assign({}, value), { minutes: parseInt(e.target.value) }));
236
+ } }) }))), working === undefined && (_jsxs("div", __assign({ className: styles.workingContainer }, { children: ["H\u00E1biles:", _jsx(Toggle, { checked: !!(value === null || value === void 0 ? void 0 : value.working), disabled: working !== undefined, onChange: function (working) {
237
+ handleChange(__assign(__assign({}, value), { working: working }));
238
+ } })] })))] })) })) }))), _jsxs(FormControl, __assign({ variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
239
+ ? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
240
+ : {
241
+ margin: containerMargin,
242
+ }, fullWidth: true, required: required, error: error }, { children: [label && (_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }))), _jsx(Select, __assign({}, others, { innerRef: ref, title: calcTimeString(value), value: value ? 0 : '', IconComponent: ScheduleRoundedIcon, onClose: function () {
243
+ setOpen(false);
244
+ }, onOpen: function () {
245
+ setOpen(true);
246
+ }, onFocus: function (e) {
247
+ var _a;
248
+ if (!((_a = e.relatedTarget) === null || _a === void 0 ? void 0 : _a.closest('.EF-MuiPaper-root'))) {
249
+ setOpen(true);
250
+ }
251
+ }, onBlur: function () {
252
+ setOpen(false);
253
+ }, input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label ? calcLabel() : undefined, classes: outlinedInputClasses }), renderValue: function () {
254
+ return calcTimeString(value);
255
+ }, MenuProps: {
256
+ PopoverClasses: menuClasses,
257
+ } }, { children: _jsx(MenuItem, { value: 0 }) })), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText })))] }))] }));
258
+ }
259
+ /**
260
+ * Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
261
+ */
262
+ var RoundedTimePicker = /** @class */ (function (_super) {
263
+ __extends(RoundedTimePicker, _super);
264
+ function RoundedTimePicker() {
265
+ return _super !== null && _super.apply(this, arguments) || this;
266
+ }
267
+ RoundedTimePicker.prototype.render = function () {
268
+ return _jsx(CustomSelect, __assign({}, this.props));
269
+ };
270
+ return RoundedTimePicker;
271
+ }(React.Component));
272
+ export default RoundedTimePicker;
273
+ function calcTimeString(value) {
274
+ if (!value)
275
+ return undefined;
276
+ var parts = [];
277
+ if (value.days) {
278
+ parts.push("".concat(value.days, " D\u00EDa").concat(value.days > 1 ? 's' : ''));
279
+ }
280
+ if (value.hours) {
281
+ parts.push("".concat(value.hours, " Hora").concat(value.hours > 1 ? 's' : ''));
282
+ }
283
+ if (value.minutes) {
284
+ parts.push("".concat(value.minutes, " Minuto").concat(value.minutes > 1 ? 's' : ''));
285
+ }
286
+ if (parts.length === 0)
287
+ return value.working ? 'Horario Hábil Más Cercano' : 'Inmediatamente';
288
+ if (value.working) {
289
+ var isMultiple = parts.length > 1 || parts[0].includes('s');
290
+ return parts.join(', ') + (isMultiple ? ' Hábiles' : ' Hábil');
291
+ }
292
+ return parts.join(', ');
293
+ }
@@ -0,0 +1,30 @@
1
+ .container {
2
+ box-shadow:
3
+ 0px 5px 5px -3px rgba(0, 0, 0, 0.2),
4
+ 0px 8px 10px 1px rgba(0, 0, 0, 0.14),
5
+ 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
6
+ border-radius: 10px;
7
+ overflow: hidden;
8
+ position: relative;
9
+ background-color: white;
10
+ width: 130px;
11
+ padding: 30px 35px 30px 30px;
12
+ display: flex;
13
+ flex-direction: column;
14
+ row-gap: 10px;
15
+ }
16
+
17
+ .numberPickerContainer {
18
+ width: 130px;
19
+ padding-top: 5px;
20
+ padding-bottom: 5px;
21
+ }
22
+
23
+ .workingContainer {
24
+ display: flex;
25
+ font-size: 1.1em;
26
+ margin-left: 5px;
27
+ flex-direction: row;
28
+ column-gap: 5px;
29
+ align-items: center;
30
+ }
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { SwitchProps } from '@material-ui/core';
3
+ interface StyleProps {
4
+ /** The color of the toggle */
5
+ color?: string;
6
+ /** The color of the toggle when unchecked */
7
+ baseColor?: string;
8
+ }
9
+ interface RoundedToggleProps extends Omit<SwitchProps, 'color' | 'onChange'>, StyleProps {
10
+ /** If the toggle is checked */
11
+ checked?: boolean;
12
+ /** Function to call when the toggle is clicked on */
13
+ onChange: (checked: boolean) => void;
14
+ /** If the Toggle is disabled */
15
+ disabled?: boolean;
16
+ }
17
+ declare function RoundedToggle({ color, baseColor, checked, onChange, disabled, size, }: RoundedToggleProps): JSX.Element;
18
+ export default RoundedToggle;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { makeStyles, Switch } from '@material-ui/core';
3
+ var useStyles = function (props) {
4
+ var _a;
5
+ return makeStyles({
6
+ switchBase: {
7
+ color: props.baseColor + ' !important',
8
+ '&$checked': {
9
+ color: props.color + ' !important',
10
+ },
11
+ '&$checked + $track': {
12
+ backgroundColor: props.color + ' !important',
13
+ },
14
+ '&:hover': {
15
+ backgroundColor: ((_a = props.color) === null || _a === void 0 ? void 0 : _a.startsWith('#'))
16
+ ? props.color + '40'
17
+ : props.color,
18
+ },
19
+ },
20
+ checked: {},
21
+ track: {},
22
+ });
23
+ };
24
+ function RoundedToggle(_a) {
25
+ var _b = _a.color, color = _b === void 0 ? '#3d5a7f' : _b, _c = _a.baseColor, baseColor = _c === void 0 ? '#b8b8b8' : _c, _d = _a.checked, checked = _d === void 0 ? true : _d, onChange = _a.onChange, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.size, size = _f === void 0 ? 'medium' : _f;
26
+ var classes = useStyles({ color: color, baseColor: baseColor })();
27
+ return (_jsx(Switch, { size: size, classes: classes, checked: checked, disabled: disabled, onChange: function (event) {
28
+ onChange(event.target.checked);
29
+ } }));
30
+ }
31
+ export default RoundedToggle;
@@ -0,0 +1,15 @@
1
+ import { AYFFormStep } from '../@Types/AYFFormStep';
2
+ import { CBRFormStep } from '../@Types/CBRFormStep';
3
+ import { Condition } from '../@Types/Condition';
4
+ import { FormStep } from '../@Types/FormStep';
5
+ import { MapperElement } from '../@Types/MapperElement';
6
+ import { CustomStep } from '../FormSteps/CustomStep';
7
+ export declare function calcRecursiveData<Type>(element: Readonly<MapperElement<Type>>, newSteps: Record<string, FormStep>, customSteps: Record<string, CustomStep>): void;
8
+ export declare const calcRecursiveCondition: (condition: Condition, ids: Record<string, string>) => void;
9
+ /**
10
+ * Utility function to calc the substeps of a step
11
+ * @param step step to calc the substeps
12
+ * @param idModifier optional modifier for the ids of the substeps and all other properties
13
+ * @returns list of the ids of the substeps of the step, if modifier returns modified steps
14
+ */
15
+ export declare const calcSubSteps: (idStep: string, allSteps: Record<string, FormStep | CBRFormStep | AYFFormStep>, idModifier?: ((idSubStep: string) => string) | undefined) => string[];
@@ -0,0 +1,166 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import AYFFormStepTypes from '../constants/AYFFormStepTypes';
11
+ import CBRFormStepTypes from '../constants/CBRFormStepTypes';
12
+ import ConditionTypes from '../constants/ConditionTypes';
13
+ import FormStepTypes, { ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
14
+ export function calcRecursiveData(element, newSteps, customSteps) {
15
+ if (!newSteps)
16
+ return;
17
+ for (var _i = 0, _a = Object.entries(newSteps); _i < _a.length; _i++) {
18
+ var _b = _a[_i], idStep = _b[0], step = _b[1];
19
+ step.id = idStep;
20
+ if (step.dependencies) {
21
+ for (var i = 0; i < step.dependencies.length; i++) {
22
+ var idDep = step.dependencies[i];
23
+ var newId = element.ids[idDep];
24
+ if (newId) {
25
+ step.dependencies[i] = newId;
26
+ }
27
+ }
28
+ }
29
+ var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
30
+ if (custom === null || custom === void 0 ? void 0 : custom.calcRecursiveData) {
31
+ custom.calcRecursiveData(step, element.ids);
32
+ }
33
+ if (step.condition) {
34
+ calcRecursiveCondition(step.condition, element.ids);
35
+ }
36
+ // calcSubSteps(
37
+ // step.id,
38
+ // newSteps,
39
+ // (idStep: string): string => element.ids[idStep] ?? idStep
40
+ // );
41
+ }
42
+ }
43
+ export var calcRecursiveCondition = function (condition, ids) {
44
+ switch (condition.type) {
45
+ case ConditionTypes.EXPRESSION:
46
+ for (var _i = 0, _a = condition.conditions; _i < _a.length; _i++) {
47
+ var subCondition = _a[_i];
48
+ calcRecursiveCondition(subCondition, ids);
49
+ }
50
+ break;
51
+ case ConditionTypes.FORM_STEP: {
52
+ var newId = ids[condition.idStep];
53
+ if (newId) {
54
+ condition.idStep = newId;
55
+ }
56
+ break;
57
+ }
58
+ default:
59
+ break;
60
+ }
61
+ };
62
+ /**
63
+ * Utility function to calc the substeps of a step
64
+ * @param step step to calc the substeps
65
+ * @param idModifier optional modifier for the ids of the substeps and all other properties
66
+ * @returns list of the ids of the substeps of the step, if modifier returns modified steps
67
+ */
68
+ export var calcSubSteps = function (idStep, allSteps, idModifier) {
69
+ var _a;
70
+ var step = allSteps[idStep];
71
+ var subSteps = [];
72
+ if (!step)
73
+ return [];
74
+ var handleSteps = function (steps) {
75
+ for (var i = 0; i < steps.length; i++) {
76
+ var idSubStep = steps[i];
77
+ if (idModifier)
78
+ steps[i] = idModifier(steps[i]);
79
+ subSteps.push.apply(subSteps, __spreadArray([idSubStep], calcSubSteps(idSubStep, allSteps, idModifier), false));
80
+ }
81
+ };
82
+ switch (step.type) {
83
+ case FormStepTypes.SELECTOR: {
84
+ for (var _i = 0, _b = step.options; _i < _b.length; _i++) {
85
+ var option = _b[_i];
86
+ if (option.type === OptionTypes.NESTED) {
87
+ handleSteps(option.steps);
88
+ }
89
+ }
90
+ break;
91
+ }
92
+ case FormStepTypes.CLASSIFIER_SELECTOR:
93
+ for (var _c = 0, _d = Object.keys(step.options); _c < _d.length; _c++) {
94
+ var idOption = _d[_c];
95
+ var option = step.options[idOption];
96
+ if (option.type === ClassifierOptionTypes.NESTED) {
97
+ handleSteps(option.steps);
98
+ }
99
+ }
100
+ break;
101
+ case FormStepTypes.RATING:
102
+ if (step.nestedSteps) {
103
+ for (var _e = 0, _f = step.nestedSteps; _e < _f.length; _e++) {
104
+ var steps = _f[_e];
105
+ handleSteps(steps);
106
+ }
107
+ }
108
+ break;
109
+ case FormStepTypes.COLLAPSIBLE: {
110
+ handleSteps(step.steps);
111
+ break;
112
+ }
113
+ case FormStepTypes.CHECKBOX: {
114
+ if (step.steps)
115
+ handleSteps(step.steps);
116
+ if (step.uncheckedSteps)
117
+ handleSteps(step.uncheckedSteps);
118
+ break;
119
+ }
120
+ case FormStepTypes.ENTITYVALUEPICKER:
121
+ if (idModifier) {
122
+ for (var _g = 0, _h = step.path; _g < _h.length; _g++) {
123
+ var path = _h[_g];
124
+ if (path.type === EntityValueDataTypes.STEP) {
125
+ path.idStep = idModifier(path.idStep);
126
+ }
127
+ }
128
+ for (var _j = 0, _k = step.filters; _j < _k.length; _j++) {
129
+ var filter = _k[_j];
130
+ if (filter.type === EntityValueDataTypes.STEP) {
131
+ filter.idStep = idModifier(filter.idStep);
132
+ }
133
+ }
134
+ }
135
+ for (var _l = 0, _m = Object.keys((_a = step.options) !== null && _a !== void 0 ? _a : {}); _l < _m.length; _l++) {
136
+ var idOption = _m[_l];
137
+ var option = step.options[idOption];
138
+ if (option.type === EntityValueOptionTypes.NESTED) {
139
+ handleSteps(option.steps);
140
+ }
141
+ }
142
+ break;
143
+ case CBRFormStepTypes.CBR_LOCATIVAS:
144
+ {
145
+ var elementStep = step;
146
+ if (elementStep.subStep) {
147
+ if (idModifier)
148
+ elementStep.subStep = idModifier(elementStep.subStep);
149
+ subSteps.push(elementStep.subStep);
150
+ }
151
+ }
152
+ break;
153
+ case AYFFormStepTypes.AYF_ICA_CITY: {
154
+ var cityStep = step;
155
+ if (cityStep.idNitStep) {
156
+ if (idModifier)
157
+ cityStep.idNitStep = idModifier(cityStep.idNitStep);
158
+ subSteps.push(cityStep.idNitStep);
159
+ }
160
+ break;
161
+ }
162
+ default:
163
+ break;
164
+ }
165
+ return subSteps;
166
+ };
@@ -2,6 +2,7 @@ export declare enum EntityPropertyTypes {
2
2
  NAME = "NAME",
3
3
  TEXTAREA = "TEXTAREA",
4
4
  DATEPICKER = "DATEPICKER",
5
+ TIMEPICKER = "TIMEPICKER",
5
6
  TEXTINPUT = "TEXTINPUT",
6
7
  SELECTOR = "SELECTOR",
7
8
  CHECKBOX = "CHECKBOX"
@@ -3,6 +3,7 @@ export var EntityPropertyTypes;
3
3
  EntityPropertyTypes["NAME"] = "NAME";
4
4
  EntityPropertyTypes["TEXTAREA"] = "TEXTAREA";
5
5
  EntityPropertyTypes["DATEPICKER"] = "DATEPICKER";
6
+ EntityPropertyTypes["TIMEPICKER"] = "TIMEPICKER";
6
7
  EntityPropertyTypes["TEXTINPUT"] = "TEXTINPUT";
7
8
  EntityPropertyTypes["SELECTOR"] = "SELECTOR";
8
9
  EntityPropertyTypes["CHECKBOX"] = "CHECKBOX";
@@ -5,7 +5,8 @@ export declare enum FormTypes {
5
5
  export declare enum FormStyleTypes {
6
6
  MATERIAL = "MATERIAL"
7
7
  }
8
- export declare enum StepTypes {
8
+ export declare enum FormStepTypes {
9
+ TIMEPICKER = "TIMEPICKER",
9
10
  TITLE = "TITLE",
10
11
  RATING = "RATING",
11
12
  CHECKBOX = "CHECKBOX",
@@ -46,7 +47,7 @@ export declare enum RatingTypes {
46
47
  SATISFACTION = "SATISFACTION",
47
48
  LIKE = "LIKE"
48
49
  }
49
- export default StepTypes;
50
+ export default FormStepTypes;
50
51
  export declare enum MapperStyleTypes {
51
52
  PILL = "PILL",
52
53
  LIST = "LIST",