1 line
15 KiB
JSON
1 line
15 KiB
JSON
|
{"ast":null,"code":"import { unit } from '@ant-design/cssinjs';\nimport { genStyleHooks, mergeToken } from '../../theme/internal';\n// ============================== Row-Shared ==============================\nconst genGridRowStyle = token => {\n const {\n componentCls\n } = token;\n return {\n // Grid system\n [componentCls]: {\n display: 'flex',\n flexFlow: 'row wrap',\n minWidth: 0,\n '&::before, &::after': {\n display: 'flex'\n },\n '&-no-wrap': {\n flexWrap: 'nowrap'\n },\n // The origin of the X-axis\n '&-start': {\n justifyContent: 'flex-start'\n },\n // The center of the X-axis\n '&-center': {\n justifyContent: 'center'\n },\n // The opposite of the X-axis\n '&-end': {\n justifyContent: 'flex-end'\n },\n '&-space-between': {\n justifyContent: 'space-between'\n },\n '&-space-around': {\n justifyContent: 'space-around'\n },\n '&-space-evenly': {\n justifyContent: 'space-evenly'\n },\n // Align at the top\n '&-top': {\n alignItems: 'flex-start'\n },\n // Align at the center\n '&-middle': {\n alignItems: 'center'\n },\n '&-bottom': {\n alignItems: 'flex-end'\n }\n }\n };\n};\n// ============================== Col-Shared ==============================\nconst genGridColStyle = token => {\n const {\n componentCls\n } = token;\n return {\n // Grid system\n [componentCls]: {\n position: 'relative',\n maxWidth: '100%',\n // Prevent columns from collapsing when empty\n minHeight: 1\n }\n };\n};\nconst genLoopGridColumnsStyle = (token, sizeCls) => {\n const {\n prefixCls,\n componentCls,\n gridColumns\n } = token;\n const gridColumnsStyle = {};\n for (let i = gridColumns; i >= 0; i--) {\n if (i === 0) {\n gridColumnsStyle[`${componentCls}${sizeCls}-${i}`] = {\n display: 'none'\n };\n gridColumnsStyle[`${componentCls}-push-${i}`] = {\n insetInlineStart: 'auto'\n };\n gridColumnsStyle[`${componentCls}-pull-${i}`] = {\n insetInlineEnd: 'auto'\n };\n gridColumnsStyle[`${componentCls}${sizeCls}-push-${i}`] = {\n insetInlineStart: 'auto'\n };\n gridColumnsStyle[`${componentCls}${sizeCls}-pull-${i}`] = {\n insetInlineEnd: 'auto'\n };\n gridColumnsStyle[`${componentCls}${sizeCls}-offset-${i}`] = {\n marginInlineStart: 0\n };\n gridColumnsStyle[`${componentCls}${sizeCls}-order-${i}`] = {\n order: 0\n };\n } else {\n gridColumnsStyle[`${componentCls}${sizeCls}-${i}`] = [\n // https://github.com/ant-design/ant-design/issues/44456\n // Form set `display: flex` on Col which will override `display: block`.\n // Let's get it from css variable to support override.\n {\n ['--ant-display']: 'block',\n // Fallback to display if variable not support\n display: 'block'\n }, {\n display: 'var(--ant-display)',\n flex: `0 0 ${i / gridColumns * 100}%`,\n maxWidth: `${i / gridColumns * 100}%`\n }];\n gridColumnsStyle[`${componentCls}${sizeCls}-push-${i}`] = {\n insetInlineStart: `${i / gridColumns * 100}%`\n };\n gridColumnsStyle[`${componentCls}${sizeCls}-pull-${i}`] = {\n insetInlineEnd: `${i / gridColumns * 100}%`\n };\n gridColumnsStyle[`${componentCls}${sizeCls}-offset-${i}`] = {\n marginInlineStart: `${i / gridColumns * 100}%`\n };\n gridColumnsStyle[`${componentCls}${sizeCls}-order-${i}`] = {\n order: i\n };\n }\n }\n // Flex CSS Var\n gridColumnsStyle[`${componentCls}${sizeCls}-flex`] = {\n flex: `var(--${prefixCls}${sizeCls}-flex)`\n };\n return gridColumnsStyle;\n};\nconst genGridStyle = (token, sizeCls) => genLoopGridColumnsStyle(token, sizeCls);\nconst genGridMediaStyle = (token, screenSize, sizeCls) => ({\n [`@media (min-width: ${unit(screenSize)})`]: Object.assign({}, genGr
|