(core) Refactor more value parsing code into common

Summary:
Following discussion in https://phab.getgrist.com/D3164:

- Change createParser to accept docData and one or two metadata row IDs and let it extract the metadata, so it's more easily usable in the server.
- Change ViewFieldRec.valueParser observable to a function createValueParser.

Test Plan: Existing tests.

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D3172
This commit is contained in:
Alex Hall
2021-12-08 00:37:53 +02:00
parent 4164d89b84
commit 6b448567c9
5 changed files with 53 additions and 25 deletions

View File

@@ -76,7 +76,7 @@ export class NTextEditor extends NewBaseEditor {
}
public getCellValue(): CellValue {
const valueParser = this.options.field.valueParser.peek();
const valueParser = this.options.field.createValueParser();
return valueParser(this.getTextValue());
}