@hazelcast/ui 1.3.3-next.25 → 1.3.3-next.27

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.
Files changed (55) hide show
  1. package/lib/AppHeader/AppHeader.module.scss +2 -2
  2. package/lib/AppHeader/AppHeaderMenu/AppHeaderMenu.module.scss +1 -1
  3. package/lib/AppHeader/SelectCluster/SelectCluster.module.scss +3 -3
  4. package/lib/AppSidebar/AppSidebar.module.scss +1 -1
  5. package/lib/AppSidebar/AppSidebarFavoriteButton/AppSidebarFavoriteButton.module.scss +2 -2
  6. package/lib/AppSidebar/AppSidebarItem/AppSidebarItem.module.scss +3 -3
  7. package/lib/Button.d.ts +2 -1
  8. package/lib/Button.js.map +1 -1
  9. package/lib/Button.module.scss +9 -9
  10. package/lib/Icon.d.ts +2 -1
  11. package/lib/Icon.js +2 -2
  12. package/lib/Icon.js.map +1 -1
  13. package/lib/Pagination.js +9 -9
  14. package/lib/Pagination.js.map +1 -1
  15. package/lib/Table/Cell.d.ts +5 -3
  16. package/lib/Table/Cell.js +1 -1
  17. package/lib/Table/Cell.js.map +1 -1
  18. package/lib/Table/Cell.module.scss +6 -2
  19. package/lib/Table/CellWrapper.d.ts +6 -6
  20. package/lib/Table/CellWrapper.js +6 -6
  21. package/lib/Table/CellWrapper.js.map +1 -1
  22. package/lib/Table/EnhancedRenderers.d.ts +8 -10
  23. package/lib/Table/EnhancedRenderers.js +6 -10
  24. package/lib/Table/EnhancedRenderers.js.map +1 -1
  25. package/lib/Table/Header.d.ts +9 -5
  26. package/lib/Table/Header.js +12 -7
  27. package/lib/Table/Header.js.map +1 -1
  28. package/lib/Table/Header.module.scss +7 -3
  29. package/lib/Table/Row.d.ts +5 -3
  30. package/lib/Table/Row.js +4 -4
  31. package/lib/Table/Row.js.map +1 -1
  32. package/lib/Table/Row.module.scss +8 -0
  33. package/lib/Table/Table.d.ts +21 -36
  34. package/lib/Table/Table.js +102 -93
  35. package/lib/Table/Table.js.map +1 -1
  36. package/lib/Table/Table.module.scss +4 -0
  37. package/lib/Table/TableContent.d.ts +7 -7
  38. package/lib/Table/TableContent.js +20 -14
  39. package/lib/Table/TableContent.js.map +1 -1
  40. package/lib/Table/helpers.d.ts +2 -0
  41. package/lib/Table/helpers.js +10 -0
  42. package/lib/Table/helpers.js.map +1 -0
  43. package/lib/Table/tableTypes.d.ts +80 -0
  44. package/lib/Table/tableTypes.js +2 -0
  45. package/lib/Table/tableTypes.js.map +1 -0
  46. package/lib/Table/useTrackTableState.d.ts +3 -0
  47. package/lib/Table/useTrackTableState.js +30 -0
  48. package/lib/Table/useTrackTableState.js.map +1 -0
  49. package/lib/Table/utils.d.ts +16 -0
  50. package/lib/Table/utils.js +121 -0
  51. package/lib/Table/utils.js.map +1 -0
  52. package/lib/Tooltip.module.scss +3 -3
  53. package/package.json +5 -4
  54. package/styles/constants/_colors.scss +36 -18
  55. package/styles/helpers/_gradients.scss +39 -6
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/Table/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,OAAO,EAAE,WAAW,EAAwD,MAAM,EAAE,MAAM,OAAO,CAAA;AACrH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAE5D,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAqBzC,MAAM,CAAC,MAAM,MAAM,GAAoB,CAAC,EACtC,KAAK,GAAG,MAAM,EACd,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,UAAU,EACV,eAAe,EACf,OAAO,EACP,KAAK,EACL,SAAS,EACT,IAAI,EACJ,KAAK,EACL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NeutralWhite;
26
25
  }
27
26
 
28
27
  .resizing,
@@ -33,6 +32,11 @@
33
32
 
34
33
  .container {
35
34
  position: relative;
35
+ flex-grow: 1;
36
+ flex-basis: auto;
37
+ flex-shrink: 0;
38
+ background: c.$colorNeutralGray;
39
+ border-right: 1px solid c.$colorNeutralWhite;
36
40
 
37
41
  .th {
38
42
  display: flex;
@@ -41,7 +45,7 @@
41
45
  padding-left: c.$grid * 5;
42
46
  padding-right: c.$grid * 5;
43
47
  color: c.$colorText;
44
- background: #e9f0f9;
48
+ box-sizing: border-box;
45
49
 
46
50
  @include c.typographyBodySmall('bold');
47
51
  @include h.overflowEllipsis;
@@ -79,7 +83,7 @@
79
83
  }
80
84
 
81
85
  &:hover {
82
- background-color: #ccdff5;
86
+ background-color: c.$colorNeutralGrayDarker;
83
87
  }
84
88
  }
85
89
 
