MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / InputSQL

Function InputSQL

web/pgadmin/static/js/components/FormComponents.jsx:189–217  ·  view source on GitHub ↗
({ value, options={}, onChange, className, controlProps, inputRef, ...props })

Source from the content-addressed store, hash-verified

187};
188
189export function InputSQL({ value, options={}, onChange, className, controlProps, inputRef, ...props }) {
190
191 const editor = useRef();
192 const { autocompleteProvider, autocompleteOnKeyPress } = options;
193
194 return (
195 <Root style={{height: '100%'}}>
196 <CodeMirror
197 currEditor={(obj) => {
198 editor.current = obj;
199 inputRef?.(obj);
200 if(autocompleteProvider) {
201 editor.current.registerAutocomplete(autocompleteProvider);
202 }
203 }}
204 value={value || ''}
205 options={{
206 ..._.omit(options, ['autocompleteProvider', 'autocompleteOnKeyPress']),
207 }}
208 className={'Form-sql ' + className}
209 onChange={onChange}
210 autocomplete={true}
211 autocompleteOnKeyPress={autocompleteOnKeyPress}
212 {...controlProps}
213 {...props}
214 />
215 </Root>
216 );
217}
218InputSQL.propTypes = {
219 value: PropTypes.string,
220 options: PropTypes.object,

Callers

nothing calls this directly

Calls 1

registerAutocompleteMethod · 0.80

Tested by

no test coverage detected