import { ActionValue , DynamicValue , EditableValue , ValueStatus } from "mendix" ; export const executeAction = ( action ? ) : void => { if ( action && action . canExecute && ! action . isExecuting ) { action . execute ( ) ; } } ; export const isAvailable = ( property ) : boolean => { return property && property . status === ValueStatus . Available && property . value ; } ; export const parseStyle = ( style = "" ) : { [ key ] : string ; } => { try { return style . split ( ";" ) . reduce < { [ key ] : string ; } > ( ( styleObject , line ) => { const pair = line . split ( ":" ) ; if ( pair . length === 2 ) { const name = pair [ 0 ] . trim ( ) . replace ( /(-.)/g , match => match [ 1 ] . toUpperCase ( ) ) ; styleObject [ name ] = pair [ 1 ] . trim ( ) ; } return styleObject ; } , { } ) ; } catch ( _ ) { return { } ; } } ; export const debounce = < F extends ( ... args : any [ ] ) => any > ( func , waitFor ) => { let timeout = null ; const debounced = ( ... args ) => { if ( timeout !== null ) { clearTimeout ( timeout ) ; timeout = null ; } timeout = setTimeout ( ( ) => func ( ... args ) , waitFor ) ; } ; return debounced as ( ... args : Parameters < F > ) => ReturnType < F > ; } ;