From 1b52c4a7b8025d9ca1ff72d1c335ec5e51ebb6b7 Mon Sep 17 00:00:00 2001 From: James Yeung Date: Mon, 9 Jan 2023 15:00:32 +0800 Subject: [PATCH] fix(module: transfer): DataSource refresh (#2998) --- components/transfer/Transfer.razor.cs | 6 +++++- components/transfer/TransferItem.cs | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/components/transfer/Transfer.razor.cs b/components/transfer/Transfer.razor.cs index 600b6cf8..95d84ed6 100644 --- a/components/transfer/Transfer.razor.cs +++ b/components/transfer/Transfer.razor.cs @@ -92,7 +92,6 @@ namespace AntDesign ClassMapper .Add(PrefixName) .If($"{PrefixName}-rtl", () => RTL); - } public override async Task SetParametersAsync(ParameterView parameters) @@ -108,6 +107,11 @@ namespace AntDesign needRefresh |= SelectedKeys != newSelectedKeys; } + if (parameters.TryGetValue(nameof(DataSource), out IList dataSource)) + { + needRefresh |= DataSource == null || dataSource == null || DataSource.SequenceEqual(dataSource); + } + await base.SetParametersAsync(parameters); if (needRefresh) diff --git a/components/transfer/TransferItem.cs b/components/transfer/TransferItem.cs index 153fb0bd..43435d8f 100644 --- a/components/transfer/TransferItem.cs +++ b/components/transfer/TransferItem.cs @@ -2,7 +2,7 @@ namespace AntDesign { - public class TransferItem + public record struct TransferItem { public string Key { get; set; } = ""; @@ -10,10 +10,14 @@ namespace AntDesign public string Description { get; set; } = ""; - public bool Disabled { get; set; } + public bool Disabled { get; set; } = false; private readonly IDictionary _properties = new Dictionary(); + public TransferItem() + { + } + public object this[string index] { get