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

rc-tree

Package Overview
Dependencies
Maintainers
11
Versions
314
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.10.1 to 5.11.0

4

es/contextTypes.d.ts

@@ -64,1 +64,5 @@ /**

export declare const TreeContext: React.Context<TreeContextProps<any> | null>;
/** Internal usage, safe to remove. Do not use in prod */
export declare const UnstableContext: React.Context<{
nodeDisabled?: (node: DataNode) => boolean;
}>;

5

es/contextTypes.js

@@ -6,2 +6,5 @@ /**

import * as React from 'react';
export var TreeContext = /*#__PURE__*/React.createContext(null);
export var TreeContext = /*#__PURE__*/React.createContext(null);
/** Internal usage, safe to remove. Do not use in prod */
export var UnstableContext = /*#__PURE__*/React.createContext({});

@@ -5,4 +5,5 @@ import Tree from './Tree';

import type { TreeNodeProps, BasicDataNode, FieldDataNode } from './interface';
export { TreeNode };
import { UnstableContext } from './contextTypes';
export { TreeNode, UnstableContext };
export type { TreeProps, TreeNodeProps, BasicDataNode, FieldDataNode };
export default Tree;
import Tree from "./Tree";
import TreeNode from "./TreeNode";
export { TreeNode };
import { UnstableContext } from "./contextTypes";
export { TreeNode, UnstableContext };
export default Tree;

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

