@lemon-fe/kits 1.4.23 → 1.4.24
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.
|
@@ -8,8 +8,6 @@ declare type ProcessStepParams<T> = {
|
|
|
8
8
|
* 上一步的额外信息,如果上一步执行成功,则没有该数据
|
|
9
9
|
*/
|
|
10
10
|
payload?: any;
|
|
11
|
-
/** 这一步的操作是否允许自动执行 */
|
|
12
|
-
skipWarning?: boolean;
|
|
13
11
|
};
|
|
14
12
|
declare type ProcessStep<T, R> = {
|
|
15
13
|
/** 在不传入render warning会自动进行二次确认 */
|
|
@@ -41,14 +39,6 @@ interface Props<RecordType extends Record<string, any> = Record<string, any>, Re
|
|
|
41
39
|
*/
|
|
42
40
|
footer?: ReactNode | ((record: RecordType[], others: {
|
|
43
41
|
results: Map<Key, Result<ResultType>>;
|
|
44
|
-
isExecuting?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* 全部执行逻辑
|
|
47
|
-
* 主要功能以handle里中的skipWarning实现
|
|
48
|
-
* 使用时,注意配置process中的skipWarning
|
|
49
|
-
* 中间不配置skipWarning的步骤会停下来
|
|
50
|
-
**/
|
|
51
|
-
executeUntilBlocked: () => void;
|
|
52
42
|
}) => ReactNode);
|
|
53
43
|
/**
|
|
54
44
|
* @description 关闭时触发
|
|
@@ -91,16 +91,6 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
91
91
|
var result = typeof rowKey === 'function' ? rowKey(record) : get(record, rowKey);
|
|
92
92
|
return String(result !== null && result !== void 0 ? result : '').toString();
|
|
93
93
|
});
|
|
94
|
-
_defineProperty(_assertThisInitialized(_this), "executeUntilBlocked", function () {
|
|
95
|
-
var results = _this.state.results;
|
|
96
|
-
var params = _this.props.params;
|
|
97
|
-
results.forEach(function (result, id) {
|
|
98
|
-
if (!result.loading && result.error && result.stepIdx !== undefined) {
|
|
99
|
-
var stepIdx = result.stepIdx;
|
|
100
|
-
_this.processNode(id, stepIdx + 1, params, undefined, true);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
94
|
_defineProperty(_assertThisInitialized(_this), "handleClose", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
105
95
|
var _this$props, onBeforeClose, onClose, data, results, value;
|
|
106
96
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -224,56 +214,40 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
224
214
|
value: function () {
|
|
225
215
|
var _processNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id, stepIdx, payload, next) {
|
|
226
216
|
var _this2 = this;
|
|
227
|
-
var
|
|
228
|
-
process,
|
|
229
|
-
_this$locale,
|
|
230
|
-
continueText,
|
|
231
|
-
oprationSuccessText,
|
|
232
|
-
grid,
|
|
233
|
-
node,
|
|
234
|
-
data,
|
|
235
|
-
_process$stepIdx,
|
|
236
|
-
handler,
|
|
237
|
-
renderResult,
|
|
238
|
-
mode,
|
|
239
|
-
isFinal,
|
|
240
|
-
done,
|
|
241
|
-
_result,
|
|
242
|
-
_args2 = arguments;
|
|
217
|
+
var process, _this$locale, continueText, oprationSuccessText, grid, node, data, _process$stepIdx, handler, renderResult, mode, isFinal, done, _result;
|
|
243
218
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
244
219
|
while (1) switch (_context2.prev = _context2.next) {
|
|
245
220
|
case 0:
|
|
246
|
-
skipWarning = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : false;
|
|
247
221
|
process = this.state.process;
|
|
248
222
|
_this$locale = this.locale, continueText = _this$locale.continueText, oprationSuccessText = _this$locale.oprationSuccessText;
|
|
249
223
|
if (!(stepIdx >= process.length)) {
|
|
250
|
-
_context2.next =
|
|
224
|
+
_context2.next = 5;
|
|
251
225
|
break;
|
|
252
226
|
}
|
|
253
227
|
next === null || next === void 0 || next();
|
|
254
228
|
return _context2.abrupt("return");
|
|
255
|
-
case
|
|
229
|
+
case 5:
|
|
256
230
|
grid = this.grid.current;
|
|
257
231
|
if (!(!grid || !grid.ready())) {
|
|
258
|
-
_context2.next =
|
|
232
|
+
_context2.next = 8;
|
|
259
233
|
break;
|
|
260
234
|
}
|
|
261
235
|
return _context2.abrupt("return");
|
|
262
|
-
case
|
|
236
|
+
case 8:
|
|
263
237
|
node = grid.api.getRowNode(id);
|
|
264
238
|
if (node) {
|
|
265
|
-
_context2.next =
|
|
239
|
+
_context2.next = 11;
|
|
266
240
|
break;
|
|
267
241
|
}
|
|
268
242
|
return _context2.abrupt("return");
|
|
269
|
-
case
|
|
243
|
+
case 11:
|
|
270
244
|
data = node.data;
|
|
271
245
|
if (data) {
|
|
272
|
-
_context2.next =
|
|
246
|
+
_context2.next = 14;
|
|
273
247
|
break;
|
|
274
248
|
}
|
|
275
249
|
return _context2.abrupt("return");
|
|
276
|
-
case
|
|
250
|
+
case 14:
|
|
277
251
|
_process$stepIdx = process[stepIdx], handler = _process$stepIdx.handler, renderResult = _process$stepIdx.render, mode = _process$stepIdx.mode;
|
|
278
252
|
isFinal = stepIdx === process.length - 1;
|
|
279
253
|
done = function done(result, error) {
|
|
@@ -284,7 +258,6 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
284
258
|
result: result,
|
|
285
259
|
error: error,
|
|
286
260
|
payload: payload,
|
|
287
|
-
stepIdx: stepIdx,
|
|
288
261
|
render: function render() {
|
|
289
262
|
if (error) {
|
|
290
263
|
if (mode === 'warning') {
|
|
@@ -349,7 +322,6 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
349
322
|
result: result,
|
|
350
323
|
error: error,
|
|
351
324
|
payload: payload,
|
|
352
|
-
stepIdx: stepIdx,
|
|
353
325
|
render: function render() {
|
|
354
326
|
return renderResult({
|
|
355
327
|
data: data,
|
|
@@ -371,41 +343,40 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
371
343
|
});
|
|
372
344
|
}
|
|
373
345
|
} else {
|
|
374
|
-
_this2.processNode(id, stepIdx + 1, undefined, next
|
|
346
|
+
_this2.processNode(id, stepIdx + 1, undefined, next);
|
|
375
347
|
}
|
|
376
348
|
};
|
|
377
|
-
_context2.prev =
|
|
349
|
+
_context2.prev = 17;
|
|
378
350
|
this.changeResult(id, {
|
|
379
351
|
loading: true
|
|
380
352
|
});
|
|
381
353
|
|
|
382
354
|
/** 这里需要将handler处理成异步函数,否则后续next拿到的this.state.paused依旧是true */
|
|
383
|
-
_context2.next =
|
|
355
|
+
_context2.next = 21;
|
|
384
356
|
return new Promise(function (res) {
|
|
385
357
|
/** 不能使用requestAnimationFrame,因为这个函数会在页面后台被浏览器阻塞,使用setTimeout至少还能执行,虽然会降低执行速度,后续可以考虑优化state的使用 */
|
|
386
358
|
setTimeout(res);
|
|
387
359
|
});
|
|
388
|
-
case
|
|
389
|
-
_context2.next =
|
|
360
|
+
case 21:
|
|
361
|
+
_context2.next = 23;
|
|
390
362
|
return handler({
|
|
391
363
|
data: data,
|
|
392
|
-
payload: payload
|
|
393
|
-
skipWarning: skipWarning
|
|
364
|
+
payload: payload
|
|
394
365
|
});
|
|
395
|
-
case
|
|
366
|
+
case 23:
|
|
396
367
|
_result = _context2.sent;
|
|
397
368
|
done(_result);
|
|
398
|
-
_context2.next =
|
|
369
|
+
_context2.next = 30;
|
|
399
370
|
break;
|
|
400
|
-
case
|
|
401
|
-
_context2.prev =
|
|
402
|
-
_context2.t0 = _context2["catch"](
|
|
371
|
+
case 27:
|
|
372
|
+
_context2.prev = 27;
|
|
373
|
+
_context2.t0 = _context2["catch"](17);
|
|
403
374
|
done(undefined, _context2.t0);
|
|
404
|
-
case
|
|
375
|
+
case 30:
|
|
405
376
|
case "end":
|
|
406
377
|
return _context2.stop();
|
|
407
378
|
}
|
|
408
|
-
}, _callee2, this, [[
|
|
379
|
+
}, _callee2, this, [[17, 27]]);
|
|
409
380
|
}));
|
|
410
381
|
function processNode(_x, _x2, _x3, _x4) {
|
|
411
382
|
return _processNode.apply(this, arguments);
|
|
@@ -684,9 +655,7 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
684
655
|
});
|
|
685
656
|
},
|
|
686
657
|
footer: typeof footer === 'function' ? footer(data, {
|
|
687
|
-
results: this.getError()
|
|
688
|
-
isExecuting: !paused,
|
|
689
|
-
executeUntilBlocked: this.executeUntilBlocked
|
|
658
|
+
results: this.getError()
|
|
690
659
|
}) : footer,
|
|
691
660
|
maskClosable: false,
|
|
692
661
|
afterClose: function afterClose() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/kits",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.24",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@ant-design/icons": "^4.7.0",
|
|
27
|
-
"@lemon-fe/components": "^1.4.
|
|
27
|
+
"@lemon-fe/components": "^1.4.24",
|
|
28
28
|
"@lemon-fe/hooks": "^1.4.15",
|
|
29
29
|
"@lemon-fe/utils": "^1.4.15",
|
|
30
30
|
"ag-grid-community": "29.2.0",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"registry": "https://registry.npmjs.org"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f7a95929abc37783091d4ba9db0e7ea0d02fb7a1"
|
|
51
51
|
}
|