import { ComponentUtil } from '@ag-grid-community/core' ; export const kebabProperty = ( property ) => { return property . replace ( /([a-z])([A-Z])/g , '$1-$2' ) . toLowerCase ( ) ; } ; export const kebabNameToAttrEventName = ( kebabName ) => { return `on${ kebabName . charAt ( 0 ) . toUpperCase ( ) }${ kebabName . substring ( 1 , kebabName . length ) }` ; } ; export interface Properties { [ propertyName ] : any ; } export const getAgGridProperties = ( ) : [ Properties , Properties , { prop : string ; event : string ; } ] => { const props = { } ; const eventNameAsProps = ComponentUtil . PUBLIC_EVENTS . map ( ( eventName ) => kebabNameToAttrEventName ( kebabProperty ( eventName ) ) ) ; eventNameAsProps . reduce ( ( accumulator , eventName ) => { accumulator [ eventName ] = undefined ; return accumulator ; } , props ) ; const watch = { } ; ComponentUtil . ALL_PROPERTIES . filter ( ( propertyName ) => propertyName != 'gridOptions' ) . forEach ( ( propertyName ) => { props [ propertyName ] = { } ; watch [ propertyName ] = { handler ( currentValue , previousValue ) { this . processChanges ( propertyName , currentValue , previousValue ) ; } , deep : propertyName !== 'popupParent' && propertyName !== 'context' } ; } ) ; const model = { prop : 'rowDataModel' , event : 'data-model-changed' , } ; return [ props , watch , model ] ; } ;