carbon-components-angular
Version:
Next generation components
73 lines (69 loc) • 2.69 kB
TypeScript
/**
*
* carbon-angular v0.0.0 | dropdown.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 { OnDestroy } from "@angular/core";
import { PlaceholderService } from "carbon-components-angular/placeholder";
import { Subscription } from "rxjs";
import { AnimationFrameService } from "carbon-components-angular/utils";
import * as i0 from "@angular/core";
export declare class DropdownService implements OnDestroy {
protected placeholderService: PlaceholderService;
protected animationFrameService: AnimationFrameService;
set offset(value: {
top?: number;
left?: number;
});
get offset(): {
top?: number;
left?: number;
};
/**
* reference to the body appended menu
*/
protected menuInstance: HTMLElement;
/**
* Maintains an Event Observable Subscription for the global requestAnimationFrame.
* requestAnimationFrame is tracked only if the `Dropdown` is appended to the body otherwise we don't need it
*/
protected animationFrameSubscription: Subscription;
protected _offset: {
top: number;
left: number;
};
constructor(placeholderService: PlaceholderService, animationFrameService: AnimationFrameService);
/**
* Appends the menu to the body, or a `cds-placeholder` (if defined)
*
* @param parentRef container to position relative to
* @param menuRef menu to be appended to body
* @param classList any extra classes we should wrap the container with
*/
appendToBody(parentRef: HTMLElement, menuRef: HTMLElement, classList: any): HTMLElement;
/**
* Reattach the dropdown menu to the parent container
* @param hostRef container to append to
*/
appendToDropdown(hostRef: HTMLElement): HTMLElement;
/**
* position an open dropdown relative to the given parentRef
*/
updatePosition(parentRef: any): void;
ngOnDestroy(): void;
protected positionDropdown(parentRef: any, menuRef: any): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DropdownService>;
}