@basis-ng/primitives 0.0.1-alpha.47 → 0.0.1-alpha.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ import { ClosingType, DialogService } from '../../services/dialog.service';
2
+ import { CdkDialogContainer, DialogRef } from '@angular/cdk/dialog';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * DialogComponent acts as a custom container for dialogs opened via the Angular CDK Dialog module.
6
+ * It provides custom close behavior (ESC key and outside click) and hosts the dialog content.
7
+ *
8
+ * @example
9
+ * Used internally by DialogService. Not intended for direct use.
10
+ */
11
+ export declare class DialogComponent extends CdkDialogContainer {
12
+ /**
13
+ * Injected instance of the DialogService.
14
+ * @internal
15
+ */
16
+ dialogService: DialogService;
17
+ /**
18
+ * Injected reference to the current DialogRef.
19
+ * @internal
20
+ */
21
+ dialogRef: DialogRef<any, any>;
22
+ /**
23
+ * Injected reference to the host element.
24
+ * @internal
25
+ */
26
+ private el;
27
+ /**
28
+ * Signal indicating if the dialog is in the process of leaving (closing).
29
+ */
30
+ readonly leaving: import("@angular/core").WritableSignal<boolean>;
31
+ /**
32
+ * Closes the dialog by calling the DialogService.
33
+ */
34
+ close(type: ClosingType): void;
35
+ /**
36
+ * Listens for document click events and closes the dialog if the click occurs outside the dialog element.
37
+ * @param event MouseEvent
38
+ */
39
+ onDocumentClick(event: MouseEvent): void;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<DialogComponent, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<DialogComponent, "b-dialog", never, {}, {}, never, never, true, never>;
42
+ }
@@ -0,0 +1,86 @@
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
+ import { DialogData } from '../services/dialog.service';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Directive used to register an `ng-template` as a dialog with the `DialogService`.
6
+ * Apply this directive to an `<ng-template>` element, providing a unique ID.
7
+ * The service can then open this template as a dialog by referencing the ID.
8
+ *
9
+ * @example
10
+ * ```html
11
+ * <ng-template bDialog="myModalId" [hasBackdrop]="false">
12
+ * <h2>My Modal Content</h2>
13
+ * <p>This is the content of the dialog.</p>
14
+ * <button (click)="dialogService.closeDialog('myModalId')">Close</button>
15
+ * </ng-template>
16
+ * ```
17
+ */
18
+ export declare class DialogDirective implements OnInit, OnDestroy {
19
+ /**
20
+ * The unique identifier for this dialog template. Used by the `DialogService` to open this specific dialog.
21
+ * Applied as the value of the `bDialog` attribute.
22
+ */
23
+ readonly id: import("@angular/core").InputSignal<string>;
24
+ /**
25
+ * Determines whether the dialog should have a backdrop. Defaults to `true`.
26
+ */
27
+ readonly hasBackdrop: import("@angular/core").InputSignal<boolean>;
28
+ /**
29
+ * Determines whether the dialog should close when the backdrop is clicked. Defaults to `true`.
30
+ */
31
+ readonly closeOnBackdropClick: import("@angular/core").InputSignal<boolean>;
32
+ /**
33
+ * Determines whether the dialog should close when the escape key is pressed. Defaults to `true`.
34
+ */
35
+ readonly closeOnEscapeKey: import("@angular/core").InputSignal<boolean>;
36
+ /**
37
+ * Determines whether the dialog should close when the escape key is pressed or when a pointer event occurs outside the dialog.
38
+ * Defaults to `false`.
39
+ */
40
+ readonly restoreFocus: import("@angular/core").InputSignal<boolean>;
41
+ /**
42
+ * Computed signal that combines the template reference and configuration inputs
43
+ * into the `DialogData` structure expected by the `DialogService`.
44
+ */
45
+ readonly data: import("@angular/core").Signal<DialogData>;
46
+ /**
47
+ * Delay in milliseconds before the dialog opens. Defaults to `0`.
48
+ */
49
+ readonly openDelay: import("@angular/core").InputSignal<number>;
50
+ /**
51
+ * Delay in milliseconds before the dialog closes. Defaults to `150`.
52
+ */
53
+ readonly closeDelay: import("@angular/core").InputSignal<number>;
54
+ /**
55
+ * Injected instance of the `DialogService`.
56
+ * @internal
57
+ */
58
+ private readonly dialogService;
59
+ /**
60
+ * Injected reference to the `ng-template` element this directive is applied to.
61
+ * @internal
62
+ */
63
+ private readonly templateRef;
64
+ /**
65
+ * Lifecycle hook called after Angular has initialized all data-bound properties of a directive.
66
+ * Registers the dialog template and its configuration with the `DialogService`.
67
+ */
68
+ ngOnInit(): void;
69
+ /**
70
+ * Opens the dialog using the `DialogService`.
71
+ * This method can be called to programmatically open the dialog.
72
+ */
73
+ open(): void;
74
+ /**
75
+ * Closes the dialog using the `DialogService`.
76
+ * This method can be called to programmatically close the dialog.
77
+ */
78
+ close(): void;
79
+ /**
80
+ * Lifecycle hook called once, before the directive is destroyed.
81
+ * Removes the dialog registration from the `DialogService`.
82
+ */
83
+ ngOnDestroy(): void;
84
+ static ɵfac: i0.ɵɵFactoryDeclaration<DialogDirective, never>;
85
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DialogDirective, "[bDialog]", ["bDialog"], { "id": { "alias": "bDialog"; "required": true; "isSignal": true; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; "isSignal": true; }; "closeOnBackdropClick": { "alias": "closeOnBackdropClick"; "required": false; "isSignal": true; }; "closeOnEscapeKey": { "alias": "closeOnEscapeKey"; "required": false; "isSignal": true; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; "isSignal": true; }; "openDelay": { "alias": "openDelay"; "required": false; "isSignal": true; }; "closeDelay": { "alias": "closeDelay"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
86
+ }
@@ -0,0 +1,91 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import { UtilsService } from '../../shared/services/utils.service';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Represents the data structure for a registered dialog, containing its template and configuration.
6
+ */
7
+ export interface DialogData {
8
+ /** The template reference (`ng-template`) to be rendered as the dialog content. */
9
+ template: TemplateRef<any>;
10
+ /** Configuration options for the dialog. */
11
+ config: DialogConfig;
12
+ }
13
+ /**
14
+ * Represents the configuration options for a dialog.
15
+ */
16
+ interface DialogConfig {
17
+ /** Whether the dialog should have a backdrop. */
18
+ hasBackdrop: boolean;
19
+ /** The delay before the dialog opens, in milliseconds. */
20
+ openDelay: number;
21
+ /** The delay before the dialog closes, in milliseconds. */
22
+ closeDelay: number;
23
+ /** Whether the dialog should restore focus to the previously focused element when closed. */
24
+ restoreFocus: boolean;
25
+ /** Whether the dialog should be closed when the backdrop is clicked. */
26
+ closeOnBackdropClick: boolean;
27
+ /** Whether the dialog should be closed when the escape key is pressed. */
28
+ closeOnEscapeKey: boolean;
29
+ }
30
+ /**
31
+ * Type representing the closing type for dialogs.
32
+ */
33
+ export type ClosingType = 'outsideClick' | 'escapeKey' | 'closeButton';
34
+ /**
35
+ * Service responsible for managing and controlling dialogs registered via the `DialogDirective`.
36
+ * It uses the Angular CDK Dialog module internally.
37
+ */
38
+ export declare class DialogService {
39
+ /**
40
+ * Injected instance of the Angular CDK `Dialog` service.
41
+ * @internal
42
+ */
43
+ private readonly dialog;
44
+ /**
45
+ * Injected instance of the `UtilsService`.
46
+ * @internal
47
+ */
48
+ utilsService: UtilsService;
49
+ /**
50
+ * A map storing the registered dialog templates and their data, keyed by their unique ID.
51
+ * @internal
52
+ */
53
+ private readonly dialogs;
54
+ /**
55
+ * Registers a dialog template and its data with the service.
56
+ * Typically called automatically by the `DialogDirective`.
57
+ *
58
+ * @param id - The unique identifier for the dialog.
59
+ * @param data - The dialog data containing the template and configuration.
60
+ */
61
+ addDialog(id: string, data: DialogData): void;
62
+ /**
63
+ * Removes a dialog registration from the service.
64
+ * Typically called automatically by the `DialogDirective` when the template is destroyed.
65
+ *
66
+ * @param id - The unique identifier of the dialog to remove.
67
+ */
68
+ removeDialog(id: string): void;
69
+ /**
70
+ * Opens the dialog associated with the given ID.
71
+ *
72
+ * @param id - The unique identifier of the dialog to open.
73
+ * @throws Error if a dialog with the specified ID is not found.
74
+ */
75
+ openDialog(id: string): void;
76
+ /**
77
+ * Closes the dialog associated with the given ID.
78
+ * Does nothing if no dialog with the specified ID is currently open.
79
+ *
80
+ * @param id - The unique identifier of the dialog to close.
81
+ * @param type - The type of closing action.
82
+ */
83
+ closeDialog(id: string, type?: ClosingType): void;
84
+ /**
85
+ * Closes all currently open dialogs managed by the CDK Dialog service.
86
+ */
87
+ closeAllDialogs(): void;
88
+ static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>;
89
+ static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
90
+ }
91
+ export {};
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, inject, RendererFactory2, Injectable, input, ElementRef, Component, TemplateRef, Directive, computed, output, contentChildren, effect, viewChild, contentChild, linkedSignal, model, forwardRef, HostListener, afterNextRender, afterRenderEffect } from '@angular/core';
2
+ import { signal, inject, RendererFactory2, Injectable, input, ElementRef, Component, TemplateRef, Directive, computed, output, contentChildren, effect, viewChild, contentChild, linkedSignal, model, forwardRef, HostListener, afterNextRender, afterRenderEffect, ViewEncapsulation } from '@angular/core';
3
3
  import { NgModel, NG_VALUE_ACCESSOR, ControlContainer } from '@angular/forms';
4
4
  import * as i1 from '@angular/cdk/listbox';
5
5
  import { CdkOption, CdkListbox } from '@angular/cdk/listbox';
@@ -9,12 +9,13 @@ import * as i1$1 from '@angular/cdk/overlay';
9
9
  import { CdkOverlayOrigin, CdkConnectedOverlay, Overlay, OverlayConfig } from '@angular/cdk/overlay';
10
10
  import { NgStyle, NgClass, CommonModule, NgTemplateOutlet } from '@angular/common';
11
11
  import { ActiveDescendantKeyManager, CdkTrapFocus } from '@angular/cdk/a11y';
12
- import { ComponentPortal } from '@angular/cdk/portal';
12
+ import { ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
13
13
  import * as i1$2 from '@angular/cdk/drag-drop';
14
14
  import { CdkDropList, CdkDropListGroup, CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
15
15
  import * as i1$3 from '@angular/cdk/menu';
16
16
  import { CdkMenu, CdkMenuItem, CdkMenuGroup, CdkMenuItemCheckbox, CdkMenuItemRadio, CdkMenuTrigger } from '@angular/cdk/menu';
17
17
  import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
18
+ import { CdkDialogContainer, DialogRef, Dialog } from '@angular/cdk/dialog';
18
19
 
19
20
  class ThemeService {
20
21
  /**
@@ -2956,6 +2957,296 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
2956
2957
  }]
2957
2958
  }] });
2958
2959
 
2960
+ /**
2961
+ * DialogComponent acts as a custom container for dialogs opened via the Angular CDK Dialog module.
2962
+ * It provides custom close behavior (ESC key and outside click) and hosts the dialog content.
2963
+ *
2964
+ * @example
2965
+ * Used internally by DialogService. Not intended for direct use.
2966
+ */
2967
+ class DialogComponent extends CdkDialogContainer {
2968
+ /**
2969
+ * Injected instance of the DialogService.
2970
+ * @internal
2971
+ */
2972
+ dialogService = inject(DialogService);
2973
+ /**
2974
+ * Injected reference to the current DialogRef.
2975
+ * @internal
2976
+ */
2977
+ dialogRef = inject(DialogRef);
2978
+ /**
2979
+ * Injected reference to the host element.
2980
+ * @internal
2981
+ */
2982
+ el = inject(ElementRef);
2983
+ /**
2984
+ * Signal indicating if the dialog is in the process of leaving (closing).
2985
+ */
2986
+ leaving = signal(false);
2987
+ /**
2988
+ * Closes the dialog by calling the DialogService.
2989
+ */
2990
+ close(type) {
2991
+ this.dialogService.closeDialog(this.dialogRef.id, type);
2992
+ }
2993
+ /**
2994
+ * Listens for document click events and closes the dialog if the click occurs outside the dialog element.
2995
+ * @param event MouseEvent
2996
+ */
2997
+ onDocumentClick(event) {
2998
+ if (!this.el.nativeElement.contains(event.target)) {
2999
+ this.close('outsideClick');
3000
+ }
3001
+ }
3002
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DialogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3003
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: DialogComponent, isStandalone: true, selector: "b-dialog", host: { listeners: { "keydown.escape": "close(\"escapeKey\")", "document:click": "onDocumentClick($event)" }, properties: { "class.leaving": "leaving()" } }, usesInheritance: true, ngImport: i0, template: `<ng-template cdkPortalOutlet />`, isInline: true, dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], encapsulation: i0.ViewEncapsulation.None });
3004
+ }
3005
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DialogComponent, decorators: [{
3006
+ type: Component,
3007
+ args: [{
3008
+ selector: 'b-dialog',
3009
+ template: `<ng-template cdkPortalOutlet />`,
3010
+ encapsulation: ViewEncapsulation.None,
3011
+ standalone: true,
3012
+ imports: [CdkPortalOutlet],
3013
+ host: {
3014
+ '(keydown.escape)': 'close("escapeKey")',
3015
+ '[class.leaving]': 'leaving()',
3016
+ },
3017
+ }]
3018
+ }], propDecorators: { onDocumentClick: [{
3019
+ type: HostListener,
3020
+ args: ['document:click', ['$event']]
3021
+ }] } });
3022
+
3023
+ // dialog.service.ts
3024
+ /**
3025
+ * Service responsible for managing and controlling dialogs registered via the `DialogDirective`.
3026
+ * It uses the Angular CDK Dialog module internally.
3027
+ */
3028
+ class DialogService {
3029
+ /**
3030
+ * Injected instance of the Angular CDK `Dialog` service.
3031
+ * @internal
3032
+ */
3033
+ dialog = inject(Dialog);
3034
+ /**
3035
+ * Injected instance of the `UtilsService`.
3036
+ * @internal
3037
+ */
3038
+ utilsService = inject(UtilsService);
3039
+ /**
3040
+ * A map storing the registered dialog templates and their data, keyed by their unique ID.
3041
+ * @internal
3042
+ */
3043
+ dialogs = new Map();
3044
+ /**
3045
+ * Registers a dialog template and its data with the service.
3046
+ * Typically called automatically by the `DialogDirective`.
3047
+ *
3048
+ * @param id - The unique identifier for the dialog.
3049
+ * @param data - The dialog data containing the template and configuration.
3050
+ */
3051
+ addDialog(id, data) {
3052
+ if (this.dialogs.has(id)) {
3053
+ console.warn(`[DialogService] Dialog with id "${id}" is already registered. Overwriting.`);
3054
+ }
3055
+ this.dialogs.set(id, data);
3056
+ }
3057
+ /**
3058
+ * Removes a dialog registration from the service.
3059
+ * Typically called automatically by the `DialogDirective` when the template is destroyed.
3060
+ *
3061
+ * @param id - The unique identifier of the dialog to remove.
3062
+ */
3063
+ removeDialog(id) {
3064
+ this.dialogs.delete(id);
3065
+ }
3066
+ /**
3067
+ * Opens the dialog associated with the given ID.
3068
+ *
3069
+ * @param id - The unique identifier of the dialog to open.
3070
+ * @throws Error if a dialog with the specified ID is not found.
3071
+ */
3072
+ openDialog(id) {
3073
+ const dialogData = this.dialogs.get(id);
3074
+ if (!dialogData) {
3075
+ throw new Error(`[DialogService] Dialog with id "${id}" not found. Ensure the bDialog directive is applied correctly.`);
3076
+ }
3077
+ this.utilsService.debounce('open-dialog-' + id, () => {
3078
+ this.dialog.open(dialogData.template, {
3079
+ id: id,
3080
+ hasBackdrop: dialogData.config.hasBackdrop,
3081
+ backdropClass: 'b-dialog-backdrop',
3082
+ disableClose: true,
3083
+ container: DialogComponent,
3084
+ });
3085
+ }, dialogData.config.openDelay);
3086
+ }
3087
+ /**
3088
+ * Closes the dialog associated with the given ID.
3089
+ * Does nothing if no dialog with the specified ID is currently open.
3090
+ *
3091
+ * @param id - The unique identifier of the dialog to close.
3092
+ * @param type - The type of closing action.
3093
+ */
3094
+ closeDialog(id, type = 'closeButton') {
3095
+ const config = this.dialogs.get(id)?.config;
3096
+ if (!config) {
3097
+ console.warn(`[DialogService] Attempted to close dialog with id "${id}", but no open dialog with that id was found.`);
3098
+ return;
3099
+ }
3100
+ if ((type === 'escapeKey' && !config.closeOnEscapeKey) ||
3101
+ (type === 'outsideClick' && !config.closeOnBackdropClick)) {
3102
+ return;
3103
+ }
3104
+ const dialogRef = this.dialog.getDialogById(id);
3105
+ if (dialogRef) {
3106
+ const container = dialogRef.containerInstance;
3107
+ if (container && container.leaving) {
3108
+ container.leaving.set(true);
3109
+ }
3110
+ this.utilsService.debounce('close-dialog-' + id, () => {
3111
+ dialogRef.close();
3112
+ if (container && container.leaving) {
3113
+ container.leaving.set(false);
3114
+ }
3115
+ }, config.closeDelay);
3116
+ }
3117
+ else {
3118
+ console.warn(`[DialogService] Attempted to close dialog with id "${id}", but no open dialog with that id was found.`);
3119
+ }
3120
+ }
3121
+ /**
3122
+ * Closes all currently open dialogs managed by the CDK Dialog service.
3123
+ */
3124
+ closeAllDialogs() {
3125
+ this.dialog.closeAll();
3126
+ }
3127
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3128
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DialogService, providedIn: 'root' });
3129
+ }
3130
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DialogService, decorators: [{
3131
+ type: Injectable,
3132
+ args: [{
3133
+ providedIn: 'root',
3134
+ }]
3135
+ }] });
3136
+
3137
+ // dialog.directive.ts
3138
+ /**
3139
+ * Directive used to register an `ng-template` as a dialog with the `DialogService`.
3140
+ * Apply this directive to an `<ng-template>` element, providing a unique ID.
3141
+ * The service can then open this template as a dialog by referencing the ID.
3142
+ *
3143
+ * @example
3144
+ * ```html
3145
+ * <ng-template bDialog="myModalId" [hasBackdrop]="false">
3146
+ * <h2>My Modal Content</h2>
3147
+ * <p>This is the content of the dialog.</p>
3148
+ * <button (click)="dialogService.closeDialog('myModalId')">Close</button>
3149
+ * </ng-template>
3150
+ * ```
3151
+ */
3152
+ class DialogDirective {
3153
+ /**
3154
+ * The unique identifier for this dialog template. Used by the `DialogService` to open this specific dialog.
3155
+ * Applied as the value of the `bDialog` attribute.
3156
+ */
3157
+ id = input.required({ alias: 'bDialog' });
3158
+ /**
3159
+ * Determines whether the dialog should have a backdrop. Defaults to `true`.
3160
+ */
3161
+ hasBackdrop = input(true);
3162
+ /**
3163
+ * Determines whether the dialog should close when the backdrop is clicked. Defaults to `true`.
3164
+ */
3165
+ closeOnBackdropClick = input(true);
3166
+ /**
3167
+ * Determines whether the dialog should close when the escape key is pressed. Defaults to `true`.
3168
+ */
3169
+ closeOnEscapeKey = input(true);
3170
+ /**
3171
+ * Determines whether the dialog should close when the escape key is pressed or when a pointer event occurs outside the dialog.
3172
+ * Defaults to `false`.
3173
+ */
3174
+ restoreFocus = input(true);
3175
+ /**
3176
+ * Computed signal that combines the template reference and configuration inputs
3177
+ * into the `DialogData` structure expected by the `DialogService`.
3178
+ */
3179
+ data = computed(() => ({
3180
+ template: this.templateRef,
3181
+ config: {
3182
+ hasBackdrop: this.hasBackdrop(),
3183
+ openDelay: this.openDelay(),
3184
+ closeDelay: this.closeDelay(),
3185
+ restoreFocus: this.restoreFocus(),
3186
+ closeOnBackdropClick: this.closeOnBackdropClick(),
3187
+ closeOnEscapeKey: this.closeOnEscapeKey(),
3188
+ },
3189
+ }));
3190
+ /**
3191
+ * Delay in milliseconds before the dialog opens. Defaults to `0`.
3192
+ */
3193
+ openDelay = input(0);
3194
+ /**
3195
+ * Delay in milliseconds before the dialog closes. Defaults to `150`.
3196
+ */
3197
+ closeDelay = input(150);
3198
+ /**
3199
+ * Injected instance of the `DialogService`.
3200
+ * @internal
3201
+ */
3202
+ dialogService = inject(DialogService);
3203
+ /**
3204
+ * Injected reference to the `ng-template` element this directive is applied to.
3205
+ * @internal
3206
+ */
3207
+ templateRef = inject((TemplateRef)); // Specify type as any or a specific context type
3208
+ /**
3209
+ * Lifecycle hook called after Angular has initialized all data-bound properties of a directive.
3210
+ * Registers the dialog template and its configuration with the `DialogService`.
3211
+ */
3212
+ ngOnInit() {
3213
+ this.dialogService.addDialog(this.id(), this.data());
3214
+ }
3215
+ /**
3216
+ * Opens the dialog using the `DialogService`.
3217
+ * This method can be called to programmatically open the dialog.
3218
+ */
3219
+ open() {
3220
+ this.dialogService.openDialog(this.id());
3221
+ }
3222
+ /**
3223
+ * Closes the dialog using the `DialogService`.
3224
+ * This method can be called to programmatically close the dialog.
3225
+ */
3226
+ close() {
3227
+ this.dialogService.closeDialog(this.id(), 'closeButton');
3228
+ }
3229
+ /**
3230
+ * Lifecycle hook called once, before the directive is destroyed.
3231
+ * Removes the dialog registration from the `DialogService`.
3232
+ */
3233
+ ngOnDestroy() {
3234
+ this.dialogService.removeDialog(this.id());
3235
+ }
3236
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DialogDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3237
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.7", type: DialogDirective, isStandalone: true, selector: "[bDialog]", inputs: { id: { classPropertyName: "id", publicName: "bDialog", isSignal: true, isRequired: true, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscapeKey: { classPropertyName: "closeOnEscapeKey", publicName: "closeOnEscapeKey", isSignal: true, isRequired: false, transformFunction: null }, restoreFocus: { classPropertyName: "restoreFocus", publicName: "restoreFocus", isSignal: true, isRequired: false, transformFunction: null }, openDelay: { classPropertyName: "openDelay", publicName: "openDelay", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown.escape": "closeOnEscapeKey() ? close() : null" } }, exportAs: ["bDialog"], ngImport: i0 });
3238
+ }
3239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DialogDirective, decorators: [{
3240
+ type: Directive,
3241
+ args: [{
3242
+ selector: '[bDialog]',
3243
+ exportAs: 'bDialog',
3244
+ host: {
3245
+ '(keydown.escape)': 'closeOnEscapeKey() ? close() : null',
3246
+ },
3247
+ }]
3248
+ }] });
3249
+
2959
3250
  /*
2960
3251
  * Public API Surface of basis-ng
2961
3252
  */
