Skip to content

Misc


CellProps = Props





ColumnGroupHeaderProps = Props



ColumnHeaderChildren = ColumnHeaderRenderFunction | React.ReactElement | readonly ColumnHeaderChild[]


ColumnHeaderProps = Props


const columns$: NodeRef<Map<string, ColumnInfo>>


const columnWidths$: NodeRef<Map<string, number>>


string



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.

An EngineRef should only be used with a single EngineProvider. Using the same ref with multiple providers is unsupported.

Engine | null

The current engine instance, or null if not yet available.


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 = (viewId, payload) => void

ParameterType
viewIdstring
payloadunknown

void



GroupHeaderCellProps = Props


const HeaderEdge: (props) => null

ParameterType
propsHeaderSlotProps

null


const HeaderEnd: (props) => null

ParameterType
propsHeaderSlotProps

null


const HeaderOverlay: (props) => null

ParameterType
propsHeaderSlotProps

null


HeaderSlotCustomComponent<P> = React.ComponentType<HeaderSlotRenderParams & P>

Type ParameterDefault type
PRecord<string, unknown>

HeaderSlotRenderFunction = (params) => React.ReactNode

ParameterType
paramsHeaderSlotRenderParams

React.ReactNode


ColumnInfo


string


ColumnState


RefObject<HTMLDivElement | null>


boolean


const HeaderStart: (props) => null

ParameterType
propsHeaderSlotProps

null


const initialData$: NodeRef<DataArray | null>


const loadingState$: NodeRef<DataTableLoadingState>


unknown


string


ModelActionState = Record<string, ModelActionSnapshot>


Row<D> = Item<D>

Alias for Item, used in row-specific contexts

Type Parameter
D

useCellValue<T>(cell): T

Gets the current value of the cell. The component is re-rendered when the cell value changes.

Type ParameterDescription
Tthe type of the value that the cell caries.
ParameterTypeDescription
cellOut<T>The cell to use.

T

The current value of the cell.

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.

const cell$ = Cell(0)
//...
function MyComponent() {
  const cell = useCellValue(cell$)
  return <div>{cell}</div>
}

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.

EngineRef

function App() {
  const engineRef = useEngineRef()
  return (
    <>
      <SiblingComponent engineRef={engineRef} />
      <EngineProvider engineRef={engineRef} initFn={initFn}>
        <NestedComponent />
      </EngineProvider>
    </>
  )
}

usePublisher<T>(node$): (value) => void

Returns a function that publishes its passed argument into the specified node.

Type ParameterDescription
TThe type of values that the node accepts.
ParameterTypeDescription
node$Inp<T>the node to publish in.

The publisher function for the passed node$.

(value): void

ParameterType
valueT

void

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<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 ParameterDescription
TThe type of values that the cell emits/accepts.
ParameterTypeDescription
cellNodeRef<T>The cell to use.
engineSourceEngineSourceA string engine ID or an EngineRef.

[T | undefined, (value) => void]

A tuple of the current value (or undefined) and a publisher function.

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<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 ParameterDescription
TThe type of the value that the cell carries.
ParameterTypeDescription
cellOut<T>The cell to read from.
engineSourceEngineSourceA string engine ID or an EngineRef to read from.

T | undefined

The current value of the cell, or undefined if the engine is not available.

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<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 ParameterDescription
TThe type of values that the node accepts.
ParameterTypeDescription
node$Inp<T>The node to publish to.
engineSourceEngineSourceA string engine ID or an EngineRef to publish to.

A publisher function that accepts values of type T.

(value): void

ParameterType
valueT

void

const trigger$ = Trigger()
// ...
function SiblingComponent({ engineRef }: { engineRef: EngineRef }) {
  const publish = useRemotePublisher(trigger$, engineRef)
  return <button onClick={() => publish()}>Trigger</button>
}

const VirtuosoDataTable: <Data, Context, Group>(props) => ReactElement & object


const visibleColumns$: NodeRef<Map<string, ColumnInfo>>