6
6
using Microsoft . AspNetCore . Components ;
7
7
using Microsoft . AspNetCore . Components . Web ;
8
8
using Microsoft . FluentUI . AspNetCore . Components . Extensions ;
9
+ using Microsoft . FluentUI . AspNetCore . Components . Utilities ;
9
10
10
11
namespace Microsoft . FluentUI . AspNetCore . Components ;
11
12
@@ -16,6 +17,8 @@ namespace Microsoft.FluentUI.AspNetCore.Components;
16
17
public partial class FluentSlider < TValue > : FluentInputBase < TValue > , ITooltipComponent
17
18
where TValue : struct , IComparable < TValue >
18
19
{
20
+ private readonly Debounce _debounce = new ( ) ;
21
+
19
22
/// <summary>
20
23
/// Initializes a new instance of the <see cref="FluentSlider{TValue}"/> class.
21
24
/// </summary>
@@ -80,6 +83,12 @@ public FluentSlider(LibraryConfiguration configuration) : base(configuration)
80
83
[ Parameter ]
81
84
public string ? Tooltip { get ; set ; }
82
85
86
+ /// <summary>
87
+ /// Gets or sets the delay, in milliseconds, before to raise the change event.
88
+ /// </summary>
89
+ [ Parameter ]
90
+ public ushort ImmediateDelay { get ; set ; } = 60 ;
91
+
83
92
/// <summary />
84
93
protected override async Task OnInitializedAsync ( )
85
94
{
@@ -107,6 +116,15 @@ protected virtual Task FocusOutHandlerAsync(FocusEventArgs e)
107
116
return Task . CompletedTask ;
108
117
}
109
118
119
+ /// <summary />
120
+ protected override Task ChangeHandlerAsync ( ChangeEventArgs e )
121
+ {
122
+ return _debounce . RunAsync ( ImmediateDelay , ( ) =>
123
+ {
124
+ return base . ChangeHandlerAsync ( e ) ;
125
+ } ) ;
126
+ }
127
+
110
128
/// <summary>
111
129
/// Parses a string to create the <see cref="Microsoft.AspNetCore.Components.Forms.InputBase{TValue}.Value"/>.
112
130
/// </summary>
0 commit comments