You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/DropZone/DropZone.razor

69 lines
1.7 KiB

@namespace Connected.Components
@inherits UIComponent
@typeparam T
<div class="@Classname" style="@Style"
id="@($"mud-drop-zone-{_id}")"
@ondrop="HandleDrop"
@ondragenter="HandleDragEnter"
@ondragleave="HandleDragLeave"
@attributes="UserAttributes">
@ChildContent
@if (OnlyZone != true)
{
int index = 0;
var transactionIndex = Container?.GetTransactionIndex() ?? -1;
var items = GetItems();
@if (AllowReorder == true)
{
@if (items.Any() == false)
{
<div class="@PlaceholderClassname"></div>
}
else
{
if (transactionIndex == -1)
{
<div class="@PlaceholderClassname"></div>
}
<DynamicDropItem @key="_id" T="T"
Item="default"
ZoneIdentifier="@Identifier"
Disabled="true" HideContent="false"
Class="mud-drop-item-preview-start"/>
}
}
@foreach (var item in items)
{
var indexCopy = index;
<DynamicDropItem @key="@(item.GetHashCode())" T="T" DraggingClass="@GetItemDraggingClass()"
Item="item"
OnDragStarted="DragOperationStarted"
OnDragEnded="FinishedDragOperation"
ZoneIdentifier="@Identifier"
Disabled="@GetItemDisabledStatus(item)"
Index="indexCopy"
DisabledClass="@(DisabledClass ?? Container?.DisabledClass)">
@{
var renderer = GetItemTemplate();
}
@renderer(item)
</DynamicDropItem>
if (transactionIndex == indexCopy && IsOrign(indexCopy) == false )
{
<div class="@PlaceholderClassname"></div>
}
index++;
}
}
</div>