Move tooltip plugin hooks to the core Plugin type (#8160)

* Move tooltip plugin hooks to the core
* Try and use declaration merging for Plugin type
* Merge Plugin types
This commit is contained in:
Evert Timberg 2020-12-17 18:10:29 -05:00 committed by GitHub
parent b10d994017
commit b54bd272fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -25,7 +25,7 @@ import {
ScaleType
} from '../interfaces';
import { ElementChartOptions } from '../elements';
import { PluginOptions } from '../plugins';
import { ExtendedPlugin, PluginOptions } from '../plugins';
export interface DateAdapterBase {
/**
@ -564,7 +564,7 @@ export const layouts: {
update(chart: Chart, width: number, height: number): void;
};
export interface Plugin<O = {}> {
export interface Plugin<O = {}> extends ExtendedPlugin {
id: string;
/**

View File

@ -1,4 +1,4 @@
import { ActiveDataPoint, ActiveElement, Chart, Element, InteractionMode, LayoutPosition, Plugin } from '../core';
import { ActiveDataPoint, ActiveElement, Chart, Element, LayoutPosition } from 'core';
import { AnimationSpecContainer, Color, ChartArea, FontSpec, Scriptable, TextAlign, ChartEvent, CoreInteractionOptions } from '../core/interfaces';
import { PointStyle } from '../elements';
import { ChartData, ChartDataset } from '../interfaces';
@ -312,7 +312,7 @@ export interface TooltipCallbacks {
afterFooter(this: TooltipModel, tooltipItems: TooltipItem[]): string | string[];
}
export interface TooltipPlugin<O = {}> {
export interface ExtendedPlugin<O = {}> {
/**
* @desc Called before drawing the `tooltip`. If any plugin returns `false`,
* the tooltip drawing is cancelled until another `render` is triggered.
@ -333,7 +333,6 @@ export interface TooltipPlugin<O = {}> {
*/
afterTooltipDraw?(chart: Chart, args: { tooltip: TooltipModel }, options: O): void;
}
export interface TooltipOptions extends CoreInteractionOptions {
/**
* Are on-canvas tooltips enabled?