Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SegmentedButton

A SegmentedButton is a button subclass that also contains a segmented control within the button, which can be used to change the current value of the button or to use as a secondary value associated with the button's value, such as filters.

export

Hierarchy

Implements

Index

Constructors

constructor

  • Initializes and returns a segmented button instance configured with the specified options.

    memberof

    SegmentedButton

    Parameters

    Returns SegmentedButton

Accessors

$el

  • get $el(): any
  • DOM element associated with the view.

    readonly
    memberof

    View

    Returns any

controls

data

  • get data(): any
  • Data used when rendering the view, if any.

    readonly
    memberof

    View

    Returns any

groupId

  • get groupId(): string

id

  • get id(): string
  • Button identifier.

    readonly
    memberof

    Button

    Returns string

info

  • Returns the button metadata, including identifier, key, current value, and selected segments.

    readonly
    memberof

    SegmentedButton

    Returns ButtonInfo

isExpanded

  • get isExpanded(): boolean
  • Returns whether the button is currently expanded.

    readonly
    memberof

    SegmentedButton

    Returns boolean

isFilter

  • get isFilter(): boolean
  • Returns whether the segments are configured as filter options.

    readonly
    memberof

    SegmentedButton

    Returns boolean

isMounted

  • get isMounted(): boolean
  • Returns boolean

isRendered

  • get isRendered(): boolean
  • Returns boolean

key

  • get key(): string
  • Returns string

options

  • get options(): any
  • Custom data associated with the button, if any.

    readonly
    memberof

    Button

    Returns any

opts

parentId

  • get parentId(): string

selected

  • get selected(): boolean
  • A Boolean indicated whether the button is currently selected.

    readonly
    memberof

    Button

    Returns boolean

state

  • Current component state.

    readonly
    memberof

    Component

    Returns ButtonState

title

  • get title(): string
  • Title label displayed for the button.

    readonly
    memberof

    Button

    Returns string

toggleable

  • get toggleable(): boolean

ui

  • get ui(): {}
  • Interface DOM targets, which are only available after the view has been rendered to the DOM.

    readonly
    memberof

    View

    Returns {}

    • [key: string]: any

value

  • get value(): Array<string> | Record<string, any>
  • set value(value: Array<string> | Record<string, any>): void
  • Value associated with the currently selected segment(s).

    readonly
    memberof

    SegmentedButton

    Returns Array<string> | Record<string, any>

  • Value associated with the currently selected segment(s).

    readonly
    memberof

    SegmentedButton

    Parameters

    • value: Array<string> | Record<string, any>

    Returns void

Methods

addTo

  • addTo(target: HTMLElement | string, replace?: boolean, index?: number): boolean
  • Adds the view's element to the DOM by appending it to the specified target.

    memberof

    View

    Parameters

    • target: HTMLElement | string

      DOM target in which the view will be appended

    • Default value replace: boolean = false
    • Default value index: number = -1

    Returns boolean

bounds

  • bounds(absolute?: boolean, relative?: any): Bounds
  • Parameters

    • Default value absolute: boolean = false
    • Default value relative: any = null

    Returns Bounds

containsId

  • containsId(id: string): boolean
  • Parameters

    • id: string

    Returns boolean

containsValue

  • containsValue(value: string): boolean
  • Returns true if the button contains a segment option associated with the specified value. This can either be a button segment value or identifier.

    memberof

    SegmentedButton

    Parameters

    • value: string

    Returns boolean

deselect

  • deselect(trigger?: boolean): void
  • Deselects the button.

    memberof

    Button

    Parameters

    • Default value trigger: boolean = true

    Returns void

deselectSegment

  • deselectSegment(option: string | Record<string, any>): void
  • Deselects the button segment associated with the specified option.

    memberof

    SegmentedButton

    Parameters

    • option: string | Record<string, any>

    Returns void

disable

  • disable(value: boolean): void
  • Enables or disables the button. If disabled, button will not react to click events.

    Parameters

    • value: boolean

    Returns void

el

  • el(selector: string): any
  • Parameters

    • selector: string

    Returns any

getState

  • getState(key: string): any
  • Parameters

    • key: string

    Returns any

has

  • has(type: string): boolean
  • Returns whether the listeners are registered for the specified event name.

    memberof

    EventDispatcher

    Parameters

    • type: string

    Returns boolean

hide

  • hide(): void
  • Hides the view.

    memberof

    View

    Returns void

index

  • index(): number
  • Returns number

initialize

  • initialize(data?: any): void
  • Parameters

    • Optional data: any

    Returns void

layout

  • layout(): void
  • Returns void

matches

  • matches(check: string | Array<string>): boolean
  • Parameters

    • check: string | Array<string>

    Returns boolean

