@arquimedes.co/eureka-forms 1.9.1 → 1.9.2

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.
@@ -5,7 +5,7 @@ export interface PostVentaStep extends GBaseStep {
5
5
  type: Types.CBR_POSTVENTA;
6
6
  }
7
7
  export interface CBRProjectStep extends GSmartSelect {
8
- type: Types.CBR_PROYECTO;
8
+ type: Types.CBR_PROYECTO | Types.CBR_MACRO_PROYECTO;
9
9
  steps: string[];
10
10
  /** Only has maxSize if level === 0 */
11
11
  maxSize: number;
@@ -154,8 +154,10 @@ function ColumnForm(_a) {
154
154
  setShowConfirmation(undefined);
155
155
  } }, void 0)), sections.map(function (idSection, index) { return (_jsx(SectionComponent, __assign({ form: form, domain: domain, postview: postview, clearErrors: clearErrors, widthStats: widthStats, control: control, getValues: getValues, originalValues: originalValues, errors: errors, index: index, setSections: setSections, section: form.sections[idSection], formStyle: formStyle, customSteps: customSteps, setDependencyStore: setDependencyStore, dependencyStore: dependencyStore, trigger: trigger }, others), index)); }), form.terms &&
156
156
  (!internal || (internal && postview)) &&
157
- (originalValues === null || originalValues === void 0 ? void 0 : originalValues['INTERNAL_CREATING_AGENT']) === undefined &&
158
- form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }), !postview && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "form__submit", className: styles.submitBtn, onClick: function () {
157
+ (originalValues === null || originalValues === void 0 ? void 0 : originalValues['INTERNAL_CREATING_AGENT']) === undefined && (_jsx("div", __assign({ className: styles.termsContainer, style: {
158
+ width: (form.size.blockSize + form.size.spacingSize) *
159
+ form.size.blockNum,
160
+ } }, { children: form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }) }), void 0)), !postview && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "form__submit", className: styles.submitBtn, onClick: function () {
159
161
  onSubmit();
160
162
  }, style: {
161
163
  background: formStyle.primaryColor,
@@ -33,7 +33,7 @@ function IncidentComponent(_a) {
33
33
  if (incident.deleted) {
34
34
  return _jsx("div", {}, void 0);
35
35
  }
36
- return (_jsx("div", __assign({ className: others.widthStats.isMobile
36
+ return (_jsx("div", __assign({ className: others.widthStats.isMobile || form.size.blockNum < 3
37
37
  ? styles.mobileContainer
38
38
  : styles.container }, { children: _jsxs("div", __assign({ className: styles.contentContainer, style: {
39
39
  width: (form.size.blockSize + form.size.spacingSize) *
@@ -95,7 +95,7 @@ function LeakIconComponent(props) {
95
95
  } }, void 0));
96
96
  }
97
97
  var getLocativasOptions = function (idOrganization, step, dependencyStore) { return __awaiter(void 0, void 0, void 0, function () {
98
- var idProyecto, response, father_1, locativasList, data;
98
+ var idProyecto, response, father_1;
99
99
  var _a;
100
100
  return __generator(this, function (_b) {
101
101
  switch (_b.label) {
@@ -105,30 +105,22 @@ var getLocativasOptions = function (idOrganization, step, dependencyStore) { ret
105
105
  if (!idProyecto) {
106
106
  return [2 /*return*/, null]; //null para indicar que falta la depedency
107
107
  }
108
- return [4 /*yield*/, axios.get("https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/ConsultaLocativas?idOrganization=" + idOrganization)];
108
+ return [4 /*yield*/, axios.get("https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/Locativas?idOrganization=" + idOrganization)];
109
109
  case 1:
110
110
  response = (_b.sent()).data;
111
111
  father_1 = dependencyStore[step.dependencies[1]];
112
112
  if (father_1 !== undefined && father_1.id === undefined) {
113
113
  return [2 /*return*/, null];
114
114
  }
115
- locativasList = response.lstLocativas.TipoLocativas.filter(function (locativa) {
116
- if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
117
- return (locativa.Id.startsWith(father_1.id) &&
118
- locativa.Id !== father_1.id);
119
- }
120
- else {
121
- return locativa.Id.length === 2;
122
- }
123
- });
124
- data = locativasList.map(function (option) {
125
- return {
126
- label: option.Descripcion,
127
- id: option.Id,
128
- };
129
- });
130
- data.sort(function (a, b) { return a.label.localeCompare(b.label); });
131
- return [2 /*return*/, data];
115
+ return [2 /*return*/, response.filter(function (locativa) {
116
+ if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
117
+ return (locativa.id.startsWith(father_1.id) &&
118
+ locativa.id !== father_1.id);
119
+ }
120
+ else {
121
+ return locativa.id.length === 2;
122
+ }
123
+ })];
132
124
  case 2: return [2 /*return*/, null];
133
125
  }
134
126
  });
@@ -46,13 +46,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  }
47
47
  };
48
48
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import styles from './CBRPropertyStep.module.css';
49
50
  import SmartSelectStep from '../../SmartSelectStep/SmartSelectStep';
51
+ import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
52
+ import WarningRoundedIcon from '@material-ui/icons/WarningRounded';
50
53
  import axios from 'axios';
54
+ import React, { useState } from 'react';
55
+ import { Dialog } from '@material-ui/core';
56
+ import RoundedButton from '../../../../shared/RoundedButton/RoundedButton';
51
57
  var baseUrl = "https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/";
52
58
  function CBRPropertyStepComponent(props) {
53
59
  var _this = this;
60
+ var _a = useState(undefined), showWarning = _a[0], setShowWarning = _a[1];
54
61
  var getInmueblesOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
55
- var idProyecto, idMacroProyecto, response;
62
+ var idProyecto, idMacroProyecto;
56
63
  var _a, _b;
57
64
  return __generator(this, function (_c) {
58
65
  switch (_c.label) {
@@ -64,47 +71,63 @@ function CBRPropertyStepComponent(props) {
64
71
  return [2 /*return*/, null]; //null para indicar que falta la depedency
65
72
  }
66
73
  return [4 /*yield*/, axios.get(baseUrl +
67
- 'ConsultaInmuebles?idMacro=' +
74
+ 'Inmuebles?idMacro=' +
68
75
  idMacroProyecto +
69
76
  '&idProyecto=' +
70
77
  idProyecto +
71
78
  '&idOrganization=' +
72
79
  idOrganization)];
73
- case 1:
74
- response = (_c.sent()).data;
75
- return [2 /*return*/, response.map(function (option) {
76
- return {
77
- label: option.Descripcion,
78
- id: option.Id,
79
- entrega: option.FechaEntrega,
80
- };
81
- })];
80
+ case 1: return [2 /*return*/, (_c.sent()).data];
82
81
  case 2: return [2 /*return*/, null];
83
82
  }
84
83
  });
85
84
  }); };
86
- return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(PropertyIcon, { fill: "#757575", style: {
87
- display: 'flex',
88
- height: 23,
89
- width: 23,
90
- } }, void 0), getOptionSelected: function (option, value) {
91
- return option.id === value.id;
92
- }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; }, getValueWarning: props.step.validation
93
- ? function (value) {
94
- if (value &&
95
- value.entrega !== undefined &&
96
- props.step.validation) {
97
- var date = new Date(value.entrega);
98
- var today = new Date();
99
- var time = today.getTime() - date.getTime();
100
- var days = time / (1000 * 3600 * 24);
101
- if (days > props.step.validation.maxDays) {
102
- return props.step.validation.message;
85
+ return (_jsxs(React.Fragment, { children: [_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(PropertyIcon, { fill: "#757575", style: {
86
+ display: 'flex',
87
+ height: 23,
88
+ width: 23,
89
+ } }, void 0), getOptionSelected: function (option, value) {
90
+ return option.id === value.id;
91
+ }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; }, getValueWarning: props.step.validation
92
+ ? function (value) {
93
+ if (value &&
94
+ value.entrega !== undefined &&
95
+ props.step.validation) {
96
+ var date = new Date(value.entrega);
97
+ var today = new Date();
98
+ var time = today.getTime() - date.getTime();
99
+ var days = time / (1000 * 3600 * 24);
100
+ if (days > props.step.validation.maxDays) {
101
+ return props.step.validation.message;
102
+ }
103
+ }
104
+ return null;
103
105
  }
104
- }
105
- return null;
106
- }
107
- : undefined, iconComponent: PropertyIconComponent, getOptions: getInmueblesOptions }), void 0));
106
+ : undefined, changeListener: props.step.validation
107
+ ? function (value) {
108
+ if (value &&
109
+ value.entrega !== undefined &&
110
+ props.step.validation) {
111
+ var date = new Date(value.entrega);
112
+ var today = new Date();
113
+ var time = today.getTime() - date.getTime();
114
+ var days = time / (1000 * 3600 * 24);
115
+ if (days > props.step.validation.maxDays) {
116
+ setShowWarning(date);
117
+ }
118
+ }
119
+ }
120
+ : undefined, iconComponent: PropertyIconComponent, getOptions: getInmueblesOptions }), void 0), showWarning !== undefined && (_jsx(Dialog, __assign({ PaperProps: {
121
+ style: {
122
+ borderRadius: '20px',
123
+ maxWidth: '100vw',
124
+ boxSizing: 'content-box',
125
+ },
126
+ }, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: props.formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
127
+ setShowWarning(undefined);
128
+ } }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.warningContainer, style: { color: props.formStyle.primaryColor } }, { children: _jsx(WarningRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["La garant\u00EDa de su inmueble expir\u00F3 el d\u00EDa", ' ', showWarning.toLocaleDateString(), "."] }), void 0), _jsx("div", __assign({ className: styles.btnContainer }, { children: _jsx(RoundedButton, { text: 'Continuar', color: props.formStyle.primaryContrastColor, backgroundColor: props.formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
129
+ setShowWarning(undefined);
130
+ } }, void 0) }), void 0)] }), void 0)] }), void 0) }), void 0))] }, void 0));
108
131
  }
