Hooks
useActivePivotClient
React hook returning the ActivePivotClient at serverKey
.
Argument | Type | Description |
---|---|---|
serverKey | string | undefined |
ActivePivotClient | undefined
Throws:ClientsNotFoundError when no clients are provided via ClientsProvider.
ActivePivotClientNotFoundError when serverKey
is defined but no ActivePivotClient is provided for this key via ClientsProvider.
useActivePivotClients
React hook returning the map of all registered ActivePivotClients.
{ [serverKey: string]: ActivePivotClient; }
useActivity
React hook returning the value for the given activity key, along with a function to update this value.
Argument | Type | Description |
---|---|---|
key | T |
[Activity[T] | null, (value: Activity[T]) => void]
useConnectionStatuses
React hook returning the overall status of the connection with the registered ActivePivot clients.
{ [serverKey: string]: ConnectionStatus; }
useContentClient
React hook returning the ContentClient.
ClientsNotFoundError when no clients are provided via ClientsProvider.
ContentClientNotFoundError when no ContentClient is provided via ClientsProvider.
useDataModel
React hook returning the DataModel of the ActivePivot server identified by serverKey
.
Argument | Type | Description |
---|---|---|
serverKey | string | undefined |
DataModel | undefined
Throws:DataModelNotFoundError when serverKey
is defined but the data model could not be found.
useDataModels
React hook returning the data models of all ActivePivot servers to which the client is connected.
{ [serverKey: string]: DataModel; }
useIsModalMounted
Hook returning whether a modal should be mounted/unmounted depending on whether it is visible. It allows to reset the state of a Modal declaratively, without losing Ant Design's close animation.
See https://github.com/activeviam/activeui-5/pull/1465\#issuecomment-862306468.
Argument | Type | Description |
---|---|---|
isModalVisible | boolean |
boolean
For example:useIsPresenting
React hook returning the current state of isPresenting.
boolean
usePersisted
React hook returning the value for the key
in the browser local storage and the function to update it.
Argument | Type | Description |
---|---|---|
key | string | |
initialValue | T |
[T | undefined, (newValue: T) => void]
useQuery
React hook returning the up-to-date Query corresponding to queryId
.
Argument | Type | Description |
---|---|---|
{ serverKey, queryId, } | { serverKey?: string; queryId?: string; } |
useQueryResult
Subscribes to a query's result. If queryId
is not provided, returns an empty result. If queryId
is provided: returns an up-to-date result. If queryId
and query
are provided and a query already exists for this serverKey
and queryId
: updates that query. Otherwise, registers query
within serverKey
.
Argument | Type | Description |
---|---|---|
{ serverKey, queryId, query, } | { serverKey?: string; queryId?: string; query?: Query<MdxString>; } |
QueryResult<ResultType>
useSetting
React hook returning the setting value for the given key, along with a function to update this value.
Argument | Type | Description |
---|---|---|
key | T |
[Settings[T], (value: Settings[T]) => void]
useSwitchedWidgetState
React Hook returning the switched widget state if switched or the original state if not switched.
Argument | Type | Description |
---|---|---|
widgetState | WidgetState |
WidgetState
useTheme
React hook returning the Theme.
useTree
React hook returning the dashboards or widgets tree.
Argument | Type | Description |
---|---|---|
type | T |
ContentRecord<DashboardMetaData | WidgetMetaData | FilterMetaData> | null
useUser
React hook returning the user from context.
UserNotFoundError when no User is provided via UserProvider.
useUserGroupNames
React hook returning the user group names from context.
UserGroupName[] | null
useUserNames
React hook returning the provided user names from context.
UserName[] | null
useWidgetName
React Hook returning either widgetState.name if defined otherwise returns a translated initial name from the widget plugin.
Argument | Type | Description |
---|---|---|
widgetState | AWidgetState |
string
useWidgetPluginKeys
React hook returning the keys of all the registered widget plugins.
string[]
useWidgetPlugins
React hook returning the widget plugins corresponding to widgetKeys
.
Argument | Type | Description |
---|---|---|
widgetKeys | string[] |
useWidgetQuery
Returns the widget's Query, impacted by the page and dashboard filters and the query contexts found in dashboardState
and paused when the widget is in an inactive dashboard page.
Argument | Type | Description |
---|---|---|
{ widgetState, dashboardState, pageKey, cube, } | { widgetState: WidgetWithQueryState<MdxSelect | MdxDrillthrough>; dashboardState: DashboardState | undefined; pageKey?: string; cube: Cube; } |