Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutocompleteInput: allow user-defined values #1588

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/reference/widgets/AutocompleteInput.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"\n",
"* **``options``** (list or dict): A list or dictionary of options to select from\n",
"* **``value``** (object): The current value; must be one of the option values\n",
"* **``restrict``** (boolean): Set to False in order to allow users to enter text that is not present in the options list.\n",
"\n",
"##### Display\n",
"\n",
Expand Down Expand Up @@ -93,4 +94,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
2 changes: 1 addition & 1 deletion panel/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions panel/widgets/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from ..layout import Column, VSpacer
from ..models import SingleSelect as _BkSingleSelect
from ..util import as_unicode, isIn, indexOf
from ..util import as_unicode, isIn, indexOf, bokeh_version
from .base import Widget, CompositeWidget
from .button import _ButtonBase, Button
from .input import TextInput, TextAreaInput
Expand Down Expand Up @@ -205,6 +205,11 @@ class MultiChoice(_MultiSelectBase):
_widget_type = _BkMultiChoice


_AutocompleteInput_rename = {'name': 'title', 'options': 'completions'}
if bokeh_version < '2.3.0':
# disable restrict keyword
_AutocompleteInput_rename['restrict'] = None

class AutocompleteInput(Widget):

min_characters = param.Integer(default=2, doc="""
Expand All @@ -219,9 +224,11 @@ class AutocompleteInput(Widget):

case_sensitive = param.Boolean(default=True)

restrict = param.Boolean(default=True)

_widget_type = _BkAutocompleteInput

_rename = {'name': 'title', 'options': 'completions'}
_rename = _AutocompleteInput_rename


class _RadioGroupBase(SingleSelectBase):
Expand Down