@lemon-fe/kits 0.1.140 → 0.1.144

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.
@@ -7,6 +7,8 @@ export default function useBatchOperate<RecordType = Record<string, any>>(option
7
7
  columns?: ColumnType<RecordType>[];
8
8
  rowKey?: BaseTableProps<RecordType>['rowKey'];
9
9
  onClose?: (results: Map<Key, Result>) => void;
10
+ /** 弹窗关闭前的检验,返回true校验通过关闭弹窗,false校验不通过 */
11
+ onBeforeClose?: (results: Map<Key, Result>) => Promise<boolean>;
10
12
  }): {
11
13
  node: JSX.Element;
12
14
  run: (data: RecordType[]) => void;
@@ -25,6 +25,7 @@ export default function useBatchOperate(options) {
25
25
  handler = options.handler,
26
26
  columns = options.columns,
27
27
  onClose = options.onClose,
28
+ onBeforeClose = options.onBeforeClose,
28
29
  rowKey = options.rowKey;
29
30
  var _useState = useState(false),
30
31
  _useState2 = _slicedToArray(_useState, 2),
@@ -244,12 +245,42 @@ export default function useBatchOperate(options) {
244
245
  setVisible(true);
245
246
  setData(data);
246
247
  };
247
- var handleClose = function handleClose() {
248
- setVisible(false);
249
- if (onClose) {
250
- onClose(results);
251
- }
252
- };
248
+ var handleClose = /*#__PURE__*/function () {
249
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
250
+ var beforeCloseResult;
251
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
252
+ while (1) {
253
+ switch (_context3.prev = _context3.next) {
254
+ case 0:
255
+ if (!onBeforeClose) {
256
+ _context3.next = 6;
257
+ break;
258
+ }
259
+ _context3.next = 3;
260
+ return onBeforeClose(results);
261
+ case 3:
262
+ beforeCloseResult = _context3.sent;
263
+ if (beforeCloseResult) {
264
+ _context3.next = 6;
265
+ break;
266
+ }
267
+ return _context3.abrupt("return");
268
+ case 6:
269
+ setVisible(false);
270
+ if (onClose) {
271
+ onClose(results);
272
+ }
273
+ case 8:
274
+ case "end":
275
+ return _context3.stop();
276
+ }
277
+ }
278
+ }, _callee3);
279
+ }));
280
+ return function handleClose() {
281
+ return _ref3.apply(this, arguments);
282
+ };
283
+ }();
253
284
  var node = /*#__PURE__*/React.createElement(Modal, {
254
285
  title: modalTitle,
255
286
  visible: visible,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "0.1.140",
3
+ "version": "0.1.144",
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.140",
28
- "@lemon-fe/hooks": "^0.1.140",
29
- "@lemon-fe/layouts": "^0.1.140",
27
+ "@lemon-fe/components": "^0.1.144",
28
+ "@lemon-fe/hooks": "^0.1.142",
29
+ "@lemon-fe/layouts": "^0.1.144",
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": "99cc7a85d28b2380ee970ff1f616fe1f77b44259"
35
+ "gitHead": "aa14d0c951acdc5db1bd2246dfb4bf6200bf845d"
36
36
  }