Merge pull request #27923 from acemac/rst

react-sortable-tree missing prop 'shouldCopyOnOutsideDrop'
This commit is contained in:
Benjamin Lichtman
2018-08-16 15:08:05 -07:00
committed by GitHub
2 changed files with 10 additions and 0 deletions
+8
View File
@@ -3,6 +3,7 @@
// Definitions by: Wouter Hardeman <https://github.com/wouterhardeman>
// Jovica Zoric <https://github.com/jzoric>
// Kevin Perrine <https://github.com/kevinsperrine>
// Alex Maclean <https://github.com/acemac>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -70,6 +71,12 @@ export interface OnDragPreviousAndNextLocation extends PreviousAndNextLocation {
nextParent: TreeItem | null;
}
export interface ShouldCopyData {
node: TreeNode;
prevPath: NumberArrayOrStringArray;
prevTreeIndex: number;
}
export interface OnMovePreviousAndNextLocation extends PreviousAndNextLocation {
nextParentNode: TreeItem | null;
}
@@ -186,6 +193,7 @@ export interface ReactSortableTreeProps {
dndType?: string;
placeholderRenderer?: PlaceholderRenderer;
theme?: ThemeProps;
shouldCopyOnOutsideDrop?: boolean | ((data: ShouldCopyData) => boolean);
}
declare const SortableTree: React.ComponentClass<ReactSortableTreeProps>;
@@ -69,11 +69,13 @@ class Test extends React.Component {
dndType="testNodeType"
placeholderRenderer={PlaceholderRenderer}
theme={theme}
shouldCopyOnOutsideDrop={true}
/>
<SortableTreeWithoutDndContext
treeData={[{title: "Title", subtitle: "Subtitle", children: []}]}
onChange={(treeData: TreeItem[]) => {}}
style={{width: "100px"}}
shouldCopyOnOutsideDrop={() => false}
/>
</div>
);