@@ -1,6 +1,8 @@
1
- import { FC, AnchorHTMLAttributes } from 'react';
2
- import { TableHeaderGroupProps } from 'react-table';
3
- type RowBase = Omit<TableHeaderGroupProps, 'key'> & {
1
+ import { FC, AnchorHTMLAttributes, CSSProperties } from 'react';
2
+ type RowBase = {
3
+ className?: string;
4
+ style?: CSSProperties;
5
+ role?: string;
4
6
  ariaRowIndex?: number;
5
7
  };
6
8
  export type RowProps = RowBase & {
package/lib/Table/Row.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import cn from 'classnames';
3
- import styles from './Row.module.scss';
4
3
  import { useUID } from 'react-uid';
5
4
  import { keyIsOneOf } from '../utils/keyboard';
5
+ import styles from './Row.module.scss';
6
6
  export const Row = ({ children, className, style, role, ariaRowIndex, onClick }) => {
7
- const onKeyPress = useCallback((event) => {
7
+ const onKeyDown = useCallback((event) => {
8
8
  event.preventDefault();
9
9
  if (keyIsOneOf(event, 'Enter') && onClick) {
10
10
  onClick();
@@ -12,7 +12,7 @@ export const Row = ({ children, className, style, role, ariaRowIndex, onClick })
12
12
  }, [onClick]);
13
13
  return (React.createElement("div", { "data-test": "table-cell-row", className: cn(styles.row, {
14
14
  [styles.clickable]: !!onClick,
15
- }, className), style: style, "aria-rowindex": ariaRowIndex, role: role, tabIndex: onClick ? 0 : undefined, onKeyPress: onClick ? onKeyPress : undefined, onClick: onClick }, children));
15
+ }, className), style: style, "aria-rowindex": ariaRowIndex, role: role, tabIndex: onClick ? 0 : undefined, onKeyDown: onClick ? onKeyDown : undefined, onClick: onClick }, children));
16
16
  };
17
17
  // eslint-disable-next-line jsx-a11y/anchor-has-content
18
18
  const DefaultAnchor = (props) => React.createElement("a", { ...props });
