|
|
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[177],{
|
|
|
|
|
|
/***/ "/Uag":
|
|
|
/*!***********************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/ExerciseEdit/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___2EHs6","flex_space_between":"flex_space_between___1vkKn","flex_box_vertical_center":"flex_box_vertical_center___3PPfK","flex_box_center_end":"flex_box_center_end___21L0H","flex_box_column":"flex_box_column___27irt","wrap":"wrap___3IJqX","btns":"btns___1zbB6","tips":"tips___1Gjk6","crumbs":"crumbs___ySg_M","oneWrap":"oneWrap___2uGVw","title":"title___1RddJ","formWrap":"formWrap___24Shg","rb":"rb___2Um5h","twoWrap":"twoWrap___1PbSN","list":"list___2rD2r","total":"total___2xQcA","tag":"tag___1wZHF","knWarp":"knWarp___20MB2","kn":"kn___2lFyR","name":"name___pvXnk","modalColumn":"modalColumn___3NSxU","modalRow":"modalRow___BX8a0","sup":"sup___2_C4x"};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "2sxD":
|
|
|
/*!*********************************************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/List/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 = {"list":"list___3_VOx","head":"head___37dUf","name":"name___1VbnU","right":"right___gDdSx","body":"body___1wO_8","top":"top___cjRoo","bottom":"bottom___O44ku","l":"l___3de2t","ListGroup":"ListGroup___22jzr","a":"a___3Rx6Z","b":"b___S9Ybp","c":"c___3CVXw","c1":"c1___3b8Zq","radio":"radio___LnwQZ","d":"d___2-cs-"};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "51dB":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/assets/images/paper/sc.svg ***!
|
|
|
\****************************************/
|
|
|
/*! 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/sc.c1696770.svg";
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "5MlY":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/assets/images/paper/sm.svg ***!
|
|
|
\****************************************/
|
|
|
/*! 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/sm.8ccb50bf.svg";
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "5jaM":
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/assets/images/paper/dui.svg ***!
|
|
|
\*****************************************/
|
|
|
/*! 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/dui.b74348bd.svg";
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "E/GV":
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./src/assets/images/paper/swenjianjia.svg ***!
|
|
|
\*************************************************/
|
|
|
/*! 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/swenjianjia.1640bf70.svg";
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "FTkQ":
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/assets/images/icons/tagDelete.png ***!
|
|
|
\***********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABjUlEQVQ4T61VsUoDQRB9s+eVYifkUlqIWCW3sbBMqYUR0cbfUPETxPgZ2giigpZaCnKXpBK1sMydpIx25+7ISu5ILhsjclvuzLx5M292lmA57PtuF2gIYIMBSYBn3BiICAg1cF0GrqjVSvLhlL+IqtVNEDUZWLAlS+8IeAPzvtduXw77ZYAMiEjKI2LeY2AskQ2cAGaiEy8MDwnQxicL7Ep5bDL+xmqijahZDsODDHBQ5sVfmVn6xmDeMuWTESAGnqf1bBpz09MSsESx729r4DwfIIA6hPjUSt2AaP7Hztwj5nXHdd0vpR7yMQzsUOT7pwzsjgEKsVIKgiCu1Za1UvfGLhynXgqCp6hSkSxEYCn9jLq+/wJgcawk5l4KYECN3YBlCVLWo4GvhmGfgVlrj4ZAjX0KmBmZD8Owj4IAMQAsvGSrKKR1zet0QpsosZQrmvnRKsqksZlxnFWVJAkT3Y6MDbAmgDlFdGcdm8IH22Qp9OmltAtdDoPlWez6SpkWtmCHFTNCvQMN/scX8A1e4fnIOEHt8AAAAABJRU5ErkJggg=="
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "Gytx":
|
|
|
/*!********************************************!*\
|
|
|
!*** ./node_modules/shallowequal/index.js ***!
|
|
|
\********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
//
|
|
|
|
|
|
module.exports = function shallowEqual(objA, objB, compare, compareContext) {
|
|
|
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
|
|
|
|
|
if (ret !== void 0) {
|
|
|
return !!ret;
|
|
|
}
|
|
|
|
|
|
if (objA === objB) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var keysA = Object.keys(objA);
|
|
|
var keysB = Object.keys(objB);
|
|
|
|
|
|
if (keysA.length !== keysB.length) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
|
|
|
|
// Test for A's keys different from B.
|
|
|
for (var idx = 0; idx < keysA.length; idx++) {
|
|
|
var key = keysA[idx];
|
|
|
|
|
|
if (!bHasOwnProperty(key)) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var valueA = objA[key];
|
|
|
var valueB = objB[key];
|
|
|
|
|
|
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
|
|
|
|
|
if (ret === false || (ret === void 0 && valueA !== valueB)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "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);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "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);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "YBdh":
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./src/assets/images/paper/xiren.svg ***!
|
|
|
\*******************************************/
|
|
|
/*! 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/xiren.a6554bc1.svg";
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "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);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "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;
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "dmUQ":
|
|
|
/*!**************************************************************!*\
|
|
|
!*** ./node_modules/rc-input-number/es/index.js + 1 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/defineProperty.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.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/objectWithoutProperties.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.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/KeyCode.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__("Ff2n");
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
|
var defineProperty = __webpack_require__("rePB");
|
|
|
|
|
|
// 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/possibleConstructorReturn.js
|
|
|
var possibleConstructorReturn = __webpack_require__("md7G");
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
|
|
|
var getPrototypeOf = __webpack_require__("foSv");
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js
|
|
|
var KeyCode = __webpack_require__("4IlW");
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-input-number/es/InputNumber.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
|
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
|
|
|
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; }
|
|
|
|
|
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
|
|
|
|
/* eslint-disable react/prop-types */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function noop() {}
|
|
|
|
|
|
function preventDefault(e) {
|
|
|
e.preventDefault();
|
|
|
}
|
|
|
|
|
|
var defaultParser = function defaultParser(input) {
|
|
|
return input.replace(/[^\w.-]+/g, '');
|
|
|
};
|
|
|
/**
|
|
|
* When click and hold on a button - the speed of auto changin the value.
|
|
|
*/
|
|
|
|
|
|
|
|
|
var SPEED = 200;
|
|
|
/**
|
|
|
* When click and hold on a button - the delay before auto changin the value.
|
|
|
*/
|
|
|
|
|
|
var DELAY = 600;
|
|
|
/**
|
|
|
* Max Safe Integer -- on IE this is not available, so manually set the number in that case.
|
|
|
* The reason this is used, instead of Infinity is because numbers above the MSI are unstable
|
|
|
*/
|
|
|
|
|
|
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;
|
|
|
|
|
|
var isValidProps = function isValidProps(value) {
|
|
|
return value !== undefined && value !== null;
|
|
|
};
|
|
|
|
|
|
var isEqual = function isEqual(oldValue, newValue) {
|
|
|
return newValue === oldValue || typeof newValue === 'number' && typeof oldValue === 'number' && isNaN(newValue) && isNaN(oldValue);
|
|
|
};
|
|
|
|
|
|
var InputNumber_InputNumber = /*#__PURE__*/function (_React$Component) {
|
|
|
Object(inherits["a" /* default */])(InputNumber, _React$Component);
|
|
|
|
|
|
var _super = _createSuper(InputNumber);
|
|
|
|
|
|
function InputNumber(props) {
|
|
|
var _this;
|
|
|
|
|
|
Object(classCallCheck["a" /* default */])(this, InputNumber);
|
|
|
|
|
|
_this = _super.call(this, props);
|
|
|
|
|
|
_this.onKeyDown = function (e) {
|
|
|
var _this$props = _this.props,
|
|
|
onKeyDown = _this$props.onKeyDown,
|
|
|
onPressEnter = _this$props.onPressEnter;
|
|
|
|
|
|
if (e.keyCode === KeyCode["a" /* default */].UP) {
|
|
|
var ratio = _this.getRatio(e);
|
|
|
|
|
|
_this.up(e, ratio, null);
|
|
|
|
|
|
_this.stop();
|
|
|
} else if (e.keyCode === KeyCode["a" /* default */].DOWN) {
|
|
|
var _ratio = _this.getRatio(e);
|
|
|
|
|
|
_this.down(e, _ratio, null);
|
|
|
|
|
|
_this.stop();
|
|
|
} else if (e.keyCode === KeyCode["a" /* default */].ENTER && onPressEnter) {
|
|
|
onPressEnter(e);
|
|
|
} // Trigger user key down
|
|
|
|
|
|
|
|
|
_this.recordCursorPosition();
|
|
|
|
|
|
_this.lastKeyCode = e.keyCode;
|
|
|
|
|
|
if (onKeyDown) {
|
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
|
args[_key - 1] = arguments[_key];
|
|
|
}
|
|
|
|
|
|
onKeyDown.apply(void 0, [e].concat(args));
|
|
|
}
|
|
|
};
|
|
|
|
|
|
_this.onKeyUp = function (e) {
|
|
|
var onKeyUp = _this.props.onKeyUp;
|
|
|
|
|
|
_this.stop();
|
|
|
|
|
|
_this.recordCursorPosition(); // Trigger user key up
|
|
|
|
|
|
|
|
|
if (onKeyUp) {
|
|
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
|
args[_key2 - 1] = arguments[_key2];
|
|
|
}
|
|
|
|
|
|
onKeyUp.apply(void 0, [e].concat(args));
|
|
|
}
|
|
|
};
|
|
|
|
|
|
_this.onChange = function (e) {
|
|
|
var onChange = _this.props.onChange;
|
|
|
|
|
|
if (_this.state.focused) {
|
|
|
_this.inputting = true;
|
|
|
}
|
|
|
|
|
|
_this.rawInput = _this.props.parser(_this.getValueFromEvent(e));
|
|
|
|
|
|
_this.setState({
|
|
|
inputValue: _this.rawInput
|
|
|
});
|
|
|
|
|
|
onChange(_this.toNumber(_this.rawInput)); // valid number or invalid string
|
|
|
};
|
|
|
|
|
|
_this.onMouseUp = function () {
|
|
|
var onMouseUp = _this.props.onMouseUp;
|
|
|
|
|
|
_this.recordCursorPosition();
|
|
|
|
|
|
if (onMouseUp) {
|
|
|
onMouseUp.apply(void 0, arguments);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
_this.onFocus = function () {
|
|
|
var _this$props2;
|
|
|
|
|
|
_this.setState({
|
|
|
focused: true
|
|
|
});
|
|
|
|
|
|
(_this$props2 = _this.props).onFocus.apply(_this$props2, arguments);
|
|
|
};
|
|
|
|
|
|
_this.onBlur = function () {
|
|
|
var onBlur = _this.props.onBlur;
|
|
|
_this.inputting = false;
|
|
|
|
|
|
_this.setState({
|
|
|
focused: false
|
|
|
});
|
|
|
|
|
|
var value = _this.getCurrentValidValue(_this.state.inputValue);
|
|
|
|
|
|
var newValue = _this.setValue(value, noop);
|
|
|
|
|
|
if (onBlur) {
|
|
|
var originValue = _this.input.value;
|
|
|
|
|
|
var displayValue = _this.getInputDisplayValue({
|
|
|
focus: false,
|
|
|
value: newValue
|
|
|
});
|
|
|
|
|
|
_this.input.value = displayValue ? Number(displayValue) : displayValue;
|
|
|
onBlur.apply(void 0, arguments);
|
|
|
_this.input.value = originValue;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
_this.getRatio = function (e) {
|
|
|
var ratio = 1;
|
|
|
|
|
|
if (e.metaKey || e.ctrlKey) {
|
|
|
ratio = 0.1;
|
|
|
} else if (e.shiftKey) {
|
|
|
ratio = 10;
|
|
|
}
|
|
|
|
|
|
return ratio;
|
|
|
};
|
|
|
|
|
|
_this.getFullNum = function (num) {
|
|
|
if (isNaN(num)) {
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
if (!/e/i.test(String(num))) {
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
return Number(num).toFixed(18).replace(/\.?0+$/, '');
|
|
|
};
|
|
|
|
|
|
_this.getPrecision = function (value) {
|
|
|
if (isValidProps(_this.props.precision)) {
|
|
|
return _this.props.precision;
|
|
|
}
|
|
|
|
|
|
var valueString = String(value);
|
|
|
|
|
|
if (valueString.indexOf('e-') >= 0) {
|
|
|
return parseInt(valueString.slice(valueString.indexOf('e-') + 2), 10);
|
|
|
}
|
|
|
|
|
|
var precision = 0;
|
|
|
|
|
|
if (valueString.indexOf('.') >= 0) {
|
|
|
precision = valueString.length - valueString.indexOf('.') - 1;
|
|
|
}
|
|
|
|
|
|
return precision;
|
|
|
};
|
|
|
|
|
|
_this.getInputDisplayValue = function (state) {
|
|
|
var _ref = state || _this.state,
|
|
|
focused = _ref.focused,
|
|
|
inputValue = _ref.inputValue,
|
|
|
value = _ref.value;
|
|
|
|
|
|
var inputDisplayValue;
|
|
|
|
|
|
if (focused) {
|
|
|
inputDisplayValue = inputValue;
|
|
|
} else {
|
|
|
inputDisplayValue = _this.toPrecisionAsStep(value);
|
|
|
}
|
|
|
|
|
|
if (inputDisplayValue === undefined || inputDisplayValue === null) {
|
|
|
inputDisplayValue = '';
|
|
|
}
|
|
|
|
|
|
var inputDisplayValueFormat = _this.formatWrapper(inputDisplayValue);
|
|
|
|
|
|
if (isValidProps(_this.props.decimalSeparator)) {
|
|
|
inputDisplayValueFormat = inputDisplayValueFormat.toString().replace('.', _this.props.decimalSeparator);
|
|
|
}
|
|
|
|
|
|
return inputDisplayValueFormat;
|
|
|
};
|
|
|
|
|
|
_this.recordCursorPosition = function () {
|
|
|
// Record position
|
|
|
try {
|
|
|
_this.cursorStart = _this.input.selectionStart;
|
|
|
_this.cursorEnd = _this.input.selectionEnd;
|
|
|
_this.currentValue = _this.input.value;
|
|
|
_this.cursorBefore = _this.input.value.substring(0, _this.cursorStart);
|
|
|
_this.cursorAfter = _this.input.value.substring(_this.cursorEnd);
|
|
|
} catch (e) {// Fix error in Chrome:
|
|
|
// Failed to read the 'selectionStart' property from 'HTMLInputElement'
|
|
|
// http://stackoverflow.com/q/21177489/3040605
|
|
|
}
|
|
|
};
|
|
|
|
|
|
_this.restoreByAfter = function (str) {
|
|
|
if (str === undefined) return false;
|
|
|
var fullStr = _this.input.value;
|
|
|
var index = fullStr.lastIndexOf(str);
|
|
|
if (index === -1) return false;
|
|
|
var prevCursorPos = _this.cursorBefore.length;
|
|
|
|
|
|
if (_this.lastKeyCode === KeyCode["a" /* default */].DELETE && _this.cursorBefore.charAt(prevCursorPos - 1) === str[0]) {
|
|
|
_this.fixCaret(prevCursorPos, prevCursorPos);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
if (index + str.length === fullStr.length) {
|
|
|
_this.fixCaret(index, index);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
_this.partRestoreByAfter = function (str) {
|
|
|
if (str === undefined) return false; // For loop from full str to the str with last char to map. e.g. 123
|
|
|
// -> 123
|
|
|
// -> 23
|
|
|
// -> 3
|
|
|
|
|
|
return Array.prototype.some.call(str, function (_, start) {
|
|
|
var partStr = str.substring(start);
|
|
|
return _this.restoreByAfter(partStr);
|
|
|
});
|
|
|
}; // '1.' '1x' 'xx' '' => are not complete numbers
|
|
|
|
|
|
|
|
|
_this.isNotCompleteNumber = function (num) {
|
|
|
return isNaN(num) || num === '' || num === null || num && num.toString().indexOf('.') === num.toString().length - 1;
|
|
|
};
|
|
|
|
|
|
_this.stop = function () {
|
|
|
if (_this.autoStepTimer) {
|
|
|
clearTimeout(_this.autoStepTimer);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
_this.down = function (e, ratio, recursive) {
|
|
|
_this.pressingUpOrDown = true;
|
|
|
|
|
|
_this.step('down', e, ratio, recursive);
|
|
|
};
|
|
|
|
|
|
_this.up = function (e, ratio, recursive) {
|
|
|
_this.pressingUpOrDown = true;
|
|
|
|
|
|
_this.step('up', e, ratio, recursive);
|
|
|
};
|
|
|
|
|
|
_this.saveInput = function (node) {
|
|
|
_this.input = node;
|
|
|
};
|
|
|
|
|
|
var value = props.value;
|
|
|
|
|
|
if (value === undefined) {
|
|
|
value = props.defaultValue;
|
|
|
}
|
|
|
|
|
|
_this.state = {
|
|
|
focused: props.autoFocus
|
|
|
};
|
|
|
|
|
|
var validValue = _this.getValidValue(_this.toNumber(value));
|
|
|
|
|
|
_this.state = _objectSpread(_objectSpread({}, _this.state), {}, {
|
|
|
inputValue: _this.toPrecisionAsStep(validValue),
|
|
|
value: validValue
|
|
|
});
|
|
|
return _this;
|
|
|
}
|
|
|
|
|
|
Object(createClass["a" /* default */])(InputNumber, [{
|
|
|
key: "componentDidMount",
|
|
|
value: function componentDidMount() {
|
|
|
this.componentDidUpdate(null);
|
|
|
}
|
|
|
}, {
|
|
|
key: "componentDidUpdate",
|
|
|
value: function componentDidUpdate(prevProps) {
|
|
|
var _this$props3 = this.props,
|
|
|
value = _this$props3.value,
|
|
|
onChange = _this$props3.onChange,
|
|
|
max = _this$props3.max,
|
|
|
min = _this$props3.min;
|
|
|
var focused = this.state.focused; // Don't trigger in componentDidMount
|
|
|
|
|
|
if (prevProps) {
|
|
|
if (!isEqual(prevProps.value, value) || !isEqual(prevProps.max, max) || !isEqual(prevProps.min, min)) {
|
|
|
var validValue = focused ? value : this.getValidValue(value);
|
|
|
var nextInputValue;
|
|
|
|
|
|
if (this.pressingUpOrDown) {
|
|
|
nextInputValue = validValue;
|
|
|
} else if (this.inputting) {
|
|
|
nextInputValue = this.rawInput;
|
|
|
} else {
|
|
|
nextInputValue = this.toPrecisionAsStep(validValue);
|
|
|
}
|
|
|
|
|
|
this.setState({
|
|
|
// eslint-disable-line
|
|
|
value: validValue,
|
|
|
inputValue: nextInputValue
|
|
|
});
|
|
|
} // Trigger onChange when max or min change
|
|
|
// https://github.com/ant-design/ant-design/issues/11574
|
|
|
|
|
|
|
|
|
var nextValue = 'value' in this.props ? value : this.state.value; // ref: null < 20 === true
|
|
|
// https://github.com/ant-design/ant-design/issues/14277
|
|
|
|
|
|
if ('max' in this.props && prevProps.max !== max && typeof nextValue === 'number' && nextValue > max && onChange) {
|
|
|
onChange(max);
|
|
|
}
|
|
|
|
|
|
if ('min' in this.props && prevProps.min !== min && typeof nextValue === 'number' && nextValue < min && onChange) {
|
|
|
onChange(min);
|
|
|
}
|
|
|
} // Restore cursor
|
|
|
|
|
|
|
|
|
try {
|
|
|
// Firefox set the input cursor after it get focused.
|
|
|
// This caused that if an input didn't init with the selection,
|
|
|
// set will cause cursor not correct when first focus.
|
|
|
// Safari will focus input if set selection. We need skip this.
|
|
|
if (this.cursorStart !== undefined && this.state.focused) {
|
|
|
// In most cases, the string after cursor is stable.
|
|
|
// We can move the cursor before it
|
|
|
if ( // If not match full str, try to match part of str
|
|
|
!this.partRestoreByAfter(this.cursorAfter) && this.state.value !== this.props.value) {
|
|
|
// If not match any of then, let's just keep the position
|
|
|
// TODO: Logic should not reach here, need check if happens
|
|
|
var pos = this.cursorStart + 1; // If not have last string, just position to the end
|
|
|
|
|
|
if (!this.cursorAfter) {
|
|
|
pos = this.input.value.length;
|
|
|
} else if (this.lastKeyCode === KeyCode["a" /* default */].BACKSPACE) {
|
|
|
pos = this.cursorStart - 1;
|
|
|
} else if (this.lastKeyCode === KeyCode["a" /* default */].DELETE) {
|
|
|
pos = this.cursorStart;
|
|
|
}
|
|
|
|
|
|
this.fixCaret(pos, pos);
|
|
|
} else if (this.currentValue === this.input.value) {
|
|
|
// Handle some special key code
|
|
|
switch (this.lastKeyCode) {
|
|
|
case KeyCode["a" /* default */].BACKSPACE:
|
|
|
this.fixCaret(this.cursorStart - 1, this.cursorStart - 1);
|
|
|
break;
|
|
|
|
|
|
case KeyCode["a" /* default */].DELETE:
|
|
|
this.fixCaret(this.cursorStart + 1, this.cursorStart + 1);
|
|
|
break;
|
|
|
|
|
|
default: // Do nothing
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} catch (e) {// Do nothing
|
|
|
} // Reset last key
|
|
|
|
|
|
|
|
|
this.lastKeyCode = null; // pressingUpOrDown is true means that someone just click up or down button
|
|
|
|
|
|
if (!this.pressingUpOrDown) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (this.props.focusOnUpDown && this.state.focused) {
|
|
|
if (document.activeElement !== this.input) {
|
|
|
this.focus();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
key: "componentWillUnmount",
|
|
|
value: function componentWillUnmount() {
|
|
|
this.stop();
|
|
|
}
|
|
|
}, {
|
|
|
key: "getCurrentValidValue",
|
|
|
value: function getCurrentValidValue(value) {
|
|
|
var val = value;
|
|
|
|
|
|
if (val === '') {
|
|
|
val = '';
|
|
|
} else if (!this.isNotCompleteNumber(parseFloat(val))) {
|
|
|
val = this.getValidValue(val);
|
|
|
} else {
|
|
|
val = this.state.value;
|
|
|
}
|
|
|
|
|
|
return this.toNumber(val);
|
|
|
}
|
|
|
}, {
|
|
|
key: "getValueFromEvent",
|
|
|
value: function getValueFromEvent(e) {
|
|
|
// optimize for chinese input expierence
|
|
|
// https://github.com/ant-design/ant-design/issues/8196
|
|
|
var value = e.target.value.trim().replace(/。/g, '.');
|
|
|
|
|
|
if (isValidProps(this.props.decimalSeparator)) {
|
|
|
value = value.replace(this.props.decimalSeparator, '.');
|
|
|
}
|
|
|
|
|
|
return value;
|
|
|
}
|
|
|
}, {
|
|
|
key: "getValidValue",
|
|
|
value: function getValidValue(value) {
|
|
|
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.props.min;
|
|
|
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.props.max;
|
|
|
var val = parseFloat(value); // https://github.com/ant-design/ant-design/issues/7358
|
|
|
|
|
|
if (isNaN(val)) {
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
if (val < min) {
|
|
|
val = min;
|
|
|
}
|
|
|
|
|
|
if (val > max) {
|
|
|
val = max;
|
|
|
}
|
|
|
|
|
|
return val;
|
|
|
}
|
|
|
}, {
|
|
|
key: "setValue",
|
|
|
value: function setValue(v, callback) {
|
|
|
// trigger onChange
|
|
|
var precision = this.props.precision;
|
|
|
var newValue = this.isNotCompleteNumber(parseFloat(v)) ? null : parseFloat(v);
|
|
|
var _this$state$value = this.state.value,
|
|
|
value = _this$state$value === void 0 ? null : _this$state$value;
|
|
|
var _this$state$inputValu = this.state.inputValue,
|
|
|
inputValue = _this$state$inputValu === void 0 ? null : _this$state$inputValu; // https://github.com/ant-design/ant-design/issues/7363
|
|
|
// https://github.com/ant-design/ant-design/issues/16622
|
|
|
|
|
|
var newValueInString = typeof newValue === 'number' ? newValue.toFixed(precision) : "".concat(newValue);
|
|
|
var changed = newValue !== value || newValueInString !== "".concat(inputValue);
|
|
|
|
|
|
if (!('value' in this.props)) {
|
|
|
this.setState({
|
|
|
value: newValue,
|
|
|
inputValue: this.toPrecisionAsStep(v)
|
|
|
}, callback);
|
|
|
} else {
|
|
|
// always set input value same as value
|
|
|
inputValue = this.toPrecisionAsStep(this.state.value);
|
|
|
this.setState({
|
|
|
inputValue: inputValue
|
|
|
}, callback);
|
|
|
}
|
|
|
|
|
|
if (changed) {
|
|
|
this.props.onChange(newValue);
|
|
|
}
|
|
|
|
|
|
return newValue;
|
|
|
} // step={1.0} value={1.51}
|
|
|
// press +
|
|
|
// then value should be 2.51, rather than 2.5
|
|
|
// if this.props.precision is undefined
|
|
|
// https://github.com/react-component/input-number/issues/39
|
|
|
|
|
|
}, {
|
|
|
key: "getMaxPrecision",
|
|
|
value: function getMaxPrecision(currentValue) {
|
|
|
var ratio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
|
var _this$props4 = this.props,
|
|
|
precision = _this$props4.precision,
|
|
|
step = _this$props4.step;
|
|
|
|
|
|
if (isValidProps(precision)) {
|
|
|
return precision;
|
|
|
}
|
|
|
|
|
|
var ratioPrecision = this.getPrecision(ratio);
|
|
|
var stepPrecision = this.getPrecision(step);
|
|
|
var currentValuePrecision = this.getPrecision(currentValue);
|
|
|
|
|
|
if (!currentValue) {
|
|
|
return ratioPrecision + stepPrecision;
|
|
|
}
|
|
|
|
|
|
return Math.max(currentValuePrecision, ratioPrecision + stepPrecision);
|
|
|
}
|
|
|
}, {
|
|
|
key: "getPrecisionFactor",
|
|
|
value: function getPrecisionFactor(currentValue) {
|
|
|
var ratio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
|
var precision = this.getMaxPrecision(currentValue, ratio);
|
|
|
return Math.pow(10, precision);
|
|
|
}
|
|
|
}, {
|
|
|
key: "focus",
|
|
|
value: function focus() {
|
|
|
this.input.focus();
|
|
|
this.recordCursorPosition();
|
|
|
}
|
|
|
}, {
|
|
|
key: "blur",
|
|
|
value: function blur() {
|
|
|
this.input.blur();
|
|
|
}
|
|
|
}, {
|
|
|
key: "select",
|
|
|
value: function select() {
|
|
|
this.input.select();
|
|
|
}
|
|
|
}, {
|
|
|
key: "formatWrapper",
|
|
|
value: function formatWrapper(num) {
|
|
|
// http://2ality.com/2012/03/signedzero.html
|
|
|
// https://github.com/ant-design/ant-design/issues/9439
|
|
|
if (this.props.formatter) {
|
|
|
return this.props.formatter(num);
|
|
|
}
|
|
|
|
|
|
return num;
|
|
|
}
|
|
|
}, {
|
|
|
key: "toPrecisionAsStep",
|
|
|
value: function toPrecisionAsStep(num) {
|
|
|
if (this.isNotCompleteNumber(num) || num === '') {
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
var precision = Math.abs(this.getMaxPrecision(num));
|
|
|
|
|
|
if (!isNaN(precision)) {
|
|
|
return Number(num).toFixed(precision);
|
|
|
}
|
|
|
|
|
|
return num.toString();
|
|
|
}
|
|
|
}, {
|
|
|
key: "toNumber",
|
|
|
value: function toNumber(num) {
|
|
|
var precision = this.props.precision;
|
|
|
var focused = this.state.focused; // num.length > 16 => This is to prevent input of large numbers
|
|
|
|
|
|
var numberIsTooLarge = num && num.length > 16 && focused;
|
|
|
|
|
|
if (this.isNotCompleteNumber(num) || numberIsTooLarge) {
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
if (isValidProps(precision)) {
|
|
|
return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision);
|
|
|
}
|
|
|
|
|
|
return Number(num);
|
|
|
}
|
|
|
}, {
|
|
|
key: "upStep",
|
|
|
value: function upStep(val, rat) {
|
|
|
var step = this.props.step;
|
|
|
var precisionFactor = this.getPrecisionFactor(val, rat);
|
|
|
var precision = Math.abs(this.getMaxPrecision(val, rat));
|
|
|
var result = ((precisionFactor * val + precisionFactor * step * rat) / precisionFactor).toFixed(precision);
|
|
|
return this.toNumber(result);
|
|
|
}
|
|
|
}, {
|
|
|
key: "downStep",
|
|
|
value: function downStep(val, rat) {
|
|
|
var step = this.props.step;
|
|
|
var precisionFactor = this.getPrecisionFactor(val, rat);
|
|
|
var precision = Math.abs(this.getMaxPrecision(val, rat));
|
|
|
var result = ((precisionFactor * val - precisionFactor * step * rat) / precisionFactor).toFixed(precision);
|
|
|
return this.toNumber(result);
|
|
|
}
|
|
|
}, {
|
|
|
key: "step",
|
|
|
value: function step(type, e) {
|
|
|
var _this2 = this;
|
|
|
|
|
|
var ratio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
|
var recursive = arguments.length > 3 ? arguments[3] : undefined;
|
|
|
this.stop();
|
|
|
|
|
|
if (e) {
|
|
|
e.persist();
|
|
|
e.preventDefault();
|
|
|
}
|
|
|
|
|
|
var props = this.props;
|
|
|
|
|
|
if (props.disabled) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var value = this.getCurrentValidValue(this.state.inputValue) || 0;
|
|
|
|
|
|
if (this.isNotCompleteNumber(value)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var val = this["".concat(type, "Step")](value, ratio);
|
|
|
var outOfRange = val > props.max || val < props.min;
|
|
|
|
|
|
if (val > props.max) {
|
|
|
val = props.max;
|
|
|
} else if (val < props.min) {
|
|
|
val = props.min;
|
|
|
}
|
|
|
|
|
|
this.setValue(val, null);
|
|
|
this.setState({
|
|
|
focused: true
|
|
|
}, function () {
|
|
|
_this2.pressingUpOrDown = false;
|
|
|
});
|
|
|
|
|
|
if (outOfRange) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.autoStepTimer = setTimeout(function () {
|
|
|
_this2[type](e, ratio, true);
|
|
|
}, recursive ? SPEED : DELAY);
|
|
|
}
|
|
|
}, {
|
|
|
key: "fixCaret",
|
|
|
value: function fixCaret(start, end) {
|
|
|
if (start === undefined || end === undefined || !this.input || !this.input.value) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
var currentStart = this.input.selectionStart;
|
|
|
var currentEnd = this.input.selectionEnd;
|
|
|
|
|
|
if (start !== currentStart || end !== currentEnd) {
|
|
|
this.input.setSelectionRange(start, end);
|
|
|
}
|
|
|
} 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() {
|
|
|
var _classNames;
|
|
|
|
|
|
var _this$props5 = this.props,
|
|
|
prefixCls = _this$props5.prefixCls,
|
|
|
disabled = _this$props5.disabled,
|
|
|
readOnly = _this$props5.readOnly,
|
|
|
useTouch = _this$props5.useTouch,
|
|
|
autoComplete = _this$props5.autoComplete,
|
|
|
upHandler = _this$props5.upHandler,
|
|
|
downHandler = _this$props5.downHandler,
|
|
|
className = _this$props5.className,
|
|
|
max = _this$props5.max,
|
|
|
min = _this$props5.min,
|
|
|
style = _this$props5.style,
|
|
|
title = _this$props5.title,
|
|
|
onMouseEnter = _this$props5.onMouseEnter,
|
|
|
onMouseLeave = _this$props5.onMouseLeave,
|
|
|
onMouseOver = _this$props5.onMouseOver,
|
|
|
onMouseOut = _this$props5.onMouseOut,
|
|
|
required = _this$props5.required,
|
|
|
onClick = _this$props5.onClick,
|
|
|
tabIndex = _this$props5.tabIndex,
|
|
|
type = _this$props5.type,
|
|
|
placeholder = _this$props5.placeholder,
|
|
|
id = _this$props5.id,
|
|
|
inputMode = _this$props5.inputMode,
|
|
|
pattern = _this$props5.pattern,
|
|
|
step = _this$props5.step,
|
|
|
maxLength = _this$props5.maxLength,
|
|
|
autoFocus = _this$props5.autoFocus,
|
|
|
name = _this$props5.name,
|
|
|
onPaste = _this$props5.onPaste,
|
|
|
onInput = _this$props5.onInput,
|
|
|
rest = Object(objectWithoutProperties["a" /* default */])(_this$props5, ["prefixCls", "disabled", "readOnly", "useTouch", "autoComplete", "upHandler", "downHandler", "className", "max", "min", "style", "title", "onMouseEnter", "onMouseLeave", "onMouseOver", "onMouseOut", "required", "onClick", "tabIndex", "type", "placeholder", "id", "inputMode", "pattern", "step", "maxLength", "autoFocus", "name", "onPaste", "onInput"]);
|
|
|
|
|
|
var _this$state = this.state,
|
|
|
value = _this$state.value,
|
|
|
focused = _this$state.focused;
|
|
|
var classes = classnames_default()(prefixCls, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, className, !!className), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-disabled"), disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(prefixCls, "-focused"), focused), _classNames));
|
|
|
var dataOrAriaAttributeProps = {};
|
|
|
Object.keys(rest).forEach(function (key) {
|
|
|
if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') {
|
|
|
dataOrAriaAttributeProps[key] = rest[key];
|
|
|
}
|
|
|
});
|
|
|
var editable = !readOnly && !disabled; // focus state, show input value
|
|
|
// unfocus state, show valid value
|
|
|
|
|
|
var inputDisplayValue = this.getInputDisplayValue(null);
|
|
|
var upDisabled = (value || value === 0) && (isNaN(value) || Number(value) >= max);
|
|
|
var downDisabled = (value || value === 0) && (isNaN(value) || Number(value) <= min);
|
|
|
var isUpDisabled = upDisabled || disabled || readOnly;
|
|
|
var isDownDisabled = downDisabled || disabled || readOnly;
|
|
|
var upClassName = classnames_default()("".concat(prefixCls, "-handler"), "".concat(prefixCls, "-handler-up"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-handler-up-disabled"), isUpDisabled));
|
|
|
var downClassName = classnames_default()("".concat(prefixCls, "-handler"), "".concat(prefixCls, "-handler-down"), Object(defineProperty["a" /* default */])({}, "".concat(prefixCls, "-handler-down-disabled"), isDownDisabled));
|
|
|
var upEvents = useTouch ? {
|
|
|
onTouchStart: isUpDisabled ? noop : this.up,
|
|
|
onTouchEnd: this.stop
|
|
|
} : {
|
|
|
onMouseDown: isUpDisabled ? noop : this.up,
|
|
|
onMouseUp: this.stop,
|
|
|
onMouseLeave: this.stop
|
|
|
};
|
|
|
var downEvents = useTouch ? {
|
|
|
onTouchStart: isDownDisabled ? noop : this.down,
|
|
|
onTouchEnd: this.stop
|
|
|
} : {
|
|
|
onMouseDown: isDownDisabled ? noop : this.down,
|
|
|
onMouseUp: this.stop,
|
|
|
onMouseLeave: this.stop
|
|
|
};
|
|
|
return external_window_React_default.a.createElement("div", {
|
|
|
className: classes,
|
|
|
style: style,
|
|
|
title: title,
|
|
|
onMouseEnter: onMouseEnter,
|
|
|
onMouseLeave: onMouseLeave,
|
|
|
onMouseOver: onMouseOver,
|
|
|
onMouseOut: onMouseOut,
|
|
|
onFocus: function onFocus() {
|
|
|
return null;
|
|
|
},
|
|
|
onBlur: function onBlur() {
|
|
|
return null;
|
|
|
}
|
|
|
}, external_window_React_default.a.createElement("div", {
|
|
|
className: "".concat(prefixCls, "-handler-wrap")
|
|
|
}, external_window_React_default.a.createElement("span", Object.assign({
|
|
|
unselectable: "on"
|
|
|
}, upEvents, {
|
|
|
role: "button",
|
|
|
"aria-label": "Increase Value",
|
|
|
"aria-disabled": isUpDisabled,
|
|
|
className: upClassName
|
|
|
}), upHandler || external_window_React_default.a.createElement("span", {
|
|
|
unselectable: "on",
|
|
|
className: "".concat(prefixCls, "-handler-up-inner"),
|
|
|
onClick: preventDefault
|
|
|
})), external_window_React_default.a.createElement("span", Object.assign({
|
|
|
unselectable: "on"
|
|
|
}, downEvents, {
|
|
|
role: "button",
|
|
|
"aria-label": "Decrease Value",
|
|
|
"aria-disabled": isDownDisabled,
|
|
|
className: downClassName
|
|
|
}), downHandler || external_window_React_default.a.createElement("span", {
|
|
|
unselectable: "on",
|
|
|
className: "".concat(prefixCls, "-handler-down-inner"),
|
|
|
onClick: preventDefault
|
|
|
}))), external_window_React_default.a.createElement("div", {
|
|
|
className: "".concat(prefixCls, "-input-wrap")
|
|
|
}, external_window_React_default.a.createElement("input", Object.assign({
|
|
|
role: "spinbutton",
|
|
|
"aria-valuemin": min,
|
|
|
"aria-valuemax": max,
|
|
|
"aria-valuenow": value,
|
|
|
required: required,
|
|
|
type: type,
|
|
|
placeholder: placeholder,
|
|
|
onPaste: onPaste,
|
|
|
onClick: onClick,
|
|
|
onMouseUp: this.onMouseUp,
|
|
|
className: "".concat(prefixCls, "-input"),
|
|
|
tabIndex: tabIndex,
|
|
|
autoComplete: autoComplete,
|
|
|
onFocus: this.onFocus,
|
|
|
onBlur: this.onBlur,
|
|
|
onKeyDown: editable ? this.onKeyDown : noop,
|
|
|
onKeyUp: editable ? this.onKeyUp : noop,
|
|
|
autoFocus: autoFocus,
|
|
|
maxLength: maxLength,
|
|
|
readOnly: readOnly,
|
|
|
disabled: disabled,
|
|
|
max: max,
|
|
|
min: min,
|
|
|
step: step,
|
|
|
name: name,
|
|
|
title: title,
|
|
|
id: id,
|
|
|
onChange: this.onChange,
|
|
|
ref: this.saveInput,
|
|
|
value: this.getFullNum(inputDisplayValue),
|
|
|
pattern: pattern,
|
|
|
inputMode: inputMode,
|
|
|
onInput: onInput
|
|
|
}, dataOrAriaAttributeProps))));
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
return InputNumber;
|
|
|
}(external_window_React_default.a.Component);
|
|
|
|
|
|
InputNumber_InputNumber.defaultProps = {
|
|
|
focusOnUpDown: true,
|
|
|
useTouch: false,
|
|
|
prefixCls: 'rc-input-number',
|
|
|
max: MAX_SAFE_INTEGER,
|
|
|
min: -MAX_SAFE_INTEGER,
|
|
|
step: 1,
|
|
|
style: {},
|
|
|
onChange: noop,
|
|
|
onKeyDown: noop,
|
|
|
onPressEnter: noop,
|
|
|
onFocus: noop,
|
|
|
onBlur: noop,
|
|
|
parser: defaultParser,
|
|
|
required: false,
|
|
|
autoComplete: 'off'
|
|
|
};
|
|
|
/* harmony default export */ var es_InputNumber = (InputNumber_InputNumber);
|
|
|
// CONCATENATED MODULE: ./node_modules/rc-input-number/es/index.js
|
|
|
|
|
|
/* harmony default export */ var es = __webpack_exports__["a"] = (es_InputNumber);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "e+RI":
|
|
|
/*!************************************************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/AddTags/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 = {"btn":"btn___35XHi","s1":"s1___yzdGB","s2":"s2___3kxXm","btnDisabled":"btnDisabled___lI9pA","btn2":"btn2___2KLJQ"};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "eS0+":
|
|
|
/*!************************************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/List/index.tsx ***!
|
|
|
\************************************************************************************/
|
|
|
/*! exports provided: ListGroup, default */
|
|
|
/*! exports used: default */
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
"use strict";
|
|
|
/* unused harmony export ListGroup */
|
|
|
/* harmony import */ var antd_es_input_number_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/input-number/style */ "giR+");
|
|
|
/* harmony import */ var antd_es_input_number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/input-number */ "fyUT");
|
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */ "tJVT");
|
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties */ "PpiC");
|
|
|
/* harmony import */ var antd_es_select_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/select/style */ "OaEy");
|
|
|
/* harmony import */ var antd_es_select__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd/es/select */ "2fM7");
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ "cDcd");
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./index.less?modules */ "2sxD");
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_index_less_modules__WEBPACK_IMPORTED_MODULE_7__);
|
|
|
/* harmony import */ var _assets_images_paper_sc_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/assets/images/paper/sc.svg */ "51dB");
|
|
|
/* harmony import */ var _assets_images_paper_sc_svg__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_assets_images_paper_sc_svg__WEBPACK_IMPORTED_MODULE_8__);
|
|
|
/* harmony import */ var _assets_images_paper_sm_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/assets/images/paper/sm.svg */ "5MlY");
|
|
|
/* harmony import */ var _assets_images_paper_sm_svg__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_assets_images_paper_sm_svg__WEBPACK_IMPORTED_MODULE_9__);
|
|
|
/* harmony import */ var _assets_images_paper_up_svg__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/assets/images/paper/up.svg */ "lnNo");
|
|
|
/* harmony import */ var _assets_images_paper_up_svg__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_assets_images_paper_up_svg__WEBPACK_IMPORTED_MODULE_10__);
|
|
|
/* harmony import */ var _assets_images_paper_xiren_svg__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/assets/images/paper/xiren.svg */ "YBdh");
|
|
|
/* harmony import */ var _assets_images_paper_xiren_svg__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_assets_images_paper_xiren_svg__WEBPACK_IMPORTED_MODULE_11__);
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! lodash */ "LvDl");
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_12__);
|
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! classnames */ "TSYQ");
|
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_13__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = antd_es_select__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Option;
|
|
|
|
|
|
var parser = function parser(v) {
|
|
|
var num = parseInt(v);
|
|
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_12__["isNaN"])(num) ? 0 : num;
|
|
|
};
|
|
|
|
|
|
var ListGroup = function ListGroup(_ref) {
|
|
|
var _value$difficulties, _value$difficulties2;
|
|
|
|
|
|
var index = _ref.index,
|
|
|
_ref$value = _ref.value,
|
|
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
|
onChange = _ref.onChange,
|
|
|
type = _ref.type,
|
|
|
_ref$disabled = _ref.disabled,
|
|
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
|
_ref$expansion = _ref.expansion,
|
|
|
expansion = _ref$expansion === void 0 ? true : _ref$expansion,
|
|
|
props = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_ref, ["index", "value", "onChange", "type", "disabled", "expansion"]);
|
|
|
|
|
|
var _useState = Object(react__WEBPACK_IMPORTED_MODULE_6__["useState"])(true),
|
|
|
_useState2 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_useState, 2),
|
|
|
visible = _useState2[0],
|
|
|
setVisible = _useState2[1];
|
|
|
|
|
|
var handleChange = function handleChange(e, i) {
|
|
|
var newValue = Object(lodash__WEBPACK_IMPORTED_MODULE_12__["cloneDeep"])(value);
|
|
|
newValue.difficulties[i].num = e;
|
|
|
console.log(newValue, 444);
|
|
|
onChange(newValue);
|
|
|
};
|
|
|
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.ListGroup,
|
|
|
style: {
|
|
|
borderWidth: index ? 1 : 0
|
|
|
}
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.a
|
|
|
}, index + 1), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
"data-type": "width",
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.b
|
|
|
}, value === null || value === void 0 ? void 0 : value.name), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.c
|
|
|
}, value === null || value === void 0 ? void 0 : (_value$difficulties = value.difficulties) === null || _value$difficulties === void 0 ? void 0 : _value$difficulties.map(function (e, i) {
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
key: i,
|
|
|
style: {
|
|
|
display: visible ? 'flex' : i ? 'none' : 'flex'
|
|
|
},
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.c1
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
style: {
|
|
|
color: '#777777',
|
|
|
marginRight: 5
|
|
|
}
|
|
|
}, "\u96BE\u5EA6"), e.difficulty === 1 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.radio
|
|
|
}, "\u7B80\u5355"), e.difficulty === 2 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.radio
|
|
|
}, "\u9002\u4E2D"), e.difficulty === 3 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.radio
|
|
|
}, "\u56F0\u96BE"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
style: {
|
|
|
color: '#777777',
|
|
|
marginRight: 5,
|
|
|
marginLeft: 50
|
|
|
}
|
|
|
}, "\u62BD\u9898\u6570\u91CF"), index === 0 && i === 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
id: "".concat(type, "_sum")
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(antd_es_input_number__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
|
|
|
disabled: disabled,
|
|
|
parser: parser,
|
|
|
onChange: function onChange(e) {
|
|
|
return handleChange(e, i);
|
|
|
},
|
|
|
min: 0,
|
|
|
max: e === null || e === void 0 ? void 0 : e.count,
|
|
|
value: (e === null || e === void 0 ? void 0 : e.num) || 0,
|
|
|
style: {
|
|
|
width: 66
|
|
|
}
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
style: {
|
|
|
display: 'none'
|
|
|
}
|
|
|
}, "\u8BF7\u8F93\u5165\u6570\u91CF")) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(antd_es_input_number__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
|
|
|
disabled: disabled,
|
|
|
parser: parser,
|
|
|
onChange: function onChange(e) {
|
|
|
return handleChange(e, i);
|
|
|
},
|
|
|
min: 0,
|
|
|
max: e === null || e === void 0 ? void 0 : e.count,
|
|
|
value: (e === null || e === void 0 ? void 0 : e.num) || 0,
|
|
|
style: {
|
|
|
width: 66
|
|
|
}
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
style: {
|
|
|
marginLeft: 5
|
|
|
}
|
|
|
}, "/", e === null || e === void 0 ? void 0 : e.count));
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
style: {
|
|
|
display: (value === null || value === void 0 ? void 0 : (_value$difficulties2 = value.difficulties) === null || _value$difficulties2 === void 0 ? void 0 : _value$difficulties2.length) === 1 || !expansion ? 'none' : 'block'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return setVisible(!visible);
|
|
|
},
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.d
|
|
|
}, visible ? '收起' : '展开', /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("img", {
|
|
|
style: {
|
|
|
marginTop: -2,
|
|
|
transform: visible ? 'rotate(0deg)' : 'rotate(180deg)'
|
|
|
},
|
|
|
src: _assets_images_paper_up_svg__WEBPACK_IMPORTED_MODULE_10___default.a,
|
|
|
className: "ml5"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
var List = function List(_ref2) {
|
|
|
var _questionData$find, _value$item_banks;
|
|
|
|
|
|
var _ref2$value = _ref2.value,
|
|
|
value = _ref2$value === void 0 ? [] : _ref2$value,
|
|
|
onChange = _ref2.onChange,
|
|
|
listClassName = _ref2.listClassName,
|
|
|
_ref2$disabled = _ref2.disabled,
|
|
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
|
_ref2$expansion = _ref2.expansion,
|
|
|
expansion = _ref2$expansion === void 0 ? true : _ref2$expansion,
|
|
|
props = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_ref2, ["value", "onChange", "listClassName", "disabled", "expansion"]);
|
|
|
|
|
|
var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_6__["useState"])(true),
|
|
|
_useState4 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_useState3, 2),
|
|
|
visible = _useState4[0],
|
|
|
setVisible = _useState4[1];
|
|
|
|
|
|
var calculate = function calculate(v) {
|
|
|
var _v$item_banks;
|
|
|
|
|
|
var n = v.score || 0;
|
|
|
var item = [];
|
|
|
v === null || v === void 0 ? void 0 : (_v$item_banks = v.item_banks) === null || _v$item_banks === void 0 ? void 0 : _v$item_banks.forEach(function (e) {
|
|
|
var _e$tag_disciplines;
|
|
|
|
|
|
e === null || e === void 0 ? void 0 : (_e$tag_disciplines = e.tag_disciplines) === null || _e$tag_disciplines === void 0 ? void 0 : _e$tag_disciplines.forEach(function (r) {
|
|
|
var _r$difficulties;
|
|
|
|
|
|
r === null || r === void 0 ? void 0 : (_r$difficulties = r.difficulties) === null || _r$difficulties === void 0 ? void 0 : _r$difficulties.forEach(function (s) {
|
|
|
if (s.num) {
|
|
|
item.push(s.num);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
var sum = item.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0);
|
|
|
return sum * n;
|
|
|
};
|
|
|
|
|
|
var questionData = [{
|
|
|
type: 'SINGLE',
|
|
|
name: '单选题'
|
|
|
}, {
|
|
|
type: 'MULTIPLE',
|
|
|
name: '多选题'
|
|
|
}, {
|
|
|
type: 'COMPLETION',
|
|
|
name: '填空题'
|
|
|
}, {
|
|
|
type: 'JUDGMENT',
|
|
|
name: '判断题'
|
|
|
}, {
|
|
|
type: 'SUBJECTIVE',
|
|
|
name: '简答题'
|
|
|
}, {
|
|
|
type: 'PROGRAM',
|
|
|
name: '编程题'
|
|
|
}, {
|
|
|
type: 'PRACTICAL',
|
|
|
name: '实训题'
|
|
|
}, {
|
|
|
type: 'COMBINATION',
|
|
|
name: '组合题'
|
|
|
}];
|
|
|
|
|
|
var handleChange = function handleChange(e, index, i) {
|
|
|
var newValue = Object(lodash__WEBPACK_IMPORTED_MODULE_12__["cloneDeep"])(value);
|
|
|
newValue.item_banks[index].tag_disciplines[i] = e;
|
|
|
var total = calculate(newValue);
|
|
|
newValue.scoreTotal = total;
|
|
|
console.log(newValue, 'newValue');
|
|
|
onChange(newValue);
|
|
|
};
|
|
|
|
|
|
var handleInputChange = function handleInputChange(e) {
|
|
|
var newValue = Object(lodash__WEBPACK_IMPORTED_MODULE_12__["cloneDeep"])(value);
|
|
|
newValue.score = e;
|
|
|
var total = calculate(newValue);
|
|
|
newValue.scoreTotal = total;
|
|
|
onChange(newValue);
|
|
|
};
|
|
|
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: classnames__WEBPACK_IMPORTED_MODULE_13___default()(_index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.list, listClassName)
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.head
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.name
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("b", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", null, (_questionData$find = questionData.find(function (e) {
|
|
|
return e.type === (value === null || value === void 0 ? void 0 : value.item_type);
|
|
|
})) === null || _questionData$find === void 0 ? void 0 : _questionData$find.name)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.right
|
|
|
}, expansion && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
onClick: function onClick() {
|
|
|
return setVisible(!visible);
|
|
|
},
|
|
|
className: "current c-light-primary mb10"
|
|
|
}, visible ? '收起' : '展开', /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("img", {
|
|
|
style: {
|
|
|
marginTop: -2,
|
|
|
transform: visible ? 'rotate(0deg)' : 'rotate(180deg)'
|
|
|
},
|
|
|
src: _assets_images_paper_up_svg__WEBPACK_IMPORTED_MODULE_10___default.a,
|
|
|
className: "ml5"
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("img", {
|
|
|
src: _assets_images_paper_sc_svg__WEBPACK_IMPORTED_MODULE_8___default.a
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
className: "ml10 mr20"
|
|
|
}, "\u603B\u5206", value.scoreTotal, "\u5206"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("img", {
|
|
|
className: "mr10",
|
|
|
src: _assets_images_paper_sm_svg__WEBPACK_IMPORTED_MODULE_9___default.a
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", null, (value === null || value === void 0 ? void 0 : value.item_type) === 'COMBINATION' ? '每小题' : '每题'), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
id: "".concat(value === null || value === void 0 ? void 0 : value.item_type, "_score")
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(antd_es_input_number__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
|
|
|
disabled: disabled,
|
|
|
parser: parser,
|
|
|
min: 0,
|
|
|
onChange: handleInputChange,
|
|
|
value: value.score,
|
|
|
style: {
|
|
|
margin: '0 5px'
|
|
|
}
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", {
|
|
|
style: {
|
|
|
display: 'none'
|
|
|
}
|
|
|
}, "\u8BF7\u8F93\u5165\u6BCF\u9898\u5206\u6570")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", null, "\u5206")))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.body,
|
|
|
style: {
|
|
|
display: visible ? "block" : 'none'
|
|
|
}
|
|
|
}, value === null || value === void 0 ? void 0 : (_value$item_banks = value.item_banks) === null || _value$item_banks === void 0 ? void 0 : _value$item_banks.map(function (item, index) {
|
|
|
var _item$tag_disciplines;
|
|
|
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_6___default.a.Fragment, {
|
|
|
key: index
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.top
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("img", {
|
|
|
src: _assets_images_paper_xiren_svg__WEBPACK_IMPORTED_MODULE_11___default.a
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("span", null, "\u65B9\u5411/\u8BFE\u7A0B"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("b", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("aside", null, item === null || item === void 0 ? void 0 : item.disciplines, "/", item === null || item === void 0 ? void 0 : item.sub_discipline)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.bottom
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.l
|
|
|
}, "\u77E5\u8BC6\u70B9"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_7___default.a.r
|
|
|
}, item === null || item === void 0 ? void 0 : (_item$tag_disciplines = item.tag_disciplines) === null || _item$tag_disciplines === void 0 ? void 0 : _item$tag_disciplines.map(function (e, i) {
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(ListGroup, {
|
|
|
expansion: expansion,
|
|
|
disabled: disabled,
|
|
|
type: value === null || value === void 0 ? void 0 : value.item_type,
|
|
|
key: "".concat(index, "-").concat(i),
|
|
|
value: e,
|
|
|
index: i,
|
|
|
onChange: function onChange(e) {
|
|
|
return handleChange(e, index, i);
|
|
|
}
|
|
|
});
|
|
|
}))));
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["a"] = (List);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "k4n4":
|
|
|
/*!***************************************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/AddTags/index.tsx ***!
|
|
|
\***************************************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
"use strict";
|
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */ "tJVT");
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "cDcd");
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less?modules */ "e+RI");
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_index_less_modules__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _assets_images_icons_tagDelete_png__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/assets/images/icons/tagDelete.png */ "FTkQ");
|
|
|
/* harmony import */ var _assets_images_icons_tagDelete_png__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_assets_images_icons_tagDelete_png__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var _assets_images_paper_swenjianjia_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/assets/images/paper/swenjianjia.svg */ "E/GV");
|
|
|
/* harmony import */ var _assets_images_paper_swenjianjia_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_assets_images_paper_swenjianjia_svg__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddTags = function AddTags(_ref) {
|
|
|
var _ref$type = _ref.type,
|
|
|
type = _ref$type === void 0 ? 1 : _ref$type,
|
|
|
_ref$value = _ref.value,
|
|
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
|
onChange = _ref.onChange,
|
|
|
_ref$disabled = _ref.disabled,
|
|
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
|
icon = _ref.icon;
|
|
|
|
|
|
var _useState = Object(react__WEBPACK_IMPORTED_MODULE_1__["useState"])(),
|
|
|
_useState2 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_useState, 2),
|
|
|
inputValue = _useState2[0],
|
|
|
setInputValue = _useState2[1];
|
|
|
|
|
|
var handleDelete = function handleDelete(id) {
|
|
|
onChange(id);
|
|
|
};
|
|
|
|
|
|
if (type === 1) {
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", null, value === null || value === void 0 ? void 0 : value.map(function (item, index) {
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", {
|
|
|
key: index,
|
|
|
className: disabled ? "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.btn, " ").concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.btnDisabled) : _index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.btn
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("span", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.s1
|
|
|
}, item.name), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("img", {
|
|
|
src: _assets_images_icons_tagDelete_png__WEBPACK_IMPORTED_MODULE_3___default.a,
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.s2,
|
|
|
onClick: function onClick() {
|
|
|
return handleDelete(item.id);
|
|
|
}
|
|
|
}));
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", null, value === null || value === void 0 ? void 0 : value.map(function (item, index) {
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", {
|
|
|
key: index,
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.btn2
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("span", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.s1
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("img", {
|
|
|
src: icon || _assets_images_paper_swenjianjia_svg__WEBPACK_IMPORTED_MODULE_4___default.a
|
|
|
}), item.name), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("img", {
|
|
|
src: _assets_images_icons_tagDelete_png__WEBPACK_IMPORTED_MODULE_3___default.a,
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2___default.a.s2,
|
|
|
onClick: function onClick() {
|
|
|
return handleDelete(item.id);
|
|
|
}
|
|
|
}));
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["a"] = (AddTags);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "lnNo":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/assets/images/paper/up.svg ***!
|
|
|
\****************************************/
|
|
|
/*! 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/up.69f3b3fd.svg";
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ "zytX":
|
|
|
/*!**************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/ExerciseEdit/index.tsx ***!
|
|
|
\**************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! all exports used */
|
|
|
/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/.umi-production/core/routes.ts (referenced with import()) */
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
"use strict";
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
/* harmony import */ var antd_es_skeleton_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/skeleton/style */ "cWXX");
|
|
|
/* harmony import */ var antd_es_skeleton__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/skeleton */ "/ezw");
|
|
|
/* 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 antd_es_radio_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/radio/style */ "7Kak");
|
|
|
/* harmony import */ var antd_es_radio__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd/es/radio */ "9yH6");
|
|
|
/* harmony import */ var antd_es_message_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd/es/message/style */ "miYZ");
|
|
|
/* harmony import */ var antd_es_message__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd/es/message */ "tsqr");
|
|
|
/* harmony import */ var antd_es_input_number_style__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd/es/input-number/style */ "giR+");
|
|
|
/* harmony import */ var antd_es_input_number__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd/es/input-number */ "fyUT");
|
|
|
/* harmony import */ var antd_es_modal_style__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd/es/modal/style */ "2qtc");
|
|
|
/* harmony import */ var antd_es_modal__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd/es/modal */ "kLXV");
|
|
|
/* 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_12__ = __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_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/toConsumableArray */ "oBTY");
|
|
|
/* 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_14__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */ "k1fw");
|
|
|
/* harmony import */ var antd_es_form_style__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd/es/form/style */ "y8nQ");
|
|
|
/* harmony import */ var antd_es_form__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd/es/form */ "Vl3Y");
|
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */ "tJVT");
|
|
|
/* harmony import */ var antd_es_input_style__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd/es/input/style */ "5NDa");
|
|
|
/* harmony import */ var antd_es_input__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd/es/input */ "5rEg");
|
|
|
/* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20__ = __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_20___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_20__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! react */ "cDcd");
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_21__);
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! umi */ "Ty5D");
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! umi */ "9kvl");
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./index.less?modules */ "/Uag");
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_index_less_modules__WEBPACK_IMPORTED_MODULE_24__);
|
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! @/utils/fetch */ "ErOA");
|
|
|
/* harmony import */ var _pages_Paperlibrary_Random_AddAndEdit_components_StepTwo_List__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/List */ "eS0+");
|
|
|
/* harmony import */ var _pages_Paperlibrary_Random_AddAndEdit_components_StepTwo_AddTags__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! @/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/AddTags */ "k4n4");
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! lodash */ "LvDl");
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_28__);
|
|
|
/* harmony import */ var _service_exercise__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! @/service/exercise */ "V0Rq");
|
|
|
/* harmony import */ var _assets_images_paper_dui_svg__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! @/assets/images/paper/dui.svg */ "5jaM");
|
|
|
/* harmony import */ var _assets_images_paper_dui_svg__WEBPACK_IMPORTED_MODULE_30___default = /*#__PURE__*/__webpack_require__.n(_assets_images_paper_dui_svg__WEBPACK_IMPORTED_MODULE_30__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = antd_es_input__WEBPACK_IMPORTED_MODULE_19__[/* default */ "a"].TextArea;
|
|
|
|
|
|
var PaperlibraryPage = function PaperlibraryPage(_ref) {
|
|
|
var _editData$exercise, _userInfo$course;
|
|
|
|
|
|
var paperlibrary = _ref.paperlibrary,
|
|
|
user = _ref.user,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
dispatch = _ref.dispatch;
|
|
|
|
|
|
var _Form$useForm = antd_es_form__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"].useForm(),
|
|
|
_Form$useForm2 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"])(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
|
|
|
var _useState = Object(react__WEBPACK_IMPORTED_MODULE_21__["useState"])({}),
|
|
|
_useState2 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"])(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
|
|
|
var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_21__["useState"])(true),
|
|
|
_useState4 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"])(_useState3, 2),
|
|
|
loading = _useState4[0],
|
|
|
setLoading = _useState4[1];
|
|
|
|
|
|
var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_21__["useState"])(false),
|
|
|
_useState6 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"])(_useState5, 2),
|
|
|
btnLoading = _useState6[0],
|
|
|
setBtnLoading = _useState6[1];
|
|
|
|
|
|
var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_21__["useState"])(false),
|
|
|
_useState8 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"])(_useState7, 2),
|
|
|
saveLoading = _useState8[0],
|
|
|
setSaveBtnLoading = _useState8[1];
|
|
|
|
|
|
var _useState9 = Object(react__WEBPACK_IMPORTED_MODULE_21__["useState"])({}),
|
|
|
_useState10 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"])(_useState9, 2),
|
|
|
editData = _useState10[0],
|
|
|
setEditData = _useState10[1];
|
|
|
|
|
|
var _useState11 = Object(react__WEBPACK_IMPORTED_MODULE_21__["useState"])([]),
|
|
|
_useState12 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"])(_useState11, 2),
|
|
|
listData = _useState12[0],
|
|
|
setListData = _useState12[1];
|
|
|
|
|
|
var params = Object(umi__WEBPACK_IMPORTED_MODULE_22__[/* useParams */ "i"])();
|
|
|
var saveCompareData = Object(react__WEBPACK_IMPORTED_MODULE_21__["useRef"])({
|
|
|
contents: {},
|
|
|
score_settings: {}
|
|
|
});
|
|
|
var userInfo = user.userInfo;
|
|
|
Object(react__WEBPACK_IMPORTED_MODULE_21__["useEffect"])(function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
return function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
payload: true
|
|
|
});
|
|
|
};
|
|
|
}, []);
|
|
|
Object(react__WEBPACK_IMPORTED_MODULE_21__["useEffect"])(function () {
|
|
|
getEditData();
|
|
|
}, []);
|
|
|
|
|
|
var handleValuesChange = function handleValuesChange(changedValues) {
|
|
|
setFormValue(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"])({}, form.getFieldsValue()));
|
|
|
};
|
|
|
|
|
|
var dealList = function dealList(str, data) {
|
|
|
var subDisciplinesList = data || [];
|
|
|
|
|
|
var list = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_13__[/* default */ "a"])(subDisciplinesList),
|
|
|
flag = 0,
|
|
|
data = [];
|
|
|
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var az = '';
|
|
|
|
|
|
for (var j = 0; j < data.length; j++) {
|
|
|
if (data[j][0][str] == list[i][str]) {
|
|
|
flag = 1;
|
|
|
az = j;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (flag == 1) {
|
|
|
data[az].push(list[i]);
|
|
|
flag = 0;
|
|
|
} else if (flag == 0) {
|
|
|
var wdy = new Array();
|
|
|
wdy.push(list[i]);
|
|
|
data.push(wdy);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return data;
|
|
|
};
|
|
|
|
|
|
var calcListData = function calcListData(param) {
|
|
|
var _items2;
|
|
|
|
|
|
var score_settings = param.score_settings,
|
|
|
contents = param.contents; //生成比较数据
|
|
|
|
|
|
score_settings.forEach(function (e) {
|
|
|
saveCompareData.current.score_settings[e.item_type] = e.score;
|
|
|
});
|
|
|
contents.forEach(function (e) {
|
|
|
var name = "".concat(e.item_type, "_").concat(e.sub_discipline_id, "_").concat(e.tag_discipline_id, "_").concat(e.difficulty);
|
|
|
saveCompareData.current.contents[name] = e.quanlity;
|
|
|
}); //生成一级结构
|
|
|
|
|
|
var items = score_settings === null || score_settings === void 0 ? void 0 : score_settings.map(function (e) {
|
|
|
return Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, e), {}, {
|
|
|
item_banks: [],
|
|
|
questionTotal: 0,
|
|
|
scoreTotal: 0
|
|
|
});
|
|
|
}); //相同类型组合
|
|
|
|
|
|
contents === null || contents === void 0 ? void 0 : contents.forEach(function (e) {
|
|
|
var _items, _items$index, _items$index$item_ban;
|
|
|
|
|
|
var index = items.findIndex(function (k) {
|
|
|
return e.item_type === k.item_type;
|
|
|
});
|
|
|
|
|
|
var r = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, e), {}, {
|
|
|
disciplines: e.discipline_name,
|
|
|
sub_discipline: e.sub_discipline_name
|
|
|
});
|
|
|
|
|
|
delete r.discipline_name;
|
|
|
delete r.sub_discipline_name;
|
|
|
(_items = items) === null || _items === void 0 ? void 0 : (_items$index = _items[index]) === null || _items$index === void 0 ? void 0 : (_items$index$item_ban = _items$index.item_banks) === null || _items$index$item_ban === void 0 ? void 0 : _items$index$item_ban.push(r);
|
|
|
}); //相同sub_discipline_id组合二维数组
|
|
|
|
|
|
items = items.map(function (e) {
|
|
|
return Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, e), {}, {
|
|
|
item_banks: dealList('sub_discipline_id', e.item_banks)
|
|
|
});
|
|
|
}); //生成tag_disciplines数组
|
|
|
|
|
|
items = items.map(function (e) {
|
|
|
var _e$item_banks;
|
|
|
|
|
|
return Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, e), {}, {
|
|
|
item_banks: (_e$item_banks = e.item_banks) === null || _e$item_banks === void 0 ? void 0 : _e$item_banks.map(function (k) {
|
|
|
var r = {
|
|
|
tag_disciplines: []
|
|
|
};
|
|
|
k === null || k === void 0 ? void 0 : k.forEach(function (s) {
|
|
|
r.disciplines = s.disciplines;
|
|
|
delete s.disciplines;
|
|
|
r.sub_discipline = s.sub_discipline;
|
|
|
delete s.sub_discipline;
|
|
|
r.sub_discipline_id = s.sub_discipline_id;
|
|
|
delete s.sub_discipline_id;
|
|
|
delete s.item_type;
|
|
|
r.tag_disciplines.push(s);
|
|
|
});
|
|
|
r.tag_disciplines = dealList('tag_discipline_id', r.tag_disciplines);
|
|
|
var elseR = r.tag_disciplines.map(function (h) {
|
|
|
var g = {
|
|
|
difficulties: []
|
|
|
};
|
|
|
h === null || h === void 0 ? void 0 : h.forEach(function (q) {
|
|
|
g.name = q.tag_discipline_name;
|
|
|
g.tag_discipline_id = q.tag_discipline_id;
|
|
|
delete q.tag_discipline_name;
|
|
|
delete q.tag_discipline_id;
|
|
|
g.difficulties.push(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, q), {}, {
|
|
|
num: q.quanlity,
|
|
|
count: Object(lodash__WEBPACK_IMPORTED_MODULE_28__["isNil"])(q === null || q === void 0 ? void 0 : q.count) ? q.quanlity : q.count
|
|
|
}));
|
|
|
});
|
|
|
return g;
|
|
|
});
|
|
|
r.tag_disciplines = elseR;
|
|
|
return r;
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
var record = calculate(items);
|
|
|
var panel = record.panel,
|
|
|
score_num_item = record.score_num_item;
|
|
|
items = (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2.map(function (e, i) {
|
|
|
var _panel$i;
|
|
|
|
|
|
var questionTotal = (panel === null || panel === void 0 ? void 0 : (_panel$i = panel[i]) === null || _panel$i === void 0 ? void 0 : _panel$i.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0)) || 0;
|
|
|
return Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, e), {}, {
|
|
|
scoreTotal: questionTotal * (score_num_item[i] || 0),
|
|
|
questionTotal: questionTotal
|
|
|
});
|
|
|
});
|
|
|
setListData(Object(lodash__WEBPACK_IMPORTED_MODULE_28__["cloneDeep"])(items));
|
|
|
};
|
|
|
|
|
|
var getEditData = /*#__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_12__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.mark(function _callee() {
|
|
|
var res, _res$exercise, _res$exercise2, _res$exercise3, _res$exercise4, _res$exercise5, param;
|
|
|
|
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.wrap(function _callee$(_context) {
|
|
|
while (1) {
|
|
|
switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return Object(_utils_fetch__WEBPACK_IMPORTED_MODULE_25__[/* default */ "a"])("/api/exercises/".concat(params.categoryId, "/edit.json"), {
|
|
|
method: 'get',
|
|
|
params: Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"])({}, params)
|
|
|
});
|
|
|
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
|
|
|
if (res !== null && res !== void 0 && res.exercise) {
|
|
|
param = {
|
|
|
difficulty: res === null || res === void 0 ? void 0 : (_res$exercise = res.exercise) === null || _res$exercise === void 0 ? void 0 : _res$exercise.difficulty,
|
|
|
exam_notes: res === null || res === void 0 ? void 0 : (_res$exercise2 = res.exercise) === null || _res$exercise2 === void 0 ? void 0 : _res$exercise2.exercise_description,
|
|
|
name: res === null || res === void 0 ? void 0 : (_res$exercise3 = res.exercise) === null || _res$exercise3 === void 0 ? void 0 : _res$exercise3.exercise_name,
|
|
|
time: res === null || res === void 0 ? void 0 : (_res$exercise4 = res.exercise) === null || _res$exercise4 === void 0 ? void 0 : _res$exercise4.time,
|
|
|
num: (res === null || res === void 0 ? void 0 : (_res$exercise5 = res.exercise) === null || _res$exercise5 === void 0 ? void 0 : _res$exercise5.total_num) || 0
|
|
|
};
|
|
|
setLoading(false);
|
|
|
setFormValue(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"])({}, param));
|
|
|
form.setFieldsValue(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"])({}, param));
|
|
|
setEditData(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"])({}, res));
|
|
|
calcListData(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"])({}, res)); // const data = `[{"item_type":"SINGLE","item_banks":[{"disciplines":"系统/运维","sub_discipline":"shell编程","discipline_id":17,"sub_discipline_id":73,"tag_disciplines":[{"tag_discipline_id":774,"name":"2","difficulties":[{"difficulty":1,"count":2,"num":2}]},{"name":"未匹配知识点","tag_discipline_id":656,"difficulties":[{"difficulty":1,"count":4,"num":2},{"difficulty":2,"count":2}]}]},{"disciplines":"系统/运维","sub_discipline":"Linux ","discipline_id":17,"sub_discipline_id":74,"tag_disciplines":[{"tag_discipline_id":657,"name":"未匹配知识点","difficulties":[{"difficulty":1,"count":1,"num":1},{"difficulty":2,"count":1,"num":1}]},{"name":"如果信念有颜色,那一定是中国红","tag_discipline_id":825,"difficulties":[{"difficulty":1,"count":1,"num":1}]}]},{"disciplines":"系统/运维","sub_discipline":"自动化运维","discipline_id":17,"sub_discipline_id":75,"tag_disciplines":[{"tag_discipline_id":727,"name":"自动化运维-公开知识点","difficulties":[{"difficulty":1,"count":1,"num":1},{"difficulty":3,"count":1,"num":1}]}]}],"scoreTotal":18,"score":2,"questionTotal":9},{"item_type":"MULTIPLE","item_banks":[{"disciplines":"系统/运维","sub_discipline":"shell编程","discipline_id":17,"sub_discipline_id":73,"tag_disciplines":[{"tag_discipline_id":656,"name":"未匹配知识点","difficulties":[{"difficulty":1,"count":2,"num":2}]}]}],"scoreTotal":4,"score":2,"questionTotal":2},{"item_type":"JUDGMENT","item_banks":[{"disciplines":"系统/运维","sub_discipline":"自动化运维","discipline_id":17,"sub_discipline_id":75,"tag_disciplines":[{"tag_discipline_id":727,"name":"自动化运维-公开知识点","difficulties":[{"difficulty":1,"count":1,"num":1}]}]},{"disciplines":"系统/运维","sub_discipline":"shell编程","discipline_id":17,"sub_discipline_id":73,"tag_disciplines":[{"tag_discipline_id":656,"name":"未匹配知识点","difficulties":[{"difficulty":1,"count":4},{"difficulty":2,"count":3}]}]}],"scoreTotal":1,"score":1,"questionTotal":1}]`
|
|
|
// setListData(JSON.parse(data))
|
|
|
// console.log(JSON.parse(data))
|
|
|
}
|
|
|
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
|
|
|
return function getEditData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
|
|
|
var questionData = [{
|
|
|
type: 'SINGLE',
|
|
|
name: '单选题'
|
|
|
}, {
|
|
|
type: 'MULTIPLE',
|
|
|
name: '多选题'
|
|
|
}, {
|
|
|
type: 'COMPLETION',
|
|
|
name: '填空题'
|
|
|
}, {
|
|
|
type: 'JUDGMENT',
|
|
|
name: '判断题'
|
|
|
}, {
|
|
|
type: 'SUBJECTIVE',
|
|
|
name: '简答题'
|
|
|
}, {
|
|
|
type: 'PROGRAM',
|
|
|
name: '编程题'
|
|
|
}, {
|
|
|
type: 'PRACTICAL',
|
|
|
name: '实训题'
|
|
|
}, {
|
|
|
type: 'COMBINATION',
|
|
|
name: '组合题'
|
|
|
}];
|
|
|
|
|
|
var calculate = function calculate(list) {
|
|
|
var item = {
|
|
|
contents: [],
|
|
|
panel: [],
|
|
|
score_num_item: [],
|
|
|
//每题多少分集合
|
|
|
score_total: [],
|
|
|
error_tips: []
|
|
|
};
|
|
|
list === null || list === void 0 ? void 0 : list.forEach(function (k, index) {
|
|
|
var _item$error_tips, _questionData$find, _k$item_banks;
|
|
|
|
|
|
item.panel.push([]);
|
|
|
item.score_num_item.push(k === null || k === void 0 ? void 0 : k.score);
|
|
|
item.score_total.push(k === null || k === void 0 ? void 0 : k.scoreTotal);
|
|
|
(_item$error_tips = item.error_tips) === null || _item$error_tips === void 0 ? void 0 : _item$error_tips.push({
|
|
|
name: (_questionData$find = questionData.find(function (l) {
|
|
|
return l.type === (k === null || k === void 0 ? void 0 : k.item_type);
|
|
|
})) === null || _questionData$find === void 0 ? void 0 : _questionData$find.name,
|
|
|
score: (k === null || k === void 0 ? void 0 : k.score) || 0,
|
|
|
scoreTotal: k === null || k === void 0 ? void 0 : k.scoreTotal,
|
|
|
item_type: k === null || k === void 0 ? void 0 : k.item_type
|
|
|
});
|
|
|
k === null || k === void 0 ? void 0 : (_k$item_banks = k.item_banks) === null || _k$item_banks === void 0 ? void 0 : _k$item_banks.forEach(function (e) {
|
|
|
var _e$tag_disciplines;
|
|
|
|
|
|
e === null || e === void 0 ? void 0 : (_e$tag_disciplines = e.tag_disciplines) === null || _e$tag_disciplines === void 0 ? void 0 : _e$tag_disciplines.forEach(function (r) {
|
|
|
var _r$difficulties;
|
|
|
|
|
|
r === null || r === void 0 ? void 0 : (_r$difficulties = r.difficulties) === null || _r$difficulties === void 0 ? void 0 : _r$difficulties.forEach(function (s) {
|
|
|
if (s.num) {
|
|
|
item.panel[index].push(s.num);
|
|
|
item.contents.push({
|
|
|
difficulty: s.difficulty,
|
|
|
item_type: k.item_type,
|
|
|
items_count: s.num,
|
|
|
sub_discipline_id: e.sub_discipline_id,
|
|
|
tag_discipline_id: r.tag_discipline_id
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
return item;
|
|
|
};
|
|
|
|
|
|
var toAnswer = /*#__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_12__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.mark(function _callee2() {
|
|
|
var _res$exercise6;
|
|
|
|
|
|
var res, _user$userInfo;
|
|
|
|
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.wrap(function _callee2$(_context2) {
|
|
|
while (1) {
|
|
|
switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
setBtnLoading(true);
|
|
|
_context2.next = 3;
|
|
|
return Object(_service_exercise__WEBPACK_IMPORTED_MODULE_29__[/* startSimulateAnswer */ "X"])(Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, params), {}, {
|
|
|
is_reset: 1
|
|
|
}));
|
|
|
|
|
|
case 3:
|
|
|
res = _context2.sent;
|
|
|
|
|
|
if (res !== null && res !== void 0 && (_res$exercise6 = res.exercise) !== null && _res$exercise6 !== void 0 && _res$exercise6.id) {
|
|
|
umi__WEBPACK_IMPORTED_MODULE_23__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/").concat((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login, "/initate_answer"));
|
|
|
}
|
|
|
|
|
|
setBtnLoading(false);
|
|
|
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
|
|
|
return function toAnswer() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
|
|
|
var handleChange = function handleChange(e, i) {
|
|
|
var _param$panel, _param$panel$;
|
|
|
|
|
|
var newValue = Object(lodash__WEBPACK_IMPORTED_MODULE_28__["cloneDeep"])(listData);
|
|
|
newValue[i] = e;
|
|
|
var param = calculate([newValue[i]]);
|
|
|
var sum = param === null || param === void 0 ? void 0 : (_param$panel = param.panel) === null || _param$panel === void 0 ? void 0 : (_param$panel$ = _param$panel[0]) === null || _param$panel$ === void 0 ? void 0 : _param$panel$.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0);
|
|
|
newValue[i].questionTotal = sum;
|
|
|
setListData(newValue);
|
|
|
var dom = document.getElementsByClassName('customError');
|
|
|
dom === null || dom === void 0 ? void 0 : dom.forEach(function (e) {
|
|
|
var _e$classList;
|
|
|
|
|
|
e === null || e === void 0 ? void 0 : (_e$classList = e.classList) === null || _e$classList === void 0 ? void 0 : _e$classList.remove("customError");
|
|
|
});
|
|
|
};
|
|
|
|
|
|
var parser = function parser(v) {
|
|
|
var num = parseInt(v);
|
|
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_28__["isNaN"])(num) ? '' : num;
|
|
|
};
|
|
|
|
|
|
var renderTotal = function renderTotal() {
|
|
|
var param = calculate(listData);
|
|
|
var score_total = param.score_total;
|
|
|
score_total = score_total.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0);
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.total
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("b", null), " ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", null, "\u672C\u8BD5\u5377\u603B\u5206", score_total, "\u5206"));
|
|
|
};
|
|
|
|
|
|
var handleOk = /*#__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_12__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.mark(function _callee4() {
|
|
|
var name, modal;
|
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.wrap(function _callee4$(_context4) {
|
|
|
while (1) {
|
|
|
switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
name = 1;
|
|
|
modal = antd_es_modal__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].confirm({
|
|
|
icon: null,
|
|
|
className: 'custom-modal-divider',
|
|
|
centered: true,
|
|
|
width: 500,
|
|
|
maskClosable: false,
|
|
|
keyboard: false,
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
},
|
|
|
title: '配置出卷数量',
|
|
|
content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.modalColumn
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.modalRow
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("sup", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.sup
|
|
|
}, "*"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", {
|
|
|
style: {
|
|
|
flexShrink: 0
|
|
|
}
|
|
|
}, "\u968F\u673A\u51FA\u5377\u6570\u91CF\uFF1A"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_input_number__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"], {
|
|
|
parser: parser,
|
|
|
style: {
|
|
|
width: 120
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BD5\u5377\u6570\u91CF",
|
|
|
min: 1,
|
|
|
defaultValue: name,
|
|
|
onChange: function onChange(e) {
|
|
|
name = e;
|
|
|
var dom = document.getElementById('model_error');
|
|
|
|
|
|
if (name < 1 || name > 50) {
|
|
|
dom.style.display = 'block';
|
|
|
} else {
|
|
|
dom.style.display = 'none';
|
|
|
}
|
|
|
}
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
style: {
|
|
|
display: 'none',
|
|
|
marginLeft: 78
|
|
|
},
|
|
|
id: "model_error",
|
|
|
className: "c-red"
|
|
|
}, "\u8BF7\u8F93\u51651-50\u4E4B\u95F4\u7684\u6574\u6570")),
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_12__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.mark(function _callee3() {
|
|
|
var dom, res;
|
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.wrap(function _callee3$(_context3) {
|
|
|
while (1) {
|
|
|
switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
if (!(name < 1 || name > 50)) {
|
|
|
_context3.next = 4;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
dom = document.getElementById('model_error');
|
|
|
dom.style.display = 'block';
|
|
|
return _context3.abrupt("return", Promise.reject());
|
|
|
|
|
|
case 4:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: true
|
|
|
}
|
|
|
});
|
|
|
_context3.next = 7;
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
setTimeout(function () {
|
|
|
resolve('');
|
|
|
}, 4000);
|
|
|
});
|
|
|
|
|
|
case 7:
|
|
|
res = _context3.sent;
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (1) {
|
|
|
antd_es_modal__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].destroyAll();
|
|
|
|
|
|
antd_es_modal__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].confirm({
|
|
|
icon: null,
|
|
|
className: 'custom-modal-divider',
|
|
|
centered: true,
|
|
|
width: 500,
|
|
|
title: '提示',
|
|
|
content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.modalColumn
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
style: {
|
|
|
color: '#676A6C',
|
|
|
display: 'flex'
|
|
|
},
|
|
|
className: "font14 mt20 mb10"
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("img", {
|
|
|
style: {
|
|
|
marginRight: 5
|
|
|
},
|
|
|
src: _assets_images_paper_dui_svg__WEBPACK_IMPORTED_MODULE_30___default.a
|
|
|
}), "\u751F\u6210\u8BD5\u5377\u6210\u529F\u3002")),
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function onOk() {
|
|
|
sendData();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
|
|
|
function onOk() {
|
|
|
return _onOk.apply(this, arguments);
|
|
|
}
|
|
|
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
|
|
|
case 2:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
|
|
|
return function handleOk() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
|
|
|
var sendData = function sendData() {// const body = {
|
|
|
// ...editData?.exercise,
|
|
|
// contents: param.contents,
|
|
|
// exerciseId: params.categoryId,
|
|
|
// score_settings: new_score_settings,
|
|
|
// time: formValue?.time,
|
|
|
// exercise_name: formValue?.name,
|
|
|
// difficulty: formValue?.difficulty,
|
|
|
// exercise_description: formValue?.exam_notes,
|
|
|
// }
|
|
|
// const res = await putExercise(body)
|
|
|
// if (res.status === 0) {
|
|
|
// message.success("修改成功 ")
|
|
|
// history.push(`/classrooms/${params.coursesId}/exercise/${params.categoryId}/detail?random=true`)
|
|
|
// }
|
|
|
};
|
|
|
|
|
|
var handleSave = /*#__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_12__[/* default */ "a"])( /*#__PURE__*/_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.mark(function _callee5() {
|
|
|
var _param$error_tips, _param$contents;
|
|
|
|
|
|
var new_score_settings, new_sort_by_item_type, param, i, _param$panel2, _param$panel2$i, sum, _param$error_tips$i, dom, _param$error_tips$i2, _dom, _param$error_tips$i3, _param$error_tips$i4, compareData, body, res;
|
|
|
|
|
|
return _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_20___default.a.wrap(function _callee5$(_context5) {
|
|
|
while (1) {
|
|
|
switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
_context5.next = 2;
|
|
|
return form.validateFields();
|
|
|
|
|
|
case 2:
|
|
|
new_score_settings = [];
|
|
|
new_sort_by_item_type = [];
|
|
|
param = calculate(listData);
|
|
|
i = 0;
|
|
|
|
|
|
case 6:
|
|
|
if (!(i < param.error_tips.length)) {
|
|
|
_context5.next = 22;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
sum = param === null || param === void 0 ? void 0 : (_param$panel2 = param.panel) === null || _param$panel2 === void 0 ? void 0 : (_param$panel2$i = _param$panel2[i]) === null || _param$panel2$i === void 0 ? void 0 : _param$panel2$i.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0);
|
|
|
|
|
|
if (!(param.error_tips[i].score === 0 && sum !== 0)) {
|
|
|
_context5.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
dom = document.getElementById("".concat((_param$error_tips$i = param.error_tips[i]) === null || _param$error_tips$i === void 0 ? void 0 : _param$error_tips$i.item_type, "_score"));
|
|
|
dom.classList.add("customError");
|
|
|
dom.scrollIntoView({
|
|
|
block: "start",
|
|
|
behavior: "smooth"
|
|
|
});
|
|
|
return _context5.abrupt("return");
|
|
|
|
|
|
case 13:
|
|
|
if (!(param.error_tips[i].score !== 0 && sum === 0)) {
|
|
|
_context5.next = 18;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
_dom = document.getElementById("".concat((_param$error_tips$i2 = param.error_tips[i]) === null || _param$error_tips$i2 === void 0 ? void 0 : _param$error_tips$i2.item_type, "_sum"));
|
|
|
|
|
|
_dom.classList.add("customError");
|
|
|
|
|
|
_dom.scrollIntoView({
|
|
|
block: "start",
|
|
|
behavior: "smooth"
|
|
|
});
|
|
|
|
|
|
return _context5.abrupt("return");
|
|
|
|
|
|
case 18:
|
|
|
if (param.error_tips[i].score !== 0 && sum !== 0) {
|
|
|
new_score_settings === null || new_score_settings === void 0 ? void 0 : new_score_settings.push({
|
|
|
item_type: (_param$error_tips$i3 = param.error_tips[i]) === null || _param$error_tips$i3 === void 0 ? void 0 : _param$error_tips$i3.item_type,
|
|
|
score: ((_param$error_tips$i4 = param.error_tips[i]) === null || _param$error_tips$i4 === void 0 ? void 0 : _param$error_tips$i4.score) || 0
|
|
|
});
|
|
|
new_sort_by_item_type.push(param.error_tips[i].name);
|
|
|
}
|
|
|
|
|
|
case 19:
|
|
|
i++;
|
|
|
_context5.next = 6;
|
|
|
break;
|
|
|
|
|
|
case 22:
|
|
|
if (!(new_score_settings.length === 0)) {
|
|
|
_context5.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_7__[/* default */ "b"].warn('不允许每个题型的总分和抽题数量都为0');
|
|
|
|
|
|
return _context5.abrupt("return");
|
|
|
|
|
|
case 25:
|
|
|
compareData = {
|
|
|
contents: {},
|
|
|
score_settings: {}
|
|
|
}; //生成比较数据
|
|
|
|
|
|
param === null || param === void 0 ? void 0 : (_param$error_tips = param.error_tips) === null || _param$error_tips === void 0 ? void 0 : _param$error_tips.forEach(function (e) {
|
|
|
compareData.score_settings[e.item_type] = e.score;
|
|
|
});
|
|
|
param === null || param === void 0 ? void 0 : (_param$contents = param.contents) === null || _param$contents === void 0 ? void 0 : _param$contents.forEach(function (e) {
|
|
|
var name = "".concat(e.item_type, "_").concat(e.sub_discipline_id, "_").concat(e.tag_discipline_id, "_").concat(e.difficulty);
|
|
|
compareData.contents[name] = e.items_count;
|
|
|
}); // if (!isEqual(saveCompareData.current, compareData)) {
|
|
|
// Modal.confirm({
|
|
|
// icon: null,
|
|
|
// className: 'custom-modal-divider',
|
|
|
// centered: true,
|
|
|
// width: 514,
|
|
|
// title: '提示',
|
|
|
// content: <div className={styles.modalColumn}>
|
|
|
// <div style={{ color: '#676A6C', display: 'flex' }} className="font14 mt20 mb10"><img style={{ marginRight: 5 }} src={J} />修改后需重新配置出卷数量,对已生成的随机试卷删除,确定要修改吗?</div>
|
|
|
// </div>,
|
|
|
// okText: '确认',
|
|
|
// cancelText: '取消',
|
|
|
// onOk: () => {
|
|
|
// Modal.destroyAll();
|
|
|
// handleOk()
|
|
|
// }
|
|
|
// });
|
|
|
// return;
|
|
|
// }
|
|
|
// sendData()
|
|
|
|
|
|
body = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, editData === null || editData === void 0 ? void 0 : editData.exercise), {}, {
|
|
|
contents: param.contents,
|
|
|
exerciseId: params.categoryId,
|
|
|
score_settings: new_score_settings,
|
|
|
time: formValue === null || formValue === void 0 ? void 0 : formValue.time,
|
|
|
exercise_name: formValue === null || formValue === void 0 ? void 0 : formValue.name,
|
|
|
difficulty: formValue === null || formValue === void 0 ? void 0 : formValue.difficulty,
|
|
|
exercise_description: formValue === null || formValue === void 0 ? void 0 : formValue.exam_notes,
|
|
|
num: formValue === null || formValue === void 0 ? void 0 : formValue.num
|
|
|
});
|
|
|
setSaveBtnLoading(true);
|
|
|
_context5.next = 32;
|
|
|
return Object(_service_exercise__WEBPACK_IMPORTED_MODULE_29__[/* putExercise */ "N"])(body);
|
|
|
|
|
|
case 32:
|
|
|
res = _context5.sent;
|
|
|
|
|
|
if (res.status === 0) {
|
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_7__[/* default */ "b"].success("修改成功 ");
|
|
|
|
|
|
umi__WEBPACK_IMPORTED_MODULE_23__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail?random=true"));
|
|
|
}
|
|
|
|
|
|
setSaveBtnLoading(false);
|
|
|
|
|
|
case 35:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
|
|
|
return function handleSave() {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
|
|
|
var selectList = dealList('sub_discipline_name', editData === null || editData === void 0 ? void 0 : editData.all_tag_disciplines);
|
|
|
var disabled = (editData === null || editData === void 0 ? void 0 : (_editData$exercise = editData.exercise) === null || _editData$exercise === void 0 ? void 0 : _editData$exercise.exercise_status) !== 1;
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("section", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.wrap
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_skeleton__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
|
|
|
loading: loading,
|
|
|
active: true,
|
|
|
paragraph: {
|
|
|
rows: 5
|
|
|
}
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.crumbs
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("b", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return umi__WEBPACK_IMPORTED_MODULE_23__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
}
|
|
|
}, "".concat(userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$course = userInfo.course) === null || _userInfo$course === void 0 ? void 0 : _userInfo$course.course_name, ">")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return umi__WEBPACK_IMPORTED_MODULE_23__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
}
|
|
|
}, '试卷列表>'), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", {
|
|
|
style: {
|
|
|
color: "#bebebe"
|
|
|
}
|
|
|
}, '编辑试卷')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("section", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.oneWrap
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.title
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("b", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", null, "\u57FA\u672C\u4FE1\u606F"), " "), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"], {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.formWrap,
|
|
|
form: form,
|
|
|
layout: "horizontal",
|
|
|
scrollToFirstError: true,
|
|
|
onValuesChange: handleValuesChange // onFinish={handleFinish}
|
|
|
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"].Item, {
|
|
|
label: "\u8BD5\u5377\u540D\u79F0",
|
|
|
name: "name",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: '试卷名称不能为空'
|
|
|
}, {
|
|
|
pattern: /^(?!(\s+$))/,
|
|
|
message: '输入框不能全为空格'
|
|
|
}]
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_input__WEBPACK_IMPORTED_MODULE_19__[/* default */ "a"], {
|
|
|
disabled: disabled,
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.in,
|
|
|
bordered: false,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0\uFF0C\u6700\u591A60\u4E2A\u5B57",
|
|
|
maxLength: 60
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
style: {
|
|
|
position: 'relative'
|
|
|
}
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"].Item, {
|
|
|
label: "\u7B54\u9898\u65F6\u957F:",
|
|
|
name: "time",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: "答题时长不能为空"
|
|
|
}]
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_input_number__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"], {
|
|
|
min: 1,
|
|
|
parser: parser,
|
|
|
max: 9999,
|
|
|
disabled: disabled,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u7B54\u9898\u65F6\u957F",
|
|
|
style: {
|
|
|
width: 190
|
|
|
}
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", {
|
|
|
style: {
|
|
|
position: 'absolute',
|
|
|
top: 26,
|
|
|
left: 310
|
|
|
}
|
|
|
}, "\u5206\u949F")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"].Item, {
|
|
|
label: "\u8BD5\u9898\u96BE\u5EA6",
|
|
|
name: "difficulty",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: "请选择难度"
|
|
|
}]
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_radio__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Group, {
|
|
|
disabled: disabled,
|
|
|
style: {
|
|
|
display: "flex",
|
|
|
width: 286,
|
|
|
justifyContent: "space-between"
|
|
|
},
|
|
|
size: "large"
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_radio__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Button, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.rb,
|
|
|
value: 1
|
|
|
}, "\u7B80\u5355"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_radio__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Button, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.rb,
|
|
|
value: 2
|
|
|
}, "\u9002\u4E2D"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_radio__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Button, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.rb,
|
|
|
value: 3
|
|
|
}, "\u56F0\u96BE"))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"].Item, {
|
|
|
label: "\u51FA\u5377\u6570\u91CF:",
|
|
|
name: "num",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: "出卷数量不能为空"
|
|
|
}, {
|
|
|
max: 50,
|
|
|
min: 1,
|
|
|
message: "请输入1~50之间的整数",
|
|
|
type: 'number'
|
|
|
}]
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_input_number__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"], {
|
|
|
min: 0,
|
|
|
parser: parser // max={}
|
|
|
,
|
|
|
disabled: disabled,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u51FA\u5377\u6570\u91CF",
|
|
|
style: {
|
|
|
width: 190
|
|
|
}
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"].Item, {
|
|
|
label: "\u8003\u8BD5\u987B\u77E5",
|
|
|
name: "exam_notes"
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(TextArea, {
|
|
|
disabled: disabled,
|
|
|
placeholder: "\u8003\u751F\u5FC5\u987B\u4E25\u683C\u9075\u5B88\u8003\u573A\u7EAA\u5F8B\uFF0C\u4E0D\u51C6\u5192\u540D\u9876\u66FF\uFF0C\u4E0D\u51C6\u6709\u4EFB\u4F55\u4F5C\u5F0A\u884C\u4E3A\u3002\u5982\u53D1\u73B0\u8FDD\u7EAA\uFF0C\u5E76\u7ED9\u4E88\u4E25\u5389\u5904\u5206\u3002",
|
|
|
rows: 4,
|
|
|
maxLength: 300
|
|
|
})))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("section", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.twoWrap
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.tag
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.name
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("b", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.num
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", null, "\u8003\u5BDF\u8303\u56F4")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.knWarp
|
|
|
}, selectList === null || selectList === void 0 ? void 0 : selectList.map(function (e, key) {
|
|
|
var _e$;
|
|
|
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_21___default.a.Fragment, {
|
|
|
key: key
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.kn
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", null, key + 1), " ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", null, e === null || e === void 0 ? void 0 : (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.sub_discipline_name)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(_pages_Paperlibrary_Random_AddAndEdit_components_StepTwo_AddTags__WEBPACK_IMPORTED_MODULE_27__[/* default */ "a"], {
|
|
|
disabled: true,
|
|
|
type: 1,
|
|
|
value: e === null || e === void 0 ? void 0 : e.map(function (k) {
|
|
|
return Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_14__[/* 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_14__[/* default */ "a"])({}, k), {}, {
|
|
|
id: k.sub_discipline_id,
|
|
|
name: k.tag_discipline_name
|
|
|
});
|
|
|
})
|
|
|
}));
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.name,
|
|
|
style: {
|
|
|
marginTop: 10
|
|
|
}
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("b", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.num
|
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", null, "\u6559\u7814\u56E2\u961F")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.knWarp
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(_pages_Paperlibrary_Random_AddAndEdit_components_StepTwo_AddTags__WEBPACK_IMPORTED_MODULE_27__[/* default */ "a"], {
|
|
|
disabled: true,
|
|
|
type: 1,
|
|
|
value: editData === null || editData === void 0 ? void 0 : editData.teach_groups
|
|
|
}))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.title
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("b", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("span", null, "\u9898\u76EE\u9898\u91CF"), " "), listData.map(function (e, i) {
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(_pages_Paperlibrary_Random_AddAndEdit_components_StepTwo_List__WEBPACK_IMPORTED_MODULE_26__[/* default */ "a"], {
|
|
|
expansion: false,
|
|
|
disabled: disabled,
|
|
|
listClassName: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.list,
|
|
|
key: i,
|
|
|
value: e,
|
|
|
onChange: function onChange(e) {
|
|
|
return handleChange(e, i);
|
|
|
}
|
|
|
});
|
|
|
}), renderTotal()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_24___default.a.btns
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], {
|
|
|
onClick: function onClick() {
|
|
|
document.body.scrollIntoView();
|
|
|
umi__WEBPACK_IMPORTED_MODULE_23__[/* history */ "d"].push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
}
|
|
|
}, "\u8FD4\u56DE"), !disabled && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], {
|
|
|
loading: btnLoading,
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return toAnswer();
|
|
|
}
|
|
|
}, "\u6A21\u62DF\u8003\u8BD5"), !disabled && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_21___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], {
|
|
|
loading: saveLoading,
|
|
|
onClick: function onClick() {
|
|
|
return handleSave();
|
|
|
}
|
|
|
}, "\u63D0\u4EA4"))));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["default"] = (Object(umi__WEBPACK_IMPORTED_MODULE_23__[/* connect */ "a"])(function (_ref6) {
|
|
|
var paperlibrary = _ref6.paperlibrary,
|
|
|
user = _ref6.user,
|
|
|
globalSetting = _ref6.globalSetting;
|
|
|
return {
|
|
|
paperlibrary: paperlibrary,
|
|
|
user: user,
|
|
|
globalSetting: globalSetting
|
|
|
};
|
|
|
})(PaperlibraryPage));
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |