@darwino/darwino-react-bootstrap
Version:
A set of Javascript classes and utilities
57 lines (50 loc) • 1.61 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
/*
* (c) Copyright Darwino Inc. 2014-2017.
*/
import React, { Component } from "react";
import { Col, FormControl, FormGroup, ControlLabel } from 'react-bootstrap';
import FieldStatic from './FieldStatic';
class FieldText extends Component {
render() {
var _this$props = this.props,
{
input,
multiple,
type,
editable,
separator,
disabled,
readOnly,
meta
} = _this$props,
props = _objectWithoutProperties(_this$props, ["input", "multiple", "type", "editable", "separator", "disabled", "readOnly", "meta"]);
if (readOnly) return /*#__PURE__*/React.createElement(FieldStatic, this.props);
var inputType = type;
var inputReadOnly = editable !== undefined && editable;
var inputAttr = input;
if (multiple) {
inputAttr = {
value: Array.isArray(input.value) ? input.value.join(separator || ',') : "",
onBlur: e => {
var a = (e.target.value || "").split(separator || ',');
input.onBlur(a);
},
onChange: e => {
var a = (e.target.value || "").split(separator || ',');
input.onChange(a);
}
};
inputType = "text";
}
return /*#__PURE__*/React.createElement(FormControl, _extends({
type: type
}, props, inputAttr, {
disabled: disabled,
readOnly: inputReadOnly
}));
}
}
export default FieldText;
//# sourceMappingURL=FieldText.js.map