Skip to content

Commit

Permalink
v5.79.1
Browse files Browse the repository at this point in the history
  • Loading branch information
agordn52 committed Jul 6, 2024
1 parent abd8eea commit 7b14a1c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [5.79.1] - 2024-07-06

* Fix slight issue with NyForm when handling validation rules
* Update `validate` helper in NyState to skip null values

## [5.79.0] - 2024-07-06

* Add new Forms
Expand Down
18 changes: 15 additions & 3 deletions lib/widgets/ny_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ class NyFormData {
_validate[formField.key] = validate.value;
});

if (!_validate.containsKey(formField.key)) {
_validate[formField.key] = null;
}

// Check if the field has a dummy data
if (formField.dummyData != null) {
_dummyData[formField.key] = formField.dummyData;
Expand All @@ -377,6 +381,10 @@ class NyFormData {
_dummyData[formField.key] = dummyData.value;
});

if (!_dummyData.containsKey(formField.key)) {
_dummyData[formField.key] = null;
}

// Check if the field has a style
if (formField.style != null) {
_style[formField.key] = formField.style;
Expand All @@ -386,6 +394,10 @@ class NyFormData {
.forEach((style) {
_style[formField.key] = style.value;
});

if (!_style.containsKey(formField.key)) {
_style[formField.key] = null;
}
}

this.setData(allData);
Expand Down Expand Up @@ -983,7 +995,9 @@ class _NyFormState extends NyState<NyForm> {
Map<String, dynamic> dummyData = widget.form.getDummyData;
if (dummyData.containsKey(field.key)) {
dummyDataValue = dummyData[field.key];
widget.form.setField(field.key, dummyDataValue);
if (dummyDataValue != null) {
widget.form.setField(field.key, dummyDataValue);
}
}

Field nyField = Field(field.key, value: value, cast: fieldCast);
Expand Down Expand Up @@ -1036,8 +1050,6 @@ class _NyFormState extends NyState<NyForm> {
}

rules[field.key] = formValidator;
} else {
rules[field.key] = [field.value, rules[field.key]];
}
}
});
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/ny_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ abstract class NyState<T extends StatefulWidget> extends State<T> {
finalMessages[key] = value[2];
}
} else {
finalRules[key] = value;
if (value != null) {
finalRules[key] = value;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nylo_support
description: Support library for the Nylo framework. This library supports routing, widgets, localization, cli, storage and more.
version: 5.79.0
version: 5.79.1
homepage: https://nylo.dev
repository: https://github.com/nylo-core/support/tree/5.x
issue_tracker: https://github.com/nylo-core/support/issues
Expand Down

0 comments on commit 7b14a1c

Please sign in to comment.