mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 20:19:05 +08:00
Menu: Mark menu components as internal (#30740)
* Menu: Mark menu components are internal * Update * minor fix
This commit is contained in:
@ -14,10 +14,10 @@ import {
|
|||||||
outerJoinDataFrames,
|
outerJoinDataFrames,
|
||||||
reduceField,
|
reduceField,
|
||||||
TimeRange,
|
TimeRange,
|
||||||
|
TimeZone,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { useTheme } from '../../themes';
|
import { useTheme } from '../../themes';
|
||||||
import { UPlotChart } from '../uPlot/Plot';
|
import { UPlotChart } from '../uPlot/Plot';
|
||||||
import { PlotProps } from '../uPlot/types';
|
|
||||||
import {
|
import {
|
||||||
AxisPlacement,
|
AxisPlacement,
|
||||||
DrawStyle,
|
DrawStyle,
|
||||||
@ -41,12 +41,18 @@ export interface XYFieldMatchers {
|
|||||||
x: FieldMatcher; // first match
|
x: FieldMatcher; // first match
|
||||||
y: FieldMatcher;
|
y: FieldMatcher;
|
||||||
}
|
}
|
||||||
export interface GraphNGProps extends Omit<PlotProps, 'data' | 'config'> {
|
|
||||||
|
export interface GraphNGProps {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
data: DataFrame[];
|
data: DataFrame[];
|
||||||
|
timeRange: TimeRange;
|
||||||
legend: VizLegendOptions;
|
legend: VizLegendOptions;
|
||||||
|
timeZone: TimeZone;
|
||||||
fields?: XYFieldMatchers; // default will assume timeseries data
|
fields?: XYFieldMatchers; // default will assume timeseries data
|
||||||
onLegendClick?: (event: GraphNGLegendEvent) => void;
|
onLegendClick?: (event: GraphNGLegendEvent) => void;
|
||||||
onSeriesColorChange?: (label: string, color: string) => void;
|
onSeriesColorChange?: (label: string, color: string) => void;
|
||||||
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultConfig: GraphFieldConfig = {
|
const defaultConfig: GraphFieldConfig = {
|
||||||
|
@ -6,6 +6,7 @@ import { styleMixins, useStyles } from '../../themes';
|
|||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
import { IconName } from '../../types';
|
import { IconName } from '../../types';
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
export interface MenuItem {
|
export interface MenuItem {
|
||||||
/** Label of the menu item */
|
/** Label of the menu item */
|
||||||
label: string;
|
label: string;
|
||||||
@ -23,6 +24,7 @@ export interface MenuItem {
|
|||||||
active?: boolean;
|
active?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
export interface MenuItemsGroup {
|
export interface MenuItemsGroup {
|
||||||
/** Label for the menu items group */
|
/** Label for the menu items group */
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -30,6 +32,7 @@ export interface MenuItemsGroup {
|
|||||||
items: MenuItem[];
|
items: MenuItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
export interface MenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
export interface MenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
/** React element rendered at the top of the menu */
|
/** React element rendered at the top of the menu */
|
||||||
header?: React.ReactNode;
|
header?: React.ReactNode;
|
||||||
@ -39,7 +42,7 @@ export interface MenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
|||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @alpha */
|
/** @internal */
|
||||||
export const Menu = React.forwardRef<HTMLDivElement, MenuProps>(({ header, items, onClose, ...otherProps }, ref) => {
|
export const Menu = React.forwardRef<HTMLDivElement, MenuProps>(({ header, items, onClose, ...otherProps }, ref) => {
|
||||||
const styles = useStyles(getMenuStyles);
|
const styles = useStyles(getMenuStyles);
|
||||||
const onClick = useCallback(() => {
|
const onClick = useCallback(() => {
|
||||||
|
@ -23,7 +23,7 @@ export interface PlotProps {
|
|||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
config: UPlotConfigBuilder;
|
config: UPlotConfigBuilder;
|
||||||
children?: React.ReactElement[];
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class PlotConfigBuilder<P, T> {
|
export abstract class PlotConfigBuilder<P, T> {
|
||||||
|
@ -55,12 +55,10 @@ export const TimeSeriesPanel: React.FC<TimeSeriesPanelProps> = ({
|
|||||||
<TooltipPlugin mode={options.tooltipOptions.mode} timeZone={timeZone} />
|
<TooltipPlugin mode={options.tooltipOptions.mode} timeZone={timeZone} />
|
||||||
<ZoomPlugin onZoom={onChangeTimeRange} />
|
<ZoomPlugin onZoom={onChangeTimeRange} />
|
||||||
<ContextMenuPlugin timeZone={timeZone} replaceVariables={replaceVariables} />
|
<ContextMenuPlugin timeZone={timeZone} replaceVariables={replaceVariables} />
|
||||||
{data.annotations ? (
|
{data.annotations && (
|
||||||
<ExemplarsPlugin exemplars={data.annotations} timeZone={timeZone} getFieldLinks={getFieldLinks} />
|
<ExemplarsPlugin exemplars={data.annotations} timeZone={timeZone} getFieldLinks={getFieldLinks} />
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
{data.annotations ? <AnnotationsPlugin annotations={data.annotations} timeZone={timeZone} /> : <></>}
|
{data.annotations && <AnnotationsPlugin annotations={data.annotations} timeZone={timeZone} />}
|
||||||
</GraphNG>
|
</GraphNG>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user