UNPKG

carbon-components-angular

Version:
79 lines (75 loc) 3.19 kB
/** * * carbon-angular v0.0.0 | dialog.service.d.ts * * Copyright 2014, 2024 IBM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Injector, ComponentRef, ViewContainerRef } from "@angular/core"; import { DialogConfig } from "./dialog-config.interface"; import { PlaceholderService } from "carbon-components-angular/placeholder"; import { Dialog } from "./dialog.component"; import * as i0 from "@angular/core"; /** * `Dialog` object to be injected into other components. */ export declare class DialogService { protected injector: Injector; protected placeholderService: PlaceholderService; /** * Used in `singletonClickListen`, don't count on its existence and values. */ protected static listeningForBodyClicks: boolean; /** * A set of all known dialog components */ protected static dialogRefs: Set<ComponentRef<Dialog>>; /** * Closes all known `Dialog`s. Does not focus any previous elements, since we can't know which would be correct */ static closeAll(): void; /** * Creates an instance of `DialogService`. */ constructor(injector: Injector, placeholderService: PlaceholderService); /** * If `dialogRef` is defined, the Dialog is already open. If * `dialogRef` is undefined, we create the `Dialog` component and reference to it. * A subscription is created to track if the `Dialog` should close. * * @param viewContainer a `ViewContainerRef` to instantiate the component against. * May be `null` if an `cds-placeholder` exists and `dialogConfig.appendInline` is false * @param dialogConfig the `DialogConfig` for the component */ open(viewContainer: ViewContainerRef, dialogConfig: DialogConfig, component: any): ComponentRef<Dialog>; /** * On close of `Dialog` item, sets focus back to previous item, unsets * the current `dialogRef` item. Unsubscribes to the event of `Dialog` close. * * @param dialogRef the dialogRef to close */ close(dialogRef: ComponentRef<Dialog>): void; /** * Fix for safari hijacking clicks. * * Runs on `ngOnInit` of every dialog. Ensures we don't have multiple listeners * because having many of them could degrade performance in certain cases (and is * not necessary for our use case) * * This is an internally used function, can change at any point (even get removed) * and changes to it won't be considered a breaking change. Use at your own risk. */ singletonClickListen(): void; static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>; }