Browse Source
type: supplementary React.FC type (#43410)
* type: supplementary React.FC type
* fix: remove useless code
* revert: remove useStyle
* revert: card-top
* Update card-top.tsx
pull/42485/merge
thinkasany
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with
20 additions and
20 deletions
-
components/button/demo/chinese-chars-loading.tsx
-
components/color-picker/__tests__/index.test.tsx
-
components/form/__tests__/index.test.tsx
-
components/form/demo/validate-only.tsx
-
components/image/demo/preview-group-top-progress.tsx
-
components/input/__tests__/index.test.tsx
-
components/input/__tests__/textarea.test.tsx
-
components/table/__tests__/Table.filter.test.tsx
-
components/tag/demo/draggable.tsx
-
components/transfer/__tests__/index.test.tsx
|
|
@ -1,13 +1,13 @@ |
|
|
|
// @ts-nocheck
|
|
|
|
import React from 'react'; |
|
|
|
import { PoweroffOutlined } from '@ant-design/icons'; |
|
|
|
import { Button, Space } from 'antd'; |
|
|
|
import React from 'react'; |
|
|
|
|
|
|
|
const Text1 = () => '部署'; |
|
|
|
const Text2 = () => <span>部署</span>; |
|
|
|
const Text3 = () => 'Submit'; |
|
|
|
|
|
|
|
const App = () => ( |
|
|
|
const App: React.FC = () => ( |
|
|
|
<Space wrap> |
|
|
|
<Button loading>部署</Button> |
|
|
|
<Button loading> |
|
|
|
|
|
@ -55,7 +55,7 @@ describe('ColorPicker', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
it('Should component custom trigger work', async () => { |
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [color, setColor] = useState<Color | string>('hsb(215, 91%, 100%)'); |
|
|
|
const colorString = useMemo( |
|
|
|
() => (typeof color === 'string' ? color : color.toHsbString()), |
|
|
|
|
|
@ -1641,7 +1641,7 @@ describe('Form', () => { |
|
|
|
<DatePicker.YearPicker key="DatePicker.YearPicker" disabled={disabled} />, |
|
|
|
<DatePicker.TimePicker key="DatePicker.TimePicker" disabled={disabled} />, |
|
|
|
]; |
|
|
|
const App = () => <Form disabled>{renderComps(false)}</Form>; |
|
|
|
const App: React.FC = () => <Form disabled>{renderComps(false)}</Form>; |
|
|
|
|
|
|
|
const wrapper = render(<App />); |
|
|
|
expect(wrapper.container.querySelectorAll('[disabled]').length).toBe(0); |
|
|
@ -1803,7 +1803,7 @@ describe('Form', () => { |
|
|
|
return <Input {...props} />; |
|
|
|
}; |
|
|
|
|
|
|
|
const App = () => ( |
|
|
|
const App: React.FC = () => ( |
|
|
|
<Form> |
|
|
|
<Form.Item> |
|
|
|
<Form.Item name="test" label="test" rules={[{ len: 3, message: 'error.' }]}> |
|
|
|
|
|
@ -26,7 +26,7 @@ const SubmitButton = ({ form }: { form: FormInstance }) => { |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [form] = Form.useForm(); |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import React from 'react'; |
|
|
|
import { Image } from 'antd'; |
|
|
|
import React from 'react'; |
|
|
|
|
|
|
|
const App = () => ( |
|
|
|
const App: React.FC = () => ( |
|
|
|
<Image.PreviewGroup |
|
|
|
preview={{ countRender: (current, total) => `当前 ${current} / 总计 ${total}` }} |
|
|
|
> |
|
|
|
|
|
@ -398,7 +398,7 @@ describe('Input allowClear', () => { |
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/31927
|
|
|
|
it('should correctly when useState', () => { |
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [query, setQuery] = useState(''); |
|
|
|
return ( |
|
|
|
<Input |
|
|
|
|
|
@ -489,7 +489,7 @@ describe('TextArea allowClear', () => { |
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/31927
|
|
|
|
it('should correctly when useState', () => { |
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [query, setQuery] = useState(''); |
|
|
|
return ( |
|
|
|
<TextArea |
|
|
|
|
|
@ -1472,7 +1472,7 @@ describe('Table.filter', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
it('filtered should work after change', () => { |
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [filtered, setFiltered] = React.useState(true); |
|
|
|
const columns = [ |
|
|
|
{ |
|
|
|
|
|
@ -1,14 +1,14 @@ |
|
|
|
import React, { useState } from 'react'; |
|
|
|
import { Tag } from 'antd'; |
|
|
|
import { DndContext, PointerSensor, useSensor, useSensors, closestCenter } from '@dnd-kit/core'; |
|
|
|
import { DndContext, PointerSensor, closestCenter, useSensor, useSensors } from '@dnd-kit/core'; |
|
|
|
import type { DragEndEvent } from '@dnd-kit/core/dist/types/index'; |
|
|
|
import { |
|
|
|
arrayMove, |
|
|
|
useSortable, |
|
|
|
SortableContext, |
|
|
|
arrayMove, |
|
|
|
horizontalListSortingStrategy, |
|
|
|
useSortable, |
|
|
|
} from '@dnd-kit/sortable'; |
|
|
|
import { Tag } from 'antd'; |
|
|
|
import type { FC } from 'react'; |
|
|
|
import type { DragEndEvent } from '@dnd-kit/core/dist/types/index'; |
|
|
|
import React, { useState } from 'react'; |
|
|
|
|
|
|
|
type Item = { |
|
|
|
id: number; |
|
|
@ -43,7 +43,7 @@ const DraggableTag: FC<DraggableTagProps> = (props) => { |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [items, setItems] = useState<Item[]>([ |
|
|
|
{ |
|
|
|
id: 1, |
|
|
|
|
|
@ -646,7 +646,7 @@ describe('Transfer', () => { |
|
|
|
it('control mode select all should not throw warning', () => { |
|
|
|
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); |
|
|
|
|
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); |
|
|
|
|
|
|
|
const onSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => { |
|
|
@ -686,7 +686,7 @@ describe('immutable data', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
it('prevent error when reset data in some cases', () => { |
|
|
|
const App = () => { |
|
|
|
const App: React.FC = () => { |
|
|
|
const [mockData, setMockData] = useState<DefaultRecordType[]>([]); |
|
|
|
const [targetKeys, setTargetKeys] = useState<string[]>([]); |
|
|
|
|
|
|
|