1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import get from 'lodash/get'
import PropTypes from 'prop-types'
import * as keyPropTypes from './keyPropTypes'
import KeyValue from './KeyValue'
import styles from './styles.module.css'
function KeyParamlist(props) {
const { index, params, values, onSelect, root } = props
return (
<span
className={styles.params}
data-is-root={!!root}
data-param-count={params.length}
>
{params.map((param, i) => (
<span key={`param-${i}`} className={styles.param}>
<KeyValue
index={index.indexOf(values[i])}
param={param}
value={get(values[i], 'value')}
source={get(values[i], 'source')}
onSelect={onSelect}
/>
{get(values[i], 'source.params.length') > 0 ? (
<KeyParamlist
index={index}
params={get(values[i], 'source.params')}
values={get(values[i], 'params')}
onSelect={onSelect}
/>
) : null}
</span>
))}
</span>
)
}
KeyParamlist.propTypes = {
index: keyPropTypes.index.isRequired,
params: PropTypes.arrayOf(keyPropTypes.param).isRequired,
values: PropTypes.arrayOf(keyPropTypes.node).isRequired,
source: keyPropTypes.source,
onSelect: PropTypes.func.isRequired
}
export default KeyParamlist
|