@rhc-shared-components/packages-table 0.3.6 → 1.0.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/dist/index.js +1516 -1292
- package/dist/index.modern.js +1368 -1184
- package/package.json +4 -4
- package/dist/check-293a8689.js +0 -5
- package/dist/check-8277bc89.js +0 -4
- package/dist/inline-edit-aba2c28a.js +0 -5
- package/dist/inline-edit-dea85160.js +0 -4
- package/dist/table-68d022f9.js +0 -4
- package/dist/table-ee2a086b.js +0 -5
- package/dist/table-grid-5f08beb3.js +0 -4
- package/dist/table-grid-be1510e7.js +0 -5
- package/dist/table-scrollable-08a401e0.js +0 -4
- package/dist/table-scrollable-8d506d50.js +0 -5
- package/dist/table-tree-view-248a6705.js +0 -5
- package/dist/table-tree-view-c9374e2e.js +0 -4
package/dist/index.modern.js
CHANGED
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useState, useEffect, useCallback, cloneElement } from 'react';
|
|
3
|
-
import { setTabIndex, useOUIAProps, handleArrows,
|
|
3
|
+
import { setTabIndex, useOUIAProps, handleArrows, Toolbar, ToolbarContent, ToolbarItem, Pagination, Bullseye, Title, Spinner, EmptyState, EmptyStateHeader, EmptyStateIcon, SearchInput, ToggleGroup as ToggleGroup$1, ToggleGroupItem, Tabs, Tab } from '@patternfly/react-core';
|
|
4
4
|
import { sortBy, uniqueId } from 'lodash';
|
|
5
|
-
import {
|
|
6
|
-
import { Button as Button$1 } from '@patternfly/react-core/dist/esm/components/Button/Button';
|
|
5
|
+
import { useOUIAProps as useOUIAProps$1 } from '@patternfly/react-core/dist/esm/helpers';
|
|
7
6
|
import mergeWith from 'lodash/mergeWith';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
8
|
+
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
9
|
+
import { Popover } from '@patternfly/react-core/dist/esm/components/Popover';
|
|
10
|
+
import { Tooltip as Tooltip$1 } from '@patternfly/react-core/dist/esm/components/Tooltip/Tooltip';
|
|
11
|
+
import { Dropdown, DropdownList, DropdownItem } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
12
|
+
import { Divider } from '@patternfly/react-core/dist/esm/components/Divider';
|
|
13
|
+
import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
14
|
+
import { Checkbox } from '@patternfly/react-core/dist/esm/components/Checkbox';
|
|
15
|
+
import { Select, SelectOption } from '@patternfly/react-core/deprecated';
|
|
13
16
|
import { format } from 'date-fns';
|
|
14
17
|
|
|
15
18
|
var css_248z = ".vulnerabilities-table .impact-icon {\n font-size: 1.5rem;\n padding-right: 0.5rem;\n}\n.vulnerabilities-table .impact-icon.color-critical {\n color: #a30000;\n}\n.vulnerabilities-table .impact-icon.color-important {\n color: #ec7a08;\n}\n.vulnerabilities-table .impact-icon.color-moderate {\n color: #f5c12e;\n}\n.vulnerabilities-table .impact-icon.color-low {\n color: #777;\n}\n.vulnerabilities-table__affected-packages-cell {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n.vulnerabilities-table__impact-cell {\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n}\n\n.filterable-table {\n padding-bottom: var(--pf-global--spacer--lg);\n}\n.filterable-table__bottom-pagination[class] {\n margin-top: 1rem;\n}\n.filterable-table .pf-c-toolbar {\n padding-top: 0;\n}\n.filterable-table .pf-c-toolbar__content {\n --pf-c-toolbar__content--PaddingRight: 0;\n --pf-c-toolbar__content--PaddingLeft: 0;\n}\n.filterable-table .pf-c-input-group__text {\n --pf-c-input-group__text--PaddingRight: 0;\n}\n.filterable-table .pf-c-pagination.pf-m-bottom {\n --pf-c-pagination--m-bottom--md--PaddingRight: 0;\n}\n\n.packages-table .pf-c-tabs__item > button {\n padding: 1rem 1.5rem;\n}\n.packages-table__excluded-packages-disclaimer {\n margin: 1rem 0 0 0.5rem;\n}\n\n.filter-input {\n width: 18rem;\n margin: 1rem 0 1rem 0;\n}";
|
|
16
19
|
|
|
20
|
+
/******************************************************************************
|
|
21
|
+
Copyright (c) Microsoft Corporation.
|
|
22
|
+
|
|
23
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
24
|
+
purpose with or without fee is hereby granted.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
27
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
28
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
29
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
30
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
31
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
32
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
33
|
+
***************************************************************************** */
|
|
34
|
+
function __rest$1(s, e) {
|
|
35
|
+
var t = {};
|
|
36
|
+
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
38
|
+
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
41
|
+
}
|
|
42
|
+
return t;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
+
var e = new Error(message);
|
|
47
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48
|
+
};
|
|
49
|
+
|
|
17
50
|
/*! *****************************************************************************
|
|
18
51
|
Copyright (c) Microsoft Corporation.
|
|
19
52
|
|
|
@@ -39,29 +72,194 @@ function __rest(s, e) {
|
|
|
39
72
|
return t;
|
|
40
73
|
}
|
|
41
74
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
let currentId = 0;
|
|
76
|
+
/**
|
|
77
|
+
* Factory to create Icon class components for consumers
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
function createIcon({
|
|
81
|
+
name,
|
|
82
|
+
xOffset = 0,
|
|
83
|
+
yOffset = 0,
|
|
84
|
+
width,
|
|
85
|
+
height,
|
|
86
|
+
svgPath
|
|
87
|
+
}) {
|
|
88
|
+
var _a;
|
|
89
|
+
|
|
90
|
+
return _a = class SVGIcon extends React.Component {
|
|
91
|
+
constructor() {
|
|
92
|
+
super(...arguments);
|
|
93
|
+
this.id = `icon-title-${currentId++}`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
render() {
|
|
97
|
+
const _a = this.props,
|
|
98
|
+
{
|
|
99
|
+
title,
|
|
100
|
+
className
|
|
101
|
+
} = _a,
|
|
102
|
+
props = __rest(_a, ["title", "className"]);
|
|
103
|
+
|
|
104
|
+
const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
|
|
105
|
+
const hasTitle = Boolean(title);
|
|
106
|
+
const viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
107
|
+
return React.createElement("svg", Object.assign({
|
|
108
|
+
className: classes,
|
|
109
|
+
viewBox: viewBox,
|
|
110
|
+
fill: "currentColor",
|
|
111
|
+
"aria-labelledby": hasTitle ? this.id : null,
|
|
112
|
+
"aria-hidden": hasTitle ? null : true,
|
|
113
|
+
role: "img",
|
|
114
|
+
width: "1em",
|
|
115
|
+
height: "1em"
|
|
116
|
+
}, props), hasTitle && React.createElement("title", {
|
|
117
|
+
id: this.id
|
|
118
|
+
}, title), React.createElement("path", {
|
|
119
|
+
d: svgPath
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
}, _a.displayName = name, _a;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const EllipsisVIconConfig = {
|
|
127
|
+
name: 'EllipsisVIcon',
|
|
128
|
+
height: 512,
|
|
129
|
+
width: 192,
|
|
130
|
+
svgPath: 'M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z',
|
|
131
|
+
yOffset: 0,
|
|
132
|
+
xOffset: 0
|
|
133
|
+
};
|
|
134
|
+
const EllipsisVIcon = createIcon(EllipsisVIconConfig);
|
|
135
|
+
var EllipsisVIcon$1 = EllipsisVIcon;
|
|
136
|
+
|
|
137
|
+
const ActionsColumnBase = _a => {
|
|
138
|
+
var {
|
|
139
|
+
items,
|
|
140
|
+
isDisabled,
|
|
141
|
+
rowData,
|
|
142
|
+
extraData,
|
|
143
|
+
actionsToggle,
|
|
144
|
+
popperProps = {
|
|
145
|
+
position: 'end',
|
|
146
|
+
direction: 'down'
|
|
147
|
+
},
|
|
148
|
+
innerRef,
|
|
149
|
+
firstActionItemRef,
|
|
150
|
+
isOnOpenChangeDisabled = false
|
|
151
|
+
} = _a,
|
|
152
|
+
props = __rest$1(_a, ["items", "isDisabled", "rowData", "extraData", "actionsToggle", "popperProps", "innerRef", "firstActionItemRef", "isOnOpenChangeDisabled"]);
|
|
153
|
+
|
|
154
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
155
|
+
|
|
156
|
+
const onToggle = () => {
|
|
157
|
+
setIsOpen(!isOpen);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const onActionClick = (event, onClick) => {
|
|
161
|
+
// Only prevent default if onClick is provided. This allows href support.
|
|
162
|
+
if (onClick) {
|
|
163
|
+
event.preventDefault(); // tslint:disable-next-line:no-unused-expression
|
|
164
|
+
|
|
165
|
+
onClick(event, extraData && extraData.rowIndex, rowData, extraData);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
return React.createElement(React.Fragment, null, items.filter(item => item.isOutsideDropdown) // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
170
|
+
.map((_a, key) => {
|
|
171
|
+
var {
|
|
172
|
+
title,
|
|
173
|
+
itemKey,
|
|
174
|
+
onClick,
|
|
175
|
+
isOutsideDropdown
|
|
176
|
+
} = _a,
|
|
177
|
+
props = __rest$1(_a, ["title", "itemKey", "onClick", "isOutsideDropdown"]);
|
|
178
|
+
|
|
179
|
+
return typeof title === 'string' ? React.createElement(Button, Object.assign({
|
|
180
|
+
onClick: event => onActionClick(event, onClick)
|
|
181
|
+
}, props, {
|
|
182
|
+
isDisabled: isDisabled,
|
|
183
|
+
key: itemKey || `outside_dropdown_${key}`,
|
|
184
|
+
"data-key": itemKey || `outside_dropdown_${key}`
|
|
185
|
+
}), title) : React.cloneElement(title, Object.assign({
|
|
186
|
+
onClick,
|
|
187
|
+
isDisabled
|
|
188
|
+
}, props));
|
|
189
|
+
}), React.createElement(Dropdown, Object.assign({
|
|
190
|
+
isOpen: isOpen,
|
|
191
|
+
onOpenChange: !isOnOpenChangeDisabled ? isOpen => setIsOpen(isOpen) : undefined,
|
|
192
|
+
toggle: toggleRef => actionsToggle ? actionsToggle({
|
|
193
|
+
onToggle,
|
|
194
|
+
isOpen,
|
|
195
|
+
isDisabled,
|
|
196
|
+
toggleRef
|
|
197
|
+
}) : React.createElement(MenuToggle, {
|
|
198
|
+
"aria-label": "Kebab toggle",
|
|
199
|
+
ref: toggleRef,
|
|
200
|
+
onClick: onToggle,
|
|
201
|
+
isExpanded: isOpen,
|
|
202
|
+
isDisabled: isDisabled,
|
|
203
|
+
variant: "plain"
|
|
204
|
+
}, React.createElement(EllipsisVIcon$1, null))
|
|
205
|
+
}, rowData && rowData.actionProps, {
|
|
206
|
+
ref: innerRef
|
|
207
|
+
}, props, {
|
|
208
|
+
popperProps: popperProps
|
|
209
|
+
}), React.createElement(DropdownList, null, items.filter(item => !item.isOutsideDropdown).map((_a, index) => {
|
|
210
|
+
var {
|
|
211
|
+
title,
|
|
212
|
+
itemKey,
|
|
213
|
+
onClick,
|
|
214
|
+
tooltipProps,
|
|
215
|
+
isSeparator,
|
|
216
|
+
shouldCloseOnClick = true
|
|
217
|
+
} = _a,
|
|
218
|
+
props = __rest$1(_a, ["title", "itemKey", "onClick", "tooltipProps", "isSeparator", "shouldCloseOnClick"]);
|
|
219
|
+
|
|
220
|
+
if (isSeparator) {
|
|
221
|
+
return React.createElement(Divider, {
|
|
222
|
+
key: itemKey || index,
|
|
223
|
+
"data-key": itemKey || index
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const item = React.createElement(DropdownItem, Object.assign({
|
|
228
|
+
onClick: event => {
|
|
229
|
+
onActionClick(event, onClick);
|
|
230
|
+
shouldCloseOnClick && onToggle();
|
|
231
|
+
}
|
|
232
|
+
}, props, {
|
|
233
|
+
key: itemKey || index,
|
|
234
|
+
"data-key": itemKey || index,
|
|
235
|
+
ref: index === 0 ? firstActionItemRef : undefined
|
|
236
|
+
}), title);
|
|
237
|
+
|
|
238
|
+
if (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content) {
|
|
239
|
+
return React.createElement(Tooltip, Object.assign({
|
|
240
|
+
key: itemKey || index
|
|
241
|
+
}, tooltipProps), item);
|
|
242
|
+
} else {
|
|
243
|
+
return item;
|
|
244
|
+
}
|
|
245
|
+
}))));
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const ActionsColumn = React.forwardRef((props, ref) => React.createElement(ActionsColumnBase, Object.assign({}, props, {
|
|
249
|
+
innerRef: ref
|
|
250
|
+
})));
|
|
251
|
+
ActionsColumn.displayName = 'ActionsColumn';
|
|
252
|
+
|
|
253
|
+
const AngleDownIconConfig = {
|
|
254
|
+
name: 'AngleDownIcon',
|
|
255
|
+
height: 512,
|
|
256
|
+
width: 320,
|
|
257
|
+
svgPath: 'M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z',
|
|
258
|
+
yOffset: 0,
|
|
259
|
+
xOffset: 0
|
|
64
260
|
};
|
|
261
|
+
const AngleDownIcon = createIcon(AngleDownIconConfig);
|
|
262
|
+
var AngleDownIcon$1 = AngleDownIcon;
|
|
65
263
|
|
|
66
264
|
/** Joins args into a className string
|
|
67
265
|
*
|
|
@@ -93,9 +291,11 @@ function css(...args) {
|
|
|
93
291
|
return classes.join(' ');
|
|
94
292
|
}
|
|
95
293
|
|
|
96
|
-
import('./table-68d022f9.js');
|
|
97
294
|
var styles$1 = {
|
|
98
|
-
"button": "pf-c-button",
|
|
295
|
+
"button": "pf-v5-c-button",
|
|
296
|
+
"check": "pf-v5-c-check",
|
|
297
|
+
"checkInput": "pf-v5-c-check__input",
|
|
298
|
+
"dirRtl": "pf-v5-m-dir-rtl",
|
|
99
299
|
"modifiers": {
|
|
100
300
|
"hidden": "pf-m-hidden",
|
|
101
301
|
"hiddenOnSm": "pf-m-hidden-on-sm",
|
|
@@ -110,6 +310,8 @@ var styles$1 = {
|
|
|
110
310
|
"visibleOn_2xl": "pf-m-visible-on-2xl",
|
|
111
311
|
"fixed": "pf-m-fixed",
|
|
112
312
|
"stickyHeader": "pf-m-sticky-header",
|
|
313
|
+
"nestedColumnHeader": "pf-m-nested-column-header",
|
|
314
|
+
"borderRow": "pf-m-border-row",
|
|
113
315
|
"striped": "pf-m-striped",
|
|
114
316
|
"expandable": "pf-m-expandable",
|
|
115
317
|
"stripedEven": "pf-m-striped-even",
|
|
@@ -119,18 +321,18 @@ var styles$1 = {
|
|
|
119
321
|
"favorite": "pf-m-favorite",
|
|
120
322
|
"borderRight": "pf-m-border-right",
|
|
121
323
|
"borderLeft": "pf-m-border-left",
|
|
122
|
-
"
|
|
324
|
+
"expanded": "pf-m-expanded",
|
|
123
325
|
"truncate": "pf-m-truncate",
|
|
124
326
|
"wrap": "pf-m-wrap",
|
|
125
327
|
"nowrap": "pf-m-nowrap",
|
|
126
328
|
"fitContent": "pf-m-fit-content",
|
|
127
329
|
"breakWord": "pf-m-break-word",
|
|
128
330
|
"noBorderRows": "pf-m-no-border-rows",
|
|
129
|
-
"
|
|
130
|
-
"hoverable": "pf-m-hoverable",
|
|
331
|
+
"clickable": "pf-m-clickable",
|
|
131
332
|
"selected": "pf-m-selected",
|
|
132
333
|
"firstCellOffsetReset": "pf-m-first-cell-offset-reset",
|
|
133
334
|
"dragOver": "pf-m-drag-over",
|
|
335
|
+
"standalone": "pf-m-standalone",
|
|
134
336
|
"favorited": "pf-m-favorited",
|
|
135
337
|
"noPadding": "pf-m-no-padding",
|
|
136
338
|
"compact": "pf-m-compact",
|
|
@@ -149,552 +351,412 @@ var styles$1 = {
|
|
|
149
351
|
"width_90": "pf-m-width-90",
|
|
150
352
|
"width_100": "pf-m-width-100"
|
|
151
353
|
},
|
|
152
|
-
"table": "pf-c-table",
|
|
153
|
-
"tableAction": "pf-c-table__action",
|
|
154
|
-
"tableButton": "pf-c-table__button",
|
|
155
|
-
"tableButtonContent": "pf-c-table__button-content",
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
354
|
+
"table": "pf-v5-c-table",
|
|
355
|
+
"tableAction": "pf-v5-c-table__action",
|
|
356
|
+
"tableButton": "pf-v5-c-table__button",
|
|
357
|
+
"tableButtonContent": "pf-v5-c-table__button-content",
|
|
358
|
+
"tableCaption": "pf-v5-c-table__caption",
|
|
359
|
+
"tableCheck": "pf-v5-c-table__check",
|
|
360
|
+
"tableColumnHelp": "pf-v5-c-table__column-help",
|
|
361
|
+
"tableColumnHelpAction": "pf-v5-c-table__column-help-action",
|
|
362
|
+
"tableCompoundExpansionToggle": "pf-v5-c-table__compound-expansion-toggle",
|
|
363
|
+
"tableControlRow": "pf-v5-c-table__control-row",
|
|
364
|
+
"tableDraggable": "pf-v5-c-table__draggable",
|
|
365
|
+
"tableExpandableRow": "pf-v5-c-table__expandable-row",
|
|
366
|
+
"tableExpandableRowContent": "pf-v5-c-table__expandable-row-content",
|
|
367
|
+
"tableFavorite": "pf-v5-c-table__favorite",
|
|
368
|
+
"tableIcon": "pf-v5-c-table__icon",
|
|
369
|
+
"tableIconInline": "pf-v5-c-table__icon-inline",
|
|
370
|
+
"tableInlineEditAction": "pf-v5-c-table__inline-edit-action",
|
|
371
|
+
"tableSort": "pf-v5-c-table__sort",
|
|
372
|
+
"tableSortIndicator": "pf-v5-c-table__sort-indicator",
|
|
373
|
+
"tableSubhead": "pf-v5-c-table__subhead",
|
|
374
|
+
"tableTbody": "pf-v5-c-table__tbody",
|
|
375
|
+
"tableTd": "pf-v5-c-table__td",
|
|
376
|
+
"tableText": "pf-v5-c-table__text",
|
|
377
|
+
"tableTh": "pf-v5-c-table__th",
|
|
378
|
+
"tableThead": "pf-v5-c-table__thead",
|
|
379
|
+
"tableToggle": "pf-v5-c-table__toggle",
|
|
380
|
+
"tableToggleIcon": "pf-v5-c-table__toggle-icon",
|
|
381
|
+
"tableTr": "pf-v5-c-table__tr",
|
|
382
|
+
"themeDark": "pf-v5-theme-dark"
|
|
175
383
|
};
|
|
176
384
|
|
|
177
|
-
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
"noPadding": "pf-m-no-padding",
|
|
186
|
-
"hoverable": "pf-m-hoverable",
|
|
187
|
-
"nowrap": "pf-m-nowrap",
|
|
188
|
-
"fitContent": "pf-m-fit-content",
|
|
189
|
-
"truncate": "pf-m-truncate",
|
|
190
|
-
"gridMd": "pf-m-grid-md",
|
|
191
|
-
"gridLg": "pf-m-grid-lg",
|
|
192
|
-
"gridXl": "pf-m-grid-xl",
|
|
193
|
-
"grid_2xl": "pf-m-grid-2xl"
|
|
194
|
-
},
|
|
195
|
-
"table": "pf-c-table",
|
|
196
|
-
"tableAction": "pf-c-table__action",
|
|
197
|
-
"tableButton": "pf-c-table__button",
|
|
198
|
-
"tableCheck": "pf-c-table__check",
|
|
199
|
-
"tableCompoundExpansionToggle": "pf-c-table__compound-expansion-toggle",
|
|
200
|
-
"tableExpandableRow": "pf-c-table__expandable-row",
|
|
201
|
-
"tableExpandableRowContent": "pf-c-table__expandable-row-content",
|
|
202
|
-
"tableFavorite": "pf-c-table__favorite",
|
|
203
|
-
"tableIcon": "pf-c-table__icon",
|
|
204
|
-
"tableInlineEditAction": "pf-c-table__inline-edit-action",
|
|
205
|
-
"tableText": "pf-c-table__text",
|
|
206
|
-
"tableToggle": "pf-c-table__toggle",
|
|
207
|
-
"tableToggleIcon": "pf-c-table__toggle-icon"
|
|
208
|
-
};
|
|
385
|
+
const CollapseColumn = _a => {
|
|
386
|
+
var {
|
|
387
|
+
className = '',
|
|
388
|
+
children = null,
|
|
389
|
+
isOpen,
|
|
390
|
+
onToggle
|
|
391
|
+
} = _a,
|
|
392
|
+
props = __rest$1(_a, ["className", "children", "isOpen", "onToggle"]);
|
|
209
393
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
"
|
|
215
|
-
|
|
216
|
-
"
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
"treeViewGrid_2xl": "pf-m-tree-view-grid-2xl"
|
|
221
|
-
},
|
|
222
|
-
"table": "pf-c-table",
|
|
223
|
-
"tableAction": "pf-c-table__action",
|
|
224
|
-
"tableCheck": "pf-c-table__check",
|
|
225
|
-
"tableToggle": "pf-c-table__toggle",
|
|
226
|
-
"tableToggleIcon": "pf-c-table__toggle-icon",
|
|
227
|
-
"tableTreeViewDetailsToggle": "pf-c-table__tree-view-details-toggle",
|
|
228
|
-
"tableTreeViewIcon": "pf-c-table__tree-view-icon",
|
|
229
|
-
"tableTreeViewMain": "pf-c-table__tree-view-main",
|
|
230
|
-
"tableTreeViewText": "pf-c-table__tree-view-text",
|
|
231
|
-
"tableTreeViewTitleCell": "pf-c-table__tree-view-title-cell",
|
|
232
|
-
"tableTreeViewTitleHeaderCell": "pf-c-table__tree-view-title-header-cell"
|
|
394
|
+
return React.createElement(React.Fragment, null, isOpen !== undefined && React.createElement(Button, Object.assign({
|
|
395
|
+
className: css(className, isOpen && styles$1.modifiers.expanded)
|
|
396
|
+
}, props, {
|
|
397
|
+
variant: "plain",
|
|
398
|
+
"aria-label": props['aria-label'] || 'Details',
|
|
399
|
+
onClick: onToggle,
|
|
400
|
+
"aria-expanded": isOpen
|
|
401
|
+
}), React.createElement("div", {
|
|
402
|
+
className: css(styles$1.tableToggleIcon)
|
|
403
|
+
}, React.createElement(AngleDownIcon$1, null))), children);
|
|
233
404
|
};
|
|
405
|
+
CollapseColumn.displayName = 'CollapseColumn';
|
|
234
406
|
|
|
235
|
-
const
|
|
407
|
+
const GripVerticalIconConfig = {
|
|
408
|
+
name: 'GripVerticalIcon',
|
|
409
|
+
height: 512,
|
|
410
|
+
width: 320,
|
|
411
|
+
svgPath: 'M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z',
|
|
412
|
+
yOffset: 0,
|
|
413
|
+
xOffset: 0
|
|
414
|
+
};
|
|
415
|
+
const GripVerticalIcon = createIcon(GripVerticalIconConfig);
|
|
416
|
+
var GripVerticalIcon$1 = GripVerticalIcon;
|
|
236
417
|
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
418
|
+
const DraggableCell = _a => {
|
|
419
|
+
var {
|
|
420
|
+
className,
|
|
421
|
+
onClick,
|
|
422
|
+
'aria-label': ariaLabel,
|
|
423
|
+
id
|
|
424
|
+
} = _a,
|
|
425
|
+
props = __rest$1(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
241
426
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
427
|
+
return React.createElement(Button, Object.assign({
|
|
428
|
+
id: id,
|
|
429
|
+
variant: "plain",
|
|
430
|
+
className: className,
|
|
431
|
+
type: "button",
|
|
432
|
+
"aria-label": ariaLabel || `Draggable row draggable button`,
|
|
433
|
+
onClick: onClick
|
|
434
|
+
}, props), React.createElement(GripVerticalIcon$1, {
|
|
435
|
+
"aria-hidden": true
|
|
436
|
+
}));
|
|
437
|
+
};
|
|
438
|
+
DraggableCell.displayName = 'DraggableCell';
|
|
245
439
|
|
|
246
|
-
var
|
|
440
|
+
var inlineStyles = {
|
|
441
|
+
"button": "pf-v5-c-button",
|
|
442
|
+
"inlineEdit": "pf-v5-c-inline-edit",
|
|
443
|
+
"inlineEditAction": "pf-v5-c-inline-edit__action",
|
|
444
|
+
"inlineEditEditableText": "pf-v5-c-inline-edit__editable-text",
|
|
445
|
+
"inlineEditGroup": "pf-v5-c-inline-edit__group",
|
|
446
|
+
"inlineEditInput": "pf-v5-c-inline-edit__input",
|
|
447
|
+
"inlineEditLabel": "pf-v5-c-inline-edit__label",
|
|
448
|
+
"inlineEditValue": "pf-v5-c-inline-edit__value",
|
|
449
|
+
"modifiers": {
|
|
450
|
+
"iconGroup": "pf-m-icon-group",
|
|
451
|
+
"footer": "pf-m-footer",
|
|
452
|
+
"column": "pf-m-column",
|
|
453
|
+
"valid": "pf-m-valid",
|
|
454
|
+
"plain": "pf-m-plain",
|
|
455
|
+
"actionGroup": "pf-m-action-group",
|
|
456
|
+
"enableEditable": "pf-m-enable-editable",
|
|
457
|
+
"inlineEditable": "pf-m-inline-editable",
|
|
458
|
+
"enable": "pf-m-enable",
|
|
459
|
+
"bold": "pf-m-bold"
|
|
460
|
+
}
|
|
461
|
+
};
|
|
247
462
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
463
|
+
const HelpIconConfig = {
|
|
464
|
+
name: 'HelpIcon',
|
|
465
|
+
height: 1024,
|
|
466
|
+
width: 1024,
|
|
467
|
+
svgPath: 'M521.3,576 C627.5,576 713.7,502 713.7,413.7 C713.7,325.4 627.6,253.6 521.3,253.6 C366,253.6 334.5,337.7 329.2,407.2 C329.2,414.3 335.2,416 343.5,416 L445,416 C450.5,416 458,415.5 460.8,406.5 C460.8,362.6 582.9,357.1 582.9,413.6 C582.9,441.9 556.2,470.9 521.3,473 C486.4,475.1 447.3,479.8 447.3,521.7 L447.3,553.8 C447.3,570.8 456.1,576 472,576 C487.9,576 521.3,576 521.3,576 M575.3,751.3 L575.3,655.3 C575.313862,651.055109 573.620137,646.982962 570.6,644 C567.638831,640.947672 563.552355,639.247987 559.3,639.29884 L463.3,639.29884 C459.055109,639.286138 454.982962,640.979863 452,644 C448.947672,646.961169 447.247987,651.047645 447.29884,655.3 L447.29884,751.3 C447.286138,755.544891 448.979863,759.617038 452,762.6 C454.961169,765.652328 459.047645,767.352013 463.3,767.30116 L559.3,767.30116 C563.544891,767.313862 567.617038,765.620137 570.6,762.6 C573.659349,759.643612 575.360354,755.553963 575.3,751.3 M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.8,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 M512.1,0 C229.7,0 0,229.8 0,512 C0,794.2 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0',
|
|
468
|
+
yOffset: 0,
|
|
469
|
+
xOffset: 0
|
|
470
|
+
};
|
|
471
|
+
const HelpIcon = createIcon(HelpIconConfig);
|
|
472
|
+
var HelpIcon$1 = HelpIcon;
|
|
256
473
|
|
|
257
|
-
var
|
|
474
|
+
var TableTextVariant;
|
|
258
475
|
|
|
259
|
-
(function (
|
|
260
|
-
|
|
261
|
-
|
|
476
|
+
(function (TableTextVariant) {
|
|
477
|
+
TableTextVariant["div"] = "div";
|
|
478
|
+
TableTextVariant["nav"] = "nav";
|
|
479
|
+
})(TableTextVariant || (TableTextVariant = {}));
|
|
262
480
|
|
|
263
|
-
|
|
264
|
-
registerSelectableRow: () => {}
|
|
265
|
-
});
|
|
481
|
+
var WrapModifier;
|
|
266
482
|
|
|
267
|
-
|
|
268
|
-
|
|
483
|
+
(function (WrapModifier) {
|
|
484
|
+
WrapModifier["wrap"] = "wrap";
|
|
485
|
+
WrapModifier["nowrap"] = "nowrap";
|
|
486
|
+
WrapModifier["truncate"] = "truncate";
|
|
487
|
+
WrapModifier["breakWord"] = "breakWord";
|
|
488
|
+
WrapModifier["fitContent"] = "fitContent";
|
|
489
|
+
})(WrapModifier || (WrapModifier = {}));
|
|
269
490
|
|
|
491
|
+
const TableText = _a => {
|
|
270
492
|
var {
|
|
271
|
-
children,
|
|
272
|
-
className,
|
|
273
|
-
variant,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
ouiaId,
|
|
281
|
-
ouiaSafe = true,
|
|
282
|
-
isTreeTable = false,
|
|
283
|
-
isNested = false,
|
|
284
|
-
isStriped = false,
|
|
285
|
-
isExpandable = false,
|
|
286
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
287
|
-
nestedHeaderColumnSpans,
|
|
288
|
-
hasSelectableRowCaption,
|
|
289
|
-
selectableRowCaptionText
|
|
493
|
+
children = null,
|
|
494
|
+
className = '',
|
|
495
|
+
variant = 'span',
|
|
496
|
+
wrapModifier = null,
|
|
497
|
+
tooltip: tooltipProp = '',
|
|
498
|
+
tooltipProps = {},
|
|
499
|
+
onMouseEnter: onMouseEnterProp = () => {},
|
|
500
|
+
focused = false,
|
|
501
|
+
tooltipHasDefaultBehavior = false
|
|
290
502
|
} = _a,
|
|
291
|
-
props = __rest(_a, ["children", "className", "variant", "
|
|
292
|
-
|
|
293
|
-
const tableRef = innerRef || React.useRef(null);
|
|
294
|
-
const [hasSelectableRows, setHasSelectableRows] = React.useState(false);
|
|
295
|
-
const [tableCaption, setTableCaption] = React.useState();
|
|
296
|
-
React.useEffect(() => {
|
|
297
|
-
document.addEventListener('keydown', handleKeys); // sets up roving tab-index to tree tables only
|
|
503
|
+
props = __rest$1(_a, ["children", "className", "variant", "wrapModifier", "tooltip", "tooltipProps", "onMouseEnter", "focused", "tooltipHasDefaultBehavior"]);
|
|
298
504
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
505
|
+
const Component = variant;
|
|
506
|
+
const textRef = React.createRef();
|
|
507
|
+
const [tooltip, setTooltip] = React.useState(tooltipProp);
|
|
303
508
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}, [tableRef, tableRef.current]);
|
|
308
|
-
React.useEffect(() => {
|
|
309
|
-
if (selectableRowCaptionText) {
|
|
310
|
-
setTableCaption(React.createElement("caption", null, selectableRowCaptionText, React.createElement("div", {
|
|
311
|
-
className: "pf-screen-reader"
|
|
312
|
-
}, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter.")));
|
|
509
|
+
const onMouseEnter = event => {
|
|
510
|
+
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
511
|
+
setTooltip(tooltipProp || event.target.innerText);
|
|
313
512
|
} else {
|
|
314
|
-
|
|
315
|
-
className: "pf-screen-reader"
|
|
316
|
-
}, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter."));
|
|
317
|
-
}
|
|
318
|
-
}, [selectableRowCaptionText]);
|
|
319
|
-
const ouiaProps = useOUIAProps('Table', ouiaId, ouiaSafe);
|
|
320
|
-
const grid = (_b = stylesGrid.modifiers) === null || _b === void 0 ? void 0 : _b[toCamel(gridBreakPoint || '').replace(/-?2xl/, '_2xl')];
|
|
321
|
-
const breakPointPrefix = `treeView${gridBreakPoint.charAt(0).toUpperCase() + gridBreakPoint.slice(1)}`;
|
|
322
|
-
const treeGrid = (_c = stylesTreeView.modifiers) === null || _c === void 0 ? void 0 : _c[toCamel(breakPointPrefix || '').replace(/-?2xl/, '_2xl')];
|
|
323
|
-
|
|
324
|
-
const handleKeys = event => {
|
|
325
|
-
if (isNested || !(tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) || // implements roving tab-index to tree tables only
|
|
326
|
-
tableRef && tableRef.current !== event.target.closest('.pf-c-table:not(.pf-m-nested)')) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const activeElement = document.activeElement;
|
|
331
|
-
const key = event.key;
|
|
332
|
-
const rows = Array.from(tableRef.current.querySelectorAll('tbody tr')).filter(el => !el.classList.contains('pf-m-disabled') && !el.hidden);
|
|
333
|
-
|
|
334
|
-
if (key === 'Space' || key === 'Enter') {
|
|
335
|
-
activeElement.click();
|
|
336
|
-
event.preventDefault();
|
|
513
|
+
setTooltip('');
|
|
337
514
|
}
|
|
338
515
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
handleArrows(event, rows, element => element === activeElement.closest('tr'), getFocusableElement, ['button', 'input', 'a'], undefined, false, true, false);
|
|
516
|
+
onMouseEnterProp(event);
|
|
342
517
|
};
|
|
343
518
|
|
|
344
|
-
const
|
|
345
|
-
|
|
519
|
+
const onFocus = element => {
|
|
520
|
+
if (element.offsetWidth < element.scrollWidth) {
|
|
521
|
+
setTooltip(tooltipProp || element.innerText);
|
|
522
|
+
} else {
|
|
523
|
+
setTooltip('');
|
|
524
|
+
}
|
|
346
525
|
};
|
|
347
526
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
527
|
+
const text = React.createElement(Component, Object.assign({
|
|
528
|
+
ref: textRef,
|
|
529
|
+
onMouseEnter: !tooltipHasDefaultBehavior ? onMouseEnter : undefined,
|
|
530
|
+
className: css(className, wrapModifier && styles$1.modifiers[wrapModifier], styles$1.tableText)
|
|
531
|
+
}, props), children);
|
|
532
|
+
React.useEffect(() => {
|
|
533
|
+
if (!tooltipHasDefaultBehavior) {
|
|
534
|
+
if (focused) {
|
|
535
|
+
onFocus(textRef.current);
|
|
536
|
+
} else {
|
|
537
|
+
setTooltip('');
|
|
538
|
+
}
|
|
351
539
|
}
|
|
352
|
-
},
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}, ouiaProps, props), hasSelectableRowCaption && hasSelectableRows && tableCaption, children));
|
|
540
|
+
}, [focused, tooltipHasDefaultBehavior]);
|
|
541
|
+
return tooltip !== '' ? React.createElement(Tooltip, Object.assign({
|
|
542
|
+
triggerRef: textRef,
|
|
543
|
+
content: tooltip
|
|
544
|
+
}, !tooltipHasDefaultBehavior && {
|
|
545
|
+
isVisible: true
|
|
546
|
+
}, tooltipProps), text) : text;
|
|
360
547
|
};
|
|
548
|
+
TableText.displayName = 'TableText';
|
|
361
549
|
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
550
|
+
const HeaderCellInfoWrapper = ({
|
|
551
|
+
children,
|
|
552
|
+
info,
|
|
553
|
+
className,
|
|
554
|
+
variant: _variant = 'tooltip',
|
|
555
|
+
popoverProps,
|
|
556
|
+
tooltipProps,
|
|
557
|
+
ariaLabel
|
|
558
|
+
}) => React.createElement("div", {
|
|
559
|
+
className: css(styles$1.tableColumnHelp, className)
|
|
560
|
+
}, typeof children === 'string' ? React.createElement(TableText, null, children) : children, React.createElement("span", {
|
|
561
|
+
className: css(styles$1.tableColumnHelpAction)
|
|
562
|
+
}, _variant === 'tooltip' ? React.createElement(Tooltip, Object.assign({
|
|
563
|
+
content: info
|
|
564
|
+
}, tooltipProps), React.createElement(Button, {
|
|
565
|
+
variant: "plain",
|
|
566
|
+
"aria-label": ariaLabel || typeof info === 'string' && info || 'More info'
|
|
567
|
+
}, React.createElement(HelpIcon$1, null))) : React.createElement(Popover, Object.assign({
|
|
568
|
+
bodyContent: info
|
|
569
|
+
}, popoverProps), React.createElement(Button, {
|
|
570
|
+
variant: "plain",
|
|
571
|
+
"aria-label": ariaLabel || typeof info === 'string' && info || 'More info'
|
|
572
|
+
}, React.createElement(HelpIcon$1, null)))));
|
|
573
|
+
HeaderCellInfoWrapper.displayName = 'HeaderCellInfoWrapper';
|
|
366
574
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
575
|
+
var stylesGrid = {
|
|
576
|
+
"button": "pf-v5-c-button",
|
|
577
|
+
"modifiers": {
|
|
578
|
+
"grid": "pf-m-grid",
|
|
579
|
+
"compact": "pf-m-compact",
|
|
580
|
+
"expanded": "pf-m-expanded",
|
|
581
|
+
"selected": "pf-m-selected",
|
|
582
|
+
"noPadding": "pf-m-no-padding",
|
|
583
|
+
"hoverable": "pf-m-hoverable",
|
|
584
|
+
"nowrap": "pf-m-nowrap",
|
|
585
|
+
"fitContent": "pf-m-fit-content",
|
|
586
|
+
"truncate": "pf-m-truncate",
|
|
587
|
+
"gridMd": "pf-m-grid-md",
|
|
588
|
+
"gridLg": "pf-m-grid-lg",
|
|
589
|
+
"gridXl": "pf-m-grid-xl",
|
|
590
|
+
"grid_2xl": "pf-m-grid-2xl"
|
|
591
|
+
},
|
|
592
|
+
"table": "pf-v5-c-table",
|
|
593
|
+
"tableAction": "pf-v5-c-table__action",
|
|
594
|
+
"tableButton": "pf-v5-c-table__button",
|
|
595
|
+
"tableCheck": "pf-v5-c-table__check",
|
|
596
|
+
"tableCompoundExpansionToggle": "pf-v5-c-table__compound-expansion-toggle",
|
|
597
|
+
"tableExpandableRow": "pf-v5-c-table__expandable-row",
|
|
598
|
+
"tableExpandableRowContent": "pf-v5-c-table__expandable-row-content",
|
|
599
|
+
"tableFavorite": "pf-v5-c-table__favorite",
|
|
600
|
+
"tableIcon": "pf-v5-c-table__icon",
|
|
601
|
+
"tableInlineEditAction": "pf-v5-c-table__inline-edit-action",
|
|
602
|
+
"tableTbody": "pf-v5-c-table__tbody",
|
|
603
|
+
"tableTd": "pf-v5-c-table__td",
|
|
604
|
+
"tableText": "pf-v5-c-table__text",
|
|
605
|
+
"tableTh": "pf-v5-c-table__th",
|
|
606
|
+
"tableThead": "pf-v5-c-table__thead",
|
|
607
|
+
"tableToggle": "pf-v5-c-table__toggle",
|
|
608
|
+
"tableToggleIcon": "pf-v5-c-table__toggle-icon",
|
|
609
|
+
"tableTr": "pf-v5-c-table__tr"
|
|
610
|
+
};
|
|
376
611
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
612
|
+
var treeViewStyles = {
|
|
613
|
+
"dirRtl": "pf-v5-m-dir-rtl",
|
|
614
|
+
"dropdown": "pf-v5-c-dropdown",
|
|
615
|
+
"modifiers": {
|
|
616
|
+
"treeView": "pf-m-tree-view",
|
|
617
|
+
"noInset": "pf-m-no-inset",
|
|
618
|
+
"treeViewGrid": "pf-m-tree-view-grid",
|
|
619
|
+
"treeViewDetailsExpanded": "pf-m-tree-view-details-expanded",
|
|
620
|
+
"treeViewGridMd": "pf-m-tree-view-grid-md",
|
|
621
|
+
"treeViewGridLg": "pf-m-tree-view-grid-lg",
|
|
622
|
+
"treeViewGridXl": "pf-m-tree-view-grid-xl",
|
|
623
|
+
"treeViewGrid_2xl": "pf-m-tree-view-grid-2xl"
|
|
624
|
+
},
|
|
625
|
+
"table": "pf-v5-c-table",
|
|
626
|
+
"tableAction": "pf-v5-c-table__action",
|
|
627
|
+
"tableCheck": "pf-v5-c-table__check",
|
|
628
|
+
"tableTbody": "pf-v5-c-table__tbody",
|
|
629
|
+
"tableTd": "pf-v5-c-table__td",
|
|
630
|
+
"tableTh": "pf-v5-c-table__th",
|
|
631
|
+
"tableThead": "pf-v5-c-table__thead",
|
|
632
|
+
"tableToggle": "pf-v5-c-table__toggle",
|
|
633
|
+
"tableToggleIcon": "pf-v5-c-table__toggle-icon",
|
|
634
|
+
"tableTr": "pf-v5-c-table__tr",
|
|
635
|
+
"tableTreeViewDetailsToggle": "pf-v5-c-table__tree-view-details-toggle",
|
|
636
|
+
"tableTreeViewIcon": "pf-v5-c-table__tree-view-icon",
|
|
637
|
+
"tableTreeViewMain": "pf-v5-c-table__tree-view-main",
|
|
638
|
+
"tableTreeViewText": "pf-v5-c-table__tree-view-text",
|
|
639
|
+
"tableTreeViewTitleCell": "pf-v5-c-table__tree-view-title-cell",
|
|
640
|
+
"tableTreeViewTitleHeaderCell": "pf-v5-c-table__tree-view-title-header-cell"
|
|
381
641
|
};
|
|
382
642
|
|
|
383
|
-
|
|
384
|
-
innerRef: ref
|
|
385
|
-
})));
|
|
386
|
-
Thead.displayName = 'Thead';
|
|
643
|
+
var RowSelectVariant;
|
|
387
644
|
|
|
388
|
-
|
|
645
|
+
(function (RowSelectVariant) {
|
|
646
|
+
RowSelectVariant["radio"] = "radio";
|
|
647
|
+
RowSelectVariant["checkbox"] = "checkbox";
|
|
648
|
+
})(RowSelectVariant || (RowSelectVariant = {}));
|
|
649
|
+
|
|
650
|
+
const SelectColumn = _a => {
|
|
389
651
|
var {
|
|
390
|
-
children,
|
|
652
|
+
children = null,
|
|
653
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
391
654
|
className,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
655
|
+
onSelect = null,
|
|
656
|
+
selectVariant,
|
|
657
|
+
tooltip,
|
|
658
|
+
tooltipProps
|
|
396
659
|
} = _a,
|
|
397
|
-
props = __rest(_a, ["children", "className", "
|
|
660
|
+
props = __rest$1(_a, ["children", "className", "onSelect", "selectVariant", "tooltip", "tooltipProps"]);
|
|
398
661
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
662
|
+
const inputRef = React.createRef();
|
|
663
|
+
const content = React.createElement(React.Fragment, null, React.createElement("label", null, React.createElement("input", Object.assign({}, props, {
|
|
664
|
+
ref: inputRef,
|
|
665
|
+
type: selectVariant,
|
|
666
|
+
onChange: onSelect
|
|
667
|
+
}))), children);
|
|
668
|
+
return tooltip ? React.createElement(Tooltip, Object.assign({
|
|
669
|
+
triggerRef: inputRef,
|
|
670
|
+
content: tooltip
|
|
671
|
+
}, tooltipProps), content) : content;
|
|
404
672
|
};
|
|
673
|
+
SelectColumn.displayName = 'SelectColumn';
|
|
405
674
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
isHoverable = false,
|
|
419
|
-
isRowSelected = false,
|
|
420
|
-
isStriped = false,
|
|
421
|
-
innerRef,
|
|
422
|
-
ouiaId,
|
|
423
|
-
ouiaSafe = true,
|
|
424
|
-
resetOffset = false,
|
|
425
|
-
onRowClick,
|
|
426
|
-
isSelectable,
|
|
427
|
-
'aria-label': passedAriaLabel
|
|
428
|
-
} = _a,
|
|
429
|
-
props = __rest(_a, ["children", "className", "isExpanded", "isEditable", "isHidden", "isHoverable", "isRowSelected", "isStriped", "innerRef", "ouiaId", "ouiaSafe", "resetOffset", "onRowClick", "isSelectable", 'aria-label']);
|
|
675
|
+
var checkStyles = {
|
|
676
|
+
"check": "pf-v5-c-check",
|
|
677
|
+
"checkBody": "pf-v5-c-check__body",
|
|
678
|
+
"checkDescription": "pf-v5-c-check__description",
|
|
679
|
+
"checkInput": "pf-v5-c-check__input",
|
|
680
|
+
"checkLabel": "pf-v5-c-check__label",
|
|
681
|
+
"checkLabelRequired": "pf-v5-c-check__label-required",
|
|
682
|
+
"modifiers": {
|
|
683
|
+
"standalone": "pf-m-standalone",
|
|
684
|
+
"disabled": "pf-m-disabled"
|
|
685
|
+
}
|
|
686
|
+
};
|
|
430
687
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
688
|
+
const selectable = (label, {
|
|
689
|
+
rowIndex,
|
|
690
|
+
columnIndex,
|
|
691
|
+
rowData,
|
|
692
|
+
column,
|
|
693
|
+
property,
|
|
694
|
+
tooltip
|
|
695
|
+
}) => {
|
|
696
|
+
const {
|
|
697
|
+
extraParams: {
|
|
698
|
+
onSelect,
|
|
699
|
+
selectVariant,
|
|
700
|
+
allRowsSelected,
|
|
701
|
+
isHeaderSelectDisabled
|
|
702
|
+
}
|
|
703
|
+
} = column;
|
|
704
|
+
const extraData = {
|
|
705
|
+
rowIndex,
|
|
706
|
+
columnIndex,
|
|
707
|
+
column,
|
|
708
|
+
property
|
|
709
|
+
};
|
|
434
710
|
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
e.preventDefault();
|
|
440
|
-
}
|
|
711
|
+
if (rowData && rowData.hasOwnProperty('parent') && !rowData.showSelect && !rowData.fullWidth) {
|
|
712
|
+
return {
|
|
713
|
+
component: 'td',
|
|
714
|
+
isVisible: true
|
|
441
715
|
};
|
|
442
716
|
}
|
|
443
717
|
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
React.useEffect(() => {
|
|
449
|
-
if (isSelectable && !rowIsHidden) {
|
|
450
|
-
setComputedAriaLabel(`${isRowSelected ? 'Selected' : 'Unselected'}, selectable row.`);
|
|
451
|
-
registerSelectableRow();
|
|
452
|
-
} else {
|
|
453
|
-
setComputedAriaLabel(undefined);
|
|
454
|
-
}
|
|
455
|
-
}, [isRowSelected, isSelectable, registerSelectableRow, rowIsHidden]);
|
|
456
|
-
const ariaLabel = passedAriaLabel || computedAriaLabel;
|
|
457
|
-
return React.createElement(React.Fragment, null, isSelectable && React.createElement("output", {
|
|
458
|
-
className: "pf-screen-reader"
|
|
459
|
-
}, ariaLabel), React.createElement("tr", Object.assign({
|
|
460
|
-
className: css(className, isExpanded !== undefined && styles$1.tableExpandableRow, isExpanded && styles$1.modifiers.expanded, isEditable && inlineStyles.modifiers.inlineEditable, isHoverable && styles$1.modifiers.hoverable, isRowSelected && styles$1.modifiers.selected, isStriped && styles$1.modifiers.striped, resetOffset && styles$1.modifiers.firstCellOffsetReset),
|
|
461
|
-
hidden: rowIsHidden
|
|
462
|
-
}, isHoverable && {
|
|
463
|
-
tabIndex: 0
|
|
464
|
-
}, {
|
|
465
|
-
"aria-label": ariaLabel,
|
|
466
|
-
ref: innerRef
|
|
467
|
-
}, onRowClick && {
|
|
468
|
-
onClick: onRowClick,
|
|
469
|
-
onKeyDown
|
|
470
|
-
}, ouiaProps, props), children));
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
const Tr = React.forwardRef((props, ref) => React.createElement(TrBase, Object.assign({}, props, {
|
|
474
|
-
innerRef: ref
|
|
475
|
-
})));
|
|
476
|
-
Tr.displayName = 'Tr';
|
|
477
|
-
|
|
478
|
-
import('./table-scrollable-08a401e0.js');
|
|
479
|
-
var styles = {
|
|
480
|
-
"modifiers": {
|
|
481
|
-
"borderRight": "pf-m-border-right",
|
|
482
|
-
"borderLeft": "pf-m-border-left",
|
|
483
|
-
"stickyHeader": "pf-m-sticky-header"
|
|
484
|
-
},
|
|
485
|
-
"scrollInnerWrapper": "pf-c-scroll-inner-wrapper",
|
|
486
|
-
"scrollOuterWrapper": "pf-c-scroll-outer-wrapper",
|
|
487
|
-
"table": "pf-c-table",
|
|
488
|
-
"tableStickyColumn": "pf-c-table__sticky-column"
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
var IconSize;
|
|
492
|
-
|
|
493
|
-
(function (IconSize) {
|
|
494
|
-
IconSize["sm"] = "sm";
|
|
495
|
-
IconSize["md"] = "md";
|
|
496
|
-
IconSize["lg"] = "lg";
|
|
497
|
-
IconSize["xl"] = "xl";
|
|
498
|
-
})(IconSize || (IconSize = {}));
|
|
499
|
-
|
|
500
|
-
const getSize = size => {
|
|
501
|
-
switch (size) {
|
|
502
|
-
case IconSize.sm:
|
|
503
|
-
return '1em';
|
|
504
|
-
|
|
505
|
-
case IconSize.md:
|
|
506
|
-
return '1.5em';
|
|
507
|
-
|
|
508
|
-
case IconSize.lg:
|
|
509
|
-
return '2em';
|
|
718
|
+
const rowId = rowIndex !== undefined ? rowIndex : -1;
|
|
719
|
+
/**
|
|
720
|
+
* @param {React.FormEvent} event - React form event
|
|
721
|
+
*/
|
|
510
722
|
|
|
511
|
-
|
|
512
|
-
|
|
723
|
+
function selectClick(event) {
|
|
724
|
+
const selected = rowIndex === undefined ? event.currentTarget.checked : rowData && !rowData.selected; // tslint:disable-next-line:no-unused-expression
|
|
513
725
|
|
|
514
|
-
|
|
515
|
-
return '1em';
|
|
726
|
+
onSelect && onSelect(event, selected, rowId, rowData, extraData);
|
|
516
727
|
}
|
|
517
|
-
};
|
|
518
|
-
let currentId = 0;
|
|
519
|
-
/**
|
|
520
|
-
* Factory to create Icon class components for consumers
|
|
521
|
-
*/
|
|
522
|
-
|
|
523
|
-
function createIcon({
|
|
524
|
-
name,
|
|
525
|
-
xOffset = 0,
|
|
526
|
-
yOffset = 0,
|
|
527
|
-
width,
|
|
528
|
-
height,
|
|
529
|
-
svgPath
|
|
530
|
-
}) {
|
|
531
|
-
var _a;
|
|
532
|
-
|
|
533
|
-
return _a = class SVGIcon extends React.Component {
|
|
534
|
-
constructor() {
|
|
535
|
-
super(...arguments);
|
|
536
|
-
this.id = `icon-title-${currentId++}`;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
render() {
|
|
540
|
-
const _a = this.props,
|
|
541
|
-
{
|
|
542
|
-
size,
|
|
543
|
-
color,
|
|
544
|
-
title,
|
|
545
|
-
noVerticalAlign
|
|
546
|
-
} = _a,
|
|
547
|
-
props = __rest(_a, ["size", "color", "title", "noVerticalAlign"]);
|
|
548
|
-
|
|
549
|
-
const hasTitle = Boolean(title);
|
|
550
|
-
const heightWidth = getSize(size);
|
|
551
|
-
const baseAlign = -0.125 * Number.parseFloat(heightWidth);
|
|
552
|
-
const style = noVerticalAlign ? null : {
|
|
553
|
-
verticalAlign: `${baseAlign}em`
|
|
554
|
-
};
|
|
555
|
-
const viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
556
|
-
return React.createElement("svg", Object.assign({
|
|
557
|
-
style: style,
|
|
558
|
-
fill: color,
|
|
559
|
-
height: heightWidth,
|
|
560
|
-
width: heightWidth,
|
|
561
|
-
viewBox: viewBox,
|
|
562
|
-
"aria-labelledby": hasTitle ? this.id : null,
|
|
563
|
-
"aria-hidden": hasTitle ? null : true,
|
|
564
|
-
role: "img"
|
|
565
|
-
}, props), hasTitle && React.createElement("title", {
|
|
566
|
-
id: this.id
|
|
567
|
-
}, title), React.createElement("path", {
|
|
568
|
-
d: svgPath
|
|
569
|
-
}));
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
}, _a.displayName = name, _a.defaultProps = {
|
|
573
|
-
color: 'currentColor',
|
|
574
|
-
size: IconSize.sm,
|
|
575
|
-
noVerticalAlign: false
|
|
576
|
-
}, _a;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
const HelpIconConfig = {
|
|
580
|
-
name: 'HelpIcon',
|
|
581
|
-
height: 1024,
|
|
582
|
-
width: 1024,
|
|
583
|
-
svgPath: 'M521.3,576 C627.5,576 713.7,502 713.7,413.7 C713.7,325.4 627.6,253.6 521.3,253.6 C366,253.6 334.5,337.7 329.2,407.2 C329.2,414.3 335.2,416 343.5,416 L445,416 C450.5,416 458,415.5 460.8,406.5 C460.8,362.6 582.9,357.1 582.9,413.6 C582.9,441.9 556.2,470.9 521.3,473 C486.4,475.1 447.3,479.8 447.3,521.7 L447.3,553.8 C447.3,570.8 456.1,576 472,576 C487.9,576 521.3,576 521.3,576 M575.3,751.3 L575.3,655.3 C575.313862,651.055109 573.620137,646.982962 570.6,644 C567.638831,640.947672 563.552355,639.247987 559.3,639.29884 L463.3,639.29884 C459.055109,639.286138 454.982962,640.979863 452,644 C448.947672,646.961169 447.247987,651.047645 447.29884,655.3 L447.29884,751.3 C447.286138,755.544891 448.979863,759.617038 452,762.6 C454.961169,765.652328 459.047645,767.352013 463.3,767.30116 L559.3,767.30116 C563.544891,767.313862 567.617038,765.620137 570.6,762.6 C573.659349,759.643612 575.360354,755.553963 575.3,751.3 M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.8,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 M512.1,0 C229.7,0 0,229.8 0,512 C0,794.2 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0',
|
|
584
|
-
yOffset: 0,
|
|
585
|
-
xOffset: 0
|
|
586
|
-
};
|
|
587
|
-
const HelpIcon = createIcon(HelpIconConfig);
|
|
588
|
-
var HelpIcon$1 = HelpIcon;
|
|
589
|
-
|
|
590
|
-
var TableTextVariant;
|
|
591
|
-
|
|
592
|
-
(function (TableTextVariant) {
|
|
593
|
-
TableTextVariant["div"] = "div";
|
|
594
|
-
TableTextVariant["nav"] = "nav";
|
|
595
|
-
})(TableTextVariant || (TableTextVariant = {}));
|
|
596
|
-
|
|
597
|
-
var WrapModifier;
|
|
598
|
-
|
|
599
|
-
(function (WrapModifier) {
|
|
600
|
-
WrapModifier["wrap"] = "wrap";
|
|
601
|
-
WrapModifier["nowrap"] = "nowrap";
|
|
602
|
-
WrapModifier["truncate"] = "truncate";
|
|
603
|
-
WrapModifier["breakWord"] = "breakWord";
|
|
604
|
-
WrapModifier["fitContent"] = "fitContent";
|
|
605
|
-
})(WrapModifier || (WrapModifier = {}));
|
|
606
|
-
|
|
607
|
-
const TableText = _a => {
|
|
608
|
-
var {
|
|
609
|
-
children = null,
|
|
610
|
-
className = '',
|
|
611
|
-
variant = 'span',
|
|
612
|
-
wrapModifier = null,
|
|
613
|
-
tooltip: tooltipProp = '',
|
|
614
|
-
tooltipProps = {},
|
|
615
|
-
onMouseEnter: onMouseEnterProp = () => {}
|
|
616
|
-
} = _a,
|
|
617
|
-
props = __rest(_a, ["children", "className", "variant", "wrapModifier", "tooltip", "tooltipProps", "onMouseEnter"]);
|
|
618
728
|
|
|
619
|
-
const
|
|
620
|
-
|
|
729
|
+
const customProps = Object.assign(Object.assign(Object.assign({}, rowId !== -1 ? {
|
|
730
|
+
checked: rowData && !!rowData.selected,
|
|
731
|
+
'aria-label': `Select row ${rowIndex}`
|
|
732
|
+
} : {
|
|
733
|
+
checked: allRowsSelected,
|
|
734
|
+
'aria-label': 'Select all rows'
|
|
735
|
+
}), rowData && (rowData.disableCheckbox || rowData.disableSelection) && {
|
|
736
|
+
disabled: true,
|
|
737
|
+
className: checkStyles.checkInput
|
|
738
|
+
}), !rowData && isHeaderSelectDisabled && {
|
|
739
|
+
disabled: true
|
|
740
|
+
});
|
|
741
|
+
let selectName = 'check-all';
|
|
621
742
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
743
|
+
if (rowId !== -1 && selectVariant === RowSelectVariant.checkbox) {
|
|
744
|
+
selectName = `checkrow${rowIndex}`;
|
|
745
|
+
} else if (rowId !== -1) {
|
|
746
|
+
selectName = 'radioGroup';
|
|
747
|
+
}
|
|
628
748
|
|
|
629
|
-
|
|
749
|
+
return {
|
|
750
|
+
className: css(styles$1.tableCheck),
|
|
751
|
+
component: rowId !== -1 ? 'td' : 'th',
|
|
752
|
+
isVisible: !rowData || !rowData.fullWidth,
|
|
753
|
+
children: React.createElement(SelectColumn, Object.assign({}, customProps, {
|
|
754
|
+
selectVariant: selectVariant,
|
|
755
|
+
onSelect: selectClick,
|
|
756
|
+
name: selectName,
|
|
757
|
+
tooltip: tooltip
|
|
758
|
+
}), label)
|
|
630
759
|
};
|
|
631
|
-
|
|
632
|
-
const text = React.createElement(Component, Object.assign({
|
|
633
|
-
onMouseEnter: onMouseEnter,
|
|
634
|
-
className: css(className, wrapModifier && styles$1.modifiers[wrapModifier], styles$1.tableText)
|
|
635
|
-
}, props), children);
|
|
636
|
-
return tooltip !== '' ? React.createElement(Tooltip, Object.assign({
|
|
637
|
-
content: tooltip,
|
|
638
|
-
isVisible: true
|
|
639
|
-
}, tooltipProps), text) : text;
|
|
640
|
-
};
|
|
641
|
-
TableText.displayName = 'TableText';
|
|
642
|
-
|
|
643
|
-
const HeaderCellInfoWrapper = ({
|
|
644
|
-
children,
|
|
645
|
-
info,
|
|
646
|
-
className,
|
|
647
|
-
variant: _variant = 'tooltip',
|
|
648
|
-
popoverProps,
|
|
649
|
-
tooltipProps,
|
|
650
|
-
ariaLabel
|
|
651
|
-
}) => React.createElement("div", {
|
|
652
|
-
className: css(styles$1.tableColumnHelp, className)
|
|
653
|
-
}, typeof children === 'string' ? React.createElement(TableText, null, children) : children, React.createElement("span", {
|
|
654
|
-
className: css(styles$1.tableColumnHelpAction)
|
|
655
|
-
}, _variant === 'tooltip' ? React.createElement(Tooltip$1, Object.assign({
|
|
656
|
-
content: info
|
|
657
|
-
}, tooltipProps), React.createElement(Button, {
|
|
658
|
-
variant: "plain",
|
|
659
|
-
"aria-label": ariaLabel || typeof info === 'string' && info || 'More info'
|
|
660
|
-
}, React.createElement(HelpIcon$1, {
|
|
661
|
-
noVerticalAlign: true
|
|
662
|
-
}))) : React.createElement(Popover, Object.assign({
|
|
663
|
-
bodyContent: info
|
|
664
|
-
}, popoverProps), React.createElement(Button, {
|
|
665
|
-
variant: "plain",
|
|
666
|
-
"aria-label": ariaLabel || typeof info === 'string' && info || 'More info'
|
|
667
|
-
}, React.createElement(HelpIcon$1, {
|
|
668
|
-
noVerticalAlign: true
|
|
669
|
-
})))));
|
|
670
|
-
HeaderCellInfoWrapper.displayName = 'HeaderCellInfoWrapper';
|
|
671
|
-
|
|
672
|
-
const info = ({
|
|
673
|
-
tooltip,
|
|
674
|
-
tooltipProps,
|
|
675
|
-
popover,
|
|
676
|
-
popoverProps,
|
|
677
|
-
className,
|
|
678
|
-
ariaLabel
|
|
679
|
-
}) => {
|
|
680
|
-
const infoObj = value => ({
|
|
681
|
-
className: styles$1.modifiers.help,
|
|
682
|
-
children: tooltip ? React.createElement(HeaderCellInfoWrapper, {
|
|
683
|
-
variant: "tooltip",
|
|
684
|
-
info: tooltip,
|
|
685
|
-
tooltipProps: tooltipProps,
|
|
686
|
-
ariaLabel: ariaLabel,
|
|
687
|
-
className: className
|
|
688
|
-
}, value) : React.createElement(HeaderCellInfoWrapper, {
|
|
689
|
-
variant: "popover",
|
|
690
|
-
info: popover,
|
|
691
|
-
popoverProps: popoverProps,
|
|
692
|
-
ariaLabel: ariaLabel,
|
|
693
|
-
className: className
|
|
694
|
-
}, value)
|
|
695
|
-
});
|
|
696
|
-
|
|
697
|
-
return infoObj;
|
|
698
760
|
};
|
|
699
761
|
|
|
700
762
|
const LongArrowAltUpIconConfig = {
|
|
@@ -744,11 +806,15 @@ const SortColumn = _a => {
|
|
|
744
806
|
isSortedBy = false,
|
|
745
807
|
onSort = null,
|
|
746
808
|
sortDirection = '',
|
|
747
|
-
type = 'button'
|
|
809
|
+
type = 'button',
|
|
810
|
+
tooltip,
|
|
811
|
+
tooltipProps,
|
|
812
|
+
tooltipHasDefaultBehavior
|
|
748
813
|
} = _a,
|
|
749
|
-
props = __rest(_a, ["children", "className", "isSortedBy", "onSort", "sortDirection", "type"]);
|
|
814
|
+
props = __rest$1(_a, ["children", "className", "isSortedBy", "onSort", "sortDirection", "type", "tooltip", "tooltipProps", "tooltipHasDefaultBehavior"]);
|
|
750
815
|
|
|
751
816
|
let SortedByIcon;
|
|
817
|
+
const [focused, setFocused] = React.useState(false);
|
|
752
818
|
|
|
753
819
|
if (isSortedBy) {
|
|
754
820
|
SortedByIcon = sortDirection === SortByDirection.asc ? LongArrowAltUpIcon$1 : LongArrowAltDownIcon$1;
|
|
@@ -759,10 +825,17 @@ const SortColumn = _a => {
|
|
|
759
825
|
return React.createElement("button", Object.assign({}, props, {
|
|
760
826
|
type: type,
|
|
761
827
|
className: css(className, styles$1.tableButton),
|
|
762
|
-
onClick: event => onSort && onSort(event)
|
|
828
|
+
onClick: event => onSort && onSort(event),
|
|
829
|
+
onFocus: () => setFocused(true),
|
|
830
|
+
onBlur: () => setFocused(false)
|
|
763
831
|
}), React.createElement("div", {
|
|
764
832
|
className: css(className, styles$1.tableButtonContent)
|
|
765
|
-
}, React.createElement(TableText,
|
|
833
|
+
}, React.createElement(TableText, {
|
|
834
|
+
tooltip: tooltip,
|
|
835
|
+
tooltipProps: tooltipProps,
|
|
836
|
+
tooltipHasDefaultBehavior: tooltipHasDefaultBehavior,
|
|
837
|
+
focused: focused
|
|
838
|
+
}, children), React.createElement("span", {
|
|
766
839
|
className: css(styles$1.tableSortIndicator)
|
|
767
840
|
}, React.createElement(SortedByIcon, null))));
|
|
768
841
|
};
|
|
@@ -790,14 +863,20 @@ const sortableFavorites = sort => () => sortable(React.createElement(StarIcon$1,
|
|
|
790
863
|
sortBy: sort.sortBy,
|
|
791
864
|
onSort: sort === null || sort === void 0 ? void 0 : sort.onSort
|
|
792
865
|
}
|
|
793
|
-
}
|
|
866
|
+
},
|
|
867
|
+
tooltip: sort.tooltip,
|
|
868
|
+
tooltipProps: sort.tooltipProps,
|
|
869
|
+
tooltipHasDefaultBehavior: true
|
|
794
870
|
});
|
|
795
871
|
const sortable = (label, {
|
|
796
872
|
columnIndex,
|
|
797
873
|
column,
|
|
798
874
|
property,
|
|
799
875
|
className,
|
|
800
|
-
ariaLabel
|
|
876
|
+
ariaLabel,
|
|
877
|
+
tooltip,
|
|
878
|
+
tooltipProps,
|
|
879
|
+
tooltipHasDefaultBehavior
|
|
801
880
|
}) => {
|
|
802
881
|
const {
|
|
803
882
|
extraParams: {
|
|
@@ -835,152 +914,70 @@ const sortable = (label, {
|
|
|
835
914
|
isSortedBy: isSortedBy,
|
|
836
915
|
sortDirection: isSortedBy ? sortBy.direction : '',
|
|
837
916
|
onSort: sortClicked,
|
|
838
|
-
"aria-label": ariaLabel
|
|
917
|
+
"aria-label": ariaLabel,
|
|
918
|
+
tooltip: tooltip,
|
|
919
|
+
tooltipProps: tooltipProps,
|
|
920
|
+
tooltipHasDefaultBehavior: tooltipHasDefaultBehavior
|
|
839
921
|
}, label)
|
|
840
922
|
};
|
|
841
923
|
};
|
|
842
924
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
(function (RowSelectVariant) {
|
|
846
|
-
RowSelectVariant["radio"] = "radio";
|
|
847
|
-
RowSelectVariant["checkbox"] = "checkbox";
|
|
848
|
-
})(RowSelectVariant || (RowSelectVariant = {}));
|
|
849
|
-
|
|
850
|
-
const SelectColumn = _a => {
|
|
851
|
-
var {
|
|
852
|
-
children = null,
|
|
853
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
854
|
-
className,
|
|
855
|
-
onSelect = null,
|
|
856
|
-
selectVariant
|
|
857
|
-
} = _a,
|
|
858
|
-
props = __rest(_a, ["children", "className", "onSelect", "selectVariant"]);
|
|
859
|
-
|
|
860
|
-
return React.createElement(React.Fragment, null, React.createElement("label", null, React.createElement("input", Object.assign({}, props, {
|
|
861
|
-
type: selectVariant,
|
|
862
|
-
onChange: onSelect
|
|
863
|
-
}))), children);
|
|
864
|
-
};
|
|
865
|
-
SelectColumn.displayName = 'SelectColumn';
|
|
866
|
-
|
|
867
|
-
import('./check-8277bc89.js');
|
|
868
|
-
var checkStyles = {
|
|
869
|
-
"check": "pf-c-check",
|
|
870
|
-
"checkBody": "pf-c-check__body",
|
|
871
|
-
"checkDescription": "pf-c-check__description",
|
|
872
|
-
"checkInput": "pf-c-check__input",
|
|
873
|
-
"checkLabel": "pf-c-check__label",
|
|
874
|
-
"modifiers": {
|
|
875
|
-
"standalone": "pf-m-standalone",
|
|
876
|
-
"disabled": "pf-m-disabled"
|
|
877
|
-
}
|
|
878
|
-
};
|
|
925
|
+
const resolveOrDefault = (resolver, defaultValue, rowData, extraData) => typeof resolver === 'function' ? resolver(rowData, extraData) : defaultValue;
|
|
879
926
|
|
|
880
|
-
const
|
|
881
|
-
rowIndex,
|
|
882
|
-
columnIndex,
|
|
927
|
+
const cellActions = (actions, actionResolver, areActionsDisabled) => (label, {
|
|
883
928
|
rowData,
|
|
884
929
|
column,
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
930
|
+
rowIndex,
|
|
931
|
+
columnIndex,
|
|
932
|
+
column: {
|
|
888
933
|
extraParams: {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
allRowsSelected,
|
|
892
|
-
isHeaderSelectDisabled
|
|
934
|
+
actionsToggle,
|
|
935
|
+
actionsPopperProps
|
|
893
936
|
}
|
|
894
|
-
}
|
|
937
|
+
},
|
|
938
|
+
property
|
|
939
|
+
}) => {
|
|
895
940
|
const extraData = {
|
|
896
941
|
rowIndex,
|
|
897
942
|
columnIndex,
|
|
898
943
|
column,
|
|
899
944
|
property
|
|
900
945
|
};
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
const customProps = Object.assign(Object.assign(Object.assign({}, rowId !== -1 ? {
|
|
921
|
-
checked: rowData && !!rowData.selected,
|
|
922
|
-
'aria-label': `Select row ${rowIndex}`
|
|
923
|
-
} : {
|
|
924
|
-
checked: allRowsSelected,
|
|
925
|
-
'aria-label': 'Select all rows'
|
|
926
|
-
}), rowData && (rowData.disableCheckbox || rowData.disableSelection) && {
|
|
927
|
-
disabled: true,
|
|
928
|
-
className: checkStyles.checkInput
|
|
929
|
-
}), !rowData && isHeaderSelectDisabled && {
|
|
930
|
-
disabled: true
|
|
931
|
-
});
|
|
932
|
-
let selectName = 'check-all';
|
|
933
|
-
|
|
934
|
-
if (rowId !== -1 && selectVariant === RowSelectVariant.checkbox) {
|
|
935
|
-
selectName = `checkrow${rowIndex}`;
|
|
936
|
-
} else if (rowId !== -1) {
|
|
937
|
-
selectName = 'radioGroup';
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
return {
|
|
941
|
-
className: css(styles$1.tableCheck),
|
|
942
|
-
component: 'td',
|
|
943
|
-
isVisible: !rowData || !rowData.fullWidth,
|
|
944
|
-
children: React.createElement(SelectColumn, Object.assign({}, customProps, {
|
|
945
|
-
selectVariant: selectVariant,
|
|
946
|
-
onSelect: selectClick,
|
|
947
|
-
name: selectName
|
|
948
|
-
}), label)
|
|
949
|
-
};
|
|
946
|
+
const resolvedActions = resolveOrDefault(actionResolver, actions, rowData, extraData);
|
|
947
|
+
const resolvedIsDisabled = resolveOrDefault(areActionsDisabled, rowData && rowData.disableActions, rowData, extraData);
|
|
948
|
+
const renderProps = resolvedActions && resolvedActions.length > 0 ? {
|
|
949
|
+
children: React.createElement(ActionsColumn, {
|
|
950
|
+
items: resolvedActions,
|
|
951
|
+
isDisabled: resolvedIsDisabled,
|
|
952
|
+
rowData: rowData,
|
|
953
|
+
extraData: extraData,
|
|
954
|
+
actionsToggle: actionsToggle,
|
|
955
|
+
popperProps: actionsPopperProps
|
|
956
|
+
}, label)
|
|
957
|
+
} : {};
|
|
958
|
+
return Object.assign({
|
|
959
|
+
className: css(styles$1.tableAction),
|
|
960
|
+
style: {
|
|
961
|
+
paddingRight: 0
|
|
962
|
+
},
|
|
963
|
+
isVisible: true
|
|
964
|
+
}, renderProps);
|
|
950
965
|
};
|
|
951
966
|
|
|
952
|
-
const
|
|
953
|
-
name: 'AngleDownIcon',
|
|
954
|
-
height: 512,
|
|
955
|
-
width: 320,
|
|
956
|
-
svgPath: 'M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z',
|
|
957
|
-
yOffset: 0,
|
|
958
|
-
xOffset: 0
|
|
959
|
-
};
|
|
960
|
-
const AngleDownIcon = createIcon(AngleDownIconConfig);
|
|
961
|
-
var AngleDownIcon$1 = AngleDownIcon;
|
|
967
|
+
const camelize = s => s.toUpperCase().replace('-', '').replace('_', '');
|
|
962
968
|
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
isOpen,
|
|
968
|
-
onToggle
|
|
969
|
-
} = _a,
|
|
970
|
-
props = __rest(_a, ["className", "children", "isOpen", "onToggle"]);
|
|
969
|
+
const toCamel = s => s.replace(/([-_][a-z])/gi, camelize);
|
|
970
|
+
/**
|
|
971
|
+
* @param {string} input - String to capitalize
|
|
972
|
+
*/
|
|
971
973
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}), React.createElement("div", {
|
|
980
|
-
className: css(styles$1.tableToggleIcon)
|
|
981
|
-
}, React.createElement(AngleDownIcon$1, null))), children);
|
|
982
|
-
};
|
|
983
|
-
CollapseColumn.displayName = 'CollapseColumn';
|
|
974
|
+
function capitalize(input) {
|
|
975
|
+
return input[0].toUpperCase() + input.substring(1);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
const cellWidth = width => () => ({
|
|
979
|
+
className: css(styles$1.modifiers[typeof width === 'number' ? `width_${width}` : `width${capitalize(width)}`])
|
|
980
|
+
});
|
|
984
981
|
|
|
985
982
|
const collapsible = (value, {
|
|
986
983
|
rowIndex,
|
|
@@ -1033,19 +1030,498 @@ const collapsible = (value, {
|
|
|
1033
1030
|
};
|
|
1034
1031
|
};
|
|
1035
1032
|
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1038
|
-
|
|
1033
|
+
const compoundExpand = (value, {
|
|
1034
|
+
rowIndex,
|
|
1035
|
+
columnIndex,
|
|
1036
|
+
rowData,
|
|
1037
|
+
column,
|
|
1038
|
+
property
|
|
1039
|
+
}) => {
|
|
1040
|
+
if (!value) {
|
|
1041
|
+
return null;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
const {
|
|
1045
|
+
title,
|
|
1046
|
+
props
|
|
1047
|
+
} = value;
|
|
1048
|
+
const {
|
|
1049
|
+
extraParams: {
|
|
1050
|
+
onExpand,
|
|
1051
|
+
expandId = 'expand-toggle'
|
|
1052
|
+
}
|
|
1053
|
+
} = column;
|
|
1054
|
+
const extraData = {
|
|
1055
|
+
rowIndex,
|
|
1056
|
+
columnIndex,
|
|
1057
|
+
column,
|
|
1058
|
+
property
|
|
1059
|
+
};
|
|
1060
|
+
/**
|
|
1061
|
+
* @param {React.MouseEvent} event - Mouse event
|
|
1062
|
+
*/
|
|
1063
|
+
|
|
1064
|
+
function onToggle(event) {
|
|
1065
|
+
// tslint:disable-next-line:no-unused-expression
|
|
1066
|
+
onExpand && onExpand(event, rowIndex, columnIndex, props.isOpen, rowData, extraData);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
return {
|
|
1070
|
+
className: css(styles$1.tableCompoundExpansionToggle, props.isOpen && styles$1.modifiers.expanded),
|
|
1071
|
+
children: props.isOpen !== undefined && React.createElement("button", {
|
|
1072
|
+
type: "button",
|
|
1073
|
+
className: css(styles$1.tableButton),
|
|
1074
|
+
onClick: onToggle,
|
|
1075
|
+
"aria-expanded": props.isOpen,
|
|
1076
|
+
"aria-controls": props.ariaControls,
|
|
1077
|
+
id: `${expandId}-${rowIndex}-${columnIndex}`
|
|
1078
|
+
}, React.createElement(TableText, null, title))
|
|
1079
|
+
};
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
const visibilityModifiers = ['hidden', 'hiddenOnSm', 'hiddenOnMd', 'hiddenOnLg', 'hiddenOnXl', 'hiddenOn_2xl', 'visibleOnSm', 'visibleOnMd', 'visibleOnLg', 'visibleOnXl', 'visibleOn_2xl'];
|
|
1083
|
+
const Visibility = visibilityModifiers.filter(key => styles$1.modifiers[key]).reduce((acc, curr) => {
|
|
1084
|
+
const key2 = curr.replace('_2xl', '2Xl');
|
|
1085
|
+
acc[key2] = styles$1.modifiers[curr];
|
|
1086
|
+
return acc;
|
|
1087
|
+
}, {});
|
|
1088
|
+
const classNames = (...classes) => () => ({
|
|
1089
|
+
className: css(...classes)
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
const info = ({
|
|
1093
|
+
tooltip,
|
|
1094
|
+
tooltipProps,
|
|
1095
|
+
popover,
|
|
1096
|
+
popoverProps,
|
|
1097
|
+
className,
|
|
1098
|
+
ariaLabel
|
|
1099
|
+
}) => {
|
|
1100
|
+
const infoObj = value => ({
|
|
1101
|
+
className: styles$1.modifiers.help,
|
|
1102
|
+
children: tooltip ? React.createElement(HeaderCellInfoWrapper, {
|
|
1103
|
+
variant: "tooltip",
|
|
1104
|
+
info: tooltip,
|
|
1105
|
+
tooltipProps: tooltipProps,
|
|
1106
|
+
ariaLabel: ariaLabel,
|
|
1107
|
+
className: className
|
|
1108
|
+
}, value) : React.createElement(HeaderCellInfoWrapper, {
|
|
1109
|
+
variant: "popover",
|
|
1110
|
+
info: popover,
|
|
1111
|
+
popoverProps: popoverProps,
|
|
1112
|
+
ariaLabel: ariaLabel,
|
|
1113
|
+
className: className
|
|
1114
|
+
}, value)
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
return infoObj;
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
const FavoritesCell = _a => {
|
|
1121
|
+
var {
|
|
1122
|
+
className = '',
|
|
1123
|
+
onFavorite,
|
|
1124
|
+
isFavorited,
|
|
1125
|
+
rowIndex
|
|
1126
|
+
} = _a,
|
|
1127
|
+
props = __rest$1(_a, ["className", "onFavorite", "isFavorited", "rowIndex"]);
|
|
1128
|
+
|
|
1129
|
+
const ariaProps = rowIndex === undefined ? {} : {
|
|
1130
|
+
id: `favorites-button-${rowIndex}`,
|
|
1131
|
+
'aria-labelledby': `favorites-button-${rowIndex}`
|
|
1132
|
+
};
|
|
1133
|
+
return React.createElement(Button, Object.assign({
|
|
1134
|
+
variant: "plain",
|
|
1135
|
+
className: className,
|
|
1136
|
+
type: "button",
|
|
1137
|
+
"aria-label": isFavorited ? 'Starred' : 'Not starred',
|
|
1138
|
+
onClick: onFavorite
|
|
1139
|
+
}, ariaProps, props), React.createElement(StarIcon$1, {
|
|
1140
|
+
"aria-hidden": true
|
|
1141
|
+
}));
|
|
1142
|
+
};
|
|
1143
|
+
FavoritesCell.displayName = 'FavoritesCell';
|
|
1144
|
+
|
|
1145
|
+
const favoritable = (value, {
|
|
1146
|
+
rowIndex,
|
|
1147
|
+
columnIndex,
|
|
1148
|
+
rowData,
|
|
1149
|
+
column,
|
|
1150
|
+
property
|
|
1151
|
+
}) => {
|
|
1152
|
+
const {
|
|
1153
|
+
extraParams: {
|
|
1154
|
+
onFavorite
|
|
1155
|
+
}
|
|
1156
|
+
} = column;
|
|
1157
|
+
const extraData = {
|
|
1158
|
+
rowIndex,
|
|
1159
|
+
columnIndex,
|
|
1160
|
+
column,
|
|
1161
|
+
property
|
|
1162
|
+
}; // this is a child row which should not display the favorites icon
|
|
1163
|
+
|
|
1164
|
+
if (rowData && rowData.hasOwnProperty('parent') && !rowData.fullWidth) {
|
|
1165
|
+
return {
|
|
1166
|
+
component: 'td',
|
|
1167
|
+
isVisible: true
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* @param {React.MouseEvent} event - Mouse event
|
|
1172
|
+
*/
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
function favoritesClick(event) {
|
|
1176
|
+
// tslint:disable-next-line:no-unused-expression
|
|
1177
|
+
onFavorite && onFavorite(event, rowData && !rowData.favorited, rowIndex, rowData, extraData);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
const additionalProps = rowData.favoritesProps || {};
|
|
1181
|
+
return {
|
|
1182
|
+
className: css(styles$1.tableFavorite, rowData && rowData.favorited && styles$1.modifiers.favorited),
|
|
1183
|
+
isVisible: !rowData || !rowData.fullWidth,
|
|
1184
|
+
children: React.createElement(FavoritesCell, Object.assign({
|
|
1185
|
+
rowIndex: rowIndex,
|
|
1186
|
+
onFavorite: favoritesClick,
|
|
1187
|
+
isFavorited: rowData && rowData.favorited
|
|
1188
|
+
}, additionalProps))
|
|
1189
|
+
};
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
const EllipsisHIconConfig = {
|
|
1193
|
+
name: 'EllipsisHIcon',
|
|
1194
|
+
height: 512,
|
|
1195
|
+
width: 512,
|
|
1196
|
+
svgPath: 'M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z',
|
|
1197
|
+
yOffset: 0,
|
|
1198
|
+
xOffset: 0
|
|
1199
|
+
};
|
|
1200
|
+
const EllipsisHIcon = createIcon(EllipsisHIconConfig);
|
|
1201
|
+
var EllipsisHIcon$1 = EllipsisHIcon;
|
|
1202
|
+
|
|
1203
|
+
const treeRow = (onCollapse, onCheckChange, onToggleRowDetails) => (value, {
|
|
1204
|
+
rowIndex,
|
|
1205
|
+
rowData
|
|
1206
|
+
}) => {
|
|
1207
|
+
const {
|
|
1208
|
+
isExpanded,
|
|
1209
|
+
isDetailsExpanded,
|
|
1210
|
+
'aria-level': level,
|
|
1211
|
+
'aria-setsize': setsize,
|
|
1212
|
+
toggleAriaLabel,
|
|
1213
|
+
checkAriaLabel,
|
|
1214
|
+
showDetailsAriaLabel,
|
|
1215
|
+
isChecked,
|
|
1216
|
+
checkboxId,
|
|
1217
|
+
icon
|
|
1218
|
+
} = rowData.props;
|
|
1219
|
+
const content = value.title || value;
|
|
1220
|
+
const text = React.createElement("div", {
|
|
1221
|
+
className: css(treeViewStyles.tableTreeViewText),
|
|
1222
|
+
key: "tree-view-text"
|
|
1223
|
+
}, icon && React.createElement("span", {
|
|
1224
|
+
className: css(treeViewStyles.tableTreeViewIcon),
|
|
1225
|
+
key: "tree-view-text-icon"
|
|
1226
|
+
}, icon), React.createElement("span", {
|
|
1227
|
+
className: styles$1.tableText,
|
|
1228
|
+
key: "table-text"
|
|
1229
|
+
}, content));
|
|
1230
|
+
|
|
1231
|
+
const onChange = (isChecked, event) => {
|
|
1232
|
+
onCheckChange(event, isChecked, rowIndex, content, rowData);
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
return {
|
|
1236
|
+
component: 'th',
|
|
1237
|
+
className: treeViewStyles.tableTreeViewTitleCell,
|
|
1238
|
+
children: level !== undefined ? React.createElement("div", {
|
|
1239
|
+
className: css(treeViewStyles.tableTreeViewMain)
|
|
1240
|
+
}, setsize > 0 && React.createElement("span", {
|
|
1241
|
+
className: css(treeViewStyles.tableToggle),
|
|
1242
|
+
key: "table-toggle"
|
|
1243
|
+
}, React.createElement(Button, {
|
|
1244
|
+
variant: "plain",
|
|
1245
|
+
onClick: event => onCollapse && onCollapse(event, rowIndex, content, rowData),
|
|
1246
|
+
className: css(isExpanded && styles$1.modifiers.expanded),
|
|
1247
|
+
"aria-expanded": isExpanded,
|
|
1248
|
+
"aria-label": toggleAriaLabel || `${isExpanded ? 'Collapse' : 'Expand'} row ${rowIndex}`
|
|
1249
|
+
}, React.createElement("div", {
|
|
1250
|
+
className: css(treeViewStyles.tableToggleIcon)
|
|
1251
|
+
}, React.createElement(AngleDownIcon$1, {
|
|
1252
|
+
"aria-hidden": "true"
|
|
1253
|
+
})))), !!onCheckChange && React.createElement("span", {
|
|
1254
|
+
className: css(treeViewStyles.tableCheck),
|
|
1255
|
+
key: "table-check"
|
|
1256
|
+
}, React.createElement("label", {
|
|
1257
|
+
htmlFor: checkboxId || `checkbox_${rowIndex}`
|
|
1258
|
+
}, React.createElement(Checkbox, {
|
|
1259
|
+
id: checkboxId || `checkbox_${rowIndex}`,
|
|
1260
|
+
"aria-label": checkAriaLabel || `Row ${rowIndex} checkbox`,
|
|
1261
|
+
isChecked: isChecked,
|
|
1262
|
+
onChange: (event, checked) => onChange(checked, event)
|
|
1263
|
+
}))), text, !!onToggleRowDetails && React.createElement("span", {
|
|
1264
|
+
className: css(treeViewStyles.tableTreeViewDetailsToggle),
|
|
1265
|
+
key: "view-details-toggle"
|
|
1266
|
+
}, React.createElement(Button, {
|
|
1267
|
+
variant: "plain",
|
|
1268
|
+
"aria-expanded": isDetailsExpanded,
|
|
1269
|
+
"aria-label": showDetailsAriaLabel || 'Show row details',
|
|
1270
|
+
onClick: event => onToggleRowDetails && onToggleRowDetails(event, rowIndex, content, rowData)
|
|
1271
|
+
}, React.createElement("span", {
|
|
1272
|
+
className: `${styles$1.table}__details-toggle-icon`
|
|
1273
|
+
}, React.createElement(EllipsisHIcon$1, {
|
|
1274
|
+
"aria-hidden": true
|
|
1275
|
+
}))))) : text
|
|
1276
|
+
};
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
var TableGridBreakpoint;
|
|
1280
|
+
|
|
1281
|
+
(function (TableGridBreakpoint) {
|
|
1282
|
+
TableGridBreakpoint["none"] = "";
|
|
1283
|
+
TableGridBreakpoint["grid"] = "grid";
|
|
1284
|
+
TableGridBreakpoint["gridMd"] = "grid-md";
|
|
1285
|
+
TableGridBreakpoint["gridLg"] = "grid-lg";
|
|
1286
|
+
TableGridBreakpoint["gridXl"] = "grid-xl";
|
|
1287
|
+
TableGridBreakpoint["grid2xl"] = "grid-2xl";
|
|
1288
|
+
})(TableGridBreakpoint || (TableGridBreakpoint = {}));
|
|
1289
|
+
|
|
1290
|
+
var TableVariant;
|
|
1291
|
+
|
|
1292
|
+
(function (TableVariant) {
|
|
1293
|
+
TableVariant["compact"] = "compact";
|
|
1294
|
+
})(TableVariant || (TableVariant = {}));
|
|
1295
|
+
|
|
1296
|
+
const TableContext = React.createContext({
|
|
1297
|
+
registerSelectableRow: () => {}
|
|
1298
|
+
});
|
|
1299
|
+
|
|
1300
|
+
const TableBase = _a => {
|
|
1301
|
+
var _b, _c;
|
|
1302
|
+
|
|
1303
|
+
var {
|
|
1304
|
+
children,
|
|
1305
|
+
className,
|
|
1306
|
+
variant,
|
|
1307
|
+
borders = true,
|
|
1308
|
+
isStickyHeader = false,
|
|
1309
|
+
gridBreakPoint = TableGridBreakpoint.gridMd,
|
|
1310
|
+
'aria-label': ariaLabel,
|
|
1311
|
+
role = 'grid',
|
|
1312
|
+
innerRef,
|
|
1313
|
+
ouiaId,
|
|
1314
|
+
ouiaSafe = true,
|
|
1315
|
+
isTreeTable = false,
|
|
1316
|
+
isNested = false,
|
|
1317
|
+
isStriped = false,
|
|
1318
|
+
isExpandable = false,
|
|
1319
|
+
hasNoInset = false,
|
|
1320
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1321
|
+
nestedHeaderColumnSpans,
|
|
1322
|
+
selectableRowCaptionText
|
|
1323
|
+
} = _a,
|
|
1324
|
+
props = __rest$1(_a, ["children", "className", "variant", "borders", "isStickyHeader", "gridBreakPoint", 'aria-label', "role", "innerRef", "ouiaId", "ouiaSafe", "isTreeTable", "isNested", "isStriped", "isExpandable", "hasNoInset", "nestedHeaderColumnSpans", "selectableRowCaptionText"]);
|
|
1325
|
+
|
|
1326
|
+
const ref = React.useRef(null);
|
|
1327
|
+
const tableRef = innerRef || ref;
|
|
1328
|
+
const [hasSelectableRows, setHasSelectableRows] = React.useState(false);
|
|
1329
|
+
const [tableCaption, setTableCaption] = React.useState();
|
|
1330
|
+
React.useEffect(() => {
|
|
1331
|
+
document.addEventListener('keydown', handleKeys); // sets up roving tab-index to tree tables only
|
|
1332
|
+
|
|
1333
|
+
if (tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) {
|
|
1334
|
+
const tbody = tableRef.current.querySelector('tbody');
|
|
1335
|
+
tbody && setTabIndex(Array.from(tbody.querySelectorAll('button, a, input')));
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
return function cleanup() {
|
|
1339
|
+
document.removeEventListener('keydown', handleKeys);
|
|
1340
|
+
};
|
|
1341
|
+
}, [tableRef, tableRef.current]);
|
|
1342
|
+
React.useEffect(() => {
|
|
1343
|
+
if (selectableRowCaptionText) {
|
|
1344
|
+
setTableCaption(React.createElement("caption", null, selectableRowCaptionText, React.createElement("div", {
|
|
1345
|
+
className: "pf-v5-screen-reader"
|
|
1346
|
+
}, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter.")));
|
|
1347
|
+
} else {
|
|
1348
|
+
setTableCaption(React.createElement("caption", {
|
|
1349
|
+
className: "pf-v5-screen-reader"
|
|
1350
|
+
}, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter."));
|
|
1351
|
+
}
|
|
1352
|
+
}, [selectableRowCaptionText]);
|
|
1353
|
+
const ouiaProps = useOUIAProps('Table', ouiaId, ouiaSafe);
|
|
1354
|
+
const grid = (_b = stylesGrid.modifiers) === null || _b === void 0 ? void 0 : _b[toCamel(gridBreakPoint || '').replace(/-?2xl/, '_2xl')];
|
|
1355
|
+
const breakPointPrefix = `treeView${gridBreakPoint.charAt(0).toUpperCase() + gridBreakPoint.slice(1)}`;
|
|
1356
|
+
const treeGrid = (_c = treeViewStyles.modifiers) === null || _c === void 0 ? void 0 : _c[toCamel(breakPointPrefix || '').replace(/-?2xl/, '_2xl')];
|
|
1357
|
+
|
|
1358
|
+
const handleKeys = event => {
|
|
1359
|
+
if (isNested || !(tableRef && tableRef.current && tableRef.current.classList.contains(treeViewStyles.modifiers.treeView)) || // implements roving tab-index to tree tables only
|
|
1360
|
+
tableRef && tableRef.current !== event.target.closest(`.${styles$1.table}:not(.pf-m-nested)`)) {
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
const activeElement = document.activeElement;
|
|
1365
|
+
const key = event.key;
|
|
1366
|
+
const rows = Array.from(tableRef.current.querySelectorAll('tbody tr')).filter(el => !el.classList.contains('pf-m-disabled') && !el.hidden);
|
|
1367
|
+
|
|
1368
|
+
if (key === 'Space' || key === 'Enter') {
|
|
1369
|
+
activeElement.click();
|
|
1370
|
+
event.preventDefault();
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
const getFocusableElement = element => element.querySelectorAll('button:not(:disabled), input:not(:disabled), a:not(:disabled)')[0];
|
|
1374
|
+
|
|
1375
|
+
handleArrows(event, rows, element => element === activeElement.closest('tr'), getFocusableElement, ['button', 'input', 'a'], undefined, false, true, false);
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
const registerSelectableRow = () => {
|
|
1379
|
+
!hasSelectableRows && setHasSelectableRows(true);
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
return React.createElement(TableContext.Provider, {
|
|
1383
|
+
value: {
|
|
1384
|
+
registerSelectableRow
|
|
1385
|
+
}
|
|
1386
|
+
}, React.createElement("table", Object.assign({
|
|
1387
|
+
"aria-label": ariaLabel,
|
|
1388
|
+
role: role,
|
|
1389
|
+
className: css(className, styles$1.table, isTreeTable ? treeGrid : grid, styles$1.modifiers[variant], !borders && styles$1.modifiers.noBorderRows, isStickyHeader && styles$1.modifiers.stickyHeader, isTreeTable && treeViewStyles.modifiers.treeView, isStriped && styles$1.modifiers.striped, isExpandable && styles$1.modifiers.expandable, hasNoInset && treeViewStyles.modifiers.noInset, isNested && 'pf-m-nested'),
|
|
1390
|
+
ref: tableRef
|
|
1391
|
+
}, isTreeTable && {
|
|
1392
|
+
role: 'treegrid'
|
|
1393
|
+
}, ouiaProps, props), hasSelectableRows && tableCaption, children));
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
const Table = React.forwardRef((props, ref) => React.createElement(TableBase, Object.assign({}, props, {
|
|
1397
|
+
innerRef: ref
|
|
1398
|
+
})));
|
|
1399
|
+
Table.displayName = 'Table';
|
|
1400
|
+
|
|
1401
|
+
const TrBase = _a => {
|
|
1402
|
+
var {
|
|
1403
|
+
children,
|
|
1404
|
+
className,
|
|
1405
|
+
isExpanded,
|
|
1406
|
+
isEditable,
|
|
1407
|
+
isHidden = false,
|
|
1408
|
+
isClickable = false,
|
|
1409
|
+
isRowSelected = false,
|
|
1410
|
+
isStriped = false,
|
|
1411
|
+
isBorderRow = false,
|
|
1412
|
+
innerRef,
|
|
1413
|
+
ouiaId,
|
|
1414
|
+
ouiaSafe = true,
|
|
1415
|
+
resetOffset = false,
|
|
1416
|
+
onRowClick,
|
|
1417
|
+
isSelectable,
|
|
1418
|
+
'aria-label': passedAriaLabel
|
|
1419
|
+
} = _a,
|
|
1420
|
+
props = __rest$1(_a, ["children", "className", "isExpanded", "isEditable", "isHidden", "isClickable", "isRowSelected", "isStriped", "isBorderRow", "innerRef", "ouiaId", "ouiaSafe", "resetOffset", "onRowClick", "isSelectable", 'aria-label']);
|
|
1421
|
+
|
|
1422
|
+
const ouiaProps = useOUIAProps$1('TableRow', ouiaId, ouiaSafe);
|
|
1423
|
+
const [computedAriaLabel, setComputedAriaLabel] = React.useState('');
|
|
1424
|
+
let onKeyDown = null;
|
|
1425
|
+
|
|
1426
|
+
if (onRowClick) {
|
|
1427
|
+
onKeyDown = e => {
|
|
1428
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
1429
|
+
onRowClick(e);
|
|
1430
|
+
e.preventDefault();
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
const rowIsHidden = isHidden || isExpanded !== undefined && !isExpanded;
|
|
1436
|
+
const {
|
|
1437
|
+
registerSelectableRow
|
|
1438
|
+
} = React.useContext(TableContext);
|
|
1439
|
+
React.useEffect(() => {
|
|
1440
|
+
if (isSelectable && !rowIsHidden) {
|
|
1441
|
+
setComputedAriaLabel(`${isRowSelected ? 'Row selected' : ''}`);
|
|
1442
|
+
registerSelectableRow();
|
|
1443
|
+
} else {
|
|
1444
|
+
setComputedAriaLabel(undefined);
|
|
1445
|
+
}
|
|
1446
|
+
}, [isRowSelected, isSelectable, registerSelectableRow, rowIsHidden]);
|
|
1447
|
+
const ariaLabel = passedAriaLabel || computedAriaLabel;
|
|
1448
|
+
return React.createElement(React.Fragment, null, React.createElement("tr", Object.assign({
|
|
1449
|
+
className: css(styles$1.tableTr, className, isExpanded !== undefined && styles$1.tableExpandableRow, isExpanded && styles$1.modifiers.expanded, isEditable && inlineStyles.modifiers.inlineEditable, isClickable && styles$1.modifiers.clickable, isRowSelected && styles$1.modifiers.selected, isStriped && styles$1.modifiers.striped, isBorderRow && styles$1.modifiers.borderRow, resetOffset && styles$1.modifiers.firstCellOffsetReset),
|
|
1450
|
+
hidden: rowIsHidden
|
|
1451
|
+
}, isClickable && {
|
|
1452
|
+
tabIndex: 0
|
|
1453
|
+
}, {
|
|
1454
|
+
"aria-label": ariaLabel,
|
|
1455
|
+
ref: innerRef
|
|
1456
|
+
}, onRowClick && {
|
|
1457
|
+
onClick: onRowClick,
|
|
1458
|
+
onKeyDown
|
|
1459
|
+
}, ouiaProps, props), children));
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
const Tr = React.forwardRef((props, ref) => React.createElement(TrBase, Object.assign({}, props, {
|
|
1463
|
+
innerRef: ref
|
|
1464
|
+
})));
|
|
1465
|
+
Tr.displayName = 'Tr';
|
|
1466
|
+
|
|
1467
|
+
const TheadBase = _a => {
|
|
1468
|
+
var {
|
|
1469
|
+
children,
|
|
1470
|
+
className,
|
|
1471
|
+
noWrap = false,
|
|
1472
|
+
innerRef,
|
|
1473
|
+
hasNestedHeader
|
|
1474
|
+
} = _a,
|
|
1475
|
+
props = __rest$1(_a, ["children", "className", "noWrap", "innerRef", "hasNestedHeader"]);
|
|
1476
|
+
|
|
1477
|
+
return React.createElement("thead", Object.assign({
|
|
1478
|
+
className: css(styles$1.tableThead, className, noWrap && styles$1.modifiers.nowrap, hasNestedHeader && styles$1.modifiers.nestedColumnHeader),
|
|
1479
|
+
ref: innerRef
|
|
1480
|
+
}, props), children);
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
const Thead = React.forwardRef((props, ref) => React.createElement(TheadBase, Object.assign({}, props, {
|
|
1484
|
+
innerRef: ref
|
|
1485
|
+
})));
|
|
1486
|
+
Thead.displayName = 'Thead';
|
|
1487
|
+
|
|
1488
|
+
const TbodyBase = _a => {
|
|
1489
|
+
var {
|
|
1490
|
+
children,
|
|
1491
|
+
className,
|
|
1492
|
+
isExpanded,
|
|
1493
|
+
innerRef,
|
|
1494
|
+
isEvenStriped = false,
|
|
1495
|
+
isOddStriped = false
|
|
1496
|
+
} = _a,
|
|
1497
|
+
props = __rest$1(_a, ["children", "className", "isExpanded", "innerRef", "isEvenStriped", "isOddStriped"]);
|
|
1498
|
+
|
|
1499
|
+
return React.createElement("tbody", Object.assign({
|
|
1500
|
+
role: "rowgroup",
|
|
1501
|
+
className: css(styles$1.tableTbody, className, isExpanded && styles$1.modifiers.expanded, isOddStriped && styles$1.modifiers.striped, isEvenStriped && styles$1.modifiers.stripedEven),
|
|
1502
|
+
ref: innerRef
|
|
1503
|
+
}, props), children);
|
|
1504
|
+
};
|
|
1505
|
+
|
|
1506
|
+
const Tbody = React.forwardRef((props, ref) => React.createElement(TbodyBase, Object.assign({}, props, {
|
|
1507
|
+
innerRef: ref
|
|
1508
|
+
})));
|
|
1509
|
+
Tbody.displayName = 'Tbody';
|
|
1039
1510
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
}
|
|
1511
|
+
var styles = {
|
|
1512
|
+
"modifiers": {
|
|
1513
|
+
"borderRight": "pf-m-border-right",
|
|
1514
|
+
"borderLeft": "pf-m-border-left",
|
|
1515
|
+
"right": "pf-m-right",
|
|
1516
|
+
"inlineEnd": "pf-m-inline-end",
|
|
1517
|
+
"left": "pf-m-left",
|
|
1518
|
+
"inlineStart": "pf-m-inline-start"
|
|
1519
|
+
},
|
|
1520
|
+
"scrollInnerWrapper": "pf-v5-c-scroll-inner-wrapper",
|
|
1521
|
+
"scrollOuterWrapper": "pf-v5-c-scroll-outer-wrapper",
|
|
1522
|
+
"table": "pf-v5-c-table",
|
|
1523
|
+
"tableStickyCell": "pf-v5-c-table__sticky-cell"
|
|
1524
|
+
};
|
|
1049
1525
|
|
|
1050
1526
|
/**
|
|
1051
1527
|
* merge-props.js
|
|
@@ -1090,6 +1566,27 @@ function mergeProps(...props) {
|
|
|
1090
1566
|
});
|
|
1091
1567
|
}
|
|
1092
1568
|
|
|
1569
|
+
const c_table__sticky_cell_MinWidth = {
|
|
1570
|
+
"name": "--pf-v5-c-table__sticky-cell--MinWidth",
|
|
1571
|
+
"value": "12.5rem",
|
|
1572
|
+
"var": "var(--pf-v5-c-table__sticky-cell--MinWidth)"
|
|
1573
|
+
};
|
|
1574
|
+
var cssStickyCellMinWidth = c_table__sticky_cell_MinWidth;
|
|
1575
|
+
|
|
1576
|
+
const c_table__sticky_cell_Left = {
|
|
1577
|
+
"name": "--pf-v5-c-table__sticky-cell--Left",
|
|
1578
|
+
"value": "0",
|
|
1579
|
+
"var": "var(--pf-v5-c-table__sticky-cell--Left)"
|
|
1580
|
+
};
|
|
1581
|
+
var cssStickyCellLeft = c_table__sticky_cell_Left;
|
|
1582
|
+
|
|
1583
|
+
const c_table__sticky_cell_Right = {
|
|
1584
|
+
"name": "--pf-v5-c-table__sticky-cell--Right",
|
|
1585
|
+
"value": "0",
|
|
1586
|
+
"var": "var(--pf-v5-c-table__sticky-cell--Right)"
|
|
1587
|
+
};
|
|
1588
|
+
var cssStickyCellRight = c_table__sticky_cell_Right;
|
|
1589
|
+
|
|
1093
1590
|
const ThBase = _a => {
|
|
1094
1591
|
var {
|
|
1095
1592
|
children,
|
|
@@ -1103,6 +1600,7 @@ const ThBase = _a => {
|
|
|
1103
1600
|
select = null,
|
|
1104
1601
|
expand: collapse = null,
|
|
1105
1602
|
tooltip = '',
|
|
1603
|
+
tooltipProps,
|
|
1106
1604
|
onMouseEnter: onMouseEnterProp = () => {},
|
|
1107
1605
|
width,
|
|
1108
1606
|
visibility,
|
|
@@ -1110,422 +1608,147 @@ const ThBase = _a => {
|
|
|
1110
1608
|
info: infoProps,
|
|
1111
1609
|
isStickyColumn = false,
|
|
1112
1610
|
hasRightBorder = false,
|
|
1611
|
+
hasLeftBorder = false,
|
|
1113
1612
|
stickyMinWidth = '120px',
|
|
1114
1613
|
stickyLeftOffset,
|
|
1115
|
-
|
|
1614
|
+
stickyRightOffset,
|
|
1615
|
+
isSubheader = false,
|
|
1616
|
+
screenReaderText,
|
|
1617
|
+
'aria-label': ariaLabel
|
|
1116
1618
|
} = _a,
|
|
1117
|
-
props = __rest(_a, ["children", "className", "component", "dataLabel", "scope", "textCenter", "sort", "modifier", "select", "expand", "tooltip", "onMouseEnter", "width", "visibility", "innerRef", "info", "isStickyColumn", "hasRightBorder", "stickyMinWidth", "stickyLeftOffset", "isSubheader"]);
|
|
1118
|
-
|
|
1119
|
-
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
1120
|
-
|
|
1121
|
-
const onMouseEnter = event => {
|
|
1122
|
-
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1123
|
-
!showTooltip && setShowTooltip(true);
|
|
1124
|
-
} else {
|
|
1125
|
-
showTooltip && setShowTooltip(false);
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
onMouseEnterProp(event);
|
|
1129
|
-
};
|
|
1130
|
-
|
|
1131
|
-
let sortParams = null;
|
|
1132
|
-
|
|
1133
|
-
if (sort) {
|
|
1134
|
-
if (sort.isFavorites) {
|
|
1135
|
-
sortParams = sortableFavorites({
|
|
1136
|
-
onSort: sort === null || sort === void 0 ? void 0 : sort.onSort,
|
|
1137
|
-
columnIndex: sort.columnIndex,
|
|
1138
|
-
sortBy: sort.sortBy
|
|
1139
|
-
})();
|
|
1140
|
-
} else {
|
|
1141
|
-
sortParams = sortable(children, {
|
|
1142
|
-
columnIndex: sort.columnIndex,
|
|
1143
|
-
column: {
|
|
1144
|
-
extraParams: {
|
|
1145
|
-
sortBy: sort.sortBy,
|
|
1146
|
-
onSort: sort === null || sort === void 0 ? void 0 : sort.onSort
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
const selectParams = select ? selectable(children, {
|
|
1154
|
-
column: {
|
|
1155
|
-
extraParams: {
|
|
1156
|
-
onSelect: select === null || select === void 0 ? void 0 : select.onSelect,
|
|
1157
|
-
selectVariant: 'checkbox',
|
|
1158
|
-
allRowsSelected: select.isSelected,
|
|
1159
|
-
isHeaderSelectDisabled: !!select.isHeaderSelectDisabled
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
}) : null;
|
|
1163
|
-
const collapseParams = collapse ? collapsible(children, {
|
|
1164
|
-
column: {
|
|
1165
|
-
extraParams: {
|
|
1166
|
-
onCollapse: collapse === null || collapse === void 0 ? void 0 : collapse.onToggle,
|
|
1167
|
-
allRowsExpanded: !collapse.areAllExpanded,
|
|
1168
|
-
collapseAllAriaLabel: ''
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}) : null;
|
|
1172
|
-
const widthParams = width ? cellWidth(width)() : null;
|
|
1173
|
-
const visibilityParams = visibility ? classNames(...visibility.map(vis => Visibility[vis]))() : null;
|
|
1174
|
-
let transformedChildren = (sortParams === null || sortParams === void 0 ? void 0 : sortParams.children) || (selectParams === null || selectParams === void 0 ? void 0 : selectParams.children) || (collapseParams === null || collapseParams === void 0 ? void 0 : collapseParams.children) || children; // info can wrap other transformedChildren
|
|
1175
|
-
|
|
1176
|
-
let infoParams = null;
|
|
1177
|
-
|
|
1178
|
-
if (infoProps) {
|
|
1179
|
-
infoParams = info(infoProps)(transformedChildren);
|
|
1180
|
-
transformedChildren = infoParams.children;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
const merged = mergeProps(sortParams, selectParams, collapseParams, widthParams, visibilityParams, infoParams);
|
|
1184
|
-
|
|
1185
|
-
const {
|
|
1186
|
-
// ignore the merged children since we transform them ourselves so we can wrap it with info
|
|
1187
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1188
|
-
children: mergedChildren = null,
|
|
1189
|
-
// selectable adds this but we don't want it
|
|
1190
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1191
|
-
isVisible = null,
|
|
1192
|
-
className: mergedClassName = '',
|
|
1193
|
-
component: MergedComponent = component
|
|
1194
|
-
} = merged,
|
|
1195
|
-
mergedProps = __rest(merged, ["children", "isVisible", "className", "component"]);
|
|
1196
|
-
|
|
1197
|
-
const cell = React.createElement(MergedComponent, Object.assign({
|
|
1198
|
-
"data-label": dataLabel,
|
|
1199
|
-
onMouseEnter: tooltip !== null ? onMouseEnter : onMouseEnterProp,
|
|
1200
|
-
scope: component === 'th' && children ? scope : null,
|
|
1201
|
-
ref: innerRef,
|
|
1202
|
-
className: css(className, textCenter && styles$1.modifiers.center, isSubheader && styles$1.tableSubhead, isStickyColumn && styles.tableStickyColumn, hasRightBorder && styles.modifiers.borderRight, modifier && styles$1.modifiers[modifier], mergedClassName)
|
|
1203
|
-
}, mergedProps, props, isStickyColumn && {
|
|
1204
|
-
style: Object.assign({
|
|
1205
|
-
'--pf-c-table__sticky-column--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
1206
|
-
'--pf-c-table__sticky-column--Left': stickyLeftOffset ? stickyLeftOffset : undefined
|
|
1207
|
-
}, props.style)
|
|
1208
|
-
}), transformedChildren);
|
|
1209
|
-
const canDefault = tooltip === '' ? typeof children === 'string' : true;
|
|
1210
|
-
return tooltip !== null && canDefault && showTooltip ? React.createElement(Tooltip, {
|
|
1211
|
-
content: tooltip || tooltip === '' && children,
|
|
1212
|
-
isVisible: true
|
|
1213
|
-
}, cell) : cell;
|
|
1214
|
-
};
|
|
1215
|
-
|
|
1216
|
-
const Th = React.forwardRef((props, ref) => React.createElement(ThBase, Object.assign({}, props, {
|
|
1217
|
-
innerRef: ref
|
|
1218
|
-
})));
|
|
1219
|
-
Th.displayName = 'Th';
|
|
1220
|
-
|
|
1221
|
-
class ActionsColumn extends React.Component {
|
|
1222
|
-
constructor(props) {
|
|
1223
|
-
super(props);
|
|
1224
|
-
this.toggleRef = React.createRef();
|
|
1225
|
-
|
|
1226
|
-
this.onToggle = isOpen => {
|
|
1227
|
-
this.setState({
|
|
1228
|
-
isOpen
|
|
1229
|
-
});
|
|
1230
|
-
};
|
|
1231
|
-
|
|
1232
|
-
this.onClick = (event, onClick) => {
|
|
1233
|
-
const {
|
|
1234
|
-
rowData,
|
|
1235
|
-
extraData
|
|
1236
|
-
} = this.props; // Only prevent default if onClick is provided. This allows href support.
|
|
1237
|
-
|
|
1238
|
-
if (onClick) {
|
|
1239
|
-
event.preventDefault(); // tslint:disable-next-line:no-unused-expression
|
|
1240
|
-
|
|
1241
|
-
onClick(event, extraData && extraData.rowIndex, rowData, extraData);
|
|
1242
|
-
}
|
|
1243
|
-
};
|
|
1244
|
-
|
|
1245
|
-
this.state = {
|
|
1246
|
-
isOpen: false
|
|
1247
|
-
};
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
render() {
|
|
1251
|
-
const {
|
|
1252
|
-
isOpen
|
|
1253
|
-
} = this.state;
|
|
1254
|
-
const {
|
|
1255
|
-
items,
|
|
1256
|
-
children,
|
|
1257
|
-
dropdownPosition,
|
|
1258
|
-
dropdownDirection,
|
|
1259
|
-
isDisabled,
|
|
1260
|
-
rowData,
|
|
1261
|
-
actionsToggle
|
|
1262
|
-
} = this.props;
|
|
1263
|
-
const actionsToggleClone = actionsToggle ? actionsToggle({
|
|
1264
|
-
onToggle: this.onToggle,
|
|
1265
|
-
isOpen,
|
|
1266
|
-
isDisabled
|
|
1267
|
-
}) : React.createElement(KebabToggle, {
|
|
1268
|
-
isDisabled: isDisabled,
|
|
1269
|
-
onToggle: this.onToggle
|
|
1270
|
-
});
|
|
1271
|
-
return React.createElement(React.Fragment, null, items.filter(item => item.isOutsideDropdown) // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1272
|
-
.map((_a, key) => {
|
|
1273
|
-
var {
|
|
1274
|
-
title,
|
|
1275
|
-
itemKey,
|
|
1276
|
-
onClick,
|
|
1277
|
-
isOutsideDropdown
|
|
1278
|
-
} = _a,
|
|
1279
|
-
props = __rest(_a, ["title", "itemKey", "onClick", "isOutsideDropdown"]);
|
|
1280
|
-
|
|
1281
|
-
return typeof title === 'string' ? React.createElement(Button$1, Object.assign({
|
|
1282
|
-
onClick: event => this.onClick(event, onClick)
|
|
1283
|
-
}, props, {
|
|
1284
|
-
isDisabled: isDisabled,
|
|
1285
|
-
key: itemKey || `outside_dropdown_${key}`,
|
|
1286
|
-
"data-key": itemKey || `outside_dropdown_${key}`
|
|
1287
|
-
}), title) : React.cloneElement(title, Object.assign({
|
|
1288
|
-
onClick,
|
|
1289
|
-
isDisabled
|
|
1290
|
-
}, props));
|
|
1291
|
-
}), React.createElement(Dropdown, Object.assign({
|
|
1292
|
-
toggle: actionsToggleClone,
|
|
1293
|
-
position: dropdownPosition,
|
|
1294
|
-
direction: dropdownDirection,
|
|
1295
|
-
isOpen: isOpen,
|
|
1296
|
-
dropdownItems: items.filter(item => !item.isOutsideDropdown).map((_a, key) => {
|
|
1297
|
-
var {
|
|
1298
|
-
title,
|
|
1299
|
-
itemKey,
|
|
1300
|
-
onClick,
|
|
1301
|
-
isSeparator
|
|
1302
|
-
} = _a,
|
|
1303
|
-
props = __rest(_a, ["title", "itemKey", "onClick", "isSeparator"]);
|
|
1304
|
-
|
|
1305
|
-
return isSeparator ? React.createElement(DropdownSeparator, Object.assign({}, props, {
|
|
1306
|
-
key: itemKey || key,
|
|
1307
|
-
"data-key": itemKey || key
|
|
1308
|
-
})) : React.createElement(DropdownItem, Object.assign({
|
|
1309
|
-
component: "button",
|
|
1310
|
-
onClick: event => {
|
|
1311
|
-
this.onClick(event, onClick);
|
|
1312
|
-
this.onToggle(!isOpen);
|
|
1313
|
-
}
|
|
1314
|
-
}, props, {
|
|
1315
|
-
key: itemKey || key,
|
|
1316
|
-
"data-key": itemKey || key
|
|
1317
|
-
}), title);
|
|
1318
|
-
}),
|
|
1319
|
-
isPlain: true
|
|
1320
|
-
}, rowData && rowData.actionProps)), children);
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
}
|
|
1324
|
-
ActionsColumn.displayName = 'ActionsColumn';
|
|
1325
|
-
ActionsColumn.defaultProps = {
|
|
1326
|
-
children: null,
|
|
1327
|
-
items: [],
|
|
1328
|
-
dropdownPosition: DropdownPosition.right,
|
|
1329
|
-
dropdownDirection: DropdownDirection.down,
|
|
1330
|
-
rowData: {},
|
|
1331
|
-
extraData: {}
|
|
1332
|
-
};
|
|
1333
|
-
|
|
1334
|
-
const resolveOrDefault = (resolver, defaultValue, rowData, extraData) => typeof resolver === 'function' ? resolver(rowData, extraData) : defaultValue;
|
|
1335
|
-
|
|
1336
|
-
const cellActions = (actions, actionResolver, areActionsDisabled) => (label, {
|
|
1337
|
-
rowData,
|
|
1338
|
-
column,
|
|
1339
|
-
rowIndex,
|
|
1340
|
-
columnIndex,
|
|
1341
|
-
column: {
|
|
1342
|
-
extraParams: {
|
|
1343
|
-
dropdownPosition,
|
|
1344
|
-
dropdownDirection,
|
|
1345
|
-
actionsToggle
|
|
1346
|
-
}
|
|
1347
|
-
},
|
|
1348
|
-
property
|
|
1349
|
-
}) => {
|
|
1350
|
-
const extraData = {
|
|
1351
|
-
rowIndex,
|
|
1352
|
-
columnIndex,
|
|
1353
|
-
column,
|
|
1354
|
-
property
|
|
1355
|
-
};
|
|
1356
|
-
const resolvedActions = resolveOrDefault(actionResolver, actions, rowData, extraData);
|
|
1357
|
-
const resolvedIsDisabled = resolveOrDefault(areActionsDisabled, rowData && rowData.disableActions, rowData, extraData);
|
|
1358
|
-
const renderProps = resolvedActions && resolvedActions.length > 0 ? {
|
|
1359
|
-
children: React.createElement(ActionsColumn, {
|
|
1360
|
-
items: resolvedActions,
|
|
1361
|
-
dropdownPosition: dropdownPosition,
|
|
1362
|
-
dropdownDirection: dropdownDirection,
|
|
1363
|
-
isDisabled: resolvedIsDisabled,
|
|
1364
|
-
rowData: rowData,
|
|
1365
|
-
extraData: extraData,
|
|
1366
|
-
actionsToggle: actionsToggle
|
|
1367
|
-
}, label)
|
|
1368
|
-
} : {};
|
|
1369
|
-
return Object.assign({
|
|
1370
|
-
className: css(styles$1.tableAction),
|
|
1371
|
-
style: {
|
|
1372
|
-
paddingRight: 0
|
|
1373
|
-
},
|
|
1374
|
-
isVisible: true
|
|
1375
|
-
}, renderProps);
|
|
1376
|
-
};
|
|
1377
|
-
|
|
1378
|
-
const compoundExpand = (value, {
|
|
1379
|
-
rowIndex,
|
|
1380
|
-
columnIndex,
|
|
1381
|
-
rowData,
|
|
1382
|
-
column,
|
|
1383
|
-
property
|
|
1384
|
-
}) => {
|
|
1385
|
-
if (!value) {
|
|
1386
|
-
return null;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
const {
|
|
1390
|
-
title,
|
|
1391
|
-
props
|
|
1392
|
-
} = value;
|
|
1393
|
-
const {
|
|
1394
|
-
extraParams: {
|
|
1395
|
-
onExpand
|
|
1396
|
-
}
|
|
1397
|
-
} = column;
|
|
1398
|
-
const extraData = {
|
|
1399
|
-
rowIndex,
|
|
1400
|
-
columnIndex,
|
|
1401
|
-
column,
|
|
1402
|
-
property
|
|
1403
|
-
};
|
|
1404
|
-
/**
|
|
1405
|
-
* @param {React.MouseEvent} event - Mouse event
|
|
1406
|
-
*/
|
|
1619
|
+
props = __rest$1(_a, ["children", "className", "component", "dataLabel", "scope", "textCenter", "sort", "modifier", "select", "expand", "tooltip", "tooltipProps", "onMouseEnter", "width", "visibility", "innerRef", "info", "isStickyColumn", "hasRightBorder", "hasLeftBorder", "stickyMinWidth", "stickyLeftOffset", "stickyRightOffset", "isSubheader", "screenReaderText", 'aria-label']);
|
|
1407
1620
|
|
|
1408
|
-
|
|
1409
|
-
//
|
|
1410
|
-
|
|
1621
|
+
if (!children && !screenReaderText && !ariaLabel) {
|
|
1622
|
+
// eslint-disable-next-line no-console
|
|
1623
|
+
console.warn('Th: Table headers must have an accessible name. If the Th is intended to be visually empty, pass in screenReaderText. If the Th contains only non-text, interactive content such as a checkbox or expand toggle, pass in an aria-label.');
|
|
1411
1624
|
}
|
|
1412
1625
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
};
|
|
1423
|
-
};
|
|
1424
|
-
|
|
1425
|
-
const FavoritesCell = _a => {
|
|
1426
|
-
var {
|
|
1427
|
-
className = '',
|
|
1428
|
-
onFavorite,
|
|
1429
|
-
isFavorited,
|
|
1430
|
-
rowIndex
|
|
1431
|
-
} = _a,
|
|
1432
|
-
props = __rest(_a, ["className", "onFavorite", "isFavorited", "rowIndex"]);
|
|
1433
|
-
|
|
1434
|
-
const ariaProps = rowIndex === undefined ? {} : {
|
|
1435
|
-
id: `favorites-button-${rowIndex}`,
|
|
1436
|
-
'aria-labelledby': `favorites-button-${rowIndex}`
|
|
1437
|
-
};
|
|
1438
|
-
return React.createElement(Button$1, Object.assign({
|
|
1439
|
-
variant: "plain",
|
|
1440
|
-
className: className,
|
|
1441
|
-
type: "button",
|
|
1442
|
-
"aria-label": isFavorited ? 'Starred' : 'Not starred',
|
|
1443
|
-
onClick: onFavorite
|
|
1444
|
-
}, ariaProps, props), React.createElement(StarIcon$1, {
|
|
1445
|
-
"aria-hidden": true
|
|
1446
|
-
}));
|
|
1447
|
-
};
|
|
1448
|
-
FavoritesCell.displayName = 'FavoritesCell';
|
|
1449
|
-
|
|
1450
|
-
const favoritable = (value, {
|
|
1451
|
-
rowIndex,
|
|
1452
|
-
columnIndex,
|
|
1453
|
-
rowData,
|
|
1454
|
-
column,
|
|
1455
|
-
property
|
|
1456
|
-
}) => {
|
|
1457
|
-
const {
|
|
1458
|
-
extraParams: {
|
|
1459
|
-
onFavorite
|
|
1626
|
+
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
1627
|
+
const [truncated, setTruncated] = React.useState(false);
|
|
1628
|
+
const cellRef = innerRef ? innerRef : React.createRef();
|
|
1629
|
+
|
|
1630
|
+
const onMouseEnter = event => {
|
|
1631
|
+
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1632
|
+
!showTooltip && setShowTooltip(true);
|
|
1633
|
+
} else {
|
|
1634
|
+
showTooltip && setShowTooltip(false);
|
|
1460
1635
|
}
|
|
1461
|
-
} = column;
|
|
1462
|
-
const extraData = {
|
|
1463
|
-
rowIndex,
|
|
1464
|
-
columnIndex,
|
|
1465
|
-
column,
|
|
1466
|
-
property
|
|
1467
|
-
}; // this is a child row which should not display the favorites icon
|
|
1468
1636
|
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
component: 'td',
|
|
1472
|
-
isVisible: true
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* @param {React.MouseEvent} event - Mouse event
|
|
1477
|
-
*/
|
|
1637
|
+
onMouseEnterProp(event);
|
|
1638
|
+
};
|
|
1478
1639
|
|
|
1640
|
+
let sortParams = null;
|
|
1479
1641
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1642
|
+
if (sort) {
|
|
1643
|
+
if (sort.isFavorites) {
|
|
1644
|
+
sortParams = sortableFavorites({
|
|
1645
|
+
onSort: sort === null || sort === void 0 ? void 0 : sort.onSort,
|
|
1646
|
+
columnIndex: sort.columnIndex,
|
|
1647
|
+
sortBy: sort.sortBy,
|
|
1648
|
+
tooltip: tooltip,
|
|
1649
|
+
tooltipProps
|
|
1650
|
+
})();
|
|
1651
|
+
} else {
|
|
1652
|
+
sortParams = sortable(children, {
|
|
1653
|
+
columnIndex: sort.columnIndex,
|
|
1654
|
+
column: {
|
|
1655
|
+
extraParams: {
|
|
1656
|
+
sortBy: sort.sortBy,
|
|
1657
|
+
onSort: sort === null || sort === void 0 ? void 0 : sort.onSort
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
tooltip: tooltip,
|
|
1661
|
+
tooltipProps
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1483
1664
|
}
|
|
1484
1665
|
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1666
|
+
const selectParams = select ? selectable(children, {
|
|
1667
|
+
rowData: {
|
|
1668
|
+
selected: select.isSelected,
|
|
1669
|
+
disableSelection: select === null || select === void 0 ? void 0 : select.isDisabled,
|
|
1670
|
+
props: select === null || select === void 0 ? void 0 : select.props
|
|
1671
|
+
},
|
|
1672
|
+
column: {
|
|
1673
|
+
extraParams: {
|
|
1674
|
+
onSelect: select === null || select === void 0 ? void 0 : select.onSelect,
|
|
1675
|
+
selectVariant: 'checkbox',
|
|
1676
|
+
allRowsSelected: select.isSelected,
|
|
1677
|
+
isHeaderSelectDisabled: !!select.isHeaderSelectDisabled
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
tooltip: tooltip,
|
|
1681
|
+
tooltipProps
|
|
1682
|
+
}) : null;
|
|
1683
|
+
const collapseParams = collapse ? collapsible(children, {
|
|
1684
|
+
column: {
|
|
1685
|
+
extraParams: {
|
|
1686
|
+
onCollapse: collapse === null || collapse === void 0 ? void 0 : collapse.onToggle,
|
|
1687
|
+
allRowsExpanded: !collapse.areAllExpanded,
|
|
1688
|
+
collapseAllAriaLabel: ''
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}) : null;
|
|
1692
|
+
const widthParams = width ? cellWidth(width)() : null;
|
|
1693
|
+
const visibilityParams = visibility ? classNames(...visibility.map(vis => Visibility[vis]))() : null;
|
|
1694
|
+
let transformedChildren = (sortParams === null || sortParams === void 0 ? void 0 : sortParams.children) || (selectParams === null || selectParams === void 0 ? void 0 : selectParams.children) || (collapseParams === null || collapseParams === void 0 ? void 0 : collapseParams.children) || children; // info can wrap other transformedChildren
|
|
1496
1695
|
|
|
1497
|
-
|
|
1498
|
-
name: 'GripVerticalIcon',
|
|
1499
|
-
height: 512,
|
|
1500
|
-
width: 320,
|
|
1501
|
-
svgPath: 'M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z',
|
|
1502
|
-
yOffset: 0,
|
|
1503
|
-
xOffset: 0
|
|
1504
|
-
};
|
|
1505
|
-
const GripVerticalIcon = createIcon(GripVerticalIconConfig);
|
|
1506
|
-
var GripVerticalIcon$1 = GripVerticalIcon;
|
|
1696
|
+
let infoParams = null;
|
|
1507
1697
|
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
'aria-label': ariaLabel,
|
|
1513
|
-
id
|
|
1514
|
-
} = _a,
|
|
1515
|
-
props = __rest(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
1698
|
+
if (infoProps) {
|
|
1699
|
+
infoParams = info(infoProps)(transformedChildren);
|
|
1700
|
+
transformedChildren = infoParams.children;
|
|
1701
|
+
}
|
|
1516
1702
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1703
|
+
const merged = mergeProps(sortParams, selectParams, collapseParams, widthParams, visibilityParams, infoParams);
|
|
1704
|
+
|
|
1705
|
+
const {
|
|
1706
|
+
// ignore the merged children since we transform them ourselves so we can wrap it with info
|
|
1707
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1708
|
+
children: mergedChildren = null,
|
|
1709
|
+
// selectable adds this but we don't want it
|
|
1710
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1711
|
+
isVisible = null,
|
|
1712
|
+
className: mergedClassName = '',
|
|
1713
|
+
component: MergedComponent = component
|
|
1714
|
+
} = merged,
|
|
1715
|
+
mergedProps = __rest$1(merged, ["children", "isVisible", "className", "component"]);
|
|
1716
|
+
|
|
1717
|
+
React.useEffect(() => {
|
|
1718
|
+
setTruncated(cellRef.current.offsetWidth < cellRef.current.scrollWidth);
|
|
1719
|
+
}, [cellRef]);
|
|
1720
|
+
const cell = React.createElement(MergedComponent, Object.assign({
|
|
1721
|
+
tabIndex: sort || select || !truncated ? -1 : 0,
|
|
1722
|
+
onFocus: tooltip !== null ? onMouseEnter : onMouseEnterProp,
|
|
1723
|
+
onBlur: () => setShowTooltip(false),
|
|
1724
|
+
"data-label": dataLabel,
|
|
1725
|
+
onMouseEnter: tooltip !== null ? onMouseEnter : onMouseEnterProp,
|
|
1726
|
+
scope: component === 'th' ? scope : null,
|
|
1727
|
+
ref: cellRef,
|
|
1728
|
+
"aria-label": ariaLabel,
|
|
1729
|
+
className: css(styles$1.tableTh, className, textCenter && styles$1.modifiers.center, isSubheader && styles$1.tableSubhead, isStickyColumn && styles.tableStickyCell, hasRightBorder && styles.modifiers.borderRight, hasLeftBorder && styles.modifiers.borderLeft, modifier && styles$1.modifiers[modifier], mergedClassName)
|
|
1730
|
+
}, mergedProps, props, isStickyColumn && {
|
|
1731
|
+
style: Object.assign({
|
|
1732
|
+
[cssStickyCellMinWidth.name]: stickyMinWidth ? stickyMinWidth : undefined,
|
|
1733
|
+
[cssStickyCellLeft.name]: stickyLeftOffset ? stickyLeftOffset : 0,
|
|
1734
|
+
[cssStickyCellRight.name]: stickyRightOffset ? stickyRightOffset : 0
|
|
1735
|
+
}, props.style)
|
|
1736
|
+
}), transformedChildren || screenReaderText && React.createElement("span", {
|
|
1737
|
+
className: "pf-v5-screen-reader"
|
|
1738
|
+
}, screenReaderText));
|
|
1739
|
+
const canMakeDefaultTooltip = tooltip === '' ? typeof transformedChildren === 'string' : true;
|
|
1740
|
+
const childControlsTooltip = sortParams || selectParams;
|
|
1741
|
+
return tooltip !== null && canMakeDefaultTooltip && !childControlsTooltip && showTooltip ? React.createElement(React.Fragment, null, cell, React.createElement(Tooltip, Object.assign({
|
|
1742
|
+
triggerRef: cellRef,
|
|
1743
|
+
content: tooltip || tooltip === '' && children,
|
|
1744
|
+
isVisible: true
|
|
1745
|
+
}, tooltipProps))) : cell;
|
|
1527
1746
|
};
|
|
1528
|
-
|
|
1747
|
+
|
|
1748
|
+
const Th = React.forwardRef((props, ref) => React.createElement(ThBase, Object.assign({}, props, {
|
|
1749
|
+
innerRef: ref
|
|
1750
|
+
})));
|
|
1751
|
+
Th.displayName = 'Th';
|
|
1529
1752
|
|
|
1530
1753
|
const draggable = (value, {
|
|
1531
1754
|
rowData
|
|
@@ -1541,93 +1764,6 @@ const draggable = (value, {
|
|
|
1541
1764
|
};
|
|
1542
1765
|
};
|
|
1543
1766
|
|
|
1544
|
-
const EllipsisHIconConfig = {
|
|
1545
|
-
name: 'EllipsisHIcon',
|
|
1546
|
-
height: 512,
|
|
1547
|
-
width: 512,
|
|
1548
|
-
svgPath: 'M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z',
|
|
1549
|
-
yOffset: 0,
|
|
1550
|
-
xOffset: 0
|
|
1551
|
-
};
|
|
1552
|
-
const EllipsisHIcon = createIcon(EllipsisHIconConfig);
|
|
1553
|
-
var EllipsisHIcon$1 = EllipsisHIcon;
|
|
1554
|
-
|
|
1555
|
-
const treeRow = (onCollapse, onCheckChange, onToggleRowDetails) => (value, {
|
|
1556
|
-
rowIndex,
|
|
1557
|
-
rowData
|
|
1558
|
-
}) => {
|
|
1559
|
-
const {
|
|
1560
|
-
isExpanded,
|
|
1561
|
-
isDetailsExpanded,
|
|
1562
|
-
'aria-level': level,
|
|
1563
|
-
'aria-setsize': setsize,
|
|
1564
|
-
toggleAriaLabel,
|
|
1565
|
-
checkAriaLabel,
|
|
1566
|
-
showDetailsAriaLabel,
|
|
1567
|
-
isChecked,
|
|
1568
|
-
checkboxId,
|
|
1569
|
-
icon
|
|
1570
|
-
} = rowData.props;
|
|
1571
|
-
const content = value.title || value;
|
|
1572
|
-
const text = React.createElement("div", {
|
|
1573
|
-
className: css(stylesTreeView.tableTreeViewText),
|
|
1574
|
-
key: "tree-view-text"
|
|
1575
|
-
}, icon && React.createElement("span", {
|
|
1576
|
-
className: css(stylesTreeView.tableTreeViewIcon),
|
|
1577
|
-
key: "tree-view-text-icon"
|
|
1578
|
-
}, icon), React.createElement("span", {
|
|
1579
|
-
className: "pf-c-table__text",
|
|
1580
|
-
key: "table-text"
|
|
1581
|
-
}, content));
|
|
1582
|
-
|
|
1583
|
-
const onChange = (isChecked, event) => {
|
|
1584
|
-
onCheckChange(event, isChecked, rowIndex, content, rowData);
|
|
1585
|
-
};
|
|
1586
|
-
|
|
1587
|
-
return {
|
|
1588
|
-
component: 'th',
|
|
1589
|
-
className: 'pf-c-table__tree-view-title-cell',
|
|
1590
|
-
children: level !== undefined ? React.createElement("div", {
|
|
1591
|
-
className: css(stylesTreeView.tableTreeViewMain)
|
|
1592
|
-
}, setsize > 0 && React.createElement("span", {
|
|
1593
|
-
className: css(stylesTreeView.tableToggle),
|
|
1594
|
-
key: "table-toggle"
|
|
1595
|
-
}, React.createElement(Button, {
|
|
1596
|
-
variant: "plain",
|
|
1597
|
-
onClick: event => onCollapse && onCollapse(event, rowIndex, content, rowData),
|
|
1598
|
-
className: css(isExpanded && styles$1.modifiers.expanded),
|
|
1599
|
-
"aria-expanded": isExpanded,
|
|
1600
|
-
"aria-label": toggleAriaLabel || `${isExpanded ? 'Collapse' : 'Expand'} row ${rowIndex}`
|
|
1601
|
-
}, React.createElement("div", {
|
|
1602
|
-
className: css(stylesTreeView.tableToggleIcon)
|
|
1603
|
-
}, React.createElement(AngleDownIcon$1, {
|
|
1604
|
-
"aria-hidden": "true"
|
|
1605
|
-
})))), !!onCheckChange && React.createElement("span", {
|
|
1606
|
-
className: css(stylesTreeView.tableCheck),
|
|
1607
|
-
key: "table-check"
|
|
1608
|
-
}, React.createElement("label", {
|
|
1609
|
-
htmlFor: checkboxId || `checkbox_${rowIndex}`
|
|
1610
|
-
}, React.createElement(Checkbox, {
|
|
1611
|
-
id: checkboxId || `checkbox_${rowIndex}`,
|
|
1612
|
-
"aria-label": checkAriaLabel || `Row ${rowIndex} checkbox`,
|
|
1613
|
-
isChecked: isChecked,
|
|
1614
|
-
onChange: onChange
|
|
1615
|
-
}))), text, !!onToggleRowDetails && React.createElement("span", {
|
|
1616
|
-
className: css(stylesTreeView.tableTreeViewDetailsToggle),
|
|
1617
|
-
key: "view-details-toggle"
|
|
1618
|
-
}, React.createElement(Button, {
|
|
1619
|
-
variant: "plain",
|
|
1620
|
-
"aria-expanded": isDetailsExpanded,
|
|
1621
|
-
"aria-label": showDetailsAriaLabel || 'Show row details',
|
|
1622
|
-
onClick: event => onToggleRowDetails && onToggleRowDetails(event, rowIndex, content, rowData)
|
|
1623
|
-
}, React.createElement("span", {
|
|
1624
|
-
className: "pf-c-table__details-toggle-icon"
|
|
1625
|
-
}, React.createElement(EllipsisHIcon$1, {
|
|
1626
|
-
"aria-hidden": true
|
|
1627
|
-
}))))) : text
|
|
1628
|
-
};
|
|
1629
|
-
};
|
|
1630
|
-
|
|
1631
1767
|
const TdBase = _a => {
|
|
1632
1768
|
var {
|
|
1633
1769
|
children,
|
|
@@ -1647,15 +1783,37 @@ const TdBase = _a => {
|
|
|
1647
1783
|
visibility,
|
|
1648
1784
|
innerRef,
|
|
1649
1785
|
favorites = null,
|
|
1650
|
-
draggableRow: draggableRowProp = null
|
|
1786
|
+
draggableRow: draggableRowProp = null,
|
|
1787
|
+
tooltip = '',
|
|
1788
|
+
onMouseEnter: onMouseEnterProp = () => {},
|
|
1789
|
+
isStickyColumn = false,
|
|
1790
|
+
hasRightBorder = false,
|
|
1791
|
+
hasLeftBorder = false,
|
|
1792
|
+
stickyMinWidth = '120px',
|
|
1793
|
+
stickyLeftOffset,
|
|
1794
|
+
stickyRightOffset
|
|
1651
1795
|
} = _a,
|
|
1652
|
-
props = __rest(_a, ["children", "className", "isActionCell", "component", "dataLabel", "textCenter", "modifier", "select", "actions", "expand", "treeRow", "compoundExpand", "noPadding", "width", "visibility", "innerRef", "favorites", "draggableRow"]);
|
|
1796
|
+
props = __rest$1(_a, ["children", "className", "isActionCell", "component", "dataLabel", "textCenter", "modifier", "select", "actions", "expand", "treeRow", "compoundExpand", "noPadding", "width", "visibility", "innerRef", "favorites", "draggableRow", "tooltip", "onMouseEnter", "isStickyColumn", "hasRightBorder", "hasLeftBorder", "stickyMinWidth", "stickyLeftOffset", "stickyRightOffset"]);
|
|
1797
|
+
|
|
1798
|
+
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
1799
|
+
const [truncated, setTruncated] = React.useState(false);
|
|
1800
|
+
const cellRef = innerRef ? innerRef : React.createRef();
|
|
1801
|
+
|
|
1802
|
+
const onMouseEnter = event => {
|
|
1803
|
+
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1804
|
+
!showTooltip && setShowTooltip(true);
|
|
1805
|
+
} else {
|
|
1806
|
+
showTooltip && setShowTooltip(false);
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
onMouseEnterProp(event);
|
|
1810
|
+
};
|
|
1653
1811
|
|
|
1654
1812
|
const selectParams = select ? selectable(children, {
|
|
1655
1813
|
rowIndex: select.rowIndex,
|
|
1656
1814
|
rowData: {
|
|
1657
1815
|
selected: select.isSelected,
|
|
1658
|
-
disableSelection: select === null || select === void 0 ? void 0 : select.
|
|
1816
|
+
disableSelection: select === null || select === void 0 ? void 0 : select.isDisabled,
|
|
1659
1817
|
props: select === null || select === void 0 ? void 0 : select.props
|
|
1660
1818
|
},
|
|
1661
1819
|
column: {
|
|
@@ -1686,12 +1844,13 @@ const TdBase = _a => {
|
|
|
1686
1844
|
const actionParams = actionParamsFunc ? actionParamsFunc(null, {
|
|
1687
1845
|
rowIndex: actions === null || actions === void 0 ? void 0 : actions.rowIndex,
|
|
1688
1846
|
rowData: {
|
|
1689
|
-
disableActions: actions === null || actions === void 0 ? void 0 : actions.
|
|
1847
|
+
disableActions: actions === null || actions === void 0 ? void 0 : actions.isDisabled
|
|
1690
1848
|
},
|
|
1691
1849
|
column: {
|
|
1692
1850
|
extraParams: {
|
|
1693
1851
|
dropdownPosition: actions === null || actions === void 0 ? void 0 : actions.dropdownPosition,
|
|
1694
1852
|
dropdownDirection: actions === null || actions === void 0 ? void 0 : actions.dropdownDirection,
|
|
1853
|
+
menuAppendTo: actions === null || actions === void 0 ? void 0 : actions.menuAppendTo,
|
|
1695
1854
|
actionsToggle: actions === null || actions === void 0 ? void 0 : actions.actionsToggle
|
|
1696
1855
|
}
|
|
1697
1856
|
}
|
|
@@ -1704,7 +1863,8 @@ const TdBase = _a => {
|
|
|
1704
1863
|
},
|
|
1705
1864
|
column: {
|
|
1706
1865
|
extraParams: {
|
|
1707
|
-
onCollapse: expand === null || expand === void 0 ? void 0 : expand.onToggle
|
|
1866
|
+
onCollapse: expand === null || expand === void 0 ? void 0 : expand.onToggle,
|
|
1867
|
+
expandId: expand === null || expand === void 0 ? void 0 : expand.expandId
|
|
1708
1868
|
}
|
|
1709
1869
|
}
|
|
1710
1870
|
}) : null;
|
|
@@ -1714,9 +1874,12 @@ const TdBase = _a => {
|
|
|
1714
1874
|
isOpen: compoundExpandProp.isExpanded
|
|
1715
1875
|
}
|
|
1716
1876
|
}, {
|
|
1877
|
+
rowIndex: compoundExpandProp === null || compoundExpandProp === void 0 ? void 0 : compoundExpandProp.rowIndex,
|
|
1878
|
+
columnIndex: compoundExpandProp === null || compoundExpandProp === void 0 ? void 0 : compoundExpandProp.columnIndex,
|
|
1717
1879
|
column: {
|
|
1718
1880
|
extraParams: {
|
|
1719
|
-
onExpand: compoundExpandProp === null || compoundExpandProp === void 0 ? void 0 : compoundExpandProp.onToggle
|
|
1881
|
+
onExpand: compoundExpandProp === null || compoundExpandProp === void 0 ? void 0 : compoundExpandProp.onToggle,
|
|
1882
|
+
expandId: compoundExpandProp === null || compoundExpandProp === void 0 ? void 0 : compoundExpandProp.expandId
|
|
1720
1883
|
}
|
|
1721
1884
|
}
|
|
1722
1885
|
}) : null;
|
|
@@ -1740,15 +1903,35 @@ const TdBase = _a => {
|
|
|
1740
1903
|
className: mergedClassName = '',
|
|
1741
1904
|
component: MergedComponent = component
|
|
1742
1905
|
} = merged,
|
|
1743
|
-
mergedProps = __rest(merged, ["isVisible", "children", "className", "component"]);
|
|
1906
|
+
mergedProps = __rest$1(merged, ["isVisible", "children", "className", "component"]);
|
|
1744
1907
|
|
|
1745
|
-
const treeTableTitleCell = className && className.includes(
|
|
1746
|
-
|
|
1908
|
+
const treeTableTitleCell = className && className.includes(treeViewStyles.tableTreeViewTitleCell) || mergedClassName && mergedClassName.includes(treeViewStyles.tableTreeViewTitleCell);
|
|
1909
|
+
React.useEffect(() => {
|
|
1910
|
+
setTruncated(cellRef.current.offsetWidth < cellRef.current.scrollWidth);
|
|
1911
|
+
}, [cellRef]);
|
|
1912
|
+
const cell = React.createElement(MergedComponent, Object.assign({
|
|
1913
|
+
tabIndex: (select || !truncated) && modifier !== 'truncate' ? -1 : 0
|
|
1914
|
+
}, !treeTableTitleCell && {
|
|
1747
1915
|
'data-label': dataLabel
|
|
1748
1916
|
}, {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1917
|
+
onFocus: tooltip !== null ? onMouseEnter : onMouseEnterProp,
|
|
1918
|
+
onBlur: () => setShowTooltip(false),
|
|
1919
|
+
onMouseEnter: tooltip !== null ? onMouseEnter : onMouseEnterProp,
|
|
1920
|
+
className: css(styles$1.tableTd, className, isActionCell && styles$1.tableAction, textCenter && styles$1.modifiers.center, noPadding && styles$1.modifiers.noPadding, isStickyColumn && styles.tableStickyCell, hasRightBorder && styles.modifiers.borderRight, hasLeftBorder && styles.modifiers.borderLeft, styles$1.modifiers[modifier], draggableParams && styles$1.tableDraggable, mergedClassName),
|
|
1921
|
+
ref: cellRef
|
|
1922
|
+
}, mergedProps, props, isStickyColumn && {
|
|
1923
|
+
style: Object.assign({
|
|
1924
|
+
[cssStickyCellMinWidth.name]: stickyMinWidth ? stickyMinWidth : undefined,
|
|
1925
|
+
[cssStickyCellLeft.name]: stickyLeftOffset ? stickyLeftOffset : 0,
|
|
1926
|
+
[cssStickyCellRight.name]: stickyRightOffset ? stickyRightOffset : 0
|
|
1927
|
+
}, props.style)
|
|
1928
|
+
}), mergedChildren || children);
|
|
1929
|
+
const canMakeDefaultTooltip = tooltip === '' ? typeof children === 'string' : true;
|
|
1930
|
+
return tooltip !== null && canMakeDefaultTooltip && showTooltip ? React.createElement(React.Fragment, null, cell, React.createElement(Tooltip$1, {
|
|
1931
|
+
triggerRef: cellRef,
|
|
1932
|
+
content: tooltip || tooltip === '' && children,
|
|
1933
|
+
isVisible: true
|
|
1934
|
+
})) : cell;
|
|
1752
1935
|
};
|
|
1753
1936
|
|
|
1754
1937
|
const Td = React.forwardRef((props, ref) => React.createElement(TdBase, Object.assign({}, props, {
|
|
@@ -1910,7 +2093,7 @@ function FilterableTable({
|
|
|
1910
2093
|
headingLevel: 'h3'
|
|
1911
2094
|
}, React__default.createElement(Spinner, {
|
|
1912
2095
|
size: 'lg'
|
|
1913
|
-
})))) : React__default.createElement(React__default.Fragment, null, header, React__default.createElement(
|
|
2096
|
+
})))) : React__default.createElement(React__default.Fragment, null, header, React__default.createElement(Table, {
|
|
1914
2097
|
"aria-label": 'Packages Table'
|
|
1915
2098
|
}, React__default.createElement(Thead, null, React__default.createElement(Tr, null, columns.map((col, colIdx) => React__default.createElement(Th, Object.assign({
|
|
1916
2099
|
key: `pkg-table-head-${colIdx}`
|
|
@@ -1930,12 +2113,13 @@ function FilterableTable({
|
|
|
1930
2113
|
}, (_renderRow = renderRow(row)) == null ? void 0 : _renderRow[colIdx]);
|
|
1931
2114
|
}))) : React__default.createElement(Tr, null, React__default.createElement(Td, {
|
|
1932
2115
|
colSpan: columns.length
|
|
1933
|
-
}, React__default.createElement(EmptyState, null, React__default.createElement(
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2116
|
+
}, React__default.createElement(EmptyState, null, React__default.createElement(EmptyStateHeader, {
|
|
2117
|
+
titleText: 'No results found',
|
|
2118
|
+
icon: React__default.createElement(EmptyStateIcon, {
|
|
2119
|
+
icon: SearchIcon
|
|
2120
|
+
}),
|
|
2121
|
+
headingLevel: 'h5'
|
|
2122
|
+
}))))))), renderPagination('bottom'));
|
|
1939
2123
|
}
|
|
1940
2124
|
|
|
1941
2125
|
const FilterInput = ({
|
|
@@ -2052,12 +2236,12 @@ function EcoSelect({
|
|
|
2052
2236
|
id: id,
|
|
2053
2237
|
variant: variant,
|
|
2054
2238
|
"aria-label": ariaLabel,
|
|
2055
|
-
onToggle: onToggle,
|
|
2239
|
+
onToggle: (_event, isOpen) => onToggle(isOpen),
|
|
2056
2240
|
onSelect: onSelect,
|
|
2057
2241
|
selections: selected,
|
|
2058
2242
|
isOpen: isOpen,
|
|
2059
2243
|
placeholderText: placeholderText,
|
|
2060
|
-
className:
|
|
2244
|
+
className: 'pf-select-wrapper'
|
|
2061
2245
|
}, options.map(option => React__default.createElement(SelectOption, {
|
|
2062
2246
|
key: option,
|
|
2063
2247
|
value: option
|
|
@@ -2082,7 +2266,7 @@ const ToggleGroup = props => {
|
|
|
2082
2266
|
key: index,
|
|
2083
2267
|
buttonId: option.id,
|
|
2084
2268
|
isSelected: selected === option.id,
|
|
2085
|
-
onChange: onClick
|
|
2269
|
+
onChange: (event, _) => onClick(_, event)
|
|
2086
2270
|
})));
|
|
2087
2271
|
};
|
|
2088
2272
|
|