UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

158 lines (157 loc) 4.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _cssinjs = require("@ant-design/cssinjs"); var _style = require("../../style"); const genFilterStyle = token => { const { componentCls, antCls, iconCls, tableFilterDropdownWidth, tableFilterDropdownSearchWidth, paddingXXS, paddingXS, colorText, lineWidth, lineType, tableBorderColor, headerIconColor, fontSizeSM, tablePaddingHorizontal, borderRadius, motionDurationSlow, colorTextDescription, colorPrimary, tableHeaderFilterActiveBg, colorTextDisabled, tableFilterDropdownBg, tableFilterDropdownHeight, controlItemBgHover, controlItemBgActive, boxShadowSecondary, filterDropdownMenuBg, calc } = token; const dropdownPrefixCls = `${antCls}-dropdown`; const tableFilterDropdownPrefixCls = `${componentCls}-filter-dropdown`; const treePrefixCls = `${antCls}-tree`; const tableBorder = `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`; return [{ [`${componentCls}-wrapper`]: { [`${componentCls}-filter-column`]: { display: 'flex', justifyContent: 'space-between' }, [`${componentCls}-filter-trigger`]: { position: 'relative', display: 'flex', alignItems: 'center', marginBlock: calc(paddingXXS).mul(-1).equal(), marginInline: `${(0, _cssinjs.unit)(paddingXXS)} ${(0, _cssinjs.unit)(calc(tablePaddingHorizontal).div(2).mul(-1).equal())}`, padding: `0 ${(0, _cssinjs.unit)(paddingXXS)}`, color: headerIconColor, fontSize: fontSizeSM, borderRadius, cursor: 'pointer', transition: `all ${motionDurationSlow}`, '&:hover': { color: colorTextDescription, background: tableHeaderFilterActiveBg }, '&.active': { color: colorPrimary } } } }, { // Dropdown [`${antCls}-dropdown`]: { [tableFilterDropdownPrefixCls]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), { minWidth: tableFilterDropdownWidth, backgroundColor: tableFilterDropdownBg, borderRadius, boxShadow: boxShadowSecondary, overflow: 'hidden', // Reset menu [`${dropdownPrefixCls}-menu`]: { // https://github.com/ant-design/ant-design/issues/4916 // https://github.com/ant-design/ant-design/issues/19542 maxHeight: tableFilterDropdownHeight, overflowX: 'hidden', border: 0, boxShadow: 'none', borderRadius: 'unset', backgroundColor: filterDropdownMenuBg, '&:empty::after': { display: 'block', padding: `${(0, _cssinjs.unit)(paddingXS)} 0`, color: colorTextDisabled, fontSize: fontSizeSM, textAlign: 'center', content: '"Not Found"' } }, [`${tableFilterDropdownPrefixCls}-tree`]: { paddingBlock: `${(0, _cssinjs.unit)(paddingXS)} 0`, paddingInline: paddingXS, [treePrefixCls]: { padding: 0 }, [`${treePrefixCls}-treenode ${treePrefixCls}-node-content-wrapper:hover`]: { backgroundColor: controlItemBgHover }, [`${treePrefixCls}-treenode-checkbox-checked ${treePrefixCls}-node-content-wrapper`]: { '&, &:hover': { backgroundColor: controlItemBgActive } } }, [`${tableFilterDropdownPrefixCls}-search`]: { padding: paddingXS, borderBottom: tableBorder, '&-input': { input: { minWidth: tableFilterDropdownSearchWidth }, [iconCls]: { color: colorTextDisabled } } }, [`${tableFilterDropdownPrefixCls}-checkall`]: { width: '100%', marginBottom: paddingXXS, marginInlineStart: paddingXXS }, // Operation [`${tableFilterDropdownPrefixCls}-btns`]: { display: 'flex', justifyContent: 'space-between', padding: `${(0, _cssinjs.unit)(calc(paddingXS).sub(lineWidth).equal())} ${(0, _cssinjs.unit)(paddingXS)}`, overflow: 'hidden', borderTop: tableBorder } }) } }, // Dropdown Menu & SubMenu { // submenu of table filter dropdown [`${antCls}-dropdown ${tableFilterDropdownPrefixCls}, ${tableFilterDropdownPrefixCls}-submenu`]: { // Checkbox [`${antCls}-checkbox-wrapper + span`]: { paddingInlineStart: paddingXS, color: colorText }, '> ul': { maxHeight: 'calc(100vh - 130px)', overflowX: 'hidden', overflowY: 'auto' } } }]; }; var _default = exports.default = genFilterStyle;