-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathawesomplete_input.py
33 lines (25 loc) · 1.08 KB
/
awesomplete_input.py
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
from bokeh.core.properties import List, String, Int, Bool
from bokeh.models.widgets import TextInput
"""
Nice autocomplete plugin from this thread: https://github.com/bokeh/bokeh/issues/5596
Project URL: https://leaverou.github.io/awesomplete/
"""
class AwesompleteInput(TextInput):
""" Single-line input widget with auto-completion. """
__implementation__ = "awesomplete_input.coffee"
__css__ = ["https://cdnjs.cloudflare.com/ajax/libs/awesomplete/1.1.1/awesomplete.css"]
__javascript__ = ["https://cdnjs.cloudflare.com/ajax/libs/awesomplete/1.1.1/awesomplete.js"]
completions = List(String, help="""
A list of completion strings. This will be used to guide the
user upon typing a substring of a desired value.
""")
min_chars = Int(default=1, help="""
Minimum characteres the user has to type before the autocomplete
popup shows up.
""")
max_items = Int(default=10, help="""
Maximum number of suggestions to display.
""")
auto_first = Bool(default=False, help="""
Whether the first element should be automatically selected
""")