@atlaskit/tree
Advanced tools
Comparing version 1.0.1 to 1.1.0
# @atlaskit/tree | ||
## 1.1.0 | ||
- [minor] Introducing Drag&Drop functionality to atlaskit/tree [98fe2b5](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/98fe2b5) | ||
- [none] Updated dependencies [87cd977](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/87cd977) | ||
- @atlaskit/navigation@33.0.5 | ||
- [none] Updated dependencies [22efc08](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/22efc08) | ||
- @atlaskit/navigation@33.0.5 | ||
## 1.0.1 | ||
@@ -4,0 +13,0 @@ - [patch] Update docs, change dev deps [25d6e48](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/25d6e48) |
@@ -16,2 +16,11 @@ 'use strict'; | ||
var _tree = require('./utils/tree'); | ||
Object.defineProperty(exports, 'mutateTree', { | ||
enumerable: true, | ||
get: function get() { | ||
return _tree.mutateTree; | ||
} | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,1 +0,1 @@ | ||
'use strict'; | ||
"use strict"; |
@@ -6,4 +6,8 @@ 'use strict'; | ||
}); | ||
exports.isSamePath = exports.mutateTree = exports.flattenTree = undefined; | ||
exports.getTreePosition = exports.getParent = exports.getItem = exports.mutateTree = exports.flattenTree = undefined; | ||
var _getIterator2 = require('babel-runtime/core-js/get-iterator'); | ||
var _getIterator3 = _interopRequireDefault(_getIterator2); | ||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); | ||
@@ -21,3 +25,3 @@ | ||
var _handy = require('./handy'); | ||
var _path = require('./path'); | ||
@@ -45,2 +49,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* | ||
Constructs a new FlattenedItem | ||
*/ | ||
var createFlattenedItem = function createFlattenedItem(item, currentPath) { | ||
@@ -53,2 +60,5 @@ return { | ||
/* | ||
Flatten the children of the given subtree | ||
*/ | ||
var flattenChildren = function flattenChildren(tree, item, currentPath) { | ||
@@ -71,20 +81,48 @@ return item.isExpanded ? flattenTree({ rootId: item.id, items: tree.items }, currentPath) : []; | ||
rootId: tree.rootId, | ||
items: (0, _extends4.default)({}, tree.items, (0, _defineProperty3.default)({}, itemId, { | ||
id: itemId, | ||
isExpanded: (0, _handy.oneOf)(mutation.isExpanded, itemToChange.isExpanded), | ||
hasChildren: (0, _handy.oneOf)(mutation.hasChildren, itemToChange.hasChildren), | ||
children: typeof mutation.children !== 'undefined' ? mutation.children : itemToChange.children, | ||
isChildrenLoading: (0, _handy.oneOf)(mutation.isChildrenLoading, itemToChange.isChildrenLoading), | ||
data: (0, _handy.oneOf)(mutation.data, itemToChange.data) | ||
})) | ||
items: (0, _extends4.default)({}, tree.items, (0, _defineProperty3.default)({}, itemId, (0, _extends4.default)({}, itemToChange, mutation))) | ||
}; | ||
}; | ||
var isSamePath = exports.isSamePath = function isSamePath(a, b) { | ||
if (a === b) { | ||
return true; | ||
var getItem = exports.getItem = function getItem(tree, path) { | ||
var cursor = tree.items[tree.rootId]; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = (0, _getIterator3.default)(path), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var i = _step.value; | ||
cursor = tree.items[cursor.children[i]]; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return a.length === b.length && a.every(function (v, i) { | ||
return v === b[i]; | ||
}); | ||
return cursor; | ||
}; | ||
var getParent = exports.getParent = function getParent(tree, path) { | ||
var parentPath = (0, _path.getParentPath)(path); | ||
return getItem(tree, parentPath); | ||
}; | ||
var getTreePosition = exports.getTreePosition = function getTreePosition(tree, path) { | ||
var parent = getParent(tree, path); | ||
var index = (0, _path.getIndexAmongSiblings)(path); | ||
return { | ||
parentId: parent.id, | ||
index: index | ||
}; | ||
}; |
@@ -1,1 +0,3 @@ | ||
export { default } from './components/Tree'; | ||
export { default } from './components/Tree'; | ||
export { mutateTree } from './utils/tree'; |
@@ -0,1 +1,2 @@ | ||
import _getIterator from 'babel-runtime/core-js/get-iterator'; | ||
import _defineProperty from 'babel-runtime/helpers/defineProperty'; | ||
@@ -5,4 +6,5 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
import { oneOf } from './handy'; | ||
import { getParentPath, getIndexAmongSiblings } from './path'; | ||
/* | ||
@@ -27,2 +29,5 @@ Transforms tree structure into flat list of items for rendering purposes. | ||
/* | ||
Constructs a new FlattenedItem | ||
*/ | ||
var createFlattenedItem = function createFlattenedItem(item, currentPath) { | ||
@@ -35,2 +40,5 @@ return { | ||
/* | ||
Flatten the children of the given subtree | ||
*/ | ||
var flattenChildren = function flattenChildren(tree, item, currentPath) { | ||
@@ -53,20 +61,48 @@ return item.isExpanded ? flattenTree({ rootId: item.id, items: tree.items }, currentPath) : []; | ||
rootId: tree.rootId, | ||
items: _extends({}, tree.items, _defineProperty({}, itemId, { | ||
id: itemId, | ||
isExpanded: oneOf(mutation.isExpanded, itemToChange.isExpanded), | ||
hasChildren: oneOf(mutation.hasChildren, itemToChange.hasChildren), | ||
children: typeof mutation.children !== 'undefined' ? mutation.children : itemToChange.children, | ||
isChildrenLoading: oneOf(mutation.isChildrenLoading, itemToChange.isChildrenLoading), | ||
data: oneOf(mutation.data, itemToChange.data) | ||
})) | ||
items: _extends({}, tree.items, _defineProperty({}, itemId, _extends({}, itemToChange, mutation))) | ||
}; | ||
}; | ||
export var isSamePath = function isSamePath(a, b) { | ||
if (a === b) { | ||
return true; | ||
export var getItem = function getItem(tree, path) { | ||
var cursor = tree.items[tree.rootId]; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = _getIterator(path), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var i = _step.value; | ||
cursor = tree.items[cursor.children[i]]; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return a.length === b.length && a.every(function (v, i) { | ||
return v === b[i]; | ||
}); | ||
return cursor; | ||
}; | ||
export var getParent = function getParent(tree, path) { | ||
var parentPath = getParentPath(path); | ||
return getItem(tree, parentPath); | ||
}; | ||
export var getTreePosition = function getTreePosition(tree, path) { | ||
var parent = getParent(tree, path); | ||
var index = getIndexAmongSiblings(path); | ||
return { | ||
parentId: parent.id, | ||
index: index | ||
}; | ||
}; |
{ | ||
"name": "@atlaskit/tree", | ||
"version": "1.0.0" | ||
"version": "1.0.1" | ||
} |
{ | ||
"name": "@atlaskit/tree", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A React Component for displaying expandable and sortable tree hierarchies", | ||
@@ -14,3 +14,5 @@ "license": "Apache-2.0", | ||
"repository": "https://bitbucket.org/atlassian/atlaskit-mk-2", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"react-beautiful-dnd": "^8.0.5" | ||
}, | ||
"peerDependencies": { | ||
@@ -22,5 +24,5 @@ "react": "^16.4.0" | ||
"@atlaskit/icon": "^13.0.0", | ||
"@atlaskit/navigation": "^33.0.0", | ||
"@atlaskit/navigation": "^33.0.5", | ||
"@atlaskit/section-message": "^1.0.1", | ||
"@atlaskit/spinner": "^9.0.0", | ||
"@atlaskit/section-message": "^1.0.1", | ||
"@atlaskit/theme": "^5.0.0", | ||
@@ -36,2 +38,2 @@ "enzyme": "https://registry.npmjs.org/@pgleeson/enzyme/-/enzyme-3.3.7.tgz", | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80035
57
989
2
1
+ Addedreact-beautiful-dnd@^8.0.5
+ Added@babel/runtime@7.0.0-beta.547.26.0(transitive)
+ Addedasap@2.0.6(transitive)
+ Addedcore-js@1.2.72.6.12(transitive)
+ Addedcss-box-model@1.2.1(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addedmemoize-one@4.1.0(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedperformance-now@0.2.02.1.0(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedprop-types@15.6.1(transitive)
+ Addedraf@3.4.1(transitive)
+ Addedraf-schd@4.0.3(transitive)
+ Addedreact-beautiful-dnd@8.0.7(transitive)
+ Addedreact-lifecycles-compat@3.0.4(transitive)
+ Addedreact-motion@0.5.2(transitive)
+ Addedreact-redux@5.1.2(transitive)
+ Addedredux@4.2.1(transitive)
+ Addedregenerator-runtime@0.12.10.14.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedtiny-invariant@0.0.31.3.3(transitive)
+ Addedua-parser-js@0.7.39(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)