@progress/kendo-angular-dialog
Version:
Dialog Package for Angular
57 lines (56 loc) • 2.78 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 { DialogRef } from './models/dialog-ref';
import { DialogActionsComponent } from './dialog-actions.component';
import { DialogTitleBarComponent } from './dialog-titlebar.component';
import { Directive, ViewChild } from '@angular/core';
import { filter } from 'rxjs/operators';
import * as i0 from "@angular/core";
import * as i1 from "./models/dialog-ref";
/**
* The base class which will be extended by a component that is provided as content through `content`
* ([see example](slug:service_dialog#toc-single-component-rendering)).
*/
export class DialogContentBase {
dialog;
/**
* @hidden
*/
dialogTitleBar;
/**
* @hidden
*/
dialogActions;
constructor(dialog) {
this.dialog = dialog;
}
/**
* @hidden
*/
ngAfterViewInit() {
if (this.dialogTitleBar) {
// when opening component inside dialog with service AND the component has defined its own titlebar
this.dialogTitleBar.close.pipe(filter((e) => !e.isDefaultPrevented())).subscribe(() => {
this.dialog.close();
});
}
if (this.dialogActions) {
if (this.dialogActions.actions) {
this.dialogActions.action.subscribe(action => this.dialog.dialog.instance.action.emit(action));
}
}
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DialogContentBase, deps: [{ token: i1.DialogRef }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: DialogContentBase, viewQueries: [{ propertyName: "dialogTitleBar", first: true, predicate: DialogTitleBarComponent, descendants: true }, { propertyName: "dialogActions", first: true, predicate: DialogActionsComponent, descendants: true }], ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DialogContentBase, decorators: [{
type: Directive
}], ctorParameters: function () { return [{ type: i1.DialogRef }]; }, propDecorators: { dialogTitleBar: [{
type: ViewChild,
args: [DialogTitleBarComponent, { static: false }]
}], dialogActions: [{
type: ViewChild,
args: [DialogActionsComponent, { static: false }]
}] } });