import React, { useCallback } from 'react';
import { makeStyles, Typography } from '@material-ui/core';
import { NodeLoader } from '../UI/feedback/NodeLoader';
import { InquiryTreeMenu } from './InquiryTreeMenu';
import clsx from 'clsx';
import NoEntityOpenedUrl from '../assets/unityIcons/NoEntityOpened.svg';
import { SvgIcon } from '../utilities/iconLibrary/SvgIcon';
const useStyles = makeStyles((theme) => ({
    root: {
        overflowX: 'auto'
    },
    nodeContainer: {
        width: '100%'
    },
    loader: {
        marginRight: theme.spacing(1),
        marginLeft: theme.spacing(1)
    },
    empty: {
        display: 'flex',
        justifyContent: 'center',
        alignItems: 'center'
    },
    emptyIcon: {
        textAlign: 'center'
    },
    emptyIconText: {
        color: theme.palette.secondary
    }
}));
export const NodeList = (props) => {
    const { menuItemsList, onSelectNode, onDropNode, selectedNodeId, selectedNodeParentId, expandAllClicked, classes: classProps, menuLoading, nodesRequested, sidebarExpanded, executeQueryAdHoc, catalogObjects, promotedEntities, treeStructureArr, setMenuList, treeViewMode, onExpandedChange } = props;
    const { root } = classProps || {};
    const classes = useStyles();
    const handleSelectNode = useCallback((selectedNode, menuIndex, selectedTree) => {
        onSelectNode(selectedNode, menuIndex, selectedTree);
    }, [onSelectNode]);
    return (React.createElement("div", { className: clsx(classes.root, root, !!!(menuItemsList === null || menuItemsList === void 0 ? void 0 : menuItemsList.length) && !menuLoading && classes.empty) }, !!!(menuItemsList === null || menuItemsList === void 0 ? void 0 : menuItemsList.length) && !menuLoading && (React.createElement("div", { className: classes.emptyIcon }, React.createElement(SvgIcon, { src: NoEntityOpenedUrl, size: 42 }), React.createElement(Typography, { variant: "subtitle1", className: classes.emptyIconText }, "No Entity Opene"))), (menuItemsList === null || menuItemsList === void 0 ? void 0 : menuItemsList.length) > 0 &&
        menuItemsList.map((menuItems, index) => (React.createElement("div", { key: menuItems.id, className: classes.nodeContainer }, React.createElement(InquiryTreeMenu, { menuItems: menuItems, onSelectNode: handleSelectNode, onDropNode: onDropNode, menuIndex: index, selectedNodeId: selectedNodeId, selectedNodeParentId: selectedNodeParentId, expandAllClicked: expandAllClicked, sidebarExpanded: sidebarExpanded, executeQueryAdHoc: executeQueryAdHoc, catalogObjects: catalogObjects, promotedEntities: promotedEntities, treeStructureArr: treeStructureArr || [], setMenuList: setMenuList, treeViewMode: treeViewMode, onExpandedChange: onExpandedChange })))), menuLoading && (React.createElement("div", { className: classes.loader }, React.createElement(NodeLoader, { loading: menuLoading, nodesRequested: nodesRequested })))));
};
//# sourceMappingURL=NodeList.js.map