streamlit-nightly 1.38.1.dev20240830__py2.py3-none-any.whl → 1.38.1.dev20240901__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/components/v1/component_registry.py +1 -1
- streamlit/components/v1/custom_component.py +3 -3
- streamlit/elements/arrow.py +2 -2
- streamlit/elements/iframe.py +2 -2
- streamlit/elements/layouts.py +20 -0
- streamlit/elements/media.py +3 -6
- streamlit/elements/plotly_chart.py +2 -2
- streamlit/elements/vega_charts.py +2 -2
- streamlit/elements/widgets/button.py +6 -6
- streamlit/elements/widgets/button_group.py +4 -4
- streamlit/elements/widgets/camera_input.py +3 -3
- streamlit/elements/widgets/chat.py +4 -4
- streamlit/elements/widgets/checkbox.py +3 -3
- streamlit/elements/widgets/color_picker.py +3 -3
- streamlit/elements/widgets/data_editor.py +8 -6
- streamlit/elements/widgets/file_uploader.py +3 -3
- streamlit/elements/widgets/multiselect.py +4 -4
- streamlit/elements/widgets/number_input.py +3 -3
- streamlit/elements/widgets/radio.py +4 -4
- streamlit/elements/widgets/select_slider.py +4 -4
- streamlit/elements/widgets/selectbox.py +4 -4
- streamlit/elements/widgets/slider.py +3 -3
- streamlit/elements/widgets/text_widgets.py +5 -5
- streamlit/elements/widgets/time_widgets.py +5 -5
- streamlit/proto/Block_pb2.py +7 -7
- streamlit/proto/Block_pb2.pyi +4 -1
- streamlit/runtime/state/common.py +24 -23
- streamlit/runtime/state/session_state.py +5 -5
- streamlit/runtime/state/widgets.py +2 -2
- streamlit/static/asset-manifest.json +5 -5
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/583.61ac7fde.chunk.js +1 -0
- streamlit/static/static/js/6141.43a8fda3.chunk.js +1 -0
- streamlit/static/static/js/9060.1ec8dc2b.chunk.js +1 -0
- streamlit/static/static/js/main.f0eff620.js +28 -0
- streamlit/testing/v1/element_tree.py +2 -2
- {streamlit_nightly-1.38.1.dev20240830.dist-info → streamlit_nightly-1.38.1.dev20240901.dist-info}/METADATA +2 -2
- {streamlit_nightly-1.38.1.dev20240830.dist-info → streamlit_nightly-1.38.1.dev20240901.dist-info}/RECORD +43 -43
- streamlit/static/static/js/583.0933ee10.chunk.js +0 -1
- streamlit/static/static/js/6141.3a6bc340.chunk.js +0 -1
- streamlit/static/static/js/9060.d2bc110a.chunk.js +0 -1
- streamlit/static/static/js/main.f42f34e1.js +0 -28
- /streamlit/static/static/js/{main.f42f34e1.js.LICENSE.txt → main.f0eff620.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.38.1.dev20240830.data → streamlit_nightly-1.38.1.dev20240901.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.38.1.dev20240830.dist-info → streamlit_nightly-1.38.1.dev20240901.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.38.1.dev20240830.dist-info → streamlit_nightly-1.38.1.dev20240901.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.38.1.dev20240830.dist-info → streamlit_nightly-1.38.1.dev20240901.dist-info}/top_level.txt +0 -0
@@ -63,7 +63,7 @@ def declare_component(
|
|
63
63
|
|
64
64
|
.. warning::
|
65
65
|
Using ``st.components.v1.declare_component`` directly (instead of
|
66
|
-
importing its module) is deprecated and will be
|
66
|
+
importing its module) is deprecated and will be disallowed in a later
|
67
67
|
version.
|
68
68
|
|
69
69
|
Parameters
|
@@ -29,7 +29,7 @@ from streamlit.proto.Element_pb2 import Element
|
|
29
29
|
from streamlit.runtime.metrics_util import gather_metrics
|
30
30
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
31
31
|
from streamlit.runtime.state import NoValue, register_widget
|
32
|
-
from streamlit.runtime.state.common import
|
32
|
+
from streamlit.runtime.state.common import compute_element_id
|
33
33
|
from streamlit.type_util import is_bytes_like, to_bytes
|
34
34
|
|
35
35
|
if TYPE_CHECKING:
|
@@ -172,7 +172,7 @@ And if you're using Streamlit Cloud, add "pyarrow" to your requirements.txt."""
|
|
172
172
|
|
173
173
|
if key is None:
|
174
174
|
marshall_element_args()
|
175
|
-
computed_id =
|
175
|
+
computed_id = compute_element_id(
|
176
176
|
"component_instance",
|
177
177
|
user_key=key,
|
178
178
|
name=self.name,
|
@@ -184,7 +184,7 @@ And if you're using Streamlit Cloud, add "pyarrow" to your requirements.txt."""
|
|
184
184
|
page=ctx.active_script_hash if ctx else None,
|
185
185
|
)
|
186
186
|
else:
|
187
|
-
computed_id =
|
187
|
+
computed_id = compute_element_id(
|
188
188
|
"component_instance",
|
189
189
|
user_key=key,
|
190
190
|
name=self.name,
|
streamlit/elements/arrow.py
CHANGED
@@ -53,7 +53,7 @@ from streamlit.runtime.scriptrunner_utils.script_run_context import (
|
|
53
53
|
get_script_run_ctx,
|
54
54
|
)
|
55
55
|
from streamlit.runtime.state import WidgetCallback, register_widget
|
56
|
-
from streamlit.runtime.state.common import
|
56
|
+
from streamlit.runtime.state.common import compute_element_id
|
57
57
|
|
58
58
|
if TYPE_CHECKING:
|
59
59
|
from numpy import typing as npt
|
@@ -566,7 +566,7 @@ class ArrowMixin:
|
|
566
566
|
proto.form_id = current_form_id(self.dg)
|
567
567
|
|
568
568
|
ctx = get_script_run_ctx()
|
569
|
-
proto.id =
|
569
|
+
proto.id = compute_element_id(
|
570
570
|
"dataframe",
|
571
571
|
user_key=key,
|
572
572
|
data=proto.data,
|
streamlit/elements/iframe.py
CHANGED
@@ -39,7 +39,7 @@ class IframeMixin:
|
|
39
39
|
|
40
40
|
.. warning::
|
41
41
|
Using ``st.components.v1.iframe`` directly (instead of importing
|
42
|
-
its module) is deprecated and will be
|
42
|
+
its module) is deprecated and will be disallowed in a later version.
|
43
43
|
|
44
44
|
Parameters
|
45
45
|
----------
|
@@ -95,7 +95,7 @@ class IframeMixin:
|
|
95
95
|
|
96
96
|
.. warning::
|
97
97
|
Using ``st.components.v1.html`` directly (instead of importing
|
98
|
-
its module) is deprecated and will be
|
98
|
+
its module) is deprecated and will be disallowed in a later version.
|
99
99
|
|
100
100
|
Parameters
|
101
101
|
----------
|
streamlit/elements/layouts.py
CHANGED
@@ -551,6 +551,7 @@ class LayoutsMixin:
|
|
551
551
|
label: str,
|
552
552
|
*,
|
553
553
|
help: str | None = None,
|
554
|
+
icon: str | None = None,
|
554
555
|
disabled: bool = False,
|
555
556
|
use_container_width: bool = False,
|
556
557
|
) -> DeltaGenerator:
|
@@ -593,6 +594,23 @@ class LayoutsMixin:
|
|
593
594
|
An optional tooltip that gets displayed when the popover button is
|
594
595
|
hovered over.
|
595
596
|
|
597
|
+
icon : str
|
598
|
+
An optional emoji or icon to display next to the button label. If ``icon``
|
599
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
600
|
+
string, the following options are valid:
|
601
|
+
|
602
|
+
* A single-character emoji. For example, you can set ``icon="🚨"``
|
603
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
604
|
+
|
605
|
+
* An icon from the Material Symbols library (rounded style) in the
|
606
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
607
|
+
of the icon in snake case.
|
608
|
+
|
609
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
610
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
611
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
612
|
+
font library.
|
613
|
+
|
596
614
|
disabled : bool
|
597
615
|
An optional boolean, which disables the popover button if set to
|
598
616
|
True. The default is False.
|
@@ -653,6 +671,8 @@ class LayoutsMixin:
|
|
653
671
|
popover_proto.disabled = disabled
|
654
672
|
if help:
|
655
673
|
popover_proto.help = str(help)
|
674
|
+
if icon is not None:
|
675
|
+
popover_proto.icon = validate_icon_or_emoji(icon)
|
656
676
|
|
657
677
|
block_proto = BlockProto()
|
658
678
|
block_proto.allow_empty = True
|
streamlit/elements/media.py
CHANGED
@@ -30,7 +30,7 @@ from streamlit.proto.Video_pb2 import Video as VideoProto
|
|
30
30
|
from streamlit.runtime import caching
|
31
31
|
from streamlit.runtime.metrics_util import gather_metrics
|
32
32
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
33
|
-
from streamlit.runtime.state.common import
|
33
|
+
from streamlit.runtime.state.common import compute_element_id
|
34
34
|
from streamlit.time_util import time_to_seconds
|
35
35
|
from streamlit.type_util import NumpyShape
|
36
36
|
|
@@ -567,7 +567,7 @@ def marshall_video(
|
|
567
567
|
if autoplay:
|
568
568
|
ctx = get_script_run_ctx()
|
569
569
|
proto.autoplay = autoplay
|
570
|
-
id =
|
570
|
+
proto.id = compute_element_id(
|
571
571
|
"video",
|
572
572
|
url=proto.url,
|
573
573
|
mimetype=mimetype,
|
@@ -579,8 +579,6 @@ def marshall_video(
|
|
579
579
|
page=ctx.active_script_hash if ctx else None,
|
580
580
|
)
|
581
581
|
|
582
|
-
proto.id = id
|
583
|
-
|
584
582
|
|
585
583
|
def _parse_start_time_end_time(
|
586
584
|
start_time: MediaTime, end_time: MediaTime | None
|
@@ -743,7 +741,7 @@ def marshall_audio(
|
|
743
741
|
if autoplay:
|
744
742
|
ctx = get_script_run_ctx()
|
745
743
|
proto.autoplay = autoplay
|
746
|
-
id =
|
744
|
+
proto.id = compute_element_id(
|
747
745
|
"audio",
|
748
746
|
url=proto.url,
|
749
747
|
mimetype=mimetype,
|
@@ -754,4 +752,3 @@ def marshall_audio(
|
|
754
752
|
autoplay=autoplay,
|
755
753
|
page=ctx.active_script_hash if ctx else None,
|
756
754
|
)
|
757
|
-
proto.id = id
|
@@ -48,7 +48,7 @@ from streamlit.proto.PlotlyChart_pb2 import PlotlyChart as PlotlyChartProto
|
|
48
48
|
from streamlit.runtime.metrics_util import gather_metrics
|
49
49
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
50
50
|
from streamlit.runtime.state import WidgetCallback, register_widget
|
51
|
-
from streamlit.runtime.state.common import
|
51
|
+
from streamlit.runtime.state.common import compute_element_id
|
52
52
|
|
53
53
|
if TYPE_CHECKING:
|
54
54
|
import matplotlib
|
@@ -498,7 +498,7 @@ class PlotlyMixin:
|
|
498
498
|
# We are computing the widget id for all plotly uses
|
499
499
|
# to also allow non-widget Plotly charts to keep their state
|
500
500
|
# when the frontend component gets unmounted and remounted.
|
501
|
-
plotly_chart_proto.id =
|
501
|
+
plotly_chart_proto.id = compute_element_id(
|
502
502
|
"plotly_chart",
|
503
503
|
user_key=key,
|
504
504
|
key=key,
|
@@ -55,7 +55,7 @@ from streamlit.proto.ArrowVegaLiteChart_pb2 import (
|
|
55
55
|
from streamlit.runtime.metrics_util import gather_metrics
|
56
56
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
57
57
|
from streamlit.runtime.state import WidgetCallback, register_widget
|
58
|
-
from streamlit.runtime.state.common import
|
58
|
+
from streamlit.runtime.state.common import compute_element_id
|
59
59
|
from streamlit.util import HASHLIB_KWARGS
|
60
60
|
|
61
61
|
if TYPE_CHECKING:
|
@@ -1887,7 +1887,7 @@ class VegaChartsMixin:
|
|
1887
1887
|
vega_lite_proto.form_id = current_form_id(self.dg)
|
1888
1888
|
|
1889
1889
|
ctx = get_script_run_ctx()
|
1890
|
-
vega_lite_proto.id =
|
1890
|
+
vega_lite_proto.id = compute_element_id(
|
1891
1891
|
"arrow_vega_lite_chart",
|
1892
1892
|
user_key=key,
|
1893
1893
|
key=key,
|
@@ -49,7 +49,7 @@ from streamlit.runtime.state import (
|
|
49
49
|
WidgetKwargs,
|
50
50
|
register_widget,
|
51
51
|
)
|
52
|
-
from streamlit.runtime.state.common import
|
52
|
+
from streamlit.runtime.state.common import compute_element_id, save_for_app_testing
|
53
53
|
from streamlit.string_util import validate_icon_or_emoji
|
54
54
|
from streamlit.url_util import is_url
|
55
55
|
|
@@ -662,7 +662,7 @@ class ButtonMixin:
|
|
662
662
|
writes_allowed=False,
|
663
663
|
)
|
664
664
|
|
665
|
-
|
665
|
+
element_id = compute_element_id(
|
666
666
|
"download_button",
|
667
667
|
user_key=key,
|
668
668
|
label=label,
|
@@ -682,7 +682,7 @@ class ButtonMixin:
|
|
682
682
|
)
|
683
683
|
|
684
684
|
download_button_proto = DownloadButtonProto()
|
685
|
-
download_button_proto.id =
|
685
|
+
download_button_proto.id = element_id
|
686
686
|
download_button_proto.use_container_width = use_container_width
|
687
687
|
download_button_proto.label = label
|
688
688
|
download_button_proto.default = False
|
@@ -843,7 +843,7 @@ class ButtonMixin:
|
|
843
843
|
enable_check_callback_rules=not is_form_submitter,
|
844
844
|
)
|
845
845
|
|
846
|
-
|
846
|
+
element_id = compute_element_id(
|
847
847
|
"button",
|
848
848
|
user_key=key,
|
849
849
|
label=label,
|
@@ -872,7 +872,7 @@ class ButtonMixin:
|
|
872
872
|
)
|
873
873
|
|
874
874
|
button_proto = ButtonProto()
|
875
|
-
button_proto.id =
|
875
|
+
button_proto.id = element_id
|
876
876
|
button_proto.label = label
|
877
877
|
button_proto.default = False
|
878
878
|
button_proto.is_form_submitter = is_form_submitter
|
@@ -902,7 +902,7 @@ class ButtonMixin:
|
|
902
902
|
)
|
903
903
|
|
904
904
|
if ctx:
|
905
|
-
save_for_app_testing(ctx,
|
905
|
+
save_for_app_testing(ctx, element_id, button_state.value)
|
906
906
|
self.dg._enqueue("button", button_proto)
|
907
907
|
|
908
908
|
return button_state.value
|
@@ -47,7 +47,7 @@ from streamlit.runtime.state.common import (
|
|
47
47
|
RegisterWidgetResult,
|
48
48
|
WidgetDeserializer,
|
49
49
|
WidgetSerializer,
|
50
|
-
|
50
|
+
compute_element_id,
|
51
51
|
save_for_app_testing,
|
52
52
|
)
|
53
53
|
|
@@ -396,7 +396,7 @@ class ButtonGroupMixin:
|
|
396
396
|
if format_func is None
|
397
397
|
else [format_func(option) for option in indexable_options]
|
398
398
|
)
|
399
|
-
|
399
|
+
element_id = compute_element_id(
|
400
400
|
widget_name,
|
401
401
|
user_key=key,
|
402
402
|
key=key,
|
@@ -408,7 +408,7 @@ class ButtonGroupMixin:
|
|
408
408
|
)
|
409
409
|
|
410
410
|
proto = _build_proto(
|
411
|
-
|
411
|
+
element_id,
|
412
412
|
formatted_options,
|
413
413
|
default or [],
|
414
414
|
disabled,
|
@@ -437,7 +437,7 @@ class ButtonGroupMixin:
|
|
437
437
|
proto.set_value = True
|
438
438
|
|
439
439
|
if ctx:
|
440
|
-
save_for_app_testing(ctx,
|
440
|
+
save_for_app_testing(ctx, element_id, format_func)
|
441
441
|
|
442
442
|
self.dg._enqueue(widget_name, proto)
|
443
443
|
|
@@ -43,7 +43,7 @@ from streamlit.runtime.state import (
|
|
43
43
|
WidgetKwargs,
|
44
44
|
register_widget,
|
45
45
|
)
|
46
|
-
from streamlit.runtime.state.common import
|
46
|
+
from streamlit.runtime.state.common import compute_element_id
|
47
47
|
from streamlit.runtime.uploaded_file_manager import DeletedFile, UploadedFile
|
48
48
|
|
49
49
|
if TYPE_CHECKING:
|
@@ -203,7 +203,7 @@ class CameraInputMixin:
|
|
203
203
|
)
|
204
204
|
maybe_raise_label_warnings(label, label_visibility)
|
205
205
|
|
206
|
-
|
206
|
+
element_id = compute_element_id(
|
207
207
|
"camera_input",
|
208
208
|
user_key=key,
|
209
209
|
label=label,
|
@@ -214,7 +214,7 @@ class CameraInputMixin:
|
|
214
214
|
)
|
215
215
|
|
216
216
|
camera_input_proto = CameraInputProto()
|
217
|
-
camera_input_proto.id =
|
217
|
+
camera_input_proto.id = element_id
|
218
218
|
camera_input_proto.label = label
|
219
219
|
camera_input_proto.form_id = current_form_id(self.dg)
|
220
220
|
camera_input_proto.disabled = disabled
|
@@ -37,7 +37,7 @@ from streamlit.runtime.state import (
|
|
37
37
|
WidgetKwargs,
|
38
38
|
register_widget,
|
39
39
|
)
|
40
|
-
from streamlit.runtime.state.common import
|
40
|
+
from streamlit.runtime.state.common import compute_element_id, save_for_app_testing
|
41
41
|
from streamlit.string_util import is_emoji, validate_material_icon
|
42
42
|
|
43
43
|
if TYPE_CHECKING:
|
@@ -323,7 +323,7 @@ class ChatMixin:
|
|
323
323
|
)
|
324
324
|
|
325
325
|
ctx = get_script_run_ctx()
|
326
|
-
|
326
|
+
element_id = compute_element_id(
|
327
327
|
"chat_input",
|
328
328
|
user_key=key,
|
329
329
|
key=key,
|
@@ -356,7 +356,7 @@ class ChatMixin:
|
|
356
356
|
position = "inline"
|
357
357
|
|
358
358
|
chat_input_proto = ChatInputProto()
|
359
|
-
chat_input_proto.id =
|
359
|
+
chat_input_proto.id = element_id
|
360
360
|
chat_input_proto.placeholder = str(placeholder)
|
361
361
|
|
362
362
|
if max_chars is not None:
|
@@ -383,7 +383,7 @@ class ChatMixin:
|
|
383
383
|
chat_input_proto.set_value = True
|
384
384
|
|
385
385
|
if ctx:
|
386
|
-
save_for_app_testing(ctx,
|
386
|
+
save_for_app_testing(ctx, element_id, widget_state.value)
|
387
387
|
if position == "bottom":
|
388
388
|
# We need to enqueue the chat input into the bottom container
|
389
389
|
# instead of the currently active dg.
|
@@ -38,7 +38,7 @@ from streamlit.runtime.state import (
|
|
38
38
|
WidgetKwargs,
|
39
39
|
register_widget,
|
40
40
|
)
|
41
|
-
from streamlit.runtime.state.common import
|
41
|
+
from streamlit.runtime.state.common import compute_element_id
|
42
42
|
|
43
43
|
if TYPE_CHECKING:
|
44
44
|
from streamlit.delta_generator import DeltaGenerator
|
@@ -291,7 +291,7 @@ class CheckboxMixin:
|
|
291
291
|
)
|
292
292
|
maybe_raise_label_warnings(label, label_visibility)
|
293
293
|
|
294
|
-
|
294
|
+
element_id = compute_element_id(
|
295
295
|
"toggle" if type == CheckboxProto.StyleType.TOGGLE else "checkbox",
|
296
296
|
user_key=key,
|
297
297
|
label=label,
|
@@ -303,7 +303,7 @@ class CheckboxMixin:
|
|
303
303
|
)
|
304
304
|
|
305
305
|
checkbox_proto = CheckboxProto()
|
306
|
-
checkbox_proto.id =
|
306
|
+
checkbox_proto.id = element_id
|
307
307
|
checkbox_proto.label = label
|
308
308
|
checkbox_proto.default = bool(value)
|
309
309
|
checkbox_proto.type = type
|
@@ -40,7 +40,7 @@ from streamlit.runtime.state import (
|
|
40
40
|
WidgetKwargs,
|
41
41
|
register_widget,
|
42
42
|
)
|
43
|
-
from streamlit.runtime.state.common import
|
43
|
+
from streamlit.runtime.state.common import compute_element_id
|
44
44
|
|
45
45
|
if TYPE_CHECKING:
|
46
46
|
from streamlit.delta_generator import DeltaGenerator
|
@@ -186,7 +186,7 @@ class ColorPickerMixin:
|
|
186
186
|
)
|
187
187
|
maybe_raise_label_warnings(label, label_visibility)
|
188
188
|
|
189
|
-
|
189
|
+
element_id = compute_element_id(
|
190
190
|
"color_picker",
|
191
191
|
user_key=key,
|
192
192
|
label=label,
|
@@ -224,7 +224,7 @@ class ColorPickerMixin:
|
|
224
224
|
)
|
225
225
|
|
226
226
|
color_picker_proto = ColorPickerProto()
|
227
|
-
color_picker_proto.id =
|
227
|
+
color_picker_proto.id = element_id
|
228
228
|
color_picker_proto.label = label
|
229
229
|
color_picker_proto.default = str(value)
|
230
230
|
color_picker_proto.form_id = current_form_id(self.dg)
|
@@ -66,7 +66,7 @@ from streamlit.runtime.state import (
|
|
66
66
|
WidgetKwargs,
|
67
67
|
register_widget,
|
68
68
|
)
|
69
|
-
from streamlit.runtime.state.common import
|
69
|
+
from streamlit.runtime.state.common import compute_element_id
|
70
70
|
from streamlit.type_util import is_type
|
71
71
|
from streamlit.util import calc_md5
|
72
72
|
|
@@ -377,12 +377,14 @@ def _apply_dataframe_edits(
|
|
377
377
|
if data_editor_state.get("edited_rows"):
|
378
378
|
_apply_cell_edits(df, data_editor_state["edited_rows"], dataframe_schema)
|
379
379
|
|
380
|
-
if data_editor_state.get("added_rows"):
|
381
|
-
_apply_row_additions(df, data_editor_state["added_rows"], dataframe_schema)
|
382
|
-
|
383
380
|
if data_editor_state.get("deleted_rows"):
|
384
381
|
_apply_row_deletions(df, data_editor_state["deleted_rows"])
|
385
382
|
|
383
|
+
if data_editor_state.get("added_rows"):
|
384
|
+
# The addition of new rows needs to happen after the deletion to not have
|
385
|
+
# unexpected side-effects, like https://github.com/streamlit/streamlit/issues/8854
|
386
|
+
_apply_row_additions(df, data_editor_state["added_rows"], dataframe_schema)
|
387
|
+
|
386
388
|
|
387
389
|
def _is_supported_index(df_index: pd.Index) -> bool:
|
388
390
|
"""Check if the index is supported by the data editor component.
|
@@ -883,7 +885,7 @@ class DataEditorMixin:
|
|
883
885
|
# format that will hash consistently, so we do it late here to have it
|
884
886
|
# as close as possible to how it used to be.
|
885
887
|
ctx = get_script_run_ctx()
|
886
|
-
|
888
|
+
element_id = compute_element_id(
|
887
889
|
"data_editor",
|
888
890
|
user_key=key,
|
889
891
|
data=arrow_bytes,
|
@@ -899,7 +901,7 @@ class DataEditorMixin:
|
|
899
901
|
)
|
900
902
|
|
901
903
|
proto = ArrowProto()
|
902
|
-
proto.id =
|
904
|
+
proto.id = element_id
|
903
905
|
|
904
906
|
proto.use_container_width = use_container_width
|
905
907
|
|
@@ -43,7 +43,7 @@ from streamlit.runtime.state import (
|
|
43
43
|
WidgetKwargs,
|
44
44
|
register_widget,
|
45
45
|
)
|
46
|
-
from streamlit.runtime.state.common import
|
46
|
+
from streamlit.runtime.state.common import compute_element_id
|
47
47
|
from streamlit.runtime.uploaded_file_manager import DeletedFile, UploadedFile
|
48
48
|
|
49
49
|
if TYPE_CHECKING:
|
@@ -405,7 +405,7 @@ class FileUploaderMixin:
|
|
405
405
|
)
|
406
406
|
maybe_raise_label_warnings(label, label_visibility)
|
407
407
|
|
408
|
-
|
408
|
+
element_id = compute_element_id(
|
409
409
|
"file_uploader",
|
410
410
|
user_key=key,
|
411
411
|
label=label,
|
@@ -437,7 +437,7 @@ class FileUploaderMixin:
|
|
437
437
|
type.append(x)
|
438
438
|
|
439
439
|
file_uploader_proto = FileUploaderProto()
|
440
|
-
file_uploader_proto.id =
|
440
|
+
file_uploader_proto.id = element_id
|
441
441
|
file_uploader_proto.label = label
|
442
442
|
file_uploader_proto.type[:] = type if type is not None else []
|
443
443
|
file_uploader_proto.max_upload_size_mb = config.get_option(
|
@@ -41,7 +41,7 @@ from streamlit.proto.MultiSelect_pb2 import MultiSelect as MultiSelectProto
|
|
41
41
|
from streamlit.runtime.metrics_util import gather_metrics
|
42
42
|
from streamlit.runtime.scriptrunner import ScriptRunContext, get_script_run_ctx
|
43
43
|
from streamlit.runtime.state import register_widget
|
44
|
-
from streamlit.runtime.state.common import
|
44
|
+
from streamlit.runtime.state.common import compute_element_id, save_for_app_testing
|
45
45
|
from streamlit.type_util import (
|
46
46
|
T,
|
47
47
|
is_iterable,
|
@@ -280,7 +280,7 @@ class MultiSelectMixin:
|
|
280
280
|
default_values = get_default_indices(indexable_options, default)
|
281
281
|
|
282
282
|
form_id = current_form_id(self.dg)
|
283
|
-
|
283
|
+
element_id = compute_element_id(
|
284
284
|
widget_name,
|
285
285
|
user_key=key,
|
286
286
|
label=label,
|
@@ -295,7 +295,7 @@ class MultiSelectMixin:
|
|
295
295
|
)
|
296
296
|
|
297
297
|
proto = MultiSelectProto()
|
298
|
-
proto.id =
|
298
|
+
proto.id = element_id
|
299
299
|
proto.default[:] = default_values
|
300
300
|
proto.form_id = form_id
|
301
301
|
proto.disabled = disabled
|
@@ -332,7 +332,7 @@ class MultiSelectMixin:
|
|
332
332
|
proto.set_value = True
|
333
333
|
|
334
334
|
if ctx:
|
335
|
-
save_for_app_testing(ctx,
|
335
|
+
save_for_app_testing(ctx, element_id, format_func)
|
336
336
|
|
337
337
|
self.dg._enqueue(widget_name, proto)
|
338
338
|
|
@@ -44,7 +44,7 @@ from streamlit.runtime.state import (
|
|
44
44
|
get_session_state,
|
45
45
|
register_widget,
|
46
46
|
)
|
47
|
-
from streamlit.runtime.state.common import
|
47
|
+
from streamlit.runtime.state.common import compute_element_id
|
48
48
|
|
49
49
|
if TYPE_CHECKING:
|
50
50
|
from streamlit.delta_generator import DeltaGenerator
|
@@ -350,7 +350,7 @@ class NumberInputMixin:
|
|
350
350
|
)
|
351
351
|
maybe_raise_label_warnings(label, label_visibility)
|
352
352
|
|
353
|
-
|
353
|
+
element_id = compute_element_id(
|
354
354
|
"number_input",
|
355
355
|
user_key=key,
|
356
356
|
label=label,
|
@@ -481,7 +481,7 @@ class NumberInputMixin:
|
|
481
481
|
data_type = NumberInputProto.INT if all_ints else NumberInputProto.FLOAT
|
482
482
|
|
483
483
|
number_input_proto = NumberInputProto()
|
484
|
-
number_input_proto.id =
|
484
|
+
number_input_proto.id = element_id
|
485
485
|
number_input_proto.data_type = data_type
|
486
486
|
number_input_proto.label = label
|
487
487
|
if value is not None:
|
@@ -42,7 +42,7 @@ from streamlit.runtime.state import (
|
|
42
42
|
get_session_state,
|
43
43
|
register_widget,
|
44
44
|
)
|
45
|
-
from streamlit.runtime.state.common import
|
45
|
+
from streamlit.runtime.state.common import compute_element_id, save_for_app_testing
|
46
46
|
from streamlit.type_util import (
|
47
47
|
T,
|
48
48
|
check_python_comparable,
|
@@ -312,7 +312,7 @@ class RadioMixin:
|
|
312
312
|
opt = convert_anything_to_list(options)
|
313
313
|
check_python_comparable(opt)
|
314
314
|
|
315
|
-
|
315
|
+
element_id = compute_element_id(
|
316
316
|
"radio",
|
317
317
|
user_key=key,
|
318
318
|
label=label,
|
@@ -351,7 +351,7 @@ class RadioMixin:
|
|
351
351
|
index = None
|
352
352
|
|
353
353
|
radio_proto = RadioProto()
|
354
|
-
radio_proto.id =
|
354
|
+
radio_proto.id = element_id
|
355
355
|
radio_proto.label = label
|
356
356
|
if index is not None:
|
357
357
|
radio_proto.default = index
|
@@ -392,7 +392,7 @@ class RadioMixin:
|
|
392
392
|
radio_proto.set_value = True
|
393
393
|
|
394
394
|
if ctx:
|
395
|
-
save_for_app_testing(ctx,
|
395
|
+
save_for_app_testing(ctx, element_id, format_func)
|
396
396
|
self.dg._enqueue("radio", radio_proto)
|
397
397
|
return widget_state.value
|
398
398
|
|
@@ -55,7 +55,7 @@ from streamlit.runtime.state import (
|
|
55
55
|
)
|
56
56
|
from streamlit.runtime.state.common import (
|
57
57
|
RegisterWidgetResult,
|
58
|
-
|
58
|
+
compute_element_id,
|
59
59
|
save_for_app_testing,
|
60
60
|
)
|
61
61
|
from streamlit.type_util import T, check_python_comparable
|
@@ -365,7 +365,7 @@ class SelectSliderMixin:
|
|
365
365
|
# Convert element to index of the elements
|
366
366
|
slider_value = as_index_list(value)
|
367
367
|
|
368
|
-
|
368
|
+
element_id = compute_element_id(
|
369
369
|
"select_slider",
|
370
370
|
user_key=key,
|
371
371
|
label=label,
|
@@ -378,7 +378,7 @@ class SelectSliderMixin:
|
|
378
378
|
)
|
379
379
|
|
380
380
|
slider_proto = SliderProto()
|
381
|
-
slider_proto.id =
|
381
|
+
slider_proto.id = element_id
|
382
382
|
slider_proto.type = SliderProto.Type.SELECT_SLIDER
|
383
383
|
slider_proto.label = label
|
384
384
|
slider_proto.format = "%s"
|
@@ -421,7 +421,7 @@ class SelectSliderMixin:
|
|
421
421
|
slider_proto.set_value = True
|
422
422
|
|
423
423
|
if ctx:
|
424
|
-
save_for_app_testing(ctx,
|
424
|
+
save_for_app_testing(ctx, element_id, format_func)
|
425
425
|
|
426
426
|
self.dg._enqueue("slider", slider_proto)
|
427
427
|
return widget_state.value
|
@@ -41,7 +41,7 @@ from streamlit.runtime.state import (
|
|
41
41
|
get_session_state,
|
42
42
|
register_widget,
|
43
43
|
)
|
44
|
-
from streamlit.runtime.state.common import
|
44
|
+
from streamlit.runtime.state.common import compute_element_id, save_for_app_testing
|
45
45
|
from streamlit.type_util import (
|
46
46
|
T,
|
47
47
|
check_python_comparable,
|
@@ -284,7 +284,7 @@ class SelectboxMixin:
|
|
284
284
|
opt = convert_anything_to_list(options)
|
285
285
|
check_python_comparable(opt)
|
286
286
|
|
287
|
-
|
287
|
+
element_id = compute_element_id(
|
288
288
|
"selectbox",
|
289
289
|
user_key=key,
|
290
290
|
label=label,
|
@@ -312,7 +312,7 @@ class SelectboxMixin:
|
|
312
312
|
index = None
|
313
313
|
|
314
314
|
selectbox_proto = SelectboxProto()
|
315
|
-
selectbox_proto.id =
|
315
|
+
selectbox_proto.id = element_id
|
316
316
|
selectbox_proto.label = label
|
317
317
|
if index is not None:
|
318
318
|
selectbox_proto.default = index
|
@@ -349,7 +349,7 @@ class SelectboxMixin:
|
|
349
349
|
selectbox_proto.set_value = True
|
350
350
|
|
351
351
|
if ctx:
|
352
|
-
save_for_app_testing(ctx,
|
352
|
+
save_for_app_testing(ctx, element_id, format_func)
|
353
353
|
self.dg._enqueue("selectbox", selectbox_proto)
|
354
354
|
return widget_state.value
|
355
355
|
|
@@ -56,7 +56,7 @@ from streamlit.runtime.state import (
|
|
56
56
|
get_session_state,
|
57
57
|
register_widget,
|
58
58
|
)
|
59
|
-
from streamlit.runtime.state.common import
|
59
|
+
from streamlit.runtime.state.common import compute_element_id
|
60
60
|
|
61
61
|
if TYPE_CHECKING:
|
62
62
|
from streamlit.delta_generator import DeltaGenerator
|
@@ -542,7 +542,7 @@ class SliderMixin:
|
|
542
542
|
)
|
543
543
|
maybe_raise_label_warnings(label, label_visibility)
|
544
544
|
|
545
|
-
|
545
|
+
element_id = compute_element_id(
|
546
546
|
"slider",
|
547
547
|
user_key=key,
|
548
548
|
label=label,
|
@@ -803,7 +803,7 @@ class SliderMixin:
|
|
803
803
|
|
804
804
|
slider_proto = SliderProto()
|
805
805
|
slider_proto.type = SliderProto.Type.SLIDER
|
806
|
-
slider_proto.id =
|
806
|
+
slider_proto.id = element_id
|
807
807
|
slider_proto.label = label
|
808
808
|
slider_proto.format = format
|
809
809
|
slider_proto.default[:] = value
|