@arquimedes.co/eureka-forms 1.7.0 → 1.7.2-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.
@@ -31,7 +31,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
31
31
  };
32
32
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
33
33
  /* eslint-disable no-console */
34
- import { useState } from 'react';
34
+ import { useEffect, useState } from 'react';
35
35
  import { Controller } from 'react-hook-form';
36
36
  import CBRFormStepTypes from '../../../../../constants/CBRFormStepTypes';
37
37
  import IncidentComponent from './Incident/Incident';
@@ -42,6 +42,11 @@ function Incidents(_a) {
42
42
  var step = _a.step, form = _a.form, btnRef = _a.btnRef, editable = _a.editable, postview = _a.postview, onChange = _a.onChange, incidents = _a.incidents, formStyle = _a.formStyle, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "btnRef", "editable", "postview", "onChange", "incidents", "formStyle", "dependencyStore", "setDependencyStore"]);
43
43
  /** Form to pass down with aditional steps */
44
44
  var _b = useState(__assign(__assign({}, form), { steps: __assign({}, form.steps) })), localForm = _b[0], setLocalForm = _b[1];
45
+ useEffect(function () {
46
+ if (incidents.length === 0 && !postview && editable) {
47
+ handleAddIncident();
48
+ }
49
+ }, []);
45
50
  var handleAddIncident = function () {
46
51
  var _a, _b;
47
52
  var current = incidents.filter(function (incident) { return !incident.deleted; });
@@ -33,7 +33,7 @@ function MaterialRatingStep(_a) {
33
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
34
  var renderNestedOption = function () {
35
35
  var currentOption;
36
- if (value && step.nestedSteps) {
36
+ if (value !== undefined && value !== null && step.nestedSteps) {
37
37
  if (step.ratingType === RatingTypes.LIKE) {
38
38
  currentOption = step.nestedSteps[value];
39
39
  }
@@ -80,6 +80,7 @@ function SmartSelect(_a) {
80
80
  var _g = useState(true), first = _g[0], setFirst = _g[1];
81
81
  var _h = useState(), options = _h[0], setOptions = _h[1];
82
82
  var _j = useState(), error = _j[0], setError = _j[1];
83
+ var _k = useState(false), loading = _k[0], setLoading = _k[1];
83
84
  var calcOptions = function (currentValue, invalidDeps) { return __awaiter(_this, void 0, void 0, function () {
84
85
  var resp, currentOption, invalids;
85
86
  var _a;
@@ -105,6 +106,7 @@ function SmartSelect(_a) {
105
106
  }
106
107
  }
107
108
  setOptions(resp);
109
+ setLoading(false);
108
110
  return [2 /*return*/];
109
111
  }
110
112
  });
@@ -132,6 +134,9 @@ function SmartSelect(_a) {
132
134
  if (invalids.length > 0) {
133
135
  trigger(invalids, { shouldFocus: true });
134
136
  }
137
+ else {
138
+ setLoading(true);
139
+ }
135
140
  }
136
141
  }
137
142
  return [2 /*return*/];
@@ -147,7 +152,7 @@ function SmartSelect(_a) {
147
152
  if (options === null) {
148
153
  handleMissingDep();
149
154
  }
150
- }, "data-testid": step.id }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, disabled: options === null, loading: options === undefined, options: options !== null && options !== void 0 ? options : [], inputRef: inputRef, cantEdit: !editable || postview, fullWidth: true, backgroundColor: "transparent", innerBackgroundColor: (_d = formStyle.stepBackgroundColor) !== null && _d !== void 0 ? _d : 'white', label: step.label, required: step.required, height: '31px', searchable: step.searchable, icon: step.showIcon ? icon : undefined, iconComponent: step.showIcon ? iconComponent : undefined, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, containerMargin: "0px", handleUpdate: function (value) {
155
+ }, "data-testid": step.id }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, disabled: options === null, loading: loading, options: options !== null && options !== void 0 ? options : [], inputRef: inputRef, cantEdit: !editable || postview, fullWidth: true, backgroundColor: "transparent", innerBackgroundColor: (_d = formStyle.stepBackgroundColor) !== null && _d !== void 0 ? _d : 'white', label: step.label, required: step.required, height: '31px', searchable: step.searchable, icon: step.showIcon ? icon : undefined, iconComponent: step.showIcon ? iconComponent : undefined, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, containerMargin: "0px", handleUpdate: function (value) {
151
156
  var _a;
152
157
  if (dependencyStore[step.id] !== undefined) {
153
158
  setDependencyStore(__assign(__assign({}, dependencyStore), (_a = {}, _a[step.id] = value, _a)));
@@ -26,6 +26,7 @@ import { makeStyles } from '@material-ui/core/styles';
26
26
  import TextField from '@material-ui/core/TextField';
27
27
  import { MenuItem, Popper } from '@material-ui/core';
28
28
  import RoundedSelect from '../RoundedSelect/RoundedSelect';
29
+ import CircularProgress from '@material-ui/core/CircularProgress';
29
30
  var filter = createFilterOptions();
30
31
  var useTextfieldStyles = function (props) {
31
32
  return makeStyles(function () { return ({
@@ -83,7 +84,7 @@ var useTextfieldStyles = function (props) {
83
84
  marginTop: -10,
84
85
  },
85
86
  '& .EF-MuiAutocomplete-input::placeholder': {
86
- color: 'var(--greyFont)',
87
+ color: '#787878',
87
88
  opacity: 1,
88
89
  },
89
90
  },
@@ -139,9 +140,7 @@ export default function RoundedSmartSelect(_a) {
139
140
  };
140
141
  var textFieldClasses = useTextfieldStyles(props)();
141
142
  if (searchable) {
142
- return (_jsx(Autocomplete, { size: "small", fullWidth: true, openOnFocus: true, disabled: cantEdit || disabled, popupIcon: showIcon && icon ? icon : undefined, onOpen: function () {
143
- //Show loading icon if loading
144
- }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: function (option) {
143
+ return (_jsx(Autocomplete, { size: "small", fullWidth: true, openOnFocus: true, disabled: cantEdit || disabled, popupIcon: loading ? (_jsx(CircularProgress, { size: 22, style: { color: '#757575' } }, void 0)) : showIcon && icon ? (icon) : undefined, onOpen: function () { }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: function (option) {
145
144
  var _a, _b;
146
145
  // Value selected with enter, right from the input
147
146
  if (typeof option === 'string') {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "1.7.0",
4
+ "version":"1.7.2-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",