@patternfly/react-table 4.111.54 → 4.112.0
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 +19 -0
- package/dist/esm/components/Table/base/provider.d.ts +1 -1
- package/dist/esm/components/Table/base/types.d.ts +5 -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/esm/components/TableComposable/Td.d.ts +9 -1
- package/dist/esm/components/TableComposable/Td.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Td.js +5 -2
- package/dist/esm/components/TableComposable/Td.js.map +1 -1
- package/dist/esm/components/TableComposable/Th.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Th.js +5 -0
- package/dist/esm/components/TableComposable/Th.js.map +1 -1
- package/dist/js/components/Table/base/provider.d.ts +1 -1
- package/dist/js/components/Table/base/types.d.ts +5 -1
- package/dist/js/components/Table/base/types.d.ts.map +1 -1
- package/dist/js/components/Table/base/types.js.map +1 -1
- package/dist/js/components/TableComposable/Td.d.ts +9 -1
- package/dist/js/components/TableComposable/Td.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Td.js +5 -2
- package/dist/js/components/TableComposable/Td.js.map +1 -1
- package/dist/js/components/TableComposable/Th.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Th.js +5 -0
- package/dist/js/components/TableComposable/Th.js.map +1 -1
- package/dist/umd/react-table.min.js +3 -3
- package/package.json +3 -3
- package/src/components/Table/base/types.tsx +4 -0
- package/src/components/TableComposable/Td.tsx +22 -0
- package/src/components/TableComposable/Th.tsx +5 -0
- package/src/components/TableComposable/examples/ComposableTable.md +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.112.0",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"clean": "rimraf dist"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@patternfly/react-core": "^4.
|
|
46
|
+
"@patternfly/react-core": "^4.267.0",
|
|
47
47
|
"@patternfly/react-icons": "^4.93.2",
|
|
48
48
|
"@patternfly/react-styles": "^4.92.2",
|
|
49
49
|
"@patternfly/react-tokens": "^4.94.2",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react": "^16.8 || ^17 || ^18",
|
|
59
59
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "bf5681a6297998e57a4e0f8486cc891ef64af76e"
|
|
62
62
|
}
|
|
@@ -171,6 +171,10 @@ export interface ThSelectType {
|
|
|
171
171
|
isSelected: boolean;
|
|
172
172
|
/** Flag indicating the select checkbox in the th is disabled */
|
|
173
173
|
isHeaderSelectDisabled?: boolean;
|
|
174
|
+
/** Whether to disable the selection */
|
|
175
|
+
isDisabled?: boolean;
|
|
176
|
+
/** Additional props forwarded to select rowData */
|
|
177
|
+
props?: any;
|
|
174
178
|
}
|
|
175
179
|
|
|
176
180
|
export interface ThExpandType {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
4
|
+
import scrollStyles from '@patternfly/react-styles/css/components/Table/table-scrollable';
|
|
4
5
|
import { BaseCellProps } from './TableComposable';
|
|
5
6
|
import { cellActions } from '../Table/utils/decorators/cellActions';
|
|
6
7
|
import { selectable } from '../Table/utils/decorators/selectable';
|
|
@@ -57,6 +58,14 @@ export interface TdProps extends BaseCellProps, Omit<React.HTMLProps<HTMLTableDa
|
|
|
57
58
|
tooltip?: React.ReactNode;
|
|
58
59
|
/** Callback on mouse enter */
|
|
59
60
|
onMouseEnter?: (event: any) => void;
|
|
61
|
+
/** Indicates the column should be sticky */
|
|
62
|
+
isStickyColumn?: boolean;
|
|
63
|
+
/** Adds a border to the right side of the cell */
|
|
64
|
+
hasRightBorder?: boolean;
|
|
65
|
+
/** Minimum width for a sticky column */
|
|
66
|
+
stickyMinWidth?: string;
|
|
67
|
+
/** Left offset of a sticky column. This will typically be equal to the combined value set by stickyMinWidth of any sticky columns that precede the current sticky column. */
|
|
68
|
+
stickyLeftOffset?: string;
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
const TdBase: React.FunctionComponent<TdProps> = ({
|
|
@@ -80,6 +89,10 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
80
89
|
draggableRow: draggableRowProp = null,
|
|
81
90
|
tooltip = '',
|
|
82
91
|
onMouseEnter: onMouseEnterProp = () => {},
|
|
92
|
+
isStickyColumn = false,
|
|
93
|
+
hasRightBorder = false,
|
|
94
|
+
stickyMinWidth = '120px',
|
|
95
|
+
stickyLeftOffset,
|
|
83
96
|
...props
|
|
84
97
|
}: TdProps) => {
|
|
85
98
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
@@ -239,6 +252,8 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
239
252
|
isActionCell && styles.tableAction,
|
|
240
253
|
textCenter && styles.modifiers.center,
|
|
241
254
|
noPadding && styles.modifiers.noPadding,
|
|
255
|
+
isStickyColumn && scrollStyles.tableStickyColumn,
|
|
256
|
+
hasRightBorder && scrollStyles.modifiers.borderRight,
|
|
242
257
|
styles.modifiers[modifier as 'breakWord' | 'fitContent' | 'nowrap' | 'truncate' | 'wrap' | undefined],
|
|
243
258
|
draggableParams && styles.tableDraggable,
|
|
244
259
|
mergedClassName
|
|
@@ -246,6 +261,13 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
246
261
|
ref={innerRef}
|
|
247
262
|
{...mergedProps}
|
|
248
263
|
{...props}
|
|
264
|
+
{...(isStickyColumn && {
|
|
265
|
+
style: {
|
|
266
|
+
'--pf-c-table__sticky-column--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
267
|
+
'--pf-c-table__sticky-column--Left': stickyLeftOffset ? stickyLeftOffset : undefined,
|
|
268
|
+
...props.style
|
|
269
|
+
} as React.CSSProperties
|
|
270
|
+
})}
|
|
249
271
|
>
|
|
250
272
|
{mergedChildren || children}
|
|
251
273
|
</MergedComponent>
|
|
@@ -109,6 +109,11 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
109
109
|
}
|
|
110
110
|
const selectParams = select
|
|
111
111
|
? selectable(children as IFormatterValueType, {
|
|
112
|
+
rowData: {
|
|
113
|
+
selected: select.isSelected,
|
|
114
|
+
disableSelection: select?.isDisabled,
|
|
115
|
+
props: select?.props
|
|
116
|
+
},
|
|
112
117
|
column: {
|
|
113
118
|
extraParams: {
|
|
114
119
|
onSelect: select?.onSelect,
|
|
@@ -327,14 +327,14 @@ There are a few ways this can be handled:
|
|
|
327
327
|
|
|
328
328
|
### Composable: Sticky column
|
|
329
329
|
|
|
330
|
-
To make a column sticky, wrap `TableComposable` with `InnerScrollContainer` and add the following properties to the `Th` that should be sticky: `isStickyColumn` and `hasRightBorder`. To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` should also have the `modifier="nowrap"` property. To set the minimum width of the sticky column, use the `stickyMinWidth` property.
|
|
330
|
+
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
331
|
|
|
332
332
|
```ts file="ComposableTableStickyColumn.tsx"
|
|
333
333
|
```
|
|
334
334
|
|
|
335
335
|
### Composable: Multiple sticky columns
|
|
336
336
|
|
|
337
|
-
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` should also have the `modifier="nowrap"` property.
|
|
337
|
+
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
338
|
|
|
339
339
|
```ts file="ComposableTableMultipleStickyColumns.tsx"
|
|
340
340
|
```
|