2022-05-19 10:06:58 +08:00
|
|
|
import type { UploadToken } from '.';
|
2022-06-27 14:25:59 +08:00
|
|
|
import type { GenerateStyle } from '../../theme';
|
2022-10-28 16:44:19 +08:00
|
|
|
import { clearFix, textEllipsis } from '../../style';
|
2022-04-25 18:46:53 +08:00
|
|
|
|
2022-05-19 10:06:58 +08:00
|
|
|
const genListStyle: GenerateStyle<UploadToken> = token => {
|
|
|
|
const { componentCls, antCls, iconCls, fontSizeBase, lineHeight } = token;
|
2022-04-25 18:46:53 +08:00
|
|
|
const itemCls = `${componentCls}-list-item`;
|
|
|
|
const actionsCls = `${itemCls}-actions`;
|
|
|
|
const actionCls = `${itemCls}-action`;
|
2022-05-19 10:06:58 +08:00
|
|
|
const listItemHeightSM = Math.round(fontSizeBase * lineHeight);
|
2022-04-25 18:46:53 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
[`${componentCls}-list`]: {
|
|
|
|
...clearFix(),
|
|
|
|
lineHeight: token.lineHeight,
|
|
|
|
|
|
|
|
[itemCls]: {
|
|
|
|
position: 'relative',
|
2022-05-19 10:06:58 +08:00
|
|
|
height: token.lineHeight * fontSizeBase,
|
2022-04-25 18:46:53 +08:00
|
|
|
marginTop: token.marginXS,
|
2022-05-19 10:06:58 +08:00
|
|
|
fontSize: fontSizeBase,
|
2022-04-25 18:46:53 +08:00
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
transition: `background-color ${token.motionDurationSlow}`,
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
backgroundColor: token.controlItemBgHover,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}-name`]: {
|
2022-10-28 16:44:19 +08:00
|
|
|
...textEllipsis,
|
2022-04-25 18:46:53 +08:00
|
|
|
padding: `0 ${token.paddingXS}px`,
|
2022-05-19 10:06:58 +08:00
|
|
|
lineHeight,
|
2022-04-25 18:46:53 +08:00
|
|
|
flex: 'auto',
|
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
|
},
|
|
|
|
|
|
|
|
[actionsCls]: {
|
|
|
|
[actionCls]: {
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${actionCls}${antCls}-btn-sm`]: {
|
2022-05-19 10:06:58 +08:00
|
|
|
height: listItemHeightSM,
|
|
|
|
border: 0,
|
2022-04-25 18:46:53 +08:00
|
|
|
lineHeight: 1,
|
|
|
|
// FIXME: should not override small button
|
|
|
|
'> span': {
|
|
|
|
transform: 'scale(1)',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
|
|
|
${actionCls}:focus,
|
|
|
|
&.picture ${actionCls}
|
|
|
|
`]: {
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
[iconCls]: {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-04-25 18:46:53 +08:00
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:hover ${iconCls}`]: {
|
|
|
|
color: token.colorText,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-icon ${iconCls}`]: {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-05-19 10:06:58 +08:00
|
|
|
fontSize: fontSizeBase,
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}-progress`]: {
|
|
|
|
position: 'absolute',
|
2022-05-19 10:06:58 +08:00
|
|
|
bottom: -token.uploadProgressOffset,
|
2022-04-25 18:46:53 +08:00
|
|
|
width: '100%',
|
2022-05-19 10:06:58 +08:00
|
|
|
paddingInlineStart: fontSizeBase + token.paddingXS,
|
|
|
|
fontSize: fontSizeBase,
|
2022-04-25 18:46:53 +08:00
|
|
|
lineHeight: 0,
|
2022-05-19 10:06:58 +08:00
|
|
|
pointerEvents: 'none',
|
|
|
|
|
|
|
|
'> div': {
|
|
|
|
margin: 0,
|
|
|
|
},
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}:hover ${actionCls}`]: {
|
|
|
|
opacity: 1,
|
|
|
|
color: token.colorText,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}-error`]: {
|
|
|
|
color: token.colorError,
|
|
|
|
[`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
|
|
|
|
color: token.colorError,
|
|
|
|
},
|
|
|
|
|
|
|
|
[actionsCls]: {
|
|
|
|
[`${iconCls}, ${iconCls}:hover`]: {
|
|
|
|
color: token.colorError,
|
|
|
|
},
|
|
|
|
|
|
|
|
[actionCls]: {
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-list-item-container`]: {
|
|
|
|
transition: `opacity ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
|
|
|
|
|
|
|
|
// For smooth removing animation
|
|
|
|
'&::before': {
|
|
|
|
display: 'table',
|
|
|
|
width: 0,
|
|
|
|
height: 0,
|
|
|
|
content: '""',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genListStyle;
|