mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 00:29:12 +08:00
fe314589ed
* chore: init * chore: link picker * chore: move files * chore: update style * chore: update types * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: fix test case * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * chore: clesn up useless types * chore: update types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: update style * chore: clean up * chore: update types * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * fix: format * chore: update deps * chore: feature merge master (#46794) * fix: Fix typo s/Notificaiton/Notification/ (#46775) * docs: supplement form preserve field description (#46788) close https://github.com/ant-design/ant-design/issues/46773 * docs: tweak changelog drawer width in small screen (#46791) * docs: Update compatible-style.zh-CN.md (#46790) Signed-off-by: afc163 <afc163@gmail.com> --------- Signed-off-by: afc163 <afc163@gmail.com> Co-authored-by: hugo-syn <61210734+hugo-syn@users.noreply.github.com> Co-authored-by: Shunze Chen <qianlonwork@outlook.com> Co-authored-by: afc163 <afc163@gmail.com> * chore: update locale size * chore: lock dumi * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * chore: bump version * test: update snapshot * test: update snapshot * chore: bump version * chore: update limit * test: update snapshot * docs: update 7 days sample * chore: rm useless style * chore: clean up style * docs: add buddihist era demo * refactor: interface * chore: add multiple types * docs: add demo * chore: init style * chore: init style * chore: fill style * chore: fill style * chore: style * chore: size of it * chore: size style * docs: add align demo * docs: needConfirm * chore: fix showWeek style * test: update snapshot * chore: fix ts * chore: fix ts * chore: fix ts * chore: fix ts * fix: week style * docs: update dayjs note * fix: style missing * chore: fix footer extra style missing * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot --------- Signed-off-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: hugo-syn <61210734+hugo-syn@users.noreply.github.com> Co-authored-by: Shunze Chen <qianlonwork@outlook.com> Co-authored-by: afc163 <afc163@gmail.com> Co-authored-by: lijianan <574980606@qq.com>
95 lines
2.8 KiB
TypeScript
95 lines
2.8 KiB
TypeScript
import type { CSSInterpolation } from '@ant-design/cssinjs';
|
|
|
|
import { genSelectionStyle } from '../../select/style/multiple';
|
|
import { mergeToken, type GenerateStyle } from '../../theme/internal';
|
|
import type { PickerToken } from './token';
|
|
|
|
const genSize = (token: PickerToken, suffix?: string): CSSInterpolation => {
|
|
const { componentCls, selectHeight, fontHeight, lineWidth, calc } = token;
|
|
|
|
const suffixCls = suffix ? `${componentCls}-${suffix}` : '';
|
|
|
|
const height = token.calc(fontHeight).add(2).equal();
|
|
const restHeight = () => calc(selectHeight).sub(height).sub(calc(lineWidth).mul(2));
|
|
|
|
const paddingTop = token.max(restHeight().div(2).equal(), 0);
|
|
const paddingBottom = token.max(restHeight().sub(paddingTop).equal(), 0);
|
|
|
|
return [
|
|
genSelectionStyle(token, suffix),
|
|
{
|
|
[`${componentCls}-multiple${suffixCls}`]: {
|
|
paddingTop,
|
|
paddingBottom,
|
|
paddingInlineStart: paddingTop,
|
|
},
|
|
},
|
|
];
|
|
};
|
|
|
|
const genPickerMultipleStyle: GenerateStyle<PickerToken> = (token) => {
|
|
const { componentCls, calc, lineWidth } = token;
|
|
|
|
const smallToken = mergeToken<PickerToken>(token, {
|
|
fontHeight: token.fontSize,
|
|
selectHeight: token.controlHeightSM,
|
|
multipleSelectItemHeight: token.controlHeightXS,
|
|
borderRadius: token.borderRadiusSM,
|
|
borderRadiusSM: token.borderRadiusXS,
|
|
});
|
|
|
|
const largeToken = mergeToken<PickerToken>(token, {
|
|
fontHeight: calc(token.multipleItemHeightLG)
|
|
.sub(calc(lineWidth).mul(2).equal())
|
|
.equal() as number,
|
|
fontSize: token.fontSizeLG,
|
|
selectHeight: token.controlHeightLG,
|
|
multipleSelectItemHeight: token.multipleItemHeightLG,
|
|
borderRadius: token.borderRadiusLG,
|
|
borderRadiusSM: token.borderRadius,
|
|
});
|
|
|
|
return [
|
|
// ======================== Size ========================
|
|
genSize(smallToken, 'small'),
|
|
genSize(token),
|
|
genSize(largeToken, 'large'),
|
|
|
|
// ====================== Selection ======================
|
|
genSelectionStyle(token),
|
|
{
|
|
[`${componentCls}${componentCls}-multiple`]: {
|
|
width: '100%',
|
|
|
|
// ==================== Selector =====================
|
|
[`${componentCls}-selector`]: {
|
|
flex: 'auto',
|
|
padding: 0,
|
|
|
|
'&:after': {
|
|
margin: 0,
|
|
},
|
|
},
|
|
|
|
// ==================== Selection ====================
|
|
[`${componentCls}-selection-item`]: {
|
|
marginBlock: 0,
|
|
},
|
|
|
|
// ====================== Input ======================
|
|
// Input is `readonly`, which is used for a11y only
|
|
[`${componentCls}-multiple-input`]: {
|
|
width: 0,
|
|
height: 0,
|
|
border: 0,
|
|
visibility: 'hidden',
|
|
position: 'absolute',
|
|
zIndex: -1,
|
|
},
|
|
},
|
|
},
|
|
];
|
|
};
|
|
|
|
export default genPickerMultipleStyle;
|