UNPKG

@grapecity/wijmo

Version:

UI library for pure JS, Angular, React, Vue and more...

1,536 lines • 170 kB
/*! * * Wijmo Library 5.20252.42 * https://developer.mescius.com/wijmo * * Copyright(c) MESCIUS inc. All rights reserved. * * Licensed under the End-User License Agreement For MESCIUS Wijmo Software. * us.sales@mescius.com * https://developer.mescius.com/wijmo/licensing * */ /** * {@module wijmo} * Contains utilities used by all controls and modules, as well as the * {@link Control} and {@link Event} classes. */ /** * */ export declare var ___keepComment: any; import * as selfModule from '@grapecity/wijmo'; /** * Provides binding to complex properties (e.g. 'customer.address.city') */ export declare class Binding { _path: string; _parts: any[]; _key: string; /** * Initializes a new instance of the {@link Binding} class. * * @param path Name of the property to bind to. */ constructor(path: string); /** * Gets or sets the path for the binding. * * In the simplest case, the path is the name of the property of the source * object to use for the binding (e.g. 'street'). * * Sub-properties of a property can be specified by a syntax similar to that * used in JavaScript (e.g. 'address.street'). */ path: string; /** * Gets the binding value for a given object. * * If the object does not contain the property specified by the * binding {@link path}, the method returns null. * * @param object The object that contains the data to be retrieved. */ getValue(object: any): any; /** * Sets the binding value on a given object. * * If the object does not contain the property specified by the * binding {@link path}, the value is not set. * * @param object The object that contains the data to be set. * @param value Data value to set. * @returns True if the value was assigned correctly, false otherwise. */ setValue(object: any, value: any): boolean; } /** * Represents an event handler. * * Event handlers are functions invoked when events are raised. * * Every event handler has two arguments: * <ul> * <li><b>sender</b> is the object that raised the event, and</li> * <li><b>args</b> is an optional object that contains the event parameters.</li> * </ul> * * Read more about <a href="https://developer.mescius.com/blogs/html-and-wijmo-events" target="_blank">Wijmo Events</a>. * */ export interface IEventHandler<S = any, T = EventArgs> { (sender: S, args: T): void; } /** * Represents an event. * * Wijmo events are similar to .NET events. Any class may define events by * declaring them as fields. Any class may subscribe to events using the * event's {@link addHandler} method and unsubscribe using the {@link removeHandler} * method. * * Wijmo event handlers take two parameters: <i>sender</i> and <i>args</i>. * The first is the object that raised the event, and the second is an object * that contains the event parameters. * * Classes that define events follow the .NET pattern where for every event * there is an <i>on[EVENTNAME]</i> method that raises the event. This pattern * allows derived classes to override the <i>on[EVENTNAME]</i> method and * handle the event before and/or after the base class raises the event. * Derived classes may even suppress the event by not calling the base class * implementation. * * For example, the TypeScript code below overrides the <b>onValueChanged</b> * event for a control to perform some processing before and after the * <b>valueChanged</b> event fires: * * <pre>// override base class * onValueChanged(e: EventArgs) { * // execute some code before the event fires * console.log('about to fire valueChanged'); * // optionally, call base class to fire the event * super.onValueChanged(e); * // execute some code after the event fired * console.log('valueChanged event just fired'); * }</pre> */ export declare class Event<S = any, T = EventArgs> { private _handlers; private _handlersChanged; /** * Initializes a new instance of an {@link Event}. * * @param handlersChanged Optional callback invoked when handlers are * added or removed from this {@link Event}. */ constructor(handlersChanged?: Function); /** * Adds a handler to this event. * * @param handler Function invoked when the event is raised. * @param self Object that defines the event handler * (accessible as 'this' from the handler code). */ addHandler(handler: IEventHandler<S, T>, self?: any): void; /** * Gets a handler to this event. * * @param index Desired handle index number, this is usually zero. */ getHandler(index?: number): IEventHandler | void; /** * Removes a handler from this event. * * @param handler Function invoked when the event is raised. * @param self Object that owns the event handler (accessible as 'this' from the handler code). */ removeHandler(handler: IEventHandler<S, T>, self?: any): void; /** * Removes all handlers associated with this event. */ removeAllHandlers(): void; /** * Raises this event, causing all associated handlers to be invoked. * * @param sender Source object. * @param args Event parameters. */ raise(sender: any, args?: EventArgs): void; /** * Gets a value that indicates whether this event has any handlers. */ readonly hasHandlers: boolean; /** * Gets the number of handlers added to this event. */ readonly handlerCount: number; } /** * Base class for event arguments. */ export declare class EventArgs { /** * Provides a value to use with events that do not have event data. */ static empty: EventArgs; } /** * Provides arguments for cancellable events. */ export declare class CancelEventArgs extends EventArgs { /** * Gets or sets a value that indicates whether the event should be canceled. */ cancel: boolean; } /** * Provides arguments for property change events. */ export declare class PropertyChangedEventArgs extends EventArgs { _name: string; _oldVal: any; _newVal: any; /** * Initializes a new instance of the {@link PropertyChangedEventArgs} class. * * @param propertyName The name of the property whose value changed. * @param oldValue The old value of the property. * @param newValue The new value of the property. */ constructor(propertyName: string, oldValue: any, newValue: any); /** * Gets the name of the property whose value changed. */ readonly propertyName: string; /** * Gets the old value of the property. */ readonly oldValue: any; /** * Gets the new value of the property. */ readonly newValue: any; } /** * Provides arguments for * <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest" target="_blank">XMLHttpRequest</a> * error events. */ export declare class RequestErrorEventArgs extends CancelEventArgs { _xhr: XMLHttpRequest; _msg: string; /** * Initializes a new instance of the {@link RequestErrorEventArgs} class. * * @param xhr The <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest" target="_blank">XMLHttpRequest</a> * that detected the error. * The 'status' and 'statusText' properties of the request object contain details about the error. * @param msg Optional error message. */ constructor(xhr: XMLHttpRequest, msg?: string); /** * Gets a reference to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest" target="_blank">XMLHttpRequest</a> * that detected the error. * * The status and statusText properties of the request object contain * details about the error. */ readonly request: XMLHttpRequest; /** * Gets or sets an error message to display to the user. */ message: string; } /** * Notifies listeners of dynamic changes, such as when items get added and * removed or when the collection is sorted, filtered, or grouped. */ export interface INotifyCollectionChanged { /** * Occurs when the collection changes. */ collectionChanged: Event<INotifyCollectionChanged, NotifyCollectionChangedEventArgs>; } /** * Describes the action that caused the {@link INotifyCollectionChanged.collectionChanged} * event to fire. */ export declare enum NotifyCollectionChangedAction { /** An item was added to the collection. */ Add = 0, /** An item was removed from the collection. */ Remove = 1, /** An item was changed or replaced. */ Change = 2, /** * Several items changed simultaneously * (for example, the collection was sorted, filtered, or grouped). */ Reset = 3 } /** * Provides data for the {@link INotifyCollectionChanged.collectionChanged} event. */ export declare class NotifyCollectionChangedEventArgs<T = any> extends EventArgs { /** * Provides a reset notification. */ static reset: NotifyCollectionChangedEventArgs<any>; /** * Gets the action that caused the event to fire. */ action: NotifyCollectionChangedAction; /** * Gets the item that was added, removed, or changed. */ item: T; /** * Gets the index at which the change occurred. */ index: number; /** * Initializes a new instance of the {@link NotifyCollectionChangedEventArgs} class. * * @param action Type of action that caused the event to fire. * @param item Item that was added or changed. * @param index Index of the item. */ constructor(action?: NotifyCollectionChangedAction, item?: T, index?: number); } /** * Represents a method that takes an item of any type and returns a * boolean that indicates whether the object meets a set of criteria. */ export interface IPredicate<T = any> { /** * @param item Data item to test. * @returns true if the item passes the test, false otherwise. */ (item: T): boolean; } /** * Represents a method that compares two objects. */ export interface IComparer<T = any> { /** * @param item1 First object to compare. * @param item2 Second object to compare. * @returns -1, 0, or +1 to indicate that the first item is smaller than, equal to, or created than the second. */ (item1: T, item2: T): number; } /** * Represents a method that takes an item and a property name * and returns a group name. */ export interface IGroupConverter<T = any> { /** * @param item Data item being grouped. * @param property Name of the property being grouped on. * @return Name of the group to use for this data item. */ (item: T, property: string): string; } /** * Describes a sorting criterion. */ export declare class SortDescription { _bnd: Binding; _asc: boolean; /** * Initializes a new instance of the {@link SortDescription} class. * * @param property Name of the property to sort on. * @param ascending Whether to sort in ascending order. */ constructor(property: string, ascending: boolean); /** * Gets the name of the property used to sort. */ readonly property: string; /** * Gets a value that determines whether to sort the values in ascending order. */ readonly ascending: boolean; } /** * Enables collections to have the functionalities of current record management, * custom sorting, filtering, and grouping. * * This is a JavaScript version of the <b>ICollectionView</b> interface used in * Microsoft's XAML platform. It provides a consistent, powerful, and MVVM-friendly * way to bind data to UI elements. * * Wijmo includes several classes that implement {@link ICollectionView}. The most * common is {@link CollectionView}, which works based on regular JavsScript * arrays. */ export interface ICollectionView<T = any> extends INotifyCollectionChanged, IQueryInterface { /** * Gets a value that indicates whether this view supports filtering via the * {@link filter} property. */ canFilter: boolean; /** * Gets a value that indicates whether this view supports grouping via the * {@link groupDescriptions} property. */ canGroup: boolean; /** * Gets a value that indicates whether this view supports sorting via the * {@link sortDescriptions} property. */ canSort: boolean; /** * Gets the current item in the view. */ currentItem: T; /** * Gets the ordinal position of the current item in the view. */ currentPosition: number; /** * Gets or sets a callback used to determine if an item is suitable for * inclusion in the view. * * NOTE: If the filter function needs a scope (i.e. a meaningful 'this' * value), then remember to set the filter using the 'bind' function to * specify the 'this' object. For example: * <pre> * collectionView.filter = this._filter.bind(this); * </pre> */ filter: IPredicate<T> | null; /** * Gets a collection of {@link GroupDescription} objects that describe how the * items in the collection are grouped in the view. */ groupDescriptions: ObservableArray<GroupDescription>; /** * Gets the top-level groups. */ groups: any[]; /** * Gets a value that indicates whether this view contains no items. */ isEmpty: boolean; /** * Gets a collection of {@link SortDescription} objects that describe how the items * in the collection are sorted in the view. */ sortDescriptions: ObservableArray<SortDescription>; /** * Gets or sets the collection object from which to create this view. */ sourceCollection: T[]; /** * Returns a value that indicates whether a given item belongs to this view. * * @param item The item to locate in the collection. */ contains(item: T): boolean; /** * Sets the specified item to be the current item in the view. * * @param item The item to set as the {@link currentItem}. */ moveCurrentTo(item: T): boolean; /** * Sets the first item in the view as the current item. */ moveCurrentToFirst(): boolean; /** * Sets the last item in the view as the current item. */ moveCurrentToLast(): boolean; /** * Sets the item after the current item in the view as the current item. */ moveCurrentToNext(): boolean; /** * Sets the item at the specified index in the view as the current item. * * @param index The index of the item to set as the {@link currentItem}. */ moveCurrentToPosition(index: number): boolean; /** * Sets the item before the current item in the view as the current item. */ moveCurrentToPrevious(): boolean; /** * Re-creates the view using the current sort, filter, and group parameters. */ refresh(): void; /** * Occurs after the current item changes. */ currentChanged: Event<ICollectionView, EventArgs>; /** * Occurs before the current item changes. */ currentChanging: Event<ICollectionView, EventArgs>; /** * Suspends refreshes until the next call to {@link endUpdate}. */ beginUpdate(): void; /** * Resumes refreshes suspended by a call to {@link beginUpdate}. * * @param force Whether to force a refresh when ending the update. */ endUpdate(force?: boolean): void; /** * Executes a function within a beginUpdate/endUpdate block. * * The collection will not be refreshed until the function has been executed. * This method ensures endUpdate is called even if the function throws. * * @param fn Function to be executed within the beginUpdate/endUpdate block. * @param force Whether to force a refresh when ending the update. */ deferUpdate(fn: Function, force?: boolean): void; /** * Gets the filtered, sorted, grouped items in the view. */ items: T[]; } /** * Defines methods and properties that extend {@link ICollectionView} to provide * editing capabilities. */ export interface IEditableCollectionView<T = any> extends ICollectionView { /** * Gets a value that indicates whether a new item can be added to the collection. */ canAddNew: boolean; /** * Gets a value that indicates whether the collection view can discard pending changes * and restore the original values of an edited object. */ canCancelEdit: boolean; /** * Gets a value that indicates whether items can be removed from the collection. */ canRemove: boolean; /** * Gets the item that is being added during the current add transaction. */ currentAddItem: T; /** * Gets the item that is being edited during the current edit transaction. */ currentEditItem: T; /** * Gets a value that indicates whether an add transaction is in progress. */ isAddingNew: boolean; /** * Gets a value that indicates whether an edit transaction is in progress. */ isEditingItem: boolean; /** * Adds a new item to the collection. * * @return The item that was added to the collection. */ addNew(): any; /** * Ends the current edit transaction and, if possible, * restores the original value to the item. */ cancelEdit(): void; /** * Ends the current add transaction and discards the pending new item. */ cancelNew(): void; /** * Ends the current edit transaction and saves the pending changes. */ commitEdit(): void; /** * Ends the current add transaction and saves the pending new item. */ commitNew(): void; /** * Begins an edit transaction of the specified item. * * @param item Item to edit. */ editItem(item: T): void; /** * Removes the specified item from the collection. * * @param item Item to remove from the collection. */ remove(item: T): void; /** * Removes the item at the specified index from the collection. * * @param index Index of the item to remove from the collection. */ removeAt(index: number): void; } /** * Defines methods and properties that extend {@link ICollectionView} to provide * paging capabilities. */ export interface IPagedCollectionView extends ICollectionView { /** * Gets a value that indicates whether the {@link pageIndex} value can change. */ canChangePage: boolean; /** * Gets a value that indicates whether the index is changing. */ isPageChanging: boolean; /** * Gets the number of items in the view taking paging into account. * * To get the total number of items, use the {@link totalItemCount} property. * * Notice that this is different from the .NET <b>IPagedCollectionView</b>, * where <b>itemCount</b> and <b>totalItemCount</b> both return the count * before paging is applied. */ itemCount: number; /** * Gets the zero-based index of the current page. */ pageIndex: number; /** * Gets or sets the number of items to display on each page. */ pageSize: number; /** * Gets the total number of items in the view before paging is applied. * * To get the number of items in the current view taking paging into * account, use the {@link itemCount} property. * * Notice that this is different from the .NET <b>IPagedCollectionView</b>, * where <b>itemCount</b> and <b>totalItemCount</b> both return the count * before paging is applied. */ totalItemCount: number; /** * Sets the first page as the current page. */ moveToFirstPage(): boolean; /** * Sets the last page as the current page. */ moveToLastPage(): boolean; /** * Moves to the page after the current page. */ moveToNextPage(): boolean; /** * Moves to the page at the specified index. * * @param index Index of the page to move to. */ moveToPage(index: number): boolean; /** * Moves to the page before the current page. */ moveToPreviousPage(): boolean; /** * Occurs after the page index changes. */ pageChanged: Event<IPagedCollectionView, EventArgs>; /** * Occurs before the page index changes. */ pageChanging: Event<IPagedCollectionView, PageChangingEventArgs>; } /** * Provides data for the {@link IPagedCollectionView.pageChanging} event */ export declare class PageChangingEventArgs extends CancelEventArgs { /** * Gets the index of the page that is about to become current. */ newPageIndex: number; /** * Initializes a new instance of the {@link PageChangingEventArgs} class. * * @param newIndex Index of the page that is about to become current. */ constructor(newIndex: number); } /** * Represents a base class for types defining grouping conditions. * * The concrete class which is commonly used for this purpose is * {@link PropertyGroupDescription}. */ export declare class GroupDescription { /** * Returns the group name for the given item. * * @param item The item to get group name for. * @param level The zero-based group level index. * @return The name of the group the item belongs to. */ groupNameFromItem(item: any, level: number): any; /** * Returns a value that indicates whether the group name and the item name * match (which implies that the item belongs to the group). * * @param groupName The name of the group. * @param itemName The name of the item. * @return True if the names match; otherwise, false. */ namesMatch(groupName: any, itemName: any): boolean; } /** * Describes the grouping of items using a property name as the criterion. * * For example, the code below causes a {@link CollectionView} to group items * by the value of their 'country' property: * <pre> * var cv = new wijmo.collections.CollectionView(items); * var gd = new wijmo.collections.PropertyGroupDescription('country'); * cv.groupDescriptions.push(gd); * </pre> * * You may also specify a callback function that generates the group name. * For example, the code below causes a {@link CollectionView} to group items * by the first letter of the value of their 'country' property: * <pre> * var cv = new wijmo.collections.CollectionView(items); * var gd = new wijmo.collections.PropertyGroupDescription('country', * function(item, propName) { * return item[propName][0]; // return country's initial * }); * cv.groupDescriptions.push(gd); * </pre> */ export declare class PropertyGroupDescription extends GroupDescription { _bnd: Binding; _converter: IGroupConverter; /** * Initializes a new instance of the {@link PropertyGroupDescription} class. * * @param property The name of the property that specifies * which group an item belongs to. * @param converter A callback function that takes an item and * a property name and returns the group name. If not specified, * the group name is the property value for the item. */ constructor(property: string, converter?: IGroupConverter); /** * Gets the name of the property that is used to determine which * group an item belongs to. */ readonly propertyName: string; /** * Returns the group name for the given item. * * @param item The item to get group name for. * @param level The zero-based group level index. * @return The name of the group the item belongs to. */ groupNameFromItem(item: any, level: number): any; /** * Returns a value that indicates whether the group name and the item name * match (which implies that the item belongs to the group). * * @param groupName The name of the group. * @param itemName The name of the item. * @return True if the names match; otherwise, false. */ namesMatch(groupName: any, itemName: any): boolean; } export declare const empty: {}; export declare const ClipboardClsNames: { clipboard: string; }; export declare const ControlClsNames: { content: string; hostElement: string; template: string; }; export declare const ControlStateClsNames: { active: string; checked: string; collapsed: string; collapsing: string; disabled: string; dragSrc: string; empty: string; focus: string; focused: string; invalid: string; lastSelected: string; loading: string; match: string; exactMatchSpace: string; measuring: string; multiSelected: string; pinned: string; readOnly: string; selected: string; sticky: string; updating: string; labeledInput: string; wjError: string; errorVisible: string; }; export declare const GlyphClsNames: { backward: string; btnGlyph: string; calendar: string; circle: string; clock: string; down: string; downLeft: string; drag: string; file: string; filter: string; forward: string; glyph: string; left: string; minus: string; plus: string; right: string; stepBackward: string; stepForward: string; up: string; }; export declare const InputFormElementsClsNames: { btn: string; btnDefault: string; btnGroup: string; btnGroupVertical: string; btnsOutside: string; formControl: string; svgBtn: string; }; export declare const PrintDocumentClsNames: { printDocument: string; }; export declare const TooltipClsNames: { hostElement: string; }; export declare const UtilitesClsNames: { align: string; alignVCenter: string; animated: string; centerVert: string; close: string; hide: string; hideOk: string; remove: string; right: string; rtl: string; separator: string; }; export declare const ForeignClsNames: { InputClsNames: { input: string; inputBtnVisible: string; inputGroup: string; inputGroupBtn: string; }; SelectorClsNames: { columnSelector: string; columnSelectorGroup: string; }; }; export declare function isMobile(): boolean; export declare function isiOS(): boolean; export declare function isFirefox(): boolean; export declare function isSafari(): boolean; export declare function isEdge(): boolean; export declare function isIE(): boolean; export declare function isIE9(): boolean; export declare function isIE10(): boolean; export declare function isChromiumBased(): boolean; export declare function getEventOptions(capture: boolean, passive: boolean): any; export declare function supportsFocusOptions(): boolean; export declare function _startDrag(dataTransfer: any, effectAllowed: string): void; export declare class _FocusService { private readonly _hasDoc; private _ae; private static readonly _noAe; constructor(); readonly activeElement: HTMLElement; private _onBlur; private _onFocus; private _isSpecialRoot; private _nativeAe; dispose(): void; } export declare function _getCalculatedArray(arr: any[], calculatedFields: any, newItem?: any): any[]; export declare function _getTargetObject(item: any): any; export declare const _CLS_STATE_DISABLED: string; /** * Gets the version of the Wijmo library that is currently loaded. */ export declare function getVersion(): string; /** * Sets the license key that identifies licensed Wijmo applications. * * If you do not set the license key, Wijmo will run in evaluation mode, * adding a watermark element to the page. * * Licensed users may obtain keys at the * <a href="https://developer.mescius.com/my-account" target="_blank">My Account</a> * section of the Wijmo site. * * Note that Wijmo does not send keys or any licensing information to any servers. * It only checks the internal consistency of the key provided. * * @param licenseKey String containing the license key to use in this application. */ export declare function setLicenseKey(licenseKey: string): void; /** * Specifies constants that represent keyboard codes. * * This enumeration is useful when handling <b>keyDown</b> events. */ export declare enum Key { /** The backspace key. */ Back = 8, /** The tab key. */ Tab = 9, /** The enter key. */ Enter = 13, /** The escape key. */ Escape = 27, /** The space key. */ Space = 32, /** The page up key. */ PageUp = 33, /** The page down key. */ PageDown = 34, /** The end key. */ End = 35, /** The home key. */ Home = 36, /** The left arrow key. */ Left = 37, /** The up arrow key. */ Up = 38, /** The right arrow key. */ Right = 39, /** The down arrow key. */ Down = 40, /** The delete key. */ Delete = 46, /** The 'X' key */ X = 88, /** The F1 key. */ F1 = 112, /** The F2 key. */ F2 = 113, /** The F3 key. */ F3 = 114, /** The F4 key. */ F4 = 115, /** The F5 key. */ F5 = 116, /** The F6 key. */ F6 = 117, /** The F7 key. */ F7 = 118, /** The F8 key. */ F8 = 119, /** The F9 key. */ F9 = 120, /** The F10 key. */ F10 = 121, /** The F11 key. */ F11 = 122, /** The F12 key. */ F12 = 123, /** The + key. */ PlusKey = 107, /** The -/_ key. */ EqualPlusKey = 187, /** The - key. */ MinusKey = 109, /** The -/_ key. */ HyphenMinusKey = 189, /** The 'S' key. */ S = 83, /** The 'P' key. */ P = 80, /** The 'F' key. */ F = 70 } /** * Specifies constants that represent data types. * * Use the {@link getType} method to get a {@link DataType} from a value. */ export declare enum DataType { /** Object (anything). */ Object = 0, /** String. */ String = 1, /** Number. */ Number = 2, /** Boolean. */ Boolean = 3, /** Date (date and time). */ Date = 4, /** Array. */ Array = 5 } /** * Allows callers to verify whether an object implements an interface. */ export interface IQueryInterface { /** * Returns true if the object implements a given interface. * * @param interfaceName Name of the interface to look for. */ implementsInterface(interfaceName: string): boolean; } /** * Casts a value to a type if possible. * * @param value Value to cast. * @param type Type or interface name to cast to. * @return The value passed in if the cast was successful, null otherwise. */ export declare function tryCast(value: any, type: any): any; /** * Determines whether an object is a primitive type (string, number, Boolean, or Date). * * @param value Value to test. */ export declare function isPrimitive(value: any): value is string | number | Boolean | Date; /** * Determines whether an object is a string. * * @param value Value to test. */ export declare function isString(value: any): value is string; /** * Determines whether a string is null, empty, or whitespace only. * * @param value Value to test. */ export declare function isNullOrWhiteSpace(value: string): boolean; /** * Determines whether an object is a number. * * @param value Value to test. */ export declare function isNumber(value: any): value is number; /** * Determines whether an object is an integer. * * @param value Value to test. */ export declare function isInt(value: any): value is number; /** * Determines whether an object is a Boolean. * * @param value Value to test. */ export declare function isBoolean(value: any): value is boolean; /** * Determines whether an object is a function. * * @param value Value to test. */ export declare function isFunction(value: any): value is Function; /** * Determines whether an object is undefined. * * @param value Value to test. */ export declare function isUndefined(value: any): value is undefined; /** * Determines whether an object is null or undefined. * * @param value Value to test. */ export declare function isNullOrUndefined(value: any): value is null | undefined; /** * Determines whether an object is a Date. * * @param value Value to test. */ export declare function isDate(value: any): value is Date; /** * Determines whether an object is an Array. * * @param value Value to test. */ export declare function isArray(value: any): value is Array<any>; export declare function _isPlainArray(value: any): boolean; /** * Determines whether a value is an object * (as opposed to a value type, an array, or a Date). * * @param value Value to test. */ export declare function isObject(value: any): boolean; /** * Determines whether an object is empty * (contains no enumerable properties). * * @param obj Object to test. */ export declare function isEmpty(obj: any): boolean; export declare function _areObjectsEqual(obj1: any, obj2: any): boolean; /** * Creates a new unique id for an element by adding sequential * numbers to a given base id. * * Use getSafeUniqueId instead. * * @param baseId String to use as a basis for generating the unique id. */ export declare function getUniqueId(baseId: string): string; export declare function getSafeUniqueId(baseId: string, prefix?: string, forcePrefix?: boolean): string; /** * Creates an unique id */ export declare function uidGenerator(): string; /** * Converts mouse or touch event arguments into a {@link Point} in page coordinates. */ export declare function mouseToPage(e: any): Point; /** * Gets the type of a value. * * @param value Value to test. * @return A {@link DataType} value representing the type of the value passed in. */ export declare function getType(value: any): DataType; /** * Provides binding information for object properties. */ export interface IBindingInfo { binding: string; dataType: DataType; isReadOnly?: boolean; } /** * Gets an array containing the names and types of items in an array. * * @param arr Array containing data items. * @param limit Number of the array items to scan (1000 by default). Zero or negative value causes * the function to scan all items. * @return An array containing objects with the binding and type of each * primitive property in the items found in the input array. */ export declare function getTypes(arr: any[], limit?: number): IBindingInfo[]; /** * Changes the type of a value. * * If the conversion fails, the original value is returned. To check if a * conversion succeeded, you should check the type of the returned value. * * @param value Value to convert. * @param type {@link DataType} to convert the value to. * @param format Format to use when converting to or from strings. * @param refDate Reference date to use when parsing strings with missing information. * @return The converted value, or the original value if a conversion was not possible. */ export declare function changeType(value: any, type: DataType, format?: string, refDate?: Date): any; /** * Rounds or truncates a number to a specified precision. * * @param value Value to round or truncate. * @param prec Number of decimal digits for the result. * @param truncate Whether to truncate or round the original value. */ export declare function toFixed(value: number, prec: number, truncate: boolean): number; /** * Replaces each format item in a specified string with the text equivalent of an * object's value. * * The function works by replacing parts of the <b>formatString</b> with the pattern * '{name:format}' with properties of the <b>data</b> parameter. For example: * * ```typescript * import { format } from '@grapecity/wijmo'; * let data = { name: 'Joe', amount: 123456 }, * msg = format('Hello {name}, you won {amount:n2}!', data); * ``` * * The {@link format} function supports pluralization. If the format string is a * JSON-encoded object with 'count' and 'when' properties, the method uses * the 'count' parameter of the data object to select the appropriate format * from the 'when' property. For example: * * ```typescript * import { format } from '@grapecity/wijmo'; * fmtObj fmt = { * count: 'count', * when: { * 0: 'No items selected.', * 1: 'One item is selected.', * 2: 'A pair is selected.', * 'other': '{count:n0} items are selected.' * } * }; * let fmt = JSON.stringify(fmtObj); * console.log(format(fmt, { count: 0 })); // No items selected. * console.log(format(fmt, { count: 1 })); // One item is selected. * console.log(format(fmt, { count: 2 })); // A pair is selected. * console.log(format(fmt, { count: 12 })); // 12 items are selected. * ``` * * The optional <b>formatFunction</b> allows you to customize the content by * providing context-sensitive formatting. If provided, the format function * gets called for each format element and gets passed the data object, the * parameter name, the format, and the value; it should return an output string. * For example: * * ```typescript * import { format, isString, escapeHtml } from '@grapecity/wijmo'; * let data = { name: 'Joe', amount: 123456 }, * msg = format('Hello {name}, you won {amount:n2}!', data, * (data, name, fmt, val) => { * if (isString(data[name])) { * val = escapeHtml(data[name]); * } * return val; * } * ); * ``` * * @param format A composite format string. * @param data The data object used to build the string. * @param formatFunction An optional function used to format items in context. * @return The formatted string. */ export declare function format(format: string, data: any, formatFunction?: Function): string; /** * Tag function for use with template literals. * * The {@link glbz} tag function allows you to specify formatting for * variables in template literal expressions. * * To format a variable in a template literal using {@link glbz}, add a * colon and the format string after the name of the variable you want * to format. * * For example: * * ```typescript * import { glbz } from '@grapecity/wijmo'; * let num = 42, * dt = new Date(), * msg = glbz`the number is ${num}:n2, and the date is ${dt}:'MMM d, yyyy'!`; * ``` */ export declare function glbz(...args: any[]): string; /** * Evaluates a string in template literal notation. * * This function allows you to evaluate template literals on-demand, * rather than when they are declared. * * The template string uses the standard template literal syntax, * except it is a regular string (enclosed in single or double * quotes) rather than a template literal (enclosed in back-quotes). * * The template string may contain references to variables provided * in a context object passed as a parameter. * * The template string may contain formatting information as * used with the {@link glbz} tag function. * * For example: * ```typescript * import { evalTemplate } from '@grapecity/wijmo'; * const msg = evalTemplate('hello ${user}, want some ${Math.PI}:n2?', { user: 'Chris' })); * console.log(msg); * > hello Chris, want some 3.14? * ``` * * @param template String in template literal notation. * @param ctx Object with properties acessible to the template. * @returns A string containing the result. */ export declare function evalTemplate(template: string, ctx?: any): string; /** * Clamps a value between a minimum and a maximum. * * @param value Original value. * @param min Minimum allowed value. * @param max Maximum allowed value. */ export declare function clamp(value: number, min: number, max: number): number; /** * Copies properties from an object to another. * * This method is typically used to initialize controls and other Wijmo objects * by setting their properties and assigning event handlers. * * The destination object must define all the properties defined in the source, * or an error will be thrown. * * @param dst The destination object. * @param src The source object. * @param copySubObjects Whether to copy properties of Object type props. * @returns The destination object. */ export declare function copy(dst: any, src: any, copySubObjects?: boolean, copyNativeSubObjects?: boolean): any; export declare function _isPlainObject(value: any): boolean; /** * Checks if given property of an object is writable * @param obj Object whose property needs to check * @param key property that needs to be checked * @returns true if property is writable otherwise false */ export declare function isWritable<T extends Object>(obj: T, key: keyof T): boolean; /** * Creates a recursive deep copy of an object or array, ensuring * that all nested structures are duplicated without retaining * references to the original instance. * * @param obj Array or Object to deep clone * @returns Returns deep cloned array or object */ export declare function deepClone<T>(obj: T): T; /** * Throws an exception if a condition is false. * * @param condition Condition expected to be true. * @param msg Message of the exception if the condition is not true. */ export declare function assert(condition: boolean, msg: string, showStackTrace?: boolean): void; /** * Outputs a message to indicate a member has been deprecated. * * @param oldMember Member that has been deprecated. * @param newMember Member that replaces the one that has been deprecated. */ export declare function _deprecated(oldMember: string, newMember: string): void; /** * Outputs a warning message. * * @param msg message to print on console */ export declare function _warning(msg: string): void; /** * Asserts that a value is a string. * * @param value Value supposed to be a string. * @param nullOK Whether null values are acceptable. * @return The string passed in. */ export declare function asString(value: string, nullOK?: boolean): string; /** * Asserts that a value is a number. * * @param value Value supposed to be numeric. * @param nullOK Whether null values are acceptable. * @param positive Whether to accept only positive numeric values. * @return The number passed in. */ export declare function asNumber(value: number, nullOK?: boolean, positive?: boolean): number; /** * Asserts that a value is an integer. * * @param value Value supposed to be an integer. * @param nullOK Whether null values are acceptable. * @param positive Whether to accept only positive integers. * @return The number passed in. */ export declare function asInt(value: number, nullOK?: boolean, positive?: boolean): number; /** * Asserts that a value is a Boolean. * * @param value Value supposed to be Boolean. * @param nullOK Whether null values are acceptable. * @return The Boolean passed in. */ export declare function asBoolean(value: boolean, nullOK?: boolean): boolean; /** * Asserts that a value is a Date. * * @param value Value supposed to be a Date. * @param nullOK Whether null values are acceptable. * @return The Date passed in. */ export declare function asDate(value: Date, nullOK?: boolean): Date; /** * Asserts that a value is a function. * * @param value Value supposed to be a function. * @param nullOK Whether null values are acceptable. * @return The function passed in. */ export declare function asFunction(value: any, nullOK?: boolean): Function; /** * Asserts that a value is an array. * * @param value Value supposed to be an array. * @param nullOK Whether null values are acceptable. * @return The array passed in. */ export declare function asArray(value: any, nullOK?: boolean): any[]; /** * Asserts that a value is an instance of a given type. * * @param value Value to be checked. * @param type Type of value expected. * @param nullOK Whether null values are acceptable. * @return The value passed in. */ export declare function asType(value: any, type: any, nullOK?: boolean): any; /** * Asserts that a value is a valid setting for an enumeration. * * @param value Value supposed to be a member of the enumeration. * @param enumType Enumeration to test for. * @param nullOK Whether null values are acceptable. * @return The value passed in. */ export declare function asEnum(value: number, enumType: any, nullOK?: boolean): number; /** * Asserts that a value is an {@link ICollectionView} or an Array. * * @param value Array or {@link ICollectionView}. * @param nullOK Whether null values are acceptable. * @return The {@link ICollectionView} that was passed in or a {@link CollectionView} * created from the array that was passed in. */ export declare function asCollectionView(value: any, nullOK?: boolean): ICollectionView; /** * Checks whether an {@link ICollectionView} is defined and not empty. * * @param value {@link ICollectionView} to check. */ export declare function hasItems(value: ICollectionView): boolean; /** * Converts a camel-cased string into a header-type string by capitalizing the first letter * and adding spaces before uppercase characters preceded by lower-case characters. * * For example, 'somePropertyName' becomes 'Some Property Name'. * * @param text String to convert to header case. */ export declare function toHeaderCase(text: string): string; /** * Escapes a string by replacing HTML characters with text entities. * * Strings entered by users should always be escaped before they are displayed * in HTML pages. This helps ensure page integrity and prevent HTML/javascript * injection attacks. * * @param text Text to escape. * @return An HTML-escaped version of the original string. */ export declare function escapeHtml(text: string): string; export declare function getSpecialCharsRegex(): RegExp; /** * Escapes a string by prefixing special regular expression characters * with backslashes. * * @param text Text to escape. * @return A RegExp-escaped version of the original string. */ export declare function escapeRegExp(text: string): string; /** * Converts an HTML string into plain text. * * @param html HTML string to convert to plain text. * @return A plain-text version of the string. */ export declare function toPlainText(html: string): string; /** * Checks whether an element has a class. * * @param e Element to check. * @param className Class to check for. */ export declare function hasClass(e: Element, className: string): boolean; /** * Adds a class to an element. * * @param e Element that will have the class added. * @param className Class (or space-separated list of classes) to add to the element. */ export declare function addClass(e: Element, className?: string): void; /** * Removes a class from an element. * * @param e Element that will have the class removed. * @param className Class (or space-separated list of classes) to remove from the element. */ export declare function removeClass(e: Element, className: string): void; /** * Adds or removes a class to or from an element. * * @param e Element that will have the class added. * @param className Class to add or remove. * @param addOrRemove Whether to add or remove the class. If not provided, toggle the class. */ export declare function toggleClass(e: Element, className: string, addOrRemove?: boolean): void; /** * Sets or clears an attribute on an element. * * @param e Element that will be updated. * @param name Name of the attribute to add or remove. * @param value Value of the attribute, or null to remove the attribute * from the element. * @param keep Whether to keep original attribute if present. */ export declare function setAttribute(e: Element, name: string, value?: any, keep?: boolean): void; /** * Sets the checked and indeterminate properties of a checkbox input * element. * * @param cb Checkbox element. * @param checked True, false, or null for checked, unchecked, or indeterminate. */ export declare function setChecked(cb: HTMLInputElement, checked: boolean): void; /** * Sets or clears an element's <b>aria-label</b> attribute. * * @param e Element that will be updated. * @param value Value of the aria label, or null to remove the label * from the element. */ export declare function setAriaLabel(e: Element, value?: string): void; /** * Sets the start and end positions of a selection in a text field. * * This method is similar to the native {@link setSelectionRange} method * in HTMLInputElement objects, except it checks for conditions that * may cause exceptions (element not in the DOM, disabled, or hidden). * * @param e HTMLInputElement or HTMLTextAreaElement to select. * @param start Offset into the text field for the start of the selection. * @param end Offset into the text field for the end of the selection. */ export declare function setSelectionRange(e: any, start: number, end?: number, needFocus?: boolean): boolean; /** * Disables the autocomplete, autocorrect, autocapitalize, and spellcheck * properties of an input element. * * @param e The input element. */ export declare function disableAutoComplete(e: HTMLInputElement): void; /** * Safely removes an element from the DOM tree. * * @param e Element to remove from the DOM tree. */ export declare function removeChild(e: Node): Node; /** * Gets a reference to the element that contains the focus, * accounting for shadow document fragments. */ export declare function getActiveElement(): HTMLElement; export declare function _getActiveElement(activeElement: HTMLElement): HTMLElement; /** * Moves the focus to the next/previous/first focusable child within * a given parent element. * * @param parent Parent element. * @param offset Offset to use when moving the focus (use zero to focus on the first focusable child). * @return