]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Move tooltip plugin hooks to the core Plugin type (#8160)
authorEvert Timberg <evert.timberg+github@gmail.com>
Thu, 17 Dec 2020 23:10:29 +0000 (18:10 -0500)
committerGitHub <noreply@github.com>
Thu, 17 Dec 2020 23:10:29 +0000 (18:10 -0500)
* Move tooltip plugin hooks to the core
* Try and use declaration merging for Plugin type
* Merge Plugin types

types/core/index.d.ts
types/plugins/index.d.ts

index 0359e31b04fb63cd05801e12d06de63ba3c27701..c0bee8ba664f64387cf98c5105e079c57fa923d8 100644 (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;
 
        /**
index dc53806ba9cbd58cf1f914070b7724c04b5aa89b..3c2ee6b5347acb24209a1919dd848b893cf12a18 100644 (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?