mirror of
https://gitee.com/AntdUI/AntdUI.git
synced 2026-03-25 23:20:55 +08:00
👾 调整 Table 鼠标交互、修复 SelectMultiple 超出索引
This commit is contained in:
87
example/Demo/Controls/Table.Designer.cs
generated
87
example/Demo/Controls/Table.Designer.cs
generated
@@ -49,6 +49,9 @@ namespace Demo.Controls
|
||||
pagination1 = new AntdUI.Pagination();
|
||||
table1 = new AntdUI.Table();
|
||||
panel1 = new AntdUI.Panel();
|
||||
selectEditStyle = new AntdUI.Select();
|
||||
selectEditMode = new AntdUI.Select();
|
||||
checkFilter = new AntdUI.Checkbox();
|
||||
checkAddressLineBreak = new AntdUI.Checkbox();
|
||||
checkVisibleHeader = new AntdUI.Checkbox();
|
||||
checkEnableHeaderResizing = new AntdUI.Checkbox();
|
||||
@@ -96,8 +99,6 @@ namespace Demo.Controls
|
||||
table1.AutoSizeColumnsMode = AntdUI.ColumnsMode.Fill;
|
||||
table1.CellImpactHeight = false;
|
||||
table1.Dock = DockStyle.Fill;
|
||||
table1.EditMode = AntdUI.TEditMode.DoubleClick;
|
||||
table1.EditInputStyle = AntdUI.TEditInputStyle.Full;
|
||||
table1.GapCell = 6;
|
||||
table1.Location = new Point(4, 43);
|
||||
table1.Name = "table1";
|
||||
@@ -106,10 +107,14 @@ namespace Demo.Controls
|
||||
table1.TabIndex = 2;
|
||||
table1.CellClick += table1_CellClick;
|
||||
table1.CellButtonClick += table1_CellButtonClick;
|
||||
table1.CellBeginEdit += table1_CellBeginEdit;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Back = Color.Transparent;
|
||||
panel1.Controls.Add(selectEditStyle);
|
||||
panel1.Controls.Add(selectEditMode);
|
||||
panel1.Controls.Add(checkFilter);
|
||||
panel1.Controls.Add(checkAddressLineBreak);
|
||||
panel1.Controls.Add(checkVisibleHeader);
|
||||
panel1.Controls.Add(checkEnableHeaderResizing);
|
||||
@@ -127,14 +132,55 @@ namespace Demo.Controls
|
||||
panel1.Size = new Size(1292, 43);
|
||||
panel1.TabIndex = 1;
|
||||
//
|
||||
// selectEditStyle
|
||||
//
|
||||
selectEditStyle.AllowClear = true;
|
||||
selectEditStyle.Dock = DockStyle.Left;
|
||||
selectEditStyle.Enabled = false;
|
||||
selectEditStyle.List = true;
|
||||
selectEditStyle.ListAutoWidth = true;
|
||||
selectEditStyle.LocalizationPlaceholderText = "Table.{id}";
|
||||
selectEditStyle.Location = new Point(1098, 0);
|
||||
selectEditStyle.Name = "selectEditStyle";
|
||||
selectEditStyle.PlaceholderText = "编辑风格";
|
||||
selectEditStyle.Size = new Size(100, 43);
|
||||
selectEditStyle.TabIndex = 11;
|
||||
selectEditStyle.SelectedValueChanged += selectEditStyle_SelectedValueChanged;
|
||||
//
|
||||
// selectEditMode
|
||||
//
|
||||
selectEditMode.AllowClear = true;
|
||||
selectEditMode.Dock = DockStyle.Left;
|
||||
selectEditMode.List = true;
|
||||
selectEditMode.ListAutoWidth = true;
|
||||
selectEditMode.LocalizationPlaceholderText = "Table.{id}";
|
||||
selectEditMode.Location = new Point(988, 0);
|
||||
selectEditMode.Name = "selectEditMode";
|
||||
selectEditMode.PlaceholderText = "编辑模式";
|
||||
selectEditMode.Size = new Size(104, 43);
|
||||
selectEditMode.TabIndex = 10;
|
||||
selectEditMode.SelectedValueChanged += selectEditMode_SelectedValueChanged;
|
||||
//
|
||||
// checkFilter
|
||||
//
|
||||
checkFilter.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkFilter.Dock = DockStyle.Left;
|
||||
checkFilter.LocalizationText = "Table.{id}";
|
||||
checkFilter.Location = new Point(897, 0);
|
||||
checkFilter.Name = "checkFilter";
|
||||
checkFilter.Size = new Size(91, 43);
|
||||
checkFilter.TabIndex = 9;
|
||||
checkFilter.Text = "年龄筛选";
|
||||
checkFilter.CheckedChanged += checkFilter_CheckedChanged;
|
||||
//
|
||||
// checkAddressLineBreak
|
||||
//
|
||||
checkAddressLineBreak.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkAddressLineBreak.Dock = DockStyle.Left;
|
||||
checkAddressLineBreak.LocalizationText = "Table.{id}";
|
||||
checkAddressLineBreak.Location = new Point(875, 0);
|
||||
checkAddressLineBreak.Location = new Point(806, 0);
|
||||
checkAddressLineBreak.Name = "checkAddressLineBreak";
|
||||
checkAddressLineBreak.Size = new Size(99, 43);
|
||||
checkAddressLineBreak.Size = new Size(91, 43);
|
||||
checkAddressLineBreak.TabIndex = 8;
|
||||
checkAddressLineBreak.Text = "地址换行";
|
||||
checkAddressLineBreak.CheckedChanged += checkAddressLineBreak_CheckedChanged;
|
||||
@@ -145,9 +191,9 @@ namespace Demo.Controls
|
||||
checkVisibleHeader.Checked = true;
|
||||
checkVisibleHeader.Dock = DockStyle.Left;
|
||||
checkVisibleHeader.LocalizationText = "Table.{id}";
|
||||
checkVisibleHeader.Location = new Point(776, 0);
|
||||
checkVisibleHeader.Location = new Point(715, 0);
|
||||
checkVisibleHeader.Name = "checkVisibleHeader";
|
||||
checkVisibleHeader.Size = new Size(99, 43);
|
||||
checkVisibleHeader.Size = new Size(91, 43);
|
||||
checkVisibleHeader.TabIndex = 7;
|
||||
checkVisibleHeader.Text = "显示表头";
|
||||
checkVisibleHeader.CheckedChanged += checkVisibleHeader_CheckedChanged;
|
||||
@@ -157,9 +203,9 @@ namespace Demo.Controls
|
||||
checkEnableHeaderResizing.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkEnableHeaderResizing.Dock = DockStyle.Left;
|
||||
checkEnableHeaderResizing.LocalizationText = "Table.{id}";
|
||||
checkEnableHeaderResizing.Location = new Point(622, 0);
|
||||
checkEnableHeaderResizing.Location = new Point(571, 0);
|
||||
checkEnableHeaderResizing.Name = "checkEnableHeaderResizing";
|
||||
checkEnableHeaderResizing.Size = new Size(154, 43);
|
||||
checkEnableHeaderResizing.Size = new Size(144, 43);
|
||||
checkEnableHeaderResizing.TabIndex = 6;
|
||||
checkEnableHeaderResizing.Text = "手动调整列头宽度";
|
||||
checkEnableHeaderResizing.CheckedChanged += checkEnableHeaderResizing_CheckedChanged;
|
||||
@@ -169,9 +215,9 @@ namespace Demo.Controls
|
||||
checkSortOrder.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkSortOrder.Dock = DockStyle.Left;
|
||||
checkSortOrder.LocalizationText = "Table.{id}";
|
||||
checkSortOrder.Location = new Point(523, 0);
|
||||
checkSortOrder.Location = new Point(480, 0);
|
||||
checkSortOrder.Name = "checkSortOrder";
|
||||
checkSortOrder.Size = new Size(99, 43);
|
||||
checkSortOrder.Size = new Size(91, 43);
|
||||
checkSortOrder.TabIndex = 5;
|
||||
checkSortOrder.Text = "年龄排序";
|
||||
checkSortOrder.CheckedChanged += checkSortOrder_CheckedChanged;
|
||||
@@ -181,9 +227,9 @@ namespace Demo.Controls
|
||||
checkSetRowStyle.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkSetRowStyle.Dock = DockStyle.Left;
|
||||
checkSetRowStyle.LocalizationText = "Table.{id}";
|
||||
checkSetRowStyle.Location = new Point(438, 0);
|
||||
checkSetRowStyle.Location = new Point(403, 0);
|
||||
checkSetRowStyle.Name = "checkSetRowStyle";
|
||||
checkSetRowStyle.Size = new Size(85, 43);
|
||||
checkSetRowStyle.Size = new Size(77, 43);
|
||||
checkSetRowStyle.TabIndex = 4;
|
||||
checkSetRowStyle.Text = "奇偶列";
|
||||
checkSetRowStyle.CheckedChanged += checkSetRowStyle_CheckedChanged;
|
||||
@@ -193,9 +239,9 @@ namespace Demo.Controls
|
||||
checkBordered.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkBordered.Dock = DockStyle.Left;
|
||||
checkBordered.LocalizationText = "Table.{id}";
|
||||
checkBordered.Location = new Point(325, 0);
|
||||
checkBordered.Location = new Point(299, 0);
|
||||
checkBordered.Name = "checkBordered";
|
||||
checkBordered.Size = new Size(113, 43);
|
||||
checkBordered.Size = new Size(104, 43);
|
||||
checkBordered.TabIndex = 3;
|
||||
checkBordered.Text = "显示列边框";
|
||||
checkBordered.CheckedChanged += checkBordered_CheckedChanged;
|
||||
@@ -205,9 +251,9 @@ namespace Demo.Controls
|
||||
checkRowsDragSort.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkRowsDragSort.Dock = DockStyle.Left;
|
||||
checkRowsDragSort.LocalizationText = "Table.{id}";
|
||||
checkRowsDragSort.Location = new Point(212, 0);
|
||||
checkRowsDragSort.Location = new Point(195, 0);
|
||||
checkRowsDragSort.Name = "checkRowsDragSort";
|
||||
checkRowsDragSort.Size = new Size(113, 43);
|
||||
checkRowsDragSort.Size = new Size(104, 43);
|
||||
checkRowsDragSort.TabIndex = 2;
|
||||
checkRowsDragSort.Text = "行拖拽排序";
|
||||
checkRowsDragSort.CheckedChanged += checkRowsDragSort_CheckedChanged;
|
||||
@@ -217,9 +263,9 @@ namespace Demo.Controls
|
||||
checkColumnDragSort.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkColumnDragSort.Dock = DockStyle.Left;
|
||||
checkColumnDragSort.LocalizationText = "Table.{id}";
|
||||
checkColumnDragSort.Location = new Point(99, 0);
|
||||
checkColumnDragSort.Location = new Point(91, 0);
|
||||
checkColumnDragSort.Name = "checkColumnDragSort";
|
||||
checkColumnDragSort.Size = new Size(113, 43);
|
||||
checkColumnDragSort.Size = new Size(104, 43);
|
||||
checkColumnDragSort.TabIndex = 1;
|
||||
checkColumnDragSort.Text = "列拖拽排序";
|
||||
checkColumnDragSort.CheckedChanged += checkColumnDragSort_CheckedChanged;
|
||||
@@ -232,7 +278,7 @@ namespace Demo.Controls
|
||||
checkFixedHeader.LocalizationText = "Table.{id}";
|
||||
checkFixedHeader.Location = new Point(0, 0);
|
||||
checkFixedHeader.Name = "checkFixedHeader";
|
||||
checkFixedHeader.Size = new Size(99, 43);
|
||||
checkFixedHeader.Size = new Size(91, 43);
|
||||
checkFixedHeader.TabIndex = 0;
|
||||
checkFixedHeader.Text = "固定表头";
|
||||
checkFixedHeader.CheckedChanged += checkFixedHeader_CheckedChanged;
|
||||
@@ -280,5 +326,8 @@ namespace Demo.Controls
|
||||
private AntdUI.Checkbox checkVisibleHeader;
|
||||
private AntdUI.Panel panel_main;
|
||||
private AntdUI.Checkbox checkAddressLineBreak;
|
||||
private AntdUI.Checkbox checkFilter;
|
||||
private AntdUI.Select selectEditMode;
|
||||
private AntdUI.Select selectEditStyle;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace Demo.Controls
|
||||
|
||||
table1.Columns = new AntdUI.ColumnCollection {
|
||||
new AntdUI.ColumnCheck("check").SetFixed(),
|
||||
new AntdUI.Column("name", "<22><><EFBFBD><EFBFBD>"){ Filter=new AntdUI.FilterOption()}.SetFixed().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("name", "<22><><EFBFBD><EFBFBD>").SetFixed().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.ColumnCheck("checkTitle", "<22><>ȫѡ<C8AB><D1A1><EFBFBD><EFBFBD>").SetColAlign().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.ColumnRadio("radio", "<22><>ѡ").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("online", "״̬", AntdUI.ColumnAlign.Center).SetLocalizationTitleID("Table.Column."),
|
||||
@@ -47,18 +47,30 @@ namespace Demo.Controls
|
||||
return value;
|
||||
}
|
||||
},
|
||||
new AntdUI.Column("age", "<22><><EFBFBD><EFBFBD>", AntdUI.ColumnAlign.Center).SetLocalizationTitleID("Table.Column.").SetDefaultFilter(typeof(int)),
|
||||
new AntdUI.Column("date", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", AntdUI.ColumnAlign.Center).SetLocalizationTitleID("Table.Column.").SetDefaultFilter(typeof(DateTime)),
|
||||
new AntdUI.Column("age", "<22><><EFBFBD><EFBFBD>").SetAlign().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("address", "סַ").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("date", "<22><><EFBFBD><EFBFBD>").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("tag", "Tag"),
|
||||
new AntdUI.Column("imgs", "ͼƬ").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("address", "סַ"){ Width="full", Fixed=true}.SetLocalizationTitleID("Table.Column.").SetDefaultFilter(typeof(string)),
|
||||
new AntdUI.Column("btns", "<22><><EFBFBD><EFBFBD>").SetFixed().SetWidth("auto").SetFixed(true).SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("btns", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>").SetFixed().SetWidth("auto").SetLocalizationTitleID("Table.Column."),
|
||||
};
|
||||
|
||||
table1.DataSource = GetPageData(pagination1.Current, pagination1.PageSize);
|
||||
pagination1.PageSizeOptions = new int[] { 10, 20, 30, 50, 100 };
|
||||
|
||||
#endregion
|
||||
|
||||
Array editMode = Enum.GetValues(typeof(AntdUI.TEditMode));
|
||||
var editModes = new List<AntdUI.SelectItem>(editMode.Length);
|
||||
foreach (var it in editMode) editModes.Add(new AntdUI.SelectItem(it));
|
||||
editModes.RemoveAt(0);
|
||||
selectEditMode.Items.AddRange(editModes.ToArray());
|
||||
|
||||
Array editStyle = Enum.GetValues(typeof(AntdUI.TEditInputStyle));
|
||||
var editStyles = new List<AntdUI.SelectItem>(editStyle.Length);
|
||||
foreach (var it in editStyle) editStyles.Add(new AntdUI.SelectItem(it));
|
||||
editStyles.RemoveAt(0);
|
||||
selectEditStyle.Items.AddRange(editStyles.ToArray());
|
||||
}
|
||||
|
||||
#region ʾ<EFBFBD><EFBFBD>
|
||||
@@ -109,7 +121,16 @@ namespace Demo.Controls
|
||||
|
||||
void checkSortOrder_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
{
|
||||
if (table1.Columns != null) table1.Columns[6].SortOrder = table1.Columns[7].SortOrder = e.Value;
|
||||
foreach (var it in table1.Columns)
|
||||
{
|
||||
switch (it.Key)
|
||||
{
|
||||
case "age":
|
||||
case "address":
|
||||
it.SortOrder = e.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkEnableHeaderResizing_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
@@ -122,11 +143,75 @@ namespace Demo.Controls
|
||||
table1.VisibleHeader = e.Value;
|
||||
}
|
||||
|
||||
private void checkAddressLineBreak_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
void checkAddressLineBreak_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
{
|
||||
if (e.Value) table1.Columns[7].Width = "120";
|
||||
else table1.Columns[7].Width = null;
|
||||
table1.Columns[7].LineBreak = e.Value;
|
||||
foreach (var it in table1.Columns)
|
||||
{
|
||||
switch (it.Key)
|
||||
{
|
||||
case "address":
|
||||
if (e.Value) it.Width = "120";
|
||||
else it.Width = null;
|
||||
it.LineBreak = e.Value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkFilter_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
{
|
||||
if (e.Value)
|
||||
{
|
||||
foreach (var it in table1.Columns)
|
||||
{
|
||||
switch (it.Key)
|
||||
{
|
||||
case "name":
|
||||
it.Filter = new AntdUI.FilterOption();
|
||||
break;
|
||||
case "age":
|
||||
it.SetDefaultFilter(typeof(int));
|
||||
break;
|
||||
case "address":
|
||||
it.SetDefaultFilter(typeof(string));
|
||||
break;
|
||||
case "date":
|
||||
it.SetDefaultFilter(typeof(DateTime));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var it in table1.Columns) it.Filter = null;
|
||||
}
|
||||
}
|
||||
|
||||
void selectEditMode_SelectedValueChanged(object sender, AntdUI.ObjectNEventArgs e)
|
||||
{
|
||||
if (e.Value is AntdUI.TEditMode v)
|
||||
{
|
||||
table1.EditMode = v;
|
||||
selectEditStyle.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
table1.EditMode = AntdUI.TEditMode.None;
|
||||
selectEditStyle.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void selectEditStyle_SelectedValueChanged(object sender, AntdUI.ObjectNEventArgs e)
|
||||
{
|
||||
if (e.Value is AntdUI.TEditInputStyle v) table1.EditInputStyle = v;
|
||||
else table1.EditInputStyle = AntdUI.TEditInputStyle.Default;
|
||||
}
|
||||
|
||||
bool table1_CellBeginEdit(object sender, AntdUI.TableEventArgs e)
|
||||
{
|
||||
if (e.Column == null) return true;
|
||||
if (e.Column.Key == "tag" || e.Column.Key == "btns" || e.Column.Key == "imgs") return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -135,10 +220,11 @@ namespace Demo.Controls
|
||||
|
||||
void table1_CellClick(object sender, AntdUI.TableClickEventArgs e)
|
||||
{
|
||||
if (e.Record is TestClass data)
|
||||
if (e.Column == null) return;
|
||||
if (e.RowIndex > 0 && e.Record is TestClass data)
|
||||
{
|
||||
if (e.RowIndex > 0 && e.ColumnIndex == 11) AntdUI.Popover.open(new AntdUI.Popover.Config(table1, "<22><>ʾһ<CABE><D2BB><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>") { Offset = e.Rect });
|
||||
else if (e.RowIndex > 0 && e.ColumnIndex == 9)
|
||||
if (e.Column.Key == "online") AntdUI.Popover.open(new AntdUI.Popover.Config(table1, "<22><>ʾһ<CABE><D2BB><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>") { Offset = e.Rect });
|
||||
else if (e.Column.Key == "tag")
|
||||
{
|
||||
if (data.tag == null) data.tag = new AntdUI.CellTag[] { new AntdUI.CellTag("NICE", AntdUI.TTypeMini.Success), new AntdUI.CellTag("DEVELOPER", AntdUI.TTypeMini.Info) };
|
||||
else
|
||||
@@ -205,15 +291,15 @@ namespace Demo.Controls
|
||||
DateTime birthday_TigerHu = new DateTime(1983, 7, 4);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>https://baike.baidu.com/link?url=7UWQOAPtuaXDjkFQZ92-cNlijS9voNgkQEJSmPLDV73RX1RLogXTLRQdBIQ6KMO7s1nIEZDKjvCJXa_e9fOrrhA9HxRDvRbkgGvPdWYMmP7
|
||||
DateTime birthday_DanielWu = new DateTime(1974, 9, 30);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>https://baike.baidu.com/link?url=zk3KO7qvnfny-fZ2QfgQ2-lZleCeNUaCfketfcE6Ur5p_LowHOhlttu0c4tEXDKN673QcgpSRRRUmymic58Rf5NiUpsMJrctl1SXaR2RXuu
|
||||
|
||||
list.Add(new TestClass(start, 0, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", (int)Math.Round((now - birthday_TigerHu).TotalDays / 365)));
|
||||
list.Add(new TestClass(start + 1, 1, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", (int)Math.Round((now - birthday_DanielWu).TotalDays / 365))
|
||||
list.Add(new TestClass(start, 0, AntdUI.Localization.Get("Table.Data.Name1", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), (int)Math.Round((now - birthday_TigerHu).TotalDays / 365)));
|
||||
list.Add(new TestClass(start + 1, 1, AntdUI.Localization.Get("Table.Data.Name2", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), (int)Math.Round((now - birthday_DanielWu).TotalDays / 365))
|
||||
{
|
||||
tag = new AntdUI.CellTag[] { new AntdUI.CellTag("NICE", AntdUI.TTypeMini.Success), new AntdUI.CellTag("DEVELOPER", AntdUI.TTypeMini.Info) }
|
||||
});
|
||||
for (int i = 2; i < pageSize; i++)
|
||||
{
|
||||
int index = start + i;
|
||||
list.Add(new TestClass(index, i, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 20 + index));
|
||||
list.Add(new TestClass(index, i, AntdUI.Localization.Get("Table.Data.Name3", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), 20 + index));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -240,15 +326,20 @@ namespace Demo.Controls
|
||||
public TestClass(int index, int start, string name, int age)
|
||||
{
|
||||
id = (index + 1);
|
||||
if (start == 1) _online = new AntdUI.CellBadge(AntdUI.TState.Success, "<22><><EFBFBD><EFBFBD>");
|
||||
else if (start == 2) _online = new AntdUI.CellBadge(AntdUI.TState.Processing, "<22><><EFBFBD><EFBFBD>");
|
||||
else if (start == 3) _online = new AntdUI.CellBadge(AntdUI.TState.Error, "<22><><EFBFBD><EFBFBD>");
|
||||
else if (start == 4) _online = new AntdUI.CellBadge(AntdUI.TState.Warn, "<22><><EFBFBD><EFBFBD>");
|
||||
else _online = new AntdUI.CellBadge(AntdUI.TState.Default, "<22><><EFBFBD><EFBFBD>");
|
||||
if (start == 1) _online = new AntdUI.CellBadge(AntdUI.TState.Success, AntdUI.Localization.Get("Table.Data.Online", "<22><><EFBFBD><EFBFBD>"));
|
||||
else if (start == 2) _online = new AntdUI.CellBadge(AntdUI.TState.Processing, AntdUI.Localization.Get("Table.Data.Online.Processing", "<22><><EFBFBD><EFBFBD>"));
|
||||
else if (start == 3) _online = new AntdUI.CellBadge(AntdUI.TState.Error, AntdUI.Localization.Get("Table.Data.Online.Error", "<22><><EFBFBD><EFBFBD>"));
|
||||
else if (start == 4) _online = new AntdUI.CellBadge(AntdUI.TState.Warn, AntdUI.Localization.Get("Table.Data.Online.Warn", "<22><><EFBFBD><EFBFBD>"));
|
||||
else _online = new AntdUI.CellBadge(AntdUI.TState.Default, AntdUI.Localization.Get("Table.Data.Online.Default", "<22><><EFBFBD><EFBFBD>"));
|
||||
_name = name;
|
||||
_age = age;
|
||||
_date = DateTime.Now.Date.AddYears(-age);
|
||||
_address = (new System.Random().Next(DateTime.Now.Second) > 5 ? "<22><><EFBFBD><EFBFBD>" : "<22><><EFBFBD><EFBFBD>") + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + id + "<22><>";
|
||||
|
||||
_address = AntdUI.Localization.GetLangI("Table.Data.Address" + id, null);
|
||||
if (_address == null) _address = AntdUI.Localization.GetLangI("Table.Data.AddressNum", null);
|
||||
if (_address == null) _address = (new Random().Next(DateTime.Now.Second) > 5 ? "<22><><EFBFBD><EFBFBD>" : "<22><><EFBFBD><EFBFBD>") + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + id + "<22><>";
|
||||
else _address += id;
|
||||
|
||||
_enable = start % 2 == 0;
|
||||
if (start == 1)
|
||||
{
|
||||
@@ -258,38 +349,48 @@ namespace Demo.Controls
|
||||
};
|
||||
}
|
||||
|
||||
if (start == 2)
|
||||
if (start == 1)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("b1") {
|
||||
BorderWidth = 1,
|
||||
IconSvg = "SearchOutlined",
|
||||
IconHoverSvg = Properties.Resources.icon_like,
|
||||
ShowArrow = true
|
||||
},
|
||||
new AntdUI.CellButton("b2") { ShowArrow = true },
|
||||
new AntdUI.CellButton("b3") { Type = AntdUI.TTypeMini.Primary, IconSvg = "SearchOutlined" }
|
||||
new AntdUI.CellButton("id", null, AntdUI.TTypeMini.Primary).SetIcon("SearchOutlined").SetIconHover(Properties.Resources.icon_like),
|
||||
new AntdUI.CellButton("id", null, AntdUI.TTypeMini.Warn).SetIcon("ArrowDownOutlined"),
|
||||
new AntdUI.CellButton("id", null, AntdUI.TTypeMini.Error).SetArrow()
|
||||
};
|
||||
}
|
||||
else if (start == 2)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("id").SetBorder().SetIcon("SearchOutlined").SetIconHover(Properties.Resources.icon_like),
|
||||
new AntdUI.CellButton("id").SetBorder().SetIcon("ArrowDownOutlined"),
|
||||
new AntdUI.CellButton("id").SetBorder().SetArrow()
|
||||
};
|
||||
}
|
||||
else if (start == 3)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("b1", "Border") { BorderWidth = 1 },
|
||||
new AntdUI.CellButton("b2", "GhostBorder") { Ghost = true, BorderWidth = 1, ShowArrow = true, IsLink = true }
|
||||
new AntdUI.CellButton("id").SetBorder().SetGhost().SetIcon("SearchOutlined").SetIconHover(Properties.Resources.icon_like),
|
||||
new AntdUI.CellButton("id").SetBorder().SetGhost().SetIcon("ArrowDownOutlined"),
|
||||
new AntdUI.CellButton("id").SetBorder().SetGhost().SetArrow()
|
||||
};
|
||||
}
|
||||
else if (start == 4)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("edit", "Edit", AntdUI.TTypeMini.Primary) { Ghost = true, BorderWidth = 1 },
|
||||
new AntdUI.CellButton("delete", "Delete", AntdUI.TTypeMini.Error) { Ghost = true, BorderWidth = 1 }
|
||||
new AntdUI.CellButton("edit", "Edit", AntdUI.TTypeMini.Primary),
|
||||
new AntdUI.CellButton("delete", "Delete", AntdUI.TTypeMini.Error)
|
||||
};
|
||||
}
|
||||
else if (start == 5)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("edit","Edit",AntdUI.TTypeMini.Primary),
|
||||
new AntdUI.CellButton("delete","Delete",AntdUI.TTypeMini.Error)
|
||||
new AntdUI.CellButton("edit", "Edit", AntdUI.TTypeMini.Primary).SetBorder().SetGhost(),
|
||||
new AntdUI.CellButton("delete", "Delete", AntdUI.TTypeMini.Error).SetBorder().SetGhost()
|
||||
};
|
||||
}
|
||||
else if (start == 6)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("delete", "Download", AntdUI.TTypeMini.Success).SetIcon("DownloadOutlined")
|
||||
};
|
||||
}
|
||||
else _btns = new AntdUI.CellLink[] { new AntdUI.CellLink("delete", "Delete") };
|
||||
|
||||
121
example/Demo/Controls/TableAOT.Designer.cs
generated
121
example/Demo/Controls/TableAOT.Designer.cs
generated
@@ -49,10 +49,11 @@ namespace Demo.Controls
|
||||
pagination1 = new AntdUI.Pagination();
|
||||
table1 = new AntdUI.Table();
|
||||
panel1 = new AntdUI.Panel();
|
||||
selectEditStyle = new AntdUI.Select();
|
||||
selectEditMode = new AntdUI.Select();
|
||||
checkFilter = new AntdUI.Checkbox();
|
||||
checkAddressLineBreak = new AntdUI.Checkbox();
|
||||
checkVisibleHeader = new AntdUI.Checkbox();
|
||||
checkDoubleEdit = new AntdUI.Checkbox();
|
||||
checkEditFullMode = new AntdUI.Checkbox();
|
||||
checkEnableHeaderResizing = new AntdUI.Checkbox();
|
||||
checkSortOrder = new AntdUI.Checkbox();
|
||||
checkSetRowStyle = new AntdUI.Checkbox();
|
||||
@@ -106,12 +107,14 @@ namespace Demo.Controls
|
||||
table1.TabIndex = 2;
|
||||
table1.CellClick += table1_CellClick;
|
||||
table1.CellButtonClick += table1_CellButtonClick;
|
||||
table1.CellBeginEdit += table1_CellBeginEdit;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Back = Color.Transparent;
|
||||
panel1.Controls.Add(checkEditFullMode);
|
||||
panel1.Controls.Add(checkDoubleEdit);
|
||||
panel1.Back = Color.Transparent;
|
||||
panel1.Controls.Add(selectEditStyle);
|
||||
panel1.Controls.Add(selectEditMode);
|
||||
panel1.Controls.Add(checkFilter);
|
||||
panel1.Controls.Add(checkAddressLineBreak);
|
||||
panel1.Controls.Add(checkVisibleHeader);
|
||||
panel1.Controls.Add(checkEnableHeaderResizing);
|
||||
@@ -129,16 +132,57 @@ namespace Demo.Controls
|
||||
panel1.Size = new Size(1292, 43);
|
||||
panel1.TabIndex = 1;
|
||||
//
|
||||
// selectEditStyle
|
||||
//
|
||||
selectEditStyle.AllowClear = true;
|
||||
selectEditStyle.Dock = DockStyle.Left;
|
||||
selectEditStyle.Enabled = false;
|
||||
selectEditStyle.List = true;
|
||||
selectEditStyle.ListAutoWidth = true;
|
||||
selectEditStyle.LocalizationPlaceholderText = "Table.{id}";
|
||||
selectEditStyle.Location = new Point(1098, 0);
|
||||
selectEditStyle.Name = "selectEditStyle";
|
||||
selectEditStyle.PlaceholderText = "编辑风格";
|
||||
selectEditStyle.Size = new Size(100, 43);
|
||||
selectEditStyle.TabIndex = 11;
|
||||
selectEditStyle.SelectedValueChanged += selectEditStyle_SelectedValueChanged;
|
||||
//
|
||||
// selectEditMode
|
||||
//
|
||||
selectEditMode.AllowClear = true;
|
||||
selectEditMode.Dock = DockStyle.Left;
|
||||
selectEditMode.List = true;
|
||||
selectEditMode.ListAutoWidth = true;
|
||||
selectEditMode.LocalizationPlaceholderText = "Table.{id}";
|
||||
selectEditMode.Location = new Point(988, 0);
|
||||
selectEditMode.Name = "selectEditMode";
|
||||
selectEditMode.PlaceholderText = "编辑模式";
|
||||
selectEditMode.Size = new Size(104, 43);
|
||||
selectEditMode.TabIndex = 10;
|
||||
selectEditMode.SelectedValueChanged += selectEditMode_SelectedValueChanged;
|
||||
//
|
||||
// checkFilter
|
||||
//
|
||||
checkFilter.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkFilter.Dock = DockStyle.Left;
|
||||
checkFilter.LocalizationText = "Table.{id}";
|
||||
checkFilter.Location = new Point(897, 0);
|
||||
checkFilter.Name = "checkFilter";
|
||||
checkFilter.Size = new Size(91, 43);
|
||||
checkFilter.TabIndex = 9;
|
||||
checkFilter.Text = "年龄筛选";
|
||||
checkFilter.CheckedChanged += checkFilter_CheckedChanged;
|
||||
//
|
||||
// checkAddressLineBreak
|
||||
//
|
||||
checkAddressLineBreak.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkAddressLineBreak.Dock = DockStyle.Left;
|
||||
checkAddressLineBreak.LocalizationText = "Table.{id}";
|
||||
checkAddressLineBreak.Location = new Point(875, 0);
|
||||
checkAddressLineBreak.Location = new Point(806, 0);
|
||||
checkAddressLineBreak.Name = "checkAddressLineBreak";
|
||||
checkAddressLineBreak.Size = new Size(99, 43);
|
||||
checkAddressLineBreak.Size = new Size(91, 43);
|
||||
checkAddressLineBreak.TabIndex = 8;
|
||||
checkAddressLineBreak.Text = "地址换行/只读";
|
||||
checkAddressLineBreak.Text = "地址换行";
|
||||
checkAddressLineBreak.CheckedChanged += checkAddressLineBreak_CheckedChanged;
|
||||
//
|
||||
// checkVisibleHeader
|
||||
@@ -147,47 +191,21 @@ namespace Demo.Controls
|
||||
checkVisibleHeader.Checked = true;
|
||||
checkVisibleHeader.Dock = DockStyle.Left;
|
||||
checkVisibleHeader.LocalizationText = "Table.{id}";
|
||||
checkVisibleHeader.Location = new Point(806, 0);
|
||||
checkVisibleHeader.Location = new Point(715, 0);
|
||||
checkVisibleHeader.Name = "checkVisibleHeader";
|
||||
checkVisibleHeader.Size = new Size(99, 43);
|
||||
checkVisibleHeader.Size = new Size(91, 43);
|
||||
checkVisibleHeader.TabIndex = 7;
|
||||
checkVisibleHeader.Text = "显示表头";
|
||||
checkVisibleHeader.CheckedChanged += checkVisibleHeader_CheckedChanged;
|
||||
//
|
||||
// checkDoubleEdit
|
||||
//
|
||||
checkDoubleEdit.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkDoubleEdit.Checked = false;
|
||||
checkDoubleEdit.Dock = DockStyle.Left;
|
||||
checkDoubleEdit.LocalizationText = "Table.{id}";
|
||||
checkDoubleEdit.Location = new Point(885+12, 0);
|
||||
checkDoubleEdit.Name = "checkDoubleEdit";
|
||||
checkDoubleEdit.Size = new Size(120, 43);
|
||||
checkDoubleEdit.TabIndex = 9;
|
||||
checkDoubleEdit.Text = "启用编辑 (双击)";
|
||||
checkDoubleEdit.CheckedChanged += checkDoubleEdit_CheckedChanged;
|
||||
//
|
||||
// checkEditFullMode
|
||||
//
|
||||
checkEditFullMode.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkEditFullMode.Checked = false;
|
||||
checkEditFullMode.Dock = DockStyle.Left;
|
||||
checkEditFullMode.LocalizationText = "Table.{id}";
|
||||
checkEditFullMode.Location = new Point(885+120+12, 0);
|
||||
checkEditFullMode.Name = "checkEditFullMode";
|
||||
checkEditFullMode.Size = new Size(99, 43);
|
||||
checkEditFullMode.TabIndex = 10;
|
||||
checkEditFullMode.Text = "切换编辑风格";
|
||||
checkEditFullMode.CheckedChanged += checkEditFullMode_CheckedChanged;
|
||||
//
|
||||
// checkEnableHeaderResizing
|
||||
//
|
||||
checkEnableHeaderResizing.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkEnableHeaderResizing.Dock = DockStyle.Left;
|
||||
checkEnableHeaderResizing.LocalizationText = "Table.{id}";
|
||||
checkEnableHeaderResizing.Location = new Point(622, 0);
|
||||
checkEnableHeaderResizing.Location = new Point(571, 0);
|
||||
checkEnableHeaderResizing.Name = "checkEnableHeaderResizing";
|
||||
checkEnableHeaderResizing.Size = new Size(154, 43);
|
||||
checkEnableHeaderResizing.Size = new Size(144, 43);
|
||||
checkEnableHeaderResizing.TabIndex = 6;
|
||||
checkEnableHeaderResizing.Text = "手动调整列头宽度";
|
||||
checkEnableHeaderResizing.CheckedChanged += checkEnableHeaderResizing_CheckedChanged;
|
||||
@@ -197,9 +215,9 @@ namespace Demo.Controls
|
||||
checkSortOrder.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkSortOrder.Dock = DockStyle.Left;
|
||||
checkSortOrder.LocalizationText = "Table.{id}";
|
||||
checkSortOrder.Location = new Point(523, 0);
|
||||
checkSortOrder.Location = new Point(480, 0);
|
||||
checkSortOrder.Name = "checkSortOrder";
|
||||
checkSortOrder.Size = new Size(99, 43);
|
||||
checkSortOrder.Size = new Size(91, 43);
|
||||
checkSortOrder.TabIndex = 5;
|
||||
checkSortOrder.Text = "年龄排序";
|
||||
checkSortOrder.CheckedChanged += checkSortOrder_CheckedChanged;
|
||||
@@ -209,9 +227,9 @@ namespace Demo.Controls
|
||||
checkSetRowStyle.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkSetRowStyle.Dock = DockStyle.Left;
|
||||
checkSetRowStyle.LocalizationText = "Table.{id}";
|
||||
checkSetRowStyle.Location = new Point(438, 0);
|
||||
checkSetRowStyle.Location = new Point(403, 0);
|
||||
checkSetRowStyle.Name = "checkSetRowStyle";
|
||||
checkSetRowStyle.Size = new Size(85, 43);
|
||||
checkSetRowStyle.Size = new Size(77, 43);
|
||||
checkSetRowStyle.TabIndex = 4;
|
||||
checkSetRowStyle.Text = "奇偶列";
|
||||
checkSetRowStyle.CheckedChanged += checkSetRowStyle_CheckedChanged;
|
||||
@@ -221,9 +239,9 @@ namespace Demo.Controls
|
||||
checkBordered.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkBordered.Dock = DockStyle.Left;
|
||||
checkBordered.LocalizationText = "Table.{id}";
|
||||
checkBordered.Location = new Point(325, 0);
|
||||
checkBordered.Location = new Point(299, 0);
|
||||
checkBordered.Name = "checkBordered";
|
||||
checkBordered.Size = new Size(113, 43);
|
||||
checkBordered.Size = new Size(104, 43);
|
||||
checkBordered.TabIndex = 3;
|
||||
checkBordered.Text = "显示列边框";
|
||||
checkBordered.CheckedChanged += checkBordered_CheckedChanged;
|
||||
@@ -233,9 +251,9 @@ namespace Demo.Controls
|
||||
checkRowsDragSort.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkRowsDragSort.Dock = DockStyle.Left;
|
||||
checkRowsDragSort.LocalizationText = "Table.{id}";
|
||||
checkRowsDragSort.Location = new Point(212, 0);
|
||||
checkRowsDragSort.Location = new Point(195, 0);
|
||||
checkRowsDragSort.Name = "checkRowsDragSort";
|
||||
checkRowsDragSort.Size = new Size(113, 43);
|
||||
checkRowsDragSort.Size = new Size(104, 43);
|
||||
checkRowsDragSort.TabIndex = 2;
|
||||
checkRowsDragSort.Text = "行拖拽排序";
|
||||
checkRowsDragSort.CheckedChanged += checkRowsDragSort_CheckedChanged;
|
||||
@@ -245,9 +263,9 @@ namespace Demo.Controls
|
||||
checkColumnDragSort.AutoSizeMode = AntdUI.TAutoSize.Width;
|
||||
checkColumnDragSort.Dock = DockStyle.Left;
|
||||
checkColumnDragSort.LocalizationText = "Table.{id}";
|
||||
checkColumnDragSort.Location = new Point(99, 0);
|
||||
checkColumnDragSort.Location = new Point(91, 0);
|
||||
checkColumnDragSort.Name = "checkColumnDragSort";
|
||||
checkColumnDragSort.Size = new Size(113, 43);
|
||||
checkColumnDragSort.Size = new Size(104, 43);
|
||||
checkColumnDragSort.TabIndex = 1;
|
||||
checkColumnDragSort.Text = "列拖拽排序";
|
||||
checkColumnDragSort.CheckedChanged += checkColumnDragSort_CheckedChanged;
|
||||
@@ -260,7 +278,7 @@ namespace Demo.Controls
|
||||
checkFixedHeader.LocalizationText = "Table.{id}";
|
||||
checkFixedHeader.Location = new Point(0, 0);
|
||||
checkFixedHeader.Name = "checkFixedHeader";
|
||||
checkFixedHeader.Size = new Size(99, 43);
|
||||
checkFixedHeader.Size = new Size(91, 43);
|
||||
checkFixedHeader.TabIndex = 0;
|
||||
checkFixedHeader.Text = "固定表头";
|
||||
checkFixedHeader.CheckedChanged += checkFixedHeader_CheckedChanged;
|
||||
@@ -306,9 +324,10 @@ namespace Demo.Controls
|
||||
private AntdUI.Checkbox checkBordered;
|
||||
private AntdUI.Checkbox checkSortOrder;
|
||||
private AntdUI.Checkbox checkVisibleHeader;
|
||||
private AntdUI.Checkbox checkDoubleEdit;
|
||||
private AntdUI.Checkbox checkEditFullMode;
|
||||
private AntdUI.Panel panel_main;
|
||||
private AntdUI.Checkbox checkAddressLineBreak;
|
||||
private AntdUI.Checkbox checkFilter;
|
||||
private AntdUI.Select selectEditMode;
|
||||
private AntdUI.Select selectEditStyle;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace Demo.Controls
|
||||
|
||||
table1.Columns = new AntdUI.ColumnCollection {
|
||||
new AntdUI.ColumnCheck("check").SetFixed(),
|
||||
new AntdUI.Column("name", "<22><><EFBFBD><EFBFBD>"){ Filter=new AntdUI.FilterOption()}.SetFixed().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("name", "<22><><EFBFBD><EFBFBD>").SetFixed().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.ColumnCheck("checkTitle", "<22><>ȫѡ<C8AB><D1A1><EFBFBD><EFBFBD>").SetColAlign().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.ColumnRadio("radio", "<22><>ѡ").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("online", "״̬", AntdUI.ColumnAlign.Center).SetLocalizationTitleID("Table.Column."),
|
||||
@@ -47,9 +47,9 @@ namespace Demo.Controls
|
||||
return value;
|
||||
}
|
||||
},
|
||||
new AntdUI.Column("age", "<22><><EFBFBD><EFBFBD>", AntdUI.ColumnAlign.Center).SetLocalizationTitleID("Table.Column.").SetDefaultFilter(typeof(int)),
|
||||
new AntdUI.Column("date", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", AntdUI.ColumnAlign.Center).SetLocalizationTitleID("Table.Column.").SetDefaultFilter(typeof(DateTime)),
|
||||
new AntdUI.Column("address", "סַ").SetLocalizationTitleID("Table.Column.").SetDefaultFilter(typeof(string)),
|
||||
new AntdUI.Column("age", "<22><><EFBFBD><EFBFBD>").SetAlign().SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("address", "סַ").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("date", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("tag", "Tag"),
|
||||
new AntdUI.Column("imgs", "ͼƬ").SetLocalizationTitleID("Table.Column."),
|
||||
new AntdUI.Column("btns", "<22><><EFBFBD><EFBFBD>").SetFixed().SetWidth("auto").SetLocalizationTitleID("Table.Column."),
|
||||
@@ -59,6 +59,18 @@ namespace Demo.Controls
|
||||
pagination1.PageSizeOptions = new int[] { 10, 20, 30, 50, 100 };
|
||||
|
||||
#endregion
|
||||
|
||||
Array editMode = Enum.GetValues(typeof(AntdUI.TEditMode));
|
||||
var editModes = new List<AntdUI.SelectItem>(editMode.Length);
|
||||
foreach (var it in editMode) editModes.Add(new AntdUI.SelectItem(it));
|
||||
editModes.RemoveAt(0);
|
||||
selectEditMode.Items.AddRange(editModes.ToArray());
|
||||
|
||||
Array editStyle = Enum.GetValues(typeof(AntdUI.TEditInputStyle));
|
||||
var editStyles = new List<AntdUI.SelectItem>(editStyle.Length);
|
||||
foreach (var it in editStyle) editStyles.Add(new AntdUI.SelectItem(it));
|
||||
editStyles.RemoveAt(0);
|
||||
selectEditStyle.Items.AddRange(editStyles.ToArray());
|
||||
}
|
||||
|
||||
#region ʾ<EFBFBD><EFBFBD>
|
||||
@@ -109,7 +121,16 @@ namespace Demo.Controls
|
||||
|
||||
void checkSortOrder_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
{
|
||||
if (table1.Columns != null) table1.Columns[6].SortOrder = table1.Columns[7].SortOrder = e.Value;
|
||||
foreach (var it in table1.Columns)
|
||||
{
|
||||
switch (it.Key)
|
||||
{
|
||||
case "age":
|
||||
case "address":
|
||||
it.SortOrder = e.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkEnableHeaderResizing_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
@@ -122,33 +143,90 @@ namespace Demo.Controls
|
||||
table1.VisibleHeader = e.Value;
|
||||
}
|
||||
|
||||
private void checkAddressLineBreak_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
void checkAddressLineBreak_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
{
|
||||
if (e.Value) table1.Columns[7].Width = "120";
|
||||
else table1.Columns[7].Width = null;
|
||||
table1.Columns[7].LineBreak = e.Value;
|
||||
table1.Columns[7].ReadOnly = e.Value;
|
||||
foreach (var it in table1.Columns)
|
||||
{
|
||||
switch (it.Key)
|
||||
{
|
||||
case "address":
|
||||
if (e.Value) it.Width = "120";
|
||||
else it.Width = null;
|
||||
it.LineBreak = e.Value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkEditFullMode_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
|
||||
void checkFilter_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
{
|
||||
table1.EditInputStyle = e.Value ? AntdUI.TEditInputStyle.Excel : AntdUI.TEditInputStyle.Full;
|
||||
if (e.Value)
|
||||
{
|
||||
foreach (var it in table1.Columns)
|
||||
{
|
||||
switch (it.Key)
|
||||
{
|
||||
case "name":
|
||||
it.Filter = new AntdUI.FilterOption();
|
||||
break;
|
||||
case "age":
|
||||
it.SetDefaultFilter(typeof(int));
|
||||
break;
|
||||
case "address":
|
||||
it.SetDefaultFilter(typeof(string));
|
||||
break;
|
||||
case "date":
|
||||
it.SetDefaultFilter(typeof(DateTime));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var it in table1.Columns) it.Filter = null;
|
||||
}
|
||||
}
|
||||
private void checkDoubleEdit_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
|
||||
|
||||
void selectEditMode_SelectedValueChanged(object sender, AntdUI.ObjectNEventArgs e)
|
||||
{
|
||||
table1.EditMode = e.Value ? AntdUI.TEditMode.DoubleClick : AntdUI.TEditMode.None;
|
||||
if (e.Value is AntdUI.TEditMode v)
|
||||
{
|
||||
table1.EditMode = v;
|
||||
selectEditStyle.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
table1.EditMode = AntdUI.TEditMode.None;
|
||||
selectEditStyle.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void selectEditStyle_SelectedValueChanged(object sender, AntdUI.ObjectNEventArgs e)
|
||||
{
|
||||
if (e.Value is AntdUI.TEditInputStyle v) table1.EditInputStyle = v;
|
||||
else table1.EditInputStyle = AntdUI.TEditInputStyle.Default;
|
||||
}
|
||||
|
||||
bool table1_CellBeginEdit(object sender, AntdUI.TableEventArgs e)
|
||||
{
|
||||
if (e.Column == null) return true;
|
||||
if (e.Column.Key == "tag" || e.Column.Key == "btns" || e.Column.Key == "imgs") return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>/˫<EFBFBD><EFBFBD>
|
||||
|
||||
void table1_CellClick(object sender, AntdUI.TableClickEventArgs e)
|
||||
{
|
||||
if (e.Record is IList<AntdUI.AntItem> data)
|
||||
if (e.Column == null) return;
|
||||
if (e.RowIndex > 0 && e.Record is IList<AntdUI.AntItem> data)
|
||||
{
|
||||
if (e.RowIndex > 0 && e.ColumnIndex == 6) AntdUI.Popover.open(new AntdUI.Popover.Config(table1, "<22><>ʾһ<CABE><D2BB><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>") { Offset = e.Rect });
|
||||
else if (e.RowIndex > 0 && e.ColumnIndex == 8)
|
||||
if (e.Column.Key == "online") AntdUI.Popover.open(new AntdUI.Popover.Config(table1, "<22><>ʾһ<CABE><D2BB><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>") { Offset = e.Rect });
|
||||
else if (e.Column.Key == "tag")
|
||||
{
|
||||
var tag = data[8];
|
||||
var tag = data[e.ColumnIndex + (checkRowsDragSort.Checked ? 0 : 1)];
|
||||
if (tag.value is AntdUI.CellTag[] tags)
|
||||
{
|
||||
if (tags.Length == 1)
|
||||
@@ -173,7 +251,7 @@ namespace Demo.Controls
|
||||
{
|
||||
if (AntdUI.Modal.open(new AntdUI.Modal.Config(form, "<22>Ƿ<EFBFBD>ɾ<EFBFBD><C9BE>", new AntdUI.Modal.TextLine[] {
|
||||
new AntdUI.Modal.TextLine(data[2].value.ToString(),AntdUI.Style.Db.Primary),
|
||||
new AntdUI.Modal.TextLine(data[11].value.ToString(),6,AntdUI.Style.Db.TextSecondary)
|
||||
new AntdUI.Modal.TextLine(data[8].value.ToString(),6,AntdUI.Style.Db.TextSecondary)
|
||||
}, AntdUI.TType.Error)
|
||||
{
|
||||
CancelText = null,
|
||||
@@ -214,50 +292,15 @@ namespace Demo.Controls
|
||||
DateTime birthday_TigerHu = new DateTime(1983, 7, 4);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>https://baike.baidu.com/link?url=7UWQOAPtuaXDjkFQZ92-cNlijS9voNgkQEJSmPLDV73RX1RLogXTLRQdBIQ6KMO7s1nIEZDKjvCJXa_e9fOrrhA9HxRDvRbkgGvPdWYMmP7
|
||||
DateTime birthday_DanielWu = new DateTime(1974, 9, 30);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>https://baike.baidu.com/link?url=zk3KO7qvnfny-fZ2QfgQ2-lZleCeNUaCfketfcE6Ur5p_LowHOhlttu0c4tEXDKN673QcgpSRRRUmymic58Rf5NiUpsMJrctl1SXaR2RXuu
|
||||
|
||||
list.Add(new AntdUI.AntItem[]{
|
||||
new AntdUI.AntItem("no",start),
|
||||
new AntdUI.AntItem("check",false),
|
||||
new AntdUI.AntItem("name","<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
||||
new AntdUI.AntItem("checkTitle",false),
|
||||
new AntdUI.AntItem("radio",false),
|
||||
new AntdUI.AntItem("online", new AntdUI.CellBadge(AntdUI.TState.Success, "<22><><EFBFBD><EFBFBD>")),
|
||||
new AntdUI.AntItem("enable",false),
|
||||
new AntdUI.AntItem("age",(int)Math.Round((now - birthday_TigerHu).TotalDays / 365)),
|
||||
new AntdUI.AntItem("date",DateTime.Now.Date.AddYears(-new System.Random().Next(DateTime.Now.Second))),
|
||||
new AntdUI.AntItem("address", (new System.Random().Next(DateTime.Now.Second)>5?"<22><><EFBFBD><EFBFBD>": "<22><><EFBFBD><EFBFBD>")+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + (start+1) + "<22><>"),
|
||||
new AntdUI.AntItem("tag"),
|
||||
new AntdUI.AntItem("imgs",new AntdUI.CellImage[] {
|
||||
new AntdUI.CellImage(Properties.Resources.img1){ BorderWidth=4,BorderColor=Color.BlueViolet},
|
||||
new AntdUI.CellImage(Properties.Resources.bg1)
|
||||
}),
|
||||
new AntdUI.AntItem("btns", new AntdUI.CellLink[] {
|
||||
new AntdUI.CellLink("delete","Delete")
|
||||
}),
|
||||
});
|
||||
list.Add(new AntdUI.AntItem[]{
|
||||
new AntdUI.AntItem("no",start + 1),
|
||||
new AntdUI.AntItem("check",false),
|
||||
new AntdUI.AntItem("name","<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
||||
new AntdUI.AntItem("checkTitle",false),
|
||||
new AntdUI.AntItem("radio",false),
|
||||
new AntdUI.AntItem("online",new AntdUI.CellBadge(AntdUI.TState.Processing, "<22><><EFBFBD><EFBFBD>")),
|
||||
new AntdUI.AntItem("enable",false),
|
||||
new AntdUI.AntItem("age",(int)Math.Round((now - birthday_DanielWu).TotalDays / 365)),
|
||||
new AntdUI.AntItem("date",DateTime.Now.Date.AddYears(-new System.Random().Next(DateTime.Now.Second))),
|
||||
new AntdUI.AntItem("address",(new System.Random().Next(DateTime.Now.Second)>5?"<22><><EFBFBD><EFBFBD>": "<22><><EFBFBD><EFBFBD>")+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + (start + 1+1) + "<22><>"),
|
||||
new AntdUI.AntItem("tag",new AntdUI.CellTag[]{ new AntdUI.CellTag("NICE", AntdUI.TTypeMini.Success), new AntdUI.CellTag("DEVELOPER", AntdUI.TTypeMini.Info) }),
|
||||
new AntdUI.AntItem("imgs"),
|
||||
new AntdUI.AntItem("btns", new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("b1") { BorderWidth=1, IconSvg="SearchOutlined",IconHoverSvg=Properties.Resources.icon_like,ShowArrow=true},
|
||||
new AntdUI.CellButton("b2") { ShowArrow=true},
|
||||
new AntdUI.CellButton("b3") { Type= AntdUI.TTypeMini.Primary, IconSvg="SearchOutlined" }
|
||||
}),
|
||||
});
|
||||
list.Add(GetItemOne(start, 0, AntdUI.Localization.Get("Table.Data.Name1", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), (int)Math.Round((now - birthday_TigerHu).TotalDays / 365)));
|
||||
list.Add(GetItemOne(start + 1, 1, AntdUI.Localization.Get("Table.Data.Name2", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), (int)Math.Round((now - birthday_DanielWu).TotalDays / 365),
|
||||
new AntdUI.CellTag[] { new AntdUI.CellTag("NICE", AntdUI.TTypeMini.Success), new AntdUI.CellTag("DEVELOPER", AntdUI.TTypeMini.Info)
|
||||
}));
|
||||
|
||||
for (int i = 2; i < pageSize; i++)
|
||||
{
|
||||
int index = start + i;
|
||||
list.Add(GetItemOne(index, i, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 20 + index));
|
||||
list.Add(GetItemOne(index, i, AntdUI.Localization.Get("Table.Data.Name3", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), 20 + index));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -271,61 +314,79 @@ namespace Demo.Controls
|
||||
return $"{e.PageSize} / {e.Total}<7D><> {e.PageTotal}ҳ";
|
||||
}
|
||||
|
||||
AntdUI.AntItem[] GetItemOne(int index, int start, string name, int age)
|
||||
AntdUI.AntItem[] GetItemOne(int index, int start, string name, int age, AntdUI.CellTag[]? tag = null)
|
||||
{
|
||||
int id = (index + 1);
|
||||
AntdUI.CellBadge _online = null;
|
||||
AntdUI.CellImage[] _imgs = null;
|
||||
AntdUI.CellLink[] _btns = null;
|
||||
|
||||
if (start == 1) _online = new AntdUI.CellBadge(AntdUI.TState.Success, "<22><><EFBFBD><EFBFBD>");
|
||||
else if (start == 2) _online = new AntdUI.CellBadge(AntdUI.TState.Processing, "<22><><EFBFBD><EFBFBD>");
|
||||
else if (start == 3) _online = new AntdUI.CellBadge(AntdUI.TState.Error, "<22><><EFBFBD><EFBFBD>");
|
||||
else if (start == 4) _online = new AntdUI.CellBadge(AntdUI.TState.Warn, "<22><><EFBFBD><EFBFBD>");
|
||||
else _online = new AntdUI.CellBadge(AntdUI.TState.Default, "<22><><EFBFBD><EFBFBD>");
|
||||
AntdUI.CellBadge online = null;
|
||||
AntdUI.CellImage[] imgs = null;
|
||||
AntdUI.CellLink[] btns = null;
|
||||
|
||||
if (start == 1) online = new AntdUI.CellBadge(AntdUI.TState.Success, AntdUI.Localization.Get("Table.Data.Online", "<22><><EFBFBD><EFBFBD>"));
|
||||
else if (start == 2) online = new AntdUI.CellBadge(AntdUI.TState.Processing, AntdUI.Localization.Get("Table.Data.Online.Processing", "<22><><EFBFBD><EFBFBD>"));
|
||||
else if (start == 3) online = new AntdUI.CellBadge(AntdUI.TState.Error, AntdUI.Localization.Get("Table.Data.Online.Error", "<22><><EFBFBD><EFBFBD>"));
|
||||
else if (start == 4) online = new AntdUI.CellBadge(AntdUI.TState.Warn, AntdUI.Localization.Get("Table.Data.Online.Warn", "<22><><EFBFBD><EFBFBD>"));
|
||||
else online = new AntdUI.CellBadge(AntdUI.TState.Default, AntdUI.Localization.Get("Table.Data.Online.Default", "<22><><EFBFBD><EFBFBD>"));
|
||||
|
||||
|
||||
var address = AntdUI.Localization.GetLangI("Table.Data.Address" + id, null);
|
||||
if (address == null) address = AntdUI.Localization.GetLangI("Table.Data.AddressNum", null);
|
||||
if (address == null) address = (new Random().Next(DateTime.Now.Second) > 5 ? "<22><><EFBFBD><EFBFBD>" : "<22><><EFBFBD><EFBFBD>") + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + id + "<22><>";
|
||||
else address += id;
|
||||
|
||||
if (start == 1)
|
||||
{
|
||||
_imgs = new AntdUI.CellImage[] {
|
||||
imgs = new AntdUI.CellImage[] {
|
||||
new AntdUI.CellImage(Properties.Resources.img1) { BorderWidth = 4, BorderColor = Color.BlueViolet },
|
||||
new AntdUI.CellImage(Properties.Resources.bg1)
|
||||
};
|
||||
}
|
||||
|
||||
if (start == 2)
|
||||
if (start == 1)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("b1") {
|
||||
BorderWidth = 1,
|
||||
IconSvg = "SearchOutlined",
|
||||
IconHoverSvg = Properties.Resources.icon_like,
|
||||
ShowArrow = true
|
||||
},
|
||||
new AntdUI.CellButton("b2") { ShowArrow = true },
|
||||
new AntdUI.CellButton("b3") { Type = AntdUI.TTypeMini.Primary, IconSvg = "SearchOutlined" }
|
||||
btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("id", null, AntdUI.TTypeMini.Primary).SetIcon("SearchOutlined").SetIconHover(Properties.Resources.icon_like),
|
||||
new AntdUI.CellButton("id", null, AntdUI.TTypeMini.Warn).SetIcon("ArrowDownOutlined"),
|
||||
new AntdUI.CellButton("id", null, AntdUI.TTypeMini.Error).SetArrow()
|
||||
};
|
||||
}
|
||||
else if (start == 2)
|
||||
{
|
||||
btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("id").SetBorder().SetIcon("SearchOutlined").SetIconHover(Properties.Resources.icon_like),
|
||||
new AntdUI.CellButton("id").SetBorder().SetIcon("ArrowDownOutlined"),
|
||||
new AntdUI.CellButton("id").SetBorder().SetArrow()
|
||||
};
|
||||
}
|
||||
else if (start == 3)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("b1", "Border") { BorderWidth = 1 },
|
||||
new AntdUI.CellButton("b2", "GhostBorder") { Ghost = true, BorderWidth = 1, ShowArrow = true, IsLink = true }
|
||||
};
|
||||
btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("id").SetBorder().SetGhost().SetIcon("SearchOutlined").SetIconHover(Properties.Resources.icon_like),
|
||||
new AntdUI.CellButton("id").SetBorder().SetGhost().SetIcon("ArrowDownOutlined"),
|
||||
new AntdUI.CellButton("id").SetBorder().SetGhost().SetArrow()
|
||||
};
|
||||
}
|
||||
else if (start == 4)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("edit", "Edit", AntdUI.TTypeMini.Primary) { Ghost = true, BorderWidth = 1 },
|
||||
new AntdUI.CellButton("delete", "Delete", AntdUI.TTypeMini.Error) { Ghost = true, BorderWidth = 1 }
|
||||
};
|
||||
btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("edit", "Edit", AntdUI.TTypeMini.Primary),
|
||||
new AntdUI.CellButton("delete", "Delete", AntdUI.TTypeMini.Error)
|
||||
};
|
||||
}
|
||||
else if (start == 5)
|
||||
{
|
||||
_btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("edit","Edit",AntdUI.TTypeMini.Primary),
|
||||
new AntdUI.CellButton("delete","Delete",AntdUI.TTypeMini.Error)
|
||||
};
|
||||
btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("edit", "Edit", AntdUI.TTypeMini.Primary).SetBorder().SetGhost(),
|
||||
new AntdUI.CellButton("delete", "Delete", AntdUI.TTypeMini.Error).SetBorder().SetGhost()
|
||||
};
|
||||
}
|
||||
else _btns = new AntdUI.CellLink[] { new AntdUI.CellLink("delete", "Delete") };
|
||||
else if (start == 6)
|
||||
{
|
||||
btns = new AntdUI.CellLink[] {
|
||||
new AntdUI.CellButton("delete", "Download", AntdUI.TTypeMini.Success).SetIcon("DownloadOutlined")
|
||||
};
|
||||
}
|
||||
else btns = new AntdUI.CellLink[] { new AntdUI.CellLink("delete", "Delete") };
|
||||
|
||||
return new AntdUI.AntItem[]{
|
||||
new AntdUI.AntItem("no", id),
|
||||
@@ -333,14 +394,14 @@ namespace Demo.Controls
|
||||
new AntdUI.AntItem("name", name),
|
||||
new AntdUI.AntItem("checkTitle", false),
|
||||
new AntdUI.AntItem("radio", false),
|
||||
new AntdUI.AntItem("online", _online),
|
||||
new AntdUI.AntItem("online", online),
|
||||
new AntdUI.AntItem("enable", start % 2 == 0),
|
||||
new AntdUI.AntItem("age", age),
|
||||
new AntdUI.AntItem("age", DateTime.Now.Date.AddYears(-age)),
|
||||
new AntdUI.AntItem("address", address),
|
||||
new AntdUI.AntItem("date",DateTime.Now.Date.AddYears(-new System.Random().Next(DateTime.Now.Second))),
|
||||
new AntdUI.AntItem("address", (new System.Random().Next(DateTime.Now.Second)>5?"<22><><EFBFBD><EFBFBD>": "<22><><EFBFBD><EFBFBD>")+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + id + "<22><>"),
|
||||
new AntdUI.AntItem("tag"),
|
||||
new AntdUI.AntItem("imgs", _imgs),
|
||||
new AntdUI.AntItem("btns", _btns),
|
||||
new AntdUI.AntItem("tag",tag),
|
||||
new AntdUI.AntItem("imgs", imgs),
|
||||
new AntdUI.AntItem("btns", btns),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -516,6 +516,12 @@ namespace Demo
|
||||
return "VisibleHeader";
|
||||
case "Table.checkAddressLineBreak":
|
||||
return "AddressLineBreak";
|
||||
case "Table.checkFilter":
|
||||
return "Filter";
|
||||
case "Table.selectEditMode":
|
||||
return "EditMode";
|
||||
case "Table.selectEditStyle":
|
||||
return "EditStyle";
|
||||
case "Table.Column.name":
|
||||
return "Name";
|
||||
case "Table.Column.checkTitle":
|
||||
@@ -530,10 +536,38 @@ namespace Demo
|
||||
return "Age";
|
||||
case "Table.Column.address":
|
||||
return "Address";
|
||||
case "Table.Column.date":
|
||||
return "Date";
|
||||
case "Table.Column.imgs":
|
||||
return "Imgs";
|
||||
case "Table.Column.btns":
|
||||
return "Action";
|
||||
case "Table.Data.Name1":
|
||||
return "John Brown";
|
||||
case "Table.Data.Name2":
|
||||
return "Jim Green";
|
||||
case "Table.Data.Name3":
|
||||
return "Joe Black";
|
||||
case "Table.Data.Online.Default":
|
||||
return "Default";
|
||||
case "Table.Data.Online":
|
||||
return "Online";
|
||||
case "Table.Data.Online.Processing":
|
||||
return "Processing";
|
||||
case "Table.Data.Online.Error":
|
||||
return "Error";
|
||||
case "Table.Data.Online.Warn":
|
||||
return "Warn";
|
||||
case "Table.Data.Address1":
|
||||
return "London, Park Lane no.1";
|
||||
case "Table.Data.Address2":
|
||||
return "New York No.1 Lake Park";
|
||||
case "Table.Data.Address3":
|
||||
return "London No. 1 Lake Park";
|
||||
case "Table.Data.Address4":
|
||||
return "Sydney No. 1 Lake Park";
|
||||
case "Table.Data.AddressNum":
|
||||
return "London, Park Lane no.";
|
||||
|
||||
//Tabs ----------------------------
|
||||
case "Tabs.Text":
|
||||
|
||||
@@ -791,11 +791,7 @@ namespace AntdUI
|
||||
SelectedIndex = i;
|
||||
if (DragSort)
|
||||
{
|
||||
dragHeader = new Table.DragHeader
|
||||
{
|
||||
i = i,
|
||||
x = x
|
||||
};
|
||||
dragHeader = new Table.DragHeader(e.X, e.Y, i, x);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -495,7 +495,7 @@ namespace AntdUI
|
||||
return this;
|
||||
}
|
||||
|
||||
public CellButton SetArrow(float value = 1F)
|
||||
public CellButton SetArrowProg(float value = 1F)
|
||||
{
|
||||
ArrowProg = value;
|
||||
return this;
|
||||
|
||||
@@ -404,8 +404,7 @@ namespace AntdUI
|
||||
}
|
||||
else
|
||||
{
|
||||
if (column.COLUMN.SortOrder) column.RECT_REAL = new Rectangle(_rect.X + gap, _rect.Y, _rect.Width - gap2 - column.SortWidth, _rect.Height);
|
||||
else column.RECT_REAL = new Rectangle(_rect.X + gap, _rect.Y, _rect.Width - gap2, _rect.Height);
|
||||
column.RECT_REAL = new Rectangle(_rect.X + gap, _rect.Y, _rect.Width - gap2 - column.SFWidth, _rect.Height);
|
||||
if (x < column.RECT_REAL.Right) x = column.RECT_REAL.Right;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,11 +90,7 @@ namespace AntdUI
|
||||
}
|
||||
if (ColumnDragSort && cell.COLUMN.DragSort)
|
||||
{
|
||||
dragHeader = new DragHeader
|
||||
{
|
||||
i = cell.COLUMN.INDEX_REAL,
|
||||
x = e.X
|
||||
};
|
||||
dragHeader = new DragHeader(e.X, e.Y, cell.COLUMN.INDEX_REAL, e.X);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -102,11 +98,7 @@ namespace AntdUI
|
||||
{
|
||||
if (cell.COLUMN is ColumnSort sort && cell.CONTAIN_REAL(r_x, r_y))
|
||||
{
|
||||
dragBody = new DragHeader
|
||||
{
|
||||
i = cell.ROW.INDEX,
|
||||
x = e.Y
|
||||
};
|
||||
dragBody = new DragHeader(e.X, e.Y, cell.ROW.INDEX, e.Y);
|
||||
return;
|
||||
}
|
||||
if (cell.ROW.CanExpand && cell.ROW.RECORD != null && cell.ROW.RectExpand.Contains(r_x, r_y))
|
||||
@@ -202,7 +194,7 @@ namespace AntdUI
|
||||
if (dragHeader != null)
|
||||
{
|
||||
bool hand = dragHeader.hand;
|
||||
if (hand && dragHeader.im != -1)
|
||||
if (hand && dragHeader.enable && dragHeader.im != -1)
|
||||
{
|
||||
//执行排序
|
||||
if (columns == null) return;
|
||||
@@ -233,7 +225,7 @@ namespace AntdUI
|
||||
if (dragBody != null)
|
||||
{
|
||||
bool hand = dragBody.hand;
|
||||
if (hand && dragBody.im != -1)
|
||||
if (hand && dragBody.enable && dragBody.im != -1)
|
||||
{
|
||||
//执行排序
|
||||
if (rows == null) return;
|
||||
@@ -599,6 +591,7 @@ namespace AntdUI
|
||||
}
|
||||
if (dragHeader != null)
|
||||
{
|
||||
dragHeader.SetEnable(e.X, e.Y);
|
||||
SetCursor(CursorType.SizeAll);
|
||||
dragHeader.hand = true;
|
||||
dragHeader.xr = e.X - dragHeader.x;
|
||||
@@ -624,6 +617,7 @@ namespace AntdUI
|
||||
}
|
||||
if (dragBody != null)
|
||||
{
|
||||
dragBody.SetEnable(e.X, e.Y);
|
||||
SetCursor(CursorType.SizeAll);
|
||||
dragBody.hand = true;
|
||||
dragBody.xr = e.Y - dragBody.x;
|
||||
@@ -690,13 +684,9 @@ namespace AntdUI
|
||||
}
|
||||
}
|
||||
if (has_check && cel.COLUMN is ColumnCheck columnCheck && columnCheck.NoTitle && cel.CONTAIN_REAL(r_x, r_y)) SetCursor(true);
|
||||
else if (ColumnDragSort && cel.COLUMN.DragSort)
|
||||
{
|
||||
SetCursor(CursorType.SizeAll);
|
||||
return;
|
||||
}
|
||||
else if (cel.COLUMN.Filter != null && cel.rect_filter.Contains(r_x - cel.offsetx, r_y - cel.offsetx)) SetCursor(true);
|
||||
else if (cel.COLUMN.SortOrder) SetCursor(true);
|
||||
else if (ColumnDragSort && cel.COLUMN.DragSort) SetCursor(CursorType.SizeAll);
|
||||
else SetCursor(false);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -319,41 +319,44 @@ namespace AntdUI
|
||||
}
|
||||
}
|
||||
if (dragHeader == null) return;
|
||||
foreach (var column in row.cells)
|
||||
if (dragHeader.enable)
|
||||
{
|
||||
int index = column.COLUMN.INDEX_REAL;
|
||||
if (dragHeader.i == index)
|
||||
foreach (var column in row.cells)
|
||||
{
|
||||
using (var brush = new SolidBrush(Colour.FillSecondary.Get("Table", ColorScheme)))
|
||||
int index = column.COLUMN.INDEX_REAL;
|
||||
if (dragHeader.i == index)
|
||||
{
|
||||
if (radius > 0)
|
||||
using (var brush = new SolidBrush(Colour.FillSecondary.Get("Table", ColorScheme)))
|
||||
{
|
||||
if (column.INDEX == 0)
|
||||
if (radius > 0)
|
||||
{
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, true, false, false, false))
|
||||
if (column.INDEX == 0)
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, true, false, false, false))
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column.INDEX == row.cells.Length - 1)
|
||||
{
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, false, true, false, false))
|
||||
else if (column.INDEX == row.cells.Length - 1)
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, false, true, false, false))
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
}
|
||||
}
|
||||
else g.Fill(brush, column.RECT);
|
||||
}
|
||||
else g.Fill(brush, column.RECT);
|
||||
}
|
||||
else g.Fill(brush, column.RECT);
|
||||
}
|
||||
}
|
||||
if (dragHeader.im == index)
|
||||
{
|
||||
using (var brush_split = new SolidBrush(Colour.BorderColor.Get("Table", ColorScheme)))
|
||||
if (dragHeader.im == index)
|
||||
{
|
||||
int sp = (int)(2 * Config.Dpi);
|
||||
if (dragHeader.last) g.Fill(brush_split, new Rectangle(column.RECT.Right - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
else g.Fill(brush_split, new Rectangle(column.RECT.X - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
using (var brush_split = new SolidBrush(Colour.BorderColor.Get("Table", ColorScheme)))
|
||||
{
|
||||
int sp = (int)(2 * Config.Dpi);
|
||||
if (dragHeader.last) g.Fill(brush_split, new Rectangle(column.RECT.Right - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
else g.Fill(brush_split, new Rectangle(column.RECT.X - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,41 +414,44 @@ namespace AntdUI
|
||||
}
|
||||
g.Restore(state);
|
||||
if (dragHeader == null) return;
|
||||
foreach (var column in row.cells)
|
||||
if (dragHeader.enable)
|
||||
{
|
||||
int index = column.COLUMN.INDEX_REAL;
|
||||
if (dragHeader.i == index)
|
||||
foreach (var column in row.cells)
|
||||
{
|
||||
using (var brush = new SolidBrush(Colour.FillSecondary.Get("Table", ColorScheme)))
|
||||
int index = column.COLUMN.INDEX_REAL;
|
||||
if (dragHeader.i == index)
|
||||
{
|
||||
if (radius > 0)
|
||||
using (var brush = new SolidBrush(Colour.FillSecondary.Get("Table", ColorScheme)))
|
||||
{
|
||||
if (column.INDEX == 0)
|
||||
if (radius > 0)
|
||||
{
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, true, false, false, false))
|
||||
if (column.INDEX == 0)
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, true, false, false, false))
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column.INDEX == row.cells.Length - 1)
|
||||
{
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, false, true, false, false))
|
||||
else if (column.INDEX == row.cells.Length - 1)
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
using (var path = Helper.RoundPath(column.RECT, radius, false, true, false, false))
|
||||
{
|
||||
g.Fill(brush, path);
|
||||
}
|
||||
}
|
||||
else g.Fill(brush, column.RECT);
|
||||
}
|
||||
else g.Fill(brush, column.RECT);
|
||||
}
|
||||
else g.Fill(brush, column.RECT);
|
||||
}
|
||||
}
|
||||
if (dragHeader.im == index)
|
||||
{
|
||||
using (var brush_split = new SolidBrush(Colour.BorderColor.Get("Table", ColorScheme)))
|
||||
if (dragHeader.im == index)
|
||||
{
|
||||
int sp = (int)(2 * Config.Dpi);
|
||||
if (dragHeader.last) g.Fill(brush_split, new Rectangle(column.RECT.Right - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
else g.Fill(brush_split, new Rectangle(column.RECT.X - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
using (var brush_split = new SolidBrush(Colour.BorderColor.Get("Table", ColorScheme)))
|
||||
{
|
||||
int sp = (int)(2 * Config.Dpi);
|
||||
if (dragHeader.last) g.Fill(brush_split, new Rectangle(column.RECT.Right - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
else g.Fill(brush_split, new Rectangle(column.RECT.X - sp, column.RECT.Y, sp * 2, column.RECT.Height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,7 +714,7 @@ namespace AntdUI
|
||||
g.SetClip(it.RECT, CombineMode.Intersect);
|
||||
g.String(text.value, Font, fore, text.RECT_REAL, StringFormat(text.COLUMN));
|
||||
}
|
||||
if (dragHeader != null && dragHeader.i == it.COLUMN.INDEX_REAL) g.Fill(Colour.FillSecondary.Get("Table", ColorScheme), it.RECT);
|
||||
if (dragHeader != null && dragHeader.enable && dragHeader.i == it.COLUMN.INDEX_REAL) g.Fill(Colour.FillSecondary.Get("Table", ColorScheme), it.RECT);
|
||||
if (it.ROW.CanExpand && it.ROW.KeyTreeINDEX == columnIndex)
|
||||
{
|
||||
using (var path_check = Helper.RoundPath(it.ROW.RectExpand, check_radius, false))
|
||||
|
||||
@@ -889,16 +889,15 @@ namespace AntdUI
|
||||
var size = g.MeasureString(value, font);
|
||||
if (COLUMN.SortOrder || COLUMN.HasFilter)
|
||||
{
|
||||
if (COLUMN.SortOrder && COLUMN.HasFilter) SortWidth = (int)(size.Height * 1.8F);
|
||||
else if (COLUMN.HasFilter) SortWidth = (int)(size.Height * 1.34F);
|
||||
else SortWidth = (int)(size.Height * .8F);
|
||||
if (COLUMN.SortOrder && COLUMN.HasFilter) SFWidth = (int)(size.Height * 1.8F);
|
||||
else SFWidth = (int)(size.Height * .8F);
|
||||
}
|
||||
MinWidth = size.Width + gap2 + SortWidth;
|
||||
MinWidth = size.Width + gap2 + SFWidth;
|
||||
|
||||
return new Size(size.Width + gap2 + SortWidth, size.Height);
|
||||
return new Size(size.Width + gap2 + SFWidth, size.Height);
|
||||
}
|
||||
|
||||
public int SortWidth = 0;
|
||||
public int SFWidth = 0;
|
||||
public override string ToString() => value;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,22 @@ namespace AntdUI
|
||||
|
||||
internal class DragHeader
|
||||
{
|
||||
public DragHeader(int ox, int oy, int _i, int _x)
|
||||
{
|
||||
_ox = ox;
|
||||
_oy = oy;
|
||||
i = _i;
|
||||
x = _x;
|
||||
}
|
||||
public int _ox { get; set; }
|
||||
public int _oy { get; set; }
|
||||
public void SetEnable(int x, int y)
|
||||
{
|
||||
if (x == _ox && y == _oy) return;
|
||||
enable = true;
|
||||
}
|
||||
|
||||
public bool enable { get; set; }
|
||||
public int x { get; set; }
|
||||
public int xr { get; set; }
|
||||
public int i { get; set; }
|
||||
|
||||
@@ -1988,6 +1988,7 @@ namespace AntdUI
|
||||
filter = value;
|
||||
if (filter == null) HasFilter = false;
|
||||
else HasFilter = true;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +206,7 @@ namespace AntdUI
|
||||
}
|
||||
bool IFNextSelect(int start)
|
||||
{
|
||||
if (start > Items.Count - 1) return false;
|
||||
var it = Items[start];
|
||||
if (selectedValue.Contains(it.Item) || it.Item is SelectItem item && selectedValue.Contains(item.Tag)) return true;
|
||||
else return false;
|
||||
|
||||
Reference in New Issue
Block a user