Skip to content

Commit adc3e46

Browse files
authored
feat(MaterialDesignIcon): integrated MaterialDesign icon (#5247)
* refactor: 移动 fa 图标 * chore: 增加 bs 图标 * feat: 增加 bs 图标集 * refactor: 调整顺序 * refactor: 移除 bs 图标集配置 * chore: 移除包 * chore: 增加图标集 * chore: 移除配置代码 * chore: 移除包 * refactor: 重命名 * chore: 增加 MaterialDesign 图标
1 parent 4e0bb22 commit adc3e46

File tree

4 files changed

+231
-6
lines changed

4 files changed

+231
-6
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
<PackageReference Include="BootstrapBlazor.Live2DDisplay" Version="9.0.1" />
4545
<PackageReference Include="BootstrapBlazor.Markdown" Version="9.0.1" />
4646
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="9.0.0" />
47-
<PackageReference Include="BootstrapBlazor.MaterialDesign.Extensions" Version="9.1.0" />
4847
<PackageReference Include="BootstrapBlazor.MeiliSearch" Version="9.1.7" />
4948
<PackageReference Include="BootstrapBlazor.Mermaid" Version="9.0.3" />
5049
<PackageReference Include="BootstrapBlazor.MindMap" Version="9.1.3" />

src/BootstrapBlazor.Server/Extensions/ServiceCollectionSharedExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ public static IServiceCollection AddBootstrapBlazorServices(this IServiceCollect
7373
options.Binders.Add("layout-demo/text=Parameter", new() { Text = "Text 3" });
7474
});
7575

