mirror of
https://github.com/apache/superset.git
synced 2026-04-10 20:06:13 +00:00
* Change in files * Renamin files and folders * cleaning up a single piece of lint * Removing boat picture from docs * add superset word mark * Update rename note in docs * Fixing images * Pinning datatables * Fixing issues with mapbox-gl * Forgot to rename one file * Linting * v0.13.0 * adding pyyaml to dev-reqs
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import React, { PropTypes } from 'react';
|
|
import FieldSet from './FieldSet';
|
|
|
|
const NUM_COLUMNS = 12;
|
|
|
|
const propTypes = {
|
|
fields: PropTypes.object.isRequired,
|
|
fieldSets: PropTypes.array.isRequired,
|
|
fieldOverrides: PropTypes.object,
|
|
onChange: PropTypes.func,
|
|
form_data: PropTypes.object.isRequired,
|
|
};
|
|
|
|
const defaultProps = {
|
|
fieldOverrides: {},
|
|
onChange: () => {},
|
|
};
|
|
|
|
export default class FieldSetRow extends React.Component {
|
|
getFieldData(fs) {
|
|
const { fields, fieldOverrides } = this.props;
|
|
let fieldData = fields[fs];
|
|
if (fieldOverrides.hasOwnProperty(fs)) {
|
|
const overrideData = fieldOverrides[fs];
|
|
fieldData = Object.assign({}, fieldData, overrideData);
|
|
}
|
|
return fieldData;
|
|
}
|
|
render() {
|
|
const colSize = NUM_COLUMNS / this.props.fieldSets.length;
|
|
return (
|
|
<div className="row">
|
|
{this.props.fieldSets.map((fs) => {
|
|
const fieldData = this.getFieldData(fs);
|
|
return (
|
|
<div className={`col-lg-${colSize} col-xs-12`} key={fs}>
|
|
<FieldSet
|
|
name={fs}
|
|
onChange={this.props.onChange}
|
|
value={this.props.form_data[fs]}
|
|
{...fieldData}
|
|
/>
|
|
</div>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
FieldSetRow.propTypes = propTypes;
|
|
FieldSetRow.defaultProps = defaultProps;
|