rc-tree
Advanced tools
Comparing version 5.0.4 to 5.0.5
@@ -0,1 +1,2 @@ | ||
/// <reference types="react" /> | ||
export default function DropIndicator({ dropPosition, dropLevelOffset, indent, }: { | ||
@@ -2,0 +3,0 @@ dropPosition: -1 | 0 | 1; |
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 @@ |
133
es/Tree.js
@@ -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.currentMouseOverDroppableNodeKey = null; | ||
@@ -104,11 +110,3 @@ _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) { | ||
@@ -326,6 +324,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) { | ||
@@ -335,5 +331,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) { | ||
@@ -589,7 +584,4 @@ var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
promise.then(function () { | ||
var _this$state7 = _this.state, | ||
currentLoadedKeys = _this$state7.loadedKeys, | ||
currentLoadingKeys = _this$state7.loadingKeys; | ||
var newLoadedKeys = arrAdd(currentLoadedKeys, key); | ||
var newLoadingKeys = arrDel(currentLoadingKeys, key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice. | ||
var currentLoadedKeys = _this.state.loadedKeys; | ||
var newLoadedKeys = arrAdd(currentLoadedKeys, key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice. | ||
// https://github.com/ant-design/ant-design/issues/12464 | ||
@@ -608,4 +600,6 @@ | ||
_this.setState({ | ||
loadingKeys: newLoadingKeys | ||
_this.setState(function (prevState) { | ||
return { | ||
loadingKeys: arrDel(prevState.loadingKeys, key) | ||
}; | ||
}); | ||
@@ -615,7 +609,6 @@ | ||
}).catch(function (e) { | ||
var currentLoadingKeys = _this.state.loadingKeys; | ||
var newLoadingKeys = arrDel(currentLoadingKeys, key); | ||
_this.setState({ | ||
loadingKeys: newLoadingKeys | ||
_this.setState(function (prevState) { | ||
return { | ||
loadingKeys: arrDel(prevState.loadingKeys, key) | ||
}; | ||
}); | ||
@@ -693,12 +686,12 @@ | ||
_this.getTreeNodeRequiredProps = function () { | ||
var _this$state8 = _this.state, | ||
expandedKeys = _this$state8.expandedKeys, | ||
selectedKeys = _this$state8.selectedKeys, | ||
loadedKeys = _this$state8.loadedKeys, | ||
loadingKeys = _this$state8.loadingKeys, | ||
checkedKeys = _this$state8.checkedKeys, | ||
halfCheckedKeys = _this$state8.halfCheckedKeys, | ||
dragOverNodeKey = _this$state8.dragOverNodeKey, | ||
dropPosition = _this$state8.dropPosition, | ||
keyEntities = _this$state8.keyEntities; | ||
var _this$state7 = _this.state, | ||
expandedKeys = _this$state7.expandedKeys, | ||
selectedKeys = _this$state7.selectedKeys, | ||
loadedKeys = _this$state7.loadedKeys, | ||
loadingKeys = _this$state7.loadingKeys, | ||
checkedKeys = _this$state7.checkedKeys, | ||
halfCheckedKeys = _this$state7.halfCheckedKeys, | ||
dragOverNodeKey = _this$state7.dragOverNodeKey, | ||
dropPosition = _this$state7.dropPosition, | ||
keyEntities = _this$state7.keyEntities; | ||
return { | ||
@@ -715,11 +708,8 @@ expandedKeys: expandedKeys || [], | ||
}; | ||
}; // =========================== Expanded =========================== | ||
}; | ||
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */ | ||
_this.setExpandedKeys = function (expandedKeys) { | ||
var _this$state9 = _this.state, | ||
treeData = _this$state9.treeData, | ||
fieldNames = _this$state9.fieldNames; | ||
var _this$state8 = _this.state, | ||
treeData = _this$state8.treeData, | ||
fieldNames = _this$state8.fieldNames; | ||
var flattenNodes = flattenTreeData(treeData, expandedKeys, fieldNames); | ||
@@ -735,5 +725,5 @@ | ||
var expandedKeys = _this.state.expandedKeys; | ||
var _this$state10 = _this.state, | ||
listChanging = _this$state10.listChanging, | ||
fieldNames = _this$state10.fieldNames; | ||
var _this$state9 = _this.state, | ||
listChanging = _this$state9.listChanging, | ||
fieldNames = _this$state9.fieldNames; | ||
var _this$props6 = _this.props, | ||
@@ -804,5 +794,4 @@ onExpand = _this$props6.onExpand, | ||
}); | ||
}; // =========================== Keyboard =========================== | ||
}; | ||
_this.onActiveChange = function (newActiveKey) { | ||
@@ -832,5 +821,5 @@ var activeKey = _this.state.activeKey; | ||
_this.getActiveItem = function () { | ||
var _this$state11 = _this.state, | ||
activeKey = _this$state11.activeKey, | ||
flattenNodes = _this$state11.flattenNodes; | ||
var _this$state10 = _this.state, | ||
activeKey = _this$state10.activeKey, | ||
flattenNodes = _this$state10.flattenNodes; | ||
@@ -848,5 +837,5 @@ if (activeKey === null) { | ||
_this.offsetActiveKey = function (offset) { | ||
var _this$state12 = _this.state, | ||
flattenNodes = _this$state12.flattenNodes, | ||
activeKey = _this$state12.activeKey; | ||
var _this$state11 = _this.state, | ||
flattenNodes = _this$state11.flattenNodes, | ||
activeKey = _this$state11.activeKey; | ||
var index = flattenNodes.findIndex(function (_ref3) { | ||
@@ -874,6 +863,6 @@ var key = _ref3.data.key; | ||
_this.onKeyDown = function (event) { | ||
var _this$state13 = _this.state, | ||
activeKey = _this$state13.activeKey, | ||
expandedKeys = _this$state13.expandedKeys, | ||
checkedKeys = _this$state13.checkedKeys; | ||
var _this$state12 = _this.state, | ||
activeKey = _this$state12.activeKey, | ||
expandedKeys = _this$state12.expandedKeys, | ||
checkedKeys = _this$state12.checkedKeys; | ||
var _this$props7 = _this.props, | ||
@@ -961,7 +950,3 @@ onKeyDown = _this$props7.onKeyDown, | ||
}; | ||
/** | ||
* Only update the value which is not in props | ||
*/ | ||
_this.setUncontrolledState = function (state) { | ||
@@ -1011,14 +996,14 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var _this$state14 = this.state, | ||
focused = _this$state14.focused, | ||
flattenNodes = _this$state14.flattenNodes, | ||
keyEntities = _this$state14.keyEntities, | ||
dragging = _this$state14.dragging, | ||
activeKey = _this$state14.activeKey, | ||
dropLevelOffset = _this$state14.dropLevelOffset, | ||
dropContainerKey = _this$state14.dropContainerKey, | ||
dropTargetKey = _this$state14.dropTargetKey, | ||
dropPosition = _this$state14.dropPosition, | ||
dragOverNodeKey = _this$state14.dragOverNodeKey, | ||
indent = _this$state14.indent; | ||
var _this$state13 = this.state, | ||
focused = _this$state13.focused, | ||
flattenNodes = _this$state13.flattenNodes, | ||
keyEntities = _this$state13.keyEntities, | ||
dragging = _this$state13.dragging, | ||
activeKey = _this$state13.activeKey, | ||
dropLevelOffset = _this$state13.dropLevelOffset, | ||
dropContainerKey = _this$state13.dropContainerKey, | ||
dropTargetKey = _this$state13.dropTargetKey, | ||
dropPosition = _this$state13.dropPosition, | ||
dragOverNodeKey = _this$state13.dragOverNodeKey, | ||
indent = _this$state13.indent; | ||
var _this$props8 = this.props, | ||
@@ -1025,0 +1010,0 @@ prefixCls = _this$props8.prefixCls, |
@@ -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"]; | ||
@@ -241,3 +242,3 @@ /* eslint-disable no-lonely-if */ | ||
var children = _ref3.children, | ||
props = _objectWithoutProperties(_ref3, ["children"]); | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
@@ -244,0 +245,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; |
"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); |
134
lib/Tree.js
@@ -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.currentMouseOverDroppableNodeKey = null; | ||
@@ -133,11 +140,3 @@ _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) { | ||
@@ -353,6 +352,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) { | ||
@@ -362,5 +359,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) { | ||
@@ -614,7 +610,4 @@ var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
promise.then(function () { | ||
var _this$state7 = _this.state, | ||
currentLoadedKeys = _this$state7.loadedKeys, | ||
currentLoadingKeys = _this$state7.loadingKeys; | ||
var newLoadedKeys = (0, _util.arrAdd)(currentLoadedKeys, key); | ||
var newLoadingKeys = (0, _util.arrDel)(currentLoadingKeys, key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice. | ||
var currentLoadedKeys = _this.state.loadedKeys; | ||
var newLoadedKeys = (0, _util.arrAdd)(currentLoadedKeys, key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice. | ||
// https://github.com/ant-design/ant-design/issues/12464 | ||
@@ -633,4 +626,6 @@ | ||
_this.setState({ | ||
loadingKeys: newLoadingKeys | ||
_this.setState(function (prevState) { | ||
return { | ||
loadingKeys: (0, _util.arrDel)(prevState.loadingKeys, key) | ||
}; | ||
}); | ||
@@ -640,7 +635,6 @@ | ||
}).catch(function (e) { | ||
var currentLoadingKeys = _this.state.loadingKeys; | ||
var newLoadingKeys = (0, _util.arrDel)(currentLoadingKeys, key); | ||
_this.setState({ | ||
loadingKeys: newLoadingKeys | ||
_this.setState(function (prevState) { | ||
return { | ||
loadingKeys: (0, _util.arrDel)(prevState.loadingKeys, key) | ||
}; | ||
}); | ||
@@ -718,12 +712,12 @@ | ||
_this.getTreeNodeRequiredProps = function () { | ||
var _this$state8 = _this.state, | ||
expandedKeys = _this$state8.expandedKeys, | ||
selectedKeys = _this$state8.selectedKeys, | ||
loadedKeys = _this$state8.loadedKeys, | ||
loadingKeys = _this$state8.loadingKeys, | ||
checkedKeys = _this$state8.checkedKeys, | ||
halfCheckedKeys = _this$state8.halfCheckedKeys, | ||
dragOverNodeKey = _this$state8.dragOverNodeKey, | ||
dropPosition = _this$state8.dropPosition, | ||
keyEntities = _this$state8.keyEntities; | ||
var _this$state7 = _this.state, | ||
expandedKeys = _this$state7.expandedKeys, | ||
selectedKeys = _this$state7.selectedKeys, | ||
loadedKeys = _this$state7.loadedKeys, | ||
loadingKeys = _this$state7.loadingKeys, | ||
checkedKeys = _this$state7.checkedKeys, | ||
halfCheckedKeys = _this$state7.halfCheckedKeys, | ||
dragOverNodeKey = _this$state7.dragOverNodeKey, | ||
dropPosition = _this$state7.dropPosition, | ||
keyEntities = _this$state7.keyEntities; | ||
return { | ||
@@ -740,11 +734,8 @@ expandedKeys: expandedKeys || [], | ||
}; | ||
}; // =========================== Expanded =========================== | ||
}; | ||
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */ | ||
_this.setExpandedKeys = function (expandedKeys) { | ||
var _this$state9 = _this.state, | ||
treeData = _this$state9.treeData, | ||
fieldNames = _this$state9.fieldNames; | ||
var _this$state8 = _this.state, | ||
treeData = _this$state8.treeData, | ||
fieldNames = _this$state8.fieldNames; | ||
var flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, expandedKeys, fieldNames); | ||
@@ -760,5 +751,5 @@ | ||
var expandedKeys = _this.state.expandedKeys; | ||
var _this$state10 = _this.state, | ||
listChanging = _this$state10.listChanging, | ||
fieldNames = _this$state10.fieldNames; | ||
var _this$state9 = _this.state, | ||
listChanging = _this$state9.listChanging, | ||
fieldNames = _this$state9.fieldNames; | ||
var _this$props6 = _this.props, | ||
@@ -829,5 +820,4 @@ onExpand = _this$props6.onExpand, | ||
}); | ||
}; // =========================== Keyboard =========================== | ||
}; | ||
_this.onActiveChange = function (newActiveKey) { | ||
@@ -857,5 +847,5 @@ var activeKey = _this.state.activeKey; | ||
_this.getActiveItem = function () { | ||
var _this$state11 = _this.state, | ||
activeKey = _this$state11.activeKey, | ||
flattenNodes = _this$state11.flattenNodes; | ||
var _this$state10 = _this.state, | ||
activeKey = _this$state10.activeKey, | ||
flattenNodes = _this$state10.flattenNodes; | ||
@@ -873,5 +863,5 @@ if (activeKey === null) { | ||
_this.offsetActiveKey = function (offset) { | ||
var _this$state12 = _this.state, | ||
flattenNodes = _this$state12.flattenNodes, | ||
activeKey = _this$state12.activeKey; | ||
var _this$state11 = _this.state, | ||
flattenNodes = _this$state11.flattenNodes, | ||
activeKey = _this$state11.activeKey; | ||
var index = flattenNodes.findIndex(function (_ref3) { | ||
@@ -899,6 +889,6 @@ var key = _ref3.data.key; | ||
_this.onKeyDown = function (event) { | ||
var _this$state13 = _this.state, | ||
activeKey = _this$state13.activeKey, | ||
expandedKeys = _this$state13.expandedKeys, | ||
checkedKeys = _this$state13.checkedKeys; | ||
var _this$state12 = _this.state, | ||
activeKey = _this$state12.activeKey, | ||
expandedKeys = _this$state12.expandedKeys, | ||
checkedKeys = _this$state12.checkedKeys; | ||
var _this$props7 = _this.props, | ||
@@ -986,7 +976,3 @@ onKeyDown = _this$props7.onKeyDown, | ||
}; | ||
/** | ||
* Only update the value which is not in props | ||
*/ | ||
_this.setUncontrolledState = function (state) { | ||
@@ -1036,14 +1022,14 @@ var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var _this$state14 = this.state, | ||
focused = _this$state14.focused, | ||
flattenNodes = _this$state14.flattenNodes, | ||
keyEntities = _this$state14.keyEntities, | ||
dragging = _this$state14.dragging, | ||
activeKey = _this$state14.activeKey, | ||
dropLevelOffset = _this$state14.dropLevelOffset, | ||
dropContainerKey = _this$state14.dropContainerKey, | ||
dropTargetKey = _this$state14.dropTargetKey, | ||
dropPosition = _this$state14.dropPosition, | ||
dragOverNodeKey = _this$state14.dragOverNodeKey, | ||
indent = _this$state14.indent; | ||
var _this$state13 = this.state, | ||
focused = _this$state13.focused, | ||
flattenNodes = _this$state13.flattenNodes, | ||
keyEntities = _this$state13.keyEntities, | ||
dragging = _this$state13.dragging, | ||
activeKey = _this$state13.activeKey, | ||
dropLevelOffset = _this$state13.dropLevelOffset, | ||
dropContainerKey = _this$state13.dropContainerKey, | ||
dropTargetKey = _this$state13.dropTargetKey, | ||
dropPosition = _this$state13.dropPosition, | ||
dragOverNodeKey = _this$state13.dragOverNodeKey, | ||
indent = _this$state13.indent; | ||
var _this$props8 = this.props, | ||
@@ -1050,0 +1036,0 @@ prefixCls = _this$props8.prefixCls, |
"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) { | ||
@@ -278,3 +275,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); | ||
@@ -281,0 +278,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.4", | ||
"version": "5.0.5", | ||
"description": "tree ui component for react", | ||
@@ -5,0 +5,0 @@ "engines": { |
333731
7155