@covalent/core
Version:
Core Teradata UI Platform for layouts, icons, custom components and themes. This should be added as a dependency for any project that wants to use layouts, icons and themes for Angular Material.
381 lines (351 loc) • 17.2 kB
TypeScript
import * as i0 from '@angular/core';
import { PipeTransform, ChangeDetectorRef } from '@angular/core';
import * as i10 from '@angular/forms';
import { ControlValueAccessor, NgControl, ValidatorFn, AbstractControl } from '@angular/forms';
import * as i11 from '@angular/common';
import { AnimationTriggerMetadata } from '@angular/animations';
import { Observable } from 'rxjs';
declare class TdAutoTrimDirective {
private _model;
/**
* Listens to host's (blur) event and trims value.
*/
onBlur(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<TdAutoTrimDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<TdAutoTrimDirective, "[tdAutoTrim]", never, {}, {}, never, never, true, never>;
}
declare class TdFullscreenDirective {
private _document;
private _el;
fullScreenIsActive: boolean;
fsChangeHandler(event: Event): void;
toggleFullScreen(): void;
enterFullScreen(): void;
exitFullScreen(): void;
private _getFullScreenElement;
static ɵfac: i0.ɵɵFactoryDeclaration<TdFullscreenDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<TdFullscreenDirective, "[tdFullScreen]", ["tdFullScreen"], {}, {}, never, never, true, never>;
}
declare class TdTimeAgoPipe implements PipeTransform {
transform(time: any, reference?: any): string;
static ɵfac: i0.ɵɵFactoryDeclaration<TdTimeAgoPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TdTimeAgoPipe, "timeAgo", true>;
}
declare class TdTimeDifferencePipe implements PipeTransform {
transform(start: any, end?: any): string;
static ɵfac: i0.ɵɵFactoryDeclaration<TdTimeDifferencePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TdTimeDifferencePipe, "timeDifference", true>;
}
declare class TdTimeUntilPipe implements PipeTransform {
transform(time: any, reference?: any): string;
static ɵfac: i0.ɵɵFactoryDeclaration<TdTimeUntilPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TdTimeUntilPipe, "timeUntil", true>;
}
declare class TdBytesPipe implements PipeTransform {
transform(bytes: any, precision?: number): string;
static ɵfac: i0.ɵɵFactoryDeclaration<TdBytesPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TdBytesPipe, "bytes", true>;
}
declare class TdDecimalBytesPipe implements PipeTransform {
transform(bytes: any, precision?: number): string;
static ɵfac: i0.ɵɵFactoryDeclaration<TdDecimalBytesPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TdDecimalBytesPipe, "decimalBytes", true>;
}
declare class TdDigitsPipe implements PipeTransform {
private _locale;
private _decimalPipe;
constructor();
set locale(locale: string);
transform(digits: any, precision?: number): string;
static ɵfac: i0.ɵɵFactoryDeclaration<TdDigitsPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TdDigitsPipe, "digits", true>;
}
declare class TdTruncatePipe implements PipeTransform {
transform(text: any, length?: number): string;
static ɵfac: i0.ɵɵFactoryDeclaration<TdTruncatePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TdTruncatePipe, "truncate", true>;
}
/**
* @deprecated This module is deprecated and will be removed in future versions.
* Please migrate to using standalone components as soon as possible.
*/
declare class CovalentCommonModule {
static ɵfac: i0.ɵɵFactoryDeclaration<CovalentCommonModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CovalentCommonModule, never, [typeof TdAutoTrimDirective, typeof TdFullscreenDirective, typeof TdTimeAgoPipe, typeof TdTimeDifferencePipe, typeof TdTimeUntilPipe, typeof TdBytesPipe, typeof TdDecimalBytesPipe, typeof TdDigitsPipe, typeof TdTruncatePipe], [typeof i10.FormsModule, typeof i11.CommonModule, typeof TdAutoTrimDirective, typeof TdFullscreenDirective, typeof TdTimeAgoPipe, typeof TdTimeDifferencePipe, typeof TdTimeUntilPipe, typeof TdBytesPipe, typeof TdDecimalBytesPipe, typeof TdDigitsPipe, typeof TdTruncatePipe]>;
static ɵinj: i0.ɵɵInjectorDeclaration<CovalentCommonModule>;
}
interface IAnimationOptions {
anchor?: string;
duration?: number;
delay?: number;
}
interface IRotateAnimation extends IAnimationOptions {
degrees?: number;
ease?: string;
}
/**
* const tdRotateAnimation
*
* Parameter Options:
* * degressStart: Degrees of rotation that the dom object will end up in during the "false" state
* * degreesEnd: Degrees of rotation that the dom object will end up in during the "true" state
* * duration: Duration the animation will run in milliseconds. Defaults to 150 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * ease: Animation accelerates and decelerates. Defaults to ease-in.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a rotation animation.
*
* usage: [@tdRotate]="{ value: true | false, params: { degreesEnd: 90 }}"
*/
declare const tdRotateAnimation: AnimationTriggerMetadata;
interface ICollapseAnimation extends IAnimationOptions {
easeOnClose?: string;
easeOnOpen?: string;
}
/**
* const tdCollapseAnimation
*
* Parameter Options:
* * duration: Duration the animation will run in milliseconds. Defaults to 150 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * easeOnClose: Animation accelerates and decelerates when closing. Defaults to ease-in.
* * easeOnOpen: Animation accelerates and decelerates when opening. Defaults to ease-out.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a collapse/expand animation.
*
* usage: [@tdCollapse]="{ value: true | false, params: { duration: 500 }}"
*/
declare const tdCollapseAnimation: AnimationTriggerMetadata;
interface IFadeInOutAnimation extends IAnimationOptions {
easeOnIn?: string;
easeOnOut?: string;
}
/**
* const tdFadeInOutAnimation
*
* Parameter Options:
* * duration: Duration the animation will run in milliseconds. Defaults to 150 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * easeOnIn: Animation accelerates and decelerates when fading in. Defaults to ease-in.
* * easeOnOut: Animation accelerates and decelerates when fading out. Defaults to ease-out.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a fade animation.
*
* usage: [@tdFadeInOut]="{ value: true | false, params: { duration: 200 }}"
*/
declare const tdFadeInOutAnimation: AnimationTriggerMetadata;
/**
* const tdBounceAnimation
*
* Parameter Options:
* * duration: Duration the animation will run in milliseconds. Defaults to 500 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * ease: Animation accelerate and decelerate style. Defaults to ease-out.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a bounce animation.
*
* usage: [@tdBounce]="{ value: true | false, params: { duration: 200 }}"
*/
declare const tdBounceAnimation: AnimationTriggerMetadata;
/**
* const tdFlashAnimation
*
* Parameter Options:
* * duration: Duration the animation will run in milliseconds. Defaults to 500 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * ease: Animation accelerate and decelerate style. Defaults to ease-out.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a flash animation.
*
* usage: [@tdFlash]="{ value: true | false, params: { duration: 200 }}"
*/
declare const tdFlashAnimation: AnimationTriggerMetadata;
/**
* const tdHeadshakeAnimation
*
* Parameter Options:
* * duration: Duration the animation will run in milliseconds. Defaults to 500 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * ease: Animation accelerate and decelerate style. Defaults to ease-out.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a headshake animation.
*
* usage: [@tdHeadshake]="{ value: true | false, params: { duration: 200 }}"
*/
declare const tdHeadshakeAnimation: AnimationTriggerMetadata;
/**
* const tdJelloAnimation
*
* Parameter Options:
* * duration: Duration the animation will run in milliseconds. Defaults to 500 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * ease: Animation accelerate and decelerate style. Defaults to ease-out.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a jello animation.
*
* usage: [@tdJello]="{ value: true | false, params: { duration: 200 }}"
*/
declare const tdJelloAnimation: AnimationTriggerMetadata;
/**
* const tdPulseAnimation
*
* Parameter Options:
* * duration: Duration the animation will run in milliseconds. Defaults to 500 ms.
* * delay: Delay before the animation will run in milliseconds. Defaults to 0 ms.
* * ease: Animation accelerate and decelerate style. Defaults to ease-out.
*
* Returns an [AnimationTriggerMetadata] object with boolean states for a pulse animation.
*
* usage: [@tdPulse]="{ value: true | false, params: { duration: 200 }}"
*/
declare const tdPulseAnimation: AnimationTriggerMetadata;
type Constructor$2<T> = new (...args: any[]) => T;
interface IControlValueAccessor extends ControlValueAccessor {
value: any;
valueChanges: Observable<any>;
onChange: (_: any) => any;
onTouched: () => any;
}
interface IHasChangeDetectorRef {
_changeDetectorRef: ChangeDetectorRef;
}
/** Mixin to augment a component with ngModel support. */
declare function mixinControlValueAccessor<T extends Constructor$2<IHasChangeDetectorRef>>(base: T, initialValue?: any): Constructor$2<IControlValueAccessor> & T;
type Constructor$1<T> = new (...args: any[]) => T;
/** Interface to implement when applying the disabled mixin */
interface ICanDisable {
disabled: boolean;
onDisabledChange(v: boolean): void;
}
/** Mixin to augment a component or directive with a `disabled` property. */
declare function mixinDisabled<T extends Constructor$1<any>>(base: T): Constructor$1<ICanDisable> & T;
type Constructor<T> = new (...args: any[]) => T;
/** Interface to implement when applying the disabled mixin */
interface ICanDisableRipple {
disableRipple: boolean;
onDisableRippleChange(v: boolean): void;
}
/** Mixin to augment a component or directive with a `disabled` property. */
declare function mixinDisableRipple<T extends Constructor<Record<string, unknown>>>(base: T): Constructor<ICanDisableRipple> & T;
declare class CovalentTextfieldValueAccessorDirective implements ControlValueAccessor {
private _elementRef;
_ngControl: NgControl;
private _onChange;
private _onTouched;
constructor();
writeValue(value: string): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
handleChange(event: Event): void;
handleBlur(): void;
setDisabledState(isDisabled: boolean): void;
private _isCheckBox;
private _isRadio;
private _updateValidity;
static ɵfac: i0.ɵɵFactoryDeclaration<CovalentTextfieldValueAccessorDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CovalentTextfieldValueAccessorDirective, "cv-textfield[formControl], cv-textarea[formControl], cv-select[formControl], cv-checkbox[formControl], cv-checkbox-icon[formControl], cv-radio[formControl], cv-radio-icon[formControl], cv-textfield[formControlName], cv-textarea[formControlName], cv-select[formControlName], cv-checkbox[formControlName], cv-checkbox-icon[formControlName], cv-radio[formControlName], cv-radio-icon[formControlName],", never, {}, {}, never, never, true, never>;
}
declare class CovalentValidators {
static min(minValue: any): ValidatorFn;
static max(maxValue: any): ValidatorFn;
static numberRequired(c: AbstractControl): {
[key: string]: any;
};
}
/**
* Assign a text value to the system clipboard. Note: Due to browser
* security restrictions, the copy will only succeed if this method
* is invoked as a result of a user action (eg. user button click).
*
* @param value text value to be assigned to clipboard.
* @returns boolean indicating success/failure of copy operation.
*/
declare function copyToClipboard(value: string): boolean;
/**
* Conversion function that takes an array of objects and converts
* them to CSV format. Custom key and line separators can be specified.
*
* @param objects list of strings in JSON format or actual objects
* @param keySeparator optional parameter to specify custom value separator
* @param lineSeparator optional parameter to specify custom end of line separator
* @returns CSV formatted string
*/
declare function convertObjectsToCSV(objects: any[], keySeparator?: string, lineSeparator?: string): string;
/**
* Conversion function that takes a CSV representation
* of objects and converts them to JSON.
* The first row in the input must be the object keys.
* Custom key separator and line separator can be specified.
* Indentation size for output JSON can be specified.
*
* @param csv list of strings in JSON format or actual objects
* @param keySeparator optional parameter to specify custom value separator
* @param lineSeparator optional parameter to specify custom end of line separator
* @param indent optional parameter indicating space indentation for pretty output. Default is 2.
* @returns JSON formatted string
*/
declare function convertCSVToJSON(csv: string, keySeparator?: string, lineSeparator?: string, indent?: number): string;
/**
* Convert object to JSON using stringify. Indentation size for output JSON can be specified.
*
* @param json object to be converted
* @param indent optional parameter indicating space indentation for pretty output. Default is 2.
*/
declare function formatJSON(json: object, indent?: number): string;
/**
* Download CSV content to the specified file with .csv extension
* appended to the provided base file name.
*
* @param fileBaseName base name of destination file
* @param csv CSV contents
*/
declare function downloadCSV(fileBaseName: string, csv: string): void;
/**
* Download JSON content to the specified file with .json extension
* appended to the provided base file name.
*
* @param fileBaseName base name of destination file
* @param json JSON contents
* @param format indicates if JSON should be prettied
* @param indent optional parameter indicating space indentation for pretty output. Default is 2
*/
declare function downloadJSON(fileBaseName: string, json: string, format?: boolean, indent?: number): void;
/**
* Convert objects to CSV format and download to file with .csv
* extension appended to the provided base file name. Custom key
* separator and line separator can be specified.
*
* @param fileBaseName base name of destination file
* @param objects object array to be converted to CSV format
* prior to writing to download destination
* @param keySeparator optional parameter to specify custom value separator
* @param lineSeparator optional parameter to specify custom end of line separator
*/
declare function downloadObjectsToCSV(fileBaseName: string, objects: any[], keySeparator?: string, lineSeparator?: string): void;
/**
* Convert objects to JSON format and download to file with .json
* extension appended to the provided base file name.
*
* @param fileBaseName base name of destination file
* @param objects object array to be converted to JSON format
* prior to writing to download destination
* @param indent optional parameter indicating space indentation for pretty output. Default is 2
*/
declare function downloadObjectsToJSON(fileBaseName: string, objects: any[], indent?: number): void;
/**
* Download string content to the specified file with desired mime type.
*
* @param fileName full filename (including appropriate extension) of destination file
* @param contents string contents to be written to download destination
* @param mimeType mime type appropriate to file content to support consumption of destination file
*/
declare function downloadFile(fileName: string, contents: string, mimeType?: string): void;
/**
* Read file as UTF-8 text. Return string contents on read completion.
*
* @param file filename or File object
* @returns promise that resolves to file content string
*/
declare function readFile(file: File): Promise<string>;
export { CovalentCommonModule, CovalentTextfieldValueAccessorDirective, CovalentValidators, TdAutoTrimDirective, TdBytesPipe, TdDecimalBytesPipe, TdDigitsPipe, TdFullscreenDirective, TdTimeAgoPipe, TdTimeDifferencePipe, TdTimeUntilPipe, TdTruncatePipe, convertCSVToJSON, convertObjectsToCSV, copyToClipboard, downloadCSV, downloadFile, downloadJSON, downloadObjectsToCSV, downloadObjectsToJSON, formatJSON, mixinControlValueAccessor, mixinDisableRipple, mixinDisabled, readFile, tdBounceAnimation, tdCollapseAnimation, tdFadeInOutAnimation, tdFlashAnimation, tdHeadshakeAnimation, tdJelloAnimation, tdPulseAnimation, tdRotateAnimation };
export type { ICanDisable, ICanDisableRipple, ICollapseAnimation, IControlValueAccessor, IFadeInOutAnimation, IHasChangeDetectorRef, IRotateAnimation };