html-reporter 9.5.1 → 9.6.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/CHANGELOG.md +11 -0
- package/lib/static/components/controls/browser-list/index.js +239 -0
- package/lib/static/components/controls/browser-list/index.styl +52 -0
- package/lib/static/components/controls/browser-list/label.js +60 -0
- package/lib/static/components/controls/browser-list/label.styl +18 -0
- package/lib/static/components/controls/browser-list/utils.js +43 -0
- package/lib/static/components/controls/controls.less +0 -4
- package/lib/static/components/controls/strict-match-filter-input.js +26 -35
- package/lib/static/components/controls/test-name-filter-input.js +29 -41
- package/lib/static/components/gui.js +2 -2
- package/lib/static/components/header/header.css +1 -0
- package/lib/static/components/header/summary/dbSummary.js +15 -13
- package/lib/static/components/header/summary/summary.css +6 -3
- package/lib/static/components/popup/index.js +85 -0
- package/lib/static/components/popup/index.styl +37 -0
- package/lib/static/components/report.js +2 -4
- package/lib/static/components/sticky-header/gui.js +12 -0
- package/lib/static/components/sticky-header/index.js +36 -0
- package/lib/static/components/sticky-header/index.styl +37 -0
- package/lib/static/components/sticky-header/report.js +14 -0
- package/lib/static/containers/array/array.styl +32 -0
- package/lib/static/containers/array/index.js +61 -0
- package/lib/static/gui.html +1 -13
- package/lib/static/gui.min.css +1 -723
- package/lib/static/gui.min.js +61 -47
- package/lib/static/hooks/useElementSize.js +30 -0
- package/lib/static/hooks/useEventListener.js +25 -0
- package/lib/static/hooks/useWindowSize.js +25 -0
- package/lib/static/index.html +1 -13
- package/lib/static/report.min.css +1 -723
- package/lib/static/report.min.js +61 -47
- package/lib/static/styles.css +20 -103
- package/package.json +11 -9
- package/webpack.common.js +29 -18
- package/webpack.dev.js +4 -0
- package/webpack.prod.js +4 -9
- package/lib/static/2.min.js +0 -1925
- package/lib/static/components/controls/browser-list.js +0 -153
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
display: inline;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
.db-info__popup {
|
|
38
|
+
margin-left: auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
.ui.basic.db-info {
|
|
38
42
|
font-family: inherit;
|
|
39
43
|
font-size: inherit;
|
|
@@ -43,7 +47,6 @@
|
|
|
43
47
|
box-shadow: none !important;
|
|
44
48
|
border: none;
|
|
45
49
|
color: #000 !important;
|
|
46
|
-
margin-left: auto;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
.ui.basic.db-info:hover {
|
|
@@ -58,8 +61,8 @@
|
|
|
58
61
|
color: #e66767 !important;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
.
|
|
62
|
-
|
|
64
|
+
.popup__content .db-info__row {
|
|
65
|
+
white-space: nowrap;
|
|
63
66
|
font-size: 15px;
|
|
64
67
|
}
|
|
65
68
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, {useRef, useState, useEffect} from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import useElementSize from '../../hooks/useElementSize';
|
|
5
|
+
import useWindowSize from '../../hooks/useWindowSize';
|
|
6
|
+
|
|
7
|
+
import './index.styl';
|
|
8
|
+
|
|
9
|
+
const OVERFLOW_BORDER = 20;
|
|
10
|
+
|
|
11
|
+
const Popup = (props) => {
|
|
12
|
+
const {action, target, children, ...rest} = props;
|
|
13
|
+
|
|
14
|
+
const isClickHandled = useRef(false);
|
|
15
|
+
const [show, setShow] = useState(false);
|
|
16
|
+
const {width: windowWidth} = useWindowSize();
|
|
17
|
+
const [targetRef, targetPos] = useElementSize();
|
|
18
|
+
const [popupRef, popupPos] = useElementSize();
|
|
19
|
+
|
|
20
|
+
const handleClick = (newState, {isLast} = {}) => {
|
|
21
|
+
if (!isClickHandled.current) {
|
|
22
|
+
isClickHandled.current = true;
|
|
23
|
+
setShow(newState);
|
|
24
|
+
}
|
|
25
|
+
if (isLast) {
|
|
26
|
+
isClickHandled.current = false;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const xOffset = targetPos.left + targetPos.width / 2;
|
|
31
|
+
const yOffset = targetPos.top + targetPos.height;
|
|
32
|
+
|
|
33
|
+
const overflowRight = Math.max(xOffset + popupPos.width / 2 - windowWidth + OVERFLOW_BORDER, 0);
|
|
34
|
+
const overflowLeft = Math.min(xOffset - popupPos.width / 2 - OVERFLOW_BORDER, 0);
|
|
35
|
+
const overflow = overflowLeft || overflowRight;
|
|
36
|
+
|
|
37
|
+
const mouseEnterHandler = action === 'hover' ? () => setShow(true) : null;
|
|
38
|
+
const mouseLeaveHandler = action === 'hover' ? () => setShow(false) : null;
|
|
39
|
+
|
|
40
|
+
const mouseClickTargetHandler = action === 'click' ? () => handleClick(s => !s) : null;
|
|
41
|
+
const mouseClickOuterHandler = action === 'click' ? () => handleClick(true) : null;
|
|
42
|
+
const mouseClickAwayHandler = action === 'click' ? () => handleClick(false, {isLast: true}) : null;
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (mouseClickAwayHandler) {
|
|
46
|
+
window.addEventListener('click', mouseClickAwayHandler);
|
|
47
|
+
|
|
48
|
+
return () => window.removeEventListener('click', mouseClickAwayHandler);
|
|
49
|
+
}
|
|
50
|
+
}), [];
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<span
|
|
54
|
+
{...rest}
|
|
55
|
+
onMouseEnter={mouseEnterHandler}
|
|
56
|
+
onMouseLeave={mouseLeaveHandler}
|
|
57
|
+
onClick={mouseClickOuterHandler}
|
|
58
|
+
>
|
|
59
|
+
{React.cloneElement(target, {
|
|
60
|
+
ref: targetRef,
|
|
61
|
+
onClick: mouseClickTargetHandler
|
|
62
|
+
})}
|
|
63
|
+
<span
|
|
64
|
+
className={`popup popup_${show ? 'visible' : 'hidden'}`}
|
|
65
|
+
style={{left: xOffset, top: yOffset}}
|
|
66
|
+
>
|
|
67
|
+
<div className='popup__pointer' />
|
|
68
|
+
<div
|
|
69
|
+
ref={popupRef}
|
|
70
|
+
className='popup__content'
|
|
71
|
+
style={{transform: `translate(${-overflow}px)`}}
|
|
72
|
+
>
|
|
73
|
+
{children}
|
|
74
|
+
</div>
|
|
75
|
+
</span>
|
|
76
|
+
</span>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
Popup.propTypes = {
|
|
81
|
+
action: PropTypes.oneOf(['hover', 'click']).isRequired,
|
|
82
|
+
target: PropTypes.node.isRequired
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default Popup;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.popup
|
|
2
|
+
position absolute
|
|
3
|
+
z-index 1500
|
|
4
|
+
transform translate(-50%, -1px)
|
|
5
|
+
|
|
6
|
+
&.popup_visible
|
|
7
|
+
visibility visible
|
|
8
|
+
|
|
9
|
+
&.popup_hidden
|
|
10
|
+
visibility hidden
|
|
11
|
+
|
|
12
|
+
.popup__pointer
|
|
13
|
+
position relative
|
|
14
|
+
height pointer-height = 20px
|
|
15
|
+
|
|
16
|
+
&::after
|
|
17
|
+
content ''
|
|
18
|
+
pointer-border-width = 1px
|
|
19
|
+
border-left pointer-border-width solid #ccc
|
|
20
|
+
border-top pointer-border-width solid #ccc
|
|
21
|
+
margin-top pointer-height - (2 * pointer-border-width * math(2, 'sqrt'))
|
|
22
|
+
position absolute
|
|
23
|
+
box-sizing content-box
|
|
24
|
+
height 20px
|
|
25
|
+
width 20px
|
|
26
|
+
background white
|
|
27
|
+
z-index 1400
|
|
28
|
+
left 50%
|
|
29
|
+
transform rotate(45deg) translate(-50%)
|
|
30
|
+
|
|
31
|
+
.popup__content
|
|
32
|
+
border 1px solid #ccc
|
|
33
|
+
border-radius .25rem
|
|
34
|
+
box-shadow 0 2px 4px 0 rgba(34, 36, 38, .12),
|
|
35
|
+
0 2px 10px 0 rgba(34, 36, 38, .15)
|
|
36
|
+
background-color white
|
|
37
|
+
padding 15px
|
|
@@ -7,8 +7,7 @@ import {bindActionCreators} from 'redux';
|
|
|
7
7
|
import {ROOT} from '../../constants/extension-points';
|
|
8
8
|
import * as actions from '../modules/actions';
|
|
9
9
|
import Loading from './loading';
|
|
10
|
-
import
|
|
11
|
-
import ControlButtons from './controls/report-controls';
|
|
10
|
+
import StickyHeader from './sticky-header/report';
|
|
12
11
|
import MainTree from './main-tree';
|
|
13
12
|
import CustomScripts from './custom-scripts';
|
|
14
13
|
import FaviconChanger from './favicon-changer';
|
|
@@ -51,8 +50,7 @@ class Report extends Component {
|
|
|
51
50
|
<CustomScripts scripts={this.props.customScripts}/>
|
|
52
51
|
{notificationElem}
|
|
53
52
|
<FaviconChanger />
|
|
54
|
-
<
|
|
55
|
-
<ControlButtons/>
|
|
53
|
+
<StickyHeader />
|
|
56
54
|
<main className="container">
|
|
57
55
|
<MainTree />
|
|
58
56
|
</main>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import StickyHeaderTemplate from '.';
|
|
4
|
+
import ControlButtons from '../controls/gui-controls';
|
|
5
|
+
|
|
6
|
+
const StickyHeader = () => (
|
|
7
|
+
<StickyHeaderTemplate>
|
|
8
|
+
<ControlButtons />
|
|
9
|
+
</StickyHeaderTemplate>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export default StickyHeader;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, {useState, useCallback} from 'react';
|
|
2
|
+
import {throttle} from 'lodash';
|
|
3
|
+
|
|
4
|
+
import './index.styl';
|
|
5
|
+
import useEventListener from '../../hooks/useEventListener';
|
|
6
|
+
|
|
7
|
+
const MAX_SHOW_HEADER = 10;
|
|
8
|
+
const MIN_HIDE_HEADER = 30;
|
|
9
|
+
|
|
10
|
+
const StickyHeader = ({children}) => {
|
|
11
|
+
const [scrollHeight, setScrollHeight] = useState(0);
|
|
12
|
+
const shouldWrap = scrollHeight > MAX_SHOW_HEADER;
|
|
13
|
+
const handleScroll = useCallback(throttle(() => {
|
|
14
|
+
const shouldShow = scroll => (scroll < MAX_SHOW_HEADER && window.scrollY > MIN_HIDE_HEADER);
|
|
15
|
+
const shouldHide = scroll => (scroll > MIN_HIDE_HEADER && window.scrollY < MAX_SHOW_HEADER);
|
|
16
|
+
const shouldUpdate = scroll => shouldShow(scroll) || shouldHide(scroll);
|
|
17
|
+
const cb = scroll => shouldUpdate(scroll)
|
|
18
|
+
? window.scrollY
|
|
19
|
+
: scroll;
|
|
20
|
+
|
|
21
|
+
setScrollHeight(cb);
|
|
22
|
+
}, 100), [setScrollHeight]);
|
|
23
|
+
|
|
24
|
+
useEventListener('scroll', handleScroll);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className={`sticky-header sticky-header_${shouldWrap ? 'wrapped' : 'unwrapped'}`}>
|
|
28
|
+
<div className="sticky-header__wrap" />
|
|
29
|
+
<div className="sticky-header__content">
|
|
30
|
+
{children}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default StickyHeader;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.sticky-header
|
|
2
|
+
display contents
|
|
3
|
+
|
|
4
|
+
.sticky-header__wrap
|
|
5
|
+
position fixed
|
|
6
|
+
width 100%
|
|
7
|
+
height 40px
|
|
8
|
+
z-index 1000
|
|
9
|
+
text-align center
|
|
10
|
+
background-color white
|
|
11
|
+
border-bottom 1px solid #ccc
|
|
12
|
+
transition transform 250ms ease-out 500ms
|
|
13
|
+
transform-origin top
|
|
14
|
+
transform translateY(-100%)
|
|
15
|
+
|
|
16
|
+
&::before
|
|
17
|
+
transform translateY(50%) rotate(180deg)
|
|
18
|
+
|
|
19
|
+
.sticky-header__content
|
|
20
|
+
position sticky
|
|
21
|
+
top 0
|
|
22
|
+
width 100%
|
|
23
|
+
z-index 1100
|
|
24
|
+
transform-origin top
|
|
25
|
+
transition transform 250ms linear 250ms
|
|
26
|
+
background-color white
|
|
27
|
+
border-bottom 1px solid #ccc
|
|
28
|
+
|
|
29
|
+
&.sticky-header_unwrapped .sticky-header__wrap
|
|
30
|
+
transition-delay 0ms
|
|
31
|
+
|
|
32
|
+
&.sticky-header_wrapped:not(:hover)
|
|
33
|
+
.sticky-header__wrap
|
|
34
|
+
transform translateY(0)
|
|
35
|
+
|
|
36
|
+
.sticky-header__content
|
|
37
|
+
transform translateY(-100%) scaleY(0)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import StickyHeaderTemplate from '.';
|
|
4
|
+
import Header from '../header';
|
|
5
|
+
import ControlButtons from '../controls/report-controls';
|
|
6
|
+
|
|
7
|
+
const StickyHeader = () => (
|
|
8
|
+
<StickyHeaderTemplate>
|
|
9
|
+
<Header />
|
|
10
|
+
<ControlButtons />
|
|
11
|
+
</StickyHeaderTemplate>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export default StickyHeader;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.array
|
|
2
|
+
display inline-flex
|
|
3
|
+
height 25px
|
|
4
|
+
font-size 11px
|
|
5
|
+
border 1px solid #ccc
|
|
6
|
+
border-radius 2px
|
|
7
|
+
user-select none
|
|
8
|
+
|
|
9
|
+
&:hover
|
|
10
|
+
border-color #555
|
|
11
|
+
|
|
12
|
+
.array__container
|
|
13
|
+
display inherit
|
|
14
|
+
flex-wrap wrap
|
|
15
|
+
overflow hidden
|
|
16
|
+
|
|
17
|
+
.array__placeholder
|
|
18
|
+
margin-left 8px
|
|
19
|
+
line-height 22px
|
|
20
|
+
opacity .6
|
|
21
|
+
|
|
22
|
+
.array__item
|
|
23
|
+
flex-shrink 0
|
|
24
|
+
background #ffeb9f
|
|
25
|
+
border 1px solid #cebe7d
|
|
26
|
+
border-radius 3px
|
|
27
|
+
padding 4px
|
|
28
|
+
margin 1px
|
|
29
|
+
line-height 11px
|
|
30
|
+
|
|
31
|
+
&.array__item_hidden
|
|
32
|
+
display none
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, {useLayoutEffect, useRef, useState} from 'react';
|
|
2
|
+
import {get} from 'lodash';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
|
|
6
|
+
import './array.styl';
|
|
7
|
+
|
|
8
|
+
const ArrayContainer = (props, ref) => {
|
|
9
|
+
const {elements, placeholder, ...rest} = props;
|
|
10
|
+
|
|
11
|
+
const containerRef = useRef(null);
|
|
12
|
+
const [hiddenItemsAmount, setHiddenItemsAmount] = useState(0);
|
|
13
|
+
const hiddenAmountClassNames = classNames('array__item', {'array__item_hidden': !hiddenItemsAmount});
|
|
14
|
+
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
const ammount = countHiddenItems();
|
|
17
|
+
|
|
18
|
+
setHiddenItemsAmount(ammount);
|
|
19
|
+
}, [elements]);
|
|
20
|
+
|
|
21
|
+
function countHiddenItems() {
|
|
22
|
+
if (!get(containerRef, 'current.children.length', 0)) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const children = [...containerRef.current.children];
|
|
27
|
+
const showingItemTopOffset = children[0].offsetTop;
|
|
28
|
+
const hiddenElementIndex = children.findIndex(el => el.offsetTop > showingItemTopOffset);
|
|
29
|
+
|
|
30
|
+
return hiddenElementIndex === -1
|
|
31
|
+
? 0
|
|
32
|
+
: children.length - hiddenElementIndex;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div ref={ref} className='array' {...rest}>
|
|
37
|
+
<div ref={containerRef} className='array__container'>
|
|
38
|
+
{elements.length
|
|
39
|
+
? elements.map((element, ind) => (
|
|
40
|
+
<div key={ind} className='array__item'>
|
|
41
|
+
{element}
|
|
42
|
+
</div>
|
|
43
|
+
))
|
|
44
|
+
: <span className='array__placeholder'>{placeholder}</span>
|
|
45
|
+
}
|
|
46
|
+
</div>
|
|
47
|
+
<div className={hiddenAmountClassNames}>
|
|
48
|
+
+ {hiddenItemsAmount}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const ForwardedArrayContainer = React.forwardRef(ArrayContainer);
|
|
55
|
+
|
|
56
|
+
ForwardedArrayContainer.propTypes = {
|
|
57
|
+
elements: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
58
|
+
placeholder: PropTypes.node
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default ForwardedArrayContainer;
|
package/lib/static/gui.html
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
<!
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Gui report</title>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
7
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"/>
|
|
8
|
-
<link id="dynamic-favicon" rel="icon" type="image/png" href="icons/favicon.png" />
|
|
9
|
-
<link href="gui.min.css" rel="stylesheet"></head>
|
|
10
|
-
<body class="report">
|
|
11
|
-
<div id="app"></div>
|
|
12
|
-
<script type="text/javascript" src="sql-wasm.js"></script><script type="text/javascript" src="gui.min.js"></script></body>
|
|
13
|
-
</html>
|
|
1
|
+
<!doctype html><html><head><title>Gui report</title><meta charset="utf-8"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"/><link id="dynamic-favicon" rel="icon" type="image/png" href="icons/favicon.png"/><link href="gui.min.css" rel="stylesheet"></head><body class="report"><div id="app"></div><script src="sql-wasm.js"></script><script src="gui.min.js"></script></body></html>
|