@titaui/pc 1.12.99 → 1.13.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/lib/components/change-okr-modal/index.js +1 -1
  2. package/lib/components/checkbox-list/index.css +18 -0
  3. package/lib/components/checkbox-list/index.js +66 -0
  4. package/lib/components/common-share/publishMblog.js +1 -1
  5. package/lib/components/create-okr-modal/fields/okr-type-detail.js +1 -1
  6. package/lib/components/create-okr-modal/fields/okr-visibility-detail.js +1 -1
  7. package/lib/components/create-okr-modal/index.js +5 -2
  8. package/lib/components/create-okr-modal/request-api.js +1 -1
  9. package/lib/components/create-okr-modal/utils/helper.js +1 -1
  10. package/lib/components/date-picker/BodyItem.js +3 -3
  11. package/lib/components/date-picker/CalendarHeader.js +3 -3
  12. package/lib/components/delete-confirm-pop/ConfirmPop.js +3 -3
  13. package/lib/components/dialog-qq-docs/index.css +90 -0
  14. package/lib/components/dialog-qq-docs/index.js +490 -0
  15. package/lib/components/dialog-qq-docs/request-apis.js +16 -0
  16. package/lib/components/dialog-qq-docs/utils.js +80 -0
  17. package/lib/components/dialog-select/index.css +9 -0
  18. package/lib/components/dialog-select/index.js +48 -0
  19. package/lib/components/dialog-upload/index.js +1 -1
  20. package/lib/components/dialog-upload-type/assets/folder.svg +20 -0
  21. package/lib/components/dialog-upload-type/assets/qq-docs.svg +20 -0
  22. package/lib/components/dialog-upload-type/components/upload-type-item/index.css +14 -0
  23. package/lib/components/dialog-upload-type/components/upload-type-item/index.js +36 -0
  24. package/lib/components/dialog-upload-type/index.css +7 -0
  25. package/lib/components/dialog-upload-type/index.js +75 -0
  26. package/lib/components/drawer-manager/drawerWrapper.js +1 -1
  27. package/lib/components/dynamic/dynamic-item/components/progress/components/okr-progress/index.js +1 -1
  28. package/lib/components/dynamic/dynamic-item/components/summary-header/index.js +1 -1
  29. package/lib/components/eReport/eReportLists/reportList.js +3 -3
  30. package/lib/components/emotions-selector/selector-pop.js +3 -3
  31. package/lib/components/ereport-list/index.js +3 -3
  32. package/lib/components/file-list/components/single-file/index.js +3 -1
  33. package/lib/components/file-list/index.js +2 -1
  34. package/lib/components/file-preview/index.css +37 -0
  35. package/lib/components/file-preview/index.js +68 -0
  36. package/lib/components/firework/index.js +1 -1
  37. package/lib/components/form/form-fields/input-verification-code/index.js +1 -1
  38. package/lib/components/grid-layout/util/network.js +1 -1
  39. package/lib/components/import-modal/tree/okr-tree/index.js +1 -1
  40. package/lib/components/loading/assets/loading.gif +0 -0
  41. package/lib/components/loading/index.css +23 -0
  42. package/lib/components/loading/index.js +30 -0
  43. package/lib/components/mblog/components/MblogAction.js +3 -3
  44. package/lib/components/nav/index.css +23 -0
  45. package/lib/components/nav/index.js +31 -0
  46. package/lib/components/nav-top/components/app-center/index.css +1 -1
  47. package/lib/components/nav-top/components/menu/index.js +15 -15
  48. package/lib/components/nav-top/index.js +112 -5
  49. package/lib/components/okr-detail/base-info/other-infos/principal/index.js +1 -1
  50. package/lib/components/okr-detail/components/ao-nice/index.js +1 -1
  51. package/lib/components/okr-detail/components/header/edit-name.js +1 -1
  52. package/lib/components/okr-detail/components/header/o-avatar.js +1 -1
  53. package/lib/components/okr-detail/components/header/o-classify.js +1 -1
  54. package/lib/components/okr-detail/components/o-classify.js +1 -1
  55. package/lib/components/okr-detail/components/o-progress-update/index.js +1 -1
  56. package/lib/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.js +1 -1
  57. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-task-level2.js +1 -1
  58. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-task.js +1 -1
  59. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +1 -1
  60. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/edit-pop.js +3 -3
  61. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-parent-node/index.js +1 -1
  62. package/lib/components/okr-detail/components/okr-tree/tree-node/o-child-node/edit-child-okr-weight.js +1 -1
  63. package/lib/components/okr-detail/components/okr-tree/tree-node/o-parent-node/index.js +1 -1
  64. package/lib/components/okr-detail/detail-footer/index.js +1 -1
  65. package/lib/components/okr-detail/detail-header/delete-confirm/delete-confirm.js +33 -29
  66. package/lib/components/okr-detail/detail-header/index.js +1 -1
  67. package/lib/components/okr-detail/okr-list/index.js +1 -1
  68. package/lib/components/okr-detail/request-apis.js +1 -1
  69. package/lib/components/okr-flow/child-node/fields/creator.js +1 -1
  70. package/lib/components/okr-flow/child-node/work-node.js +1 -1
  71. package/lib/components/okr-flow/export-modal/index.js +40 -1
  72. package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +1 -1
  73. package/lib/components/okr-flow/request-apis.js +1 -1
  74. package/lib/components/okr-flow/root-node/index.js +1 -1
  75. package/lib/components/okr-guide/constant.js +23 -0
  76. package/lib/components/okr-guide/img/left-img.png +0 -0
  77. package/lib/components/okr-guide/index.css +146 -0
  78. package/lib/components/okr-guide/index.js +243 -0
  79. package/lib/components/okr-guide/request-api.js +57 -0
  80. package/lib/components/okr-progress/components/o-progress-update/index.js +1 -1
  81. package/lib/components/okr-progress-modal/index.js +1 -1
  82. package/lib/components/okr-review/ReviewPop/components/ReviewBody/index.js +1 -1
  83. package/lib/components/okr-review/components/ReviewItem/index.js +3 -3
  84. package/lib/components/okr-review/components/confirm-pop/ConfirmPop.js +3 -3
  85. package/lib/components/okr-share/common-painter/darwAvatar.js +1 -1
  86. package/lib/components/okr-share/common-painter/openDataPainter.js +1 -1
  87. package/lib/components/okr-share/common-painter/utils.js +1 -1
  88. package/lib/components/okr-share/pink-card/drawDepartmentName.js +1 -1
  89. package/lib/components/okr-share/pink-card/drawKrs.js +1 -1
  90. package/lib/components/okr-share/pink-card/drawQuote.js +1 -1
  91. package/lib/components/okr-share/pink-card/drawUserName.js +1 -1
  92. package/lib/components/okr-share/pink-card/index.js +1 -1
  93. package/lib/components/okr-share/publishMblog.js +1 -1
  94. package/lib/components/okr-share/shareCardSelector.js +1 -1
  95. package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +3 -1
  96. package/lib/components/okrcase-library/server/network.js +1 -1
  97. package/lib/components/open-data-painter/index.js +1 -1
  98. package/lib/components/period-selector/helper/index.js +1 -1
  99. package/lib/components/range-selector-pop/RangeSelectorPop.js +3 -3
  100. package/lib/components/rich-editor/models/schema.js +6 -6
  101. package/lib/components/rich-editor/plugins/block/block-quote/index.js +8 -8
  102. package/lib/components/rich-editor/plugins/block/heading/index.js +8 -8
  103. package/lib/components/rich-editor/plugins/block/lists/index.js +14 -14
  104. package/lib/components/rich-editor/plugins/block/paragraph/index.js +5 -5
  105. package/lib/components/rich-editor/plugins/core/index.js +4 -4
  106. package/lib/components/rich-editor/plugins/extension/alignment/index.js +5 -5
  107. package/lib/components/rich-editor/plugins/extension/placeholder/index.js +4 -4
  108. package/lib/components/rich-editor/plugins/inline/color/commond.js +3 -3
  109. package/lib/components/rich-editor/plugins/inline/color/index.js +11 -11
  110. package/lib/components/rich-editor/plugins/inline/delete-line/index.js +8 -8
  111. package/lib/components/rich-editor/plugins/inline/em/index.js +5 -5
  112. package/lib/components/rich-editor/plugins/inline/link/index.js +8 -8
  113. package/lib/components/rich-editor/plugins/inline/strong/index.js +8 -8
  114. package/lib/components/rich-editor/plugins/inline/under-line/index.js +8 -8
  115. package/lib/components/rich-editor/react/uiProvider.js +3 -3
  116. package/lib/components/rich-editor/ui/Popup/index.js +3 -3
  117. package/lib/components/scroll-container/index.js +27 -6
  118. package/lib/components/search-input/index.js +3 -0
  119. package/lib/components/select/Option.js +3 -3
  120. package/lib/components/superset-charts/fetch-assets-and-append/get-assets-with-cache.js +1 -1
  121. package/lib/components/superset-charts/fetch-assets-and-append/index.js +1 -1
  122. package/lib/components/survey-model/request-api.js +1 -1
  123. package/lib/components/task-relation-modal/index.js +1 -1
  124. package/lib/components/task-relation-modal/tree/category-tree/index.js +1 -1
  125. package/lib/components/task-relation-modal/tree/okr-tree/index.js +1 -1
  126. package/lib/components/task-relation-modal/tree/work-tree/index.js +1 -1
  127. package/lib/components/task-relation-modal/work-relation/index.js +1 -1
  128. package/lib/components/task-tree/task-item-node/e-project.js +1 -1
  129. package/lib/components/task-tree/task-item-node/e-task.js +1 -1
  130. package/lib/components/tita-chart/errorBoundary/index.js +3 -3
  131. package/lib/components/toast/index.js +1 -1
  132. package/lib/components/upload/index.js +261 -455
  133. package/lib/components/upload/upload.js +555 -0
  134. package/lib/components/upvote/index.js +1 -1
  135. package/lib/components/version-change-modal/index.js +1 -1
  136. package/lib/components/version-change-modal/request-api.js +1 -1
  137. package/lib/components/weekly-report/card.js +11 -1
  138. package/lib/components/weekly-report/common-painter/darwAvatar.js +1 -1
  139. package/lib/components/weekly-report/common-painter/drawName.js +1 -1
  140. package/lib/components/weekly-report/common-painter/openDataPainter.js +1 -1
  141. package/lib/components/weekly-report/index.js +1 -1
  142. package/lib/components-v1/animate/AnimateChild.js +3 -3
  143. package/lib/components-v1/avatar/index.js +3 -3
  144. package/lib/components-v1/dropDownSelector/StatelessDropdown.js +3 -3
  145. package/lib/components-v1/progress/CircleProgress.js +3 -3
  146. package/lib/components-v1/select/Option.js +3 -3
  147. package/lib/components-v1/userSelector/UserSelectorPop.js +3 -3
  148. package/lib/components-v1/userSelector/components/MultiMode/index.js +3 -3
  149. package/lib/components-v1/userSelector/components/UserItem.js +3 -3
  150. package/lib/index.js +8 -0
  151. package/lib/pages/group-management/groupInterface.js +1 -1
  152. package/lib/pages/new-okr-list/request-api.js +1 -1
  153. package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +1 -1
  154. package/lib/pages/okr-map/request-apis.js +1 -1
  155. package/lib/utils/open-data.js +1 -1
  156. package/lib/utils/request-v1.js +1 -1
  157. package/lib/utils/request.js +1 -1
  158. package/lib/utils/tools.js +11 -1
  159. package/package.json +1 -1
