clr-angular-static-fix
Version:
1. Install Clarity Icons package through npm:
43 lines (36 loc) • 1.47 kB
text/typescript
/*
* 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 { Component, ElementRef, Input, OnDestroy, Optional, SkipSelf } from '@angular/core';
import { Subscription } from 'rxjs';
import { IfOpenService } from '../../utils/conditional/if-open.service';
import { POPOVER_HOST_ANCHOR } from '../common/popover-host-anchor.token';
import { ROOT_DROPDOWN_PROVIDER, RootDropdownService } from './providers/dropdown.service';
({
selector: 'clr-dropdown',
template: '<ng-content></ng-content>',
host: {
'[class.dropdown]': 'true',
// FIXME: remove this as soon as we stop supporting this old <div class="dropdown-menu"> syntax
'[class.open]': 'ifOpenService.open',
},
providers: [IfOpenService, ROOT_DROPDOWN_PROVIDER, { provide: POPOVER_HOST_ANCHOR, useExisting: ElementRef }],
})
export class ClrDropdown implements OnDestroy {
private _subscription: Subscription;
constructor(
()
()
public parent: ClrDropdown,
public ifOpenService: IfOpenService,
dropdownService: RootDropdownService
) {
this._subscription = dropdownService.changes.subscribe(value => (this.ifOpenService.open = value));
}
('clrCloseMenuOnItemClick') isMenuClosable: boolean = true;
ngOnDestroy() {
this._subscription.unsubscribe();
}
}