UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

165 lines 21.5 kB
import { __decorate } from "tslib"; import { normalizePassiveListenerOptions } from '@angular/cdk/platform'; import { DOCUMENT, NgIf, NgTemplateOutlet } from '@angular/common'; import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, Optional, Output, ViewChild, ViewEncapsulation } from '@angular/core'; import { fromEvent, Subject, Subscription } from 'rxjs'; import { debounceTime, takeUntil } from 'rxjs/operators'; import { fadeMotion } from 'ng-zorro-antd/core/animation'; import { WithConfig } from 'ng-zorro-antd/core/config'; import { NzDestroyService } from 'ng-zorro-antd/core/services'; import { InputNumber } from 'ng-zorro-antd/core/util'; import { NzIconModule } from 'ng-zorro-antd/icon'; import * as i0 from "@angular/core"; import * as i1 from "ng-zorro-antd/core/config"; import * as i2 from "ng-zorro-antd/core/services"; import * as i3 from "@angular/cdk/platform"; import * as i4 from "@angular/cdk/bidi"; import * as i5 from "ng-zorro-antd/icon"; const NZ_CONFIG_MODULE_NAME = 'backTop'; const passiveEventListenerOptions = normalizePassiveListenerOptions({ passive: true }); export class NzBackTopComponent { set backTop(backTop) { if (backTop) { this.backTopClickSubscription.unsubscribe(); this.backTopClickSubscription = this.zone.runOutsideAngular(() => fromEvent(backTop.nativeElement, 'click') .pipe(takeUntil(this.destroy$)) .subscribe(() => { this.scrollSrv.scrollTo(this.getTarget(), 0, { duration: this.nzDuration }); if (this.nzClick.observers.length) { this.zone.run(() => this.nzClick.emit(true)); } })); } } constructor(doc, nzConfigService, scrollSrv, platform, cd, zone, cdr, destroy$, directionality) { this.doc = doc; this.nzConfigService = nzConfigService; this.scrollSrv = scrollSrv; this.platform = platform; this.cd = cd; this.zone = zone; this.cdr = cdr; this.destroy$ = destroy$; this.directionality = directionality; this._nzModuleName = NZ_CONFIG_MODULE_NAME; this.scrollListenerDestroy$ = new Subject(); this.target = null; this.visible = false; this.dir = 'ltr'; this.nzVisibilityHeight = 400; this.nzDuration = 450; this.nzClick = new EventEmitter(); this.backTopClickSubscription = Subscription.EMPTY; this.dir = this.directionality.value; } ngOnInit() { this.registerScrollEvent(); this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => { this.dir = direction; this.cdr.detectChanges(); }); this.dir = this.directionality.value; } getTarget() { return this.target || window; } handleScroll() { if (this.visible === this.scrollSrv.getScroll(this.getTarget()) > this.nzVisibilityHeight) { return; } this.visible = !this.visible; this.cd.detectChanges(); } registerScrollEvent() { if (!this.platform.isBrowser) { return; } this.scrollListenerDestroy$.next(true); this.handleScroll(); this.zone.runOutsideAngular(() => { fromEvent(this.getTarget(), 'scroll', passiveEventListenerOptions) .pipe(debounceTime(50), takeUntil(this.scrollListenerDestroy$)) .subscribe(() => this.handleScroll()); }); } ngOnDestroy() { this.scrollListenerDestroy$.next(true); this.scrollListenerDestroy$.complete(); } ngOnChanges(changes) { const { nzTarget } = changes; if (nzTarget) { this.target = typeof this.nzTarget === 'string' ? this.doc.querySelector(this.nzTarget) : this.nzTarget; this.registerScrollEvent(); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzBackTopComponent, deps: [{ token: DOCUMENT }, { token: i1.NzConfigService }, { token: i2.NzScrollService }, { token: i3.Platform }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i2.NzDestroyService }, { token: i4.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: NzBackTopComponent, isStandalone: true, selector: "nz-back-top", inputs: { nzTemplate: "nzTemplate", nzVisibilityHeight: "nzVisibilityHeight", nzTarget: "nzTarget", nzDuration: "nzDuration" }, outputs: { nzClick: "nzClick" }, providers: [NzDestroyService], viewQueries: [{ propertyName: "backTop", first: true, predicate: ["backTop"], descendants: true }], exportAs: ["nzBackTop"], usesOnChanges: true, ngImport: i0, template: ` @if (visible) { <div #backTop class="ant-back-top" [class.ant-back-top-rtl]="dir === 'rtl'" @fadeMotion> <ng-template #defaultContent> <div class="ant-back-top-content"> <div class="ant-back-top-icon"> <span nz-icon nzType="vertical-align-top"></span> </div> </div> </ng-template> <ng-template [ngTemplateOutlet]="nzTemplate || defaultContent"></ng-template> </div> } `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i5.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], animations: [fadeMotion], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } } __decorate([ WithConfig(), InputNumber() ], NzBackTopComponent.prototype, "nzVisibilityHeight", void 0); __decorate([ InputNumber() ], NzBackTopComponent.prototype, "nzDuration", void 0); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzBackTopComponent, decorators: [{ type: Component, args: [{ selector: 'nz-back-top', exportAs: 'nzBackTop', animations: [fadeMotion], standalone: true, imports: [NgIf, NgTemplateOutlet, NzIconModule], template: ` @if (visible) { <div #backTop class="ant-back-top" [class.ant-back-top-rtl]="dir === 'rtl'" @fadeMotion> <ng-template #defaultContent> <div class="ant-back-top-content"> <div class="ant-back-top-icon"> <span nz-icon nzType="vertical-align-top"></span> </div> </div> </ng-template> <ng-template [ngTemplateOutlet]="nzTemplate || defaultContent"></ng-template> </div> } `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, providers: [NzDestroyService] }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT] }] }, { type: i1.NzConfigService }, { type: i2.NzScrollService }, { type: i3.Platform }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i2.NzDestroyService }, { type: i4.Directionality, decorators: [{ type: Optional }] }], propDecorators: { nzTemplate: [{ type: Input }], nzVisibilityHeight: [{ type: Input }], nzTarget: [{ type: Input }], nzDuration: [{ type: Input }], nzClick: [{ type: Output }], backTop: [{ type: ViewChild, args: ['backTop', { static: false }] }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFjay10b3AuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vY29tcG9uZW50cy9iYWNrLXRvcC9iYWNrLXRvcC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQU1BLE9BQU8sRUFBRSwrQkFBK0IsRUFBWSxNQUFNLHVCQUF1QixDQUFDO0FBQ2xGLE9BQU8sRUFBRSxRQUFRLEVBQUUsSUFBSSxFQUFFLGdCQUFnQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDbkUsT0FBTyxFQUNMLHVCQUF1QixFQUV2QixTQUFTLEVBRVQsWUFBWSxFQUNaLE1BQU0sRUFDTixLQUFLLEVBS0wsUUFBUSxFQUNSLE1BQU0sRUFHTixTQUFTLEVBQ1QsaUJBQWlCLEVBQ2xCLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBRSxTQUFTLEVBQUUsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUN4RCxPQUFPLEVBQUUsWUFBWSxFQUFFLFNBQVMsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRXpELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUMxRCxPQUFPLEVBQWdDLFVBQVUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3JGLE9BQU8sRUFBRSxnQkFBZ0IsRUFB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