wargerm 0.5.27 → 0.5.30

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -54,6 +54,7 @@ export interface WFormProps extends FormProps {
54
54
  columns: ColumnProps[];
55
55
  extraColumns?: ColumnProps[];
56
56
  disabled?: boolean;
57
+ deps?: any;
57
58
  disabledHideInSearch?: boolean;
58
59
  setForm?: (form: any) => void;
59
60
  onSubmit?: (params: Record<string, any>) => void;
package/dist/index.esm.js CHANGED
@@ -7192,7 +7192,7 @@ var WCascader = function WCascader(props) {
7192
7192
  }, extraProps));
7193
7193
  };
7194
7194
 
7195
- var _excluded$7 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "disabledRuler", "onFormChange", "onSubmit", "onReset", "setForm"];
7195
+ var _excluded$7 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "disabledRuler", "onFormChange", "onSubmit", "onReset", "setForm", "deps"];
7196
7196
  var RangePicker$2 = Index$6.RangePicker;
7197
7197
 
7198
7198
  var WForm = function WForm(props, ref) {
@@ -7208,6 +7208,7 @@ var WForm = function WForm(props, ref) {
7208
7208
  onSubmit = props.onSubmit,
7209
7209
  onReset = props.onReset,
7210
7210
  setForm = props.setForm,
7211
+ deps = props.deps,
7211
7212
  extraProps = _objectWithoutProperties(props, _excluded$7);
7212
7213
 
7213
7214
  var _Form$useForm = _Form.useForm(),
@@ -7746,8 +7747,8 @@ var WForm = function WForm(props, ref) {
7746
7747
  return renderItemForm(c);
7747
7748
  }
7748
7749
  });
7749
- }, [changedValues, columns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
7750
- ]);
7750
+ }, [changedValues, columns, disabled].concat(_toConsumableArray(deps ? [deps] : []), [JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
7751
+ ]));
7751
7752
  var filterExtraColumnsForm = useMemo(function () {
7752
7753
  return filterExtraFormColumns.map(function (c) {
7753
7754
  if (c.type == 'group') {
@@ -7758,7 +7759,7 @@ var WForm = function WForm(props, ref) {
7758
7759
  return renderItemForm(c);
7759
7760
  }
7760
7761
  });
7761
- }, [changedValues, extraColumns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]);
7762
+ }, [changedValues, extraColumns, disabled].concat(_toConsumableArray(deps ? [deps] : []), [JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]));
7762
7763
 
7763
7764
  var handleSearch = function handleSearch(v) {
7764
7765
  var searchForm = form.getFieldsValue();
@@ -10499,7 +10500,7 @@ function DragBox(_ref) {
10499
10500
  }, children)) : /*#__PURE__*/React.createElement(React.Fragment, null);
10500
10501
  }
10501
10502
 
