@arquimedes.co/eureka-forms 1.5.7-test → 1.5.9

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/App.d.ts CHANGED
@@ -17,6 +17,8 @@ export interface AppProps {
17
17
  preview?: boolean;
18
18
  /** If the form can be edited (For entities) */
19
19
  editable?: boolean;
20
+ /** The custom send label to display */
21
+ sendLabel?: string;
20
22
  /** The data to fill the form with */
21
23
  valuesData?: Record<string, unknown>;
22
24
  /** Custom steps to display */
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { FormComponentProps } from '../Form';
3
- declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, widthStats, customSteps, customSend, handleLoaded, originalValues, ...others }: FormComponentProps): JSX.Element;
3
+ declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, sendLabel, widthStats, customSteps, customSend, handleLoaded, originalValues, ...others }: FormComponentProps): JSX.Element;
4
4
  export default ColumnForm;
@@ -70,7 +70,7 @@ import axiosInstance from '../../../AxiosAPI';
70
70
  import widgetInstance from '../../../AxiosWidget';
71
71
  function ColumnForm(_a) {
72
72
  var _this = this;
73
- var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, domain = _a.domain, postview = _a.postview, internal = _a.internal, formStyle = _a.formStyle, widthStats = _a.widthStats, customSteps = _a.customSteps, customSend = _a.customSend, handleLoaded = _a.handleLoaded, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "widthStats", "customSteps", "customSend", "handleLoaded", "originalValues"]);
73
+ var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, domain = _a.domain, postview = _a.postview, internal = _a.internal, formStyle = _a.formStyle, sendLabel = _a.sendLabel, widthStats = _a.widthStats, customSteps = _a.customSteps, customSend = _a.customSend, handleLoaded = _a.handleLoaded, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "sendLabel", "widthStats", "customSteps", "customSend", "handleLoaded", "originalValues"]);
74
74
  var _b = useState(false), tempError = _b[0], setTempError = _b[1];
75
75
  var _c = useState(calcDependencies(form.steps, originalValues)), dependencyStore = _c[0], setDependencyStore = _c[1];
76
76
  var _d = useForm({
@@ -161,7 +161,7 @@ function ColumnForm(_a) {
161
161
  color: formStyle.primaryContrastColor,
162
162
  }, disabled: loading }, { children: [_jsx("div", __assign({ style: {
163
163
  visibility: loading ? 'hidden' : 'visible',
164
- } }, { children: "Enviar" }), void 0), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }, void 0) }), void 0))] }), void 0) }), void 0))] }), void 0));
164
+ } }, { children: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar' }), void 0), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }, void 0) }), void 0))] }), void 0) }), void 0))] }), void 0));
165
165
  }
166
166
  export default ColumnForm;
