@patternfly/react-table 6.0.0-alpha.10 → 6.0.0-alpha.101
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 +934 -2
- package/README.md +2 -17
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/Table/package.json +1 -1
- package/dist/dynamic/components/Table/utils/decorators/package.json +1 -1
- package/dist/dynamic/components/Table/utils/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/base/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic-modules.json +127 -0
- package/dist/esm/components/Table/ActionsColumn.d.ts +2 -0
- package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/ActionsColumn.js +4 -5
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/DraggableCell.d.ts.map +1 -1
- package/dist/esm/components/Table/DraggableCell.js +1 -2
- package/dist/esm/components/Table/DraggableCell.js.map +1 -1
- package/dist/esm/components/Table/EditColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/EditColumn.js +3 -6
- package/dist/esm/components/Table/EditColumn.js.map +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.d.ts +3 -4
- package/dist/esm/components/Table/EditableSelectInputCell.d.ts.map +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.js +8 -4
- package/dist/esm/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/esm/components/Table/FavoritesCell.d.ts.map +1 -1
- package/dist/esm/components/Table/FavoritesCell.js +1 -2
- package/dist/esm/components/Table/FavoritesCell.js.map +1 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.d.ts.map +1 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js +2 -4
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/esm/components/Table/RowWrapper.js.map +1 -1
- package/dist/esm/components/Table/SortColumn.js.map +1 -1
- package/dist/esm/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/components/Table/Table.js +4 -4
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/TableText.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +26 -25
- package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/esm/components/Table/TableTypes.js.map +1 -1
- package/dist/esm/components/Table/Td.d.ts +1 -1
- package/dist/esm/components/Table/Td.js +3 -3
- package/dist/esm/components/Table/Td.js.map +1 -1
- package/dist/esm/components/Table/Th.d.ts +8 -0
- package/dist/esm/components/Table/Th.d.ts.map +1 -1
- package/dist/esm/components/Table/Th.js +10 -6
- package/dist/esm/components/Table/Th.js.map +1 -1
- package/dist/esm/components/Table/Tr.d.ts +2 -0
- package/dist/esm/components/Table/Tr.d.ts.map +1 -1
- package/dist/esm/components/Table/Tr.js +2 -2
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/esm/components/Table/base/columns-are-equal.js.map +1 -1
- package/dist/esm/components/Table/base/evaluate-transforms.js.map +1 -1
- package/dist/esm/components/Table/base/merge-props.js.map +1 -1
- package/dist/esm/components/Table/base/provider.js.map +1 -1
- package/dist/esm/components/Table/base/types.d.ts +16 -17
- 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/compoundExpand.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/editable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/favoritable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/selectable.js +1 -1
- package/dist/esm/components/Table/utils/decorators/selectable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/sortable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.d.ts +1 -1
- package/dist/esm/components/Table/utils/headerUtils.js.map +1 -1
- package/dist/esm/components/Table/utils/utils.js.map +1 -1
- package/dist/esm/demos/DashboardHeader.d.ts +8 -0
- package/dist/esm/demos/DashboardHeader.d.ts.map +1 -0
- package/dist/esm/demos/DashboardHeader.js +78 -0
- package/dist/esm/demos/DashboardHeader.js.map +1 -0
- package/dist/esm/demos/DashboardWrapper.d.ts +85 -0
- package/dist/esm/demos/DashboardWrapper.d.ts.map +1 -0
- package/dist/esm/demos/DashboardWrapper.js +41 -0
- package/dist/esm/demos/DashboardWrapper.js.map +1 -0
- package/dist/esm/demos/index.d.ts +2 -0
- package/dist/esm/demos/index.d.ts.map +1 -1
- package/dist/esm/demos/index.js +2 -0
- package/dist/esm/demos/index.js.map +1 -1
- package/dist/esm/deprecated/components/Table/Body.d.ts +1 -1
- package/dist/esm/deprecated/components/Table/Body.d.ts.map +1 -1
- package/dist/esm/deprecated/components/Table/Body.js.map +1 -1
- package/dist/esm/deprecated/components/Table/BodyCell.js.map +1 -1
- package/dist/esm/deprecated/components/Table/BodyWrapper.js.map +1 -1
- package/dist/esm/deprecated/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/deprecated/components/Table/Table.js +2 -3
- package/dist/esm/deprecated/components/Table/Table.js.map +1 -1
- package/dist/esm/deprecated/components/Table/base/body-row.js.map +1 -1
- package/dist/esm/deprecated/components/Table/base/body.js.map +1 -1
- package/dist/esm/deprecated/components/Table/base/header-row.js +1 -1
- package/dist/esm/deprecated/components/Table/base/header-row.js.map +1 -1
- package/dist/esm/deprecated/components/Table/base/resolve-row-key.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/test-helpers/data-helpers.js.map +1 -1
- package/dist/js/components/Table/ActionsColumn.d.ts +2 -0
- package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +4 -5
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/CollapseColumn.js.map +1 -1
- package/dist/js/components/Table/DraggableCell.d.ts.map +1 -1
- package/dist/js/components/Table/DraggableCell.js +1 -2
- package/dist/js/components/Table/DraggableCell.js.map +1 -1
- package/dist/js/components/Table/EditColumn.d.ts.map +1 -1
- package/dist/js/components/Table/EditColumn.js +3 -6
- package/dist/js/components/Table/EditColumn.js.map +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.d.ts +3 -4
- package/dist/js/components/Table/EditableSelectInputCell.d.ts.map +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.js +8 -4
- package/dist/js/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/js/components/Table/EditableTextCell.js.map +1 -1
- package/dist/js/components/Table/FavoritesCell.d.ts.map +1 -1
- package/dist/js/components/Table/FavoritesCell.js +1 -2
- package/dist/js/components/Table/FavoritesCell.js.map +1 -1
- package/dist/js/components/Table/HeaderCellInfoWrapper.d.ts.map +1 -1
- package/dist/js/components/Table/HeaderCellInfoWrapper.js +2 -4
- package/dist/js/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/js/components/Table/RowWrapper.js +0 -1
- package/dist/js/components/Table/RowWrapper.js.map +1 -1
- package/dist/js/components/Table/SelectColumn.js +1 -1
- package/dist/js/components/Table/SelectColumn.js.map +1 -1
- package/dist/js/components/Table/SortColumn.js +1 -2
- package/dist/js/components/Table/SortColumn.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js +3 -3
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/TableText.js +2 -2
- package/dist/js/components/Table/TableText.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +26 -25
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/TableTypes.js +2 -6
- package/dist/js/components/Table/TableTypes.js.map +1 -1
- package/dist/js/components/Table/Td.d.ts +1 -1
- package/dist/js/components/Table/Td.js +3 -3
- package/dist/js/components/Table/Td.js.map +1 -1
- package/dist/js/components/Table/Th.d.ts +8 -0
- package/dist/js/components/Table/Th.d.ts.map +1 -1
- package/dist/js/components/Table/Th.js +10 -6
- package/dist/js/components/Table/Th.js.map +1 -1
- package/dist/js/components/Table/Tr.d.ts +2 -0
- package/dist/js/components/Table/Tr.d.ts.map +1 -1
- package/dist/js/components/Table/Tr.js +2 -2
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/js/components/Table/base/columns-are-equal.js.map +1 -1
- package/dist/js/components/Table/base/evaluate-transforms.js.map +1 -1
- package/dist/js/components/Table/base/merge-props.js.map +1 -1
- package/dist/js/components/Table/base/provider.js.map +1 -1
- package/dist/js/components/Table/base/types.d.ts +16 -17
- package/dist/js/components/Table/base/types.d.ts.map +1 -1
- package/dist/js/components/Table/base/types.js +0 -4
- package/dist/js/components/Table/base/types.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/compoundExpand.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/editable.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/favoritable.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/selectable.js +1 -1
- package/dist/js/components/Table/utils/decorators/selectable.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/sortable.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.d.ts +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/js/components/Table/utils/headerUtils.js.map +1 -1
- package/dist/js/components/Table/utils/utils.js.map +1 -1
- package/dist/js/demos/DashboardHeader.d.ts +8 -0
- package/dist/js/demos/DashboardHeader.d.ts.map +1 -0
- package/dist/js/demos/DashboardHeader.js +83 -0
- package/dist/js/demos/DashboardHeader.js.map +1 -0
- package/dist/js/demos/DashboardWrapper.d.ts +85 -0
- package/dist/js/demos/DashboardWrapper.d.ts.map +1 -0
- package/dist/js/demos/DashboardWrapper.js +45 -0
- package/dist/js/demos/DashboardWrapper.js.map +1 -0
- package/dist/js/demos/index.d.ts +2 -0
- package/dist/js/demos/index.d.ts.map +1 -1
- package/dist/js/demos/index.js +2 -0
- package/dist/js/demos/index.js.map +1 -1
- package/dist/js/deprecated/components/Table/Body.d.ts +1 -1
- package/dist/js/deprecated/components/Table/Body.d.ts.map +1 -1
- package/dist/js/deprecated/components/Table/Body.js.map +1 -1
- package/dist/js/deprecated/components/Table/BodyCell.js +0 -1
- package/dist/js/deprecated/components/Table/BodyCell.js.map +1 -1
- package/dist/js/deprecated/components/Table/BodyWrapper.js.map +1 -1
- package/dist/js/deprecated/components/Table/Table.d.ts.map +1 -1
- package/dist/js/deprecated/components/Table/Table.js +9 -10
- package/dist/js/deprecated/components/Table/Table.js.map +1 -1
- package/dist/js/deprecated/components/Table/base/body-row.js.map +1 -1
- package/dist/js/deprecated/components/Table/base/body.js.map +1 -1
- package/dist/js/deprecated/components/Table/base/header-row.js +1 -1
- package/dist/js/deprecated/components/Table/base/header-row.js.map +1 -1
- package/dist/js/deprecated/components/Table/base/resolve-row-key.js.map +1 -1
- package/dist/js/index.d.ts +0 -1
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +0 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/test-helpers/data-helpers.js.map +1 -1
- package/dist/umd/assets/output-BtVZZiou.css +26986 -0
- package/dist/umd/react-table.min.js +4 -5
- package/package.json +8 -12
- package/rollup.config.mjs +8 -0
- package/single-packages.config.json +3 -6
- package/src/components/Table/ActionsColumn.tsx +35 -31
- package/src/components/Table/DraggableCell.tsx +2 -3
- package/src/components/Table/EditColumn.tsx +21 -9
- package/src/components/Table/EditableSelectInputCell.tsx +15 -10
- package/src/components/Table/FavoritesCell.tsx +2 -3
- package/src/components/Table/HeaderCellInfoWrapper.tsx +10 -6
- package/src/components/Table/Table.tsx +4 -4
- package/src/components/Table/TableTypes.tsx +9 -9
- package/src/components/Table/Td.tsx +5 -5
- package/src/components/Table/Th.tsx +24 -6
- package/src/components/Table/Tr.tsx +4 -0
- package/src/components/Table/__tests__/Th.test.tsx +31 -0
- package/src/components/Table/__tests__/__snapshots__/RowWrapper.test.tsx.snap +4 -4
- package/src/components/Table/base/types.tsx +6 -7
- package/src/components/Table/examples/Table.md +46 -4
- package/src/components/Table/examples/TableActions.tsx +2 -2
- package/src/components/Table/examples/TableActionsOverflow.tsx +3 -5
- package/src/components/Table/examples/TableCompoundExpandable.tsx +3 -3
- package/src/components/Table/examples/TableDraggable.tsx +19 -16
- package/src/components/Table/examples/TableEditable.tsx +313 -0
- package/src/components/Table/examples/TableEmptyState.tsx +1 -8
- package/src/components/Table/examples/TableExpandable.tsx +1 -2
- package/src/components/Table/examples/TableMisc.tsx +2 -2
- package/src/components/Table/examples/TableNestedExpandable.tsx +1 -1
- package/src/components/Table/examples/TableNestedHeaders.tsx +4 -7
- package/src/components/Table/examples/TableNestedStickyHeader.tsx +4 -10
- package/src/components/Table/examples/TableNestedTableExpandable.tsx +1 -1
- package/src/components/Table/examples/TableSelectable.tsx +1 -0
- package/src/components/Table/examples/TableSelectableRadio.tsx +1 -1
- package/src/components/Table/examples/TableSortableCustom.tsx +2 -3
- package/src/components/Table/examples/TableStickyColumnsAndHeader.tsx +1 -1
- package/src/components/Table/examples/TableStripedExpandable.tsx +1 -1
- package/src/components/Table/utils/__snapshots__/transformers.test.tsx.snap +4 -4
- package/src/components/Table/utils/decorators/selectable.tsx +1 -1
- package/src/components/Table/utils/transformers.test.tsx +4 -7
- package/src/demos/DashboardHeader.tsx +201 -0
- package/src/demos/DashboardWrapper.tsx +198 -0
- package/src/demos/Table.md +30 -8
- package/src/demos/assets/avatarImg.svg +18 -0
- package/src/demos/assets/index.d.ts +4 -0
- package/src/demos/assets/pf-logo.svg +28 -0
- package/src/demos/examples/TableBulkSelect.tsx +2 -2
- package/src/demos/examples/TableColumnManagement.tsx +7 -9
- package/src/demos/examples/TableColumnManagementWithDraggable.tsx +7 -13
- package/src/demos/examples/TableCompact.tsx +8 -3
- package/src/demos/examples/TableCompoundExpansion.tsx +5 -4
- package/src/demos/examples/TableEmptyStateDefault.tsx +7 -9
- package/src/demos/examples/TableEmptyStateError.tsx +8 -18
- package/src/demos/examples/TableEmptyStateLoading.tsx +3 -13
- package/src/demos/examples/TableExpandCollapseAll.tsx +59 -58
- package/src/demos/examples/TableFilterable.tsx +10 -17
- package/src/demos/examples/TableSortableResponsive.tsx +13 -16
- package/src/demos/examples/TableStaticBottomPagination.tsx +8 -3
- package/src/demos/examples/TableStickyFirstColumn.tsx +1 -1
- package/src/demos/examples/TableStickyHeader.tsx +1 -1
- package/src/demos/index.ts +2 -0
- package/src/deprecated/components/Table/Table.tsx +2 -3
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +2457 -2274
- package/src/deprecated/components/Table/base/header-row.tsx +1 -1
- package/src/deprecated/components/Table/examples/LegacyTableEmptyState.tsx +6 -8
- package/src/deprecated/components/Table/examples/LegacyTableMisc.tsx +2 -2
- package/src/deprecated/components/Table/examples/LegacyTableSortableCustom.tsx +2 -3
- package/src/deprecated/components/Table/examples/Table.md +48 -41
- package/src/index.ts +0 -1
- package/rollup.config.js +0 -7
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import { TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
10
10
|
import { PopoverProps } from '@patternfly/react-core/dist/esm/components/Popover';
|
|
11
|
-
import {
|
|
12
|
-
import { SelectOptionObject, SelectProps } from '@patternfly/react-core/dist/esm/deprecated/components/Select';
|
|
11
|
+
import { SelectProps } from '@patternfly/react-core/dist/esm/components/Select';
|
|
13
12
|
import { Table } from '../Table';
|
|
14
13
|
import { Thead } from '../Thead';
|
|
15
14
|
import { Tbody } from '../Tbody';
|
|
@@ -61,9 +60,9 @@ export interface TdActionsType {
|
|
|
61
60
|
/** Whether the actions are disabled */
|
|
62
61
|
isDisabled?: boolean;
|
|
63
62
|
/** Actions dropdown position */
|
|
64
|
-
dropdownPosition?:
|
|
63
|
+
dropdownPosition?: 'right' | 'left';
|
|
65
64
|
/** Actions dropdown direction */
|
|
66
|
-
dropdownDirection?:
|
|
65
|
+
dropdownDirection?: 'up' | 'down';
|
|
67
66
|
/** The container to append the dropdown menu to. Defaults to 'inline'.
|
|
68
67
|
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
69
68
|
* Some examples:
|
|
@@ -286,11 +285,11 @@ export interface EditableSelectInputProps {
|
|
|
286
285
|
value: string | string[];
|
|
287
286
|
/** Flag controlling isOpen state of select */
|
|
288
287
|
isSelectOpen: boolean;
|
|
289
|
-
/**
|
|
290
|
-
selected:
|
|
288
|
+
/** Single select option value for single select menus, or array of select option values for multi select. You can also specify isSelected on the SelectOption */
|
|
289
|
+
selected: any | any[];
|
|
291
290
|
/** Array of react elements to display in the select menu */
|
|
292
291
|
options: React.ReactElement[];
|
|
293
|
-
/** Props to be passed down to the
|
|
292
|
+
/** Props to be passed down to the select component */
|
|
294
293
|
editableSelectProps?: SelectProps;
|
|
295
294
|
/** arbitrary data to pass to the internal select component in the editable select input cell */
|
|
296
295
|
[key: string]: any;
|
|
@@ -51,12 +51,16 @@ import FolderOpenIcon from '@patternfly/react-icons/dist/esm/icons/folder-open-i
|
|
|
51
51
|
import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
|
|
52
52
|
import BlueprintIcon from '@patternfly/react-icons/dist/esm/icons/blueprint-icon';
|
|
53
53
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
54
|
+
import PencilAltIcon from '@patternfly/react-icons/dist/esm/icons/pencil-alt-icon';
|
|
55
|
+
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
56
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
54
57
|
|
|
55
58
|
import { css } from '@patternfly/react-styles';
|
|
56
59
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
57
60
|
import spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing';
|
|
58
61
|
import textStyles from '@patternfly/react-styles/css/utilities/Text/text';
|
|
59
|
-
import
|
|
62
|
+
import inlineEditStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
63
|
+
import global_background_color_secondary_default from '@patternfly/react-tokens/dist/esm/global_background_color_secondary_default';
|
|
60
64
|
|
|
61
65
|
## Table examples
|
|
62
66
|
|
|
@@ -71,6 +75,7 @@ Some general notes:
|
|
|
71
75
|
### Basic
|
|
72
76
|
|
|
73
77
|
```ts file="TableBasic.tsx"
|
|
78
|
+
|
|
74
79
|
```
|
|
75
80
|
|
|
76
81
|
### Custom row wrapper, header tooltips & popovers
|
|
@@ -82,6 +87,7 @@ Some general notes:
|
|
|
82
87
|
To add a header tooltip or popover to `Th`, pass a `ThInfoType` object via the `info` prop.
|
|
83
88
|
|
|
84
89
|
```ts file="TableMisc.tsx"
|
|
90
|
+
|
|
85
91
|
```
|
|
86
92
|
|
|
87
93
|
### Sortable & wrapping headers
|
|
@@ -103,6 +109,7 @@ type OnSort = (
|
|
|
103
109
|
The built in display for sorting is not fully responsive, as the column headers will be displayed per row when the screen size is small. To see a full page demo of a responsive sortable table, utilizing a toolbar item to control sorting for small screens, view the `Sortable - responsive` demo in the `React demos` tab.
|
|
104
110
|
|
|
105
111
|
```ts file="TableSortable.tsx"
|
|
112
|
+
|
|
106
113
|
```
|
|
107
114
|
|
|
108
115
|
### Sortable - custom control
|
|
@@ -110,6 +117,7 @@ The built in display for sorting is not fully responsive, as the column headers
|
|
|
110
117
|
Sorting a table may also be controlled manually with a toolbar control. To see a full page demo of a responsive table, view the `Sortable - responsive` demo in the `React demos` tab.
|
|
111
118
|
|
|
112
119
|
```ts file="TableSortableCustom.tsx"
|
|
120
|
+
|
|
113
121
|
```
|
|
114
122
|
|
|
115
123
|
### Selectable with checkbox
|
|
@@ -140,6 +148,7 @@ type OnSelect = (
|
|
|
140
148
|
checking checkboxes will check intermediate rows' checkboxes.
|
|
141
149
|
|
|
142
150
|
```ts file="TableSelectable.tsx"
|
|
151
|
+
|
|
143
152
|
```
|
|
144
153
|
|
|
145
154
|
### Selectable radio input
|
|
@@ -147,6 +156,7 @@ checking checkboxes will check intermediate rows' checkboxes.
|
|
|
147
156
|
Similarly to the selectable example above, the radio buttons use the first column. The first header cell is empty, and each body row's first cell has radio button props.
|
|
148
157
|
|
|
149
158
|
```ts file="TableSelectableRadio.tsx"
|
|
159
|
+
|
|
150
160
|
```
|
|
151
161
|
|
|
152
162
|
### Row click handler, clickable rows
|
|
@@ -154,6 +164,14 @@ Similarly to the selectable example above, the radio buttons use the first colum
|
|
|
154
164
|
This selectable rows feature is intended for use when a table is used to present a list of objects in a Primary-detail view.
|
|
155
165
|
|
|
156
166
|
```ts file="TableClickable.tsx"
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Editable rows
|
|
171
|
+
|
|
172
|
+
This example shows a table with editable rows. Cells in a row can be edited after clicking on the edit icon.
|
|
173
|
+
|
|
174
|
+
```ts file="TableEditable.tsx"
|
|
157
175
|
```
|
|
158
176
|
|
|
159
177
|
### Actions
|
|
@@ -165,6 +183,7 @@ To make a cell an action cell, render an `ActionsColumn` component inside a row'
|
|
|
165
183
|
If actions menus are getting clipped by other items on the page, such as sticky columns or rows, the `ActionsColumn` can be passed a `menuAppendTo` prop to adjust where the actions menu is appended.
|
|
166
184
|
|
|
167
185
|
```ts file="TableActions.tsx"
|
|
186
|
+
|
|
168
187
|
```
|
|
169
188
|
|
|
170
189
|
### Actions Overflow
|
|
@@ -172,6 +191,7 @@ If actions menus are getting clipped by other items on the page, such as sticky
|
|
|
172
191
|
Useing an `OverflowMenu` in the actions column, allowing the actions to condense into a dropdown if necessary for space.
|
|
173
192
|
|
|
174
193
|
```ts file="TableActionsOverflow.tsx"
|
|
194
|
+
|
|
175
195
|
```
|
|
176
196
|
|
|
177
197
|
### Expandable
|
|
@@ -197,6 +217,7 @@ type OnCollapse = (
|
|
|
197
217
|
Note: Table column widths will respond automatically when toggling expanded rows. To retain column widths between expanded and collapsed states, column header and/or data cell widths must be set.
|
|
198
218
|
|
|
199
219
|
```ts file="TableExpandable.tsx"
|
|
220
|
+
|
|
200
221
|
```
|
|
201
222
|
|
|
202
223
|
### Compound expandable
|
|
@@ -221,16 +242,19 @@ export type OnExpand = (
|
|
|
221
242
|
```
|
|
222
243
|
|
|
223
244
|
```ts file="TableCompoundExpandable.tsx"
|
|
245
|
+
|
|
224
246
|
```
|
|
225
247
|
|
|
226
248
|
### Cell width, breakpoint modifiers
|
|
227
249
|
|
|
228
250
|
```ts file="TableCellWidth.tsx"
|
|
251
|
+
|
|
229
252
|
```
|
|
230
253
|
|
|
231
254
|
### Controlling text
|
|
232
255
|
|
|
233
256
|
```ts file="TableControllingText.tsx"
|
|
257
|
+
|
|
234
258
|
```
|
|
235
259
|
|
|
236
260
|
### Modifiers with table text
|
|
@@ -238,11 +262,13 @@ export type OnExpand = (
|
|
|
238
262
|
If the "wrapModifier" property is set to "truncate", it's needed to ensure that the corresponding tooltip can be opened using both keyboard and screen reader. Since this particular Td element is generic and doesn't have any predefined decorators, the focus management required to trigger the tooltip needs to be handled manually by defining and manipulating the requisite props.
|
|
239
263
|
|
|
240
264
|
```ts file="TableTextModifiers.tsx"
|
|
265
|
+
|
|
241
266
|
```
|
|
242
267
|
|
|
243
268
|
### Empty state
|
|
244
269
|
|
|
245
270
|
```ts file="TableEmptyState.tsx"
|
|
271
|
+
|
|
246
272
|
```
|
|
247
273
|
|
|
248
274
|
### Favoritable (implemented with sortable)
|
|
@@ -265,6 +291,7 @@ type OnFavorite = (
|
|
|
265
291
|
To make a favoritable column sortable, pass a `ThSortType` object to the favoritable column's `Th` with `isFavorites` set to true.
|
|
266
292
|
|
|
267
293
|
```ts file="TableFavoritable.tsx"
|
|
294
|
+
|
|
268
295
|
```
|
|
269
296
|
|
|
270
297
|
### Tree table
|
|
@@ -298,6 +325,7 @@ aria-posinset, and aria-setsize as violations. This is an intentional choice at
|
|
|
298
325
|
the voice over technologies will recognize the flat table structure as a tree.
|
|
299
326
|
|
|
300
327
|
```ts file="TableTree.tsx"
|
|
328
|
+
|
|
301
329
|
```
|
|
302
330
|
|
|
303
331
|
### Flat tree table with no inset
|
|
@@ -305,6 +333,7 @@ the voice over technologies will recognize the flat table structure as a tree.
|
|
|
305
333
|
To remove the inset used to leave space for the expand/collapse toggle in a flat tree table, use the `hasNoInset` prop on the `Table` component.
|
|
306
334
|
|
|
307
335
|
```ts file="TableTreeNoInset.tsx"
|
|
336
|
+
|
|
308
337
|
```
|
|
309
338
|
|
|
310
339
|
### Draggable row table
|
|
@@ -318,6 +347,7 @@ To make a row draggable:
|
|
|
318
347
|
5. The draggable `Td` in each row needs a `TdDraggableType` object passed to its `draggable` prop.
|
|
319
348
|
|
|
320
349
|
```ts isBeta file="TableDraggable.tsx"
|
|
350
|
+
|
|
321
351
|
```
|
|
322
352
|
|
|
323
353
|
### Sticky table modifiers
|
|
@@ -334,7 +364,7 @@ There are a few ways this can be handled:
|
|
|
334
364
|
|
|
335
365
|
### Sticky column
|
|
336
366
|
|
|
337
|
-
To make a column sticky, wrap `Table` with `InnerScrollContainer` and add the following properties to the `Th` or `Td` that should be sticky:
|
|
367
|
+
To make a column sticky, wrap `Table` with `InnerScrollContainer` and add the following properties to the `Th` or `Td` that should be sticky:
|
|
338
368
|
|
|
339
369
|
- `isStickyColumn`
|
|
340
370
|
- `hasRightBorder` for a left-aligned sticky column, or `hasLeftBorder` for a right-aligned sticky column.
|
|
@@ -342,6 +372,7 @@ To make a column sticky, wrap `Table` with `InnerScrollContainer` and add the fo
|
|
|
342
372
|
To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property. To set the minimum width of the sticky column, use the `stickyMinWidth` property. For multiple sticky columns, use the `stickyLeftOffset` and `stickyRightOffset` properties for additional left or right sticky columns.
|
|
343
373
|
|
|
344
374
|
```ts file="TableStickyColumn.tsx"
|
|
375
|
+
|
|
345
376
|
```
|
|
346
377
|
|
|
347
378
|
### Multiple left-aligned sticky columns
|
|
@@ -351,11 +382,12 @@ To make multiple left-aligned columns sticky:
|
|
|
351
382
|
- wrap `Table` with `InnerScrollContainer`
|
|
352
383
|
- add `isStickyColumn` to all columns that should be sticky
|
|
353
384
|
- add `hasRightBorder` to the rightmost sticky column
|
|
354
|
-
- add `stickyLeftOffset` to each sticky column with a value that equals the combined width - set by `stickyMindWidth` - of the previous sticky columns. The leftmost sticky column should have a value of `0`, which is the default of this property.
|
|
385
|
+
- add `stickyLeftOffset` to each sticky column with a value that equals the combined width - set by `stickyMindWidth` - of the previous sticky columns. The leftmost sticky column should have a value of `0`, which is the default of this property.
|
|
355
386
|
|
|
356
387
|
To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property.
|
|
357
388
|
|
|
358
389
|
```ts file="TableMultipleStickyColumns.tsx"
|
|
390
|
+
|
|
359
391
|
```
|
|
360
392
|
|
|
361
393
|
### Multiple right-aligned sticky columns
|
|
@@ -365,11 +397,12 @@ To make multiple right-aligned columns sticky:
|
|
|
365
397
|
- wrap `Table` with `InnerScrollContainer`
|
|
366
398
|
- add `isStickyColumn` to all columns that should be sticky
|
|
367
399
|
- add `hasLeftBorder` to the leftmost sticky column
|
|
368
|
-
- add `stickyRightOffset` to each sticky column with a value that equals the combined width - set by `stickyMindWidth` - of the next sticky columns. The rightmost sticky column should have a value of `0`, which is the default of this property.
|
|
400
|
+
- add `stickyRightOffset` to each sticky column with a value that equals the combined width - set by `stickyMindWidth` - of the next sticky columns. The rightmost sticky column should have a value of `0`, which is the default of this property.
|
|
369
401
|
|
|
370
402
|
To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property.
|
|
371
403
|
|
|
372
404
|
```ts file="TableRightStickyColumn.tsx"
|
|
405
|
+
|
|
373
406
|
```
|
|
374
407
|
|
|
375
408
|
### Sticky columns and header
|
|
@@ -377,6 +410,7 @@ To prevent the default text wrapping behavior and allow horizontal scrolling, al
|
|
|
377
410
|
To maintain proper sticky behavior across sticky columns and header, `Table` must be wrapped with `OuterScrollContainer` and `InnerScrollContainer`.
|
|
378
411
|
|
|
379
412
|
```ts file="TableStickyColumnsAndHeader.tsx"
|
|
413
|
+
|
|
380
414
|
```
|
|
381
415
|
|
|
382
416
|
### Nested column headers
|
|
@@ -393,21 +427,25 @@ The first `Tr` represents the top level of columns, and each must pass either `r
|
|
|
393
427
|
The second `Tr` represents the second level of sub columns. The `Th` in this row each should pass `isSubHeader`, and the last sub column of a column should also pass `hasRightBorder`.
|
|
394
428
|
|
|
395
429
|
```ts file="TableNestedHeaders.tsx"
|
|
430
|
+
|
|
396
431
|
```
|
|
397
432
|
|
|
398
433
|
### Nested column headers and expandable rows
|
|
399
434
|
|
|
400
435
|
```ts file="TableNestedExpandable.tsx"
|
|
436
|
+
|
|
401
437
|
```
|
|
402
438
|
|
|
403
439
|
### Expandable with nested table
|
|
404
440
|
|
|
405
441
|
```ts file="TableNestedTableExpandable.tsx"
|
|
442
|
+
|
|
406
443
|
```
|
|
407
444
|
|
|
408
445
|
### Nested sticky header
|
|
409
446
|
|
|
410
447
|
```ts file="TableNestedStickyHeader.tsx"
|
|
448
|
+
|
|
411
449
|
```
|
|
412
450
|
|
|
413
451
|
### Striped
|
|
@@ -415,6 +453,7 @@ The second `Tr` represents the second level of sub columns. The `Th` in this row
|
|
|
415
453
|
To apply striping to a basic table, add the `isStriped` property to `Table`.
|
|
416
454
|
|
|
417
455
|
```ts file="TableStriped.tsx"
|
|
456
|
+
|
|
418
457
|
```
|
|
419
458
|
|
|
420
459
|
### Striped expandable
|
|
@@ -422,6 +461,7 @@ To apply striping to a basic table, add the `isStriped` property to `Table`.
|
|
|
422
461
|
To apply striping to an expandable table, add the `isStriped` and `isExpandable` properties to `Table`.
|
|
423
462
|
|
|
424
463
|
```ts file="TableStripedExpandable.tsx"
|
|
464
|
+
|
|
425
465
|
```
|
|
426
466
|
|
|
427
467
|
### Striped multiple tobdy
|
|
@@ -429,6 +469,7 @@ To apply striping to an expandable table, add the `isStriped` and `isExpandable`
|
|
|
429
469
|
When there are multiple `Tbody` components within a table, a more granular application of striping may be controlled by adding either the `isEvenStriped` or `isOddStriped` properties to `Tbody`. These properties will stripe even or odd rows within that `Tbody` respectively.
|
|
430
470
|
|
|
431
471
|
```ts file="TableStripedMultipleTbody.tsx"
|
|
472
|
+
|
|
432
473
|
```
|
|
433
474
|
|
|
434
475
|
### Striped tr
|
|
@@ -436,4 +477,5 @@ When there are multiple `Tbody` components within a table, a more granular appli
|
|
|
436
477
|
To manually control striping, add the `isStriped` property to each desired `Tr`. This replaces adding the `isStriped` property to `Table`.
|
|
437
478
|
|
|
438
479
|
```ts file="TableStripedTr.tsx"
|
|
480
|
+
|
|
439
481
|
```
|
|
@@ -116,8 +116,8 @@ export const TableActions: React.FunctionComponent = () => {
|
|
|
116
116
|
<Th>{columnNames.prs}</Th>
|
|
117
117
|
<Th>{columnNames.workspaces}</Th>
|
|
118
118
|
<Th>{columnNames.lastCommit}</Th>
|
|
119
|
-
<
|
|
120
|
-
<
|
|
119
|
+
<Th screenReaderText="Primary action" />
|
|
120
|
+
<Th screenReaderText="Secondary action" />
|
|
121
121
|
</Tr>
|
|
122
122
|
</Thead>
|
|
123
123
|
<Tbody>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import {
|
|
4
3
|
Button,
|
|
@@ -66,7 +65,7 @@ export const TableActions: React.FunctionComponent = () => {
|
|
|
66
65
|
<Th>{columnNames.prs}</Th>
|
|
67
66
|
<Th>{columnNames.workspaces}</Th>
|
|
68
67
|
<Th>{columnNames.lastCommit}</Th>
|
|
69
|
-
<
|
|
68
|
+
<Th screenReaderText="Actions" />
|
|
70
69
|
</Tr>
|
|
71
70
|
</Thead>
|
|
72
71
|
<Tbody>
|
|
@@ -106,9 +105,8 @@ export const TableActions: React.FunctionComponent = () => {
|
|
|
106
105
|
setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
|
|
107
106
|
}
|
|
108
107
|
isExpanded={repo.isMenuOpen}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</MenuToggle>
|
|
108
|
+
icon={<EllipsisVIcon />}
|
|
109
|
+
/>
|
|
112
110
|
)}
|
|
113
111
|
isOpen={repo.isMenuOpen}
|
|
114
112
|
onOpenChange={(isOpen) =>
|
|
@@ -67,7 +67,7 @@ export const TableCompoundExpandable: React.FunctionComponent = () => {
|
|
|
67
67
|
<Th>{columnNames.prs}</Th>
|
|
68
68
|
<Th>{columnNames.workspaces}</Th>
|
|
69
69
|
<Th>{columnNames.lastCommit}</Th>
|
|
70
|
-
<Th />
|
|
70
|
+
<Th screenReaderText="URL" />
|
|
71
71
|
</Tr>
|
|
72
72
|
</Thead>
|
|
73
73
|
{repositories.map((repo: Repository, rowIndex: number) => {
|
|
@@ -75,7 +75,7 @@ export const TableCompoundExpandable: React.FunctionComponent = () => {
|
|
|
75
75
|
const isRowExpanded = !!expandedCellKey;
|
|
76
76
|
return (
|
|
77
77
|
<Tbody key={repo.name} isExpanded={isRowExpanded}>
|
|
78
|
-
<Tr>
|
|
78
|
+
<Tr isControlRow>
|
|
79
79
|
<Td width={25} dataLabel={columnNames.name} component="th">
|
|
80
80
|
<a href="#">{repo.name}</a>
|
|
81
81
|
</Td>
|
|
@@ -109,7 +109,7 @@ export const TableCompoundExpandable: React.FunctionComponent = () => {
|
|
|
109
109
|
</Tr>
|
|
110
110
|
{isRowExpanded ? (
|
|
111
111
|
<Tr isExpanded={isRowExpanded}>
|
|
112
|
-
<Td dataLabel={columnNames[expandedCellKey]}
|
|
112
|
+
<Td dataLabel={columnNames[expandedCellKey]} colSpan={6}>
|
|
113
113
|
<ExpandableRowContent>
|
|
114
114
|
<div className={spacing.mMd}>
|
|
115
115
|
Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem
|
|
@@ -140,30 +140,33 @@ export const TableDraggable: React.FunctionComponent = () => {
|
|
|
140
140
|
];
|
|
141
141
|
|
|
142
142
|
return (
|
|
143
|
-
<Table aria-label="Draggable table" className={isDragging
|
|
143
|
+
<Table aria-label="Draggable table" className={isDragging ? styles.modifiers.dragOver : ''}>
|
|
144
144
|
<Thead>
|
|
145
145
|
<Tr>
|
|
146
|
-
<Th />
|
|
146
|
+
<Th screenReaderText="Drag and drop" />
|
|
147
147
|
{columns.map((column, columnIndex) => (
|
|
148
148
|
<Th key={columnIndex}>{column}</Th>
|
|
149
149
|
))}
|
|
150
150
|
</Tr>
|
|
151
151
|
</Thead>
|
|
152
152
|
<Tbody ref={bodyRef} onDragOver={onDragOver} onDrop={onDragOver} onDragLeave={onDragLeave}>
|
|
153
|
-
{rows.map((row, rowIndex) =>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
153
|
+
{rows.map((row, rowIndex) => {
|
|
154
|
+
const rowCellsToBuild = Object.keys(row).filter((rowCell) => rowCell !== 'id');
|
|
155
|
+
return (
|
|
156
|
+
<Tr key={rowIndex} id={row.id} draggable onDrop={onDrop} onDragEnd={onDragEnd} onDragStart={onDragStart}>
|
|
157
|
+
<Td
|
|
158
|
+
draggableRow={{
|
|
159
|
+
id: `draggable-row-${row.id}`
|
|
160
|
+
}}
|
|
161
|
+
/>
|
|
162
|
+
{rowCellsToBuild.map((key, keyIndex) => (
|
|
163
|
+
<Td key={`${rowIndex}_${keyIndex}`} dataLabel={columns[keyIndex]}>
|
|
164
|
+
{row[key]}
|
|
165
|
+
</Td>
|
|
166
|
+
))}
|
|
167
|
+
</Tr>
|
|
168
|
+
);
|
|
169
|
+
})}
|
|
167
170
|
</Tbody>
|
|
168
171
|
</Table>
|
|
169
172
|
);
|