diff --git a/example/data/array.json b/example/data/array.json index 8bcdb186..f770e793 100644 --- a/example/data/array.json +++ b/example/data/array.json @@ -36,6 +36,19 @@ "title": "Type", "type": "string", "enum": ["home", "work", "mobile", "fax", "etc"] + }, + "nested": { + "title": "Nested", + "type": "array", + "items": { + "type": "object", + "properties": { + "first": { + "title": "First", + "type": "string" + } + } + } } }, "required": ["name","comment"] @@ -80,6 +93,12 @@ { "name": "Fax", "value": "fax" }, { "name": "Etc", "value": "etc" } ] + }, + { + "key": "comments[].nested", + "items": [ + "comments[].nested[].first" + ] } ] } diff --git a/src/Array.js b/src/Array.js index c56e14a5..78a16348 100644 --- a/src/Array.js +++ b/src/Array.js @@ -55,8 +55,6 @@ type State = { class Array extends Component { static ITEM_ID = "_SCHEMAFORM_ITEM_ID"; - static SEQUENCE = 1; - static assignItemId(item) { if (item && typeof item === "object" && !item[Array.ITEM_ID]) { const newItem = Object.assign({}, item); @@ -87,6 +85,8 @@ class Array extends Component { return copy; }; + SEQUENCE = 1; + constructor(props) { super(props); const { form, model } = this.props;