wargerm 0.5.25 → 0.5.28
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/components/Upload/example/demo2.d.ts +3 -0
- package/dist/components/WForm/example/demo1.d.ts +3 -0
- package/dist/components/WForm/example/demo2.d.ts +3 -0
- package/dist/components/WForm/example/demo3.d.ts +3 -0
- package/dist/components/WForm/index.d.ts +1 -0
- package/dist/index.esm.js +112 -63
- package/dist/index.js +114 -65
- package/package.json +2 -1
@@ -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
@@ -11,12 +11,11 @@ import 'antd/es/input/style';
|
|
11
11
|
import _Input from 'antd/es/input';
|
12
12
|
import 'antd/es/modal/style';
|
13
13
|
import _Modal from 'antd/es/modal';
|
14
|
-
import 'antd/es/progress/style';
|
15
|
-
import _Progress from 'antd/es/progress';
|
16
|
-
import 'antd/es/upload/style';
|
17
|
-
import _Upload from 'antd/es/upload';
|
18
14
|
import 'antd/es/message/style';
|
19
15
|
import _message from 'antd/es/message';
|
16
|
+
import 'antd/es/upload/style';
|
17
|
+
import _Upload from 'antd/es/upload';
|
18
|
+
import FileViewer from 'react-file-viewer';
|
20
19
|
import 'antd/es/input-number/style';
|
21
20
|
import _InputNumber from 'antd/es/input-number';
|
22
21
|
import 'antd/es/pagination/style';
|
@@ -586,7 +585,8 @@ var Index = WInput;
|
|
586
585
|
Index.TextArea = _Input.TextArea;
|
587
586
|
WInput.defaultProps = {};
|
588
587
|
|
589
|
-
var _excluded$1 = ["value", "onChange", "onRemove", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList"];
|
588
|
+
var _excluded$1 = ["value", "onChange", "onRemove", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList", "type"];
|
589
|
+
var Dragger = _Upload.Dragger;
|
590
590
|
|
591
591
|
function Index$1(_ref, ref) {
|
592
592
|
var value = _ref.value,
|
@@ -599,6 +599,7 @@ function Index$1(_ref, ref) {
|
|
599
599
|
splitStr = _ref$splitStr === void 0 ? ',' : _ref$splitStr,
|
600
600
|
fetchMethod = _ref.fetchMethod,
|
601
601
|
getFileList = _ref.getFileList,
|
602
|
+
type = _ref.type,
|
602
603
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
603
604
|
|
604
605
|
var _useState = useState([]),
|
@@ -615,13 +616,14 @@ function Index$1(_ref, ref) {
|
|
615
616
|
setFileList(value ? value.split(splitStr).map(function (url) {
|
616
617
|
return {
|
617
618
|
uid: Math.random().toString(36).slice(2, 36),
|
618
|
-
name:
|
619
|
+
name: url,
|
619
620
|
status: 'done',
|
620
621
|
url: url
|
621
622
|
};
|
622
623
|
}) : []);
|
623
624
|
}, [value]);
|
624
625
|
useEffect(function () {
|
626
|
+
console.log(fileList);
|
625
627
|
getFileList && getFileList(fileList.map(function (file) {
|
626
628
|
return file.url;
|
627
629
|
}), fileList);
|
@@ -675,30 +677,53 @@ function Index$1(_ref, ref) {
|
|
675
677
|
}
|
676
678
|
|
677
679
|
return beforeUpload ? beforeUpload(file) : isJpgOrPng && isLt2M;
|
678
|
-
};
|
679
|
-
// if (file.status === 'done') {
|
680
|
-
// file.url = file.response;
|
681
|
-
// const urls = newFileList.map(file => file.url).join(splitStr)
|
682
|
-
// onChange && onChange(urls)
|
683
|
-
// }
|
684
|
-
// setFileList(newFileList)
|
685
|
-
// };
|
686
|
-
|
680
|
+
};
|
687
681
|
|
688
|
-
var
|
689
|
-
var
|
690
|
-
var
|
682
|
+
var handleChange = /*#__PURE__*/function () {
|
683
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref2) {
|
684
|
+
var file, newFileList, urls;
|
691
685
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
692
686
|
while (1) {
|
693
687
|
switch (_context.prev = _context.next) {
|
688
|
+
case 0:
|
689
|
+
file = _ref2.file, newFileList = _ref2.fileList;
|
690
|
+
|
691
|
+
if (file.status === 'done' || file.status === 'removed') {
|
692
|
+
file.url = file.response;
|
693
|
+
urls = newFileList.map(function (file) {
|
694
|
+
return file.url;
|
695
|
+
}).join(splitStr);
|
696
|
+
onChange && onChange(urls);
|
697
|
+
} // setFileList(newFileList)
|
698
|
+
|
699
|
+
|
700
|
+
case 2:
|
701
|
+
case "end":
|
702
|
+
return _context.stop();
|
703
|
+
}
|
704
|
+
}
|
705
|
+
}, _callee);
|
706
|
+
}));
|
707
|
+
|
708
|
+
return function handleChange(_x) {
|
709
|
+
return _ref3.apply(this, arguments);
|
710
|
+
};
|
711
|
+
}();
|
712
|
+
|
713
|
+
var request = /*#__PURE__*/function () {
|
714
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(options) {
|
715
|
+
var onSuccess, onError, file, onProgress, url, fileObj, newFileList;
|
716
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
717
|
+
while (1) {
|
718
|
+
switch (_context2.prev = _context2.next) {
|
694
719
|
case 0:
|
695
720
|
onSuccess = options.onSuccess, onError = options.onError, file = options.file, onProgress = options.onProgress;
|
696
|
-
|
697
|
-
|
721
|
+
_context2.prev = 1;
|
722
|
+
_context2.next = 4;
|
698
723
|
return fetchMethod ? fetchMethod(file) : getBase64(file);
|
699
724
|
|
700
725
|
case 4:
|
701
|
-
url =
|
726
|
+
url = _context2.sent;
|
702
727
|
|
703
728
|
if (url) {
|
704
729
|
fileObj = {
|
@@ -711,35 +736,31 @@ function Index$1(_ref, ref) {
|
|
711
736
|
xhr: onProgress
|
712
737
|
};
|
713
738
|
newFileList = [].concat(_toConsumableArray(fileList), [fileObj]);
|
714
|
-
urls = newFileList.map(function (file) {
|
715
|
-
return file.url;
|
716
|
-
}).join(splitStr);
|
717
|
-
onChange && onChange(urls);
|
718
739
|
setFileList(newFileList);
|
719
740
|
onSuccess(url, file);
|
720
741
|
}
|
721
742
|
|
722
|
-
|
743
|
+
_context2.next = 12;
|
723
744
|
break;
|
724
745
|
|
725
746
|
case 8:
|
726
|
-
|
727
|
-
|
728
|
-
console.log("Eroor: ",
|
747
|
+
_context2.prev = 8;
|
748
|
+
_context2.t0 = _context2["catch"](1);
|
749
|
+
console.log("Eroor: ", _context2.t0);
|
729
750
|
onError({
|
730
|
-
err:
|
751
|
+
err: _context2.t0
|
731
752
|
});
|
732
753
|
|
733
754
|
case 12:
|
734
755
|
case "end":
|
735
|
-
return
|
756
|
+
return _context2.stop();
|
736
757
|
}
|
737
758
|
}
|
738
|
-
},
|
759
|
+
}, _callee2, null, [[1, 8]]);
|
739
760
|
}));
|
740
761
|
|
741
|
-
return function request(
|
742
|
-
return
|
762
|
+
return function request(_x2) {
|
763
|
+
return _ref4.apply(this, arguments);
|
743
764
|
};
|
744
765
|
}();
|
745
766
|
|
@@ -760,21 +781,21 @@ function Index$1(_ref, ref) {
|
|
760
781
|
};
|
761
782
|
|
762
783
|
var handlePreview = /*#__PURE__*/function () {
|
763
|
-
var
|
764
|
-
return regeneratorRuntime.wrap(function
|
784
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(file) {
|
785
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
765
786
|
while (1) {
|
766
|
-
switch (
|
787
|
+
switch (_context3.prev = _context3.next) {
|
767
788
|
case 0:
|
768
789
|
if (!(!file.url && !file.preview)) {
|
769
|
-
|
790
|
+
_context3.next = 4;
|
770
791
|
break;
|
771
792
|
}
|
772
793
|
|
773
|
-
|
794
|
+
_context3.next = 3;
|
774
795
|
return getBase64(file.originFileObj);
|
775
796
|
|
776
797
|
case 3:
|
777
|
-
file.preview =
|
798
|
+
file.preview = _context3.sent;
|
778
799
|
|
779
800
|
case 4:
|
780
801
|
setPreviewImage(file.url || file.preview);
|
@@ -783,14 +804,14 @@ function Index$1(_ref, ref) {
|
|
783
804
|
|
784
805
|
case 7:
|
785
806
|
case "end":
|
786
|
-
return
|
807
|
+
return _context3.stop();
|
787
808
|
}
|
788
809
|
}
|
789
|
-
},
|
810
|
+
}, _callee3);
|
790
811
|
}));
|
791
812
|
|
792
|
-
return function handlePreview(
|
793
|
-
return
|
813
|
+
return function handlePreview(_x3) {
|
814
|
+
return _ref5.apply(this, arguments);
|
794
815
|
};
|
795
816
|
}();
|
796
817
|
|
@@ -804,17 +825,35 @@ function Index$1(_ref, ref) {
|
|
804
825
|
fileList: fileList
|
805
826
|
};
|
806
827
|
});
|
807
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
828
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, type == 'dragger' ? /*#__PURE__*/React.createElement(Dragger, _objectSpread2({
|
829
|
+
fileList: fileList,
|
830
|
+
onPreview: handlePreview,
|
831
|
+
onChange: handleChange,
|
832
|
+
onRemove: handleronRemove,
|
833
|
+
customRequest: request,
|
834
|
+
onProgress: function onProgress(_ref6) {
|
835
|
+
var percent = _ref6.percent;
|
836
|
+
console.log("progre...", percent);
|
837
|
+
|
838
|
+
if (percent === 100) {
|
839
|
+
setTimeout(function () {
|
840
|
+
return setProgress(0);
|
841
|
+
}, 1000);
|
842
|
+
}
|
843
|
+
|
844
|
+
return setProgress(Math.floor(percent));
|
845
|
+
}
|
846
|
+
}, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom) : /*#__PURE__*/React.createElement(_Upload, _objectSpread2({
|
808
847
|
accept: "image/*",
|
809
848
|
fileList: fileList,
|
810
849
|
listType: "picture-card",
|
811
850
|
beforeUpload: beforeUploadIn,
|
812
851
|
onPreview: handlePreview,
|
813
|
-
|
852
|
+
onChange: handleChange,
|
814
853
|
onRemove: handleronRemove,
|
815
854
|
customRequest: request,
|
816
|
-
onProgress: function onProgress(
|
817
|
-
var percent =
|
855
|
+
onProgress: function onProgress(_ref7) {
|
856
|
+
var percent = _ref7.percent;
|
818
857
|
console.log("progre...", percent);
|
819
858
|
|
820
859
|
if (percent === 100) {
|
@@ -825,14 +864,19 @@ function Index$1(_ref, ref) {
|
|
825
864
|
|
826
865
|
return setProgress(Math.floor(percent));
|
827
866
|
}
|
828
|
-
}, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom),
|
829
|
-
percent: progress
|
830
|
-
}) : null, /*#__PURE__*/React.createElement(_Modal, {
|
867
|
+
}, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom), /*#__PURE__*/React.createElement(_Modal, {
|
831
868
|
visible: previewVisible,
|
832
869
|
title: previewTitle,
|
833
870
|
footer: null,
|
834
871
|
onCancel: handleCancel
|
835
|
-
}, /*#__PURE__*/React.createElement(
|
872
|
+
}, type == 'dragger' ? /*#__PURE__*/React.createElement(FileViewer, {
|
873
|
+
fileType: previewTitle.slice(previewTitle.lastIndexOf('.') + 1) || previewImage.slice(previewImage.lastIndexOf('.') + 1) || '',
|
874
|
+
filePath: previewImage,
|
875
|
+
errorComponent: /*#__PURE__*/React.createElement(React.Fragment, null, "".concat(previewTitle.slice(previewTitle.lastIndexOf('.') + 1) || previewImage.slice(previewImage.lastIndexOf('.') + 1) || '', " \u7C7B\u578B\u4E0D\u652F\u6301\u9884\u89C8\uFF01")),
|
876
|
+
onError: function onError(err) {
|
877
|
+
console.log(err);
|
878
|
+
}
|
879
|
+
}) : /*#__PURE__*/React.createElement("img", {
|
836
880
|
alt: "example",
|
837
881
|
style: {
|
838
882
|
width: '100%'
|
@@ -7148,7 +7192,7 @@ var WCascader = function WCascader(props) {
|
|
7148
7192
|
}, extraProps));
|
7149
7193
|
};
|
7150
7194
|
|
7151
|
-
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"];
|
7152
7196
|
var RangePicker$2 = Index$6.RangePicker;
|
7153
7197
|
|
7154
7198
|
var WForm = function WForm(props, ref) {
|
@@ -7164,6 +7208,7 @@ var WForm = function WForm(props, ref) {
|
|
7164
7208
|
onSubmit = props.onSubmit,
|
7165
7209
|
onReset = props.onReset,
|
7166
7210
|
setForm = props.setForm,
|
7211
|
+
deps = props.deps,
|
7167
7212
|
extraProps = _objectWithoutProperties(props, _excluded$7);
|
7168
7213
|
|
7169
7214
|
var _Form$useForm = _Form.useForm(),
|
@@ -7702,8 +7747,8 @@ var WForm = function WForm(props, ref) {
|
|
7702
7747
|
return renderItemForm(c);
|
7703
7748
|
}
|
7704
7749
|
});
|
7705
|
-
}, [changedValues, columns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
|
7706
|
-
]);
|
7750
|
+
}, [changedValues, columns, disabled].concat(_toConsumableArray(deps ? [deps] : []), [JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
|
7751
|
+
]));
|
7707
7752
|
var filterExtraColumnsForm = useMemo(function () {
|
7708
7753
|
return filterExtraFormColumns.map(function (c) {
|
7709
7754
|
if (c.type == 'group') {
|
@@ -7714,7 +7759,7 @@ var WForm = function WForm(props, ref) {
|
|
7714
7759
|
return renderItemForm(c);
|
7715
7760
|
}
|
7716
7761
|
});
|
7717
|
-
}, [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())]));
|
7718
7763
|
|
7719
7764
|
var handleSearch = function handleSearch(v) {
|
7720
7765
|
var searchForm = form.getFieldsValue();
|
@@ -7849,7 +7894,7 @@ var WForm = function WForm(props, ref) {
|
|
7849
7894
|
|
7850
7895
|
filterFormColumns.forEach(function (c) {
|
7851
7896
|
if (c.search && c.search.transformSetForm) {
|
7852
|
-
var transformObj = c.search.transformSetForm(setFieldsValues[c.dataIndex]);
|
7897
|
+
var transformObj = c.search.transformSetForm(setFieldsValues[c.dataIndex], setFieldsValues);
|
7853
7898
|
setFieldsValues = _objectSpread2(_objectSpread2({}, setFieldsValues), transformObj);
|
7854
7899
|
|
7855
7900
|
if (!transformObj[c.dataIndex]) {
|
@@ -10455,7 +10500,7 @@ function DragBox(_ref) {
|
|
10455
10500
|
}, children)) : /*#__PURE__*/React.createElement(React.Fragment, null);
|
10456
10501
|
}
|
10457
10502
|
|
10458
|
-
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"];
|
10459
10504
|
|
10460
10505
|
var ModalForm = function ModalForm(props, ref) {
|
10461
10506
|
var columns = props.columns,
|
@@ -10472,6 +10517,9 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10472
10517
|
onFormChange = props.onFormChange,
|
10473
10518
|
formItemChild = props.formItemChild,
|
10474
10519
|
onCancel = props.onCancel,
|
10520
|
+
modalHeaderSolt = props.modalHeaderSolt,
|
10521
|
+
modalFooterSolt = props.modalFooterSolt,
|
10522
|
+
formProps = props.formProps,
|
10475
10523
|
extraProps = _objectWithoutProperties(props, _excluded$h);
|
10476
10524
|
|
10477
10525
|
var formRef = useRef(null);
|
@@ -10602,7 +10650,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10602
10650
|
onOk: handleOk,
|
10603
10651
|
confirmLoading: confirmLoading,
|
10604
10652
|
onCancel: handleCancel
|
10605
|
-
}, extraProps), /*#__PURE__*/React.createElement(WForm$1, {
|
10653
|
+
}, extraProps), modalHeaderSolt, /*#__PURE__*/React.createElement(WForm$1, _objectSpread2({
|
10606
10654
|
ref: formRef,
|
10607
10655
|
disabled: disabled,
|
10608
10656
|
onSubmit: onSubmit,
|
@@ -10612,12 +10660,12 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10612
10660
|
search: search,
|
10613
10661
|
columns: columns,
|
10614
10662
|
extraColumns: extraColumns
|
10615
|
-
}), title == '查看' && formItemChild ? formItemChild() : null);
|
10663
|
+
}, formProps || {})), title == '查看' && formItemChild ? formItemChild() : null, modalFooterSolt);
|
10616
10664
|
};
|
10617
10665
|
|
10618
10666
|
var ModalForm$1 = /*#__PURE__*/React.forwardRef(ModalForm);
|
10619
10667
|
|
10620
|
-
var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10668
|
+
var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "searchFormConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10621
10669
|
|
10622
10670
|
var TabelCard = function TabelCard(props, ref) {
|
10623
10671
|
var columns = props.columns,
|
@@ -10632,6 +10680,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10632
10680
|
style = props.style,
|
10633
10681
|
onFormChange = props.onFormChange,
|
10634
10682
|
modalConfig = props.modalConfig,
|
10683
|
+
searchFormConfig = props.searchFormConfig,
|
10635
10684
|
optionColumnConfig = props.optionColumnConfig,
|
10636
10685
|
pagination = props.pagination,
|
10637
10686
|
noBordered = props.noBordered,
|
@@ -11078,7 +11127,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11078
11127
|
|
11079
11128
|
return true;
|
11080
11129
|
})
|
11081
|
-
})), /*#__PURE__*/React.createElement(WForm$1, {
|
11130
|
+
})), /*#__PURE__*/React.createElement(WForm$1, _objectSpread2({
|
11082
11131
|
ref: searchFormRef,
|
11083
11132
|
disabledRuler: true,
|
11084
11133
|
search: search == false ? {
|
@@ -11102,7 +11151,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11102
11151
|
return [].concat(_toConsumableArray(pre), [column]);
|
11103
11152
|
}
|
11104
11153
|
}, [])
|
11105
|
-
}), /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
|
11154
|
+
}, searchFormConfig || {})), /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
|
11106
11155
|
actionRef: actionRef,
|
11107
11156
|
rowKey: "id",
|
11108
11157
|
bordered: !noBordered,
|
package/dist/index.js
CHANGED
@@ -15,12 +15,11 @@ require('antd/es/input/style');
|
|
15
15
|
var _Input = require('antd/es/input');
|
16
16
|
require('antd/es/modal/style');
|
17
17
|
var _Modal = require('antd/es/modal');
|
18
|
-
require('antd/es/progress/style');
|
19
|
-
var _Progress = require('antd/es/progress');
|
20
|
-
require('antd/es/upload/style');
|
21
|
-
var _Upload = require('antd/es/upload');
|
22
18
|
require('antd/es/message/style');
|
23
19
|
var _message = require('antd/es/message');
|
20
|
+
require('antd/es/upload/style');
|
21
|
+
var _Upload = require('antd/es/upload');
|
22
|
+
var FileViewer = require('react-file-viewer');
|
24
23
|
require('antd/es/input-number/style');
|
25
24
|
var _InputNumber = require('antd/es/input-number');
|
26
25
|
require('antd/es/pagination/style');
|
@@ -95,9 +94,9 @@ var _Dropdown__default = /*#__PURE__*/_interopDefaultLegacy(_Dropdown);
|
|
95
94
|
var _Menu__default = /*#__PURE__*/_interopDefaultLegacy(_Menu);
|
96
95
|
var _Input__default = /*#__PURE__*/_interopDefaultLegacy(_Input);
|
97
96
|
var _Modal__default = /*#__PURE__*/_interopDefaultLegacy(_Modal);
|
98
|
-
var _Progress__default = /*#__PURE__*/_interopDefaultLegacy(_Progress);
|
99
|
-
var _Upload__default = /*#__PURE__*/_interopDefaultLegacy(_Upload);
|
100
97
|
var _message__default = /*#__PURE__*/_interopDefaultLegacy(_message);
|
98
|
+
var _Upload__default = /*#__PURE__*/_interopDefaultLegacy(_Upload);
|
99
|
+
var FileViewer__default = /*#__PURE__*/_interopDefaultLegacy(FileViewer);
|
101
100
|
var _InputNumber__default = /*#__PURE__*/_interopDefaultLegacy(_InputNumber);
|
102
101
|
var _Pagination__default = /*#__PURE__*/_interopDefaultLegacy(_Pagination);
|
103
102
|
var _Spin__default = /*#__PURE__*/_interopDefaultLegacy(_Spin);
|
@@ -647,7 +646,8 @@ var Index = WInput;
|
|
647
646
|
Index.TextArea = _Input__default['default'].TextArea;
|
648
647
|
WInput.defaultProps = {};
|
649
648
|
|
650
|
-
var _excluded$1 = ["value", "onChange", "onRemove", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList"];
|
649
|
+
var _excluded$1 = ["value", "onChange", "onRemove", "beforeUpload", "uploadButton", "maxCount", "splitStr", "fetchMethod", "getFileList", "type"];
|
650
|
+
var Dragger = _Upload__default['default'].Dragger;
|
651
651
|
|
652
652
|
function Index$1(_ref, ref) {
|
653
653
|
var value = _ref.value,
|
@@ -660,6 +660,7 @@ function Index$1(_ref, ref) {
|
|
660
660
|
splitStr = _ref$splitStr === void 0 ? ',' : _ref$splitStr,
|
661
661
|
fetchMethod = _ref.fetchMethod,
|
662
662
|
getFileList = _ref.getFileList,
|
663
|
+
type = _ref.type,
|
663
664
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
664
665
|
|
665
666
|
var _useState = React.useState([]),
|
@@ -676,13 +677,14 @@ function Index$1(_ref, ref) {
|
|
676
677
|
setFileList(value ? value.split(splitStr).map(function (url) {
|
677
678
|
return {
|
678
679
|
uid: Math.random().toString(36).slice(2, 36),
|
679
|
-
name:
|
680
|
+
name: url,
|
680
681
|
status: 'done',
|
681
682
|
url: url
|
682
683
|
};
|
683
684
|
}) : []);
|
684
685
|
}, [value]);
|
685
686
|
React.useEffect(function () {
|
687
|
+
console.log(fileList);
|
686
688
|
getFileList && getFileList(fileList.map(function (file) {
|
687
689
|
return file.url;
|
688
690
|
}), fileList);
|
@@ -736,30 +738,53 @@ function Index$1(_ref, ref) {
|
|
736
738
|
}
|
737
739
|
|
738
740
|
return beforeUpload ? beforeUpload(file) : isJpgOrPng && isLt2M;
|
739
|
-
};
|
740
|
-
// if (file.status === 'done') {
|
741
|
-
// file.url = file.response;
|
742
|
-
// const urls = newFileList.map(file => file.url).join(splitStr)
|
743
|
-
// onChange && onChange(urls)
|
744
|
-
// }
|
745
|
-
// setFileList(newFileList)
|
746
|
-
// };
|
747
|
-
|
741
|
+
};
|
748
742
|
|
749
|
-
var
|
750
|
-
var
|
751
|
-
var
|
743
|
+
var handleChange = /*#__PURE__*/function () {
|
744
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref2) {
|
745
|
+
var file, newFileList, urls;
|
752
746
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
753
747
|
while (1) {
|
754
748
|
switch (_context.prev = _context.next) {
|
749
|
+
case 0:
|
750
|
+
file = _ref2.file, newFileList = _ref2.fileList;
|
751
|
+
|
752
|
+
if (file.status === 'done' || file.status === 'removed') {
|
753
|
+
file.url = file.response;
|
754
|
+
urls = newFileList.map(function (file) {
|
755
|
+
return file.url;
|
756
|
+
}).join(splitStr);
|
757
|
+
onChange && onChange(urls);
|
758
|
+
} // setFileList(newFileList)
|
759
|
+
|
760
|
+
|
761
|
+
case 2:
|
762
|
+
case "end":
|
763
|
+
return _context.stop();
|
764
|
+
}
|
765
|
+
}
|
766
|
+
}, _callee);
|
767
|
+
}));
|
768
|
+
|
769
|
+
return function handleChange(_x) {
|
770
|
+
return _ref3.apply(this, arguments);
|
771
|
+
};
|
772
|
+
}();
|
773
|
+
|
774
|
+
var request = /*#__PURE__*/function () {
|
775
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(options) {
|
776
|
+
var onSuccess, onError, file, onProgress, url, fileObj, newFileList;
|
777
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
778
|
+
while (1) {
|
779
|
+
switch (_context2.prev = _context2.next) {
|
755
780
|
case 0:
|
756
781
|
onSuccess = options.onSuccess, onError = options.onError, file = options.file, onProgress = options.onProgress;
|
757
|
-
|
758
|
-
|
782
|
+
_context2.prev = 1;
|
783
|
+
_context2.next = 4;
|
759
784
|
return fetchMethod ? fetchMethod(file) : getBase64(file);
|
760
785
|
|
761
786
|
case 4:
|
762
|
-
url =
|
787
|
+
url = _context2.sent;
|
763
788
|
|
764
789
|
if (url) {
|
765
790
|
fileObj = {
|
@@ -772,35 +797,31 @@ function Index$1(_ref, ref) {
|
|
772
797
|
xhr: onProgress
|
773
798
|
};
|
774
799
|
newFileList = [].concat(_toConsumableArray(fileList), [fileObj]);
|
775
|
-
urls = newFileList.map(function (file) {
|
776
|
-
return file.url;
|
777
|
-
}).join(splitStr);
|
778
|
-
onChange && onChange(urls);
|
779
800
|
setFileList(newFileList);
|
780
801
|
onSuccess(url, file);
|
781
802
|
}
|
782
803
|
|
783
|
-
|
804
|
+
_context2.next = 12;
|
784
805
|
break;
|
785
806
|
|
786
807
|
case 8:
|
787
|
-
|
788
|
-
|
789
|
-
console.log("Eroor: ",
|
808
|
+
_context2.prev = 8;
|
809
|
+
_context2.t0 = _context2["catch"](1);
|
810
|
+
console.log("Eroor: ", _context2.t0);
|
790
811
|
onError({
|
791
|
-
err:
|
812
|
+
err: _context2.t0
|
792
813
|
});
|
793
814
|
|
794
815
|
case 12:
|
795
816
|
case "end":
|
796
|
-
return
|
817
|
+
return _context2.stop();
|
797
818
|
}
|
798
819
|
}
|
799
|
-
},
|
820
|
+
}, _callee2, null, [[1, 8]]);
|
800
821
|
}));
|
801
822
|
|
802
|
-
return function request(
|
803
|
-
return
|
823
|
+
return function request(_x2) {
|
824
|
+
return _ref4.apply(this, arguments);
|
804
825
|
};
|
805
826
|
}();
|
806
827
|
|
@@ -821,21 +842,21 @@ function Index$1(_ref, ref) {
|
|
821
842
|
};
|
822
843
|
|
823
844
|
var handlePreview = /*#__PURE__*/function () {
|
824
|
-
var
|
825
|
-
return regeneratorRuntime.wrap(function
|
845
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(file) {
|
846
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
826
847
|
while (1) {
|
827
|
-
switch (
|
848
|
+
switch (_context3.prev = _context3.next) {
|
828
849
|
case 0:
|
829
850
|
if (!(!file.url && !file.preview)) {
|
830
|
-
|
851
|
+
_context3.next = 4;
|
831
852
|
break;
|
832
853
|
}
|
833
854
|
|
834
|
-
|
855
|
+
_context3.next = 3;
|
835
856
|
return getBase64(file.originFileObj);
|
836
857
|
|
837
858
|
case 3:
|
838
|
-
file.preview =
|
859
|
+
file.preview = _context3.sent;
|
839
860
|
|
840
861
|
case 4:
|
841
862
|
setPreviewImage(file.url || file.preview);
|
@@ -844,14 +865,14 @@ function Index$1(_ref, ref) {
|
|
844
865
|
|
845
866
|
case 7:
|
846
867
|
case "end":
|
847
|
-
return
|
868
|
+
return _context3.stop();
|
848
869
|
}
|
849
870
|
}
|
850
|
-
},
|
871
|
+
}, _callee3);
|
851
872
|
}));
|
852
873
|
|
853
|
-
return function handlePreview(
|
854
|
-
return
|
874
|
+
return function handlePreview(_x3) {
|
875
|
+
return _ref5.apply(this, arguments);
|
855
876
|
};
|
856
877
|
}();
|
857
878
|
|
@@ -865,17 +886,35 @@ function Index$1(_ref, ref) {
|
|
865
886
|
fileList: fileList
|
866
887
|
};
|
867
888
|
});
|
868
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(
|
889
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, type == 'dragger' ? /*#__PURE__*/React__default['default'].createElement(Dragger, _objectSpread2({
|
890
|
+
fileList: fileList,
|
891
|
+
onPreview: handlePreview,
|
892
|
+
onChange: handleChange,
|
893
|
+
onRemove: handleronRemove,
|
894
|
+
customRequest: request,
|
895
|
+
onProgress: function onProgress(_ref6) {
|
896
|
+
var percent = _ref6.percent;
|
897
|
+
console.log("progre...", percent);
|
898
|
+
|
899
|
+
if (percent === 100) {
|
900
|
+
setTimeout(function () {
|
901
|
+
return setProgress(0);
|
902
|
+
}, 1000);
|
903
|
+
}
|
904
|
+
|
905
|
+
return setProgress(Math.floor(percent));
|
906
|
+
}
|
907
|
+
}, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom) : /*#__PURE__*/React__default['default'].createElement(_Upload__default['default'], _objectSpread2({
|
869
908
|
accept: "image/*",
|
870
909
|
fileList: fileList,
|
871
910
|
listType: "picture-card",
|
872
911
|
beforeUpload: beforeUploadIn,
|
873
912
|
onPreview: handlePreview,
|
874
|
-
|
913
|
+
onChange: handleChange,
|
875
914
|
onRemove: handleronRemove,
|
876
915
|
customRequest: request,
|
877
|
-
onProgress: function onProgress(
|
878
|
-
var percent =
|
916
|
+
onProgress: function onProgress(_ref7) {
|
917
|
+
var percent = _ref7.percent;
|
879
918
|
console.log("progre...", percent);
|
880
919
|
|
881
920
|
if (percent === 100) {
|
@@ -886,14 +925,19 @@ function Index$1(_ref, ref) {
|
|
886
925
|
|
887
926
|
return setProgress(Math.floor(percent));
|
888
927
|
}
|
889
|
-
}, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom),
|
890
|
-
percent: progress
|
891
|
-
}) : null, /*#__PURE__*/React__default['default'].createElement(_Modal__default['default'], {
|
928
|
+
}, props), fileList.length >= maxCount ? null : uploadButton ? uploadButton : uploadButtonDom), /*#__PURE__*/React__default['default'].createElement(_Modal__default['default'], {
|
892
929
|
visible: previewVisible,
|
893
930
|
title: previewTitle,
|
894
931
|
footer: null,
|
895
932
|
onCancel: handleCancel
|
896
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
933
|
+
}, type == 'dragger' ? /*#__PURE__*/React__default['default'].createElement(FileViewer__default['default'], {
|
934
|
+
fileType: previewTitle.slice(previewTitle.lastIndexOf('.') + 1) || previewImage.slice(previewImage.lastIndexOf('.') + 1) || '',
|
935
|
+
filePath: previewImage,
|
936
|
+
errorComponent: /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "".concat(previewTitle.slice(previewTitle.lastIndexOf('.') + 1) || previewImage.slice(previewImage.lastIndexOf('.') + 1) || '', " \u7C7B\u578B\u4E0D\u652F\u6301\u9884\u89C8\uFF01")),
|
937
|
+
onError: function onError(err) {
|
938
|
+
console.log(err);
|
939
|
+
}
|
940
|
+
}) : /*#__PURE__*/React__default['default'].createElement("img", {
|
897
941
|
alt: "example",
|
898
942
|
style: {
|
899
943
|
width: '100%'
|
@@ -7209,7 +7253,7 @@ var WCascader = function WCascader(props) {
|
|
7209
7253
|
}, extraProps));
|
7210
7254
|
};
|
7211
7255
|
|
7212
|
-
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"];
|
7213
7257
|
var RangePicker$2 = Index$6.RangePicker;
|
7214
7258
|
|
7215
7259
|
var WForm = function WForm(props, ref) {
|
@@ -7225,6 +7269,7 @@ var WForm = function WForm(props, ref) {
|
|
7225
7269
|
onSubmit = props.onSubmit,
|
7226
7270
|
onReset = props.onReset,
|
7227
7271
|
setForm = props.setForm,
|
7272
|
+
deps = props.deps,
|
7228
7273
|
extraProps = _objectWithoutProperties(props, _excluded$7);
|
7229
7274
|
|
7230
7275
|
var _Form$useForm = _Form__default['default'].useForm(),
|
@@ -7763,8 +7808,8 @@ var WForm = function WForm(props, ref) {
|
|
7763
7808
|
return renderItemForm(c);
|
7764
7809
|
}
|
7765
7810
|
});
|
7766
|
-
}, [changedValues, columns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
|
7767
|
-
]);
|
7811
|
+
}, [changedValues, columns, disabled].concat(_toConsumableArray(deps ? [deps] : []), [JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue()) // 依赖值改变,需要重新渲染
|
7812
|
+
]));
|
7768
7813
|
var filterExtraColumnsForm = React.useMemo(function () {
|
7769
7814
|
return filterExtraFormColumns.map(function (c) {
|
7770
7815
|
if (c.type == 'group') {
|
@@ -7775,7 +7820,7 @@ var WForm = function WForm(props, ref) {
|
|
7775
7820
|
return renderItemForm(c);
|
7776
7821
|
}
|
7777
7822
|
});
|
7778
|
-
}, [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())]));
|
7779
7824
|
|
7780
7825
|
var handleSearch = function handleSearch(v) {
|
7781
7826
|
var searchForm = form.getFieldsValue();
|
@@ -7910,7 +7955,7 @@ var WForm = function WForm(props, ref) {
|
|
7910
7955
|
|
7911
7956
|
filterFormColumns.forEach(function (c) {
|
7912
7957
|
if (c.search && c.search.transformSetForm) {
|
7913
|
-
var transformObj = c.search.transformSetForm(setFieldsValues[c.dataIndex]);
|
7958
|
+
var transformObj = c.search.transformSetForm(setFieldsValues[c.dataIndex], setFieldsValues);
|
7914
7959
|
setFieldsValues = _objectSpread2(_objectSpread2({}, setFieldsValues), transformObj);
|
7915
7960
|
|
7916
7961
|
if (!transformObj[c.dataIndex]) {
|
@@ -10516,7 +10561,7 @@ function DragBox(_ref) {
|
|
10516
10561
|
}, children)) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
10517
10562
|
}
|
10518
10563
|
|
10519
|
-
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"];
|
10520
10565
|
|
10521
10566
|
var ModalForm = function ModalForm(props, ref) {
|
10522
10567
|
var columns = props.columns,
|
@@ -10533,6 +10578,9 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10533
10578
|
onFormChange = props.onFormChange,
|
10534
10579
|
formItemChild = props.formItemChild,
|
10535
10580
|
onCancel = props.onCancel,
|
10581
|
+
modalHeaderSolt = props.modalHeaderSolt,
|
10582
|
+
modalFooterSolt = props.modalFooterSolt,
|
10583
|
+
formProps = props.formProps,
|
10536
10584
|
extraProps = _objectWithoutProperties(props, _excluded$h);
|
10537
10585
|
|
10538
10586
|
var formRef = React.useRef(null);
|
@@ -10663,7 +10711,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10663
10711
|
onOk: handleOk,
|
10664
10712
|
confirmLoading: confirmLoading,
|
10665
10713
|
onCancel: handleCancel
|
10666
|
-
}, extraProps), /*#__PURE__*/React__default['default'].createElement(WForm$1, {
|
10714
|
+
}, extraProps), modalHeaderSolt, /*#__PURE__*/React__default['default'].createElement(WForm$1, _objectSpread2({
|
10667
10715
|
ref: formRef,
|
10668
10716
|
disabled: disabled,
|
10669
10717
|
onSubmit: onSubmit,
|
@@ -10673,12 +10721,12 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10673
10721
|
search: search,
|
10674
10722
|
columns: columns,
|
10675
10723
|
extraColumns: extraColumns
|
10676
|
-
}), title == '查看' && formItemChild ? formItemChild() : null);
|
10724
|
+
}, formProps || {})), title == '查看' && formItemChild ? formItemChild() : null, modalFooterSolt);
|
10677
10725
|
};
|
10678
10726
|
|
10679
10727
|
var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
|
10680
10728
|
|
10681
|
-
var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10729
|
+
var _excluded$i = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "searchFormConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10682
10730
|
|
10683
10731
|
var TabelCard = function TabelCard(props, ref) {
|
10684
10732
|
var columns = props.columns,
|
@@ -10693,6 +10741,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10693
10741
|
style = props.style,
|
10694
10742
|
onFormChange = props.onFormChange,
|
10695
10743
|
modalConfig = props.modalConfig,
|
10744
|
+
searchFormConfig = props.searchFormConfig,
|
10696
10745
|
optionColumnConfig = props.optionColumnConfig,
|
10697
10746
|
pagination = props.pagination,
|
10698
10747
|
noBordered = props.noBordered,
|
@@ -11139,7 +11188,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11139
11188
|
|
11140
11189
|
return true;
|
11141
11190
|
})
|
11142
|
-
})), /*#__PURE__*/React__default['default'].createElement(WForm$1, {
|
11191
|
+
})), /*#__PURE__*/React__default['default'].createElement(WForm$1, _objectSpread2({
|
11143
11192
|
ref: searchFormRef,
|
11144
11193
|
disabledRuler: true,
|
11145
11194
|
search: search == false ? {
|
@@ -11163,7 +11212,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11163
11212
|
return [].concat(_toConsumableArray(pre), [column]);
|
11164
11213
|
}
|
11165
11214
|
}, [])
|
11166
|
-
}), /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
|
11215
|
+
}, searchFormConfig || {})), /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
|
11167
11216
|
actionRef: actionRef,
|
11168
11217
|
rowKey: "id",
|
11169
11218
|
bordered: !noBordered,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"private": false,
|
3
3
|
"name": "wargerm",
|
4
|
-
"version": "0.5.
|
4
|
+
"version": "0.5.28",
|
5
5
|
"scripts": {
|
6
6
|
"dev": "dumi dev",
|
7
7
|
"docs:build": "dumi build",
|
@@ -52,6 +52,7 @@
|
|
52
52
|
"echarts-for-react": "^3.0.2",
|
53
53
|
"react-countup": "^6.0.0",
|
54
54
|
"react-dom": "^17.0.2",
|
55
|
+
"react-file-viewer": "^1.2.1",
|
55
56
|
"swiper": "^6.7.0",
|
56
57
|
"xgplayer": "^2.31.6",
|
57
58
|
"xgplayer-flv": "^2.5.1",
|