Options
All
  • Public
  • Public/Protected
  • All
Menu

The view model for the Slider widget.

Type parameters

  • T

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Protected _config

_config: SliderConfig

The configuration options for this slider.

Protected _defaultItemActivePredicate

_defaultItemActivePredicate: function

The default predicate which determines whether a slider item is active (ie selectable) in the slider or not. This function will be executed each time an item is selected.

Type declaration

    • (item: T | number, index: number): boolean
    • Parameters

      • item: T | number
      • index: number

      Returns boolean

Protected _defaultNumericLabelGenerator

_defaultNumericLabelGenerator: function

The default label generator for a number series.

Type declaration

    • (item: number, index: number): string
    • Parameters

      • item: number
      • index: number

      Returns string

Protected _defaultSliderDivisions

_defaultSliderDivisions: number

Protected _isDestroyed

_isDestroyed: boolean

Protected _maxSliderTicks

_maxSliderTicks: number

Protected _numericSliderItemCache

_numericSliderItemCache: __type

In numeric mode, the items collection is kept empty. We create SliderItems based on the actual numeric value the user selects. This is an internal cache of previously created SliderItem objects so we can reuse older objects once they've been created.

Protected _snappableDatePoints

_snappableDatePoints: number[]

Protected _underlyingCollection

_underlyingCollection: ObservableCollection<T>

The underlying collection of observable items, if any, that this slider is bound to. WARNING: Do not modify this collection in any manner whatsoever since it is a reference to an external observableCollection we're binding to.

Protected _underlyingCollectionBindingToken

_underlyingCollectionBindingToken: string

The token representing the binding to the underlying collection.

animate

animate: boolean

Indicates whether the generated slider is animated or not. Defaults to false.

app

dateModeTimeInterval

dateModeTimeInterval: number

The time interval for this slider if it has been invoked in date mode.

dateModeTimeIntervalUnit

dateModeTimeIntervalUnit: TimeUnits

The time interval unit for this slider if it has been invoked in date mode.

disableSnappingForNumericValues

disableSnappingForNumericValues: boolean

Indicates whether snapping to data items or labels is disabled altogether when the slider is in numeric mode - i.e. all data item values are numeric. Defauls to true.

id

id: string

isDateMode

isDateMode: boolean

Indicates whether the slider is dealing with dates.

isEnabled

isEnabled: Observable<boolean>

Enable or disable the slider.

isNumeric

isNumeric: boolean

Indicates whether this slider contains numeric data only or other types of objects.

itemActivePredicate

itemActivePredicate: function

The predicate which, will be applied to compute whether an item is active (i.e. selectable) each time it is selected in the slider. Returns true by default.

Type declaration

    • (item: T | number, index: number): boolean
    • Parameters

      • item: T | number
      • index: number

      Returns boolean

items

The items that participate in this slider. This collection is automatically set when an underlying collection is attached to. It need not be set if the slider is configured to display an integer range. This includes a date range measured as milliseconds from epoch.

labelGenerator

labelGenerator: function

The label generator function which, if defined, will be applied to compute the labels corresponding to each item in the underlying collection.

Type declaration

    • (item: T | number, index: number): string
    • Parameters

      • item: T | number
      • index: number

      Returns string

libraryId

libraryId: string

lockMinSliderHandleAtMinVal

lockMinSliderHandleAtMinVal: boolean

If true, will lock the min slider handle at the min value, provided the slider is in range mode. Ineffective in non-range mode.

numericSliderHandleStartValues

numericSliderHandleStartValues: number[]

The numeric start values for the slider handles when the slider is in numeric mode.

numericSliderMaxVal

numericSliderMaxVal: number

The max value for the slider if in numeric mode.

numericSliderMinVal

numericSliderMinVal: number

The min value for the slider if in numeric mode.

numericSliderStep

numericSliderStep: number

Defines the steps the time slider will take if the data is numeric. This may be overridden if the next available item is not active.

range

range: boolean

Indicates whether this slider should be a range slider (two handles) or a solo slider. Defaults to false.

sliderHandleStartLabels

sliderHandleStartLabels: string[]

The start labels for the slider handles when the slider is in non-numeric mode.

sliderMaxHandleAriaLabel

sliderMaxHandleAriaLabel: string

A language string to be applied to the aria-label of the slider max handle if in range mode. This is for WCAG compliance. If not defined, the currently selected time will be set as the label.

sliderMaxHandleCurrentItem

sliderMaxHandleCurrentItem: Observable<SliderItem<T>>

The item currently associated with the max slider handle if range mode is active.

sliderMaxHandleLabel

sliderMaxHandleLabel: Observable<string>

The currently selected label for the second slider handle (if configured as a range slider).

sliderMaxLabel

sliderMaxLabel: Observable<string>

The label for the slider's maximum value.

sliderMinHandleAriaLabel

