8000 Merge pull request #1 from SaffronCode/inputDebug · SaffronCode/SaffronCodeJS@86f3c64 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit 86f3c64

Browse files
authored
Merge pull request #1 from SaffronCode/inputDebug
Patterns added to Saffron Input
2 parents e7ad608 + c31aa22 commit 86f3c64

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ui/Input.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export default class Input extends Component {
88
type:"text",
99
value:"",
1010
name:'',
11+
className:"",
12+
placeholder:null,
13+
pattern:"",
1114
/*defaultChecked:false,
1215
checked:false,*/
1316
}
@@ -25,6 +28,10 @@ export default class Input extends Component {
2528
onChange(item)
2629
{
2730
item.target.value = this.NumberChange(this.correctString(item.target.value));
31+
if(this.props.pattern!=="")
32+
{
33+
item.target.value = String(item.target.value).match(this.props.pattern);
34+
}
2835
this.state.onChange(item);
2936
}
3037

@@ -61,7 +68,9 @@ export default class Input extends Component {
6168
type={currentType}
6269
value={this.state.value}
6370
inputmode={inputmode}
71+
className={this.state.className}
6472
defaultChecked={this.state.defaultChecked}
73+
placeholder={this.state.placeholder}
6574
checked={this.state.checked}/>
6675
)
6776
}

0 commit comments

Comments
 (0)
0