@patternfly/react-table 4.38.4 → 4.39.3
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/TableTypes.d.ts +4 -0
- 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/utils/decorators/sortable.js +1 -1
- package/dist/esm/components/Table/utils/decorators/sortable.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +4 -0
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/TableTypes.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/sortable.js +1 -1
- package/dist/js/components/Table/utils/decorators/sortable.js.map +1 -1
- package/dist/umd/react-table.css +2589 -2578
- package/dist/umd/react-table.js +1 -1
- package/dist/umd/react-table.min.css +20 -9
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +6 -6
- package/src/components/Table/{TableTypes.ts → TableTypes.tsx} +4 -0
- package/src/components/Table/examples/Table.md +4 -2
- package/src/components/Table/utils/decorators/sortable.tsx +1 -1
- package/src/components/TableComposable/examples/ComposableTable.md +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.39.3",
|
|
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.
|
|
35
|
-
"@patternfly/react-icons": "^4.
|
|
36
|
-
"@patternfly/react-styles": "^4.
|
|
37
|
-
"@patternfly/react-tokens": "^4.
|
|
34
|
+
"@patternfly/react-core": "^4.170.3",
|
|
35
|
+
"@patternfly/react-icons": "^4.21.3",
|
|
36
|
+
"@patternfly/react-styles": "^4.20.3",
|
|
37
|
+
"@patternfly/react-tokens": "^4.22.3",
|
|
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": "0c1fea3b72c8dfc497db8c846c57741dfef5b248"
|
|
50
50
|
}
|
|
@@ -137,8 +137,12 @@ export type IFormatterValueType = formatterValueType & {
|
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
export interface ISortBy {
|
|
140
|
+
/** Index of the current sorted column */
|
|
140
141
|
index?: number;
|
|
142
|
+
/** Current sort direction */
|
|
141
143
|
direction?: 'asc' | 'desc';
|
|
144
|
+
/** Defaulting sorting direction. Defaults to "asc". */
|
|
145
|
+
defaultDirection?: 'asc' | 'desc';
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
export interface IAction extends Omit<DropdownItemProps, 'title' | 'onClick'> {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: Table
|
|
3
3
|
cssPrefix: pf-c-table
|
|
4
4
|
section: components
|
|
5
|
-
propComponents: ['Table', 'TableHeader', 'TableBody']
|
|
5
|
+
propComponents: ['Table', 'TableHeader', 'TableBody', 'ISortBy']
|
|
6
6
|
ouia: true
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -330,7 +330,9 @@ class SortableTable extends React.Component {
|
|
|
330
330
|
['a', 'two', 'k', 'four', 'five'],
|
|
331
331
|
['p', 'two', 'b', 'four', 'five']
|
|
332
332
|
],
|
|
333
|
-
sortBy: {
|
|
333
|
+
sortBy: {
|
|
334
|
+
defaultDirection: 'asc' // starting sort direction when first sorting a column. Defaults to 'asc'
|
|
335
|
+
}
|
|
334
336
|
};
|
|
335
337
|
this.onSort = this.onSort.bind(this);
|
|
336
338
|
}
|
|
@@ -39,7 +39,7 @@ export const sortable: ITransform = (
|
|
|
39
39
|
function sortClicked(event: React.MouseEvent) {
|
|
40
40
|
let reversedDirection: SortByDirection;
|
|
41
41
|
if (!isSortedBy) {
|
|
42
|
-
reversedDirection = SortByDirection.asc;
|
|
42
|
+
reversedDirection = sortBy.defaultDirection ? (sortBy.defaultDirection as SortByDirection) : SortByDirection.asc;
|
|
43
43
|
} else {
|
|
44
44
|
reversedDirection = sortBy.direction === SortByDirection.asc ? SortByDirection.desc : SortByDirection.asc;
|
|
45
45
|
}
|
|
@@ -27,6 +27,7 @@ propComponents:
|
|
|
27
27
|
'EditableSelectInputProps',
|
|
28
28
|
'EditableTextCellProps',
|
|
29
29
|
'ThSortType',
|
|
30
|
+
'ISortBy',
|
|
30
31
|
]
|
|
31
32
|
ouia: true
|
|
32
33
|
---
|
|
@@ -313,7 +314,8 @@ ComposableTableSortable = () => {
|
|
|
313
314
|
sort: {
|
|
314
315
|
sortBy: {
|
|
315
316
|
index: activeSortIndex,
|
|
316
|
-
direction: activeSortDirection
|
|
317
|
+
direction: activeSortDirection,
|
|
318
|
+
defaultDirection: 'asc' // starting sort direction when first sorting a column. Defaults to 'asc'
|
|
317
319
|
},
|
|
318
320
|
onSort,
|
|
319
321
|
columnIndex
|