From 0cf27b6a2eaf14a6a9c875fb84ad90a31812799f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fred=20Lef=C3=A9v=C3=A8re-Laoide?= <90181748+FredLL-Avaiga@users.noreply.github.com> Date: Wed, 31 Aug 2022 17:00:09 +0200 Subject: [PATCH 1/6] (cherry picked from commit f56752ce2b2cabf64399f41780cd30df3a27b18c) #379 BUG-slider with labels=dict --- taipy/gui/renderers/builder.py | 3 ++- taipy/gui/utils/boolean.py | 2 +- tests/taipy/gui/control/test_slider.py | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/taipy/gui/renderers/builder.py b/taipy/gui/renderers/builder.py index 3fe987eda..ebe30ed09 100644 --- a/taipy/gui/renderers/builder.py +++ b/taipy/gui/renderers/builder.py @@ -749,7 +749,8 @@ def set_labels(self, var_name: str = "labels"): if value := self.__attributes.get(var_name): if _is_boolean_true(value): return self.__set_react_attribute(_to_camel_case(var_name), True) - return self.__set_dict_attribute(var_name) + elif isinstance(value, (dict, _MapDict)): + return self.__set_dict_attribute(var_name) return self def set_partial(self): diff --git a/taipy/gui/utils/boolean.py b/taipy/gui/utils/boolean.py index d67d804f5..54655f713 100644 --- a/taipy/gui/utils/boolean.py +++ b/taipy/gui/utils/boolean.py @@ -13,7 +13,7 @@ def _is_boolean_true(s: t.Union[bool, str]) -> bool: - return s if isinstance(s, bool) else s.lower() in ["true", "1", "t", "y", "yes", "yeah", "sure"] + return s if isinstance(s, bool) else s.lower() in ["true", "1", "t", "y", "yes", "yeah", "sure"] if isinstance(s, str) else False def _is_boolean(s: t.Any) -> bool: diff --git a/tests/taipy/gui/control/test_slider.py b/tests/taipy/gui/control/test_slider.py index dddfefb18..78db7c0e1 100644 --- a/tests/taipy/gui/control/test_slider.py +++ b/tests/taipy/gui/control/test_slider.py @@ -9,6 +9,7 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. +import inspect from taipy.gui import Gui @@ -31,6 +32,22 @@ def test_slider_with_min_max(gui: Gui, test_client, helpers): helpers.test_control_md(gui, md_string, expected_list) +def test_slider_with_dict_labels_md(gui: Gui, helpers): + sel = "Item 1" + labels = {"Item 1": "Label Start", "Item 3": "Label End"} + gui._set_frame(inspect.currentframe()) + md_string = "<|{sel}|slider|lov=Item 1;Item 2;Item 3|labels={labels}|>" + expected_list = [" Date: Wed, 31 Aug 2022 17:52:09 +0200 Subject: [PATCH 2/6] Table - #366 specify editable by column - #365 boolean editable - #333 input multiline (cherry picked from commit 3b6cce446e5770a0c467df3cc9c91e75b1cbbea8) --- gui/doc/input.csv | 2 + gui/doc/table.csv | 2 + gui/src/components/Taipy/AutoLoadingTable.tsx | 102 ++++++------ gui/src/components/Taipy/Input.tsx | 19 ++- gui/src/components/Taipy/PaginatedTable.tsx | 100 ++++++------ gui/src/components/Taipy/tableUtils.tsx | 150 +++++++++++------- gui/src/components/Taipy/utils.ts | 2 + taipy/gui/renderers/builder.py | 7 + taipy/gui/renderers/factory.py | 3 + 9 files changed, 229 insertions(+), 158 deletions(-) diff --git a/gui/doc/input.csv b/gui/doc/input.csv index 34f498738..f66c56cbf 100644 --- a/gui/doc/input.csv +++ b/gui/doc/input.csv @@ -4,4 +4,6 @@ password,bool,False,"If True, the text is obscured: all input characters are dis label,str,None,The label associated with the input. >sharedInput,,, >on_change,,, +multiline,bool,False,"If True, the text is presented as a multi line input." +lines_shown,int,5,"The height of the displayed element if multiline is True." >propagate,,, diff --git a/gui/doc/table.csv b/gui/doc/table.csv index 8fab825a0..eef46d374 100644 --- a/gui/doc/table.csv +++ b/gui/doc/table.csv @@ -32,6 +32,8 @@ width,str|int|float,"""100vw""","The width, in CSS units, of this table control. height,str|int|float,"""80vh""","The height, in CSS units, of this table control." nan_value,str,"""""",The replacement text for NaN (not-a-number) values. nan_value[col_name],str,"""""",The replacement text for NaN (not-a-number) values for the indicated column. +editable,dynamic(bool),FALSE,"Indicates, if True, that all columns can be edited." +editable[col_name],bool,"editable","Indicates, if False, that the indicated column cannot be edited when editable is True." on_edit,Callback,,"The name of a function that is to be triggered when a cell edition is validated.
All parameters of that function are optional: