tonder-web-sdk 1.9.2-beta.4 → 1.9.2-beta.5
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/package.json +1 -1
- package/src/helpers/skyflow.js +2 -8
package/package.json
CHANGED
package/src/helpers/skyflow.js
CHANGED
|
@@ -185,18 +185,12 @@ async function mountElements(
|
|
|
185
185
|
function handleSkyflowElementEvents(element, fieldMessage= "", error_styles = {}, resetOnFocus = true, requiredMessage = "El campo es requerido", invalidMessage= "El campo es inválido") {
|
|
186
186
|
if ("on" in element) {
|
|
187
187
|
element.on(Skyflow.EventName.CHANGE, (state) => {
|
|
188
|
-
// console.log("state chan:", state)
|
|
189
188
|
updateErrorLabel(element, error_styles, "transparent")
|
|
190
|
-
// if(state.isValid && !state.isEmpty){
|
|
191
|
-
// element.resetError();
|
|
192
|
-
// }
|
|
193
189
|
});
|
|
194
190
|
|
|
195
191
|
element.on(Skyflow.EventName.BLUR, (state) => {
|
|
196
|
-
console.log("state blur:", state)
|
|
197
192
|
if (!state.isValid) {
|
|
198
193
|
const msj_error = state.isEmpty ? requiredMessage : fieldMessage != "" ?`El campo ${fieldMessage} es inválido`: invalidMessage;
|
|
199
|
-
// updateErrorLabel(element, error_styles)
|
|
200
194
|
element.setError(msj_error);
|
|
201
195
|
}
|
|
202
196
|
updateErrorLabel(element, error_styles)
|
|
@@ -209,14 +203,14 @@ function handleSkyflowElementEvents(element, fieldMessage= "", error_styles = {}
|
|
|
209
203
|
}
|
|
210
204
|
}
|
|
211
205
|
|
|
212
|
-
function updateErrorLabel(element, errorStyles, color = "
|
|
206
|
+
function updateErrorLabel(element, errorStyles, color = "" ){
|
|
213
207
|
if(Object.keys(errorStyles).length > 0){
|
|
214
208
|
element.update({
|
|
215
209
|
errorTextStyles: {
|
|
216
210
|
...errorStyles,
|
|
217
211
|
base: {
|
|
218
212
|
...errorStyles.base,
|
|
219
|
-
color
|
|
213
|
+
...(color != "" && {color})
|
|
220
214
|
}
|
|
221
215
|
}
|
|
222
216
|
})
|