export class Default extends SampleBase {
onCreated() { this.element.setAttribute('maxLength', '5') }
render() {
return (<div className='control-pane'>
<div className='control-section input-content-wrapper'>
<div className="row custom-margin">
<div className="col-xs-6 col-sm-6 col-lg-6 col-md-6"></div>
</div>
<div className="row custom-margin custom-padding-5">
<div className="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<TextBoxComponent placeholder="Max length" created={this.onCreated} floatLabelType="Auto" />
</div>
</div>
</div>
</div>);
}
} |
export class Default extends SampleBase {
render() {
return (<div className='control-pane'>
<div className='control-section input-content-wrapper'>
<div className="row custom-margin">
<div className="col-xs-6 col-sm-6 col-lg-6 col-md-6"></div>
</div>
<div className="row custom-margin custom-padding-5">
<div className="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<TextBoxComponent placeholder="Natural Number" type="number" floatLabelType="Auto" />
</div>
</div>
</div>
</div>);
}
} |
export class Default extends SampleBase {
onCreated() {
const input = document.querySelector('input');
input.addEventListener('keydown', function (e) {
if (/ ^ [0-9] $ /.test(e.key) || e.key === '.' || e.key === '-' || e.key === '') { e.preventDefault(); return true; }
})
}
render() {
return (<div className='control-pane'>
<div className='control-section input-content-wrapper'>
<div className="row custom-margin">
<div className="col-xs-6 col-sm-6 col-lg-6 col-md-6"></div>
</div>
<div className="row custom-margin custom-padding-5">
<div className="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<TextBoxComponent placeholder="Natural Number" type="number" floatLabelType="Always" created={this.onCreated} />
</div>
</div>
</div>
</div>);
}
} |