Comparing version 4.1.5 to 4.2.0
@@ -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; |
@@ -1,4 +0,7 @@ | ||
import Tree, { TreeProps } from './Tree'; | ||
import TreeNode, { TreeNodeProps } from './TreeNode'; | ||
export { TreeNode, TreeProps, TreeNodeProps }; | ||
import Tree from './Tree'; | ||
import TreeNode from './TreeNode'; | ||
import type { TreeProps } from './Tree'; | ||
import type { TreeNodeProps } from './TreeNode'; | ||
export { TreeNode }; | ||
export type { TreeProps, TreeNodeProps }; | ||
export default Tree; |
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"], | ||
_excluded2 = ["key"]; | ||
import * as React from 'react'; | ||
@@ -22,3 +24,3 @@ import { useEffect } from 'react'; | ||
treeNodeRequiredProps = _ref.treeNodeRequiredProps, | ||
props = _objectWithoutProperties(_ref, ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"]); | ||
props = _objectWithoutProperties(_ref, _excluded); | ||
@@ -79,3 +81,3 @@ var _React$useState = React.useState(true), | ||
key = _treeNode$data.key, | ||
restProps = _objectWithoutProperties(_treeNode$data, ["key"]), | ||
restProps = _objectWithoutProperties(_treeNode$data, _excluded2), | ||
isStart = treeNode.isStart, | ||
@@ -82,0 +84,0 @@ isEnd = treeNode.isEnd; |
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"], | ||
_excluded2 = ["key"]; | ||
@@ -107,3 +109,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 ================================ | ||
@@ -217,5 +219,3 @@ | ||
"aria-live": "assertive" | ||
}, getAccessibilityPath(activeItem)), /*#__PURE__*/React.createElement("div", { | ||
role: "tree" | ||
}, /*#__PURE__*/React.createElement("input", { | ||
}, getAccessibilityPath(activeItem)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", { | ||
style: HIDDEN_STYLE, | ||
@@ -257,3 +257,3 @@ disabled: focusable === false || disabled, | ||
key = _treeNode$data.key, | ||
restProps = _objectWithoutProperties(_treeNode$data, ["key"]), | ||
restProps = _objectWithoutProperties(_treeNode$data, _excluded2), | ||
isStart = treeNode.isStart, | ||
@@ -260,0 +260,0 @@ isEnd = treeNode.isEnd; |
@@ -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 = { | ||
@@ -69,2 +74,3 @@ keyEntities: {}, | ||
_this.dragStartMousePosition = null; | ||
_this.dragNode = void 0; | ||
_this.listRef = /*#__PURE__*/React.createRef(); | ||
@@ -102,11 +108,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) { | ||
@@ -301,6 +299,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) { | ||
@@ -310,5 +306,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) { | ||
@@ -542,3 +537,3 @@ var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
_this.onNodeLoad = function (treeNode) { | ||
return new Promise(function (resolve) { | ||
return new Promise(function (resolve, reject) { | ||
// We need to get the latest state of loading/loaded keys | ||
@@ -556,4 +551,3 @@ _this.setState(function (_ref) { | ||
if (!loadData || loadedKeys.indexOf(key) !== -1 || loadingKeys.indexOf(key) !== -1) { | ||
// react 15 will warn if return null | ||
return {}; | ||
return null; | ||
} // Process load data | ||
@@ -587,2 +581,11 @@ | ||
resolve(); | ||
}).catch(function (e) { | ||
var currentLoadingKeys = _this.state.loadingKeys; | ||
var newLoadingKeys = arrDel(currentLoadingKeys, key); | ||
_this.setState({ | ||
loadingKeys: newLoadingKeys | ||
}); | ||
reject(e); | ||
}); | ||
@@ -678,7 +681,4 @@ return { | ||
}; | ||
}; // =========================== Expanded =========================== | ||
}; | ||
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */ | ||
_this.setExpandedKeys = function (expandedKeys) { | ||
@@ -740,2 +740,7 @@ var treeData = _this.state.treeData; | ||
}); | ||
}).catch(function () { | ||
var currentExpandedKeys = _this.state.expandedKeys; | ||
var expandedKeysToRestore = arrDel(currentExpandedKeys, key); | ||
_this.setExpandedKeys(expandedKeysToRestore); | ||
}); | ||
@@ -758,5 +763,4 @@ } | ||
}); | ||
}; // =========================== Keyboard =========================== | ||
}; | ||
_this.onActiveChange = function (newActiveKey) { | ||
@@ -912,7 +916,3 @@ var activeKey = _this.state.activeKey; | ||
}; | ||
/** | ||
* Only update the value which is not in props | ||
*/ | ||
_this.setUncontrolledState = function (state) { | ||
@@ -1041,2 +1041,3 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
}, /*#__PURE__*/React.createElement("div", { | ||
role: "tree", | ||
className: classNames(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-show-line"), showLine), _defineProperty(_classNames, "".concat(prefixCls, "-focused"), focused), _defineProperty(_classNames, "".concat(prefixCls, "-active-focused"), activeKey !== null), _classNames)) | ||
@@ -1043,0 +1044,0 @@ }, /*#__PURE__*/React.createElement(NodeList, _extends({ |
@@ -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) { | ||
@@ -224,4 +227,9 @@ var expanded = props.expanded, | ||
onNodeLoad = _this$props$context.onNodeLoad; | ||
if (loading) return; // read from state to avoid loadData at same time | ||
if (loading) { | ||
return; | ||
} | ||
; // read from state to avoid loadData at same time | ||
if (loadData && expanded && !_this.isLeaf()) { | ||
@@ -248,5 +256,4 @@ // We needn't reload data when has children in sync logic | ||
return switcherIcon; | ||
}; // Switcher | ||
}; | ||
_this.renderSwitcher = function () { | ||
@@ -273,5 +280,4 @@ var expanded = _this.props.expanded; | ||
}, switcherIconDom) : null; | ||
}; // Checkbox | ||
}; | ||
_this.renderCheckbox = function () { | ||
@@ -303,5 +309,4 @@ var _this$props4 = _this.props, | ||
}); | ||
}; // Icon + Title | ||
}; | ||
_this.renderSelector = function () { | ||
@@ -394,8 +399,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); | ||
@@ -444,3 +449,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); | ||
@@ -447,0 +452,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 toArray from "rc-util/es/Children/toArray"; | ||
@@ -57,3 +58,3 @@ import warning from "rc-util/es/warning"; | ||
children = _treeNode$props.children, | ||
rest = _objectWithoutProperties(_treeNode$props, ["children"]); | ||
rest = _objectWithoutProperties(_treeNode$props, _excluded); | ||
@@ -60,0 +61,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; |
@@ -1,4 +0,7 @@ | ||
import Tree, { TreeProps } from './Tree'; | ||
import TreeNode, { TreeNodeProps } from './TreeNode'; | ||
export { TreeNode, TreeProps, TreeNodeProps }; | ||
import Tree from './Tree'; | ||
import TreeNode from './TreeNode'; | ||
import type { TreeProps } from './Tree'; | ||
import type { TreeNodeProps } from './TreeNode'; | ||
export { TreeNode }; | ||
export type { TreeProps, TreeNodeProps }; | ||
export default Tree; |
"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,5 @@ value: true | ||
var _excluded = ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"], | ||
_excluded2 = ["key"]; | ||
var MotionTreeNode = function MotionTreeNode(_ref, ref) { | ||
@@ -41,3 +44,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); | ||
@@ -98,3 +101,3 @@ var _React$useState = React.useState(true), | ||
key = _treeNode$data.key, | ||
restProps = (0, _objectWithoutProperties2.default)(_treeNode$data, ["key"]), | ||
restProps = (0, _objectWithoutProperties2.default)(_treeNode$data, _excluded2), | ||
isStart = treeNode.isStart, | ||
@@ -101,0 +104,0 @@ isEnd = treeNode.isEnd; |
"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,4 @@ 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"], | ||
_excluded2 = ["key"]; | ||
var HIDDEN_STYLE = { | ||
@@ -129,3 +128,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 ================================ | ||
@@ -238,5 +237,3 @@ var listRef = React.useRef(null); | ||
"aria-live": "assertive" | ||
}, getAccessibilityPath(activeItem)), /*#__PURE__*/React.createElement("div", { | ||
role: "tree" | ||
}, /*#__PURE__*/React.createElement("input", { | ||
}, getAccessibilityPath(activeItem)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", { | ||
style: HIDDEN_STYLE, | ||
@@ -278,3 +275,3 @@ disabled: focusable === false || disabled, | ||
key = _treeNode$data.key, | ||
restProps = (0, _objectWithoutProperties2.default)(_treeNode$data, ["key"]), | ||
restProps = (0, _objectWithoutProperties2.default)(_treeNode$data, _excluded2), | ||
isStart = treeNode.isStart, | ||
@@ -281,0 +278,0 @@ isEnd = treeNode.isEnd; |
@@ -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 = { | ||
@@ -98,2 +104,3 @@ keyEntities: {}, | ||
_this.dragStartMousePosition = null; | ||
_this.dragNode = void 0; | ||
_this.listRef = /*#__PURE__*/React.createRef(); | ||
@@ -131,11 +138,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) { | ||
@@ -328,6 +327,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) { | ||
@@ -337,5 +334,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) { | ||
@@ -567,3 +563,3 @@ var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
_this.onNodeLoad = function (treeNode) { | ||
return new Promise(function (resolve) { | ||
return new Promise(function (resolve, reject) { | ||
// We need to get the latest state of loading/loaded keys | ||
@@ -581,4 +577,3 @@ _this.setState(function (_ref) { | ||
if (!loadData || loadedKeys.indexOf(key) !== -1 || loadingKeys.indexOf(key) !== -1) { | ||
// react 15 will warn if return null | ||
return {}; | ||
return null; | ||
} // Process load data | ||
@@ -612,2 +607,11 @@ | ||
resolve(); | ||
}).catch(function (e) { | ||
var currentLoadingKeys = _this.state.loadingKeys; | ||
var newLoadingKeys = (0, _util.arrDel)(currentLoadingKeys, key); | ||
_this.setState({ | ||
loadingKeys: newLoadingKeys | ||
}); | ||
reject(e); | ||
}); | ||
@@ -703,7 +707,4 @@ return { | ||
}; | ||
}; // =========================== Expanded =========================== | ||
}; | ||
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */ | ||
_this.setExpandedKeys = function (expandedKeys) { | ||
@@ -765,2 +766,7 @@ var treeData = _this.state.treeData; | ||
}); | ||
}).catch(function () { | ||
var currentExpandedKeys = _this.state.expandedKeys; | ||
var expandedKeysToRestore = (0, _util.arrDel)(currentExpandedKeys, key); | ||
_this.setExpandedKeys(expandedKeysToRestore); | ||
}); | ||
@@ -783,5 +789,4 @@ } | ||
}); | ||
}; // =========================== Keyboard =========================== | ||
}; | ||
_this.onActiveChange = function (newActiveKey) { | ||
@@ -937,7 +942,3 @@ var activeKey = _this.state.activeKey; | ||
}; | ||
/** | ||
* Only update the value which is not in props | ||
*/ | ||
_this.setUncontrolledState = function (state) { | ||
@@ -1066,2 +1067,3 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
}, /*#__PURE__*/React.createElement("div", { | ||
role: "tree", | ||
className: (0, _classnames.default)(prefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-show-line"), showLine), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-focused"), focused), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-active-focused"), activeKey !== null), _classNames)) | ||
@@ -1068,0 +1070,0 @@ }, /*#__PURE__*/React.createElement(_NodeList.default, (0, _extends2.default)({ |
"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) { | ||
@@ -249,4 +252,9 @@ var expanded = props.expanded, | ||
onNodeLoad = _this$props$context.onNodeLoad; | ||
if (loading) return; // read from state to avoid loadData at same time | ||
if (loading) { | ||
return; | ||
} | ||
; // read from state to avoid loadData at same time | ||
if (loadData && expanded && !_this.isLeaf()) { | ||
@@ -273,5 +281,4 @@ // We needn't reload data when has children in sync logic | ||
return switcherIcon; | ||
}; // Switcher | ||
}; | ||
_this.renderSwitcher = function () { | ||
@@ -298,5 +305,4 @@ var expanded = _this.props.expanded; | ||
}, switcherIconDom) : null; | ||
}; // Checkbox | ||
}; | ||
_this.renderCheckbox = function () { | ||
@@ -328,5 +334,4 @@ var _this$props4 = _this.props, | ||
}); | ||
}; // Icon + Title | ||
}; | ||
_this.renderSelector = function () { | ||
@@ -419,8 +424,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); | ||
@@ -469,3 +474,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, | ||
@@ -472,0 +477,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); |
@@ -31,2 +31,4 @@ "use strict"; | ||
var _excluded = ["children"]; | ||
function getKey(key, pos) { | ||
@@ -81,3 +83,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)({ | ||
@@ -84,0 +86,0 @@ key: key |
{ | ||
"name": "rc-tree", | ||
"version": "4.1.5", | ||
"version": "4.2.0", | ||
"description": "tree ui component for react", | ||
"engines": { | ||
"node": ">=8.x" | ||
"node": ">=12.x" | ||
}, | ||
@@ -54,7 +54,6 @@ "keywords": [ | ||
"@types/jest": "^26.0.4", | ||
"@types/react": "^16.8.19", | ||
"@types/react-dom": "^16.8.4", | ||
"@types/react": "^17.0.11", | ||
"@types/react-dom": "^17.0.8", | ||
"@types/warning": "^3.0.0", | ||
"@umijs/fabric": "^2.4.8", | ||
"css-animation": "^1.2.0", | ||
"dumi": "^1.1.4", | ||
@@ -61,0 +60,0 @@ "enzyme": "^3.3.0", |
@@ -5,3 +5,3 @@ # rc-tree | ||
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url] | ||
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url] | ||
@@ -12,4 +12,4 @@ [npm-image]: http://img.shields.io/npm/v/rc-tree.svg?style=flat-square | ||
[github-actions-url]: https://github.com/react-component/tree/actions | ||
[coveralls-image]: https://img.shields.io/coveralls/react-component/tree.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/react-component/tree?branch=master | ||
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/tree/master.svg?style=flat-square | ||
[codecov-url]: https://codecov.io/gh/react-component/tree/branch/master | ||
[david-url]: https://david-dm.org/react-component/tree | ||
@@ -16,0 +16,0 @@ [david-image]: https://david-dm.org/react-component/tree/status.svg?style=flat-square |
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
326548
20
6958