moveTo

  • moveTo(position: Point, offset?: { x: number; y: number }): void
  • Updates the view's position to the specified x and y values with optional offsets. The view must be configured with absolute positioning.

    memberof

    View

    Parameters

    • position: Point
    • Default value offset: { x: number; y: number } = { x: 0, y: 0 }
      • x: number
      • y: number

    Returns void

off

  • Removes a registered listener function for the specified event.

    memberof

    EventDispatcher

    Parameters

    • type: string

      Name of the event to remove the listener for.

    • callback: Function

      Handler function to remove so it won't be executed next time the event is triggered.

    • Default value scope: any = null

    Returns EventDispatcher

offAll

on

  • on(type: string, callback: Function, scope?: any, priority?: number): EventDispatcher
  • Registers a listener function to be executed each time an event occurs

    memberof

    EventDispatcher

    Parameters

    • type: string

      Name of the event to listen for. Value can contain multiple event names separated by spaces to trigger the same handler function for each event name.

    • callback: Function

      Handler function to be called when the event occurs

    • Default value scope: any = null
    • Default value priority: number = 0

    Returns EventDispatcher

once

  • once(type: string, callback: Function, scope?: any, priority?: number): EventDispatcher
  • Registers a listener function to be executed the first time an event occurs.

    memberof

    EventDispatcher

    Parameters

    • type: string

      Name of the event to listen for. Value can contain multiple event names separated by spaces to trigger the same handler function for each event name.

    • callback: Function

      Handler function to be called when the event occurs

    • Default value scope: any = null
    • Default value priority: number = 0

    Returns EventDispatcher

parent

  • parent(): any
  • Parent DOM target, if any. Parent will be null if the view has not been added to the DOM.

    memberof

    View

    Returns any

pinTo

  • pinTo(position: AnchorType, offset?: { x: number; y: number }): void
  • Positions the view by pinning it relative to its parent container. The view must be configured with absolute positioning.

    memberof

    View

    Parameters

    • position: AnchorType

      Anchor position of the view within its container

    • Optional offset: { x: number; y: number }
      • x: number
      • y: number

    Returns void

remove

  • remove(removeEvents?: boolean): void
  • Removes the view from the DOM.

    memberof

    View

    Parameters

    • Default value removeEvents: boolean = false

    Returns void

segmentGroups

  • Returns the button segment groups associated with the button.

    memberof

    SegmentedButton

    Returns ButtonSegmentGroup[]

segmentIds

  • segmentIds(includeParent?: boolean): string[]
  • Returns an array of identifiers from the button segments.

    memberof

    SegmentedButton

    Parameters

    • Default value includeParent: boolean = true

    Returns string[]

segmentInfo

  • segmentInfo(selectedOnly?: boolean): Array<ButtonInfo>
  • Parameters

    • Default value selectedOnly: boolean = false

    Returns Array<ButtonInfo>

segmentValues

  • segmentValues(): string[]
  • Returns an array of values from the button segments.

    memberof

    SegmentedButton

    Returns string[]

segments

  • Returns an array of child button segment for the button.

    memberof

    SegmentedButton

    Returns ButtonSegment[]

select

  • select(trigger?: boolean): void
  • Selects the button.

    memberof

    Button

    Parameters

    • Default value trigger: boolean = true

    Returns void

selectSegment

  • selectSegment(option: string | Record<string, any>, select?: boolean): void
  • Selects the button segment associated with the specified option. If select is true, then then parent button will also be selected.

    memberof

    SegmentedButton

    Parameters

    • option: string | Record<string, any>
    • Default value select: boolean = true

    Returns void

selectedSegments

  • Returns the selected button segment(s).

    memberof

    SegmentedButton

    Returns ButtonSegment[]

setIndex

  • setIndex(index: number): void
  • Parameters

    • index: number

    Returns void

setLoading

  • setLoading(loading: boolean): void
  • Parameters

    • loading: boolean

    Returns void

setSize

  • setSize(width: number, height: number): void
  • Parameters

    • width: number
    • height: number

    Returns void

setState

  • setState(state: any): void
  • Updates the component state with the provided properties. Only those state properties provided will be updated, while all other state properties will retain their existing values.

    memberof

    Component

    Parameters

    • state: any

    Returns void

setUI

  • setUI(mapping: {}): void
  • Assigns the UI targets according to the view's configured interface selectors.

    Note that this method should only be called after the view has been rendered and added to the DOM.

    memberof

    View

    Parameters

    • mapping: {}
      • [key: string]: string

    Returns void

show

  • show(): void
  • Shows the view.

    memberof

    View

    Returns void

size

  • Returns Size

trigger

  • Triggers the specified event so that all registered listeners will be executed with the specified parameters.

    memberof

    EventDispatcher

    Parameters

    • type: any

      Event name to trigger

    • Default value data: any = null

    Returns EventDispatcher

update

  • update(data?: any, replace?: boolean): void
  • Parameters

    • Optional data: any
    • Default value replace: boolean = true

    Returns void

Generated using TypeDoc