devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
202 lines (194 loc) • 9.98 kB
TypeScript
/**
* DevExtreme (viz/core/base_widget.d.ts)
* Version: 20.1.7
* Build date: Tue Aug 25 2020
*
* Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import '../../jquery_augmentation';
import DOMComponent, {
DOMComponentOptions
} from '../../core/dom_component';
import {
dxElement
} from '../../core/element';
import {
format
} from '../../ui/widget/ui.widget';
import {
DashStyleType
} from '../common';
/** Warning! This type is used for internal purposes. Do not import it directly. */
export type WordWrapType = 'normal' | 'breakWord' | 'none';
/** Warning! This type is used for internal purposes. Do not import it directly. */
export type VizTextOverflowType = 'ellipsis' | 'hide' | 'none';
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface BaseWidgetOptions<T = BaseWidget> extends DOMComponentOptions<T> {
/** Specifies whether the widget responds to user interaction. */
disabled?: boolean;
/** Configures the exporting and printing features. */
export?: BaseWidgetExport;
/** Configures the loading indicator. */
loadingIndicator?: BaseWidgetLoadingIndicator;
/** Generates space around the widget. */
margin?: BaseWidgetMargin;
/** A function that is executed when the widget's rendering has finished. */
onDrawn?: ((e: { component?: T, element?: dxElement, model?: any }) => any);
/** A function that is executed after the widget is exported. */
onExported?: ((e: { component?: T, element?: dxElement, model?: any }) => any);
/** A function that is executed before the widget is exported. */
onExporting?: ((e: { component?: T, element?: dxElement, model?: any, fileName?: string, cancel?: boolean, format?: string }) => any);
/** A function that is executed before a file with exported widget is saved to the user's local storage. */
onFileSaving?: ((e: { component?: T, element?: dxElement, fileName?: string, format?: string, data?: Blob, cancel?: boolean }) => any);
/** A function that is executed when an error or warning occurs. */
onIncidentOccurred?: ((e: { component?: T, element?: dxElement, model?: any, target?: any }) => any);
/** Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */
pathModified?: boolean;
/** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */
redrawOnResize?: boolean;
/** Switches the widget to a right-to-left representation. */
rtlEnabled?: boolean;
/** Specifies the widget's size in pixels. */
size?: BaseWidgetSize;
/** Sets the name of the theme the widget uses. */
theme?: 'generic.dark' | 'generic.light' | 'generic.contrast' | 'ios7.default' | 'generic.carmine' | 'generic.darkmoon' | 'generic.darkviolet' | 'generic.greenmist' | 'generic.softblue' | 'material.blue.light' | 'material.lime.light' | 'material.orange.light' | 'material.purple.light' | 'material.teal.light';
/** Configures the widget's title. */
title?: BaseWidgetTitle | string;
/** Configures tooltips - small pop-up rectangles that display information about a data-visualizing widget element being pressed or hovered over with the mouse pointer. */
tooltip?: BaseWidgetTooltip;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface BaseWidgetExport {
/** Specifies the color that will fill transparent regions in the resulting file or document. */
backgroundColor?: string;
/** Enables the client-side exporting in the widget. */
enabled?: boolean;
/** Specifies a default name for the file to which the widget will be exported. */
fileName?: string;
/** Specifies a set of export formats. */
formats?: Array<'GIF' | 'JPEG' | 'PDF' | 'PNG' | 'SVG'>;
/** Adds an empty space around the exported widget; measured in pixels. */
margin?: number;
/** Enables the printing feature in the widget. Applies only if the export.enabled option is true. */
printingEnabled?: boolean;
/** @deprecated [important] Since v10, Safari browser supports API for saving files, and this option is no longer required. */
/** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable exporting in the Safari browser. */
proxyUrl?: string;
/** A function that renders SVG markup on the HTML canvas. Required to export custom SVG elements (for example, markerTemplate). */
svgToCanvas?: ((svg: SVGElement, canvas: HTMLCanvasElement) => Promise<void> | JQueryPromise<void>);
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface BaseWidgetLoadingIndicator {
/** Colors the background of the loading indicator. */
backgroundColor?: string;
/** Specifies whether the loading indicator should be displayed and hidden automatically. */
enabled?: boolean;
/** Specifies font options for the loading indicator. */
font?: Font;
/** Allows you to change the loading indicator's visibility. */
show?: boolean;
/** Specifies the text to be displayed by the loading indicator. */
text?: string;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface BaseWidgetMargin {
/** Specifies the bottom margin of the widget in pixels. */
bottom?: number;
/** Specifies the left margin of the widget in pixels. */
left?: number;
/** Specifies the right margin of the widget in pixels. */
right?: number;
/** Specifies the top margin of the widget in pixels. */
top?: number;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface BaseWidgetSize {
/** Specifies the height of the widget in pixels. */
height?: number;
/** Specifies the width of the widget in pixels. */
width?: number;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface BaseWidgetTitle {
/** Specifies font options for the title. */
font?: Font;
/** Specifies the title's alignment in a horizontal direction. */
horizontalAlignment?: 'center' | 'left' | 'right';
/** Generates space around the title. */
margin?: number | { bottom?: number, left?: number, right?: number, top?: number };
/** Reserves a pixel-measured space for the title. */
placeholderSize?: number;
/** Configures the widget's subtitle. */
subtitle?: { font?: Font, offset?: number, text?: string, textOverflow?: VizTextOverflowType, wordWrap?: WordWrapType } | string;
/** Specifies the title's text. */
text?: string;
/** Specifies what to do with the title when it overflows the allocated space after applying wordWrap: hide, truncate it and display an ellipsis, or do nothing. */
textOverflow?: VizTextOverflowType;
/** Specifies the title's alignment in a vertical direction. */
verticalAlignment?: 'bottom' | 'top';
/** Specifies how to wrap the title if it does not fit into a single line. */
wordWrap?: WordWrapType;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface BaseWidgetTooltip {
/** Specifies the length of a tooltip's arrow in pixels. */
arrowLength?: number;
/** Configures a tooltip's border. */
border?: { color?: string, dashStyle?: DashStyleType, opacity?: number, visible?: boolean, width?: number };
/** Colors all tooltips. */
color?: string;
/** Specifies the container in which to draw tooltips. The default container is the HTML DOM `` element. */
container?: string | Element | JQuery;
/** Makes all the tooltip's corners rounded. */
cornerRadius?: number;
/** Enables tooltips. */
enabled?: boolean;
/** Specifies tooltips' font options. */
font?: Font;
/** Formats a value before it is displayed it in a tooltip. */
format?: format;
/** Specifies tooltips' transparency. */
opacity?: number;
/** Generates an empty space, measured in pixels, between a tooltip's left/right border and its text. */
paddingLeftRight?: number;
/** Generates an empty space, measured in pixels, between a tooltip's top/bottom border and its text. */
paddingTopBottom?: number;
/** Configures a tooltip's shadow. */
shadow?: { blur?: number, color?: string, offsetX?: number, offsetY?: number, opacity?: number };
/** Specifies a tooltip's z-index. */
zIndex?: number;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
/** This section describes options and methods that are common to all widgets. */
export default class BaseWidget extends DOMComponent {
constructor(element: Element, options?: BaseWidgetOptions)
constructor(element: JQuery, options?: BaseWidgetOptions)
/** Exports the widget. */
exportTo(fileName: string, format: string): void;
/** Gets the current widget size. */
getSize(): BaseWidgetSize;
/** Hides the loading indicator. */
hideLoadingIndicator(): void;
/** Opens the browser's print window. */
print(): void;
/** Redraws the widget. */
render(): void;
/** Shows the loading indicator. */
showLoadingIndicator(): void;
/** Gets the widget's SVG markup. */
svg(): string;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface Font {
/** Specifies font color. */
color?: string;
/** Specifies font family. */
family?: string;
/** Specifies font opacity. */
opacity?: number;
/** Specifies font size. */
size?: string | number;
/** Specifies font weight. Accepts values from 100 to 900 in increments of 100. Higher values increase boldness. */
weight?: number;
}