UNPKG

ngx-line-truncation

Version:

Ngx Line Truncation is line truncation implementation for Angular that truncate text by user defined line number.

57 lines 2.21 kB
import { AfterViewInit, ElementRef, EventEmitter, OnInit, Renderer2, OnDestroy } from "@angular/core"; import { Subject, Subscription, BehaviorSubject } from "rxjs"; import * as i0 from "@angular/core"; /** * This Directive allows you to specify the number of lines that you want to truncate a text by. * * @example * <!-- with <p> --> * <p [innerHTML]="description" * [line-truncation]="5" * (hasTruncated)="onTruncationFinish(e)"> * </p> * <!-- with div --> * <div [line-truncation]="5">your text</div> * */ interface Options { ellipsis: string; } export declare class LineTruncationDirective implements AfterViewInit, OnInit, OnDestroy { private elementRef; private renderer; lines: number; options: Options; set disabled(val: boolean); watchChanges: boolean; hasTruncated: EventEmitter<boolean>; elementClone: Node; MAX_TRIES: number; observerFlag: boolean; _disabled$: BehaviorSubject<boolean>; element: HTMLElement; windowResize$: Subject<Event>; windowListener: Subscription; mutationObserver: MutationObserver; isTruncated: boolean; handleClick(event: Event): void; constructor(elementRef: ElementRef<HTMLElement>, renderer: Renderer2); /** * Hide the original text content until we've finished the truncation */ ngOnInit(): void; ngAfterViewInit(): void; truncateWhenNecessary(element: HTMLElement, tries?: number, maxTries?: number): void; handler(e: boolean): void; truncationInit(): void; putbackElement(): void; initWindowResizeListener(element: HTMLElement): void; initMutationObserver(element: HTMLElement): void; disconnectMutationObserver(): void; disconnectWindowLisener(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<LineTruncationDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<LineTruncationDirective, "[line-truncation]", ["lineTruncation"], { "lines": "line-truncation"; "options": "options"; "disabled": "disabled"; "watchChanges": "watchChanges"; }, { "hasTruncated": "hasTruncated"; }, never, never, false>; } export {}; //# sourceMappingURL=line-truncation.directive.d.ts.map