10502
- var _excluded$h = ["columns", "extraColumns", "search", "visible", "setVisible", "modalFormOpend", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange", "formItemChild", "onCancel"];
10503
+ var _excluded$h = ["columns", "extraColumns", "search", "visible", "setVisible", "modalFormOpend", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange", "formItemChild", "onCancel", "modalHeaderSolt", "modalFooterSolt", "formProps"];
10503
10504
 
10504
10505
  var ModalForm = function ModalForm(props, ref) {
10505
10506
  var columns = props.columns,
@@ -10516,6 +10517,9 @@ var ModalForm = function ModalForm(props, ref) {
10516
10517
  onFormChange = props.onFormChange,
10517
10518
  formItemChild = props.formItemChild,
10518
10519
  onCancel = props.onCancel,
10520
+ modalHeaderSolt = props.modalHeaderSolt,
10521
+ modalFooterSolt = props.modalFooterSolt,
10522
+ formProps = props.formProps,
10519
10523
  extraProps = _objectWithoutProperties(props, _excluded$h);
10520
10524
 
10521
10525
  var formRef = useRef(null);
@@ -10609,6 +10613,7 @@ var ModalForm = function ModalForm(props, ref) {
10609
10613
  _context2.next = 5;
10610
10614
  return submitMethod(values, function () {
10611
10615
  setVisible(false);
10616
+ onCancel && onCancel();
10612
10617
  });
10613
10618
 
10614
10619
  case 5:
@@ -10646,7 +10651,7 @@ var ModalForm = function ModalForm(props, ref) {
10646
10651
  onOk: handleOk,
10647
10652
  confirmLoading: confirmLoading,
10648
10653
  onCancel: handleCancel
10649
- }, extraProps), /*#__PURE__*/React.createElement(WForm$1, {
10654
+ }, extraProps), modalHeaderSolt, /*#__PURE__*/React.createElement(WForm$1, _objectSpread2({
10650
10655
  ref: formRef,
10651
10656
  disabled: disabled,
10652
10657
  onSubmit: onSubmit,
@@ -10656,12 +10661,12 @@ var ModalForm = function ModalForm(props, ref) {
10656
10661
  search: search,
10657
10662
  columns: columns,
10658
10663
  extraColumns: extraColumns
10659
- }), title == '查看' && formItemChild ? formItemChild() : null);
10664
+ }, formProps || {})), title == '查看' && formItemChild ? formItemChild() : null, modalFooterSolt);
10660
10665
  };
10661
10666
 
10662
10667
  var ModalForm$1 = /*#__PURE__*/React.forwardRef(ModalForm);
10663
10668
 
10664
- var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
10669
+ var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "searchFormConfig", "optionColumnConfig", "pagination", "noBordered"];
10665
10670
 
10666
10671
  var TabelCard = function TabelCard(props, ref) {
10667
10672
  var columns = props.columns,
@@ -10676,6 +10681,7 @@ var TabelCard = function TabelCard(props, ref) {
10676
10681
  style = props.style,
10677
10682
  onFormChange = props.onFormChange,
10678
10683
  modalConfig = props.modalConfig,
10684
+ searchFormConfig = props.searchFormConfig,
10679
10685
  optionColumnConfig = props.optionColumnConfig,
10680
10686
  pagination = props.pagination,
10681
10687
  noBordered = props.noBordered,
@@ -10695,11 +10701,7 @@ var TabelCard = function TabelCard(props, ref) {
10695
10701
  modalFormConfig = _useState4[0],
10696
10702
  setModalFormConfig = _useState4[1];
10697
10703
 
10698
- var _useState5 = useState({}),
10699
- _useState6 = _slicedToArray(_useState5, 2),
10700
- formSearch = _useState6[0],
10701
- setFormSearch = _useState6[1];
10702
-
10704
+ var formSearchRef = useRef({});
10703
10705
  var modalFormColumn = deepCopy(columns) || [];
10704
10706
  var formSearchColumn = deepCopy(columns) || [];
10705
10707
  useImperativeHandle(ref, function () {
@@ -10894,11 +10896,45 @@ var TabelCard = function TabelCard(props, ref) {
10894
10896
  key: i
10895
10897
  }, /*#__PURE__*/React.createElement("a", {
10896
10898
  key: btn.key,
10897
- onClick: function onClick() {
10898
- 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
+ }
10899
10914
 
10900
- return (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, record, index);
10901
- }
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
+ }()
10902
10938
  }, btn.icon, " ", btn.title));
10903
10939
  }
10904
10940
 
@@ -10917,11 +10953,45 @@ var TabelCard = function TabelCard(props, ref) {
10917
10953
  key: i
10918
10954
  }, /*#__PURE__*/React.createElement("a", {
10919
10955
  key: btn.key,
10920
- onClick: function onClick() {
10921
- 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
+ }
10922
10971
 
10923
- return (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, record, index);
10924
- }
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
+ }()
10925
10995
  }, btn.icon, " ", btn.title));
10926
10996
  }
10927
10997
 
