@namespace Connected.Components
@inherits UIComponent
@typeparam T


<div class="@Classname"
	 id="@($"drop-zone-{_id}")"
	 @ondrop="HandleDrop"
	 @ondragenter="HandleDragEnter"
	 @ondragleave="HandleDragLeave"
	 @attributes="CustomAttributes">

	@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="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>