pixel-react-excel-sheet 1.1.26 → 1.1.27
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/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js +60 -190
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
- package/lib/index.cjs +60 -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/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
|
@@ -41157,216 +41157,85 @@ const ActiveCell = props => {
|
|
|
41157
41157
|
const [selectOption, setSelectOption] = React__namespace.useState(false);
|
|
41158
41158
|
const [allOption, setAllOption] = React__namespace.useState();
|
|
41159
41159
|
const [selectedFiles, setSelectedFiles] = React__namespace.useState([]);
|
|
41160
|
-
|
|
41161
|
-
// newFiles: File[],
|
|
41162
|
-
// selected?: File[],
|
|
41163
|
-
// actionType?: string
|
|
41164
|
-
// ) => {
|
|
41165
|
-
// if (newFiles.length > 5) {
|
|
41166
|
-
// toast.info('Cannot upload more than 5 files.');
|
|
41167
|
-
// return;
|
|
41168
|
-
// }
|
|
41169
|
-
// if (props.attachmentAction?.addAttachment && selected) {
|
|
41170
|
-
// try {
|
|
41171
|
-
// if (actionType === 'ADD' && cell?.inputType?.type === 'file') {
|
|
41172
|
-
// const parsedFiles: File[] = !checkEmpty(cell.value)
|
|
41173
|
-
// ? JSON.parse(cell.value)
|
|
41174
|
-
// : [];
|
|
41175
|
-
// let successCount = 0;
|
|
41176
|
-
// let failureCount = 0;
|
|
41177
|
-
// let duplicateCount = 0;
|
|
41178
|
-
// const nonDuplicateFiles = selected?.filter((file) => {
|
|
41179
|
-
// const isDuplicate = parsedFiles?.some(
|
|
41180
|
-
// (existing) => existing?.name.split('*')[0] === file?.name
|
|
41181
|
-
// );
|
|
41182
|
-
// if (isDuplicate) {
|
|
41183
|
-
// duplicateCount++;
|
|
41184
|
-
// }
|
|
41185
|
-
// return !isDuplicate;
|
|
41186
|
-
// });
|
|
41187
|
-
// const uploadPromises = nonDuplicateFiles?.map(async (file) => {
|
|
41188
|
-
// const response = await props.attachmentAction?.addAttachment(file);
|
|
41189
|
-
// if (!checkEmpty(response)) {
|
|
41190
|
-
// return JSON.parse(response ?? '');
|
|
41191
|
-
// }
|
|
41192
|
-
// });
|
|
41193
|
-
// const results = await Promise.all(uploadPromises);
|
|
41194
|
-
// results.forEach((result) => {
|
|
41195
|
-
// if (result) {
|
|
41196
|
-
// parsedFiles.push(result);
|
|
41197
|
-
// successCount++;
|
|
41198
|
-
// } else {
|
|
41199
|
-
// failureCount++;
|
|
41200
|
-
// }
|
|
41201
|
-
// });
|
|
41202
|
-
// // Update cell value with all successful uploads
|
|
41203
|
-
// handleChange({
|
|
41204
|
-
// ...cell,
|
|
41205
|
-
// value: JSON.stringify(parsedFiles),
|
|
41206
|
-
// style: cell?.style,
|
|
41207
|
-
// inputType: cell?.inputType,
|
|
41208
|
-
// });
|
|
41209
|
-
// setSelectedFiles(parsedFiles);
|
|
41210
|
-
// if (duplicateCount > 0) {
|
|
41211
|
-
// toast.warning(`Duplicate attachments not allowed within the same row`);
|
|
41212
|
-
// } else if (successCount > 0 && failureCount === 0) {
|
|
41213
|
-
// toast.success(
|
|
41214
|
-
// `file${successCount > 1 ? 's' : ''} uploaded successfully.`
|
|
41215
|
-
// );
|
|
41216
|
-
// } else if (failureCount > 0) {
|
|
41217
|
-
// toast.info(
|
|
41218
|
-
// `${failureCount} unsupported ${failureCount > 1 ? 'files' : 'file'}. Please check the file formats.`
|
|
41219
|
-
// );
|
|
41220
|
-
// }
|
|
41221
|
-
// } else if (actionType === 'DELETE') {
|
|
41222
|
-
// const parsedValue = cell && JSON.parse(cell.value);
|
|
41223
|
-
// const updatedFileDetails = [...parsedValue];
|
|
41224
|
-
// for (const file of selected) {
|
|
41225
|
-
// const index = updatedFileDetails.findIndex(
|
|
41226
|
-
// (originalFile: Types.AttachmentApi) => {
|
|
41227
|
-
// return originalFile.name === file.name;
|
|
41228
|
-
// }
|
|
41229
|
-
// );
|
|
41230
|
-
// const fileId = updatedFileDetails[index].id;
|
|
41231
|
-
// if (index !== -1 && fileId) {
|
|
41232
|
-
// const response = await props.attachmentAction?.deleteAttachment(fileId);
|
|
41233
|
-
// if (response) {
|
|
41234
|
-
// updatedFileDetails.splice(index, 1);
|
|
41235
|
-
// handleChange({
|
|
41236
|
-
// ...cell,
|
|
41237
|
-
// value: !checkEmpty(updatedFileDetails)
|
|
41238
|
-
// ? JSON.stringify(updatedFileDetails)
|
|
41239
|
-
// : '',
|
|
41240
|
-
// style: cell?.style,
|
|
41241
|
-
// inputType: cell?.inputType,
|
|
41242
|
-
// });
|
|
41243
|
-
// setSelectedFiles((prevSelectedFiles) => [
|
|
41244
|
-
// ...prevSelectedFiles.filter((f) => f.name !== file.name),
|
|
41245
|
-
// ]);
|
|
41246
|
-
// }
|
|
41247
|
-
// }
|
|
41248
|
-
// }
|
|
41249
|
-
// }
|
|
41250
|
-
// } catch (error) {
|
|
41251
|
-
// toast.error('Attachment operation failed');
|
|
41252
|
-
// console.error('Attachment failed:', error);
|
|
41253
|
-
// }
|
|
41254
|
-
// }
|
|
41255
|
-
// };
|
|
41160
|
+
console.log("Active cell");
|
|
41256
41161
|
const handleFilesChange = async (newFiles, selected, actionType) => {
|
|
41257
41162
|
if (newFiles.length > 5) {
|
|
41258
41163
|
toast.info('Cannot upload more than 5 files.');
|
|
41259
41164
|
return;
|
|
41260
41165
|
}
|
|
41261
|
-
|
|
41166
|
+
console.log(newFiles);
|
|
41167
|
+
console.log(selected);
|
|
41168
|
+
console.log(actionType);
|
|
41169
|
+
if (props.attachmentAction?.addAttachment && selected) {
|
|
41262
41170
|
try {
|
|
41263
|
-
|
|
41264
|
-
|
|
41265
|
-
|
|
41266
|
-
|
|
41267
|
-
|
|
41268
|
-
|
|
41269
|
-
|
|
41270
|
-
|
|
41271
|
-
|
|
41272
|
-
|
|
41273
|
-
|
|
41274
|
-
|
|
41275
|
-
|
|
41276
|
-
toast.warning(`Duplicate attachments not allowed within the same row`);
|
|
41277
|
-
}
|
|
41278
|
-
if (nonDuplicateFiles.length === 0) {
|
|
41279
|
-
return; // No files to upload after filtering duplicates
|
|
41280
|
-
}
|
|
41281
|
-
// Upload non-duplicate files
|
|
41282
|
-
const uploadPromises = nonDuplicateFiles.map(async file => {
|
|
41283
|
-
try {
|
|
41171
|
+
if (actionType === 'ADD' && cell?.inputType?.type === 'file') {
|
|
41172
|
+
const parsedFiles = !checkEmpty(cell.value) ? JSON.parse(cell.value) : [];
|
|
41173
|
+
let successCount = 0;
|
|
41174
|
+
let failureCount = 0;
|
|
41175
|
+
let duplicateCount = 0;
|
|
41176
|
+
const nonDuplicateFiles = selected?.filter(file => {
|
|
41177
|
+
const isDuplicate = parsedFiles?.some(existing => existing?.name.split('*')[0] === file?.name);
|
|
41178
|
+
if (isDuplicate) {
|
|
41179
|
+
duplicateCount++;
|
|
41180
|
+
}
|
|
41181
|
+
return !isDuplicate;
|
|
41182
|
+
});
|
|
41183
|
+
const uploadPromises = nonDuplicateFiles?.map(async file => {
|
|
41284
41184
|
const response = await props.attachmentAction?.addAttachment(file);
|
|
41285
|
-
// Check if response is non-empty
|
|
41286
41185
|
if (!checkEmpty(response)) {
|
|
41287
|
-
|
|
41288
|
-
|
|
41289
|
-
|
|
41290
|
-
|
|
41291
|
-
|
|
41292
|
-
|
|
41293
|
-
|
|
41294
|
-
|
|
41295
|
-
} else {
|
|
41296
|
-
throw new Error('Invalid response structure');
|
|
41297
|
-
}
|
|
41298
|
-
} catch (parseError) {
|
|
41299
|
-
throw parseError;
|
|
41300
|
-
}
|
|
41186
|
+
return JSON.parse(response ?? '');
|
|
41187
|
+
}
|
|
41188
|
+
});
|
|
41189
|
+
const results = await Promise.all(uploadPromises);
|
|
41190
|
+
results.forEach(result => {
|
|
41191
|
+
if (result) {
|
|
41192
|
+
parsedFiles.push(result);
|
|
41193
|
+
successCount++;
|
|
41301
41194
|
} else {
|
|
41302
|
-
|
|
41195
|
+
failureCount++;
|
|
41303
41196
|
}
|
|
41304
|
-
}
|
|
41305
|
-
|
|
41306
|
-
file,
|
|
41307
|
-
error
|
|
41308
|
-
}; // Capture errors for individual files
|
|
41309
|
-
}
|
|
41310
|
-
});
|
|
41311
|
-
const results = await Promise.all(uploadPromises);
|
|
41312
|
-
// Process results
|
|
41313
|
-
const successfulUploads = [];
|
|
41314
|
-
results.forEach(({
|
|
41315
|
-
file,
|
|
41316
|
-
result,
|
|
41317
|
-
error
|
|
41318
|
-
}) => {
|
|
41319
|
-
if (result && !error) {
|
|
41320
|
-
successfulUploads.push(result);
|
|
41321
|
-
successCount++;
|
|
41322
|
-
} else {
|
|
41323
|
-
failureCount++;
|
|
41324
|
-
console.error(`Failed to upload file ${file?.name}:`, error);
|
|
41325
|
-
}
|
|
41326
|
-
});
|
|
41327
|
-
// Update cell value with successful uploads
|
|
41328
|
-
if (successCount > 0) {
|
|
41329
|
-
const updatedFiles = [...parsedFiles, ...successfulUploads];
|
|
41197
|
+
});
|
|
41198
|
+
// Update cell value with all successful uploads
|
|
41330
41199
|
handleChange({
|
|
41331
41200
|
...cell,
|
|
41332
|
-
value: JSON.stringify(
|
|
41201
|
+
value: JSON.stringify(parsedFiles),
|
|
41333
41202
|
style: cell?.style,
|
|
41334
41203
|
inputType: cell?.inputType
|
|
41335
41204
|
});
|
|
41336
|
-
setSelectedFiles(
|
|
41337
|
-
|
|
41338
|
-
|
|
41339
|
-
|
|
41340
|
-
|
|
41341
|
-
|
|
41342
|
-
|
|
41343
|
-
|
|
41344
|
-
|
|
41345
|
-
|
|
41346
|
-
|
|
41347
|
-
|
|
41348
|
-
|
|
41349
|
-
|
|
41350
|
-
|
|
41351
|
-
|
|
41352
|
-
|
|
41353
|
-
|
|
41354
|
-
|
|
41355
|
-
|
|
41356
|
-
|
|
41357
|
-
|
|
41358
|
-
|
|
41359
|
-
|
|
41360
|
-
|
|
41361
|
-
|
|
41362
|
-
|
|
41363
|
-
|
|
41205
|
+
setSelectedFiles(parsedFiles);
|
|
41206
|
+
if (duplicateCount > 0) {
|
|
41207
|
+
toast.warning(`Duplicate attachments not allowed within the same row`);
|
|
41208
|
+
} else if (successCount > 0 && failureCount === 0) {
|
|
41209
|
+
toast.success(`file${successCount > 1 ? 's' : ''} uploaded successfully.`);
|
|
41210
|
+
} else if (failureCount > 0) {
|
|
41211
|
+
toast.info(`${failureCount} unsupported ${failureCount > 1 ? 'files' : 'file'}. Please check the file formats.`);
|
|
41212
|
+
}
|
|
41213
|
+
} else if (actionType === 'DELETE') {
|
|
41214
|
+
const parsedValue = cell && JSON.parse(cell.value);
|
|
41215
|
+
const updatedFileDetails = [...parsedValue];
|
|
41216
|
+
for (const file of selected) {
|
|
41217
|
+
const index = updatedFileDetails.findIndex(originalFile => {
|
|
41218
|
+
return originalFile.name === file.name;
|
|
41219
|
+
});
|
|
41220
|
+
const fileId = updatedFileDetails[index].id;
|
|
41221
|
+
if (index !== -1 && fileId) {
|
|
41222
|
+
const response = await props.attachmentAction?.deleteAttachment(fileId);
|
|
41223
|
+
if (response) {
|
|
41224
|
+
updatedFileDetails.splice(index, 1);
|
|
41225
|
+
handleChange({
|
|
41226
|
+
...cell,
|
|
41227
|
+
value: !checkEmpty(updatedFileDetails) ? JSON.stringify(updatedFileDetails) : '',
|
|
41228
|
+
style: cell?.style,
|
|
41229
|
+
inputType: cell?.inputType
|
|
41230
|
+
});
|
|
41231
|
+
setSelectedFiles(prevSelectedFiles => [...prevSelectedFiles.filter(f => f.name !== file.name)]);
|
|
41232
|
+
}
|
|
41364
41233
|
}
|
|
41365
41234
|
}
|
|
41366
41235
|
}
|
|
41367
41236
|
} catch (error) {
|
|
41368
41237
|
toast.error('Attachment operation failed');
|
|
41369
|
-
console.error('
|
|
41238
|
+
console.error('Attachment failed:', error);
|
|
41370
41239
|
}
|
|
41371
41240
|
}
|
|
41372
41241
|
};
|
|
@@ -41492,6 +41361,7 @@ const ActiveCell = props => {
|
|
|
41492
41361
|
selectedFiles: selectedFiles,
|
|
41493
41362
|
onFilesChange: handleFilesChange,
|
|
41494
41363
|
disabled: false,
|
|
41364
|
+
maxFileSizeMB: 5,
|
|
41495
41365
|
maxFiles: 5,
|
|
41496
41366
|
buttonLabel: "+ Attachments",
|
|
41497
41367
|
buttonVariant: "tertiary",
|