Functions
addDrillthroughColumn
Returns a new MdxDrillthrough corresponding to mdx
where the column identified by drillthroughColumnUniqueName
was added at index
if provided or at the last position otherwise. Does not mutate mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxDrillthrough | |
{ drillthroughColumnUniqueName, index, } | { drillthroughColumnUniqueName: string; index?: number; } |
addFormula
Returns a new MdxSelect corresponding to mdx
where the given formula was added. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ formulaName, expression, measureIndex, properties, } | { formulaName: string; expression: MdxExpression; measureIndex?: number; properties?: MdxMemberPropertyDefinition[]; } | |
cube | Cube |
addLevel
Returns a new MdxSelect corresponding to mdx
where the given level was added.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, dimensionName, hierarchyName, levelName, axisName, indexOnAxis, shouldCreateNonEmptyAxis, doesIncludeCalculatedMembers, } | { cube: Cube; dimensionName: DimensionName; hierarchyName: HierarchyName; levelName: LevelName; axisName?: AxisName; indexOnAxis?: number; shouldCreateNonEmptyAxis?: boolean; doesIncludeCalculatedMembers?: boolean; } |
addMeasure
Returns a new MdxSelect corresponding to mdx
where the given measure was added. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, measureName, measureIndex, shouldCreateNonEmptyAxis, axisName, } | { cube: Cube; measureName: MeasureName; measureIndex?: number; shouldCreateNonEmptyAxis?: boolean; axisName?: AxisName; } |
addPage
Adds a page to a dashboard and returns the updated dashboard state with the new page key. Does not mutate the dashboard state.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState | |
options | { page: DashboardPageState; key?: string; index?: number; } |
addWidget
Returns a new dashboard with the given widget added at the specified location. Does not mutate dashboard.
Argument | Type | Description |
---|---|---|
{ dashboardState, initialWidgetState, layoutPath, pageKey, side, } | { dashboardState: DashboardState; initialWidgetState: AWidgetState; layoutPath: number[]; pageKey: string; side: Side; } |
authenticate
Logs the current user in and retrieves her Jwt token. Only useful if you use the same authentication mechanism as the ActivePivot sandbox.
Argument | Type | Description |
---|---|---|
url | string | |
{ username, password } | { username: string; password: string; } |
Promise<string>
collapse
Returns a new MdxSelect corresponding to mdx
where the given tuple was collapsed. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, tupleCoordinates, } | { cube: Cube; tupleCoordinates: TupleCoordinates; } |
createActivePivotClient
Returns a new ActivePivotClient instance.
Argument | Type | Description |
---|---|---|
{ url, version, requestInit, pingPeriod, } | { url: string; version: ServiceVersion; requestInit?: RequestInit; pingPeriod?: number; } |
createContentClient
Returns a new ContentClient instance.
Argument | Type | Description |
---|---|---|
{ url, version, requestInit, } | { url: string; version: ServiceVersion; requestInit?: RequestInit; } |
createFilter
Returns the filter represented by mdx
(assuming that it represents a filter).
Argument | Type | Description |
---|---|---|
mdx | Mdx | |
cube | Cube |
createMdxForFilter
Returns a new Mdx representing filter
.
Argument | Type | Description |
---|---|---|
filter | Filter | |
cube | Cube |
deserializeDashboardState
Returns a new dashboard state where: - all MDX strings representing queries and filters are parsed and replaced by AST. - all data visualization widget mappings are deserialized. Does not mutate the passed dashboard state.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState<"serialized"> |
DashboardState<"deserialized">
deserializeWidgetState
Accepts a serialized widgetState
, as it is saved on a content server and returns its deserialized version, ready to live in the state of Dashboard.
Argument | Type | Description |
---|---|---|
widgetState | AWidgetState<"serialized"> |
R
expand
Returns a new MdxSelect corresponding to mdx
where the given tuple was expanded. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, tupleCoordinates, toLevel, doesIncludeCalculatedMembers, } | { cube: Cube; tupleCoordinates: TupleCoordinates; toLevel: LevelCoordinates; doesIncludeCalculatedMembers?: boolean; } |
fetchTranslations
Asynchronously returns the ActiveUI SDK translations for locale
.
Argument | Type | Description |
---|---|---|
locale | Locale |
Promise<{ [key in string]: string; }>
findContentRecords
Returns the nodes in tree
with the given ids, indexed by id.
Argument | Type | Description |
---|---|---|
tree | ContentRecord<T> | |
ids | string[] | |
path | string[] |
{ [id: string]: { node: ContentRecord<T>; pathToParentFolder: string[]; }; }
getAntMenuItemProps
Returns the part of an action's menuItem's props that should be forwarded to the Ant Design menu item
Argument | Type | Description |
---|---|---|
props | MenuItemProps<WidgetState, SelectionType> |
AntMenuItemProps
getCalculatedMeasures
Returns the expression of each calculated measure defined in mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | MdxDrillthrough |
{ [measureName: string]: MdxFormula; }
getContentNodes
Returns the nodes useful to display a ContentTree
.
Argument | Type | Description |
---|---|---|
structure | ContentRecord<T> | |
options | { rootNodeMetaData: T; areFilesVisible: boolean; getDragItem?: (id: string, metaData: T) => void; } |
getContentRecordAtPath
Returns the ContentRecord at path
in tree
.
Argument | Type | Description |
---|---|---|
{ tree, path, } | { tree?: ContentRecord<AMetaData> | null; path?: string[]; } |
ContentRecord<AMetaData> | undefined
getCube
Returns the cube identified by cubeName
in dataModel
.
Argument | Type | Description |
---|---|---|
dataModel | DataModel | |
cubeName | CubeName |
getCubeName
Returns the name of the cube used in mdx
, if any.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | MdxSubSelect | MdxDrillthrough | MdxFromClause |
getDimension
Returns the dimension identified by dimensionName
in cube
.
Argument | Type | Description |
---|---|---|
dimensionName | DimensionName | |
cube | Cube |
getDrawersTranslations
Returns the translations of all drawers for the given locale.
Argument | Type | Description |
---|---|---|
drawers | Drawer[] | null | |
locale | string |
{ [key in string]: string; }
getDrillthroughColumns
Returns the DrillthroughColumnUniqueName of each drillthrough column in mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxDrillthrough |
DrillthroughColumnUniqueName[]
getExpandedTuples
Returns the expanded tuples in mdx
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | MdxAxis | |
cube | Cube |
{ tupleCoordinates: TupleCoordinates; toLevel: LevelCoordinates; }[]
getFilters
Returns the filters expressed in mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | MdxSubSelect | MdxDrillthrough | |
{ cube } | { cube: Cube; } |
{ mdx: Mdx; paths: (string | number)[][]; }[]
getHierarchy
Returns the hierarchy identified by hierarchyCoordinates
in cube
.
Argument | Type | Description |
---|---|---|
hierarchyCoordinates | HierarchyCoordinates | |
cube | Cube |
getLayoutPath
Returns the layoutPath of the widget identified by leafKey
in layout
.
Argument | Type | Description |
---|---|---|
layout | Layout | |
leafKey | string |
number[]
getLevel
Returns the level identified by levelCoordinates
in cube
.
Argument | Type | Description |
---|---|---|
levelCoordinates | LevelCoordinates | |
cube | Cube |
getLevels
Returns the coordinates of every level used in mdx
.
Argument | Type | Description |
---|---|---|
mdx | Mdx | |
{ cube } | { cube: Cube; } |
getMeasure
Returns the measure identified by measureName
in cube
.
Argument | Type | Description |
---|---|---|
measureName | string | |
cube | Cube |
Measure | undefined
getMeasures
Returns the names of the measures used in the axes of mdx
. Does not return duplicate measures.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect |
{ measureName: MeasureName; }[]
getMeasuresAxisName
Returns the name of the axis of mdx
containing the measures.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect |
getMetaData
Returns a dashboard or a widget's metadata, useful to display its corresponding node in a ContentTree.
Argument | Type | Description |
---|---|---|
node | ContentRecord<MetaData> | |
id | string |
MetaData
getNewPageKey
Returns the next page key based on the existing page keys.
Argument | Type | Description |
---|---|---|
pagesOrder | string[] |
string
getNode
Returns a reference to the node at the given path
Argument | Type | Description |
---|---|---|
tree | TreeObject<T> | |
path | number[] |
TreeObject<T>
getOwnersAndReaders
Returns the ContentEntry owners and readers corresponding to the given permissions
. - Permissions of type "editor" are converted to "owners". - Permissions of type "reader" are converted both to "owners" and "readers". - The current user is added both as "owner" and "reader".
Argument | Type | Description |
---|---|---|
permissions | Permission[] | |
currentUserName | string |
{ owners: string[]; readers: string[]; }
getOwnersAndReadersForNewFile
Returns the ContentEntry owners and readers for a new file or folder.
The reasoning is as follows: - if the user is not allowed to share, then she is the only owner/reader for the file being created and is not allowed to edit those permissions. - if the user is allowed to share.. - ..and is saving at the root, then she is initially the only owner/reader for the file being created, but is allowed to edit those permissions. - ..and is saving under a folder, then the file being created initially inherits the permissions of that folder, and its permissions are editable.
Argument | Type | Description |
---|---|---|
{ currentUserName, canShare, parentFolderOwners, parentFolderReaders, isParentFolderRoot, } | { currentUserName: string; canShare: boolean; parentFolderOwners: string[]; parentFolderReaders: string[]; isParentFolderRoot: boolean; } |
{ owners: string[]; readers: string[]; }
getPage
Returns the page with the specified key in the dashboard.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState | null | undefined | |
pageKey | string | null |
DashboardPageState | undefined
getPathToFolder
Looks for the file with the given id in tree
and returns the path (of ids) to its parent folder.
Argument | Type | Description |
---|---|---|
tree | ContentRecord | |
id | string |
string[] | undefined
getPermissions
Returns an array of Permission corresponding to the given ContentEntry owners and readers, meant to be displayed in a
- Owners are converted to editor permissions. - Readers that are not in the list of owners are converted to reader permissions. The readers that are also owners are ignored. - The current user is stripped both from the editors and readers: it is always granted implicitly, and does not need to be displayed.
Argument | Type | Description |
---|---|---|
{ currentUserName, owners, readers, } | { currentUserName: string; owners: string[]; readers: string[]; } |
getPermissionsForNewFile
Returns the initial permissions that should be displayed in a
when creating a new file or folder.See getOwnersAndReadersForNewFile.
Argument | Type | Description |
---|---|---|
args | { currentUserName: UserName; canShare: boolean; parentFolderOwners: string[]; parentFolderReaders: string[]; isParentFolderRoot: boolean; } |
getPluginsTranslations
Returns the translations of all plugins for the given locale
Argument | Type | Description |
---|---|---|
plugins | { [key in PluginType]?: PluginsOfType<APlugin>; } | null | |
locale | string |
{ [key in string]: string; }
getPrefixedLocalStorageKey
Returns key
, prefixed with the application's name, in order to avoid conflicts on the domain where it is deployed.
Argument | Type | Description |
---|---|---|
key | string |
string
getSort
Returns the OrderMode defining the sort and the LevelCoordinates if it is alphabetical or the TupleCoordinates if it is numerical. Returns undefined
if mdx
is not sorted.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube } | { cube: Cube; } |
({ orderMode: OrderMode; } & ({ tupleCoordinates: TupleCoordinates; } | { levelCoordinates: LevelCoordinates; })) | undefined
getWidget
Returns the widget with the specified key in the page at the specified index of the dashboard.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState | null | undefined | |
pageKey | string | null | |
leafKey | string | null |
AWidgetState | undefined
isActionInDashboard
An action can be used in or outside a dashboard. Some actions make sense in any context (e.g. "sort the current widget"). Some others only make sense in a dashboard (e.g. "remove widget"). This function returns whether the action is being used in a dashboard.
Argument | Type | Description |
---|---|---|
props | ActionProps<WidgetState, SelectionType> |
props is WidgetInDashboardActionProps<WidgetState, SelectionType>
isDimensionNode
Returns whether node
is a DimensionNode.
Argument | Type | Description |
---|---|---|
node | DataModelNode |
node is DimensionNode
isDraggedDimension
Returns whether the given drag item represents a dimension dragged from the data model tree.
Argument | Type | Description |
---|---|---|
item | { type: string; } & any |
item is DimensionDraggedFromDataModelTree
isDraggedHierarchy
Returns whether the given drag item represents a hierarchy dragged from the data model tree.
Argument | Type | Description |
---|---|---|
item | { type: string; } & any |
item is HierarchyDraggedFromDataModelTree
isDraggedLevel
Returns whether the given drag item represents a level dragged from the data model tree.
Argument | Type | Description |
---|---|---|
item | { type: string; } & any |
item is LevelDraggedFromDataModelTree
isDraggedMeasure
Returns whether the given drag item represents a measure dragged from the data model tree.
Argument | Type | Description |
---|---|---|
item | { type: string; } & any |
item is MeasureDraggedFromDataModelTree
isFieldDraggedFromDataModelTree
Returns whether the given drag item represents a dimension, hierarchy, level or measure dragged from the data model tree.
Argument | Type | Description |
---|---|---|
item | { type: string; } & any |
item is FieldDraggedFromDataModelTree
isHierarchyNode
Returns whether node
is a HierarchyNode.
Argument | Type | Description |
---|---|---|
node | DataModelNode |
node is HierarchyNode
isLevelNode
Returns whether node
is a LevelNode.
Argument | Type | Description |
---|---|---|
node | DataModelNode |
node is LevelNode
isMeasureNode
Returns whether node
is a MeasureNode.
Argument | Type | Description |
---|---|---|
node | DataModelNode |
node is MeasureNode
isWidgetInDashboard
Returns whether props
are the properties of a widget in a dashboard. In this case, it contains a "dashboardState" and a "pageKey" attribute.
Argument | Type | Description |
---|---|---|
props | WidgetPluginProps<T, SelectionType> |
props is WidgetPluginInDashboardProps<T, SelectionType>
isWidgetWithQueryState
Returns whether widgetState
is a WidgetWithQueryState.
Argument | Type | Description |
---|---|---|
widgetState | AWidgetState<T> |
widgetState is WidgetWithQueryState<MdxType, T>
moveAllMeasures
Returns a new MdxSelect corresponding to mdx
where all measures were moved to indexOnAxis
on the axis with axisName
. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ axisName, cube, indexOnAxis, shouldCreateNonEmptyAxis, } | { axisName?: AxisName; cube: Cube; indexOnAxis?: number; shouldCreateNonEmptyAxis?: boolean; } |
moveDrillthroughColumn
Returns a new MdxDrillthrough corresponding to mdx
where the column identified by drillthroughColumnUniqueName
has been moved to index
. Does not mutate mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxDrillthrough | |
{ drillthroughColumnUniqueName, index, } | { drillthroughColumnUniqueName: string; index: number; } |
moveLevel
Returns a new MdxSelect corresponding to mdx
where the given level is moved at indexOnAxis
on the axis with axisName
. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, dimensionName, hierarchyName, levelName, axisName, indexOnAxis, shouldCreateNonEmptyAxis, } | { cube: Cube; dimensionName: DimensionName; hierarchyName: HierarchyName; levelName: LevelName; axisName?: AxisName; indexOnAxis: number; shouldCreateNonEmptyAxis?: boolean; } |
moveMeasure
Returns a new MdxSelect corresponding to mdx
where the given measure was moved to measureIndex
. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
options | { cube: Cube; measureName: MeasureName; measureIndex: number; shouldCreateNonEmptyAxis?: boolean; } |
moveWidget
Returns a new dashboard with the given widget moved from the specified origin to the specified target. Does not mutate dashboard.
Argument | Type | Description |
---|---|---|
{ dashboardState, originLayoutPath, pageKey, side, targetLayoutPath, } | { dashboardState: DashboardState; originLayoutPath: number[]; pageKey: string; side: Side; targetLayoutPath: number[]; } |
parse
Returns the Mdx abstract syntax tree corresponding to mdxString
Argument | Type | Description |
---|---|---|
mdxString | MdxString |
T
Throws:MdxError when mdxString
does not represent a valid Mdx query.
ping
Pings the server at the given URL.
Argument | Type | Description |
---|---|---|
serverUrl | string | |
serviceVersion | ServiceVersion | |
options | RequestInit |
Promise<void>
quote
Converts an array of strings into the corresponding stringified Mdx compound identifier.
Argument | Type | Description |
---|---|---|
path | string[] |
removeAllMeasures
Returns a new MdxSelect corresponding to mdx
where all measures were removed. Does not mutate mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, shouldRemoveCalculatedMeasureExpression, } | { cube: Cube; shouldRemoveCalculatedMeasureExpression?: boolean; } |
removeDrillthroughColumn
Returns a new MdxDrillthrough corresponding to mdx
where the column identified by drillthroughColumnUniqueName
was removed. Does not mutate mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxDrillthrough | |
{ drillthroughColumnUniqueName, } | { drillthroughColumnUniqueName: DrillthroughColumnUniqueName; } |
removeLevel
Returns a new MdxSelect corresponding to mdx
where the given level was removed. Does not mutate mdx
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, dimensionName, hierarchyName, levelName, } | { cube: Cube; dimensionName: string; hierarchyName: string; levelName: string; } |
removeMeasure
Returns a new MdxSelect corresponding to mdx
where the given measure was removed. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, measureName, shouldRemoveCalculatedMeasureExpression, } | { cube: Cube; measureName: string; shouldRemoveCalculatedMeasureExpression?: boolean; } |
removePage
Returns a new DashboardState corresponding to dashboardState
from which the page identified by pageKey
was removed. Does not mutate dashboardState
.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState | |
pageKey | string |
removeSort
Returns a new MdxSelect corresponding to mdx
, unsorted. Does not mutate mdx
.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect |
removeWidget
Returns a new dashboard with the widget at the specified location removed. Does not mutate dashboard.
Argument | Type | Description |
---|---|---|
{ dashboardState, layoutPath, pageKey, leafKey, } | { dashboardState: DashboardState; layoutPath: number[]; pageKey: string; leafKey: string; } |
search
Returns the matches corresponding to searchValue
within list
. Uses a fuzzy search algorithm. See https://fusejs.io/.
Argument | Type | Description |
---|---|---|
list | T[] | |
searchValue | string | |
options | Partial<FuseOptions<T>> |
T[]
serializeDashboardState
Returns a new dashboard state where: - all MDX AST objects of filters and queries are replaced by their stringified versions - all data visualization widget mappings are serialized. Does not mutate the passed dashboard state.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState<"deserialized"> |
DashboardState<"serialized">
serializeWidgetState
Accepts a deserialized widgetState
, as it lives in the state of Dashboard and returns its serialized version, ready to be saved on a content server.
Argument | Type | Description |
---|---|---|
widgetState | AWidgetState<"deserialized"> |
AWidgetState<"serialized">
setCubeName
Returns a new MdxSelect or MdxDrillthrough corresponding to mdx
with cubeName
updated as required. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | MdxDrillthrough | |
{ cubeName } | { cubeName: string; } |
setFilters
Returns a new MdxSelect or MdxDrillthrough corresponding to mdx
where the filters were set to mdxFilters
. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | MdxDrillthrough | |
{ filters, cube } | { filters: Mdx[]; cube: Cube; } |
setSort
Returns a new MdxSelect corresponding to mdx
, sorted as specified. Does not mutate mdx.
Argument | Type | Description |
---|---|---|
mdx | MdxSelect | |
{ cube, levelCoordinates, orderMode, tupleCoordinates, } | { cube: Cube; levelCoordinates?: LevelCoordinates; orderMode: OrderMode; tupleCoordinates?: TupleCoordinates; } |
sortTree
Returns a new tree, corresponding to tree
recursively sorted using comparator
. Does not mutate tree
.
Argument | Type | Description |
---|---|---|
tree | TreeObject<NodeType> | |
comparator | (nodeA: NodeType, nodeB: NodeType) => number |
TreeObject<NodeType>
sortTreeAlphabeticallyAndFoldersFirst
Returns a new tree, corresponding to tree
recursively sorted alphabetically and folders first. Does not mutate tree
.
Argument | Type | Description |
---|---|---|
tree | TreeObject<NodeType> |
TreeObject<NodeType>
stringify
Returns the Mdx string corresponding to mdx
Argument | Type | Description |
---|---|---|
mdx | Mdx | |
options | { indent?: boolean; } | |
indenter | GenericIndenter |
Title
A component that wraps antd's Title and allows us to customize its style.
Argument | Type | Description |
---|---|---|
{ level, disabled, ...otherProps } | TitleProps |
JSX.Element
unquote
Converts a stringified Mdx compound identifier into the corresponding array of strings.
Argument | Type | Description |
---|---|---|
str | MdxString |
string[]
For example:updatePage
Updates the page with the specified key in the dashboard. Does not mutate dashboard.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState | |
pageKey | string | |
updater | (page: DashboardPageState) => void |
updateWidget
Updates the widget with the specified key in the specified page in the dashboard. Does not mutate dashboard.
Argument | Type | Description |
---|---|---|
dashboardState | DashboardState | |
{ pageKey, leafKey, } | { pageKey: string; leafKey: string; } | |
updater | (widget: WidgetState) => WidgetState |
withQueryResult
Runs the widget's query and provides its result to the underlying component. The component is wrapped with an
to ensure that it is not unmounted when there is a query error (which in most cases would lead to the query being unregistered, making the error unrecoverable).Argument | Type | Description |
---|---|---|
WrappedComponent | ComponentType<WidgetWithQueryProps<WidgetState, CellSet, Selection>> |
ComponentType<WidgetPluginProps<WidgetState, Selection>>