mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
Merge pull request #26768 from ant-design/master
chore: merge master into feature
This commit is contained in:
commit
4a86b75c74
11
.eslintrc.js
11
.eslintrc.js
@ -113,11 +113,22 @@ module.exports = {
|
||||
|
||||
'jest/no-test-callback': 0,
|
||||
'jest/expect-expect': 0,
|
||||
'jest/no-done-callback': 0,
|
||||
'jest/valid-title': 0,
|
||||
'jest/no-conditional-expect': 0,
|
||||
|
||||
'unicorn/better-regex': 2,
|
||||
'unicorn/prefer-trim-start-end': 2,
|
||||
'unicorn/expiring-todo-comments': 2,
|
||||
'unicorn/no-abusive-eslint-disable': 2,
|
||||
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/2540#issuecomment-692866111
|
||||
'no-use-before-define': 0,
|
||||
'@typescript-eslint/no-use-before-define': 2,
|
||||
'no-shadow': 0,
|
||||
'@typescript-eslint/no-shadow': [2, { ignoreTypeValueShadow: true }],
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/2528#issuecomment-689369395
|
||||
'no-undef': 0,
|
||||
},
|
||||
globals: {
|
||||
gtag: true,
|
||||
|
19
SECURITY.md
Normal file
19
SECURITY.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 4.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use this section to tell people how to report a vulnerability.
|
||||
|
||||
Tell them where to go, how often they can expect to get an update on a
|
||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||
declined, etc.
|
@ -8,7 +8,7 @@ export const tupleNum = <T extends number[]>(...args: T) => args;
|
||||
* https://stackoverflow.com/a/59187769
|
||||
* Extract the type of an element of an array/tuple without performing indexing
|
||||
*/
|
||||
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer E)[] ? E : never;
|
||||
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer F)[] ? F : never;
|
||||
|
||||
/**
|
||||
* https://github.com/Microsoft/TypeScript/issues/29729
|
||||
|
@ -186,7 +186,7 @@ describe('Affix Render', () => {
|
||||
it.each([
|
||||
{ name: 'inner', index: 0 },
|
||||
{ name: 'outer', index: 1 },
|
||||
])(name, async ({ index }) => {
|
||||
])('inner or outer', async ({ index }) => {
|
||||
document.body.innerHTML = '<div id="mounter" />';
|
||||
|
||||
const updateCalled = jest.fn();
|
||||
|
@ -9,6 +9,8 @@ import scrollTo from '../_util/scrollTo';
|
||||
import getScroll from '../_util/getScroll';
|
||||
import AnchorContext from './context';
|
||||
|
||||
export type AnchorContainer = HTMLElement | Window;
|
||||
|
||||
function getDefaultContainer() {
|
||||
return window;
|
||||
}
|
||||
@ -38,8 +40,6 @@ type Section = {
|
||||
top: number;
|
||||
};
|
||||
|
||||
export type AnchorContainer = HTMLElement | Window;
|
||||
|
||||
export interface AnchorProps {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
|
@ -41,18 +41,6 @@ exports[`renders ./components/anchor/demo/basic.md correctly 1`] = `
|
||||
Static demo
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="ant-anchor-link"
|
||||
>
|
||||
<a
|
||||
class="ant-anchor-link-title"
|
||||
href="#components-anchor-demo-basic"
|
||||
target="_blank"
|
||||
title="Basic demo with Target"
|
||||
>
|
||||
Basic demo with Target
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="ant-anchor-link"
|
||||
>
|
||||
|
@ -22,7 +22,6 @@ ReactDOM.render(
|
||||
<Anchor>
|
||||
<Link href="#components-anchor-demo-basic" title="Basic demo" />
|
||||
<Link href="#components-anchor-demo-static" title="Static demo" />
|
||||
<Link href="#components-anchor-demo-basic" title="Basic demo with Target" target="_blank" />
|
||||
<Link href="#API" title="API">
|
||||
<Link href="#Anchor-Props" title="Anchor Props" />
|
||||
<Link href="#Link-Props" title="Link Props" />
|
||||
|
@ -19,14 +19,14 @@ import { Anchor } from 'antd';
|
||||
const { Link } = Anchor;
|
||||
|
||||
const handleClick = (
|
||||
e: React.MouseEvent<HTMLElement>,
|
||||
link: {
|
||||
title: React.ReactNode;
|
||||
href: string;
|
||||
},
|
||||
) => {
|
||||
e.preventDefault();
|
||||
console.log(link);
|
||||
e: React.MouseEvent<HTMLElement>,
|
||||
link: {
|
||||
title: React.ReactNode;
|
||||
href: string;
|
||||
},
|
||||
) => {
|
||||
e.preventDefault();
|
||||
console.log(link);
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
|
@ -22,7 +22,7 @@ For displaying anchor hyperlinks on page and jumping between them.
|
||||
| bounds | Bounding distance of anchor area | number | 5 | |
|
||||
| getContainer | Scrolling container | () => HTMLElement | () => window | |
|
||||
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 | |
|
||||
| showInkInFixed | Whether show ink-balls in Fixed mode | boolean | false | |
|
||||
| showInkInFixed | Whether show ink-balls when `affix={false}` | boolean | false | |
|
||||
| onClick | Set the handler to handle `click` event | function(e: Event, link: Object) | - | |
|
||||
| getCurrentAnchor | Customize the anchor highlight | () => string | - | |
|
||||
| targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetOffset) | number | - | |
|
||||
|
@ -23,7 +23,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_1-C1JwsC/Anchor.svg
|
||||
| bounds | 锚点区域边界 | number | 5 | |
|
||||
| getContainer | 指定滚动的容器 | () => HTMLElement | () => window | |
|
||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | |
|
||||
| showInkInFixed | 固定模式是否显示小圆点 | boolean | false | |
|
||||
| showInkInFixed | `affix={false}` 时是否显示小圆点 | boolean | false | |
|
||||
| onClick | `click` 事件的 handler | function(e: Event, link: Object) | - | |
|
||||
| getCurrentAnchor | 自定义高亮的锚点 | () => string | - | |
|
||||
| targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetOffset) | number | - | |
|
||||
|
@ -69,4 +69,13 @@ describe('AutoComplete', () => {
|
||||
wrapper.find('input').simulate('change', { target: { value: '1' } });
|
||||
expect(wrapper.find('.ant-select-item-option').length).toBe(2);
|
||||
});
|
||||
|
||||
it('should not warning when getInputElement is null', () => {
|
||||
jest.spyOn(console, 'warn').mockImplementation(() => undefined);
|
||||
mount(<AutoComplete placeholder="input here" allowClear />);
|
||||
// eslint-disable-next-line no-console
|
||||
expect(console.warn).not.toBeCalled();
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn.mockRestore();
|
||||
});
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ const AutoComplete: React.ForwardRefRenderFunction<Select, AutoCompleteProps> =
|
||||
React.useImperativeHandle<Select, Select>(ref, () => selectRef.current!);
|
||||
|
||||
// ============================= Input =============================
|
||||
let customizeInput: React.ReactElement;
|
||||
let customizeInput: React.ReactElement | undefined;
|
||||
|
||||
if (
|
||||
childNodes.length === 1 &&
|
||||
@ -56,7 +56,7 @@ const AutoComplete: React.ForwardRefRenderFunction<Select, AutoCompleteProps> =
|
||||
[customizeInput] = childNodes;
|
||||
}
|
||||
|
||||
const getInputElement = (): React.ReactElement => customizeInput;
|
||||
const getInputElement = customizeInput ? (): React.ReactElement => customizeInput! : undefined;
|
||||
|
||||
// ============================ Options ============================
|
||||
let optionChildren: React.ReactNode;
|
||||
@ -131,10 +131,10 @@ const AutoComplete: React.ForwardRefRenderFunction<Select, AutoCompleteProps> =
|
||||
|
||||
const RefAutoComplete = React.forwardRef<Select, AutoCompleteProps>(AutoComplete);
|
||||
|
||||
type RefAutoComplete = typeof RefAutoComplete & {
|
||||
type RefAutoCompleteWithOption = typeof RefAutoComplete & {
|
||||
Option: OptionType;
|
||||
};
|
||||
|
||||
(RefAutoComplete as RefAutoComplete).Option = Option;
|
||||
(RefAutoComplete as RefAutoCompleteWithOption).Option = Option;
|
||||
|
||||
export default RefAutoComplete as RefAutoComplete;
|
||||
export default RefAutoComplete as RefAutoCompleteWithOption;
|
||||
|
@ -1,3 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import InternalAvatar, { AvatarProps } from './avatar';
|
||||
import Group from './group';
|
||||
|
||||
|
@ -262,7 +262,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
||||
? spaceChildren(children, isNeedInserted() && autoInsertSpace)
|
||||
: null;
|
||||
|
||||
const linkButtonRestProps = omit(rest as AnchorButtonProps, ['htmlType', 'loading']);
|
||||
const linkButtonRestProps = omit(rest as AnchorButtonProps, ['htmlType', 'loading', 'navigate']);
|
||||
if (linkButtonRestProps.href !== undefined) {
|
||||
return (
|
||||
<a {...linkButtonRestProps} className={classes} onClick={handleClick} ref={buttonRef}>
|
||||
|
@ -214,7 +214,7 @@ describe('Calendar', () => {
|
||||
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('3'));
|
||||
});
|
||||
|
||||
it('if start.month > value.month, set value.month to start.month ', () => {
|
||||
it('if start.month > value.month, set value.month to start.month', () => {
|
||||
const value = new Moment('1990-01-03');
|
||||
const start = new Moment('2019-11-01');
|
||||
const end = new Moment('2019-03-01');
|
||||
@ -223,7 +223,7 @@ describe('Calendar', () => {
|
||||
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('10'));
|
||||
});
|
||||
|
||||
it('if change year and new month > end month, set value.month to end.month ', () => {
|
||||
it('if change year and new month > end month, set value.month to end.month', () => {
|
||||
const value = new Moment('2018-11-03');
|
||||
const start = new Moment('2000-01-01');
|
||||
const end = new Moment('2019-03-01');
|
||||
|
@ -86,6 +86,7 @@ describe('Carousel', () => {
|
||||
|
||||
describe('should works for dotPosition', () => {
|
||||
['left', 'right', 'top', 'bottom'].forEach(dotPosition => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
it(dotPosition, () => {
|
||||
const wrapper = mount(
|
||||
<Carousel dotPosition={dotPosition}>
|
||||
@ -118,12 +119,7 @@ describe('Carousel', () => {
|
||||
children: [<div key="1" />, <div key="2" />, <div key="3" />],
|
||||
});
|
||||
wrapper.update();
|
||||
expect(
|
||||
wrapper
|
||||
.find('.slick-dots li')
|
||||
.at(1)
|
||||
.hasClass('slick-active'),
|
||||
).toBeTruthy();
|
||||
expect(wrapper.find('.slick-dots li').at(1).hasClass('slick-active')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -27,10 +27,6 @@ export interface AbstractCheckboxProps<T> {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface CheckboxProps extends AbstractCheckboxProps<CheckboxChangeEvent> {
|
||||
indeterminate?: boolean;
|
||||
}
|
||||
|
||||
export interface CheckboxChangeEventTarget extends CheckboxProps {
|
||||
checked: boolean;
|
||||
}
|
||||
@ -42,6 +38,10 @@ export interface CheckboxChangeEvent {
|
||||
nativeEvent: MouseEvent;
|
||||
}
|
||||
|
||||
export interface CheckboxProps extends AbstractCheckboxProps<CheckboxChangeEvent> {
|
||||
indeterminate?: boolean;
|
||||
}
|
||||
|
||||
class Checkbox extends React.PureComponent<CheckboxProps, {}> {
|
||||
static Group: typeof CheckboxGroup;
|
||||
|
||||
|
@ -136,7 +136,7 @@ function generatePicker<DateType>(generateConfig: GenerateConfig<DateType>) {
|
||||
const RangePicker = generateRangePicker(generateConfig);
|
||||
|
||||
// =========================== Export ===========================
|
||||
type MergedDatePicker = typeof DatePicker & {
|
||||
type MergedDatePickerType = typeof DatePicker & {
|
||||
WeekPicker: typeof WeekPicker;
|
||||
MonthPicker: typeof MonthPicker;
|
||||
YearPicker: typeof YearPicker;
|
||||
@ -145,7 +145,7 @@ function generatePicker<DateType>(generateConfig: GenerateConfig<DateType>) {
|
||||
QuarterPicker: typeof QuarterPicker;
|
||||
};
|
||||
|
||||
const MergedDatePicker = DatePicker as MergedDatePicker;
|
||||
const MergedDatePicker = DatePicker as MergedDatePickerType;
|
||||
MergedDatePicker.WeekPicker = WeekPicker;
|
||||
MergedDatePicker.MonthPicker = MonthPicker;
|
||||
MergedDatePicker.YearPicker = YearPicker;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useRef, useMemo } from 'react';
|
||||
import * as React from 'react';
|
||||
import { useForm as useRcForm, FormInstance as RcFormInstance } from 'rc-field-form';
|
||||
import scrollIntoView from 'scroll-into-view-if-needed';
|
||||
import { ScrollOptions, NamePath, InternalNamePath } from '../interface';
|
||||
@ -23,9 +23,9 @@ function toNamePathStr(name: NamePath) {
|
||||
|
||||
export default function useForm<Values = any>(form?: FormInstance<Values>): [FormInstance<Values>] {
|
||||
const [rcForm] = useRcForm();
|
||||
const itemsRef = useRef<Record<string, React.ReactElement>>({});
|
||||
const itemsRef = React.useRef<Record<string, React.ReactElement>>({});
|
||||
|
||||
const wrapForm: FormInstance<Values> = useMemo(
|
||||
const wrapForm: FormInstance<Values> = React.useMemo(
|
||||
() =>
|
||||
form || {
|
||||
...rcForm,
|
||||
|
@ -6,8 +6,9 @@ import List from './FormList';
|
||||
import { FormProvider } from './context';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
type InternalForm = typeof InternalForm;
|
||||
interface Form extends InternalForm {
|
||||
type InternalFormType = typeof InternalForm;
|
||||
|
||||
interface FormInterface extends InternalFormType {
|
||||
useForm: typeof useForm;
|
||||
Item: typeof Item;
|
||||
List: typeof List;
|
||||
@ -18,7 +19,7 @@ interface Form extends InternalForm {
|
||||
create: () => void;
|
||||
}
|
||||
|
||||
const Form: Form = InternalForm as Form;
|
||||
const Form = InternalForm as FormInterface;
|
||||
|
||||
Form.Item = Item;
|
||||
Form.List = List;
|
||||
|
@ -33,7 +33,7 @@ export interface ModalStaticFunctions {
|
||||
export default function confirm(config: ModalFuncProps) {
|
||||
const div = document.createElement('div');
|
||||
document.body.appendChild(div);
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
let currentConfig = { ...config, close, visible: true } as any;
|
||||
|
||||
function destroy(...args: any[]) {
|
||||
@ -47,7 +47,7 @@ export default function confirm(config: ModalFuncProps) {
|
||||
}
|
||||
for (let i = 0; i < destroyFns.length; i++) {
|
||||
const fn = destroyFns[i];
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
if (fn === close) {
|
||||
destroyFns.splice(i, 1);
|
||||
break;
|
||||
|
@ -16,9 +16,10 @@ function modalWarn(props: ModalFuncProps) {
|
||||
return confirm(withWarn(props));
|
||||
}
|
||||
|
||||
type Modal = typeof OriginModal &
|
||||
type ModalType = typeof OriginModal &
|
||||
ModalStaticFunctions & { destroyAll: () => void; config: typeof globalConfig };
|
||||
const Modal = OriginModal as Modal;
|
||||
|
||||
const Modal = OriginModal as ModalType;
|
||||
|
||||
Modal.info = function infoFn(props: ModalFuncProps) {
|
||||
return confirm(withInfo(props));
|
||||
|
@ -1,3 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import InternalRadio from './radio';
|
||||
import Group from './group';
|
||||
import Button from './radioButton';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import { ColumnType } from './interface';
|
||||
import { ColumnProps } from './Column';
|
||||
|
||||
|
@ -80,13 +80,31 @@ exports[`Table.rowSelection fix expand on th left when selection column fixed on
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
@ -413,10 +431,22 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
@ -704,10 +734,22 @@ exports[`Table.rowSelection fix selection column on the left when any other colu
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
|
@ -5701,37 +5701,103 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
@ -6095,37 +6161,103 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] =
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
@ -7099,13 +7231,31 @@ exports[`renders ./components/table/demo/fixed-header.md correctly 1`] = `
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
@ -8521,28 +8671,76 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
@ -15361,37 +15559,103 @@ exports[`renders ./components/table/demo/sticky.md correctly 1`] = `
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
@ -16530,10 +16794,22 @@ Array [
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
|
@ -250,7 +250,7 @@ exports[`Table renders empty table with fixed columns 1`] = `
|
||||
style="overflow-x:auto;overflow-y:hidden"
|
||||
>
|
||||
<table
|
||||
style="min-width:100%;table-layout:fixed"
|
||||
style="width:1px;min-width:100%;table-layout:fixed"
|
||||
>
|
||||
<colgroup>
|
||||
<col
|
||||
@ -345,37 +345,103 @@ exports[`Table renders empty table with fixed columns 1`] = `
|
||||
>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
style="padding:0;border:0;height:0"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="height:0;overflow:hidden"
|
||||
>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-placeholder"
|
||||
|
@ -1,3 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
GetRowKey,
|
||||
ColumnType as RcColumnType,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* eslint no-use-before-define: "off" */
|
||||
/* eslint @typescript-eslint/no-use-before-define: "off" */
|
||||
import React from 'react';
|
||||
import { render, mount } from 'enzyme';
|
||||
import Transfer from '..';
|
||||
|
@ -23,8 +23,6 @@ export interface RenderResultObject {
|
||||
|
||||
export type RenderResult = React.ReactElement | RenderResultObject | string | null;
|
||||
|
||||
type TransferRender = (item: TransferItem) => RenderResult;
|
||||
|
||||
export interface TransferItem {
|
||||
key: string;
|
||||
title?: string;
|
||||
@ -33,6 +31,8 @@ export interface TransferItem {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
type TransferRender = (item: TransferItem) => RenderResult;
|
||||
|
||||
export interface ListStyle {
|
||||
direction: TransferDirection;
|
||||
}
|
||||
@ -41,6 +41,20 @@ export type SelectAllLabel =
|
||||
| React.ReactNode
|
||||
| ((info: { selectedCount: number; totalCount: number }) => React.ReactNode);
|
||||
|
||||
export interface TransferLocale {
|
||||
titles: string[];
|
||||
notFoundContent?: React.ReactNode;
|
||||
searchPlaceholder: string;
|
||||
itemUnit: string;
|
||||
itemsUnit: string;
|
||||
remove: string;
|
||||
selectAll: string;
|
||||
selectCurrent: string;
|
||||
selectInvert: string;
|
||||
removeAll: string;
|
||||
removeCurrent: string;
|
||||
}
|
||||
|
||||
export interface TransferProps {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
@ -70,20 +84,6 @@ export interface TransferProps {
|
||||
pagination?: PaginationType;
|
||||
}
|
||||
|
||||
export interface TransferLocale {
|
||||
titles: string[];
|
||||
notFoundContent?: React.ReactNode;
|
||||
searchPlaceholder: string;
|
||||
itemUnit: string;
|
||||
itemsUnit: string;
|
||||
remove: string;
|
||||
selectAll: string;
|
||||
selectCurrent: string;
|
||||
selectInvert: string;
|
||||
removeAll: string;
|
||||
removeCurrent: string;
|
||||
}
|
||||
|
||||
interface TransferState {
|
||||
sourceSelectedKeys: string[];
|
||||
targetSelectedKeys: string[];
|
||||
|
@ -539,7 +539,7 @@ describe('Upload', () => {
|
||||
errorSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('it should be treated as file but not an image', () => {
|
||||
it('should be treated as file but not an image', () => {
|
||||
const file = {
|
||||
status: 'done',
|
||||
uid: '-1',
|
||||
|
14
package.json
14
package.json
@ -162,7 +162,7 @@
|
||||
"@types/enzyme": "^3.10.5",
|
||||
"@types/gtag.js": "^0.0.3",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/jest-image-snapshot": "^3.1.0",
|
||||
"@types/jest-image-snapshot": "^4.1.0",
|
||||
"@types/lodash": "^4.14.139",
|
||||
"@types/puppeteer": "^3.0.0",
|
||||
"@types/raf": "^3.4.0",
|
||||
@ -171,8 +171,8 @@
|
||||
"@types/react-copy-to-clipboard": "^4.3.0",
|
||||
"@types/react-dom": "^16.9.5",
|
||||
"@types/warning": "^3.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.0.0",
|
||||
"@typescript-eslint/parser": "^3.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.1.1",
|
||||
"@typescript-eslint/parser": "^4.1.1",
|
||||
"antd-img-crop": "^3.1.1",
|
||||
"antd-pro-merge-less": "^3.0.9",
|
||||
"antd-theme-generator": "^1.2.3",
|
||||
@ -197,16 +197,16 @@
|
||||
"enzyme-adapter-react-16": "^1.14.0",
|
||||
"enzyme-to-json": "^3.3.5",
|
||||
"esbuild-webpack-plugin": "^1.0.0",
|
||||
"eslint": "^7.3.1",
|
||||
"eslint": "^7.9.0",
|
||||
"eslint-config-airbnb": "^18.0.0",
|
||||
"eslint-config-prettier": "^6.0.0",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-import": "^2.21.1",
|
||||
"eslint-plugin-jest": "^23.0.2",
|
||||
"eslint-plugin-jest": "^24.0.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.1",
|
||||
"eslint-plugin-markdown": "^1.0.0",
|
||||
"eslint-plugin-react": "^7.14.2",
|
||||
"eslint-plugin-react-hooks": "^4.0.0",
|
||||
"eslint-plugin-react": "^7.20.6",
|
||||
"eslint-plugin-react-hooks": "^4.1.2",
|
||||
"eslint-plugin-unicorn": "^21.0.0",
|
||||
"eslint-tinker": "^0.5.0",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
|
@ -7,6 +7,8 @@ import * as utils from '../utils';
|
||||
import './index.less';
|
||||
import AffixTabs from './AffixTabs';
|
||||
|
||||
type ContentUnit = string | Record<string, any> | ContentUnit[];
|
||||
|
||||
interface PageData {
|
||||
meta: {
|
||||
order?: number;
|
||||
@ -40,8 +42,6 @@ interface ResourcesProps {
|
||||
};
|
||||
}
|
||||
|
||||
type ContentUnit = string | Record<string, any> | ContentUnit[];
|
||||
|
||||
function getUnitString(unit: ContentUnit[]): string {
|
||||
if (!unit) return '';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user