@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
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
3
|
+
import { Button, Checkbox, Radio, TextInput, KeyTypes, getUniqueId } from '@patternfly/react-core';
|
|
4
|
+
import PencilAltIcon from '@patternfly/react-icons/dist/esm/icons/pencil-alt-icon';
|
|
5
|
+
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
6
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
7
|
+
import inlineEditStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
8
|
+
import { css } from '@patternfly/react-styles';
|
|
9
|
+
|
|
10
|
+
interface EditButtonsCellProps {
|
|
11
|
+
onClick: (type: 'save' | 'cancel' | 'edit') => void;
|
|
12
|
+
elementToFocusOnEditRef?: React.MutableRefObject<HTMLElement>;
|
|
13
|
+
rowAriaLabel: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const EditButtonsCell: React.FunctionComponent<EditButtonsCellProps> = ({
|
|
17
|
+
onClick,
|
|
18
|
+
elementToFocusOnEditRef,
|
|
19
|
+
rowAriaLabel = 'row'
|
|
20
|
+
}) => {
|
|
21
|
+
const editButtonRef = React.useRef<HTMLButtonElement>();
|
|
22
|
+
|
|
23
|
+
const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, button: 'edit' | 'stopEditing') => {
|
|
24
|
+
const focusRef = button === 'edit' ? elementToFocusOnEditRef : editButtonRef;
|
|
25
|
+
|
|
26
|
+
if (event.key === KeyTypes.Enter || event.key === KeyTypes.Space) {
|
|
27
|
+
// because space key triggers click event before keyDown, we have to prevent default behaviour and trigger click manually
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
(event.target as HTMLButtonElement).click();
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
focusRef?.current?.focus();
|
|
32
|
+
}, 0);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<Td
|
|
39
|
+
dataLabel="Save and cancel buttons"
|
|
40
|
+
className={css(
|
|
41
|
+
inlineEditStyles.inlineEditGroup,
|
|
42
|
+
inlineEditStyles.modifiers.iconGroup,
|
|
43
|
+
inlineEditStyles.modifiers.actionGroup
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<div className={css(inlineEditStyles.inlineEditAction, inlineEditStyles.modifiers.valid)}>
|
|
47
|
+
<Button
|
|
48
|
+
aria-label={`Save edits of ${rowAriaLabel}`}
|
|
49
|
+
onClick={() => onClick('save')}
|
|
50
|
+
onKeyDown={(event) => onKeyDown(event, 'stopEditing')}
|
|
51
|
+
variant="plain"
|
|
52
|
+
>
|
|
53
|
+
<CheckIcon />
|
|
54
|
+
</Button>
|
|
55
|
+
</div>
|
|
56
|
+
<div className={css(inlineEditStyles.inlineEditAction)}>
|
|
57
|
+
<Button
|
|
58
|
+
aria-label={`Discard edits of ${rowAriaLabel}`}
|
|
59
|
+
onClick={() => onClick('cancel')}
|
|
60
|
+
onKeyDown={(event) => onKeyDown(event, 'stopEditing')}
|
|
61
|
+
variant="plain"
|
|
62
|
+
>
|
|
63
|
+
<TimesIcon />
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
66
|
+
</Td>
|
|
67
|
+
<Td
|
|
68
|
+
dataLabel="Edit button"
|
|
69
|
+
className={css(inlineEditStyles.inlineEditAction, inlineEditStyles.modifiers.enableEditable)}
|
|
70
|
+
>
|
|
71
|
+
<Button
|
|
72
|
+
ref={editButtonRef}
|
|
73
|
+
aria-label={`Edit ${rowAriaLabel}`}
|
|
74
|
+
onClick={() => onClick('edit')}
|
|
75
|
+
onKeyDown={(event) => onKeyDown(event, 'edit')}
|
|
76
|
+
variant="plain"
|
|
77
|
+
>
|
|
78
|
+
<PencilAltIcon />
|
|
79
|
+
</Button>
|
|
80
|
+
</Td>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
interface EditableCellProps {
|
|
86
|
+
dataLabel: string;
|
|
87
|
+
staticValue: React.ReactNode;
|
|
88
|
+
editingValue: React.ReactNode;
|
|
89
|
+
role?: string;
|
|
90
|
+
ariaLabel?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const EditableCell: React.FunctionComponent<EditableCellProps> = ({
|
|
94
|
+
dataLabel,
|
|
95
|
+
staticValue,
|
|
96
|
+
editingValue,
|
|
97
|
+
role,
|
|
98
|
+
ariaLabel
|
|
99
|
+
}) => {
|
|
100
|
+
const hasMultipleInputs = Array.isArray(editingValue) && editingValue.every((elem) => React.isValidElement(elem));
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<Td dataLabel={dataLabel}>
|
|
104
|
+
<div className={css(inlineEditStyles.inlineEditValue)}>{staticValue}</div>
|
|
105
|
+
{hasMultipleInputs ? (
|
|
106
|
+
<div className={css(inlineEditStyles.inlineEditGroup, 'pf-m-column')} role={role} aria-label={ariaLabel}>
|
|
107
|
+
{(editingValue as React.ReactElement[]).map((elem, index) => (
|
|
108
|
+
<div key={index} className={css(inlineEditStyles.inlineEditInput)}>
|
|
109
|
+
{elem}
|
|
110
|
+
</div>
|
|
111
|
+
))}
|
|
112
|
+
</div>
|
|
113
|
+
) : (
|
|
114
|
+
<div className={css(inlineEditStyles.inlineEditInput)}>{editingValue}</div>
|
|
115
|
+
)}
|
|
116
|
+
</Td>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
interface EditableRow {
|
|
121
|
+
data: CustomData;
|
|
122
|
+
columnNames: ColumnNames<CustomData>;
|
|
123
|
+
dataOptions?: CustomDataOptions;
|
|
124
|
+
saveChanges: (editedData: CustomData) => void;
|
|
125
|
+
ariaLabel: string;
|
|
126
|
+
rowIndex?: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const EditableRow: React.FunctionComponent<EditableRow> = ({
|
|
130
|
+
data,
|
|
131
|
+
columnNames,
|
|
132
|
+
dataOptions,
|
|
133
|
+
saveChanges,
|
|
134
|
+
ariaLabel,
|
|
135
|
+
rowIndex
|
|
136
|
+
}) => {
|
|
137
|
+
const [editable, setEditable] = React.useState(false);
|
|
138
|
+
const [editedData, setEditedData] = React.useState(data);
|
|
139
|
+
|
|
140
|
+
const inputRef = React.useRef();
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<Tr className={css(inlineEditStyles.inlineEdit, editable ? inlineEditStyles.modifiers.inlineEditable : '')}>
|
|
144
|
+
<EditableCell
|
|
145
|
+
dataLabel={columnNames.textInput}
|
|
146
|
+
staticValue={data.textInput}
|
|
147
|
+
editingValue={
|
|
148
|
+
<TextInput
|
|
149
|
+
aria-label={`${columnNames.textInput} ${ariaLabel}`}
|
|
150
|
+
ref={inputRef}
|
|
151
|
+
value={editedData.textInput}
|
|
152
|
+
onChange={(e) => setEditedData((data) => ({ ...data, textInput: (e.target as HTMLInputElement).value }))}
|
|
153
|
+
/>
|
|
154
|
+
}
|
|
155
|
+
/>
|
|
156
|
+
<EditableCell
|
|
157
|
+
dataLabel={columnNames.textInputDisabled}
|
|
158
|
+
staticValue={data.textInputDisabled}
|
|
159
|
+
editingValue={
|
|
160
|
+
<TextInput
|
|
161
|
+
aria-label={`${columnNames.textInputDisabled} ${ariaLabel}`}
|
|
162
|
+
isDisabled={true}
|
|
163
|
+
value={editedData.textInputDisabled ?? ''}
|
|
164
|
+
/>
|
|
165
|
+
}
|
|
166
|
+
/>
|
|
167
|
+
<EditableCell
|
|
168
|
+
dataLabel={columnNames.checkboxes}
|
|
169
|
+
staticValue={data.checkboxes.join(', ')}
|
|
170
|
+
role="group"
|
|
171
|
+
ariaLabel={`Checkbox group row ${rowIndex}`}
|
|
172
|
+
editingValue={dataOptions?.checkboxes.map((option) => {
|
|
173
|
+
const id = getUniqueId('checkbox');
|
|
174
|
+
return (
|
|
175
|
+
<Checkbox
|
|
176
|
+
key={id}
|
|
177
|
+
name={id}
|
|
178
|
+
id={id}
|
|
179
|
+
label={option}
|
|
180
|
+
isChecked={editedData.checkboxes.includes(option)}
|
|
181
|
+
onChange={(_e, checked) =>
|
|
182
|
+
setEditedData((data) => ({
|
|
183
|
+
...data,
|
|
184
|
+
checkboxes: checked ? [...data.checkboxes, option] : data.checkboxes.filter((item) => item !== option)
|
|
185
|
+
}))
|
|
186
|
+
}
|
|
187
|
+
/>
|
|
188
|
+
);
|
|
189
|
+
})}
|
|
190
|
+
/>
|
|
191
|
+
<EditableCell
|
|
192
|
+
dataLabel={columnNames.radios}
|
|
193
|
+
staticValue={data.radios}
|
|
194
|
+
ariaLabel={`Radio button group row ${rowIndex}`}
|
|
195
|
+
role="radiogroup"
|
|
196
|
+
editingValue={dataOptions?.radios.map((option) => {
|
|
197
|
+
const id = getUniqueId('radio');
|
|
198
|
+
return (
|
|
199
|
+
<Radio
|
|
200
|
+
key={id}
|
|
201
|
+
name={id}
|
|
202
|
+
id={id}
|
|
203
|
+
label={option}
|
|
204
|
+
isChecked={editedData.radios === option}
|
|
205
|
+
onChange={() => setEditedData((data) => ({ ...data, radios: option }))}
|
|
206
|
+
/>
|
|
207
|
+
);
|
|
208
|
+
})}
|
|
209
|
+
/>
|
|
210
|
+
<EditButtonsCell
|
|
211
|
+
onClick={(type) => {
|
|
212
|
+
type === 'edit' ? setEditable(true) : setEditable(false);
|
|
213
|
+
type === 'save' && saveChanges(editedData);
|
|
214
|
+
type === 'cancel' && setEditedData(data);
|
|
215
|
+
}}
|
|
216
|
+
rowAriaLabel={ariaLabel}
|
|
217
|
+
elementToFocusOnEditRef={inputRef}
|
|
218
|
+
/>
|
|
219
|
+
</Tr>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
interface CustomData {
|
|
224
|
+
textInput: string;
|
|
225
|
+
textInputDisabled: string | null;
|
|
226
|
+
checkboxes: string[];
|
|
227
|
+
radios: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
interface CustomDataOptions {
|
|
231
|
+
checkboxes: string[];
|
|
232
|
+
radios: string[];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
type ColumnNames<T> = { [K in keyof T]: string };
|
|
236
|
+
|
|
237
|
+
export const TableEditable: React.FunctionComponent = () => {
|
|
238
|
+
// In real usage, this data would come from some external source like an API via props.
|
|
239
|
+
const initialRows: CustomData[] = [
|
|
240
|
+
{
|
|
241
|
+
textInput: 'Editable text 1',
|
|
242
|
+
textInputDisabled: 'Non-editable text 1',
|
|
243
|
+
checkboxes: ['Option A'],
|
|
244
|
+
radios: 'Option A'
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
textInput: 'Editable text 2',
|
|
248
|
+
textInputDisabled: null,
|
|
249
|
+
checkboxes: [],
|
|
250
|
+
radios: 'Option B'
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
textInput: 'Editable text 3',
|
|
254
|
+
textInputDisabled: 'Non-editable text 3',
|
|
255
|
+
checkboxes: ['Option A', 'Option B'],
|
|
256
|
+
radios: 'Option A'
|
|
257
|
+
}
|
|
258
|
+
];
|
|
259
|
+
|
|
260
|
+
// List of all selectable options for some cells of initialRows
|
|
261
|
+
const initialRowsOptions: CustomDataOptions[] = [
|
|
262
|
+
{
|
|
263
|
+
checkboxes: ['Option A', 'Option B', 'Option C'],
|
|
264
|
+
radios: ['Option A', 'Option B']
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
checkboxes: ['Option A', 'Option B'],
|
|
268
|
+
radios: ['Option A', 'Option B', 'Option C']
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
checkboxes: ['Option A', 'Option B'],
|
|
272
|
+
radios: ['Option A', 'Option B']
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
const [rows, setRows] = React.useState(initialRows);
|
|
277
|
+
|
|
278
|
+
const columnNames: ColumnNames<CustomData> = {
|
|
279
|
+
textInput: 'Text input',
|
|
280
|
+
textInputDisabled: 'Disabled text input',
|
|
281
|
+
checkboxes: 'Checkboxes',
|
|
282
|
+
radios: 'Radios'
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
return (
|
|
286
|
+
<Table aria-label="Editable table">
|
|
287
|
+
<Thead>
|
|
288
|
+
<Tr>
|
|
289
|
+
<Th>{columnNames.textInput}</Th>
|
|
290
|
+
<Th>{columnNames.textInputDisabled}</Th>
|
|
291
|
+
<Th>{columnNames.checkboxes}</Th>
|
|
292
|
+
<Th>{columnNames.radios}</Th>
|
|
293
|
+
<Th screenReaderText="Row edit actions" />
|
|
294
|
+
</Tr>
|
|
295
|
+
</Thead>
|
|
296
|
+
<Tbody>
|
|
297
|
+
{rows.map((data, index) => (
|
|
298
|
+
<EditableRow
|
|
299
|
+
key={index}
|
|
300
|
+
data={data}
|
|
301
|
+
rowIndex={index}
|
|
302
|
+
dataOptions={initialRowsOptions[index]}
|
|
303
|
+
columnNames={columnNames}
|
|
304
|
+
saveChanges={(editedRow) => {
|
|
305
|
+
setRows((rows) => rows.map((row, i) => (i === index ? editedRow : row)));
|
|
306
|
+
}}
|
|
307
|
+
ariaLabel={`row ${index + 1}`}
|
|
308
|
+
></EditableRow>
|
|
309
|
+
))}
|
|
310
|
+
</Tbody>
|
|
311
|
+
</Table>
|
|
312
|
+
);
|
|
313
|
+
};
|
|
@@ -4,10 +4,8 @@ import {
|
|
|
4
4
|
Bullseye,
|
|
5
5
|
EmptyState,
|
|
6
6
|
EmptyStateVariant,
|
|
7
|
-
EmptyStateIcon,
|
|
8
7
|
EmptyStateBody,
|
|
9
8
|
Button,
|
|
10
|
-
EmptyStateHeader,
|
|
11
9
|
EmptyStateFooter,
|
|
12
10
|
EmptyStateActions
|
|
13
11
|
} from '@patternfly/react-core';
|
|
@@ -31,12 +29,7 @@ export const TableEmptyState: React.FunctionComponent = () => (
|
|
|
31
29
|
<Tr>
|
|
32
30
|
<Td colSpan={8}>
|
|
33
31
|
<Bullseye>
|
|
34
|
-
<EmptyState variant={EmptyStateVariant.sm}>
|
|
35
|
-
<EmptyStateHeader
|
|
36
|
-
icon={<EmptyStateIcon icon={SearchIcon} />}
|
|
37
|
-
titleText="No results found"
|
|
38
|
-
headingLevel="h2"
|
|
39
|
-
/>
|
|
32
|
+
<EmptyState headingLevel="h2" titleText="No results found" icon={SearchIcon} variant={EmptyStateVariant.sm}>
|
|
40
33
|
<EmptyStateBody>Clear all filters and try again.</EmptyStateBody>
|
|
41
34
|
<EmptyStateFooter>
|
|
42
35
|
<EmptyStateActions>
|
|
@@ -16,7 +16,6 @@ interface Repository {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
19
|
export const TableExpandable: React.FunctionComponent = () => {
|
|
21
20
|
// In real usage, this data would come from some external source like an API via props.
|
|
22
21
|
const repositories: Repository[] = [
|
|
@@ -120,7 +119,7 @@ export const TableExpandable: React.FunctionComponent = () => {
|
|
|
120
119
|
<Table aria-label="Expandable table" variant={isExampleCompact ? 'compact' : undefined}>
|
|
121
120
|
<Thead>
|
|
122
121
|
<Tr>
|
|
123
|
-
<Th />
|
|
122
|
+
<Th screenReaderText="Row expansion" />
|
|
124
123
|
<Th width={25}>{columnNames.name}</Th>
|
|
125
124
|
<Th width={10}>{columnNames.branches}</Th>
|
|
126
125
|
<Th width={15}>{columnNames.prs}</Th>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
|
-
import
|
|
4
|
+
import global_background_color_secondary_default from '@patternfly/react-tokens/dist/esm/global_background_color_secondary_default';
|
|
5
5
|
|
|
6
6
|
interface Repository {
|
|
7
7
|
name: string;
|
|
@@ -67,7 +67,7 @@ export const TableMisc: React.FunctionComponent = () => {
|
|
|
67
67
|
{repositories.map((repo, rowIndex) => {
|
|
68
68
|
const isOddRow = (rowIndex + 1) % 2;
|
|
69
69
|
const customStyle = {
|
|
70
|
-
backgroundColor:
|
|
70
|
+
backgroundColor: global_background_color_secondary_default.var
|
|
71
71
|
};
|
|
72
72
|
// Some arbitrary logic to demonstrate that cell styles can be based on anything
|
|
73
73
|
const nameColSpan = repo.branches === null && repo.prs === null ? 3 : 1;
|
|
@@ -64,7 +64,7 @@ export const TableNestedExpandable: React.FunctionComponent = () => {
|
|
|
64
64
|
<Table aria-label="Nested column headers with expandable rows table" gridBreakPoint="">
|
|
65
65
|
<Thead hasNestedHeader>
|
|
66
66
|
<Tr>
|
|
67
|
-
<Th rowSpan={2} />
|
|
67
|
+
<Th screenReaderText="Row expansion" rowSpan={2} />
|
|
68
68
|
<Th width={35} rowSpan={2} hasRightBorder>
|
|
69
69
|
{columnNames.team}
|
|
70
70
|
</Th>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Table, Thead, Tr, Th, Tbody, Td, InnerScrollContainer, ThProps } from '@patternfly/react-table';
|
|
3
|
-
import { Stack, StackItem } from '@patternfly/react-core';
|
|
4
|
-
import textStyles from '@patternfly/react-styles/css/utilities/Text/text';
|
|
5
|
-
|
|
3
|
+
import { Stack, StackItem, Timestamp } from '@patternfly/react-core';
|
|
6
4
|
interface PodConnection {
|
|
7
5
|
source: {
|
|
8
6
|
podName: string;
|
|
@@ -162,8 +160,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
162
160
|
<Td dataLabel={columnNames.destination}>{connection.destination.podName}</Td>\
|
|
163
161
|
<Td dataLabel={columnNames.datetime}>
|
|
164
162
|
<div>
|
|
165
|
-
<
|
|
166
|
-
<span className={textStyles.color_200}>{new Date(connection.timestamp).toLocaleTimeString()}</span>
|
|
163
|
+
<Timestamp dateFormat="full" timeFormat="medium" date={new Date(connection.timestamp)} />
|
|
167
164
|
</div>
|
|
168
165
|
</Td>
|
|
169
166
|
<Td dataLabel={columnNames.source}>
|
|
@@ -172,7 +169,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
172
169
|
<span>{connection.source.port.num}</span>
|
|
173
170
|
</StackItem>
|
|
174
171
|
<StackItem>
|
|
175
|
-
<
|
|
172
|
+
<small>({connection.source.port.protocol})</small>
|
|
176
173
|
</StackItem>
|
|
177
174
|
</Stack>
|
|
178
175
|
</Td>
|
|
@@ -182,7 +179,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
182
179
|
<span>{connection.destination.port.num}</span>
|
|
183
180
|
</StackItem>
|
|
184
181
|
<StackItem>
|
|
185
|
-
<
|
|
182
|
+
<small>({connection.destination.port.protocol})</small>
|
|
186
183
|
</StackItem>
|
|
187
184
|
</Stack>
|
|
188
185
|
</Td>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Table, Thead, Tr, Th, Tbody, Td, InnerScrollContainer, ThProps } from '@patternfly/react-table';
|
|
3
|
-
import { Stack, StackItem } from '@patternfly/react-core';
|
|
4
|
-
import textStyles from '@patternfly/react-styles/css/utilities/Text/text';
|
|
5
|
-
|
|
3
|
+
import { Stack, StackItem, Timestamp } from '@patternfly/react-core';
|
|
6
4
|
interface PodConnection {
|
|
7
5
|
source: {
|
|
8
6
|
podName: string;
|
|
@@ -154,9 +152,6 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
154
152
|
{columnNames.destination}
|
|
155
153
|
</Th>
|
|
156
154
|
</Tr>
|
|
157
|
-
<Tr isBorderRow aria-hidden="true">
|
|
158
|
-
<Td colSpan={9}></Td>
|
|
159
|
-
</Tr>
|
|
160
155
|
</Thead>
|
|
161
156
|
<Tbody>
|
|
162
157
|
{sortedConnections.map((connection) => (
|
|
@@ -165,8 +160,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
165
160
|
<Td dataLabel={columnNames.destination}>{connection.destination.podName}</Td>\
|
|
166
161
|
<Td dataLabel={columnNames.datetime}>
|
|
167
162
|
<div>
|
|
168
|
-
<
|
|
169
|
-
<span className={textStyles.color_200}>{new Date(connection.timestamp).toLocaleTimeString()}</span>
|
|
163
|
+
<Timestamp dateFormat="full" timeFormat="medium" date={new Date(connection.timestamp)} />
|
|
170
164
|
</div>
|
|
171
165
|
</Td>
|
|
172
166
|
<Td dataLabel={columnNames.source}>
|
|
@@ -175,7 +169,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
175
169
|
<span>{connection.source.port.num}</span>
|
|
176
170
|
</StackItem>
|
|
177
171
|
<StackItem>
|
|
178
|
-
<
|
|
172
|
+
<small>({connection.source.port.protocol})</small>
|
|
179
173
|
</StackItem>
|
|
180
174
|
</Stack>
|
|
181
175
|
</Td>
|
|
@@ -185,7 +179,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
185
179
|
<span>{connection.destination.port.num}</span>
|
|
186
180
|
</StackItem>
|
|
187
181
|
<StackItem>
|
|
188
|
-
<
|
|
182
|
+
<small>({connection.destination.port.protocol})</small>
|
|
189
183
|
</StackItem>
|
|
190
184
|
</Stack>
|
|
191
185
|
</Td>
|
|
@@ -131,7 +131,7 @@ export const TableExpandable: React.FunctionComponent = () => {
|
|
|
131
131
|
<Table aria-label="Simple table">
|
|
132
132
|
<Thead>
|
|
133
133
|
<Tr>
|
|
134
|
-
<
|
|
134
|
+
<Th screenReaderText="Row expansion" />
|
|
135
135
|
<Th width={20}>{columnNames.name}</Th>
|
|
136
136
|
<Th>{columnNames.branches}</Th>
|
|
137
137
|
<Th>{columnNames.prs}</Th>
|
|
@@ -93,6 +93,7 @@ export const TableSelectable: React.FunctionComponent = () => {
|
|
|
93
93
|
onSelect: (_event, isSelecting) => selectAllRepos(isSelecting),
|
|
94
94
|
isSelected: areAllReposSelected
|
|
95
95
|
}}
|
|
96
|
+
aria-label="Row select"
|
|
96
97
|
/>
|
|
97
98
|
<Th>{columnNames.name}</Th>
|
|
98
99
|
<Th>{columnNames.branches}</Th>
|
|
@@ -35,7 +35,7 @@ export const TableSelectableRadio: React.FunctionComponent = () => {
|
|
|
35
35
|
<Table aria-label="Selectable table">
|
|
36
36
|
<Thead>
|
|
37
37
|
<Tr>
|
|
38
|
-
<Th />
|
|
38
|
+
<Th screenReaderText="Row select" />
|
|
39
39
|
<Th>{columnNames.name}</Th>
|
|
40
40
|
<Th>{columnNames.branches}</Th>
|
|
41
41
|
<Th>{columnNames.prs}</Th>
|
|
@@ -117,9 +117,8 @@ export const TableSortableCustom: React.FunctionComponent = () => {
|
|
|
117
117
|
isExpanded={isSortDropdownOpen}
|
|
118
118
|
variant="plain"
|
|
119
119
|
aria-label="Sort columns"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
</MenuToggle>
|
|
120
|
+
icon={<SortAmountDownIcon />}
|
|
121
|
+
/>
|
|
123
122
|
)}
|
|
124
123
|
>
|
|
125
124
|
<SelectGroup label="Sort column">
|
|
@@ -98,7 +98,7 @@ export const TableStickyColumnsAndHeader: React.FunctionComponent = () => {
|
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
return (
|
|
101
|
-
<div style={{ height: '
|
|
101
|
+
<div style={{ height: '400px' }}>
|
|
102
102
|
<OuterScrollContainer>
|
|
103
103
|
<InnerScrollContainer>
|
|
104
104
|
<Table aria-label="Sticky columns and header table" gridBreakPoint="" isStickyHeader>
|
|
@@ -115,7 +115,7 @@ export const TableStripedExpandable: React.FunctionComponent = () => {
|
|
|
115
115
|
<Table aria-label="Expandable table" variant={isExampleCompact ? 'compact' : undefined} isStriped isExpandable>
|
|
116
116
|
<Thead>
|
|
117
117
|
<Tr>
|
|
118
|
-
<Th />
|
|
118
|
+
<Th screenReaderText="Row expansion" />
|
|
119
119
|
<Th width={25}>{columnNames.name}</Th>
|
|
120
120
|
<Th width={10}>{columnNames.branches}</Th>
|
|
121
121
|
<Th width={15}>{columnNames.prs}</Th>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Transformer functions selectable unselected 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"children": <SelectColumn
|
|
6
6
|
aria-label="Select row 0"
|
|
7
7
|
checked={false}
|
|
@@ -10,14 +10,14 @@ Object {
|
|
|
10
10
|
>
|
|
11
11
|
|
|
12
12
|
</SelectColumn>,
|
|
13
|
-
"className": "pf-
|
|
13
|
+
"className": "pf-v6-c-table__check",
|
|
14
14
|
"component": "td",
|
|
15
15
|
"isVisible": true,
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
19
|
exports[`Transformer functions sortable asc 1`] = `
|
|
20
|
-
|
|
20
|
+
{
|
|
21
21
|
"aria-sort": "ascending",
|
|
22
22
|
"children": <SortColumn
|
|
23
23
|
isSortedBy={true}
|
|
@@ -26,6 +26,6 @@ Object {
|
|
|
26
26
|
>
|
|
27
27
|
|
|
28
28
|
</SortColumn>,
|
|
29
|
-
"className": "pf-
|
|
29
|
+
"className": "pf-v6-c-table__sort pf-m-selected",
|
|
30
30
|
}
|
|
31
31
|
`;
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
textCenter,
|
|
19
19
|
cellActions
|
|
20
20
|
} from './';
|
|
21
|
-
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core/dist/esm/deprecated/components/Dropdown';
|
|
22
21
|
import {
|
|
23
22
|
IAction,
|
|
24
23
|
IActions,
|
|
@@ -31,7 +30,7 @@ import {
|
|
|
31
30
|
} from '../TableTypes';
|
|
32
31
|
import { css } from '@patternfly/react-styles';
|
|
33
32
|
import tableStyles from '@patternfly/react-styles/css/components/Table/table';
|
|
34
|
-
import
|
|
33
|
+
import menuStyles from '@patternfly/react-styles/css/components/Menu/menu';
|
|
35
34
|
|
|
36
35
|
const testCellActions = async ({
|
|
37
36
|
actions,
|
|
@@ -58,8 +57,8 @@ const testCellActions = async ({
|
|
|
58
57
|
rowData,
|
|
59
58
|
column: {
|
|
60
59
|
extraParams: {
|
|
61
|
-
dropdownPosition:
|
|
62
|
-
dropdownDirection:
|
|
60
|
+
dropdownPosition: 'right',
|
|
61
|
+
dropdownDirection: 'down'
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
});
|
|
@@ -77,9 +76,7 @@ const testCellActions = async ({
|
|
|
77
76
|
await user.click(screen.getAllByRole('button')[0]);
|
|
78
77
|
await waitFor(() =>
|
|
79
78
|
// eslint-disable-next-line testing-library/no-container
|
|
80
|
-
expect(container.querySelectorAll(`.${
|
|
81
|
-
expectDisabled ? 0 : 1
|
|
82
|
-
)
|
|
79
|
+
expect(container.querySelectorAll(`.${menuStyles.menu} li button`)).toHaveLength(expectDisabled ? 0 : 1)
|
|
83
80
|
);
|
|
84
81
|
}
|
|
85
82
|
};
|