import { BlockUIServiceInstance } from '../block-ui.module' ; import { BlockUIDecoratorSettings } from '../models/block-ui-decorator-settings.model' ; export let blockInstanceGuid = 1 ; export function BlockUI ( blockName ? , settings = { } ) { if ( ! settings . scopeToInstance ) { return function ( target ? , propertyKey ? ) { target [ propertyKey ] = BlockUIServiceInstance . decorate ( blockName ) ; } ; } return function ( target ? , key ? ) { const secret = `_${ key }-block-ui` ; Object . defineProperty ( target , key , { get : function ( ) { if ( this [ secret ] ) { return this [ secret ] ; } const instanceName = `${ blockName }-${ blockInstanceGuid ++ }` ; this [ secret ] = BlockUIServiceInstance . decorate ( instanceName ) ; return this [ secret ] ; } , set : function ( value ) { this [ secret ] = value ; } , } ) ; } ; }