index.d.ts 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175
  1. import { BooleanInput } from '@angular/cdk/coercion';
  2. import { CdkScrollable } from '@angular/cdk/scrolling';
  3. import { ComponentFactoryResolver } from '@angular/core';
  4. import { ComponentPortal } from '@angular/cdk/portal';
  5. import { ComponentRef } from '@angular/core';
  6. import { ComponentType } from '@angular/cdk/portal';
  7. import { Direction } from '@angular/cdk/bidi';
  8. import { Directionality } from '@angular/cdk/bidi';
  9. import { ElementRef } from '@angular/core';
  10. import { EmbeddedViewRef } from '@angular/core';
  11. import { EventEmitter } from '@angular/core';
  12. import * as i0 from '@angular/core';
  13. import * as i1 from '@angular/cdk/bidi';
  14. import * as i2 from '@angular/cdk/portal';
  15. import * as i3 from '@angular/cdk/scrolling';
  16. import { InjectionToken } from '@angular/core';
  17. import { Injector } from '@angular/core';
  18. import { Location as Location_2 } from '@angular/common';
  19. import { NgZone } from '@angular/core';
  20. import { Observable } from 'rxjs';
  21. import { OnChanges } from '@angular/core';
  22. import { OnDestroy } from '@angular/core';
  23. import { Platform } from '@angular/cdk/platform';
  24. import { PortalOutlet } from '@angular/cdk/portal';
  25. import { ScrollDispatcher } from '@angular/cdk/scrolling';
  26. import { SimpleChanges } from '@angular/core';
  27. import { Subject } from 'rxjs';
  28. import { TemplatePortal } from '@angular/cdk/portal';
  29. import { TemplateRef } from '@angular/core';
  30. import { ViewContainerRef } from '@angular/core';
  31. import { ViewportRuler } from '@angular/cdk/scrolling';
  32. /**
  33. * Service for dispatching events that land on the body to appropriate overlay ref,
  34. * if any. It maintains a list of attached overlays to determine best suited overlay based
  35. * on event target and order of overlay opens.
  36. */
  37. declare abstract class BaseOverlayDispatcher implements OnDestroy {
  38. /** Currently attached overlays in the order they were attached. */
  39. _attachedOverlays: OverlayRef[];
  40. protected _document: Document;
  41. protected _isAttached: boolean;
  42. constructor(document: any);
  43. ngOnDestroy(): void;
  44. /** Add a new overlay to the list of attached overlay refs. */
  45. add(overlayRef: OverlayRef): void;
  46. /** Remove an overlay from the list of attached overlay refs. */
  47. remove(overlayRef: OverlayRef): void;
  48. /** Detaches the global event listener. */
  49. protected abstract detach(): void;
  50. static ɵfac: i0.ɵɵFactoryDeclaration<BaseOverlayDispatcher, never>;
  51. static ɵprov: i0.ɵɵInjectableDeclaration<BaseOverlayDispatcher>;
  52. }
  53. /**
  54. * Strategy that will prevent the user from scrolling while the overlay is visible.
  55. */
  56. export declare class BlockScrollStrategy implements ScrollStrategy {
  57. private _viewportRuler;
  58. private _previousHTMLStyles;
  59. private _previousScrollPosition;
  60. private _isEnabled;
  61. private _document;
  62. constructor(_viewportRuler: ViewportRuler, document: any);
  63. /** Attaches this scroll strategy to an overlay. */
  64. attach(): void;
  65. /** Blocks page-level scroll while the attached overlay is open. */
  66. enable(): void;
  67. /** Unblocks page-level scroll while the attached overlay is open. */
  68. disable(): void;
  69. private _canBeEnabled;
  70. }
  71. /** Injection token that determines the scroll handling while the connected overlay is open. */
  72. declare const CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
  73. /** @docs-private */
  74. declare const CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER: {
  75. provide: InjectionToken<() => ScrollStrategy>;
  76. deps: (typeof Overlay)[];
  77. useFactory: typeof CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY;
  78. };
  79. /** @docs-private */
  80. declare function CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => RepositionScrollStrategy;
  81. /**
  82. * Directive to facilitate declarative creation of an
  83. * Overlay using a FlexibleConnectedPositionStrategy.
  84. */
  85. export declare class CdkConnectedOverlay implements OnDestroy, OnChanges {
  86. private _overlay;
  87. private _dir;
  88. private _overlayRef;
  89. private _templatePortal;
  90. private _hasBackdrop;
  91. private _lockPosition;
  92. private _growAfterOpen;
  93. private _flexibleDimensions;
  94. private _push;
  95. private _backdropSubscription;
  96. private _attachSubscription;
  97. private _detachSubscription;
  98. private _positionSubscription;
  99. private _offsetX;
  100. private _offsetY;
  101. private _position;
  102. private _scrollStrategyFactory;
  103. /** Origin for the connected overlay. */
  104. origin: CdkOverlayOrigin | FlexibleConnectedPositionStrategyOrigin;
  105. /** Registered connected position pairs. */
  106. positions: ConnectedPosition[];
  107. /**
  108. * This input overrides the positions input if specified. It lets users pass
  109. * in arbitrary positioning strategies.
  110. */
  111. positionStrategy: FlexibleConnectedPositionStrategy;
  112. /** The offset in pixels for the overlay connection point on the x-axis */
  113. get offsetX(): number;
  114. set offsetX(offsetX: number);
  115. /** The offset in pixels for the overlay connection point on the y-axis */
  116. get offsetY(): number;
  117. set offsetY(offsetY: number);
  118. /** The width of the overlay panel. */
  119. width: number | string;
  120. /** The height of the overlay panel. */
  121. height: number | string;
  122. /** The min width of the overlay panel. */
  123. minWidth: number | string;
  124. /** The min height of the overlay panel. */
  125. minHeight: number | string;
  126. /** The custom class to be set on the backdrop element. */
  127. backdropClass: string | string[];
  128. /** The custom class to add to the overlay pane element. */
  129. panelClass: string | string[];
  130. /** Margin between the overlay and the viewport edges. */
  131. viewportMargin: number;
  132. /** Strategy to be used when handling scroll events while the overlay is open. */
  133. scrollStrategy: ScrollStrategy;
  134. /** Whether the overlay is open. */
  135. open: boolean;
  136. /** Whether the overlay can be closed by user interaction. */
  137. disableClose: boolean;
  138. /** CSS selector which to set the transform origin. */
  139. transformOriginSelector: string;
  140. /** Whether or not the overlay should attach a backdrop. */
  141. get hasBackdrop(): boolean;
  142. set hasBackdrop(value: BooleanInput);
  143. /** Whether or not the overlay should be locked when scrolling. */
  144. get lockPosition(): boolean;
  145. set lockPosition(value: BooleanInput);
  146. /** Whether the overlay's width and height can be constrained to fit within the viewport. */
  147. get flexibleDimensions(): boolean;
  148. set flexibleDimensions(value: BooleanInput);
  149. /** Whether the overlay can grow after the initial open when flexible positioning is turned on. */
  150. get growAfterOpen(): boolean;
  151. set growAfterOpen(value: BooleanInput);
  152. /** Whether the overlay can be pushed on-screen if none of the provided positions fit. */
  153. get push(): boolean;
  154. set push(value: BooleanInput);
  155. /** Event emitted when the backdrop is clicked. */
  156. readonly backdropClick: EventEmitter<MouseEvent>;
  157. /** Event emitted when the position has changed. */
  158. readonly positionChange: EventEmitter<ConnectedOverlayPositionChange>;
  159. /** Event emitted when the overlay has been attached. */
  160. readonly attach: EventEmitter<void>;
  161. /** Event emitted when the overlay has been detached. */
  162. readonly detach: EventEmitter<void>;
  163. /** Emits when there are keyboard events that are targeted at the overlay. */
  164. readonly overlayKeydown: EventEmitter<KeyboardEvent>;
  165. /** Emits when there are mouse outside click events that are targeted at the overlay. */
  166. readonly overlayOutsideClick: EventEmitter<MouseEvent>;
  167. constructor(_overlay: Overlay, templateRef: TemplateRef<any>, viewContainerRef: ViewContainerRef, scrollStrategyFactory: any, _dir: Directionality);
  168. /** The associated overlay reference. */
  169. get overlayRef(): OverlayRef;
  170. /** The element's layout direction. */
  171. get dir(): Direction;
  172. ngOnDestroy(): void;
  173. ngOnChanges(changes: SimpleChanges): void;
  174. /** Creates an overlay */
  175. private _createOverlay;
  176. /** Builds the overlay config based on the directive's inputs */
  177. private _buildConfig;
  178. /** Updates the state of a position strategy, based on the values of the directive inputs. */
  179. private _updatePositionStrategy;
  180. /** Returns the position strategy of the overlay to be set on the overlay config */
  181. private _createPositionStrategy;
  182. private _getFlexibleConnectedPositionStrategyOrigin;
  183. /** Attaches the overlay and subscribes to backdrop clicks if backdrop exists */
  184. private _attachOverlay;
  185. /** Detaches the overlay and unsubscribes to backdrop clicks if backdrop exists */
  186. private _detachOverlay;
  187. static ɵfac: i0.ɵɵFactoryDeclaration<CdkConnectedOverlay, [null, null, null, null, { optional: true; }]>;
  188. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkConnectedOverlay, "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", ["cdkConnectedOverlay"], { "origin": { "alias": "cdkConnectedOverlayOrigin"; "required": false; }; "positions": { "alias": "cdkConnectedOverlayPositions"; "required": false; }; "positionStrategy": { "alias": "cdkConnectedOverlayPositionStrategy"; "required": false; }; "offsetX": { "alias": "cdkConnectedOverlayOffsetX"; "required": false; }; "offsetY": { "alias": "cdkConnectedOverlayOffsetY"; "required": false; }; "width": { "alias": "cdkConnectedOverlayWidth"; "required": false; }; "height": { "alias": "cdkConnectedOverlayHeight"; "required": false; }; "minWidth": { "alias": "cdkConnectedOverlayMinWidth"; "required": false; }; "minHeight": { "alias": "cdkConnectedOverlayMinHeight"; "required": false; }; "backdropClass": { "alias": "cdkConnectedOverlayBackdropClass"; "required": false; }; "panelClass": { "alias": "cdkConnectedOverlayPanelClass"; "required": false; }; "viewportMargin": { "alias": "cdkConnectedOverlayViewportMargin"; "required": false; }; "scrollStrategy": { "alias": "cdkConnectedOverlayScrollStrategy"; "required": false; }; "open": { "alias": "cdkConnectedOverlayOpen"; "required": false; }; "disableClose": { "alias": "cdkConnectedOverlayDisableClose"; "required": false; }; "transformOriginSelector": { "alias": "cdkConnectedOverlayTransformOriginOn"; "required": false; }; "hasBackdrop": { "alias": "cdkConnectedOverlayHasBackdrop"; "required": false; }; "lockPosition": { "alias": "cdkConnectedOverlayLockPosition"; "required": false; }; "flexibleDimensions": { "alias": "cdkConnectedOverlayFlexibleDimensions"; "required": false; }; "growAfterOpen": { "alias": "cdkConnectedOverlayGrowAfterOpen"; "required": false; }; "push": { "alias": "cdkConnectedOverlayPush"; "required": false; }; }, { "backdropClick": "backdropClick"; "positionChange": "positionChange"; "attach": "attach"; "detach": "detach"; "overlayKeydown": "overlayKeydown"; "overlayOutsideClick": "overlayOutsideClick"; }, never, never, true, never>;
  189. }
  190. /**
  191. * Directive applied to an element to make it usable as an origin for an Overlay using a
  192. * ConnectedPositionStrategy.
  193. */
  194. export declare class CdkOverlayOrigin {
  195. /** Reference to the element on which the directive is applied. */
  196. elementRef: ElementRef;
  197. constructor(
  198. /** Reference to the element on which the directive is applied. */
  199. elementRef: ElementRef);
  200. static ɵfac: i0.ɵɵFactoryDeclaration<CdkOverlayOrigin, never>;
  201. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkOverlayOrigin, "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", ["cdkOverlayOrigin"], {}, {}, never, never, true, never>;
  202. }
  203. export { CdkScrollable }
  204. /**
  205. * Strategy that will close the overlay as soon as the user starts scrolling.
  206. */
  207. export declare class CloseScrollStrategy implements ScrollStrategy {
  208. private _scrollDispatcher;
  209. private _ngZone;
  210. private _viewportRuler;
  211. private _config?;
  212. private _scrollSubscription;
  213. private _overlayRef;
  214. private _initialScrollPosition;
  215. constructor(_scrollDispatcher: ScrollDispatcher, _ngZone: NgZone, _viewportRuler: ViewportRuler, _config?: CloseScrollStrategyConfig | undefined);
  216. /** Attaches this scroll strategy to an overlay. */
  217. attach(overlayRef: OverlayRef): void;
  218. /** Enables the closing of the attached overlay on scroll. */
  219. enable(): void;
  220. /** Disables the closing the attached overlay on scroll. */
  221. disable(): void;
  222. detach(): void;
  223. /** Detaches the overlay ref and disables the scroll strategy. */
  224. private _detach;
  225. }
  226. /**
  227. * Config options for the CloseScrollStrategy.
  228. */
  229. declare interface CloseScrollStrategyConfig {
  230. /** Amount of pixels the user has to scroll before the overlay is closed. */
  231. threshold?: number;
  232. }
  233. export { ComponentType }
  234. /** The change event emitted by the strategy when a fallback position is used. */
  235. export declare class ConnectedOverlayPositionChange {
  236. /** The position used as a result of this change. */
  237. connectionPair: ConnectionPositionPair;
  238. /** @docs-private */
  239. scrollableViewProperties: ScrollingVisibility;
  240. constructor(
  241. /** The position used as a result of this change. */
  242. connectionPair: ConnectionPositionPair,
  243. /** @docs-private */
  244. scrollableViewProperties: ScrollingVisibility);
  245. }
  246. /** A connected position as specified by the user. */
  247. export declare interface ConnectedPosition {
  248. originX: 'start' | 'center' | 'end';
  249. originY: 'top' | 'center' | 'bottom';
  250. overlayX: 'start' | 'center' | 'end';
  251. overlayY: 'top' | 'center' | 'bottom';
  252. weight?: number;
  253. offsetX?: number;
  254. offsetY?: number;
  255. panelClass?: string | string[];
  256. }
  257. /** The points of the origin element and the overlay element to connect. */
  258. export declare class ConnectionPositionPair {
  259. /** Offset along the X axis. */
  260. offsetX?: number | undefined;
  261. /** Offset along the Y axis. */
  262. offsetY?: number | undefined;
  263. /** Class(es) to be applied to the panel while this position is active. */
  264. panelClass?: string | string[] | undefined;
  265. /** X-axis attachment point for connected overlay origin. Can be 'start', 'end', or 'center'. */
  266. originX: HorizontalConnectionPos;
  267. /** Y-axis attachment point for connected overlay origin. Can be 'top', 'bottom', or 'center'. */
  268. originY: VerticalConnectionPos;
  269. /** X-axis attachment point for connected overlay. Can be 'start', 'end', or 'center'. */
  270. overlayX: HorizontalConnectionPos;
  271. /** Y-axis attachment point for connected overlay. Can be 'top', 'bottom', or 'center'. */
  272. overlayY: VerticalConnectionPos;
  273. constructor(origin: OriginConnectionPosition, overlay: OverlayConnectionPosition,
  274. /** Offset along the X axis. */
  275. offsetX?: number | undefined,
  276. /** Offset along the Y axis. */
  277. offsetY?: number | undefined,
  278. /** Class(es) to be applied to the panel while this position is active. */
  279. panelClass?: string | string[] | undefined);
  280. }
  281. /**
  282. * A strategy for positioning overlays. Using this strategy, an overlay is given an
  283. * implicit position relative some origin element. The relative position is defined in terms of
  284. * a point on the origin element that is connected to a point on the overlay element. For example,
  285. * a basic dropdown is connecting the bottom-left corner of the origin to the top-left corner
  286. * of the overlay.
  287. */
  288. export declare class FlexibleConnectedPositionStrategy implements PositionStrategy {
  289. private _viewportRuler;
  290. private _document;
  291. private _platform;
  292. private _overlayContainer;
  293. /** The overlay to which this strategy is attached. */
  294. private _overlayRef;
  295. /** Whether we're performing the very first positioning of the overlay. */
  296. private _isInitialRender;
  297. /** Last size used for the bounding box. Used to avoid resizing the overlay after open. */
  298. private _lastBoundingBoxSize;
  299. /** Whether the overlay was pushed in a previous positioning. */
  300. private _isPushed;
  301. /** Whether the overlay can be pushed on-screen on the initial open. */
  302. private _canPush;
  303. /** Whether the overlay can grow via flexible width/height after the initial open. */
  304. private _growAfterOpen;
  305. /** Whether the overlay's width and height can be constrained to fit within the viewport. */
  306. private _hasFlexibleDimensions;
  307. /** Whether the overlay position is locked. */
  308. private _positionLocked;
  309. /** Cached origin dimensions */
  310. private _originRect;
  311. /** Cached overlay dimensions */
  312. private _overlayRect;
  313. /** Cached viewport dimensions */
  314. private _viewportRect;
  315. /** Cached container dimensions */
  316. private _containerRect;
  317. /** Amount of space that must be maintained between the overlay and the edge of the viewport. */
  318. private _viewportMargin;
  319. /** The Scrollable containers used to check scrollable view properties on position change. */
  320. private _scrollables;
  321. /** Ordered list of preferred positions, from most to least desirable. */
  322. _preferredPositions: ConnectionPositionPair[];
  323. /** The origin element against which the overlay will be positioned. */
  324. _origin: FlexibleConnectedPositionStrategyOrigin;
  325. /** The overlay pane element. */
  326. private _pane;
  327. /** Whether the strategy has been disposed of already. */
  328. private _isDisposed;
  329. /**
  330. * Parent element for the overlay panel used to constrain the overlay panel's size to fit
  331. * within the viewport.
  332. */
  333. private _boundingBox;
  334. /** The last position to have been calculated as the best fit position. */
  335. private _lastPosition;
  336. /** Subject that emits whenever the position changes. */
  337. private readonly _positionChanges;
  338. /** Subscription to viewport size changes. */
  339. private _resizeSubscription;
  340. /** Default offset for the overlay along the x axis. */
  341. private _offsetX;
  342. /** Default offset for the overlay along the y axis. */
  343. private _offsetY;
  344. /** Selector to be used when finding the elements on which to set the transform origin. */
  345. private _transformOriginSelector;
  346. /** Keeps track of the CSS classes that the position strategy has applied on the overlay panel. */
  347. private _appliedPanelClasses;
  348. /** Amount by which the overlay was pushed in each axis during the last time it was positioned. */
  349. private _previousPushAmount;
  350. /** Observable sequence of position changes. */
  351. positionChanges: Observable<ConnectedOverlayPositionChange>;
  352. /** Ordered list of preferred positions, from most to least desirable. */
  353. get positions(): ConnectionPositionPair[];
  354. constructor(connectedTo: FlexibleConnectedPositionStrategyOrigin, _viewportRuler: ViewportRuler, _document: Document, _platform: Platform, _overlayContainer: OverlayContainer);
  355. /** Attaches this position strategy to an overlay. */
  356. attach(overlayRef: OverlayRef): void;
  357. /**
  358. * Updates the position of the overlay element, using whichever preferred position relative
  359. * to the origin best fits on-screen.
  360. *
  361. * The selection of a position goes as follows:
  362. * - If any positions fit completely within the viewport as-is,
  363. * choose the first position that does so.
  364. * - If flexible dimensions are enabled and at least one satisfies the given minimum width/height,
  365. * choose the position with the greatest available size modified by the positions' weight.
  366. * - If pushing is enabled, take the position that went off-screen the least and push it
  367. * on-screen.
  368. * - If none of the previous criteria were met, use the position that goes off-screen the least.
  369. * @docs-private
  370. */
  371. apply(): void;
  372. detach(): void;
  373. /** Cleanup after the element gets destroyed. */
  374. dispose(): void;
  375. /**
  376. * This re-aligns the overlay element with the trigger in its last calculated position,
  377. * even if a position higher in the "preferred positions" list would now fit. This
  378. * allows one to re-align the panel without changing the orientation of the panel.
  379. */
  380. reapplyLastPosition(): void;
  381. /**
  382. * Sets the list of Scrollable containers that host the origin element so that
  383. * on reposition we can evaluate if it or the overlay has been clipped or outside view. Every
  384. * Scrollable must be an ancestor element of the strategy's origin element.
  385. */
  386. withScrollableContainers(scrollables: CdkScrollable[]): this;
  387. /**
  388. * Adds new preferred positions.
  389. * @param positions List of positions options for this overlay.
  390. */
  391. withPositions(positions: ConnectedPosition[]): this;
  392. /**
  393. * Sets a minimum distance the overlay may be positioned to the edge of the viewport.
  394. * @param margin Required margin between the overlay and the viewport edge in pixels.
  395. */
  396. withViewportMargin(margin: number): this;
  397. /** Sets whether the overlay's width and height can be constrained to fit within the viewport. */
  398. withFlexibleDimensions(flexibleDimensions?: boolean): this;
  399. /** Sets whether the overlay can grow after the initial open via flexible width/height. */
  400. withGrowAfterOpen(growAfterOpen?: boolean): this;
  401. /** Sets whether the overlay can be pushed on-screen if none of the provided positions fit. */
  402. withPush(canPush?: boolean): this;
  403. /**
  404. * Sets whether the overlay's position should be locked in after it is positioned
  405. * initially. When an overlay is locked in, it won't attempt to reposition itself
  406. * when the position is re-applied (e.g. when the user scrolls away).
  407. * @param isLocked Whether the overlay should locked in.
  408. */
  409. withLockedPosition(isLocked?: boolean): this;
  410. /**
  411. * Sets the origin, relative to which to position the overlay.
  412. * Using an element origin is useful for building components that need to be positioned
  413. * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
  414. * used for cases like contextual menus which open relative to the user's pointer.
  415. * @param origin Reference to the new origin.
  416. */
  417. setOrigin(origin: FlexibleConnectedPositionStrategyOrigin): this;
  418. /**
  419. * Sets the default offset for the overlay's connection point on the x-axis.
  420. * @param offset New offset in the X axis.
  421. */
  422. withDefaultOffsetX(offset: number): this;
  423. /**
  424. * Sets the default offset for the overlay's connection point on the y-axis.
  425. * @param offset New offset in the Y axis.
  426. */
  427. withDefaultOffsetY(offset: number): this;
  428. /**
  429. * Configures that the position strategy should set a `transform-origin` on some elements
  430. * inside the overlay, depending on the current position that is being applied. This is
  431. * useful for the cases where the origin of an animation can change depending on the
  432. * alignment of the overlay.
  433. * @param selector CSS selector that will be used to find the target
  434. * elements onto which to set the transform origin.
  435. */
  436. withTransformOriginOn(selector: string): this;
  437. /**
  438. * Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
  439. */
  440. private _getOriginPoint;
  441. /**
  442. * Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
  443. * origin point to which the overlay should be connected.
  444. */
  445. private _getOverlayPoint;
  446. /** Gets how well an overlay at the given point will fit within the viewport. */
  447. private _getOverlayFit;
  448. /**
  449. * Whether the overlay can fit within the viewport when it may resize either its width or height.
  450. * @param fit How well the overlay fits in the viewport at some position.
  451. * @param point The (x, y) coordinates of the overlay at some position.
  452. * @param viewport The geometry of the viewport.
  453. */
  454. private _canFitWithFlexibleDimensions;
  455. /**
  456. * Gets the point at which the overlay can be "pushed" on-screen. If the overlay is larger than
  457. * the viewport, the top-left corner will be pushed on-screen (with overflow occurring on the
  458. * right and bottom).
  459. *
  460. * @param start Starting point from which the overlay is pushed.
  461. * @param rawOverlayRect Dimensions of the overlay.
  462. * @param scrollPosition Current viewport scroll position.
  463. * @returns The point at which to position the overlay after pushing. This is effectively a new
  464. * originPoint.
  465. */
  466. private _pushOverlayOnScreen;
  467. /**
  468. * Applies a computed position to the overlay and emits a position change.
  469. * @param position The position preference
  470. * @param originPoint The point on the origin element where the overlay is connected.
  471. */
  472. private _applyPosition;
  473. /** Sets the transform origin based on the configured selector and the passed-in position. */
  474. private _setTransformOrigin;
  475. /**
  476. * Gets the position and size of the overlay's sizing container.
  477. *
  478. * This method does no measuring and applies no styles so that we can cheaply compute the
  479. * bounds for all positions and choose the best fit based on these results.
  480. */
  481. private _calculateBoundingBoxRect;
  482. /**
  483. * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
  484. * origin's connection point and stretches to the bounds of the viewport.
  485. *
  486. * @param origin The point on the origin element where the overlay is connected.
  487. * @param position The position preference
  488. */
  489. private _setBoundingBoxStyles;
  490. /** Resets the styles for the bounding box so that a new positioning can be computed. */
  491. private _resetBoundingBoxStyles;
  492. /** Resets the styles for the overlay pane so that a new positioning can be computed. */
  493. private _resetOverlayElementStyles;
  494. /** Sets positioning styles to the overlay element. */
  495. private _setOverlayElementStyles;
  496. /** Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing. */
  497. private _getExactOverlayY;
  498. /** Gets the exact left/right for the overlay when not using flexible sizing or when pushing. */
  499. private _getExactOverlayX;
  500. /**
  501. * Gets the view properties of the trigger and overlay, including whether they are clipped
  502. * or completely outside the view of any of the strategy's scrollables.
  503. */
  504. private _getScrollVisibility;
  505. /** Subtracts the amount that an element is overflowing on an axis from its length. */
  506. private _subtractOverflows;
  507. /** Narrows the given viewport rect by the current _viewportMargin. */
  508. private _getNarrowedViewportRect;
  509. /** Whether the we're dealing with an RTL context */
  510. private _isRtl;
  511. /** Determines whether the overlay uses exact or flexible positioning. */
  512. private _hasExactPosition;
  513. /** Retrieves the offset of a position along the x or y axis. */
  514. private _getOffset;
  515. /** Validates that the current position match the expected values. */
  516. private _validatePositions;
  517. /** Adds a single CSS class or an array of classes on the overlay panel. */
  518. private _addPanelClasses;
  519. /** Clears the classes that the position strategy has applied from the overlay panel. */
  520. private _clearPanelClasses;
  521. /** Returns the ClientRect of the current origin. */
  522. private _getOriginRect;
  523. }
  524. /** Possible values that can be set as the origin of a FlexibleConnectedPositionStrategy. */
  525. export declare type FlexibleConnectedPositionStrategyOrigin = ElementRef | Element | (Point & {
  526. width?: number;
  527. height?: number;
  528. });
  529. /**
  530. * Alternative to OverlayContainer that supports correct displaying of overlay elements in
  531. * Fullscreen mode
  532. * https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen
  533. *
  534. * Should be provided in the root component.
  535. */
  536. export declare class FullscreenOverlayContainer extends OverlayContainer implements OnDestroy {
  537. private _fullScreenEventName;
  538. private _fullScreenListener;
  539. constructor(_document: any, platform: Platform);
  540. ngOnDestroy(): void;
  541. protected _createContainer(): void;
  542. private _adjustParentForFullscreenChange;
  543. private _addFullscreenChangeListener;
  544. private _getEventName;
  545. /**
  546. * When the page is put into fullscreen mode, a specific element is specified.
  547. * Only that element and its children are visible when in fullscreen mode.
  548. */
  549. getFullscreenElement(): Element;
  550. static ɵfac: i0.ɵɵFactoryDeclaration<FullscreenOverlayContainer, never>;
  551. static ɵprov: i0.ɵɵInjectableDeclaration<FullscreenOverlayContainer>;
  552. }
  553. /**
  554. * A strategy for positioning overlays. Using this strategy, an overlay is given an
  555. * explicit position relative to the browser's viewport. We use flexbox, instead of
  556. * transforms, in order to avoid issues with subpixel rendering which can cause the
  557. * element to become blurry.
  558. */
  559. export declare class GlobalPositionStrategy implements PositionStrategy {
  560. /** The overlay to which this strategy is attached. */
  561. private _overlayRef;
  562. private _cssPosition;
  563. private _topOffset;
  564. private _bottomOffset;
  565. private _alignItems;
  566. private _xPosition;
  567. private _xOffset;
  568. private _width;
  569. private _height;
  570. private _isDisposed;
  571. attach(overlayRef: OverlayRef): void;
  572. /**
  573. * Sets the top position of the overlay. Clears any previously set vertical position.
  574. * @param value New top offset.
  575. */
  576. top(value?: string): this;
  577. /**
  578. * Sets the left position of the overlay. Clears any previously set horizontal position.
  579. * @param value New left offset.
  580. */
  581. left(value?: string): this;
  582. /**
  583. * Sets the bottom position of the overlay. Clears any previously set vertical position.
  584. * @param value New bottom offset.
  585. */
  586. bottom(value?: string): this;
  587. /**
  588. * Sets the right position of the overlay. Clears any previously set horizontal position.
  589. * @param value New right offset.
  590. */
  591. right(value?: string): this;
  592. /**
  593. * Sets the overlay to the start of the viewport, depending on the overlay direction.
  594. * This will be to the left in LTR layouts and to the right in RTL.
  595. * @param offset Offset from the edge of the screen.
  596. */
  597. start(value?: string): this;
  598. /**
  599. * Sets the overlay to the end of the viewport, depending on the overlay direction.
  600. * This will be to the right in LTR layouts and to the left in RTL.
  601. * @param offset Offset from the edge of the screen.
  602. */
  603. end(value?: string): this;
  604. /**
  605. * Sets the overlay width and clears any previously set width.
  606. * @param value New width for the overlay
  607. * @deprecated Pass the `width` through the `OverlayConfig`.
  608. * @breaking-change 8.0.0
  609. */
  610. width(value?: string): this;
  611. /**
  612. * Sets the overlay height and clears any previously set height.
  613. * @param value New height for the overlay
  614. * @deprecated Pass the `height` through the `OverlayConfig`.
  615. * @breaking-change 8.0.0
  616. */
  617. height(value?: string): this;
  618. /**
  619. * Centers the overlay horizontally with an optional offset.
  620. * Clears any previously set horizontal position.
  621. *
  622. * @param offset Overlay offset from the horizontal center.
  623. */
  624. centerHorizontally(offset?: string): this;
  625. /**
  626. * Centers the overlay vertically with an optional offset.
  627. * Clears any previously set vertical position.
  628. *
  629. * @param offset Overlay offset from the vertical center.
  630. */
  631. centerVertically(offset?: string): this;
  632. /**
  633. * Apply the position to the element.
  634. * @docs-private
  635. */
  636. apply(): void;
  637. /**
  638. * Cleans up the DOM changes from the position strategy.
  639. * @docs-private
  640. */
  641. dispose(): void;
  642. }
  643. /** Horizontal dimension of a connection point on the perimeter of the origin or overlay element. */
  644. export declare type HorizontalConnectionPos = 'start' | 'center' | 'end';
  645. declare namespace i4 {
  646. export {
  647. CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY,
  648. CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY,
  649. CdkOverlayOrigin,
  650. CdkConnectedOverlay,
  651. CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER
  652. }
  653. }
  654. /** An object where all of its properties cannot be written. */
  655. declare type ImmutableObject<T> = {
  656. readonly [P in keyof T]: T[P];
  657. };
  658. /** Scroll strategy that doesn't do anything. */
  659. export declare class NoopScrollStrategy implements ScrollStrategy {
  660. /** Does nothing, as this scroll strategy is a no-op. */
  661. enable(): void;
  662. /** Does nothing, as this scroll strategy is a no-op. */
  663. disable(): void;
  664. /** Does nothing, as this scroll strategy is a no-op. */
  665. attach(): void;
  666. }
  667. /** A connection point on the origin element. */
  668. export declare interface OriginConnectionPosition {
  669. originX: HorizontalConnectionPos;
  670. originY: VerticalConnectionPos;
  671. }
  672. /**
  673. * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
  674. * used as a low-level building block for other components. Dialogs, tooltips, menus,
  675. * selects, etc. can all be built using overlays. The service should primarily be used by authors
  676. * of re-usable components rather than developers building end-user applications.
  677. *
  678. * An overlay *is* a PortalOutlet, so any kind of Portal can be loaded into one.
  679. */
  680. export declare class Overlay {
  681. /** Scrolling strategies that can be used when creating an overlay. */
  682. scrollStrategies: ScrollStrategyOptions;
  683. private _overlayContainer;
  684. private _componentFactoryResolver;
  685. private _positionBuilder;
  686. private _keyboardDispatcher;
  687. private _injector;
  688. private _ngZone;
  689. private _document;
  690. private _directionality;
  691. private _location;
  692. private _outsideClickDispatcher;
  693. private _animationsModuleType?;
  694. private _appRef;
  695. constructor(
  696. /** Scrolling strategies that can be used when creating an overlay. */
  697. scrollStrategies: ScrollStrategyOptions, _overlayContainer: OverlayContainer, _componentFactoryResolver: ComponentFactoryResolver, _positionBuilder: OverlayPositionBuilder, _keyboardDispatcher: OverlayKeyboardDispatcher, _injector: Injector, _ngZone: NgZone, _document: any, _directionality: Directionality, _location: Location_2, _outsideClickDispatcher: OverlayOutsideClickDispatcher, _animationsModuleType?: string | undefined);
  698. /**
  699. * Creates an overlay.
  700. * @param config Configuration applied to the overlay.
  701. * @returns Reference to the created overlay.
  702. */
  703. create(config?: OverlayConfig): OverlayRef;
  704. /**
  705. * Gets a position builder that can be used, via fluent API,
  706. * to construct and configure a position strategy.
  707. * @returns An overlay position builder.
  708. */
  709. position(): OverlayPositionBuilder;
  710. /**
  711. * Creates the DOM element for an overlay and appends it to the overlay container.
  712. * @returns Newly-created pane element
  713. */
  714. private _createPaneElement;
  715. /**
  716. * Creates the host element that wraps around an overlay
  717. * and can be used for advanced positioning.
  718. * @returns Newly-create host element.
  719. */
  720. private _createHostElement;
  721. /**
  722. * Create a DomPortalOutlet into which the overlay content can be loaded.
  723. * @param pane The DOM element to turn into a portal outlet.
  724. * @returns A portal outlet for the given DOM element.
  725. */
  726. private _createPortalOutlet;
  727. static ɵfac: i0.ɵɵFactoryDeclaration<Overlay, [null, null, null, null, null, null, null, null, null, null, null, { optional: true; }]>;
  728. static ɵprov: i0.ɵɵInjectableDeclaration<Overlay>;
  729. }
  730. /** Initial configuration used when creating an overlay. */
  731. export declare class OverlayConfig {
  732. /** Strategy with which to position the overlay. */
  733. positionStrategy?: PositionStrategy;
  734. /** Strategy to be used when handling scroll events while the overlay is open. */
  735. scrollStrategy?: ScrollStrategy;
  736. /** Custom class to add to the overlay pane. */
  737. panelClass?: string | string[];
  738. /** Whether the overlay has a backdrop. */
  739. hasBackdrop?: boolean;
  740. /** Custom class to add to the backdrop */
  741. backdropClass?: string | string[];
  742. /** The width of the overlay panel. If a number is provided, pixel units are assumed. */
  743. width?: number | string;
  744. /** The height of the overlay panel. If a number is provided, pixel units are assumed. */
  745. height?: number | string;
  746. /** The min-width of the overlay panel. If a number is provided, pixel units are assumed. */
  747. minWidth?: number | string;
  748. /** The min-height of the overlay panel. If a number is provided, pixel units are assumed. */
  749. minHeight?: number | string;
  750. /** The max-width of the overlay panel. If a number is provided, pixel units are assumed. */
  751. maxWidth?: number | string;
  752. /** The max-height of the overlay panel. If a number is provided, pixel units are assumed. */
  753. maxHeight?: number | string;
  754. /**
  755. * Direction of the text in the overlay panel. If a `Directionality` instance
  756. * is passed in, the overlay will handle changes to its value automatically.
  757. */
  758. direction?: Direction | Directionality;
  759. /**
  760. * Whether the overlay should be disposed of when the user goes backwards/forwards in history.
  761. * Note that this usually doesn't include clicking on links (unless the user is using
  762. * the `HashLocationStrategy`).
  763. */
  764. disposeOnNavigation?: boolean;
  765. constructor(config?: OverlayConfig);
  766. }
  767. /** A connection point on the overlay element. */
  768. export declare interface OverlayConnectionPosition {
  769. overlayX: HorizontalConnectionPos;
  770. overlayY: VerticalConnectionPos;
  771. }
  772. /** Container inside which all overlays will render. */
  773. export declare class OverlayContainer implements OnDestroy {
  774. protected _platform: Platform;
  775. protected _containerElement: HTMLElement;
  776. protected _document: Document;
  777. constructor(document: any, _platform: Platform);
  778. ngOnDestroy(): void;
  779. /**
  780. * This method returns the overlay container element. It will lazily
  781. * create the element the first time it is called to facilitate using
  782. * the container in non-browser environments.
  783. * @returns the container element
  784. */
  785. getContainerElement(): HTMLElement;
  786. /**
  787. * Create the overlay container element, which is simply a div
  788. * with the 'cdk-overlay-container' class on the document body.
  789. */
  790. protected _createContainer(): void;
  791. static ɵfac: i0.ɵɵFactoryDeclaration<OverlayContainer, never>;
  792. static ɵprov: i0.ɵɵInjectableDeclaration<OverlayContainer>;
  793. }
  794. /**
  795. * Service for dispatching keyboard events that land on the body to appropriate overlay ref,
  796. * if any. It maintains a list of attached overlays to determine best suited overlay based
  797. * on event target and order of overlay opens.
  798. */
  799. export declare class OverlayKeyboardDispatcher extends BaseOverlayDispatcher {
  800. /** @breaking-change 14.0.0 _ngZone will be required. */
  801. private _ngZone?;
  802. constructor(document: any,
  803. /** @breaking-change 14.0.0 _ngZone will be required. */
  804. _ngZone?: NgZone | undefined);
  805. /** Add a new overlay to the list of attached overlay refs. */
  806. add(overlayRef: OverlayRef): void;
  807. /** Detaches the global keyboard event listener. */
  808. protected detach(): void;
  809. /** Keyboard event listener that will be attached to the body. */
  810. private _keydownListener;
  811. static ɵfac: i0.ɵɵFactoryDeclaration<OverlayKeyboardDispatcher, [null, { optional: true; }]>;
  812. static ɵprov: i0.ɵɵInjectableDeclaration<OverlayKeyboardDispatcher>;
  813. }
  814. export declare class OverlayModule {
  815. static ɵfac: i0.ɵɵFactoryDeclaration<OverlayModule, never>;
  816. static ɵmod: i0.ɵɵNgModuleDeclaration<OverlayModule, never, [typeof i1.BidiModule, typeof i2.PortalModule, typeof i3.ScrollingModule, typeof i4.CdkConnectedOverlay, typeof i4.CdkOverlayOrigin], [typeof i4.CdkConnectedOverlay, typeof i4.CdkOverlayOrigin, typeof i3.ScrollingModule]>;
  817. static ɵinj: i0.ɵɵInjectorDeclaration<OverlayModule>;
  818. }
  819. /**
  820. * Service for dispatching mouse click events that land on the body to appropriate overlay ref,
  821. * if any. It maintains a list of attached overlays to determine best suited overlay based
  822. * on event target and order of overlay opens.
  823. */
  824. export declare class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
  825. private _platform;
  826. /** @breaking-change 14.0.0 _ngZone will be required. */
  827. private _ngZone?;
  828. private _cursorOriginalValue;
  829. private _cursorStyleIsSet;
  830. private _pointerDownEventTarget;
  831. constructor(document: any, _platform: Platform,
  832. /** @breaking-change 14.0.0 _ngZone will be required. */
  833. _ngZone?: NgZone | undefined);
  834. /** Add a new overlay to the list of attached overlay refs. */
  835. add(overlayRef: OverlayRef): void;
  836. /** Detaches the global keyboard event listener. */
  837. protected detach(): void;
  838. private _addEventListeners;
  839. /** Store pointerdown event target to track origin of click. */
  840. private _pointerDownListener;
  841. /** Click event listener that will be attached to the body propagate phase. */
  842. private _clickListener;
  843. static ɵfac: i0.ɵɵFactoryDeclaration<OverlayOutsideClickDispatcher, [null, null, { optional: true; }]>;
  844. static ɵprov: i0.ɵɵInjectableDeclaration<OverlayOutsideClickDispatcher>;
  845. }
  846. /** Builder for overlay position strategy. */
  847. export declare class OverlayPositionBuilder {
  848. private _viewportRuler;
  849. private _document;
  850. private _platform;
  851. private _overlayContainer;
  852. constructor(_viewportRuler: ViewportRuler, _document: any, _platform: Platform, _overlayContainer: OverlayContainer);
  853. /**
  854. * Creates a global position strategy.
  855. */
  856. global(): GlobalPositionStrategy;
  857. /**
  858. * Creates a flexible position strategy.
  859. * @param origin Origin relative to which to position the overlay.
  860. */
  861. flexibleConnectedTo(origin: FlexibleConnectedPositionStrategyOrigin): FlexibleConnectedPositionStrategy;
  862. static ɵfac: i0.ɵɵFactoryDeclaration<OverlayPositionBuilder, never>;
  863. static ɵprov: i0.ɵɵInjectableDeclaration<OverlayPositionBuilder>;
  864. }
  865. /**
  866. * Reference to an overlay that has been created with the Overlay service.
  867. * Used to manipulate or dispose of said overlay.
  868. */
  869. export declare class OverlayRef implements PortalOutlet {
  870. private _portalOutlet;
  871. private _host;
  872. private _pane;
  873. private _config;
  874. private _ngZone;
  875. private _keyboardDispatcher;
  876. private _document;
  877. private _location;
  878. private _outsideClickDispatcher;
  879. private _animationsDisabled;
  880. private _backdropElement;
  881. private _backdropTimeout;
  882. private readonly _backdropClick;
  883. private readonly _attachments;
  884. private readonly _detachments;
  885. private _positionStrategy;
  886. private _scrollStrategy;
  887. private _locationChanges;
  888. private _backdropClickHandler;
  889. private _backdropTransitionendHandler;
  890. /**
  891. * Reference to the parent of the `_host` at the time it was detached. Used to restore
  892. * the `_host` to its original position in the DOM when it gets re-attached.
  893. */
  894. private _previousHostParent;
  895. /** Stream of keydown events dispatched to this overlay. */
  896. readonly _keydownEvents: Subject<KeyboardEvent>;
  897. /** Stream of mouse outside events dispatched to this overlay. */
  898. readonly _outsidePointerEvents: Subject<MouseEvent>;
  899. constructor(_portalOutlet: PortalOutlet, _host: HTMLElement, _pane: HTMLElement, _config: ImmutableObject<OverlayConfig>, _ngZone: NgZone, _keyboardDispatcher: OverlayKeyboardDispatcher, _document: Document, _location: Location_2, _outsideClickDispatcher: OverlayOutsideClickDispatcher, _animationsDisabled?: boolean);
  900. /** The overlay's HTML element */
  901. get overlayElement(): HTMLElement;
  902. /** The overlay's backdrop HTML element. */
  903. get backdropElement(): HTMLElement | null;
  904. /**
  905. * Wrapper around the panel element. Can be used for advanced
  906. * positioning where a wrapper with specific styling is
  907. * required around the overlay pane.
  908. */
  909. get hostElement(): HTMLElement;
  910. attach<T>(portal: ComponentPortal<T>): ComponentRef<T>;
  911. attach<T>(portal: TemplatePortal<T>): EmbeddedViewRef<T>;
  912. attach(portal: any): any;
  913. /**
  914. * Detaches an overlay from a portal.
  915. * @returns The portal detachment result.
  916. */
  917. detach(): any;
  918. /** Cleans up the overlay from the DOM. */
  919. dispose(): void;
  920. /** Whether the overlay has attached content. */
  921. hasAttached(): boolean;
  922. /** Gets an observable that emits when the backdrop has been clicked. */
  923. backdropClick(): Observable<MouseEvent>;
  924. /** Gets an observable that emits when the overlay has been attached. */
  925. attachments(): Observable<void>;
  926. /** Gets an observable that emits when the overlay has been detached. */
  927. detachments(): Observable<void>;
  928. /** Gets an observable of keydown events targeted to this overlay. */
  929. keydownEvents(): Observable<KeyboardEvent>;
  930. /** Gets an observable of pointer events targeted outside this overlay. */
  931. outsidePointerEvents(): Observable<MouseEvent>;
  932. /** Gets the current overlay configuration, which is immutable. */
  933. getConfig(): OverlayConfig;
  934. /** Updates the position of the overlay based on the position strategy. */
  935. updatePosition(): void;
  936. /** Switches to a new position strategy and updates the overlay position. */
  937. updatePositionStrategy(strategy: PositionStrategy): void;
  938. /** Update the size properties of the overlay. */
  939. updateSize(sizeConfig: OverlaySizeConfig): void;
  940. /** Sets the LTR/RTL direction for the overlay. */
  941. setDirection(dir: Direction | Directionality): void;
  942. /** Add a CSS class or an array of classes to the overlay pane. */
  943. addPanelClass(classes: string | string[]): void;
  944. /** Remove a CSS class or an array of classes from the overlay pane. */
  945. removePanelClass(classes: string | string[]): void;
  946. /**
  947. * Returns the layout direction of the overlay panel.
  948. */
  949. getDirection(): Direction;
  950. /** Switches to a new scroll strategy. */
  951. updateScrollStrategy(strategy: ScrollStrategy): void;
  952. /** Updates the text direction of the overlay panel. */
  953. private _updateElementDirection;
  954. /** Updates the size of the overlay element based on the overlay config. */
  955. private _updateElementSize;
  956. /** Toggles the pointer events for the overlay pane element. */
  957. private _togglePointerEvents;
  958. /** Attaches a backdrop for this overlay. */
  959. private _attachBackdrop;
  960. /**
  961. * Updates the stacking order of the element, moving it to the top if necessary.
  962. * This is required in cases where one overlay was detached, while another one,
  963. * that should be behind it, was destroyed. The next time both of them are opened,
  964. * the stacking will be wrong, because the detached element's pane will still be
  965. * in its original DOM position.
  966. */
  967. private _updateStackingOrder;
  968. /** Detaches the backdrop (if any) associated with the overlay. */
  969. detachBackdrop(): void;
  970. /** Toggles a single CSS class or an array of classes on an element. */
  971. private _toggleClasses;
  972. /** Detaches the overlay content next time the zone stabilizes. */
  973. private _detachContentWhenStable;
  974. /** Disposes of a scroll strategy. */
  975. private _disposeScrollStrategy;
  976. /** Removes a backdrop element from the DOM. */
  977. private _disposeBackdrop;
  978. }
  979. /** Size properties for an overlay. */
  980. export declare interface OverlaySizeConfig {
  981. width?: number | string;
  982. height?: number | string;
  983. minWidth?: number | string;
  984. minHeight?: number | string;
  985. maxWidth?: number | string;
  986. maxHeight?: number | string;
  987. }
  988. /** A simple (x, y) coordinate. */
  989. declare interface Point {
  990. x: number;
  991. y: number;
  992. }
  993. /** Strategy for setting the position on an overlay. */
  994. export declare interface PositionStrategy {
  995. /** Attaches this position strategy to an overlay. */
  996. attach(overlayRef: OverlayRef): void;
  997. /** Updates the position of the overlay element. */
  998. apply(): void;
  999. /** Called when the overlay is detached. */
  1000. detach?(): void;
  1001. /** Cleans up any DOM modifications made by the position strategy, if necessary. */
  1002. dispose(): void;
  1003. }
  1004. /**
  1005. * Strategy that will update the element position as the user is scrolling.
  1006. */
  1007. export declare class RepositionScrollStrategy implements ScrollStrategy {
  1008. private _scrollDispatcher;
  1009. private _viewportRuler;
  1010. private _ngZone;
  1011. private _config?;
  1012. private _scrollSubscription;
  1013. private _overlayRef;
  1014. constructor(_scrollDispatcher: ScrollDispatcher, _viewportRuler: ViewportRuler, _ngZone: NgZone, _config?: RepositionScrollStrategyConfig | undefined);
  1015. /** Attaches this scroll strategy to an overlay. */
  1016. attach(overlayRef: OverlayRef): void;
  1017. /** Enables repositioning of the attached overlay on scroll. */
  1018. enable(): void;
  1019. /** Disables repositioning of the attached overlay on scroll. */
  1020. disable(): void;
  1021. detach(): void;
  1022. }
  1023. /**
  1024. * Config options for the RepositionScrollStrategy.
  1025. */
  1026. export declare interface RepositionScrollStrategyConfig {
  1027. /** Time in milliseconds to throttle the scroll events. */
  1028. scrollThrottle?: number;
  1029. /** Whether to close the overlay once the user has scrolled away completely. */
  1030. autoClose?: boolean;
  1031. }
  1032. export { ScrollDispatcher }
  1033. /**
  1034. * Set of properties regarding the position of the origin and overlay relative to the viewport
  1035. * with respect to the containing Scrollable elements.
  1036. *
  1037. * The overlay and origin are clipped if any part of their bounding client rectangle exceeds the
  1038. * bounds of any one of the strategy's Scrollable's bounding client rectangle.
  1039. *
  1040. * The overlay and origin are outside view if there is no overlap between their bounding client
  1041. * rectangle and any one of the strategy's Scrollable's bounding client rectangle.
  1042. *
  1043. * ----------- -----------
  1044. * | outside | | clipped |
  1045. * | view | --------------------------
  1046. * | | | | | |
  1047. * ---------- | ----------- |
  1048. * -------------------------- | |
  1049. * | | | Scrollable |
  1050. * | | | |
  1051. * | | --------------------------
  1052. * | Scrollable |
  1053. * | |
  1054. * --------------------------
  1055. *
  1056. * @docs-private
  1057. */
  1058. export declare class ScrollingVisibility {
  1059. isOriginClipped: boolean;
  1060. isOriginOutsideView: boolean;
  1061. isOverlayClipped: boolean;
  1062. isOverlayOutsideView: boolean;
  1063. }
  1064. /**
  1065. * Describes a strategy that will be used by an overlay to handle scroll events while it is open.
  1066. */
  1067. export declare interface ScrollStrategy {
  1068. /** Enable this scroll strategy (called when the attached overlay is attached to a portal). */
  1069. enable: () => void;
  1070. /** Disable this scroll strategy (called when the attached overlay is detached from a portal). */
  1071. disable: () => void;
  1072. /** Attaches this `ScrollStrategy` to an overlay. */
  1073. attach: (overlayRef: OverlayRef) => void;
  1074. /** Detaches the scroll strategy from the current overlay. */
  1075. detach?: () => void;
  1076. }
  1077. /**
  1078. * Options for how an overlay will handle scrolling.
  1079. *
  1080. * Users can provide a custom value for `ScrollStrategyOptions` to replace the default
  1081. * behaviors. This class primarily acts as a factory for ScrollStrategy instances.
  1082. */
  1083. export declare class ScrollStrategyOptions {
  1084. private _scrollDispatcher;
  1085. private _viewportRuler;
  1086. private _ngZone;
  1087. private _document;
  1088. constructor(_scrollDispatcher: ScrollDispatcher, _viewportRuler: ViewportRuler, _ngZone: NgZone, document: any);
  1089. /** Do nothing on scroll. */
  1090. noop: () => NoopScrollStrategy;
  1091. /**
  1092. * Close the overlay as soon as the user scrolls.
  1093. * @param config Configuration to be used inside the scroll strategy.
  1094. */
  1095. close: (config?: CloseScrollStrategyConfig) => CloseScrollStrategy;
  1096. /** Block scrolling. */
  1097. block: () => BlockScrollStrategy;
  1098. /**
  1099. * Update the overlay's position on scroll.
  1100. * @param config Configuration to be used inside the scroll strategy.
  1101. * Allows debouncing the reposition calls.
  1102. */
  1103. reposition: (config?: RepositionScrollStrategyConfig) => RepositionScrollStrategy;
  1104. static ɵfac: i0.ɵɵFactoryDeclaration<ScrollStrategyOptions, never>;
  1105. static ɵprov: i0.ɵɵInjectableDeclaration<ScrollStrategyOptions>;
  1106. }
  1107. export declare const STANDARD_DROPDOWN_ADJACENT_POSITIONS: ConnectedPosition[];
  1108. export declare const STANDARD_DROPDOWN_BELOW_POSITIONS: ConnectedPosition[];
  1109. /**
  1110. * Validates whether a horizontal position property matches the expected values.
  1111. * @param property Name of the property being validated.
  1112. * @param value Value of the property being validated.
  1113. * @docs-private
  1114. */
  1115. export declare function validateHorizontalPosition(property: string, value: HorizontalConnectionPos): void;
  1116. /**
  1117. * Validates whether a vertical position property matches the expected values.
  1118. * @param property Name of the property being validated.
  1119. * @param value Value of the property being validated.
  1120. * @docs-private
  1121. */
  1122. export declare function validateVerticalPosition(property: string, value: VerticalConnectionPos): void;
  1123. /** Vertical dimension of a connection point on the perimeter of the origin or overlay element. */
  1124. export declare type VerticalConnectionPos = 'top' | 'center' | 'bottom';
  1125. export { ViewportRuler }
  1126. export { }