109
132
  export default CBRPropertyStepComponent;
110
133
  function PropertyIconComponent(props) {
@@ -0,0 +1,54 @@
1
+ .confirmationContainer {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: fit-content;
5
+ max-height: 80vh;
6
+ max-width: 80vw;
7
+ position: relative;
8
+ }
9
+
10
+ .container {
11
+ max-height: 100%;
12
+ display: flex;
13
+ flex-direction: column;
14
+ overflow: hidden;
15
+ overflow-y: auto;
16
+ }
17
+ .confirmationContainer,
18
+ .confirmationContainer *,
19
+ .confirmationContainer *::after,
20
+ .confirmationContainer *::before {
21
+ -webkit-box-sizing: content-box;
22
+ -moz-box-sizing: content-box;
23
+ box-sizing: content-box;
24
+ }
25
+
26
+ .warningContainer {
27
+ margin-left: auto;
28
+ margin-right: auto;
29
+ padding-top: 30px;
30
+ height: fit-content;
31
+ margin-bottom: 15px;
32
+ }
33
+
34
+ .messageContainer {
35
+ margin-top: 5px;
36
+ margin-left: 20px;
37
+ margin-right: 20px;
38
+ font-size: 1.2rem;
39
+ text-align: center;
40
+ }
41
+
42
+ .btnContainer {
43
+ margin-left: auto;
44
+ margin-right: auto;
45
+ margin-top: 30px;
46
+ margin-bottom: 20px;
47
+ }
48
+ .closeIcon {
49
+ right: 15px;
50
+ top: 10px;
51
+ font-size: 26px;
52
+ position: absolute;
53
+ cursor: pointer;
54
+ }
@@ -59,61 +59,48 @@ var baseUrl = "https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/c
59
59
  function CBRStepMapper(props) {
60
60
  var _this = this;
61
61
  var getTipoDocOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
62
- var response, data;
63
62
  return __generator(this, function (_a) {
64
63
  switch (_a.label) {
65
- case 0: return [4 /*yield*/, axios.get(baseUrl + 'ConsultaTiposDoc?idOrganization=' + idOrganization)];
64
+ case 0: return [4 /*yield*/, axios.get(baseUrl + 'TiposDoc?idOrganization=' + idOrganization)];
65
+ case 1: return [2 /*return*/, (_a.sent()).data];
66
+ }
67
+ });
68
+ }); };
69
+ var getProyectoOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
70
+ var idMacroProyecto, proyectos;
71
+ var _a, _b, _c;
72
+ return __generator(this, function (_d) {
73
+ switch (_d.label) {
74
+ case 0:
75
+ idMacroProyecto = (_c = dependencyStore[(_b = (_a = step.dependencies) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '']) === null || _c === void 0 ? void 0 : _c.id;
76
+ return [4 /*yield*/, axios.get(baseUrl + 'Proyectos?idOrganization=' + idOrganization)];
66
77
  case 1:
67
- response = (_a.sent()).data;
68
- data = response.map(function (option) {
69
- return { label: option.Descripcion, id: option.Id };
70
- });
71
- data.sort(function (a, b) { return a.label.localeCompare(b.label); });
72
- return [2 /*return*/, data];
78
+ proyectos = (_d.sent()).data;
79
+ if (idMacroProyecto) {
80
+ proyectos = proyectos.filter(function (proyecto) { return proyecto.idMacroProyecto === idMacroProyecto; });
81
+ }
82
+ return [2 /*return*/, proyectos];
73
83
  }
74
84
  });
75
85
  }); };