@@ -0,0 +1,555 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _titaUi = require("tita-ui");
13
+
14
+ var _uuid = _interopRequireDefault(require("uuid"));
15
+
16
+ var _Portals = _interopRequireDefault(require("../../components-v1/portals/Portals"));
17
+
18
+ var _requestV = require("../../utils/request-v1");
19
+
20
+ var _toast = _interopRequireDefault(require("../toast"));
21
+
22
+ var _uploadedPreview = _interopRequireDefault(require("./components/uploadedPreview"));
23
+
24
+ var _type = require("./type");
25
+
26
+ var _style = require("./style");
27
+
28
+ var _imgViewer = _interopRequireDefault(require("../img-viewer"));
29
+
30
+ var _util = require("./util");
31
+
32
+ var _getLocale = require("../../utils/getLocale");
33
+
34
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
+
36
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
+
38
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
+
40
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
41
+
42
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
43
+
44
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
45
+
46
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
47
+
48
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
49
+
50
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
51
+
52
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
53
+
54
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
55
+
56
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
57
+
58
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
59
+
60
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
61
+
62
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
63
+
64
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
65
+
66
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
67
+
68
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
69
+
70
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
71
+
72
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
73
+
74
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
75
+
76
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
77
+
78
+ var Upload = /*#__PURE__*/function (_PureComponent) {
79
+ _inherits(Upload, _PureComponent);
80
+
81
+ var _super = _createSuper(Upload);
82
+
83
+ function Upload(props) {
84
+ var _this;
85
+
86
+ _classCallCheck(this, Upload);
87
+
88
+ _this = _super.call(this, props);
89
+
90
+ _this.onFileInputChange = function (e) {
91
+ var onChange = _this.props.onChange;
92
+ var fileInput = _this.refs.fileInput;
93
+ if (onChange) onChange(e); // @ts-ignore
94
+
95
+ var selectFiles = fileInput.files; // 选择的文件
96
+ // @ts-ignore
97
+
98
+ if (!fileInput.value) return; // 未选择文件或选择文件超出个数限制时
99
+
100
+ _this.dealSelectFiles(Array.from(selectFiles));
101
+
102
+ if (fileInput) {
103
+ // @ts-ignore
104
+ fileInput.value = '';
105
+ }
106
+ };
107
+
108
+ _this.dealSelectFiles = function (uploadSelectFilesObj) {
109
+ var _this$state = _this.state,
110
+ uploadSuccessFiles = _this$state.uploadSuccessFiles,
111
+ selectFiles = _this$state.selectFiles;
112
+ var _this$props = _this.props,
113
+ action = _this$props.action,
114
+ fileNumLimit = _this$props.fileNumLimit,
115
+ fileSizeLimit = _this$props.fileSizeLimit,
116
+ filesTotal = _this$props.filesTotal;
117
+ var uploadSelectFilesLen = uploadSelectFilesObj.length; // 选中上传的文件数量
118
+
119
+ var uploadSuccessFilesLen = uploadSuccessFiles.length; // 已上传成功的文件数量
120
+
121
+ var allFilesTotal = uploadSuccessFilesLen + uploadSelectFilesLen; // 把文件字节流保存,用来文件重传用
122
+
123
+ uploadSelectFilesObj.forEach(function (ele) {
124
+ if (!selectFiles[ele.name]) {
125
+ selectFiles[ele.name] = ele;
126
+ }
127
+ });
128
+
129
+ _this.setState({
130
+ selectFiles: selectFiles
131
+ });
132
+
133
+ if (filesTotal && allFilesTotal > filesTotal) {
134
+ _toast["default"].Error("\u6700\u591A\u53EF\u4E0A\u4F20 ".concat(filesTotal, " \u4E2A\u6587\u4EF6"), {
135
+ canClose: false
136
+ });
137
+
138
+ uploadSelectFilesObj = uploadSelectFilesObj.slice(0, filesTotal - uploadSuccessFilesLen);
139
+ }
140
+
141
+ if (fileNumLimit && uploadSelectFilesObj.length > fileNumLimit) {
142
+ _toast["default"].Error("\u5355\u6B21\u6700\u591A\u53EF\u4E0A\u4F20 ".concat(fileNumLimit, " \u4E2A\u6587\u4EF6"), {
143
+ canClose: false
144
+ });
145
+
146
+ uploadSelectFilesObj = uploadSelectFilesObj.slice(0, fileNumLimit);
147
+ }
148
+
149
+ if (!uploadSelectFilesObj.length) return;
150
+ var uploadSelectFilesSize = uploadSelectFilesObj.map(function (item) {
151
+ return item.size;
152
+ }).reduce(function (total, num) {
153
+ return total + num;
154
+ }); // 上传文件的大小
155
+
156
+ if (uploadSelectFilesSize > fileNumLimit * fileSizeLimit * 1024 * 1024) return _toast["default"].Error("\u5355\u6B21\u6700\u591A\u53EF\u4E0A\u4F20 ".concat(fileNumLimit, " \u4E2A\u6587\u4EF6\uFF0C\u6BCF\u4E2A\u4E0D\u8D85\u8FC7 ").concat(fileSizeLimit, "M")); // 文件大小超出限制
157
+
158
+ var uploadStartFiles = []; // 开始上传的文件
159
+
160
+ uploadSelectFilesObj.forEach(function (element, index) {
161
+ var formData = new FormData(); // FormData 对象
162
+
163
+ var uploadStartFile = null;
164
+ var timestamp = new Date().getTime(); // 给每个文件加一个时间戳
165
+
166
+ var uploadFileType = element.name.substring(element.name.lastIndexOf('.') + 1);
167
+ uploadStartFile = {
168
+ FileName: element.name,
169
+ FileType: (0, _type._dealAttachmentType)(uploadFileType).FileType,
170
+ FileSize: element.size,
171
+ FileLastModified: element.lastModified,
172
+ IsImage: (0, _type._dealAttachmentType)(uploadFileType).IsImage,
173
+ percentComplete: 0,
174
+ uploadStatus: 1,
175
+ // 开始上传
176
+ IsSuccess: false,
177
+ uid: (0, _uuid["default"])(),
178
+ _smallImageUrl: '',
179
+ _bigImageUrl: '',
180
+ MediaType: '',
181
+ UserId: 0,
182
+ MaxDocCount: 0,
183
+ DfsPath: '',
184
+ ClientUrl: '',
185
+ SmallImageUrl: '',
186
+ BigImageUrl: '',
187
+ DownloadUrl: '',
188
+ Msg: '',
189
+ AllowUploadAttachmentSize: 50,
190
+ Deleteable: true,
191
+ requestXHR: new XMLHttpRequest() // 在这创建是为了取消用
192
+
193
+ };
194
+ var sameFile = uploadSuccessFiles.find(function (file) {
195
+ return _this.isSameFile(file, uploadStartFile) && file.uploadStatus !== 4;
196
+ });
197
+
198
+ if (sameFile) {
199
+ return;
200
+ }
201
+
202
+ uploadStartFiles.push(uploadStartFile);
203
+
204
+ _this._dealUploadStart(uploadStartFiles); // 处理开始上传的文件
205
+
206
+
207
+ formData.append('file', element);
208
+ var url = action || (0, _requestV.getApiUrl)("Upload/PostFiles?format=json&timestamp=".concat(timestamp));
209
+
210
+ _this._dealUploadXHRRequest(formData, url, uploadStartFile);
211
+ });
212
+ };
213
+
214
+ _this._dealUploadXHRRequest = function (formData, url, uploadStartFile) {
215
+ if (uploadStartFile.FileSize > _this.props.fileSizeLimit * 1024 * 1024) {
216
+ setTimeout(function () {
217
+ _this._dealUploadSuccess(_objectSpread(_objectSpread({}, uploadStartFile), {
218
+ Msg: '上传失败,文件过大',
219
+ IsImage: false,
220
+ uploadStatus: 5
221
+ }));
222
+ }, 300);
223
+ return;
224
+ }
225
+
226
+ var xhr = uploadStartFile.requestXHR; // xhr.onreadystatechange = () => {
227
+ // if (xhr.readyState == 4 && xhr.status == 200) {
228
+ // const result = { ...JSON.parse(xhr.responseText).Result[0] }; // 上传成功接口返回数据
229
+ // result.percentComplete = 100;
230
+ // result.IsSuccess = !!result.IsSuccess;
231
+ // result.uploadStatus = result.IsSuccess ? 3 : 4; // 3上传成功;4上传失败
232
+ // this._dealUploadSuccess({ ...uploadStartFile, ...result });
233
+ // }
234
+ // };
235
+ // // 进度条部分
236
+ // xhr.upload.onprogress = (evt) => {
237
+ // const uploadSuccessFiles = [...this.state.uploadSuccessFiles];
238
+ // if (evt.lengthComputable) {
239
+ // uploadSuccessFiles.forEach((item: UploadResultObj) => {
240
+ // if (this.isSameFile(item, uploadStartFile)) {
241
+ // item.uploadStatus = 2; // 上传中
242
+ // item.percentComplete = Math.round((evt.loaded * 100) / evt.total);
243
+ // }
244
+ // });
245
+ // this.setState({ uploadSuccessFiles });
246
+ // }
247
+ // };
248
+
249
+ xhr.onreadystatechange = function () {
250
+ if (xhr.readyState == 4 && xhr.status == 200) {
251
+ var result = Object.assign({}, _objectSpread({}, JSON.parse(xhr.responseText).Result[0])); // 上传成功接口返回数据
252
+
253
+ result.percentComplete = 100;
254
+ result.IsSuccess = !!result.IsSuccess;
255
+ result.uploadStatus = result.IsSuccess ? 3 : 4; // 3上传成功;4上传失败
256
+
257
+ _this._dealUploadSuccess(_objectSpread(_objectSpread({}, uploadStartFile), result));
258
+ }
259
+ }; //进度条部分
260
+
261
+
262
+ xhr.upload.onprogress = function (evt) {
263
+ var uploadSuccessFiles = JSON.parse(JSON.stringify(_this.state.uploadSuccessFiles));
264
+
265
+ if (evt.lengthComputable) {
266
+ uploadSuccessFiles.forEach(function (item) {
267
+ if (_this.isSameFile(item, uploadStartFile)) {
268
+ item.uploadStatus = 2; // 上传中
269
+
270
+ item.percentComplete = Math.round(evt.loaded * 100 / evt.total);
271
+ }
272
+ });
273
+
274
+ _this.setState({
275
+ uploadSuccessFiles: uploadSuccessFiles
276
+ });
277
+ }
278
+ };
279
+
280
+ xhr.upload.onerror = function (evt) {
281
+ var uploadSuccessFiles = _toConsumableArray(_this.state.uploadSuccessFiles);
282
+
283
+ uploadSuccessFiles.forEach(function (item) {
284
+ if (_this.isSameFile(item, uploadStartFile)) {
285
+ item.uploadStatus = 4; // 上传失败
286
+
287
+ item.percentComplete = Math.round(evt.loaded * 100 / evt.total);
288
+ item.Msg = '网络异常,请重新上传';
289
+ }
290
+ });
291
+
292
+ _this.setState({
293
+ uploadSuccessFiles: uploadSuccessFiles
294
+ });
295
+ };
296
+
297
+ xhr.open('POST', url, true);
298
+ xhr.send(formData); // 开始上传,发送form数据
299
+ };
300
+
301
+ _this._dealUploadStart = function (uploadStartFiles) {
302
+ var uploadSuccessFiles = [];
303
+
304
+ var uploadedFiles = _toConsumableArray(_this.state.uploadSuccessFiles); // 处理重传文件,直接展开会导致同样的文件展示两个
305
+
306
+
307
+ var uploadFilesConcatArr = uploadedFiles;
308
+ var isReloadFile = uploadFilesConcatArr.filter(function (item) {
309
+ return _this.isSameFile(item, uploadStartFiles[0]);
310
+ });
311
+
312
+ if (!isReloadFile || isReloadFile.length === 0) {
313
+ uploadFilesConcatArr = [].concat(_toConsumableArray(uploadedFiles), _toConsumableArray(uploadStartFiles));
314
+ }
315
+
316
+ uploadFilesConcatArr.forEach(function (item) {
317
+ var res = uploadSuccessFiles.filter(function (v) {
318
+ return _this.isSameFile(item, v);
319
+ });
320
+ uploadSuccessFiles.forEach(function (element) {
321
+ if (_this.isSameFile(item, element)) {
322
+ element = item;
323
+ }
324
+ });
325
+
326
+ if (res.length === 0) {
327
+ uploadSuccessFiles.push(item);
328
+ }
329
+ });
330
+
331
+ _this.setState({
332
+ uploadSuccessFiles: uploadSuccessFiles
333
+ });
334
+ };
335
+
336
+ _this._dealUploadSuccess = function (uploadSuccessFile) {
337
+ var _this$props2 = _this.props,
338
+ onSubmit = _this$props2.onSubmit,
339
+ onUploadSuccess = _this$props2.onUploadSuccess;
340
+
341
+ var uploadSuccessFiles = _toConsumableArray(_this.state.uploadSuccessFiles);
342
+
343
+ var uploadSuccessFilesFormat = uploadSuccessFiles.map(function (element) {
344
+ return _this.isSameFile(uploadSuccessFile, element) ? uploadSuccessFile : element;
345
+ });
346
+ var uploadSuccessFilesPath = uploadSuccessFilesFormat.map(function (item) {
347
+ return item.DfsPath;
348
+ }); // 获取文件上传后返回的路径
349
+
350
+ onSubmit(uploadSuccessFilesPath); // 将上传完成的文件路径传递给父组件
351
+
352
+ if (onUploadSuccess) onUploadSuccess(uploadSuccessFilesFormat);
353
+
354
+ _this.setState({
355
+ uploadSuccessFiles: uploadSuccessFilesFormat,
356
+ attachmentPreviewUrl: (0, _util.getPreviewImgs)(uploadSuccessFilesFormat)
357
+ });
358
+ };
359
+
360
+ _this.isImg = function (fileType) {
361
+ if (/^(jpg|png|gif|jpeg|image|JPG|PNG|GIF|JPEG)$/.test(fileType)) {
362
+ return true;
363
+ }
364
+
365
+ return false;
366
+ };
367
+
368
+ _this.getImgIndex = function (index) {
369
+ var newIndex = 0;
370
+ var uploadSuccessFiles = _this.state.uploadSuccessFiles;
371
+
372
+ for (var i = 0; i < index; i++) {
373
+ if (_this.isImg(uploadSuccessFiles[i].FileType)) {
374
+ newIndex++;
375
+ }
376
+ }
377
+
378
+ return newIndex;
379
+ };
380
+
381
+ _this.handlerUploadPreviewOptions = function (index, options) {
382
+ var _this$props3 = _this.props,
383
+ onSubmit = _this$props3.onSubmit,
384
+ onDelete = _this$props3.onDelete;
385
+
386
+ if (options === 'cancel') {
387
+ var reUploadFileInfo = _this.state.uploadSuccessFiles[index];
388
+ reUploadFileInfo.requestXHR.abort();
389
+ }
390
+
391
+ if (options === 'delete' || options === 'cancel') {
392
+ var uploadResultFiles = _toConsumableArray(_this.state.uploadSuccessFiles);
393
+
394
+ var deleteFiles = uploadResultFiles[index];
395
+ onDelete && onDelete(deleteFiles.documentId ? deleteFiles.documentId : deleteFiles.DfsPath);
396
+ uploadResultFiles.splice(index, 1);
397
+
398
+ var _uploadSuccessFilesPath = uploadResultFiles.map(function (item) {
399
+ return item.DfsPath;
400
+ });
401
+
402
+ onSubmit(_uploadSuccessFilesPath, options);
403
+
404
+ _this.setState({
405
+ uploadSuccessFiles: uploadResultFiles
406
+ });
407
+ } else if (options === 'preview') {
408
+ var imgIndex = _this.getImgIndex(index);
409
+
410
+ _this.refs.imgViewerRef.show(imgIndex);
411
+ } else if (options === 'reupload') {
412
+ var _reUploadFileInfo = _this.state.uploadSuccessFiles[index];
413
+ var reUploadFile = _this.state.selectFiles[_reUploadFileInfo.FileName];
414
+
415
+ _this.dealSelectFiles([reUploadFile]);
416
+ }
417
+ };
418
+
419
+ _this.isSameFile = function (item, element) {
420
+ return item.FileName === element.FileName && item.FileSize === element.FileSize && item.FileLastModified === element.FileLastModified;
421
+ };
422
+
423
+ _this.renderUploadList = function (list) {
424
+ var _this$props4 = _this.props,
425
+ attachmentPreviewBox = _this$props4.attachmentPreviewBox,
426
+ _this$props4$showFile = _this$props4.showFileList,
427
+ showFileList = _this$props4$showFile === void 0 ? true : _this$props4$showFile;
428
+ var attachmentPreviewUrl = _this.state.attachmentPreviewUrl;
429
+ if (!list.length || !showFileList) return;
430
+ return /*#__PURE__*/_react["default"].createElement(_Portals["default"], {
431
+ domNode: attachmentPreviewBox,
432
+ className: "uploadFile__preview__list"
433
+ }, /*#__PURE__*/_react["default"].createElement(_imgViewer["default"], {
434
+ data: attachmentPreviewUrl,
435
+ ref: "imgViewerRef",
436
+ showDownload: false
437
+ }), list.map(function (item, index) {
438
+ return /*#__PURE__*/_react["default"].createElement(_uploadedPreview["default"], {
439
+ uploadResultItem: item,
440
+ index: index,
441
+ key: item.uid,
442
+ className: "uploaded__preview",
443
+ onSubmit: function onSubmit(index, options) {
444
+ _this.handlerUploadPreviewOptions(index, options);
445
+ }
446
+ });
447
+ }));
448
+ };
449
+
450
+ _this.handleButtonClick = function (e) {
451
+ e.nativeEvent.stopImmediatePropagation();
452
+
453
+ if (_this.refs.fileInput) {
454
+ // @ts-ignore
455
+ _this.refs.fileInput.click();
456
+ }
457
+ };
458
+
459
+ _this.state = {
460
+ uploadSuccessFiles: props.attachments || [],
461
+ attachmentPreviewUrl: props.attachments ? (0, _util.getPreviewImgs)(props.attachments) : [],
462
+ selectFiles: {}
463
+ };
464
+ return _this;
465
+ }
466
+
467
+ _createClass(Upload, [{
468
+ key: "componentDidMount",
469
+ value: function componentDidMount() {
470
+ var attachments = this.props.attachments;
471
+ this.setState({
472
+ uploadSuccessFiles: attachments || [],
473
+ attachmentPreviewUrl: attachments ? (0, _util.getPreviewImgs)(attachments) : []
474
+ });
475
+ }
476
+ }, {
477
+ key: "componentWillReceiveProps",
478
+ value: function componentWillReceiveProps(nextProps) {
479
+ if (this.props.submitStatus === 2 && nextProps.submitStatus == 1) {
480
+ this.setState({
481
+ uploadSuccessFiles: [],
482
+ attachmentPreviewUrl: []
483
+ });
484
+ } else {
485
+ this.setState({
486
+ // uploadSuccessFiles: nextProps.attachments || [],
487
+ attachmentPreviewUrl: nextProps.attachments ? (0, _util.getPreviewImgs)(nextProps.attachments) : []
488
+ });
489
+ }
490
+
491
+ if (nextProps.dragFilesList && nextProps.dragFilesList.length) {
492
+ this.dealSelectFiles(nextProps.dragFilesList);
493
+ }
494
+ }
495
+ }, {
496
+ key: "render",
497
+ value: function render() {
498
+ var _this2 = this;
499
+
500
+ var _this$props5 = this.props,
501
+ children = _this$props5.children,
502
+ className = _this$props5.className,
503
+ style = _this$props5.style,
504
+ _this$props5$attachme = _this$props5.attachmentTipText,
505
+ attachmentTipText = _this$props5$attachme === void 0 ? (0, _getLocale.getLocale)('OKR_MyO_KRP_Draganddropu') : _this$props5$attachme,
506
+ _this$props5$disableT = _this$props5.disableTooltip,
507
+ disableTooltip = _this$props5$disableT === void 0 ? false : _this$props5$disableT;
508
+ var uploadSuccessFiles = this.state.uploadSuccessFiles;
509
+
510
+ var uploadFormContainer = /*#__PURE__*/_react["default"].createElement(_style.UploadFormContainer, {
511
+ className: className,
512
+ style: style,
513
+ onMouseUp: function onMouseUp(e) {
514
+ return _this2.handleButtonClick(e);
515
+ }
516
+ }, /*#__PURE__*/_react["default"].createElement("div", {
517
+ ref: "uploader-trigger",
518
+ style: {
519
+ cursor: 'pointer'
520
+ }
521
+ }, children), /*#__PURE__*/_react["default"].createElement("input", {
522
+ type: "file",
523
+ ref: "fileInput",
524
+ className: "upload_file_input",
525
+ multiple: this.props.multiple,
526
+ style: {
527
+ display: 'none'
528
+ },
529
+ onChange: this.onFileInputChange
530
+ }));
531
+
532
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, disableTooltip ? uploadFormContainer : /*#__PURE__*/_react["default"].createElement(_titaUi.Tooltip, {
533
+ container: document.body,
534
+ content: /*#__PURE__*/_react["default"].createElement("p", {
535
+ dangerouslySetInnerHTML: {
536
+ __html: attachmentTipText
537
+ }
538
+ })
539
+ }, uploadFormContainer), this.renderUploadList(uploadSuccessFiles));
540
+ }
541
+ }]);
542
+
543
+ return Upload;
544
+ }(_react.PureComponent);
545
+
546
+ Upload.Preview = _uploadedPreview["default"];
547
+ Upload.defaultProps = {
548
+ fileNumLimit: 20,
549
+ fileSizeLimit: 50,
550
+ filesTotal: 50,
551
+ multiple: true,
552
+ attachmentPreviewBox: 'MBlog__attachmentViewBox'
553
+ };
554
+ var _default = Upload;
555
+ exports["default"] = _default;
@@ -42,7 +42,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
42
42
 
43
43
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
44
44
 
45
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
45
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
46
46
 
47
47
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
48
48