diff --git a/py/h2o_wave/types.py b/py/h2o_wave/types.py index 955a4dc0184..14cac74fd64 100644 --- a/py/h2o_wave/types.py +++ b/py/h2o_wave/types.py @@ -2892,6 +2892,7 @@ def __init__( compact: Optional[bool] = None, visible: Optional[bool] = None, tooltip: Optional[str] = None, + required: Optional[bool] = None, ): _guard_scalar('FileUpload.name', name, (str,), True, False, False) _guard_scalar('FileUpload.label', label, (str,), False, True, False) @@ -2904,6 +2905,7 @@ def __init__( _guard_scalar('FileUpload.compact', compact, (bool,), False, True, False) _guard_scalar('FileUpload.visible', visible, (bool,), False, True, False) _guard_scalar('FileUpload.tooltip', tooltip, (str,), False, True, False) + _guard_scalar('FileUpload.required', required, (bool,), False, True, False) self.name = name """An identifying name for this component.""" self.label = label @@ -2926,6 +2928,8 @@ def __init__( """True if the component should be visible. Defaults to True.""" self.tooltip = tooltip """An optional tooltip message displayed when a user clicks the help icon to the right of the component.""" + self.required = required + """True if this is a required field. Defaults to False.""" def dump(self) -> Dict: """Returns the contents of this object as a dict.""" @@ -2940,6 +2944,7 @@ def dump(self) -> Dict: _guard_scalar('FileUpload.compact', self.compact, (bool,), False, True, False) _guard_scalar('FileUpload.visible', self.visible, (bool,), False, True, False) _guard_scalar('FileUpload.tooltip', self.tooltip, (str,), False, True, False) + _guard_scalar('FileUpload.required', self.required, (bool,), False, True, False) return _dump( name=self.name, label=self.label, @@ -2952,6 +2957,7 @@ def dump(self) -> Dict: compact=self.compact, visible=self.visible, tooltip=self.tooltip, + required=self.required, ) @staticmethod @@ -2979,6 +2985,8 @@ def load(__d: Dict) -> 'FileUpload': _guard_scalar('FileUpload.visible', __d_visible, (bool,), False, True, False) __d_tooltip: Any = __d.get('tooltip') _guard_scalar('FileUpload.tooltip', __d_tooltip, (str,), False, True, False) + __d_required: Any = __d.get('required') + _guard_scalar('FileUpload.required', __d_required, (bool,), False, True, False) name: str = __d_name label: Optional[str] = __d_label multiple: Optional[bool] = __d_multiple @@ -2990,6 +2998,7 @@ def load(__d: Dict) -> 'FileUpload': compact: Optional[bool] = __d_compact visible: Optional[bool] = __d_visible tooltip: Optional[str] = __d_tooltip + required: Optional[bool] = __d_required return FileUpload( name, label, @@ -3002,6 +3011,7 @@ def load(__d: Dict) -> 'FileUpload': compact, visible, tooltip, + required, ) diff --git a/py/h2o_wave/ui.py b/py/h2o_wave/ui.py index 33e6a779957..9ee1c43b7cc 100644 --- a/py/h2o_wave/ui.py +++ b/py/h2o_wave/ui.py @@ -1123,6 +1123,7 @@ def file_upload( compact: Optional[bool] = None, visible: Optional[bool] = None, tooltip: Optional[str] = None, + required: Optional[bool] = None, ) -> Component: """Create a file upload component. A file upload component allows a user to browse, select and upload one or more files. @@ -1139,6 +1140,7 @@ def file_upload( compact: True if the component should be displayed compactly (without drag-and-drop capabilities). Defaults to False. visible: True if the component should be visible. Defaults to True. tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component. + required: True if this is a required field. Defaults to False. Returns: A `h2o_wave.types.FileUpload` instance. """ @@ -1154,6 +1156,7 @@ def file_upload( compact, visible, tooltip, + required, )) diff --git a/r/R/ui.R b/r/R/ui.R index 708ac43770c..09dc70aca44 100644 --- a/r/R/ui.R +++ b/r/R/ui.R @@ -1324,6 +1324,7 @@ ui_mini_buttons <- function( #' @param compact True if the component should be displayed compactly (without drag-and-drop capabilities). Defaults to False. #' @param visible True if the component should be visible. Defaults to True. #' @param tooltip An optional tooltip message displayed when a user clicks the help icon to the right of the component. +#' @param required True if this is a required field. Defaults to False. #' @return A FileUpload instance. #' @export ui_file_upload <- function( @@ -1337,7 +1338,8 @@ ui_file_upload <- function( width = NULL, compact = NULL, visible = NULL, - tooltip = NULL) { + tooltip = NULL, + required = NULL) { .guard_scalar("name", "character", name) .guard_scalar("label", "character", label) .guard_scalar("multiple", "logical", multiple) @@ -1349,6 +1351,7 @@ ui_file_upload <- function( .guard_scalar("compact", "logical", compact) .guard_scalar("visible", "logical", visible) .guard_scalar("tooltip", "character", tooltip) + .guard_scalar("required", "logical", required) .o <- list(file_upload=list( name=name, label=label, @@ -1360,7 +1363,8 @@ ui_file_upload <- function( width=width, compact=compact, visible=visible, - tooltip=tooltip)) + tooltip=tooltip, + required=required)) class(.o) <- append(class(.o), c(.wave_obj, "WaveComponent")) return(.o) } 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 7b887b96211..bd1ca4e2d29 100644 --- a/tools/intellij-plugin/src/main/resources/templates/wave-components.xml +++ b/tools/intellij-plugin/src/main/resources/templates/wave-components.xml @@ -1195,7 +1195,7 @@