@hazelcast/ui 1.3.3-next.3 → 1.3.3-next.31
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/Alert.js +1 -1
- package/lib/Alert.js.map +1 -1
- package/lib/Alert.module.scss +1 -0
- package/lib/AppHeader/AppHeader.d.ts +16 -0
- package/lib/AppHeader/AppHeader.js +17 -0
- package/lib/AppHeader/AppHeader.js.map +1 -0
- package/lib/AppHeader/AppHeader.module.scss +29 -0
- package/lib/AppHeader/AppHeaderLogo/AppHeaderLogo.d.ts +12 -0
- package/lib/AppHeader/AppHeaderLogo/AppHeaderLogo.js +7 -0
- package/lib/AppHeader/AppHeaderLogo/AppHeaderLogo.js.map +1 -0
- package/lib/AppHeader/AppHeaderLogo/AppHeaderLogo.module.scss +29 -0
- package/lib/AppHeader/AppHeaderLogo/index.d.ts +1 -0
- package/lib/AppHeader/AppHeaderLogo/index.js +2 -0
- package/lib/AppHeader/AppHeaderLogo/index.js.map +1 -0
- package/lib/AppHeader/AppHeaderMenu/AppHeaderMenu.d.ts +8 -0
- package/lib/AppHeader/AppHeaderMenu/AppHeaderMenu.js +15 -0
- package/lib/AppHeader/AppHeaderMenu/AppHeaderMenu.js.map +1 -0
- package/lib/AppHeader/AppHeaderMenu/AppHeaderMenu.module.scss +20 -0
- package/lib/AppHeader/AppHeaderMenu/index.d.ts +1 -0
- package/lib/AppHeader/AppHeaderMenu/index.js +2 -0
- package/lib/AppHeader/AppHeaderMenu/index.js.map +1 -0
- package/lib/AppHeader/EnvironmentBadge/EnvironmentBadge.d.ts +5 -0
- package/lib/AppHeader/EnvironmentBadge/EnvironmentBadge.js +10 -0
- package/lib/AppHeader/EnvironmentBadge/EnvironmentBadge.js.map +1 -0
- package/lib/AppHeader/EnvironmentBadge/EnvironmentBadge.module.scss +13 -0
- package/lib/AppHeader/EnvironmentBadge/index.d.ts +1 -0
- package/lib/AppHeader/EnvironmentBadge/index.js +2 -0
- package/lib/AppHeader/EnvironmentBadge/index.js.map +1 -0
- package/lib/AppHeader/SelectCluster/SelectCluster.d.ts +9 -0
- package/lib/AppHeader/SelectCluster/SelectCluster.js +37 -0
- package/lib/AppHeader/SelectCluster/SelectCluster.js.map +1 -0
- package/lib/AppHeader/SelectCluster/SelectCluster.module.scss +101 -0
- package/lib/AppHeader/SelectCluster/index.d.ts +1 -0
- package/lib/AppHeader/SelectCluster/index.js +2 -0
- package/lib/AppHeader/SelectCluster/index.js.map +1 -0
- package/lib/AppHeader/index.d.ts +1 -0
- package/lib/AppHeader/index.js +2 -0
- package/lib/AppHeader/index.js.map +1 -0
- package/lib/AppSidebar/AppSidebar.d.ts +12 -0
- package/lib/AppSidebar/AppSidebar.js +31 -0
- package/lib/AppSidebar/AppSidebar.js.map +1 -0
- package/lib/AppSidebar/AppSidebar.module.scss +66 -0
- package/lib/AppSidebar/AppSidebarFavoriteButton/AppSidebarFavoriteButton.d.ts +6 -0
- package/lib/AppSidebar/AppSidebarFavoriteButton/AppSidebarFavoriteButton.js +22 -0
- package/lib/AppSidebar/AppSidebarFavoriteButton/AppSidebarFavoriteButton.js.map +1 -0
- package/lib/AppSidebar/AppSidebarFavoriteButton/AppSidebarFavoriteButton.module.scss +16 -0
- package/lib/AppSidebar/AppSidebarFavoriteButton/index.d.ts +1 -0
- package/lib/AppSidebar/AppSidebarFavoriteButton/index.js +2 -0
- package/lib/AppSidebar/AppSidebarFavoriteButton/index.js.map +1 -0
- package/lib/AppSidebar/AppSidebarFavorites/AppSidebarFavorites.d.ts +7 -0
- package/lib/AppSidebar/AppSidebarFavorites/AppSidebarFavorites.js +11 -0
- package/lib/AppSidebar/AppSidebarFavorites/AppSidebarFavorites.js.map +1 -0
- package/lib/AppSidebar/AppSidebarFavorites/AppSidebarFavorites.module.scss +13 -0
- package/lib/AppSidebar/AppSidebarFavorites/index.d.ts +1 -0
- package/lib/AppSidebar/AppSidebarFavorites/index.js +2 -0
- package/lib/AppSidebar/AppSidebarFavorites/index.js.map +1 -0
- package/lib/AppSidebar/AppSidebarItem/AppSidebarItem.d.ts +28 -0
- package/lib/AppSidebar/AppSidebarItem/AppSidebarItem.js +23 -0
- package/lib/AppSidebar/AppSidebarItem/AppSidebarItem.js.map +1 -0
- package/lib/AppSidebar/AppSidebarItem/AppSidebarItem.module.scss +92 -0
- package/lib/AppSidebar/AppSidebarItem/index.d.ts +1 -0
- package/lib/AppSidebar/AppSidebarItem/index.js +2 -0
- package/lib/AppSidebar/AppSidebarItem/index.js.map +1 -0
- package/lib/AppSidebar/AppSidebarMenuItemCounter/AppSidebarMenuItemCounter.d.ts +6 -0
- package/lib/AppSidebar/AppSidebarMenuItemCounter/AppSidebarMenuItemCounter.js +6 -0
- package/lib/AppSidebar/AppSidebarMenuItemCounter/AppSidebarMenuItemCounter.js.map +1 -0
- package/lib/AppSidebar/AppSidebarMenuItemCounter/AppSidebarMenuItemCounter.module.scss +24 -0
- package/lib/AppSidebar/AppSidebarMenuItemCounter/index.d.ts +1 -0
- package/lib/AppSidebar/AppSidebarMenuItemCounter/index.js +2 -0
- package/lib/AppSidebar/AppSidebarMenuItemCounter/index.js.map +1 -0
- package/lib/AppSidebar/AppSidebarSection/AppSidebarSection.d.ts +13 -0
- package/lib/AppSidebar/AppSidebarSection/AppSidebarSection.js +15 -0
- package/lib/AppSidebar/AppSidebarSection/AppSidebarSection.js.map +1 -0
- package/lib/AppSidebar/AppSidebarSection/AppSidebarSection.module.scss +58 -0
- package/lib/AppSidebar/AppSidebarSection/AppSidebarSectionExpandable.d.ts +12 -0
- package/lib/AppSidebar/AppSidebarSection/AppSidebarSectionExpandable.js +55 -0
- package/lib/AppSidebar/AppSidebarSection/AppSidebarSectionExpandable.js.map +1 -0
- package/lib/AppSidebar/AppSidebarSection/appSidebarSectionContext.d.ts +2 -0
- package/lib/AppSidebar/AppSidebarSection/appSidebarSectionContext.js +3 -0
- package/lib/AppSidebar/AppSidebarSection/appSidebarSectionContext.js.map +1 -0
- package/lib/AppSidebar/AppSidebarSection/index.d.ts +1 -0
- package/lib/AppSidebar/AppSidebarSection/index.js +2 -0
- package/lib/AppSidebar/AppSidebarSection/index.js.map +1 -0
- package/lib/AppSidebar/appSidebarContext.d.ts +10 -0
- package/lib/AppSidebar/appSidebarContext.js +11 -0
- package/lib/AppSidebar/appSidebarContext.js.map +1 -0
- package/lib/AppSidebar/index.d.ts +5 -0
- package/lib/AppSidebar/index.js +6 -0
- package/lib/AppSidebar/index.js.map +1 -0
- package/lib/AutocompleteField.js +3 -3
- package/lib/AutocompleteField.js.map +1 -1
- package/lib/Button.d.ts +8 -8
- package/lib/Button.js +14 -42
- package/lib/Button.js.map +1 -1
- package/lib/Button.module.scss +40 -10
- package/lib/Calendar/Calendar.d.ts +2 -1
- package/lib/Calendar/Calendar.js +4 -4
- package/lib/Calendar/Calendar.js.map +1 -1
- package/lib/Calendar/components/CalendarInput.d.ts +3 -2
- package/lib/Calendar/components/CalendarInput.js +1 -1
- package/lib/Calendar/components/CalendarInput.js.map +1 -1
- package/lib/Calendar/components/CalendarTime.d.ts +3 -2
- package/lib/Calendar/components/CalendarTime.js +5 -5
- package/lib/Calendar/components/CalendarTime.js.map +1 -1
- package/lib/Card.d.ts +2 -0
- package/lib/Card.js +3 -2
- package/lib/Card.js.map +1 -1
- package/lib/Card.module.scss +51 -18
- package/lib/CenteredLoader.d.ts +5 -0
- package/lib/CenteredLoader.js +6 -0
- package/lib/CenteredLoader.js.map +1 -0
- package/lib/CenteredLoader.module.scss +11 -0
- package/lib/Checkbox.js +2 -2
- package/lib/Checkbox.js.map +1 -1
- package/lib/Checkbox.module.scss +2 -2
- package/lib/Dialog.js +22 -18
- package/lib/Dialog.js.map +1 -1
- package/lib/Error.d.ts +2 -1
- package/lib/Error.js +1 -1
- package/lib/Error.js.map +1 -1
- package/lib/Help.d.ts +2 -1
- package/lib/Help.js +2 -2
- package/lib/Help.js.map +1 -1
- package/lib/Icon.d.ts +2 -1
- package/lib/Icon.js +2 -2
- package/lib/Icon.js.map +1 -1
- package/lib/IconButton.js +3 -3
- package/lib/IconButton.js.map +1 -1
- package/lib/InteractiveList.d.ts +6 -5
- package/lib/InteractiveList.js +10 -10
- package/lib/InteractiveList.js.map +1 -1
- package/lib/Label.d.ts +2 -1
- package/lib/Label.js +1 -1
- package/lib/Label.js.map +1 -1
- package/lib/Link.d.ts +1 -1
- package/lib/Link.js +1 -0
- package/lib/Link.js.map +1 -1
- package/lib/Link.module.scss +5 -0
- package/lib/Loader.d.ts +2 -1
- package/lib/Loader.js +2 -2
- package/lib/Loader.js.map +1 -1
- package/lib/Modal.js +4 -4
- package/lib/Modal.js.map +1 -1
- package/lib/Modal.module.scss +2 -1
- package/lib/NumberField.d.ts +1 -0
- package/lib/NumberField.js +27 -10
- package/lib/NumberField.js.map +1 -1
- package/lib/Overlay.js +3 -1
- package/lib/Overlay.js.map +1 -1
- package/lib/Overlay.module.scss +5 -2
- package/lib/Pagination.js +10 -10
- package/lib/Pagination.js.map +1 -1
- package/lib/Pagination.module.scss +4 -4
- package/lib/PasswordField.js +4 -4
- package/lib/PasswordField.js.map +1 -1
- package/lib/Radio.js +3 -3
- package/lib/Radio.js.map +1 -1
- package/lib/RadioGroup.js +3 -3
- package/lib/RadioGroup.js.map +1 -1
- package/lib/Select/Common.js +8 -12
- package/lib/Select/Common.js.map +1 -1
- package/lib/Select/Common.module.scss +1 -1
- package/lib/Select/MultiSelectField.js +4 -5
- package/lib/Select/MultiSelectField.js.map +1 -1
- package/lib/Select/MultiSelectFieldFormik.d.ts +2 -1
- package/lib/Select/MultiSelectFieldFormik.js.map +1 -1
- package/lib/Select/SelectField.d.ts +1 -0
- package/lib/Select/SelectField.js +4 -4
- package/lib/Select/SelectField.js.map +1 -1
- package/lib/Slider.module.scss +6 -6
- package/lib/Table/Cell.d.ts +5 -3
- package/lib/Table/Cell.js +4 -3
- package/lib/Table/Cell.js.map +1 -1
- package/lib/Table/Cell.module.scss +14 -5
- package/lib/Table/CellWrapper.d.ts +6 -6
- package/lib/Table/CellWrapper.js +6 -6
- package/lib/Table/CellWrapper.js.map +1 -1
- package/lib/Table/EnhancedRenderers.d.ts +8 -10
- package/lib/Table/EnhancedRenderers.js +7 -10
- package/lib/Table/EnhancedRenderers.js.map +1 -1
- package/lib/Table/Header.d.ts +9 -5
- package/lib/Table/Header.js +12 -7
- package/lib/Table/Header.js.map +1 -1
- package/lib/Table/Header.module.scss +12 -7
- package/lib/Table/Row.d.ts +5 -3
- package/lib/Table/Row.js +4 -4
- package/lib/Table/Row.js.map +1 -1
- package/lib/Table/Row.module.scss +15 -12
- package/lib/Table/Table.d.ts +21 -36
- package/lib/Table/Table.js +102 -87
- package/lib/Table/Table.js.map +1 -1
- package/lib/Table/Table.module.scss +6 -0
- package/lib/Table/TableContent.d.ts +7 -7
- package/lib/Table/TableContent.js +20 -14
- package/lib/Table/TableContent.js.map +1 -1
- package/lib/Table/helpers.d.ts +2 -0
- package/lib/Table/helpers.js +10 -0
- package/lib/Table/helpers.js.map +1 -0
- package/lib/Table/tableTypes.d.ts +80 -0
- package/lib/Table/tableTypes.js +2 -0
- package/lib/Table/tableTypes.js.map +1 -0
- package/lib/Table/useTrackTableState.d.ts +3 -0
- package/lib/Table/useTrackTableState.js +30 -0
- package/lib/Table/useTrackTableState.js.map +1 -0
- package/lib/Table/utils.d.ts +16 -0
- package/lib/Table/utils.js +121 -0
- package/lib/Table/utils.js.map +1 -0
- package/lib/Tabs/Tab.d.ts +1 -19
- package/lib/Tabs/Tab.js +2 -16
- package/lib/Tabs/Tab.js.map +1 -1
- package/lib/Tabs/Tab.module.scss +0 -4
- package/lib/Tabs/TabPanel.d.ts +2 -1
- package/lib/Tabs/TabPanel.js +2 -2
- package/lib/Tabs/TabPanel.js.map +1 -1
- package/lib/TextArea.js +3 -3
- package/lib/TextArea.js.map +1 -1
- package/lib/TextField.js +5 -5
- package/lib/TextField.js.map +1 -1
- package/lib/TimeField.js +3 -3
- package/lib/TimeField.js.map +1 -1
- package/lib/Toast.d.ts +2 -1
- package/lib/Toast.js +5 -5
- package/lib/Toast.js.map +1 -1
- package/lib/Toggle.js +5 -5
- package/lib/Toggle.js.map +1 -1
- package/lib/Tooltip.d.ts +3 -0
- package/lib/Tooltip.js +21 -15
- package/lib/Tooltip.js.map +1 -1
- package/lib/Tooltip.module.scss +102 -70
- package/lib/TruncatedText.d.ts +4 -1
- package/lib/TruncatedText.js +4 -4
- package/lib/TruncatedText.js.map +1 -1
- package/lib/TruncatedText.module.scss +4 -0
- package/lib/hooks/useOnClickOutside.d.ts +1 -1
- package/lib/hooks/useOnClickOutside.js +7 -1
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/package.json +26 -20
- package/styles/constants/_colors.scss +36 -12
- package/styles/constants/_typography.scss +0 -7
- package/styles/helpers/_a11y.scss +8 -0
- package/styles/helpers/_gradients.scss +39 -6
- package/styles/helpers/_text.scss +9 -0
- package/styles/typography/fonts/UbuntuMono-Bold.woff2 +0 -0
- package/styles/typography/fonts/UbuntuMono-BoldItalic.woff2 +0 -0
- package/styles/typography/fonts/UbuntuMono-Italic.woff2 +0 -0
- package/styles/typography/fonts/UbuntuMono-Regular.woff2 +0 -0
- package/styles/typography/ubuntu-mono.css +31 -0
- package/lib/utils/test.d.ts +0 -3
- package/lib/utils/test.js +0 -8
- package/lib/utils/test.js.map +0 -1
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
1
2
|
@use '../../styles/constants' as c;
|
|
2
3
|
@use '../../styles/helpers' as h;
|
|
3
4
|
|
|
4
5
|
.td {
|
|
5
6
|
position: relative;
|
|
6
7
|
display: flex;
|
|
8
|
+
box-sizing: border-box;
|
|
7
9
|
align-items: center;
|
|
8
|
-
height: c.$grid *
|
|
10
|
+
height: c.$grid * 6;
|
|
9
11
|
padding-right: c.$grid * 5;
|
|
10
12
|
padding-left: c.$grid * 5;
|
|
11
13
|
color: c.$colorText;
|
|
12
14
|
background-color: inherit;
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
flex-basis: auto;
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
font-family: 'Ubuntu Mono', monospace;
|
|
13
19
|
|
|
14
|
-
@include c.typographyBodySmall;
|
|
15
20
|
@include h.overflowEllipsis;
|
|
16
21
|
|
|
17
22
|
&.alignLeft {
|
|
@@ -27,16 +32,16 @@
|
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
&.selected {
|
|
30
|
-
background:
|
|
35
|
+
background: color.adjust(c.$colorPrimary, $lightness: 30%) !important;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
&:not(:last-of-type) {
|
|
34
|
-
border-right: c.$borderWidth solid c.$
|
|
39
|
+
border-right: c.$borderWidth solid c.$colorNeutralWhite;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
.warningIcon {
|
|
39
|
-
color: c.$
|
|
44
|
+
color: c.$colorWarningDark;
|
|
40
45
|
|
|
41
46
|
&.left {
|
|
42
47
|
margin-left: c.$grid * 2;
|
|
@@ -50,3 +55,7 @@
|
|
|
50
55
|
.selectable {
|
|
51
56
|
user-select: none;
|
|
52
57
|
}
|
|
58
|
+
|
|
59
|
+
.truncated {
|
|
60
|
+
font-family: 'Ubuntu Mono', monospace;
|
|
61
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { CSSProperties, RefObject } from 'react';
|
|
2
|
+
import { Cell } from '@tanstack/react-table';
|
|
3
3
|
import { CellProps } from './Cell';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { RowData } from './tableTypes';
|
|
5
|
+
export type CellWrapperProps<D extends RowData> = CellProps & {
|
|
6
|
+
cell: Cell<D, unknown>;
|
|
6
7
|
selectable?: boolean;
|
|
7
|
-
|
|
8
|
+
style: CSSProperties;
|
|
8
9
|
selectedColumnValuesRef?: RefObject<(string | undefined)[][]>;
|
|
9
|
-
columnResizing: UseResizeColumnsState<D>['columnResizing'];
|
|
10
10
|
};
|
|
11
11
|
export declare const CellWrapper: <D extends object>(props: CellWrapperProps<D>) => JSX.Element;
|
package/lib/Table/CellWrapper.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
+
import { flexRender } from '@tanstack/react-table';
|
|
2
3
|
import { ROW_EXPANDER_COLUMN_ID } from './constants';
|
|
3
4
|
import { Cell as TableCell } from './Cell';
|
|
4
|
-
import { EnhancedCellRenderer } from './EnhancedRenderers';
|
|
5
5
|
export const CellWrapper = (props) => {
|
|
6
|
-
|
|
7
|
-
const
|
|
6
|
+
var _a;
|
|
7
|
+
const { selectable, cell, selectedColumnValuesRef, onClickSelection, onMouseEnterSelection, selectionStartedRef, ...rest } = props;
|
|
8
|
+
const isSelectable = selectable && ((_a = cell.column) === null || _a === void 0 ? void 0 : _a.id) !== ROW_EXPANDER_COLUMN_ID;
|
|
8
9
|
useEffect(() => {
|
|
9
10
|
if (rest.cellId) {
|
|
10
11
|
const [rowIndex, cellIndex] = rest.cellId.split(':');
|
|
@@ -12,7 +13,7 @@ export const CellWrapper = (props) => {
|
|
|
12
13
|
if (rest.selected) {
|
|
13
14
|
const row = selectedColumnValuesRef.current[Number(rowIndex)];
|
|
14
15
|
if (row) {
|
|
15
|
-
row[Number(cellIndex)] = typeof cell.
|
|
16
|
+
row[Number(cellIndex)] = typeof cell.getValue() !== 'object' ? String(cell.getValue()) : '';
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
else {
|
|
@@ -23,7 +24,6 @@ export const CellWrapper = (props) => {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}, [rest, cell, selectedColumnValuesRef]);
|
|
26
|
-
|
|
27
|
-
return (React.createElement(TableCell, { onClickSelection: isSelectable ? onClickSelection : undefined, selectionStartedRef: isSelectable ? selectionStartedRef : undefined, onMouseEnterSelection: isSelectable ? onMouseEnterSelection : undefined, ...rest }, content));
|
|
27
|
+
return (React.createElement(TableCell, { onClickSelection: isSelectable ? onClickSelection : undefined, selectionStartedRef: isSelectable ? selectionStartedRef : undefined, onMouseEnterSelection: isSelectable ? onMouseEnterSelection : undefined, ...rest }, flexRender(cell.column.columnDef.cell, cell.getContext())));
|
|
28
28
|
};
|
|
29
29
|
//# sourceMappingURL=CellWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellWrapper.js","sourceRoot":"","sources":["../../src/Table/CellWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CellWrapper.js","sourceRoot":"","sources":["../../src/Table/CellWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA4B,SAAS,EAAE,MAAM,OAAO,CAAA;AAClE,OAAO,EAAQ,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAa,IAAI,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAA;AAUrD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAmB,KAA0B,EAAE,EAAE;;IAC1E,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;IAElI,MAAM,YAAY,GAAG,UAAU,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,EAAE,MAAK,sBAAsB,CAAA;IAE7E,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAA;YAExE,IAAI,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,OAAO,EAAE;gBACpC,IAAI,IAAI,CAAC,QAAQ,EA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{ Cell as CellType, HeaderContext } from '@tanstack/react-table';
|
|
3
3
|
/**
|
|
4
4
|
* Few notes about text truncation:
|
|
5
5
|
* We try to enhance Header, Footer and Cell with text truncation and a tooltip using TruncatedText.
|
|
@@ -10,14 +10,12 @@ import { Cell as CellType, HeaderGroup, UseResizeColumnsState } from 'react-tabl
|
|
|
10
10
|
* Here's how react-table renderers are made: https://github.com/tannerlinsley/react-table/blob/6e2fe31ac028e543ce0f9d56168d5f922389fbbc/src/publicUtils.js#L199
|
|
11
11
|
*/
|
|
12
12
|
export type EnhancedHeaderFooterRendererProps<D extends object> = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type: 'Header' | 'Footer';
|
|
13
|
+
context: HeaderContext<D, unknown>;
|
|
14
|
+
type: 'header' | 'footer';
|
|
16
15
|
};
|
|
17
|
-
export declare const EnhancedHeaderFooterRenderer: <D extends object>({
|
|
16
|
+
export declare const EnhancedHeaderFooterRenderer: <D extends object>({ context, type }: EnhancedHeaderFooterRendererProps<D>) => JSX.Element;
|
|
18
17
|
export type EnhancedCellRendererProps<D extends object> = {
|
|
19
|
-
cell: CellType<D,
|
|
20
|
-
|
|
21
|
-
columnResizing: UseResizeColumnsState<D>['columnResizing'];
|
|
18
|
+
cell: CellType<D, unknown>;
|
|
19
|
+
columnResizing: boolean;
|
|
22
20
|
};
|
|
23
|
-
export declare const EnhancedCellRenderer: <D extends object>({ cell,
|
|
21
|
+
export declare const EnhancedCellRenderer: <D extends object>({ cell, columnResizing }: EnhancedCellRendererProps<D>) => JSX.Element;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { flexRender } from '@tanstack/react-table';
|
|
2
3
|
import { TruncatedText } from '../TruncatedText';
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import styles from './Cell.module.scss';
|
|
5
|
+
export const EnhancedHeaderFooterRenderer = ({ context, type }) => {
|
|
6
|
+
const value = context.column.columnDef[type];
|
|
5
7
|
if (typeof value === 'string') {
|
|
6
|
-
return React.createElement(TruncatedText, { text: value, forceUpdateToken:
|
|
8
|
+
return React.createElement(TruncatedText, { text: value, forceUpdateToken: context.column.getIsResizing() });
|
|
7
9
|
}
|
|
8
|
-
return
|
|
9
|
-
};
|
|
10
|
-
export const EnhancedCellRenderer = ({ cell, hasCellRenderer, columnResizing }) => {
|
|
11
|
-
if (hasCellRenderer) {
|
|
12
|
-
return cell.render('Cell');
|
|
13
|
-
}
|
|
14
|
-
return React.createElement(TruncatedText, { text: cell.value, forceUpdateToken: columnResizing.isResizingColumn });
|
|
10
|
+
return React.createElement(React.Fragment, null, flexRender(value, context));
|
|
15
11
|
};
|
|
12
|
+
export const EnhancedCellRenderer = ({ cell, columnResizing }) => (React.createElement(TruncatedText, { text: cell.renderValue(), forceUpdateToken: columnResizing, tooltipClassName: styles.truncated }));
|
|
16
13
|
//# sourceMappingURL=EnhancedRenderers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedRenderers.js","sourceRoot":"","sources":["../../src/Table/EnhancedRenderers.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"EnhancedRenderers.js","sourceRoot":"","sources":["../../src/Table/EnhancedRenderers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAoB,UAAU,EAAiB,MAAM,uBAAuB,CAAA;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAiBvC,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAmB,EAAE,OAAO,EAAE,IAAI,EAAwC,EAAE,EAAE;IACxH,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAE5C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,oBAAC,aAAa,IAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,GAAI,CAAA;KACxF;IAED,OAAO,0CAAG,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAI,CAAA;AAC1C,CAAC,CAAA;AAOD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAmB,EAAE,IAAI,EAAE,cAAc,EAAgC,EAAE,EAAE,CAAC,CAChH,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,CAAC,SAAS,GAAI,CAC5H,CAAA"}
|
package/lib/Table/Header.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TableHeaderProps, TableResizerProps } from 'react-table';
|
|
1
|
+
import React, { MouseEvent, KeyboardEvent, DragEvent, CSSProperties } from 'react';
|
|
3
2
|
export type HeaderProps = {
|
|
4
3
|
/**
|
|
5
4
|
* Number fields should be right aligned as that allows
|
|
@@ -13,9 +12,14 @@ export type HeaderProps = {
|
|
|
13
12
|
onClick?: (event: MouseEvent | KeyboardEvent) => void;
|
|
14
13
|
canResize: boolean;
|
|
15
14
|
isResizing: boolean;
|
|
16
|
-
|
|
15
|
+
size?: number;
|
|
17
16
|
index: number;
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
role: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
resizeHandler: (e: unknown) => void;
|
|
18
22
|
onDragStart?: (e: DragEvent) => void;
|
|
19
23
|
onDrop?: (e: DragEvent, index: number) => void;
|
|
20
|
-
}
|
|
21
|
-
export declare const Header:
|
|
24
|
+
};
|
|
25
|
+
export declare const Header: ({ align, colSpan, children, canSort, isSorted, isSortedDesc, canResize, isResizing, onClick, style, className, role, index, size, onDragStart, onDrop, resizeHandler, }: HeaderProps) => JSX.Element;
|
package/lib/Table/Header.js
CHANGED
|
@@ -4,7 +4,7 @@ import cn from 'classnames';
|
|
|
4
4
|
import { Icon } from '../Icon';
|
|
5
5
|
import { keyIsOneOf } from '../utils/keyboard';
|
|
6
6
|
import styles from './Header.module.scss';
|
|
7
|
-
export const Header = ({ align = 'left', colSpan, children, canSort, isSorted, isSortedDesc, canResize, isResizing,
|
|
7
|
+
export const Header = ({ align = 'left', colSpan, children, canSort, isSorted, isSortedDesc, canResize, isResizing, onClick, style, className, role, index, size, onDragStart, onDrop, resizeHandler, }) => {
|
|
8
8
|
const rootRef = useRef(null);
|
|
9
9
|
const isDragStarterRef = useRef(false);
|
|
10
10
|
const counterRef = useRef(0);
|
|
@@ -13,13 +13,13 @@ export const Header = ({ align = 'left', colSpan, children, canSort, isSorted, i
|
|
|
13
13
|
if (isSorted) {
|
|
14
14
|
ariaSort = isSortedDesc ? 'descending' : 'ascending';
|
|
15
15
|
}
|
|
16
|
-
const Chevron = useMemo(() => (React.createElement(Icon, { className: cn(styles.sortingIcon, {
|
|
16
|
+
const Chevron = useMemo(() => (React.createElement(Icon, { "data-test": "chevron", className: cn(styles.sortingIcon, {
|
|
17
17
|
[styles.left]: align === 'left',
|
|
18
18
|
[styles.right]: align === 'right',
|
|
19
19
|
[styles.isSorted]: isSorted,
|
|
20
20
|
}), icon: !isSorted ? ChevronUp : isSortedDesc ? ChevronDown : ChevronUp, ariaLabel: !isSorted ? 'Not Sorted' : isSortedDesc ? 'Descending' : 'Ascending', size: "smallMedium" })), [align, isSorted, isSortedDesc]);
|
|
21
21
|
const DraggableIcon = (React.createElement(Icon, { icon: Menu, size: "small", ariaLabel: "draggable-indicator", className: cn(styles.dragIcon, { [styles.dragIconRight]: align === 'right' }) }));
|
|
22
|
-
const
|
|
22
|
+
const onKeyDown = useCallback((event) => {
|
|
23
23
|
event.preventDefault();
|
|
24
24
|
if (keyIsOneOf(event, 'Enter') && onClick) {
|
|
25
25
|
onClick(event);
|
|
@@ -28,10 +28,13 @@ export const Header = ({ align = 'left', colSpan, children, canSort, isSorted, i
|
|
|
28
28
|
const buttonRoleProps = {
|
|
29
29
|
tabIndex: onClick ? 0 : undefined,
|
|
30
30
|
role: onClick ? 'button' : undefined,
|
|
31
|
-
|
|
31
|
+
onKeyDown: onClick ? onKeyDown : undefined,
|
|
32
32
|
onClick,
|
|
33
33
|
};
|
|
34
|
-
return (React.createElement("div", { ref: rootRef, "data-test": "table-header-container", className: cn(styles.container, className), style:
|
|
34
|
+
return (React.createElement("div", { ref: rootRef, "data-test": "table-header-container", className: cn(styles.container, className), style: {
|
|
35
|
+
...style,
|
|
36
|
+
...(size != null ? { width: size } : {}),
|
|
37
|
+
}, role: role, "aria-colspan": colSpan, "aria-sort": ariaSort },
|
|
35
38
|
React.createElement("div", { draggable: draggable, "data-test": "table-header-content", className: cn(styles.th, {
|
|
36
39
|
[styles.sortable]: canSort,
|
|
37
40
|
[styles.alignLeft]: align === 'left',
|
|
@@ -75,8 +78,10 @@ export const Header = ({ align = 'left', colSpan, children, canSort, isSorted, i
|
|
|
75
78
|
children,
|
|
76
79
|
canSort && (align === 'left' || align === 'center') && Chevron,
|
|
77
80
|
draggable && (align === 'left' || align === 'center') && DraggableIcon),
|
|
78
|
-
canResize && (
|
|
79
|
-
|
|
81
|
+
canResize && (
|
|
82
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
83
|
+
React.createElement("div", { "data-test": "table-header-column-resizer-container", className: styles.resizer, onMouseDown: resizeHandler, onTouchStart: resizeHandler },
|
|
84
|
+
React.createElement("div", { "data-test": "table-header-column-resizer", className: cn('resizer', styles.separator, {
|
|
80
85
|
[styles.resizing]: isResizing,
|
|
81
86
|
}) })))));
|
|
82
87
|
};
|
package/lib/Table/Header.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/Table/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","s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,CACnE;QACL,SAAS,IAAI;QACZ,mEAAmE;QACnE,0CACY,uCAAuC,EACjD,SAAS,EAAE,MAAM,CAAC,OAAO,EACzB,WAAW,EAAE,aAAa,EAC1B,YAAY,EAAE,aAAa;YAE3B,0CACY,6BAA6B,EACvC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE;oBACzC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU;iBAC9B,CAAC,GACF,CACE,CACP,CACG,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
display: flex;
|
|
7
7
|
justify-content: center;
|
|
8
8
|
align-items: center;
|
|
9
|
-
width:
|
|
9
|
+
width: 20px;
|
|
10
10
|
height: 100%;
|
|
11
11
|
top: 0;
|
|
12
|
-
right: -
|
|
12
|
+
right: -10px;
|
|
13
13
|
z-index: c.$zIndex100;
|
|
14
14
|
cursor: col-resize;
|
|
15
15
|
user-select: none;
|
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
/* doiuse-enable css-touch-action */
|
|
21
21
|
|
|
22
22
|
.separator {
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
25
|
-
background: c.$colorNeutral;
|
|
23
|
+
width: 1px;
|
|
24
|
+
height: 100%;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
.resizing,
|
|
@@ -33,14 +32,20 @@
|
|
|
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;
|
|
39
43
|
align-items: center;
|
|
40
|
-
height: c.$grid *
|
|
44
|
+
height: c.$grid * 12;
|
|
41
45
|
padding-left: c.$grid * 5;
|
|
42
46
|
padding-right: c.$grid * 5;
|
|
43
47
|
color: c.$colorText;
|
|
48
|
+
box-sizing: border-box;
|
|
44
49
|
|
|
45
50
|
@include c.typographyBodySmall('bold');
|
|
46
51
|
@include h.overflowEllipsis;
|
|
@@ -78,7 +83,7 @@
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
&:hover {
|
|
81
|
-
background-color: c.$
|
|
86
|
+
background-color: c.$colorNeutralGrayDarker;
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
89
|
|
package/lib/Table/Row.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { FC, AnchorHTMLAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
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,
|
|
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.
|
|
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
|
package/lib/Table/Row.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Row.js","sourceRoot":"","sources":["../../src/Table/Row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"Row.js","sourceRoot":"","sources":["../../src/Table/Row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,WAAW,EAAsD,MAAM,OAAO,CAAA;AAClG,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,MAAM,MAAM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E,IAAI,EAAE,IAAI,mBAAiB,YAAY,eAAa,QAAQ;QACpI,oBAAC,eAAe,IAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,IAC5E,QAAQ,CACO,CACd,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CACnG,0CAAe,kBAAkB,EAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,mBAAiB,YAAY,IAC1H,QAAQ,CACL,CACP,CAAA"}
|
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
@use '../../styles/helpers' as h;
|
|
3
3
|
|
|
4
4
|
@mixin rowBase {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
&:nth-child(even) {
|
|
9
|
+
background-color: c.$colorNeutralLighter;
|
|
10
|
+
}
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
.row {
|
|
14
|
+
@include c.typographyBodySmall;
|
|
10
15
|
@include rowBase;
|
|
11
16
|
|
|
12
17
|
&.clickable {
|
|
@@ -18,23 +23,24 @@
|
|
|
18
23
|
// Do not remove outline for high-contrast modes
|
|
19
24
|
// https://stackoverflow.com/a/52616313
|
|
20
25
|
outline: c.$outlineWidth solid transparent;
|
|
21
|
-
background-color:
|
|
26
|
+
background-color: #e2e7fa;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
&:hover {
|
|
25
|
-
|
|
30
|
+
font-weight: bold;
|
|
31
|
+
background-color: #e2e7fa;
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
.linkRow {
|
|
31
|
-
@include rowBase;
|
|
32
|
-
|
|
33
37
|
cursor: pointer;
|
|
38
|
+
@include rowBase;
|
|
34
39
|
|
|
35
40
|
.link {
|
|
36
41
|
text-decoration: none;
|
|
37
42
|
background-color: inherit;
|
|
43
|
+
@include rowBase;
|
|
38
44
|
|
|
39
45
|
&:focus-visible {
|
|
40
46
|
@include h.outlineSimple;
|
|
@@ -42,15 +48,12 @@
|
|
|
42
48
|
// Do not remove outline for high-contrast modes
|
|
43
49
|
// https://stackoverflow.com/a/52616313
|
|
44
50
|
outline: c.$outlineWidth solid transparent;
|
|
45
|
-
background-color:
|
|
51
|
+
background-color: #e2e7fa;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
&:hover {
|
|
49
|
-
|
|
55
|
+
font-weight: bold;
|
|
56
|
+
background-color: #e2e7fa;
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
|
|
54
|
-
.headerRow {
|
|
55
|
-
margin-bottom: c.$grid * 1.25;
|
|
56
|
-
}
|
package/lib/Table/Table.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
52
|
-
|
|
53
|
-
onSortingChange?: (sortBy: SortingRule<D>[]) => void;
|
|
28
|
+
export type ControlledSortingProps = {
|
|
29
|
+
onSortingChange?: (sortBy: SortingRule[]) => void;
|
|
54
30
|
};
|
|
55
|
-
type CustomTableRowClickProps<D extends
|
|
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
|
|
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
|
|
59
|
+
children?: (table: ReactElement) => ReactElement;
|
|
84
60
|
renderRowSubComponent?: (props: RowType<D>) => ReactNode;
|
|
85
|
-
canExpand?: (row: RowType<D>) =>
|
|
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
|
|
89
|
-
|
|
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
|
|
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;
|