Readonly select will be basic readonly inputs

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-09-05 14:03:58 +02:00
parent 1d0108ac80
commit 60b7e187fe
Signed by: Florian Bouillon
GPG Key ID: 50BD648F12C86AB6

View File

@ -97,7 +97,7 @@ export default class Input extends React.Component<Props, States> {
baseProps.onWheel = (ev: React.WheelEvent<HTMLInputElement>) => ev.currentTarget.blur() baseProps.onWheel = (ev: React.WheelEvent<HTMLInputElement>) => ev.currentTarget.blur()
} }
if (this.props.type === 'select') { if (this.props.type === 'select' && !this.props.readOnly) {
input = ( input = (
<select <select
ref={this.props.selectRef || this.inputRef} ref={this.props.selectRef || this.inputRef}
@ -112,6 +112,15 @@ export default class Input extends React.Component<Props, States> {
{this.props.children} {this.props.children}
</select> </select>
) )
// select is readonly
} else if (this.props.type === 'select') {
input = (
<input
{...props}
{...baseProps}
type="text"
/>
)
} else if (this.props.type === 'textarea') { } else if (this.props.type === 'textarea') {
delete baseProps.ref delete baseProps.ref
input = ( input = (