-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bump file-uploader from 1.2.0 to 1.9.0
- Loading branch information
1 parent
c568e7e
commit d0df7a2
Showing
7 changed files
with
90 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 17 additions & 7 deletions
24
packages/react-uploader/src/utils/getCalcPropertyOfProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
export const getCalcPropertyOfProps = <T extends Object>(props: T) => { | ||
import type { FileUploaderModesKeys, TProps } from "../Uploader/types"; | ||
|
||
export const getCalcPropertyOfProps = <T extends FileUploaderModesKeys>(props: TProps<T>) => { | ||
const eventHandlers: Record<string, unknown> = {}; | ||
const config: Record<string, unknown> = {}; | ||
const uploader: Record<string, unknown> = {}; | ||
|
||
for (const [prop, value] of Object.entries(props)) { | ||
if (prop.startsWith("on")) { | ||
eventHandlers[prop] = value; | ||
continue; | ||
} | ||
|
||
Object.entries(props).forEach(([key, value]) => { | ||
if (key.startsWith("on")) { | ||
eventHandlers[key] = value; | ||
} else { | ||
config[key] = value; | ||
if (prop === "headless") { | ||
uploader[prop] = value; | ||
continue; | ||
} | ||
}); | ||
|
||
config[prop] = value; | ||
} | ||
|
||
return { | ||
eventHandlers, | ||
uploader, | ||
config, | ||
}; | ||
}; |