76-
// 增加 MaterialDesign 图标主题
77-
services.ConfigureMaterialDesignIconTheme();
78-
7976
// 增加 BootstrapBlazor 假日服务
8077
services.AddBootstrapHolidayService();
8178

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
// Copyright (c) Argo Zhang ([email protected]). All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
// Website: https://www.blazor.zone or https://argozhang.github.io/
4+
5+
namespace BootstrapBlazor.Components;
6+
7+
internal static class MaterialDesignIcons
8+
{
9+
public static Dictionary<ComponentIcons, string> Icons => new()
10+
{
11+
// AnchorLink 组件
12+
{ ComponentIcons.AnchorLinkIcon, "mdi mdi-link-variant" },
13+
14+
// Avatar 组件
15+
{ ComponentIcons.AvatarIcon, "mdi mdi-account" },
16+
{ ComponentIcons.AutoFillIcon, "mdi mdi-chevron-up" },
17+
{ ComponentIcons.AutoCompleteIcon, "mdi mdi-chevron-up" },
18+
19+
{ ComponentIcons.ButtonLoadingIcon, "mdi mdi-loading mdi-spin" },
20+
21+
{ ComponentIcons.CaptchaRefreshIcon, "mdi mdi-refresh" },
22+
{ ComponentIcons.CaptchaBarIcon, "mdi mdi-chevron-right" },
23+
{ ComponentIcons.CameraPlayIcon, "mdi mdi-play-circle-outline" },
24+
{ ComponentIcons.CameraStopIcon, "mdi mdi-stop-circle-outline" },
25+
{ ComponentIcons.CameraPhotoIcon, "mdi mdi-camera-outline" },
26+
{ ComponentIcons.CardCollapseIcon, "mdi mdi-chevron-right-circle" },
27+
{ ComponentIcons.CarouselPreviousIcon, "mdi mdi-chevron-left" },
28+
{ ComponentIcons.CarouselNextIcon, "mdi mdi-chevron-right" },
29+
{ ComponentIcons.CascaderIcon, "mdi mdi-chevron-up" },
30+
{ ComponentIcons.CascaderSubMenuIcon, "mdi mdi-chevron-down" },
31+
{ ComponentIcons.ConsoleClearButtonIcon, "mdi mdi-close" },
32+
33+
// DateTimePicker 组件
34+
{ ComponentIcons.DatePickBodyPreviousYearIcon, "mdi mdi-chevron-double-left" },
35+
{ ComponentIcons.DatePickBodyPreviousMonthIcon, "mdi mdi-chevron-left" },
36+
{ ComponentIcons.DatePickBodyNextMonthIcon, "mdi mdi-chevron-right" },
37+
{ ComponentIcons.DatePickBodyNextYearIcon, "mdi mdi-chevron-double-right" },
38+
{ ComponentIcons.DateTimePickerIcon, "mdi mdi-calendar-outline" },
39+
{ ComponentIcons.TimePickerCellUpIcon, "mdi mdi-chevron-up" },
40+
{ ComponentIcons.TimePickerCellDownIcon, "mdi mdi-chevron-down" },
41+
42+
// DateTimeRange 组件
43+
{ ComponentIcons.DateTimeRangeIcon, "mdi mdi-calendar-range-outline" },
44+
{ ComponentIcons.DateTimeRangeClearIcon, "mdi mdi-close-circle-outline" },
45+
46+
{ ComponentIcons.DialogCloseButtonIcon, "mdi mdi-close" },
47+
{ ComponentIcons.DialogSaveButtonIcon, "mdi mdi-content-save" },
48+
{ ComponentIcons.DialogMaximizeWindowIcon, "mdi mdi-window-maximize" },
49+
{ ComponentIcons.DialogRestoreWindowIcon, "mdi mdi-window-restore" },
50+
51+
{ ComponentIcons.TopMenuDropdownIcon, "mdi mdi-chevron-down" },
52+
{ ComponentIcons.SideMenuDropdownIcon, "mdi mdi-chevron-down" },
53+
{ ComponentIcons.MenuLinkArrowIcon, "mdi mdi-chevron-left" },
54+
55+
{ ComponentIcons.ResultDialogYesIcon, "mdi mdi-check" },
56+
{ ComponentIcons.ResultDialogNoIcon, "mdi mdi-close-circle-outline" },
57+
{ ComponentIcons.ResultDialogCloseIcon, "mdi mdi-close-circle-outline" },
58+
59+
{ ComponentIcons.SearchDialogClearIcon, "mdi mdi-trash-can-outline" },
60+
{ ComponentIcons.SearchDialogSearchIcon, "mdi mdi-magnify-plus-outline" },
61+
62+
{ ComponentIcons.StepIcon, "mdi mdi-check" },
63+
{ ComponentIcons.StepErrorIcon, "mdi mdi-close" },
64+
65+
{ ComponentIcons.FilterButtonFilterIcon, "mdi mdi-filter-outline" },
66+
{ ComponentIcons.FilterButtonClearIcon, "mdi mdi-filter-remove-outline" },
67+
68+
{ ComponentIcons.TableFilterPlusIcon, "mdi mdi-plus" },
69+
{ ComponentIcons.TableFilterMinusIcon, "mdi mdi-minus" },
70+
71+
{ ComponentIcons.FullScreenButtonIcon, "mdi mdi-arrow-expand-all" },
72+
{ ComponentIcons.FullScreenExitButtonIcon, "mdi mdi-fullscreen-exit" },
73+
74+
{ ComponentIcons.GoTopIcon, "mdi mdi-chevron-up" },
75+
76+
{ ComponentIcons.ImagePreviewPreviousIcon, "mdi mdi-chevron-left" },
77+
{ ComponentIcons.ImagePreviewNextIcon, "mdi mdi-chevron-right" },
78+
{ ComponentIcons.ImagePreviewMinusIcon, "mdi mdi-magnify-minus-outline" },
79+
{ ComponentIcons.ImagePreviewPlusIcon, "mdi mdi-magnify-plus-outline" },
80+
{ ComponentIcons.ImagePreviewRotateLeftIcon, "mdi mdi-file-rotate-left-outline" },
81+
{ ComponentIcons.ImagePreviewRotateRightIcon, "mdi mdi-file-rotate-right-outline" },
82+
83+
{ ComponentIcons.ImageViewerFileIcon, "mdi mdi-file-image-outline" },
84+
85+
{ ComponentIcons.InputClearIcon, "mdi mdi-close-circle-outline" },
86+
87+
{ ComponentIcons.InputNumberMinusIcon, "mdi mdi-minus-circle-outline" },
88+
{ ComponentIcons.InputNumberPlusIcon, "mdi mdi-plus-circle-outline" },
89+
90+
{ ComponentIcons.LayoutMenuBarIcon, "mdi mdi-menu" },
91+
{ ComponentIcons.LogoutLinkIcon, "mdi mdi-logout" },
92+
93+
{ ComponentIcons.LoadingIcon, "mdi mdi-loading mdi-spin" },
94+
95+
{ ComponentIcons.PaginationPrevPageIcon, "mdi mdi-chevron-left" },
96+
{ ComponentIcons.PaginationNextPageIcon, "mdi mdi-chevron-right" },
97+
{ ComponentIcons.PaginationPrevEllipsisPageIcon, "mdi mdi-dots-horizontal" },
98+
{ ComponentIcons.PaginationNextEllipsisPageIcon, "mdi mdi-dots-horizontal" },
99+
100+
{ ComponentIcons.PopConfirmButtonConfirmIcon, "mdi mdi-exclamation" },
101+
102+
{ ComponentIcons.RateStarIcon, "mdi mdi-star" },
103+
{ ComponentIcons.RateUnStarIcon, "mdi mdi-star-outline" },
104+
105+
{ ComponentIcons.RibbonTabArrowUpIcon, "mdi mdi-chevron-up" },
106+
{ ComponentIcons.RibbonTabArrowDownIcon, "mdi mdi-chevron-down" },
107+
{ ComponentIcons.RibbonTabArrowPinIcon, "mdi mdi-pin mdi-pin-off" },
108+
109+
{ ComponentIcons.MultiSelectDropdownIcon, "mdi mdi-chevron-up" },
110+
{ ComponentIcons.MultiSelectClearIcon, "mdi mdi-close" },
111+
112+
{ ComponentIcons.SelectTreeDropdownIcon, "mdi mdi-chevron-up" },
113+
114+
{ ComponentIcons.SearchClearButtonIcon, "mdi mdi-trash-can-outline" },
115+
{ ComponentIcons.SearchButtonIcon, "mdi mdi-magnify-plus-outline" },
116+
{ ComponentIcons.SearchButtonLoadingIcon, "mdi mdi-loading mdi-spin" },
117+
118+
{ ComponentIcons.SelectDropdownIcon, "mdi mdi-chevron-up" },
119+
{ ComponentIcons.SelectClearIcon, "mdi mdi-close-circle-outline" },
120+
{ ComponentIcons.SelectSearchIcon, "mdi mdi-magnify-plus-outline" },
121+
122+
{ ComponentIcons.SweetAlertCloseIcon, "mdi mdi-close" },
123+
{ ComponentIcons.SweetAlertConfirmIcon, "mdi mdi-check" },
124+
125+
{ ComponentIcons.PrintButtonIcon, "mdi mdi-printer-outline" },
126+
127+
{ ComponentIcons.ToastSuccessIcon, "mdi mdi-check-circle" },
128+
{ ComponentIcons.ToastInformationIcon, "mdi mdi-alert-circle" },
129+
{ ComponentIcons.ToastWarningIcon, "mdi mdi-alert" },
130+
{ ComponentIcons.ToastErrorIcon, "mdi mdi-close-circle" },
131+
132+
{ ComponentIcons.TabPreviousIcon, "mdi mdi-chevron-left" },
133+
{ ComponentIcons.TabNextIcon, "mdi mdi-chevron-right" },
134+
{ ComponentIcons.TabDropdownIcon, "mdi mdi-chevron-down" },
135+
{ ComponentIcons.TabCloseIcon, "mdi mdi-close" },
136+
137+
{ ComponentIcons.TableColumnToolboxIcon, "mdi mdi-cog" },
138+
139+
{ ComponentIcons.TableSortIconAsc, "mdi mdi-sort-ascending" },
140+
{ ComponentIcons.TableSortDesc, "mdi mdi-sort-descending" },
141+
{ ComponentIcons.TableSortIcon, "mdi mdi-sort" },
142+
{ ComponentIcons.TableFilterIcon, "mdi mdi-filter" },
143+
{ ComponentIcons.TableExportButtonIcon, "mdi mdi-download" },
144+
145+
{ ComponentIcons.TableAddButtonIcon, "mdi mdi-plus" },
146+
{ ComponentIcons.TableEditButtonIcon, "mdi mdi-file-edit-outline" },
147+
{ ComponentIcons.TableDeleteButtonIcon, "mdi mdi-close" },
148+
{ ComponentIcons.TableRefreshButtonIcon, "mdi mdi-refresh" },
149+
{ ComponentIcons.TableCardViewButtonIcon, "mdi mdi-menu" },
150+
{ ComponentIcons.TableColumnListButtonIcon, "mdi mdi-format-list-bulleted" },
151+
{ ComponentIcons.TableExportCsvIcon, "mdi mdi-file-table-box" },
152+
{ ComponentIcons.TableExportExcelIcon, "mdi mdi-file-excel-box" },
153+
{ ComponentIcons.TableExportPdfIcon, "mdi mdi-file-pdf-box" },
154+
{ ComponentIcons.TableSearchButtonIcon, "mdi mdi-magnify" },
155+
{ ComponentIcons.TableResetSearchButtonIcon, "mdi mdi-trash-can-outline" },
156+
{ ComponentIcons.TableCloseButtonIcon, "mdi mdi-close" },
157+
{ ComponentIcons.TableCancelButtonIcon, "mdi mdi-close" },
158+
{ ComponentIcons.TableSaveButtonIcon, "mdi mdi-content-save" },
159+
{ ComponentIcons.TableAdvanceButtonIcon, "mdi mdi-magnify-plus-outline" },
160+
{ ComponentIcons.TableAdvancedSortButtonIcon, "mdi mdi-sort-alphabetical-descending" },
161+
162+
{ ComponentIcons.TableTreeIcon, "mdi mdi-menu-right" },
163+
{ ComponentIcons.TableTreeExpandIcon, "mdi mdi-menu-right mdi-rotate-90" },
164+
{ ComponentIcons.TableTreeNodeLoadingIcon, "mdi mdi-loading mdi-spin" },
165+
{ ComponentIcons.TableCopyColumnButtonIcon, "mdi mdi-clipboard-outline" },
166+
{ ComponentIcons.TableGearIcon, "mdi mdi-cog" },
167+
168+
{ ComponentIcons.TransferLeftIcon, "mdi mdi-chevron-left" },
169+
{ ComponentIcons.TransferRightIcon, "mdi mdi-chevron-right" },
170+
{ ComponentIcons.TransferPanelSearchIcon, "mdi mdi-magnify-plus-outline" },
171+
172+
{ ComponentIcons.TimerIcon, "mdi mdi-bell-outline" },
173+
174+
{ ComponentIcons.TreeViewExpandNodeIcon, "mdi mdi-menu-right mdi-rotate-90" },
175+
{ ComponentIcons.TreeViewNodeIcon, "mdi mdi-menu-right" },
176+
{ ComponentIcons.TreeViewSearchIcon, "mdi mdi-magnify" },
177+
{ ComponentIcons.TreeViewResetSearchIcon, "mdi mdi-backspace" },
178+
{ ComponentIcons.TreeViewLoadingIcon, "mdi mdi-loading mdi-spin" },
179+
180+
// Upload
181+
{ ComponentIcons.AvatarUploadDeleteIcon, "mdi mdi-trash-can-outline" },
182+
{ ComponentIcons.AvatarUploadLoadingIcon, "mdi mdi-loading mdi-spin" },
183+
{ ComponentIcons.AvatarUploadAddIcon, "mdi mdi-plus" },
184+
{ ComponentIcons.AvatarUploadValidStatusIcon, "mdi mdi-check mdi-rotate-315" },
185+
{ ComponentIcons.AvatarUploadInvalidStatusIcon, "mdi mdi-close mdi-rotate-315" },
186+
187+
{ ComponentIcons.ButtonUploadBrowserButtonIcon, "mdi mdi-folder-open" },
188+
{ ComponentIcons.ButtonUploadLoadingIcon, "mdi mdi-loading mdi-spin" },
189+
{ ComponentIcons.ButtonUploadInvalidStatusIcon, "mdi mdi-close-circle-outline" },
190+
{ ComponentIcons.ButtonUploadValidStatusIcon, "mdi mdi-check-circle-outline" },
191+
{ ComponentIcons.ButtonUploadDeleteIcon, "mdi mdi-trash-can-outline" },
192+
{ ComponentIcons.ButtonUploadDownloadIcon, "mdi mdi-cloud-download-outline" },
193+
194+
{ ComponentIcons.InputUploadBrowserButtonIcon, "mdi mdi-folder-open" },
195+
{ ComponentIcons.InputUploadDeleteButtonIcon, "mdi mdi-trash-can-outline" },
196+
197+
{ ComponentIcons.CardUploadAddIcon, "mdi mdi-plus" },
198+
{ ComponentIcons.CardUploadStatusIcon, "mdi mdi-check mdi-rotate-315" },
199+
{ ComponentIcons.CardUploadDeleteIcon, "mdi mdi-close mdi-rotate-315" },
200+
{ ComponentIcons.CardUploadRemoveIcon, "mdi mdi-trash-can-outline" },
201+
{ ComponentIcons.CardUploadDownloadIcon, "mdi mdi-cloud-download-outline" },
202+
{ ComponentIcons.CardUploadZoomIcon, "mdi mdi-magnify-plus-outline" },
203+
{ ComponentIcons.UploadCancelIcon, "mdi mdi-cancel" },
204+
{ ComponentIcons.DropUploadIcon, "mdi mdi-cloud-upload" },
205+
206+
{ ComponentIcons.FileIconExcel, "mdi mdi-file-excel-outline" },
207+
{ ComponentIcons.FileIconDocx, "mdi mdi-file-word-outline" },
208+
{ ComponentIcons.FileIconPPT, "mdi mdi-file-powerpoint-outline" },
209+
{ ComponentIcons.FileIconAudio, "mdi mdi-file-music-outline" },
210+
{ ComponentIcons.FileIconVideo, "mdi mdi-file-video-outline" },
211+
{ ComponentIcons.FileIconCode, "mdi mdi-file-code-outline" },
212+
{ ComponentIcons.FileIconPdf, "mdi mdi-file-pdf-box" },
213+
{ ComponentIcons.FileIconZip, "mdi mdi-file-cog-outline" },
214+
{ ComponentIcons.FileIconArchive, "mdi mdi-file-document-check-outline" },
215+
{ ComponentIcons.FileIconImage, "mdi mdi-file-image-outline" },
216+
{ ComponentIcons.FileIconFile, "mdi mdi-file-outline" },
217+
218+
{ ComponentIcons.QueryBuilderPlusIcon, "mdi mdi-plus" },
219+
{ ComponentIcons.QueryBuilderMinusIcon, "mdi mdi-minus" },
220+
{ ComponentIcons.QueryBuilderRemoveIcon, "mdi mdi-close" },
221+
222+
{ ComponentIcons.ThemeProviderAutoModeIcon, "mdi mdi-circle-half-full" },
223+
{ ComponentIcons.ThemeProviderLightModeIcon, "mdi mdi-white-balance-sunny" },
224+
{ ComponentIcons.ThemeProviderDarkModeIcon, "mdi mdi-weather-night" },
225+
{ ComponentIcons.ThemeProviderActiveModeIcon, "mdi mdi-check" }
226+
};
227+
}

src/BootstrapBlazor/Options/IconThemeOptions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ public IconThemeOptions()
3737
Icons = new Dictionary<string, FrozenDictionary<ComponentIcons, string>>()
3838
{
3939
{ "fa", FontAwesomeIcons.Icons.ToFrozenDictionary() },
40-
{ "bootstrap", BootstrapIcons.Icons.ToFrozenDictionary() }
40+
{ "bootstrap", BootstrapIcons.Icons.ToFrozenDictionary() },
41+
{ "mdi", MaterialDesignIcons.Icons.ToFrozenDictionary() }
4142
}.ToFrozenDictionary();
4243
#else
4344
Icons = new()
4445
{
4546
{ "fa", FontAwesomeIcons.Icons },
46-
{ "bootstrap", BootstrapIcons.Icons }
47+
{ "bootstrap", BootstrapIcons.Icons },
48+
{ "mdi", MaterialDesignIcons.Icons }
4749
};
4850
#endif
4951
ThemeKey = "fa";

0 commit comments

Comments
 (0)