Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

References

Re-exports DELETE

Type Aliases

Assignable<T>: T extends undefined ? (T extends Function ? T : T extends object ? { [ Key in keyof T]?: Assignable<T[Key]> } : T) | typeof DELETE : T extends Function ? T | undefined : T extends object ? { [ Key in keyof T]?: Assignable<T[Key]> } : T | undefined

Turns undefined into undefined | typeof DELETE and makes everything partial. Intended to be used with deepObjectAssign.

Type Parameters

  • T

ConfiguratorConfig: { readonly [ Key in string]: ConfiguratorConfig | ConfiguratorInput }
ConfiguratorHideOption: ((parentPath: readonly string[], optionName: string, options: any) => boolean)

Type declaration

    • (parentPath: readonly string[], optionName: string, options: any): boolean
    • Parameters

      • parentPath: readonly string[]
      • optionName: string
      • options: any

      Returns boolean

Mashable: number | string | boolean | object | bigint

Values of these types can be used as a seed.

OptionsConfig: { __type__: { object: "object" } & OptionsType } & { readonly [ Key in string]: OptionsConfig | OptionsType }

Variables

Activator: any
ColorPicker: any
Configurator: any
Hammer: HammerStatic
Popup: any
VALIDATOR_PRINT_STYLE: string
Validator: any
easingFunctions: { easeInCubic: any; easeInOutCubic: any; easeInOutQuad: any; easeInOutQuart: any; easeInOutQuint: any; easeInQuad: any; easeInQuart: any; easeInQuint: any; easeOutCubic: any; easeOutQuad: any; easeOutQuart: any; easeOutQuint: any; linear: any }

Type declaration

  • easeInCubic:function
    • easeInCubic(t: number): number
    • Accelerate from zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeInOutCubic:function
    • easeInOutCubic(t: number): number
    • Accelerate until halfway, then decelerate.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeInOutQuad:function
    • easeInOutQuad(t: number): number
    • Accelerate until halfway, then decelerate.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeInOutQuart:function
    • easeInOutQuart(t: number): number
    • Accelerate until halfway, then decelerate.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeInOutQuint:function
    • easeInOutQuint(t: number): number
    • Accelerate until halfway, then decelerate.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeInQuad:function
    • easeInQuad(t: number): number
    • Accelerate from zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeInQuart:function
    • easeInQuart(t: number): number
    • Accelerate from zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeInQuint:function
    • easeInQuint(t: number): number
    • Accelerate from zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeOutCubic:function
    • easeOutCubic(t: number): number
    • Decelerate to zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeOutQuad:function
    • easeOutQuad(t: number): number
    • Decelerate to zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeOutQuart:function
    • easeOutQuart(t: number): number
    • Decelerate to zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • easeOutQuint:function
    • easeOutQuint(t: number): number
    • Decelerate to zero velocity.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

  • linear:function
    • linear(t: number): number
    • Provides no easing and no acceleration.

      Parameters

      • t: number

        Time.

      Returns number

      Value at time t.

option: { asBoolean: any; asElement: any; asNumber: any; asSize: any; asString: any }

Type declaration

  • asBoolean:function
    • asBoolean(value: unknown, defaultValue?: boolean): null | boolean
    • Convert a value into a boolean.

      Parameters

      • value: unknown

        Value to be converted intoboolean, a function will be executed as (() => unknown).

      • Optional defaultValue: boolean

        If the value or the return value of the function == null then this will be returned.

      Returns null | boolean

      Corresponding boolean value, if none then the default value, if none then null.

  • asElement:function
    • asElement<T>(value: undefined | T | (() => undefined | T), defaultValue: T): null | T
    • Convert a value into a DOM Element.

      Type Parameters

      • T extends Node

      Parameters

      • value: undefined | T | (() => undefined | T)

        Value to be converted into DOM Element, a function will be executed as (() => unknown).

      • defaultValue: T

        If the value or the return value of the function == null then this will be returned.

      Returns null | T

      The DOM Element, if none then the default value, if none then null.

  • asNumber:function
    • asNumber(value: unknown, defaultValue?: number): null | number
    • Convert a value into a number.

      Parameters

      • value: unknown

        Value to be converted intonumber, a function will be executed as (() => unknown).

      • Optional defaultValue: number

        If the value or the return value of the function == null then this will be returned.

      Returns null | number

      Corresponding boxed number value, if none then the default value, if none then null.

  • asSize:function
    • asSize(value: unknown, defaultValue?: string): null | string
    • Convert a value into a size.

      Parameters

      • value: unknown

        Value to be converted intosize, a function will be executed as (() => unknown).

      • Optional defaultValue: string

        If the value or the return value of the function == null then this will be returned.

      Returns null | string

      Corresponding string value (number + 'px'), if none then the default value, if none then null.

  • asString:function
    • asString(value: unknown, defaultValue?: string): null | string
    • Convert a value into a string.

      Parameters

      • value: unknown

        Value to be converted intostring, a function will be executed as (() => unknown).

      • Optional defaultValue: string

        If the value or the return value of the function == null then this will be returned.

      Returns null | string

      Corresponding boxed string value, if none then the default value, if none then null.

