mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Add missing placeholderRenderer prop
This commit is contained in:
Vendored
+9
@@ -87,6 +87,14 @@ export interface NodeRendererProps {
|
||||
canDrop?: boolean;
|
||||
}
|
||||
|
||||
export type PlaceholderRenderer = React.ComponentClass<PlaceholderRendererProps>;
|
||||
|
||||
export interface PlaceholderRendererProps {
|
||||
isOver: boolean;
|
||||
canDrop: boolean;
|
||||
draggedNode: {[index: string]: any};
|
||||
}
|
||||
|
||||
type NumberArrayOrStringArray = string[] | number[];
|
||||
|
||||
export interface ReactSortableTreeProps {
|
||||
@@ -113,6 +121,7 @@ export interface ReactSortableTreeProps {
|
||||
isVirtualized?: boolean;
|
||||
nodeContentRenderer?: NodeRenderer;
|
||||
dndType?: string;
|
||||
placeholderRenderer?: PlaceholderRenderer;
|
||||
}
|
||||
|
||||
declare const SortableTree: React.ComponentClass<ReactSortableTreeProps>;
|
||||
|
||||
@@ -11,10 +11,18 @@ import SortableTree,
|
||||
ExtendedNodeData,
|
||||
FullTree,
|
||||
OnVisibilityToggleData,
|
||||
PreviousAnNextLocation
|
||||
PreviousAnNextLocation,
|
||||
PlaceholderRendererProps
|
||||
} from "react-sortable-tree";
|
||||
import { ListProps, ListRowRenderer } from "react-virtualized";
|
||||
|
||||
class PlaceholderRenderer extends React.Component<PlaceholderRendererProps> {
|
||||
render() {
|
||||
const backgroundColor = this.props.isOver ? 'green' : 'red';
|
||||
return <div style={{backgroundColor}}>Custom Placeholder class</div>;
|
||||
}
|
||||
}
|
||||
|
||||
class Test extends React.Component {
|
||||
render() {
|
||||
const treeData = [
|
||||
@@ -55,6 +63,7 @@ class Test extends React.Component {
|
||||
isVirtualized={true}
|
||||
nodeContentRenderer={nodeRenderer}
|
||||
dndType="testNodeType"
|
||||
placeholderRenderer={PlaceholderRenderer}
|
||||
/>
|
||||
<SortableTreeWithoutDndContext
|
||||
treeData={[{title: "Title", subtitle: "Subtitle", children: []}]}
|
||||
|
||||
Reference in New Issue
Block a user