@@ -10975,17 +11045,17 @@ var TabelCard = function TabelCard(props, ref) {
10975
11045
  type: '新增',
10976
11046
  record: {},
10977
11047
  modalOnOk: function () {
10978
- var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(values, loading) {
10979
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
11048
+ var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(values, loading) {
11049
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
10980
11050
  while (1) {
10981
- switch (_context5.prev = _context5.next) {
11051
+ switch (_context7.prev = _context7.next) {
10982
11052
  case 0:
10983
11053
  if (!item.actionMethod) {
10984
- _context5.next = 3;
11054
+ _context7.next = 3;
10985
11055
  break;
10986
11056
  }
10987
11057
 
10988
- _context5.next = 3;
11058
+ _context7.next = 3;
10989
11059
  return item.actionMethod(values, function () {
10990
11060
  var _actionRef$current4;
10991
11061
 
@@ -10995,10 +11065,10 @@ var TabelCard = function TabelCard(props, ref) {
10995
11065
 
10996
11066
  case 3:
10997
11067
  case "end":
10998
- return _context5.stop();
11068
+ return _context7.stop();
10999
11069
  }
11000
11070
  }
11001
- }, _callee5);
11071
+ }, _callee7);
11002
11072
  }));
11003
11073
 
11004
11074
  function modalOnOk(_x3, _x4) {
@@ -11027,14 +11097,14 @@ var TabelCard = function TabelCard(props, ref) {
11027
11097
  var onSubmit = function onSubmit(values) {
11028
11098
  var _actionRef$current6;
11029
11099
 
11030
- setFormSearch(values);
11100
+ formSearchRef.current = values;
11031
11101
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11032
11102
  };
11033
11103
 
11034
11104
  var onReset = function onReset() {
11035
11105
  var _actionRef$current7;
11036
11106
 
11037
- setFormSearch({});
11107
+ formSearchRef.current = {};
11038
11108
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11039
11109
  };
11040
11110
 
@@ -11050,7 +11120,13 @@ var TabelCard = function TabelCard(props, ref) {
11050
11120
  }).forEach(function (item) {
11051
11121
  delete obj[item.dataIndex];
11052
11122
  });
11053
- setFormSearch(obj);
11123
+ formSearchRef.current = obj;
11124
+
11125
+ if (columns === null || columns === void 0 ? void 0 : columns.length) {
11126
+ var _actionRef$current8;
11127
+
11128
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : _actionRef$current8.reload(true);
11129
+ }
11054
11130
  }
11055
11131
  }, [columns]);
11056
11132
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalForm$1, _objectSpread2(_objectSpread2({
@@ -11062,25 +11138,25 @@ var TabelCard = function TabelCard(props, ref) {
11062
11138
  disabled: modalFormConfig.type == '查看',
11063
11139
  setVisible: setVisible,
11064
11140
  submitMethod: function () {
11065
- var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(values, loading) {
11066
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
11141
+ var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(values, loading) {
11142
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
11067
11143
  while (1) {
11068
- switch (_context6.prev = _context6.next) {
11144
+ switch (_context8.prev = _context8.next) {
11069
11145
  case 0:
11070
11146
  if (!modalFormConfig.modalOnOk) {
11071
- _context6.next = 3;
11147
+ _context8.next = 3;
11072
11148
  break;
11073
11149
  }
11074
11150
 
11075
- _context6.next = 3;
11151
+ _context8.next = 3;
11076
11152
  return modalFormConfig.modalOnOk(values, loading);
11077
11153
 
11078
11154
  case 3:
11079
11155
  case "end":
11080
- return _context6.stop();
11156
+ return _context8.stop();
11081
11157
  }
11082
11158
  }
11083
- }, _callee6);
11159
+ }, _callee8);
11084
11160
  }));
11085
11161
 
11086
11162
  function submitMethod(_x5, _x6) {
@@ -11122,7 +11198,7 @@ var TabelCard = function TabelCard(props, ref) {
11122
11198
 
11123
11199
  return true;
11124
11200
  })
11125
- })), /*#__PURE__*/React.createElement(WForm$1, {
11201
+ })), /*#__PURE__*/React.createElement(WForm$1, _objectSpread2({
11126
11202
  ref: searchFormRef,
11127
11203
  disabledRuler: true,
11128
11204
  search: search == false ? {
@@ -11146,7 +11222,7 @@ var TabelCard = function TabelCard(props, ref) {
11146
11222
  return [].concat(_toConsumableArray(pre), [column]);
11147
11223
  }
11148
11224
  }, [])
11149
- }), /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
11225
+ }, searchFormConfig || {})), columns && columns.length && /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
11150
11226
  actionRef: actionRef,
