Move and make type public

Signed-off-by: Paul Stoker <pstoker@spotify.com>
This commit is contained in:
Paul Stoker
2023-11-17 17:09:22 +01:00
parent 8903ab5b04
commit 36bd2059f1
7 changed files with 25 additions and 18 deletions
+5 -2
View File
@@ -181,12 +181,15 @@ export const CatalogTable: {
}>;
};
// @public
export type CatalogTableColumnsFunc = (
entityListContext: EntityListContextProps,
) => TableColumn<CatalogTableRow>[];
// @public
export interface CatalogTableProps {
// (undocumented)
actions?: TableProps<CatalogTableRow>['actions'];
// Warning: (ae-forgotten-export) The symbol "CatalogTableColumnsFunc" needs to be exported by the entry point index.d.ts
//
// (undocumented)
columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;
// (undocumented)
@@ -44,7 +44,8 @@ import React from 'react';
import { createComponentRouteRef } from '../../routes';
import { CatalogTableRow } from '../CatalogTable';
import { DefaultCatalogPage } from './DefaultCatalogPage';
import { CatalogTableColumnsFunc } from '../CatalogTable/CatalogTable';
import { CatalogTableColumnsFunc } from '../CatalogTable/types';
describe('DefaultCatalogPage', () => {
const origReplaceState = window.history.replaceState;
@@ -43,7 +43,8 @@ import { createComponentRouteRef } from '../../routes';
import { CatalogTable, CatalogTableRow } from '../CatalogTable';
import { catalogTranslationRef } from '../../translation';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
import { CatalogTableColumnsFunc } from '../CatalogTable/CatalogTable';
import { CatalogTableColumnsFunc } from '../CatalogTable/types';
/** @internal */
export interface BaseCatalogPageProps {
@@ -31,7 +31,8 @@ import {
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
import { act, fireEvent, screen } from '@testing-library/react';
import * as React from 'react';
import { CatalogTable, CatalogTableColumnsFunc } from './CatalogTable';
import { CatalogTable } from './CatalogTable';
import { CatalogTableColumnsFunc } from './types';
const entities: Entity[] = [
{
@@ -29,7 +29,6 @@ import {
WarningPanel,
} from '@backstage/core-components';
import {
EntityListContextProps,
getEntityRelations,
humanizeEntityRef,
useEntityList,
@@ -46,16 +45,7 @@ import { capitalize } from 'lodash';
import pluralize from 'pluralize';
import React, { ReactNode, useMemo } from 'react';
import { columnFactories } from './columns';
import { CatalogTableRow } from './types';
/**
* Typed columns function to dynamically render columns based on entity list context.
*
* @public
*/
export type CatalogTableColumnsFunc = (
entityListContext: EntityListContextProps,
) => TableColumn<CatalogTableRow>[];
import { CatalogTableColumnsFunc, CatalogTableRow } from './types';
/**
* Props for {@link CatalogTable}.
@@ -16,4 +16,4 @@
export { CatalogTable } from './CatalogTable';
export type { CatalogTableProps } from './CatalogTable';
export type { CatalogTableRow } from './types';
export type { CatalogTableRow, CatalogTableColumnsFunc } from './types';
@@ -14,7 +14,9 @@
* limitations under the License.
*/
import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
import { EntityListContextProps } from '@backstage/plugin-catalog-react';
import { TableColumn } from '@backstage/core-components';
/** @public */
export interface CatalogTableRow {
@@ -31,3 +33,12 @@ export interface CatalogTableRow {
ownedByRelations: CompoundEntityRef[];
};
}
/**
* Typed columns function to dynamically render columns based on entity list context.
*
* @public
*/
export type CatalogTableColumnsFunc = (
entityListContext: EntityListContextProps,
) => TableColumn<CatalogTableRow>[];