reflex-components-dataeditor 0.9.0a1__tar.gz → 0.9.0a2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex-components-dataeditor
3
- Version: 0.9.0a1
3
+ Version: 0.9.0a2
4
4
  Summary: Reflex dataeditor components.
5
5
  Author-email: Khaleel Al-Adhami <khaleel@reflex.dev>
6
6
  Maintainer-email: Khaleel Al-Adhami <khaleel@reflex.dev>
@@ -14,7 +14,7 @@ from reflex_base.utils import console, format, types
14
14
  from reflex_base.utils.imports import ImportDict, ImportVar
15
15
  from reflex_base.utils.serializers import serializer
16
16
  from reflex_base.vars import get_unique_variable_name
17
- from reflex_base.vars.base import Var
17
+ from reflex_base.vars.base import Var, VarData
18
18
  from reflex_base.vars.function import FunctionStringVar
19
19
  from reflex_base.vars.sequence import ArrayVar
20
20
 
@@ -395,6 +395,9 @@ class DataEditor(NoSSRComponent):
395
395
  doc="Fired when the search close button is clicked."
396
396
  )
397
397
 
398
+ # Custom cell renderers
399
+ custom_renderers: Var[Any]
400
+
398
401
  def add_imports(self) -> ImportDict:
399
402
  """Add imports for the component.
400
403
 
@@ -489,11 +492,12 @@ class DataEditor(NoSSRComponent):
489
492
  return ["\n".join(code)]
490
493
 
491
494
  @classmethod
492
- def create(cls, *children, **props) -> Component:
495
+ def create(cls, *children, extended_cell_types: bool = False, **props) -> Component:
493
496
  """Create the DataEditor component.
494
497
 
495
498
  Args:
496
499
  *children: The children of the data editor.
500
+ extended_cell_types: Whether to enable extended cell types.
497
501
  **props: The props of the data editor.
498
502
 
499
503
  Returns:
@@ -550,6 +554,18 @@ class DataEditor(NoSSRComponent):
550
554
  "reconstructGridSelection"
551
555
  ).call(grid_selection)
552
556
 
557
+ if extended_cell_types:
558
+ props["custom_renderers"] = Var(
559
+ "allCells",
560
+ _var_data=VarData(
561
+ imports={
562
+ "@glideapps/glide-data-grid-cells@6.0.3": ImportVar(
563
+ tag="allCells", is_default=False
564
+ )
565
+ }
566
+ ),
567
+ )
568
+
553
569
  grid = super().create(*children, **props)
