UNPKG

fit-ui

Version:

Object Oriented framework for building rich User Interfaces

1,152 lines (1,148 loc) 596 kB
/** * * @namespace [Fit Fit] */ declare namespace Fit { // Functions defined by Fit /** * Get absolute path to Fit.UI on server - e.g. /libs/fitui. * @function GetPath * @static * @returns string */ export function GetPath():string; /** * Get fully qualified URL to Fit.UI on server - e.g. http://server.com/libs/fitui. * @function GetUrl * @static * @returns string */ export function GetUrl():string; /** * Get Fit.UI version object containing the following properties: Major (integer), Minor (integer), Patch (integer), Version (string representing Major.Minor.Patch). * @function GetVersion * @static * @returns Fit.CoreTypeDefs.VersionInfo */ export function GetVersion():Fit.CoreTypeDefs.VersionInfo; /** * Set path to Fit.UI on server - e.g. libs/fitui. This may be necessary if Fit.UI is loaded dynamically using RequireJS or bundled using e.g. WebPack. Changing the path affects the return value of both GetUrl() and GetPath(), and from where Fit.UI will load resources dynamically. * @function SetPath * @static * @param {string} basePath - Absolute or relative path to folder containing Fit.UI. */ export function SetPath(basePath:string):void; /** * Set URL to Fit.UI on server - e.g. http://cdn/libs/fitui/. This may be necessary if Fit.UI is loaded dynamically from a foreign domain such as a CDN (Content Delivery Network). Changing the URL affects the return value of both GetUrl() and GetPath(), and from where Fit.UI will load resources dynamically. * @function SetUrl * @static * @param {string} baseUrl - Full URL to folder containing Fit.UI. */ export function SetUrl(baseUrl:string):void; /** * Functionality extending the capabilities of native JS arrays. * @class [Fit.Array Array] */ class Array { // Functions defined by Fit.Array /** * Add object to array. * @function Add * @static * @param {any[]} arr - Array to which object is added. * @param {any} obj - Object to add to array. */ public static Add(arr:any[], obj:any):void; /** * Clear all items from array. * @function Clear * @static * @param {any[]} arr - Array from which all objects are remove. */ public static Clear(arr:any[]):void; /** * Returns True if given object is contained in collection, otherwise False. * @function Contains * @static * @param {any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList} arr - Collection to search through. * @param {any} obj - Object to look for. * @returns boolean */ public static Contains(arr:any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList, obj:any):boolean; /** * Returns a shallow copy of the collection. For a deep copy see Fit.Core.Clone(..). * @template Type * @function Copy * @static * @param {Type[]} arr - Collection to copy. * @returns Type[] */ public static Copy<Type>(arr:Type[]):Type[]; /** * Returns a shallow copy of the collection. For a deep copy see Fit.Core.Clone(..). * @function Copy * @static * @param {HTMLCollection} arr - Collection to copy. * @returns HTMLElement[] */ public static Copy(arr:HTMLCollection):HTMLElement[]; /** * Returns a shallow copy of the collection. For a deep copy see Fit.Core.Clone(..). * @function Copy * @static * @param {NodeList} arr - Collection to copy. * @returns Node[] */ public static Copy(arr:NodeList):Node[]; /** * Returns a shallow copy of the collection. For a deep copy see Fit.Core.Clone(..). * @function Copy * @static * @param {NamedNodeMap} arr - Collection to copy. * @returns Attr[] */ public static Copy(arr:NamedNodeMap):Attr[]; /** * Returns a shallow copy of the collection. For a deep copy see Fit.Core.Clone(..). * @function Copy * @static * @param {FileList} arr - Collection to copy. * @returns File[] */ public static Copy(arr:FileList):File[]; /** * Returns a shallow copy of the collection. For a deep copy see Fit.Core.Clone(..). * @function Copy * @static * @param {StyleSheetList} arr - Collection to copy. * @returns StyleSheet[] */ public static Copy(arr:StyleSheetList):StyleSheet[]; /** * Returns a shallow copy of the collection. For a deep copy see Fit.Core.Clone(..). * @function Copy * @static * @param {CSSRuleList} arr - Collection to copy. * @returns CSSRule[] */ public static Copy(arr:CSSRuleList):CSSRule[]; /** * Returns number of elements in collection. * @function Count * @static * @param {any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList} arr - Collection to count elements within. * @returns number */ public static Count(arr:any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList):number; /** * Returns number of elements in object array. * @function Count * @static * @param {any} obj - Object array to count elements within. * @returns number */ public static Count(obj:any):number; /** * Iterates through objects in collection and passes each object to provided callback. Callback is expected to return any children supposed to be iterated too, or Null if further/deeper iteration is not required. * @template Type * @function CustomRecurse * @static * @param {Type[]} arr - Collection containing objects to iterate through. * @param {(obj:Type) => Type[] | null | void} callback - Callback function accepting objects from the collection, passed in turn. Function must return children collection to continue recursive operation, or Null (or nothing) to stop further processing. * @returns boolean */ public static CustomRecurse<Type>(arr:Type[], callback:(obj:Type) => Type[] | null | void):boolean; /** * Iterates through objects in collection and passes each object to provided callback. Callback is expected to return any children supposed to be iterated too, or Null if further/deeper iteration is not required. * @function CustomRecurse * @static * @param {HTMLCollection} arr - Collection containing objects to iterate through. * @param {(obj:HTMLElement) => HTMLCollection | HTMLElement[] | null | void} callback - Callback function accepting objects from the collection, passed in turn. Function must return children collection to continue recursive operation, or Null (or nothing) to stop further processing. * @returns boolean */ public static CustomRecurse(arr:HTMLCollection, callback:(obj:HTMLElement) => HTMLCollection | HTMLElement[] | null | void):boolean; /** * Iterates through objects in collection and passes each object to provided callback. Callback is expected to return any children supposed to be iterated too, or Null if further/deeper iteration is not required. * @function CustomRecurse * @static * @param {NodeList} arr - Collection containing objects to iterate through. * @param {(obj:Node) => NodeList | Node[] | null | void} callback - Callback function accepting objects from the collection, passed in turn. Function must return children collection to continue recursive operation, or Null (or nothing) to stop further processing. * @returns boolean */ public static CustomRecurse(arr:NodeList, callback:(obj:Node) => NodeList | Node[] | null | void):boolean; /** * Iterates through objects in collection and passes each object to provided callback. Callback is expected to return any children supposed to be iterated too, or Null if further/deeper iteration is not required. * @function CustomRecurse * @static * @param {NamedNodeMap[]} arr - Collection containing objects to iterate through. * @param {(obj:Attr) => NamedNodeMap | Attr[] | null | void} callback - Callback function accepting objects from the collection, passed in turn. Function must return children collection to continue recursive operation, or Null (or nothing) to stop further processing. * @returns boolean */ public static CustomRecurse(arr:NamedNodeMap[], callback:(obj:Attr) => NamedNodeMap | Attr[] | null | void):boolean; /** * Iterates through objects in collection and passes each object to provided callback. Callback is expected to return any children supposed to be iterated too, or Null if further/deeper iteration is not required. * @function CustomRecurse * @static * @param {FileList} arr - Collection containing objects to iterate through. * @param {(obj:File) => FileList | File[] | null | void} callback - Callback function accepting objects from the collection, passed in turn. Function must return children collection to continue recursive operation, or Null (or nothing) to stop further processing. * @returns boolean */ public static CustomRecurse(arr:FileList, callback:(obj:__fitUiAliasFile) => FileList | __fitUiAliasFile[] | null | void):boolean; /** * Iterates through objects in collection and passes each object to provided callback. Callback is expected to return any children supposed to be iterated too, or Null if further/deeper iteration is not required. * @function CustomRecurse * @static * @param {StyleSheetList} arr - Collection containing objects to iterate through. * @param {(obj:StyleSheet) => StyleSheetList | StyleSheet[] | null | void} callback - Callback function accepting objects from the collection, passed in turn. Function must return children collection to continue recursive operation, or Null (or nothing) to stop further processing. * @returns boolean */ public static CustomRecurse(arr:StyleSheetList, callback:(obj:StyleSheet) => StyleSheetList | StyleSheet[] | null | void):boolean; /** * Iterates through objects in collection and passes each object to provided callback. Callback is expected to return any children supposed to be iterated too, or Null if further/deeper iteration is not required. * @function CustomRecurse * @static * @param {CSSRuleList} arr - Collection containing objects to iterate through. * @param {(obj:CSSRule) => CSSRuleList | CSSRule[] | null | void} callback - Callback function accepting objects from the collection, passed in turn. Function must return children collection to continue recursive operation, or Null (or nothing) to stop further processing. * @returns boolean */ public static CustomRecurse(arr:CSSRuleList, callback:(obj:CSSRule) => CSSRuleList | CSSRule[] | null | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @template Type * @function ForEach * @static * @param {Type[]} arr - Collection containing objects to iterate through. * @param {(obj:Type) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach<Type>(arr:Type[], callback:(obj:Type) => boolean | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {HTMLCollection} arr - Collection containing objects to iterate through. * @param {(obj:HTMLElement) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(arr:HTMLCollection, callback:(obj:HTMLElement) => boolean | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {NodeList} arr - Collection containing objects to iterate through. * @param {(obj:Node) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(arr:NodeList, callback:(obj:Node) => boolean | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {NamedNodeMap} arr - Collection containing objects to iterate through. * @param {(obj:Attr) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(arr:NamedNodeMap, callback:(obj:Attr) => boolean | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {FileList} arr - Collection containing objects to iterate through. * @param {(obj:File) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(arr:FileList, callback:(obj:__fitUiAliasFile) => boolean | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {StyleSheetList} arr - Collection containing objects to iterate through. * @param {(obj:StyleSheet) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(arr:StyleSheetList, callback:(obj:StyleSheet) => boolean | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {CSSRuleList} arr - Collection containing objects to iterate through. * @param {(obj:CSSRule) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(arr:CSSRuleList, callback:(obj:CSSRule) => boolean | void):boolean; /** * Iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {any[]} arr - Collection containing objects to iterate through. * @param {(obj:any) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(arr:any[], callback:(obj:any) => boolean | void):boolean; /** * Iterates through object properties and passes each property name to the provided callback function. Returns boolean indicating whether iteration was carried through (True) or interrupted (False). * @function ForEach * @static * @param {any} obj - Object containing properties to iterate through. * @param {(key:string) => boolean | void} callback - Callback function accepting properties from the object, passed in turn. Return False from callback to break loop. * @returns boolean */ public static ForEach(obj:any, callback:(key:string) => boolean | void):boolean; /** * Returns index of object in collection if found, otherwise a value of -1 is returned. * @function GetIndex * @static * @param {any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList} arr - Collection to search through. * @param {any} obj - Object to obtain index for. * @returns number */ public static GetIndex(arr:any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList, obj:any):number; /** * Returns all keys in collection (indices) - 0, 1, 2, 3, ... * @function GetKeys * @static * @param {any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList} arr - Collection to get keys from. * @returns number[] */ public static GetKeys(arr:any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList):number[]; /** * Returns all keys (property names) in object. * @function GetKeys * @static * @param {any} obj - Object to get keys from. * @returns string[] */ public static GetKeys(obj:any):string[]; /** * Returns True if collection has items, otherwise False. * @function HasItems * @static * @param {any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList} arr - Collection to investigate. * @returns boolean */ public static HasItems(arr:any[] | HTMLCollection | NodeList | NamedNodeMap | FileList | StyleSheetList | CSSRuleList):boolean; /** * Returns True if object array has items, otherwise False. * @function HasItems * @static * @param {any} obj - Object array to investigate. * @returns boolean */ public static HasItems(obj:any):boolean; /** * Insert object into array at specified index. * @function Insert * @static * @param {any[]} arr - Array into which object is inserted. * @param {number} idx - Index to insert object at. * @param {any} obj - Object to insert into array. */ public static Insert(arr:any[], idx:number, obj:any):void; /** * Join objects from a collection into a string. * @template Type * @function Join * @static * @param {Type[]} arr - Collection containing objects. * @param {string} separator - String used to glue values together. * @param {(obj:Type) => string} callback - Callback returning string representation of objects passed from collection in turn. * @returns string */ public static Join<Type>(arr:Type[], separator:string, callback:(obj:Type) => string):string; /** * Join objects from a collection into a string. * @function Join * @static * @param {HTMLCollection} arr - Collection containing objects. * @param {string} separator - String used to glue values together. * @param {(obj:HTMLElement) => string} callback - Callback returning string representation of objects passed from collection in turn. * @returns string */ public static Join(arr:HTMLCollection, separator:string, callback:(obj:HTMLElement) => string):string; /** * Join objects from a collection into a string. * @function Join * @static * @param {NodeList} arr - Collection containing objects. * @param {string} separator - String used to glue values together. * @param {(obj:Node) => string} callback - Callback returning string representation of objects passed from collection in turn. * @returns string */ public static Join(arr:NodeList, separator:string, callback:(obj:Node) => string):string; /** * Join objects from a collection into a string. * @function Join * @static * @param {NamedNodeMap} arr - Collection containing objects. * @param {string} separator - String used to glue values together. * @param {(obj:Attr) => string} callback - Callback returning string representation of objects passed from collection in turn. * @returns string */ public static Join(arr:NamedNodeMap, separator:string, callback:(obj:Attr) => string):string; /** * Join objects from a collection into a string. * @function Join * @static * @param {FileList} arr - Collection containing objects. * @param {string} separator - String used to glue values together. * @param {(obj:File) => string} callback - Callback returning string representation of objects passed from collection in turn. * @returns string */ public static Join(arr:FileList, separator:string, callback:(obj:__fitUiAliasFile) => string):string; /** * Join objects from a collection into a string. * @function Join * @static * @param {StyleSheetList} arr - Collection containing objects. * @param {string} separator - String used to glue values together. * @param {(obj:StyleSheet) => string} callback - Callback returning string representation of objects passed from collection in turn. * @returns string */ public static Join(arr:StyleSheetList, separator:string, callback:(obj:StyleSheet) => string):string; /** * Join objects from a collection into a string. * @function Join * @static * @param {CSSRuleList} arr - Collection containing objects. * @param {string} separator - String used to glue values together. * @param {(obj:CSSRule) => string} callback - Callback returning string representation of objects passed from collection in turn. * @returns string */ public static Join(arr:CSSRuleList, separator:string, callback:(obj:CSSRule) => string):string; /** * Merge/join two arrays. * @template TypeA * @template TypeB * @function Merge * @static * @param {TypeA[]} arr1 - Array 1 to merge with array 2. * @param {TypeB[]} arr2 - Array 2 to merge with array 1. * @returns (TypeA | TypeB)[] */ public static Merge<TypeA, TypeB>(arr1:TypeA[], arr2:TypeB[]):(TypeA | TypeB)[]; /** * Move object within array from one position to another. * @function Move * @static * @param {any[]} arr - Array to manipulate. * @param {number} fromIdx - Position of object to move. * @param {number} ToIdx - New object position. */ public static Move(arr:any[], fromIdx:number, ToIdx:number):void; /** * Recursively iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether recursion was carried through (True) or interrupted (False). * @template Type * @function Recurse * @static * @param {Type[]} arr - Collection containing objects to iterate through. * @param {string} childrenProperty - Name of property or argumentless getter function returning children (e.g. "Children" or "GetChildren"). * @param {(obj:Type) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static Recurse<Type>(arr:Type[], childrenProperty:string, callback:(obj:Type) => boolean | void):boolean; /** * Recursively iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether recursion was carried through (True) or interrupted (False). * @function Recurse * @static * @param {HTMLCollection} arr - Collection containing objects to iterate through. * @param {string} childrenProperty - Name of property or argumentless getter function returning children (e.g. "Children" or "GetChildren"). * @param {(obj:HTMLElement) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static Recurse(arr:HTMLCollection, childrenProperty:string, callback:(obj:HTMLElement) => boolean | void):boolean; /** * Recursively iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether recursion was carried through (True) or interrupted (False). * @function Recurse * @static * @param {NodeList} arr - Collection containing objects to iterate through. * @param {string} childrenProperty - Name of property or argumentless getter function returning children (e.g. "Children" or "GetChildren"). * @param {(obj:Node) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static Recurse(arr:NodeList, childrenProperty:string, callback:(obj:Node) => boolean | void):boolean; /** * Recursively iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether recursion was carried through (True) or interrupted (False). * @function Recurse * @static * @param {NamedNodeMap} arr - Collection containing objects to iterate through. * @param {string} childrenProperty - Name of property or argumentless getter function returning children (e.g. "Children" or "GetChildren"). * @param {(obj:Attr) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static Recurse(arr:NamedNodeMap, childrenProperty:string, callback:(obj:Attr) => boolean | void):boolean; /** * Recursively iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether recursion was carried through (True) or interrupted (False). * @function Recurse * @static * @param {FileList} arr - Collection containing objects to iterate through. * @param {string} childrenProperty - Name of property or argumentless getter function returning children (e.g. "Children" or "GetChildren"). * @param {(obj:File) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static Recurse(arr:FileList, childrenProperty:string, callback:(obj:__fitUiAliasFile) => boolean | void):boolean; /** * Recursively iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether recursion was carried through (True) or interrupted (False). * @function Recurse * @static * @param {StyleSheetList} arr - Collection containing objects to iterate through. * @param {string} childrenProperty - Name of property or argumentless getter function returning children (e.g. "Children" or "GetChildren"). * @param {(obj:StyleSheet) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static Recurse(arr:StyleSheetList, childrenProperty:string, callback:(obj:StyleSheet) => boolean | void):boolean; /** * Recursively iterates through objects in collection and passes each object to the provided callback function. Returns boolean indicating whether recursion was carried through (True) or interrupted (False). * @function Recurse * @static * @param {CSSRuleList} arr - Collection containing objects to iterate through. * @param {string} childrenProperty - Name of property or argumentless getter function returning children (e.g. "Children" or "GetChildren"). * @param {(obj:CSSRule) => boolean | void} callback - Callback function accepting objects from the collection, passed in turn. Return False from callback to break loop. * @returns boolean */ public static Recurse(arr:CSSRuleList, childrenProperty:string, callback:(obj:CSSRule) => boolean | void):boolean; /** * Remove object from array. * @function Remove * @static * @param {any[]} arr - Array from which object is remove. * @param {any} obj - Object to remove from array. */ public static Remove(arr:any[], obj:any):void; /** * Remove object from array at specified index. * @function RemoveAt * @static * @param {any[]} arr - Array from which object is remove. * @param {number} idx - Object index in array. */ public static RemoveAt(arr:any[], idx:number):void; /** * Convert collection to a traditional JavaScript array. * @function ToArray * @static * @param {HTMLCollection} coll - Collection to convert to array. * @returns HTMLElement[] */ public static ToArray(coll:HTMLCollection):HTMLElement[]; /** * Convert collection to a traditional JavaScript array. * @function ToArray * @static * @param {NodeList} coll - Collection to convert to array. * @returns Node[] */ public static ToArray(coll:NodeList):Node[]; /** * Convert collection to a traditional JavaScript array. * @function ToArray * @static * @param {NamedNodeMap} coll - Collection to convert to array. * @returns Attr[] */ public static ToArray(coll:NamedNodeMap):Attr[]; /** * Convert collection to a traditional JavaScript array. * @function ToArray * @static * @param {FileList} coll - Collection to convert to array. * @returns File[] */ public static ToArray(coll:FileList):File[]; /** * Convert collection to a traditional JavaScript array. * @function ToArray * @static * @param {StyleSheetList} coll - Collection to convert to array. * @returns StyleSheet[] */ public static ToArray(coll:StyleSheetList):StyleSheet[]; /** * Convert collection to a traditional JavaScript array. * @function ToArray * @static * @param {CSSRuleList} coll - Collection to convert to array. * @returns CSSRule[] */ public static ToArray(coll:CSSRuleList):CSSRule[]; /** * Copy array to a new array. * @template Type * @function ToArray * @static * @param {Type[]} coll - Array to copy to a new array. * @returns Type[] */ public static ToArray<Type>(coll:Type[]):Type[]; } /** * Provides access to various browser information. // Example code var browserName = Fit.Browser.GetBrowser(); var browserVersion = Fit.Browser.GetVersion(); var browserLanguage = Fit.Browser.GetLanguage(); if (browserName === "MSIE" && browserVersion < 7) {      if (browserLanguage === "da")          alert("Opgrader venligst til IE7 eller nyere");      else          alert("Please upgrade to IE7 or newer"); }. * @class [Fit.Browser Browser] */ class Browser { // Functions defined by Fit.Browser /** * Returns name of browser useful for adjusting behaviour based on render engine. Possible values are: Chrome (both WebKit and Blink based - also returned for modern versions of Opera and Edge), Safari (also returned for Edge, Chrome, Opera, and Firefox on iOS), Edge (version 12-18), MSIE (version 8-11), Firefox, Opera (version 1-12), and Unknown. * @function GetBrowser * @static * @param {false} [returnAppId=false] - Set True to have app specific identifier returned. * @returns "Edge" | "Chrome" | "Safari" | "MSIE" | "Firefox" | "Opera" | "Unknown" */ public static GetBrowser(returnAppId?:false):"Edge" | "Chrome" | "Safari" | "MSIE" | "Firefox" | "Opera" | "Unknown"; /** * Returns browser app name useful for adjusting behaviour based on actual application, regardless of render engine and platform. Possible values are: Chrome (both Webkit and Blink based), Safari, Edge (both legacy and modern), MSIE (version 8-11), Firefox, Opera (both legacy and modern), and Unknown. Be careful not to check against browser app name and app version alone. For instance Opera 3 on a touch device is newer than Opera 60 on a Desktop device, as they are two completely different browsers. Check whether the browser runs on a tablet or phone using e.g. Fit.Browser.IsMobile(true) or Fit.Browser.GetInfo(true).IsMobile. * @function GetBrowser * @static * @param {true} returnAppId - Set True to have app specific identifier returned. * @returns "Edge" | "Chrome" | "Safari" | "MSIE" | "Firefox" | "Opera" | "Unknown" */ public static GetBrowser(returnAppId:true):"Edge" | "Chrome" | "Safari" | "MSIE" | "Firefox" | "Opera" | "Unknown"; /** * Get style value applied after stylesheets have been loaded. An empty string or null may be returned if style has not been defined or does not exist. Make sure not to use shorthand properties (e.g. border-color or padding) as some browsers are not capable of calculating these - use the fully qualified property name (e.g. border-left-color or padding-left). * @function GetComputedStyle * @static * @param {HTMLElement} elm - Element which contains desired CSS style value. * @param {string} style - CSS style property name. * @returns string | null */ public static GetComputedStyle(elm:HTMLElement, style:string):string | null; /** * Returns cached object with browser information. * @function GetInfo * @static * @param {false} [returnAppInfo=false] - Set True to have app specific browser information returned - see GetBrowser(..) for details. * @returns Fit.BrowserTypeDefs.BrowserInfo */ public static GetInfo(returnAppInfo?:false):Fit.BrowserTypeDefs.BrowserInfo; /** * Returns cached object with browser app information. * @function GetInfo * @static * @param {true} returnAppInfo - Set True to have app specific browser information returned - see GetBrowser(..) for details. * @returns Fit.BrowserTypeDefs.BrowserAppInfo */ public static GetInfo(returnAppInfo:true):Fit.BrowserTypeDefs.BrowserAppInfo; /** * Returns browser language - e.g. "da" (Danish), "en" (English) etc. * @function GetLanguage * @static * @returns string */ public static GetLanguage():string; /** * Returns page height in pixels. * @function GetPageHeight * @static * @returns number */ public static GetPageHeight():number; /** * Returns page width in pixels. * @function GetPageWidth * @static * @returns number */ public static GetPageWidth():number; /** * Returns query string information. * @function GetQueryString * @static * @param {string} [alternativeUrl=undefined] - Alternative URL to parse. * @returns Fit.BrowserTypeDefs.QueryString */ public static GetQueryString(alternativeUrl?:string):Fit.BrowserTypeDefs.QueryString; /** * Returns object with Width and Height properties specifying screen dimensions. * @function GetScreenDimensions * @static * @param {boolean} [onlyAvailable=false] - Set True to return only available space (may be reduced by e.g. Start menu (Windows) or Dock (Linux/OSX). * @returns Fit.TypeDefs.Dimension */ public static GetScreenDimensions(onlyAvailable?:boolean):Fit.TypeDefs.Dimension; /** * Get screen height. * @function GetScreenHeight * @static * @param {boolean} [onlyAvailable=false] - Set True to return only available space (may be reduced by e.g. start menu (Windows) or Dock (Linux/OSX). * @returns number */ public static GetScreenHeight(onlyAvailable?:boolean):number; /** * Get screen width. * @function GetScreenWidth * @static * @param {boolean} [onlyAvailable=false] - Set True to return only available space (may be reduced by e.g. start menu (Windows) or Dock (Linux/OSX). * @returns number */ public static GetScreenWidth(onlyAvailable?:boolean):number; /** * Get information about scrollbars in viewport. Returns an object with Vertical and Horizontal properties, each containing Enabled and Size properties, which can be used to determine whether scrolling is enabled, and the size of the scrollbar. The size remains 0 when scrolling is not enabled. To determine whether a DOM element has scrolling enabled, use Fit.Dom.GetScrollBars(..). * @function GetScrollBars * @static * @returns Fit.TypeDefs.ScrollBarsPresent */ public static GetScrollBars():Fit.TypeDefs.ScrollBarsPresent; /** * Get thickness of browser scrollbars. The function works even when no scrollbars are currently present. For browsers and operating systems hiding scrollbars for scrollable objects, the value returned will be 0 (zero). * @function GetScrollBarSize * @static * @returns number */ public static GetScrollBarSize():number; /** * Get scrolling document element. This is the cross browser equivalent of document.scrollingElement. * @function GetScrollDocument * @static * @returns HTMLElement */ public static GetScrollDocument():HTMLElement; /** * Returns object with X and Y properties specifying scroll position. * @function GetScrollPosition * @static * @returns Fit.TypeDefs.Position */ public static GetScrollPosition():Fit.TypeDefs.Position; /** * Returns major version number for known browsers, -1 for unknown browsers. * @function GetVersion * @static * @param {boolean} [returnAppVersion=false] - Set True to have app specific version number returned, rather than version number of browser engine. If version number is used in combination with the result from Fit.Browser.GetBrowser(true), then this argument should be True as well, otherwise False (default). * @returns number */ public static GetVersion(returnAppVersion?:boolean):number; /** * Returns object with Width and Height properties specifying dimensions of viewport. * @function GetViewPortDimensions * @static * @param {boolean} [includeScrollbars=false] - Include scrollbars if present to get all potential space available if scrollbars are removed. * @returns Fit.TypeDefs.Dimension */ public static GetViewPortDimensions(includeScrollbars?:boolean):Fit.TypeDefs.Dimension; /** * Returns value indicating whether device is a mobile device or not. Notice that some phones and tablets may identify as desktop devices, in which case IsMobile(..) will return False. In this case consider using Fit.Browser.IsTouchEnabled(), e.g. in combination with Fit.Browser.GetBrowser(), or a check against the size of the viewport, which will provide some indication as to whether device should be treated as a mobile device or not. As an example, Safari on iPad identifies as a Mac computer by default (it has "Request Desktop Website" enabled by default). To always detect iPad and iPhone as a mobile device, no matter the configuration of "Request Desktop Website"), simply use: var isMobile = Fit.Browser.IsMobile(true) || (Fit.Browser.GetBrowser() === "Safari" && Fit.Browser.IsTouchEnabled()) We will not be able to distinguish between an iPhone and an iPad though, not even by looking at the viewport size, since this approach is unreliable with high resolution iPhones and support for split screen which affects the viewport size. * @function IsMobile * @static * @param {boolean} [includeTablets=true] - Value indicating whether tablets are considered mobile devices or not. * @returns boolean */ public static IsMobile(includeTablets?:boolean):boolean; /** * Returns value indicating whether Session and Local storage is supported or not. * @function IsStorageSupported * @static * @returns boolean */ public static IsStorageSupported():boolean; /** * Returns value indicating whether device is touch enabled or not. * @function IsTouchEnabled * @static * @returns boolean */ public static IsTouchEnabled():boolean; /** * Log message or object. * @function Log * @static * @param {any} msg - Message or object to log. */ public static Log(msg:any):void; /** * Log message about use of deprecated feature. * @function LogDeprecated * @static * @param {string} msg - Message to log. */ public static LogDeprecated(msg:string):void; /** * Parses well-formed URLs and returns an object containing the various components. * @function ParseUrl * @static * @param {string} url - Well-formed URL to parse. * @returns Fit.BrowserTypeDefs.ParsedUrl */ public static ParseUrl(url:string):Fit.BrowserTypeDefs.ParsedUrl; } /** * * @class [Fit.Color Color] */ class Color { // Functions defined by Fit.Color /** * Get "black" or "white" depending on which is best suited in combination with specified color. * @function GetContrastColor * @static * @param {string} hex - HEX color string, e.g. #C0C0C0 (hash symbol is optional). * @param {number} [threshold=undefined] - Returns "black" when brightness is above threshold, "white" otherwise. 0 = all black, 255 = all white. Value defaults to 128. * @returns string */ public static GetContrastColor(hex:string, threshold?:number):string; /** * Convert HEX color string into RGB color string. * @function HexToRgb * @static * @param {string} hex - HEX color string, e.g. #C0C0C0 (hash symbol is optional). * @returns string */ public static HexToRgb(hex:string):string; /** * Returns True if value is a valid HEX color value, otherwise False. * @function IsHex * @static * @param {string} val - Value to validate. * @returns boolean */ public static IsHex(val:string):boolean; /** * Returns True if value is a valid RGB(A) color value, otherwise False. * @function IsRgb * @static * @param {string} val - Value to validate. * @returns boolean */ public static IsRgb(val:string):boolean; /** * Convert HEX color string into RGB color object, e.g. { Red: 150, Green: 30, Blue: 185 }. * @function ParseHex * @static * @param {string} hex - HEX color string, e.g. #C0C0C0 (hash symbol is optional). * @returns Fit.ColorTypeDefs.RgbColor */ public static ParseHex(hex:string):Fit.ColorTypeDefs.RgbColor; /** * Parses RGB(A) string and turns result into a RGB(A) color object, e.g. { Red: 100, Green: 100, Blue: 100, Alpha: 0.3 }. * @function ParseRgb * @static * @param {string} val - RGB(A) color string, e.g. rgba(100, 100, 100, 0.3) or simply 100,100,200,0.3. * @returns Fit.ColorTypeDefs.RgbaColor */ public static ParseRgb(val:string):Fit.ColorTypeDefs.RgbaColor; /** * Convert RGB colors into HEX color string. * @function RgbToHex * @static * @param {number} r - Color index for red. * @param {number} g - Color index for green. * @param {number} b - Color index for blue. * @returns string */ public static RgbToHex(r:number, g:number, b:number):string; } /** * * @namespace [Fit.Controls Controls] */ namespace Controls { // Functions defined by Fit.Controls /** * Check dirty state for all controls - either all controls on page, or within specified scope. Returns True if one or more controls are dirty, otherwise False. * @function DirtyCheckAll * @static * @param {string} [scope=undefined] - If specified, dirty check controls only within this scope. See Fit.Controls.ControlBase.Scope(..) for details on configurering scoped validation. * @returns boolean */ export function DirtyCheckAll(scope?:string):boolean; /** * Get control by unique Control ID - returns Null if not found. * @function Find * @static * @param {string} id - Unique Control ID. * @returns Fit.Controls.Component | null */ export function Find(id:string):Fit.Controls.Component | null; /** * Get control by unique Control ID - returns Null if not found. * @template ExpectedControlType * @function Find * @static * @param {string} id - Unique Control ID. * @param {ExpectedControlType} expectedType - For development environments supporting JSDoc and generics (e.g. VSCode), make Find(..) return found component as specified type. For instance to return a type as Fit.Controls.DropDown, specify Fit.Controls.DropDown.prototype. * @returns ExpectedControlType | null */ export function Find<ExpectedControlType>(id:string, expectedType:ExpectedControlType):ExpectedControlType | null; /** * Validate all controls - either all controls on page, or within specified scope. Returns True if all controls contain valid values, otherwise False. * @function ValidateAll * @static * @param {string} [scope=undefined] - If specified, validate controls only within this scope. See Fit.Controls.ControlBase.Scope(..) for details on configurering scoped validation. * @returns boolean */ export function ValidateAll(scope?:string):boolean; /** * Button control with support for Font Awesome icons. * @class [Fit.Controls.Button Button] */ class Button { // Functions defined by Fit.Controls.Button /** * Create instance of Button control. * @function Button * @param {string} [controlId=undefined] - Unique control ID that can be used to access control using Fit.Controls.Find(..). */ constructor(controlId?:string); /** * Programmatically trigger a button click. * @function Click */ public Click():void; /** * Get/set value indicating whether button is enabled or not. * @function Enabled * @param {boolean} [val=undefined] - If specified, True enables button, False disables it. * @returns boolean */ public Enabled(val?:boolean):boolean; /** * Get/set value indicating whether control has focus. * @function Focused * @param {boolean} [focus=undefined] - If defined, True assigns focus, False removes focus (blur). * @returns boolean */ public Focused(focus?:boolean):boolean; /** * Get/set control height - returns object with Value and Unit properties. * @function Height * @param {number} [val=undefined] - If defined, control height is updated to specified value. A value of -1 resets control height. * @param {Fit.TypeDefs.CssUnit | "%" | "ch" | "cm" | "em" | "ex" | "in" | "mm" | "pc" | "pt" | "px" | "rem" | "vh" | "vmax" | "vmin" | "vw"} [unit=px] - If defined, control height is updated to specified CSS unit. * @returns Fit.TypeDefs.CssValue */ public Height(val?:number, unit?:Fit.TypeDefs.CssUnit | "%" | "ch" | "cm" | "em" | "ex" | "in" | "mm" | "pc" | "pt" | "px" | "rem" | "vh" | "vmax" | "vmin" | "vw"):Fit.TypeDefs.CssValue; /** * Get/set button icon (Font Awesome icon name, e.g. fa-check-circle-o - https://fontawesome.com/v4.7.0/icons). * @function Icon * @param {string} [val=undefined] - If specified, button icon will be set to specified value. * @returns string */ public Icon(val?:string):string; /** * Set callback function invoked when button is clicked. * @function OnClick * @param {Fit.Controls.ButtonTypeDefs.ClickEventHandler} cb - Callback function invoked when button is clicked - takes button instance as argument. */ public OnClick(cb:Fit.Controls.ButtonTypeDefs.ClickEventHandler):void; /** * Get/set flag indicating whether button returns focus after click. * @function ReturnFocus * @param {boolean} [val=undefined] - A value of True causes button to return focus to previously focused element after click - defaults to False. * @returns boolean */ public ReturnFocus(val?:boolean):boolean; /** * Get/set button title. * @function Title * @param {string} [val=undefined] - If specified, button title will be set to specified value. * @returns string */ public Title(val?:string):string; /** * Get/set button type producing specific look and feel. Possible values are: - Fit.Controls.ButtonType.Default (white) - Fit.Controls.ButtonType.Primary (blue) - Fit.Controls.ButtonType.Success (green) - Fit.Controls.ButtonType.Info (turquoise) - Fit.Controls.ButtonType.Warning (orange) - Fit.Controls.ButtonType.Danger (red). * @function Type * @param {Fit.Controls.ButtonType | "Danger" | "Default" | "Info" | "Primary" | "Success" | "Warning"} [val=undefined] - If specified, button type will be set to specified value. * @returns Fit.Controls.ButtonType | "Danger" | "Default" | "Info" | "Primary" | "Success" | "Warning" */ public Type(val?:Fit.Controls.ButtonType | "Danger" | "Default" | "Info" | "Primary" | "Success" | "Warning"):Fit.Controls.ButtonType | "Danger" | "Default" | "Info" | "Primary" | "Success" | "Warning"; /** * Get/set control width - returns object with Value and Unit properties. * @function Width * @param {number} [val=undefined] - If defined, control width is updated to specified value. A value of -1 resets control width. * @param {Fit.TypeDefs.CssUnit | "%" | "ch" | "cm" | "em" | "ex" | "in" | "mm" | "pc" | "pt" | "px" | "rem" | "vh" | "vmax" | "vmin" | "vw"} [unit=px] - If defined, control width is updated to specified CSS unit. * @returns Fit.TypeDefs.CssValue */ public Width(val?:number, unit?:Fit.TypeDefs.CssUnit | "%" | "ch" | "cm" | "em" | "ex" | "in" | "mm" | "pc" | "pt" | "px" | "rem" | "vh" | "vmax" | "vmin" | "vw"):Fit.TypeDefs.CssValue; // Functions defined by Fit.Controls.Component /** * Destroys control to free up memory. Make sure to call Dispose() on Component which can be done like so: this.Dispose = Fit.Core.CreateOverride(this.Dispose, function() {      // Add control specific dispose logic here      base(); // Call Dispose on Component });. * @function Dispose */ public Dispose():void; /** * Get DOMElement representing control. * @function GetDomElement * @returns HTMLElement */ public GetDomElement():HTMLElement; /** * Get unique Control ID. * @function GetId * @returns string */ public GetId():string; /** * Render control, either inline or to element specified. * @function Render * @param {HTMLElement} [toElement=undefined] - If defined, control is rendered to this element. */ public Render(toElement?:HTMLElement):void; } /** * * @namespace [Fit.Controls.ButtonTypeDefs ButtonTypeDefs] */ namespace ButtonTypeDefs { // Functions defined by Fit.Controls.ButtonTypeDefs /** * OnClick event handler. * @callback ClickEventHandler * @param {Fit.Controls.Button} sender - Instance of Button. */ type ClickEventHandler = (sender:Fit.Controls.Button) => void; } /** * Simple CheckBox control. Extending from Fit.Controls.ControlBase. * @class [Fit.Controls.CheckBox CheckBox] */ class CheckBox { // Functions defined by Fit.Controls.CheckBox /** * Create instance of CheckBox control. * @function CheckBox * @param {string} [ctlId=undefined] - Unique control ID that can be used to a