/* eslint-disable */ // // Has eslint disabled because it's a node-renderer which is based on default // node-renderer from react-sortable-tree library with minor overrides, as is // recommended per their docs in case of severe necessity // remote URL: https://github.com/frontend-collective/react-sortable-tree/blob/a5c67fe168db6c3f11a768909d5435d21255cb43/src/node-renderer-default.js // import React from 'react'; import styled from 'styled-components'; import { isDescendant } from 'react-sortable-tree'; function classNames(...classes: any[]) { // Use Boolean constructor as a filter callback // Allows for loose type truthy/falsey checks // Boolean("") === false; // Boolean(false) === false; // Boolean(undefined) === false; // Boolean(null) === false; // Boolean(0) === false; // Boolean("classname") === true; return classes.filter(Boolean).join(' '); } const Container = styled.div` height: 100%; display: flex; flex-direction: row; align-items: center; `; const NodeRenderer = (props: any) => { const { scaffoldBlockPxWidth, toggleChildrenVisibility, connectDragPreview, connectDragSource, isDragging, canDrop, canDrag, node, title, moveHandle, subtitle, draggedNode, path, treeIndex, isSearchMatch, isSearchFocus, className, style, didDrop, treeId, isOver, // Not needed, but preserved for other renderers parentNode, // Needed for dndManager rowDirection, ...otherProps } = props; const nodeMoveHandle = moveHandle || node.moveHandle; const nodeTitle = title || node.title; const nodeSubtitle = subtitle || node.subtitle; const rowDirectionClass = rowDirection === 'rtl' ? 'rst__rtl' : null; let handle; if (canDrag) { if (typeof node.children === 'function' && node.expanded) { // Show a loading symbol on the handle when the children are expanded // and yet still defined by a function (a callback to fetch the children) handle = (