554
570
  return Div.create(
555
571
  grid,
@@ -137,6 +137,7 @@ class DataEditor(NoSSRComponent):
137
137
  def create(
138
138
  cls,
139
139
  *children,
140
+ extended_cell_types: bool | None = False,
140
141
  rows: Var[int] | int | None = None,
141
142
  columns: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
142
143
  data: Sequence[Sequence[Any]] | Var[Sequence[Sequence[Any]]] | None = None,
@@ -205,6 +206,7 @@ class DataEditor(NoSSRComponent):
205
206
  theme: DataEditorTheme | Var[DataEditorTheme | dict] | dict | None = None,
206
207
  grid_selection: GridSelection | Var[GridSelection] | None = None,
207
208
  show_search: Var[bool] | bool | None = None,
209
+ custom_renderers: Any | Var[Any] | None = None,
208
210
  style: Sequence[Mapping[str, Any]]
209
211
  | Mapping[str, Any]
210
212
  | Var[Mapping[str, Any]]
@@ -214,51 +216,26 @@ class DataEditor(NoSSRComponent):
214
216
  id: Any | None = None,
215
217
  ref: Var | None = None,
216
218
  class_name: Any | None = None,
217
- custom_attrs: dict[str, Var | Any] | None = None,
219
+ custom_attrs: dict[str, Any | Var] | None = None,
218
220
  on_blur: EventType[()] | None = None,
219
221
  on_cell_activated: EventType[()] | EventType[tuple[int, int]] | None = None,
220
222
  on_cell_clicked: EventType[()] | EventType[tuple[int, int]] | None = None,
221
223
  on_cell_context_menu: EventType[()] | EventType[tuple[int, int]] | None = None,
222
- on_cell_edited: EventType[()]
223
- | EventType[tuple[int, int]]
224
- | EventType[tuple[int, int], GridCell]
225
- | None = None,
224
+ on_cell_edited: EventType[()] | EventType[tuple[int, int]] | EventType[tuple[int, int], GridCell] | None = None,
226
225
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
227
- on_column_resize: EventType[()]
228
- | EventType[GridColumn]
229
- | EventType[GridColumn, int]
230
- | None = None,
226
+ on_column_resize: EventType[()] | EventType[GridColumn] | EventType[GridColumn, int] | None = None,
231
227
  on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
232
228
  on_delete: EventType[()] | EventType[GridSelection] | None = None,
233
229
  on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
234
- on_finished_editing: EventType[()]
235
- | EventType[GridCell | None]
236
- | EventType[GridCell | None, tuple[int, int]]
237
- | None = None,
230
+ on_finished_editing: EventType[()] | EventType[GridCell | None] | EventType[GridCell | None, tuple[int, int]] | None = None,
238
231
  on_focus: EventType[()] | None = None,
239
- on_grid_selection_change: EventType[()]
240
- | EventType[GridSelection]
241
- | None = None,
242
- on_group_header_clicked: EventType[()]
243
- | EventType[tuple[int, int]]
244
- | EventType[tuple[int, int], GridCell]
245
- | None = None,
246
- on_group_header_context_menu: EventType[()]
247
- | EventType[int]
248
- | EventType[int, GroupHeaderClickedEventArgs]
249
- | None = None,
250
- on_group_header_renamed: EventType[()]
251
- | EventType[str]
252
- | EventType[str, str]
253
- | None = None,
232
+ on_grid_selection_change: EventType[()] | EventType[GridSelection] | None = None,
233
+ on_group_header_clicked: EventType[()] | EventType[tuple[int, int]] | EventType[tuple[int, int], GridCell] | None = None,
234
+ on_group_header_context_menu: EventType[()] | EventType[int] | EventType[int, GroupHeaderClickedEventArgs] | None = None,
235
+ on_group_header_renamed: EventType[()] | EventType[str] | EventType[str, str] | None = None,
254
236
  on_header_clicked: EventType[()] | EventType[tuple[int, int]] | None = None,
255
- on_header_context_menu: EventType[()]
256
- | EventType[tuple[int, int]]
257
- | None = None,
258
- on_header_menu_click: EventType[()]
259
- | EventType[int]
260
- | EventType[int, Rectangle]
261
- | None = None,
237
+ on_header_context_menu: EventType[()] | EventType[tuple[int, int]] | None = None,
238
+ on_header_menu_click: EventType[()] | EventType[int] | EventType[int, Rectangle] | None = None,
262
239
  on_item_hovered: EventType[()] | EventType[tuple[int, int]] | None = None,
263
240
  on_mount: EventType[()] | None = None,
264
241
  on_mouse_down: EventType[()] | None = None,
@@ -279,14 +256,95 @@ class DataEditor(NoSSRComponent):
279
256
  """Create the DataEditor component.
280
257
 
281
258
  Args:
282
- *children: The children of the data editor.
283
- **props: The props of the data editor.
259
+ *children: The children of the data editor.
260
+ extended_cell_types: Whether to enable extended cell types.
261
+ rows: Number of rows.
262
+ columns: Headers of the columns for the data grid.
263
+ data: The data.
264
+ get_cell_content: The name of the callback used to find the data to display.
265
+ get_cells_for_selection: Allow selection for copying.
266
+ on_paste: Allow paste.
267
+ draw_focus_ring: Controls the drawing of the focus ring.
268
+ fixed_shadow_x: Enables or disables the overlay shadow when scrolling horizontally.
269
+ fixed_shadow_y: Enables or disables the overlay shadow when scrolling vertically.
270
+ fill_handle: Controls the presence of the fill indicator
271
+ freeze_columns: The number of columns which should remain in place when scrolling horizontally. Doesn't include rowMarkers.
272
+ group_header_height: Controls the header of the group header row.
273
+ header_height: Controls the height of the header row.
274
+ max_column_auto_width: The maximum width a column can be automatically sized to.
275
+ max_column_width: The maximum width a column can be resized to.
276
+ min_column_width: The minimum width a column can be resized to.
277
+ row_height: Determines the height of each row.
278
+ row_markers: Kind of row markers. Options are: "none", "number", "checkbox", "both", "checkbox-visible", "clickable-number".
279
+ row_marker_start_index: Changes the starting index for row markers.
280
+ row_marker_width: Sets the width of row markers in pixels, if unset row markers will automatically size.
281
+ smooth_scroll_x: Enable horizontal smooth scrolling.
282
+ smooth_scroll_y: Enable vertical smooth scrolling.
283
+ vertical_border: Controls the drawing of the left hand vertical border of a column. If set to a boolean value it controls all borders.
284
+ column_select: Allow columns selections. ("none", "single", "multi")
285
+ range_select: Allow range selections. ("none", "cell", "rect", "multi-cell", "multi-rect").
286
+ row_select: Allow row selections. ("none", "single", "multi").
287
+ prevent_diagonal_scrolling: Prevent diagonal scrolling.
288
+ overscroll_x: Allow to scroll past the limit of the actual content on the horizontal axis.
289
+ overscroll_y: Allow to scroll past the limit of the actual content on the vertical axis.
290
+ scroll_offset_x: Initial scroll offset on the horizontal axis.
291
+ scroll_offset_y: Initial scroll offset on the vertical axis.
292
+ range_selection_blending: Controls which types of range selections can exist at the same time. ("exclusive", "mixed").
293
+ column_selection_blending: Controls which types of column selections can exist at the same time. ("exclusive", "mixed").
294
+ row_selection_blending: Controls which types of row selections can exist at the same time. ("exclusive", "mixed").
295
+ row_selection_mode: Controls row marker selection behavior. "auto" adapts to touch/mouse, "multi" acts as if Ctrl is pressed. ("auto", "multi").
296
+ span_range_behavior: Controls how spans are handled in selections. ("default", "allowPartial").
297
+ theme: global theme
298
+ grid_selection: The current grid selection state (columns, rows, and current cell/range). Must be used when on_grid_selection_change is used otherwise updates will not be reflected in the grid.
299
+ show_search: Shows search bar.
300
+ custom_renderers: Custom cell renderers
301
+ style: The style of the component.
302
+ key: A unique key for the component.
303
+ id: The id for the component.
304
+ ref: The Var to pass as the ref to the component.
305
+ class_name: The class name for the component.
306
+ custom_attrs: Attributes passed directly to the component.
307
+ on_focus: Fired when the element (or some element inside of it) receives focus. For example, it is called when the user clicks on a text input.
308
+ on_blur: Fired when focus has left the element (or left some element inside of it). For example, it is called when the user clicks outside of a focused text input.
309
+ on_click: Fired when the user clicks on an element. For example, it's called when the user clicks on a button.
310
+ on_context_menu: Fired when the user right-clicks on an element.
311
+ on_double_click: Fired when the user double-clicks on an element.
312
+ on_mouse_down: Fired when the user presses a mouse button on an element.
313
+ on_mouse_enter: Fired when the mouse pointer enters the element.
314
+ on_mouse_leave: Fired when the mouse pointer leaves the element.
315
+ on_mouse_move: Fired when the mouse pointer moves over the element.
316
+ on_mouse_out: Fired when the mouse pointer moves out of the element.
317
+ on_mouse_over: Fired when the mouse pointer moves onto the element.
318
+ on_mouse_up: Fired when the user releases a mouse button on an element.
319
+ on_scroll: Fired when the user scrolls the element.
320
+ on_scroll_end: Fired when scrolling ends on the element.
321
+ on_mount: Fired when the component is mounted to the page.
322
+ on_unmount: Fired when the component is removed from the page. Only called during navigation, not on page refresh.
323
+ on_cell_activated: Fired when a cell is activated.
324
+ on_cell_clicked: Fired when a cell is clicked.
325
+ on_cell_context_menu: Fired when a cell is right-clicked.
326
+ on_cell_edited: Fired when a cell is edited.
327
+ on_group_header_clicked: Fired when a group header is clicked.
328
+ on_group_header_context_menu: Fired when a group header is right-clicked.
329
+ on_group_header_renamed: Fired when a group header is renamed.
330
+ on_header_clicked: Fired when a header is clicked.
331
+ on_header_context_menu: Fired when a header is right-clicked.
332
+ on_header_menu_click: Fired when a header menu item is clicked.
333
+ on_item_hovered: Fired when an item is hovered.
334
+ on_delete: Fired when a selection is deleted.
335
+ on_finished_editing: Fired when editing is finished.
336
+ on_row_appended: Fired when a row is appended.
337
+ on_grid_selection_change: Fired when the grid selection changes. Will pass the current selection, the selected columns and the selected rows.
338
+ on_selection_cleared: Fired when the selection is cleared.
339
+ on_column_resize: Fired when a column is resized.
340
+ on_search_close: Fired when the search close button is clicked.
341
+ **props: The props of the data editor.
284
342
 
285
343
  Returns:
286
- The DataEditor component.&
344
+ The DataEditor component.&
287
345
 
288
346
  Raises:
289
- ValueError: invalid input.
347
+ ValueError: invalid input.
290
348
  """
291
349
 
292
350
  @serializer