From 936583fb17ab348da8ce3a9f58556a25c8bd7af7 Mon Sep 17 00:00:00 2001 From: dengfuping Date: Wed, 25 Oct 2023 18:10:09 +0800 Subject: [PATCH] chore: Format code by prettier --- .../__tests__/less-to-token.test.ts | 11 +- packages/ui/src/BasicLayout/style/Header.ts | 59 ++++---- packages/ui/src/BasicLayout/style/index.ts | 141 +++++++++--------- .../ui/src/ContentWithQuestion/demo/basic.tsx | 2 +- .../src/ContentWithQuestion/demo/index.less | 2 +- .../ui/src/ContentWithQuestion/index.less | 3 +- packages/ui/src/ContentWithQuestion/index.md | 2 +- packages/ui/src/ContentWithQuestion/index.tsx | 2 +- 8 files changed, 111 insertions(+), 111 deletions(-) diff --git a/packages/codemod/transforms/__tests__/less-to-token.test.ts b/packages/codemod/transforms/__tests__/less-to-token.test.ts index 0423e2a38..8926086bc 100644 --- a/packages/codemod/transforms/__tests__/less-to-token.test.ts +++ b/packages/codemod/transforms/__tests__/less-to-token.test.ts @@ -8,9 +8,14 @@ const tests = ['antd-v4-less-to-token', 'obui-less-to-token']; describe(testUnit, () => { tests.forEach(test => { it(test, async () => { - const result = await transform(path.join(__dirname, `../__testfixtures__/less-to-token/${test}.input.less`)) - const output = fs.readFileSync(path.join(__dirname, `../__testfixtures__/less-to-token/${test}.output.less`), 'utf-8'); + const result = await transform( + path.join(__dirname, `../__testfixtures__/less-to-token/${test}.input.less`) + ); + const output = fs.readFileSync( + path.join(__dirname, `../__testfixtures__/less-to-token/${test}.output.less`), + 'utf-8' + ); expect(result).toEqual(output); - }) + }); }); }); diff --git a/packages/ui/src/BasicLayout/style/Header.ts b/packages/ui/src/BasicLayout/style/Header.ts index cddd5a524..5aee9c631 100644 --- a/packages/ui/src/BasicLayout/style/Header.ts +++ b/packages/ui/src/BasicLayout/style/Header.ts @@ -4,78 +4,76 @@ import { genComponentStyleHook } from '../../_util/genComponentStyleHook'; export type HeaderToken = FullToken; -export const genHeaderStyle: GenerateStyle = ( - token: HeaderToken -): CSSObject => { +export const genHeaderStyle: GenerateStyle = (token: HeaderToken): CSSObject => { const { antCls, componentCls } = token; return { [`${componentCls}`]: { - position: "fixed", + position: 'fixed', zIndex: 10, - width: "100%", + width: '100%', height: 48, - padding: "10px 24px", + padding: '10px 24px', lineHeight: '48px', backgroundColor: token.colorBgLayout, boxShadow: `inset 0 -1px 0 0 ${token.colorBorderSecondary}`, [`${componentCls}-content`]: { - display: "flex", - alignItems: "center", - justifyContent: "space-between", + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', maxWidth: token.maxWidth, - height: "100%", - margin: "0 auto", + height: '100%', + margin: '0 auto', }, [`${componentCls}-logo`]: { height: 24, - cursor: 'pointer' + cursor: 'pointer', }, [`${componentCls}-icon`]: { width: 52, height: 48, lineHeight: '48px', - textAlign: "center", + textAlign: 'center', borderRight: `1px solid ${token.colorBorderSecondary}`, borderBottom: `1px solid ${token.colorBorderSecondary}`, - cursor: "pointer", + cursor: 'pointer', img: { height: 32, - marginTop: 8 + marginTop: 8, }, }, [`${componentCls}-title`]: { /* 占据剩余的全部空间 */ flex: 1, - margin: "0 16px", + margin: '0 16px', }, [`${componentCls}-extra`]: { - display: "flex", - alignItems: "center", - justifyContent: "space-between", + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', [`${componentCls}-extra-item`]: { - display: "inline-flex", + display: 'inline-flex', fontSize: 12, - cursor: "pointer", + cursor: 'pointer', '&:not(:last-child)': { - marginRight: 24 + marginRight: 24, }, [`${componentCls}-extra-icon-wrapper`]: { width: 28, height: 28, lineHeight: '28px', - textAlign: "center", - border: "0.88px solid #ced4e1", + textAlign: 'center', + border: '0.88px solid #ced4e1', borderRadius: 14, }, [`${componentCls}-extra-user-wrapper`]: { height: 28, - padding: "0 10px", + padding: '0 10px', lineHeight: '28px', - border: "0.88px solid #ced4e1", + border: '0.88px solid #ced4e1', borderRadius: 14, [`${componentCls}-extra-user-icon`]: { marginRight: 6, @@ -87,9 +85,9 @@ export const genHeaderStyle: GenerateStyle = ( [`${componentCls}-extra-with-label`]: { [`${componentCls}-extra-item`]: { '&:not(:last-child)': { - marginRight: '24px !important' - } - } + marginRight: '24px !important', + }, + }, }, }, @@ -113,8 +111,7 @@ export const genHeaderStyle: GenerateStyle = ( fontSize: 12, color: token.colorTextTertiary, }, - } - + }, }; }; diff --git a/packages/ui/src/BasicLayout/style/index.ts b/packages/ui/src/BasicLayout/style/index.ts index 9f4e7ed96..a776b2946 100644 --- a/packages/ui/src/BasicLayout/style/index.ts +++ b/packages/ui/src/BasicLayout/style/index.ts @@ -18,7 +18,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( colorPrimary, motionDurationSlow, } = token; - const maxWidth = '8192px' + const maxWidth = '8192px'; const siderWidthList = [0, 52, 52 * 2, 192, 208]; @@ -38,7 +38,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( position: 'fixed', top: 0, zIndex: 20, - width: '100%' + width: '100%', }, // 对于 Alert 类型的 banner,自动增加上间距 @@ -94,7 +94,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( [`${componentCls}-sider-collapse`]: { opacity: 1, transition: 'opacity 0.3s', - } + }, }, [`${componentCls}-sider-collapse`]: { @@ -116,9 +116,9 @@ export const genBasicLayoutStyle: GenerateStyle = ( ['.anticon']: { fontSize: 'px', display: 'block', - lineHeight: '42px' - } - } + lineHeight: '42px', + }, + }, }, [`${componentCls}-sider-wrapper`]: { @@ -142,7 +142,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( width: '18px', height: '18px', fontSize: '18px', - } + }, }, [`${antCls}-menu-submenu`]: { width: '100%', @@ -156,14 +156,14 @@ export const genBasicLayoutStyle: GenerateStyle = ( width: '18px', height: '18px', fontSize: '18px', - } + }, }, [`${antCls}-menu-submenu > ${antCls}-menu-submenu-title`]: { width: '100%', marginBottom: '4px !important', marginInline: 0, marginBlock: 0, - } + }, }, // 内嵌菜单样式 [`${antCls}-menu-inline`]: { @@ -173,47 +173,48 @@ export const genBasicLayoutStyle: GenerateStyle = ( marginBottom: '16px', // 子菜单展开时 marginBottom 会变小,为了避免效果突兀,增加过渡效果 transition: 'marginBottom 0.2s', - } + }, }, [`${antCls}-menu-submenu-open`]: { '&:not(:last-childantCls)': { // 子菜单展开时,减小 marginBottom marginBottom: 4, - } + }, }, // 子菜单项间距 [`${antCls}-menu-submenu`]: { [`${antCls}-menu-item:not(:last-child)`]: { marginBottom: 4, - } + }, }, // 菜单项缩进 [`${antCls}-menu-item, ${antCls}-menu-submenu > ${antCls}-menu-submenu-title`]: { paddingLeft: '16px !important', [`${antCls}-menu-title-content`]: { - width: '108px' - } + width: '108px', + }, }, // 子菜单项缩进 [`${antCls}-menu-sub`]: { [`${antCls}-menu-item`]: { marginLeft: '16px', paddingLeft: '28px !important', - } + }, }, // 菜单项激活样式 - [`${antCls}-menu-item-active, ${antCls}-menu-submenu-active > ${antCls}-menu-submenu-title`]: { - color: `${colorText} !important`, - fontWeight: 600, - animation: 'activeGradientAnimation 0.1s', - // .border-gradient(linear-gradient(to right, #E9EDF6, @colorBgLayout), linear-gradient(90deg, #C6CDD9, @colorBgLayout), 0.5px, solid, 8px 0 0 8px), - backgroundImage: `linear-gradient(to right,#E9EDF6, ${colorBgLayout}),linear-gradient(90deg,#C6CDD9,${colorBgLayout})`, - backgroundClip: 'padding-box,border-box', - backgroundOrigin: 'padding-box,border-box', - border: '.5px solid transparent', - borderRadius: '8px 0 0 8px', - transition: 'border-width .3s', - }, + [`${antCls}-menu-item-active, ${antCls}-menu-submenu-active > ${antCls}-menu-submenu-title`]: + { + color: `${colorText} !important`, + fontWeight: 600, + animation: 'activeGradientAnimation 0.1s', + // .border-gradient(linear-gradient(to right, #E9EDF6, @colorBgLayout), linear-gradient(90deg, #C6CDD9, @colorBgLayout), 0.5px, solid, 8px 0 0 8px), + backgroundImage: `linear-gradient(to right,#E9EDF6, ${colorBgLayout}),linear-gradient(90deg,#C6CDD9,${colorBgLayout})`, + backgroundClip: 'padding-box,border-box', + backgroundOrigin: 'padding-box,border-box', + border: '.5px solid transparent', + borderRadius: '8px 0 0 8px', + transition: 'border-width .3s', + }, // 菜单项选中样式 [`${antCls}-menu-item-selected`]: { color: `${colorPrimary} !important`, @@ -230,14 +231,14 @@ export const genBasicLayoutStyle: GenerateStyle = ( // content: '""', // 去掉菜单项的选中标记 display: 'none', - } + }, }, [`${antCls}-menu-submenu-selected > ${antCls}-menu-submenu-title`]: { color: `${colorPrimary} !important`, }, [`${antCls}-divider`]: { margin: '0 0 16px 0', - } + }, }, // 垂直菜单样式 @@ -249,7 +250,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( [`${antCls}-menu-item, ${antCls}-menu-submenu`]: { '&:not(:last-child)': { marginBottom: 4, - } + }, }, [`${antCls}-menu-item, ${antCls}-menu-submenu > ${antCls}-menu-submenu-title`]: { @@ -269,34 +270,36 @@ export const genBasicLayoutStyle: GenerateStyle = ( [`${antCls}-menu-submenu-arrow`]: { display: 'none', - } - }, - [`${antCls}-menu-item-active, ${antCls}-menu-submenu-active > ${antCls}-menu-submenu-title`]: { - [`${antCls}-menu-title-content`]: { - backgroundColor: '#e9edf6', - border: '0.5px solid #c6cdd9', - } + }, }, - [`${antCls}-menu-item-selected, ${antCls}-menu-submenu-selected > ${antCls}-menu-submenu-title`]: { - [`${antCls}-menu-title-content`]: { - backgroundColor: '#e5eeff', - border: `0.5px solid ${colorPrimaryBorder}`, - } - } + [`${antCls}-menu-item-active, ${antCls}-menu-submenu-active > ${antCls}-menu-submenu-title`]: + { + [`${antCls}-menu-title-content`]: { + backgroundColor: '#e9edf6', + border: '0.5px solid #c6cdd9', + }, + }, + [`${antCls}-menu-item-selected, ${antCls}-menu-submenu-selected > ${antCls}-menu-submenu-title`]: + { + [`${antCls}-menu-title-content`]: { + backgroundColor: '#e5eeff', + border: `0.5px solid ${colorPrimaryBorder}`, + }, + }, }, [`${componentCls}-sub-sider`]: { borderRight: '1px solid #e2e8f3', [`${antCls}-divider`]: { margin: '0 0 4px 0', - } + }, }, [`${componentCls}-sub-sider, ${componentCls}-menu-collapsed`]: { width: '52px', [`${antCls}-divider`]: { margin: '0 0 4px 0', - } + }, }, [`${componentCls}-sider-content`]: { @@ -325,11 +328,10 @@ export const genBasicLayoutStyle: GenerateStyle = ( backgroundColor: 'transparent', borderRight: 'none', marginBottom: '32px', - } - } + }, + }, }, - - } + }, }, [`${componentCls}-sider-collapsed`]: { @@ -343,49 +345,49 @@ export const genBasicLayoutStyle: GenerateStyle = ( display: 'none', [`${componentCls}-sider-collapse`]: { display: 'none', - } + }, }, [`${antCls}-menu-inline`]: { paddingTop: '16px', [`${antCls}-menu-item, ${antCls}-menu-submenu`]: { - '&:not\(:last-child\)': { + '&:not(:last-child)': { marginBottom: '16px !important', - } + }, }, [`${antCls}-divider`]: { width: '60%', minWidth: '60%', margin: '-8px 0 8px 16px !important', - } + }, }, [`${antCls}-menu-vertical`]: { paddingTop: '10px', }, [`${componentCls}-sider-content`]: { paddingLeft: '6px', - } + }, }, [`${componentCls}-content`]: { backgroundColor: colorBgLayout, transition: 'all 0.3s', - } - } + }, + }, }, [`@media (min-width: ${maxWidth})`]: { [`${componentCls}`]: { [`${componentCls}-content-layout`]: { [`${componentCls}-sider`]: { - paddingLeft: 0 - } - } + paddingLeft: 0, + }, + }, }, [`${proComponentsCls}-footer-bar`]: { right: `calc((100% - ${maxWidth}) / 2 + 24px)`, width: `calc(${maxWidth} - 192px - 24px - 24px)`, - maxWidth: `calc(${maxWidth} - 192px - 24px - 24px)` - } + maxWidth: `calc(${maxWidth} - 192px - 24px - 24px)`, + }, }, // 弹出菜单样式 @@ -400,7 +402,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( marginInline: 0, '&:not(:last-child):': { marginBottom: '8px !important', - } + }, }, [`${antCls}-menu-submenu`]: { width: '100%', @@ -409,7 +411,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( marginInline: 0, '&:not(:last-child):': { marginBottom: '8px !important', - } + }, }, [`${antCls}-menu-item-active`]: { color: 'colorText !important', @@ -421,10 +423,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( backgroundOrigin: 'padding-box,border-box', border: '.5px solid transparent', borderRadius: '8px 0 0 8px', - transition: 'border-width .3s' - - - + transition: 'border-width .3s', }, [`${antCls}-menu-submenu-active > & ${antCls}-menu-submenu-title`]: { color: 'colorText !important', @@ -436,7 +435,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( backgroundOrigin: 'padding-box,border-box', border: '.5px solid transparent', borderRadius: '8px 0 0 8px', - transition: 'border-width .3s' + transition: 'border-width .3s', }, [`${antCls}-menu-item-selected`]: { @@ -449,17 +448,17 @@ export const genBasicLayoutStyle: GenerateStyle = ( backgroundOrigin: 'padding-box,border-box', border: '.5px solid transparent', borderRadius: '8px 0 0 8px', - transition: 'border-width .3s' + transition: 'border-width .3s', }, [`${antCls}-divider`]: { width: "'60%'", minWidth: '60%', - margin: '0 0 8px 16px !important' + margin: '0 0 8px 16px !important', }, }, }, }; -} +}; export default (prefixCls: string) => { const useStyle = genComponentStyleHook('BasicLayout', token => { diff --git a/packages/ui/src/ContentWithQuestion/demo/basic.tsx b/packages/ui/src/ContentWithQuestion/demo/basic.tsx index 85bce78fa..f04db993e 100644 --- a/packages/ui/src/ContentWithQuestion/demo/basic.tsx +++ b/packages/ui/src/ContentWithQuestion/demo/basic.tsx @@ -26,4 +26,4 @@ export default () => { ); -}; \ No newline at end of file +}; diff --git a/packages/ui/src/ContentWithQuestion/demo/index.less b/packages/ui/src/ContentWithQuestion/demo/index.less index d2d36e889..fe13fe822 100644 --- a/packages/ui/src/ContentWithQuestion/demo/index.less +++ b/packages/ui/src/ContentWithQuestion/demo/index.less @@ -1,3 +1,3 @@ .customer-className { color: #597ef7; -} \ No newline at end of file +} diff --git a/packages/ui/src/ContentWithQuestion/index.less b/packages/ui/src/ContentWithQuestion/index.less index dc325e19a..74f96d50a 100644 --- a/packages/ui/src/ContentWithQuestion/index.less +++ b/packages/ui/src/ContentWithQuestion/index.less @@ -14,6 +14,5 @@ } .@{prefix}-color { color: red; - } -} \ No newline at end of file +} diff --git a/packages/ui/src/ContentWithQuestion/index.md b/packages/ui/src/ContentWithQuestion/index.md index 1c30516b2..164e9e382 100644 --- a/packages/ui/src/ContentWithQuestion/index.md +++ b/packages/ui/src/ContentWithQuestion/index.md @@ -21,4 +21,4 @@ nav: | prefixIcon | 文字前图标配置 | IconProps | null | - | | suffixIcon | 文字后图标配置 | IconProps | { type: 'question-circle', spin: false, pointable: true, style: { marginRight: 4 } } | - | | className | 组件 className | String | - | - | -| style | 组件 style | React.CSSProperties | - | - | \ No newline at end of file +| style | 组件 style | React.CSSProperties | - | - | diff --git a/packages/ui/src/ContentWithQuestion/index.tsx b/packages/ui/src/ContentWithQuestion/index.tsx index 58db6faab..9b5d28a54 100644 --- a/packages/ui/src/ContentWithQuestion/index.tsx +++ b/packages/ui/src/ContentWithQuestion/index.tsx @@ -69,4 +69,4 @@ const ContentWithQuestion: React.FC = ({ ); }; -export default ContentWithQuestion; \ No newline at end of file +export default ContentWithQuestion;