Update dynamic components authored by Michel Smola's avatar Michel Smola
...@@ -9,7 +9,7 @@ const Field = { ...@@ -9,7 +9,7 @@ const Field = {
labelContainer: null, labelContainer: null,
valueContainer: null, valueContainer: null,
init({ onClick, type, label, value }) { init({ onClick = null, type, label, value }) {
switch (type) { switch (type) {
case 'int': case 'int':
this.parse = v => parseInt(v, 10); this.parse = v => parseInt(v, 10);
...@@ -29,7 +29,7 @@ const Field = { ...@@ -29,7 +29,7 @@ const Field = {
this.valueContainer = DOMore.create('span', { className: 'value', target: this }); this.valueContainer = DOMore.create('span', { className: 'value', target: this });
this.value = value; this.value = value;
this.addEventListener('click', onClick); if (onClick) this.addEventListener('click', onClick);
}, },
value: { value: {
...@@ -66,5 +66,6 @@ const integerField = DOMore.create(Field, { ...@@ -66,5 +66,6 @@ const integerField = DOMore.create(Field, {
className: 'integer-field', className: 'integer-field',
type: 'int', type: 'int',
value: 7, value: 7,
label: 'Integer Field',
}); });
``` ```
\ No newline at end of file