import { observer } from 'mobx-react-lite';
import { GridCardItem } from './GridCardItem';
import React from 'react';
function _GridItem(props) {
    const { state, preset, index, rowIndex, columnIndex, renderItem, renderAddItem, actionCell, dragAndDrop, isOverlay, } = props;
    const renderType = state.getItemRenderTypeAt(index);
    const { collection: { query: { hasNonPersistentActiveFilters }, }, } = state;
    if (renderType === null) {
        return null;
    }
    if (renderType === 'trailing') {
        if (hasNonPersistentActiveFilters) {
            return null;
        }
        return (React.createElement("div", { key: "add-item", "data-hook": "grid-add-item-container", style: { height: '100%' }, onClick: () => state.onAddItemClick() }, renderAddItem?.()));
    }
    let child = (React.createElement(GridCardItem, { state: state, index: index, rowIndex: rowIndex, columnIndex: columnIndex, keyedItem: renderType, renderItem: renderItem, actionCell: actionCell, preset: preset }));
    if (dragAndDrop) {
        const { DraggableCard } = dragAndDrop;
        child = (React.createElement(DraggableCard, { id: renderType.key, index: renderType.index, state: state, isOverlay: isOverlay }, child));
    }
    return child;
}
export const GridItem = observer(_GridItem);
//# sourceMappingURL=GridItem.js.map