Releases: unchartedsoftware/lex
Release 0.17.4
Fix for #342
Release 0.17.3
Release 0.17.2
Release 0.17.1
Addition of hooks for the acceptance and rejection of suggestion tokens to Lex
configuration. If supplied, these hooks allow for app functionality to take place when these events occur, the transformation of suggestions before acceptance, or even the complete blocking of Lex
's internal suggestion-add/remove handling in favour of your own (via setQuery
and setSuggestions
).
See the documentation of the Lex
component for more details:
* @param {function | undefined} config.onAcceptSuggestion - A callback called when the user presses "add" on a suggestion. A no-op by default (`(s, idx) => s`) but, if supplied, can be used to transform the incoming boxed suggestion, perform additional actions, etc. Return `null` to stop Lex from updating suggestions and query automatically, or return the suggestion (or a transformed version) to allow Lex to handle the rest.
* @param {function | undefined} config.onRejectSuggestion - A callback called when the user presses "x" on a suggestion. A no-op by default (`(s, idx) => true`) but, if supplied, can be used to perform additional actions or stop Lex from auto-updating the suggestions and query (by returning `false`)
Release 0.17.0
Refactors to State
and StateTemplate
to improve performance, stability and API flexibility going forward.
All existing State
types now extend State
directly, rather than StateTemplate
, and StateTemplate
is thus no longer exported by the library.
No refactoring of the search language in existing applications is required, but the following minor changes (basically find/replace) to custom Builder
s and Assistants
are necessary:
- any custom
State
s created will need to extendState
instead ofStateTemplate
. - any reference to
machineStateTemplate
in a customBuilder
orAssistant
should be changed tomachineState
. - any reference to
machineState.template
in a customBuilder
orAssistant
should be removed and replaced withmachineState
(orthis.state.machine.state.template
->this.state.machine.state
). A find replace for.template -> ''
should be sufficient. - Any custom logic for fetching options in an
OptionState
that used the thirdarchive
parameter should replace this parameter with an in-method reference tothis.archive
, as theState
'svalue
andarchive
are now directly accessible in the scope of the option-fetching function.
Release 0.16.3
Temporary fix for #321. Performance problems will be addressed in the next release.
Release 0.16.2
Improving error messages for OptionState
initialization.
Release 0.16.1
Fix for #319
Release 0.16.0
- Major performance improvements to
OptionState
via #302 and #304 - An API-breaking change which is a consequence of these improvements is that
OptionState
s which fetchasync
options need to supply an additional configuration parameterconfig.fetchOptions
which is a function which, given a list of specific values, can fetch their correspondingOptionStateOption
s for validation purposes. This is distinct from theconfig.options
function, which fetches suggestions.
Updating to 0.16.0 will require the addition of a config.fetchOptions
parameter to ALL async
OptionState
s.
Release 0.15.3
Fix for #299