Skip to content

Commit 8a68e03

Browse files
authored
fix(SorableList): generate two client item when use clone mode (#630)
* fix: 修复 clone 模式下生成两个元素问题 * chore: bump version 9.0.4
1 parent f0f86bb commit 8a68e03

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

src/components/BootstrapBlazor.Sortable/BootstrapBlazor.Sortable.csproj

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

3-
<PropertyGroup>
4-
<Version>9.0.3</Version>
3+
<PropertyGroup Condition="'$(VisualStudioVersion)' == '17.0'">
4+
<Version>9.0.4</Version>
5+
</PropertyGroup>
6+
7+
<PropertyGroup Condition="'$(VisualStudioVersion)' == '18.0'">
8+
<Version>10.0.0-rc.2.1.0</Version>
59
</PropertyGroup>
610

711
<PropertyGroup>
812
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components Sortable</PackageTags>
913
<Description>Bootstrap UI components extensions of SortableJS</Description>
1014
</PropertyGroup>
1115

12-
<ItemGroup>
16+
<ItemGroup Condition="'$(VisualStudioVersion)' == '17.0'">
1317
<PackageReference Include="BootstrapBlazor" Version="9.9.1" />
1418
</ItemGroup>
1519

20+
<ItemGroup Condition="'$(VisualStudioVersion)' == '18.0'">
21+
<PackageReference Include="BootstrapBlazor" Version="10.0.0-rc.2.1.0" />
22+
</ItemGroup>
23+
1624
<ItemGroup>
1725
<Using Include="BootstrapBlazor.Components" />
1826
</ItemGroup>

src/components/BootstrapBlazor.Sortable/Components/SortableList.razor.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const initSortable = (id, element, invoke, op) => {
104104
}
105105

106106
if (op.triggerAdd) {
107-
op.onAdd = event => {
107+
op.onAdd = async event => {
108108
var closestParent = event.from.closest('.bb-sortable');
109109
if (closestParent) {
110110
const items = [];
@@ -116,7 +116,11 @@ const initSortable = (id, element, invoke, op) => {
116116
else {
117117
items.push({ oldIndex: event.oldIndex, newIndex: event.newIndex, FromId: closestParent.id });
118118
}
119-
invoke.invokeMethodAsync('TriggerAdd', items);
119+
120+
await invoke.invokeMethodAsync('TriggerAdd', items);
121+
if (event.pullMode === 'clone') {
122+
event.item.remove();
123+
}
120124
}
121125
}
122126
}

0 commit comments

Comments
 (0)