adui
Version:
<div> <img src="https://wxa.wxs.qq.com/mpweb/delivery/legacy/wxadtouch/upload/t1/od834zef_52939fc6.png" style="margin:40px 0 0 -8px; background-color: #fcfcfc; box-shadow: none;" /> </div>
796 lines (795 loc) • 127 kB
JavaScript
"use strict";
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var React = _interopRequireWildcard(require("react"));
var _rcTreeSelect = _interopRequireWildcard(require("rc-tree-select"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _shallowequal = _interopRequireDefault(require("shallowequal"));
var _classnames = _interopRequireDefault(require("classnames"));
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
var _omit = _interopRequireDefault(require("../_util/omit"));
var _configProvider = require("../config-provider");
var _checkbox = _interopRequireDefault(require("../checkbox"));
var _icon = _interopRequireDefault(require("../icon"));
var _popover = _interopRequireDefault(require("../popover"));
var _portal = _interopRequireDefault(require("../portal"));
var _spinner = _interopRequireDefault(require("../spinner"));
require("./style");
var _excluded = ["children", "value", "popover", "popoverProps", "title"],
_excluded2 = ["autoClearSearchValue", "bottomContent", "children", "className", "filterTreeNode", "getPopupContainer", "intent", "maxTagCount", "multiple", "onDropdownVisibleChange", "placeholder", "rightIcon", "resultRender", "resultVisible", "sameValueEnabled", "selectAll", "showCheckedStrategy", "topContent", "treeData"];
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
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); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
var prefix = "adui-tree-select";
var sameValueSplitter = "__@@__";
var noop = function noop() {};
var strategies = {
"show-all": _rcTreeSelect.SHOW_ALL,
"show-child": _rcTreeSelect.SHOW_CHILD,
"show-parent": _rcTreeSelect.SHOW_PARENT
};
var isArrayIncludes = function isArrayIncludes(a1, a2) {
if (!Array.isArray(a1) || !Array.isArray(a2)) {
return false;
}
return a2.every(function (o) {
return a1.includes(o);
});
};
var TreeSelect = function (_React$Component) {
function TreeSelect(props) {
var _this;
_classCallCheck(this, TreeSelect);
_this = _callSuper(this, TreeSelect, [props]);
_this.select = void 0;
_this.portal = void 0;
_this.wrapper = void 0;
_this.treeData = void 0;
_this.treeValueAll = void 0;
_this.treeValueFlatten = [];
_this.shouldComponentUpdate = function (nextProps, nextState) {
return !(0, _shallowequal["default"])(_this.props, nextProps) || !(0, _shallowequal["default"])(_this.state, nextState);
};
_this.saveSelect = function (node) {
_this.select = node;
};
_this.saveWrapper = function (node) {
_this.wrapper = node;
};
_this.renderSwitcherIcon = function (_ref) {
var isLeaf = _ref.isLeaf,
loading = _ref.loading;
if (loading) {
return React.createElement(_spinner["default"], {
size: "mini",
className: "".concat(prefix, "-tree-switcher-icon")
});
}
if (isLeaf) {
return null;
}
return React.createElement(_icon["default"], {
icon: "triangle-right",
className: "".concat(prefix, "-tree-switcher-icon")
});
};
_this.handleVisibleChange = function (visible) {
setTimeout(function () {
_this.forceUpdate(function () {
var _this$props = _this.props,
bottomContent = _this$props.bottomContent,
topContent = _this$props.topContent;
var _this$state = _this.state,
hash = _this$state.hash,
bottomContentPortalTarget = _this$state.bottomContentPortalTarget,
topContentPortalTarget = _this$state.topContentPortalTarget;
if (visible && (topContent && !topContentPortalTarget || bottomContent && !bottomContentPortalTarget)) {
var dropdown = document.querySelector(".".concat(prefix, "-dropdown_").concat(hash));
if (dropdown) {
if (topContent && !topContentPortalTarget) {
var el = document.createElement("div");
el.onmousedown = function (e) {
e.preventDefault();
e.stopImmediatePropagation();
};
dropdown.insertBefore(el, dropdown.children[0]);
_this.setState({
topContentPortalTarget: el
});
}
if (bottomContent && !bottomContentPortalTarget) {
var _el = document.createElement("div");
_el.onmousedown = function (e) {
e.preventDefault();
e.stopImmediatePropagation();
};
dropdown.appendChild(_el);
_this.setState({
bottomContentPortalTarget: _el
});
}
}
}
});
}, 0);
};
_this.handleChange = function (value, titleList) {
var valueParam = [];
var _this$props2 = _this.props,
disabled = _this$props2.disabled,
multiple = _this$props2.multiple,
onChange = _this$props2.onChange,
valueProp = _this$props2.value,
sameValueEnabled = _this$props2.sameValueEnabled;
var valueState = _this.state.value;
if (!disabled) {
if (sameValueEnabled) {
value === null || value === void 0 || value.forEach(function (v) {
var splited = "".concat(v).split(sameValueSplitter);
var val = splited[splited.length - 1];
var _value$filter = value.filter(function (o) {
return "".concat(o).endsWith("".concat(sameValueSplitter).concat(val));
}),
length = _value$filter.length;
if (length === _this.treeValueFlatten.filter(function (o) {
return "".concat(o).endsWith("".concat(sameValueSplitter).concat(val));
}).length) {
valueParam.push(val);
} else if (!(valueState !== null && valueState !== void 0 && valueState.includes(val))) {
valueParam.push(val);
}
});
} else if (value) {
valueParam = value;
}
if (multiple) {
valueParam = _toConsumableArray(new Set(valueParam));
}
if (valueProp === null) {
_this.setState({
value: valueParam
});
}
if (onChange) {
onChange(valueParam, titleList);
}
}
};
_this.getFilteredTreeData = function (searchValue) {
var filterTreeNode = _this.props.filterTreeNode;
if (!searchValue || filterTreeNode === false) {
return _this.treeData;
}
var filterOptionFunc;
if (typeof filterTreeNode === "function") {
filterOptionFunc = filterTreeNode;
} else {
filterOptionFunc = _this.filterTreeNode;
}
var _dig = function dig(list) {
var keepAll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return list.map(function (dataNode) {
var children = dataNode.children;
var match = keepAll || filterOptionFunc && filterOptionFunc(searchValue, dataNode);
var childList = _dig(children || [], match);
if (match || childList.length) {
return _objectSpread(_objectSpread({}, dataNode), {}, {
children: childList
});
}
return null;
}).filter(function (node) {
return node;
});
};
return _dig(_this.treeData);
};
_this.handleSearch = function (val) {
var onSearch = _this.props.onSearch;
if (onSearch) {
onSearch(val, _this.getFilteredTreeData(val));
setTimeout(function () {
_this.forceUpdate();
}, 0);
}
};
_this.filterTreeNode = function (input, treeNode) {
var filterCaseSensitive = _this.props.filterCaseSensitive;
var key = treeNode.key,
title = treeNode.title,
value = treeNode.value,
dataTitle = treeNode.dataTitle;
if (!key || !value) {
return false;
}
if (!filterCaseSensitive) {
return String(dataTitle || title).toLocaleLowerCase().includes(input.toLocaleLowerCase());
}
return String(dataTitle || title).includes(input);
};
_this.getMaxTagCount = function () {
var maxTagCount = _this.props.maxTagCount;
var value = _this.state.value;
if (!maxTagCount || !value || value.length <= maxTagCount) {
return null;
}
return 0;
};
_this.handleSelectAll = function () {
var _this$props3 = _this.props,
valueProp = _this$props3.value,
onChange = _this$props3.onChange;
var value = _this.state.value;
if (isArrayIncludes(value || [], _this.treeValueAll)) {
if (valueProp === null) {
_this.setState({
value: []
});
}
if (onChange) {
onChange([], []);
}
} else {
if (valueProp === null) {
_this.setState({
value: _this.treeValueAll
});
}
if (onChange) {
onChange(_this.treeValueAll, []);
}
}
};
_this.getMaxTagPlaceholder = function (nodes) {
var _nodes$;
if (!_this.select) {
return null;
}
var _this$props4 = _this.props,
onChange = _this$props4.onChange,
resultRender = _this$props4.resultRender,
value = _this$props4.value,
disabledProp = _this$props4.disabled;
if (resultRender) {
return resultRender(nodes);
}
var length = nodes.length;
var placeholderText = React.createElement(React.Fragment, null, React.createElement("span", {
style: {
display: "inline-block",
verticalAlign: "top",
maxWidth: "calc(100% - 53px)",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap"
}
}, (_nodes$ = nodes[0]) === null || _nodes$ === void 0 ? void 0 : _nodes$.label), React.createElement("span", {
style: {
display: "inline-block",
verticalAlign: "top"
}
}, "\u7B49 ", length, " \u4E2A"));
return React.createElement(_popover["default"], {
visible: disabledProp ? false : undefined,
alignEdge: false,
placement: "top",
popup: React.createElement("div", {
role: "none",
className: "".concat(prefix, "-max-popover-item-wrapper"),
onMouseDown: function onMouseDown(e) {
return e.stopPropagation();
}
}, nodes.map(function (_ref2, i) {
var key = _ref2.key,
disabled = _ref2.disabled,
label = _ref2.label;
return React.createElement("div", {
className: "".concat(prefix, "-max-popover-item"),
key: key
}, React.createElement("span", null, label), !disabled && React.createElement(_icon["default"], {
icon: "cancel",
onClick: function onClick() {
var vals = nodes.map(function (o) {
return o.value;
});
vals.splice(i, 1);
if (value === null) {
_this.setState({
value: vals
});
}
var labels = nodes.map(function (o) {
return o.label;
});
labels.splice(i, 1);
if (onChange) {
onChange(vals, labels);
}
}
}));
})),
popupClassName: "".concat(prefix, "-maxPopover")
}, React.createElement("div", {
className: "".concat(prefix, "-maxPlaceholder"),
role: "none",
onClick: function onClick(e) {
return e.stopPropagation();
}
}, placeholderText, React.createElement(_icon["default"], {
icon: "cancel",
size: 14,
onClick: function onClick() {
if (!disabledProp) {
if (value === null) {
_this.setState({
value: []
});
}
if (onChange) {
onChange([], []);
}
}
}
})));
};
_this.convertChildrenToData = function (nodes) {
return (0, _toArray["default"])(nodes).map(function (node) {
if (!React.isValidElement(node) || !node.type) {
return null;
}
var _ref3 = node,
key = _ref3.key,
_ref3$props = _ref3.props,
children = _ref3$props.children,
value = _ref3$props.value,
popover = _ref3$props.popover,
popoverProps = _ref3$props.popoverProps,
title = _ref3$props.title,
restProps = _objectWithoutProperties(_ref3$props, _excluded);
var data = _objectSpread({
key: key,
value: value,
dataTitle: title,
title: popover ? React.createElement(React.Fragment, null, React.createElement("div", {
className: "".concat(prefix, "-pop-trigger")
}, title), React.createElement(_popover["default"], _extends({
popup: popover,
placement: "right"
}, popoverProps), React.createElement("div", {
className: "".concat(prefix, "-pop-trigger-placeholder")
}))) : title
}, restProps);
var childData = _this.convertChildrenToData(children);
if (childData.length) {
data.children = childData;
}
return data;
}).filter(function (data) {
return data;
});
};
_this.convertTreeData = function (dataNodeParam) {
var _dataNode$, _dataNode$2;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var sameValueEnabled = _this.props.sameValueEnabled;
if (!dataNodeParam) {
return undefined;
}
var dataNode = _toConsumableArray(dataNodeParam);
var valueState = _this.state.value;
var isAllSelected = isArrayIncludes(valueState || [], _this.treeValueAll);
var indeterminate = !isAllSelected && !!(valueState !== null && valueState !== void 0 && valueState.length);
if (((_dataNode$ = dataNode[0]) === null || _dataNode$ === void 0 ? void 0 : _dataNode$.key) === "".concat(prefix, "-tree-treenode-all")) {
return dataNode;
}
if (sameValueEnabled && !((_dataNode$2 = dataNode[0]) !== null && _dataNode$2 !== void 0 && _dataNode$2.dataTitle)) {
_this.treeValueFlatten = [];
}
var selectAll = options.selectAll;
var _process = function process(node, parentValue) {
node.forEach(function (o) {
var children = o.children,
key = o.key,
title = o.title,
dataChildren = o.dataChildren,
dataTitle = o.dataTitle,
value = o.value,
popover = o.popover,
_o$popoverProps = o.popoverProps,
popoverProps = _o$popoverProps === void 0 ? {} : _o$popoverProps;
if (dataTitle && dataChildren) {
return;
}
if (title && !dataTitle) {
o.dataTitle = title;
}
if (children !== null && children !== void 0 && children.length) {
o.dataChildren = 1;
}
if (key === undefined) {
o.key = value;
} else if (value === undefined) {
o.value = key;
}
if (sameValueEnabled) {
var newVal = "".concat(parentValue ? "".concat(parentValue).concat(sameValueSplitter) : "").concat(value);
o.key = newVal;
o.value = newVal;
if (!_this.treeValueFlatten.includes(newVal)) {
_this.treeValueFlatten.push(newVal);
}
}
if (popover) {
o.title = React.createElement(React.Fragment, null, React.createElement("div", {
className: "".concat(prefix, "-pop-trigger")
}, title), React.createElement(_popover["default"], _extends({
popup: popover,
placement: "right"
}, popoverProps), React.createElement("div", {
className: "".concat(prefix, "-pop-trigger-placeholder")
})));
}
if (children) {
_process(children, o.value);
}
});
};
_process(dataNode);
if (selectAll) {
dataNode.unshift({
title: React.createElement("div", {
role: "none",
className: "".concat(prefix, "-tree-treenode-all-inner"),
onClick: _this.handleSelectAll
}, "\u5168\u9009", React.createElement(_checkbox["default"], {
size: "medium",
checked: isAllSelected,
indeterminate: indeterminate
})),
className: "".concat(prefix, "-tree-treenode-all"),
key: "".concat(prefix, "-tree-treenode-all"),
value: "".concat(prefix, "-tree-treenode-all"),
checkable: false,
disableCheckbox: true
});
}
return dataNode;
};
_this.listenInputChange = function (e) {
var onSearchEnter = _this.props.onSearchEnter;
var value = e.target.value,
key = e.key;
if (key === "Backspace" && value === "") {
e.stopPropagation();
}
setTimeout(function () {
if (key === "Enter" && onSearchEnter) {
onSearchEnter(e);
}
}, 0);
};
_this.componentDidMount = function () {
var _this$wrapper;
var input = (_this$wrapper = _this.wrapper) === null || _this$wrapper === void 0 ? void 0 : _this$wrapper.querySelector("input");
var _this$props5 = _this.props,
maxTagCount = _this$props5.maxTagCount,
placeholder = _this$props5.placeholder,
resultVisible = _this$props5.resultVisible;
var value = _this.state.value;
if (input) {
input.addEventListener("keydown", _this.listenInputChange, false);
}
if (maxTagCount !== null && value) {
_this.forceUpdate();
}
if (!resultVisible && _this.wrapper) {
if (input) {
input.placeholder = placeholder;
}
}
};
_this.componentDidUpdate = function () {
var _this$props6 = _this.props,
resultVisible = _this$props6.resultVisible,
placeholder = _this$props6.placeholder;
if (!resultVisible) {
setTimeout(function () {
var _this$wrapper2;
window.dispatchEvent(new Event("resize"));
var input = (_this$wrapper2 = _this.wrapper) === null || _this$wrapper2 === void 0 ? void 0 : _this$wrapper2.querySelector("input");
if (input) {
input.placeholder = placeholder;
}
}, 0);
}
};
var _value = props.value,
defaultValue = props.defaultValue;
var _valueState = _value !== null ? _value : defaultValue;
_this.state = {
hash: Math.random().toString(36).substring(3, 8),
value: _valueState
};
return _this;
}
_inherits(TreeSelect, _React$Component);
return _createClass(TreeSelect, [{
key: "render",
value: function render() {
var _this2 = this;
var _this$props7 = this.props,
autoClearSearchValue = _this$props7.autoClearSearchValue,
bottomContent = _this$props7.bottomContent,
children = _this$props7.children,
className = _this$props7.className,
filterTreeNode = _this$props7.filterTreeNode,
getPopupContainer = _this$props7.getPopupContainer,
intent = _this$props7.intent,
maxTagCount = _this$props7.maxTagCount,
multiple = _this$props7.multiple,
_onDropdownVisibleChange = _this$props7.onDropdownVisibleChange,
placeholder = _this$props7.placeholder,
rightIcon = _this$props7.rightIcon,
resultRender = _this$props7.resultRender,
resultVisible = _this$props7.resultVisible,
sameValueEnabled = _this$props7.sameValueEnabled,
selectAll = _this$props7.selectAll,
showCheckedStrategy = _this$props7.showCheckedStrategy,
topContent = _this$props7.topContent,
treeData = _this$props7.treeData,
otherProps = _objectWithoutProperties(_this$props7, _excluded2);
var restProps = (0, _omit["default"])(otherProps, ["filterCaseSensitive", "onChange", "onSearch", "onSearchEnter", "defaultValue", "value"]);
var _this$state2 = this.state,
hash = _this$state2.hash,
bottomContentPortalTarget = _this$state2.bottomContentPortalTarget,
topContentPortalTarget = _this$state2.topContentPortalTarget,
value = _this$state2.value;
var classSet = (0, _classnames["default"])(className, "".concat(prefix, "-").concat(intent), _defineProperty({}, "".concat(prefix, "_resultHidden"), !resultVisible));
var checkbox = multiple;
if (multiple) {
checkbox = React.createElement("div", null, React.createElement("svg", {
width: "12",
height: "10",
className: "".concat(prefix, "-tree-checkbox-indeterminateSvg")
}, React.createElement("rect", {
x: "1",
y: "4",
width: "10",
height: "2",
rx: ".5",
fill: "#fff",
fillRule: "evenodd"
})), React.createElement("svg", {
width: "12",
height: "10",
className: "".concat(prefix, "-tree-checkbox-checkedSvg")
}, React.createElement("path", {
d: "M.618 5.827a.463.463 0 0 1-.02-.675l.804-.804a.52.52 0 0 1 .716-.01L4.75 6.75l4.922-5.625a.513.513 0 0 1 .707-.06l.742.62a.478.478 0 0 1 .044.687l-6.08 6.756a.506.506 0 0 1-.703.045L.618 5.827z",
fillRule: "evenodd"
})));
}
if (value !== null) {
restProps.value = value;
}
if (sameValueEnabled) {
var trueValue = [];
if (restProps.value) {
restProps.value.forEach(function (o) {
_this2.treeValueFlatten.forEach(function (p) {
var splited = p.split(sameValueSplitter);
if (splited[splited.length - 1] === o) {
trueValue.push(p);
}
});
});
}
restProps.value = trueValue;
}
if (maxTagCount !== null) {
var count = this.getMaxTagCount();
if (count !== null) {
restProps.maxTagCount = count;
}
}
if (resultRender) {
restProps.maxTagCount = 0;
}
var treeDataFinal = this.convertTreeData(treeData || this.convertChildrenToData(children), {
selectAll: selectAll
}) || [];
this.treeData = treeDataFinal;
if (showCheckedStrategy === "show-parent") {
this.treeValueAll = treeDataFinal.map(function (_ref4) {
var val = _ref4.value,
disabled = _ref4.disabled,
disableCheckbox = _ref4.disableCheckbox,
checkable = _ref4.checkable;
if (val !== undefined && !disabled && !disableCheckbox && checkable !== false) {
return val;
}
return undefined;
}).filter(function (o) {
return Boolean(o) || o === 0;
});
} else {
var treeValueAll = [];
var _getAllValue = function getAllValue(data) {
data.forEach(function (_ref5) {
var val = _ref5.value,
disabled = _ref5.disabled,
disableCheckbox = _ref5.disableCheckbox,
checkable = _ref5.checkable,
child = _ref5.children;
if (val !== undefined && !disabled && !disableCheckbox && checkable !== false) {
if (showCheckedStrategy === "show-all" || !child) {
treeValueAll.push(val);
} else {
_getAllValue(child);
}
}
});
};
_getAllValue(treeDataFinal);
this.treeValueAll = treeValueAll.filter(function (o) {
return Boolean(o) || o === 0;
});
}
var multiLevel = treeDataFinal.some(function (o) {
var _o$children;
return (_o$children = o.children) === null || _o$children === void 0 ? void 0 : _o$children.length;
});
return React.createElement(_configProvider.ConfigContext.Consumer, null, function (_ref6) {
var getPopupContainerContext = _ref6.getPopupContainer;
return React.createElement("div", {
className: (0, _classnames["default"])("".concat(prefix, "-wrapper ").concat(prefix, "-wrapper_").concat(hash), _defineProperty(_defineProperty({}, "".concat(prefix, "-wrapper-maxTag"), _this2.getMaxTagCount() !== null), "".concat(prefix, "-wrapper-resultRender"), !!resultRender)),
ref: _this2.saveWrapper
}, topContent && topContentPortalTarget && React.createElement(_portal["default"], {
container: topContentPortalTarget
}, topContent), bottomContent && bottomContentPortalTarget && React.createElement(_portal["default"], {
container: bottomContentPortalTarget
}, bottomContent), React.createElement(_rcTreeSelect["default"], _extends({
autoClearSearchValue: resultVisible ? autoClearSearchValue : false,
className: classSet,
dropdownClassName: (0, _classnames["default"])("".concat(prefix, "-dropdown_").concat(hash), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefix, "-dropdown-multiple"), multiple), "".concat(prefix, "-dropdown-single"), !multiple), "".concat(prefix, "-dropdown-all"), selectAll), "".concat(prefix, "-dropdown-single-level"), !multiLevel)),
filterTreeNode: filterTreeNode || _this2.filterTreeNode,
getPopupContainer: getPopupContainer || getPopupContainerContext,
inputIcon: React.createElement(_icon["default"], {
icon: "triangle-down"
}),
maxTagPlaceholder: _this2.getMaxTagPlaceholder,
notFoundContent: React.createElement(React.Fragment, null, React.createElement(_icon["default"], {
icon: "file-outlined",
color: "var(--transparent-gray-600)",
style: {
marginRight: "4px"
}
}), "\u65E0\u5339\u914D\u9879"),
onChange: _this2.handleChange,
onSearch: _this2.handleSearch,
placeholder: placeholder,
prefixCls: prefix,
ref: _this2.saveSelect,
removeIcon: React.createElement(_icon["default"], {
icon: "cancel",
interactive: true,
size: 16
}),
showCheckedStrategy: showCheckedStrategy && strategies[showCheckedStrategy],
showSearch: multiple,
switcherIcon: _this2.renderSwitcherIcon,
transitionName: "slide-up",
treeCheckable: checkbox,
treeNodeFilterProp: "title",
listItemHeight: 32,
listHeight: 280,
treeData: treeDataFinal,
onDropdownVisibleChange: function onDropdownVisibleChange(visible) {
if (!visible) {
_this2.handleSearch("");
}
_this2.handleVisibleChange(visible);
if (_onDropdownVisibleChange) {
_onDropdownVisibleChange(visible);
}
}
}, restProps)), !!rightIcon && multiple && React.createElement(_icon["default"], {
icon: rightIcon,
className: "".concat(prefix, "-icon")
}));
});
}
}]);
}(React.Component);
TreeSelect.propTypes = {
autoClearSearchValue: _propTypes["default"].bool,
bottomContent: _propTypes["default"].node,
className: _propTypes["default"].string,
defaultValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array]),
disabled: _propTypes["default"].bool,
filterTreeNode: _propTypes["default"].any,
filterCaseSensitive: _propTypes["default"].bool,
getPopupContainer: _propTypes["default"].func,
intent: _propTypes["default"].oneOf(["normal", "primary", "success", "warning", "danger"]),
maxTagCount: _propTypes["default"].number,
multiple: _propTypes["default"].bool,
onChange: _propTypes["default"].func,
onDropdownVisibleChange: _propTypes["default"].func,
onSearch: _propTypes["default"].func,
onSearchEnter: _propTypes["default"].func,
placeholder: _propTypes["default"].string,
resultRender: _propTypes["default"].func,
resultVisible: _propTypes["default"].bool,
rightIcon: _propTypes["default"].string,
sameValueEnabled: _propTypes["default"].bool,
selectAll: _propTypes["default"].bool,
showCheckedStrategy: _propTypes["default"].oneOf(["show-all", "show-parent", "show-child"]),
topContent: _propTypes["default"].node,
treeData: _propTypes["default"].array,
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array])
};
TreeSelect.defaultProps = {
autoClearSearchValue: false,
bottomContent: undefined,
className: undefined,
defaultValue: null,
disabled: false,
filterTreeNode: undefined,
filterCaseSensitive: false,
getPopupContainer: null,
intent: "normal",
maxTagCount: null,
multiple: true,
onChange: noop,
onDropdownVisibleChange: noop,
onSearch: noop,
onSearchEnter: noop,
placeholder: "请选择",
resultRender: null,
resultVisible: true,
rightIcon: "list",
sameValueEnabled: false,
selectAll: false,
showCheckedStrategy: "show-parent",
topContent: undefined,
treeData: undefined,
value: null
};
TreeSelect.getDerivedStateFromProps = function (_ref7) {
var value = _ref7.value;
if (value !== null) {
return {
value: value
};
}
return null;
};
TreeSelect.TreeNode = _rcTreeSelect.TreeNode;
var _default = exports["default"] = TreeSelect;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJSZWFjdCIsIl9pbnRlcm9wUmVxdWlyZVdpbGRjYXJkIiwicmVxdWlyZSIsIl9yY1RyZWVTZWxlY3QiLCJfcHJvcFR5cGVzIiwiX2ludGVyb3BSZXF1aXJlRGVmYXVsdCIsIl9zaGFsbG93ZXF1YWwiLCJfY2xhc3NuYW1lcyIsIl90b0FycmF5IiwiX29taXQiLCJfY29uZmlnUHJvdmlkZXIiLCJfY2hlY2tib3giLCJfaWNvbiIsIl9wb3BvdmVyIiwiX3BvcnRhbCIsIl9zcGlubmVyIiwiX2V4Y2x1ZGVkIiwiX2V4Y2x1ZGVkMiIsImUiLCJfX2VzTW9kdWxlIiwiX2dldFJlcXVpcmVXaWxkY2FyZENhY2hlIiwiV2Vha01hcCIsInIiLCJ0IiwiX3R5cGVvZiIsImhhcyIsImdldCIsIm4iLCJfX3Byb3RvX18iLCJhIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IiLCJ1Iiwi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gICog5pCc57Si5Zue6L2m5pe255qE5Zue6LCD77yM5Y+C5pWwOiBlXG4gICAgICovXG4gICAgb25TZWFyY2hFbnRlcjog