UNPKG

smart-webcomponents

Version:

Web Components & Custom Elements for Professional Web Applications

127 lines (105 loc) 4.24 kB
import { RibbonGroup } from './../index'; import { RibbonGroupDirection, RibbonGroupWrapSize, RibbonGroupDialogLauncher, ElementRenderMode} from './../index'; import { Component, Directive, AfterViewInit, ElementRef, Input, OnInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'; import { BaseElement, Smart } from './smart.element'; export { RibbonGroupDirection, RibbonGroupWrapSize, RibbonGroupDialogLauncher, ElementRenderMode} from './../index'; export { Smart } from './smart.element'; export { RibbonGroup } from './../index'; @Directive({ exportAs: 'smart-ribbon-group', selector: 'smart-ribbon-group, [smart-ribbon-group]' }) export class RibbonGroupComponent extends BaseElement implements OnInit, AfterViewInit, OnDestroy, OnChanges { constructor(ref: ElementRef<RibbonGroup>) { super(ref); this.nativeElement = ref.nativeElement as RibbonGroup; } private eventHandlers: any[] = []; public declare nativeElement: RibbonGroup; /** @description Creates the component on demand. * @param properties An optional object of properties, which will be added to the template binded ones. */ public createComponent(properties = {}): any { this.nativeElement = <RibbonGroup>document.createElement('smart-ribbon-group'); for (let propertyName in properties) { this.nativeElement[propertyName] = properties[propertyName]; } return this.nativeElement; } /** @description Determines the label of the ribbon group. */ @Input() get label(): string { return this.nativeElement ? this.nativeElement.label : undefined; } set label(value: string) { this.nativeElement ? this.nativeElement.label = value : undefined; } /** @description Determines the icon of the ribbon group. */ @Input() get icon(): string { return this.nativeElement ? this.nativeElement.icon : undefined; } set icon(value: string) { this.nativeElement ? this.nativeElement.icon = value : undefined; } /** @description Determines the class of the ribbon group. */ @Input() get cssClass(): string { return this.nativeElement ? this.nativeElement.cssClass : undefined; } set cssClass(value: string) { this.nativeElement ? this.nativeElement.cssClass = value : undefined; } /** @description Determines the ribbon items of the ribbon group. */ @Input() get ribbonItems(): any { return this.nativeElement ? this.nativeElement.ribbonItems : undefined; } set ribbonItems(value: any) { this.nativeElement ? this.nativeElement.ribbonItems = value : undefined; } /** @description Determines the direction of the ribbon group. */ @Input() get direction(): RibbonGroupDirection | string { return this.nativeElement ? this.nativeElement.direction : undefined; } set direction(value: RibbonGroupDirection | string) { this.nativeElement ? this.nativeElement.direction = value : undefined; } /** @description Determines the settings of the dialog launcher of the ribbon group. */ @Input() get dialogLauncher(): RibbonGroupDialogLauncher { return this.nativeElement ? this.nativeElement.dialogLauncher : undefined; } set dialogLauncher(value: RibbonGroupDialogLauncher) { this.nativeElement ? this.nativeElement.dialogLauncher = value : undefined; } /** @description Determines the size, below which the ribbon group will be wrapped. */ @Input() get wrapSize(): RibbonGroupWrapSize | string { return this.nativeElement ? this.nativeElement.wrapSize : undefined; } set wrapSize(value: RibbonGroupWrapSize | string) { this.nativeElement ? this.nativeElement.wrapSize = value : undefined; } get isRendered(): boolean { return this.nativeElement ? this.nativeElement.isRendered : false; } ngOnInit() { } ngAfterViewInit() { const that = this; that.onCreate.emit(that.nativeElement); this.nativeElement.classList.add('smart-angular'); if (this.nativeElement.whenRendered) this.nativeElement.whenRendered(() => { that.onReady.emit(that.nativeElement); }); } ngOnDestroy() { } ngOnChanges(changes: SimpleChanges) { if (this.nativeElement && this.nativeElement.isRendered) { for (const propName in changes) { if (changes.hasOwnProperty(propName)) { this.nativeElement[propName] = changes[propName].currentValue; } } } } }