You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14109 lines
516 KiB
14109 lines
516 KiB
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[56,6,8],{
|
|
|
|
/***/ "55Ip":
|
|
/*!***************************************************************!*\
|
|
!*** ./node_modules/react-router-dom/esm/react-router-dom.js ***!
|
|
\***************************************************************/
|
|
/*! exports provided: MemoryRouter, Prompt, Redirect, Route, Router, StaticRouter, Switch, generatePath, matchPath, useHistory, useLocation, useParams, useRouteMatch, withRouter, BrowserRouter, HashRouter, Link, NavLink */
|
|
/*! exports used: Link, NavLink */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* unused harmony export BrowserRouter */
|
|
/* unused harmony export HashRouter */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Link; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NavLink; });
|
|
/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router */ "Ty5D");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "dI71");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
|
|
/* harmony import */ var history__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! history */ "YS25");
|
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! prop-types */ "17x9");
|
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_4__);
|
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "wx14");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "zLVn");
|
|
/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! tiny-invariant */ "9R94");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The public API for a <Router> that uses HTML5 history.
|
|
*/
|
|
|
|
var BrowserRouter =
|
|
/*#__PURE__*/
|
|
function (_React$Component) {
|
|
Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(BrowserRouter, _React$Component);
|
|
|
|
function BrowserRouter() {
|
|
var _this;
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
_this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createBrowserHistory */ "a"])(_this.props);
|
|
return _this;
|
|
}
|
|
|
|
var _proto = BrowserRouter.prototype;
|
|
|
|
_proto.render = function render() {
|
|
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* Router */ "c"], {
|
|
history: this.history,
|
|
children: this.props.children
|
|
});
|
|
};
|
|
|
|
return BrowserRouter;
|
|
}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component);
|
|
|
|
if (false) {}
|
|
|
|
/**
|
|
* The public API for a <Router> that uses window.location.hash.
|
|
*/
|
|
|
|
var HashRouter =
|
|
/*#__PURE__*/
|
|
function (_React$Component) {
|
|
Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(HashRouter, _React$Component);
|
|
|
|
function HashRouter() {
|
|
var _this;
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
_this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createHashHistory */ "b"])(_this.props);
|
|
return _this;
|
|
}
|
|
|
|
var _proto = HashRouter.prototype;
|
|
|
|
_proto.render = function render() {
|
|
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* Router */ "c"], {
|
|
history: this.history,
|
|
children: this.props.children
|
|
});
|
|
};
|
|
|
|
return HashRouter;
|
|
}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component);
|
|
|
|
if (false) {}
|
|
|
|
var resolveToLocation = function resolveToLocation(to, currentLocation) {
|
|
return typeof to === "function" ? to(currentLocation) : to;
|
|
};
|
|
var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
|
|
return typeof to === "string" ? Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createLocation */ "c"])(to, null, null, currentLocation) : to;
|
|
};
|
|
|
|
var forwardRefShim = function forwardRefShim(C) {
|
|
return C;
|
|
};
|
|
|
|
var forwardRef = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef;
|
|
|
|
if (typeof forwardRef === "undefined") {
|
|
forwardRef = forwardRefShim;
|
|
}
|
|
|
|
function isModifiedEvent(event) {
|
|
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
}
|
|
|
|
var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
|
|
var innerRef = _ref.innerRef,
|
|
navigate = _ref.navigate,
|
|
_onClick = _ref.onClick,
|
|
rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref, ["innerRef", "navigate", "onClick"]);
|
|
|
|
var target = rest.target;
|
|
|
|
var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, rest, {
|
|
onClick: function onClick(event) {
|
|
try {
|
|
if (_onClick) _onClick(event);
|
|
} catch (ex) {
|
|
event.preventDefault();
|
|
throw ex;
|
|
}
|
|
|
|
if (!event.defaultPrevented && // onClick prevented default
|
|
event.button === 0 && ( // ignore everything but left clicks
|
|
!target || target === "_self") && // let browser handle "target=_blank" etc.
|
|
!isModifiedEvent(event) // ignore clicks with modifier keys
|
|
) {
|
|
event.preventDefault();
|
|
navigate();
|
|
}
|
|
}
|
|
}); // React 15 compat
|
|
|
|
|
|
if (forwardRefShim !== forwardRef) {
|
|
props.ref = forwardedRef || innerRef;
|
|
} else {
|
|
props.ref = innerRef;
|
|
}
|
|
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
|
|
|
|
|
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement("a", props);
|
|
});
|
|
|
|
if (false) {}
|
|
/**
|
|
* The public API for rendering a history-aware <a>.
|
|
*/
|
|
|
|
|
|
var Link = forwardRef(function (_ref2, forwardedRef) {
|
|
var _ref2$component = _ref2.component,
|
|
component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
|
|
replace = _ref2.replace,
|
|
to = _ref2.to,
|
|
innerRef = _ref2.innerRef,
|
|
rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref2, ["component", "replace", "to", "innerRef"]);
|
|
|
|
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* __RouterContext */ "e"].Consumer, null, function (context) {
|
|
!context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(false) : void 0;
|
|
var history = context.history;
|
|
var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
|
|
var href = location ? history.createHref(location) : "";
|
|
|
|
var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, rest, {
|
|
href: href,
|
|
navigate: function navigate() {
|
|
var location = resolveToLocation(to, context.location);
|
|
var method = replace ? history.replace : history.push;
|
|
method(location);
|
|
}
|
|
}); // React 15 compat
|
|
|
|
|
|
if (forwardRefShim !== forwardRef) {
|
|
props.ref = forwardedRef || innerRef;
|
|
} else {
|
|
props.innerRef = innerRef;
|
|
}
|
|
|
|
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(component, props);
|
|
});
|
|
});
|
|
|
|
if (false) { var refType, toType; }
|
|
|
|
var forwardRefShim$1 = function forwardRefShim(C) {
|
|
return C;
|
|
};
|
|
|
|
var forwardRef$1 = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef;
|
|
|
|
if (typeof forwardRef$1 === "undefined") {
|
|
forwardRef$1 = forwardRefShim$1;
|
|
}
|
|
|
|
function joinClassnames() {
|
|
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
classnames[_key] = arguments[_key];
|
|
}
|
|
|
|
return classnames.filter(function (i) {
|
|
return i;
|
|
}).join(" ");
|
|
}
|
|
/**
|
|
* A <Link> wrapper that knows if it's "active" or not.
|
|
*/
|
|
|
|
|
|
var NavLink = forwardRef$1(function (_ref, forwardedRef) {
|
|
var _ref$ariaCurrent = _ref["aria-current"],
|
|
ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
|
|
_ref$activeClassName = _ref.activeClassName,
|
|
activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
|
|
activeStyle = _ref.activeStyle,
|
|
classNameProp = _ref.className,
|
|
exact = _ref.exact,
|
|
isActiveProp = _ref.isActive,
|
|
locationProp = _ref.location,
|
|
sensitive = _ref.sensitive,
|
|
strict = _ref.strict,
|
|
styleProp = _ref.style,
|
|
to = _ref.to,
|
|
innerRef = _ref.innerRef,
|
|
rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
|
|
|
|
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* __RouterContext */ "e"].Consumer, null, function (context) {
|
|
!context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(false) : void 0;
|
|
var currentLocation = locationProp || context.location;
|
|
var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
|
|
var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
|
|
|
|
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
var match = escapedPath ? Object(react_router__WEBPACK_IMPORTED_MODULE_0__[/* matchPath */ "f"])(currentLocation.pathname, {
|
|
path: escapedPath,
|
|
exact: exact,
|
|
sensitive: sensitive,
|
|
strict: strict
|
|
}) : null;
|
|
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
var className = isActive ? joinClassnames(classNameProp, activeClassName) : classNameProp;
|
|
var style = isActive ? Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, styleProp, {}, activeStyle) : styleProp;
|
|
|
|
var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({
|
|
"aria-current": isActive && ariaCurrent || null,
|
|
className: className,
|
|
style: style,
|
|
to: toLocation
|
|
}, rest); // React 15 compat
|
|
|
|
|
|
if (forwardRefShim$1 !== forwardRef$1) {
|
|
props.ref = forwardedRef || innerRef;
|
|
} else {
|
|
props.innerRef = innerRef;
|
|
}
|
|
|
|
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(Link, props);
|
|
});
|
|
});
|
|
|
|
if (false) { var ariaCurrentType; }
|
|
|
|
|
|
//# sourceMappingURL=react-router-dom.js.map
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "6+eU":
|
|
/*!************************************************************!*\
|
|
!*** ./node_modules/rc-pagination/es/index.js + 4 modules ***!
|
|
\************************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-pagination/es/locale/zh_CN.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ es_Pagination; });
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__("wx14");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__("rePB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("VTBJ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__("1OyB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__("vuIU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__("Ji7U");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__("LK+K");
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-pagination/es/Pager.js
|
|
|
|
|
|
/* eslint react/prop-types: 0 */
|
|
|
|
|
|
|
|
var Pager_Pager = function Pager(props) {
|
|
var _classNames;
|
|
|
|
var prefixCls = "".concat(props.rootPrefixCls, "-item");
|
|
var cls = classnames_default()(prefixCls, "".concat(prefixCls, "-").concat(props.page), (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-active"), props.active), Object(defineProperty["a" /* default */])(_classNames, props.className, !!props.className), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-disabled"), !props.page), _classNames));
|
|
|
|
var handleClick = function handleClick() {
|
|
props.onClick(props.page);
|
|
};
|
|
|
|
var handleKeyPress = function handleKeyPress(e) {
|
|
props.onKeyPress(e, props.onClick, props.page);
|
|
};
|
|
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: props.showTitle ? props.page : null,
|
|
className: cls,
|
|
onClick: handleClick,
|
|
onKeyPress: handleKeyPress,
|
|
tabIndex: "0"
|
|
}, props.itemRender(props.page, 'page', /*#__PURE__*/external_window_React_default.a.createElement("a", {
|
|
rel: "nofollow"
|
|
}, props.page)));
|
|
};
|
|
|
|
/* harmony default export */ var es_Pager = (Pager_Pager);
|
|
// CONCATENATED MODULE: ./node_modules/rc-pagination/es/KeyCode.js
|
|
/* harmony default export */ var KeyCode = ({
|
|
ZERO: 48,
|
|
NINE: 57,
|
|
NUMPAD_ZERO: 96,
|
|
NUMPAD_NINE: 105,
|
|
BACKSPACE: 8,
|
|
DELETE: 46,
|
|
ENTER: 13,
|
|
ARROW_UP: 38,
|
|
ARROW_DOWN: 40
|
|
});
|
|
// CONCATENATED MODULE: ./node_modules/rc-pagination/es/Options.js
|
|
|
|
|
|
|
|
|
|
|
|
/* eslint react/prop-types: 0 */
|
|
|
|
|
|
|
|
var Options_Options = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(Options, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(Options);
|
|
|
|
function Options() {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, Options);
|
|
|
|
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 = {
|
|
goInputText: ''
|
|
};
|
|
|
|
_this.buildOptionText = function (value) {
|
|
return "".concat(value, " ").concat(_this.props.locale.items_per_page);
|
|
};
|
|
|
|
_this.changeSize = function (value) {
|
|
_this.props.changeSize(Number(value));
|
|
};
|
|
|
|
_this.handleChange = function (e) {
|
|
_this.setState({
|
|
goInputText: e.target.value
|
|
});
|
|
};
|
|
|
|
_this.handleBlur = function (e) {
|
|
var _this$props = _this.props,
|
|
goButton = _this$props.goButton,
|
|
quickGo = _this$props.quickGo,
|
|
rootPrefixCls = _this$props.rootPrefixCls;
|
|
var goInputText = _this.state.goInputText;
|
|
|
|
if (goButton || goInputText === '') {
|
|
return;
|
|
}
|
|
|
|
if (e.relatedTarget && (e.relatedTarget.className.indexOf("".concat(rootPrefixCls, "-prev")) >= 0 || e.relatedTarget.className.indexOf("".concat(rootPrefixCls, "-next")) >= 0)) {
|
|
return;
|
|
}
|
|
|
|
_this.setState({
|
|
goInputText: ''
|
|
});
|
|
|
|
quickGo(_this.getValidValue());
|
|
};
|
|
|
|
_this.go = function (e) {
|
|
var goInputText = _this.state.goInputText;
|
|
|
|
if (goInputText === '') {
|
|
return;
|
|
}
|
|
|
|
if (e.keyCode === KeyCode.ENTER || e.type === 'click') {
|
|
_this.setState({
|
|
goInputText: ''
|
|
});
|
|
|
|
_this.props.quickGo(_this.getValidValue());
|
|
}
|
|
};
|
|
|
|
return _this;
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(Options, [{
|
|
key: "getValidValue",
|
|
value: function getValidValue() {
|
|
var _this$state = this.state,
|
|
goInputText = _this$state.goInputText,
|
|
current = _this$state.current; // eslint-disable-next-line no-restricted-globals
|
|
|
|
return !goInputText || isNaN(goInputText) ? current : Number(goInputText);
|
|
}
|
|
}, {
|
|
key: "getPageSizeOptions",
|
|
value: function getPageSizeOptions() {
|
|
var _this$props2 = this.props,
|
|
pageSize = _this$props2.pageSize,
|
|
pageSizeOptions = _this$props2.pageSizeOptions;
|
|
|
|
if (pageSizeOptions.some(function (option) {
|
|
return option.toString() === pageSize.toString();
|
|
})) {
|
|
return pageSizeOptions;
|
|
}
|
|
|
|
return pageSizeOptions.concat([pageSize.toString()]).sort(function (a, b) {
|
|
// eslint-disable-next-line no-restricted-globals
|
|
var numberA = isNaN(Number(a)) ? 0 : Number(a); // eslint-disable-next-line no-restricted-globals
|
|
|
|
var numberB = isNaN(Number(b)) ? 0 : Number(b);
|
|
return numberA - numberB;
|
|
});
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
var _this2 = this;
|
|
|
|
var _this$props3 = this.props,
|
|
pageSize = _this$props3.pageSize,
|
|
locale = _this$props3.locale,
|
|
rootPrefixCls = _this$props3.rootPrefixCls,
|
|
changeSize = _this$props3.changeSize,
|
|
quickGo = _this$props3.quickGo,
|
|
goButton = _this$props3.goButton,
|
|
selectComponentClass = _this$props3.selectComponentClass,
|
|
buildOptionText = _this$props3.buildOptionText,
|
|
selectPrefixCls = _this$props3.selectPrefixCls,
|
|
disabled = _this$props3.disabled;
|
|
var goInputText = this.state.goInputText;
|
|
var prefixCls = "".concat(rootPrefixCls, "-options");
|
|
var Select = selectComponentClass;
|
|
var changeSelect = null;
|
|
var goInput = null;
|
|
var gotoButton = null;
|
|
|
|
if (!changeSize && !quickGo) {
|
|
return null;
|
|
}
|
|
|
|
var pageSizeOptions = this.getPageSizeOptions();
|
|
|
|
if (changeSize && Select) {
|
|
var options = pageSizeOptions.map(function (opt, i) {
|
|
return /*#__PURE__*/external_window_React_default.a.createElement(Select.Option, {
|
|
key: i,
|
|
value: opt.toString()
|
|
}, (buildOptionText || _this2.buildOptionText)(opt));
|
|
});
|
|
changeSelect = /*#__PURE__*/external_window_React_default.a.createElement(Select, {
|
|
disabled: disabled,
|
|
prefixCls: selectPrefixCls,
|
|
showSearch: false,
|
|
className: "".concat(prefixCls, "-size-changer"),
|
|
optionLabelProp: "children",
|
|
dropdownMatchSelectWidth: false,
|
|
value: (pageSize || pageSizeOptions[0]).toString(),
|
|
onChange: this.changeSize,
|
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
return triggerNode.parentNode;
|
|
}
|
|
}, options);
|
|
}
|
|
|
|
if (quickGo) {
|
|
if (goButton) {
|
|
gotoButton = typeof goButton === 'boolean' ? /*#__PURE__*/external_window_React_default.a.createElement("button", {
|
|
type: "button",
|
|
onClick: this.go,
|
|
onKeyUp: this.go,
|
|
disabled: disabled,
|
|
className: "".concat(prefixCls, "-quick-jumper-button")
|
|
}, locale.jump_to_confirm) : /*#__PURE__*/external_window_React_default.a.createElement("span", {
|
|
onClick: this.go,
|
|
onKeyUp: this.go
|
|
}, goButton);
|
|
}
|
|
|
|
goInput = /*#__PURE__*/external_window_React_default.a.createElement("div", {
|
|
className: "".concat(prefixCls, "-quick-jumper")
|
|
}, locale.jump_to, /*#__PURE__*/external_window_React_default.a.createElement("input", {
|
|
disabled: disabled,
|
|
type: "text",
|
|
value: goInputText,
|
|
onChange: this.handleChange,
|
|
onKeyUp: this.go,
|
|
onBlur: this.handleBlur
|
|
}), locale.page, gotoButton);
|
|
}
|
|
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
className: "".concat(prefixCls)
|
|
}, changeSelect, goInput);
|
|
}
|
|
}]);
|
|
|
|
return Options;
|
|
}(external_window_React_default.a.Component);
|
|
|
|
Options_Options.defaultProps = {
|
|
pageSizeOptions: ['10', '20', '50', '100']
|
|
};
|
|
/* harmony default export */ var es_Options = (Options_Options);
|
|
// EXTERNAL MODULE: ./node_modules/rc-pagination/es/locale/zh_CN.js
|
|
var zh_CN = __webpack_require__("N2Kk");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-pagination/es/Pagination.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* eslint react/prop-types: 0 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function noop() {}
|
|
|
|
function isInteger(value) {
|
|
return (// eslint-disable-next-line no-restricted-globals
|
|
typeof value === 'number' && isFinite(value) && Math.floor(value) === value
|
|
);
|
|
}
|
|
|
|
function defaultItemRender(page, type, element) {
|
|
return element;
|
|
}
|
|
|
|
function calculatePage(p, state, props) {
|
|
var pageSize = typeof p === 'undefined' ? state.pageSize : p;
|
|
return Math.floor((props.total - 1) / pageSize) + 1;
|
|
}
|
|
|
|
var Pagination_Pagination = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(Pagination, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(Pagination);
|
|
|
|
function Pagination(props) {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, Pagination);
|
|
|
|
_this = _super.call(this, props);
|
|
|
|
_this.getJumpPrevPage = function () {
|
|
return Math.max(1, _this.state.current - (_this.props.showLessItems ? 3 : 5));
|
|
};
|
|
|
|
_this.getJumpNextPage = function () {
|
|
return Math.min(calculatePage(undefined, _this.state, _this.props), _this.state.current + (_this.props.showLessItems ? 3 : 5));
|
|
};
|
|
|
|
_this.getItemIcon = function (icon, label) {
|
|
var prefixCls = _this.props.prefixCls;
|
|
var iconNode = icon || /*#__PURE__*/external_window_React_default.a.createElement("button", {
|
|
type: "button",
|
|
"aria-label": label,
|
|
className: "".concat(prefixCls, "-item-link")
|
|
});
|
|
|
|
if (typeof icon === 'function') {
|
|
iconNode = external_window_React_default.a.createElement(icon, Object(objectSpread2["a" /* default */])({}, _this.props));
|
|
}
|
|
|
|
return iconNode;
|
|
};
|
|
|
|
_this.savePaginationNode = function (node) {
|
|
_this.paginationNode = node;
|
|
};
|
|
|
|
_this.isValid = function (page) {
|
|
return isInteger(page) && page !== _this.state.current;
|
|
};
|
|
|
|
_this.shouldDisplayQuickJumper = function () {
|
|
var _this$props = _this.props,
|
|
showQuickJumper = _this$props.showQuickJumper,
|
|
pageSize = _this$props.pageSize,
|
|
total = _this$props.total;
|
|
|
|
if (total <= pageSize) {
|
|
return false;
|
|
}
|
|
|
|
return showQuickJumper;
|
|
};
|
|
|
|
_this.handleKeyDown = function (e) {
|
|
if (e.keyCode === KeyCode.ARROW_UP || e.keyCode === KeyCode.ARROW_DOWN) {
|
|
e.preventDefault();
|
|
}
|
|
};
|
|
|
|
_this.handleKeyUp = function (e) {
|
|
var value = _this.getValidValue(e);
|
|
|
|
var currentInputValue = _this.state.currentInputValue;
|
|
|
|
if (value !== currentInputValue) {
|
|
_this.setState({
|
|
currentInputValue: value
|
|
});
|
|
}
|
|
|
|
if (e.keyCode === KeyCode.ENTER) {
|
|
_this.handleChange(value);
|
|
} else if (e.keyCode === KeyCode.ARROW_UP) {
|
|
_this.handleChange(value - 1);
|
|
} else if (e.keyCode === KeyCode.ARROW_DOWN) {
|
|
_this.handleChange(value + 1);
|
|
}
|
|
};
|
|
|
|
_this.changePageSize = function (size) {
|
|
var current = _this.state.current;
|
|
var newCurrent = calculatePage(size, _this.state, _this.props);
|
|
current = current > newCurrent ? newCurrent : current; // fix the issue:
|
|
// Once 'total' is 0, 'current' in 'onShowSizeChange' is 0, which is not correct.
|
|
|
|
if (newCurrent === 0) {
|
|
// eslint-disable-next-line prefer-destructuring
|
|
current = _this.state.current;
|
|
}
|
|
|
|
if (typeof size === 'number') {
|
|
if (!('pageSize' in _this.props)) {
|
|
_this.setState({
|
|
pageSize: size
|
|
});
|
|
}
|
|
|
|
if (!('current' in _this.props)) {
|
|
_this.setState({
|
|
current: current,
|
|
currentInputValue: current
|
|
});
|
|
}
|
|
}
|
|
|
|
_this.props.onShowSizeChange(current, size);
|
|
|
|
if ('onChange' in _this.props && _this.props.onChange) {
|
|
_this.props.onChange(current, size);
|
|
}
|
|
};
|
|
|
|
_this.handleChange = function (p) {
|
|
var disabled = _this.props.disabled;
|
|
var page = p;
|
|
|
|
if (_this.isValid(page) && !disabled) {
|
|
var currentPage = calculatePage(undefined, _this.state, _this.props);
|
|
|
|
if (page > currentPage) {
|
|
page = currentPage;
|
|
} else if (page < 1) {
|
|
page = 1;
|
|
}
|
|
|
|
if (!('current' in _this.props)) {
|
|
_this.setState({
|
|
current: page,
|
|
currentInputValue: page
|
|
});
|
|
}
|
|
|
|
var pageSize = _this.state.pageSize;
|
|
|
|
_this.props.onChange(page, pageSize);
|
|
|
|
return page;
|
|
}
|
|
|
|
return _this.state.current;
|
|
};
|
|
|
|
_this.prev = function () {
|
|
if (_this.hasPrev()) {
|
|
_this.handleChange(_this.state.current - 1);
|
|
}
|
|
};
|
|
|
|
_this.next = function () {
|
|
if (_this.hasNext()) {
|
|
_this.handleChange(_this.state.current + 1);
|
|
}
|
|
};
|
|
|
|
_this.jumpPrev = function () {
|
|
_this.handleChange(_this.getJumpPrevPage());
|
|
};
|
|
|
|
_this.jumpNext = function () {
|
|
_this.handleChange(_this.getJumpNextPage());
|
|
};
|
|
|
|
_this.hasPrev = function () {
|
|
return _this.state.current > 1;
|
|
};
|
|
|
|
_this.hasNext = function () {
|
|
return _this.state.current < calculatePage(undefined, _this.state, _this.props);
|
|
};
|
|
|
|
_this.runIfEnter = function (event, callback) {
|
|
if (event.key === 'Enter' || event.charCode === 13) {
|
|
for (var _len = arguments.length, restParams = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
restParams[_key - 2] = arguments[_key];
|
|
}
|
|
|
|
callback.apply(void 0, restParams);
|
|
}
|
|
};
|
|
|
|
_this.runIfEnterPrev = function (e) {
|
|
_this.runIfEnter(e, _this.prev);
|
|
};
|
|
|
|
_this.runIfEnterNext = function (e) {
|
|
_this.runIfEnter(e, _this.next);
|
|
};
|
|
|
|
_this.runIfEnterJumpPrev = function (e) {
|
|
_this.runIfEnter(e, _this.jumpPrev);
|
|
};
|
|
|
|
_this.runIfEnterJumpNext = function (e) {
|
|
_this.runIfEnter(e, _this.jumpNext);
|
|
};
|
|
|
|
_this.handleGoTO = function (e) {
|
|
if (e.keyCode === KeyCode.ENTER || e.type === 'click') {
|
|
_this.handleChange(_this.state.currentInputValue);
|
|
}
|
|
};
|
|
|
|
var hasOnChange = props.onChange !== noop;
|
|
var hasCurrent = ('current' in props);
|
|
|
|
if (hasCurrent && !hasOnChange) {
|
|
// eslint-disable-next-line no-console
|
|
console.warn('Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.');
|
|
}
|
|
|
|
var _current = props.defaultCurrent;
|
|
|
|
if ('current' in props) {
|
|
// eslint-disable-next-line prefer-destructuring
|
|
_current = props.current;
|
|
}
|
|
|
|
var _pageSize = props.defaultPageSize;
|
|
|
|
if ('pageSize' in props) {
|
|
// eslint-disable-next-line prefer-destructuring
|
|
_pageSize = props.pageSize;
|
|
}
|
|
|
|
_current = Math.min(_current, calculatePage(_pageSize, undefined, props));
|
|
_this.state = {
|
|
current: _current,
|
|
currentInputValue: _current,
|
|
pageSize: _pageSize
|
|
};
|
|
return _this;
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(Pagination, [{
|
|
key: "componentDidUpdate",
|
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
// When current page change, fix focused style of prev item
|
|
// A hacky solution of https://github.com/ant-design/ant-design/issues/8948
|
|
var prefixCls = this.props.prefixCls;
|
|
|
|
if (prevState.current !== this.state.current && this.paginationNode) {
|
|
var lastCurrentNode = this.paginationNode.querySelector(".".concat(prefixCls, "-item-").concat(prevState.current));
|
|
|
|
if (lastCurrentNode && document.activeElement === lastCurrentNode) {
|
|
lastCurrentNode.blur();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "getValidValue",
|
|
value: function getValidValue(e) {
|
|
var inputValue = e.target.value;
|
|
var allPages = calculatePage(undefined, this.state, this.props);
|
|
var currentInputValue = this.state.currentInputValue;
|
|
var value;
|
|
|
|
if (inputValue === '') {
|
|
value = inputValue; // eslint-disable-next-line no-restricted-globals
|
|
} else if (isNaN(Number(inputValue))) {
|
|
value = currentInputValue;
|
|
} else if (inputValue >= allPages) {
|
|
value = allPages;
|
|
} else {
|
|
value = Number(inputValue);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
}, {
|
|
key: "getShowSizeChanger",
|
|
value: function getShowSizeChanger() {
|
|
var _this$props2 = this.props,
|
|
showSizeChanger = _this$props2.showSizeChanger,
|
|
total = _this$props2.total,
|
|
totalBoundaryShowSizeChanger = _this$props2.totalBoundaryShowSizeChanger;
|
|
|
|
if (typeof showSizeChanger !== 'undefined') {
|
|
return showSizeChanger;
|
|
}
|
|
|
|
return total > totalBoundaryShowSizeChanger;
|
|
}
|
|
}, {
|
|
key: "renderPrev",
|
|
value: function renderPrev(prevPage) {
|
|
var _this$props3 = this.props,
|
|
prevIcon = _this$props3.prevIcon,
|
|
itemRender = _this$props3.itemRender;
|
|
var prevButton = itemRender(prevPage, 'prev', this.getItemIcon(prevIcon, 'prev page'));
|
|
var disabled = !this.hasPrev();
|
|
return Object(external_window_React_["isValidElement"])(prevButton) ? Object(external_window_React_["cloneElement"])(prevButton, {
|
|
disabled: disabled
|
|
}) : prevButton;
|
|
}
|
|
}, {
|
|
key: "renderNext",
|
|
value: function renderNext(nextPage) {
|
|
var _this$props4 = this.props,
|
|
nextIcon = _this$props4.nextIcon,
|
|
itemRender = _this$props4.itemRender;
|
|
var nextButton = itemRender(nextPage, 'next', this.getItemIcon(nextIcon, 'next page'));
|
|
var disabled = !this.hasNext();
|
|
return Object(external_window_React_["isValidElement"])(nextButton) ? Object(external_window_React_["cloneElement"])(nextButton, {
|
|
disabled: disabled
|
|
}) : nextButton;
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
var _this2 = this;
|
|
|
|
var _this$props5 = this.props,
|
|
prefixCls = _this$props5.prefixCls,
|
|
className = _this$props5.className,
|
|
style = _this$props5.style,
|
|
disabled = _this$props5.disabled,
|
|
hideOnSinglePage = _this$props5.hideOnSinglePage,
|
|
total = _this$props5.total,
|
|
locale = _this$props5.locale,
|
|
showQuickJumper = _this$props5.showQuickJumper,
|
|
showLessItems = _this$props5.showLessItems,
|
|
showTitle = _this$props5.showTitle,
|
|
showTotal = _this$props5.showTotal,
|
|
simple = _this$props5.simple,
|
|
itemRender = _this$props5.itemRender,
|
|
showPrevNextJumpers = _this$props5.showPrevNextJumpers,
|
|
jumpPrevIcon = _this$props5.jumpPrevIcon,
|
|
jumpNextIcon = _this$props5.jumpNextIcon,
|
|
selectComponentClass = _this$props5.selectComponentClass,
|
|
selectPrefixCls = _this$props5.selectPrefixCls,
|
|
pageSizeOptions = _this$props5.pageSizeOptions;
|
|
var _this$state = this.state,
|
|
current = _this$state.current,
|
|
pageSize = _this$state.pageSize,
|
|
currentInputValue = _this$state.currentInputValue; // When hideOnSinglePage is true and there is only 1 page, hide the pager
|
|
|
|
if (hideOnSinglePage === true && total <= pageSize) {
|
|
return null;
|
|
}
|
|
|
|
var allPages = calculatePage(undefined, this.state, this.props);
|
|
var pagerList = [];
|
|
var jumpPrev = null;
|
|
var jumpNext = null;
|
|
var firstPager = null;
|
|
var lastPager = null;
|
|
var gotoButton = null;
|
|
var goButton = showQuickJumper && showQuickJumper.goButton;
|
|
var pageBufferSize = showLessItems ? 1 : 2;
|
|
var prevPage = current - 1 > 0 ? current - 1 : 0;
|
|
var nextPage = current + 1 < allPages ? current + 1 : allPages;
|
|
var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function (prev, key) {
|
|
if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') {
|
|
// eslint-disable-next-line no-param-reassign
|
|
prev[key] = _this2.props[key];
|
|
}
|
|
|
|
return prev;
|
|
}, {});
|
|
|
|
if (simple) {
|
|
if (goButton) {
|
|
if (typeof goButton === 'boolean') {
|
|
gotoButton = /*#__PURE__*/external_window_React_default.a.createElement("button", {
|
|
type: "button",
|
|
onClick: this.handleGoTO,
|
|
onKeyUp: this.handleGoTO
|
|
}, locale.jump_to_confirm);
|
|
} else {
|
|
gotoButton = /*#__PURE__*/external_window_React_default.a.createElement("span", {
|
|
onClick: this.handleGoTO,
|
|
onKeyUp: this.handleGoTO
|
|
}, goButton);
|
|
}
|
|
|
|
gotoButton = /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? "".concat(locale.jump_to).concat(current, "/").concat(allPages) : null,
|
|
className: "".concat(prefixCls, "-simple-pager")
|
|
}, gotoButton);
|
|
}
|
|
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("ul", Object(esm_extends["a" /* default */])({
|
|
className: classnames_default()(prefixCls, "".concat(prefixCls, "-simple"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-disabled"), disabled), className),
|
|
style: style,
|
|
ref: this.savePaginationNode
|
|
}, dataOrAriaAttributeProps), /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? locale.prev_page : null,
|
|
onClick: this.prev,
|
|
tabIndex: this.hasPrev() ? 0 : null,
|
|
onKeyPress: this.runIfEnterPrev,
|
|
className: classnames_default()("".concat(prefixCls, "-prev"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-disabled"), !this.hasPrev())),
|
|
"aria-disabled": !this.hasPrev()
|
|
}, this.renderPrev(prevPage)), /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? "".concat(current, "/").concat(allPages) : null,
|
|
className: "".concat(prefixCls, "-simple-pager")
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("input", {
|
|
type: "text",
|
|
value: currentInputValue,
|
|
disabled: disabled,
|
|
onKeyDown: this.handleKeyDown,
|
|
onKeyUp: this.handleKeyUp,
|
|
onChange: this.handleKeyUp,
|
|
size: "3"
|
|
}), /*#__PURE__*/external_window_React_default.a.createElement("span", {
|
|
className: "".concat(prefixCls, "-slash")
|
|
}, "/"), allPages), /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? locale.next_page : null,
|
|
onClick: this.next,
|
|
tabIndex: this.hasPrev() ? 0 : null,
|
|
onKeyPress: this.runIfEnterNext,
|
|
className: classnames_default()("".concat(prefixCls, "-next"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-disabled"), !this.hasNext())),
|
|
"aria-disabled": !this.hasNext()
|
|
}, this.renderNext(nextPage)), gotoButton);
|
|
}
|
|
|
|
if (allPages <= 3 + pageBufferSize * 2) {
|
|
var pagerProps = {
|
|
locale: locale,
|
|
rootPrefixCls: prefixCls,
|
|
onClick: this.handleChange,
|
|
onKeyPress: this.runIfEnter,
|
|
showTitle: showTitle,
|
|
itemRender: itemRender
|
|
};
|
|
|
|
if (!allPages) {
|
|
pagerList.push( /*#__PURE__*/external_window_React_default.a.createElement(es_Pager, Object(esm_extends["a" /* default */])({}, pagerProps, {
|
|
key: "noPager",
|
|
page: allPages,
|
|
className: "".concat(prefixCls, "-disabled")
|
|
})));
|
|
}
|
|
|
|
for (var i = 1; i <= allPages; i += 1) {
|
|
var active = current === i;
|
|
pagerList.push( /*#__PURE__*/external_window_React_default.a.createElement(es_Pager, Object(esm_extends["a" /* default */])({}, pagerProps, {
|
|
key: i,
|
|
page: i,
|
|
active: active
|
|
})));
|
|
}
|
|
} else {
|
|
var prevItemTitle = showLessItems ? locale.prev_3 : locale.prev_5;
|
|
var nextItemTitle = showLessItems ? locale.next_3 : locale.next_5;
|
|
|
|
if (showPrevNextJumpers) {
|
|
jumpPrev = /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? prevItemTitle : null,
|
|
key: "prev",
|
|
onClick: this.jumpPrev,
|
|
tabIndex: "0",
|
|
onKeyPress: this.runIfEnterJumpPrev,
|
|
className: classnames_default()("".concat(prefixCls, "-jump-prev"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-jump-prev-custom-icon"), !!jumpPrevIcon))
|
|
}, itemRender(this.getJumpPrevPage(), 'jump-prev', this.getItemIcon(jumpPrevIcon, 'prev page')));
|
|
jumpNext = /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? nextItemTitle : null,
|
|
key: "next",
|
|
tabIndex: "0",
|
|
onClick: this.jumpNext,
|
|
onKeyPress: this.runIfEnterJumpNext,
|
|
className: classnames_default()("".concat(prefixCls, "-jump-next"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-jump-next-custom-icon"), !!jumpNextIcon))
|
|
}, itemRender(this.getJumpNextPage(), 'jump-next', this.getItemIcon(jumpNextIcon, 'next page')));
|
|
}
|
|
|
|
lastPager = /*#__PURE__*/external_window_React_default.a.createElement(es_Pager, {
|
|
locale: locale,
|
|
last: true,
|
|
rootPrefixCls: prefixCls,
|
|
onClick: this.handleChange,
|
|
onKeyPress: this.runIfEnter,
|
|
key: allPages,
|
|
page: allPages,
|
|
active: false,
|
|
showTitle: showTitle,
|
|
itemRender: itemRender
|
|
});
|
|
firstPager = /*#__PURE__*/external_window_React_default.a.createElement(es_Pager, {
|
|
locale: locale,
|
|
rootPrefixCls: prefixCls,
|
|
onClick: this.handleChange,
|
|
onKeyPress: this.runIfEnter,
|
|
key: 1,
|
|
page: 1,
|
|
active: false,
|
|
showTitle: showTitle,
|
|
itemRender: itemRender
|
|
});
|
|
var left = Math.max(1, current - pageBufferSize);
|
|
var right = Math.min(current + pageBufferSize, allPages);
|
|
|
|
if (current - 1 <= pageBufferSize) {
|
|
right = 1 + pageBufferSize * 2;
|
|
}
|
|
|
|
if (allPages - current <= pageBufferSize) {
|
|
left = allPages - pageBufferSize * 2;
|
|
}
|
|
|
|
for (var _i = left; _i <= right; _i += 1) {
|
|
var _active = current === _i;
|
|
|
|
pagerList.push( /*#__PURE__*/external_window_React_default.a.createElement(es_Pager, {
|
|
locale: locale,
|
|
rootPrefixCls: prefixCls,
|
|
onClick: this.handleChange,
|
|
onKeyPress: this.runIfEnter,
|
|
key: _i,
|
|
page: _i,
|
|
active: _active,
|
|
showTitle: showTitle,
|
|
itemRender: itemRender
|
|
}));
|
|
}
|
|
|
|
if (current - 1 >= pageBufferSize * 2 && current !== 1 + 2) {
|
|
pagerList[0] = Object(external_window_React_["cloneElement"])(pagerList[0], {
|
|
className: "".concat(prefixCls, "-item-after-jump-prev")
|
|
});
|
|
pagerList.unshift(jumpPrev);
|
|
}
|
|
|
|
if (allPages - current >= pageBufferSize * 2 && current !== allPages - 2) {
|
|
pagerList[pagerList.length - 1] = Object(external_window_React_["cloneElement"])(pagerList[pagerList.length - 1], {
|
|
className: "".concat(prefixCls, "-item-before-jump-next")
|
|
});
|
|
pagerList.push(jumpNext);
|
|
}
|
|
|
|
if (left !== 1) {
|
|
pagerList.unshift(firstPager);
|
|
}
|
|
|
|
if (right !== allPages) {
|
|
pagerList.push(lastPager);
|
|
}
|
|
}
|
|
|
|
var totalText = null;
|
|
|
|
if (showTotal) {
|
|
totalText = /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
className: "".concat(prefixCls, "-total-text")
|
|
}, showTotal(total, [total === 0 ? 0 : (current - 1) * pageSize + 1, current * pageSize > total ? total : current * pageSize]));
|
|
}
|
|
|
|
var prevDisabled = !this.hasPrev() || !allPages;
|
|
var nextDisabled = !this.hasNext() || !allPages;
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("ul", Object(esm_extends["a" /* default */])({
|
|
className: classnames_default()(prefixCls, className, Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-disabled"), disabled)),
|
|
style: style,
|
|
unselectable: "unselectable",
|
|
ref: this.savePaginationNode
|
|
}, dataOrAriaAttributeProps), totalText, /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? locale.prev_page : null,
|
|
onClick: this.prev,
|
|
tabIndex: prevDisabled ? null : 0,
|
|
onKeyPress: this.runIfEnterPrev,
|
|
className: classnames_default()("".concat(prefixCls, "-prev"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-disabled"), prevDisabled)),
|
|
"aria-disabled": prevDisabled
|
|
}, this.renderPrev(prevPage)), pagerList, /*#__PURE__*/external_window_React_default.a.createElement("li", {
|
|
title: showTitle ? locale.next_page : null,
|
|
onClick: this.next,
|
|
tabIndex: nextDisabled ? null : 0,
|
|
onKeyPress: this.runIfEnterNext,
|
|
className: classnames_default()("".concat(prefixCls, "-next"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-disabled"), nextDisabled)),
|
|
"aria-disabled": nextDisabled
|
|
}, this.renderNext(nextPage)), /*#__PURE__*/external_window_React_default.a.createElement(es_Options, {
|
|
disabled: disabled,
|
|
locale: locale,
|
|
rootPrefixCls: prefixCls,
|
|
selectComponentClass: selectComponentClass,
|
|
selectPrefixCls: selectPrefixCls,
|
|
changeSize: this.getShowSizeChanger() ? this.changePageSize : null,
|
|
current: current,
|
|
pageSize: pageSize,
|
|
pageSizeOptions: pageSizeOptions,
|
|
quickGo: this.shouldDisplayQuickJumper() ? this.handleChange : null,
|
|
goButton: goButton
|
|
}));
|
|
}
|
|
}], [{
|
|
key: "getDerivedStateFromProps",
|
|
value: function getDerivedStateFromProps(props, prevState) {
|
|
var newState = {};
|
|
|
|
if ('current' in props) {
|
|
newState.current = props.current;
|
|
|
|
if (props.current !== prevState.current) {
|
|
newState.currentInputValue = newState.current;
|
|
}
|
|
}
|
|
|
|
if ('pageSize' in props && props.pageSize !== prevState.pageSize) {
|
|
var current = prevState.current;
|
|
var newCurrent = calculatePage(props.pageSize, prevState, props);
|
|
current = current > newCurrent ? newCurrent : current;
|
|
|
|
if (!('current' in props)) {
|
|
newState.current = current;
|
|
newState.currentInputValue = current;
|
|
}
|
|
|
|
newState.pageSize = props.pageSize;
|
|
}
|
|
|
|
return newState;
|
|
}
|
|
}]);
|
|
|
|
return Pagination;
|
|
}(external_window_React_default.a.Component);
|
|
|
|
Pagination_Pagination.defaultProps = {
|
|
defaultCurrent: 1,
|
|
total: 0,
|
|
defaultPageSize: 10,
|
|
onChange: noop,
|
|
className: '',
|
|
selectPrefixCls: 'rc-select',
|
|
prefixCls: 'rc-pagination',
|
|
selectComponentClass: null,
|
|
hideOnSinglePage: false,
|
|
showPrevNextJumpers: true,
|
|
showQuickJumper: false,
|
|
showLessItems: false,
|
|
showTitle: true,
|
|
onShowSizeChange: noop,
|
|
locale: zh_CN["a" /* default */],
|
|
style: {},
|
|
itemRender: defaultItemRender,
|
|
totalBoundaryShowSizeChanger: 50
|
|
};
|
|
/* harmony default export */ var es_Pagination = (Pagination_Pagination);
|
|
// CONCATENATED MODULE: ./node_modules/rc-pagination/es/index.js
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "6RRn":
|
|
/*!*******************************************!*\
|
|
!*** ./node_modules/rc-table/es/index.js ***!
|
|
\*******************************************/
|
|
/*! exports provided: Summary, Column, ColumnGroup, INTERNAL_COL_DEFINE, default */
|
|
/*! exports used: INTERNAL_COL_DEFINE, Summary, default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var _Table__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Table */ "wCXF");
|
|
/* harmony import */ var _Footer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Footer */ "n6Qo");
|
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _Footer__WEBPACK_IMPORTED_MODULE_1__["a"]; });
|
|
|
|
/* harmony import */ var _sugar_Column__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sugar/Column */ "IBYe");
|
|
/* harmony import */ var _sugar_ColumnGroup__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sugar/ColumnGroup */ "6eGT");
|
|
/* harmony import */ var _utils_legacyUtil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/legacyUtil */ "hW8S");
|
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _utils_legacyUtil__WEBPACK_IMPORTED_MODULE_4__["a"]; });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["c"] = (_Table__WEBPACK_IMPORTED_MODULE_0__[/* default */ "b"]);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "6eGT":
|
|
/*!*******************************************************!*\
|
|
!*** ./node_modules/rc-table/es/sugar/ColumnGroup.js ***!
|
|
\*******************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* istanbul ignore next */
|
|
|
|
/**
|
|
* This is a syntactic sugar for `columns` prop.
|
|
* So HOC will not work on this.
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
function ColumnGroup(_) {
|
|
return null;
|
|
}
|
|
|
|
/* harmony default export */ __webpack_exports__["a"] = (ColumnGroup);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "815F":
|
|
/*!***************************************************!*\
|
|
!*** ./node_modules/rc-tree/es/utils/treeUtil.js ***!
|
|
\***************************************************/
|
|
/*! exports provided: getKey, warningWithoutKey, convertTreeToData, flattenTreeData, traverseDataNodes, convertDataToEntities, getTreeNodeProps, convertNodePropsToEventData */
|
|
/*! exports used: convertDataToEntities, convertNodePropsToEventData, convertTreeToData, flattenTreeData, getKey, getTreeNodeProps */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getKey; });
|
|
/* unused harmony export warningWithoutKey */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return convertTreeToData; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return flattenTreeData; });
|
|
/* unused harmony export traverseDataNodes */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return convertDataToEntities; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getTreeNodeProps; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertNodePropsToEventData; });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "KQm4");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "VTBJ");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "Ff2n");
|
|
/* harmony import */ var rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rc-util/es/Children/toArray */ "Zm9Q");
|
|
/* harmony import */ var rc_util_es_warning__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rc-util/es/warning */ "Kwbf");
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util */ "OZM5");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getKey(key, pos) {
|
|
if (key !== null && key !== undefined) {
|
|
return key;
|
|
}
|
|
|
|
return pos;
|
|
}
|
|
/**
|
|
* Warning if TreeNode do not provides key
|
|
*/
|
|
|
|
function warningWithoutKey() {
|
|
var treeData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
var keys = new Map();
|
|
|
|
function dig(list) {
|
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
(list || []).forEach(function (treeNode) {
|
|
var key = treeNode.key,
|
|
children = treeNode.children;
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(key !== null && key !== undefined, "Tree node must have a certain key: [".concat(path).concat(key, "]"));
|
|
var recordKey = String(key);
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(!keys.has(recordKey) || key === null || key === undefined, "Same 'key' exist in the Tree: ".concat(recordKey));
|
|
keys.set(recordKey, true);
|
|
dig(children, "".concat(path).concat(recordKey, " > "));
|
|
});
|
|
}
|
|
|
|
dig(treeData);
|
|
}
|
|
/**
|
|
* Convert `children` of Tree into `treeData` structure.
|
|
*/
|
|
|
|
function convertTreeToData(rootNodes) {
|
|
function dig(node) {
|
|
var treeNodes = Object(rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(node);
|
|
return treeNodes.map(function (treeNode) {
|
|
// Filter invalidate node
|
|
if (!Object(_util__WEBPACK_IMPORTED_MODULE_5__[/* isTreeNode */ "i"])(treeNode)) {
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(!treeNode, 'Tree/TreeNode can only accept TreeNode as children.');
|
|
return null;
|
|
}
|
|
|
|
var key = treeNode.key;
|
|
|
|
var _treeNode$props = treeNode.props,
|
|
children = _treeNode$props.children,
|
|
rest = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_treeNode$props, ["children"]);
|
|
|
|
var dataNode = Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({
|
|
key: key
|
|
}, rest);
|
|
|
|
var parsedChildren = dig(children);
|
|
|
|
if (parsedChildren.length) {
|
|
dataNode.children = parsedChildren;
|
|
}
|
|
|
|
return dataNode;
|
|
}).filter(function (dataNode) {
|
|
return dataNode;
|
|
});
|
|
}
|
|
|
|
return dig(rootNodes);
|
|
}
|
|
/**
|
|
* Flat nest tree data into flatten list. This is used for virtual list render.
|
|
* @param treeNodeList Origin data node list
|
|
* @param expandedKeys
|
|
* need expanded keys, provides `true` means all expanded (used in `rc-tree-select`).
|
|
*/
|
|
|
|
function flattenTreeData() {
|
|
var treeNodeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
var expandedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
var expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);
|
|
var flattenList = [];
|
|
|
|
function dig(list) {
|
|
var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
return list.map(function (treeNode, index) {
|
|
var pos = Object(_util__WEBPACK_IMPORTED_MODULE_5__[/* getPosition */ "h"])(parent ? parent.pos : '0', index);
|
|
var mergedKey = getKey(treeNode.key, pos); // Add FlattenDataNode into list
|
|
|
|
var flattenNode = Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({}, treeNode), {}, {
|
|
parent: parent,
|
|
pos: pos,
|
|
children: null,
|
|
data: treeNode,
|
|
isStart: [].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(parent ? parent.isStart : []), [index === 0]),
|
|
isEnd: [].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(parent ? parent.isEnd : []), [index === list.length - 1])
|
|
});
|
|
|
|
flattenList.push(flattenNode); // Loop treeNode children
|
|
|
|
if (expandedKeys === true || expandedKeySet.has(mergedKey)) {
|
|
flattenNode.children = dig(treeNode.children || [], flattenNode);
|
|
} else {
|
|
flattenNode.children = [];
|
|
}
|
|
|
|
return flattenNode;
|
|
});
|
|
}
|
|
|
|
dig(treeNodeList);
|
|
return flattenList;
|
|
}
|
|
/**
|
|
* Traverse all the data by `treeData`.
|
|
* Please not use it out of the `rc-tree` since we may refactor this code.
|
|
*/
|
|
|
|
function traverseDataNodes(dataNodes, callback, externalGetKey) {
|
|
var syntheticGetKey;
|
|
|
|
if (externalGetKey) {
|
|
if (typeof externalGetKey === 'string') {
|
|
syntheticGetKey = function syntheticGetKey(node) {
|
|
return node[externalGetKey];
|
|
};
|
|
} else if (typeof externalGetKey === 'function') {
|
|
syntheticGetKey = function syntheticGetKey(node) {
|
|
return externalGetKey(node);
|
|
};
|
|
}
|
|
} else {
|
|
syntheticGetKey = function syntheticGetKey(node, pos) {
|
|
return getKey(node.key, pos);
|
|
};
|
|
}
|
|
|
|
function processNode(node, index, parent) {
|
|
var children = node ? node.children : dataNodes;
|
|
var pos = node ? Object(_util__WEBPACK_IMPORTED_MODULE_5__[/* getPosition */ "h"])(parent.pos, index) : '0'; // Process node if is not root
|
|
|
|
if (node) {
|
|
var key = syntheticGetKey(node, pos);
|
|
var data = {
|
|
node: node,
|
|
index: index,
|
|
pos: pos,
|
|
key: key,
|
|
parentPos: parent.node ? parent.pos : null,
|
|
level: parent.level + 1
|
|
};
|
|
callback(data);
|
|
} // Process children node
|
|
|
|
|
|
if (children) {
|
|
children.forEach(function (subNode, subIndex) {
|
|
processNode(subNode, subIndex, {
|
|
node: node,
|
|
pos: pos,
|
|
level: parent ? parent.level + 1 : -1
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
processNode(null);
|
|
}
|
|
/**
|
|
* Convert `treeData` into entity records.
|
|
*/
|
|
|
|
function convertDataToEntities(dataNodes) {
|
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
initWrapper = _ref.initWrapper,
|
|
processEntity = _ref.processEntity,
|
|
onProcessFinished = _ref.onProcessFinished;
|
|
|
|
var externalGetKey = arguments.length > 2 ? arguments[2] : undefined;
|
|
var posEntities = {};
|
|
var keyEntities = {};
|
|
var wrapper = {
|
|
posEntities: posEntities,
|
|
keyEntities: keyEntities
|
|
};
|
|
|
|
if (initWrapper) {
|
|
wrapper = initWrapper(wrapper) || wrapper;
|
|
}
|
|
|
|
traverseDataNodes(dataNodes, function (item) {
|
|
var node = item.node,
|
|
index = item.index,
|
|
pos = item.pos,
|
|
key = item.key,
|
|
parentPos = item.parentPos,
|
|
level = item.level;
|
|
var entity = {
|
|
node: node,
|
|
index: index,
|
|
key: key,
|
|
pos: pos,
|
|
level: level
|
|
};
|
|
var mergedKey = getKey(key, pos);
|
|
posEntities[pos] = entity;
|
|
keyEntities[mergedKey] = entity; // Fill children
|
|
|
|
entity.parent = posEntities[parentPos];
|
|
|
|
if (entity.parent) {
|
|
entity.parent.children = entity.parent.children || [];
|
|
entity.parent.children.push(entity);
|
|
}
|
|
|
|
if (processEntity) {
|
|
processEntity(entity, wrapper);
|
|
}
|
|
}, externalGetKey);
|
|
|
|
if (onProcessFinished) {
|
|
onProcessFinished(wrapper);
|
|
}
|
|
|
|
return wrapper;
|
|
}
|
|
/**
|
|
* Get TreeNode props with Tree props.
|
|
*/
|
|
|
|
function getTreeNodeProps(key, _ref2) {
|
|
var expandedKeys = _ref2.expandedKeys,
|
|
selectedKeys = _ref2.selectedKeys,
|
|
loadedKeys = _ref2.loadedKeys,
|
|
loadingKeys = _ref2.loadingKeys,
|
|
checkedKeys = _ref2.checkedKeys,
|
|
halfCheckedKeys = _ref2.halfCheckedKeys,
|
|
dragOverNodeKey = _ref2.dragOverNodeKey,
|
|
dropPosition = _ref2.dropPosition,
|
|
keyEntities = _ref2.keyEntities;
|
|
var entity = keyEntities[key];
|
|
var treeNodeProps = {
|
|
eventKey: key,
|
|
expanded: expandedKeys.indexOf(key) !== -1,
|
|
selected: selectedKeys.indexOf(key) !== -1,
|
|
loaded: loadedKeys.indexOf(key) !== -1,
|
|
loading: loadingKeys.indexOf(key) !== -1,
|
|
checked: checkedKeys.indexOf(key) !== -1,
|
|
halfChecked: halfCheckedKeys.indexOf(key) !== -1,
|
|
pos: String(entity ? entity.pos : ''),
|
|
// [Legacy] Drag props
|
|
dragOver: dragOverNodeKey === key && dropPosition === 0,
|
|
dragOverGapTop: dragOverNodeKey === key && dropPosition === -1,
|
|
dragOverGapBottom: dragOverNodeKey === key && dropPosition === 1
|
|
};
|
|
return treeNodeProps;
|
|
}
|
|
function convertNodePropsToEventData(props) {
|
|
var data = props.data,
|
|
expanded = props.expanded,
|
|
selected = props.selected,
|
|
checked = props.checked,
|
|
loaded = props.loaded,
|
|
loading = props.loading,
|
|
halfChecked = props.halfChecked,
|
|
dragOver = props.dragOver,
|
|
dragOverGapTop = props.dragOverGapTop,
|
|
dragOverGapBottom = props.dragOverGapBottom,
|
|
pos = props.pos,
|
|
active = props.active;
|
|
|
|
var eventData = Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({}, data), {}, {
|
|
expanded: expanded,
|
|
selected: selected,
|
|
checked: checked,
|
|
loaded: loaded,
|
|
loading: loading,
|
|
halfChecked: halfChecked,
|
|
dragOver: dragOver,
|
|
dragOverGapTop: dragOverGapTop,
|
|
dragOverGapBottom: dragOverGapBottom,
|
|
pos: pos,
|
|
active: active
|
|
});
|
|
|
|
if (!('props' in eventData)) {
|
|
Object.defineProperty(eventData, 'props', {
|
|
get: function get() {
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(false, 'Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`.');
|
|
return props;
|
|
}
|
|
});
|
|
}
|
|
|
|
return eventData;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "8Jsi":
|
|
/*!**************************************************************!*\
|
|
!*** ./node_modules/rc-tree-select/es/index.js + 12 modules ***!
|
|
\**************************************************************/
|
|
/*! exports provided: TreeNode, SHOW_ALL, SHOW_CHILD, SHOW_PARENT, default */
|
|
/*! exports used: SHOW_ALL, SHOW_CHILD, SHOW_PARENT, TreeNode, default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/interface/generator.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/conductUtil.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/treeUtil.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMergedState.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ es_TreeNode; });
|
|
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ SHOW_ALL; });
|
|
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ SHOW_CHILD; });
|
|
__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ SHOW_PARENT; });
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__("1OyB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__("vuIU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__("Ji7U");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__("LK+K");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__("KQm4");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__("U8pU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__("ODXe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("VTBJ");
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-select/es/generate.js + 11 modules
|
|
var generate = __webpack_require__("qNPg");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-select/es/utils/valueUtil.js
|
|
var valueUtil = __webpack_require__("2Qr1");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/utils/treeUtil.js
|
|
var treeUtil = __webpack_require__("815F");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/utils/conductUtil.js
|
|
var conductUtil = __webpack_require__("NvD2");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-select/es/interface/generator.js
|
|
var generator = __webpack_require__("wPlo");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMergedState.js
|
|
var useMergedState = __webpack_require__("6cGi");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
|
|
var warning = __webpack_require__("Kwbf");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__("4IlW");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMemo.js
|
|
var useMemo = __webpack_require__("YrtM");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/index.js + 4 modules
|
|
var es = __webpack_require__("fAei");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/Context.js
|
|
|
|
var SelectContext = /*#__PURE__*/external_window_React_["createContext"](null);
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/hooks/useKeyValueMapping.js
|
|
|
|
function isDisabled(dataNode, skipType) {
|
|
if (!dataNode) {
|
|
return true;
|
|
}
|
|
|
|
var _dataNode$data = dataNode.data,
|
|
disabled = _dataNode$data.disabled,
|
|
disableCheckbox = _dataNode$data.disableCheckbox;
|
|
|
|
switch (skipType) {
|
|
case 'select':
|
|
return disabled;
|
|
|
|
case 'checkbox':
|
|
return disabled || disableCheckbox;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
function useKeyValueMapping(cacheKeyMap, cacheValueMap) {
|
|
var getEntityByKey = external_window_React_["useCallback"](function (key) {
|
|
var skipType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
|
|
var ignoreDisabledCheck = arguments.length > 2 ? arguments[2] : undefined;
|
|
var dataNode = cacheKeyMap.get(key);
|
|
|
|
if (!ignoreDisabledCheck && isDisabled(dataNode, skipType)) {
|
|
return null;
|
|
}
|
|
|
|
return dataNode;
|
|
}, [cacheKeyMap]);
|
|
var getEntityByValue = external_window_React_["useCallback"](function (value) {
|
|
var skipType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
|
|
var ignoreDisabledCheck = arguments.length > 2 ? arguments[2] : undefined;
|
|
var dataNode = cacheValueMap.get(value);
|
|
|
|
if (!ignoreDisabledCheck && isDisabled(dataNode, skipType)) {
|
|
return null;
|
|
}
|
|
|
|
return dataNode;
|
|
}, [cacheValueMap]);
|
|
return [getEntityByKey, getEntityByValue];
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/hooks/useKeyValueMap.js
|
|
|
|
/**
|
|
* Return cached Key Value map with DataNode.
|
|
* Only re-calculate when `flattenOptions` changed.
|
|
*/
|
|
|
|
function useKeyValueMap(flattenOptions) {
|
|
return external_window_React_["useMemo"](function () {
|
|
var cacheKeyMap = new Map();
|
|
var cacheValueMap = new Map(); // Cache options by key
|
|
|
|
flattenOptions.forEach(function (dataNode) {
|
|
cacheKeyMap.set(dataNode.key, dataNode);
|
|
cacheValueMap.set(dataNode.data.value, dataNode);
|
|
});
|
|
return [cacheKeyMap, cacheValueMap];
|
|
}, [flattenOptions]);
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/OptionList.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var HIDDEN_STYLE = {
|
|
width: 0,
|
|
height: 0,
|
|
display: 'flex',
|
|
overflow: 'hidden',
|
|
opacity: 0,
|
|
border: 0,
|
|
padding: 0,
|
|
margin: 0
|
|
};
|
|
|
|
var OptionList_OptionList = function OptionList(props, ref) {
|
|
var prefixCls = props.prefixCls,
|
|
height = props.height,
|
|
itemHeight = props.itemHeight,
|
|
virtual = props.virtual,
|
|
options = props.options,
|
|
flattenOptions = props.flattenOptions,
|
|
multiple = props.multiple,
|
|
searchValue = props.searchValue,
|
|
onSelect = props.onSelect,
|
|
onToggleOpen = props.onToggleOpen,
|
|
open = props.open,
|
|
notFoundContent = props.notFoundContent,
|
|
onMouseEnter = props.onMouseEnter;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](SelectContext),
|
|
checkable = _React$useContext.checkable,
|
|
checkedKeys = _React$useContext.checkedKeys,
|
|
halfCheckedKeys = _React$useContext.halfCheckedKeys,
|
|
treeExpandedKeys = _React$useContext.treeExpandedKeys,
|
|
treeDefaultExpandAll = _React$useContext.treeDefaultExpandAll,
|
|
treeDefaultExpandedKeys = _React$useContext.treeDefaultExpandedKeys,
|
|
onTreeExpand = _React$useContext.onTreeExpand,
|
|
treeIcon = _React$useContext.treeIcon,
|
|
showTreeIcon = _React$useContext.showTreeIcon,
|
|
switcherIcon = _React$useContext.switcherIcon,
|
|
treeLine = _React$useContext.treeLine,
|
|
treeNodeFilterProp = _React$useContext.treeNodeFilterProp,
|
|
loadData = _React$useContext.loadData,
|
|
treeLoadedKeys = _React$useContext.treeLoadedKeys,
|
|
treeMotion = _React$useContext.treeMotion,
|
|
onTreeLoad = _React$useContext.onTreeLoad;
|
|
|
|
var treeRef = external_window_React_["useRef"]();
|
|
var memoOptions = Object(useMemo["a" /* default */])(function () {
|
|
return options;
|
|
}, [open, options], function (prev, next) {
|
|
return next[0] && prev[1] !== next[1];
|
|
});
|
|
|
|
var _useKeyValueMap = useKeyValueMap(flattenOptions),
|
|
_useKeyValueMap2 = Object(slicedToArray["a" /* default */])(_useKeyValueMap, 2),
|
|
cacheKeyMap = _useKeyValueMap2[0],
|
|
cacheValueMap = _useKeyValueMap2[1];
|
|
|
|
var _useKeyValueMapping = useKeyValueMapping(cacheKeyMap, cacheValueMap),
|
|
_useKeyValueMapping2 = Object(slicedToArray["a" /* default */])(_useKeyValueMapping, 2),
|
|
getEntityByKey = _useKeyValueMapping2[0],
|
|
getEntityByValue = _useKeyValueMapping2[1]; // ========================== Values ==========================
|
|
|
|
|
|
var valueKeys = external_window_React_["useMemo"](function () {
|
|
return checkedKeys.map(function (val) {
|
|
var entity = getEntityByValue(val);
|
|
return entity ? entity.key : null;
|
|
});
|
|
}, [checkedKeys]);
|
|
var mergedCheckedKeys = external_window_React_["useMemo"](function () {
|
|
if (!checkable) {
|
|
return null;
|
|
}
|
|
|
|
return {
|
|
checked: valueKeys,
|
|
halfChecked: halfCheckedKeys
|
|
};
|
|
}, [valueKeys, halfCheckedKeys, checkable]); // ========================== Scroll ==========================
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
// Single mode should scroll to current key
|
|
if (open && !multiple && valueKeys.length) {
|
|
var _treeRef$current;
|
|
|
|
(_treeRef$current = treeRef.current) === null || _treeRef$current === void 0 ? void 0 : _treeRef$current.scrollTo({
|
|
key: valueKeys[0]
|
|
});
|
|
}
|
|
}, [open]); // ========================== Search ==========================
|
|
|
|
var lowerSearchValue = String(searchValue).toLowerCase();
|
|
|
|
var filterTreeNode = function filterTreeNode(treeNode) {
|
|
if (!lowerSearchValue) {
|
|
return false;
|
|
}
|
|
|
|
return String(treeNode[treeNodeFilterProp]).toLowerCase().includes(lowerSearchValue);
|
|
}; // =========================== Keys ===========================
|
|
|
|
|
|
var _React$useState = external_window_React_["useState"](treeDefaultExpandedKeys),
|
|
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
|
|
expandedKeys = _React$useState2[0],
|
|
setExpandedKeys = _React$useState2[1];
|
|
|
|
var _React$useState3 = external_window_React_["useState"](null),
|
|
_React$useState4 = Object(slicedToArray["a" /* default */])(_React$useState3, 2),
|
|
searchExpandedKeys = _React$useState4[0],
|
|
setSearchExpandedKeys = _React$useState4[1];
|
|
|
|
var mergedExpandedKeys = external_window_React_["useMemo"](function () {
|
|
if (treeExpandedKeys) {
|
|
return Object(toConsumableArray["a" /* default */])(treeExpandedKeys);
|
|
}
|
|
|
|
return searchValue ? searchExpandedKeys : expandedKeys;
|
|
}, [expandedKeys, searchExpandedKeys, lowerSearchValue, treeExpandedKeys]);
|
|
external_window_React_["useEffect"](function () {
|
|
if (searchValue) {
|
|
setSearchExpandedKeys(flattenOptions.map(function (o) {
|
|
return o.key;
|
|
}));
|
|
}
|
|
}, [searchValue]);
|
|
|
|
var onInternalExpand = function onInternalExpand(keys) {
|
|
setExpandedKeys(keys);
|
|
setSearchExpandedKeys(keys);
|
|
|
|
if (onTreeExpand) {
|
|
onTreeExpand(keys);
|
|
}
|
|
}; // ========================== Events ==========================
|
|
|
|
|
|
var onListMouseDown = function onListMouseDown(event) {
|
|
event.preventDefault();
|
|
};
|
|
|
|
var onInternalSelect = function onInternalSelect(_, _ref) {
|
|
var key = _ref.node.key;
|
|
var entity = getEntityByKey(key, checkable ? 'checkbox' : 'select');
|
|
|
|
if (entity !== null) {
|
|
onSelect(entity.data.value, {
|
|
selected: !checkedKeys.includes(entity.data.value)
|
|
});
|
|
}
|
|
|
|
if (!multiple) {
|
|
onToggleOpen(false);
|
|
}
|
|
}; // ========================= Keyboard =========================
|
|
|
|
|
|
var _React$useState5 = external_window_React_["useState"](null),
|
|
_React$useState6 = Object(slicedToArray["a" /* default */])(_React$useState5, 2),
|
|
activeKey = _React$useState6[0],
|
|
setActiveKey = _React$useState6[1];
|
|
|
|
var activeEntity = getEntityByKey(activeKey);
|
|
external_window_React_["useImperativeHandle"](ref, function () {
|
|
return {
|
|
onKeyDown: function onKeyDown(event) {
|
|
var _treeRef$current2;
|
|
|
|
var which = event.which;
|
|
|
|
switch (which) {
|
|
// >>> Arrow keys
|
|
case KeyCode["a" /* default */].UP:
|
|
case KeyCode["a" /* default */].DOWN:
|
|
case KeyCode["a" /* default */].LEFT:
|
|
case KeyCode["a" /* default */].RIGHT:
|
|
(_treeRef$current2 = treeRef.current) === null || _treeRef$current2 === void 0 ? void 0 : _treeRef$current2.onKeyDown(event);
|
|
break;
|
|
// >>> Select item
|
|
|
|
case KeyCode["a" /* default */].ENTER:
|
|
{
|
|
if (activeEntity !== null) {
|
|
onInternalSelect(null, {
|
|
node: {
|
|
key: activeKey
|
|
},
|
|
selected: !checkedKeys.includes(activeEntity.data.value)
|
|
});
|
|
}
|
|
|
|
break;
|
|
}
|
|
// >>> Close
|
|
|
|
case KeyCode["a" /* default */].ESC:
|
|
{
|
|
onToggleOpen(false);
|
|
}
|
|
}
|
|
},
|
|
onKeyUp: function onKeyUp() {}
|
|
};
|
|
}); // ========================== Render ==========================
|
|
|
|
if (memoOptions.length === 0) {
|
|
return /*#__PURE__*/external_window_React_["createElement"]("div", {
|
|
role: "listbox",
|
|
className: "".concat(prefixCls, "-empty"),
|
|
onMouseDown: onListMouseDown
|
|
}, notFoundContent);
|
|
}
|
|
|
|
var treeProps = {};
|
|
|
|
if (treeLoadedKeys) {
|
|
treeProps.loadedKeys = treeLoadedKeys;
|
|
}
|
|
|
|
if (mergedExpandedKeys) {
|
|
treeProps.expandedKeys = mergedExpandedKeys;
|
|
}
|
|
|
|
return /*#__PURE__*/external_window_React_["createElement"]("div", {
|
|
onMouseDown: onListMouseDown,
|
|
onMouseEnter: onMouseEnter
|
|
}, activeEntity && open && /*#__PURE__*/external_window_React_["createElement"]("span", {
|
|
style: HIDDEN_STYLE,
|
|
"aria-live": "assertive"
|
|
}, activeEntity.data.value), /*#__PURE__*/external_window_React_["createElement"](es["b" /* default */], Object.assign({
|
|
ref: treeRef,
|
|
focusable: false,
|
|
prefixCls: "".concat(prefixCls, "-tree"),
|
|
treeData: memoOptions,
|
|
height: height,
|
|
itemHeight: itemHeight,
|
|
virtual: virtual,
|
|
multiple: multiple,
|
|
icon: treeIcon,
|
|
showIcon: showTreeIcon,
|
|
switcherIcon: switcherIcon,
|
|
showLine: treeLine,
|
|
loadData: searchValue ? null : loadData,
|
|
motion: treeMotion,
|
|
// We handle keys by out instead tree self
|
|
checkable: checkable,
|
|
checkStrictly: true,
|
|
checkedKeys: mergedCheckedKeys,
|
|
selectedKeys: !checkable ? valueKeys : [],
|
|
defaultExpandAll: treeDefaultExpandAll
|
|
}, treeProps, {
|
|
// Proxy event out
|
|
onActiveChange: setActiveKey,
|
|
onSelect: onInternalSelect,
|
|
onCheck: onInternalSelect,
|
|
onExpand: onInternalExpand,
|
|
onLoad: onTreeLoad,
|
|
filterTreeNode: filterTreeNode
|
|
})));
|
|
};
|
|
|
|
var RefOptionList = /*#__PURE__*/external_window_React_["forwardRef"](OptionList_OptionList);
|
|
RefOptionList.displayName = 'OptionList';
|
|
/* harmony default export */ var es_OptionList = (RefOptionList);
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/TreeNode.js
|
|
/** This is a placeholder, not real render in dom */
|
|
var TreeNode = function TreeNode() {
|
|
return null;
|
|
};
|
|
|
|
/* harmony default export */ var es_TreeNode = (TreeNode);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__("Ff2n");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__("Zm9Q");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/utils/legacyUtil.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function convertChildrenToData(nodes) {
|
|
return Object(toArray["a" /* default */])(nodes).map(function (node) {
|
|
if (! /*#__PURE__*/external_window_React_["isValidElement"](node) || !node.type) {
|
|
return null;
|
|
}
|
|
|
|
var key = node.key,
|
|
_node$props = node.props,
|
|
children = _node$props.children,
|
|
value = _node$props.value,
|
|
restProps = Object(objectWithoutProperties["a" /* default */])(_node$props, ["children", "value"]);
|
|
|
|
var data = Object(objectSpread2["a" /* default */])({
|
|
key: key,
|
|
value: value
|
|
}, restProps);
|
|
|
|
var childData = convertChildrenToData(children);
|
|
|
|
if (childData.length) {
|
|
data.children = childData;
|
|
}
|
|
|
|
return data;
|
|
}).filter(function (data) {
|
|
return data;
|
|
});
|
|
}
|
|
function fillLegacyProps(dataNode) {
|
|
// Skip if not dataNode exist
|
|
if (!dataNode) {
|
|
return dataNode;
|
|
}
|
|
|
|
var cloneNode = Object(objectSpread2["a" /* default */])({}, dataNode);
|
|
|
|
if (!('props' in cloneNode)) {
|
|
Object.defineProperty(cloneNode, 'props', {
|
|
get: function get() {
|
|
Object(warning["a" /* default */])(false, 'New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access.');
|
|
return cloneNode;
|
|
}
|
|
});
|
|
}
|
|
|
|
return cloneNode;
|
|
}
|
|
function fillAdditionalInfo(extra, triggerValue, checkedValues, treeData, showPosition) {
|
|
var triggerNode = null;
|
|
var nodeList = null;
|
|
|
|
function generateMap() {
|
|
function dig(list) {
|
|
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0';
|
|
var parentIncluded = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
return list.map(function (dataNode, index) {
|
|
var pos = "".concat(level, "-").concat(index);
|
|
var included = checkedValues.includes(dataNode.value);
|
|
var children = dig(dataNode.children || [], pos, included);
|
|
var node = /*#__PURE__*/external_window_React_["createElement"](es_TreeNode, Object.assign({}, dataNode), children.map(function (child) {
|
|
return child.node;
|
|
})); // Link with trigger node
|
|
|
|
if (triggerValue === dataNode.value) {
|
|
triggerNode = node;
|
|
}
|
|
|
|
if (included) {
|
|
var checkedNode = {
|
|
pos: pos,
|
|
node: node,
|
|
children: children
|
|
};
|
|
|
|
if (!parentIncluded) {
|
|
nodeList.push(checkedNode);
|
|
}
|
|
|
|
return checkedNode;
|
|
}
|
|
|
|
return null;
|
|
}).filter(function (node) {
|
|
return node;
|
|
});
|
|
}
|
|
|
|
if (!nodeList) {
|
|
nodeList = [];
|
|
dig(treeData); // Sort to keep the checked node length
|
|
|
|
nodeList.sort(function (_ref, _ref2) {
|
|
var val1 = _ref.node.props.value;
|
|
var val2 = _ref2.node.props.value;
|
|
var index1 = checkedValues.indexOf(val1);
|
|
var index2 = checkedValues.indexOf(val2);
|
|
return index1 - index2;
|
|
});
|
|
}
|
|
}
|
|
|
|
Object.defineProperty(extra, 'triggerNode', {
|
|
get: function get() {
|
|
Object(warning["a" /* default */])(false, '`triggerNode` is deprecated. Please consider decoupling data with node.');
|
|
generateMap();
|
|
return triggerNode;
|
|
}
|
|
});
|
|
Object.defineProperty(extra, 'allCheckedNodes', {
|
|
get: function get() {
|
|
Object(warning["a" /* default */])(false, '`allCheckedNodes` is deprecated. Please consider decoupling data with node.');
|
|
generateMap();
|
|
|
|
if (showPosition) {
|
|
return nodeList;
|
|
}
|
|
|
|
return nodeList.map(function (_ref3) {
|
|
var node = _ref3.node;
|
|
return node;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/utils/valueUtil.js
|
|
|
|
|
|
|
|
|
|
function valueUtil_toArray(value) {
|
|
if (Array.isArray(value)) {
|
|
return value;
|
|
}
|
|
|
|
return value !== undefined ? [value] : [];
|
|
}
|
|
function findValueOption(values, options) {
|
|
var optionMap = new Map();
|
|
options.forEach(function (flattenItem) {
|
|
var data = flattenItem.data;
|
|
optionMap.set(data.value, data);
|
|
});
|
|
return values.map(function (val) {
|
|
return fillLegacyProps(optionMap.get(val));
|
|
});
|
|
}
|
|
function isValueDisabled(value, options) {
|
|
var option = findValueOption([value], options)[0];
|
|
|
|
if (option) {
|
|
return option.disabled;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
function isCheckDisabled(node) {
|
|
return node.disabled || node.disableCheckbox || node.checkable === false;
|
|
}
|
|
|
|
function getLevel(_ref) {
|
|
var parent = _ref.parent;
|
|
var level = 0;
|
|
var current = parent;
|
|
|
|
while (current) {
|
|
current = current.parent;
|
|
level += 1;
|
|
}
|
|
|
|
return level;
|
|
}
|
|
/**
|
|
* Before reuse `rc-tree` logic, we need to add key since TreeSelect use `value` instead of `key`.
|
|
*/
|
|
|
|
|
|
function valueUtil_flattenOptions(options) {
|
|
// Add missing key
|
|
function fillKey(list) {
|
|
return (list || []).map(function (node) {
|
|
var value = node.value,
|
|
key = node.key,
|
|
children = node.children;
|
|
|
|
var clone = Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, node), {}, {
|
|
key: 'key' in node ? key : value
|
|
});
|
|
|
|
if (children) {
|
|
clone.children = fillKey(children);
|
|
}
|
|
|
|
return clone;
|
|
});
|
|
}
|
|
|
|
var flattenList = Object(treeUtil["d" /* flattenTreeData */])(fillKey(options), true);
|
|
return flattenList.map(function (node) {
|
|
return {
|
|
key: node.data.key,
|
|
data: node.data,
|
|
level: getLevel(node)
|
|
};
|
|
});
|
|
}
|
|
|
|
function getDefaultFilterOption(optionFilterProp) {
|
|
return function (searchValue, dataNode) {
|
|
var value = dataNode[optionFilterProp];
|
|
return String(value).toLowerCase().includes(String(searchValue).toLowerCase());
|
|
};
|
|
}
|
|
/** Filter options and return a new options by the search text */
|
|
|
|
|
|
function filterOptions(searchValue, options, _ref2) {
|
|
var optionFilterProp = _ref2.optionFilterProp,
|
|
filterOption = _ref2.filterOption;
|
|
|
|
if (filterOption === false) {
|
|
return options;
|
|
}
|
|
|
|
var filterOptionFunc;
|
|
|
|
if (typeof filterOption === 'function') {
|
|
filterOptionFunc = filterOption;
|
|
} else {
|
|
filterOptionFunc = getDefaultFilterOption(optionFilterProp);
|
|
}
|
|
|
|
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(searchValue, fillLegacyProps(dataNode));
|
|
var childList = dig(children || [], match);
|
|
|
|
if (match || childList.length) {
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, dataNode), {}, {
|
|
children: childList
|
|
});
|
|
}
|
|
|
|
return null;
|
|
}).filter(function (node) {
|
|
return node;
|
|
});
|
|
}
|
|
|
|
return dig(options);
|
|
}
|
|
function getRawValueLabeled(values, prevValue, getEntityByValue, getLabelProp) {
|
|
var valueMap = new Map();
|
|
valueUtil_toArray(prevValue).forEach(function (item) {
|
|
if (item && Object(esm_typeof["a" /* default */])(item) === 'object' && 'value' in item) {
|
|
valueMap.set(item.value, item);
|
|
}
|
|
});
|
|
return values.map(function (val) {
|
|
var item = {
|
|
value: val
|
|
};
|
|
var entity = getEntityByValue(val, 'select', true);
|
|
var label = entity ? getLabelProp(entity.data) : val;
|
|
|
|
if (valueMap.has(val)) {
|
|
var labeledValue = valueMap.get(val);
|
|
item.label = 'label' in labeledValue ? labeledValue.label : label;
|
|
|
|
if ('halfChecked' in labeledValue) {
|
|
item.halfChecked = labeledValue.halfChecked;
|
|
}
|
|
} else {
|
|
item.label = label;
|
|
}
|
|
|
|
return item;
|
|
});
|
|
}
|
|
function addValue(rawValues, value) {
|
|
var values = new Set(rawValues);
|
|
values.add(value);
|
|
return Array.from(values);
|
|
}
|
|
function removeValue(rawValues, value) {
|
|
var values = new Set(rawValues);
|
|
values.delete(value);
|
|
return Array.from(values);
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/utils/warningPropsUtil.js
|
|
|
|
|
|
|
|
|
|
function warningProps(props) {
|
|
var searchPlaceholder = props.searchPlaceholder,
|
|
treeCheckStrictly = props.treeCheckStrictly,
|
|
treeCheckable = props.treeCheckable,
|
|
labelInValue = props.labelInValue,
|
|
value = props.value,
|
|
multiple = props.multiple;
|
|
Object(warning["a" /* default */])(!searchPlaceholder, '`searchPlaceholder` has been removed.');
|
|
|
|
if (treeCheckStrictly && labelInValue === false) {
|
|
Object(warning["a" /* default */])(false, '`treeCheckStrictly` will force set `labelInValue` to `true`.');
|
|
}
|
|
|
|
if (labelInValue || treeCheckStrictly) {
|
|
Object(warning["a" /* default */])(valueUtil_toArray(value).every(function (val) {
|
|
return val && Object(esm_typeof["a" /* default */])(val) === 'object' && 'value' in val;
|
|
}), 'Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead.');
|
|
}
|
|
|
|
if (treeCheckStrictly || multiple || treeCheckable) {
|
|
Object(warning["a" /* default */])(!value || Array.isArray(value), '`value` should be an array when `TreeSelect` is checkable or multiple.');
|
|
} else {
|
|
Object(warning["a" /* default */])(!Array.isArray(value), '`value` should not be array when `TreeSelect` is single mode.');
|
|
}
|
|
}
|
|
|
|
/* harmony default export */ var warningPropsUtil = (warningProps);
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/hooks/useTreeData.js
|
|
|
|
|
|
|
|
|
|
|
|
var MAX_WARNING_TIMES = 10;
|
|
|
|
function parseSimpleTreeData(treeData, _ref) {
|
|
var id = _ref.id,
|
|
pId = _ref.pId,
|
|
rootPId = _ref.rootPId;
|
|
var keyNodes = {};
|
|
var rootNodeList = []; // Fill in the map
|
|
|
|
var nodeList = treeData.map(function (node) {
|
|
var clone = Object(objectSpread2["a" /* default */])({}, node);
|
|
|
|
var key = clone[id];
|
|
keyNodes[key] = clone;
|
|
clone.key = clone.key || key;
|
|
return clone;
|
|
}); // Connect tree
|
|
|
|
nodeList.forEach(function (node) {
|
|
var parentKey = node[pId];
|
|
var parent = keyNodes[parentKey]; // Fill parent
|
|
|
|
if (parent) {
|
|
parent.children = parent.children || [];
|
|
parent.children.push(node);
|
|
} // Fill root tree node
|
|
|
|
|
|
if (parentKey === rootPId || !parent && rootPId === null) {
|
|
rootNodeList.push(node);
|
|
}
|
|
});
|
|
return rootNodeList;
|
|
}
|
|
/**
|
|
* Format `treeData` with `value` & `key` which is used for calculation
|
|
*/
|
|
|
|
|
|
function formatTreeData(treeData, getLabelProp) {
|
|
var warningTimes = 0;
|
|
var valueSet = new Set();
|
|
|
|
function dig(dataNodes) {
|
|
return (dataNodes || []).map(function (node) {
|
|
var key = node.key,
|
|
value = node.value,
|
|
children = node.children,
|
|
rest = Object(objectWithoutProperties["a" /* default */])(node, ["key", "value", "children"]);
|
|
|
|
var mergedValue = 'value' in node ? value : key;
|
|
|
|
var dataNode = Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, rest), {}, {
|
|
key: key !== null && key !== undefined ? key : mergedValue,
|
|
value: mergedValue,
|
|
title: getLabelProp(node)
|
|
}); // Check `key` & `value` and warning user
|
|
|
|
|
|
if (false) {}
|
|
|
|
if ('children' in node) {
|
|
dataNode.children = dig(children);
|
|
}
|
|
|
|
return dataNode;
|
|
});
|
|
}
|
|
|
|
return dig(treeData);
|
|
}
|
|
/**
|
|
* Convert `treeData` or `children` into formatted `treeData`.
|
|
* Will not re-calculate if `treeData` or `children` not change.
|
|
*/
|
|
|
|
|
|
function useTreeData(treeData, children, _ref2) {
|
|
var getLabelProp = _ref2.getLabelProp,
|
|
simpleMode = _ref2.simpleMode;
|
|
var cacheRef = external_window_React_["useRef"]({});
|
|
|
|
if (treeData) {
|
|
cacheRef.current.formatTreeData = cacheRef.current.treeData === treeData ? cacheRef.current.formatTreeData : formatTreeData(simpleMode ? parseSimpleTreeData(treeData, Object(objectSpread2["a" /* default */])({
|
|
id: 'id',
|
|
pId: 'pId',
|
|
rootPId: null
|
|
}, simpleMode !== true ? simpleMode : {})) : treeData, getLabelProp);
|
|
cacheRef.current.treeData = treeData;
|
|
} else {
|
|
cacheRef.current.formatTreeData = cacheRef.current.children === children ? cacheRef.current.formatTreeData : formatTreeData(convertChildrenToData(children), getLabelProp);
|
|
}
|
|
|
|
return cacheRef.current.formatTreeData;
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/utils/strategyUtil.js
|
|
|
|
var SHOW_ALL = 'SHOW_ALL';
|
|
var SHOW_PARENT = 'SHOW_PARENT';
|
|
var SHOW_CHILD = 'SHOW_CHILD';
|
|
function formatStrategyKeys(keys, strategy, keyEntities) {
|
|
var keySet = new Set(keys);
|
|
|
|
if (strategy === SHOW_CHILD) {
|
|
return keys.filter(function (key) {
|
|
var entity = keyEntities[key];
|
|
|
|
if (entity && entity.children && entity.children.every(function (_ref) {
|
|
var node = _ref.node;
|
|
return isCheckDisabled(node) || keySet.has(node.key);
|
|
})) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
});
|
|
}
|
|
|
|
if (strategy === SHOW_PARENT) {
|
|
return keys.filter(function (key) {
|
|
var entity = keyEntities[key];
|
|
var parent = entity ? entity.parent : null;
|
|
|
|
if (parent && !isCheckDisabled(parent.node) && keySet.has(parent.node.key)) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
});
|
|
}
|
|
|
|
return keys;
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/hooks/useSelectValues.js
|
|
|
|
|
|
|
|
/** Return */
|
|
|
|
function useSelectValues(rawValues, _ref) {
|
|
var value = _ref.value,
|
|
getEntityByValue = _ref.getEntityByValue,
|
|
getEntityByKey = _ref.getEntityByKey,
|
|
treeConduction = _ref.treeConduction,
|
|
showCheckedStrategy = _ref.showCheckedStrategy,
|
|
conductKeyEntities = _ref.conductKeyEntities,
|
|
getLabelProp = _ref.getLabelProp;
|
|
return external_window_React_["useMemo"](function () {
|
|
var mergedRawValues = rawValues;
|
|
|
|
if (treeConduction) {
|
|
var rawKeys = formatStrategyKeys(rawValues.map(function (val) {
|
|
var entity = getEntityByValue(val);
|
|
return entity ? entity.key : val;
|
|
}), showCheckedStrategy, conductKeyEntities);
|
|
mergedRawValues = rawKeys.map(function (key) {
|
|
var entity = getEntityByKey(key);
|
|
return entity ? entity.data.value : key;
|
|
});
|
|
}
|
|
|
|
return getRawValueLabeled(mergedRawValues, value, getEntityByValue, getLabelProp);
|
|
}, [rawValues, value, treeConduction, showCheckedStrategy, getEntityByValue]);
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/TreeSelect.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var OMIT_PROPS = ['expandedKeys', 'treeData', 'treeCheckable', 'showCheckedStrategy', 'searchPlaceholder', 'treeLine', 'treeIcon', 'showTreeIcon', 'switcherIcon', 'treeNodeFilterProp', 'filterTreeNode', 'dropdownPopupAlign', 'treeDefaultExpandAll', 'treeCheckStrictly', 'treeExpandedKeys', 'treeLoadedKeys', 'treeMotion', 'onTreeExpand', 'onTreeLoad', 'loadData', 'treeDataSimpleMode', 'treeNodeLabelProp', 'treeDefaultExpandedKeys'];
|
|
var RefSelect = Object(generate["a" /* default */])({
|
|
prefixCls: 'rc-tree-select',
|
|
components: {
|
|
optionList: es_OptionList
|
|
},
|
|
// Not use generate since we will handle ourself
|
|
convertChildrenToData: function convertChildrenToData() {
|
|
return null;
|
|
},
|
|
flattenOptions: valueUtil_flattenOptions,
|
|
// Handle `optionLabelProp` in TreeSelect component
|
|
getLabeledValue: valueUtil["e" /* getLabeledValue */],
|
|
filterOptions: filterOptions,
|
|
isValueDisabled: isValueDisabled,
|
|
findValueOption: findValueOption,
|
|
omitDOMProps: function omitDOMProps(props) {
|
|
var cloneProps = Object(objectSpread2["a" /* default */])({}, props);
|
|
|
|
OMIT_PROPS.forEach(function (prop) {
|
|
delete cloneProps[prop];
|
|
});
|
|
return cloneProps;
|
|
}
|
|
});
|
|
RefSelect.displayName = 'Select';
|
|
var RefTreeSelect = /*#__PURE__*/external_window_React_["forwardRef"](function (props, ref) {
|
|
var multiple = props.multiple,
|
|
treeCheckable = props.treeCheckable,
|
|
treeCheckStrictly = props.treeCheckStrictly,
|
|
_props$showCheckedStr = props.showCheckedStrategy,
|
|
showCheckedStrategy = _props$showCheckedStr === void 0 ? 'SHOW_CHILD' : _props$showCheckedStr,
|
|
labelInValue = props.labelInValue,
|
|
loadData = props.loadData,
|
|
treeLoadedKeys = props.treeLoadedKeys,
|
|
_props$treeNodeFilter = props.treeNodeFilterProp,
|
|
treeNodeFilterProp = _props$treeNodeFilter === void 0 ? 'value' : _props$treeNodeFilter,
|
|
treeNodeLabelProp = props.treeNodeLabelProp,
|
|
treeDataSimpleMode = props.treeDataSimpleMode,
|
|
treeData = props.treeData,
|
|
treeExpandedKeys = props.treeExpandedKeys,
|
|
treeDefaultExpandedKeys = props.treeDefaultExpandedKeys,
|
|
treeDefaultExpandAll = props.treeDefaultExpandAll,
|
|
children = props.children,
|
|
treeIcon = props.treeIcon,
|
|
showTreeIcon = props.showTreeIcon,
|
|
switcherIcon = props.switcherIcon,
|
|
treeLine = props.treeLine,
|
|
treeMotion = props.treeMotion,
|
|
filterTreeNode = props.filterTreeNode,
|
|
dropdownPopupAlign = props.dropdownPopupAlign,
|
|
onChange = props.onChange,
|
|
onTreeExpand = props.onTreeExpand,
|
|
onTreeLoad = props.onTreeLoad,
|
|
onDropdownVisibleChange = props.onDropdownVisibleChange,
|
|
onSelect = props.onSelect,
|
|
onDeselect = props.onDeselect;
|
|
var mergedCheckable = treeCheckable || treeCheckStrictly;
|
|
var mergedMultiple = multiple || mergedCheckable;
|
|
var treeConduction = treeCheckable && !treeCheckStrictly;
|
|
var mergedLabelInValue = treeCheckStrictly || labelInValue; // ========================== Ref ==========================
|
|
|
|
var selectRef = external_window_React_["useRef"](null);
|
|
external_window_React_["useImperativeHandle"](ref, function () {
|
|
return {
|
|
focus: selectRef.current.focus,
|
|
blur: selectRef.current.blur
|
|
};
|
|
}); // ======================= Tree Data =======================
|
|
// Legacy both support `label` or `title` if not set.
|
|
// We have to fallback to function to handle this
|
|
|
|
var getTreeNodeTitle = function getTreeNodeTitle(node) {
|
|
if (!treeData) {
|
|
return node.title;
|
|
}
|
|
|
|
return node.label || node.title;
|
|
};
|
|
|
|
var getTreeNodeLabelProp = function getTreeNodeLabelProp(node) {
|
|
if (treeNodeLabelProp) {
|
|
return node[treeNodeLabelProp];
|
|
}
|
|
|
|
return getTreeNodeTitle(node);
|
|
};
|
|
|
|
var mergedTreeData = useTreeData(treeData, children, {
|
|
getLabelProp: getTreeNodeTitle,
|
|
simpleMode: treeDataSimpleMode
|
|
});
|
|
var flattedOptions = Object(external_window_React_["useMemo"])(function () {
|
|
return valueUtil_flattenOptions(mergedTreeData);
|
|
}, [mergedTreeData]);
|
|
|
|
var _useKeyValueMap = useKeyValueMap(flattedOptions),
|
|
_useKeyValueMap2 = Object(slicedToArray["a" /* default */])(_useKeyValueMap, 2),
|
|
cacheKeyMap = _useKeyValueMap2[0],
|
|
cacheValueMap = _useKeyValueMap2[1];
|
|
|
|
var _useKeyValueMapping = useKeyValueMapping(cacheKeyMap, cacheValueMap),
|
|
_useKeyValueMapping2 = Object(slicedToArray["a" /* default */])(_useKeyValueMapping, 2),
|
|
getEntityByKey = _useKeyValueMapping2[0],
|
|
getEntityByValue = _useKeyValueMapping2[1]; // Only generate keyEntities for check conduction when is `treeCheckable`
|
|
|
|
|
|
var _useMemo = Object(external_window_React_["useMemo"])(function () {
|
|
if (treeConduction) {
|
|
return Object(treeUtil["a" /* convertDataToEntities */])(mergedTreeData);
|
|
}
|
|
|
|
return {
|
|
keyEntities: null
|
|
};
|
|
}, [mergedTreeData, treeCheckable, treeCheckStrictly]),
|
|
conductKeyEntities = _useMemo.keyEntities; // ========================= Value =========================
|
|
|
|
|
|
var _useMergedState = Object(useMergedState["a" /* default */])(props.defaultValue, {
|
|
value: props.value
|
|
}),
|
|
_useMergedState2 = Object(slicedToArray["a" /* default */])(_useMergedState, 2),
|
|
value = _useMergedState2[0],
|
|
setValue = _useMergedState2[1];
|
|
/** Get `missingRawValues` which not exist in the tree yet */
|
|
|
|
|
|
var splitRawValues = function splitRawValues(newRawValues) {
|
|
var missingRawValues = [];
|
|
var existRawValues = []; // Keep missing value in the cache
|
|
|
|
newRawValues.forEach(function (val) {
|
|
if (getEntityByValue(val)) {
|
|
existRawValues.push(val);
|
|
} else {
|
|
missingRawValues.push(val);
|
|
}
|
|
});
|
|
return {
|
|
missingRawValues: missingRawValues,
|
|
existRawValues: existRawValues
|
|
};
|
|
};
|
|
|
|
var _useMemo2 = Object(external_window_React_["useMemo"])(function () {
|
|
var valueHalfCheckedKeys = [];
|
|
var newRawValues = [];
|
|
valueUtil_toArray(value).forEach(function (item) {
|
|
if (item && Object(esm_typeof["a" /* default */])(item) === 'object' && 'value' in item) {
|
|
if (item.halfChecked && treeCheckStrictly) {
|
|
var entity = getEntityByValue(item.value);
|
|
valueHalfCheckedKeys.push(entity ? entity.key : item.value);
|
|
} else {
|
|
newRawValues.push(item.value);
|
|
}
|
|
} else {
|
|
newRawValues.push(item);
|
|
}
|
|
}); // We need do conduction of values
|
|
|
|
if (treeConduction) {
|
|
var _splitRawValues = splitRawValues(newRawValues),
|
|
missingRawValues = _splitRawValues.missingRawValues,
|
|
existRawValues = _splitRawValues.existRawValues;
|
|
|
|
var keyList = existRawValues.map(function (val) {
|
|
return getEntityByValue(val).key;
|
|
});
|
|
|
|
var _conductCheck = Object(conductUtil["a" /* conductCheck */])(keyList, true, conductKeyEntities),
|
|
checkedKeys = _conductCheck.checkedKeys,
|
|
halfCheckedKeys = _conductCheck.halfCheckedKeys;
|
|
|
|
return [[].concat(Object(toConsumableArray["a" /* default */])(missingRawValues), Object(toConsumableArray["a" /* default */])(checkedKeys.map(function (key) {
|
|
return getEntityByKey(key).data.value;
|
|
}))), halfCheckedKeys];
|
|
}
|
|
|
|
return [newRawValues, valueHalfCheckedKeys];
|
|
}, [value, mergedMultiple, mergedLabelInValue, treeCheckable, treeCheckStrictly]),
|
|
_useMemo3 = Object(slicedToArray["a" /* default */])(_useMemo2, 2),
|
|
rawValues = _useMemo3[0],
|
|
rawHalfCheckedKeys = _useMemo3[1];
|
|
|
|
var selectValues = useSelectValues(rawValues, {
|
|
treeConduction: treeConduction,
|
|
value: value,
|
|
showCheckedStrategy: showCheckedStrategy,
|
|
conductKeyEntities: conductKeyEntities,
|
|
getEntityByValue: getEntityByValue,
|
|
getEntityByKey: getEntityByKey,
|
|
getLabelProp: getTreeNodeLabelProp
|
|
});
|
|
|
|
var triggerChange = function triggerChange(newRawValues, extra, source) {
|
|
setValue(mergedMultiple ? newRawValues : newRawValues[0]);
|
|
|
|
if (onChange) {
|
|
var eventValues = newRawValues;
|
|
|
|
if (treeConduction && showCheckedStrategy !== 'SHOW_ALL') {
|
|
var keyList = newRawValues.map(function (val) {
|
|
var entity = getEntityByValue(val);
|
|
return entity ? entity.key : val;
|
|
});
|
|
var formattedKeyList = formatStrategyKeys(keyList, showCheckedStrategy, conductKeyEntities);
|
|
eventValues = formattedKeyList.map(function (key) {
|
|
var entity = getEntityByKey(key);
|
|
return entity ? entity.data.value : key;
|
|
});
|
|
}
|
|
|
|
var _ref = extra || {
|
|
triggerValue: undefined,
|
|
selected: undefined
|
|
},
|
|
triggerValue = _ref.triggerValue,
|
|
selected = _ref.selected;
|
|
|
|
var returnValues = mergedLabelInValue ? getRawValueLabeled(eventValues, value, getEntityByValue, getTreeNodeLabelProp) : eventValues; // We need fill half check back
|
|
|
|
if (treeCheckStrictly) {
|
|
var halfValues = rawHalfCheckedKeys.map(function (key) {
|
|
var entity = getEntityByKey(key);
|
|
return entity ? entity.data.value : key;
|
|
}).filter(function (val) {
|
|
return !eventValues.includes(val);
|
|
});
|
|
returnValues = [].concat(Object(toConsumableArray["a" /* default */])(returnValues), Object(toConsumableArray["a" /* default */])(getRawValueLabeled(halfValues, value, getEntityByValue, getTreeNodeLabelProp)));
|
|
}
|
|
|
|
var additionalInfo = {
|
|
// [Legacy] Always return as array contains label & value
|
|
preValue: selectValues,
|
|
triggerValue: triggerValue
|
|
}; // [Legacy] Fill legacy data if user query.
|
|
// This is expansive that we only fill when user query
|
|
// https://github.com/react-component/tree-select/blob/fe33eb7c27830c9ac70cd1fdb1ebbe7bc679c16a/src/Select.jsx
|
|
|
|
var showPosition = true;
|
|
|
|
if (treeCheckStrictly || source === 'selection' && !selected) {
|
|
showPosition = false;
|
|
}
|
|
|
|
fillAdditionalInfo(additionalInfo, triggerValue, newRawValues, mergedTreeData, showPosition);
|
|
|
|
if (mergedCheckable) {
|
|
additionalInfo.checked = selected;
|
|
} else {
|
|
additionalInfo.selected = selected;
|
|
}
|
|
|
|
onChange(mergedMultiple ? returnValues : returnValues[0], mergedLabelInValue ? null : eventValues.map(function (val) {
|
|
var entity = getEntityByValue(val);
|
|
return entity ? getTreeNodeLabelProp(entity.data) : null;
|
|
}), additionalInfo);
|
|
}
|
|
};
|
|
|
|
var onInternalSelect = function onInternalSelect(selectValue, option, source) {
|
|
var eventValue = mergedLabelInValue ? selectValue : selectValue;
|
|
|
|
if (!mergedMultiple) {
|
|
// Single mode always set value
|
|
triggerChange([selectValue], {
|
|
selected: true,
|
|
triggerValue: selectValue
|
|
}, source);
|
|
} else {
|
|
var newRawValues = addValue(rawValues, selectValue); // Add keys if tree conduction
|
|
|
|
if (treeConduction) {
|
|
// Should keep missing values
|
|
var _splitRawValues2 = splitRawValues(newRawValues),
|
|
missingRawValues = _splitRawValues2.missingRawValues,
|
|
existRawValues = _splitRawValues2.existRawValues;
|
|
|
|
var keyList = existRawValues.map(function (val) {
|
|
return getEntityByValue(val).key;
|
|
});
|
|
|
|
var _conductCheck2 = Object(conductUtil["a" /* conductCheck */])(keyList, true, conductKeyEntities),
|
|
checkedKeys = _conductCheck2.checkedKeys;
|
|
|
|
newRawValues = [].concat(Object(toConsumableArray["a" /* default */])(missingRawValues), Object(toConsumableArray["a" /* default */])(checkedKeys.map(function (key) {
|
|
return getEntityByKey(key).data.value;
|
|
})));
|
|
}
|
|
|
|
triggerChange(newRawValues, {
|
|
selected: true,
|
|
triggerValue: selectValue
|
|
}, source);
|
|
}
|
|
|
|
if (onSelect) {
|
|
onSelect(eventValue, option);
|
|
}
|
|
};
|
|
|
|
var onInternalDeselect = function onInternalDeselect(selectValue, option, source) {
|
|
var eventValue = mergedLabelInValue ? selectValue : selectValue;
|
|
var newRawValues = removeValue(rawValues, selectValue); // Remove keys if tree conduction
|
|
|
|
if (treeConduction) {
|
|
var _splitRawValues3 = splitRawValues(newRawValues),
|
|
missingRawValues = _splitRawValues3.missingRawValues,
|
|
existRawValues = _splitRawValues3.existRawValues;
|
|
|
|
var keyList = existRawValues.map(function (val) {
|
|
return getEntityByValue(val).key;
|
|
});
|
|
|
|
var _conductCheck3 = Object(conductUtil["a" /* conductCheck */])(keyList, {
|
|
checked: false,
|
|
halfCheckedKeys: rawHalfCheckedKeys
|
|
}, conductKeyEntities),
|
|
checkedKeys = _conductCheck3.checkedKeys;
|
|
|
|
newRawValues = [].concat(Object(toConsumableArray["a" /* default */])(missingRawValues), Object(toConsumableArray["a" /* default */])(checkedKeys.map(function (key) {
|
|
return getEntityByKey(key).data.value;
|
|
})));
|
|
}
|
|
|
|
triggerChange(newRawValues, {
|
|
selected: false,
|
|
triggerValue: selectValue
|
|
}, source);
|
|
|
|
if (onDeselect) {
|
|
onDeselect(eventValue, option);
|
|
}
|
|
};
|
|
|
|
var onInternalClear = function onInternalClear() {
|
|
triggerChange([], null, 'clear');
|
|
}; // ========================= Open ==========================
|
|
|
|
|
|
var onInternalDropdownVisibleChange = external_window_React_["useCallback"](function (open) {
|
|
if (onDropdownVisibleChange) {
|
|
var legacyParam = {};
|
|
Object.defineProperty(legacyParam, 'documentClickClose', {
|
|
get: function get() {
|
|
Object(warning["a" /* default */])(false, 'Second param of `onDropdownVisibleChange` has been removed.');
|
|
return false;
|
|
}
|
|
});
|
|
onDropdownVisibleChange(open, legacyParam);
|
|
}
|
|
}, [onDropdownVisibleChange]); // ======================== Warning ========================
|
|
|
|
if (false) {} // ======================== Render =========================
|
|
// We pass some props into select props style
|
|
|
|
|
|
var selectProps = {
|
|
optionLabelProp: null,
|
|
optionFilterProp: treeNodeFilterProp,
|
|
dropdownAlign: dropdownPopupAlign,
|
|
internalProps: {
|
|
mark: generator["a" /* INTERNAL_PROPS_MARK */],
|
|
onClear: onInternalClear,
|
|
skipTriggerChange: true,
|
|
skipTriggerSelect: true,
|
|
onRawSelect: onInternalSelect,
|
|
onRawDeselect: onInternalDeselect
|
|
}
|
|
};
|
|
|
|
if ('filterTreeNode' in props) {
|
|
selectProps.filterOption = filterTreeNode;
|
|
}
|
|
|
|
return /*#__PURE__*/external_window_React_["createElement"](SelectContext.Provider, {
|
|
value: {
|
|
checkable: mergedCheckable,
|
|
loadData: loadData,
|
|
treeLoadedKeys: treeLoadedKeys,
|
|
onTreeLoad: onTreeLoad,
|
|
checkedKeys: rawValues,
|
|
halfCheckedKeys: rawHalfCheckedKeys,
|
|
treeDefaultExpandAll: treeDefaultExpandAll,
|
|
treeExpandedKeys: treeExpandedKeys,
|
|
treeDefaultExpandedKeys: treeDefaultExpandedKeys,
|
|
onTreeExpand: onTreeExpand,
|
|
treeIcon: treeIcon,
|
|
treeMotion: treeMotion,
|
|
showTreeIcon: showTreeIcon,
|
|
switcherIcon: switcherIcon,
|
|
treeLine: treeLine,
|
|
treeNodeFilterProp: treeNodeFilterProp
|
|
}
|
|
}, /*#__PURE__*/external_window_React_["createElement"](RefSelect, Object.assign({
|
|
ref: selectRef,
|
|
mode: mergedMultiple ? 'multiple' : null
|
|
}, props, selectProps, {
|
|
value: selectValues,
|
|
// We will handle this ourself since we need calculate conduction
|
|
labelInValue: true,
|
|
options: mergedTreeData,
|
|
onChange: null,
|
|
onSelect: null,
|
|
onDeselect: null,
|
|
onDropdownVisibleChange: onInternalDropdownVisibleChange
|
|
})));
|
|
}); // Use class component since typescript not support generic
|
|
// by `forwardRef` with function component yet.
|
|
|
|
var TreeSelect_TreeSelect = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(TreeSelect, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(TreeSelect);
|
|
|
|
function TreeSelect() {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, TreeSelect);
|
|
|
|
_this = _super.apply(this, arguments);
|
|
_this.selectRef = /*#__PURE__*/external_window_React_["createRef"]();
|
|
|
|
_this.focus = function () {
|
|
_this.selectRef.current.focus();
|
|
};
|
|
|
|
_this.blur = function () {
|
|
_this.selectRef.current.blur();
|
|
};
|
|
|
|
return _this;
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(TreeSelect, [{
|
|
key: "render",
|
|
value: function render() {
|
|
return /*#__PURE__*/external_window_React_["createElement"](RefTreeSelect, Object.assign({
|
|
ref: this.selectRef
|
|
}, this.props));
|
|
}
|
|
}]);
|
|
|
|
return TreeSelect;
|
|
}(external_window_React_["Component"]);
|
|
|
|
TreeSelect_TreeSelect.TreeNode = es_TreeNode;
|
|
TreeSelect_TreeSelect.SHOW_ALL = SHOW_ALL;
|
|
TreeSelect_TreeSelect.SHOW_PARENT = SHOW_PARENT;
|
|
TreeSelect_TreeSelect.SHOW_CHILD = SHOW_CHILD;
|
|
/* harmony default export */ var es_TreeSelect = (TreeSelect_TreeSelect);
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree-select/es/index.js
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var rc_tree_select_es = __webpack_exports__["e"] = (es_TreeSelect);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "BU3w":
|
|
/*!***************************************************!*\
|
|
!*** ./node_modules/rc-util/es/Dom/dynamicCSS.js ***!
|
|
\***************************************************/
|
|
/*! exports provided: injectCSS, updateCSS */
|
|
/*! exports used: updateCSS */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* unused harmony export injectCSS */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return updateCSS; });
|
|
/* harmony import */ var _canUseDom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./canUseDom */ "MNnm");
|
|
|
|
var MARK_KEY = "rc-util-key";
|
|
|
|
function getContainer(option) {
|
|
if (option.attachTo) {
|
|
return option.attachTo;
|
|
}
|
|
|
|
var head = document.querySelector('head');
|
|
return head || document.body;
|
|
}
|
|
|
|
function injectCSS(css) {
|
|
var _option$csp;
|
|
|
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
if (!Object(_canUseDom__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])()) {
|
|
return null;
|
|
}
|
|
|
|
var styleNode = document.createElement('style');
|
|
|
|
if ((_option$csp = option.csp) === null || _option$csp === void 0 ? void 0 : _option$csp.nonce) {
|
|
var _option$csp2;
|
|
|
|
styleNode.nonce = (_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce;
|
|
}
|
|
|
|
styleNode.innerHTML = css;
|
|
var container = getContainer(option);
|
|
var firstChild = container.firstChild;
|
|
|
|
if (option.prepend && container.prepend) {
|
|
// Use `prepend` first
|
|
container.prepend(styleNode);
|
|
} else if (option.prepend && firstChild) {
|
|
// Fallback to `insertBefore` like IE not support `prepend`
|
|
container.insertBefore(styleNode, firstChild);
|
|
} else {
|
|
container.appendChild(styleNode);
|
|
}
|
|
|
|
return styleNode;
|
|
}
|
|
var containerCache = new Map();
|
|
function updateCSS(css, key) {
|
|
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
var container = getContainer(option); // Get real parent
|
|
|
|
if (!containerCache.has(container)) {
|
|
var placeholderStyle = injectCSS('', option);
|
|
var parentNode = placeholderStyle.parentNode;
|
|
containerCache.set(container, parentNode);
|
|
parentNode.removeChild(placeholderStyle);
|
|
}
|
|
|
|
var existNode = Array.from(containerCache.get(container).children).find(function (node) {
|
|
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
});
|
|
|
|
if (existNode) {
|
|
var _option$csp3, _option$csp4;
|
|
|
|
if (((_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce) && existNode.nonce !== ((_option$csp4 = option.csp) === null || _option$csp4 === void 0 ? void 0 : _option$csp4.nonce)) {
|
|
var _option$csp5;
|
|
|
|
existNode.nonce = (_option$csp5 = option.csp) === null || _option$csp5 === void 0 ? void 0 : _option$csp5.nonce;
|
|
}
|
|
|
|
if (existNode.innerHTML !== css) {
|
|
existNode.innerHTML = css;
|
|
}
|
|
|
|
return existNode;
|
|
}
|
|
|
|
var newNode = injectCSS(css, option);
|
|
newNode[MARK_KEY] = key;
|
|
return newNode;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "BdwD":
|
|
/*!*****************************************!*\
|
|
!*** ./src/components/NoData/index.tsx ***!
|
|
\*****************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var antd_es_button_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/button/style */ "+L6B");
|
|
/* harmony import */ var antd_es_button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/button */ "2/Rp");
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */ "0Owb");
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */ "k1fw");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/assets/images/icons/nodata.png */ "FOrL");
|
|
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_5__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var noData = function noData(_ref) {
|
|
var _ref$buttonProps = _ref.buttonProps,
|
|
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
|
|
_ref$styles = _ref.styles,
|
|
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
|
customText = _ref.customText,
|
|
ButtonText = _ref.ButtonText,
|
|
ButtonClick = _ref.ButtonClick,
|
|
Buttonclass = _ref.Buttonclass,
|
|
ButtonTwo = _ref.ButtonTwo;
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement("section", {
|
|
className: "tc animated fadeIn",
|
|
style: Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])({}, {
|
|
color: '#999',
|
|
margin: '200px auto'
|
|
}), styles)
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement("img", {
|
|
src: _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_5___default.a
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement("p", {
|
|
className: "mt20 font14"
|
|
}, customText || '暂时还没有相关数据哦!'), ButtonText && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({
|
|
className: Buttonclass,
|
|
onClick: ButtonClick
|
|
}, buttonProps), ButtonText), ButtonTwo && ButtonTwo);
|
|
};
|
|
|
|
/* harmony default export */ __webpack_exports__["a"] = (noData);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "FOrL":
|
|
/*!********************************************!*\
|
|
!*** ./src/assets/images/icons/nodata.png ***!
|
|
\********************************************/
|
|
/*! no static exports found */
|
|
/*! exports used: default */
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__.p + "static/nodata.a6b3f948.png";
|
|
|
|
/***/ }),
|
|
|
|
/***/ "GfqC":
|
|
/*!********************************************************!*\
|
|
!*** ./node_modules/rc-upload/es/index.js + 6 modules ***!
|
|
\********************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-upload/es/request.js
|
|
function getError(option, xhr) {
|
|
var msg = 'cannot ' + option.method + ' ' + option.action + ' ' + xhr.status + '\'';
|
|
var err = new Error(msg);
|
|
err.status = xhr.status;
|
|
err.method = option.method;
|
|
err.url = option.action;
|
|
return err;
|
|
}
|
|
|
|
function getBody(xhr) {
|
|
var text = xhr.responseText || xhr.response;
|
|
if (!text) {
|
|
return text;
|
|
}
|
|
|
|
try {
|
|
return JSON.parse(text);
|
|
} catch (e) {
|
|
return text;
|
|
}
|
|
}
|
|
|
|
// option {
|
|
// onProgress: (event: { percent: number }): void,
|
|
// onError: (event: Error, body?: Object): void,
|
|
// onSuccess: (body: Object): void,
|
|
// data: Object,
|
|
// filename: String,
|
|
// file: File,
|
|
// withCredentials: Boolean,
|
|
// action: String,
|
|
// headers: Object,
|
|
// }
|
|
function upload(option) {
|
|
// eslint-disable-next-line no-undef
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
if (option.onProgress && xhr.upload) {
|
|
xhr.upload.onprogress = function progress(e) {
|
|
if (e.total > 0) {
|
|
e.percent = e.loaded / e.total * 100;
|
|
}
|
|
option.onProgress(e);
|
|
};
|
|
}
|
|
|
|
// eslint-disable-next-line no-undef
|
|
var formData = new FormData();
|
|
|
|
if (option.data) {
|
|
Object.keys(option.data).forEach(function (key) {
|
|
var value = option.data[key];
|
|
// support key-value array data
|
|
if (Array.isArray(value)) {
|
|
value.forEach(function (item) {
|
|
// { list: [ 11, 22 ] }
|
|
// formData.append('list[]', 11);
|
|
formData.append(key + '[]', item);
|
|
});
|
|
return;
|
|
}
|
|
|
|
formData.append(key, option.data[key]);
|
|
});
|
|
}
|
|
|
|
// eslint-disable-next-line no-undef
|
|
if (option.file instanceof Blob) {
|
|
formData.append(option.filename, option.file, option.file.name);
|
|
} else {
|
|
formData.append(option.filename, option.file);
|
|
}
|
|
|
|
xhr.onerror = function error(e) {
|
|
option.onError(e);
|
|
};
|
|
|
|
xhr.onload = function onload() {
|
|
// allow success when 2xx status
|
|
// see https://github.com/react-component/upload/issues/34
|
|
if (xhr.status < 200 || xhr.status >= 300) {
|
|
return option.onError(getError(option, xhr), getBody(xhr));
|
|
}
|
|
|
|
return option.onSuccess(getBody(xhr), xhr);
|
|
};
|
|
|
|
xhr.open(option.method, option.action, true);
|
|
|
|
// Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
|
|
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
xhr.withCredentials = true;
|
|
}
|
|
|
|
var headers = option.headers || {};
|
|
|
|
// when set headers['X-Requested-With'] = null , can close default XHR header
|
|
// see https://github.com/react-component/upload/issues/33
|
|
if (headers['X-Requested-With'] !== null) {
|
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
|
}
|
|
|
|
Object.keys(headers).forEach(function (h) {
|
|
if (headers[h] !== null) {
|
|
xhr.setRequestHeader(h, headers[h]);
|
|
}
|
|
});
|
|
|
|
xhr.send(formData);
|
|
|
|
return {
|
|
abort: function abort() {
|
|
xhr.abort();
|
|
}
|
|
};
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-upload/es/uid.js
|
|
var now = +new Date();
|
|
var index = 0;
|
|
|
|
function uid_uid() {
|
|
return "rc-upload-" + now + "-" + ++index;
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-upload/es/attr-accept.js
|
|
function endsWith(str, suffix) {
|
|
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
|
}
|
|
|
|
/* harmony default export */ var attr_accept = (function (file, acceptedFiles) {
|
|
if (file && acceptedFiles) {
|
|
var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
|
|
var fileName = file.name || '';
|
|
var mimeType = file.type || '';
|
|
var baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
|
|
return acceptedFilesArray.some(function (type) {
|
|
var validType = type.trim();
|
|
if (validType.charAt(0) === '.') {
|
|
return endsWith(fileName.toLowerCase(), validType.toLowerCase());
|
|
} else if (/\/\*$/.test(validType)) {
|
|
// This is something like a image/* mime type
|
|
return baseMimeType === validType.replace(/\/.*$/, '');
|
|
}
|
|
return mimeType === validType;
|
|
});
|
|
}
|
|
return true;
|
|
});
|
|
// CONCATENATED MODULE: ./node_modules/rc-upload/es/traverseFileTree.js
|
|
function loopFiles(item, callback) {
|
|
var dirReader = item.createReader();
|
|
var fileList = [];
|
|
|
|
function sequence() {
|
|
dirReader.readEntries(function (entries) {
|
|
var entryList = Array.prototype.slice.apply(entries);
|
|
fileList = fileList.concat(entryList);
|
|
|
|
// Check if all the file has been viewed
|
|
var isFinished = !entryList.length;
|
|
|
|
if (isFinished) {
|
|
callback(fileList);
|
|
} else {
|
|
sequence();
|
|
}
|
|
});
|
|
}
|
|
|
|
sequence();
|
|
}
|
|
|
|
var traverseFileTree = function traverseFileTree(files, callback, isAccepted) {
|
|
var _traverseFileTree = function _traverseFileTree(item, path) {
|
|
path = path || '';
|
|
if (item.isFile) {
|
|
item.file(function (file) {
|
|
if (isAccepted(file)) {
|
|
// https://github.com/ant-design/ant-design/issues/16426
|
|
if (item.fullPath && !file.webkitRelativePath) {
|
|
Object.defineProperties(file, {
|
|
webkitRelativePath: {
|
|
writable: true
|
|
}
|
|
});
|
|
file.webkitRelativePath = item.fullPath.replace(/^\//, '');
|
|
Object.defineProperties(file, {
|
|
webkitRelativePath: {
|
|
writable: false
|
|
}
|
|
});
|
|
}
|
|
callback([file]);
|
|
}
|
|
});
|
|
} else if (item.isDirectory) {
|
|
loopFiles(item, function (entries) {
|
|
entries.forEach(function (entryItem) {
|
|
_traverseFileTree(entryItem, '' + path + item.name + '/');
|
|
});
|
|
});
|
|
}
|
|
};
|
|
files.forEach(function (file) {
|
|
_traverseFileTree(file.webkitGetAsEntry());
|
|
});
|
|
};
|
|
|
|
/* harmony default export */ var es_traverseFileTree = (traverseFileTree);
|
|
// CONCATENATED MODULE: ./node_modules/rc-upload/es/AjaxUploader.js
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
/* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dataOrAriaAttributeProps = function dataOrAriaAttributeProps(props) {
|
|
return Object.keys(props).reduce(function (acc, key) {
|
|
if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') {
|
|
acc[key] = props[key];
|
|
}
|
|
return acc;
|
|
}, {});
|
|
};
|
|
|
|
var AjaxUploader_AjaxUploader = function (_Component) {
|
|
_inherits(AjaxUploader, _Component);
|
|
|
|
function AjaxUploader() {
|
|
var _ref;
|
|
|
|
var _temp, _this, _ret;
|
|
|
|
_classCallCheck(this, AjaxUploader);
|
|
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = AjaxUploader.__proto__ || Object.getPrototypeOf(AjaxUploader)).call.apply(_ref, [this].concat(args))), _this), _this.state = { uid: uid_uid() }, _this.reqs = {}, _this.onChange = function (e) {
|
|
var files = e.target.files;
|
|
_this.uploadFiles(files);
|
|
_this.reset();
|
|
}, _this.onClick = function (e) {
|
|
var el = _this.fileInput;
|
|
if (!el) {
|
|
return;
|
|
}
|
|
var _this$props = _this.props,
|
|
children = _this$props.children,
|
|
onClick = _this$props.onClick;
|
|
|
|
if (children && children.type === 'button') {
|
|
el.parentNode.focus();
|
|
el.parentNode.querySelector('button').blur();
|
|
}
|
|
el.click();
|
|
if (onClick) {
|
|
onClick(e);
|
|
}
|
|
}, _this.onKeyDown = function (e) {
|
|
if (e.key === 'Enter') {
|
|
_this.onClick();
|
|
}
|
|
}, _this.onFileDrop = function (e) {
|
|
var multiple = _this.props.multiple;
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
if (e.type === 'dragover') {
|
|
return;
|
|
}
|
|
|
|
if (_this.props.directory) {
|
|
es_traverseFileTree(Array.prototype.slice.call(e.dataTransfer.items), _this.uploadFiles, function (_file) {
|
|
return attr_accept(_file, _this.props.accept);
|
|
});
|
|
} else {
|
|
var files = Array.prototype.slice.call(e.dataTransfer.files).filter(function (file) {
|
|
return attr_accept(file, _this.props.accept);
|
|
});
|
|
|
|
if (multiple === false) {
|
|
files = files.slice(0, 1);
|
|
}
|
|
|
|
_this.uploadFiles(files);
|
|
}
|
|
}, _this.uploadFiles = function (files) {
|
|
var postFiles = Array.prototype.slice.call(files);
|
|
postFiles.map(function (file) {
|
|
file.uid = uid_uid();
|
|
return file;
|
|
}).forEach(function (file) {
|
|
_this.upload(file, postFiles);
|
|
});
|
|
}, _this.saveFileInput = function (node) {
|
|
_this.fileInput = node;
|
|
}, _temp), _possibleConstructorReturn(_this, _ret);
|
|
}
|
|
|
|
_createClass(AjaxUploader, [{
|
|
key: 'componentDidMount',
|
|
value: function componentDidMount() {
|
|
this._isMounted = true;
|
|
}
|
|
}, {
|
|
key: 'componentWillUnmount',
|
|
value: function componentWillUnmount() {
|
|
this._isMounted = false;
|
|
this.abort();
|
|
}
|
|
}, {
|
|
key: 'upload',
|
|
value: function upload(file, fileList) {
|
|
var _this2 = this;
|
|
|
|
var props = this.props;
|
|
|
|
if (!props.beforeUpload) {
|
|
// always async in case use react state to keep fileList
|
|
return setTimeout(function () {
|
|
return _this2.post(file);
|
|
}, 0);
|
|
}
|
|
|
|
var before = props.beforeUpload(file, fileList);
|
|
if (before && before.then) {
|
|
before.then(function (processedFile) {
|
|
var processedFileType = Object.prototype.toString.call(processedFile);
|
|
if (processedFileType === '[object File]' || processedFileType === '[object Blob]') {
|
|
return _this2.post(processedFile);
|
|
}
|
|
return _this2.post(file);
|
|
})['catch'](function (e) {
|
|
// eslint-disable-next-line no-console
|
|
console.log(e);
|
|
});
|
|
} else if (before !== false) {
|
|
setTimeout(function () {
|
|
return _this2.post(file);
|
|
}, 0);
|
|
}
|
|
return undefined;
|
|
}
|
|
}, {
|
|
key: 'post',
|
|
value: function post(file) {
|
|
var _this3 = this;
|
|
|
|
if (!this._isMounted) {
|
|
return;
|
|
}
|
|
var props = this.props;
|
|
var onStart = props.onStart,
|
|
onProgress = props.onProgress,
|
|
_props$transformFile = props.transformFile,
|
|
transformFile = _props$transformFile === undefined ? function (originFile) {
|
|
return originFile;
|
|
} : _props$transformFile;
|
|
|
|
|
|
new Promise(function (resolve) {
|
|
var action = props.action;
|
|
|
|
if (typeof action === 'function') {
|
|
action = action(file);
|
|
}
|
|
return resolve(action);
|
|
}).then(function (action) {
|
|
var uid = file.uid;
|
|
|
|
var request = props.customRequest || upload;
|
|
var transform = Promise.resolve(transformFile(file)).then(function (transformedFile) {
|
|
var data = props.data;
|
|
|
|
if (typeof data === 'function') {
|
|
data = data(transformedFile);
|
|
}
|
|
return Promise.all([transformedFile, data]);
|
|
})['catch'](function (e) {
|
|
console.error(e); // eslint-disable-line no-console
|
|
});
|
|
|
|
transform.then(function (_ref2) {
|
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
transformedFile = _ref3[0],
|
|
data = _ref3[1];
|
|
|
|
var requestOption = {
|
|
action: action,
|
|
filename: props.name,
|
|
data: data,
|
|
file: transformedFile,
|
|
headers: props.headers,
|
|
withCredentials: props.withCredentials,
|
|
method: props.method || 'post',
|
|
onProgress: onProgress ? function (e) {
|
|
onProgress(e, file);
|
|
} : null,
|
|
onSuccess: function onSuccess(ret, xhr) {
|
|
delete _this3.reqs[uid];
|
|
props.onSuccess(ret, file, xhr);
|
|
},
|
|
onError: function onError(err, ret) {
|
|
delete _this3.reqs[uid];
|
|
props.onError(err, ret, file);
|
|
}
|
|
};
|
|
|
|
onStart(file);
|
|
_this3.reqs[uid] = request(requestOption);
|
|
});
|
|
});
|
|
}
|
|
}, {
|
|
key: 'reset',
|
|
value: function reset() {
|
|
this.setState({
|
|
uid: uid_uid()
|
|
});
|
|
}
|
|
}, {
|
|
key: 'abort',
|
|
value: function abort(file) {
|
|
var reqs = this.reqs;
|
|
|
|
if (file) {
|
|
var uid = file;
|
|
if (file && file.uid) {
|
|
uid = file.uid;
|
|
}
|
|
if (reqs[uid] && reqs[uid].abort) {
|
|
reqs[uid].abort();
|
|
}
|
|
delete reqs[uid];
|
|
} else {
|
|
Object.keys(reqs).forEach(function (uid) {
|
|
if (reqs[uid] && reqs[uid].abort) {
|
|
reqs[uid].abort();
|
|
}
|
|
delete reqs[uid];
|
|
});
|
|
}
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
var _classNames;
|
|
|
|
var _props = this.props,
|
|
Tag = _props.component,
|
|
prefixCls = _props.prefixCls,
|
|
className = _props.className,
|
|
disabled = _props.disabled,
|
|
id = _props.id,
|
|
style = _props.style,
|
|
multiple = _props.multiple,
|
|
accept = _props.accept,
|
|
children = _props.children,
|
|
directory = _props.directory,
|
|
openFileDialogOnClick = _props.openFileDialogOnClick,
|
|
onMouseEnter = _props.onMouseEnter,
|
|
onMouseLeave = _props.onMouseLeave,
|
|
otherProps = _objectWithoutProperties(_props, ['component', 'prefixCls', 'className', 'disabled', 'id', 'style', 'multiple', 'accept', 'children', 'directory', 'openFileDialogOnClick', 'onMouseEnter', 'onMouseLeave']);
|
|
|
|
var cls = classnames_default()((_classNames = {}, _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, prefixCls + '-disabled', disabled), _defineProperty(_classNames, className, className), _classNames));
|
|
var events = disabled ? {} : {
|
|
onClick: openFileDialogOnClick ? this.onClick : function () {},
|
|
onKeyDown: openFileDialogOnClick ? this.onKeyDown : function () {},
|
|
onMouseEnter: onMouseEnter,
|
|
onMouseLeave: onMouseLeave,
|
|
onDrop: this.onFileDrop,
|
|
onDragOver: this.onFileDrop,
|
|
tabIndex: '0'
|
|
};
|
|
return external_window_React_default.a.createElement(
|
|
Tag,
|
|
_extends({}, events, {
|
|
className: cls,
|
|
role: 'button',
|
|
style: style
|
|
}),
|
|
external_window_React_default.a.createElement('input', _extends({}, dataOrAriaAttributeProps(otherProps), {
|
|
id: id,
|
|
type: 'file',
|
|
ref: this.saveFileInput,
|
|
onClick: function onClick(e) {
|
|
return e.stopPropagation();
|
|
} // https://github.com/ant-design/ant-design/issues/19948
|
|
, key: this.state.uid,
|
|
style: { display: 'none' },
|
|
accept: accept,
|
|
directory: directory ? 'directory' : null,
|
|
webkitdirectory: directory ? 'webkitdirectory' : null,
|
|
multiple: multiple,
|
|
onChange: this.onChange
|
|
})),
|
|
children
|
|
);
|
|
}
|
|
}]);
|
|
|
|
return AjaxUploader;
|
|
}(external_window_React_["Component"]);
|
|
|
|
/* harmony default export */ var es_AjaxUploader = (AjaxUploader_AjaxUploader);
|
|
// CONCATENATED MODULE: ./node_modules/rc-upload/es/Upload.js
|
|
var Upload_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
var Upload_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
function Upload_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function Upload_possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function Upload_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
/* eslint react/prop-types:0 */
|
|
|
|
|
|
|
|
function empty() {}
|
|
|
|
var Upload_Upload = function (_Component) {
|
|
Upload_inherits(Upload, _Component);
|
|
|
|
function Upload() {
|
|
var _ref;
|
|
|
|
var _temp, _this, _ret;
|
|
|
|
Upload_classCallCheck(this, Upload);
|
|
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
return _ret = (_temp = (_this = Upload_possibleConstructorReturn(this, (_ref = Upload.__proto__ || Object.getPrototypeOf(Upload)).call.apply(_ref, [this].concat(args))), _this), _this.saveUploader = function (node) {
|
|
_this.uploader = node;
|
|
}, _temp), Upload_possibleConstructorReturn(_this, _ret);
|
|
}
|
|
|
|
Upload_createClass(Upload, [{
|
|
key: 'abort',
|
|
value: function abort(file) {
|
|
this.uploader.abort(file);
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
return external_window_React_default.a.createElement(es_AjaxUploader, Upload_extends({}, this.props, { ref: this.saveUploader }));
|
|
}
|
|
}]);
|
|
|
|
return Upload;
|
|
}(external_window_React_["Component"]);
|
|
|
|
Upload_Upload.defaultProps = {
|
|
component: 'span',
|
|
prefixCls: 'rc-upload',
|
|
data: {},
|
|
headers: {},
|
|
name: 'file',
|
|
multipart: false,
|
|
onStart: empty,
|
|
onError: empty,
|
|
onSuccess: empty,
|
|
multiple: false,
|
|
beforeUpload: null,
|
|
customRequest: null,
|
|
withCredentials: false,
|
|
openFileDialogOnClick: true
|
|
};
|
|
|
|
|
|
/* harmony default export */ var es_Upload = (Upload_Upload);
|
|
// CONCATENATED MODULE: ./node_modules/rc-upload/es/index.js
|
|
// export this package's api
|
|
|
|
|
|
/* harmony default export */ var es = __webpack_exports__["a"] = (es_Upload);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "IBYe":
|
|
/*!**************************************************!*\
|
|
!*** ./node_modules/rc-table/es/sugar/Column.js ***!
|
|
\**************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* istanbul ignore next */
|
|
|
|
/**
|
|
* This is a syntactic sugar for `columns` prop.
|
|
* So HOC will not work on this.
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
function Column(_) {
|
|
return null;
|
|
}
|
|
|
|
/* harmony default export */ __webpack_exports__["a"] = (Column);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "LdHM":
|
|
/*!********************************************************!*\
|
|
!*** ./node_modules/rc-select/es/index.js + 6 modules ***!
|
|
\********************************************************/
|
|
/*! exports provided: Option, OptGroup, default */
|
|
/*! exports used: OptGroup, Option, default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/TransBtn.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/commonUtil.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/pickAttrs.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ es_Option; });
|
|
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ es_OptGroup; });
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__("1OyB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__("vuIU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__("Ji7U");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__("LK+K");
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__("rePB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__("Ff2n");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__("ODXe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__("4IlW");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/pickAttrs.js
|
|
var pickAttrs = __webpack_require__("bX4T");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMemo.js
|
|
var useMemo = __webpack_require__("YrtM");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-virtual-list/es/index.js + 19 modules
|
|
var es = __webpack_require__("+nKL");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-select/es/TransBtn.js
|
|
var TransBtn = __webpack_require__("8OUc");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-select/es/OptionList.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Using virtual list of option display.
|
|
* Will fallback to dom if use customize render.
|
|
*/
|
|
|
|
var OptionList_OptionList = function OptionList(_ref, ref) {
|
|
var prefixCls = _ref.prefixCls,
|
|
id = _ref.id,
|
|
flattenOptions = _ref.flattenOptions,
|
|
childrenAsData = _ref.childrenAsData,
|
|
values = _ref.values,
|
|
searchValue = _ref.searchValue,
|
|
multiple = _ref.multiple,
|
|
defaultActiveFirstOption = _ref.defaultActiveFirstOption,
|
|
height = _ref.height,
|
|
itemHeight = _ref.itemHeight,
|
|
notFoundContent = _ref.notFoundContent,
|
|
open = _ref.open,
|
|
menuItemSelectedIcon = _ref.menuItemSelectedIcon,
|
|
virtual = _ref.virtual,
|
|
onSelect = _ref.onSelect,
|
|
onToggleOpen = _ref.onToggleOpen,
|
|
onActiveValue = _ref.onActiveValue,
|
|
onScroll = _ref.onScroll,
|
|
onMouseEnter = _ref.onMouseEnter;
|
|
var itemPrefixCls = "".concat(prefixCls, "-item");
|
|
var memoFlattenOptions = Object(useMemo["a" /* default */])(function () {
|
|
return flattenOptions;
|
|
}, [open, flattenOptions], function (prev, next) {
|
|
return next[0] && prev[1] !== next[1];
|
|
}); // =========================== List ===========================
|
|
|
|
var listRef = external_window_React_["useRef"](null);
|
|
|
|
var onListMouseDown = function onListMouseDown(event) {
|
|
event.preventDefault();
|
|
};
|
|
|
|
var scrollIntoView = function scrollIntoView(index) {
|
|
if (listRef.current) {
|
|
listRef.current.scrollTo({
|
|
index: index
|
|
});
|
|
}
|
|
}; // ========================== Active ==========================
|
|
|
|
|
|
var getEnabledActiveIndex = function getEnabledActiveIndex(index) {
|
|
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
var len = memoFlattenOptions.length;
|
|
|
|
for (var i = 0; i < len; i += 1) {
|
|
var current = (index + i * offset + len) % len;
|
|
var _memoFlattenOptions$c = memoFlattenOptions[current],
|
|
group = _memoFlattenOptions$c.group,
|
|
data = _memoFlattenOptions$c.data;
|
|
|
|
if (!group && !data.disabled) {
|
|
return current;
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
};
|
|
|
|
var _React$useState = external_window_React_["useState"](function () {
|
|
return getEnabledActiveIndex(0);
|
|
}),
|
|
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
|
|
activeIndex = _React$useState2[0],
|
|
setActiveIndex = _React$useState2[1];
|
|
|
|
var setActive = function setActive(index) {
|
|
setActiveIndex(index); // Trigger active event
|
|
|
|
var flattenItem = memoFlattenOptions[index];
|
|
|
|
if (!flattenItem) {
|
|
onActiveValue(null, -1);
|
|
return;
|
|
}
|
|
|
|
onActiveValue(flattenItem.data.value, index);
|
|
}; // Auto active first item when list length or searchValue changed
|
|
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
|
|
}, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
/**
|
|
* React will skip `onChange` when component update.
|
|
* `setActive` function will call root accessibility state update which makes re-render.
|
|
* So we need to delay to let Input component trigger onChange first.
|
|
*/
|
|
var timeoutId = setTimeout(function () {
|
|
if (!multiple && open && values.size === 1) {
|
|
var value = Array.from(values)[0];
|
|
var index = memoFlattenOptions.findIndex(function (_ref2) {
|
|
var data = _ref2.data;
|
|
return data.value === value;
|
|
});
|
|
setActive(index);
|
|
scrollIntoView(index);
|
|
}
|
|
});
|
|
return function () {
|
|
return clearTimeout(timeoutId);
|
|
};
|
|
}, [open]); // ========================== Values ==========================
|
|
|
|
var onSelectValue = function onSelectValue(value) {
|
|
if (value !== undefined) {
|
|
onSelect(value, {
|
|
selected: !values.has(value)
|
|
});
|
|
} // Single mode should always close by select
|
|
|
|
|
|
if (!multiple) {
|
|
onToggleOpen(false);
|
|
}
|
|
}; // ========================= Keyboard =========================
|
|
|
|
|
|
external_window_React_["useImperativeHandle"](ref, function () {
|
|
return {
|
|
onKeyDown: function onKeyDown(event) {
|
|
var which = event.which;
|
|
|
|
switch (which) {
|
|
// >>> Arrow keys
|
|
case KeyCode["a" /* default */].UP:
|
|
case KeyCode["a" /* default */].DOWN:
|
|
{
|
|
var offset = 0;
|
|
|
|
if (which === KeyCode["a" /* default */].UP) {
|
|
offset = -1;
|
|
} else if (which === KeyCode["a" /* default */].DOWN) {
|
|
offset = 1;
|
|
}
|
|
|
|
if (offset !== 0) {
|
|
var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset);
|
|
scrollIntoView(nextActiveIndex);
|
|
setActive(nextActiveIndex);
|
|
}
|
|
|
|
break;
|
|
}
|
|
// >>> Select
|
|
|
|
case KeyCode["a" /* default */].ENTER:
|
|
{
|
|
// value
|
|
var item = memoFlattenOptions[activeIndex];
|
|
|
|
if (item && !item.data.disabled) {
|
|
onSelectValue(item.data.value);
|
|
} else {
|
|
onSelectValue(undefined);
|
|
}
|
|
|
|
if (open) {
|
|
event.preventDefault();
|
|
}
|
|
|
|
break;
|
|
}
|
|
// >>> Close
|
|
|
|
case KeyCode["a" /* default */].ESC:
|
|
{
|
|
onToggleOpen(false);
|
|
}
|
|
}
|
|
},
|
|
onKeyUp: function onKeyUp() {},
|
|
scrollTo: function scrollTo(index) {
|
|
scrollIntoView(index);
|
|
}
|
|
};
|
|
}); // ========================== Render ==========================
|
|
|
|
if (memoFlattenOptions.length === 0) {
|
|
return external_window_React_["createElement"]("div", {
|
|
role: "listbox",
|
|
id: "".concat(id, "_list"),
|
|
className: "".concat(itemPrefixCls, "-empty"),
|
|
onMouseDown: onListMouseDown
|
|
}, notFoundContent);
|
|
}
|
|
|
|
function renderItem(index) {
|
|
var item = memoFlattenOptions[index];
|
|
if (!item) return null;
|
|
var itemData = item.data || {};
|
|
var value = itemData.value,
|
|
label = itemData.label,
|
|
children = itemData.children;
|
|
var attrs = Object(pickAttrs["a" /* default */])(itemData, true);
|
|
var mergedLabel = childrenAsData ? children : label;
|
|
return item ? external_window_React_["createElement"]("div", Object.assign({
|
|
"aria-label": typeof mergedLabel === 'string' ? mergedLabel : null
|
|
}, attrs, {
|
|
key: index,
|
|
role: "option",
|
|
id: "".concat(id, "_list_").concat(index),
|
|
"aria-selected": values.has(value)
|
|
}), value) : null;
|
|
}
|
|
|
|
return external_window_React_["createElement"](external_window_React_["Fragment"], null, external_window_React_["createElement"]("div", {
|
|
role: "listbox",
|
|
id: "".concat(id, "_list"),
|
|
style: {
|
|
height: 0,
|
|
width: 0,
|
|
overflow: 'hidden'
|
|
}
|
|
}, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), external_window_React_["createElement"](es["a" /* default */], {
|
|
itemKey: "key",
|
|
ref: listRef,
|
|
data: memoFlattenOptions,
|
|
height: height,
|
|
itemHeight: itemHeight,
|
|
fullHeight: false,
|
|
onMouseDown: onListMouseDown,
|
|
onScroll: onScroll,
|
|
virtual: virtual,
|
|
onMouseEnter: onMouseEnter
|
|
}, function (_ref3, itemIndex) {
|
|
var _classNames;
|
|
|
|
var group = _ref3.group,
|
|
groupOption = _ref3.groupOption,
|
|
data = _ref3.data;
|
|
var label = data.label,
|
|
key = data.key; // Group
|
|
|
|
if (group) {
|
|
return external_window_React_["createElement"]("div", {
|
|
className: classnames_default()(itemPrefixCls, "".concat(itemPrefixCls, "-group"))
|
|
}, label !== undefined ? label : key);
|
|
}
|
|
|
|
var disabled = data.disabled,
|
|
value = data.value,
|
|
title = data.title,
|
|
children = data.children,
|
|
style = data.style,
|
|
className = data.className,
|
|
otherProps = Object(objectWithoutProperties["a" /* default */])(data, ["disabled", "value", "title", "children", "style", "className"]); // Option
|
|
|
|
|
|
var selected = values.has(value);
|
|
var optionPrefixCls = "".concat(itemPrefixCls, "-option");
|
|
var optionClassName = classnames_default()(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames));
|
|
var mergedLabel = childrenAsData ? children : label;
|
|
var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected;
|
|
return external_window_React_["createElement"]("div", Object.assign({}, otherProps, {
|
|
"aria-selected": selected,
|
|
className: optionClassName,
|
|
title: title,
|
|
onMouseMove: function onMouseMove() {
|
|
if (activeIndex === itemIndex || disabled) {
|
|
return;
|
|
}
|
|
|
|
setActive(itemIndex);
|
|
},
|
|
onClick: function onClick() {
|
|
if (!disabled) {
|
|
onSelectValue(value);
|
|
}
|
|
},
|
|
style: style
|
|
}), external_window_React_["createElement"]("div", {
|
|
className: "".concat(optionPrefixCls, "-content")
|
|
}, mergedLabel || value), external_window_React_["isValidElement"](menuItemSelectedIcon) || selected, iconVisible && external_window_React_["createElement"](TransBtn["a" /* default */], {
|
|
className: "".concat(itemPrefixCls, "-option-state"),
|
|
customizeIcon: menuItemSelectedIcon,
|
|
customizeIconProps: {
|
|
isSelected: selected
|
|
}
|
|
}, selected ? '✓' : null));
|
|
}));
|
|
};
|
|
|
|
var RefOptionList = external_window_React_["forwardRef"](OptionList_OptionList);
|
|
RefOptionList.displayName = 'OptionList';
|
|
/* harmony default export */ var es_OptionList = (RefOptionList);
|
|
// CONCATENATED MODULE: ./node_modules/rc-select/es/Option.js
|
|
/** This is a placeholder, not real render in dom */
|
|
var Option = function Option() {
|
|
return null;
|
|
};
|
|
|
|
Option.isSelectOption = true;
|
|
/* harmony default export */ var es_Option = (Option);
|
|
// CONCATENATED MODULE: ./node_modules/rc-select/es/OptGroup.js
|
|
/** This is a placeholder, not real render in dom */
|
|
var OptGroup = function OptGroup() {
|
|
return null;
|
|
};
|
|
|
|
OptGroup.isSelectOptGroup = true;
|
|
/* harmony default export */ var es_OptGroup = (OptGroup);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("VTBJ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__("Zm9Q");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-select/es/utils/legacyUtil.js
|
|
|
|
|
|
|
|
|
|
|
|
function convertNodeToOption(node) {
|
|
var key = node.key,
|
|
_node$props = node.props,
|
|
children = _node$props.children,
|
|
value = _node$props.value,
|
|
restProps = Object(objectWithoutProperties["a" /* default */])(_node$props, ["children", "value"]);
|
|
|
|
return Object(objectSpread2["a" /* default */])({
|
|
key: key,
|
|
value: value !== undefined ? value : key,
|
|
children: children
|
|
}, restProps);
|
|
}
|
|
|
|
function convertChildrenToData(nodes) {
|
|
var optionOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
return Object(toArray["a" /* default */])(nodes).map(function (node, index) {
|
|
if (!external_window_React_["isValidElement"](node) || !node.type) {
|
|
return null;
|
|
}
|
|
|
|
var isSelectOptGroup = node.type.isSelectOptGroup,
|
|
key = node.key,
|
|
_node$props2 = node.props,
|
|
children = _node$props2.children,
|
|
restProps = Object(objectWithoutProperties["a" /* default */])(_node$props2, ["children"]);
|
|
|
|
if (optionOnly || !isSelectOptGroup) {
|
|
return convertNodeToOption(node);
|
|
}
|
|
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({
|
|
key: "__RC_SELECT_GRP__".concat(key === null ? index : key, "__"),
|
|
label: key
|
|
}, restProps), {}, {
|
|
options: convertChildrenToData(children)
|
|
});
|
|
}).filter(function (data) {
|
|
return data;
|
|
});
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/rc-select/es/utils/valueUtil.js
|
|
var valueUtil = __webpack_require__("2Qr1");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-select/es/generate.js + 11 modules
|
|
var generate = __webpack_require__("qNPg");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__("U8pU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
|
|
var warning = __webpack_require__("Kwbf");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-select/es/utils/commonUtil.js
|
|
var commonUtil = __webpack_require__("WKfj");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-select/es/utils/warningPropsUtil.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function warningProps(props) {
|
|
var mode = props.mode,
|
|
options = props.options,
|
|
children = props.children,
|
|
backfill = props.backfill,
|
|
allowClear = props.allowClear,
|
|
placeholder = props.placeholder,
|
|
getInputElement = props.getInputElement,
|
|
showSearch = props.showSearch,
|
|
onSearch = props.onSearch,
|
|
defaultOpen = props.defaultOpen,
|
|
autoFocus = props.autoFocus,
|
|
labelInValue = props.labelInValue,
|
|
value = props.value,
|
|
inputValue = props.inputValue,
|
|
optionLabelProp = props.optionLabelProp;
|
|
var multiple = mode === 'multiple' || mode === 'tags';
|
|
var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';
|
|
var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled
|
|
|
|
Object(warning["a" /* default */])(mode !== 'tags' || mergedOptions.every(function (opt) {
|
|
return !opt.disabled;
|
|
}), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type
|
|
|
|
if (mode === 'tags' || mode === 'combobox') {
|
|
var hasNumberValue = mergedOptions.some(function (item) {
|
|
if (item.options) {
|
|
return item.options.some(function (opt) {
|
|
return typeof ('value' in opt ? opt.value : opt.key) === 'number';
|
|
});
|
|
}
|
|
|
|
return typeof ('value' in item ? item.value : item.key) === 'number';
|
|
});
|
|
Object(warning["a" /* default */])(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');
|
|
} // `combobox` should not use `optionLabelProp`
|
|
|
|
|
|
Object(warning["a" /* default */])(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill`
|
|
|
|
Object(warning["a" /* default */])(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement`
|
|
|
|
Object(warning["a" /* default */])(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder`
|
|
|
|
Object(warning["b" /* noteOnce */])(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch`
|
|
|
|
if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {
|
|
Object(warning["a" /* default */])(false, '`onSearch` should work with `showSearch` instead of use alone.');
|
|
}
|
|
|
|
Object(warning["b" /* noteOnce */])(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');
|
|
|
|
if (value !== undefined && value !== null) {
|
|
var values = Object(commonUtil["d" /* toArray */])(value);
|
|
Object(warning["a" /* default */])(!labelInValue || values.every(function (val) {
|
|
return Object(esm_typeof["a" /* default */])(val) === 'object' && ('key' in val || 'value' in val);
|
|
}), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');
|
|
Object(warning["a" /* default */])(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');
|
|
} // Syntactic sugar should use correct children type
|
|
|
|
|
|
if (children) {
|
|
var invalidateChildType = null;
|
|
Object(toArray["a" /* default */])(children).some(function (node) {
|
|
if (!external_window_React_["isValidElement"](node) || !node.type) {
|
|
return false;
|
|
}
|
|
|
|
var type = node.type;
|
|
|
|
if (type.isSelectOption) {
|
|
return false;
|
|
}
|
|
|
|
if (type.isSelectOptGroup) {
|
|
var allChildrenValid = Object(toArray["a" /* default */])(node.props.children).every(function (subNode) {
|
|
if (!external_window_React_["isValidElement"](subNode) || !node.type || subNode.type.isSelectOption) {
|
|
return true;
|
|
}
|
|
|
|
invalidateChildType = subNode.type;
|
|
return false;
|
|
});
|
|
|
|
if (allChildrenValid) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
invalidateChildType = type;
|
|
return true;
|
|
});
|
|
|
|
if (invalidateChildType) {
|
|
Object(warning["a" /* default */])(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`."));
|
|
}
|
|
|
|
Object(warning["a" /* default */])(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.');
|
|
}
|
|
}
|
|
|
|
/* harmony default export */ var warningPropsUtil = (warningProps);
|
|
// CONCATENATED MODULE: ./node_modules/rc-select/es/Select.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* To match accessibility requirement, we always provide an input in the component.
|
|
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
|
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
|
*
|
|
* ref:
|
|
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
|
*
|
|
* New api:
|
|
* - listHeight
|
|
* - listItemHeight
|
|
* - component
|
|
*
|
|
* Remove deprecated api:
|
|
* - multiple
|
|
* - tags
|
|
* - combobox
|
|
* - firstActiveValue
|
|
* - dropdownMenuStyle
|
|
* - openClassName (Not list in api)
|
|
*
|
|
* Update:
|
|
* - `backfill` only support `combobox` mode
|
|
* - `combobox` mode not support `labelInValue` since it's meaningless
|
|
* - `getInputElement` only support `combobox` mode
|
|
* - `onChange` return OptionData instead of ReactNode
|
|
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
|
|
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
|
|
* - `combobox` mode not support `optionLabelProp`
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RefSelect = Object(generate["a" /* default */])({
|
|
prefixCls: 'rc-select',
|
|
components: {
|
|
optionList: es_OptionList
|
|
},
|
|
convertChildrenToData: convertChildrenToData,
|
|
flattenOptions: valueUtil["d" /* flattenOptions */],
|
|
getLabeledValue: valueUtil["e" /* getLabeledValue */],
|
|
filterOptions: valueUtil["b" /* filterOptions */],
|
|
isValueDisabled: valueUtil["g" /* isValueDisabled */],
|
|
findValueOption: valueUtil["c" /* findValueOption */],
|
|
warningProps: warningPropsUtil,
|
|
fillOptionsWithMissingValue: valueUtil["a" /* fillOptionsWithMissingValue */]
|
|
});
|
|
/**
|
|
* Typescript not support generic with function component,
|
|
* we have to wrap an class component to handle this.
|
|
*/
|
|
|
|
var Select_Select = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(Select, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(Select);
|
|
|
|
function Select() {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, Select);
|
|
|
|
_this = _super.apply(this, arguments);
|
|
_this.selectRef = external_window_React_["createRef"]();
|
|
|
|
_this.focus = function () {
|
|
_this.selectRef.current.focus();
|
|
};
|
|
|
|
_this.blur = function () {
|
|
_this.selectRef.current.blur();
|
|
};
|
|
|
|
return _this;
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(Select, [{
|
|
key: "render",
|
|
value: function render() {
|
|
return external_window_React_["createElement"](RefSelect, Object.assign({
|
|
ref: this.selectRef
|
|
}, this.props));
|
|
}
|
|
}]);
|
|
|
|
return Select;
|
|
}(external_window_React_["Component"]);
|
|
|
|
Select_Select.Option = es_Option;
|
|
Select_Select.OptGroup = es_OptGroup;
|
|
/* harmony default export */ var es_Select = (Select_Select);
|
|
// CONCATENATED MODULE: ./node_modules/rc-select/es/index.js
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var rc_select_es = __webpack_exports__["c"] = (es_Select);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "NvD2":
|
|
/*!******************************************************!*\
|
|
!*** ./node_modules/rc-tree/es/utils/conductUtil.js ***!
|
|
\******************************************************/
|
|
/*! exports provided: isCheckDisabled, conductCheck */
|
|
/*! exports used: conductCheck */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* unused harmony export isCheckDisabled */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return conductCheck; });
|
|
/* harmony import */ var rc_util_es_warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/warning */ "Kwbf");
|
|
|
|
|
|
function removeFromCheckedKeys(halfCheckedKeys, checkedKeys) {
|
|
var filteredKeys = new Set();
|
|
halfCheckedKeys.forEach(function (key) {
|
|
if (!checkedKeys.has(key)) {
|
|
filteredKeys.add(key);
|
|
}
|
|
});
|
|
return filteredKeys;
|
|
}
|
|
|
|
function isCheckDisabled(node) {
|
|
var _ref = node || {},
|
|
disabled = _ref.disabled,
|
|
disableCheckbox = _ref.disableCheckbox,
|
|
checkable = _ref.checkable;
|
|
|
|
return !!(disabled || disableCheckbox) || checkable === false;
|
|
} // Fill miss keys
|
|
|
|
function fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
|
|
var checkedKeys = new Set(keys);
|
|
var halfCheckedKeys = new Set(); // Add checked keys top to bottom
|
|
|
|
for (var level = 0; level <= maxLevel; level += 1) {
|
|
var entities = levelEntities.get(level) || new Set();
|
|
entities.forEach(function (entity) {
|
|
var key = entity.key,
|
|
node = entity.node,
|
|
_entity$children = entity.children,
|
|
children = _entity$children === void 0 ? [] : _entity$children;
|
|
|
|
if (checkedKeys.has(key) && !syntheticGetCheckDisabled(node)) {
|
|
children.filter(function (childEntity) {
|
|
return !syntheticGetCheckDisabled(childEntity.node);
|
|
}).forEach(function (childEntity) {
|
|
checkedKeys.add(childEntity.key);
|
|
});
|
|
}
|
|
});
|
|
} // Add checked keys from bottom to top
|
|
|
|
|
|
var visitedKeys = new Set();
|
|
|
|
for (var _level = maxLevel; _level >= 0; _level -= 1) {
|
|
var _entities = levelEntities.get(_level) || new Set();
|
|
|
|
_entities.forEach(function (entity) {
|
|
var parent = entity.parent,
|
|
node = entity.node; // Skip if no need to check
|
|
|
|
if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
|
|
return;
|
|
} // Skip if parent is disabled
|
|
|
|
|
|
if (syntheticGetCheckDisabled(entity.parent.node)) {
|
|
visitedKeys.add(parent.key);
|
|
return;
|
|
}
|
|
|
|
var allChecked = true;
|
|
var partialChecked = false;
|
|
(parent.children || []).filter(function (childEntity) {
|
|
return !syntheticGetCheckDisabled(childEntity.node);
|
|
}).forEach(function (_ref2) {
|
|
var key = _ref2.key;
|
|
var checked = checkedKeys.has(key);
|
|
|
|
if (allChecked && !checked) {
|
|
allChecked = false;
|
|
}
|
|
|
|
if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
|
|
partialChecked = true;
|
|
}
|
|
});
|
|
|
|
if (allChecked) {
|
|
checkedKeys.add(parent.key);
|
|
}
|
|
|
|
if (partialChecked) {
|
|
halfCheckedKeys.add(parent.key);
|
|
}
|
|
|
|
visitedKeys.add(parent.key);
|
|
});
|
|
}
|
|
|
|
return {
|
|
checkedKeys: Array.from(checkedKeys),
|
|
halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
|
|
};
|
|
} // Remove useless key
|
|
|
|
|
|
function cleanConductCheck(keys, halfKeys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
|
|
var checkedKeys = new Set(keys);
|
|
var halfCheckedKeys = new Set(halfKeys); // Remove checked keys from top to bottom
|
|
|
|
for (var level = 0; level <= maxLevel; level += 1) {
|
|
var entities = levelEntities.get(level) || new Set();
|
|
entities.forEach(function (entity) {
|
|
var key = entity.key,
|
|
node = entity.node,
|
|
_entity$children2 = entity.children,
|
|
children = _entity$children2 === void 0 ? [] : _entity$children2;
|
|
|
|
if (!checkedKeys.has(key) && !halfCheckedKeys.has(key) && !syntheticGetCheckDisabled(node)) {
|
|
children.filter(function (childEntity) {
|
|
return !syntheticGetCheckDisabled(childEntity.node);
|
|
}).forEach(function (childEntity) {
|
|
checkedKeys.delete(childEntity.key);
|
|
});
|
|
}
|
|
});
|
|
} // Remove checked keys form bottom to top
|
|
|
|
|
|
halfCheckedKeys = new Set();
|
|
var visitedKeys = new Set();
|
|
|
|
for (var _level2 = maxLevel; _level2 >= 0; _level2 -= 1) {
|
|
var _entities2 = levelEntities.get(_level2) || new Set();
|
|
|
|
_entities2.forEach(function (entity) {
|
|
var parent = entity.parent,
|
|
node = entity.node; // Skip if no need to check
|
|
|
|
if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
|
|
return;
|
|
} // Skip if parent is disabled
|
|
|
|
|
|
if (syntheticGetCheckDisabled(entity.parent.node)) {
|
|
visitedKeys.add(parent.key);
|
|
return;
|
|
}
|
|
|
|
var allChecked = true;
|
|
var partialChecked = false;
|
|
(parent.children || []).filter(function (childEntity) {
|
|
return !syntheticGetCheckDisabled(childEntity.node);
|
|
}).forEach(function (_ref3) {
|
|
var key = _ref3.key;
|
|
var checked = checkedKeys.has(key);
|
|
|
|
if (allChecked && !checked) {
|
|
allChecked = false;
|
|
}
|
|
|
|
if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
|
|
partialChecked = true;
|
|
}
|
|
});
|
|
|
|
if (!allChecked) {
|
|
checkedKeys.delete(parent.key);
|
|
}
|
|
|
|
if (partialChecked) {
|
|
halfCheckedKeys.add(parent.key);
|
|
}
|
|
|
|
visitedKeys.add(parent.key);
|
|
});
|
|
}
|
|
|
|
return {
|
|
checkedKeys: Array.from(checkedKeys),
|
|
halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
|
|
};
|
|
}
|
|
/**
|
|
* Conduct with keys.
|
|
* @param keyList current key list
|
|
* @param keyEntities key - dataEntity map
|
|
* @param mode `fill` to fill missing key, `clean` to remove useless key
|
|
*/
|
|
|
|
|
|
function conductCheck(keyList, checked, keyEntities, getCheckDisabled) {
|
|
var warningMissKeys = [];
|
|
var syntheticGetCheckDisabled;
|
|
|
|
if (getCheckDisabled) {
|
|
syntheticGetCheckDisabled = getCheckDisabled;
|
|
} else {
|
|
syntheticGetCheckDisabled = isCheckDisabled;
|
|
} // We only handle exist keys
|
|
|
|
|
|
var keys = new Set(keyList.filter(function (key) {
|
|
var hasEntity = !!keyEntities[key];
|
|
|
|
if (!hasEntity) {
|
|
warningMissKeys.push(key);
|
|
}
|
|
|
|
return hasEntity;
|
|
}));
|
|
var levelEntities = new Map();
|
|
var maxLevel = 0; // Convert entities by level for calculation
|
|
|
|
Object.keys(keyEntities).forEach(function (key) {
|
|
var entity = keyEntities[key];
|
|
var level = entity.level;
|
|
var levelSet = levelEntities.get(level);
|
|
|
|
if (!levelSet) {
|
|
levelSet = new Set();
|
|
levelEntities.set(level, levelSet);
|
|
}
|
|
|
|
levelSet.add(entity);
|
|
maxLevel = Math.max(maxLevel, level);
|
|
});
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(!warningMissKeys.length, "Tree missing follow keys: ".concat(warningMissKeys.slice(0, 100).map(function (key) {
|
|
return "'".concat(key, "'");
|
|
}).join(', ')));
|
|
var result;
|
|
|
|
if (checked === true) {
|
|
result = fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled);
|
|
} else {
|
|
result = cleanConductCheck(keys, checked.halfCheckedKeys, levelEntities, maxLevel, syntheticGetCheckDisabled);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "OZM5":
|
|
/*!*****************************************!*\
|
|
!*** ./node_modules/rc-tree/es/util.js ***!
|
|
\*****************************************/
|
|
/*! exports provided: arrDel, arrAdd, posToArr, getPosition, isTreeNode, getDragNodesKeys, calcDropPosition, calcSelectedKeys, convertDataToTree, parseCheckedKeys, conductExpandParent, getDataAndAria */
|
|
/*! exports used: arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDataAndAria, getDragNodesKeys, getPosition, isTreeNode, parseCheckedKeys, posToArr */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return arrDel; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrAdd; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return posToArr; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getPosition; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isTreeNode; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getDragNodesKeys; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return calcDropPosition; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return calcSelectedKeys; });
|
|
/* unused harmony export convertDataToTree */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return parseCheckedKeys; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return conductExpandParent; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getDataAndAria; });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "KQm4");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "U8pU");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "Ff2n");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
|
|
/* harmony import */ var rc_util_es_warning__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rc-util/es/warning */ "Kwbf");
|
|
/* harmony import */ var _TreeNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TreeNode */ "WaYH");
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Legacy code. Should avoid to use if you are new to import these code.
|
|
*/
|
|
|
|
|
|
|
|
var DRAG_SIDE_RANGE = 0.25;
|
|
var DRAG_MIN_GAP = 2;
|
|
function arrDel(list, value) {
|
|
var clone = list.slice();
|
|
var index = clone.indexOf(value);
|
|
|
|
if (index >= 0) {
|
|
clone.splice(index, 1);
|
|
}
|
|
|
|
return clone;
|
|
}
|
|
function arrAdd(list, value) {
|
|
var clone = list.slice();
|
|
|
|
if (clone.indexOf(value) === -1) {
|
|
clone.push(value);
|
|
}
|
|
|
|
return clone;
|
|
}
|
|
function posToArr(pos) {
|
|
return pos.split('-');
|
|
}
|
|
function getPosition(level, index) {
|
|
return "".concat(level, "-").concat(index);
|
|
}
|
|
function isTreeNode(node) {
|
|
return node && node.type && node.type.isTreeNode;
|
|
}
|
|
function getDragNodesKeys(dragNodeKey, keyEntities) {
|
|
var dragNodesKeys = [dragNodeKey];
|
|
var entity = keyEntities[dragNodeKey];
|
|
|
|
function dig() {
|
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
list.forEach(function (_ref) {
|
|
var key = _ref.key,
|
|
children = _ref.children;
|
|
dragNodesKeys.push(key);
|
|
dig(children);
|
|
});
|
|
}
|
|
|
|
dig(entity.children);
|
|
return dragNodesKeys;
|
|
} // Only used when drag, not affect SSR.
|
|
|
|
function calcDropPosition(event, treeNode) {
|
|
var clientY = event.clientY;
|
|
|
|
var _treeNode$selectHandl = treeNode.selectHandle.getBoundingClientRect(),
|
|
top = _treeNode$selectHandl.top,
|
|
bottom = _treeNode$selectHandl.bottom,
|
|
height = _treeNode$selectHandl.height;
|
|
|
|
var des = Math.max(height * DRAG_SIDE_RANGE, DRAG_MIN_GAP);
|
|
|
|
if (clientY <= top + des) {
|
|
return -1;
|
|
}
|
|
|
|
if (clientY >= bottom - des) {
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
/**
|
|
* Return selectedKeys according with multiple prop
|
|
* @param selectedKeys
|
|
* @param props
|
|
* @returns [string]
|
|
*/
|
|
|
|
function calcSelectedKeys(selectedKeys, props) {
|
|
if (!selectedKeys) return undefined;
|
|
var multiple = props.multiple;
|
|
|
|
if (multiple) {
|
|
return selectedKeys.slice();
|
|
}
|
|
|
|
if (selectedKeys.length) {
|
|
return [selectedKeys[0]];
|
|
}
|
|
|
|
return selectedKeys;
|
|
}
|
|
|
|
var internalProcessProps = function internalProcessProps(props) {
|
|
return props;
|
|
};
|
|
|
|
function convertDataToTree(treeData, processor) {
|
|
if (!treeData) return [];
|
|
|
|
var _ref2 = processor || {},
|
|
_ref2$processProps = _ref2.processProps,
|
|
processProps = _ref2$processProps === void 0 ? internalProcessProps : _ref2$processProps;
|
|
|
|
var list = Array.isArray(treeData) ? treeData : [treeData];
|
|
return list.map(function (_ref3) {
|
|
var children = _ref3.children,
|
|
props = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_ref3, ["children"]);
|
|
|
|
var childrenNodes = convertDataToTree(children, processor);
|
|
return react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(_TreeNode__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], Object.assign({}, processProps(props)), childrenNodes);
|
|
});
|
|
}
|
|
/**
|
|
* Parse `checkedKeys` to { checkedKeys, halfCheckedKeys } style
|
|
*/
|
|
|
|
function parseCheckedKeys(keys) {
|
|
if (!keys) {
|
|
return null;
|
|
} // Convert keys to object format
|
|
|
|
|
|
var keyProps;
|
|
|
|
if (Array.isArray(keys)) {
|
|
// [Legacy] Follow the api doc
|
|
keyProps = {
|
|
checkedKeys: keys,
|
|
halfCheckedKeys: undefined
|
|
};
|
|
} else if (Object(_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(keys) === 'object') {
|
|
keyProps = {
|
|
checkedKeys: keys.checked || undefined,
|
|
halfCheckedKeys: keys.halfChecked || undefined
|
|
};
|
|
} else {
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(false, '`checkedKeys` is not an array or an object');
|
|
return null;
|
|
}
|
|
|
|
return keyProps;
|
|
}
|
|
/**
|
|
* If user use `autoExpandParent` we should get the list of parent node
|
|
* @param keyList
|
|
* @param keyEntities
|
|
*/
|
|
|
|
function conductExpandParent(keyList, keyEntities) {
|
|
var expandedKeys = new Set();
|
|
|
|
function conductUp(key) {
|
|
if (expandedKeys.has(key)) return;
|
|
var entity = keyEntities[key];
|
|
if (!entity) return;
|
|
expandedKeys.add(key);
|
|
var parent = entity.parent,
|
|
node = entity.node;
|
|
if (node.disabled) return;
|
|
|
|
if (parent) {
|
|
conductUp(parent.key);
|
|
}
|
|
}
|
|
|
|
(keyList || []).forEach(function (key) {
|
|
conductUp(key);
|
|
});
|
|
return Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(expandedKeys);
|
|
}
|
|
/**
|
|
* Returns only the data- and aria- key/value pairs
|
|
*/
|
|
|
|
function getDataAndAria(props) {
|
|
var omitProps = {};
|
|
Object.keys(props).forEach(function (key) {
|
|
if (key.startsWith('data-') || key.startsWith('aria-')) {
|
|
omitProps[key] = props[key];
|
|
}
|
|
});
|
|
return omitProps;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "SA+Z":
|
|
/*!********************************************************!*\
|
|
!*** ./node_modules/@babel/runtime/helpers/toArray.js ***!
|
|
\********************************************************/
|
|
/*! no static exports found */
|
|
/*! exports used: default */
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ "wTVA");
|
|
|
|
var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "EbDI");
|
|
|
|
var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "ZhPi");
|
|
|
|
var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ "wkBT");
|
|
|
|
function _toArray(arr) {
|
|
return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
|
|
}
|
|
|
|
module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "WaYH":
|
|
/*!*********************************************************!*\
|
|
!*** ./node_modules/rc-tree/es/TreeNode.js + 1 modules ***!
|
|
\*********************************************************/
|
|
/*! exports provided: InternalTreeNode, default */
|
|
/*! exports used: default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/contextTypes.js because of ./node_modules/rc-tree/es/Tree.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/util.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/treeUtil.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// UNUSED EXPORTS: InternalTreeNode
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__("rePB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__("Ff2n");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("VTBJ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__("1OyB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__("vuIU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
var assertThisInitialized = __webpack_require__("JX7q");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__("Ji7U");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__("LK+K");
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/contextTypes.js
|
|
var contextTypes = __webpack_require__("sboe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/util.js
|
|
var util = __webpack_require__("OZM5");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree/es/Indent.js
|
|
|
|
|
|
|
|
|
|
var Indent_Indent = function Indent(_ref) {
|
|
var prefixCls = _ref.prefixCls,
|
|
level = _ref.level,
|
|
isStart = _ref.isStart,
|
|
isEnd = _ref.isEnd;
|
|
|
|
if (!level) {
|
|
return null;
|
|
}
|
|
|
|
var baseClassName = "".concat(prefixCls, "-indent-unit");
|
|
var list = [];
|
|
|
|
for (var i = 0; i < level; i += 1) {
|
|
var _classNames;
|
|
|
|
list.push(external_window_React_["createElement"]("span", {
|
|
key: i,
|
|
className: classnames_default()(baseClassName, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(baseClassName, "-start"), isStart[i + 1]), Object(defineProperty["a" /* default */])(_classNames, "".concat(baseClassName, "-end"), isEnd[i + 1]), Object(defineProperty["a" /* default */])(_classNames, "".concat(baseClassName, "-end-first-level"), !i && isEnd[0]), _classNames))
|
|
}));
|
|
}
|
|
|
|
return external_window_React_["createElement"]("span", {
|
|
"aria-hidden": "true",
|
|
className: "".concat(prefixCls, "-indent")
|
|
}, list);
|
|
};
|
|
|
|
/* harmony default export */ var es_Indent = (Indent_Indent);
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/utils/treeUtil.js
|
|
var treeUtil = __webpack_require__("815F");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree/es/TreeNode.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
|
|
|
|
var ICON_OPEN = 'open';
|
|
var ICON_CLOSE = 'close';
|
|
var defaultTitle = '---';
|
|
|
|
var TreeNode_InternalTreeNode = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(InternalTreeNode, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(InternalTreeNode);
|
|
|
|
function InternalTreeNode() {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, InternalTreeNode);
|
|
|
|
_this = _super.apply(this, arguments);
|
|
_this.state = {
|
|
dragNodeHighlight: false
|
|
};
|
|
|
|
_this.onSelectorClick = function (e) {
|
|
// Click trigger before select/check operation
|
|
var onNodeClick = _this.props.context.onNodeClick;
|
|
onNodeClick(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
|
|
if (_this.isSelectable()) {
|
|
_this.onSelect(e);
|
|
} else {
|
|
_this.onCheck(e);
|
|
}
|
|
};
|
|
|
|
_this.onSelectorDoubleClick = function (e) {
|
|
var onNodeDoubleClick = _this.props.context.onNodeDoubleClick;
|
|
onNodeDoubleClick(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
};
|
|
|
|
_this.onSelect = function (e) {
|
|
if (_this.isDisabled()) return;
|
|
var onNodeSelect = _this.props.context.onNodeSelect;
|
|
e.preventDefault();
|
|
onNodeSelect(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
};
|
|
|
|
_this.onCheck = function (e) {
|
|
if (_this.isDisabled()) return;
|
|
var _this$props = _this.props,
|
|
disableCheckbox = _this$props.disableCheckbox,
|
|
checked = _this$props.checked;
|
|
var onNodeCheck = _this.props.context.onNodeCheck;
|
|
if (!_this.isCheckable() || disableCheckbox) return;
|
|
e.preventDefault();
|
|
var targetChecked = !checked;
|
|
onNodeCheck(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props), targetChecked);
|
|
};
|
|
|
|
_this.onMouseEnter = function (e) {
|
|
var onNodeMouseEnter = _this.props.context.onNodeMouseEnter;
|
|
onNodeMouseEnter(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
};
|
|
|
|
_this.onMouseLeave = function (e) {
|
|
var onNodeMouseLeave = _this.props.context.onNodeMouseLeave;
|
|
onNodeMouseLeave(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
};
|
|
|
|
_this.onContextMenu = function (e) {
|
|
var onNodeContextMenu = _this.props.context.onNodeContextMenu;
|
|
onNodeContextMenu(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
};
|
|
|
|
_this.onDragStart = function (e) {
|
|
var onNodeDragStart = _this.props.context.onNodeDragStart;
|
|
e.stopPropagation();
|
|
|
|
_this.setState({
|
|
dragNodeHighlight: true
|
|
});
|
|
|
|
onNodeDragStart(e, Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
try {
|
|
// ie throw error
|
|
// firefox-need-it
|
|
e.dataTransfer.setData('text/plain', '');
|
|
} catch (error) {// empty
|
|
}
|
|
};
|
|
|
|
_this.onDragEnter = function (e) {
|
|
var onNodeDragEnter = _this.props.context.onNodeDragEnter;
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
onNodeDragEnter(e, Object(assertThisInitialized["a" /* default */])(_this));
|
|
};
|
|
|
|
_this.onDragOver = function (e) {
|
|
var onNodeDragOver = _this.props.context.onNodeDragOver;
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
onNodeDragOver(e, Object(assertThisInitialized["a" /* default */])(_this));
|
|
};
|
|
|
|
_this.onDragLeave = function (e) {
|
|
var onNodeDragLeave = _this.props.context.onNodeDragLeave;
|
|
e.stopPropagation();
|
|
onNodeDragLeave(e, Object(assertThisInitialized["a" /* default */])(_this));
|
|
};
|
|
|
|
_this.onDragEnd = function (e) {
|
|
var onNodeDragEnd = _this.props.context.onNodeDragEnd;
|
|
e.stopPropagation();
|
|
|
|
_this.setState({
|
|
dragNodeHighlight: false
|
|
});
|
|
|
|
onNodeDragEnd(e, Object(assertThisInitialized["a" /* default */])(_this));
|
|
};
|
|
|
|
_this.onDrop = function (e) {
|
|
var onNodeDrop = _this.props.context.onNodeDrop;
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
_this.setState({
|
|
dragNodeHighlight: false
|
|
});
|
|
|
|
onNodeDrop(e, Object(assertThisInitialized["a" /* default */])(_this));
|
|
}; // Disabled item still can be switch
|
|
|
|
|
|
_this.onExpand = function (e) {
|
|
var onNodeExpand = _this.props.context.onNodeExpand;
|
|
onNodeExpand(e, Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
}; // Drag usage
|
|
|
|
|
|
_this.setSelectHandle = function (node) {
|
|
_this.selectHandle = node;
|
|
};
|
|
|
|
_this.getNodeState = function () {
|
|
var expanded = _this.props.expanded;
|
|
|
|
if (_this.isLeaf()) {
|
|
return null;
|
|
}
|
|
|
|
return expanded ? ICON_OPEN : ICON_CLOSE;
|
|
};
|
|
|
|
_this.hasChildren = function () {
|
|
var eventKey = _this.props.eventKey;
|
|
var keyEntities = _this.props.context.keyEntities;
|
|
|
|
var _ref = keyEntities[eventKey] || {},
|
|
children = _ref.children;
|
|
|
|
return !!(children || []).length;
|
|
};
|
|
|
|
_this.isLeaf = function () {
|
|
var _this$props2 = _this.props,
|
|
isLeaf = _this$props2.isLeaf,
|
|
loaded = _this$props2.loaded;
|
|
var loadData = _this.props.context.loadData;
|
|
|
|
var hasChildren = _this.hasChildren();
|
|
|
|
if (isLeaf === false) {
|
|
return false;
|
|
}
|
|
|
|
return isLeaf || !loadData && !hasChildren || loadData && loaded && !hasChildren;
|
|
};
|
|
|
|
_this.isDisabled = function () {
|
|
var disabled = _this.props.disabled;
|
|
var treeDisabled = _this.props.context.disabled;
|
|
return !!(treeDisabled || disabled);
|
|
};
|
|
|
|
_this.isCheckable = function () {
|
|
var checkable = _this.props.checkable;
|
|
var treeCheckable = _this.props.context.checkable; // Return false if tree or treeNode is not checkable
|
|
|
|
if (!treeCheckable || checkable === false) return false;
|
|
return treeCheckable;
|
|
}; // Load data to avoid default expanded tree without data
|
|
|
|
|
|
_this.syncLoadData = function (props) {
|
|
var expanded = props.expanded,
|
|
loading = props.loading,
|
|
loaded = props.loaded;
|
|
var _this$props$context = _this.props.context,
|
|
loadData = _this$props$context.loadData,
|
|
onNodeLoad = _this$props$context.onNodeLoad;
|
|
if (loading) return; // read from state to avoid loadData at same time
|
|
|
|
if (loadData && expanded && !_this.isLeaf()) {
|
|
// We needn't reload data when has children in sync logic
|
|
// It's only needed in node expanded
|
|
if (!_this.hasChildren() && !loaded) {
|
|
onNodeLoad(Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.props));
|
|
}
|
|
}
|
|
}; // Switcher
|
|
|
|
|
|
_this.renderSwitcher = function () {
|
|
var _this$props3 = _this.props,
|
|
expanded = _this$props3.expanded,
|
|
switcherIconFromProps = _this$props3.switcherIcon;
|
|
var _this$props$context2 = _this.props.context,
|
|
prefixCls = _this$props$context2.prefixCls,
|
|
switcherIconFromCtx = _this$props$context2.switcherIcon;
|
|
var switcherIcon = switcherIconFromProps || switcherIconFromCtx;
|
|
|
|
if (_this.isLeaf()) {
|
|
return external_window_React_["createElement"]("span", {
|
|
className: classnames_default()("".concat(prefixCls, "-switcher"), "".concat(prefixCls, "-switcher-noop"))
|
|
}, typeof switcherIcon === 'function' ? switcherIcon(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, _this.props), {}, {
|
|
isLeaf: true
|
|
})) : switcherIcon);
|
|
}
|
|
|
|
var switcherCls = classnames_default()("".concat(prefixCls, "-switcher"), "".concat(prefixCls, "-switcher_").concat(expanded ? ICON_OPEN : ICON_CLOSE));
|
|
return external_window_React_["createElement"]("span", {
|
|
onClick: _this.onExpand,
|
|
className: switcherCls
|
|
}, typeof switcherIcon === 'function' ? switcherIcon(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, _this.props), {}, {
|
|
isLeaf: false
|
|
})) : switcherIcon);
|
|
}; // Checkbox
|
|
|
|
|
|
_this.renderCheckbox = function () {
|
|
var _this$props4 = _this.props,
|
|
checked = _this$props4.checked,
|
|
halfChecked = _this$props4.halfChecked,
|
|
disableCheckbox = _this$props4.disableCheckbox;
|
|
var prefixCls = _this.props.context.prefixCls;
|
|
|
|
var disabled = _this.isDisabled();
|
|
|
|
var checkable = _this.isCheckable();
|
|
|
|
if (!checkable) return null; // [Legacy] Custom element should be separate with `checkable` in future
|
|
|
|
var $custom = typeof checkable !== 'boolean' ? checkable : null;
|
|
return external_window_React_["createElement"]("span", {
|
|
className: classnames_default()("".concat(prefixCls, "-checkbox"), checked && "".concat(prefixCls, "-checkbox-checked"), !checked && halfChecked && "".concat(prefixCls, "-checkbox-indeterminate"), (disabled || disableCheckbox) && "".concat(prefixCls, "-checkbox-disabled")),
|
|
onClick: _this.onCheck
|
|
}, $custom);
|
|
};
|
|
|
|
_this.renderIcon = function () {
|
|
var loading = _this.props.loading;
|
|
var prefixCls = _this.props.context.prefixCls;
|
|
return external_window_React_["createElement"]("span", {
|
|
className: classnames_default()("".concat(prefixCls, "-iconEle"), "".concat(prefixCls, "-icon__").concat(_this.getNodeState() || 'docu'), loading && "".concat(prefixCls, "-icon_loading"))
|
|
});
|
|
}; // Icon + Title
|
|
|
|
|
|
_this.renderSelector = function () {
|
|
var dragNodeHighlight = _this.state.dragNodeHighlight;
|
|
var _this$props5 = _this.props,
|
|
title = _this$props5.title,
|
|
selected = _this$props5.selected,
|
|
icon = _this$props5.icon,
|
|
loading = _this$props5.loading,
|
|
data = _this$props5.data;
|
|
var _this$props$context3 = _this.props.context,
|
|
prefixCls = _this$props$context3.prefixCls,
|
|
showIcon = _this$props$context3.showIcon,
|
|
treeIcon = _this$props$context3.icon,
|
|
draggable = _this$props$context3.draggable,
|
|
loadData = _this$props$context3.loadData,
|
|
titleRender = _this$props$context3.titleRender;
|
|
|
|
var disabled = _this.isDisabled();
|
|
|
|
var wrapClass = "".concat(prefixCls, "-node-content-wrapper"); // Icon - Still show loading icon when loading without showIcon
|
|
|
|
var $icon;
|
|
|
|
if (showIcon) {
|
|
var currentIcon = icon || treeIcon;
|
|
$icon = currentIcon ? external_window_React_["createElement"]("span", {
|
|
className: classnames_default()("".concat(prefixCls, "-iconEle"), "".concat(prefixCls, "-icon__customize"))
|
|
}, typeof currentIcon === 'function' ? currentIcon(_this.props) : currentIcon) : _this.renderIcon();
|
|
} else if (loadData && loading) {
|
|
$icon = _this.renderIcon();
|
|
} // Title
|
|
|
|
|
|
var titleNode;
|
|
|
|
if (typeof title === 'function') {
|
|
titleNode = title(data);
|
|
} else if (titleRender) {
|
|
titleNode = titleRender(data);
|
|
} else {
|
|
titleNode = title;
|
|
}
|
|
|
|
var $title = external_window_React_["createElement"]("span", {
|
|
className: "".concat(prefixCls, "-title")
|
|
}, titleNode);
|
|
return external_window_React_["createElement"]("span", {
|
|
ref: _this.setSelectHandle,
|
|
title: typeof title === 'string' ? title : '',
|
|
className: classnames_default()("".concat(wrapClass), "".concat(wrapClass, "-").concat(_this.getNodeState() || 'normal'), !disabled && (selected || dragNodeHighlight) && "".concat(prefixCls, "-node-selected"), !disabled && draggable && 'draggable'),
|
|
draggable: !disabled && draggable || undefined,
|
|
"aria-grabbed": !disabled && draggable || undefined,
|
|
onMouseEnter: _this.onMouseEnter,
|
|
onMouseLeave: _this.onMouseLeave,
|
|
onContextMenu: _this.onContextMenu,
|
|
onClick: _this.onSelectorClick,
|
|
onDoubleClick: _this.onSelectorDoubleClick,
|
|
onDragStart: draggable ? _this.onDragStart : undefined
|
|
}, $icon, $title);
|
|
};
|
|
|
|
return _this;
|
|
} // Isomorphic needn't load data in server side
|
|
|
|
|
|
Object(createClass["a" /* default */])(InternalTreeNode, [{
|
|
key: "componentDidMount",
|
|
value: function componentDidMount() {
|
|
this.syncLoadData(this.props);
|
|
}
|
|
}, {
|
|
key: "componentDidUpdate",
|
|
value: function componentDidUpdate() {
|
|
this.syncLoadData(this.props);
|
|
}
|
|
}, {
|
|
key: "isSelectable",
|
|
value: function isSelectable() {
|
|
var selectable = this.props.selectable;
|
|
var treeSelectable = this.props.context.selectable; // Ignore when selectable is undefined or null
|
|
|
|
if (typeof selectable === 'boolean') {
|
|
return selectable;
|
|
}
|
|
|
|
return treeSelectable;
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
var _classNames;
|
|
|
|
var _this$props6 = this.props,
|
|
eventKey = _this$props6.eventKey,
|
|
className = _this$props6.className,
|
|
style = _this$props6.style,
|
|
dragOver = _this$props6.dragOver,
|
|
dragOverGapTop = _this$props6.dragOverGapTop,
|
|
dragOverGapBottom = _this$props6.dragOverGapBottom,
|
|
isLeaf = _this$props6.isLeaf,
|
|
isStart = _this$props6.isStart,
|
|
isEnd = _this$props6.isEnd,
|
|
expanded = _this$props6.expanded,
|
|
selected = _this$props6.selected,
|
|
checked = _this$props6.checked,
|
|
halfChecked = _this$props6.halfChecked,
|
|
loading = _this$props6.loading,
|
|
domRef = _this$props6.domRef,
|
|
active = _this$props6.active,
|
|
onMouseMove = _this$props6.onMouseMove,
|
|
otherProps = Object(objectWithoutProperties["a" /* default */])(_this$props6, ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "onMouseMove"]);
|
|
|
|
var _this$props$context4 = this.props.context,
|
|
prefixCls = _this$props$context4.prefixCls,
|
|
filterTreeNode = _this$props$context4.filterTreeNode,
|
|
draggable = _this$props$context4.draggable,
|
|
keyEntities = _this$props$context4.keyEntities;
|
|
var disabled = this.isDisabled();
|
|
var dataOrAriaAttributeProps = Object(util["f" /* getDataAndAria */])(otherProps);
|
|
|
|
var _ref2 = keyEntities[eventKey] || {},
|
|
level = _ref2.level;
|
|
|
|
var isEndNode = isEnd[isEnd.length - 1];
|
|
return external_window_React_["createElement"]("div", Object.assign({
|
|
ref: domRef,
|
|
className: classnames_default()(className, "".concat(prefixCls, "-treenode"), (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-disabled"), disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-switcher-").concat(expanded ? 'open' : 'close'), !isLeaf), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-checkbox-checked"), checked), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-checkbox-indeterminate"), halfChecked), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-selected"), selected), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-loading"), loading), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-active"), active), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-treenode-leaf-last"), isEndNode), Object(defineProperty["a" /* default */])(_classNames, 'drag-over', !disabled && dragOver), Object(defineProperty["a" /* default */])(_classNames, 'drag-over-gap-top', !disabled && dragOverGapTop), Object(defineProperty["a" /* default */])(_classNames, 'drag-over-gap-bottom', !disabled && dragOverGapBottom), Object(defineProperty["a" /* default */])(_classNames, 'filter-node', filterTreeNode && filterTreeNode(Object(treeUtil["b" /* convertNodePropsToEventData */])(this.props))), _classNames)),
|
|
style: style,
|
|
onDragEnter: draggable ? this.onDragEnter : undefined,
|
|
onDragOver: draggable ? this.onDragOver : undefined,
|
|
onDragLeave: draggable ? this.onDragLeave : undefined,
|
|
onDrop: draggable ? this.onDrop : undefined,
|
|
onDragEnd: draggable ? this.onDragEnd : undefined,
|
|
onMouseMove: onMouseMove
|
|
}, dataOrAriaAttributeProps), external_window_React_["createElement"](es_Indent, {
|
|
prefixCls: prefixCls,
|
|
level: level,
|
|
isStart: isStart,
|
|
isEnd: isEnd
|
|
}), this.renderSwitcher(), this.renderCheckbox(), this.renderSelector());
|
|
}
|
|
}]);
|
|
|
|
return InternalTreeNode;
|
|
}(external_window_React_["Component"]);
|
|
|
|
var TreeNode_ContextTreeNode = function ContextTreeNode(props) {
|
|
return external_window_React_["createElement"](contextTypes["a" /* TreeContext */].Consumer, null, function (context) {
|
|
return external_window_React_["createElement"](TreeNode_InternalTreeNode, Object.assign({}, props, {
|
|
context: context
|
|
}));
|
|
});
|
|
};
|
|
|
|
TreeNode_ContextTreeNode.displayName = 'TreeNode';
|
|
TreeNode_ContextTreeNode.defaultProps = {
|
|
title: defaultTitle
|
|
};
|
|
TreeNode_ContextTreeNode.isTreeNode = 1;
|
|
|
|
/* harmony default export */ var TreeNode = __webpack_exports__["a"] = (TreeNode_ContextTreeNode);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "Y1PL":
|
|
/*!**********************************************************!*\
|
|
!*** ./node_modules/rc-textarea/es/index.js + 7 modules ***!
|
|
\**********************************************************/
|
|
/*! exports provided: ResizableTextArea, default */
|
|
/*! all exports used */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "ResizableTextArea", function() { return /* reexport */ es_ResizableTextArea; });
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__("wx14");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__("1OyB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__("vuIU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__("Ji7U");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__("LK+K");
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("VTBJ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__("rePB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__("Zm9Q");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
|
|
var warning = __webpack_require__("Kwbf");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/ref.js
|
|
var ref = __webpack_require__("c+Xe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/findDOMNode.js
|
|
var findDOMNode = __webpack_require__("m+aA");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js
|
|
var ResizeObserver_es = __webpack_require__("bdgK");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/node_modules/rc-resize-observer/es/utils/observerUtil.js
|
|
// =============================== Const ===============================
|
|
|
|
var elementListeners = new Map();
|
|
|
|
function observerUtil_onResize(entities) {
|
|
entities.forEach(function (entity) {
|
|
var _elementListeners$get;
|
|
|
|
var target = entity.target;
|
|
(_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 ? void 0 : _elementListeners$get.forEach(function (listener) {
|
|
return listener(target);
|
|
});
|
|
});
|
|
} // Note: ResizeObserver polyfill not support option to measure border-box resize
|
|
|
|
|
|
var resizeObserver = new ResizeObserver_es["default"](observerUtil_onResize); // Dev env only
|
|
|
|
var _el = false ? undefined : null; // eslint-disable-line
|
|
|
|
var _rs = false ? undefined : null; // eslint-disable-line
|
|
// ============================== Observe ==============================
|
|
|
|
function observe(element, callback) {
|
|
if (!elementListeners.has(element)) {
|
|
elementListeners.set(element, new Set());
|
|
resizeObserver.observe(element);
|
|
}
|
|
|
|
elementListeners.get(element).add(callback);
|
|
}
|
|
function unobserve(element, callback) {
|
|
if (elementListeners.has(element)) {
|
|
elementListeners.get(element).delete(callback);
|
|
|
|
if (!elementListeners.get(element).size) {
|
|
resizeObserver.unobserve(element);
|
|
elementListeners.delete(element);
|
|
}
|
|
}
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/node_modules/rc-resize-observer/es/SingleObserver/DomWrapper.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Fallback to findDOMNode if origin ref do not provide any dom element
|
|
*/
|
|
|
|
var DomWrapper_DomWrapper = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(DomWrapper, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(DomWrapper);
|
|
|
|
function DomWrapper() {
|
|
Object(classCallCheck["a" /* default */])(this, DomWrapper);
|
|
|
|
return _super.apply(this, arguments);
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(DomWrapper, [{
|
|
key: "render",
|
|
value: function render() {
|
|
return this.props.children;
|
|
}
|
|
}]);
|
|
|
|
return DomWrapper;
|
|
}(external_window_React_["Component"]);
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/node_modules/rc-resize-observer/es/Collection.js
|
|
|
|
var CollectionContext = /*#__PURE__*/external_window_React_["createContext"](null);
|
|
/**
|
|
* Collect all the resize event from children ResizeObserver
|
|
*/
|
|
|
|
function Collection(_ref) {
|
|
var children = _ref.children,
|
|
onBatchResize = _ref.onBatchResize;
|
|
var resizeIdRef = external_window_React_["useRef"](0);
|
|
var resizeInfosRef = external_window_React_["useRef"]([]);
|
|
var onCollectionResize = external_window_React_["useContext"](CollectionContext);
|
|
var onResize = external_window_React_["useCallback"](function (size, element, data) {
|
|
resizeIdRef.current += 1;
|
|
var currentId = resizeIdRef.current;
|
|
resizeInfosRef.current.push({
|
|
size: size,
|
|
element: element,
|
|
data: data
|
|
});
|
|
Promise.resolve().then(function () {
|
|
if (currentId === resizeIdRef.current) {
|
|
onBatchResize === null || onBatchResize === void 0 ? void 0 : onBatchResize(resizeInfosRef.current);
|
|
resizeInfosRef.current = [];
|
|
}
|
|
}); // Continue bubbling if parent exist
|
|
|
|
onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(size, element, data);
|
|
}, [onBatchResize, onCollectionResize]);
|
|
return /*#__PURE__*/external_window_React_["createElement"](CollectionContext.Provider, {
|
|
value: onResize
|
|
}, children);
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/node_modules/rc-resize-observer/es/SingleObserver/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SingleObserver(props) {
|
|
var children = props.children,
|
|
disabled = props.disabled;
|
|
var elementRef = external_window_React_["useRef"](null);
|
|
var wrapperRef = external_window_React_["useRef"](null);
|
|
var onCollectionResize = external_window_React_["useContext"](CollectionContext); // ============================= Size =============================
|
|
|
|
var sizeRef = external_window_React_["useRef"]({
|
|
width: -1,
|
|
height: -1,
|
|
offsetWidth: -1,
|
|
offsetHeight: -1
|
|
}); // ============================= Ref ==============================
|
|
|
|
var canRef = /*#__PURE__*/external_window_React_["isValidElement"](children) && Object(ref["c" /* supportRef */])(children);
|
|
var originRef = canRef ? children.ref : null;
|
|
var mergedRef = external_window_React_["useMemo"](function () {
|
|
return Object(ref["a" /* composeRef */])(originRef, elementRef);
|
|
}, [originRef, elementRef]); // =========================== Observe ============================
|
|
|
|
var propsRef = external_window_React_["useRef"](props);
|
|
propsRef.current = props; // Handler
|
|
|
|
var onInternalResize = external_window_React_["useCallback"](function (target) {
|
|
var _propsRef$current = propsRef.current,
|
|
onResize = _propsRef$current.onResize,
|
|
data = _propsRef$current.data;
|
|
|
|
var _target$getBoundingCl = target.getBoundingClientRect(),
|
|
width = _target$getBoundingCl.width,
|
|
height = _target$getBoundingCl.height;
|
|
|
|
var offsetWidth = target.offsetWidth,
|
|
offsetHeight = target.offsetHeight;
|
|
/**
|
|
* Resize observer trigger when content size changed.
|
|
* In most case we just care about element size,
|
|
* let's use `boundary` instead of `contentRect` here to avoid shaking.
|
|
*/
|
|
|
|
var fixedWidth = Math.floor(width);
|
|
var fixedHeight = Math.floor(height);
|
|
|
|
if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) {
|
|
var size = {
|
|
width: fixedWidth,
|
|
height: fixedHeight,
|
|
offsetWidth: offsetWidth,
|
|
offsetHeight: offsetHeight
|
|
};
|
|
sizeRef.current = size; // IE is strange, right?
|
|
|
|
var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
|
|
var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
|
|
|
|
var sizeInfo = Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, size), {}, {
|
|
offsetWidth: mergedOffsetWidth,
|
|
offsetHeight: mergedOffsetHeight
|
|
}); // Let collection know what happened
|
|
|
|
|
|
onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(sizeInfo, target, data);
|
|
|
|
if (onResize) {
|
|
// defer the callback but not defer to next frame
|
|
Promise.resolve().then(function () {
|
|
onResize(sizeInfo, target);
|
|
});
|
|
}
|
|
}
|
|
}, []); // Dynamic observe
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
var currentElement = Object(findDOMNode["a" /* default */])(elementRef.current) || Object(findDOMNode["a" /* default */])(wrapperRef.current);
|
|
|
|
if (currentElement && !disabled) {
|
|
observe(currentElement, onInternalResize);
|
|
}
|
|
|
|
return function () {
|
|
return unobserve(currentElement, onInternalResize);
|
|
};
|
|
}, [elementRef.current, disabled]); // ============================ Render ============================
|
|
|
|
return /*#__PURE__*/external_window_React_["createElement"](DomWrapper_DomWrapper, {
|
|
ref: wrapperRef
|
|
}, canRef ? /*#__PURE__*/external_window_React_["cloneElement"](children, {
|
|
ref: mergedRef
|
|
}) : children);
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/node_modules/rc-resize-observer/es/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var INTERNAL_PREFIX_KEY = 'rc-observer-key';
|
|
|
|
function ResizeObserver(props) {
|
|
var children = props.children;
|
|
var childNodes = Object(toArray["a" /* default */])(children);
|
|
|
|
if (false) {}
|
|
|
|
return childNodes.map(function (child, index) {
|
|
var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index);
|
|
return /*#__PURE__*/external_window_React_["createElement"](SingleObserver, Object(esm_extends["a" /* default */])({}, props, {
|
|
key: key
|
|
}), child);
|
|
});
|
|
}
|
|
|
|
ResizeObserver.Collection = Collection;
|
|
/* harmony default export */ var es = (ResizeObserver);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/omit.js
|
|
var omit = __webpack_require__("bT9E");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/es/calculateNodeHeight.js
|
|
// Thanks to https://github.com/andreypopp/react-textarea-autosize/
|
|
|
|
/**
|
|
* calculateNodeHeight(uiTextNode, useCache = false)
|
|
*/
|
|
var HIDDEN_TEXTAREA_STYLE = "\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n";
|
|
var SIZING_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'font-variant', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing', 'word-break'];
|
|
var computedStyleCache = {};
|
|
var hiddenTextarea;
|
|
function calculateNodeStyling(node) {
|
|
var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
var nodeRef = node.getAttribute('id') || node.getAttribute('data-reactid') || node.getAttribute('name');
|
|
|
|
if (useCache && computedStyleCache[nodeRef]) {
|
|
return computedStyleCache[nodeRef];
|
|
}
|
|
|
|
var style = window.getComputedStyle(node);
|
|
var boxSizing = style.getPropertyValue('box-sizing') || style.getPropertyValue('-moz-box-sizing') || style.getPropertyValue('-webkit-box-sizing');
|
|
var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
|
|
var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
|
|
var sizingStyle = SIZING_STYLE.map(function (name) {
|
|
return "".concat(name, ":").concat(style.getPropertyValue(name));
|
|
}).join(';');
|
|
var nodeInfo = {
|
|
sizingStyle: sizingStyle,
|
|
paddingSize: paddingSize,
|
|
borderSize: borderSize,
|
|
boxSizing: boxSizing
|
|
};
|
|
|
|
if (useCache && nodeRef) {
|
|
computedStyleCache[nodeRef] = nodeInfo;
|
|
}
|
|
|
|
return nodeInfo;
|
|
}
|
|
function calculateNodeHeight(uiTextNode) {
|
|
var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
var minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
var maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
|
|
if (!hiddenTextarea) {
|
|
hiddenTextarea = document.createElement('textarea');
|
|
hiddenTextarea.setAttribute('tab-index', '-1');
|
|
hiddenTextarea.setAttribute('aria-hidden', 'true');
|
|
document.body.appendChild(hiddenTextarea);
|
|
} // Fix wrap="off" issue
|
|
// https://github.com/ant-design/ant-design/issues/6577
|
|
|
|
|
|
if (uiTextNode.getAttribute('wrap')) {
|
|
hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap'));
|
|
} else {
|
|
hiddenTextarea.removeAttribute('wrap');
|
|
} // Copy all CSS properties that have an impact on the height of the content in
|
|
// the textbox
|
|
|
|
|
|
var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache),
|
|
paddingSize = _calculateNodeStyling.paddingSize,
|
|
borderSize = _calculateNodeStyling.borderSize,
|
|
boxSizing = _calculateNodeStyling.boxSizing,
|
|
sizingStyle = _calculateNodeStyling.sizingStyle; // Need to have the overflow attribute to hide the scrollbar otherwise
|
|
// text-lines will not calculated properly as the shadow will technically be
|
|
// narrower for content
|
|
|
|
|
|
hiddenTextarea.setAttribute('style', "".concat(sizingStyle, ";").concat(HIDDEN_TEXTAREA_STYLE));
|
|
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';
|
|
var minHeight = Number.MIN_SAFE_INTEGER;
|
|
var maxHeight = Number.MAX_SAFE_INTEGER;
|
|
var height = hiddenTextarea.scrollHeight;
|
|
var overflowY;
|
|
|
|
if (boxSizing === 'border-box') {
|
|
// border-box: add border, since height = content + padding + border
|
|
height += borderSize;
|
|
} else if (boxSizing === 'content-box') {
|
|
// remove padding, since height = content
|
|
height -= paddingSize;
|
|
}
|
|
|
|
if (minRows !== null || maxRows !== null) {
|
|
// measure height of a textarea with a single row
|
|
hiddenTextarea.value = ' ';
|
|
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
|
|
|
if (minRows !== null) {
|
|
minHeight = singleRowHeight * minRows;
|
|
|
|
if (boxSizing === 'border-box') {
|
|
minHeight = minHeight + paddingSize + borderSize;
|
|
}
|
|
|
|
height = Math.max(minHeight, height);
|
|
}
|
|
|
|
if (maxRows !== null) {
|
|
maxHeight = singleRowHeight * maxRows;
|
|
|
|
if (boxSizing === 'border-box') {
|
|
maxHeight = maxHeight + paddingSize + borderSize;
|
|
}
|
|
|
|
overflowY = height > maxHeight ? '' : 'hidden';
|
|
height = Math.min(maxHeight, height);
|
|
}
|
|
}
|
|
|
|
return {
|
|
height: height,
|
|
minHeight: minHeight,
|
|
maxHeight: maxHeight,
|
|
overflowY: overflowY,
|
|
resize: 'none'
|
|
};
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/shallowequal/index.js
|
|
var shallowequal = __webpack_require__("Gytx");
|
|
var shallowequal_default = /*#__PURE__*/__webpack_require__.n(shallowequal);
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/es/ResizableTextArea.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
var RESIZE_STATUS;
|
|
|
|
(function (RESIZE_STATUS) {
|
|
RESIZE_STATUS[RESIZE_STATUS["NONE"] = 0] = "NONE";
|
|
RESIZE_STATUS[RESIZE_STATUS["RESIZING"] = 1] = "RESIZING";
|
|
RESIZE_STATUS[RESIZE_STATUS["RESIZED"] = 2] = "RESIZED";
|
|
})(RESIZE_STATUS || (RESIZE_STATUS = {}));
|
|
|
|
var ResizableTextArea_ResizableTextArea = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(ResizableTextArea, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(ResizableTextArea);
|
|
|
|
function ResizableTextArea(props) {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, ResizableTextArea);
|
|
|
|
_this = _super.call(this, props);
|
|
_this.nextFrameActionId = void 0;
|
|
_this.resizeFrameId = void 0;
|
|
_this.textArea = void 0;
|
|
|
|
_this.saveTextArea = function (textArea) {
|
|
_this.textArea = textArea;
|
|
};
|
|
|
|
_this.handleResize = function (size) {
|
|
var resizeStatus = _this.state.resizeStatus;
|
|
var _this$props = _this.props,
|
|
autoSize = _this$props.autoSize,
|
|
onResize = _this$props.onResize;
|
|
|
|
if (resizeStatus !== RESIZE_STATUS.NONE) {
|
|
return;
|
|
}
|
|
|
|
if (typeof onResize === 'function') {
|
|
onResize(size);
|
|
}
|
|
|
|
if (autoSize) {
|
|
_this.resizeOnNextFrame();
|
|
}
|
|
};
|
|
|
|
_this.resizeOnNextFrame = function () {
|
|
cancelAnimationFrame(_this.nextFrameActionId);
|
|
_this.nextFrameActionId = requestAnimationFrame(_this.resizeTextarea);
|
|
};
|
|
|
|
_this.resizeTextarea = function () {
|
|
var autoSize = _this.props.autoSize;
|
|
|
|
if (!autoSize || !_this.textArea) {
|
|
return;
|
|
}
|
|
|
|
var minRows = autoSize.minRows,
|
|
maxRows = autoSize.maxRows;
|
|
var textareaStyles = calculateNodeHeight(_this.textArea, false, minRows, maxRows);
|
|
|
|
_this.setState({
|
|
textareaStyles: textareaStyles,
|
|
resizeStatus: RESIZE_STATUS.RESIZING
|
|
}, function () {
|
|
cancelAnimationFrame(_this.resizeFrameId);
|
|
_this.resizeFrameId = requestAnimationFrame(function () {
|
|
_this.setState({
|
|
resizeStatus: RESIZE_STATUS.RESIZED
|
|
}, function () {
|
|
_this.resizeFrameId = requestAnimationFrame(function () {
|
|
_this.setState({
|
|
resizeStatus: RESIZE_STATUS.NONE
|
|
});
|
|
|
|
_this.fixFirefoxAutoScroll();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
};
|
|
|
|
_this.renderTextArea = function () {
|
|
var _this$props2 = _this.props,
|
|
_this$props2$prefixCl = _this$props2.prefixCls,
|
|
prefixCls = _this$props2$prefixCl === void 0 ? 'rc-textarea' : _this$props2$prefixCl,
|
|
autoSize = _this$props2.autoSize,
|
|
onResize = _this$props2.onResize,
|
|
className = _this$props2.className,
|
|
disabled = _this$props2.disabled;
|
|
var _this$state = _this.state,
|
|
textareaStyles = _this$state.textareaStyles,
|
|
resizeStatus = _this$state.resizeStatus;
|
|
var otherProps = Object(omit["a" /* default */])(_this.props, ['prefixCls', 'onPressEnter', 'autoSize', 'defaultValue', 'onResize']);
|
|
var cls = classnames_default()(prefixCls, className, Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-disabled"), disabled)); // Fix https://github.com/ant-design/ant-design/issues/6776
|
|
// Make sure it could be reset when using form.getFieldDecorator
|
|
|
|
if ('value' in otherProps) {
|
|
otherProps.value = otherProps.value || '';
|
|
}
|
|
|
|
var style = Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, _this.props.style), textareaStyles), resizeStatus === RESIZE_STATUS.RESIZING ? // React will warning when mix `overflow` & `overflowY`.
|
|
// We need to define this separately.
|
|
{
|
|
overflowX: 'hidden',
|
|
overflowY: 'hidden'
|
|
} : null);
|
|
|
|
return /*#__PURE__*/external_window_React_["createElement"](es, {
|
|
onResize: _this.handleResize,
|
|
disabled: !(autoSize || onResize)
|
|
}, /*#__PURE__*/external_window_React_["createElement"]("textarea", Object(esm_extends["a" /* default */])({}, otherProps, {
|
|
className: cls,
|
|
style: style,
|
|
ref: _this.saveTextArea
|
|
})));
|
|
};
|
|
|
|
_this.state = {
|
|
textareaStyles: {},
|
|
resizeStatus: RESIZE_STATUS.NONE
|
|
};
|
|
return _this;
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(ResizableTextArea, [{
|
|
key: "componentDidUpdate",
|
|
value: function componentDidUpdate(prevProps) {
|
|
// Re-render with the new content or new autoSize property then recalculate the height as required.
|
|
if (prevProps.value !== this.props.value || !shallowequal_default()(prevProps.autoSize, this.props.autoSize)) {
|
|
this.resizeTextarea();
|
|
}
|
|
}
|
|
}, {
|
|
key: "componentWillUnmount",
|
|
value: function componentWillUnmount() {
|
|
cancelAnimationFrame(this.nextFrameActionId);
|
|
cancelAnimationFrame(this.resizeFrameId);
|
|
} // https://github.com/ant-design/ant-design/issues/21870
|
|
|
|
}, {
|
|
key: "fixFirefoxAutoScroll",
|
|
value: function fixFirefoxAutoScroll() {
|
|
try {
|
|
if (document.activeElement === this.textArea) {
|
|
var currentStart = this.textArea.selectionStart;
|
|
var currentEnd = this.textArea.selectionEnd;
|
|
this.textArea.setSelectionRange(currentStart, currentEnd);
|
|
}
|
|
} catch (e) {// Fix error in Chrome:
|
|
// Failed to read the 'selectionStart' property from 'HTMLInputElement'
|
|
// http://stackoverflow.com/q/21177489/3040605
|
|
}
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
return this.renderTextArea();
|
|
}
|
|
}]);
|
|
|
|
return ResizableTextArea;
|
|
}(external_window_React_["Component"]);
|
|
|
|
/* harmony default export */ var es_ResizableTextArea = (ResizableTextArea_ResizableTextArea);
|
|
// CONCATENATED MODULE: ./node_modules/rc-textarea/es/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var es_TextArea = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(TextArea, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(TextArea);
|
|
|
|
function TextArea(props) {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, TextArea);
|
|
|
|
_this = _super.call(this, props);
|
|
_this.resizableTextArea = void 0;
|
|
|
|
_this.focus = function () {
|
|
_this.resizableTextArea.textArea.focus();
|
|
};
|
|
|
|
_this.saveTextArea = function (resizableTextArea) {
|
|
_this.resizableTextArea = resizableTextArea;
|
|
};
|
|
|
|
_this.handleChange = function (e) {
|
|
var onChange = _this.props.onChange;
|
|
|
|
_this.setValue(e.target.value, function () {
|
|
_this.resizableTextArea.resizeTextarea();
|
|
});
|
|
|
|
if (onChange) {
|
|
onChange(e);
|
|
}
|
|
};
|
|
|
|
_this.handleKeyDown = function (e) {
|
|
var _this$props = _this.props,
|
|
onPressEnter = _this$props.onPressEnter,
|
|
onKeyDown = _this$props.onKeyDown;
|
|
|
|
if (e.keyCode === 13 && onPressEnter) {
|
|
onPressEnter(e);
|
|
}
|
|
|
|
if (onKeyDown) {
|
|
onKeyDown(e);
|
|
}
|
|
};
|
|
|
|
var value = typeof props.value === 'undefined' || props.value === null ? props.defaultValue : props.value;
|
|
_this.state = {
|
|
value: value
|
|
};
|
|
return _this;
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(TextArea, [{
|
|
key: "setValue",
|
|
value: function setValue(value, callback) {
|
|
if (!('value' in this.props)) {
|
|
this.setState({
|
|
value: value
|
|
}, callback);
|
|
}
|
|
}
|
|
}, {
|
|
key: "blur",
|
|
value: function blur() {
|
|
this.resizableTextArea.textArea.blur();
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
return /*#__PURE__*/external_window_React_["createElement"](es_ResizableTextArea, Object(esm_extends["a" /* default */])({}, this.props, {
|
|
value: this.state.value,
|
|
onKeyDown: this.handleKeyDown,
|
|
onChange: this.handleChange,
|
|
ref: this.saveTextArea
|
|
}));
|
|
}
|
|
}], [{
|
|
key: "getDerivedStateFromProps",
|
|
value: function getDerivedStateFromProps(nextProps) {
|
|
if ('value' in nextProps) {
|
|
return {
|
|
value: nextProps.value
|
|
};
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}]);
|
|
|
|
return TextArea;
|
|
}(external_window_React_["Component"]);
|
|
|
|
|
|
/* harmony default export */ var rc_textarea_es = __webpack_exports__["default"] = (es_TextArea);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "ZpRC":
|
|
/*!*************************************************************************!*\
|
|
!*** ./node_modules/scroll-into-view-if-needed/es/index.js + 1 modules ***!
|
|
\*************************************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// CONCATENATED MODULE: ./node_modules/compute-scroll-into-view/dist/index.module.js
|
|
function t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}/* harmony default export */ var index_module = (function(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p)}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)))}C.push({el:k,top:F,left:G})}return C});
|
|
//# sourceMappingURL=index.module.js.map
|
|
|
|
// CONCATENATED MODULE: ./node_modules/scroll-into-view-if-needed/es/index.js
|
|
|
|
|
|
function isOptionsObject(options) {
|
|
return options === Object(options) && Object.keys(options).length !== 0;
|
|
}
|
|
|
|
function defaultBehavior(actions, behavior) {
|
|
if (behavior === void 0) {
|
|
behavior = 'auto';
|
|
}
|
|
|
|
var canSmoothScroll = ('scrollBehavior' in document.body.style);
|
|
actions.forEach(function (_ref) {
|
|
var el = _ref.el,
|
|
top = _ref.top,
|
|
left = _ref.left;
|
|
|
|
if (el.scroll && canSmoothScroll) {
|
|
el.scroll({
|
|
top: top,
|
|
left: left,
|
|
behavior: behavior
|
|
});
|
|
} else {
|
|
el.scrollTop = top;
|
|
el.scrollLeft = left;
|
|
}
|
|
});
|
|
}
|
|
|
|
function getOptions(options) {
|
|
if (options === false) {
|
|
return {
|
|
block: 'end',
|
|
inline: 'nearest'
|
|
};
|
|
}
|
|
|
|
if (isOptionsObject(options)) {
|
|
return options;
|
|
}
|
|
|
|
return {
|
|
block: 'start',
|
|
inline: 'nearest'
|
|
};
|
|
}
|
|
|
|
function scrollIntoView(target, options) {
|
|
var targetIsDetached = !target.ownerDocument.documentElement.contains(target);
|
|
|
|
if (isOptionsObject(options) && typeof options.behavior === 'function') {
|
|
return options.behavior(targetIsDetached ? [] : index_module(target, options));
|
|
}
|
|
|
|
if (targetIsDetached) {
|
|
return;
|
|
}
|
|
|
|
var computeOptions = getOptions(options);
|
|
return defaultBehavior(index_module(target, computeOptions), computeOptions.behavior);
|
|
}
|
|
|
|
/* harmony default export */ var es = __webpack_exports__["a"] = (scrollIntoView);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "Zss7":
|
|
/*!**********************************************!*\
|
|
!*** ./node_modules/tinycolor2/tinycolor.js ***!
|
|
\**********************************************/
|
|
/*! no static exports found */
|
|
/*! exports used: default */
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2
|
|
// https://github.com/bgrins/TinyColor
|
|
// Brian Grinstead, MIT License
|
|
|
|
(function(Math) {
|
|
|
|
var trimLeft = /^\s+/,
|
|
trimRight = /\s+$/,
|
|
tinyCounter = 0,
|
|
mathRound = Math.round,
|
|
mathMin = Math.min,
|
|
mathMax = Math.max,
|
|
mathRandom = Math.random;
|
|
|
|
function tinycolor (color, opts) {
|
|
|
|
color = (color) ? color : '';
|
|
opts = opts || { };
|
|
|
|
// If input is already a tinycolor, return itself
|
|
if (color instanceof tinycolor) {
|
|
return color;
|
|
}
|
|
// If we are called as a function, call using new instead
|
|
if (!(this instanceof tinycolor)) {
|
|
return new tinycolor(color, opts);
|
|
}
|
|
|
|
var rgb = inputToRGB(color);
|
|
this._originalInput = color,
|
|
this._r = rgb.r,
|
|
this._g = rgb.g,
|
|
this._b = rgb.b,
|
|
this._a = rgb.a,
|
|
this._roundA = mathRound(100*this._a) / 100,
|
|
this._format = opts.format || rgb.format;
|
|
this._gradientType = opts.gradientType;
|
|
|
|
// Don't let the range of [0,255] come back in [0,1].
|
|
// Potentially lose a little bit of precision here, but will fix issues where
|
|
// .5 gets interpreted as half of the total, instead of half of 1
|
|
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
if (this._r < 1) { this._r = mathRound(this._r); }
|
|
if (this._g < 1) { this._g = mathRound(this._g); }
|
|
if (this._b < 1) { this._b = mathRound(this._b); }
|
|
|
|
this._ok = rgb.ok;
|
|
this._tc_id = tinyCounter++;
|
|
}
|
|
|
|
tinycolor.prototype = {
|
|
isDark: function() {
|
|
return this.getBrightness() < 128;
|
|
},
|
|
isLight: function() {
|
|
return !this.isDark();
|
|
},
|
|
isValid: function() {
|
|
return this._ok;
|
|
},
|
|
getOriginalInput: function() {
|
|
return this._originalInput;
|
|
},
|
|
getFormat: function() {
|
|
return this._format;
|
|
},
|
|
getAlpha: function() {
|
|
return this._a;
|
|
},
|
|
getBrightness: function() {
|
|
//http://www.w3.org/TR/AERT#color-contrast
|
|
var rgb = this.toRgb();
|
|
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
},
|
|
getLuminance: function() {
|
|
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
var rgb = this.toRgb();
|
|
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
RsRGB = rgb.r/255;
|
|
GsRGB = rgb.g/255;
|
|
BsRGB = rgb.b/255;
|
|
|
|
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
|
|
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
|
|
if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
|
|
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
|
|
},
|
|
setAlpha: function(value) {
|
|
this._a = boundAlpha(value);
|
|
this._roundA = mathRound(100*this._a) / 100;
|
|
return this;
|
|
},
|
|
toHsv: function() {
|
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
|
},
|
|
toHsvString: function() {
|
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
|
|
return (this._a == 1) ?
|
|
"hsv(" + h + ", " + s + "%, " + v + "%)" :
|
|
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
|
|
},
|
|
toHsl: function() {
|
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
|
},
|
|
toHslString: function() {
|
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
|
|
return (this._a == 1) ?
|
|
"hsl(" + h + ", " + s + "%, " + l + "%)" :
|
|
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
|
|
},
|
|
toHex: function(allow3Char) {
|
|
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
},
|
|
toHexString: function(allow3Char) {
|
|
return '#' + this.toHex(allow3Char);
|
|
},
|
|
toHex8: function(allow4Char) {
|
|
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
},
|
|
toHex8String: function(allow4Char) {
|
|
return '#' + this.toHex8(allow4Char);
|
|
},
|
|
toRgb: function() {
|
|
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
|
|
},
|
|
toRgbString: function() {
|
|
return (this._a == 1) ?
|
|
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
|
|
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
|
|
},
|
|
toPercentageRgb: function() {
|
|
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
|
|
},
|
|
toPercentageRgbString: function() {
|
|
return (this._a == 1) ?
|
|
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
|
|
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
},
|
|
toName: function() {
|
|
if (this._a === 0) {
|
|
return "transparent";
|
|
}
|
|
|
|
if (this._a < 1) {
|
|
return false;
|
|
}
|
|
|
|
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
},
|
|
toFilter: function(secondColor) {
|
|
var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
var secondHex8String = hex8String;
|
|
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
|
|
if (secondColor) {
|
|
var s = tinycolor(secondColor);
|
|
secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
}
|
|
|
|
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
|
|
},
|
|
toString: function(format) {
|
|
var formatSet = !!format;
|
|
format = format || this._format;
|
|
|
|
var formattedString = false;
|
|
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
|
|
if (needsAlphaFormat) {
|
|
// Special case for "transparent", all other non-alpha formats
|
|
// will return rgba when there is transparency.
|
|
if (format === "name" && this._a === 0) {
|
|
return this.toName();
|
|
}
|
|
return this.toRgbString();
|
|
}
|
|
if (format === "rgb") {
|
|
formattedString = this.toRgbString();
|
|
}
|
|
if (format === "prgb") {
|
|
formattedString = this.toPercentageRgbString();
|
|
}
|
|
if (format === "hex" || format === "hex6") {
|
|
formattedString = this.toHexString();
|
|
}
|
|
if (format === "hex3") {
|
|
formattedString = this.toHexString(true);
|
|
}
|
|
if (format === "hex4") {
|
|
formattedString = this.toHex8String(true);
|
|
}
|
|
if (format === "hex8") {
|
|
formattedString = this.toHex8String();
|
|
}
|
|
if (format === "name") {
|
|
formattedString = this.toName();
|
|
}
|
|
if (format === "hsl") {
|
|
formattedString = this.toHslString();
|
|
}
|
|
if (format === "hsv") {
|
|
formattedString = this.toHsvString();
|
|
}
|
|
|
|
return formattedString || this.toHexString();
|
|
},
|
|
clone: function() {
|
|
return tinycolor(this.toString());
|
|
},
|
|
|
|
_applyModification: function(fn, args) {
|
|
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
this._r = color._r;
|
|
this._g = color._g;
|
|
this._b = color._b;
|
|
this.setAlpha(color._a);
|
|
return this;
|
|
},
|
|
lighten: function() {
|
|
return this._applyModification(lighten, arguments);
|
|
},
|
|
brighten: function() {
|
|
return this._applyModification(brighten, arguments);
|
|
},
|
|
darken: function() {
|
|
return this._applyModification(darken, arguments);
|
|
},
|
|
desaturate: function() {
|
|
return this._applyModification(desaturate, arguments);
|
|
},
|
|
saturate: function() {
|
|
return this._applyModification(saturate, arguments);
|
|
},
|
|
greyscale: function() {
|
|
return this._applyModification(greyscale, arguments);
|
|
},
|
|
spin: function() {
|
|
return this._applyModification(spin, arguments);
|
|
},
|
|
|
|
_applyCombination: function(fn, args) {
|
|
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
},
|
|
analogous: function() {
|
|
return this._applyCombination(analogous, arguments);
|
|
},
|
|
complement: function() {
|
|
return this._applyCombination(complement, arguments);
|
|
},
|
|
monochromatic: function() {
|
|
return this._applyCombination(monochromatic, arguments);
|
|
},
|
|
splitcomplement: function() {
|
|
return this._applyCombination(splitcomplement, arguments);
|
|
},
|
|
triad: function() {
|
|
return this._applyCombination(triad, arguments);
|
|
},
|
|
tetrad: function() {
|
|
return this._applyCombination(tetrad, arguments);
|
|
}
|
|
};
|
|
|
|
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
tinycolor.fromRatio = function(color, opts) {
|
|
if (typeof color == "object") {
|
|
var newColor = {};
|
|
for (var i in color) {
|
|
if (color.hasOwnProperty(i)) {
|
|
if (i === "a") {
|
|
newColor[i] = color[i];
|
|
}
|
|
else {
|
|
newColor[i] = convertToPercentage(color[i]);
|
|
}
|
|
}
|
|
}
|
|
color = newColor;
|
|
}
|
|
|
|
return tinycolor(color, opts);
|
|
};
|
|
|
|
// Given a string or object, convert that input to RGB
|
|
// Possible string inputs:
|
|
//
|
|
// "red"
|
|
// "#f00" or "f00"
|
|
// "#ff0000" or "ff0000"
|
|
// "#ff000000" or "ff000000"
|
|
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
//
|
|
function inputToRGB(color) {
|
|
|
|
var rgb = { r: 0, g: 0, b: 0 };
|
|
var a = 1;
|
|
var s = null;
|
|
var v = null;
|
|
var l = null;
|
|
var ok = false;
|
|
var format = false;
|
|
|
|
if (typeof color == "string") {
|
|
color = stringInputToObject(color);
|
|
}
|
|
|
|
if (typeof color == "object") {
|
|
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
ok = true;
|
|
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
}
|
|
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
s = convertToPercentage(color.s);
|
|
v = convertToPercentage(color.v);
|
|
rgb = hsvToRgb(color.h, s, v);
|
|
ok = true;
|
|
format = "hsv";
|
|
}
|
|
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
s = convertToPercentage(color.s);
|
|
l = convertToPercentage(color.l);
|
|
rgb = hslToRgb(color.h, s, l);
|
|
ok = true;
|
|
format = "hsl";
|
|
}
|
|
|
|
if (color.hasOwnProperty("a")) {
|
|
a = color.a;
|
|
}
|
|
}
|
|
|
|
a = boundAlpha(a);
|
|
|
|
return {
|
|
ok: ok,
|
|
format: color.format || format,
|
|
r: mathMin(255, mathMax(rgb.r, 0)),
|
|
g: mathMin(255, mathMax(rgb.g, 0)),
|
|
b: mathMin(255, mathMax(rgb.b, 0)),
|
|
a: a
|
|
};
|
|
}
|
|
|
|
|
|
// Conversion Functions
|
|
// --------------------
|
|
|
|
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
|
|
// `rgbToRgb`
|
|
// Handle bounds / percentage checking to conform to CSS color spec
|
|
// <http://www.w3.org/TR/css3-color/>
|
|
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
// *Returns:* { r, g, b } in [0, 255]
|
|
function rgbToRgb(r, g, b){
|
|
return {
|
|
r: bound01(r, 255) * 255,
|
|
g: bound01(g, 255) * 255,
|
|
b: bound01(b, 255) * 255
|
|
};
|
|
}
|
|
|
|
// `rgbToHsl`
|
|
// Converts an RGB color value to HSL.
|
|
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
// *Returns:* { h, s, l } in [0,1]
|
|
function rgbToHsl(r, g, b) {
|
|
|
|
r = bound01(r, 255);
|
|
g = bound01(g, 255);
|
|
b = bound01(b, 255);
|
|
|
|
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
var h, s, l = (max + min) / 2;
|
|
|
|
if(max == min) {
|
|
h = s = 0; // achromatic
|
|
}
|
|
else {
|
|
var d = max - min;
|
|
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
switch(max) {
|
|
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
case g: h = (b - r) / d + 2; break;
|
|
case b: h = (r - g) / d + 4; break;
|
|
}
|
|
|
|
h /= 6;
|
|
}
|
|
|
|
return { h: h, s: s, l: l };
|
|
}
|
|
|
|
// `hslToRgb`
|
|
// Converts an HSL color value to RGB.
|
|
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
// *Returns:* { r, g, b } in the set [0, 255]
|
|
function hslToRgb(h, s, l) {
|
|
var r, g, b;
|
|
|
|
h = bound01(h, 360);
|
|
s = bound01(s, 100);
|
|
l = bound01(l, 100);
|
|
|
|
function hue2rgb(p, q, t) {
|
|
if(t < 0) t += 1;
|
|
if(t > 1) t -= 1;
|
|
if(t < 1/6) return p + (q - p) * 6 * t;
|
|
if(t < 1/2) return q;
|
|
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
|
return p;
|
|
}
|
|
|
|
if(s === 0) {
|
|
r = g = b = l; // achromatic
|
|
}
|
|
else {
|
|
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
var p = 2 * l - q;
|
|
r = hue2rgb(p, q, h + 1/3);
|
|
g = hue2rgb(p, q, h);
|
|
b = hue2rgb(p, q, h - 1/3);
|
|
}
|
|
|
|
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
}
|
|
|
|
// `rgbToHsv`
|
|
// Converts an RGB color value to HSV
|
|
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
// *Returns:* { h, s, v } in [0,1]
|
|
function rgbToHsv(r, g, b) {
|
|
|
|
r = bound01(r, 255);
|
|
g = bound01(g, 255);
|
|
b = bound01(b, 255);
|
|
|
|
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
var h, s, v = max;
|
|
|
|
var d = max - min;
|
|
s = max === 0 ? 0 : d / max;
|
|
|
|
if(max == min) {
|
|
h = 0; // achromatic
|
|
}
|
|
else {
|
|
switch(max) {
|
|
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
case g: h = (b - r) / d + 2; break;
|
|
case b: h = (r - g) / d + 4; break;
|
|
}
|
|
h /= 6;
|
|
}
|
|
return { h: h, s: s, v: v };
|
|
}
|
|
|
|
// `hsvToRgb`
|
|
// Converts an HSV color value to RGB.
|
|
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
// *Returns:* { r, g, b } in the set [0, 255]
|
|
function hsvToRgb(h, s, v) {
|
|
|
|
h = bound01(h, 360) * 6;
|
|
s = bound01(s, 100);
|
|
v = bound01(v, 100);
|
|
|
|
var i = Math.floor(h),
|
|
f = h - i,
|
|
p = v * (1 - s),
|
|
q = v * (1 - f * s),
|
|
t = v * (1 - (1 - f) * s),
|
|
mod = i % 6,
|
|
r = [v, q, p, p, t, v][mod],
|
|
g = [t, v, v, q, p, p][mod],
|
|
b = [p, p, t, v, v, q][mod];
|
|
|
|
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
}
|
|
|
|
// `rgbToHex`
|
|
// Converts an RGB color to hex
|
|
// Assumes r, g, and b are contained in the set [0, 255]
|
|
// Returns a 3 or 6 character hex
|
|
function rgbToHex(r, g, b, allow3Char) {
|
|
|
|
var hex = [
|
|
pad2(mathRound(r).toString(16)),
|
|
pad2(mathRound(g).toString(16)),
|
|
pad2(mathRound(b).toString(16))
|
|
];
|
|
|
|
// Return a 3 character hex if possible
|
|
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
}
|
|
|
|
return hex.join("");
|
|
}
|
|
|
|
// `rgbaToHex`
|
|
// Converts an RGBA color plus alpha transparency to hex
|
|
// Assumes r, g, b are contained in the set [0, 255] and
|
|
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
|
|
var hex = [
|
|
pad2(mathRound(r).toString(16)),
|
|
pad2(mathRound(g).toString(16)),
|
|
pad2(mathRound(b).toString(16)),
|
|
pad2(convertDecimalToHex(a))
|
|
];
|
|
|
|
// Return a 4 character hex if possible
|
|
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
}
|
|
|
|
return hex.join("");
|
|
}
|
|
|
|
// `rgbaToArgbHex`
|
|
// Converts an RGBA color to an ARGB Hex8 string
|
|
// Rarely used, but required for "toFilter()"
|
|
function rgbaToArgbHex(r, g, b, a) {
|
|
|
|
var hex = [
|
|
pad2(convertDecimalToHex(a)),
|
|
pad2(mathRound(r).toString(16)),
|
|
pad2(mathRound(g).toString(16)),
|
|
pad2(mathRound(b).toString(16))
|
|
];
|
|
|
|
return hex.join("");
|
|
}
|
|
|
|
// `equals`
|
|
// Can be called with any tinycolor input
|
|
tinycolor.equals = function (color1, color2) {
|
|
if (!color1 || !color2) { return false; }
|
|
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
};
|
|
|
|
tinycolor.random = function() {
|
|
return tinycolor.fromRatio({
|
|
r: mathRandom(),
|
|
g: mathRandom(),
|
|
b: mathRandom()
|
|
});
|
|
};
|
|
|
|
|
|
// Modification Functions
|
|
// ----------------------
|
|
// Thanks to less.js for some of the basics here
|
|
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
|
|
function desaturate(color, amount) {
|
|
amount = (amount === 0) ? 0 : (amount || 10);
|
|
var hsl = tinycolor(color).toHsl();
|
|
hsl.s -= amount / 100;
|
|
hsl.s = clamp01(hsl.s);
|
|
return tinycolor(hsl);
|
|
}
|
|
|
|
function saturate(color, amount) {
|
|
amount = (amount === 0) ? 0 : (amount || 10);
|
|
var hsl = tinycolor(color).toHsl();
|
|
hsl.s += amount / 100;
|
|
hsl.s = clamp01(hsl.s);
|
|
return tinycolor(hsl);
|
|
}
|
|
|
|
function greyscale(color) {
|
|
return tinycolor(color).desaturate(100);
|
|
}
|
|
|
|
function lighten (color, amount) {
|
|
amount = (amount === 0) ? 0 : (amount || 10);
|
|
var hsl = tinycolor(color).toHsl();
|
|
hsl.l += amount / 100;
|
|
hsl.l = clamp01(hsl.l);
|
|
return tinycolor(hsl);
|
|
}
|
|
|
|
function brighten(color, amount) {
|
|
amount = (amount === 0) ? 0 : (amount || 10);
|
|
var rgb = tinycolor(color).toRgb();
|
|
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
|
|
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
|
|
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
|
|
return tinycolor(rgb);
|
|
}
|
|
|
|
function darken (color, amount) {
|
|
amount = (amount === 0) ? 0 : (amount || 10);
|
|
var hsl = tinycolor(color).toHsl();
|
|
hsl.l -= amount / 100;
|
|
hsl.l = clamp01(hsl.l);
|
|
return tinycolor(hsl);
|
|
}
|
|
|
|
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
// Values outside of this range will be wrapped into this range.
|
|
function spin(color, amount) {
|
|
var hsl = tinycolor(color).toHsl();
|
|
var hue = (hsl.h + amount) % 360;
|
|
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
return tinycolor(hsl);
|
|
}
|
|
|
|
// Combination Functions
|
|
// ---------------------
|
|
// Thanks to jQuery xColor for some of the ideas behind these
|
|
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
|
|
function complement(color) {
|
|
var hsl = tinycolor(color).toHsl();
|
|
hsl.h = (hsl.h + 180) % 360;
|
|
return tinycolor(hsl);
|
|
}
|
|
|
|
function triad(color) {
|
|
var hsl = tinycolor(color).toHsl();
|
|
var h = hsl.h;
|
|
return [
|
|
tinycolor(color),
|
|
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
|
|
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
|
|
];
|
|
}
|
|
|
|
function tetrad(color) {
|
|
var hsl = tinycolor(color).toHsl();
|
|
var h = hsl.h;
|
|
return [
|
|
tinycolor(color),
|
|
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
|
|
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
|
|
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
|
|
];
|
|
}
|
|
|
|
function splitcomplement(color) {
|
|
var hsl = tinycolor(color).toHsl();
|
|
var h = hsl.h;
|
|
return [
|
|
tinycolor(color),
|
|
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
|
|
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
|
|
];
|
|
}
|
|
|
|
function analogous(color, results, slices) {
|
|
results = results || 6;
|
|
slices = slices || 30;
|
|
|
|
var hsl = tinycolor(color).toHsl();
|
|
var part = 360 / slices;
|
|
var ret = [tinycolor(color)];
|
|
|
|
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
|
|
hsl.h = (hsl.h + part) % 360;
|
|
ret.push(tinycolor(hsl));
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
function monochromatic(color, results) {
|
|
results = results || 6;
|
|
var hsv = tinycolor(color).toHsv();
|
|
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
var ret = [];
|
|
var modification = 1 / results;
|
|
|
|
while (results--) {
|
|
ret.push(tinycolor({ h: h, s: s, v: v}));
|
|
v = (v + modification) % 1;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
// Utility Functions
|
|
// ---------------------
|
|
|
|
tinycolor.mix = function(color1, color2, amount) {
|
|
amount = (amount === 0) ? 0 : (amount || 50);
|
|
|
|
var rgb1 = tinycolor(color1).toRgb();
|
|
var rgb2 = tinycolor(color2).toRgb();
|
|
|
|
var p = amount / 100;
|
|
|
|
var rgba = {
|
|
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
|
|
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
|
|
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
|
|
a: ((rgb2.a - rgb1.a) * p) + rgb1.a
|
|
};
|
|
|
|
return tinycolor(rgba);
|
|
};
|
|
|
|
|
|
// Readability Functions
|
|
// ---------------------
|
|
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
|
|
// `contrast`
|
|
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
tinycolor.readability = function(color1, color2) {
|
|
var c1 = tinycolor(color1);
|
|
var c2 = tinycolor(color2);
|
|
return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
|
|
};
|
|
|
|
// `isReadable`
|
|
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
// The third argument is an optional Object.
|
|
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
|
|
// *Example*
|
|
// tinycolor.isReadable("#000", "#111") => false
|
|
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
var readability = tinycolor.readability(color1, color2);
|
|
var wcag2Parms, out;
|
|
|
|
out = false;
|
|
|
|
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
case "AAsmall":
|
|
case "AAAlarge":
|
|
out = readability >= 4.5;
|
|
break;
|
|
case "AAlarge":
|
|
out = readability >= 3;
|
|
break;
|
|
case "AAAsmall":
|
|
out = readability >= 7;
|
|
break;
|
|
}
|
|
return out;
|
|
|
|
};
|
|
|
|
// `mostReadable`
|
|
// Given a base color and a list of possible foreground or background
|
|
// colors for that base, returns the most readable color.
|
|
// Optionally returns Black or White if the most readable color is unreadable.
|
|
// *Example*
|
|
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
var bestColor = null;
|
|
var bestScore = 0;
|
|
var readability;
|
|
var includeFallbackColors, level, size ;
|
|
args = args || {};
|
|
includeFallbackColors = args.includeFallbackColors ;
|
|
level = args.level;
|
|
size = args.size;
|
|
|
|
for (var i= 0; i < colorList.length ; i++) {
|
|
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
if (readability > bestScore) {
|
|
bestScore = readability;
|
|
bestColor = tinycolor(colorList[i]);
|
|
}
|
|
}
|
|
|
|
if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
|
|
return bestColor;
|
|
}
|
|
else {
|
|
args.includeFallbackColors=false;
|
|
return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
|
|
}
|
|
};
|
|
|
|
|
|
// Big List of Colors
|
|
// ------------------
|
|
// <http://www.w3.org/TR/css3-color/#svg-color>
|
|
var names = tinycolor.names = {
|
|
aliceblue: "f0f8ff",
|
|
antiquewhite: "faebd7",
|
|
aqua: "0ff",
|
|
aquamarine: "7fffd4",
|
|
azure: "f0ffff",
|
|
beige: "f5f5dc",
|
|
bisque: "ffe4c4",
|
|
black: "000",
|
|
blanchedalmond: "ffebcd",
|
|
blue: "00f",
|
|
blueviolet: "8a2be2",
|
|
brown: "a52a2a",
|
|
burlywood: "deb887",
|
|
burntsienna: "ea7e5d",
|
|
cadetblue: "5f9ea0",
|
|
chartreuse: "7fff00",
|
|
chocolate: "d2691e",
|
|
coral: "ff7f50",
|
|
cornflowerblue: "6495ed",
|
|
cornsilk: "fff8dc",
|
|
crimson: "dc143c",
|
|
cyan: "0ff",
|
|
darkblue: "00008b",
|
|
darkcyan: "008b8b",
|
|
darkgoldenrod: "b8860b",
|
|
darkgray: "a9a9a9",
|
|
darkgreen: "006400",
|
|
darkgrey: "a9a9a9",
|
|
darkkhaki: "bdb76b",
|
|
darkmagenta: "8b008b",
|
|
darkolivegreen: "556b2f",
|
|
darkorange: "ff8c00",
|
|
darkorchid: "9932cc",
|
|
darkred: "8b0000",
|
|
darksalmon: "e9967a",
|
|
darkseagreen: "8fbc8f",
|
|
darkslateblue: "483d8b",
|
|
darkslategray: "2f4f4f",
|
|
darkslategrey: "2f4f4f",
|
|
darkturquoise: "00ced1",
|
|
darkviolet: "9400d3",
|
|
deeppink: "ff1493",
|
|
deepskyblue: "00bfff",
|
|
dimgray: "696969",
|
|
dimgrey: "696969",
|
|
dodgerblue: "1e90ff",
|
|
firebrick: "b22222",
|
|
floralwhite: "fffaf0",
|
|
forestgreen: "228b22",
|
|
fuchsia: "f0f",
|
|
gainsboro: "dcdcdc",
|
|
ghostwhite: "f8f8ff",
|
|
gold: "ffd700",
|
|
goldenrod: "daa520",
|
|
gray: "808080",
|
|
green: "008000",
|
|
greenyellow: "adff2f",
|
|
grey: "808080",
|
|
honeydew: "f0fff0",
|
|
hotpink: "ff69b4",
|
|
indianred: "cd5c5c",
|
|
indigo: "4b0082",
|
|
ivory: "fffff0",
|
|
khaki: "f0e68c",
|
|
lavender: "e6e6fa",
|
|
lavenderblush: "fff0f5",
|
|
lawngreen: "7cfc00",
|
|
lemonchiffon: "fffacd",
|
|
lightblue: "add8e6",
|
|
lightcoral: "f08080",
|
|
lightcyan: "e0ffff",
|
|
lightgoldenrodyellow: "fafad2",
|
|
lightgray: "d3d3d3",
|
|
lightgreen: "90ee90",
|
|
lightgrey: "d3d3d3",
|
|
lightpink: "ffb6c1",
|
|
lightsalmon: "ffa07a",
|
|
lightseagreen: "20b2aa",
|
|
lightskyblue: "87cefa",
|
|
lightslategray: "789",
|
|
lightslategrey: "789",
|
|
lightsteelblue: "b0c4de",
|
|
lightyellow: "ffffe0",
|
|
lime: "0f0",
|
|
limegreen: "32cd32",
|
|
linen: "faf0e6",
|
|
magenta: "f0f",
|
|
maroon: "800000",
|
|
mediumaquamarine: "66cdaa",
|
|
mediumblue: "0000cd",
|
|
mediumorchid: "ba55d3",
|
|
mediumpurple: "9370db",
|
|
mediumseagreen: "3cb371",
|
|
mediumslateblue: "7b68ee",
|
|
mediumspringgreen: "00fa9a",
|
|
mediumturquoise: "48d1cc",
|
|
mediumvioletred: "c71585",
|
|
midnightblue: "191970",
|
|
mintcream: "f5fffa",
|
|
mistyrose: "ffe4e1",
|
|
moccasin: "ffe4b5",
|
|
navajowhite: "ffdead",
|
|
navy: "000080",
|
|
oldlace: "fdf5e6",
|
|
olive: "808000",
|
|
olivedrab: "6b8e23",
|
|
orange: "ffa500",
|
|
orangered: "ff4500",
|
|
orchid: "da70d6",
|
|
palegoldenrod: "eee8aa",
|
|
palegreen: "98fb98",
|
|
paleturquoise: "afeeee",
|
|
palevioletred: "db7093",
|
|
papayawhip: "ffefd5",
|
|
peachpuff: "ffdab9",
|
|
peru: "cd853f",
|
|
pink: "ffc0cb",
|
|
plum: "dda0dd",
|
|
powderblue: "b0e0e6",
|
|
purple: "800080",
|
|
rebeccapurple: "663399",
|
|
red: "f00",
|
|
rosybrown: "bc8f8f",
|
|
royalblue: "4169e1",
|
|
saddlebrown: "8b4513",
|
|
salmon: "fa8072",
|
|
sandybrown: "f4a460",
|
|
seagreen: "2e8b57",
|
|
seashell: "fff5ee",
|
|
sienna: "a0522d",
|
|
silver: "c0c0c0",
|
|
skyblue: "87ceeb",
|
|
slateblue: "6a5acd",
|
|
slategray: "708090",
|
|
slategrey: "708090",
|
|
snow: "fffafa",
|
|
springgreen: "00ff7f",
|
|
steelblue: "4682b4",
|
|
tan: "d2b48c",
|
|
teal: "008080",
|
|
thistle: "d8bfd8",
|
|
tomato: "ff6347",
|
|
turquoise: "40e0d0",
|
|
violet: "ee82ee",
|
|
wheat: "f5deb3",
|
|
white: "fff",
|
|
whitesmoke: "f5f5f5",
|
|
yellow: "ff0",
|
|
yellowgreen: "9acd32"
|
|
};
|
|
|
|
// Make it easy to access colors via `hexNames[hex]`
|
|
var hexNames = tinycolor.hexNames = flip(names);
|
|
|
|
|
|
// Utilities
|
|
// ---------
|
|
|
|
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
function flip(o) {
|
|
var flipped = { };
|
|
for (var i in o) {
|
|
if (o.hasOwnProperty(i)) {
|
|
flipped[o[i]] = i;
|
|
}
|
|
}
|
|
return flipped;
|
|
}
|
|
|
|
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
function boundAlpha(a) {
|
|
a = parseFloat(a);
|
|
|
|
if (isNaN(a) || a < 0 || a > 1) {
|
|
a = 1;
|
|
}
|
|
|
|
return a;
|
|
}
|
|
|
|
// Take input from [0, n] and return it as [0, 1]
|
|
function bound01(n, max) {
|
|
if (isOnePointZero(n)) { n = "100%"; }
|
|
|
|
var processPercent = isPercentage(n);
|
|
n = mathMin(max, mathMax(0, parseFloat(n)));
|
|
|
|
// Automatically convert percentage into number
|
|
if (processPercent) {
|
|
n = parseInt(n * max, 10) / 100;
|
|
}
|
|
|
|
// Handle floating point rounding errors
|
|
if ((Math.abs(n - max) < 0.000001)) {
|
|
return 1;
|
|
}
|
|
|
|
// Convert into [0, 1] range if it isn't already
|
|
return (n % max) / parseFloat(max);
|
|
}
|
|
|
|
// Force a number between 0 and 1
|
|
function clamp01(val) {
|
|
return mathMin(1, mathMax(0, val));
|
|
}
|
|
|
|
// Parse a base-16 hex value into a base-10 integer
|
|
function parseIntFromHex(val) {
|
|
return parseInt(val, 16);
|
|
}
|
|
|
|
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
function isOnePointZero(n) {
|
|
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
|
|
}
|
|
|
|
// Check to see if string passed in is a percentage
|
|
function isPercentage(n) {
|
|
return typeof n === "string" && n.indexOf('%') != -1;
|
|
}
|
|
|
|
// Force a hex value to have 2 characters
|
|
function pad2(c) {
|
|
return c.length == 1 ? '0' + c : '' + c;
|
|
}
|
|
|
|
// Replace a decimal with it's percentage value
|
|
function convertToPercentage(n) {
|
|
if (n <= 1) {
|
|
n = (n * 100) + "%";
|
|
}
|
|
|
|
return n;
|
|
}
|
|
|
|
// Converts a decimal to a hex value
|
|
function convertDecimalToHex(d) {
|
|
return Math.round(parseFloat(d) * 255).toString(16);
|
|
}
|
|
// Converts a hex value to a decimal
|
|
function convertHexToDecimal(h) {
|
|
return (parseIntFromHex(h) / 255);
|
|
}
|
|
|
|
var matchers = (function() {
|
|
|
|
// <http://www.w3.org/TR/css3-values/#integers>
|
|
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
|
|
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
|
|
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
|
|
// Actual matching.
|
|
// Parentheses and commas are optional, but not required.
|
|
// Whitespace can take the place of commas or opening paren
|
|
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
|
|
return {
|
|
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
};
|
|
})();
|
|
|
|
// `isValidCSSUnit`
|
|
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
// (see `matchers` above for definition).
|
|
function isValidCSSUnit(color) {
|
|
return !!matchers.CSS_UNIT.exec(color);
|
|
}
|
|
|
|
// `stringInputToObject`
|
|
// Permissive string parsing. Take in a number of formats, and output an object
|
|
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
function stringInputToObject(color) {
|
|
|
|
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
|
|
var named = false;
|
|
if (names[color]) {
|
|
color = names[color];
|
|
named = true;
|
|
}
|
|
else if (color == 'transparent') {
|
|
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
}
|
|
|
|
// Try to match string input using regular expressions.
|
|
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
// Just return an object and let the conversion functions handle that.
|
|
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
var match;
|
|
if ((match = matchers.rgb.exec(color))) {
|
|
return { r: match[1], g: match[2], b: match[3] };
|
|
}
|
|
if ((match = matchers.rgba.exec(color))) {
|
|
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
}
|
|
if ((match = matchers.hsl.exec(color))) {
|
|
return { h: match[1], s: match[2], l: match[3] };
|
|
}
|
|
if ((match = matchers.hsla.exec(color))) {
|
|
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
}
|
|
if ((match = matchers.hsv.exec(color))) {
|
|
return { h: match[1], s: match[2], v: match[3] };
|
|
}
|
|
if ((match = matchers.hsva.exec(color))) {
|
|
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
}
|
|
if ((match = matchers.hex8.exec(color))) {
|
|
return {
|
|
r: parseIntFromHex(match[1]),
|
|
g: parseIntFromHex(match[2]),
|
|
b: parseIntFromHex(match[3]),
|
|
a: convertHexToDecimal(match[4]),
|
|
format: named ? "name" : "hex8"
|
|
};
|
|
}
|
|
if ((match = matchers.hex6.exec(color))) {
|
|
return {
|
|
r: parseIntFromHex(match[1]),
|
|
g: parseIntFromHex(match[2]),
|
|
b: parseIntFromHex(match[3]),
|
|
format: named ? "name" : "hex"
|
|
};
|
|
}
|
|
if ((match = matchers.hex4.exec(color))) {
|
|
return {
|
|
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
a: convertHexToDecimal(match[4] + '' + match[4]),
|
|
format: named ? "name" : "hex8"
|
|
};
|
|
}
|
|
if ((match = matchers.hex3.exec(color))) {
|
|
return {
|
|
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
format: named ? "name" : "hex"
|
|
};
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function validateWCAG2Parms(parms) {
|
|
// return valid WCAG2 parms for isReadable.
|
|
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
var level, size;
|
|
parms = parms || {"level":"AA", "size":"small"};
|
|
level = (parms.level || "AA").toUpperCase();
|
|
size = (parms.size || "small").toLowerCase();
|
|
if (level !== "AA" && level !== "AAA") {
|
|
level = "AA";
|
|
}
|
|
if (size !== "small" && size !== "large") {
|
|
size = "small";
|
|
}
|
|
return {"level":level, "size":size};
|
|
}
|
|
|
|
// Node: Export function
|
|
if ( true && module.exports) {
|
|
module.exports = tinycolor;
|
|
}
|
|
// AMD/requirejs: Define the module
|
|
else if (true) {
|
|
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module),
|
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
}
|
|
// Browser: Expose to window
|
|
else {}
|
|
|
|
})(Math);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "bT9E":
|
|
/*!*****************************************!*\
|
|
!*** ./node_modules/rc-util/es/omit.js ***!
|
|
\*****************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return omit; });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "VTBJ");
|
|
|
|
function omit(obj, fields) {
|
|
var clone = Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, obj);
|
|
|
|
if (Array.isArray(fields)) {
|
|
fields.forEach(function (key) {
|
|
delete clone[key];
|
|
});
|
|
}
|
|
|
|
return clone;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "biw7":
|
|
/*!**********************************************************!*\
|
|
!*** ./node_modules/rc-table/es/context/TableContext.js ***!
|
|
\**********************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
|
var TableContext = react__WEBPACK_IMPORTED_MODULE_0__["createContext"](null);
|
|
/* harmony default export */ __webpack_exports__["a"] = (TableContext);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "fAei":
|
|
/*!******************************************************!*\
|
|
!*** ./node_modules/rc-tree/es/index.js + 4 modules ***!
|
|
\******************************************************/
|
|
/*! exports provided: TreeNode, default */
|
|
/*! exports used: TreeNode, default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-motion/es/index.js (<- Module is referenced from these modules with unsupported syntax: ./node_modules/antd/lib/button/LoadingIcon.js (referenced with cjs require)) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/TreeNode.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/contextTypes.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/util.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/conductUtil.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/treeUtil.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ TreeNode["a" /* default */]; });
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__("rePB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("VTBJ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__("KQm4");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__("1OyB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__("vuIU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__("Ji7U");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__("LK+K");
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__("4IlW");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
|
|
var warning = __webpack_require__("Kwbf");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/contextTypes.js
|
|
var contextTypes = __webpack_require__("sboe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/util.js
|
|
var util = __webpack_require__("OZM5");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/utils/treeUtil.js
|
|
var treeUtil = __webpack_require__("815F");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__("ODXe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__("Ff2n");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-virtual-list/es/index.js + 19 modules
|
|
var es = __webpack_require__("+nKL");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-motion/es/index.js + 5 modules
|
|
var rc_motion_es = __webpack_require__("8XRh");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/TreeNode.js + 1 modules
|
|
var TreeNode = __webpack_require__("WaYH");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree/es/MotionTreeNode.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MotionTreeNode_MotionTreeNode = function MotionTreeNode(_ref, ref) {
|
|
var className = _ref.className,
|
|
style = _ref.style,
|
|
motion = _ref.motion,
|
|
motionNodes = _ref.motionNodes,
|
|
motionType = _ref.motionType,
|
|
onOriginMotionStart = _ref.onMotionStart,
|
|
onOriginMotionEnd = _ref.onMotionEnd,
|
|
active = _ref.active,
|
|
treeNodeRequiredProps = _ref.treeNodeRequiredProps,
|
|
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"]);
|
|
|
|
var _React$useState = external_window_React_["useState"](true),
|
|
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
|
|
visible = _React$useState2[0],
|
|
setVisible = _React$useState2[1];
|
|
|
|
var _React$useContext = external_window_React_["useContext"](contextTypes["a" /* TreeContext */]),
|
|
prefixCls = _React$useContext.prefixCls;
|
|
|
|
var motionedRef = external_window_React_["useRef"](false);
|
|
|
|
var onMotionEnd = function onMotionEnd() {
|
|
if (!motionedRef.current) {
|
|
onOriginMotionEnd();
|
|
}
|
|
|
|
motionedRef.current = true;
|
|
};
|
|
|
|
Object(external_window_React_["useEffect"])(function () {
|
|
if (motionNodes && motionType === 'hide' && visible) {
|
|
setVisible(false);
|
|
}
|
|
}, [motionNodes]);
|
|
Object(external_window_React_["useEffect"])(function () {
|
|
// Trigger motion only when patched
|
|
if (motionNodes) {
|
|
onOriginMotionStart();
|
|
}
|
|
|
|
return function () {
|
|
if (motionNodes) {
|
|
onMotionEnd();
|
|
}
|
|
};
|
|
}, []);
|
|
|
|
if (motionNodes) {
|
|
return external_window_React_["createElement"](rc_motion_es["default"], Object.assign({
|
|
ref: ref,
|
|
visible: visible
|
|
}, motion, {
|
|
motionAppear: motionType === 'show',
|
|
onAppearEnd: onMotionEnd,
|
|
onLeaveEnd: onMotionEnd
|
|
}), function (_ref2, motionRef) {
|
|
var motionClassName = _ref2.className,
|
|
motionStyle = _ref2.style;
|
|
return external_window_React_["createElement"]("div", {
|
|
ref: motionRef,
|
|
className: classnames_default()("".concat(prefixCls, "-treenode-motion"), motionClassName),
|
|
style: motionStyle
|
|
}, motionNodes.map(function (treeNode) {
|
|
var _treeNode$data = treeNode.data,
|
|
key = _treeNode$data.key,
|
|
restProps = Object(objectWithoutProperties["a" /* default */])(_treeNode$data, ["key"]),
|
|
isStart = treeNode.isStart,
|
|
isEnd = treeNode.isEnd;
|
|
|
|
delete restProps.children;
|
|
var treeNodeProps = Object(treeUtil["f" /* getTreeNodeProps */])(key, treeNodeRequiredProps);
|
|
return external_window_React_["createElement"](TreeNode["a" /* default */], Object.assign({}, restProps, treeNodeProps, {
|
|
active: active,
|
|
data: treeNode.data,
|
|
key: key,
|
|
isStart: isStart,
|
|
isEnd: isEnd
|
|
}));
|
|
}));
|
|
});
|
|
}
|
|
|
|
return external_window_React_["createElement"](TreeNode["a" /* default */], Object.assign({
|
|
domRef: ref,
|
|
className: className,
|
|
style: style
|
|
}, props, {
|
|
active: active
|
|
}));
|
|
};
|
|
|
|
MotionTreeNode_MotionTreeNode.displayName = 'MotionTreeNode';
|
|
var RefMotionTreeNode = external_window_React_["forwardRef"](MotionTreeNode_MotionTreeNode);
|
|
/* harmony default export */ var es_MotionTreeNode = (RefMotionTreeNode);
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree/es/utils/diffUtil.js
|
|
function findExpandedKeys() {
|
|
var prev = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
var next = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
var prevLen = prev.length;
|
|
var nextLen = next.length;
|
|
|
|
if (Math.abs(prevLen - nextLen) !== 1) {
|
|
return {
|
|
add: false,
|
|
key: null
|
|
};
|
|
}
|
|
|
|
function find(shorter, longer) {
|
|
var cache = new Map();
|
|
shorter.forEach(function (key) {
|
|
cache.set(key, true);
|
|
});
|
|
var keys = longer.filter(function (key) {
|
|
return !cache.has(key);
|
|
});
|
|
return keys.length === 1 ? keys[0] : null;
|
|
}
|
|
|
|
if (prevLen < nextLen) {
|
|
return {
|
|
add: true,
|
|
key: find(prev, next)
|
|
};
|
|
}
|
|
|
|
return {
|
|
add: false,
|
|
key: find(next, prev)
|
|
};
|
|
}
|
|
function getExpandRange(shorter, longer, key) {
|
|
var shorterStartIndex = shorter.findIndex(function (_ref) {
|
|
var data = _ref.data;
|
|
return data.key === key;
|
|
});
|
|
var shorterEndNode = shorter[shorterStartIndex + 1];
|
|
var longerStartIndex = longer.findIndex(function (_ref2) {
|
|
var data = _ref2.data;
|
|
return data.key === key;
|
|
});
|
|
|
|
if (shorterEndNode) {
|
|
var longerEndIndex = longer.findIndex(function (_ref3) {
|
|
var data = _ref3.data;
|
|
return data.key === shorterEndNode.data.key;
|
|
});
|
|
return longer.slice(longerStartIndex + 1, longerEndIndex);
|
|
}
|
|
|
|
return longer.slice(longerStartIndex + 1);
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree/es/NodeList.js
|
|
|
|
|
|
|
|
/**
|
|
* Handle virtual list of the TreeNodes.
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
var HIDDEN_STYLE = {
|
|
width: 0,
|
|
height: 0,
|
|
display: 'flex',
|
|
overflow: 'hidden',
|
|
opacity: 0,
|
|
border: 0,
|
|
padding: 0,
|
|
margin: 0
|
|
};
|
|
|
|
var noop = function noop() {};
|
|
|
|
var MOTION_KEY = "RC_TREE_MOTION_".concat(Math.random());
|
|
var MotionNode = {
|
|
key: MOTION_KEY
|
|
};
|
|
var MotionEntity = {
|
|
key: MOTION_KEY,
|
|
level: 0,
|
|
index: 0,
|
|
pos: '0',
|
|
node: MotionNode
|
|
};
|
|
var MotionFlattenData = {
|
|
parent: null,
|
|
children: [],
|
|
pos: MotionEntity.pos,
|
|
data: MotionNode,
|
|
|
|
/** Hold empty list here since we do not use it */
|
|
isStart: [],
|
|
isEnd: []
|
|
};
|
|
/**
|
|
* We only need get visible content items to play the animation.
|
|
*/
|
|
|
|
function getMinimumRangeTransitionRange(list, virtual, height, itemHeight) {
|
|
if (virtual === false || !height) {
|
|
return list;
|
|
}
|
|
|
|
return list.slice(0, Math.ceil(height / itemHeight) + 1);
|
|
}
|
|
|
|
function itemKey(item) {
|
|
var key = item.data.key,
|
|
pos = item.pos;
|
|
return Object(treeUtil["e" /* getKey */])(key, pos);
|
|
}
|
|
|
|
function getAccessibilityPath(item) {
|
|
var path = String(item.data.key);
|
|
var current = item;
|
|
|
|
while (current.parent) {
|
|
current = current.parent;
|
|
path = "".concat(current.data.key, " > ").concat(path);
|
|
}
|
|
|
|
return path;
|
|
}
|
|
|
|
var NodeList_RefNodeList = function RefNodeList(props, ref) {
|
|
var prefixCls = props.prefixCls,
|
|
data = props.data,
|
|
selectable = props.selectable,
|
|
checkable = props.checkable,
|
|
expandedKeys = props.expandedKeys,
|
|
selectedKeys = props.selectedKeys,
|
|
checkedKeys = props.checkedKeys,
|
|
loadedKeys = props.loadedKeys,
|
|
loadingKeys = props.loadingKeys,
|
|
halfCheckedKeys = props.halfCheckedKeys,
|
|
keyEntities = props.keyEntities,
|
|
disabled = props.disabled,
|
|
dragging = props.dragging,
|
|
dragOverNodeKey = props.dragOverNodeKey,
|
|
dropPosition = props.dropPosition,
|
|
motion = props.motion,
|
|
height = props.height,
|
|
itemHeight = props.itemHeight,
|
|
virtual = props.virtual,
|
|
focusable = props.focusable,
|
|
activeItem = props.activeItem,
|
|
focused = props.focused,
|
|
tabIndex = props.tabIndex,
|
|
onKeyDown = props.onKeyDown,
|
|
onFocus = props.onFocus,
|
|
onBlur = props.onBlur,
|
|
onActiveChange = props.onActiveChange,
|
|
onListChangeStart = props.onListChangeStart,
|
|
onListChangeEnd = props.onListChangeEnd,
|
|
domProps = Object(objectWithoutProperties["a" /* 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 ================================
|
|
|
|
|
|
var listRef = external_window_React_["useRef"](null);
|
|
external_window_React_["useImperativeHandle"](ref, function () {
|
|
return {
|
|
scrollTo: function scrollTo(scroll) {
|
|
listRef.current.scrollTo(scroll);
|
|
}
|
|
};
|
|
}); // ============================== Motion ==============================
|
|
|
|
var _React$useState = external_window_React_["useState"](expandedKeys),
|
|
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
|
|
prevExpandedKeys = _React$useState2[0],
|
|
setPrevExpandedKeys = _React$useState2[1];
|
|
|
|
var _React$useState3 = external_window_React_["useState"](data),
|
|
_React$useState4 = Object(slicedToArray["a" /* default */])(_React$useState3, 2),
|
|
prevData = _React$useState4[0],
|
|
setPrevData = _React$useState4[1];
|
|
|
|
var _React$useState5 = external_window_React_["useState"](data),
|
|
_React$useState6 = Object(slicedToArray["a" /* default */])(_React$useState5, 2),
|
|
transitionData = _React$useState6[0],
|
|
setTransitionData = _React$useState6[1];
|
|
|
|
var _React$useState7 = external_window_React_["useState"]([]),
|
|
_React$useState8 = Object(slicedToArray["a" /* default */])(_React$useState7, 2),
|
|
transitionRange = _React$useState8[0],
|
|
setTransitionRange = _React$useState8[1];
|
|
|
|
var _React$useState9 = external_window_React_["useState"](null),
|
|
_React$useState10 = Object(slicedToArray["a" /* default */])(_React$useState9, 2),
|
|
motionType = _React$useState10[0],
|
|
setMotionType = _React$useState10[1];
|
|
|
|
function onMotionEnd() {
|
|
setPrevData(data);
|
|
setTransitionData(data);
|
|
setTransitionRange([]);
|
|
setMotionType(null);
|
|
onListChangeEnd();
|
|
} // Do animation if expanded keys changed
|
|
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
setPrevExpandedKeys(expandedKeys);
|
|
var diffExpanded = findExpandedKeys(prevExpandedKeys, expandedKeys);
|
|
|
|
if (diffExpanded.key !== null) {
|
|
if (diffExpanded.add) {
|
|
var keyIndex = prevData.findIndex(function (_ref) {
|
|
var key = _ref.data.key;
|
|
return key === diffExpanded.key;
|
|
});
|
|
var rangeNodes = getMinimumRangeTransitionRange(getExpandRange(prevData, data, diffExpanded.key), virtual, height, itemHeight);
|
|
var newTransitionData = prevData.slice();
|
|
newTransitionData.splice(keyIndex + 1, 0, MotionFlattenData);
|
|
setTransitionData(newTransitionData);
|
|
setTransitionRange(rangeNodes);
|
|
setMotionType('show');
|
|
} else {
|
|
var _keyIndex = data.findIndex(function (_ref2) {
|
|
var key = _ref2.data.key;
|
|
return key === diffExpanded.key;
|
|
});
|
|
|
|
var _rangeNodes = getMinimumRangeTransitionRange(getExpandRange(data, prevData, diffExpanded.key), virtual, height, itemHeight);
|
|
|
|
var _newTransitionData = data.slice();
|
|
|
|
_newTransitionData.splice(_keyIndex + 1, 0, MotionFlattenData);
|
|
|
|
setTransitionData(_newTransitionData);
|
|
setTransitionRange(_rangeNodes);
|
|
setMotionType('hide');
|
|
}
|
|
} else if (prevData !== data) {
|
|
// If whole data changed, we just refresh the list
|
|
setPrevData(data);
|
|
setTransitionData(data);
|
|
}
|
|
}, [expandedKeys, data]); // We should clean up motion if is changed by dragging
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
if (!dragging) {
|
|
onMotionEnd();
|
|
}
|
|
}, [dragging]);
|
|
var mergedData = motion ? transitionData : data;
|
|
var treeNodeRequiredProps = {
|
|
expandedKeys: expandedKeys,
|
|
selectedKeys: selectedKeys,
|
|
loadedKeys: loadedKeys,
|
|
loadingKeys: loadingKeys,
|
|
checkedKeys: checkedKeys,
|
|
halfCheckedKeys: halfCheckedKeys,
|
|
dragOverNodeKey: dragOverNodeKey,
|
|
dropPosition: dropPosition,
|
|
keyEntities: keyEntities
|
|
};
|
|
return external_window_React_["createElement"](external_window_React_["Fragment"], null, focused && activeItem && external_window_React_["createElement"]("span", {
|
|
style: HIDDEN_STYLE,
|
|
"aria-live": "assertive"
|
|
}, getAccessibilityPath(activeItem)), external_window_React_["createElement"]("div", {
|
|
role: "tree"
|
|
}, external_window_React_["createElement"]("input", {
|
|
style: HIDDEN_STYLE,
|
|
disabled: focusable === false || disabled,
|
|
tabIndex: focusable !== false ? tabIndex : null,
|
|
onKeyDown: onKeyDown,
|
|
onFocus: onFocus,
|
|
onBlur: onBlur,
|
|
value: "",
|
|
onChange: noop
|
|
})), external_window_React_["createElement"](es["a" /* default */], Object.assign({}, domProps, {
|
|
data: mergedData,
|
|
itemKey: itemKey,
|
|
height: height,
|
|
fullHeight: false,
|
|
virtual: virtual,
|
|
itemHeight: itemHeight,
|
|
prefixCls: "".concat(prefixCls, "-list"),
|
|
ref: listRef
|
|
}), function (treeNode) {
|
|
var pos = treeNode.pos,
|
|
_treeNode$data = treeNode.data,
|
|
key = _treeNode$data.key,
|
|
restProps = Object(objectWithoutProperties["a" /* default */])(_treeNode$data, ["key"]),
|
|
isStart = treeNode.isStart,
|
|
isEnd = treeNode.isEnd;
|
|
|
|
var mergedKey = Object(treeUtil["e" /* getKey */])(key, pos);
|
|
delete restProps.children;
|
|
var treeNodeProps = Object(treeUtil["f" /* getTreeNodeProps */])(mergedKey, treeNodeRequiredProps);
|
|
return external_window_React_["createElement"](es_MotionTreeNode, Object.assign({}, restProps, treeNodeProps, {
|
|
active: activeItem && key === activeItem.data.key,
|
|
pos: pos,
|
|
data: treeNode.data,
|
|
isStart: isStart,
|
|
isEnd: isEnd,
|
|
motion: motion,
|
|
motionNodes: key === MOTION_KEY ? transitionRange : null,
|
|
motionType: motionType,
|
|
onMotionStart: onListChangeStart,
|
|
onMotionEnd: onMotionEnd,
|
|
treeNodeRequiredProps: treeNodeRequiredProps,
|
|
onMouseMove: function onMouseMove() {
|
|
onActiveChange(null);
|
|
}
|
|
}));
|
|
}));
|
|
};
|
|
|
|
var NodeList = external_window_React_["forwardRef"](NodeList_RefNodeList);
|
|
NodeList.displayName = 'NodeList';
|
|
/* harmony default export */ var es_NodeList = (NodeList);
|
|
// EXTERNAL MODULE: ./node_modules/rc-tree/es/utils/conductUtil.js
|
|
var conductUtil = __webpack_require__("NvD2");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree/es/Tree.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: https://www.w3.org/TR/2017/NOTE-wai-aria-practices-1.1-20171214/examples/treeview/treeview-2/treeview-2a.html
|
|
// Fully accessibility support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Tree_Tree = /*#__PURE__*/function (_React$Component) {
|
|
Object(inherits["a" /* default */])(Tree, _React$Component);
|
|
|
|
var _super = Object(createSuper["a" /* default */])(Tree);
|
|
|
|
function Tree() {
|
|
var _this;
|
|
|
|
Object(classCallCheck["a" /* default */])(this, Tree);
|
|
|
|
_this = _super.apply(this, arguments);
|
|
_this.destroyed = false;
|
|
_this.state = {
|
|
keyEntities: {},
|
|
selectedKeys: [],
|
|
checkedKeys: [],
|
|
halfCheckedKeys: [],
|
|
loadedKeys: [],
|
|
loadingKeys: [],
|
|
expandedKeys: [],
|
|
dragging: false,
|
|
dragNodesKeys: [],
|
|
dragOverNodeKey: null,
|
|
dropPosition: null,
|
|
treeData: [],
|
|
flattenNodes: [],
|
|
focused: false,
|
|
activeKey: null,
|
|
listChanging: false,
|
|
prevProps: null
|
|
};
|
|
_this.listRef = external_window_React_["createRef"]();
|
|
|
|
_this.onNodeDragStart = function (event, node) {
|
|
var _this$state = _this.state,
|
|
expandedKeys = _this$state.expandedKeys,
|
|
keyEntities = _this$state.keyEntities;
|
|
var onDragStart = _this.props.onDragStart;
|
|
var eventKey = node.props.eventKey;
|
|
_this.dragNode = node;
|
|
var newExpandedKeys = Object(util["b" /* arrDel */])(expandedKeys, eventKey);
|
|
|
|
_this.setState({
|
|
dragging: true,
|
|
dragNodesKeys: Object(util["g" /* getDragNodesKeys */])(eventKey, keyEntities)
|
|
});
|
|
|
|
_this.setExpandedKeys(newExpandedKeys);
|
|
|
|
if (onDragStart) {
|
|
onDragStart({
|
|
event: event,
|
|
node: Object(treeUtil["b" /* convertNodePropsToEventData */])(node.props)
|
|
});
|
|
}
|
|
};
|
|
/**
|
|
* [Legacy] Select handler is less small 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) {
|
|
var _this$state2 = _this.state,
|
|
expandedKeys = _this$state2.expandedKeys,
|
|
keyEntities = _this$state2.keyEntities,
|
|
dragNodesKeys = _this$state2.dragNodesKeys;
|
|
var onDragEnter = _this.props.onDragEnter;
|
|
var _node$props = node.props,
|
|
pos = _node$props.pos,
|
|
eventKey = _node$props.eventKey;
|
|
if (!_this.dragNode || dragNodesKeys.indexOf(eventKey) !== -1) return;
|
|
var dropPosition = Object(util["c" /* calcDropPosition */])(event, node); // Skip if drag node is self
|
|
|
|
if (_this.dragNode.props.eventKey === eventKey && dropPosition === 0) {
|
|
_this.setState({
|
|
dragOverNodeKey: '',
|
|
dropPosition: null
|
|
});
|
|
|
|
return;
|
|
} // Ref: https://github.com/react-component/tree/issues/132
|
|
// Add timeout to let onDragLevel fire before onDragEnter,
|
|
// so that we can clean drag props for onDragLeave node.
|
|
// Macro task for this:
|
|
// https://html.spec.whatwg.org/multipage/webappapis.html#clean-up-after-running-script
|
|
|
|
|
|
setTimeout(function () {
|
|
// Update drag over node
|
|
_this.setState({
|
|
dragOverNodeKey: eventKey,
|
|
dropPosition: dropPosition
|
|
}); // Side effect for delay drag
|
|
|
|
|
|
if (!_this.delayedDragEnterLogic) {
|
|
_this.delayedDragEnterLogic = {};
|
|
}
|
|
|
|
Object.keys(_this.delayedDragEnterLogic).forEach(function (key) {
|
|
clearTimeout(_this.delayedDragEnterLogic[key]);
|
|
});
|
|
_this.delayedDragEnterLogic[pos] = window.setTimeout(function () {
|
|
if (!_this.state.dragging) return;
|
|
|
|
var newExpandedKeys = Object(toConsumableArray["a" /* default */])(expandedKeys);
|
|
|
|
var entity = keyEntities[eventKey];
|
|
|
|
if (entity && (entity.children || []).length) {
|
|
newExpandedKeys = Object(util["a" /* arrAdd */])(expandedKeys, eventKey);
|
|
}
|
|
|
|
if (!('expandedKeys' in _this.props)) {
|
|
_this.setExpandedKeys(newExpandedKeys);
|
|
}
|
|
|
|
if (onDragEnter) {
|
|
onDragEnter({
|
|
event: event,
|
|
node: Object(treeUtil["b" /* convertNodePropsToEventData */])(node.props),
|
|
expandedKeys: newExpandedKeys
|
|
});
|
|
}
|
|
}, 400);
|
|
}, 0);
|
|
};
|
|
|
|
_this.onNodeDragOver = function (event, node) {
|
|
var dragNodesKeys = _this.state.dragNodesKeys;
|
|
var onDragOver = _this.props.onDragOver;
|
|
var eventKey = node.props.eventKey;
|
|
|
|
if (dragNodesKeys.indexOf(eventKey) !== -1) {
|
|
return;
|
|
} // Update drag position
|
|
|
|
|
|
if (_this.dragNode && eventKey === _this.state.dragOverNodeKey) {
|
|
var dropPosition = Object(util["c" /* calcDropPosition */])(event, node);
|
|
if (dropPosition === _this.state.dropPosition) return;
|
|
|
|
_this.setState({
|
|
dropPosition: dropPosition
|
|
});
|
|
}
|
|
|
|
if (onDragOver) {
|
|
onDragOver({
|
|
event: event,
|
|
node: Object(treeUtil["b" /* convertNodePropsToEventData */])(node.props)
|
|
});
|
|
}
|
|
};
|
|
|
|
_this.onNodeDragLeave = function (event, node) {
|
|
var onDragLeave = _this.props.onDragLeave;
|
|
|
|
_this.setState({
|
|
dragOverNodeKey: ''
|
|
});
|
|
|
|
if (onDragLeave) {
|
|
onDragLeave({
|
|
event: event,
|
|
node: Object(treeUtil["b" /* convertNodePropsToEventData */])(node.props)
|
|
});
|
|
}
|
|
};
|
|
|
|
_this.onNodeDragEnd = function (event, node) {
|
|
var onDragEnd = _this.props.onDragEnd;
|
|
|
|
_this.setState({
|
|
dragOverNodeKey: ''
|
|
});
|
|
|
|
_this.cleanDragState();
|
|
|
|
if (onDragEnd) {
|
|
onDragEnd({
|
|
event: event,
|
|
node: Object(treeUtil["b" /* convertNodePropsToEventData */])(node.props)
|
|
});
|
|
}
|
|
|
|
_this.dragNode = null;
|
|
};
|
|
|
|
_this.onNodeDrop = function (event, node) {
|
|
var _this$state3 = _this.state,
|
|
_this$state3$dragNode = _this$state3.dragNodesKeys,
|
|
dragNodesKeys = _this$state3$dragNode === void 0 ? [] : _this$state3$dragNode,
|
|
dropPosition = _this$state3.dropPosition;
|
|
var onDrop = _this.props.onDrop;
|
|
var _node$props2 = node.props,
|
|
eventKey = _node$props2.eventKey,
|
|
pos = _node$props2.pos;
|
|
|
|
_this.setState({
|
|
dragOverNodeKey: ''
|
|
});
|
|
|
|
_this.cleanDragState();
|
|
|
|
if (dragNodesKeys.indexOf(eventKey) !== -1) {
|
|
Object(warning["a" /* default */])(false, "Can not drop to dragNode(include it's children node)");
|
|
return;
|
|
}
|
|
|
|
var posArr = Object(util["k" /* posToArr */])(pos);
|
|
var dropResult = {
|
|
event: event,
|
|
node: Object(treeUtil["b" /* convertNodePropsToEventData */])(node.props),
|
|
dragNode: _this.dragNode ? Object(treeUtil["b" /* convertNodePropsToEventData */])(_this.dragNode.props) : null,
|
|
dragNodesKeys: dragNodesKeys.slice(),
|
|
dropPosition: dropPosition + Number(posArr[posArr.length - 1]),
|
|
dropToGap: false
|
|
};
|
|
|
|
if (dropPosition !== 0) {
|
|
dropResult.dropToGap = true;
|
|
}
|
|
|
|
if (onDrop) {
|
|
onDrop(dropResult);
|
|
}
|
|
|
|
_this.dragNode = null;
|
|
};
|
|
|
|
_this.cleanDragState = function () {
|
|
var dragging = _this.state.dragging;
|
|
|
|
if (dragging) {
|
|
_this.setState({
|
|
dragging: false
|
|
});
|
|
}
|
|
};
|
|
|
|
_this.onNodeClick = function (e, treeNode) {
|
|
var onClick = _this.props.onClick;
|
|
|
|
if (onClick) {
|
|
onClick(e, treeNode);
|
|
}
|
|
};
|
|
|
|
_this.onNodeDoubleClick = function (e, treeNode) {
|
|
var onDoubleClick = _this.props.onDoubleClick;
|
|
|
|
if (onDoubleClick) {
|
|
onDoubleClick(e, treeNode);
|
|
}
|
|
};
|
|
|
|
_this.onNodeSelect = function (e, treeNode) {
|
|
var selectedKeys = _this.state.selectedKeys;
|
|
var keyEntities = _this.state.keyEntities;
|
|
var _this$props = _this.props,
|
|
onSelect = _this$props.onSelect,
|
|
multiple = _this$props.multiple;
|
|
var selected = treeNode.selected,
|
|
key = treeNode.key;
|
|
var targetSelected = !selected; // Update selected keys
|
|
|
|
if (!targetSelected) {
|
|
selectedKeys = Object(util["b" /* arrDel */])(selectedKeys, key);
|
|
} else if (!multiple) {
|
|
selectedKeys = [key];
|
|
} else {
|
|
selectedKeys = Object(util["a" /* arrAdd */])(selectedKeys, key);
|
|
} // [Legacy] Not found related usage in doc or upper libs
|
|
|
|
|
|
var selectedNodes = selectedKeys.map(function (selectedKey) {
|
|
var entity = keyEntities[selectedKey];
|
|
if (!entity) return null;
|
|
return entity.node;
|
|
}).filter(function (node) {
|
|
return node;
|
|
});
|
|
|
|
_this.setUncontrolledState({
|
|
selectedKeys: selectedKeys
|
|
});
|
|
|
|
if (onSelect) {
|
|
onSelect(selectedKeys, {
|
|
event: 'select',
|
|
selected: targetSelected,
|
|
node: treeNode,
|
|
selectedNodes: selectedNodes,
|
|
nativeEvent: e.nativeEvent
|
|
});
|
|
}
|
|
};
|
|
|
|
_this.onNodeCheck = function (e, treeNode, checked) {
|
|
var _this$state4 = _this.state,
|
|
keyEntities = _this$state4.keyEntities,
|
|
oriCheckedKeys = _this$state4.checkedKeys,
|
|
oriHalfCheckedKeys = _this$state4.halfCheckedKeys;
|
|
var _this$props2 = _this.props,
|
|
checkStrictly = _this$props2.checkStrictly,
|
|
onCheck = _this$props2.onCheck;
|
|
var key = treeNode.key; // Prepare trigger arguments
|
|
|
|
var checkedObj;
|
|
var eventObj = {
|
|
event: 'check',
|
|
node: treeNode,
|
|
checked: checked,
|
|
nativeEvent: e.nativeEvent
|
|
};
|
|
|
|
if (checkStrictly) {
|
|
var checkedKeys = checked ? Object(util["a" /* arrAdd */])(oriCheckedKeys, key) : Object(util["b" /* arrDel */])(oriCheckedKeys, key);
|
|
var halfCheckedKeys = Object(util["b" /* arrDel */])(oriHalfCheckedKeys, key);
|
|
checkedObj = {
|
|
checked: checkedKeys,
|
|
halfChecked: halfCheckedKeys
|
|
};
|
|
eventObj.checkedNodes = checkedKeys.map(function (checkedKey) {
|
|
return keyEntities[checkedKey];
|
|
}).filter(function (entity) {
|
|
return entity;
|
|
}).map(function (entity) {
|
|
return entity.node;
|
|
});
|
|
|
|
_this.setUncontrolledState({
|
|
checkedKeys: checkedKeys
|
|
});
|
|
} else {
|
|
// Always fill first
|
|
var _conductCheck = Object(conductUtil["a" /* conductCheck */])([].concat(Object(toConsumableArray["a" /* default */])(oriCheckedKeys), [key]), true, keyEntities),
|
|
_checkedKeys = _conductCheck.checkedKeys,
|
|
_halfCheckedKeys = _conductCheck.halfCheckedKeys; // If remove, we do it again to correction
|
|
|
|
|
|
if (!checked) {
|
|
var keySet = new Set(_checkedKeys);
|
|
keySet.delete(key);
|
|
|
|
var _conductCheck2 = Object(conductUtil["a" /* conductCheck */])(Array.from(keySet), {
|
|
checked: false,
|
|
halfCheckedKeys: _halfCheckedKeys
|
|
}, keyEntities);
|
|
|
|
_checkedKeys = _conductCheck2.checkedKeys;
|
|
_halfCheckedKeys = _conductCheck2.halfCheckedKeys;
|
|
}
|
|
|
|
checkedObj = _checkedKeys; // [Legacy] This is used for `rc-tree-select`
|
|
|
|
eventObj.checkedNodes = [];
|
|
eventObj.checkedNodesPositions = [];
|
|
eventObj.halfCheckedKeys = _halfCheckedKeys;
|
|
|
|
_checkedKeys.forEach(function (checkedKey) {
|
|
var entity = keyEntities[checkedKey];
|
|
if (!entity) return;
|
|
var node = entity.node,
|
|
pos = entity.pos;
|
|
eventObj.checkedNodes.push(node);
|
|
eventObj.checkedNodesPositions.push({
|
|
node: node,
|
|
pos: pos
|
|
});
|
|
});
|
|
|
|
_this.setUncontrolledState({
|
|
checkedKeys: _checkedKeys
|
|
}, false, {
|
|
halfCheckedKeys: _halfCheckedKeys
|
|
});
|
|
}
|
|
|
|
if (onCheck) {
|
|
onCheck(checkedObj, eventObj);
|
|
}
|
|
};
|
|
|
|
_this.onNodeLoad = function (treeNode) {
|
|
return new Promise(function (resolve) {
|
|
// We need to get the latest state of loading/loaded keys
|
|
_this.setState(function (_ref) {
|
|
var _ref$loadedKeys = _ref.loadedKeys,
|
|
loadedKeys = _ref$loadedKeys === void 0 ? [] : _ref$loadedKeys,
|
|
_ref$loadingKeys = _ref.loadingKeys,
|
|
loadingKeys = _ref$loadingKeys === void 0 ? [] : _ref$loadingKeys;
|
|
var _this$props3 = _this.props,
|
|
loadData = _this$props3.loadData,
|
|
onLoad = _this$props3.onLoad;
|
|
var key = treeNode.key;
|
|
|
|
if (!loadData || loadedKeys.indexOf(key) !== -1 || loadingKeys.indexOf(key) !== -1) {
|
|
// react 15 will warn if return null
|
|
return {};
|
|
} // Process load data
|
|
|
|
|
|
var promise = loadData(treeNode);
|
|
promise.then(function () {
|
|
var _this$state5 = _this.state,
|
|
currentLoadedKeys = _this$state5.loadedKeys,
|
|
currentLoadingKeys = _this$state5.loadingKeys;
|
|
var newLoadedKeys = Object(util["a" /* arrAdd */])(currentLoadedKeys, key);
|
|
var newLoadingKeys = Object(util["b" /* arrDel */])(currentLoadingKeys, key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice.
|
|
// https://github.com/ant-design/ant-design/issues/12464
|
|
|
|
if (onLoad) {
|
|
onLoad(newLoadedKeys, {
|
|
event: 'load',
|
|
node: treeNode
|
|
});
|
|
}
|
|
|
|
_this.setUncontrolledState({
|
|
loadedKeys: newLoadedKeys
|
|
});
|
|
|
|
_this.setState({
|
|
loadingKeys: newLoadingKeys
|
|
});
|
|
|
|
resolve();
|
|
});
|
|
return {
|
|
loadingKeys: Object(util["a" /* arrAdd */])(loadingKeys, key)
|
|
};
|
|
});
|
|
});
|
|
};
|
|
|
|
_this.onNodeMouseEnter = function (event, node) {
|
|
var onMouseEnter = _this.props.onMouseEnter;
|
|
|
|
if (onMouseEnter) {
|
|
onMouseEnter({
|
|
event: event,
|
|
node: node
|
|
});
|
|
}
|
|
};
|
|
|
|
_this.onNodeMouseLeave = function (event, node) {
|
|
var onMouseLeave = _this.props.onMouseLeave;
|
|
|
|
if (onMouseLeave) {
|
|
onMouseLeave({
|
|
event: event,
|
|
node: node
|
|
});
|
|
}
|
|
};
|
|
|
|
_this.onNodeContextMenu = function (event, node) {
|
|
var onRightClick = _this.props.onRightClick;
|
|
|
|
if (onRightClick) {
|
|
event.preventDefault();
|
|
onRightClick({
|
|
event: event,
|
|
node: node
|
|
});
|
|
}
|
|
};
|
|
|
|
_this.onFocus = function () {
|
|
var onFocus = _this.props.onFocus;
|
|
|
|
_this.setState({
|
|
focused: true
|
|
});
|
|
|
|
if (onFocus) {
|
|
onFocus.apply(void 0, arguments);
|
|
}
|
|
};
|
|
|
|
_this.onBlur = function () {
|
|
var onBlur = _this.props.onBlur;
|
|
|
|
_this.setState({
|
|
focused: false
|
|
});
|
|
|
|
_this.onActiveChange(null);
|
|
|
|
if (onBlur) {
|
|
onBlur.apply(void 0, arguments);
|
|
}
|
|
};
|
|
|
|
_this.getTreeNodeRequiredProps = function () {
|
|
var _this$state6 = _this.state,
|
|
expandedKeys = _this$state6.expandedKeys,
|
|
selectedKeys = _this$state6.selectedKeys,
|
|
loadedKeys = _this$state6.loadedKeys,
|
|
loadingKeys = _this$state6.loadingKeys,
|
|
checkedKeys = _this$state6.checkedKeys,
|
|
halfCheckedKeys = _this$state6.halfCheckedKeys,
|
|
dragOverNodeKey = _this$state6.dragOverNodeKey,
|
|
dropPosition = _this$state6.dropPosition,
|
|
keyEntities = _this$state6.keyEntities;
|
|
return {
|
|
expandedKeys: expandedKeys || [],
|
|
selectedKeys: selectedKeys || [],
|
|
loadedKeys: loadedKeys || [],
|
|
loadingKeys: loadingKeys || [],
|
|
checkedKeys: checkedKeys || [],
|
|
halfCheckedKeys: halfCheckedKeys || [],
|
|
dragOverNodeKey: dragOverNodeKey,
|
|
dropPosition: dropPosition,
|
|
keyEntities: keyEntities
|
|
};
|
|
}; // =========================== Expanded ===========================
|
|
|
|
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */
|
|
|
|
|
|
_this.setExpandedKeys = function (expandedKeys) {
|
|
var treeData = _this.state.treeData;
|
|
var flattenNodes = Object(treeUtil["d" /* flattenTreeData */])(treeData, expandedKeys);
|
|
|
|
_this.setUncontrolledState({
|
|
expandedKeys: expandedKeys,
|
|
flattenNodes: flattenNodes
|
|
}, true);
|
|
};
|
|
|
|
_this.onNodeExpand = function (e, treeNode) {
|
|
var expandedKeys = _this.state.expandedKeys;
|
|
var listChanging = _this.state.listChanging;
|
|
var _this$props4 = _this.props,
|
|
onExpand = _this$props4.onExpand,
|
|
loadData = _this$props4.loadData;
|
|
var key = treeNode.key,
|
|
expanded = treeNode.expanded; // Do nothing when motion is in progress
|
|
|
|
if (listChanging) {
|
|
return;
|
|
} // Update selected keys
|
|
|
|
|
|
var index = expandedKeys.indexOf(key);
|
|
var targetExpanded = !expanded;
|
|
Object(warning["a" /* default */])(expanded && index !== -1 || !expanded && index === -1, 'Expand state not sync with index check');
|
|
|
|
if (targetExpanded) {
|
|
expandedKeys = Object(util["a" /* arrAdd */])(expandedKeys, key);
|
|
} else {
|
|
expandedKeys = Object(util["b" /* arrDel */])(expandedKeys, key);
|
|
}
|
|
|
|
_this.setExpandedKeys(expandedKeys);
|
|
|
|
if (onExpand) {
|
|
onExpand(expandedKeys, {
|
|
node: treeNode,
|
|
expanded: targetExpanded,
|
|
nativeEvent: e.nativeEvent
|
|
});
|
|
} // Async Load data
|
|
|
|
|
|
if (targetExpanded && loadData) {
|
|
var loadPromise = _this.onNodeLoad(treeNode);
|
|
|
|
if (loadPromise) {
|
|
loadPromise.then(function () {
|
|
// [Legacy] Refresh logic
|
|
var newFlattenTreeData = Object(treeUtil["d" /* flattenTreeData */])(_this.state.treeData, expandedKeys);
|
|
|
|
_this.setUncontrolledState({
|
|
flattenNodes: newFlattenTreeData
|
|
});
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
_this.onListChangeStart = function () {
|
|
_this.setUncontrolledState({
|
|
listChanging: true
|
|
});
|
|
};
|
|
|
|
_this.onListChangeEnd = function () {
|
|
setTimeout(function () {
|
|
_this.setUncontrolledState({
|
|
listChanging: false
|
|
});
|
|
});
|
|
}; // =========================== Keyboard ===========================
|
|
|
|
|
|
_this.onActiveChange = function (newActiveKey) {
|
|
var activeKey = _this.state.activeKey;
|
|
var onActiveChange = _this.props.onActiveChange;
|
|
|
|
if (activeKey === newActiveKey) {
|
|
return;
|
|
}
|
|
|
|
_this.setState({
|
|
activeKey: newActiveKey
|
|
});
|
|
|
|
if (newActiveKey !== null) {
|
|
_this.scrollTo({
|
|
key: newActiveKey
|
|
});
|
|
}
|
|
|
|
if (onActiveChange) {
|
|
onActiveChange(newActiveKey);
|
|
}
|
|
};
|
|
|
|
_this.getActiveItem = function () {
|
|
var _this$state7 = _this.state,
|
|
activeKey = _this$state7.activeKey,
|
|
flattenNodes = _this$state7.flattenNodes;
|
|
|
|
if (activeKey === null) {
|
|
return null;
|
|
}
|
|
|
|
return flattenNodes.find(function (_ref2) {
|
|
var key = _ref2.data.key;
|
|
return key === activeKey;
|
|
}) || null;
|
|
};
|
|
|
|
_this.offsetActiveKey = function (offset) {
|
|
var _this$state8 = _this.state,
|
|
flattenNodes = _this$state8.flattenNodes,
|
|
activeKey = _this$state8.activeKey;
|
|
var index = flattenNodes.findIndex(function (_ref3) {
|
|
var key = _ref3.data.key;
|
|
return key === activeKey;
|
|
}); // Align with index
|
|
|
|
if (index === -1 && offset < 0) {
|
|
index = flattenNodes.length;
|
|
}
|
|
|
|
index = (index + offset + flattenNodes.length) % flattenNodes.length;
|
|
var item = flattenNodes[index];
|
|
|
|
if (item) {
|
|
var key = item.data.key;
|
|
|
|
_this.onActiveChange(key);
|
|
} else {
|
|
_this.onActiveChange(null);
|
|
}
|
|
};
|
|
|
|
_this.onKeyDown = function (event) {
|
|
var _this$state9 = _this.state,
|
|
activeKey = _this$state9.activeKey,
|
|
expandedKeys = _this$state9.expandedKeys,
|
|
checkedKeys = _this$state9.checkedKeys;
|
|
var _this$props5 = _this.props,
|
|
onKeyDown = _this$props5.onKeyDown,
|
|
checkable = _this$props5.checkable,
|
|
selectable = _this$props5.selectable; // >>>>>>>>>> Direction
|
|
|
|
switch (event.which) {
|
|
case KeyCode["a" /* default */].UP:
|
|
{
|
|
_this.offsetActiveKey(-1);
|
|
|
|
event.preventDefault();
|
|
break;
|
|
}
|
|
|
|
case KeyCode["a" /* default */].DOWN:
|
|
{
|
|
_this.offsetActiveKey(1);
|
|
|
|
event.preventDefault();
|
|
break;
|
|
}
|
|
} // >>>>>>>>>> Expand & Selection
|
|
|
|
|
|
var activeItem = _this.getActiveItem();
|
|
|
|
if (activeItem && activeItem.data) {
|
|
var treeNodeRequiredProps = _this.getTreeNodeRequiredProps();
|
|
|
|
var expandable = activeItem.data.isLeaf === false || !!(activeItem.data.children || []).length;
|
|
var eventNode = Object(treeUtil["b" /* convertNodePropsToEventData */])(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, Object(treeUtil["f" /* getTreeNodeProps */])(activeKey, treeNodeRequiredProps)), {}, {
|
|
data: activeItem.data,
|
|
active: true
|
|
}));
|
|
|
|
switch (event.which) {
|
|
// >>> Expand
|
|
case KeyCode["a" /* default */].LEFT:
|
|
{
|
|
// Collapse if possible
|
|
if (expandable && expandedKeys.includes(activeKey)) {
|
|
_this.onNodeExpand({}, eventNode);
|
|
} else if (activeItem.parent) {
|
|
_this.onActiveChange(activeItem.parent.data.key);
|
|
}
|
|
|
|
event.preventDefault();
|
|
break;
|
|
}
|
|
|
|
case KeyCode["a" /* default */].RIGHT:
|
|
{
|
|
// Expand if possible
|
|
if (expandable && !expandedKeys.includes(activeKey)) {
|
|
_this.onNodeExpand({}, eventNode);
|
|
} else if (activeItem.children && activeItem.children.length) {
|
|
_this.onActiveChange(activeItem.children[0].data.key);
|
|
}
|
|
|
|
event.preventDefault();
|
|
break;
|
|
}
|
|
// Selection
|
|
|
|
case KeyCode["a" /* default */].ENTER:
|
|
case KeyCode["a" /* default */].SPACE:
|
|
{
|
|
if (checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox) {
|
|
_this.onNodeCheck({}, eventNode, !checkedKeys.includes(activeKey));
|
|
} else if (!checkable && selectable && !eventNode.disabled && eventNode.selectable !== false) {
|
|
_this.onNodeSelect({}, eventNode);
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (onKeyDown) {
|
|
onKeyDown(event);
|
|
}
|
|
};
|
|
/**
|
|
* Only update the value which is not in props
|
|
*/
|
|
|
|
|
|
_this.setUncontrolledState = function (state) {
|
|
var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
var forceState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
|
|
if (_this.destroyed) {
|
|
return;
|
|
}
|
|
|
|
var needSync = false;
|
|
var allPassed = true;
|
|
var newState = {};
|
|
Object.keys(state).forEach(function (name) {
|
|
if (name in _this.props) {
|
|
allPassed = false;
|
|
return;
|
|
}
|
|
|
|
needSync = true;
|
|
newState[name] = state[name];
|
|
});
|
|
|
|
if (needSync && (!atomic || allPassed)) {
|
|
_this.setState(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, newState), forceState));
|
|
}
|
|
};
|
|
|
|
_this.scrollTo = function (scroll) {
|
|
_this.listRef.current.scrollTo(scroll);
|
|
};
|
|
|
|
return _this;
|
|
}
|
|
|
|
Object(createClass["a" /* default */])(Tree, [{
|
|
key: "componentWillUnmount",
|
|
value: function componentWillUnmount() {
|
|
this.destroyed = true;
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
var _classNames;
|
|
|
|
var _this$state10 = this.state,
|
|
focused = _this$state10.focused,
|
|
flattenNodes = _this$state10.flattenNodes,
|
|
keyEntities = _this$state10.keyEntities,
|
|
dragging = _this$state10.dragging,
|
|
activeKey = _this$state10.activeKey;
|
|
var _this$props6 = this.props,
|
|
prefixCls = _this$props6.prefixCls,
|
|
className = _this$props6.className,
|
|
style = _this$props6.style,
|
|
showLine = _this$props6.showLine,
|
|
focusable = _this$props6.focusable,
|
|
_this$props6$tabIndex = _this$props6.tabIndex,
|
|
tabIndex = _this$props6$tabIndex === void 0 ? 0 : _this$props6$tabIndex,
|
|
selectable = _this$props6.selectable,
|
|
showIcon = _this$props6.showIcon,
|
|
icon = _this$props6.icon,
|
|
switcherIcon = _this$props6.switcherIcon,
|
|
draggable = _this$props6.draggable,
|
|
checkable = _this$props6.checkable,
|
|
checkStrictly = _this$props6.checkStrictly,
|
|
disabled = _this$props6.disabled,
|
|
motion = _this$props6.motion,
|
|
loadData = _this$props6.loadData,
|
|
filterTreeNode = _this$props6.filterTreeNode,
|
|
height = _this$props6.height,
|
|
itemHeight = _this$props6.itemHeight,
|
|
virtual = _this$props6.virtual,
|
|
titleRender = _this$props6.titleRender,
|
|
onContextMenu = _this$props6.onContextMenu;
|
|
var domProps = Object(util["f" /* getDataAndAria */])(this.props);
|
|
return external_window_React_["createElement"](contextTypes["a" /* TreeContext */].Provider, {
|
|
value: {
|
|
prefixCls: prefixCls,
|
|
selectable: selectable,
|
|
showIcon: showIcon,
|
|
icon: icon,
|
|
switcherIcon: switcherIcon,
|
|
draggable: draggable,
|
|
checkable: checkable,
|
|
checkStrictly: checkStrictly,
|
|
disabled: disabled,
|
|
keyEntities: keyEntities,
|
|
loadData: loadData,
|
|
filterTreeNode: filterTreeNode,
|
|
titleRender: titleRender,
|
|
onNodeClick: this.onNodeClick,
|
|
onNodeDoubleClick: this.onNodeDoubleClick,
|
|
onNodeExpand: this.onNodeExpand,
|
|
onNodeSelect: this.onNodeSelect,
|
|
onNodeCheck: this.onNodeCheck,
|
|
onNodeLoad: this.onNodeLoad,
|
|
onNodeMouseEnter: this.onNodeMouseEnter,
|
|
onNodeMouseLeave: this.onNodeMouseLeave,
|
|
onNodeContextMenu: this.onNodeContextMenu,
|
|
onNodeDragStart: this.onNodeDragStart,
|
|
onNodeDragEnter: this.onNodeDragEnter,
|
|
onNodeDragOver: this.onNodeDragOver,
|
|
onNodeDragLeave: this.onNodeDragLeave,
|
|
onNodeDragEnd: this.onNodeDragEnd,
|
|
onNodeDrop: this.onNodeDrop
|
|
}
|
|
}, external_window_React_["createElement"]("div", {
|
|
className: classnames_default()(prefixCls, className, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-show-line"), showLine), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-focused"), focused), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-active-focused"), activeKey !== null), _classNames))
|
|
}, external_window_React_["createElement"](es_NodeList, Object.assign({
|
|
ref: this.listRef,
|
|
prefixCls: prefixCls,
|
|
style: style,
|
|
data: flattenNodes,
|
|
disabled: disabled,
|
|
selectable: selectable,
|
|
checkable: !!checkable,
|
|
motion: motion,
|
|
dragging: dragging,
|
|
height: height,
|
|
itemHeight: itemHeight,
|
|
virtual: virtual,
|
|
focusable: focusable,
|
|
focused: focused,
|
|
tabIndex: tabIndex,
|
|
activeItem: this.getActiveItem(),
|
|
onFocus: this.onFocus,
|
|
onBlur: this.onBlur,
|
|
onKeyDown: this.onKeyDown,
|
|
onActiveChange: this.onActiveChange,
|
|
onListChangeStart: this.onListChangeStart,
|
|
onListChangeEnd: this.onListChangeEnd,
|
|
onContextMenu: onContextMenu
|
|
}, this.getTreeNodeRequiredProps(), domProps))));
|
|
}
|
|
}], [{
|
|
key: "getDerivedStateFromProps",
|
|
value: function getDerivedStateFromProps(props, prevState) {
|
|
var prevProps = prevState.prevProps;
|
|
var newState = {
|
|
prevProps: props
|
|
};
|
|
|
|
function needSync(name) {
|
|
return !prevProps && name in props || prevProps && prevProps[name] !== props[name];
|
|
} // ================== Tree Node ==================
|
|
|
|
|
|
var treeData; // Check if `treeData` or `children` changed and save into the state.
|
|
|
|
if (needSync('treeData')) {
|
|
treeData = props.treeData;
|
|
} else if (needSync('children')) {
|
|
Object(warning["a" /* default */])(false, '`children` of Tree is deprecated. Please use `treeData` instead.');
|
|
treeData = Object(treeUtil["c" /* convertTreeToData */])(props.children);
|
|
} // Save flatten nodes info and convert `treeData` into keyEntities
|
|
|
|
|
|
if (treeData) {
|
|
newState.treeData = treeData;
|
|
var entitiesMap = Object(treeUtil["a" /* convertDataToEntities */])(treeData);
|
|
newState.keyEntities = Object(objectSpread2["a" /* default */])(Object(defineProperty["a" /* default */])({}, MOTION_KEY, MotionEntity), entitiesMap.keyEntities); // Warning if treeNode not provide key
|
|
|
|
if (false) {}
|
|
}
|
|
|
|
var keyEntities = newState.keyEntities || prevState.keyEntities; // ================ expandedKeys =================
|
|
|
|
if (needSync('expandedKeys') || prevProps && needSync('autoExpandParent')) {
|
|
newState.expandedKeys = props.autoExpandParent || !prevProps && props.defaultExpandParent ? Object(util["e" /* conductExpandParent */])(props.expandedKeys, keyEntities) : props.expandedKeys;
|
|
} else if (!prevProps && props.defaultExpandAll) {
|
|
var cloneKeyEntities = Object(objectSpread2["a" /* default */])({}, keyEntities);
|
|
|
|
delete cloneKeyEntities[MOTION_KEY];
|
|
newState.expandedKeys = Object.keys(cloneKeyEntities).map(function (key) {
|
|
return cloneKeyEntities[key].key;
|
|
});
|
|
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? Object(util["e" /* conductExpandParent */])(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;
|
|
}
|
|
|
|
if (!newState.expandedKeys) {
|
|
delete newState.expandedKeys;
|
|
} // ================ flattenNodes =================
|
|
|
|
|
|
if (treeData || newState.expandedKeys) {
|
|
var flattenNodes = Object(treeUtil["d" /* flattenTreeData */])(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys);
|
|
newState.flattenNodes = flattenNodes;
|
|
} // ================ selectedKeys =================
|
|
|
|
|
|
if (props.selectable) {
|
|
if (needSync('selectedKeys')) {
|
|
newState.selectedKeys = Object(util["d" /* calcSelectedKeys */])(props.selectedKeys, props);
|
|
} else if (!prevProps && props.defaultSelectedKeys) {
|
|
newState.selectedKeys = Object(util["d" /* calcSelectedKeys */])(props.defaultSelectedKeys, props);
|
|
}
|
|
} // ================= checkedKeys =================
|
|
|
|
|
|
if (props.checkable) {
|
|
var checkedKeyEntity;
|
|
|
|
if (needSync('checkedKeys')) {
|
|
checkedKeyEntity = Object(util["j" /* parseCheckedKeys */])(props.checkedKeys) || {};
|
|
} else if (!prevProps && props.defaultCheckedKeys) {
|
|
checkedKeyEntity = Object(util["j" /* parseCheckedKeys */])(props.defaultCheckedKeys) || {};
|
|
} else if (treeData) {
|
|
// If `treeData` changed, we also need check it
|
|
checkedKeyEntity = Object(util["j" /* parseCheckedKeys */])(props.checkedKeys) || {
|
|
checkedKeys: prevState.checkedKeys,
|
|
halfCheckedKeys: prevState.halfCheckedKeys
|
|
};
|
|
}
|
|
|
|
if (checkedKeyEntity) {
|
|
var _checkedKeyEntity = checkedKeyEntity,
|
|
_checkedKeyEntity$che = _checkedKeyEntity.checkedKeys,
|
|
checkedKeys = _checkedKeyEntity$che === void 0 ? [] : _checkedKeyEntity$che,
|
|
_checkedKeyEntity$hal = _checkedKeyEntity.halfCheckedKeys,
|
|
halfCheckedKeys = _checkedKeyEntity$hal === void 0 ? [] : _checkedKeyEntity$hal;
|
|
|
|
if (!props.checkStrictly) {
|
|
var conductKeys = Object(conductUtil["a" /* conductCheck */])(checkedKeys, true, keyEntities);
|
|
checkedKeys = conductKeys.checkedKeys;
|
|
halfCheckedKeys = conductKeys.halfCheckedKeys;
|
|
}
|
|
|
|
newState.checkedKeys = checkedKeys;
|
|
newState.halfCheckedKeys = halfCheckedKeys;
|
|
}
|
|
} // ================= loadedKeys ==================
|
|
|
|
|
|
if (needSync('loadedKeys')) {
|
|
newState.loadedKeys = props.loadedKeys;
|
|
}
|
|
|
|
return newState;
|
|
}
|
|
}]);
|
|
|
|
return Tree;
|
|
}(external_window_React_["Component"]);
|
|
|
|
Tree_Tree.defaultProps = {
|
|
prefixCls: 'rc-tree',
|
|
showLine: false,
|
|
showIcon: true,
|
|
selectable: true,
|
|
multiple: false,
|
|
checkable: false,
|
|
disabled: false,
|
|
checkStrictly: false,
|
|
draggable: false,
|
|
defaultExpandParent: true,
|
|
autoExpandParent: false,
|
|
defaultExpandAll: false,
|
|
defaultExpandedKeys: [],
|
|
defaultCheckedKeys: [],
|
|
defaultSelectedKeys: []
|
|
};
|
|
Tree_Tree.TreeNode = TreeNode["a" /* default */];
|
|
/* harmony default export */ var es_Tree = (Tree_Tree);
|
|
// CONCATENATED MODULE: ./node_modules/rc-tree/es/index.js
|
|
|
|
|
|
|
|
/* harmony default export */ var rc_tree_es = __webpack_exports__["b"] = (es_Tree);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "fyJ8":
|
|
/*!************************************************!*\
|
|
!*** ./node_modules/rc-table/es/Cell/index.js ***!
|
|
\************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "rePB");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "VTBJ");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "Ff2n");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "U8pU");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! classnames */ "TSYQ");
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_5__);
|
|
/* harmony import */ var rc_util_es_ref__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rc-util/es/ref */ "c+Xe");
|
|
/* harmony import */ var _utils_valueUtil__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/valueUtil */ "sR1s");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isRenderCell(data) {
|
|
return data && Object(_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(data) === 'object' && !Array.isArray(data) && !react__WEBPACK_IMPORTED_MODULE_4__["isValidElement"](data);
|
|
}
|
|
|
|
function isRefComponent(component) {
|
|
// String tag component also support ref
|
|
if (typeof component === 'string') {
|
|
return true;
|
|
}
|
|
|
|
return Object(rc_util_es_ref__WEBPACK_IMPORTED_MODULE_6__[/* supportRef */ "c"])(component);
|
|
}
|
|
|
|
function Cell(_ref, ref) {
|
|
var _classNames;
|
|
|
|
var prefixCls = _ref.prefixCls,
|
|
className = _ref.className,
|
|
record = _ref.record,
|
|
index = _ref.index,
|
|
dataIndex = _ref.dataIndex,
|
|
render = _ref.render,
|
|
children = _ref.children,
|
|
_ref$component = _ref.component,
|
|
Component = _ref$component === void 0 ? 'td' : _ref$component,
|
|
colSpan = _ref.colSpan,
|
|
rowSpan = _ref.rowSpan,
|
|
fixLeft = _ref.fixLeft,
|
|
fixRight = _ref.fixRight,
|
|
firstFixLeft = _ref.firstFixLeft,
|
|
lastFixLeft = _ref.lastFixLeft,
|
|
firstFixRight = _ref.firstFixRight,
|
|
lastFixRight = _ref.lastFixRight,
|
|
appendNode = _ref.appendNode,
|
|
_ref$additionalProps = _ref.additionalProps,
|
|
additionalProps = _ref$additionalProps === void 0 ? {} : _ref$additionalProps,
|
|
ellipsis = _ref.ellipsis,
|
|
align = _ref.align,
|
|
rowType = _ref.rowType,
|
|
isSticky = _ref.isSticky;
|
|
var cellPrefixCls = "".concat(prefixCls, "-cell"); // ==================== Child Node ====================
|
|
|
|
var cellProps;
|
|
var childNode;
|
|
|
|
if (children) {
|
|
childNode = children;
|
|
} else {
|
|
var value = Object(_utils_valueUtil__WEBPACK_IMPORTED_MODULE_7__[/* getPathValue */ "b"])(record, dataIndex); // Customize render node
|
|
|
|
childNode = value;
|
|
|
|
if (render) {
|
|
var renderData = render(value, record, index);
|
|
|
|
if (isRenderCell(renderData)) {
|
|
childNode = renderData.children;
|
|
cellProps = renderData.props;
|
|
} else {
|
|
childNode = renderData;
|
|
}
|
|
}
|
|
} // Not crash if final `childNode` is not validate ReactNode
|
|
|
|
|
|
if (Object(_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(childNode) === 'object' && !Array.isArray(childNode) && !react__WEBPACK_IMPORTED_MODULE_4__["isValidElement"](childNode)) {
|
|
childNode = null;
|
|
}
|
|
|
|
if (ellipsis && (lastFixLeft || firstFixRight)) {
|
|
childNode = react__WEBPACK_IMPORTED_MODULE_4__["createElement"]("span", {
|
|
className: "".concat(cellPrefixCls, "-content")
|
|
}, childNode);
|
|
}
|
|
|
|
var _ref2 = cellProps || {},
|
|
cellColSpan = _ref2.colSpan,
|
|
cellRowSpan = _ref2.rowSpan,
|
|
cellStyle = _ref2.style,
|
|
cellClassName = _ref2.className,
|
|
restCellProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_ref2, ["colSpan", "rowSpan", "style", "className"]);
|
|
|
|
var mergedColSpan = cellColSpan !== undefined ? cellColSpan : colSpan;
|
|
var mergedRowSpan = cellRowSpan !== undefined ? cellRowSpan : rowSpan;
|
|
|
|
if (mergedColSpan === 0 || mergedRowSpan === 0) {
|
|
return null;
|
|
} // ====================== Fixed =======================
|
|
|
|
|
|
var fixedStyle = {};
|
|
var isFixLeft = typeof fixLeft === 'number';
|
|
var isFixRight = typeof fixRight === 'number';
|
|
|
|
if (isFixLeft) {
|
|
fixedStyle.position = 'sticky';
|
|
fixedStyle.left = fixLeft;
|
|
}
|
|
|
|
if (isFixRight) {
|
|
fixedStyle.position = 'sticky';
|
|
fixedStyle.right = fixRight;
|
|
} // ====================== Align =======================
|
|
|
|
|
|
var alignStyle = {};
|
|
|
|
if (align) {
|
|
alignStyle.textAlign = align;
|
|
} // ====================== Render ======================
|
|
|
|
|
|
var title;
|
|
var ellipsisConfig = ellipsis === true ? {
|
|
showTitle: true
|
|
} : ellipsis;
|
|
|
|
if (ellipsisConfig && (ellipsisConfig.showTitle || rowType === 'header')) {
|
|
if (typeof childNode === 'string' || typeof childNode === 'number') {
|
|
title = childNode.toString();
|
|
} else if (react__WEBPACK_IMPORTED_MODULE_4__["isValidElement"](childNode) && typeof childNode.props.children === 'string') {
|
|
title = childNode.props.children;
|
|
}
|
|
}
|
|
|
|
var componentProps = Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({
|
|
title: title
|
|
}, restCellProps), additionalProps), {}, {
|
|
colSpan: mergedColSpan && mergedColSpan !== 1 ? mergedColSpan : null,
|
|
rowSpan: mergedRowSpan && mergedRowSpan !== 1 ? mergedRowSpan : null,
|
|
className: classnames__WEBPACK_IMPORTED_MODULE_5___default()(cellPrefixCls, className, (_classNames = {}, Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-fix-left"), isFixLeft), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-fix-left-first"), firstFixLeft), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-fix-left-last"), lastFixLeft), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-fix-right"), isFixRight), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-fix-right-first"), firstFixRight), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-fix-right-last"), lastFixRight), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-ellipsis"), ellipsis), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-with-append"), appendNode), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classNames, "".concat(cellPrefixCls, "-fix-sticky"), (isFixLeft || isFixRight) && isSticky), _classNames), additionalProps.className, cellClassName),
|
|
style: Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({}, additionalProps.style), alignStyle), fixedStyle), cellStyle),
|
|
ref: isRefComponent(Component) ? ref : null
|
|
});
|
|
|
|
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](Component, Object.assign({}, componentProps), appendNode, childNode);
|
|
}
|
|
|
|
var RefCell = react__WEBPACK_IMPORTED_MODULE_4__["forwardRef"](Cell);
|
|
RefCell.displayName = 'Cell';
|
|
var MemoCell = react__WEBPACK_IMPORTED_MODULE_4__["memo"](RefCell, function (prev, next) {
|
|
if (next.shouldCellUpdate) {
|
|
return !next.shouldCellUpdate(next.record, prev.record);
|
|
}
|
|
|
|
return false;
|
|
});
|
|
/* harmony default export */ __webpack_exports__["a"] = (MemoCell);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "h78n":
|
|
/*!**********************************************************!*\
|
|
!*** ./node_modules/rc-progress/es/index.js + 3 modules ***!
|
|
\**********************************************************/
|
|
/*! exports provided: Line, Circle, default */
|
|
/*! exports used: Circle */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ es_Circle; });
|
|
|
|
// UNUSED EXPORTS: Line
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-progress/es/common.js
|
|
|
|
var defaultProps = {
|
|
className: '',
|
|
percent: 0,
|
|
prefixCls: 'rc-progress',
|
|
strokeColor: '#2db7f5',
|
|
strokeLinecap: 'round',
|
|
strokeWidth: 1,
|
|
style: {},
|
|
trailColor: '#D9D9D9',
|
|
trailWidth: 1
|
|
};
|
|
var common_useTransitionDuration = function useTransitionDuration(percentList) {
|
|
var paths = percentList.map(function () {
|
|
return Object(external_window_React_["useRef"])();
|
|
});
|
|
var prevTimeStamp = Object(external_window_React_["useRef"])();
|
|
Object(external_window_React_["useEffect"])(function () {
|
|
var now = Date.now();
|
|
var updated = false;
|
|
Object.keys(paths).forEach(function (key) {
|
|
var path = paths[key].current;
|
|
|
|
if (!path) {
|
|
return;
|
|
}
|
|
|
|
updated = true;
|
|
var pathStyle = path.style;
|
|
pathStyle.transitionDuration = '.3s, .3s, .3s, .06s';
|
|
|
|
if (prevTimeStamp.current && now - prevTimeStamp.current < 100) {
|
|
pathStyle.transitionDuration = '0s, 0s';
|
|
}
|
|
});
|
|
|
|
if (updated) {
|
|
prevTimeStamp.current = Date.now();
|
|
}
|
|
});
|
|
return [paths];
|
|
};
|
|
// CONCATENATED MODULE: ./node_modules/rc-progress/es/Line.js
|
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
|
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
|
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
|
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
|
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
|
|
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
|
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
|
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
|
|
/* eslint react/prop-types: 0 */
|
|
|
|
|
|
|
|
|
|
var Line_Line = function Line(_ref) {
|
|
var className = _ref.className,
|
|
percent = _ref.percent,
|
|
prefixCls = _ref.prefixCls,
|
|
strokeColor = _ref.strokeColor,
|
|
strokeLinecap = _ref.strokeLinecap,
|
|
strokeWidth = _ref.strokeWidth,
|
|
style = _ref.style,
|
|
trailColor = _ref.trailColor,
|
|
trailWidth = _ref.trailWidth,
|
|
transition = _ref.transition,
|
|
restProps = _objectWithoutProperties(_ref, ["className", "percent", "prefixCls", "strokeColor", "strokeLinecap", "strokeWidth", "style", "trailColor", "trailWidth", "transition"]);
|
|
|
|
delete restProps.gapPosition;
|
|
var percentList = Array.isArray(percent) ? percent : [percent];
|
|
var strokeColorList = Array.isArray(strokeColor) ? strokeColor : [strokeColor];
|
|
|
|
var _useTransitionDuratio = common_useTransitionDuration(percentList),
|
|
_useTransitionDuratio2 = _slicedToArray(_useTransitionDuratio, 1),
|
|
paths = _useTransitionDuratio2[0];
|
|
|
|
var center = strokeWidth / 2;
|
|
var right = 100 - strokeWidth / 2;
|
|
var pathString = "M ".concat(strokeLinecap === 'round' ? center : 0, ",").concat(center, "\n L ").concat(strokeLinecap === 'round' ? right : 100, ",").concat(center);
|
|
var viewBoxString = "0 0 100 ".concat(strokeWidth);
|
|
var stackPtg = 0;
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("svg", _extends({
|
|
className: classnames_default()("".concat(prefixCls, "-line"), className),
|
|
viewBox: viewBoxString,
|
|
preserveAspectRatio: "none",
|
|
style: style
|
|
}, restProps), /*#__PURE__*/external_window_React_default.a.createElement("path", {
|
|
className: "".concat(prefixCls, "-line-trail"),
|
|
d: pathString,
|
|
strokeLinecap: strokeLinecap,
|
|
stroke: trailColor,
|
|
strokeWidth: trailWidth || strokeWidth,
|
|
fillOpacity: "0"
|
|
}), percentList.map(function (ptg, index) {
|
|
var pathStyle = {
|
|
strokeDasharray: "".concat(ptg, "px, 100px"),
|
|
strokeDashoffset: "-".concat(stackPtg, "px"),
|
|
transition: transition || 'stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear'
|
|
};
|
|
var color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1];
|
|
stackPtg += ptg;
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("path", {
|
|
key: index,
|
|
className: "".concat(prefixCls, "-line-path"),
|
|
d: pathString,
|
|
strokeLinecap: strokeLinecap,
|
|
stroke: color,
|
|
strokeWidth: strokeWidth,
|
|
fillOpacity: "0",
|
|
ref: paths[index],
|
|
style: pathStyle
|
|
});
|
|
}));
|
|
};
|
|
|
|
Line_Line.defaultProps = defaultProps;
|
|
/* harmony default export */ var es_Line = (Line_Line);
|
|
// CONCATENATED MODULE: ./node_modules/rc-progress/es/Circle.js
|
|
function Circle_extends() { Circle_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Circle_extends.apply(this, arguments); }
|
|
|
|
function Circle_slicedToArray(arr, i) { return Circle_arrayWithHoles(arr) || Circle_iterableToArrayLimit(arr, i) || Circle_unsupportedIterableToArray(arr, i) || Circle_nonIterableRest(); }
|
|
|
|
function Circle_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
|
|
function Circle_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Circle_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Circle_arrayLikeToArray(o, minLen); }
|
|
|
|
function Circle_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
|
|
function Circle_iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
|
|
function Circle_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
|
function Circle_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Circle_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
|
|
function Circle_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
|
|
/* eslint react/prop-types: 0 */
|
|
|
|
|
|
|
|
var gradientSeed = 0;
|
|
|
|
function stripPercentToNumber(percent) {
|
|
return +percent.replace('%', '');
|
|
}
|
|
|
|
function toArray(symArray) {
|
|
return Array.isArray(symArray) ? symArray : [symArray];
|
|
}
|
|
|
|
function getPathStyles(offset, percent, strokeColor, strokeWidth) {
|
|
var gapDegree = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
var gapPosition = arguments.length > 5 ? arguments[5] : undefined;
|
|
var radius = 50 - strokeWidth / 2;
|
|
var beginPositionX = 0;
|
|
var beginPositionY = -radius;
|
|
var endPositionX = 0;
|
|
var endPositionY = -2 * radius;
|
|
|
|
switch (gapPosition) {
|
|
case 'left':
|
|
beginPositionX = -radius;
|
|
beginPositionY = 0;
|
|
endPositionX = 2 * radius;
|
|
endPositionY = 0;
|
|
break;
|
|
|
|
case 'right':
|
|
beginPositionX = radius;
|
|
beginPositionY = 0;
|
|
endPositionX = -2 * radius;
|
|
endPositionY = 0;
|
|
break;
|
|
|
|
case 'bottom':
|
|
beginPositionY = radius;
|
|
endPositionY = 2 * radius;
|
|
break;
|
|
|
|
default:
|
|
}
|
|
|
|
var pathString = "M 50,50 m ".concat(beginPositionX, ",").concat(beginPositionY, "\n a ").concat(radius, ",").concat(radius, " 0 1 1 ").concat(endPositionX, ",").concat(-endPositionY, "\n a ").concat(radius, ",").concat(radius, " 0 1 1 ").concat(-endPositionX, ",").concat(endPositionY);
|
|
var len = Math.PI * 2 * radius;
|
|
var pathStyle = {
|
|
stroke: strokeColor,
|
|
strokeDasharray: "".concat(percent / 100 * (len - gapDegree), "px ").concat(len, "px"),
|
|
strokeDashoffset: "-".concat(gapDegree / 2 + offset / 100 * (len - gapDegree), "px"),
|
|
transition: 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s' // eslint-disable-line
|
|
|
|
};
|
|
return {
|
|
pathString: pathString,
|
|
pathStyle: pathStyle
|
|
};
|
|
}
|
|
|
|
var Circle_Circle = function Circle(_ref) {
|
|
var prefixCls = _ref.prefixCls,
|
|
strokeWidth = _ref.strokeWidth,
|
|
trailWidth = _ref.trailWidth,
|
|
gapDegree = _ref.gapDegree,
|
|
gapPosition = _ref.gapPosition,
|
|
trailColor = _ref.trailColor,
|
|
strokeLinecap = _ref.strokeLinecap,
|
|
style = _ref.style,
|
|
className = _ref.className,
|
|
strokeColor = _ref.strokeColor,
|
|
percent = _ref.percent,
|
|
restProps = Circle_objectWithoutProperties(_ref, ["prefixCls", "strokeWidth", "trailWidth", "gapDegree", "gapPosition", "trailColor", "strokeLinecap", "style", "className", "strokeColor", "percent"]);
|
|
|
|
var gradientId = Object(external_window_React_["useMemo"])(function () {
|
|
gradientSeed += 1;
|
|
return gradientSeed;
|
|
}, []);
|
|
|
|
var _getPathStyles = getPathStyles(0, 100, trailColor, strokeWidth, gapDegree, gapPosition),
|
|
pathString = _getPathStyles.pathString,
|
|
pathStyle = _getPathStyles.pathStyle;
|
|
|
|
var percentList = toArray(percent);
|
|
var strokeColorList = toArray(strokeColor);
|
|
var gradient = strokeColorList.find(function (color) {
|
|
return Object.prototype.toString.call(color) === '[object Object]';
|
|
});
|
|
|
|
var _useTransitionDuratio = common_useTransitionDuration(percentList),
|
|
_useTransitionDuratio2 = Circle_slicedToArray(_useTransitionDuratio, 1),
|
|
paths = _useTransitionDuratio2[0];
|
|
|
|
var getStokeList = function getStokeList() {
|
|
var stackPtg = 0;
|
|
return percentList.map(function (ptg, index) {
|
|
var color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1];
|
|
var stroke = Object.prototype.toString.call(color) === '[object Object]' ? "url(#".concat(prefixCls, "-gradient-").concat(gradientId, ")") : '';
|
|
var pathStyles = getPathStyles(stackPtg, ptg, color, strokeWidth, gapDegree, gapPosition);
|
|
stackPtg += ptg;
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("path", {
|
|
key: index,
|
|
className: "".concat(prefixCls, "-circle-path"),
|
|
d: pathStyles.pathString,
|
|
stroke: stroke,
|
|
strokeLinecap: strokeLinecap,
|
|
strokeWidth: strokeWidth,
|
|
opacity: ptg === 0 ? 0 : 1,
|
|
fillOpacity: "0",
|
|
style: pathStyles.pathStyle,
|
|
ref: paths[index]
|
|
});
|
|
});
|
|
};
|
|
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("svg", Circle_extends({
|
|
className: classnames_default()("".concat(prefixCls, "-circle"), className),
|
|
viewBox: "0 0 100 100",
|
|
style: style
|
|
}, restProps), gradient && /*#__PURE__*/external_window_React_default.a.createElement("defs", null, /*#__PURE__*/external_window_React_default.a.createElement("linearGradient", {
|
|
id: "".concat(prefixCls, "-gradient-").concat(gradientId),
|
|
x1: "100%",
|
|
y1: "0%",
|
|
x2: "0%",
|
|
y2: "0%"
|
|
}, Object.keys(gradient).sort(function (a, b) {
|
|
return stripPercentToNumber(a) - stripPercentToNumber(b);
|
|
}).map(function (key, index) {
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("stop", {
|
|
key: index,
|
|
offset: key,
|
|
stopColor: gradient[key]
|
|
});
|
|
}))), /*#__PURE__*/external_window_React_default.a.createElement("path", {
|
|
className: "".concat(prefixCls, "-circle-trail"),
|
|
d: pathString,
|
|
stroke: trailColor,
|
|
strokeLinecap: strokeLinecap,
|
|
strokeWidth: trailWidth || strokeWidth,
|
|
fillOpacity: "0",
|
|
style: pathStyle
|
|
}), getStokeList().reverse());
|
|
};
|
|
|
|
Circle_Circle.defaultProps = defaultProps;
|
|
/* harmony default export */ var es_Circle = (Circle_Circle);
|
|
// CONCATENATED MODULE: ./node_modules/rc-progress/es/index.js
|
|
|
|
|
|
|
|
/* harmony default export */ var es = ({
|
|
Line: es_Line,
|
|
Circle: es_Circle
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ "hW8S":
|
|
/*!******************************************************!*\
|
|
!*** ./node_modules/rc-table/es/utils/legacyUtil.js ***!
|
|
\******************************************************/
|
|
/*! exports provided: INTERNAL_COL_DEFINE, getExpandableProps, getDataAndAriaProps */
|
|
/*! exports used: INTERNAL_COL_DEFINE, getDataAndAriaProps, getExpandableProps */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return INTERNAL_COL_DEFINE; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getExpandableProps; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getDataAndAriaProps; });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "VTBJ");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "Ff2n");
|
|
/* harmony import */ var rc_util_es_warning__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rc-util/es/warning */ "Kwbf");
|
|
|
|
|
|
|
|
var INTERNAL_COL_DEFINE = 'RC_TABLE_INTERNAL_COL_DEFINE';
|
|
function getExpandableProps(props) {
|
|
var expandable = props.expandable,
|
|
legacyExpandableConfig = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(props, ["expandable"]);
|
|
|
|
if ('expandable' in props) {
|
|
return Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, legacyExpandableConfig), expandable);
|
|
}
|
|
|
|
if (false) {}
|
|
|
|
return legacyExpandableConfig;
|
|
}
|
|
/**
|
|
* Returns only data- and aria- key/value pairs
|
|
* @param {object} props
|
|
*/
|
|
|
|
function getDataAndAriaProps(props) {
|
|
/* eslint-disable no-param-reassign */
|
|
return Object.keys(props).reduce(function (memo, key) {
|
|
if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-') {
|
|
memo[key] = props[key];
|
|
}
|
|
|
|
return memo;
|
|
}, {});
|
|
/* eslint-enable */
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "lx6N":
|
|
/*!**********************************************!*\
|
|
!*** ./src/components/ExportCount/index.tsx ***!
|
|
\**********************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var antd_es_modal_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/modal/style */ "2qtc");
|
|
/* harmony import */ var antd_es_modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/modal */ "kLXV");
|
|
/* harmony import */ var antd_es_button_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/button/style */ "+L6B");
|
|
/* harmony import */ var antd_es_button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd/es/button */ "2/Rp");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
|
|
|
|
|
|
|
//首页广告弹窗
|
|
|
|
|
|
function Advertisement(_ref) {
|
|
var res = _ref.res,
|
|
ismodel = _ref.ismodel,
|
|
setismodel = _ref.setismodel;
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(antd_es_modal__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
|
|
visible: ismodel,
|
|
title: "提示",
|
|
footer: null,
|
|
style: {
|
|
background: "transparen"
|
|
},
|
|
centered: true,
|
|
width: 670,
|
|
maskClosable: false // closable={false}
|
|
|
|
}, res === null || res === void 0 ? void 0 : res.message, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement("div", {
|
|
style: {
|
|
textAlign: 'right'
|
|
}
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], {
|
|
onClick: function onClick() {
|
|
setismodel(false);
|
|
},
|
|
type: "primary"
|
|
}, "\u786E\u8BA4")));
|
|
}
|
|
|
|
/* harmony default export */ __webpack_exports__["a"] = (Advertisement);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "mgmH":
|
|
/*!*****************************!*\
|
|
!*** ./src/utils/export.ts ***!
|
|
\*****************************/
|
|
/*! exports provided: ExportCourseInfo, ExportCourseActScore, ExportCourseMemberScores, ExportCourseAndOther, exportMoocrecord, ExportCourseTotalScore, ExportCourseWorkListScores, ExportCourseWorkListAppendix, ExportPollsScores, ExportAttendance, ExportVideoStudent, ExportCourseStudentsInfo, ExportProblemset, Exportcompetitions, ExportExerciseStudentScores, getDownFile, getecyears, getec_training_objectives, getec_graduation_requirements */
|
|
/*! exports used: ExportAttendance, ExportCourseActScore, ExportCourseAndOther, ExportCourseInfo, ExportCourseMemberScores, ExportCourseStudentsInfo, ExportCourseTotalScore, ExportCourseWorkListScores, ExportExerciseStudentScores, ExportPollsScores, ExportProblemset, ExportVideoStudent, Exportcompetitions, exportMoocrecord, getDownFile, getec_graduation_requirements, getec_training_objectives, getecyears */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ExportCourseInfo; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ExportCourseActScore; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ExportCourseMemberScores; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ExportCourseAndOther; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return exportMoocrecord; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return ExportCourseTotalScore; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return ExportCourseWorkListScores; });
|
|
/* unused harmony export ExportCourseWorkListAppendix */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return ExportPollsScores; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ExportAttendance; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return ExportVideoStudent; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return ExportCourseStudentsInfo; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return ExportProblemset; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Exportcompetitions; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return ExportExerciseStudentScores; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return getDownFile; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return getecyears; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return getec_training_objectives; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return getec_graduation_requirements; });
|
|
/* harmony import */ var antd_es_message_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/message/style */ "miYZ");
|
|
/* harmony import */ var antd_es_message__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/message */ "tsqr");
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */ "k1fw");
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */ "9og8");
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */ "WmNS");
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4__);
|
|
/* harmony import */ var _service_classrooms__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/service/classrooms */ "oUNq");
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! umi */ "9kvl");
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util */ "1vsH");
|
|
/* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./env */ "m3rI");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var showLoading = function showLoading() {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'globalSetting/setGlobalLoading',
|
|
payload: {
|
|
show: true,
|
|
text: '正在生成文件,请稍后...'
|
|
}
|
|
});
|
|
};
|
|
|
|
var hideLoading = function hideLoading() {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'globalSetting/setGlobalLoading',
|
|
payload: {
|
|
show: false,
|
|
text: ''
|
|
}
|
|
});
|
|
};
|
|
|
|
var ExportCourseInfo = /*#__PURE__*/function () {
|
|
var _ref = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
showLoading();
|
|
_context.next = 3;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportCourseInfo */ "s"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 3:
|
|
res = _context.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context.next = 7;
|
|
break;
|
|
}
|
|
|
|
_context.next = 7;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFileIframe */ "u"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/courses/".concat(params.coursesId, "/export_couser_info.json"),
|
|
query: params
|
|
}));
|
|
|
|
case 7:
|
|
hideLoading();
|
|
|
|
case 8:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee);
|
|
}));
|
|
|
|
return function ExportCourseInfo(_x) {
|
|
return _ref.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportCourseActScore = /*#__PURE__*/function () {
|
|
var _ref2 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee2(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee2$(_context2) {
|
|
while (1) {
|
|
switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
_context2.next = 2;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportCourseActScore */ "q"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 2:
|
|
res = _context2.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context2.next = 8;
|
|
break;
|
|
}
|
|
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].info('导出任务生成成功');
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_member_act_score"));
|
|
_context2.next = 13;
|
|
break;
|
|
|
|
case 8:
|
|
if (!(res.status === -2)) {
|
|
_context2.next = 12;
|
|
break;
|
|
}
|
|
|
|
return _context2.abrupt("return", res);
|
|
|
|
case 12:
|
|
if (res.status === -3) {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '导出提醒'
|
|
}
|
|
});
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_member_act_score"));
|
|
}
|
|
|
|
case 13:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
|
|
return function ExportCourseActScore(_x2) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportCourseMemberScores = /*#__PURE__*/function () {
|
|
var _ref3 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee3(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee3$(_context3) {
|
|
while (1) {
|
|
switch (_context3.prev = _context3.next) {
|
|
case 0:
|
|
_context3.next = 2;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportCourseMemberScores */ "t"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 2:
|
|
res = _context3.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context3.next = 8;
|
|
break;
|
|
}
|
|
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].info('导出任务生成成功');
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_score"));
|
|
_context3.next = 13;
|
|
break;
|
|
|
|
case 8:
|
|
if (!(res.status === -2)) {
|
|
_context3.next = 12;
|
|
break;
|
|
}
|
|
|
|
return _context3.abrupt("return", res);
|
|
|
|
case 12:
|
|
if (res.status === -3) {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '导出提醒'
|
|
}
|
|
});
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_score"));
|
|
}
|
|
|
|
case 13:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
|
|
return function ExportCourseMemberScores(_x3) {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}(); //试卷
|
|
|
|
var ExportCourseAndOther = /*#__PURE__*/function () {
|
|
var _ref4 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee4(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee4$(_context4) {
|
|
while (1) {
|
|
switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
_context4.next = 2;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportCourseAndOther */ "r"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 2:
|
|
res = _context4.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context4.next = 8;
|
|
break;
|
|
}
|
|
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].info('导出任务生成成功');
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_exercise_and_other"));
|
|
_context4.next = 13;
|
|
break;
|
|
|
|
case 8:
|
|
if (!(res.status === -2)) {
|
|
_context4.next = 12;
|
|
break;
|
|
}
|
|
|
|
return _context4.abrupt("return", res);
|
|
|
|
case 12:
|
|
if (res.status === -3) {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '导出提醒'
|
|
}
|
|
});
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_exercise_and_other"));
|
|
}
|
|
|
|
case 13:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}
|
|
}, _callee4);
|
|
}));
|
|
|
|
return function ExportCourseAndOther(_x4) {
|
|
return _ref4.apply(this, arguments);
|
|
};
|
|
}(); //第三方幕课
|
|
|
|
var exportMoocrecord = /*#__PURE__*/function () {
|
|
var _ref5 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee5(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee5$(_context5) {
|
|
while (1) {
|
|
switch (_context5.prev = _context5.next) {
|
|
case 0:
|
|
_context5.next = 2;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportMoocrecords */ "y"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 2:
|
|
res = _context5.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context5.next = 8;
|
|
break;
|
|
}
|
|
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].info('导出任务生成成功');
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_exercise_and_other"));
|
|
_context5.next = 13;
|
|
break;
|
|
|
|
case 8:
|
|
if (!(res.status === -2)) {
|
|
_context5.next = 12;
|
|
break;
|
|
}
|
|
|
|
return _context5.abrupt("return", res);
|
|
|
|
case 12:
|
|
if (res.status === -3) {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '导出提醒'
|
|
}
|
|
});
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_exercise_and_other"));
|
|
}
|
|
|
|
case 13:
|
|
case "end":
|
|
return _context5.stop();
|
|
}
|
|
}
|
|
}, _callee5);
|
|
}));
|
|
|
|
return function exportMoocrecord(_x5) {
|
|
return _ref5.apply(this, arguments);
|
|
};
|
|
}(); //作业
|
|
|
|
var ExportCourseTotalScore = /*#__PURE__*/function () {
|
|
var _ref6 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee6(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee6$(_context6) {
|
|
while (1) {
|
|
switch (_context6.prev = _context6.next) {
|
|
case 0:
|
|
_context6.next = 2;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportCourseTotalScore */ "u"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 2:
|
|
res = _context6.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context6.next = 8;
|
|
break;
|
|
}
|
|
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].info('导出任务生成成功');
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_homework"));
|
|
_context6.next = 13;
|
|
break;
|
|
|
|
case 8:
|
|
if (!(res.status === -2)) {
|
|
_context6.next = 12;
|
|
break;
|
|
}
|
|
|
|
return _context6.abrupt("return", res);
|
|
|
|
case 12:
|
|
if (res.status === -3) {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '导出提醒'
|
|
}
|
|
});
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/course_total_homework"));
|
|
}
|
|
|
|
case 13:
|
|
case "end":
|
|
return _context6.stop();
|
|
}
|
|
}
|
|
}, _callee6);
|
|
}));
|
|
|
|
return function ExportCourseTotalScore(_x6) {
|
|
return _ref6.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportCourseWorkListScores = /*#__PURE__*/function () {
|
|
var _ref7 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee7(params, type) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee7$(_context7) {
|
|
while (1) {
|
|
switch (_context7.prev = _context7.next) {
|
|
case 0:
|
|
_context7.next = 2;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportCourseWorkListScores */ "w"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 2:
|
|
res = _context7.sent;
|
|
|
|
if (res.status === 0) {
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].info('导出任务生成成功');
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/").concat(type));
|
|
} else if (res.status === -3) {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '导出提醒'
|
|
}
|
|
});
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/").concat(type));
|
|
} // else if(res.status === -1){
|
|
// history.push(`/classrooms/${params.coursesId}/exportlist/${type}`)
|
|
// };
|
|
// console.log(JSON.stringify(params))
|
|
// if(res.status === 0) await downLoadFileIframe('',setUrlQuery({url:ENV.API_SERVER + `/api/homework_commons/${params.categoryId}/works_list.xlsx`,query:params}))
|
|
// hideLoading();
|
|
|
|
|
|
case 4:
|
|
case "end":
|
|
return _context7.stop();
|
|
}
|
|
}
|
|
}, _callee7);
|
|
}));
|
|
|
|
return function ExportCourseWorkListScores(_x7, _x8) {
|
|
return _ref7.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportCourseWorkListAppendix = /*#__PURE__*/function () {
|
|
var _ref8 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee8(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee8$(_context8) {
|
|
while (1) {
|
|
switch (_context8.prev = _context8.next) {
|
|
case 0:
|
|
showLoading();
|
|
_context8.next = 3;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportCourseWorkListAppendix */ "v"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 3:
|
|
res = _context8.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context8.next = 7;
|
|
break;
|
|
}
|
|
|
|
_context8.next = 7;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFileIframe */ "u"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/homework_commons/".concat(params.categoryId, "/works_list.zip"),
|
|
query: params
|
|
}));
|
|
|
|
case 7:
|
|
hideLoading();
|
|
|
|
case 8:
|
|
case "end":
|
|
return _context8.stop();
|
|
}
|
|
}
|
|
}, _callee8);
|
|
}));
|
|
|
|
return function ExportCourseWorkListAppendix(_x9) {
|
|
return _ref8.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportPollsScores = /*#__PURE__*/function () {
|
|
var _ref9 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee9(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee9$(_context9) {
|
|
while (1) {
|
|
switch (_context9.prev = _context9.next) {
|
|
case 0:
|
|
showLoading();
|
|
_context9.next = 3;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportPollsScores */ "z"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 3:
|
|
res = _context9.sent;
|
|
|
|
if (!(res.status === 0)) {
|
|
_context9.next = 7;
|
|
break;
|
|
}
|
|
|
|
_context9.next = 7;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFileIframe */ "u"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/polls/".concat(params.categoryId, "/commit_result.xlsx"),
|
|
query: params
|
|
}));
|
|
|
|
case 7:
|
|
hideLoading();
|
|
|
|
case 8:
|
|
case "end":
|
|
return _context9.stop();
|
|
}
|
|
}
|
|
}, _callee9);
|
|
}));
|
|
|
|
return function ExportPollsScores(_x10) {
|
|
return _ref9.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportAttendance = /*#__PURE__*/function () {
|
|
var _ref10 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee10(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee10$(_context10) {
|
|
while (1) {
|
|
switch (_context10.prev = _context10.next) {
|
|
case 0:
|
|
_context10.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/courses/".concat(params.coursesId, "/attendances/export_xlsx_data.xlsx"),
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context10.stop();
|
|
}
|
|
}
|
|
}, _callee10);
|
|
}));
|
|
|
|
return function ExportAttendance(_x11) {
|
|
return _ref10.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportVideoStudent = /*#__PURE__*/function () {
|
|
var _ref11 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee11(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee11$(_context11) {
|
|
while (1) {
|
|
switch (_context11.prev = _context11.next) {
|
|
case 0:
|
|
_context11.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/courses/".concat(params.coursesId, "/video_study_statics.xlsx"),
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context11.stop();
|
|
}
|
|
}
|
|
}, _callee11);
|
|
}));
|
|
|
|
return function ExportVideoStudent(_x12) {
|
|
return _ref11.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportCourseStudentsInfo = /*#__PURE__*/function () {
|
|
var _ref12 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee12(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee12$(_context12) {
|
|
while (1) {
|
|
switch (_context12.prev = _context12.next) {
|
|
case 0:
|
|
_context12.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/courses/".concat(params.coursesId, "/export_course_students_info.xlsx"),
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context12.stop();
|
|
}
|
|
}
|
|
}, _callee12);
|
|
}));
|
|
|
|
return function ExportCourseStudentsInfo(_x13) {
|
|
return _ref12.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportProblemset = /*#__PURE__*/function () {
|
|
var _ref13 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee13(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee13$(_context13) {
|
|
while (1) {
|
|
switch (_context13.prev = _context13.next) {
|
|
case 0:
|
|
_context13.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/item_banks/export.xlsx",
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context13.stop();
|
|
}
|
|
}
|
|
}, _callee13);
|
|
}));
|
|
|
|
return function ExportProblemset(_x14) {
|
|
return _ref13.apply(this, arguments);
|
|
};
|
|
}();
|
|
var Exportcompetitions = /*#__PURE__*/function () {
|
|
var _ref14 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee14(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee14$(_context14) {
|
|
while (1) {
|
|
switch (_context14.prev = _context14.next) {
|
|
case 0:
|
|
_context14.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/competitions/region_reports.xlsx",
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context14.stop();
|
|
}
|
|
}
|
|
}, _callee14);
|
|
}));
|
|
|
|
return function Exportcompetitions(_x15) {
|
|
return _ref14.apply(this, arguments);
|
|
};
|
|
}();
|
|
var ExportExerciseStudentScores = /*#__PURE__*/function () {
|
|
var _ref15 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee15(params) {
|
|
var res;
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee15$(_context15) {
|
|
while (1) {
|
|
switch (_context15.prev = _context15.next) {
|
|
case 0:
|
|
_context15.next = 2;
|
|
return Object(_service_classrooms__WEBPACK_IMPORTED_MODULE_5__[/* exportExerciseStudentScores */ "x"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, params));
|
|
|
|
case 2:
|
|
res = _context15.sent;
|
|
|
|
if (res.status === 0) {
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].info('导出任务生成成功');
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/exercise_score"));
|
|
} else if (res.status === -3) {
|
|
Object(umi__WEBPACK_IMPORTED_MODULE_6__[/* getDvaApp */ "c"])()._store.dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '导出提醒'
|
|
}
|
|
});
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_6__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exportlist/exercise_score"));
|
|
} // else if(res.status === -1){
|
|
// history.push(`/classrooms/${params.coursesId}/exportlist/exercise_score`)
|
|
// };
|
|
// // https://test-newweb.educoder.net/api/exercises/4229/exercise_lists.xlsx?page=1&search=&limit=20&order=end_at&randomcode=undefined&client_key=6d57f8c3dd186c5ada392546ace9620a
|
|
// if(res.status === 0) await downLoadFileIframe('',setUrlQuery({url:ENV.API_SERVER + `/api/exercises/${params.categoryId}/exercise_lists.xlsx`,query:params}))
|
|
// hideLoading();
|
|
|
|
|
|
case 4:
|
|
case "end":
|
|
return _context15.stop();
|
|
}
|
|
}
|
|
}, _callee15);
|
|
}));
|
|
|
|
return function ExportExerciseStudentScores(_x16) {
|
|
return _ref15.apply(this, arguments);
|
|
};
|
|
}();
|
|
var getDownFile = /*#__PURE__*/function () {
|
|
var _ref16 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee16(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee16$(_context16) {
|
|
while (1) {
|
|
switch (_context16.prev = _context16.next) {
|
|
case 0:
|
|
console.log('----------', '调用下载');
|
|
_context16.next = 3;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/export_records/".concat(params.id, ".xlsx"),
|
|
query: params
|
|
}));
|
|
|
|
case 3:
|
|
case "end":
|
|
return _context16.stop();
|
|
}
|
|
}
|
|
}, _callee16);
|
|
}));
|
|
|
|
return function getDownFile(_x17) {
|
|
return _ref16.apply(this, arguments);
|
|
};
|
|
}();
|
|
var getecyears = /*#__PURE__*/function () {
|
|
var _ref17 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee17(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee17$(_context17) {
|
|
while (1) {
|
|
switch (_context17.prev = _context17.next) {
|
|
case 0:
|
|
_context17.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/ec_major_schools/0/ec_years.xlsx",
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context17.stop();
|
|
}
|
|
}
|
|
}, _callee17);
|
|
}));
|
|
|
|
return function getecyears(_x18) {
|
|
return _ref17.apply(this, arguments);
|
|
};
|
|
}();
|
|
var getec_training_objectives = /*#__PURE__*/function () {
|
|
var _ref18 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee18(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee18$(_context18) {
|
|
while (1) {
|
|
switch (_context18.prev = _context18.next) {
|
|
case 0:
|
|
_context18.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/ec_years/".concat(params === null || params === void 0 ? void 0 : params.ec_year_id, "/ec_training_objectives.xlsx"),
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context18.stop();
|
|
}
|
|
}
|
|
}, _callee18);
|
|
}));
|
|
|
|
return function getec_training_objectives(_x19) {
|
|
return _ref18.apply(this, arguments);
|
|
};
|
|
}();
|
|
var getec_graduation_requirements = /*#__PURE__*/function () {
|
|
var _ref19 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.mark(function _callee19(params) {
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default.a.wrap(function _callee19$(_context19) {
|
|
while (1) {
|
|
switch (_context19.prev = _context19.next) {
|
|
case 0:
|
|
_context19.next = 2;
|
|
return Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* downLoadFile */ "t"])('', Object(_util__WEBPACK_IMPORTED_MODULE_7__[/* setUrlQuery */ "W"])({
|
|
url: _env__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].API_SERVER + "/api/ec_years/".concat(params === null || params === void 0 ? void 0 : params.ec_year_id, "/ec_graduation_requirements.xlsx"),
|
|
query: params
|
|
}));
|
|
|
|
case 2:
|
|
case "end":
|
|
return _context19.stop();
|
|
}
|
|
}
|
|
}, _callee19);
|
|
}));
|
|
|
|
return function getec_graduation_requirements(_x20) {
|
|
return _ref19.apply(this, arguments);
|
|
};
|
|
}();
|
|
|
|
/***/ }),
|
|
|
|
/***/ "mpGW":
|
|
/*!***************************************************************************!*\
|
|
!*** ./src/pages/Classrooms/Lists/CourseGroup/NotList/index.less?modules ***!
|
|
\***************************************************************************/
|
|
/*! no static exports found */
|
|
/*! exports used: default */
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
module.exports = {"flex_box_center":"flex_box_center___2etn-","flex_space_between":"flex_space_between___1lEB8","flex_box_vertical_center":"flex_box_vertical_center___3TT7x","flex_box_center_end":"flex_box_center_end___2BD6y","flex_box_column":"flex_box_column___1NfEJ","bg":"bg___20qKA","containerTitle":"containerTitle___3G78U","containerDesc":"containerDesc___B47ih","listItem":"listItem___2vX5S","title":"title___2DI34","titleLeft":"titleLeft___2pYkt","titleRight":"titleRight___1gw5f","acitons":"acitons___3672W","memberManager":"memberManager___2T3OD","menu":"menu___1mrpt"};
|
|
|
|
/***/ }),
|
|
|
|
/***/ "n6Qo":
|
|
/*!**************************************************************!*\
|
|
!*** ./node_modules/rc-table/es/Footer/index.js + 2 modules ***!
|
|
\**************************************************************/
|
|
/*! exports provided: default, FooterComponents */
|
|
/*! exports used: FooterComponents, default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Cell/index.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/context/TableContext.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ FooterComponents; });
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/context/TableContext.js
|
|
var TableContext = __webpack_require__("biw7");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/Cell/index.js
|
|
var Cell = __webpack_require__("fyJ8");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Footer/Cell.js
|
|
|
|
|
|
|
|
function SummaryCell(_ref) {
|
|
var className = _ref.className,
|
|
index = _ref.index,
|
|
children = _ref.children,
|
|
colSpan = _ref.colSpan,
|
|
rowSpan = _ref.rowSpan;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
fixedInfoList = _React$useContext.fixedInfoList;
|
|
|
|
var fixedInfo = fixedInfoList[index];
|
|
return external_window_React_["createElement"](Cell["a" /* default */], Object.assign({
|
|
className: className,
|
|
index: index,
|
|
component: "td",
|
|
prefixCls: prefixCls,
|
|
record: null,
|
|
dataIndex: null,
|
|
render: function render() {
|
|
return {
|
|
children: children,
|
|
props: {
|
|
colSpan: colSpan,
|
|
rowSpan: rowSpan
|
|
}
|
|
};
|
|
}
|
|
}, fixedInfo));
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Footer/Row.js
|
|
|
|
function FooterRow(props) {
|
|
return external_window_React_["createElement"]("tr", Object.assign({}, props));
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Footer/index.js
|
|
|
|
|
|
|
|
|
|
|
|
function Footer(_ref) {
|
|
var children = _ref.children;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext.prefixCls;
|
|
|
|
return external_window_React_["createElement"]("tfoot", {
|
|
className: "".concat(prefixCls, "-summary")
|
|
}, children);
|
|
}
|
|
|
|
/* harmony default export */ var es_Footer = __webpack_exports__["b"] = (Footer);
|
|
var FooterComponents = {
|
|
Cell: SummaryCell,
|
|
Row: FooterRow
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ "sR1s":
|
|
/*!*****************************************************!*\
|
|
!*** ./node_modules/rc-table/es/utils/valueUtil.js ***!
|
|
\*****************************************************/
|
|
/*! exports provided: getPathValue, getColumnsKey, mergeObject, validateValue */
|
|
/*! exports used: getColumnsKey, getPathValue, mergeObject, validateValue */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getPathValue; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getColumnsKey; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return mergeObject; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return validateValue; });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "U8pU");
|
|
|
|
var INTERNAL_KEY_PREFIX = 'RC_TABLE_KEY';
|
|
|
|
function toArray(arr) {
|
|
if (arr === undefined || arr === null) {
|
|
return [];
|
|
}
|
|
|
|
return Array.isArray(arr) ? arr : [arr];
|
|
}
|
|
|
|
function getPathValue(record, path) {
|
|
// Skip if path is empty
|
|
if (!path && typeof path !== 'number') {
|
|
return record;
|
|
}
|
|
|
|
var pathList = toArray(path);
|
|
var current = record;
|
|
|
|
for (var i = 0; i < pathList.length; i += 1) {
|
|
if (!current) {
|
|
return null;
|
|
}
|
|
|
|
var prop = pathList[i];
|
|
current = current[prop];
|
|
}
|
|
|
|
return current;
|
|
}
|
|
function getColumnsKey(columns) {
|
|
var columnKeys = [];
|
|
var keys = {};
|
|
columns.forEach(function (column) {
|
|
var _ref = column || {},
|
|
key = _ref.key,
|
|
dataIndex = _ref.dataIndex;
|
|
|
|
var mergedKey = key || toArray(dataIndex).join('-') || INTERNAL_KEY_PREFIX;
|
|
|
|
while (keys[mergedKey]) {
|
|
mergedKey = "".concat(mergedKey, "_next");
|
|
}
|
|
|
|
keys[mergedKey] = true;
|
|
columnKeys.push(mergedKey);
|
|
});
|
|
return columnKeys;
|
|
}
|
|
function mergeObject() {
|
|
var merged = {};
|
|
/* eslint-disable no-param-reassign */
|
|
|
|
function fillProps(obj, clone) {
|
|
if (clone) {
|
|
Object.keys(clone).forEach(function (key) {
|
|
var value = clone[key];
|
|
|
|
if (value && Object(_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(value) === 'object') {
|
|
obj[key] = obj[key] || {};
|
|
fillProps(obj[key], value);
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
/* eslint-enable */
|
|
|
|
|
|
for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
objects[_key] = arguments[_key];
|
|
}
|
|
|
|
objects.forEach(function (clone) {
|
|
fillProps(merged, clone);
|
|
});
|
|
return merged;
|
|
}
|
|
function validateValue(val) {
|
|
return val !== null && val !== undefined;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "sboe":
|
|
/*!*************************************************!*\
|
|
!*** ./node_modules/rc-tree/es/contextTypes.js ***!
|
|
\*************************************************/
|
|
/*! exports provided: TreeContext */
|
|
/*! exports used: TreeContext */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TreeContext; });
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
/**
|
|
* Webpack has bug for import loop, which is not the same behavior as ES module.
|
|
* When util.js imports the TreeNode for tree generate will cause treeContextTypes be empty.
|
|
*/
|
|
|
|
var TreeContext = react__WEBPACK_IMPORTED_MODULE_0__["createContext"](null);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "sl2e":
|
|
/*!******************************************************************************!*\
|
|
!*** ./src/pages/Classrooms/Lists/CourseGroup/NotList/index.tsx + 2 modules ***!
|
|
\******************************************************************************/
|
|
/*! exports provided: default */
|
|
/*! all exports used */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/icons/es/icons/DownOutlined.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/icons/es/icons/InboxOutlined.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Classrooms/Lists/CourseGroup/NotList/index.less?modules (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/.umi-production/core/umiExports.ts */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/ExportCount/index.tsx */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/NoData/index.tsx */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/authority.ts */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/export.ts */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/fetch.ts */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/checkbox/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/checkbox/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/dropdown/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/dropdown/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/pagination/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/pagination/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/space/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/space/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/table/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/table/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tree-select/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tree-select/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/upload/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/upload/style/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/moment/moment.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router-dom/esm/react-router-dom.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router/esm/react-router.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/style/index.js
|
|
var style = __webpack_require__("DjyN");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/index.js + 2 modules
|
|
var pagination = __webpack_require__("NUBc");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/table/style/index.js
|
|
var table_style = __webpack_require__("g9YV");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/table/index.js + 14 modules
|
|
var table = __webpack_require__("wCAj");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js
|
|
var input_style = __webpack_require__("5NDa");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 3 modules
|
|
var input = __webpack_require__("5rEg");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/style/index.js
|
|
var dropdown_style = __webpack_require__("qVdP");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/index.js
|
|
var dropdown = __webpack_require__("jsC+");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/space/style/index.js
|
|
var space_style = __webpack_require__("DYRE");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/space/index.js
|
|
var space = __webpack_require__("zeV3");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/style/index.js
|
|
var checkbox_style = __webpack_require__("sRBo");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 2 modules
|
|
var es_checkbox = __webpack_require__("kaz8");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/menu/style/index.js
|
|
var menu_style = __webpack_require__("lUTK");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/menu/index.js + 3 modules
|
|
var menu = __webpack_require__("BvKs");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js
|
|
var message_style = __webpack_require__("miYZ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
|
|
var message = __webpack_require__("tsqr");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__("9og8");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("k1fw");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__("tJVT");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js
|
|
var regenerator = __webpack_require__("WmNS");
|
|
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/moment/moment.js
|
|
var moment = __webpack_require__("wd/R");
|
|
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/react-router/esm/react-router.js
|
|
var react_router = __webpack_require__("Ty5D");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/react-router-dom/esm/react-router-dom.js
|
|
var react_router_dom = __webpack_require__("55Ip");
|
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/core/umiExports.ts + 17 modules
|
|
var umiExports = __webpack_require__("9kvl");
|
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__("ErOA");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DownOutlined.js + 1 modules
|
|
var DownOutlined = __webpack_require__("8Skl");
|
|
|
|
// EXTERNAL MODULE: ./src/utils/export.ts
|
|
var utils_export = __webpack_require__("mgmH");
|
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__("m3rI");
|
|
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
var NoData = __webpack_require__("BdwD");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js
|
|
var modal_style = __webpack_require__("2qtc");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
|
|
var modal = __webpack_require__("kLXV");
|
|
|
|
// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/CourseGroup/NotList/components/DelTasks.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DelTasks_DelShixun = function DelShixun(_ref) {
|
|
var classroomList = _ref.classroomList,
|
|
dispatch = _ref.dispatch,
|
|
cb = _ref.cb;
|
|
var params = Object(react_router["i" /* useParams */])();
|
|
params['id'] = params['coursesId'];
|
|
return /*#__PURE__*/external_window_React_default.a.createElement(modal["a" /* default */], {
|
|
centered: true,
|
|
title: "\u63D0\u793A",
|
|
visible: classroomList.actionTabs.key === '删除分班' ? true : false,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
onOk: /*#__PURE__*/Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
|
|
var res;
|
|
return regenerator_default.a.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return Object(fetch["a" /* default */])("/api/courses/".concat(params.coursesId, "/delete_from_course.json"), {
|
|
method: 'post',
|
|
body: {
|
|
students: [{
|
|
course_member_id: classroomList.actionTabs.selectArrs.course_member_id
|
|
}]
|
|
}
|
|
});
|
|
|
|
case 2:
|
|
res = _context.sent;
|
|
|
|
if (res.status === 0) {
|
|
cb();
|
|
|
|
message["b" /* default */].success('删除成功');
|
|
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {}
|
|
});
|
|
dispatch({
|
|
type: 'classroomList/getCourseStudentsList',
|
|
payload: Object(objectSpread2["a" /* default */])({}, classroomList.actionTabs.params)
|
|
});
|
|
}
|
|
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee);
|
|
})),
|
|
onCancel: function onCancel() {
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {}
|
|
});
|
|
}
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("p", null, "\u662F\u5426\u786E\u8BA4\u5220\u9664?"));
|
|
};
|
|
|
|
/* harmony default export */ var DelTasks = (Object(umiExports["a" /* connect */])(function (_ref3) {
|
|
var classroomList = _ref3.classroomList;
|
|
return {
|
|
classroomList: classroomList
|
|
};
|
|
})(DelTasks_DelShixun));
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/CourseGroup/NotList/index.less?modules
|
|
var NotListmodules = __webpack_require__("mpGW");
|
|
var NotListmodules_default = /*#__PURE__*/__webpack_require__.n(NotListmodules);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js
|
|
var form_style = __webpack_require__("y8nQ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 11 modules
|
|
var es_form = __webpack_require__("Vl3Y");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tree-select/style/index.js
|
|
var tree_select_style = __webpack_require__("nRaC");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tree-select/index.js
|
|
var tree_select = __webpack_require__("5RzL");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/upload/style/index.js
|
|
var upload_style = __webpack_require__("DZo9");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/upload/index.js + 4 modules
|
|
var upload = __webpack_require__("8z0m");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/InboxOutlined.js + 1 modules
|
|
var InboxOutlined = __webpack_require__("LtfV");
|
|
|
|
// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/CourseGroup/NotList/components/ImportCourse.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Dragger = upload["a" /* default */].Dragger;
|
|
var TreeNode = tree_select["a" /* default */].TreeNode;
|
|
|
|
var ImportCourse_EditAttendance = function EditAttendance(_ref) {
|
|
var classroomList = _ref.classroomList,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch;
|
|
var params = Object(react_router["i" /* useParams */])();
|
|
|
|
var _useState = Object(external_window_React_["useState"])([]),
|
|
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
|
|
files = _useState2[0],
|
|
setFiles = _useState2[1];
|
|
|
|
params['id'] = params['coursesId'];
|
|
var detailLeftMenus = classroomList.detailLeftMenus,
|
|
actionTabs = classroomList.actionTabs;
|
|
|
|
var _Form$useForm = es_form["a" /* default */].useForm(),
|
|
_Form$useForm2 = Object(slicedToArray["a" /* default */])(_Form$useForm, 1),
|
|
form = _Form$useForm2[0];
|
|
|
|
var props = {
|
|
name: 'file',
|
|
multiple: true,
|
|
accept: '.xls,.xlsx',
|
|
action: env["a" /* default */].API_SERVER + '/api/attachments.json',
|
|
onChange: function onChange(info) {
|
|
var status = info.file.status;
|
|
setFiles(info.fileList);
|
|
|
|
if (status !== 'uploading') {}
|
|
|
|
if (status === 'done') {
|
|
message["b" /* default */].success("".concat(info.file.name, " \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"));
|
|
} else if (status === 'error') {
|
|
message["b" /* default */].error("".concat(info.file.name, " \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"));
|
|
}
|
|
}
|
|
};
|
|
return /*#__PURE__*/external_window_React_default.a.createElement(modal["a" /* default */], {
|
|
centered: true,
|
|
title: "\u5BFC\u5165\u521B\u5EFA\u5206\u73ED",
|
|
visible: classroomList.actionTabs.key === '导入创建分班' ? true : false,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
bodyStyle: {
|
|
minHeight: 130,
|
|
padding: '0 50px',
|
|
marginTop: 25
|
|
},
|
|
onOk: /*#__PURE__*/Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
|
|
var formValue, res;
|
|
return regenerator_default.a.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.t0 = objectSpread2["a" /* default */];
|
|
_context.t1 = {};
|
|
_context.next = 4;
|
|
return form.validateFields();
|
|
|
|
case 4:
|
|
_context.t2 = _context.sent;
|
|
formValue = (0, _context.t0)(_context.t1, _context.t2);
|
|
|
|
if (!(files == '')) {
|
|
_context.next = 9;
|
|
break;
|
|
}
|
|
|
|
message["b" /* default */].error('请先上传文件');
|
|
|
|
return _context.abrupt("return", false);
|
|
|
|
case 9:
|
|
_context.next = 11;
|
|
return Object(fetch["a" /* default */])("/api/courses/".concat(params.id, "/create_group_by_importing_file.json"), {
|
|
method: 'post',
|
|
body: {
|
|
attachment_ids: files.map(function (v) {
|
|
return v.response.id;
|
|
})
|
|
}
|
|
});
|
|
|
|
case 11:
|
|
res = _context.sent;
|
|
|
|
if (res.status === 0) {
|
|
message["b" /* default */].success('添加成功');
|
|
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {}
|
|
});
|
|
dispatch({
|
|
type: 'classroomList/getCourseGroupsList',
|
|
payload: {
|
|
id: params['coursesId']
|
|
}
|
|
});
|
|
}
|
|
|
|
case 13:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee);
|
|
})),
|
|
onCancel: function onCancel() {
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {}
|
|
});
|
|
}
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement(Dragger, props, /*#__PURE__*/external_window_React_default.a.createElement("p", {
|
|
className: "ant-upload-drag-icon"
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement(InboxOutlined["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement("p", {
|
|
className: "ant-upload-text"
|
|
}, "\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u8FD9\u91CC\u4E0A\u4F20"), /*#__PURE__*/external_window_React_default.a.createElement("p", {
|
|
className: "ant-upload-hint"
|
|
}, "\u5355\u4E2A\u6587\u4EF6\u6700\u5927150MB")), ",");
|
|
};
|
|
|
|
/* harmony default export */ var ImportCourse = (Object(umiExports["a" /* connect */])(function (_ref3) {
|
|
var classroomList = _ref3.classroomList,
|
|
loading = _ref3.loading;
|
|
return {
|
|
classroomList: classroomList,
|
|
loading: loading
|
|
};
|
|
})(ImportCourse_EditAttendance));
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__("xKgJ");
|
|
|
|
// EXTERNAL MODULE: ./src/components/ExportCount/index.tsx
|
|
var ExportCount = __webpack_require__("lx6N");
|
|
|
|
// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/CourseGroup/NotList/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
moment_default.a.locale('zh-cn');
|
|
|
|
var NotList_ShixunsListPage = function ShixunsListPage(_ref) {
|
|
var _detailCoursStudentsL;
|
|
|
|
var classroomList = _ref.classroomList,
|
|
globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch;
|
|
|
|
var _useState = Object(external_window_React_["useState"])(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, Object(react_router["i" /* useParams */])()), {}, {
|
|
limit: 20
|
|
})),
|
|
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
|
|
params = _useState2[0],
|
|
setParams = _useState2[1];
|
|
|
|
var detailCoursStudentsList = classroomList.detailCoursStudentsList,
|
|
detailCourseGroupsList = classroomList.detailCourseGroupsList,
|
|
detailLeftMenus = classroomList.detailLeftMenus;
|
|
|
|
var _useState3 = Object(external_window_React_["useState"])([]),
|
|
_useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2),
|
|
selectArrs = _useState4[0],
|
|
setSelectArrs = _useState4[1];
|
|
|
|
var _useState5 = Object(external_window_React_["useState"])('排序'),
|
|
_useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2),
|
|
sortText = _useState6[0],
|
|
setSortText = _useState6[1];
|
|
|
|
var _useState7 = Object(external_window_React_["useState"])(),
|
|
_useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2),
|
|
res = _useState8[0],
|
|
setRes = _useState8[1];
|
|
|
|
var _useState9 = Object(external_window_React_["useState"])(false),
|
|
_useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2),
|
|
ismodel = _useState10[0],
|
|
setismodel = _useState10[1];
|
|
|
|
params['id'] = params['coursesId'];
|
|
params['order'] = 1;
|
|
params['course_group_id'] = 0;
|
|
params['sort'] = 'asc';
|
|
var courseModules;
|
|
|
|
if (detailLeftMenus.course_modules) {
|
|
courseModules = classroomList.detailLeftMenus.course_modules.filter(function (v) {
|
|
return v.type === 'board';
|
|
})[0];
|
|
} // alert(params.id)
|
|
|
|
|
|
Object(external_window_React_["useEffect"])(function () {
|
|
dispatch({
|
|
type: 'classroomList/getCourseStudentsList',
|
|
payload: Object(objectSpread2["a" /* default */])({}, params)
|
|
});
|
|
dispatch({
|
|
type: 'classroomList/getCourseGroupsList',
|
|
payload: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, params), {}, {
|
|
limit: 10000
|
|
})
|
|
});
|
|
}, [params['categoryId']]);
|
|
Object(external_window_React_["useEffect"])(function () {
|
|
if (classroomList.actionTabs.key === '目录重命名成功') {
|
|
dispatch({
|
|
type: 'classroomList/getCourseStudentsList',
|
|
payload: Object(objectSpread2["a" /* default */])({}, params)
|
|
});
|
|
}
|
|
}, [classroomList.actionTabs.key]);
|
|
|
|
var onShowSizeChange = function onShowSizeChange(current, pageSize) {
|
|
params.page = current;
|
|
setSelectArrs([]);
|
|
dispatch({
|
|
type: 'classroomList/getCourseStudentsList',
|
|
payload: Object(objectSpread2["a" /* default */])({}, params)
|
|
});
|
|
};
|
|
|
|
var exportMenuArr = [{
|
|
name: '课堂信息',
|
|
url: "".concat(env["a" /* default */].API_SERVER, "/api/courses/").concat(params.coursesId, "/export_couser_info.xlsx?group_id=").concat(params.categoryId)
|
|
}, {
|
|
name: '活跃度',
|
|
url: "".concat(env["a" /* default */].API_SERVER, "/api/courses/").concat(params.coursesId, "/export_member_act_score.xlsx?group_id=").concat(params.categoryId)
|
|
}, {
|
|
name: '总成绩',
|
|
url: "".concat(env["a" /* default */].API_SERVER, "/api/courses/").concat(params.coursesId, "/export_member_scores_excel.xlsx?group_id=").concat(params.categoryId)
|
|
}];
|
|
|
|
var handleExport = /*#__PURE__*/function () {
|
|
var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee(key) {
|
|
var hyd, zcj;
|
|
return regenerator_default.a.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
if (!(selectArrs == '' && key !== '课堂信息')) {
|
|
_context.next = 3;
|
|
break;
|
|
}
|
|
|
|
message["b" /* default */].error('请先选择学生');
|
|
|
|
return _context.abrupt("return", false);
|
|
|
|
case 3:
|
|
_context.t0 = key;
|
|
_context.next = _context.t0 === "课堂信息" ? 6 : _context.t0 === "活跃度" ? 8 : _context.t0 === "总成绩" ? 13 : 18;
|
|
break;
|
|
|
|
case 6:
|
|
Object(utils_export["d" /* ExportCourseInfo */])(Object(objectSpread2["a" /* default */])({}, params));
|
|
return _context.abrupt("break", 18);
|
|
|
|
case 8:
|
|
_context.next = 10;
|
|
return Object(utils_export["b" /* ExportCourseActScore */])(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, params), {}, {
|
|
course_member_ids: selectArrs
|
|
}));
|
|
|
|
case 10:
|
|
hyd = _context.sent;
|
|
|
|
if ((hyd === null || hyd === void 0 ? void 0 : hyd.status) === -2) {
|
|
setRes(hyd);
|
|
setismodel(true);
|
|
}
|
|
|
|
return _context.abrupt("break", 18);
|
|
|
|
case 13:
|
|
_context.next = 15;
|
|
return Object(utils_export["e" /* ExportCourseMemberScores */])(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, params), {}, {
|
|
course_member_ids: selectArrs
|
|
}));
|
|
|
|
case 15:
|
|
zcj = _context.sent;
|
|
|
|
if ((zcj === null || zcj === void 0 ? void 0 : zcj.status) === -2) {
|
|
setRes(zcj);
|
|
setismodel(true);
|
|
}
|
|
|
|
return _context.abrupt("break", 18);
|
|
|
|
case 18:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee);
|
|
}));
|
|
|
|
return function handleExport(_x) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
|
|
var exportMenu = /*#__PURE__*/external_window_React_default.a.createElement(menu["a" /* default */], {
|
|
style: {
|
|
maxHeight: 400,
|
|
width: 240,
|
|
overflow: 'auto'
|
|
}
|
|
}, exportMenuArr.map(function (item, key) {
|
|
return /*#__PURE__*/external_window_React_default.a.createElement(menu["a" /* default */].Item, {
|
|
key: item.url,
|
|
onClick: function onClick(e) {
|
|
handleExport(item.name);
|
|
}
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("span", null, item.name));
|
|
}));
|
|
var submenu = /*#__PURE__*/external_window_React_default.a.createElement(menu["a" /* default */], {
|
|
onClick: /*#__PURE__*/function () {
|
|
var _ref4 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2(_ref3) {
|
|
var item, key, keyPath, domEvent, res;
|
|
return regenerator_default.a.wrap(function _callee2$(_context2) {
|
|
while (1) {
|
|
switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
item = _ref3.item, key = _ref3.key, keyPath = _ref3.keyPath, domEvent = _ref3.domEvent;
|
|
|
|
if (!(selectArrs == '')) {
|
|
_context2.next = 4;
|
|
break;
|
|
}
|
|
|
|
message["b" /* default */].error('请选择你要操作的任务');
|
|
|
|
return _context2.abrupt("return", null);
|
|
|
|
case 4:
|
|
_context2.next = 6;
|
|
return Object(fetch["a" /* default */])("/api/courses/".concat(params.id, "/transfer_to_course_group.json"), {
|
|
method: 'post',
|
|
body: {
|
|
students: selectArrs.map(function (v) {
|
|
return {
|
|
course_member_id: v
|
|
};
|
|
}),
|
|
course_group_id: key
|
|
}
|
|
});
|
|
|
|
case 6:
|
|
res = _context2.sent;
|
|
|
|
if (res.status === 0) {
|
|
setSelectArrs([]);
|
|
|
|
message["b" /* default */].success('操作成功');
|
|
|
|
dispatch({
|
|
type: 'classroomList/getCourseStudentsList',
|
|
payload: Object(objectSpread2["a" /* default */])({}, params)
|
|
});
|
|
}
|
|
|
|
case 8:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
|
|
return function (_x2) {
|
|
return _ref4.apply(this, arguments);
|
|
};
|
|
}(),
|
|
style: {
|
|
maxHeight: 400,
|
|
width: 240,
|
|
overflow: 'auto'
|
|
}
|
|
}, detailCourseGroupsList.course_groups && detailCourseGroupsList.course_groups.map(function (item, key) {
|
|
return /*#__PURE__*/external_window_React_default.a.createElement(menu["a" /* default */].Item, {
|
|
key: item.id
|
|
}, item.name);
|
|
}));
|
|
var columns = [{
|
|
title: '',
|
|
render: function render(text, record) {
|
|
return Object(authority["c" /* isAdmin */])() && /*#__PURE__*/external_window_React_default.a.createElement(es_checkbox["a" /* default */], {
|
|
checked: selectArrs.includes(record.course_member_id),
|
|
value: record.course_member_id,
|
|
onChange: function onChange(e) {
|
|
var key = selectArrs.indexOf(record.course_member_id);
|
|
|
|
if (selectArrs.indexOf(record.course_member_id) > -1) {
|
|
setSelectArrs(selectArrs.filter(function (val) {
|
|
return val !== record.course_member_id;
|
|
}));
|
|
} else {
|
|
setSelectArrs(selectArrs.concat(record.course_member_id));
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}, {
|
|
title: '序号',
|
|
render: function render(text, record, index) {
|
|
return "".concat(!params.page || params.page === 1 ? index + 1 : index + 1 + (params.page - 1) * 20);
|
|
}
|
|
}, {
|
|
title: '姓名',
|
|
dataIndex: 'name'
|
|
}, {
|
|
title: '学号',
|
|
dataIndex: 'student_id'
|
|
}, {
|
|
title: '手机号',
|
|
dataIndex: 'user_phone'
|
|
}, {
|
|
title: '邮箱',
|
|
dataIndex: 'user_mail'
|
|
}, Object(authority["c" /* isAdmin */])() && {
|
|
title: '操作',
|
|
key: 'action',
|
|
render: function render(text, record) {
|
|
return /*#__PURE__*/external_window_React_default.a.createElement(space["a" /* default */], {
|
|
size: "middle"
|
|
}, Object(authority["c" /* isAdmin */])() && /*#__PURE__*/external_window_React_default.a.createElement("a", {
|
|
onClick: function onClick() {
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '删除分班',
|
|
selectArrs: record,
|
|
params: params
|
|
}
|
|
});
|
|
}
|
|
}, "\u5220\u9664\u5B66\u751F"));
|
|
}
|
|
}].filter(function (item) {
|
|
return !!item;
|
|
});
|
|
return /*#__PURE__*/external_window_React_default.a.createElement("section", null, /*#__PURE__*/external_window_React_default.a.createElement("aside", {
|
|
className: NotListmodules_default.a.bg
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("aside", {
|
|
className: NotListmodules_default.a.menu
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement(menu["a" /* default */], {
|
|
mode: "horizontal",
|
|
style: {
|
|
margin: '0 18px'
|
|
} // onSelect={onMenuSelect}
|
|
,
|
|
defaultSelectedKeys: ['1']
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement(menu["a" /* default */].Item, {
|
|
className: "font16",
|
|
key: '0'
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement(react_router_dom["a" /* Link */], {
|
|
className: "font16",
|
|
to: "/classrooms/".concat(params.coursesId, "/course_group")
|
|
}, "\u5206\u73ED\u5217\u8868")), /*#__PURE__*/external_window_React_default.a.createElement(menu["a" /* default */].Item, {
|
|
className: "font16",
|
|
key: '1'
|
|
}, "\u672A\u5206\u73ED")), Object(authority["c" /* isAdmin */])() && /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement(dropdown["a" /* default */], {
|
|
overlay: exportMenu
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("a", {
|
|
className: "ant-dropdown-link font16 current",
|
|
onClick: function onClick(e) {
|
|
return e.preventDefault();
|
|
}
|
|
}, "\u5BFC\u51FA", /*#__PURE__*/external_window_React_default.a.createElement(DownOutlined["a" /* default */], null))))), /*#__PURE__*/external_window_React_default.a.createElement("div", {
|
|
className: NotListmodules_default.a.containerDesc
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("p", null, "\u5171", /*#__PURE__*/external_window_React_default.a.createElement("span", {
|
|
className: "c-orange"
|
|
}, detailCoursStudentsList.students_count), "\u4E2A\u5B66\u751F"), /*#__PURE__*/external_window_React_default.a.createElement("p", null, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */].Search, {
|
|
allowClear: true,
|
|
placeholder: "\u8BF7\u8F93\u5165\u59D3\u540D\u3001\u5B66\u53F7\u8FDB\u884C\u641C\u7D22",
|
|
onSearch: function onSearch(value) {
|
|
params.search = value;
|
|
params.page = 1;
|
|
dispatch({
|
|
type: 'classroomList/getCourseStudentsList',
|
|
payload: Object(objectSpread2["a" /* default */])({}, params)
|
|
});
|
|
},
|
|
style: {
|
|
width: 248
|
|
}
|
|
})))), detailCoursStudentsList.total_count === 0 && /*#__PURE__*/external_window_React_default.a.createElement(NoData["a" /* default */], null), /*#__PURE__*/external_window_React_default.a.createElement("aside", {
|
|
className: "plr30 mt20 ".concat(NotListmodules_default.a.bg)
|
|
}, Object(authority["c" /* isAdmin */])() && /*#__PURE__*/external_window_React_default.a.createElement("aside", {
|
|
className: NotListmodules_default.a.acitons
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement(es_checkbox["a" /* default */], {
|
|
checked: ((_detailCoursStudentsL = detailCoursStudentsList.students) === null || _detailCoursStudentsL === void 0 ? void 0 : _detailCoursStudentsL.length) === selectArrs.length,
|
|
onChange: function onChange(e) {
|
|
if (e.target.checked) {
|
|
setSelectArrs(detailCoursStudentsList.students.map(function (v) {
|
|
return v.course_member_id;
|
|
}));
|
|
} else {
|
|
setSelectArrs([]);
|
|
}
|
|
}
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("span", {
|
|
className: "ml5 font14"
|
|
}, "\u5DF2\u9009\u62E9 ", selectArrs.length, " \u4E2A"))), /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement(dropdown["a" /* default */], {
|
|
overlay: submenu
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement("a", {
|
|
className: "ant-dropdown-link",
|
|
onClick: function onClick(e) {
|
|
return e.preventDefault();
|
|
}
|
|
}, "\u79FB\u52A8\u5230 ", /*#__PURE__*/external_window_React_default.a.createElement(DownOutlined["a" /* default */], null))))), /*#__PURE__*/external_window_React_default.a.createElement("div", {
|
|
className: "mt20"
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement(table["a" /* default */], {
|
|
columns: columns,
|
|
dataSource: detailCoursStudentsList.students,
|
|
loading: loading.effects['classroomList/getCourseStudentsList'],
|
|
pagination: false
|
|
}))), /*#__PURE__*/external_window_React_default.a.createElement("aside", {
|
|
className: "tc mb50 mt30"
|
|
}, /*#__PURE__*/external_window_React_default.a.createElement(pagination["a" /* default */], {
|
|
hideOnSinglePage: true,
|
|
showSizeChanger: false,
|
|
onChange: onShowSizeChange,
|
|
defaultPageSize: 20,
|
|
defaultCurrent: 1,
|
|
current: params.page || 1,
|
|
total: detailCoursStudentsList.students_count
|
|
})), /*#__PURE__*/external_window_React_default.a.createElement(DelTasks, {
|
|
cb: function cb() {
|
|
return setSelectArrs([]);
|
|
}
|
|
}), /*#__PURE__*/external_window_React_default.a.createElement(ImportCourse, {
|
|
cb: function cb() {
|
|
return setSelectArrs([]);
|
|
}
|
|
}), /*#__PURE__*/external_window_React_default.a.createElement(ExportCount["a" /* default */], {
|
|
res: res,
|
|
ismodel: ismodel,
|
|
setismodel: setismodel
|
|
}));
|
|
};
|
|
|
|
/* harmony default export */ var NotList = __webpack_exports__["default"] = (Object(umiExports["a" /* connect */])(function (_ref5) {
|
|
var classroomList = _ref5.classroomList,
|
|
loading = _ref5.loading,
|
|
globalSetting = _ref5.globalSetting;
|
|
return {
|
|
classroomList: classroomList,
|
|
globalSetting: globalSetting,
|
|
loading: loading
|
|
};
|
|
})(NotList_ShixunsListPage));
|
|
|
|
/***/ }),
|
|
|
|
/***/ "t23M":
|
|
/*!*****************************************************!*\
|
|
!*** ./node_modules/rc-resize-observer/es/index.js ***!
|
|
\*****************************************************/
|
|
/*! exports provided: default */
|
|
/*! exports used: default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "VTBJ");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "1OyB");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "vuIU");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "Ji7U");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createSuper */ "LK+K");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);
|
|
/* harmony import */ var rc_util_es_Dom_findDOMNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rc-util/es/Dom/findDOMNode */ "m+aA");
|
|
/* harmony import */ var rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! rc-util/es/Children/toArray */ "Zm9Q");
|
|
/* harmony import */ var rc_util_es_warning__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! rc-util/es/warning */ "Kwbf");
|
|
/* harmony import */ var rc_util_es_ref__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! rc-util/es/ref */ "c+Xe");
|
|
/* harmony import */ var resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! resize-observer-polyfill */ "bdgK");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var INTERNAL_PREFIX_KEY = 'rc-observer-key'; // Still need to be compatible with React 15, we use class component here
|
|
|
|
var ReactResizeObserver = /*#__PURE__*/function (_React$Component) {
|
|
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(ReactResizeObserver, _React$Component);
|
|
|
|
var _super = Object(_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(ReactResizeObserver);
|
|
|
|
function ReactResizeObserver() {
|
|
var _this;
|
|
|
|
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(this, ReactResizeObserver);
|
|
|
|
_this = _super.apply(this, arguments);
|
|
_this.resizeObserver = null;
|
|
_this.childNode = null;
|
|
_this.currentElement = null;
|
|
_this.state = {
|
|
width: 0,
|
|
height: 0,
|
|
offsetHeight: 0,
|
|
offsetWidth: 0
|
|
};
|
|
|
|
_this.onResize = function (entries) {
|
|
var onResize = _this.props.onResize;
|
|
var target = entries[0].target;
|
|
|
|
var _target$getBoundingCl = target.getBoundingClientRect(),
|
|
width = _target$getBoundingCl.width,
|
|
height = _target$getBoundingCl.height;
|
|
|
|
var offsetWidth = target.offsetWidth,
|
|
offsetHeight = target.offsetHeight;
|
|
/**
|
|
* Resize observer trigger when content size changed.
|
|
* In most case we just care about element size,
|
|
* let's use `boundary` instead of `contentRect` here to avoid shaking.
|
|
*/
|
|
|
|
var fixedWidth = Math.floor(width);
|
|
var fixedHeight = Math.floor(height);
|
|
|
|
if (_this.state.width !== fixedWidth || _this.state.height !== fixedHeight || _this.state.offsetWidth !== offsetWidth || _this.state.offsetHeight !== offsetHeight) {
|
|
var size = {
|
|
width: fixedWidth,
|
|
height: fixedHeight,
|
|
offsetWidth: offsetWidth,
|
|
offsetHeight: offsetHeight
|
|
};
|
|
|
|
_this.setState(size);
|
|
|
|
if (onResize) {
|
|
// defer the callback but not defer to next frame
|
|
Promise.resolve().then(function () {
|
|
onResize(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, size), {}, {
|
|
offsetWidth: offsetWidth,
|
|
offsetHeight: offsetHeight
|
|
}));
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
_this.setChildNode = function (node) {
|
|
_this.childNode = node;
|
|
};
|
|
|
|
return _this;
|
|
}
|
|
|
|
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(ReactResizeObserver, [{
|
|
key: "componentDidMount",
|
|
value: function componentDidMount() {
|
|
this.onComponentUpdated();
|
|
}
|
|
}, {
|
|
key: "componentDidUpdate",
|
|
value: function componentDidUpdate() {
|
|
this.onComponentUpdated();
|
|
}
|
|
}, {
|
|
key: "componentWillUnmount",
|
|
value: function componentWillUnmount() {
|
|
this.destroyObserver();
|
|
}
|
|
}, {
|
|
key: "onComponentUpdated",
|
|
value: function onComponentUpdated() {
|
|
var disabled = this.props.disabled; // Unregister if disabled
|
|
|
|
if (disabled) {
|
|
this.destroyObserver();
|
|
return;
|
|
} // Unregister if element changed
|
|
|
|
|
|
var element = Object(rc_util_es_Dom_findDOMNode__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(this.childNode || this);
|
|
var elementChanged = element !== this.currentElement;
|
|
|
|
if (elementChanged) {
|
|
this.destroyObserver();
|
|
this.currentElement = element;
|
|
}
|
|
|
|
if (!this.resizeObserver && element) {
|
|
this.resizeObserver = new resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_10__["default"](this.onResize);
|
|
this.resizeObserver.observe(element);
|
|
}
|
|
}
|
|
}, {
|
|
key: "destroyObserver",
|
|
value: function destroyObserver() {
|
|
if (this.resizeObserver) {
|
|
this.resizeObserver.disconnect();
|
|
this.resizeObserver = null;
|
|
}
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
var children = this.props.children;
|
|
var childNodes = Object(rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(children);
|
|
|
|
if (childNodes.length > 1) {
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"])(false, 'Find more than one child node with `children` in ResizeObserver. Will only observe first one.');
|
|
} else if (childNodes.length === 0) {
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"])(false, '`children` of ResizeObserver is empty. Nothing is in observe.');
|
|
return null;
|
|
}
|
|
|
|
var childNode = childNodes[0];
|
|
|
|
if (react__WEBPACK_IMPORTED_MODULE_5__["isValidElement"](childNode) && Object(rc_util_es_ref__WEBPACK_IMPORTED_MODULE_9__[/* supportRef */ "c"])(childNode)) {
|
|
var ref = childNode.ref;
|
|
childNodes[0] = react__WEBPACK_IMPORTED_MODULE_5__["cloneElement"](childNode, {
|
|
ref: Object(rc_util_es_ref__WEBPACK_IMPORTED_MODULE_9__[/* composeRef */ "a"])(ref, this.setChildNode)
|
|
});
|
|
}
|
|
|
|
return childNodes.length === 1 ? childNodes[0] : childNodes.map(function (node, index) {
|
|
if (!react__WEBPACK_IMPORTED_MODULE_5__["isValidElement"](node) || 'key' in node && node.key !== null) {
|
|
return node;
|
|
}
|
|
|
|
return react__WEBPACK_IMPORTED_MODULE_5__["cloneElement"](node, {
|
|
key: "".concat(INTERNAL_PREFIX_KEY, "-").concat(index)
|
|
});
|
|
});
|
|
}
|
|
}]);
|
|
|
|
return ReactResizeObserver;
|
|
}(react__WEBPACK_IMPORTED_MODULE_5__["Component"]);
|
|
|
|
ReactResizeObserver.displayName = 'ResizeObserver';
|
|
/* harmony default export */ __webpack_exports__["a"] = (ReactResizeObserver);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "wCXF":
|
|
/*!********************************************************!*\
|
|
!*** ./node_modules/rc-table/es/Table.js + 17 modules ***!
|
|
\********************************************************/
|
|
/*! exports provided: INTERNAL_HOOKS, default */
|
|
/*! exports used: INTERNAL_HOOKS, default */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/raf/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-resize-observer/es/index.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Cell/index.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Footer/index.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/context/TableContext.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/hooks/useColumns.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/sugar/Column.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/sugar/ColumnGroup.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/utils/legacyUtil.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/utils/valueUtil.js because of ./node_modules/antd/es/table/Table.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/addEventListener.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/css.js because of ./node_modules/rc-image/es/Image.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/getScrollBarSize.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ INTERNAL_HOOKS; });
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__("rePB");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__("VTBJ");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__("KQm4");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__("U8pU");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__("ODXe");
|
|
|
|
// EXTERNAL MODULE: external "window.React"
|
|
var external_window_React_ = __webpack_require__("cDcd");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__("TSYQ");
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/shallowequal/index.js
|
|
var shallowequal = __webpack_require__("Gytx");
|
|
var shallowequal_default = /*#__PURE__*/__webpack_require__.n(shallowequal);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
|
|
var warning = __webpack_require__("Kwbf");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-resize-observer/es/index.js
|
|
var es = __webpack_require__("t23M");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/getScrollBarSize.js
|
|
var getScrollBarSize = __webpack_require__("qx4F");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/sugar/ColumnGroup.js
|
|
var ColumnGroup = __webpack_require__("6eGT");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/sugar/Column.js
|
|
var Column = __webpack_require__("IBYe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__("Ff2n");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/ref.js
|
|
var es_ref = __webpack_require__("c+Xe");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/Cell/index.js
|
|
var Cell = __webpack_require__("fyJ8");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/context/TableContext.js
|
|
var TableContext = __webpack_require__("biw7");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/utils/fixUtil.js
|
|
function getCellFixedInfo(colStart, colEnd, columns, stickyOffsets, direction) {
|
|
var startColumn = columns[colStart] || {};
|
|
var endColumn = columns[colEnd] || {};
|
|
var fixLeft;
|
|
var fixRight;
|
|
|
|
if (startColumn.fixed === 'left') {
|
|
fixLeft = stickyOffsets.left[colStart];
|
|
} else if (endColumn.fixed === 'right') {
|
|
fixRight = stickyOffsets.right[colEnd];
|
|
}
|
|
|
|
var lastFixLeft = false;
|
|
var firstFixRight = false;
|
|
var lastFixRight = false;
|
|
var firstFixLeft = false;
|
|
var nextColumn = columns[colEnd + 1];
|
|
var prevColumn = columns[colStart - 1];
|
|
|
|
if (direction === 'rtl') {
|
|
if (fixLeft !== undefined) {
|
|
var prevFixLeft = prevColumn && prevColumn.fixed === 'left';
|
|
firstFixLeft = !prevFixLeft;
|
|
} else if (fixRight !== undefined) {
|
|
var nextFixRight = nextColumn && nextColumn.fixed === 'right';
|
|
lastFixRight = !nextFixRight;
|
|
}
|
|
} else if (fixLeft !== undefined) {
|
|
var nextFixLeft = nextColumn && nextColumn.fixed === 'left';
|
|
lastFixLeft = !nextFixLeft;
|
|
} else if (fixRight !== undefined) {
|
|
var prevFixRight = prevColumn && prevColumn.fixed === 'right';
|
|
firstFixRight = !prevFixRight;
|
|
}
|
|
|
|
return {
|
|
fixLeft: fixLeft,
|
|
fixRight: fixRight,
|
|
lastFixLeft: lastFixLeft,
|
|
firstFixRight: firstFixRight,
|
|
lastFixRight: lastFixRight,
|
|
firstFixLeft: firstFixLeft,
|
|
isSticky: stickyOffsets.isSticky
|
|
};
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/utils/valueUtil.js
|
|
var valueUtil = __webpack_require__("sR1s");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Header/HeaderRow.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function HeaderRow(_ref) {
|
|
var cells = _ref.cells,
|
|
stickyOffsets = _ref.stickyOffsets,
|
|
flattenColumns = _ref.flattenColumns,
|
|
RowComponent = _ref.rowComponent,
|
|
CellComponent = _ref.cellComponent,
|
|
onHeaderRow = _ref.onHeaderRow,
|
|
index = _ref.index;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
direction = _React$useContext.direction;
|
|
|
|
var rowProps;
|
|
|
|
if (onHeaderRow) {
|
|
rowProps = onHeaderRow(cells.map(function (cell) {
|
|
return cell.column;
|
|
}), index);
|
|
}
|
|
|
|
var columnsKey = Object(valueUtil["a" /* getColumnsKey */])(cells.map(function (cell) {
|
|
return cell.column;
|
|
}));
|
|
return external_window_React_["createElement"](RowComponent, Object.assign({}, rowProps), cells.map(function (cell, cellIndex) {
|
|
var column = cell.column;
|
|
var fixedInfo = getCellFixedInfo(cell.colStart, cell.colEnd, flattenColumns, stickyOffsets, direction);
|
|
var additionalProps;
|
|
|
|
if (column && column.onHeaderCell) {
|
|
additionalProps = cell.column.onHeaderCell(column);
|
|
}
|
|
|
|
return external_window_React_["createElement"](Cell["a" /* default */], Object.assign({}, cell, {
|
|
ellipsis: column.ellipsis,
|
|
align: column.align,
|
|
component: CellComponent,
|
|
prefixCls: prefixCls,
|
|
key: columnsKey[cellIndex]
|
|
}, fixedInfo, {
|
|
additionalProps: additionalProps,
|
|
rowType: "header"
|
|
}));
|
|
}));
|
|
}
|
|
|
|
HeaderRow.displayName = 'HeaderRow';
|
|
/* harmony default export */ var Header_HeaderRow = (HeaderRow);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Header/Header.js
|
|
|
|
|
|
|
|
|
|
function parseHeaderRows(rootColumns) {
|
|
var rows = [];
|
|
|
|
function fillRowCells(columns, colIndex) {
|
|
var rowIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
// Init rows
|
|
rows[rowIndex] = rows[rowIndex] || [];
|
|
var currentColIndex = colIndex;
|
|
var colSpans = columns.filter(Boolean).map(function (column) {
|
|
var cell = {
|
|
key: column.key,
|
|
className: column.className || '',
|
|
children: column.title,
|
|
column: column,
|
|
colStart: currentColIndex
|
|
};
|
|
var colSpan = 1;
|
|
var subColumns = column.children;
|
|
|
|
if (subColumns && subColumns.length > 0) {
|
|
colSpan = fillRowCells(subColumns, currentColIndex, rowIndex + 1).reduce(function (total, count) {
|
|
return total + count;
|
|
}, 0);
|
|
cell.hasSubColumns = true;
|
|
}
|
|
|
|
if ('colSpan' in column) {
|
|
colSpan = column.colSpan;
|
|
}
|
|
|
|
if ('rowSpan' in column) {
|
|
cell.rowSpan = column.rowSpan;
|
|
}
|
|
|
|
cell.colSpan = colSpan;
|
|
cell.colEnd = cell.colStart + colSpan - 1;
|
|
rows[rowIndex].push(cell);
|
|
currentColIndex += colSpan;
|
|
return colSpan;
|
|
});
|
|
return colSpans;
|
|
} // Generate `rows` cell data
|
|
|
|
|
|
fillRowCells(rootColumns, 0); // Handle `rowSpan`
|
|
|
|
var rowCount = rows.length;
|
|
|
|
var _loop = function _loop(rowIndex) {
|
|
rows[rowIndex].forEach(function (cell) {
|
|
if (!('rowSpan' in cell) && !cell.hasSubColumns) {
|
|
// eslint-disable-next-line no-param-reassign
|
|
cell.rowSpan = rowCount - rowIndex;
|
|
}
|
|
});
|
|
};
|
|
|
|
for (var rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
|
|
_loop(rowIndex);
|
|
}
|
|
|
|
return rows;
|
|
}
|
|
|
|
function Header(_ref) {
|
|
var stickyOffsets = _ref.stickyOffsets,
|
|
columns = _ref.columns,
|
|
flattenColumns = _ref.flattenColumns,
|
|
onHeaderRow = _ref.onHeaderRow;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
getComponent = _React$useContext.getComponent;
|
|
|
|
var rows = external_window_React_["useMemo"](function () {
|
|
return parseHeaderRows(columns);
|
|
}, [columns]);
|
|
var WrapperComponent = getComponent(['header', 'wrapper'], 'thead');
|
|
var trComponent = getComponent(['header', 'row'], 'tr');
|
|
var thComponent = getComponent(['header', 'cell'], 'th');
|
|
return external_window_React_["createElement"](WrapperComponent, {
|
|
className: "".concat(prefixCls, "-thead")
|
|
}, rows.map(function (row, rowIndex) {
|
|
var rowNode = external_window_React_["createElement"](Header_HeaderRow, {
|
|
key: rowIndex,
|
|
flattenColumns: flattenColumns,
|
|
cells: row,
|
|
stickyOffsets: stickyOffsets,
|
|
rowComponent: trComponent,
|
|
cellComponent: thComponent,
|
|
onHeaderRow: onHeaderRow,
|
|
index: rowIndex
|
|
});
|
|
return rowNode;
|
|
}));
|
|
}
|
|
|
|
/* harmony default export */ var Header_Header = (Header);
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/utils/legacyUtil.js
|
|
var legacyUtil = __webpack_require__("hW8S");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/ColGroup.js
|
|
|
|
|
|
|
|
function ColGroup(_ref) {
|
|
var colWidths = _ref.colWidths,
|
|
columns = _ref.columns,
|
|
columCount = _ref.columCount;
|
|
var cols = [];
|
|
var len = columCount || columns.length; // Only insert col with width & additional props
|
|
// Skip if rest col do not have any useful info
|
|
|
|
var mustInsert = false;
|
|
|
|
for (var i = len - 1; i >= 0; i -= 1) {
|
|
var width = colWidths[i];
|
|
var column = columns && columns[i];
|
|
var additionalProps = column && column[legacyUtil["a" /* INTERNAL_COL_DEFINE */]];
|
|
|
|
if (width || additionalProps || mustInsert) {
|
|
cols.unshift(external_window_React_["createElement"]("col", Object.assign({
|
|
key: i,
|
|
style: {
|
|
width: width,
|
|
minWidth: width
|
|
}
|
|
}, additionalProps)));
|
|
mustInsert = true;
|
|
}
|
|
}
|
|
|
|
return external_window_React_["createElement"]("colgroup", null, cols);
|
|
}
|
|
|
|
/* harmony default export */ var es_ColGroup = (ColGroup);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Header/FixedHeader.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useColumnWidth(colWidths, columCount) {
|
|
return Object(external_window_React_["useMemo"])(function () {
|
|
var cloneColumns = [];
|
|
|
|
for (var i = 0; i < columCount; i += 1) {
|
|
var val = colWidths[i];
|
|
|
|
if (val !== undefined) {
|
|
cloneColumns[i] = val;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
return cloneColumns;
|
|
}, [colWidths.join('_'), columCount]);
|
|
}
|
|
|
|
var FixedHeader = external_window_React_["forwardRef"](function (_ref, ref) {
|
|
var noData = _ref.noData,
|
|
columns = _ref.columns,
|
|
flattenColumns = _ref.flattenColumns,
|
|
colWidths = _ref.colWidths,
|
|
columCount = _ref.columCount,
|
|
stickyOffsets = _ref.stickyOffsets,
|
|
direction = _ref.direction,
|
|
fixHeader = _ref.fixHeader,
|
|
offsetHeader = _ref.offsetHeader,
|
|
stickyClassName = _ref.stickyClassName,
|
|
onScroll = _ref.onScroll,
|
|
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["noData", "columns", "flattenColumns", "colWidths", "columCount", "stickyOffsets", "direction", "fixHeader", "offsetHeader", "stickyClassName", "onScroll"]);
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
scrollbarSize = _React$useContext.scrollbarSize,
|
|
isSticky = _React$useContext.isSticky;
|
|
|
|
var combinationScrollBarSize = isSticky && !fixHeader ? 0 : scrollbarSize; // Pass wheel to scroll event
|
|
|
|
var scrollRef = external_window_React_["useRef"](null);
|
|
var setScrollRef = external_window_React_["useCallback"](function (element) {
|
|
Object(es_ref["b" /* fillRef */])(ref, element);
|
|
Object(es_ref["b" /* fillRef */])(scrollRef, element);
|
|
}, []);
|
|
external_window_React_["useEffect"](function () {
|
|
var _scrollRef$current;
|
|
|
|
function onWheel(e) {
|
|
var currentTarget = e.currentTarget,
|
|
deltaX = e.deltaX;
|
|
|
|
if (deltaX) {
|
|
onScroll({
|
|
currentTarget: currentTarget,
|
|
scrollLeft: currentTarget.scrollLeft + deltaX
|
|
});
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
|
|
(_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.addEventListener('wheel', onWheel);
|
|
return function () {
|
|
var _scrollRef$current2;
|
|
|
|
(_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.removeEventListener('wheel', onWheel);
|
|
};
|
|
}, []); // Add scrollbar column
|
|
|
|
var lastColumn = flattenColumns[flattenColumns.length - 1];
|
|
var ScrollBarColumn = {
|
|
fixed: lastColumn ? lastColumn.fixed : null,
|
|
onHeaderCell: function onHeaderCell() {
|
|
return {
|
|
className: "".concat(prefixCls, "-cell-scrollbar")
|
|
};
|
|
}
|
|
};
|
|
var columnsWithScrollbar = Object(external_window_React_["useMemo"])(function () {
|
|
return combinationScrollBarSize ? [].concat(Object(toConsumableArray["a" /* default */])(columns), [ScrollBarColumn]) : columns;
|
|
}, [combinationScrollBarSize, columns]);
|
|
var flattenColumnsWithScrollbar = Object(external_window_React_["useMemo"])(function () {
|
|
return combinationScrollBarSize ? [].concat(Object(toConsumableArray["a" /* default */])(flattenColumns), [ScrollBarColumn]) : flattenColumns;
|
|
}, [combinationScrollBarSize, flattenColumns]); // Calculate the sticky offsets
|
|
|
|
var headerStickyOffsets = Object(external_window_React_["useMemo"])(function () {
|
|
var right = stickyOffsets.right,
|
|
left = stickyOffsets.left;
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, stickyOffsets), {}, {
|
|
left: direction === 'rtl' ? [].concat(Object(toConsumableArray["a" /* default */])(left.map(function (width) {
|
|
return width + combinationScrollBarSize;
|
|
})), [0]) : left,
|
|
right: direction === 'rtl' ? right : [].concat(Object(toConsumableArray["a" /* default */])(right.map(function (width) {
|
|
return width + combinationScrollBarSize;
|
|
})), [0]),
|
|
isSticky: isSticky
|
|
});
|
|
}, [combinationScrollBarSize, stickyOffsets, isSticky]);
|
|
var mergedColumnWidth = useColumnWidth(colWidths, columCount);
|
|
return external_window_React_["createElement"]("div", {
|
|
style: Object(objectSpread2["a" /* default */])({
|
|
overflow: 'hidden'
|
|
}, isSticky ? {
|
|
top: offsetHeader
|
|
} : {}),
|
|
ref: setScrollRef,
|
|
className: classnames_default()("".concat(prefixCls, "-header"), Object(defineProperty["a" /* default */])({}, stickyClassName, !!stickyClassName))
|
|
}, external_window_React_["createElement"]("table", {
|
|
style: {
|
|
tableLayout: 'fixed',
|
|
visibility: noData || mergedColumnWidth ? null : 'hidden'
|
|
}
|
|
}, external_window_React_["createElement"](es_ColGroup, {
|
|
colWidths: mergedColumnWidth ? [].concat(Object(toConsumableArray["a" /* default */])(mergedColumnWidth), [combinationScrollBarSize]) : [],
|
|
columCount: columCount + 1,
|
|
columns: flattenColumnsWithScrollbar
|
|
}), external_window_React_["createElement"](Header_Header, Object.assign({}, props, {
|
|
stickyOffsets: headerStickyOffsets,
|
|
columns: columnsWithScrollbar,
|
|
flattenColumns: flattenColumnsWithScrollbar
|
|
}))));
|
|
});
|
|
FixedHeader.displayName = 'FixedHeader';
|
|
/* harmony default export */ var Header_FixedHeader = (FixedHeader);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/context/BodyContext.js
|
|
|
|
var BodyContext = external_window_React_["createContext"](null);
|
|
/* harmony default export */ var context_BodyContext = (BodyContext);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Body/ExpandedRow.js
|
|
|
|
|
|
|
|
|
|
function ExpandedRow(_ref) {
|
|
var prefixCls = _ref.prefixCls,
|
|
children = _ref.children,
|
|
Component = _ref.component,
|
|
cellComponent = _ref.cellComponent,
|
|
fixHeader = _ref.fixHeader,
|
|
fixColumn = _ref.fixColumn,
|
|
horizonScroll = _ref.horizonScroll,
|
|
className = _ref.className,
|
|
expanded = _ref.expanded,
|
|
componentWidth = _ref.componentWidth,
|
|
colSpan = _ref.colSpan;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
scrollbarSize = _React$useContext.scrollbarSize; // Cache render node
|
|
|
|
|
|
return external_window_React_["useMemo"](function () {
|
|
var contentNode = children;
|
|
|
|
if (fixColumn) {
|
|
contentNode = external_window_React_["createElement"]("div", {
|
|
style: {
|
|
width: componentWidth - (fixHeader ? scrollbarSize : 0),
|
|
position: 'sticky',
|
|
left: 0,
|
|
overflow: 'hidden'
|
|
},
|
|
className: "".concat(prefixCls, "-expanded-row-fixed")
|
|
}, contentNode);
|
|
}
|
|
|
|
return external_window_React_["createElement"](Component, {
|
|
className: className,
|
|
style: {
|
|
display: expanded ? null : 'none'
|
|
}
|
|
}, external_window_React_["createElement"](Cell["a" /* default */], {
|
|
component: cellComponent,
|
|
prefixCls: prefixCls,
|
|
colSpan: colSpan
|
|
}, contentNode));
|
|
}, [children, Component, fixHeader, horizonScroll, className, expanded, componentWidth, colSpan, scrollbarSize]);
|
|
}
|
|
|
|
/* harmony default export */ var Body_ExpandedRow = (ExpandedRow);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Body/BodyRow.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function BodyRow(props) {
|
|
var className = props.className,
|
|
style = props.style,
|
|
record = props.record,
|
|
index = props.index,
|
|
rowKey = props.rowKey,
|
|
getRowKey = props.getRowKey,
|
|
rowExpandable = props.rowExpandable,
|
|
expandedKeys = props.expandedKeys,
|
|
onRow = props.onRow,
|
|
_props$indent = props.indent,
|
|
indent = _props$indent === void 0 ? 0 : _props$indent,
|
|
RowComponent = props.rowComponent,
|
|
cellComponent = props.cellComponent,
|
|
childrenColumnName = props.childrenColumnName;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
fixedInfoList = _React$useContext.fixedInfoList;
|
|
|
|
var _React$useContext2 = external_window_React_["useContext"](context_BodyContext),
|
|
fixHeader = _React$useContext2.fixHeader,
|
|
fixColumn = _React$useContext2.fixColumn,
|
|
horizonScroll = _React$useContext2.horizonScroll,
|
|
componentWidth = _React$useContext2.componentWidth,
|
|
flattenColumns = _React$useContext2.flattenColumns,
|
|
expandableType = _React$useContext2.expandableType,
|
|
expandRowByClick = _React$useContext2.expandRowByClick,
|
|
onTriggerExpand = _React$useContext2.onTriggerExpand,
|
|
rowClassName = _React$useContext2.rowClassName,
|
|
expandedRowClassName = _React$useContext2.expandedRowClassName,
|
|
indentSize = _React$useContext2.indentSize,
|
|
expandIcon = _React$useContext2.expandIcon,
|
|
expandedRowRender = _React$useContext2.expandedRowRender,
|
|
expandIconColumnIndex = _React$useContext2.expandIconColumnIndex;
|
|
|
|
var _React$useState = external_window_React_["useState"](false),
|
|
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
|
|
expandRended = _React$useState2[0],
|
|
setExpandRended = _React$useState2[1];
|
|
|
|
var expanded = expandedKeys && expandedKeys.has(props.recordKey);
|
|
external_window_React_["useEffect"](function () {
|
|
if (expanded) {
|
|
setExpandRended(true);
|
|
}
|
|
}, [expanded]);
|
|
var rowSupportExpand = expandableType === 'row' && (!rowExpandable || rowExpandable(record)); // Only when row is not expandable and `children` exist in record
|
|
|
|
var nestExpandable = expandableType === 'nest';
|
|
var hasNestChildren = childrenColumnName && record && record[childrenColumnName];
|
|
var mergedExpandable = rowSupportExpand || nestExpandable; // =========================== onRow ===========================
|
|
|
|
var additionalProps;
|
|
|
|
if (onRow) {
|
|
additionalProps = onRow(record, index);
|
|
}
|
|
|
|
var onClick = function onClick(event) {
|
|
if (expandRowByClick && mergedExpandable) {
|
|
onTriggerExpand(record, event);
|
|
}
|
|
|
|
if (additionalProps && additionalProps.onClick) {
|
|
var _additionalProps;
|
|
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
|
|
(_additionalProps = additionalProps).onClick.apply(_additionalProps, [event].concat(args));
|
|
}
|
|
}; // ======================== Base tr row ========================
|
|
|
|
|
|
var computeRowClassName;
|
|
|
|
if (typeof rowClassName === 'string') {
|
|
computeRowClassName = rowClassName;
|
|
} else if (typeof rowClassName === 'function') {
|
|
computeRowClassName = rowClassName(record, index, indent);
|
|
}
|
|
|
|
var columnsKey = Object(valueUtil["a" /* getColumnsKey */])(flattenColumns);
|
|
var baseRowNode = external_window_React_["createElement"](RowComponent, Object.assign({}, additionalProps, {
|
|
"data-row-key": rowKey,
|
|
className: classnames_default()(className, "".concat(prefixCls, "-row"), "".concat(prefixCls, "-row-level-").concat(indent), computeRowClassName, additionalProps && additionalProps.className),
|
|
style: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, style), additionalProps ? additionalProps.style : null),
|
|
onClick: onClick
|
|
}), flattenColumns.map(function (column, colIndex) {
|
|
var render = column.render,
|
|
dataIndex = column.dataIndex,
|
|
columnClassName = column.className;
|
|
var key = columnsKey[colIndex];
|
|
var fixedInfo = fixedInfoList[colIndex]; // ============= Used for nest expandable =============
|
|
|
|
var appendCellNode;
|
|
|
|
if (colIndex === (expandIconColumnIndex || 0) && nestExpandable) {
|
|
appendCellNode = external_window_React_["createElement"](external_window_React_["Fragment"], null, external_window_React_["createElement"]("span", {
|
|
style: {
|
|
paddingLeft: "".concat(indentSize * indent, "px")
|
|
},
|
|
className: "".concat(prefixCls, "-row-indent indent-level-").concat(indent)
|
|
}), expandIcon({
|
|
prefixCls: prefixCls,
|
|
expanded: expanded,
|
|
expandable: hasNestChildren,
|
|
record: record,
|
|
onExpand: onTriggerExpand
|
|
}));
|
|
}
|
|
|
|
var additionalCellProps;
|
|
|
|
if (column.onCell) {
|
|
additionalCellProps = column.onCell(record, index);
|
|
}
|
|
|
|
return external_window_React_["createElement"](Cell["a" /* default */], Object.assign({
|
|
className: columnClassName,
|
|
ellipsis: column.ellipsis,
|
|
align: column.align,
|
|
component: cellComponent,
|
|
prefixCls: prefixCls,
|
|
key: key,
|
|
record: record,
|
|
index: index,
|
|
dataIndex: dataIndex,
|
|
render: render,
|
|
shouldCellUpdate: column.shouldCellUpdate
|
|
}, fixedInfo, {
|
|
appendNode: appendCellNode,
|
|
additionalProps: additionalCellProps
|
|
}));
|
|
})); // ======================== Expand Row =========================
|
|
|
|
var expandRowNode;
|
|
|
|
if (rowSupportExpand && (expandRended || expanded)) {
|
|
var expandContent = expandedRowRender(record, index, indent + 1, expanded);
|
|
var computedExpandedRowClassName = expandedRowClassName && expandedRowClassName(record, index, indent);
|
|
expandRowNode = external_window_React_["createElement"](Body_ExpandedRow, {
|
|
expanded: expanded,
|
|
className: classnames_default()("".concat(prefixCls, "-expanded-row"), "".concat(prefixCls, "-expanded-row-level-").concat(indent + 1), computedExpandedRowClassName),
|
|
prefixCls: prefixCls,
|
|
fixHeader: fixHeader,
|
|
fixColumn: fixColumn,
|
|
horizonScroll: horizonScroll,
|
|
component: RowComponent,
|
|
componentWidth: componentWidth,
|
|
cellComponent: cellComponent,
|
|
colSpan: flattenColumns.length
|
|
}, expandContent);
|
|
} // ========================= Nest Row ==========================
|
|
|
|
|
|
var nestRowNode;
|
|
|
|
if (hasNestChildren && expanded) {
|
|
nestRowNode = (record[childrenColumnName] || []).map(function (subRecord, subIndex) {
|
|
var subKey = getRowKey(subRecord, subIndex);
|
|
return external_window_React_["createElement"](BodyRow, Object.assign({}, props, {
|
|
key: subKey,
|
|
rowKey: subKey,
|
|
record: subRecord,
|
|
recordKey: subKey,
|
|
index: subIndex,
|
|
indent: indent + 1
|
|
}));
|
|
});
|
|
}
|
|
|
|
return external_window_React_["createElement"](external_window_React_["Fragment"], null, baseRowNode, expandRowNode, nestRowNode);
|
|
}
|
|
|
|
BodyRow.displayName = 'BodyRow';
|
|
/* harmony default export */ var Body_BodyRow = (BodyRow);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/context/ResizeContext.js
|
|
|
|
var ResizeContext = external_window_React_["createContext"](null);
|
|
/* harmony default export */ var context_ResizeContext = (ResizeContext);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Body/MeasureCell.js
|
|
|
|
|
|
function MeasureCell(_ref) {
|
|
var columnKey = _ref.columnKey,
|
|
onColumnResize = _ref.onColumnResize;
|
|
var cellRef = external_window_React_["useRef"]();
|
|
external_window_React_["useEffect"](function () {
|
|
if (cellRef.current) {
|
|
onColumnResize(columnKey, cellRef.current.offsetWidth);
|
|
}
|
|
}, []);
|
|
return external_window_React_["createElement"](es["a" /* default */], {
|
|
onResize: function onResize(_ref2) {
|
|
var offsetWidth = _ref2.offsetWidth;
|
|
onColumnResize(columnKey, offsetWidth);
|
|
}
|
|
}, external_window_React_["createElement"]("td", {
|
|
ref: cellRef,
|
|
style: {
|
|
padding: 0,
|
|
border: 0,
|
|
height: 0
|
|
}
|
|
}, external_window_React_["createElement"]("div", {
|
|
style: {
|
|
height: 0,
|
|
overflow: 'hidden'
|
|
}
|
|
}, "\xA0")));
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Body/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Body(_ref) {
|
|
var data = _ref.data,
|
|
getRowKey = _ref.getRowKey,
|
|
measureColumnWidth = _ref.measureColumnWidth,
|
|
expandedKeys = _ref.expandedKeys,
|
|
onRow = _ref.onRow,
|
|
rowExpandable = _ref.rowExpandable,
|
|
emptyNode = _ref.emptyNode,
|
|
childrenColumnName = _ref.childrenColumnName;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](context_ResizeContext),
|
|
onColumnResize = _React$useContext.onColumnResize;
|
|
|
|
var _React$useContext2 = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext2.prefixCls,
|
|
getComponent = _React$useContext2.getComponent;
|
|
|
|
var _React$useContext3 = external_window_React_["useContext"](context_BodyContext),
|
|
fixHeader = _React$useContext3.fixHeader,
|
|
horizonScroll = _React$useContext3.horizonScroll,
|
|
flattenColumns = _React$useContext3.flattenColumns,
|
|
componentWidth = _React$useContext3.componentWidth;
|
|
|
|
return external_window_React_["useMemo"](function () {
|
|
var WrapperComponent = getComponent(['body', 'wrapper'], 'tbody');
|
|
var trComponent = getComponent(['body', 'row'], 'tr');
|
|
var tdComponent = getComponent(['body', 'cell'], 'td');
|
|
var rows;
|
|
|
|
if (data.length) {
|
|
rows = data.map(function (record, index) {
|
|
var key = getRowKey(record, index);
|
|
return external_window_React_["createElement"](Body_BodyRow, {
|
|
key: key,
|
|
rowKey: key,
|
|
record: record,
|
|
recordKey: key,
|
|
index: index,
|
|
rowComponent: trComponent,
|
|
cellComponent: tdComponent,
|
|
expandedKeys: expandedKeys,
|
|
onRow: onRow,
|
|
getRowKey: getRowKey,
|
|
rowExpandable: rowExpandable,
|
|
childrenColumnName: childrenColumnName
|
|
});
|
|
});
|
|
} else {
|
|
rows = external_window_React_["createElement"](Body_ExpandedRow, {
|
|
expanded: true,
|
|
className: "".concat(prefixCls, "-placeholder"),
|
|
prefixCls: prefixCls,
|
|
fixHeader: fixHeader,
|
|
fixColumn: horizonScroll,
|
|
horizonScroll: horizonScroll,
|
|
component: trComponent,
|
|
componentWidth: componentWidth,
|
|
cellComponent: tdComponent,
|
|
colSpan: flattenColumns.length
|
|
}, emptyNode);
|
|
}
|
|
|
|
var columnsKey = Object(valueUtil["a" /* getColumnsKey */])(flattenColumns);
|
|
return external_window_React_["createElement"](WrapperComponent, {
|
|
className: "".concat(prefixCls, "-tbody")
|
|
}, measureColumnWidth && external_window_React_["createElement"]("tr", {
|
|
"aria-hidden": "true",
|
|
className: "".concat(prefixCls, "-measure-row"),
|
|
style: {
|
|
height: 0
|
|
}
|
|
}, columnsKey.map(function (columnKey) {
|
|
return external_window_React_["createElement"](MeasureCell, {
|
|
key: columnKey,
|
|
columnKey: columnKey,
|
|
onColumnResize: onColumnResize
|
|
});
|
|
})), rows);
|
|
}, [data, prefixCls, onRow, measureColumnWidth, expandedKeys, getRowKey, getComponent, componentWidth, emptyNode, flattenColumns]);
|
|
}
|
|
|
|
var MemoBody = external_window_React_["memo"](Body);
|
|
MemoBody.displayName = 'Body';
|
|
/* harmony default export */ var es_Body = (MemoBody);
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/hooks/useColumns.js
|
|
var useColumns = __webpack_require__("wRmb");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/raf/index.js
|
|
var raf = __webpack_require__("xEkU");
|
|
var raf_default = /*#__PURE__*/__webpack_require__.n(raf);
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/hooks/useFrame.js
|
|
|
|
|
|
|
|
function useFrameState(defaultState) {
|
|
var stateRef = Object(external_window_React_["useRef"])(defaultState);
|
|
|
|
var _useState = Object(external_window_React_["useState"])({}),
|
|
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
|
|
forceUpdate = _useState2[1];
|
|
|
|
var timeoutRef = Object(external_window_React_["useRef"])(null);
|
|
var updateBatchRef = Object(external_window_React_["useRef"])([]);
|
|
|
|
function setFrameState(updater) {
|
|
if (timeoutRef.current === null) {
|
|
updateBatchRef.current = [];
|
|
timeoutRef.current = raf_default()(function () {
|
|
updateBatchRef.current.forEach(function (batchUpdater) {
|
|
stateRef.current = batchUpdater(stateRef.current);
|
|
});
|
|
timeoutRef.current = null;
|
|
forceUpdate({});
|
|
});
|
|
}
|
|
|
|
updateBatchRef.current.push(updater);
|
|
}
|
|
|
|
Object(external_window_React_["useEffect"])(function () {
|
|
return function () {
|
|
raf_default.a.cancel(timeoutRef.current);
|
|
};
|
|
}, []);
|
|
return [stateRef.current, setFrameState];
|
|
}
|
|
/** Lock frame, when frame pass reset the lock. */
|
|
|
|
function useTimeoutLock(defaultState) {
|
|
var frameRef = Object(external_window_React_["useRef"])(defaultState);
|
|
var timeoutRef = Object(external_window_React_["useRef"])(null);
|
|
|
|
function cleanUp() {
|
|
window.clearTimeout(timeoutRef.current);
|
|
}
|
|
|
|
function setState(newState) {
|
|
frameRef.current = newState;
|
|
cleanUp();
|
|
timeoutRef.current = window.setTimeout(function () {
|
|
frameRef.current = null;
|
|
timeoutRef.current = null;
|
|
}, 100);
|
|
}
|
|
|
|
function getState() {
|
|
return frameRef.current;
|
|
}
|
|
|
|
Object(external_window_React_["useEffect"])(function () {
|
|
return cleanUp;
|
|
}, []);
|
|
return [setState, getState];
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/hooks/useStickyOffsets.js
|
|
|
|
/**
|
|
* Get sticky column offset width
|
|
*/
|
|
|
|
function useStickyOffsets(colWidths, columCount, direction) {
|
|
var stickyOffsets = Object(external_window_React_["useMemo"])(function () {
|
|
var leftOffsets = [];
|
|
var rightOffsets = [];
|
|
var left = 0;
|
|
var right = 0;
|
|
|
|
for (var start = 0; start < columCount; start += 1) {
|
|
if (direction === 'rtl') {
|
|
// Left offset
|
|
rightOffsets[start] = right;
|
|
right += colWidths[start] || 0; // Right offset
|
|
|
|
var end = columCount - start - 1;
|
|
leftOffsets[end] = left;
|
|
left += colWidths[end] || 0;
|
|
} else {
|
|
// Left offset
|
|
leftOffsets[start] = left;
|
|
left += colWidths[start] || 0; // Right offset
|
|
|
|
var _end = columCount - start - 1;
|
|
|
|
rightOffsets[_end] = right;
|
|
right += colWidths[_end] || 0;
|
|
}
|
|
}
|
|
|
|
return {
|
|
left: leftOffsets,
|
|
right: rightOffsets
|
|
};
|
|
}, [colWidths, columCount, direction]);
|
|
return stickyOffsets;
|
|
}
|
|
|
|
/* harmony default export */ var hooks_useStickyOffsets = (useStickyOffsets);
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Panel/index.js
|
|
|
|
|
|
function Panel(_ref) {
|
|
var className = _ref.className,
|
|
children = _ref.children;
|
|
return external_window_React_["createElement"]("div", {
|
|
className: className
|
|
}, children);
|
|
}
|
|
|
|
/* harmony default export */ var es_Panel = (Panel);
|
|
// EXTERNAL MODULE: ./node_modules/rc-table/es/Footer/index.js + 2 modules
|
|
var Footer = __webpack_require__("n6Qo");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/utils/expandUtil.js
|
|
|
|
|
|
|
|
function renderExpandIcon(_ref) {
|
|
var _classNames;
|
|
|
|
var prefixCls = _ref.prefixCls,
|
|
record = _ref.record,
|
|
onExpand = _ref.onExpand,
|
|
expanded = _ref.expanded,
|
|
expandable = _ref.expandable;
|
|
var expandClassName = "".concat(prefixCls, "-row-expand-icon");
|
|
|
|
if (!expandable) {
|
|
return external_window_React_["createElement"]("span", {
|
|
className: classnames_default()(expandClassName, "".concat(prefixCls, "-row-spaced"))
|
|
});
|
|
}
|
|
|
|
var onClick = function onClick(event) {
|
|
onExpand(record, event);
|
|
event.stopPropagation();
|
|
};
|
|
|
|
return external_window_React_["createElement"]("span", {
|
|
className: classnames_default()(expandClassName, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-row-expanded"), expanded), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-row-collapsed"), !expanded), _classNames)),
|
|
onClick: onClick
|
|
});
|
|
}
|
|
function findAllChildrenKeys(data, getRowKey, childrenColumnName) {
|
|
var keys = [];
|
|
|
|
function dig(list) {
|
|
(list || []).forEach(function (item, index) {
|
|
keys.push(getRowKey(item, index));
|
|
dig(item[childrenColumnName]);
|
|
});
|
|
}
|
|
|
|
dig(data);
|
|
return keys;
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/addEventListener.js
|
|
var addEventListener = __webpack_require__("zT1h");
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/css.js
|
|
var css = __webpack_require__("y0+3");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/stickyScrollBar.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var stickyScrollBar_StickyScrollBar = function StickyScrollBar(_ref, ref) {
|
|
var _scrollBodyRef$curren, _scrollBodyRef$curren2;
|
|
|
|
var scrollBodyRef = _ref.scrollBodyRef,
|
|
onScroll = _ref.onScroll,
|
|
offsetScroll = _ref.offsetScroll;
|
|
|
|
var _React$useContext = external_window_React_["useContext"](TableContext["a" /* default */]),
|
|
prefixCls = _React$useContext.prefixCls;
|
|
|
|
var bodyScrollWidth = ((_scrollBodyRef$curren = scrollBodyRef.current) === null || _scrollBodyRef$curren === void 0 ? void 0 : _scrollBodyRef$curren.scrollWidth) || 0;
|
|
var bodyWidth = ((_scrollBodyRef$curren2 = scrollBodyRef.current) === null || _scrollBodyRef$curren2 === void 0 ? void 0 : _scrollBodyRef$curren2.clientWidth) || 0;
|
|
var scrollBarWidth = bodyScrollWidth && bodyWidth * (bodyWidth / bodyScrollWidth);
|
|
var scrollBarRef = external_window_React_["useRef"]();
|
|
|
|
var _useFrameState = useFrameState({
|
|
scrollLeft: 0,
|
|
isHiddenScrollBar: false
|
|
}),
|
|
_useFrameState2 = Object(slicedToArray["a" /* default */])(_useFrameState, 2),
|
|
frameState = _useFrameState2[0],
|
|
setFrameState = _useFrameState2[1];
|
|
|
|
var refState = external_window_React_["useRef"]({
|
|
delta: 0,
|
|
x: 0
|
|
});
|
|
|
|
var _React$useState = external_window_React_["useState"](false),
|
|
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
|
|
isActive = _React$useState2[0],
|
|
setActive = _React$useState2[1];
|
|
|
|
var onMouseUp = function onMouseUp() {
|
|
setActive(false);
|
|
};
|
|
|
|
var onMouseDown = function onMouseDown(event) {
|
|
event.persist();
|
|
refState.current.delta = event.pageX - frameState.scrollLeft;
|
|
refState.current.x = 0;
|
|
setActive(true);
|
|
event.preventDefault();
|
|
};
|
|
|
|
var onMouseMove = function onMouseMove(event) {
|
|
var _window;
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
|
|
var _ref2 = event || ((_window = window) === null || _window === void 0 ? void 0 : _window.event),
|
|
buttons = _ref2.buttons;
|
|
|
|
if (!isActive || buttons === 0) {
|
|
// If out body mouse up, we can set isActive false when mouse move
|
|
if (isActive) {
|
|
setActive(false);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
var left = refState.current.x + event.pageX - refState.current.x - refState.current.delta;
|
|
|
|
if (left <= 0) {
|
|
left = 0;
|
|
}
|
|
|
|
if (left + scrollBarWidth >= bodyWidth) {
|
|
left = bodyWidth - scrollBarWidth;
|
|
}
|
|
|
|
onScroll({
|
|
scrollLeft: left / bodyWidth * (bodyScrollWidth + 2)
|
|
});
|
|
refState.current.x = event.pageX;
|
|
};
|
|
|
|
var onContainerScroll = function onContainerScroll() {
|
|
var tableOffsetTop = Object(css["b" /* getOffset */])(scrollBodyRef.current).top;
|
|
var tableBottomOffset = tableOffsetTop + scrollBodyRef.current.offsetHeight;
|
|
var currentClientOffset = document.documentElement.scrollTop + window.innerHeight;
|
|
|
|
if (tableBottomOffset - Object(getScrollBarSize["a" /* default */])() <= currentClientOffset || tableOffsetTop >= currentClientOffset - offsetScroll) {
|
|
setFrameState(function (state) {
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, state), {}, {
|
|
isHiddenScrollBar: true
|
|
});
|
|
});
|
|
} else {
|
|
setFrameState(function (state) {
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, state), {}, {
|
|
isHiddenScrollBar: false
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|
|
var setScrollLeft = function setScrollLeft(left) {
|
|
setFrameState(function (state) {
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, state), {}, {
|
|
scrollLeft: left / bodyScrollWidth * bodyWidth || 0
|
|
});
|
|
});
|
|
};
|
|
|
|
external_window_React_["useImperativeHandle"](ref, function () {
|
|
return {
|
|
setScrollLeft: setScrollLeft
|
|
};
|
|
});
|
|
external_window_React_["useEffect"](function () {
|
|
var onMouseUpListener = Object(addEventListener["a" /* default */])(document.body, 'mouseup', onMouseUp, false);
|
|
var onMouseMoveListener = Object(addEventListener["a" /* default */])(document.body, 'mousemove', onMouseMove, false);
|
|
onContainerScroll();
|
|
return function () {
|
|
onMouseUpListener.remove();
|
|
onMouseMoveListener.remove();
|
|
};
|
|
}, [scrollBarWidth, isActive]);
|
|
external_window_React_["useEffect"](function () {
|
|
var onScrollListener = Object(addEventListener["a" /* default */])(window, 'scroll', onContainerScroll, false);
|
|
var onResizeListener = Object(addEventListener["a" /* default */])(window, 'resize', onContainerScroll, false);
|
|
return function () {
|
|
onScrollListener.remove();
|
|
onResizeListener.remove();
|
|
};
|
|
}, []);
|
|
external_window_React_["useEffect"](function () {
|
|
if (!frameState.isHiddenScrollBar) {
|
|
setFrameState(function (state) {
|
|
var _scrollBodyRef$curren3, _scrollBodyRef$curren4;
|
|
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, state), {}, {
|
|
scrollLeft: scrollBodyRef.current.scrollLeft / ((_scrollBodyRef$curren3 = scrollBodyRef.current) === null || _scrollBodyRef$curren3 === void 0 ? void 0 : _scrollBodyRef$curren3.scrollWidth) * ((_scrollBodyRef$curren4 = scrollBodyRef.current) === null || _scrollBodyRef$curren4 === void 0 ? void 0 : _scrollBodyRef$curren4.clientWidth)
|
|
});
|
|
});
|
|
}
|
|
}, [frameState.isHiddenScrollBar]);
|
|
|
|
if (bodyScrollWidth <= bodyWidth || !scrollBarWidth || frameState.isHiddenScrollBar) {
|
|
return null;
|
|
}
|
|
|
|
return external_window_React_["createElement"]("div", {
|
|
style: {
|
|
height: Object(getScrollBarSize["a" /* default */])(),
|
|
width: bodyWidth,
|
|
bottom: offsetScroll
|
|
},
|
|
className: "".concat(prefixCls, "-sticky-scroll")
|
|
}, external_window_React_["createElement"]("div", {
|
|
onMouseDown: onMouseDown,
|
|
ref: scrollBarRef,
|
|
className: classnames_default()("".concat(prefixCls, "-sticky-scroll-bar"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-sticky-scroll-bar-active"), isActive)),
|
|
style: {
|
|
width: "".concat(scrollBarWidth, "px"),
|
|
transform: "translate3d(".concat(frameState.scrollLeft, "px, 0, 0)")
|
|
}
|
|
}));
|
|
};
|
|
|
|
/* harmony default export */ var stickyScrollBar = (external_window_React_["forwardRef"](stickyScrollBar_StickyScrollBar));
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/hooks/useSticky.js
|
|
|
|
|
|
/** Sticky header hooks */
|
|
|
|
function useSticky(sticky, prefixCls) {
|
|
return external_window_React_["useMemo"](function () {
|
|
var isSticky = !!sticky;
|
|
return {
|
|
isSticky: isSticky,
|
|
stickyClassName: isSticky ? "".concat(prefixCls, "-sticky-header") : '',
|
|
offsetHeader: Object(esm_typeof["a" /* default */])(sticky) === 'object' ? sticky.offsetHeader || 0 : 0,
|
|
offsetScroll: Object(esm_typeof["a" /* default */])(sticky) === 'object' ? sticky.offsetScroll || 0 : 0
|
|
};
|
|
}, [sticky, prefixCls]);
|
|
}
|
|
// CONCATENATED MODULE: ./node_modules/rc-table/es/Table.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Feature:
|
|
* - fixed not need to set width
|
|
* - support `rowExpandable` to config row expand logic
|
|
* - add `summary` to support `() => ReactNode`
|
|
*
|
|
* Update:
|
|
* - `dataIndex` is `array[]` now
|
|
* - `expandable` wrap all the expand related props
|
|
*
|
|
* Removed:
|
|
* - expandIconAsCell
|
|
* - useFixedHeader
|
|
* - rowRef
|
|
* - columns[number].onCellClick
|
|
* - onRowClick
|
|
* - onRowDoubleClick
|
|
* - onRowMouseEnter
|
|
* - onRowMouseLeave
|
|
* - getBodyWrapper
|
|
* - bodyStyle
|
|
*
|
|
* Deprecated:
|
|
* - All expanded props, move into expandable
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Used for conditions cache
|
|
|
|
var EMPTY_DATA = []; // Used for customize scroll
|
|
|
|
var EMPTY_SCROLL_TARGET = {};
|
|
var INTERNAL_HOOKS = 'rc-table-internal-hook';
|
|
var MemoTableContent = external_window_React_["memo"](function (_ref) {
|
|
var children = _ref.children;
|
|
return children;
|
|
}, function (prev, next) {
|
|
if (!shallowequal_default()(prev.props, next.props)) {
|
|
return false;
|
|
} // No additional render when pinged status change.
|
|
// This is not a bug.
|
|
|
|
|
|
return prev.pingLeft !== next.pingLeft || prev.pingRight !== next.pingRight;
|
|
});
|
|
|
|
function Table(props) {
|
|
var _classNames;
|
|
|
|
var prefixCls = props.prefixCls,
|
|
className = props.className,
|
|
rowClassName = props.rowClassName,
|
|
style = props.style,
|
|
data = props.data,
|
|
rowKey = props.rowKey,
|
|
scroll = props.scroll,
|
|
tableLayout = props.tableLayout,
|
|
direction = props.direction,
|
|
title = props.title,
|
|
footer = props.footer,
|
|
summary = props.summary,
|
|
id = props.id,
|
|
showHeader = props.showHeader,
|
|
components = props.components,
|
|
emptyText = props.emptyText,
|
|
onRow = props.onRow,
|
|
onHeaderRow = props.onHeaderRow,
|
|
internalHooks = props.internalHooks,
|
|
transformColumns = props.transformColumns,
|
|
internalRefs = props.internalRefs,
|
|
sticky = props.sticky;
|
|
var mergedData = data || EMPTY_DATA;
|
|
var hasData = !!mergedData.length; // ===================== Effects ======================
|
|
|
|
var _React$useState = external_window_React_["useState"](0),
|
|
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
|
|
scrollbarSize = _React$useState2[0],
|
|
setScrollbarSize = _React$useState2[1];
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
setScrollbarSize(Object(getScrollBarSize["a" /* default */])());
|
|
}); // ===================== Warning ======================
|
|
|
|
if (false) {} // ==================== Customize =====================
|
|
|
|
|
|
var mergedComponents = external_window_React_["useMemo"](function () {
|
|
return Object(valueUtil["c" /* mergeObject */])(components, {});
|
|
}, [components]);
|
|
var getComponent = external_window_React_["useCallback"](function (path, defaultComponent) {
|
|
return Object(valueUtil["b" /* getPathValue */])(mergedComponents, path) || defaultComponent;
|
|
}, [mergedComponents]);
|
|
var getRowKey = external_window_React_["useMemo"](function () {
|
|
if (typeof rowKey === 'function') {
|
|
return rowKey;
|
|
}
|
|
|
|
return function (record) {
|
|
var key = record && record[rowKey];
|
|
|
|
if (false) {}
|
|
|
|
return key;
|
|
};
|
|
}, [rowKey]); // ====================== Expand ======================
|
|
|
|
var expandableConfig = Object(legacyUtil["c" /* getExpandableProps */])(props);
|
|
var expandIcon = expandableConfig.expandIcon,
|
|
expandedRowKeys = expandableConfig.expandedRowKeys,
|
|
defaultExpandedRowKeys = expandableConfig.defaultExpandedRowKeys,
|
|
defaultExpandAllRows = expandableConfig.defaultExpandAllRows,
|
|
expandedRowRender = expandableConfig.expandedRowRender,
|
|
onExpand = expandableConfig.onExpand,
|
|
onExpandedRowsChange = expandableConfig.onExpandedRowsChange,
|
|
expandRowByClick = expandableConfig.expandRowByClick,
|
|
rowExpandable = expandableConfig.rowExpandable,
|
|
expandIconColumnIndex = expandableConfig.expandIconColumnIndex,
|
|
expandedRowClassName = expandableConfig.expandedRowClassName,
|
|
childrenColumnName = expandableConfig.childrenColumnName,
|
|
indentSize = expandableConfig.indentSize;
|
|
var mergedExpandIcon = expandIcon || renderExpandIcon;
|
|
var mergedChildrenColumnName = childrenColumnName || 'children';
|
|
var expandableType = external_window_React_["useMemo"](function () {
|
|
if (expandedRowRender) {
|
|
return 'row';
|
|
}
|
|
/* eslint-disable no-underscore-dangle */
|
|
|
|
/**
|
|
* Fix https://github.com/ant-design/ant-design/issues/21154
|
|
* This is a workaround to not to break current behavior.
|
|
* We can remove follow code after final release.
|
|
*
|
|
* To other developer:
|
|
* Do not use `__PARENT_RENDER_ICON__` in prod since we will remove this when refactor
|
|
*/
|
|
|
|
|
|
if (props.expandable && internalHooks === INTERNAL_HOOKS && props.expandable.__PARENT_RENDER_ICON__ || mergedData.some(function (record) {
|
|
return record && Object(esm_typeof["a" /* default */])(record) === 'object' && record[mergedChildrenColumnName];
|
|
})) {
|
|
return 'nest';
|
|
}
|
|
/* eslint-enable */
|
|
|
|
|
|
return false;
|
|
}, [!!expandedRowRender, mergedData]);
|
|
|
|
var _React$useState3 = external_window_React_["useState"](function () {
|
|
if (defaultExpandedRowKeys) {
|
|
return defaultExpandedRowKeys;
|
|
}
|
|
|
|
if (defaultExpandAllRows) {
|
|
return findAllChildrenKeys(mergedData, getRowKey, mergedChildrenColumnName);
|
|
}
|
|
|
|
return [];
|
|
}),
|
|
_React$useState4 = Object(slicedToArray["a" /* default */])(_React$useState3, 2),
|
|
innerExpandedKeys = _React$useState4[0],
|
|
setInnerExpandedKeys = _React$useState4[1];
|
|
|
|
var mergedExpandedKeys = external_window_React_["useMemo"](function () {
|
|
return new Set(expandedRowKeys || innerExpandedKeys || []);
|
|
}, [expandedRowKeys, innerExpandedKeys]);
|
|
var onTriggerExpand = external_window_React_["useCallback"](function (record) {
|
|
var key = getRowKey(record, mergedData.indexOf(record));
|
|
var newExpandedKeys;
|
|
var hasKey = mergedExpandedKeys.has(key);
|
|
|
|
if (hasKey) {
|
|
mergedExpandedKeys.delete(key);
|
|
newExpandedKeys = Object(toConsumableArray["a" /* default */])(mergedExpandedKeys);
|
|
} else {
|
|
newExpandedKeys = [].concat(Object(toConsumableArray["a" /* default */])(mergedExpandedKeys), [key]);
|
|
}
|
|
|
|
setInnerExpandedKeys(newExpandedKeys);
|
|
|
|
if (onExpand) {
|
|
onExpand(!hasKey, record);
|
|
}
|
|
|
|
if (onExpandedRowsChange) {
|
|
onExpandedRowsChange(newExpandedKeys);
|
|
}
|
|
}, [getRowKey, mergedExpandedKeys, mergedData, onExpand, onExpandedRowsChange]); // ====================== Column ======================
|
|
|
|
var _React$useState5 = external_window_React_["useState"](0),
|
|
_React$useState6 = Object(slicedToArray["a" /* default */])(_React$useState5, 2),
|
|
componentWidth = _React$useState6[0],
|
|
setComponentWidth = _React$useState6[1];
|
|
|
|
var _useColumns = Object(useColumns["b" /* default */])(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, props), expandableConfig), {}, {
|
|
expandable: !!expandedRowRender,
|
|
expandedKeys: mergedExpandedKeys,
|
|
getRowKey: getRowKey,
|
|
// https://github.com/ant-design/ant-design/issues/23894
|
|
onTriggerExpand: onTriggerExpand,
|
|
expandIcon: mergedExpandIcon,
|
|
expandIconColumnIndex: expandIconColumnIndex,
|
|
direction: direction
|
|
}), internalHooks === INTERNAL_HOOKS ? transformColumns : null),
|
|
_useColumns2 = Object(slicedToArray["a" /* default */])(_useColumns, 2),
|
|
columns = _useColumns2[0],
|
|
flattenColumns = _useColumns2[1];
|
|
|
|
var columnContext = external_window_React_["useMemo"](function () {
|
|
return {
|
|
columns: columns,
|
|
flattenColumns: flattenColumns
|
|
};
|
|
}, [columns, flattenColumns]); // ====================== Scroll ======================
|
|
|
|
var fullTableRef = external_window_React_["useRef"]();
|
|
var scrollHeaderRef = external_window_React_["useRef"]();
|
|
var scrollBodyRef = external_window_React_["useRef"]();
|
|
|
|
var _React$useState7 = external_window_React_["useState"](false),
|
|
_React$useState8 = Object(slicedToArray["a" /* default */])(_React$useState7, 2),
|
|
pingedLeft = _React$useState8[0],
|
|
setPingedLeft = _React$useState8[1];
|
|
|
|
var _React$useState9 = external_window_React_["useState"](false),
|
|
_React$useState10 = Object(slicedToArray["a" /* default */])(_React$useState9, 2),
|
|
pingedRight = _React$useState10[0],
|
|
setPingedRight = _React$useState10[1];
|
|
|
|
var _useFrameState = useFrameState(new Map()),
|
|
_useFrameState2 = Object(slicedToArray["a" /* default */])(_useFrameState, 2),
|
|
colsWidths = _useFrameState2[0],
|
|
updateColsWidths = _useFrameState2[1]; // Convert map to number width
|
|
|
|
|
|
var colsKeys = Object(valueUtil["a" /* getColumnsKey */])(flattenColumns);
|
|
var pureColWidths = colsKeys.map(function (columnKey) {
|
|
return colsWidths.get(columnKey);
|
|
});
|
|
var colWidths = external_window_React_["useMemo"](function () {
|
|
return pureColWidths;
|
|
}, [pureColWidths.join('_')]);
|
|
var stickyOffsets = hooks_useStickyOffsets(colWidths, flattenColumns.length, direction);
|
|
var fixHeader = scroll && Object(valueUtil["d" /* validateValue */])(scroll.y);
|
|
var horizonScroll = scroll && Object(valueUtil["d" /* validateValue */])(scroll.x);
|
|
var fixColumn = horizonScroll && flattenColumns.some(function (_ref2) {
|
|
var fixed = _ref2.fixed;
|
|
return fixed;
|
|
}); // Sticky
|
|
|
|
var stickyRef = external_window_React_["useRef"]();
|
|
|
|
var _useSticky = useSticky(sticky, prefixCls),
|
|
isSticky = _useSticky.isSticky,
|
|
offsetHeader = _useSticky.offsetHeader,
|
|
offsetScroll = _useSticky.offsetScroll,
|
|
stickyClassName = _useSticky.stickyClassName;
|
|
|
|
var scrollXStyle;
|
|
var scrollYStyle;
|
|
var scrollTableStyle;
|
|
|
|
if (fixHeader) {
|
|
scrollYStyle = {
|
|
overflowY: 'scroll',
|
|
maxHeight: scroll.y
|
|
};
|
|
}
|
|
|
|
if (horizonScroll) {
|
|
scrollXStyle = {
|
|
overflowX: 'auto'
|
|
}; // When no vertical scrollbar, should hide it
|
|
// https://github.com/ant-design/ant-design/pull/20705
|
|
// https://github.com/ant-design/ant-design/issues/21879
|
|
|
|
if (!fixHeader) {
|
|
scrollYStyle = {
|
|
overflowY: 'hidden'
|
|
};
|
|
}
|
|
|
|
scrollTableStyle = {
|
|
width: scroll.x === true ? 'auto' : scroll.x,
|
|
minWidth: '100%'
|
|
};
|
|
}
|
|
|
|
var onColumnResize = external_window_React_["useCallback"](function (columnKey, width) {
|
|
updateColsWidths(function (widths) {
|
|
var newWidths = new Map(widths);
|
|
newWidths.set(columnKey, width);
|
|
return newWidths;
|
|
});
|
|
}, []);
|
|
|
|
var _useTimeoutLock = useTimeoutLock(null),
|
|
_useTimeoutLock2 = Object(slicedToArray["a" /* default */])(_useTimeoutLock, 2),
|
|
setScrollTarget = _useTimeoutLock2[0],
|
|
getScrollTarget = _useTimeoutLock2[1];
|
|
|
|
function forceScroll(scrollLeft, target) {
|
|
if (!target) {
|
|
return;
|
|
}
|
|
|
|
if (typeof target === 'function') {
|
|
target(scrollLeft);
|
|
} else if (target.scrollLeft !== scrollLeft) {
|
|
// eslint-disable-next-line no-param-reassign
|
|
target.scrollLeft = scrollLeft;
|
|
}
|
|
}
|
|
|
|
var onScroll = function onScroll(_ref3) {
|
|
var currentTarget = _ref3.currentTarget,
|
|
scrollLeft = _ref3.scrollLeft;
|
|
var mergedScrollLeft = typeof scrollLeft === 'number' ? scrollLeft : currentTarget.scrollLeft;
|
|
var compareTarget = currentTarget || EMPTY_SCROLL_TARGET;
|
|
|
|
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
var _stickyRef$current;
|
|
|
|
setScrollTarget(compareTarget);
|
|
forceScroll(mergedScrollLeft, scrollHeaderRef.current);
|
|
forceScroll(mergedScrollLeft, scrollBodyRef.current);
|
|
forceScroll(mergedScrollLeft, (_stickyRef$current = stickyRef.current) === null || _stickyRef$current === void 0 ? void 0 : _stickyRef$current.setScrollLeft);
|
|
}
|
|
|
|
if (currentTarget) {
|
|
var scrollWidth = currentTarget.scrollWidth,
|
|
clientWidth = currentTarget.clientWidth;
|
|
setPingedLeft(mergedScrollLeft > 0);
|
|
setPingedRight(mergedScrollLeft < scrollWidth - clientWidth);
|
|
}
|
|
};
|
|
|
|
var triggerOnScroll = function triggerOnScroll() {
|
|
if (scrollBodyRef.current) {
|
|
onScroll({
|
|
currentTarget: scrollBodyRef.current
|
|
});
|
|
}
|
|
};
|
|
|
|
var onFullTableResize = function onFullTableResize(_ref4) {
|
|
var width = _ref4.width;
|
|
triggerOnScroll();
|
|
setComponentWidth(fullTableRef.current ? fullTableRef.current.offsetWidth : width);
|
|
}; // Sync scroll bar when init or `horizonScroll` changed
|
|
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
return triggerOnScroll;
|
|
}, []);
|
|
external_window_React_["useEffect"](function () {
|
|
if (horizonScroll) {
|
|
triggerOnScroll();
|
|
}
|
|
}, [horizonScroll]); // ================== INTERNAL HOOKS ==================
|
|
|
|
external_window_React_["useEffect"](function () {
|
|
if (internalHooks === INTERNAL_HOOKS && internalRefs) {
|
|
internalRefs.body.current = scrollBodyRef.current;
|
|
}
|
|
}); // ====================== Render ======================
|
|
|
|
var TableComponent = getComponent(['table'], 'table'); // Table layout
|
|
|
|
var mergedTableLayout = external_window_React_["useMemo"](function () {
|
|
if (tableLayout) {
|
|
return tableLayout;
|
|
} // https://github.com/ant-design/ant-design/issues/25227
|
|
// When scroll.x is max-content, no need to fix table layout
|
|
// it's width should stretch out to fit content
|
|
|
|
|
|
if (fixColumn) {
|
|
return scroll.x === 'max-content' ? 'auto' : 'fixed';
|
|
}
|
|
|
|
if (fixHeader || flattenColumns.some(function (_ref5) {
|
|
var ellipsis = _ref5.ellipsis;
|
|
return ellipsis;
|
|
})) {
|
|
return 'fixed';
|
|
}
|
|
|
|
return 'auto';
|
|
}, [fixHeader, fixColumn, flattenColumns, tableLayout]);
|
|
var groupTableNode; // Header props
|
|
|
|
var headerProps = {
|
|
colWidths: colWidths,
|
|
columCount: flattenColumns.length,
|
|
stickyOffsets: stickyOffsets,
|
|
onHeaderRow: onHeaderRow,
|
|
fixHeader: fixHeader
|
|
}; // Empty
|
|
|
|
var emptyNode = external_window_React_["useMemo"](function () {
|
|
if (hasData) {
|
|
return null;
|
|
}
|
|
|
|
if (typeof emptyText === 'function') {
|
|
return emptyText();
|
|
}
|
|
|
|
return emptyText;
|
|
}, [hasData, emptyText]); // Body
|
|
|
|
var bodyTable = external_window_React_["createElement"](es_Body, {
|
|
data: mergedData,
|
|
measureColumnWidth: fixHeader || horizonScroll || isSticky,
|
|
expandedKeys: mergedExpandedKeys,
|
|
rowExpandable: rowExpandable,
|
|
getRowKey: getRowKey,
|
|
onRow: onRow,
|
|
emptyNode: emptyNode,
|
|
childrenColumnName: mergedChildrenColumnName
|
|
});
|
|
var bodyColGroup = external_window_React_["createElement"](es_ColGroup, {
|
|
colWidths: flattenColumns.map(function (_ref6) {
|
|
var width = _ref6.width;
|
|
return width;
|
|
}),
|
|
columns: flattenColumns
|
|
});
|
|
var footerTable = summary && external_window_React_["createElement"](Footer["b" /* default */], null, summary(mergedData));
|
|
var customizeScrollBody = getComponent(['body']);
|
|
|
|
if (false) {}
|
|
|
|
if (fixHeader || isSticky) {
|
|
var bodyContent;
|
|
|
|
if (typeof customizeScrollBody === 'function') {
|
|
bodyContent = customizeScrollBody(mergedData, {
|
|
scrollbarSize: scrollbarSize,
|
|
ref: scrollBodyRef,
|
|
onScroll: onScroll
|
|
});
|
|
headerProps.colWidths = flattenColumns.map(function (_ref7, index) {
|
|
var width = _ref7.width;
|
|
var colWidth = index === columns.length - 1 ? width - scrollbarSize : width;
|
|
|
|
if (typeof colWidth === 'number' && !Number.isNaN(colWidth)) {
|
|
return colWidth;
|
|
}
|
|
|
|
Object(warning["a" /* default */])(false, 'When use `components.body` with render props. Each column should have a fixed value.');
|
|
return 0;
|
|
});
|
|
} else {
|
|
bodyContent = external_window_React_["createElement"]("div", {
|
|
style: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, scrollXStyle), scrollYStyle),
|
|
onScroll: onScroll,
|
|
ref: scrollBodyRef,
|
|
className: classnames_default()("".concat(prefixCls, "-body"))
|
|
}, external_window_React_["createElement"](TableComponent, {
|
|
style: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, scrollTableStyle), {}, {
|
|
tableLayout: mergedTableLayout
|
|
})
|
|
}, bodyColGroup, bodyTable, footerTable), isSticky && external_window_React_["createElement"](stickyScrollBar, {
|
|
ref: stickyRef,
|
|
offsetScroll: offsetScroll,
|
|
scrollBodyRef: scrollBodyRef,
|
|
onScroll: onScroll
|
|
}));
|
|
}
|
|
|
|
groupTableNode = external_window_React_["createElement"](external_window_React_["Fragment"], null, showHeader !== false && external_window_React_["createElement"](Header_FixedHeader, Object.assign({
|
|
noData: !mergedData.length
|
|
}, headerProps, columnContext, {
|
|
direction: direction,
|
|
// Fixed Props
|
|
offsetHeader: offsetHeader,
|
|
stickyClassName: stickyClassName,
|
|
ref: scrollHeaderRef,
|
|
onScroll: onScroll
|
|
})), bodyContent);
|
|
} else {
|
|
groupTableNode = external_window_React_["createElement"]("div", {
|
|
style: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, scrollXStyle), scrollYStyle),
|
|
className: classnames_default()("".concat(prefixCls, "-content")),
|
|
onScroll: onScroll,
|
|
ref: scrollBodyRef
|
|
}, external_window_React_["createElement"](TableComponent, {
|
|
style: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, scrollTableStyle), {}, {
|
|
tableLayout: mergedTableLayout
|
|
})
|
|
}, bodyColGroup, showHeader !== false && external_window_React_["createElement"](Header_Header, Object.assign({}, headerProps, columnContext)), bodyTable, footerTable));
|
|
}
|
|
|
|
var ariaProps = Object(legacyUtil["b" /* getDataAndAriaProps */])(props);
|
|
var fullTable = external_window_React_["createElement"]("div", Object.assign({
|
|
className: classnames_default()(prefixCls, className, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-ping-left"), pingedLeft), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-ping-right"), pingedRight), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-layout-fixed"), tableLayout === 'fixed'), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-fixed-header"), fixHeader), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-fixed-column"), fixColumn), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-scroll-horizontal"), horizonScroll), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-has-fix-left"), flattenColumns[0] && flattenColumns[0].fixed), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-has-fix-right"), flattenColumns[flattenColumns.length - 1] && flattenColumns[flattenColumns.length - 1].fixed === 'right'), _classNames)),
|
|
style: style,
|
|
id: id,
|
|
ref: fullTableRef
|
|
}, ariaProps), external_window_React_["createElement"](MemoTableContent, {
|
|
pingLeft: pingedLeft,
|
|
pingRight: pingedRight,
|
|
props: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, props), {}, {
|
|
stickyOffsets: stickyOffsets,
|
|
mergedExpandedKeys: mergedExpandedKeys
|
|
})
|
|
}, title && external_window_React_["createElement"](es_Panel, {
|
|
className: "".concat(prefixCls, "-title")
|
|
}, title(mergedData)), external_window_React_["createElement"]("div", {
|
|
className: "".concat(prefixCls, "-container")
|
|
}, groupTableNode), footer && external_window_React_["createElement"](es_Panel, {
|
|
className: "".concat(prefixCls, "-footer")
|
|
}, footer(mergedData))));
|
|
|
|
if (horizonScroll) {
|
|
fullTable = external_window_React_["createElement"](es["a" /* default */], {
|
|
onResize: onFullTableResize
|
|
}, fullTable);
|
|
}
|
|
|
|
var TableContextValue = external_window_React_["useMemo"](function () {
|
|
return {
|
|
prefixCls: prefixCls,
|
|
getComponent: getComponent,
|
|
scrollbarSize: scrollbarSize,
|
|
direction: direction,
|
|
fixedInfoList: flattenColumns.map(function (_, colIndex) {
|
|
return getCellFixedInfo(colIndex, colIndex, flattenColumns, stickyOffsets, direction);
|
|
}),
|
|
isSticky: isSticky
|
|
};
|
|
}, [prefixCls, getComponent, scrollbarSize, direction, flattenColumns, stickyOffsets, direction, isSticky]);
|
|
var BodyContextValue = external_window_React_["useMemo"](function () {
|
|
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, columnContext), {}, {
|
|
tableLayout: mergedTableLayout,
|
|
rowClassName: rowClassName,
|
|
expandedRowClassName: expandedRowClassName,
|
|
componentWidth: componentWidth,
|
|
fixHeader: fixHeader,
|
|
fixColumn: fixColumn,
|
|
horizonScroll: horizonScroll,
|
|
expandIcon: mergedExpandIcon,
|
|
expandableType: expandableType,
|
|
expandRowByClick: expandRowByClick,
|
|
expandedRowRender: expandedRowRender,
|
|
onTriggerExpand: onTriggerExpand,
|
|
expandIconColumnIndex: expandIconColumnIndex,
|
|
indentSize: indentSize
|
|
});
|
|
}, [columnContext, mergedTableLayout, rowClassName, expandedRowClassName, componentWidth, fixHeader, fixColumn, horizonScroll, mergedExpandIcon, expandableType, expandRowByClick, expandedRowRender, onTriggerExpand, expandIconColumnIndex, indentSize]);
|
|
var ResizeContextValue = external_window_React_["useMemo"](function () {
|
|
return {
|
|
onColumnResize: onColumnResize
|
|
};
|
|
}, [onColumnResize]);
|
|
return external_window_React_["createElement"](TableContext["a" /* default */].Provider, {
|
|
value: TableContextValue
|
|
}, external_window_React_["createElement"](context_BodyContext.Provider, {
|
|
value: BodyContextValue
|
|
}, external_window_React_["createElement"](context_ResizeContext.Provider, {
|
|
value: ResizeContextValue
|
|
}, fullTable)));
|
|
}
|
|
|
|
Table.Column = Column["a" /* default */];
|
|
Table.ColumnGroup = ColumnGroup["a" /* default */];
|
|
Table.Summary = Footer["a" /* FooterComponents */];
|
|
Table.defaultProps = {
|
|
rowKey: 'key',
|
|
prefixCls: 'rc-table',
|
|
emptyText: function emptyText() {
|
|
return 'No Data';
|
|
}
|
|
};
|
|
/* harmony default export */ var es_Table = __webpack_exports__["b"] = (Table);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "wRmb":
|
|
/*!******************************************************!*\
|
|
!*** ./node_modules/rc-table/es/hooks/useColumns.js ***!
|
|
\******************************************************/
|
|
/*! exports provided: convertChildrenToColumns, default */
|
|
/*! exports used: convertChildrenToColumns, default */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return convertChildrenToColumns; });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "rePB");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "KQm4");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "VTBJ");
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "Ff2n");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "cDcd");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
/* harmony import */ var rc_util_es_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rc-util/es/warning */ "Kwbf");
|
|
/* harmony import */ var rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rc-util/es/Children/toArray */ "Zm9Q");
|
|
/* harmony import */ var _utils_legacyUtil__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/legacyUtil */ "hW8S");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function convertChildrenToColumns(children) {
|
|
return Object(rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(children).filter(function (node) {
|
|
return react__WEBPACK_IMPORTED_MODULE_4__["isValidElement"](node);
|
|
}).map(function (_ref) {
|
|
var key = _ref.key,
|
|
props = _ref.props;
|
|
|
|
var nodeChildren = props.children,
|
|
restProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(props, ["children"]);
|
|
|
|
var column = Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({
|
|
key: key
|
|
}, restProps);
|
|
|
|
if (nodeChildren) {
|
|
column.children = convertChildrenToColumns(nodeChildren);
|
|
}
|
|
|
|
return column;
|
|
});
|
|
}
|
|
|
|
function flatColumns(columns) {
|
|
return columns.reduce(function (list, column) {
|
|
var fixed = column.fixed; // Convert `fixed='true'` to `fixed='left'` instead
|
|
|
|
var parsedFixed = fixed === true ? 'left' : fixed;
|
|
var subColumns = column.children;
|
|
|
|
if (subColumns && subColumns.length > 0) {
|
|
return [].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(list), Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(flatColumns(subColumns).map(function (subColum) {
|
|
return Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({
|
|
fixed: parsedFixed
|
|
}, subColum);
|
|
})));
|
|
}
|
|
|
|
return [].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(list), [Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({}, column), {}, {
|
|
fixed: parsedFixed
|
|
})]);
|
|
}, []);
|
|
}
|
|
|
|
function warningFixed(flattenColumns) {
|
|
var allFixLeft = true;
|
|
|
|
for (var i = 0; i < flattenColumns.length; i += 1) {
|
|
var col = flattenColumns[i];
|
|
|
|
if (allFixLeft && col.fixed !== 'left') {
|
|
allFixLeft = false;
|
|
} else if (!allFixLeft && col.fixed === 'left') {
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(false, "Index ".concat(i - 1, " of `columns` missing `fixed='left'` prop."));
|
|
break;
|
|
}
|
|
}
|
|
|
|
var allFixRight = true;
|
|
|
|
for (var _i = flattenColumns.length - 1; _i >= 0; _i -= 1) {
|
|
var _col = flattenColumns[_i];
|
|
|
|
if (allFixRight && _col.fixed !== 'right') {
|
|
allFixRight = false;
|
|
} else if (!allFixRight && _col.fixed === 'right') {
|
|
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(false, "Index ".concat(_i + 1, " of `columns` missing `fixed='right'` prop."));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
function revertForRtl(columns) {
|
|
return columns.map(function (column) {
|
|
var fixed = column.fixed,
|
|
restProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(column, ["fixed"]); // Convert `fixed='left'` to `fixed='right'` instead
|
|
|
|
|
|
var parsedFixed = fixed;
|
|
|
|
if (fixed === 'left') {
|
|
parsedFixed = 'right';
|
|
} else if (fixed === 'right') {
|
|
parsedFixed = 'left';
|
|
}
|
|
|
|
return Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])({
|
|
fixed: parsedFixed
|
|
}, restProps);
|
|
});
|
|
}
|
|
/**
|
|
* Parse `columns` & `children` into `columns`.
|
|
*/
|
|
|
|
|
|
function useColumns(_ref2, transformColumns) {
|
|
var prefixCls = _ref2.prefixCls,
|
|
columns = _ref2.columns,
|
|
children = _ref2.children,
|
|
expandable = _ref2.expandable,
|
|
expandedKeys = _ref2.expandedKeys,
|
|
getRowKey = _ref2.getRowKey,
|
|
onTriggerExpand = _ref2.onTriggerExpand,
|
|
expandIcon = _ref2.expandIcon,
|
|
rowExpandable = _ref2.rowExpandable,
|
|
expandIconColumnIndex = _ref2.expandIconColumnIndex,
|
|
direction = _ref2.direction,
|
|
expandRowByClick = _ref2.expandRowByClick;
|
|
var baseColumns = react__WEBPACK_IMPORTED_MODULE_4__["useMemo"](function () {
|
|
return columns || convertChildrenToColumns(children);
|
|
}, [columns, children]); // Add expand column
|
|
|
|
var withExpandColumns = react__WEBPACK_IMPORTED_MODULE_4__["useMemo"](function () {
|
|
if (expandable) {
|
|
var _expandColumn;
|
|
|
|
var expandColIndex = expandIconColumnIndex || 0;
|
|
var prevColumn = baseColumns[expandColIndex];
|
|
var expandColumn = (_expandColumn = {}, Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_expandColumn, _utils_legacyUtil__WEBPACK_IMPORTED_MODULE_7__[/* INTERNAL_COL_DEFINE */ "a"], {
|
|
className: "".concat(prefixCls, "-expand-icon-col")
|
|
}), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_expandColumn, "title", ''), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_expandColumn, "fixed", prevColumn ? prevColumn.fixed : null), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_expandColumn, "className", "".concat(prefixCls, "-row-expand-icon-cell")), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_expandColumn, "render", function render(_, record, index) {
|
|
var rowKey = getRowKey(record, index);
|
|
var expanded = expandedKeys.has(rowKey);
|
|
var recordExpandable = rowExpandable ? rowExpandable(record) : true;
|
|
var icon = expandIcon({
|
|
prefixCls: prefixCls,
|
|
expanded: expanded,
|
|
expandable: recordExpandable,
|
|
record: record,
|
|
onExpand: onTriggerExpand
|
|
});
|
|
|
|
if (expandRowByClick) {
|
|
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"]("span", {
|
|
onClick: function onClick(e) {
|
|
return e.stopPropagation();
|
|
}
|
|
}, icon);
|
|
}
|
|
|
|
return icon;
|
|
}), _expandColumn); // Insert expand column in the target position
|
|
|
|
var cloneColumns = baseColumns.slice();
|
|
|
|
if (expandColIndex >= 0) {
|
|
cloneColumns.splice(expandColIndex, 0, expandColumn);
|
|
}
|
|
|
|
return cloneColumns;
|
|
}
|
|
|
|
return baseColumns;
|
|
}, [expandable, baseColumns, getRowKey, expandedKeys, expandIcon, direction]);
|
|
var mergedColumns = react__WEBPACK_IMPORTED_MODULE_4__["useMemo"](function () {
|
|
var finalColumns = withExpandColumns;
|
|
|
|
if (transformColumns) {
|
|
finalColumns = transformColumns(finalColumns);
|
|
} // Always provides at least one column for table display
|
|
|
|
|
|
if (!finalColumns.length) {
|
|
finalColumns = [{
|
|
render: function render() {
|
|
return null;
|
|
}
|
|
}];
|
|
}
|
|
|
|
return finalColumns;
|
|
}, [transformColumns, withExpandColumns, direction]);
|
|
var flattenColumns = react__WEBPACK_IMPORTED_MODULE_4__["useMemo"](function () {
|
|
if (direction === 'rtl') {
|
|
return revertForRtl(flatColumns(mergedColumns));
|
|
}
|
|
|
|
return flatColumns(mergedColumns);
|
|
}, [mergedColumns, direction]); // Only check out of production since it's waste for each render
|
|
|
|
if (false) {}
|
|
|
|
return [mergedColumns, flattenColumns];
|
|
}
|
|
|
|
/* harmony default export */ __webpack_exports__["b"] = (useColumns);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "y0+3":
|
|
/*!********************************************!*\
|
|
!*** ./node_modules/rc-util/es/Dom/css.js ***!
|
|
\********************************************/
|
|
/*! exports provided: get, set, getOuterWidth, getOuterHeight, getDocSize, getClientSize, getScroll, getOffset */
|
|
/*! exports used: getClientSize, getOffset */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* unused harmony export get */
|
|
/* unused harmony export set */
|
|
/* unused harmony export getOuterWidth */
|
|
/* unused harmony export getOuterHeight */
|
|
/* unused harmony export getDocSize */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getClientSize; });
|
|
/* unused harmony export getScroll */
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getOffset; });
|
|
/* eslint-disable no-nested-ternary */
|
|
var PIXEL_PATTERN = /margin|padding|width|height|max|min|offset/;
|
|
var removePixel = {
|
|
left: true,
|
|
top: true
|
|
};
|
|
var floatMap = {
|
|
cssFloat: 1,
|
|
styleFloat: 1,
|
|
float: 1
|
|
};
|
|
|
|
function getComputedStyle(node) {
|
|
return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
|
|
}
|
|
|
|
function getStyleValue(node, type, value) {
|
|
type = type.toLowerCase();
|
|
|
|
if (value === 'auto') {
|
|
if (type === 'height') {
|
|
return node.offsetHeight;
|
|
}
|
|
|
|
if (type === 'width') {
|
|
return node.offsetWidth;
|
|
}
|
|
}
|
|
|
|
if (!(type in removePixel)) {
|
|
removePixel[type] = PIXEL_PATTERN.test(type);
|
|
}
|
|
|
|
return removePixel[type] ? parseFloat(value) || 0 : value;
|
|
}
|
|
|
|
function get(node, name) {
|
|
var length = arguments.length;
|
|
var style = getComputedStyle(node);
|
|
name = floatMap[name] ? 'cssFloat' in node.style ? 'cssFloat' : 'styleFloat' : name;
|
|
return length === 1 ? style : getStyleValue(node, name, style[name] || node.style[name]);
|
|
}
|
|
function set(node, name, value) {
|
|
var length = arguments.length;
|
|
name = floatMap[name] ? 'cssFloat' in node.style ? 'cssFloat' : 'styleFloat' : name;
|
|
|
|
if (length === 3) {
|
|
if (typeof value === 'number' && PIXEL_PATTERN.test(name)) {
|
|
value = "".concat(value, "px");
|
|
}
|
|
|
|
node.style[name] = value; // Number
|
|
|
|
return value;
|
|
}
|
|
|
|
for (var x in name) {
|
|
if (name.hasOwnProperty(x)) {
|
|
set(node, x, name[x]);
|
|
}
|
|
}
|
|
|
|
return getComputedStyle(node);
|
|
}
|
|
function getOuterWidth(el) {
|
|
if (el === document.body) {
|
|
return document.documentElement.clientWidth;
|
|
}
|
|
|
|
return el.offsetWidth;
|
|
}
|
|
function getOuterHeight(el) {
|
|
if (el === document.body) {
|
|
return window.innerHeight || document.documentElement.clientHeight;
|
|
}
|
|
|
|
return el.offsetHeight;
|
|
}
|
|
function getDocSize() {
|
|
var width = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
|
|
var height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
|
|
return {
|
|
width: width,
|
|
height: height
|
|
};
|
|
}
|
|
function getClientSize() {
|
|
var width = document.documentElement.clientWidth;
|
|
var height = window.innerHeight || document.documentElement.clientHeight;
|
|
return {
|
|
width: width,
|
|
height: height
|
|
};
|
|
}
|
|
function getScroll() {
|
|
return {
|
|
scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
|
|
scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
|
|
};
|
|
}
|
|
function getOffset(node) {
|
|
var box = node.getBoundingClientRect();
|
|
var docElem = document.documentElement; // < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
|
|
|
|
return {
|
|
left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
|
|
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
|
|
};
|
|
}
|
|
|
|
/***/ })
|
|
|
|
}]); |