@rhc-shared-components/packages-table 1.0.4 → 2.0.1
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/components/ExcludedPackagesTable.d.ts +6 -6
- package/dist/components/FilterInput.d.ts +6 -6
- package/dist/components/FilterableTable.d.ts +19 -19
- package/dist/components/Select.d.ts +9 -9
- package/dist/components/ToggleGroup.d.ts +10 -10
- package/dist/components/VulnerabilitiesTable.d.ts +7 -7
- package/dist/index.d.ts +14 -14
- package/dist/index.js +2995 -1018
- package/dist/index.modern.js +2781 -753
- package/dist/index.test.d.ts +1 -1
- package/package.json +9 -12
- package/CHANGELOG.md +0 -79
package/dist/index.modern.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useState, useEffect, useCallback, cloneElement, useMemo } from 'react';
|
|
4
|
+
import { Toolbar, ToolbarContent, ToolbarItem, Bullseye, Title, Spinner, EmptyState, EmptyStateHeader, EmptyStateIcon, Pagination, SearchInput, ToggleGroup as ToggleGroup$1, ToggleGroupItem, Tabs, Tab } from '@patternfly/react-core';
|
|
5
|
+
import { setTabIndex, handleArrows } from '@patternfly/react-core/dist/esm/helpers/KeyboardHandler';
|
|
6
|
+
import { useOUIAProps } from '@patternfly/react-core/dist/esm/helpers/OUIA/ouia';
|
|
5
7
|
import { useOUIAProps as useOUIAProps$1 } from '@patternfly/react-core/dist/esm/helpers';
|
|
6
|
-
import mergeWith from 'lodash/mergeWith';
|
|
7
8
|
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
8
9
|
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
9
10
|
import { Popover } from '@patternfly/react-core/dist/esm/components/Popover';
|
|
@@ -17,6 +18,16 @@ import { format } from 'date-fns';
|
|
|
17
18
|
|
|
18
19
|
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-v5-global--spacer--lg);\n}\n.filterable-table__bottom-pagination[class] {\n margin-top: 1rem;\n}\n.filterable-table .pf-v5-c-toolbar__content {\n --pf-v5-c-toolbar__content--PaddingRight: 0;\n --pf-v5-c-toolbar__content--PaddingLeft: 0;\n}\n.filterable-table .pf-v5-c-input-group__text {\n --pf-v5-c-input-group__text--PaddingRight: 0;\n}\n.filterable-table .pf-v5-c-pagination.pf-m-bottom {\n --pf-v5-c-pagination--m-bottom--md--PaddingRight: 0;\n}\n\n.packages-table .pf-v5-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}";
|
|
19
20
|
|
|
21
|
+
function _extends() {
|
|
22
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
23
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
24
|
+
var t = arguments[e];
|
|
25
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
26
|
+
}
|
|
27
|
+
return n;
|
|
28
|
+
}, _extends.apply(null, arguments);
|
|
29
|
+
}
|
|
30
|
+
|
|
20
31
|
/******************************************************************************
|
|
21
32
|
Copyright (c) Microsoft Corporation.
|
|
22
33
|
|
|
@@ -31,52 +42,23 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
31
42
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
32
43
|
PERFORMANCE OF THIS SOFTWARE.
|
|
33
44
|
***************************************************************************** */
|
|
34
|
-
function __rest
|
|
45
|
+
function __rest(s, e) {
|
|
35
46
|
var t = {};
|
|
36
|
-
|
|
37
47
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
38
|
-
|
|
39
48
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
49
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
41
50
|
}
|
|
42
51
|
return t;
|
|
43
52
|
}
|
|
44
|
-
|
|
45
53
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
54
|
var e = new Error(message);
|
|
47
55
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48
56
|
};
|
|
49
57
|
|
|
50
|
-
/*! *****************************************************************************
|
|
51
|
-
Copyright (c) Microsoft Corporation.
|
|
52
|
-
|
|
53
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
54
|
-
purpose with or without fee is hereby granted.
|
|
55
|
-
|
|
56
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
57
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
58
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
59
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
60
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
61
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
62
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
63
|
-
***************************************************************************** */
|
|
64
|
-
function __rest(s, e) {
|
|
65
|
-
var t = {};
|
|
66
|
-
|
|
67
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
68
|
-
|
|
69
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
70
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
71
|
-
}
|
|
72
|
-
return t;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
58
|
let currentId = 0;
|
|
76
59
|
/**
|
|
77
60
|
* Factory to create Icon class components for consumers
|
|
78
61
|
*/
|
|
79
|
-
|
|
80
62
|
function createIcon({
|
|
81
63
|
name,
|
|
82
64
|
xOffset = 0,
|
|
@@ -86,21 +68,18 @@ function createIcon({
|
|
|
86
68
|
svgPath
|
|
87
69
|
}) {
|
|
88
70
|
var _a;
|
|
89
|
-
|
|
90
71
|
return _a = class SVGIcon extends React.Component {
|
|
91
72
|
constructor() {
|
|
92
73
|
super(...arguments);
|
|
93
74
|
this.id = `icon-title-${currentId++}`;
|
|
94
75
|
}
|
|
95
|
-
|
|
96
76
|
render() {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
77
|
+
const _b = this.props,
|
|
78
|
+
{
|
|
79
|
+
title,
|
|
80
|
+
className
|
|
81
|
+
} = _b,
|
|
82
|
+
props = __rest(_b, ["title", "className"]);
|
|
104
83
|
const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
|
|
105
84
|
const hasTitle = Boolean(title);
|
|
106
85
|
const viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
@@ -119,7 +98,6 @@ function createIcon({
|
|
|
119
98
|
d: svgPath
|
|
120
99
|
}));
|
|
121
100
|
}
|
|
122
|
-
|
|
123
101
|
}, _a.displayName = name, _a;
|
|
124
102
|
}
|
|
125
103
|
|
|
@@ -136,46 +114,42 @@ var EllipsisVIcon$1 = EllipsisVIcon;
|
|
|
136
114
|
|
|
137
115
|
const ActionsColumnBase = _a => {
|
|
138
116
|
var {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
117
|
+
items,
|
|
118
|
+
isDisabled,
|
|
119
|
+
rowData,
|
|
120
|
+
extraData,
|
|
121
|
+
actionsToggle,
|
|
122
|
+
popperProps = {
|
|
123
|
+
position: 'end',
|
|
124
|
+
direction: 'down'
|
|
125
|
+
},
|
|
126
|
+
innerRef,
|
|
127
|
+
firstActionItemRef,
|
|
128
|
+
isOnOpenChangeDisabled = false
|
|
129
|
+
} = _a,
|
|
130
|
+
props = __rest(_a, ["items", "isDisabled", "rowData", "extraData", "actionsToggle", "popperProps", "innerRef", "firstActionItemRef", "isOnOpenChangeDisabled"]);
|
|
154
131
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
155
|
-
|
|
156
132
|
const onToggle = () => {
|
|
157
133
|
setIsOpen(!isOpen);
|
|
158
134
|
};
|
|
159
|
-
|
|
160
135
|
const onActionClick = (event, onClick) => {
|
|
161
136
|
// Only prevent default if onClick is provided. This allows href support.
|
|
162
137
|
if (onClick) {
|
|
163
|
-
event.preventDefault();
|
|
164
|
-
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
// tslint:disable-next-line:no-unused-expression
|
|
165
140
|
onClick(event, extraData && extraData.rowIndex, rowData, extraData);
|
|
166
141
|
}
|
|
167
142
|
};
|
|
168
|
-
|
|
169
|
-
|
|
143
|
+
return React.createElement(React.Fragment, null, items.filter(item => item.isOutsideDropdown)
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
170
145
|
.map((_a, key) => {
|
|
171
146
|
var {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
147
|
+
title,
|
|
148
|
+
itemKey,
|
|
149
|
+
onClick,
|
|
150
|
+
isOutsideDropdown
|
|
151
|
+
} = _a,
|
|
152
|
+
props = __rest(_a, ["title", "itemKey", "onClick", "isOutsideDropdown"]);
|
|
179
153
|
return typeof title === 'string' ? React.createElement(Button, Object.assign({
|
|
180
154
|
onClick: event => onActionClick(event, onClick)
|
|
181
155
|
}, props, {
|
|
@@ -208,22 +182,20 @@ const ActionsColumnBase = _a => {
|
|
|
208
182
|
popperProps: popperProps
|
|
209
183
|
}), React.createElement(DropdownList, null, items.filter(item => !item.isOutsideDropdown).map((_a, index) => {
|
|
210
184
|
var {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
185
|
+
title,
|
|
186
|
+
itemKey,
|
|
187
|
+
onClick,
|
|
188
|
+
tooltipProps,
|
|
189
|
+
isSeparator,
|
|
190
|
+
shouldCloseOnClick = true
|
|
191
|
+
} = _a,
|
|
192
|
+
props = __rest(_a, ["title", "itemKey", "onClick", "tooltipProps", "isSeparator", "shouldCloseOnClick"]);
|
|
220
193
|
if (isSeparator) {
|
|
221
194
|
return React.createElement(Divider, {
|
|
222
195
|
key: itemKey || index,
|
|
223
196
|
"data-key": itemKey || index
|
|
224
197
|
});
|
|
225
198
|
}
|
|
226
|
-
|
|
227
199
|
const item = React.createElement(DropdownItem, Object.assign({
|
|
228
200
|
onClick: event => {
|
|
229
201
|
onActionClick(event, onClick);
|
|
@@ -234,7 +206,6 @@ const ActionsColumnBase = _a => {
|
|
|
234
206
|
"data-key": itemKey || index,
|
|
235
207
|
ref: index === 0 ? firstActionItemRef : undefined
|
|
236
208
|
}), title);
|
|
237
|
-
|
|
238
209
|
if (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content) {
|
|
239
210
|
return React.createElement(Tooltip, Object.assign({
|
|
240
211
|
key: itemKey || index
|
|
@@ -244,7 +215,6 @@ const ActionsColumnBase = _a => {
|
|
|
244
215
|
}
|
|
245
216
|
}))));
|
|
246
217
|
};
|
|
247
|
-
|
|
248
218
|
const ActionsColumn = React.forwardRef((props, ref) => React.createElement(ActionsColumnBase, Object.assign({}, props, {
|
|
249
219
|
innerRef: ref
|
|
250
220
|
})));
|
|
@@ -271,12 +241,10 @@ function css(...args) {
|
|
|
271
241
|
const hasOwn = {}.hasOwnProperty;
|
|
272
242
|
args.filter(Boolean).forEach(arg => {
|
|
273
243
|
const argType = typeof arg;
|
|
274
|
-
|
|
275
244
|
if (argType === 'string' || argType === 'number') {
|
|
276
245
|
classes.push(arg);
|
|
277
246
|
} else if (Array.isArray(arg) && arg.length) {
|
|
278
247
|
const inner = css(...arg);
|
|
279
|
-
|
|
280
248
|
if (inner) {
|
|
281
249
|
classes.push(inner);
|
|
282
250
|
}
|
|
@@ -384,13 +352,12 @@ var styles$1 = {
|
|
|
384
352
|
|
|
385
353
|
const CollapseColumn = _a => {
|
|
386
354
|
var {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
355
|
+
className = '',
|
|
356
|
+
children = null,
|
|
357
|
+
isOpen,
|
|
358
|
+
onToggle
|
|
359
|
+
} = _a,
|
|
360
|
+
props = __rest(_a, ["className", "children", "isOpen", "onToggle"]);
|
|
394
361
|
return React.createElement(React.Fragment, null, isOpen !== undefined && React.createElement(Button, Object.assign({
|
|
395
362
|
className: css(className, isOpen && styles$1.modifiers.expanded)
|
|
396
363
|
}, props, {
|
|
@@ -417,13 +384,12 @@ var GripVerticalIcon$1 = GripVerticalIcon;
|
|
|
417
384
|
|
|
418
385
|
const DraggableCell = _a => {
|
|
419
386
|
var {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
387
|
+
className,
|
|
388
|
+
onClick,
|
|
389
|
+
'aria-label': ariaLabel,
|
|
390
|
+
id
|
|
391
|
+
} = _a,
|
|
392
|
+
props = __rest(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
427
393
|
return React.createElement(Button, Object.assign({
|
|
428
394
|
id: id,
|
|
429
395
|
variant: "plain",
|
|
@@ -472,14 +438,11 @@ const HelpIcon = createIcon(HelpIconConfig);
|
|
|
472
438
|
var HelpIcon$1 = HelpIcon;
|
|
473
439
|
|
|
474
440
|
var TableTextVariant;
|
|
475
|
-
|
|
476
441
|
(function (TableTextVariant) {
|
|
477
442
|
TableTextVariant["div"] = "div";
|
|
478
443
|
TableTextVariant["nav"] = "nav";
|
|
479
444
|
})(TableTextVariant || (TableTextVariant = {}));
|
|
480
|
-
|
|
481
445
|
var WrapModifier;
|
|
482
|
-
|
|
483
446
|
(function (WrapModifier) {
|
|
484
447
|
WrapModifier["wrap"] = "wrap";
|
|
485
448
|
WrapModifier["nowrap"] = "nowrap";
|
|
@@ -487,35 +450,30 @@ var WrapModifier;
|
|
|
487
450
|
WrapModifier["breakWord"] = "breakWord";
|
|
488
451
|
WrapModifier["fitContent"] = "fitContent";
|
|
489
452
|
})(WrapModifier || (WrapModifier = {}));
|
|
490
|
-
|
|
491
453
|
const TableText = _a => {
|
|
492
454
|
var {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
455
|
+
children = null,
|
|
456
|
+
className = '',
|
|
457
|
+
variant = 'span',
|
|
458
|
+
wrapModifier = null,
|
|
459
|
+
tooltip: tooltipProp = '',
|
|
460
|
+
tooltipProps = {},
|
|
461
|
+
onMouseEnter: onMouseEnterProp = () => {},
|
|
462
|
+
focused = false,
|
|
463
|
+
tooltipHasDefaultBehavior = false
|
|
464
|
+
} = _a,
|
|
465
|
+
props = __rest(_a, ["children", "className", "variant", "wrapModifier", "tooltip", "tooltipProps", "onMouseEnter", "focused", "tooltipHasDefaultBehavior"]);
|
|
505
466
|
const Component = variant;
|
|
506
467
|
const textRef = React.createRef();
|
|
507
468
|
const [tooltip, setTooltip] = React.useState(tooltipProp);
|
|
508
|
-
|
|
509
469
|
const onMouseEnter = event => {
|
|
510
470
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
511
471
|
setTooltip(tooltipProp || event.target.innerText);
|
|
512
472
|
} else {
|
|
513
473
|
setTooltip('');
|
|
514
474
|
}
|
|
515
|
-
|
|
516
475
|
onMouseEnterProp(event);
|
|
517
476
|
};
|
|
518
|
-
|
|
519
477
|
const onFocus = element => {
|
|
520
478
|
if (element.offsetWidth < element.scrollWidth) {
|
|
521
479
|
setTooltip(tooltipProp || element.innerText);
|
|
@@ -523,7 +481,6 @@ const TableText = _a => {
|
|
|
523
481
|
setTooltip('');
|
|
524
482
|
}
|
|
525
483
|
};
|
|
526
|
-
|
|
527
484
|
const text = React.createElement(Component, Object.assign({
|
|
528
485
|
ref: textRef,
|
|
529
486
|
onMouseEnter: !tooltipHasDefaultBehavior ? onMouseEnter : undefined,
|
|
@@ -641,24 +598,21 @@ var treeViewStyles = {
|
|
|
641
598
|
};
|
|
642
599
|
|
|
643
600
|
var RowSelectVariant;
|
|
644
|
-
|
|
645
601
|
(function (RowSelectVariant) {
|
|
646
602
|
RowSelectVariant["radio"] = "radio";
|
|
647
603
|
RowSelectVariant["checkbox"] = "checkbox";
|
|
648
604
|
})(RowSelectVariant || (RowSelectVariant = {}));
|
|
649
|
-
|
|
650
605
|
const SelectColumn = _a => {
|
|
651
606
|
var {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
607
|
+
children = null,
|
|
608
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
609
|
+
className,
|
|
610
|
+
onSelect = null,
|
|
611
|
+
selectVariant,
|
|
612
|
+
tooltip,
|
|
613
|
+
tooltipProps
|
|
614
|
+
} = _a,
|
|
615
|
+
props = __rest(_a, ["children", "className", "onSelect", "selectVariant", "tooltip", "tooltipProps"]);
|
|
662
616
|
const inputRef = React.createRef();
|
|
663
617
|
const content = React.createElement(React.Fragment, null, React.createElement("label", null, React.createElement("input", Object.assign({}, props, {
|
|
664
618
|
ref: inputRef,
|
|
@@ -707,25 +661,21 @@ const selectable = (label, {
|
|
|
707
661
|
column,
|
|
708
662
|
property
|
|
709
663
|
};
|
|
710
|
-
|
|
711
664
|
if (rowData && rowData.hasOwnProperty('parent') && !rowData.showSelect && !rowData.fullWidth) {
|
|
712
665
|
return {
|
|
713
666
|
component: 'td',
|
|
714
667
|
isVisible: true
|
|
715
668
|
};
|
|
716
669
|
}
|
|
717
|
-
|
|
718
670
|
const rowId = rowIndex !== undefined ? rowIndex : -1;
|
|
719
671
|
/**
|
|
720
672
|
* @param {React.FormEvent} event - React form event
|
|
721
673
|
*/
|
|
722
|
-
|
|
723
674
|
function selectClick(event) {
|
|
724
|
-
const selected = rowIndex === undefined ? event.currentTarget.checked : rowData && !rowData.selected;
|
|
725
|
-
|
|
675
|
+
const selected = rowIndex === undefined ? event.currentTarget.checked : rowData && !rowData.selected;
|
|
676
|
+
// tslint:disable-next-line:no-unused-expression
|
|
726
677
|
onSelect && onSelect(event, selected, rowId, rowData, extraData);
|
|
727
678
|
}
|
|
728
|
-
|
|
729
679
|
const customProps = Object.assign(Object.assign(Object.assign({}, rowId !== -1 ? {
|
|
730
680
|
checked: rowData && !!rowData.selected,
|
|
731
681
|
'aria-label': `Select row ${rowIndex}`
|
|
@@ -739,13 +689,11 @@ const selectable = (label, {
|
|
|
739
689
|
disabled: true
|
|
740
690
|
});
|
|
741
691
|
let selectName = 'check-all';
|
|
742
|
-
|
|
743
692
|
if (rowId !== -1 && selectVariant === RowSelectVariant.checkbox) {
|
|
744
693
|
selectName = `checkrow${rowIndex}`;
|
|
745
694
|
} else if (rowId !== -1) {
|
|
746
695
|
selectName = 'radioGroup';
|
|
747
696
|
}
|
|
748
|
-
|
|
749
697
|
return {
|
|
750
698
|
className: css(styles$1.tableCheck),
|
|
751
699
|
component: rowId !== -1 ? 'td' : 'th',
|
|
@@ -793,35 +741,30 @@ const ArrowsAltVIcon = createIcon(ArrowsAltVIconConfig);
|
|
|
793
741
|
var ArrowsAltVIcon$1 = ArrowsAltVIcon;
|
|
794
742
|
|
|
795
743
|
var SortByDirection;
|
|
796
|
-
|
|
797
744
|
(function (SortByDirection) {
|
|
798
745
|
SortByDirection["asc"] = "asc";
|
|
799
746
|
SortByDirection["desc"] = "desc";
|
|
800
747
|
})(SortByDirection || (SortByDirection = {}));
|
|
801
|
-
|
|
802
748
|
const SortColumn = _a => {
|
|
803
749
|
var {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
750
|
+
children = null,
|
|
751
|
+
className = '',
|
|
752
|
+
isSortedBy = false,
|
|
753
|
+
onSort = null,
|
|
754
|
+
sortDirection = '',
|
|
755
|
+
type = 'button',
|
|
756
|
+
tooltip,
|
|
757
|
+
tooltipProps,
|
|
758
|
+
tooltipHasDefaultBehavior
|
|
759
|
+
} = _a,
|
|
760
|
+
props = __rest(_a, ["children", "className", "isSortedBy", "onSort", "sortDirection", "type", "tooltip", "tooltipProps", "tooltipHasDefaultBehavior"]);
|
|
816
761
|
let SortedByIcon;
|
|
817
762
|
const [focused, setFocused] = React.useState(false);
|
|
818
|
-
|
|
819
763
|
if (isSortedBy) {
|
|
820
764
|
SortedByIcon = sortDirection === SortByDirection.asc ? LongArrowAltUpIcon$1 : LongArrowAltDownIcon$1;
|
|
821
765
|
} else {
|
|
822
766
|
SortedByIcon = ArrowsAltVIcon$1;
|
|
823
767
|
}
|
|
824
|
-
|
|
825
768
|
return React.createElement("button", Object.assign({}, props, {
|
|
826
769
|
type: type,
|
|
827
770
|
className: css(className, styles$1.tableButton),
|
|
@@ -893,23 +836,21 @@ const sortable = (label, {
|
|
|
893
836
|
/**
|
|
894
837
|
* @param {React.MouseEvent} event - React mouse event
|
|
895
838
|
*/
|
|
896
|
-
|
|
897
839
|
function sortClicked(event) {
|
|
898
840
|
let reversedDirection;
|
|
899
|
-
|
|
900
841
|
if (!isSortedBy) {
|
|
901
842
|
reversedDirection = sortBy.defaultDirection ? sortBy.defaultDirection : SortByDirection.asc;
|
|
902
843
|
} else {
|
|
903
844
|
reversedDirection = sortBy.direction === SortByDirection.asc ? SortByDirection.desc : SortByDirection.asc;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
|
|
845
|
+
}
|
|
846
|
+
// tslint:disable-next-line:no-unused-expression
|
|
907
847
|
onSort && onSort(event, columnIndex, reversedDirection, extraData);
|
|
908
848
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
'aria-sort':
|
|
849
|
+
return Object.assign(Object.assign({
|
|
850
|
+
className: css(styles$1.tableSort, isSortedBy && styles$1.modifiers.selected, className)
|
|
851
|
+
}, isSortedBy && {
|
|
852
|
+
'aria-sort': `${sortBy.direction}ending`
|
|
853
|
+
}), {
|
|
913
854
|
children: React.createElement(SortColumn, {
|
|
914
855
|
isSortedBy: isSortedBy,
|
|
915
856
|
sortDirection: isSortedBy ? sortBy.direction : '',
|
|
@@ -919,11 +860,10 @@ const sortable = (label, {
|
|
|
919
860
|
tooltipProps: tooltipProps,
|
|
920
861
|
tooltipHasDefaultBehavior: tooltipHasDefaultBehavior
|
|
921
862
|
}, label)
|
|
922
|
-
};
|
|
863
|
+
});
|
|
923
864
|
};
|
|
924
865
|
|
|
925
866
|
const resolveOrDefault = (resolver, defaultValue, rowData, extraData) => typeof resolver === 'function' ? resolver(rowData, extraData) : defaultValue;
|
|
926
|
-
|
|
927
867
|
const cellActions = (actions, actionResolver, areActionsDisabled) => (label, {
|
|
928
868
|
rowData,
|
|
929
869
|
column,
|
|
@@ -965,12 +905,10 @@ const cellActions = (actions, actionResolver, areActionsDisabled) => (label, {
|
|
|
965
905
|
};
|
|
966
906
|
|
|
967
907
|
const camelize = s => s.toUpperCase().replace('-', '').replace('_', '');
|
|
968
|
-
|
|
969
908
|
const toCamel = s => s.replace(/([-_][a-z])/gi, camelize);
|
|
970
909
|
/**
|
|
971
910
|
* @param {string} input - String to capitalize
|
|
972
911
|
*/
|
|
973
|
-
|
|
974
912
|
function capitalize(input) {
|
|
975
913
|
return input[0].toUpperCase() + input.substring(1);
|
|
976
914
|
}
|
|
@@ -1012,13 +950,11 @@ const collapsible = (value, {
|
|
|
1012
950
|
/**
|
|
1013
951
|
* @param {React.MouseEvent} event - Mouse event
|
|
1014
952
|
*/
|
|
1015
|
-
|
|
1016
953
|
function onToggle(event) {
|
|
1017
|
-
const open = rowData ? !rowData.isOpen : !allRowsExpanded;
|
|
1018
|
-
|
|
954
|
+
const open = rowData ? !rowData.isOpen : !allRowsExpanded;
|
|
955
|
+
// tslint:disable-next-line:no-unused-expression
|
|
1019
956
|
onCollapse && onCollapse(event, rowIndex, open, rowData, extraData);
|
|
1020
957
|
}
|
|
1021
|
-
|
|
1022
958
|
return {
|
|
1023
959
|
className: ((rowData === null || rowData === void 0 ? void 0 : rowData.isOpen) !== undefined || rowId === -1) && css(styles$1.tableToggle),
|
|
1024
960
|
isVisible: !(rowData === null || rowData === void 0 ? void 0 : rowData.fullWidth),
|
|
@@ -1040,7 +976,6 @@ const compoundExpand = (value, {
|
|
|
1040
976
|
if (!value) {
|
|
1041
977
|
return null;
|
|
1042
978
|
}
|
|
1043
|
-
|
|
1044
979
|
const {
|
|
1045
980
|
title,
|
|
1046
981
|
props
|
|
@@ -1060,12 +995,10 @@ const compoundExpand = (value, {
|
|
|
1060
995
|
/**
|
|
1061
996
|
* @param {React.MouseEvent} event - Mouse event
|
|
1062
997
|
*/
|
|
1063
|
-
|
|
1064
998
|
function onToggle(event) {
|
|
1065
999
|
// tslint:disable-next-line:no-unused-expression
|
|
1066
1000
|
onExpand && onExpand(event, rowIndex, columnIndex, props.isOpen, rowData, extraData);
|
|
1067
1001
|
}
|
|
1068
|
-
|
|
1069
1002
|
return {
|
|
1070
1003
|
className: css(styles$1.tableCompoundExpansionToggle, props.isOpen && styles$1.modifiers.expanded),
|
|
1071
1004
|
children: props.isOpen !== undefined && React.createElement("button", {
|
|
@@ -1113,19 +1046,17 @@ const info = ({
|
|
|
1113
1046
|
className: className
|
|
1114
1047
|
}, value)
|
|
1115
1048
|
});
|
|
1116
|
-
|
|
1117
1049
|
return infoObj;
|
|
1118
1050
|
};
|
|
1119
1051
|
|
|
1120
1052
|
const FavoritesCell = _a => {
|
|
1121
1053
|
var {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1054
|
+
className = '',
|
|
1055
|
+
onFavorite,
|
|
1056
|
+
isFavorited,
|
|
1057
|
+
rowIndex
|
|
1058
|
+
} = _a,
|
|
1059
|
+
props = __rest(_a, ["className", "onFavorite", "isFavorited", "rowIndex"]);
|
|
1129
1060
|
const ariaProps = rowIndex === undefined ? {} : {
|
|
1130
1061
|
id: `favorites-button-${rowIndex}`,
|
|
1131
1062
|
'aria-labelledby': `favorites-button-${rowIndex}`
|
|
@@ -1159,8 +1090,8 @@ const favoritable = (value, {
|
|
|
1159
1090
|
columnIndex,
|
|
1160
1091
|
column,
|
|
1161
1092
|
property
|
|
1162
|
-
};
|
|
1163
|
-
|
|
1093
|
+
};
|
|
1094
|
+
// this is a child row which should not display the favorites icon
|
|
1164
1095
|
if (rowData && rowData.hasOwnProperty('parent') && !rowData.fullWidth) {
|
|
1165
1096
|
return {
|
|
1166
1097
|
component: 'td',
|
|
@@ -1170,13 +1101,10 @@ const favoritable = (value, {
|
|
|
1170
1101
|
/**
|
|
1171
1102
|
* @param {React.MouseEvent} event - Mouse event
|
|
1172
1103
|
*/
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
1104
|
function favoritesClick(event) {
|
|
1176
1105
|
// tslint:disable-next-line:no-unused-expression
|
|
1177
1106
|
onFavorite && onFavorite(event, rowData && !rowData.favorited, rowIndex, rowData, extraData);
|
|
1178
1107
|
}
|
|
1179
|
-
|
|
1180
1108
|
const additionalProps = rowData.favoritesProps || {};
|
|
1181
1109
|
return {
|
|
1182
1110
|
className: css(styles$1.tableFavorite, rowData && rowData.favorited && styles$1.modifiers.favorited),
|
|
@@ -1227,11 +1155,9 @@ const treeRow = (onCollapse, onCheckChange, onToggleRowDetails) => (value, {
|
|
|
1227
1155
|
className: styles$1.tableText,
|
|
1228
1156
|
key: "table-text"
|
|
1229
1157
|
}, content));
|
|
1230
|
-
|
|
1231
1158
|
const onChange = (isChecked, event) => {
|
|
1232
1159
|
onCheckChange(event, isChecked, rowIndex, content, rowData);
|
|
1233
1160
|
};
|
|
1234
|
-
|
|
1235
1161
|
return {
|
|
1236
1162
|
component: 'th',
|
|
1237
1163
|
className: treeViewStyles.tableTreeViewTitleCell,
|
|
@@ -1277,7 +1203,6 @@ const treeRow = (onCollapse, onCheckChange, onToggleRowDetails) => (value, {
|
|
|
1277
1203
|
};
|
|
1278
1204
|
|
|
1279
1205
|
var TableGridBreakpoint;
|
|
1280
|
-
|
|
1281
1206
|
(function (TableGridBreakpoint) {
|
|
1282
1207
|
TableGridBreakpoint["none"] = "";
|
|
1283
1208
|
TableGridBreakpoint["grid"] = "grid";
|
|
@@ -1286,9 +1211,7 @@ var TableGridBreakpoint;
|
|
|
1286
1211
|
TableGridBreakpoint["gridXl"] = "grid-xl";
|
|
1287
1212
|
TableGridBreakpoint["grid2xl"] = "grid-2xl";
|
|
1288
1213
|
})(TableGridBreakpoint || (TableGridBreakpoint = {}));
|
|
1289
|
-
|
|
1290
1214
|
var TableVariant;
|
|
1291
|
-
|
|
1292
1215
|
(function (TableVariant) {
|
|
1293
1216
|
TableVariant["compact"] = "compact";
|
|
1294
1217
|
})(TableVariant || (TableVariant = {}));
|
|
@@ -1296,45 +1219,41 @@ var TableVariant;
|
|
|
1296
1219
|
const TableContext = React.createContext({
|
|
1297
1220
|
registerSelectableRow: () => {}
|
|
1298
1221
|
});
|
|
1299
|
-
|
|
1300
1222
|
const TableBase = _a => {
|
|
1301
1223
|
var _b, _c;
|
|
1302
|
-
|
|
1303
1224
|
var {
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1225
|
+
children,
|
|
1226
|
+
className,
|
|
1227
|
+
variant,
|
|
1228
|
+
borders = true,
|
|
1229
|
+
isStickyHeader = false,
|
|
1230
|
+
gridBreakPoint = TableGridBreakpoint.gridMd,
|
|
1231
|
+
'aria-label': ariaLabel,
|
|
1232
|
+
role = 'grid',
|
|
1233
|
+
innerRef,
|
|
1234
|
+
ouiaId,
|
|
1235
|
+
ouiaSafe = true,
|
|
1236
|
+
isTreeTable = false,
|
|
1237
|
+
isNested = false,
|
|
1238
|
+
isStriped = false,
|
|
1239
|
+
isExpandable = false,
|
|
1240
|
+
hasNoInset = false,
|
|
1241
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1242
|
+
nestedHeaderColumnSpans,
|
|
1243
|
+
selectableRowCaptionText
|
|
1244
|
+
} = _a,
|
|
1245
|
+
props = __rest(_a, ["children", "className", "variant", "borders", "isStickyHeader", "gridBreakPoint", 'aria-label', "role", "innerRef", "ouiaId", "ouiaSafe", "isTreeTable", "isNested", "isStriped", "isExpandable", "hasNoInset", "nestedHeaderColumnSpans", "selectableRowCaptionText"]);
|
|
1326
1246
|
const ref = React.useRef(null);
|
|
1327
1247
|
const tableRef = innerRef || ref;
|
|
1328
1248
|
const [hasSelectableRows, setHasSelectableRows] = React.useState(false);
|
|
1329
1249
|
const [tableCaption, setTableCaption] = React.useState();
|
|
1330
1250
|
React.useEffect(() => {
|
|
1331
|
-
document.addEventListener('keydown', handleKeys);
|
|
1332
|
-
|
|
1251
|
+
document.addEventListener('keydown', handleKeys);
|
|
1252
|
+
// sets up roving tab-index to tree tables only
|
|
1333
1253
|
if (tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) {
|
|
1334
1254
|
const tbody = tableRef.current.querySelector('tbody');
|
|
1335
1255
|
tbody && setTabIndex(Array.from(tbody.querySelectorAll('button, a, input')));
|
|
1336
1256
|
}
|
|
1337
|
-
|
|
1338
1257
|
return function cleanup() {
|
|
1339
1258
|
document.removeEventListener('keydown', handleKeys);
|
|
1340
1259
|
};
|
|
@@ -1354,31 +1273,25 @@ const TableBase = _a => {
|
|
|
1354
1273
|
const grid = (_b = stylesGrid.modifiers) === null || _b === void 0 ? void 0 : _b[toCamel(gridBreakPoint || '').replace(/-?2xl/, '_2xl')];
|
|
1355
1274
|
const breakPointPrefix = `treeView${gridBreakPoint.charAt(0).toUpperCase() + gridBreakPoint.slice(1)}`;
|
|
1356
1275
|
const treeGrid = (_c = treeViewStyles.modifiers) === null || _c === void 0 ? void 0 : _c[toCamel(breakPointPrefix || '').replace(/-?2xl/, '_2xl')];
|
|
1357
|
-
|
|
1358
1276
|
const handleKeys = event => {
|
|
1359
|
-
if (isNested || !(tableRef && tableRef.current && tableRef.current.classList.contains(treeViewStyles.modifiers.treeView)) ||
|
|
1277
|
+
if (isNested || !(tableRef && tableRef.current && tableRef.current.classList.contains(treeViewStyles.modifiers.treeView)) ||
|
|
1278
|
+
// implements roving tab-index to tree tables only
|
|
1360
1279
|
tableRef && tableRef.current !== event.target.closest(`.${styles$1.table}:not(.pf-m-nested)`)) {
|
|
1361
1280
|
return;
|
|
1362
1281
|
}
|
|
1363
|
-
|
|
1364
1282
|
const activeElement = document.activeElement;
|
|
1365
1283
|
const key = event.key;
|
|
1366
1284
|
const rows = Array.from(tableRef.current.querySelectorAll('tbody tr')).filter(el => !el.classList.contains('pf-m-disabled') && !el.hidden);
|
|
1367
|
-
|
|
1368
1285
|
if (key === 'Space' || key === 'Enter') {
|
|
1369
1286
|
activeElement.click();
|
|
1370
1287
|
event.preventDefault();
|
|
1371
1288
|
}
|
|
1372
|
-
|
|
1373
1289
|
const getFocusableElement = element => element.querySelectorAll('button:not(:disabled), input:not(:disabled), a:not(:disabled)')[0];
|
|
1374
|
-
|
|
1375
1290
|
handleArrows(event, rows, element => element === activeElement.closest('tr'), getFocusableElement, ['button', 'input', 'a'], undefined, false, true, false);
|
|
1376
1291
|
};
|
|
1377
|
-
|
|
1378
1292
|
const registerSelectableRow = () => {
|
|
1379
1293
|
!hasSelectableRows && setHasSelectableRows(true);
|
|
1380
1294
|
};
|
|
1381
|
-
|
|
1382
1295
|
return React.createElement(TableContext.Provider, {
|
|
1383
1296
|
value: {
|
|
1384
1297
|
registerSelectableRow
|
|
@@ -1392,7 +1305,6 @@ const TableBase = _a => {
|
|
|
1392
1305
|
role: 'treegrid'
|
|
1393
1306
|
}, ouiaProps, props), hasSelectableRows && tableCaption, children));
|
|
1394
1307
|
};
|
|
1395
|
-
|
|
1396
1308
|
const Table = React.forwardRef((props, ref) => React.createElement(TableBase, Object.assign({}, props, {
|
|
1397
1309
|
innerRef: ref
|
|
1398
1310
|
})));
|
|
@@ -1400,29 +1312,28 @@ Table.displayName = 'Table';
|
|
|
1400
1312
|
|
|
1401
1313
|
const TrBase = _a => {
|
|
1402
1314
|
var {
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1315
|
+
children,
|
|
1316
|
+
className,
|
|
1317
|
+
isExpanded,
|
|
1318
|
+
isEditable,
|
|
1319
|
+
isHidden = false,
|
|
1320
|
+
isClickable = false,
|
|
1321
|
+
isRowSelected = false,
|
|
1322
|
+
isStriped = false,
|
|
1323
|
+
isBorderRow = false,
|
|
1324
|
+
isControlRow = false,
|
|
1325
|
+
innerRef,
|
|
1326
|
+
ouiaId,
|
|
1327
|
+
ouiaSafe = true,
|
|
1328
|
+
resetOffset = false,
|
|
1329
|
+
onRowClick,
|
|
1330
|
+
isSelectable,
|
|
1331
|
+
'aria-label': passedAriaLabel
|
|
1332
|
+
} = _a,
|
|
1333
|
+
props = __rest(_a, ["children", "className", "isExpanded", "isEditable", "isHidden", "isClickable", "isRowSelected", "isStriped", "isBorderRow", "isControlRow", "innerRef", "ouiaId", "ouiaSafe", "resetOffset", "onRowClick", "isSelectable", 'aria-label']);
|
|
1422
1334
|
const ouiaProps = useOUIAProps$1('TableRow', ouiaId, ouiaSafe);
|
|
1423
1335
|
const [computedAriaLabel, setComputedAriaLabel] = React.useState('');
|
|
1424
1336
|
let onKeyDown = null;
|
|
1425
|
-
|
|
1426
1337
|
if (onRowClick) {
|
|
1427
1338
|
onKeyDown = e => {
|
|
1428
1339
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -1431,7 +1342,6 @@ const TrBase = _a => {
|
|
|
1431
1342
|
}
|
|
1432
1343
|
};
|
|
1433
1344
|
}
|
|
1434
|
-
|
|
1435
1345
|
const rowIsHidden = isHidden || isExpanded !== undefined && !isExpanded;
|
|
1436
1346
|
const {
|
|
1437
1347
|
registerSelectableRow
|
|
@@ -1446,7 +1356,7 @@ const TrBase = _a => {
|
|
|
1446
1356
|
}, [isRowSelected, isSelectable, registerSelectableRow, rowIsHidden]);
|
|
1447
1357
|
const ariaLabel = passedAriaLabel || computedAriaLabel;
|
|
1448
1358
|
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),
|
|
1359
|
+
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, isControlRow && styles$1.tableControlRow, resetOffset && styles$1.modifiers.firstCellOffsetReset),
|
|
1450
1360
|
hidden: rowIsHidden
|
|
1451
1361
|
}, isClickable && {
|
|
1452
1362
|
tabIndex: 0
|
|
@@ -1458,7 +1368,6 @@ const TrBase = _a => {
|
|
|
1458
1368
|
onKeyDown
|
|
1459
1369
|
}, ouiaProps, props), children));
|
|
1460
1370
|
};
|
|
1461
|
-
|
|
1462
1371
|
const Tr = React.forwardRef((props, ref) => React.createElement(TrBase, Object.assign({}, props, {
|
|
1463
1372
|
innerRef: ref
|
|
1464
1373
|
})));
|
|
@@ -1466,20 +1375,18 @@ Tr.displayName = 'Tr';
|
|
|
1466
1375
|
|
|
1467
1376
|
const TheadBase = _a => {
|
|
1468
1377
|
var {
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1378
|
+
children,
|
|
1379
|
+
className,
|
|
1380
|
+
noWrap = false,
|
|
1381
|
+
innerRef,
|
|
1382
|
+
hasNestedHeader
|
|
1383
|
+
} = _a,
|
|
1384
|
+
props = __rest(_a, ["children", "className", "noWrap", "innerRef", "hasNestedHeader"]);
|
|
1477
1385
|
return React.createElement("thead", Object.assign({
|
|
1478
1386
|
className: css(styles$1.tableThead, className, noWrap && styles$1.modifiers.nowrap, hasNestedHeader && styles$1.modifiers.nestedColumnHeader),
|
|
1479
1387
|
ref: innerRef
|
|
1480
1388
|
}, props), children);
|
|
1481
1389
|
};
|
|
1482
|
-
|
|
1483
1390
|
const Thead = React.forwardRef((props, ref) => React.createElement(TheadBase, Object.assign({}, props, {
|
|
1484
1391
|
innerRef: ref
|
|
1485
1392
|
})));
|
|
@@ -1487,22 +1394,20 @@ Thead.displayName = 'Thead';
|
|
|
1487
1394
|
|
|
1488
1395
|
const TbodyBase = _a => {
|
|
1489
1396
|
var {
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1397
|
+
children,
|
|
1398
|
+
className,
|
|
1399
|
+
isExpanded,
|
|
1400
|
+
innerRef,
|
|
1401
|
+
isEvenStriped = false,
|
|
1402
|
+
isOddStriped = false
|
|
1403
|
+
} = _a,
|
|
1404
|
+
props = __rest(_a, ["children", "className", "isExpanded", "innerRef", "isEvenStriped", "isOddStriped"]);
|
|
1499
1405
|
return React.createElement("tbody", Object.assign({
|
|
1500
1406
|
role: "rowgroup",
|
|
1501
1407
|
className: css(styles$1.tableTbody, className, isExpanded && styles$1.modifiers.expanded, isOddStriped && styles$1.modifiers.striped, isEvenStriped && styles$1.modifiers.stripedEven),
|
|
1502
1408
|
ref: innerRef
|
|
1503
1409
|
}, props), children);
|
|
1504
1410
|
};
|
|
1505
|
-
|
|
1506
1411
|
const Tbody = React.forwardRef((props, ref) => React.createElement(TbodyBase, Object.assign({}, props, {
|
|
1507
1412
|
innerRef: ref
|
|
1508
1413
|
})));
|
|
@@ -1524,121 +1429,2238 @@ var styles = {
|
|
|
1524
1429
|
};
|
|
1525
1430
|
|
|
1526
1431
|
/**
|
|
1527
|
-
*
|
|
1432
|
+
* Removes all key-value entries from the list cache.
|
|
1528
1433
|
*
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1434
|
+
* @private
|
|
1435
|
+
* @name clear
|
|
1436
|
+
* @memberOf ListCache
|
|
1531
1437
|
*/
|
|
1438
|
+
function listCacheClear() {
|
|
1439
|
+
this.__data__ = [];
|
|
1440
|
+
this.size = 0;
|
|
1441
|
+
}
|
|
1442
|
+
var _listCacheClear = listCacheClear;
|
|
1443
|
+
|
|
1532
1444
|
/**
|
|
1533
|
-
*
|
|
1445
|
+
* Performs a
|
|
1446
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1447
|
+
* comparison between two values to determine if they are equivalent.
|
|
1448
|
+
*
|
|
1449
|
+
* @static
|
|
1450
|
+
* @memberOf _
|
|
1451
|
+
* @since 4.0.0
|
|
1452
|
+
* @category Lang
|
|
1453
|
+
* @param {*} value The value to compare.
|
|
1454
|
+
* @param {*} other The other value to compare.
|
|
1455
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
1456
|
+
* @example
|
|
1457
|
+
*
|
|
1458
|
+
* var object = { 'a': 1 };
|
|
1459
|
+
* var other = { 'a': 1 };
|
|
1460
|
+
*
|
|
1461
|
+
* _.eq(object, object);
|
|
1462
|
+
* // => true
|
|
1463
|
+
*
|
|
1464
|
+
* _.eq(object, other);
|
|
1465
|
+
* // => false
|
|
1466
|
+
*
|
|
1467
|
+
* _.eq('a', 'a');
|
|
1468
|
+
* // => true
|
|
1469
|
+
*
|
|
1470
|
+
* _.eq('a', Object('a'));
|
|
1471
|
+
* // => false
|
|
1472
|
+
*
|
|
1473
|
+
* _.eq(NaN, NaN);
|
|
1474
|
+
* // => true
|
|
1534
1475
|
*/
|
|
1476
|
+
function eq(value, other) {
|
|
1477
|
+
return value === other || value !== value && other !== other;
|
|
1478
|
+
}
|
|
1479
|
+
var eq_1 = eq;
|
|
1535
1480
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1481
|
+
/**
|
|
1482
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1483
|
+
*
|
|
1484
|
+
* @private
|
|
1485
|
+
* @param {Array} array The array to inspect.
|
|
1486
|
+
* @param {*} key The key to search for.
|
|
1487
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1488
|
+
*/
|
|
1489
|
+
function assocIndexOf(array, key) {
|
|
1490
|
+
var length = array.length;
|
|
1491
|
+
while (length--) {
|
|
1492
|
+
if (eq_1(array[length][0], key)) {
|
|
1493
|
+
return length;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
return -1;
|
|
1497
|
+
}
|
|
1498
|
+
var _assocIndexOf = assocIndexOf;
|
|
1539
1499
|
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
} // Avoid mutating the first prop collection
|
|
1500
|
+
/** Used for built-in method references. */
|
|
1501
|
+
var arrayProto = Array.prototype;
|
|
1543
1502
|
|
|
1503
|
+
/** Built-in value references. */
|
|
1504
|
+
var splice = arrayProto.splice;
|
|
1544
1505
|
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1506
|
+
/**
|
|
1507
|
+
* Removes `key` and its value from the list cache.
|
|
1508
|
+
*
|
|
1509
|
+
* @private
|
|
1510
|
+
* @name delete
|
|
1511
|
+
* @memberOf ListCache
|
|
1512
|
+
* @param {string} key The key of the value to remove.
|
|
1513
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1514
|
+
*/
|
|
1515
|
+
function listCacheDelete(key) {
|
|
1516
|
+
var data = this.__data__,
|
|
1517
|
+
index = _assocIndexOf(data, key);
|
|
1518
|
+
if (index < 0) {
|
|
1519
|
+
return false;
|
|
1520
|
+
}
|
|
1521
|
+
var lastIndex = data.length - 1;
|
|
1522
|
+
if (index == lastIndex) {
|
|
1523
|
+
data.pop();
|
|
1524
|
+
} else {
|
|
1525
|
+
splice.call(data, index, 1);
|
|
1526
|
+
}
|
|
1527
|
+
--this.size;
|
|
1528
|
+
return true;
|
|
1529
|
+
}
|
|
1530
|
+
var _listCacheDelete = listCacheDelete;
|
|
1554
1531
|
|
|
1532
|
+
/**
|
|
1533
|
+
* Gets the list cache value for `key`.
|
|
1534
|
+
*
|
|
1535
|
+
* @private
|
|
1536
|
+
* @name get
|
|
1537
|
+
* @memberOf ListCache
|
|
1538
|
+
* @param {string} key The key of the value to get.
|
|
1539
|
+
* @returns {*} Returns the entry value.
|
|
1540
|
+
*/
|
|
1541
|
+
function listCacheGet(key) {
|
|
1542
|
+
var data = this.__data__,
|
|
1543
|
+
index = _assocIndexOf(data, key);
|
|
1544
|
+
return index < 0 ? undefined : data[index][1];
|
|
1545
|
+
}
|
|
1546
|
+
var _listCacheGet = listCacheGet;
|
|
1555
1547
|
|
|
1556
|
-
|
|
1557
|
-
|
|
1548
|
+
/**
|
|
1549
|
+
* Checks if a list cache value for `key` exists.
|
|
1550
|
+
*
|
|
1551
|
+
* @private
|
|
1552
|
+
* @name has
|
|
1553
|
+
* @memberOf ListCache
|
|
1554
|
+
* @param {string} key The key of the entry to check.
|
|
1555
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1556
|
+
*/
|
|
1557
|
+
function listCacheHas(key) {
|
|
1558
|
+
return _assocIndexOf(this.__data__, key) > -1;
|
|
1559
|
+
}
|
|
1560
|
+
var _listCacheHas = listCacheHas;
|
|
1558
1561
|
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1562
|
+
/**
|
|
1563
|
+
* Sets the list cache `key` to `value`.
|
|
1564
|
+
*
|
|
1565
|
+
* @private
|
|
1566
|
+
* @name set
|
|
1567
|
+
* @memberOf ListCache
|
|
1568
|
+
* @param {string} key The key of the value to set.
|
|
1569
|
+
* @param {*} value The value to set.
|
|
1570
|
+
* @returns {Object} Returns the list cache instance.
|
|
1571
|
+
*/
|
|
1572
|
+
function listCacheSet(key, value) {
|
|
1573
|
+
var data = this.__data__,
|
|
1574
|
+
index = _assocIndexOf(data, key);
|
|
1575
|
+
if (index < 0) {
|
|
1576
|
+
++this.size;
|
|
1577
|
+
data.push([key, value]);
|
|
1578
|
+
} else {
|
|
1579
|
+
data[index][1] = value;
|
|
1580
|
+
}
|
|
1581
|
+
return this;
|
|
1582
|
+
}
|
|
1583
|
+
var _listCacheSet = listCacheSet;
|
|
1564
1584
|
|
|
1565
|
-
|
|
1566
|
-
|
|
1585
|
+
/**
|
|
1586
|
+
* Creates an list cache object.
|
|
1587
|
+
*
|
|
1588
|
+
* @private
|
|
1589
|
+
* @constructor
|
|
1590
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1591
|
+
*/
|
|
1592
|
+
function ListCache(entries) {
|
|
1593
|
+
var index = -1,
|
|
1594
|
+
length = entries == null ? 0 : entries.length;
|
|
1595
|
+
this.clear();
|
|
1596
|
+
while (++index < length) {
|
|
1597
|
+
var entry = entries[index];
|
|
1598
|
+
this.set(entry[0], entry[1]);
|
|
1599
|
+
}
|
|
1567
1600
|
}
|
|
1568
1601
|
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1602
|
+
// Add methods to `ListCache`.
|
|
1603
|
+
ListCache.prototype.clear = _listCacheClear;
|
|
1604
|
+
ListCache.prototype['delete'] = _listCacheDelete;
|
|
1605
|
+
ListCache.prototype.get = _listCacheGet;
|
|
1606
|
+
ListCache.prototype.has = _listCacheHas;
|
|
1607
|
+
ListCache.prototype.set = _listCacheSet;
|
|
1608
|
+
var _ListCache = ListCache;
|
|
1575
1609
|
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1610
|
+
/**
|
|
1611
|
+
* Removes all key-value entries from the stack.
|
|
1612
|
+
*
|
|
1613
|
+
* @private
|
|
1614
|
+
* @name clear
|
|
1615
|
+
* @memberOf Stack
|
|
1616
|
+
*/
|
|
1617
|
+
function stackClear() {
|
|
1618
|
+
this.__data__ = new _ListCache();
|
|
1619
|
+
this.size = 0;
|
|
1620
|
+
}
|
|
1621
|
+
var _stackClear = stackClear;
|
|
1582
1622
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1623
|
+
/**
|
|
1624
|
+
* Removes `key` and its value from the stack.
|
|
1625
|
+
*
|
|
1626
|
+
* @private
|
|
1627
|
+
* @name delete
|
|
1628
|
+
* @memberOf Stack
|
|
1629
|
+
* @param {string} key The key of the value to remove.
|
|
1630
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1631
|
+
*/
|
|
1632
|
+
function stackDelete(key) {
|
|
1633
|
+
var data = this.__data__,
|
|
1634
|
+
result = data['delete'](key);
|
|
1635
|
+
this.size = data.size;
|
|
1636
|
+
return result;
|
|
1637
|
+
}
|
|
1638
|
+
var _stackDelete = stackDelete;
|
|
1589
1639
|
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
tooltipProps,
|
|
1604
|
-
onMouseEnter: onMouseEnterProp = () => {},
|
|
1605
|
-
width,
|
|
1606
|
-
visibility,
|
|
1607
|
-
innerRef,
|
|
1608
|
-
info: infoProps,
|
|
1609
|
-
isStickyColumn = false,
|
|
1610
|
-
hasRightBorder = false,
|
|
1611
|
-
hasLeftBorder = false,
|
|
1612
|
-
stickyMinWidth = '120px',
|
|
1613
|
-
stickyLeftOffset,
|
|
1614
|
-
stickyRightOffset,
|
|
1615
|
-
isSubheader = false,
|
|
1616
|
-
screenReaderText,
|
|
1617
|
-
'aria-label': ariaLabel
|
|
1618
|
-
} = _a,
|
|
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']);
|
|
1640
|
+
/**
|
|
1641
|
+
* Gets the stack value for `key`.
|
|
1642
|
+
*
|
|
1643
|
+
* @private
|
|
1644
|
+
* @name get
|
|
1645
|
+
* @memberOf Stack
|
|
1646
|
+
* @param {string} key The key of the value to get.
|
|
1647
|
+
* @returns {*} Returns the entry value.
|
|
1648
|
+
*/
|
|
1649
|
+
function stackGet(key) {
|
|
1650
|
+
return this.__data__.get(key);
|
|
1651
|
+
}
|
|
1652
|
+
var _stackGet = stackGet;
|
|
1620
1653
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1654
|
+
/**
|
|
1655
|
+
* Checks if a stack value for `key` exists.
|
|
1656
|
+
*
|
|
1657
|
+
* @private
|
|
1658
|
+
* @name has
|
|
1659
|
+
* @memberOf Stack
|
|
1660
|
+
* @param {string} key The key of the entry to check.
|
|
1661
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1662
|
+
*/
|
|
1663
|
+
function stackHas(key) {
|
|
1664
|
+
return this.__data__.has(key);
|
|
1665
|
+
}
|
|
1666
|
+
var _stackHas = stackHas;
|
|
1625
1667
|
|
|
1668
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1669
|
+
|
|
1670
|
+
function createCommonjsModule(fn) {
|
|
1671
|
+
var module = { exports: {} };
|
|
1672
|
+
return fn(module, module.exports), module.exports;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/** Detect free variable `global` from Node.js. */
|
|
1676
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
1677
|
+
var _freeGlobal = freeGlobal;
|
|
1678
|
+
|
|
1679
|
+
/** Detect free variable `self`. */
|
|
1680
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
1681
|
+
|
|
1682
|
+
/** Used as a reference to the global object. */
|
|
1683
|
+
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
1684
|
+
var _root = root;
|
|
1685
|
+
|
|
1686
|
+
/** Built-in value references. */
|
|
1687
|
+
var Symbol = _root.Symbol;
|
|
1688
|
+
var _Symbol = Symbol;
|
|
1689
|
+
|
|
1690
|
+
/** Used for built-in method references. */
|
|
1691
|
+
var objectProto$a = Object.prototype;
|
|
1692
|
+
|
|
1693
|
+
/** Used to check objects for own properties. */
|
|
1694
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* Used to resolve the
|
|
1698
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1699
|
+
* of values.
|
|
1700
|
+
*/
|
|
1701
|
+
var nativeObjectToString$1 = objectProto$a.toString;
|
|
1702
|
+
|
|
1703
|
+
/** Built-in value references. */
|
|
1704
|
+
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
1708
|
+
*
|
|
1709
|
+
* @private
|
|
1710
|
+
* @param {*} value The value to query.
|
|
1711
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
1712
|
+
*/
|
|
1713
|
+
function getRawTag(value) {
|
|
1714
|
+
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
|
|
1715
|
+
tag = value[symToStringTag$1];
|
|
1716
|
+
try {
|
|
1717
|
+
value[symToStringTag$1] = undefined;
|
|
1718
|
+
var unmasked = true;
|
|
1719
|
+
} catch (e) {}
|
|
1720
|
+
var result = nativeObjectToString$1.call(value);
|
|
1721
|
+
if (unmasked) {
|
|
1722
|
+
if (isOwn) {
|
|
1723
|
+
value[symToStringTag$1] = tag;
|
|
1724
|
+
} else {
|
|
1725
|
+
delete value[symToStringTag$1];
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
return result;
|
|
1729
|
+
}
|
|
1730
|
+
var _getRawTag = getRawTag;
|
|
1731
|
+
|
|
1732
|
+
/** Used for built-in method references. */
|
|
1733
|
+
var objectProto$9 = Object.prototype;
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* Used to resolve the
|
|
1737
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1738
|
+
* of values.
|
|
1739
|
+
*/
|
|
1740
|
+
var nativeObjectToString = objectProto$9.toString;
|
|
1741
|
+
|
|
1742
|
+
/**
|
|
1743
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
1744
|
+
*
|
|
1745
|
+
* @private
|
|
1746
|
+
* @param {*} value The value to convert.
|
|
1747
|
+
* @returns {string} Returns the converted string.
|
|
1748
|
+
*/
|
|
1749
|
+
function objectToString(value) {
|
|
1750
|
+
return nativeObjectToString.call(value);
|
|
1751
|
+
}
|
|
1752
|
+
var _objectToString = objectToString;
|
|
1753
|
+
|
|
1754
|
+
/** `Object#toString` result references. */
|
|
1755
|
+
var nullTag = '[object Null]',
|
|
1756
|
+
undefinedTag = '[object Undefined]';
|
|
1757
|
+
|
|
1758
|
+
/** Built-in value references. */
|
|
1759
|
+
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
1763
|
+
*
|
|
1764
|
+
* @private
|
|
1765
|
+
* @param {*} value The value to query.
|
|
1766
|
+
* @returns {string} Returns the `toStringTag`.
|
|
1767
|
+
*/
|
|
1768
|
+
function baseGetTag(value) {
|
|
1769
|
+
if (value == null) {
|
|
1770
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
1771
|
+
}
|
|
1772
|
+
return symToStringTag && symToStringTag in Object(value) ? _getRawTag(value) : _objectToString(value);
|
|
1773
|
+
}
|
|
1774
|
+
var _baseGetTag = baseGetTag;
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* Checks if `value` is the
|
|
1778
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
1779
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
1780
|
+
*
|
|
1781
|
+
* @static
|
|
1782
|
+
* @memberOf _
|
|
1783
|
+
* @since 0.1.0
|
|
1784
|
+
* @category Lang
|
|
1785
|
+
* @param {*} value The value to check.
|
|
1786
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
1787
|
+
* @example
|
|
1788
|
+
*
|
|
1789
|
+
* _.isObject({});
|
|
1790
|
+
* // => true
|
|
1791
|
+
*
|
|
1792
|
+
* _.isObject([1, 2, 3]);
|
|
1793
|
+
* // => true
|
|
1794
|
+
*
|
|
1795
|
+
* _.isObject(_.noop);
|
|
1796
|
+
* // => true
|
|
1797
|
+
*
|
|
1798
|
+
* _.isObject(null);
|
|
1799
|
+
* // => false
|
|
1800
|
+
*/
|
|
1801
|
+
function isObject(value) {
|
|
1802
|
+
var type = typeof value;
|
|
1803
|
+
return value != null && (type == 'object' || type == 'function');
|
|
1804
|
+
}
|
|
1805
|
+
var isObject_1 = isObject;
|
|
1806
|
+
|
|
1807
|
+
/** `Object#toString` result references. */
|
|
1808
|
+
var asyncTag = '[object AsyncFunction]',
|
|
1809
|
+
funcTag$1 = '[object Function]',
|
|
1810
|
+
genTag = '[object GeneratorFunction]',
|
|
1811
|
+
proxyTag = '[object Proxy]';
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* Checks if `value` is classified as a `Function` object.
|
|
1815
|
+
*
|
|
1816
|
+
* @static
|
|
1817
|
+
* @memberOf _
|
|
1818
|
+
* @since 0.1.0
|
|
1819
|
+
* @category Lang
|
|
1820
|
+
* @param {*} value The value to check.
|
|
1821
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
1822
|
+
* @example
|
|
1823
|
+
*
|
|
1824
|
+
* _.isFunction(_);
|
|
1825
|
+
* // => true
|
|
1826
|
+
*
|
|
1827
|
+
* _.isFunction(/abc/);
|
|
1828
|
+
* // => false
|
|
1829
|
+
*/
|
|
1830
|
+
function isFunction(value) {
|
|
1831
|
+
if (!isObject_1(value)) {
|
|
1832
|
+
return false;
|
|
1833
|
+
}
|
|
1834
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
1835
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
1836
|
+
var tag = _baseGetTag(value);
|
|
1837
|
+
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
1838
|
+
}
|
|
1839
|
+
var isFunction_1 = isFunction;
|
|
1840
|
+
|
|
1841
|
+
/** Used to detect overreaching core-js shims. */
|
|
1842
|
+
var coreJsData = _root['__core-js_shared__'];
|
|
1843
|
+
var _coreJsData = coreJsData;
|
|
1844
|
+
|
|
1845
|
+
/** Used to detect methods masquerading as native. */
|
|
1846
|
+
var maskSrcKey = function () {
|
|
1847
|
+
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
|
|
1848
|
+
return uid ? 'Symbol(src)_1.' + uid : '';
|
|
1849
|
+
}();
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Checks if `func` has its source masked.
|
|
1853
|
+
*
|
|
1854
|
+
* @private
|
|
1855
|
+
* @param {Function} func The function to check.
|
|
1856
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
1857
|
+
*/
|
|
1858
|
+
function isMasked(func) {
|
|
1859
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
1860
|
+
}
|
|
1861
|
+
var _isMasked = isMasked;
|
|
1862
|
+
|
|
1863
|
+
/** Used for built-in method references. */
|
|
1864
|
+
var funcProto$2 = Function.prototype;
|
|
1865
|
+
|
|
1866
|
+
/** Used to resolve the decompiled source of functions. */
|
|
1867
|
+
var funcToString$2 = funcProto$2.toString;
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Converts `func` to its source code.
|
|
1871
|
+
*
|
|
1872
|
+
* @private
|
|
1873
|
+
* @param {Function} func The function to convert.
|
|
1874
|
+
* @returns {string} Returns the source code.
|
|
1875
|
+
*/
|
|
1876
|
+
function toSource(func) {
|
|
1877
|
+
if (func != null) {
|
|
1878
|
+
try {
|
|
1879
|
+
return funcToString$2.call(func);
|
|
1880
|
+
} catch (e) {}
|
|
1881
|
+
try {
|
|
1882
|
+
return func + '';
|
|
1883
|
+
} catch (e) {}
|
|
1884
|
+
}
|
|
1885
|
+
return '';
|
|
1886
|
+
}
|
|
1887
|
+
var _toSource = toSource;
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Used to match `RegExp`
|
|
1891
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
1892
|
+
*/
|
|
1893
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
1894
|
+
|
|
1895
|
+
/** Used to detect host constructors (Safari). */
|
|
1896
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
1897
|
+
|
|
1898
|
+
/** Used for built-in method references. */
|
|
1899
|
+
var funcProto$1 = Function.prototype,
|
|
1900
|
+
objectProto$8 = Object.prototype;
|
|
1901
|
+
|
|
1902
|
+
/** Used to resolve the decompiled source of functions. */
|
|
1903
|
+
var funcToString$1 = funcProto$1.toString;
|
|
1904
|
+
|
|
1905
|
+
/** Used to check objects for own properties. */
|
|
1906
|
+
var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
|
|
1907
|
+
|
|
1908
|
+
/** Used to detect if a method is native. */
|
|
1909
|
+
var reIsNative = RegExp('^' + funcToString$1.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
1910
|
+
|
|
1911
|
+
/**
|
|
1912
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
1913
|
+
*
|
|
1914
|
+
* @private
|
|
1915
|
+
* @param {*} value The value to check.
|
|
1916
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
1917
|
+
* else `false`.
|
|
1918
|
+
*/
|
|
1919
|
+
function baseIsNative(value) {
|
|
1920
|
+
if (!isObject_1(value) || _isMasked(value)) {
|
|
1921
|
+
return false;
|
|
1922
|
+
}
|
|
1923
|
+
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
|
|
1924
|
+
return pattern.test(_toSource(value));
|
|
1925
|
+
}
|
|
1926
|
+
var _baseIsNative = baseIsNative;
|
|
1927
|
+
|
|
1928
|
+
/**
|
|
1929
|
+
* Gets the value at `key` of `object`.
|
|
1930
|
+
*
|
|
1931
|
+
* @private
|
|
1932
|
+
* @param {Object} [object] The object to query.
|
|
1933
|
+
* @param {string} key The key of the property to get.
|
|
1934
|
+
* @returns {*} Returns the property value.
|
|
1935
|
+
*/
|
|
1936
|
+
function getValue(object, key) {
|
|
1937
|
+
return object == null ? undefined : object[key];
|
|
1938
|
+
}
|
|
1939
|
+
var _getValue = getValue;
|
|
1940
|
+
|
|
1941
|
+
/**
|
|
1942
|
+
* Gets the native function at `key` of `object`.
|
|
1943
|
+
*
|
|
1944
|
+
* @private
|
|
1945
|
+
* @param {Object} object The object to query.
|
|
1946
|
+
* @param {string} key The key of the method to get.
|
|
1947
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1948
|
+
*/
|
|
1949
|
+
function getNative(object, key) {
|
|
1950
|
+
var value = _getValue(object, key);
|
|
1951
|
+
return _baseIsNative(value) ? value : undefined;
|
|
1952
|
+
}
|
|
1953
|
+
var _getNative = getNative;
|
|
1954
|
+
|
|
1955
|
+
/* Built-in method references that are verified to be native. */
|
|
1956
|
+
var Map = _getNative(_root, 'Map');
|
|
1957
|
+
var _Map = Map;
|
|
1958
|
+
|
|
1959
|
+
/* Built-in method references that are verified to be native. */
|
|
1960
|
+
var nativeCreate = _getNative(Object, 'create');
|
|
1961
|
+
var _nativeCreate = nativeCreate;
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* Removes all key-value entries from the hash.
|
|
1965
|
+
*
|
|
1966
|
+
* @private
|
|
1967
|
+
* @name clear
|
|
1968
|
+
* @memberOf Hash
|
|
1969
|
+
*/
|
|
1970
|
+
function hashClear() {
|
|
1971
|
+
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
|
1972
|
+
this.size = 0;
|
|
1973
|
+
}
|
|
1974
|
+
var _hashClear = hashClear;
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* Removes `key` and its value from the hash.
|
|
1978
|
+
*
|
|
1979
|
+
* @private
|
|
1980
|
+
* @name delete
|
|
1981
|
+
* @memberOf Hash
|
|
1982
|
+
* @param {Object} hash The hash to modify.
|
|
1983
|
+
* @param {string} key The key of the value to remove.
|
|
1984
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1985
|
+
*/
|
|
1986
|
+
function hashDelete(key) {
|
|
1987
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1988
|
+
this.size -= result ? 1 : 0;
|
|
1989
|
+
return result;
|
|
1990
|
+
}
|
|
1991
|
+
var _hashDelete = hashDelete;
|
|
1992
|
+
|
|
1993
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1994
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1995
|
+
|
|
1996
|
+
/** Used for built-in method references. */
|
|
1997
|
+
var objectProto$7 = Object.prototype;
|
|
1998
|
+
|
|
1999
|
+
/** Used to check objects for own properties. */
|
|
2000
|
+
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Gets the hash value for `key`.
|
|
2004
|
+
*
|
|
2005
|
+
* @private
|
|
2006
|
+
* @name get
|
|
2007
|
+
* @memberOf Hash
|
|
2008
|
+
* @param {string} key The key of the value to get.
|
|
2009
|
+
* @returns {*} Returns the entry value.
|
|
2010
|
+
*/
|
|
2011
|
+
function hashGet(key) {
|
|
2012
|
+
var data = this.__data__;
|
|
2013
|
+
if (_nativeCreate) {
|
|
2014
|
+
var result = data[key];
|
|
2015
|
+
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
2016
|
+
}
|
|
2017
|
+
return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
|
|
2018
|
+
}
|
|
2019
|
+
var _hashGet = hashGet;
|
|
2020
|
+
|
|
2021
|
+
/** Used for built-in method references. */
|
|
2022
|
+
var objectProto$6 = Object.prototype;
|
|
2023
|
+
|
|
2024
|
+
/** Used to check objects for own properties. */
|
|
2025
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
2026
|
+
|
|
2027
|
+
/**
|
|
2028
|
+
* Checks if a hash value for `key` exists.
|
|
2029
|
+
*
|
|
2030
|
+
* @private
|
|
2031
|
+
* @name has
|
|
2032
|
+
* @memberOf Hash
|
|
2033
|
+
* @param {string} key The key of the entry to check.
|
|
2034
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
2035
|
+
*/
|
|
2036
|
+
function hashHas(key) {
|
|
2037
|
+
var data = this.__data__;
|
|
2038
|
+
return _nativeCreate ? data[key] !== undefined : hasOwnProperty$5.call(data, key);
|
|
2039
|
+
}
|
|
2040
|
+
var _hashHas = hashHas;
|
|
2041
|
+
|
|
2042
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
2043
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
2044
|
+
|
|
2045
|
+
/**
|
|
2046
|
+
* Sets the hash `key` to `value`.
|
|
2047
|
+
*
|
|
2048
|
+
* @private
|
|
2049
|
+
* @name set
|
|
2050
|
+
* @memberOf Hash
|
|
2051
|
+
* @param {string} key The key of the value to set.
|
|
2052
|
+
* @param {*} value The value to set.
|
|
2053
|
+
* @returns {Object} Returns the hash instance.
|
|
2054
|
+
*/
|
|
2055
|
+
function hashSet(key, value) {
|
|
2056
|
+
var data = this.__data__;
|
|
2057
|
+
this.size += this.has(key) ? 0 : 1;
|
|
2058
|
+
data[key] = _nativeCreate && value === undefined ? HASH_UNDEFINED : value;
|
|
2059
|
+
return this;
|
|
2060
|
+
}
|
|
2061
|
+
var _hashSet = hashSet;
|
|
2062
|
+
|
|
2063
|
+
/**
|
|
2064
|
+
* Creates a hash object.
|
|
2065
|
+
*
|
|
2066
|
+
* @private
|
|
2067
|
+
* @constructor
|
|
2068
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
2069
|
+
*/
|
|
2070
|
+
function Hash(entries) {
|
|
2071
|
+
var index = -1,
|
|
2072
|
+
length = entries == null ? 0 : entries.length;
|
|
2073
|
+
this.clear();
|
|
2074
|
+
while (++index < length) {
|
|
2075
|
+
var entry = entries[index];
|
|
2076
|
+
this.set(entry[0], entry[1]);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
// Add methods to `Hash`.
|
|
2081
|
+
Hash.prototype.clear = _hashClear;
|
|
2082
|
+
Hash.prototype['delete'] = _hashDelete;
|
|
2083
|
+
Hash.prototype.get = _hashGet;
|
|
2084
|
+
Hash.prototype.has = _hashHas;
|
|
2085
|
+
Hash.prototype.set = _hashSet;
|
|
2086
|
+
var _Hash = Hash;
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Removes all key-value entries from the map.
|
|
2090
|
+
*
|
|
2091
|
+
* @private
|
|
2092
|
+
* @name clear
|
|
2093
|
+
* @memberOf MapCache
|
|
2094
|
+
*/
|
|
2095
|
+
function mapCacheClear() {
|
|
2096
|
+
this.size = 0;
|
|
2097
|
+
this.__data__ = {
|
|
2098
|
+
'hash': new _Hash(),
|
|
2099
|
+
'map': new (_Map || _ListCache)(),
|
|
2100
|
+
'string': new _Hash()
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
var _mapCacheClear = mapCacheClear;
|
|
2104
|
+
|
|
2105
|
+
/**
|
|
2106
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
2107
|
+
*
|
|
2108
|
+
* @private
|
|
2109
|
+
* @param {*} value The value to check.
|
|
2110
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
2111
|
+
*/
|
|
2112
|
+
function isKeyable(value) {
|
|
2113
|
+
var type = typeof value;
|
|
2114
|
+
return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
|
|
2115
|
+
}
|
|
2116
|
+
var _isKeyable = isKeyable;
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Gets the data for `map`.
|
|
2120
|
+
*
|
|
2121
|
+
* @private
|
|
2122
|
+
* @param {Object} map The map to query.
|
|
2123
|
+
* @param {string} key The reference key.
|
|
2124
|
+
* @returns {*} Returns the map data.
|
|
2125
|
+
*/
|
|
2126
|
+
function getMapData(map, key) {
|
|
2127
|
+
var data = map.__data__;
|
|
2128
|
+
return _isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
|
|
2129
|
+
}
|
|
2130
|
+
var _getMapData = getMapData;
|
|
2131
|
+
|
|
2132
|
+
/**
|
|
2133
|
+
* Removes `key` and its value from the map.
|
|
2134
|
+
*
|
|
2135
|
+
* @private
|
|
2136
|
+
* @name delete
|
|
2137
|
+
* @memberOf MapCache
|
|
2138
|
+
* @param {string} key The key of the value to remove.
|
|
2139
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
2140
|
+
*/
|
|
2141
|
+
function mapCacheDelete(key) {
|
|
2142
|
+
var result = _getMapData(this, key)['delete'](key);
|
|
2143
|
+
this.size -= result ? 1 : 0;
|
|
2144
|
+
return result;
|
|
2145
|
+
}
|
|
2146
|
+
var _mapCacheDelete = mapCacheDelete;
|
|
2147
|
+
|
|
2148
|
+
/**
|
|
2149
|
+
* Gets the map value for `key`.
|
|
2150
|
+
*
|
|
2151
|
+
* @private
|
|
2152
|
+
* @name get
|
|
2153
|
+
* @memberOf MapCache
|
|
2154
|
+
* @param {string} key The key of the value to get.
|
|
2155
|
+
* @returns {*} Returns the entry value.
|
|
2156
|
+
*/
|
|
2157
|
+
function mapCacheGet(key) {
|
|
2158
|
+
return _getMapData(this, key).get(key);
|
|
2159
|
+
}
|
|
2160
|
+
var _mapCacheGet = mapCacheGet;
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* Checks if a map value for `key` exists.
|
|
2164
|
+
*
|
|
2165
|
+
* @private
|
|
2166
|
+
* @name has
|
|
2167
|
+
* @memberOf MapCache
|
|
2168
|
+
* @param {string} key The key of the entry to check.
|
|
2169
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
2170
|
+
*/
|
|
2171
|
+
function mapCacheHas(key) {
|
|
2172
|
+
return _getMapData(this, key).has(key);
|
|
2173
|
+
}
|
|
2174
|
+
var _mapCacheHas = mapCacheHas;
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* Sets the map `key` to `value`.
|
|
2178
|
+
*
|
|
2179
|
+
* @private
|
|
2180
|
+
* @name set
|
|
2181
|
+
* @memberOf MapCache
|
|
2182
|
+
* @param {string} key The key of the value to set.
|
|
2183
|
+
* @param {*} value The value to set.
|
|
2184
|
+
* @returns {Object} Returns the map cache instance.
|
|
2185
|
+
*/
|
|
2186
|
+
function mapCacheSet(key, value) {
|
|
2187
|
+
var data = _getMapData(this, key),
|
|
2188
|
+
size = data.size;
|
|
2189
|
+
data.set(key, value);
|
|
2190
|
+
this.size += data.size == size ? 0 : 1;
|
|
2191
|
+
return this;
|
|
2192
|
+
}
|
|
2193
|
+
var _mapCacheSet = mapCacheSet;
|
|
2194
|
+
|
|
2195
|
+
/**
|
|
2196
|
+
* Creates a map cache object to store key-value pairs.
|
|
2197
|
+
*
|
|
2198
|
+
* @private
|
|
2199
|
+
* @constructor
|
|
2200
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
2201
|
+
*/
|
|
2202
|
+
function MapCache(entries) {
|
|
2203
|
+
var index = -1,
|
|
2204
|
+
length = entries == null ? 0 : entries.length;
|
|
2205
|
+
this.clear();
|
|
2206
|
+
while (++index < length) {
|
|
2207
|
+
var entry = entries[index];
|
|
2208
|
+
this.set(entry[0], entry[1]);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
// Add methods to `MapCache`.
|
|
2213
|
+
MapCache.prototype.clear = _mapCacheClear;
|
|
2214
|
+
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
2215
|
+
MapCache.prototype.get = _mapCacheGet;
|
|
2216
|
+
MapCache.prototype.has = _mapCacheHas;
|
|
2217
|
+
MapCache.prototype.set = _mapCacheSet;
|
|
2218
|
+
var _MapCache = MapCache;
|
|
2219
|
+
|
|
2220
|
+
/** Used as the size to enable large array optimizations. */
|
|
2221
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
2222
|
+
|
|
2223
|
+
/**
|
|
2224
|
+
* Sets the stack `key` to `value`.
|
|
2225
|
+
*
|
|
2226
|
+
* @private
|
|
2227
|
+
* @name set
|
|
2228
|
+
* @memberOf Stack
|
|
2229
|
+
* @param {string} key The key of the value to set.
|
|
2230
|
+
* @param {*} value The value to set.
|
|
2231
|
+
* @returns {Object} Returns the stack cache instance.
|
|
2232
|
+
*/
|
|
2233
|
+
function stackSet(key, value) {
|
|
2234
|
+
var data = this.__data__;
|
|
2235
|
+
if (data instanceof _ListCache) {
|
|
2236
|
+
var pairs = data.__data__;
|
|
2237
|
+
if (!_Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
2238
|
+
pairs.push([key, value]);
|
|
2239
|
+
this.size = ++data.size;
|
|
2240
|
+
return this;
|
|
2241
|
+
}
|
|
2242
|
+
data = this.__data__ = new _MapCache(pairs);
|
|
2243
|
+
}
|
|
2244
|
+
data.set(key, value);
|
|
2245
|
+
this.size = data.size;
|
|
2246
|
+
return this;
|
|
2247
|
+
}
|
|
2248
|
+
var _stackSet = stackSet;
|
|
2249
|
+
|
|
2250
|
+
/**
|
|
2251
|
+
* Creates a stack cache object to store key-value pairs.
|
|
2252
|
+
*
|
|
2253
|
+
* @private
|
|
2254
|
+
* @constructor
|
|
2255
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
2256
|
+
*/
|
|
2257
|
+
function Stack(entries) {
|
|
2258
|
+
var data = this.__data__ = new _ListCache(entries);
|
|
2259
|
+
this.size = data.size;
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
// Add methods to `Stack`.
|
|
2263
|
+
Stack.prototype.clear = _stackClear;
|
|
2264
|
+
Stack.prototype['delete'] = _stackDelete;
|
|
2265
|
+
Stack.prototype.get = _stackGet;
|
|
2266
|
+
Stack.prototype.has = _stackHas;
|
|
2267
|
+
Stack.prototype.set = _stackSet;
|
|
2268
|
+
var _Stack = Stack;
|
|
2269
|
+
|
|
2270
|
+
var defineProperty = function () {
|
|
2271
|
+
try {
|
|
2272
|
+
var func = _getNative(Object, 'defineProperty');
|
|
2273
|
+
func({}, '', {});
|
|
2274
|
+
return func;
|
|
2275
|
+
} catch (e) {}
|
|
2276
|
+
}();
|
|
2277
|
+
var _defineProperty = defineProperty;
|
|
2278
|
+
|
|
2279
|
+
/**
|
|
2280
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
2281
|
+
* value checks.
|
|
2282
|
+
*
|
|
2283
|
+
* @private
|
|
2284
|
+
* @param {Object} object The object to modify.
|
|
2285
|
+
* @param {string} key The key of the property to assign.
|
|
2286
|
+
* @param {*} value The value to assign.
|
|
2287
|
+
*/
|
|
2288
|
+
function baseAssignValue(object, key, value) {
|
|
2289
|
+
if (key == '__proto__' && _defineProperty) {
|
|
2290
|
+
_defineProperty(object, key, {
|
|
2291
|
+
'configurable': true,
|
|
2292
|
+
'enumerable': true,
|
|
2293
|
+
'value': value,
|
|
2294
|
+
'writable': true
|
|
2295
|
+
});
|
|
2296
|
+
} else {
|
|
2297
|
+
object[key] = value;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
var _baseAssignValue = baseAssignValue;
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* This function is like `assignValue` except that it doesn't assign
|
|
2304
|
+
* `undefined` values.
|
|
2305
|
+
*
|
|
2306
|
+
* @private
|
|
2307
|
+
* @param {Object} object The object to modify.
|
|
2308
|
+
* @param {string} key The key of the property to assign.
|
|
2309
|
+
* @param {*} value The value to assign.
|
|
2310
|
+
*/
|
|
2311
|
+
function assignMergeValue(object, key, value) {
|
|
2312
|
+
if (value !== undefined && !eq_1(object[key], value) || value === undefined && !(key in object)) {
|
|
2313
|
+
_baseAssignValue(object, key, value);
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
var _assignMergeValue = assignMergeValue;
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
2320
|
+
*
|
|
2321
|
+
* @private
|
|
2322
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
2323
|
+
* @returns {Function} Returns the new base function.
|
|
2324
|
+
*/
|
|
2325
|
+
function createBaseFor(fromRight) {
|
|
2326
|
+
return function (object, iteratee, keysFunc) {
|
|
2327
|
+
var index = -1,
|
|
2328
|
+
iterable = Object(object),
|
|
2329
|
+
props = keysFunc(object),
|
|
2330
|
+
length = props.length;
|
|
2331
|
+
while (length--) {
|
|
2332
|
+
var key = props[fromRight ? length : ++index];
|
|
2333
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
2334
|
+
break;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
return object;
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
var _createBaseFor = createBaseFor;
|
|
2341
|
+
|
|
2342
|
+
/**
|
|
2343
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
2344
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
2345
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
2346
|
+
*
|
|
2347
|
+
* @private
|
|
2348
|
+
* @param {Object} object The object to iterate over.
|
|
2349
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
2350
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
2351
|
+
* @returns {Object} Returns `object`.
|
|
2352
|
+
*/
|
|
2353
|
+
var baseFor = _createBaseFor();
|
|
2354
|
+
var _baseFor = baseFor;
|
|
2355
|
+
|
|
2356
|
+
var _cloneBuffer = createCommonjsModule(function (module, exports) {
|
|
2357
|
+
/** Detect free variable `exports`. */
|
|
2358
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
2359
|
+
|
|
2360
|
+
/** Detect free variable `module`. */
|
|
2361
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
2362
|
+
|
|
2363
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
2364
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2365
|
+
|
|
2366
|
+
/** Built-in value references. */
|
|
2367
|
+
var Buffer = moduleExports ? _root.Buffer : undefined,
|
|
2368
|
+
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
|
2369
|
+
|
|
2370
|
+
/**
|
|
2371
|
+
* Creates a clone of `buffer`.
|
|
2372
|
+
*
|
|
2373
|
+
* @private
|
|
2374
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
2375
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2376
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
2377
|
+
*/
|
|
2378
|
+
function cloneBuffer(buffer, isDeep) {
|
|
2379
|
+
if (isDeep) {
|
|
2380
|
+
return buffer.slice();
|
|
2381
|
+
}
|
|
2382
|
+
var length = buffer.length,
|
|
2383
|
+
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
2384
|
+
buffer.copy(result);
|
|
2385
|
+
return result;
|
|
2386
|
+
}
|
|
2387
|
+
module.exports = cloneBuffer;
|
|
2388
|
+
});
|
|
2389
|
+
|
|
2390
|
+
/** Built-in value references. */
|
|
2391
|
+
var Uint8Array = _root.Uint8Array;
|
|
2392
|
+
var _Uint8Array = Uint8Array;
|
|
2393
|
+
|
|
2394
|
+
/**
|
|
2395
|
+
* Creates a clone of `arrayBuffer`.
|
|
2396
|
+
*
|
|
2397
|
+
* @private
|
|
2398
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
2399
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
2400
|
+
*/
|
|
2401
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
2402
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2403
|
+
new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
|
|
2404
|
+
return result;
|
|
2405
|
+
}
|
|
2406
|
+
var _cloneArrayBuffer = cloneArrayBuffer;
|
|
2407
|
+
|
|
2408
|
+
/**
|
|
2409
|
+
* Creates a clone of `typedArray`.
|
|
2410
|
+
*
|
|
2411
|
+
* @private
|
|
2412
|
+
* @param {Object} typedArray The typed array to clone.
|
|
2413
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2414
|
+
* @returns {Object} Returns the cloned typed array.
|
|
2415
|
+
*/
|
|
2416
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
2417
|
+
var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
2418
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2419
|
+
}
|
|
2420
|
+
var _cloneTypedArray = cloneTypedArray;
|
|
2421
|
+
|
|
2422
|
+
/**
|
|
2423
|
+
* Copies the values of `source` to `array`.
|
|
2424
|
+
*
|
|
2425
|
+
* @private
|
|
2426
|
+
* @param {Array} source The array to copy values from.
|
|
2427
|
+
* @param {Array} [array=[]] The array to copy values to.
|
|
2428
|
+
* @returns {Array} Returns `array`.
|
|
2429
|
+
*/
|
|
2430
|
+
function copyArray(source, array) {
|
|
2431
|
+
var index = -1,
|
|
2432
|
+
length = source.length;
|
|
2433
|
+
array || (array = Array(length));
|
|
2434
|
+
while (++index < length) {
|
|
2435
|
+
array[index] = source[index];
|
|
2436
|
+
}
|
|
2437
|
+
return array;
|
|
2438
|
+
}
|
|
2439
|
+
var _copyArray = copyArray;
|
|
2440
|
+
|
|
2441
|
+
/** Built-in value references. */
|
|
2442
|
+
var objectCreate = Object.create;
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* The base implementation of `_.create` without support for assigning
|
|
2446
|
+
* properties to the created object.
|
|
2447
|
+
*
|
|
2448
|
+
* @private
|
|
2449
|
+
* @param {Object} proto The object to inherit from.
|
|
2450
|
+
* @returns {Object} Returns the new object.
|
|
2451
|
+
*/
|
|
2452
|
+
var baseCreate = function () {
|
|
2453
|
+
function object() {}
|
|
2454
|
+
return function (proto) {
|
|
2455
|
+
if (!isObject_1(proto)) {
|
|
2456
|
+
return {};
|
|
2457
|
+
}
|
|
2458
|
+
if (objectCreate) {
|
|
2459
|
+
return objectCreate(proto);
|
|
2460
|
+
}
|
|
2461
|
+
object.prototype = proto;
|
|
2462
|
+
var result = new object();
|
|
2463
|
+
object.prototype = undefined;
|
|
2464
|
+
return result;
|
|
2465
|
+
};
|
|
2466
|
+
}();
|
|
2467
|
+
var _baseCreate = baseCreate;
|
|
2468
|
+
|
|
2469
|
+
/**
|
|
2470
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
2471
|
+
*
|
|
2472
|
+
* @private
|
|
2473
|
+
* @param {Function} func The function to wrap.
|
|
2474
|
+
* @param {Function} transform The argument transform.
|
|
2475
|
+
* @returns {Function} Returns the new function.
|
|
2476
|
+
*/
|
|
2477
|
+
function overArg(func, transform) {
|
|
2478
|
+
return function (arg) {
|
|
2479
|
+
return func(transform(arg));
|
|
2480
|
+
};
|
|
2481
|
+
}
|
|
2482
|
+
var _overArg = overArg;
|
|
2483
|
+
|
|
2484
|
+
/** Built-in value references. */
|
|
2485
|
+
var getPrototype = _overArg(Object.getPrototypeOf, Object);
|
|
2486
|
+
var _getPrototype = getPrototype;
|
|
2487
|
+
|
|
2488
|
+
/** Used for built-in method references. */
|
|
2489
|
+
var objectProto$5 = Object.prototype;
|
|
2490
|
+
|
|
2491
|
+
/**
|
|
2492
|
+
* Checks if `value` is likely a prototype object.
|
|
2493
|
+
*
|
|
2494
|
+
* @private
|
|
2495
|
+
* @param {*} value The value to check.
|
|
2496
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
2497
|
+
*/
|
|
2498
|
+
function isPrototype(value) {
|
|
2499
|
+
var Ctor = value && value.constructor,
|
|
2500
|
+
proto = typeof Ctor == 'function' && Ctor.prototype || objectProto$5;
|
|
2501
|
+
return value === proto;
|
|
2502
|
+
}
|
|
2503
|
+
var _isPrototype = isPrototype;
|
|
2504
|
+
|
|
2505
|
+
/**
|
|
2506
|
+
* Initializes an object clone.
|
|
2507
|
+
*
|
|
2508
|
+
* @private
|
|
2509
|
+
* @param {Object} object The object to clone.
|
|
2510
|
+
* @returns {Object} Returns the initialized clone.
|
|
2511
|
+
*/
|
|
2512
|
+
function initCloneObject(object) {
|
|
2513
|
+
return typeof object.constructor == 'function' && !_isPrototype(object) ? _baseCreate(_getPrototype(object)) : {};
|
|
2514
|
+
}
|
|
2515
|
+
var _initCloneObject = initCloneObject;
|
|
2516
|
+
|
|
2517
|
+
/**
|
|
2518
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
2519
|
+
* and has a `typeof` result of "object".
|
|
2520
|
+
*
|
|
2521
|
+
* @static
|
|
2522
|
+
* @memberOf _
|
|
2523
|
+
* @since 4.0.0
|
|
2524
|
+
* @category Lang
|
|
2525
|
+
* @param {*} value The value to check.
|
|
2526
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
2527
|
+
* @example
|
|
2528
|
+
*
|
|
2529
|
+
* _.isObjectLike({});
|
|
2530
|
+
* // => true
|
|
2531
|
+
*
|
|
2532
|
+
* _.isObjectLike([1, 2, 3]);
|
|
2533
|
+
* // => true
|
|
2534
|
+
*
|
|
2535
|
+
* _.isObjectLike(_.noop);
|
|
2536
|
+
* // => false
|
|
2537
|
+
*
|
|
2538
|
+
* _.isObjectLike(null);
|
|
2539
|
+
* // => false
|
|
2540
|
+
*/
|
|
2541
|
+
function isObjectLike(value) {
|
|
2542
|
+
return value != null && typeof value == 'object';
|
|
2543
|
+
}
|
|
2544
|
+
var isObjectLike_1 = isObjectLike;
|
|
2545
|
+
|
|
2546
|
+
/** `Object#toString` result references. */
|
|
2547
|
+
var argsTag$1 = '[object Arguments]';
|
|
2548
|
+
|
|
2549
|
+
/**
|
|
2550
|
+
* The base implementation of `_.isArguments`.
|
|
2551
|
+
*
|
|
2552
|
+
* @private
|
|
2553
|
+
* @param {*} value The value to check.
|
|
2554
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
2555
|
+
*/
|
|
2556
|
+
function baseIsArguments(value) {
|
|
2557
|
+
return isObjectLike_1(value) && _baseGetTag(value) == argsTag$1;
|
|
2558
|
+
}
|
|
2559
|
+
var _baseIsArguments = baseIsArguments;
|
|
2560
|
+
|
|
2561
|
+
/** Used for built-in method references. */
|
|
2562
|
+
var objectProto$4 = Object.prototype;
|
|
2563
|
+
|
|
2564
|
+
/** Used to check objects for own properties. */
|
|
2565
|
+
var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
|
|
2566
|
+
|
|
2567
|
+
/** Built-in value references. */
|
|
2568
|
+
var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* Checks if `value` is likely an `arguments` object.
|
|
2572
|
+
*
|
|
2573
|
+
* @static
|
|
2574
|
+
* @memberOf _
|
|
2575
|
+
* @since 0.1.0
|
|
2576
|
+
* @category Lang
|
|
2577
|
+
* @param {*} value The value to check.
|
|
2578
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
2579
|
+
* else `false`.
|
|
2580
|
+
* @example
|
|
2581
|
+
*
|
|
2582
|
+
* _.isArguments(function() { return arguments; }());
|
|
2583
|
+
* // => true
|
|
2584
|
+
*
|
|
2585
|
+
* _.isArguments([1, 2, 3]);
|
|
2586
|
+
* // => false
|
|
2587
|
+
*/
|
|
2588
|
+
var isArguments = _baseIsArguments(function () {
|
|
2589
|
+
return arguments;
|
|
2590
|
+
}()) ? _baseIsArguments : function (value) {
|
|
2591
|
+
return isObjectLike_1(value) && hasOwnProperty$4.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
|
|
2592
|
+
};
|
|
2593
|
+
var isArguments_1 = isArguments;
|
|
2594
|
+
|
|
2595
|
+
/**
|
|
2596
|
+
* Checks if `value` is classified as an `Array` object.
|
|
2597
|
+
*
|
|
2598
|
+
* @static
|
|
2599
|
+
* @memberOf _
|
|
2600
|
+
* @since 0.1.0
|
|
2601
|
+
* @category Lang
|
|
2602
|
+
* @param {*} value The value to check.
|
|
2603
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
2604
|
+
* @example
|
|
2605
|
+
*
|
|
2606
|
+
* _.isArray([1, 2, 3]);
|
|
2607
|
+
* // => true
|
|
2608
|
+
*
|
|
2609
|
+
* _.isArray(document.body.children);
|
|
2610
|
+
* // => false
|
|
2611
|
+
*
|
|
2612
|
+
* _.isArray('abc');
|
|
2613
|
+
* // => false
|
|
2614
|
+
*
|
|
2615
|
+
* _.isArray(_.noop);
|
|
2616
|
+
* // => false
|
|
2617
|
+
*/
|
|
2618
|
+
var isArray = Array.isArray;
|
|
2619
|
+
var isArray_1 = isArray;
|
|
2620
|
+
|
|
2621
|
+
/** Used as references for various `Number` constants. */
|
|
2622
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* Checks if `value` is a valid array-like length.
|
|
2626
|
+
*
|
|
2627
|
+
* **Note:** This method is loosely based on
|
|
2628
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
2629
|
+
*
|
|
2630
|
+
* @static
|
|
2631
|
+
* @memberOf _
|
|
2632
|
+
* @since 4.0.0
|
|
2633
|
+
* @category Lang
|
|
2634
|
+
* @param {*} value The value to check.
|
|
2635
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
2636
|
+
* @example
|
|
2637
|
+
*
|
|
2638
|
+
* _.isLength(3);
|
|
2639
|
+
* // => true
|
|
2640
|
+
*
|
|
2641
|
+
* _.isLength(Number.MIN_VALUE);
|
|
2642
|
+
* // => false
|
|
2643
|
+
*
|
|
2644
|
+
* _.isLength(Infinity);
|
|
2645
|
+
* // => false
|
|
2646
|
+
*
|
|
2647
|
+
* _.isLength('3');
|
|
2648
|
+
* // => false
|
|
2649
|
+
*/
|
|
2650
|
+
function isLength(value) {
|
|
2651
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
|
|
2652
|
+
}
|
|
2653
|
+
var isLength_1 = isLength;
|
|
2654
|
+
|
|
2655
|
+
/**
|
|
2656
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
2657
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
2658
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
2659
|
+
*
|
|
2660
|
+
* @static
|
|
2661
|
+
* @memberOf _
|
|
2662
|
+
* @since 4.0.0
|
|
2663
|
+
* @category Lang
|
|
2664
|
+
* @param {*} value The value to check.
|
|
2665
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
2666
|
+
* @example
|
|
2667
|
+
*
|
|
2668
|
+
* _.isArrayLike([1, 2, 3]);
|
|
2669
|
+
* // => true
|
|
2670
|
+
*
|
|
2671
|
+
* _.isArrayLike(document.body.children);
|
|
2672
|
+
* // => true
|
|
2673
|
+
*
|
|
2674
|
+
* _.isArrayLike('abc');
|
|
2675
|
+
* // => true
|
|
2676
|
+
*
|
|
2677
|
+
* _.isArrayLike(_.noop);
|
|
2678
|
+
* // => false
|
|
2679
|
+
*/
|
|
2680
|
+
function isArrayLike(value) {
|
|
2681
|
+
return value != null && isLength_1(value.length) && !isFunction_1(value);
|
|
2682
|
+
}
|
|
2683
|
+
var isArrayLike_1 = isArrayLike;
|
|
2684
|
+
|
|
2685
|
+
/**
|
|
2686
|
+
* This method is like `_.isArrayLike` except that it also checks if `value`
|
|
2687
|
+
* is an object.
|
|
2688
|
+
*
|
|
2689
|
+
* @static
|
|
2690
|
+
* @memberOf _
|
|
2691
|
+
* @since 4.0.0
|
|
2692
|
+
* @category Lang
|
|
2693
|
+
* @param {*} value The value to check.
|
|
2694
|
+
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
|
2695
|
+
* else `false`.
|
|
2696
|
+
* @example
|
|
2697
|
+
*
|
|
2698
|
+
* _.isArrayLikeObject([1, 2, 3]);
|
|
2699
|
+
* // => true
|
|
2700
|
+
*
|
|
2701
|
+
* _.isArrayLikeObject(document.body.children);
|
|
2702
|
+
* // => true
|
|
2703
|
+
*
|
|
2704
|
+
* _.isArrayLikeObject('abc');
|
|
2705
|
+
* // => false
|
|
2706
|
+
*
|
|
2707
|
+
* _.isArrayLikeObject(_.noop);
|
|
2708
|
+
* // => false
|
|
2709
|
+
*/
|
|
2710
|
+
function isArrayLikeObject(value) {
|
|
2711
|
+
return isObjectLike_1(value) && isArrayLike_1(value);
|
|
2712
|
+
}
|
|
2713
|
+
var isArrayLikeObject_1 = isArrayLikeObject;
|
|
2714
|
+
|
|
2715
|
+
/**
|
|
2716
|
+
* This method returns `false`.
|
|
2717
|
+
*
|
|
2718
|
+
* @static
|
|
2719
|
+
* @memberOf _
|
|
2720
|
+
* @since 4.13.0
|
|
2721
|
+
* @category Util
|
|
2722
|
+
* @returns {boolean} Returns `false`.
|
|
2723
|
+
* @example
|
|
2724
|
+
*
|
|
2725
|
+
* _.times(2, _.stubFalse);
|
|
2726
|
+
* // => [false, false]
|
|
2727
|
+
*/
|
|
2728
|
+
function stubFalse() {
|
|
2729
|
+
return false;
|
|
2730
|
+
}
|
|
2731
|
+
var stubFalse_1 = stubFalse;
|
|
2732
|
+
|
|
2733
|
+
var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
|
2734
|
+
/** Detect free variable `exports`. */
|
|
2735
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
2736
|
+
|
|
2737
|
+
/** Detect free variable `module`. */
|
|
2738
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
2739
|
+
|
|
2740
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
2741
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2742
|
+
|
|
2743
|
+
/** Built-in value references. */
|
|
2744
|
+
var Buffer = moduleExports ? _root.Buffer : undefined;
|
|
2745
|
+
|
|
2746
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2747
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
2748
|
+
|
|
2749
|
+
/**
|
|
2750
|
+
* Checks if `value` is a buffer.
|
|
2751
|
+
*
|
|
2752
|
+
* @static
|
|
2753
|
+
* @memberOf _
|
|
2754
|
+
* @since 4.3.0
|
|
2755
|
+
* @category Lang
|
|
2756
|
+
* @param {*} value The value to check.
|
|
2757
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
2758
|
+
* @example
|
|
2759
|
+
*
|
|
2760
|
+
* _.isBuffer(new Buffer(2));
|
|
2761
|
+
* // => true
|
|
2762
|
+
*
|
|
2763
|
+
* _.isBuffer(new Uint8Array(2));
|
|
2764
|
+
* // => false
|
|
2765
|
+
*/
|
|
2766
|
+
var isBuffer = nativeIsBuffer || stubFalse_1;
|
|
2767
|
+
module.exports = isBuffer;
|
|
2768
|
+
});
|
|
2769
|
+
|
|
2770
|
+
/** `Object#toString` result references. */
|
|
2771
|
+
var objectTag$1 = '[object Object]';
|
|
2772
|
+
|
|
2773
|
+
/** Used for built-in method references. */
|
|
2774
|
+
var funcProto = Function.prototype,
|
|
2775
|
+
objectProto$3 = Object.prototype;
|
|
2776
|
+
|
|
2777
|
+
/** Used to resolve the decompiled source of functions. */
|
|
2778
|
+
var funcToString = funcProto.toString;
|
|
2779
|
+
|
|
2780
|
+
/** Used to check objects for own properties. */
|
|
2781
|
+
var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
|
|
2782
|
+
|
|
2783
|
+
/** Used to infer the `Object` constructor. */
|
|
2784
|
+
var objectCtorString = funcToString.call(Object);
|
|
2785
|
+
|
|
2786
|
+
/**
|
|
2787
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
2788
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
2789
|
+
*
|
|
2790
|
+
* @static
|
|
2791
|
+
* @memberOf _
|
|
2792
|
+
* @since 0.8.0
|
|
2793
|
+
* @category Lang
|
|
2794
|
+
* @param {*} value The value to check.
|
|
2795
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
2796
|
+
* @example
|
|
2797
|
+
*
|
|
2798
|
+
* function Foo() {
|
|
2799
|
+
* this.a = 1;
|
|
2800
|
+
* }
|
|
2801
|
+
*
|
|
2802
|
+
* _.isPlainObject(new Foo);
|
|
2803
|
+
* // => false
|
|
2804
|
+
*
|
|
2805
|
+
* _.isPlainObject([1, 2, 3]);
|
|
2806
|
+
* // => false
|
|
2807
|
+
*
|
|
2808
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
2809
|
+
* // => true
|
|
2810
|
+
*
|
|
2811
|
+
* _.isPlainObject(Object.create(null));
|
|
2812
|
+
* // => true
|
|
2813
|
+
*/
|
|
2814
|
+
function isPlainObject(value) {
|
|
2815
|
+
if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$1) {
|
|
2816
|
+
return false;
|
|
2817
|
+
}
|
|
2818
|
+
var proto = _getPrototype(value);
|
|
2819
|
+
if (proto === null) {
|
|
2820
|
+
return true;
|
|
2821
|
+
}
|
|
2822
|
+
var Ctor = hasOwnProperty$3.call(proto, 'constructor') && proto.constructor;
|
|
2823
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
2824
|
+
}
|
|
2825
|
+
var isPlainObject_1 = isPlainObject;
|
|
2826
|
+
|
|
2827
|
+
/** `Object#toString` result references. */
|
|
2828
|
+
var argsTag = '[object Arguments]',
|
|
2829
|
+
arrayTag = '[object Array]',
|
|
2830
|
+
boolTag = '[object Boolean]',
|
|
2831
|
+
dateTag = '[object Date]',
|
|
2832
|
+
errorTag = '[object Error]',
|
|
2833
|
+
funcTag = '[object Function]',
|
|
2834
|
+
mapTag = '[object Map]',
|
|
2835
|
+
numberTag = '[object Number]',
|
|
2836
|
+
objectTag = '[object Object]',
|
|
2837
|
+
regexpTag = '[object RegExp]',
|
|
2838
|
+
setTag = '[object Set]',
|
|
2839
|
+
stringTag = '[object String]',
|
|
2840
|
+
weakMapTag = '[object WeakMap]';
|
|
2841
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2842
|
+
dataViewTag = '[object DataView]',
|
|
2843
|
+
float32Tag = '[object Float32Array]',
|
|
2844
|
+
float64Tag = '[object Float64Array]',
|
|
2845
|
+
int8Tag = '[object Int8Array]',
|
|
2846
|
+
int16Tag = '[object Int16Array]',
|
|
2847
|
+
int32Tag = '[object Int32Array]',
|
|
2848
|
+
uint8Tag = '[object Uint8Array]',
|
|
2849
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
2850
|
+
uint16Tag = '[object Uint16Array]',
|
|
2851
|
+
uint32Tag = '[object Uint32Array]';
|
|
2852
|
+
|
|
2853
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
2854
|
+
var typedArrayTags = {};
|
|
2855
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
2856
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
|
2857
|
+
|
|
2858
|
+
/**
|
|
2859
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
2860
|
+
*
|
|
2861
|
+
* @private
|
|
2862
|
+
* @param {*} value The value to check.
|
|
2863
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
2864
|
+
*/
|
|
2865
|
+
function baseIsTypedArray(value) {
|
|
2866
|
+
return isObjectLike_1(value) && isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
|
|
2867
|
+
}
|
|
2868
|
+
var _baseIsTypedArray = baseIsTypedArray;
|
|
2869
|
+
|
|
2870
|
+
/**
|
|
2871
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
2872
|
+
*
|
|
2873
|
+
* @private
|
|
2874
|
+
* @param {Function} func The function to cap arguments for.
|
|
2875
|
+
* @returns {Function} Returns the new capped function.
|
|
2876
|
+
*/
|
|
2877
|
+
function baseUnary(func) {
|
|
2878
|
+
return function (value) {
|
|
2879
|
+
return func(value);
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
var _baseUnary = baseUnary;
|
|
2883
|
+
|
|
2884
|
+
var _nodeUtil = createCommonjsModule(function (module, exports) {
|
|
2885
|
+
/** Detect free variable `exports`. */
|
|
2886
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
2887
|
+
|
|
2888
|
+
/** Detect free variable `module`. */
|
|
2889
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
2890
|
+
|
|
2891
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
2892
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2893
|
+
|
|
2894
|
+
/** Detect free variable `process` from Node.js. */
|
|
2895
|
+
var freeProcess = moduleExports && _freeGlobal.process;
|
|
2896
|
+
|
|
2897
|
+
/** Used to access faster Node.js helpers. */
|
|
2898
|
+
var nodeUtil = function () {
|
|
2899
|
+
try {
|
|
2900
|
+
// Use `util.types` for Node.js 10+.
|
|
2901
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
2902
|
+
if (types) {
|
|
2903
|
+
return types;
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
2907
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
2908
|
+
} catch (e) {}
|
|
2909
|
+
}();
|
|
2910
|
+
module.exports = nodeUtil;
|
|
2911
|
+
});
|
|
2912
|
+
|
|
2913
|
+
/* Node.js helper references. */
|
|
2914
|
+
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
|
|
2915
|
+
|
|
2916
|
+
/**
|
|
2917
|
+
* Checks if `value` is classified as a typed array.
|
|
2918
|
+
*
|
|
2919
|
+
* @static
|
|
2920
|
+
* @memberOf _
|
|
2921
|
+
* @since 3.0.0
|
|
2922
|
+
* @category Lang
|
|
2923
|
+
* @param {*} value The value to check.
|
|
2924
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
2925
|
+
* @example
|
|
2926
|
+
*
|
|
2927
|
+
* _.isTypedArray(new Uint8Array);
|
|
2928
|
+
* // => true
|
|
2929
|
+
*
|
|
2930
|
+
* _.isTypedArray([]);
|
|
2931
|
+
* // => false
|
|
2932
|
+
*/
|
|
2933
|
+
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
|
|
2934
|
+
var isTypedArray_1 = isTypedArray;
|
|
2935
|
+
|
|
2936
|
+
/**
|
|
2937
|
+
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
|
|
2938
|
+
*
|
|
2939
|
+
* @private
|
|
2940
|
+
* @param {Object} object The object to query.
|
|
2941
|
+
* @param {string} key The key of the property to get.
|
|
2942
|
+
* @returns {*} Returns the property value.
|
|
2943
|
+
*/
|
|
2944
|
+
function safeGet(object, key) {
|
|
2945
|
+
if (key === 'constructor' && typeof object[key] === 'function') {
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
2948
|
+
if (key == '__proto__') {
|
|
2949
|
+
return;
|
|
2950
|
+
}
|
|
2951
|
+
return object[key];
|
|
2952
|
+
}
|
|
2953
|
+
var _safeGet = safeGet;
|
|
2954
|
+
|
|
2955
|
+
/** Used for built-in method references. */
|
|
2956
|
+
var objectProto$2 = Object.prototype;
|
|
2957
|
+
|
|
2958
|
+
/** Used to check objects for own properties. */
|
|
2959
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
2963
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
2964
|
+
* for equality comparisons.
|
|
2965
|
+
*
|
|
2966
|
+
* @private
|
|
2967
|
+
* @param {Object} object The object to modify.
|
|
2968
|
+
* @param {string} key The key of the property to assign.
|
|
2969
|
+
* @param {*} value The value to assign.
|
|
2970
|
+
*/
|
|
2971
|
+
function assignValue(object, key, value) {
|
|
2972
|
+
var objValue = object[key];
|
|
2973
|
+
if (!(hasOwnProperty$2.call(object, key) && eq_1(objValue, value)) || value === undefined && !(key in object)) {
|
|
2974
|
+
_baseAssignValue(object, key, value);
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
var _assignValue = assignValue;
|
|
2978
|
+
|
|
2979
|
+
/**
|
|
2980
|
+
* Copies properties of `source` to `object`.
|
|
2981
|
+
*
|
|
2982
|
+
* @private
|
|
2983
|
+
* @param {Object} source The object to copy properties from.
|
|
2984
|
+
* @param {Array} props The property identifiers to copy.
|
|
2985
|
+
* @param {Object} [object={}] The object to copy properties to.
|
|
2986
|
+
* @param {Function} [customizer] The function to customize copied values.
|
|
2987
|
+
* @returns {Object} Returns `object`.
|
|
2988
|
+
*/
|
|
2989
|
+
function copyObject(source, props, object, customizer) {
|
|
2990
|
+
var isNew = !object;
|
|
2991
|
+
object || (object = {});
|
|
2992
|
+
var index = -1,
|
|
2993
|
+
length = props.length;
|
|
2994
|
+
while (++index < length) {
|
|
2995
|
+
var key = props[index];
|
|
2996
|
+
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
|
|
2997
|
+
if (newValue === undefined) {
|
|
2998
|
+
newValue = source[key];
|
|
2999
|
+
}
|
|
3000
|
+
if (isNew) {
|
|
3001
|
+
_baseAssignValue(object, key, newValue);
|
|
3002
|
+
} else {
|
|
3003
|
+
_assignValue(object, key, newValue);
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
return object;
|
|
3007
|
+
}
|
|
3008
|
+
var _copyObject = copyObject;
|
|
3009
|
+
|
|
3010
|
+
/**
|
|
3011
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
3012
|
+
* or max array length checks.
|
|
3013
|
+
*
|
|
3014
|
+
* @private
|
|
3015
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
3016
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
3017
|
+
* @returns {Array} Returns the array of results.
|
|
3018
|
+
*/
|
|
3019
|
+
function baseTimes(n, iteratee) {
|
|
3020
|
+
var index = -1,
|
|
3021
|
+
result = Array(n);
|
|
3022
|
+
while (++index < n) {
|
|
3023
|
+
result[index] = iteratee(index);
|
|
3024
|
+
}
|
|
3025
|
+
return result;
|
|
3026
|
+
}
|
|
3027
|
+
var _baseTimes = baseTimes;
|
|
3028
|
+
|
|
3029
|
+
/** Used as references for various `Number` constants. */
|
|
3030
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
3031
|
+
|
|
3032
|
+
/** Used to detect unsigned integer values. */
|
|
3033
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
3034
|
+
|
|
3035
|
+
/**
|
|
3036
|
+
* Checks if `value` is a valid array-like index.
|
|
3037
|
+
*
|
|
3038
|
+
* @private
|
|
3039
|
+
* @param {*} value The value to check.
|
|
3040
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
3041
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
3042
|
+
*/
|
|
3043
|
+
function isIndex(value, length) {
|
|
3044
|
+
var type = typeof value;
|
|
3045
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
3046
|
+
return !!length && (type == 'number' || type != 'symbol' && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
|
|
3047
|
+
}
|
|
3048
|
+
var _isIndex = isIndex;
|
|
3049
|
+
|
|
3050
|
+
/** Used for built-in method references. */
|
|
3051
|
+
var objectProto$1 = Object.prototype;
|
|
3052
|
+
|
|
3053
|
+
/** Used to check objects for own properties. */
|
|
3054
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
3055
|
+
|
|
3056
|
+
/**
|
|
3057
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
3058
|
+
*
|
|
3059
|
+
* @private
|
|
3060
|
+
* @param {*} value The value to query.
|
|
3061
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
3062
|
+
* @returns {Array} Returns the array of property names.
|
|
3063
|
+
*/
|
|
3064
|
+
function arrayLikeKeys(value, inherited) {
|
|
3065
|
+
var isArr = isArray_1(value),
|
|
3066
|
+
isArg = !isArr && isArguments_1(value),
|
|
3067
|
+
isBuff = !isArr && !isArg && isBuffer_1(value),
|
|
3068
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
|
|
3069
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
3070
|
+
result = skipIndexes ? _baseTimes(value.length, String) : [],
|
|
3071
|
+
length = result.length;
|
|
3072
|
+
for (var key in value) {
|
|
3073
|
+
if ((inherited || hasOwnProperty$1.call(value, key)) && !(skipIndexes && (
|
|
3074
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
3075
|
+
key == 'length' ||
|
|
3076
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
3077
|
+
isBuff && (key == 'offset' || key == 'parent') ||
|
|
3078
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
3079
|
+
isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
|
|
3080
|
+
// Skip index properties.
|
|
3081
|
+
_isIndex(key, length)))) {
|
|
3082
|
+
result.push(key);
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
return result;
|
|
3086
|
+
}
|
|
3087
|
+
var _arrayLikeKeys = arrayLikeKeys;
|
|
3088
|
+
|
|
3089
|
+
/**
|
|
3090
|
+
* This function is like
|
|
3091
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
3092
|
+
* except that it includes inherited enumerable properties.
|
|
3093
|
+
*
|
|
3094
|
+
* @private
|
|
3095
|
+
* @param {Object} object The object to query.
|
|
3096
|
+
* @returns {Array} Returns the array of property names.
|
|
3097
|
+
*/
|
|
3098
|
+
function nativeKeysIn(object) {
|
|
3099
|
+
var result = [];
|
|
3100
|
+
if (object != null) {
|
|
3101
|
+
for (var key in Object(object)) {
|
|
3102
|
+
result.push(key);
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
return result;
|
|
3106
|
+
}
|
|
3107
|
+
var _nativeKeysIn = nativeKeysIn;
|
|
3108
|
+
|
|
3109
|
+
/** Used for built-in method references. */
|
|
3110
|
+
var objectProto = Object.prototype;
|
|
3111
|
+
|
|
3112
|
+
/** Used to check objects for own properties. */
|
|
3113
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
3114
|
+
|
|
3115
|
+
/**
|
|
3116
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
3117
|
+
*
|
|
3118
|
+
* @private
|
|
3119
|
+
* @param {Object} object The object to query.
|
|
3120
|
+
* @returns {Array} Returns the array of property names.
|
|
3121
|
+
*/
|
|
3122
|
+
function baseKeysIn(object) {
|
|
3123
|
+
if (!isObject_1(object)) {
|
|
3124
|
+
return _nativeKeysIn(object);
|
|
3125
|
+
}
|
|
3126
|
+
var isProto = _isPrototype(object),
|
|
3127
|
+
result = [];
|
|
3128
|
+
for (var key in object) {
|
|
3129
|
+
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
|
3130
|
+
result.push(key);
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
return result;
|
|
3134
|
+
}
|
|
3135
|
+
var _baseKeysIn = baseKeysIn;
|
|
3136
|
+
|
|
3137
|
+
/**
|
|
3138
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
3139
|
+
*
|
|
3140
|
+
* **Note:** Non-object values are coerced to objects.
|
|
3141
|
+
*
|
|
3142
|
+
* @static
|
|
3143
|
+
* @memberOf _
|
|
3144
|
+
* @since 3.0.0
|
|
3145
|
+
* @category Object
|
|
3146
|
+
* @param {Object} object The object to query.
|
|
3147
|
+
* @returns {Array} Returns the array of property names.
|
|
3148
|
+
* @example
|
|
3149
|
+
*
|
|
3150
|
+
* function Foo() {
|
|
3151
|
+
* this.a = 1;
|
|
3152
|
+
* this.b = 2;
|
|
3153
|
+
* }
|
|
3154
|
+
*
|
|
3155
|
+
* Foo.prototype.c = 3;
|
|
3156
|
+
*
|
|
3157
|
+
* _.keysIn(new Foo);
|
|
3158
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
3159
|
+
*/
|
|
3160
|
+
function keysIn(object) {
|
|
3161
|
+
return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
|
|
3162
|
+
}
|
|
3163
|
+
var keysIn_1 = keysIn;
|
|
3164
|
+
|
|
3165
|
+
/**
|
|
3166
|
+
* Converts `value` to a plain object flattening inherited enumerable string
|
|
3167
|
+
* keyed properties of `value` to own properties of the plain object.
|
|
3168
|
+
*
|
|
3169
|
+
* @static
|
|
3170
|
+
* @memberOf _
|
|
3171
|
+
* @since 3.0.0
|
|
3172
|
+
* @category Lang
|
|
3173
|
+
* @param {*} value The value to convert.
|
|
3174
|
+
* @returns {Object} Returns the converted plain object.
|
|
3175
|
+
* @example
|
|
3176
|
+
*
|
|
3177
|
+
* function Foo() {
|
|
3178
|
+
* this.b = 2;
|
|
3179
|
+
* }
|
|
3180
|
+
*
|
|
3181
|
+
* Foo.prototype.c = 3;
|
|
3182
|
+
*
|
|
3183
|
+
* _.assign({ 'a': 1 }, new Foo);
|
|
3184
|
+
* // => { 'a': 1, 'b': 2 }
|
|
3185
|
+
*
|
|
3186
|
+
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
|
3187
|
+
* // => { 'a': 1, 'b': 2, 'c': 3 }
|
|
3188
|
+
*/
|
|
3189
|
+
function toPlainObject(value) {
|
|
3190
|
+
return _copyObject(value, keysIn_1(value));
|
|
3191
|
+
}
|
|
3192
|
+
var toPlainObject_1 = toPlainObject;
|
|
3193
|
+
|
|
3194
|
+
/**
|
|
3195
|
+
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
3196
|
+
* deep merges and tracks traversed objects enabling objects with circular
|
|
3197
|
+
* references to be merged.
|
|
3198
|
+
*
|
|
3199
|
+
* @private
|
|
3200
|
+
* @param {Object} object The destination object.
|
|
3201
|
+
* @param {Object} source The source object.
|
|
3202
|
+
* @param {string} key The key of the value to merge.
|
|
3203
|
+
* @param {number} srcIndex The index of `source`.
|
|
3204
|
+
* @param {Function} mergeFunc The function to merge values.
|
|
3205
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
|
3206
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
3207
|
+
* counterparts.
|
|
3208
|
+
*/
|
|
3209
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
3210
|
+
var objValue = _safeGet(object, key),
|
|
3211
|
+
srcValue = _safeGet(source, key),
|
|
3212
|
+
stacked = stack.get(srcValue);
|
|
3213
|
+
if (stacked) {
|
|
3214
|
+
_assignMergeValue(object, key, stacked);
|
|
3215
|
+
return;
|
|
3216
|
+
}
|
|
3217
|
+
var newValue = customizer ? customizer(objValue, srcValue, key + '', object, source, stack) : undefined;
|
|
3218
|
+
var isCommon = newValue === undefined;
|
|
3219
|
+
if (isCommon) {
|
|
3220
|
+
var isArr = isArray_1(srcValue),
|
|
3221
|
+
isBuff = !isArr && isBuffer_1(srcValue),
|
|
3222
|
+
isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
|
|
3223
|
+
newValue = srcValue;
|
|
3224
|
+
if (isArr || isBuff || isTyped) {
|
|
3225
|
+
if (isArray_1(objValue)) {
|
|
3226
|
+
newValue = objValue;
|
|
3227
|
+
} else if (isArrayLikeObject_1(objValue)) {
|
|
3228
|
+
newValue = _copyArray(objValue);
|
|
3229
|
+
} else if (isBuff) {
|
|
3230
|
+
isCommon = false;
|
|
3231
|
+
newValue = _cloneBuffer(srcValue, true);
|
|
3232
|
+
} else if (isTyped) {
|
|
3233
|
+
isCommon = false;
|
|
3234
|
+
newValue = _cloneTypedArray(srcValue, true);
|
|
3235
|
+
} else {
|
|
3236
|
+
newValue = [];
|
|
3237
|
+
}
|
|
3238
|
+
} else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
|
|
3239
|
+
newValue = objValue;
|
|
3240
|
+
if (isArguments_1(objValue)) {
|
|
3241
|
+
newValue = toPlainObject_1(objValue);
|
|
3242
|
+
} else if (!isObject_1(objValue) || isFunction_1(objValue)) {
|
|
3243
|
+
newValue = _initCloneObject(srcValue);
|
|
3244
|
+
}
|
|
3245
|
+
} else {
|
|
3246
|
+
isCommon = false;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
if (isCommon) {
|
|
3250
|
+
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
3251
|
+
stack.set(srcValue, newValue);
|
|
3252
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
3253
|
+
stack['delete'](srcValue);
|
|
3254
|
+
}
|
|
3255
|
+
_assignMergeValue(object, key, newValue);
|
|
3256
|
+
}
|
|
3257
|
+
var _baseMergeDeep = baseMergeDeep;
|
|
3258
|
+
|
|
3259
|
+
/**
|
|
3260
|
+
* The base implementation of `_.merge` without support for multiple sources.
|
|
3261
|
+
*
|
|
3262
|
+
* @private
|
|
3263
|
+
* @param {Object} object The destination object.
|
|
3264
|
+
* @param {Object} source The source object.
|
|
3265
|
+
* @param {number} srcIndex The index of `source`.
|
|
3266
|
+
* @param {Function} [customizer] The function to customize merged values.
|
|
3267
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
3268
|
+
* counterparts.
|
|
3269
|
+
*/
|
|
3270
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
3271
|
+
if (object === source) {
|
|
3272
|
+
return;
|
|
3273
|
+
}
|
|
3274
|
+
_baseFor(source, function (srcValue, key) {
|
|
3275
|
+
stack || (stack = new _Stack());
|
|
3276
|
+
if (isObject_1(srcValue)) {
|
|
3277
|
+
_baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
3278
|
+
} else {
|
|
3279
|
+
var newValue = customizer ? customizer(_safeGet(object, key), srcValue, key + '', object, source, stack) : undefined;
|
|
3280
|
+
if (newValue === undefined) {
|
|
3281
|
+
newValue = srcValue;
|
|
3282
|
+
}
|
|
3283
|
+
_assignMergeValue(object, key, newValue);
|
|
3284
|
+
}
|
|
3285
|
+
}, keysIn_1);
|
|
3286
|
+
}
|
|
3287
|
+
var _baseMerge = baseMerge;
|
|
3288
|
+
|
|
3289
|
+
/**
|
|
3290
|
+
* This method returns the first argument it receives.
|
|
3291
|
+
*
|
|
3292
|
+
* @static
|
|
3293
|
+
* @since 0.1.0
|
|
3294
|
+
* @memberOf _
|
|
3295
|
+
* @category Util
|
|
3296
|
+
* @param {*} value Any value.
|
|
3297
|
+
* @returns {*} Returns `value`.
|
|
3298
|
+
* @example
|
|
3299
|
+
*
|
|
3300
|
+
* var object = { 'a': 1 };
|
|
3301
|
+
*
|
|
3302
|
+
* console.log(_.identity(object) === object);
|
|
3303
|
+
* // => true
|
|
3304
|
+
*/
|
|
3305
|
+
function identity(value) {
|
|
3306
|
+
return value;
|
|
3307
|
+
}
|
|
3308
|
+
var identity_1 = identity;
|
|
3309
|
+
|
|
3310
|
+
/**
|
|
3311
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
3312
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
3313
|
+
*
|
|
3314
|
+
* @private
|
|
3315
|
+
* @param {Function} func The function to invoke.
|
|
3316
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
3317
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
3318
|
+
* @returns {*} Returns the result of `func`.
|
|
3319
|
+
*/
|
|
3320
|
+
function apply(func, thisArg, args) {
|
|
3321
|
+
switch (args.length) {
|
|
3322
|
+
case 0:
|
|
3323
|
+
return func.call(thisArg);
|
|
3324
|
+
case 1:
|
|
3325
|
+
return func.call(thisArg, args[0]);
|
|
3326
|
+
case 2:
|
|
3327
|
+
return func.call(thisArg, args[0], args[1]);
|
|
3328
|
+
case 3:
|
|
3329
|
+
return func.call(thisArg, args[0], args[1], args[2]);
|
|
3330
|
+
}
|
|
3331
|
+
return func.apply(thisArg, args);
|
|
3332
|
+
}
|
|
3333
|
+
var _apply = apply;
|
|
3334
|
+
|
|
3335
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3336
|
+
var nativeMax = Math.max;
|
|
3337
|
+
|
|
3338
|
+
/**
|
|
3339
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
3340
|
+
*
|
|
3341
|
+
* @private
|
|
3342
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
3343
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
3344
|
+
* @param {Function} transform The rest array transform.
|
|
3345
|
+
* @returns {Function} Returns the new function.
|
|
3346
|
+
*/
|
|
3347
|
+
function overRest(func, start, transform) {
|
|
3348
|
+
start = nativeMax(start === undefined ? func.length - 1 : start, 0);
|
|
3349
|
+
return function () {
|
|
3350
|
+
var args = arguments,
|
|
3351
|
+
index = -1,
|
|
3352
|
+
length = nativeMax(args.length - start, 0),
|
|
3353
|
+
array = Array(length);
|
|
3354
|
+
while (++index < length) {
|
|
3355
|
+
array[index] = args[start + index];
|
|
3356
|
+
}
|
|
3357
|
+
index = -1;
|
|
3358
|
+
var otherArgs = Array(start + 1);
|
|
3359
|
+
while (++index < start) {
|
|
3360
|
+
otherArgs[index] = args[index];
|
|
3361
|
+
}
|
|
3362
|
+
otherArgs[start] = transform(array);
|
|
3363
|
+
return _apply(func, this, otherArgs);
|
|
3364
|
+
};
|
|
3365
|
+
}
|
|
3366
|
+
var _overRest = overRest;
|
|
3367
|
+
|
|
3368
|
+
/**
|
|
3369
|
+
* Creates a function that returns `value`.
|
|
3370
|
+
*
|
|
3371
|
+
* @static
|
|
3372
|
+
* @memberOf _
|
|
3373
|
+
* @since 2.4.0
|
|
3374
|
+
* @category Util
|
|
3375
|
+
* @param {*} value The value to return from the new function.
|
|
3376
|
+
* @returns {Function} Returns the new constant function.
|
|
3377
|
+
* @example
|
|
3378
|
+
*
|
|
3379
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
3380
|
+
*
|
|
3381
|
+
* console.log(objects);
|
|
3382
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
3383
|
+
*
|
|
3384
|
+
* console.log(objects[0] === objects[1]);
|
|
3385
|
+
* // => true
|
|
3386
|
+
*/
|
|
3387
|
+
function constant(value) {
|
|
3388
|
+
return function () {
|
|
3389
|
+
return value;
|
|
3390
|
+
};
|
|
3391
|
+
}
|
|
3392
|
+
var constant_1 = constant;
|
|
3393
|
+
|
|
3394
|
+
/**
|
|
3395
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
3396
|
+
*
|
|
3397
|
+
* @private
|
|
3398
|
+
* @param {Function} func The function to modify.
|
|
3399
|
+
* @param {Function} string The `toString` result.
|
|
3400
|
+
* @returns {Function} Returns `func`.
|
|
3401
|
+
*/
|
|
3402
|
+
var baseSetToString = !_defineProperty ? identity_1 : function (func, string) {
|
|
3403
|
+
return _defineProperty(func, 'toString', {
|
|
3404
|
+
'configurable': true,
|
|
3405
|
+
'enumerable': false,
|
|
3406
|
+
'value': constant_1(string),
|
|
3407
|
+
'writable': true
|
|
3408
|
+
});
|
|
3409
|
+
};
|
|
3410
|
+
var _baseSetToString = baseSetToString;
|
|
3411
|
+
|
|
3412
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
3413
|
+
var HOT_COUNT = 800,
|
|
3414
|
+
HOT_SPAN = 16;
|
|
3415
|
+
|
|
3416
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3417
|
+
var nativeNow = Date.now;
|
|
3418
|
+
|
|
3419
|
+
/**
|
|
3420
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
3421
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
3422
|
+
* milliseconds.
|
|
3423
|
+
*
|
|
3424
|
+
* @private
|
|
3425
|
+
* @param {Function} func The function to restrict.
|
|
3426
|
+
* @returns {Function} Returns the new shortable function.
|
|
3427
|
+
*/
|
|
3428
|
+
function shortOut(func) {
|
|
3429
|
+
var count = 0,
|
|
3430
|
+
lastCalled = 0;
|
|
3431
|
+
return function () {
|
|
3432
|
+
var stamp = nativeNow(),
|
|
3433
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
3434
|
+
lastCalled = stamp;
|
|
3435
|
+
if (remaining > 0) {
|
|
3436
|
+
if (++count >= HOT_COUNT) {
|
|
3437
|
+
return arguments[0];
|
|
3438
|
+
}
|
|
3439
|
+
} else {
|
|
3440
|
+
count = 0;
|
|
3441
|
+
}
|
|
3442
|
+
return func.apply(undefined, arguments);
|
|
3443
|
+
};
|
|
3444
|
+
}
|
|
3445
|
+
var _shortOut = shortOut;
|
|
3446
|
+
|
|
3447
|
+
/**
|
|
3448
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
3449
|
+
*
|
|
3450
|
+
* @private
|
|
3451
|
+
* @param {Function} func The function to modify.
|
|
3452
|
+
* @param {Function} string The `toString` result.
|
|
3453
|
+
* @returns {Function} Returns `func`.
|
|
3454
|
+
*/
|
|
3455
|
+
var setToString = _shortOut(_baseSetToString);
|
|
3456
|
+
var _setToString = setToString;
|
|
3457
|
+
|
|
3458
|
+
/**
|
|
3459
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
3460
|
+
*
|
|
3461
|
+
* @private
|
|
3462
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
3463
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
3464
|
+
* @returns {Function} Returns the new function.
|
|
3465
|
+
*/
|
|
3466
|
+
function baseRest(func, start) {
|
|
3467
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
3468
|
+
}
|
|
3469
|
+
var _baseRest = baseRest;
|
|
3470
|
+
|
|
3471
|
+
/**
|
|
3472
|
+
* Checks if the given arguments are from an iteratee call.
|
|
3473
|
+
*
|
|
3474
|
+
* @private
|
|
3475
|
+
* @param {*} value The potential iteratee value argument.
|
|
3476
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
3477
|
+
* @param {*} object The potential iteratee object argument.
|
|
3478
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
3479
|
+
* else `false`.
|
|
3480
|
+
*/
|
|
3481
|
+
function isIterateeCall(value, index, object) {
|
|
3482
|
+
if (!isObject_1(object)) {
|
|
3483
|
+
return false;
|
|
3484
|
+
}
|
|
3485
|
+
var type = typeof index;
|
|
3486
|
+
if (type == 'number' ? isArrayLike_1(object) && _isIndex(index, object.length) : type == 'string' && index in object) {
|
|
3487
|
+
return eq_1(object[index], value);
|
|
3488
|
+
}
|
|
3489
|
+
return false;
|
|
3490
|
+
}
|
|
3491
|
+
var _isIterateeCall = isIterateeCall;
|
|
3492
|
+
|
|
3493
|
+
/**
|
|
3494
|
+
* Creates a function like `_.assign`.
|
|
3495
|
+
*
|
|
3496
|
+
* @private
|
|
3497
|
+
* @param {Function} assigner The function to assign values.
|
|
3498
|
+
* @returns {Function} Returns the new assigner function.
|
|
3499
|
+
*/
|
|
3500
|
+
function createAssigner(assigner) {
|
|
3501
|
+
return _baseRest(function (object, sources) {
|
|
3502
|
+
var index = -1,
|
|
3503
|
+
length = sources.length,
|
|
3504
|
+
customizer = length > 1 ? sources[length - 1] : undefined,
|
|
3505
|
+
guard = length > 2 ? sources[2] : undefined;
|
|
3506
|
+
customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined;
|
|
3507
|
+
if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
|
|
3508
|
+
customizer = length < 3 ? undefined : customizer;
|
|
3509
|
+
length = 1;
|
|
3510
|
+
}
|
|
3511
|
+
object = Object(object);
|
|
3512
|
+
while (++index < length) {
|
|
3513
|
+
var source = sources[index];
|
|
3514
|
+
if (source) {
|
|
3515
|
+
assigner(object, source, index, customizer);
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
return object;
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
var _createAssigner = createAssigner;
|
|
3522
|
+
|
|
3523
|
+
/**
|
|
3524
|
+
* This method is like `_.merge` except that it accepts `customizer` which
|
|
3525
|
+
* is invoked to produce the merged values of the destination and source
|
|
3526
|
+
* properties. If `customizer` returns `undefined`, merging is handled by the
|
|
3527
|
+
* method instead. The `customizer` is invoked with six arguments:
|
|
3528
|
+
* (objValue, srcValue, key, object, source, stack).
|
|
3529
|
+
*
|
|
3530
|
+
* **Note:** This method mutates `object`.
|
|
3531
|
+
*
|
|
3532
|
+
* @static
|
|
3533
|
+
* @memberOf _
|
|
3534
|
+
* @since 4.0.0
|
|
3535
|
+
* @category Object
|
|
3536
|
+
* @param {Object} object The destination object.
|
|
3537
|
+
* @param {...Object} sources The source objects.
|
|
3538
|
+
* @param {Function} customizer The function to customize assigned values.
|
|
3539
|
+
* @returns {Object} Returns `object`.
|
|
3540
|
+
* @example
|
|
3541
|
+
*
|
|
3542
|
+
* function customizer(objValue, srcValue) {
|
|
3543
|
+
* if (_.isArray(objValue)) {
|
|
3544
|
+
* return objValue.concat(srcValue);
|
|
3545
|
+
* }
|
|
3546
|
+
* }
|
|
3547
|
+
*
|
|
3548
|
+
* var object = { 'a': [1], 'b': [2] };
|
|
3549
|
+
* var other = { 'a': [3], 'b': [4] };
|
|
3550
|
+
*
|
|
3551
|
+
* _.mergeWith(object, other, customizer);
|
|
3552
|
+
* // => { 'a': [1, 3], 'b': [2, 4] }
|
|
3553
|
+
*/
|
|
3554
|
+
var mergeWith = _createAssigner(function (object, source, srcIndex, customizer) {
|
|
3555
|
+
_baseMerge(object, source, srcIndex, customizer);
|
|
3556
|
+
});
|
|
3557
|
+
var mergeWith_1 = mergeWith;
|
|
3558
|
+
var mergeWith$1 = mergeWith_1;
|
|
3559
|
+
|
|
3560
|
+
/**
|
|
3561
|
+
* merge-props.js
|
|
3562
|
+
*
|
|
3563
|
+
* Forked from reactabular-table version 8.14.0
|
|
3564
|
+
* https://github.com/reactabular/reactabular/tree/v8.14.0/packages/reactabular-table/src
|
|
3565
|
+
*/
|
|
3566
|
+
/**
|
|
3567
|
+
* @param {any} props - Props
|
|
3568
|
+
*/
|
|
3569
|
+
function mergeProps(...props) {
|
|
3570
|
+
const firstProps = props[0];
|
|
3571
|
+
const restProps = props.slice(1);
|
|
3572
|
+
if (!restProps.length) {
|
|
3573
|
+
return mergeWith$1({}, firstProps);
|
|
3574
|
+
}
|
|
3575
|
+
// Avoid mutating the first prop collection
|
|
3576
|
+
return mergeWith$1(mergeWith$1({}, firstProps), ...restProps, (a, b, key) => {
|
|
3577
|
+
if (key === 'children') {
|
|
3578
|
+
if (a && b) {
|
|
3579
|
+
// compose the two
|
|
3580
|
+
return React.cloneElement(a, {
|
|
3581
|
+
children: b
|
|
3582
|
+
});
|
|
3583
|
+
}
|
|
3584
|
+
// Children have to be merged in reverse order for Reactabular
|
|
3585
|
+
// logic to work.
|
|
3586
|
+
return Object.assign(Object.assign({}, b), a);
|
|
3587
|
+
}
|
|
3588
|
+
if (key === 'className') {
|
|
3589
|
+
// Process class names through classNames to merge properly
|
|
3590
|
+
// as a string.
|
|
3591
|
+
return css(a, b);
|
|
3592
|
+
}
|
|
3593
|
+
return undefined;
|
|
3594
|
+
});
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3597
|
+
const c_table__sticky_cell_MinWidth = {
|
|
3598
|
+
"name": "--pf-v5-c-table__sticky-cell--MinWidth",
|
|
3599
|
+
"value": "12.5rem",
|
|
3600
|
+
"var": "var(--pf-v5-c-table__sticky-cell--MinWidth)"
|
|
3601
|
+
};
|
|
3602
|
+
var cssStickyCellMinWidth = c_table__sticky_cell_MinWidth;
|
|
3603
|
+
|
|
3604
|
+
const c_table__sticky_cell_Left = {
|
|
3605
|
+
"name": "--pf-v5-c-table__sticky-cell--Left",
|
|
3606
|
+
"value": "0",
|
|
3607
|
+
"var": "var(--pf-v5-c-table__sticky-cell--Left)"
|
|
3608
|
+
};
|
|
3609
|
+
var cssStickyCellLeft = c_table__sticky_cell_Left;
|
|
3610
|
+
|
|
3611
|
+
const c_table__sticky_cell_Right = {
|
|
3612
|
+
"name": "--pf-v5-c-table__sticky-cell--Right",
|
|
3613
|
+
"value": "0",
|
|
3614
|
+
"var": "var(--pf-v5-c-table__sticky-cell--Right)"
|
|
3615
|
+
};
|
|
3616
|
+
var cssStickyCellRight = c_table__sticky_cell_Right;
|
|
3617
|
+
|
|
3618
|
+
const ThBase = _a => {
|
|
3619
|
+
var {
|
|
3620
|
+
children,
|
|
3621
|
+
className,
|
|
3622
|
+
component = 'th',
|
|
3623
|
+
dataLabel,
|
|
3624
|
+
scope = 'col',
|
|
3625
|
+
textCenter = false,
|
|
3626
|
+
sort = null,
|
|
3627
|
+
modifier,
|
|
3628
|
+
select = null,
|
|
3629
|
+
expand: collapse = null,
|
|
3630
|
+
tooltip = '',
|
|
3631
|
+
tooltipProps,
|
|
3632
|
+
onMouseEnter: onMouseEnterProp = () => {},
|
|
3633
|
+
width,
|
|
3634
|
+
visibility,
|
|
3635
|
+
innerRef,
|
|
3636
|
+
info: infoProps,
|
|
3637
|
+
isStickyColumn = false,
|
|
3638
|
+
hasRightBorder = false,
|
|
3639
|
+
hasLeftBorder = false,
|
|
3640
|
+
stickyMinWidth = '120px',
|
|
3641
|
+
stickyLeftOffset,
|
|
3642
|
+
stickyRightOffset,
|
|
3643
|
+
isSubheader = false,
|
|
3644
|
+
screenReaderText,
|
|
3645
|
+
'aria-label': ariaLabel
|
|
3646
|
+
} = _a,
|
|
3647
|
+
props = __rest(_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']);
|
|
3648
|
+
if (!children && !screenReaderText && !ariaLabel) {
|
|
3649
|
+
// eslint-disable-next-line no-console
|
|
3650
|
+
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.');
|
|
3651
|
+
}
|
|
1626
3652
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
1627
3653
|
const [truncated, setTruncated] = React.useState(false);
|
|
1628
3654
|
const cellRef = innerRef ? innerRef : React.createRef();
|
|
1629
|
-
|
|
1630
3655
|
const onMouseEnter = event => {
|
|
1631
3656
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1632
3657
|
!showTooltip && setShowTooltip(true);
|
|
1633
3658
|
} else {
|
|
1634
3659
|
showTooltip && setShowTooltip(false);
|
|
1635
3660
|
}
|
|
1636
|
-
|
|
1637
3661
|
onMouseEnterProp(event);
|
|
1638
3662
|
};
|
|
1639
|
-
|
|
1640
3663
|
let sortParams = null;
|
|
1641
|
-
|
|
1642
3664
|
if (sort) {
|
|
1643
3665
|
if (sort.isFavorites) {
|
|
1644
3666
|
sortParams = sortableFavorites({
|
|
@@ -1662,7 +3684,6 @@ const ThBase = _a => {
|
|
|
1662
3684
|
});
|
|
1663
3685
|
}
|
|
1664
3686
|
}
|
|
1665
|
-
|
|
1666
3687
|
const selectParams = select ? selectable(children, {
|
|
1667
3688
|
rowData: {
|
|
1668
3689
|
selected: select.isSelected,
|
|
@@ -1691,29 +3712,25 @@ const ThBase = _a => {
|
|
|
1691
3712
|
}) : null;
|
|
1692
3713
|
const widthParams = width ? cellWidth(width)() : null;
|
|
1693
3714
|
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;
|
|
1695
|
-
|
|
3715
|
+
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;
|
|
3716
|
+
// info can wrap other transformedChildren
|
|
1696
3717
|
let infoParams = null;
|
|
1697
|
-
|
|
1698
3718
|
if (infoProps) {
|
|
1699
3719
|
infoParams = info(infoProps)(transformedChildren);
|
|
1700
3720
|
transformedChildren = infoParams.children;
|
|
1701
3721
|
}
|
|
1702
|
-
|
|
1703
3722
|
const merged = mergeProps(sortParams, selectParams, collapseParams, widthParams, visibilityParams, infoParams);
|
|
1704
|
-
|
|
1705
3723
|
const {
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
3724
|
+
// ignore the merged children since we transform them ourselves so we can wrap it with info
|
|
3725
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3726
|
+
children: mergedChildren = null,
|
|
3727
|
+
// selectable adds this but we don't want it
|
|
3728
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3729
|
+
isVisible = null,
|
|
3730
|
+
className: mergedClassName = '',
|
|
3731
|
+
component: MergedComponent = component
|
|
3732
|
+
} = merged,
|
|
3733
|
+
mergedProps = __rest(merged, ["children", "isVisible", "className", "component"]);
|
|
1717
3734
|
React.useEffect(() => {
|
|
1718
3735
|
setTruncated(cellRef.current.offsetWidth < cellRef.current.scrollWidth);
|
|
1719
3736
|
}, [cellRef]);
|
|
@@ -1744,7 +3761,6 @@ const ThBase = _a => {
|
|
|
1744
3761
|
isVisible: true
|
|
1745
3762
|
}, tooltipProps))) : cell;
|
|
1746
3763
|
};
|
|
1747
|
-
|
|
1748
3764
|
const Th = React.forwardRef((props, ref) => React.createElement(ThBase, Object.assign({}, props, {
|
|
1749
3765
|
innerRef: ref
|
|
1750
3766
|
})));
|
|
@@ -1766,49 +3782,45 @@ const draggable = (value, {
|
|
|
1766
3782
|
|
|
1767
3783
|
const TdBase = _a => {
|
|
1768
3784
|
var {
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
3785
|
+
children,
|
|
3786
|
+
className,
|
|
3787
|
+
isActionCell = false,
|
|
3788
|
+
component = 'td',
|
|
3789
|
+
dataLabel,
|
|
3790
|
+
textCenter = false,
|
|
3791
|
+
modifier,
|
|
3792
|
+
select = null,
|
|
3793
|
+
actions = null,
|
|
3794
|
+
expand = null,
|
|
3795
|
+
treeRow: treeRowProp = null,
|
|
3796
|
+
compoundExpand: compoundExpandProp = null,
|
|
3797
|
+
noPadding,
|
|
3798
|
+
width,
|
|
3799
|
+
visibility,
|
|
3800
|
+
innerRef,
|
|
3801
|
+
favorites = null,
|
|
3802
|
+
draggableRow: draggableRowProp = null,
|
|
3803
|
+
tooltip = '',
|
|
3804
|
+
onMouseEnter: onMouseEnterProp = () => {},
|
|
3805
|
+
isStickyColumn = false,
|
|
3806
|
+
hasRightBorder = false,
|
|
3807
|
+
hasLeftBorder = false,
|
|
3808
|
+
stickyMinWidth = '120px',
|
|
3809
|
+
stickyLeftOffset,
|
|
3810
|
+
stickyRightOffset
|
|
3811
|
+
} = _a,
|
|
3812
|
+
props = __rest(_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"]);
|
|
1798
3813
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
1799
3814
|
const [truncated, setTruncated] = React.useState(false);
|
|
1800
3815
|
const cellRef = innerRef ? innerRef : React.createRef();
|
|
1801
|
-
|
|
1802
3816
|
const onMouseEnter = event => {
|
|
1803
3817
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1804
3818
|
!showTooltip && setShowTooltip(true);
|
|
1805
3819
|
} else {
|
|
1806
3820
|
showTooltip && setShowTooltip(false);
|
|
1807
3821
|
}
|
|
1808
|
-
|
|
1809
3822
|
onMouseEnterProp(event);
|
|
1810
3823
|
};
|
|
1811
|
-
|
|
1812
3824
|
const selectParams = select ? selectable(children, {
|
|
1813
3825
|
rowIndex: select.rowIndex,
|
|
1814
3826
|
rowData: {
|
|
@@ -1894,17 +3906,15 @@ const TdBase = _a => {
|
|
|
1894
3906
|
}
|
|
1895
3907
|
}) : null;
|
|
1896
3908
|
const merged = mergeProps(selectParams, actionParams, expandableParams, compoundParams, widthParams, visibilityParams, favoriteParams, treeRowParams, draggableParams);
|
|
1897
|
-
|
|
1898
3909
|
const {
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
3910
|
+
// selectable adds this but we don't want it
|
|
3911
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3912
|
+
isVisible = null,
|
|
3913
|
+
children: mergedChildren = null,
|
|
3914
|
+
className: mergedClassName = '',
|
|
3915
|
+
component: MergedComponent = component
|
|
3916
|
+
} = merged,
|
|
3917
|
+
mergedProps = __rest(merged, ["isVisible", "children", "className", "component"]);
|
|
1908
3918
|
const treeTableTitleCell = className && className.includes(treeViewStyles.tableTreeViewTitleCell) || mergedClassName && mergedClassName.includes(treeViewStyles.tableTreeViewTitleCell);
|
|
1909
3919
|
React.useEffect(() => {
|
|
1910
3920
|
setTruncated(cellRef.current.offsetWidth < cellRef.current.scrollWidth);
|
|
@@ -1933,7 +3943,6 @@ const TdBase = _a => {
|
|
|
1933
3943
|
isVisible: true
|
|
1934
3944
|
})) : cell;
|
|
1935
3945
|
};
|
|
1936
|
-
|
|
1937
3946
|
const Td = React.forwardRef((props, ref) => React.createElement(TdBase, Object.assign({}, props, {
|
|
1938
3947
|
innerRef: ref
|
|
1939
3948
|
})));
|
|
@@ -1970,70 +3979,68 @@ function FilterableTable({
|
|
|
1970
3979
|
actions,
|
|
1971
3980
|
perPageOptions
|
|
1972
3981
|
}) {
|
|
1973
|
-
|
|
1974
3982
|
const [page, setPage] = useState(DEFAULT_PAGE);
|
|
1975
3983
|
const [perPage, setPerPage] = useState(DEFAULT_PERPAGE );
|
|
1976
3984
|
const [sortTableBy, setSortTableBy] = useState({});
|
|
1977
3985
|
const [rows, setRows] = useState([]);
|
|
1978
3986
|
const [filteredItems, setFilteredItems] = useState(items);
|
|
1979
3987
|
const [tableFilters, setTableFilters] = useState([]);
|
|
1980
|
-
/**
|
|
1981
|
-
* Sorts table by the selected column in ascending or decending order
|
|
1982
|
-
* @param _event click
|
|
1983
|
-
* @param index column index
|
|
1984
|
-
* @param direction asc || desc
|
|
3988
|
+
/**
|
|
3989
|
+
* Sorts table by the selected column in ascending or decending order
|
|
3990
|
+
* @param _event click
|
|
3991
|
+
* @param index column index
|
|
3992
|
+
* @param direction asc || desc
|
|
1985
3993
|
*/
|
|
1986
|
-
|
|
1987
3994
|
const onSort = (_event, index, direction) => {
|
|
1988
3995
|
var _columns$index, _columns$index2;
|
|
1989
|
-
|
|
1990
|
-
const
|
|
1991
|
-
const
|
|
1992
|
-
|
|
3996
|
+
const sortField = columns == null || (_columns$index = columns[index]) == null ? void 0 : _columns$index.sortField;
|
|
3997
|
+
const sortFn = columns == null || (_columns$index2 = columns[index]) == null ? void 0 : _columns$index2.sortFn;
|
|
3998
|
+
const sortedRows = sortFn ? [...filteredItems].sort((a, b) => {
|
|
3999
|
+
const aVal = sortFn(a);
|
|
4000
|
+
const bVal = sortFn(b);
|
|
4001
|
+
return aVal < bVal ? -1 : aVal > bVal ? 1 : 0;
|
|
4002
|
+
}) : sortField ? [...filteredItems].sort((a, b) => {
|
|
4003
|
+
const aVal = a[sortField];
|
|
4004
|
+
const bVal = b[sortField];
|
|
4005
|
+
return aVal < bVal ? -1 : aVal > bVal ? 1 : 0;
|
|
4006
|
+
}) : filteredItems;
|
|
1993
4007
|
setSortTableBy({
|
|
1994
4008
|
index,
|
|
1995
4009
|
direction
|
|
1996
4010
|
});
|
|
1997
4011
|
setFilteredItems(direction === SortByDirection.asc ? [...sortedRows] : [...(sortedRows == null ? void 0 : sortedRows.reverse())]);
|
|
1998
4012
|
};
|
|
1999
|
-
/**
|
|
2000
|
-
* Set table rows to display based on current list of filtered items, page, and perPage settings
|
|
4013
|
+
/**
|
|
4014
|
+
* Set table rows to display based on current list of filtered items, page, and perPage settings
|
|
2001
4015
|
*/
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
4016
|
useEffect(() => {
|
|
2005
4017
|
const startIndex = (page - 1) * perPage;
|
|
2006
4018
|
const endIndex = startIndex + perPage;
|
|
2007
4019
|
const itemsInPage = filteredItems.slice(startIndex, endIndex);
|
|
2008
4020
|
setRows(itemsInPage);
|
|
2009
4021
|
}, [filteredItems, page, perPage]);
|
|
2010
|
-
/**
|
|
2011
|
-
* If the list of items change, reset to the first page
|
|
4022
|
+
/**
|
|
4023
|
+
* If the list of items change, reset to the first page
|
|
2012
4024
|
*/
|
|
2013
|
-
|
|
2014
4025
|
function handleItemsPropChange() {
|
|
2015
4026
|
setPage(1);
|
|
2016
4027
|
}
|
|
2017
|
-
|
|
2018
4028
|
const handleItemsPropChangeCallback = useCallback(handleItemsPropChange, [setPage, items]);
|
|
2019
4029
|
useEffect(handleItemsPropChangeCallback, [handleItemsPropChangeCallback]);
|
|
2020
|
-
/**
|
|
2021
|
-
* Whenever a filter is selected or a user enter a search string, run each item through each filter condition
|
|
2022
|
-
* and check it includes the search string. Only inlcude the item in the table if it passes all filter/search string
|
|
2023
|
-
* conditions.
|
|
4030
|
+
/**
|
|
4031
|
+
* Whenever a filter is selected or a user enter a search string, run each item through each filter condition
|
|
4032
|
+
* and check it includes the search string. Only inlcude the item in the table if it passes all filter/search string
|
|
4033
|
+
* conditions.
|
|
2024
4034
|
*/
|
|
2025
|
-
|
|
2026
4035
|
useEffect(() => setFilteredItems(items.filter(item => tableFilters.map((f, i) => {
|
|
2027
|
-
var _filters$i, _filters$i
|
|
2028
|
-
|
|
2029
|
-
return !f ? true : filters == null ? void 0 : (_filters$i = filters[i]) == null ? void 0 : (_filters$i$props = _filters$i.props) == null ? void 0 : _filters$i$props.onChange(f, item);
|
|
4036
|
+
var _filters$i$props$onCh, _filters$i;
|
|
4037
|
+
return !f ? true : (_filters$i$props$onCh = filters == null || (_filters$i = filters[i]) == null || (_filters$i = _filters$i.props) == null || _filters$i.onChange == null ? void 0 : _filters$i.onChange(f, item)) != null ? _filters$i$props$onCh : true;
|
|
2030
4038
|
}).reduce((r, v) => r && v, true))), [filters, items, tableFilters]);
|
|
2031
|
-
/**
|
|
2032
|
-
* Whenever a new filter is selected by the user, update the state of selectedFilters
|
|
2033
|
-
* @param selected filter selections
|
|
2034
|
-
* @param index filter to update with new selections
|
|
4039
|
+
/**
|
|
4040
|
+
* Whenever a new filter is selected by the user, update the state of selectedFilters
|
|
4041
|
+
* @param selected filter selections
|
|
4042
|
+
* @param index filter to update with new selections
|
|
2035
4043
|
*/
|
|
2036
|
-
|
|
2037
4044
|
const onFilterChange = (selected, index) => {
|
|
2038
4045
|
handleItemsPropChangeCallback();
|
|
2039
4046
|
setTableFilters(prevState => {
|
|
@@ -2041,15 +4048,13 @@ function FilterableTable({
|
|
|
2041
4048
|
return [...prevState];
|
|
2042
4049
|
});
|
|
2043
4050
|
};
|
|
2044
|
-
/**
|
|
2045
|
-
* Pagination component
|
|
2046
|
-
* @param variant top or bottom
|
|
2047
|
-
* @returns Pagination component based on variant
|
|
4051
|
+
/**
|
|
4052
|
+
* Pagination component
|
|
4053
|
+
* @param variant top or bottom
|
|
4054
|
+
* @returns Pagination component based on variant
|
|
2048
4055
|
*/
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
4056
|
const renderPagination = variant => {
|
|
2052
|
-
return (filteredItems == null ? void 0 : filteredItems.length) > 0 &&
|
|
4057
|
+
return (filteredItems == null ? void 0 : filteredItems.length) > 0 && jsx(Pagination, {
|
|
2053
4058
|
itemCount: (filteredItems == null ? void 0 : filteredItems.length) || 0,
|
|
2054
4059
|
page: page,
|
|
2055
4060
|
perPage: perPage,
|
|
@@ -2066,64 +4071,85 @@ function FilterableTable({
|
|
|
2066
4071
|
}
|
|
2067
4072
|
});
|
|
2068
4073
|
};
|
|
2069
|
-
/**
|
|
2070
|
-
* Toolbar populated with provided filters
|
|
4074
|
+
/**
|
|
4075
|
+
* Toolbar populated with provided filters
|
|
2071
4076
|
*/
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
4077
|
+
const header = jsx(Toolbar, {
|
|
4078
|
+
children: jsxs(ToolbarContent, {
|
|
4079
|
+
children: [filters == null ? void 0 : filters.map((el, i) => {
|
|
4080
|
+
return jsx(ToolbarItem, {
|
|
4081
|
+
className: 'filterable-table__toolbar__item--filter',
|
|
4082
|
+
children: cloneElement(el, {
|
|
4083
|
+
onChange: selectedFilters => onFilterChange(selectedFilters, i)
|
|
4084
|
+
})
|
|
4085
|
+
}, i);
|
|
4086
|
+
}), actions == null ? void 0 : actions.map((el, i) => {
|
|
4087
|
+
return jsx(ToolbarItem, {
|
|
4088
|
+
className: 'filterable-table__toolbar__item--action',
|
|
4089
|
+
children: el
|
|
4090
|
+
}, i);
|
|
4091
|
+
}), jsx(ToolbarItem, {
|
|
4092
|
+
variant: 'pagination',
|
|
4093
|
+
children: renderPagination('top')
|
|
4094
|
+
})]
|
|
4095
|
+
})
|
|
4096
|
+
});
|
|
4097
|
+
return jsxs("div", {
|
|
4098
|
+
className: 'filterable-table',
|
|
4099
|
+
children: [isLoading ? jsx(Bullseye, {
|
|
4100
|
+
style: {
|
|
4101
|
+
minHeight: '15rem'
|
|
4102
|
+
},
|
|
4103
|
+
children: jsx("div", {
|
|
4104
|
+
children: jsx(Title, {
|
|
4105
|
+
headingLevel: 'h3',
|
|
4106
|
+
children: jsx(Spinner, {
|
|
4107
|
+
size: 'lg'
|
|
4108
|
+
})
|
|
4109
|
+
})
|
|
4110
|
+
})
|
|
4111
|
+
}) : jsxs(Fragment, {
|
|
4112
|
+
children: [header, jsxs(Table, {
|
|
4113
|
+
"aria-label": 'Packages Table',
|
|
4114
|
+
gridBreakPoint: 'grid-xl',
|
|
4115
|
+
children: [jsx(Thead, {
|
|
4116
|
+
children: jsx(Tr, {
|
|
4117
|
+
children: columns.map((col, colIdx) => jsx(Th, _extends({}, col.sortField ? {
|
|
4118
|
+
sort: {
|
|
4119
|
+
onSort: onSort,
|
|
4120
|
+
sortBy: sortTableBy,
|
|
4121
|
+
columnIndex: colIdx
|
|
4122
|
+
}
|
|
4123
|
+
} : {}, {
|
|
4124
|
+
children: col.title
|
|
4125
|
+
}), `pkg-table-head-${colIdx}`))
|
|
4126
|
+
})
|
|
4127
|
+
}), jsx(Tbody, {
|
|
4128
|
+
children: rows.length > 0 ? rows.map((row, rowIdx) => jsx(Tr, {
|
|
4129
|
+
children: columns.map((_col, colIdx) => {
|
|
4130
|
+
var _renderRow;
|
|
4131
|
+
return jsx(Td, {
|
|
4132
|
+
children: (_renderRow = renderRow(row)) == null ? void 0 : _renderRow[colIdx]
|
|
4133
|
+
}, `pkg-table-row-${rowIdx}-col-${colIdx}`);
|
|
4134
|
+
})
|
|
4135
|
+
}, `pkg-table-row-${rowIdx}`)) : jsx(Tr, {
|
|
4136
|
+
children: jsx(Td, {
|
|
4137
|
+
colSpan: columns.length,
|
|
4138
|
+
children: jsx(EmptyState, {
|
|
4139
|
+
children: jsx(EmptyStateHeader, {
|
|
4140
|
+
titleText: 'No results found',
|
|
4141
|
+
icon: jsx(EmptyStateIcon, {
|
|
4142
|
+
icon: SearchIcon
|
|
4143
|
+
}),
|
|
4144
|
+
headingLevel: 'h5'
|
|
4145
|
+
})
|
|
4146
|
+
})
|
|
4147
|
+
})
|
|
4148
|
+
})
|
|
4149
|
+
})]
|
|
4150
|
+
})]
|
|
4151
|
+
}), renderPagination('bottom')]
|
|
4152
|
+
});
|
|
2127
4153
|
}
|
|
2128
4154
|
|
|
2129
4155
|
const FilterInput = ({
|
|
@@ -2131,7 +4157,6 @@ const FilterInput = ({
|
|
|
2131
4157
|
placeholder
|
|
2132
4158
|
}) => {
|
|
2133
4159
|
const [searchStr, setSearchStr] = useState('');
|
|
2134
|
-
|
|
2135
4160
|
const onChange = (event, text) => {
|
|
2136
4161
|
event.stopPropagation();
|
|
2137
4162
|
event.preventDefault();
|
|
@@ -2140,24 +4165,24 @@ const FilterInput = ({
|
|
|
2140
4165
|
return text;
|
|
2141
4166
|
});
|
|
2142
4167
|
};
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
})
|
|
4168
|
+
return jsx("div", {
|
|
4169
|
+
className: 'filter-input',
|
|
4170
|
+
children: jsx(SearchInput, {
|
|
4171
|
+
value: searchStr,
|
|
4172
|
+
placeholder: placeholder,
|
|
4173
|
+
onChange: onChange,
|
|
4174
|
+
"aria-label": 'Text input filter',
|
|
4175
|
+
onFocus: event => {
|
|
4176
|
+
event.stopPropagation();
|
|
4177
|
+
event.preventDefault();
|
|
4178
|
+
},
|
|
4179
|
+
onClick: event => {
|
|
4180
|
+
event.stopPropagation();
|
|
4181
|
+
event.preventDefault();
|
|
4182
|
+
},
|
|
4183
|
+
onClear: event => onChange(event, '')
|
|
4184
|
+
})
|
|
4185
|
+
});
|
|
2161
4186
|
};
|
|
2162
4187
|
|
|
2163
4188
|
const ExcludedPackagesTable = ({
|
|
@@ -2173,46 +4198,47 @@ const ExcludedPackagesTable = ({
|
|
|
2173
4198
|
nvra,
|
|
2174
4199
|
summary
|
|
2175
4200
|
}) => {
|
|
2176
|
-
return [gpg ?
|
|
4201
|
+
return [gpg ? jsx("a", {
|
|
2177
4202
|
href: `https://access.redhat.com/downloads/content/${name}/${version}}-${release}/${architecture}/${gpg == null ? void 0 : gpg.slice(-8)}/package`,
|
|
2178
4203
|
target: '_blank',
|
|
2179
|
-
rel: 'noopener noreferrer'
|
|
2180
|
-
|
|
4204
|
+
rel: 'noopener noreferrer',
|
|
4205
|
+
children: nvra
|
|
4206
|
+
}) : jsx("span", {
|
|
4207
|
+
children: nvra
|
|
4208
|
+
}), summary];
|
|
2181
4209
|
};
|
|
2182
|
-
|
|
2183
4210
|
const onTextInputFilterChange = (text, {
|
|
2184
4211
|
nvra,
|
|
2185
4212
|
summary
|
|
2186
4213
|
}) => `${nvra + summary}`.toLowerCase().includes(text.toLowerCase());
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
}));
|
|
4214
|
+
return jsx("div", {
|
|
4215
|
+
className: 'excluded-packages-table',
|
|
4216
|
+
children: jsx(FilterableTable, {
|
|
4217
|
+
isLoading: isLoading,
|
|
4218
|
+
tableName: 'Excluded packages table',
|
|
4219
|
+
columns: [{
|
|
4220
|
+
title: 'Excluded Package'
|
|
4221
|
+
}, {
|
|
4222
|
+
title: 'Summary'
|
|
4223
|
+
}],
|
|
4224
|
+
items: excludedPackages,
|
|
4225
|
+
renderRow: renderPackagesRow,
|
|
4226
|
+
perPageOptions: [{
|
|
4227
|
+
title: '5',
|
|
4228
|
+
value: 5
|
|
4229
|
+
}, {
|
|
4230
|
+
title: '10',
|
|
4231
|
+
value: 10
|
|
4232
|
+
}, {
|
|
4233
|
+
title: '20',
|
|
4234
|
+
value: 20
|
|
4235
|
+
}],
|
|
4236
|
+
filters: [jsx(FilterInput, {
|
|
4237
|
+
onChange: onTextInputFilterChange,
|
|
4238
|
+
placeholder: 'Filter excluded packages'
|
|
4239
|
+
}, 'excluded-packages-table__filter-input')]
|
|
4240
|
+
})
|
|
4241
|
+
});
|
|
2216
4242
|
};
|
|
2217
4243
|
|
|
2218
4244
|
function EcoSelect({
|
|
@@ -2224,37 +4250,34 @@ function EcoSelect({
|
|
|
2224
4250
|
}) {
|
|
2225
4251
|
const [isOpen, setIsOpen] = useState(false);
|
|
2226
4252
|
const [selected, setSelected] = useState([]);
|
|
2227
|
-
|
|
2228
4253
|
const onToggle = isOpen => setIsOpen(isOpen);
|
|
2229
|
-
|
|
2230
4254
|
const onSelect = (event, selection) => {
|
|
2231
4255
|
const result = selected.includes(selection) ? selected.filter(item => item !== selection) : [selection, ...selected];
|
|
2232
4256
|
setSelected(result);
|
|
2233
4257
|
onChange && onChange(result, event);
|
|
2234
4258
|
};
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
})
|
|
4259
|
+
const id = useMemo(() => `select-${Math.random().toString(36).substring(2, 11)}`, []);
|
|
4260
|
+
return jsx("div", {
|
|
4261
|
+
className: 'select',
|
|
4262
|
+
children: jsx(Select, {
|
|
4263
|
+
id: id,
|
|
4264
|
+
variant: variant,
|
|
4265
|
+
"aria-label": ariaLabel,
|
|
4266
|
+
onToggle: (_event, isOpen) => onToggle(isOpen),
|
|
4267
|
+
onSelect: onSelect,
|
|
4268
|
+
selections: selected,
|
|
4269
|
+
isOpen: isOpen,
|
|
4270
|
+
placeholderText: placeholderText,
|
|
4271
|
+
className: 'pf-select-wrapper',
|
|
4272
|
+
children: options.map(option => jsx(SelectOption, {
|
|
4273
|
+
value: option
|
|
4274
|
+
}, option))
|
|
4275
|
+
})
|
|
4276
|
+
});
|
|
2253
4277
|
}
|
|
2254
4278
|
|
|
2255
4279
|
const ToggleGroup = props => {
|
|
2256
4280
|
const [selected, setSelected] = useState('');
|
|
2257
|
-
|
|
2258
4281
|
const onClick = (_, event) => {
|
|
2259
4282
|
const id = event.currentTarget.id;
|
|
2260
4283
|
setSelected(() => {
|
|
@@ -2262,19 +4285,17 @@ const ToggleGroup = props => {
|
|
|
2262
4285
|
return id;
|
|
2263
4286
|
});
|
|
2264
4287
|
};
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
})));
|
|
4288
|
+
return jsx(ToggleGroup$1, {
|
|
4289
|
+
"aria-label": props['aria-label'],
|
|
4290
|
+
children: props.options.map((option, index) => jsx(ToggleGroupItem, {
|
|
4291
|
+
text: option.text,
|
|
4292
|
+
buttonId: option.id,
|
|
4293
|
+
isSelected: selected === option.id,
|
|
4294
|
+
onChange: (event, _) => onClick(_, event)
|
|
4295
|
+
}, index))
|
|
4296
|
+
});
|
|
2275
4297
|
};
|
|
2276
4298
|
|
|
2277
|
-
/* eslint-disable camelcase */
|
|
2278
4299
|
const VulnerabilitiesTable = ({
|
|
2279
4300
|
vulnerabilities,
|
|
2280
4301
|
isLoading,
|
|
@@ -2283,65 +4304,80 @@ const VulnerabilitiesTable = ({
|
|
|
2283
4304
|
const getImpact = ({
|
|
2284
4305
|
severity
|
|
2285
4306
|
}) => {
|
|
2286
|
-
return
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
4307
|
+
return jsx(Fragment, {
|
|
4308
|
+
children: jsxs("div", {
|
|
4309
|
+
className: 'vulnerabilities-table__impact-cell',
|
|
4310
|
+
children: [jsx(SecurityIcon, {
|
|
4311
|
+
className: `impact-icon color-${severity.toLowerCase()}`
|
|
4312
|
+
}), jsx("span", {
|
|
4313
|
+
children: severity
|
|
4314
|
+
})]
|
|
4315
|
+
})
|
|
4316
|
+
});
|
|
2291
4317
|
};
|
|
2292
|
-
|
|
2293
4318
|
const getCVE = ({
|
|
2294
4319
|
cve_id
|
|
2295
4320
|
}) => {
|
|
2296
|
-
return
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
4321
|
+
return jsx(Fragment, {
|
|
4322
|
+
children: jsx("div", {
|
|
4323
|
+
className: 'vulnerabilities-table__cve-cell',
|
|
4324
|
+
children: jsx("a", {
|
|
4325
|
+
href: `https://access.redhat.com/security/cve/${cve_id}`,
|
|
4326
|
+
target: '_blank',
|
|
4327
|
+
rel: 'noopener noreferrer',
|
|
4328
|
+
children: cve_id
|
|
4329
|
+
})
|
|
4330
|
+
})
|
|
4331
|
+
});
|
|
2303
4332
|
};
|
|
2304
|
-
|
|
2305
4333
|
const getAffectedPackages = rpms => {
|
|
2306
|
-
return
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
4334
|
+
return jsx(Fragment, {
|
|
4335
|
+
children: rpms == null ? void 0 : rpms.map(({
|
|
4336
|
+
gpg,
|
|
4337
|
+
name,
|
|
4338
|
+
version,
|
|
4339
|
+
release,
|
|
4340
|
+
architecture,
|
|
4341
|
+
nvra
|
|
4342
|
+
} = {}, index) => {
|
|
4343
|
+
return gpg ? jsx("div", {
|
|
4344
|
+
className: 'vulnerabilities-table__affected-packages-cell',
|
|
4345
|
+
children: jsx("a", {
|
|
4346
|
+
href: `https://access.redhat.com/downloads/content/${name}/${version}-${release}/${architecture}/${gpg == null ? void 0 : gpg.slice(-8)}/package`,
|
|
4347
|
+
target: '_blank',
|
|
4348
|
+
rel: 'noopener noreferrer',
|
|
4349
|
+
children: nvra
|
|
4350
|
+
})
|
|
4351
|
+
}, `affected-package-${index}`) : jsx("div", {
|
|
4352
|
+
className: 'vulnerabilities-table__affected-packages-cell',
|
|
4353
|
+
children: jsx("span", {
|
|
4354
|
+
children: nvra
|
|
4355
|
+
})
|
|
4356
|
+
}, `affected-package-${index}`);
|
|
4357
|
+
})
|
|
4358
|
+
});
|
|
2326
4359
|
};
|
|
2327
|
-
|
|
2328
4360
|
const getRPMAdvisory = ({
|
|
2329
4361
|
advisory_type,
|
|
2330
4362
|
advisory_id
|
|
2331
4363
|
}) => {
|
|
2332
|
-
return
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
4364
|
+
return jsx(Fragment, {
|
|
4365
|
+
children: jsx("div", {
|
|
4366
|
+
className: 'vulnerabilities-table__rpm-advisory-cell',
|
|
4367
|
+
children: advisory_type && advisory_id ? jsxs("a", {
|
|
4368
|
+
href: `https://access.redhat.com/errata/${advisory_type}-${advisory_id}`,
|
|
4369
|
+
target: '_blank',
|
|
4370
|
+
rel: 'noopener noreferrer',
|
|
4371
|
+
children: [advisory_type, "-", advisory_id]
|
|
4372
|
+
}) : jsx("span", {
|
|
4373
|
+
children: "-"
|
|
4374
|
+
})
|
|
4375
|
+
})
|
|
4376
|
+
});
|
|
2339
4377
|
};
|
|
2340
|
-
|
|
2341
4378
|
const renderVulnerabilitiesRow = vulnerability => {
|
|
2342
4379
|
return [getImpact(vulnerability), getCVE(vulnerability), getAffectedPackages(vulnerability.rpm_nvra_with_link_data), getRPMAdvisory(vulnerability), vulnerability != null && vulnerability.creation_date ? format(new Date(vulnerability == null ? void 0 : vulnerability.creation_date), 'MMM dd, yyyy hh:mm a') : ''];
|
|
2343
4380
|
};
|
|
2344
|
-
|
|
2345
4381
|
const onTextInputFilterChange = (text, {
|
|
2346
4382
|
rpm_nvra_with_link_data,
|
|
2347
4383
|
severity,
|
|
@@ -2353,89 +4389,81 @@ const VulnerabilitiesTable = ({
|
|
|
2353
4389
|
}) => result += nvra, '');
|
|
2354
4390
|
return `${severity + cve_id + advisory_id + nvraList}`.toLowerCase().includes(text.toLowerCase());
|
|
2355
4391
|
};
|
|
2356
|
-
|
|
2357
4392
|
const onStatusFilterChange = (selected, vulnerability) => {
|
|
2358
4393
|
return selected === 'fixed' ? !!(vulnerability != null && vulnerability.advisory_id) : selected === 'unfixed' ? !(vulnerability != null && vulnerability.advisory_id) : true;
|
|
2359
4394
|
};
|
|
2360
|
-
|
|
2361
4395
|
const onImpactFilterChange = (selected, vulnerability) => {
|
|
2362
4396
|
return selected.length > 0 ? selected.includes(vulnerability.severity) : true;
|
|
2363
4397
|
};
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
sortFn: vulnerability => severitySortOrder[vulnerability.severity]
|
|
2373
|
-
}, {
|
|
2374
|
-
title: 'CVE',
|
|
2375
|
-
sortField: 'cve_id'
|
|
2376
|
-
}, {
|
|
2377
|
-
title: 'Affected Package(s)'
|
|
2378
|
-
}, {
|
|
2379
|
-
title: 'RPM Advisory',
|
|
2380
|
-
sortField: 'advisory_id'
|
|
2381
|
-
}, {
|
|
2382
|
-
title: 'Created',
|
|
2383
|
-
sortField: 'creation_date',
|
|
2384
|
-
sortFn: vulnerability => new Date(vulnerability == null ? void 0 : vulnerability.creation_date).getTime()
|
|
2385
|
-
}],
|
|
2386
|
-
items: vulnerabilities,
|
|
2387
|
-
renderRow: renderVulnerabilitiesRow,
|
|
2388
|
-
isLoading: isLoading,
|
|
2389
|
-
perPageOptions: [{
|
|
2390
|
-
title: '5',
|
|
2391
|
-
value: 5
|
|
2392
|
-
}, {
|
|
2393
|
-
title: '10',
|
|
2394
|
-
value: 10
|
|
2395
|
-
}, {
|
|
2396
|
-
title: '20',
|
|
2397
|
-
value: 20
|
|
2398
|
-
}],
|
|
2399
|
-
filters: [React__default.createElement(FilterInput, {
|
|
2400
|
-
key: 'vulnerabilities-table__filter-input',
|
|
2401
|
-
onChange: onTextInputFilterChange,
|
|
2402
|
-
placeholder: 'Filter vulnerabilities'
|
|
2403
|
-
}), !hideToggler ? React__default.createElement(ToggleGroup, {
|
|
2404
|
-
key: 'vulnerabilities-table__toggle-group',
|
|
2405
|
-
onChange: onStatusFilterChange,
|
|
2406
|
-
"aria-label": 'Vulnerability status filter',
|
|
2407
|
-
options: [{
|
|
2408
|
-
id: 'all',
|
|
2409
|
-
text: 'All'
|
|
4398
|
+
return jsx("div", {
|
|
4399
|
+
className: 'vulnerabilities-table',
|
|
4400
|
+
children: jsx(FilterableTable, {
|
|
4401
|
+
tableName: 'Vulnerabilities impact table',
|
|
4402
|
+
columns: [{
|
|
4403
|
+
title: 'Impact',
|
|
4404
|
+
sortField: 'severity',
|
|
4405
|
+
sortFn: vulnerability => severitySortOrder[vulnerability.severity]
|
|
2410
4406
|
}, {
|
|
2411
|
-
|
|
2412
|
-
|
|
4407
|
+
title: 'CVE',
|
|
4408
|
+
sortField: 'cve_id'
|
|
2413
4409
|
}, {
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
4410
|
+
title: 'Affected Package(s)'
|
|
4411
|
+
}, {
|
|
4412
|
+
title: 'RPM Advisory',
|
|
4413
|
+
sortField: 'advisory_id'
|
|
4414
|
+
}, {
|
|
4415
|
+
title: 'Created',
|
|
4416
|
+
sortField: 'creation_date',
|
|
4417
|
+
sortFn: vulnerability => new Date(vulnerability == null ? void 0 : vulnerability.creation_date).getTime()
|
|
4418
|
+
}],
|
|
4419
|
+
items: vulnerabilities,
|
|
4420
|
+
renderRow: renderVulnerabilitiesRow,
|
|
4421
|
+
isLoading: isLoading,
|
|
4422
|
+
perPageOptions: [{
|
|
4423
|
+
title: '5',
|
|
4424
|
+
value: 5
|
|
4425
|
+
}, {
|
|
4426
|
+
title: '10',
|
|
4427
|
+
value: 10
|
|
4428
|
+
}, {
|
|
4429
|
+
title: '20',
|
|
4430
|
+
value: 20
|
|
4431
|
+
}],
|
|
4432
|
+
filters: [jsx(FilterInput, {
|
|
4433
|
+
onChange: onTextInputFilterChange,
|
|
4434
|
+
placeholder: 'Filter vulnerabilities'
|
|
4435
|
+
}, 'vulnerabilities-table__filter-input'), !hideToggler ? jsx(ToggleGroup, {
|
|
4436
|
+
onChange: onStatusFilterChange,
|
|
4437
|
+
"aria-label": 'Vulnerability status filter',
|
|
4438
|
+
options: [{
|
|
4439
|
+
id: 'all',
|
|
4440
|
+
text: 'All'
|
|
4441
|
+
}, {
|
|
4442
|
+
id: 'fixed',
|
|
4443
|
+
text: 'Fixed'
|
|
4444
|
+
}, {
|
|
4445
|
+
id: 'unfixed',
|
|
4446
|
+
text: 'Unfixed'
|
|
4447
|
+
}]
|
|
4448
|
+
}, 'vulnerabilities-table__toggle-group') : jsx(Fragment, {}), jsx(EcoSelect, {
|
|
4449
|
+
onChange: onImpactFilterChange,
|
|
4450
|
+
"aria-label": 'Impact filter',
|
|
4451
|
+
placeholderText: 'Impact',
|
|
4452
|
+
variant: 'checkbox',
|
|
4453
|
+
options: Array.from(new Set(vulnerabilities.map(vulnerability => vulnerability.severity)))
|
|
4454
|
+
}, 'vulnerabilities-table__select')]
|
|
4455
|
+
})
|
|
4456
|
+
});
|
|
2426
4457
|
};
|
|
2427
4458
|
|
|
2428
|
-
/* eslint-disable camelcase */
|
|
2429
4459
|
const severitySortOrder = {
|
|
2430
4460
|
Critical: 1,
|
|
2431
4461
|
Important: 2,
|
|
2432
4462
|
Moderate: 3,
|
|
2433
4463
|
Low: 4
|
|
2434
4464
|
};
|
|
2435
|
-
|
|
2436
4465
|
const InsertCss = () => {
|
|
2437
4466
|
const styleId = 'example-component-styles';
|
|
2438
|
-
|
|
2439
4467
|
if (!document.getElementById(styleId)) {
|
|
2440
4468
|
const styleTag = document.createElement('style');
|
|
2441
4469
|
styleTag.id = styleId;
|
|
@@ -2443,85 +4471,85 @@ const InsertCss = () => {
|
|
|
2443
4471
|
document.body.appendChild(styleTag);
|
|
2444
4472
|
}
|
|
2445
4473
|
};
|
|
2446
|
-
|
|
2447
4474
|
const PackagesTable = ({
|
|
2448
4475
|
vulnerabilities: _vulnerabilities = [],
|
|
2449
4476
|
rpms: _rpms = [],
|
|
2450
4477
|
hideToggler,
|
|
2451
4478
|
isLoading: _isLoading = false
|
|
2452
4479
|
}) => {
|
|
2453
|
-
const [excludedPackages, setExcludedPackages] =
|
|
2454
|
-
const [uniqueVulnerabilities, setUniqueVulnerabilities] =
|
|
2455
|
-
const [activeKey, setActiveKey] =
|
|
2456
|
-
|
|
4480
|
+
const [excludedPackages, setExcludedPackages] = useState([]);
|
|
4481
|
+
const [uniqueVulnerabilities, setUniqueVulnerabilities] = useState([]);
|
|
4482
|
+
const [activeKey, setActiveKey] = useState(0);
|
|
4483
|
+
useEffect(() => {
|
|
2457
4484
|
const VALID_REDHAT_GPG_KEYS = ['199e2f91fd431d51', '5326810137017186', '45689c882fa658e0', '219180cddb42a60e', '7514f77d8366b0d9', 'fd372689897da07a', '938a80caf21541eb', '08b871e6a5787476'];
|
|
2458
|
-
|
|
2459
4485
|
const packages = _rpms.filter(({
|
|
2460
4486
|
gpg
|
|
2461
4487
|
}) => !VALID_REDHAT_GPG_KEYS.includes(gpg));
|
|
2462
|
-
|
|
2463
4488
|
setExcludedPackages(packages);
|
|
2464
|
-
const uniqueVulnerabilities = [..._vulnerabilities];
|
|
2465
|
-
|
|
4489
|
+
const uniqueVulnerabilities = [..._vulnerabilities];
|
|
4490
|
+
// augment vulnerabilities with link data
|
|
2466
4491
|
uniqueVulnerabilities.forEach(vulnerability => {
|
|
2467
|
-
vulnerability.rpm_nvra_with_link_data = [];
|
|
2468
|
-
|
|
4492
|
+
vulnerability.rpm_nvra_with_link_data = [];
|
|
4493
|
+
// // CONNCERT-2121
|
|
2469
4494
|
if (vulnerability != null && vulnerability.affected_packages) {
|
|
2470
4495
|
var _vulnerability$affect;
|
|
2471
|
-
|
|
2472
|
-
vulnerability == null ? void 0 : (_vulnerability$affect = vulnerability.affected_packages) == null ? void 0 : _vulnerability$affect.forEach(({
|
|
4496
|
+
vulnerability == null || (_vulnerability$affect = vulnerability.affected_packages) == null || _vulnerability$affect.forEach(({
|
|
2473
4497
|
name,
|
|
2474
4498
|
arch
|
|
2475
4499
|
}) => {
|
|
2476
|
-
const link_data = _rpms == null ? void 0 : _rpms.filter(rpm => rpm.name === name && rpm.architecture === arch);
|
|
4500
|
+
const link_data = _rpms == null ? void 0 : _rpms.filter(rpm => rpm.name === name && rpm.architecture === arch && !excludedPackages.includes(rpm));
|
|
2477
4501
|
vulnerability.rpm_nvra_with_link_data.push(link_data[0]);
|
|
2478
4502
|
});
|
|
2479
4503
|
} else {
|
|
2480
4504
|
var _vulnerability$packag;
|
|
2481
|
-
|
|
2482
|
-
vulnerability == null ? void 0 : (_vulnerability$packag = vulnerability.packages) == null ? void 0 : _vulnerability$packag.forEach(p => {
|
|
4505
|
+
vulnerability == null || (_vulnerability$packag = vulnerability.packages) == null || _vulnerability$packag.forEach(p => {
|
|
2483
4506
|
var _p$rpm_nvra;
|
|
2484
|
-
|
|
2485
|
-
return p == null ? void 0 : (_p$rpm_nvra = p.rpm_nvra) == null ? void 0 : _p$rpm_nvra.forEach(rpm_nvra => {
|
|
4507
|
+
return p == null || (_p$rpm_nvra = p.rpm_nvra) == null ? void 0 : _p$rpm_nvra.forEach(rpm_nvra => {
|
|
2486
4508
|
const link_data = _rpms == null ? void 0 : _rpms.filter(pk => pk.nvra === rpm_nvra);
|
|
2487
4509
|
vulnerability.rpm_nvra_with_link_data.push(link_data[0]);
|
|
2488
4510
|
});
|
|
2489
4511
|
});
|
|
2490
4512
|
}
|
|
2491
|
-
|
|
2492
4513
|
return vulnerability;
|
|
2493
|
-
});
|
|
2494
|
-
|
|
2495
|
-
uniqueVulnerabilities.sort(vulnerability => severitySortOrder[vulnerability.severity]);
|
|
2496
|
-
|
|
4514
|
+
});
|
|
4515
|
+
// sort vulnerabilities by severity
|
|
4516
|
+
uniqueVulnerabilities.sort(vulnerability => severitySortOrder[vulnerability.severity]);
|
|
4517
|
+
// filter out vulnerabilities with duplicate CVE IDs
|
|
2497
4518
|
uniqueVulnerabilities.filter((value, index, self) => self.findIndex(vulnerability => vulnerability.cve_id === value.cve_id) === index);
|
|
2498
4519
|
setUniqueVulnerabilities(uniqueVulnerabilities);
|
|
2499
4520
|
}, [_rpms, _vulnerabilities]);
|
|
2500
4521
|
InsertCss();
|
|
2501
|
-
return
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
4522
|
+
return jsx(Fragment, {
|
|
4523
|
+
children: (uniqueVulnerabilities.length > 0 || excludedPackages.length > 0) && jsx("div", {
|
|
4524
|
+
className: 'packages-table',
|
|
4525
|
+
children: jsxs(Tabs, {
|
|
4526
|
+
activeKey: activeKey,
|
|
4527
|
+
onSelect: (_evt, tabKey) => setActiveKey(tabKey),
|
|
4528
|
+
variant: 'default',
|
|
4529
|
+
isBox: true,
|
|
4530
|
+
"aria-label": 'vulnerability tab',
|
|
4531
|
+
children: [uniqueVulnerabilities.length > 0 && jsx(Tab, {
|
|
4532
|
+
eventKey: 0,
|
|
4533
|
+
title: `Vulnerabilities (${uniqueVulnerabilities.length})`,
|
|
4534
|
+
children: jsx(VulnerabilitiesTable, {
|
|
4535
|
+
vulnerabilities: uniqueVulnerabilities,
|
|
4536
|
+
isLoading: _isLoading,
|
|
4537
|
+
hideToggler: hideToggler
|
|
4538
|
+
})
|
|
4539
|
+
}), excludedPackages.length > 0 && jsxs(Tab, {
|
|
4540
|
+
eventKey: 1,
|
|
4541
|
+
title: `Excluded Packages (${excludedPackages.length})`,
|
|
4542
|
+
children: [jsx("p", {
|
|
4543
|
+
className: 'packages-table__excluded-packages-disclaimer',
|
|
4544
|
+
children: "The following packages were found in this image and cannot be scanned or compared to public vulnerability information. This image may include additional packages or content not found or listed below."
|
|
4545
|
+
}), jsx(ExcludedPackagesTable, {
|
|
4546
|
+
excludedPackages: excludedPackages,
|
|
4547
|
+
isLoading: _isLoading
|
|
4548
|
+
})]
|
|
4549
|
+
})]
|
|
4550
|
+
})
|
|
4551
|
+
})
|
|
4552
|
+
});
|
|
2525
4553
|
};
|
|
2526
4554
|
|
|
2527
4555
|
export { PackagesTable, severitySortOrder };
|