UNPKG

cv-dialog-sdk

Version:

Catavolt Dialog Javascript API

63 lines (62 loc) 2.07 kB
import { CatavoltApi } from '../dialog/CatavoltApi'; import { Property } from './Property'; import { PropertyDef } from './PropertyDef'; import 'moment/locale/de'; import 'moment/locale/en-ca'; import 'moment/locale/en-gb'; import 'moment/locale/es'; import 'moment/locale/fr'; import 'moment/locale/it'; import 'moment/locale/ja'; import 'moment/locale/pt'; import 'moment/locale/pt-br'; import 'moment/locale/ru'; import 'moment/locale/zh-cn'; export declare class PropertyFormatter { private _catavoltApi; private static _singleton; decimalFormat: string[]; decimalFormatGeneric: string; moneyFormat: string[]; moneyFormatGeneric: string; percentFormat: string[]; percentFormatGeneric: string; wholeFormat: string; static singleton(catavoltApi: CatavoltApi): PropertyFormatter; private constructor(); /** * Get a string representation of this property suitable for 'reading' * @param prop * @param propDef * @returns {string} */ formatForRead(prop: Property, propDef: PropertyDef): string; formatValueForRead(value: any, propDef: PropertyDef): any; /** * Get a string representation of this property suitable for 'writing' * @param prop * @param propDef * @returns {string} */ formatForWrite(prop: Property, propDef: PropertyDef): string; /** * Attempt to construct (or preserve) the appropriate data type given primitive (or already constructed) value. * Note this must be done here and not at 'write' time because it requires the knowledge of the PropDef * @param value * @param propDef * @returns {} */ parse(value: any, propDef: PropertyDef): any; resetFormats(): void; toString(o: any, propDef: PropertyDef): string; /** * Render this value as a string * * @param o * @param {PropertyDef} propDef * @returns {string} */ toStringRead(o: any, propDef: PropertyDef): string; toStringWrite(o: any, propDef: PropertyDef): string; private getSupportedLocale; }