ods-component-lib 1.18.178 → 1.18.179
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.
|
@@ -8,6 +8,9 @@ declare type FileUploadProps = {
|
|
|
8
8
|
multipleDoc?: boolean;
|
|
9
9
|
removeFile?: (file: any) => void;
|
|
10
10
|
customValidationMessages: IValidationMessageOptions;
|
|
11
|
+
RemoveTitle?: string;
|
|
12
|
+
RemoveOkText?: string;
|
|
13
|
+
RemoveCancelText?: string;
|
|
11
14
|
};
|
|
12
15
|
interface IValidationMessageOptions {
|
|
13
16
|
sizeValidationFailMessage?: string;
|
package/dist/index.js
CHANGED
|
@@ -1753,7 +1753,10 @@ function OdsFileUpload(props) {
|
|
|
1753
1753
|
allowDocumentUpload = _props$allowDocumentU === void 0 ? false : _props$allowDocumentU,
|
|
1754
1754
|
_props$multipleDoc = props.multipleDoc,
|
|
1755
1755
|
multipleDoc = _props$multipleDoc === void 0 ? false : _props$multipleDoc,
|
|
1756
|
-
customValidationMessages = props.customValidationMessages
|
|
1756
|
+
customValidationMessages = props.customValidationMessages,
|
|
1757
|
+
RemoveTitle = props.RemoveTitle,
|
|
1758
|
+
RemoveOkText = props.RemoveOkText,
|
|
1759
|
+
RemoveCancelText = props.RemoveCancelText;
|
|
1757
1760
|
var _useState = React.useState(false),
|
|
1758
1761
|
previewOpen = _useState[0],
|
|
1759
1762
|
setPreviewOpen = _useState[1];
|
|
@@ -1766,6 +1769,7 @@ function OdsFileUpload(props) {
|
|
|
1766
1769
|
var _useState4 = React.useState(""),
|
|
1767
1770
|
previewFileName = _useState4[0],
|
|
1768
1771
|
setPreviewFileName = _useState4[1];
|
|
1772
|
+
var confirm = antd.Modal.confirm;
|
|
1769
1773
|
var getBase64 = function getBase64(img, callback) {
|
|
1770
1774
|
var reader = new FileReader();
|
|
1771
1775
|
reader.addEventListener('load', function () {
|
|
@@ -1848,23 +1852,32 @@ function OdsFileUpload(props) {
|
|
|
1848
1852
|
}
|
|
1849
1853
|
},
|
|
1850
1854
|
onRemove: function onRemove(file) {
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1855
|
+
confirm({
|
|
1856
|
+
title: RemoveTitle ? RemoveTitle : "The image will be deleted, do you confirm?",
|
|
1857
|
+
okText: RemoveOkText ? RemoveOkText : "Ok",
|
|
1858
|
+
cancelText: RemoveCancelText ? RemoveCancelText : "Cancel",
|
|
1859
|
+
onOk: function onOk() {
|
|
1860
|
+
if (!multipleDoc) {
|
|
1861
|
+
setFileList([]);
|
|
1862
|
+
sendDataToParent({
|
|
1863
|
+
base64: null,
|
|
1864
|
+
fileName: null,
|
|
1865
|
+
plainTextBase64: null,
|
|
1866
|
+
id: null
|
|
1867
|
+
});
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
var updatedFileList = fileList.filter(function (item) {
|
|
1871
|
+
return item.uid !== file.uid;
|
|
1872
|
+
});
|
|
1873
|
+
setFileList(updatedFileList);
|
|
1874
|
+
removeFile && removeFile(updatedFileList.map(function (file) {
|
|
1875
|
+
return file.uid;
|
|
1876
|
+
}));
|
|
1877
|
+
},
|
|
1878
|
+
onCancel: function onCancel() {}
|
|
1863
1879
|
});
|
|
1864
|
-
|
|
1865
|
-
removeFile(updatedFileList.map(function (file) {
|
|
1866
|
-
return file.uid;
|
|
1867
|
-
}));
|
|
1880
|
+
return false;
|
|
1868
1881
|
},
|
|
1869
1882
|
onDownload: function onDownload(file) {
|
|
1870
1883
|
downloadFile(file.url, file.thumbUrl, file.name);
|