@@ -2965,5 +3256,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
2965
3256
  * Generated bundle index. Do not edit.
2966
3257
  */
2967
3258
 
2968
- export { AlertComponent, BadgeComponent, ButtonComponent, ButtonGroupComponent, Checkbox, ColorPickerComponent, ComboboxComponent, CommandComponent, CommandOptionsComponent, DrawerComponent, IconComponent, InViewportDirective, InViewportService, InputComponent, InputGroupComponent, LazyContentDirective, MenuComponent, MenuGroupComponent, MenuItemCheckboxComponent, MenuItemComponent, MenuItemRadioComponent, MenuLabelComponent, MenuTriggerDirective, OptionComponent, OverlayDirective, OverlayTriggerDirective, RangeComponent, ResponsiveService, RowComponent, RowItemComponent, SelectComponent, SelectOptionsComponent, SheetComponent, SpinnerComponent, SwitchComponent, TabComponent, TableComponent, TabsComponent, TextareaComponent, ThemeService, TooltipDirective, TreeComponent, TreeNodeComponent };
3259
+ export { AlertComponent, BadgeComponent, ButtonComponent, ButtonGroupComponent, Checkbox, ColorPickerComponent, ComboboxComponent, CommandComponent, CommandOptionsComponent, DialogDirective, DialogService, DrawerComponent, IconComponent, InViewportDirective, InViewportService, InputComponent, InputGroupComponent, LazyContentDirective, MenuComponent, MenuGroupComponent, MenuItemCheckboxComponent, MenuItemComponent, MenuItemRadioComponent, MenuLabelComponent, MenuTriggerDirective, OptionComponent, OverlayDirective, OverlayTriggerDirective, RangeComponent, ResponsiveService, RowComponent, RowItemComponent, SelectComponent, SelectOptionsComponent, SheetComponent, SpinnerComponent, SwitchComponent, TabComponent, TableComponent, TabsComponent, TextareaComponent, ThemeService, TooltipDirective, TreeComponent, TreeNodeComponent };
2969
3260
  //# sourceMappingURL=basis-ng-primitives.mjs.map