-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54f152d
commit 762457b
Showing
19 changed files
with
499 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import BaseElement | ||
|
||
|
||
def column(*children: Any, width: float | None = None, **kwargs: Any): | ||
""" | ||
A column is a container that can be used to group elements. | ||
Each element will be placed below its prior sibling. | ||
Args: | ||
children: Elements to render in the column. | ||
width: The percent width of the column relative to other children of its parent. If not provided, the column will be sized automatically. | ||
""" | ||
return BaseElement( | ||
"deephaven.ui.components.Column", *children, width=width, **kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import BaseElement | ||
|
||
|
||
def dashboard(*children: Any, **kwargs: Any): | ||
""" | ||
A dashboard is the container for an entire layout. | ||
Args: | ||
children: Elements to render in the dashboard. Must have only 1 root element. | ||
""" | ||
return BaseElement("deephaven.ui.components.Dashboard", *children, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import BaseElement | ||
|
||
|
||
def row(*children: Any, height: float | None = None, **kwargs: Any): | ||
""" | ||
A row is a container that can be used to group elements. | ||
Each element will be placed to the right of its prior sibling. | ||
Args: | ||
children: Elements to render in the row. | ||
height: The percent height of the row relative to other children of its parent. If not provided, the row will be sized automatically. | ||
""" | ||
return BaseElement( | ||
"deephaven.ui.components.Row", *children, height=height, **kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import BaseElement | ||
|
||
|
||
def stack( | ||
*children: Any, | ||
height: float | None = None, | ||
width: float | None = None, | ||
activeItemIndex: int | None = None, | ||
**kwargs: Any, | ||
): | ||
""" | ||
A stack is a container that can be used to group elements which creates a set of tabs. | ||
Each element will get a tab and only one element can be visible at a time. | ||
Args: | ||
children: Elements to render in the row. | ||
height: The percent height of the stack relative to other children of its parent. If not provided, the stack will be sized automatically. | ||
width: The percent width of the stack relative to other children of its parent. If not provided, the stack will be sized automatically. | ||
""" | ||
return BaseElement( | ||
"deephaven.ui.components.Stack", | ||
*children, | ||
height=height, | ||
width=width, | ||
activeItemIndex=activeItemIndex, | ||
**kwargs, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { useLayoutManager } from '@deephaven/dashboard'; | ||
import type { ColumnElementProps } from './LayoutUtils'; | ||
import { ParentItemContext, useParentItem } from './ParentItemContext'; | ||
|
||
function Column({ children, width }: ColumnElementProps): JSX.Element | null { | ||
const layoutManager = useLayoutManager(); | ||
const parent = useParentItem(); | ||
const [column] = useState(() => { | ||
const newColumn = layoutManager.createContentItem( | ||
{ | ||
type: 'column', | ||
width, | ||
}, | ||
parent | ||
); | ||
|
||
parent.addChild(newColumn, undefined, true); | ||
|
||
return newColumn; | ||
}); | ||
|
||
useEffect(() => { | ||
column.setSize(); | ||
|
||
return () => { | ||
column.remove(); | ||
}; | ||
}, [column]); | ||
|
||
return ( | ||
<ParentItemContext.Provider value={column}> | ||
{children} | ||
</ParentItemContext.Provider> | ||
); | ||
} | ||
|
||
export default Column; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { useLayoutManager } from '@deephaven/dashboard'; | ||
import type { StackElementProps } from './LayoutUtils'; | ||
import { ParentItemContext } from './ParentItemContext'; | ||
|
||
function Dashboard({ children }: StackElementProps): JSX.Element | null { | ||
const layoutManager = useLayoutManager(); | ||
const [dashboard, setDashboard] = useState(false); | ||
|
||
useEffect(() => { | ||
layoutManager.root.callDownwards('_$destroy', [], true, true); | ||
layoutManager.root.contentItems = []; | ||
setDashboard(true); | ||
}, []); | ||
Check warning on line 14 in plugins/ui/src/js/src/layout/Dashboard.tsx GitHub Actions / test-js / unit
|
||
|
||
if (!dashboard) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ParentItemContext.Provider value={layoutManager.root}> | ||
{children} | ||
</ParentItemContext.Provider> | ||
); | ||
} | ||
|
||
export default Dashboard; |
Oops, something went wrong.