UNPKG

igniteui-angular

Version:

Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps

329 lines (328 loc) 11.4 kB
import { InjectionToken } from '@angular/core'; import { Observable } from 'rxjs'; import { IgxTheme } from '../services/theme/theme.token'; import * as i0 from "@angular/core"; /** @hidden @internal */ export declare const ELEMENTS_TOKEN: InjectionToken<boolean>; /** * @hidden */ export declare const showMessage: (message: string, isMessageShown: boolean) => boolean; export declare const mkenum: <T extends { [index: string]: U; }, U extends string>(x: T) => T; /** * * @hidden @internal */ export declare const getResizeObserver: () => { new (callback: ResizeObserverCallback): ResizeObserver; prototype: ResizeObserver; }; /** * @hidden */ export declare const cloneArray: (array: any[], deep?: boolean) => any[]; /** * Doesn't clone leaf items * * @hidden */ export declare const cloneHierarchicalArray: (array: any[], childDataKey: any) => any[]; /** * Creates an object with prototype from provided source and copies * all properties descriptors from provided source * @param obj Source to copy prototype and descriptors from * @returns New object with cloned prototype and property descriptors */ export declare const copyDescriptors: (obj: any) => any; /** * Deep clones all first level keys of Obj2 and merges them to Obj1 * * @param obj1 Object to merge into * @param obj2 Object to merge from * @returns Obj1 with merged cloned keys from Obj2 * @hidden */ export declare const mergeObjects: (obj1: any, obj2: any) => any; /** * Creates deep clone of provided value. * Supports primitive values, dates and objects. * If passed value is array returns shallow copy of the array. * * @param value value to clone * @returns Deep copy of provided value * @hidden */ export declare const cloneValue: (value: any) => any; /** * Creates deep clone of provided value. * Supports primitive values, dates and objects. * If passed value is array returns shallow copy of the array. * For Objects property values and references are cached and reused. * This allows for circular references to same objects. * * @param value value to clone * @param cache map of cached values already parsed * @returns Deep copy of provided value * @hidden */ export declare const cloneValueCached: (value: any, cache: Map<any, any>) => any; /** * Parse provided input to Date. * * @param value input to parse * @returns Date if parse succeed or null * @hidden */ export declare const parseDate: (value: any) => Date | null; /** * Returns an array with unique dates only. * * @param columnValues collection of date values (might be numbers or ISO 8601 strings) * @returns collection of unique dates. * @hidden */ export declare const uniqueDates: (columnValues: any[]) => any; /** * Checks if provided variable is Object * * @param value Value to check * @returns true if provided variable is Object * @hidden */ export declare const isObject: (value: any) => boolean; /** * Checks if provided variable is Date * * @param value Value to check * @returns true if provided variable is Date * @hidden */ export declare const isDate: (value: any) => value is Date; /** * Checks if the two passed arguments are equal * Currently supports date objects * * @param obj1 * @param obj2 * @returns: `boolean` * @hidden */ export declare const isEqual: (obj1: any, obj2: any) => boolean; /** * Utility service taking care of various utility functions such as * detecting browser features, general cross browser DOM manipulation, etc. * * @hidden @internal */ export declare class PlatformUtil { private platformId; isBrowser: boolean; isIOS: boolean; isSafari: boolean; isFirefox: boolean; isEdge: boolean; isChromium: boolean; browserVersion: number; /** @hidden @internal */ isElements: boolean; KEYMAP: { ENTER: "Enter"; SPACE: " "; ESCAPE: "Escape"; ARROW_DOWN: "ArrowDown"; ARROW_UP: "ArrowUp"; ARROW_LEFT: "ArrowLeft"; ARROW_RIGHT: "ArrowRight"; END: "End"; HOME: "Home"; PAGE_DOWN: "PageDown"; PAGE_UP: "PageUp"; F2: "F2"; TAB: "Tab"; SEMICOLON: ";"; DELETE: "Delete"; BACKSPACE: "Backspace"; CONTROL: "Control"; X: "x"; Y: "y"; Z: "z"; }; constructor(platformId: any); /** * @hidden @internal * Returns the actual size of the node content, using Range * ```typescript * let range = document.createRange(); * let column = this.grid.columnList.filter(c => c.field === 'ID')[0]; * * let size = getNodeSizeViaRange(range, column.cells[0].nativeElement); * * @remarks * The last parameter is useful when the size of the element to measure is modified by a * parent element that has explicit size. In such cases the calculated size is never lower * and the function may instead remove the parent size while measuring to get the correct value. * ``` */ getNodeSizeViaRange(range: Range, node: HTMLElement, sizeHoldingNode?: HTMLElement): number; /** * Returns true if the current keyboard event is an activation key (Enter/Space bar) * * @hidden * @internal * * @memberof PlatformUtil */ isActivationKey(event: KeyboardEvent): boolean; /** * Returns true if the current keyboard event is a combination that closes the filtering UI of the grid. (Escape/Ctrl+Shift+L) * * @hidden * @internal * @param event * @memberof PlatformUtil */ isFilteringKeyCombo(event: KeyboardEvent): boolean; /** * @hidden @internal */ isLeftClick(event: PointerEvent | MouseEvent): boolean; /** * @hidden @internal */ isNavigationKey(key: string): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<PlatformUtil, never>; static ɵprov: i0.ɵɵInjectableDeclaration<PlatformUtil>; } /** * @hidden */ export declare const flatten: (arr: any[]) => any[]; export interface CancelableEventArgs { /** * Provides the ability to cancel the event. */ cancel: boolean; } export interface IBaseEventArgs { /** * Provides reference to the owner component. */ owner?: any; } export interface CancelableBrowserEventArgs extends CancelableEventArgs { /** Browser event */ event?: Event; } export interface IBaseCancelableBrowserEventArgs extends CancelableBrowserEventArgs, IBaseEventArgs { } export interface IBaseCancelableEventArgs extends CancelableEventArgs, IBaseEventArgs { } export declare const HORIZONTAL_NAV_KEYS: Set<string>; export declare const NAVIGATION_KEYS: Set<string>; export declare const ACCORDION_NAVIGATION_KEYS: Set<string>; export declare const ROW_EXPAND_KEYS: Set<string>; export declare const ROW_COLLAPSE_KEYS: Set<string>; export declare const ROW_ADD_KEYS: Set<string>; export declare const SUPPORTED_KEYS: Set<string>; export declare const HEADER_KEYS: Set<string>; /** * @hidden * @internal * * Creates a new ResizeObserver on `target` and returns it as an Observable. * Run the resizeObservable outside angular zone, because it patches the MutationObserver which causes an infinite loop. * Related issue: https://github.com/angular/angular/issues/31712 */ export declare const resizeObservable: (target: HTMLElement) => Observable<ResizeObserverEntry[]>; /** * @hidden * @internal * * Compares two maps. */ export declare const compareMaps: (map1: Map<any, any>, map2: Map<any, any>) => boolean; /** * * Given a property access path in the format `x.y.z` resolves and returns * the value of the `z` property in the passed object. * * @hidden * @internal */ export declare const resolveNestedPath: (obj: any, path: string) => any; /** * * Given a property access path in the format `x.y.z` and a value * this functions builds and returns an object following the access path. * * @example * ```typescript * console.log('x.y.z.', 42); * >> { x: { y: { z: 42 } } } * ``` * * @hidden * @internal */ export declare const reverseMapper: (path: string, value: any) => {}; export declare const yieldingLoop: (count: number, chunkSize: number, callback: (index: number) => void, done: () => void) => void; export declare const isConstructor: (ref: any) => boolean; /** * Similar to Angular's formatDate. However it will not throw on `undefined | null | ''` instead * coalescing to an empty string. */ export declare const formatDate: (value: string | number | Date, format: string, locale: string, timezone?: string) => string; export declare const formatCurrency: { (value: number | string, currencyCode?: string, display?: "code" | "symbol" | "symbol-narrow" | string | boolean, digitsInfo?: string, locale?: string): string | null; (value: null | undefined, currencyCode?: string, display?: "code" | "symbol" | "symbol-narrow" | string | boolean, digitsInfo?: string, locale?: string): null; (value: number | string | null | undefined, currencyCode?: string, display?: "code" | "symbol" | "symbol-narrow" | string | boolean, digitsInfo?: string, locale?: string): string | null; }; /** Converts pixel values to their rem counterparts for a base value */ export declare const rem: (value: number | string) => number; /** Get the size of the component as derived from the CSS size variable */ export declare function getComponentSize(el: Element): string; /** Get the first item in an array */ export declare function first<T>(arr: T[]): T; /** Get the last item in an array */ export declare function last<T>(arr: T[]): T; /** Calculates the modulo of two numbers, ensuring a non-negative result. */ export declare function modulo(n: number, d: number): number; /** * Splits an array into chunks of length `size` and returns a generator * yielding each chunk. * The last chunk may contain less than `size` elements. * * @example * ```typescript * const arr = [0,1,2,3,4,5,6,7,8,9]; * * Array.from(chunk(arr, 2)) // [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]] * Array.from(chunk(arr, 3)) // [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] * Array.from(chunk([], 3)) // [] * Array.from(chunk(arr, -3)) // Error * ``` */ export declare function intoChunks<T>(arr: T[], size: number): Generator<T[], void, unknown>; /** * @param size * @returns string that represents the --component-size default value */ export declare function getComponentCssSizeVar(size: string): "var(--ig-size, var(--ig-size-small))" | "var(--ig-size, var(--ig-size-medium))" | "var(--ig-size, var(--ig-size-large))"; /** * @param path - The URI path to be normalized. * @returns string encoded using the encodeURI function. */ export declare function normalizeURI(path: string): string; export declare function getComponentTheme(el: Element): IgxTheme; /** * Collection re-created w/ the built in track by identity will always log * warning even for valid cases of recalculating all collection items. * See https://github.com/angular/angular/blob/55581b4181639568fb496e91055142a1b489e988/packages/core/src/render3/instructions/control_flow.ts#L393-L409 * Current solution explicit track function doing the same as suggested in: * https://github.com/angular/angular/issues/56471#issuecomment-2180315803 * This should be used with moderation and when necessary. * @internal */ export declare function trackByIdentity<T>(item: T): T;