mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Preventing empty string update on any column.
Summary: When editor is opened on any column and closed without entering any value, the column is converted to a text column. Test Plan: browser tests Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3211
This commit is contained in:
parent
3facb2a7cd
commit
5a876976d5
@ -32,6 +32,17 @@ export class ValueParser {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as basic Value parser, but will return null if a value is an empty string.
|
||||
*/
|
||||
class NullIfEmptyParser extends ValueParser {
|
||||
public cleanParse(value: string): any {
|
||||
if (value === "") {
|
||||
return null;
|
||||
}
|
||||
return super.cleanParse(value);
|
||||
}
|
||||
}
|
||||
|
||||
export class NumericParser extends ValueParser {
|
||||
private _parse: NumberParse;
|
||||
@ -206,6 +217,7 @@ export class ReferenceListParser extends ReferenceParser {
|
||||
}
|
||||
|
||||
export const valueParserClasses: { [type: string]: typeof ValueParser } = {
|
||||
Any: NullIfEmptyParser,
|
||||
Numeric: NumericParser,
|
||||
Int: NumericParser,
|
||||
Date: DateParser,
|
||||
|
Loading…
Reference in New Issue
Block a user