From 9c9940ee44ed2e79722d9e7899a06876b0070c36 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Tue, 2 Jul 2024 14:27:03 +0800 Subject: [PATCH 01/18] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/docs.json | 86 +++++++++++++++------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/src/BootstrapBlazor.Server/docs.json b/src/BootstrapBlazor.Server/docs.json index 5d130c8f653..23878905cc1 100644 --- a/src/BootstrapBlazor.Server/docs.json +++ b/src/BootstrapBlazor.Server/docs.json @@ -220,48 +220,52 @@ "zip-archive": "ZipArchives" }, "video": { - "autorefresh": "BV1ap4y1x7Qn?p=8", - "column": "BV1ap4y1x7Qn?p=2", - "edit": "BV1ap4y1x7Qn?p=9;BV1ap4y1x7Qn?p=10;BV1ap4y1x7Qn?p=11;BV1ap4y1x7Qn?p=12;BV12P4y137Ar", - "editors": "BV13B4y1y7cS", - "editdialogs": "BV1bT4y1N78e?p=10", - "export": "BV1ap4y1x7Qn?p=6", - "drawers": "BV1bT4y1N78e?p=7", - "detail": "BV1ap4y1x7Qn?p=3", - "dialog": "BV1bT4y1N78e?p=1", - "dialogs": "BV1bT4y1N78e?p=1;BV17v4y1K7Ho", - "header": "BV15o4y1f7eN", - "localizer": "BV1Kz4y1U7FR?p=1", - "filter": "BV1ap4y1x7Qn?p=4", - "fix-column": "BV1ap4y1x7Qn?p=5", - "footer": "BV15o4y1f7eN", - "messages": "BV1bT4y1N78e?p=3", - "modals": "BV1bT4y1N78e?p=4", - "multi-header": "BV15o4y1f7eN", - "pages": "BV1Et4y1r7qr", - "popconfirms": "BV1bT4y1N78e?p=5", - "row": "BV1ap4y1x7Qn?p=3", - "search": "BV1ap4y1x7Qn?p=4;BV1E34y1R7ia", - "searchdialogs": "BV1bT4y1N78e?p=9", - "selection": "BV1jh41127U6", - "swals": "BV1bT4y1N78e?p=8", - "tables": "BV1ap4y1x7Qn?p=1", - "template": "BV1Kp4y1B7pY", - "toolbar": "BV1ap4y1x7Qn?p=6", - "toasts": "BV1bT4y1N78e?p=6", - "tree": "BV1ap4y1x7Qn?p=14;BV1ZW4y1z7bB", - "wrap": "BV1ap4y1x7Qn?p=7", - "uploads": "BV1hK4y157Rj", - "validateforms": "BV1TU4y1Y7CM", - "dynamic": "BV1Eb4y1z7cY", - "excel": "BV1QL411x7v4", - "dynamicexcel": "BV1p3411278A", + "table": "BV1ap4y1x7Qn?p=1", + "table/auto-refresh": "BV1ap4y1x7Qn?p=8", + "table/column": "BV1ap4y1x7Qn?p=2", + "table/edit": "BV1ap4y1x7Qn?p=9;BV1ap4y1x7Qn?p=10;BV1ap4y1x7Qn?p=11;BV1ap4y1x7Qn?p=12;BV12P4y137Ar", + "table/detail": "BV1ap4y1x7Qn?p=3", + "table/dialog": "BV1bT4y1N78e?p=1", + "table/export": "BV1ap4y1x7Qn?p=6;BV1nN411V7W9;BV1Nb4y1L7p9", + "table/header": "BV15o4y1f7eN", + "table/filter": "BV1ap4y1x7Qn?p=4", + "table/fix-column": "BV1ap4y1x7Qn?p=5", + "table/multi-header": "BV15o4y1f7eN", + "table/footer": "BV15o4y1f7eN", + "table/row": "BV1ap4y1x7Qn?p=3", + "table/search": "BV1ap4y1x7Qn?p=4;BV1E34y1R7ia", + "table/selection": "BV1jh41127U6", + "table/toolbar": "BV1ap4y1x7Qn?p=6", + "table/wrap": "BV1ap4y1x7Qn?p=7", + "table/dynamic": "BV1Eb4y1z7cY", + "table/excel": "BV1QL411x7v4", + "tale/dynamic-excel": "BV1p3411278A", + "editor": "BV13B4y1y7cS", + "edit-dialog": "BV1bT4y1N78e?p=10", + "drawer": "BV1bT4y1N78e?p=7", + "dialog": "BV1bT4y1N78e?p=1;BV17v4y1K7Ho", + "message": "BV1bT4y1N78e?p=3", + "modal": "BV1bT4y1N78e?p=4", + "pagination": "BV1Et4y1r7qr", + "pop-confirm": "BV1bT4y1N78e?p=5", + "search-dialog": "BV1bT4y1N78e?p=9", + "sweet-alert": "BV1bT4y1N78e?p=8", + "toast": "BV1bT4y1N78e?p=6", + "tree-view": "BV1ap4y1x7Qn?p=14;BV1ZW4y1z7bB;BV15c411v7w7", + "upload": "BV1hK4y157Rj", + "validate-form": "BV1TU4y1Y7CM", + "speech/speechwave": "BV1Dr4y1J7Z5", + "speech/recognizer": "BV1aR4y1N7UP", + "speech/synthesizer": "BV1aR4y1N7UP", + "reconnector": "BV1Dr4y1J7Z5;BV193411P7Dz", + "topology": "BV1eY4y167jn;BV13Z4y1h7MA", + "select-object": "BV1Zw411j7Ea", + "select-table": "BV1f64y1A7AL;BV1Ye411n7XR", + "step": "BV1oN4y1y75m", + "context-menu": "BV1gk4y1w7Ab", "globalexception": "BV1xq4y1z7K2", - "recognizers": "BV1aR4y1N7UP", - "synthesizers": "BV1aR4y1N7UP", - "reconnectors": "BV1Dr4y1J7Z5;BV193411P7Dz", - "speechwaves": "BV1Dr4y1J7Z5", - "topologies": "BV1eY4y167jn;BV13Z4y1h7MA" + "localizer": "BV1Kz4y1U7FR?p=1", + "template": "BV1Kp4y1B7pY" }, "link": { "AntDesign": "http://www.antblazor.com/", From b6b3a0db86b5b85ecedfee5da63f306ebb82bee5 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 09:52:38 +0800 Subject: [PATCH 02/18] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Filters/FilterBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Filters/FilterBase.cs b/src/BootstrapBlazor/Components/Filters/FilterBase.cs index bb55d9e8487..a31dafdadbb 100644 --- a/src/BootstrapBlazor/Components/Filters/FilterBase.cs +++ b/src/BootstrapBlazor/Components/Filters/FilterBase.cs @@ -43,7 +43,7 @@ public abstract class FilterBase : ComponentBase, IFilterAction public int Count { get; set; } /// - /// 获得/设置 条件候选项 + /// 获得/设置 条件候选项 请尽量使用静态数据 避免组件性能损失 /// [Parameter] public IEnumerable? Items { get; set; } From 0c4ac97db34f77a9d3050a6ed40247c0a006e87d Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 09:53:07 +0800 Subject: [PATCH 03/18] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=20MultiFil?= =?UTF-8?q?terItem=20=E5=86=85=E9=83=A8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Filters/MultiFilter.razor | 2 +- .../Components/Filters/MultiFilter.razor.cs | 30 +++++++------------ 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor index ee465a48dad..e05bd985b6b 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor @@ -19,7 +19,7 @@ @foreach (var item in GetItems()) {
- +
} diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs index 2efee0ff923..7d0bbe7b111 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs @@ -29,9 +29,9 @@ public partial class MultiFilter private string? _searchText; - private List _source = []; + private List _source = []; - private List? _items; + private List? _items; /// /// OnInitialized 方法 @@ -57,8 +57,9 @@ protected override void OnParametersSet() if (Items != null) { - _source = Items.Select(item => new MultiFilterItem() { Value = item.Value, Text = item.Text }).ToList(); + _source = Items.ToList(); } + _source ??= []; } /// @@ -69,7 +70,7 @@ public override void Reset() _searchText = string.Empty; foreach (var item in _source) { - item.Checked = false; + item.Active = false; } _items = null; StateHasChanged(); @@ -83,7 +84,7 @@ public override FilterKeyValueAction GetFilterConditions() { var filter = new FilterKeyValueAction() { Filters = [], FilterLogic = FilterLogic.Or }; - foreach (var item in GetItems().Where(i => i.Checked)) + foreach (var item in GetItems().Where(i => i.Active)) { filter.Filters.Add(new FilterKeyValueAction() { @@ -103,9 +104,9 @@ private CheckboxState GetState() var items = GetItems(); if (items.Count > 0) { - state = items.All(i => i.Checked) + state = items.All(i => i.Active) ? CheckboxState.Checked - : items.Any(i => i.Checked) + : items.Any(i => i.Active) ? CheckboxState.Indeterminate : CheckboxState.UnChecked; } @@ -122,7 +123,7 @@ private Task OnStateChanged(CheckboxState state, bool val) { foreach (var item in GetItems()) { - item.Checked = state == CheckboxState.Checked; + item.Active = state == CheckboxState.Checked; } StateHasChanged(); return Task.CompletedTask; @@ -148,16 +149,5 @@ private Task OnSearchValueChanged(string? val) return Task.CompletedTask; } - private List GetItems() => _items ?? _source; - - class MultiFilterItem - { - public bool Checked { get; set; } - - [NotNull] - public string? Value { get; init; } - - [NotNull] - public string? Text { get; init; } - } + private List GetItems() => _items ?? _source; } From c5cc0f56726347575ef1389d8173940d02a8593f Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 10:10:48 +0800 Subject: [PATCH 04/18] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Table/TablesFilter.razor | 13 ++++++------- .../Components/Samples/Table/TablesFilter.razor.cs | 3 +++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor index 032f69f849d..5f996c4c480 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor @@ -14,7 +14,7 @@
  • @((MarkupString)Localizer["TablesFilterDescLi2"].Value)
  • -
    @@ -113,7 +113,6 @@ - - + *@ - + - + - + - + diff --git a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs index 04cc9351d97..87af87657d6 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs @@ -28,6 +28,8 @@ public partial class TablesFilter [NotNull] private Table? TableSetFilter { get; set; } + private readonly List _addressFilterItems = []; + /// /// OnInitialized 方法 /// @@ -36,6 +38,7 @@ protected override void OnInitialized() base.OnInitialized(); Items = Foo.GenerateFoo(FooLocalizer); + _addressFilterItems.AddRange(Items.Select(i => new SelectedItem(i.Address!, i.Address!)).DistinctBy(i => i.Value)); } private Task> OnQueryAsync(QueryPageOptions options) From 724c4786078ded37ee9204f388fd062a45c7a20f Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 10:48:40 +0800 Subject: [PATCH 05/18] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Filters/FilterBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/Filters/FilterBase.cs b/src/BootstrapBlazor/Components/Filters/FilterBase.cs index a31dafdadbb..74873da61fb 100644 --- a/src/BootstrapBlazor/Components/Filters/FilterBase.cs +++ b/src/BootstrapBlazor/Components/Filters/FilterBase.cs @@ -86,7 +86,7 @@ protected override void OnInitialized() public virtual Task SetFilterConditionsAsync(FilterKeyValueAction filter) => OnFilterValueChanged(); /// - /// + /// 过滤按钮回调方法 /// /// protected async Task OnFilterValueChanged() @@ -99,7 +99,7 @@ protected async Task OnFilterValueChanged() } /// - /// + /// 重置按钮回调方法 /// /// protected async Task OnClearFilter() From 9bc6cb4323eef6ea88040082436bff1aac54317d Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 10:48:53 +0800 Subject: [PATCH 06/18] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=87=92?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Filters/MultiFilter.razor | 46 +++++++++++++------ .../Components/Filters/MultiFilter.razor.cs | 28 +++++++---- .../Components/Filters/MultiFilter.razor.scss | 7 +++ 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor index e05bd985b6b..add83482a7b 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor @@ -4,24 +4,40 @@ @inject IStringLocalizer Localizer
    - @if (ShowSearch) + @if (_source != null) { - - } -
    -
    - + @if (ShowSearch) + { + + } +
    +
    + +
    +
    + @foreach (var item in GetItems()) + { +
    + +
    + } +
    -
    - @foreach (var item in GetItems()) + } + else + { +
    + @if (LoadingTemplate != null) { -
    - -
    + @LoadingTemplate + } + else + { + }
    -
    + }
    diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs index 7d0bbe7b111..fce0cac84be 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs @@ -27,22 +27,40 @@ public partial class MultiFilter [Parameter] public bool ShowSearch { get; set; } = true; + /// + /// 获得 过滤项集合回调方法 适合动态给定数据源 + /// + [Parameter] + public Func>>? OnGetItemsAsync { get; set; } + + /// + /// 获得/设置 Loading 模板 + /// + [Parameter] + public RenderFragment? LoadingTemplate { get; set; } + private string? _searchText; - private List _source = []; + private List? _source; private List? _items; /// - /// OnInitialized 方法 + /// /// protected override void OnInitialized() { base.OnInitialized(); + if (TableFilter != null) { TableFilter.ShowMoreButton = false; } + + if (Items != null) + { + _source = Items.ToList(); + } } /// @@ -54,12 +72,6 @@ protected override void OnParametersSet() SearchPlaceHolderText ??= Localizer["MultiFilterSearchPlaceHolderText"]; SelectAllText ??= Localizer["MultiFilterSelectAllText"]; - - if (Items != null) - { - _source = Items.ToList(); - } - _source ??= []; } /// diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss index f45f056c898..f406054bd39 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss @@ -48,4 +48,11 @@ } } } + + .bb-multi-filter-loading { + height: var(--bb-multi-filter-height); + display: flex; + align-items: center; + justify-content: center; + } } From 7b443eb300c69649a4cfc1fda6c4b0352c5e8ee2 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 12:15:41 +0800 Subject: [PATCH 07/18] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E6=94=AF=E6=8C=81=E6=95=B0=E6=8D=AE=E6=87=92=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Filters/FilterBase.cs | 2 +- .../Components/Filters/MultiFilter.razor | 44 ++++++++------- .../Components/Filters/MultiFilter.razor.cs | 54 +++++++++++++++---- .../Components/Filters/MultiFilter.razor.js | 31 +++++++++++ .../Components/Filters/MultiFilter.razor.scss | 8 ++- 5 files changed, 103 insertions(+), 36 deletions(-) create mode 100644 src/BootstrapBlazor/Components/Filters/MultiFilter.razor.js diff --git a/src/BootstrapBlazor/Components/Filters/FilterBase.cs b/src/BootstrapBlazor/Components/Filters/FilterBase.cs index 74873da61fb..05de848323f 100644 --- a/src/BootstrapBlazor/Components/Filters/FilterBase.cs +++ b/src/BootstrapBlazor/Components/Filters/FilterBase.cs @@ -7,7 +7,7 @@ namespace BootstrapBlazor.Components; /// /// 类型过滤器基类 /// /// -public abstract class FilterBase : ComponentBase, IFilterAction +public abstract class FilterBase : BootstrapModuleComponentBase, IFilterAction { /// /// diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor index add83482a7b..96a0e96438a 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor @@ -2,32 +2,30 @@ @namespace BootstrapBlazor.Components @inherits FilterBase @inject IStringLocalizer Localizer +@attribute [BootstrapModuleAutoLoader("Filters/MultiFilter.razor.js", JSObjectReference = true)] -
    - @if (_source != null) +
    + @if (ShowSearch) { - @if (ShowSearch) - { - - } -
    -
    - -
    -
    - @foreach (var item in GetItems()) - { -
    - -
    - } -
    -
    + } - else +
    +
    + +
    +
    + @foreach (var item in GetItems()) + { +
    + +
    + } +
    +
    + @if (_source == null) {
    @if (LoadingTemplate != null) diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs index fce0cac84be..4ce77d451e0 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs @@ -31,7 +31,7 @@ public partial class MultiFilter /// 获得 过滤项集合回调方法 适合动态给定数据源 ///
    [Parameter] - public Func>>? OnGetItemsAsync { get; set; } + public Func>>? OnGetItemsAsync { get; set; } /// /// 获得/设置 Loading 模板 @@ -74,15 +74,30 @@ protected override void OnParametersSet() SelectAllText ??= Localizer["MultiFilterSelectAllText"]; } + /// + /// + /// + /// + protected override async Task InvokeInitAsync() + { + if (OnGetItemsAsync != null) + { + await InvokeVoidAsync("init", Id, new { Invoker = Interop, Callback = nameof(InitItems) }); + } + } + /// /// 重置过滤条件方法 /// public override void Reset() { _searchText = string.Empty; - foreach (var item in _source) + if (_source != null) { - item.Active = false; + foreach (var item in _source) + { + item.Active = false; + } } _items = null; StateHasChanged(); @@ -108,6 +123,20 @@ public override FilterKeyValueAction GetFilterConditions() return filter; } + /// + /// Javascript 回调方法 + /// + /// + [JSInvokable] + public async Task InitItems() + { + if (OnGetItemsAsync != null) + { + _source = await OnGetItemsAsync(); + StateHasChanged(); + } + } + private CheckboxState _selectAllState = CheckboxState.UnChecked; private CheckboxState GetState() @@ -149,17 +178,20 @@ private Task OnStateChanged(CheckboxState state, bool val) private Task OnSearchValueChanged(string? val) { _searchText = val; - if (!string.IsNullOrEmpty(_searchText)) + if (_source != null) { - _items = _source.Where(i => i.Text.Contains(_searchText)).ToList(); - } - else - { - _items = null; + if (!string.IsNullOrEmpty(_searchText)) + { + _items = _source.Where(i => i.Text.Contains(_searchText)).ToList(); + } + else + { + _items = null; + } + StateHasChanged(); } - StateHasChanged(); return Task.CompletedTask; } - private List GetItems() => _items ?? _source; + private List GetItems() => _items ?? _source ?? []; } diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.js b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.js new file mode 100644 index 00000000000..d859d121d8d --- /dev/null +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.js @@ -0,0 +1,31 @@ +import Data from "../../modules/data.js" +import EventHandler from "../../modules/event-handler.js" + +export function init(id, options) { + const el = document.getElementById(id) + if (el == null) { + return; + } + + const { invoker, callback } = options; + const filterEl = el.closest('.filter-icon'); + if (filterEl) { + const popoverEl = filterEl.querySelector('i[data-bs-toggle="bb.dropdown"]'); + if (popoverEl) { + EventHandler.on(popoverEl, 'show.bs.popover', () => { + EventHandler.off(popoverEl, 'show.bs.popover'); + invoker.invokeMethodAsync(callback); + }); + Data.set(id, popoverEl); + } + } +} + +export function dispose(id) { + const popoverEl = Data.get(id) + Data.remove(id) + + if (popoverEl) { + EventHandler.off(popoverEl, 'show.bs.popover'); + } +} diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss index f406054bd39..5b87d19b60a 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.scss @@ -5,6 +5,7 @@ --bb-multi-filter-body-item-bg: #fff; --bb-multi-filter-body-item-hover-bg: #fff; --bb-multi-filter-body-item-margin: .5rem; + position: relative; .bb-multi-filter-search { margin-bottom: var(--bb-multi-filter-search-margin-bottom); @@ -50,7 +51,12 @@ } .bb-multi-filter-loading { - height: var(--bb-multi-filter-height); + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: var(--bs-body-bg); display: flex; align-items: center; justify-content: center; From 7fa9f7c0591912b4ec722bc22c5633f79376e5c6 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 12:26:19 +0800 Subject: [PATCH 08/18] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Filters/NumberFilter.razor.cs | 12 ++++++------ .../Components/Filters/StringFilter.razor.cs | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/BootstrapBlazor/Components/Filters/NumberFilter.razor.cs b/src/BootstrapBlazor/Components/Filters/NumberFilter.razor.cs index 084daeb2fbf..18ee784b63b 100644 --- a/src/BootstrapBlazor/Components/Filters/NumberFilter.razor.cs +++ b/src/BootstrapBlazor/Components/Filters/NumberFilter.razor.cs @@ -38,12 +38,12 @@ protected override void OnParametersSet() Items ??= new SelectedItem[] { - new SelectedItem("GreaterThanOrEqual", Localizer["GreaterThanOrEqual"].Value), - new SelectedItem("LessThanOrEqual", Localizer["LessThanOrEqual"].Value), - new SelectedItem("GreaterThan", Localizer["GreaterThan"].Value), - new SelectedItem("LessThan", Localizer["LessThan"].Value), - new SelectedItem("Equal", Localizer["Equal"].Value), - new SelectedItem("NotEqual", Localizer["NotEqual"].Value) + new("GreaterThanOrEqual", Localizer["GreaterThanOrEqual"].Value), + new("LessThanOrEqual", Localizer["LessThanOrEqual"].Value), + new("GreaterThan", Localizer["GreaterThan"].Value), + new("LessThan", Localizer["LessThan"].Value), + new("Equal", Localizer["Equal"].Value), + new("NotEqual", Localizer["NotEqual"].Value) }; } diff --git a/src/BootstrapBlazor/Components/Filters/StringFilter.razor.cs b/src/BootstrapBlazor/Components/Filters/StringFilter.razor.cs index 9e72829550f..6dadbe192c9 100644 --- a/src/BootstrapBlazor/Components/Filters/StringFilter.razor.cs +++ b/src/BootstrapBlazor/Components/Filters/StringFilter.razor.cs @@ -37,10 +37,10 @@ protected override void OnParametersSet() Items ??= new SelectedItem[] { - new SelectedItem("Contains", Localizer["Contains"].Value), - new SelectedItem("Equal", Localizer["Equal"].Value), - new SelectedItem("NotEqual", Localizer["NotEqual"].Value), - new SelectedItem("NotContains", Localizer["NotContains"].Value) + new("Contains", Localizer["Contains"].Value), + new("Equal", Localizer["Equal"].Value), + new("NotEqual", Localizer["NotEqual"].Value), + new("NotContains", Localizer["NotContains"].Value) }; } From 395469fd4abbbc03be622cf991aaec88ba232be6 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 12:26:42 +0800 Subject: [PATCH 09/18] =?UTF-8?q?refactor:=20=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E6=96=B9=E6=B3=95=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs index 4ce77d451e0..c1f5dc5b488 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs @@ -82,7 +82,7 @@ protected override async Task InvokeInitAsync() { if (OnGetItemsAsync != null) { - await InvokeVoidAsync("init", Id, new { Invoker = Interop, Callback = nameof(InitItems) }); + await InvokeVoidAsync("init", Id, new { Invoker = Interop, Callback = nameof(TriggerGetItemsCallback) }); } } @@ -128,7 +128,7 @@ public override FilterKeyValueAction GetFilterConditions() /// /// [JSInvokable] - public async Task InitItems() + public async Task TriggerGetItemsCallback() { if (OnGetItemsAsync != null) { From f74956bed89cbcf15cb20d8440dc7182f927546e Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 13:43:24 +0800 Subject: [PATCH 10/18] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20Items=20?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E9=80=89=E4=B8=AD=E9=A1=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Filters/MultiFilter.razor.cs | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs index c1f5dc5b488..fb353a80334 100644 --- a/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs +++ b/src/BootstrapBlazor/Components/Filters/MultiFilter.razor.cs @@ -56,11 +56,6 @@ protected override void OnInitialized() { TableFilter.ShowMoreButton = false; } - - if (Items != null) - { - _source = Items.ToList(); - } } /// @@ -70,8 +65,35 @@ protected override void OnParametersSet() { base.OnParametersSet(); + if (Items != null && OnGetItemsAsync != null) + { + throw new InvalidOperationException($"{GetType()} can only accept one item source from its parameters. Do not supply both '{nameof(Items)}' and '{nameof(OnGetItemsAsync)}'."); + } + SearchPlaceHolderText ??= Localizer["MultiFilterSearchPlaceHolderText"]; SelectAllText ??= Localizer["MultiFilterSelectAllText"]; + + if (Items != null) + { + var selectedItems = _source?.Where(x => x.Active).ToList(); + _source = Items.ToList(); + ResetActiveItems(_source, selectedItems); + } + } + + private static void ResetActiveItems(List source, List? activeItems) + { + if (activeItems != null) + { + foreach (var active in activeItems) + { + var item = source.Find(i => i.Value == active.Value); + if (item != null) + { + item.Active = true; + } + } + } } /// From 3fa500ecf327cb57390a1324b69fdbcc20b59bba Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 13:43:35 +0800 Subject: [PATCH 11/18] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Table/TablesFilter.razor | 15 ++++++++------- .../Samples/Table/TablesFilter.razor.cs | 11 +++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor index 5f996c4c480..01f7b4fcfc0 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor @@ -195,6 +195,7 @@ +
    - + - + - + - + - + - + - + diff --git a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs index 87af87657d6..801c7df32b7 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor.cs @@ -28,7 +28,7 @@ public partial class TablesFilter [NotNull] private Table? TableSetFilter { get; set; } - private readonly List _addressFilterItems = []; + private IEnumerable _nameMultiFilterItems = default!; /// /// OnInitialized 方法 @@ -38,7 +38,14 @@ protected override void OnInitialized() base.OnInitialized(); Items = Foo.GenerateFoo(FooLocalizer); - _addressFilterItems.AddRange(Items.Select(i => new SelectedItem(i.Address!, i.Address!)).DistinctBy(i => i.Value)); + _nameMultiFilterItems = Items.Select(i => new SelectedItem(i.Name!, i.Name!)).DistinctBy(i => i.Value); + } + + private async Task> OnGetAddressItemsAsync() + { + // 模拟数据库延时 + await Task.Delay(500); + return Items.Select(i => new SelectedItem(i.Address!, i.Address!)).DistinctBy(i => i.Value).ToList(); } private Task> OnQueryAsync(QueryPageOptions options) From 9e32822e4298d48fc8e6147f5210b1764f2388dc Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 13:43:53 +0800 Subject: [PATCH 12/18] chore: bump version 8.7.1-beta05 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 7f4e39a9fe5..dc76c0bbc64 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.7.1-beta04 + 8.7.1-beta05 From b23755e28dd8703548043a45256f945a0b87097a Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 13:57:48 +0800 Subject: [PATCH 13/18] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TableFilterTest.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/UnitTest/Components/TableFilterTest.cs b/test/UnitTest/Components/TableFilterTest.cs index f3ce8a4caef..519ef8c9e2d 100644 --- a/test/UnitTest/Components/TableFilterTest.cs +++ b/test/UnitTest/Components/TableFilterTest.cs @@ -152,6 +152,26 @@ await cut.InvokeAsync(() => var input = cut.Find(".bb-multi-filter-search"); await cut.InvokeAsync(() => input.Input("test02")); await cut.InvokeAsync(() => input.Input("")); + + filter.SetParametersAndRender(pb => + { + pb.Add(a => a.Items, null); + pb.Add(a => a.OnGetItemsAsync, () => Task.FromResult(new List() { new("test1", "test1") })); + }); + } + + [Fact] + public void MultiFilter_Exception() + { + // 测试 Exception + Assert.Throws(() => + { + Context.RenderComponent(pb => + { + pb.Add(a => a.Items, new SelectedItem[] { new("test1", "test1"), new("test2", "test2") }); + pb.Add(a => a.OnGetItemsAsync, () => Task.FromResult(new List() { new("test1", "test1") })); + }); + }); } [Fact] From 3b13d3320e369842a6014a51b88fc499787fc7d9 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 14:06:54 +0800 Subject: [PATCH 14/18] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TableFilterTest.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/UnitTest/Components/TableFilterTest.cs b/test/UnitTest/Components/TableFilterTest.cs index 519ef8c9e2d..9a6f17c5772 100644 --- a/test/UnitTest/Components/TableFilterTest.cs +++ b/test/UnitTest/Components/TableFilterTest.cs @@ -144,6 +144,15 @@ await cut.InvokeAsync(() => Assert.Equal("P8", action.Filters[0].FieldKey); Assert.Equal(CheckboxState.Indeterminate, checkboxs[0].Instance.State); + // 测试 Items 改变保持选项 + filter.SetParametersAndRender(pb => + { + pb.Add(a => a.Items, new SelectedItem[] { new("test3", "test3"), new("test2", "test2") }); + }); + checkboxs = cut.FindComponents>(); + Assert.Equal(3, checkboxs.Count); + checkboxs[2].Markup.Contains("checked=\"checked\""); + // 测试全选 await cut.InvokeAsync(() => checkboxs[0].Instance.SetState(CheckboxState.Checked)); await cut.InvokeAsync(() => checkboxs[0].Instance.SetState(CheckboxState.UnChecked)); From 563b57b184bd06619d3d5687aef09352ab69a45e Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 14:18:16 +0800 Subject: [PATCH 15/18] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TableFilterTest.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/UnitTest/Components/TableFilterTest.cs b/test/UnitTest/Components/TableFilterTest.cs index 9a6f17c5772..cb94c582ccf 100644 --- a/test/UnitTest/Components/TableFilterTest.cs +++ b/test/UnitTest/Components/TableFilterTest.cs @@ -101,21 +101,28 @@ public async Task MultiFilter_Ok() { b.OpenComponent(0); b.AddAttribute(1, nameof(MultiFilter.ShowSearch), true); - b.AddAttribute(2, nameof(MultiFilter.Items), new SelectedItem[] { - new("test1", "test1"), - new("test2", "test2") - }); b.CloseComponent(); })); builder.CloseComponent(); }); }); }); + cut.Contains("bb-multi-filter-loading"); + var filter = cut.FindComponent(); + filter.SetParametersAndRender(pb => + { + pb.Add(a => a.LoadingTemplate, "loading-template-test"); + }); + cut.Contains("loading-template-test"); + + filter.SetParametersAndRender(pb => + { + pb.Add(a => a.Items, new SelectedItem[] { new("test1", "test1"), new("test2", "test2") }); + }); cut.DoesNotContain("multi-filter-placeholder"); cut.DoesNotContain("multi-filter-All"); - var filter = cut.FindComponent(); filter.SetParametersAndRender(pb => { pb.Add(a => a.SearchPlaceHolderText, "multi-filter-placeholder"); @@ -167,6 +174,7 @@ await cut.InvokeAsync(() => pb.Add(a => a.Items, null); pb.Add(a => a.OnGetItemsAsync, () => Task.FromResult(new List() { new("test1", "test1") })); }); + await cut.InvokeAsync(() => filter.Instance.TriggerGetItemsCallback()); } [Fact] From 2fde323332b388b7df7b8e822144fee744adee04 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 14:22:24 +0800 Subject: [PATCH 16/18] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TableFilterTest.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/UnitTest/Components/TableFilterTest.cs b/test/UnitTest/Components/TableFilterTest.cs index cb94c582ccf..58902de6b4f 100644 --- a/test/UnitTest/Components/TableFilterTest.cs +++ b/test/UnitTest/Components/TableFilterTest.cs @@ -101,6 +101,7 @@ public async Task MultiFilter_Ok() { b.OpenComponent(0); b.AddAttribute(1, nameof(MultiFilter.ShowSearch), true); + b.AddAttribute(2, nameof(MultiFilter.OnGetItemsAsync), () => Task.FromResult(new List() { new("test1", "test1") })); b.CloseComponent(); })); builder.CloseComponent(); @@ -115,10 +116,12 @@ public async Task MultiFilter_Ok() pb.Add(a => a.LoadingTemplate, "loading-template-test"); }); cut.Contains("loading-template-test"); + await cut.InvokeAsync(() => filter.Instance.TriggerGetItemsCallback()); filter.SetParametersAndRender(pb => { pb.Add(a => a.Items, new SelectedItem[] { new("test1", "test1"), new("test2", "test2") }); + pb.Add(a => a.OnGetItemsAsync, null); }); cut.DoesNotContain("multi-filter-placeholder"); cut.DoesNotContain("multi-filter-All"); @@ -168,13 +171,6 @@ await cut.InvokeAsync(() => var input = cut.Find(".bb-multi-filter-search"); await cut.InvokeAsync(() => input.Input("test02")); await cut.InvokeAsync(() => input.Input("")); - - filter.SetParametersAndRender(pb => - { - pb.Add(a => a.Items, null); - pb.Add(a => a.OnGetItemsAsync, () => Task.FromResult(new List() { new("test1", "test1") })); - }); - await cut.InvokeAsync(() => filter.Instance.TriggerGetItemsCallback()); } [Fact] From 9f5c943d65426144335a840d6fbf546dd17362ce Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 14:31:02 +0800 Subject: [PATCH 17/18] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TableFilterTest.cs | 61 +++++++++++++++------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/test/UnitTest/Components/TableFilterTest.cs b/test/UnitTest/Components/TableFilterTest.cs index 58902de6b4f..7a9d53dc7df 100644 --- a/test/UnitTest/Components/TableFilterTest.cs +++ b/test/UnitTest/Components/TableFilterTest.cs @@ -117,15 +117,56 @@ public async Task MultiFilter_Ok() }); cut.Contains("loading-template-test"); await cut.InvokeAsync(() => filter.Instance.TriggerGetItemsCallback()); + } - filter.SetParametersAndRender(pb => + [Fact] + public void MultiFilter_Exception() + { + // 测试 Exception + Assert.Throws(() => { - pb.Add(a => a.Items, new SelectedItem[] { new("test1", "test1"), new("test2", "test2") }); - pb.Add(a => a.OnGetItemsAsync, null); + Context.RenderComponent(pb => + { + pb.Add(a => a.Items, new SelectedItem[] { new("test1", "test1"), new("test2", "test2") }); + pb.Add(a => a.OnGetItemsAsync, () => Task.FromResult(new List() { new("test1", "test1") })); + }); + }); + } + + [Fact] + public async Task MultipleFilter_Items() + { + var cut = Context.RenderComponent(pb => + { + pb.AddChildContent>(pb => + { + pb.Add(a => a.Items, new List + { + new() + }); + pb.Add(a => a.RenderMode, TableRenderMode.Table); + pb.Add(a => a.TableColumns, cat => builder => + { + var index = 0; + builder.OpenComponent>(index++); + builder.AddAttribute(index++, nameof(TableColumn.Field), cat.P8); + builder.AddAttribute(index++, nameof(TableColumn.FieldExpression), Utility.GenerateValueExpression(cat, nameof(Cat.P8), typeof(string))); + builder.AddAttribute(index++, nameof(TableColumn.Filterable), true); + builder.AddAttribute(index++, nameof(TableColumn.FilterTemplate), new RenderFragment(b => + { + b.OpenComponent(0); + b.AddAttribute(1, nameof(MultiFilter.ShowSearch), true); + b.AddAttribute(2, nameof(MultiFilter.Items), new SelectedItem[] { new("test1", "test1"), new("test2", "test2") }); + b.CloseComponent(); + })); + builder.CloseComponent(); + }); + }); }); cut.DoesNotContain("multi-filter-placeholder"); cut.DoesNotContain("multi-filter-All"); + var filter = cut.FindComponent(); filter.SetParametersAndRender(pb => { pb.Add(a => a.SearchPlaceHolderText, "multi-filter-placeholder"); @@ -173,20 +214,6 @@ await cut.InvokeAsync(() => await cut.InvokeAsync(() => input.Input("")); } - [Fact] - public void MultiFilter_Exception() - { - // 测试 Exception - Assert.Throws(() => - { - Context.RenderComponent(pb => - { - pb.Add(a => a.Items, new SelectedItem[] { new("test1", "test1"), new("test2", "test2") }); - pb.Add(a => a.OnGetItemsAsync, () => Task.FromResult(new List() { new("test1", "test1") })); - }); - }); - } - [Fact] public void NotInTable_Ok() { From 02433c11712fa6c3a3a6a16eedcca0fe3651b8d6 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Wed, 3 Jul 2024 14:43:40 +0800 Subject: [PATCH 18/18] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Table/TablesFilter.razor | 12 +++++++++--- src/BootstrapBlazor.Server/Locales/en-US.json | 3 +++ src/BootstrapBlazor.Server/Locales/zh-CN.json | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor index 01f7b4fcfc0..65fee59e62a 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesFilter.razor @@ -14,7 +14,7 @@
  • @((MarkupString)Localizer["TablesFilterDescLi2"].Value)
  • -@*
    @@ -190,12 +190,18 @@
    -
    *@ + -
    +
    +

    @((MarkupString)Localizer["MultiFilterTips"].Value)

    +
      +
    • @((MarkupString)Localizer["MultiFilterTipsLi1"].Value)
    • +
    • @((MarkupString)Localizer["MultiFilterTipsLi2"].Value)
    • +
    +
    MultiFilter component to provide multi-select filtering via FilterTemplate", + "MultiFilterTips": "The component provides two ways to set the data source: Items and OnGetItemsAsync", + "MultiFilterTipsLi1": "Items is suitable for small amounts of data and statically prepared data sets", + "MultiFilterTipsLi2": "OnGetItemsAsync is suitable for large and dynamic data collections. For performance reasons, the component uses a local lazy record method to fill in data, that is, the callback is called to obtain data when the filter window is opened.", "TablesFilterTitle": "Filter and sort function", "TablesFilterDesc": "Filter to quickly find the data you want to see; sort to quickly find or compare data.", "TablesFilterDescLi1": "Filters a column of data to specify the column to be filtered by specifying the filterable property of the column", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 01dcd330fc4..a225977b063 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -5471,6 +5471,9 @@ "BootstrapBlazor.Server.Components.Samples.Table.TablesFilter": { "MultiFilterTitle": "多选列表筛选", "MultiFilterIntro": "通过 FilterTemplate 使用内置 MultiFilter 组件提供多选筛选功能", + "MultiFilterTips": "组件提供 ItemsOnGetItemsAsync 两种设置数据源方式", + "MultiFilterTipsLi1": "Items 适合数据量小且静态事先准备好的数据集合", + "MultiFilterTipsLi2": "OnGetItemsAsync 适合数据量大且动态的数据集合,出于性能考虑组件内部采用局域懒记载方式填装数据,即点开过滤窗口时才回调获得数据", "TablesFilterTitle": "筛选和排序功能", "TablesFilterDesc": "筛选可快速查找到自己想看的数据;排序可快速查找或对比数据。", "TablesFilterDescLi1": "对某一列数据进行筛选,通过指定列的 Filterable 属性来指定需要筛选的列",