diff --git a/api-generator/components/chart.js b/api-generator/components/chart.js index c60869bca..2cd31d4e2 100644 --- a/api-generator/components/chart.js +++ b/api-generator/components/chart.js @@ -34,6 +34,12 @@ const ChartProps = [ type: 'number', default: '150', description: 'Height of the chart in non-responsive mode.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/chart/Chart.d.ts b/components/lib/chart/Chart.d.ts index 25227eaee..2ea6c838c 100755 --- a/components/lib/chart/Chart.d.ts +++ b/components/lib/chart/Chart.d.ts @@ -10,6 +10,37 @@ import { CanvasHTMLAttributes } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type ChartPassThroughOptionType = ChartPassThroughAttributes | ((options: ChartPassThroughMethodOptions) => ChartPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface ChartPassThroughMethodOptions { + props: ChartProps; +} + +/** + * Custom passthrough(pt) options. + * @see {@link ChartProps.pt} + */ +export interface ChartPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: ChartPassThroughOptionType; + /** + * Uses to pass attributes to the canvas's DOM element. + */ + canvas?: ChartPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface ChartPassThroughAttributes { + [key: string]: any; +} + /** * Custom select event. * @see {@link ChartEmits.select} @@ -63,6 +94,11 @@ export interface ChartProps { * Uses to pass all properties of the CanvasHTMLAttributes to canvas element inside the component. */ canvasProps?: CanvasHTMLAttributes | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {ChartPassThroughOptions} + */ + pt?: ChartPassThroughOptions; } export interface ChartSlots {} diff --git a/components/lib/chart/Chart.vue b/components/lib/chart/Chart.vue index a3b6fa893..1de5f969d 100755 --- a/components/lib/chart/Chart.vue +++ b/components/lib/chart/Chart.vue @@ -1,12 +1,15 @@