Prefer type and expose in public API.

Signed-off-by: Aramis Sennyey <sennyeya@amazon.com>
This commit is contained in:
Aramis Sennyey
2023-02-03 10:18:19 -05:00
parent a6dba7dde1
commit 21c31d742a
4 changed files with 38 additions and 36 deletions
+30 -32
View File
@@ -65,19 +65,16 @@ export enum Direction {
}
// @public
export const EntityCatalogGraphCard: (props: {
variant?: InfoCardVariants | undefined;
relationPairs?: RelationPairs | undefined;
maxDepth?: number | undefined;
unidirectional?: boolean | undefined;
mergeRelations?: boolean | undefined;
kinds?: string[] | undefined;
relations?: string[] | undefined;
direction?: Direction | undefined;
height?: number | undefined;
title?: string | undefined;
zoom?: 'disabled' | 'enabled' | 'enable-on-click' | undefined;
}) => JSX.Element;
export const EntityCatalogGraphCard: (
props: Omit<
EntityRelationsGraphProps,
'className' | 'onNodeClick' | 'rootEntityNames'
> & {
variant?: InfoCardVariants | undefined;
height?: number | undefined;
title?: string | undefined;
},
) => JSX.Element;
// @public
export type EntityEdge = DependencyGraphTypes.DependencyEdge<EntityEdgeData>;
@@ -103,26 +100,27 @@ export type EntityNodeData = {
};
// @public
export const EntityRelationsGraph: (props: {
export const EntityRelationsGraph: (
props: EntityRelationsGraphProps,
) => JSX.Element;
// @public (undocumented)
export type EntityRelationsGraphProps = {
rootEntityNames: CompoundEntityRef | CompoundEntityRef[];
maxDepth?: number | undefined;
unidirectional?: boolean | undefined;
mergeRelations?: boolean | undefined;
kinds?: string[] | undefined;
relations?: string[] | undefined;
direction?: Direction | undefined;
onNodeClick?:
| ((value: EntityNode, event: MouseEvent_2<unknown>) => void)
| undefined;
relationPairs?: RelationPairs | undefined;
className?: string | undefined;
zoom?: 'disabled' | 'enabled' | 'enable-on-click' | undefined;
renderNode?: DependencyGraphTypes.RenderNodeFunction<EntityNode> | undefined;
renderLabel?:
| DependencyGraphTypes.RenderLabelFunction<EntityEdge>
| undefined;
curve?: 'curveStepBefore' | 'curveMonotoneX' | undefined;
}) => JSX.Element;
maxDepth?: number;
unidirectional?: boolean;
mergeRelations?: boolean;
kinds?: string[];
relations?: string[];
direction?: Direction;
onNodeClick?: (value: EntityNode, event: MouseEvent_2<unknown>) => void;
relationPairs?: RelationPairs;
className?: string;
zoom?: 'enabled' | 'disabled' | 'enable-on-click';
renderNode?: DependencyGraphTypes.RenderNodeFunction<EntityNode>;
renderLabel?: DependencyGraphTypes.RenderLabelFunction<EntityEdge>;
curve?: 'curveStepBefore' | 'curveMonotoneX';
};
// @public
export type RelationPairs = [string, string][];
@@ -132,12 +132,12 @@ export const CatalogGraphCard = (
<EntityRelationsGraph
{...props}
rootEntityNames={entityName}
onNodeClick={onNodeClick}
className={classes.graph}
maxDepth={maxDepth}
unidirectional={unidirectional}
mergeRelations={mergeRelations}
direction={direction}
onNodeClick={onNodeClick}
className={classes.graph}
relationPairs={relationPairs}
zoom={zoom}
/>
@@ -66,7 +66,10 @@ const useStyles = makeStyles(
{ name: 'PluginCatalogGraphEntityRelationsGraph' },
);
export interface EntityRelationsGraphProps {
/**
* @public
*/
export type EntityRelationsGraphProps = {
rootEntityNames: CompoundEntityRef | CompoundEntityRef[];
maxDepth?: number;
unidirectional?: boolean;
@@ -81,7 +84,7 @@ export interface EntityRelationsGraphProps {
renderNode?: DependencyGraphTypes.RenderNodeFunction<EntityNode>;
renderLabel?: DependencyGraphTypes.RenderLabelFunction<EntityEdge>;
curve?: 'curveStepBefore' | 'curveMonotoneX';
}
};
/**
* Core building block for custom entity relations diagrams.
@@ -14,6 +14,7 @@
* limitations under the License.
*/
export { EntityRelationsGraph } from './EntityRelationsGraph';
export type { EntityRelationsGraphProps } from './EntityRelationsGraph';
export { ALL_RELATION_PAIRS } from './relations';
export type { RelationPairs } from './relations';
export { Direction } from './types';