Socket
Socket
Sign inDemoInstall

rc-tree

Package Overview
Dependencies
Maintainers
10
Versions
306
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-tree - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

1

es/DropIndicator.d.ts

@@ -0,1 +1,2 @@

/// <reference types="react" />
export default function DropIndicator({ dropPosition, dropLevelOffset, indent, }: {

@@ -2,0 +3,0 @@ dropPosition: -1 | 0 | 1;

@@ -0,1 +1,2 @@

/// <reference types="react" />
interface IndentProps {

@@ -2,0 +3,0 @@ prefixCls: string;

3

es/MotionTreeNode.js
import _extends from "@babel/runtime/helpers/esm/extends";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"];
import * as React from 'react';

@@ -22,3 +23,3 @@ import { useEffect } from 'react';

treeNodeRequiredProps = _ref.treeNodeRequiredProps,
props = _objectWithoutProperties(_ref, ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"]);
props = _objectWithoutProperties(_ref, _excluded);

@@ -25,0 +26,0 @@ var _React$useState = React.useState(true),

import _extends from "@babel/runtime/helpers/esm/extends";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["prefixCls", "data", "selectable", "checkable", "expandedKeys", "selectedKeys", "checkedKeys", "loadedKeys", "loadingKeys", "halfCheckedKeys", "keyEntities", "disabled", "dragging", "dragOverNodeKey", "dropPosition", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabIndex", "onKeyDown", "onFocus", "onBlur", "onActiveChange", "onListChangeStart", "onListChangeEnd"];

@@ -109,3 +110,3 @@ /**

onListChangeEnd = props.onListChangeEnd,
domProps = _objectWithoutProperties(props, ["prefixCls", "data", "selectable", "checkable", "expandedKeys", "selectedKeys", "checkedKeys", "loadedKeys", "loadingKeys", "halfCheckedKeys", "keyEntities", "disabled", "dragging", "dragOverNodeKey", "dropPosition", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabIndex", "onKeyDown", "onFocus", "onBlur", "onActiveChange", "onListChangeStart", "onListChangeEnd"]); // =============================== Ref ================================
domProps = _objectWithoutProperties(props, _excluded); // =============================== Ref ================================

@@ -112,0 +113,0 @@

@@ -67,2 +67,3 @@ import * as React from 'react';

onDoubleClick?: NodeMouseEventHandler;
onScroll?: React.UIEventHandler<HTMLElement>;
onExpand?: (expandedKeys: Key[], info: {

@@ -69,0 +70,0 @@ node: EventDataNode;

@@ -34,4 +34,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";

_this = _super.apply(this, arguments);
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(_args));
_this.destroyed = false;
_this.delayedDragEnterLogic = void 0;
_this.state = {

@@ -70,2 +75,3 @@ keyEntities: {},

_this.dragStartMousePosition = null;
_this.dragNode = void 0;
_this.listRef = /*#__PURE__*/React.createRef();

@@ -103,11 +109,3 @@

};
/**
* [Legacy] Select handler is smaller than node,
* so that this will trigger when drag enter node or select handler.
* This is a little tricky if customize css without padding.
* Better for use mouse move event to refresh drag state.
* But let's just keep it to avoid event trigger logic change.
*/
_this.onNodeDragEnter = function (event, node) {

@@ -302,6 +300,4 @@ var _this$state2 = _this.state,

}
}; // since stopPropagation() is called in treeNode
// if onWindowDrag is called, whice means state is keeped, drag state should be cleared
};
_this.onWindowDragEnd = function (event) {

@@ -311,5 +307,4 @@ _this.onNodeDragEnd(event, null, true);

window.removeEventListener('dragend', _this.onWindowDragEnd);
}; // if onNodeDragEnd is called, onWindowDragEnd won't be called since stopPropagation() is called
};
_this.onNodeDragEnd = function (event, node) {

@@ -686,7 +681,4 @@ var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

};
}; // =========================== Expanded ===========================
};
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */
_this.setExpandedKeys = function (expandedKeys) {

@@ -774,5 +766,4 @@ var _this$state9 = _this.state,

});
}; // =========================== Keyboard ===========================
};
_this.onActiveChange = function (newActiveKey) {

@@ -928,7 +919,3 @@ var activeKey = _this.state.activeKey;

};
/**
* Only update the value which is not in props
*/
_this.setUncontrolledState = function (state) {

@@ -1015,2 +1002,3 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

onContextMenu = _this$props8.onContextMenu,
onScroll = _this$props8.onScroll,
direction = _this$props8.direction;

@@ -1083,3 +1071,4 @@ var domProps = getDataAndAria(this.props);

onListChangeEnd: this.onListChangeEnd,
onContextMenu: onContextMenu
onContextMenu: onContextMenu,
onScroll: onScroll
}, this.getTreeNodeRequiredProps(), domProps))));

