import * as i0 from '@angular/core'; import { Type, OnInit, OnDestroy, AfterViewInit, ElementRef, ChangeDetectorRef, Renderer2, RendererFactory2 } from '@angular/core'; import * as i8 from '@sinequa/core/intl'; import { MessageParams } from '@sinequa/core/intl'; import * as i10 from '@sinequa/components/utils'; import { Placement, UIService } from '@sinequa/components/utils'; import { Subject, Observable } from 'rxjs'; import * as i7 from '@angular/common'; import * as i9 from '@sinequa/core/load-component'; declare abstract class IAction { /** * internal name of the `Action` */ name?: string; /** * the display text of the `Action` */ text?: string; /** * when set, `Action` element is a link tag, otherwise it's a button tag */ href?: string; target?: string; /** * icon class name displayed before the `Action` text */ icon?: string; /** * additional css styles to add */ styles?: string | string[] | Set | { [klass: string]: any; }; /** * icon class name displayed after the `Action` text */ iconAfter?: string; /** * when true, `Action` is displayed as a menu separator */ separator?: boolean; /** * The children are scrollable */ scrollable?: boolean; /** * A separate item whose children are scrollable "in place" */ scrollGroup?: boolean; /** * embedded component dynamically loaded */ component?: Type; /** * component's inputs. Work with `component` */ componentInputs?: any; /** * any additional informations */ data?: any; /** * tooltip's text */ title?: string; /** * tooltip placement, when undefined default is"bottom" */ titlePlacement?: Placement; /** * tooltip fallback placement(s) */ fallbackPlacements?: Placement | Placement[]; /** * when true, the display of the `Action` will start with a check icon */ selected?: boolean; /** * when true, the `Action` is grayed out */ disabled?: boolean; /** * when true, the `Action` is not shown */ hidden?: boolean; /** * A dropdown with only one child is flattened to show only the child at the top level */ flattenable?: boolean; /** * i18n - passed to sqMessage in (eg) action-item-content * work with the `text` property */ messageParams?: MessageParams; /** * when true, display the `title` property as a dropdown header before children elements */ headerGroup?: boolean; action?: (item: Action, event: UIEvent) => void; toggle?: (item: Action, open: boolean) => void; updater?: (item: Action) => void; init?: (item: Action) => void; destroy?: (item: Action) => void; /** * children `Action` elements. Used with nested menus */ children?: Action[]; } declare class Action extends IAction { constructor(options: IAction); get hasChildren(): boolean; get showSelected(): boolean; update(): void; } /** * Creating a new Action object with the separator property set to true. **/ declare const ActionSeparator: Action; type StringWithAutocomplete = T | (string & Record); type ActionSize = StringWithAutocomplete<"xs" | "sm" | "md" | "lg" | "xl" | "xxl">; interface ActionOptions { /** * the size of the menu */ size?: ActionSize; /** * the css class of the menu */ style?: string; /** * whether to automatically change the visualisation of the menu and * it's children when resizing the browser window */ autoAdjust?: boolean; /** * if `autoAdjust` is true, this property defines the size of the browser * window at which the menu size can be adjusted */ autoAdjustBreakpoint?: ActionSize; /** * whether the menu elements are right-aligned */ rightAligned?: boolean; } interface ActionButtonsOptions extends ActionOptions { items: Action[] | Action; } interface ActionItemOptions extends ActionOptions { /** * the `Action` object representing the menu */ item: Action; /** * if true, the menu elements will have `nav-link` css class, * otherwise, they are set to `dropdown-item` */ inMenu: boolean; } interface DropdownMenuOptions { /** * the `Action` object representing the menu */ item: Action; /** * whether the menu elements are right-aligned */ rightAligned?: boolean; /** * the css class of the menu when it is shown */ showMenuClass: string; /** * text of the section displayed above the `Action` element */ header?: string; } declare class BsActionButtons { klass: string; private _options; set options(opts: ActionButtonsOptions); get options(): ActionButtonsOptions; get sizeClass(): string; get styleClass(): string; get itemsVisible(): Action[]; getActionItemOptions(item: Action): ActionItemOptions; itemClick(item: Action, event: UIEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsActionItem implements OnInit, OnDestroy, AfterViewInit { private uiService; private elementRef; private cdRef; set options(props: ActionItemOptions); get options(): ActionItemOptions; collapseBreakpoint: ActionSize; protected props: ActionItemOptions; protected item: Action; protected inListItem: boolean; protected dropdownButton: Element; protected dropdownListItem: Element; protected autoAdjustBreakpoint?: string; protected showDropdown: boolean; constructor(uiService: UIService, elementRef: ElementRef, cdRef: ChangeDetectorRef); get haveItem(): boolean; get isVisible(): boolean; get hasAction(): boolean; get isDropdownButton(): boolean; get isButton(): boolean; get isDropdownListItem(): boolean; get isListItem(): boolean; get haveSpace(): boolean; get haveIcon(): boolean; get itemText(): string; get itemTitle(): string; get itemMessageParams(): any; get sizeClass(): string; get styleClass(): string; get dropdownMenuOptions(): DropdownMenuOptions; ngAfterViewInit(): void; ngOnInit(): void; ngOnDestroy(): void; click(event: UIEvent): void; touchstart(): void; mousedown(): void; focusin(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsActionItemContent { klass: string; item: Action; text: string; inDropdownMenu: boolean; componentClick(event: UIEvent): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsActionMenu implements OnInit { /** * the children `Action` elements of the menu */ items: Action[]; size: ActionSize; autoAdjust: boolean; autoAdjustBreakpoint: ActionSize; collapseBreakpoint: ActionSize; /** * whether the menu elements are right-aligned */ right: boolean; ngOnInit(): void; identify(index: number, item: Action): string | number; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsDropdownMenu { private elementRef; item: Action; /** * all visibles `Action` elements */ children: Action[]; private _options; set options(opts: DropdownMenuOptions); get options(): DropdownMenuOptions; role: string; dropdown: boolean; rightAligned: boolean | undefined; constructor(elementRef: ElementRef); private getLi; click(item: Action, event: UIEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } interface DropdownEvent { type: "clear" | "toggle" | "active"; } interface DropdownClearEvent extends DropdownEvent { type: "clear"; sourceEvent: KeyboardEvent | MouseEvent | undefined; source?: Element; } interface DropdownToggleEvent extends DropdownEvent { type: "toggle"; element: Element; } interface DropdownActiveEvent extends DropdownEvent { type: "active"; value: boolean; } type DropdownEvents = DropdownClearEvent | DropdownToggleEvent | DropdownActiveEvent; declare const gClassName: { DISABLED: string; SHOW: string; DROPUP: string; DROPRIGHT: string; DROPLEFT: string; MENURIGHT: string; MENULEFT: string; POSITION_STATIC: string; }; declare const gSelector: { DROPDOWN: string; DATA_TOGGLE: string; FORM_CHILD: string; MENU: string; NAVBAR_NAV: string; VISIBLE_ITEMS: string; }; declare class BsDropdownService implements OnDestroy { readonly document: Document; protected _events: Subject; protected unlisteners: (() => void)[]; protected renderer: Renderer2; constructor(document: Document, rendererFactory: RendererFactory2); ngOnDestroy(): void; get events(): Observable; /** * "If the event target matches the selector, return it, otherwise return the * first ancestor of the event target that matches the selector." * * The function starts by declaring a variable named element and assigning it * the value of the event target. The event target is the element that the * event was dispatched from * @param {Element} base - The element that the event listener is attached to. * @param {Event} event - The event that was triggered. * @param {string} selector - The CSS selector to match. * @returns The element that matches the selector. */ private matchDescendant; /** * If the element has a data-target attribute, return it. Otherwise, if the * element has an href attribute, return it. Otherwise, return null * @param {HTMLElement} element - The element that triggered the event. * @returns The selector is being returned. */ private getSelectorFromElement; /** * It returns the parent element of the element passed in as a parameter * @param {HTMLElement} element - The element that was clicked. * @returns The parent element of the element that was clicked. */ getParentFromElement(element: HTMLElement): Node | null; private dataApiKeydownHandler; private clearMenus; private toggle; private formChildClick; raiseClear(source?: Element): void; raiseActive(active: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class BsDropdownDirective implements OnInit, OnDestroy, AfterViewInit { private elementRef; private dropdownService; private subscription; /** * true if the dropdown is within a navbar element */ private inNavbar; /** * the dropdown wrapper, often the parent of the `ElementRef` element * * @example * * */ private dropdown; /** * the `dropdown-toggle` element where the directive is set. * * @example * */ private dropdownToggle; /** * the `dropdown-menu` element attached to the `dropdown-toggle` element * * @example * */ private _dropdownMenu; private popper; constructor(elementRef: ElementRef, dropdownService: BsDropdownService); /** * @returns The first `.dropdown` descendant `.dropdown-menu` element. */ get dropdownMenu(): HTMLElement | null; ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; clickHandler(event: Event): void; private toggle; /** * * If the dropdown is a `dropup`, then the placement is `top-start` unless * if the dropdown menu is a `dropdown-menu-end`, then the placement is `top-end`. * * If the dropdown is a `dropend`, then the placement is `right-start`. * * If the dropdown is a `dropstart`, then the placement is `left-start`. * * If the dropdown menu is a `dropdown-menu-end`, then the placement is `bottom-end`. * Otherwise, the placement is `bottom-start` * * @returns The placement of the dropdown menu. */ private getPlacement; private getPopperConfig; /** * If the dropdown menu is already visible, do nothing. Otherwise, if the * dropdown menu is not visible, show it * @param [usePopper=false] - boolean */ show(usePopper?: boolean): void; /** * If the dropdown is open, close it * @param event - StrictUnion */ private clear; /** * It removes the class "show" from all submenus. * @param {HTMLElement} element - HTMLElement - The element that was clicked. */ private closeSubmenus; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class BsActionModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { Action, ActionSeparator, BsActionButtons, BsActionItem, BsActionItemContent, BsActionMenu, BsActionModule, BsDropdownDirective, BsDropdownMenu, BsDropdownService, IAction, gClassName, gSelector }; export type { ActionButtonsOptions, ActionItemOptions, ActionSize, DropdownActiveEvent, DropdownClearEvent, DropdownEvent, DropdownEvents, DropdownMenuOptions, DropdownToggleEvent };