pixel-priya 1.2.8 → 1.2.9
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/lib/_virtual/index10.js +2 -2
- package/lib/_virtual/index11.js +2 -2
- package/lib/_virtual/index9.js +2 -2
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js +57 -190
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
- package/lib/index.cjs +57 -190
- package/lib/index.cjs.map +1 -1
- package/lib/node_modules/js-beautify/js/src/css/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/css/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/tokenizer.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/tokenizer.js +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -40439,216 +40439,81 @@ const ActiveCell = props => {
|
|
|
40439
40439
|
const [selectOption, setSelectOption] = React__namespace.useState(false);
|
|
40440
40440
|
const [allOption, setAllOption] = React__namespace.useState();
|
|
40441
40441
|
const [selectedFiles, setSelectedFiles] = React__namespace.useState([]);
|
|
40442
|
-
// const handleFilesChange = async (
|
|
40443
|
-
// newFiles: File[],
|
|
40444
|
-
// selected?: File[],
|
|
40445
|
-
// actionType?: string
|
|
40446
|
-
// ) => {
|
|
40447
|
-
// if (newFiles.length > 5) {
|
|
40448
|
-
// toast.info('Cannot upload more than 5 files.');
|
|
40449
|
-
// return;
|
|
40450
|
-
// }
|
|
40451
|
-
// if (props.attachmentAction?.addAttachment && selected) {
|
|
40452
|
-
// try {
|
|
40453
|
-
// if (actionType === 'ADD' && cell?.inputType?.type === 'file') {
|
|
40454
|
-
// const parsedFiles: File[] = !checkEmpty(cell.value)
|
|
40455
|
-
// ? JSON.parse(cell.value)
|
|
40456
|
-
// : [];
|
|
40457
|
-
// let successCount = 0;
|
|
40458
|
-
// let failureCount = 0;
|
|
40459
|
-
// let duplicateCount = 0;
|
|
40460
|
-
// const nonDuplicateFiles = selected?.filter((file) => {
|
|
40461
|
-
// const isDuplicate = parsedFiles?.some(
|
|
40462
|
-
// (existing) => existing?.name.split('*')[0] === file?.name
|
|
40463
|
-
// );
|
|
40464
|
-
// if (isDuplicate) {
|
|
40465
|
-
// duplicateCount++;
|
|
40466
|
-
// }
|
|
40467
|
-
// return !isDuplicate;
|
|
40468
|
-
// });
|
|
40469
|
-
// const uploadPromises = nonDuplicateFiles?.map(async (file) => {
|
|
40470
|
-
// const response = await props.attachmentAction?.addAttachment(file);
|
|
40471
|
-
// if (!checkEmpty(response)) {
|
|
40472
|
-
// return JSON.parse(response ?? '');
|
|
40473
|
-
// }
|
|
40474
|
-
// });
|
|
40475
|
-
// const results = await Promise.all(uploadPromises);
|
|
40476
|
-
// results.forEach((result) => {
|
|
40477
|
-
// if (result) {
|
|
40478
|
-
// parsedFiles.push(result);
|
|
40479
|
-
// successCount++;
|
|
40480
|
-
// } else {
|
|
40481
|
-
// failureCount++;
|
|
40482
|
-
// }
|
|
40483
|
-
// });
|
|
40484
|
-
// // Update cell value with all successful uploads
|
|
40485
|
-
// handleChange({
|
|
40486
|
-
// ...cell,
|
|
40487
|
-
// value: JSON.stringify(parsedFiles),
|
|
40488
|
-
// style: cell?.style,
|
|
40489
|
-
// inputType: cell?.inputType,
|
|
40490
|
-
// });
|
|
40491
|
-
// setSelectedFiles(parsedFiles);
|
|
40492
|
-
// if (duplicateCount > 0) {
|
|
40493
|
-
// toast.warning(`Duplicate attachments not allowed within the same row`);
|
|
40494
|
-
// } else if (successCount > 0 && failureCount === 0) {
|
|
40495
|
-
// toast.success(
|
|
40496
|
-
// `file${successCount > 1 ? 's' : ''} uploaded successfully.`
|
|
40497
|
-
// );
|
|
40498
|
-
// } else if (failureCount > 0) {
|
|
40499
|
-
// toast.info(
|
|
40500
|
-
// `${failureCount} unsupported ${failureCount > 1 ? 'files' : 'file'}. Please check the file formats.`
|
|
40501
|
-
// );
|
|
40502
|
-
// }
|
|
40503
|
-
// } else if (actionType === 'DELETE') {
|
|
40504
|
-
// const parsedValue = cell && JSON.parse(cell.value);
|
|
40505
|
-
// const updatedFileDetails = [...parsedValue];
|
|
40506
|
-
// for (const file of selected) {
|
|
40507
|
-
// const index = updatedFileDetails.findIndex(
|
|
40508
|
-
// (originalFile: Types.AttachmentApi) => {
|
|
40509
|
-
// return originalFile.name === file.name;
|
|
40510
|
-
// }
|
|
40511
|
-
// );
|
|
40512
|
-
// const fileId = updatedFileDetails[index].id;
|
|
40513
|
-
// if (index !== -1 && fileId) {
|
|
40514
|
-
// const response = await props.attachmentAction?.deleteAttachment(fileId);
|
|
40515
|
-
// if (response) {
|
|
40516
|
-
// updatedFileDetails.splice(index, 1);
|
|
40517
|
-
// handleChange({
|
|
40518
|
-
// ...cell,
|
|
40519
|
-
// value: !checkEmpty(updatedFileDetails)
|
|
40520
|
-
// ? JSON.stringify(updatedFileDetails)
|
|
40521
|
-
// : '',
|
|
40522
|
-
// style: cell?.style,
|
|
40523
|
-
// inputType: cell?.inputType,
|
|
40524
|
-
// });
|
|
40525
|
-
// setSelectedFiles((prevSelectedFiles) => [
|
|
40526
|
-
// ...prevSelectedFiles.filter((f) => f.name !== file.name),
|
|
40527
|
-
// ]);
|
|
40528
|
-
// }
|
|
40529
|
-
// }
|
|
40530
|
-
// }
|
|
40531
|
-
// }
|
|
40532
|
-
// } catch (error) {
|
|
40533
|
-
// toast.error('Attachment operation failed');
|
|
40534
|
-
// console.error('Attachment failed:', error);
|
|
40535
|
-
// }
|
|
40536
|
-
// }
|
|
40537
|
-
// };
|
|
40538
40442
|
const handleFilesChange = async (newFiles, selected, actionType) => {
|
|
40539
40443
|
if (newFiles.length > 5) {
|
|
40540
40444
|
toast.info('Cannot upload more than 5 files.');
|
|
40541
40445
|
return;
|
|
40542
40446
|
}
|
|
40543
|
-
if (props.attachmentAction?.addAttachment && selected
|
|
40447
|
+
if (props.attachmentAction?.addAttachment && selected) {
|
|
40544
40448
|
try {
|
|
40545
|
-
|
|
40546
|
-
|
|
40547
|
-
|
|
40548
|
-
|
|
40549
|
-
|
|
40550
|
-
|
|
40551
|
-
|
|
40552
|
-
|
|
40553
|
-
|
|
40554
|
-
|
|
40555
|
-
|
|
40556
|
-
|
|
40557
|
-
|
|
40558
|
-
toast.warning(`Duplicate attachments not allowed within the same row`);
|
|
40559
|
-
}
|
|
40560
|
-
if (nonDuplicateFiles.length === 0) {
|
|
40561
|
-
return; // No files to upload after filtering duplicates
|
|
40562
|
-
}
|
|
40563
|
-
// Upload non-duplicate files
|
|
40564
|
-
const uploadPromises = nonDuplicateFiles.map(async file => {
|
|
40565
|
-
try {
|
|
40449
|
+
if (actionType === 'ADD' && cell?.inputType?.type === 'file') {
|
|
40450
|
+
const parsedFiles = !checkEmpty(cell.value) ? JSON.parse(cell.value) : [];
|
|
40451
|
+
let successCount = 0;
|
|
40452
|
+
let failureCount = 0;
|
|
40453
|
+
let duplicateCount = 0;
|
|
40454
|
+
const nonDuplicateFiles = selected?.filter(file => {
|
|
40455
|
+
const isDuplicate = parsedFiles?.some(existing => existing?.name.split('*')[0] === file?.name);
|
|
40456
|
+
if (isDuplicate) {
|
|
40457
|
+
duplicateCount++;
|
|
40458
|
+
}
|
|
40459
|
+
return !isDuplicate;
|
|
40460
|
+
});
|
|
40461
|
+
const uploadPromises = nonDuplicateFiles?.map(async file => {
|
|
40566
40462
|
const response = await props.attachmentAction?.addAttachment(file);
|
|
40567
|
-
// Check if response is non-empty
|
|
40568
40463
|
if (!checkEmpty(response)) {
|
|
40569
|
-
|
|
40570
|
-
|
|
40571
|
-
|
|
40572
|
-
|
|
40573
|
-
|
|
40574
|
-
|
|
40575
|
-
|
|
40576
|
-
|
|
40577
|
-
} else {
|
|
40578
|
-
throw new Error('Invalid response structure');
|
|
40579
|
-
}
|
|
40580
|
-
} catch (parseError) {
|
|
40581
|
-
throw parseError;
|
|
40582
|
-
}
|
|
40464
|
+
return JSON.parse(response ?? '');
|
|
40465
|
+
}
|
|
40466
|
+
});
|
|
40467
|
+
const results = await Promise.all(uploadPromises);
|
|
40468
|
+
results.forEach(result => {
|
|
40469
|
+
if (result) {
|
|
40470
|
+
parsedFiles.push(result);
|
|
40471
|
+
successCount++;
|
|
40583
40472
|
} else {
|
|
40584
|
-
|
|
40473
|
+
failureCount++;
|
|
40585
40474
|
}
|
|
40586
|
-
}
|
|
40587
|
-
|
|
40588
|
-
file,
|
|
40589
|
-
error
|
|
40590
|
-
}; // Capture errors for individual files
|
|
40591
|
-
}
|
|
40592
|
-
});
|
|
40593
|
-
const results = await Promise.all(uploadPromises);
|
|
40594
|
-
// Process results
|
|
40595
|
-
const successfulUploads = [];
|
|
40596
|
-
results.forEach(({
|
|
40597
|
-
file,
|
|
40598
|
-
result,
|
|
40599
|
-
error
|
|
40600
|
-
}) => {
|
|
40601
|
-
if (result && !error) {
|
|
40602
|
-
successfulUploads.push(result);
|
|
40603
|
-
successCount++;
|
|
40604
|
-
} else {
|
|
40605
|
-
failureCount++;
|
|
40606
|
-
console.error(`Failed to upload file ${file?.name}:`, error);
|
|
40607
|
-
}
|
|
40608
|
-
});
|
|
40609
|
-
// Update cell value with successful uploads
|
|
40610
|
-
if (successCount > 0) {
|
|
40611
|
-
const updatedFiles = [...parsedFiles, ...successfulUploads];
|
|
40475
|
+
});
|
|
40476
|
+
// Update cell value with all successful uploads
|
|
40612
40477
|
handleChange({
|
|
40613
40478
|
...cell,
|
|
40614
|
-
value: JSON.stringify(
|
|
40479
|
+
value: JSON.stringify(parsedFiles),
|
|
40615
40480
|
style: cell?.style,
|
|
40616
40481
|
inputType: cell?.inputType
|
|
40617
40482
|
});
|
|
40618
|
-
setSelectedFiles(
|
|
40619
|
-
|
|
40620
|
-
|
|
40621
|
-
|
|
40622
|
-
|
|
40623
|
-
|
|
40624
|
-
|
|
40625
|
-
|
|
40626
|
-
|
|
40627
|
-
|
|
40628
|
-
|
|
40629
|
-
|
|
40630
|
-
|
|
40631
|
-
|
|
40632
|
-
|
|
40633
|
-
|
|
40634
|
-
|
|
40635
|
-
|
|
40636
|
-
|
|
40637
|
-
|
|
40638
|
-
|
|
40639
|
-
|
|
40640
|
-
|
|
40641
|
-
|
|
40642
|
-
|
|
40643
|
-
|
|
40644
|
-
|
|
40645
|
-
|
|
40483
|
+
setSelectedFiles(parsedFiles);
|
|
40484
|
+
if (duplicateCount > 0) {
|
|
40485
|
+
toast.warning(`Duplicate attachments not allowed within the same row`);
|
|
40486
|
+
} else if (successCount > 0 && failureCount === 0) {
|
|
40487
|
+
toast.success(`file${successCount > 1 ? 's' : ''} uploaded successfully.`);
|
|
40488
|
+
} else if (failureCount > 0) {
|
|
40489
|
+
toast.info(`${failureCount} unsupported ${failureCount > 1 ? 'files' : 'file'}. Please check the file formats.`);
|
|
40490
|
+
}
|
|
40491
|
+
} else if (actionType === 'DELETE') {
|
|
40492
|
+
const parsedValue = cell && JSON.parse(cell.value);
|
|
40493
|
+
const updatedFileDetails = [...parsedValue];
|
|
40494
|
+
for (const file of selected) {
|
|
40495
|
+
const index = updatedFileDetails.findIndex(originalFile => {
|
|
40496
|
+
return originalFile.name === file.name;
|
|
40497
|
+
});
|
|
40498
|
+
const fileId = updatedFileDetails[index].id;
|
|
40499
|
+
if (index !== -1 && fileId) {
|
|
40500
|
+
const response = await props.attachmentAction?.deleteAttachment(fileId);
|
|
40501
|
+
if (response) {
|
|
40502
|
+
updatedFileDetails.splice(index, 1);
|
|
40503
|
+
handleChange({
|
|
40504
|
+
...cell,
|
|
40505
|
+
value: !checkEmpty(updatedFileDetails) ? JSON.stringify(updatedFileDetails) : '',
|
|
40506
|
+
style: cell?.style,
|
|
40507
|
+
inputType: cell?.inputType
|
|
40508
|
+
});
|
|
40509
|
+
setSelectedFiles(prevSelectedFiles => [...prevSelectedFiles.filter(f => f.name !== file.name)]);
|
|
40510
|
+
}
|
|
40646
40511
|
}
|
|
40647
40512
|
}
|
|
40648
40513
|
}
|
|
40649
40514
|
} catch (error) {
|
|
40650
40515
|
toast.error('Attachment operation failed');
|
|
40651
|
-
console.error('
|
|
40516
|
+
console.error('Attachment failed:', error);
|
|
40652
40517
|
}
|
|
40653
40518
|
}
|
|
40654
40519
|
};
|
|
@@ -40736,6 +40601,7 @@ const ActiveCell = props => {
|
|
|
40736
40601
|
options: props.contextOption?.options || []
|
|
40737
40602
|
});
|
|
40738
40603
|
}, [props]);
|
|
40604
|
+
console.log("Hi Sharan");
|
|
40739
40605
|
return jsxRuntime.jsxs("div", {
|
|
40740
40606
|
ref: rootRef,
|
|
40741
40607
|
className: classNames('ff-spreadsheet-active-cell', `ff-spreadsheet-active-cell--${mode}`),
|
|
@@ -40774,6 +40640,7 @@ const ActiveCell = props => {
|
|
|
40774
40640
|
selectedFiles: selectedFiles,
|
|
40775
40641
|
onFilesChange: handleFilesChange,
|
|
40776
40642
|
disabled: false,
|
|
40643
|
+
maxFileSizeMB: 5,
|
|
40777
40644
|
maxFiles: 5,
|
|
40778
40645
|
buttonLabel: "+ Attachments",
|
|
40779
40646
|
buttonVariant: "tertiary",
|