76
- var getProyectoOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
77
- var response, data;
86
+ var getMacroProyectoOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
78
87
  return __generator(this, function (_a) {
79
88
  switch (_a.label) {
80
- case 0: return [4 /*yield*/, axios.get(baseUrl + 'Consultaproyectos?idOrganization=' + idOrganization)];
81
- case 1:
82
- response = (_a.sent()).data;
83
- data = response.map(function (option) {
84
- return {
85
- label: option.NombreProyecto,
86
- id: option.IdProyecto,
87
- idMacroProyecto: option.IdMacroproyecto,
88
- };
89
- });
90
- data.sort(function (a, b) { return a.label.localeCompare(b.label); });
91
- return [2 /*return*/, data];
89
+ case 0: return [4 /*yield*/, axios.get(baseUrl + 'MacroProyectos?idOrganization=' + idOrganization)];
90
+ case 1: return [2 /*return*/, (_a.sent()).data];
92
91
  }
93
92
  });
94
93
  }); };
95
94
  var getTipoSolicitanteOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
96
- var response, data;
97
95
  return __generator(this, function (_a) {
98
96
  switch (_a.label) {
99
- case 0: return [4 /*yield*/, axios.get(baseUrl +
100
- 'ConsultaTipoSolicitante?idOrganization=' +
101
- idOrganization)];
102
- case 1:
103
- response = (_a.sent()).data;
104
- data = response.map(function (option) {
105
- return {
106
- label: option.Descripcion,
107
- id: option.Id,
108
- };
109
- });
110
- data.sort(function (a, b) { return a.label.localeCompare(b.label); });
111
- return [2 /*return*/, data];
97
+ case 0: return [4 /*yield*/, axios.get(baseUrl + 'TiposSolicitante?idOrganization=' + idOrganization)];
98
+ case 1: return [2 /*return*/, (_a.sent()).data];
112
99
  }
113
100
  });
