@@ -6,16 +6,35 @@ function block (className, element = "div") {
66 return el ;
77}
88
9- function getContainer ( prop ) {
9+ function getPropertyBlock ( prop ) {
1010 let item = block ( `item` ) ,
1111 icon = block ( `icon public` ) ,
12- text = block ( `label` , `span` ) ;
12+ text = block ( `label` , `span` ) ,
13+ type = prop [ "Type" ] || prop [ "ReturnType" ] || prop [ "MimeType" ] || "" ;
1314 item . appendChild ( icon ) ;
14- text . textContent = `${ prop [ "Name" ] } : ${ prop [ "Type" ] } ` ;
15+ text . textContent = `${ prop [ "Name" ] } ${ type ? ": " + type : "" } ` ;
1516 item . appendChild ( text ) ;
1617 return item ;
1718}
1819
20+ function getBlock ( key , data ) {
21+
22+ let section = block ( `section` ) , body , header ;
23+ for ( let prop in data [ key ] ) {
24+ header = block ( `header` ) ;
25+ header . textContent = key ;
26+ body = block ( `body` ) ;
27+ section . appendChild ( header ) ;
28+ section . appendChild ( body ) ;
29+ break ;
30+ }
31+ for ( let prop in data [ key ] ) {
32+ section . appendChild ( getPropertyBlock ( data [ key ] [ prop ] ) ) ;
33+ }
34+ return section ;
35+
36+ }
37+
1938/**
2039 * This function returns card element that may be applied to the grid.
2140 * @param {* } data
@@ -32,20 +51,12 @@ export function getCardElement (data) {
3251 head . appendChild ( header ) ;
3352 card . appendChild ( head ) ;
3453
35- let section , body ;
36- for ( let prop in data [ "Properties" ] ) {
37- section = block ( `section` ) ;
38- header = block ( `header` ) ;
39- header . textContent = "Properties" ;
40- body = block ( `body` ) ;
41- section . appendChild ( header ) ;
42- section . appendChild ( body ) ;
43- card . appendChild ( section ) ;
44- break ;
45- }
46- for ( let prop in data [ "Properties" ] ) {
47- section . appendChild ( getContainer ( data [ "Properties" ] [ prop ] ) ) ;
48- }
54+ card . appendChild ( getBlock ( "Parameters" , data ) ) ;
55+ card . appendChild ( getBlock ( "Properties" , data ) ) ;
56+ card . appendChild ( getBlock ( "Indices" , data ) ) ;
57+ card . appendChild ( getBlock ( "Methods" , data ) ) ;
58+ card . appendChild ( getBlock ( "Queries" , data ) ) ;
59+ card . appendChild ( getBlock ( "XDatas" , data ) ) ;
4960
5061 if ( data [ "_type" ] === "package" ) {
5162 card . addEventListener ( "click" , ( ) => {
0 commit comments