@parca/profile 0.19.140 → 0.19.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/GraphTooltipArrow/Content.js +224 -30
- package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
- package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
- package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/index.js +86 -56
- package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
- package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +94 -68
- package/dist/MatchersInput/SuggestionItem.js +91 -12
- package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
- package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
- package/dist/MatchersInput/SuggestionsList.js +371 -157
- package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
- package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
- package/dist/MatchersInput/index.js +308 -115
- package/dist/MetricsCircle/index.js +39 -3
- package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
- package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
- package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
- package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
- package/dist/MetricsGraph/index.js +552 -203
- package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
- package/dist/MetricsGraph/utils/colorMapping.js +24 -17
- package/dist/MetricsSeries/index.js +70 -7
- package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
- package/dist/PreSelectedMatchers/index.js +249 -102
- package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -45
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
- package/dist/ProfileExplorer/index.js +183 -32
- package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
- package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
- package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
- package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
- package/dist/ProfileFlameChart/index.js +260 -126
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +283 -85
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
- package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
- package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
- package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
- package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
- package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
- package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
- package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
- package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
- package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
- package/dist/ProfileFlameGraph/index.js +322 -147
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
- package/dist/ProfileMetricsGraph/index.js +515 -256
- package/dist/ProfileSelector/CompareButton.js +132 -12
- package/dist/ProfileSelector/MetricsGraphSection.js +228 -63
- package/dist/ProfileSelector/index.d.ts +1 -1
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +734 -142
- package/dist/ProfileSelector/useAutoQuerySelector.d.ts +1 -3
- package/dist/ProfileSelector/useAutoQuerySelector.d.ts.map +1 -1
- package/dist/ProfileSelector/useAutoQuerySelector.js +280 -132
- package/dist/ProfileSource.js +230 -163
- package/dist/ProfileTypeSelector/index.js +214 -125
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +137 -32
- package/dist/ProfileView/components/ColorStackLegend.js +182 -54
- package/dist/ProfileView/components/DashboardItems/index.js +87 -28
- package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
- package/dist/ProfileView/components/DiffLegend.js +172 -29
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
- package/dist/ProfileView/components/InvertCallStack/index.js +97 -9
- package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
- package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +191 -118
- package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
- package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
- package/dist/ProfileView/components/ShareButton/index.js +352 -62
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +664 -192
- package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +196 -155
- package/dist/ProfileView/components/Toolbars/index.js +441 -21
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
- package/dist/ProfileView/components/ViewSelector/index.js +186 -82
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
- package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
- package/dist/ProfileView/components/VisualizationPanel.js +185 -8
- package/dist/ProfileView/context/DashboardContext.js +74 -26
- package/dist/ProfileView/context/ProfileViewContext.js +56 -15
- package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
- package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
- package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +53 -17
- package/dist/ProfileView/hooks/useVisualizationState.js +229 -69
- package/dist/ProfileView/index.js +383 -45
- package/dist/ProfileView/types/visualization.js +1 -13
- package/dist/ProfileView/utils/colorUtils.js +8 -7
- package/dist/ProfileViewWithData.js +319 -225
- package/dist/QueryControls/index.js +418 -47
- package/dist/Sandwich/components/CalleesSection.js +54 -4
- package/dist/Sandwich/components/CallersSection.js +97 -27
- package/dist/Sandwich/components/TableSection.js +77 -4
- package/dist/Sandwich/index.js +125 -12
- package/dist/Sandwich/utils/processRowData.js +48 -39
- package/dist/SelectWithRefresh/index.js +102 -28
- package/dist/SimpleMatchers/Select.js +520 -187
- package/dist/SimpleMatchers/index.js +590 -288
- package/dist/SourceView/Highlighter.js +230 -70
- package/dist/SourceView/LineNo.js +72 -17
- package/dist/SourceView/index.js +177 -101
- package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
- package/dist/SourceView/lang-detector/index.js +28 -14
- package/dist/SourceView/useSelectedLineRange.js +72 -20
- package/dist/Table/ColorCell.js +42 -1
- package/dist/Table/ColumnsVisibility.js +114 -6
- package/dist/Table/MoreDropdown.js +107 -21
- package/dist/Table/TableContextMenu.js +144 -134
- package/dist/Table/TableContextMenuWrapper.js +59 -14
- package/dist/Table/hooks/useColorManagement.js +58 -16
- package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
- package/dist/Table/hooks/useTableConfiguration.js +323 -167
- package/dist/Table/index.js +217 -123
- package/dist/Table/utils/functions.js +169 -144
- package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
- package/dist/TimelineGuide/index.js +209 -16
- package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
- package/dist/TopTable/index.js +325 -121
- package/dist/contexts/LabelsQueryProvider.js +94 -32
- package/dist/contexts/UnifiedLabelsContext.js +114 -49
- package/dist/contexts/utils.js +37 -15
- package/dist/hooks/urlParsers.js +27 -15
- package/dist/hooks/useColorBy.js +47 -10
- package/dist/hooks/useCompareModeMeta.js +112 -62
- package/dist/hooks/useDashboardItems.js +52 -11
- package/dist/hooks/useLabels.js +295 -52
- package/dist/hooks/useQueryState.d.ts +1 -1
- package/dist/hooks/useQueryState.d.ts.map +1 -1
- package/dist/hooks/useQueryState.js +375 -329
- package/dist/index.js +11 -6
- package/dist/testdata/fg-diff.json +3750 -0
- package/dist/testdata/fg-simple.json +1879 -0
- package/dist/testdata/link_data.json +56 -0
- package/dist/testdata/tabular.json +30 -0
- package/dist/testdata/test_flamegraph.json +26846 -0
- package/dist/testdata/test_graph.json +53 -0
- package/dist/useDelayedLoader.js +32 -18
- package/dist/useGrpcQuery/index.js +71 -11
- package/dist/useHasProfileData.js +90 -12
- package/dist/useQuery.js +205 -64
- package/dist/useSumBy.d.ts.map +1 -1
- package/dist/useSumBy.js +294 -138
- package/dist/utils.js +62 -30
- package/package.json +9 -9
- package/src/GraphTooltipArrow/index.tsx +3 -0
- package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
- package/src/MatchersInput/SuggestionsList.tsx +11 -10
- package/src/MatchersInput/index.tsx +1 -1
- package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
- package/src/PreSelectedMatchers/index.tsx +3 -0
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -2
- package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
- package/src/ProfileSelector/index.tsx +31 -9
- package/src/ProfileSelector/useAutoQuerySelector.ts +64 -42
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
- package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
- package/src/Table/hooks/useTableConfiguration.tsx +7 -13
- package/src/hooks/useQueryState.ts +18 -3
- package/src/useDelayedLoader.ts +10 -10
- package/src/useSumBy.ts +12 -18
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
- package/dist/hooks/useQueryState.test.js +0 -868
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
13
|
// Copyright 2022 The Parca Authors
|
|
2
14
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
15
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,172 +22,185 @@
|
|
|
10
22
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
23
|
// See the License for the specific language governing permissions and
|
|
12
24
|
// limitations under the License.
|
|
25
|
+
|
|
13
26
|
import { getLastItem } from '@parca/utilities';
|
|
14
27
|
import { hexifyAddress } from '../../utils';
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
export var addPlusSign = function addPlusSign(num) {
|
|
29
|
+
if (num.charAt(0) === '0' || num.charAt(0) === '-') {
|
|
30
|
+
return num;
|
|
31
|
+
}
|
|
32
|
+
return "+".concat(num);
|
|
20
33
|
};
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
export var getRowColor = function getRowColor(colorByColors, mappingFileColumn, row, functionFileNameColumn, colorBy) {
|
|
35
|
+
var _mappingFileColumn$ge, _functionFileNameColu;
|
|
36
|
+
if (mappingFileColumn === null) {
|
|
37
|
+
console.error('mapping_file column not found');
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
var mappingFile = (_mappingFileColumn$ge = mappingFileColumn === null || mappingFileColumn === void 0 ? void 0 : mappingFileColumn.get(row)) !== null && _mappingFileColumn$ge !== void 0 ? _mappingFileColumn$ge : null;
|
|
41
|
+
var functionFileName = (_functionFileNameColu = functionFileNameColumn === null || functionFileNameColumn === void 0 ? void 0 : functionFileNameColumn.get(row)) !== null && _functionFileNameColu !== void 0 ? _functionFileNameColu : null;
|
|
42
|
+
var mapping = '';
|
|
43
|
+
var filename = '';
|
|
44
|
+
if (mappingFile != null) {
|
|
45
|
+
var _getLastItem;
|
|
46
|
+
mapping = "".concat((_getLastItem = getLastItem(mappingFile)) !== null && _getLastItem !== void 0 ? _getLastItem : '');
|
|
47
|
+
}
|
|
48
|
+
if (functionFileName != null) {
|
|
49
|
+
var _getLastItem2;
|
|
50
|
+
filename = "".concat((_getLastItem2 = getLastItem(functionFileName)) !== null && _getLastItem2 !== void 0 ? _getLastItem2 : '');
|
|
51
|
+
}
|
|
52
|
+
if (colorBy === 'filename') {
|
|
53
|
+
return colorByColors[filename === '' ? 'Everything else' : filename];
|
|
54
|
+
}
|
|
55
|
+
return colorByColors[mapping];
|
|
40
56
|
};
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
export var RowName = function RowName(mappingFileColumn, locationAddressColumn, functionNameColumn, row) {
|
|
58
|
+
var _functionNameColumn$g, _locationAddressColum;
|
|
59
|
+
if (mappingFileColumn === null) {
|
|
60
|
+
console.error('mapping_file column not found');
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
var mappingFile = mappingFileColumn === null || mappingFileColumn === void 0 ? void 0 : mappingFileColumn.get(row);
|
|
64
|
+
var mapping = '';
|
|
65
|
+
// Show the last item in the mapping file only if there are more than 1 mappings
|
|
66
|
+
if (mappingFile != null && mappingFileColumn.data.length > 1) {
|
|
67
|
+
var _getLastItem3;
|
|
68
|
+
mapping = "[".concat((_getLastItem3 = getLastItem(mappingFile)) !== null && _getLastItem3 !== void 0 ? _getLastItem3 : '', "]");
|
|
69
|
+
}
|
|
70
|
+
var functionName = (_functionNameColumn$g = functionNameColumn === null || functionNameColumn === void 0 ? void 0 : functionNameColumn.get(row)) !== null && _functionNameColumn$g !== void 0 ? _functionNameColumn$g : '';
|
|
71
|
+
if (functionName !== null && functionName !== '') {
|
|
72
|
+
return "".concat(mapping, " ").concat(functionName);
|
|
73
|
+
}
|
|
74
|
+
var address = (_locationAddressColum = locationAddressColumn === null || locationAddressColumn === void 0 ? void 0 : locationAddressColumn.get(row)) !== null && _locationAddressColum !== void 0 ? _locationAddressColum : 0n;
|
|
75
|
+
return hexifyAddress(address);
|
|
58
76
|
};
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
export var getRowsCount = function getRowsCount(rows) {
|
|
78
|
+
if (rows.length < 6) {
|
|
79
|
+
return 6;
|
|
80
|
+
}
|
|
81
|
+
return rows.length;
|
|
64
82
|
};
|
|
65
83
|
export function getScrollTargetIndex(rows, parentRow, newRow) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
var parentIndex = rows.indexOf(parentRow);
|
|
85
|
+
var newRowIndex = rows.indexOf(newRow);
|
|
86
|
+
var targetIndex = newRowIndex;
|
|
87
|
+
if (parentIndex > newRowIndex) {
|
|
88
|
+
// Adjusting the number of subs rows to scroll to the main row after expansion.
|
|
89
|
+
targetIndex -= getRowsCount(newRow.subRows);
|
|
90
|
+
}
|
|
91
|
+
if (parentIndex < newRowIndex) {
|
|
92
|
+
// If the parent row is above the new row, we need to adjust the number of subrows of the parent.
|
|
93
|
+
targetIndex += getRowsCount(parentRow.subRows);
|
|
94
|
+
}
|
|
95
|
+
if (targetIndex < 0) {
|
|
96
|
+
targetIndex = 0;
|
|
97
|
+
}
|
|
98
|
+
return targetIndex;
|
|
81
99
|
}
|
|
82
100
|
export function isSubRow(row) {
|
|
83
|
-
|
|
101
|
+
return row.isTopSubRow === true || row.isBottomSubRow === true;
|
|
84
102
|
}
|
|
85
103
|
export function isLastSubRow(row, rows) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
104
|
+
var index = rows.indexOf(row);
|
|
105
|
+
var nextRow = rows[index + 1];
|
|
106
|
+
return nextRow == null || !isSubRow(nextRow.original) && !nextRow.getIsExpanded();
|
|
89
107
|
}
|
|
90
108
|
export function isFirstSubRow(row, rows) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
var index = rows.indexOf(row);
|
|
110
|
+
var prevRow = rows[index - 1];
|
|
111
|
+
return prevRow == null || !isSubRow(prevRow.original) && !prevRow.getIsExpanded();
|
|
94
112
|
}
|
|
95
|
-
export
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
113
|
+
export var rowBgClassNames = function rowBgClassNames(isExpanded, isSubRow) {
|
|
114
|
+
return {
|
|
115
|
+
relative: true,
|
|
116
|
+
'bg-indigo-100 dark:bg-gray-600': isSubRow,
|
|
117
|
+
'bg-indigo-50 dark:bg-gray-700': isExpanded
|
|
118
|
+
};
|
|
101
119
|
};
|
|
102
|
-
export
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
120
|
+
export var ROW_HEIGHT = 29;
|
|
121
|
+
export var sizeToHeightStyle = function sizeToHeightStyle(size) {
|
|
122
|
+
return {
|
|
123
|
+
height: "".concat(size * ROW_HEIGHT, "px")
|
|
124
|
+
};
|
|
107
125
|
};
|
|
108
|
-
export
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
126
|
+
export var sizeToWidthStyle = function sizeToWidthStyle(size) {
|
|
127
|
+
return {
|
|
128
|
+
width: "".concat(size * ROW_HEIGHT, "px")
|
|
129
|
+
};
|
|
112
130
|
};
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
131
|
+
export var sizeToBottomStyle = function sizeToBottomStyle(size) {
|
|
132
|
+
return {
|
|
133
|
+
bottom: "-".concat(size * ROW_HEIGHT, "px")
|
|
134
|
+
};
|
|
117
135
|
};
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
export var getCallerRows = function getCallerRows(callers) {
|
|
137
|
+
if (callers.length === 0) {
|
|
138
|
+
return [{
|
|
139
|
+
size: 3,
|
|
140
|
+
message: 'No callers.',
|
|
141
|
+
isTopSubRow: true
|
|
142
|
+
}];
|
|
143
|
+
}
|
|
144
|
+
var rows = callers.map(function (row) {
|
|
145
|
+
return _objectSpread(_objectSpread({}, row), {}, {
|
|
146
|
+
isTopSubRow: true
|
|
124
147
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
148
|
+
});
|
|
149
|
+
if (rows.length >= 3) {
|
|
150
|
+
return rows;
|
|
151
|
+
}
|
|
152
|
+
return [].concat(_toConsumableArray(rows), [{
|
|
153
|
+
size: 3 - rows.length,
|
|
154
|
+
message: '',
|
|
155
|
+
isTopSubRow: true
|
|
156
|
+
}]);
|
|
129
157
|
};
|
|
130
|
-
export
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
158
|
+
export var getCalleeRows = function getCalleeRows(callees) {
|
|
159
|
+
if (callees.length === 0) {
|
|
160
|
+
return [{
|
|
161
|
+
size: 3,
|
|
162
|
+
message: 'No callees.',
|
|
163
|
+
isBottomSubRow: true
|
|
164
|
+
}];
|
|
165
|
+
}
|
|
166
|
+
var rows = callees.map(function (row) {
|
|
167
|
+
return _objectSpread(_objectSpread({}, row), {}, {
|
|
168
|
+
isBottomSubRow: true
|
|
136
169
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
170
|
+
});
|
|
171
|
+
if (rows.length >= 3) {
|
|
172
|
+
return rows;
|
|
173
|
+
}
|
|
174
|
+
return [{
|
|
175
|
+
size: 3 - rows.length,
|
|
176
|
+
message: '',
|
|
177
|
+
isBottomSubRow: true
|
|
178
|
+
}].concat(_toConsumableArray(rows));
|
|
141
179
|
};
|
|
142
|
-
export
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
180
|
+
export var getPercentageString = function getPercentageString(value, total) {
|
|
181
|
+
if (total === 0n) {
|
|
182
|
+
return '0%';
|
|
183
|
+
}
|
|
184
|
+
var percentage = Number(value) / Number(total) * 100;
|
|
185
|
+
return "".concat(percentage.toFixed(2), "%");
|
|
148
186
|
};
|
|
149
|
-
export
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
187
|
+
export var getRatioString = function getRatioString(value, total, filtered) {
|
|
188
|
+
if (filtered === 0n) {
|
|
189
|
+
return " ".concat(getPercentageString(value, total));
|
|
190
|
+
}
|
|
191
|
+
return "".concat(getPercentageString(value, total), " / ").concat(getPercentageString(value, filtered));
|
|
154
192
|
};
|
|
155
|
-
export
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
'
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
'cumulativeDiff',
|
|
163
|
-
'cumulativeDiffPercentage',
|
|
164
|
-
'name',
|
|
165
|
-
'functionSystemName',
|
|
166
|
-
'functionFileName',
|
|
167
|
-
'mappingFile',
|
|
168
|
-
];
|
|
169
|
-
export const percentageString = (value, total) => {
|
|
170
|
-
if (total === 0n) {
|
|
171
|
-
return '0%';
|
|
172
|
-
}
|
|
173
|
-
const percentage = (Number(value) / Number(total)) * 100;
|
|
174
|
-
return `${percentage.toFixed(2)}%`;
|
|
175
|
-
};
|
|
176
|
-
export const ratioString = (value, total, filtered) => {
|
|
177
|
-
if (filtered === 0n) {
|
|
178
|
-
return ` ${percentageString(value, total)}`;
|
|
179
|
-
}
|
|
180
|
-
return `${percentageString(value, total)} / ${percentageString(value, filtered)}`;
|
|
193
|
+
export var possibleColumns = ['flat', 'flatPercentage', 'flatDiff', 'flatDiffPercentage', 'cumulative', 'cumulativePercentage', 'cumulativeDiff', 'cumulativeDiffPercentage', 'name', 'functionSystemName', 'functionFileName', 'mappingFile'];
|
|
194
|
+
export var percentageString = function percentageString(value, total) {
|
|
195
|
+
if (total === 0n) {
|
|
196
|
+
return '0%';
|
|
197
|
+
}
|
|
198
|
+
var percentage = Number(value) / Number(total) * 100;
|
|
199
|
+
return "".concat(percentage.toFixed(2), "%");
|
|
181
200
|
};
|
|
201
|
+
export var ratioString = function ratioString(value, total, filtered) {
|
|
202
|
+
if (filtered === 0n) {
|
|
203
|
+
return " ".concat(percentageString(value, total));
|
|
204
|
+
}
|
|
205
|
+
return "".concat(percentageString(value, total), " / ").concat(percentageString(value, filtered));
|
|
206
|
+
};
|
|
@@ -10,59 +10,76 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
import { getMemoOptions, memo } from '@tanstack/table-core';
|
|
14
15
|
export function getTopAndBottomExpandedRowModel() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
return expandRows(rowModel);
|
|
16
|
+
return function (table) {
|
|
17
|
+
return memo(function () {
|
|
18
|
+
return [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows];
|
|
19
|
+
}, function (expanded, rowModel, paginateExpandedRows) {
|
|
20
|
+
if (rowModel.rows.length === 0 || expanded !== true && Object.keys(expanded !== null && expanded !== void 0 ? expanded : {}).length === 0) {
|
|
21
|
+
return rowModel;
|
|
22
|
+
}
|
|
23
|
+
if (paginateExpandedRows !== true) {
|
|
24
|
+
// Only expand rows at this point if they are being paginated
|
|
25
|
+
return rowModel;
|
|
26
|
+
}
|
|
27
|
+
return expandRows(rowModel);
|
|
29
28
|
}, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel'));
|
|
29
|
+
};
|
|
30
30
|
}
|
|
31
31
|
export function expandRows(rowModel) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
32
|
+
var expandedRows = [];
|
|
33
|
+
var _handleRow = function handleRow(row) {
|
|
34
|
+
var _row$subRows, _row$subRows2;
|
|
35
|
+
if (!row.getIsExpanded()) {
|
|
36
|
+
expandedRows.push(row);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// @ts-expect-error
|
|
41
|
+
var topSubRows = ((_row$subRows = row.subRows) !== null && _row$subRows !== void 0 ? _row$subRows : []).filter(function (subRow) {
|
|
42
|
+
var _subRow$original;
|
|
43
|
+
return (_subRow$original = subRow.original) === null || _subRow$original === void 0 ? void 0 : _subRow$original.isTopSubRow;
|
|
44
|
+
});
|
|
45
|
+
if (topSubRows.length > 0) {
|
|
46
|
+
// Needs to be split into dummy and non-dummy rows to ensure that the dummy rows are rendered at the top.
|
|
47
|
+
// @ts-expect-error
|
|
48
|
+
var dummyRows = topSubRows.filter(function (subRow) {
|
|
49
|
+
return 'size' in subRow.original;
|
|
50
|
+
});
|
|
51
|
+
// @ts-expect-error
|
|
52
|
+
var nonDummyRows = topSubRows.filter(function (subRow) {
|
|
53
|
+
return !('size' in subRow.original);
|
|
54
|
+
});
|
|
55
|
+
dummyRows.forEach(_handleRow);
|
|
56
|
+
nonDummyRows.forEach(_handleRow);
|
|
57
|
+
}
|
|
58
|
+
expandedRows.push(row);
|
|
59
|
+
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
var bottomSubRows = ((_row$subRows2 = row.subRows) !== null && _row$subRows2 !== void 0 ? _row$subRows2 : []).filter(function (subRow) {
|
|
62
|
+
var _subRow$original2;
|
|
63
|
+
return (_subRow$original2 = subRow.original) === null || _subRow$original2 === void 0 ? void 0 : _subRow$original2.isBottomSubRow;
|
|
64
|
+
});
|
|
65
|
+
if (bottomSubRows.length > 0) {
|
|
66
|
+
// Needs to be split into dummy and non-dummy rows to ensure that the dummy rows are rendered at the bottom.
|
|
67
|
+
// @ts-expect-error
|
|
68
|
+
var _dummyRows = bottomSubRows.filter(function (subRow) {
|
|
69
|
+
return 'size' in subRow.original;
|
|
70
|
+
});
|
|
71
|
+
// @ts-expect-error
|
|
72
|
+
var _nonDummyRows = bottomSubRows.filter(function (subRow) {
|
|
73
|
+
return !('size' in subRow.original);
|
|
74
|
+
});
|
|
75
|
+
_nonDummyRows.forEach(_handleRow);
|
|
76
|
+
_dummyRows.forEach(_handleRow);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
rowModel.rows.forEach(_handleRow);
|
|
80
|
+
return {
|
|
81
|
+
rows: expandedRows,
|
|
82
|
+
flatRows: rowModel.flatRows,
|
|
83
|
+
rowsById: rowModel.rowsById
|
|
84
|
+
};
|
|
85
|
+
}
|