import { IValueTransformer , ValueTransformResult } from "../providers/value-transformers-provider" ; export class EnumValueTransformer implements IValueTransformer { enumName : string ; constructor ( enumName ) { this . enumName = enumName ; } transform ( originalValue , name , widgetType ) { const value = this . resolveEnumValue ( this . enumName , originalValue ) ; return { handled : true , propertyType : 'object' , value : value } ; } private resolveEnumValue ( enumName , value ) { if ( /^[a-zA-Z0-9_]+$/ . test ( value ) ) { return `${ enumName }.${ value }` ; } return value ; } }