UNPKG

@obliczeniowo/elementary

Version:
99 lines (92 loc) 4.15 kB
import * as i0 from '@angular/core'; import { TemplateRef, ApplicationRef, Injector, ElementRef, EventEmitter, SimpleChanges } from '@angular/core'; import { Portal } from '@angular/cdk/portal'; import { IPoint2D } from '@obliczeniowo/elementary/classes'; import { OblResizeWindowService } from '@obliczeniowo/elementary/resize-window'; import { Subject } from 'rxjs'; import * as i3 from '@angular/common'; import * as i4 from '@angular/cdk/overlay'; import * as i5 from '@obliczeniowo/elementary/icons'; import * as i6 from '@obliczeniowo/elementary/text-pipes'; interface MenuItem { id: string | number; icon?: string | TemplateRef<any>; text: string; command: string; disabled?: boolean; } declare class OblMenuTeleportService { private readonly appRef; private readonly injector; private readonly portalOutlet; constructor(appRef: ApplicationRef, injector: Injector); registerPortalOutlet(outletElement: HTMLElement): number; unregisterPortalOutlet(id: number): void; teleport(id: number, portal: Portal<any>): void; finishTeleportation(id: number): void; static ɵfac: i0.ɵɵFactoryDeclaration<OblMenuTeleportService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<OblMenuTeleportService>; } declare class MenuComponent { private menuTeleportService; protected resize: OblResizeWindowService; protected elementRef: ElementRef<HTMLElement>; protected _opened: boolean; /** * Open/close menu. When set to false emits extra command 'on-close' only by using command Subject */ set opened(opened: boolean); get opened(): boolean; target: HTMLElement; items: MenuItem[]; /** * translations for item.text from {@link items} */ translations: { [en: string]: string; }; /** * emit command when active element was clicked */ clicked: EventEmitter<string>; command: Subject<string>; protected parent: HTMLDivElement; protected position: IPoint2D; protected size: { width: number; height: number; }; protected id: number; set content(elemRef: ElementRef<HTMLElement>); checkParent(target: HTMLElement | null | undefined): boolean; protected targetClicked: (event: MouseEvent) => void; constructor(menuTeleportService: OblMenuTeleportService, resize: OblResizeWindowService, elementRef: ElementRef<HTMLElement>); ngOnDestroy(): void; ngAfterViewChecked(): void; protected itemClicked(item: MenuItem): void; static ɵfac: i0.ɵɵFactoryDeclaration<MenuComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MenuComponent, "obl-menu", never, { "opened": { "alias": "opened"; "required": false; }; "target": { "alias": "target"; "required": false; }; "items": { "alias": "items"; "required": false; }; "translations": { "alias": "translations"; "required": false; }; }, { "clicked": "clicked"; }, never, never, false, never>; } declare class MenuItemComponent { item: MenuItem; translations: { [english: string]: string; }; noIcon: boolean; clicked: EventEmitter<MenuItem>; onClick(): void; get disabled(): boolean | undefined; ngOnChanges(changes: SimpleChanges): void; protected stringIcon(): boolean; protected iconTemplate(): TemplateRef<any>; protected iconString(): string; static ɵfac: i0.ɵɵFactoryDeclaration<MenuItemComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MenuItemComponent, "obl-menu-item", never, { "item": { "alias": "item"; "required": true; }; "translations": { "alias": "translations"; "required": false; }; }, { "clicked": "clicked"; }, never, never, false, never>; } declare class MenuModule { static ɵfac: i0.ɵɵFactoryDeclaration<MenuModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<MenuModule, [typeof MenuComponent, typeof MenuItemComponent], [typeof i3.CommonModule, typeof i4.OverlayModule, typeof i5.IconsModule, typeof i6.TextPipesModule], [typeof MenuComponent]>; static ɵinj: i0.ɵɵInjectorDeclaration<MenuModule>; } export { MenuComponent, MenuModule }; export type { MenuItem };