|
14 | 14 | from reflex.utils.imports import ImportDict, ImportVar |
15 | 15 | from reflex.utils.serializers import serializer |
16 | 16 | from reflex.vars import get_unique_variable_name |
17 | | -from reflex.vars.base import Var |
| 17 | +from reflex.vars.base import Var, VarData |
18 | 18 | from reflex.vars.function import FunctionStringVar |
19 | 19 | from reflex.vars.sequence import ArrayVar |
20 | 20 |
|
@@ -184,7 +184,6 @@ class DataEditor(NoSSRComponent): |
184 | 184 | lib_dependencies: list[str] = [ |
185 | 185 | "lodash@4.17.21", |
186 | 186 | "react-responsive-carousel@3.2.23", |
187 | | - "@glideapps/glide-data-grid-cells@6.0.3", |
188 | 187 | ] |
189 | 188 |
|
190 | 189 | # Number of rows. |
@@ -368,7 +367,7 @@ class DataEditor(NoSSRComponent): |
368 | 367 | on_search_close: EventHandler[no_args_event_spec] |
369 | 368 |
|
370 | 369 | # Custom cell renderers |
371 | | - custom_renderers: Var[Any] = Var(_js_expr="allCells") |
| 370 | + custom_renderers: Var[Any] |
372 | 371 |
|
373 | 372 | def add_imports(self) -> ImportDict: |
374 | 373 | """Add imports for the component. |
@@ -398,9 +397,6 @@ def add_custom_code(self) -> list[str]: |
398 | 397 | """ |
399 | 398 | return [ |
400 | 399 | """ |
401 | | - import * as AllCells from "@glideapps/glide-data-grid-cells"; |
402 | | - const allCells = Object.values(AllCells).filter(x => x?.isMatch); |
403 | | -
|
404 | 400 | function reconstructGridSelection(selection) { |
405 | 401 | if (!selection || typeof selection !== 'object') { |
406 | 402 | return undefined; |
@@ -528,6 +524,18 @@ def create(cls, *children, **props) -> Component: |
528 | 524 | "reconstructGridSelection" |
529 | 525 | ).call(grid_selection) |
530 | 526 |
|
| 527 | + if props.get("extended_cell_types") is not None: |
| 528 | + props["custom_renderers"] = Var( |
| 529 | + "allCells", |
| 530 | + _var_data=VarData( |
| 531 | + imports={ |
| 532 | + "@glideapps/glide-data-grid-cells@6.0.3": ImportVar( |
| 533 | + tag="allCells", is_default=False |
| 534 | + ) |
| 535 | + } |
| 536 | + ), |
| 537 | + ) |
| 538 | + |
531 | 539 | grid = super().create(*children, **props) |
532 | 540 | return Div.create( |
533 | 541 | grid, |
|
0 commit comments