114
101
  }); };
115
102
  var getTipoEspaciosOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
116
- var idProyecto, response, data;
103
+ var idProyecto;
117
104
  var _a;
118
105
  return __generator(this, function (_b) {
119
106
  switch (_b.label) {
@@ -124,20 +111,11 @@ function CBRStepMapper(props) {
124
111
  return [2 /*return*/, null]; //null para indicar que falta la depedency
125
112
  }
126
113
  return [4 /*yield*/, axios.get(baseUrl +
127
- 'ConsultaTipoEspacios?idProyecto=' +
114
+ 'TiposEspacio?idProyecto=' +
128
115
  idProyecto +
129
116
  '&idOrganization=' +
130
117
  idOrganization)];
131
- case 1:
132
- response = (_b.sent()).data;
133
- data = response.map(function (option) {
134
- return {
135
- label: option.Descripcion,
136
- id: option.Id,
137
- };
138
- });
139
- data.sort(function (a, b) { return a.label.localeCompare(b.label); });
140
- return [2 /*return*/, data];
118
+ case 1: return [2 /*return*/, (_b.sent()).data];
141
119
  case 2: return [2 /*return*/, null];
142
120
  }
143
121
  });
@@ -157,6 +135,14 @@ function CBRStepMapper(props) {
157
135
  return (_jsx(SmartSelectStep, __assign({}, props, { step: __assign(__assign({}, props.step), { showIcon: false }), getOptions: getTipoDocOptions, getOptionSelected: function (option, value) {
158
136
  return option.id === value.id;
159
137
  }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; } }), void 0));
