去除所有高级特性

This commit is contained in:
czz_y 2024-09-06 16:54:03 +08:00
parent cdb177356e
commit 8e71e518f4
11 changed files with 78 additions and 43 deletions

View File

@ -10,7 +10,6 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>assets\icon.ico</ApplicationIcon>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>12</LangVersion>
<Copyright>Copyright © 2024 czz_y</Copyright>
<FileVersion>$(Version)</FileVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>

View File

@ -87,7 +87,7 @@ namespace AntdUIDemo.Views
if (toggle)
{
tooltipText.AppendLine($"Toggle: {toggle}");
if (toggletype is not null)
if (toggletype != null)
tooltipText.AppendLine($"ToggleType: {toggletype}");
if (!string.IsNullOrEmpty(toggleiconsvg))
{

View File

@ -34,12 +34,12 @@ namespace AntdUIDemo.Views
// dates 参数为 DateTime[] 数组长度固定为2返回UI上显示的开始日期与结束日期
// DateTime start_date = dates[0], end_date = dates[1];
var now = dates[1];
return [
new(now.ToString("yyyy-MM-dd"),0),
new(now.AddDays(-20).ToString("yyyy-MM-dd"),5),
new(now.AddDays(-2).ToString("yyyy-MM-dd"),99),
new(now.AddDays(-6).ToString("yyyy-MM-dd"),998,Color.FromArgb(112, 237, 58)),
];
return new List<DateBadge> {
new DateBadge(now.ToString("yyyy-MM-dd"),0),
new DateBadge(now.AddDays(-20).ToString("yyyy-MM-dd"),5),
new DateBadge(now.AddDays(-2).ToString("yyyy-MM-dd"),99),
new DateBadge(now.AddDays(-6).ToString("yyyy-MM-dd"),998,Color.FromArgb(112, 237, 58)),
};
};
calendar.LoadBadge();
}

View File

@ -39,7 +39,7 @@ namespace AntdUIDemo.Views
daysToMonday += 7;
start = today.AddDays(-daysToMonday);
end = start.AddDays(6);
datePickerRange.Value = [start, end];
datePickerRange.Value = new DateTime[] { start, end };
break;
case "上周":
daysToMonday = (int)today.DayOfWeek - (int)DayOfWeek.Monday;
@ -47,27 +47,27 @@ namespace AntdUIDemo.Views
daysToMonday += 7;
start = today.AddDays(-daysToMonday - 7);
end = start.AddDays(6);
datePickerRange.Value = [start, end];
datePickerRange.Value = new DateTime[] { start, end };
break;
case "本月":
start = new DateTime(today.Year, today.Month, 1);
end = start.AddMonths(1).AddDays(-1);
datePickerRange.Value = [start, end];
datePickerRange.Value = new DateTime[] { start, end };
break;
case "上月":
start = new DateTime(today.Year, today.Month, 1).AddMonths(-1);
end = start.AddMonths(1).AddDays(-1);
datePickerRange.Value = [start, end];
datePickerRange.Value = new DateTime[] { start, end };
break;
case "本年":
start = new DateTime(today.Year, 1, 1);
end = start.AddYears(1).AddDays(-1);
datePickerRange.Value = [start, end];
datePickerRange.Value = new DateTime[] { start, end };
break;
case "去年":
start = new DateTime(today.Year - 1, 1, 1);
end = start.AddYears(1).AddDays(-1);
datePickerRange.Value = [start, end];
datePickerRange.Value = new DateTime[] { start, end };
break;
}
}

View File

