scroll.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { NgZone } from '@angular/core';
  2. import { NzSafeAny } from 'ng-zorro-antd/core/types';
  3. import * as i0 from "@angular/core";
  4. export type EasyingFn = (t: number, b: number, c: number, d: number) => number;
  5. export interface NzScrollToOptions {
  6. /** Scroll container, default as window */
  7. easing?: EasyingFn;
  8. /** Scroll end callback */
  9. callback?(): void;
  10. /** Animation duration, default as 450 */
  11. duration?: number;
  12. }
  13. export declare class NzScrollService {
  14. private ngZone;
  15. private doc;
  16. constructor(ngZone: NgZone);
  17. /** Set the position of the scroll bar of `el`. */
  18. setScrollTop(el: Element | Window, topValue?: number): void;
  19. /** Get position of `el` against window. */
  20. getOffset(el: Element): {
  21. top: number;
  22. left: number;
  23. };
  24. /** Get the position of the scoll bar of `el`. */
  25. getScroll(target?: Element | HTMLElement | Window | Document | null, top?: boolean): number;
  26. isWindow(obj: NzSafeAny): boolean;
  27. /**
  28. * Scroll `el` to some position with animation.
  29. *
  30. * @param containerEl container, `window` by default
  31. * @param y Scroll to `top`, 0 by default
  32. */
  33. scrollTo(containerEl?: Element | HTMLElement | Window | Document | null, y?: number, options?: NzScrollToOptions): void;
  34. static ɵfac: i0.ɵɵFactoryDeclaration<NzScrollService, never>;
  35. static ɵprov: i0.ɵɵInjectableDeclaration<NzScrollService>;
  36. }