All Downloads are FREE. Search and download functionalities are using the official Maven repository.

plugins.SideBar.NavItemContainer.tsx Maven / Gradle / Ivy

There is a newer version: 7.28.2
Show newest version
import React, { useContext } from 'react'
import classNames from 'classnames'

import { getFromSource, metaPropsType } from '../utils'
import { ITEM_SRC } from '../constants'
import { Item, FactoryComponent } from '../CommonMenuTypes'
import { DataSourceModels } from '../../core/datasource/const'
import { FactoryContext } from '../../core/factory/context'
import { FactoryLevels } from '../../core/factory/factoryLevels'
import { parseExpression } from '../../core/Expression/parse'

interface SidebarItemContainer {
    className?: string
    itemProps: Item
    activeId: string
    sidebarOpen: boolean
    showContent: boolean
    isMiniView: boolean
    isStaticView: boolean
    datasources: metaPropsType[]
    datasource: string
    models: DataSourceModels
    level?: number
}

export function NavItemContainer({
    className,
    itemProps,
    activeId,
    sidebarOpen,
    showContent,
    isMiniView,
    isStaticView,
    datasources,
    datasource,
    models,
    level = 1,
}: SidebarItemContainer) {
    const item = getFromSource(itemProps, datasources, models, datasource)
    const { src } = item

    const { getComponent } = useContext(FactoryContext)
    const FactoryComponent: FactoryComponent = getComponent(src, FactoryLevels.SIDEBAR_ITEM)

    if (!FactoryComponent) { return null }

    const { title } = item

    if (parseExpression(title)) { return null }

    return (
        
  • ) } export default NavItemContainer




    © 2015 - 2025 Weber Informatics LLC | Privacy Policy