Class: StepsController

AlpineSteps.StepsController(model, circular, initialStep)

Class for stepwise UI controller

Constructor

new StepsController(model, circular, initialStep)

Create a controller

Parameters:
Name Type Description
model Array.<string> | Array.<Object>

Step items.

Properties
Name Type Description
name string

The name of the step, if an array of Objects.

circular boolean

Allow circular step indexing.

initialStep string

The name of the step to start at.

Properties:
Name Type Description
steps Array.<string> | Array.<Object>

Step items.

currentStep string

The name of the active step item.

circular boolean

If circular indexing is enabled.

Source:

Members

currentIndex

Get the 0 based index of active step.

Source:

currentStepIndex

Get the 1 based index of active step.

Source:

currentStepNode

Get the active step item.

Source:

firstStepName

Get the name for the first step item.

Source:

length

Get the length of steps.

Source:

Methods

activate(step) → {boolean}

Set current step by name.

Parameters:
Name Type Description
step string | Object
Properties
Name Type Description
name string

The name of the step, if an Object.

Source:
Returns:

If step is activated, without error.

Type
boolean

getIndex(nameQuery) → {number}

Get the 1 based index of the step by name.

Parameters:
Name Type Description
nameQuery string

The name of the step to check.

Source:
Returns:

The index of the step if available.

Type
number

incrementIndex(increment) → {number}

Increment the index. Note: If in circular mode, it will always return an in bounds index.

Parameters:
Name Type Default Description
increment number 1

The value to increment by.

Source:
Returns:

The index after increment.

Type
number

init()

Required by Alpine for automatic execution.

Source:

isActive(name) → {boolean}

Validate if step is active by name.

Parameters:
Name Type Description
name string

Name of step to check.

Source:
Returns:

If the step is active.

Type
boolean

pickNext() → {boolean|string}

Get the next available step item. Note: If in circular mode, it will always return a step.

Source:
Returns:

The next step if available or false.

Type
boolean | string

pickPrevious() → {boolean|string}

Get the previous available step item. Note: If in circular mode, it will always return a step.

Source:
Returns:

The previous step if available or false.

Type
boolean | string

transitionTo(to) → {boolean}

Activate step by name.

Parameters:
Name Type Description
to string

Name of step to activate.

Source:
Returns:

If the step was activated.

Type
boolean

transitionToNext() → {boolean}

Activate the next step.

Source:
Returns:

If the next step is activated.

Type
boolean

transitionToPrevious() → {boolean}

Activate the previous step.

Source:
Returns:

If the previous step is activated.

Type
boolean