dara-components 1.25.0__py3-none-any.whl → 1.25.1__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.
@@ -123,6 +123,7 @@ class Select(FormComponent):
123
123
  :param placeholder: Placeholder text to be displayed when the select is empty
124
124
  :param searchable: Boolean, if True the items can be filtered via a search term
125
125
  :param value: A Variable instance recording the component's state
126
+ :param size: An optional font size for the select component, in REM units
126
127
  """
127
128
 
128
129
  id: str | None = None
@@ -133,6 +134,7 @@ class Select(FormComponent):
133
134
  onchange: Action | None = None
134
135
  placeholder: str | None = None
135
136
  value: Variable[Any] | None = None
137
+ size: int | float | None = None
136
138
 
137
139
  @field_validator('items', mode='before')
138
140
  @classmethod
@@ -507,6 +507,12 @@ class Column(BaseModel):
507
507
  return filter
508
508
 
509
509
 
510
+ class TableAction(BaseModel):
511
+ icon_name: str
512
+ label: str
513
+ id: str
514
+
515
+
510
516
  class Table(ContentComponent):
511
517
  """
512
518
  ![Table](../../../../docs/packages/dara-components/common/assets/Table.png)
@@ -835,12 +841,52 @@ class Table(ContentComponent):
835
841
  )
