diff --git a/.changeset/empty-dogs-smash.md b/.changeset/empty-dogs-smash.md new file mode 100644 index 000000000..aeeb03bbe --- /dev/null +++ b/.changeset/empty-dogs-smash.md @@ -0,0 +1,6 @@ +--- +"@hi-ui/upload": minor +--- + +perf: 依赖项中增加 @hi-ui/message,否则打包时会将多余代码打进去 +feat: 暴露出单个不同类型的上传组件,支持按需引入,对 Tree Shaking 友好 diff --git a/.changeset/popular-phones-visit.md b/.changeset/popular-phones-visit.md new file mode 100644 index 000000000..305ed724a --- /dev/null +++ b/.changeset/popular-phones-visit.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +perf(upload): 代码优化,降低打包体积 diff --git a/packages/ui/upload/package.json b/packages/ui/upload/package.json index 1f2b9bf53..62b176d18 100644 --- a/packages/ui/upload/package.json +++ b/packages/ui/upload/package.json @@ -48,6 +48,7 @@ "@hi-ui/env": "^4.0.4", "@hi-ui/file-select": "^4.0.7", "@hi-ui/icons": "^4.0.18", + "@hi-ui/message": "^4.0.7", "@hi-ui/modal": "^4.0.15", "@hi-ui/preview": "^4.0.8", "@hi-ui/use-id": "^4.0.4", diff --git a/packages/ui/upload/src/index.ts b/packages/ui/upload/src/index.ts index e792a49a7..8988e76df 100644 --- a/packages/ui/upload/src/index.ts +++ b/packages/ui/upload/src/index.ts @@ -3,4 +3,10 @@ import './styles/index.scss' export * from './Upload' export { Upload as default } from './Upload' +export { NormalUpload } from './NormalUpload' +export { DragUpload } from './DragUpload' +export { PictureListUpload } from './PictureListUpload' +export { PictureUpload } from './PictureUpload' +export { AvatarUpload } from './AvatarUpload' + export * from './types' diff --git a/packages/ui/upload/stories/index.stories.tsx b/packages/ui/upload/stories/index.stories.tsx index 8995ab3ef..6dcaf53b5 100644 --- a/packages/ui/upload/stories/index.stories.tsx +++ b/packages/ui/upload/stories/index.stories.tsx @@ -2,6 +2,7 @@ import React from 'react' import Upload from '../src' export * from './basic.stories' +export * from './single-import.stories' export * from './draggable.stories' export * from './picture-card.stories' export * from './photo.stories' diff --git a/packages/ui/upload/stories/single-import.stories.tsx b/packages/ui/upload/stories/single-import.stories.tsx new file mode 100644 index 000000000..c4621df17 --- /dev/null +++ b/packages/ui/upload/stories/single-import.stories.tsx @@ -0,0 +1,26 @@ +import React from 'react' +import { NormalUpload, DragUpload, PictureUpload, PictureListUpload, AvatarUpload } from '../src' + +/** + * @title 单个导入,按需引用 + * @desc 建议采用该方式引用,有利用打包时做 Tree Shaking + */ +export const SingleImport = () => { + return ( + <> +