11151
11227
  rowKey: "id",
11152
11228
  bordered: !noBordered,
@@ -11154,23 +11230,23 @@ var TabelCard = function TabelCard(props, ref) {
11154
11230
  toolBarRender: false
11155
11231
  }, _request ? {
11156
11232
  request: function () {
11157
- var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(params) {
11158
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
11233
+ var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(params) {
11234
+ return regeneratorRuntime.wrap(function _callee9$(_context9) {
11159
11235
  while (1) {
11160
- switch (_context7.prev = _context7.next) {
11236
+ switch (_context9.prev = _context9.next) {
11161
11237
  case 0:
11162
- _context7.next = 2;
11163
- return _request(_objectSpread2(_objectSpread2({}, params), formSearch));
11238
+ _context9.next = 2;
11239
+ return _request(_objectSpread2(_objectSpread2({}, params), formSearchRef.current));
11164
11240
 
11165
11241
  case 2:
11166
- return _context7.abrupt("return", _context7.sent);
11242
+ return _context9.abrupt("return", _context9.sent);
11167
11243
 
11168
11244
  case 3:
11169
11245
  case "end":
11170
- return _context7.stop();
11246
+ return _context9.stop();
11171
11247
  }
11172
11248
  }
11173
- }, _callee7);
11249
+ }, _callee9);
11174
11250
  }));
11175
11251
 
11176
11252
  function request(_x7) {
package/dist/index.js CHANGED
@@ -7253,7 +7253,7 @@ var WCascader = function WCascader(props) {
7253
7253
  }, extraProps));
7254
7254
  };
7255
7255
 
7256
- var _excluded$7 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "disabledRuler", "onFormChange", "onSubmit", "onReset", "setForm"];
7256
+ var _excluded$7 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "disabledRuler", "onFormChange", "onSubmit", "onReset", "setForm", "deps"];
7257
7257
  var RangePicker$2 = Index$6.RangePicker;
7258
7258
 
7259
7259
  var WForm = function WForm(props, ref) {
@@ -7269,6 +7269,7 @@ var WForm = function WForm(props, ref) {
7269
7269
  onSubmit = props.onSubmit,
7270
7270
  onReset = props.onReset,
7271
7271
  setForm = props.setForm,
7272
+ deps = props.deps,
7272
7273
  extraProps = _objectWithoutProperties(props, _excluded$7);
7273
7274
 
7274
7275
  var _Form$useForm = _Form__default['default'].useForm(),
@@ -7807,8 +7808,8 @@ var WForm = function WForm(props, ref) {
7807
7808
  return renderItemForm(c);
7808
7809
  }
7809
7810
  });
7810
- }, [changedValues, columns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
7811
- ]);
7811
+ }, [changedValues, columns, disabled].concat(_toConsumableArray(deps ? [deps] : []), [JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
7812
+ ]));
7812
7813
  var filterExtraColumnsForm = React.useMemo(function () {
7813
7814
  return filterExtraFormColumns.map(function (c) {
7814
7815
  if (c.type == 'group') {
@@ -7819,7 +7820,7 @@ var WForm = function WForm(props, ref) {
7819
7820
  return renderItemForm(c);
7820
7821
  }
7821
7822
  });
7822
- }, [changedValues, extraColumns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]);
7823
+ }, [changedValues, extraColumns, disabled].concat(_toConsumableArray(deps ? [deps] : []), [JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]));
7823
7824
 
