File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
packages/core/useDropZone Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ export interface UseDropZoneOptions {
1616 * Also can be a function to check the data types.
1717 */
1818 dataTypes ?: MaybeRef < readonly string [ ] > | ( ( types : readonly string [ ] ) => boolean )
19+ /**
20+ * Similar to dataTypes, but exposes the DataTransferItemList for custom validation.
21+ * If provided, this function takes precedence over dataTypes.
22+ */
23+ checkValidity ?: ( items : DataTransferItemList ) => boolean
1924 onDrop ?: ( files : File [ ] | null , event : DragEvent ) => void
2025 onEnter ?: ( files : File [ ] | null , event : DragEvent ) => void
2126 onLeave ?: ( files : File [ ] | null , event : DragEvent ) => void
@@ -67,6 +72,10 @@ export function useDropZone(
6772 }
6873
6974 const checkValidity = ( items : DataTransferItemList ) => {
75+ if ( _options . checkValidity ) {
76+ return _options . checkValidity ( items )
77+ }
78+
7079 const types = Array . from ( items ?? [ ] ) . map ( item => item . type )
7180
7281 const dataTypesValid = checkDataTypes ( types )
You can’t perform that action at this time.
0 commit comments