@progress/kendo-angular-navigation
Version:
Kendo UI Navigation for Angular
156 lines (147 loc) • 8.31 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Component, ContentChild, ElementRef, Host, HostBinding, Input, NgZone, Optional, Renderer2 } from '@angular/core';
import { ActionSheetHeaderTemplateDirective, ActionSheetContentTemplateDirective, ActionSheetFooterTemplateDirective, ActionSheetTemplateDirective } from './models';
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common';
import { getId } from '../common/util';
import { ActionSheetComponent } from './actionsheet.component';
import { take } from 'rxjs/operators';
import * as i0 from "@angular/core";
import * as i1 from "./actionsheet.component";
/**
* @hidden
*
* Represents the [Kendo UI ActionSheetView component for Angular].
* Used to display multiple views.
*/
export class ActionSheetViewComponent {
actionSheet;
renderer;
host;
zone;
title;
subtitle;
titleId = getId('k-actionsheet-title');
hostClass = true;
transitionDuration = '500ms';
transitionProperty = 'transform';
headerTemplate;
contentTemplate;
footerTemplate;
actionSheetTemplate;
ngAfterViewInit() {
this.zone.onStable.pipe(take(1)).subscribe(() => {
if (this.actionSheet?.actionSheetViews?.length > 1) {
this.renderer.addClass(this.host.nativeElement, 'k-actionsheet-view-animated');
}
});
}
constructor(actionSheet, renderer, host, zone) {
this.actionSheet = actionSheet;
this.renderer = renderer;
this.host = host;
this.zone = zone;
}
get orientationClass() {
return this.actionSheet?.orientationClass;
}
get alignmentClass() {
return this.actionSheet?.alignmentClass;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ActionSheetViewComponent, deps: [{ token: i1.ActionSheetComponent, host: true, optional: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ActionSheetViewComponent, isStandalone: true, selector: "kendo-actionsheet-view", inputs: { title: "title", subtitle: "subtitle", titleId: "titleId" }, host: { properties: { "class.k-actionsheet-view": "this.hostClass", "style.transition-duration": "this.transitionDuration", "style.transition-property": "this.transitionProperty" } }, queries: [{ propertyName: "headerTemplate", first: true, predicate: ActionSheetHeaderTemplateDirective, descendants: true }, { propertyName: "contentTemplate", first: true, predicate: ActionSheetContentTemplateDirective, descendants: true }, { propertyName: "footerTemplate", first: true, predicate: ActionSheetFooterTemplateDirective, descendants: true }, { propertyName: "actionSheetTemplate", first: true, predicate: ActionSheetTemplateDirective, descendants: true }], ngImport: i0, template: `
<ng-template *ngIf="actionSheetTemplate; else defaultTemplate"
[ngTemplateOutlet]="actionSheetTemplate?.templateRef">
</ng-template>
<ng-template #defaultTemplate>
<div *ngIf="title || subtitle || headerTemplate" class="k-actionsheet-titlebar">
<ng-template *ngIf="headerTemplate; else defaultHeaderTemplate" [ngTemplateOutlet]="headerTemplate.templateRef">
</ng-template>
<ng-template #defaultHeaderTemplate>
<div class="k-actionsheet-titlebar-group k-hbox">
<div class="k-actionsheet-title" [id]="titleId">
<div *ngIf="title" class="k-text-center">{{title}}</div>
<div *ngIf="subtitle" class="k-actionsheet-subtitle k-text-center">{{subtitle}}</div>
</div>
</div>
</ng-template>
</div>
<div *ngIf="contentTemplate" class="k-actionsheet-content">
<ng-template [ngTemplateOutlet]="contentTemplate.templateRef">
</ng-template>
</div>
<div *ngIf="footerTemplate" [ngClass]="[orientationClass, alignmentClass, 'k-actions', 'k-actionsheet-footer']">
<ng-template [ngTemplateOutlet]="footerTemplate.templateRef">
</ng-template>
</div>
</ng-template>
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ActionSheetViewComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-actionsheet-view',
template: `
<ng-template *ngIf="actionSheetTemplate; else defaultTemplate"
[ngTemplateOutlet]="actionSheetTemplate?.templateRef">
</ng-template>
<ng-template #defaultTemplate>
<div *ngIf="title || subtitle || headerTemplate" class="k-actionsheet-titlebar">
<ng-template *ngIf="headerTemplate; else defaultHeaderTemplate" [ngTemplateOutlet]="headerTemplate.templateRef">
</ng-template>
<ng-template #defaultHeaderTemplate>
<div class="k-actionsheet-titlebar-group k-hbox">
<div class="k-actionsheet-title" [id]="titleId">
<div *ngIf="title" class="k-text-center">{{title}}</div>
<div *ngIf="subtitle" class="k-actionsheet-subtitle k-text-center">{{subtitle}}</div>
</div>
</div>
</ng-template>
</div>
<div *ngIf="contentTemplate" class="k-actionsheet-content">
<ng-template [ngTemplateOutlet]="contentTemplate.templateRef">
</ng-template>
</div>
<div *ngIf="footerTemplate" [ngClass]="[orientationClass, alignmentClass, 'k-actions', 'k-actionsheet-footer']">
<ng-template [ngTemplateOutlet]="footerTemplate.templateRef">
</ng-template>
</div>
</ng-template>
`,
standalone: true,
imports: [NgIf, NgClass, NgTemplateOutlet]
}]
}], ctorParameters: function () { return [{ type: i1.ActionSheetComponent, decorators: [{
type: Optional
}, {
type: Host
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { title: [{
type: Input
}], subtitle: [{
type: Input
}], titleId: [{
type: Input
}], hostClass: [{
type: HostBinding,
args: ['class.k-actionsheet-view']
}], transitionDuration: [{
type: HostBinding,
args: ['style.transition-duration']
}], transitionProperty: [{
type: HostBinding,
args: ['style.transition-property']
}], headerTemplate: [{
type: ContentChild,
args: [ActionSheetHeaderTemplateDirective]
}], contentTemplate: [{
type: ContentChild,
args: [ActionSheetContentTemplateDirective]
}], footerTemplate: [{
type: ContentChild,
args: [ActionSheetFooterTemplateDirective]
}], actionSheetTemplate: [{
type: ContentChild,
args: [ActionSheetTemplateDirective]
}] } });