tp-react-elements-dev 1.5.5 → 1.5.6

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
@@ -52237,7 +52237,7 @@ const FormRenderFileUpload = ({ props }) => {
52237
52237
  ? ".pdf,.jpg,.jpeg,.png,.xls,.xlsx,.doc,.docx"
52238
52238
  : "",
52239
52239
  }, onChange: (event) => {
52240
- var _a, _b, _c, _d, _e;
52240
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
52241
52241
  const file = event.target.files[0];
52242
52242
  const fileName = file ? file.name : null;
52243
52243
  const allowedExtensions = {
@@ -52256,13 +52256,24 @@ const FormRenderFileUpload = ({ props }) => {
52256
52256
  if (((_a = props.item) === null || _a === void 0 ? void 0 : _a.fileType) &&
52257
52257
  fileExtension &&
52258
52258
  !validExtensions.includes(fileExtension)) {
52259
- ((_b = props.item) === null || _b === void 0 ? void 0 : _b.handleFileError) && ((_c = props.item) === null || _c === void 0 ? void 0 : _c.handleFileError(`Please upload ${allowedExtensions[props.item.fileType].join(",")} Files only`));
52259
+ ((_b = props.item) === null || _b === void 0 ? void 0 : _b.handleFileError) &&
52260
+ ((_c = props.item) === null || _c === void 0 ? void 0 : _c.handleFileError(`Please upload ${allowedExtensions[props.item.fileType].join(",")} Files only`));
52261
+ event.target.value = ""; // Clear the file input\
52262
+ props.setValue((_d = props.item) === null || _d === void 0 ? void 0 : _d.name, null);
52263
+ props.setValue(((_e = props.item) === null || _e === void 0 ? void 0 : _e.name) + "Name", "");
52264
+ return;
52265
+ }
52266
+ else if (event.target.files[0].size > 20000000) {
52267
+ ((_f = props.item) === null || _f === void 0 ? void 0 : _f.handleFileError) &&
52268
+ ((_g = props.item) === null || _g === void 0 ? void 0 : _g.handleFileError(`File size should be less than 20MB`));
52260
52269
  event.target.value = ""; // Clear the file input
52270
+ props.setValue((_h = props.item) === null || _h === void 0 ? void 0 : _h.name, null);
52271
+ props.setValue(((_j = props.item) === null || _j === void 0 ? void 0 : _j.name) + "Name", "");
52261
52272
  return;
52262
52273
  }
52263
52274
  // Proceed if valid
52264
- props.setValue((_d = props.item) === null || _d === void 0 ? void 0 : _d.name, file);
52265
- props.setValue(((_e = props.item) === null || _e === void 0 ? void 0 : _e.name) + "Name", fileName);
52275
+ props.setValue((_k = props.item) === null || _k === void 0 ? void 0 : _k.name, file);
52276
+ props.setValue(((_l = props.item) === null || _l === void 0 ? void 0 : _l.name) + "Name", fileName);
52266
52277
  // props?.item?.onChangeFn({
52267
52278
  // [props.item.name]: file,
52268
52279
  // [props.item.name + "Name"]: fileName,