asma-core-ui 2.19.89 → 2.19.91
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/dist/asma-core-ui.es.js +2 -2
- package/dist/src/components/table/StyledTable.d.ts +1 -1
- package/dist/src/components/table/components/TableHeader.d.ts +2 -1
- package/dist/src/components/table/components/columns/expandColumn.d.ts +1 -0
- package/dist/src/components/table/components/columns/selectColumn.d.ts +2 -1
- package/dist/src/components/table/story/components/RenderSubRows.d.ts +5 -0
- package/dist/src/components/table/story/components/getRowActions.d.ts +23 -0
- package/dist/src/components/table/story/components/useTableSubRowsColumns.d.ts +5 -0
- package/dist/src/components/table/types.d.ts +22 -11
- package/dist/style.css +1 -1
- package/package.json +119 -118
|
@@ -11,4 +11,4 @@ import { type StyledTableProps } from './types';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const StyledTable: <TData extends {
|
|
13
13
|
id: string | number;
|
|
14
|
-
}, TCustomData = Record<string, unknown>>({ actions, columns, data, customSubRowData, initialState, enableRowSelection, headerPin, loading, noRowsOverlay, tableInstanceRef, className, rowHeight, tdClassName, getRowClassName, onRowClick, renderSubRows, customActionsNode, focusable, stickyHeader, expandArrow, height, locale, footer, hideHeader, ...rest }: StyledTableProps<TData, TCustomData>) => JSX.Element;
|
|
14
|
+
}, TCustomData = Record<string, unknown>>({ actions, columns, data, customSubRowData, initialState, enableRowSelection, headerPin, loading, noRowsOverlay, tableInstanceRef, className, rowHeight, tdClassName, getRowClassName, onRowClick, renderSubRows, customActionsNode, focusable, stickyHeader, expandArrow, height, locale, footer, hideHeader, hideFooter, ...rest }: StyledTableProps<TData, TCustomData>) => JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type Table } from '@tanstack/react-table';
|
|
3
|
-
export declare function TableHeader<TData>({ table, stickyHeader }: {
|
|
3
|
+
export declare function TableHeader<TData>({ table, stickyHeader, hideHeader, }: {
|
|
4
4
|
table: Table<TData>;
|
|
5
5
|
stickyHeader?: boolean;
|
|
6
|
+
hideHeader?: boolean;
|
|
6
7
|
}): JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CellContext, HeaderContext } from '@tanstack/react-table';
|
|
2
2
|
export declare function selectColumn<TData>(): {
|
|
3
3
|
id: string;
|
|
4
|
-
|
|
4
|
+
minSize: number;
|
|
5
5
|
maxSize: number;
|
|
6
|
+
size: number;
|
|
6
7
|
header: ({ table }: HeaderContext<TData, TData>) => JSX.Element;
|
|
7
8
|
cell: ({ cell }: CellContext<TData, TData>) => JSX.Element;
|
|
8
9
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Person } from '../helpers/makeData';
|
|
2
|
+
import type { Row } from '@tanstack/react-table';
|
|
3
|
+
export declare function getRowActions(row: Row<Person>): ({
|
|
4
|
+
label: string;
|
|
5
|
+
hide: boolean;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
className?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
label: string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
hide?: undefined;
|
|
12
|
+
className?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
label: string;
|
|
15
|
+
className: string;
|
|
16
|
+
onClick: () => void;
|
|
17
|
+
hide?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
label: string;
|
|
20
|
+
hide: boolean;
|
|
21
|
+
className: string;
|
|
22
|
+
onClick: () => void;
|
|
23
|
+
})[];
|
|
@@ -15,16 +15,27 @@ declare module '@tanstack/react-table' {
|
|
|
15
15
|
meta?: ColumnMeta<TData, TValue>;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface IAction<TData> {
|
|
19
|
+
label: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
hide?: boolean;
|
|
23
|
+
onClick?: (row: Row<TData>) => void;
|
|
24
|
+
}
|
|
25
|
+
type IFooter<TData> = {
|
|
26
|
+
footer?: (table: Table<TData>) => ReactNode;
|
|
27
|
+
hideFooter?: never;
|
|
28
|
+
};
|
|
29
|
+
type IHideFooter = {
|
|
30
|
+
footer: never;
|
|
31
|
+
hideFooter?: boolean;
|
|
32
|
+
};
|
|
33
|
+
type TFooter<TData> = IFooter<TData> | IHideFooter;
|
|
34
|
+
type TTableOptions<TData> = TableOptions<TData>;
|
|
35
|
+
export type StyledTableProps<TData, TCustomData> = {
|
|
19
36
|
locale?: 'no' | 'en';
|
|
20
37
|
height?: string | number;
|
|
21
|
-
actions?: (row: Row<TData>) =>
|
|
22
|
-
label: string;
|
|
23
|
-
className?: string;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
hide?: boolean;
|
|
26
|
-
onClick?: (row: Row<TData>) => void;
|
|
27
|
-
}[];
|
|
38
|
+
actions?: (row: Row<TData>) => IAction<TData>[];
|
|
28
39
|
customActionsNode?: (row: CellContext<TData, TData>) => ReactNode;
|
|
29
40
|
customSubRowData?: Map<string, TCustomData[]>;
|
|
30
41
|
headerPin?: boolean;
|
|
@@ -42,11 +53,11 @@ export interface StyledTableProps<TData, TCustomData> extends Omit<TableOptions<
|
|
|
42
53
|
renderSubRows?: (props: {
|
|
43
54
|
rows: TCustomData[];
|
|
44
55
|
row: TData;
|
|
45
|
-
}) => ReactElement;
|
|
56
|
+
}) => ReactElement | null;
|
|
46
57
|
getRowSelectionIds?: (ids: string[]) => void;
|
|
47
|
-
footer?: (table: Table<TData>) => ReactNode;
|
|
48
58
|
hideHeader?: boolean;
|
|
49
|
-
}
|
|
59
|
+
} & Omit<TTableOptions<TData>, 'getCoreRowModel' | 'getExpandedRowModel' | 'getFilteredRowModel' | 'getSortedRowModel'> & TFooter<TData>;
|
|
50
60
|
export declare const SELECT_COLUMN_ID = "select";
|
|
51
61
|
export declare const EXPAND_COLUMN_ID = "expand-column-id";
|
|
52
62
|
export declare const ACTIONS_COLUMN_ID = "actions";
|
|
63
|
+
export {};
|