(force)
| 447 | } |
| 448 | |
| 449 | refreshValue (force) { |
| 450 | const oldi = this.value ? this.value.length : 0 |
| 451 | /* Get the value for this editor */ |
| 452 | this.value = this.rows.map(editor => editor.getValue()) |
| 453 | |
| 454 | if (oldi !== this.value.length || force) { |
| 455 | /* If we currently have minItems items in the array */ |
| 456 | const minItems = this.schema.minItems && this.schema.minItems >= this.rows.length |
| 457 | |
| 458 | this.rows.forEach((editor, i) => { |
| 459 | /* Hide the move down button for the last row */ |
| 460 | if (editor.movedown_button) { |
| 461 | const display = (i !== this.rows.length - 1) |
| 462 | this.setButtonState(editor.movedown_button, display) |
| 463 | } |
| 464 | |
| 465 | /* Hide the delete button if we have minItems items */ |
| 466 | if (editor.delete_button) { |
| 467 | this.setButtonState(editor.delete_button, !minItems) |
| 468 | } |
| 469 | |
| 470 | /* Get the value for this editor */ |
| 471 | this.value[i] = editor.getValue() |
| 472 | }) |
| 473 | |
| 474 | if (this.setupButtons(minItems) && !this.collapsed) { |
| 475 | this.controls.style.display = 'inline-block' |
| 476 | } else { |
| 477 | this.controls.style.display = 'none' |
| 478 | } |
| 479 | } |
| 480 | this.serialized = JSON.stringify(this.value) |
| 481 | } |
| 482 | |
| 483 | addRow (value, initial) { |
| 484 | const i = this.rows.length |
no test coverage detected