Skip to content

Commit 09e6487

Browse files
author
Domino987
committed
chore: mrge edit cell validate fixes
1 parent f7a259e commit 09e6487

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/components/m-table-edit-cell.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class MTableEditCell extends React.Component {
9494
this.props.onCellEditFinished(this.props.rowData, this.props.columnDef);
9595
};
9696

97-
renderActions(isValid) {
97+
renderActions() {
9898
if (this.state.isLoading) {
9999
return (
100100
<div style={{ display: 'flex', justifyContent: 'center', width: 60 }}>
@@ -108,7 +108,7 @@ class MTableEditCell extends React.Component {
108108
icon: this.props.icons.Check,
109109
tooltip: this.props.localization.saveTooltip,
110110
onClick: this.onApprove,
111-
disabled: !this.state.isLoading || !isValid
111+
disabled: !this.state.isLoading || !this.state.errorState.isValid
112112
},
113113
{
114114
icon: this.props.icons.Clear,
@@ -128,23 +128,17 @@ class MTableEditCell extends React.Component {
128128
}
129129

130130
handleChange(value) {
131-
const errorState = this.props.columnDef.validate({
132-
[this.props.columnDef.field]: value
133-
});
131+
const errorState = validateInput(this.props.columnDef, value);
134132
this.setState({ errorState, value });
135133
}
136134

137135
render() {
138-
const error = validateInput(this.props.columnDef, this.state.value);
139-
console.log(error);
140136
return (
141137
<TableCell size={this.props.size} style={this.getStyle()} padding="none">
142138
<div style={{ display: 'flex', alignItems: 'center' }}>
143139
<div style={{ flex: 1, marginRight: 4 }}>
144140
<this.props.components.EditField
145141
columnDef={this.props.columnDef}
146-
error={!error.isValid}
147-
helperText={error.helperText}
148142
value={this.state.value}
149143
error={!this.state.errorState.isValid}
150144
helperText={this.state.errorState.helperText}
@@ -155,7 +149,7 @@ class MTableEditCell extends React.Component {
155149
autoFocus
156150
/>
157151
</div>
158-
{this.renderActions(error.isValid)}
152+
{this.renderActions()}
159153
</div>
160154
</TableCell>
161155
);

0 commit comments

Comments
 (0)