Skip to content

Commit ed34e1e

Browse files
committed
react-dnd: v14.0.4 -> v16.0.1
1 parent 9943896 commit ed34e1e

File tree

10 files changed

+463
-454
lines changed

10 files changed

+463
-454
lines changed

package-lock.json

Lines changed: 44 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"postcss": "^8.5.6",
8484
"prettier": "^3.6.2",
8585
"react": "^18.3.1",
86-
"react-dnd-touch-backend": "^14.1.1",
86+
"react-dnd-touch-backend": "^16.0.1",
8787
"react-dom": "^18.3.1",
8888
"rollup": "^4.53.3",
8989
"rollup-plugin-dts": "^6.2.3",
@@ -94,13 +94,13 @@
9494
},
9595
"peerDependencies": {
9696
"react": "^18.3.1",
97-
"react-dnd": "14.0.4",
97+
"react-dnd": "^16.0.1",
9898
"react-dom": "^18.3.1"
9999
},
100100
"dependencies": {
101101
"lodash.isequal": "^4.5.0",
102-
"react-dnd": "14.0.4",
103-
"react-dnd-html5-backend": "^14.1.0",
102+
"react-dnd": "^16.0.1",
103+
"react-dnd-html5-backend": "^16.0.1",
104104
"virtua": "^0.38.5"
105105
},
106106
"browserslist": {

src/node-renderer-default.tsx

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ const NodeRendererDefault: React.FC<NodeRendererProps> = (props) => {
107107
</div>
108108
</div>
109109
) : (
110-
connectDragSource(<div className="rst__moveHandle" />, {
111-
dropEffect: 'copy',
112-
})
110+
<div
111+
ref={connectDragSource}
112+
className="rst__moveHandle"
113+
/>
113114
)
114115
}
115116

@@ -158,71 +159,70 @@ const NodeRendererDefault: React.FC<NodeRendererProps> = (props) => {
158159

159160
<div className={classnames('rst__rowWrapper', rowDirectionClass ?? '')}>
160161
{/* Set the row preview to be used during drag and drop */}
161-
{connectDragPreview(
162+
<div
163+
ref={connectDragPreview}
164+
className={classnames(
165+
'rst__row',
166+
isLandingPadActive ? 'rst__rowLandingPad' : '',
167+
isLandingPadActive && !canDrop ? 'rst__rowCancelPad' : '',
168+
isSearchMatch ? 'rst__rowSearchMatch' : '',
169+
isSearchFocus ? 'rst__rowSearchFocus' : '',
170+
rowDirectionClass ?? '',
171+
className ?? ''
172+
)}
173+
style={{
174+
opacity: isDraggedDescendant ? 0.5 : 1,
175+
...style,
176+
}}>
177+
{handle}
178+
162179
<div
163180
className={classnames(
164-
'rst__row',
165-
isLandingPadActive ? 'rst__rowLandingPad' : '',
166-
isLandingPadActive && !canDrop ? 'rst__rowCancelPad' : '',
167-
isSearchMatch ? 'rst__rowSearchMatch' : '',
168-
isSearchFocus ? 'rst__rowSearchFocus' : '',
169-
rowDirectionClass ?? '',
170-
className ?? ''
171-
)}
172-
style={{
173-
opacity: isDraggedDescendant ? 0.5 : 1,
174-
...style,
175-
}}>
176-
{handle}
177-
181+
'rst__rowContents',
182+
canDrag ? '' : 'rst__rowContentsDragDisabled',
183+
rowDirectionClass ?? ''
184+
)}>
178185
<div
179186
className={classnames(
180-
'rst__rowContents',
181-
canDrag ? '' : 'rst__rowContentsDragDisabled',
187+
'rst__rowLabel',
182188
rowDirectionClass ?? ''
183189
)}>
184-
<div
190+
<span
185191
className={classnames(
186-
'rst__rowLabel',
187-
rowDirectionClass ?? ''
192+
'rst__rowTitle',
193+
node.subtitle ? 'rst__rowTitleWithSubtitle' : ''
188194
)}>
189-
<span
190-
className={classnames(
191-
'rst__rowTitle',
192-
node.subtitle ? 'rst__rowTitleWithSubtitle' : ''
193-
)}>
194-
{typeof nodeTitle === 'function'
195-
? nodeTitle({
196-
node,
197-
path,
198-
treeIndex,
199-
})
200-
: nodeTitle}
201-
</span>
195+
{typeof nodeTitle === 'function'
196+
? nodeTitle({
197+
node,
198+
path,
199+
treeIndex,
200+
})
201+
: nodeTitle}
202+
</span>
202203

203-
{nodeSubtitle && (
204-
<span className="rst__rowSubtitle">
205-
{typeof nodeSubtitle === 'function'
206-
? nodeSubtitle({
207-
node,
208-
path,
209-
treeIndex,
210-
})
211-
: nodeSubtitle}
212-
</span>
213-
)}
214-
</div>
204+
{nodeSubtitle && (
205+
<span className="rst__rowSubtitle">
206+
{typeof nodeSubtitle === 'function'
207+
? nodeSubtitle({
208+
node,
209+
path,
210+
treeIndex,
211+
})
212+
: nodeSubtitle}
213+
</span>
214+
)}
215+
</div>
215216

216-
<div className="rst__rowToolbar">
217-
{buttons?.map((btn, index) => (
218-
<div key={index} className="rst__toolbarButton">
219-
{btn}
220-
</div>
221-
))}
222-
</div>
217+
<div className="rst__rowToolbar">
218+
{buttons?.map((btn, index) => (
219+
<div key={index} className="rst__toolbarButton">
220+
{btn}
221+
</div>
222+
))}
223223
</div>
224224
</div>
225-
)}
225+
</div>
226226
</div>
227227
</div>
228228
)

src/react-sortable-tree.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,6 @@ export type ReactSortableTreeProps = {
897897
// rtl support
898898
rowDirection?: string
899899

900-
debugMode?: boolean
901-
902900
overscan?: number | { main: number; reverse: number }
903901
}
904902

@@ -929,7 +927,6 @@ ReactSortableTree.defaultProps = {
929927
onDragStateChanged: () => { },
930928
onlyExpandSearchedNodes: false,
931929
rowDirection: 'ltr',
932-
debugMode: false,
933930
overscan: 0,
934931
virtuaRef: undefined,
935932
}
@@ -950,7 +947,7 @@ export const SortableTreeWithoutDndContext = (
950947

951948
export const SortableTree = (props: ReactSortableTreeProps) => {
952949
return (
953-
<DndProvider debugMode={props.debugMode} backend={HTML5Backend}>
950+
<DndProvider backend={HTML5Backend}>
954951
<SortableTreeWithoutDndContext {...props} />
955952
</DndProvider>
956953
)

0 commit comments

Comments
 (0)