You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
638 B
31 lines
638 B
const Component = require('react').Component
|
|
const h = require('react-hyperscript')
|
|
const inherits = require('util').inherits
|
|
|
|
module.exports = ReadOnlyInput
|
|
|
|
inherits(ReadOnlyInput, Component)
|
|
function ReadOnlyInput () {
|
|
Component.call(this)
|
|
}
|
|
|
|
ReadOnlyInput.prototype.render = function () {
|
|
const {
|
|
wrapperClass = '',
|
|
inputClass = '',
|
|
value,
|
|
textarea,
|
|
} = this.props
|
|
|
|
const inputType = textarea ? 'textarea' : 'input'
|
|
|
|
return h('div', {className: wrapperClass}, [
|
|
h(inputType, {
|
|
className: inputClass,
|
|
value,
|
|
readOnly: true,
|
|
onFocus: event => event.target.select(),
|
|
}),
|
|
])
|
|
}
|
|
|
|
|