From cff3c3dbbd7b0d456e34e66baf5057877970b7e6 Mon Sep 17 00:00:00 2001 From: Leopold Talirz Date: Wed, 16 Sep 2020 22:57:40 +0200 Subject: [PATCH 1/2] AutocompleteInput: allow user-defined values bokeh 2.3.0 introduces a new `restrict` keyword (default: True). Setting it to False allows users to enter values that are not present in the list of completions. --- panel/widgets/select.py | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/panel/widgets/select.py b/panel/widgets/select.py index 3d0b05f1e8..7e7f9715d0 100644 --- a/panel/widgets/select.py +++ b/panel/widgets/select.py @@ -219,6 +219,8 @@ class AutocompleteInput(Widget): case_sensitive = param.Boolean(default=True) + restrict = param.Boolean(default=True) + _widget_type = _BkAutocompleteInput _rename = {'name': 'title', 'options': 'completions'} diff --git a/setup.py b/setup.py index 60c11aa42d..35d7021029 100644 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def run(self): ########## dependencies ########## install_requires = [ - 'bokeh >=2.1', + 'bokeh >=2.3.0.dev1', 'param >=1.9.3', 'pyviz_comms >=0.7.4', 'markdown', From 834940c129c05b720260b8ab006535cfab8c8910 Mon Sep 17 00:00:00 2001 From: Leopold Talirz Date: Mon, 28 Sep 2020 14:37:40 +0200 Subject: [PATCH 2/2] address coments from review --- examples/reference/widgets/AutocompleteInput.ipynb | 3 ++- panel/package-lock.json | 2 +- panel/widgets/select.py | 9 +++++++-- setup.py | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/reference/widgets/AutocompleteInput.ipynb b/examples/reference/widgets/AutocompleteInput.ipynb index 82b5094284..60d5d6cf44 100644 --- a/examples/reference/widgets/AutocompleteInput.ipynb +++ b/examples/reference/widgets/AutocompleteInput.ipynb @@ -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", @@ -93,4 +94,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/panel/package-lock.json b/panel/package-lock.json index 04f5ad9e29..18aea7f93c 100644 --- a/panel/package-lock.json +++ b/panel/package-lock.json @@ -1,6 +1,6 @@ { "name": "@holoviz/panel", - "version": "0.10.0-a24", + "version": "0.10.0-a25", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/panel/widgets/select.py b/panel/widgets/select.py index 7e7f9715d0..d5095fdb2d 100644 --- a/panel/widgets/select.py +++ b/panel/widgets/select.py @@ -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 @@ -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=""" @@ -223,7 +228,7 @@ class AutocompleteInput(Widget): _widget_type = _BkAutocompleteInput - _rename = {'name': 'title', 'options': 'completions'} + _rename = _AutocompleteInput_rename class _RadioGroupBase(SingleSelectBase): diff --git a/setup.py b/setup.py index 35d7021029..60c11aa42d 100644 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def run(self): ########## dependencies ########## install_requires = [ - 'bokeh >=2.3.0.dev1', + 'bokeh >=2.1', 'param >=1.9.3', 'pyviz_comms >=0.7.4', 'markdown',