Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Bump deps.
Browse files Browse the repository at this point in the history
  • Loading branch information
nosferatu500 committed Feb 3, 2023
1 parent f81e4cf commit 09005de
Show file tree
Hide file tree
Showing 7 changed files with 1,266 additions and 1,080 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ style.css.map
# Error files
yarn-error.log

.vscode
.vscode
.eslintcache
54 changes: 27 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nosferatu500/react-sortable-tree",
"version": "4.2.1",
"version": "4.2.2",
"description": "Drag-and-drop sortable component for nested data and hierarchies",
"main": "./index.js",
"module": "./esm/index.js",
Expand All @@ -25,7 +25,7 @@
"build:storybook": "build-storybook -o build",
"clean": "rimraf dist",
"clean:storybook": "rimraf build",
"lint": "eslint '*.{js,json}' '{src,tests}/**/*.{ts,tsx}'",
"lint": "eslint '*.{js,json}' '{src,tests}/**/*.{ts,tsx}' --cache",
"prepublishOnly": "yarn build",
"release": "standard-version",
"storybook": "start-storybook -p ${PORT:-3001} -h 0.0.0.0",
Expand Down Expand Up @@ -73,57 +73,57 @@
"react-virtuoso": "^2.19.1"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.12",
"@babel/eslint-parser": "^7.19.1",
"@babel/helper-module-imports": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@babel/plugin-transform-react-jsx": "^7.20.13",
"@babel/preset-env": "^7.20.2",
"@babel/types": "^7.20.2",
"@babel/types": "^7.20.7",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-node-resolve": "^14.1.0",
"@rollup/plugin-typescript": "^8.5.0",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/addons": "^6.5.13",
"@storybook/react": "^6.5.13",
"@storybook/theming": "^6.5.13",
"@storybook/addons": "^6.5.16",
"@storybook/react": "^6.5.16",
"@storybook/theming": "^6.5.16",
"@types/babel-plugin-macros": "^2.8.5",
"@types/lodash.isequal": "^4.5.6",
"@types/react": "^17.0.52",
"@types/react": "^16.14.35",
"@types/react-dom": "^17.0.18",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"acorn-jsx": "^5.3.2",
"autoprefixer": "^10.4.13",
"babel-plugin-macros": "^3.1.0",
"esbuild": "^0.15.13",
"eslint": "^8.27.0",
"esbuild": "^0.17.5",
"eslint": "^8.33.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-sonarjs": "^0.16.0",
"eslint-plugin-storybook": "^0.6.7",
"eslint-plugin-unicorn": "^44.0.2",
"eslint-plugin-sonarjs": "^0.18.0",
"eslint-plugin-storybook": "^0.6.10",
"eslint-plugin-unicorn": "^45.0.2",
"json": "^11.0.0",
"postcss": "^8.4.18",
"prettier": "^2.7.1",
"postcss": "^8.4.21",
"prettier": "^2.8.3",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-dnd-touch-backend": "^14.1.1",
"react-dom": "^17.0.2",
"rimraf": "^3.0.2",
"rimraf": "^4.1.2",
"rollup": "^2.79.1",
"rollup-plugin-esbuild": "^4.10.1",
"rollup-plugin-esbuild": "^4.10.3",
"rollup-plugin-postcss": "^4.0.2",
"shx": "^0.3.4",
"tslib": "^2.4.1",
"typescript": "^4.8.4"
"tslib": "^2.5.0",
"typescript": "^4.9.5"
},
"peerDependencies": {
"react": ">=17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/node-renderer-default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const NodeRendererDefault: React.FC<NodeRendererProps> = function (props) {
typeof node.children === 'function' && node.expanded ? (
<div className="rst__loadingHandle">
<div className="rst__loadingCircle">
{[...Array.from({ length: 12 })].map((_, index) => (
{Array.from({ length: 12 }).map((_, index) => (
<div
key={index}
className={classnames(
Expand Down Expand Up @@ -178,7 +178,7 @@ const NodeRendererDefault: React.FC<NodeRendererProps> = function (props) {
<div
className={classnames(
'rst__rowContents',
!canDrag ? 'rst__rowContentsDragDisabled' : '',
canDrag ? '' : 'rst__rowContentsDragDisabled',
rowDirectionClass ?? ''
)}>
<div
Expand Down
12 changes: 5 additions & 7 deletions src/react-sortable-tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ const mergeTheme = (props) => {
// If all else fails, fall back to the default
if (props[propKey] === undefined) {
merged[propKey] =
typeof props.theme[propKey] !== 'undefined'
? props.theme[propKey]
: overridableDefaults[propKey]
props.theme[propKey] === undefined
? overridableDefaults[propKey]
: props.theme[propKey]
}
}

Expand Down Expand Up @@ -588,11 +588,9 @@ class ReactSortableTree extends Component {
isSearchMatch,
isSearchFocus,
}
const nodeProps = !generateNodeProps
? {}
: generateNodeProps(callbackParams)
const nodeProps = generateNodeProps ? generateNodeProps(callbackParams) : {}
const rowCanDrag =
typeof canDrag !== 'function' ? canDrag : canDrag(callbackParams)
typeof canDrag === 'function' ? canDrag(callbackParams) : canDrag

const sharedProps = {
treeIndex,
Expand Down
20 changes: 10 additions & 10 deletions src/utils/dnd-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ const getTargetDepth = (
let dragSourceInitialDepth = (monitor.getItem().path || []).length

// When adding node from external source
if (monitor.getItem().treeId !== treeId) {
if (monitor.getItem().treeId === treeId) {
// handle row direction support
const direction = dropTargetProps.rowDirection === 'rtl' ? -1 : 1

blocksOffset = Math.round(
(direction * monitor.getDifferenceFromInitialOffset().x) /
dropTargetProps.scaffoldBlockPxWidth
)
} else {
// Ignore the tree depth of the source, if it had any to begin with
dragSourceInitialDepth = 0

Expand All @@ -115,14 +123,6 @@ const getTargetDepth = (
} else {
blocksOffset = dropTargetProps.path.length
}
} else {
// handle row direction support
const direction = dropTargetProps.rowDirection === 'rtl' ? -1 : 1

blocksOffset = Math.round(
(direction * monitor.getDifferenceFromInitialOffset().x) /
dropTargetProps.scaffoldBlockPxWidth
)
}

let targetDepth = Math.min(
Expand All @@ -131,7 +131,7 @@ const getTargetDepth = (
)

// If a maxDepth is defined, constrain the target depth
if (typeof maxDepth !== 'undefined' && maxDepth !== undefined) {
if (maxDepth !== undefined && maxDepth !== undefined) {
const draggedNode = monitor.getItem().node
const draggedChildDepth = getDepth(draggedNode)

Expand Down
6 changes: 3 additions & 3 deletions src/utils/tree-data-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const getNodeDataAtTreeIndexOrNextIndex = ({
isPseudoRoot: boolean
}) => {
// The pseudo-root is not considered in the path
const selfPath = !isPseudoRoot
? [...path, getNodeKey({ node, treeIndex: currentIndex })]
: []
const selfPath = isPseudoRoot
? []
: [...path, getNodeKey({ node, treeIndex: currentIndex })]

// Return target node when found
if (currentIndex === targetIndex) {
Expand Down
Loading

0 comments on commit 09005de

Please sign in to comment.