@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
24 lines (23 loc) • 1.42 kB
TypeScript
import type { AdaptableContainerValue, ContainerContext, InitContainerContext } from '../AdaptableOptions/ContainerOptions';
/**
* The union type representing any container option value (static or function).
*/
type AnyContainerOption = AdaptableContainerValue | ((context: any) => AdaptableContainerValue);
/**
* Resolves a container option value to an `HTMLElement`.
*
* Resolution order:
* 1. If `container` is `null`/`undefined`, returns `null`.
* 2. If `container` is a function, it is called with the provided `context` and the result is resolved.
* 3. If the value is an `HTMLElement`, it is returned directly.
* 4. If the value is an `AdaptableCSSSelector` (`{ selector: string }`), `document.querySelectorAll` is used.
* If multiple elements match, the first is returned and a console warning is logged.
* 5. If the value is a `string`, it is treated as an element ID and `document.getElementById` is used.
*
* @param container - The container reference to resolve.
* @param context - Optional context passed to the function form of the container.
* @param doc - The document to query against (defaults to `globalThis.document`).
* @returns The resolved `HTMLElement`, or `null` if not found.
*/
export declare function resolveContainerElement(container: AnyContainerOption | undefined | null, context?: ContainerContext | InitContainerContext, doc?: Document): HTMLElement | null;
export {};