UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

20 lines (19 loc) 1.74 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import * as React from 'react'; import SimpleButton from '../../components/SimpleButton'; import { useAdaptable } from '../AdaptableContext'; import { AdaptableObjectListItem } from '../Components/AdaptableObjectList/AdaptableObjectList'; import { Box, Flex } from '../../components/Flex'; export const Dependencies = (props) => { const adaptable = useAdaptable(); const dependencies = adaptable.api.teamSharingApi.internalApi.getSharedEntryDependencies(props.sharedEntity); return (_jsx(_Fragment, { children: dependencies.map((sharedEntity) => { const module = adaptable.ModuleService.getModuleById('TeamSharing'); const itemView = module.toView(sharedEntity); return (_jsx(Box, { as: "ul", className: "ab-Shared-Entity-Shared-Object twa:mb-2 twa:p-0 twa:flex twa:flex-col twa:gap-3", children: _jsx(AdaptableObjectListItem, { deleteTooltip: 'Cannot delete dependencies.', deleteDisabled: true, module: module, data: itemView }) }, sharedEntity.Uuid)); }) })); }; export const SharedEntityDependencies = (props) => { const [isExpanded, setIsExpanded] = React.useState(false); return (_jsxs(_Fragment, { children: [_jsxs(Flex, { children: [_jsx(Box, { className: 'ab-Adaptable-Object-List__Item__label twa:mr-3', children: "Dependencies" }), _jsx(Box, { className: "twa:my-2", children: isExpanded ? (_jsx(SimpleButton, { onClick: () => setIsExpanded(false), icon: "arrow-up", children: "Collapse" })) : (_jsx(SimpleButton, { onClick: () => setIsExpanded(true), icon: "arrow-down", children: "Expand" })) })] }), isExpanded && _jsx(Dependencies, { sharedEntity: props.data })] })); };