mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
refactor: inline-style to cssinjs (#51843)
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
* refactor: inline-style to cssinjs * fix: fix test case * fix: fix * Update components/upload/Upload.tsx Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * rename * fix: fix --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
parent
4dbb0075bb
commit
cbfe7fb454
@ -941,8 +941,7 @@ exports[`Form form should support disabled 1`] = `
|
|||||||
class="ant-upload-wrapper"
|
class="ant-upload-wrapper"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-upload ant-upload-select ant-upload-disabled"
|
class="ant-upload ant-upload-select ant-upload-disabled ant-upload-hidden"
|
||||||
style="display: none;"
|
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-upload ant-upload-disabled"
|
class="ant-upload ant-upload-disabled"
|
||||||
|
@ -469,12 +469,13 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadButtonCls = classNames(prefixCls, `${prefixCls}-select`, {
|
const uploadBtnCls = classNames(prefixCls, `${prefixCls}-select`, {
|
||||||
[`${prefixCls}-disabled`]: mergedDisabled,
|
[`${prefixCls}-disabled`]: mergedDisabled,
|
||||||
|
[`${prefixCls}-hidden`]: !children,
|
||||||
});
|
});
|
||||||
|
|
||||||
const uploadButton = (
|
const uploadButton = (
|
||||||
<div className={uploadButtonCls} style={children ? undefined : { display: 'none' }}>
|
<div className={uploadBtnCls}>
|
||||||
<RcUpload {...rcUploadProps} ref={upload} />
|
<RcUpload {...rcUploadProps} ref={upload} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -5,8 +5,7 @@ exports[`Upload rtl render component should be rendered correctly in RTL directi
|
|||||||
class="ant-upload-wrapper ant-upload-rtl"
|
class="ant-upload-wrapper ant-upload-rtl"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-upload ant-upload-select"
|
class="ant-upload ant-upload-select ant-upload-hidden"
|
||||||
style="display: none;"
|
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-upload"
|
class="ant-upload"
|
||||||
|
@ -75,10 +75,7 @@ describe('Upload List', () => {
|
|||||||
mockHeightGet.mockImplementation(() => size.height);
|
mockHeightGet.mockImplementation(() => size.height);
|
||||||
mockSrcSet.mockImplementation(function fn() {
|
mockSrcSet.mockImplementation(function fn() {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (this.onload) {
|
this.onload?.();
|
||||||
// @ts-ignore
|
|
||||||
this.onload();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mockGetCanvasContext.mockReturnValue({
|
mockGetCanvasContext.mockReturnValue({
|
||||||
@ -1629,8 +1626,8 @@ describe('Upload List', () => {
|
|||||||
<Upload fileList={list as UploadProps['defaultFileList']} listType="picture-card" />,
|
<Upload fileList={list as UploadProps['defaultFileList']} listType="picture-card" />,
|
||||||
);
|
);
|
||||||
expect(wrapper.querySelectorAll('.ant-upload-select').length).toBe(1);
|
expect(wrapper.querySelectorAll('.ant-upload-select').length).toBe(1);
|
||||||
expect(wrapper.querySelectorAll<HTMLDivElement>('.ant-upload-select')[0]?.style.display).toBe(
|
expect(wrapper.querySelector<HTMLDivElement>('.ant-upload-select')).toHaveClass(
|
||||||
'none',
|
'ant-upload-hidden',
|
||||||
);
|
);
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
@ -1654,8 +1651,8 @@ describe('Upload List', () => {
|
|||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
expect(wrapper.querySelectorAll('.ant-upload-select').length).toBe(1);
|
expect(wrapper.querySelectorAll('.ant-upload-select').length).toBe(1);
|
||||||
expect(wrapper.querySelectorAll<HTMLDivElement>('.ant-upload-select')[0]?.style.display).toBe(
|
expect(wrapper.querySelector<HTMLDivElement>('.ant-upload-select')).toHaveClass(
|
||||||
'none',
|
'ant-upload-hidden',
|
||||||
);
|
);
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
@ -40,6 +40,10 @@ const genBaseStyle: GenerateStyle<UploadToken> = (token) => {
|
|||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[`${componentCls}-hidden`]: {
|
||||||
|
display: 'none',
|
||||||
|
},
|
||||||
|
|
||||||
[`${componentCls}-disabled`]: {
|
[`${componentCls}-disabled`]: {
|
||||||
color: colorTextDisabled,
|
color: colorTextDisabled,
|
||||||
cursor: 'not-allowed',
|
cursor: 'not-allowed',
|
||||||
|
Loading…
Reference in New Issue
Block a user