sliderMinHandleAriaLabel: string

A language string to be applied to the aria-label of the slider min handle if in range mode. This is for WCAG compliance. If not defined, the currently selected time will be set as the label.

sliderMinHandleCurrentItem

sliderMinHandleCurrentItem: Observable<SliderItem<T>>

The item currently associated with the min slider handle.

sliderMinHandleLabel

sliderMinHandleLabel: Observable<string>

The currently selected label for the first slider handle.

sliderMinLabel

sliderMinLabel: Observable<string>

The label for the slider's minimum value.

sliderSingleHandleAriaLabel

sliderSingleHandleAriaLabel: string

A language string to be applied to the aria-label of the slider handle if it is not in range mode. This is for WCAG compliance. If not defined, the currently selected time will be set as the label.

sliderTicks

The ticks for the slider.

Methods

Protected _applyConfig

  • Apply configuration settings or defaults if no settings are available.

    Parameters

    Returns void

Protected _createSliderItem

  • _createSliderItem(item: T | number, index: number): SliderItem<T>
  • Create a SliderItem for the given underlying item.

    Parameters

    • item: T | number
    • index: number

    Returns SliderItem<T>

Protected _generateDateModeSnappablePoints

  • _generateDateModeSnappablePoints(): void
  • Returns void

Protected _getAdjacentNumericItemRawValue

  • _getAdjacentNumericItemRawValue(rawValue: number, position?: string, autoSnapNumericValsToMinMax?: boolean): number
  • Parameters

    • rawValue: number
    • Optional position: string
    • Optional autoSnapNumericValsToMinMax: boolean

    Returns number

Protected _getAdjacentSliderItem

  • _getAdjacentSliderItem(sliderItem: SliderItem<T>, position?: string, status?: string): SliderItem<T>
  • Internal implementation to get the next or previous active slider item. Returns the item if it exists, null otherwise.

    Parameters

    • sliderItem: SliderItem<T>

      The slider item for which we want to retrieve the next or previous active slider item.

    • Optional position: string

      May have two distinct values - "next" for the next active slider item or "prev" for the previous active slider item. Defaults to "next"

    • Optional status: string

      May have three distinct values - "active" for active slider item, "inactive" for inactive slider item or "any" for a slider item with any status. Defaults to "any".

    Returns SliderItem<T>

Protected _getClosestDateItemRawValueSnappedToInterval

  • _getClosestDateItemRawValueSnappedToInterval(rawValue: number, searchDirection?: string, doNotReturnOriginal?: boolean): number
  • Parameters

    • rawValue: number
    • Optional searchDirection: string
    • Optional doNotReturnOriginal: boolean

    Returns number

Protected _getItemLabel

  • _getItemLabel(item: T | number, index: number): string
  • Get the label for the current item

    Parameters

    • item: T | number
    • index: number

    Returns string

Protected _getUpdatedNumericItemAndUpdateCache

  • _getUpdatedNumericItemAndUpdateCache(value: number, index: number): SliderItem<T>
  • Retrieve a numeric slider item by value and update the numeric item cache so subsequent retrievals return the same object.

    Parameters

    • value: number
    • index: number

    Returns SliderItem<T>

Protected _handleUnderlyingCollectionChanges

  • Update the items collection as the underlying collection changes.

    Parameters

    Returns void

Protected _initializeUIObservables

  • _initializeUIObservables(): void
  • Returns void

Protected _resetTimeIntervalBasedOnSliderStep

  • _resetTimeIntervalBasedOnSliderStep(): void
  • Returns void

Protected _setNextOrPreviousSliderItem

  • _setNextOrPreviousSliderItem(handleIndex: number, qualifier: string): boolean
  • Parameters

    • handleIndex: number
    • qualifier: string

    Returns boolean

Protected _setupSliderMinMaxLabels

  • _setupSliderMinMaxLabels(): void
  • Returns void

Protected _setupSliderTicks

  • _setupSliderTicks(): void
  • Returns void

Protected _updateSliderItem

  • Parameters

    Returns SliderItem<T>

attachToCollection

  • attachToCollection(collection: ObservableCollection<T>, labelGenerator?: function, itemActivePredicate?: function, startItemLabels?: string[]): void
  • Attaches to an ObservableCollection and automatically generates relevant SliderItems.

    Parameters

    • collection: ObservableCollection<T>

      The collection to attach to.

    • Optional labelGenerator: function

      Optional function which will be called for each item in the collection. Generates a string label for the item. For example (item: Feature, index: number) => ${index + 1}: ${item.label.get()};

        • (item: T, index: number): string
        • Parameters

          • item: T
          • index: number

          Returns string

    • Optional itemActivePredicate: function

      Optional. A function which determines whether the current item is active (ie is selectable in the slider) or not. This function will be executed each time an item is selected. If not specified, returns true.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    • Optional startItemLabels: string[]

      Optional. An array of strings containing one or two values, depicting the start labels of the handle (or handles if in range mode) of the slider. These values will be applied on a best effort basis: 1) At slider creation time:: If the startup label values are valid, they will be applied. 2) When an attached collection is updated:: If the startup label value has not yet been applied and the slider handle has not been moved manually by the user at the point in time when the collection is updated, the startup label values will be applied provided they are valid. Once the user moves either one of the slider handles manually, the startup label values will no longer be respected. If no startup label values are provided, the handles will start at the first and second data points respectively by default.

    Returns void

