@lemon-fe/kits 0.1.119 → 0.1.122
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.
- package/es/subject.js +0 -1
- package/es/useBatchOperator/index.js +26 -75
- package/package.json +4 -4
package/es/subject.js
CHANGED
|
@@ -1,27 +1,17 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
1
3
|
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); } }
|
|
2
|
-
|
|
3
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
-
|
|
5
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
-
|
|
7
6
|
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."); }
|
|
8
|
-
|
|
9
7
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
-
|
|
11
8
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
-
|
|
13
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
|
|
15
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
|
|
17
11
|
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); }
|
|
18
|
-
|
|
19
12
|
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; }
|
|
20
|
-
|
|
21
13
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
22
|
-
|
|
23
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
|
|
25
15
|
import React, { useMemo, useState, useRef, useEffect } from 'react';
|
|
26
16
|
import { Modal, Row, Spin } from 'antd';
|
|
27
17
|
import { PlayCircleOutlined, DeleteTwoTone, PauseCircleOutlined, ReloadOutlined } from '@ant-design/icons';
|
|
@@ -31,37 +21,31 @@ import { useThrottle } from '@lemon-fe/hooks';
|
|
|
31
21
|
var loading = Symbol('loading');
|
|
32
22
|
export default function useBatchOperate(options) {
|
|
33
23
|
var _options$modalTitle = options.modalTitle,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
modalTitle = _options$modalTitle === void 0 ? '批量操作' : _options$modalTitle,
|
|
25
|
+
handler = options.handler,
|
|
26
|
+
columns = options.columns,
|
|
27
|
+
onClose = options.onClose,
|
|
28
|
+
rowKey = options.rowKey;
|
|
40
29
|
var _useState = useState(false),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
visible = _useState2[0],
|
|
32
|
+
setVisible = _useState2[1];
|
|
45
33
|
var _useState3 = useState([]),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
data = _useState4[0],
|
|
36
|
+
setData = _useState4[1];
|
|
50
37
|
var _useState5 = useState(new Map()),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
results = _useState6[0],
|
|
40
|
+
setResults = _useState6[1];
|
|
55
41
|
var _useState7 = useState(-1),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
43
|
+
active = _useState8[0],
|
|
44
|
+
setActive = _useState8[1];
|
|
60
45
|
var _useState9 = useState(true),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
47
|
+
paused = _useState10[0],
|
|
48
|
+
setPaused = _useState10[1];
|
|
65
49
|
var mounted = useRef(false);
|
|
66
50
|
var pausedRef = useRef(paused);
|
|
67
51
|
pausedRef.current = paused;
|
|
@@ -71,19 +55,15 @@ export default function useBatchOperate(options) {
|
|
|
71
55
|
mounted.current = false;
|
|
72
56
|
};
|
|
73
57
|
}, [visible]);
|
|
74
|
-
|
|
75
58
|
var getRowKey = function getRowKey(record, index) {
|
|
76
59
|
if (typeof rowKey === 'function') {
|
|
77
60
|
return rowKey(record, index);
|
|
78
61
|
}
|
|
79
|
-
|
|
80
62
|
if (rowKey !== undefined) {
|
|
81
63
|
return get(record, rowKey);
|
|
82
64
|
}
|
|
83
|
-
|
|
84
65
|
return get(record, 'key');
|
|
85
66
|
};
|
|
86
|
-
|
|
87
67
|
var mCols = useMemo(function () {
|
|
88
68
|
var cols = columns ? _toConsumableArray(columns) : [{
|
|
89
69
|
title: '编号',
|
|
@@ -104,12 +84,10 @@ export default function useBatchOperate(options) {
|
|
|
104
84
|
if (!paused) {
|
|
105
85
|
return;
|
|
106
86
|
}
|
|
107
|
-
|
|
108
87
|
setActive(function (prev) {
|
|
109
88
|
if (prev >= index) {
|
|
110
89
|
return prev - 1;
|
|
111
90
|
}
|
|
112
|
-
|
|
113
91
|
return prev;
|
|
114
92
|
});
|
|
115
93
|
setResults(function (prev) {
|
|
@@ -118,12 +96,10 @@ export default function useBatchOperate(options) {
|
|
|
118
96
|
next.delete(key);
|
|
119
97
|
return next;
|
|
120
98
|
}
|
|
121
|
-
|
|
122
99
|
return prev;
|
|
123
100
|
});
|
|
124
101
|
setData(function (prev) {
|
|
125
102
|
var next = _toConsumableArray(prev);
|
|
126
|
-
|
|
127
103
|
next.splice(index, 1);
|
|
128
104
|
return next;
|
|
129
105
|
});
|
|
@@ -138,7 +114,6 @@ export default function useBatchOperate(options) {
|
|
|
138
114
|
render: function render(_, record, index) {
|
|
139
115
|
var key = getRowKey(record, index);
|
|
140
116
|
var result = results.get(key);
|
|
141
|
-
|
|
142
117
|
if (active === index && !paused || result === loading) {
|
|
143
118
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Spin, {
|
|
144
119
|
size: "small",
|
|
@@ -147,13 +122,11 @@ export default function useBatchOperate(options) {
|
|
|
147
122
|
}
|
|
148
123
|
}), /*#__PURE__*/React.createElement("span", null, " \u8FDB\u884C\u4E2D"));
|
|
149
124
|
}
|
|
150
|
-
|
|
151
125
|
if (!results.has(key)) {
|
|
152
126
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Icons.Tip, {
|
|
153
127
|
type: "warning"
|
|
154
128
|
}), /*#__PURE__*/React.createElement("span", null, " \u5F85\u5904\u7406"));
|
|
155
129
|
}
|
|
156
|
-
|
|
157
130
|
if (result instanceof Error) {
|
|
158
131
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Icons.Tip, {
|
|
159
132
|
type: "error"
|
|
@@ -163,7 +136,6 @@ export default function useBatchOperate(options) {
|
|
|
163
136
|
}
|
|
164
137
|
}));
|
|
165
138
|
}
|
|
166
|
-
|
|
167
139
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Icons.Tip, {
|
|
168
140
|
type: "success"
|
|
169
141
|
}), /*#__PURE__*/React.createElement("span", null, " ", result || '操作成功'));
|
|
@@ -171,7 +143,6 @@ export default function useBatchOperate(options) {
|
|
|
171
143
|
});
|
|
172
144
|
return cols;
|
|
173
145
|
}, [columns, paused, active, results]);
|
|
174
|
-
|
|
175
146
|
var changeResult = function changeResult(key, val) {
|
|
176
147
|
if (mounted.current) {
|
|
177
148
|
setResults(function (prev) {
|
|
@@ -181,11 +152,10 @@ export default function useBatchOperate(options) {
|
|
|
181
152
|
});
|
|
182
153
|
}
|
|
183
154
|
};
|
|
184
|
-
|
|
185
155
|
var reload = useThrottle( /*#__PURE__*/function () {
|
|
186
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
156
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item, index) {
|
|
187
157
|
var key, res;
|
|
188
|
-
return
|
|
158
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
189
159
|
while (1) {
|
|
190
160
|
switch (_context.prev = _context.next) {
|
|
191
161
|
case 0:
|
|
@@ -194,18 +164,15 @@ export default function useBatchOperate(options) {
|
|
|
194
164
|
changeResult(key, loading);
|
|
195
165
|
_context.next = 5;
|
|
196
166
|
return handler(item);
|
|
197
|
-
|
|
198
167
|
case 5:
|
|
199
168
|
res = _context.sent;
|
|
200
169
|
changeResult(key, res);
|
|
201
170
|
_context.next = 12;
|
|
202
171
|
break;
|
|
203
|
-
|
|
204
172
|
case 9:
|
|
205
173
|
_context.prev = 9;
|
|
206
174
|
_context.t0 = _context["catch"](1);
|
|
207
175
|
changeResult(key, _context.t0);
|
|
208
|
-
|
|
209
176
|
case 12:
|
|
210
177
|
case "end":
|
|
211
178
|
return _context.stop();
|
|
@@ -213,71 +180,59 @@ export default function useBatchOperate(options) {
|
|
|
213
180
|
}
|
|
214
181
|
}, _callee, null, [[1, 9]]);
|
|
215
182
|
}));
|
|
216
|
-
|
|
217
183
|
return function (_x, _x2) {
|
|
218
184
|
return _ref.apply(this, arguments);
|
|
219
185
|
};
|
|
220
186
|
}(), 500);
|
|
221
|
-
var start = useThrottle( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
187
|
+
var start = useThrottle( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
222
188
|
var i, item, key, res;
|
|
223
|
-
return
|
|
189
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
224
190
|
while (1) {
|
|
225
191
|
switch (_context2.prev = _context2.next) {
|
|
226
192
|
case 0:
|
|
227
193
|
setPaused(false);
|
|
228
194
|
i = active + 1;
|
|
229
|
-
|
|
230
195
|
case 2:
|
|
231
196
|
if (!(i < data.length)) {
|
|
232
197
|
_context2.next = 23;
|
|
233
198
|
break;
|
|
234
199
|
}
|
|
235
|
-
|
|
236
200
|
setActive(i);
|
|
237
201
|
item = data[i];
|
|
238
202
|
key = getRowKey(item, i);
|
|
239
203
|
_context2.prev = 6;
|
|
240
204
|
_context2.next = 9;
|
|
241
205
|
return handler(item);
|
|
242
|
-
|
|
243
206
|
case 9:
|
|
244
207
|
res = _context2.sent;
|
|
245
208
|
changeResult(key, res);
|
|
246
209
|
_context2.next = 16;
|
|
247
210
|
break;
|
|
248
|
-
|
|
249
211
|
case 13:
|
|
250
212
|
_context2.prev = 13;
|
|
251
213
|
_context2.t0 = _context2["catch"](6);
|
|
252
214
|
changeResult(key, _context2.t0);
|
|
253
|
-
|
|
254
215
|
case 16:
|
|
255
216
|
if (!pausedRef.current) {
|
|
256
217
|
_context2.next = 18;
|
|
257
218
|
break;
|
|
258
219
|
}
|
|
259
|
-
|
|
260
220
|
return _context2.abrupt("return");
|
|
261
|
-
|
|
262
221
|
case 18:
|
|
263
222
|
if (mounted.current) {
|
|
264
223
|
_context2.next = 20;
|
|
265
224
|
break;
|
|
266
225
|
}
|
|
267
|
-
|
|
268
226
|
return _context2.abrupt("break", 23);
|
|
269
|
-
|
|
270
227
|
case 20:
|
|
271
228
|
i += 1;
|
|
272
229
|
_context2.next = 2;
|
|
273
230
|
break;
|
|
274
|
-
|
|
275
231
|
case 23:
|
|
276
232
|
if (mounted.current) {
|
|
277
233
|
setActive(-1);
|
|
278
234
|
setPaused(true);
|
|
279
235
|
}
|
|
280
|
-
|
|
281
236
|
case 24:
|
|
282
237
|
case "end":
|
|
283
238
|
return _context2.stop();
|
|
@@ -285,20 +240,16 @@ export default function useBatchOperate(options) {
|
|
|
285
240
|
}
|
|
286
241
|
}, _callee2, null, [[6, 13]]);
|
|
287
242
|
})), 500);
|
|
288
|
-
|
|
289
243
|
var run = function run(data) {
|
|
290
244
|
setVisible(true);
|
|
291
245
|
setData(data);
|
|
292
246
|
};
|
|
293
|
-
|
|
294
247
|
var handleClose = function handleClose() {
|
|
295
248
|
setVisible(false);
|
|
296
|
-
|
|
297
249
|
if (onClose) {
|
|
298
250
|
onClose(results);
|
|
299
251
|
}
|
|
300
252
|
};
|
|
301
|
-
|
|
302
253
|
var node = /*#__PURE__*/React.createElement(Modal, {
|
|
303
254
|
title: modalTitle,
|
|
304
255
|
visible: visible,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/kits",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.122",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "鲁盛杰 <lusj@cnlemon.net>",
|
|
6
6
|
"homepage": "",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"url": "git@gitlab.nhsoft.cn:lemon-fe/kits-next.git"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lemon-fe/components": "^0.1.
|
|
27
|
+
"@lemon-fe/components": "^0.1.122",
|
|
28
28
|
"@lemon-fe/hooks": "^0.1.86",
|
|
29
|
-
"@lemon-fe/layouts": "^0.1.
|
|
29
|
+
"@lemon-fe/layouts": "^0.1.122",
|
|
30
30
|
"antd": "^4.21.6"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "c06d24110423eabd6a1c08e69b5bebcb339e709c"
|
|
36
36
|
}
|