@@ -21,5 +21,5 @@ export const LinkRow = ({ children, className, style, role, ariaRowIndex, href,
21
21
  return (React.createElement("div", { "data-test": "table-cell-row", className: cn(styles.linkRow, className), role: role, "aria-rowindex": ariaRowIndex, "aria-owns": anchorId },
22
22
  React.createElement(AnchorComponent, { className: styles.link, style: style, href: href, id: anchorId }, children)));
23
23
  };
24
- export const HeaderRow = ({ children, className, style, role, ariaRowIndex }) => (React.createElement("div", { "data-test": "table-header-row", className: cn(styles.headerRow, className), style: style, role: role, "aria-rowindex": ariaRowIndex }, children));
24
+ export const HeaderRow = ({ children, className, style, role, ariaRowIndex }) => (React.createElement("div", { "data-test": "table-header-row", className: cn(styles.row, className), style: style, role: role, "aria-rowindex": ariaRowIndex }, children));
25
25
  //# sourceMappingURL=Row.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sourceRoot":"","sources":["../../src/Table/Row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,WAAW,EAAuC,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAO9C,MAAM,CAAC,MAAM,GAAG,GAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS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AAI,mBAAiB,YAAY,IAC1H,QAAQ,CACL,CACP,CAAA"}
@@ -1,8 +1,14 @@
1
1
  @use '../../styles/constants' as c;
2
2
  @use '../../styles/helpers' as h;
3
3
 
4
+ @mixin rowBase {
5
+ display: flex;
6
+ width: 100%;
7
+ }
8
+
4
9
  .row {
5
10
  @include c.typographyBodySmall;
11
+ @include rowBase;
6
12
 
7
13
  &.clickable {
8
14
  cursor: pointer;
@@ -25,10 +31,12 @@
25
31
 
26
32
  .linkRow {
27
33
  cursor: pointer;
34
+ @include rowBase;
28
35
 
29
36
  .link {
30
37
  text-decoration: none;
31
38
  background-color: inherit;
39
+ @include rowBase;
32
40
 
33
41
  &:focus-visible {
34
42
  @include h.outlineSimple;
@@ -1,34 +1,11 @@
1
1
  import { DataTestProp } from '@hazelcast/helpers';
2
2
  import { AnchorHTMLAttributes, FC, ReactChild, ReactElement, ReactNode } from 'react';
3
- import { TableOptions, Row as RowType, Cell as CellType, Column as ColumnType, TableInstance, SortingRule } from 'react-table';
4
3
  import { PaginationProps } from '../Pagination';
5
4
  import { CellProps } from './Cell';
6
5
  import { RowProps } from './Row';
7
- export type { Accessor, Cell, Renderer, Row, CellProps, HeaderGroup, TableInstance, TableState } from 'react-table';
8
- export type Column<T extends object> = ColumnType<T> & {
9
- canHide?: boolean;
10
- };
11
- declare module 'react-table' {
12
- interface TableOptions<D extends object = {}> extends UsePaginationOptions<D & UseExpandedRowProps<D>>, UseSortByOptions<D>, UseFiltersOptions<D>, UseRowSelectOptions<D>, UseGroupByOptions<D>, UseExpandedOptions<D>, UseResizeColumnsOptions<D>, Record<string, any> {
13
- }
14
- interface Hooks<D extends object = {}> extends UseSortByHooks<D>, UseRowSelectHooks<D>, UseGroupByHooks<D> {
15
- }
16
- interface TableInstance<D extends object = {}> extends UsePaginationInstanceProps<D>, UseSortByInstanceProps<D>, UseFiltersInstanceProps<D>, UseRowSelectInstanceProps<D>, UseGroupByInstanceProps<D> {
17
- }
18
- interface TableState<D extends object = {}> extends UsePaginationState<D>, UseSortByState<D>, UseFiltersState<D>, UseRowSelectState<D>, UseGroupByState<D>, UseColumnOrderState<D>, UseResizeColumnsState<D> {
19
- }
20
- interface ColumnInterface<D extends object = {}> extends UseSortByColumnOptions<D>, UseFiltersColumnOptions<D>, UseGroupByColumnOptions<D>, UseResizeColumnsColumnOptions<D> {
21
- Footer?: string | Renderer<TableInstance<D>>;
22
- align?: 'left' | 'right' | 'center';
23
- }
24
- interface ColumnInstance<D extends object = {}> extends UseSortByColumnProps<D>, UseFiltersColumnProps<D>, UseGroupByColumnProps<D>, UseResizeColumnsColumnProps<D> {
25
- }
26
- interface Cell<D extends object = {}, V = any> extends UseGroupByCellProps<D>, UseRowStateCellProps<D> {
27
- }
28
- interface Row<D extends object = {}> extends UseGroupByRowProps<D>, UseRowSelectRowProps<D>, UseExpandedRowProps<D> {
29
- }
30
- }
6
+ import { CellType, ColumnType, InitialState, RowData, RowType, SortingRule, TableState } from './tableTypes';
31
7
  export type PaginationOptions = Partial<Pick<PaginationProps, 'pageSizeOptions'>>;
8
+ export * from './tableTypes';
32
9
  /**
33
10
  * `defaultPageSize` should be one of the values in `pageSizeOptions`.
34
11
  * If it's not it won't break anything but it is a bad UX
@@ -48,11 +25,10 @@ export type ControlledPaginationProps = {
48
25
  manualPagination?: boolean;
49
26
  onPaginationChange?: (paginationChangeProps: PaginationChangeProps) => void;
50
27
  };
51
- export type ControlledSortingProps<D extends object> = {
52
- manualSortBy?: boolean;
53
- onSortingChange?: (sortBy: SortingRule<D>[]) => void;
28
+ export type ControlledSortingProps = {
29
+ onSortingChange?: (sortBy: SortingRule[]) => void;
54
30
  };
55
- type CustomTableRowClickProps<D extends object> = {
31
+ type CustomTableRowClickProps<D extends RowData> = {
56
32
  onRowClick?: (rowInfo: RowType<D>) => void;
57
33
  getHref?: never;
58
34
  AnchorComponent?: never;
@@ -61,8 +37,9 @@ type CustomTableRowClickProps<D extends object> = {
61
37
  onRowClick?: never;
62
38
  AnchorComponent?: FC<AnchorHTMLAttributes<HTMLAnchorElement>>;
63
39
  };
64
- type CustomTableProps<D extends object> = {
40
+ type CustomTableProps<D extends RowData> = {
65
41
  loading?: boolean;
42
+ tableId?: string;
66
43
  overlayLoading?: boolean;
67
44
  className?: string;
68
45
  hideHeader?: boolean;
@@ -75,18 +52,24 @@ type CustomTableProps<D extends object> = {
75
52
  getCustomRowProps?: (rowInfo: RowType<D>) => RowProps;
76
53
  getCustomCellProps?: (cellInfo: CellType<D>) => CellProps;
77
54
  onRenderedContentChange?: (newPage: RowType<D>[]) => void;
78
- autoResetGlobalFilter?: boolean;
79
55
  pageIndex?: number;
80
56
  onPageChange?: (newPage: number) => void;
81
57
  onRowSelect?: (ids: string[]) => void;
82
58
  columnsOrdering?: boolean;
83
- children?: (table: ReactElement, tableInstance: TableInstance<D>) => ReactElement;
59
+ children?: (table: ReactElement) => ReactElement;
84
60
  renderRowSubComponent?: (props: RowType<D>) => ReactNode;
85
- canExpand?: (row: RowType<D>) => void;
61
+ canExpand?: (row: RowType<D>) => boolean;
86
62
  onCopy?: (data: (string | undefined)[][]) => void;
63
+ initialState?: InitialState;
64
+ onStateChange?: ((newState: TableState) => void) | null;
87
65
  } & CustomTableRowClickProps<D> & DataTestProp;
88
- export type TableProps<D extends object> = TableOptions<D> & ExtendedPaginationProps & ControlledPaginationProps & ControlledSortingProps<D> & CustomTableProps<D>;
89
- export type { ColumnType, RowType, CellType };
66
+ export type TableProps<D extends RowData> = {
67
+ data: D[];
68
+ columns: ColumnType<D>[];
69
+ pageCount?: number;
70
+ disableSortBy?: boolean;
71
+ pageSize?: number;
72
+ } & ExtendedPaginationProps & ControlledPaginationProps & ControlledSortingProps & CustomTableProps<D>;
90
73
  /**
91
74
  * ### Purpose
92
75
  * Table component allows to arrange data in rows and columns.
@@ -97,4 +80,6 @@ export type { ColumnType, RowType, CellType };
97
80
  * - Rows can be clickable. If you supply Table with `getHref` function rows will become <a> tags!
98
81
  * - Is able to resize columns out of the box
99
82
  */
100
- export declare const Table: <D extends object>({ "data-test": dataTest, autoResetSortBy, columns: propColumns, data, defaultColumn, disableSortBy, onPaginationChange, onSortingChange, manualPagination, manualSortBy, onRenderedContentChange, autoResetPage, hidePagination, pageCount: controlledPageCount, defaultPageSize, paginationOptions, onRowClick, getHref, AnchorComponent, getCustomRowProps, getCustomCellProps, loading, noDataTitle, pageIndex: incomingPageIndex, initialState, className, headerClassName, contentClassName, footerClassName, searchValue, hideHeader, autoResetGlobalFilter, onPageChange, overlayLoading, onRowSelect, columnsOrdering, autoResetResize, autoResetSelectedRows, children, renderRowSubComponent, autoResetExpanded, onCopy, canExpand, }: TableProps<D>) => ReactElement;
83
+ export declare const Table: <D extends object & {
84
+ subRows?: D[] | undefined;
85
+ }>({ "data-test": dataTest, columns: propColumns, data, disableSortBy, onPaginationChange, onSortingChange, manualPagination, onRenderedContentChange, hidePagination, pageCount: controlledPageCount, defaultPageSize, paginationOptions, onRowClick, getHref, AnchorComponent, getCustomRowProps, getCustomCellProps, loading, noDataTitle, pageIndex: incomingPageIndex, initialState, className, headerClassName, contentClassName, footerClassName, searchValue, hideHeader, onPageChange, overlayLoading, onRowSelect, columnsOrdering, children, renderRowSubComponent, onCopy, canExpand, onStateChange, }: TableProps<D>) => ReactElement;
@@ -1,11 +1,12 @@
1
+ import debounce from 'lodash/debounce';
1
2
  import React, { useCallback, useEffect, useRef, useMemo, useState, } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { HotKeys } from 'react-hotkeys';
4
- import { useTable, usePagination, useSortBy, useAsyncDebounce, useResizeColumns, useFlexLayout, useGlobalFilter, useColumnOrder, useExpanded, } from 'react-table';
5
+ import { useReactTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getExpandedRowModel, getFilteredRowModel, } from '@tanstack/react-table';
5
6
  import { AlertTriangle, ChevronDown, ChevronUp } from 'react-feather';
6
7
  import { Pagination } from '../Pagination';
7
8
  import { Cell } from './Cell';
8
- import { EnhancedHeaderFooterRenderer } from './EnhancedRenderers';
9
+ import { EnhancedCellRenderer, EnhancedHeaderFooterRenderer } from './EnhancedRenderers';
9
10
  import { Header } from './Header';
10
11
  import { HeaderRow, Row } from './Row';
11
12
  import { Loader } from '../Loader';
@@ -16,14 +17,11 @@ import { TableContent } from './TableContent';
16
17
  import { ROW_EXPANDER_COLUMN_ID } from './constants';
17
18
  import { useColumnsSelection, ContextMenu } from './features/columnsSelection';
18
19
  import { useRefValue } from '../hooks';
20
+ import { useTrackTableState } from './useTrackTableState';
21
+ import { getCellStyle, getColumnDef, getRowStyle, getTableInitialState, prepareRow } from './utils';
19
22
  import styles from './Table.module.scss';
20
23
  import styleConsts from '../../styles/constants/export.module.scss';
21
- const column = {
22
- // When using the useFlexLayout:
23
- minWidth: Number(styleConsts.tableColumnMinWidth),
24
- width: Number(styleConsts.tableColumnWidth),
25
- maxWidth: Number(styleConsts.tableColumnMaxWidth), // maxWidth is only used as a limit for resizing
26
- };
24
+ export * from './tableTypes';
27
25
  /**
28
26
  * ### Purpose
29
27
  * Table component allows to arrange data in rows and columns.
@@ -35,9 +33,11 @@ const column = {
35
33
  * - Is able to resize columns out of the box
36
34
  */
37
35
  // Inspiration here: https://react-table.tanstack.com/docs/examples/basic
38
- export const Table = ({ 'data-test': dataTest, autoResetSortBy = false, columns: propColumns, data, defaultColumn = column, disableSortBy, onPaginationChange, onSortingChange, manualPagination, manualSortBy, onRenderedContentChange, autoResetPage = false, hidePagination = false, pageCount: controlledPageCount, defaultPageSize = 10, paginationOptions, onRowClick, getHref, AnchorComponent, getCustomRowProps, getCustomCellProps, loading, noDataTitle = 'The table is empty', pageIndex: incomingPageIndex, initialState = { pageIndex: incomingPageIndex || 0, pageSize: defaultPageSize }, className = '', headerClassName = '', contentClassName = '', footerClassName = '', searchValue, hideHeader, autoResetGlobalFilter = false, onPageChange, overlayLoading, onRowSelect, columnsOrdering = false, autoResetResize = false, autoResetSelectedRows = false, children, renderRowSubComponent, autoResetExpanded = false, onCopy, canExpand, }) => {
36
+ export const Table = ({ 'data-test': dataTest, columns: propColumns, data, disableSortBy, onPaginationChange, onSortingChange, manualPagination, onRenderedContentChange, hidePagination = false, pageCount: controlledPageCount, defaultPageSize = 10, paginationOptions, onRowClick, getHref, AnchorComponent, getCustomRowProps, getCustomCellProps, loading, noDataTitle = 'The table is empty', pageIndex: incomingPageIndex, initialState = { paginationOptions: { pageIndex: incomingPageIndex || 0, pageSize: defaultPageSize } }, className = '', headerClassName = '', contentClassName = '', footerClassName = '', searchValue, hideHeader, onPageChange, overlayLoading, onRowSelect, columnsOrdering = false, children, renderRowSubComponent, onCopy, canExpand, onStateChange, }) => {
39
37
  var _a;
40
38
  const getOncopy = useRefValue(onCopy);
39
+ const getCanExpand = useRefValue(canExpand);
40
+ const getRenderRowSubComponent = useRefValue(renderRowSubComponent);
41
41
  const [contextMenuAnchorEl, setContextMenuAnchorEl] = useState(null);
42
42
  const draggedColumnRef = useRef(null);
43
43
  const previousIncomingPageIndex = usePrevious(incomingPageIndex);
@@ -53,76 +53,94 @@ export const Table = ({ 'data-test': dataTest, autoResetSortBy = false, columns:
53
53
  }, [onCopy]);
54
54
  const columns = useMemo(() => {
55
55
  if (renderRowSubComponent || data.some((item) => 'subRows' in item)) {
56
- return [
57
- {
58
- width: 60,
59
- disableResizing: true,
60
- id: ROW_EXPANDER_COLUMN_ID,
61
- Header: () => React.createElement("span", { role: "contentinfo", "aria-label": "row-expander-column-header" }),
62
- Cell: ({ row }) => {
63
- if ((row.canExpand || renderRowSubComponent) && (!canExpand || (canExpand && canExpand(row)))) {
64
- const rowProps = row.getToggleRowExpandedProps();
65
- return (
66
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events
67
- React.createElement("div", { tabIndex: 0, role: "button", "data-test": "row-expander", className: styles.expander, ...rowProps, onClick: (e) => {
68
- e.preventDefault();
69
- rowProps.onClick(e);
70
- } },
71
- React.createElement(Icon, { icon: row.isExpanded ? ChevronUp : ChevronDown, ariaLabel: "row-expander" })));
72
- }
73
- return null;
74
- },
56
+ const expander = {
57
+ width: 60,
58
+ disableResizing: true,
59
+ id: ROW_EXPANDER_COLUMN_ID,
60
+ Header: () => React.createElement("span", { role: "contentinfo", "aria-label": "row-expander-column-header" }),
61
+ Cell: ({ row }) => {
62
+ if (row.getCanExpand()) {
63
+ return (
64
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
65
+ React.createElement("div", { tabIndex: 0, role: "button", "data-test": "row-expander", "aria-expanded": row.getIsExpanded(), className: styles.expander, onClick: (e) => {
66
+ e.preventDefault();
67
+ row.getToggleExpandedHandler()();
68
+ } },
69
+ React.createElement(Icon, { icon: row.getIsExpanded() ? ChevronUp : ChevronDown, ariaLabel: "row-expander" })));
70
+ }
71
+ return React.createElement(React.Fragment, null, null);
75
72
  },
76
- ...propColumns,
77
- ];
73
+ };
74
+ return [expander, ...propColumns].map(getColumnDef);
78
75
  }
79
- return propColumns;
80
- }, [propColumns, canExpand, data, renderRowSubComponent]);
81
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
82
- const onPaginationChangeDebounced = useAsyncDebounce(onPaginationChange, 200);
83
- const tableInstance = useTable({
76
+ return propColumns.map(getColumnDef);
77
+ }, [propColumns, data, renderRowSubComponent]);
78
+ const defaultColumn = useMemo(() => ({
79
+ cell: (props) => React.createElement(EnhancedCellRenderer, { cell: props.cell, columnResizing: props.column.getIsResizing() }),
80
+ minSize: Number(styleConsts.tableColumnMinWidth),
81
+ size: Number(styleConsts.tableColumnWidth),
82
+ maxSize: Number(styleConsts.tableColumnMaxWidth), // maxWidth is only used as a limit for resizing
83
+ }), []);
84
+ const tableInitialState = useMemo(() => getTableInitialState(initialState), [initialState]);
85
+ const tableInstance = useReactTable({
84
86
  columns,
85
87
  data,
86
- disableSortBy,
87
- disableMultiSort: true,
88
- // https://react-table.tanstack.com/docs/faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes
89
- autoResetSortBy,
88
+ enableSorting: !disableSortBy,
89
+ enableMultiSort: false,
90
90
  // Pass our hoisted table state
91
- initialState,
91
+ initialState: tableInitialState,
92
92
  // Tell the usePagination hook that we'll handle our own data fetching
93
93
  manualPagination: manualPagination,
94
- manualSortBy,
95
94
  // This means we'll also have to provide our own pageCount
96
95
  pageCount: controlledPageCount,
97
- autoResetPage,
98
96
  defaultColumn,
99
- autoResetGlobalFilter,
100
- autoResetResize,
101
- autoResetSelectedRows,
102
- autoResetExpanded,
97
+ columnResizeMode: 'onChange',
103
98
  paginateExpandedRows: false,
104
- }, useGlobalFilter, useSortBy, useExpanded, usePagination, useFlexLayout, useResizeColumns, useColumnOrder);
105
- const { getTableProps, headerGroups, footerGroups, prepareRow, page, visibleColumns, canPreviousPage, canNextPage, pageCount, gotoPage, nextPage, previousPage, setPageSize,
106
- // Get the state from the instance
107
- state: { pageIndex, pageSize, sortBy, columnResizing, selectedRowIds, hiddenColumns }, setGlobalFilter, setColumnOrder, } = tableInstance;
99
+ getSubRows: useCallback((row) => row.subRows, []),
100
+ getRowCanExpand: useCallback((row) => {
101
+ var _a;
102
+ const cb = getCanExpand();
103
+ if (cb) {
104
+ return cb(prepareRow(row));
105
+ }
106
+ if (getRenderRowSubComponent()) {
107
+ return true;
108
+ }
109
+ return ((_a = row.subRows) === null || _a === void 0 ? void 0 : _a.length) > 0;
110
+ }, [getCanExpand, getRenderRowSubComponent]),
111
+ getCoreRowModel: getCoreRowModel(),
112
+ getPaginationRowModel: getPaginationRowModel(),
113
+ getSortedRowModel: getSortedRowModel(),
114
+ getExpandedRowModel: getExpandedRowModel(),
115
+ getFilteredRowModel: getFilteredRowModel(),
116
+ });
117
+ const { getVisibleFlatColumns, nextPage, setPageIndex: goToPage, getRowCount, getState, previousPage, setPageSize, setGlobalFilter, setColumnOrder, getPageCount, getCanNextPage, getCanPreviousPage, getFooterGroups, } = tableInstance;
118
+ useTrackTableState(tableInstance, onStateChange);
119
+ const footerGroups = getFooterGroups();
120
+ const page = tableInstance.getPaginationRowModel().rows;
121
+ const rowsPerPage = getRowCount();
122
+ const pageCount = getPageCount();
123
+ const { sorting: sortBy, columnOrder, columnSizing: columnResizing, rowSelection: selectedRowIds, pagination: { pageIndex, pageSize }, } = getState();
124
+ const getColumnOrder = useRefValue(columnOrder);
108
125
  // drag and drop
109
126
  const onDragStart = useCallback((e) => {
110
127
  draggedColumnRef.current = Number(e.dataTransfer.getData('text/plain'));
111
128
  }, []);
112
- const onDrop = useCallback((e, columnIndex) => {
129
+ const onDrop = useCallback((_, columnIndex) => {
113
130
  if (draggedColumnRef.current !== null && columnIndex !== draggedColumnRef.current) {
131
+ const visibleColumns = getColumnOrder() || getVisibleFlatColumns().map(({ id }) => id);
114
132
  const newColumns = [...visibleColumns];
115
133
  newColumns[columnIndex] = visibleColumns[draggedColumnRef.current];
116
134
  newColumns[draggedColumnRef.current] = visibleColumns[columnIndex];
117
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
118
- setColumnOrder(newColumns.map(({ id, accessor }) => (id || accessor)));
135
+ setColumnOrder(newColumns);
119
136
  }
120
- }, [visibleColumns, setColumnOrder]);
137
+ }, [getColumnOrder, getVisibleFlatColumns, setColumnOrder]);
121
138
  const columnsSelectionProps = useColumnsSelection({
122
- rowsPerPage: page.length,
139
+ rowsPerPage,
123
140
  columnsPerRow: columns.length,
124
141
  });
125
142
  const { onEndSelection, getSelectedColumns, selectedColumnValuesRef } = columnsSelectionProps;
143
+ const onPaginationChangeDebounced = useMemo(() => (onPaginationChange ? debounce(onPaginationChange, 200) : undefined), [onPaginationChange]);
126
144
  const onKeyUp = useCallback(() => {
127
145
  const callback = getOncopy();
128
146
  if (callback) {
@@ -147,25 +165,23 @@ export const Table = ({ 'data-test': dataTest, autoResetSortBy = false, columns:
147
165
  }, [onKeyUp, onEndSelection]);
148
166
  // Listen for changes in pagination and use the state to fetch new data. This is a recommended way to fetch new data: https://react-table.tanstack.com/docs/faq#how-can-i-use-the-table-state-to-fetch-new-data
149
167
  useEffect(() => {
150
- if (onPaginationChange) {
168
+ if (onPaginationChangeDebounced) {
151
169
  onPaginationChangeDebounced({ pageIndex, pageSize });
152
170
  }
153
- }, [onPaginationChange, onPaginationChangeDebounced, pageIndex, pageSize]);
171
+ }, [onPaginationChangeDebounced, pageIndex, pageSize]);
154
172
  useEffect(() => {
155
173
  if (onSortingChange) {
156
174
  onSortingChange(sortBy);
157
175
  }
158
176
  }, [sortBy, onSortingChange]);
159
177
  // Debounce our `fetchData` call for 200ms.
160
- // We can use non-null assertion here since we're checking existence of `fetchData` in the `useEffect` below
161
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
162
- const onRenderedContentChangeDebounced = useAsyncDebounce(onRenderedContentChange, 200);
178
+ const onRenderedContentChangeDebounced = useMemo(() => (onRenderedContentChange ? debounce(onRenderedContentChange, 200) : undefined), [onRenderedContentChange]);
163
179
  // Listen for changes in pagination and use the state to fetch new data. This is a recommended way to fetch new data: https://react-table.tanstack.com/docs/faq#how-can-i-use-the-table-state-to-fetch-new-data
164
180
  useEffect(() => {
165
- if (onRenderedContentChange) {
166
- onRenderedContentChangeDebounced(page);
181
+ if (onRenderedContentChangeDebounced) {
182
+ onRenderedContentChangeDebounced(page.map(prepareRow));
167
183
  }
168
- }, [onRenderedContentChange, onRenderedContentChangeDebounced, page]);
184
+ }, [onRenderedContentChangeDebounced, page]);
169
185
  // Apply global filter when searchValue changes
170
186
  useEffect(() => {
171
187
  if (searchValue !== undefined) {
@@ -175,14 +191,14 @@ export const Table = ({ 'data-test': dataTest, autoResetSortBy = false, columns:
175
191
  }, [searchValue, setGlobalFilter]);
176
192
  useEffect(() => {
177
193
  if (pageCount < pageIndex + 1) {
178
- gotoPage(pageCount - 1);
194
+ goToPage(pageCount - 1);
179
195
  }
180
- }, [pageIndex, pageCount, gotoPage]);
196
+ }, [pageIndex, pageCount, goToPage]);
181
197
  useEffect(() => {
182
198
  if (incomingPageIndex !== undefined && incomingPageIndex !== previousIncomingPageIndex) {
183
- gotoPage(incomingPageIndex);
199
+ goToPage(incomingPageIndex);
184
200
  }
185
- }, [gotoPage, incomingPageIndex, previousIncomingPageIndex]);
201
+ }, [goToPage, incomingPageIndex, previousIncomingPageIndex]);
186
202
  useEffect(() => {
187
203
  if (onRowSelect) {
188
204
  onRowSelect(Object.keys(selectedRowIds));
@@ -190,58 +206,51 @@ export const Table = ({ 'data-test': dataTest, autoResetSortBy = false, columns:
190
206
  }, [onRowSelect, selectedRowIds]);
191
207
  const hasData = data.length > 0;
192
208
  // If at least one of the columns has footer then we display the footer row
193
- const hasFooter = !loading && hasData && columns.some((col) => !!col.Footer);
209
+ const hasFooter = !loading && hasData && columns.some((col) => !!col.footer);
194
210
  // Header row has always aria-rowindex = 1.
195
211
  const headerIndex = 1;
196
212
  // We're using this offset to display correct aria-rowindex when pagination is in action.
197
213
  const cellIndexOffset = pageSize * pageIndex + headerIndex;
198
214
  // Total row count.
199
215
  const rowCount = data.length + headerIndex + (hasFooter ? 1 : 0);
200
- const contentColumns = useMemo(() => {
201
- if (!hiddenColumns || hiddenColumns.length === 0) {
202
- return columns;
203
- }
204
- return columns.filter((col) => hiddenColumns === null || hiddenColumns === void 0 ? void 0 : hiddenColumns.includes((col.id || col.Header)));
205
- }, [columns, hiddenColumns]);
206
216
  const content = (React.createElement(React.Fragment, null,
207
217
  React.createElement("div", { "data-test": dataTest !== null && dataTest !== void 0 ? dataTest : 'table-wrapper', className: className },
208
218
  React.createElement("div", { className: cn(styles.container, {
209
219
  [styles.spaceBottom]: !hidePagination,
210
220
  }) },
211
- React.createElement("div", { "data-test": "table", ...getTableProps(), "aria-rowcount": rowCount },
212
- !hideHeader && (React.createElement("div", { "data-test": "table-header-row-group", role: "rowgroup", className: headerClassName }, headerGroups.map((headerGroup) => {
213
- const { key: headerGroupKey, ...restHeaderGroupProps } = headerGroup.getHeaderGroupProps();
214
- return (React.createElement(HeaderRow, { key: headerGroupKey, ...restHeaderGroupProps, ariaRowIndex: headerIndex }, headerGroup.headers.map((column, i) => {
215
- const { key: columnKey, ...restHeaderProps } = column.getHeaderProps(column.getSortByToggleProps());
216
- const isDraggable = columnsOrdering && column.id !== 'expander';
217
- return (React.createElement(Header, { index: i, key: columnKey, align: column.align, canSort: column.canSort, isSorted: column.isSorted, isSortedDesc: column.isSortedDesc, canResize: column.canResize, isResizing: column.isResizing, getResizerProps: column.getResizerProps, onDrop: isDraggable ? onDrop : undefined, onDragStart: onDragStart, ...restHeaderProps },
218
- React.createElement(EnhancedHeaderFooterRenderer, { column: column, columnResizing: columnResizing, type: "Header" })));
219
- })));
220
- }))),
221
+ React.createElement("div", { "data-test": "table", role: "table", "aria-rowcount": rowCount },
222
+ !hideHeader && (React.createElement("div", { "data-test": "table-header-row-group", role: "rowgroup", className: headerClassName }, tableInstance.getHeaderGroups().map((headerGroup) => (React.createElement(HeaderRow, { key: headerGroup.id, role: "row", ariaRowIndex: headerIndex, style: getRowStyle({ totalSize: tableInstance.getTotalSize() }) }, headerGroup.headers.map((header, i) => {
223
+ var _a, _b;
224
+ const canSort = header.column.getCanSort();
225
+ const isDraggable = columnsOrdering && header.id !== 'expander';
226
+ return (React.createElement(Header, { index: i, colSpan: 1, key: header.id, role: "columnheader", onDragStart: onDragStart, style: getCellStyle({ size: header.getSize(), minSize: header.column.columnDef.minSize || header.getSize() }), canSort: canSort, isSorted: !!header.column.getIsSorted(), isSortedDesc: (_a = sortBy[header.column.getSortIndex()]) === null || _a === void 0 ? void 0 : _a.desc, canResize: header.column.getCanResize(), onDrop: isDraggable ? onDrop : undefined, resizeHandler: header.getResizeHandler(), isResizing: header.column.getIsResizing(), align: (_b = header.column.columnDef.meta) === null || _b === void 0 ? void 0 : _b.align, onClick: canSort ? header.column.getToggleSortingHandler() : undefined },
227
+ React.createElement(EnhancedHeaderFooterRenderer, { type: "header", context: header.getContext() })));
228
+ })))))),
221
229
  !overlayLoading && loading ? (React.createElement(Row, { role: "row" },
222
230
  React.createElement(Cell, { role: "cell", align: "center", colSpan: columns.length, "data-test": "table-loader-cell" },
223
231
  React.createElement(Loader, null)))) : hasData ? (React.createElement(HotKeys, { role: "rowgroup", "data-test": "table-cell-row-group", keyMap: commands, handlers: hotKeysHandlers, className: styles.hotKeys },
224
- React.createElement(TableContent, { page: page, onCopy: onCopy, getHref: getHref, columns: contentColumns, rootRef: setContextMenuAnchorEl, ...columnsSelectionProps, onRowClick: onRowClick, prepareRow: prepareRow, className: contentClassName, columnResizing: columnResizing, AnchorComponent: AnchorComponent, cellIndexOffset: cellIndexOffset, getCustomRowProps: getCustomRowProps, getCustomCellProps: getCustomCellProps, renderRowSubComponent: renderRowSubComponent }))) : (React.createElement("div", { role: "row" },
232
+ React.createElement(TableContent, { page: page, onCopy: onCopy, getHref: getHref, totalSize: tableInstance.getTotalSize(), rootRef: setContextMenuAnchorEl, ...columnsSelectionProps, onRowClick: onRowClick, className: contentClassName, columnResizing: columnResizing, AnchorComponent: AnchorComponent, cellIndexOffset: cellIndexOffset, getCustomRowProps: getCustomRowProps, getCustomCellProps: getCustomCellProps, renderRowSubComponent: renderRowSubComponent }))) : (React.createElement("div", { role: "row" },
225
233
  React.createElement("div", { role: "cell" },
226
234
  React.createElement(EmptyState, { "data-test": "table-no-data", className: styles.empty, title: noDataTitle, icon: AlertTriangle, iconLabel: "Alert" })))),
227
235
  hasFooter && (React.createElement("div", { "data-test": "table-footer-row-group", role: "rowgroup", className: footerClassName }, footerGroups.map((group) => {
228
- const { key: footerGroupKey, ...restFooterGroupProps } = group.getFooterGroupProps();
236
+ const { id: footerGroupKey } = group;
229
237
  return (
230
238
  // Footer props getters do not provide role attributes
231
- React.createElement(Row, { key: footerGroupKey, ariaRowIndex: rowCount, ...restFooterGroupProps, role: "row" }, group.headers.map((column) => {
232
- const { key: footerKey, ...restFooterProps } = column.getFooterProps();
239
+ React.createElement(Row, { key: footerGroupKey, ariaRowIndex: rowCount, style: getRowStyle({ totalSize: tableInstance.getTotalSize() }), role: "row" }, group.headers.map((column) => {
240
+ var _a;
241
+ const { id: footerKey, column: { columnDef }, } = column;
233
242
  return (
234
243
  // Footer props getters do not provide role attributes
235
- React.createElement(Cell, { key: footerKey, ...restFooterProps, align: column.align, role: "cell" },
236
- React.createElement(EnhancedHeaderFooterRenderer, { column: column, columnResizing: columnResizing, type: "Footer" })));
244
+ React.createElement(Cell, { key: footerKey, colSpan: 1, align: (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.align, style: getCellStyle({ size: column.getSize(), maxSize: columnDef.maxSize, minSize: columnDef.minSize }), role: "cell" },
245
+ React.createElement(EnhancedHeaderFooterRenderer, { context: column.getContext(), type: "footer" })));
237
246
  })));
238
247
  }))))),
239
- !hidePagination && hasData && (React.createElement(Pagination, { pageCount: pageCount, currentPage: pageIndex + 1, canPreviousPage: canPreviousPage, canNextPage: canNextPage, goToPage: (p) => {
248
+ !hidePagination && hasData && (React.createElement(Pagination, { pageCount: pageCount, currentPage: pageIndex + 1, canPreviousPage: getCanPreviousPage(), canNextPage: getCanNextPage(), goToPage: (p) => {
240
249
  if (onPageChange) {
241
250
  onPageChange(p - 1);
242
251
  }
243
252
  else {
244
- gotoPage(p - 1);
253
+ goToPage(p - 1);
245
254
  }
246
255
  }, nextPage: () => {
247
256
  if (onPageChange) {
@@ -260,7 +269,7 @@ export const Table = ({ 'data-test': dataTest, autoResetSortBy = false, columns:
260
269
  }, pageSize: pageSize, setPageSize: setPageSize, numberOfItems: data.length, pageSizeOptions: (_a = paginationOptions === null || paginationOptions === void 0 ? void 0 : paginationOptions.pageSizeOptions) !== null && _a !== void 0 ? _a : [5, 10, 20] }))),
261
270
  onCopy && React.createElement(ContextMenu, { anchorElement: contextMenuAnchorEl, onCopy: onKeyUp })));
262
271
  if (children) {
263
- return children(content, tableInstance);
272
+ return children(content);
264
273
  }
265
274
  return content;
266
275
  };