From 998a87885423b9dcc75c4b058eae953c14584bfb Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 13 Apr 2024 21:09:29 +0800 Subject: [PATCH] feat(TagHelper): add BootstrapBlazor.TagHelper package (#3278) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc: 增加压缩 * refactor: 代码格式化 * refactor: 更改变量名 * refactor: 优化代码 * chore: 移除版本信息 * refactor: 增加压缩配置 * refactor: 使用原生标签 * refactor: 移除缓存配置 * chore: 移除工具链 * chore: 移除代码内置依赖服务 * doc: 移除 xml 注释 * refactor: 更新缓存策略 * doc: 格式化文档 * Revert "refactor: 使用原生标签" This reverts commit 00da9357f75672ccfe8b1322391964435ce483e8. * doc: 增加字典 * doc: 移除 jQuery 显示引用 * Revert "doc: 移除 jQuery 显示引用" This reverts commit f81512f340bdd64874a27b151a5f55e600514f2f. * feat: 增加文件哈希值逻辑 * chore: 更新路由 * doc: 更新注释 * feat: 增加 HashFile 方法 * doc: 格式化文档 * revert: 移除方法 * refactor: 更改属性标签顺序 * refactor: 使用原生标签 * chore: 更新自动化脚本 * revert: 撤销 WebRootPath 参数 * feat: 增加 TagHelper 工程 * doc: 格式化文档 * test: 更新单元测试 --- BootstrapBlazor.sln | 7 +++ Directory.Build.props | 1 - exclusion.dic | 1 + .../Components/App.razor | 26 +++++------ .../Components/Components/Header.razor.js | 4 +- .../Components/Components/Pre.razor.js | 4 +- .../Components/ThemeChooser.razor.js | 6 +-- .../Components/UpdateIntro.razor.js | 4 +- .../Layout/ComponentLayout.razor.cs | 9 +--- .../Components/Layout/DockLayout.razor.cs | 9 +--- .../Components/Layout/NavMenu.razor.js | 6 +-- .../Components/Pages/Chats.razor.cs | 6 +-- .../Components/Pages/Chats.razor.js | 2 +- .../Components/Pages/Index.razor.js | 2 +- .../Samples/Tutorials/DrawingApp.razor.js | 6 +-- .../Directory.Build.targets | 2 +- .../Extensions/ServicesExtensions.cs | 3 +- ...=> StaticFileResponseContextExtensions.cs} | 41 ++++++------------ src/BootstrapBlazor.Server/Program.cs | 28 ++++++++---- .../wwwroot/css/site.css | 2 +- .../wwwroot/lib/theme.js | 2 +- .../Components/Anchor/Anchor.razor.js | 4 +- .../Components/AnchorLink/AnchorLink.razor.js | 6 +-- .../AutoComplete/AutoComplete.razor.js | 12 ++--- .../BootstrapModuleComponentBase.cs | 9 +--- .../Components/Button/Button.razor.js | 2 +- .../Components/Button/DialButton.razor.js | 4 +- .../Button/PopConfirmButton.razor.js | 8 ++-- .../Components/Button/SlideButton.razor.js | 4 +- .../Components/Camera/Camera.razor.js | 2 +- .../Components/Captcha/Captcha.razor.js | 6 +-- .../Components/Card/Card.razor.js | 4 +- .../Components/Carousel/Carousel.razor.js | 4 +- .../ClockPicker/ClockPicker.razor.js | 6 +-- .../Components/Console/Console.razor.js | 4 +- .../ContextMenu/ContextMenu.razor.js | 6 +-- .../Components/CountUp/CountUp.razor.js | 4 +- .../DateTimePicker/DateTimePicker.razor.js | 6 +-- .../Components/Dialog/IconDialog.razor.js | 6 +-- .../Components/Drawer/Drawer.razor.js | 4 +- .../Components/Dropdown/Dropdown.razor.js | 4 +- .../Components/Filters/TableFilter.razor.js | 6 +-- .../Components/FlipClock/FlipClock.razor.js | 2 +- .../Components/GoTop/GoTop.razor.js | 4 +- .../Handwritten/Handwritten.razor.js | 4 +- .../Components/IFrame/IFrame.razor.js | 2 +- .../ImagePreviewer/ImagePreviewer.razor.js | 4 +- .../ImageViewer/ImageViewer.razor.js | 4 +- .../Components/Input/BootstrapInput.razor.js | 2 +- .../Components/IpAddress/IpAddress.razor.js | 4 +- .../Components/Layout/Layout.razor.js | 4 +- .../Components/Menu/Menu.razor.js | 4 +- .../Components/Message/Message.razor.js | 4 +- .../Components/Modal/Modal.razor.js | 4 +- .../Components/Modal/ModalDialog.razor.js | 6 +-- .../Components/Print/PrintButton.razor.js | 8 ++-- .../Components/RibbonTab/RibbonTab.razor.js | 4 +- .../Components/Segmented/Segmented.razor.js | 4 +- .../Components/Select/MultiSelect.razor.js | 8 ++-- .../Components/Select/Select.razor.js | 8 ++-- .../Components/Select/SelectObject.razor.js | 6 +-- .../Components/Select/SelectTable.razor.js | 6 +-- .../Components/Select/SelectTree.razor.js | 6 +-- .../Components/Split/Split.razor.js | 8 ++-- .../Components/Tab/Tab.razor.js | 4 +- .../Components/Table/Table.razor.js | 12 ++--- .../Components/Textarea/Textarea.razor.js | 2 +- .../TimePicker/TimePickerCell.razor.js | 4 +- .../Components/Toast/Toast.razor.js | 4 +- .../Components/Tooltip/Tooltip.razor.js | 2 +- .../Components/Transition/Transition.razor.js | 2 +- .../Components/TreeView/TreeView.razor.js | 4 +- .../Components/Validate/ValidateBase.cs | 2 +- .../ValidateForm/ValidateForm.razor.js | 2 +- .../Components/Waterfall/Waterfall.razor.js | 6 +-- src/BootstrapBlazor/Directory.Build.props | 2 +- .../Services/DefaultGeoLocationService.cs | 8 +--- .../Services/NotificationService.cs | 8 +--- .../Services/WebClientService.cs | 4 +- src/BootstrapBlazor/Utils/Utility.cs | 2 +- .../wwwroot/modules/autoredirect.js | 6 +-- .../wwwroot/modules/base-popover.js | 4 +- src/BootstrapBlazor/wwwroot/modules/client.js | 4 +- .../wwwroot/modules/debounce.js | 2 +- src/BootstrapBlazor/wwwroot/modules/drag.js | 2 +- .../wwwroot/modules/fullscreen.js | 4 +- src/BootstrapBlazor/wwwroot/modules/hub.js | 6 +-- src/BootstrapBlazor/wwwroot/modules/input.js | 2 +- .../wwwroot/modules/responsive.js | 4 +- src/BootstrapBlazor/wwwroot/modules/upload.js | 4 +- .../wwwroot/modules/utility.js | 2 +- src/BootstrapBlazor/wwwroot/modules/viewer.js | 4 +- src/Bundle.props | 1 - src/Directory.Build.props | 8 ++++ .../BootstrapBlazor.TagHelper.csproj | 25 +++++++++++ .../WebHostEnvironmentExtensions.cs | 35 +++++++++++++++ .../HtmlTag/Link.razor | 0 .../HtmlTag/Link.razor.cs | 9 ++-- .../HtmlTag/Script.razor | 0 .../HtmlTag/Script.razor.cs | 10 +++-- .../BootstrapBlazor.TagHelper/_Imports.razor | 2 + .../BootstrapBlazor.TagHelper/logo.png | Bin 0 -> 6414 bytes src/Logo.props | 5 --- test/UnitTest/Components/LinkTest.cs | 32 -------------- test/UnitTest/Components/ScriptTest.cs | 32 -------------- 105 files changed, 316 insertions(+), 343 deletions(-) rename src/BootstrapBlazor.Server/Extensions/{CacheExtensions.cs => StaticFileResponseContextExtensions.cs} (59%) create mode 100644 src/Extensions/Components/BootstrapBlazor.TagHelper/BootstrapBlazor.TagHelper.csproj create mode 100644 src/Extensions/Components/BootstrapBlazor.TagHelper/Extensions/WebHostEnvironmentExtensions.cs rename src/{BootstrapBlazor/Components => Extensions/Components/BootstrapBlazor.TagHelper}/HtmlTag/Link.razor (100%) rename src/{BootstrapBlazor/Components => Extensions/Components/BootstrapBlazor.TagHelper}/HtmlTag/Link.razor.cs (77%) rename src/{BootstrapBlazor/Components => Extensions/Components/BootstrapBlazor.TagHelper}/HtmlTag/Script.razor (100%) rename src/{BootstrapBlazor/Components => Extensions/Components/BootstrapBlazor.TagHelper}/HtmlTag/Script.razor.cs (75%) create mode 100644 src/Extensions/Components/BootstrapBlazor.TagHelper/_Imports.razor create mode 100644 src/Extensions/Components/BootstrapBlazor.TagHelper/logo.png delete mode 100644 test/UnitTest/Components/LinkTest.cs delete mode 100644 test/UnitTest/Components/ScriptTest.cs diff --git a/BootstrapBlazor.sln b/BootstrapBlazor.sln index e58217d87..0bd8a222d 100644 --- a/BootstrapBlazor.sln +++ b/BootstrapBlazor.sln @@ -132,6 +132,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapBlazor.Maui", "src EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "maui", "maui", "{81615751-490B-4B50-8029-C79846F592BB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapBlazor.TagHelper", "src\Extensions\Components\BootstrapBlazor.TagHelper\BootstrapBlazor.TagHelper.csproj", "{65CEB170-D561-4878-80E4-625538590D29}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -292,6 +294,10 @@ Global {B94D32F4-2E7C-400B-BC34-D6BA31A234CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {B94D32F4-2E7C-400B-BC34-D6BA31A234CB}.Release|Any CPU.Build.0 = Release|Any CPU {B94D32F4-2E7C-400B-BC34-D6BA31A234CB}.Release|Any CPU.Deploy.0 = Release|Any CPU + {65CEB170-D561-4878-80E4-625538590D29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65CEB170-D561-4878-80E4-625538590D29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65CEB170-D561-4878-80E4-625538590D29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65CEB170-D561-4878-80E4-625538590D29}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -343,6 +349,7 @@ Global {AB19F805-A27F-455F-8E36-8F1ADE295868} = {7C1D79F1-87BC-42C1-BD5A-CDE4044AC1BD} {B94D32F4-2E7C-400B-BC34-D6BA31A234CB} = {81615751-490B-4B50-8029-C79846F592BB} {81615751-490B-4B50-8029-C79846F592BB} = {A2182155-43ED-44C1-BF6F-1B70EBD2DFFE} + {65CEB170-D561-4878-80E4-625538590D29} = {CD062AB6-244D-402A-8F33-C37DAC5856CC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0DCB0756-34FA-4FD0-AE1D-D3F08B5B3A6B} diff --git a/Directory.Build.props b/Directory.Build.props index 8a4182961..4fbc82938 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,7 +8,6 @@ $(MSBuildThisFileDirectory)src\keys\Longbow.Utility.snk enable enable - true diff --git a/exclusion.dic b/exclusion.dic index eed31ac0c..fcb8fa230 100644 --- a/exclusion.dic +++ b/exclusion.dic @@ -80,3 +80,4 @@ Cascader Cascaders maui gantt +jquery diff --git a/src/BootstrapBlazor.Server/Components/App.razor b/src/BootstrapBlazor.Server/Components/App.razor index fc611c680..1f02a7641 100644 --- a/src/BootstrapBlazor.Server/Components/App.razor +++ b/src/BootstrapBlazor.Server/Components/App.razor @@ -1,4 +1,4 @@ -@inject IHostEnvironment Env +@inject IWebHostEnvironment Env @inject IStringLocalizer Localizer @@ -12,19 +12,19 @@ + - - - - - - - - @Localizer["Title"] + + + + + + + - + @Localizer["Title"] @@ -36,14 +36,14 @@ - + @if (Env.IsDevelopment()) { - + } @if (Env.IsProduction()) { - + } @if (Env.IsProduction()) diff --git a/src/BootstrapBlazor.Server/Components/Components/Header.razor.js b/src/BootstrapBlazor.Server/Components/Components/Header.razor.js index 766ba454f..75ecc64f2 100644 --- a/src/BootstrapBlazor.Server/Components/Components/Header.razor.js +++ b/src/BootstrapBlazor.Server/Components/Components/Header.razor.js @@ -1,5 +1,5 @@ -import { getPreferredTheme, setTheme } from "../../_content/BootstrapBlazor/modules/theme.js?v=$version" -import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js?v=$version" +import { getPreferredTheme, setTheme } from "../../_content/BootstrapBlazor/modules/theme.js" +import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" export function init() { const scrollTop = () => (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop diff --git a/src/BootstrapBlazor.Server/Components/Components/Pre.razor.js b/src/BootstrapBlazor.Server/Components/Components/Pre.razor.js index d7cf6ae69..96be73522 100644 --- a/src/BootstrapBlazor.Server/Components/Components/Pre.razor.js +++ b/src/BootstrapBlazor.Server/Components/Components/Pre.razor.js @@ -1,5 +1,5 @@ -import { copy, getDescribedElement, addLink, addScript, getHeight } from "../../_content/BootstrapBlazor/modules/utility.js?v=$version" -import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js?v=$version" +import { copy, getDescribedElement, addLink, addScript, getHeight } from "../../_content/BootstrapBlazor/modules/utility.js" +import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" export async function init(id, title) { const el = document.getElementById(id); diff --git a/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js b/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js index 4f5cb317c..36809694e 100644 --- a/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js +++ b/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js @@ -1,6 +1,6 @@ -import { insertAfter } from "../../_content/BootstrapBlazor/modules/utility.js?v=$version" -import Data from "../../_content/BootstrapBlazor/modules/data.js?v=$version" -import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js?v=$version" +import { insertAfter } from "../../_content/BootstrapBlazor/modules/utility.js" +import Data from "../../_content/BootstrapBlazor/modules/data.js" +import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor.Server/Components/Components/UpdateIntro.razor.js b/src/BootstrapBlazor.Server/Components/Components/UpdateIntro.razor.js index 1f0d841dd..ed2ec96cb 100644 --- a/src/BootstrapBlazor.Server/Components/Components/UpdateIntro.razor.js +++ b/src/BootstrapBlazor.Server/Components/Components/UpdateIntro.razor.js @@ -1,5 +1,5 @@ -import Data from "../../_content/BootstrapBlazor/modules/data.js?v=$version" -import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js?v=$version" +import Data from "../../_content/BootstrapBlazor/modules/data.js" +import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" export function init(id, version) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor.Server/Components/Layout/ComponentLayout.razor.cs b/src/BootstrapBlazor.Server/Components/Layout/ComponentLayout.razor.cs index e43b6e267..82bd281aa 100644 --- a/src/BootstrapBlazor.Server/Components/Layout/ComponentLayout.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Layout/ComponentLayout.razor.cs @@ -47,13 +47,6 @@ public partial class ComponentLayout : IAsyncDisposable /// private JSModule? Module { get; set; } - /// - /// 获得 IVersionService 服务实例 - /// - [Inject] - [NotNull] - private IVersionService? JSVersionService { get; set; } - [Inject] [NotNull] private IOptions? IconThemeOptions { get; set; } @@ -109,7 +102,7 @@ public partial class ComponentLayout : IAsyncDisposable { if (firstRender) { - Module = await JSRuntime.LoadModule("./Components/Layout/ComponentLayout.razor.js", JSVersionService.GetVersion()); + Module = await JSRuntime.LoadModule("./Components/Layout/ComponentLayout.razor.js"); } if (Module != null) { diff --git a/src/BootstrapBlazor.Server/Components/Layout/DockLayout.razor.cs b/src/BootstrapBlazor.Server/Components/Layout/DockLayout.razor.cs index 13a21056c..e0f93cbbb 100644 --- a/src/BootstrapBlazor.Server/Components/Layout/DockLayout.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Layout/DockLayout.razor.cs @@ -23,13 +23,6 @@ public partial class DockLayout : IAsyncDisposable [NotNull] private IJSRuntime? JSRuntime { get; set; } - /// - /// 获得 IVersionService 服务实例 - /// - [Inject] - [NotNull] - private IVersionService? JSVersionService { get; set; } - /// /// /// @@ -39,7 +32,7 @@ public partial class DockLayout : IAsyncDisposable { if (firstRender) { - Module = await JSRuntime.LoadModule("./Components/Layout/DockLayout.razor.js", JSVersionService.GetVersion()); + Module = await JSRuntime.LoadModule("./Components/Layout/DockLayout.razor.js"); await Module.InvokeVoidAsync("init"); } } diff --git a/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js b/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js index e88c9c4d8..854cefcec 100644 --- a/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js +++ b/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js @@ -1,6 +1,6 @@ -import Data from "../../_content/BootstrapBlazor/modules/data.js?v=$version" -import Drag from "../../_content/BootstrapBlazor/modules/drag.js?v=$version" -import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js?v=$version" +import Data from "../../_content/BootstrapBlazor/modules/data.js" +import Drag from "../../_content/BootstrapBlazor/modules/drag.js" +import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" export function init(id) { const navmenu = { diff --git a/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.cs b/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.cs index 45cf8c4ff..1a91cce51 100644 --- a/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.cs @@ -24,10 +24,6 @@ public partial class Chats [NotNull] private IBrowserFingerService? BrowserFingerService { get; set; } - [Inject] - [NotNull] - private IVersionService? VersionService { get; set; } - private string? Context { get; set; } private List Messages { get; } = []; @@ -129,7 +125,7 @@ public partial class Chats private async Task GetFingerCodeAsync() { var code = await BrowserFingerService.GetFingerCodeAsync(); - code ??= $"BootstrapBlazor{VersionService.GetVersion()}"; + code ??= "BootstrapBlazor"; return code; } diff --git a/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.js b/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.js index 752935d46..bf16b72fa 100644 --- a/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.js +++ b/src/BootstrapBlazor.Server/Components/Pages/Chats.razor.js @@ -1,4 +1,4 @@ -import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js?v=$version" +import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor.Server/Components/Pages/Index.razor.js b/src/BootstrapBlazor.Server/Components/Pages/Index.razor.js index 4d3085bab..4cd55e666 100644 --- a/src/BootstrapBlazor.Server/Components/Pages/Index.razor.js +++ b/src/BootstrapBlazor.Server/Components/Pages/Index.razor.js @@ -1,4 +1,4 @@ -import Data from '../../_content/BootstrapBlazor/modules/data.js?v=$version' +import Data from '../../_content/BootstrapBlazor/modules/data.js' export function init(id, text1, text2, text3) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Tutorials/DrawingApp.razor.js b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/DrawingApp.razor.js index d55e1b7ca..b0e4b5b07 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Tutorials/DrawingApp.razor.js +++ b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/DrawingApp.razor.js @@ -1,6 +1,6 @@ -import Data from '../../../_content/BootstrapBlazor/modules/data.js?v=$version' -import EventHandler from "../../../_content/BootstrapBlazor/modules/event-handler.js?v=$version" -import { isMobile } from "../../../_content/BootstrapBlazor/modules/utility.js?v=$version" +import Data from '../../../_content/BootstrapBlazor/modules/data.js' +import EventHandler from "../../../_content/BootstrapBlazor/modules/event-handler.js" +import { isMobile } from "../../../_content/BootstrapBlazor/modules/utility.js" /** * 缓存绘图步骤 diff --git a/src/BootstrapBlazor.Server/Directory.Build.targets b/src/BootstrapBlazor.Server/Directory.Build.targets index cd3b952db..990e21d75 100644 --- a/src/BootstrapBlazor.Server/Directory.Build.targets +++ b/src/BootstrapBlazor.Server/Directory.Build.targets @@ -1,6 +1,6 @@ - + diff --git a/src/BootstrapBlazor.Server/Extensions/ServicesExtensions.cs b/src/BootstrapBlazor.Server/Extensions/ServicesExtensions.cs index 1a85a9ad8..2d1cfad02 100644 --- a/src/BootstrapBlazor.Server/Extensions/ServicesExtensions.cs +++ b/src/BootstrapBlazor.Server/Extensions/ServicesExtensions.cs @@ -44,8 +44,9 @@ internal static class ServicesExtensions // 增加多语言支持配置信息 services.AddRequestLocalization>((localizerOption, blazorOption) => { - blazorOption.OnChange(op => Invoke(op)); + blazorOption.OnChange(Invoke); Invoke(blazorOption.CurrentValue); + return; void Invoke(BootstrapBlazorOptions option) { diff --git a/src/BootstrapBlazor.Server/Extensions/CacheExtensions.cs b/src/BootstrapBlazor.Server/Extensions/StaticFileResponseContextExtensions.cs similarity index 59% rename from src/BootstrapBlazor.Server/Extensions/CacheExtensions.cs rename to src/BootstrapBlazor.Server/Extensions/StaticFileResponseContextExtensions.cs index 4efb600f0..887b0d00c 100644 --- a/src/BootstrapBlazor.Server/Extensions/CacheExtensions.cs +++ b/src/BootstrapBlazor.Server/Extensions/StaticFileResponseContextExtensions.cs @@ -3,15 +3,11 @@ // Website: https://www.blazor.zone or https://argozhang.github.io/ using Microsoft.AspNetCore.StaticFiles; -using Microsoft.AspNetCore.WebUtilities; using Microsoft.Net.Http.Headers; namespace BootstrapBlazor.Server.Extensions; -/// -/// -/// -internal static class CacheExtensions +internal static class StaticFileResponseContextExtensions { public static void ProcessCache(this StaticFileResponseContext context, IConfiguration configuration) { @@ -26,8 +22,8 @@ internal static class CacheExtensions var ret = false; age = 0; - var files = configuration.GetFiles(); - if (files.Any(i => context.CanCache(i))) + var fileTypes = configuration.GetFileTypes(); + if (fileTypes.Any(context.CanCache)) { ret = true; age = configuration.GetAge(); @@ -35,30 +31,19 @@ internal static class CacheExtensions return ret; } - private static bool CanCache(this StaticFileResponseContext context, string file) + private static bool CanCache(this StaticFileResponseContext context, string fileType) { var ext = Path.GetExtension(context.File.PhysicalPath) ?? ""; - bool ret = file.Equals(ext, StringComparison.OrdinalIgnoreCase); - if (ret && ext.Equals(".js", StringComparison.OrdinalIgnoreCase)) - { - // process javascript file - ret = false; - if (context.Context.Request.QueryString.HasValue) - { - var paras = QueryHelpers.ParseQuery(context.Context.Request.QueryString.Value); - ret = paras.ContainsKey("v"); - } - } - return ret; + return fileType.Equals(ext, StringComparison.OrdinalIgnoreCase); } - private static List? _files; - private static List GetFiles(this IConfiguration configuration) + private static List? _fileTypes; + private static List GetFileTypes(this IConfiguration configuration) { - _files ??= GetFiles(); - return _files; + _fileTypes ??= GetFilesFromConfiguration(); + return _fileTypes; - List GetFiles() + List GetFilesFromConfiguration() { var cacheSection = configuration.GetSection("Cache-Control"); return cacheSection.GetSection("Files").Get>() ?? []; @@ -68,13 +53,13 @@ internal static class CacheExtensions private static int? _age; private static int GetAge(this IConfiguration configuration) { - _age ??= GetAge(); + _age ??= GetAgeFromConfiguration(); return _age.Value; - int GetAge() + int GetAgeFromConfiguration() { var cacheSection = configuration.GetSection("Cache-Control"); - return cacheSection.GetValue("Max-Age", 1000 * 60 * 10); + return cacheSection.GetValue("Max-Age", 1000 * 60 * 10); } } } diff --git a/src/BootstrapBlazor.Server/Program.cs b/src/BootstrapBlazor.Server/Program.cs index b2de451a7..0850737ea 100644 --- a/src/BootstrapBlazor.Server/Program.cs +++ b/src/BootstrapBlazor.Server/Program.cs @@ -21,7 +21,14 @@ builder.Services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All)); builder.Services.AddLogging(logBuilder => logBuilder.AddFileLogger()); builder.Services.AddCors(); -builder.Services.AddResponseCompression(); + +#if DEBUG +#else + builder.Services.AddResponseCompression(options => + { + options.EnableForHttps = true; + }); +#endif builder.Services.AddControllers(); builder.Services.AddRazorComponents().AddInteractiveServerComponents(); @@ -48,14 +55,19 @@ if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); app.UseResponseCompression(); - app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = ctx => ctx.ProcessCache(app.Configuration) }); } +app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = ctx => ctx.ProcessCache(app.Configuration) }); -var provider = new FileExtensionContentTypeProvider(); -provider.Mappings[".properties"] = "application/octet-stream"; -provider.Mappings[".moc"] = "application/x-msdownload"; -provider.Mappings[".moc3"] = "application/x-msdownload"; -provider.Mappings[".mtn"] = "application/x-msdownload"; +var provider = new FileExtensionContentTypeProvider +{ + Mappings = + { + [".properties"] = "application/octet-stream", + [".moc"] = "application/x-msdownload", + [".moc3"] = "application/x-msdownload", + [".mtn"] = "application/x-msdownload" + } +}; app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider }); app.UseStaticFiles(); @@ -63,7 +75,7 @@ app.UseStaticFiles(); var cors = app.Configuration["AllowOrigins"]?.Split(',', StringSplitOptions.RemoveEmptyEntries); if (cors?.Length > 0) { - app.UseCors(builder => builder.WithOrigins() + app.UseCors(options => options.WithOrigins() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials()); diff --git a/src/BootstrapBlazor.Server/wwwroot/css/site.css b/src/BootstrapBlazor.Server/wwwroot/css/site.css index 08fc3d46f..55275794d 100644 --- a/src/BootstrapBlazor.Server/wwwroot/css/site.css +++ b/src/BootstrapBlazor.Server/wwwroot/css/site.css @@ -226,7 +226,7 @@ code { top: .65rem; right: 1.5rem; font-size: 65%; - transition: opacity .3s linear; + transition: opacity .3s linear; } .btn-code:not(:hover) { diff --git a/src/BootstrapBlazor.Server/wwwroot/lib/theme.js b/src/BootstrapBlazor.Server/wwwroot/lib/theme.js index 9c1fd8a8a..a49a799de 100644 --- a/src/BootstrapBlazor.Server/wwwroot/lib/theme.js +++ b/src/BootstrapBlazor.Server/wwwroot/lib/theme.js @@ -1,3 +1,3 @@ -import { getPreferredTheme, setTheme } from "../../_content/BootstrapBlazor/modules/theme.js?v=$version" +import { getPreferredTheme, setTheme } from "../../_content/BootstrapBlazor/modules/theme.js" setTheme(getPreferredTheme()) diff --git a/src/BootstrapBlazor/Components/Anchor/Anchor.razor.js b/src/BootstrapBlazor/Components/Anchor/Anchor.razor.js index 994231b53..a3038a473 100644 --- a/src/BootstrapBlazor/Components/Anchor/Anchor.razor.js +++ b/src/BootstrapBlazor/Components/Anchor/Anchor.razor.js @@ -1,5 +1,5 @@ -import { getDescribedElement, getOverflowParent } from "../../modules/utility.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { getDescribedElement, getOverflowParent } from "../../modules/utility.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/AnchorLink/AnchorLink.razor.js b/src/BootstrapBlazor/Components/AnchorLink/AnchorLink.razor.js index 8b4998879..5b97c3054 100644 --- a/src/BootstrapBlazor/Components/AnchorLink/AnchorLink.razor.js +++ b/src/BootstrapBlazor/Components/AnchorLink/AnchorLink.razor.js @@ -1,6 +1,6 @@ -import { copy } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { copy } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js index 498902683..228ea78c6 100644 --- a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js +++ b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js @@ -1,9 +1,9 @@ -import { debounce, getHeight } from "../../modules/utility.js?v=$version" -import { handleKeyUp, select, selectAllByFocus, selectAllByEnter } from "../Input/BootstrapInput.razor.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" -import Input from "../../modules/input.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import { debounce, getHeight } from "../../modules/utility.js" +import { handleKeyUp, select, selectAllByFocus, selectAllByEnter } from "../Input/BootstrapInput.razor.js" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" +import Input from "../../modules/input.js" +import Popover from "../../modules/base-popover.js" export function init(id, invoke) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs b/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs index 95186ab72..4597393bd 100644 --- a/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs +++ b/src/BootstrapBlazor/Components/BaseComponents/BootstrapModuleComponentBase.cs @@ -36,13 +36,6 @@ public abstract class BootstrapModuleComponentBase : IdComponentBase, IAsyncDisp /// protected DotNetObjectReference? Interop { get; set; } - /// - /// 获得 IVersionService 服务实例 - /// - [Inject] - [NotNull] - protected IVersionService? JSVersionService { get; set; } - /// /// /// @@ -61,7 +54,7 @@ public abstract class BootstrapModuleComponentBase : IdComponentBase, IAsyncDisp { if (firstRender && !string.IsNullOrEmpty(ModulePath)) { - Module ??= await JSRuntime.LoadModule(ModulePath, JSVersionService.GetVersion()); + Module ??= await JSRuntime.LoadModule(ModulePath); if (AutoInvokeInit) { diff --git a/src/BootstrapBlazor/Components/Button/Button.razor.js b/src/BootstrapBlazor/Components/Button/Button.razor.js index eb5872f6d..cc4a1bc03 100644 --- a/src/BootstrapBlazor/Components/Button/Button.razor.js +++ b/src/BootstrapBlazor/Components/Button/Button.razor.js @@ -1,4 +1,4 @@ -import Data from "../../modules/data.js?v=$version" +import Data from "../../modules/data.js" const showTooltip = (id, title) => { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Button/DialButton.razor.js b/src/BootstrapBlazor/Components/Button/DialButton.razor.js index a34c1e712..4dc25cf65 100644 --- a/src/BootstrapBlazor/Components/Button/DialButton.razor.js +++ b/src/BootstrapBlazor/Components/Button/DialButton.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.js b/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.js index cea9cb24c..b76877541 100644 --- a/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.js +++ b/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.js @@ -1,7 +1,7 @@ -import { getDescribedElement, getDescribedOwner, hackPopover, isDisabled } from "../../modules/utility.js?v=$version" -import { showTooltip, removeTooltip } from "./Button.razor.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { getDescribedElement, getDescribedOwner, hackPopover, isDisabled } from "../../modules/utility.js" +import { showTooltip, removeTooltip } from "./Button.razor.js" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" const config = { class: 'popover-confirm', diff --git a/src/BootstrapBlazor/Components/Button/SlideButton.razor.js b/src/BootstrapBlazor/Components/Button/SlideButton.razor.js index 4ddb61c45..9e8594a19 100644 --- a/src/BootstrapBlazor/Components/Button/SlideButton.razor.js +++ b/src/BootstrapBlazor/Components/Button/SlideButton.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Camera/Camera.razor.js b/src/BootstrapBlazor/Components/Camera/Camera.razor.js index 9230c4f93..37e3562ca 100644 --- a/src/BootstrapBlazor/Components/Camera/Camera.razor.js +++ b/src/BootstrapBlazor/Components/Camera/Camera.razor.js @@ -1,4 +1,4 @@ -import Data from "../../modules/data.js?v=$version" +import Data from "../../modules/data.js" const openDevice = camera => { if(camera.video) { diff --git a/src/BootstrapBlazor/Components/Captcha/Captcha.razor.js b/src/BootstrapBlazor/Components/Captcha/Captcha.razor.js index f562a76b7..5f4840f3f 100644 --- a/src/BootstrapBlazor/Components/Captcha/Captcha.razor.js +++ b/src/BootstrapBlazor/Components/Captcha/Captcha.razor.js @@ -1,6 +1,6 @@ -import Data from "../../modules/data.js?v=$version" -import Drag from "../../modules/drag.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import Drag from "../../modules/drag.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback, option) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Card/Card.razor.js b/src/BootstrapBlazor/Components/Card/Card.razor.js index 86826134a..c2b7f9fe5 100644 --- a/src/BootstrapBlazor/Components/Card/Card.razor.js +++ b/src/BootstrapBlazor/Components/Card/Card.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Carousel/Carousel.razor.js b/src/BootstrapBlazor/Components/Carousel/Carousel.razor.js index 819a371e9..453beddb6 100644 --- a/src/BootstrapBlazor/Components/Carousel/Carousel.razor.js +++ b/src/BootstrapBlazor/Components/Carousel/Carousel.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, options) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/ClockPicker/ClockPicker.razor.js b/src/BootstrapBlazor/Components/ClockPicker/ClockPicker.razor.js index da50c1168..1ae647c80 100644 --- a/src/BootstrapBlazor/Components/ClockPicker/ClockPicker.razor.js +++ b/src/BootstrapBlazor/Components/ClockPicker/ClockPicker.razor.js @@ -1,6 +1,6 @@ -import Data from "../../modules/data.js?v=$version" -import Drag from "../../modules/drag.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import Drag from "../../modules/drag.js" +import EventHandler from "../../modules/event-handler.js" const setValue = (picker, point, value) => { const { el, val } = picker; diff --git a/src/BootstrapBlazor/Components/Console/Console.razor.js b/src/BootstrapBlazor/Components/Console/Console.razor.js index 1817edb94..5382db71c 100644 --- a/src/BootstrapBlazor/Components/Console/Console.razor.js +++ b/src/BootstrapBlazor/Components/Console/Console.razor.js @@ -1,5 +1,5 @@ -import { getHeight } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" +import { getHeight } from "../../modules/utility.js" +import Data from "../../modules/data.js" export function init(id) { const con = { diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.js b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.js index e199d699e..c40b88d10 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.js +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.js @@ -1,6 +1,6 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" -import { createPopper, computePosition } from '../../modules/floating-ui.js?v=$version' +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" +import { createPopper, computePosition } from '../../modules/floating-ui.js' export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/CountUp/CountUp.razor.js b/src/BootstrapBlazor/Components/CountUp/CountUp.razor.js index 1c880bd2b..abb76f30b 100644 --- a/src/BootstrapBlazor/Components/CountUp/CountUp.razor.js +++ b/src/BootstrapBlazor/Components/CountUp/CountUp.razor.js @@ -1,5 +1,5 @@ -import { CountUp } from "../../lib/countUp/countUp.min.js?v=$version" -import Data from "../../modules/data.js?v=$version" +import { CountUp } from "../../lib/countUp/countUp.min.js" +import Data from "../../modules/data.js" export function init(id, invoke, val, callback, option) { option = option || {} diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.js b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.js index 92a2e832f..d45c4fd26 100644 --- a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.js +++ b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.js @@ -1,6 +1,6 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" +import Popover from "../../modules/base-popover.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Dialog/IconDialog.razor.js b/src/BootstrapBlazor/Components/Dialog/IconDialog.razor.js index 15e796e54..330674c51 100644 --- a/src/BootstrapBlazor/Components/Dialog/IconDialog.razor.js +++ b/src/BootstrapBlazor/Components/Dialog/IconDialog.razor.js @@ -1,6 +1,6 @@ -import { copy } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { copy } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Drawer/Drawer.razor.js b/src/BootstrapBlazor/Components/Drawer/Drawer.razor.js index 13daf3759..7984b9c62 100644 --- a/src/BootstrapBlazor/Components/Drawer/Drawer.razor.js +++ b/src/BootstrapBlazor/Components/Drawer/Drawer.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import Drag from "../../modules/drag.js?v=$version" +import Data from "../../modules/data.js" +import Drag from "../../modules/drag.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Dropdown/Dropdown.razor.js b/src/BootstrapBlazor/Components/Dropdown/Dropdown.razor.js index 3cd8382b8..764a79b4c 100644 --- a/src/BootstrapBlazor/Components/Dropdown/Dropdown.razor.js +++ b/src/BootstrapBlazor/Components/Dropdown/Dropdown.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import Data from "../../modules/data.js" +import Popover from "../../modules/base-popover.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Filters/TableFilter.razor.js b/src/BootstrapBlazor/Components/Filters/TableFilter.razor.js index 784cbf602..2a3a675d1 100644 --- a/src/BootstrapBlazor/Components/Filters/TableFilter.razor.js +++ b/src/BootstrapBlazor/Components/Filters/TableFilter.razor.js @@ -1,6 +1,6 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" +import Popover from "../../modules/base-popover.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/FlipClock/FlipClock.razor.js b/src/BootstrapBlazor/Components/FlipClock/FlipClock.razor.js index d00a91c4b..32ed2bbd0 100644 --- a/src/BootstrapBlazor/Components/FlipClock/FlipClock.razor.js +++ b/src/BootstrapBlazor/Components/FlipClock/FlipClock.razor.js @@ -1,4 +1,4 @@ -import Data from "../../modules/data.js?v=$version" +import Data from "../../modules/data.js" export function init(id, options) { options = { diff --git a/src/BootstrapBlazor/Components/GoTop/GoTop.razor.js b/src/BootstrapBlazor/Components/GoTop/GoTop.razor.js index b730eb624..8bb385fda 100644 --- a/src/BootstrapBlazor/Components/GoTop/GoTop.razor.js +++ b/src/BootstrapBlazor/Components/GoTop/GoTop.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" const getScrollElement = el => { let ele = el diff --git a/src/BootstrapBlazor/Components/Handwritten/Handwritten.razor.js b/src/BootstrapBlazor/Components/Handwritten/Handwritten.razor.js index ee72a813f..c47836da0 100644 --- a/src/BootstrapBlazor/Components/Handwritten/Handwritten.razor.js +++ b/src/BootstrapBlazor/Components/Handwritten/Handwritten.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback) { //当页面高度超过设备可见高度时,阻止掉touchmove事件。 diff --git a/src/BootstrapBlazor/Components/IFrame/IFrame.razor.js b/src/BootstrapBlazor/Components/IFrame/IFrame.razor.js index 3df4b7a3b..ce9355a0a 100644 --- a/src/BootstrapBlazor/Components/IFrame/IFrame.razor.js +++ b/src/BootstrapBlazor/Components/IFrame/IFrame.razor.js @@ -1,4 +1,4 @@ -import Data from "../../modules/data.js?v=$version" +import Data from "../../modules/data.js" export function init(id, invoke, callback) { const handler = e => { diff --git a/src/BootstrapBlazor/Components/ImagePreviewer/ImagePreviewer.razor.js b/src/BootstrapBlazor/Components/ImagePreviewer/ImagePreviewer.razor.js index 07f0266ee..47db46efb 100644 --- a/src/BootstrapBlazor/Components/ImagePreviewer/ImagePreviewer.razor.js +++ b/src/BootstrapBlazor/Components/ImagePreviewer/ImagePreviewer.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import Viewer from "../../modules/viewer.js?v=$version" +import Data from "../../modules/data.js" +import Viewer from "../../modules/viewer.js" export function init(id, prevList) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/ImageViewer/ImageViewer.razor.js b/src/BootstrapBlazor/Components/ImageViewer/ImageViewer.razor.js index b84dfd4e0..5b1c14da4 100644 --- a/src/BootstrapBlazor/Components/ImageViewer/ImageViewer.razor.js +++ b/src/BootstrapBlazor/Components/ImageViewer/ImageViewer.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" const setListeners = (viewer, index) => { if (viewer.prevList && viewer.prevList.length > 0) { diff --git a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js index 2fab5194f..961f4f67d 100644 --- a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js +++ b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js @@ -1,4 +1,4 @@ -import EventHandler from "../../modules/event-handler.js?v=$version" +import EventHandler from "../../modules/event-handler.js" export function clear(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.js b/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.js index 7e89f0b7b..c24cfa78e 100644 --- a/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.js +++ b/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" const selectCell = (el, index) => { if (index === -1) { diff --git a/src/BootstrapBlazor/Components/Layout/Layout.razor.js b/src/BootstrapBlazor/Components/Layout/Layout.razor.js index 9c84f0cf4..a2b12dca0 100644 --- a/src/BootstrapBlazor/Components/Layout/Layout.razor.js +++ b/src/BootstrapBlazor/Components/Layout/Layout.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback) { const layout = { diff --git a/src/BootstrapBlazor/Components/Menu/Menu.razor.js b/src/BootstrapBlazor/Components/Menu/Menu.razor.js index 15fa89f58..1f6c3ff58 100644 --- a/src/BootstrapBlazor/Components/Menu/Menu.razor.js +++ b/src/BootstrapBlazor/Components/Menu/Menu.razor.js @@ -1,5 +1,5 @@ -import { getTargetElement, getTransitionDelayDurationFromElement } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" +import { getTargetElement, getTransitionDelayDurationFromElement } from "../../modules/utility.js" +import Data from "../../modules/data.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Message/Message.razor.js b/src/BootstrapBlazor/Components/Message/Message.razor.js index a56ce2a39..051ee869c 100644 --- a/src/BootstrapBlazor/Components/Message/Message.razor.js +++ b/src/BootstrapBlazor/Components/Message/Message.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Modal/Modal.razor.js b/src/BootstrapBlazor/Components/Modal/Modal.razor.js index 1750e447a..93f686aff 100644 --- a/src/BootstrapBlazor/Components/Modal/Modal.razor.js +++ b/src/BootstrapBlazor/Components/Modal/Modal.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, shownCallback, closeCallback) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js index 1f3e7aeb1..0789c8898 100644 --- a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js +++ b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js @@ -1,6 +1,6 @@ -import { drag } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { drag } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Print/PrintButton.razor.js b/src/BootstrapBlazor/Components/Print/PrintButton.razor.js index ecd2667c5..111e29779 100644 --- a/src/BootstrapBlazor/Components/Print/PrintButton.razor.js +++ b/src/BootstrapBlazor/Components/Print/PrintButton.razor.js @@ -1,7 +1,7 @@ -import { getUID } from "../../modules/utility.js?v=$version" -import { showTooltip, removeTooltip } from "../Button/Button.razor.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { getUID } from "../../modules/utility.js" +import { showTooltip, removeTooltip } from "../Button/Button.razor.js" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/RibbonTab/RibbonTab.razor.js b/src/BootstrapBlazor/Components/RibbonTab/RibbonTab.razor.js index ffe6a6e91..22e351d9a 100644 --- a/src/BootstrapBlazor/Components/RibbonTab/RibbonTab.razor.js +++ b/src/BootstrapBlazor/Components/RibbonTab/RibbonTab.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Segmented/Segmented.razor.js b/src/BootstrapBlazor/Components/Segmented/Segmented.razor.js index ce45ff20f..7361c0fe6 100644 --- a/src/BootstrapBlazor/Components/Segmented/Segmented.razor.js +++ b/src/BootstrapBlazor/Components/Segmented/Segmented.razor.js @@ -1,5 +1,5 @@ -import Data from '../../modules/data.js?v=$version' -import EventHandler from '../../modules/event-handler.js?v=$version' +import Data from '../../modules/data.js' +import EventHandler from '../../modules/event-handler.js' export function init(id, invoke) { const el = document.getElementById(id); diff --git a/src/BootstrapBlazor/Components/Select/MultiSelect.razor.js b/src/BootstrapBlazor/Components/Select/MultiSelect.razor.js index a0f8879b4..83c7e9600 100644 --- a/src/BootstrapBlazor/Components/Select/MultiSelect.razor.js +++ b/src/BootstrapBlazor/Components/Select/MultiSelect.razor.js @@ -1,7 +1,7 @@ -import { isDisabled } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { isDisabled } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import Popover from "../../modules/base-popover.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, method) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.js b/src/BootstrapBlazor/Components/Select/Select.razor.js index aaec5940a..b610a8b18 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor.js +++ b/src/BootstrapBlazor/Components/Select/Select.razor.js @@ -1,7 +1,7 @@ -import { getHeight, getInnerHeight } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import { getHeight, getInnerHeight } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" +import Popover from "../../modules/base-popover.js" export function init(id, invoke, method) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Select/SelectObject.razor.js b/src/BootstrapBlazor/Components/Select/SelectObject.razor.js index 128ca5125..7491bda5f 100644 --- a/src/BootstrapBlazor/Components/Select/SelectObject.razor.js +++ b/src/BootstrapBlazor/Components/Select/SelectObject.razor.js @@ -1,6 +1,6 @@ -import { getWidth } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import { getWidth } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import Popover from "../../modules/base-popover.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Select/SelectTable.razor.js b/src/BootstrapBlazor/Components/Select/SelectTable.razor.js index af1d832ab..660184853 100644 --- a/src/BootstrapBlazor/Components/Select/SelectTable.razor.js +++ b/src/BootstrapBlazor/Components/Select/SelectTable.razor.js @@ -1,6 +1,6 @@ -import { getWidth } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import { getWidth } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import Popover from "../../modules/base-popover.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Select/SelectTree.razor.js b/src/BootstrapBlazor/Components/Select/SelectTree.razor.js index 10a405273..9a1c90a96 100644 --- a/src/BootstrapBlazor/Components/Select/SelectTree.razor.js +++ b/src/BootstrapBlazor/Components/Select/SelectTree.razor.js @@ -1,6 +1,6 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" -import Popover from "../../modules/base-popover.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" +import Popover from "../../modules/base-popover.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Split/Split.razor.js b/src/BootstrapBlazor/Components/Split/Split.razor.js index f5a36e0fb..7efe935ba 100644 --- a/src/BootstrapBlazor/Components/Split/Split.razor.js +++ b/src/BootstrapBlazor/Components/Split/Split.razor.js @@ -1,7 +1,7 @@ -import { getHeight, getInnerHeight } from "../../modules/utility.js?v=$version" -import Data from "../../modules/data.js?v=$version" -import Drag from "../../modules/drag.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import { getHeight, getInnerHeight } from "../../modules/utility.js" +import Data from "../../modules/data.js" +import Drag from "../../modules/drag.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.js b/src/BootstrapBlazor/Components/Tab/Tab.razor.js index be599357d..9c4fb6c72 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.js +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" const getPosition = el => { return el.getBoundingClientRect(); diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.js b/src/BootstrapBlazor/Components/Table/Table.razor.js index 0d28251cf..f8603cccd 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.js +++ b/src/BootstrapBlazor/Components/Table/Table.razor.js @@ -1,9 +1,9 @@ -export { getResponsive } from '../../modules/responsive.js?v=$version' -import { copy, drag, getDescribedElement, getOuterHeight, getWidth, isVisible } from '../../modules/utility.js?v=$version' -import '../../modules/browser.js?v=$version' -import Data from '../../modules/data.js?v=$version' -import EventHandler from '../../modules/event-handler.js?v=$version' -import Popover from "../../modules/base-popover.js?v=$version" +export { getResponsive } from '../../modules/responsive.js' +import { copy, drag, getDescribedElement, getOuterHeight, getWidth, isVisible } from '../../modules/utility.js' +import '../../modules/browser.js' +import Data from '../../modules/data.js' +import EventHandler from '../../modules/event-handler.js' +import Popover from "../../modules/base-popover.js" const setBodyHeight = table => { const el = table.el diff --git a/src/BootstrapBlazor/Components/Textarea/Textarea.razor.js b/src/BootstrapBlazor/Components/Textarea/Textarea.razor.js index 86e0492d1..d04b33a33 100644 --- a/src/BootstrapBlazor/Components/Textarea/Textarea.razor.js +++ b/src/BootstrapBlazor/Components/Textarea/Textarea.razor.js @@ -1,4 +1,4 @@ -import Data from "../../modules/data.js?v=$version" +import Data from "../../modules/data.js" export function init(id) { const text = { diff --git a/src/BootstrapBlazor/Components/TimePicker/TimePickerCell.razor.js b/src/BootstrapBlazor/Components/TimePicker/TimePickerCell.razor.js index 9e344bf83..4451f29a1 100644 --- a/src/BootstrapBlazor/Components/TimePicker/TimePickerCell.razor.js +++ b/src/BootstrapBlazor/Components/TimePicker/TimePickerCell.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Toast/Toast.razor.js b/src/BootstrapBlazor/Components/Toast/Toast.razor.js index cf4d3be10..3bbe14cf3 100644 --- a/src/BootstrapBlazor/Components/Toast/Toast.razor.js +++ b/src/BootstrapBlazor/Components/Toast/Toast.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.js b/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.js index 9c35fad02..5565e990f 100644 --- a/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.js +++ b/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.js @@ -1,4 +1,4 @@ -import Data from "../../modules/data.js?v=$version" +import Data from "../../modules/data.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Transition/Transition.razor.js b/src/BootstrapBlazor/Components/Transition/Transition.razor.js index ffb9cab53..e316e3bf3 100644 --- a/src/BootstrapBlazor/Components/Transition/Transition.razor.js +++ b/src/BootstrapBlazor/Components/Transition/Transition.razor.js @@ -1,4 +1,4 @@ -import EventHandler from "../../modules/event-handler.js?v=$version" +import EventHandler from "../../modules/event-handler.js" export function init(id, invoke, callback) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/TreeView/TreeView.razor.js b/src/BootstrapBlazor/Components/TreeView/TreeView.razor.js index bc739f4db..c51ca4c53 100644 --- a/src/BootstrapBlazor/Components/TreeView/TreeView.razor.js +++ b/src/BootstrapBlazor/Components/TreeView/TreeView.razor.js @@ -1,5 +1,5 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Validate/ValidateBase.cs b/src/BootstrapBlazor/Components/Validate/ValidateBase.cs index 8c0e583be..5e12e0d7d 100644 --- a/src/BootstrapBlazor/Components/Validate/ValidateBase.cs +++ b/src/BootstrapBlazor/Components/Validate/ValidateBase.cs @@ -434,7 +434,7 @@ public abstract class ValidateBase : DisplayBase, IValidateCompo private JSModule? ValidateModule { get; set; } - private Task LoadValidateModule() => JSRuntime.LoadModule("./_content/BootstrapBlazor/modules/validate.js", JSVersionService.GetVersion()); + private Task LoadValidateModule() => JSRuntime.LoadModule("./_content/BootstrapBlazor/modules/validate.js"); /// /// 增加客户端 Tooltip 方法 diff --git a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.js b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.js index 2b1f8a78d..0f9c0d5d7 100644 --- a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.js +++ b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.js @@ -1,4 +1,4 @@ -import EventHandler from "../../modules/event-handler.js?v=$version" +import EventHandler from "../../modules/event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/Components/Waterfall/Waterfall.razor.js b/src/BootstrapBlazor/Components/Waterfall/Waterfall.razor.js index 4ea9b358d..a1820512a 100644 --- a/src/BootstrapBlazor/Components/Waterfall/Waterfall.razor.js +++ b/src/BootstrapBlazor/Components/Waterfall/Waterfall.razor.js @@ -1,6 +1,6 @@ -import Data from "../../modules/data.js?v=$version" -import EventHandler from "../../modules/event-handler.js?v=$version" -import { debounce } from "../../modules/utility.js?v=$version" +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" +import { debounce } from "../../modules/utility.js" const cal = (el, imgWidth) => { const containerWidth = el.offsetWidth; diff --git a/src/BootstrapBlazor/Directory.Build.props b/src/BootstrapBlazor/Directory.Build.props index c85d4ee00..11fd3325e 100644 --- a/src/BootstrapBlazor/Directory.Build.props +++ b/src/BootstrapBlazor/Directory.Build.props @@ -5,7 +5,7 @@ - + Bootstrap Blazor WebAssembly wasm UI Components diff --git a/src/BootstrapBlazor/Services/DefaultGeoLocationService.cs b/src/BootstrapBlazor/Services/DefaultGeoLocationService.cs index ace20b3fc..bd2233c24 100644 --- a/src/BootstrapBlazor/Services/DefaultGeoLocationService.cs +++ b/src/BootstrapBlazor/Services/DefaultGeoLocationService.cs @@ -16,22 +16,18 @@ class DefaultGeoLocationService : IGeoLocationService private long WatchId { get; set; } - private IVersionService JSVersionService { get; } - /// /// 构造函数 /// /// - /// - public DefaultGeoLocationService(IJSRuntime jsRuntime, IVersionService versionService) + public DefaultGeoLocationService(IJSRuntime jsRuntime) { JSRuntime = jsRuntime; - JSVersionService = versionService; Interop = DotNetObjectReference.Create(this); } - private Task LoadModule() => JSRuntime.LoadModule("./_content/BootstrapBlazor/modules/geo.js", JSVersionService.GetVersion()); + private Task LoadModule() => JSRuntime.LoadModule("./_content/BootstrapBlazor/modules/geo.js"); /// /// get the current position of the device diff --git a/src/BootstrapBlazor/Services/NotificationService.cs b/src/BootstrapBlazor/Services/NotificationService.cs index c3715a988..e485765b3 100644 --- a/src/BootstrapBlazor/Services/NotificationService.cs +++ b/src/BootstrapBlazor/Services/NotificationService.cs @@ -19,23 +19,19 @@ public class NotificationService : IAsyncDisposable private ICacheManager Cache { get; } - private IVersionService JSVersionService { get; } - /// /// 构造函数 /// /// /// - /// - public NotificationService(IJSRuntime runtime, ICacheManager cache, IVersionService versionService) + public NotificationService(IJSRuntime runtime, ICacheManager cache) { JSRuntime = runtime; Cache = cache; - JSVersionService = versionService; Interop = DotNetObjectReference.Create(this); } - private Task LoadModule() => JSRuntime.LoadModule("./_content/BootstrapBlazor/modules/noti.js", JSVersionService.GetVersion()); + private Task LoadModule() => JSRuntime.LoadModule("./_content/BootstrapBlazor/modules/noti.js"); /// /// 检查浏览器通知权限状态 diff --git a/src/BootstrapBlazor/Services/WebClientService.cs b/src/BootstrapBlazor/Services/WebClientService.cs index 0eae457a0..55dbd088a 100644 --- a/src/BootstrapBlazor/Services/WebClientService.cs +++ b/src/BootstrapBlazor/Services/WebClientService.cs @@ -12,12 +12,10 @@ namespace BootstrapBlazor.Components; /// /// /// -/// /// public class WebClientService( IJSRuntime runtime, NavigationManager navigation, - IVersionService versionService, ILogger logger) : IAsyncDisposable { /// @@ -42,7 +40,7 @@ public class WebClientService( { RequestUrl = navigation.Uri }; - _jsModule ??= await runtime.LoadModule("./_content/BootstrapBlazor/modules/client.js", versionService.GetVersion()); + _jsModule ??= await runtime.LoadModule("./_content/BootstrapBlazor/modules/client.js"); _interop ??= DotNetObjectReference.Create(this); await _jsModule.InvokeVoidAsync("ping", "ip.axd", _interop, nameof(SetData)); diff --git a/src/BootstrapBlazor/Utils/Utility.cs b/src/BootstrapBlazor/Utils/Utility.cs index 9b8495293..ec962b600 100644 --- a/src/BootstrapBlazor/Utils/Utility.cs +++ b/src/BootstrapBlazor/Utils/Utility.cs @@ -596,7 +596,7 @@ public static class Utility /// 通过指定类型生成组件类型 /// /// - /// 是否为 Textarea 组件 + /// 是否为 TextArea 组件 /// /// private static Type GenerateComponentType(Type fieldType, bool hasRows, IEnumerable? lookup) diff --git a/src/BootstrapBlazor/wwwroot/modules/autoredirect.js b/src/BootstrapBlazor/wwwroot/modules/autoredirect.js index cc7fcfa01..a95dec23b 100644 --- a/src/BootstrapBlazor/wwwroot/modules/autoredirect.js +++ b/src/BootstrapBlazor/wwwroot/modules/autoredirect.js @@ -1,5 +1,5 @@ -import Data from "./data.js?v=$version" -import EventHandler from "./event-handler.js?v=$version" +import Data from "./data.js" +import EventHandler from "./event-handler.js" export function init(id, invoke, interval, callback) { const m = { invoke, interval, callback, mousePosition: {}, count: 1000 } @@ -35,7 +35,7 @@ export function dispose(id) { const m = Data.get(id) Data.remove(id) - if(m) { + if (m) { EventHandler.off(document, 'mousemove', m.fnMouseHandler) EventHandler.off(document, 'keydown', m.fnKeyHandler) diff --git a/src/BootstrapBlazor/wwwroot/modules/base-popover.js b/src/BootstrapBlazor/wwwroot/modules/base-popover.js index 0d3a47baa..349cecbc0 100644 --- a/src/BootstrapBlazor/wwwroot/modules/base-popover.js +++ b/src/BootstrapBlazor/wwwroot/modules/base-popover.js @@ -1,5 +1,5 @@ -import { getDescribedElement, getDescribedOwner, hackPopover, isDisabled } from "./utility.js?v=$version" -import EventHandler from "./event-handler.js?v=$version" +import { getDescribedElement, getDescribedOwner, hackPopover, isDisabled } from "./utility.js" +import EventHandler from "./event-handler.js" const Popover = { init(el, config) { diff --git a/src/BootstrapBlazor/wwwroot/modules/client.js b/src/BootstrapBlazor/wwwroot/modules/client.js index 21061ee97..30974525b 100644 --- a/src/BootstrapBlazor/wwwroot/modules/client.js +++ b/src/BootstrapBlazor/wwwroot/modules/client.js @@ -1,5 +1,5 @@ -import "./browser.js?v=$version" -import { execute } from "./ajax.js?v=$version" +import "./browser.js" +import { execute } from "./ajax.js" export async function ping(url, invoke, method) { const data = await getClientInfo(url); diff --git a/src/BootstrapBlazor/wwwroot/modules/debounce.js b/src/BootstrapBlazor/wwwroot/modules/debounce.js index 0f08bb120..281d5ad70 100644 --- a/src/BootstrapBlazor/wwwroot/modules/debounce.js +++ b/src/BootstrapBlazor/wwwroot/modules/debounce.js @@ -1,4 +1,4 @@ -import EventHandler from "./event-handler.js?v=$version" +import EventHandler from "./event-handler.js" export default { init(id, waitMs) { diff --git a/src/BootstrapBlazor/wwwroot/modules/drag.js b/src/BootstrapBlazor/wwwroot/modules/drag.js index 924999500..64d9ea9ae 100644 --- a/src/BootstrapBlazor/wwwroot/modules/drag.js +++ b/src/BootstrapBlazor/wwwroot/modules/drag.js @@ -1,4 +1,4 @@ -import EventHandler from "./event-handler.js?v=$version" +import EventHandler from "./event-handler.js" export default { drag: (el, start, move, end) => { diff --git a/src/BootstrapBlazor/wwwroot/modules/fullscreen.js b/src/BootstrapBlazor/wwwroot/modules/fullscreen.js index 81f3b4ad2..4ecb6d4ff 100644 --- a/src/BootstrapBlazor/wwwroot/modules/fullscreen.js +++ b/src/BootstrapBlazor/wwwroot/modules/fullscreen.js @@ -1,5 +1,5 @@ -import { isElement } from "./utility.js?v=$version" -import Data from "./data.js?v=$version" +import { isElement } from "./utility.js" +import Data from "./data.js" export function init(id) { const fs = {} diff --git a/src/BootstrapBlazor/wwwroot/modules/hub.js b/src/BootstrapBlazor/wwwroot/modules/hub.js index 1d295388a..ac0923bbd 100644 --- a/src/BootstrapBlazor/wwwroot/modules/hub.js +++ b/src/BootstrapBlazor/wwwroot/modules/hub.js @@ -1,6 +1,6 @@ -import { getClientInfo } from "./client.js?v=$version" -import Data from "./data.js?v=$version" -import EventHandler from "./event-handler.js?v=$version"; +import { getClientInfo } from "./client.js" +import Data from "./data.js" +import EventHandler from "./event-handler.js"; export async function init(id, options) { const { invoke, method, interval = 3000, url, connectionId } = options; diff --git a/src/BootstrapBlazor/wwwroot/modules/input.js b/src/BootstrapBlazor/wwwroot/modules/input.js index 0d806cf0f..a4aad40cc 100644 --- a/src/BootstrapBlazor/wwwroot/modules/input.js +++ b/src/BootstrapBlazor/wwwroot/modules/input.js @@ -1,4 +1,4 @@ -import EventHandler from "./event-handler.js?v=$version" +import EventHandler from "./event-handler.js" export default { composition(id, invoke, callback) { diff --git a/src/BootstrapBlazor/wwwroot/modules/responsive.js b/src/BootstrapBlazor/wwwroot/modules/responsive.js index d421e2e42..aae4b02b8 100644 --- a/src/BootstrapBlazor/wwwroot/modules/responsive.js +++ b/src/BootstrapBlazor/wwwroot/modules/responsive.js @@ -1,5 +1,5 @@ -import Data from "./data.js?v=$version" -import EventHandler from "./event-handler.js?v=$version" +import Data from "./data.js" +import EventHandler from "./event-handler.js" export function init(id, invoke, callback) { const resp = { diff --git a/src/BootstrapBlazor/wwwroot/modules/upload.js b/src/BootstrapBlazor/wwwroot/modules/upload.js index 2ec367e8b..31013c9ff 100644 --- a/src/BootstrapBlazor/wwwroot/modules/upload.js +++ b/src/BootstrapBlazor/wwwroot/modules/upload.js @@ -1,5 +1,5 @@ -import Data from "./data.js?v=$version" -import EventHandler from "./event-handler.js?v=$version" +import Data from "./data.js" +import EventHandler from "./event-handler.js" export function init(id) { const el = document.getElementById(id) diff --git a/src/BootstrapBlazor/wwwroot/modules/utility.js b/src/BootstrapBlazor/wwwroot/modules/utility.js index b8a5efd99..b90b4b550 100644 --- a/src/BootstrapBlazor/wwwroot/modules/utility.js +++ b/src/BootstrapBlazor/wwwroot/modules/utility.js @@ -251,8 +251,8 @@ const addLink = (href, rel = "stylesheet") => { if (link.length === 0) { const css = document.createElement('link') link.push(css) - css.setAttribute('href', href) css.setAttribute("rel", rel) + css.setAttribute('href', href) document.getElementsByTagName("head")[0].appendChild(css) css.onload = () => { css.setAttribute('loaded', true) diff --git a/src/BootstrapBlazor/wwwroot/modules/viewer.js b/src/BootstrapBlazor/wwwroot/modules/viewer.js index f6ada8421..591c51ef2 100644 --- a/src/BootstrapBlazor/wwwroot/modules/viewer.js +++ b/src/BootstrapBlazor/wwwroot/modules/viewer.js @@ -1,5 +1,5 @@ -import Drag from "./drag.js?v=$version" -import EventHandler from "./event-handler.js?v=$version" +import Drag from "./drag.js" +import EventHandler from "./event-handler.js" export default { init(el, prevList, config) { diff --git a/src/Bundle.props b/src/Bundle.props index e4b00560d..43cfd89a1 100644 --- a/src/Bundle.props +++ b/src/Bundle.props @@ -2,7 +2,6 @@ - diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f0cf68094..38a131f6d 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,6 +2,10 @@ + + true + + https://github.com/dotnetcore/BootstrapBlazor.git https://www.blazor.zone @@ -10,6 +14,10 @@ $(MSBuildProjectName).xml + + + + NETSDK1138 CS8002 diff --git a/src/Extensions/Components/BootstrapBlazor.TagHelper/BootstrapBlazor.TagHelper.csproj b/src/Extensions/Components/BootstrapBlazor.TagHelper/BootstrapBlazor.TagHelper.csproj new file mode 100644 index 000000000..2af76a914 --- /dev/null +++ b/src/Extensions/Components/BootstrapBlazor.TagHelper/BootstrapBlazor.TagHelper.csproj @@ -0,0 +1,25 @@ + + + + 8.0.0 + + + + Bootstrap Blazor Server UI Components + Bootstrap UI components extensions of TagHelper + + + + + + + + + + + + + + + + diff --git a/src/Extensions/Components/BootstrapBlazor.TagHelper/Extensions/WebHostEnvironmentExtensions.cs b/src/Extensions/Components/BootstrapBlazor.TagHelper/Extensions/WebHostEnvironmentExtensions.cs new file mode 100644 index 000000000..84af56186 --- /dev/null +++ b/src/Extensions/Components/BootstrapBlazor.TagHelper/Extensions/WebHostEnvironmentExtensions.cs @@ -0,0 +1,35 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.WebUtilities; +using System.Security.Cryptography; + +namespace BootstrapBlazor.Components; + +/// +/// IWebHostEnvironment 扩展方法 +/// +static class WebHostEnvironmentExtensions +{ + public static string? GetVersionHash(this IWebHostEnvironment env, string? href) + { + var ret = ""; + if (!string.IsNullOrEmpty(href)) + { + var fileInfo = env.WebRootFileProvider.GetFileInfo(href); + using var readStream = fileInfo.CreateReadStream(); +#if NET6_0 + var length = readStream.Length; + var buffer = new Span(new byte[length]); + readStream.Read(buffer); + var hash = SHA256.HashData(buffer); +#else + var hash = SHA256.HashData(readStream); +#endif + ret = WebEncoders.Base64UrlEncode(hash); + } + return $"{href}?v={ret}"; + } +} diff --git a/src/BootstrapBlazor/Components/HtmlTag/Link.razor b/src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Link.razor similarity index 100% rename from src/BootstrapBlazor/Components/HtmlTag/Link.razor rename to src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Link.razor diff --git a/src/BootstrapBlazor/Components/HtmlTag/Link.razor.cs b/src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Link.razor.cs similarity index 77% rename from src/BootstrapBlazor/Components/HtmlTag/Link.razor.cs rename to src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Link.razor.cs index f6cd08f68..65ea0ad95 100644 --- a/src/BootstrapBlazor/Components/HtmlTag/Link.razor.cs +++ b/src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Link.razor.cs @@ -2,6 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ +using Microsoft.AspNetCore.Hosting; + namespace BootstrapBlazor.Components; /// @@ -22,9 +24,8 @@ public partial class Link [Parameter] public string? Version { get; set; } - [Inject] - [NotNull] - private IVersionService? VersionService { get; set; } + [Inject, NotNull] + private IWebHostEnvironment? Env { get; set; } - private string GetHref() => $"{Href}?v={Version ?? VersionService.GetVersion()}"; + private string GetHref() => $"{Href}?v={Version ?? Env.GetVersionHash(Href)}"; } diff --git a/src/BootstrapBlazor/Components/HtmlTag/Script.razor b/src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Script.razor similarity index 100% rename from src/BootstrapBlazor/Components/HtmlTag/Script.razor rename to src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Script.razor diff --git a/src/BootstrapBlazor/Components/HtmlTag/Script.razor.cs b/src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Script.razor.cs similarity index 75% rename from src/BootstrapBlazor/Components/HtmlTag/Script.razor.cs rename to src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Script.razor.cs index fd7d59771..89c134546 100644 --- a/src/BootstrapBlazor/Components/HtmlTag/Script.razor.cs +++ b/src/Extensions/Components/BootstrapBlazor.TagHelper/HtmlTag/Script.razor.cs @@ -2,6 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.WebUtilities; + namespace BootstrapBlazor.Components; /// @@ -22,9 +25,8 @@ public partial class Script [Parameter] public string? Version { get; set; } - [Inject] - [NotNull] - private IVersionService? VersionService { get; set; } + [Inject, NotNull] + private IWebHostEnvironment? Env { get; set; } - private string GetSrc() => $"{Src}?v={Version ?? VersionService.GetVersion()}"; + private string GetSrc() => $"{Src}?v={Env.GetVersionHash(Src)}"; } diff --git a/src/Extensions/Components/BootstrapBlazor.TagHelper/_Imports.razor b/src/Extensions/Components/BootstrapBlazor.TagHelper/_Imports.razor new file mode 100644 index 000000000..d46585f83 --- /dev/null +++ b/src/Extensions/Components/BootstrapBlazor.TagHelper/_Imports.razor @@ -0,0 +1,2 @@ +@using BootstrapBlazor.Components; +@using Microsoft.AspNetCore.Components.Web diff --git a/src/Extensions/Components/BootstrapBlazor.TagHelper/logo.png b/src/Extensions/Components/BootstrapBlazor.TagHelper/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a30290780f1d7fbb242279e1ed64a94be6341d16 GIT binary patch literal 6414 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 - true logo.png - - - - diff --git a/test/UnitTest/Components/LinkTest.cs b/test/UnitTest/Components/LinkTest.cs deleted file mode 100644 index 0b2ee3f89..000000000 --- a/test/UnitTest/Components/LinkTest.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Website: https://www.blazor.zone or https://argozhang.github.io/ - -using Microsoft.Extensions.DependencyInjection; - -namespace UnitTest.Components; - -public class LinkTest : BootstrapBlazorTestBase -{ - [Fact] - public void Link_Ok() - { - var cut = Context.RenderComponent(pb => - { - pb.Add(a => a.Href, "http://www.blazor.zone"); - }); - var versionService = cut.Services.GetRequiredService(); - Assert.Equal($"", cut.Markup); - } - - [Fact] - public void Link_Version() - { - var cut = Context.RenderComponent(pb => - { - pb.Add(a => a.Href, "http://www.blazor.zone"); - pb.Add(a => a.Version, "20220202"); - }); - Assert.Equal($"", cut.Markup); - } -} diff --git a/test/UnitTest/Components/ScriptTest.cs b/test/UnitTest/Components/ScriptTest.cs deleted file mode 100644 index d61e8b59d..000000000 --- a/test/UnitTest/Components/ScriptTest.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Website: https://www.blazor.zone or https://argozhang.github.io/ - -using Microsoft.Extensions.DependencyInjection; - -namespace UnitTest.Components; - -public class ScriptTest : BootstrapBlazorTestBase -{ - [Fact] - public void Script_Ok() - { - var cut = Context.RenderComponent", cut.Markup); - } - - [Fact] - public void Script_Version() - { - var cut = Context.RenderComponent", cut.Markup); - } -}