Module UI

Index

Modules

Enumerations

Interfaces

Classes

Functions

Functions

computeDataSourceGroups(listDataSource: IListDataSource, groupKey: Function, groupData: Function, options?: any): IListDataSource

Returns a new IListDataSource that adds group information to the items of another IListDataSource.

Parameters

  • listDataSource: IListDataSource

    The data source for the individual items to group.

  • groupKey: Function

    A callback function that accepts a single argument: an item in the IListDataSource. The function is called for each item in the list and must return the group key for that item as a string.

  • groupData: Function

    A callback function that accepts a single argument: an item in the IListDataSource. The function is called on one IListDataSource item for each group and must return an object that represents the header of that group.

  • options?: any optional

    An object that can contain properties that specify additional options: groupCountEstimate, batchSize.

Returns

IListDataSource

An IListDataSource that contains the items in the original data source and provides additional group information in the form of a "groups" property. The "groups" property returns another IListDataSource that enumerates the different groups in the list.

disableAnimations()

Used to disables all Animations Library and ListView animations. Calling this function does not guarantee that the animations will be disabled, as the determination is made based on several factors.

enableAnimations()

Used to enable all Animations Library and ListView animations. Calling this function does not guarantee that the animations will be enabled, as the determination is made based on several factors.

eventHandler(handler: any): any

Marks a event handler function as being compatible with declarative processing.

Parameters

  • handler: any

    The handler to be marked as compatible with declarative processing.

Returns

any

The handler, marked as compatible with declarative processing.

executeAnimation(element: HTMLElement, animation: any): Promise

Asynchronously executes a collection of CSS animations on a collection of elements. This is the underlying animation mechanism used by the Animations Library. Apps are encouraged to use the Animations Library to conform with the standard look and feel of the rest of the system, rather than calling this function directly.

Parameters

  • element: HTMLElement

    Element or elements to be animated. This parameter can be expressed in several ways: As the special value "undefined", which means that the animation has no target, As a single object, As a JavaScript array (possibly empty), in which each element of the array can be a single element or a JavaScript array of elements., As a NodeList (for example, the result of querySelectorAll), As an HTMLCollection.

  • animation: any

    The animation description or an array of animation descriptions to apply to element. An animation description is a JavaScript object with specific properties, listed below. There are two types of animation descriptions: one for keyframe-based animations and one for explicit animations. These types are distinguished by whether the keyframe property has a defined value. The following properties are required for both types of animation descriptions: property (string), delay (number), duration (number), timing (string). If an animation has a keyframe property with a defined, non-null value, then the animation is a keyframe-based animation. A keyframe-based animation description requires the following property in addition to those mentioned above: keyframe (string). If an animation does not have a keyframe property, or if the value of the property is null or undefined, then the animation is an explicit animation. An explicit animation description requires the following properties in addition to the common properties mentioned above: from, to. The values given in the from and to properties must be valid for the CSS property specified by the property property. For example, if the CSS property is "opacity", then the from and to properties must be numbers between 0 and 1 (inclusive).

Returns

Promise

Returns a Promise object that completes when the CSS animation is complete.

executeTransition(element: HTMLElement, transition: any): Promise

Asynchronously executes a collection of CSS transitions on a collection of elements. This is the underlying animation mechanism used by the Animations Library. Apps are encouraged to use the Animations Library to conform with the standard look and feel of the rest of the system, rather than calling this function directly.

Parameters

  • element: HTMLElement

    Element or elements on which to perform the transition. This parameter can be expressed in several ways: As the special value "undefined", which means that the transition has no target, As a single object, As a JavaScript array (possibly empty), in which each element of the array can be a single element or a JavaScript array of elements., As a NodeList (for example, the result of querySelectorAll), As an HTMLCollection.

  • transition: any

    The transition description or an array of transition descriptions to apply to element. A transition description is a JavaScript object with these properties: property (string), delay (number), duration (number), timing (string), from (optional), to. The values given in the from and to properties must be valid for the CSS property specified by the property property. For example, if the CSS property is "opacity", then the from and to properties must be numbers between 0 and 1 (inclusive).

Returns

Promise

Returns a Promise that completes when the transition is finished.

getItemsFromRanges(dataSource: IListDataSource, ranges: ISelectionRange[]): Promise

Retrieves the items in the specified index range.

Parameters

  • dataSource: IListDataSource

    The data source that contains the items to retrieve.

  • ranges: ISelectionRange[]

    An array of ISelectionRange objects that have firstIndex and lastIndex values.

Returns

Promise

A Promise that contains an array of the requested IItem objects.

isAnimationEnabled(): boolean

Determines whether the Animations Library and ListView animations will be performed if called.

Returns

boolean

Returns true if animations will be performed; otherwise false.

process(element: Element): Promise

Applies declarative control binding to the specified element.

Parameters

  • element: Element

    The element to bind.

Returns

Promise

A promise that is fulfilled after the control is activated. The value of the promise is the control that is attached to element.

processAll(rootElement?: Element, skipRoot?: boolean): Promise

Applies declarative control binding to all elements, starting at the specified root element.

Parameters

  • rootElement?: Element optional

    The element at which to start applying the binding. If this parameter is not specified, the binding is applied to the entire document.

  • skipRoot?: boolean optional

    If true, the elements to be bound skip the specified root element and include only the children.

Returns

Promise

A promise that is fulfilled when binding has been applied to all the controls.

scopedSelect(selector: string, element: HTMLElement): HTMLElement

Walks the DOM tree from the given element to the root of the document. Whenever a selector scope is encountered, this method performs a lookup within that scope for the specified selector string. The first matching element is returned.

Parameters

  • selector: string

    The selector string.

  • element: HTMLElement

    The element to begin walking to the root of the document from.

Returns

HTMLElement

The target element, if found.

setControl(element: HTMLElement, control: any)

Given a DOM element and a control, attaches the control to the element.

Parameters

  • element: HTMLElement

    Element to associate with the control.

  • control: any

    The control to attach to the element.

setOptions(control: any, options?: any)

Adds the set of declaratively specified options (properties and events) to the specified control. If name of the options property begins with "on", the property value is a function and the control supports addEventListener. setControl calls addEventListener on the control.

Parameters

  • control: any

    The control on which the properties and events are to be applied.

  • options?: any optional

    The set of options that are specified declaratively.