2022-04-25 18:46:53 +08:00
|
|
|
// deps-lint-skip-all
|
2022-06-27 14:25:59 +08:00
|
|
|
import type { FullToken, GenerateStyle } from '../../theme';
|
|
|
|
import { genComponentStyleHook, mergeToken, resetComponent } from '../../theme';
|
2022-04-25 18:46:53 +08:00
|
|
|
import genDraggerStyle from './dragger';
|
|
|
|
import genListStyle from './list';
|
|
|
|
import genMotionStyle from './motion';
|
2022-06-27 14:25:59 +08:00
|
|
|
import { genPictureCardStyle, genPictureStyle } from './picture';
|
2022-04-25 18:46:53 +08:00
|
|
|
import genRtlStyle from './rtl';
|
|
|
|
|
2022-05-19 10:06:58 +08:00
|
|
|
export interface ComponentToken {}
|
|
|
|
|
|
|
|
export interface UploadToken extends FullToken<'Upload'> {
|
|
|
|
uploadThumbnailSize: number;
|
|
|
|
uploadProgressOffset: number;
|
|
|
|
uploadPicCardSize: number;
|
2022-04-25 18:46:53 +08:00
|
|
|
}
|
|
|
|
|
2022-05-19 10:06:58 +08:00
|
|
|
const genBaseStyle: GenerateStyle<UploadToken> = token => {
|
2022-04-25 18:46:53 +08:00
|
|
|
const { componentCls } = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
...resetComponent(token),
|
|
|
|
|
|
|
|
[componentCls]: {
|
|
|
|
outline: 0,
|
|
|
|
"input[type='file']": {
|
|
|
|
cursor: 'pointer',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-select`]: {
|
|
|
|
display: 'inline-block',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-disabled`]: {
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2022-05-19 10:06:58 +08:00
|
|
|
export default genComponentStyleHook('Upload', token => {
|
|
|
|
const { fontSizeHeading3, fontSizeBase, lineHeight, lineWidth, controlHeightLG } = token;
|
|
|
|
const listItemHeightSM = Math.round(fontSizeBase * lineHeight);
|
|
|
|
|
|
|
|
const uploadToken = mergeToken<UploadToken>(token, {
|
|
|
|
uploadThumbnailSize: fontSizeHeading3 * 2,
|
|
|
|
uploadProgressOffset: listItemHeightSM / 2 + lineWidth,
|
|
|
|
uploadPicCardSize: controlHeightLG * 2.55,
|
|
|
|
});
|
|
|
|
|
|
|
|
return [
|
|
|
|
genBaseStyle(uploadToken),
|
|
|
|
genDraggerStyle(uploadToken),
|
|
|
|
genPictureStyle(uploadToken),
|
|
|
|
genPictureCardStyle(uploadToken),
|
|
|
|
genListStyle(uploadToken),
|
|
|
|
genMotionStyle(uploadToken),
|
|
|
|
genRtlStyle(uploadToken),
|
|
|
|
];
|
|
|
|
});
|