UNPKG

3.66 kBTypeScriptView Raw
1import { ElementRef } from '@angular/core';
2import { GlobalPositionStrategy } from '@angular/cdk/overlay';
3import { Observable } from 'rxjs';
4import { NbConnectedPosition, NbFlexibleConnectedPositionStrategy, NbOverlayPositionBuilder, NbOverlayRef, NbPositionStrategy } from './mapping';
5import { NbPlatform } from '../platform/platform-service';
6import { NbOverlayContainerAdapter } from '../adapter/overlay-container-adapter';
7import { NbViewportRulerAdapter } from '../adapter/viewport-ruler-adapter';
8import { NbGlobalLogicalPosition } from './position-helper';
9import { NbLayoutDirection } from '../../../services/direction.service';
10import * as i0 from "@angular/core";
11export type NbAdjustmentValues = 'noop' | 'clockwise' | 'counterclockwise' | 'vertical' | 'horizontal';
12export declare enum NbAdjustment {
13 NOOP = "noop",
14 CLOCKWISE = "clockwise",
15 COUNTERCLOCKWISE = "counterclockwise",
16 VERTICAL = "vertical",
17 HORIZONTAL = "horizontal"
18}
19export type NbPositionValues = 'top' | 'bottom' | 'left' | 'right' | 'start' | 'end' | 'top-end' | 'top-start' | 'bottom-end' | 'bottom-start' | 'end-top' | 'end-bottom' | 'start-top' | 'start-bottom';
20export declare enum NbPosition {
21 TOP = "top",
22 BOTTOM = "bottom",
23 LEFT = "left",
24 RIGHT = "right",
25 START = "start",
26 END = "end",
27 TOP_END = "top-end",
28 TOP_START = "top-start",
29 BOTTOM_END = "bottom-end",
30 BOTTOM_START = "bottom-start",
31 END_TOP = "end-top",
32 END_BOTTOM = "end-bottom",
33 START_TOP = "start-top",
34 START_BOTTOM = "start-bottom"
35}
36/**
37 * The main idea of the adjustable connected strategy is to provide predefined set of positions for your overlay.
38 * You have to provide adjustment and appropriate strategy will be chosen in runtime.
39 * */
40export declare class NbAdjustableConnectedPositionStrategy extends NbFlexibleConnectedPositionStrategy implements NbPositionStrategy {
41 protected _position: NbPosition;
42 protected _offset: number;
43 protected _adjustment: NbAdjustment;
44 protected _direction: NbLayoutDirection | undefined;
45 protected appliedPositions: {
46 key: NbPosition;
47 connectedPosition: NbConnectedPosition;
48 }[];
49 readonly positionChange: Observable<NbPosition>;
50 attach(overlayRef: NbOverlayRef): void;
51 direction(direction: NbLayoutDirection): this;
52 apply(): void;
53 position(position: NbPosition): this;
54 adjustment(adjustment: NbAdjustment): this;
55 offset(offset: number): this;
56 protected applyPositions(): void;
57 protected createPositions(): NbPosition[];
58 protected mapToLogicalPosition(position: NbPosition): NbPosition;
59 protected persistChosenPositions(positions: NbPosition[]): void;
60 protected reorderPreferredPositions(positions: NbPosition[]): NbPosition[];
61}
62export declare class NbGlobalPositionStrategy extends GlobalPositionStrategy {
63 position(position: NbGlobalLogicalPosition): this;
64}
65export declare class NbPositionBuilderService {
66 protected document: any;
67 protected viewportRuler: NbViewportRulerAdapter;
68 protected platform: NbPlatform;
69 protected positionBuilder: NbOverlayPositionBuilder;
70 protected overlayContainer: NbOverlayContainerAdapter;
71 constructor(document: any, viewportRuler: NbViewportRulerAdapter, platform: NbPlatform, positionBuilder: NbOverlayPositionBuilder, overlayContainer: NbOverlayContainerAdapter);
72 global(): NbGlobalPositionStrategy;
73 connectedTo(elementRef: ElementRef): NbAdjustableConnectedPositionStrategy;
74 static ɵfac: i0.ɵɵFactoryDeclaration<NbPositionBuilderService, never>;
75 static ɵprov: i0.ɵɵInjectableDeclaration<NbPositionBuilderService>;
76}