Skip to content

Commit

Permalink
Merge pull request #27 from majorimi/dev/typeahead
Browse files Browse the repository at this point in the history
Demo app update
  • Loading branch information
majorimi authored Oct 27, 2020
2 parents 6fd5fe4 + a73841d commit 224f472
Show file tree
Hide file tree
Showing 16 changed files with 1,091 additions and 122 deletions.
14 changes: 8 additions & 6 deletions demo/Blazor.Components.DemoApp/Blazor.Components.DemoApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Majorsoft.Blazor.Components.CssEvents" Version="0.9.48-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Debounce.Input" Version="0.9.48-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Loading" Version="0.9.48-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Modal" Version="0.9.48-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Timer" Version="0.9.48-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.WebAssembly.Logging.Console" Version="0.9.48-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Common.JsInterop" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.CssEvents" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Loading" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Modal" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Timer" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.Components.Typeahead" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Majorsoft.Blazor.WebAssembly.Logging.Console" Version="0.9.50-rc.2.20479.15" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0-rc.2.20475.17" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0-rc.2.20475.17" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0-rc.2.20475.5" />
Expand Down
35 changes: 23 additions & 12 deletions demo/Blazor.Components.DemoApp/Components/CssEventsAnimation.razor
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div1Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log1" @bind="_div1Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand Down Expand Up @@ -114,7 +114,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div2Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log2" @bind="_div2Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand Down Expand Up @@ -143,7 +143,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div3Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log3" @bind="_div3Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand All @@ -168,7 +168,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div4Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log4" @bind="_div4Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand All @@ -193,7 +193,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div5Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log5" @bind="_div5Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand All @@ -218,7 +218,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div6Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log6" @bind="_div6Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand Down Expand Up @@ -251,15 +251,19 @@
}

private string _div1Log;
private void OnAnimationEvent1(AnimationEventArgs e)
private ElementReference _log1;
private async Task OnAnimationEvent1(AnimationEventArgs e)
{
_div1Log = WriteLog(_div1Log, e);
await _log1.ScrollToEndAsync();
}

private string _div2Log;
private void OnAnimationEvent2(AnimationEventArgs e)
private ElementReference _log2;
private async Task OnAnimationEvent2(AnimationEventArgs e)
{
_div2Log = WriteLog(_div2Log, e);
await _log2.ScrollToEndAsync();
}
private bool _animateDiv2 = false;
private async Task StartAnimation1()
Expand All @@ -268,9 +272,11 @@
}

private string _div3Log;
private void OnAnimationEvent3(AnimationEventArgs e)
private ElementReference _log3;
private async Task OnAnimationEvent3(AnimationEventArgs e)
{
_div3Log = WriteLog(_div3Log, e);
await _log3.ScrollToEndAsync();
}
private bool _animateDiv3 = false;
private async Task StartAnimation2()
Expand All @@ -280,6 +286,7 @@


private ElementReference _div4;
private ElementReference _log4;
private bool _eventsSubscribed1 = true;
private string _eventsText1 = "Unsubscribe events";
private async Task HandleEvent3()
Expand All @@ -306,10 +313,11 @@
private async Task OnAnimationEvent4(AnimationEventArgs e)
{
_div4Log = WriteLog(_div4Log, e);
await _log4.ScrollToEndAsync();
}


private ElementReference _div5;
private ElementReference _log5;
private bool _eventsSubscribed2 = true;
private string _eventsText2 = "Unsubscribe events";
private async Task HandleEvent4()
Expand Down Expand Up @@ -340,11 +348,12 @@
private async Task OnAnimationEvent5(AnimationEventArgs e)
{
_div5Log = WriteLog(_div5Log, e);
await _log5.ScrollToEndAsync();
}


private ElementReference _div6;
private ElementReference _label6;
private ElementReference _log6;
private bool _eventsSubscribed3 = true;
private string _eventsText3 = "Unsubscribe events";
private async Task HandleEvent5()
Expand Down Expand Up @@ -384,9 +393,11 @@
{
_div6Log = WriteLog(_div6Log, item, time);
}
StateHasChanged();

await _log6.ScrollToEndAsync();
}


private string WriteLog(string log, AnimationEventArgs e, TimeSpan? eventTime = null)
{
return log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div1Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log1" @bind="_div1Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand Down Expand Up @@ -93,7 +93,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div2Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log2" @bind="_div2Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand All @@ -118,7 +118,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div3Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log3" @bind="_div3Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand All @@ -143,7 +143,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div4Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log4" @bind="_div4Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand All @@ -168,7 +168,7 @@
<div class="row pb-2">
<div class="col-12">
<label><strong>Event log</strong>:</label>
<textarea @bind="_div5Log" class="form-control w-100" readonly></textarea>
<textarea @ref="_log5" @bind="_div5Log" class="form-control w-100" readonly></textarea>
</div>
</div>
</div>
Expand Down Expand Up @@ -260,35 +260,46 @@
}

private string _div1Log;
private void OnTransitionEnded1(TransitionEventArgs e)
private ElementReference _log1;
private async Task OnTransitionEnded1(TransitionEventArgs e)
{
_div1Log = WriteLog(_div1Log, e);
await _log1.ScrollToEndAsync();
}
private string _div2Log;
private void OnTransitionEnded2(TransitionEventArgs e)
private ElementReference _log2;
private async Task OnTransitionEnded2(TransitionEventArgs e)
{
_div2Log = WriteLog(_div2Log, e);
await _log2.ScrollToEndAsync();
}

private ElementReference _div3;
private string _div3Log;
private ElementReference _log3;
private async Task OnTransitionEnded3(TransitionEventArgs e)
{
_div3Log = WriteLog(_div3Log, e);
StateHasChanged();

await _log3.ScrollToEndAsync();
}

private ElementReference _div4;
private string _div4Log;
private ElementReference _log4;
private async Task OnTransitionEnded4(TransitionEventArgs e)
{
_div4Log = WriteLog(_div4Log, e);
StateHasChanged();

await _log4.ScrollToEndAsync();
}

private ElementReference _div5;
private ElementReference _label5;
private string _div5Log;
private ElementReference _log5;
private async Task OnTransitionEnded5(TransitionEventArgs[] args)
{
var time = DateTime.Now.TimeOfDay;
Expand All @@ -298,7 +309,9 @@
{
_div5Log = WriteLog(_div5Log, item, time);
}

StateHasChanged();
await _log5.ScrollToEndAsync();
}

private string WriteLog(string log, TransitionEventArgs e, TimeSpan? eventTime = null)
Expand Down
Loading

0 comments on commit 224f472

Please sign in to comment.