wargerm 0.5.28 → 0.5.31

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/dist/index.esm.js CHANGED
@@ -10613,6 +10613,7 @@ var ModalForm = function ModalForm(props, ref) {
10613
10613
  _context2.next = 5;
10614
10614
  return submitMethod(values, function () {
10615
10615
  setVisible(false);
10616
+ onCancel && onCancel();
10616
10617
  });
10617
10618
 
10618
10619
  case 5:
@@ -10700,11 +10701,7 @@ var TabelCard = function TabelCard(props, ref) {
10700
10701
  modalFormConfig = _useState4[0],
10701
10702
  setModalFormConfig = _useState4[1];
10702
10703
 
10703
- var _useState5 = useState({}),
10704
- _useState6 = _slicedToArray(_useState5, 2),
10705
- formSearch = _useState6[0],
10706
- setFormSearch = _useState6[1];
10707
-
10704
+ var formSearchRef = useRef({});
10708
10705
  var modalFormColumn = deepCopy(columns) || [];
10709
10706
  var formSearchColumn = deepCopy(columns) || [];
10710
10707
  useImperativeHandle(ref, function () {
@@ -10899,11 +10896,45 @@ var TabelCard = function TabelCard(props, ref) {
10899
10896
  key: i
10900
10897
  }, /*#__PURE__*/React.createElement("a", {
10901
10898
  key: btn.key,
10902
- onClick: function onClick() {
10903
- var _actionHandler$item$t;
10899
+ onClick: function () {
10900
+ var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
10901
+ var _actionHandler$item$t;
10902
+
10903
+ var info;
10904
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
10905
+ while (1) {
10906
+ switch (_context5.prev = _context5.next) {
10907
+ case 0:
10908
+ info = null;
10909
+
10910
+ if (!item.fetchInfo) {
10911
+ _context5.next = 5;
10912
+ break;
10913
+ }
10904
10914
 
10905
- return (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, record, index);
10906
- }
10915
+ _context5.next = 4;
10916
+ return item.fetchInfo(record);
10917
+
10918
+ case 4:
10919
+ info = _context5.sent;
10920
+
10921
+ case 5:
10922
+ (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, info || record, index);
10923
+
10924
+ case 6:
10925
+ case "end":
10926
+ return _context5.stop();
10927
+ }
10928
+ }
10929
+ }, _callee5);
10930
+ }));
10931
+
10932
+ function onClick() {
10933
+ return _onClick.apply(this, arguments);
10934
+ }
10935
+
10936
+ return onClick;
10937
+ }()
10907
10938
  }, btn.icon, " ", btn.title));
10908
10939
  }
10909
10940
 
@@ -10922,11 +10953,45 @@ var TabelCard = function TabelCard(props, ref) {
10922
10953
  key: i
10923
10954
  }, /*#__PURE__*/React.createElement("a", {
10924
10955
  key: btn.key,
10925
- onClick: function onClick() {
10926
- var _actionHandler$item$t3;
10956
+ onClick: function () {
10957
+ var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
10958
+ var _actionHandler$item$t3;
10959
+
10960
+ var info;
10961
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
10962
+ while (1) {
10963
+ switch (_context6.prev = _context6.next) {
10964
+ case 0:
10965
+ info = null;
10966
+
10967
+ if (!item.fetchInfo) {
10968
+ _context6.next = 5;
10969
+ break;
10970
+ }
10927
10971
 
10928
- return (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, record, index);
10929
- }
10972
+ _context6.next = 4;
10973
+ return item.fetchInfo(record);
10974
+
10975
+ case 4:
10976
+ info = _context6.sent;
10977
+
10978
+ case 5:
10979
+ (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, info || record, index);
10980
+
10981
+ case 6:
10982
+ case "end":
10983
+ return _context6.stop();
10984
+ }
10985
+ }
10986
+ }, _callee6);
10987
+ }));
10988
+
10989
+ function onClick() {
10990
+ return _onClick2.apply(this, arguments);
10991
+ }
10992
+
10993
+ return onClick;
10994
+ }()
10930
10995
  }, btn.icon, " ", btn.title));
10931
10996
  }
10932
10997
 
