Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 1x 1x 1x 3x 3x 9x 3x 9x | /* Copyright © 2005-2017 Kuali, Inc. - All Rights Reserved
* You may use and modify this code under the terms of the Kuali, Inc.
* Pre-Release License Agreement. You may not distribute it.
*
* You should have received a copy of the Kuali, Inc. Pre-Release License
* Agreement with this file. If not, please write to license@kuali.co.
*/
import PropTypes from 'prop-types'
import styles from './style.css'
import { compact, get } from 'lodash'
import {
FieldCell,
FieldGroup,
Form,
Label,
SelectionControlGroup
} from '@kuali/kuali-ui'
import React, { Component } from 'react'
export default class ListConfig extends Component {
static displayName = 'ListConfig'
static defaultProps = {
gadgets: []
}
static propTypes = {
onChange: PropTypes.func.isRequired,
value: PropTypes.object.isRequired
}
typeChanged = type => {
this.props.onChange({ ...this.props.value, type })
}
fieldChanged = summaryFields => {
const defaultHeaders = compact(summaryFields.split(','))
this.props.onChange({ ...this.props.value, defaultHeaders: defaultHeaders })
}
render () {
const { gadgets, id, value } = this.props
const thisGadgetInstance = gadgets[id]
const childFields = get(thisGadgetInstance, 'children', []).map(child => ({
label: child.label,
value: child.formKey
}))
return (
<div>
<h3>Settings</h3>
<Form showGrid>
<FieldGroup>
<FieldCell>
<Label htmlFor='listType'>Edit mode</Label>
<SelectionControlGroup
controls={[
{
label: 'Inline',
value: 'inline'
},
{
label: 'Dialog',
value: 'dialog'
}
]}
controlClassName={styles['listType-radio']}
id='listType'
inline
name='listType'
onChange={this.typeChanged}
type='radio'
value={get(value, 'type')}
/>
</FieldCell>
</FieldGroup>
<FieldGroup>
<FieldCell>
<Label htmlFor='tableFields'>Default Columns</Label>
<SelectionControlGroup
controls={childFields}
id='tableFields'
name='tableFields'
onChange={this.fieldChanged}
type='checkbox'
value={get(
value,
'defaultHeaders',
childFields.map(field => field.value)
).join(',')}
/>
</FieldCell>
</FieldGroup>
</Form>
</div>
)
}
}
|