@ -95,10 +95,38 @@ namespace AntdUIDemo.Views
menu.Radius = (int)input_radius.Value;
menu.ForeColor = colorPicker_forecolor.Value == Color.Transparent ? null : colorPicker_forecolor.Value;
menu.ForeActive = colorPicker_foreactive.Value == Color.Transparent ? null : colorPicker_foreactive.Value;
menu.BackHover = colorPicker_backhover.Value == Color.Transparent ? null : colorPicker_backhover.Value;
menu.BackActive = colorPicker_backactive.Value == Color.Transparent ? null : colorPicker_backactive.Value;
if (colorPicker_forecolor.Value == Color.Transparent)
{
menu.ForeColor = null;
}
else
{
menu.ForeColor = colorPicker_forecolor.Value;
}
if (colorPicker_foreactive.Value == Color.Transparent)
{
menu.ForeActive = null;
}
else
{
menu.ForeActive = colorPicker_foreactive.Value;
}
if (colorPicker_backhover.Value == Color.Transparent)
{
menu.BackHover = null;
}
else
{
menu.BackHover = colorPicker_backhover.Value;
}
if (colorPicker_backactive.Value == Color.Transparent)
{
menu.BackActive = null;
}
else
{
menu.BackActive = colorPicker_backactive.Value;
}
}
}

View File

@ -77,8 +77,8 @@ namespace AntdUIDemo.Views
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
Btns = [new AntdUI.Modal.Btn("return", "Return", AntdUI.TTypeMini.Default),
new AntdUI.Modal.Btn("submit", "Submit", AntdUI.TTypeMini.Warn)],
Btns = new Modal.Btn[]{ new AntdUI.Modal.Btn("return", "Return", AntdUI.TTypeMini.Default),
new AntdUI.Modal.Btn("submit", "Submit", AntdUI.TTypeMini.Warn) },
CancelText = null,
OkText = "Search On Google",
OnOk = config =>

View File

@ -129,7 +129,7 @@ namespace AntdUIDemo.Views
switch_show.Checked = true;
switch_right.Checked = true;
selectMultiple.SelectedValue = ["1", "2", "5", "10"];
selectMultiple.SelectedValue = new object[] { "1", "2", "5", "10" };
}
}
}

View File

