Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandraRamanenka committed Dec 6, 2024
1 parent bf03c40 commit f5ad6dc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/components/_classes/nested/NestedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,8 @@ export default class NestedComponent extends Field {
}

resetValue() {
// Reset values of child components first, then reset the parent one, otherwise it will restore the default
// value of parent component and clear it one by one while resetting child components
this.getComponents().forEach((comp) => comp.resetValue());
super.resetValue();
this.setPristine(true);
Expand Down
2 changes: 1 addition & 1 deletion src/components/_classes/nesteddata/NestedDataComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NestedComponent from '../nested/NestedComponent';
import _ from 'lodash';
import { componentValueTypes, getComponentSavedTypes } from '../../../utils/utils';

export default class NestedDataComponent extends NestedComponent {
export default class NestedDataComponent extends NestedComponent {
hasChanged(newValue, oldValue) {
// If we do not have a value and are getting set to anything other than undefined or null, then we changed.
if (
Expand Down
10 changes: 0 additions & 10 deletions src/components/editgrid/EditGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -1409,16 +1409,6 @@ export default class EditGridComponent extends NestedArrayComponent {
this.setNestedValue(component, editRow.data, flags);
});
}

emptyRows() {
this.editRows.forEach((editRow, index) => this.destroyComponents(false, index));
this.editRows = [];
}

resetValue() {
super.resetValue();
// this.emptyRows();
}
}

EditGridComponent.prototype.hasChanged = Component.prototype.hasChanged;
2 changes: 1 addition & 1 deletion src/components/selectboxes/SelectBoxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default class SelectBoxesComponent extends RadioComponent {
return super.setCustomValidity(_.filter(messages, (message) => message.ruleName !=='invalidValueProperty'), dirty, external);
} else {
return super.setCustomValidity(messages, dirty, external);
};
}
}

validateValueAvailability(setting, value) {
Expand Down

0 comments on commit f5ad6dc

Please sign in to comment.