2023-06-07 11:54:50 +08:00
|
|
|
import { resetComponent } from '../../style';
|
|
|
|
import { genCollapseMotion } from '../../style/motion';
|
2023-11-13 19:44:27 +08:00
|
|
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
2023-11-29 17:23:45 +08:00
|
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
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';
|
|
|
|
|
2023-05-19 11:11:31 +08:00
|
|
|
export interface ComponentToken {
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 操作按扭颜色
|
|
|
|
* @descEN Action button color
|
|
|
|
*/
|
2023-05-19 11:11:31 +08:00
|
|
|
actionsColor: string;
|
|
|
|
}
|
2022-05-19 10:06:58 +08:00
|
|
|
|
|
|
|
export interface UploadToken extends FullToken<'Upload'> {
|
2023-11-13 19:44:27 +08:00
|
|
|
uploadThumbnailSize: number | string;
|
|
|
|
uploadProgressOffset: number | string;
|
|
|
|
uploadPicCardSize: number | string;
|
2022-04-25 18:46:53 +08:00
|
|
|
}
|
|
|
|
|
2022-11-19 13:47:33 +08:00
|
|
|
const genBaseStyle: GenerateStyle<UploadToken> = (token) => {
|
2022-07-19 17:51:35 +08:00
|
|
|
const { componentCls, colorTextDisabled } = token;
|
2022-04-25 18:46:53 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
...resetComponent(token),
|
|
|
|
|
|
|
|
[componentCls]: {
|
|
|
|
outline: 0,
|
|
|
|
"input[type='file']": {
|
|
|
|
cursor: 'pointer',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-select`]: {
|
|
|
|
display: 'inline-block',
|
|
|
|
},
|
|
|
|
|
2024-12-02 23:16:00 +08:00
|
|
|
[`${componentCls}-hidden`]: {
|
|
|
|
display: 'none',
|
|
|
|
},
|
|
|
|
|
2022-04-25 18:46:53 +08:00
|
|
|
[`${componentCls}-disabled`]: {
|
2022-07-19 17:51:35 +08:00
|
|
|
color: colorTextDisabled,
|
2022-04-25 18:46:53 +08:00
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-11-13 19:44:27 +08:00
|
|
|
export const prepareComponentToken: GetDefaultToken<'Upload'> = (token) => ({
|
|
|
|
actionsColor: token.colorTextDescription,
|
|
|
|
});
|
|
|
|
|
2022-04-25 18:46:53 +08:00
|
|
|
// ============================== Export ==============================
|
2023-11-29 17:23:45 +08:00
|
|
|
export default genStyleHooks(
|
2023-05-19 11:11:31 +08:00
|
|
|
'Upload',
|
|
|
|
(token) => {
|
2023-11-13 19:44:27 +08:00
|
|
|
const { fontSizeHeading3, fontHeight, lineWidth, controlHeightLG, calc } = token;
|
2022-05-19 10:06:58 +08:00
|
|
|
|
2023-05-19 11:11:31 +08:00
|
|
|
const uploadToken = mergeToken<UploadToken>(token, {
|
2023-11-13 19:44:27 +08:00
|
|
|
uploadThumbnailSize: calc(fontSizeHeading3).mul(2).equal(),
|
|
|
|
uploadProgressOffset: calc(calc(fontHeight).div(2)).add(lineWidth).equal(),
|
|
|
|
uploadPicCardSize: calc(controlHeightLG).mul(2.55).equal(),
|
2023-05-19 11:11:31 +08:00
|
|
|
});
|
2022-05-19 10:06:58 +08:00
|
|
|
|
2023-05-19 11:11:31 +08:00
|
|
|
return [
|
|
|
|
genBaseStyle(uploadToken),
|
|
|
|
genDraggerStyle(uploadToken),
|
|
|
|
genPictureStyle(uploadToken),
|
|
|
|
genPictureCardStyle(uploadToken),
|
|
|
|
genListStyle(uploadToken),
|
|
|
|
genMotionStyle(uploadToken),
|
|
|
|
genRtlStyle(uploadToken),
|
|
|
|
genCollapseMotion(uploadToken),
|
|
|
|
];
|
|
|
|
},
|
2023-11-13 19:44:27 +08:00
|
|
|
prepareComponentToken,
|
2023-05-19 11:11:31 +08:00
|
|
|
);
|