auto

  • auto(arg0: any, arg1: any, arg2: any): void
  • Binds a handler to an Observable or to a dojo.connect. Binding to an Observable:

    ``` this.auto(someObservable, function (newValue) { });

    with explicit scope:

    this.auto(someObservable, this, function (newValue) { });

    Alternately, pass an event name as a string to use dojo.connect:

    this.auto(window, "onclick", function () { }); ```

    Parameters

    • arg0: any

      Either an Observable (for observable bindings) or a regular object (if arg1 is a string)

    • arg1: any

      If arg0 is an Observable, a function or scope object. Otherwise, an event name (to use with dojo.connect).

    • arg2: any

      If arg0 is an Observable, a function handler.

    Returns void

cleanUp

  • cleanUp(): void
  • Returns void

destroy

  • destroy(): void
  • Destroys the object completely

    Returns void

destroyBindings

  • destroyBindings(): void

getClosestDateItemSnappedToInterval

  • getClosestDateItemSnappedToInterval(sliderItem: SliderItem<number>, searchDirection?: string, doNotReturnOriginal?: boolean): SliderItem<number>
  • Get the nearest date item snapped to a computed date interval. This will work only in date mode.

    Parameters

    • sliderItem: SliderItem<number>

      The slider item for which the nearest date item needs to be computed.

    • Optional searchDirection: string

      A string - "next" or "prev" - defining which direction to search in.

    • Optional doNotReturnOriginal: boolean

      A boolean which if true will prevent the function from returning the original item if it's already snapped to interval.

    Returns SliderItem<number>

    The closest date item if found. Null otherwise.

getNextActiveSliderItem

  • Get the next active slider item.

    Parameters

    • sliderItem: SliderItem<T>

      The current slider item with respect to which we want to find the next active item.

    Returns SliderItem<T>

getNextInactiveSliderItem

  • Get the next inactive slider item.

    Parameters

    • sliderItem: SliderItem<T>

      The current slider item with respect to which we want to find the next inactive item.

    Returns SliderItem<T>

getNextSliderItem

  • Get the next slider item.

    Parameters

    • sliderItem: SliderItem<T>

      The current slider item with respect to which we want to find the next item.

    Returns SliderItem<T>

getPreviousActiveSliderItem

  • Get the previous active slider item.

    Parameters

    • sliderItem: SliderItem<T>

      The current slider item with respect to which we want to find the previous active item.

    Returns SliderItem<T>

getPreviousInactiveSliderItem

  • Get the previous inactive slider item.

    Parameters

    • sliderItem: SliderItem<T>

      The current slider item with respect to which we want to find the previous inactive item.

    Returns SliderItem<T>

getPreviousSliderItem

  • Get the previous slider item.

    Parameters

    • sliderItem: SliderItem<T>

      The current slider item with respect to which we want to find the previous item.

    Returns SliderItem<T>

getRawSliderValueForItem

  • getRawSliderValueForItem(sliderItem: SliderItem<any>): number
  • Get the raw slider value for a give slider item. Returns the raw slider value or null if the item does not exist.

    Parameters

    Returns number

getResource

  • getResource(resourceKey: string, locale?: string): string
  • Gets a language resource from the Application's resource dictionary, given a key, and optional locale. Returns null if the resource does not exist.

    Parameters

    • resourceKey: string
    • Optional locale: string

      The locale of the resource to fetch. Defaults to the current application locale.

    Returns string

getSliderItemByItemLabel

  • getSliderItemByItemLabel(label: string): SliderItem<T>
  • Retrieve the updated slider item corresponding to the given slider label. Returns the slider item if found, null otherwise. If more than one item exists with the same label, we'll return the first match.

    Parameters

    • label: string

    Returns SliderItem<T>

getSliderItemByItemValue

  • getSliderItemByItemValue(value: T | number): SliderItem<T>
  • Retrieve the updated slider item corresponding to the given item value. Returns the slider item if found, null otherwise.

    Parameters

    • value: T | number

    Returns SliderItem<T>

getSliderItemByRawSliderValue

  • getSliderItemByRawSliderValue(rawSliderValue: number, autoSnapNumericValsToMinMax?: boolean): SliderItem<any>
  • Retrieve the updated slider item corresponding to the raw slider value. Returns the slider item if found, null otherwise.

    Parameters

    • rawSliderValue: number
    • Optional autoSnapNumericValsToMinMax: boolean

    Returns SliderItem<any>

