@rhc-shared-components/packages-table 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/dist/index.js +1466 -810
- package/dist/index.modern.js +1330 -774
- package/package.json +4 -4
- /package/dist/{check-ee7cdde5.js → check-293a8689.js} +0 -0
- /package/dist/{check-317f30b2.js → check-8277bc89.js} +0 -0
- /package/dist/{inline-edit-320c12ad.js → inline-edit-aba2c28a.js} +0 -0
- /package/dist/{inline-edit-b186d03c.js → inline-edit-dea85160.js} +0 -0
- /package/dist/{table-ffd0513c.js → table-68d022f9.js} +0 -0
- /package/dist/{table-817f1921.js → table-ee2a086b.js} +0 -0
- /package/dist/{table-grid-5d7f8359.js → table-grid-5f08beb3.js} +0 -0
- /package/dist/{table-grid-6f46705c.js → table-grid-be1510e7.js} +0 -0
- /package/dist/{table-scrollable-01103545.js → table-scrollable-08a401e0.js} +0 -0
- /package/dist/{table-scrollable-423d12ef.js → table-scrollable-8d506d50.js} +0 -0
- /package/dist/{table-tree-view-eec85588.js → table-tree-view-248a6705.js} +0 -0
- /package/dist/{table-tree-view-ee6ac38a.js → table-tree-view-c9374e2e.js} +0 -0
package/dist/index.modern.js
CHANGED
|
@@ -12,7 +12,7 @@ import { DropdownSeparator } from '@patternfly/react-core/dist/esm/components/Dr
|
|
|
12
12
|
import { DropdownPosition, DropdownDirection } from '@patternfly/react-core/dist/esm/components/Dropdown/dropdownConstants';
|
|
13
13
|
import { format } from 'date-fns';
|
|
14
14
|
|
|
15
|
-
var css_248z = ".vulnerabilities-table .impact-icon {\n font-size: 1.5rem;\n padding-right: 0.5rem
|
|
15
|
+
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
16
|
|
|
17
17
|
/*! *****************************************************************************
|
|
18
18
|
Copyright (c) Microsoft Corporation.
|
|
@@ -39,7 +39,7 @@ function __rest(s, e) {
|
|
|
39
39
|
return t;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
import('./inline-edit-
|
|
42
|
+
import('./inline-edit-dea85160.js');
|
|
43
43
|
var inlineStyles = {
|
|
44
44
|
"button": "pf-c-button",
|
|
45
45
|
"inlineEdit": "pf-c-inline-edit",
|
|
@@ -68,32 +68,32 @@ var inlineStyles = {
|
|
|
68
68
|
* @param {any} args list of objects, string, or arrays to reduce
|
|
69
69
|
*/
|
|
70
70
|
function css(...args) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
// Adapted from https://github.com/JedWatson/classnames/blob/master/index.js
|
|
72
|
+
const classes = [];
|
|
73
|
+
const hasOwn = {}.hasOwnProperty;
|
|
74
|
+
args.filter(Boolean).forEach(arg => {
|
|
75
|
+
const argType = typeof arg;
|
|
76
|
+
|
|
77
|
+
if (argType === 'string' || argType === 'number') {
|
|
78
|
+
classes.push(arg);
|
|
79
|
+
} else if (Array.isArray(arg) && arg.length) {
|
|
80
|
+
const inner = css(...arg);
|
|
81
|
+
|
|
82
|
+
if (inner) {
|
|
83
|
+
classes.push(inner);
|
|
84
|
+
}
|
|
85
|
+
} else if (argType === 'object') {
|
|
86
|
+
for (const key in arg) {
|
|
87
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
88
|
+
classes.push(key);
|
|
78
89
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else if (argType === 'object') {
|
|
86
|
-
for (const key in arg) {
|
|
87
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
88
|
-
classes.push(key);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return classes.join(' ');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return classes.join(' ');
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
import('./table-
|
|
96
|
+
import('./table-68d022f9.js');
|
|
97
97
|
var styles$1 = {
|
|
98
98
|
"button": "pf-c-button",
|
|
99
99
|
"modifiers": {
|
|
@@ -174,7 +174,7 @@ var styles$1 = {
|
|
|
174
174
|
"themeDark": "pf-theme-dark"
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
import('./table-grid-
|
|
177
|
+
import('./table-grid-5f08beb3.js');
|
|
178
178
|
var stylesGrid = {
|
|
179
179
|
"button": "pf-c-button",
|
|
180
180
|
"modifiers": {
|
|
@@ -207,7 +207,7 @@ var stylesGrid = {
|
|
|
207
207
|
"tableToggleIcon": "pf-c-table__toggle-icon"
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
import('./table-tree-view-
|
|
210
|
+
import('./table-tree-view-c9374e2e.js');
|
|
211
211
|
var stylesTreeView = {
|
|
212
212
|
"dropdown": "pf-c-dropdown",
|
|
213
213
|
"modifiers": {
|
|
@@ -232,142 +232,250 @@ var stylesTreeView = {
|
|
|
232
232
|
"tableTreeViewTitleHeaderCell": "pf-c-table__tree-view-title-header-cell"
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
const camelize =
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
.replace('_', '');
|
|
239
|
-
const toCamel = (s) => s.replace(/([-_][a-z])/gi, camelize);
|
|
235
|
+
const camelize = s => s.toUpperCase().replace('-', '').replace('_', '');
|
|
236
|
+
|
|
237
|
+
const toCamel = s => s.replace(/([-_][a-z])/gi, camelize);
|
|
240
238
|
/**
|
|
241
239
|
* @param {string} input - String to capitalize
|
|
242
240
|
*/
|
|
241
|
+
|
|
243
242
|
function capitalize(input) {
|
|
244
|
-
|
|
243
|
+
return input[0].toUpperCase() + input.substring(1);
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
var TableGridBreakpoint;
|
|
247
|
+
|
|
248
248
|
(function (TableGridBreakpoint) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
249
|
+
TableGridBreakpoint["none"] = "";
|
|
250
|
+
TableGridBreakpoint["grid"] = "grid";
|
|
251
|
+
TableGridBreakpoint["gridMd"] = "grid-md";
|
|
252
|
+
TableGridBreakpoint["gridLg"] = "grid-lg";
|
|
253
|
+
TableGridBreakpoint["gridXl"] = "grid-xl";
|
|
254
|
+
TableGridBreakpoint["grid2xl"] = "grid-2xl";
|
|
255
255
|
})(TableGridBreakpoint || (TableGridBreakpoint = {}));
|
|
256
|
+
|
|
256
257
|
var TableVariant;
|
|
258
|
+
|
|
257
259
|
(function (TableVariant) {
|
|
258
|
-
|
|
260
|
+
TableVariant["compact"] = "compact";
|
|
259
261
|
})(TableVariant || (TableVariant = {}));
|
|
260
262
|
|
|
261
263
|
const TableComposableContext = React.createContext({
|
|
262
|
-
|
|
264
|
+
registerSelectableRow: () => {}
|
|
263
265
|
});
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
|
|
267
|
+
const TableComposableBase = _a => {
|
|
268
|
+
var _b, _c;
|
|
269
|
+
|
|
270
|
+
var {
|
|
271
|
+
children,
|
|
272
|
+
className,
|
|
273
|
+
variant,
|
|
274
|
+
borders = true,
|
|
275
|
+
isStickyHeader = false,
|
|
276
|
+
gridBreakPoint = TableGridBreakpoint.gridMd,
|
|
277
|
+
'aria-label': ariaLabel,
|
|
278
|
+
role = 'grid',
|
|
279
|
+
innerRef,
|
|
280
|
+
ouiaId,
|
|
281
|
+
ouiaSafe = true,
|
|
282
|
+
isTreeTable = false,
|
|
283
|
+
isNested = false,
|
|
284
|
+
isStriped = false,
|
|
285
|
+
isExpandable = false,
|
|
267
286
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
268
|
-
nestedHeaderColumnSpans,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
React.createElement("div", { className: "pf-screen-reader" }, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter.")));
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
setTableCaption(React.createElement("caption", { className: "pf-screen-reader" }, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter."));
|
|
291
|
-
}
|
|
292
|
-
}, [selectableRowCaptionText]);
|
|
293
|
-
const ouiaProps = useOUIAProps('Table', ouiaId, ouiaSafe);
|
|
294
|
-
const grid = (_b = stylesGrid.modifiers) === null || _b === void 0 ? void 0 : _b[toCamel(gridBreakPoint || '').replace(/-?2xl/, '_2xl')];
|
|
295
|
-
const breakPointPrefix = `treeView${gridBreakPoint.charAt(0).toUpperCase() + gridBreakPoint.slice(1)}`;
|
|
296
|
-
const treeGrid = (_c = stylesTreeView.modifiers) === null || _c === void 0 ? void 0 : _c[toCamel(breakPointPrefix || '').replace(/-?2xl/, '_2xl')];
|
|
297
|
-
const handleKeys = (event) => {
|
|
298
|
-
if (isNested ||
|
|
299
|
-
!(tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) || // implements roving tab-index to tree tables only
|
|
300
|
-
(tableRef && tableRef.current !== event.target.closest('.pf-c-table:not(.pf-m-nested)'))) {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
const activeElement = document.activeElement;
|
|
304
|
-
const key = event.key;
|
|
305
|
-
const rows = Array.from(tableRef.current.querySelectorAll('tbody tr')).filter(el => !el.classList.contains('pf-m-disabled') && !el.hidden);
|
|
306
|
-
if (key === 'Space' || key === 'Enter') {
|
|
307
|
-
activeElement.click();
|
|
308
|
-
event.preventDefault();
|
|
309
|
-
}
|
|
310
|
-
const getFocusableElement = (element) => element.querySelectorAll('button:not(:disabled), input:not(:disabled), a:not(:disabled)')[0];
|
|
311
|
-
handleArrows(event, rows, (element) => element === activeElement.closest('tr'), getFocusableElement, ['button', 'input', 'a'], undefined, false, true, false);
|
|
312
|
-
};
|
|
313
|
-
const registerSelectableRow = () => {
|
|
314
|
-
!hasSelectableRows && setHasSelectableRows(true);
|
|
287
|
+
nestedHeaderColumnSpans,
|
|
288
|
+
hasSelectableRowCaption,
|
|
289
|
+
selectableRowCaptionText
|
|
290
|
+
} = _a,
|
|
291
|
+
props = __rest(_a, ["children", "className", "variant", "borders", "isStickyHeader", "gridBreakPoint", 'aria-label', "role", "innerRef", "ouiaId", "ouiaSafe", "isTreeTable", "isNested", "isStriped", "isExpandable", "nestedHeaderColumnSpans", "hasSelectableRowCaption", "selectableRowCaptionText"]);
|
|
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
|
|
298
|
+
|
|
299
|
+
if (tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) {
|
|
300
|
+
const tbody = tableRef.current.querySelector('tbody');
|
|
301
|
+
tbody && setTabIndex(Array.from(tbody.querySelectorAll('button, a, input')));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return function cleanup() {
|
|
305
|
+
document.removeEventListener('keydown', handleKeys);
|
|
315
306
|
};
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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.")));
|
|
313
|
+
} else {
|
|
314
|
+
setTableCaption(React.createElement("caption", {
|
|
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();
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const getFocusableElement = element => element.querySelectorAll('button:not(:disabled), input:not(:disabled), a:not(:disabled)')[0];
|
|
340
|
+
|
|
341
|
+
handleArrows(event, rows, element => element === activeElement.closest('tr'), getFocusableElement, ['button', 'input', 'a'], undefined, false, true, false);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const registerSelectableRow = () => {
|
|
345
|
+
!hasSelectableRows && setHasSelectableRows(true);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
return React.createElement(TableComposableContext.Provider, {
|
|
349
|
+
value: {
|
|
350
|
+
registerSelectableRow
|
|
351
|
+
}
|
|
352
|
+
}, React.createElement("table", Object.assign({
|
|
353
|
+
"aria-label": ariaLabel,
|
|
354
|
+
role: role,
|
|
355
|
+
className: css(className, styles$1.table, isTreeTable ? treeGrid : grid, styles$1.modifiers[variant], !borders && styles$1.modifiers.noBorderRows, isStickyHeader && styles$1.modifiers.stickyHeader, isTreeTable && stylesTreeView.modifiers.treeView, isStriped && styles$1.modifiers.striped, isExpandable && styles$1.modifiers.expandable, isNested && 'pf-m-nested'),
|
|
356
|
+
ref: tableRef
|
|
357
|
+
}, isTreeTable && {
|
|
358
|
+
role: 'treegrid'
|
|
359
|
+
}, ouiaProps, props), hasSelectableRowCaption && hasSelectableRows && tableCaption, children));
|
|
320
360
|
};
|
|
321
|
-
|
|
361
|
+
|
|
362
|
+
const TableComposable = React.forwardRef((props, ref) => React.createElement(TableComposableBase, Object.assign({}, props, {
|
|
363
|
+
innerRef: ref
|
|
364
|
+
})));
|
|
322
365
|
TableComposable.displayName = 'TableComposable';
|
|
323
366
|
|
|
324
|
-
const TheadBase =
|
|
325
|
-
|
|
326
|
-
|
|
367
|
+
const TheadBase = _a => {
|
|
368
|
+
var {
|
|
369
|
+
children,
|
|
370
|
+
className,
|
|
371
|
+
noWrap = false,
|
|
372
|
+
innerRef,
|
|
373
|
+
hasNestedHeader
|
|
374
|
+
} = _a,
|
|
375
|
+
props = __rest(_a, ["children", "className", "noWrap", "innerRef", "hasNestedHeader"]);
|
|
376
|
+
|
|
377
|
+
return React.createElement("thead", Object.assign({
|
|
378
|
+
className: css(className, noWrap && styles$1.modifiers.nowrap, hasNestedHeader && styles$1.modifiers.nestedColumnHeader),
|
|
379
|
+
ref: innerRef
|
|
380
|
+
}, props), children);
|
|
327
381
|
};
|
|
328
|
-
|
|
382
|
+
|
|
383
|
+
const Thead = React.forwardRef((props, ref) => React.createElement(TheadBase, Object.assign({}, props, {
|
|
384
|
+
innerRef: ref
|
|
385
|
+
})));
|
|
329
386
|
Thead.displayName = 'Thead';
|
|
330
387
|
|
|
331
|
-
const TbodyBase =
|
|
332
|
-
|
|
333
|
-
|
|
388
|
+
const TbodyBase = _a => {
|
|
389
|
+
var {
|
|
390
|
+
children,
|
|
391
|
+
className,
|
|
392
|
+
isExpanded,
|
|
393
|
+
innerRef,
|
|
394
|
+
isEvenStriped = false,
|
|
395
|
+
isOddStriped = false
|
|
396
|
+
} = _a,
|
|
397
|
+
props = __rest(_a, ["children", "className", "isExpanded", "innerRef", "isEvenStriped", "isOddStriped"]);
|
|
398
|
+
|
|
399
|
+
return React.createElement("tbody", Object.assign({
|
|
400
|
+
role: "rowgroup",
|
|
401
|
+
className: css(className, isExpanded && styles$1.modifiers.expanded, isOddStriped && styles$1.modifiers.striped, isEvenStriped && styles$1.modifiers.stripedEven),
|
|
402
|
+
ref: innerRef
|
|
403
|
+
}, props), children);
|
|
334
404
|
};
|
|
335
|
-
|
|
405
|
+
|
|
406
|
+
const Tbody = React.forwardRef((props, ref) => React.createElement(TbodyBase, Object.assign({}, props, {
|
|
407
|
+
innerRef: ref
|
|
408
|
+
})));
|
|
336
409
|
Tbody.displayName = 'Tbody';
|
|
337
410
|
|
|
338
|
-
const TrBase =
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
411
|
+
const TrBase = _a => {
|
|
412
|
+
var {
|
|
413
|
+
children,
|
|
414
|
+
className,
|
|
415
|
+
isExpanded,
|
|
416
|
+
isEditable,
|
|
417
|
+
isHidden = false,
|
|
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']);
|
|
430
|
+
|
|
431
|
+
const ouiaProps = useOUIAProps('TableRow', ouiaId, ouiaSafe);
|
|
432
|
+
const [computedAriaLabel, setComputedAriaLabel] = React.useState('');
|
|
433
|
+
let onKeyDown = null;
|
|
434
|
+
|
|
435
|
+
if (onRowClick) {
|
|
436
|
+
onKeyDown = e => {
|
|
437
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
438
|
+
onRowClick(e);
|
|
439
|
+
e.preventDefault();
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const rowIsHidden = isHidden || isExpanded !== undefined && !isExpanded;
|
|
445
|
+
const {
|
|
446
|
+
registerSelectableRow
|
|
447
|
+
} = React.useContext(TableComposableContext);
|
|
448
|
+
React.useEffect(() => {
|
|
449
|
+
if (isSelectable && !rowIsHidden) {
|
|
450
|
+
setComputedAriaLabel(`${isRowSelected ? 'Selected' : 'Unselected'}, selectable row.`);
|
|
451
|
+
registerSelectableRow();
|
|
452
|
+
} else {
|
|
453
|
+
setComputedAriaLabel(undefined);
|
|
350
454
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
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));
|
|
366
471
|
};
|
|
367
|
-
|
|
472
|
+
|
|
473
|
+
const Tr = React.forwardRef((props, ref) => React.createElement(TrBase, Object.assign({}, props, {
|
|
474
|
+
innerRef: ref
|
|
475
|
+
})));
|
|
368
476
|
Tr.displayName = 'Tr';
|
|
369
477
|
|
|
370
|
-
import('./table-scrollable-
|
|
478
|
+
import('./table-scrollable-08a401e0.js');
|
|
371
479
|
var styles = {
|
|
372
480
|
"modifiers": {
|
|
373
481
|
"borderRight": "pf-m-border-right",
|
|
@@ -381,56 +489,91 @@ var styles = {
|
|
|
381
489
|
};
|
|
382
490
|
|
|
383
491
|
var IconSize;
|
|
492
|
+
|
|
384
493
|
(function (IconSize) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
494
|
+
IconSize["sm"] = "sm";
|
|
495
|
+
IconSize["md"] = "md";
|
|
496
|
+
IconSize["lg"] = "lg";
|
|
497
|
+
IconSize["xl"] = "xl";
|
|
389
498
|
})(IconSize || (IconSize = {}));
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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';
|
|
510
|
+
|
|
511
|
+
case IconSize.xl:
|
|
512
|
+
return '3em';
|
|
513
|
+
|
|
514
|
+
default:
|
|
515
|
+
return '1em';
|
|
516
|
+
}
|
|
403
517
|
};
|
|
404
518
|
let currentId = 0;
|
|
405
519
|
/**
|
|
406
520
|
* Factory to create Icon class components for consumers
|
|
407
521
|
*/
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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;
|
|
434
577
|
}
|
|
435
578
|
|
|
436
579
|
const HelpIconConfig = {
|
|
@@ -439,59 +582,119 @@ const HelpIconConfig = {
|
|
|
439
582
|
width: 1024,
|
|
440
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',
|
|
441
584
|
yOffset: 0,
|
|
442
|
-
xOffset: 0
|
|
585
|
+
xOffset: 0
|
|
443
586
|
};
|
|
444
|
-
|
|
445
587
|
const HelpIcon = createIcon(HelpIconConfig);
|
|
446
|
-
|
|
447
588
|
var HelpIcon$1 = HelpIcon;
|
|
448
589
|
|
|
449
590
|
var TableTextVariant;
|
|
591
|
+
|
|
450
592
|
(function (TableTextVariant) {
|
|
451
|
-
|
|
452
|
-
|
|
593
|
+
TableTextVariant["div"] = "div";
|
|
594
|
+
TableTextVariant["nav"] = "nav";
|
|
453
595
|
})(TableTextVariant || (TableTextVariant = {}));
|
|
596
|
+
|
|
454
597
|
var WrapModifier;
|
|
598
|
+
|
|
455
599
|
(function (WrapModifier) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
600
|
+
WrapModifier["wrap"] = "wrap";
|
|
601
|
+
WrapModifier["nowrap"] = "nowrap";
|
|
602
|
+
WrapModifier["truncate"] = "truncate";
|
|
603
|
+
WrapModifier["breakWord"] = "breakWord";
|
|
604
|
+
WrapModifier["fitContent"] = "fitContent";
|
|
461
605
|
})(WrapModifier || (WrapModifier = {}));
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
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
|
+
|
|
619
|
+
const Component = variant;
|
|
620
|
+
const [tooltip, setTooltip] = React.useState('');
|
|
621
|
+
|
|
622
|
+
const onMouseEnter = event => {
|
|
623
|
+
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
624
|
+
setTooltip(tooltipProp || event.target.innerText);
|
|
625
|
+
} else {
|
|
626
|
+
setTooltip('');
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
onMouseEnterProp(event);
|
|
630
|
+
};
|
|
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;
|
|
477
640
|
};
|
|
478
641
|
TableText.displayName = 'TableText';
|
|
479
642
|
|
|
480
|
-
const HeaderCellInfoWrapper = ({
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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
|
+
})))));
|
|
487
670
|
HeaderCellInfoWrapper.displayName = 'HeaderCellInfoWrapper';
|
|
488
671
|
|
|
489
|
-
const info = ({
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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;
|
|
495
698
|
};
|
|
496
699
|
|
|
497
700
|
const LongArrowAltUpIconConfig = {
|
|
@@ -500,11 +703,9 @@ const LongArrowAltUpIconConfig = {
|
|
|
500
703
|
width: 256,
|
|
501
704
|
svgPath: 'M88 166.059V468c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12V166.059h46.059c21.382 0 32.09-25.851 16.971-40.971l-86.059-86.059c-9.373-9.373-24.569-9.373-33.941 0l-86.059 86.059c-15.119 15.119-4.411 40.971 16.971 40.971H88z',
|
|
502
705
|
yOffset: 0,
|
|
503
|
-
xOffset: 0
|
|
706
|
+
xOffset: 0
|
|
504
707
|
};
|
|
505
|
-
|
|
506
708
|
const LongArrowAltUpIcon = createIcon(LongArrowAltUpIconConfig);
|
|
507
|
-
|
|
508
709
|
var LongArrowAltUpIcon$1 = LongArrowAltUpIcon;
|
|
509
710
|
|
|
510
711
|
const LongArrowAltDownIconConfig = {
|
|
@@ -513,11 +714,9 @@ const LongArrowAltDownIconConfig = {
|
|
|
513
714
|
width: 256,
|
|
514
715
|
svgPath: 'M168 345.941V44c0-6.627-5.373-12-12-12h-56c-6.627 0-12 5.373-12 12v301.941H41.941c-21.382 0-32.09 25.851-16.971 40.971l86.059 86.059c9.373 9.373 24.569 9.373 33.941 0l86.059-86.059c15.119-15.119 4.411-40.971-16.971-40.971H168z',
|
|
515
716
|
yOffset: 0,
|
|
516
|
-
xOffset: 0
|
|
717
|
+
xOffset: 0
|
|
517
718
|
};
|
|
518
|
-
|
|
519
719
|
const LongArrowAltDownIcon = createIcon(LongArrowAltDownIconConfig);
|
|
520
|
-
|
|
521
720
|
var LongArrowAltDownIcon$1 = LongArrowAltDownIcon;
|
|
522
721
|
|
|
523
722
|
const ArrowsAltVIconConfig = {
|
|
@@ -526,32 +725,46 @@ const ArrowsAltVIconConfig = {
|
|
|
526
725
|
width: 256,
|
|
527
726
|
svgPath: 'M214.059 377.941H168V134.059h46.059c21.382 0 32.09-25.851 16.971-40.971L144.971 7.029c-9.373-9.373-24.568-9.373-33.941 0L24.971 93.088c-15.119 15.119-4.411 40.971 16.971 40.971H88v243.882H41.941c-21.382 0-32.09 25.851-16.971 40.971l86.059 86.059c9.373 9.373 24.568 9.373 33.941 0l86.059-86.059c15.12-15.119 4.412-40.971-16.97-40.971z',
|
|
528
727
|
yOffset: 0,
|
|
529
|
-
xOffset: 0
|
|
728
|
+
xOffset: 0
|
|
530
729
|
};
|
|
531
|
-
|
|
532
730
|
const ArrowsAltVIcon = createIcon(ArrowsAltVIconConfig);
|
|
533
|
-
|
|
534
731
|
var ArrowsAltVIcon$1 = ArrowsAltVIcon;
|
|
535
732
|
|
|
536
733
|
var SortByDirection;
|
|
734
|
+
|
|
537
735
|
(function (SortByDirection) {
|
|
538
|
-
|
|
539
|
-
|
|
736
|
+
SortByDirection["asc"] = "asc";
|
|
737
|
+
SortByDirection["desc"] = "desc";
|
|
540
738
|
})(SortByDirection || (SortByDirection = {}));
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
739
|
+
|
|
740
|
+
const SortColumn = _a => {
|
|
741
|
+
var {
|
|
742
|
+
children = null,
|
|
743
|
+
className = '',
|
|
744
|
+
isSortedBy = false,
|
|
745
|
+
onSort = null,
|
|
746
|
+
sortDirection = '',
|
|
747
|
+
type = 'button'
|
|
748
|
+
} = _a,
|
|
749
|
+
props = __rest(_a, ["children", "className", "isSortedBy", "onSort", "sortDirection", "type"]);
|
|
750
|
+
|
|
751
|
+
let SortedByIcon;
|
|
752
|
+
|
|
753
|
+
if (isSortedBy) {
|
|
754
|
+
SortedByIcon = sortDirection === SortByDirection.asc ? LongArrowAltUpIcon$1 : LongArrowAltDownIcon$1;
|
|
755
|
+
} else {
|
|
756
|
+
SortedByIcon = ArrowsAltVIcon$1;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
return React.createElement("button", Object.assign({}, props, {
|
|
760
|
+
type: type,
|
|
761
|
+
className: css(className, styles$1.tableButton),
|
|
762
|
+
onClick: event => onSort && onSort(event)
|
|
763
|
+
}), React.createElement("div", {
|
|
764
|
+
className: css(className, styles$1.tableButtonContent)
|
|
765
|
+
}, React.createElement(TableText, null, children), React.createElement("span", {
|
|
766
|
+
className: css(styles$1.tableSortIndicator)
|
|
767
|
+
}, React.createElement(SortedByIcon, null))));
|
|
555
768
|
};
|
|
556
769
|
SortColumn.displayName = 'SortColumn';
|
|
557
770
|
|
|
@@ -561,70 +774,97 @@ const StarIconConfig = {
|
|
|
561
774
|
width: 576,
|
|
562
775
|
svgPath: 'M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z',
|
|
563
776
|
yOffset: 0,
|
|
564
|
-
xOffset: 0
|
|
777
|
+
xOffset: 0
|
|
565
778
|
};
|
|
566
|
-
|
|
567
779
|
const StarIcon = createIcon(StarIconConfig);
|
|
568
|
-
|
|
569
780
|
var StarIcon$1 = StarIcon;
|
|
570
781
|
|
|
571
|
-
const sortableFavorites =
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
782
|
+
const sortableFavorites = sort => () => sortable(React.createElement(StarIcon$1, {
|
|
783
|
+
"aria-hidden": true
|
|
784
|
+
}), {
|
|
785
|
+
columnIndex: sort.columnIndex,
|
|
786
|
+
className: styles$1.modifiers.favorite,
|
|
787
|
+
ariaLabel: 'Sort favorites',
|
|
788
|
+
column: {
|
|
789
|
+
extraParams: {
|
|
790
|
+
sortBy: sort.sortBy,
|
|
791
|
+
onSort: sort === null || sort === void 0 ? void 0 : sort.onSort
|
|
580
792
|
}
|
|
793
|
+
}
|
|
581
794
|
});
|
|
582
|
-
const sortable = (label, {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
function sortClicked(event) {
|
|
594
|
-
let reversedDirection;
|
|
595
|
-
if (!isSortedBy) {
|
|
596
|
-
reversedDirection = sortBy.defaultDirection ? sortBy.defaultDirection : SortByDirection.asc;
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
reversedDirection = sortBy.direction === SortByDirection.asc ? SortByDirection.desc : SortByDirection.asc;
|
|
600
|
-
}
|
|
601
|
-
// tslint:disable-next-line:no-unused-expression
|
|
602
|
-
onSort && onSort(event, columnIndex, reversedDirection, extraData);
|
|
795
|
+
const sortable = (label, {
|
|
796
|
+
columnIndex,
|
|
797
|
+
column,
|
|
798
|
+
property,
|
|
799
|
+
className,
|
|
800
|
+
ariaLabel
|
|
801
|
+
}) => {
|
|
802
|
+
const {
|
|
803
|
+
extraParams: {
|
|
804
|
+
sortBy,
|
|
805
|
+
onSort
|
|
603
806
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
807
|
+
} = column;
|
|
808
|
+
const extraData = {
|
|
809
|
+
columnIndex,
|
|
810
|
+
column,
|
|
811
|
+
property
|
|
812
|
+
};
|
|
813
|
+
const isSortedBy = sortBy && columnIndex === sortBy.index;
|
|
814
|
+
/**
|
|
815
|
+
* @param {React.MouseEvent} event - React mouse event
|
|
816
|
+
*/
|
|
817
|
+
|
|
818
|
+
function sortClicked(event) {
|
|
819
|
+
let reversedDirection;
|
|
820
|
+
|
|
821
|
+
if (!isSortedBy) {
|
|
822
|
+
reversedDirection = sortBy.defaultDirection ? sortBy.defaultDirection : SortByDirection.asc;
|
|
823
|
+
} else {
|
|
824
|
+
reversedDirection = sortBy.direction === SortByDirection.asc ? SortByDirection.desc : SortByDirection.asc;
|
|
825
|
+
} // tslint:disable-next-line:no-unused-expression
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
onSort && onSort(event, columnIndex, reversedDirection, extraData);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
return {
|
|
832
|
+
className: css(styles$1.tableSort, isSortedBy && styles$1.modifiers.selected, className),
|
|
833
|
+
'aria-sort': isSortedBy ? `${sortBy.direction}ending` : 'none',
|
|
834
|
+
children: React.createElement(SortColumn, {
|
|
835
|
+
isSortedBy: isSortedBy,
|
|
836
|
+
sortDirection: isSortedBy ? sortBy.direction : '',
|
|
837
|
+
onSort: sortClicked,
|
|
838
|
+
"aria-label": ariaLabel
|
|
839
|
+
}, label)
|
|
840
|
+
};
|
|
609
841
|
};
|
|
610
842
|
|
|
611
843
|
var RowSelectVariant;
|
|
844
|
+
|
|
612
845
|
(function (RowSelectVariant) {
|
|
613
|
-
|
|
614
|
-
|
|
846
|
+
RowSelectVariant["radio"] = "radio";
|
|
847
|
+
RowSelectVariant["checkbox"] = "checkbox";
|
|
615
848
|
})(RowSelectVariant || (RowSelectVariant = {}));
|
|
616
|
-
|
|
617
|
-
|
|
849
|
+
|
|
850
|
+
const SelectColumn = _a => {
|
|
851
|
+
var {
|
|
852
|
+
children = null,
|
|
618
853
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
619
|
-
className,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
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);
|
|
624
864
|
};
|
|
625
865
|
SelectColumn.displayName = 'SelectColumn';
|
|
626
866
|
|
|
627
|
-
import('./check-
|
|
867
|
+
import('./check-8277bc89.js');
|
|
628
868
|
var checkStyles = {
|
|
629
869
|
"check": "pf-c-check",
|
|
630
870
|
"checkBody": "pf-c-check__body",
|
|
@@ -637,55 +877,76 @@ var checkStyles = {
|
|
|
637
877
|
}
|
|
638
878
|
};
|
|
639
879
|
|
|
640
|
-
const selectable = (label, {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
const rowId = rowIndex !== undefined ? rowIndex : -1;
|
|
655
|
-
/**
|
|
656
|
-
* @param {React.FormEvent} event - React form event
|
|
657
|
-
*/
|
|
658
|
-
function selectClick(event) {
|
|
659
|
-
const selected = rowIndex === undefined ? event.currentTarget.checked : rowData && !rowData.selected;
|
|
660
|
-
// tslint:disable-next-line:no-unused-expression
|
|
661
|
-
onSelect && onSelect(event, selected, rowId, rowData, extraData);
|
|
662
|
-
}
|
|
663
|
-
const customProps = Object.assign(Object.assign(Object.assign({}, (rowId !== -1
|
|
664
|
-
? {
|
|
665
|
-
checked: rowData && !!rowData.selected,
|
|
666
|
-
'aria-label': `Select row ${rowIndex}`
|
|
667
|
-
}
|
|
668
|
-
: {
|
|
669
|
-
checked: allRowsSelected,
|
|
670
|
-
'aria-label': 'Select all rows'
|
|
671
|
-
})), (rowData &&
|
|
672
|
-
(rowData.disableCheckbox || rowData.disableSelection) && {
|
|
673
|
-
disabled: true,
|
|
674
|
-
className: checkStyles.checkInput
|
|
675
|
-
})), (!rowData && isHeaderSelectDisabled && { disabled: true }));
|
|
676
|
-
let selectName = 'check-all';
|
|
677
|
-
if (rowId !== -1 && selectVariant === RowSelectVariant.checkbox) {
|
|
678
|
-
selectName = `checkrow${rowIndex}`;
|
|
679
|
-
}
|
|
680
|
-
else if (rowId !== -1) {
|
|
681
|
-
selectName = 'radioGroup';
|
|
880
|
+
const selectable = (label, {
|
|
881
|
+
rowIndex,
|
|
882
|
+
columnIndex,
|
|
883
|
+
rowData,
|
|
884
|
+
column,
|
|
885
|
+
property
|
|
886
|
+
}) => {
|
|
887
|
+
const {
|
|
888
|
+
extraParams: {
|
|
889
|
+
onSelect,
|
|
890
|
+
selectVariant,
|
|
891
|
+
allRowsSelected,
|
|
892
|
+
isHeaderSelectDisabled
|
|
682
893
|
}
|
|
894
|
+
} = column;
|
|
895
|
+
const extraData = {
|
|
896
|
+
rowIndex,
|
|
897
|
+
columnIndex,
|
|
898
|
+
column,
|
|
899
|
+
property
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
if (rowData && rowData.hasOwnProperty('parent') && !rowData.showSelect && !rowData.fullWidth) {
|
|
683
903
|
return {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
isVisible: !rowData || !rowData.fullWidth,
|
|
687
|
-
children: (React.createElement(SelectColumn, Object.assign({}, customProps, { selectVariant: selectVariant, onSelect: selectClick, name: selectName }), label))
|
|
904
|
+
component: 'td',
|
|
905
|
+
isVisible: true
|
|
688
906
|
};
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
const rowId = rowIndex !== undefined ? rowIndex : -1;
|
|
910
|
+
/**
|
|
911
|
+
* @param {React.FormEvent} event - React form event
|
|
912
|
+
*/
|
|
913
|
+
|
|
914
|
+
function selectClick(event) {
|
|
915
|
+
const selected = rowIndex === undefined ? event.currentTarget.checked : rowData && !rowData.selected; // tslint:disable-next-line:no-unused-expression
|
|
916
|
+
|
|
917
|
+
onSelect && onSelect(event, selected, rowId, rowData, extraData);
|
|
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
|
+
};
|
|
689
950
|
};
|
|
690
951
|
|
|
691
952
|
const AngleDownIconConfig = {
|
|
@@ -694,82 +955,96 @@ const AngleDownIconConfig = {
|
|
|
694
955
|
width: 320,
|
|
695
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',
|
|
696
957
|
yOffset: 0,
|
|
697
|
-
xOffset: 0
|
|
958
|
+
xOffset: 0
|
|
698
959
|
};
|
|
699
|
-
|
|
700
960
|
const AngleDownIcon = createIcon(AngleDownIconConfig);
|
|
701
|
-
|
|
702
961
|
var AngleDownIcon$1 = AngleDownIcon;
|
|
703
962
|
|
|
704
|
-
const CollapseColumn =
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
963
|
+
const CollapseColumn = _a => {
|
|
964
|
+
var {
|
|
965
|
+
className = '',
|
|
966
|
+
children = null,
|
|
967
|
+
isOpen,
|
|
968
|
+
onToggle
|
|
969
|
+
} = _a,
|
|
970
|
+
props = __rest(_a, ["className", "children", "isOpen", "onToggle"]);
|
|
971
|
+
|
|
972
|
+
return React.createElement(React.Fragment, null, isOpen !== undefined && React.createElement(Button$1, Object.assign({
|
|
973
|
+
className: css(className, isOpen && styles$1.modifiers.expanded)
|
|
974
|
+
}, props, {
|
|
975
|
+
variant: "plain",
|
|
976
|
+
"aria-label": props['aria-label'] || 'Details',
|
|
977
|
+
onClick: onToggle,
|
|
978
|
+
"aria-expanded": isOpen
|
|
979
|
+
}), React.createElement("div", {
|
|
980
|
+
className: css(styles$1.tableToggleIcon)
|
|
981
|
+
}, React.createElement(AngleDownIcon$1, null))), children);
|
|
711
982
|
};
|
|
712
983
|
CollapseColumn.displayName = 'CollapseColumn';
|
|
713
984
|
|
|
714
|
-
const collapsible = (value, {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
: {
|
|
729
|
-
isOpen: allRowsExpanded,
|
|
730
|
-
'aria-label': collapseAllAriaLabel || 'Expand all rows'
|
|
731
|
-
}));
|
|
732
|
-
/**
|
|
733
|
-
* @param {React.MouseEvent} event - Mouse event
|
|
734
|
-
*/
|
|
735
|
-
function onToggle(event) {
|
|
736
|
-
const open = rowData ? !rowData.isOpen : !allRowsExpanded;
|
|
737
|
-
// tslint:disable-next-line:no-unused-expression
|
|
738
|
-
onCollapse && onCollapse(event, rowIndex, open, rowData, extraData);
|
|
985
|
+
const collapsible = (value, {
|
|
986
|
+
rowIndex,
|
|
987
|
+
columnIndex,
|
|
988
|
+
rowData,
|
|
989
|
+
column,
|
|
990
|
+
property
|
|
991
|
+
}) => {
|
|
992
|
+
const {
|
|
993
|
+
extraParams: {
|
|
994
|
+
onCollapse,
|
|
995
|
+
rowLabeledBy = 'simple-node',
|
|
996
|
+
expandId = 'expand-toggle',
|
|
997
|
+
allRowsExpanded,
|
|
998
|
+
collapseAllAriaLabel
|
|
739
999
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
1000
|
+
} = column;
|
|
1001
|
+
const extraData = {
|
|
1002
|
+
rowIndex,
|
|
1003
|
+
columnIndex,
|
|
1004
|
+
column,
|
|
1005
|
+
property
|
|
1006
|
+
};
|
|
1007
|
+
const rowId = rowIndex !== undefined ? rowIndex : -1;
|
|
1008
|
+
const customProps = Object.assign({}, rowId !== -1 ? {
|
|
1009
|
+
isOpen: rowData === null || rowData === void 0 ? void 0 : rowData.isOpen,
|
|
1010
|
+
'aria-labelledby': `${rowLabeledBy}${rowId} ${expandId}${rowId}`
|
|
1011
|
+
} : {
|
|
1012
|
+
isOpen: allRowsExpanded,
|
|
1013
|
+
'aria-label': collapseAllAriaLabel || 'Expand all rows'
|
|
1014
|
+
});
|
|
1015
|
+
/**
|
|
1016
|
+
* @param {React.MouseEvent} event - Mouse event
|
|
1017
|
+
*/
|
|
1018
|
+
|
|
1019
|
+
function onToggle(event) {
|
|
1020
|
+
const open = rowData ? !rowData.isOpen : !allRowsExpanded; // tslint:disable-next-line:no-unused-expression
|
|
1021
|
+
|
|
1022
|
+
onCollapse && onCollapse(event, rowIndex, open, rowData, extraData);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
return {
|
|
1026
|
+
className: ((rowData === null || rowData === void 0 ? void 0 : rowData.isOpen) !== undefined || rowId === -1) && css(styles$1.tableToggle),
|
|
1027
|
+
isVisible: !(rowData === null || rowData === void 0 ? void 0 : rowData.fullWidth),
|
|
1028
|
+
children: React.createElement(CollapseColumn, Object.assign({
|
|
1029
|
+
"aria-labelledby": `${rowLabeledBy}${rowId} ${expandId}${rowId}`,
|
|
1030
|
+
onToggle: onToggle,
|
|
1031
|
+
id: expandId + rowId
|
|
1032
|
+
}, customProps), value)
|
|
1033
|
+
};
|
|
745
1034
|
};
|
|
746
1035
|
|
|
747
|
-
const cellWidth =
|
|
748
|
-
|
|
1036
|
+
const cellWidth = width => () => ({
|
|
1037
|
+
className: css(styles$1.modifiers[typeof width === 'number' ? `width_${width}` : `width${capitalize(width)}`])
|
|
749
1038
|
});
|
|
750
1039
|
|
|
751
|
-
const visibilityModifiers = [
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
'hiddenOnXl',
|
|
757
|
-
'hiddenOn_2xl',
|
|
758
|
-
'visibleOnSm',
|
|
759
|
-
'visibleOnMd',
|
|
760
|
-
'visibleOnLg',
|
|
761
|
-
'visibleOnXl',
|
|
762
|
-
'visibleOn_2xl'
|
|
763
|
-
];
|
|
764
|
-
const Visibility = visibilityModifiers
|
|
765
|
-
.filter(key => styles$1.modifiers[key])
|
|
766
|
-
.reduce((acc, curr) => {
|
|
767
|
-
const key2 = curr.replace('_2xl', '2Xl');
|
|
768
|
-
acc[key2] = styles$1.modifiers[curr];
|
|
769
|
-
return acc;
|
|
1040
|
+
const visibilityModifiers = ['hidden', 'hiddenOnSm', 'hiddenOnMd', 'hiddenOnLg', 'hiddenOnXl', 'hiddenOn_2xl', 'visibleOnSm', 'visibleOnMd', 'visibleOnLg', 'visibleOnXl', 'visibleOn_2xl'];
|
|
1041
|
+
const Visibility = visibilityModifiers.filter(key => styles$1.modifiers[key]).reduce((acc, curr) => {
|
|
1042
|
+
const key2 = curr.replace('_2xl', '2Xl');
|
|
1043
|
+
acc[key2] = styles$1.modifiers[curr];
|
|
1044
|
+
return acc;
|
|
770
1045
|
}, {});
|
|
771
1046
|
const classNames = (...classes) => () => ({
|
|
772
|
-
|
|
1047
|
+
className: css(...classes)
|
|
773
1048
|
});
|
|
774
1049
|
|
|
775
1050
|
/**
|
|
@@ -781,259 +1056,442 @@ const classNames = (...classes) => () => ({
|
|
|
781
1056
|
/**
|
|
782
1057
|
* @param {any} props - Props
|
|
783
1058
|
*/
|
|
1059
|
+
|
|
784
1060
|
function mergeProps(...props) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
1061
|
+
const firstProps = props[0];
|
|
1062
|
+
const restProps = props.slice(1);
|
|
1063
|
+
|
|
1064
|
+
if (!restProps.length) {
|
|
1065
|
+
return mergeWith({}, firstProps);
|
|
1066
|
+
} // Avoid mutating the first prop collection
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
return mergeWith(mergeWith({}, firstProps), ...restProps, (a, b, key) => {
|
|
1070
|
+
if (key === 'children') {
|
|
1071
|
+
if (a && b) {
|
|
1072
|
+
// compose the two
|
|
1073
|
+
return React.cloneElement(a, {
|
|
1074
|
+
children: b
|
|
1075
|
+
});
|
|
1076
|
+
} // Children have to be merged in reverse order for Reactabular
|
|
1077
|
+
// logic to work.
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
return Object.assign(Object.assign({}, b), a);
|
|
789
1081
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
// Children have to be merged in reverse order for Reactabular
|
|
800
|
-
// logic to work.
|
|
801
|
-
return Object.assign(Object.assign({}, b), a);
|
|
802
|
-
}
|
|
803
|
-
if (key === 'className') {
|
|
804
|
-
// Process class names through classNames to merge properly
|
|
805
|
-
// as a string.
|
|
806
|
-
return css(a, b);
|
|
807
|
-
}
|
|
808
|
-
return undefined;
|
|
809
|
-
});
|
|
1082
|
+
|
|
1083
|
+
if (key === 'className') {
|
|
1084
|
+
// Process class names through classNames to merge properly
|
|
1085
|
+
// as a string.
|
|
1086
|
+
return css(a, b);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
return undefined;
|
|
1090
|
+
});
|
|
810
1091
|
}
|
|
811
1092
|
|
|
812
|
-
const ThBase =
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1093
|
+
const ThBase = _a => {
|
|
1094
|
+
var {
|
|
1095
|
+
children,
|
|
1096
|
+
className,
|
|
1097
|
+
component = 'th',
|
|
1098
|
+
dataLabel,
|
|
1099
|
+
scope = 'col',
|
|
1100
|
+
textCenter = false,
|
|
1101
|
+
sort = null,
|
|
1102
|
+
modifier,
|
|
1103
|
+
select = null,
|
|
1104
|
+
expand: collapse = null,
|
|
1105
|
+
tooltip = '',
|
|
1106
|
+
onMouseEnter: onMouseEnterProp = () => {},
|
|
1107
|
+
width,
|
|
1108
|
+
visibility,
|
|
1109
|
+
innerRef,
|
|
1110
|
+
info: infoProps,
|
|
1111
|
+
isStickyColumn = false,
|
|
1112
|
+
hasRightBorder = false,
|
|
1113
|
+
stickyMinWidth = '120px',
|
|
1114
|
+
stickyLeftOffset,
|
|
1115
|
+
isSubheader = false
|
|
1116
|
+
} = _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
|
+
}
|
|
843
1148
|
}
|
|
1149
|
+
});
|
|
844
1150
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
})
|
|
856
|
-
: null;
|
|
857
|
-
const collapseParams = collapse
|
|
858
|
-
? collapsible(children, {
|
|
859
|
-
column: {
|
|
860
|
-
extraParams: {
|
|
861
|
-
onCollapse: collapse === null || collapse === void 0 ? void 0 : collapse.onToggle,
|
|
862
|
-
allRowsExpanded: !collapse.areAllExpanded,
|
|
863
|
-
collapseAllAriaLabel: ''
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
})
|
|
867
|
-
: null;
|
|
868
|
-
const widthParams = width ? cellWidth(width)() : null;
|
|
869
|
-
const visibilityParams = visibility
|
|
870
|
-
? classNames(...visibility.map((vis) => Visibility[vis]))()
|
|
871
|
-
: null;
|
|
872
|
-
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;
|
|
873
|
-
// info can wrap other transformedChildren
|
|
874
|
-
let infoParams = null;
|
|
875
|
-
if (infoProps) {
|
|
876
|
-
infoParams = info(infoProps)(transformedChildren);
|
|
877
|
-
transformedChildren = infoParams.children;
|
|
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
|
+
}
|
|
878
1161
|
}
|
|
879
|
-
|
|
880
|
-
|
|
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 {
|
|
881
1186
|
// ignore the merged children since we transform them ourselves so we can wrap it with info
|
|
882
1187
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
883
|
-
children: mergedChildren = null,
|
|
1188
|
+
children: mergedChildren = null,
|
|
884
1189
|
// selectable adds this but we don't want it
|
|
885
1190
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
886
|
-
isVisible = null,
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
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;
|
|
892
1214
|
};
|
|
893
|
-
|
|
1215
|
+
|
|
1216
|
+
const Th = React.forwardRef((props, ref) => React.createElement(ThBase, Object.assign({}, props, {
|
|
1217
|
+
innerRef: ref
|
|
1218
|
+
})));
|
|
894
1219
|
Th.displayName = 'Th';
|
|
895
1220
|
|
|
896
1221
|
class ActionsColumn extends React.Component {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
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
|
+
|
|
941
1323
|
}
|
|
942
1324
|
ActionsColumn.displayName = 'ActionsColumn';
|
|
943
1325
|
ActionsColumn.defaultProps = {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1326
|
+
children: null,
|
|
1327
|
+
items: [],
|
|
1328
|
+
dropdownPosition: DropdownPosition.right,
|
|
1329
|
+
dropdownDirection: DropdownDirection.down,
|
|
1330
|
+
rowData: {},
|
|
1331
|
+
extraData: {}
|
|
950
1332
|
};
|
|
951
1333
|
|
|
952
|
-
const resolveOrDefault = (resolver, defaultValue, rowData, extraData) =>
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
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);
|
|
968
1376
|
};
|
|
969
1377
|
|
|
970
|
-
const compoundExpand = (value, {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
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
|
|
988
1396
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1397
|
+
} = column;
|
|
1398
|
+
const extraData = {
|
|
1399
|
+
rowIndex,
|
|
1400
|
+
columnIndex,
|
|
1401
|
+
column,
|
|
1402
|
+
property
|
|
1403
|
+
};
|
|
1404
|
+
/**
|
|
1405
|
+
* @param {React.MouseEvent} event - Mouse event
|
|
1406
|
+
*/
|
|
1407
|
+
|
|
1408
|
+
function onToggle(event) {
|
|
1409
|
+
// tslint:disable-next-line:no-unused-expression
|
|
1410
|
+
onExpand && onExpand(event, rowIndex, columnIndex, props.isOpen, rowData, extraData);
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
return {
|
|
1414
|
+
className: css(styles$1.tableCompoundExpansionToggle, props.isOpen && styles$1.modifiers.expanded),
|
|
1415
|
+
children: props.isOpen !== undefined && React.createElement("button", {
|
|
1416
|
+
type: "button",
|
|
1417
|
+
className: css(styles$1.tableButton),
|
|
1418
|
+
onClick: onToggle,
|
|
1419
|
+
"aria-expanded": props.isOpen,
|
|
1420
|
+
"aria-controls": props.ariaControls
|
|
1421
|
+
}, React.createElement(TableText, null, title))
|
|
1422
|
+
};
|
|
994
1423
|
};
|
|
995
1424
|
|
|
996
|
-
const FavoritesCell =
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
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
|
+
}));
|
|
1006
1447
|
};
|
|
1007
1448
|
FavoritesCell.displayName = 'FavoritesCell';
|
|
1008
1449
|
|
|
1009
|
-
const favoritable = (value, {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
return {
|
|
1020
|
-
component: 'td',
|
|
1021
|
-
isVisible: true
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* @param {React.MouseEvent} event - Mouse event
|
|
1026
|
-
*/
|
|
1027
|
-
function favoritesClick(event) {
|
|
1028
|
-
// tslint:disable-next-line:no-unused-expression
|
|
1029
|
-
onFavorite && onFavorite(event, rowData && !rowData.favorited, rowIndex, rowData, extraData);
|
|
1450
|
+
const favoritable = (value, {
|
|
1451
|
+
rowIndex,
|
|
1452
|
+
columnIndex,
|
|
1453
|
+
rowData,
|
|
1454
|
+
column,
|
|
1455
|
+
property
|
|
1456
|
+
}) => {
|
|
1457
|
+
const {
|
|
1458
|
+
extraParams: {
|
|
1459
|
+
onFavorite
|
|
1030
1460
|
}
|
|
1031
|
-
|
|
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
|
+
|
|
1469
|
+
if (rowData && rowData.hasOwnProperty('parent') && !rowData.fullWidth) {
|
|
1032
1470
|
return {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
children: (React.createElement(FavoritesCell, Object.assign({ rowIndex: rowIndex, onFavorite: favoritesClick, isFavorited: rowData && rowData.favorited }, additionalProps)))
|
|
1471
|
+
component: 'td',
|
|
1472
|
+
isVisible: true
|
|
1036
1473
|
};
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* @param {React.MouseEvent} event - Mouse event
|
|
1477
|
+
*/
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
function favoritesClick(event) {
|
|
1481
|
+
// tslint:disable-next-line:no-unused-expression
|
|
1482
|
+
onFavorite && onFavorite(event, rowData && !rowData.favorited, rowIndex, rowData, extraData);
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
const additionalProps = rowData.favoritesProps || {};
|
|
1486
|
+
return {
|
|
1487
|
+
className: css(styles$1.tableFavorite, rowData && rowData.favorited && styles$1.modifiers.favorited),
|
|
1488
|
+
isVisible: !rowData || !rowData.fullWidth,
|
|
1489
|
+
children: React.createElement(FavoritesCell, Object.assign({
|
|
1490
|
+
rowIndex: rowIndex,
|
|
1491
|
+
onFavorite: favoritesClick,
|
|
1492
|
+
isFavorited: rowData && rowData.favorited
|
|
1493
|
+
}, additionalProps))
|
|
1494
|
+
};
|
|
1037
1495
|
};
|
|
1038
1496
|
|
|
1039
1497
|
const GripVerticalIconConfig = {
|
|
@@ -1042,26 +1500,45 @@ const GripVerticalIconConfig = {
|
|
|
1042
1500
|
width: 320,
|
|
1043
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',
|
|
1044
1502
|
yOffset: 0,
|
|
1045
|
-
xOffset: 0
|
|
1503
|
+
xOffset: 0
|
|
1046
1504
|
};
|
|
1047
|
-
|
|
1048
1505
|
const GripVerticalIcon = createIcon(GripVerticalIconConfig);
|
|
1049
|
-
|
|
1050
1506
|
var GripVerticalIcon$1 = GripVerticalIcon;
|
|
1051
1507
|
|
|
1052
|
-
const DraggableCell =
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1508
|
+
const DraggableCell = _a => {
|
|
1509
|
+
var {
|
|
1510
|
+
className,
|
|
1511
|
+
onClick,
|
|
1512
|
+
'aria-label': ariaLabel,
|
|
1513
|
+
id
|
|
1514
|
+
} = _a,
|
|
1515
|
+
props = __rest(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
1516
|
+
|
|
1517
|
+
return React.createElement(Button$1, Object.assign({
|
|
1518
|
+
id: id,
|
|
1519
|
+
variant: "plain",
|
|
1520
|
+
className: className,
|
|
1521
|
+
type: "button",
|
|
1522
|
+
"aria-label": ariaLabel || `Draggable row draggable button`,
|
|
1523
|
+
onClick: onClick
|
|
1524
|
+
}, props), React.createElement(GripVerticalIcon$1, {
|
|
1525
|
+
"aria-hidden": true
|
|
1526
|
+
}));
|
|
1056
1527
|
};
|
|
1057
1528
|
DraggableCell.displayName = 'DraggableCell';
|
|
1058
1529
|
|
|
1059
|
-
const draggable = (value, {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1530
|
+
const draggable = (value, {
|
|
1531
|
+
rowData
|
|
1532
|
+
}) => {
|
|
1533
|
+
const {
|
|
1534
|
+
id
|
|
1535
|
+
} = rowData;
|
|
1536
|
+
return {
|
|
1537
|
+
className: '',
|
|
1538
|
+
children: React.createElement(DraggableCell, {
|
|
1539
|
+
id: id
|
|
1540
|
+
})
|
|
1541
|
+
};
|
|
1065
1542
|
};
|
|
1066
1543
|
|
|
1067
1544
|
const EllipsisHIconConfig = {
|
|
@@ -1070,148 +1547,213 @@ const EllipsisHIconConfig = {
|
|
|
1070
1547
|
width: 512,
|
|
1071
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',
|
|
1072
1549
|
yOffset: 0,
|
|
1073
|
-
xOffset: 0
|
|
1550
|
+
xOffset: 0
|
|
1074
1551
|
};
|
|
1075
|
-
|
|
1076
1552
|
const EllipsisHIcon = createIcon(EllipsisHIconConfig);
|
|
1077
|
-
|
|
1078
1553
|
var EllipsisHIcon$1 = EllipsisHIcon;
|
|
1079
1554
|
|
|
1080
|
-
const treeRow = (onCollapse, onCheckChange, onToggleRowDetails) => (value, {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
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
|
+
};
|
|
1106
1629
|
};
|
|
1107
1630
|
|
|
1108
|
-
const TdBase =
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
?
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1631
|
+
const TdBase = _a => {
|
|
1632
|
+
var {
|
|
1633
|
+
children,
|
|
1634
|
+
className,
|
|
1635
|
+
isActionCell = false,
|
|
1636
|
+
component = 'td',
|
|
1637
|
+
dataLabel,
|
|
1638
|
+
textCenter = false,
|
|
1639
|
+
modifier,
|
|
1640
|
+
select = null,
|
|
1641
|
+
actions = null,
|
|
1642
|
+
expand = null,
|
|
1643
|
+
treeRow: treeRowProp = null,
|
|
1644
|
+
compoundExpand: compoundExpandProp = null,
|
|
1645
|
+
noPadding,
|
|
1646
|
+
width,
|
|
1647
|
+
visibility,
|
|
1648
|
+
innerRef,
|
|
1649
|
+
favorites = null,
|
|
1650
|
+
draggableRow: draggableRowProp = null
|
|
1651
|
+
} = _a,
|
|
1652
|
+
props = __rest(_a, ["children", "className", "isActionCell", "component", "dataLabel", "textCenter", "modifier", "select", "actions", "expand", "treeRow", "compoundExpand", "noPadding", "width", "visibility", "innerRef", "favorites", "draggableRow"]);
|
|
1653
|
+
|
|
1654
|
+
const selectParams = select ? selectable(children, {
|
|
1655
|
+
rowIndex: select.rowIndex,
|
|
1656
|
+
rowData: {
|
|
1657
|
+
selected: select.isSelected,
|
|
1658
|
+
disableSelection: select === null || select === void 0 ? void 0 : select.disable,
|
|
1659
|
+
props: select === null || select === void 0 ? void 0 : select.props
|
|
1660
|
+
},
|
|
1661
|
+
column: {
|
|
1662
|
+
extraParams: {
|
|
1663
|
+
onSelect: select === null || select === void 0 ? void 0 : select.onSelect,
|
|
1664
|
+
selectVariant: select.variant || 'checkbox'
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
}) : null;
|
|
1668
|
+
const favoriteParams = favorites ? favoritable(null, {
|
|
1669
|
+
rowIndex: favorites === null || favorites === void 0 ? void 0 : favorites.rowIndex,
|
|
1670
|
+
rowData: {
|
|
1671
|
+
favorited: favorites.isFavorited,
|
|
1672
|
+
favoritesProps: favorites === null || favorites === void 0 ? void 0 : favorites.props
|
|
1673
|
+
},
|
|
1674
|
+
column: {
|
|
1675
|
+
extraParams: {
|
|
1676
|
+
onFavorite: favorites === null || favorites === void 0 ? void 0 : favorites.onFavorite
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
}) : null;
|
|
1680
|
+
const draggableParams = draggableRowProp !== null ? draggable(null, {
|
|
1681
|
+
rowData: {
|
|
1682
|
+
id: draggableRowProp.id
|
|
1683
|
+
}
|
|
1684
|
+
}) : null;
|
|
1685
|
+
const actionParamsFunc = actions ? cellActions(actions.items, null, null) : null;
|
|
1686
|
+
const actionParams = actionParamsFunc ? actionParamsFunc(null, {
|
|
1687
|
+
rowIndex: actions === null || actions === void 0 ? void 0 : actions.rowIndex,
|
|
1688
|
+
rowData: {
|
|
1689
|
+
disableActions: actions === null || actions === void 0 ? void 0 : actions.disable
|
|
1690
|
+
},
|
|
1691
|
+
column: {
|
|
1692
|
+
extraParams: {
|
|
1693
|
+
dropdownPosition: actions === null || actions === void 0 ? void 0 : actions.dropdownPosition,
|
|
1694
|
+
dropdownDirection: actions === null || actions === void 0 ? void 0 : actions.dropdownDirection,
|
|
1695
|
+
actionsToggle: actions === null || actions === void 0 ? void 0 : actions.actionsToggle
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}) : null;
|
|
1699
|
+
const expandableParams = expand !== null ? collapsible(null, {
|
|
1700
|
+
rowIndex: expand.rowIndex,
|
|
1701
|
+
columnIndex: expand === null || expand === void 0 ? void 0 : expand.columnIndex,
|
|
1702
|
+
rowData: {
|
|
1703
|
+
isOpen: expand.isExpanded
|
|
1704
|
+
},
|
|
1705
|
+
column: {
|
|
1706
|
+
extraParams: {
|
|
1707
|
+
onCollapse: expand === null || expand === void 0 ? void 0 : expand.onToggle
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}) : null;
|
|
1711
|
+
const compoundParams = compoundExpandProp !== null ? compoundExpand({
|
|
1712
|
+
title: children,
|
|
1713
|
+
props: {
|
|
1714
|
+
isOpen: compoundExpandProp.isExpanded
|
|
1715
|
+
}
|
|
1716
|
+
}, {
|
|
1717
|
+
column: {
|
|
1718
|
+
extraParams: {
|
|
1719
|
+
onExpand: compoundExpandProp === null || compoundExpandProp === void 0 ? void 0 : compoundExpandProp.onToggle
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}) : null;
|
|
1723
|
+
const widthParams = width ? cellWidth(width)() : null;
|
|
1724
|
+
const visibilityParams = visibility ? classNames(...visibility.map(vis => Visibility[vis]))() : null;
|
|
1725
|
+
const treeRowParams = treeRowProp !== null ? treeRow(treeRowProp.onCollapse, treeRowProp.onCheckChange, treeRowProp.onToggleRowDetails)({
|
|
1726
|
+
title: children
|
|
1727
|
+
}, {
|
|
1728
|
+
rowIndex: treeRowProp.rowIndex,
|
|
1729
|
+
rowData: {
|
|
1730
|
+
props: treeRowProp.props
|
|
1731
|
+
}
|
|
1732
|
+
}) : null;
|
|
1733
|
+
const merged = mergeProps(selectParams, actionParams, expandableParams, compoundParams, widthParams, visibilityParams, favoriteParams, treeRowParams, draggableParams);
|
|
1734
|
+
|
|
1735
|
+
const {
|
|
1207
1736
|
// selectable adds this but we don't want it
|
|
1208
1737
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1209
|
-
isVisible = null,
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1738
|
+
isVisible = null,
|
|
1739
|
+
children: mergedChildren = null,
|
|
1740
|
+
className: mergedClassName = '',
|
|
1741
|
+
component: MergedComponent = component
|
|
1742
|
+
} = merged,
|
|
1743
|
+
mergedProps = __rest(merged, ["isVisible", "children", "className", "component"]);
|
|
1744
|
+
|
|
1745
|
+
const treeTableTitleCell = className && className.includes('pf-c-table__tree-view-title-cell') || mergedClassName && mergedClassName.includes('pf-c-table__tree-view-title-cell');
|
|
1746
|
+
return React.createElement(MergedComponent, Object.assign({}, !treeTableTitleCell && {
|
|
1747
|
+
'data-label': dataLabel
|
|
1748
|
+
}, {
|
|
1749
|
+
className: css(className, isActionCell && styles$1.tableAction, textCenter && styles$1.modifiers.center, noPadding && styles$1.modifiers.noPadding, styles$1.modifiers[modifier], draggableParams && styles$1.tableDraggable, mergedClassName),
|
|
1750
|
+
ref: innerRef
|
|
1751
|
+
}, mergedProps, props), mergedChildren || children);
|
|
1213
1752
|
};
|
|
1214
|
-
|
|
1753
|
+
|
|
1754
|
+
const Td = React.forwardRef((props, ref) => React.createElement(TdBase, Object.assign({}, props, {
|
|
1755
|
+
innerRef: ref
|
|
1756
|
+
})));
|
|
1215
1757
|
Td.displayName = 'Td';
|
|
1216
1758
|
|
|
1217
1759
|
const SearchIconConfig = {
|
|
@@ -1220,9 +1762,8 @@ const SearchIconConfig = {
|
|
|
1220
1762
|
width: 512,
|
|
1221
1763
|
svgPath: 'M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z',
|
|
1222
1764
|
yOffset: 0,
|
|
1223
|
-
xOffset: 0
|
|
1765
|
+
xOffset: 0
|
|
1224
1766
|
};
|
|
1225
|
-
|
|
1226
1767
|
const SearchIcon = createIcon(SearchIconConfig);
|
|
1227
1768
|
|
|
1228
1769
|
const SecurityIconConfig = {
|
|
@@ -1231,9 +1772,8 @@ const SecurityIconConfig = {
|
|
|
1231
1772
|
width: 896,
|
|
1232
1773
|
svgPath: 'M861.5,0 L34.5,0 C15.4,0 0,14.3 0,32 L0,452.1 C0,768 387.7,1024 448.5,1024 C509.3,1024 896,768 896,452.2 L896,32 C896,14.3 880.6,0 861.5,0 Z M490.7,768 L405.3,768 C393.5,767.8 384.2,757.5 384,744.7 L384,663.3 C384.2,650.5 393.6,640.3 405.3,640 L490.7,640 C502.5,640.2 511.8,650.5 512,663.3 L512,744.7 L512.1,744.7 C511.8,757.5 502.4,767.8 490.7,768 Z M543.9,162.7 L517.2,514.4 C515.8,530.9 502,544 485.3,544 L410.6,544 C394,544 380.1,531.2 378.7,514.7 L352.1,163 C350.5,144.3 365.3,128.3 384,128.3 L512,128 C530.7,128 545.4,144 543.9,162.7 Z',
|
|
1233
1774
|
yOffset: 0,
|
|
1234
|
-
xOffset: 0
|
|
1775
|
+
xOffset: 0
|
|
1235
1776
|
};
|
|
1236
|
-
|
|
1237
1777
|
const SecurityIcon = createIcon(SecurityIconConfig);
|
|
1238
1778
|
|
|
1239
1779
|
const DEFAULT_PAGE = 1;
|
|
@@ -1736,17 +2276,33 @@ const PackagesTable = ({
|
|
|
1736
2276
|
const uniqueVulnerabilities = [..._vulnerabilities]; // augment vulnerabilities with link data
|
|
1737
2277
|
|
|
1738
2278
|
uniqueVulnerabilities.forEach(vulnerability => {
|
|
1739
|
-
|
|
2279
|
+
vulnerability.rpm_nvra_with_link_data = []; // // CONNCERT-2121
|
|
1740
2280
|
|
|
1741
|
-
vulnerability.
|
|
1742
|
-
|
|
1743
|
-
var _p$rpm_nvra;
|
|
2281
|
+
if (vulnerability != null && vulnerability.affected_packages) {
|
|
2282
|
+
var _vulnerability$affect;
|
|
1744
2283
|
|
|
1745
|
-
|
|
1746
|
-
|
|
2284
|
+
vulnerability == null ? void 0 : (_vulnerability$affect = vulnerability.affected_packages) == null ? void 0 : _vulnerability$affect.forEach(({
|
|
2285
|
+
name,
|
|
2286
|
+
version,
|
|
2287
|
+
arch
|
|
2288
|
+
}) => {
|
|
2289
|
+
const link_data = _rpms == null ? void 0 : _rpms.filter(rpm => rpm.name === name && rpm.version === version && rpm.architecture === arch);
|
|
1747
2290
|
vulnerability.rpm_nvra_with_link_data.push(link_data[0]);
|
|
1748
2291
|
});
|
|
1749
|
-
}
|
|
2292
|
+
} else {
|
|
2293
|
+
var _vulnerability$packag;
|
|
2294
|
+
|
|
2295
|
+
vulnerability == null ? void 0 : (_vulnerability$packag = vulnerability.packages) == null ? void 0 : _vulnerability$packag.forEach(p => {
|
|
2296
|
+
var _p$rpm_nvra;
|
|
2297
|
+
|
|
2298
|
+
return p == null ? void 0 : (_p$rpm_nvra = p.rpm_nvra) == null ? void 0 : _p$rpm_nvra.forEach(rpm_nvra => {
|
|
2299
|
+
const link_data = _rpms == null ? void 0 : _rpms.filter(pk => pk.nvra === rpm_nvra);
|
|
2300
|
+
vulnerability.rpm_nvra_with_link_data.push(link_data[0]);
|
|
2301
|
+
});
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
return vulnerability;
|
|
1750
2306
|
}); // sort vulnerabilities by severity
|
|
1751
2307
|
|
|
1752
2308
|
uniqueVulnerabilities.sort(vulnerability => severitySortOrder[vulnerability.severity]); // filter out vulnerabilities with duplicate CVE IDs
|