@kylincloud/flamegraph 0.35.22 → 0.35.24
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 +22 -0
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts +6 -1
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts.map +1 -1
- package/dist/FlameGraph/FlameGraphComponent/FlamegraphBreadcrumb.d.ts +16 -0
- package/dist/FlameGraph/FlameGraphComponent/FlamegraphBreadcrumb.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts +8 -0
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts.map +1 -1
- package/dist/FlameGraph/FlameGraphComponent/index.d.ts +13 -0
- package/dist/FlameGraph/FlameGraphComponent/index.d.ts.map +1 -1
- package/dist/FlameGraph/FlameGraphRenderer.d.ts +13 -1
- package/dist/FlameGraph/FlameGraphRenderer.d.ts.map +1 -1
- package/dist/ProfilerTable.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/format/format.d.ts +14 -0
- package/dist/format/format.d.ts.map +1 -1
- package/dist/i18n.d.ts +9 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +4 -4
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +4 -4
- package/dist/index.node.esm.js.map +1 -1
- package/dist/shims/Table.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/FlameGraph/FlameGraphComponent/Flamegraph.ts +7 -2
- package/src/FlameGraph/FlameGraphComponent/FlamegraphBreadcrumb.module.scss +106 -0
- package/src/FlameGraph/FlameGraphComponent/FlamegraphBreadcrumb.tsx +98 -0
- package/src/FlameGraph/FlameGraphComponent/Flamegraph_render.ts +54 -23
- package/src/FlameGraph/FlameGraphComponent/index.tsx +46 -3
- package/src/FlameGraph/FlameGraphRenderer.tsx +211 -6
- package/src/ProfilerTable.module.scss +1 -2
- package/src/ProfilerTable.tsx +52 -46
- package/src/Tooltip/Tooltip.tsx +1 -75
- package/src/format/format.ts +98 -0
- package/src/i18n.tsx +39 -0
- package/src/shims/Table.module.scss +9 -2
- package/src/shims/Table.tsx +44 -40
package/src/shims/Table.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/shims/Table.tsx
|
|
2
2
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
3
|
-
import React, { useState, ReactNode, CSSProperties, RefObject } from 'react';
|
|
3
|
+
import React, { useState, useRef, ReactNode, CSSProperties, RefObject } from 'react';
|
|
4
4
|
import { faChevronLeft } from '@fortawesome/free-solid-svg-icons/faChevronLeft';
|
|
5
5
|
import { faChevronRight } from '@fortawesome/free-solid-svg-icons/faChevronRight';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -94,6 +94,46 @@ interface TableProps {
|
|
|
94
94
|
itemsPerPage?: number;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* 表格行组件
|
|
99
|
+
* 单击立即高亮,双击同时触发高亮和聚焦
|
|
100
|
+
*/
|
|
101
|
+
function TableRow({ row }: { row: BodyRow }) {
|
|
102
|
+
const {
|
|
103
|
+
cells,
|
|
104
|
+
isRowSelected,
|
|
105
|
+
isRowDisabled,
|
|
106
|
+
className,
|
|
107
|
+
onClick,
|
|
108
|
+
onDoubleClick,
|
|
109
|
+
onContextMenu,
|
|
110
|
+
...rest
|
|
111
|
+
} = row;
|
|
112
|
+
|
|
113
|
+
const renderID = useRef(Math.random()).current;
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<tr
|
|
117
|
+
{...rest}
|
|
118
|
+
onClick={onClick}
|
|
119
|
+
onDoubleClick={onDoubleClick}
|
|
120
|
+
onContextMenu={onContextMenu}
|
|
121
|
+
className={clsx(className, {
|
|
122
|
+
[styles.isRowSelected]: isRowSelected,
|
|
123
|
+
[styles.isRowDisabled]: isRowDisabled,
|
|
124
|
+
})}
|
|
125
|
+
>
|
|
126
|
+
{cells &&
|
|
127
|
+
cells.map(({ style, value, ...cellRest }: Cell, index: number) => (
|
|
128
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
129
|
+
<td key={renderID + index} style={style} {...cellRest}>
|
|
130
|
+
{value}
|
|
131
|
+
</td>
|
|
132
|
+
))}
|
|
133
|
+
</tr>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
97
137
|
function Table({
|
|
98
138
|
sortByDirection,
|
|
99
139
|
sortBy,
|
|
@@ -154,45 +194,9 @@ function Table({
|
|
|
154
194
|
</tr>
|
|
155
195
|
) : (
|
|
156
196
|
paginate(table.bodyRows, currPage, itemsPerPage).map(
|
|
157
|
-
(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
isRowDisabled,
|
|
161
|
-
className,
|
|
162
|
-
onClick,
|
|
163
|
-
onDoubleClick,
|
|
164
|
-
onContextMenu,
|
|
165
|
-
...rest
|
|
166
|
-
}) => {
|
|
167
|
-
// The problem is that when you switch apps or time-range and the function
|
|
168
|
-
// names stay the same it leads to an issue where rows don't get re-rendered
|
|
169
|
-
// So we force a rerender each time.
|
|
170
|
-
const renderID = Math.random();
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<tr
|
|
174
|
-
key={renderID}
|
|
175
|
-
{...rest}
|
|
176
|
-
onClick={onClick}
|
|
177
|
-
onDoubleClick={onDoubleClick}
|
|
178
|
-
onContextMenu={onContextMenu}
|
|
179
|
-
className={clsx(className, {
|
|
180
|
-
[styles.isRowSelected]: isRowSelected,
|
|
181
|
-
[styles.isRowDisabled]: isRowDisabled,
|
|
182
|
-
})}
|
|
183
|
-
>
|
|
184
|
-
{cells &&
|
|
185
|
-
cells.map(
|
|
186
|
-
({ style, value, ...rest }: Cell, index: number) => (
|
|
187
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
188
|
-
<td key={renderID + index} style={style} {...rest}>
|
|
189
|
-
{value}
|
|
190
|
-
</td>
|
|
191
|
-
)
|
|
192
|
-
)}
|
|
193
|
-
</tr>
|
|
194
|
-
);
|
|
195
|
-
}
|
|
197
|
+
(row, idx) => (
|
|
198
|
+
<TableRow key={row['data-row'] ?? `row-${idx}`} row={row} />
|
|
199
|
+
)
|
|
196
200
|
)
|
|
197
201
|
)}
|
|
198
202
|
</tbody>
|