@patternfly/react-table 4.112.30 → 4.112.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/components/Table/ActionsColumn.d.ts +2 -0
- package/components/Table/ActionsColumn.d.ts.map +1 -1
- package/components/Table/ActionsColumn.js +3 -2
- package/components/Table/ActionsColumn.js.map +1 -1
- package/components/Table/Table.d.ts +8 -0
- package/components/Table/Table.d.ts.map +1 -1
- package/components/Table/Table.js +3 -1
- package/components/Table/Table.js.map +1 -1
- package/components/Table/TableTypes.d.ts +1 -0
- package/components/Table/TableTypes.d.ts.map +1 -1
- package/components/Table/base/types.d.ts +8 -0
- package/components/Table/base/types.d.ts.map +1 -1
- package/components/Table/base/types.js.map +1 -1
- package/components/Table/utils/decorators/cellActions.d.ts.map +1 -1
- package/components/Table/utils/decorators/cellActions.js +2 -2
- package/components/Table/utils/decorators/cellActions.js.map +1 -1
- package/components/TableComposable/Td.d.ts +1 -1
- package/components/TableComposable/Td.d.ts.map +1 -1
- package/components/TableComposable/Td.js +1 -0
- package/components/TableComposable/Td.js.map +1 -1
- 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 +3 -2
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/Table.d.ts +8 -0
- package/dist/esm/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/components/Table/Table.js +3 -1
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +1 -0
- package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/esm/components/Table/base/types.d.ts +8 -0
- 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/cellActions.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/cellActions.js +2 -2
- package/dist/esm/components/Table/utils/decorators/cellActions.js.map +1 -1
- package/dist/esm/components/TableComposable/Td.d.ts +1 -1
- package/dist/esm/components/TableComposable/Td.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Td.js +1 -0
- package/dist/esm/components/TableComposable/Td.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 +3 -2
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts +8 -0
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js +3 -1
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +1 -0
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/base/types.d.ts +8 -0
- package/dist/js/components/Table/base/types.d.ts.map +1 -1
- package/dist/js/components/Table/base/types.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/cellActions.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/cellActions.js +2 -2
- package/dist/js/components/Table/utils/decorators/cellActions.js.map +1 -1
- package/dist/js/components/TableComposable/Td.d.ts +1 -1
- package/dist/js/components/TableComposable/Td.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Td.js +1 -0
- package/dist/js/components/TableComposable/Td.js.map +1 -1
- package/dist/umd/react-table.min.js +6 -6
- package/package.json +2 -2
- package/src/components/Table/ActionsColumn.tsx +13 -1
- package/src/components/Table/Table.tsx +11 -0
- package/src/components/Table/TableTypes.tsx +1 -0
- package/src/components/Table/base/types.tsx +8 -0
- package/src/components/Table/examples/Table.md +2 -0
- package/src/components/Table/utils/decorators/cellActions.tsx +2 -1
- package/src/components/TableComposable/Td.tsx +2 -1
- package/src/components/TableComposable/examples/ComposableTable.md +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.112.
|
|
3
|
+
"version": "4.112.31",
|
|
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",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"react": "^16.8 || ^17 || ^18",
|
|
55
55
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "954f51d1b285c1e8fa1905e1a2003e2966f0d465"
|
|
58
58
|
}
|
|
@@ -22,6 +22,7 @@ export interface ActionsColumnProps {
|
|
|
22
22
|
children?: React.ReactNode;
|
|
23
23
|
items: IAction[];
|
|
24
24
|
isDisabled?: boolean;
|
|
25
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
25
26
|
dropdownPosition?: DropdownPosition;
|
|
26
27
|
dropdownDirection?: DropdownDirection;
|
|
27
28
|
rowData?: IRowData;
|
|
@@ -41,6 +42,7 @@ export class ActionsColumn extends React.Component<ActionsColumnProps, ActionsCo
|
|
|
41
42
|
items: [] as IAction[],
|
|
42
43
|
dropdownPosition: DropdownPosition.right,
|
|
43
44
|
dropdownDirection: DropdownDirection.down,
|
|
45
|
+
menuAppendTo: 'inline',
|
|
44
46
|
rowData: {} as IRowData,
|
|
45
47
|
extraData: {} as IExtraData
|
|
46
48
|
};
|
|
@@ -74,7 +76,16 @@ export class ActionsColumn extends React.Component<ActionsColumnProps, ActionsCo
|
|
|
74
76
|
|
|
75
77
|
render() {
|
|
76
78
|
const { isOpen } = this.state;
|
|
77
|
-
const {
|
|
79
|
+
const {
|
|
80
|
+
items,
|
|
81
|
+
children,
|
|
82
|
+
dropdownPosition,
|
|
83
|
+
dropdownDirection,
|
|
84
|
+
menuAppendTo,
|
|
85
|
+
isDisabled,
|
|
86
|
+
rowData,
|
|
87
|
+
actionsToggle
|
|
88
|
+
} = this.props;
|
|
78
89
|
|
|
79
90
|
const actionsToggleClone = actionsToggle ? (
|
|
80
91
|
actionsToggle({ onToggle: this.onToggle, isOpen, isDisabled })
|
|
@@ -106,6 +117,7 @@ export class ActionsColumn extends React.Component<ActionsColumnProps, ActionsCo
|
|
|
106
117
|
toggle={actionsToggleClone}
|
|
107
118
|
position={dropdownPosition}
|
|
108
119
|
direction={dropdownDirection}
|
|
120
|
+
menuAppendTo={menuAppendTo}
|
|
109
121
|
isOpen={isOpen}
|
|
110
122
|
dropdownItems={items
|
|
111
123
|
.filter(item => !item.isOutsideDropdown)
|
|
@@ -93,6 +93,14 @@ export interface TableProps extends OUIAProps {
|
|
|
93
93
|
dropdownPosition?: 'right' | 'left';
|
|
94
94
|
/** The desired direction to show the dropdown when clicking on the actions Kebab. Can only be used together with `actions` property */
|
|
95
95
|
dropdownDirection?: 'up' | 'down';
|
|
96
|
+
/** The container to append the dropdown menu to. Defaults to 'inline'.
|
|
97
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
98
|
+
* Some examples:
|
|
99
|
+
* actionsMenuAppendTo="parent"
|
|
100
|
+
* actionsMenuAppendTo={() => document.body}
|
|
101
|
+
* actionsMenuAppendTo={document.getElementById('target')}
|
|
102
|
+
*/
|
|
103
|
+
actionsMenuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
96
104
|
/** The toggle of the actions menu dropdown. A KebabToggle or DropdownToggle component */
|
|
97
105
|
actionsToggle?: (props: CustomActionsToggleProps) => React.ReactNode;
|
|
98
106
|
/** Row data */
|
|
@@ -141,6 +149,7 @@ export class Table extends React.Component<TableProps, {}> {
|
|
|
141
149
|
contentId: 'expanded-content',
|
|
142
150
|
dropdownPosition: DropdownPosition.right,
|
|
143
151
|
dropdownDirection: DropdownDirection.down,
|
|
152
|
+
actionsMenuAppendTo: 'inline',
|
|
144
153
|
header: undefined as React.ReactNode,
|
|
145
154
|
caption: undefined as React.ReactNode,
|
|
146
155
|
'aria-label': undefined as string,
|
|
@@ -202,6 +211,7 @@ export class Table extends React.Component<TableProps, {}> {
|
|
|
202
211
|
rowLabeledBy,
|
|
203
212
|
dropdownPosition,
|
|
204
213
|
dropdownDirection,
|
|
214
|
+
actionsMenuAppendTo: menuAppendTo,
|
|
205
215
|
actionsToggle,
|
|
206
216
|
contentId,
|
|
207
217
|
expandId,
|
|
@@ -244,6 +254,7 @@ export class Table extends React.Component<TableProps, {}> {
|
|
|
244
254
|
contentId,
|
|
245
255
|
dropdownPosition,
|
|
246
256
|
dropdownDirection,
|
|
257
|
+
menuAppendTo,
|
|
247
258
|
actionsToggle,
|
|
248
259
|
onFavorite,
|
|
249
260
|
canSortFavorites,
|
|
@@ -106,6 +106,7 @@ export interface IColumn {
|
|
|
106
106
|
contentId?: string;
|
|
107
107
|
dropdownPosition?: DropdownPosition;
|
|
108
108
|
dropdownDirection?: DropdownDirection;
|
|
109
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
109
110
|
actionsToggle?: (props: CustomActionsToggleProps) => React.ReactNode;
|
|
110
111
|
allRowsSelected?: boolean;
|
|
111
112
|
allRowsExpanded?: boolean;
|
|
@@ -68,6 +68,14 @@ export interface TdActionsType {
|
|
|
68
68
|
dropdownPosition?: DropdownPosition;
|
|
69
69
|
/** Actions dropdown direction */
|
|
70
70
|
dropdownDirection?: DropdownDirection;
|
|
71
|
+
/** The container to append the dropdown menu to. Defaults to 'inline'.
|
|
72
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
73
|
+
* Some examples:
|
|
74
|
+
* menuAppendTo="parent"
|
|
75
|
+
* menuAppendTo={() => document.body}
|
|
76
|
+
* menuAppendTo={document.getElementById('target')}
|
|
77
|
+
*/
|
|
78
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
71
79
|
/** Custom toggle for the actions menu */
|
|
72
80
|
actionsToggle?: (props: CustomActionsToggleProps) => React.ReactNode;
|
|
73
81
|
}
|
|
@@ -214,6 +214,8 @@ This selectable rows feature is intended for use when a table is used to present
|
|
|
214
214
|
|
|
215
215
|
To use actions you can either specify an array of actions and pass that into the `Table`'s `actions` prop, or for more control you can use the `actionResolver` callback prop to add actions conditionally.
|
|
216
216
|
|
|
217
|
+
If actions menus are getting clipped by other items on the page, such as sticky columns or rows, the `Table` can be passed a `actionsMenuAppendTo` prop to adjust where the actions menu is appended.
|
|
218
|
+
|
|
217
219
|
```ts file="LegacyTableActions.tsx"
|
|
218
220
|
```
|
|
219
221
|
|
|
@@ -33,7 +33,7 @@ export const cellActions = (
|
|
|
33
33
|
rowIndex,
|
|
34
34
|
columnIndex,
|
|
35
35
|
column: {
|
|
36
|
-
extraParams: { dropdownPosition, dropdownDirection, actionsToggle }
|
|
36
|
+
extraParams: { dropdownPosition, dropdownDirection, actionsToggle, menuAppendTo }
|
|
37
37
|
},
|
|
38
38
|
property
|
|
39
39
|
}: IExtra
|
|
@@ -60,6 +60,7 @@ export const cellActions = (
|
|
|
60
60
|
items={resolvedActions}
|
|
61
61
|
dropdownPosition={dropdownPosition}
|
|
62
62
|
dropdownDirection={dropdownDirection}
|
|
63
|
+
menuAppendTo={menuAppendTo}
|
|
63
64
|
isDisabled={resolvedIsDisabled}
|
|
64
65
|
rowData={rowData}
|
|
65
66
|
extraData={extraData}
|
|
@@ -33,7 +33,7 @@ export interface TdProps extends BaseCellProps, Omit<React.HTMLProps<HTMLTableDa
|
|
|
33
33
|
dataLabel?: string;
|
|
34
34
|
/** Renders a checkbox or radio select */
|
|
35
35
|
select?: TdSelectType;
|
|
36
|
-
/** Turns the cell into an actions cell */
|
|
36
|
+
/** Turns the cell into an actions cell. Recommended to use an ActionsColumn component as a child of the Td rather than this prop. */
|
|
37
37
|
actions?: TdActionsType;
|
|
38
38
|
/** Turns the cell into an expansion toggle and determines if the corresponding expansion row is open */
|
|
39
39
|
expand?: TdExpandType;
|
|
@@ -154,6 +154,7 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
154
154
|
extraParams: {
|
|
155
155
|
dropdownPosition: actions?.dropdownPosition,
|
|
156
156
|
dropdownDirection: actions?.dropdownDirection,
|
|
157
|
+
menuAppendTo: actions?.menuAppendTo,
|
|
157
158
|
actionsToggle: actions?.actionsToggle
|
|
158
159
|
}
|
|
159
160
|
}
|
|
@@ -16,6 +16,7 @@ propComponents:
|
|
|
16
16
|
'TdSelectType',
|
|
17
17
|
'ThSelectType',
|
|
18
18
|
'TdTreeRowType',
|
|
19
|
+
'ActionsColumn',
|
|
19
20
|
'IActions',
|
|
20
21
|
'TdCompoundExpandType',
|
|
21
22
|
'TdFavoritesType',
|
|
@@ -164,6 +165,8 @@ This example demonstrates adding actions as the last column. The header's last c
|
|
|
164
165
|
|
|
165
166
|
To make a cell an action cell, render an `ActionsColumn` component inside a row's last `Td` and pass an array of `IAction` objects via the `items` prop of `ActionsColumn`.
|
|
166
167
|
|
|
168
|
+
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.
|
|
169
|
+
|
|
167
170
|
```ts file="ComposableTableActions.tsx"
|
|
168
171
|
```
|
|
169
172
|
|