streamlit-plugins 0.7.16__tar.gz → 0.7.17__tar.gz

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.
Files changed (97) hide show
  1. {streamlit_plugins-0.7.16/streamlit_plugins.egg-info → streamlit_plugins-0.7.17}/PKG-INFO +1 -1
  2. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/__init__.py +56 -30
  3. streamlit_plugins-0.7.17/streamlit_plugins/components/navbar/frontend/build/asset-manifest.json +10 -0
  4. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/index.html +1 -1
  5. streamlit_plugins-0.7.17/streamlit_plugins/components/navbar/frontend/build/static/js/main.8e1dc380.js +3 -0
  6. streamlit_plugins-0.7.17/streamlit_plugins/components/navbar/frontend/build/static/js/main.8e1dc380.js.map +1 -0
  7. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17/streamlit_plugins.egg-info}/PKG-INFO +1 -1
  8. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins.egg-info/SOURCES.txt +3 -3
  9. streamlit_plugins-0.7.16/streamlit_plugins/components/navbar/frontend/build/asset-manifest.json +0 -10
  10. streamlit_plugins-0.7.16/streamlit_plugins/components/navbar/frontend/build/static/js/main.8bc23bfa.js +0 -3
  11. streamlit_plugins-0.7.16/streamlit_plugins/components/navbar/frontend/build/static/js/main.8bc23bfa.js.map +0 -1
  12. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/LICENSE +0 -0
  13. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/README.md +0 -0
  14. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/setup.cfg +0 -0
  15. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/setup.py +0 -0
  16. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/__init__.py +0 -0
  17. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/__init__.py +0 -0
  18. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/annotated_text/__init__.py +0 -0
  19. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/document_blocks/__init__.py +0 -0
  20. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/input_chat_advance/__init__.py +0 -0
  21. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/__init__.py +0 -0
  22. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/asset-manifest.json +0 -0
  23. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/bootstrap.min.css +0 -0
  24. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/custom.css +0 -0
  25. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/index.html +0 -0
  26. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/css/2.4f758a59.chunk.css +0 -0
  27. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/css/2.4f758a59.chunk.css.map +0 -0
  28. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/js/2.524324ba.chunk.js +0 -0
  29. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/js/2.524324ba.chunk.js.LICENSE.txt +0 -0
  30. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/js/2.524324ba.chunk.js.map +0 -0
  31. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/js/main.34b82d10.chunk.js +0 -0
  32. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/js/main.34b82d10.chunk.js.map +0 -0
  33. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/js/runtime-main.65660c44.js +0 -0
  34. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/label_studio/frontend/build/static/js/runtime-main.65660c44.js.map +0 -0
  35. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/loader/__init__.py +0 -0
  36. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/config.py +0 -0
  37. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/CrossOriginInterface.js +0 -0
  38. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/bootstrap.min.css +0 -0
  39. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/bootstrap.min.css.map +0 -0
  40. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/material-fonts.css +0 -0
  41. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/material.woff2 +0 -0
  42. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/st-styles.css +0 -0
  43. /streamlit_plugins-0.7.16/streamlit_plugins/components/navbar/frontend/build/static/js/main.8bc23bfa.js.LICENSE.txt → /streamlit_plugins-0.7.17/streamlit_plugins/components/navbar/frontend/build/static/js/main.8e1dc380.js.LICENSE.txt +0 -0
  44. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/frontend/build/style.css +0 -0
  45. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/navbar/inject_script.py +0 -0
  46. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/sankey_input/__init__.py +0 -0
  47. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/selectbox_enrich/__init__.py +0 -0
  48. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/skeleton/__init__.py +0 -0
  49. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/skeleton/template_builder.py +0 -0
  50. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/__init__.py +0 -0
  51. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/asset-manifest.json +0 -0
  52. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/index.html +0 -0
  53. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/drawsvg.js +0 -0
  54. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/drawsvg.v7.js +0 -0
  55. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/favicon.ico +0 -0
  56. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/images/sort_asc.png +0 -0
  57. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/images/sort_both.png +0 -0
  58. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/images/sort_desc.png +0 -0
  59. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/js/2.9cedfdc4.chunk.js +0 -0
  60. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/js/2.9cedfdc4.chunk.js.LICENSE.txt +0 -0
  61. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/js/2.9cedfdc4.chunk.js.map +0 -0
  62. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/js/main.1dfd8582.chunk.js +0 -0
  63. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/js/main.1dfd8582.chunk.js.map +0 -0
  64. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/js/runtime-main.8efd821a.js +0 -0
  65. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/js/runtime-main.8efd821a.js.map +0 -0
  66. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/snakeviz.css +0 -0
  67. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/snakeviz.js +0 -0
  68. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/d3.v3.min.js +0 -0
  69. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/immutable.min.js +0 -0
  70. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/jquery-3.2.1.min.js +0 -0
  71. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/jquery.dataTables.min.css +0 -0
  72. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/jquery.dataTables.min.js +0 -0
  73. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/lodash.min.js +0 -0
  74. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/templates/dir.html +0 -0
  75. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/snakeviz/frontend/build/templates/viz.html +0 -0
  76. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/theme_changer/__init__.py +0 -0
  77. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/theme_changer/config.py +0 -0
  78. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/theme_changer/entity.py +0 -0
  79. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/theme_changer/frontend/build/CrossOriginInterface.js +0 -0
  80. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/components/theme_changer/inject_script.py +0 -0
  81. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/extension/__init__.py +0 -0
  82. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/extension/button_group/__init__.py +0 -0
  83. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/extension/dynamic_container/__init__.py +0 -0
  84. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/__init__.py +0 -0
  85. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/multilit/__init__.py +0 -0
  86. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/multilit/app_wrapper.py +0 -0
  87. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/multilit/loading_engine.py +0 -0
  88. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/multilit/multilit.py +0 -0
  89. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/reactlit/__init__.py +0 -0
  90. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/reactlit/advanced_patterns.py +0 -0
  91. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/reactlit/lab.py +0 -0
  92. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/reactlit/reactive.py +0 -0
  93. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/reactlit/reactlit.py +0 -0
  94. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins/framework/reactlit/test_reactive.py +0 -0
  95. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins.egg-info/dependency_links.txt +0 -0
  96. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins.egg-info/requires.txt +0 -0
  97. {streamlit_plugins-0.7.16 → streamlit_plugins-0.7.17}/streamlit_plugins.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-plugins
