From ff3f9ff6bc2370368daf7363860116bb63590b9c Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Wed, 25 Oct 2023 15:11:35 +0200 Subject: [PATCH] Update docs and remove comments --- vizro-core/docs/pages/user_guides/table.md | 8 +++++++ .../src/vizro/managers/_model_manager.py | 2 -- .../models/_components/_components_utils.py | 2 -- vizro-core/src/vizro/models/types.py | 22 ++++++++++++------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/vizro-core/docs/pages/user_guides/table.md b/vizro-core/docs/pages/user_guides/table.md index 4dd6420af..0026d3bc4 100755 --- a/vizro-core/docs/pages/user_guides/table.md +++ b/vizro-core/docs/pages/user_guides/table.md @@ -70,3 +70,11 @@ All other [parameters of the Dash DataTable](https://dash.plotly.com/datatable/r [![Table]][Table] [Table]: ../../assets/user_guides/table/table.png + +#### Styling/Modifying the Dash DataTable + +Lorem ipsum + +#### Custom Table + +Lorem Ispum diff --git a/vizro-core/src/vizro/managers/_model_manager.py b/vizro-core/src/vizro/managers/_model_manager.py index 8dd1ac2a7..cc1b9984d 100644 --- a/vizro-core/src/vizro/managers/_model_manager.py +++ b/vizro-core/src/vizro/managers/_model_manager.py @@ -12,9 +12,7 @@ rd = random.Random(0) -# Type used for model_manager IDs ModelID = NewType("ModelID", str) - Model = TypeVar("Model", bound="VizroBaseModel") diff --git a/vizro-core/src/vizro/models/_components/_components_utils.py b/vizro-core/src/vizro/models/_components/_components_utils.py index 75c559ab1..8723d2664 100644 --- a/vizro-core/src/vizro/models/_components/_components_utils.py +++ b/vizro-core/src/vizro/models/_components/_components_utils.py @@ -4,8 +4,6 @@ logger = logging.getLogger(__name__) - -# Validator for reuse in other models to validate pages def _process_callable_data_frame(captured_callable, values): data_frame = captured_callable["data_frame"] diff --git a/vizro-core/src/vizro/models/types.py b/vizro-core/src/vizro/models/types.py index f15522c12..5e204e66d 100644 --- a/vizro-core/src/vizro/models/types.py +++ b/vizro-core/src/vizro/models/types.py @@ -30,10 +30,11 @@ class CapturedCallable: `functools.partial`. Ready-to-use `CapturedCallable` instances are provided by Vizro. In this case refer to the user guide on - [Charts/Graph][graph] or [Actions][pre-defined-actions] to see available choices. + [Charts/Graph][graph], [Table][table] or [Actions][pre-defined-actions] to see available choices. (Advanced) In case you would like to create your own `CapturedCallable`, please refer to the user guide on - [custom charts](../user_guides/custom_charts.md) or [custom actions][custom-actions]. + [custom charts](../user_guides/custom_charts.md), [custom tables][custom-table] or + [custom actions][custom-actions]. """ def __init__(self, function, /, *args, **kwargs): @@ -152,12 +153,16 @@ class capture: """Captures a function call to create a [`CapturedCallable`][vizro.models.types.CapturedCallable]. This is used to add the functionality required to make graphs and actions work in a dashboard. - Typically it should be used as a function decorator. There are two possible modes: `"graph"` and `"action"`. + Typically it should be used as a function decorator. There are three possible modes: `"graph"`, `"table"` and + `"action"`. Examples: >>> @capture("graph") >>> def plot_function(): >>> ... + >>> @capture("table") + >>> def plot_function(): + >>> ... >>> @capture("action") >>> def action_function(): >>> ... @@ -167,14 +172,15 @@ class capture: """ def __init__(self, mode: Literal["graph", "action", "table"]): - """Instantiates the decorator to capture a function call. Valid modes are "graph" and "action".""" + """Instantiates the decorator to capture a function call. Valid modes are "graph", "table" and "action".""" self._mode = mode def __call__(self, func, /): """Produces a CapturedCallable or _DashboardReadyFigure. - mode="action" gives a CapturedCallable, while mode="graph" gives a _DashboardReadyFigure that contains a - CapturedCallable. In both cases, the CapturedCallable is based on func and the provided *args and **kwargs. + mode="action" and mode="table" give a CapturedCallable, while mode="graph" gives a _DashboardReadyFigure that + contains a CapturedCallable. In both cases, the CapturedCallable is based on func and the provided + *args and **kwargs. """ if self._mode == "graph": # The more difficult case, where we need to still have a valid plotly figure that renders in a notebook. @@ -219,7 +225,6 @@ def wrapped(*args, **kwargs): return wrapped elif self._mode == "table": - @functools.wraps(func) def wrapped(*args, **kwargs): if "data_frame" not in inspect.signature(func).parameters: @@ -294,7 +299,8 @@ class OptionsDictType(TypedDict): ), ] """Discriminated union. Type of component that makes up part of the layout on the page: -[`Button`][vizro.models.Button], [`Card`][vizro.models.Card] or [`Graph`][vizro.models.Graph].""" +[`Button`][vizro.models.Button], [`Card`][vizro.models.Card], [`Table`][vizro.models.Table] or +[`Graph`][vizro.models.Graph].""" # Types used for pages values in the Navigation model. NavigationPagesType = Annotated[