@@ -10980,17 +11045,17 @@ var TabelCard = function TabelCard(props, ref) {
10980
11045
  type: '新增',
10981
11046
  record: {},
10982
11047
  modalOnOk: function () {
10983
- var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(values, loading) {
10984
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
11048
+ var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(values, loading) {
11049
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
10985
11050
  while (1) {
10986
- switch (_context5.prev = _context5.next) {
11051
+ switch (_context7.prev = _context7.next) {
10987
11052
  case 0:
10988
11053
  if (!item.actionMethod) {
10989
- _context5.next = 3;
11054
+ _context7.next = 3;
10990
11055
  break;
10991
11056
  }
10992
11057
 
10993
- _context5.next = 3;
11058
+ _context7.next = 3;
10994
11059
  return item.actionMethod(values, function () {
10995
11060
  var _actionRef$current4;
10996
11061
 
@@ -11000,10 +11065,10 @@ var TabelCard = function TabelCard(props, ref) {
11000
11065
 
11001
11066
  case 3:
11002
11067
  case "end":
11003
- return _context5.stop();
11068
+ return _context7.stop();
11004
11069
  }
11005
11070
  }
11006
- }, _callee5);
11071
+ }, _callee7);
11007
11072
  }));
11008
11073
 
11009
11074
  function modalOnOk(_x3, _x4) {
@@ -11032,14 +11097,14 @@ var TabelCard = function TabelCard(props, ref) {
11032
11097
  var onSubmit = function onSubmit(values) {
11033
11098
  var _actionRef$current6;
11034
11099
 
11035
- setFormSearch(values);
11100
+ formSearchRef.current = values;
11036
11101
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11037
11102
  };
11038
11103
 
11039
11104
  var onReset = function onReset() {
11040
11105
  var _actionRef$current7;
11041
11106
 
11042
- setFormSearch({});
11107
+ formSearchRef.current = {};
11043
11108
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11044
11109
  };
11045
11110
 
@@ -11055,7 +11120,7 @@ var TabelCard = function TabelCard(props, ref) {
11055
11120
  }).forEach(function (item) {
11056
11121
  delete obj[item.dataIndex];
11057
11122
  });
11058
- setFormSearch(obj);
11123
+ formSearchRef.current = obj;
11059
11124
  }
11060
11125
  }, [columns]);
11061
11126
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalForm$1, _objectSpread2(_objectSpread2({
@@ -11067,25 +11132,25 @@ var TabelCard = function TabelCard(props, ref) {
11067
11132
  disabled: modalFormConfig.type == '查看',
11068
11133
  setVisible: setVisible,
11069
11134
  submitMethod: function () {
11070
- var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(values, loading) {
11071
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
11135
+ var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(values, loading) {
11136
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
11072
11137
  while (1) {
11073
- switch (_context6.prev = _context6.next) {
11138
+ switch (_context8.prev = _context8.next) {
11074
11139
  case 0:
11075
11140
  if (!modalFormConfig.modalOnOk) {
11076
- _context6.next = 3;
11141
+ _context8.next = 3;
11077
11142
  break;
11078
11143
  }
11079
11144
 
11080
- _context6.next = 3;
11145
+ _context8.next = 3;
11081
11146
  return modalFormConfig.modalOnOk(values, loading);
11082
11147
 
11083
11148
  case 3:
11084
11149
  case "end":
11085
- return _context6.stop();
11150
+ return _context8.stop();
11086
11151
  }
11087
11152
  }
11088
- }, _callee6);
11153
+ }, _callee8);
11089
11154
  }));
11090
11155
 
11091
11156
  function submitMethod(_x5, _x6) {
@@ -11151,7 +11216,7 @@ var TabelCard = function TabelCard(props, ref) {
11151
11216
  return [].concat(_toConsumableArray(pre), [column]);
11152
11217
  }
11153
11218
  }, [])
11154
- }, searchFormConfig || {})), /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
11219
+ }, searchFormConfig || {})), columns && columns.length && /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
11155
11220
  actionRef: actionRef,
11156
11221
  rowKey: "id",
11157
11222
  bordered: !noBordered,
@@ -11159,23 +11224,23 @@ var TabelCard = function TabelCard(props, ref) {
11159
11224
  toolBarRender: false
11160
11225
  }, _request ? {
11161
11226
  request: function () {
11162
- var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(params) {
11163
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
11227
+ var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(params) {
11228
+ return regeneratorRuntime.wrap(function _callee9$(_context9) {
11164
11229
  while (1) {
11165
- switch (_context7.prev = _context7.next) {
11230
+ switch (_context9.prev = _context9.next) {
11166
11231
  case 0:
11167
- _context7.next = 2;
11168
- return _request(_objectSpread2(_objectSpread2({}, params), formSearch));
11232
+ _context9.next = 2;
11233
+ return _request(_objectSpread2(_objectSpread2({}, params), formSearchRef.current));
11169
11234
 
11170
11235
  case 2:
11171
- return _context7.abrupt("return", _context7.sent);
11236
+ return _context9.abrupt("return", _context9.sent);
11172
11237
 
11173
11238
  case 3:
11174
11239
  case "end":
11175
- return _context7.stop();
11240
+ return _context9.stop();
11176
11241
  }
11177
11242
  }
11178
- }, _callee7);
11243
+ }, _callee9);
11179
11244
  }));
11180
11245
 
