@google/dscc
Version:
`dscc` (Data Studio Community Component) is a library to help with the building of community components for Google Data Studio. It can be used as a standalone library, or as a npm dependency.
66 lines (62 loc) • 2.26 kB
TypeScript
/*!
@license
Copyright 2019 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { ClearInteraction, FieldsByConfigId, Message, ObjectTransform, SendInteraction, SubscriptionsOptions, TableTransform } from './types';
export * from './types';
/**
* Returns the width (in pixels) of the vis's iframe.
*
* Usage:
* ```
* var myWidth = dscc.getWidth();
* console.log('My width is: ', myWidth);
* ```
*/
export declare const getWidth: () => number;
/**
* Returns the height (in pixels) of the vis's iframe.
*
* Usage:
* ```
* var myHeight = dscc.getHeight();
* console.log('My height is: ', myHeight);
* ```
*/
export declare const getHeight: () => number;
/**
* Returns the componentId of the vis. Component ids uniquely identify a vis to
* Data Studio.
*
* Usage:
* ```
* var myComponentId = dscc.getComponentId();
* console.log('My componentId is: ', myComponentId);
* ```
*/
export declare const getComponentId: () => string;
/**
* Returns the fields indexed by their config id. Since many fields can be in
* the same `METRIC`/`DIMENSION` selection, `configId` is mapped to `Field[]`.
*/
export declare const fieldsByConfigId: (message: Message) => FieldsByConfigId;
/**
* The transform to use for data in a Table format. i.e. `[[1, 2, 3], [4, 5, 6]]`
*/
export declare const tableTransform: TableTransform;
/**
* The transform to use for data in an object format. i.e. `[{name: 'john', views: 3}, {name: 'suzie', views: 5}]`
*/
export declare const objectTransform: ObjectTransform;
export declare const subscribeToData: <T>(cb: (componentData: T) => void, options: SubscriptionsOptions<T>) => () => void;
export declare const sendInteraction: SendInteraction;
export declare const clearInteraction: ClearInteraction;