diff --git a/public/app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor.tsx b/public/app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor.tsx index 726eb17fff7..292b1df8b68 100644 --- a/public/app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor.tsx +++ b/public/app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor.tsx @@ -1,6 +1,6 @@ import { selectors } from '@grafana/e2e-selectors'; import { Field, Label } from '@grafana/ui'; -import React, { ComponentType, ReactNode } from 'react'; +import React, { ReactNode } from 'react'; import { OptionsPaneCategoryDescriptor } from './OptionsPaneCategoryDescriptor'; export interface OptionsPaneItemProps { @@ -8,7 +8,7 @@ export interface OptionsPaneItemProps { value?: any; description?: string; popularRank?: number; - Component: ComponentType; + render: () => React.ReactNode; skipField?: boolean; showIf?: () => boolean; } @@ -51,7 +51,7 @@ export class OptionsPaneItemDescriptor { } render(isSearching?: boolean) { - const { title, description, Component, showIf, skipField } = this.props; + const { title, description, render, showIf, skipField } = this.props; const key = `${this.parent.props.id} ${title}`; if (showIf && !showIf()) { @@ -59,7 +59,7 @@ export class OptionsPaneItemDescriptor { } if (skipField) { - return ; + return render(); } return ( @@ -69,7 +69,7 @@ export class OptionsPaneItemDescriptor { key={key} aria-label={selectors.components.PanelEditor.OptionsPane.fieldLabel(key)} > - + {render() as React.ReactElement} ); } diff --git a/public/app/features/dashboard/components/PanelEditor/getFieldOverrideElements.tsx b/public/app/features/dashboard/components/PanelEditor/getFieldOverrideElements.tsx index faa9cb00070..481b9325e71 100644 --- a/public/app/features/dashboard/components/PanelEditor/getFieldOverrideElements.tsx +++ b/public/app/features/dashboard/components/PanelEditor/getFieldOverrideElements.tsx @@ -110,7 +110,7 @@ export function getFieldOverrideCategories(props: OptionPaneRenderProps): Option category.addItem( new OptionsPaneItemDescriptor({ title: matcherUi.name, - Component: function renderMatcherUI() { + render: function renderMatcherUI() { return ( !!panel.repeat, - Component: function renderRepeatOptions() { + render: function renderRepeatOptions() { const directionOptions = [ { label: 'Horizontal', value: 'h' }, { label: 'Vertical', value: 'v' }, @@ -127,7 +127,7 @@ export function getPanelFrameCategory(props: OptionPaneRenderProps): OptionsPane new OptionsPaneItemDescriptor({ title: 'Max per row', showIf: () => Boolean(panel.repeat && panel.repeatDirection === 'h'), - Component: function renderOption() { + render: function renderOption() { const maxPerRowOptions = [2, 3, 4, 6, 8, 12].map((value) => ({ label: value.toString(), value })); return (