138
+ case CBRFormStepTypes.CBR_MACRO_PROYECTO:
139
+ return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(ProjectIcon, { fill: "#757575", style: {
140
+ display: 'flex',
141
+ height: 24,
142
+ width: 24,
143
+ } }, void 0), iconComponent: ProjectIconComponent, getOptions: getMacroProyectoOptions, getOptionSelected: function (option, value) {
144
+ return option.id === value.id;
145
+ }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; } }), void 0));
160
146
  case CBRFormStepTypes.CBR_PROYECTO:
161
147
  return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(ProjectIcon, { fill: "#757575", style: {
162
148
  display: 'flex',
@@ -66,7 +66,7 @@ import React from 'react';
66
66
  function SmartSelect(_a) {
67
67
  var _this = this;
68
68
  var _b, _c, _d, _e;
69
- var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, trigger = _a.trigger, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, organization = _a.organization, calcDepError = _a.calcDepError, iconComponent = _a.iconComponent, valueOverwrite = _a.valueOverwrite, getValueString = _a.getValueString, dependencyStore = _a.dependencyStore, _f = _a.calcInvalidDeps, calcInvalidDeps = _f === void 0 ? function (step, depStore) {
69
+ var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, trigger = _a.trigger, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, organization = _a.organization, calcDepError = _a.calcDepError, iconComponent = _a.iconComponent, valueOverwrite = _a.valueOverwrite, getValueString = _a.getValueString, changeListener = _a.changeListener, dependencyStore = _a.dependencyStore, _f = _a.calcInvalidDeps, calcInvalidDeps = _f === void 0 ? function (step, depStore) {
70
70
  var _a;
71
71
  var missingDeps = [];
72
72
  for (var _i = 0, _b = (_a = step.dependencies) !== null && _a !== void 0 ? _a : []; _i < _b.length; _i++) {
@@ -76,7 +76,7 @@ function SmartSelect(_a) {
76
76
  }
77
77
  }
78
78
  return missingDeps;
79
- } : _f, getValueWarning = _a.getValueWarning, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "trigger", "children", "editable", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "organization", "calcDepError", "iconComponent", "valueOverwrite", "getValueString", "dependencyStore", "calcInvalidDeps", "getValueWarning", "getOptionSelected", "setDependencyStore"]);
79
+ } : _f, getValueWarning = _a.getValueWarning, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "trigger", "children", "editable", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "organization", "calcDepError", "iconComponent", "valueOverwrite", "getValueString", "changeListener", "dependencyStore", "calcInvalidDeps", "getValueWarning", "getOptionSelected", "setDependencyStore"]);
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];
@@ -128,6 +128,9 @@ function SmartSelect(_a) {
128
128
  calcOptions(null);
129
129
  }
130
130
  }
