UNPKG

@react-awesome-query-builder/mui

Version:
41 lines 1.26 kB
import _extends from "@babel/runtime/helpers/extends"; import React from "react"; import TextField from "@mui/material/TextField"; import FormControl from "@mui/material/FormControl"; export default (function (props) { var value = props.value, setValue = props.setValue, config = props.config, readonly = props.readonly, placeholder = props.placeholder, customProps = props.customProps, maxLength = props.maxLength, maxRows = props.maxRows, fullWidth = props.fullWidth; var defaultMaxRows = config.settings.defaultMaxRows; var onChange = function onChange(e) { var val = e.target.value; if (val === "") val = undefined; // don't allow empty value setValue(val); }; var textValue = value || ""; return /*#__PURE__*/React.createElement(FormControl, { fullWidth: fullWidth }, /*#__PURE__*/React.createElement(TextField, _extends({ variant: "standard", fullWidth: fullWidth, maxRows: maxRows || defaultMaxRows, multiline: true, value: textValue, placeholder: !readonly ? placeholder : "", InputProps: { readOnly: readonly }, inputProps: { maxLength: maxLength }, disabled: readonly, onChange: onChange, size: "small" }, customProps))); });