ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
273 lines (238 loc) • 11.4 kB
TypeScript
import { TemplateRef } from '@angular/core';
import { IndexableObject, NzSafeAny, FunctionProp, NgStyleInterface, NzValidateStatus, NgClassInterface, NzVariant } from 'ng-zorro-antd/core/types';
import { Observable } from 'rxjs';
/**
* 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 function toArray<T>(value: T | T[]): T[];
declare function arraysEqual<T>(array1: T[], array2: T[]): boolean;
declare function shallowCopyArray<T>(source: T[]): T[];
/**
* 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 function isNotNil<T>(value: T): value is NonNullable<T>;
declare function isNil(value: unknown): value is null | undefined;
/**
* Examine if two objects are shallowly equaled.
*/
declare function shallowEqual(objA?: IndexableObject, objB?: IndexableObject): boolean;
declare function isNonEmptyString(value: NzSafeAny): boolean;
declare function isTemplateRef<T>(value: TemplateRef<T> | NzSafeAny): value is TemplateRef<T>;
/**
* 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 function toBoolean(value: unknown): boolean;
declare function numberAttributeWithZeroFallback(value: unknown): number;
declare function numberAttributeWithOneFallback(value: unknown): number;
declare function numberAttributeWithInfinityFallback(value: unknown): number;
declare function toNumber(value: number | string): number;
declare function toNumber<D>(value: number | string, fallback: D): number | D;
declare function toCssPixel(value: number | string): string;
/**
* Get the function-property type's value
*/
declare function valueFunctionProp<T>(prop: FunctionProp<T> | T, ...args: NzSafeAny[]): T;
/**
* @deprecated Use input transform instead: `@Input({ transform })`
*
* Input decorator that handle a prop to do get/set automatically with toBoolean
*
* Why not using @InputBoolean alone without @Input? AOT needs @Input to be visible
*
* @howToUse
* ```
* @Input() @InputBoolean() visible: boolean = false;
*
* // Act as below:
* // @Input()
* // get visible() { return this.__visible; }
* // set visible(value) { this.__visible = value; }
* // __visible = false;
* ```
*/
declare function InputBoolean(): NzSafeAny;
/**
* @deprecated Use input transform instead: `@Input({ transform })`
*/
declare function InputCssPixel(): NzSafeAny;
/**
* @deprecated Use input transform instead: `@Input({ transform })`
*/
declare function InputNumber(fallbackValue?: NzSafeAny): NzSafeAny;
/**
* 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
*/
/**
* This module provides utility functions to query DOM information or
* set properties.
*/
/**
* Silent an event by stopping and preventing it.
*/
declare function silentEvent(e: Event): void;
declare function getElementOffset(elem: HTMLElement): {
top: number;
left: number;
};
/**
* Investigate if an event is a `TouchEvent`.
*/
declare function isTouchEvent(event: MouseEvent | TouchEvent): event is TouchEvent;
declare function getEventPosition(event: MouseEvent | TouchEvent): MouseEvent | Touch;
interface MouseTouchObserverConfig {
end: string;
move: string;
pluckKey: string[];
start: string;
end$?: Observable<Event>;
moveResolved$?: Observable<number>;
startPlucked$?: Observable<number>;
filter?(e: Event): boolean;
}
/**
* 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 function getRegExp(prefix: string | string[]): RegExp;
declare function getMentions(value: string, prefix?: string | string[]): string[];
/**
* 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
*/
/**
* Much like lodash.
*/
declare function padStart(toPad: string, length: number, element: string): string;
declare function padEnd(toPad: string, length: number, element: string): string;
declare function getRepeatedElement(length: number, element: string): string;
/**
* 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 function isPromise<T>(obj: NzSafeAny): obj is Promise<T>;
/**
* 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 function getPercent(min: number, max: number, value: number): number;
declare function getPrecision(num: number): number;
declare function ensureNumberInRange(num: number, min: number, max: number): number;
declare function isNumberFinite(value: NzSafeAny): boolean;
declare function toDecimal(value: number, decimal: number): number;
declare function sum(input: number[], initial?: number): 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 function scrollIntoView(node: HTMLElement): 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 const properties: string[];
interface Coordinates {
top: number;
left: number;
height: number;
}
declare function getCaretCoordinates(element: HTMLInputElement | HTMLTextAreaElement, position: number, options?: {
debug?: boolean;
}): Coordinates;
declare function createDebugEle(element: HTMLInputElement | HTMLTextAreaElement, coordinates: Coordinates): 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 function isStyleSupport(styleName: string | string[]): boolean;
declare function getStyleAsText(styles?: NgStyleInterface): string;
/**
* 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 MeasureResult {
finished: boolean;
node: Node | null;
}
declare function pxToNumber(value: string | null): number;
declare function measure(originEle: HTMLElement, rows: number, contentNodes: Node[], fixedContent: HTMLElement[], ellipsisStr: string, suffixStr?: string): {
contentNodes: Node[];
text: string;
ellipsis: boolean;
};
/**
* 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 function measureScrollbar(direction?: 'vertical' | 'horizontal', prefix?: string): 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 function ensureInBounds(value: number, boundValue: number): 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 function inNextTick(): Observable<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 function wrapIntoObservable<T>(value: T | Promise<T> | Observable<T>): Observable<T>;
/**
* 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
*/
/**
* Sync from rc-util [https://github.com/react-component/util]
*/
declare function canUseDom(): boolean;
/**
* 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 Options {
attachTo?: Element;
cspNonce?: string | null;
prepend?: boolean;
mark?: string;
}
declare function injectCSS(css: string, options?: Options): HTMLStyleElement | null;
declare function removeCSS(key: string, option?: Options): void;
declare function updateCSS(css: string, key: string, options?: Options): HTMLStyleElement | null;
/**
* 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 function getStatusClassNames(prefixCls: string, status?: NzValidateStatus, hasFeedback?: boolean): NgClassInterface;
/**
* 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
*/
/**
* This function replaces `runOutsideAngular` with `fromEvent`, introducing a
* lot of boilerplate where we need to inject the `NgZone` service and then subscribe
* to `fromEvent` within the `runOutsideAngular` callback.
*/
declare function fromEventOutsideAngular<TEvent extends Event>(target: EventTarget | null | undefined, name: string, options?: boolean | AddEventListenerOptions): Observable<TEvent>;
/**
* 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 function getVariantClassNames(prefixCls: string, variant?: NzVariant, borderless?: boolean): NgClassInterface;
/**
* 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
*/
/**
* Escapes all potentially dangerous characters, so that the
* resulting string can be safely inserted into attribute or
* element text.
*/
declare function encodeEntities(value: string): string;
export { InputBoolean, InputCssPixel, InputNumber, arraysEqual, canUseDom, createDebugEle, encodeEntities, ensureInBounds, ensureNumberInRange, fromEventOutsideAngular, getCaretCoordinates, getElementOffset, getEventPosition, getMentions, getPercent, getPrecision, getRegExp, getRepeatedElement, getStatusClassNames, getStyleAsText, getVariantClassNames, inNextTick, injectCSS, isNil, isNonEmptyString, isNotNil, isNumberFinite, isPromise, isStyleSupport, isTemplateRef, isTouchEvent, measure, measureScrollbar, numberAttributeWithInfinityFallback, numberAttributeWithOneFallback, numberAttributeWithZeroFallback, padEnd, padStart, properties, pxToNumber, removeCSS, scrollIntoView, shallowCopyArray, shallowEqual, silentEvent, sum, toArray, toBoolean, toCssPixel, toDecimal, toNumber, updateCSS, valueFunctionProp, wrapIntoObservable };
export type { Coordinates, MeasureResult, MouseTouchObserverConfig };