7824
7825
  var handleSearch = function handleSearch(v) {
7825
7826
  var searchForm = form.getFieldsValue();
@@ -10560,7 +10561,7 @@ function DragBox(_ref) {
10560
10561
  }, children)) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
10561
10562
  }
10562
10563
 
10563
- var _excluded$h = ["columns", "extraColumns", "search", "visible", "setVisible", "modalFormOpend", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange", "formItemChild", "onCancel"];
10564
+ var _excluded$h = ["columns", "extraColumns", "search", "visible", "setVisible", "modalFormOpend", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange", "formItemChild", "onCancel", "modalHeaderSolt", "modalFooterSolt", "formProps"];
10564
10565
 
10565
10566
  var ModalForm = function ModalForm(props, ref) {
10566
10567
  var columns = props.columns,
@@ -10577,6 +10578,9 @@ var ModalForm = function ModalForm(props, ref) {
10577
10578
  onFormChange = props.onFormChange,
10578
10579
  formItemChild = props.formItemChild,
10579
10580
  onCancel = props.onCancel,
10581
+ modalHeaderSolt = props.modalHeaderSolt,
10582
+ modalFooterSolt = props.modalFooterSolt,
10583
+ formProps = props.formProps,
10580
10584
  extraProps = _objectWithoutProperties(props, _excluded$h);
10581
10585
 
10582
10586
  var formRef = React.useRef(null);
@@ -10670,6 +10674,7 @@ var ModalForm = function ModalForm(props, ref) {
10670
10674
  _context2.next = 5;
10671
10675
  return submitMethod(values, function () {
10672
10676
  setVisible(false);
10677
+ onCancel && onCancel();
10673
10678
  });
10674
10679
 
10675
10680
  case 5:
@@ -10707,7 +10712,7 @@ var ModalForm = function ModalForm(props, ref) {
10707
10712
  onOk: handleOk,
10708
10713
  confirmLoading: confirmLoading,
10709
10714
  onCancel: handleCancel
10710
- }, extraProps), /*#__PURE__*/React__default['default'].createElement(WForm$1, {
10715
+ }, extraProps), modalHeaderSolt, /*#__PURE__*/React__default['default'].createElement(WForm$1, _objectSpread2({
10711
10716
  ref: formRef,
10712
10717
  disabled: disabled,
10713
10718
  onSubmit: onSubmit,
@@ -10717,12 +10722,12 @@ var ModalForm = function ModalForm(props, ref) {
10717
10722
  search: search,
10718
10723
  columns: columns,
10719
10724
  extraColumns: extraColumns
10720
- }), title == '查看' && formItemChild ? formItemChild() : null);
10725
+ }, formProps || {})), title == '查看' && formItemChild ? formItemChild() : null, modalFooterSolt);
10721
10726
  };
10722
10727
 
10723
10728
  var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
10724
10729
 
10725
- var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
10730
+ var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "searchFormConfig", "optionColumnConfig", "pagination", "noBordered"];
10726
10731
 
