Misc
Components
Section titled “Components”CellProps
Section titled “CellProps”CellProps =
Props
Column
Section titled “Column”Components
Section titled “Components”ColumnGroup
Section titled “ColumnGroup”Components
Section titled “Components”ColumnGroupHeader
Section titled “ColumnGroupHeader”Components
Section titled “Components”ColumnGroupHeaderProps
Section titled “ColumnGroupHeaderProps”ColumnGroupHeaderProps =
Props
ColumnHeader
Section titled “ColumnHeader”Components
Section titled “Components”ColumnHeaderChildren
Section titled “ColumnHeaderChildren”ColumnHeaderChildren =
ColumnHeaderRenderFunction|React.ReactElement| readonlyColumnHeaderChild[]
ColumnHeaderProps
Section titled “ColumnHeaderProps”ColumnHeaderProps =
Props
columns$
Section titled “columns$”
constcolumns$:NodeRef<Map<string,ColumnInfo>>
columnWidths$
Section titled “columnWidths$”
constcolumnWidths$:NodeRef<Map<string,number>>
DispatchModelActionPayload
Section titled “DispatchModelActionPayload”Properties
Section titled “Properties”action
Section titled “action”string
payload?: unknown
Section titled “payload?: unknown”EngineRef
Section titled “EngineRef”A reactive ref that holds an engine instance. Created by useEngineRef.
Pass it to EngineProvider via the engineRef prop, then use it with
the useRemote* hooks to access the engine from anywhere in the component tree.
Remarks
Section titled “Remarks”An EngineRef should only be used with a single EngineProvider.
Using the same ref with multiple providers is unsupported.
Properties
Section titled “Properties”current
Section titled “current”Engine | null
The current engine instance, or null if not yet available.
EngineSource
Section titled “EngineSource”EngineSource =
EngineRef|string
Union type for the engine source parameter accepted by useRemote* hooks.
Can be either a string engine ID (for global registry lookup) or an EngineRef.
EventEmitter
Section titled “EventEmitter”EventEmitter = (
viewId,payload) =>void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
viewId | string |
payload | unknown |
Returns
Section titled “Returns”void
GroupHeaderCell
Section titled “GroupHeaderCell”Components
Section titled “Components”GroupHeaderCellProps
Section titled “GroupHeaderCellProps”GroupHeaderCellProps =
Props
HeaderEdge
Section titled “HeaderEdge”
constHeaderEdge: (props) =>null
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props | HeaderSlotProps |
Returns
Section titled “Returns”null
HeaderEnd
Section titled “HeaderEnd”
constHeaderEnd: (props) =>null
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props | HeaderSlotProps |
Returns
Section titled “Returns”null
HeaderOverlay
Section titled “HeaderOverlay”
constHeaderOverlay: (props) =>null
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props | HeaderSlotProps |
Returns
Section titled “Returns”null
HeaderSlotCustomComponent
Section titled “HeaderSlotCustomComponent”HeaderSlotCustomComponent<
P> =React.ComponentType<HeaderSlotRenderParams&P>
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
P | Record<string, unknown> |
HeaderSlotRenderFunction
Section titled “HeaderSlotRenderFunction”HeaderSlotRenderFunction = (
params) =>React.ReactNode
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | HeaderSlotRenderParams |
Returns
Section titled “Returns”React.ReactNode
HeaderSlotRenderParams
Section titled “HeaderSlotRenderParams”Properties
Section titled “Properties”column
Section titled “column”columnKey
Section titled “columnKey”string
columnState
Section titled “columnState”headerRef
Section titled “headerRef”RefObject<HTMLDivElement | null>
overlaidByScrollbar
Section titled “overlaidByScrollbar”boolean
HeaderStart
Section titled “HeaderStart”
constHeaderStart: (props) =>null
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props | HeaderSlotProps |
Returns
Section titled “Returns”null
initialData$
Section titled “initialData$”
constinitialData$:NodeRef<DataArray|null>
loadingState$
Section titled “loadingState$”
constloadingState$:NodeRef<DataTableLoadingState>
ModelActionSnapshot
Section titled “ModelActionSnapshot”Properties
Section titled “Properties”payload
Section titled “payload”unknown
viewId
Section titled “viewId”string
ModelActionState
Section titled “ModelActionState”ModelActionState =
Record<string,ModelActionSnapshot>
Row<
D> =Item<D>
Alias for Item, used in row-specific contexts
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
D |
useCellValue
Section titled “useCellValue”useCellValue<
T>(cell):T
Gets the current value of the cell. The component is re-rendered when the cell value changes.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Description |
|---|---|
T | the type of the value that the cell caries. |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
cell | Out<T> | The cell to use. |
Returns
Section titled “Returns”T
The current value of the cell.
Remarks
Section titled “Remarks”If you need the values of multiple nodes from the engine and those nodes might change in the same computiation, you can useCellValues to reduce re-renders.
Example
Section titled “Example”const cell$ = Cell(0)
//...
function MyComponent() {
const cell = useCellValue(cell$)
return <div>{cell}</div>
}useEngineRef
Section titled “useEngineRef”useEngineRef():
EngineRef
Creates a stable, memoized EngineRef for use inside a component.
Pass the returned ref to an EngineProvider via the engineRef prop,
and to useRemote* hooks to access the engine reactively.
Returns
Section titled “Returns”Example
Section titled “Example”function App() {
const engineRef = useEngineRef()
return (
<>
<SiblingComponent engineRef={engineRef} />
<EngineProvider engineRef={engineRef} initFn={initFn}>
<NestedComponent />
</EngineProvider>
</>
)
}usePublisher
Section titled “usePublisher”usePublisher<
T>(node$): (value) =>void
Returns a function that publishes its passed argument into the specified node.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Description |
|---|---|
T | The type of values that the node accepts. |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
node$ | Inp<T> | the node to publish in. |
Returns
Section titled “Returns”The publisher function for the passed node$.
(
value):void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | T |
Returns
Section titled “Returns”void
Example
Section titled “Example”import {Stream, e, usePublisher} from '@virtuoso.dev/reactive-engine-react'
const stream$ = Stream<number>()
e.sub(stream, (value) => console.log(`${value} was published in the stream`))
//...
function MyComponent() {
const pub = usePublisher(stream);
return <button onClick={() => pub(2)}>Push a value into the stream</button>
}useRemoteCell
Section titled “useRemoteCell”useRemoteCell<
T>(cell,engineSource): [T|undefined, (value) =>void]
Returns a tuple of the current value and a publisher function for a cell in an engine identified by engineSource.
Returns [undefined, noop] when the engine is not available yet.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Description |
|---|---|
T | The type of values that the cell emits/accepts. |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
cell | NodeRef<T> | The cell to use. |
engineSource | EngineSource | A string engine ID or an EngineRef. |
Returns
Section titled “Returns”[T | undefined, (value) => void]
A tuple of the current value (or undefined) and a publisher function.
Example
Section titled “Example”const cell$ = Cell(0)
// ...
function SiblingComponent({ engineRef }: { engineRef: EngineRef }) {
const [value, setValue] = useRemoteCell(cell$, engineRef)
if (value === undefined) return <div>Loading...</div>
return <button onClick={() => setValue(value + 1)}>{value}</button>
}useRemoteCellValue
Section titled “useRemoteCellValue”useRemoteCellValue<
T>(cell,engineSource):T|undefined
Gets the current value of the cell from an engine identified by engineSource.
Returns undefined when the engine is not available yet.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Description |
|---|---|
T | The type of the value that the cell carries. |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
cell | Out<T> | The cell to read from. |
engineSource | EngineSource | A string engine ID or an EngineRef to read from. |
Returns
Section titled “Returns”T | undefined
The current value of the cell, or undefined if the engine is not available.
Example
Section titled “Example”const cell$ = Cell(0)
// ...
function SiblingComponent({ engineRef }: { engineRef: EngineRef }) {
const value = useRemoteCellValue(cell$, engineRef)
if (value === undefined) return <div>Loading...</div>
return <div>{value}</div>
}useRemotePublisher
Section titled “useRemotePublisher”useRemotePublisher<
T>(node$,engineSource): (value) =>void
Returns a function that publishes values to a node in an engine identified by engineSource.
Returns a no-op function when the engine is not available yet.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Description |
|---|---|
T | The type of values that the node accepts. |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
node$ | Inp<T> | The node to publish to. |
engineSource | EngineSource | A string engine ID or an EngineRef to publish to. |
Returns
Section titled “Returns”A publisher function that accepts values of type T.
(
value):void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | T |
Returns
Section titled “Returns”void
Example
Section titled “Example”const trigger$ = Trigger()
// ...
function SiblingComponent({ engineRef }: { engineRef: EngineRef }) {
const publish = useRemotePublisher(trigger$, engineRef)
return <button onClick={() => publish()}>Trigger</button>
}VirtuosoDataTable
Section titled “VirtuosoDataTable”
constVirtuosoDataTable: <Data,Context,Group>(props) =>ReactElement&object
Type Declaration
Section titled “Type Declaration”displayName?: string
Section titled “displayName?: string”visibleColumns$
Section titled “visibleColumns$”
constvisibleColumns$:NodeRef<Map<string,ColumnInfo>>