131
+ else if (value && !step.searchable) {
132
+ setOptions([value]);
133
+ }
131
134
  }, (_c = (_b = step.dependencies) === null || _b === void 0 ? void 0 : _b.map(function (dep) { return dependencyStore[dep]; })) !== null && _c !== void 0 ? _c : []);
132
135
  var handleMissingDep = function () { return __awaiter(_this, void 0, void 0, function () {
133
136
  var invalids;
@@ -160,7 +163,7 @@ function SmartSelect(_a) {
160
163
  if (options === undefined && !(!editable || postview)) {
161
164
  setLoading(true);
162
165
  }
163
- }, "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) {
166
+ }, "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', changeListener: changeListener, 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) {
164
167
  var _a;
165
168
  if (dependencyStore[step.id] !== undefined) {
166
169
  setDependencyStore(__assign(__assign({}, dependencyStore), (_a = {}, _a[step.id] = value, _a)));
@@ -25,6 +25,8 @@ export interface SmartSelectStepProps extends Omit<StepProps, 'step'> {
25
25
  children?: React.ReactElement<any, string>;
26
26
  /** Function that overwrites the value before setting it */
27
27
  valueOverwrite?: (value: any | null) => any;
28
+ /** Function called on each value change */
29
+ changeListener?: (value: any) => void;
28
30
  }
29
31
  declare function SmartSelectStep(props: SmartSelectStepProps): JSX.Element;
30
32
  export default SmartSelectStep;
@@ -1,4 +1,5 @@
1
1
  declare enum TYPES {
2
+ CBR_MACRO_PROYECTO = "CBR_MACRO_PROYECTO",
2
3
  CBR_POSTVENTA = "CBR_POSTVENTA",
3
4
  CBR_FIRST_NAME = "CBR_FIRST_NAME",
4
5
  CBR_MIDDLE_NAME = "CBR_MIDDLE_NAME",
@@ -1,5 +1,6 @@
1
1
  var TYPES;
2
2
  (function (TYPES) {
3
+ TYPES["CBR_MACRO_PROYECTO"] = "CBR_MACRO_PROYECTO";
3
4
  TYPES["CBR_POSTVENTA"] = "CBR_POSTVENTA";
4
5
  TYPES["CBR_FIRST_NAME"] = "CBR_FIRST_NAME";
5
6
  TYPES["CBR_MIDDLE_NAME"] = "CBR_MIDDLE_NAME";
@@ -60,6 +60,8 @@ export interface RoundedSmartSelectProps extends Omit<TextFieldProps, 'color'>,
60
60
  getOptionSelected?: (option: any, value: any) => boolean;
61
61
  /** Function to determine the current value in string format */
62
62
  getValueString?: (value: any) => string;
63
+ /** Function called on each value change */
64
+ changeListener?: (value: any) => void;
63
65
  }
64
- export default function RoundedSmartSelect({ options, value, handleUpdate, label, getValueString, color, errorColor, focusColor, helperTextColor, outlineColor, backgroundColor, cantEdit, loading, height, fontSize, required, error, innerBackgroundColor, getOptionSelected, helperText, readOnly, borderRadius, fontWeight, icon, iconComponent, searchable, containerMargin, showIcon, inputRef, disabled, onBlur, name, }: RoundedSmartSelectProps): JSX.Element;
66
+ export default function RoundedSmartSelect({ options, value, handleUpdate, label, getValueString, color, errorColor, focusColor, helperTextColor, outlineColor, backgroundColor, cantEdit, loading, height, fontSize, required, changeListener, error, innerBackgroundColor, getOptionSelected, helperText, readOnly, borderRadius, fontWeight, icon, iconComponent, searchable, containerMargin, showIcon, inputRef, disabled, onBlur, name, }: RoundedSmartSelectProps): JSX.Element;
65
67
  export {};
@@ -124,7 +124,7 @@ var useTextfieldStyles = function (props) {
124
124
  }); });
125
125
  };
126
126
  export default function RoundedSmartSelect(_a) {
127
- var _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.value, value = _c === void 0 ? '' : _c, handleUpdate = _a.handleUpdate, label = _a.label, _d = _a.getValueString, getValueString = _d === void 0 ? function (value) { return value.value; } : _d, _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.helperTextColor, helperTextColor = _h === void 0 ? '#989898' : _h, _j = _a.outlineColor, outlineColor = _j === void 0 ? '#b8b8b8' : _j, _k = _a.backgroundColor, backgroundColor = _k === void 0 ? '#ffffff' : _k, _l = _a.cantEdit, cantEdit = _l === void 0 ? false : _l, _m = _a.loading, loading = _m === void 0 ? false : _m, _o = _a.height, height = _o === void 0 ? '31px' : _o, _p = _a.fontSize, fontSize = _p === void 0 ? '1rem' : _p, required = _a.required, error = _a.error, innerBackgroundColor = _a.innerBackgroundColor, getOptionSelected = _a.getOptionSelected, helperText = _a.helperText, _q = _a.readOnly, readOnly = _q === void 0 ? false : _q, _r = _a.borderRadius, borderRadius = _r === void 0 ? 10 : _r, _s = _a.fontWeight, fontWeight = _s === void 0 ? '400' : _s, icon = _a.icon, iconComponent = _a.iconComponent, _t = _a.searchable, searchable = _t === void 0 ? false : _t, _u = _a.containerMargin, containerMargin = _u === void 0 ? '0px' : _u, _v = _a.showIcon, showIcon = _v === void 0 ? true : _v, inputRef = _a.inputRef, disabled = _a.disabled, onBlur = _a.onBlur, name = _a.name;
127
+ var _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.value, value = _c === void 0 ? '' : _c, handleUpdate = _a.handleUpdate, label = _a.label, _d = _a.getValueString, getValueString = _d === void 0 ? function (value) { return value.value; } : _d, _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.helperTextColor, helperTextColor = _h === void 0 ? '#989898' : _h, _j = _a.outlineColor, outlineColor = _j === void 0 ? '#b8b8b8' : _j, _k = _a.backgroundColor, backgroundColor = _k === void 0 ? '#ffffff' : _k, _l = _a.cantEdit, cantEdit = _l === void 0 ? false : _l, _m = _a.loading, loading = _m === void 0 ? false : _m, _o = _a.height, height = _o === void 0 ? '31px' : _o, _p = _a.fontSize, fontSize = _p === void 0 ? '1rem' : _p, required = _a.required, changeListener = _a.changeListener, error = _a.error, innerBackgroundColor = _a.innerBackgroundColor, getOptionSelected = _a.getOptionSelected, helperText = _a.helperText, _q = _a.readOnly, readOnly = _q === void 0 ? false : _q, _r = _a.borderRadius, borderRadius = _r === void 0 ? 10 : _r, _s = _a.fontWeight, fontWeight = _s === void 0 ? '400' : _s, icon = _a.icon, iconComponent = _a.iconComponent, _t = _a.searchable, searchable = _t === void 0 ? false : _t, _u = _a.containerMargin, containerMargin = _u === void 0 ? '0px' : _u, _v = _a.showIcon, showIcon = _v === void 0 ? true : _v, inputRef = _a.inputRef, disabled = _a.disabled, onBlur = _a.onBlur, name = _a.name;
128
128
  var props = {
129
129
  color: color,
130
130
  height: height,
@@ -160,6 +160,7 @@ export default function RoundedSmartSelect(_a) {
160
160
  var style = _a.style, props = __rest(_a, ["style"]);
161
161
  return (_jsx(Popper, __assign({}, props, { style: __assign(__assign({}, style), { zIndex: 1305 }) }), void 0));
162
162
  }, value: value ? value : null, onChange: function (event, newValue) {
163
+ changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue);
163
164
  handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
164
165
  }, filterOptions: function (options, params) {
165
166
  if (value && value.label === (params === null || params === void 0 ? void 0 : params.inputValue)) {
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.9.1",
4
+ "version": "1.9.2",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",