@patternfly/react-table 5.0.0-alpha.47 → 5.0.0-alpha.48
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 +6 -0
- package/dist/esm/components/Table/ActionsColumn.js +1 -1
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/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/TableTypes.d.ts +2 -2
- 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/base/types.d.ts +2 -1
- 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/js/components/Table/ActionsColumn.js +4 -4
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js +6 -6
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +2 -2
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/TableTypes.js +1 -1
- package/dist/js/components/Table/TableTypes.js.map +1 -1
- package/dist/js/components/Table/base/types.d.ts +2 -1
- package/dist/js/components/Table/base/types.d.ts.map +1 -1
- package/dist/js/components/Table/base/types.js +1 -0
- package/dist/js/components/Table/base/types.js.map +1 -1
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +3 -3
- package/src/components/Table/ActionsColumn.tsx +2 -2
- package/src/components/Table/Table.tsx +4 -7
- package/src/components/Table/TableTypes.tsx +2 -5
- package/src/components/Table/base/types.tsx +2 -8
- package/src/components/Table/utils/transformers.test.tsx +3 -3
- package/src/components/TableComposable/examples/ComposableTable.md +30 -3
- package/src/components/TableComposable/examples/ComposableTableActionsOverflow.tsx +5 -4
- package/src/docs/demos/Table.md +24 -17
- package/src/docs/demos/table-demos/SortableResponsive.jsx +21 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.48",
|
|
4
4
|
"description": "This library provides a set of React table components for use with the PatternFly 4",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"subpaths": "node scripts/createSubpaths.js"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@patternfly/react-core": "^5.0.0-alpha.
|
|
42
|
+
"@patternfly/react-core": "^5.0.0-alpha.48",
|
|
43
43
|
"@patternfly/react-icons": "^5.0.0-alpha.6",
|
|
44
44
|
"@patternfly/react-styles": "^5.0.0-alpha.5",
|
|
45
45
|
"@patternfly/react-tokens": "^5.0.0-alpha.5",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"react": "^17 || ^18",
|
|
55
55
|
"react-dom": "^17 || ^18"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "febfd27ce11f0858e9f6f333fb8703c31ae52e3f"
|
|
58
58
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core
|
|
2
|
+
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core';
|
|
3
3
|
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
4
4
|
import { Divider } from '@patternfly/react-core/dist/esm/components/Divider';
|
|
5
5
|
import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
@@ -115,7 +115,7 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
115
115
|
}
|
|
116
116
|
const item = (
|
|
117
117
|
<DropdownItem
|
|
118
|
-
onClick={(event) => {
|
|
118
|
+
onClick={(event: any) => {
|
|
119
119
|
onActionClick(event, onClick);
|
|
120
120
|
onToggle();
|
|
121
121
|
}}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OUIAProps, getDefaultOUIAId } from '@patternfly/react-core';
|
|
3
|
-
import {
|
|
4
|
-
DropdownDirection,
|
|
5
|
-
DropdownPosition
|
|
6
|
-
} from '@patternfly/react-core/dist/esm/components/Dropdown/dropdownConstants';
|
|
3
|
+
import { DropdownDirection, DropdownPosition } from '@patternfly/react-core/dist/esm/deprecated/components';
|
|
7
4
|
import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
8
5
|
import { css } from '@patternfly/react-styles';
|
|
9
6
|
import { Provider } from './base';
|
|
@@ -177,7 +174,7 @@ export class Table extends React.Component<TableProps, {}> {
|
|
|
177
174
|
return false;
|
|
178
175
|
}
|
|
179
176
|
return rows.every(
|
|
180
|
-
row => this.isSelected(row) || row.disableSelection || (row.hasOwnProperty('parent') && !row.showSelect)
|
|
177
|
+
(row) => this.isSelected(row) || row.disableSelection || (row.hasOwnProperty('parent') && !row.showSelect)
|
|
181
178
|
);
|
|
182
179
|
};
|
|
183
180
|
|
|
@@ -185,7 +182,7 @@ export class Table extends React.Component<TableProps, {}> {
|
|
|
185
182
|
if (rows === undefined || rows.length === 0) {
|
|
186
183
|
return false;
|
|
187
184
|
}
|
|
188
|
-
return rows.every(row => row.isOpen === undefined || row.isOpen);
|
|
185
|
+
return rows.every((row) => row.isOpen === undefined || row.isOpen);
|
|
189
186
|
};
|
|
190
187
|
|
|
191
188
|
render() {
|
|
@@ -259,7 +256,7 @@ export class Table extends React.Component<TableProps, {}> {
|
|
|
259
256
|
onFavorite,
|
|
260
257
|
canSortFavorites,
|
|
261
258
|
// order of columns: Collapsible | Selectable | Favoritable
|
|
262
|
-
firstUserColumnIndex: [onCollapse, onSelect, onFavorite].filter(callback => callback).length
|
|
259
|
+
firstUserColumnIndex: [onCollapse, onSelect, onFavorite].filter((callback) => callback).length
|
|
263
260
|
});
|
|
264
261
|
|
|
265
262
|
const table = (
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { DropdownItemProps } from '@patternfly/react-core
|
|
1
|
+
import { DropdownItemProps } from '@patternfly/react-core';
|
|
2
2
|
import { formatterValueType, ColumnType, RowType, RowKeyType, HeaderType } from './base';
|
|
3
3
|
import { SortByDirection } from './SortColumn';
|
|
4
|
-
import {
|
|
5
|
-
DropdownDirection,
|
|
6
|
-
DropdownPosition
|
|
7
|
-
} from '@patternfly/react-core/dist/esm/components/Dropdown/dropdownConstants';
|
|
4
|
+
import { DropdownDirection, DropdownPosition } from '@patternfly/react-core/dist/esm/deprecated/components';
|
|
8
5
|
import * as React from 'react';
|
|
9
6
|
import { CustomActionsToggleProps } from './ActionsColumn';
|
|
10
7
|
import { ButtonProps } from '@patternfly/react-core';
|
|
@@ -6,14 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
PopoverProps,
|
|
12
|
-
DropdownPosition,
|
|
13
|
-
DropdownDirection,
|
|
14
|
-
SelectOptionObject,
|
|
15
|
-
SelectProps
|
|
16
|
-
} from '@patternfly/react-core';
|
|
9
|
+
import { TooltipProps, PopoverProps, SelectOptionObject, SelectProps } from '@patternfly/react-core';
|
|
10
|
+
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core/dist/esm/deprecated/components';
|
|
17
11
|
import { TableComposable } from '../../TableComposable/TableComposable';
|
|
18
12
|
import { Thead } from '../../TableComposable/Thead';
|
|
19
13
|
import { Tbody } from '../../TableComposable/Tbody';
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
textCenter,
|
|
19
19
|
cellActions
|
|
20
20
|
} from './';
|
|
21
|
-
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core';
|
|
21
|
+
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core/deprecated';
|
|
22
22
|
import {
|
|
23
23
|
IAction,
|
|
24
24
|
IActions,
|
|
@@ -210,7 +210,7 @@ describe('Transformer functions', () => {
|
|
|
210
210
|
|
|
211
211
|
describe('cellWidth', () => {
|
|
212
212
|
const widths = [10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100];
|
|
213
|
-
widths.forEach(width =>
|
|
213
|
+
widths.forEach((width) =>
|
|
214
214
|
test(`${width}`, () => {
|
|
215
215
|
expect(cellWidth(width as widthType)()).toEqual({ className: `pf-m-width-${width}` });
|
|
216
216
|
})
|
|
@@ -336,7 +336,7 @@ describe('Transformer functions', () => {
|
|
|
336
336
|
});
|
|
337
337
|
|
|
338
338
|
describe('visibility classNames', () => {
|
|
339
|
-
Object.keys(Visibility).forEach(className => {
|
|
339
|
+
Object.keys(Visibility).forEach((className) => {
|
|
340
340
|
test(`${className} is defined`, () => {
|
|
341
341
|
expect(Visibility[className]).not.toBe(undefined);
|
|
342
342
|
});
|
|
@@ -31,7 +31,7 @@ propComponents:
|
|
|
31
31
|
'ThSortType',
|
|
32
32
|
'ISortBy',
|
|
33
33
|
'InnerScrollContainer',
|
|
34
|
-
'OuterScrollContainer'
|
|
34
|
+
'OuterScrollContainer'
|
|
35
35
|
]
|
|
36
36
|
ouia: true
|
|
37
37
|
---
|
|
@@ -57,8 +57,6 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
57
57
|
|
|
58
58
|
import { css } from '@patternfly/react-styles';
|
|
59
59
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
60
|
-
import { Dropdown as DropdownNext, DropdownList } from '@patternfly/react-core/next';
|
|
61
|
-
|
|
62
60
|
|
|
63
61
|
## TableComposable examples
|
|
64
62
|
|
|
@@ -73,6 +71,7 @@ Some general notes:
|
|
|
73
71
|
### Composable: Basic
|
|
74
72
|
|
|
75
73
|
```ts file="ComposableTableBasic.tsx"
|
|
74
|
+
|
|
76
75
|
```
|
|
77
76
|
|
|
78
77
|
### Composable: Custom row wrapper, header tooltips & popovers
|
|
@@ -84,6 +83,7 @@ Some general notes:
|
|
|
84
83
|
To add a header tooltip or popover to `Th`, pass a `ThInfoType` object via the `info` prop.
|
|
85
84
|
|
|
86
85
|
```ts file="ComposableTableMisc.tsx"
|
|
86
|
+
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
### Composable: Sortable & wrapping headers
|
|
@@ -105,6 +105,7 @@ type OnSort = (
|
|
|
105
105
|
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.
|
|
106
106
|
|
|
107
107
|
```ts file="ComposableTableSortable.tsx"
|
|
108
|
+
|
|
108
109
|
```
|
|
109
110
|
|
|
110
111
|
### Composable: Sortable - custom control
|
|
@@ -112,6 +113,7 @@ The built in display for sorting is not fully responsive, as the column headers
|
|
|
112
113
|
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.
|
|
113
114
|
|
|
114
115
|
```ts file="ComposableTableSortableCustom.tsx"
|
|
116
|
+
|
|
115
117
|
```
|
|
116
118
|
|
|
117
119
|
### Composable: Selectable with checkbox
|
|
@@ -142,6 +144,7 @@ type OnSelect = (
|
|
|
142
144
|
checking checkboxes will check intermediate rows' checkboxes.
|
|
143
145
|
|
|
144
146
|
```ts file="ComposableTableSelectable.tsx"
|
|
147
|
+
|
|
145
148
|
```
|
|
146
149
|
|
|
147
150
|
### Composable: Selectable radio input
|
|
@@ -149,6 +152,7 @@ checking checkboxes will check intermediate rows' checkboxes.
|
|
|
149
152
|
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.
|
|
150
153
|
|
|
151
154
|
```ts file="ComposableTableSelectableRadio.tsx"
|
|
155
|
+
|
|
152
156
|
```
|
|
153
157
|
|
|
154
158
|
### Composable: Row click handler, hoverable & selected rows
|
|
@@ -156,6 +160,7 @@ Similarly to the selectable example above, the radio buttons use the first colum
|
|
|
156
160
|
This selectable rows feature is intended for use when a table is used to present a list of objects in a Primary-detail view.
|
|
157
161
|
|
|
158
162
|
```ts file="ComposableTableHoverable.tsx"
|
|
163
|
+
|
|
159
164
|
```
|
|
160
165
|
|
|
161
166
|
### Composable: Actions
|
|
@@ -167,6 +172,7 @@ To make a cell an action cell, render an `ActionsColumn` component inside a row'
|
|
|
167
172
|
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.
|
|
168
173
|
|
|
169
174
|
```ts file="ComposableTableActions.tsx"
|
|
175
|
+
|
|
170
176
|
```
|
|
171
177
|
|
|
172
178
|
### Composable: Actions Overflow
|
|
@@ -174,6 +180,7 @@ If actions menus are getting clipped by other items on the page, such as sticky
|
|
|
174
180
|
Useing an `OverflowMenu` in the actions column, allowing the actions to condense into a dropdown if necessary for space.
|
|
175
181
|
|
|
176
182
|
```ts file="ComposableTableActionsOverflow.tsx"
|
|
183
|
+
|
|
177
184
|
```
|
|
178
185
|
|
|
179
186
|
### Composable: Expandable
|
|
@@ -199,6 +206,7 @@ type OnCollapse = (
|
|
|
199
206
|
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.
|
|
200
207
|
|
|
201
208
|
```ts file="ComposableTableExpandable.tsx"
|
|
209
|
+
|
|
202
210
|
```
|
|
203
211
|
|
|
204
212
|
### Composable: Compound expandable
|
|
@@ -223,26 +231,31 @@ export type OnExpand = (
|
|
|
223
231
|
```
|
|
224
232
|
|
|
225
233
|
```ts file="ComposableTableCompoundExpandable.tsx"
|
|
234
|
+
|
|
226
235
|
```
|
|
227
236
|
|
|
228
237
|
### Composable: Cell width, breakpoint modifiers
|
|
229
238
|
|
|
230
239
|
```ts file="ComposableTableCellWidth.tsx"
|
|
240
|
+
|
|
231
241
|
```
|
|
232
242
|
|
|
233
243
|
### Composable: Controlling text
|
|
234
244
|
|
|
235
245
|
```ts file="ComposableTableControllingText.tsx"
|
|
246
|
+
|
|
236
247
|
```
|
|
237
248
|
|
|
238
249
|
### Composable: Modifiers with table text
|
|
239
250
|
|
|
240
251
|
```ts file="ComposableTableTextModifiers.tsx"
|
|
252
|
+
|
|
241
253
|
```
|
|
242
254
|
|
|
243
255
|
### Composable: Empty state
|
|
244
256
|
|
|
245
257
|
```ts file="ComposableTableEmptyState.tsx"
|
|
258
|
+
|
|
246
259
|
```
|
|
247
260
|
|
|
248
261
|
### Composable: Favoritable (implemented with sortable)
|
|
@@ -265,6 +278,7 @@ type OnFavorite = (
|
|
|
265
278
|
To make a favoritable column sortable, pass a `ThSortType` object to the favoritable column's `Th` with `isFavorites` set to true.
|
|
266
279
|
|
|
267
280
|
```ts file="ComposableTableFavoritable.tsx"
|
|
281
|
+
|
|
268
282
|
```
|
|
269
283
|
|
|
270
284
|
### Composable: Tree table
|
|
@@ -298,6 +312,7 @@ aria-posinset, and aria-setsize as violations. This is an intentional choice at
|
|
|
298
312
|
the voice over technologies will recognize the flat table structure as a tree.
|
|
299
313
|
|
|
300
314
|
```ts file="ComposableTableTree.tsx"
|
|
315
|
+
|
|
301
316
|
```
|
|
302
317
|
|
|
303
318
|
### Composable: Draggable row table
|
|
@@ -311,6 +326,7 @@ To make a row draggable:
|
|
|
311
326
|
5. The draggable `Td` in each row needs a `TdDraggableType` object passed to its `draggable` prop.
|
|
312
327
|
|
|
313
328
|
```ts isBeta file="ComposableTableDraggable.tsx"
|
|
329
|
+
|
|
314
330
|
```
|
|
315
331
|
|
|
316
332
|
## Sticky table modifiers
|
|
@@ -330,6 +346,7 @@ There are a few ways this can be handled:
|
|
|
330
346
|
To make a column sticky, wrap `TableComposable` with `InnerScrollContainer` and add the following properties to the `Th` or `Td` that should be sticky: `isStickyColumn` and `hasRightBorder`. 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.
|
|
331
347
|
|
|
332
348
|
```ts file="ComposableTableStickyColumn.tsx"
|
|
349
|
+
|
|
333
350
|
```
|
|
334
351
|
|
|
335
352
|
### Composable: Multiple sticky columns
|
|
@@ -337,6 +354,7 @@ To make a column sticky, wrap `TableComposable` with `InnerScrollContainer` and
|
|
|
337
354
|
To make multiple columns sticky, wrap `TableComposable` with `InnerScrollContainer` and add `isStickyColumn` to all columns that should be sticky. The rightmost column should also have the `hasRightBorder` property, and each sticky column after the first must define a `stickyLeftOffset` property that equals the combined width of the previous sticky columns - set by `stickyMinWidth`. To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property.
|
|
338
355
|
|
|
339
356
|
```ts file="ComposableTableMultipleStickyColumns.tsx"
|
|
357
|
+
|
|
340
358
|
```
|
|
341
359
|
|
|
342
360
|
### Composable: Sticky columns and header
|
|
@@ -344,6 +362,7 @@ To make multiple columns sticky, wrap `TableComposable` with `InnerScrollContain
|
|
|
344
362
|
To maintain proper sticky behavior across sticky columns and header, `TableComposable` must be wrapped with `OuterScrollContainer` and `InnerScrollContainer`.
|
|
345
363
|
|
|
346
364
|
```ts file="ComposableTableStickyColumnsAndHeader.tsx"
|
|
365
|
+
|
|
347
366
|
```
|
|
348
367
|
|
|
349
368
|
## Nested column headers
|
|
@@ -362,21 +381,25 @@ The second `Tr` represents the second level of sub columns. The `Th` in this row
|
|
|
362
381
|
### Composable: Nested column headers
|
|
363
382
|
|
|
364
383
|
```ts file="ComposableTableNestedHeaders.tsx"
|
|
384
|
+
|
|
365
385
|
```
|
|
366
386
|
|
|
367
387
|
### Composable: Nested column headers and expandable rows
|
|
368
388
|
|
|
369
389
|
```ts file="ComposableTableNestedExpandable.tsx"
|
|
390
|
+
|
|
370
391
|
```
|
|
371
392
|
|
|
372
393
|
### Composable: Expandable with nested table
|
|
373
394
|
|
|
374
395
|
```ts file="ComposableTableNestedTableExpandable.tsx"
|
|
396
|
+
|
|
375
397
|
```
|
|
376
398
|
|
|
377
399
|
### Composable: Nested sticky header
|
|
378
400
|
|
|
379
401
|
```ts file="ComposableTableNestedStickyHeader.tsx"
|
|
402
|
+
|
|
380
403
|
```
|
|
381
404
|
|
|
382
405
|
## Striped
|
|
@@ -386,6 +409,7 @@ The second `Tr` represents the second level of sub columns. The `Th` in this row
|
|
|
386
409
|
To apply striping to a basic table, add the `isStriped` property to `TableComposable`.
|
|
387
410
|
|
|
388
411
|
```ts file="ComposableTableStriped.tsx"
|
|
412
|
+
|
|
389
413
|
```
|
|
390
414
|
|
|
391
415
|
### Composable: Striped expandable
|
|
@@ -393,6 +417,7 @@ To apply striping to a basic table, add the `isStriped` property to `TableCompos
|
|
|
393
417
|
To apply striping to an expandable table, add the `isStriped` and `isExpandable` properties to `TableComposable`.
|
|
394
418
|
|
|
395
419
|
```ts file="ComposableTableStripedExpandable.tsx"
|
|
420
|
+
|
|
396
421
|
```
|
|
397
422
|
|
|
398
423
|
### Composable: Striped multiple tobdy
|
|
@@ -400,6 +425,7 @@ To apply striping to an expandable table, add the `isStriped` and `isExpandable`
|
|
|
400
425
|
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.
|
|
401
426
|
|
|
402
427
|
```ts file="ComposableTableStripedMultipleTbody.tsx"
|
|
428
|
+
|
|
403
429
|
```
|
|
404
430
|
|
|
405
431
|
### Composable: Striped tr
|
|
@@ -407,4 +433,5 @@ When there are multiple `Tbody` components within a table, a more granular appli
|
|
|
407
433
|
To manually control striping, add the `isStriped` property to each desired `Tr`. This replaces adding the `isStriped` property to `TableComposable`.
|
|
408
434
|
|
|
409
435
|
```ts file="ComposableTableStripedTr.tsx"
|
|
436
|
+
|
|
410
437
|
```
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
OverflowMenuGroup,
|
|
9
9
|
OverflowMenuItem,
|
|
10
10
|
OverflowMenuDropdownItem,
|
|
11
|
-
MenuToggle
|
|
11
|
+
MenuToggle,
|
|
12
|
+
Dropdown,
|
|
13
|
+
DropdownList
|
|
12
14
|
} from '@patternfly/react-core';
|
|
13
15
|
import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
14
|
-
import { Dropdown as DropdownNext, DropdownList } from '@patternfly/react-core/next';
|
|
15
16
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
16
17
|
|
|
17
18
|
interface Repository {
|
|
@@ -92,7 +93,7 @@ export const ComposableTableActions: React.FunctionComponent = () => {
|
|
|
92
93
|
</OverflowMenuGroup>
|
|
93
94
|
</OverflowMenuContent>
|
|
94
95
|
<OverflowMenuControl>
|
|
95
|
-
<
|
|
96
|
+
<Dropdown
|
|
96
97
|
onSelect={() =>
|
|
97
98
|
setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
|
|
98
99
|
}
|
|
@@ -115,7 +116,7 @@ export const ComposableTableActions: React.FunctionComponent = () => {
|
|
|
115
116
|
}
|
|
116
117
|
>
|
|
117
118
|
<DropdownList>{dropdownItems}</DropdownList>
|
|
118
|
-
</
|
|
119
|
+
</Dropdown>
|
|
119
120
|
</OverflowMenuControl>
|
|
120
121
|
</OverflowMenu>
|
|
121
122
|
</Td>
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -24,6 +24,14 @@ PageSectionVariants,
|
|
|
24
24
|
TextContent,
|
|
25
25
|
Text,
|
|
26
26
|
Divider } from '@patternfly/react-core';
|
|
27
|
+
import {
|
|
28
|
+
Dropdown as DropdownDeprecated,
|
|
29
|
+
DropdownItem as DropdownItemDeprecated,
|
|
30
|
+
DropdownPosition,
|
|
31
|
+
DropdownToggle,
|
|
32
|
+
DropdownToggleCheckbox,
|
|
33
|
+
KebabToggle
|
|
34
|
+
} from '@patternfly/react-core/deprecated';
|
|
27
35
|
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
28
36
|
import CloneIcon from '@patternfly/react-icons/dist/esm/icons/clone-icon';
|
|
29
37
|
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
@@ -47,6 +55,7 @@ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
|
47
55
|
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
48
56
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
49
57
|
import BlueprintIcon from '@patternfly/react-icons/dist/esm/icons/blueprint-icon';
|
|
58
|
+
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
50
59
|
import { rows, columns } from '../examples/Data.jsx';
|
|
51
60
|
|
|
52
61
|
## Demos
|
|
@@ -56,11 +65,6 @@ import { rows, columns } from '../examples/Data.jsx';
|
|
|
56
65
|
```js isFullscreen
|
|
57
66
|
import React from 'react';
|
|
58
67
|
import {
|
|
59
|
-
Dropdown,
|
|
60
|
-
DropdownItem,
|
|
61
|
-
DropdownPosition,
|
|
62
|
-
DropdownToggle,
|
|
63
|
-
DropdownToggleCheckbox,
|
|
64
68
|
PageSection,
|
|
65
69
|
Pagination,
|
|
66
70
|
Title,
|
|
@@ -69,6 +73,13 @@ import {
|
|
|
69
73
|
ToolbarGroup,
|
|
70
74
|
ToolbarItem
|
|
71
75
|
} from '@patternfly/react-core';
|
|
76
|
+
import {
|
|
77
|
+
Dropdown as DropdownDeprecated,
|
|
78
|
+
DropdownItem as DropdownItemDeprecated,
|
|
79
|
+
DropdownPosition,
|
|
80
|
+
DropdownToggle,
|
|
81
|
+
DropdownToggleCheckbox
|
|
82
|
+
} from '@patternfly/react-core/deprecated';
|
|
72
83
|
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
|
|
73
84
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
74
85
|
|
|
@@ -207,19 +218,19 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
207
218
|
const isChecked = allSelected ? true : someChecked;
|
|
208
219
|
|
|
209
220
|
const items = [
|
|
210
|
-
<
|
|
221
|
+
<DropdownItemDeprecated key="item-1" onClick={() => this.handleSelectClick('none')}>
|
|
211
222
|
Select none (0 items)
|
|
212
|
-
</
|
|
213
|
-
<
|
|
223
|
+
</DropdownItemDeprecated>,
|
|
224
|
+
<DropdownItemDeprecated key="item-2" onClick={() => this.handleSelectClick('page')}>
|
|
214
225
|
Select page ({this.state.perPage} items)
|
|
215
|
-
</
|
|
216
|
-
<
|
|
226
|
+
</DropdownItemDeprecated>,
|
|
227
|
+
<DropdownItemDeprecated key="item-3" onClick={() => this.handleSelectClick('all')}>
|
|
217
228
|
Select all (100 items)
|
|
218
|
-
</
|
|
229
|
+
</DropdownItemDeprecated>
|
|
219
230
|
];
|
|
220
231
|
|
|
221
232
|
return (
|
|
222
|
-
<
|
|
233
|
+
<DropdownDeprecated
|
|
223
234
|
onSelect={this.onDropDownSelect}
|
|
224
235
|
position={DropdownPosition.left}
|
|
225
236
|
toggle={
|
|
@@ -1757,11 +1768,7 @@ class LoadingStateDemo extends React.Component {
|
|
|
1757
1768
|
title: (
|
|
1758
1769
|
<Bullseye>
|
|
1759
1770
|
<EmptyState>
|
|
1760
|
-
<EmptyStateHeader
|
|
1761
|
-
titleText="Loading"
|
|
1762
|
-
headingLevel="h2"
|
|
1763
|
-
icon={<EmptyStateIcon icon={Spinner} />}
|
|
1764
|
-
/>
|
|
1771
|
+
<EmptyStateHeader titleText="Loading" headingLevel="h2" icon={<EmptyStateIcon icon={Spinner} />} />
|
|
1765
1772
|
</EmptyState>
|
|
1766
1773
|
</Bullseye>
|
|
1767
1774
|
)
|
|
@@ -2,8 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
4
|
Card,
|
|
5
|
+
Dropdown,
|
|
6
|
+
DropdownList,
|
|
5
7
|
Flex,
|
|
6
8
|
FlexItem,
|
|
9
|
+
MenuToggle,
|
|
7
10
|
Toolbar,
|
|
8
11
|
ToolbarContent,
|
|
9
12
|
ToolbarGroup,
|
|
@@ -11,8 +14,6 @@ import {
|
|
|
11
14
|
Pagination,
|
|
12
15
|
Text,
|
|
13
16
|
TextContent,
|
|
14
|
-
Dropdown,
|
|
15
|
-
KebabToggle,
|
|
16
17
|
OverflowMenu,
|
|
17
18
|
OverflowMenuContent,
|
|
18
19
|
OverflowMenuControl,
|
|
@@ -30,6 +31,7 @@ import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
|
30
31
|
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
31
32
|
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
32
33
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
34
|
+
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
33
35
|
|
|
34
36
|
export const ComposableTableSortable = () => {
|
|
35
37
|
const [isKebabDropdownOpen, setIsKebabDropdownOpen] = React.useState(false);
|
|
@@ -86,7 +88,7 @@ export const ComposableTableSortable = () => {
|
|
|
86
88
|
setPerPage(newPerPage);
|
|
87
89
|
};
|
|
88
90
|
|
|
89
|
-
renderPagination = variant => (
|
|
91
|
+
renderPagination = (variant) => (
|
|
90
92
|
<Pagination
|
|
91
93
|
isCompact
|
|
92
94
|
itemCount={rows.length}
|
|
@@ -107,7 +109,7 @@ export const ComposableTableSortable = () => {
|
|
|
107
109
|
/>
|
|
108
110
|
);
|
|
109
111
|
|
|
110
|
-
const renderLabel = labelText => {
|
|
112
|
+
const renderLabel = (labelText) => {
|
|
111
113
|
switch (labelText) {
|
|
112
114
|
case 'Running':
|
|
113
115
|
return <Label color="green">{labelText}</Label>;
|
|
@@ -187,14 +189,23 @@ export const ComposableTableSortable = () => {
|
|
|
187
189
|
</OverflowMenuContent>
|
|
188
190
|
<OverflowMenuControl hasAdditionalOptions>
|
|
189
191
|
<Dropdown
|
|
190
|
-
isPlain
|
|
191
192
|
onSelect={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)}
|
|
192
|
-
|
|
193
|
+
onOpenChange={(isKebabDropdownOpen) => setIsKebabDropdownOpen(isKebabDropdownOpen)}
|
|
194
|
+
toggle={(toggleRef) => (
|
|
195
|
+
<MenuToggle
|
|
196
|
+
ref={toggleRef}
|
|
197
|
+
aria-label="overflow menu"
|
|
198
|
+
variant="plain"
|
|
199
|
+
onClick={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)}
|
|
200
|
+
isExpanded={false}
|
|
201
|
+
>
|
|
202
|
+
<EllipsisVIcon />
|
|
203
|
+
</MenuToggle>
|
|
204
|
+
)}
|
|
193
205
|
isOpen={isKebabDropdownOpen}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
/>
|
|
206
|
+
>
|
|
207
|
+
<DropdownList>{kebabDropdownItems}</DropdownList>
|
|
208
|
+
</Dropdown>
|
|
198
209
|
</OverflowMenuControl>
|
|
199
210
|
</OverflowMenu>
|
|
200
211
|
<ToolbarGroup variant="icon-button-group">
|