@serenity-is/corelib / AbstractSelect2
Abstract Class: AbstractSelect2
Defined in: src/ui/editors/select2.tsx:1208
Extended by
Constructors
Constructor
new AbstractSelect2():
AbstractSelect2
Returns
AbstractSelect2
Properties
_touchEvent
protected_touchEvent:boolean
Defined in: src/ui/editors/select2.tsx:1213
Whether the results were touched, when the click that follows selects what is highlighted, see handleDropdownClick.
autofocus
protectedautofocus:boolean
Defined in: src/ui/editors/select2.tsx:1216
container
container:
HTMLElement
Defined in: src/ui/editors/select2.tsx:1217
containerEventName
protectedcontainerEventName:string
Defined in: src/ui/editors/select2.tsx:1219
containerId
protectedcontainerId:string
Defined in: src/ui/editors/select2.tsx:1218
context
protectedcontext:any
Defined in: src/ui/editors/select2.tsx:1220
dropdown
dropdown:
HTMLElement
Defined in: src/ui/editors/select2.tsx:1221
elementTabIndex
protectedelementTabIndex:string
Defined in: src/ui/editors/select2.tsx:1222
enabledInterface
protectedenabledInterface:boolean
Defined in: src/ui/editors/select2.tsx:1223
highlightNavigated
protectedhighlightNavigated:boolean
Defined in: src/ui/editors/select2.tsx:2214
Whether the highlight was moved with the arrow keys since the dropdown was opened, see tabSelects.
id()
protectedid: (item) =>string
Defined in: src/ui/editors/select2.tsx:1224
Parameters
item
any
Returns
string
nextSearchTerm
protectednextSearchTerm:string
Defined in: src/ui/editors/select2.tsx:1225
opts
protectedopts:Select2Options
Defined in: src/ui/editors/select2.tsx:1226
propertyObserver
protectedpropertyObserver:MutationObserver
Defined in: src/ui/editors/select2.tsx:1227
queryCount
protectedqueryCount:number
Defined in: src/ui/editors/select2.tsx:1228
results
protectedresults:HTMLElement
Defined in: src/ui/editors/select2.tsx:1229
resultsPage
protectedresultsPage:number
Defined in: src/ui/editors/select2.tsx:1230
search
search:
HTMLInputElement
Defined in: src/ui/editors/select2.tsx:1231
select
protectedselect:HTMLSelectElement
Defined in: src/ui/editors/select2.tsx:1475
selection
protectedselection:HTMLElement
Defined in: src/ui/editors/select2.tsx:1232
showSearchInput
protectedshowSearchInput:boolean
Defined in: src/ui/editors/select2.tsx:1233
Methods
blur()
protectedblur():void
Defined in: src/ui/editors/select2.tsx:2628
Returns
void
cancel()
protectedcancel(e?):void
Defined in: src/ui/editors/select2.tsx:2624
Parameters
e?
Event
Returns
void
clearDropdownAlignmentPreference()
protectedclearDropdownAlignmentPreference():void
Defined in: src/ui/editors/select2.tsx:1966
Returns
void
clearSearch()
protectedclearSearch():void
Defined in: src/ui/editors/select2.tsx:2136
Returns
void
clearTouchMoved()
protectedclearTouchMoved():void
Defined in: src/ui/editors/select2.tsx:2293
Returns
void
close()
close():
void
Defined in: src/ui/editors/select2.tsx:2088
Returns
void
countSelectableResults()
protectedcountSelectableResults():number
Defined in: src/ui/editors/select2.tsx:2297
Returns
number
createContainer()
abstractprotectedcreateContainer():HTMLElement
Defined in: src/ui/editors/select2.tsx:1269
Returns
HTMLElement
data()
abstractdata(value?,triggerChange?):void|Select2Item|Select2Item[]
Defined in: src/ui/editors/select2.tsx:1270
Parameters
value?
triggerChange?
boolean
Returns
void | Select2Item | Select2Item[]
destroy()
destroy():
void
Defined in: src/ui/editors/select2.tsx:1405
Returns
void
disable()
disable():
void
Defined in: src/ui/editors/select2.tsx:1807
Returns
void
enable()
enable(
enabled?):void
Defined in: src/ui/editors/select2.tsx:1798
Parameters
enabled?
boolean
Returns
void
enableInterface()
protectedenableInterface():boolean
Defined in: src/ui/editors/select2.tsx:1785
Returns
boolean
ensureHighlightVisible()
protectedensureHighlightVisible():void
Defined in: src/ui/editors/select2.tsx:2162
Returns
void
externalSearch()
protectedexternalSearch(term):void
Defined in: src/ui/editors/select2.tsx:2130
Opens control, sets input value, and updates results.
Parameters
term
string
Returns
void
findHighlightableChoices()
protectedfindHighlightableChoices():Element[]
Defined in: src/ui/editors/select2.tsx:2209
Returns
Element[]
focus()
abstractfocus():void
Defined in: src/ui/editors/select2.tsx:1271
Returns
void
focusSearch()
protectedfocusSearch():void
Defined in: src/ui/editors/select2.tsx:2640
Returns
void
getMaximumSelectionSize()
protectedgetMaximumSelectionSize():any
Defined in: src/ui/editors/select2.tsx:2158
Returns
any
getPlaceholder()
protectedgetPlaceholder():string
Defined in: src/ui/editors/select2.tsx:2661
Returns
string
getPlaceholderOption()
protectedgetPlaceholderOption():HTMLOptionElement
Defined in: src/ui/editors/select2.tsx:2676
Returns
HTMLOptionElement
handleDropdownMouseUp()
protectedhandleDropdownMouseUp(e):void
Defined in: src/ui/editors/select2.tsx:1477
Parameters
e
Event
Returns
void
handleEnter()
protectedhandleEnter():void
Defined in: src/ui/editors/select2.tsx:1265
Handles Enter while the dropdown is open, which selects the highlighted result, unless a select does otherwise, see MultiSelect2, whose checklist accepts its selection with it, and closes.
Returns
void
handleSearchBlur()
protectedhandleSearchBlur():void
Defined in: src/ui/editors/select2.tsx:2386
Returns
void
handleSearchFocus()
protectedhandleSearchFocus():void
Defined in: src/ui/editors/select2.tsx:2382
Returns
void
handleSearchInput()
protectedhandleSearchInput():void
Defined in: src/ui/editors/select2.tsx:2378
Returns
void
handleSpace()
protectedhandleSpace():boolean
Defined in: src/ui/editors/select2.tsx:1257
Handles Space while the dropdown is open, before it is typed in the search input, which it is when this returns false, see MultiSelect2, whose checklist ticks the item that selects all the results with it.
Returns
boolean
True when Space was handled.
highlight()
protectedhighlight(index?):number
Defined in: src/ui/editors/select2.tsx:2257
Parameters
index?
number
Returns
number
highlightUnderEvent()
protectedhighlightUnderEvent(event):void
Defined in: src/ui/editors/select2.tsx:2301
Parameters
event
Event
Returns
void
init()
init(
opts):void
Defined in: src/ui/editors/select2.tsx:1279
Parameters
opts
Returns
void
initContainer()
abstractprotectedinitContainer():void
Defined in: src/ui/editors/select2.tsx:1273
Returns
void
initContainerWidth()
protectedinitContainerWidth():void
Defined in: src/ui/editors/select2.tsx:2696
Get the desired width for the container element. This is
derived first from option width passed to select2, then
the inline 'style' on the original element, and finally
falls back to the jQuery calculated element width.
Returns
void
initSelection()
abstractprotectedinitSelection():void
Defined in: src/ui/editors/select2.tsx:1274
Returns
void
isFocused()
abstractisFocused():boolean
Defined in: src/ui/editors/select2.tsx:1272
Returns
boolean
isInterfaceEnabled()
protectedisInterfaceEnabled():boolean
Defined in: src/ui/editors/select2.tsx:1781
Returns
boolean
isSelectAllItem()
protectedisSelectAllItem(item):boolean
Defined in: src/ui/editors/select2.tsx:1239
Whether an item is the one that selects all the results that are shown, or clears them, which the select adds itself, see Select2Options.selectAll. Only a multiple select has one.
Parameters
item
Returns
boolean
loadMoreIfNeeded()
protectedloadMoreIfNeeded():void
Defined in: src/ui/editors/select2.tsx:2312
Returns
void
monitorSource()
protectedmonitorSource():void
Defined in: src/ui/editors/select2.tsx:1730
Monitor the original element for changes and update select2 accordingly
Returns
void
moveHighlight()
protectedmoveHighlight(delta):void
Defined in: src/ui/editors/select2.tsx:2242
Parameters
delta
number
Returns
void
onSelect()
abstractprotectedonSelect(item,options?):void
Defined in: src/ui/editors/select2.tsx:1275
Parameters
item
options?
noFocus
boolean
Returns
void
open()
open():
boolean
Defined in: src/ui/editors/select2.tsx:1978
Opens the dropdown
Returns
boolean
whether or not dropdown was opened. This method will return false if, for example, the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
opened()
opened():
boolean
Defined in: src/ui/editors/select2.tsx:1820
Returns
boolean
opening()
protectedopening():void
Defined in: src/ui/editors/select2.tsx:2003
Returns
void
optionToData()
optionToData(
element):Select2Item
Defined in: src/ui/editors/select2.tsx:1455
Parameters
element
HTMLOptGroupElement | HTMLOptionElement
Returns
positionDropdown()
positionDropdown():
void
Defined in: src/ui/editors/select2.tsx:1824
Returns
void
postprocessResults()
abstractprotectedpostprocessResults(data,initial,noHighlightUpdate?):void
Defined in: src/ui/editors/select2.tsx:1276
Parameters
data
initial
boolean
noHighlightUpdate?
boolean
Returns
void
prepareOpts()
protectedprepareOpts(opts):Select2Options
Defined in: src/ui/editors/select2.tsx:1508
Parameters
opts
Returns
readonly()
readonly(
enabled?):void
Defined in: src/ui/editors/select2.tsx:1811
Parameters
enabled?
boolean
Returns
void
removeHighlight()
protectedremoveHighlight():void
Defined in: src/ui/editors/select2.tsx:2285
Returns
void
selectHighlighted()
protectedselectHighlighted(options?):void
Defined in: src/ui/editors/select2.tsx:2644
Parameters
options?
any
Returns
void
shouldOpen()
protectedshouldOpen():boolean
Defined in: src/ui/editors/select2.tsx:1956
Returns
boolean
showSearch()
protectedshowSearch(showSearchInput):void
Defined in: src/ui/editors/select2.tsx:2146
Shows or hides the search box of the dropdown, which stays focusable when it is hidden, so that the keys still reach the results. Only a select that has its search box in the dropdown has one, e.g. a single select, or a checklist, see Select2Options.checkList.
Parameters
showSearchInput
boolean
Whether to show the search box.
Returns
void
tabOut()
protectedtabOut(e,from):void
Defined in: src/ui/editors/select2.tsx:2233
Leaves the control with Tab, or Shift+Tab, from its dropdown: closes it, which the select does before, and moves the focus to the next element, or the previous one, from the control, as the search input is in the dropdown, at the end of the page, from which the browser would move it.
Parameters
e
KeyboardEvent
The key event.
from
HTMLElement
The element of the control that takes the focus, from which the focus moves.
Returns
void
tabSelects()
protectedtabSelects():boolean
Defined in: src/ui/editors/select2.tsx:2222
Whether Tab selects the highlighted result as it leaves the control: only when the user pointed at it, by typing a search, which highlights a result that is found, or by moving the highlight with the arrow keys, so that opening the dropdown and leaving it with Tab does not change the value to the result that happens to be highlighted. The mouse does not count, as it often rests over the results by chance.
Returns
boolean
tokenize()
protectedtokenize():string
Defined in: src/ui/editors/select2.tsx:2374
Default tokenizer function which does nothing
Returns
string
touchMoved()
protectedtouchMoved():void
Defined in: src/ui/editors/select2.tsx:2289
Returns
void
triggerChange()
protectedtriggerChange(details?):void
Defined in: src/ui/editors/select2.tsx:1762
Triggers the change event on the source element
Parameters
details?
any
Returns
void
triggerSelect()
protectedtriggerSelect(data):boolean
Defined in: src/ui/editors/select2.tsx:1753
Parameters
data
Returns
boolean
updateResults()
protectedupdateResults(initial?):void
Defined in: src/ui/editors/select2.tsx:2454
Parameters
initial?
boolean
whether or not this is the call to this method right after the dropdown has been opened
Returns
void
val()
abstractval(value?):string|string[]
Defined in: src/ui/editors/select2.tsx:1277
Parameters
value?
string | string[]
Returns
string | string[]
withSelectAllItem()
protectedwithSelectAllItem(results,more?):Select2Item[]
Defined in: src/ui/editors/select2.tsx:1248
Returns the first page of results with the item that selects them all, when the select has one, see Select2Options.selectAll. The results are not changed.
Parameters
results
The first page of results.
more?
boolean