From a7a2a6ddbfc3301c91618a5cc75316781c270f9b Mon Sep 17 00:00:00 2001 From: Martin Turoci Date: Tue, 5 Sep 2023 10:24:55 +0200 Subject: [PATCH 1/3] feat: Plot and card animations. --- py/examples/tour.py | 1 + py/h2o_lightwave/h2o_lightwave/types.py | 30 ++++++++++++ py/h2o_lightwave/h2o_lightwave/ui.py | 9 ++++ py/h2o_wave/h2o_wave/types.py | 30 ++++++++++++ py/h2o_wave/h2o_wave/ui.py | 9 ++++ r/R/ui.R | 16 ++++++- .../resources/templates/wave-components.xml | 9 ++-- .../vscode-extension/component-snippets.json | 6 +-- ui/src/footer.tsx | 2 +- ui/src/header.tsx | 2 +- ui/src/index.scss | 23 ++++++++- ui/src/layout.tsx | 5 +- ui/src/meta.tsx | 9 ++-- ui/src/nav.tsx | 2 +- ui/src/plot.tsx | 47 +++++++++---------- 15 files changed, 158 insertions(+), 42 deletions(-) diff --git a/py/examples/tour.py b/py/examples/tour.py index ef4f99168f..ff683c13ec 100644 --- a/py/examples/tour.py +++ b/py/examples/tour.py @@ -233,6 +233,7 @@ def get_wave_completions(line, character, file_content): q.page['meta'] = ui.meta_card( box='', title=app_title, + animate=True, scripts=[ui.script(q.app.tour_assets + '/loader.min.js')], script=ui.inline_script(content=template, requires=['require'], targets=['monaco-editor']), layouts=[ diff --git a/py/h2o_lightwave/h2o_lightwave/types.py b/py/h2o_lightwave/h2o_lightwave/types.py index b98d6be9b7..92100ecd3c 100644 --- a/py/h2o_lightwave/h2o_lightwave/types.py +++ b/py/h2o_lightwave/h2o_lightwave/types.py @@ -5626,6 +5626,7 @@ def __init__( visible: Optional[bool] = None, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, ): _guard_scalar('Visualization.plot', plot, (Plot,), False, False, False) _guard_scalar('Visualization.width', width, (str,), False, True, False) @@ -5634,6 +5635,7 @@ def __init__( _guard_scalar('Visualization.visible', visible, (bool,), False, True, False) _guard_vector('Visualization.events', events, (str,), False, True, False) _guard_vector('Visualization.interactions', interactions, (str,), False, True, False) + _guard_scalar('Visualization.animate', animate, (bool,), False, True, False) self.plot = plot """The plot to be rendered in this visualization.""" self.data = data @@ -5650,6 +5652,8 @@ def __init__( """The events to capture on this visualization. One of 'select_marks'.""" self.interactions = interactions """The interactions to be allowed for this plot. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.""" + self.animate = animate + """True to turn on the chart animations. Defaults to False.""" def dump(self) -> Dict: """Returns the contents of this object as a dict.""" @@ -5660,6 +5664,7 @@ def dump(self) -> Dict: _guard_scalar('Visualization.visible', self.visible, (bool,), False, True, False) _guard_vector('Visualization.events', self.events, (str,), False, True, False) _guard_vector('Visualization.interactions', self.interactions, (str,), False, True, False) + _guard_scalar('Visualization.animate', self.animate, (bool,), False, True, False) return _dump( plot=self.plot.dump(), data=self.data, @@ -5669,6 +5674,7 @@ def dump(self) -> Dict: visible=self.visible, events=self.events, interactions=self.interactions, + animate=self.animate, ) @staticmethod @@ -5689,6 +5695,8 @@ def load(__d: Dict) -> 'Visualization': _guard_vector('Visualization.events', __d_events, (str,), False, True, False) __d_interactions: Any = __d.get('interactions') _guard_vector('Visualization.interactions', __d_interactions, (str,), False, True, False) + __d_animate: Any = __d.get('animate') + _guard_scalar('Visualization.animate', __d_animate, (bool,), False, True, False) plot: Plot = Plot.load(__d_plot) data: PackedRecord = __d_data width: Optional[str] = __d_width @@ -5697,6 +5705,7 @@ def load(__d: Dict) -> 'Visualization': visible: Optional[bool] = __d_visible events: Optional[List[str]] = __d_events interactions: Optional[List[str]] = __d_interactions + animate: Optional[bool] = __d_animate return Visualization( plot, data, @@ -5706,6 +5715,7 @@ def load(__d: Dict) -> 'Visualization': visible, events, interactions, + animate, ) @@ -10620,6 +10630,7 @@ def __init__( script: Optional[InlineScript] = None, stylesheet: Optional[InlineStylesheet] = None, stylesheets: Optional[List[Stylesheet]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ): _guard_scalar('MetaCard.box', box, (str,), False, False, False) @@ -10639,6 +10650,7 @@ def __init__( _guard_scalar('MetaCard.script', script, (InlineScript,), False, True, False) _guard_scalar('MetaCard.stylesheet', stylesheet, (InlineStylesheet,), False, True, False) _guard_vector('MetaCard.stylesheets', stylesheets, (Stylesheet,), False, True, False) + _guard_scalar('MetaCard.animate', animate, (bool,), False, True, False) _guard_vector('MetaCard.commands', commands, (Command,), False, True, False) self.box = box """A string indicating how to place this component on the page.""" @@ -10674,6 +10686,8 @@ def __init__( """CSS stylesheet to be applied to this page.""" self.stylesheets = stylesheets """External CSS files to load into the page.""" + self.animate = animate + """True to turn on the card animations. Defaults to False.""" self.commands = commands """Contextual menu commands for this component.""" @@ -10696,6 +10710,7 @@ def dump(self) -> Dict: _guard_scalar('MetaCard.script', self.script, (InlineScript,), False, True, False) _guard_scalar('MetaCard.stylesheet', self.stylesheet, (InlineStylesheet,), False, True, False) _guard_vector('MetaCard.stylesheets', self.stylesheets, (Stylesheet,), False, True, False) + _guard_scalar('MetaCard.animate', self.animate, (bool,), False, True, False) _guard_vector('MetaCard.commands', self.commands, (Command,), False, True, False) return _dump( view='meta', @@ -10716,6 +10731,7 @@ def dump(self) -> Dict: script=None if self.script is None else self.script.dump(), stylesheet=None if self.stylesheet is None else self.stylesheet.dump(), stylesheets=None if self.stylesheets is None else [__e.dump() for __e in self.stylesheets], + animate=self.animate, commands=None if self.commands is None else [__e.dump() for __e in self.commands], ) @@ -10756,6 +10772,8 @@ def load(__d: Dict) -> 'MetaCard': _guard_scalar('MetaCard.stylesheet', __d_stylesheet, (dict,), False, True, False) __d_stylesheets: Any = __d.get('stylesheets') _guard_vector('MetaCard.stylesheets', __d_stylesheets, (dict,), False, True, False) + __d_animate: Any = __d.get('animate') + _guard_scalar('MetaCard.animate', __d_animate, (bool,), False, True, False) __d_commands: Any = __d.get('commands') _guard_vector('MetaCard.commands', __d_commands, (dict,), False, True, False) box: str = __d_box @@ -10775,6 +10793,7 @@ def load(__d: Dict) -> 'MetaCard': script: Optional[InlineScript] = None if __d_script is None else InlineScript.load(__d_script) stylesheet: Optional[InlineStylesheet] = None if __d_stylesheet is None else InlineStylesheet.load(__d_stylesheet) stylesheets: Optional[List[Stylesheet]] = None if __d_stylesheets is None else [Stylesheet.load(__e) for __e in __d_stylesheets] + animate: Optional[bool] = __d_animate commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands] return MetaCard( box, @@ -10794,6 +10813,7 @@ def load(__d: Dict) -> 'MetaCard': script, stylesheet, stylesheets, + animate, commands, ) @@ -11017,6 +11037,7 @@ def __init__( plot: Plot, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ): _guard_scalar('PlotCard.box', box, (str,), False, False, False) @@ -11024,6 +11045,7 @@ def __init__( _guard_scalar('PlotCard.plot', plot, (Plot,), False, False, False) _guard_vector('PlotCard.events', events, (str,), False, True, False) _guard_vector('PlotCard.interactions', interactions, (str,), False, True, False) + _guard_scalar('PlotCard.animate', animate, (bool,), False, True, False) _guard_vector('PlotCard.commands', commands, (Command,), False, True, False) self.box = box """A string indicating how to place this component on the page.""" @@ -11037,6 +11059,8 @@ def __init__( """The events to capture on this card. One of 'select_marks'.""" self.interactions = interactions """The interactions to be allowed for this card. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.""" + self.animate = animate + """True to turn on the chart animations. Defaults to False.""" self.commands = commands """Contextual menu commands for this component.""" @@ -11047,6 +11071,7 @@ def dump(self) -> Dict: _guard_scalar('PlotCard.plot', self.plot, (Plot,), False, False, False) _guard_vector('PlotCard.events', self.events, (str,), False, True, False) _guard_vector('PlotCard.interactions', self.interactions, (str,), False, True, False) + _guard_scalar('PlotCard.animate', self.animate, (bool,), False, True, False) _guard_vector('PlotCard.commands', self.commands, (Command,), False, True, False) return _dump( view='plot', @@ -11056,6 +11081,7 @@ def dump(self) -> Dict: plot=self.plot.dump(), events=self.events, interactions=self.interactions, + animate=self.animate, commands=None if self.commands is None else [__e.dump() for __e in self.commands], ) @@ -11073,6 +11099,8 @@ def load(__d: Dict) -> 'PlotCard': _guard_vector('PlotCard.events', __d_events, (str,), False, True, False) __d_interactions: Any = __d.get('interactions') _guard_vector('PlotCard.interactions', __d_interactions, (str,), False, True, False) + __d_animate: Any = __d.get('animate') + _guard_scalar('PlotCard.animate', __d_animate, (bool,), False, True, False) __d_commands: Any = __d.get('commands') _guard_vector('PlotCard.commands', __d_commands, (dict,), False, True, False) box: str = __d_box @@ -11081,6 +11109,7 @@ def load(__d: Dict) -> 'PlotCard': plot: Plot = Plot.load(__d_plot) events: Optional[List[str]] = __d_events interactions: Optional[List[str]] = __d_interactions + animate: Optional[bool] = __d_animate commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands] return PlotCard( box, @@ -11089,6 +11118,7 @@ def load(__d: Dict) -> 'PlotCard': plot, events, interactions, + animate, commands, ) diff --git a/py/h2o_lightwave/h2o_lightwave/ui.py b/py/h2o_lightwave/h2o_lightwave/ui.py index f0457c546c..c9e7f37dc4 100644 --- a/py/h2o_lightwave/h2o_lightwave/ui.py +++ b/py/h2o_lightwave/h2o_lightwave/ui.py @@ -2087,6 +2087,7 @@ def visualization( visible: Optional[bool] = None, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, ) -> Component: """Create a visualization for display inside a form. @@ -2099,6 +2100,7 @@ def visualization( visible: True if the component should be visible. Defaults to True. events: The events to capture on this visualization. One of 'select_marks'. interactions: The interactions to be allowed for this plot. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event. + animate: True to turn on the chart animations. Defaults to False. Returns: A `h2o_wave.types.Visualization` instance. """ @@ -2111,6 +2113,7 @@ def visualization( visible, events, interactions, + animate, )) @@ -3770,6 +3773,7 @@ def meta_card( script: Optional[InlineScript] = None, stylesheet: Optional[InlineStylesheet] = None, stylesheets: Optional[List[Stylesheet]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ) -> MetaCard: """Represents page-global state. @@ -3795,6 +3799,7 @@ def meta_card( script: Javascript code to execute on this page. stylesheet: CSS stylesheet to be applied to this page. stylesheets: External CSS files to load into the page. + animate: True to turn on the card animations. Defaults to False. commands: Contextual menu commands for this component. Returns: A `h2o_wave.types.MetaCard` instance. @@ -3817,6 +3822,7 @@ def meta_card( script, stylesheet, stylesheets, + animate, commands, ) @@ -3903,6 +3909,7 @@ def plot_card( plot: Plot, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ) -> PlotCard: """Create a card displaying a plot. @@ -3914,6 +3921,7 @@ def plot_card( plot: The plot to be displayed in this card. events: The events to capture on this card. One of 'select_marks'. interactions: The interactions to be allowed for this card. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event. + animate: True to turn on the chart animations. Defaults to False. commands: Contextual menu commands for this component. Returns: A `h2o_wave.types.PlotCard` instance. @@ -3925,6 +3933,7 @@ def plot_card( plot, events, interactions, + animate, commands, ) diff --git a/py/h2o_wave/h2o_wave/types.py b/py/h2o_wave/h2o_wave/types.py index b98d6be9b7..92100ecd3c 100644 --- a/py/h2o_wave/h2o_wave/types.py +++ b/py/h2o_wave/h2o_wave/types.py @@ -5626,6 +5626,7 @@ def __init__( visible: Optional[bool] = None, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, ): _guard_scalar('Visualization.plot', plot, (Plot,), False, False, False) _guard_scalar('Visualization.width', width, (str,), False, True, False) @@ -5634,6 +5635,7 @@ def __init__( _guard_scalar('Visualization.visible', visible, (bool,), False, True, False) _guard_vector('Visualization.events', events, (str,), False, True, False) _guard_vector('Visualization.interactions', interactions, (str,), False, True, False) + _guard_scalar('Visualization.animate', animate, (bool,), False, True, False) self.plot = plot """The plot to be rendered in this visualization.""" self.data = data @@ -5650,6 +5652,8 @@ def __init__( """The events to capture on this visualization. One of 'select_marks'.""" self.interactions = interactions """The interactions to be allowed for this plot. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.""" + self.animate = animate + """True to turn on the chart animations. Defaults to False.""" def dump(self) -> Dict: """Returns the contents of this object as a dict.""" @@ -5660,6 +5664,7 @@ def dump(self) -> Dict: _guard_scalar('Visualization.visible', self.visible, (bool,), False, True, False) _guard_vector('Visualization.events', self.events, (str,), False, True, False) _guard_vector('Visualization.interactions', self.interactions, (str,), False, True, False) + _guard_scalar('Visualization.animate', self.animate, (bool,), False, True, False) return _dump( plot=self.plot.dump(), data=self.data, @@ -5669,6 +5674,7 @@ def dump(self) -> Dict: visible=self.visible, events=self.events, interactions=self.interactions, + animate=self.animate, ) @staticmethod @@ -5689,6 +5695,8 @@ def load(__d: Dict) -> 'Visualization': _guard_vector('Visualization.events', __d_events, (str,), False, True, False) __d_interactions: Any = __d.get('interactions') _guard_vector('Visualization.interactions', __d_interactions, (str,), False, True, False) + __d_animate: Any = __d.get('animate') + _guard_scalar('Visualization.animate', __d_animate, (bool,), False, True, False) plot: Plot = Plot.load(__d_plot) data: PackedRecord = __d_data width: Optional[str] = __d_width @@ -5697,6 +5705,7 @@ def load(__d: Dict) -> 'Visualization': visible: Optional[bool] = __d_visible events: Optional[List[str]] = __d_events interactions: Optional[List[str]] = __d_interactions + animate: Optional[bool] = __d_animate return Visualization( plot, data, @@ -5706,6 +5715,7 @@ def load(__d: Dict) -> 'Visualization': visible, events, interactions, + animate, ) @@ -10620,6 +10630,7 @@ def __init__( script: Optional[InlineScript] = None, stylesheet: Optional[InlineStylesheet] = None, stylesheets: Optional[List[Stylesheet]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ): _guard_scalar('MetaCard.box', box, (str,), False, False, False) @@ -10639,6 +10650,7 @@ def __init__( _guard_scalar('MetaCard.script', script, (InlineScript,), False, True, False) _guard_scalar('MetaCard.stylesheet', stylesheet, (InlineStylesheet,), False, True, False) _guard_vector('MetaCard.stylesheets', stylesheets, (Stylesheet,), False, True, False) + _guard_scalar('MetaCard.animate', animate, (bool,), False, True, False) _guard_vector('MetaCard.commands', commands, (Command,), False, True, False) self.box = box """A string indicating how to place this component on the page.""" @@ -10674,6 +10686,8 @@ def __init__( """CSS stylesheet to be applied to this page.""" self.stylesheets = stylesheets """External CSS files to load into the page.""" + self.animate = animate + """True to turn on the card animations. Defaults to False.""" self.commands = commands """Contextual menu commands for this component.""" @@ -10696,6 +10710,7 @@ def dump(self) -> Dict: _guard_scalar('MetaCard.script', self.script, (InlineScript,), False, True, False) _guard_scalar('MetaCard.stylesheet', self.stylesheet, (InlineStylesheet,), False, True, False) _guard_vector('MetaCard.stylesheets', self.stylesheets, (Stylesheet,), False, True, False) + _guard_scalar('MetaCard.animate', self.animate, (bool,), False, True, False) _guard_vector('MetaCard.commands', self.commands, (Command,), False, True, False) return _dump( view='meta', @@ -10716,6 +10731,7 @@ def dump(self) -> Dict: script=None if self.script is None else self.script.dump(), stylesheet=None if self.stylesheet is None else self.stylesheet.dump(), stylesheets=None if self.stylesheets is None else [__e.dump() for __e in self.stylesheets], + animate=self.animate, commands=None if self.commands is None else [__e.dump() for __e in self.commands], ) @@ -10756,6 +10772,8 @@ def load(__d: Dict) -> 'MetaCard': _guard_scalar('MetaCard.stylesheet', __d_stylesheet, (dict,), False, True, False) __d_stylesheets: Any = __d.get('stylesheets') _guard_vector('MetaCard.stylesheets', __d_stylesheets, (dict,), False, True, False) + __d_animate: Any = __d.get('animate') + _guard_scalar('MetaCard.animate', __d_animate, (bool,), False, True, False) __d_commands: Any = __d.get('commands') _guard_vector('MetaCard.commands', __d_commands, (dict,), False, True, False) box: str = __d_box @@ -10775,6 +10793,7 @@ def load(__d: Dict) -> 'MetaCard': script: Optional[InlineScript] = None if __d_script is None else InlineScript.load(__d_script) stylesheet: Optional[InlineStylesheet] = None if __d_stylesheet is None else InlineStylesheet.load(__d_stylesheet) stylesheets: Optional[List[Stylesheet]] = None if __d_stylesheets is None else [Stylesheet.load(__e) for __e in __d_stylesheets] + animate: Optional[bool] = __d_animate commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands] return MetaCard( box, @@ -10794,6 +10813,7 @@ def load(__d: Dict) -> 'MetaCard': script, stylesheet, stylesheets, + animate, commands, ) @@ -11017,6 +11037,7 @@ def __init__( plot: Plot, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ): _guard_scalar('PlotCard.box', box, (str,), False, False, False) @@ -11024,6 +11045,7 @@ def __init__( _guard_scalar('PlotCard.plot', plot, (Plot,), False, False, False) _guard_vector('PlotCard.events', events, (str,), False, True, False) _guard_vector('PlotCard.interactions', interactions, (str,), False, True, False) + _guard_scalar('PlotCard.animate', animate, (bool,), False, True, False) _guard_vector('PlotCard.commands', commands, (Command,), False, True, False) self.box = box """A string indicating how to place this component on the page.""" @@ -11037,6 +11059,8 @@ def __init__( """The events to capture on this card. One of 'select_marks'.""" self.interactions = interactions """The interactions to be allowed for this card. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.""" + self.animate = animate + """True to turn on the chart animations. Defaults to False.""" self.commands = commands """Contextual menu commands for this component.""" @@ -11047,6 +11071,7 @@ def dump(self) -> Dict: _guard_scalar('PlotCard.plot', self.plot, (Plot,), False, False, False) _guard_vector('PlotCard.events', self.events, (str,), False, True, False) _guard_vector('PlotCard.interactions', self.interactions, (str,), False, True, False) + _guard_scalar('PlotCard.animate', self.animate, (bool,), False, True, False) _guard_vector('PlotCard.commands', self.commands, (Command,), False, True, False) return _dump( view='plot', @@ -11056,6 +11081,7 @@ def dump(self) -> Dict: plot=self.plot.dump(), events=self.events, interactions=self.interactions, + animate=self.animate, commands=None if self.commands is None else [__e.dump() for __e in self.commands], ) @@ -11073,6 +11099,8 @@ def load(__d: Dict) -> 'PlotCard': _guard_vector('PlotCard.events', __d_events, (str,), False, True, False) __d_interactions: Any = __d.get('interactions') _guard_vector('PlotCard.interactions', __d_interactions, (str,), False, True, False) + __d_animate: Any = __d.get('animate') + _guard_scalar('PlotCard.animate', __d_animate, (bool,), False, True, False) __d_commands: Any = __d.get('commands') _guard_vector('PlotCard.commands', __d_commands, (dict,), False, True, False) box: str = __d_box @@ -11081,6 +11109,7 @@ def load(__d: Dict) -> 'PlotCard': plot: Plot = Plot.load(__d_plot) events: Optional[List[str]] = __d_events interactions: Optional[List[str]] = __d_interactions + animate: Optional[bool] = __d_animate commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands] return PlotCard( box, @@ -11089,6 +11118,7 @@ def load(__d: Dict) -> 'PlotCard': plot, events, interactions, + animate, commands, ) diff --git a/py/h2o_wave/h2o_wave/ui.py b/py/h2o_wave/h2o_wave/ui.py index f0457c546c..c9e7f37dc4 100644 --- a/py/h2o_wave/h2o_wave/ui.py +++ b/py/h2o_wave/h2o_wave/ui.py @@ -2087,6 +2087,7 @@ def visualization( visible: Optional[bool] = None, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, ) -> Component: """Create a visualization for display inside a form. @@ -2099,6 +2100,7 @@ def visualization( visible: True if the component should be visible. Defaults to True. events: The events to capture on this visualization. One of 'select_marks'. interactions: The interactions to be allowed for this plot. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event. + animate: True to turn on the chart animations. Defaults to False. Returns: A `h2o_wave.types.Visualization` instance. """ @@ -2111,6 +2113,7 @@ def visualization( visible, events, interactions, + animate, )) @@ -3770,6 +3773,7 @@ def meta_card( script: Optional[InlineScript] = None, stylesheet: Optional[InlineStylesheet] = None, stylesheets: Optional[List[Stylesheet]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ) -> MetaCard: """Represents page-global state. @@ -3795,6 +3799,7 @@ def meta_card( script: Javascript code to execute on this page. stylesheet: CSS stylesheet to be applied to this page. stylesheets: External CSS files to load into the page. + animate: True to turn on the card animations. Defaults to False. commands: Contextual menu commands for this component. Returns: A `h2o_wave.types.MetaCard` instance. @@ -3817,6 +3822,7 @@ def meta_card( script, stylesheet, stylesheets, + animate, commands, ) @@ -3903,6 +3909,7 @@ def plot_card( plot: Plot, events: Optional[List[str]] = None, interactions: Optional[List[str]] = None, + animate: Optional[bool] = None, commands: Optional[List[Command]] = None, ) -> PlotCard: """Create a card displaying a plot. @@ -3914,6 +3921,7 @@ def plot_card( plot: The plot to be displayed in this card. events: The events to capture on this card. One of 'select_marks'. interactions: The interactions to be allowed for this card. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event. + animate: True to turn on the chart animations. Defaults to False. commands: Contextual menu commands for this component. Returns: A `h2o_wave.types.PlotCard` instance. @@ -3925,6 +3933,7 @@ def plot_card( plot, events, interactions, + animate, commands, ) diff --git a/r/R/ui.R b/r/R/ui.R index 8dd67bb1a6..2c689ebc7d 100644 --- a/r/R/ui.R +++ b/r/R/ui.R @@ -2453,6 +2453,7 @@ ui_plot <- function( #' @param visible True if the component should be visible. Defaults to True. #' @param events The events to capture on this visualization. One of 'select_marks'. #' @param interactions The interactions to be allowed for this plot. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event. +#' @param animate True to turn on the chart animations. Defaults to False. #' @return A Visualization instance. #' @export ui_visualization <- function( @@ -2463,7 +2464,8 @@ ui_visualization <- function( name = NULL, visible = NULL, events = NULL, - interactions = NULL) { + interactions = NULL, + animate = NULL) { .guard_scalar("plot", "WavePlot", plot) # TODO Validate data: Rec .guard_scalar("width", "character", width) @@ -2472,6 +2474,7 @@ ui_visualization <- function( .guard_scalar("visible", "logical", visible) .guard_vector("events", "character", events) .guard_vector("interactions", "character", interactions) + .guard_scalar("animate", "logical", animate) .o <- list(visualization=list( plot=plot, data=data, @@ -2480,7 +2483,8 @@ ui_visualization <- function( name=name, visible=visible, events=events, - interactions=interactions)) + interactions=interactions, + animate=animate)) class(.o) <- append(class(.o), c(.wave_obj, "WaveComponent")) return(.o) } @@ -4388,6 +4392,7 @@ ui_stylesheet <- function( #' @param script Javascript code to execute on this page. #' @param stylesheet CSS stylesheet to be applied to this page. #' @param stylesheets External CSS files to load into the page. +#' @param animate True to turn on the card animations. Defaults to False. #' @param commands Contextual menu commands for this component. #' @return A MetaCard instance. #' @export @@ -4409,6 +4414,7 @@ ui_meta_card <- function( script = NULL, stylesheet = NULL, stylesheets = NULL, + animate = NULL, commands = NULL) { .guard_scalar("box", "character", box) .guard_scalar("title", "character", title) @@ -4427,6 +4433,7 @@ ui_meta_card <- function( .guard_scalar("script", "WaveInlineScript", script) .guard_scalar("stylesheet", "WaveInlineStylesheet", stylesheet) .guard_vector("stylesheets", "WaveStylesheet", stylesheets) + .guard_scalar("animate", "logical", animate) .guard_vector("commands", "WaveCommand", commands) .o <- list( box=box, @@ -4446,6 +4453,7 @@ ui_meta_card <- function( script=script, stylesheet=stylesheet, stylesheets=stylesheets, + animate=animate, commands=commands, view='meta') class(.o) <- append(class(.o), c(.wave_obj, "WaveMetaCard")) @@ -4550,6 +4558,7 @@ ui_pixel_art_card <- function( #' @param plot The plot to be displayed in this card. #' @param events The events to capture on this card. One of 'select_marks'. #' @param interactions The interactions to be allowed for this card. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event. +#' @param animate True to turn on the chart animations. Defaults to False. #' @param commands Contextual menu commands for this component. #' @return A PlotCard instance. #' @export @@ -4560,6 +4569,7 @@ ui_plot_card <- function( plot, events = NULL, interactions = NULL, + animate = NULL, commands = NULL) { .guard_scalar("box", "character", box) .guard_scalar("title", "character", title) @@ -4567,6 +4577,7 @@ ui_plot_card <- function( .guard_scalar("plot", "WavePlot", plot) .guard_vector("events", "character", events) .guard_vector("interactions", "character", interactions) + .guard_scalar("animate", "logical", animate) .guard_vector("commands", "WaveCommand", commands) .o <- list( box=box, @@ -4575,6 +4586,7 @@ ui_plot_card <- function( plot=plot, events=events, interactions=interactions, + animate=animate, commands=commands, view='plot') class(.o) <- append(class(.o), c(.wave_obj, "WavePlotCard")) diff --git a/tools/intellij-plugin/src/main/resources/templates/wave-components.xml b/tools/intellij-plugin/src/main/resources/templates/wave-components.xml index d13ff24ec8..b24c294fac 100644 --- a/tools/intellij-plugin/src/main/resources/templates/wave-components.xml +++ b/tools/intellij-plugin/src/main/resources/templates/wave-components.xml @@ -1782,7 +1782,7 @@