UNPKG

@progress/kendo-angular-layout

Version:

Kendo UI for Angular Layout Package - a collection of components to create professional application layoyts

122 lines (121 loc) 5.05 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, HostBinding, ContentChild } from '@angular/core'; import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n'; import { DrawerComponent } from './drawer.component'; import { isPresent } from '../common/util'; import { NgIf } from '@angular/common'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-l10n"; /** * Serves as a container for the [Kendo UI Drawer component for Angular]({% slug overview_drawer %}) and its content. */ export class DrawerContainerComponent { localizationService; get hostClass() { return true; } get overlayClass() { return this.drawer.mode === 'overlay'; } get miniClass() { return this.drawer.mini && !this.drawer.expanded; } get pushClass() { return this.drawer.mode === 'push'; } get isExpandedClass() { return this.drawer.expanded; } /** * @hidden */ direction; /** * @hidden */ drawer; dynamicRTLSubscription; rtl = false; constructor(localizationService) { this.localizationService = localizationService; this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => { this.rtl = rtl; this.direction = this.rtl ? 'rtl' : 'ltr'; }); } ngOnDestroy() { if (this.dynamicRTLSubscription) { this.dynamicRTLSubscription.unsubscribe(); } } /** * @hidden */ get overlay() { return isPresent(this.drawer) && this.drawer.expanded && this.drawer.mode === 'overlay'; } /** * @hidden */ closeDrawer() { if (this.overlay && this.drawer.autoCollapse) { this.drawer.toggle(false); } } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawerContainerComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DrawerContainerComponent, isStandalone: true, selector: "kendo-drawer-container", host: { properties: { "class.k-drawer-container": "this.hostClass", "class.k-drawer-overlay": "this.overlayClass", "class.k-drawer-mini": "this.miniClass", "class.k-drawer-push": "this.pushClass", "class.k-drawer-expanded": "this.isExpandedClass", "attr.dir": "this.direction" } }, providers: [ LocalizationService, { provide: L10N_PREFIX, useValue: 'kendo.drawer.container' } ], queries: [{ propertyName: "drawer", first: true, predicate: DrawerComponent, descendants: true }], ngImport: i0, template: ` <div class="k-overlay" *ngIf="overlay" (click)="closeDrawer()"></div> <ng-content></ng-content> `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawerContainerComponent, decorators: [{ type: Component, args: [{ selector: 'kendo-drawer-container', providers: [ LocalizationService, { provide: L10N_PREFIX, useValue: 'kendo.drawer.container' } ], template: ` <div class="k-overlay" *ngIf="overlay" (click)="closeDrawer()"></div> <ng-content></ng-content> `, standalone: true, imports: [NgIf] }] }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { hostClass: [{ type: HostBinding, args: ['class.k-drawer-container'] }], overlayClass: [{ type: HostBinding, args: ['class.k-drawer-overlay'] }], miniClass: [{ type: HostBinding, args: ['class.k-drawer-mini'] }], pushClass: [{ type: HostBinding, args: ['class.k-drawer-push'] }], isExpandedClass: [{ type: HostBinding, args: ['class.k-drawer-expanded'] }], direction: [{ type: HostBinding, args: ['attr.dir'] }], drawer: [{ type: ContentChild, args: [DrawerComponent] }] } });