import * as React from "react"; import * as cx from "classnames"; import { Dispatch } from "redux"; import { PCQuery, PCQueryType, PCVariable } from "paperclip"; import { BaseQueryItemProps, QueryOptions } from "./view.pc"; import { queryLabelChanged } from "../../../../../actions"; export type Props = { query: PCQuery; dispatch: Dispatch; globalVariables: PCVariable[]; }; export default (Base: React.ComponentClass) => class BaseQueryItemController extends React.PureComponent { onLabelChange = (value: string) => { this.props.dispatch(queryLabelChanged(this.props.query, value)); }; render() { const { onLabelChange } = this; const { query, dispatch, globalVariables, ...rest } = this.props; return ( ) }} labelInputProps={{ value: query.label, focus: !query.label, onChangeComplete: onLabelChange }} /> ); } };