Merge branch 'release/FixDataPagerExport'
This commit is contained in:
@@ -18,15 +18,18 @@
|
||||
</defs>
|
||||
<rect width="100" height="100" rx="50" fill="url(#RadialGrad2)" fill-opacity="0.5">
|
||||
</rect>
|
||||
<text id="TitleElem" x="10%" y="50%" class="text-light" style="font-size:2rem;">Titolo</text>
|
||||
<text x="10%" y="70%" class="text-light" style="font-size:0.8rem;">testo più lungo
|
||||
<animate attributeName="x"
|
||||
values="100%;-100%"
|
||||
dur="5s"
|
||||
begin="2s"
|
||||
repeatCount="indefinite" />
|
||||
<text id="TitleElem" x="10%" y="50%" class="text-light" style="font-size:2rem;">Titolo</text>
|
||||
<g>
|
||||
<rect x="10%" y="10%" width="80%" height="80%" fill="white" fill-opacity="0.1" >
|
||||
</rect>
|
||||
<text x="10%" y="70%" class="text-light" style="font-size:0.8rem;">
|
||||
testo più lungo... 0123456789
|
||||
<animate attributeName="x"
|
||||
values="10%;10%;-10%;-80%;-100%;-100%;10%"
|
||||
dur="6s"
|
||||
begin="2s"
|
||||
repeatCount="indefinite" />
|
||||
</text>
|
||||
<g transform="translate(50%,50%)">
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
@@ -36,6 +36,17 @@
|
||||
{
|
||||
<span>@totalCount records</span>
|
||||
}
|
||||
@if (exportEnabled && totalCount > 0)
|
||||
{
|
||||
if (!fileExist)
|
||||
{
|
||||
<button class="btn btn-block btn-sm btn-primary" @onclick="() => requestSave()"><span class="oi oi-wrench"></span> Prepare Data</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a target="_blank" href="Download?fileName=@fileName" class="btn btn-block btn-sm btn-success"><span class="oi oi-cloud-download"></span> Download Data</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="p-1 flex-fill text-end small">
|
||||
@if (totalCount > 0)
|
||||
|
||||
@@ -1,95 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace EgwCoreLib.Razor
|
||||
{
|
||||
public partial class DataPager : ComponentBase
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected bool _showLoading = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int endPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public void resetCurrPage()
|
||||
{
|
||||
//await Task.Delay(1);
|
||||
currPage = 1;
|
||||
}
|
||||
private int LastPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1);
|
||||
}
|
||||
}
|
||||
|
||||
private int nextBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int numPages { get; set; } = 10;
|
||||
|
||||
private int prevBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage - numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
// calcola un set 1 .. numPages centrato sulla pagina corrente...
|
||||
private int startPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int _numPage { get; set; } = 1;
|
||||
|
||||
protected int _numRecord { get; set; } = 10;
|
||||
|
||||
protected int percLoading { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
@@ -110,6 +24,15 @@ public void resetCurrPage()
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public bool exportEnabled { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> exportRequested { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string fileName { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numPageChanged { get; set; }
|
||||
|
||||
@@ -161,19 +84,46 @@ public void resetCurrPage()
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
#region Public Methods
|
||||
|
||||
private void reportChange()
|
||||
public void resetCurrPage()
|
||||
{
|
||||
numRecordChanged.InvokeAsync(PageSize);
|
||||
//await Task.Delay(1);
|
||||
currPage = 1;
|
||||
}
|
||||
|
||||
private void reportChangePage()
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool _showLoading = false;
|
||||
|
||||
protected string exportDir = $"{Directory.GetCurrentDirectory()}\\temp";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int _numPage { get; set; } = 1;
|
||||
|
||||
protected int _numRecord { get; set; } = 10;
|
||||
|
||||
protected bool fileExist
|
||||
{
|
||||
numPageChanged.InvokeAsync(currPage);
|
||||
get
|
||||
{
|
||||
return File.Exists(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
protected string fullPath
|
||||
{
|
||||
get => $"{exportDir}\\{fileName}";
|
||||
}
|
||||
|
||||
protected int percLoading { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
@@ -198,5 +148,82 @@ public void resetCurrPage()
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int endPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int LastPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1);
|
||||
}
|
||||
}
|
||||
|
||||
private int nextBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int numPages { get; set; } = 10;
|
||||
|
||||
private int prevBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage - numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
// calcola un set 1 .. numPages centrato sulla pagina corrente...
|
||||
private int startPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
numRecordChanged.InvokeAsync(PageSize);
|
||||
}
|
||||
|
||||
private void reportChangePage()
|
||||
{
|
||||
numPageChanged.InvokeAsync(currPage);
|
||||
}
|
||||
|
||||
private async Task requestSave()
|
||||
{
|
||||
showLoading = true;
|
||||
await Task.Delay(1);
|
||||
await exportRequested.InvokeAsync(currPage);
|
||||
showLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user