overlay.d-BdoMy0hX.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. import { n as ScrollStrategy, b as OverlayRef, P as PositionStrategy, e as FlexibleConnectedPositionStrategyOrigin, F as FlexibleConnectedPositionStrategy, g as OverlayConfig } from './overlay-module.d-B3qEQtts.js';
  2. import * as i0 from '@angular/core';
  3. import { NgZone } from '@angular/core';
  4. import { ViewportRuler } from './scrolling/index.js';
  5. import { S as ScrollDispatcher } from './scrolling-module.d-ud2XrbF8.js';
  6. /**
  7. * Strategy that will prevent the user from scrolling while the overlay is visible.
  8. */
  9. declare class BlockScrollStrategy implements ScrollStrategy {
  10. private _viewportRuler;
  11. private _previousHTMLStyles;
  12. private _previousScrollPosition;
  13. private _isEnabled;
  14. private _document;
  15. constructor(_viewportRuler: ViewportRuler, document: any);
  16. /** Attaches this scroll strategy to an overlay. */
  17. attach(): void;
  18. /** Blocks page-level scroll while the attached overlay is open. */
  19. enable(): void;
  20. /** Unblocks page-level scroll while the attached overlay is open. */
  21. disable(): void;
  22. private _canBeEnabled;
  23. }
  24. /**
  25. * Config options for the CloseScrollStrategy.
  26. */
  27. interface CloseScrollStrategyConfig {
  28. /** Amount of pixels the user has to scroll before the overlay is closed. */
  29. threshold?: number;
  30. }
  31. /**
  32. * Strategy that will close the overlay as soon as the user starts scrolling.
  33. */
  34. declare class CloseScrollStrategy implements ScrollStrategy {
  35. private _scrollDispatcher;
  36. private _ngZone;
  37. private _viewportRuler;
  38. private _config?;
  39. private _scrollSubscription;
  40. private _overlayRef;
  41. private _initialScrollPosition;
  42. constructor(_scrollDispatcher: ScrollDispatcher, _ngZone: NgZone, _viewportRuler: ViewportRuler, _config?: CloseScrollStrategyConfig | undefined);
  43. /** Attaches this scroll strategy to an overlay. */
  44. attach(overlayRef: OverlayRef): void;
  45. /** Enables the closing of the attached overlay on scroll. */
  46. enable(): void;
  47. /** Disables the closing the attached overlay on scroll. */
  48. disable(): void;
  49. detach(): void;
  50. /** Detaches the overlay ref and disables the scroll strategy. */
  51. private _detach;
  52. }
  53. /** Scroll strategy that doesn't do anything. */
  54. declare class NoopScrollStrategy implements ScrollStrategy {
  55. /** Does nothing, as this scroll strategy is a no-op. */
  56. enable(): void;
  57. /** Does nothing, as this scroll strategy is a no-op. */
  58. disable(): void;
  59. /** Does nothing, as this scroll strategy is a no-op. */
  60. attach(): void;
  61. }
  62. /**
  63. * Config options for the RepositionScrollStrategy.
  64. */
  65. interface RepositionScrollStrategyConfig {
  66. /** Time in milliseconds to throttle the scroll events. */
  67. scrollThrottle?: number;
  68. /** Whether to close the overlay once the user has scrolled away completely. */
  69. autoClose?: boolean;
  70. }
  71. /**
  72. * Strategy that will update the element position as the user is scrolling.
  73. */
  74. declare class RepositionScrollStrategy implements ScrollStrategy {
  75. private _scrollDispatcher;
  76. private _viewportRuler;
  77. private _ngZone;
  78. private _config?;
  79. private _scrollSubscription;
  80. private _overlayRef;
  81. constructor(_scrollDispatcher: ScrollDispatcher, _viewportRuler: ViewportRuler, _ngZone: NgZone, _config?: RepositionScrollStrategyConfig | undefined);
  82. /** Attaches this scroll strategy to an overlay. */
  83. attach(overlayRef: OverlayRef): void;
  84. /** Enables repositioning of the attached overlay on scroll. */
  85. enable(): void;
  86. /** Disables repositioning of the attached overlay on scroll. */
  87. disable(): void;
  88. detach(): void;
  89. }
  90. /**
  91. * Options for how an overlay will handle scrolling.
  92. *
  93. * Users can provide a custom value for `ScrollStrategyOptions` to replace the default
  94. * behaviors. This class primarily acts as a factory for ScrollStrategy instances.
  95. */
  96. declare class ScrollStrategyOptions {
  97. private _scrollDispatcher;
  98. private _viewportRuler;
  99. private _ngZone;
  100. private _document;
  101. constructor(...args: unknown[]);
  102. /** Do nothing on scroll. */
  103. noop: () => NoopScrollStrategy;
  104. /**
  105. * Close the overlay as soon as the user scrolls.
  106. * @param config Configuration to be used inside the scroll strategy.
  107. */
  108. close: (config?: CloseScrollStrategyConfig) => CloseScrollStrategy;
  109. /** Block scrolling. */
  110. block: () => BlockScrollStrategy;
  111. /**
  112. * Update the overlay's position on scroll.
  113. * @param config Configuration to be used inside the scroll strategy.
  114. * Allows debouncing the reposition calls.
  115. */
  116. reposition: (config?: RepositionScrollStrategyConfig) => RepositionScrollStrategy;
  117. static ɵfac: i0.ɵɵFactoryDeclaration<ScrollStrategyOptions, never>;
  118. static ɵprov: i0.ɵɵInjectableDeclaration<ScrollStrategyOptions>;
  119. }
  120. /**
  121. * A strategy for positioning overlays. Using this strategy, an overlay is given an
  122. * explicit position relative to the browser's viewport. We use flexbox, instead of
  123. * transforms, in order to avoid issues with subpixel rendering which can cause the
  124. * element to become blurry.
  125. */
  126. declare class GlobalPositionStrategy implements PositionStrategy {
  127. /** The overlay to which this strategy is attached. */
  128. private _overlayRef;
  129. private _cssPosition;
  130. private _topOffset;
  131. private _bottomOffset;
  132. private _alignItems;
  133. private _xPosition;
  134. private _xOffset;
  135. private _width;
  136. private _height;
  137. private _isDisposed;
  138. attach(overlayRef: OverlayRef): void;
  139. /**
  140. * Sets the top position of the overlay. Clears any previously set vertical position.
  141. * @param value New top offset.
  142. */
  143. top(value?: string): this;
  144. /**
  145. * Sets the left position of the overlay. Clears any previously set horizontal position.
  146. * @param value New left offset.
  147. */
  148. left(value?: string): this;
  149. /**
  150. * Sets the bottom position of the overlay. Clears any previously set vertical position.
  151. * @param value New bottom offset.
  152. */
  153. bottom(value?: string): this;
  154. /**
  155. * Sets the right position of the overlay. Clears any previously set horizontal position.
  156. * @param value New right offset.
  157. */
  158. right(value?: string): this;
  159. /**
  160. * Sets the overlay to the start of the viewport, depending on the overlay direction.
  161. * This will be to the left in LTR layouts and to the right in RTL.
  162. * @param offset Offset from the edge of the screen.
  163. */
  164. start(value?: string): this;
  165. /**
  166. * Sets the overlay to the end of the viewport, depending on the overlay direction.
  167. * This will be to the right in LTR layouts and to the left in RTL.
  168. * @param offset Offset from the edge of the screen.
  169. */
  170. end(value?: string): this;
  171. /**
  172. * Sets the overlay width and clears any previously set width.
  173. * @param value New width for the overlay
  174. * @deprecated Pass the `width` through the `OverlayConfig`.
  175. * @breaking-change 8.0.0
  176. */
  177. width(value?: string): this;
  178. /**
  179. * Sets the overlay height and clears any previously set height.
  180. * @param value New height for the overlay
  181. * @deprecated Pass the `height` through the `OverlayConfig`.
  182. * @breaking-change 8.0.0
  183. */
  184. height(value?: string): this;
  185. /**
  186. * Centers the overlay horizontally with an optional offset.
  187. * Clears any previously set horizontal position.
  188. *
  189. * @param offset Overlay offset from the horizontal center.
  190. */
  191. centerHorizontally(offset?: string): this;
  192. /**
  193. * Centers the overlay vertically with an optional offset.
  194. * Clears any previously set vertical position.
  195. *
  196. * @param offset Overlay offset from the vertical center.
  197. */
  198. centerVertically(offset?: string): this;
  199. /**
  200. * Apply the position to the element.
  201. * @docs-private
  202. */
  203. apply(): void;
  204. /**
  205. * Cleans up the DOM changes from the position strategy.
  206. * @docs-private
  207. */
  208. dispose(): void;
  209. }
  210. /** Builder for overlay position strategy. */
  211. declare class OverlayPositionBuilder {
  212. private _viewportRuler;
  213. private _document;
  214. private _platform;
  215. private _overlayContainer;
  216. constructor(...args: unknown[]);
  217. /**
  218. * Creates a global position strategy.
  219. */
  220. global(): GlobalPositionStrategy;
  221. /**
  222. * Creates a flexible position strategy.
  223. * @param origin Origin relative to which to position the overlay.
  224. */
  225. flexibleConnectedTo(origin: FlexibleConnectedPositionStrategyOrigin): FlexibleConnectedPositionStrategy;
  226. static ɵfac: i0.ɵɵFactoryDeclaration<OverlayPositionBuilder, never>;
  227. static ɵprov: i0.ɵɵInjectableDeclaration<OverlayPositionBuilder>;
  228. }
  229. /**
  230. * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
  231. * used as a low-level building block for other components. Dialogs, tooltips, menus,
  232. * selects, etc. can all be built using overlays. The service should primarily be used by authors
  233. * of re-usable components rather than developers building end-user applications.
  234. *
  235. * An overlay *is* a PortalOutlet, so any kind of Portal can be loaded into one.
  236. */
  237. declare class Overlay {
  238. scrollStrategies: ScrollStrategyOptions;
  239. private _overlayContainer;
  240. private _positionBuilder;
  241. private _keyboardDispatcher;
  242. private _injector;
  243. private _ngZone;
  244. private _document;
  245. private _directionality;
  246. private _location;
  247. private _outsideClickDispatcher;
  248. private _animationsModuleType;
  249. private _idGenerator;
  250. private _renderer;
  251. private _appRef;
  252. private _styleLoader;
  253. constructor(...args: unknown[]);
  254. /**
  255. * Creates an overlay.
  256. * @param config Configuration applied to the overlay.
  257. * @returns Reference to the created overlay.
  258. */
  259. create(config?: OverlayConfig): OverlayRef;
  260. /**
  261. * Gets a position builder that can be used, via fluent API,
  262. * to construct and configure a position strategy.
  263. * @returns An overlay position builder.
  264. */
  265. position(): OverlayPositionBuilder;
  266. /**
  267. * Creates the DOM element for an overlay and appends it to the overlay container.
  268. * @returns Newly-created pane element
  269. */
  270. private _createPaneElement;
  271. /**
  272. * Creates the host element that wraps around an overlay
  273. * and can be used for advanced positioning.
  274. * @returns Newly-create host element.
  275. */
  276. private _createHostElement;
  277. /**
  278. * Create a DomPortalOutlet into which the overlay content can be loaded.
  279. * @param pane The DOM element to turn into a portal outlet.
  280. * @returns A portal outlet for the given DOM element.
  281. */
  282. private _createPortalOutlet;
  283. static ɵfac: i0.ɵɵFactoryDeclaration<Overlay, never>;
  284. static ɵprov: i0.ɵɵInjectableDeclaration<Overlay>;
  285. }
  286. export { BlockScrollStrategy as B, CloseScrollStrategy as C, GlobalPositionStrategy as G, NoopScrollStrategy as N, Overlay as O, RepositionScrollStrategy as R, ScrollStrategyOptions as S, OverlayPositionBuilder as a };
  287. export type { RepositionScrollStrategyConfig as b };