@digital-ai/dot-components 2.24.3 → 2.25.1
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/index.esm.js
CHANGED
|
@@ -10040,29 +10040,35 @@ const renderDropzoneContent = ({
|
|
|
10040
10040
|
}
|
|
10041
10041
|
};
|
|
10042
10042
|
const getUploadedFilesList = ({
|
|
10043
|
+
contentErrors,
|
|
10043
10044
|
maxSize,
|
|
10044
10045
|
onFileClick,
|
|
10045
10046
|
onFileDelete,
|
|
10046
10047
|
uploadedFiles
|
|
10047
10048
|
}) => uploadedFiles.map((fileToBeParsed, index) => parseListItem({
|
|
10049
|
+
contentError: contentErrors && contentErrors.length === uploadedFiles.length ? contentErrors[index] : null,
|
|
10048
10050
|
fileToBeParsed,
|
|
10049
|
-
onFileDelete,
|
|
10050
|
-
onFileClick,
|
|
10051
10051
|
index,
|
|
10052
|
-
maxSize
|
|
10052
|
+
maxSize,
|
|
10053
|
+
onFileDelete,
|
|
10054
|
+
onFileClick
|
|
10053
10055
|
}));
|
|
10054
10056
|
const parseListItem = ({
|
|
10055
|
-
|
|
10056
|
-
onFileClick,
|
|
10057
|
+
contentError,
|
|
10057
10058
|
fileToBeParsed,
|
|
10058
10059
|
index,
|
|
10059
|
-
maxSize
|
|
10060
|
+
maxSize,
|
|
10061
|
+
onFileDelete,
|
|
10062
|
+
onFileClick
|
|
10060
10063
|
}) => {
|
|
10061
10064
|
const fileErrors = fileToBeParsed.errors;
|
|
10062
10065
|
const parsedFile = fileToBeParsed.file;
|
|
10063
|
-
const
|
|
10066
|
+
const hasFileErrors = fileErrors.length > 0;
|
|
10067
|
+
const hasContentError = contentError && contentError !== null;
|
|
10064
10068
|
let errorText;
|
|
10065
|
-
if (
|
|
10069
|
+
if (hasContentError) {
|
|
10070
|
+
errorText = contentError;
|
|
10071
|
+
} else if (hasFileErrors) {
|
|
10066
10072
|
errorText = fileErrors.map(e => {
|
|
10067
10073
|
switch (e.code) {
|
|
10068
10074
|
case 'file-too-large':
|
|
@@ -10079,7 +10085,7 @@ const parseListItem = ({
|
|
|
10079
10085
|
return {
|
|
10080
10086
|
child: jsx(DotFileListItem, {
|
|
10081
10087
|
deleteFile: onFileDelete,
|
|
10082
|
-
error:
|
|
10088
|
+
error: hasContentError || hasFileErrors,
|
|
10083
10089
|
errorText: errorText,
|
|
10084
10090
|
file: {
|
|
10085
10091
|
id: index,
|
|
@@ -10104,6 +10110,7 @@ const DotFileUpload = ({
|
|
|
10104
10110
|
},
|
|
10105
10111
|
buttonOnly: _buttonOnly = false,
|
|
10106
10112
|
className,
|
|
10113
|
+
contentErrors,
|
|
10107
10114
|
'data-pendoid': dataPendoId = rootClassName$7,
|
|
10108
10115
|
'data-testid': dataTestId,
|
|
10109
10116
|
disabled,
|
|
@@ -10160,6 +10167,7 @@ const DotFileUpload = ({
|
|
|
10160
10167
|
onChange(uploadedFiles);
|
|
10161
10168
|
};
|
|
10162
10169
|
const uploadedFilesList = getUploadedFilesList({
|
|
10170
|
+
contentErrors,
|
|
10163
10171
|
maxSize,
|
|
10164
10172
|
onFileClick,
|
|
10165
10173
|
onFileDelete: deleteFile,
|