@arquimedes.co/eureka-forms 1.6.4-test → 1.6.7-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/CBRFormStep.d.ts +4 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.d.ts +8 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +117 -0
- package/dist/FormComponents/Step/CBRStepMapper.js +2 -46
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +3 -2
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +1 -1
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +11 -8
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +2 -0
- package/dist/shared/Rating/Rating.d.ts +1 -0
- package/dist/shared/Rating/Ratings/ScaleRating.d.ts +1 -1
- package/dist/shared/Rating/Ratings/ScaleRating.js +2 -2
- package/package.json +1 -1
|
@@ -18,6 +18,10 @@ export interface CBRRequesterTypeStep extends GSmartSelect {
|
|
|
18
18
|
}
|
|
19
19
|
export interface CBRPropertyStep extends GSmartSelect {
|
|
20
20
|
type: Types.CBR_INMUEBLE;
|
|
21
|
+
validation?: {
|
|
22
|
+
maxDays: number;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
21
25
|
}
|
|
22
26
|
export interface CBRSpaceTypeStep extends GSmartSelect {
|
|
23
27
|
type: Types.CBR_TIPO_ESPACIO;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StepProps } from '../../Step';
|
|
3
|
+
import { CBRPropertyStep } from '../../../../@Types/CBRFormStep';
|
|
4
|
+
export interface PropertyRendererProps extends Omit<StepProps, 'step'> {
|
|
5
|
+
step: CBRPropertyStep;
|
|
6
|
+
}
|
|
7
|
+
declare function CBRPropertyStepComponent(props: PropertyRendererProps): JSX.Element;
|
|
8
|
+
export default CBRPropertyStepComponent;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
+
import SmartSelectStep from '../../SmartSelectStep/SmartSelectStep';
|
|
50
|
+
import axios from 'axios';
|
|
51
|
+
var baseUrl = "https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/";
|
|
52
|
+
function CBRPropertyStepComponent(props) {
|
|
53
|
+
var _this = this;
|
|
54
|
+
var getInmueblesOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
55
|
+
var idProyecto, idMacroProyecto, response;
|
|
56
|
+
var _a, _b;
|
|
57
|
+
return __generator(this, function (_c) {
|
|
58
|
+
switch (_c.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
61
|
+
idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
|
|
62
|
+
idMacroProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.idMacroProyecto;
|
|
63
|
+
if (!idProyecto) {
|
|
64
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
65
|
+
}
|
|
66
|
+
return [4 /*yield*/, axios.get(baseUrl +
|
|
67
|
+
'ConsultaInmuebles?idMacro=' +
|
|
68
|
+
idMacroProyecto +
|
|
69
|
+
'&idProyecto=' +
|
|
70
|
+
idProyecto +
|
|
71
|
+
'&idOrganization=' +
|
|
72
|
+
'arquimedes')];
|
|
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
|
+
})];
|
|
82
|
+
case 2: return [2 /*return*/, null];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}); };
|
|
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
|
+
}, 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;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
: undefined, iconComponent: PropertyIconComponent, getOptions: getInmueblesOptions }), void 0));
|
|
108
|
+
}
|
|
109
|
+
export default CBRPropertyStepComponent;
|
|
110
|
+
function PropertyIconComponent(props) {
|
|
111
|
+
return (_jsx(PropertyIcon, { className: props.className, fill: "#757575", style: {
|
|
112
|
+
display: 'flex',
|
|
113
|
+
height: 23,
|
|
114
|
+
width: 23,
|
|
115
|
+
} }, void 0));
|
|
116
|
+
}
|
|
117
|
+
var PropertyIcon = function (props) { return (_jsx("svg", __assign({ fill: props.fill, className: props.class, style: props.style, height: "512", viewBox: "0 0 512 512", width: "512", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("g", __assign({ id: "_01-home", "data-name": "01-home" }, { children: _jsxs("g", __assign({ id: "glyph" }, { children: [_jsx("path", { d: "m256 4c-108.075 0-196 87.925-196 196 0 52.5 31.807 119.92 94.537 200.378a1065.816 1065.816 0 0 0 93.169 104.294 12 12 0 0 0 16.588 0 1065.816 1065.816 0 0 0 93.169-104.294c62.73-80.458 94.537-147.878 94.537-200.378 0-108.075-87.925-196-196-196zm0 336c-77.2 0-140-62.8-140-140s62.8-140 140-140 140 62.8 140 140-62.8 140-140 140z" }, void 0), _jsx("path", { d: "m352.072 183.121-88-80a12 12 0 0 0 -16.144 0l-88 80a12.006 12.006 0 0 0 -2.23 15.039 12.331 12.331 0 0 0 10.66 5.84h11.642v76a12 12 0 0 0 12 12h28a12 12 0 0 0 12-12v-44a12 12 0 0 1 12-12h24a12 12 0 0 1 12 12v44a12 12 0 0 0 12 12h28a12 12 0 0 0 12-12v-76h11.642a12.331 12.331 0 0 0 10.66-5.84 12.006 12.006 0 0 0 -2.23-15.039z" }, void 0)] }), void 0) }), void 0) }), void 0)); };
|
|
@@ -54,6 +54,7 @@ import TextAreaStep from './TextAreaStep/TextAreaStep';
|
|
|
54
54
|
import CBRIncidentsStep from './@Construction/CBRIncidentsStep/CBRIncidentsStep';
|
|
55
55
|
import CBRLocativasStep from './@Construction/CBRLocativasStep/CBRLocativasStep';
|
|
56
56
|
import axios from 'axios';
|
|
57
|
+
import CBRPropertyStep from './@Construction/CBRPropertyStep/CBRPropertyStep';
|
|
57
58
|
var baseUrl = "https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/";
|
|
58
59
|
function CBRStepMapper(props) {
|
|
59
60
|
var _this = this;
|
|
@@ -133,37 +134,6 @@ function CBRStepMapper(props) {
|
|
|
133
134
|
}
|
|
134
135
|
});
|
|
135
136
|
}); };
|
|
136
|
-
var getInmueblesOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
137
|
-
var idProyecto, idMacroProyecto, response;
|
|
138
|
-
var _a, _b;
|
|
139
|
-
return __generator(this, function (_c) {
|
|
140
|
-
switch (_c.label) {
|
|
141
|
-
case 0:
|
|
142
|
-
if (!step.dependencies) return [3 /*break*/, 2];
|
|
143
|
-
idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
|
|
144
|
-
idMacroProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.idMacroProyecto;
|
|
145
|
-
if (!idProyecto) {
|
|
146
|
-
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
147
|
-
}
|
|
148
|
-
return [4 /*yield*/, axios.get(baseUrl +
|
|
149
|
-
'ConsultaInmuebles?idMacro=' +
|
|
150
|
-
idMacroProyecto +
|
|
151
|
-
'&idProyecto=' +
|
|
152
|
-
idProyecto +
|
|
153
|
-
'&idOrganization=' +
|
|
154
|
-
idOrganization)];
|
|
155
|
-
case 1:
|
|
156
|
-
response = (_c.sent()).data;
|
|
157
|
-
return [2 /*return*/, response.map(function (option) {
|
|
158
|
-
return {
|
|
159
|
-
label: option.Descripcion,
|
|
160
|
-
id: option.Id,
|
|
161
|
-
};
|
|
162
|
-
})];
|
|
163
|
-
case 2: return [2 /*return*/, null];
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}); };
|
|
167
137
|
switch (props.step.type) {
|
|
168
138
|
case CBRFormStepTypes.CBR_CEL:
|
|
169
139
|
case CBRFormStepTypes.CBR_EMAIL:
|
|
@@ -188,13 +158,7 @@ function CBRStepMapper(props) {
|
|
|
188
158
|
return option.id === value.id;
|
|
189
159
|
} }), void 0));
|
|
190
160
|
case CBRFormStepTypes.CBR_INMUEBLE:
|
|
191
|
-
return
|
|
192
|
-
display: 'flex',
|
|
193
|
-
height: 23,
|
|
194
|
-
width: 23,
|
|
195
|
-
} }, void 0), iconComponent: PropertyIconComponent, getOptions: getInmueblesOptions, getOptionSelected: function (option, value) {
|
|
196
|
-
return option.id === value.id;
|
|
197
|
-
} }), void 0));
|
|
161
|
+
return _jsx(CBRPropertyStep, __assign({}, props, { step: props.step }), void 0);
|
|
198
162
|
case CBRFormStepTypes.CBR_TIPO_SOLICITANTE:
|
|
199
163
|
return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(PersonRoundedIcon, { fill: "#757575", style: {
|
|
200
164
|
display: 'flex',
|
|
@@ -237,13 +201,6 @@ function ProjectIconComponent(props) {
|
|
|
237
201
|
width: 23,
|
|
238
202
|
} }, void 0));
|
|
239
203
|
}
|
|
240
|
-
function PropertyIconComponent(props) {
|
|
241
|
-
return (_jsx(PropertyIcon, { className: props.className, fill: "#757575", style: {
|
|
242
|
-
display: 'flex',
|
|
243
|
-
height: 23,
|
|
244
|
-
width: 23,
|
|
245
|
-
} }, void 0));
|
|
246
|
-
}
|
|
247
204
|
function DocumentIconComponent(props) {
|
|
248
205
|
return (_jsx("div", __assign({ style: {
|
|
249
206
|
marginRight: 2,
|
|
@@ -262,5 +219,4 @@ function SpaceTypeIconComponent(props) {
|
|
|
262
219
|
}
|
|
263
220
|
var SpaceTypeIcon = function (props) { return (_jsxs("svg", __assign({ fill: props.fill, className: props.class, style: props.style, width: "512pt", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64" }, { children: [_jsx("title", { children: "SpaceType" }, void 0), _jsxs("g", __assign({ id: "space_type", "data-name": "space type" }, { children: [_jsx("path", { d: "M29.74,39A10.21,10.21,0,0,0,27.61,39,1.63,1.63,0,0,0,26,40.61V53.35A1.63,1.63,0,0,0,27.61,55h1.74A1.63,1.63,0,0,0,31,53.35V40.61A1.63,1.63,0,0,0,29.74,39Z" }, void 0), _jsx("path", { d: "M57.35,39a10.27,10.27,0,0,0-2.13.05A1.63,1.63,0,0,0,54,40.61V53.35A1.63,1.63,0,0,0,55.61,55h1.74A1.63,1.63,0,0,0,59,53.35V40.61A1.63,1.63,0,0,0,57.35,39Z" }, void 0), _jsx("path", { d: "M33,54a1,1,0,0,0,1,1H51a1,1,0,0,0,1-1V49H33Z" }, void 0), _jsx("path", { d: "M49,42H36a3,3,0,0,0-3,3v2H52V45A3,3,0,0,0,49,42Z" }, void 0), _jsx("path", { d: "M54,31a5,5,0,0,0-5-5H36a5,5,0,0,0-5,5v6.39a3.62,3.62,0,0,1,1.86,2.24A4.68,4.68,0,0,1,33,41c1.37-1.37,4.2-1,16-1a5,5,0,0,1,2.68.78c.64.39.07.39.46-1.15a3.65,3.65,0,0,1,1.43-2C54.15,37.19,54,38.41,54,31Z" }, void 0), _jsx("path", { d: "M17,32c-5.85,0-4.33,0-4-.05a7.06,7.06,0,0,0,6-7,7,7,0,0,0-4.47,1.59,7.08,7.08,0,0,0-2.07-5.05,7.06,7.06,0,0,0-2.07,5.05,7,7,0,0,0-4.47-1.59,7.07,7.07,0,0,0,6,7c.36.08,1.89.05-4,.05l1.71,6H3V55H5V50H20v5h2V38H15.26ZM15,45H10V43h5Z" }, void 0), _jsx("path", { d: "M26,21h6L31,10H19L18,21h6V40.61a3.63,3.63,0,0,1,2-3.24Z" }, void 0)] }), void 0)] }), void 0)); };
|
|
264
221
|
var DocumentIcon = function (props) { return (_jsx("svg", __assign({ fill: props.fill, className: props.class, style: props.style, id: "bold", enableBackground: "new 0 0 24 24", height: "512", viewBox: "0 0 24 24", width: "512", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "m21.25 3h-18.5c-1.517 0-2.75 1.233-2.75 2.75v12.5c0 1.517 1.233 2.75 2.75 2.75h18.5c1.517 0 2.75-1.233 2.75-2.75v-12.5c0-1.517-1.233-2.75-2.75-2.75zm-13.75 4c1.378 0 2.5 1.122 2.5 2.5s-1.122 2.5-2.5 2.5-2.5-1.122-2.5-2.5 1.122-2.5 2.5-2.5zm4.5 9.25c0 .414-.336.75-.75.75h-7.5c-.414 0-.75-.336-.75-.75v-.5c0-1.517 1.233-2.75 2.75-2.75h3.5c1.517 0 2.75 1.233 2.75 2.75zm8.25.75h-5.5c-.414 0-.75-.336-.75-.75s.336-.75.75-.75h5.5c.414 0 .75.336.75.75s-.336.75-.75.75zm0-4h-5.5c-.414 0-.75-.336-.75-.75s.336-.75.75-.75h5.5c.414 0 .75.336.75.75s-.336.75-.75.75zm0-4h-5.5c-.414 0-.75-.336-.75-.75s.336-.75.75-.75h5.5c.414 0 .75.336.75.75s-.336.75-.75.75z" }, void 0) }), void 0)); };
|
|
265
|
-
var PropertyIcon = function (props) { return (_jsx("svg", __assign({ fill: props.fill, className: props.class, style: props.style, height: "512", viewBox: "0 0 512 512", width: "512", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("g", __assign({ id: "_01-home", "data-name": "01-home" }, { children: _jsxs("g", __assign({ id: "glyph" }, { children: [_jsx("path", { d: "m256 4c-108.075 0-196 87.925-196 196 0 52.5 31.807 119.92 94.537 200.378a1065.816 1065.816 0 0 0 93.169 104.294 12 12 0 0 0 16.588 0 1065.816 1065.816 0 0 0 93.169-104.294c62.73-80.458 94.537-147.878 94.537-200.378 0-108.075-87.925-196-196-196zm0 336c-77.2 0-140-62.8-140-140s62.8-140 140-140 140 62.8 140 140-62.8 140-140 140z" }, void 0), _jsx("path", { d: "m352.072 183.121-88-80a12 12 0 0 0 -16.144 0l-88 80a12.006 12.006 0 0 0 -2.23 15.039 12.331 12.331 0 0 0 10.66 5.84h11.642v76a12 12 0 0 0 12 12h28a12 12 0 0 0 12-12v-44a12 12 0 0 1 12-12h24a12 12 0 0 1 12 12v44a12 12 0 0 0 12 12h28a12 12 0 0 0 12-12v-76h11.642a12.331 12.331 0 0 0 10.66-5.84 12.006 12.006 0 0 0 -2.23-15.039z" }, void 0)] }), void 0) }), void 0) }), void 0)); };
|
|
266
222
|
var ProjectIcon = function (props) { return (_jsx("svg", __assign({ fill: props.fill, className: props.class, style: props.style, height: "480pt", viewBox: "0 -8 480 480", width: "480pt", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "m440 448v-49.960938c10.546875-6.214843 16.726562-17.816406 16-30.039062 0-17.671875-10.742188-32-24-32s-24 14.328125-24 32c-.726562 12.222656 5.453125 23.824219 16 30.039062v49.960938h-56v-243.054688l-48-24v43.054688h24v16h-24v32h24v16h-24v32h24v16h-24v32h24v16h-24v32h24v16h-24v16h-16v-321.96875l-96-27.421875v29.390625h56v16h-56v32h56v16h-56v32h56v16h-56v32h56v16h-56v32h56v16h-56v32h56v16h-56v32h56v16h-56v16h-16v-448h-144v32h72v16h-72v32h72v16h-72v32h72v16h-72v32h72v16h-72v32h72v16h-72v32h72v16h-72v32h72v16h-72v32h72v16h-72v32h72v16h-72v16h-48v16h480v-16zm0 0" }, void 0) }), void 0)); };
|
|
@@ -44,8 +44,9 @@ function ClassifierSelector(_a) {
|
|
|
44
44
|
var options = classifier.children
|
|
45
45
|
.filter(function (classifier) {
|
|
46
46
|
var _a;
|
|
47
|
-
return ((_a = step.options[classifier
|
|
48
|
-
|
|
47
|
+
return ((_a = step.options[typeof classifier === 'string'
|
|
48
|
+
? classifier
|
|
49
|
+
: classifier === null || classifier === void 0 ? void 0 : classifier._id]) === null || _a === void 0 ? void 0 : _a.type) !== ClassifierOptionTypes.HIDE;
|
|
49
50
|
})
|
|
50
51
|
.map(function (classifier) {
|
|
51
52
|
var _a;
|
|
@@ -25,7 +25,7 @@ function MaterialRatingStep(_a) {
|
|
|
25
25
|
}, shouldUnregister: true, render: function (_a) {
|
|
26
26
|
var _b, _c, _d, _e, _f;
|
|
27
27
|
var field = _a.field;
|
|
28
|
-
return (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.ratingContainer }, { children: _jsx(Rating, { 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: field.value, onChange: field.onChange, inputRef: field.ref }, void 0) }), void 0), (step.description || step.required) && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: {
|
|
28
|
+
return (_jsxs(React.Fragment, { children: [_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: field.value, onChange: field.onChange, inputRef: field.ref }, void 0) }), void 0), (step.description || step.required) && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: {
|
|
29
29
|
color: !!errors[step.id] &&
|
|
30
30
|
field.value === null
|
|
31
31
|
? (_d = formStyle.errorColor) !== null && _d !== void 0 ? _d : '#cc2936'
|
package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js
CHANGED
|
@@ -65,8 +65,8 @@ import { cloneElement, useEffect, useState } from 'react';
|
|
|
65
65
|
import React from 'react';
|
|
66
66
|
function SmartSelect(_a) {
|
|
67
67
|
var _this = this;
|
|
68
|
-
var _b, _c, _d;
|
|
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, dependencyStore = _a.dependencyStore,
|
|
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, 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,10 +76,10 @@ function SmartSelect(_a) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return missingDeps;
|
|
79
|
-
} :
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
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", "dependencyStore", "calcInvalidDeps", "getValueWarning", "getOptionSelected", "setDependencyStore"]);
|
|
80
|
+
var _g = useState(true), first = _g[0], setFirst = _g[1];
|
|
81
|
+
var _h = useState(), options = _h[0], setOptions = _h[1];
|
|
82
|
+
var _j = useState(), error = _j[0], setError = _j[1];
|
|
83
83
|
var calcOptions = function (currentValue, invalidDeps) { return __awaiter(_this, void 0, void 0, function () {
|
|
84
84
|
var resp, currentOption, invalids;
|
|
85
85
|
var _a;
|
|
@@ -137,6 +137,7 @@ function SmartSelect(_a) {
|
|
|
137
137
|
return [2 /*return*/];
|
|
138
138
|
});
|
|
139
139
|
}); };
|
|
140
|
+
var warning = getValueWarning === null || getValueWarning === void 0 ? void 0 : getValueWarning(value);
|
|
140
141
|
return (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.container, style: {
|
|
141
142
|
width: widthStats.currentBreakPoint <= step.size
|
|
142
143
|
? '100%'
|
|
@@ -155,9 +156,11 @@ function SmartSelect(_a) {
|
|
|
155
156
|
? onChange(valueOverwrite(value))
|
|
156
157
|
: onChange(value);
|
|
157
158
|
setError(undefined);
|
|
158
|
-
}, getOptionSelected: getOptionSelected, helperText: error !== null && error !== void 0 ? error : (errors[step.id]
|
|
159
|
+
}, getOptionSelected: getOptionSelected, helperText: (_e = error !== null && error !== void 0 ? error : warning) !== null && _e !== void 0 ? _e : (errors[step.id]
|
|
159
160
|
? errors[step.id].message
|
|
160
|
-
: step.description), error: error !== undefined ||
|
|
161
|
+
: step.description), error: error !== undefined ||
|
|
162
|
+
(warning !== undefined && warning !== null) ||
|
|
163
|
+
!!errors[step.id] }, void 0) }), void 0), children &&
|
|
161
164
|
cloneElement(children, {
|
|
162
165
|
value: value,
|
|
163
166
|
stepProps: __assign({ step: step, form: form, errors: errors, trigger: trigger, postview: postview, editable: editable, formStyle: formStyle, widthStats: widthStats, organization: organization, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }, others),
|
|
@@ -13,6 +13,8 @@ export interface SmartSelectStepProps extends Omit<StepProps, 'step'> {
|
|
|
13
13
|
getOptions: (idOrganization: string, step: GSmartSelect, dependencyStore: Record<string, any>) => Promise<any[] | null>;
|
|
14
14
|
/** Function to determine the currently selected option */
|
|
15
15
|
getOptionSelected: (option: any, value: any) => boolean;
|
|
16
|
+
/** Function to if currently selected option has warning */
|
|
17
|
+
getValueWarning?: (value: any) => string | null;
|
|
16
18
|
/** Function that returns the error message based on the types of the missing Dependencies, undefined if no error msg */
|
|
17
19
|
calcDepError?: (types: Types[]) => string | undefined;
|
|
18
20
|
/** Function that returns the missing dependencies based on the current value */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RatingProps } from '../Rating';
|
|
3
|
-
declare function ScaleRating({ value, inputRef, disabled, onChange, isMobile, focusColor, unSelectedColor, }: RatingProps): JSX.Element;
|
|
3
|
+
declare function ScaleRating({ value, name, inputRef, disabled, onChange, isMobile, focusColor, unSelectedColor, }: RatingProps): JSX.Element;
|
|
4
4
|
export default ScaleRating;
|
|
@@ -42,7 +42,7 @@ var useRatingStyles = function (props) {
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
function ScaleRating(_a) {
|
|
45
|
-
var value = _a.value, inputRef = _a.inputRef, disabled = _a.disabled, onChange = _a.onChange, isMobile = _a.isMobile, focusColor = _a.focusColor, unSelectedColor = _a.unSelectedColor;
|
|
45
|
+
var value = _a.value, name = _a.name, inputRef = _a.inputRef, disabled = _a.disabled, onChange = _a.onChange, isMobile = _a.isMobile, focusColor = _a.focusColor, unSelectedColor = _a.unSelectedColor;
|
|
46
46
|
var ratingClasses = useRatingStyles({
|
|
47
47
|
unSelectedColor: unSelectedColor,
|
|
48
48
|
focusColor: focusColor,
|
|
@@ -50,7 +50,7 @@ function ScaleRating(_a) {
|
|
|
50
50
|
return (_jsxs(React.Fragment, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }, void 0), _jsx(Rating, { value: value, onChange: function (_event, newValue) {
|
|
51
51
|
if (!disabled)
|
|
52
52
|
onChange(newValue);
|
|
53
|
-
}, disabled: disabled, classes: ratingClasses, name:
|
|
53
|
+
}, disabled: disabled, classes: ratingClasses, name: name, size: "large", defaultValue: 0, getLabelText: function (value) { return value + '/5'; }, max: 5, IconContainerComponent: isMobile ? SmallIconContainer : IconContainer }, void 0)] }, void 0));
|
|
54
54
|
}
|
|
55
55
|
function IconContainer(_a) {
|
|
56
56
|
var value = _a.value, other = __rest(_a, ["value"]);
|
package/package.json
CHANGED