3
- Version: 0.7.16
3
+ Version: 0.7.17
4
4
  Summary: Components and Frameworks to give new features to streamlit
5
5
  Home-page: https://github.com/quiradev/streamlit-plugins
6
6
  Author: Victor Quilon Ranera
@@ -1,6 +1,6 @@
1
1
  import inspect
2
2
  import time
3
- from typing import Literal
3
+ from typing import Literal, Optional, cast
4
4
  import warnings
5
5
  import logging
6
6
  from urllib.parse import urlparse
@@ -624,6 +624,7 @@ def st_navbar(
624
624
  option_menu=False,
625
625
  default_page_selected_id=None,
626
626
  override_page_selected_id=None,
627
+ override_first_page_load_id=None,
627
628
  reclick_load=True,
628
629
  input_styles: str | None = None,
629
630
  themes_data: list[dict]| None = None,
@@ -633,7 +634,7 @@ def st_navbar(
633
634
  prefix_url: str = "",
634
635
  # url_navigation: bool = False,
635
636
  key="NavBarComponent",
636
- ):
637
+ ) -> str:
637
638
  if home_definition is None:
638
639
  home_definition = menu_definition.pop(0)
639
640
 
@@ -748,12 +749,13 @@ def st_navbar(
748
749
  st.session_state[f"{NAVBAR_KEY_PREFIX}_coi_instance"] = True
749
750
 
750
751
  with navbar_view:
751
- component_value = _component_func(
752
+ component_value: Optional[str] = _component_func(
752
753
  menu_definition=menu_definition, home=home_data or None, login=login_data or None,
753
754
  override_theme=override_theme,
754
755
  position_mode=position_mode, is_sticky=sticky_nav,
755
756
  default_page_selected_id=default_page_selected_id,
756
757
  override_page_selected_id=override_page_selected_id,
758
+ override_first_page_load_id=override_first_page_load_id,
757
759
  reclick_load=reclick_load,
758
760
  styles=styles, custom_styles=input_styles,
759
761
  is_navigation=is_navigation,
@@ -762,7 +764,7 @@ def st_navbar(
762
764
  collapsible=collapsible,
763
765
  prefix_url=prefix_url,
764
766
  # url_navigation=url_navigation and is_navigation,
765
- default=default_page_selected_id,
767
+ default=None,
766
768
  is_visible=True,
767
769
  key=key, fvalue=force_value,
768
770
  )
@@ -774,14 +776,17 @@ def st_navbar(
774
776
  # print(f"FROM Navbar: {component_value}")
775
777
 
776
778
  if component_value is None:
777
- component_value = default_page_selected_id
779
+ if not is_navigation:
780
+ component_value = default_page_selected_id
781
+ else:
782
+ component_value = override_first_page_load_id or default_page_selected_id
778
783
 
779
784
  if override_page_selected_id:
780
785
  component_value = override_page_selected_id
781
786
 
782
787
  # print(f"FROM Navbar FINAL: {component_value}")
783
788
  # print()
784
- return component_value
789
+ return cast(str, component_value)
785
790
 
786
791
  def st_which_page() -> str:
787
792
  return st.session_state[f"{NAVIGATION_KEY_PREFIX}_page_id"]
@@ -805,6 +810,9 @@ def st_navigation(
805
810
  page_id_key = f"{NAVIGATION_KEY_PREFIX}_page_id"
806
811
  force_page_id_key = f"{NAVIGATION_KEY_PREFIX}_force_page_id"
807
812
  history_key = f"{NAVIGATION_KEY_PREFIX}_history"
813
+ default_page_id_key = f"{NAVIGATION_KEY_PREFIX}_default_page_id"
814
+
815
+ first_load = False
808
816
 
809
817
  if prev_url_page_id_key not in st.session_state:
810
818
  st.session_state[prev_url_page_id_key] = None
@@ -814,6 +822,7 @@ def st_navigation(
814
822
 
815
823
  if page_id_key not in st.session_state:
816
824
  st.session_state[page_id_key] = None
825
+ first_load = True
817
826
 
818
827
  if force_page_id_key not in st.session_state:
819
828
  st.session_state[force_page_id_key] = None
@@ -903,7 +912,7 @@ def st_navigation(
903
912
 
904
913
  st.session_state[f"{NAVIGATION_KEY_PREFIX}_menu_pages"] = menu_pages
905
914
  st.session_state[f"{NAVIGATION_KEY_PREFIX}_menu_account_pages"] = menu_account_pages
906
- st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"] = default_page._script_hash
915
+ st.session_state[default_page_id_key] = default_page._script_hash
907
916
 
908
917
  logout_page_id, login_page_id = None, None
909
918
  if login_page:
@@ -927,15 +936,34 @@ def st_navigation(
927
936
 
928
937
 
929
938
  if st.session_state[page_id_key] is None:
930
- st.session_state[page_id_key] = st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"]
939
+ st.session_state[page_id_key] = st.session_state[default_page_id_key]
940
+
941
+ initial_force_page_id = st.session_state[force_page_id_key]
931
942
 
932
- next_page_id = st_navbar(
943
+ if native_way:
944
+ # Si la url es el path igual al que devuelve el `next_page_id` quiere decir que la navegacion es por url
945
+ # En este punto el navigation de streamlit siempre devolvera la pagina actual
946
+ # ya que no se usara su navegacion frontal para seleccionar una pagina
947
+ # if url_navigation:
948
+ url_page_id = get_page_id_by_url_path(
949
+ pages_map, st.context.url, prefix_url=prefix_url
950
+ )
951
+ # print("URL PAGE", pages_map[url_page_id].title)
952
+ if url_page_id != st.session_state[prev_url_page_id_key]:
953
+ # Navegacion por url
954
+ st.session_state[prev_url_page_id_key] = url_page_id
955
+ # Solo si es la primera pagina, no hay variables de estado previas o se ha limpiado
956
+ if first_load:
957
+ initial_force_page_id = url_page_id
958
+
959
+ navbar_page_id = st_navbar(
933
960
  menu_definition=menu_pages, # if st.session_state.logged_in else [],
934
961
  home_definition=home_definition,
935
962
  login_definition=menu_account_pages,
936
963
  hide_streamlit_markers=False,
937
- default_page_selected_id=st.session_state[page_id_key] or st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"],
964
+ default_page_selected_id=st.session_state[page_id_key] or st.session_state[default_page_id_key],
938
965
  override_page_selected_id=st.session_state[force_page_id_key],
966
+ override_first_page_load_id=initial_force_page_id,
939
967
  position_mode=position_mode,
940
968
  sticky_nav=sticky_nav,
941
969
  input_styles=input_styles,
@@ -947,42 +975,40 @@ def st_navigation(
947
975
  hide_skeleton=True,
948
976
  )
949
977
  st.session_state[force_page_id_key] = None
950
- prev_page_id = st.session_state[page_id_key]
951
- st.session_state[page_id_key] = next_page_id # Added to fix login/logout issue
978
+ streamlit_page_id = st.session_state[page_id_key]
979
+ st.session_state[page_id_key] = navbar_page_id or initial_force_page_id # Added to fix login/logout issue
952
980
  # print("CUSTOM COMPONENT", pages_map[next_page_id].title)
953
981
  if native_way:
954
982
  # Si la url es el path igual al que devuelve el `next_page_id` quiere decir que la navegacion es por url
955
983
  # En este punto el navigation de streamlit siempre devolvera la pagina actual
956
984
  # ya que no se usara su navegacion frontal para seleccionar una pagina
957
985
  # if url_navigation:
958
- # url_page_id = get_page_id_by_url_path(
959
- # pages_map, st.context.url, prefix_url=prefix_url
960
- # )
961
- # # print("URL PAGE", pages_map[url_page_id].title)
962
- # if url_page_id != st.session_state[f"{NAVIGATION_KEY_PREFIX}_prev_url_page_id"]:
963
- # # Navegacion por url
964
- # # Give enough time to the custom component to update
965
- # time.sleep(0.1)
966
- # st.session_state[f"{NAVIGATION_KEY_PREFIX}_prev_url_page_id"] = url_page_id
967
- # next_page_id = url_page_id
986
+ url_page_id = get_page_id_by_url_path(
987
+ pages_map, st.context.url, prefix_url=prefix_url
988
+ )
989
+ # print("URL PAGE", pages_map[url_page_id].title)
990
+ if url_page_id != st.session_state[prev_url_page_id_key]:
991
+ # Navegacion por url
992
+ st.session_state[prev_url_page_id_key] = url_page_id
993
+ navbar_page_id = url_page_id
968
994
 
969
995
  page = st.navigation(
970
996
  st_pages,
971
997
  position="hidden"
972
998
  )
973
999
  # print("ST PAGE", page.title)
974
- prev_page_id = page._script_hash
1000
+ streamlit_page_id = page._script_hash
975
1001
  else:
976
- page = pages_map.get(next_page_id, default_page)
1002
+ page = pages_map.get(navbar_page_id, default_page)
977
1003
 
978
1004
  # print("PAGE", pages_map[next_page_id].title)
979
1005
 
980
- # Solo si se cambia de pagina
981
- if prev_page_id != next_page_id:
982
- st.session_state[page_id_key] = next_page_id
983
- if prev_page_id not in [logout_page_id, login_page_id]:
984
- st.session_state[prev_page_id_key] = prev_page_id
985
- st_switch_page(next_page_id, native_way=native_way)
1006
+ # Solo si se cambia de pagina desde el componente custom
1007
+ if streamlit_page_id != navbar_page_id:
1008
+ st.session_state[page_id_key] = navbar_page_id
1009
+ if streamlit_page_id not in [logout_page_id, login_page_id]:
1010
+ st.session_state[prev_page_id_key] = streamlit_page_id
1011
+ st_switch_page(navbar_page_id, native_way=native_way)
986
1012
 
987
1013
  page._can_be_called = True
988
1014
  add_page_to_history(page._script_hash)
@@ -0,0 +1,10 @@
1
+ {
2
+ "files": {
3
+ "main.js": "./static/js/main.8e1dc380.js",
4
+ "index.html": "./index.html",
5
+ "main.8e1dc380.js.map": "./static/js/main.8e1dc380.js.map"
6
+ },
7
+ "entrypoints": [
8
+ "static/js/main.8e1dc380.js"
9
+ ]
10
+ }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><title>Streamlit Component NavBar</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Streamlit Component NavBar"/><link rel="stylesheet" href="./bootstrap.min.css"/><link rel="stylesheet" href="./material-fonts.css"/><script defer="defer" src="./static/js/main.8bc23bfa.js"></script></head><body><link rel="stylesheet" href="./style.css"/><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><title>Streamlit Component NavBar</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Streamlit Component NavBar"/><link rel="stylesheet" href="./bootstrap.min.css"/><link rel="stylesheet" href="./material-fonts.css"/><script defer="defer" src="./static/js/main.8e1dc380.js"></script></head><body><link rel="stylesheet" href="./style.css"/><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>