10727
10732
  var TabelCard = function TabelCard(props, ref) {
10728
10733
  var columns = props.columns,
@@ -10737,6 +10742,7 @@ var TabelCard = function TabelCard(props, ref) {
10737
10742
  style = props.style,
10738
10743
  onFormChange = props.onFormChange,
10739
10744
  modalConfig = props.modalConfig,
10745
+ searchFormConfig = props.searchFormConfig,
10740
10746
  optionColumnConfig = props.optionColumnConfig,
10741
10747
  pagination = props.pagination,
10742
10748
  noBordered = props.noBordered,
@@ -10756,11 +10762,7 @@ var TabelCard = function TabelCard(props, ref) {
10756
10762
  modalFormConfig = _useState4[0],
10757
10763
  setModalFormConfig = _useState4[1];
10758
10764
 
10759
- var _useState5 = React.useState({}),
10760
- _useState6 = _slicedToArray(_useState5, 2),
10761
- formSearch = _useState6[0],
10762
- setFormSearch = _useState6[1];
10763
-
10765
+ var formSearchRef = React.useRef({});
10764
10766
  var modalFormColumn = deepCopy(columns) || [];
10765
10767
  var formSearchColumn = deepCopy(columns) || [];
10766
10768
  React.useImperativeHandle(ref, function () {
@@ -10955,11 +10957,45 @@ var TabelCard = function TabelCard(props, ref) {
10955
10957
  key: i
10956
10958
  }, /*#__PURE__*/React__default['default'].createElement("a", {
10957
10959
  key: btn.key,
10958
- onClick: function onClick() {
10959
- 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
+ }
10960
10975
 
10961
- return (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, record, index);
10962
- }
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
+ }()
10963
10999
  }, btn.icon, " ", btn.title));
10964
11000
  }
10965
11001
 
@@ -10978,11 +11014,45 @@ var TabelCard = function TabelCard(props, ref) {
10978
11014
  key: i
10979
11015
  }, /*#__PURE__*/React__default['default'].createElement("a", {
10980
11016
  key: btn.key,
10981
- onClick: function onClick() {
10982
- 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
+ }
10983
11032
 
10984
- return (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, record, index);
10985
- }
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
+ }()
10986
11056
  }, btn.icon, " ", btn.title));
10987
11057
  }
10988
11058
 
@@ -11036,17 +11106,17 @@ var TabelCard = function TabelCard(props, ref) {
11036
11106
  type: '新增',
11037
11107
  record: {},
11038
11108
  modalOnOk: function () {
11039
- var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(values, loading) {
11040
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
11109
+ var _modalOnOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(values, loading) {
11110
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
11041
11111
  while (1) {
11042
- switch (_context5.prev = _context5.next) {
11112
+ switch (_context7.prev = _context7.next) {
11043
11113
  case 0:
11044
11114
  if (!item.actionMethod) {
11045
- _context5.next = 3;
11115
+ _context7.next = 3;
11046
11116
  break;
11047
11117
  }
11048
11118
 
11049
- _context5.next = 3;
11119
+ _context7.next = 3;
11050
11120
  return item.actionMethod(values, function () {
11051
11121
  var _actionRef$current4;
11052
11122
 
@@ -11056,10 +11126,10 @@ var TabelCard = function TabelCard(props, ref) {
11056
11126
 
11057
11127
  case 3:
11058
11128
  case "end":
11059
- return _context5.stop();
11129
+ return _context7.stop();
11060
11130
  }
11061
11131
  }
11062
- }, _callee5);
11132
+ }, _callee7);
11063
11133
  }));
11064
11134
 
11065
11135
  function modalOnOk(_x3, _x4) {
@@ -11088,14 +11158,14 @@ var TabelCard = function TabelCard(props, ref) {
11088
11158
  var onSubmit = function onSubmit(values) {
11089
11159
  var _actionRef$current6;
11090
11160
 
11091
- setFormSearch(values);
11161
+ formSearchRef.current = values;
11092
11162
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11093
11163
  };
11094
11164
 
11095
11165
  var onReset = function onReset() {
11096
11166
  var _actionRef$current7;
11097
11167
 
11098
- setFormSearch({});
11168
+ formSearchRef.current = {};
11099
11169
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11100
11170
  };
11101
11171
 
@@ -11111,7 +11181,13 @@ var TabelCard = function TabelCard(props, ref) {
11111
11181
  }).forEach(function (item) {
11112
11182
  delete obj[item.dataIndex];
11113
11183
  });
11114
- setFormSearch(obj);
11184
+ formSearchRef.current = obj;
11185
+
11186
+ if (columns === null || columns === void 0 ? void 0 : columns.length) {
11187
+ var _actionRef$current8;
11188
+
11189
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : _actionRef$current8.reload(true);
11190
+ }
11115
11191
  }
11116
11192
  }, [columns]);
