@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
22import React from 'react' ;
33import TextField from '@material-ui/core/TextField' ;
44
5- const BuildQueryString = ( { action, cb, child, customTypes, parent, showQuery, query} ) => {
5+ const BuildQueryString = ( { action, cb, child, customTypes, parent, showQuery, query, blob } ) => {
66
77 React . useEffect ( ( ) => {
88 handleBuildQuery ( action , child . val , child . type , child . index , child . id , child . name , parent . id , parent . name , parent . type ) ;
@@ -45,8 +45,9 @@ const BuildQueryString = ({action, cb, child, customTypes, parent, showQuery, qu
4545 const setTypeInput = ( name , type , customTypes , v ) =>
4646 type [ 0 ] == '[' ? createArrayInput ( name , type , customTypes , v )
4747 : type [ 0 ] == '{' ? createSetInput ( name , type , customTypes , v )
48- : type == 'str' || type == 'utf8' || type == 'raw' ? `'${ v } '`
49- : `${ v } ` ;
48+ : type == 'str' || type == 'utf8' ? `'${ v } '`
49+ : type == 'raw' ? ( blob [ v ] ? `${ v } ` : `'${ v } '` )
50+ : `${ v } ` ;
5051
5152 const mapTypeInput = ( v , customTypes ) => v . map ( ( { name, type, val} ) => `${ name } : ${ customTypeInput ( name , type , customTypes , val ) } ` ) ;
5253
@@ -68,7 +69,8 @@ const BuildQueryString = ({action, cb, child, customTypes, parent, showQuery, qu
6869 return parentType === 'list' ? ( childIndex === null ? `#${ parentId } .${ parentName } .push(${ value } );` : `#${ parentId } .${ parentName } [${ childIndex } ] = ${ value } ;` )
6970 : parentType === 'thing' ? `#${ parentId } .${ childName } = ${ value } ;`
7071 : parentType === 'set' ? `#${ parentId } .${ parentName } .add(${ value } );`
71- : '' ;
72+ : customTypes . hasOwnProperty ( parentType ) ? `#${ parentId } .${ childName } = ${ value } ;`
73+ : '' ;
7274 } ;
7375
7476 const buildQueryRemove = ( parentId , parentName , parentType , childId , childName , childIndex ) => {
@@ -108,10 +110,12 @@ const BuildQueryString = ({action, cb, child, customTypes, parent, showQuery, qu
108110
109111BuildQueryString . defaultProps = {
110112 query : '' ,
113+ blob :{ } ,
111114} ;
112115
113116BuildQueryString . propTypes = {
114117 action : PropTypes . string . isRequired ,
118+ blob : PropTypes . object ,
115119 cb : PropTypes . func . isRequired ,
116120 child : PropTypes . object . isRequired ,
117121 customTypes : PropTypes . object . isRequired ,
0 commit comments