import { ViewModelFieldWidgetProps } from './Field'; import NumberField, { NumberFieldProps } from './NumberField'; /** * @expandproperties */ export declare type DecimalFieldProps = NumberFieldProps & { /** * The number of decimal places that should be accepted */ decimalPlaces?: number; }; /** * A decimal field that stores the value as a string rather than a `number` to support better precision. * * This class accepts all the props of [NumberField](doc:NumberField) as well as the optional * `decimalPlaces` properties which can be used by form widgets to limit the accepted values. * * * Use with [viewModelFactory](doc:viewModelFactory). * * ```js * viewModelFactory({ * id: new Field(), * total: new DecimalField(), * }, { pkFieldName: 'id' }); * ``` * * Optionally provide `minValue`, `maxValue`, `decimalPlaces` or any options from [Field](doc:Field): * * ```js * viewModelFactory({ * id: new Field(), * total: new CharField({ * minValue: '0', * decimalPlaces: 2, * }), * }, { pkFieldName: 'id' }); * ``` * * * To support decimal operations consider a custom implementation that uses a decimal library eg. decimal.js * * * See also: [FloatField](doc:FloatField) * * * * @extractdocs * @menugroup Fields */ export default class DecimalField extends NumberField { static fieldClassName: string; decimalPlaces?: number; constructor(values?: DecimalFieldProps); parse(value: any): string | null; normalize(value: string): string | null; getWidgetProps(): ViewModelFieldWidgetProps; }