ref: listRef,
role: "tree",
onVisibleChange: function onVisibleChange(originList) {

@@ -248,0 +249,0 @@ // The best match is using `fullList` - `originList` = `restList`

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

}, /*#__PURE__*/React.createElement("div", {
role: "tree",
className: classNames(prefixCls, className, rootClassName, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-show-line"), showLine), "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-active-focused"), activeKey !== null)),

@@ -1030,0 +1029,0 @@ style: rootStyle

import * as React from 'react';
import { type TreeContextProps } from './contextTypes';
import { UnstableContext, type TreeContextProps } from './contextTypes';
import type { TreeNodeProps } from './interface';

@@ -7,2 +7,3 @@ export type { TreeNodeProps } from './interface';

context?: TreeContextProps;
unstableContext?: React.ContextType<typeof UnstableContext>;
}

@@ -9,0 +10,0 @@ export interface TreeNodeState {

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

// @ts-ignore
import { TreeContext } from "./contextTypes";
import { TreeContext, UnstableContext } from "./contextTypes";
import Indent from "./Indent";

@@ -166,5 +166,9 @@ import getEntity from "./utils/keyUtil";

_defineProperty(_assertThisInitialized(_this), "isDisabled", function () {
var disabled = _this.props.disabled;
var treeDisabled = _this.props.context.disabled;
return !!(treeDisabled || disabled);
var _this$props4 = _this.props,
disabled = _this$props4.disabled,
data = _this$props4.data;
var _this$props5 = _this.props,
treeDisabled = _this$props5.context.disabled,
nodeDisabled = _this$props5.unstableContext.nodeDisabled;
return !!(treeDisabled || disabled || nodeDisabled && nodeDisabled(data));
});

@@ -199,5 +203,5 @@ _defineProperty(_assertThisInitialized(_this), "isCheckable", function () {

_defineProperty(_assertThisInitialized(_this), "isDraggable", function () {
var _this$props4 = _this.props,
data = _this$props4.data,
draggable = _this$props4.context.draggable;
var _this$props6 = _this.props,
data = _this$props6.data,
draggable = _this$props6.context.draggable;
return !!(draggable && (!draggable.nodeDraggable || draggable.nodeDraggable(data)));

@@ -248,6 +252,7 @@ });

_defineProperty(_assertThisInitialized(_this), "renderCheckbox", function () {
var _this$props5 = _this.props,
checked = _this$props5.checked,
halfChecked = _this$props5.halfChecked,
disableCheckbox = _this$props5.disableCheckbox;
var _this$props7 = _this.props,
checked = _this$props7.checked,
halfChecked = _this$props7.halfChecked,
disableCheckbox = _this$props7.disableCheckbox,
title = _this$props7.title;
var prefixCls = _this.props.context.prefixCls;

@@ -262,3 +267,7 @@ var disabled = _this.isDisabled();

className: classNames("".concat(prefixCls, "-checkbox"), checked && "".concat(prefixCls, "-checkbox-checked"), !checked && halfChecked && "".concat(prefixCls, "-checkbox-indeterminate"), (disabled || disableCheckbox) && "".concat(prefixCls, "-checkbox-disabled")),
onClick: _this.onCheck
onClick: _this.onCheck,
role: "checkbox",
"aria-checked": halfChecked ? 'mixed' : checked,
"aria-disabled": disabled || disableCheckbox,
"aria-label": "Select ".concat(typeof title === 'string' ? title : 'tree node')
}, $custom);

@@ -277,9 +286,9 @@ });

var dragNodeHighlight = _this.state.dragNodeHighlight;
var _this$props6 = _this.props,
_this$props6$title = _this$props6.title,
title = _this$props6$title === void 0 ? defaultTitle : _this$props6$title,
selected = _this$props6.selected,
icon = _this$props6.icon,
loading = _this$props6.loading,
data = _this$props6.data;
var _this$props8 = _this.props,
_this$props8$title = _this$props8.title,
title = _this$props8$title === void 0 ? defaultTitle : _this$props8$title,
selected = _this$props8.selected,
icon = _this$props8.icon,
loading = _this$props8.loading,
data = _this$props8.data;
var _this$props$context3 = _this.props.context,

@@ -330,5 +339,5 @@ prefixCls = _this$props$context3.prefixCls,

_defineProperty(_assertThisInitialized(_this), "renderDropIndicator", function () {
var _this$props7 = _this.props,
disabled = _this$props7.disabled,
eventKey = _this$props7.eventKey;
var _this$props9 = _this.props,
disabled = _this$props9.disabled,
eventKey = _this$props9.eventKey;
var _this$props$context4 = _this.props.context,

@@ -393,23 +402,23 @@ draggable = _this$props$context4.draggable,

var _classNames;
var _this$props8 = this.props,
eventKey = _this$props8.eventKey,
className = _this$props8.className,
style = _this$props8.style,
dragOver = _this$props8.dragOver,
dragOverGapTop = _this$props8.dragOverGapTop,
dragOverGapBottom = _this$props8.dragOverGapBottom,
isLeaf = _this$props8.isLeaf,
isStart = _this$props8.isStart,
isEnd = _this$props8.isEnd,
expanded = _this$props8.expanded,
selected = _this$props8.selected,
checked = _this$props8.checked,
halfChecked = _this$props8.halfChecked,
loading = _this$props8.loading,
domRef = _this$props8.domRef,
active = _this$props8.active,
data = _this$props8.data,
onMouseMove = _this$props8.onMouseMove,
selectable = _this$props8.selectable,
otherProps = _objectWithoutProperties(_this$props8, _excluded);
var _this$props10 = this.props,
eventKey = _this$props10.eventKey,
className = _this$props10.className,
style = _this$props10.style,
dragOver = _this$props10.dragOver,
dragOverGapTop = _this$props10.dragOverGapTop,
dragOverGapBottom = _this$props10.dragOverGapBottom,
isLeaf = _this$props10.isLeaf,
isStart = _this$props10.isStart,
isEnd = _this$props10.isEnd,
expanded = _this$props10.expanded,
selected = _this$props10.selected,
checked = _this$props10.checked,
halfChecked = _this$props10.halfChecked,
loading = _this$props10.loading,
domRef = _this$props10.domRef,
active = _this$props10.active,
data = _this$props10.data,
onMouseMove = _this$props10.onMouseMove,
selectable = _this$props10.selectable,
otherProps = _objectWithoutProperties(_this$props10, _excluded);
var _this$props$context5 = this.props.context,

@@ -438,2 +447,4 @@ prefixCls = _this$props$context5.prefixCls,

ref: domRef,
role: "treeitem",
"aria-expanded": isLeaf ? undefined : expanded,
className: classNames(className, "".concat(prefixCls, "-treenode"), (_classNames = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classNames, "".concat(prefixCls, "-treenode-disabled"), disabled), "".concat(prefixCls, "-treenode-switcher-").concat(expanded ? 'open' : 'close'), !isLeaf), "".concat(prefixCls, "-treenode-checkbox-checked"), checked), "".concat(prefixCls, "-treenode-checkbox-indeterminate"), halfChecked), "".concat(prefixCls, "-treenode-selected"), selected), "".concat(prefixCls, "-treenode-loading"), loading), "".concat(prefixCls, "-treenode-active"), active), "".concat(prefixCls, "-treenode-leaf-last"), isEndNode), "".concat(prefixCls, "-treenode-draggable"), mergedDraggable), "dragging", dragging), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classNames, 'drop-target', dropTargetKey === eventKey), 'drop-container', dropContainerKey === eventKey), 'drag-over', !disabled && dragOver), 'drag-over-gap-top', !disabled && dragOverGapTop), 'drag-over-gap-bottom', !disabled && dragOverGapBottom), 'filter-node', filterTreeNode && filterTreeNode(convertNodePropsToEventData(this.props))))),

