Skip to content

Commit

Permalink
chore: Add available options to target attrs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci committed Aug 16, 2023
1 parent b95533e commit 15b71f5
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions py/h2o_lightwave/h2o_lightwave/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3274,7 +3274,7 @@ def __init__(
self.name = name
"""An identifying name for this component."""
self.target = target
"""Where to display the link. Setting this to '_blank'` opens the link in a new tab or window."""
"""Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab."""

def dump(self) -> Dict:
"""Returns the contents of this object as a dict."""
Expand Down Expand Up @@ -3944,7 +3944,7 @@ def __init__(
self.visible = visible
"""True if the component should be visible. Defaults to True."""
self.target = target
"""Where to display the link. Setting this to an empty string or `'_blank'` opens the link in a new tab or window."""
"""Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab."""
self.tooltip = tooltip
"""An optional tooltip message displayed when a user clicks the help icon to the right of the component."""
self.name = name
Expand Down
4 changes: 2 additions & 2 deletions py/h2o_lightwave/h2o_lightwave/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ def markdown_table_cell_type(
Args:
name: An identifying name for this component.
target: Where to display the link. Setting this to '_blank'` opens the link in a new tab or window.
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
Returns:
A `h2o_wave.types.MarkdownTableCellType` instance.
"""
Expand Down Expand Up @@ -1510,7 +1510,7 @@ def link(
button: True if the link should be rendered as a button.
width: The width of the link, e.g. '100px'.
visible: True if the component should be visible. Defaults to True.
target: Where to display the link. Setting this to an empty string or `'_blank'` opens the link in a new tab or window.
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
name: An identifying name for this component.
Returns:
Expand Down
4 changes: 2 additions & 2 deletions py/h2o_wave/h2o_wave/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3274,7 +3274,7 @@ def __init__(
self.name = name
"""An identifying name for this component."""
self.target = target
"""Where to display the link. Setting this to '_blank'` opens the link in a new tab or window."""
"""Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab."""

def dump(self) -> Dict:
"""Returns the contents of this object as a dict."""
Expand Down Expand Up @@ -3944,7 +3944,7 @@ def __init__(
self.visible = visible
"""True if the component should be visible. Defaults to True."""
self.target = target
"""Where to display the link. Setting this to an empty string or `'_blank'` opens the link in a new tab or window."""
"""Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab."""
self.tooltip = tooltip
"""An optional tooltip message displayed when a user clicks the help icon to the right of the component."""
self.name = name
Expand Down
4 changes: 2 additions & 2 deletions py/h2o_wave/h2o_wave/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ def markdown_table_cell_type(
Args:
name: An identifying name for this component.
target: Where to display the link. Setting this to '_blank'` opens the link in a new tab or window.
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
Returns:
A `h2o_wave.types.MarkdownTableCellType` instance.
"""
Expand Down Expand Up @@ -1510,7 +1510,7 @@ def link(
button: True if the link should be rendered as a button.
width: The width of the link, e.g. '100px'.
visible: True if the component should be visible. Defaults to True.
target: Where to display the link. Setting this to an empty string or `'_blank'` opens the link in a new tab or window.
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
name: An identifying name for this component.
Returns:
Expand Down
4 changes: 2 additions & 2 deletions r/R/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ ui_menu_table_cell_type <- function(
#' Create a cell type that renders Markdown content.
#'
#' @param name An identifying name for this component.
#' @param target Where to display the link. Setting this to '_blank'` opens the link in a new tab or window.
#' @param target Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
#' @return A MarkdownTableCellType instance.
#' @export
ui_markdown_table_cell_type <- function(
Expand Down Expand Up @@ -1742,7 +1742,7 @@ ui_table <- function(
#' @param button True if the link should be rendered as a button.
#' @param width The width of the link, e.g. '100px'.
#' @param visible True if the component should be visible. Defaults to True.
#' @param target Where to display the link. Setting this to an empty string or `'_blank'` opens the link in a new tab or window.
#' @param target Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
#' @param tooltip An optional tooltip message displayed when a user clicks the help icon to the right of the component.
#' @param name An identifying name for this component.
#' @return A Link instance.
Expand Down
2 changes: 1 addition & 1 deletion ui/src/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface Link {
width?: S
/** True if the component should be visible. Defaults to True. */
visible?: B
/** Where to display the link. Setting this to an empty string or `'_blank'` opens the link in a new tab or window. */
/** Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab. */
target?: S
/** An optional tooltip message displayed when a user clicks the help icon to the right of the component. */
tooltip?: S
Expand Down
6 changes: 3 additions & 3 deletions ui/src/markdown_table_cell_type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import { Markdown } from './markdown'
export interface MarkdownTableCellType {
/** An identifying name for this component. */
name?: S
/** Where to display the link. Setting this to '_blank'` opens the link in a new tab or window. */
/** Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab. */
target?: S
}

export const XMarkdownTableCellType = ({ model: m }: { model: MarkdownTableCellType & { content: S}} ) => {
export const XMarkdownTableCellType = ({ model: m }: { model: MarkdownTableCellType & { content: S } }) => {
const ref = React.useRef<HTMLDivElement>(null)

React.useEffect(() => {
ref.current!.querySelectorAll<HTMLAnchorElement>('a')?.forEach(a => {if (m.target) a.target = m.target})
ref.current!.querySelectorAll<HTMLAnchorElement>('a')?.forEach(a => { if (m.target) a.target = m.target })
}, [m.target])

return (
Expand Down

0 comments on commit 15b71f5

Please sign in to comment.