@indico-data/design-system 2.51.0 → 2.51.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/TankstackTable.types.d.ts +7 -2
- package/lib/components/tanstackTable/TanstackTable.stories.d.ts +1 -0
- package/lib/components/tanstackTable/TanstakTable.d.ts +1 -1
- package/lib/components/tanstackTable/components/TableBody/TableBody.d.ts +5 -6
- package/lib/components/tanstackTable/components/TablePagination/TablePagination.d.ts +1 -1
- package/lib/components/tanstackTable/useTanstackTable.d.ts +0 -2
- package/lib/index.css +33 -18
- package/lib/index.d.ts +8 -3
- package/lib/index.esm.css +33 -18
- package/lib/index.esm.js +22 -45
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +22 -45
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tanstackTable/TankstackTable.types.ts +7 -2
- package/src/components/tanstackTable/TanstackTable.stories.tsx +34 -10
- package/src/components/tanstackTable/TanstakTable.tsx +8 -9
- package/src/components/tanstackTable/__tests__/TanstackTable.test.tsx +3 -17
- package/src/components/tanstackTable/components/ActionBar/ActionBar.scss +1 -1
- package/src/components/tanstackTable/components/ActionBar/ActionBar.tsx +0 -8
- package/src/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.tsx +0 -22
- package/src/components/tanstackTable/components/TableBody/TableBody.tsx +12 -22
- package/src/components/tanstackTable/components/TablePagination/TablePagination.tsx +2 -2
- package/src/components/tanstackTable/helpers.ts +1 -1
- package/src/components/tanstackTable/mock-data/table-configuration.tsx +4 -1
- package/src/components/tanstackTable/styles/table.scss +36 -22
- package/src/components/tanstackTable/tanstack-table.d.ts +1 -0
- package/src/components/tanstackTable/useTanstackTable.tsx +0 -3
- package/src/stylesAndAnimations/utilityClasses/UtilityClassesTable.tsx +16 -2
|
@@ -2,7 +2,7 @@ import { Row, ColumnDef } from '@tanstack/react-table';
|
|
|
2
2
|
export type WithPaginationProps = {
|
|
3
3
|
rowsPerPage: number;
|
|
4
4
|
rowCount: number;
|
|
5
|
-
onChangePage: (page: number
|
|
5
|
+
onChangePage: (page: number) => void;
|
|
6
6
|
currentPage: number;
|
|
7
7
|
totalEntriesText?: string;
|
|
8
8
|
showPagination: true;
|
|
@@ -10,7 +10,7 @@ export type WithPaginationProps = {
|
|
|
10
10
|
export type WithoutPaginationProps = {
|
|
11
11
|
rowsPerPage?: number;
|
|
12
12
|
rowCount?: number;
|
|
13
|
-
onChangePage?: (page: number
|
|
13
|
+
onChangePage?: (page: number) => void;
|
|
14
14
|
currentPage?: number;
|
|
15
15
|
totalEntriesText?: string;
|
|
16
16
|
showPagination?: false;
|
|
@@ -37,4 +37,9 @@ export type Props<T extends object> = {
|
|
|
37
37
|
isLoading?: boolean;
|
|
38
38
|
defaultPinnedColumns?: string[];
|
|
39
39
|
onClickRow?: ((row: Row<T>) => void) | null;
|
|
40
|
+
onRowClick?: (row: T) => void;
|
|
41
|
+
activeRows?: string[];
|
|
42
|
+
rowSelection?: Record<string, boolean>;
|
|
43
|
+
onRowSelectionChange?: (updater: Record<string, boolean>) => void;
|
|
44
|
+
onSelectAllChange?: (isSelected: boolean) => void;
|
|
40
45
|
} & PaginationProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Props } from './TankstackTable.types';
|
|
2
|
-
export declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns,
|
|
2
|
+
export declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, actionBarClassName, ...rest }: Props<T & {
|
|
3
3
|
id: string;
|
|
4
4
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Table } from '@tanstack/react-table';
|
|
2
|
-
import { Row } from '@tanstack/react-table';
|
|
3
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
4
2
|
export type Props<T> = {
|
|
5
3
|
table: Table<T>;
|
|
6
|
-
|
|
4
|
+
onRowClick?: ((row: T & {
|
|
5
|
+
id: string;
|
|
6
|
+
}) => void) | null | undefined;
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
columnsLength: number;
|
|
9
|
-
|
|
10
|
-
setIsClickedRow: Dispatch<SetStateAction<string[]>>;
|
|
9
|
+
activeRows: string[];
|
|
11
10
|
};
|
|
12
|
-
export declare const TableBody: <T>({ table,
|
|
11
|
+
export declare const TableBody: <T>({ table, onRowClick, isLoading, columnsLength, activeRows, }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,5 @@ export declare function useTanstackTable<T>({ defaultColumns }: Props<T>): {
|
|
|
10
10
|
windowWidth: number;
|
|
11
11
|
formattedColumns: ColumnDef<T>[];
|
|
12
12
|
setFormattedColumns: import("react").Dispatch<import("react").SetStateAction<ColumnDef<T>[]>>;
|
|
13
|
-
isClickedRow: string[];
|
|
14
|
-
setIsClickedRow: import("react").Dispatch<import("react").SetStateAction<string[]>>;
|
|
15
13
|
};
|
|
16
14
|
export {};
|
package/lib/index.css
CHANGED
|
@@ -2018,6 +2018,7 @@ form {
|
|
|
2018
2018
|
left: 50%;
|
|
2019
2019
|
transform: translateX(-50%);
|
|
2020
2020
|
z-index: 90;
|
|
2021
|
+
box-shadow: 3px 1px 15px 0 rgba(0, 0, 0, 0.85);
|
|
2021
2022
|
}
|
|
2022
2023
|
.tanstack-table__action-bar__container {
|
|
2023
2024
|
display: flex;
|
|
@@ -2061,17 +2062,26 @@ form {
|
|
|
2061
2062
|
text-decoration: underline;
|
|
2062
2063
|
}
|
|
2063
2064
|
|
|
2064
|
-
.tanstack-table__outer-container {
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2065
|
+
.tanstack-table__outer-container .tanstack-table__column--is-pinned {
|
|
2066
|
+
opacity: 1;
|
|
2067
|
+
}
|
|
2068
|
+
.tanstack-table__outer-container .tanstack-table__column--is-not-pinned {
|
|
2069
|
+
opacity: 0.3;
|
|
2069
2070
|
}
|
|
2070
2071
|
.tanstack-table__outer-container .tanstack-table__container {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2072
|
+
height: calc(100vh - 70px);
|
|
2073
|
+
grid-template-rows: auto 1fr auto;
|
|
2074
|
+
grid-template-columns: 1fr;
|
|
2075
|
+
display: grid;
|
|
2076
|
+
grid-template-rows: auto 1fr auto;
|
|
2077
|
+
grid-template-columns: 1fr;
|
|
2078
|
+
overflow-x: auto;
|
|
2079
|
+
overflow-y: auto;
|
|
2080
|
+
background-color: var(--pf-tanstack-table-background-color);
|
|
2081
|
+
border-radius: var(--pf-rounded-lg);
|
|
2082
|
+
border-left: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
2083
|
+
border-right: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
2084
|
+
border-bottom: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
2075
2085
|
scrollbar-width: thin;
|
|
2076
2086
|
scrollbar-color: var(--pf-tanstack-table-border-color) var(--pf-tanstack-table-background-color);
|
|
2077
2087
|
}
|
|
@@ -2110,15 +2120,15 @@ form {
|
|
|
2110
2120
|
.tanstack-table__thead {
|
|
2111
2121
|
position: sticky;
|
|
2112
2122
|
top: 0;
|
|
2113
|
-
z-index:
|
|
2123
|
+
z-index: 3;
|
|
2114
2124
|
box-sizing: border-box;
|
|
2115
2125
|
background-color: var(--pf-tanstack-table-background-color);
|
|
2116
2126
|
}
|
|
2117
2127
|
.tanstack-table__thead tr:first-child th:first-child {
|
|
2118
|
-
border-
|
|
2128
|
+
border-left: none;
|
|
2119
2129
|
}
|
|
2120
2130
|
.tanstack-table__thead tr:first-child th:last-child {
|
|
2121
|
-
border-
|
|
2131
|
+
border-right: none;
|
|
2122
2132
|
}
|
|
2123
2133
|
.tanstack-table__thead__th {
|
|
2124
2134
|
color: var(--pf-tanstack-table-font-color);
|
|
@@ -2141,17 +2151,19 @@ form {
|
|
|
2141
2151
|
text-align: left;
|
|
2142
2152
|
}
|
|
2143
2153
|
.tanstack-table__thead__th:first-child {
|
|
2144
|
-
border-left:
|
|
2154
|
+
border-left: none;
|
|
2145
2155
|
}
|
|
2146
|
-
.tanstack-
|
|
2147
|
-
border-
|
|
2156
|
+
.tanstack-table__thead__th:last-child {
|
|
2157
|
+
border-right: none;
|
|
2148
2158
|
}
|
|
2149
|
-
.tanstack-table__tbody tr:last-child
|
|
2150
|
-
border-bottom
|
|
2159
|
+
.tanstack-table__tbody tr:last-child {
|
|
2160
|
+
border-bottom: none;
|
|
2151
2161
|
}
|
|
2152
2162
|
.tanstack-table__tbody__tr {
|
|
2153
2163
|
background: transparent;
|
|
2154
2164
|
width: 100%;
|
|
2165
|
+
border-left: none;
|
|
2166
|
+
border-right: none;
|
|
2155
2167
|
}
|
|
2156
2168
|
.tanstack-table__tbody__tr.is-selected td {
|
|
2157
2169
|
background: var(--pf-tanstack-table-checked-color);
|
|
@@ -2180,7 +2192,10 @@ form {
|
|
|
2180
2192
|
text-align: left;
|
|
2181
2193
|
}
|
|
2182
2194
|
.tanstack-table__tbody__td:first-child {
|
|
2183
|
-
border-left:
|
|
2195
|
+
border-left: none;
|
|
2196
|
+
}
|
|
2197
|
+
.tanstack-table__tbody__td:last-child {
|
|
2198
|
+
border-right: none;
|
|
2184
2199
|
}
|
|
2185
2200
|
.tanstack-table__centered-row {
|
|
2186
2201
|
padding: var(--pf-padding-1) var(--pf-padding-2);
|
package/lib/index.d.ts
CHANGED
|
@@ -553,7 +553,7 @@ declare const Modal: ({ className, children, isOpen, onRequestClose, portalClass
|
|
|
553
553
|
type WithPaginationProps = {
|
|
554
554
|
rowsPerPage: number;
|
|
555
555
|
rowCount: number;
|
|
556
|
-
onChangePage: (page: number
|
|
556
|
+
onChangePage: (page: number) => void;
|
|
557
557
|
currentPage: number;
|
|
558
558
|
totalEntriesText?: string;
|
|
559
559
|
showPagination: true;
|
|
@@ -561,7 +561,7 @@ type WithPaginationProps = {
|
|
|
561
561
|
type WithoutPaginationProps = {
|
|
562
562
|
rowsPerPage?: number;
|
|
563
563
|
rowCount?: number;
|
|
564
|
-
onChangePage?: (page: number
|
|
564
|
+
onChangePage?: (page: number) => void;
|
|
565
565
|
currentPage?: number;
|
|
566
566
|
totalEntriesText?: string;
|
|
567
567
|
showPagination?: false;
|
|
@@ -588,9 +588,14 @@ type Props<T extends object> = {
|
|
|
588
588
|
isLoading?: boolean;
|
|
589
589
|
defaultPinnedColumns?: string[];
|
|
590
590
|
onClickRow?: ((row: Row$1<T>) => void) | null;
|
|
591
|
+
onRowClick?: (row: T) => void;
|
|
592
|
+
activeRows?: string[];
|
|
593
|
+
rowSelection?: Record<string, boolean>;
|
|
594
|
+
onRowSelectionChange?: (updater: Record<string, boolean>) => void;
|
|
595
|
+
onSelectAllChange?: (isSelected: boolean) => void;
|
|
591
596
|
} & PaginationProps;
|
|
592
597
|
|
|
593
|
-
declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns,
|
|
598
|
+
declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, actionBarClassName, ...rest }: Props<T & {
|
|
594
599
|
id: string;
|
|
595
600
|
}>): react_jsx_runtime.JSX.Element;
|
|
596
601
|
|
package/lib/index.esm.css
CHANGED
|
@@ -2018,6 +2018,7 @@ form {
|
|
|
2018
2018
|
left: 50%;
|
|
2019
2019
|
transform: translateX(-50%);
|
|
2020
2020
|
z-index: 90;
|
|
2021
|
+
box-shadow: 3px 1px 15px 0 rgba(0, 0, 0, 0.85);
|
|
2021
2022
|
}
|
|
2022
2023
|
.tanstack-table__action-bar__container {
|
|
2023
2024
|
display: flex;
|
|
@@ -2061,17 +2062,26 @@ form {
|
|
|
2061
2062
|
text-decoration: underline;
|
|
2062
2063
|
}
|
|
2063
2064
|
|
|
2064
|
-
.tanstack-table__outer-container {
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2065
|
+
.tanstack-table__outer-container .tanstack-table__column--is-pinned {
|
|
2066
|
+
opacity: 1;
|
|
2067
|
+
}
|
|
2068
|
+
.tanstack-table__outer-container .tanstack-table__column--is-not-pinned {
|
|
2069
|
+
opacity: 0.3;
|
|
2069
2070
|
}
|
|
2070
2071
|
.tanstack-table__outer-container .tanstack-table__container {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2072
|
+
height: calc(100vh - 70px);
|
|
2073
|
+
grid-template-rows: auto 1fr auto;
|
|
2074
|
+
grid-template-columns: 1fr;
|
|
2075
|
+
display: grid;
|
|
2076
|
+
grid-template-rows: auto 1fr auto;
|
|
2077
|
+
grid-template-columns: 1fr;
|
|
2078
|
+
overflow-x: auto;
|
|
2079
|
+
overflow-y: auto;
|
|
2080
|
+
background-color: var(--pf-tanstack-table-background-color);
|
|
2081
|
+
border-radius: var(--pf-rounded-lg);
|
|
2082
|
+
border-left: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
2083
|
+
border-right: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
2084
|
+
border-bottom: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
2075
2085
|
scrollbar-width: thin;
|
|
2076
2086
|
scrollbar-color: var(--pf-tanstack-table-border-color) var(--pf-tanstack-table-background-color);
|
|
2077
2087
|
}
|
|
@@ -2110,15 +2120,15 @@ form {
|
|
|
2110
2120
|
.tanstack-table__thead {
|
|
2111
2121
|
position: sticky;
|
|
2112
2122
|
top: 0;
|
|
2113
|
-
z-index:
|
|
2123
|
+
z-index: 3;
|
|
2114
2124
|
box-sizing: border-box;
|
|
2115
2125
|
background-color: var(--pf-tanstack-table-background-color);
|
|
2116
2126
|
}
|
|
2117
2127
|
.tanstack-table__thead tr:first-child th:first-child {
|
|
2118
|
-
border-
|
|
2128
|
+
border-left: none;
|
|
2119
2129
|
}
|
|
2120
2130
|
.tanstack-table__thead tr:first-child th:last-child {
|
|
2121
|
-
border-
|
|
2131
|
+
border-right: none;
|
|
2122
2132
|
}
|
|
2123
2133
|
.tanstack-table__thead__th {
|
|
2124
2134
|
color: var(--pf-tanstack-table-font-color);
|
|
@@ -2141,17 +2151,19 @@ form {
|
|
|
2141
2151
|
text-align: left;
|
|
2142
2152
|
}
|
|
2143
2153
|
.tanstack-table__thead__th:first-child {
|
|
2144
|
-
border-left:
|
|
2154
|
+
border-left: none;
|
|
2145
2155
|
}
|
|
2146
|
-
.tanstack-
|
|
2147
|
-
border-
|
|
2156
|
+
.tanstack-table__thead__th:last-child {
|
|
2157
|
+
border-right: none;
|
|
2148
2158
|
}
|
|
2149
|
-
.tanstack-table__tbody tr:last-child
|
|
2150
|
-
border-bottom
|
|
2159
|
+
.tanstack-table__tbody tr:last-child {
|
|
2160
|
+
border-bottom: none;
|
|
2151
2161
|
}
|
|
2152
2162
|
.tanstack-table__tbody__tr {
|
|
2153
2163
|
background: transparent;
|
|
2154
2164
|
width: 100%;
|
|
2165
|
+
border-left: none;
|
|
2166
|
+
border-right: none;
|
|
2155
2167
|
}
|
|
2156
2168
|
.tanstack-table__tbody__tr.is-selected td {
|
|
2157
2169
|
background: var(--pf-tanstack-table-checked-color);
|
|
@@ -2180,7 +2192,10 @@ form {
|
|
|
2180
2192
|
text-align: left;
|
|
2181
2193
|
}
|
|
2182
2194
|
.tanstack-table__tbody__td:first-child {
|
|
2183
|
-
border-left:
|
|
2195
|
+
border-left: none;
|
|
2196
|
+
}
|
|
2197
|
+
.tanstack-table__tbody__td:last-child {
|
|
2198
|
+
border-right: none;
|
|
2184
2199
|
}
|
|
2185
2200
|
.tanstack-table__centered-row {
|
|
2186
2201
|
padding: var(--pf-padding-1) var(--pf-padding-2);
|
package/lib/index.esm.js
CHANGED
|
@@ -25644,12 +25644,7 @@ function ActionBar({ table, TableActions, className, children, }) {
|
|
|
25644
25644
|
row.toggleSelected(false);
|
|
25645
25645
|
});
|
|
25646
25646
|
};
|
|
25647
|
-
|
|
25648
|
-
if (selectedItems.length === 1)
|
|
25649
|
-
return '1 item selected';
|
|
25650
|
-
return `${selectedItems.length} items selected`;
|
|
25651
|
-
};
|
|
25652
|
-
return (jsx(Card, { className: classNames('tanstack-table__action-bar', className), children: children !== null && children !== void 0 ? children : (jsxs("div", { className: "tanstack-table__action-bar__container", children: [jsx("div", { className: "tanstack-table__action-bar__text-container", children: jsx("span", { children: getSelectedItemsText() }) }), TableActions && (jsx("div", { className: "tanstack-table__action-bar__button-container", children: jsx(TableActions, { selectedItems: selectedItems, unselectRows: unselectRows }) }))] })) }));
|
|
25647
|
+
return (jsx(Card, { className: classNames('tanstack-table__action-bar', className), children: children !== null && children !== void 0 ? children : (jsx("div", { className: "tanstack-table__action-bar__container", children: TableActions && (jsx("div", { className: "tanstack-table__action-bar__button-container", children: jsx(TableActions, { selectedItems: selectedItems, unselectRows: unselectRows }) })) })) }));
|
|
25653
25648
|
}
|
|
25654
25649
|
|
|
25655
25650
|
function NoResults({ clearFilters, hasFilters, message }) {
|
|
@@ -42862,7 +42857,7 @@ var lodashExports = lodash.exports;
|
|
|
42862
42857
|
|
|
42863
42858
|
const TablePagination = ({ rowsPerPage, rowCount, onChangePage, currentPage, totalEntriesText, }) => {
|
|
42864
42859
|
const totalPages = Math.ceil(rowCount / rowsPerPage);
|
|
42865
|
-
return (jsx("div", { className: "table__pagination", "data-testid": "tanstack-table-pagination", children: jsxs(Row, { align: "center", justify: "between", children: [jsx(Col, { xs: "content", children: totalEntriesText && (jsx("span", { "data-testid": "table-pagination-total-entries", className: "table__pagination-total-entries", children: totalEntriesText })) }), jsx(Col, { xs: "content", children: jsx(Pagination, { "data-testid": "table-pagination-component", totalPages: totalPages, currentPage: currentPage, onChange: (page) => onChangePage(page
|
|
42860
|
+
return (jsx("div", { className: "table__pagination", "data-testid": "tanstack-table-pagination", children: jsxs(Row, { align: "center", justify: "between", children: [jsx(Col, { xs: "content", children: totalEntriesText && (jsx("span", { "data-testid": "table-pagination-total-entries", className: "table__pagination-total-entries", children: totalEntriesText })) }), jsx(Col, { xs: "content", children: jsx(Pagination, { "data-testid": "table-pagination-component", totalPages: totalPages, currentPage: currentPage, onChange: (page) => onChangePage(page) }) })] }) }));
|
|
42866
42861
|
};
|
|
42867
42862
|
|
|
42868
42863
|
function useTanstackTable({ defaultColumns }) {
|
|
@@ -42871,7 +42866,6 @@ function useTanstackTable({ defaultColumns }) {
|
|
|
42871
42866
|
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
|
42872
42867
|
const [rowSelection, setRowSelection] = useState({});
|
|
42873
42868
|
const [formattedColumns, setFormattedColumns] = useState(columns);
|
|
42874
|
-
const [isClickedRow, setIsClickedRow] = useState([]);
|
|
42875
42869
|
// Tracks changes to browser width to allow for updating of column widths
|
|
42876
42870
|
useEffect(() => {
|
|
42877
42871
|
const handleResize = () => {
|
|
@@ -42890,8 +42884,6 @@ function useTanstackTable({ defaultColumns }) {
|
|
|
42890
42884
|
windowWidth,
|
|
42891
42885
|
formattedColumns,
|
|
42892
42886
|
setFormattedColumns,
|
|
42893
|
-
isClickedRow,
|
|
42894
|
-
setIsClickedRow,
|
|
42895
42887
|
};
|
|
42896
42888
|
}
|
|
42897
42889
|
|
|
@@ -42902,7 +42894,7 @@ const getCommonPinningStyles = (column) => {
|
|
|
42902
42894
|
return {
|
|
42903
42895
|
boxShadow: isLastLeftPinnedColumn ? '-4px 0 4px -4px gray inset' : undefined,
|
|
42904
42896
|
left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
|
|
42905
|
-
position: isPinned ? 'sticky' : '
|
|
42897
|
+
position: isPinned ? 'sticky' : 'initial',
|
|
42906
42898
|
zIndex: isPinned ? 1 : 0,
|
|
42907
42899
|
};
|
|
42908
42900
|
};
|
|
@@ -42946,37 +42938,32 @@ const TableHeader = forwardRef(({ table }, ref) => {
|
|
|
42946
42938
|
}) }, headerGroup.id))) }));
|
|
42947
42939
|
});
|
|
42948
42940
|
|
|
42949
|
-
const TableBody = ({ table,
|
|
42950
|
-
const toggleRow = (id) => {
|
|
42951
|
-
if (isClickedRow.includes(id)) {
|
|
42952
|
-
setIsClickedRow((state) => state.filter((item) => item !== id));
|
|
42953
|
-
}
|
|
42954
|
-
else {
|
|
42955
|
-
setIsClickedRow((state) => [...state, id]);
|
|
42956
|
-
}
|
|
42957
|
-
};
|
|
42941
|
+
const TableBody = ({ table, onRowClick, isLoading, columnsLength, activeRows, }) => {
|
|
42958
42942
|
return (jsxs(Fragment, { children: [table.getRowModel().rows.map((row) => (jsx("tr", { className: classNames('tanstack-table__tbody__tr', {
|
|
42959
42943
|
'is-selected': row.getIsSelected(),
|
|
42960
|
-
'show-hover': !!
|
|
42961
|
-
'is-clicked':
|
|
42962
|
-
}),
|
|
42963
|
-
if (!!onClickRow) {
|
|
42964
|
-
toggleRow(row.id);
|
|
42965
|
-
onClickRow(row);
|
|
42966
|
-
}
|
|
42967
|
-
}, children: row.getVisibleCells().map((cell) => {
|
|
42944
|
+
'show-hover': !!onRowClick,
|
|
42945
|
+
'is-clicked': activeRows.includes(row.id), // Checkbox Is clicked
|
|
42946
|
+
}), children: row.getVisibleCells().map((cell) => {
|
|
42968
42947
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
42969
42948
|
const { columnDef } = cell.column;
|
|
42970
42949
|
return (jsx("td", { className: classNames('tanstack-table__tbody__td', {
|
|
42971
42950
|
'pa-0': !!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.hasNoPadding),
|
|
42972
|
-
}), style: Object.assign({}, getTdStyles(cell.column, (_f = (_e = (_d = columnDef.meta) === null || _d === void 0 ? void 0 : _d.styles) === null || _e === void 0 ? void 0 : _e.cell) === null || _f === void 0 ? void 0 : _f.textAlign, (_h = (_g = columnDef.meta) === null || _g === void 0 ? void 0 : _g.styles) === null || _h === void 0 ? void 0 : _h.definedColumnSize, cell.column.getSize())),
|
|
42951
|
+
}), style: Object.assign({}, getTdStyles(cell.column, (_f = (_e = (_d = columnDef.meta) === null || _d === void 0 ? void 0 : _d.styles) === null || _e === void 0 ? void 0 : _e.cell) === null || _f === void 0 ? void 0 : _f.textAlign, (_h = (_g = columnDef.meta) === null || _g === void 0 ? void 0 : _g.styles) === null || _h === void 0 ? void 0 : _h.definedColumnSize, cell.column.getSize())), onClick: () => {
|
|
42952
|
+
var _a, _b, _c;
|
|
42953
|
+
// if the cell is not preventRowSelection, then we can click the row
|
|
42954
|
+
if (!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.preventRowSelection)) {
|
|
42955
|
+
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row);
|
|
42956
|
+
}
|
|
42957
|
+
}, children: flexRender(columnDef.cell, cell.getContext()) }, cell.id));
|
|
42973
42958
|
}) }, row.id))), isLoading && (jsx("tr", { className: "tanstack-table__tbody__tr", children: jsx("td", { className: classNames('tanstack-table__centered-row', {
|
|
42974
42959
|
'is-Loading': isLoading,
|
|
42975
42960
|
}), colSpan: columnsLength, children: jsx(CirclePulse, { "data-testid": "loading-indicator" }) }) }))] }));
|
|
42976
42961
|
};
|
|
42977
42962
|
|
|
42978
|
-
function TanstackTable(
|
|
42979
|
-
|
|
42963
|
+
function TanstackTable(_a) {
|
|
42964
|
+
var { columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage = 1000, onChangePage, totalEntriesText, TableActions, error, enableRowSelection = true, clearFilters, hasFilters, showPagination = true, isLoading = false, defaultPinnedColumns, onRowClick, activeRows = [], actionBarClassName } = _a, rest = __rest(_a, ["columns", "data", "className", "currentPage", "rowCount", "rowsPerPage", "onChangePage", "totalEntriesText", "TableActions", "error", "enableRowSelection", "clearFilters", "hasFilters", "showPagination", "isLoading", "defaultPinnedColumns", "onRowClick", "activeRows", "actionBarClassName"]);
|
|
42965
|
+
const { columns, defaultData, windowWidth, rowSelection, // This refers to the checkboxes.
|
|
42966
|
+
setRowSelection, formattedColumns, setFormattedColumns, } = useTanstackTable({
|
|
42980
42967
|
defaultColumns,
|
|
42981
42968
|
});
|
|
42982
42969
|
const thRefs = useRef({});
|
|
@@ -42989,23 +42976,13 @@ function TanstackTable({ columns: defaultColumns, data, className, currentPage,
|
|
|
42989
42976
|
});
|
|
42990
42977
|
setFormattedColumns(updatedColumns);
|
|
42991
42978
|
}, [data, columns, windowWidth]);
|
|
42992
|
-
const table = useReactTable({
|
|
42993
|
-
data: data !== null && data !== void 0 ? data : defaultData,
|
|
42994
|
-
columns: formattedColumns,
|
|
42995
|
-
state: {
|
|
42979
|
+
const table = useReactTable(Object.assign(Object.assign({}, rest), { data: data !== null && data !== void 0 ? data : defaultData, columns: formattedColumns, state: {
|
|
42996
42980
|
rowSelection,
|
|
42997
|
-
},
|
|
42998
|
-
enableRowSelection,
|
|
42999
|
-
onRowSelectionChange: setRowSelection,
|
|
43000
|
-
getCoreRowModel: getCoreRowModel(),
|
|
43001
|
-
manualPagination: true,
|
|
43002
|
-
debugTable: true,
|
|
43003
|
-
initialState: {
|
|
42981
|
+
}, enableRowSelection, onRowSelectionChange: setRowSelection, getCoreRowModel: getCoreRowModel(), manualPagination: true, getRowId: (row) => row === null || row === void 0 ? void 0 : row.id, initialState: {
|
|
43004
42982
|
columnPinning: {
|
|
43005
42983
|
left: defaultPinnedColumns,
|
|
43006
42984
|
},
|
|
43007
|
-
}
|
|
43008
|
-
});
|
|
42985
|
+
} }));
|
|
43009
42986
|
const totalRowsOnPage = table.getRowModel().rows.length;
|
|
43010
42987
|
const hasPaginationProps = !lodashExports.isNil(currentPage) &&
|
|
43011
42988
|
!lodashExports.isNil(rowCount) &&
|
|
@@ -43022,7 +42999,7 @@ function TanstackTable({ columns: defaultColumns, data, className, currentPage,
|
|
|
43022
42999
|
? (_a = error === null || error === void 0 ? void 0 : error.errorMessage) !== null && _a !== void 0 ? _a : 'There was an error isLoading the data.'
|
|
43023
43000
|
: 'No results found.' }) }) }));
|
|
43024
43001
|
}
|
|
43025
|
-
return (jsx(TableBody, { table: table,
|
|
43002
|
+
return (jsx(TableBody, { table: table, onRowClick: onRowClick, isLoading: isLoading, columnsLength: columns.length, activeRows: activeRows }));
|
|
43026
43003
|
};
|
|
43027
43004
|
return (jsxs("div", { className: "tanstack-table__outer-container", children: [jsxs("div", { className: "tanstack-table__container", children: [jsxs("table", { className: classNames('tanstack-table', className, {
|
|
43028
43005
|
'is-Loading': isLoading,
|