Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atlaskit/tree

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/tree - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

dist/cjs/components/Tree/index.js

9

CHANGELOG.md
# @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 }; }

2

dist/cjs/types.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc