@oclif/table 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/table.d.ts +6 -6
- package/lib/table.js +1 -1
- package/lib/types.d.ts +2 -6
- package/lib/utils.d.ts +6 -6
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { printTable, printTables } from './table.js';
|
|
2
|
-
export type {
|
|
2
|
+
export type { TableOptions } from './types.js';
|
package/lib/table.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CellProps, ContainerProps,
|
|
3
|
-
export declare function Table<T extends
|
|
2
|
+
import { CellProps, ContainerProps, TableOptions } from './types.js';
|
|
3
|
+
export declare function Table<T extends Record<string, unknown>>(props: TableOptions<T>): React.JSX.Element;
|
|
4
4
|
/**
|
|
5
5
|
* Renders the header of a table.
|
|
6
6
|
*/
|
|
@@ -17,9 +17,9 @@ export declare function Skeleton(props: React.PropsWithChildren & {
|
|
|
17
17
|
}): React.JSX.Element;
|
|
18
18
|
/**
|
|
19
19
|
* Renders a table with the given data.
|
|
20
|
-
* @param options see {@link
|
|
20
|
+
* @param options see {@link TableOptions}
|
|
21
21
|
*/
|
|
22
|
-
export declare function printTable<T extends
|
|
23
|
-
export declare function printTables<T extends
|
|
24
|
-
[P in keyof T]:
|
|
22
|
+
export declare function printTable<T extends Record<string, unknown>>(options: TableOptions<T>): void;
|
|
23
|
+
export declare function printTables<T extends Record<string, unknown>[]>(tables: {
|
|
24
|
+
[P in keyof T]: TableOptions<T[P]>;
|
|
25
25
|
}, options?: Omit<ContainerProps, 'children'>): void;
|
package/lib/table.js
CHANGED
|
@@ -215,7 +215,7 @@ export function Skeleton(props) {
|
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
217
|
* Renders a table with the given data.
|
|
218
|
-
* @param options see {@link
|
|
218
|
+
* @param options see {@link TableOptions}
|
|
219
219
|
*/
|
|
220
220
|
export function printTable(options) {
|
|
221
221
|
const instance = render(React.createElement(Table, { ...options }));
|
package/lib/types.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { BorderStyle } from './skeletons.js';
|
|
2
|
-
export type Scalar = string | number | boolean | null | undefined;
|
|
3
|
-
export type ScalarDict = {
|
|
4
|
-
[key: string]: Scalar;
|
|
5
|
-
};
|
|
6
2
|
export type CellProps = React.PropsWithChildren<{
|
|
7
3
|
readonly column: number;
|
|
8
4
|
}>;
|
|
@@ -60,7 +56,7 @@ type SortOrder<T> = 'asc' | 'desc' | ((valueA: T, valueB: T) => number);
|
|
|
60
56
|
export type Sort<T> = {
|
|
61
57
|
[K in keyof T]?: SortOrder<T[K]>;
|
|
62
58
|
};
|
|
63
|
-
export type
|
|
59
|
+
export type TableOptions<T extends Record<string, unknown>> = {
|
|
64
60
|
/**
|
|
65
61
|
* List of values (rows).
|
|
66
62
|
*/
|
|
@@ -208,7 +204,7 @@ export type RowConfig = {
|
|
|
208
204
|
color: SupportedColor | undefined;
|
|
209
205
|
};
|
|
210
206
|
};
|
|
211
|
-
export type RowProps<T extends
|
|
207
|
+
export type RowProps<T extends Record<string, unknown>> = {
|
|
212
208
|
readonly key: string;
|
|
213
209
|
readonly data: Partial<T>;
|
|
214
210
|
readonly columns: Column<T>[];
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Column, Config,
|
|
1
|
+
import { Column, Config, Sort } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Intersperses a list of elements with another element.
|
|
4
4
|
*
|
|
@@ -8,8 +8,8 @@ import { Column, Config, ScalarDict, Sort } from './types.js';
|
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
10
|
export declare function intersperse<T, I>(intersperser: (index: number) => I, elements: T[]): (T | I)[];
|
|
11
|
-
export declare function sortData<T extends
|
|
12
|
-
export declare function allKeysInCollection<T extends
|
|
13
|
-
export declare function getColumns<T extends
|
|
14
|
-
export declare function getHeadings<T extends
|
|
15
|
-
export declare function maybeStripAnsi<T extends
|
|
11
|
+
export declare function sortData<T extends Record<string, unknown>>(data: T[], sort?: Sort<T> | undefined): T[];
|
|
12
|
+
export declare function allKeysInCollection<T extends Record<string, unknown>>(data: T[]): (keyof T)[];
|
|
13
|
+
export declare function getColumns<T extends Record<string, unknown>>(config: Config<T>, headings: Partial<T>): Column<T>[];
|
|
14
|
+
export declare function getHeadings<T extends Record<string, unknown>>(config: Config<T>): Partial<T>;
|
|
15
|
+
export declare function maybeStripAnsi<T extends Record<string, unknown>[]>(data: T, noStyle: boolean): T;
|