asma-ui-table 1.0.135 → 1.0.136
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-ui-table.es.js +1343 -153
- package/dist/src/components/TableBody.d.ts +6 -3
- package/dist/src/components/TableRow.d.ts +3 -1
- package/dist/src/components/TableRows.d.ts +6 -3
- package/dist/src/components/table-header/TableHeader.d.ts +4 -2
- package/dist/src/components/table-header/TableHeaderCell.d.ts +1 -2
- package/dist/src/hooks/useColumnVirtualizer.d.ts +16 -0
- package/dist/src/hooks/useRowVirtualizer.d.ts +20 -0
- package/package.json +2 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Table } from '@tanstack/react-table';
|
|
1
|
+
import type { Table } from '@tanstack/react-table';
|
|
3
2
|
import type { StyledTableProps } from '../types';
|
|
3
|
+
import type { MutableRefObject } from 'react';
|
|
4
|
+
import type { ColumnWindow } from 'src/hooks/useColumnVirtualizer';
|
|
4
5
|
export declare function TableBody<TData extends {
|
|
5
6
|
id: string | number;
|
|
6
|
-
}, TCustomData = Record<string, unknown>>({ table, styledTableProps }: {
|
|
7
|
+
}, TCustomData = Record<string, unknown>>({ table, styledTableProps, scrollRef, columnWindow, }: {
|
|
7
8
|
table: Table<TData>;
|
|
8
9
|
styledTableProps: StyledTableProps<TData, TCustomData>;
|
|
10
|
+
scrollRef?: MutableRefObject<HTMLDivElement | null>;
|
|
11
|
+
columnWindow: ColumnWindow;
|
|
9
12
|
}): JSX.Element | null;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type Row } from '@tanstack/react-table';
|
|
3
3
|
import { type StyledTableProps } from '../types';
|
|
4
|
+
import type { ColumnWindow } from 'src/hooks/useColumnVirtualizer';
|
|
4
5
|
export declare function TableRow<TData extends {
|
|
5
6
|
id: string | number;
|
|
6
|
-
}, TCustomData = Record<string, unknown>>({ styledTableProps, row, index, }: {
|
|
7
|
+
}, TCustomData = Record<string, unknown>>({ styledTableProps, row, index, columnWindow: { paddingLeft, paddingRight, indexes }, }: {
|
|
7
8
|
styledTableProps: StyledTableProps<TData, TCustomData>;
|
|
8
9
|
row: Row<TData>;
|
|
10
|
+
columnWindow: ColumnWindow;
|
|
9
11
|
index: number;
|
|
10
12
|
}): JSX.Element;
|
|
11
13
|
export declare const Checkmark: () => JSX.Element;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Table } from '@tanstack/react-table';
|
|
1
|
+
import type { Table } from '@tanstack/react-table';
|
|
3
2
|
import type { StyledTableProps } from '../types';
|
|
3
|
+
import type { MutableRefObject } from 'react';
|
|
4
|
+
import type { ColumnWindow } from 'src/hooks/useColumnVirtualizer';
|
|
4
5
|
export declare function TableRows<TData extends {
|
|
5
6
|
id: string | number;
|
|
6
|
-
}, TCustomData = Record<string, unknown>>({ styledTableProps, table }: {
|
|
7
|
+
}, TCustomData = Record<string, unknown>>({ styledTableProps, table, scrollRef, columnWindow, }: {
|
|
7
8
|
styledTableProps: StyledTableProps<TData, TCustomData>;
|
|
8
9
|
table: Table<TData>;
|
|
10
|
+
scrollRef?: MutableRefObject<HTMLDivElement | null>;
|
|
11
|
+
columnWindow: ColumnWindow;
|
|
9
12
|
}): JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type Table } from '@tanstack/react-table';
|
|
3
|
-
import type
|
|
3
|
+
import { type StyledTableProps } from 'src/types';
|
|
4
|
+
import type { ColumnWindow } from 'src/hooks/useColumnVirtualizer';
|
|
4
5
|
export declare function TableHeader<TData extends {
|
|
5
6
|
id: string | number;
|
|
6
|
-
}, TCustomData = Record<string, unknown>>({ table, styledTableProps, tableCanResize, tableWidth, }: {
|
|
7
|
+
}, TCustomData = Record<string, unknown>>({ table, styledTableProps, tableCanResize, tableWidth, columnWindow: { paddingLeft, paddingRight, indexes }, }: {
|
|
7
8
|
table: Table<TData>;
|
|
8
9
|
styledTableProps: StyledTableProps<TData, TCustomData>;
|
|
9
10
|
tableCanResize: boolean;
|
|
10
11
|
tableWidth: number | null;
|
|
12
|
+
columnWindow: ColumnWindow;
|
|
11
13
|
}): JSX.Element;
|
|
@@ -3,11 +3,10 @@ import { type Header } from '@tanstack/react-table';
|
|
|
3
3
|
import { type StyledTableProps } from 'src/types';
|
|
4
4
|
export declare function TableHeaderCell<TData extends {
|
|
5
5
|
id: string | number;
|
|
6
|
-
}, TCustomData = Record<string, unknown>>({ styledTableProps, header, tableCanResize, left,
|
|
6
|
+
}, TCustomData = Record<string, unknown>>({ styledTableProps, header, tableCanResize, left, tableWidth, }: {
|
|
7
7
|
styledTableProps: StyledTableProps<TData, TCustomData>;
|
|
8
8
|
header: Header<TData, unknown>;
|
|
9
9
|
tableCanResize: boolean;
|
|
10
10
|
left: number;
|
|
11
|
-
hasFixedLeftColumn: boolean;
|
|
12
11
|
tableWidth: number | null;
|
|
13
12
|
}): JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Table } from '@tanstack/react-table';
|
|
2
|
+
import type { MutableRefObject } from 'react';
|
|
3
|
+
export type ColumnWindow = {
|
|
4
|
+
indexes: number[];
|
|
5
|
+
paddingLeft: number;
|
|
6
|
+
paddingRight: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function useColumnVirtualizer<TData extends {
|
|
9
|
+
id: string | number;
|
|
10
|
+
}>(table: Table<TData>, scrollRef?: MutableRefObject<HTMLDivElement | null>): {
|
|
11
|
+
columnWindow: {
|
|
12
|
+
indexes: number[];
|
|
13
|
+
paddingLeft: number;
|
|
14
|
+
paddingRight: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Row } from '@tanstack/react-table';
|
|
2
|
+
import type { MutableRefObject } from 'react';
|
|
3
|
+
export type RowWindow = {
|
|
4
|
+
indexes: number[];
|
|
5
|
+
paddingTop: number;
|
|
6
|
+
paddingBottom: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function useRowVirtualizer<TData extends {
|
|
9
|
+
id: string | number;
|
|
10
|
+
}>({ rows, rowHeight, scrollRef, }: {
|
|
11
|
+
rows: Row<TData>[];
|
|
12
|
+
rowHeight: number;
|
|
13
|
+
scrollRef?: MutableRefObject<HTMLDivElement | null>;
|
|
14
|
+
}): {
|
|
15
|
+
rowWindow: {
|
|
16
|
+
indexes: number[];
|
|
17
|
+
paddingTop: number;
|
|
18
|
+
paddingBottom: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.136",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist/**/*",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"@fontsource/roboto": "^5.0.4",
|
|
59
59
|
"@mui/material": "^5.13.7",
|
|
60
60
|
"@tanstack/react-table": "^8.21.3",
|
|
61
|
+
"@tanstack/react-virtual": "^3.13.21",
|
|
61
62
|
"clsx": "^1.2.1",
|
|
62
63
|
"lodash-es": "^4.17.21",
|
|
63
64
|
"react": "^18.2.0",
|