next-helios-fe 1.8.134 → 1.8.136
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/package.json
CHANGED
@@ -51,9 +51,26 @@ export const File: React.FC<FileProps> = ({
|
|
51
51
|
useEffect(() => {
|
52
52
|
if (value) {
|
53
53
|
setTempFile(value);
|
54
|
+
|
55
|
+
if (value[0]?.size > (options?.maxSizeInMb || 0) * (1024 * 1024)) {
|
56
|
+
inputRef.current?.setCustomValidity(
|
57
|
+
`Please select a file less than ${options?.maxSizeInMb} MB.`
|
58
|
+
);
|
59
|
+
} else {
|
60
|
+
inputRef.current?.setCustomValidity("");
|
61
|
+
}
|
62
|
+
|
54
63
|
return;
|
55
64
|
} else if (defaultValue) {
|
56
65
|
setTempFile(defaultValue);
|
66
|
+
|
67
|
+
if (defaultValue[0]?.size > (options?.maxSizeInMb || 0) * (1024 * 1024)) {
|
68
|
+
inputRef.current?.setCustomValidity(
|
69
|
+
`Please select a file less than ${options?.maxSizeInMb} MB.`
|
70
|
+
);
|
71
|
+
} else {
|
72
|
+
inputRef.current?.setCustomValidity("");
|
73
|
+
}
|
57
74
|
return;
|
58
75
|
}
|
59
76
|
}, [value, defaultValue]);
|
@@ -137,6 +154,7 @@ export const File: React.FC<FileProps> = ({
|
|
137
154
|
) : (
|
138
155
|
<div className="relative flex-1 flex items-center h-full">
|
139
156
|
<input
|
157
|
+
ref={inputRef}
|
140
158
|
type="file"
|
141
159
|
className={`w-full px-4 border-default border border-dashed rounded-md bg-secondary-bg text-transparent cursor-pointer file:hidden focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:cursor-default ${
|
142
160
|
options?.height === "full" ? "min-h-60 h-full" : "h-60"
|
@@ -214,9 +232,11 @@ export const File: React.FC<FileProps> = ({
|
|
214
232
|
>
|
215
233
|
{tempFile.length !== 0
|
216
234
|
? `${
|
217
|
-
tempFile[0]?.size <
|
218
|
-
? `${(tempFile[0]?.size /
|
219
|
-
: `${(tempFile[0]?.size /
|
235
|
+
tempFile[0]?.size < 1024 * 1024
|
236
|
+
? `${(tempFile[0]?.size / 1024).toFixed(2)} KB`
|
237
|
+
: `${(tempFile[0]?.size / (1024 * 1024)).toFixed(
|
238
|
+
2
|
239
|
+
)} MB`
|
220
240
|
}`
|
221
241
|
: `Maximum file size ${options?.maxSizeInMb} MB`}
|
222
242
|
</span>
|
@@ -620,7 +620,8 @@ export const Table: TableComponentProps = ({
|
|
620
620
|
}}
|
621
621
|
/>
|
622
622
|
{((item?.type === "date" &&
|
623
|
-
dateFilter[item.key]?.
|
623
|
+
dateFilter[item.key]?.[0] &&
|
624
|
+
dateFilter[item.key]?.[1]) ||
|
624
625
|
filter?.find((filterItem) => filterItem.key === item.key)
|
625
626
|
?.value) && (
|
626
627
|
<button
|
@@ -637,7 +638,8 @@ export const Table: TableComponentProps = ({
|
|
637
638
|
);
|
638
639
|
} else if (
|
639
640
|
item?.type === "date" &&
|
640
|
-
dateFilter[item.key]?.
|
641
|
+
dateFilter[item.key]?.[0] &&
|
642
|
+
dateFilter[item.key]?.[1]
|
641
643
|
) {
|
642
644
|
const tempDateFilter = { ...dateFilter };
|
643
645
|
|