mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -05:00
feat: useQlikApi
This commit is contained in:
@@ -265,6 +265,7 @@ const loadType = async ({
|
||||
app,
|
||||
selections,
|
||||
nebbie,
|
||||
qlikApi,
|
||||
focusHandler,
|
||||
emitter,
|
||||
onMount,
|
||||
@@ -277,6 +278,7 @@ const loadType = async ({
|
||||
app,
|
||||
selections,
|
||||
nebbie,
|
||||
qlikApi,
|
||||
focusHandler,
|
||||
emitter,
|
||||
navigation,
|
||||
@@ -317,7 +319,7 @@ const Cell = forwardRef(
|
||||
ref
|
||||
) => {
|
||||
const { app, types } = halo;
|
||||
const { nebbie } = halo.public;
|
||||
const { nebbie, qlikApi } = halo.public;
|
||||
const {
|
||||
theme: themeName,
|
||||
translator,
|
||||
@@ -423,6 +425,7 @@ const Cell = forwardRef(
|
||||
app,
|
||||
selections,
|
||||
nebbie,
|
||||
qlikApi,
|
||||
focusHandler: focusHandler.current,
|
||||
emitter,
|
||||
onMount,
|
||||
|
||||
@@ -77,9 +77,14 @@ const DEFAULT_SNAPSHOT_CONFIG = /** @lends SnapshotConfiguration */ {
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* @interface QlikApi
|
||||
*/
|
||||
|
||||
/**
|
||||
* @interface Configuration
|
||||
* @property {Function(LoadType):Promise<Visualization>=} load Fallback load function for missing types
|
||||
* @property {QlikApi=} qlikApi Instance of qlik api to pass into visualizations
|
||||
* @property {Context=} context Settings for the rendering instance
|
||||
* @property {Array<TypeInfo>=} types Visualization types to register
|
||||
* @property {Array<ThemeInfo>=} themes Themes to register
|
||||
@@ -112,6 +117,7 @@ const DEFAULT_SNAPSHOT_CONFIG = /** @lends SnapshotConfiguration */ {
|
||||
*/
|
||||
|
||||
const DEFAULT_CONFIG = {
|
||||
qlikApi: undefined,
|
||||
context: {},
|
||||
load: () => undefined,
|
||||
types: [],
|
||||
@@ -243,6 +249,7 @@ function nuked(configuration = {}) {
|
||||
theme: appTheme.externalAPI,
|
||||
translator: locale.translator,
|
||||
nebbie: null, // actual value is set further down
|
||||
qlikApi: configuration.qlikApi,
|
||||
};
|
||||
|
||||
const halo = {
|
||||
|
||||
@@ -37,6 +37,7 @@ export {
|
||||
useInteractionState,
|
||||
useOptions,
|
||||
useEmbed,
|
||||
useQlikApi,
|
||||
useRenderState,
|
||||
useEmitter,
|
||||
onTakeSnapshot,
|
||||
|
||||
@@ -69,6 +69,7 @@ function createWithHooks(generator, opts, galaxy) {
|
||||
model: opts.model,
|
||||
app: opts.app,
|
||||
global: qGlobal,
|
||||
qlikApi: opts.qlikApi,
|
||||
selections: opts.selections,
|
||||
nebbie: opts.nebbie,
|
||||
element: undefined, // set on mount
|
||||
|
||||
@@ -743,6 +743,21 @@ export function useEmbed() {
|
||||
return useInternalContext('nebbie');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the possible qlik api instance provided
|
||||
* @entry
|
||||
* @since 5.5.0
|
||||
* @returns {QlikApi} The qlik api instance provided to Nebula
|
||||
* @example
|
||||
* import { useQlikApi } from '@nebula.js/stardust';
|
||||
*
|
||||
* const api = useQlikApi();
|
||||
* api.render(...)
|
||||
*/
|
||||
export function useQlikApi() {
|
||||
return useInternalContext('qlikApi');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translator.
|
||||
* @entry
|
||||
|
||||
@@ -29,6 +29,7 @@ export {
|
||||
useKeyboard,
|
||||
useOptions,
|
||||
useEmbed,
|
||||
useQlikApi,
|
||||
useRenderState,
|
||||
useEmitter,
|
||||
onTakeSnapshot,
|
||||
|
||||
Reference in New Issue
Block a user