11181
11246
  function request(_x7) {
package/dist/index.js CHANGED
@@ -10674,6 +10674,7 @@ var ModalForm = function ModalForm(props, ref) {
10674
10674
  _context2.next = 5;
10675
10675
  return submitMethod(values, function () {
10676
10676
  setVisible(false);
10677
+ onCancel && onCancel();
10677
10678
  });
10678
10679
 
10679
10680
  case 5:
@@ -10761,11 +10762,7 @@ var TabelCard = function TabelCard(props, ref) {
10761
10762
  modalFormConfig = _useState4[0],
10762
10763
  setModalFormConfig = _useState4[1];
10763
10764
 
10764
- var _useState5 = React.useState({}),
10765
- _useState6 = _slicedToArray(_useState5, 2),
10766
- formSearch = _useState6[0],
10767
- setFormSearch = _useState6[1];
10768
-
10765
+ var formSearchRef = React.useRef({});
10769
10766
  var modalFormColumn = deepCopy(columns) || [];
10770
10767
  var formSearchColumn = deepCopy(columns) || [];
10771
10768
  React.useImperativeHandle(ref, function () {
@@ -10960,11 +10957,45 @@ var TabelCard = function TabelCard(props, ref) {
10960
10957
  key: i
10961
10958
  }, /*#__PURE__*/React__default['default'].createElement("a", {
10962
10959
  key: btn.key,
10963
- onClick: function onClick() {
10964
- var _actionHandler$item$t;
10960
+ onClick: function () {
10961
+ var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
10962
+ var _actionHandler$item$t;
10963
+
10964
+ var info;
10965
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
10966
+ while (1) {
10967
+ switch (_context5.prev = _context5.next) {
10968
+ case 0:
10969
+ info = null;
10970
+
10971
+ if (!item.fetchInfo) {
10972
+ _context5.next = 5;
10973
+ break;
10974
+ }
10965
10975
 
10966
- return (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, record, index);
10967
- }
10976
+ _context5.next = 4;
10977
+ return item.fetchInfo(record);
10978
+
10979
+ case 4:
10980
+ info = _context5.sent;
10981
+
10982
+ case 5:
10983
+ (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, info || record, index);
10984
+
10985
+ case 6:
10986
+ case "end":
10987
+ return _context5.stop();
10988
+ }
10989
+ }
10990
+ }, _callee5);
10991
+ }));
10992
+
10993
+ function onClick() {
10994
+ return _onClick.apply(this, arguments);
10995
+ }
10996
+
10997
+ return onClick;
10998
+ }()
10968
10999
  }, btn.icon, " ", btn.title));
10969
11000
  }
10970
11001
 
@@ -10983,11 +11014,45 @@ var TabelCard = function TabelCard(props, ref) {
10983
11014
  key: i
10984
11015
  }, /*#__PURE__*/React__default['default'].createElement("a", {
10985
11016
  key: btn.key,
10986
- onClick: function onClick() {
10987
- var _actionHandler$item$t3;
11017
+ onClick: function () {
11018
+ var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
11019
+ var _actionHandler$item$t3;
11020
+
11021
+ var info;
11022
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
11023
+ while (1) {
11024
+ switch (_context6.prev = _context6.next) {
11025
+ case 0:
11026
+ info = null;
11027
+
11028
+ if (!item.fetchInfo) {
11029
+ _context6.next = 5;
11030
+ break;
11031
+ }
10988
11032
 
10989
- return (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, record, index);
10990
- }
11033
+ _context6.next = 4;
11034
+ return item.fetchInfo(record);
11035
+
11036
+ case 4:
11037
+ info = _context6.sent;
11038
+
11039
+ case 5:
11040
+ (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, info || record, index);
11041
+
11042
+ case 6:
11043
+ case "end":
11044
+ return _context6.stop();
11045
+ }
11046
+ }
11047
+ }, _callee6);
11048
+ }));
11049
+
11050
+ function onClick() {
11051
+ return _onClick2.apply(this, arguments);
11052
+ }
11053
+
11054
+ return onClick;
11055
+ }()
10991
11056
  }, btn.icon, " ", btn.title));
10992
11057
  }
10993
11058
 