@@ -444,3 +455,2 @@ style: style

draggable: draggableWithoutDisabled,
"aria-grabbed": dragging,
onDragStart: draggableWithoutDisabled ? this.onDragStart : undefined

@@ -467,5 +477,8 @@ // Drop config

return /*#__PURE__*/React.createElement(TreeContext.Consumer, null, function (context) {
return /*#__PURE__*/React.createElement(InternalTreeNode, _extends({}, props, {
context: context
}));
return /*#__PURE__*/React.createElement(UnstableContext.Consumer, null, function (unstableContext) {
return /*#__PURE__*/React.createElement(InternalTreeNode, _extends({}, props, {
context: context,
unstableContext: unstableContext
}));
});
});

@@ -472,0 +485,0 @@ };

@@ -64,1 +64,5 @@ /**

export declare const TreeContext: React.Context<TreeContextProps<any> | null>;
/** Internal usage, safe to remove. Do not use in prod */
export declare const UnstableContext: React.Context<{
nodeDisabled?: (node: DataNode) => boolean;
}>;

@@ -7,3 +7,3 @@ "use strict";

});
exports.TreeContext = void 0;
exports.UnstableContext = exports.TreeContext = void 0;
var React = _interopRequireWildcard(require("react"));

@@ -17,2 +17,5 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

var TreeContext = exports.TreeContext = /*#__PURE__*/React.createContext(null);
var TreeContext = exports.TreeContext = /*#__PURE__*/React.createContext(null);
/** Internal usage, safe to remove. Do not use in prod */
var UnstableContext = exports.UnstableContext = /*#__PURE__*/React.createContext({});

@@ -5,4 +5,5 @@ import Tree from './Tree';

import type { TreeNodeProps, BasicDataNode, FieldDataNode } from './interface';
export { TreeNode };
import { UnstableContext } from './contextTypes';
export { TreeNode, UnstableContext };
export type { TreeProps, TreeNodeProps, BasicDataNode, FieldDataNode };
export default Tree;

@@ -13,5 +13,12 @@ "use strict";

});
Object.defineProperty(exports, "UnstableContext", {
enumerable: true,
get: function get() {
return _contextTypes.UnstableContext;
}
});
exports.default = void 0;
var _Tree = _interopRequireDefault(require("./Tree"));
var _TreeNode = _interopRequireDefault(require("./TreeNode"));
var _contextTypes = require("./contextTypes");
var _default = exports.default = _Tree.default;

@@ -256,2 +256,3 @@ "use strict";