@ -59,12 +59,16 @@ namespace AntdUIDemo.Views
ArrowAlign = TAlign.TL,
OnControlLoad = () =>
{
popovercalendar.DateChanged += (sender, e) =>
AntdUI.Message.info(window, e.Value.ToString("yyyy-MM-dd"), autoClose: 1);
popovercalendar.DateChanged += Popovercalendar_DateChanged;
}
});
}
private void Popovercalendar_DateChanged(object sender, DateTimeEventArgs e)
{
AntdUI.Message.info(window, e.Value.ToString("yyyy-MM-dd"), autoClose: 1);
}
private void button_form_Click(object sender, EventArgs e)
{
var button = sender as AntdUI.Button;
@ -93,12 +97,16 @@ namespace AntdUIDemo.Views
{
OnControlLoad = () =>
{
popoverbutton.Click += (sender, e) =>
AntdUI.Message.info(window, "点击了PopoverButton", autoClose: 1);
popoverbutton.Click += Popoverbutton_Click;
}
});
}
private void Popoverbutton_Click(object sender, EventArgs e)
{
AntdUI.Message.info(window, "点击了PopoverButton", autoClose: 1);
}
private void button_close_Click(object sender, EventArgs e)
{
Popover.open(new Popover.Config(button_close, "Title", "Content\r\nContent\r\nContent")

View File

@ -29,8 +29,8 @@ namespace AntdUIDemo.Views
private void Button_views_Click(object sender, EventArgs e)
{
Preview.open(new Preview.Config(window,
[Properties.Resources.bg1, Properties.Resources.bg2, Properties.Resources.bg3]));
Preview.open(new Preview.Config(window, new List<Image>() {
Properties.Resources.bg1, Properties.Resources.bg2, Properties.Resources.bg3 }));
}
private void Button_view_Click(object sender, EventArgs e)

View File

@ -22,7 +22,7 @@ namespace AntdUIDemo.Views
private void InitData()
{
select_custom.Items.Clear();
select_custom.Items.AddRange([
select_custom.Items.AddRange(new object[] {
new SelectItem("在线状态"){
Online = 1,
@ -48,7 +48,7 @@ namespace AntdUIDemo.Views
{
SubText = "子文本"
}
]);
});
select_custom.SelectedIndex = 0;
}

View File

@ -25,7 +25,7 @@ namespace AntdUIDemo.Views
private void InitTableColumns()
{
table_base.Columns = [
table_base.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("Name", "姓名",ColumnAlign.Center),
new Column("Age", "年龄",ColumnAlign.Center),
@ -49,7 +49,7 @@ namespace AntdUIDemo.Views
new Column("CellProgress", "进度条",ColumnAlign.Center),
new Column("CellDivider", "分割线",ColumnAlign.Center),
new Column("CellLinks", "链接",ColumnAlign.Center),
];
};
}
private void BindEventHandler()
@ -112,14 +112,14 @@ namespace AntdUIDemo.Views
User useradd = new User()
{
CellBadge = new CellBadge(TState.Processing, "测试中"),
CellImages = [new CellImage(Properties.Resources.head)],
CellImages = new CellImage[] { new CellImage(Properties.Resources.head) },
CellDivider = new CellDivider(),
CellTags = [new CellTag("测试", TTypeMini.Primary), new CellTag("测试", TTypeMini.Success), new CellTag("测试", TTypeMini.Warn)],
CellTags = new CellTag[] { new CellTag("测试", TTypeMini.Primary), new CellTag("测试", TTypeMini.Success), new CellTag("测试", TTypeMini.Warn) },
CellText = new CellText("这是一个无图标的文本"),
CellProgress = new CellProgress(0.5f),
CellLinks = [new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI"),
CellLinks = new CellLink[]{ new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI"),
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error)],
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error) },
};
var form = new UserEdit(window, useradd) { Size = new Size(700, 400) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
@ -177,7 +177,7 @@ namespace AntdUIDemo.Views
else
AntdUI.Message.info(window, item.Text, autoClose: 1);
},
[
new IContextMenuStripItem[] {
new AntdUI.ContextMenuStripItem("编辑"){
IconSvg = "<svg t=\"1725101535645\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1082\" width=\"200\" height=\"200\"><path d=\"M867.22 413.07c-9.68 0-19.36-3.63-26.82-10.92-15.19-14.82-15.49-39.14-0.68-54.32 46.84-48.02 45.89-125.18-2.12-172.02-23.27-22.7-54.13-34.93-86.46-34.56-32.49 0.4-62.87 13.43-85.56 36.69-14.83 15.19-39.15 15.47-54.32 0.68-15.19-14.81-15.49-39.13-0.68-54.32C687 45.94 812.9 44.4 891.24 120.82c78.33 76.42 79.89 202.32 3.47 280.66-7.52 7.71-17.51 11.59-27.49 11.59z\" p-id=\"1083\"></path><path d=\"M819.09 462.01c-9.68 0-19.36-3.63-26.82-10.92L563.13 227.55c-15.19-14.82-15.49-39.14-0.68-54.32 14.82-15.2 39.15-15.47 54.32-0.68L845.92 396.1c15.19 14.82 15.49 39.14 0.68 54.32-7.54 7.72-17.52 11.59-27.51 11.59z\" p-id=\"1084\"></path><path d=\"M164.51 674.68c-9.68 0-19.36-3.63-26.82-10.92-15.19-14.82-15.49-39.14-0.68-54.32l473.74-485.6c14.82-15.2 39.15-15.47 54.33-0.67 15.18 14.82 15.48 39.14 0.67 54.33L192.01 663.09c-7.53 7.72-17.52 11.59-27.5 11.59z\" p-id=\"1085\"></path><path d=\"M111.34 958.62c-2.31 0-4.65-0.21-7.01-0.64-20.86-3.85-34.66-23.88-30.81-44.74l51.7-280.46c3.85-20.86 23.86-34.7 44.74-30.81 20.86 3.85 34.66 23.88 30.81 44.74l-51.7 280.46c-3.41 18.5-19.56 31.45-37.73 31.45z\" p-id=\"1086\"></path><path d=\"M393.86 898.44c-9.68 0-19.36-3.63-26.82-10.92-15.19-14.82-15.49-39.14-0.68-54.32L840.1 347.6c14.82-15.19 39.14-15.49 54.32-0.68 15.19 14.82 15.49 39.13 0.68 54.32l-473.74 485.6c-7.53 7.72-17.51 11.6-27.5 11.6z\" p-id=\"1087\"></path><path d=\"M111.3 958.66c-17.79 0-33.76-12.42-37.56-30.52-4.36-20.76 8.93-41.13 29.7-45.49l279.1-58.62c20.8-4.35 41.13 8.93 45.49 29.7 4.36 20.76-8.93 41.13-29.7 45.49l-279.1 58.62c-2.66 0.55-5.31 0.82-7.93 0.82z\" p-id=\"1088\"></path><path d=\"M912.71 959.5H592.59c-21.21 0-38.41-17.2-38.41-38.41 0-21.21 17.2-38.41 38.41-38.41h320.12c21.21 0 38.41 17.2 38.41 38.41 0 21.21-17.2 38.41-38.41 38.41z\" p-id=\"1089\"></path></svg>",
},
@ -186,11 +186,11 @@ namespace AntdUIDemo.Views
},
new ContextMenuStripItemDivider(),
new AntdUI.ContextMenuStripItem("详情"){
Sub = [ new AntdUI.ContextMenuStripItem("打印", "Ctrl + P") { },
new AntdUI.ContextMenuStripItem("另存为", "Ctrl + S") { } ],
Sub = new IContextMenuStripItem[]{ new AntdUI.ContextMenuStripItem("打印", "Ctrl + P") { },
new AntdUI.ContextMenuStripItem("另存为", "Ctrl + S") { } },
IconSvg = "<svg t=\"1725101601993\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1414\" width=\"200\" height=\"200\"><path d=\"M450.23 831.7c-164.87 0-316.85-108.51-366.94-269.68-30.4-97.82-20.9-201.62 26.76-292.29s127.79-157.35 225.6-187.75c97.83-30.42 201.61-20.9 292.29 26.76 90.67 47.67 157.35 127.79 187.75 225.61 35.78 115.12 16.24 237.58-53.6 335.99a383.494 383.494 0 0 1-43 50.66c-15.04 14.89-39.34 14.78-54.23-0.29-14.9-15.05-14.77-39.34 0.29-54.23a307.844 307.844 0 0 0 34.39-40.52c55.9-78.76 71.54-176.75 42.92-268.84-50.21-161.54-222.49-252.1-384.03-201.9-78.26 24.32-142.35 77.67-180.48 150.2-38.14 72.53-45.74 155.57-21.42 233.83 44.58 143.44 190.03 234.7 338.26 212.42 20.98-3.14 40.48 11.26 43.64 32.2 3.16 20.95-11.26 40.48-32.2 43.64a377.753 377.753 0 0 1-56 4.19z\" p-id=\"1415\"></path><path d=\"M919.84 959.5c-9.81 0-19.63-3.74-27.11-11.24L666.75 722.29c-14.98-14.97-14.98-39.25 0-54.23 14.97-14.98 39.26-14.98 54.23 0l225.97 225.97c14.98 14.97 14.98 39.25 0 54.23-7.48 7.5-17.3 11.24-27.11 11.24z\" p-id=\"1416\"></path></svg>",
}
]));
}));
}
}
}
@ -264,17 +264,17 @@ namespace AntdUIDemo.Views
Age = 30 + i,
Address = $"浙江省杭州市西湖区湖底公园{i + 1}号",
Enabled = i % 2 == 0,
CellImages = [new CellImage(Properties.Resources.head)],
CellTags = [new CellTag("测试", TTypeMini.Primary), new CellTag("测试", TTypeMini.Success), new CellTag("测试", TTypeMini.Warn)],
CellImages = new CellImage[] { new CellImage(Properties.Resources.head) },
CellTags = new CellTag[] { new CellTag("测试", TTypeMini.Primary), new CellTag("测试", TTypeMini.Success), new CellTag("测试", TTypeMini.Warn) },
CellBadge = new CellBadge(TState.Processing, "测试中"),
CellText = new CellText("这是一个带图标的文本")
{
IconRatio = 0.5f,
PrefixSvg = "<svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"search\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z\"></path></svg>"
},
CellLinks = [new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI"),
CellLinks = new CellLink[] {new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI"),
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error)],
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error) },
//value:0-1
CellProgress = new CellProgress(0.5f),
CellDivider = new CellDivider(),