@@ -26,6 +26,10 @@ function determineType(field) {
2626 if ( field . type === "object" ) {
2727 return "container" ;
2828 } else if ( field . type === "array" ) {
29+ // Array of objects
30+ if ( field . items . type === "object" ) {
31+ return "datagrid"
32+ }
2933 // Multi-select
3034 if ( field . items . hasOwnProperty ( "enum" ) ) {
3135 return "selectboxes" ;
@@ -100,7 +104,8 @@ function createComponent(fieldName, fieldObject) {
100104 key : fieldName ,
101105 type : "radio" ,
102106 input : true ,
103- description : fieldObject [ "description" ]
107+ description : fieldObject [ "description" ] ,
108+ tooltip : fieldObject [ "description" ]
104109 } ;
105110 case "selectboxes" :
106111 var options = transformArrayToOptions ( fieldObject . items . enum ) ;
@@ -184,6 +189,24 @@ function createComponent(fieldName, fieldObject) {
184189 input : true ,
185190 components : [ ]
186191 } ;
192+ case "datagrid" :
193+ return {
194+ label : fieldName ,
195+ reorder : false ,
196+ addAnotherPosition : "bottom" ,
197+ layoutFixed : false ,
198+ enableRowGroups : false ,
199+ initEmpty : false ,
200+ tableView : false ,
201+ defaultValue : [
202+ { }
203+ ] ,
204+ validateWhenHidden : false ,
205+ key : fieldName ,
206+ type : "datagrid" ,
207+ input : true ,
208+ components : [ ]
209+ } ;
187210 default :
188211 break ;
189212 }
@@ -197,7 +220,6 @@ function createFormHeading(title, description) {
197220function createAllComponents ( schema , prefix = "" ) {
198221 let components = [ ] ;
199222
200- console . log ( "checking schema" , schema ) ;
201223
202224 if ( schema . type === "object" && schema . properties ) {
203225 for ( const [ key , value ] of Object . entries ( schema . properties ) ) {
@@ -208,7 +230,10 @@ function createAllComponents(schema, prefix = ""){
208230
209231 if ( fieldComponent . type === "container" ) {
210232 fieldComponent . components = createAllComponents ( value , fullKey ) ;
233+ } else if ( fieldComponent . type === "datagrid" ) {
234+ fieldComponent . components = createAllComponents ( value . items , fullKey ) ;
211235 }
236+
212237 components . push ( fieldComponent ) ;
213238 }
214239 }
0 commit comments