@@ -44,9 +44,8 @@ public partial class OtpInput
4444 . AddClass ( ValidCss )
4545 . Build ( ) ;
4646
47- private string ? InputClassString => CssBuilder . Default ( )
47+ private string ? InputClassString => CssBuilder . Default ( "bb-opt-item" )
4848 . AddClass ( "input-number-fix" , Type == OtpInputType . Number )
49- . AddClass ( "disabled" , IsDisabled )
5049 . Build ( ) ;
5150
5251 private string TypeString => Type switch
@@ -58,8 +57,8 @@ public partial class OtpInput
5857
5958 private string ? MaxLengthString => Type switch
6059 {
61- OtpInputType . Text => "1" ,
62- _ => null
60+ OtpInputType . Number => null ,
61+ _ => "1"
6362 } ;
6463
6564 private string ? TypeModeString => Type switch
@@ -77,34 +76,19 @@ protected override void OnParametersSet()
7776 {
7877 base . OnParametersSet ( ) ;
7978
79+ Value ??= "" ;
8080 _values = new char [ Digits ] ;
81- if ( Value != null )
81+ for ( var index = 0 ; index < Digits ; index ++ )
8282 {
83- for ( var index = 0 ; index < Digits ; index ++ )
83+ if ( index < Value . Length )
8484 {
85- if ( index < Value . Length )
86- {
87- _values [ index ] = Value [ index ] ;
88- }
85+ _values [ index ] = Value [ index ] ;
8986 }
9087 }
9188 }
9289
9390 private char ? GetValueString ( int index )
9491 {
95- char ? c = _values . ElementAtOrDefault ( index ) ;
96- if ( c == 0 )
97- {
98- c = null ;
99- }
100- return c ;
101- }
102-
103- private void OnChanged ( string ? v , int index )
104- {
105- if ( index < Digits && ! string . IsNullOrEmpty ( v ) )
106- {
107- _values [ index ] = v [ 0 ] ;
108- }
92+ return _values [ index ] != 0 ? _values [ index ] : null ;
10993 }
11094}
0 commit comments