ref: listRef,
role: "tree",
onVisibleChange: function onVisibleChange(originList) {

@@ -258,0 +259,0 @@ // The best match is using `fullList` - `originList` = `restList`

@@ -1037,3 +1037,2 @@ "use strict";

}, /*#__PURE__*/React.createElement("div", {
role: "tree",
className: (0, _classnames.default)(prefixCls, className, rootClassName, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-show-line"), showLine), "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-active-focused"), activeKey !== null)),

@@ -1040,0 +1039,0 @@ style: rootStyle

import * as React from 'react';
import { type TreeContextProps } from './contextTypes';
import { UnstableContext, type TreeContextProps } from './contextTypes';
import type { TreeNodeProps } from './interface';

@@ -7,2 +7,3 @@ export type { TreeNodeProps } from './interface';

context?: TreeContextProps;
unstableContext?: React.ContextType<typeof UnstableContext>;
}

@@ -9,0 +10,0 @@ export interface TreeNodeState {

@@ -174,5 +174,9 @@ "use strict";

(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDisabled", function () {
var disabled = _this.props.disabled;
var treeDisabled = _this.props.context.disabled;
return !!(treeDisabled || disabled);
var _this$props4 = _this.props,
disabled = _this$props4.disabled,
data = _this$props4.data;
var _this$props5 = _this.props,
treeDisabled = _this$props5.context.disabled,
nodeDisabled = _this$props5.unstableContext.nodeDisabled;
return !!(treeDisabled || disabled || nodeDisabled && nodeDisabled(data));
});

@@ -207,5 +211,5 @@ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isCheckable", function () {

(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDraggable", function () {
var _this$props4 = _this.props,
data = _this$props4.data,
draggable = _this$props4.context.draggable;
var _this$props6 = _this.props,
data = _this$props6.data,
draggable = _this$props6.context.draggable;
return !!(draggable && (!draggable.nodeDraggable || draggable.nodeDraggable(data)));

@@ -256,6 +260,7 @@ });

(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderCheckbox", function () {
var _this$props5 = _this.props,
checked = _this$props5.checked,
halfChecked = _this$props5.halfChecked,
disableCheckbox = _this$props5.disableCheckbox;
var _this$props7 = _this.props,
checked = _this$props7.checked,
halfChecked = _this$props7.halfChecked,
disableCheckbox = _this$props7.disableCheckbox,
title = _this$props7.title;
var prefixCls = _this.props.context.prefixCls;

@@ -270,3 +275,7 @@ var disabled = _this.isDisabled();

className: (0, _classnames.default)("".concat(prefixCls, "-checkbox"), checked && "".concat(prefixCls, "-checkbox-checked"), !checked && halfChecked && "".concat(prefixCls, "-checkbox-indeterminate"), (disabled || disableCheckbox) && "".concat(prefixCls, "-checkbox-disabled")),
onClick: _this.onCheck
onClick: _this.onCheck,
role: "checkbox",
"aria-checked": halfChecked ? 'mixed' : checked,
"aria-disabled": disabled || disableCheckbox,
"aria-label": "Select ".concat(typeof title === 'string' ? title : 'tree node')
}, $custom);

@@ -285,9 +294,9 @@ });

var dragNodeHighlight = _this.state.dragNodeHighlight;
var _this$props6 = _this.props,
_this$props6$title = _this$props6.title,
title = _this$props6$title === void 0 ? defaultTitle : _this$props6$title,
selected = _this$props6.selected,
icon = _this$props6.icon,
loading = _this$props6.loading,
data = _this$props6.data;
var _this$props8 = _this.props,
_this$props8$title = _this$props8.title,
title = _this$props8$title === void 0 ? defaultTitle : _this$props8$title,
selected = _this$props8.selected,
icon = _this$props8.icon,
loading = _this$props8.loading,
data = _this$props8.data;
var _this$props$context3 = _this.props.context,

@@ -338,5 +347,5 @@ prefixCls = _this$props$context3.prefixCls,

