UNPKG

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