@patternfly/react-table 4.61.11 → 4.61.15
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 +38 -0
- package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/ActionsColumn.js +5 -4
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +11 -36
- package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +5 -4
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +11 -36
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/umd/react-table.css +142 -142
- package/dist/umd/react-table.js +5 -4
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +6 -6
- package/src/components/Table/ActionsColumn.tsx +23 -34
- package/src/components/Table/TableTypes.tsx +11 -43
- package/src/components/TableComposable/examples/ComposableTable.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.61.
|
|
3
|
+
"version": "4.61.15",
|
|
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",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"clean": "rimraf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@patternfly/react-core": "^4.192.
|
|
35
|
-
"@patternfly/react-icons": "^4.43.
|
|
36
|
-
"@patternfly/react-styles": "^4.42.
|
|
37
|
-
"@patternfly/react-tokens": "^4.44.
|
|
34
|
+
"@patternfly/react-core": "^4.192.15",
|
|
35
|
+
"@patternfly/react-icons": "^4.43.15",
|
|
36
|
+
"@patternfly/react-styles": "^4.42.15",
|
|
37
|
+
"@patternfly/react-tokens": "^4.44.15",
|
|
38
38
|
"lodash": "^4.17.19",
|
|
39
39
|
"tslib": "^2.0.0"
|
|
40
40
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react": "^16.8.0 || ^17.0.0",
|
|
47
47
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "43f728710c72197a3f6a093ec406de40cf12ce30"
|
|
50
50
|
}
|
|
@@ -10,14 +10,7 @@ import {
|
|
|
10
10
|
DropdownPosition
|
|
11
11
|
} from '@patternfly/react-core/dist/esm/components/Dropdown/dropdownConstants';
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
IAction,
|
|
15
|
-
IActionDropdownItem,
|
|
16
|
-
IActionOutsideItemButton,
|
|
17
|
-
IActionOutsideItemCustom,
|
|
18
|
-
IExtraData,
|
|
19
|
-
IRowData
|
|
20
|
-
} from './TableTypes';
|
|
13
|
+
import { IAction, IExtraData, IRowData } from './TableTypes';
|
|
21
14
|
|
|
22
15
|
export interface CustomActionsToggleProps {
|
|
23
16
|
onToggle: (isOpen: boolean) => void;
|
|
@@ -89,16 +82,10 @@ export class ActionsColumn extends React.Component<ActionsColumnProps, ActionsCo
|
|
|
89
82
|
<KebabToggle isDisabled={isDisabled} onToggle={this.onToggle} />
|
|
90
83
|
);
|
|
91
84
|
|
|
92
|
-
const outsideDropdownItems = items.filter(a => a.isOutsideDropdown) as (
|
|
93
|
-
| IActionOutsideItemButton
|
|
94
|
-
| IActionOutsideItemCustom
|
|
95
|
-
)[];
|
|
96
|
-
|
|
97
|
-
const dropdownItems = items.filter(a => !a.isOutsideDropdown) as IActionDropdownItem[];
|
|
98
|
-
|
|
99
85
|
return (
|
|
100
86
|
<React.Fragment>
|
|
101
|
-
{
|
|
87
|
+
{items
|
|
88
|
+
.filter(item => item.isOutsideDropdown)
|
|
102
89
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
90
|
.map(({ title, itemKey, onClick, isOutsideDropdown, ...props }, key) =>
|
|
104
91
|
typeof title === 'string' ? (
|
|
@@ -120,24 +107,26 @@ export class ActionsColumn extends React.Component<ActionsColumnProps, ActionsCo
|
|
|
120
107
|
position={dropdownPosition}
|
|
121
108
|
direction={dropdownDirection}
|
|
122
109
|
isOpen={isOpen}
|
|
123
|
-
dropdownItems={
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
110
|
+
dropdownItems={items
|
|
111
|
+
.filter(item => !item.isOutsideDropdown)
|
|
112
|
+
.map(({ title, itemKey, onClick, isSeparator, ...props }, key) =>
|
|
113
|
+
isSeparator ? (
|
|
114
|
+
<DropdownSeparator {...props} key={itemKey || key} data-key={itemKey || key} />
|
|
115
|
+
) : (
|
|
116
|
+
<DropdownItem
|
|
117
|
+
component="button"
|
|
118
|
+
onClick={event => {
|
|
119
|
+
this.onClick(event, onClick);
|
|
120
|
+
this.onToggle(!isOpen);
|
|
121
|
+
}}
|
|
122
|
+
{...props}
|
|
123
|
+
key={itemKey || key}
|
|
124
|
+
data-key={itemKey || key}
|
|
125
|
+
>
|
|
126
|
+
{title}
|
|
127
|
+
</DropdownItem>
|
|
128
|
+
)
|
|
129
|
+
)}
|
|
141
130
|
isPlain
|
|
142
131
|
{...(rowData && rowData.actionProps)}
|
|
143
132
|
/>
|
|
@@ -146,54 +146,22 @@ export interface ISortBy {
|
|
|
146
146
|
defaultDirection?: 'asc' | 'desc';
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export interface
|
|
149
|
+
export interface IAction extends Omit<DropdownItemProps, 'title' | 'onClick'>, Pick<ButtonProps, 'variant'> {
|
|
150
150
|
/** Flag indicating an item on actions menu is a separator, rather than an action */
|
|
151
|
-
isSeparator
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
interface IActionClickable {
|
|
151
|
+
isSeparator?: boolean;
|
|
152
|
+
/** Key of actions menu item */
|
|
153
|
+
itemKey?: string;
|
|
154
|
+
/** Content to display in the actions menu item */
|
|
155
|
+
title?: string | React.ReactNode;
|
|
159
156
|
/** Click handler for the actions menu item */
|
|
160
157
|
onClick?: (event: React.MouseEvent, rowIndex: number, rowData: IRowData, extraData: IExtraData) => void;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export type IActionOutsideItemBase = IActionClickable & {
|
|
164
158
|
/** Flag indicating this action should be placed outside the actions menu, beside the toggle */
|
|
165
|
-
isOutsideDropdown
|
|
166
|
-
|
|
167
|
-
isSeparator?: false;
|
|
168
|
-
/** Key of actions menu item */
|
|
169
|
-
itemKey?: undefined;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export type IActionOutsideItemButton = IActionOutsideItemBase &
|
|
173
|
-
Omit<ButtonProps, 'onClick'> & {
|
|
174
|
-
title: string;
|
|
175
|
-
/** Key of actions menu item */
|
|
176
|
-
itemKey?: string;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export type IActionOutsideItemCustom = IActionOutsideItemBase & {
|
|
180
|
-
title: Exclude<React.ReactNode, string>;
|
|
181
|
-
[key: string]: any;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export type IActionDropdownItem = Omit<DropdownItemProps, 'title' | 'onClick'> &
|
|
185
|
-
IActionClickable & {
|
|
186
|
-
/** Flag indicating an item on actions menu is not a separator, added to make it easy to distinguish */
|
|
187
|
-
isSeparator?: false;
|
|
188
|
-
/** Flag indicating this action should be placed outside the actions menu, beside the toggle */
|
|
189
|
-
isOutsideDropdown?: false;
|
|
190
|
-
/** Key of actions menu item */
|
|
191
|
-
itemKey?: string;
|
|
192
|
-
/** Content to display in the actions menu item */
|
|
193
|
-
title: React.ReactNode;
|
|
194
|
-
};
|
|
159
|
+
isOutsideDropdown?: boolean;
|
|
160
|
+
}
|
|
195
161
|
|
|
196
|
-
export
|
|
162
|
+
export interface ISeparator extends IAction {
|
|
163
|
+
isSeparator: boolean;
|
|
164
|
+
}
|
|
197
165
|
|
|
198
166
|
export type IActions = (IAction | ISeparator)[];
|
|
199
167
|
export type IActionsResolver = (rowData: IRowData, extraData: IExtraData) => (IAction | ISeparator)[];
|
|
@@ -163,9 +163,6 @@ This example demonstrates adding actions as the last column. The header's last c
|
|
|
163
163
|
|
|
164
164
|
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`.
|
|
165
165
|
|
|
166
|
-
Look [here](https://github.com/patternfly/patternfly-react/blob/main/packages/react-table/src/components/Table/TableTypes.tsx)
|
|
167
|
-
for the `IAction` type to see what it looks like.
|
|
168
|
-
|
|
169
166
|
```ts file="ComposableTableActions.tsx"
|
|
170
167
|
```
|
|
171
168
|
|