(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderDropIndicator", function () {
var _this$props7 = _this.props,
disabled = _this$props7.disabled,
eventKey = _this$props7.eventKey;
var _this$props9 = _this.props,
disabled = _this$props9.disabled,
eventKey = _this$props9.eventKey;
var _this$props$context4 = _this.props.context,

@@ -401,23 +410,23 @@ draggable = _this$props$context4.draggable,

var _classNames;
var _this$props8 = this.props,
eventKey = _this$props8.eventKey,
className = _this$props8.className,
style = _this$props8.style,
dragOver = _this$props8.dragOver,
dragOverGapTop = _this$props8.dragOverGapTop,
dragOverGapBottom = _this$props8.dragOverGapBottom,
isLeaf = _this$props8.isLeaf,
isStart = _this$props8.isStart,
isEnd = _this$props8.isEnd,
expanded = _this$props8.expanded,
selected = _this$props8.selected,
checked = _this$props8.checked,
halfChecked = _this$props8.halfChecked,
loading = _this$props8.loading,
domRef = _this$props8.domRef,
active = _this$props8.active,
data = _this$props8.data,
onMouseMove = _this$props8.onMouseMove,
selectable = _this$props8.selectable,
otherProps = (0, _objectWithoutProperties2.default)(_this$props8, _excluded);
var _this$props10 = this.props,
eventKey = _this$props10.eventKey,
className = _this$props10.className,
style = _this$props10.style,
dragOver = _this$props10.dragOver,
dragOverGapTop = _this$props10.dragOverGapTop,
dragOverGapBottom = _this$props10.dragOverGapBottom,
isLeaf = _this$props10.isLeaf,
isStart = _this$props10.isStart,
isEnd = _this$props10.isEnd,
expanded = _this$props10.expanded,
selected = _this$props10.selected,
checked = _this$props10.checked,
halfChecked = _this$props10.halfChecked,
loading = _this$props10.loading,
domRef = _this$props10.domRef,
active = _this$props10.active,
data = _this$props10.data,
onMouseMove = _this$props10.onMouseMove,
selectable = _this$props10.selectable,
otherProps = (0, _objectWithoutProperties2.default)(_this$props10, _excluded);
var _this$props$context5 = this.props.context,

@@ -446,2 +455,4 @@ prefixCls = _this$props$context5.prefixCls,

ref: domRef,
role: "treeitem",
"aria-expanded": isLeaf ? undefined : expanded,
className: (0, _classnames.default)(className, "".concat(prefixCls, "-treenode"), (_classNames = {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-treenode-disabled"), disabled), "".concat(prefixCls, "-treenode-switcher-").concat(expanded ? 'open' : 'close'), !isLeaf), "".concat(prefixCls, "-treenode-checkbox-checked"), checked), "".concat(prefixCls, "-treenode-checkbox-indeterminate"), halfChecked), "".concat(prefixCls, "-treenode-selected"), selected), "".concat(prefixCls, "-treenode-loading"), loading), "".concat(prefixCls, "-treenode-active"), active), "".concat(prefixCls, "-treenode-leaf-last"), isEndNode), "".concat(prefixCls, "-treenode-draggable"), mergedDraggable), "dragging", dragging), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_classNames, 'drop-target', dropTargetKey === eventKey), 'drop-container', dropContainerKey === eventKey), 'drag-over', !disabled && dragOver), 'drag-over-gap-top', !disabled && dragOverGapTop), 'drag-over-gap-bottom', !disabled && dragOverGapBottom), 'filter-node', filterTreeNode && filterTreeNode((0, _treeUtil.convertNodePropsToEventData)(this.props))))),

@@ -452,3 +463,2 @@ style: style

draggable: draggableWithoutDisabled,
"aria-grabbed": dragging,
onDragStart: draggableWithoutDisabled ? this.onDragStart : undefined

@@ -475,5 +485,8 @@ // Drop config

return /*#__PURE__*/React.createElement(_contextTypes.TreeContext.Consumer, null, function (context) {
return /*#__PURE__*/React.createElement(InternalTreeNode, (0, _extends2.default)({}, props, {
context: context
}));
return /*#__PURE__*/React.createElement(_contextTypes.UnstableContext.Consumer, null, function (unstableContext) {
return /*#__PURE__*/React.createElement(InternalTreeNode, (0, _extends2.default)({}, props, {
context: context,
unstableContext: unstableContext
}));
});
});

@@ -480,0 +493,0 @@ };

{
"name": "rc-tree",
"version": "5.10.1",
"version": "5.11.0",
"description": "tree ui component for react",

@@ -37,3 +37,3 @@ "engines": {

"prepare": "husky",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"prepublishOnly": "npm run compile",
"postpublish": "npm run gh-pages",

@@ -40,0 +40,0 @@ "lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",

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