Comparing version 5.0.3 to 5.0.4
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
export default function DropIndicator({ dropPosition, dropLevelOffset, indent, }: { | ||
@@ -3,0 +2,0 @@ dropPosition: -1 | 0 | 1; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
interface IndentProps { | ||
@@ -3,0 +2,0 @@ prefixCls: string; |
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'; | ||
@@ -23,3 +22,3 @@ import { useEffect } from 'react'; | ||
treeNodeRequiredProps = _ref.treeNodeRequiredProps, | ||
props = _objectWithoutProperties(_ref, _excluded); | ||
props = _objectWithoutProperties(_ref, ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"]); | ||
@@ -26,0 +25,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"]; | ||
@@ -110,3 +109,3 @@ /** | ||
onListChangeEnd = props.onListChangeEnd, | ||
domProps = _objectWithoutProperties(props, _excluded); // =============================== Ref ================================ | ||
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 ================================ | ||
@@ -253,3 +252,15 @@ | ||
prefixCls: "".concat(prefixCls, "-list"), | ||
ref: listRef | ||
ref: listRef, | ||
onVisibleChange: function onVisibleChange(originList, fullList) { | ||
var originSet = new Set(originList); | ||
var restList = fullList.filter(function (item) { | ||
return !originSet.has(item); | ||
}); // Motion node is not render. Skip motion | ||
if (restList.some(function (item) { | ||
return itemKey(item) === MOTION_KEY; | ||
})) { | ||
onMotionEnd(); | ||
} | ||
} | ||
}), function (treeNode) { | ||
@@ -256,0 +267,0 @@ var pos = treeNode.pos, |
@@ -34,9 +34,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
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 = _super.apply(this, arguments); | ||
_this.destroyed = false; | ||
_this.delayedDragEnterLogic = void 0; | ||
_this.state = { | ||
@@ -75,3 +70,2 @@ keyEntities: {}, | ||
_this.dragStartMousePosition = null; | ||
_this.dragNode = void 0; | ||
_this.currentMouseOverDroppableNodeKey = null; | ||
@@ -110,3 +104,11 @@ _this.listRef = /*#__PURE__*/React.createRef(); | ||
}; | ||
/** | ||
* [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) { | ||
@@ -324,4 +326,6 @@ 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) { | ||
@@ -331,4 +335,5 @@ _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) { | ||
@@ -706,4 +711,7 @@ 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) { | ||
@@ -791,4 +799,5 @@ var _this$state9 = _this.state, | ||
}); | ||
}; | ||
}; // =========================== Keyboard =========================== | ||
_this.onActiveChange = function (newActiveKey) { | ||
@@ -944,3 +953,7 @@ var activeKey = _this.state.activeKey; | ||
}; | ||
/** | ||
* Only update the value which is not in props | ||
*/ | ||
_this.setUncontrolledState = function (state) { | ||
@@ -947,0 +960,0 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
@@ -10,3 +10,2 @@ 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'; | ||
@@ -33,11 +32,6 @@ import classNames from 'classnames'; // @ts-ignore | ||
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 = _super.apply(this, arguments); | ||
_this.state = { | ||
dragNodeHighlight: false | ||
}; | ||
_this.selectHandle = void 0; | ||
@@ -154,4 +148,5 @@ _this.onSelectorClick = function (e) { | ||
onNodeDrop(e, _assertThisInitialized(_this)); | ||
}; | ||
}; // Disabled item still can be switch | ||
_this.onExpand = function (e) { | ||
@@ -163,4 +158,5 @@ var _this$props2 = _this.props, | ||
onNodeExpand(e, convertNodePropsToEventData(_this.props)); | ||
}; | ||
}; // Drag usage | ||
_this.setSelectHandle = function (node) { | ||
@@ -217,4 +213,5 @@ _this.selectHandle = node; | ||
return treeCheckable; | ||
}; | ||
}; // Load data to avoid default expanded tree without data | ||
_this.syncLoadData = function (props) { | ||
@@ -254,4 +251,5 @@ var expanded = props.expanded, | ||
return switcherIcon; | ||
}; | ||
}; // Switcher | ||
_this.renderSwitcher = function () { | ||
@@ -278,4 +276,5 @@ var expanded = _this.props.expanded; | ||
}, switcherIconDom) : null; | ||
}; | ||
}; // Checkbox | ||
_this.renderCheckbox = function () { | ||
@@ -307,4 +306,5 @@ 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: // Isomorphic needn't load data in server side | ||
function componentDidMount() { | ||
value: function componentDidMount() { | ||
this.syncLoadData(this.props); | ||
@@ -447,3 +447,3 @@ } | ||
onMouseMove = _this$props7.onMouseMove, | ||
otherProps = _objectWithoutProperties(_this$props7, _excluded); | ||
otherProps = _objectWithoutProperties(_this$props7, ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove"]); | ||
@@ -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"]; | ||
@@ -242,3 +241,3 @@ /* eslint-disable no-lonely-if */ | ||
var children = _ref3.children, | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
props = _objectWithoutProperties(_ref3, ["children"]); | ||
@@ -245,0 +244,0 @@ var childrenNodes = convertDataToTree(children, processor); |
@@ -5,3 +5,2 @@ 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"; | ||
@@ -70,3 +69,3 @@ import toArray from "rc-util/es/Children/toArray"; | ||
children = _treeNode$props.children, | ||
rest = _objectWithoutProperties(_treeNode$props, _excluded); | ||
rest = _objectWithoutProperties(_treeNode$props, ["children"]); | ||
@@ -73,0 +72,0 @@ var dataNode = _objectSpread({ |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
export default function DropIndicator({ dropPosition, dropLevelOffset, indent, }: { | ||
@@ -3,0 +2,0 @@ dropPosition: -1 | 0 | 1; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
interface IndentProps { | ||
@@ -3,0 +2,0 @@ prefixCls: string; |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -30,4 +30,2 @@ value: true | ||
var _excluded = ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"]; | ||
var MotionTreeNode = function MotionTreeNode(_ref, ref) { | ||
@@ -43,3 +41,3 @@ var className = _ref.className, | ||
treeNodeRequiredProps = _ref.treeNodeRequiredProps, | ||
props = (0, _objectWithoutProperties2.default)(_ref, _excluded); | ||
props = (0, _objectWithoutProperties2.default)(_ref, ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"]); | ||
@@ -46,0 +44,0 @@ var _React$useState = React.useState(true), |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -29,3 +29,5 @@ value: true | ||
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"]; | ||
/** | ||
* Handle virtual list of the TreeNodes. | ||
*/ | ||
var HIDDEN_STYLE = { | ||
@@ -129,3 +131,3 @@ width: 0, | ||
onListChangeEnd = props.onListChangeEnd, | ||
domProps = (0, _objectWithoutProperties2.default)(props, _excluded); // =============================== Ref ================================ | ||
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 ================================ | ||
@@ -271,3 +273,15 @@ var listRef = React.useRef(null); | ||
prefixCls: "".concat(prefixCls, "-list"), | ||
ref: listRef | ||
ref: listRef, | ||
onVisibleChange: function onVisibleChange(originList, fullList) { | ||
var originSet = new Set(originList); | ||
var restList = fullList.filter(function (item) { | ||
return !originSet.has(item); | ||
}); // Motion node is not render. Skip motion | ||
if (restList.some(function (item) { | ||
return itemKey(item) === MOTION_KEY; | ||
})) { | ||
onMotionEnd(); | ||
} | ||
} | ||
}), function (treeNode) { | ||
@@ -274,0 +288,0 @@ var pos = treeNode.pos, |
@@ -63,10 +63,4 @@ "use strict"; | ||
(0, _classCallCheck2.default)(this, Tree); | ||
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 = _super.apply(this, arguments); | ||
_this.destroyed = false; | ||
_this.delayedDragEnterLogic = void 0; | ||
_this.state = { | ||
@@ -105,3 +99,2 @@ keyEntities: {}, | ||
_this.dragStartMousePosition = null; | ||
_this.dragNode = void 0; | ||
_this.currentMouseOverDroppableNodeKey = null; | ||
@@ -140,3 +133,11 @@ _this.listRef = /*#__PURE__*/React.createRef(); | ||
}; | ||
/** | ||
* [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) { | ||
@@ -352,4 +353,6 @@ 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) { | ||
@@ -359,4 +362,5 @@ _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) { | ||
@@ -732,4 +736,7 @@ 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) { | ||
@@ -817,4 +824,5 @@ var _this$state9 = _this.state, | ||
}); | ||
}; | ||
}; // =========================== Keyboard =========================== | ||
_this.onActiveChange = function (newActiveKey) { | ||
@@ -970,3 +978,7 @@ var activeKey = _this.state.activeKey; | ||
}; | ||
/** | ||
* Only update the value which is not in props | ||
*/ | ||
_this.setUncontrolledState = function (state) { | ||
@@ -973,0 +985,0 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -42,3 +42,3 @@ value: true | ||
var _excluded = ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove"]; | ||
// @ts-ignore | ||
var ICON_OPEN = 'open'; | ||
@@ -57,12 +57,6 @@ var ICON_CLOSE = 'close'; | ||
(0, _classCallCheck2.default)(this, InternalTreeNode); | ||
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 = _super.apply(this, arguments); | ||
_this.state = { | ||
dragNodeHighlight: false | ||
}; | ||
_this.selectHandle = void 0; | ||
@@ -179,4 +173,5 @@ _this.onSelectorClick = function (e) { | ||
onNodeDrop(e, (0, _assertThisInitialized2.default)(_this)); | ||
}; | ||
}; // Disabled item still can be switch | ||
_this.onExpand = function (e) { | ||
@@ -188,4 +183,5 @@ var _this$props2 = _this.props, | ||
onNodeExpand(e, (0, _treeUtil.convertNodePropsToEventData)(_this.props)); | ||
}; | ||
}; // Drag usage | ||
_this.setSelectHandle = function (node) { | ||
@@ -242,4 +238,5 @@ _this.selectHandle = node; | ||
return treeCheckable; | ||
}; | ||
}; // Load data to avoid default expanded tree without data | ||
_this.syncLoadData = function (props) { | ||
@@ -279,4 +276,5 @@ var expanded = props.expanded, | ||
return switcherIcon; | ||
}; | ||
}; // Switcher | ||
_this.renderSwitcher = function () { | ||
@@ -303,4 +301,5 @@ var expanded = _this.props.expanded; | ||
}, switcherIconDom) : null; | ||
}; | ||
}; // Checkbox | ||
_this.renderCheckbox = function () { | ||
@@ -332,4 +331,5 @@ 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: // Isomorphic needn't load data in server side | ||
function componentDidMount() { | ||
value: function componentDidMount() { | ||
this.syncLoadData(this.props); | ||
@@ -472,3 +472,3 @@ } | ||
onMouseMove = _this$props7.onMouseMove, | ||
otherProps = (0, _objectWithoutProperties2.default)(_this$props7, _excluded); | ||
otherProps = (0, _objectWithoutProperties2.default)(_this$props7, ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove"]); | ||
var _this$props$context4 = this.props.context, | ||
@@ -475,0 +475,0 @@ prefixCls = _this$props$context4.prefixCls, |
@@ -35,4 +35,7 @@ "use strict"; | ||
var _excluded = ["children"]; | ||
/* eslint-disable no-lonely-if */ | ||
/** | ||
* Legacy code. Should avoid to use if you are new to import these code. | ||
*/ | ||
function arrDel(list, value) { | ||
@@ -275,3 +278,3 @@ var clone = list.slice(); | ||
var children = _ref3.children, | ||
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded); | ||
props = (0, _objectWithoutProperties2.default)(_ref3, ["children"]); | ||
var childrenNodes = convertDataToTree(children, processor); | ||
@@ -278,0 +281,0 @@ return /*#__PURE__*/_react.default.createElement(_TreeNode.default, processProps(props), childrenNodes); |
@@ -34,4 +34,2 @@ "use strict"; | ||
var _excluded = ["children"]; | ||
function getKey(key, pos) { | ||
@@ -98,3 +96,3 @@ if (key !== null && key !== undefined) { | ||
children = _treeNode$props.children, | ||
rest = (0, _objectWithoutProperties2.default)(_treeNode$props, _excluded); | ||
rest = (0, _objectWithoutProperties2.default)(_treeNode$props, ["children"]); | ||
var dataNode = (0, _objectSpread2.default)({ | ||
@@ -101,0 +99,0 @@ key: key |
{ | ||
"name": "rc-tree", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "tree ui component for react", | ||
@@ -80,4 +80,4 @@ "engines": { | ||
"rc-util": "^5.0.0", | ||
"rc-virtual-list": "^3.2.0" | ||
"rc-virtual-list": "^3.4.1" | ||
} | ||
} |
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
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
335061
61
7158
Updatedrc-virtual-list@^3.4.1