projects/i-components/src/lib/directives/ribbonGroupItemsDirective.directive.ts
RibbonGroupDirective
Selector | [wmRibbonGroupItem] |
Properties |
|
constructor(template: TemplateRef
|
||||||
Creates an instance of RibbonGroupDirective.
Parameters :
|
Public template |
Type : TemplateRef<any>
|
import {
ComponentRef,
Directive,
ElementRef,
Inject,
InjectionToken,
Input,
Optional,
TemplateRef,
ViewContainerRef,
} from '@angular/core';
/**
* Injection token used to access to components
*
* @export
* @class InjectionToken
*/
export const D_COMPATIBLE_COMPONENT = new InjectionToken<RibbonComponentData>(
'D_COMPATIBLE_COMPONENT'
);
/**
* RibbonGroupDirective
*
* @export
* @class RibbonGroupDirective
*/
@Directive({
selector: '[wmRibbonGroupItem]',
})
export class RibbonGroupDirective {
/**
* Creates an instance of RibbonGroupDirective.
*
* @param {TemplateRef<any>} template
* @memberof RibbonGroupDirective
*/
constructor(public template: TemplateRef<any>) {}
}
/**
* This is a directive in charge of get component instance since it was not possible to read InjectionToken on structural directive
*
* @export
* @class RibbonInstanceDirective
*/
@Directive({
selector: '[wmRibbonItemInstance]',
})
export class RibbonInstanceDirective {
/**
* Component instance
*
* @type {*}
* @memberof RibbonInstanceDirective
*/
public component: any;
/**
* Creates an instance of RibbonInstanceDirective.
*
* @param {(RibbonComponentData | null)} component
* @memberof RibbonInstanceDirective
*/
constructor(
@Optional()
@Inject(D_COMPATIBLE_COMPONENT)
component: RibbonComponentData | null
) {
this.component = component;
}
}
/**
* Interface to be implemented on all RibbonGroupComponents
*
* @export
* @interface RibbonComponentData
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface RibbonComponentData {}