Functions

  • Create a seeded pseudo random generator based on Alea by Johannes Baagøe.

    Parameters

    • Rest ...seed: Mashable[]

      All supplied arguments will be used as a seed. In case nothing is supplied the current time will be used to seed the generator.

    Returns RNG

    A ready to use seeded generator.

  • HSVToHex(h: number, s: number, v: number): string
  • Convert HSV <0, 1> into hex color string.

    Parameters

    • h: number

      Hue.

    • s: number

      Saturation.

    • v: number

      Value.

    Returns string

    Hex color string.

  • HSVToRGB(h: number, s: number, v: number): RGB
  • RGBToHSV(red: number, green: number, blue: number): HSV
  • RGBToHex(red: number, green: number, blue: number): string
  • Convert RGB <0, 255> into hex color string.

    Parameters

    • red: number

      Red channel.

    • green: number

      Green channel.

    • blue: number

      Blue channel.

    Returns string

    Hex color string (for example: '#0acdc0').

  • addClassName(elem: Element, classNames: string): void
  • Add a className to the given elements style.

    Parameters

    • elem: Element

      The element to which the classes will be added.

    • classNames: string

      Space separated list of classes.

    Returns void

  • addCssText(element: HTMLElement, cssText: string): void
  • Append a string with css styles to an element.

    Parameters

    • element: HTMLElement

      The element that will receive new styles.

    • cssText: string

      The styles to be appended.

    Returns void

  • binarySearchCustom<O, K1, K2>(orderedItems: O[], comparator: ((v: O[K1][K2]) => 0 | 1 | -1), field: K1, field2: K2): number
  • binarySearchCustom<O, K1>(orderedItems: O[], comparator: ((v: O[K1]) => 0 | 1 | -1), field: K1): number
  • Type Parameters

    • O extends object

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    Parameters

    • orderedItems: O[]
    • comparator: ((v: O[K1][K2]) => 0 | 1 | -1)
        • (v: O[K1][K2]): 0 | 1 | -1
        • Parameters

          • v: O[K1][K2]

          Returns 0 | 1 | -1

    • field: K1
    • field2: K2

    Returns number

  • Type Parameters

    • O extends object

    • K1 extends string | number | symbol

    Parameters

    • orderedItems: O[]
    • comparator: ((v: O[K1]) => 0 | 1 | -1)
        • (v: O[K1]): 0 | 1 | -1
        • Parameters

          • v: O[K1]

          Returns 0 | 1 | -1

    • field: K1

    Returns number

  • binarySearchValue<T>(orderedItems: { [ K in string]: number }[], target: number, field: T, sidePreference: "after" | "before", comparator?: ((a: number, b: number) => 0 | 1 | -1)): number
  • This function does a binary search for a specific value in a sorted array. If it does not exist but is in between of two values, we return either the one before or the one after, depending on user input If it is found, we return the index, else -1.

    Type Parameters

    • T extends string

    Parameters

    • orderedItems: { [ K in string]: number }[]

      Sorted array.

    • target: number

      The searched value.

    • field: T

      Name of the property in items to be searched.

    • sidePreference: "after" | "before"

      If the target is between two values, should the index of the before or the after be returned?

    • Optional comparator: ((a: number, b: number) => 0 | 1 | -1)

      An optional comparator, returning -1, 0, 1 for <, ===, >.

        • (a: number, b: number): 0 | 1 | -1
        • Parameters

          • a: number
          • b: number

          Returns 0 | 1 | -1

    Returns number

    The index of found value or -1 if nothing was found.

  • bridgeObject<T>(referenceObject: T): T
  • bridgeObject<T>(referenceObject: T): null
  • Type Parameters

    • T extends object

    Parameters

    • referenceObject: T

    Returns T

  • Type Parameters

    • T

    Parameters

    • referenceObject: T

    Returns null

  • copyAndExtendArray<T>(arr: readonly T[], newValue: T): T[]
  • copyAndExtendArray<A, V>(arr: readonly A[], newValue: V): (A | V)[]
  • Type Parameters

    • T

    Parameters

    • arr: readonly T[]
    • newValue: T

    Returns T[]

  • Type Parameters

    • A

    • V

    Parameters

    • arr: readonly A[]
    • newValue: V

    Returns (A | V)[]

  • copyArray<T>(arr: readonly T[]): T[]
  • Used to extend an array and copy it. This is used to propagate paths recursively.

    Type Parameters

    • T

    Parameters

    • arr: readonly T[]

      The array to be copied.

    Returns T[]

    Shallow copy of arr.

  • deepExtend(a: any, b: any, protoExtend?: boolean, allowDeletion?: boolean): any
  • Deep extend an object a with the properties of object b.

    Parameters

    • a: any

      Target object.

    • b: any

      Source object.

    • Optional protoExtend: boolean

      If true, the prototype values will also be extended. (That is the options objects that inherit from others will also get the inherited options).

    • Optional allowDeletion: boolean

      If true, the values of fields that are null will be deleted.

    Returns any

    Argument a.

  • deepObjectAssign<T>(target: T, ...sources: Assignable<T>[]): T
  • Deep version of object assign with additional deleting by the DELETE symbol.

    Type Parameters

    • T

    Parameters

    • target: T

      The object that will be augmented using the sources.

    • Rest ...sources: Assignable<T>[]

      Objects to be deeply merged into the target.

    Returns T

    The target (same instance).

  • equalArray(a: unknown[], b: unknown[]): boolean
  • Test whether all elements in two arrays are equal.

    Parameters

    • a: unknown[]

      First array.

    • b: unknown[]

      Second array.

    Returns boolean

    True if both arrays have the same length and same elements (1 = '1').

  • extend<T, U>(target: T, source: U): T & U
  • extend<T_1, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V
  • extend<T_2, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W
  • extend(target: object, ...sources: any[]): any
  • Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

    Type Parameters

    • T extends {}

    • U

    Parameters

    • target: T

      The target object to copy to.

    • source: U

      The source object from which to copy properties.

    Returns T & U

    The target object.

  • Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

    Type Parameters

    • T_1 extends {}

    • U_1

    • V

    Parameters

    • target: T_1

      The target object to copy to.

    • source1: U_1
    • source2: V

    Returns T_1 & U_1 & V

    The target object.

  • Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

    Type Parameters

    • T_2 extends {}

    • U_2

    • V_1

    • W

    Parameters

    • target: T_2

      The target object to copy to.

    • source1: U_2
    • source2: V_1
    • source3: W

    Returns T_2 & U_2 & V_1 & W

    The target object.

  • Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

    Parameters

    • target: object

      The target object to copy to.

    • Rest ...sources: any[]

    Returns any

    The target object.

  • fillIfDefined<T>(a: T, b: Partial<T>, allowDeletion?: boolean): void
  • Fill an object with a possibly partially defined other object.

    Only copies values for the properties already present in a. That means an object is not created on a property if only the b object has it.

    Type Parameters

    • T extends object

    Parameters

    • a: T

      The object that will have it's properties updated.

    • b: Partial<T>

      The object with property updates.

    • Optional allowDeletion: boolean

      If true, delete properties in a that are explicitly set to null in b.

    Returns void

  • forEach<V>(array: undefined | null | V[], callback: ((value: V, index: number, object: V[]) => void)): void
  • forEach<O>(object: undefined | null | O, callback: (<Key>(value: O[Key], key: Key, object: O) => void)): void
  • Type Parameters

    • V

    Parameters

    • array: undefined | null | V[]
    • callback: ((value: V, index: number, object: V[]) => void)
        • (value: V, index: number, object: V[]): void
        • Parameters

          • value: V
          • index: number
          • object: V[]

          Returns void

    Returns void

  • Type Parameters

    • O extends object

    Parameters

    • object: undefined | null | O
    • callback: (<Key>(value: O[Key], key: Key, object: O) => void)
        • <Key>(value: O[Key], key: Key, object: O): void
        • Type Parameters

          • Key extends string | number | symbol

          Parameters

          • value: O[Key]
          • key: Key
          • object: O

          Returns void

    Returns void

  • getAbsoluteLeft(elem: Element): number
  • Retrieve the absolute left value of a DOM element.

    Parameters

    • elem: Element

      A dom element, for example a div.

    Returns number

    The absolute left position of this element in the browser page.

  • getAbsoluteRight(elem: Element): number
  • Retrieve the absolute right value of a DOM element.

    Parameters

    • elem: Element

      A dom element, for example a div.

    Returns number

    The absolute right position of this element in the browser page.

  • getAbsoluteTop(elem: Element): number
  • Retrieve the absolute top value of a DOM element.

    Parameters

    • elem: Element

      A dom element, for example a div.

    Returns number

    The absolute top position of this element in the browser page.

  • getScrollBarWidth(): number
  • Experimentaly compute the width of the scrollbar for this browser.

    Returns number

    The width in pixels.

  • getTarget(event?: Event): Element | null
  • Get HTML element which is the target of the event.

    Parameters

    • Optional event: Event

      The event.

    Returns Element | null

    The element or null if not obtainable.

  • getType(object: unknown): string
  • Get the type of an object, for example exports.getType([]) returns 'Array'.

    Parameters

    • object: unknown

      Input value of unknown type.

    Returns string

    Detected type.

  • hasParent(element: Element, parent: Element): boolean
  • Check if given element contains given parent somewhere in the DOM tree.

    Parameters

    • element: Element

      The element to be tested.

    • parent: Element

      The ancestor (not necessarily parent) of the element.

    Returns boolean

    True if parent is an ancestor of the element, false otherwise.

  • hexToHSV(hex: string): HSV
  • Convert hex color string into HSV <0, 1>.

    Parameters

    • hex: string

      Hex color string.

    Returns HSV

    HSV color object.

  • hexToRGB(hex: string): RGB | null
  • insertSort<T>(a: T[], compare: ((a: T, b: T) => number)): T[]
  • This method provides a stable sort implementation, very fast for presorted data.

    Type Parameters

    • T

    Parameters

    • a: T[]

      The array to be sorted (in-place).

    • compare: ((a: T, b: T) => number)

      An order comparator.

        • (a: T, b: T): number
        • Parameters

          • a: T
          • b: T

          Returns number

    Returns T[]

    The argument a.

  • isDate(value: unknown): value is string | Date
  • Test whether given object is a Date, or a String containing a Date.

    Parameters

    • value: unknown

      Input value of unknown type.

    Returns value is string | Date

    True if Date instance or string date representation, false otherwise.

  • isNumber(value: unknown): value is number
  • Test whether given object is a number.

    Parameters

    • value: unknown

      Input value of unknown type.

    Returns value is number

    True if number, false otherwise.

  • isObject(value: unknown): value is object
  • Test whether given object is a object (not primitive or null).

    Parameters

    • value: unknown

      Input value of unknown type.

    Returns value is object

    True if not null object, false otherwise.

  • isString(value: unknown): value is string
  • Test whether given object is a string.

    Parameters

    • value: unknown

      Input value of unknown type.

    Returns value is string

    True if string, false otherwise.

  • isValidHex(hex: string): boolean
  • Validate hex color string.

    Parameters

    • hex: string

      Unknown string that may contain a color.

    Returns boolean

    True if the string is valid, false otherwise.

  • isValidRGB(rgb: string): boolean
  • Validate RGB color string.

    Parameters

    • rgb: string

      Unknown string that may contain a color.

    Returns boolean

    True if the string is valid, false otherwise.

  • isValidRGBA(rgba: string): boolean
  • Validate RGBA color string.

    Parameters

    • rgba: string

      Unknown string that may contain a color.

    Returns boolean

    True if the string is valid, false otherwise.

  • mergeOptions(mergeTarget: any, options: any, option: string, globalOptions?: any): void
  • This is used to set the options of subobjects in the options object.

    A requirement of these subobjects is that they have an 'enabled' element which is optional for the user but mandatory for the program.

    The added value here of the merge is that option 'enabled' is set as required.

    Parameters

    • mergeTarget: any

      Either this.options or the options used for the groups.

    • options: any

      Options.

    • option: string

      Option key in the options argument.

    • Optional globalOptions: any

      Global options, passed in to determine value of option 'enabled'.

    Returns void

  • overrideOpacity(color: string, opacity: number): string
  • This function takes string color in hex or RGB format and adds the opacity, RGBA is passed through unchanged.

    Parameters

    • color: string

      The color string (hex, RGB, RGBA).

    • opacity: number

      The new opacity.

    Returns string

    RGBA string, for example 'rgba(255, 0, 127, 0.3)'.

  • preventDefault(event: undefined | Event): void
  • Cancels the event's default action if it is cancelable, without stopping further propagation of the event.

    Parameters

    • event: undefined | Event

      The event whose default action should be prevented.

    Returns void

  • pureDeepObjectAssign<T>(base: T, ...updates: Assignable<T>[]): T
  • Pure version of deepObjectAssign, it doesn't modify any of it's arguments.

    Type Parameters

    • T

    Parameters

    • base: T

      The base object that fullfils the whole interface T.

    • Rest ...updates: Assignable<T>[]

      Updates that may change or delete props.

    Returns T

    A brand new instance with all the supplied objects deeply merged.

  • recursiveDOMDelete(DOMobject: undefined | null | Node): void
  • Remove everything in the DOM object.

    Parameters

    • DOMobject: undefined | null | Node

      Node whose child nodes will be recursively deleted.

    Returns void

  • removeClassName(elem: Element, classNames: string): void
  • Remove a className from the given elements style.

    Parameters

    • elem: Element

      The element from which the classes will be removed.

    • classNames: string

      Space separated list of classes.

    Returns void

  • removeCssText(element: HTMLElement, cssText: string): void
  • Remove a string with css styles from an element.

    Parameters

    • element: HTMLElement

      The element from which styles should be removed.

    • cssText: string

      The styles to be removed.

    Returns void

  • selectiveBridgeObject<F, V>(fields: F[], referenceObject: Record<F, V>): Record<F, V> | null
  • This recursively redirects the prototype of JSON objects to the referenceObject. This is used for default options.

    Type Parameters

    • F extends string

    • V

    Parameters

    • fields: F[]

      Names of properties to be bridged.

    • referenceObject: Record<F, V>

      The original object.

    Returns Record<F, V> | null

    A new object inheriting from the referenceObject.

  • selectiveDeepExtend(props: string[], a: any, b: any, allowDeletion?: boolean): any
  • Extend object a with selected properties of object b. Only properties with defined values are copied.

    remarks

    Previous version of this routine implied that multiple source objects could be used; however, the implementation was wrong. Since multiple (>1) sources weren't used anywhere in the vis.js code, this has been removed

    Parameters

    • props: string[]

      Names of first-level properties to copy over.

    • a: any

      Target object.

    • b: any

      Source object.

    • Optional allowDeletion: boolean

      If true, delete property in a if explicitly set to null in b.

    Returns any

    Argument a.

  • selectiveExtend(props: string[], a: any, ...others: any[]): any
  • Extend object a with selected properties of object b or a series of objects.

    remarks

    Only properties with defined values are copied.

    Parameters

    • props: string[]

      Properties to be copied to a.

    • a: any

      The target.

    • Rest ...others: any[]

      The sources.

    Returns any

    Argument a.

  • selectiveNotDeepExtend(propsToExclude: string[], a: any, b: any, allowDeletion?: boolean): any
  • Extend object a with properties of object b, ignoring properties which are explicitly specified to be excluded.

    remarks

    The properties of b are considered for copying. Properties which are themselves objects are are also extended. Only properties with defined values are copied.

    Parameters

    • propsToExclude: string[]

      Names of properties which should not be copied.

    • a: any

      Object to extend.

    • b: any

      Object to take properties from for extension.

    • Optional allowDeletion: boolean

      If true, delete properties in a that are explicitly set to null in b.

    Returns any

    Argument a.

  • throttle(fn: (() => void)): (() => void)
  • Throttle the given function to be only executed once per animation frame.

    Parameters

    • fn: (() => void)

      The original function.

        • (): void
        • Returns void

    Returns (() => void)

    The throttled function.

      • (): void
      • Throttle the given function to be only executed once per animation frame.

        Returns void

        The throttled function.

  • toArray<T>(o: {} | ArrayLike<T>): T[]
  • toArray(o: {}): any[]
  • Convert an object into an array: all objects properties are put into the array. The resulting array is unordered.

    Type Parameters

    • T

    Parameters

    • o: {} | ArrayLike<T>

      Object that contains the properties and methods.

    Returns T[]

    An array of unordered values.

  • Convert an object into an array: all objects properties are put into the array. The resulting array is unordered.

    Parameters

    • o: {}

      Object that contains the properties and methods.

      Returns any[]

      An array of unordered values.

    • topMost(pile: any, accessors: any): any
    • Get the top most property value from a pile of objects.

      Parameters

      • pile: any

        Array of objects, no required format.

      • accessors: any

        Array of property names. For example object['foo']['bar']['foo', 'bar'].

      Returns any

      Value of the property with given accessors path from the first pile item where it's not undefined.

    • updateProperty<K, V>(object: Record<K, V>, key: K, value: V): boolean
    • Update a property in an object.

      Type Parameters

      • K extends string

      • V

      Parameters

      • object: Record<K, V>

        The object whose property will be updated.

      • key: K

        Name of the property to be updated.

      • value: V

        The new value to be assigned.

      Returns boolean

      Whether the value was updated (true) or already strictly the same in the original object (false).

    Generated using TypeDoc