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
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import React, {Component} from 'react';
|
|
4
|
-
import {flatten, isEmpty, get, chain, compact} from 'lodash';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
import TreeSelect, {SHOW_PARENT} from 'rc-tree-select';
|
|
8
|
-
|
|
9
|
-
import 'rc-tree-select/assets/index.less';
|
|
10
|
-
|
|
11
|
-
const ROOT_NODE_ID = 'ROOT_NODE_ID';
|
|
12
|
-
|
|
13
|
-
export default class BrowserList extends Component {
|
|
14
|
-
static propTypes = {
|
|
15
|
-
available: PropTypes.arrayOf(PropTypes.shape({
|
|
16
|
-
id: PropTypes.string,
|
|
17
|
-
versions: PropTypes.arrayOf(PropTypes.string)
|
|
18
|
-
})).isRequired,
|
|
19
|
-
selected: PropTypes.arrayOf(PropTypes.shape({
|
|
20
|
-
id: PropTypes.string,
|
|
21
|
-
versions: PropTypes.arrayOf(PropTypes.string)
|
|
22
|
-
})),
|
|
23
|
-
onChange: PropTypes.func.isRequired
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
_buildComplexId(browserId, version) {
|
|
27
|
-
return version
|
|
28
|
-
? `${browserId} (${version})`
|
|
29
|
-
: browserId;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
_prepareTreeData() {
|
|
33
|
-
const {available} = this.props;
|
|
34
|
-
const mkNode = (parentId, browserId, version) => {
|
|
35
|
-
const id = this._buildComplexId(browserId, version);
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
pId: parentId,
|
|
39
|
-
key: id,
|
|
40
|
-
label: id,
|
|
41
|
-
value: id,
|
|
42
|
-
data: {id, browserId, version}
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const tree = available.map(({id: browserId, versions = []}) => {
|
|
47
|
-
if (isEmpty(versions) || versions.length === 1) {
|
|
48
|
-
return mkNode(ROOT_NODE_ID, browserId);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const rootNode = mkNode(ROOT_NODE_ID, browserId);
|
|
52
|
-
const subNodes = versions.map((version) => mkNode(rootNode.key, browserId, version));
|
|
53
|
-
|
|
54
|
-
return [].concat(rootNode, subNodes);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return flatten(tree);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_buidSelectedItems() {
|
|
61
|
-
const {available, selected = []} = this.props;
|
|
62
|
-
const selectedItems = selected.map(({id, versions}) => {
|
|
63
|
-
const availableNode = available.find((item) => item.id === id);
|
|
64
|
-
const shouldDrawOnlyRootNode = get(availableNode, 'versions', []).length === 1 || isEmpty(versions);
|
|
65
|
-
|
|
66
|
-
if (shouldDrawOnlyRootNode) {
|
|
67
|
-
return this._buildComplexId(id);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return versions.map((version) => this._buildComplexId(id, version));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return flatten(selectedItems);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
_formatSelectedData(selectedItems) {
|
|
77
|
-
const treeDataMap = this._simpleTree.reduce((map, item) => {
|
|
78
|
-
map[item.value] = item.data;
|
|
79
|
-
|
|
80
|
-
return map;
|
|
81
|
-
}, {});
|
|
82
|
-
|
|
83
|
-
return chain(selectedItems)
|
|
84
|
-
.reduce((map, id) => {
|
|
85
|
-
const {browserId, version} = treeDataMap[id] || {};
|
|
86
|
-
const versions = map[browserId] || [];
|
|
87
|
-
|
|
88
|
-
versions.push(version);
|
|
89
|
-
|
|
90
|
-
map[browserId] = versions;
|
|
91
|
-
|
|
92
|
-
return map;
|
|
93
|
-
}, {})
|
|
94
|
-
.map((versions, id) => ({id, versions: compact(versions)}))
|
|
95
|
-
.value();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_shouldNotRender() {
|
|
99
|
-
return isEmpty(this.props.available);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
render() {
|
|
103
|
-
if (this._shouldNotRender()) {
|
|
104
|
-
return (<div></div>);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
this._simpleTree = this._prepareTreeData();
|
|
108
|
-
|
|
109
|
-
const treeDataSimpleMode = {id: 'key', rootPId: ROOT_NODE_ID};
|
|
110
|
-
const hasNestedLevels = this._simpleTree.find(node => node.pId !== ROOT_NODE_ID);
|
|
111
|
-
const removeIcon = (<i className="fa fa-times browserlist__icon-remove" aria-hidden="true"></i>);
|
|
112
|
-
const switcherIcon = (item) => {
|
|
113
|
-
if (item.isLeaf) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return item.expanded
|
|
118
|
-
? <i className="fa fa-minus browserlist__icon-tree" aria-hidden="true"></i>
|
|
119
|
-
: <i className="fa fa-plus browserlist__icon-tree" aria-hidden="true"></i>;
|
|
120
|
-
};
|
|
121
|
-
const dropdownClassName = classNames(
|
|
122
|
-
{'browserlist_linear': !hasNestedLevels},
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<div className="browserlist">
|
|
127
|
-
<TreeSelect
|
|
128
|
-
className='browserlist__select'
|
|
129
|
-
dropdownStyle={{
|
|
130
|
-
height: 'auto',
|
|
131
|
-
width: '300px',
|
|
132
|
-
overflow: 'hidden',
|
|
133
|
-
zIndex: 50
|
|
134
|
-
}}
|
|
135
|
-
dropdownClassName={dropdownClassName}
|
|
136
|
-
switcherIcon={switcherIcon}
|
|
137
|
-
defaultValue={this._buidSelectedItems()}
|
|
138
|
-
showSearch={false}
|
|
139
|
-
treeCheckable
|
|
140
|
-
placeholder="Browsers"
|
|
141
|
-
treeData={this._simpleTree}
|
|
142
|
-
treeNodeFilterProp="title"
|
|
143
|
-
treeDataSimpleMode={treeDataSimpleMode}
|
|
144
|
-
showCheckedStrategy={SHOW_PARENT}
|
|
145
|
-
removeIcon={removeIcon}
|
|
146
|
-
treeIcon={<i></i>}
|
|
147
|
-
onChange={(selected) => this.props.onChange(this._formatSelectedData(selected))}
|
|
148
|
-
maxTagCount={2}
|
|
149
|
-
/>
|
|
150
|
-
</div>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
}
|