@darwino/darwino-react-onsenui
Version:
A set of Javascript classes and utilities for OnsenUI
59 lines (51 loc) • 1.67 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 FieldStatic from './FieldStatic';
import { Input } from 'react-onsenui';
class FieldText extends Component {
render() {
var _this$props = this.props,
{
input,
multiple,
type,
editable,
separator,
disabled,
readOnly
} = _this$props,
props = _objectWithoutProperties(_this$props, ["input", "multiple", "type", "editable", "separator", "disabled", "readOnly"]);
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";
} // OnsenUI Bug: https://github.com/OnsenUI/OnsenUI/issues/2323
// readOnly={inputReadOnly}
var ro = {};
if (inputReadOnly) ro.readOnly = true;
return /*#__PURE__*/React.createElement(Input, _extends({
type: type
}, props, inputAttr, {
disabled: disabled
}, ro));
}
}
export default FieldText;
//# sourceMappingURL=FieldText.js.map