extpoint-yii2
Version:
JavaScript part for projects on ExtPoint Yii2 Boilerplate and yii2-core
44 lines (37 loc) • 1.16 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
export default class FieldSet extends React.Component {
static propTypes = {
model: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
]),
prefix: PropTypes.string,
layout: PropTypes.string,
layoutCols: PropTypes.arrayOf(PropTypes.number),
};
static childContextTypes = {
model: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
]),
prefix: PropTypes.string,
layout: PropTypes.string,
layoutCols: PropTypes.arrayOf(PropTypes.number),
};
getChildContext() {
return {
model: this.props.model || this.context.model,
prefix: (this.context.prefix || '') + (this.props.prefix || ''),
layout: this.context.layout || this.props.layout,
layoutCols: this.context.layoutCols || this.props.layoutCols,
};
}
render() {
return (
<span>
{this.props.children}
</span>
);
}
}