import Field from './Field'; export declare type JSON = string & { ' __JSON': T; }; /** * Field for JSON values. * * The `parse` implementation will parse strings with ``JSON.parse``. If it's not a valid JSON string then the unparsed * string will be returned. * * `normalize` will do the same, except it will throw in the case of an invalid JSON string. As such once a record is * constructed the value is guaranteed to be the normalized value. * * `format` will format the value as a nicely indented JSON string. * * This class accepts all the props of [Field](doc:Field). * * * Use with [viewModelFactory](doc:viewModelFactory). * * ```js * viewModelFactory({ * id: new Field(), * data: new JsonField(), * }, { pkFieldName: 'id' }); * ``` * * Optionally provide any options from [Field](doc:Field): * * ```js * viewModelFactory({ * id: new Field(), * data: new JsonField({ * helpText: 'Paste JSON data here', * }), * }, { pkFieldName: 'id' }); * ``` * * * * @extractdocs * @menugroup Fields */ export default class JsonField extends Field | T> { static fieldClassName: string; normalize(value: JSON | T): T | null; parse(value: JSON | T): T | null; format(value: T): any; }