UNPKG

clr-angular-static-fix

Version:

1. Install Clarity Icons package through npm:

27 lines (22 loc) 966 B
/* * Copyright (c) 2016-2018 VMware, Inc. All Rights Reserved. * This software is released under MIT license. * The full license information can be found in LICENSE in the root directory of this project. */ import { Directive, ElementRef, OnDestroy } from '@angular/core'; import { Subscription } from 'rxjs'; import { DomAdapter } from './dom-adapter'; import { DatagridRenderOrganizer } from './render-organizer'; @Directive({ selector: '[clrDgBody]' }) export class DatagridBodyRenderer implements OnDestroy { constructor(private el: ElementRef, private organizer: DatagridRenderOrganizer, private domAdapter: DomAdapter) { this.subscription = organizer.scrollbar.subscribe(() => this.computeScrollbarWidth()); } private subscription: Subscription; ngOnDestroy() { this.subscription.unsubscribe(); } private computeScrollbarWidth() { this.organizer.scrollbarWidth.next(this.domAdapter.scrollBarWidth(this.el.nativeElement)); } }