@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
101 lines (100 loc) • 3.52 kB
TypeScript
import { EventEmitter, Injector, OnChanges, SimpleChanges } from '@angular/core';
import { CoreBaseComponent } from '../../controls/common/base.component';
import * as i0 from "@angular/core";
export declare enum Unicode {
HorizontalEllipsis = "\u2026"
}
/**
* Describes the clamped event of the ClampDirective
*/
export interface ClampedEvent {
clamped: boolean;
}
/**
*
* @smeDoc {@label Clamp @id sme-clamp-directive}
*
* @overview
* @file {@filepath ./examples/clamp-overview.md}
*
* @example {@label Basic Usage @id basic-usage}
* @file {@filename component.html @filepath ./examples/basic-usage.component.html}
* @file {@filename component.ts @filepath ./examples/basic-usage.component.ts}
*
* @example {@label Clamp with auto lines @id auto-lines}
* @file {@filename component.html @filepath ./examples/auto-lines-clamp.component.html}
* @file {@filename component.ts @filepath ./examples/auto-lines-clamp.component.ts}
*
*/
export declare class ClampDirective extends CoreBaseComponent implements OnChanges {
/**
* The source name to use for logging
*/
protected get logSourceName(): string;
/**
* The content to clamp.
*/
smeClamp: any;
/**
* The number of lines to clamp, or auto to clamp whatever will fit in the element
*/
smeClampLines: number | 'auto';
/**
* Event that outputs a value indicating whether the content is clamped or not
*/
clamped: EventEmitter<ClampedEvent>;
/**
* The number of lines to clamp to
*/
private get lineCount();
/**
* The height that the clamp should be contained within
*/
private get clampHeight();
/**
* The line height of this element
*/
private get lineHeight();
/**
* Indicates that content overflows the desired height of the clamp
*/
private get needsClamping();
private get renderedLines();
private get breakWords();
/**
* Constructs a new instance of the ClampDirective
* @param injector The injector for the sme base component
*/
constructor(injector: Injector);
/**
* Host listener for page resize event.
*/
onResize(): void;
/**
* Implementation of angular OnChanges interface
* On every input change, we recalculate the clamp.
*/
ngOnChanges(changes: SimpleChanges): void;
private setBreakWords;
private removeBreakWords;
private resetClampContent;
/**
* Gets the initial host classes to be applied to this element
*/
protected getInitialHostClasses(): string[];
/**
* Clamps the text of a node by doing a last child first process of
* eliminating text until the host element fits in the clamp height.
* while this method should support HTML content, our input to this directive is a string for now.
* @param node The node to clamp
* @returns true if the node was successfully clamped
*/
private clamp;
/**
* Trims the last word from the string, or returns the original string if there is only one word
* @param text the text to trim
*/
private trimLastWord;
static ɵfac: i0.ɵɵFactoryDeclaration<ClampDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ClampDirective, "[smeClamp]", never, { "smeClamp": "smeClamp"; "smeClampLines": "smeClampLines"; }, { "clamped": "clamped"; }, never, never, false, never>;
}