@bundle-stats/ui 4.4.2 → 4.5.0-beta.0
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/assets/icons.svg +16 -10
- package/lib/assets/icons.svg.js +14 -10
- package/lib/assets/icons.svg.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.js +2 -10
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.utils.js +8 -20
- package/lib/components/bundle-assets/bundle-assets.utils.js.map +1 -1
- package/lib/components/bundle-assets/index.js +0 -2
- package/lib/components/bundle-assets/index.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +2 -10
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.utils.js +1 -13
- package/lib/components/bundle-modules/bundle-modules.utils.js.map +1 -1
- package/lib/components/bundle-modules/index.js +2 -4
- package/lib/components/bundle-modules/index.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +2 -10
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.utils.js +1 -13
- package/lib/components/bundle-packages/bundle-packages.utils.js.map +1 -1
- package/lib/components/bundle-packages/index.js +2 -4
- package/lib/components/bundle-packages/index.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.js +41 -104
- package/lib/components/metrics-table/metrics-table.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.module.css +10 -15
- 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 +3 -1
- package/lib/{ui/sort-dropdown → components/sort-button}/index.js +1 -1
- package/lib/components/sort-button/index.js.map +1 -0
- package/lib/components/sort-button/sort-button.js +73 -0
- package/lib/components/sort-button/sort-button.js.map +1 -0
- package/lib/components/sort-button/sort-button.module.css +89 -0
- package/lib/constants.js +5 -1
- package/lib/constants.js.map +1 -1
- package/lib/hooks/rows-sort.js +13 -5
- package/lib/hooks/rows-sort.js.map +1 -1
- package/lib/ui/icon/icon.js +2 -0
- package/lib/ui/icon/icon.js.map +1 -1
- package/lib/ui/index.js +1 -3
- package/lib/ui/index.js.map +1 -1
- package/lib-esm/assets/icons.svg +16 -10
- package/lib-esm/assets/icons.svg.js +14 -10
- package/lib-esm/assets/icons.svg.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.js +2 -10
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js +8 -21
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js.map +1 -1
- package/lib-esm/components/bundle-assets/index.js +0 -2
- package/lib-esm/components/bundle-assets/index.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +2 -10
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +1 -14
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js.map +1 -1
- package/lib-esm/components/bundle-modules/index.js +2 -4
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +2 -10
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js +1 -14
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js.map +1 -1
- package/lib-esm/components/bundle-packages/index.js +2 -4
- package/lib-esm/components/bundle-packages/index.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.js +41 -81
- package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.module.css +10 -15
- 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 +3 -1
- package/lib-esm/components/sort-button/index.js +2 -0
- package/lib-esm/components/sort-button/index.js.map +1 -0
- package/lib-esm/components/sort-button/sort-button.js +43 -0
- package/lib-esm/components/sort-button/sort-button.js.map +1 -0
- package/lib-esm/components/sort-button/sort-button.module.css +89 -0
- package/lib-esm/constants.js +4 -0
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/hooks/rows-sort.js +11 -4
- package/lib-esm/hooks/rows-sort.js.map +1 -1
- package/lib-esm/ui/icon/icon.js +2 -0
- package/lib-esm/ui/icon/icon.js.map +1 -1
- package/lib-esm/ui/index.js +0 -1
- package/lib-esm/ui/index.js.map +1 -1
- package/package.json +3 -3
- package/src/assets/icons/chevron-down.svg +1 -0
- package/src/assets/icons/chevron-up.svg +1 -0
- package/src/assets/icons.svg +16 -10
- package/src/assets/icons.svg.jsx +24 -10
- package/src/components/bundle-assets/bundle-assets.jsx +2 -9
- package/src/components/bundle-assets/bundle-assets.utils.js +8 -24
- package/src/components/bundle-assets/index.jsx +0 -2
- package/src/components/bundle-modules/bundle-modules.jsx +2 -14
- package/src/components/bundle-modules/bundle-modules.utils.js +1 -17
- package/src/components/bundle-modules/index.jsx +2 -4
- package/src/components/bundle-packages/bundle-packages.jsx +2 -9
- package/src/components/bundle-packages/bundle-packages.utils.js +1 -17
- package/src/components/bundle-packages/index.jsx +2 -4
- package/src/components/metrics-table/metrics-table.jsx +134 -131
- package/src/components/metrics-table/metrics-table.module.css +10 -15
- package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.module.css +3 -1
- package/src/components/sort-button/index.ts +1 -0
- package/src/components/sort-button/sort-button.module.css +89 -0
- package/src/components/sort-button/sort-button.tsx +108 -0
- package/src/constants.js +5 -0
- package/src/hooks/rows-sort.ts +48 -0
- package/src/types.d.ts +4 -0
- package/src/ui/icon/icon.tsx +2 -0
- package/src/ui/index.js +0 -1
- package/types/components/bundle-assets/bundle-assets.d.ts +0 -1
- package/types/components/bundle-assets/bundle-assets.utils.d.ts +1 -1
- package/types/components/bundle-modules/bundle-modules.d.ts +1 -3
- package/types/components/bundle-modules/bundle-modules.utils.d.ts +1 -1
- package/types/components/bundle-packages/bundle-packages.d.ts +0 -1
- package/types/components/bundle-packages/bundle-packages.utils.d.ts +1 -1
- package/types/components/metrics-table/metrics-table.d.ts +3 -7
- package/types/components/sort-button/index.d.ts +1 -0
- package/types/components/sort-button/sort-button.d.ts +11 -0
- package/types/constants.d.ts +4 -0
- package/types/hooks/rows-sort.d.ts +14 -11
- package/types/ui/icon/icon.d.ts +4 -0
- package/types/ui/index.d.ts +0 -1
- package/lib/components/bundle-assets/bundle-assets.constants.js +0 -21
- package/lib/components/bundle-assets/bundle-assets.constants.js.map +0 -1
- package/lib/components/bundle-modules/bundle-modules.constants.js +0 -21
- package/lib/components/bundle-modules/bundle-modules.constants.js.map +0 -1
- package/lib/components/bundle-packages/bundle-packages.constants.js +0 -21
- package/lib/components/bundle-packages/bundle-packages.constants.js.map +0 -1
- package/lib/ui/sort-dropdown/index.js.map +0 -1
- package/lib/ui/sort-dropdown/sort-dropdown.js +0 -101
- package/lib/ui/sort-dropdown/sort-dropdown.js.map +0 -1
- package/lib/ui/sort-dropdown/sort-dropdown.module.css +0 -22
- package/lib-esm/components/bundle-assets/bundle-assets.constants.js +0 -18
- package/lib-esm/components/bundle-assets/bundle-assets.constants.js.map +0 -1
- package/lib-esm/components/bundle-modules/bundle-modules.constants.js +0 -18
- package/lib-esm/components/bundle-modules/bundle-modules.constants.js.map +0 -1
- package/lib-esm/components/bundle-packages/bundle-packages.constants.js +0 -18
- package/lib-esm/components/bundle-packages/bundle-packages.constants.js.map +0 -1
- package/lib-esm/ui/sort-dropdown/index.js +0 -2
- package/lib-esm/ui/sort-dropdown/index.js.map +0 -1
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +0 -71
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js.map +0 -1
- package/lib-esm/ui/sort-dropdown/sort-dropdown.module.css +0 -22
- package/src/components/bundle-assets/bundle-assets.constants.js +0 -18
- package/src/components/bundle-modules/bundle-modules.constants.js +0 -18
- package/src/components/bundle-packages/bundle-packages.constants.js +0 -18
- package/src/hooks/rows-sort.js +0 -24
- package/src/ui/sort-dropdown/index.js +0 -1
- package/src/ui/sort-dropdown/sort-dropdown.jsx +0 -121
- package/src/ui/sort-dropdown/sort-dropdown.module.css +0 -22
- package/types/components/bundle-assets/bundle-assets.constants.d.ts +0 -21
- package/types/components/bundle-modules/bundle-modules.constants.d.ts +0 -21
- package/types/components/bundle-packages/bundle-packages.constants.d.ts +0 -21
- package/types/ui/sort-dropdown/index.d.ts +0 -1
- package/types/ui/sort-dropdown/sort-dropdown.d.ts +0 -24
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/sort-button/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { SORT } from '../../constants';
|
|
4
|
+
import { Icon } from '../../ui/icon';
|
|
5
|
+
import { Tooltip } from '../../ui/tooltip';
|
|
6
|
+
import css from './sort-button.module.css';
|
|
7
|
+
const getToggleAction = (sort, field, label) => {
|
|
8
|
+
if ((sort === null || sort === void 0 ? void 0 : sort.field) !== field) {
|
|
9
|
+
return { direction: SORT.DESC, title: `Order ${label} descending` };
|
|
10
|
+
}
|
|
11
|
+
if ((sort === null || sort === void 0 ? void 0 : sort.direction) === SORT.DESC) {
|
|
12
|
+
return { direction: SORT.ASC, title: `Order ${label} ascending` };
|
|
13
|
+
}
|
|
14
|
+
return { direction: '', title: 'Reset order' };
|
|
15
|
+
};
|
|
16
|
+
const getAscAction = (label) => {
|
|
17
|
+
return { direction: SORT.ASC, title: `Order ${label} ascending` };
|
|
18
|
+
};
|
|
19
|
+
const getDescAction = (label) => {
|
|
20
|
+
return { direction: SORT.DESC, title: `Order ${label} descending` };
|
|
21
|
+
};
|
|
22
|
+
export const SortButton = (props) => {
|
|
23
|
+
const { className = '', children, fieldPath, fieldName, label, sort, updateSort } = props;
|
|
24
|
+
const field = `${fieldPath}.${fieldName}`;
|
|
25
|
+
const toggleAction = getToggleAction(sort, field, label);
|
|
26
|
+
const ascAction = getAscAction(label);
|
|
27
|
+
const descAction = getDescAction(label);
|
|
28
|
+
const isSorted = sort.field === field;
|
|
29
|
+
const getOrderOnClick = useCallback((action) => () => {
|
|
30
|
+
if (action.direction) {
|
|
31
|
+
updateSort({ field, direction: action.direction });
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
updateSort({ field: '', direction: '' });
|
|
35
|
+
}, [field, updateSort, toggleAction]);
|
|
36
|
+
return (React.createElement("div", { className: cx(css.root, className, isSorted && css.active) },
|
|
37
|
+
React.createElement(Tooltip, { title: toggleAction.title, as: "button", type: "button", onClick: getOrderOnClick(toggleAction), className: cx(css.button, css.toggle) }, children),
|
|
38
|
+
React.createElement(Tooltip, { title: ascAction.title, as: "button", type: "button", onClick: getOrderOnClick(ascAction), className: cx(css.button, css.direction, css.directionAsc, isSorted && sort.direction === SORT.ASC && css.directionActive) },
|
|
39
|
+
React.createElement(Icon, { glyph: Icon.ICONS.CHEVRON_UP, size: "small", className: css.directionIcon })),
|
|
40
|
+
React.createElement(Tooltip, { title: descAction.title, as: "button", type: "button", onClick: getOrderOnClick(descAction), className: cx(css.button, css.direction, css.directionDesc, isSorted && sort.direction === SORT.DESC && css.directionActive) },
|
|
41
|
+
React.createElement(Icon, { glyph: Icon.ICONS.CHEVRON_DOWN, size: "small", className: css.directionIcon }))));
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=sort-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-button.js","sourceRoot":"","sources":["../../../src/components/sort-button/sort-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,M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,EACb,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,EACnC,SAAS,EAAE,EAAE,CACX,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,SAAS,EACb,GAAG,CAAC,YAAY,EAChB,QAAQ,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,eAAe,CAC/D;YAED,oBAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,GAAG,CAAC,aAAa,GAAI,CACzE;QACV,oBAAC,OAAO,IACN,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,eAAe,CAAC,UAAU,CAAC,EACpC,SAAS,EAAE,EAAE,CACX,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,SAAS,EACb,GAAG,CAAC,aAAa,EACjB,QAAQ,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,eAAe,CAChE;YAED,oBAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,GAAG,CAAC,aAAa,GAAI,CAC3E,CACN,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
--icon-dimension: 15px;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
margin: calc(0px - var(--space-xxxsmall));
|
|
5
|
+
margin-right: calc(0px - 1px - var(--icon-dimension));
|
|
6
|
+
border-radius: var(--radius-small);
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.button {
|
|
11
|
+
appearance: none;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
border: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
margin: 0;
|
|
16
|
+
background: transparent;
|
|
17
|
+
transition: var(--transition-out);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.toggle {
|
|
21
|
+
padding: var(--space-xxxsmall);
|
|
22
|
+
padding-right: calc(1px + var(--icon-dimension));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.direction {
|
|
26
|
+
position: absolute;
|
|
27
|
+
padding: 2px;
|
|
28
|
+
display: block;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
right: -2px; /* compensate for the button padding */
|
|
31
|
+
color: var(--color-text-ultra-light);
|
|
32
|
+
transition: var(--transition-out);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.directionIcon {
|
|
36
|
+
display: block;
|
|
37
|
+
width: var(--icon-dimension);
|
|
38
|
+
height: var(--icon-dimension);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.directionActive {
|
|
42
|
+
color: var(--color-text);
|
|
43
|
+
transition: var(--transition-in);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.direction:hover,
|
|
47
|
+
.direction:active,
|
|
48
|
+
.direction:focus {
|
|
49
|
+
color: var(--color-text-dark);
|
|
50
|
+
transition: var(--transition-in);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.directionAsc {
|
|
54
|
+
padding-bottom: 0;
|
|
55
|
+
bottom: 50%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.directionAsc .directionIcon {
|
|
59
|
+
transform: translateY(3px);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.directionDesc {
|
|
63
|
+
padding-top: 0;
|
|
64
|
+
top: 50%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.directionDesc .directionIcon {
|
|
68
|
+
transform: translateY(-5px);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.root:hover,
|
|
72
|
+
.root:active,
|
|
73
|
+
.root:focus {
|
|
74
|
+
background: var(--color-outline);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.direction {
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
opacity: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.active .direction,
|
|
83
|
+
.root:hover .direction,
|
|
84
|
+
.root:active .direction,
|
|
85
|
+
.root:focus .direction {
|
|
86
|
+
pointer-events: auto;
|
|
87
|
+
opacity: 1;
|
|
88
|
+
transition: var(--transition-in);
|
|
89
|
+
}
|
package/lib-esm/constants.js
CHANGED
|
@@ -28,4 +28,8 @@ export const METRICS_WEBPACK_MODULES = [
|
|
|
28
28
|
'webpack.duplicateCode',
|
|
29
29
|
];
|
|
30
30
|
export const METRICS_WEBPACK_PACKAGES = ['webpack.packageCount', 'webpack.duplicatePackagesCount'];
|
|
31
|
+
export const SORT = {
|
|
32
|
+
ASC: 'asc',
|
|
33
|
+
DESC: 'desc',
|
|
34
|
+
};
|
|
31
35
|
//# sourceMappingURL=constants.js.map
|
package/lib-esm/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,WAAW;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,QAAQ;IAChC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM;IAC9B,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO;IAChC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM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,EAAE,CAAC,CAAC;IAClB,GAAG,GAAG;IACN,CAAC,gCAAgC,QAAQ,EAAE,CAAC,EAAE,QAAQ;CACvD,CAAC,EACF,EAAE,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,4BAA4B;IAC5B,4BAA4B;IAC5B,6BAA6B;IAC7B,2BAA2B;CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,qBAAqB;IACrB,+BAA+B;IAC/B,uBAAuB;CACxB,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,sBAAsB,EAAE,gCAAgC,CAAC,CAAC;AAEnG,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { useState, useMemo } from 'react';
|
|
2
|
+
import get from 'lodash/get';
|
|
2
3
|
import orderBy from 'lodash/orderBy';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { SORT } from '../constants';
|
|
5
|
+
export const getSortFn = (fieldPath, getCustomSort) => (item) => {
|
|
6
|
+
if (!fieldPath) {
|
|
7
|
+
return getCustomSort(item);
|
|
8
|
+
}
|
|
9
|
+
return Math.abs(get(item, fieldPath) || 0);
|
|
10
|
+
};
|
|
11
|
+
export const useRowsSort = ({ rows, fieldPath = 'runs[0].delta', direction = 'desc', getCustomSort, }) => {
|
|
12
|
+
const [sort, updateSort] = useState({ field: fieldPath, direction });
|
|
13
|
+
const orderedRows = useMemo(() => orderBy(rows, getSortFn(sort.field, getCustomSort), direction !== '' ? direction : SORT.ASC), [rows, sort]);
|
|
6
14
|
return {
|
|
7
|
-
sortFields,
|
|
8
15
|
sort,
|
|
9
16
|
updateSort,
|
|
10
17
|
items: orderedRows,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rows-sort.js","sourceRoot":"","sources":["../../src/hooks/rows-sort.
|
|
1
|
+
{"version":3,"file":"rows-sort.js","sourceRoot":"","sources":["../../src/hooks/rows-sort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AASpC,MAAM,CAAC,MAAM,SAAS,GACpB,CAAC,SAAiB,EAAE,aAAiD,EAAE,EAAE,CAAC,CAAC,IAAa,EAAE,EAAE;IAC1F,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;KAC5B;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,IAAI,EACJ,SAAS,GAAG,eAAe,EAC3B,SAAS,GAAG,MAAM,EAClB,aAAa,GACK,EAAE,EAAE;IACtB,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;IAErE,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CACH,OAAO,CACL,IAAI,EACJ,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,EAEpC,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,IAAI,CAAC,GAAW,CACjD,EACH,CAAC,IAAI,EAAE,IAAI,CAAC,CACb,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,UAAU;QACV,KAAK,EAAE,WAAW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,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,GAAG,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAElG,OAAO,CACL,oBAAC,SAAS,IAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,KAAM,SAAS;QACrE,6BAAK,SAAS,EAAE,GAAG,CAAC,IAAI;YACtB,6BAAK,SAAS,EAAE,IAAI,KAAK,EAAE,GAAI,CAC3B,CACI,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAEnB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;AAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;AAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;AAC7B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC"}
|
package/lib-esm/ui/index.js
CHANGED
|
@@ -10,7 +10,6 @@ export { Icon } from './icon';
|
|
|
10
10
|
export { Input } from './input';
|
|
11
11
|
export { Loader } from './loader';
|
|
12
12
|
export { Skeleton } from './skeleton';
|
|
13
|
-
export { SortDropdown } from './sort-dropdown';
|
|
14
13
|
export { Table } from './table';
|
|
15
14
|
export { Tabs } from './tabs';
|
|
16
15
|
export { Tag } from './tag';
|
package/lib-esm/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,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EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-beta.0",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -76,11 +76,11 @@
|
|
|
76
76
|
"react-router-dom": "^5.0.0"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@bundle-stats/utils": "^4.
|
|
79
|
+
"@bundle-stats/utils": "^4.5.0-beta.0",
|
|
80
80
|
"ariakit": "2.0.0-next.44",
|
|
81
81
|
"modern-css-reset": "1.4.0",
|
|
82
82
|
"query-string": "7.1.3",
|
|
83
83
|
"use-query-params": "2.2.1"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "f39dbde3efbbb3457bb99536c94ad06830f8ee88"
|
|
86
86
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-up"><path d="m18 15-6-6-6 6"/></svg>
|
package/src/assets/icons.svg
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
<svg width="0" height="0" style="position:absolute">
|
|
2
|
-
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
2
|
+
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="arrow" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M12 5v14M19 12l-7 7-7-7"/>
|
|
4
4
|
</symbol>
|
|
5
|
-
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
5
|
+
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="arrow-right-circle" xmlns="http://www.w3.org/2000/svg">
|
|
6
6
|
<circle cx="12" cy="12" r="10"/>
|
|
7
7
|
<path d="M12 16l4-4-4-4M8 12h8"/>
|
|
8
8
|
</symbol>
|
|
9
|
-
<symbol
|
|
9
|
+
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="chevron-down" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
+
<path d="M6 9l6 6 6-6"/>
|
|
11
|
+
</symbol>
|
|
12
|
+
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="chevron-up" xmlns="http://www.w3.org/2000/svg">
|
|
13
|
+
<path d="M18 15l-6-6-6 6"/>
|
|
14
|
+
</symbol>
|
|
15
|
+
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="clock" xmlns="http://www.w3.org/2000/svg">
|
|
10
16
|
<circle cx="12" cy="12" r="10"/>
|
|
11
17
|
<path d="M12 6v6l4 2"/>
|
|
12
18
|
</symbol>
|
|
13
|
-
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
19
|
+
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="close" xmlns="http://www.w3.org/2000/svg">
|
|
14
20
|
<circle cx="12" cy="12" r="10"/>
|
|
15
21
|
<path d="M15 9l-6 6M9 9l6 6"/>
|
|
16
22
|
</symbol>
|
|
17
|
-
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
23
|
+
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="commit" xmlns="http://www.w3.org/2000/svg">
|
|
18
24
|
<circle cx="12" cy="12" r="4"/>
|
|
19
25
|
<path d="M1.05 12H7M17.01 12h5.95"/>
|
|
20
26
|
</symbol>
|
|
@@ -22,16 +28,16 @@
|
|
|
22
28
|
<circle cx="12" cy="12" r="10"/>
|
|
23
29
|
<path d="M12 8v4M12 16h.01"/>
|
|
24
30
|
</symbol>
|
|
25
|
-
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
31
|
+
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="external-link" xmlns="http://www.w3.org/2000/svg">
|
|
26
32
|
<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3"/>
|
|
27
33
|
</symbol>
|
|
28
|
-
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
34
|
+
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="filter" xmlns="http://www.w3.org/2000/svg">
|
|
29
35
|
<path d="M12 20V10M18 20V4M6 20v-4"/>
|
|
30
36
|
</symbol>
|
|
31
37
|
<symbol viewBox="0 0 98 96" id="github" xmlns="http://www.w3.org/2000/svg">
|
|
32
38
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0112.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="currentColor"/>
|
|
33
39
|
</symbol>
|
|
34
|
-
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
40
|
+
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="help" xmlns="http://www.w3.org/2000/svg">
|
|
35
41
|
<circle cx="12" cy="12" r="10"/>
|
|
36
42
|
<path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3M12 17h.01"/>
|
|
37
43
|
</symbol>
|
|
@@ -39,7 +45,7 @@
|
|
|
39
45
|
<circle cx="12" cy="12" r="10"/>
|
|
40
46
|
<path d="M12 16v-4M12 8h.01"/>
|
|
41
47
|
</symbol>
|
|
42
|
-
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
48
|
+
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="menu" xmlns="http://www.w3.org/2000/svg">
|
|
43
49
|
<path d="M3 12h18M3 6h18M3 18h18"/>
|
|
44
50
|
</symbol>
|
|
45
51
|
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="more-vertical" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -51,7 +57,7 @@
|
|
|
51
57
|
<path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/>
|
|
52
58
|
<path d="M0 0h24v24H0z" fill="none"/>
|
|
53
59
|
</symbol>
|
|
54
|
-
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
60
|
+
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="warning" xmlns="http://www.w3.org/2000/svg">
|
|
55
61
|
<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01"/>
|
|
56
62
|
</symbol>
|
|
57
63
|
</svg>
|
package/src/assets/icons.svg.jsx
CHANGED
|
@@ -9,7 +9,6 @@ export const SvgIcons = (props) => (
|
|
|
9
9
|
stroke-width="2"
|
|
10
10
|
stroke-linecap="round"
|
|
11
11
|
stroke-linejoin="round"
|
|
12
|
-
class="feather feather-arrow-down"
|
|
13
12
|
id="arrow"
|
|
14
13
|
xmlns="http://www.w3.org/2000/svg"
|
|
15
14
|
>
|
|
@@ -21,7 +20,6 @@ export const SvgIcons = (props) => (
|
|
|
21
20
|
stroke-width="2"
|
|
22
21
|
stroke-linecap="round"
|
|
23
22
|
stroke-linejoin="round"
|
|
24
|
-
class="feather feather-arrow-right-circle"
|
|
25
23
|
viewBox="0 0 24 24"
|
|
26
24
|
id="arrow-right-circle"
|
|
27
25
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -29,6 +27,30 @@ export const SvgIcons = (props) => (
|
|
|
29
27
|
<circle cx="12" cy="12" r="10" />
|
|
30
28
|
<path d="M12 16l4-4-4-4M8 12h8" />
|
|
31
29
|
</symbol>
|
|
30
|
+
<symbol
|
|
31
|
+
fill="none"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
stroke-width="2"
|
|
34
|
+
stroke-linecap="round"
|
|
35
|
+
stroke-linejoin="round"
|
|
36
|
+
viewBox="0 0 24 24"
|
|
37
|
+
id="chevron-down"
|
|
38
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
39
|
+
>
|
|
40
|
+
<path d="M6 9l6 6 6-6" />
|
|
41
|
+
</symbol>
|
|
42
|
+
<symbol
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="currentColor"
|
|
45
|
+
stroke-width="2"
|
|
46
|
+
stroke-linecap="round"
|
|
47
|
+
stroke-linejoin="round"
|
|
48
|
+
viewBox="0 0 24 24"
|
|
49
|
+
id="chevron-up"
|
|
50
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
51
|
+
>
|
|
52
|
+
<path d="M18 15l-6-6-6 6" />
|
|
53
|
+
</symbol>
|
|
32
54
|
<symbol
|
|
33
55
|
viewBox="0 0 24 24"
|
|
34
56
|
fill="none"
|
|
@@ -36,7 +58,6 @@ export const SvgIcons = (props) => (
|
|
|
36
58
|
stroke-width="2"
|
|
37
59
|
stroke-linecap="round"
|
|
38
60
|
stroke-linejoin="round"
|
|
39
|
-
class="feather feather-clock"
|
|
40
61
|
id="clock"
|
|
41
62
|
xmlns="http://www.w3.org/2000/svg"
|
|
42
63
|
>
|
|
@@ -49,7 +70,6 @@ export const SvgIcons = (props) => (
|
|
|
49
70
|
stroke-width="2"
|
|
50
71
|
stroke-linecap="round"
|
|
51
72
|
stroke-linejoin="round"
|
|
52
|
-
class="feather feather-x-circle"
|
|
53
73
|
viewBox="0 0 24 24"
|
|
54
74
|
id="close"
|
|
55
75
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -64,7 +84,6 @@ export const SvgIcons = (props) => (
|
|
|
64
84
|
stroke-width="2"
|
|
65
85
|
stroke-linecap="round"
|
|
66
86
|
stroke-linejoin="round"
|
|
67
|
-
class="feather feather-git-commit"
|
|
68
87
|
id="commit"
|
|
69
88
|
xmlns="http://www.w3.org/2000/svg"
|
|
70
89
|
>
|
|
@@ -90,7 +109,6 @@ export const SvgIcons = (props) => (
|
|
|
90
109
|
stroke-width="2"
|
|
91
110
|
stroke-linecap="round"
|
|
92
111
|
stroke-linejoin="round"
|
|
93
|
-
class="feather feather-external-link"
|
|
94
112
|
viewBox="0 0 24 24"
|
|
95
113
|
id="external-link"
|
|
96
114
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -104,7 +122,6 @@ export const SvgIcons = (props) => (
|
|
|
104
122
|
stroke-width="2"
|
|
105
123
|
stroke-linecap="round"
|
|
106
124
|
stroke-linejoin="round"
|
|
107
|
-
class="feather feather-bar-chart"
|
|
108
125
|
id="filter"
|
|
109
126
|
xmlns="http://www.w3.org/2000/svg"
|
|
110
127
|
>
|
|
@@ -125,7 +142,6 @@ export const SvgIcons = (props) => (
|
|
|
125
142
|
stroke-width="2"
|
|
126
143
|
stroke-linecap="round"
|
|
127
144
|
stroke-linejoin="round"
|
|
128
|
-
class="feather feather-help-circle"
|
|
129
145
|
id="help"
|
|
130
146
|
xmlns="http://www.w3.org/2000/svg"
|
|
131
147
|
>
|
|
@@ -152,7 +168,6 @@ export const SvgIcons = (props) => (
|
|
|
152
168
|
stroke-width="2"
|
|
153
169
|
stroke-linecap="round"
|
|
154
170
|
stroke-linejoin="round"
|
|
155
|
-
class="feather feather-menu"
|
|
156
171
|
id="menu"
|
|
157
172
|
xmlns="http://www.w3.org/2000/svg"
|
|
158
173
|
>
|
|
@@ -183,7 +198,6 @@ export const SvgIcons = (props) => (
|
|
|
183
198
|
stroke-width="2"
|
|
184
199
|
stroke-linecap="round"
|
|
185
200
|
stroke-linejoin="round"
|
|
186
|
-
class="feather feather-alert-triangle"
|
|
187
201
|
id="warning"
|
|
188
202
|
xmlns="http://www.w3.org/2000/svg"
|
|
189
203
|
>
|
|
@@ -19,7 +19,6 @@ import { FileName } from '../../ui/file-name';
|
|
|
19
19
|
import { HoverCard } from '../../ui/hover-card';
|
|
20
20
|
import { Tag } from '../../ui/tag';
|
|
21
21
|
import { Filters } from '../../ui/filters';
|
|
22
|
-
import { SortDropdown } from '../../ui/sort-dropdown';
|
|
23
22
|
import { EmptySet } from '../../ui/empty-set';
|
|
24
23
|
import { Toolbar } from '../../ui/toolbar';
|
|
25
24
|
import { AssetInfo } from '../asset-info';
|
|
@@ -170,7 +169,6 @@ export const BundleAssets = (props) => {
|
|
|
170
169
|
filters,
|
|
171
170
|
entryId,
|
|
172
171
|
hasActiveFilters,
|
|
173
|
-
sortFields,
|
|
174
172
|
sort,
|
|
175
173
|
updateSort,
|
|
176
174
|
search,
|
|
@@ -221,7 +219,6 @@ export const BundleAssets = (props) => {
|
|
|
221
219
|
className={css.toolbar}
|
|
222
220
|
renderActions={({ actionClassName }) => (
|
|
223
221
|
<FlexStack space="xxsmall" className={cx(css.dropdown, actionClassName)}>
|
|
224
|
-
<SortDropdown fields={sortFields} {...sort} onChange={updateSort} />
|
|
225
222
|
<MetricsTableOptions
|
|
226
223
|
handleViewAll={resetAllFilters}
|
|
227
224
|
handleResetFilters={resetFilters}
|
|
@@ -252,6 +249,8 @@ export const BundleAssets = (props) => {
|
|
|
252
249
|
emptyMessage={emptyMessage}
|
|
253
250
|
showHeaderSum
|
|
254
251
|
title={metricsTableTitle}
|
|
252
|
+
sort={sort}
|
|
253
|
+
updateSort={updateSort}
|
|
255
254
|
/>
|
|
256
255
|
</main>
|
|
257
256
|
</section>
|
|
@@ -313,12 +312,6 @@ BundleAssets.propTypes = {
|
|
|
313
312
|
}).isRequired,
|
|
314
313
|
entryId: PropTypes.string,
|
|
315
314
|
hasActiveFilters: PropTypes.bool,
|
|
316
|
-
sortFields: PropTypes.shape({
|
|
317
|
-
[PropTypes.string]: PropTypes.shape({
|
|
318
|
-
label: PropTypes.string,
|
|
319
|
-
defaultDirection: PropTypes.bool,
|
|
320
|
-
}),
|
|
321
|
-
}).isRequired,
|
|
322
315
|
search: PropTypes.string.isRequired,
|
|
323
316
|
updateSearch: PropTypes.func.isRequired,
|
|
324
317
|
sort: PropTypes.shape({
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ASSET_ENTRY_TYPE, ASSET_FILE_TYPE, ASSET_FILTERS, getFileType } from '@bundle-stats/utils';
|
|
2
2
|
|
|
3
|
-
import { SORT_BY_NAME, SORT_BY_DELTA, SORT_BY_SIZE } from './bundle-assets.constants';
|
|
4
|
-
|
|
5
3
|
export const addRowAssetFlags = (row) => {
|
|
6
4
|
const { runs } = row;
|
|
7
5
|
|
|
@@ -72,25 +70,11 @@ export const getRowFilter = (filters) => (item) => {
|
|
|
72
70
|
return true;
|
|
73
71
|
};
|
|
74
72
|
|
|
75
|
-
export const getCustomSort = (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (sortId === SORT_BY_SIZE) {
|
|
85
|
-
return item?.runs?.[0]?.value || 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return [
|
|
89
|
-
!item.isNotPredictive,
|
|
90
|
-
!item.changed,
|
|
91
|
-
!item.isInitial,
|
|
92
|
-
!item.isEntry,
|
|
93
|
-
!item.isChunk,
|
|
94
|
-
item.key,
|
|
95
|
-
];
|
|
96
|
-
};
|
|
73
|
+
export const getCustomSort = (item) => [
|
|
74
|
+
!item.isNotPredictive,
|
|
75
|
+
!item.changed,
|
|
76
|
+
!item.isInitial,
|
|
77
|
+
!item.isEntry,
|
|
78
|
+
!item.isChunk,
|
|
79
|
+
item.key,
|
|
80
|
+
];
|
|
@@ -12,7 +12,6 @@ import { useRowsSort } from '../../hooks/rows-sort';
|
|
|
12
12
|
import { useSearchParams } from '../../hooks/search-params';
|
|
13
13
|
import { BundleAssets as BundleAssetsComponent } from './bundle-assets';
|
|
14
14
|
import { addRowAssetFlags, addRowIsNotPredictive, getRowFilter, getCustomSort } from './bundle-assets.utils';
|
|
15
|
-
import { SORT_BY } from './bundle-assets.constants';
|
|
16
15
|
|
|
17
16
|
export const BundleAssets = (props) => {
|
|
18
17
|
const { jobs, filters, search, setState, sortBy, direction, ...restProps } = props;
|
|
@@ -55,7 +54,6 @@ export const BundleAssets = (props) => {
|
|
|
55
54
|
|
|
56
55
|
const sortParams = useRowsSort({
|
|
57
56
|
rows: filteredRows,
|
|
58
|
-
sortFields: SORT_BY,
|
|
59
57
|
sortBy,
|
|
60
58
|
sortDirection: direction,
|
|
61
59
|
getCustomSort,
|
|
@@ -21,7 +21,6 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
21
21
|
import { EmptySet } from '../../ui/empty-set';
|
|
22
22
|
import { FileName } from '../../ui/file-name';
|
|
23
23
|
import { Filters } from '../../ui/filters';
|
|
24
|
-
import { SortDropdown } from '../../ui/sort-dropdown';
|
|
25
24
|
import { Tag } from '../../ui/tag';
|
|
26
25
|
import { Toolbar } from '../../ui/toolbar';
|
|
27
26
|
import { MetricsTable } from '../metrics-table';
|
|
@@ -125,7 +124,6 @@ export const BundleModules = ({
|
|
|
125
124
|
resetAllFilters,
|
|
126
125
|
filters,
|
|
127
126
|
entryId,
|
|
128
|
-
sortFields,
|
|
129
127
|
sort,
|
|
130
128
|
updateSort,
|
|
131
129
|
search,
|
|
@@ -179,12 +177,6 @@ export const BundleModules = ({
|
|
|
179
177
|
className={css.toolbar}
|
|
180
178
|
renderActions={({ actionClassName }) => (
|
|
181
179
|
<FlexStack space="xxsmall" className={cx(css.dropdown, actionClassName)}>
|
|
182
|
-
<SortDropdown
|
|
183
|
-
className={css.tableDropdown}
|
|
184
|
-
fields={sortFields}
|
|
185
|
-
onChange={updateSort}
|
|
186
|
-
{...sort}
|
|
187
|
-
/>
|
|
188
180
|
<MetricsTableOptions
|
|
189
181
|
handleViewAll={resetAllFilters}
|
|
190
182
|
handleResetFilters={resetFilters}
|
|
@@ -216,6 +208,8 @@ export const BundleModules = ({
|
|
|
216
208
|
emptyMessage={emptyMessage}
|
|
217
209
|
showHeaderSum
|
|
218
210
|
title={metricsTableTitle}
|
|
211
|
+
sort={sort}
|
|
212
|
+
updateSort={updateSort}
|
|
219
213
|
/>
|
|
220
214
|
</div>
|
|
221
215
|
{entryId && (
|
|
@@ -277,12 +271,6 @@ BundleModules.propTypes = {
|
|
|
277
271
|
|
|
278
272
|
hasActiveFilters: PropTypes.bool,
|
|
279
273
|
|
|
280
|
-
sortFields: PropTypes.shape({
|
|
281
|
-
[PropTypes.string]: PropTypes.shape({
|
|
282
|
-
label: PropTypes.string,
|
|
283
|
-
defaultDirection: PropTypes.bool,
|
|
284
|
-
}),
|
|
285
|
-
}).isRequired,
|
|
286
274
|
sort: PropTypes.shape({
|
|
287
275
|
sortBy: PropTypes.string,
|
|
288
276
|
direction: PropTypes.string,
|
|
@@ -11,8 +11,6 @@ import {
|
|
|
11
11
|
getModuleSourceFileType,
|
|
12
12
|
} from '@bundle-stats/utils';
|
|
13
13
|
|
|
14
|
-
import { SORT_BY_NAME, SORT_BY_SIZE, SORT_BY_DELTA } from './bundle-modules.constants';
|
|
15
|
-
|
|
16
14
|
export const addRowFlags = (row) => {
|
|
17
15
|
const { key, runs } = row;
|
|
18
16
|
|
|
@@ -28,21 +26,7 @@ export const addRowFlags = (row) => {
|
|
|
28
26
|
return row;
|
|
29
27
|
};
|
|
30
28
|
|
|
31
|
-
export const getCustomSort = (
|
|
32
|
-
if (sortBy === SORT_BY_NAME) {
|
|
33
|
-
return item.key;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (sortBy === SORT_BY_SIZE) {
|
|
37
|
-
return item?.runs?.[0]?.value || 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (sortBy === SORT_BY_DELTA) {
|
|
41
|
-
return item?.runs?.[0]?.delta ? Math.abs(item.runs[0].delta) : 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return [!item.changed, item.key];
|
|
45
|
-
};
|
|
29
|
+
export const getCustomSort = (item) => [!item.changed, item.key];
|
|
46
30
|
|
|
47
31
|
export const getRowFilter = (filters) => (row) => {
|
|
48
32
|
// Skip not changed rows
|