11117
11193
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ModalForm$1, _objectSpread2(_objectSpread2({
@@ -11123,25 +11199,25 @@ var TabelCard = function TabelCard(props, ref) {
11123
11199
  disabled: modalFormConfig.type == '查看',
11124
11200
  setVisible: setVisible,
11125
11201
  submitMethod: function () {
11126
- var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(values, loading) {
11127
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
11202
+ var _submitMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(values, loading) {
11203
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
11128
11204
  while (1) {
11129
- switch (_context6.prev = _context6.next) {
11205
+ switch (_context8.prev = _context8.next) {
11130
11206
  case 0:
11131
11207
  if (!modalFormConfig.modalOnOk) {
11132
- _context6.next = 3;
11208
+ _context8.next = 3;
11133
11209
  break;
11134
11210
  }
11135
11211
 
11136
- _context6.next = 3;
11212
+ _context8.next = 3;
11137
11213
  return modalFormConfig.modalOnOk(values, loading);
11138
11214
 
11139
11215
  case 3:
11140
11216
  case "end":
11141
- return _context6.stop();
11217
+ return _context8.stop();
11142
11218
  }
11143
11219
  }
11144
- }, _callee6);
11220
+ }, _callee8);
11145
11221
  }));
11146
11222
 
11147
11223
  function submitMethod(_x5, _x6) {
@@ -11183,7 +11259,7 @@ var TabelCard = function TabelCard(props, ref) {
11183
11259
 
11184
11260
  return true;
11185
11261
  })
11186
- })), /*#__PURE__*/React__default['default'].createElement(WForm$1, {
11262
+ })), /*#__PURE__*/React__default['default'].createElement(WForm$1, _objectSpread2({
11187
11263
  ref: searchFormRef,
11188
11264
  disabledRuler: true,
11189
11265
  search: search == false ? {
@@ -11207,7 +11283,7 @@ var TabelCard = function TabelCard(props, ref) {
11207
11283
  return [].concat(_toConsumableArray(pre), [column]);
11208
11284
  }
11209
11285
  }, [])
11210
- }), /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
11286
+ }, searchFormConfig || {})), columns && columns.length && /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
11211
11287
  actionRef: actionRef,
11212
11288
  rowKey: "id",
11213
11289
  bordered: !noBordered,
@@ -11215,23 +11291,23 @@ var TabelCard = function TabelCard(props, ref) {
11215
11291
  toolBarRender: false
11216
11292
  }, _request ? {
11217
11293
  request: function () {
11218
- var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(params) {
11219
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
11294
+ var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(params) {
11295
+ return regeneratorRuntime.wrap(function _callee9$(_context9) {
11220
11296
  while (1) {
11221
- switch (_context7.prev = _context7.next) {
11297
+ switch (_context9.prev = _context9.next) {
11222
11298
  case 0:
11223
- _context7.next = 2;
11224
- return _request(_objectSpread2(_objectSpread2({}, params), formSearch));
11299
+ _context9.next = 2;
11300
+ return _request(_objectSpread2(_objectSpread2({}, params), formSearchRef.current));
11225
11301
 
11226
11302
  case 2:
11227
- return _context7.abrupt("return", _context7.sent);
11303
+ return _context9.abrupt("return", _context9.sent);
11228
11304
 
11229
11305
  case 3:
11230
11306
  case "end":
11231
- return _context7.stop();
11307
+ return _context9.stop();
11232
11308
  }
11233
11309
  }
11234
- }, _callee7);
11310
+ }, _callee9);
11235
11311
  }));
11236
11312
 
11237
11313
  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.27",
4
+ "version": "0.5.30",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",
@@ -85,4 +85,4 @@
85
85
  "react": "^16.12.0",
86
86
  "yorkie": "^2.0.0"
87
87
  }
88
- }
88
+ }