@@ -11041,17 +11106,17 @@ var TabelCard = function TabelCard(props, ref) {
11041
11106
  type: '新增',
11042
11107
  record: {},
11043
11108
  modalOnOk: function () {
11044
- var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(values, loading) {
11045
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
11109
+ var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(values, loading) {
11110
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
11046
11111
  while (1) {
11047
- switch (_context5.prev = _context5.next) {
11112
+ switch (_context7.prev = _context7.next) {
11048
11113
  case 0:
11049
11114
  if (!item.actionMethod) {
11050
- _context5.next = 3;
11115
+ _context7.next = 3;
11051
11116
  break;
11052
11117
  }
11053
11118
 
11054
- _context5.next = 3;
11119
+ _context7.next = 3;
11055
11120
  return item.actionMethod(values, function () {
11056
11121
  var _actionRef$current4;
11057
11122
 
@@ -11061,10 +11126,10 @@ var TabelCard = function TabelCard(props, ref) {
11061
11126
 
11062
11127
  case 3:
11063
11128
  case "end":
11064
- return _context5.stop();
11129
+ return _context7.stop();
11065
11130
  }
11066
11131
  }
11067
- }, _callee5);
11132
+ }, _callee7);
11068
11133
  }));
11069
11134
 
11070
11135
  function modalOnOk(_x3, _x4) {
@@ -11093,14 +11158,14 @@ var TabelCard = function TabelCard(props, ref) {
11093
11158
  var onSubmit = function onSubmit(values) {
11094
11159
  var _actionRef$current6;
11095
11160
 
11096
- setFormSearch(values);
11161
+ formSearchRef.current = values;
11097
11162
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11098
11163
  };
11099
11164
 
11100
11165
  var onReset = function onReset() {
11101
11166
  var _actionRef$current7;
11102
11167
 
11103
- setFormSearch({});
11168
+ formSearchRef.current = {};
11104
11169
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11105
11170
  };
11106
11171
 
@@ -11116,7 +11181,7 @@ var TabelCard = function TabelCard(props, ref) {
11116
11181
  }).forEach(function (item) {
11117
11182
  delete obj[item.dataIndex];
11118
11183
  });
11119
- setFormSearch(obj);
11184
+ formSearchRef.current = obj;
11120
11185
  }
11121
11186
  }, [columns]);
11122
11187
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ModalForm$1, _objectSpread2(_objectSpread2({
@@ -11128,25 +11193,25 @@ var TabelCard = function TabelCard(props, ref) {
11128
11193
  disabled: modalFormConfig.type == '查看',
11129
11194
  setVisible: setVisible,
11130
11195
  submitMethod: function () {
11131
- var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(values, loading) {
11132
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
11196
+ var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(values, loading) {
11197
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
11133
11198
  while (1) {
11134
- switch (_context6.prev = _context6.next) {
11199
+ switch (_context8.prev = _context8.next) {
11135
11200
  case 0:
11136
11201
  if (!modalFormConfig.modalOnOk) {
11137
- _context6.next = 3;
11202
+ _context8.next = 3;
11138
11203
  break;
11139
11204
  }
11140
11205
 
11141
- _context6.next = 3;
11206
+ _context8.next = 3;
11142
11207
  return modalFormConfig.modalOnOk(values, loading);
11143
11208
 
11144
11209
  case 3:
11145
11210
  case "end":
11146
- return _context6.stop();
11211
+ return _context8.stop();
11147
11212
  }
11148
11213
  }
11149
- }, _callee6);
11214
+ }, _callee8);
11150
11215
  }));
11151
11216
 
11152
11217
  function submitMethod(_x5, _x6) {
@@ -11212,7 +11277,7 @@ var TabelCard = function TabelCard(props, ref) {
11212
11277
  return [].concat(_toConsumableArray(pre), [column]);
11213
11278
  }
11214
11279
  }, [])
11215
- }, searchFormConfig || {})), /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
11280
+ }, searchFormConfig || {})), columns && columns.length && /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
11216
11281
  actionRef: actionRef,
11217
11282
  rowKey: "id",
11218
11283
  bordered: !noBordered,
@@ -11220,23 +11285,23 @@ var TabelCard = function TabelCard(props, ref) {
11220
11285
  toolBarRender: false
11221
11286
  }, _request ? {
11222
11287
  request: function () {
11223
- var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(params) {
11224
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
11288
+ var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(params) {
11289
+ return regeneratorRuntime.wrap(function _callee9$(_context9) {
11225
11290
  while (1) {
11226
- switch (_context7.prev = _context7.next) {
11291
+ switch (_context9.prev = _context9.next) {
11227
11292
  case 0:
11228
- _context7.next = 2;
11229
- return _request(_objectSpread2(_objectSpread2({}, params), formSearch));
11293
+ _context9.next = 2;
11294
+ return _request(_objectSpread2(_objectSpread2({}, params), formSearchRef.current));
11230
11295
 
11231
11296
  case 2:
11232
- return _context7.abrupt("return", _context7.sent);
11297
+ return _context9.abrupt("return", _context9.sent);
11233
11298
 
11234
11299
  case 3:
11235
11300
  case "end":
11236
- return _context7.stop();
11301
+ return _context9.stop();
11237
11302
  }
11238
11303
  }
11239
- }, _callee7);
11304
+ }, _callee9);
11240
11305
  }));
11241
11306
 
11242
11307
  function request(_x7) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.5.28",
4
+ "version": "0.5.31",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",