@arquimedes.co/eureka-forms 1.9.21 → 1.9.22
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/AYFFormStep.d.ts +5 -1
- package/dist/@Types/Organization.d.ts +1 -0
- package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +33 -30
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +26 -23
- package/dist/FormComponents/Step/AYFStepMapper.js +72 -0
- package/dist/FormComponents/Step/CBRStepMapper.js +72 -57
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +9 -1
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +2 -1
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +1 -1
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +21 -2
- package/dist/constants/AYFFormStepTypes.d.ts +2 -1
- package/dist/constants/AYFFormStepTypes.js +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AYFFormStepTypes from '../constants/AYFFormStepTypes';
|
|
2
2
|
import { GDatePicker, GSmartSelect, GTextInput } from './GenericFormSteps';
|
|
3
|
-
export type AYFFormStep = AYFListStep | AYFBillNumStep | AYFYearStep | AYFCutOffDateStep;
|
|
3
|
+
export type AYFFormStep = AYFListStep | AYFBillNumStep | AYFYearStep | AYFCutOffDateStep | AYFCityStep;
|
|
4
4
|
export interface AYFListStep extends Omit<GSmartSelect, 'searchable'> {
|
|
5
5
|
type: AYFFormStepTypes.AYF_START_MONTH | AYFFormStepTypes.AYF_END_MONTH;
|
|
6
6
|
}
|
|
@@ -13,3 +13,7 @@ export interface AYFYearStep extends GTextInput {
|
|
|
13
13
|
export interface AYFCutOffDateStep extends GDatePicker {
|
|
14
14
|
type: AYFFormStepTypes.AYF_CUT_OFF_DATE;
|
|
15
15
|
}
|
|
16
|
+
export interface AYFCityStep extends GSmartSelect {
|
|
17
|
+
type: AYFFormStepTypes.AYF_ICA_CITY;
|
|
18
|
+
idNitStep: string;
|
|
19
|
+
}
|
|
@@ -86,37 +86,40 @@ function LocativasSubStepRenderer(_a) {
|
|
|
86
86
|
return option.id === value.id;
|
|
87
87
|
}, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; } }, { children: _jsx(LocativasSubStepRenderer, {}) })));
|
|
88
88
|
}
|
|
89
|
-
var getLocativasOptions = function (
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
89
|
+
var getLocativasOptions = function (_a, step, dependencyStore) {
|
|
90
|
+
var idOrganization = _a.idOrganization;
|
|
91
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
+
var idProyecto, response, father_1;
|
|
93
|
+
var _b;
|
|
94
|
+
return __generator(this, function (_c) {
|
|
95
|
+
switch (_c.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
98
|
+
idProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.id;
|
|
99
|
+
if (!idProyecto) {
|
|
100
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
101
|
+
}
|
|
102
|
+
return [4 /*yield*/, axios.get("https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/Locativas?idOrganization=").concat(idOrganization))];
|
|
103
|
+
case 1:
|
|
104
|
+
response = (_c.sent()).data;
|
|
105
|
+
father_1 = dependencyStore[step.dependencies[1]];
|
|
106
|
+
if (father_1 !== undefined && father_1.id === undefined) {
|
|
107
|
+
return [2 /*return*/, null];
|
|
108
|
+
}
|
|
109
|
+
return [2 /*return*/, response.filter(function (locativa) {
|
|
110
|
+
if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
|
|
111
|
+
return (locativa.id.startsWith(father_1.id) &&
|
|
112
|
+
locativa.id !== father_1.id);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
return locativa.id.length === 2;
|
|
116
|
+
}
|
|
117
|
+
})];
|
|
118
|
+
case 2: return [2 /*return*/, null];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
118
121
|
});
|
|
119
|
-
}
|
|
122
|
+
};
|
|
120
123
|
var calcInvalidDependencies = function (step, dependencyStore) {
|
|
121
124
|
var _a;
|
|
122
125
|
var deps = [];
|
|
@@ -58,30 +58,33 @@ var baseUrl = "https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sin
|
|
|
58
58
|
function CBRPropertyStepComponent(props) {
|
|
59
59
|
var _this = this;
|
|
60
60
|
var _a = useState(undefined), showWarning = _a[0], setShowWarning = _a[1];
|
|
61
|
-
var getInmueblesOptions = function (
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
var getInmueblesOptions = function (_a, step, dependencyStore) {
|
|
62
|
+
var idOrganization = _a.idOrganization;
|
|
63
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
+
var idProyecto, idMacroProyecto;
|
|
65
|
+
var _b, _c;
|
|
66
|
+
return __generator(this, function (_d) {
|
|
67
|
+
switch (_d.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
70
|
+
idProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.id;
|
|
71
|
+
idMacroProyecto = (_c = dependencyStore[step.dependencies[0]]) === null || _c === void 0 ? void 0 : _c.idMacroProyecto;
|
|
72
|
+
if (!idProyecto) {
|
|
73
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
74
|
+
}
|
|
75
|
+
return [4 /*yield*/, axios.get(baseUrl +
|
|
76
|
+
'Inmuebles?idMacro=' +
|
|
77
|
+
idMacroProyecto +
|
|
78
|
+
'&idProyecto=' +
|
|
79
|
+
idProyecto +
|
|
80
|
+
'&idOrganization=' +
|
|
81
|
+
idOrganization)];
|
|
82
|
+
case 1: return [2 /*return*/, (_d.sent()).data];
|
|
83
|
+
case 2: return [2 /*return*/, null];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
83
86
|
});
|
|
84
|
-
}
|
|
87
|
+
};
|
|
85
88
|
return (_jsxs(React.Fragment, { children: [_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(PropertyIcon, { fill: "#757575", style: {
|
|
86
89
|
display: 'flex',
|
|
87
90
|
height: 23,
|
|
@@ -50,8 +50,11 @@ import AYFFormStepTypes from '../../constants/AYFFormStepTypes';
|
|
|
50
50
|
import TextInputStep from './TextInputStep/TextInputStep';
|
|
51
51
|
import SmartSelectStep from './SmartSelectStep/SmartSelectStep';
|
|
52
52
|
import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
|
|
53
|
+
import LocationOnRoundedIcon from '@material-ui/icons/LocationOnRounded';
|
|
53
54
|
import DescriptionIcon from '@material-ui/icons/Description';
|
|
54
55
|
import DatePickerStep from './DatePickerStep/DatePickerStep';
|
|
56
|
+
import axios from 'axios';
|
|
57
|
+
var baseUrl = "https://api.integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/ayf/");
|
|
55
58
|
function AYFStepMapper(props) {
|
|
56
59
|
var _this = this;
|
|
57
60
|
var getMonths = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -72,6 +75,55 @@ function AYFStepMapper(props) {
|
|
|
72
75
|
]];
|
|
73
76
|
});
|
|
74
77
|
}); };
|
|
78
|
+
var getCiudadesOptions = function (_a, step, dependencyStore) {
|
|
79
|
+
var idOrganization = _a.idOrganization, mainCity = _a.mainCity;
|
|
80
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
81
|
+
var nit, params, _i, _b, dep, value, error_1;
|
|
82
|
+
var _c, _d;
|
|
83
|
+
return __generator(this, function (_e) {
|
|
84
|
+
switch (_e.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
nit = dependencyStore[step.idNitStep];
|
|
87
|
+
if (!nit) {
|
|
88
|
+
return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
|
|
89
|
+
}
|
|
90
|
+
params = new URLSearchParams({
|
|
91
|
+
idOrganization: idOrganization,
|
|
92
|
+
idCompany: nit,
|
|
93
|
+
nit: 'true',
|
|
94
|
+
});
|
|
95
|
+
for (_i = 0, _b = (_c = step.dependencies) !== null && _c !== void 0 ? _c : []; _i < _b.length; _i++) {
|
|
96
|
+
dep = _b[_i];
|
|
97
|
+
value = dependencyStore[dep];
|
|
98
|
+
if (value && dep.startsWith('AYF')) {
|
|
99
|
+
switch ((_d = dep.split('-')) === null || _d === void 0 ? void 0 : _d[0]) {
|
|
100
|
+
case AYFFormStepTypes.AYF_START_MONTH:
|
|
101
|
+
params.set('startMonth', value.id);
|
|
102
|
+
break;
|
|
103
|
+
case AYFFormStepTypes.AYF_END_MONTH:
|
|
104
|
+
params.set('endMonth', value.id);
|
|
105
|
+
break;
|
|
106
|
+
case AYFFormStepTypes.AYF_YEAR:
|
|
107
|
+
params.set('year', value);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
_e.label = 1;
|
|
115
|
+
case 1:
|
|
116
|
+
_e.trys.push([1, 3, , 4]);
|
|
117
|
+
return [4 /*yield*/, axios.get(baseUrl + 'CiudadesICA?' + params.toString())];
|
|
118
|
+
case 2: return [2 /*return*/, (_e.sent()).data];
|
|
119
|
+
case 3:
|
|
120
|
+
error_1 = _e.sent();
|
|
121
|
+
return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
|
|
122
|
+
case 4: return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
};
|
|
75
127
|
switch (props.step.type) {
|
|
76
128
|
case AYFFormStepTypes.AYF_START_MONTH:
|
|
77
129
|
case AYFFormStepTypes.AYF_END_MONTH:
|
|
@@ -91,6 +143,26 @@ function AYFStepMapper(props) {
|
|
|
91
143
|
return (_jsx(TextInputStep, __assign({}, props, { step: props.step, icon: _jsx(DescriptionIcon, { style: { color: '#757575', fontSize: 23 } }) })));
|
|
92
144
|
case AYFFormStepTypes.AYF_CUT_OFF_DATE:
|
|
93
145
|
return (_jsx(DatePickerStep, __assign({}, props, { step: props.step, defaultValue: new Date() })));
|
|
146
|
+
case AYFFormStepTypes.AYF_ICA_CITY:
|
|
147
|
+
return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, getOptions: getCiudadesOptions, getOptionSelected: function (option, value) {
|
|
148
|
+
return option === value;
|
|
149
|
+
}, getValueString: function (value) { return value; }, calcInvalidDeps: function (step, depStore) {
|
|
150
|
+
var _a;
|
|
151
|
+
var missingDeps = [];
|
|
152
|
+
for (var _i = 0, _b = (_a = step.dependencies) !== null && _a !== void 0 ? _a : []; _i < _b.length; _i++) {
|
|
153
|
+
var idDep = _b[_i];
|
|
154
|
+
if (depStore[idDep] === null) {
|
|
155
|
+
missingDeps.push(idDep);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return missingDeps;
|
|
159
|
+
}, icon: _jsx(LocationOnRoundedIcon, { fill: "#757575", style: {
|
|
160
|
+
display: 'flex',
|
|
161
|
+
height: 23,
|
|
162
|
+
width: 23,
|
|
163
|
+
marginRight: 3,
|
|
164
|
+
marginTop: 1,
|
|
165
|
+
} }) })));
|
|
94
166
|
default:
|
|
95
167
|
return _jsx("div", {});
|
|
96
168
|
}
|
|
@@ -58,68 +58,83 @@ import CBRPropertyStep from './@Construction/CBRPropertyStep/CBRPropertyStep';
|
|
|
58
58
|
var baseUrl = "https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/");
|
|
59
59
|
function CBRStepMapper(props) {
|
|
60
60
|
var _this = this;
|
|
61
|
-
var getTipoDocOptions = function (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
var getTipoDocOptions = function (_a) {
|
|
62
|
+
var idOrganization = _a.idOrganization;
|
|
63
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
+
return __generator(this, function (_b) {
|
|
65
|
+
switch (_b.label) {
|
|
66
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl + 'TiposDoc?idOrganization=' + idOrganization)];
|
|
67
|
+
case 1: return [2 /*return*/, (_b.sent()).data];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
67
70
|
});
|
|
68
|
-
}
|
|
69
|
-
var getProyectoOptions = function (
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
proyectos =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
};
|
|
72
|
+
var getProyectoOptions = function (_a, step, dependencyStore) {
|
|
73
|
+
var idOrganization = _a.idOrganization;
|
|
74
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
75
|
+
var idMacroProyecto, proyectos;
|
|
76
|
+
var _b, _c, _d;
|
|
77
|
+
return __generator(this, function (_e) {
|
|
78
|
+
switch (_e.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
idMacroProyecto = (_d = dependencyStore[(_c = (_b = step.dependencies) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.id;
|
|
81
|
+
return [4 /*yield*/, axios.get(baseUrl + 'Proyectos?idOrganization=' + idOrganization)];
|
|
82
|
+
case 1:
|
|
83
|
+
proyectos = (_e.sent()).data;
|
|
84
|
+
if (idMacroProyecto) {
|
|
85
|
+
proyectos = proyectos.filter(function (proyecto) { return proyecto.idMacroProyecto === idMacroProyecto; });
|
|
86
|
+
}
|
|
87
|
+
return [2 /*return*/, proyectos];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
84
90
|
});
|
|
85
|
-
}
|
|
86
|
-
var getMacroProyectoOptions = function (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
};
|
|
92
|
+
var getMacroProyectoOptions = function (_a) {
|
|
93
|
+
var idOrganization = _a.idOrganization;
|
|
94
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_b) {
|
|
96
|
+
switch (_b.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl + 'MacroProyectos?idOrganization=' + idOrganization)];
|
|
98
|
+
case 1: return [2 /*return*/, (_b.sent()).data];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
92
101
|
});
|
|
93
|
-
}
|
|
94
|
-
var getTipoSolicitanteOptions = function (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
};
|
|
103
|
+
var getTipoSolicitanteOptions = function (_a) {
|
|
104
|
+
var idOrganization = _a.idOrganization;
|
|
105
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
106
|
+
return __generator(this, function (_b) {
|
|
107
|
+
switch (_b.label) {
|
|
108
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl + 'TiposSolicitante?idOrganization=' + idOrganization)];
|
|
109
|
+
case 1: return [2 /*return*/, (_b.sent()).data];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
100
112
|
});
|
|
101
|
-
}
|
|
102
|
-
var getTipoEspaciosOptions = function (
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
};
|
|
114
|
+
var getTipoEspaciosOptions = function (_a, step, dependencyStore) {
|
|
115
|
+
var idOrganization = _a.idOrganization;
|
|
116
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
117
|
+
var idProyecto;
|
|
118
|
+
var _b;
|
|
119
|
+
return __generator(this, function (_c) {
|
|
120
|
+
switch (_c.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
123
|
+
idProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.id;
|
|
124
|
+
if (!idProyecto) {
|
|
125
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
126
|
+
}
|
|
127
|
+
return [4 /*yield*/, axios.get(baseUrl +
|
|
128
|
+
'TiposEspacio?idProyecto=' +
|
|
129
|
+
idProyecto +
|
|
130
|
+
'&idOrganization=' +
|
|
131
|
+
idOrganization)];
|
|
132
|
+
case 1: return [2 /*return*/, (_c.sent()).data];
|
|
133
|
+
case 2: return [2 /*return*/, null];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
121
136
|
});
|
|
122
|
-
}
|
|
137
|
+
};
|
|
123
138
|
switch (props.step.type) {
|
|
124
139
|
case CBRFormStepTypes.CBR_CEL:
|
|
125
140
|
case CBRFormStepTypes.CBR_EMAIL:
|
package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js
CHANGED
|
@@ -86,7 +86,7 @@ function SmartSelect(_a) {
|
|
|
86
86
|
var _a;
|
|
87
87
|
return __generator(this, function (_b) {
|
|
88
88
|
switch (_b.label) {
|
|
89
|
-
case 0: return [4 /*yield*/, (getOptions === null || getOptions === void 0 ? void 0 : getOptions(organization
|
|
89
|
+
case 0: return [4 /*yield*/, (getOptions === null || getOptions === void 0 ? void 0 : getOptions(organization, step, dependencyStore))];
|
|
90
90
|
case 1:
|
|
91
91
|
resp = _b.sent();
|
|
92
92
|
if (resp !== null) {
|
|
@@ -197,6 +197,14 @@ function SmartSelect(_a) {
|
|
|
197
197
|
}
|
|
198
198
|
function SmartSelectStep(props) {
|
|
199
199
|
var _a, _b;
|
|
200
|
+
useEffect(function () {
|
|
201
|
+
if (!props.originalValues[props.step.id] && props.defaultValue) {
|
|
202
|
+
props.setDependencyStore(function (deps) {
|
|
203
|
+
var _a;
|
|
204
|
+
return (__assign(__assign({}, deps), (_a = {}, _a[props.step.id] = props.defaultValue, _a)));
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}, []);
|
|
200
208
|
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: (_b = (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : null, rules: {
|
|
201
209
|
required: props.step.required
|
|
202
210
|
? 'Este campo es obligatorio'
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import Types from '../../../constants/FormStepTypes';
|
|
3
3
|
import { StepProps } from '../Step';
|
|
4
4
|
import { GSmartSelect } from '../../../@Types/GenericFormSteps';
|
|
5
|
+
import { Organization } from '../../../@Types';
|
|
5
6
|
export interface SmartSelectStepProps extends Omit<StepProps, 'step'> {
|
|
6
7
|
/** The SmartSelectStep to display */
|
|
7
8
|
step: GSmartSelect;
|
|
8
9
|
/** The icon to display */
|
|
9
10
|
icon?: React.ReactNode;
|
|
10
11
|
/** Function to call to get the options of the selector, return null if dependency is not met */
|
|
11
|
-
getOptions: (
|
|
12
|
+
getOptions: (organization: Organization, step: GSmartSelect, dependencyStore: Record<string, any>) => Promise<any[] | null>;
|
|
12
13
|
/** Function to determine the currently selected option */
|
|
13
14
|
getOptionSelected: (option: any, value: any) => boolean;
|
|
14
15
|
/** Function to determine the current value in string format */
|
package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TextInputStepProps } from '../TextInputStep';
|
|
3
|
-
declare function TextInputStep({ icon, step, form, errors, control, editable, postview, formStyle, widthStats, defaultValue, }: TextInputStepProps): JSX.Element;
|
|
3
|
+
declare function TextInputStep({ icon, step, form, errors, control, editable, postview, formStyle, widthStats, defaultValue, dependencyStore, setDependencyStore, }: TextInputStepProps): JSX.Element;
|
|
4
4
|
export default TextInputStep;
|
package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js
CHANGED
|
@@ -14,8 +14,10 @@ import RoundedTextField from '../../../../shared/RoundedTextField/RoundedTextFie
|
|
|
14
14
|
import styles from './MaterialTextInputStep.module.css';
|
|
15
15
|
import { Controller } from 'react-hook-form';
|
|
16
16
|
import { calcStepWidth } from '../../StepFunctions';
|
|
17
|
+
import { useState } from 'react';
|
|
17
18
|
function TextInputStep(_a) {
|
|
18
|
-
var icon = _a.icon, step = _a.step, form = _a.form, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b;
|
|
19
|
+
var icon = _a.icon, step = _a.step, form = _a.form, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore;
|
|
20
|
+
var _c = useState(null), timer = _c[0], setTimer = _c[1];
|
|
19
21
|
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
20
22
|
width: widthStats.currentBreakPoint <= step.size
|
|
21
23
|
? '100%'
|
|
@@ -35,7 +37,24 @@ function TextInputStep(_a) {
|
|
|
35
37
|
: undefined,
|
|
36
38
|
}, shouldUnregister: true, render: function (_a) {
|
|
37
39
|
var field = _a.field;
|
|
38
|
-
return (_jsx(RoundedTextField, __assign({}, field, {
|
|
40
|
+
return (_jsx(RoundedTextField, __assign({}, field, { onChange: function (e) {
|
|
41
|
+
var value = e.target.value;
|
|
42
|
+
if (dependencyStore[step.id] !== undefined) {
|
|
43
|
+
try {
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
// eslint-disable-next-line no-empty
|
|
46
|
+
}
|
|
47
|
+
catch (e) { }
|
|
48
|
+
setTimer(setTimeout(function () {
|
|
49
|
+
setDependencyStore(function (deps) {
|
|
50
|
+
var _a;
|
|
51
|
+
return (__assign(__assign({}, deps), (_a = {}, _a[step.id] = value, _a)));
|
|
52
|
+
});
|
|
53
|
+
setTimer(null);
|
|
54
|
+
}, 1000));
|
|
55
|
+
}
|
|
56
|
+
field.onChange(value);
|
|
57
|
+
}, "data-testid": step.id, label: step.label, inputRef: field.ref, cantEdit: !editable || postview, required: step.required, fontWeight: 400, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperText: errors[step.id]
|
|
39
58
|
? errors[step.id].message
|
|
40
59
|
: step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id], icon: step.showIcon ? icon : undefined })));
|
|
41
60
|
} }) })));
|
|
@@ -3,6 +3,7 @@ export declare enum AYFFormStepTypes {
|
|
|
3
3
|
AYF_END_MONTH = "AYF_END_MONTH",
|
|
4
4
|
AYF_YEAR = "AYF_YEAR",
|
|
5
5
|
AYF_BILL_NUM = "AYF_BILL_NUM",
|
|
6
|
-
AYF_CUT_OFF_DATE = "AYF_CUT_OFF_DATE"
|
|
6
|
+
AYF_CUT_OFF_DATE = "AYF_CUT_OFF_DATE",
|
|
7
|
+
AYF_ICA_CITY = "AYF_ICA_CITY"
|
|
7
8
|
}
|
|
8
9
|
export default AYFFormStepTypes;
|
|
@@ -5,5 +5,6 @@ export var AYFFormStepTypes;
|
|
|
5
5
|
AYFFormStepTypes["AYF_YEAR"] = "AYF_YEAR";
|
|
6
6
|
AYFFormStepTypes["AYF_BILL_NUM"] = "AYF_BILL_NUM";
|
|
7
7
|
AYFFormStepTypes["AYF_CUT_OFF_DATE"] = "AYF_CUT_OFF_DATE";
|
|
8
|
+
AYFFormStepTypes["AYF_ICA_CITY"] = "AYF_ICA_CITY";
|
|
8
9
|
})(AYFFormStepTypes || (AYFFormStepTypes = {}));
|
|
9
10
|
export default AYFFormStepTypes;
|