@@ -1086,0 +1075,0 @@ }

@@ -10,2 +10,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

import _createSuper from "@babel/runtime/helpers/esm/createSuper";
var _excluded = ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove"];
import * as React from 'react';

@@ -32,6 +33,11 @@ import classNames from 'classnames'; // @ts-ignore

_this = _super.apply(this, arguments);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.state = {
dragNodeHighlight: false
};
_this.selectHandle = void 0;

@@ -148,5 +154,4 @@ _this.onSelectorClick = function (e) {

onNodeDrop(e, _assertThisInitialized(_this));
}; // Disabled item still can be switch
};
_this.onExpand = function (e) {

@@ -158,5 +163,4 @@ var _this$props2 = _this.props,

onNodeExpand(e, convertNodePropsToEventData(_this.props));
}; // Drag usage
};
_this.setSelectHandle = function (node) {

@@ -213,5 +217,4 @@ _this.selectHandle = node;

return treeCheckable;
}; // Load data to avoid default expanded tree without data
};
_this.syncLoadData = function (props) {

@@ -251,5 +254,4 @@ var expanded = props.expanded,

return switcherIcon;
}; // Switcher
};
_this.renderSwitcher = function () {

@@ -276,5 +278,4 @@ var expanded = _this.props.expanded;

}, switcherIconDom) : null;
}; // Checkbox
};
_this.renderCheckbox = function () {

@@ -306,5 +307,4 @@ var _this$props4 = _this.props,

});
}; // Icon + Title
};
_this.renderSelector = function () {

@@ -397,8 +397,8 @@ var dragNodeHighlight = _this.state.dragNodeHighlight;

return _this;
} // Isomorphic needn't load data in server side
}
_createClass(InternalTreeNode, [{
key: "componentDidMount",
value: function componentDidMount() {
value: // Isomorphic needn't load data in server side
function componentDidMount() {
this.syncLoadData(this.props);

@@ -447,3 +447,3 @@ }

onMouseMove = _this$props7.onMouseMove,
otherProps = _objectWithoutProperties(_this$props7, ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove"]);
otherProps = _objectWithoutProperties(_this$props7, _excluded);

@@ -450,0 +450,0 @@ var _this$props$context4 = this.props.context,

import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["children"];

@@ -234,3 +235,3 @@ /* eslint-disable no-lonely-if */

var children = _ref3.children,
props = _objectWithoutProperties(_ref3, ["children"]);
props = _objectWithoutProperties(_ref3, _excluded);

@@ -237,0 +238,0 @@ var childrenNodes = convertDataToTree(children, processor);

@@ -5,2 +5,3 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";

import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["children"];
import omit from "rc-util/es/omit";

@@ -69,3 +70,3 @@ import toArray from "rc-util/es/Children/toArray";

children = _treeNode$props.children,
rest = _objectWithoutProperties(_treeNode$props, ["children"]);
rest = _objectWithoutProperties(_treeNode$props, _excluded);

@@ -72,0 +73,0 @@ var dataNode = _objectSpread({

@@ -0,1 +1,2 @@

/// <reference types="react" />
export default function DropIndicator({ dropPosition, dropLevelOffset, indent, }: {

@@ -2,0 +3,0 @@ dropPosition: -1 | 0 | 1;

@@ -0,1 +1,2 @@

/// <reference types="react" />
interface IndentProps {

@@ -2,0 +3,0 @@ prefixCls: string;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -30,2 +30,4 @@ value: true

var _excluded = ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"];
var MotionTreeNode = function MotionTreeNode(_ref, ref) {

@@ -41,3 +43,3 @@ var className = _ref.className,

treeNodeRequiredProps = _ref.treeNodeRequiredProps,
props = (0, _objectWithoutProperties2.default)(_ref, ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"]);
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);

@@ -44,0 +46,0 @@ var _React$useState = React.useState(true),

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -29,5 +29,3 @@ value: true

/**
* Handle virtual list of the TreeNodes.
*/
var _excluded = ["prefixCls", "data", "selectable", "checkable", "expandedKeys", "selectedKeys", "checkedKeys", "loadedKeys", "loadingKeys", "halfCheckedKeys", "keyEntities", "disabled", "dragging", "dragOverNodeKey", "dropPosition", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabIndex", "onKeyDown", "onFocus", "onBlur", "onActiveChange", "onListChangeStart", "onListChangeEnd"];
var HIDDEN_STYLE = {

@@ -131,3 +129,3 @@ width: 0,

onListChangeEnd = props.onListChangeEnd,
domProps = (0, _objectWithoutProperties2.default)(props, ["prefixCls", "data", "selectable", "checkable", "expandedKeys", "selectedKeys", "checkedKeys", "loadedKeys", "loadingKeys", "halfCheckedKeys", "keyEntities", "disabled", "dragging", "dragOverNodeKey", "dropPosition", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabIndex", "onKeyDown", "onFocus", "onBlur", "onActiveChange", "onListChangeStart", "onListChangeEnd"]); // =============================== Ref ================================
domProps = (0, _objectWithoutProperties2.default)(props, _excluded); // =============================== Ref ================================

@@ -134,0 +132,0 @@ var listRef = React.useRef(null);

@@ -67,2 +67,3 @@ import * as React from 'react';

onDoubleClick?: NodeMouseEventHandler;
onScroll?: React.UIEventHandler<HTMLElement>;
onExpand?: (expandedKeys: Key[], info: {

@@ -69,0 +70,0 @@ node: EventDataNode;

@@ -63,4 +63,10 @@ "use strict";

(0, _classCallCheck2.default)(this, Tree);
_this = _super.apply(this, arguments);
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(_args));
_this.destroyed = false;
_this.delayedDragEnterLogic = void 0;
_this.state = {

@@ -99,2 +105,3 @@ keyEntities: {},

_this.dragStartMousePosition = null;
_this.dragNode = void 0;
_this.listRef = /*#__PURE__*/React.createRef();

@@ -132,11 +139,3 @@

};
/**
* [Legacy] Select handler is smaller than node,
* so that this will trigger when drag enter node or select handler.
* This is a little tricky if customize css without padding.
* Better for use mouse move event to refresh drag state.
* But let's just keep it to avoid event trigger logic change.
*/
_this.onNodeDragEnter = function (event, node) {

@@ -329,6 +328,4 @@ var _this$state2 = _this.state,

}
}; // since stopPropagation() is called in treeNode
// if onWindowDrag is called, whice means state is keeped, drag state should be cleared
};
_this.onWindowDragEnd = function (event) {

@@ -338,5 +335,4 @@ _this.onNodeDragEnd(event, null, true);

window.removeEventListener('dragend', _this.onWindowDragEnd);
}; // if onNodeDragEnd is called, onWindowDragEnd won't be called since stopPropagation() is called
};
_this.onNodeDragEnd = function (event, node) {

@@ -711,7 +707,4 @@ var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

};
}; // =========================== Expanded ===========================
};
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */
_this.setExpandedKeys = function (expandedKeys) {

@@ -799,5 +792,4 @@ var _this$state9 = _this.state,

});
}; // =========================== Keyboard ===========================
};
_this.onActiveChange = function (newActiveKey) {

@@ -953,7 +945,3 @@ var activeKey = _this.state.activeKey;

};
/**
* Only update the value which is not in props
*/
_this.setUncontrolledState = function (state) {

@@ -1040,2 +1028,3 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

onContextMenu = _this$props8.onContextMenu,
onScroll = _this$props8.onScroll,
direction = _this$props8.direction;

@@ -1108,3 +1097,4 @@ var domProps = (0, _util.getDataAndAria)(this.props);

onListChangeEnd: this.onListChangeEnd,
onContextMenu: onContextMenu
onContextMenu: onContextMenu,
onScroll: onScroll
}, this.getTreeNodeRequiredProps(), domProps))));

@@ -1111,0 +1101,0 @@ }

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -42,3 +42,3 @@ value: true

// @ts-ignore
var _excluded = ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove"];
var ICON_OPEN = 'open';

@@ -57,6 +57,12 @@ var ICON_CLOSE = 'close';

(0, _classCallCheck2.default)(this, InternalTreeNode);
_this = _super.apply(this, arguments);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.state = {
dragNodeHighlight: false
};
_this.selectHandle = void 0;

@@ -173,5 +179,4 @@ _this.onSelectorClick = function (e) {

onNodeDrop(e, (0, _assertThisInitialized2.default)(_this));
}; // Disabled item still can be switch
};
_this.onExpand = function (e) {

@@ -183,5 +188,4 @@ var _this$props2 = _this.props,

onNodeExpand(e, (0, _treeUtil.convertNodePropsToEventData)(_this.props));
}; // Drag usage
};
_this.setSelectHandle = function (node) {

@@ -238,5 +242,4 @@ _this.selectHandle = node;

return treeCheckable;
}; // Load data to avoid default expanded tree without data
};
_this.syncLoadData = function (props) {

@@ -276,5 +279,4 @@ var expanded = props.expanded,

return switcherIcon;
}; // Switcher
};
_this.renderSwitcher = function () {

@@ -301,5 +303,4 @@ var expanded = _this.props.expanded;

}, switcherIconDom) : null;
}; // Checkbox
};
_this.renderCheckbox = function () {

@@ -331,5 +332,4 @@ var _this$props4 = _this.props,

});
}; // Icon + Title
};
_this.renderSelector = function () {

@@ -422,8 +422,8 @@ var dragNodeHighlight = _this.state.dragNodeHighlight;

return _this;
} // Isomorphic needn't load data in server side
}
(0, _createClass2.default)(InternalTreeNode, [{
key: "componentDidMount",
value: function componentDidMount() {
value: // Isomorphic needn't load data in server side
function componentDidMount() {
this.syncLoadData(this.props);

@@ -472,3 +472,3 @@ }

onMouseMove = _this$props7.onMouseMove,
otherProps = (0, _objectWithoutProperties2.default)(_this$props7, ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove"]);
otherProps = (0, _objectWithoutProperties2.default)(_this$props7, _excluded);
var _this$props$context4 = this.props.context,

@@ -475,0 +475,0 @@ prefixCls = _this$props$context4.prefixCls,

@@ -35,7 +35,4 @@ "use strict";

/* eslint-disable no-lonely-if */
var _excluded = ["children"];
/**
* Legacy code. Should avoid to use if you are new to import these code.
*/
function arrDel(list, value) {

@@ -271,3 +268,3 @@ var clone = list.slice();

var children = _ref3.children,
props = (0, _objectWithoutProperties2.default)(_ref3, ["children"]);
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
var childrenNodes = convertDataToTree(children, processor);

@@ -274,0 +271,0 @@ return /*#__PURE__*/_react.default.createElement(_TreeNode.default, processProps(props), childrenNodes);

@@ -34,2 +34,4 @@ "use strict";

var _excluded = ["children"];
function getKey(key, pos) {

@@ -96,3 +98,3 @@ if (key !== null && key !== undefined) {

children = _treeNode$props.children,
rest = (0, _objectWithoutProperties2.default)(_treeNode$props, ["children"]);
rest = (0, _objectWithoutProperties2.default)(_treeNode$props, _excluded);
var dataNode = (0, _objectSpread2.default)({

@@ -99,0 +101,0 @@ key: key

{
"name": "rc-tree",
"version": "5.0.0",
"version": "5.0.1",
"description": "tree ui component for react",

@@ -80,4 +80,4 @@ "engines": {

"rc-util": "^5.0.0",
"rc-virtual-list": "^3.0.1"
"rc-virtual-list": "^3.2.0"
}
}
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