You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
734 lines
31 KiB
734 lines
31 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[33784],{
|
|
|
|
/***/ 20032:
|
|
/*!********************************************************************!*\
|
|
!*** ./src/pages/Paperlibrary/Random/Detail/index.tsx + 1 modules ***!
|
|
\********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": function() { return /* binding */ Detail; },
|
|
"difficultType": function() { return /* binding */ difficultType; },
|
|
"questionType": function() { return /* binding */ questionType; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js
|
|
var objectDestructuringEmpty = __webpack_require__(13012);
|
|
var objectDestructuringEmpty_default = /*#__PURE__*/__webpack_require__.n(objectDestructuringEmpty);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/spin/style/index.js + 1 modules
|
|
var style = __webpack_require__(22536);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/spin/index.js
|
|
var spin = __webpack_require__(11382);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/card/style/index.js + 1 modules
|
|
var card_style = __webpack_require__(78548);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/card/index.js + 3 modules
|
|
var card = __webpack_require__(59652);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/divider/style/index.js + 1 modules
|
|
var divider_style = __webpack_require__(98541);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/divider/index.js
|
|
var divider = __webpack_require__(27049);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/breadcrumb/style/index.js + 1 modules
|
|
var breadcrumb_style = __webpack_require__(63102);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/breadcrumb/index.js + 3 modules
|
|
var breadcrumb = __webpack_require__(58492);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
|
|
var button_style = __webpack_require__(29913);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
var es_button = __webpack_require__(71577);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
|
|
var toConsumableArray = __webpack_require__(861);
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/classCallCheck.js
|
|
var classCallCheck = __webpack_require__(56690);
|
|
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createClass.js
|
|
var createClass = __webpack_require__(89728);
|
|
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/assertThisInitialized.js
|
|
var assertThisInitialized = __webpack_require__(66115);
|
|
var assertThisInitialized_default = /*#__PURE__*/__webpack_require__.n(assertThisInitialized);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inherits.js
|
|
var inherits = __webpack_require__(61655);
|
|
var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createSuper.js
|
|
var createSuper = __webpack_require__(26389);
|
|
var createSuper_default = /*#__PURE__*/__webpack_require__.n(createSuper);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
|
|
var defineProperty = __webpack_require__(38416);
|
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(84519);
|
|
// EXTERNAL MODULE: ./node_modules/@umijs/preset-umi/node_modules/react-router-dom/index.js
|
|
var react_router_dom = __webpack_require__(13854);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
var _umi_production_exports = __webpack_require__(89214);
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Detail/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Detailmodules = ({"randomIcon":"randomIcon___V1A1W"});
|
|
// EXTERNAL MODULE: ./src/pages/Paperlibrary/components/SendToClassModal.tsx + 5 modules
|
|
var SendToClassModal = __webpack_require__(79086);
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Detail/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var questionType = {
|
|
SINGLE: "单选题",
|
|
MULTIPLE: "多选题",
|
|
JUDGMENT: "判断题",
|
|
COMPLETION: "填空题",
|
|
SUBJECTIVE: "简答题",
|
|
PRACTICAL: "实训题",
|
|
PROGRAM: "编程题"
|
|
};
|
|
var difficultType = {
|
|
1: "简单",
|
|
2: "适中",
|
|
3: "困难"
|
|
};
|
|
var indexArr = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
|
|
var RandomPaperDetail = /*#__PURE__*/function (_React$Component) {
|
|
inherits_default()(RandomPaperDetail, _React$Component);
|
|
var _super = createSuper_default()(RandomPaperDetail);
|
|
function RandomPaperDetail(props) {
|
|
var _this;
|
|
classCallCheck_default()(this, RandomPaperDetail);
|
|
_this = _super.call(this, props);
|
|
defineProperty_default()(assertThisInitialized_default()(_this), "getPaperData", function () {
|
|
var id = window.location.href.split("/").pop();
|
|
_this.setState({
|
|
loading: true,
|
|
id: id
|
|
});
|
|
(0,fetch/* default */.ZP)("/api/examination_banks/".concat(id, "/edit_random_exam.json"), {
|
|
method: "get"
|
|
}).then(function (res) {
|
|
_this.setState({
|
|
loading: false
|
|
});
|
|
if (res) {
|
|
var contents = res.contents,
|
|
examination_bank = res.examination_bank,
|
|
score_settings = res.score_settings;
|
|
_this.setState({
|
|
contents: contents,
|
|
examination_bank: examination_bank,
|
|
score_settings: score_settings
|
|
});
|
|
}
|
|
});
|
|
});
|
|
defineProperty_default()(assertThisInitialized_default()(_this), "handleSendToClass", function () {
|
|
var _this$props, _this$state;
|
|
(_this$props = _this.props) === null || _this$props === void 0 ? void 0 : _this$props.dispatch({
|
|
type: 'paperlibrary/setActionTabs',
|
|
payload: {
|
|
key: 'Paperlibrary-SendToClass',
|
|
params: {
|
|
id: (_this$state = _this.state) === null || _this$state === void 0 ? void 0 : _this$state.id,
|
|
data: {
|
|
is_random: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
_this.state = {
|
|
loading: false,
|
|
contents: [],
|
|
examination_bank: {},
|
|
score_settings: [],
|
|
modalVisible: false,
|
|
id: null
|
|
};
|
|
return _this;
|
|
}
|
|
createClass_default()(RandomPaperDetail, [{
|
|
key: "componentDidMount",
|
|
value: function componentDidMount() {
|
|
this.getPaperData();
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
var _this2 = this;
|
|
var _this$state2 = this.state,
|
|
contents = _this$state2.contents,
|
|
examination_bank = _this$state2.examination_bank,
|
|
score_settings = _this$state2.score_settings,
|
|
loading = _this$state2.loading;
|
|
var count = []; //记录有哪些题型,数量
|
|
var totalScore = 0; //总分
|
|
var totalCount = 0; //总小题数
|
|
Object.keys(questionType).map(function (key) {
|
|
var num = 0;
|
|
contents.map(function (item) {
|
|
if (item.item_type === key) {
|
|
num += item.quanlity;
|
|
}
|
|
});
|
|
var scoreItem = score_settings.filter(function (v) {
|
|
return v.item_type === key;
|
|
});
|
|
count = [].concat(toConsumableArray_default()(count), [{
|
|
item_type: key,
|
|
num: num,
|
|
score: scoreItem.length > 0 ? scoreItem[0].score : 0
|
|
}]);
|
|
});
|
|
var allcount = count.filter(function (item) {
|
|
return item.num !== 0;
|
|
}); //num不为0的大题数组 [{item_type:"MUTIPLY",num:1,score:4}]
|
|
allcount.map(function (item) {
|
|
score_settings.map(function (item1) {
|
|
if (item.item_type === item1.item_type) {
|
|
totalScore += item.num * item1.score;
|
|
totalCount += item.num;
|
|
}
|
|
});
|
|
});
|
|
var CardTitle = /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
display: "flex",
|
|
justifyContent: "space-between",
|
|
alignItems: "center"
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
display: "flex",
|
|
justifyContent: "space-between",
|
|
width: "50%",
|
|
fontWeight: 500,
|
|
fontSize: '16px'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: ["\u603B\u8BA1 ", allcount.length, " \u5927\u9898\uFF0C ", totalCount, " \u5C0F\u9898\uFF0C\u603B\u5206 ", totalScore, " ", "\u5206"]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: ["\u8003\u8BD5\u65F6\u957F\uFF1A ", examination_bank.time, " \u5206\u949F"]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: ["\u8BD5\u5377\u96BE\u5EA6\uFF1A", difficultType[examination_bank.difficulty]]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
type: "primary",
|
|
onClick: function onClick() {
|
|
return _this2.handleSendToClass();
|
|
},
|
|
children: "\u53D1\u9001\u81F3\u8BFE\u5802"
|
|
})
|
|
})]
|
|
});
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
width: 1200,
|
|
margin: "0px auto"
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
spinning: this.state.loading,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(breadcrumb/* default */.Z, {
|
|
separator: ">",
|
|
style: {
|
|
padding: "12px 0px"
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default.Item */.Z.Item, {
|
|
children: "\u8BD5\u5377\u5E93"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default.Item */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(react_router_dom/* Link */.rU, {
|
|
to: "/paperlibrary",
|
|
children: "\u6211\u7684\u8BD5\u5377\u5E93"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default.Item */.Z.Item, {
|
|
children: "\u8BD5\u5377\u67E5\u770B"
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
height: 50,
|
|
display: "flex",
|
|
alignItems: "center"
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
style: {
|
|
fontSize: 20,
|
|
fontWeight: 600
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "icon-leftarrow iconfont",
|
|
style: {
|
|
fontSize: 14,
|
|
marginRight: 8,
|
|
cursor: "pointer"
|
|
},
|
|
onClick: function onClick() {
|
|
_umi_production_exports.history.back();
|
|
}
|
|
}), examination_bank.name]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Detailmodules.randomIcon,
|
|
children: "\u968F\u673A"
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(card/* default */.Z, {
|
|
title: CardTitle,
|
|
style: {
|
|
marginBottom: 200
|
|
},
|
|
children: allcount.map(function (item, index) {
|
|
//去重的二级菜单目录 subIds
|
|
var subIds = Array.from(new Set(contents.map(function (content) {
|
|
if (content.item_type === item.item_type) {
|
|
return content.sub_discipline_id;
|
|
}
|
|
return null;
|
|
}).filter(function (i) {
|
|
return i;
|
|
})));
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
color: "#0152d9"
|
|
},
|
|
children: [indexArr[index], "\u3001", questionType[item.item_type], /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
style: {
|
|
color: "#666666",
|
|
marginLeft: 5
|
|
},
|
|
children: ["(\u5171 ", item.num, " \u9898\uFF0C\u6BCF\u9898 ", item.score, " \u5206)"]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
children: subIds.map(function (id) {
|
|
//contentArr 当前大题、当前二级目录 所有的难度
|
|
var contentArr = contents.filter(function (content) {
|
|
return content.sub_discipline_id === id && item.item_type === content.item_type;
|
|
});
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
marginTop: 20,
|
|
display: "flex"
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
width: "30%",
|
|
fontWeight: "600"
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: "".concat(contentArr[0].discipline_name, " /\n ").concat(contentArr[0].sub_discipline_name)
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
children: Object.keys(difficultType).map(function (difficulty) {
|
|
var dnum = 0;
|
|
contentArr.map(function (content) {
|
|
if (content.difficulty == difficulty) {
|
|
dnum = content.quanlity;
|
|
}
|
|
return null;
|
|
});
|
|
return dnum > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
style: {
|
|
color: "#0152d9",
|
|
marginLeft: 30
|
|
},
|
|
children: [difficultType[difficulty], ": ", dnum, " \u9898"]
|
|
}) : null;
|
|
})
|
|
})]
|
|
});
|
|
})
|
|
}), index === allcount.length - 1 ? null : /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
});
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(SendToClassModal/* default */.Z, {})]
|
|
})
|
|
});
|
|
}
|
|
}]);
|
|
return RandomPaperDetail;
|
|
}(react.Component);
|
|
/* harmony default export */ var Detail = ((0,_umi_production_exports.connect)(function (_ref) {
|
|
objectDestructuringEmpty_default()(_ref);
|
|
return {};
|
|
})(RandomPaperDetail));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 58492:
|
|
/*!**************************************************************!*\
|
|
!*** ./node_modules/antd/es/breadcrumb/index.js + 3 modules ***!
|
|
\**************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ breadcrumb; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(4942);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(87462);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__(74902);
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__(94184);
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__(50344);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/context.js
|
|
var context = __webpack_require__(53124);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/menu/index.js + 5 modules
|
|
var menu = __webpack_require__(66516);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/_util/reactNode.js
|
|
var reactNode = __webpack_require__(96159);
|
|
// EXTERNAL MODULE: ./node_modules/antd/node_modules/@ant-design/icons/es/icons/DownOutlined.js
|
|
var DownOutlined = __webpack_require__(13622);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/dropdown.js + 1 modules
|
|
var dropdown = __webpack_require__(18562);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/breadcrumb/BreadcrumbItem.js
|
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var BreadcrumbItem = function BreadcrumbItem(props) {
|
|
var customizePrefixCls = props.prefixCls,
|
|
_props$separator = props.separator,
|
|
separator = _props$separator === void 0 ? '/' : _props$separator,
|
|
children = props.children,
|
|
menu = props.menu,
|
|
overlay = props.overlay,
|
|
dropdownProps = props.dropdownProps,
|
|
restProps = __rest(props, ["prefixCls", "separator", "children", "menu", "overlay", "dropdownProps"]);
|
|
var _React$useContext = react.useContext(context/* ConfigContext */.E_),
|
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
var prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
|
|
// Warning for deprecated usage
|
|
if (false) {}
|
|
/** If overlay is have Wrap a Dropdown */
|
|
var renderBreadcrumbNode = function renderBreadcrumbNode(breadcrumbItem) {
|
|
if (menu || overlay) {
|
|
return /*#__PURE__*/react.createElement(dropdown/* default */.Z, (0,esm_extends/* default */.Z)({
|
|
menu: menu,
|
|
overlay: overlay,
|
|
placement: "bottom"
|
|
}, dropdownProps), /*#__PURE__*/react.createElement("span", {
|
|
className: "".concat(prefixCls, "-overlay-link")
|
|
}, breadcrumbItem, /*#__PURE__*/react.createElement(DownOutlined/* default */.Z, null)));
|
|
}
|
|
return breadcrumbItem;
|
|
};
|
|
var link;
|
|
if ('href' in restProps) {
|
|
link = /*#__PURE__*/react.createElement("a", (0,esm_extends/* default */.Z)({
|
|
className: "".concat(prefixCls, "-link")
|
|
}, restProps), children);
|
|
} else {
|
|
link = /*#__PURE__*/react.createElement("span", (0,esm_extends/* default */.Z)({
|
|
className: "".concat(prefixCls, "-link")
|
|
}, restProps), children);
|
|
}
|
|
// wrap to dropDown
|
|
link = renderBreadcrumbNode(link);
|
|
if (children !== undefined && children !== null) {
|
|
return /*#__PURE__*/react.createElement("li", null, link, separator && /*#__PURE__*/react.createElement("span", {
|
|
className: "".concat(prefixCls, "-separator")
|
|
}, separator));
|
|
}
|
|
return null;
|
|
};
|
|
BreadcrumbItem.__ANT_BREADCRUMB_ITEM = true;
|
|
/* harmony default export */ var breadcrumb_BreadcrumbItem = (BreadcrumbItem);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/breadcrumb/BreadcrumbSeparator.js
|
|
|
|
|
|
var BreadcrumbSeparator = function BreadcrumbSeparator(_ref) {
|
|
var children = _ref.children;
|
|
var _React$useContext = react.useContext(context/* ConfigContext */.E_),
|
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
var prefixCls = getPrefixCls('breadcrumb');
|
|
return /*#__PURE__*/react.createElement("span", {
|
|
className: "".concat(prefixCls, "-separator")
|
|
}, children || '/');
|
|
};
|
|
BreadcrumbSeparator.__ANT_BREADCRUMB_SEPARATOR = true;
|
|
/* harmony default export */ var breadcrumb_BreadcrumbSeparator = (BreadcrumbSeparator);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/breadcrumb/Breadcrumb.js
|
|
|
|
|
|
|
|
var Breadcrumb_rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getBreadcrumbName(route, params) {
|
|
if (!route.breadcrumbName) {
|
|
return null;
|
|
}
|
|
var paramsKeys = Object.keys(params).join('|');
|
|
var name = route.breadcrumbName.replace(new RegExp(":(".concat(paramsKeys, ")"), 'g'), function (replacement, key) {
|
|
return params[key] || replacement;
|
|
});
|
|
return name;
|
|
}
|
|
function defaultItemRender(route, params, routes, paths) {
|
|
var isLastItem = routes.indexOf(route) === routes.length - 1;
|
|
var name = getBreadcrumbName(route, params);
|
|
return isLastItem ? /*#__PURE__*/react.createElement("span", null, name) : /*#__PURE__*/react.createElement("a", {
|
|
href: "#/".concat(paths.join('/'))
|
|
}, name);
|
|
}
|
|
var getPath = function getPath(path, params) {
|
|
path = (path || '').replace(/^\//, '');
|
|
Object.keys(params).forEach(function (key) {
|
|
path = path.replace(":".concat(key), params[key]);
|
|
});
|
|
return path;
|
|
};
|
|
var addChildPath = function addChildPath(paths, childPath, params) {
|
|
var originalPaths = (0,toConsumableArray/* default */.Z)(paths);
|
|
var path = getPath(childPath || '', params);
|
|
if (path) {
|
|
originalPaths.push(path);
|
|
}
|
|
return originalPaths;
|
|
};
|
|
var Breadcrumb = function Breadcrumb(_a) {
|
|
var customizePrefixCls = _a.prefixCls,
|
|
_a$separator = _a.separator,
|
|
separator = _a$separator === void 0 ? '/' : _a$separator,
|
|
style = _a.style,
|
|
className = _a.className,
|
|
routes = _a.routes,
|
|
children = _a.children,
|
|
_a$itemRender = _a.itemRender,
|
|
itemRender = _a$itemRender === void 0 ? defaultItemRender : _a$itemRender,
|
|
_a$params = _a.params,
|
|
params = _a$params === void 0 ? {} : _a$params,
|
|
restProps = Breadcrumb_rest(_a, ["prefixCls", "separator", "style", "className", "routes", "children", "itemRender", "params"]);
|
|
var _React$useContext = react.useContext(context/* ConfigContext */.E_),
|
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
direction = _React$useContext.direction;
|
|
var crumbs;
|
|
var prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
|
|
if (routes && routes.length > 0) {
|
|
// generated by route
|
|
var paths = [];
|
|
crumbs = routes.map(function (route) {
|
|
var path = getPath(route.path, params);
|
|
if (path) {
|
|
paths.push(path);
|
|
}
|
|
// generated overlay by route.children
|
|
var overlay;
|
|
if (route.children && route.children.length) {
|
|
overlay = /*#__PURE__*/react.createElement(menu/* default */.Z, {
|
|
items: route.children.map(function (child) {
|
|
return {
|
|
key: child.path || child.breadcrumbName,
|
|
label: itemRender(child, params, routes, addChildPath(paths, child.path, params))
|
|
};
|
|
})
|
|
});
|
|
}
|
|
var itemProps = {
|
|
separator: separator
|
|
};
|
|
if (overlay) {
|
|
itemProps.overlay = overlay;
|
|
}
|
|
return /*#__PURE__*/react.createElement(breadcrumb_BreadcrumbItem, (0,esm_extends/* default */.Z)({}, itemProps, {
|
|
key: path || route.breadcrumbName
|
|
}), itemRender(route, params, routes, paths));
|
|
});
|
|
} else if (children) {
|
|
crumbs = (0,toArray/* default */.Z)(children).map(function (element, index) {
|
|
if (!element) {
|
|
return element;
|
|
}
|
|
false ? 0 : void 0;
|
|
return (0,reactNode/* cloneElement */.Tm)(element, {
|
|
separator: separator,
|
|
key: index
|
|
});
|
|
});
|
|
}
|
|
var breadcrumbClassName = classnames_default()(prefixCls, (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className);
|
|
return /*#__PURE__*/react.createElement("nav", (0,esm_extends/* default */.Z)({
|
|
className: breadcrumbClassName,
|
|
style: style
|
|
}, restProps), /*#__PURE__*/react.createElement("ol", null, crumbs));
|
|
};
|
|
Breadcrumb.Item = breadcrumb_BreadcrumbItem;
|
|
Breadcrumb.Separator = breadcrumb_BreadcrumbSeparator;
|
|
/* harmony default export */ var breadcrumb_Breadcrumb = (Breadcrumb);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/breadcrumb/index.js
|
|
|
|
/* harmony default export */ var breadcrumb = (breadcrumb_Breadcrumb);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 63102:
|
|
/*!********************************************************************!*\
|
|
!*** ./node_modules/antd/es/breadcrumb/style/index.js + 1 modules ***!
|
|
\********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/style/default.less
|
|
var style_default = __webpack_require__(43146);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/breadcrumb/style/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/style/index.js + 1 modules
|
|
var style = __webpack_require__(68018);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/menu/style/index.js + 1 modules
|
|
var menu_style = __webpack_require__(83736);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/breadcrumb/style/index.js
|
|
|
|
|
|
// style dependencies
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 27049:
|
|
/*!***********************************************!*\
|
|
!*** ./node_modules/antd/es/divider/index.js ***!
|
|
\***********************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ 87462);
|
|
/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ 4942);
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ 94184);
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 67294);
|
|
/* harmony import */ var _config_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config-provider */ 53124);
|
|
|
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
var Divider = function Divider(props) {
|
|
var _classNames;
|
|
var _React$useContext = react__WEBPACK_IMPORTED_MODULE_1__.useContext(_config_provider__WEBPACK_IMPORTED_MODULE_2__/* .ConfigContext */ .E_),
|
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
direction = _React$useContext.direction;
|
|
var customizePrefixCls = props.prefixCls,
|
|
_props$type = props.type,
|
|
type = _props$type === void 0 ? 'horizontal' : _props$type,
|
|
_props$orientation = props.orientation,
|
|
orientation = _props$orientation === void 0 ? 'center' : _props$orientation,
|
|
orientationMargin = props.orientationMargin,
|
|
className = props.className,
|
|
children = props.children,
|
|
dashed = props.dashed,
|
|
plain = props.plain,
|
|
restProps = __rest(props, ["prefixCls", "type", "orientation", "orientationMargin", "className", "children", "dashed", "plain"]);
|
|
var prefixCls = getPrefixCls('divider', customizePrefixCls);
|
|
var orientationPrefix = orientation.length > 0 ? "-".concat(orientation) : orientation;
|
|
var hasChildren = !!children;
|
|
var hasCustomMarginLeft = orientation === 'left' && orientationMargin != null;
|
|
var hasCustomMarginRight = orientation === 'right' && orientationMargin != null;
|
|
var classString = classnames__WEBPACK_IMPORTED_MODULE_0___default()(prefixCls, "".concat(prefixCls, "-").concat(type), (_classNames = {}, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-with-text"), hasChildren), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-with-text").concat(orientationPrefix), hasChildren), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-dashed"), !!dashed), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-plain"), !!plain), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-no-default-orientation-margin-left"), hasCustomMarginLeft), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-no-default-orientation-margin-right"), hasCustomMarginRight), _classNames), className);
|
|
var innerStyle = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({}, hasCustomMarginLeft && {
|
|
marginLeft: orientationMargin
|
|
}), hasCustomMarginRight && {
|
|
marginRight: orientationMargin
|
|
});
|
|
// Warning children not work in vertical mode
|
|
if (false) {}
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({
|
|
className: classString
|
|
}, restProps, {
|
|
role: "separator"
|
|
}), children && type !== 'vertical' && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement("span", {
|
|
className: "".concat(prefixCls, "-inner-text"),
|
|
style: innerStyle
|
|
}, children));
|
|
};
|
|
/* harmony default export */ __webpack_exports__["Z"] = (Divider);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 98541:
|
|
/*!*****************************************************************!*\
|
|
!*** ./node_modules/antd/es/divider/style/index.js + 1 modules ***!
|
|
\*****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/style/default.less
|
|
var style_default = __webpack_require__(43146);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/divider/style/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/divider/style/index.js
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |