@@ -68,7 +68,7 @@ <h1>mist-form</h1>
68
68
// {id: 'ordering'},
69
69
{ id : 'references' } ,
70
70
// {id: 'custom'},
71
- { id : 'errors' } ,
71
+ // {id: 'errors'},
72
72
{ id : 'examples' } ,
73
73
{ id : 'large' } ,
74
74
{ id : 'datetime' , title : "Date & Time" } ,
@@ -81,8 +81,8 @@ <h1>mist-form</h1>
81
81
// {id: 'propdeps', title: "Property dependencies"},
82
82
// {id: 'schemadeps', title: "Schema dependencies"},
83
83
// {id: 'addprops', title: "Additional Properties"},
84
- // {id: 'anyof', title: "Any Of"},
85
- // {id: 'oneof', title: "One Of"},
84
+ { id : 'anyof' , title : "Any Of" } ,
85
+ { id : 'oneof' , title : "One Of" } ,
86
86
{ id : 'allof' , title : "All Of" } ,
87
87
{ id : 'ifthenelse' , title : "If Then Else" } ,
88
88
// {id: 'nullfields', title: "Null Fields"},
@@ -99,10 +99,12 @@ <h1>mist-form</h1>
99
99
]
100
100
}
101
101
102
+ // eslint-disable-next-line func-names
102
103
export const debouncer = function ( callback , wait ) {
103
104
let timeout = 1000 ;
104
105
return ( ...args ) => {
105
106
clearTimeout ( timeout ) ;
107
+ // eslint-disable-next-line func-names
106
108
timeout = setTimeout ( function ( ) {
107
109
callback . apply ( this , args ) ;
108
110
} , wait ) ;
@@ -165,13 +167,14 @@ <h1>mist-form</h1>
165
167
const newValue = formDataEditor . getValue ( ) ;
166
168
try {
167
169
document . querySelector ( 'mist-form' ) . formData = JSON . parse ( newValue ) ;
168
- } catch ( e ) {
170
+ } catch {
169
171
if ( document . querySelector ( 'mist-form' ) . formData !== newValue ) {
170
172
document . querySelector ( 'mist-form' ) . formData = newValue ;
171
173
}
172
174
}
173
175
} , 150 ) ) ;
174
- document . querySelector ( 'mist-form' ) . addEventListener ( 'form-data-changed' , function ( e ) {
176
+ // eslint-disable-next-line func-names
177
+ document . querySelector ( 'mist-form' ) . addEventListener ( 'form-data-changed' , function ( ) {
175
178
let newValue = this . domValue ;
176
179
switch ( typeof ( newValue ) ) {
177
180
case "string" :
@@ -191,7 +194,7 @@ <h1>mist-form</h1>
191
194
formDataEditor . setValue ( newValue ) ;
192
195
}
193
196
} ) ;
194
- updateTab ( ) ;
197
+ document . querySelector ( 'mist-form' ) . dispatchEvent ( new CustomEvent ( 'form-data-changed' , { detail : { } , bubbles : true , composed : true } ) ) ;
195
198
} ) ;
196
199
function updateTab ( e ) {
197
200
const preset = e ? e . detail . value : 0 ;
@@ -200,9 +203,10 @@ <h1>mist-form</h1>
200
203
. then ( response => response . json ( ) )
201
204
. then ( async body => {
202
205
const form = document . querySelector ( 'mist-form#playground' ) ;
203
- form . jsonSchema = body . jsonSchema ;
206
+ // debugger;
207
+ form . formData = body . formData || { } ;
208
+ form . jsonSchema = body . jsonSchema || body ;
204
209
form . uiSchema = body . uiSchema ;
205
- form . formData = body . formData ;
206
210
if ( jsonSchemaEditor ) jsonSchemaEditor . setValue ( JSON . stringify ( body . jsonSchema || body , null , 2 ) ) ;
207
211
if ( uiSchemaEditor ) uiSchemaEditor . setValue ( JSON . stringify ( body . uiSchema || { } , null , 2 ) ) ;
208
212
if ( formDataEditor ) formDataEditor . setValue ( JSON . stringify ( body . formData || { } , null , 2 ) ) ;
0 commit comments