836
842
  ```
837
843
 
844
+ You can also set row height for the table. This is particularly useful if you have text that is overflowing and you want the table to be taller. The height is a number that defines the height in pixels.
845
+
846
+ ```python
847
+ Table(
848
+ columns=columns,
849
+ data=data,
850
+ row_height=100,
851
+ )
852
+ ```
853
+
854
+ A table component can also work with custom actions. This will automatically add an action column to the table at the end, where you can define the actions you want to display.
855
+
856
+ ```python
857
+ from dara.components.common import Table, TableAction
858
+ from dara.core import action
859
+
860
+
861
+ @action
862
+ async def on_action(ctx: action.Ctx):
863
+ action_params = ctx.input
864
+ action_id = action_params['action_id']
865
+ data = action_params['data']
866
+ print(f'Action performed: {action_id} with data: {data}')
867
+
868
+ if action_id == 'delete':
869
+ # Do delete here
870
+ elif action_id == 'edit':
871
+ # Do edit here
872
+
873
+ Table(
874
+ columns=columns,
875
+ data=data,
876
+ on_action=on_action,
877
+ actions=[
878
+ TableAction(icon_name='trash', label='Delete', id='delete'),
879
+ TableAction(icon_name='pencil', label='Edit', id='edit'),
880
+ ],
881
+ )
882
+ ```
838
883
  :param columns: The table's columns, this can be a list, a Variable/DerivedVariable or if left undefined it will be inferred from the data
839
884
  :param data: The table's data, can be a list of records or a Variable resolving to a list of records
840
885
  :param multi_select: Whether to allow selection of multiple rows, works with onclick_row and defaults to False
841
886
  :param show_checkboxes: Whether to show or hide checkboxes column when onclick_row is set. Defaults to True
842
887
  :param onclick_row: An action handler for when a row is clicked on the table
843
888
  :param onselect_row: An action handler for when a row is selected via the checkbox column
889
+ :param on_action: An action handler for when an action is performed on the table, tied to the actions list
844
890
  :param selected_indices: Optional variable to store the selected rows indices, must be a list of numbers. Note that these indices are
845
891
  the sequential indices of the rows as accepted by `DataFrame.iloc`, not the `row.index` value. If you would like the selection to persist over
846
892
  page reloads, you must use a `BrowserStore` on a `Variable`.
@@ -849,6 +895,8 @@ class Table(ContentComponent):
849
895
  :param include_index: Boolean, if True the table will render the index column(s), defaults to True
850
896
  :param max_rows: if specified, table height will be fixed to accommodate the specified number of rows
851
897
  :param suppress_click_events_for_selection: Whether to suppress click events for clicks in select boxes. Defaults to False
898
+ :param actions: Optional list of actions to display in the table
899
+ :param row_height: Optional row height for the table
852
900
  """
853
901
 
854
902
  model_config = ConfigDict(ser_json_timedelta='float', use_enum_values=True, arbitrary_types_allowed=True)
@@ -859,6 +907,7 @@ class Table(ContentComponent):
859
907
  show_checkboxes: bool = True
860
908
  onclick_row: Action | None = None
861
909
  onselect_row: Action | None = None
910
+ on_action: Action | None = None
862
911
  selected_indices: list[int] | Variable | None = None
863
912
  search_columns: list[str] | None = None
864
913
  searchable: bool = False
@@ -866,6 +915,9 @@ class Table(ContentComponent):
866
915
  max_rows: int | None = None
867
916
  suppress_click_events_for_selection: bool | None = False
868
917
 
918
+ actions: list[TableAction] | None = None
919
+ row_height: int | None = None
920
+
869
921
  TableFormatterType: ClassVar[TFormatterType] = TableFormatterType
870
922
  TableFilter: ClassVar[TFilterType] = TableFilter
871
923
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dara-components
3
- Version: 1.25.0
3
+ Version: 1.25.1
4
4
  Summary: Components for the Dara Framework
5
5
  Home-page: https://dara.causalens.com/
6
6
  License: Apache-2.0
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: bokeh (==3.1.1)
16
16
  Requires-Dist: cai-causal-graph (>=0.3.6)
17
17
  Requires-Dist: certifi (>=2024.7.4)
18
- Requires-Dist: dara-core (==1.25.0)
18
+ Requires-Dist: dara-core (==1.25.1)
19
19
  Requires-Dist: dill (>=0.3.0,<0.4.0)
20
20
  Requires-Dist: matplotlib (>=2.0.0)
21
21
  Requires-Dist: pandas (>=1.1.0,<3.0.0)
@@ -27,7 +27,7 @@ Description-Content-Type: text/markdown
27
27
 
28
28
  # Dara Components
29
29
 
30
- <img src="https://github.com/causalens/dara/blob/v1.25.0/img/dara_light.svg?raw=true">
30
+ <img src="https://github.com/causalens/dara/blob/v1.25.1/img/dara_light.svg?raw=true">
31
31
 
32
32
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
33
33
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -2,7 +2,7 @@ dara/components/__init__.py,sha256=C_FZGdU_DrybumO2aVYEpVmSJ00WnDtVxWjlvv_HRJ8,1
2
2
  dara/components/_assets/__init__.py,sha256=WRWzSRHxObpPhbIJZ1R28PMkNvQeaz_mtcGyCDleUrQ,863
3
3
  dara/components/_assets/auto_js/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  dara/components/_assets/auto_js/dara.components.css,sha256=Qm0_kcxXBDoXvvPTc7YCttkl1zMFifdcp-KufTunPNY,162729
5
- dara/components/_assets/auto_js/dara.components.umd.js,sha256=EzI0B06Pllwd31gUVlHD5OLQ1FDpwSKe7Rn2Qc-68_k,7038969
5
+ dara/components/_assets/auto_js/dara.components.umd.js,sha256=HqUZ57Gi9Zzp997Gwj5qjsg6c6Tj7LgICq27o2ru3ys,7044587
6
6
  dara/components/_assets/common/bokeh-3.1.1.min.js,sha256=MbVmD3ArfHv5QtlTZlkO9QQOXQjGD1BD24RAfo9Cm3k,942380
7
7
  dara/components/_assets/common/bokeh-api-3.1.1.min.js,sha256=mXZVlXj0uhFbxfm1E4g7vSkPABdBFP1ws0FLRTYSZwc,118248
8
8
  dara/components/_assets/common/bokeh-gl-3.1.1.min.js,sha256=XzGw14TvTGCtZsW2mXMD5Ro2fVMkKk380eMyqwQN1rQ,194368
@@ -44,13 +44,13 @@ dara/components/common/overlay.py,sha256=Po-v9oGk6cJlOyRw0JhilBdSSP3eIqd6MhuoB4-
44
44
  dara/components/common/paragraph.py,sha256=nOw-ocgjVwPj_QP8CmSHs2y3ghStTmOPGlqWx2UNMNg,2316
45
45
  dara/components/common/progress_bar.py,sha256=x3k3IZjqwMEKgXWNaBqZIQqe96d8Pgrp84QX9uM5G6U,1873
46
46
  dara/components/common/radio_group.py,sha256=1spV3j-Ut4wVcFXrDnrMiIRx3D38hwqP9PKzHAkoqvg,3667
47
- dara/components/common/select.py,sha256=xBgRrYvz1yuK71JD_GWHSGh_42Wz6Zlv-7e2Rc1AiXg,6711
47
+ dara/components/common/select.py,sha256=rK4gyjgs34MZ-gJ8e0O-nP0Kf9GAIT3hHNtgcLlXuKM,6825
48
48
  dara/components/common/slider.py,sha256=yPvBdNBcUjFTq1mWmUXpd0qohkIC6pbz9hbIFJsZM0E,6433
49
49
  dara/components/common/spacer.py,sha256=foYtnexWIUjFbR4PzW3b8RVXNnf8O065IAxiJrkUc4Y,2664
50
50
  dara/components/common/stack.py,sha256=w_tZ4yil6ffFhLWj6LPeYCpN9MsaqGXchk3Cs4VrTis,5519
51
51
  dara/components/common/switch.py,sha256=hBVUE-IUuqXk8W-73u1WH0t_Koa60nHLJpygE-uSzr8,1510
52
52
  dara/components/common/tabbed_card.py,sha256=WJbsCl2C4rkMEaAWXYdCGo_p7pug3umU0qHcZgftBZI,2307
53
- dara/components/common/table.py,sha256=A-PMzw2-Ri6yS5lwSubyfPa99U-8I1CVJ8MxNh9OAb4,29994
53
+ dara/components/common/table.py,sha256=MrotytNboxXvE8SjVTkZ0ejgp4mPUhIdORyqq8MTZvQ,31664
54
54
  dara/components/common/text.py,sha256=IP8m2lpYkF0UoW4HIgEBCeqvi1wjeR5dO_Ydf03lvM0,1942
55
55
  dara/components/common/textarea.py,sha256=F0rOUHx7kVJM1BTrTq6BFnLUAN8P0OnlyTudvR0B2Qk,2084
56
56
  dara/components/common/time_utils.py,sha256=lB6ncnukBE1-pxz3F7pw0QLGrAiNCCELvBfRI49f-Rc,1717
@@ -93,8 +93,8 @@ dara/components/smart/data_slicer/utils/core.py,sha256=lRONw6kGZRlISvdOIfud9eUVt
93
93
  dara/components/smart/data_slicer/utils/data_preview.py,sha256=-j77RuYWOJNQpZwEgb2iryA42DEgabq1Q8IXHkOUUe8,1697
94
94
  dara/components/smart/data_slicer/utils/plotting.py,sha256=TB00576kbA6y1eRuZBe09UAcZmluY4iJsKmYnXZ3hWQ,3389
95
95
  dara/components/smart/hierarchy.py,sha256=Q05GVG81ykwWdXcol9mqxopIrWwhhvwtT5TRF-A1j98,2871
96
- dara_components-1.25.0.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
97
- dara_components-1.25.0.dist-info/METADATA,sha256=xl_m0Rg51ZEUnjl34bx3TN2sNwTryEeGUenPtolu6HU,2687
98
- dara_components-1.25.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
99
- dara_components-1.25.0.dist-info/entry_points.txt,sha256=QsM8eFLf60NfKyKgE4vstwyaDuuFXgqqgHaLdcsnhnk,70
100
- dara_components-1.25.0.dist-info/RECORD,,
96
+ dara_components-1.25.1.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
97
+ dara_components-1.25.1.dist-info/METADATA,sha256=EVHUR3uOBTLfkd0HrB-WcOa5ssTxeMtxutdKWfatNEg,2687
98
+ dara_components-1.25.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
99
+ dara_components-1.25.1.dist-info/entry_points.txt,sha256=QsM8eFLf60NfKyKgE4vstwyaDuuFXgqqgHaLdcsnhnk,70
100
+ dara_components-1.25.1.dist-info/RECORD,,