247 lines
10 KiB
TypeScript
247 lines
10 KiB
TypeScript
import * as i0 from '@angular/core';
|
|
import { QueryList, NgZone, InjectionToken, ChangeDetectorRef, Renderer2, AfterContentInit, AfterViewInit, OnChanges, OnInit, ElementRef, TemplateRef, EventEmitter, SimpleChanges } from '@angular/core';
|
|
import { Direction } from '@angular/cdk/bidi';
|
|
import { NzConfigKey, NzConfigService } from 'ng-zorro-antd/core/config';
|
|
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
|
import { Platform } from '@angular/cdk/platform';
|
|
import { Observable } from 'rxjs';
|
|
|
|
declare class NzCarouselContentDirective {
|
|
private renderer;
|
|
readonly el: HTMLElement;
|
|
set isActive(value: boolean);
|
|
get isActive(): boolean;
|
|
private _active;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzCarouselContentDirective, never>;
|
|
static ɵdir: i0.ɵɵDirectiveDeclaration<NzCarouselContentDirective, "[nz-carousel-content]", ["nzCarouselContent"], {}, {}, never, never, true, never>;
|
|
}
|
|
|
|
/**
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
|
|
*/
|
|
|
|
type NzCarouselEffects = 'fade' | 'scrollx' | string;
|
|
type NzCarouselDotPosition = 'top' | 'bottom' | 'left' | 'right' | string;
|
|
interface NzCarouselComponentAsSource {
|
|
carouselContents: QueryList<NzCarouselContentDirective>;
|
|
el: HTMLElement;
|
|
nzTransitionSpeed: number;
|
|
vertical: boolean;
|
|
slickListEl: HTMLElement;
|
|
slickTrackEl: HTMLElement;
|
|
activeIndex: number;
|
|
dir: Direction;
|
|
ngZone: NgZone;
|
|
}
|
|
interface NzCarouselStrategyRegistryItem {
|
|
name: string;
|
|
strategy: NzCarouselBaseStrategy;
|
|
}
|
|
declare const NZ_CAROUSEL_CUSTOM_STRATEGIES: InjectionToken<NzCarouselStrategyRegistryItem[]>;
|
|
interface PointerVector {
|
|
x: number;
|
|
y: number;
|
|
}
|
|
interface FromToInterface {
|
|
from: number;
|
|
to: number;
|
|
}
|
|
|
|
/**
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
|
|
*/
|
|
|
|
declare abstract class NzCarouselBaseStrategy<T = NzSafeAny> {
|
|
protected cdr: ChangeDetectorRef;
|
|
protected renderer: Renderer2;
|
|
protected platform: Platform;
|
|
protected options?: T | undefined;
|
|
protected carouselComponent: NzCarouselComponentAsSource | null;
|
|
protected contents: NzCarouselContentDirective[];
|
|
protected slickListEl: HTMLElement;
|
|
protected slickTrackEl: HTMLElement;
|
|
protected length: number;
|
|
protected unitWidth: number;
|
|
protected unitHeight: number;
|
|
protected get maxIndex(): number;
|
|
protected get firstEl(): HTMLElement;
|
|
protected get lastEl(): HTMLElement;
|
|
constructor(carouselComponent: NzCarouselComponentAsSource, cdr: ChangeDetectorRef, renderer: Renderer2, platform: Platform, options?: T | undefined);
|
|
/**
|
|
* Initialize dragging sequences.
|
|
*
|
|
* @param contents
|
|
*/
|
|
withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void;
|
|
/**
|
|
* Trigger transition.
|
|
*/
|
|
abstract switch(_f: number, _t: number): Observable<void>;
|
|
/**
|
|
* When user drag the carousel component.
|
|
*
|
|
* @optional
|
|
*/
|
|
dragging(_vector: PointerVector): void;
|
|
/**
|
|
* Destroy a scroll strategy.
|
|
*/
|
|
dispose(): void;
|
|
protected getFromToInBoundary(f: number, t: number): FromToInterface;
|
|
}
|
|
|
|
/**
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
|
|
*/
|
|
|
|
declare class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnChanges, OnInit {
|
|
readonly _nzModuleName: NzConfigKey;
|
|
readonly nzConfigService: NzConfigService;
|
|
readonly ngZone: NgZone;
|
|
private readonly renderer;
|
|
private readonly cdr;
|
|
private readonly platform;
|
|
private readonly resizeService;
|
|
private readonly nzDragService;
|
|
private nzResizeObserver;
|
|
private destroyRef;
|
|
carouselContents: QueryList<NzCarouselContentDirective>;
|
|
slickList: ElementRef<HTMLElement>;
|
|
slickTrack: ElementRef<HTMLElement>;
|
|
nzDotRender?: TemplateRef<{
|
|
$implicit: number;
|
|
}>;
|
|
nzEffect: NzCarouselEffects;
|
|
nzEnableSwipe: boolean;
|
|
nzDots: boolean;
|
|
nzAutoPlay: boolean;
|
|
nzAutoPlaySpeed: number;
|
|
nzTransitionSpeed: number;
|
|
nzLoop: boolean;
|
|
nzArrows: boolean;
|
|
/**
|
|
* this property is passed directly to an NzCarouselBaseStrategy
|
|
*/
|
|
nzStrategyOptions: NzSafeAny;
|
|
nzDotPosition: NzCarouselDotPosition;
|
|
readonly nzBeforeChange: EventEmitter<FromToInterface>;
|
|
readonly nzAfterChange: EventEmitter<number>;
|
|
activeIndex: number;
|
|
el: HTMLElement;
|
|
slickListEl: HTMLElement;
|
|
slickTrackEl: HTMLElement;
|
|
strategy?: NzCarouselBaseStrategy;
|
|
vertical: boolean;
|
|
transitionInProgress?: ReturnType<typeof setTimeout>;
|
|
dir: Direction;
|
|
private gestureRect;
|
|
private pointerDelta;
|
|
private isTransiting;
|
|
private isDragging;
|
|
private directionality;
|
|
private customStrategies;
|
|
constructor();
|
|
ngOnInit(): void;
|
|
ngAfterContentInit(): void;
|
|
ngAfterViewInit(): void;
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
next(): void;
|
|
pre(): void;
|
|
goTo(index: number): void;
|
|
private switchStrategy;
|
|
private scheduleNextTransition;
|
|
private clearScheduledTransition;
|
|
private markContentActive;
|
|
/**
|
|
* Drag carousel.
|
|
*/
|
|
pointerDown: (event: TouchEvent | MouseEvent) => void;
|
|
layout(): void;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzCarouselComponent, never>;
|
|
static ɵcmp: i0.ɵɵComponentDeclaration<NzCarouselComponent, "nz-carousel", ["nzCarousel"], { "nzDotRender": { "alias": "nzDotRender"; "required": false; }; "nzEffect": { "alias": "nzEffect"; "required": false; }; "nzEnableSwipe": { "alias": "nzEnableSwipe"; "required": false; }; "nzDots": { "alias": "nzDots"; "required": false; }; "nzAutoPlay": { "alias": "nzAutoPlay"; "required": false; }; "nzAutoPlaySpeed": { "alias": "nzAutoPlaySpeed"; "required": false; }; "nzTransitionSpeed": { "alias": "nzTransitionSpeed"; "required": false; }; "nzLoop": { "alias": "nzLoop"; "required": false; }; "nzArrows": { "alias": "nzArrows"; "required": false; }; "nzStrategyOptions": { "alias": "nzStrategyOptions"; "required": false; }; "nzDotPosition": { "alias": "nzDotPosition"; "required": false; }; }, { "nzBeforeChange": "nzBeforeChange"; "nzAfterChange": "nzAfterChange"; }, ["carouselContents"], ["*"], true, never>;
|
|
static ngAcceptInputType_nzEnableSwipe: unknown;
|
|
static ngAcceptInputType_nzDots: unknown;
|
|
static ngAcceptInputType_nzAutoPlay: unknown;
|
|
static ngAcceptInputType_nzAutoPlaySpeed: unknown;
|
|
static ngAcceptInputType_nzTransitionSpeed: unknown;
|
|
static ngAcceptInputType_nzArrows: unknown;
|
|
}
|
|
|
|
declare class NzCarouselModule {
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzCarouselModule, never>;
|
|
static ɵmod: i0.ɵɵNgModuleDeclaration<NzCarouselModule, never, [typeof NzCarouselComponent, typeof NzCarouselContentDirective], [typeof NzCarouselComponent, typeof NzCarouselContentDirective]>;
|
|
static ɵinj: i0.ɵɵInjectorDeclaration<NzCarouselModule>;
|
|
}
|
|
|
|
/**
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
|
|
*/
|
|
|
|
declare class NzCarouselOpacityStrategy extends NzCarouselBaseStrategy {
|
|
withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void;
|
|
switch(_f: number, _t: number): Observable<void>;
|
|
dispose(): void;
|
|
}
|
|
|
|
/**
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
|
|
*/
|
|
|
|
interface NzCarouselTransformStrategyOptions {
|
|
direction: 'left' | 'right';
|
|
}
|
|
declare class NzCarouselTransformStrategy extends NzCarouselBaseStrategy<NzCarouselTransformStrategyOptions> {
|
|
private isDragging;
|
|
private isTransitioning;
|
|
private get vertical();
|
|
constructor(carouselComponent: NzCarouselComponentAsSource, cdr: ChangeDetectorRef, renderer: Renderer2, platform: Platform, options?: NzCarouselTransformStrategyOptions);
|
|
dispose(): void;
|
|
withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void;
|
|
switch(_f: number, _t: number): Observable<void>;
|
|
dragging(_vector: PointerVector): void;
|
|
private verticalTransform;
|
|
private horizontalTransform;
|
|
private prepareVerticalContext;
|
|
private prepareHorizontalContext;
|
|
}
|
|
|
|
/**
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
|
|
*/
|
|
|
|
interface NzCarouselTransformOnLoopStrategyOptions {
|
|
direction: 'left' | 'right';
|
|
}
|
|
/**
|
|
* this strategy is very much like NzCarouselTransformStrategy, but it doesn't loop between the first and the last one
|
|
*/
|
|
declare class NzCarouselTransformNoLoopStrategy extends NzCarouselBaseStrategy<NzCarouselTransformOnLoopStrategyOptions> {
|
|
private isTransitioning;
|
|
private get vertical();
|
|
constructor(carouselComponent: NzCarouselComponentAsSource, cdr: ChangeDetectorRef, renderer: Renderer2, platform: Platform, options?: NzCarouselTransformOnLoopStrategyOptions);
|
|
dispose(): void;
|
|
withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void;
|
|
switch(_f: number, _t: number): Observable<void>;
|
|
dragging(vector: PointerVector): void;
|
|
}
|
|
|
|
/**
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
|
|
*/
|
|
|
|
declare class NzCarouselFlipStrategy extends NzCarouselBaseStrategy {
|
|
withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void;
|
|
switch(rawF: number, rawT: number): Observable<void>;
|
|
dispose(): void;
|
|
}
|
|
|
|
export { NZ_CAROUSEL_CUSTOM_STRATEGIES, NzCarouselBaseStrategy, NzCarouselComponent, NzCarouselContentDirective, NzCarouselFlipStrategy, NzCarouselModule, NzCarouselOpacityStrategy, NzCarouselTransformNoLoopStrategy, NzCarouselTransformStrategy };
|
|
export type { FromToInterface, NzCarouselComponentAsSource, NzCarouselDotPosition, NzCarouselEffects, NzCarouselStrategyRegistryItem, PointerVector };
|