Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nosferatu500/react-sortable-tree

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nosferatu500/react-sortable-tree - npm Package Compare versions

Comparing version 4.0.0-alpha.3 to 4.0.0-beta.0

39

esm/node-renderer-default.d.ts

@@ -1,6 +0,39 @@

import { Component } from 'react';
import React from 'react';
import './node-renderer-default.css';
declare class NodeRendererDefault extends Component {
render(): JSX.Element;
import { NodeData, TreeItem, NumberOrStringArray } from '.';
import { ConnectDragPreview, ConnectDragSource } from 'react-dnd';
export interface NodeRendererProps {
node: TreeItem;
path: NumberOrStringArray;
treeIndex: number;
isSearchMatch: boolean;
isSearchFocus: boolean;
canDrag: boolean;
scaffoldBlockPxWidth: number;
toggleChildrenVisibility?(data: NodeData): void | undefined | null;
buttons?: JSX.Element[] | undefined;
className?: string | undefined;
style?: React.CSSProperties | undefined;
title?: ((data: NodeData) => JSX.Element | JSX.Element) | undefined;
subtitle?: ((data: NodeData) => JSX.Element | JSX.Element) | undefined;
icons?: JSX.Element[] | undefined;
lowerSiblingCounts: number[];
swapDepth?: number | undefined;
swapFrom?: number | undefined;
swapLength?: number | undefined;
listIndex: number;
treeId: string;
rowDirection?: 'ltr' | 'rtl' | string | undefined;
connectDragPreview: ConnectDragPreview;
connectDragSource: ConnectDragSource;
parentNode?: TreeItem | undefined;
startDrag: any;
endDrag: any;
isDragging: boolean;
didDrop: boolean;
draggedNode?: TreeItem | undefined;
isOver: boolean;
canDrop?: boolean | undefined;
}
declare const NodeRendererDefault: React.FC<NodeRendererProps>;
export default NodeRendererDefault;

23

esm/placeholder-renderer-default.d.ts

@@ -1,17 +0,10 @@

import PropTypes from 'prop-types';
import React from 'react';
import './placeholder-renderer-default.css';
declare const PlaceholderRendererDefault: {
({ isOver, canDrop }: {
isOver: any;
canDrop: any;
}): JSX.Element;
defaultProps: {
isOver: boolean;
canDrop: boolean;
};
propTypes: {
isOver: PropTypes.Requireable<boolean>;
canDrop: PropTypes.Requireable<boolean>;
};
};
import { TreeItem } from '.';
export interface PlaceholderRendererProps {
isOver: boolean;
canDrop: boolean;
draggedNode: TreeItem;
}
declare const PlaceholderRendererDefault: React.FC<PlaceholderRendererProps>;
export default PlaceholderRendererDefault;

@@ -1,6 +0,33 @@

import { Component } from 'react';
import React from 'react';
import './tree-node.css';
declare class TreeNode extends Component {
render(): any;
import { ConnectDropTarget } from 'react-dnd';
import { NumberOrStringArray, TreeItem, TreePath } from '.';
export interface TreeNode {
node: TreeItem;
}
export interface FlatDataItem extends TreeNode, TreePath {
lowerSiblingCounts: number[];
parentNode: TreeItem;
}
export interface TreeRendererProps {
treeIndex: number;
treeId: string;
swapFrom?: number | undefined;
swapDepth?: number | undefined;
swapLength?: number | undefined;
scaffoldBlockPxWidth: number;
lowerSiblingCounts: number[];
rowDirection?: 'ltr' | 'rtl' | string | undefined;
listIndex: number;
children: JSX.Element[];
style?: React.CSSProperties | undefined;
connectDropTarget: ConnectDropTarget;
isOver: boolean;
canDrop?: boolean | undefined;
draggedNode?: TreeItem | undefined;
getPrevRow: () => FlatDataItem | null;
node: TreeItem;
path: NumberOrStringArray;
}
declare const TreeNode: React.FC<TreeRendererProps>;
export default TreeNode;

@@ -1,5 +0,14 @@

import { Component } from 'react';
declare class TreePlaceholder extends Component {
render(): any;
}
import React from 'react';
import { TreeItem } from '.';
import { ConnectDropTarget } from 'react-dnd';
declare type TreePlaceholderProps = {
children: any;
connectDropTarget: ConnectDropTarget;
isOver: boolean;
canDrop: boolean;
draggedNode: TreeItem;
treeId: string;
drop: any;
};
declare const TreePlaceholder: (props: TreePlaceholderProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export default TreePlaceholder;

@@ -1,6 +0,39 @@

import { Component } from 'react';
import React from 'react';
import './node-renderer-default.css';
declare class NodeRendererDefault extends Component {
render(): JSX.Element;
import { NodeData, TreeItem, NumberOrStringArray } from '.';
import { ConnectDragPreview, ConnectDragSource } from 'react-dnd';
export interface NodeRendererProps {
node: TreeItem;
path: NumberOrStringArray;
treeIndex: number;
isSearchMatch: boolean;
isSearchFocus: boolean;
canDrag: boolean;
scaffoldBlockPxWidth: number;
toggleChildrenVisibility?(data: NodeData): void | undefined | null;
buttons?: JSX.Element[] | undefined;
className?: string | undefined;
style?: React.CSSProperties | undefined;
title?: ((data: NodeData) => JSX.Element | JSX.Element) | undefined;
subtitle?: ((data: NodeData) => JSX.Element | JSX.Element) | undefined;
icons?: JSX.Element[] | undefined;
lowerSiblingCounts: number[];
swapDepth?: number | undefined;
swapFrom?: number | undefined;
swapLength?: number | undefined;
listIndex: number;
treeId: string;
rowDirection?: 'ltr' | 'rtl' | string | undefined;
connectDragPreview: ConnectDragPreview;
connectDragSource: ConnectDragSource;
parentNode?: TreeItem | undefined;
startDrag: any;
endDrag: any;
isDragging: boolean;
didDrop: boolean;
draggedNode?: TreeItem | undefined;
isOver: boolean;
canDrop?: boolean | undefined;
}
declare const NodeRendererDefault: React.FC<NodeRendererProps>;
export default NodeRendererDefault;
{
"name": "@nosferatu500/react-sortable-tree",
"version": "4.0.0-alpha.3",
"version": "4.0.0-beta.0",
"description": "Drag-and-drop sortable component for nested data and hierarchies",

@@ -42,3 +42,3 @@ "main": "./index.js",

"dependencies": {
"@nosferatu500/react-dnd-scrollzone": "^1.0.14",
"@nosferatu500/react-dnd-scrollzone": "^2.0.0",
"lodash.isequal": "^4.5.0",

@@ -45,0 +45,0 @@ "prop-types": "^15.7.2",

@@ -1,17 +0,10 @@

import PropTypes from 'prop-types';
import React from 'react';
import './placeholder-renderer-default.css';
declare const PlaceholderRendererDefault: {
({ isOver, canDrop }: {
isOver: any;
canDrop: any;
}): JSX.Element;
defaultProps: {
isOver: boolean;
canDrop: boolean;
};
propTypes: {
isOver: PropTypes.Requireable<boolean>;
canDrop: PropTypes.Requireable<boolean>;
};
};
import { TreeItem } from '.';
export interface PlaceholderRendererProps {
isOver: boolean;
canDrop: boolean;
draggedNode: TreeItem;
}
declare const PlaceholderRendererDefault: React.FC<PlaceholderRendererProps>;
export default PlaceholderRendererDefault;

@@ -1,6 +0,33 @@

import { Component } from 'react';
import React from 'react';
import './tree-node.css';
declare class TreeNode extends Component {
render(): any;
import { ConnectDropTarget } from 'react-dnd';
import { NumberOrStringArray, TreeItem, TreePath } from '.';
export interface TreeNode {
node: TreeItem;
}
export interface FlatDataItem extends TreeNode, TreePath {
lowerSiblingCounts: number[];
parentNode: TreeItem;
}
export interface TreeRendererProps {
treeIndex: number;
treeId: string;
swapFrom?: number | undefined;
swapDepth?: number | undefined;
swapLength?: number | undefined;
scaffoldBlockPxWidth: number;
lowerSiblingCounts: number[];
rowDirection?: 'ltr' | 'rtl' | string | undefined;
listIndex: number;
children: JSX.Element[];
style?: React.CSSProperties | undefined;
connectDropTarget: ConnectDropTarget;
isOver: boolean;
canDrop?: boolean | undefined;
draggedNode?: TreeItem | undefined;
getPrevRow: () => FlatDataItem | null;
node: TreeItem;
path: NumberOrStringArray;
}
declare const TreeNode: React.FC<TreeRendererProps>;
export default TreeNode;

@@ -1,5 +0,14 @@

import { Component } from 'react';
declare class TreePlaceholder extends Component {
render(): any;
}
import React from 'react';
import { TreeItem } from '.';
import { ConnectDropTarget } from 'react-dnd';
declare type TreePlaceholderProps = {
children: any;
connectDropTarget: ConnectDropTarget;
isOver: boolean;
canDrop: boolean;
draggedNode: TreeItem;
treeId: string;
drop: any;
};
declare const TreePlaceholder: (props: TreePlaceholderProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export default TreePlaceholder;

@@ -1,1 +0,1 @@

export default function classnames(...classes: any[]): string;
export declare const classnames: (...classes: string[]) => string;

@@ -1,9 +0,37 @@

export declare function defaultGetNodeKey({ treeIndex }: {
treeIndex: any;
}): any;
export declare function defaultSearchMethod({ node, path, treeIndex, searchQuery }: {
node: any;
path: any;
treeIndex: any;
/// <reference types="react" />
export interface GetTreeItemChildren {
done: (children: TreeItem[]) => void;
node: TreeItem;
path: NumberOrStringArray;
lowerSiblingCounts: number[];
treeIndex: number;
}
export declare type GetTreeItemChildrenFn = (data: GetTreeItemChildren) => void;
export declare type GetNodeKeyFunction = (data: TreeIndex & TreeNode) => string | number;
export declare type NumberOrStringArray = Array<string | number>;
export interface TreeItem {
title?: React.ReactNode | undefined;
subtitle?: React.ReactNode | undefined;
expanded?: boolean | undefined;
children?: TreeItem[] | GetTreeItemChildrenFn | undefined;
[x: string]: any;
}
export interface TreeNode {
node: TreeItem;
}
export interface TreePath {
path: NumberOrStringArray | number;
}
export interface TreeIndex {
treeIndex: number;
}
export interface FullTree {
treeData: TreeItem[] | undefined | null;
}
export interface NodeData extends TreeNode, TreePath, TreeIndex {
}
export interface SearchData extends NodeData {
searchQuery: any;
}): any;
}
export declare const defaultGetNodeKey: ({ treeIndex }: TreeIndex) => number;
export declare const defaultSearchMethod: ({ node, path, treeIndex, searchQuery, }: SearchData) => boolean;

@@ -1,1 +0,1 @@

export declare function slideRows(rows: any, fromIndex: any, toIndex: any, count?: number): any[];
export declare const slideRows: (rows: any[], fromIndex: number, toIndex: number, count?: number) => any[];

@@ -1,5 +0,14 @@

export declare function getDescendantCount({ node, ignoreCollapsed }: {
node: any;
import { FullTree, GetNodeKeyFunction, NodeData, SearchData, TreeIndex, TreeItem, TreeNode, TreePath } from '..';
export declare type WalkAndMapFunctionParameters = FullTree & {
getNodeKey: GetNodeKeyFunction;
callback: Function;
ignoreCollapsed?: boolean | undefined;
}): number;
};
export interface FlatDataItem extends TreeNode, TreePath {
lowerSiblingCounts: number[];
parentNode: TreeItem;
}
export declare const getDescendantCount: ({ node, ignoreCollapsed, }: TreeNode & {
ignoreCollapsed?: boolean | undefined;
}) => number;
/**

@@ -12,5 +21,3 @@ * Count all the visible (expanded) descendants in the tree data.

*/
export declare function getVisibleNodeCount({ treeData }: {
treeData: any;
}): any;
export declare const getVisibleNodeCount: ({ treeData }: FullTree) => number;
/**

@@ -29,7 +36,8 @@ * Get the <targetIndex>th visible node in the tree data.

*/
export declare function getVisibleNodeInfoAtIndex({ treeData, index: targetIndex, getNodeKey, }: {
treeData: any;
index: any;
getNodeKey: any;
}): any;
export declare const getVisibleNodeInfoAtIndex: ({ treeData, index: targetIndex, getNodeKey, }: FullTree & {
index: number;
getNodeKey: GetNodeKeyFunction;
}) => (TreeNode & TreePath & {
lowerSiblingCounts: number[];
}) | null;
/**

@@ -45,8 +53,3 @@ * Walk descendants depth-first and call a callback on each

*/
export declare function walk({ treeData, getNodeKey, callback, ignoreCollapsed, }: {
treeData: any;
getNodeKey: any;
callback: any;
ignoreCollapsed?: boolean | undefined;
}): void;
export declare const walk: ({ treeData, getNodeKey, callback, ignoreCollapsed, }: WalkAndMapFunctionParameters) => void;
/**

@@ -63,8 +66,3 @@ * Perform a depth-first transversal of the descendants and

*/
export declare function map({ treeData, getNodeKey, callback, ignoreCollapsed, }: {
treeData: any;
getNodeKey: any;
callback: any;
ignoreCollapsed?: boolean | undefined;
}): any;
export declare const map: ({ treeData, getNodeKey, callback, ignoreCollapsed, }: WalkAndMapFunctionParameters) => TreeItem[];
/**

@@ -78,6 +76,5 @@ * Expand or close every node in the tree

*/
export declare function toggleExpandedForAll({ treeData, expanded }: {
treeData: any;
export declare const toggleExpandedForAll: ({ treeData, expanded, }: FullTree & {
expanded?: boolean | undefined;
}): any;
}) => TreeItem[];
/**

@@ -94,9 +91,7 @@ * Replaces node at path with object, or callback-defined object

*/
export declare function changeNodeAtPath({ treeData, path, newNode, getNodeKey, ignoreCollapsed, }: {
treeData: any;
path: any;
newNode: any;
getNodeKey: any;
export declare const changeNodeAtPath: ({ treeData, path, newNode, getNodeKey, ignoreCollapsed, }: FullTree & TreePath & {
newNode: Function | any;
getNodeKey: GetNodeKeyFunction;
ignoreCollapsed?: boolean | undefined;
}): any;
}) => TreeItem[];
/**

@@ -112,8 +107,6 @@ * Removes the node at the specified path and returns the resulting treeData.

*/
export declare function removeNodeAtPath({ treeData, path, getNodeKey, ignoreCollapsed, }: {
treeData: any;
path: any;
getNodeKey: any;
export declare const removeNodeAtPath: ({ treeData, path, getNodeKey, ignoreCollapsed, }: FullTree & TreePath & {
getNodeKey: GetNodeKeyFunction;
ignoreCollapsed?: boolean | undefined;
}): any;
}) => TreeItem[];
/**

@@ -132,12 +125,6 @@ * Removes the node at the specified path and returns the resulting treeData.

*/
export declare function removeNode({ treeData, path, getNodeKey, ignoreCollapsed, }: {
treeData: any;
path: any;
getNodeKey: any;
export declare const removeNode: ({ treeData, path, getNodeKey, ignoreCollapsed, }: FullTree & TreePath & {
getNodeKey: GetNodeKeyFunction;
ignoreCollapsed?: boolean | undefined;
}): {
treeData: any;
node: null;
treeIndex: null;
};
}) => (FullTree & TreeNode & TreeIndex) | null;
/**

@@ -153,8 +140,6 @@ * Gets the node at the specified path

*/
export declare function getNodeAtPath({ treeData, path, getNodeKey, ignoreCollapsed, }: {
treeData: any;
path: any;
getNodeKey: any;
export declare const getNodeAtPath: ({ treeData, path, getNodeKey, ignoreCollapsed, }: FullTree & TreePath & {
getNodeKey: GetNodeKeyFunction;
ignoreCollapsed?: boolean | undefined;
}): null;
}) => (TreeNode & TreeIndex) | null;
/**

@@ -175,17 +160,10 @@ * Adds the node to the specified parent and returns the resulting treeData.

*/
export declare function addNodeUnderParent({ treeData, newNode, parentKey, getNodeKey, ignoreCollapsed, expandParent, addAsFirstChild, }: {
treeData: any;
newNode: any;
parentKey?: null | undefined;
getNodeKey: any;
export declare const addNodeUnderParent: ({ treeData, newNode, parentKey, getNodeKey, ignoreCollapsed, expandParent, addAsFirstChild, }: FullTree & {
newNode: TreeItem;
parentKey?: number | string | undefined | null;
getNodeKey: GetNodeKeyFunction;
ignoreCollapsed?: boolean | undefined;
expandParent?: boolean | undefined;
addAsFirstChild?: boolean | undefined;
}): {
treeData: any[];
treeIndex: any;
} | {
treeData: any;
treeIndex: null;
};
}) => FullTree & TreeIndex;
/**

@@ -208,15 +186,11 @@ * Insert a node into the tree at the given depth, after the minimum index

*/
export declare function insertNode({ treeData, depth: targetDepth, minimumTreeIndex, newNode, getNodeKey, ignoreCollapsed, expandParent, }: {
treeData: any;
depth: any;
minimumTreeIndex: any;
newNode: any;
getNodeKey?: (() => void) | undefined;
export declare const insertNode: ({ treeData, depth: targetDepth, minimumTreeIndex, newNode, getNodeKey, ignoreCollapsed, expandParent, }: FullTree & {
depth: number;
newNode: TreeItem;
minimumTreeIndex: number;
ignoreCollapsed?: boolean | undefined;
expandParent?: boolean | undefined;
}): {
treeData: any;
treeIndex: any;
path: any[];
parentNode: any;
getNodeKey: GetNodeKeyFunction;
}) => FullTree & TreeIndex & TreePath & {
parentNode: TreeItem | null;
};

@@ -236,7 +210,6 @@ /**

*/
export declare function getFlatDataFromTree({ treeData, getNodeKey, ignoreCollapsed, }: {
treeData: any;
getNodeKey: any;
export declare const getFlatDataFromTree: ({ treeData, getNodeKey, ignoreCollapsed, }: FullTree & {
getNodeKey: GetNodeKeyFunction;
ignoreCollapsed?: boolean | undefined;
}): any[];
}) => FlatDataItem[];
/**

@@ -253,3 +226,3 @@ * Generate a tree structure from flat data.

*/
export declare function getTreeFromFlatData({ flatData, getKey, getParentKey, rootKey, }: {
export declare const getTreeFromFlatData: ({ flatData, getKey, getParentKey, rootKey, }: {
flatData: any;

@@ -259,3 +232,3 @@ getKey?: ((node: any) => any) | undefined;

rootKey?: string | undefined;
}): any;
}) => any;
/**

@@ -269,3 +242,3 @@ * Check if a node is a descendant of another node.

*/
export declare function isDescendant(older: any, younger: any): any;
export declare const isDescendant: (older: TreeItem, younger: TreeItem) => boolean;
/**

@@ -279,3 +252,3 @@ * Get the maximum depth of the children (the depth of the root node is 0).

*/
export declare function getDepth(node: any, depth?: number): any;
export declare const getDepth: (node: TreeItem, depth?: number | undefined) => number;
/**

@@ -298,13 +271,11 @@ * Find nodes matching a search query in the tree,

*/
export declare function find({ getNodeKey, treeData, searchQuery, searchMethod, searchFocusOffset, expandAllMatchPaths, expandFocusMatchPaths, }: {
getNodeKey: any;
treeData: any;
searchQuery: any;
searchMethod: any;
searchFocusOffset: any;
export declare const find: ({ getNodeKey, treeData, searchQuery, searchMethod, searchFocusOffset, expandAllMatchPaths, expandFocusMatchPaths, }: FullTree & {
getNodeKey: GetNodeKeyFunction;
searchQuery?: string | number | undefined;
searchMethod: (data: SearchData) => boolean;
searchFocusOffset?: number | undefined;
expandAllMatchPaths?: boolean | undefined;
expandFocusMatchPaths?: boolean | undefined;
}): {
matches: any[];
treeData: any;
};
}) => {
matches: NodeData[];
} & FullTree;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc