gantri-components 2.127.0-beta.6 → 2.127.0-beta.7
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/dist/components/file-uploader/file-uploader.types.d.ts +7 -2
- package/dist/components/file-uploader/hooks/use-uploader-actions/hooks/use-handle-selected-files/use-handle-selected-files.types.d.ts +1 -1
- package/dist/components/file-uploader/hooks/use-uploader-actions/use-uploader-actions.types.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ export type FileUploaderProps = {
|
|
|
12
12
|
fileUrl: string;
|
|
13
13
|
/** This function should delete the record from the database, ***then*** delete the file. */
|
|
14
14
|
handleDeleteFile: HandleDeleteFile;
|
|
15
|
+
/** Provide this if supporting multiple uploads to prevent multiple calls to update the database. Should be paired with checking against `isMultipleFiles` in `handleUploadFile` args. */
|
|
16
|
+
handleMultiUploadComplete?: HandleMultiUploadComplete;
|
|
15
17
|
inputName?: string;
|
|
16
18
|
isActive?: boolean;
|
|
17
19
|
isDisabled?: boolean;
|
|
@@ -42,11 +44,13 @@ export type HandleFileDeleteArgs = {
|
|
|
42
44
|
export type DeleteFile = (options?: {
|
|
43
45
|
isReplacing?: boolean;
|
|
44
46
|
}) => Promise<void>;
|
|
45
|
-
export type HandleUploadFile = (props: SelectedFileDetails) => Promise<
|
|
47
|
+
export type HandleUploadFile = (props: SelectedFileDetails) => Promise<UploadedFileDetails>;
|
|
48
|
+
export type HandleMultiUploadComplete = (...uploadedFiles: UploadedFileDetails[]) => Promise<void>;
|
|
49
|
+
export type UploadedFileDetails = {
|
|
46
50
|
[key: string]: any;
|
|
47
51
|
fileName: string;
|
|
48
52
|
fileUrl: string;
|
|
49
|
-
}
|
|
53
|
+
};
|
|
50
54
|
/** Applicable to Firebase uploads. */
|
|
51
55
|
export interface FileMetaData {
|
|
52
56
|
contentType: string;
|
|
@@ -56,6 +60,7 @@ export interface SelectedFileDetails {
|
|
|
56
60
|
fileBlob: Blob;
|
|
57
61
|
fileName: string;
|
|
58
62
|
fileSize: number;
|
|
63
|
+
isMultipleFiles: boolean;
|
|
59
64
|
metadata: FileMetaData;
|
|
60
65
|
}
|
|
61
66
|
/** If invalid, return the error message to display. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { SelectedFileDetails, FileUploaderProps } from '../../../../file-uploader.types';
|
|
3
3
|
import { OptionalValues } from '../../../../../../types/common';
|
|
4
|
-
export type UseHandleSelectedFilesProps = OptionalValues<Required<Pick<FileUploaderProps, 'expectedExtensions' | 'fileUrl' | 'handleFileSelected' | 'isUploaderOnly' | '
|
|
4
|
+
export type UseHandleSelectedFilesProps = OptionalValues<Required<Pick<FileUploaderProps, 'expectedExtensions' | 'fileUrl' | 'handleFileSelected' | 'handleMultiUploadComplete' | 'isUploaderOnly' | 'maxFileSizeMB' | 'maxUploadsAllowed' | 'minImageHeight' | 'minImageWidth' | 'onError' | 'transformFileName' | 'validateFile'>>> & {
|
|
5
5
|
purgeInput: () => void;
|
|
6
6
|
setFileName: Dispatch<SetStateAction<string>>;
|
|
7
7
|
setFileUrl: Dispatch<SetStateAction<string>>;
|
package/dist/components/file-uploader/hooks/use-uploader-actions/use-uploader-actions.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileUploaderProps } from '../../file-uploader.types';
|
|
2
2
|
import { OptionalValues } from '../../../../types/common';
|
|
3
|
-
export type UseUploadActionsProps = OptionalValues<Required<Pick<FileUploaderProps, 'expectedExtensions' | 'fileName' | 'fileUrl' | 'handleDeleteFile' | 'handleFileSelected' | 'handleUploadFile' | 'isUploaderOnly' | 'maxUploadsAllowed' | 'onError' | 'purifyFileName' | 'transformFileName' | 'validateFile'>>> & Partial<Pick<FileUploaderProps, 'maxFileSizeMB' | 'minImageHeight' | 'minImageWidth'>> & {
|
|
3
|
+
export type UseUploadActionsProps = OptionalValues<Required<Pick<FileUploaderProps, 'expectedExtensions' | 'fileName' | 'fileUrl' | 'handleDeleteFile' | 'handleFileSelected' | 'handleMultiUploadComplete' | 'handleUploadFile' | 'isUploaderOnly' | 'maxUploadsAllowed' | 'onError' | 'purifyFileName' | 'transformFileName' | 'validateFile'>>> & Partial<Pick<FileUploaderProps, 'maxFileSizeMB' | 'minImageHeight' | 'minImageWidth'>> & {
|
|
4
4
|
purgeInput: () => void;
|
|
5
5
|
};
|