@indico-data/design-system 2.59.0 → 2.59.1
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/components/tanstackTable/TanstackTable.stories.d.ts +1 -1
- package/lib/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.d.ts +1 -1
- package/lib/components/tanstackTable/docs/withRowClick/WithRowClick.stories.d.ts +1 -1
- package/lib/components/tanstackTable/index.d.ts +1 -1
- package/lib/index.esm.js +8 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +8 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tanstackTable/TanstackTable.stories.tsx +1 -1
- package/src/components/tanstackTable/{TanstakTable.tsx → TanstackTable.tsx} +15 -10
- package/src/components/tanstackTable/__tests__/TanstackTable.test.tsx +1 -1
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.tsx +1 -1
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.stories.tsx +1 -1
- package/src/components/tanstackTable/index.ts +1 -1
- /package/lib/components/tanstackTable/{TanstakTable.d.ts → TanstackTable.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import { TanstackTable } from './
|
|
3
|
+
import { TanstackTable } from './TanstackTable';
|
|
4
4
|
import { people, Person } from './mock-data/mock-data';
|
|
5
5
|
import { columns } from './mock-data/table-configuration';
|
|
6
6
|
import { ColumnDef, Row } from '@tanstack/react-table';
|
|
@@ -11,6 +11,7 @@ import { Props } from './TankstackTable.types';
|
|
|
11
11
|
import { useTanstackTable } from './useTanstackTable';
|
|
12
12
|
import { TableHeader } from './components/TableHeader';
|
|
13
13
|
import { TableBody } from './components/TableBody';
|
|
14
|
+
import { columns } from './mock-data/table-configuration';
|
|
14
15
|
|
|
15
16
|
export function TanstackTable<T extends object>({
|
|
16
17
|
columns: defaultColumns,
|
|
@@ -47,19 +48,23 @@ export function TanstackTable<T extends object>({
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
const thRefs = useRef<Record<string, HTMLTableCellElement | null>>({});
|
|
50
|
-
|
|
51
|
+
|
|
52
|
+
// Auto-compute column widths based on current table header cell widths for columns without a defined size.
|
|
51
53
|
useEffect(() => {
|
|
52
|
-
|
|
54
|
+
setFormattedColumns(
|
|
55
|
+
formattedColumns.map((column) => {
|
|
56
|
+
if (column.meta?.styles.definedColumnSize) {
|
|
57
|
+
return column;
|
|
58
|
+
}
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
const columnWidth = thRefs.current[column.id as keyof typeof thRefs.current]!.offsetWidth;
|
|
60
|
+
const columnWidth = thRefs.current[column.id as keyof typeof thRefs.current]!.offsetWidth;
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
return {
|
|
63
|
+
...column,
|
|
64
|
+
size: columnWidth,
|
|
65
|
+
};
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
63
68
|
}, [data, columns, windowWidth]);
|
|
64
69
|
|
|
65
70
|
const table = useReactTable({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
|
-
import { TanstackTable } from '../
|
|
3
|
+
import { TanstackTable } from '../TanstackTable';
|
|
4
4
|
import { data, columns } from './__mocks__/test-mock-data';
|
|
5
5
|
|
|
6
6
|
describe('Tanstack Table Component', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import { TanstackTable } from '../../
|
|
3
|
+
import { TanstackTable } from '../../TanstackTable';
|
|
4
4
|
import { people, Person } from '../../mock-data/mock-data';
|
|
5
5
|
import { columns } from '../../mock-data/table-configuration';
|
|
6
6
|
import { ColumnDef } from '@tanstack/react-table';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import { TanstackTable } from '../../
|
|
3
|
+
import { TanstackTable } from '../../TanstackTable';
|
|
4
4
|
import { people, Person } from '../../mock-data/mock-data';
|
|
5
5
|
import { columns } from '../../mock-data/table-configuration';
|
|
6
6
|
import { ColumnDef, Row } from '@tanstack/react-table';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { ColumnDef, Row, Table } from '@tanstack/react-table';
|
|
2
|
-
export { TanstackTable } from './
|
|
2
|
+
export { TanstackTable } from './TanstackTable';
|
|
File without changes
|