@patternfly/react-table 5.0.0-alpha.51 → 5.0.0-alpha.53
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/CHANGELOG.md +8 -0
- package/dist/esm/components/Table/ActionsColumn.js +1 -1
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/BodyCell.d.ts +1 -1
- package/dist/esm/components/Table/BodyCell.d.ts.map +1 -1
- package/dist/esm/components/Table/BodyCell.js +3 -2
- package/dist/esm/components/Table/BodyCell.js.map +1 -1
- package/dist/esm/components/Table/CollapseColumn.js +1 -1
- package/dist/esm/components/Table/CollapseColumn.js.map +1 -1
- package/dist/esm/components/Table/DraggableCell.js +1 -1
- package/dist/esm/components/Table/DraggableCell.js.map +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.d.ts +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.d.ts.map +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.js +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/esm/components/Table/FavoritesCell.js +1 -1
- package/dist/esm/components/Table/FavoritesCell.js.map +1 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.d.ts +2 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.d.ts.map +1 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js +3 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/esm/components/Table/Table.d.ts +1 -1
- package/dist/esm/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/components/Table/Table.js +2 -2
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/TableText.d.ts +1 -1
- package/dist/esm/components/Table/TableText.d.ts.map +1 -1
- package/dist/esm/components/Table/TableText.js +1 -1
- package/dist/esm/components/Table/TableText.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +3 -3
- package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/esm/components/Table/base/provider.d.ts +2 -2
- package/dist/esm/components/Table/base/types.d.ts +6 -4
- package/dist/esm/components/Table/base/types.d.ts.map +1 -1
- package/dist/esm/components/Table/base/types.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.js +2 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/esm/components/TableComposable/TableComposable.d.ts +1 -1
- package/dist/esm/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/TableComposable.js +1 -1
- package/dist/esm/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/esm/components/TableComposable/Td.d.ts +5 -1
- package/dist/esm/components/TableComposable/Td.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Td.js +4 -4
- package/dist/esm/components/TableComposable/Td.js.map +1 -1
- package/dist/esm/components/TableComposable/Th.d.ts +5 -1
- package/dist/esm/components/TableComposable/Th.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Th.js +4 -4
- package/dist/esm/components/TableComposable/Th.js.map +1 -1
- package/dist/esm/components/TableComposable/Tr.d.ts +1 -1
- package/dist/esm/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Tr.js +1 -1
- package/dist/esm/components/TableComposable/Tr.js.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +4 -4
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/BodyCell.d.ts +1 -1
- package/dist/js/components/Table/BodyCell.d.ts.map +1 -1
- package/dist/js/components/Table/BodyCell.js +7 -5
- package/dist/js/components/Table/BodyCell.js.map +1 -1
- package/dist/js/components/Table/CollapseColumn.js +1 -1
- package/dist/js/components/Table/CollapseColumn.js.map +1 -1
- package/dist/js/components/Table/DraggableCell.js +1 -1
- package/dist/js/components/Table/DraggableCell.js.map +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.d.ts +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.d.ts.map +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.js +2 -2
- package/dist/js/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/js/components/Table/FavoritesCell.js +1 -1
- package/dist/js/components/Table/FavoritesCell.js.map +1 -1
- package/dist/js/components/Table/HeaderCellInfoWrapper.d.ts +2 -1
- package/dist/js/components/Table/HeaderCellInfoWrapper.d.ts.map +1 -1
- package/dist/js/components/Table/HeaderCellInfoWrapper.js +7 -5
- package/dist/js/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts +1 -1
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js +5 -5
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/TableText.d.ts +1 -1
- package/dist/js/components/Table/TableText.d.ts.map +1 -1
- package/dist/js/components/Table/TableText.js +1 -1
- package/dist/js/components/Table/TableText.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +3 -3
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/TableTypes.js +3 -1
- package/dist/js/components/Table/TableTypes.js.map +1 -1
- package/dist/js/components/Table/base/provider.d.ts +2 -2
- package/dist/js/components/Table/base/types.d.ts +6 -4
- package/dist/js/components/Table/base/types.d.ts.map +1 -1
- package/dist/js/components/Table/base/types.js +4 -1
- package/dist/js/components/Table/base/types.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.js +5 -4
- package/dist/js/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/js/components/TableComposable/TableComposable.d.ts +1 -1
- package/dist/js/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/js/components/TableComposable/TableComposable.js +4 -4
- package/dist/js/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/js/components/TableComposable/Td.d.ts +5 -1
- package/dist/js/components/TableComposable/Td.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Td.js +4 -4
- package/dist/js/components/TableComposable/Td.js.map +1 -1
- package/dist/js/components/TableComposable/Th.d.ts +5 -1
- package/dist/js/components/TableComposable/Th.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Th.js +4 -4
- package/dist/js/components/TableComposable/Th.js.map +1 -1
- package/dist/js/components/TableComposable/Tr.d.ts +1 -1
- package/dist/js/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Tr.js +2 -2
- package/dist/js/components/TableComposable/Tr.js.map +1 -1
- package/dist/umd/react-table.min.js +3 -4
- package/package.json +6 -6
- package/src/components/Table/ActionsColumn.tsx +4 -4
- package/src/components/Table/BodyCell.tsx +4 -2
- package/src/components/Table/CollapseColumn.tsx +1 -1
- package/src/components/Table/DraggableCell.tsx +1 -1
- package/src/components/Table/EditableSelectInputCell.tsx +1 -1
- package/src/components/Table/FavoritesCell.tsx +1 -1
- package/src/components/Table/HeaderCellInfoWrapper.tsx +3 -1
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/Table/TableText.tsx +1 -1
- package/src/components/Table/TableTypes.tsx +3 -3
- package/src/components/Table/base/types.tsx +4 -2
- package/src/components/Table/utils/decorators/treeRow.tsx +2 -1
- package/src/components/Table/utils/transformers.test.tsx +1 -1
- package/src/components/TableComposable/TableComposable.tsx +1 -1
- package/src/components/TableComposable/Td.tsx +9 -1
- package/src/components/TableComposable/Th.tsx +9 -1
- package/src/components/TableComposable/Tr.tsx +1 -1
- package/src/components/TableComposable/examples/Table.md +30 -2
- package/src/components/TableComposable/examples/TableRightStickyColumn.tsx +153 -0
- package/src/docs/demos/Table.md +1 -1
- package/src/docs/examples/ComposableTableStickyToolbar.tsx +0 -252
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.53",
|
|
4
4
|
"description": "This library provides a set of React table components for use with the PatternFly 4",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"subpaths": "node scripts/createSubpaths.js"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@patternfly/react-core": "^5.0.0-alpha.
|
|
43
|
-
"@patternfly/react-icons": "^5.0.0-alpha.
|
|
44
|
-
"@patternfly/react-styles": "^5.0.0-alpha.
|
|
45
|
-
"@patternfly/react-tokens": "^5.0.0-alpha.
|
|
42
|
+
"@patternfly/react-core": "^5.0.0-alpha.52",
|
|
43
|
+
"@patternfly/react-icons": "^5.0.0-alpha.8",
|
|
44
|
+
"@patternfly/react-styles": "^5.0.0-alpha.6",
|
|
45
|
+
"@patternfly/react-tokens": "^5.0.0-alpha.6",
|
|
46
46
|
"lodash": "^4.17.19",
|
|
47
47
|
"tslib": "^2.5.0"
|
|
48
48
|
},
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"react": "^17 || ^18",
|
|
55
55
|
"react-dom": "^17 || ^18"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "5eea8522248a6f8caa1d7cb27f5f5b95ca823b7b"
|
|
58
58
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core';
|
|
2
|
+
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
3
3
|
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
4
4
|
import { Divider } from '@patternfly/react-core/dist/esm/components/Divider';
|
|
5
5
|
import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
@@ -70,7 +70,7 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
70
70
|
.map(({ title, itemKey, onClick, isOutsideDropdown, ...props }, key) =>
|
|
71
71
|
typeof title === 'string' ? (
|
|
72
72
|
<Button
|
|
73
|
-
onClick={(event) => onActionClick(event, onClick)}
|
|
73
|
+
onClick={(event: MouseEvent | React.MouseEvent<any, MouseEvent> | React.KeyboardEvent<Element>) => onActionClick(event, onClick)}
|
|
74
74
|
{...(props as any)}
|
|
75
75
|
isDisabled={isDisabled}
|
|
76
76
|
key={itemKey || `outside_dropdown_${key}`}
|
|
@@ -85,8 +85,8 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
85
85
|
|
|
86
86
|
<Dropdown
|
|
87
87
|
isOpen={isOpen}
|
|
88
|
-
onOpenChange={(isOpen) => setIsOpen(isOpen)}
|
|
89
|
-
toggle={(toggleRef) =>
|
|
88
|
+
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
|
|
89
|
+
toggle={(toggleRef: any) =>
|
|
90
90
|
actionsToggle ? (
|
|
91
91
|
actionsToggle({ onToggle, isOpen, isDisabled, toggleRef })
|
|
92
92
|
) : (
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip
|
|
3
|
-
import { Bullseye
|
|
2
|
+
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
3
|
+
import { Bullseye } from '@patternfly/react-core/dist/esm/layouts/Bullseye';
|
|
4
|
+
import { EmptyState } from '@patternfly/react-core/dist/esm/components/EmptyState';
|
|
5
|
+
import { SelectProps } from '@patternfly/react-core/dist/esm/components/Select';
|
|
4
6
|
import { Td } from '../TableComposable/Td';
|
|
5
7
|
|
|
6
8
|
export interface BodyCellProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
|
-
import { Button } from '@patternfly/react-core/dist/esm/components/Button
|
|
4
|
+
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
5
5
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
6
6
|
|
|
7
7
|
export interface CollapseColumnProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon';
|
|
3
|
-
import { Button } from '@patternfly/react-core/dist/esm/components/Button
|
|
3
|
+
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
4
4
|
|
|
5
5
|
export interface DraggableCellProps {
|
|
6
6
|
id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
|
-
import { Select, SelectOptionObject } from '@patternfly/react-core';
|
|
3
|
+
import { Select, SelectOptionObject } from '@patternfly/react-core/dist/esm/components/Select';
|
|
4
4
|
import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
5
5
|
import formStyles from '@patternfly/react-styles/css/components/Form/form';
|
|
6
6
|
import { EditableSelectInputProps } from './base';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon';
|
|
3
|
-
import { Button } from '@patternfly/react-core/dist/esm/components/Button
|
|
3
|
+
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
4
4
|
|
|
5
5
|
export interface FavoritesCellProps {
|
|
6
6
|
id?: string;
|
|
@@ -2,7 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
5
|
-
import {
|
|
5
|
+
import { Tooltip, TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
6
|
+
import { Popover, PopoverProps } from '@patternfly/react-core/dist/esm/components/Popover';
|
|
7
|
+
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
6
8
|
import { TableText } from './TableText';
|
|
7
9
|
|
|
8
10
|
export interface ColumnHelpWrapperProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { OUIAProps, getDefaultOUIAId } from '@patternfly/react-core';
|
|
3
|
-
import { DropdownDirection, DropdownPosition } from '@patternfly/react-core/dist/esm/deprecated/components';
|
|
2
|
+
import { OUIAProps, getDefaultOUIAId } from '@patternfly/react-core/dist/esm/helpers';
|
|
3
|
+
import { DropdownDirection, DropdownPosition } from '@patternfly/react-core/dist/esm/deprecated/components/Dropdown';
|
|
4
4
|
import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
6
|
import { Provider } from './base';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
|
-
import { Tooltip, TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip
|
|
4
|
+
import { Tooltip, TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
5
5
|
|
|
6
6
|
export enum TableTextVariant {
|
|
7
7
|
div = 'div',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonProps } from '@patternfly/react-core/dist/esm/components/Button';
|
|
2
2
|
import { formatterValueType, ColumnType, RowType, RowKeyType, HeaderType } from './base';
|
|
3
3
|
import { SortByDirection } from './SortColumn';
|
|
4
|
-
import {
|
|
4
|
+
import { DropdownItemProps } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
5
|
+
import { DropdownDirection, DropdownPosition } from '@patternfly/react-core/dist/esm/deprecated/components/Dropdown';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { CustomActionsToggleProps } from './ActionsColumn';
|
|
7
|
-
import { ButtonProps } from '@patternfly/react-core';
|
|
8
8
|
|
|
9
9
|
export enum TableGridBreakpoint {
|
|
10
10
|
none = '',
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import { TooltipProps
|
|
10
|
-
import {
|
|
9
|
+
import { TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
10
|
+
import { PopoverProps } from '@patternfly/react-core/dist/esm/components/Popover';
|
|
11
|
+
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core/dist/esm/deprecated/components/Dropdown';
|
|
12
|
+
import { SelectProps, SelectOptionObject } from '@patternfly/react-core/dist/esm/components/Select';
|
|
11
13
|
import { TableComposable } from '../../TableComposable/TableComposable';
|
|
12
14
|
import { Thead } from '../../TableComposable/Thead';
|
|
13
15
|
import { Tbody } from '../../TableComposable/Tbody';
|
|
@@ -3,7 +3,8 @@ import { IExtra, IFormatterValueType, OnCheckChange, OnTreeRowCollapse, OnToggle
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
5
5
|
import stylesTreeView from '@patternfly/react-styles/css/components/Table/table-tree-view';
|
|
6
|
-
import { Button
|
|
6
|
+
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
7
|
+
import { Checkbox } from '@patternfly/react-core/dist/esm/components/Checkbox';
|
|
7
8
|
import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon';
|
|
8
9
|
import EllipsisHIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-h-icon';
|
|
9
10
|
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
textCenter,
|
|
19
19
|
cellActions
|
|
20
20
|
} from './';
|
|
21
|
-
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core/deprecated';
|
|
21
|
+
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core/dist/esm/deprecated/components/Dropdown';
|
|
22
22
|
import {
|
|
23
23
|
IAction,
|
|
24
24
|
IActions,
|
|
@@ -5,7 +5,7 @@ import stylesTreeView from '@patternfly/react-styles/css/components/Table/table-
|
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
6
|
import { toCamel } from '../Table/utils/utils';
|
|
7
7
|
import { IVisibility } from '../Table/utils/decorators/classNames';
|
|
8
|
-
import { useOUIAProps, OUIAProps, handleArrows, setTabIndex } from '@patternfly/react-core';
|
|
8
|
+
import { useOUIAProps, OUIAProps, handleArrows, setTabIndex } from '@patternfly/react-core/dist/esm/helpers';
|
|
9
9
|
import { TableGridBreakpoint, TableVariant } from '../Table/TableTypes';
|
|
10
10
|
|
|
11
11
|
export interface BaseCellProps {
|
|
@@ -14,7 +14,7 @@ import { draggable } from '../Table/utils/decorators/draggable';
|
|
|
14
14
|
import { treeRow } from '../Table/utils/decorators/treeRow';
|
|
15
15
|
import { mergeProps } from '../Table/base/merge-props';
|
|
16
16
|
import { IVisibility } from '../Table/utils/decorators/classNames';
|
|
17
|
-
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip
|
|
17
|
+
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
18
18
|
import { IFormatterValueType, IExtra } from '../Table/TableTypes';
|
|
19
19
|
import {
|
|
20
20
|
TdActionsType,
|
|
@@ -62,10 +62,14 @@ export interface TdProps extends BaseCellProps, Omit<React.HTMLProps<HTMLTableDa
|
|
|
62
62
|
isStickyColumn?: boolean;
|
|
63
63
|
/** Adds a border to the right side of the cell */
|
|
64
64
|
hasRightBorder?: boolean;
|
|
65
|
+
/** Adds a border to the left side of the cell */
|
|
66
|
+
hasLeftBorder?: boolean;
|
|
65
67
|
/** Minimum width for a sticky column */
|
|
66
68
|
stickyMinWidth?: string;
|
|
67
69
|
/** Left offset of a sticky column. This will typically be equal to the combined value set by stickyMinWidth of any sticky columns that precede the current sticky column. */
|
|
68
70
|
stickyLeftOffset?: string;
|
|
71
|
+
/** Right offset of a sticky column. This will typically be equal to the combined value set by stickyMinWidth of any sticky columns that come after the current sticky column. */
|
|
72
|
+
stickyRightOffset?: string;
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
const TdBase: React.FunctionComponent<TdProps> = ({
|
|
@@ -91,8 +95,10 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
91
95
|
onMouseEnter: onMouseEnterProp = () => {},
|
|
92
96
|
isStickyColumn = false,
|
|
93
97
|
hasRightBorder = false,
|
|
98
|
+
hasLeftBorder = false,
|
|
94
99
|
stickyMinWidth = '120px',
|
|
95
100
|
stickyLeftOffset,
|
|
101
|
+
stickyRightOffset,
|
|
96
102
|
...props
|
|
97
103
|
}: TdProps) => {
|
|
98
104
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
@@ -257,6 +263,7 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
257
263
|
noPadding && styles.modifiers.noPadding,
|
|
258
264
|
isStickyColumn && scrollStyles.tableStickyCell, // TODO: further updates will be made with issue #8829
|
|
259
265
|
hasRightBorder && scrollStyles.modifiers.borderRight,
|
|
266
|
+
hasLeftBorder && scrollStyles.modifiers.borderLeft,
|
|
260
267
|
styles.modifiers[modifier as 'breakWord' | 'fitContent' | 'nowrap' | 'truncate' | 'wrap' | undefined],
|
|
261
268
|
draggableParams && styles.tableDraggable,
|
|
262
269
|
mergedClassName
|
|
@@ -268,6 +275,7 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
268
275
|
style: {
|
|
269
276
|
'--pf-c-table__sticky-column--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
270
277
|
'--pf-c-table__sticky-column--Left': stickyLeftOffset ? stickyLeftOffset : undefined,
|
|
278
|
+
right: stickyRightOffset ? stickyRightOffset : 0,
|
|
271
279
|
...props.style
|
|
272
280
|
} as React.CSSProperties
|
|
273
281
|
})}
|
|
@@ -11,7 +11,7 @@ import { Visibility, classNames } from './../Table/utils/decorators/classNames';
|
|
|
11
11
|
import { ThInfoType, ThSelectType, ThExpandType, ThSortType, formatterValueType } from '../Table/base/types';
|
|
12
12
|
import { mergeProps } from '../Table/base/merge-props';
|
|
13
13
|
import { IVisibility } from '../Table/utils/decorators/classNames';
|
|
14
|
-
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip
|
|
14
|
+
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
15
15
|
import { BaseCellProps } from './TableComposable';
|
|
16
16
|
import { IFormatterValueType, IColumn } from '../Table/TableTypes';
|
|
17
17
|
|
|
@@ -46,10 +46,14 @@ export interface ThProps
|
|
|
46
46
|
isStickyColumn?: boolean;
|
|
47
47
|
/** Adds a border to the right side of the cell */
|
|
48
48
|
hasRightBorder?: boolean;
|
|
49
|
+
/** Adds a border to the left side of the cell */
|
|
50
|
+
hasLeftBorder?: boolean;
|
|
49
51
|
/** Minimum width for a sticky column */
|
|
50
52
|
stickyMinWidth?: string;
|
|
51
53
|
/** Left offset of a sticky column. This will typically be equal to the combined value set by stickyMinWidth of any sticky columns that precede the current sticky column. */
|
|
52
54
|
stickyLeftOffset?: string;
|
|
55
|
+
/** Right offset of a sticky column. This will typically be equal to the combined value set by stickyMinWidth of any sticky columns that come after the current sticky column. */
|
|
56
|
+
stickyRightOffset?: string;
|
|
53
57
|
/** Indicates the <th> is part of a subheader of a nested header */
|
|
54
58
|
isSubheader?: boolean;
|
|
55
59
|
}
|
|
@@ -73,8 +77,10 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
73
77
|
info: infoProps,
|
|
74
78
|
isStickyColumn = false,
|
|
75
79
|
hasRightBorder = false,
|
|
80
|
+
hasLeftBorder = false,
|
|
76
81
|
stickyMinWidth = '120px',
|
|
77
82
|
stickyLeftOffset,
|
|
83
|
+
stickyRightOffset,
|
|
78
84
|
isSubheader = false,
|
|
79
85
|
...props
|
|
80
86
|
}: ThProps) => {
|
|
@@ -172,6 +178,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
172
178
|
isSubheader && styles.tableSubhead,
|
|
173
179
|
isStickyColumn && scrollStyles.tableStickyCell, // TODO: further updates will be made with issue #8829
|
|
174
180
|
hasRightBorder && scrollStyles.modifiers.borderRight,
|
|
181
|
+
hasLeftBorder && scrollStyles.modifiers.borderLeft,
|
|
175
182
|
modifier && styles.modifiers[modifier as 'breakWord' | 'fitContent' | 'nowrap' | 'truncate' | 'wrap'],
|
|
176
183
|
mergedClassName
|
|
177
184
|
)}
|
|
@@ -181,6 +188,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
181
188
|
style: {
|
|
182
189
|
'--pf-c-table__sticky-column--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
183
190
|
'--pf-c-table__sticky-column--Left': stickyLeftOffset ? stickyLeftOffset : undefined,
|
|
191
|
+
right: stickyRightOffset ? stickyRightOffset : 0,
|
|
184
192
|
...props.style
|
|
185
193
|
} as React.CSSProperties
|
|
186
194
|
})}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useOUIAProps, OUIAProps } from '@patternfly/react-core';
|
|
2
|
+
import { useOUIAProps, OUIAProps } from '@patternfly/react-core/dist/esm/helpers';
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
4
4
|
import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
@@ -330,13 +330,41 @@ To make a column sticky, wrap `TableComposable` with `InnerScrollContainer` and
|
|
|
330
330
|
```ts file="TableStickyColumn.tsx"
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
-
### Multiple sticky columns
|
|
333
|
+
### Multiple left-aligned sticky columns
|
|
334
334
|
|
|
335
|
-
To make multiple
|
|
335
|
+
To make multiple left-aligned columns sticky:
|
|
336
|
+
|
|
337
|
+
- wrap TableComposable with InnerScrollContainer
|
|
338
|
+
- add isStickyColumn to all columns that should be sticky
|
|
339
|
+
- add hasRightBorder to the rightmost sticky column
|
|
340
|
+
- add stickyLeftOffset to each sticky column after the first, with a value that equals the combined width - set by stickyMindWidth - of the previous sticky columns
|
|
341
|
+
|
|
342
|
+
To prevent the default text wrapping behavior and allow horizontal scrolling, all Th or Td cells should also have the modifier="nowrap" property.
|
|
343
|
+
|
|
344
|
+
- wrap `TableComposable` with `InnerScrollContainer`
|
|
345
|
+
- add `isStickyColumn` to all columns that should be sticky
|
|
346
|
+
- add `hasRightBorder` to the rightmost sticky column
|
|
347
|
+
- add `stickyLeftOffset` to each sticky column after the first, with a value that equals the combined width - set by `stickyMindWidth` - of the previous sticky columns
|
|
348
|
+
|
|
349
|
+
To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property.
|
|
336
350
|
|
|
337
351
|
```ts file="TableMultipleStickyColumns.tsx"
|
|
338
352
|
```
|
|
339
353
|
|
|
354
|
+
### Multiple right-aligned sticky columns
|
|
355
|
+
|
|
356
|
+
To make multiple right-aligned columns sticky:
|
|
357
|
+
|
|
358
|
+
- wrap `TableComposable` with `InnerScrollContainer`
|
|
359
|
+
- add `isStickyColumn` to all columns that should be sticky
|
|
360
|
+
- add `hasLeftBorder` to the leftmost sticky column
|
|
361
|
+
- add `stickyRightOffset` to each sticky column preceding the last, with a value that equals the combined width - set by `stickyMindWidth` - of the next sticky columns
|
|
362
|
+
|
|
363
|
+
To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property.
|
|
364
|
+
|
|
365
|
+
```ts file="TableRightStickyColumn.tsx"
|
|
366
|
+
```
|
|
367
|
+
|
|
340
368
|
### Sticky columns and header
|
|
341
369
|
|
|
342
370
|
To maintain proper sticky behavior across sticky columns and header, `TableComposable` must be wrapped with `OuterScrollContainer` and `InnerScrollContainer`.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableComposable, Thead, Tr, Th, Tbody, Td, InnerScrollContainer, ThProps } from '@patternfly/react-table';
|
|
3
|
+
|
|
4
|
+
interface Fact {
|
|
5
|
+
name: string;
|
|
6
|
+
state: string;
|
|
7
|
+
detail1: string;
|
|
8
|
+
detail2: string;
|
|
9
|
+
detail3: string;
|
|
10
|
+
detail4: string;
|
|
11
|
+
detail5: string;
|
|
12
|
+
detail6: string;
|
|
13
|
+
detail7: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ComposableTableRightStickyColumn: React.FunctionComponent = () => {
|
|
17
|
+
// In real usage, this data would come from some external source like an API via props.
|
|
18
|
+
const facts: Fact[] = Array.from({ length: 9 }, (_, index) => ({
|
|
19
|
+
name: `Fact ${index + 1}`,
|
|
20
|
+
state: `State ${index + 1}`,
|
|
21
|
+
detail1: `Test cell ${index + 1}-3`,
|
|
22
|
+
detail2: `Test cell ${index + 1}-4`,
|
|
23
|
+
detail3: `Test cell ${index + 1}-5`,
|
|
24
|
+
detail4: `Test cell ${index + 1}-6`,
|
|
25
|
+
detail5: `Test cell ${index + 1}-7`,
|
|
26
|
+
detail6: `Test cell ${index + 1}-8`,
|
|
27
|
+
detail7: `Test cell ${index + 1}-9`
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
const columnNames = {
|
|
31
|
+
name: 'Fact',
|
|
32
|
+
state: 'State',
|
|
33
|
+
header3: 'Header 3',
|
|
34
|
+
header4: 'Header 4',
|
|
35
|
+
header5: 'Header 5',
|
|
36
|
+
header6: 'Header 6',
|
|
37
|
+
header7: 'Header 7',
|
|
38
|
+
header8: 'Header 8',
|
|
39
|
+
header9: 'Header 9'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Index of the currently sorted column
|
|
43
|
+
// Note: if you intend to make columns reorderable, you may instead want to use a non-numeric key
|
|
44
|
+
// as the identifier of the sorted column. See the "Compound expandable" example.
|
|
45
|
+
const [activeSortIndex, setActiveSortIndex] = React.useState<number | null>(null);
|
|
46
|
+
|
|
47
|
+
// Sort direction of the currently sorted column
|
|
48
|
+
const [activeSortDirection, setActiveSortDirection] = React.useState<'asc' | 'desc' | null>(null);
|
|
49
|
+
|
|
50
|
+
// Since OnSort specifies sorted columns by index, we need sortable values for our object by column index.
|
|
51
|
+
// This example is trivial since our data objects just contain strings, but if the data was more complex
|
|
52
|
+
// this would be a place to return simplified string or number versions of each column to sort by.
|
|
53
|
+
const getSortableRowValues = (fact: Fact): (string | number)[] => {
|
|
54
|
+
const { name, state, detail1, detail2, detail3, detail4, detail5, detail6, detail7 } = fact;
|
|
55
|
+
return [name, state, detail1, detail2, detail3, detail4, detail5, detail6, detail7];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Note that we perform the sort as part of the component's render logic and not in onSort.
|
|
59
|
+
// We shouldn't store the list of data in state because we don't want to have to sync that with props.
|
|
60
|
+
let sortedFacts = facts;
|
|
61
|
+
if (activeSortIndex !== null) {
|
|
62
|
+
sortedFacts = facts.sort((a, b) => {
|
|
63
|
+
const aValue = getSortableRowValues(a)[activeSortIndex];
|
|
64
|
+
const bValue = getSortableRowValues(b)[activeSortIndex];
|
|
65
|
+
if (aValue === bValue) {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
if (activeSortDirection === 'asc') {
|
|
69
|
+
return aValue > bValue ? 1 : -1;
|
|
70
|
+
} else {
|
|
71
|
+
return bValue > aValue ? 1 : -1;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const getSortParams = (columnIndex: number): ThProps['sort'] => ({
|
|
77
|
+
sortBy: {
|
|
78
|
+
index: activeSortIndex,
|
|
79
|
+
direction: activeSortDirection
|
|
80
|
+
},
|
|
81
|
+
onSort: (_event, index, direction) => {
|
|
82
|
+
setActiveSortIndex(index);
|
|
83
|
+
setActiveSortDirection(direction);
|
|
84
|
+
},
|
|
85
|
+
columnIndex
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<InnerScrollContainer>
|
|
90
|
+
<TableComposable aria-label="Sticky column table" gridBreakPoint="">
|
|
91
|
+
<Thead>
|
|
92
|
+
<Tr>
|
|
93
|
+
<Th modifier="truncate" sort={getSortParams(0)}>
|
|
94
|
+
{columnNames.name}
|
|
95
|
+
</Th>
|
|
96
|
+
<Th modifier="truncate" sort={getSortParams(1)}>
|
|
97
|
+
{columnNames.state}
|
|
98
|
+
</Th>
|
|
99
|
+
<Th modifier="truncate">{columnNames.header3}</Th>
|
|
100
|
+
<Th modifier="truncate">{columnNames.header4}</Th>
|
|
101
|
+
<Th modifier="truncate">{columnNames.header5}</Th>
|
|
102
|
+
<Th modifier="truncate">{columnNames.header6}</Th>
|
|
103
|
+
<Th modifier="truncate">{columnNames.header7}</Th>
|
|
104
|
+
<Th isStickyColumn hasLeftBorder stickyMinWidth="130px" stickyRightOffset="130px" modifier="truncate">
|
|
105
|
+
{columnNames.header8}
|
|
106
|
+
</Th>
|
|
107
|
+
<Th isStickyColumn stickyMinWidth="130px" modifier="truncate">
|
|
108
|
+
{columnNames.header9}
|
|
109
|
+
</Th>
|
|
110
|
+
</Tr>
|
|
111
|
+
</Thead>
|
|
112
|
+
<Tbody>
|
|
113
|
+
{sortedFacts.map(fact => (
|
|
114
|
+
<Tr key={fact.name}>
|
|
115
|
+
<Th modifier="nowrap">{fact.name}</Th>
|
|
116
|
+
<Td modifier="nowrap" dataLabel={columnNames.state}>
|
|
117
|
+
{fact.state}
|
|
118
|
+
</Td>
|
|
119
|
+
<Td modifier="nowrap" dataLabel={columnNames.header3}>
|
|
120
|
+
{fact.detail1}
|
|
121
|
+
</Td>
|
|
122
|
+
<Td modifier="nowrap" dataLabel={columnNames.header4}>
|
|
123
|
+
{fact.detail2}
|
|
124
|
+
</Td>
|
|
125
|
+
<Td modifier="nowrap" dataLabel={columnNames.header5}>
|
|
126
|
+
{fact.detail3}
|
|
127
|
+
</Td>
|
|
128
|
+
<Td modifier="nowrap" dataLabel={columnNames.header6}>
|
|
129
|
+
{fact.detail4}
|
|
130
|
+
</Td>
|
|
131
|
+
<Td modifier="nowrap" dataLabel={columnNames.header7}>
|
|
132
|
+
{fact.detail5}
|
|
133
|
+
</Td>
|
|
134
|
+
<Td
|
|
135
|
+
isStickyColumn
|
|
136
|
+
hasLeftBorder
|
|
137
|
+
stickyMinWidth="130px"
|
|
138
|
+
stickyRightOffset="130px"
|
|
139
|
+
modifier="nowrap"
|
|
140
|
+
dataLabel={columnNames.header8}
|
|
141
|
+
>
|
|
142
|
+
{fact.detail6}
|
|
143
|
+
</Td>
|
|
144
|
+
<Td isStickyColumn stickyMinWidth="130px" modifier="nowrap" dataLabel={columnNames.header9}>
|
|
145
|
+
{fact.detail7}
|
|
146
|
+
</Td>
|
|
147
|
+
</Tr>
|
|
148
|
+
))}
|
|
149
|
+
</Tbody>
|
|
150
|
+
</TableComposable>
|
|
151
|
+
</InnerScrollContainer>
|
|
152
|
+
);
|
|
153
|
+
};
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -1662,7 +1662,7 @@ class StickyHeaderTableDemo extends React.Component {
|
|
|
1662
1662
|
|
|
1663
1663
|
A toolbar may be added above a sticky table either inside or outside the `OuterScrollContainer`.
|
|
1664
1664
|
|
|
1665
|
-
```ts isFullscreen file="
|
|
1665
|
+
```ts isFullscreen file="../../components/TableComposable/examples/TableStickyColumnsAndHeader.tsx"
|
|
1666
1666
|
|
|
1667
1667
|
```
|
|
1668
1668
|
|