@patternfly/react-table 5.0.0-alpha.99 → 5.0.0-prerelease.10
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 +210 -7991
- package/README.md +48 -87
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/Table/package.json +1 -0
- package/dist/dynamic/components/Table/utils/decorators/package.json +1 -0
- package/dist/dynamic/components/Table/utils/package.json +1 -0
- package/dist/dynamic/deprecated/components/Table/base/package.json +1 -0
- package/dist/dynamic/deprecated/components/Table/package.json +1 -0
- package/dist/dynamic/deprecated/components/package.json +1 -0
- package/dist/esm/components/Table/ActionsColumn.d.ts +4 -2
- package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/ActionsColumn.js +6 -6
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/Caption.d.ts.map +1 -1
- package/dist/esm/components/Table/Caption.js +3 -1
- package/dist/esm/components/Table/Caption.js.map +1 -1
- package/dist/esm/components/Table/Table.js +1 -1
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/Tbody.d.ts.map +1 -1
- package/dist/esm/components/Table/Tbody.js +1 -1
- package/dist/esm/components/Table/Tbody.js.map +1 -1
- package/dist/esm/components/Table/Td.d.ts +1 -1
- package/dist/esm/components/Table/Td.d.ts.map +1 -1
- package/dist/esm/components/Table/Td.js +1 -1
- package/dist/esm/components/Table/Td.js.map +1 -1
- package/dist/esm/components/Table/Th.d.ts.map +1 -1
- package/dist/esm/components/Table/Th.js +1 -1
- package/dist/esm/components/Table/Th.js.map +1 -1
- package/dist/esm/components/Table/Thead.d.ts.map +1 -1
- package/dist/esm/components/Table/Thead.js +1 -1
- package/dist/esm/components/Table/Thead.js.map +1 -1
- package/dist/esm/components/Table/Tr.js +1 -2
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/js/components/Table/ActionsColumn.d.ts +4 -2
- package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +6 -6
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/Caption.d.ts.map +1 -1
- package/dist/js/components/Table/Caption.js +3 -1
- package/dist/js/components/Table/Caption.js.map +1 -1
- package/dist/js/components/Table/Table.js +1 -1
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/Tbody.d.ts.map +1 -1
- package/dist/js/components/Table/Tbody.js +1 -1
- package/dist/js/components/Table/Tbody.js.map +1 -1
- package/dist/js/components/Table/Td.d.ts +1 -1
- package/dist/js/components/Table/Td.d.ts.map +1 -1
- package/dist/js/components/Table/Td.js +1 -1
- package/dist/js/components/Table/Td.js.map +1 -1
- package/dist/js/components/Table/Th.d.ts.map +1 -1
- package/dist/js/components/Table/Th.js +1 -1
- package/dist/js/components/Table/Th.js.map +1 -1
- package/dist/js/components/Table/Thead.d.ts.map +1 -1
- package/dist/js/components/Table/Thead.js +1 -1
- package/dist/js/components/Table/Thead.js.map +1 -1
- package/dist/js/components/Table/Tr.js +1 -2
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/umd/react-table.min.js +5 -5
- package/package.json +8 -8
- package/single-packages.config.json +0 -14
- package/src/components/Table/ActionsColumn.tsx +12 -6
- package/src/components/Table/Caption.tsx +3 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Table/Tbody.tsx +1 -0
- package/src/components/Table/Td.tsx +2 -1
- package/src/components/Table/Th.tsx +1 -0
- package/src/components/Table/Thead.tsx +1 -0
- package/src/components/Table/Tr.tsx +1 -1
- package/src/components/Table/__tests__/__snapshots__/RowWrapper.test.tsx.snap +4 -4
- package/src/components/Table/examples/TableSortableCustom.tsx +10 -21
- package/src/components/Table/utils/transformers.test.tsx +1 -1
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +1896 -1780
- package/src/deprecated/components/Table/examples/LegacyTableSortableCustom.tsx +12 -29
- package/src/deprecated/components/Table/examples/Table.md +1 -0
- package/src/docs/demos/Table.md +32 -344
- package/src/docs/demos/table-demos/BulkSelect.jsx +167 -0
- package/src/docs/demos/table-demos/ColumnManagement.jsx +10 -4
- package/src/docs/demos/table-demos/Compact.jsx +19 -14
- package/src/docs/demos/table-demos/CompoundExpansion.jsx +4 -4
- package/src/docs/demos/table-demos/ExpandCollapseAll.jsx +88 -106
- package/src/docs/demos/table-demos/SortableResponsive.jsx +11 -21
- package/src/docs/demos/table-demos/StaticBottomPagination.jsx +18 -13
- package/src/docs/demos/table-demos/StickyHeader.jsx +63 -0
- package/src/docs/{examples/Data.jsx → demos/table-demos/sampleData.js} +6 -8
- package/subpaths.config.json +4 -0
- package/components/index.d.ts +0 -2
- package/components/index.d.ts.map +0 -1
- package/components/index.js +0 -2
- package/components/index.js.map +0 -1
- package/deprecated/index.d.ts +0 -2
- package/deprecated/index.d.ts.map +0 -1
- package/deprecated/index.js +0 -2
- package/deprecated/index.js.map +0 -1
- package/dist/js/components/Table/package.json +0 -1
- package/dist/js/components/Table/utils/decorators/package.json +0 -1
- package/dist/js/components/Table/utils/package.json +0 -1
- package/dist/js/components/package.json +0 -1
- package/dist/js/deprecated/components/Table/base/package.json +0 -1
- package/dist/js/deprecated/components/Table/package.json +0 -1
- package/dist/js/deprecated/components/package.json +0 -1
- package/dist/js/deprecated/package.json +0 -1
- package/dist/js/package.json +0 -1
- package/scripts/createSubpaths.js +0 -32
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { sortable, info } from '@patternfly/react-table';
|
|
3
3
|
import { Table, TableHeader, TableBody, TableProps } from '@patternfly/react-table/deprecated';
|
|
4
|
-
import {
|
|
5
|
-
Toolbar,
|
|
6
|
-
ToolbarContent,
|
|
7
|
-
ToolbarItem,
|
|
8
|
-
MenuToggle,
|
|
9
|
-
MenuToggleElement
|
|
10
|
-
} from '@patternfly/react-core';
|
|
4
|
+
import { Toolbar, ToolbarContent, ToolbarItem, MenuToggle, MenuToggleElement } from '@patternfly/react-core';
|
|
11
5
|
import {
|
|
12
6
|
Select as NewSelect,
|
|
13
7
|
SelectGroup as NewSelectGroup,
|
|
@@ -111,7 +105,7 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
111
105
|
]
|
|
112
106
|
}
|
|
113
107
|
];
|
|
114
|
-
const rows: TableProps['rows'] = sortedRepositories.map(repo => [
|
|
108
|
+
const rows: TableProps['rows'] = sortedRepositories.map((repo) => [
|
|
115
109
|
repo.name,
|
|
116
110
|
repo.branches,
|
|
117
111
|
repo.prs,
|
|
@@ -127,13 +121,14 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
127
121
|
<NewSelect
|
|
128
122
|
isOpen={isSortDropdownOpen}
|
|
129
123
|
selected={[activeSortDirection, activeSortIndex]}
|
|
130
|
-
onOpenChange={isOpen => setIsSortDropdownOpen(isOpen)}
|
|
131
|
-
onSelect={(event,
|
|
132
|
-
if (
|
|
133
|
-
setActiveSortDirection(
|
|
124
|
+
onOpenChange={(isOpen) => setIsSortDropdownOpen(isOpen)}
|
|
125
|
+
onSelect={(event, value) => {
|
|
126
|
+
if (value === 'asc' || value === 'desc') {
|
|
127
|
+
setActiveSortDirection(value as 'desc' | 'asc');
|
|
134
128
|
} else {
|
|
135
|
-
setActiveSortIndex(
|
|
136
|
-
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
129
|
+
setActiveSortIndex(value as number);
|
|
130
|
+
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
131
|
+
}
|
|
137
132
|
}}
|
|
138
133
|
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
139
134
|
<MenuToggle
|
|
@@ -150,11 +145,7 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
150
145
|
<NewSelectGroup label="Sort column">
|
|
151
146
|
<NewSelectList>
|
|
152
147
|
{Object.values(columnNames).map((column, columnIndex) => (
|
|
153
|
-
<NewSelectOption
|
|
154
|
-
key={column}
|
|
155
|
-
itemId={columnIndex}
|
|
156
|
-
isSelected={activeSortIndex === columnIndex}
|
|
157
|
-
>
|
|
148
|
+
<NewSelectOption key={column} value={columnIndex} isSelected={activeSortIndex === columnIndex}>
|
|
158
149
|
{column}
|
|
159
150
|
</NewSelectOption>
|
|
160
151
|
))}
|
|
@@ -162,18 +153,10 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
162
153
|
</NewSelectGroup>
|
|
163
154
|
<NewSelectGroup label="Sort direction">
|
|
164
155
|
<NewSelectList>
|
|
165
|
-
<NewSelectOption
|
|
166
|
-
isSelected={activeSortDirection === 'asc'}
|
|
167
|
-
itemId="asc"
|
|
168
|
-
key="ascending"
|
|
169
|
-
>
|
|
156
|
+
<NewSelectOption isSelected={activeSortDirection === 'asc'} value="asc" key="ascending">
|
|
170
157
|
Ascending
|
|
171
158
|
</NewSelectOption>
|
|
172
|
-
<NewSelectOption
|
|
173
|
-
isSelected={activeSortDirection === 'desc'}
|
|
174
|
-
itemId="desc"
|
|
175
|
-
key="descending"
|
|
176
|
-
>
|
|
159
|
+
<NewSelectOption isSelected={activeSortDirection === 'desc'} value="desc" key="descending">
|
|
177
160
|
Descending
|
|
178
161
|
</NewSelectOption>
|
|
179
162
|
</NewSelectList>
|
|
@@ -4,6 +4,7 @@ cssPrefix: pf-c-table
|
|
|
4
4
|
section: components
|
|
5
5
|
propComponents: ['Table', 'TableHeader', 'TableBody', 'ISortBy']
|
|
6
6
|
ouia: true
|
|
7
|
+
deprecated: true
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
Note: Table lives in its own package at [@patternfly/react-table](https://www.npmjs.com/package/@patternfly/react-table)!
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -50,264 +50,14 @@ import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-
|
|
|
50
50
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
51
51
|
import BlueprintIcon from '@patternfly/react-icons/dist/esm/icons/blueprint-icon';
|
|
52
52
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
53
|
-
import { rows, columns } from '
|
|
53
|
+
import { rows, columns } from './table-demos/sampleData';
|
|
54
54
|
|
|
55
55
|
## Demos
|
|
56
56
|
|
|
57
57
|
### Bulk select
|
|
58
58
|
|
|
59
|
-
```js isFullscreen
|
|
60
|
-
import React from 'react';
|
|
61
|
-
import {
|
|
62
|
-
Dropdown,
|
|
63
|
-
DropdownItem,
|
|
64
|
-
DropdownList,
|
|
65
|
-
MenuToggle,
|
|
66
|
-
MenuToggleCheckbox,
|
|
67
|
-
PageSection,
|
|
68
|
-
Pagination,
|
|
69
|
-
Title,
|
|
70
|
-
Toolbar,
|
|
71
|
-
ToolbarContent,
|
|
72
|
-
ToolbarGroup,
|
|
73
|
-
ToolbarItem
|
|
74
|
-
} from '@patternfly/react-core';
|
|
75
|
-
import { Table as TableDeprecated, TableHeader, TableBody } from '@patternfly/react-table/deprecated';
|
|
76
|
-
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
77
|
-
|
|
78
|
-
class BulkSelectTableDemo extends React.Component {
|
|
79
|
-
constructor(props) {
|
|
80
|
-
super(props);
|
|
81
|
-
this.state = {
|
|
82
|
-
res: [],
|
|
83
|
-
perPage: 20,
|
|
84
|
-
page: 1,
|
|
85
|
-
error: null,
|
|
86
|
-
loading: true,
|
|
87
|
-
selectedItems: [],
|
|
88
|
-
numSelected: 0,
|
|
89
|
-
isDropDownOpen: false,
|
|
90
|
-
isKebabOpen: false,
|
|
91
|
-
searchValue: ''
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
this.onSelect = (event, isSelected, rowId) => {
|
|
95
|
-
const { selectedItems } = this.state;
|
|
96
|
-
const rows = [...this.state.res];
|
|
97
|
-
const id = rows[rowId].id;
|
|
98
|
-
rows[rowId].selected = isSelected;
|
|
99
|
-
this.setState((prevState, props) => {
|
|
100
|
-
return {
|
|
101
|
-
res: rows,
|
|
102
|
-
selectedItems: isSelected
|
|
103
|
-
? [...prevState.selectedItems, id]
|
|
104
|
-
: prevState.selectedItems.filter((itemId) => itemId !== id)
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
this.updateSelected = () => {
|
|
110
|
-
const { res, selectedItems } = this.state;
|
|
111
|
-
let rows = res.map((post) => {
|
|
112
|
-
post.selected = selectedItems.includes(post.id);
|
|
113
|
-
return post;
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
this.setState({
|
|
117
|
-
res: rows
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
this.handleSelectClick = (newState) => {
|
|
122
|
-
if (newState === 'none') {
|
|
123
|
-
this.setState(
|
|
124
|
-
{
|
|
125
|
-
selectedItems: []
|
|
126
|
-
},
|
|
127
|
-
this.updateSelected
|
|
128
|
-
);
|
|
129
|
-
} else if (newState === 'page') {
|
|
130
|
-
let newRows = [];
|
|
131
|
-
let rows = this.state.res.map((post) => {
|
|
132
|
-
const isSelected = post.selected;
|
|
133
|
-
newRows = isSelected ? [...newRows] : [...newRows, post.id];
|
|
134
|
-
post.selected = true;
|
|
135
|
-
return post;
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
this.setState((prevState, props) => {
|
|
139
|
-
return {
|
|
140
|
-
selectedItems: prevState.selectedItems.concat(newRows)
|
|
141
|
-
};
|
|
142
|
-
}, this.updateSelected);
|
|
143
|
-
} else {
|
|
144
|
-
let newRows = [];
|
|
145
|
-
for (var i = 1; i <= 100; i++) newRows = [...newRows, i];
|
|
146
|
-
|
|
147
|
-
this.setState(
|
|
148
|
-
{
|
|
149
|
-
selectedItems: newRows
|
|
150
|
-
},
|
|
151
|
-
this.updateSelected
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
this.onDropDownToggle = (isOpen) => {
|
|
157
|
-
this.setState({
|
|
158
|
-
isDropDownOpen: isOpen
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
this.onDropDownSelect = (event) => {
|
|
163
|
-
this.setState((prevState, props) => {
|
|
164
|
-
return { isDropDownOpen: !prevState.isDropDownOpen };
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
fetch(page, perPage) {
|
|
170
|
-
this.setState({ loading: true });
|
|
171
|
-
fetch(`https://jsonplaceholder.typicode.com/posts?_page=${page}&_limit=${perPage}`)
|
|
172
|
-
.then((resp) => resp.json())
|
|
173
|
-
.then((resp) => this.setState({ res: resp, perPage, page, loading: false }))
|
|
174
|
-
.then(() => this.updateSelected())
|
|
175
|
-
.catch((err) => this.setState({ error: err, loading: false }));
|
|
176
|
-
}
|
|
59
|
+
```js isFullscreen file="./table-demos/BulkSelect.jsx"
|
|
177
60
|
|
|
178
|
-
componentDidMount() {
|
|
179
|
-
this.fetch(this.state.page, this.state.perPage);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
renderPagination(variant) {
|
|
183
|
-
const { page, perPage } = this.state;
|
|
184
|
-
return (
|
|
185
|
-
<Pagination
|
|
186
|
-
isCompact
|
|
187
|
-
itemCount={100}
|
|
188
|
-
page={page}
|
|
189
|
-
perPage={perPage}
|
|
190
|
-
onSetPage={(_evt, value) => {
|
|
191
|
-
this.fetch(value, perPage);
|
|
192
|
-
}}
|
|
193
|
-
onPerPageSelect={(_evt, value) => {
|
|
194
|
-
this.fetch(1, value);
|
|
195
|
-
}}
|
|
196
|
-
variant={variant}
|
|
197
|
-
titles={{
|
|
198
|
-
paginationAriaLabel: `${variant} pagination`
|
|
199
|
-
}}
|
|
200
|
-
/>
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
buildSelectDropdown() {
|
|
205
|
-
const { isDropDownOpen, selectedItems } = this.state;
|
|
206
|
-
const numSelected = selectedItems.length;
|
|
207
|
-
const allSelected = numSelected === 100;
|
|
208
|
-
const anySelected = numSelected > 0;
|
|
209
|
-
const someChecked = anySelected ? null : false;
|
|
210
|
-
const isChecked = allSelected ? true : someChecked;
|
|
211
|
-
|
|
212
|
-
const items = (
|
|
213
|
-
<>
|
|
214
|
-
<DropdownItem key="item-1" onClick={() => this.handleSelectClick('none')}>
|
|
215
|
-
Select none (0 items)
|
|
216
|
-
</DropdownItem>
|
|
217
|
-
<DropdownItem key="item-2" onClick={() => this.handleSelectClick('page')}>
|
|
218
|
-
Select page ({this.state.perPage} items)
|
|
219
|
-
</DropdownItem>
|
|
220
|
-
<DropdownItem key="item-3" onClick={() => this.handleSelectClick('all')}>
|
|
221
|
-
Select all (100 items)
|
|
222
|
-
</DropdownItem>
|
|
223
|
-
</>
|
|
224
|
-
);
|
|
225
|
-
return (
|
|
226
|
-
<Dropdown
|
|
227
|
-
onSelect={this.onDropDownSelect}
|
|
228
|
-
isOpen={isDropDownOpen}
|
|
229
|
-
onOpenChange={(isOpen) => this.setState({ isDropDownOpen: isOpen })}
|
|
230
|
-
toggle={(toggleRef) => (
|
|
231
|
-
<MenuToggle
|
|
232
|
-
ref={toggleRef}
|
|
233
|
-
isExpanded={isDropDownOpen}
|
|
234
|
-
onClick={this.onDropDownToggle}
|
|
235
|
-
aria-label="Select cards"
|
|
236
|
-
splitButtonOptions={{
|
|
237
|
-
items: [
|
|
238
|
-
<MenuToggleCheckbox
|
|
239
|
-
id="split-dropdown-checkbox"
|
|
240
|
-
key="split-dropdown-checkbox"
|
|
241
|
-
aria-label={anySelected ? 'Deselect all cards' : 'Select all cards'}
|
|
242
|
-
isChecked={allSelected}
|
|
243
|
-
onClick={() => {
|
|
244
|
-
anySelected ? this.handleSelectClick('none') : this.handleSelectClick('all');
|
|
245
|
-
}}
|
|
246
|
-
>
|
|
247
|
-
{numSelected !== 0 && `${numSelected} selected`}
|
|
248
|
-
</MenuToggleCheckbox>
|
|
249
|
-
]
|
|
250
|
-
}}
|
|
251
|
-
></MenuToggle>
|
|
252
|
-
)}
|
|
253
|
-
>
|
|
254
|
-
<DropdownList>{items}</DropdownList>
|
|
255
|
-
</Dropdown>
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
renderToolbar() {
|
|
260
|
-
return (
|
|
261
|
-
<React.Fragment>
|
|
262
|
-
<Toolbar>
|
|
263
|
-
<ToolbarContent>
|
|
264
|
-
<ToolbarGroup>
|
|
265
|
-
<ToolbarItem variant="bulk-select">{this.buildSelectDropdown()}</ToolbarItem>
|
|
266
|
-
</ToolbarGroup>
|
|
267
|
-
<ToolbarItem variant="pagination">{this.renderPagination('top')}</ToolbarItem>
|
|
268
|
-
</ToolbarContent>
|
|
269
|
-
</Toolbar>
|
|
270
|
-
</React.Fragment>
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
render() {
|
|
275
|
-
const { loading, res } = this.state;
|
|
276
|
-
const rows = res.map((post) => ({
|
|
277
|
-
cells: [post.title, post.body],
|
|
278
|
-
selected: post.selected
|
|
279
|
-
}));
|
|
280
|
-
|
|
281
|
-
return (
|
|
282
|
-
<DashboardWrapper hasPageTemplateTitle>
|
|
283
|
-
<PageSection isWidthLimited>
|
|
284
|
-
{this.renderToolbar()}
|
|
285
|
-
{!loading && (
|
|
286
|
-
<TableDeprecated
|
|
287
|
-
aria-label="Bulk Select Table Demo"
|
|
288
|
-
cells={['Title', 'Body']}
|
|
289
|
-
rows={rows}
|
|
290
|
-
onSelect={this.onSelect}
|
|
291
|
-
canSelectAll={false}
|
|
292
|
-
>
|
|
293
|
-
<TableHeader />
|
|
294
|
-
<TableBody />
|
|
295
|
-
</TableDeprecated>
|
|
296
|
-
)}
|
|
297
|
-
|
|
298
|
-
{loading && (
|
|
299
|
-
<div className="pf-v5-l-bullseye">
|
|
300
|
-
<Title headingLevel="h2" size="3xl">
|
|
301
|
-
Please wait while loading data
|
|
302
|
-
</Title>
|
|
303
|
-
</div>
|
|
304
|
-
)}
|
|
305
|
-
{this.renderPagination('bottom')}
|
|
306
|
-
</PageSection>
|
|
307
|
-
</DashboardWrapper>
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
61
|
```
|
|
312
62
|
|
|
313
63
|
### Expand/collapse all
|
|
@@ -1105,7 +855,7 @@ import {
|
|
|
1105
855
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
1106
856
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
1107
857
|
import { Table, TableText, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
1108
|
-
import { rows, columns } from '
|
|
858
|
+
import { rows, columns } from '';
|
|
1109
859
|
|
|
1110
860
|
class FilterTableDemo extends React.Component {
|
|
1111
861
|
constructor(props) {
|
|
@@ -1222,9 +972,9 @@ class FilterTableDemo extends React.Component {
|
|
|
1222
972
|
const { isCategoryDropdownOpen, currentCategory } = this.state;
|
|
1223
973
|
|
|
1224
974
|
const categoryMenuItems = [
|
|
1225
|
-
<SelectOption key="cat1"
|
|
1226
|
-
<SelectOption key="cat2"
|
|
1227
|
-
<SelectOption key="cat3"
|
|
975
|
+
<SelectOption key="cat1" value="Location">Location</SelectOption>,
|
|
976
|
+
<SelectOption key="cat2" value="Name">Name</SelectOption>,
|
|
977
|
+
<SelectOption key="cat3" value="Status">Status</SelectOption>
|
|
1228
978
|
];
|
|
1229
979
|
|
|
1230
980
|
return (
|
|
@@ -1260,17 +1010,17 @@ class FilterTableDemo extends React.Component {
|
|
|
1260
1010
|
const { currentCategory, isFilterDropdownOpen, inputValue, filters } = this.state;
|
|
1261
1011
|
|
|
1262
1012
|
const locationMenuItems = [
|
|
1263
|
-
<SelectOption key="raleigh"
|
|
1264
|
-
<SelectOption key="san francisco"
|
|
1265
|
-
<SelectOption key="boston"
|
|
1266
|
-
<SelectOption key="atlanta"
|
|
1013
|
+
<SelectOption key="raleigh" value="Raleigh">Raleigh</SelectOption>,
|
|
1014
|
+
<SelectOption key="san francisco" value="San Francisco">San Francisco</SelectOption>,
|
|
1015
|
+
<SelectOption key="boston" value="Boston">Boston</SelectOption>,
|
|
1016
|
+
<SelectOption key="atlanta" value="Atlanta">Atlanta</SelectOption>,
|
|
1267
1017
|
];
|
|
1268
1018
|
|
|
1269
1019
|
const statusMenuItems = [
|
|
1270
1020
|
<SelectOption
|
|
1271
1021
|
hasCheckbox
|
|
1272
1022
|
key="statusRunning"
|
|
1273
|
-
|
|
1023
|
+
value="Running"
|
|
1274
1024
|
isSelected={filters.status.includes("Running")}
|
|
1275
1025
|
>
|
|
1276
1026
|
Running
|
|
@@ -1278,7 +1028,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1278
1028
|
<SelectOption
|
|
1279
1029
|
hasCheckbox
|
|
1280
1030
|
key="statusStopped"
|
|
1281
|
-
|
|
1031
|
+
value="Stopped"
|
|
1282
1032
|
isSelected={filters.status.includes("Stopped")}
|
|
1283
1033
|
>
|
|
1284
1034
|
Stopped
|
|
@@ -1286,7 +1036,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1286
1036
|
<SelectOption
|
|
1287
1037
|
hasCheckbox
|
|
1288
1038
|
key="statusDown"
|
|
1289
|
-
|
|
1039
|
+
value="Down"
|
|
1290
1040
|
isSelected={filters.status.includes("Down")}
|
|
1291
1041
|
>
|
|
1292
1042
|
Down
|
|
@@ -1294,7 +1044,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1294
1044
|
<SelectOption
|
|
1295
1045
|
hasCheckbox
|
|
1296
1046
|
key="statusDegraded"
|
|
1297
|
-
|
|
1047
|
+
value="Degraded"
|
|
1298
1048
|
isSelected={filters.status.includes("Degraded")}
|
|
1299
1049
|
>
|
|
1300
1050
|
Degraded
|
|
@@ -1302,7 +1052,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1302
1052
|
<SelectOption
|
|
1303
1053
|
hasCheckbox
|
|
1304
1054
|
key="statusMaint"
|
|
1305
|
-
|
|
1055
|
+
value="Needs maintenance"
|
|
1306
1056
|
isSelected={filters.status.includes("Needs maintenance")}
|
|
1307
1057
|
>
|
|
1308
1058
|
Needs maintenance
|
|
@@ -1570,25 +1320,25 @@ import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
|
1570
1320
|
class ComplexPaginationTableDemo extends React.Component {
|
|
1571
1321
|
constructor(props) {
|
|
1572
1322
|
super(props);
|
|
1573
|
-
this.columns = {
|
|
1323
|
+
(this.columns = {
|
|
1574
1324
|
firstColumn: 'First column',
|
|
1575
1325
|
secondColumn: 'Second column',
|
|
1576
1326
|
thirdColumn: 'Third column'
|
|
1577
|
-
},
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1327
|
+
}),
|
|
1328
|
+
(this.defaultRows = [
|
|
1329
|
+
{ firstColumn: 'Row 1 column 1', secondColumn: 'Row 1 column 2', thirdColumn: 'Row 1 column 3' },
|
|
1330
|
+
{ firstColumn: 'Row 2 column 1', secondColumn: 'Row 2 column 2', thirdColumn: 'Row 2 column 3' },
|
|
1331
|
+
{ firstColumn: 'Row 3 column 1', secondColumn: 'Row 3 column 2', thirdColumn: 'Row 3 column 3' },
|
|
1332
|
+
{ firstColumn: 'Row 4 column 1', secondColumn: 'Row 4 column 2', thirdColumn: 'Row 4 column 3' },
|
|
1333
|
+
{ firstColumn: 'Row 5 column 1', secondColumn: 'Row 5 column 2', thirdColumn: 'Row 5 column 3' },
|
|
1334
|
+
{ firstColumn: 'Row 6 column 1', secondColumn: 'Row 6 column 2', thirdColumn: 'Row 6 column 3' },
|
|
1335
|
+
{ firstColumn: 'Row 7 column 1', secondColumn: 'Row 7 column 2', thirdColumn: 'Row 7 column 3' },
|
|
1336
|
+
{ firstColumn: 'Row 8 column 1', secondColumn: 'Row 8 column 2', thirdColumn: 'Row 8 column 3' },
|
|
1337
|
+
{ firstColumn: 'Row 9 column 1', secondColumn: 'Row 9 column 2', thirdColumn: 'Row 9 column 3' },
|
|
1338
|
+
{ firstColumn: 'Row 10 column 1', secondColumn: 'Row 10 column 2', thirdColumn: 'Row 10 column 3' },
|
|
1339
|
+
{ firstColumn: 'Row 11 column 1', secondColumn: 'Row 11 column 2', thirdColumn: 'Row 11 column 3' },
|
|
1340
|
+
{ firstColumn: 'Row 12 column 1', secondColumn: 'Row 12 column 2', thirdColumn: 'Row 12 column 3' }
|
|
1341
|
+
]);
|
|
1592
1342
|
this.defaultPerPage = 10;
|
|
1593
1343
|
this.state = {
|
|
1594
1344
|
perPage: this.defaultPerPage,
|
|
@@ -1676,70 +1426,8 @@ class ComplexPaginationTableDemo extends React.Component {
|
|
|
1676
1426
|
|
|
1677
1427
|
### Sticky header
|
|
1678
1428
|
|
|
1679
|
-
```js isFullscreen
|
|
1680
|
-
import React from 'react';
|
|
1681
|
-
import { Label, PageSection } from '@patternfly/react-core';
|
|
1682
|
-
import { Table as TableDeprecated, TableHeader, TableBody } from '@patternfly/react-table/deprecated';
|
|
1683
|
-
import { rows } from '../examples/Data.jsx';
|
|
1429
|
+
```js isFullscreen file="./table-demos/StickyHeader.jsx"
|
|
1684
1430
|
|
|
1685
|
-
class StickyHeaderTableDemo extends React.Component {
|
|
1686
|
-
render() {
|
|
1687
|
-
const renderLabel = (labelText) => {
|
|
1688
|
-
switch (labelText) {
|
|
1689
|
-
case 'Running':
|
|
1690
|
-
return <Label color="green">{labelText}</Label>;
|
|
1691
|
-
case 'Stopped':
|
|
1692
|
-
return <Label color="orange">{labelText}</Label>;
|
|
1693
|
-
case 'Needs maintenance':
|
|
1694
|
-
return <Label color="blue">{labelText}</Label>;
|
|
1695
|
-
case 'Down':
|
|
1696
|
-
return <Label color="red">{labelText}</Label>;
|
|
1697
|
-
}
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
return (
|
|
1701
|
-
<DashboardWrapper hasPageTemplateTitle>
|
|
1702
|
-
<PageSection padding={{ default: 'noPadding', xl: 'padding' }}>
|
|
1703
|
-
<Card component="div">
|
|
1704
|
-
<TableDeprecated
|
|
1705
|
-
cells={[
|
|
1706
|
-
{ title: 'Servers', transforms: [cellWidth(15)] },
|
|
1707
|
-
{ title: 'Threads', transforms: [cellWidth(10)] },
|
|
1708
|
-
{ title: 'Applications', transforms: [cellWidth(10)] },
|
|
1709
|
-
{ title: 'Workspaces', transforms: [cellWidth(10)] },
|
|
1710
|
-
{ title: 'Status', transforms: [cellWidth(10)] },
|
|
1711
|
-
{ title: 'Location', transforms: [cellWidth(15)] },
|
|
1712
|
-
{ title: 'Last Modified', transforms: [cellWidth(15)] },
|
|
1713
|
-
{ title: 'URL', transforms: [cellWidth(10)] }
|
|
1714
|
-
]}
|
|
1715
|
-
rows={rows.map((row) => [
|
|
1716
|
-
row.name,
|
|
1717
|
-
row.threads,
|
|
1718
|
-
row.applications,
|
|
1719
|
-
row.workspaces,
|
|
1720
|
-
{ title: renderLabel(row.status) },
|
|
1721
|
-
row.location,
|
|
1722
|
-
row.lastModified,
|
|
1723
|
-
{
|
|
1724
|
-
title: (
|
|
1725
|
-
<a href="#">
|
|
1726
|
-
<TableText wrapModifier="truncate">{row.url} </TableText>
|
|
1727
|
-
</a>
|
|
1728
|
-
)
|
|
1729
|
-
}
|
|
1730
|
-
])}
|
|
1731
|
-
aria-label="Sticky Header Table Demo"
|
|
1732
|
-
isStickyHeader
|
|
1733
|
-
>
|
|
1734
|
-
<TableHeader />
|
|
1735
|
-
<TableBody />
|
|
1736
|
-
</TableDeprecated>
|
|
1737
|
-
</Card>
|
|
1738
|
-
</PageSection>
|
|
1739
|
-
</DashboardWrapper>
|
|
1740
|
-
);
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
1431
|
```
|
|
1744
1432
|
|
|
1745
1433
|
### Sticky first column
|