ods-component-lib 1.18.201 → 1.18.202

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.
@@ -14,6 +14,8 @@ declare type FileUploadProps = {
14
14
  RemoveTitle?: string;
15
15
  RemoveOkText?: string;
16
16
  RemoveCancelText?: string;
17
+ skipSizeValidation?: boolean;
18
+ maxFileSizeMB?: number;
17
19
  };
18
20
  interface IValidationMessageOptions {
19
21
  sizeValidationFailMessage?: string;
package/dist/index.js CHANGED
@@ -1931,7 +1931,11 @@ function OdsFileUpload(props) {
1931
1931
  customValidationMessages = props.customValidationMessages,
1932
1932
  RemoveTitle = props.RemoveTitle,
1933
1933
  RemoveOkText = props.RemoveOkText,
1934
- RemoveCancelText = props.RemoveCancelText;
1934
+ RemoveCancelText = props.RemoveCancelText,
1935
+ _props$skipSizeValida = props.skipSizeValidation,
1936
+ skipSizeValidation = _props$skipSizeValida === void 0 ? false : _props$skipSizeValida,
1937
+ _props$maxFileSizeMB = props.maxFileSizeMB,
1938
+ maxFileSizeMB = _props$maxFileSizeMB === void 0 ? 10 : _props$maxFileSizeMB;
1935
1939
  var confirm = antd.Modal.confirm;
1936
1940
  var _useState = React.useState(false),
1937
1941
  previewOpen = _useState[0],
@@ -1991,7 +1995,7 @@ function OdsFileUpload(props) {
1991
1995
  beforeUpload: function (file) {
1992
1996
  try {
1993
1997
  var fileType = allowDocumentUpload ? ["image/png", "image/jpg", "image/jpeg", "image/svg+xml", "application/pdf", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] : ["image/png", "image/jpg", "image/jpeg", "image/svg+xml"];
1994
- var isFileSizeOk = file.size / (1024 * 1024) <= 1;
1998
+ var isFileSizeOk = skipSizeValidation ? true : file.size / (1024 * 1024) <= maxFileSizeMB;
1995
1999
  var checkType = fileType.includes(file.type);
1996
2000
  if (!checkType) {
1997
2001
  OdsNotification({
@@ -2114,7 +2118,8 @@ function OdsFileUpload(props) {
2114
2118
  src: previewSrc
2115
2119
  });
2116
2120
  } else {
2117
- var fileExtension = fileName != "" ? fileName.split(".").pop().toLowerCase() : previewSrc.split(".").pop().toLowerCase();
2121
+ var _fileName$split$pop, _previewSrc$split$pop;
2122
+ var fileExtension = fileName !== "" ? (_fileName$split$pop = fileName.split(".").pop()) === null || _fileName$split$pop === void 0 ? void 0 : _fileName$split$pop.toLowerCase() : (_previewSrc$split$pop = previewSrc.split(".").pop()) === null || _previewSrc$split$pop === void 0 ? void 0 : _previewSrc$split$pop.toLowerCase();
2118
2123
  if (fileExtension === "png" || fileExtension === "jpg" || fileExtension === "jpeg" || fileExtension === "svg") {
2119
2124
  return React__default.createElement("img", {
2120
2125
  alt: fileName == "" ? "file" : fileName,