Fields default to Blank String (#1126)
This commit is contained in:
parent
cd10a713d8
commit
55f01e6f1d
@ -259,7 +259,7 @@ export function createEmptyDraft(collection) {
|
||||
return (dispatch) => {
|
||||
const dataFields = {};
|
||||
collection.get('fields', List()).forEach((field) => {
|
||||
dataFields[field.get('name')] = field.get('default', null);
|
||||
dataFields[field.get('name')] = field.get('default');
|
||||
});
|
||||
const newEntry = createEntry(collection.get('name'), '', '', { data: dataFields });
|
||||
dispatch(emptyDraftCreated(newEntry));
|
||||
|
@ -38,3 +38,7 @@ BooleanControl.propTypes = {
|
||||
forID: PropTypes.string,
|
||||
value: PropTypes.bool,
|
||||
};
|
||||
|
||||
BooleanControl.defaultProps = {
|
||||
value: false,
|
||||
};
|
||||
|
@ -51,7 +51,6 @@ export default class RawEditor extends React.Component {
|
||||
|
||||
render() {
|
||||
const { className } = this.props;
|
||||
|
||||
return (
|
||||
<div className="nc-rawEditor-rawWrapper">
|
||||
<div className="nc-visualEditor-editorControlBar">
|
||||
|
@ -21,6 +21,10 @@ export default class MarkdownControl extends React.Component {
|
||||
value: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
editorControl = props.editorControl;
|
||||
|
@ -15,6 +15,10 @@ export default class NumberControl extends React.Component {
|
||||
max: PropTypes.number,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
handleChange = (e) => {
|
||||
const valueType = this.props.field.get('valueType');
|
||||
const { onChange } = this.props;
|
||||
|
@ -37,6 +37,10 @@ export default class ObjectControl extends Component {
|
||||
forList: PropTypes.bool,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: Map(),
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
|
@ -30,6 +30,10 @@ class RelationControl extends Component {
|
||||
setInactiveStyle: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
constructor(props, ctx) {
|
||||
super(props, ctx);
|
||||
this.controlID = uuid();
|
||||
|
@ -22,6 +22,10 @@ export default class SelectControl extends React.Component {
|
||||
}),
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
handleChange = (e) => {
|
||||
this.props.onChange(e.target.value);
|
||||
};
|
||||
|
@ -11,6 +11,10 @@ export default class StringControl extends React.Component {
|
||||
setInactiveStyle: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
forID,
|
||||
|
@ -12,6 +12,10 @@ export default class TextControl extends React.Component {
|
||||
setInactiveStyle: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
/**
|
||||
* Always update to ensure `react-textarea-autosize` properly calculates
|
||||
* height. Certain situations, such as this widget being nested in a list
|
||||
|
@ -20,6 +20,10 @@ export default function withMediaControl(forImage) {
|
||||
value: PropTypes.node,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.controlID = uuid();
|
||||
|
Loading…
x
Reference in New Issue
Block a user