File tree Expand file tree Collapse file tree 2 files changed +8
-19
lines changed
src/BootstrapBlazor/Components/Input Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change 44<div @attributes =" AdditionalAttributes" id =" @Id" class =" @ClassString" >
55 @for ( var index = 0 ; index < Digits ; index ++ )
66 {
7- @if (IsReadonly || IsDisabled )
8- {
9- <span class =" @ItemClassString" >
10- @GetValueString(index)
11- </span >
12- }
13- else
14- {
15- <input type =" @TypeString" class =" @InputClassString"
16- maxlength =" @MaxLengthString" inputmode =" @TypeModeString" placeholder =" @PlaceHolder"
17- value =" @GetValueString(index)" />
18- }
7+ <input type =" @TypeString" class =" @InputClassString"
8+ maxlength =" @MaxLengthString" inputmode =" @TypeModeString" placeholder =" @PlaceHolder"
9+ value =" @GetValueString(index)" readonly =" @ReadonlyString" disabled =" @DisabledString" />
1910 }
2011</div >
Original file line number Diff line number Diff line change @@ -39,11 +39,6 @@ public partial class OtpInput
3939 . AddClassFromAttributes ( AdditionalAttributes )
4040 . Build ( ) ;
4141
42- private string ? ItemClassString => CssBuilder . Default ( "bb-opt-item" )
43- . AddClass ( "disabled" , IsDisabled )
44- . AddClass ( ValidCss )
45- . Build ( ) ;
46-
4742 private string ? InputClassString => CssBuilder . Default ( "bb-opt-item" )
4843 . AddClass ( "input-number-fix" , Type == OtpInputType . Number )
4944 . AddClass ( ValidCss )
@@ -68,6 +63,10 @@ public partial class OtpInput
6863 _ => null
6964 } ;
7065
66+ private string ? ReadonlyString => IsReadonly ? "readonly" : null ;
67+
68+ private string ? DisabledString => IsDisabled ? "disabled" : null ;
69+
7170 private char [ ] _values = [ ] ;
7271
7372 /// <summary>
@@ -96,10 +95,9 @@ protected override void OnParametersSet()
9695
9796 private char ? GetValueString ( int index )
9897 {
99- return _values [ index ] != 0 ? _values [ index ] : null ;
98+ return _values [ index ] != 0 ? _values [ 0 ] : null ;
10099 }
101100
102-
103101 /// <summary>
104102 /// Trigger value changed event callback. Trigger by JavaScript.
105103 /// </summary>
You can’t perform that action at this time.
0 commit comments