mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 05:27:37 +08:00
bd34858efd
* feat: add locale * feat: add locale interfaces * fix: add locale interfaces for components * fix: use local classes instead of interfaces * feat: implement the locale provider * feat: make some components to support localization * fix: default language * fix: test * chore: remove the useless reference
61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class PaginationOptions : AntDomComponentBase
|
|
{
|
|
/// <summary>
|
|
/// 'default' | 'small' = 'default';
|
|
/// </summary>
|
|
[Parameter] public string Size { get; set; } = "default";
|
|
|
|
[Parameter] public bool Disabled { get; set; } = false;
|
|
|
|
[Parameter] public bool ShowSizeChanger { get; set; } = false;
|
|
|
|
[Parameter] public bool ShowQuickJumper { get; set; } = false;
|
|
|
|
[Parameter] public object Locale { get; set; }
|
|
|
|
[Parameter] public int Total { get; set; } = 0;
|
|
|
|
[Parameter] public int PageIndex { get; set; } = 1;
|
|
|
|
[Parameter] public int PageSize { get; set; } = 10;
|
|
|
|
[Parameter] public int[] PageSizeOptions { get; set; } = Array.Empty<int>();
|
|
|
|
[Parameter] public EventCallback<int> PageIndexChange { get; set; }
|
|
|
|
[Parameter] public EventCallback<int> PageSizeChange { get; set; }
|
|
|
|
[CascadingParameter] public Pagination Pagination { get; set; }
|
|
|
|
private string _inputValue;
|
|
|
|
private (int value, string label)[] _listOfPageSizeOption = Array.Empty<(int, string)>();
|
|
|
|
private void OnPageSizeChange(int size)
|
|
{
|
|
if (this.PageSize != size)
|
|
{
|
|
this.PageSizeChange.InvokeAsync(size);
|
|
}
|
|
}
|
|
|
|
private void JumpToPageViaInput(KeyboardEventArgs e)
|
|
{
|
|
if (e.Key == "Enter")
|
|
{
|
|
var index = int.TryParse(_inputValue, out var value) && value > 0 ? value : this.PageIndex;
|
|
PageIndexChange.InvokeAsync(index);
|
|
_inputValue = "";
|
|
}
|
|
}
|
|
}
|
|
}
|