123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { genCompactItemStyle } from '../../style/compact-item';
- import { genStyleHooks } from '../../theme/internal';
- import getColumnsStyle from './columns';
- // =============================== Base ===============================
- const genBaseStyle = token => {
- const {
- componentCls,
- antCls
- } = token;
- return [
- // =====================================================
- // == Control ==
- // =====================================================
- {
- [componentCls]: {
- width: token.controlWidth
- }
- },
- // =====================================================
- // == Popup ==
- // =====================================================
- {
- [`${componentCls}-dropdown`]: [{
- [`&${antCls}-select-dropdown`]: {
- padding: 0
- }
- }, getColumnsStyle(token)]
- },
- // =====================================================
- // == RTL ==
- // =====================================================
- {
- [`${componentCls}-dropdown-rtl`]: {
- direction: 'rtl'
- }
- },
- // =====================================================
- // == Space Compact ==
- // =====================================================
- genCompactItemStyle(token)];
- };
- // ============================== Export ==============================
- export const prepareComponentToken = token => {
- const itemPaddingVertical = Math.round((token.controlHeight - token.fontSize * token.lineHeight) / 2);
- return {
- controlWidth: 184,
- controlItemWidth: 111,
- dropdownHeight: 180,
- optionSelectedBg: token.controlItemBgActive,
- optionSelectedFontWeight: token.fontWeightStrong,
- optionPadding: `${itemPaddingVertical}px ${token.paddingSM}px`,
- menuPadding: token.paddingXXS,
- optionSelectedColor: token.colorText
- };
- };
- export default genStyleHooks('Cascader', genBaseStyle, prepareComponentToken, {
- unitless: {
- optionSelectedFontWeight: true
- }
- });
|