@bundle-stats/ui 4.13.0-beta.0 → 4.13.0-beta.10
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/lib/app/app.js +4 -8
- package/lib/app/app.js.map +1 -1
- package/lib/app/app.module.css +2 -2
- package/lib/components/bundle-assets/bundle-assets.js +12 -5
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib/components/bundle-assets/index.js +2 -2
- package/lib/components/bundle-assets/index.js.map +1 -1
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js +22 -11
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +22 -12
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.module.css +0 -5
- package/lib/components/bundle-modules/index.js +2 -2
- package/lib/components/bundle-modules/index.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +10 -3
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.module.css +0 -5
- package/lib/components/bundle-packages/index.js +2 -2
- package/lib/components/bundle-packages/index.js.map +1 -1
- package/lib/components/index.js +1 -3
- package/lib/components/index.js.map +1 -1
- package/lib/components/jobs-header/jobs-header.module.css +0 -4
- package/lib/components/metrics-display-selector/metrics-display-selector.js +4 -10
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.i18n.js +1 -6
- package/lib/components/metrics-table/metrics-table.i18n.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.js +4 -37
- package/lib/components/metrics-table/metrics-table.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.module.css +1 -44
- package/lib/components/{total-size-type-title → metrics-table-header}/index.js +1 -1
- package/lib/components/metrics-table-header/index.js.map +1 -0
- package/lib/components/metrics-table-header/metrics-table-header.i18n.js +9 -0
- package/lib/components/metrics-table-header/metrics-table-header.i18n.js.map +1 -0
- package/lib/components/metrics-table-header/metrics-table-header.js +79 -0
- package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -0
- package/lib/components/metrics-table-header/metrics-table-header.module.css +51 -0
- package/lib/components/metrics-table-options/metrics-table-options.js +2 -2
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.module.css +4 -4
- package/lib/components/metrics-treemap/metrics-treemap.js +66 -51
- package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.module.css +89 -56
- package/lib/components/sort-button/sort-button.module.css +1 -0
- package/lib/css/variables.css +11 -11
- package/lib/hooks/entry-info.js +12 -0
- package/lib/hooks/entry-info.js.map +1 -0
- package/lib/layout/flex-stack/flex-stack.js +3 -4
- package/lib/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib/layout/flex-stack/flex-stack.module.css +19 -23
- package/lib/query-state.js +1 -1
- package/lib/query-state.js.map +1 -1
- package/lib/ui/button/button.module.css +1 -0
- package/lib/ui/dropdown/dropdown.js +10 -40
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/index.js.map +1 -1
- package/lib/ui/filters/filters.js +33 -35
- package/lib/ui/filters/filters.js.map +1 -1
- package/lib/ui/filters/filters.module.css +55 -67
- package/lib/ui/hover-card/hover-card.js +1 -1
- package/lib/ui/hover-card/hover-card.js.map +1 -1
- package/lib/ui/toolbar/toolbar.module.css +1 -3
- package/lib-esm/app/app.js +4 -8
- package/lib-esm/app/app.js.map +1 -1
- package/lib-esm/app/app.module.css +2 -2
- package/lib-esm/components/bundle-assets/bundle-assets.js +12 -5
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib-esm/components/bundle-assets/index.js +3 -3
- package/lib-esm/components/bundle-assets/index.js.map +1 -1
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +23 -12
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +22 -12
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +0 -5
- package/lib-esm/components/bundle-modules/index.js +2 -2
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +10 -3
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +0 -5
- package/lib-esm/components/bundle-packages/index.js +3 -3
- package/lib-esm/components/bundle-packages/index.js.map +1 -1
- package/lib-esm/components/index.js +0 -1
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/jobs-header/jobs-header.module.css +0 -4
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +4 -10
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.i18n.js +0 -5
- package/lib-esm/components/metrics-table/metrics-table.i18n.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.js +4 -37
- package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.module.css +1 -44
- package/lib-esm/components/metrics-table-header/index.js +2 -0
- package/lib-esm/components/metrics-table-header/index.js.map +1 -0
- package/lib-esm/components/metrics-table-header/metrics-table-header.i18n.js +6 -0
- package/lib-esm/components/metrics-table-header/metrics-table-header.i18n.js.map +1 -0
- package/lib-esm/components/metrics-table-header/metrics-table-header.js +49 -0
- package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -0
- package/lib-esm/components/metrics-table-header/metrics-table-header.module.css +51 -0
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +3 -3
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +4 -4
- package/lib-esm/components/metrics-treemap/metrics-treemap.js +69 -53
- package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +89 -56
- package/lib-esm/components/sort-button/sort-button.module.css +1 -0
- package/lib-esm/css/variables.css +11 -11
- package/lib-esm/hooks/entry-info.js +8 -0
- package/lib-esm/hooks/entry-info.js.map +1 -0
- package/lib-esm/layout/flex-stack/flex-stack.js +3 -4
- package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib-esm/layout/flex-stack/flex-stack.module.css +19 -23
- package/lib-esm/query-state.js +1 -1
- package/lib-esm/query-state.js.map +1 -1
- package/lib-esm/ui/button/button.module.css +1 -0
- package/lib-esm/ui/dropdown/dropdown.js +8 -39
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/index.js.map +1 -1
- package/lib-esm/ui/filters/filters.js +34 -36
- package/lib-esm/ui/filters/filters.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +55 -67
- package/lib-esm/ui/hover-card/hover-card.js +1 -1
- package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
- package/lib-esm/ui/toolbar/toolbar.module.css +1 -3
- package/package.json +8 -10
- package/src/app/app.jsx +4 -12
- package/src/app/app.module.css +2 -2
- package/src/components/bundle-assets/bundle-assets.jsx +24 -7
- package/src/components/bundle-assets/bundle-assets.module.css +0 -5
- package/src/components/bundle-assets/index.jsx +8 -3
- package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +55 -24
- package/src/components/bundle-modules/bundle-modules.module.css +0 -5
- package/src/components/bundle-modules/bundle-modules.tsx +60 -42
- package/src/components/bundle-modules/index.tsx +2 -2
- package/src/components/bundle-packages/bundle-packages.jsx +19 -5
- package/src/components/bundle-packages/bundle-packages.module.css +0 -5
- package/src/components/bundle-packages/index.jsx +8 -3
- package/src/components/index.js +0 -1
- package/src/components/jobs-header/jobs-header.module.css +0 -4
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +8 -12
- package/src/components/metrics-table/metrics-table.i18n.ts +0 -7
- package/src/components/metrics-table/metrics-table.module.css +1 -44
- package/src/components/metrics-table/metrics-table.tsx +17 -153
- package/src/components/metrics-table-header/index.ts +1 -0
- package/src/components/metrics-table-header/metrics-table-header.i18n.ts +6 -0
- package/src/components/metrics-table-header/metrics-table-header.module.css +51 -0
- package/src/components/metrics-table-header/metrics-table-header.tsx +172 -0
- package/src/components/metrics-table-options/metrics-table-options.jsx +4 -10
- package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.module.css +4 -4
- package/src/components/metrics-treemap/metrics-treemap.module.css +89 -56
- package/src/components/metrics-treemap/metrics-treemap.tsx +151 -118
- package/src/components/sort-button/sort-button.module.css +1 -0
- package/src/css/variables.css +11 -11
- package/src/hooks/entry-info.ts +19 -0
- package/src/layout/flex-stack/flex-stack.module.css +19 -23
- package/src/layout/flex-stack/flex-stack.tsx +2 -8
- package/src/query-state.tsx +1 -1
- package/src/ui/button/button.module.css +1 -0
- package/src/ui/dropdown/dropdown.stories.tsx +25 -0
- package/src/ui/dropdown/dropdown.tsx +66 -0
- package/src/ui/filters/filters.module.css +55 -67
- package/src/ui/filters/filters.stories.tsx +109 -0
- package/src/ui/filters/filters.tsx +128 -167
- package/src/ui/hover-card/hover-card.tsx +1 -1
- package/src/ui/toolbar/toolbar.module.css +1 -3
- package/types/components/bundle-assets-totals/bundle-assets-totals.d.ts +5 -1
- package/types/components/index.d.ts +0 -1
- package/types/components/metrics-display-selector/metrics-display-selector.d.ts +2 -2
- package/types/components/metrics-table/metrics-table.d.ts +4 -10
- package/types/components/metrics-table/metrics-table.i18n.d.ts +0 -5
- package/types/components/metrics-table-header/index.d.ts +1 -0
- package/types/components/metrics-table-header/metrics-table-header.d.ts +15 -0
- package/types/components/metrics-table-header/metrics-table-header.i18n.d.ts +5 -0
- package/types/hooks/entry-info.d.ts +8 -0
- package/types/ui/dropdown/dropdown.d.ts +12 -47
- package/types/ui/dropdown/index.d.ts +1 -1
- package/types/ui/filters/filters.d.ts +2 -7
- package/lib/components/bundle-assets-totals/bundle-assets-totals.module.css +0 -7
- package/lib/components/total-size-type-title/index.js.map +0 -1
- package/lib/components/total-size-type-title/total-size-type-title.js +0 -32
- package/lib/components/total-size-type-title/total-size-type-title.js.map +0 -1
- package/lib/components/total-size-type-title/total-size-type-title.module.css +0 -14
- package/lib/hooks/show-entry.js +0 -13
- package/lib/hooks/show-entry.js.map +0 -1
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.module.css +0 -7
- package/lib-esm/components/total-size-type-title/index.js +0 -2
- package/lib-esm/components/total-size-type-title/index.js.map +0 -1
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +0 -25
- package/lib-esm/components/total-size-type-title/total-size-type-title.js.map +0 -1
- package/lib-esm/components/total-size-type-title/total-size-type-title.module.css +0 -14
- package/lib-esm/hooks/show-entry.js +0 -9
- package/lib-esm/hooks/show-entry.js.map +0 -1
- package/src/components/bundle-assets-totals/bundle-assets-totals.module.css +0 -7
- package/src/components/total-size-type-title/index.js +0 -1
- package/src/components/total-size-type-title/total-size-type-title.jsx +0 -41
- package/src/components/total-size-type-title/total-size-type-title.module.css +0 -14
- package/src/hooks/show-entry.ts +0 -17
- package/src/ui/dropdown/dropdown.jsx +0 -88
- package/types/components/total-size-type-title/index.d.ts +0 -1
- package/types/components/total-size-type-title/total-size-type-title.d.ts +0 -14
- package/types/hooks/show-entry.d.ts +0 -10
- /package/src/ui/dropdown/{index.js → index.ts} +0 -0
|
@@ -1,47 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
import sum from 'lodash/sum';
|
|
5
|
-
import { METRIC_TYPE_CONFIGS, MetricTypes, getMetricRunInfo, } from '@bundle-stats/utils';
|
|
6
4
|
import { Button } from '../../ui/button';
|
|
7
5
|
import { Icon } from '../../ui/icon';
|
|
8
6
|
import { Table } from '../../ui/table';
|
|
9
7
|
import { Stack } from '../../layout/stack';
|
|
10
8
|
import { Metric } from '../metric';
|
|
11
9
|
import { Delta } from '../delta';
|
|
12
|
-
import {
|
|
13
|
-
import { SortButton } from '../sort-button';
|
|
10
|
+
import { MetricsTableHeader } from '../metrics-table-header';
|
|
14
11
|
import * as I18N from './metrics-table.i18n';
|
|
15
12
|
import css from './metrics-table.module.css';
|
|
16
|
-
const METRIC_TYPE = METRIC_TYPE_CONFIGS[MetricTypes.FileSize];
|
|
17
13
|
const VISIBLE_COUNT = 500;
|
|
18
14
|
const BASELINE_COLUMN_SPAN = 1;
|
|
19
15
|
const CURRENT_COLUMN_SPAN = 3;
|
|
20
|
-
const getRowsRunTotal = (rows, runIndex) => sum(rows.map((row) => { var _a, _b; return ((_b = (_a = row === null || row === void 0 ? void 0 : row.runs) === null || _a === void 0 ? void 0 : _a[runIndex]) === null || _b === void 0 ? void 0 : _b.value) || 0; }));
|
|
21
|
-
const JobColumn = ({ run, isBaseline }) => {
|
|
22
|
-
const colSpan = isBaseline ? BASELINE_COLUMN_SPAN : CURRENT_COLUMN_SPAN;
|
|
23
|
-
const { label, internalBuildNumber } = run;
|
|
24
|
-
if (!run) {
|
|
25
|
-
return React.createElement(Table.Th, { colSpan: colSpan }, "-");
|
|
26
|
-
}
|
|
27
|
-
return (React.createElement(Table.Th, { className: css.jobCol, colSpan: colSpan },
|
|
28
|
-
React.createElement(JobName, { title: isBaseline ? I18N.BASELINE_TITLE : I18N.CURRENT_TITLE, internalBuildNumber: internalBuildNumber, className: css.jobName }, label)));
|
|
29
|
-
};
|
|
30
|
-
const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }) => {
|
|
31
|
-
const currentRunTotal = getRowsRunTotal(rows, runIndex);
|
|
32
|
-
const baselineRunTotal = !isBaseline ? getRowsRunTotal(rows, runIndex + 1) : 0;
|
|
33
|
-
const total = getMetricRunInfo(METRIC_TYPE, currentRunTotal, baselineRunTotal);
|
|
34
|
-
const fieldPath = `runs[${runIndex}]`;
|
|
35
|
-
return (React.createElement(React.Fragment, null,
|
|
36
|
-
React.createElement(Table.Th, { className: cx(css.value, css.sum) },
|
|
37
|
-
React.createElement(SortButton, { fieldPath: fieldPath, fieldName: "value", label: I18N.SORT_VALUE, updateSort: updateSort, sort: sort },
|
|
38
|
-
React.createElement(Metric, { value: total.displayValue }))),
|
|
39
|
-
!isBaseline && (React.createElement(React.Fragment, null,
|
|
40
|
-
React.createElement(Table.Th, { className: cx(css.delta, css.sum) },
|
|
41
|
-
React.createElement(SortButton, { fieldPath: fieldPath, fieldName: "delta", label: I18N.SORT_CHANGE, updateSort: updateSort, sort: sort }, 'delta' in total && (React.createElement(Delta, { displayValue: total.displayDelta, deltaType: total.deltaType })))),
|
|
42
|
-
React.createElement(Table.Th, { className: cx(css.delta, css.deltaPercentage, css.sum) },
|
|
43
|
-
React.createElement(SortButton, { fieldPath: fieldPath, fieldName: "deltaPercentage", label: I18N.SORT_PERCENTUAL_CHANGE, updateSort: updateSort, sort: sort }, 'delta' in total && (React.createElement(Delta, { displayValue: total.displayDeltaPercentage, deltaType: total.deltaType }))))))));
|
|
44
|
-
};
|
|
45
16
|
const Row = ({ className = '', item, renderHeader, ...restProps }) => (React.createElement(Table.Tr, { className: cx(!item.changed && css.unchanged, className), ...restProps },
|
|
46
17
|
React.createElement(Table.Th, { className: css.metricName }, renderHeader(item)),
|
|
47
18
|
item.runs.map((run, index) => {
|
|
@@ -60,19 +31,15 @@ const Row = ({ className = '', item, renderHeader, ...restProps }) => (React.cre
|
|
|
60
31
|
React.createElement(Table.Td, { className: css.delta }, 'delta' in run && (React.createElement(Delta, { displayValue: run.displayDelta, deltaType: run.deltaType }))),
|
|
61
32
|
React.createElement(Table.Td, { className: cx(css.delta, css.deltaPercentage) }, 'delta' in run && (React.createElement(Delta, { displayValue: run.displayDeltaPercentage, deltaType: run.deltaType })))))));
|
|
62
33
|
})));
|
|
63
|
-
export const MetricsTable = ({ className = '', runs, items, showHeaderSum = false, title
|
|
34
|
+
export const MetricsTable = ({ className = '', runs, items, showHeaderSum = false, title, sort, updateSort, renderRowHeader = (item) => item.label, emptyMessage = I18N.EMPTY_MESSAGE, showAllItems, setShowAllItems, ...restProps }) => {
|
|
64
35
|
const columnCount = (runs.length - 1) * CURRENT_COLUMN_SPAN + BASELINE_COLUMN_SPAN + 1;
|
|
65
|
-
const rootClassName = cx(css.root, className, runs.length > 1 && css.multipleRuns
|
|
36
|
+
const rootClassName = cx(css.root, className, runs.length > 1 && css.multipleRuns);
|
|
66
37
|
const showEmpty = isEmpty(items);
|
|
67
38
|
const showItems = !showEmpty;
|
|
68
39
|
const hasHiddenItems = (items === null || items === void 0 ? void 0 : items.length) > VISIBLE_COUNT;
|
|
69
40
|
const visibleItems = !hasHiddenItems || showAllItems ? items : items === null || items === void 0 ? void 0 : items.slice(0, VISIBLE_COUNT);
|
|
70
41
|
return (React.createElement(Table, { className: rootClassName, compact: true, ...restProps },
|
|
71
|
-
React.createElement(
|
|
72
|
-
React.createElement(Table.Tr, { className: css.headerRow },
|
|
73
|
-
React.createElement(Table.Th, { className: css.metricName, rowSpan: showHeaderSum ? 2 : 1 }, title || ' '),
|
|
74
|
-
runs.map((run, runIndex) => (React.createElement(JobColumn, { run: run, isBaseline: runIndex === runs.length - 1 })))),
|
|
75
|
-
showHeaderSum && (React.createElement(Table.Tr, { className: css.headerRow }, runs.map((_, runIndex) => (React.createElement(SumColumn, { rows: items, isBaseline: runIndex === runs.length - 1, runIndex: runIndex, updateSort: updateSort, sort: sort })))))),
|
|
42
|
+
React.createElement(MetricsTableHeader, { metricTitle: title, showSum: showHeaderSum, jobs: runs, rows: items, sort: sort, updateSort: updateSort }),
|
|
76
43
|
React.createElement(Table.TBody, null,
|
|
77
44
|
showEmpty && (React.createElement(Table.Tr, null,
|
|
78
45
|
React.createElement(Table.Td, { className: css.empty, colSpan: columnCount },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-table.js","sourceRoot":"","sources":["../../../src/components/metrics-table/metrics-table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,OAAO,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics-table.js","sourceRoot":"","sources":["../../../src/components/metrics-table/metrics-table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAE7C,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAO9B,MAAM,GAAG,GAAG,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,IAAI,EAAE,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AAC,eAAe,CAAC,KAAK,CAAC,EACrC,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,SAAS,CACR,CACV,CAAC,CAAC,CAAC,CACF,oBAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,SAAS,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EACpC,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,QAAQ,CACP,CACV,CACQ,CACF,CACZ,CACA,CACJ,CACW,CACR,CACT,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -10,52 +10,9 @@
|
|
|
10
10
|
text-decoration: underline;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
.metricName {
|
|
15
|
-
width: 55%;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.root .jobCol {
|
|
19
|
-
text-align: right;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.root .value {
|
|
23
|
-
text-align: right;
|
|
24
|
-
vertical-align: baseline;
|
|
25
|
-
width: 15%;
|
|
26
|
-
}
|
|
27
|
-
|
|
13
|
+
.root .value,
|
|
28
14
|
.root .delta {
|
|
29
15
|
text-align: right;
|
|
30
|
-
font-size: var(--size-xsmall);
|
|
31
|
-
vertical-align: baseline;
|
|
32
|
-
width: 10%;
|
|
33
|
-
color: pink;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.root .deltaPercentage {
|
|
37
|
-
width: 5%;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.root tbody .delta {
|
|
41
|
-
line-height: 1.6rem; /* baseline alignment with the column value */
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.jobName {
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* columns overrides for showHeaderSum */
|
|
49
|
-
.showHeaderSum .headerRow .jobCol {
|
|
50
|
-
border-bottom: 0;
|
|
51
|
-
padding-bottom: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.showHeaderSum .headerRow .sum {
|
|
55
|
-
padding-top: var(--space-xxxsmall);
|
|
56
|
-
font-size: var(--size-small);
|
|
57
|
-
vertical-align: middle;
|
|
58
|
-
text-transform: none;
|
|
59
16
|
}
|
|
60
17
|
|
|
61
18
|
/** rows */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/metrics-table-header/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const BASELINE_TITLE = 'Baseline';
|
|
2
|
+
export const CURRENT_TITLE = 'Current';
|
|
3
|
+
export const SORT_VALUE = 'value';
|
|
4
|
+
export const SORT_CHANGE = 'change';
|
|
5
|
+
export const SORT_PERCENTUAL_CHANGE = 'percentual change';
|
|
6
|
+
//# sourceMappingURL=metrics-table-header.i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-table-header.i18n.js","sourceRoot":"","sources":["../../../src/components/metrics-table-header/metrics-table-header.i18n.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AACpC,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import sum from 'lodash/sum';
|
|
4
|
+
import { METRIC_TYPE_CONFIGS, MetricTypes, getMetricRunInfo, } from '@bundle-stats/utils';
|
|
5
|
+
import { Table } from '../../ui/table';
|
|
6
|
+
import { Delta } from '../delta';
|
|
7
|
+
import { JobName } from '../job-name';
|
|
8
|
+
import { Metric } from '../metric';
|
|
9
|
+
import { SortButton } from '../sort-button';
|
|
10
|
+
import * as I18N from './metrics-table-header.i18n';
|
|
11
|
+
import css from './metrics-table-header.module.css';
|
|
12
|
+
const METRIC_TYPE = METRIC_TYPE_CONFIGS[MetricTypes.FileSize];
|
|
13
|
+
const BASELINE_COLUMN_SPAN = 1;
|
|
14
|
+
const CURRENT_COLUMN_SPAN = 3;
|
|
15
|
+
const JobColumn = ({ job, isBaseline }) => {
|
|
16
|
+
const colSpan = isBaseline ? BASELINE_COLUMN_SPAN : CURRENT_COLUMN_SPAN;
|
|
17
|
+
const { label, internalBuildNumber } = job;
|
|
18
|
+
if (!job) {
|
|
19
|
+
return React.createElement(Table.Th, { colSpan: colSpan }, "-");
|
|
20
|
+
}
|
|
21
|
+
return (React.createElement(Table.Th, { className: cx(css.col, css.job), colSpan: colSpan },
|
|
22
|
+
React.createElement(JobName, { title: isBaseline ? I18N.BASELINE_TITLE : I18N.CURRENT_TITLE, internalBuildNumber: internalBuildNumber, className: css.jobName }, label)));
|
|
23
|
+
};
|
|
24
|
+
const getRowsRunTotal = (rows, runIndex) => sum(rows.map((row) => { var _a, _b; return ((_b = (_a = row === null || row === void 0 ? void 0 : row.runs) === null || _a === void 0 ? void 0 : _a[runIndex]) === null || _b === void 0 ? void 0 : _b.value) || 0; }));
|
|
25
|
+
const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }) => {
|
|
26
|
+
const currentRunTotal = getRowsRunTotal(rows, runIndex);
|
|
27
|
+
const baselineRunTotal = !isBaseline ? getRowsRunTotal(rows, runIndex + 1) : 0;
|
|
28
|
+
const total = getMetricRunInfo(METRIC_TYPE, currentRunTotal, baselineRunTotal);
|
|
29
|
+
const fieldPath = `runs[${runIndex}]`;
|
|
30
|
+
return (React.createElement(React.Fragment, null,
|
|
31
|
+
React.createElement(Table.Th, { className: cx(css.col, css.value, css.sum) },
|
|
32
|
+
React.createElement(SortButton, { fieldPath: fieldPath, fieldName: "value", label: I18N.SORT_VALUE, updateSort: updateSort, sort: sort },
|
|
33
|
+
React.createElement(Metric, { value: total.displayValue }))),
|
|
34
|
+
!isBaseline && (React.createElement(React.Fragment, null,
|
|
35
|
+
React.createElement(Table.Th, { className: cx(css.col, css.delta, css.sum) },
|
|
36
|
+
React.createElement(SortButton, { fieldPath: fieldPath, fieldName: "delta", label: I18N.SORT_CHANGE, updateSort: updateSort, sort: sort }, 'delta' in total && (React.createElement(Delta, { displayValue: total.displayDelta, deltaType: total.deltaType })))),
|
|
37
|
+
React.createElement(Table.Th, { className: cx(css.col, css.delta, css.deltaPercentage, css.sum) },
|
|
38
|
+
React.createElement(SortButton, { fieldPath: fieldPath, fieldName: "deltaPercentage", label: I18N.SORT_PERCENTUAL_CHANGE, updateSort: updateSort, sort: sort }, 'delta' in total && (React.createElement(Delta, { displayValue: total.displayDeltaPercentage, deltaType: total.deltaType }))))))));
|
|
39
|
+
};
|
|
40
|
+
export const MetricsTableHeader = (props) => {
|
|
41
|
+
const { className = '', metricTitle = '', showSum = false, jobs, rows, sort, updateSort } = props;
|
|
42
|
+
const rootClassName = cx(css.root, showSum && css.showHeaderSum, className);
|
|
43
|
+
return (React.createElement(Table.THead, { className: rootClassName },
|
|
44
|
+
React.createElement(Table.Tr, null,
|
|
45
|
+
React.createElement(Table.Th, { className: cx(css.col, css.metric), rowSpan: showSum ? 2 : 1 }, metricTitle || ' '),
|
|
46
|
+
jobs.map((job, runIndex) => (React.createElement(JobColumn, { job: job, isBaseline: runIndex === jobs.length - 1 })))),
|
|
47
|
+
showSum && (React.createElement(Table.Tr, null, jobs.map((_, runIndex) => (React.createElement(SumColumn, { rows: rows, isBaseline: runIndex === jobs.length - 1, runIndex: runIndex, updateSort: updateSort, sort: sort })))))));
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=metrics-table-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-table-header.js","sourceRoot":"","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
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.root .job {
|
|
13
|
+
padding-top: var(--space-xxsmall);
|
|
14
|
+
text-align: right;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.root .value {
|
|
18
|
+
text-align: right;
|
|
19
|
+
vertical-align: baseline;
|
|
20
|
+
width: 15%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.root .delta {
|
|
24
|
+
text-align: right;
|
|
25
|
+
font-size: var(--size-xsmall);
|
|
26
|
+
vertical-align: baseline;
|
|
27
|
+
width: 10%;
|
|
28
|
+
color: pink;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.root .deltaPercentage {
|
|
32
|
+
width: 5%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.jobName {
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* columns overrides for showHeaderSum */
|
|
40
|
+
.showHeaderSum .job {
|
|
41
|
+
border-bottom: 0;
|
|
42
|
+
padding-bottom: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.showHeaderSum .sum {
|
|
46
|
+
padding-top: 0;
|
|
47
|
+
font-size: var(--size-small);
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
text-transform: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import I18N from '../../i18n';
|
|
4
|
-
import { Dropdown } from '../../ui/dropdown';
|
|
4
|
+
import { Dropdown, DropdownItem } from '../../ui/dropdown';
|
|
5
5
|
export const MetricsTableOptions = (props) => {
|
|
6
6
|
const { className, handleViewAll, handleResetFilters, ...restProps } = props;
|
|
7
7
|
return (React.createElement(Dropdown, { className: className, glyph: "more-vertical", ...restProps },
|
|
8
|
-
handleResetFilters && (React.createElement(
|
|
9
|
-
handleViewAll &&
|
|
8
|
+
handleResetFilters && (React.createElement(DropdownItem, { onClick: handleResetFilters }, I18N.RESET_FILTERS)),
|
|
9
|
+
handleViewAll && React.createElement(DropdownItem, { onClick: handleViewAll }, I18N.VIEW_ALL)));
|
|
10
10
|
};
|
|
11
11
|
MetricsTableOptions.propTypes = {
|
|
12
12
|
className: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-table-options.js","sourceRoot":"","sources":["../../../src/components/metrics-table-options/metrics-table-options.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics-table-options.js","sourceRoot":"","sources":["../../../src/components/metrics-table-options/metrics-table-options.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;IAC3C,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE7E,OAAO,CACL,oBAAC,QAAQ,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAC,eAAe,KAAK,SAAS;QAChE,kBAAkB,IAAI,CACrB,oBAAC,YAAY,IAAC,OAAO,EAAE,kBAAkB,IAAG,IAAI,CAAC,aAAa,CAAgB,CAC/E;QACA,aAAa,IAAI,oBAAC,YAAY,IAAC,OAAO,EAAE,aAAa,IAAG,IAAI,CAAC,QAAQ,CAAgB,CAC7E,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,GAAG;IAC9B,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,aAAa,EAAE,SAAS,CAAC,IAAI;IAC7B,kBAAkB,EAAE,SAAS,CAAC,IAAI;CACnC,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG;IACjC,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;CACzB,CAAC"}
|
|
@@ -11,7 +11,7 @@ import css from './metrics-table-title.module.css';
|
|
|
11
11
|
export const MetricsTableTitle = (props) => {
|
|
12
12
|
const { className, title, info, popoverInfo, popoverHref } = props;
|
|
13
13
|
const rootClassName = cx(css.root, className);
|
|
14
|
-
return (React.createElement(Stack, { space: "
|
|
14
|
+
return (React.createElement(Stack, { space: "none", className: rootClassName },
|
|
15
15
|
React.createElement(FlexStack, { space: "xxxsmall", alignItems: "center", as: "h3", className: css.title },
|
|
16
16
|
React.createElement("span", null, title),
|
|
17
17
|
(popoverInfo || popoverHref) && (React.createElement(HoverCard, { label: React.createElement(Icon, { glyph: Icon.ICONS.HELP, className: css.anchorIcon }), anchorClassName: css.anchor },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-table-title.js","sourceRoot":"","sources":["../../../src/components/metrics-table-title/metrics-table-title.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,GAAG,MAAM,kCAAkC,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,EAAE;IACzC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACnE,MAAM,aAAa,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE9C,OAAO,CACL,oBAAC,KAAK,IAAC,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"metrics-table-title.js","sourceRoot":"","sources":["../../../src/components/metrics-table-title/metrics-table-title.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,GAAG,MAAM,kCAAkC,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,EAAE;IACzC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACnE,MAAM,aAAa,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE9C,OAAO,CACL,oBAAC,KAAK,IAAC,KAAK,EAAC,MAAM,EAAC,SAAS,EAAE,aAAa;QAC1C,oBAAC,SAAS,IAAC,KAAK,EAAC,UAAU,EAA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4
5
|
.title {
|
|
5
|
-
color:
|
|
6
|
+
color: inherit;
|
|
6
7
|
font-size: 1em;
|
|
7
8
|
font-weight: bold;
|
|
8
9
|
text-transform: uppercase;
|
|
@@ -18,8 +19,7 @@
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
.info {
|
|
21
|
-
|
|
22
|
+
font-size: var(--size-small);
|
|
22
23
|
font-family: var(--font-family-fixed);
|
|
23
|
-
font-
|
|
24
|
-
font-weight: bold;
|
|
24
|
+
font-weight: normal;
|
|
25
25
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback, useMemo, useRef
|
|
1
|
+
import React, { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
2
|
+
import { useDebounce, useHoverDirty, useMeasure, useMouseHovered } from 'react-use';
|
|
2
3
|
import cx from 'classnames';
|
|
3
|
-
import { useMeasure } from 'react-use';
|
|
4
4
|
import { hierarchy, treemap, treemapSquarify } from 'd3';
|
|
5
|
-
import {
|
|
6
|
-
import { arrow, offset } from '@floating-ui/react-dom';
|
|
5
|
+
import { Tooltip, TooltipArrow, TooltipAnchor, useTooltipState } from 'ariakit/tooltip';
|
|
7
6
|
import { Stack } from '../../layout/stack';
|
|
8
7
|
import { FileName } from '../../ui/file-name';
|
|
9
8
|
import { Delta } from '../delta';
|
|
10
9
|
import { RunInfo } from '../run-info';
|
|
11
10
|
import css from './metrics-treemap.module.css';
|
|
12
|
-
const SQUARIFY_RATIO = 1.
|
|
11
|
+
const SQUARIFY_RATIO = 1.33;
|
|
13
12
|
const PADDING_OUTER = 0;
|
|
14
|
-
const PADDING_INNER =
|
|
13
|
+
const PADDING_INNER = 2;
|
|
15
14
|
const PADDING_TOP = 4;
|
|
16
15
|
const PADDING_BOTTOM = 2;
|
|
17
16
|
const PADDING_LEFT = 16;
|
|
@@ -19,9 +18,9 @@ const PADDING_RIGHT = 4;
|
|
|
19
18
|
const VERTICAL_SPACING = 4;
|
|
20
19
|
const LINE_HEIGHT = 16;
|
|
21
20
|
const LINE_HEIGHT_SMALL = 13.3;
|
|
22
|
-
function
|
|
21
|
+
function resolveLeafSizeDisplay(width, height) {
|
|
23
22
|
if (height > PADDING_TOP + PADDING_BOTTOM + VERTICAL_SPACING + LINE_HEIGHT * 2 &&
|
|
24
|
-
width > PADDING_LEFT + PADDING_RIGHT +
|
|
23
|
+
width > PADDING_LEFT + PADDING_RIGHT + 128) {
|
|
25
24
|
return 'default';
|
|
26
25
|
}
|
|
27
26
|
if (height > PADDING_TOP + PADDING_BOTTOM + LINE_HEIGHT_SMALL * 2 &&
|
|
@@ -30,54 +29,65 @@ function resolveTileSizeDisplay(width, height) {
|
|
|
30
29
|
}
|
|
31
30
|
return 'minimal';
|
|
32
31
|
}
|
|
33
|
-
const
|
|
34
|
-
const {
|
|
35
|
-
const currentRun =
|
|
36
|
-
const baselineRun =
|
|
37
|
-
return (React.createElement(Stack, { space: "small", className: css.
|
|
38
|
-
React.createElement("h3", { className: css.
|
|
39
|
-
React.createElement(FileName, { as: "code", name:
|
|
32
|
+
const LeafTooltipContent = (props) => {
|
|
33
|
+
const { item } = props;
|
|
34
|
+
const currentRun = item.runs[0];
|
|
35
|
+
const baselineRun = item.runs[item.runs.length - 1];
|
|
36
|
+
return (React.createElement(Stack, { space: "small", className: css.leafTooltipContent },
|
|
37
|
+
React.createElement("h3", { className: css.leafTooltipContentTitle },
|
|
38
|
+
React.createElement(FileName, { as: "code", name: item.label })),
|
|
40
39
|
React.createElement(RunInfo, { current: currentRun.displayValue, delta: currentRun.displayDeltaPercentage, deltaType: currentRun.deltaType, baseline: (baselineRun === null || baselineRun === void 0 ? void 0 : baselineRun.displayValue) || '0B' })));
|
|
41
40
|
};
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const LeafContent = forwardRef((props, ref) => {
|
|
42
|
+
const { sizeDisplay, item, runInfo } = props;
|
|
43
|
+
if (sizeDisplay === 'minimal') {
|
|
44
|
+
return React.createElement("div", { className: css.leafContent, ref: ref });
|
|
45
|
+
}
|
|
46
|
+
return (React.createElement("div", { className: css.leafContent, ref: ref },
|
|
47
|
+
React.createElement(FileName, { as: "p", className: css.leadContentLabel, name: item.label }),
|
|
48
|
+
sizeDisplay !== 'small' && (React.createElement("p", { className: css.leadContentValue },
|
|
49
|
+
React.createElement("span", { className: css.leadContentMetric }, runInfo.displayValue),
|
|
50
|
+
React.createElement(Delta, { className: css.leadContentDelta, displayValue: runInfo.displayDeltaPercentage, deltaType: runInfo.deltaType })))));
|
|
51
|
+
});
|
|
52
|
+
const LeafContentWithTooltip = (props) => {
|
|
53
|
+
const { sizeDisplay, item, runInfo, parentRef } = props;
|
|
54
|
+
const pointer = useMouseHovered(parentRef, { whenHovered: true });
|
|
55
|
+
const getAnchorRect = useCallback(() => {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
if (pointer.docX === 0 && pointer.docY === 0 && pointer.elW === 0 && pointer.elH === 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const newRect = {
|
|
61
|
+
x: pointer.docX - ((_b = (_a = document === null || document === void 0 ? void 0 : document.defaultView) === null || _a === void 0 ? void 0 : _a.scrollX) !== null && _b !== void 0 ? _b : 0),
|
|
62
|
+
y: pointer.docY - ((_d = (_c = document === null || document === void 0 ? void 0 : document.defaultView) === null || _c === void 0 ? void 0 : _c.scrollY) !== null && _d !== void 0 ? _d : 0),
|
|
63
|
+
w: 1,
|
|
64
|
+
h: 1,
|
|
65
|
+
};
|
|
66
|
+
return newRect;
|
|
67
|
+
}, [pointer.docX, pointer.docY]);
|
|
68
|
+
const tooltipState = useTooltipState({ gutter: 12, getAnchorRect, timeout: 120 });
|
|
69
|
+
useDebounce(tooltipState.render, 5, [pointer.docX, pointer.docY]);
|
|
70
|
+
return (React.createElement(React.Fragment, null,
|
|
71
|
+
React.createElement(TooltipAnchor, { state: tooltipState, className: css.leafContentTooltipAnchor },
|
|
72
|
+
React.createElement(LeafContent, { sizeDisplay: sizeDisplay, item: item, runInfo: runInfo })),
|
|
73
|
+
React.createElement(Tooltip, { state: tooltipState, className: css.tooltip },
|
|
74
|
+
React.createElement(TooltipArrow, { state: tooltipState, size: 16, className: css.leafTooltipArrow }),
|
|
75
|
+
React.createElement(LeafTooltipContent, { item: item }))));
|
|
76
|
+
};
|
|
77
|
+
const Leaf = (props) => {
|
|
78
|
+
var _a;
|
|
79
|
+
const { left, top, width, height, data, onClick } = props;
|
|
46
80
|
const { item } = data;
|
|
47
81
|
const runInfo = (_a = item.runs) === null || _a === void 0 ? void 0 : _a[0];
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
middleware: [arrow({ element: arrowRef }), offset(16)],
|
|
55
|
-
});
|
|
56
|
-
const clientPoint = useClientPoint(context);
|
|
57
|
-
const hover = useHover(context);
|
|
58
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([hover, clientPoint]);
|
|
59
|
-
const tileSizeDisplay = useMemo(() => resolveTileSizeDisplay(width, height), [width, height]);
|
|
60
|
-
const handleOnClick = useCallback(() => {
|
|
61
|
-
if (onClick) {
|
|
62
|
-
onClick(item.key);
|
|
63
|
-
}
|
|
64
|
-
}, [item.key]);
|
|
65
|
-
return (React.createElement("g", { className: cx(css.tile, !item.changed && css['tile-NO_CHANGE'], css[`tile-${runInfo.deltaType}`], tileSizeDisplay === 'small' && css.tileSmall) },
|
|
66
|
-
React.createElement("rect", { x: x, y: y, width: width, height: height, className: css.tileOverlay }),
|
|
67
|
-
React.createElement("foreignObject", { height: height, width: width, x: x, y: y },
|
|
68
|
-
React.createElement(TileButton, { onClick: handleOnClick, className: css.tileContent, ref: refs.setReference, ...getReferenceProps() }, tileSizeDisplay !== 'minimal' && (React.createElement("div", { className: css.tileContentWrapper },
|
|
69
|
-
React.createElement("p", { className: css.tileContentLabel }, item.label),
|
|
70
|
-
React.createElement("p", { className: css.tileContentValue },
|
|
71
|
-
React.createElement("span", { className: css.tileContentMetric }, runInfo.displayValue),
|
|
72
|
-
React.createElement(Delta, { className: css.tileContentDelta, displayValue: runInfo.displayDeltaPercentage, deltaType: runInfo.deltaType }))))),
|
|
73
|
-
isOpen && (React.createElement(FloatingPortal, null,
|
|
74
|
-
React.createElement("div", { ref: refs.setFloating, style: floatingStyles, ...getFloatingProps(), className: css.tooltip },
|
|
75
|
-
React.createElement("div", { ref: arrowRef, style: { left: (_b = middlewareData.arrow) === null || _b === void 0 ? void 0 : _b.x }, className: css.tooltipArrow }),
|
|
76
|
-
React.createElement(TooltipContent, { data: item })))))));
|
|
82
|
+
const sizeDisplay = useMemo(() => resolveLeafSizeDisplay(width, height), [width, height]);
|
|
83
|
+
const handleOnClick = useCallback(() => onClick === null || onClick === void 0 ? void 0 : onClick(item.key), [item.key, onClick]);
|
|
84
|
+
const leafContentRef = useRef(null);
|
|
85
|
+
const hover = useHoverDirty(leafContentRef);
|
|
86
|
+
const leafClassName = cx(css.leaf, css[`leaf-${runInfo.deltaType}`], sizeDisplay === 'small' && css.leafSmall, left === 0 && css.leafFirstCol);
|
|
87
|
+
return (React.createElement("button", { type: "button", onClick: handleOnClick, ref: leafContentRef, style: { left, top, width, height }, className: leafClassName }, hover ? (React.createElement(LeafContentWithTooltip, { sizeDisplay: sizeDisplay, item: item, runInfo: runInfo, parentRef: leafContentRef })) : (React.createElement(LeafContent, { sizeDisplay: sizeDisplay, item: item, runInfo: runInfo }))));
|
|
77
88
|
};
|
|
78
|
-
|
|
79
|
-
const {
|
|
80
|
-
const [containerRef, { width, height }] = useMeasure();
|
|
89
|
+
function useMetricsTreemapHierarchy(params) {
|
|
90
|
+
const { items, width, height } = params;
|
|
81
91
|
const treemapHierarchy = useMemo(() => {
|
|
82
92
|
const children = items.map((item) => {
|
|
83
93
|
const values = item.runs.map((run) => (run === null || run === void 0 ? void 0 : run.value) || 0);
|
|
@@ -108,11 +118,17 @@ export const MetricsTreemap = (props) => {
|
|
|
108
118
|
const tremapLayout = createTremapLayout(treemapHierarchy);
|
|
109
119
|
return tremapLayout.leaves().filter((leaf) => Boolean(leaf.parent));
|
|
110
120
|
}, [height, width, treemapHierarchy]);
|
|
111
|
-
return
|
|
121
|
+
return cells;
|
|
122
|
+
}
|
|
123
|
+
export const MetricsTreemap = (props) => {
|
|
124
|
+
const { className = '', items, onItemClick, emptyMessage = 'No data', ...restProps } = props;
|
|
125
|
+
const [containerRef, { width, height }] = useMeasure();
|
|
126
|
+
const cells = useMetricsTreemapHierarchy({ items, width, height });
|
|
127
|
+
return (React.createElement("div", { className: cx(css.root, className), ...restProps, ref: containerRef }, cells.length > 0 ? (React.createElement("div", { className: css.canvas }, cells.map((leaf) => {
|
|
112
128
|
if (!leaf.parent) {
|
|
113
129
|
return null;
|
|
114
130
|
}
|
|
115
|
-
return (React.createElement(
|
|
131
|
+
return (React.createElement(Leaf, { data: leaf.data, left: leaf.x0, top: leaf.y0, width: leaf.x1 - leaf.x0, height: leaf.y1 - leaf.y0, onClick: onItemClick, key: leaf.id }));
|
|
116
132
|
}))) : (React.createElement("div", { className: css.emptyMessage },
|
|
117
133
|
React.createElement("div", { className: css.emptyMessageWrapper }, emptyMessage)))));
|
|
118
134
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-treemap.js","sourceRoot":"","sources":["../../../src/components/metrics-treemap/metrics-treemap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"metrics-treemap.js","sourceRoot":"","sources":["../../../src/components/metrics-treemap/metrics-treemap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,MAAM,YAAY,CAAC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