167
167
  function calcNextSection(form, idSection, sections) {
@@ -26,6 +26,8 @@ export interface FormComponentProps {
26
26
  handleLoaded: () => void;
27
27
  /** If the form can be edited (For entities) */
28
28
  editable: boolean;
29
+ /** The custom send label to display */
30
+ sendLabel?: string;
29
31
  }
30
32
  declare function FormComponent({ form, internal, postview, organization, containerRef, ...others }: Omit<FormComponentProps, 'widthStats' | 'formStyle' | 'handleLoaded'> & {
31
33
  containerRef: any;
@@ -58,27 +58,20 @@ function FormComponent(_a) {
58
58
  var currentWidth = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
59
59
  if (currentWidth !== undefined) {
60
60
  var currentBreakPoint = form.size.blockNum;
61
- console.log(currentWidth);
62
- console.log((form.size.blockSize + form.size.spacingSize) *
63
- currentBreakPoint +
64
- 40);
65
- console.log(currentWidth <
66
- (form.size.blockSize + form.size.spacingSize) *
67
- currentBreakPoint +
68
- 40);
61
+ var padding = form.isStandAlone ? 40 : 0;
69
62
  while (currentWidth <
70
63
  (form.size.blockSize + form.size.spacingSize) *
71
64
  currentBreakPoint +
72
- 40) {
65
+ padding) {
73
66
  currentBreakPoint--;
74
67
  }
75
68
  setWidthStats({
76
69
  isResponsive: currentWidth <
77
70
  (form.size.blockSize + form.size.spacingSize) *
78
71
  form.size.blockNum +
79
- 40,
72
+ padding,
80
73
  isMobile: currentWidth <
81
- (form.size.blockSize + form.size.spacingSize) * 2 + 40,
74
+ (form.size.blockSize + form.size.spacingSize) * 2 + padding,
82
75
  currentBreakPoint: currentBreakPoint,
83
76
  });
84
77
  }
@@ -47,8 +47,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
49
  import SmartSelectStep from '../../SmartSelectStep/SmartSelectStep';
50
- import LocativasData from '../../CBRStepValuesTemp/CBR_LOCATIVAS.json';
51
50
  import CBRFormStepTypes from '../../../../constants/CBRFormStepTypes';
51
+ import axios from 'axios';
52
52
  function CBRLocativasStep(props) {
53
53
  return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(Leak, { fill: "#757575", style: {
54
54
  display: 'flex',
@@ -98,36 +98,37 @@ var getLocativasOptions = function (step, dependencyStore) { return __awaiter(vo
98
98
  var idProyecto, response, father_1, locativasList;
99
99
  var _a;
100
100
  return __generator(this, function (_b) {
101
- if (step.dependencies) {
102
- idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
103
- if (!idProyecto) {
104
- return [2 /*return*/, null]; //null para indicar que falta la depedency
105
- }
106
- response = LocativasData;
107
- father_1 = dependencyStore[step.dependencies[1]];
108
- if (father_1 !== undefined && father_1.id === undefined) {
109
- return [2 /*return*/, null];
110
- }
111
- locativasList = response.lstLocativas.TipoLocativas.filter(function (locativa) {
112
- if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
113
- return (locativa.Id.startsWith(father_1.id) &&
114
- locativa.Id !== father_1.id);
101
+ switch (_b.label) {
102
+ case 0:
103
+ if (!step.dependencies) return [3 /*break*/, 2];
104
+ idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
105
+ if (!idProyecto) {
106
+ return [2 /*return*/, null]; //null para indicar que falta la depedency
115
107
  }
116
- else {
117
- return locativa.Id.length === 2;
108
+ return [4 /*yield*/, axios.get('https://integrations.eureka-test.click/sinco/cbr/ConsultaLocativas?idOrganization=arquimedes')];
109
+ case 1:
110
+ response = (_b.sent()).data;
111
+ father_1 = dependencyStore[step.dependencies[1]];
112
+ if (father_1 !== undefined && father_1.id === undefined) {
113
+ return [2 /*return*/, null];
118
114
  }
119
- });
120
- return [2 /*return*/, locativasList.map(function (option) {
121
- return {
122
- label: option.Descripcion,
123
- id: option.Id,
124
- };
125
- })];
126
- }
127
- else {
128
- return [2 /*return*/, null];
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
+ return [2 /*return*/, locativasList.map(function (option) {
125
+ return {
126
+ label: option.Descripcion,
127
+ id: option.Id,
128
+ };
129
+ })];
130
+ case 2: return [2 /*return*/, null];
129
131
  }
130
- return [2 /*return*/];
131
132
  });
132
133
  }); };
133
134
  var calcInvaidDependencies = function (step, dependencyStore) {
@@ -52,93 +52,112 @@ import TextInputStep from './TextInputStep/TextInputStep';
52
52
  import SmartSelectStep from './SmartSelectStep/SmartSelectStep';
53
53
  import TextAreaStep from './TextAreaStep/TextAreaStep';
54
54
  import CBRIncidentsStep from './@Construction/CBRIncidentsStep/CBRIncidentsStep';
55
- import TipoDocData from './CBRStepValuesTemp/CBR_TIPO_DOC.json';
56
- import ProyectoData from './CBRStepValuesTemp/CBR_PROYECTO.json';
57
- import TipoSolicitanteData from './CBRStepValuesTemp/CBR_TIPO_SOLICITANTE.json';
58
- import TipoEspacioData from './CBRStepValuesTemp/CBR_TIPO_ESPACIO.json';
59
- import InmuebleData from './CBRStepValuesTemp/CBR_INMUEBLE.json';
60
55
  import CBRLocativasStep from './@Construction/CBRLocativasStep/CBRLocativasStep';
56
+ import axios from 'axios';
57
+ var baseUrl = 'https://integrations.eureka-test.click/sinco/cbr/';
61
58
  function CBRStepMapper(props) {
62
59
  var _this = this;
63
60
  var getTipoDocOptions = function () { return __awaiter(_this, void 0, void 0, function () {
64
61
  var response;
65
62
  return __generator(this, function (_a) {
66
- response = TipoDocData;
67
- return [2 /*return*/, response.map(function (option) {
68
- return { label: option.Descripcion, id: option.Id };
69
- })];
63
+ switch (_a.label) {
64
+ case 0: return [4 /*yield*/, axios.get(baseUrl + 'ConsultaTiposDoc?idOrganization=arquimedes')];
65
+ case 1:
66
+ response = (_a.sent()).data;
67
+ return [2 /*return*/, response.map(function (option) {
68
+ return { label: option.Descripcion, id: option.Id };
69
+ })];
70
+ }
70
71
  });
71
72
  }); };
72
73
  var getProyectoOptions = function () { return __awaiter(_this, void 0, void 0, function () {
73
74
  var response;
74
75
  return __generator(this, function (_a) {
75
- response = ProyectoData;
76
- return [2 /*return*/, response.map(function (option) {
77
- return {
78
- label: option.NombreProyecto,
79
- id: option.IdProyecto,
80
- idMacroProyecto: option.IdMacroproyecto,
81
- };
82
- })];
76
+ switch (_a.label) {
77
+ case 0: return [4 /*yield*/, axios.get(baseUrl + 'Consultaproyectos?idOrganization=arquimedes')];
78
+ case 1:
79
+ response = (_a.sent()).data;
80
+ return [2 /*return*/, response.map(function (option) {
81
+ return {
82
+ label: option.NombreProyecto,
83
+ id: option.IdProyecto,
84
+ idMacroProyecto: option.IdMacroproyecto,
85
+ };
86
+ })];
87
+ }
83
88
  });
84
89
  }); };
85
90
  var getTipoSolicitanteOptions = function () { return __awaiter(_this, void 0, void 0, function () {
86
91
  var response;
87
92
  return __generator(this, function (_a) {
88
- response = TipoSolicitanteData;
89
- return [2 /*return*/, response.map(function (option) {
90
- return {
91
- label: option.Descripcion,
92
- id: option.Id,
93
- };
94
- })];
93
+ switch (_a.label) {
94
+ case 0: return [4 /*yield*/, axios.get(baseUrl + 'ConsultaTipoSolicitante?idOrganization=arquimedes')];
95
+ case 1:
96
+ response = (_a.sent()).data;
97
+ return [2 /*return*/, response.map(function (option) {
98
+ return {
99
+ label: option.Descripcion,
100
+ id: option.Id,
101
+ };
102
+ })];
103
+ }
95
104
  });
96
105
  }); };
97
106
  var getTipoEspaciosOptions = function (step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
98
107
  var idProyecto, response;
99
108
  var _a;
100
109
  return __generator(this, function (_b) {
101
- if (step.dependencies) {
102
- idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
103
- if (!idProyecto) {
104
- return [2 /*return*/, null]; //null para indicar que falta la depedency
105
- }
106
- response = TipoEspacioData;
107
- return [2 /*return*/, response[String(idProyecto)].map(function (option) {
108
- return {
109
- label: option.Descripcion,
110
- id: option.Id,
111
- };
112
- })];
113
- }
114
- else {
115
- return [2 /*return*/, null];
110
+ switch (_b.label) {
111
+ case 0:
112
+ if (!step.dependencies) return [3 /*break*/, 2];
113
+ idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
114
+ if (!idProyecto) {
115
+ return [2 /*return*/, null]; //null para indicar que falta la depedency
116
+ }
117
+ return [4 /*yield*/, axios.get(baseUrl +
118
+ 'ConsultaTipoEspacios?idProyecto=' +
119
+ idProyecto +
120
+ '&idOrganization=arquimedes')];
121
+ case 1:
122
+ response = (_b.sent()).data;
123
+ return [2 /*return*/, response.map(function (option) {
124
+ return {
125
+ label: option.Descripcion,
126
+ id: option.Id,
127
+ };
128
+ })];
129
+ case 2: return [2 /*return*/, null];
116
130
  }
117
- return [2 /*return*/];
118
131
  });
119
132
  }); };
120
133
  var getInmueblesOptions = function (step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
121
134
  var idProyecto, idMacroProyecto, response;
122
135
  var _a, _b;
123
136
  return __generator(this, function (_c) {
124
- if (step.dependencies) {
125
- idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
126
- idMacroProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.idMacroProyecto;
127
- if (!idProyecto) {
128
- return [2 /*return*/, null]; //null para indicar que falta la depedency
129
- }
130
- response = InmuebleData;
131
- return [2 /*return*/, response[String(idMacroProyecto)][String(idProyecto)].map(function (option) {
132
- return {
133
- label: option.Descripcion,
134
- id: option.Id,
135
- };
136
- })];
137
- }
138
- else {
139
- return [2 /*return*/, null];
137
+ switch (_c.label) {
138
+ case 0:
139
+ if (!step.dependencies) return [3 /*break*/, 2];
140
+ idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
141
+ idMacroProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.idMacroProyecto;
142
+ if (!idProyecto) {
143
+ return [2 /*return*/, null]; //null para indicar que falta la depedency
144
+ }
145
+ return [4 /*yield*/, axios.get(baseUrl +
146
+ 'ConsultaInmuebles?idMacro=' +
147
+ idMacroProyecto +
148
+ '&idProyecto=' +
149
+ idProyecto +
150
+ '&idOrganization=arquimedes')];
151
+ case 1:
152
+ response = (_c.sent()).data;
153
+ return [2 /*return*/, response.map(function (option) {
154
+ return {
155
+ label: option.Descripcion,
156
+ id: option.Id,
157
+ };
158
+ })];
159
+ case 2: return [2 /*return*/, null];
140
160
  }
141
- return [2 /*return*/];
142
161
  });
143
162
  }); };
144
163
  switch (props.step.type) {
@@ -146,7 +146,7 @@ function SmartSelect(_a) {
146
146
  if (options === null) {
147
147
  handleMissingDep();
148
148
  }
149
- } }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, disabled: options === null, loading: options === undefined, options: options !== null && options !== void 0 ? options : [], "data-testid": step.id, 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) {
149
+ }, "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) {
150
150
  var _a;
151
151
  if (dependencyStore[step.id] !== undefined) {
152
152
  setDependencyStore(__assign(__assign({}, dependencyStore), (_a = {}, _a[step.id] = value, _a)));
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.5.7-test",
4
+ "version": "1.5.9",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",