import { defineComponent } from "vue" ; import { IBaseComponent , initBaseComponent } from "./component" ; import { getNodeOptions } from "./vue-helper" ; interface IExtension { $_isExtension : boolean ; $_attachTo ( element ) ; } interface IExtensionComponentNode { $_hasOwner : boolean ; } function initDxExtensionComponent ( ) { return defineComponent ( { extends : initBaseComponent ( ) , created ( ) { const nodeOptions = getNodeOptions ( this ) ; ( nodeOptions as any as IExtension ) . $_isExtension = true ; ( nodeOptions as any as IExtension ) . $_attachTo = this . attachTo . bind ( this ) ; } , mounted ( ) { this . $el . setAttribute ( "isExtension" , "true" ) ; const componentOptions = getNodeOptions ( this ) ; if ( componentOptions && ( componentOptions as any as IExtensionComponentNode ) . $_hasOwner ) { return ; } this . attachTo ( this . $el ) ; } , methods : { attachTo ( element ) { ( this as any as IBaseComponent ) . $_createWidget ( element ) ; } } } ) ; } export { initDxExtensionComponent , IExtension , IExtensionComponentNode } ;