@patternfly/react-table 5.0.0-alpha.21 → 5.0.0-alpha.22
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
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-alpha.22](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-table@5.0.0-alpha.21...@patternfly/react-table@5.0.0-alpha.22) (2023-03-02)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **DataListCheck:** updated onChange param order ([#8735](https://github.com/patternfly/patternfly-react/issues/8735)) ([bf0c2ff](https://github.com/patternfly/patternfly-react/commit/bf0c2ff9a4854f1b879511522746d3d5d2fbb6f1))
|
|
11
|
+
|
|
6
12
|
# [5.0.0-alpha.21](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-table@5.0.0-alpha.20...@patternfly/react-table@5.0.0-alpha.21) (2023-03-02)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @patternfly/react-table
|
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.22",
|
|
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/copySubpaths.js"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@patternfly/react-core": "^5.0.0-alpha.
|
|
42
|
+
"@patternfly/react-core": "^5.0.0-alpha.22",
|
|
43
43
|
"@patternfly/react-icons": "^5.0.0-alpha.4",
|
|
44
44
|
"@patternfly/react-styles": "^5.0.0-alpha.4",
|
|
45
45
|
"@patternfly/react-tokens": "^5.0.0-alpha.4",
|
|
@@ -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": "4ce5d3887ed6061107702090244b680ca006f3f1"
|
|
58
58
|
}
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -98,14 +98,14 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
98
98
|
res: rows,
|
|
99
99
|
selectedItems: isSelected
|
|
100
100
|
? [...prevState.selectedItems, id]
|
|
101
|
-
: prevState.selectedItems.filter(itemId => itemId !== id)
|
|
101
|
+
: prevState.selectedItems.filter((itemId) => itemId !== id)
|
|
102
102
|
};
|
|
103
103
|
});
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
this.updateSelected = () => {
|
|
107
107
|
const { res, selectedItems } = this.state;
|
|
108
|
-
let rows = res.map(post => {
|
|
108
|
+
let rows = res.map((post) => {
|
|
109
109
|
post.selected = selectedItems.includes(post.id);
|
|
110
110
|
return post;
|
|
111
111
|
});
|
|
@@ -115,7 +115,7 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
this.handleSelectClick = newState => {
|
|
118
|
+
this.handleSelectClick = (newState) => {
|
|
119
119
|
if (newState === 'none') {
|
|
120
120
|
this.setState(
|
|
121
121
|
{
|
|
@@ -125,7 +125,7 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
125
125
|
);
|
|
126
126
|
} else if (newState === 'page') {
|
|
127
127
|
let newRows = [];
|
|
128
|
-
let rows = this.state.res.map(post => {
|
|
128
|
+
let rows = this.state.res.map((post) => {
|
|
129
129
|
const isSelected = post.selected;
|
|
130
130
|
newRows = isSelected ? [...newRows] : [...newRows, post.id];
|
|
131
131
|
post.selected = true;
|
|
@@ -150,13 +150,13 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
this.onDropDownToggle = isOpen => {
|
|
153
|
+
this.onDropDownToggle = (isOpen) => {
|
|
154
154
|
this.setState({
|
|
155
155
|
isDropDownOpen: isOpen
|
|
156
156
|
});
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
this.onDropDownSelect = event => {
|
|
159
|
+
this.onDropDownSelect = (event) => {
|
|
160
160
|
this.setState((prevState, props) => {
|
|
161
161
|
return { isDropDownOpen: !prevState.isDropDownOpen };
|
|
162
162
|
});
|
|
@@ -166,10 +166,10 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
166
166
|
fetch(page, perPage) {
|
|
167
167
|
this.setState({ loading: true });
|
|
168
168
|
fetch(`https://jsonplaceholder.typicode.com/posts?_page=${page}&_limit=${perPage}`)
|
|
169
|
-
.then(resp => resp.json())
|
|
170
|
-
.then(resp => this.setState({ res: resp, perPage, page, loading: false }))
|
|
169
|
+
.then((resp) => resp.json())
|
|
170
|
+
.then((resp) => this.setState({ res: resp, perPage, page, loading: false }))
|
|
171
171
|
.then(() => this.updateSelected())
|
|
172
|
-
.catch(err => this.setState({ error: err, loading: false }));
|
|
172
|
+
.catch((err) => this.setState({ error: err, loading: false }));
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
componentDidMount() {
|
|
@@ -238,8 +238,7 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
238
238
|
</DropdownToggleCheckbox>
|
|
239
239
|
]}
|
|
240
240
|
onToggle={this.onDropDownToggle}
|
|
241
|
-
>
|
|
242
|
-
</DropdownToggle>
|
|
241
|
+
></DropdownToggle>
|
|
243
242
|
}
|
|
244
243
|
isOpen={isDropDownOpen}
|
|
245
244
|
dropdownItems={items}
|
|
@@ -264,7 +263,7 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
264
263
|
|
|
265
264
|
render() {
|
|
266
265
|
const { loading, res } = this.state;
|
|
267
|
-
const rows = res.map(post => ({
|
|
266
|
+
const rows = res.map((post) => ({
|
|
268
267
|
cells: [post.title, post.body],
|
|
269
268
|
selected: post.selected
|
|
270
269
|
}));
|
|
@@ -304,21 +303,25 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
304
303
|
### Expand/collapse all
|
|
305
304
|
|
|
306
305
|
```js isFullscreen file="./table-demos/ExpandCollapseAll.jsx"
|
|
306
|
+
|
|
307
307
|
```
|
|
308
308
|
|
|
309
309
|
### Compact
|
|
310
310
|
|
|
311
311
|
```js isFullscreen file="./table-demos/Compact.jsx"
|
|
312
|
+
|
|
312
313
|
```
|
|
313
314
|
|
|
314
315
|
### Compound expansion
|
|
315
316
|
|
|
316
317
|
```js isFullscreen file="./table-demos/CompoundExpansion.jsx"
|
|
318
|
+
|
|
317
319
|
```
|
|
318
320
|
|
|
319
321
|
### Column management
|
|
320
322
|
|
|
321
323
|
```js isFullscreen file="./table-demos/ColumnManagement.jsx"
|
|
324
|
+
|
|
322
325
|
```
|
|
323
326
|
|
|
324
327
|
### Column management with draggable
|
|
@@ -642,7 +645,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
642
645
|
this.onSelect = this.onSelect.bind(this);
|
|
643
646
|
this.toggleSelect = this.toggleSelect.bind(this);
|
|
644
647
|
this.renderModal = this.renderModal.bind(this);
|
|
645
|
-
this.matchCheckboxNameToColumn = name => {
|
|
648
|
+
this.matchCheckboxNameToColumn = (name) => {
|
|
646
649
|
switch (name) {
|
|
647
650
|
case 'check1':
|
|
648
651
|
return 'Repositories';
|
|
@@ -656,7 +659,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
656
659
|
return 'Last commit';
|
|
657
660
|
}
|
|
658
661
|
};
|
|
659
|
-
this.matchDataListNameToColumn = name => {
|
|
662
|
+
this.matchDataListNameToColumn = (name) => {
|
|
660
663
|
switch (name) {
|
|
661
664
|
case 'data1':
|
|
662
665
|
return 'Repositories';
|
|
@@ -673,8 +676,8 @@ class ColumnManagementAction extends React.Component {
|
|
|
673
676
|
this.filterData = (checked, name) => {
|
|
674
677
|
const { rows, columns, filters } = this.state;
|
|
675
678
|
if (checked) {
|
|
676
|
-
const updatedFilters = filters.filter(item => item !== name);
|
|
677
|
-
const filteredColumns = this.defaultColumns.filter(column => !updatedFilters.includes(column));
|
|
679
|
+
const updatedFilters = filters.filter((item) => item !== name);
|
|
680
|
+
const filteredColumns = this.defaultColumns.filter((column) => !updatedFilters.includes(column));
|
|
678
681
|
this.setState({
|
|
679
682
|
filters: updatedFilters,
|
|
680
683
|
filteredColumns: filteredColumns
|
|
@@ -682,7 +685,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
682
685
|
} else {
|
|
683
686
|
let updatedFilters = filters;
|
|
684
687
|
updatedFilters.push(name);
|
|
685
|
-
const filteredColumns = columns.filter(column => !filters.includes(column));
|
|
688
|
+
const filteredColumns = columns.filter((column) => !filters.includes(column));
|
|
686
689
|
this.setState({
|
|
687
690
|
filters: updatedFilters,
|
|
688
691
|
filteredColumns: filteredColumns
|
|
@@ -695,7 +698,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
695
698
|
filteredColumns: this.defaultColumns
|
|
696
699
|
});
|
|
697
700
|
};
|
|
698
|
-
this.handleChange = (
|
|
701
|
+
this.handleChange = (event, checked) => {
|
|
699
702
|
const target = event.target;
|
|
700
703
|
const value = target.type === 'checkbox' ? target.checked : target.value;
|
|
701
704
|
this.filterData(checked, this.matchCheckboxNameToColumn(target.name));
|
|
@@ -709,15 +712,15 @@ class ColumnManagementAction extends React.Component {
|
|
|
709
712
|
}));
|
|
710
713
|
};
|
|
711
714
|
this.onSave = () => {
|
|
712
|
-
const orderedColumns = this.state.itemOrder.map(item => this.matchDataListNameToColumn(item));
|
|
715
|
+
const orderedColumns = this.state.itemOrder.map((item) => this.matchDataListNameToColumn(item));
|
|
713
716
|
// concat empty string at the end for actions column
|
|
714
717
|
const filteredOrderedColumns = orderedColumns
|
|
715
|
-
.filter(col => this.state.filteredColumns.length === 0 || this.state.filteredColumns.indexOf(col) > -1)
|
|
718
|
+
.filter((col) => this.state.filteredColumns.length === 0 || this.state.filteredColumns.indexOf(col) > -1)
|
|
716
719
|
.concat(['']);
|
|
717
720
|
const orderedRows = [];
|
|
718
|
-
this.defaultRows.forEach(row => {
|
|
721
|
+
this.defaultRows.forEach((row) => {
|
|
719
722
|
const updatedCells = row.cells
|
|
720
|
-
.filter(cell => filteredOrderedColumns.indexOf(cell.props.column) > -1)
|
|
723
|
+
.filter((cell) => filteredOrderedColumns.indexOf(cell.props.column) > -1)
|
|
721
724
|
.sort((cellA, cellB) => {
|
|
722
725
|
const indexA = filteredOrderedColumns.indexOf(cellA.props.column);
|
|
723
726
|
const indexB = filteredOrderedColumns.indexOf(cellB.props.column);
|
|
@@ -740,7 +743,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
740
743
|
isModalOpen: !isModalOpen
|
|
741
744
|
}));
|
|
742
745
|
};
|
|
743
|
-
|
|
746
|
+
|
|
744
747
|
this.selectAllColumns = () => {
|
|
745
748
|
this.unfilterAllData();
|
|
746
749
|
this.setState({
|
|
@@ -752,7 +755,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
752
755
|
});
|
|
753
756
|
};
|
|
754
757
|
|
|
755
|
-
this.onDragStart = id => {
|
|
758
|
+
this.onDragStart = (id) => {
|
|
756
759
|
this.setState({
|
|
757
760
|
id: id,
|
|
758
761
|
liveText: `Dragging started for item id: ${id}.`
|
|
@@ -772,7 +775,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
772
775
|
});
|
|
773
776
|
};
|
|
774
777
|
|
|
775
|
-
this.onDragFinish = itemOrder => {
|
|
778
|
+
this.onDragFinish = (itemOrder) => {
|
|
776
779
|
this.setState({
|
|
777
780
|
liveText: `Dragging finished`,
|
|
778
781
|
itemOrder
|
|
@@ -783,7 +786,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
783
786
|
onSelect(event, isSelected, rowId) {
|
|
784
787
|
let rows;
|
|
785
788
|
if (rowId === -1) {
|
|
786
|
-
rows = this.state.rows.map(oneRow => {
|
|
789
|
+
rows = this.state.rows.map((oneRow) => {
|
|
787
790
|
oneRow.selected = isSelected;
|
|
788
791
|
return oneRow;
|
|
789
792
|
});
|
|
@@ -1151,8 +1154,8 @@ class FilterTableDemo extends React.Component {
|
|
|
1151
1154
|
|
|
1152
1155
|
this.onDelete = (type = '', id = '') => {
|
|
1153
1156
|
if (type) {
|
|
1154
|
-
this.setState(prevState => {
|
|
1155
|
-
prevState.filters[type.toLowerCase()] = prevState.filters[type.toLowerCase()].filter(s => s !== id);
|
|
1157
|
+
this.setState((prevState) => {
|
|
1158
|
+
prevState.filters[type.toLowerCase()] = prevState.filters[type.toLowerCase()].filter((s) => s !== id);
|
|
1156
1159
|
return {
|
|
1157
1160
|
filters: prevState.filters
|
|
1158
1161
|
};
|
|
@@ -1168,39 +1171,39 @@ class FilterTableDemo extends React.Component {
|
|
|
1168
1171
|
}
|
|
1169
1172
|
};
|
|
1170
1173
|
|
|
1171
|
-
this.onCategoryToggle = isOpen => {
|
|
1174
|
+
this.onCategoryToggle = (isOpen) => {
|
|
1172
1175
|
this.setState({
|
|
1173
1176
|
isCategoryDropdownOpen: isOpen
|
|
1174
1177
|
});
|
|
1175
1178
|
};
|
|
1176
1179
|
|
|
1177
|
-
this.onCategorySelect = event => {
|
|
1180
|
+
this.onCategorySelect = (event) => {
|
|
1178
1181
|
this.setState({
|
|
1179
1182
|
currentCategory: event.target.innerText,
|
|
1180
1183
|
isCategoryDropdownOpen: !this.state.isCategoryDropdownOpen
|
|
1181
1184
|
});
|
|
1182
1185
|
};
|
|
1183
1186
|
|
|
1184
|
-
this.onFilterToggle = isOpen => {
|
|
1187
|
+
this.onFilterToggle = (isOpen) => {
|
|
1185
1188
|
this.setState({
|
|
1186
1189
|
isFilterDropdownOpen: isOpen
|
|
1187
1190
|
});
|
|
1188
1191
|
};
|
|
1189
1192
|
|
|
1190
|
-
this.onFilterSelect = event => {
|
|
1193
|
+
this.onFilterSelect = (event) => {
|
|
1191
1194
|
this.setState({
|
|
1192
1195
|
isFilterDropdownOpen: !this.state.isFilterDropdownOpen
|
|
1193
1196
|
});
|
|
1194
1197
|
};
|
|
1195
1198
|
|
|
1196
|
-
this.onInputChange = newValue => {
|
|
1199
|
+
this.onInputChange = (newValue) => {
|
|
1197
1200
|
this.setState({ inputValue: newValue });
|
|
1198
1201
|
};
|
|
1199
1202
|
|
|
1200
1203
|
this.onRowSelect = (event, isSelected, rowId) => {
|
|
1201
1204
|
let rows;
|
|
1202
1205
|
if (rowId === -1) {
|
|
1203
|
-
rows = this.state.rows.map(oneRow => {
|
|
1206
|
+
rows = this.state.rows.map((oneRow) => {
|
|
1204
1207
|
oneRow.selected = isSelected;
|
|
1205
1208
|
return oneRow;
|
|
1206
1209
|
});
|
|
@@ -1215,24 +1218,24 @@ class FilterTableDemo extends React.Component {
|
|
|
1215
1218
|
|
|
1216
1219
|
this.onStatusSelect = (event, selection) => {
|
|
1217
1220
|
const checked = event.target.checked;
|
|
1218
|
-
this.setState(prevState => {
|
|
1221
|
+
this.setState((prevState) => {
|
|
1219
1222
|
const prevSelections = prevState.filters['status'];
|
|
1220
1223
|
return {
|
|
1221
1224
|
filters: {
|
|
1222
1225
|
...prevState.filters,
|
|
1223
|
-
status: checked ? [...prevSelections, selection] : prevSelections.filter(value => value !== selection)
|
|
1226
|
+
status: checked ? [...prevSelections, selection] : prevSelections.filter((value) => value !== selection)
|
|
1224
1227
|
}
|
|
1225
1228
|
};
|
|
1226
1229
|
});
|
|
1227
1230
|
};
|
|
1228
1231
|
|
|
1229
|
-
this.onNameInput = event => {
|
|
1232
|
+
this.onNameInput = (event) => {
|
|
1230
1233
|
if (event.key && event.key !== 'Enter') {
|
|
1231
1234
|
return;
|
|
1232
1235
|
}
|
|
1233
1236
|
|
|
1234
1237
|
const { inputValue } = this.state;
|
|
1235
|
-
this.setState(prevState => {
|
|
1238
|
+
this.setState((prevState) => {
|
|
1236
1239
|
const prevFilters = prevState.filters['name'];
|
|
1237
1240
|
return {
|
|
1238
1241
|
filters: {
|
|
@@ -1245,7 +1248,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1245
1248
|
};
|
|
1246
1249
|
|
|
1247
1250
|
this.onLocationSelect = (event, selection) => {
|
|
1248
|
-
this.setState(prevState => {
|
|
1251
|
+
this.setState((prevState) => {
|
|
1249
1252
|
return {
|
|
1250
1253
|
filters: {
|
|
1251
1254
|
...prevState.filters,
|
|
@@ -1381,10 +1384,10 @@ class FilterTableDemo extends React.Component {
|
|
|
1381
1384
|
|
|
1382
1385
|
const filteredRows =
|
|
1383
1386
|
filters.name.length > 0 || filters.location.length > 0 || filters.status.length > 0
|
|
1384
|
-
? rows.filter(row => {
|
|
1387
|
+
? rows.filter((row) => {
|
|
1385
1388
|
return (
|
|
1386
1389
|
(filters.name.length === 0 ||
|
|
1387
|
-
filters.name.some(name => row.cells[0].toLowerCase().includes(name.toLowerCase()))) &&
|
|
1390
|
+
filters.name.some((name) => row.cells[0].toLowerCase().includes(name.toLowerCase()))) &&
|
|
1388
1391
|
(filters.location.length === 0 || filters.location.includes(row.cells[5])) &&
|
|
1389
1392
|
(filters.status.length === 0 || filters.status.includes(row.cells[4]))
|
|
1390
1393
|
);
|
|
@@ -1460,6 +1463,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1460
1463
|
### Sortable - responsive
|
|
1461
1464
|
|
|
1462
1465
|
```js isFullscreen file="./table-demos/SortableResponsive.jsx"
|
|
1466
|
+
|
|
1463
1467
|
```
|
|
1464
1468
|
|
|
1465
1469
|
### Automatic pagination
|
|
@@ -1546,7 +1550,7 @@ class ComplexPaginationTableDemo extends React.Component {
|
|
|
1546
1550
|
}
|
|
1547
1551
|
|
|
1548
1552
|
render() {
|
|
1549
|
-
const rows = this.state.rows.map(row => ({ cells: row.cells }));
|
|
1553
|
+
const rows = this.state.rows.map((row) => ({ cells: row.cells }));
|
|
1550
1554
|
return (
|
|
1551
1555
|
<React.Fragment>
|
|
1552
1556
|
{this.renderPagination()}
|
|
@@ -1563,6 +1567,7 @@ class ComplexPaginationTableDemo extends React.Component {
|
|
|
1563
1567
|
### Static bottom pagination on mobile
|
|
1564
1568
|
|
|
1565
1569
|
```js isFullscreen file="table-demos/StaticBottomPagination.jsx"
|
|
1570
|
+
|
|
1566
1571
|
```
|
|
1567
1572
|
|
|
1568
1573
|
### Sticky header
|
|
@@ -1575,7 +1580,7 @@ import { rows } from '../examples/Data.jsx';
|
|
|
1575
1580
|
|
|
1576
1581
|
class StickyHeaderTableDemo extends React.Component {
|
|
1577
1582
|
render() {
|
|
1578
|
-
const renderLabel = labelText => {
|
|
1583
|
+
const renderLabel = (labelText) => {
|
|
1579
1584
|
switch (labelText) {
|
|
1580
1585
|
case 'Running':
|
|
1581
1586
|
return <Label color="green">{labelText}</Label>;
|
|
@@ -1603,7 +1608,7 @@ class StickyHeaderTableDemo extends React.Component {
|
|
|
1603
1608
|
{ title: 'Last Modified', transforms: [cellWidth(15)] },
|
|
1604
1609
|
{ title: 'URL', transforms: [cellWidth(10)] }
|
|
1605
1610
|
]}
|
|
1606
|
-
rows={rows.map(row => [
|
|
1611
|
+
rows={rows.map((row) => [
|
|
1607
1612
|
row.name,
|
|
1608
1613
|
row.threads,
|
|
1609
1614
|
row.applications,
|
|
@@ -1636,6 +1641,7 @@ class StickyHeaderTableDemo extends React.Component {
|
|
|
1636
1641
|
### Sticky first column
|
|
1637
1642
|
|
|
1638
1643
|
```js isFullscreen file="./table-demos/StickyFirstColumn.jsx"
|
|
1644
|
+
|
|
1639
1645
|
```
|
|
1640
1646
|
|
|
1641
1647
|
### Sticky columns and header with toolbar
|
|
@@ -1643,6 +1649,7 @@ class StickyHeaderTableDemo extends React.Component {
|
|
|
1643
1649
|
A toolbar may be added above a sticky table either inside or outside the `OuterScrollContainer`.
|
|
1644
1650
|
|
|
1645
1651
|
```ts isFullscreen file="../examples/ComposableTableStickyToolbar.tsx"
|
|
1652
|
+
|
|
1646
1653
|
```
|
|
1647
1654
|
|
|
1648
1655
|
## Empty states
|
|
@@ -45,7 +45,7 @@ export const ColumnManagementAction = () => {
|
|
|
45
45
|
const [perPage, setPerPage] = React.useState(10);
|
|
46
46
|
const [paginatedRows, setPaginatedRows] = React.useState(rows);
|
|
47
47
|
|
|
48
|
-
const matchCheckboxNameToColumn = name => {
|
|
48
|
+
const matchCheckboxNameToColumn = (name) => {
|
|
49
49
|
switch (name) {
|
|
50
50
|
case 'check1':
|
|
51
51
|
return 'Servers';
|
|
@@ -65,7 +65,7 @@ export const ColumnManagementAction = () => {
|
|
|
65
65
|
return 'URL';
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
const matchSelectedColumnNameToAttr = name => {
|
|
68
|
+
const matchSelectedColumnNameToAttr = (name) => {
|
|
69
69
|
switch (name) {
|
|
70
70
|
case 'Servers':
|
|
71
71
|
return 'name';
|
|
@@ -127,15 +127,15 @@ export const ColumnManagementAction = () => {
|
|
|
127
127
|
|
|
128
128
|
const filteredRows = [];
|
|
129
129
|
if (checked) {
|
|
130
|
-
const updatedFilters = filters.filter(item => item !== selectedColumn);
|
|
130
|
+
const updatedFilters = filters.filter((item) => item !== selectedColumn);
|
|
131
131
|
|
|
132
132
|
// Only show the names of columns that were selected in the modal
|
|
133
133
|
const filteredColumns = defaultColumns.filter(
|
|
134
|
-
column => !updatedFilters.includes(matchSelectedColumnNameToAttr(column))
|
|
134
|
+
(column) => !updatedFilters.includes(matchSelectedColumnNameToAttr(column))
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
// Remove the attributes (i.e. "columns") that were not selected
|
|
138
|
-
defaultRows.forEach(item => filteredRows.push(removePropFromObject(item, updatedFilters)));
|
|
138
|
+
defaultRows.forEach((item) => filteredRows.push(removePropFromObject(item, updatedFilters)));
|
|
139
139
|
|
|
140
140
|
setFilters(updatedFilters);
|
|
141
141
|
setFilteredColumns(filteredColumns);
|
|
@@ -145,10 +145,12 @@ export const ColumnManagementAction = () => {
|
|
|
145
145
|
updatedFilters.push(selectedColumn);
|
|
146
146
|
|
|
147
147
|
// Only show the names of columns that were selected in the modal
|
|
148
|
-
const filteredColumns = managedColumns.filter(
|
|
148
|
+
const filteredColumns = managedColumns.filter(
|
|
149
|
+
(column) => !filters.includes(matchSelectedColumnNameToAttr(column))
|
|
150
|
+
);
|
|
149
151
|
|
|
150
152
|
// Remove the attributes (i.e. "columns") that were not selected
|
|
151
|
-
managedRows.forEach(item => filteredRows.push(removePropFromObject(item, updatedFilters)));
|
|
153
|
+
managedRows.forEach((item) => filteredRows.push(removePropFromObject(item, updatedFilters)));
|
|
152
154
|
|
|
153
155
|
setFilters(updatedFilters);
|
|
154
156
|
setFilteredColumns(filteredColumns);
|
|
@@ -161,13 +163,13 @@ export const ColumnManagementAction = () => {
|
|
|
161
163
|
setFilteredRows(defaultRows);
|
|
162
164
|
};
|
|
163
165
|
|
|
164
|
-
const handleChange = (
|
|
166
|
+
const handleChange = (event, checked) => {
|
|
165
167
|
const target = event.target;
|
|
166
168
|
const value = target.type === 'checkbox' ? target.checked : target.value;
|
|
167
169
|
|
|
168
170
|
// Remove any columns from the table that aren't checked
|
|
169
171
|
filterData(checked, matchCheckboxNameToColumn(target.name));
|
|
170
|
-
const checkedIndex = columns.findIndex(element => element === matchCheckboxNameToColumn(target.name));
|
|
172
|
+
const checkedIndex = columns.findIndex((element) => element === matchCheckboxNameToColumn(target.name));
|
|
171
173
|
|
|
172
174
|
const updatedCheckedState = [...checkedState];
|
|
173
175
|
updatedCheckedState[checkedIndex] = value;
|
|
@@ -364,7 +366,7 @@ export const ColumnManagementAction = () => {
|
|
|
364
366
|
);
|
|
365
367
|
};
|
|
366
368
|
|
|
367
|
-
const renderLabel = labelText => {
|
|
369
|
+
const renderLabel = (labelText) => {
|
|
368
370
|
switch (labelText) {
|
|
369
371
|
case 'Running':
|
|
370
372
|
return <Label color="green">{labelText}</Label>;
|