wargerm 0.5.12 → 0.5.15

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
@@ -584,11 +584,12 @@ var Index = WInput;
584
584
  Index.TextArea = _Input.TextArea;
585
585
  WInput.defaultProps = {};
586
586
 
587
- var _excluded$1 = ["value", "onChange", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList"];
587
+ var _excluded$1 = ["value", "onChange", "onRemove", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList"];
588
588
 
589
589
  function Index$1(_ref, ref) {
590
590
  var value = _ref.value,
591
591
  onChange = _ref.onChange,
592
+ onRemove = _ref.onRemove,
592
593
  beforeUpload = _ref.beforeUpload,
593
594
  uploadButton = _ref.uploadButton,
594
595
  maxCount = _ref.maxCount,
@@ -684,7 +685,7 @@ function Index$1(_ref, ref) {
684
685
  }
685
686
 
686
687
  _context.next = 4;
687
- return fetchMethod ? fetchMethod(file.originFileObj) : getBase64(file.originFileObj);
688
+ return fetchMethod ? fetchMethod(file.originFileObj) : file.originFileObj ? getBase64(file.originFileObj) : Promise.resolve(file.url);
688
689
 
689
690
  case 4:
690
691
  url = _context.sent;
@@ -713,6 +714,15 @@ function Index$1(_ref, ref) {
713
714
  };
714
715
  }();
715
716
 
717
+ var handleronRemove = function handleronRemove(file) {
718
+ var index = fileList.indexOf(file);
719
+ onRemove && onRemove(file, function () {
720
+ var newFileList = fileList.slice();
721
+ newFileList.splice(index, 1);
722
+ setFileList(newFileList);
723
+ });
724
+ };
725
+
716
726
  var handlePreview = /*#__PURE__*/function () {
717
727
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file) {
718
728
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
@@ -763,7 +773,8 @@ function Index$1(_ref, ref) {
763
773
  listType: "picture-card",
764
774
  beforeUpload: beforeUploadIn,
765
775
  onPreview: handlePreview,
766
- onChange: handleChange
776
+ onChange: handleChange,
777
+ onRemove: handleronRemove
767
778
  }, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom), /*#__PURE__*/React.createElement(_Modal, {
768
779
  visible: previewVisible,
769
780
  title: previewTitle,
@@ -830,7 +841,7 @@ Index$4.Group = _Checkbox.Group;
830
841
  /*
831
842
  * @Author: lijin
832
843
  * @Date: 2021-10-27 22:18:49
833
- * @LastEditTime: 2022-08-09 09:35:23
844
+ * @LastEditTime: 2022-08-11 10:57:14
834
845
  * @LastEditors: lijin
835
846
  * @Description:
836
847
  * @FilePath: \wargerm-components\src\utils\index.ts
@@ -904,10 +915,26 @@ function deepCopy(target) {
904
915
  var result = Array.isArray(target) ? [] : {}; // eslint-disable-next-line no-restricted-syntax
905
916
 
906
917
  for (var key in target) {
907
- var _target$key;
918
+ if (_typeof(target[key]) === 'object') {
919
+ if (Object.prototype.toString.call(target).slice(8, -1) == 'Object') {
920
+ var _target$key, _target$key2;
921
+
922
+ if (((_target$key = target[key]) === null || _target$key === void 0 ? void 0 : _target$key['$$typeof']) || ((_target$key2 = target[key]) === null || _target$key2 === void 0 ? void 0 : _target$key2['_isAMomentObject'])) {
923
+ result[key] = target[key];
924
+ } else {
925
+ result[key] = deepCopy(target[key]);
926
+ }
927
+ } else if (Object.prototype.toString.call(target).slice(8, -1) == 'Array') {
928
+ var _target$key3, _target$key4;
908
929
 
909
- if (Object.prototype.toString.call(target).slice(8, -1) == 'Object' && !((_target$key = target[key]) === null || _target$key === void 0 ? void 0 : _target$key['$$typeof'])) {
910
- result[key] = deepCopy(target[key]);
930
+ if (((_target$key3 = target[key]) === null || _target$key3 === void 0 ? void 0 : _target$key3['$$typeof']) || ((_target$key4 = target[key]) === null || _target$key4 === void 0 ? void 0 : _target$key4['_isAMomentObject'])) {
931
+ result[key] = target[key];
932
+ } else {
933
+ result[key] = deepCopy(target[key]);
934
+ }
935
+ } else {
936
+ result[key] = target[key];
937
+ }
911
938
  } else {
912
939
  result[key] = target[key];
913
940
  }
@@ -962,7 +989,8 @@ function FrameBox(_ref) {
962
989
  }
963
990
 
964
991
  var _excluded$3 = ["request", "valueEnum", "onLoad", "children", "params"],
965
- _excluded2 = ["children"];
992
+ _excluded2 = ["value", "label"],
993
+ _excluded3 = ["children"];
966
994
 
967
995
  var WSelect = function WSelect(props) {
968
996
  var request = props.request,
@@ -1017,11 +1045,15 @@ var WSelect = function WSelect(props) {
1017
1045
  case 6:
1018
1046
  setResList(res);
1019
1047
  onLoad && onLoad(res);
1020
- node = res === null || res === void 0 ? void 0 : res.map(function (item) {
1021
- return /*#__PURE__*/React.createElement(_Select.Option, {
1022
- key: item.value,
1023
- value: item.value
1024
- }, item.label) || /*#__PURE__*/React.createElement(React.Fragment, null);
1048
+ node = res === null || res === void 0 ? void 0 : res.map(function (_ref2) {
1049
+ var value = _ref2.value,
1050
+ label = _ref2.label,
1051
+ extraProps = _objectWithoutProperties(_ref2, _excluded2);
1052
+
1053
+ return /*#__PURE__*/React.createElement(_Select.Option, _objectSpread2({
1054
+ key: value,
1055
+ value: value
1056
+ }, extraProps), label) || /*#__PURE__*/React.createElement(React.Fragment, null);
1025
1057
  });
1026
1058
  setChildrenNode(node);
1027
1059
 
@@ -1077,7 +1109,7 @@ WSelect.defaultProps = {};
1077
1109
 
1078
1110
  var Option = function Option(props) {
1079
1111
  var children = props.children,
1080
- extraProps = _objectWithoutProperties(props, _excluded2);
1112
+ extraProps = _objectWithoutProperties(props, _excluded3);
1081
1113
 
1082
1114
  return /*#__PURE__*/React.createElement(_Select.Option, _objectSpread2({}, extraProps), children);
1083
1115
  };
@@ -11041,6 +11073,8 @@ var TabelCard = function TabelCard(props, ref) {
11041
11073
  formSearch = _useState6[0],
11042
11074
  setFormSearch = _useState6[1];
11043
11075
 
11076
+ var modalFormColumn = deepCopy(columns) || [];
11077
+ var formSearchColumn = deepCopy(columns) || [];
11044
11078
  useImperativeHandle(ref, function () {
11045
11079
  return {
11046
11080
  actionRef: actionRef.current,
@@ -11367,14 +11401,14 @@ var TabelCard = function TabelCard(props, ref) {
11367
11401
  var _actionRef$current6;
11368
11402
 
11369
11403
  setFormSearch(values);
11370
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload();
11404
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11371
11405
  };
11372
11406
 
11373
11407
  var onReset = function onReset() {
11374
11408
  var _actionRef$current7;
11375
11409
 
11376
11410
  setFormSearch({});
11377
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload();
11411
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11378
11412
  };
11379
11413
 
11380
11414
  useEffect(function () {
@@ -11392,8 +11426,6 @@ var TabelCard = function TabelCard(props, ref) {
11392
11426
  setFormSearch(obj);
11393
11427
  }
11394
11428
  }, [columns]);
11395
- var modalFormColumn = deepCopy(columns) || [];
11396
- var formSearchColumn = columns || [];
11397
11429
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalForm$1, _objectSpread2(_objectSpread2({
11398
11430
  ref: modalFormRef,
11399
11431
  title: modalFormConfig.type || '新增',
package/dist/index.js CHANGED
@@ -644,11 +644,12 @@ var Index = WInput;
644
644
  Index.TextArea = _Input__default['default'].TextArea;
645
645
  WInput.defaultProps = {};
646
646
 
647
- var _excluded$1 = ["value", "onChange", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList"];
647
+ var _excluded$1 = ["value", "onChange", "onRemove", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList"];
648
648
 
649
649
  function Index$1(_ref, ref) {
650
650
  var value = _ref.value,
651
651
  onChange = _ref.onChange,
652
+ onRemove = _ref.onRemove,
652
653
  beforeUpload = _ref.beforeUpload,
653
654
  uploadButton = _ref.uploadButton,
654
655
  maxCount = _ref.maxCount,
@@ -744,7 +745,7 @@ function Index$1(_ref, ref) {
744
745
  }
745
746
 
746
747
  _context.next = 4;
747
- return fetchMethod ? fetchMethod(file.originFileObj) : getBase64(file.originFileObj);
748
+ return fetchMethod ? fetchMethod(file.originFileObj) : file.originFileObj ? getBase64(file.originFileObj) : Promise.resolve(file.url);
748
749
 
749
750
  case 4:
750
751
  url = _context.sent;
@@ -773,6 +774,15 @@ function Index$1(_ref, ref) {
773
774
  };
774
775
  }();
775
776
 
777
+ var handleronRemove = function handleronRemove(file) {
778
+ var index = fileList.indexOf(file);
779
+ onRemove && onRemove(file, function () {
780
+ var newFileList = fileList.slice();
781
+ newFileList.splice(index, 1);
782
+ setFileList(newFileList);
783
+ });
784
+ };
785
+
776
786
  var handlePreview = /*#__PURE__*/function () {
777
787
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file) {
778
788
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
@@ -823,7 +833,8 @@ function Index$1(_ref, ref) {
823
833
  listType: "picture-card",
824
834
  beforeUpload: beforeUploadIn,
825
835
  onPreview: handlePreview,
826
- onChange: handleChange
836
+ onChange: handleChange,
837
+ onRemove: handleronRemove
827
838
  }, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom), /*#__PURE__*/React__default['default'].createElement(_Modal__default['default'], {
828
839
  visible: previewVisible,
829
840
  title: previewTitle,
@@ -890,7 +901,7 @@ Index$4.Group = _Checkbox__default['default'].Group;
890
901
  /*
891
902
  * @Author: lijin
892
903
  * @Date: 2021-10-27 22:18:49
893
- * @LastEditTime: 2022-08-09 09:35:23
904
+ * @LastEditTime: 2022-08-11 10:57:14
894
905
  * @LastEditors: lijin
895
906
  * @Description:
896
907
  * @FilePath: \wargerm-components\src\utils\index.ts
@@ -964,10 +975,26 @@ function deepCopy(target) {
964
975
  var result = Array.isArray(target) ? [] : {}; // eslint-disable-next-line no-restricted-syntax
965
976
 
966
977
  for (var key in target) {
967
- var _target$key;
978
+ if (_typeof(target[key]) === 'object') {
979
+ if (Object.prototype.toString.call(target).slice(8, -1) == 'Object') {
980
+ var _target$key, _target$key2;
981
+
982
+ if (((_target$key = target[key]) === null || _target$key === void 0 ? void 0 : _target$key['$$typeof']) || ((_target$key2 = target[key]) === null || _target$key2 === void 0 ? void 0 : _target$key2['_isAMomentObject'])) {
983
+ result[key] = target[key];
984
+ } else {
985
+ result[key] = deepCopy(target[key]);
986
+ }
987
+ } else if (Object.prototype.toString.call(target).slice(8, -1) == 'Array') {
988
+ var _target$key3, _target$key4;
968
989
 
969
- if (Object.prototype.toString.call(target).slice(8, -1) == 'Object' && !((_target$key = target[key]) === null || _target$key === void 0 ? void 0 : _target$key['$$typeof'])) {
970
- result[key] = deepCopy(target[key]);
990
+ if (((_target$key3 = target[key]) === null || _target$key3 === void 0 ? void 0 : _target$key3['$$typeof']) || ((_target$key4 = target[key]) === null || _target$key4 === void 0 ? void 0 : _target$key4['_isAMomentObject'])) {
991
+ result[key] = target[key];
992
+ } else {
993
+ result[key] = deepCopy(target[key]);
994
+ }
995
+ } else {
996
+ result[key] = target[key];
997
+ }
971
998
  } else {
972
999
  result[key] = target[key];
973
1000
  }
@@ -1022,7 +1049,8 @@ function FrameBox(_ref) {
1022
1049
  }
1023
1050
 
1024
1051
  var _excluded$3 = ["request", "valueEnum", "onLoad", "children", "params"],
1025
- _excluded2 = ["children"];
1052
+ _excluded2 = ["value", "label"],
1053
+ _excluded3 = ["children"];
1026
1054
 
1027
1055
  var WSelect = function WSelect(props) {
1028
1056
  var request = props.request,
@@ -1077,11 +1105,15 @@ var WSelect = function WSelect(props) {
1077
1105
  case 6:
1078
1106
  setResList(res);
1079
1107
  onLoad && onLoad(res);
1080
- node = res === null || res === void 0 ? void 0 : res.map(function (item) {
1081
- return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'].Option, {
1082
- key: item.value,
1083
- value: item.value
1084
- }, item.label) || /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
1108
+ node = res === null || res === void 0 ? void 0 : res.map(function (_ref2) {
1109
+ var value = _ref2.value,
1110
+ label = _ref2.label,
1111
+ extraProps = _objectWithoutProperties(_ref2, _excluded2);
1112
+
1113
+ return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'].Option, _objectSpread2({
1114
+ key: value,
1115
+ value: value
1116
+ }, extraProps), label) || /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
1085
1117
  });
1086
1118
  setChildrenNode(node);
1087
1119
 
@@ -1137,7 +1169,7 @@ WSelect.defaultProps = {};
1137
1169
 
1138
1170
  var Option = function Option(props) {
1139
1171
  var children = props.children,
1140
- extraProps = _objectWithoutProperties(props, _excluded2);
1172
+ extraProps = _objectWithoutProperties(props, _excluded3);
1141
1173
 
1142
1174
  return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'].Option, _objectSpread2({}, extraProps), children);
1143
1175
  };
@@ -11101,6 +11133,8 @@ var TabelCard = function TabelCard(props, ref) {
11101
11133
  formSearch = _useState6[0],
11102
11134
  setFormSearch = _useState6[1];
11103
11135
 
11136
+ var modalFormColumn = deepCopy(columns) || [];
11137
+ var formSearchColumn = deepCopy(columns) || [];
11104
11138
  React.useImperativeHandle(ref, function () {
11105
11139
  return {
11106
11140
  actionRef: actionRef.current,
@@ -11427,14 +11461,14 @@ var TabelCard = function TabelCard(props, ref) {
11427
11461
  var _actionRef$current6;
11428
11462
 
11429
11463
  setFormSearch(values);
11430
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload();
11464
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11431
11465
  };
11432
11466
 
11433
11467
  var onReset = function onReset() {
11434
11468
  var _actionRef$current7;
11435
11469
 
11436
11470
  setFormSearch({});
11437
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload();
11471
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11438
11472
  };
11439
11473
 
11440
11474
  React.useEffect(function () {
@@ -11452,8 +11486,6 @@ var TabelCard = function TabelCard(props, ref) {
11452
11486
  setFormSearch(obj);
11453
11487
  }
11454
11488
  }, [columns]);
11455
- var modalFormColumn = deepCopy(columns) || [];
11456
- var formSearchColumn = columns || [];
11457
11489
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ModalForm$1, _objectSpread2(_objectSpread2({
11458
11490
  ref: modalFormRef,
11459
11491
  title: modalFormConfig.type || '新增',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.5.12",
4
+ "version": "0.5.15",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",