-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathevents.js
37 lines (32 loc) · 1.01 KB
/
events.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import Combobox from "hw_combobox/models/combobox/base"
import { dispatch } from "hw_combobox/helpers"
Combobox.Events = Base => class extends Base {
_dispatchPreselectionEvent({ isNewAndAllowed, previousValue }) {
if (previousValue === this._incomingFieldValueString) return
dispatch("hw-combobox:preselection", {
target: this.element,
detail: { ...this._eventableDetails, isNewAndAllowed, previousValue }
})
}
_dispatchSelectionEvent() {
dispatch("hw-combobox:selection", {
target: this.element,
detail: this._eventableDetails
})
}
_dispatchRemovalEvent({ removedDisplay, removedValue }) {
dispatch("hw-combobox:removal", {
target: this.element,
detail: { ...this._eventableDetails, removedDisplay, removedValue }
})
}
get _eventableDetails() {
return {
value: this._incomingFieldValueString,
display: this._fullQuery,
query: this._typedQuery,
fieldName: this._fieldName,
isValid: this._valueIsValid
}
}
}