@arquimedes.co/eureka-forms 1.6.7 → 1.6.9-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/FormStep.d.ts +1 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +1 -1
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +2 -2
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +53 -20
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RatingStepProps } from '../RatingStep';
|
|
3
|
-
declare function
|
|
4
|
-
export default
|
|
3
|
+
declare function RatingStep(props: RatingStepProps): JSX.Element;
|
|
4
|
+
export default RatingStep;
|
|
@@ -9,30 +9,63 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
12
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { createElement as _createElement } from "react";
|
|
13
25
|
import styles from './MaterialRatingStep.module.css';
|
|
14
26
|
import { Controller } from 'react-hook-form';
|
|
15
27
|
import React from 'react';
|
|
16
28
|
import Rating from '../../../../shared/Rating/Rating';
|
|
29
|
+
import { RatingTypes } from '../../../../constants/FormStepTypes';
|
|
30
|
+
import StepComponent from '../../Step';
|
|
17
31
|
function MaterialRatingStep(_a) {
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
var _b, _c, _d, _e, _f;
|
|
33
|
+
var form = _a.form, step = _a.step, value = _a.value, level = _a.level, errors = _a.errors, onChange = _a.onChange, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, others = __rest(_a, ["form", "step", "value", "level", "errors", "onChange", "inputRef", "editable", "postview", "formStyle", "widthStats"]);
|
|
34
|
+
var renderNestedOption = function () {
|
|
35
|
+
var currentOption;
|
|
36
|
+
if (value && step.nestedSteps) {
|
|
37
|
+
if (step.ratingType === RatingTypes.LIKE) {
|
|
38
|
+
currentOption = step.nestedSteps[value];
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
currentOption = step.nestedSteps[value - 1];
|
|
42
|
+
}
|
|
43
|
+
if (currentOption && currentOption.length > 0) {
|
|
44
|
+
return (_jsx(React.Fragment, { children: currentOption.map(function (idSubStep, index) {
|
|
45
|
+
var subStep = form.steps[idSubStep];
|
|
46
|
+
return (_createElement(StepComponent, __assign({}, others, { form: form, postview: postview, editable: editable, formStyle: formStyle, errors: errors, widthStats: widthStats, step: subStep, key: index, level: level + 1 })));
|
|
47
|
+
}) }, void 0));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return (_jsxs(React.Fragment, { children: [_jsxs("div", __assign({ className: styles.container, style: {
|
|
52
|
+
paddingBottom: step.description || step.required ? 0 : 15,
|
|
53
|
+
} }, { children: [_jsx("div", __assign({ className: styles.labelLabel }, { children: step.label + (step.required ? ' *' : '') }), void 0), _jsx("div", __assign({ className: styles.ratingContainer }, { children: _jsx(Rating, { name: step.id, type: step.ratingType, isMobile: widthStats.isMobile, focusColor: (_b = formStyle.primaryColor) !== null && _b !== void 0 ? _b : '#3d5a7f', unSelectedColor: (_c = formStyle.outlineColor) !== null && _c !== void 0 ? _c : '#b8b8b8', disabled: !editable || postview, value: value, onChange: onChange, inputRef: inputRef }, void 0) }), void 0), (step.description || step.required) && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: {
|
|
54
|
+
color: !!errors[step.id] && value === null
|
|
55
|
+
? (_d = formStyle.errorColor) !== null && _d !== void 0 ? _d : '#cc2936'
|
|
56
|
+
: (_e = formStyle.descriptionTextColor) !== null && _e !== void 0 ? _e : '#989898',
|
|
57
|
+
} }, { children: !!errors[step.id] && value === null
|
|
58
|
+
? (_f = errors[step.id]) === null || _f === void 0 ? void 0 : _f.message
|
|
59
|
+
: step.description }), void 0))] }), void 0), renderNestedOption()] }, void 0));
|
|
60
|
+
}
|
|
61
|
+
function RatingStep(props) {
|
|
62
|
+
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: null, rules: {
|
|
63
|
+
required: props.step.required
|
|
64
|
+
? 'Este campo es obligatorio'
|
|
65
|
+
: undefined,
|
|
66
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
67
|
+
var field = _a.field;
|
|
68
|
+
return (_jsx(MaterialRatingStep, __assign({}, props, { inputRef: field.ref, value: field.value, onChange: field.onChange }), void 0));
|
|
69
|
+
} }, void 0));
|
|
37
70
|
}
|
|
38
|
-
export default
|
|
71
|
+
export default RatingStep;
|
package/package.json
CHANGED