pixel-priya 1.2.8 → 1.2.10
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 +58 -190
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
- package/lib/index.cjs +58 -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/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,82 @@ 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) => {
|
|
40443
|
+
console.log('working');
|
|
40539
40444
|
if (newFiles.length > 5) {
|
|
40540
40445
|
toast.info('Cannot upload more than 5 files.');
|
|
40541
40446
|
return;
|
|
40542
40447
|
}
|
|
40543
|
-
if (props.attachmentAction?.addAttachment && selected
|
|
40448
|
+
if (props.attachmentAction?.addAttachment && selected) {
|
|
40544
40449
|
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 {
|
|
40450
|
+
if (actionType === 'ADD' && cell?.inputType?.type === 'file') {
|
|
40451
|
+
const parsedFiles = !checkEmpty(cell.value) ? JSON.parse(cell.value) : [];
|
|
40452
|
+
let successCount = 0;
|
|
40453
|
+
let failureCount = 0;
|
|
40454
|
+
let duplicateCount = 0;
|
|
40455
|
+
const nonDuplicateFiles = selected?.filter(file => {
|
|
40456
|
+
const isDuplicate = parsedFiles?.some(existing => existing?.name.split('*')[0] === file?.name);
|
|
40457
|
+
if (isDuplicate) {
|
|
40458
|
+
duplicateCount++;
|
|
40459
|
+
}
|
|
40460
|
+
return !isDuplicate;
|
|
40461
|
+
});
|
|
40462
|
+
const uploadPromises = nonDuplicateFiles?.map(async file => {
|
|
40566
40463
|
const response = await props.attachmentAction?.addAttachment(file);
|
|
40567
|
-
// Check if response is non-empty
|
|
40568
40464
|
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
|
-
}
|
|
40465
|
+
return JSON.parse(response ?? '');
|
|
40466
|
+
}
|
|
40467
|
+
});
|
|
40468
|
+
const results = await Promise.all(uploadPromises);
|
|
40469
|
+
results.forEach(result => {
|
|
40470
|
+
if (result) {
|
|
40471
|
+
parsedFiles.push(result);
|
|
40472
|
+
successCount++;
|
|
40583
40473
|
} else {
|
|
40584
|
-
|
|
40474
|
+
failureCount++;
|
|
40585
40475
|
}
|
|
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];
|
|
40476
|
+
});
|
|
40477
|
+
// Update cell value with all successful uploads
|
|
40612
40478
|
handleChange({
|
|
40613
40479
|
...cell,
|
|
40614
|
-
value: JSON.stringify(
|
|
40480
|
+
value: JSON.stringify(parsedFiles),
|
|
40615
40481
|
style: cell?.style,
|
|
40616
40482
|
inputType: cell?.inputType
|
|
40617
40483
|
});
|
|
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
|
-
|
|
40484
|
+
setSelectedFiles(parsedFiles);
|
|
40485
|
+
if (duplicateCount > 0) {
|
|
40486
|
+
toast.warning(`Duplicate attachments not allowed within the same row`);
|
|
40487
|
+
} else if (successCount > 0 && failureCount === 0) {
|
|
40488
|
+
toast.success(`file${successCount > 1 ? 's' : ''} uploaded successfully.`);
|
|
40489
|
+
} else if (failureCount > 0) {
|
|
40490
|
+
toast.info(`${failureCount} unsupported ${failureCount > 1 ? 'files' : 'file'}. Please check the file formats.`);
|
|
40491
|
+
}
|
|
40492
|
+
} else if (actionType === 'DELETE') {
|
|
40493
|
+
const parsedValue = cell && JSON.parse(cell.value);
|
|
40494
|
+
const updatedFileDetails = [...parsedValue];
|
|
40495
|
+
for (const file of selected) {
|
|
40496
|
+
const index = updatedFileDetails.findIndex(originalFile => {
|
|
40497
|
+
return originalFile.name === file.name;
|
|
40498
|
+
});
|
|
40499
|
+
const fileId = updatedFileDetails[index].id;
|
|
40500
|
+
if (index !== -1 && fileId) {
|
|
40501
|
+
const response = await props.attachmentAction?.deleteAttachment(fileId);
|
|
40502
|
+
if (response) {
|
|
40503
|
+
updatedFileDetails.splice(index, 1);
|
|
40504
|
+
handleChange({
|
|
40505
|
+
...cell,
|
|
40506
|
+
value: !checkEmpty(updatedFileDetails) ? JSON.stringify(updatedFileDetails) : '',
|
|
40507
|
+
style: cell?.style,
|
|
40508
|
+
inputType: cell?.inputType
|
|
40509
|
+
});
|
|
40510
|
+
setSelectedFiles(prevSelectedFiles => [...prevSelectedFiles.filter(f => f.name !== file.name)]);
|
|
40511
|
+
}
|
|
40646
40512
|
}
|
|
40647
40513
|
}
|
|
40648
40514
|
}
|
|
40649
40515
|
} catch (error) {
|
|
40650
40516
|
toast.error('Attachment operation failed');
|
|
40651
|
-
console.error('
|
|
40517
|
+
console.error('Attachment failed:', error);
|
|
40652
40518
|
}
|
|
40653
40519
|
}
|
|
40654
40520
|
};
|
|
@@ -40736,6 +40602,7 @@ const ActiveCell = props => {
|
|
|
40736
40602
|
options: props.contextOption?.options || []
|
|
40737
40603
|
});
|
|
40738
40604
|
}, [props]);
|
|
40605
|
+
console.log("Hi Sharan");
|
|
40739
40606
|
return jsxRuntime.jsxs("div", {
|
|
40740
40607
|
ref: rootRef,
|
|
40741
40608
|
className: classNames('ff-spreadsheet-active-cell', `ff-spreadsheet-active-cell--${mode}`),
|
|
@@ -40774,6 +40641,7 @@ const ActiveCell = props => {
|
|
|
40774
40641
|
selectedFiles: selectedFiles,
|
|
40775
40642
|
onFilesChange: handleFilesChange,
|
|
40776
40643
|
disabled: false,
|
|
40644
|
+
maxFileSizeMB: 5,
|
|
40777
40645
|
maxFiles: 5,
|
|
40778
40646
|
buttonLabel: "+ Attachments",
|
|
40779
40647
|
buttonVariant: "tertiary",
|