Skip to content

Instantly share code, notes, and snippets.

@m-rutter
Created August 8, 2018 12:37
Show Gist options
  • Save m-rutter/dfc997f233ff7d949252628c04f6a71a to your computer and use it in GitHub Desktop.
Save m-rutter/dfc997f233ff7d949252628c04f6a71a to your computer and use it in GitHub Desktop.
qdt-components declaration ts
declare module 'qdt-components' {
/**
* Qlik-powered components built by the Qlik Demo Team. For use with simple html, Angular6, React 16 and Vue 2
*/
export default class QdtComponents {
constructor(config: QdtConfig, connections?: QdtConnections);
/**
* Resolves to a Capabilities API App instance
*/
qAppPromise: Promise<AppAPI.IApp> | null;
/**
* Resolves to a Engine API App instance as implemented by engima.js
*/
qDocPromise: Promise<EngineAPI.IApp> | null;
/**
* Render a QdtComponent to a target element. Will internally handle the
* lifecycle of its Qlik objects
*
* @param props I'm too tried to actually document this. Some function
* overloading stuff. Read the docs/source
*/
render(
type: QdtComponentType,
props: any,
element: HTMLElement,
): Promise<void>;
}
/**
* QdtComponent types to use with render method on `QdtComponents`. Some of these
* aren't documented in the actual docs, and some of the documented ones
* aren't actually in the source code. This enum reflects what is actually
* in the lib.
*/
type QdtComponentType =
| 'QdtViz'
| 'QdtFilter'
| 'QdtCurrentSelections'
| 'QdtSelectionToolbar'
| 'QdtTable'
| 'QdtKpi'
| 'QdtButton'
| 'QdtPicasso'
| 'QdtSearch';
export interface QdtConnections {
/**
* If true QdtComponent will init a connection to the Qlik Server via the
* Capabilities API. It will directly modify the <head></head> tag to
* include css, fonts, and necessary javascript from the Qlik Server. Qlik
* Sense Desktop or Qlik Sense Server only.
*/
vizApi: boolean;
/**
* If true QdtComponent will init a connection to the Qlik Server via
* enigma.js, a lightweight `Promise` based implementation of the Engine
* APIs. Works on Qlik Sense Desktop, Qlik Sense Server, and Qlik Core.
*/
engineApi: boolean;
/**
* If set to a non-empty string will use that string in the `WebSocket` url
* path as /identity/:sessionID. Otherwise, will have an identity path with
* a randomly generated string. Basically controls how sessions are shared,
* which I cannot find docs for. Closest thing to docs:
* https://github.com/qlik-oss/enigma.js/blob/master/src/sense-utilities.js#L16
*/
useUniqueSessionID?: string;
}
export interface QdtConfig {
/**
* Qlik Server hostname
*/
host: string;
/**
* If true, then uses wss:// instead of ws://
*/
secure: boolean;
/**
* Port number for Qlik Server. For sense desktop its typically `4848`, and
* Server and Core is typically `443` or `80`
*/
port: number;
/**
* Config for Qlik proxy. If your Qlik server is using a proxy this prefixes
* the websocket url path with the proxy path. Use empty string in most cases.
*/
prefix: string;
/**
* Id for Qlik App. On Sense Desktop its the filename, whereas on Server or
* Core it is a UUID/GUID that is generated by the server.
*/
appId: string;
}
export interface QdtVizProps {
id?: string;
type?: string;
cols?: any[];
options?: any;
width?: string;
height?: string;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment