1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

docs: Fix initial warnings from generating API docs

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-04-19 10:17:22 -04:00
parent 45574d49cc
commit 5d9cdee31f
6 changed files with 93 additions and 43 deletions

View File

@ -118,7 +118,7 @@ export interface CatalogCategoryMetadata {
*/ */
readonly name: string; readonly name: string;
/** /**
* Either an `<svg>` or the name of an icon from {@link IconProps} * Either an `<svg>` or one of the provided svg names from {@link Renderer.Component.NamedSvg}
*/ */
readonly icon: string; readonly icon: string;
} }

View File

@ -86,7 +86,7 @@ export abstract class BaseExtensionStore<T extends object> {
} }
/** /**
* @deprecated Never use this method. Instead call {@link BaseExtensionStore.loadExtension} * @deprecated Never use this method. Instead call {@link Common.Store.ExtensionStore.loadExtension}
*/ */
load() { load() {
this.persistentStorage?.loadAndStartSyncing(); this.persistentStorage?.loadAndStartSyncing();

View File

@ -73,6 +73,29 @@ const localSvgIcons = new Map([
["workloads", Workloads], ["workloads", Workloads],
]); ]);
export type NamedSvg =
| "configuration"
| "crane"
| "group"
| "helm"
| "install"
| "kube"
| "lens-logo"
| "license"
| "logo-lens"
| "logout"
| "nodes"
| "push_off"
| "push_pin"
| "spinner"
| "ssh"
| "storage"
| "terminal"
| "user"
| "users"
| "wheel"
| "workloads";
export interface BaseIconProps { export interface BaseIconProps {
/** /**
* One of the names from https://material.io/icons/ * One of the names from https://material.io/icons/
@ -80,30 +103,9 @@ export interface BaseIconProps {
material?: string; material?: string;
/** /**
* Either an SVG XML or one of the following names * Either an SVG XML or one of {@link NamedSvg}
* - configuration
* - crane
* - group
* - helm
* - install
* - kube
* - lens-logo
* - license
* - logo-lens
* - logout
* - nodes
* - push_off
* - push_pin
* - spinner
* - ssh
* - storage
* - terminal
* - user
* - users
* - wheel
* - workloads
*/ */
svg?: string; svg?: NamedSvg | string;
/** /**
* render icon as NavLink from react-router-dom * render icon as NavLink from react-router-dom

View File

@ -47,7 +47,7 @@ export interface TableCellProps extends React.DOMAttributes<HTMLDivElement> {
isChecked?: boolean; isChecked?: boolean;
/** /**
* column name, must be same as key in sortable object <Table sortable={}/> * column name, must be same as key in sortable object `<Table sortable={}></Table>`
*/ */
sortBy?: TableSortBy; sortBy?: TableSortBy;

View File

@ -15,9 +15,19 @@ export interface TableRowProps<Item> extends React.DOMAttributes<HTMLDivElement>
className?: string; className?: string;
selected?: boolean; selected?: boolean;
style?: CSSProperties; style?: CSSProperties;
nowrap?: boolean; // white-space: nowrap, align inner <TableCell> in one line /**
sortItem?: Item; // data for sorting callback in <Table sortable={}/> * Should the inner `<TableCell>` be aligned to one line
searchItem?: Item; // data for searching filters in <Table searchable={}/> * `white-space: nowrap`
*/
nowrap?: boolean;
/**
* data for sorting callback in `<Table sortable={}></Table>`
*/
sortItem?: Item;
/**
* data for searching filters in `<Table searchable={}></Table>`
*/
searchItem?: Item;
disabled?: boolean; disabled?: boolean;
testId?: string; testId?: string;
} }

View File

@ -36,23 +36,61 @@ export type TableSortCallback<Item> = (data: Item) => undefined | string | numbe
export type TableSortCallbacks<Item> = Record<string, TableSortCallback<Item>>; export type TableSortCallbacks<Item> = Record<string, TableSortCallback<Item>>;
export interface TableProps<Item> extends React.DOMAttributes<HTMLDivElement> { export interface TableProps<Item> extends React.DOMAttributes<HTMLDivElement> {
tableId?: string;
items?: Item[]; // Raw items data
className?: string;
autoSize?: boolean; // Setup auto-sizing for all columns (flex: 1 0)
selectable?: boolean; // Highlight rows on hover
scrollable?: boolean; // Use scrollbar if content is bigger than parent's height
storageKey?: string; // Keep some data in localStorage & restore on page reload, e.g sorting params
/** /**
* Define sortable callbacks for every column in <TableHead><TableCell sortBy="someCol"><TableHead> * Used for persisting sort order and visible columns
* @sortItem argument in the callback is an object, provided in <TableRow sortItem={someColDataItem}/> */
tableId?: string;
/**
* The raw data for the table
*/
items?: Item[];
/**
* Optional addition class names for the root HTML element
*/
className?: string;
/**
* Setup auto-sizing for all columns (flex: 1 0)
*/
autoSize?: boolean;
/**
* Highlight rows on hover
*/
selectable?: boolean;
/**
* Use scrollbar if content is bigger than parent's height
*/
scrollable?: boolean;
/**
* @deprecated Unused
*/
storageKey?: string;
/**
* Define sortable callbacks for every column in `<TableHead><TableCell sortBy="someCol"></TableCell></TableHead>`
* @sortItem argument in the callback is an object, provided in `<TableRow sortItem={someColDataItem}></TableRow>`
*/ */
sortable?: TableSortCallbacks<Item>; sortable?: TableSortCallbacks<Item>;
sortSyncWithUrl?: boolean; // sorting state is managed globally from url params /**
sortByDefault?: Partial<TableSortParams>; // default sorting params * sorting state is managed globally from url params
onSort?: (params: TableSortParams) => void; // callback on sort change, default: global sync with url */
noItems?: React.ReactNode; // Show no items state table list is empty sortSyncWithUrl?: boolean;
selectedItemId?: string; // Allows to scroll list to selected item /**
* default sorting params
*/
sortByDefault?: Partial<TableSortParams>;
/**
* callback on sort change
*
* Default: global sync with url
*/
onSort?: (params: TableSortParams) => void;
/**
* This is shown when {@link TableProps.items} is empty
*/
noItems?: React.ReactNode;
/**
* Allows to scroll list to selected item
*/
selectedItemId?: string;
/** /**
* Use virtual list component to render only visible rows. By default uses a * Use virtual list component to render only visible rows. By default uses a