CharacterHighlight
Properties
-
0
- (type: string)
the character in the suggestion
-
1
- (type: boolean)
should it be highlighted?
Type
Array
Links
PopulateOptions(options)
Returns
Type
function
Links
Source(query, populateOptions)
Returns
Type
function
Links
MapOptionToSuggestedValue(option)
Returns
-
string
- The string to display as the suggestions for this option
Type
function
Links
onConfirm(option)
Returns
Type
function
Links
AutocompleteOptions
Properties
-
defaultValue
- (type: string)
Specify a string to prefill the autocomplete with
-
source
- (type: Source)
The function which retrieves the suggestions to display
-
mapOptionToSuggestedValue
- (type: MapOptionToSuggestedValue)
Function which transforms a suggestion before rendering
-
onConfirm
- (type: onConfirm)
Function which is called when the user selects an option
Type
object
Links
ErrorSummaryElement
Properties
-
element
- (type: HTMLInputElement)
the associated element
-
id
- (type: string)
the input element's id
-
valid
- (type: boolean)
was the user's value valid?
-
error
- (type: string)
the error message for this element
-
field
- (type: HTMLElement)
a containing o-forms-field element
-
label
- (type: HTMLLabelElement)
an associated label element
Type
object
Links
highlightSuggestion(suggestion, query)
Global Function
Returns
-
Array.<CharacterHighlight>
- An array of arrays which contain two items, the first is the character in the suggestion, the second is a boolean which indicates whether the character should be highlighted.
Links
createLoadingContainer
Global Function
Create DOM for the loading container.
Returns
-
HTMLDivElement
- The loading container.
Links
showLoadingPane(instance)
Global Function
Show the loading panel
Returns
Links
hideLoadingPane(instance)
Global Function
Hide the loading panel
Returns
Links
new Autocomplete(autocompleteEl, options)
Class constructor.
Methods
Properties
Links
new ErrorSummary(elements, headingMessage)
Class constructor.
Methods
Example
const elementsExample = [
{
id: 'text-input',
valid: false,
error: 'Please fill out this field',
label: 'Input Label',
element: <Element />,
},
{...},
];
new ErrorSummary(example, 'This is a heading message')
Links
new ExpanderUtility(...)
Class constructor.
Methods
-
apply(isSilent)
- (instance) Recalculate and apply the styles to expand or collapse the expander
according to its current state.
-
toggle
- (instance) Toggle the expander so expands or, if it's already expanded, collapses.
-
expand(isSilent)
- (instance) Expand the expander.
-
collapse(isSilent)
- (instance) Collapse the expander.
-
isCollapsed
- (instance) Return true if the expander is currently collapsed.
-
destroy
- (instance) Remove the expander from the page.
Links
new Expander(...)
o-expander constructor.
Methods
Links
new State(...)
Class constructor.
Methods
Links
<anonymous>~customSource
Inner Property
Type
Links
Autocomplete#mapOptionToSuggestedValue
Instance Property
Type
- MapOptionToSuggestedValue
Links
Autocomplete#options.source(query, populateOptions)
Static Method
Returns
Links
Autocomplete#options.source~callback(options)
Inner Function
Returns
Links
templates.suggestion(option)
Static Method
Used when rendering suggestions, the return value of this will be used as the innerHTML for a single suggestion.
Returns
-
string | undefined
- HTML string to represent a single suggestion.
Links
Autocomplete#suggestionTemplate(suggestedValue)
Instance Method
Used when rendering suggestions, the return value of this will be used as the innerHTML for a single suggestion.
Returns
-
string
- HTML string to be represent a single suggestion.
Links
<anonymous>~characters
Inner Property
Type
- Array.<CharacterHighlight>
An array of arrays which contain two items, the first is the character in the suggestion, the second is a boolean which indicates whether the character should be highlighted.
Links
Autocomplete.getDataAttributes(autocompleteEl)
Static Method
Get the data attributes from the AutocompleteElement. If the element is being set up
declaratively, this method is used to extract the data attributes from the DOM.
Returns
-
object
- An options object which can be used for configuring the component
Links
Autocomplete.init(rootElement, options)
Static Method
Initialise o-autocomplete component/s.
Returns
-
Autocomplete | Array.<Autocomplete>
- The newly constructed Autocomplete components
Links
ErrorSummary#createSummary
Instance Method
Generate Node to hold list of invalid inputs
Returns
-
HTMLDivElement
- - a div full of error messages
Links
ErrorSummary.createList(inputs)
Static Method
Generate list of anchors
Returns
-
HTMLUListElement
- - the list
Links
ErrorSummary.createItem(input)
Static Method
Generate an item for the error summary
Returns
Links
ErrorSummary.createAnchor(input)
Static Method
Generate anchor element to point at invalid input
Returns
Links
ExpanderUtility#apply(isSilent)
Instance Method
Recalculate and apply the styles to expand or collapse the expander
according to its current state.
Returns
Links
ExpanderUtility#toggle
Instance Method
Toggle the expander so expands or, if it's already expanded, collapses.
Returns
Links
ExpanderUtility#expand(isSilent)
Instance Method
Expand the expander.
Returns
Links
ExpanderUtility#collapse(isSilent)
Instance Method
Collapse the expander.
Returns
Links
ExpanderUtility#isCollapsed
Instance Method
Return true if the expander is currently collapsed.
Returns
-
boolean
- - is the expander collapsed
Links
ExpanderUtility#destroy
Instance Method
Remove the expander from the page.
Returns
Links
Expander.createCustom(oExpanderElement, opts)
Static Method
Construct a custom expander. Useful to add customised expander
functionality to a component. E.g. to animate away collapsed items
rather than hide them immediately.
Returns
-
ExpanderUtility
- - A custom expander
Links
Expander.init(rootEl, opts)
Static Method
Initialise the component.
Returns
-
Expander | Array.<Expander>
- - Expander instance(s)
Links
State#set(state, label)
Instance Method
State setter
Links