@patternfly/react-table 4.29.73 → 4.30.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 +35 -0
- package/dist/esm/components/Table/Body.d.ts +2 -2
- package/dist/esm/components/Table/Body.d.ts.map +1 -1
- package/dist/esm/components/Table/Body.js +11 -1
- package/dist/esm/components/Table/Body.js.map +1 -1
- package/dist/esm/components/Table/RowWrapper.d.ts.map +1 -1
- package/dist/esm/components/Table/RowWrapper.js +2 -2
- package/dist/esm/components/Table/RowWrapper.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +2 -0
- package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.js +6 -6
- package/dist/esm/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/esm/components/TableComposable/Tr.d.ts +7 -1
- package/dist/esm/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Tr.js +11 -2
- package/dist/esm/components/TableComposable/Tr.js.map +1 -1
- package/dist/js/components/Table/Body.d.ts +2 -2
- package/dist/js/components/Table/Body.d.ts.map +1 -1
- package/dist/js/components/Table/Body.js +11 -1
- package/dist/js/components/Table/Body.js.map +1 -1
- package/dist/js/components/Table/RowWrapper.d.ts.map +1 -1
- package/dist/js/components/Table/RowWrapper.js +2 -2
- package/dist/js/components/Table/RowWrapper.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +2 -0
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.js +6 -6
- package/dist/js/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/js/components/TableComposable/Tr.d.ts +7 -1
- package/dist/js/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Tr.js +11 -2
- package/dist/js/components/TableComposable/Tr.js.map +1 -1
- package/dist/umd/react-table.css +14800 -14800
- package/dist/umd/react-table.js +30 -11
- package/dist/umd/react-table.min.css +13589 -13589
- package/dist/umd/react-table.min.js +2 -2
- package/package.json +3 -3
- package/src/components/Table/Body.tsx +21 -6
- package/src/components/Table/RowWrapper.tsx +3 -1
- package/src/components/Table/TableTypes.ts +2 -0
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +1568 -784
- package/src/components/Table/examples/Table.md +111 -94
- package/src/components/Table/utils/decorators/treeRow.tsx +12 -6
- package/src/components/TableComposable/Tr.tsx +25 -1
- package/src/components/TableComposable/examples/ComposableTable.md +68 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.30.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,7 +31,7 @@
|
|
|
31
31
|
"clean": "rimraf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@patternfly/react-core": "^4.
|
|
34
|
+
"@patternfly/react-core": "^4.157.3",
|
|
35
35
|
"@patternfly/react-icons": "^4.11.17",
|
|
36
36
|
"@patternfly/react-styles": "^4.11.16",
|
|
37
37
|
"@patternfly/react-tokens": "^4.12.18",
|
|
@@ -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": "463b824d3b7efca8f94c4b33f62eefc880eafe46"
|
|
50
50
|
}
|
|
@@ -11,7 +11,7 @@ export interface IComputedData {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export type OnRowClick = (
|
|
14
|
-
event: React.MouseEvent,
|
|
14
|
+
event: React.KeyboardEvent | React.MouseEvent,
|
|
15
15
|
row: IRow,
|
|
16
16
|
rowProps: IExtraRowData,
|
|
17
17
|
computedData: IComputedData
|
|
@@ -28,14 +28,14 @@ export interface TableBodyProps {
|
|
|
28
28
|
rows?: IRow[];
|
|
29
29
|
/** @hide This prop should not be set manually */
|
|
30
30
|
rowKey?: RowKeyType;
|
|
31
|
-
/**
|
|
31
|
+
/** A click handler for the row */
|
|
32
32
|
onRowClick?: OnRowClick;
|
|
33
33
|
/** @hide This prop should not be set manually */
|
|
34
34
|
onRow?: Function;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const flagVisibility = (rows: IRow[]) => {
|
|
38
|
-
const visibleRows = (rows as []).filter((oneRow: IRow) => !oneRow.parent || oneRow.isExpanded) as IRow[];
|
|
38
|
+
const visibleRows = (rows as IRow[]).filter((oneRow: IRow) => !oneRow.parent || oneRow.isExpanded) as IRow[];
|
|
39
39
|
if (visibleRows.length > 0) {
|
|
40
40
|
visibleRows[0].isFirstVisible = true;
|
|
41
41
|
visibleRows[visibleRows.length - 1].isLastVisible = true;
|
|
@@ -56,13 +56,23 @@ class ContextBody extends React.Component<TableBodyProps, {}> {
|
|
|
56
56
|
return {
|
|
57
57
|
row,
|
|
58
58
|
rowProps: extendedRowProps,
|
|
59
|
-
|
|
59
|
+
onClick: (event: React.MouseEvent) => {
|
|
60
60
|
const computedData = {
|
|
61
61
|
isInput: (event.target as HTMLElement).tagName !== 'INPUT',
|
|
62
62
|
isButton: (event.target as HTMLElement).tagName !== 'BUTTON'
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
onRowClick(event, row, rowProps, computedData);
|
|
66
|
+
},
|
|
67
|
+
onKeyDown: (event: React.KeyboardEvent) => {
|
|
68
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
69
|
+
const computedData = {
|
|
70
|
+
isInput: (event.target as HTMLElement).tagName !== 'INPUT',
|
|
71
|
+
isButton: (event.target as HTMLElement).tagName !== 'BUTTON'
|
|
72
|
+
};
|
|
73
|
+
onRowClick(event, row, rowProps, computedData);
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
}
|
|
66
76
|
}
|
|
67
77
|
};
|
|
68
78
|
};
|
|
@@ -128,7 +138,7 @@ class ContextBody extends React.Component<TableBodyProps, {}> {
|
|
|
128
138
|
|
|
129
139
|
let mappedRows: IRow[];
|
|
130
140
|
if (headerData.length > 0) {
|
|
131
|
-
mappedRows = (rows as []).map((oneRow: IRow, oneRowKey: number) => ({
|
|
141
|
+
mappedRows = (rows as IRow[]).map((oneRow: IRow, oneRowKey: number) => ({
|
|
132
142
|
...oneRow,
|
|
133
143
|
...this.mapCells(headerData, oneRow, oneRowKey),
|
|
134
144
|
isExpanded: isRowExpanded(oneRow, rows),
|
|
@@ -164,7 +174,12 @@ export const TableBody = ({
|
|
|
164
174
|
rowKey = 'secretTableRowKeyId' as string,
|
|
165
175
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
166
176
|
onRow = (...args: any) => ({}),
|
|
167
|
-
onRowClick = (
|
|
177
|
+
onRowClick = (
|
|
178
|
+
event: React.MouseEvent | React.KeyboardEvent,
|
|
179
|
+
row: IRow,
|
|
180
|
+
rowProps: IExtraRowData,
|
|
181
|
+
computedData: IComputedData
|
|
182
|
+
) =>
|
|
168
183
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
169
184
|
undefined as OnRowClick,
|
|
170
185
|
...props
|
|
@@ -91,7 +91,7 @@ export class RowWrapper extends React.Component<RowWrapperProps> {
|
|
|
91
91
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
92
92
|
onScroll,
|
|
93
93
|
onResize,
|
|
94
|
-
row: { isExpanded, isEditable },
|
|
94
|
+
row: { isExpanded, isEditable, isHoverable, isRowSelected },
|
|
95
95
|
rowProps,
|
|
96
96
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
97
97
|
trRef,
|
|
@@ -108,6 +108,8 @@ export class RowWrapper extends React.Component<RowWrapperProps> {
|
|
|
108
108
|
isEditable={isEditable}
|
|
109
109
|
className={className}
|
|
110
110
|
ouiaId={ouiaId}
|
|
111
|
+
isHoverable={isHoverable}
|
|
112
|
+
isRowSelected={isRowSelected}
|
|
111
113
|
/>
|
|
112
114
|
);
|
|
113
115
|
}
|
|
@@ -227,6 +227,8 @@ export interface IRow extends RowType {
|
|
|
227
227
|
cells?: (React.ReactNode | IRowCell)[];
|
|
228
228
|
isOpen?: boolean;
|
|
229
229
|
isEditable?: boolean;
|
|
230
|
+
isHoverable?: boolean;
|
|
231
|
+
isRowSelected?: boolean;
|
|
230
232
|
isValid?: boolean;
|
|
231
233
|
/** An array of validation functions to run against every cell for a given row */
|
|
232
234
|
rowEditValidationRules?: IValidatorDef[];
|