initialize

  • Initializes the slider configuration. Can either be initialized using the "initialize" method or by passing in the config object directly during instantiation. Explicitly initializing will overwrite any previous configuration settings that may have been applied during slider instantiation.

    Parameters

    Returns void

onDestroy

  • onDestroy(): void
  • Override or attach to provide custom clean-up behaviour.

    Returns void

setNextSliderItem

  • setNextSliderItem(handleIndex: number): boolean
  • Parameters

    • handleIndex: number

    Returns boolean

setPreviousSliderItem

  • setPreviousSliderItem(handleIndex: number): boolean
  • Parameters

    • handleIndex: number

    Returns boolean

setSelectedSliderItem

  • setSelectedSliderItem(handleIndex: number, item: SliderItem<any>): void
  • Set the selected slider item for the specified handle in the view model. This function is intended to be invoked by the view code behind and does not update the slider UI widget itself.

    Parameters

    • handleIndex: number

      The index of the slider handle for which to set the selected slider item.

    • item: SliderItem<any>

      The SliderItem to update the selected handle value to.

    Returns void

setupDateSlider

  • setupDateSlider(minDateMsSinceEpoch: number, maxDateMsSinceEpoch: number, timeInterval: number, timeIntervalUnit: TimeUnits, labelGenerator?: function, itemActivePredicate?: function, startItemValues?: number[]): void
  • Parameters

    • minDateMsSinceEpoch: number
    • maxDateMsSinceEpoch: number
    • timeInterval: number
    • timeIntervalUnit: TimeUnits
    • Optional labelGenerator: function
        • (item: number, index: number): string
        • Parameters

          • item: number
          • index: number

          Returns string

    • Optional itemActivePredicate: function
        • (item: number, index: number): boolean
        • Parameters

          • item: number
          • index: number

          Returns boolean

    • Optional startItemValues: number[]

    Returns void

setupNumericSlider

  • setupNumericSlider(minVal: number, maxVal: number, steps?: number, labelGenerator?: function, itemActivePredicate?: function, startItemValues?: number[]): void
  • Puts the slider into numeric mode. This will clear out all underlying attached collections if attached previously and convert the slider into a vanilla jQuery numeric slider, albeit with configurable labels. The items collection will remain empty and so will the underlying collection.

    Parameters

    • minVal: number

      The minimum value of the numveric range this slider will represent.

    • maxVal: number

      The maximum value fo the numeric range this slider will represent.

    • Optional steps: number

      Optional parameter defining the number of steps between two data items. If not provided, a default value of 1 will be used for values over 1. 0.1 will be used for values below 1.

    • Optional labelGenerator: function

      Optional parameter defining the rules by which labels should be generated. If not provided, the label will be a string representation of the number itself.

        • (item: number, index: number): string
        • Parameters

          • item: number
          • index: number

          Returns string

    • Optional itemActivePredicate: function

      Optional. A function which determines whether the current item is active (ie is selectable in the slider) or not. This function will be executed each time an item is selected. If not specified, returns true.

        • (item: number, index: number): boolean
        • Parameters

          • item: number
          • index: number

          Returns boolean

    • Optional startItemValues: number[]

      Optional. An array of numbers containing one or two values, depicting the start values of the handle (or handles if in range mode) of the slider. These values will be applied on a best effort basis: 1) At slider creation time:: If the startup values are valid, they will be applied. 2) When an attached collection is updated:: If the startup value has not yet been applied and the slider handle has not been moved manually by the user at the point in time when the collection is updated, the startup values will be applied provided they are valid. Once the user moves either one of the slider handles manually, the startup values will no longer be respected. If no startup values are provided, the handles will start at the first and second data points respectively by default.

    Returns void

sliderHandleSlide

  • sliderHandleSlide(value: SliderItem<T>, handleIndex: number): void
  • Triggered on every mouse-move during slide. The value provided represents the value that the handle will have as a result of the current movement.

    Parameters

    • value: SliderItem<T>

      The SliderItem corresponding to the current slider value.

    • handleIndex: number

      The index of the handle which has currently been slid. This will possible values of 0 or 1.

    Returns void

trackCommandHandler

  • trackCommandHandler(command: any, token: any): void
  • Tracks a subscription to an {@link geocortex.framework.commands.Command}, disposing it when this object is disposed with the destroy method.

    Parameters

    • command: any
    • token: any

    Returns void

trackSubscription

  • trackSubscription(event: any, token: any): void
  • Tracks a subscription to an {@link geocortex.framework.events.Event}, disposing it when this object is disposed with the destroy method.

    Parameters

    • event: any
    • token: any

    Returns void